[Intel-gfx] [PATCH v3] drm/i915: add i2c symlink under hdmi connector
Ville Syrjälä
ville.syrjala at linux.intel.com
Mon Jun 3 13:33:19 UTC 2019
On Mon, Jun 03, 2019 at 10:09:30AM +0000, Vasilev, Oleg wrote:
> Hi,
>
> Can this be reviewed, please?
It looks good to me. But the test results are horrible, due to the ext4
fail I think. I've hit retest to get new results.
>
> On Mon, 2019-05-20 at 18:06 +0300, Oleg Vasilev wrote:
> > Currently, the i2c adapter is available only under DP connectors.
> >
> > Add i2c symlink under hdmi connector pointing to i2c adapter in order
> > to
> > make this behaviour consistent.
> >
> > The initial motivation was to make igt i2c subtest
> > patch [1] work on all connectors.
> >
> > [1]: https://patchwork.freedesktop.org/series/60357/
> >
> > v2:
> > - Moved symlink remove to unregister (Ville)
> > - Clarified commit message (Jani)
> > - Changed WARN to DRM_ERROR (Jani)
> > - Minor codestyle changes proposed by Jani
> >
> > v3: added blank line
> >
> > Cc: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
> > Cc: Imre Deak <imre.deak at intel.com>
> > Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
> > Cc: Jani Nikula <jani.nikula at intel.com>
> > Signed-off-by: Oleg Vasilev <oleg.vasilev at intel.com>
> > ---
> > drivers/gpu/drm/i915/intel_hdmi.c | 41
> > ++++++++++++++++++++++++++++++-
> > 1 file changed, 40 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_hdmi.c
> > b/drivers/gpu/drm/i915/intel_hdmi.c
> > index 2a4086cf2692..a51d1408db7f 100644
> > --- a/drivers/gpu/drm/i915/intel_hdmi.c
> > +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> > @@ -2658,6 +2658,36 @@ 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 drm_i915_private *dev_priv = to_i915(connector->dev);
> > + struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
> > +
> > + 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;
> > +
> > + ret = sysfs_create_link(connector_kobj, i2c_kobj, i2c_kobj-
> > >name);
> > + if (ret)
> > + DRM_ERROR("Failed to create i2c symlink (%d)\n", ret);
> > +}
> > +
> > +static void intel_hdmi_remove_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,6 +2699,8 @@ intel_hdmi_connector_register(struct
> > drm_connector *connector)
> >
> > i915_debugfs_connector_add(connector);
> >
> > + intel_hdmi_create_i2c_symlink(connector);
> > +
> > return ret;
> > }
> >
> > @@ -2680,6 +2712,13 @@ static void intel_hdmi_destroy(struct
> > drm_connector *connector)
> > intel_connector_destroy(connector);
> > }
> >
> > +static void intel_hdmi_connector_unregister(struct drm_connector
> > *connector)
> > +{
> > + intel_hdmi_remove_i2c_symlink(connector);
> > +
> > + intel_connector_unregister(connector);
> > +}
> > +
> > static const struct drm_connector_funcs intel_hdmi_connector_funcs =
> > {
> > .detect = intel_hdmi_detect,
> > .force = intel_hdmi_force,
> > @@ -2687,7 +2726,7 @@ static const struct drm_connector_funcs
> > intel_hdmi_connector_funcs = {
> > .atomic_get_property =
> > intel_digital_connector_atomic_get_property,
> > .atomic_set_property =
> > intel_digital_connector_atomic_set_property,
> > .late_register = intel_hdmi_connector_register,
> > - .early_unregister = intel_connector_unregister,
> > + .early_unregister = intel_hdmi_connector_unregister,
> > .destroy = intel_hdmi_destroy,
> > .atomic_destroy_state =
> > drm_atomic_helper_connector_destroy_state,
> > .atomic_duplicate_state =
> > intel_digital_connector_duplicate_state,
--
Ville Syrjälä
Intel
More information about the Intel-gfx
mailing list