Add ChromeOS EC CEC Support
Subsystems (7)
v6 cover Add ChromeOS EC CEC Support
Hi All,
The new Google "Fizz" Intel-based ChromeOS device is gaining CEC support through it's Embedded Controller, to enable the Linux CEC Core to communicate with it and get the CEC Physical Address from the correct HDMI Connector, the following must be added/changed:
- Add the CEC sub-device registration in the ChromeOS EC MFD Driver
- Add the CEC related commands and events definitions into the EC MFD driver
- Add a way to get a CEC notifier with it's (optional) connector name
- Add the CEC notifier to the i915 HDMI driver
- Add the proper ChromeOS EC CEC Driver
The CEC notifier with the connector name is the tricky point, since even on Device-Tree platforms, there is no way to distinguish between multiple HDMI connectors from the same DRM driver. The solution I implemented is pretty simple and only adds an optional connector name to eventually distinguish an HDMI connector notifier from another if they share the same device.
Feel free to comment this patchset !
Changes since v5:
- Small fixups on include/linux/mfd/cros_ec_commands.h
- Fixed on cros-ec-cec driver accordingly
- Added Reviewed-By tags
Changes since v4:
- Split patch 3 to move the mkbp event size change into a separate patch
Changes since v3 (incorrectly reported as v2):
- Renamed "Chrome OS" to "ChromeOS"
- Updated cros_ec_commands.h new structs definitions to kernel doc format
- Added Reviewed-By tags
Changes since v2:
- Add i915 port_identifier() and use this stable name as cec_notifier conn name
- Fixed and cleaned up the CEC commands and events handling
- Rebased the CEC sub-device registration on top of Enric's serie
- Fixed comments typo on cec driver
- Protected the DMI match only with PCI and DMI Kconfigs
Changes since v1:
- Added cec_notifier_put to intel_hdmi
- Fixed all small reported issues on the EC CEC driver
- Moved the cec_notifier_get out of the #if .. #else .. #endif
Changes since RFC:
- Moved CEC sub-device registration after CEC commands and events definitions patch
- Removed get_notifier_get_byname
- Added CEC_CORE select into i915 Kconfig
- Removed CEC driver fallback if notifier is not configured on HW, added explicit warn
- Fixed CEC core return type on error
- Moved to cros-ec-cec media platform directory
- Use bus_find_device() to find the pci i915 device instead of get_notifier_get_byname()
- Fix Logical Address setup
- Added comment about HW support
- Removed memset of msg structures
Neil Armstrong (6):
media: cec-notifier: Get notifier by device and connector name drm/i915: hdmi: add CEC notifier to intel_hdmi
mfd: cros-ec: Increase maximum mkbp event size
mfd: cros-ec: Introduce CEC commands and events definitions.
mfd: cros_ec_dev: Add CEC sub-device registration
media: platform: Add ChromeOS EC CEC driver
drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/intel_display.h | 20 ++ drivers/gpu/drm/i915/intel_drv.h | 2 + drivers/gpu/drm/i915/intel_hdmi.c | 13 + drivers/media/cec/cec-notifier.c | 11 +- drivers/media/platform/Kconfig | 11 + drivers/media/platform/Makefile | 2 + drivers/media/platform/cros-ec-cec/Makefile | 1 + drivers/media/platform/cros-ec-cec/cros-ec-cec.c | 347 +++++++++++++++++++++++ drivers/mfd/cros_ec_dev.c | 16 ++ drivers/platform/chrome/cros_ec_proto.c | 40 ++- include/linux/mfd/cros_ec.h | 2 +- include/linux/mfd/cros_ec_commands.h | 100 +++++++ include/media/cec-notifier.h | 27 +- 14 files changed, 577 insertions(+), 16 deletions(-) create mode 100644 drivers/media/platform/cros-ec-cec/Makefile create mode 100644 drivers/media/platform/cros-ec-cec/cros-ec-cec.c
Signature · 1 line
2.7.4
PATCH v6 1/6 media: cec-notifier: Get notifier by device and connector name
In non device-tree world, we can need to get the notifier by the driver name directly and eventually defer probe if not yet created.
This patch adds a variant of the get function by using the device name instead and will not create a notifier if not yet created.
But the i915 driver exposes at least 2 HDMI connectors, this patch also adds the possibility to add a connector name tied to the notifier device to form a tuple and associate different CEC controllers for each HDMI connectors.
--- drivers/media/cec/cec-notifier.c | 11 ++++++++--- include/media/cec-notifier.h | 27 ++++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 6 deletions(-)
drivers/media/cec/cec-notifier.c +8 -3
@@ -21,6 +21,7 @@ struct cec_notifier {struct list_head head;struct kref kref;struct device *dev; +const char *conn;struct cec_adapter *cec_adap;void (*callback)(struct cec_adapter *adap,u16 pa);
@@ -30,13 +31,14 @@ struct cec_notifier {static LIST_HEAD (cec_notifiers);static DEFINE_MUTEX (cec_notifiers_lock); -struct cec_notifier *cec_notifier_get (struct device *dev) +struct cec_notifier *cec_notifier_get_conn (struct device *dev,const char *conn) {struct cec_notifier *n;mutex_lock (&cec_notifiers_lock);list_for_each_entry (n, &cec_notifiers, head) { -if (n->dev == dev) { +if (n->dev == dev && + (!conn || !strcmp (n->conn, conn))) {kref_get (&n->kref);mutex_unlock (&cec_notifiers_lock);return n;
@@ -46,6 +48,8 @@ struct cec_notifier *cec_notifier_get(struct device *dev)if (!n) goto unlock; n->dev = dev; +if (conn) + n->conn =kstrdup (conn,GFP_KERNEL ); n->phys_addr =CEC_PHYS_ADDR_INVALID ;mutex_init (&n->lock);kref_init (&n->kref);
@@ -54,7 +58,7 @@ struct cec_notifier *cec_notifier_get(struct device *dev)mutex_unlock (&cec_notifiers_lock);return n; } -EXPORT_SYMBOL_GPL (cec_notifier_get); +EXPORT_SYMBOL_GPL (cec_notifier_get_conn);static void cec_notifier_release (struct kref *kref) {
@@ -62,6 +66,7 @@ static void cec_notifier_release(struct kref *kref) container_of(kref, struct cec_notifier, kref);list_del (&n->head); +kfree (n->conn);kfree (n); }
include/media/cec-notifier.h +24 -3
@@ -20,8 +20,10 @@ struct cec_notifier;#if IS_REACHABLE (CONFIG_CEC_CORE ) &&IS_ENABLED (CONFIG_CEC_NOTIFIER )/** -* cec_notifier_get - find or create a new cec_notifier for the given device. +* cec_notifier_get_conn - find or create a new cec_notifier for the given +* device and connector tuple. * @dev: device that sends the events. +* @conn: the connector name from which the event occurs * * If a notifier for device @dev already exists, then increase the refcount * and return that notifier.
@@ -31,7 +33,8 @@ struct cec_notifier;* * Return NULL if the memory could not be allocated. */ -struct cec_notifier *cec_notifier_get (struct device *dev); +struct cec_notifier *cec_notifier_get_conn (struct device *dev, +const char *conn);/** * cec_notifier_put - decrease refcount and delete when the refcount reaches 0.
@@ -85,7 +88,8 @@ void cec_register_cec_notifier(struct cec_adapter *adap, struct cec_notifier *notifier);#else -static inline struct cec_notifier *cec_notifier_get (struct device *dev) +static inline struct cec_notifier *cec_notifier_get_conn (struct device *dev, +const char *conn) {/* A non-NULL pointer is expected on success */ return (struct cec_notifier *)0xdeadfeed ;
@@ -121,6 +125,23 @@ static inline void cec_register_cec_notifier(struct cec_adapter *adap,#endif /** +* cec_notifier_get - find or create a new cec_notifier for the given device. +* @dev: device that sends the events. +* +* If a notifier for device @dev already exists, then increase the refcount +* and return that notifier. +* +* If it doesn't exist, then allocate a new notifier struct and return a +* pointer to that new struct. +* +* Return NULL if the memory could not be allocated. +*/ +static inline struct cec_notifier *cec_notifier_get (struct device *dev) +{ +return cec_notifier_get_conn (dev,NULL ); +} + +/** * cec_notifier_phys_addr_invalidate() - set the physical address to INVALID * * @n: the CEC notifier
Signature · 1 line
2.7.4
PATCH v6 2/6 drm/i915: hdmi: add CEC notifier to intel_hdmi
In reply to Neil ArmstrongThis patchs adds the cec_notifier feature to the intel_hdmi part of the i915 DRM driver. It uses the HDMI DRM connector name to differentiate between each HDMI ports.
The changes will allow the i915 HDMI code to notify EDID and HPD changes to an eventual CEC adapter.
--- drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/intel_display.h | 20 ++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ drivers/gpu/drm/i915/intel_hdmi.c | 13 +++++++++++++ 4 files changed, 36 insertions(+)
drivers/gpu/drm/i915/Kconfig +1 -0
@@ -23,6 +23,7 @@ config DRM_I915 select SYNC_FILE select IOSF_MBI select CRC32 + select CEC_CORE if CEC_NOTIFIER help Choose this option if you have a system that has "Intel Graphics Media Accelerator" or "HD Graphics" integrated graphics,
drivers/gpu/drm/i915/intel_display.h +20 -0
@@ -126,6 +126,26 @@ enum port {#define port_name (p) ((p) + 'A') +static inline const char *port_identifier (enum port port) +{ +switch (port) { +case PORT_A : +return "Port A" ; +case PORT_B : +return "Port B" ; +case PORT_C : +return "Port C" ; +case PORT_D : +return "Port D" ; +case PORT_E : +return "Port E" ; +case PORT_F : +return "Port F" ; +default : +return "<invalid>" ; + } +} +enum dpio_channel {DPIO_CH0 ,DPIO_CH1
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -39,6 +39,7 @@#include <drm/drm_dp_mst_helper.h> #include <drm/drm_rect.h> #include <drm/drm_atomic.h> +#include <media/cec-notifier.h> /** * __wait_for - magic wait macro
@@ -1001,6 +1002,7 @@ struct intel_hdmi {bool has_audio;bool rgb_quant_range_selectable;struct intel_connector *attached_connector; +struct cec_notifier *notifier; };struct intel_dp_mst_encoder ;
drivers/gpu/drm/i915/intel_hdmi.c +13 -0
@@ -1868,6 +1868,8 @@ intel_hdmi_set_edid(struct drm_connector *connector) connected = true; } +cec_notifier_set_phys_addr_from_edid (intel_hdmi->notifier, edid); +return connected; }
@@ -1876,6 +1878,7 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) {enum drm_connector_status status;struct drm_i915_private *dev_priv =to_i915 (connector->dev); +struct intel_hdmi *intel_hdmi =intel_attached_hdmi (connector);DRM_DEBUG_KMS ("[CONNECTOR:%d:%s]\n" , connector->base.id, connector->name);
@@ -1891,6 +1894,9 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)intel_display_power_put (dev_priv,POWER_DOMAIN_GMBUS ); +if (status != connector_status_connected) +cec_notifier_phys_addr_invalidate (intel_hdmi->notifier); +return status; }
@@ -2031,6 +2037,8 @@ static void chv_hdmi_pre_enable(struct intel_encoder *encoder,static void intel_hdmi_destroy (struct drm_connector *connector) { +if (intel_attached_hdmi (connector)->notifier) +cec_notifier_put (intel_attached_hdmi (connector)->notifier);kfree (to_intel_connector (connector)->detect_edid);drm_connector_cleanup (connector);kfree (connector);
@@ -2358,6 +2366,11 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,u32 temp =I915_READ (PEG_BAND_GAP_DATA );I915_WRITE (PEG_BAND_GAP_DATA , (temp & ~0xf ) |0xd ); } + + intel_hdmi->notifier =cec_notifier_get_conn (dev->dev, +port_identifier (port)); +if (!intel_hdmi->notifier) +DRM_DEBUG_KMS ("CEC notifier get failed\n" ); } void intel_hdmi_init(struct drm_i915_private *dev_priv,
Signature · 1 line
2.7.4
PATCH v6 3/6 mfd: cros-ec: Increase maximum mkbp event size
In reply to Neil ArmstrongHaving a 16 byte mkbp event size makes it possible to send CEC messages from the EC to the AP directly inside the mkbp event instead of first doing a notification and then a read.
--- drivers/platform/chrome/cros_ec_proto.c | 40 +++++++++++++++++++++++++-------- include/linux/mfd/cros_ec.h | 2 +- include/linux/mfd/cros_ec_commands.h | 19 ++++++++++++++++ 3 files changed, 51 insertions(+), 10 deletions(-)
drivers/platform/chrome/cros_ec_proto.c +31 -9
@@ -504,10 +504,31 @@ int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev, }EXPORT_SYMBOL (cros_ec_cmd_xfer_status); +static int get_next_event_xfer (struct cros_ec_device *ec_dev, +struct cros_ec_command *msg, +int version,uint32_t size) +{ +int ret; + + msg->version = version; + msg->command =EC_CMD_GET_NEXT_EVENT ; + msg->insize = size; + msg->outsize =0 ; + + ret =cros_ec_cmd_xfer (ec_dev, msg); +if (ret >0 ) { + ec_dev->event_size = ret -1 ; +memcpy (&ec_dev->event_data, msg->data, ec_dev->event_size); + } + +return ret; +} +static int get_next_event (struct cros_ec_device *ec_dev) {u8 buffer[sizeof (struct cros_ec_command ) +sizeof (ec_dev->event_data)];struct cros_ec_command *msg = (struct cros_ec_command *)&buffer; +static int cmd_version =1 ;int ret;if (ec_dev->suspended) {
@@ -515,18 +536,19 @@ static int get_next_event(struct cros_ec_device *ec_dev)return -EHOSTDOWN ; } - msg->version =0 ; - msg->command =EC_CMD_GET_NEXT_EVENT ; - msg->insize =sizeof (ec_dev->event_data); - msg->outsize =0 ; +if (cmd_version ==1 ) { + ret =get_next_event_xfer (ec_dev, msg, cmd_version, +sizeof (struct ec_response_get_next_event_v1 )); +if (ret <0 || msg->result !=EC_RES_INVALID_VERSION ) +return ret; - ret =cros_ec_cmd_xfer (ec_dev, msg); -if (ret >0 ) { - ec_dev->event_size = ret -1 ; -memcpy (&ec_dev->event_data, msg->data, -sizeof (ec_dev->event_data)); +/* Fallback to version 0 for future send attempts */ + cmd_version =0 ; } + ret =get_next_event_xfer (ec_dev, msg, cmd_version, +sizeof (struct ec_response_get_next_event )); +return ret; }
include/linux/mfd/cros_ec.h +1 -1
@@ -147,7 +147,7 @@ struct cros_ec_device {bool mkbp_event_supported;struct blocking_notifier_head event_notifier; -struct ec_response_get_next_event event_data; +struct ec_response_get_next_event_v1 event_data;int event_size;u32 host_event_wake_mask; };
include/linux/mfd/cros_ec_commands.h +19 -0
@@ -2093,12 +2093,31 @@ union ec_response_get_next_data {uint32_t sysrq; } __packed; +union ec_response_get_next_data_v1 { +uint8_t key_matrix[16 ]; + +/* Unaligned */ +uint32_t host_event; + +uint32_t buttons; +uint32_t switches; +uint32_t sysrq; +uint32_t cec_events; +uint8_t cec_message[16 ]; +} __packed; +struct ec_response_get_next_event {uint8_t event_type;/* Followed by event data if any */ union ec_response_get_next_data data; } __packed; +struct ec_response_get_next_event_v1 { +uint8_t event_type; +/* Followed by event data if any */ +union ec_response_get_next_data_v1 data; +} __packed; +/* Bit indices for buttons and switches.*/ /* Buttons */ #define EC_MKBP_POWER_BUTTON 0
Signature · 1 line
2.7.4
PATCH v6 4/6 mfd: cros-ec: Introduce CEC commands and events definitions.
In reply to Neil ArmstrongThe EC can expose a CEC bus, this patch adds the CEC related definitions needed by the cros-ec-cec driver.
--- include/linux/mfd/cros_ec_commands.h | 81 ++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+)
include/linux/mfd/cros_ec_commands.h +81 -0
@@ -804,6 +804,8 @@ enum ec_feature_code {EC_FEATURE_MOTION_SENSE_FIFO =24 ,/* EC has RTC feature that can be controlled by host commands */ EC_FEATURE_RTC =27 , +/* EC supports CEC commands */ + EC_FEATURE_CEC = 35, };#define EC_FEATURE_MASK_0 (event_code) (1UL << (event_code % 32))
@@ -2078,6 +2080,12 @@ enum ec_mkbp_event {/* EC sent a sysrq command */ EC_MKBP_EVENT_SYSRQ =6 , +/* Notify the AP that something happened on CEC */ +EC_MKBP_EVENT_CEC_EVENT =8 , + +/* Send an incoming CEC message to the AP */ +EC_MKBP_EVENT_CEC_MESSAGE =9 , +/* Number of MKBP events */ EC_MKBP_EVENT_COUNT, };
@@ -2850,6 +2858,79 @@ struct ec_params_reboot_ec {/*****************************************************************************/ /* +* HDMI CEC commands +* +* These commands are for sending and receiving message via HDMI CEC +*/ +#define EC_MAX_CEC_MSG_LEN 16 + +/* CEC message from the AP to be written on the CEC bus */ +#define EC_CMD_CEC_WRITE_MSG 0x00B8 + +/** +* struct ec_params_cec_write - Message to write to the CEC bus +* @msg: message content to write to the CEC bus +*/ +struct ec_params_cec_write { +uint8_t msg[EC_MAX_CEC_MSG_LEN ]; +} __packed; + +/* Set various CEC parameters */ +#define EC_CMD_CEC_SET 0x00BA + +/** +* struct ec_params_cec_set - CEC parameters set +* @cmd: parameter type, can be CEC_CMD_ENABLE or CEC_CMD_LOGICAL_ADDRESS +* @val: in case cmd is CEC_CMD_ENABLE, this field can be 0 to disable CEC +* or 1 to enable CEC functionnality, in case cmd is CEC_CMD_LOGICAL_ADDRESS, +* this field encodes the requested logical address between 0 and 15 +* or 0xff to unregister +*/ +struct ec_params_cec_set { +uint8_t cmd;/* enum cec_command */ +uint8_t val; +} __packed; + +/* Read various CEC parameters */ +#define EC_CMD_CEC_GET 0x00BB + +/** +* struct ec_params_cec_get - CEC parameters get +* @cmd: parameter type, can be CEC_CMD_ENABLE or CEC_CMD_LOGICAL_ADDRESS +*/ +struct ec_params_cec_get { +uint8_t cmd;/* enum cec_command */ +} __packed; + +/** +* struct ec_response_cec_get - CEC parameters get response +* @val: in case cmd was CEC_CMD_ENABLE, this field will 0 if CEC is +* disabled or 1 if CEC functionnality is enabled, +* in case cmd was CEC_CMD_LOGICAL_ADDRESS, this will encode the +* configured logical address between 0 and 15 or 0xff if unregistered +*/ +struct ec_response_cec_get { +uint8_t val; +} __packed; + +/* CEC parameters command */ +enum ec_cec_command { +/* CEC reading, writing and events enable */ +CEC_CMD_ENABLE , +/* CEC logical address */ +CEC_CMD_LOGICAL_ADDRESS , +}; + +/* Events from CEC to AP */ +enum mkbp_cec_event { +/* Outgoing message was acknowledged by a follower */ +EC_MKBP_CEC_SEND_OK =BIT (0 ), +/* Outgoing message was not acknowledged */ +EC_MKBP_CEC_SEND_FAILED =BIT (1 ), +}; + +/*****************************************************************************/ +/* * Special commands * * These do not follow the normal rules for commands. See each command for
Signature · 1 line
2.7.4
PATCH v6 5/6 mfd: cros_ec_dev: Add CEC sub-device registration
In reply to Neil ArmstrongThe EC can expose a CEC bus, thus add the cros-ec-cec MFD sub-device when the CEC feature bit is present.
--- drivers/mfd/cros_ec_dev.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/mfd/cros_ec_dev.c +16 -0
@@ -383,6 +383,10 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)kfree (msg); } +static const struct mfd_cell cros_ec_cec_cells[] = { + { .name ="cros-ec-cec" } +}; +static const struct mfd_cell cros_ec_rtc_cells[] = { { .name ="cros-ec-rtc" } };
@@ -426,6 +430,18 @@ static int ec_device_probe(struct platform_device *pdev)if (cros_ec_check_features (ec,EC_FEATURE_MOTION_SENSE ))cros_ec_sensors_register (ec); +/* Check whether this EC instance has CEC host command support */ +if (cros_ec_check_features (ec,EC_FEATURE_CEC )) { + retval =mfd_add_devices (ec->dev,PLATFORM_DEVID_AUTO , + cros_ec_cec_cells, +ARRAY_SIZE (cros_ec_cec_cells), +NULL ,0 ,NULL ); +if (retval) +dev_err (ec->dev, +"failed to add cros-ec-cec device: %d\n" , + retval); + } +/* Check whether this EC instance has RTC host command support */ if (cros_ec_check_features (ec,EC_FEATURE_RTC )) { retval = mfd_add_devices(ec->dev, PLATFORM_DEVID_AUTO,
Signature · 1 line
2.7.4
PATCH v6 6/6 media: platform: Add ChromeOS EC CEC driver
In reply to Neil ArmstrongThe ChromeOS Embedded Controller can expose a CEC bus, this patch add the driver for such feature of the Embedded Controller.
This driver is part of the cros-ec MFD and will be add as a sub-device when the feature bit is exposed by the EC.
The controller will only handle a single logical address and handles all the messages retries and will only expose Success or Error.
The controller will be tied to the HDMI CEC notifier by using the platform DMI Data and the i915 device name and connector name.
--- drivers/media/platform/Kconfig | 11 + drivers/media/platform/Makefile | 2 + drivers/media/platform/cros-ec-cec/Makefile | 1 + drivers/media/platform/cros-ec-cec/cros-ec-cec.c | 347 +++++++++++++++++++++++ 4 files changed, 361 insertions(+) create mode 100644 drivers/media/platform/cros-ec-cec/Makefile create mode 100644 drivers/media/platform/cros-ec-cec/cros-ec-cec.c
drivers/media/platform/Kconfig +11 -0
@@ -546,6 +546,17 @@ menuconfig CEC_PLATFORM_DRIVERS if CEC_PLATFORM_DRIVERS +config VIDEO_CROS_EC_CEC + tristate "ChromeOS EC CEC driver" + depends on MFD_CROS_EC || COMPILE_TEST + select CEC_CORE + select CEC_NOTIFIER + ---help--- + If you say yes here you will get support for the + ChromeOS Embedded Controller's CEC. + The CEC bus is present in the HDMI connector and enables communication + between compatible devices. + config VIDEO_MESON_AO_CEC tristate "Amlogic Meson AO CEC driver" depends on ARCH_MESON || COMPILE_TEST
drivers/media/platform/Makefile +2 -0
@@ -92,3 +92,5 @@ obj-$(CONFIG_VIDEO_QCOM_CAMSS) += qcom/camss-8x16/ obj-$(CONFIG_VIDEO_QCOM_VENUS) += qcom/venus/ obj-y += meson/ + +obj-y += cros-ec-cec/
drivers/media/platform/cros-ec-cec/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_VIDEO_CROS_EC_CEC) += cros-ec-cec.o
drivers/media/platform/cros-ec-cec/cros-ec-cec.c new file +347 -0
347 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v6 4/6] mfd: cros-ec: Introduce CEC commands and events definitions.
In reply to Neil ArmstrongQuoted 5 lines · Neil Armstrong
The EC can expose a CEC bus, this patch adds the CEC related definitions needed by the cros-ec-cec driver.
Signed-off-by Neil Armstrong <[email protected]>
Thanks!
Hans
Quoted 111 lines
--- include/linux/mfd/cros_ec_commands.h | 81 ++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+)include/linux/mfd/cros_ec_commands.h +81
-0@@ -804,6 +804,8 @@ enum ec_feature_code {EC_FEATURE_MOTION_SENSE_FIFO =24 ,/* EC has RTC feature that can be controlled by host commands */ EC_FEATURE_RTC =27 , +/* EC supports CEC commands */ + EC_FEATURE_CEC = 35, };#define EC_FEATURE_MASK_0 (event_code) (1UL << (event_code % 32))@@ -2078,6 +2080,12 @@ enum ec_mkbp_event {/* EC sent a sysrq command */ EC_MKBP_EVENT_SYSRQ =6 , +/* Notify the AP that something happened on CEC */ +EC_MKBP_EVENT_CEC_EVENT =8 , + +/* Send an incoming CEC message to the AP */ +EC_MKBP_EVENT_CEC_MESSAGE =9 , +/* Number of MKBP events */ EC_MKBP_EVENT_COUNT, };@@ -2850,6 +2858,79 @@ struct ec_params_reboot_ec {/*****************************************************************************/ /* +* HDMI CEC commands +* +* These commands are for sending and receiving message via HDMI CEC +*/ +#define EC_MAX_CEC_MSG_LEN 16 + +/* CEC message from the AP to be written on the CEC bus */ +#define EC_CMD_CEC_WRITE_MSG 0x00B8 + +/** +* struct ec_params_cec_write - Message to write to the CEC bus +* @msg: message content to write to the CEC bus +*/ +struct ec_params_cec_write { +uint8_t msg[EC_MAX_CEC_MSG_LEN ]; +} __packed; + +/* Set various CEC parameters */ +#define EC_CMD_CEC_SET 0x00BA + +/** +* struct ec_params_cec_set - CEC parameters set +* @cmd: parameter type, can be CEC_CMD_ENABLE or CEC_CMD_LOGICAL_ADDRESS +* @val: in case cmd is CEC_CMD_ENABLE, this field can be 0 to disable CEC +* or 1 to enable CEC functionnality, in case cmd is CEC_CMD_LOGICAL_ADDRESS, +* this field encodes the requested logical address between 0 and 15 +* or 0xff to unregister +*/ +struct ec_params_cec_set { +uint8_t cmd;/* enum cec_command */ +uint8_t val; +} __packed; + +/* Read various CEC parameters */ +#define EC_CMD_CEC_GET 0x00BB + +/** +* struct ec_params_cec_get - CEC parameters get +* @cmd: parameter type, can be CEC_CMD_ENABLE or CEC_CMD_LOGICAL_ADDRESS +*/ +struct ec_params_cec_get { +uint8_t cmd;/* enum cec_command */ +} __packed; + +/** +* struct ec_response_cec_get - CEC parameters get response +* @val: in case cmd was CEC_CMD_ENABLE, this field will 0 if CEC is +* disabled or 1 if CEC functionnality is enabled, +* in case cmd was CEC_CMD_LOGICAL_ADDRESS, this will encode the +* configured logical address between 0 and 15 or 0xff if unregistered +*/ +struct ec_response_cec_get { +uint8_t val; +} __packed; + +/* CEC parameters command */ +enum ec_cec_command { +/* CEC reading, writing and events enable */ +CEC_CMD_ENABLE , +/* CEC logical address */ +CEC_CMD_LOGICAL_ADDRESS , +}; + +/* Events from CEC to AP */ +enum mkbp_cec_event { +/* Outgoing message was acknowledged by a follower */ +EC_MKBP_CEC_SEND_OK =BIT (0 ), +/* Outgoing message was not acknowledged */ +EC_MKBP_CEC_SEND_FAILED =BIT (1 ), +}; + +/*****************************************************************************/ +/* * Special commands * * These do not follow the normal rules for commands. See each command for
Re: [PATCH v6 5/6] mfd: cros_ec_dev: Add CEC sub-device registration
In reply to Neil ArmstrongQuoted 5 lines · Neil Armstrong
The EC can expose a CEC bus, thus add the cros-ec-cec MFD sub-device when the CEC feature bit is present.
Signed-off-by Neil Armstrong <[email protected]>Reviewed-by Enric Balletbo i Serra <[email protected]>
For whatever it is worth:
Regards,
Hans
Quoted 39 lines
--- drivers/mfd/cros_ec_dev.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)drivers/mfd/cros_ec_dev.c +16
-0@@ -383,6 +383,10 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)kfree (msg); } +static const struct mfd_cell cros_ec_cec_cells[] = { + { .name ="cros-ec-cec" } +}; +static const struct mfd_cell cros_ec_rtc_cells[] = { { .name ="cros-ec-rtc" } };@@ -426,6 +430,18 @@ static int ec_device_probe(struct platform_device *pdev)if (cros_ec_check_features (ec,EC_FEATURE_MOTION_SENSE ))cros_ec_sensors_register (ec); +/* Check whether this EC instance has CEC host command support */ +if (cros_ec_check_features (ec,EC_FEATURE_CEC )) { + retval =mfd_add_devices (ec->dev,PLATFORM_DEVID_AUTO , + cros_ec_cec_cells, +ARRAY_SIZE (cros_ec_cec_cells), +NULL ,0 ,NULL ); +if (retval) +dev_err (ec->dev, +"failed to add cros-ec-cec device: %d\n" , + retval); + } +/* Check whether this EC instance has RTC host command support */ if (cros_ec_check_features (ec,EC_FEATURE_RTC )) { retval = mfd_add_devices(ec->dev, PLATFORM_DEVID_AUTO,
Patchwork
CI✗ Fi.CI.BAT: failure for Add ChromeOS EC CEC Support (rev7)
In reply to Neil Armstrong== Series Details ==
== Series Details ==
Series: Add ChromeOS EC CEC Support (rev7)
URL : https://patchwork.freedesktop.org/series/43162/
State : failure
== Summary ==
Applying: media: cec-notifier: Get notifier by device and connector name
Applying: drm/i915: hdmi: add CEC notifier to intel_hdmi
Applying: mfd: cros-ec: Increase maximum mkbp event size
Applying: mfd: cros-ec: Introduce CEC commands and events definitions.
Applying: mfd: cros_ec_dev: Add CEC sub-device registration
error: sha1 information is lacking or useless (drivers/mfd/cros_ec_dev.c).
error: could not build fake ancestor
Patch failed at 0005 mfd: cros_ec_dev: Add CEC sub-device registration The copy of the patch that failed is found in: .git/rebase-apply/patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH v6 2/6] drm/i915: hdmi: add CEC notifier to intel_hdmi
In reply to Neil ArmstrongQuoted 44 lines · Neil Armstrong
This patchs adds the
cec_notifierfeature to theintel_hdmipart of the i915 DRM driver. It uses the HDMI DRM connector name to differentiate between each HDMI ports.
The changes will allow the i915 HDMI code to notify EDID and HPD changes to an eventual CEC adapter.Signed-off-by Neil Armstrong <[email protected]>Reviewed-by Hans Verkuil <[email protected]>--- drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/intel_display.h | 20 ++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ drivers/gpu/drm/i915/intel_hdmi.c | 13 +++++++++++++ 4 files changed, 36 insertions(+)drivers/gpu/drm/i915/Kconfig +1
-0@@ -23,6 +23,7 @@ config DRM_I915 select SYNC_FILE select IOSF_MBI select CRC32 + select CEC_CORE if CEC_NOTIFIER help Choose this option if you have a system that has "Intel Graphics Media Accelerator" or "HD Graphics" integrated graphics,drivers/gpu/drm/i915/intel_display.h +9
-0@@ -126,6 +126,26 @@ enum port {#define port_name (p) ((p) + 'A') +static inline const char *port_identifier (enum port port) +{ +switch (port) { +case PORT_A : +return "Port A" ; +case PORT_B : +return "Port B" ; +case PORT_C : +return "Port C" ;
drivers/gpu/drm/i915/intel_display.h enum port { · line 147
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.h +10
-0+case PORT_D : +return "Port D" ; +case PORT_E : +return "Port E" ; +case PORT_F : +return "Port F" ; +default : +return "<invalid>" ; + } +}
Could use a comment to make it clear that this identifier is expected to remain stable since it's referenced from other drivers.
Quoted 17 lines
drivers/gpu/drm/i915/intel_display.h +1
-0+enum dpio_channel {DPIO_CH0 ,DPIO_CH1 drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -39,6 +39,7 @@#include <drm/drm_dp_mst_helper.h> #include <drm/drm_rect.h> #include <drm/drm_atomic.h> +#include <media/cec-notifier.h> /** * __wait_for - magic wait macro
drivers/gpu/drm/i915/intel_drv.h struct intel_hdmi { · line 1005
Quoted 4 lines
drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -1001,6 +1002,7 @@ struct intel_hdmi {bool has_audio;bool rgb_quant_range_selectable;struct intel_connector *attached_connector; +struct cec_notifier *notifier;
"notifier" seems a bit too generic a name. "cec_notifier" would be better.
Apart from that this seems OK to me
Quoted 62 lines
drivers/gpu/drm/i915/intel_drv.h +0
-0};struct intel_dp_mst_encoder ;drivers/gpu/drm/i915/intel_hdmi.c +13
-0@@ -1868,6 +1868,8 @@ intel_hdmi_set_edid(struct drm_connector *connector) connected = true; } +cec_notifier_set_phys_addr_from_edid (intel_hdmi->notifier, edid); +return connected; }@@ -1876,6 +1878,7 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) {enum drm_connector_status status;struct drm_i915_private *dev_priv =to_i915 (connector->dev); +struct intel_hdmi *intel_hdmi =intel_attached_hdmi (connector);DRM_DEBUG_KMS ("[CONNECTOR:%d:%s]\n" , connector->base.id, connector->name);@@ -1891,6 +1894,9 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)intel_display_power_put (dev_priv,POWER_DOMAIN_GMBUS ); +if (status != connector_status_connected) +cec_notifier_phys_addr_invalidate (intel_hdmi->notifier); +return status; }@@ -2031,6 +2037,8 @@ static void chv_hdmi_pre_enable(struct intel_encoder *encoder,static void intel_hdmi_destroy (struct drm_connector *connector) { +if (intel_attached_hdmi (connector)->notifier) +cec_notifier_put (intel_attached_hdmi (connector)->notifier);kfree (to_intel_connector (connector)->detect_edid);drm_connector_cleanup (connector);kfree (connector);@@ -2358,6 +2366,11 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,u32 temp =I915_READ (PEG_BAND_GAP_DATA );I915_WRITE (PEG_BAND_GAP_DATA , (temp & ~0xf ) |0xd ); } + + intel_hdmi->notifier =cec_notifier_get_conn (dev->dev, +port_identifier (port)); +if (!intel_hdmi->notifier) +DRM_DEBUG_KMS ("CEC notifier get failed\n" ); } void intel_hdmi_init(struct drm_i915_private *dev_priv,Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel
Re: [Intel-gfx] [PATCH v6 2/6] drm/i915: hdmi: add CEC notifier to intel_hdmi
Quoted 84 lines · Ville Syrjälä
Quoted 44 lines · Neil Armstrong
This patchs adds the
cec_notifierfeature to theintel_hdmipart of the i915 DRM driver. It uses the HDMI DRM connector name to differentiate between each HDMI ports.
The changes will allow the i915 HDMI code to notify EDID and HPD changes to an eventual CEC adapter.Signed-off-by Neil Armstrong <[email protected]>Reviewed-by Hans Verkuil <[email protected]>--- drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/intel_display.h | 20 ++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ drivers/gpu/drm/i915/intel_hdmi.c | 13 +++++++++++++ 4 files changed, 36 insertions(+)drivers/gpu/drm/i915/Kconfig +1
-0@@ -23,6 +23,7 @@ config DRM_I915 select SYNC_FILE select IOSF_MBI select CRC32 + select CEC_CORE if CEC_NOTIFIER help Choose this option if you have a system that has "Intel Graphics Media Accelerator" or "HD Graphics" integrated graphics,drivers/gpu/drm/i915/intel_display.h +9
-0@@ -126,6 +126,26 @@ enum port {#define port_name (p) ((p) + 'A') +static inline const char *port_identifier (enum port port) +{ +switch (port) { +case PORT_A : +return "Port A" ; +case PORT_B : +return "Port B" ; +case PORT_C : +return "Port C" ;drivers/gpu/drm/i915/intel_display.h enum port { · line 147
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.h +10
-0+case PORT_D : +return "Port D" ; +case PORT_E : +return "Port E" ; +case PORT_F : +return "Port F" ; +default : +return "<invalid>" ; + } +}Could use a comment to make it clear that this identifier is expected to remain stable since it's referenced from other drivers.
Quoted 17 lines
drivers/gpu/drm/i915/intel_display.h +1
-0+enum dpio_channel {DPIO_CH0 ,DPIO_CH1 drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -39,6 +39,7 @@#include <drm/drm_dp_mst_helper.h> #include <drm/drm_rect.h> #include <drm/drm_atomic.h> +#include <media/cec-notifier.h> /** * __wait_for - magic wait macro drivers/gpu/drm/i915/intel_drv.h struct intel_hdmi { · line 1005
Quoted 4 lines
drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -1001,6 +1002,7 @@ struct intel_hdmi {bool has_audio;bool rgb_quant_range_selectable;struct intel_connector *attached_connector; +struct cec_notifier *notifier;"notifier" seems a bit too generic a name. "
cec_notifier" would be better.
Quoted 2 lines
Apart from that this seems OK to me
Reviewed-by Ville Syrjälä <[email protected]>
It seems that you will need to push this to other trees right? Feel free to use:
Quoted 71 lines
Quoted 63 lines
drivers/gpu/drm/i915/intel_drv.h +0
-0};struct intel_dp_mst_encoder ;drivers/gpu/drm/i915/intel_hdmi.c +13
-0@@ -1868,6 +1868,8 @@ intel_hdmi_set_edid(struct drm_connector *connector) connected = true; } +cec_notifier_set_phys_addr_from_edid (intel_hdmi->notifier, edid); +return connected; }@@ -1876,6 +1878,7 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) {enum drm_connector_status status;struct drm_i915_private *dev_priv =to_i915 (connector->dev); +struct intel_hdmi *intel_hdmi =intel_attached_hdmi (connector);DRM_DEBUG_KMS ("[CONNECTOR:%d:%s]\n" , connector->base.id, connector->name);@@ -1891,6 +1894,9 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)intel_display_power_put (dev_priv,POWER_DOMAIN_GMBUS ); +if (status != connector_status_connected) +cec_notifier_phys_addr_invalidate (intel_hdmi->notifier); +return status; }@@ -2031,6 +2037,8 @@ static void chv_hdmi_pre_enable(struct intel_encoder *encoder,static void intel_hdmi_destroy (struct drm_connector *connector) { +if (intel_attached_hdmi (connector)->notifier) +cec_notifier_put (intel_attached_hdmi (connector)->notifier);kfree (to_intel_connector (connector)->detect_edid);drm_connector_cleanup (connector);kfree (connector);@@ -2358,6 +2366,11 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,u32 temp =I915_READ (PEG_BAND_GAP_DATA );I915_WRITE (PEG_BAND_GAP_DATA , (temp & ~0xf ) |0xd ); } + + intel_hdmi->notifier =cec_notifier_get_conn (dev->dev, +port_identifier (port)); +if (!intel_hdmi->notifier) +DRM_DEBUG_KMS ("CEC notifier get failed\n" ); } void intel_hdmi_init(struct drm_i915_private *dev_priv,Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 6 lines
Ville Syrjälä Intel _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Intel-gfx] [PATCH v6 2/6] drm/i915: hdmi: add CEC notifier to intel_hdmi
In reply to Ville SyrjäläQuoted 73 lines · Ville Syrjälä
Quoted 44 lines · Neil Armstrong
This patchs adds the
cec_notifierfeature to theintel_hdmipart of the i915 DRM driver. It uses the HDMI DRM connector name to differentiate between each HDMI ports.
The changes will allow the i915 HDMI code to notify EDID and HPD changes to an eventual CEC adapter.Signed-off-by Neil Armstrong <[email protected]>Reviewed-by Hans Verkuil <[email protected]>--- drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/intel_display.h | 20 ++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ drivers/gpu/drm/i915/intel_hdmi.c | 13 +++++++++++++ 4 files changed, 36 insertions(+)drivers/gpu/drm/i915/Kconfig +1
-0@@ -23,6 +23,7 @@ config DRM_I915 select SYNC_FILE select IOSF_MBI select CRC32 + select CEC_CORE if CEC_NOTIFIER help Choose this option if you have a system that has "Intel Graphics Media Accelerator" or "HD Graphics" integrated graphics,drivers/gpu/drm/i915/intel_display.h +9
-0@@ -126,6 +126,26 @@ enum port {#define port_name (p) ((p) + 'A') +static inline const char *port_identifier (enum port port) +{ +switch (port) { +case PORT_A : +return "Port A" ; +case PORT_B : +return "Port B" ; +case PORT_C : +return "Port C" ;drivers/gpu/drm/i915/intel_display.h enum port { · line 147
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.h +10
-0+case PORT_D : +return "Port D" ; +case PORT_E : +return "Port E" ; +case PORT_F : +return "Port F" ; +default : +return "<invalid>" ; + } +}Could use a comment to make it clear that this identifier is expected to remain stable since it's referenced from other drivers.
Quoted 14 lines
drivers/gpu/drm/i915/intel_display.h +1
-0+enum dpio_channel {DPIO_CH0 ,DPIO_CH1 drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -39,6 +39,7 @@#include <drm/drm_dp_mst_helper.h> #include <drm/drm_rect.h> #include <drm/drm_atomic.h> +#include <media/cec-notifier.h>
Quoted 10 lines
drivers/gpu/drm/i915/intel_drv.h struct intel_hdmi { · line 1005
Quoted 7 lines
drivers/gpu/drm/i915/intel_drv.h +1
-0/** * __wait_for - magic wait macro @@ -1001,6 +1002,7 @@ struct intel_hdmi {bool has_audio;bool rgb_quant_range_selectable;struct intel_connector *attached_connector; +struct cec_notifier *notifier;"notifier" seems a bit too generic a name. "
cec_notifier" would be better.
OK
Quoted 3 lines
Apart from that this seems OK to me
Reviewed-by Ville Syrjälä <[email protected]>
Thanks for the review !
Neil
Quoted 55 lines
Quoted 55 lines
drivers/gpu/drm/i915/intel_drv.h +0
-0};struct intel_dp_mst_encoder ;drivers/gpu/drm/i915/intel_hdmi.c +13
-0@@ -1868,6 +1868,8 @@ intel_hdmi_set_edid(struct drm_connector *connector) connected = true; } +cec_notifier_set_phys_addr_from_edid (intel_hdmi->notifier, edid); +return connected; }@@ -1876,6 +1878,7 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) {enum drm_connector_status status;struct drm_i915_private *dev_priv =to_i915 (connector->dev); +struct intel_hdmi *intel_hdmi =intel_attached_hdmi (connector);DRM_DEBUG_KMS ("[CONNECTOR:%d:%s]\n" , connector->base.id, connector->name);@@ -1891,6 +1894,9 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)intel_display_power_put (dev_priv,POWER_DOMAIN_GMBUS ); +if (status != connector_status_connected) +cec_notifier_phys_addr_invalidate (intel_hdmi->notifier); +return status; }@@ -2031,6 +2037,8 @@ static void chv_hdmi_pre_enable(struct intel_encoder *encoder,static void intel_hdmi_destroy (struct drm_connector *connector) { +if (intel_attached_hdmi (connector)->notifier) +cec_notifier_put (intel_attached_hdmi (connector)->notifier);kfree (to_intel_connector (connector)->detect_edid);drm_connector_cleanup (connector);kfree (connector);@@ -2358,6 +2366,11 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,u32 temp =I915_READ (PEG_BAND_GAP_DATA );I915_WRITE (PEG_BAND_GAP_DATA , (temp & ~0xf ) |0xd ); } + + intel_hdmi->notifier =cec_notifier_get_conn (dev->dev, +port_identifier (port)); +if (!intel_hdmi->notifier) +DRM_DEBUG_KMS ("CEC notifier get failed\n" ); }
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_hdmi.c +0
-0void intel_hdmi_init(struct drm_i915_private *dev_priv,Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Intel-gfx] [PATCH v6 2/6] drm/i915: hdmi: add CEC notifier to intel_hdmi
In reply to Rodrigo ViviQuoted 85 lines · Rodrigo Vivi
Quoted 84 lines · Ville Syrjälä
Quoted 44 lines · Neil Armstrong
This patchs adds the
cec_notifierfeature to theintel_hdmipart of the i915 DRM driver. It uses the HDMI DRM connector name to differentiate between each HDMI ports.
The changes will allow the i915 HDMI code to notify EDID and HPD changes to an eventual CEC adapter.Signed-off-by Neil Armstrong <[email protected]>Reviewed-by Hans Verkuil <[email protected]>--- drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/intel_display.h | 20 ++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ drivers/gpu/drm/i915/intel_hdmi.c | 13 +++++++++++++ 4 files changed, 36 insertions(+)drivers/gpu/drm/i915/Kconfig +1
-0@@ -23,6 +23,7 @@ config DRM_I915 select SYNC_FILE select IOSF_MBI select CRC32 + select CEC_CORE if CEC_NOTIFIER help Choose this option if you have a system that has "Intel Graphics Media Accelerator" or "HD Graphics" integrated graphics,drivers/gpu/drm/i915/intel_display.h +9
-0@@ -126,6 +126,26 @@ enum port {#define port_name (p) ((p) + 'A') +static inline const char *port_identifier (enum port port) +{ +switch (port) { +case PORT_A : +return "Port A" ; +case PORT_B : +return "Port B" ; +case PORT_C : +return "Port C" ;drivers/gpu/drm/i915/intel_display.h enum port { · line 147
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.h +10
-0+case PORT_D : +return "Port D" ; +case PORT_E : +return "Port E" ; +case PORT_F : +return "Port F" ; +default : +return "<invalid>" ; + } +}Could use a comment to make it clear that this identifier is expected to remain stable since it's referenced from other drivers.
Quoted 17 lines
drivers/gpu/drm/i915/intel_display.h +1
-0+enum dpio_channel {DPIO_CH0 ,DPIO_CH1 drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -39,6 +39,7 @@#include <drm/drm_dp_mst_helper.h> #include <drm/drm_rect.h> #include <drm/drm_atomic.h> +#include <media/cec-notifier.h> /** * __wait_for - magic wait macro drivers/gpu/drm/i915/intel_drv.h struct intel_hdmi { · line 1005
Quoted 4 lines
drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -1001,6 +1002,7 @@ struct intel_hdmi {bool has_audio;bool rgb_quant_range_selectable;struct intel_connector *attached_connector; +struct cec_notifier *notifier;"notifier" seems a bit too generic a name. "
cec_notifier" would be better.
Quoted 7 lines
Quoted 2 lines
Apart from that this seems OK to me
Reviewed-by Ville Syrjälä <[email protected]>It seems that you will need to push this to other trees right? Feel free to use:
Acked-by Rodrigo Vivi <[email protected]>
You are right, it will useful, thanks !
Neil
Quoted 60 lines
Quoted 60 lines
Quoted 60 lines
drivers/gpu/drm/i915/intel_drv.h +0
-0};struct intel_dp_mst_encoder ;drivers/gpu/drm/i915/intel_hdmi.c +13
-0@@ -1868,6 +1868,8 @@ intel_hdmi_set_edid(struct drm_connector *connector) connected = true; } +cec_notifier_set_phys_addr_from_edid (intel_hdmi->notifier, edid); +return connected; }@@ -1876,6 +1878,7 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) {enum drm_connector_status status;struct drm_i915_private *dev_priv =to_i915 (connector->dev); +struct intel_hdmi *intel_hdmi =intel_attached_hdmi (connector);DRM_DEBUG_KMS ("[CONNECTOR:%d:%s]\n" , connector->base.id, connector->name);@@ -1891,6 +1894,9 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)intel_display_power_put (dev_priv,POWER_DOMAIN_GMBUS ); +if (status != connector_status_connected) +cec_notifier_phys_addr_invalidate (intel_hdmi->notifier); +return status; }@@ -2031,6 +2037,8 @@ static void chv_hdmi_pre_enable(struct intel_encoder *encoder,static void intel_hdmi_destroy (struct drm_connector *connector) { +if (intel_attached_hdmi (connector)->notifier) +cec_notifier_put (intel_attached_hdmi (connector)->notifier);kfree (to_intel_connector (connector)->detect_edid);drm_connector_cleanup (connector);kfree (connector);@@ -2358,6 +2366,11 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,u32 temp =I915_READ (PEG_BAND_GAP_DATA );I915_WRITE (PEG_BAND_GAP_DATA , (temp & ~0xf ) |0xd ); } + + intel_hdmi->notifier =cec_notifier_get_conn (dev->dev, +port_identifier (port)); +if (!intel_hdmi->notifier) +DRM_DEBUG_KMS ("CEC notifier get failed\n" ); } void intel_hdmi_init(struct drm_i915_private *dev_priv,Signature · 1 line
2.7.4
Quoted 12 lines
Quoted 12 lines
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 6 lines
Ville Syrjälä Intel _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx