Re: [PATCH] drm/i915: added i2c symlink to hdmi connector

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 17, 2019 at 07:21:09PM +0300, Oleg Vasilev wrote:
> Currently, the i2c adapter was available only under DP connectors.
> 
> This patch adds i2c adapter symlink to hdmi connector in order to make
> this behaviour consistent.
> 
> The initial motivation of this patch was to make igt i2c subtest
> patch [1] work on all connectors.
> 
> [1]: https://patchwork.freedesktop.org/series/60357/
> 
> Signed-off-by: Oleg Vasilev <oleg.vasilev@xxxxxxxxx>
> Cc: Arkadiusz Hiler <arkadiusz.hiler@xxxxxxxxx>
> Cc: Imre Deak <imre.deak@xxxxxxxxx>
> Cc: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> Cc: Jani Nikula <jani.nikula@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/intel_hdmi.c | 35 +++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 2a4086cf2692..b8ae67297878 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -2658,6 +2658,37 @@ static void chv_hdmi_pre_enable(struct intel_encoder *encoder,
>  	chv_phy_release_cl2_override(encoder);
>  }
>  
> +static struct i2c_adapter *
> +intel_hdmi_get_i2c_adapter(struct drm_connector *connector)
> +{
> +	struct intel_encoder *intel_encoder = intel_attached_encoder(connector);
> +	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&intel_encoder->base);
> +	struct drm_device *dev = intel_encoder->base.dev;
> +	struct drm_i915_private *dev_priv = to_i915(dev);
> +
> +	return intel_gmbus_get_adapter(dev_priv, intel_hdmi->ddc_bus);
> +}
> +
> +static void intel_hdmi_create_i2c_symlink(struct drm_connector *connector)
> +{
> +	struct i2c_adapter *adapter = intel_hdmi_get_i2c_adapter(connector);
> +	struct kobject *i2c_kobj = &adapter->dev.kobj;
> +	struct kobject *connector_kobj = &connector->kdev->kobj;
> +
> +	int ret = sysfs_create_link(connector_kobj, i2c_kobj, i2c_kobj->name);
> +
> +	WARN(ret != 0, "Failed to create i2c symlink\n");
> +}
> +
> +static void intel_hdmi_delete_i2c_symlink(struct drm_connector *connector)
> +{
> +	struct i2c_adapter *adapter = intel_hdmi_get_i2c_adapter(connector);
> +	struct kobject *i2c_kobj = &adapter->dev.kobj;
> +	struct kobject *connector_kobj = &connector->kdev->kobj;
> +
> +	sysfs_remove_link(connector_kobj, i2c_kobj->name);
> +}
> +
>  static int
>  intel_hdmi_connector_register(struct drm_connector *connector)
>  {
> @@ -2669,11 +2700,15 @@ intel_hdmi_connector_register(struct drm_connector *connector)
>  
>  	i915_debugfs_connector_add(connector);
>  
> +	intel_hdmi_create_i2c_symlink(connector);
> +
>  	return ret;
>  }
>  
>  static void intel_hdmi_destroy(struct drm_connector *connector)
>  {
> +	intel_hdmi_delete_i2c_symlink(connector);
> +

Shouldn't this be in .unregister() ?

>  	if (intel_attached_hdmi(connector)->cec_notifier)
>  		cec_notifier_put(intel_attached_hdmi(connector)->cec_notifier);
>  
> -- 
> 2.21.0

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux