Re: [Intel-gfx] [PATCH v2 2/5] drm/i915: hdmi: add CEC notifier to intel_hdmi

From: Neil Armstrong
Date: Wed May 16 2018 - 03:07:44 EST


On 16/05/2018 09:31, Neil Armstrong wrote:
> Hi Ville,
>
> On 15/05/2018 17:35, Ville SyrjÃlà wrote:
>> On Tue, May 15, 2018 at 04:42:19PM +0200, Neil Armstrong wrote:
>>> This 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.
>>>
>>> Signed-off-by: Neil Armstrong <narmstrong@xxxxxxxxxxxx>
>>> ---
>>> drivers/gpu/drm/i915/Kconfig | 1 +
>>> drivers/gpu/drm/i915/intel_drv.h | 2 ++
>>> drivers/gpu/drm/i915/intel_hdmi.c | 12 ++++++++++++
>>> 3 files changed, 15 insertions(+)
>>>
>
> [..]
>
>>> }
>>>
>>> @@ -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,10 @@ 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, connector->name);
>>
>> What are we doing with the connector name here? Those are not actually
>> guaranteed to be stable, and any change in the connector probe order
>> may cause the name to change.
>
> The i915 driver can expose multiple HDMI connectors, but each connected will
> have a different EDID and CEC physical address, so we will need a different notifier
> for each connector.
>
> The connector name is DRM dependent, but user-space actually uses this name for
> operations, so I supposed it was kind of stable.
>
> Anyway, is there another stable id/name/whatever that can be used to make a name to
> distinguish the HDMI connectors ?

Would "HDMI %c", port_name(port) be OK to use ?

Neil

>
> Neil
>
>>
>>> + if (!intel_hdmi->notifier)
>>> + DRM_DEBUG_KMS("CEC notifier get failed\n");
>>> }
>>>
>>> void intel_hdmi_init(struct drm_i915_private *dev_priv,
>>> --
>>> 2.7.4
>>>
>>> _______________________________________________
>>> Intel-gfx mailing list
>>> Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
>>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
>>
>