mbox series

[v3,00/22] Associate ddc adapters with connectors

Message ID cover.1561735433.git.andrzej.p@collabora.com (mailing list archive)
Headers show
Series Associate ddc adapters with connectors | expand

Message

Andrzej Pietrasiewicz June 28, 2019, 4:01 p.m. UTC
It is difficult for a user to know which of the i2c adapters is for which
drm connector. This series addresses this problem.

The idea is to have a symbolic link in connector's sysfs directory, e.g.:

ls -l /sys/class/drm/card0-HDMI-A-1/ddc
lrwxrwxrwx 1 root root 0 Jun 24 10:42 /sys/class/drm/card0-HDMI-A-1/ddc \
	-> ../../../../soc/13880000.i2c/i2c-2

The user then knows that their card0-HDMI-A-1 uses i2c-2 and can e.g. run
ddcutil:

ddcutil -b 2 getvcp 0x10
VCP code 0x10 (Brightness                    ): current value =    90, max value =   100

The first patch in the series adds struct i2c_adapter pointer to struct
drm_connector. If the field is used by a particular driver, then an
appropriate symbolic link is created by the generic code, which is also added
by this patch.

The second patch is an example of how to convert a driver to this new scheme.

v1..v2:

- used fixed name "ddc" for the symbolic link in order to make it easy for
userspace to find the i2c adapter

v2..v3:

- converted as many drivers as possible.

PATCHES 3/22-22/22 SHOULD BE CONSIDERED RFC!

Andrzej Pietrasiewicz (22):
  drm: Include ddc adapter pointer in struct drm_connector
  drm/exynos: Provide ddc symlink in connector's sysfs
  drm: rockchip: Provide ddc symlink in rk3066_hdmi sysfs directory
  drm: rockchip: Provide ddc symlink in inno_hdmi sysfs directory
  drm/msm/hdmi: Provide ddc symlink in hdmi connector sysfs directory
  drm/sun4i: hdmi: Provide ddc symlink in sun4i hdmi connector sysfs
    directory
  drm/mediatek: Provide ddc symlink in hdmi connector sysfs directory
  drm/tegra: Provide ddc symlink in output connector sysfs directory
  drm/imx: imx-ldb: Provide ddc symlink in connector's sysfs
  drm/imx: imx-tve: Provide ddc symlink in connector's sysfs
  drm/vc4: Provide ddc symlink in connector sysfs directory
  drm: zte: Provide ddc symlink in hdmi connector sysfs directory
  drm: zte: Provide ddc symlink in vga connector sysfs directory
  drm/tilcdc: Provide ddc symlink in connector sysfs directory
  drm: sti: Provide ddc symlink in hdmi connector sysfs directory
  drm/mgag200: Provide ddc symlink in connector sysfs directory
  drm/ast: Provide ddc symlink in connector sysfs directory
  drm/bridge: dumb-vga-dac: Provide ddc symlink in connector sysfs
    directory
  drm/bridge: dw-hdmi: Provide ddc symlink in connector sysfs directory
  drm/bridge: ti-tfp410: Provide ddc symlink in connector sysfs
    directory
  drm/amdgpu: Provide ddc symlink in connector sysfs directory
  drm/radeon: Provide ddc symlink in connector sysfs directory

 .../gpu/drm/amd/amdgpu/amdgpu_connectors.c    | 70 +++++++++++-----
 drivers/gpu/drm/ast/ast_mode.c                |  1 +
 drivers/gpu/drm/bridge/dumb-vga-dac.c         | 19 ++---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c     | 40 ++++-----
 drivers/gpu/drm/bridge/ti-tfp410.c            | 19 ++---
 drivers/gpu/drm/drm_sysfs.c                   |  7 ++
 drivers/gpu/drm/exynos/exynos_hdmi.c          | 11 ++-
 drivers/gpu/drm/imx/imx-ldb.c                 | 13 ++-
 drivers/gpu/drm/imx/imx-tve.c                 |  8 +-
 drivers/gpu/drm/mediatek/mtk_hdmi.c           |  9 +-
 drivers/gpu/drm/mgag200/mgag200_mode.c        |  1 +
 drivers/gpu/drm/msm/hdmi/hdmi_connector.c     |  1 +
 drivers/gpu/drm/radeon/radeon_connectors.c    | 82 ++++++++++++++-----
 drivers/gpu/drm/rockchip/inno_hdmi.c          | 17 ++--
 drivers/gpu/drm/rockchip/rk3066_hdmi.c        | 17 ++--
 drivers/gpu/drm/sti/sti_hdmi.c                |  1 +
 drivers/gpu/drm/sun4i/sun4i_hdmi.h            |  1 -
 drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c        | 14 ++--
 drivers/gpu/drm/tegra/drm.h                   |  1 -
 drivers/gpu/drm/tegra/output.c                | 12 +--
 drivers/gpu/drm/tegra/sor.c                   |  6 +-
 drivers/gpu/drm/tilcdc/tilcdc_tfp410.c        |  1 +
 drivers/gpu/drm/vc4/vc4_hdmi.c                | 16 ++--
 drivers/gpu/drm/zte/zx_hdmi.c                 | 25 ++----
 drivers/gpu/drm/zte/zx_vga.c                  | 25 ++----
 include/drm/drm_connector.h                   | 11 +++
 26 files changed, 252 insertions(+), 176 deletions(-)

Comments

Laurent Pinchart June 28, 2019, 4:11 p.m. UTC | #1
Hi Andrzej,

Just FYI, I have a patch series that reworks how bridges and connectors
are handled, and it will heavily conflict with this. The purpose of the
two series isn't the same, so both make sense. I will post the patches
this weekend, and will then review this series in that context.
Hopefully we'll get the best of both worlds :-)

On Fri, Jun 28, 2019 at 06:01:14PM +0200, Andrzej Pietrasiewicz wrote:
> It is difficult for a user to know which of the i2c adapters is for which
> drm connector. This series addresses this problem.
> 
> The idea is to have a symbolic link in connector's sysfs directory, e.g.:
> 
> ls -l /sys/class/drm/card0-HDMI-A-1/ddc
> lrwxrwxrwx 1 root root 0 Jun 24 10:42 /sys/class/drm/card0-HDMI-A-1/ddc \
> 	-> ../../../../soc/13880000.i2c/i2c-2
> 
> The user then knows that their card0-HDMI-A-1 uses i2c-2 and can e.g. run
> ddcutil:
> 
> ddcutil -b 2 getvcp 0x10
> VCP code 0x10 (Brightness                    ): current value =    90, max value =   100
> 
> The first patch in the series adds struct i2c_adapter pointer to struct
> drm_connector. If the field is used by a particular driver, then an
> appropriate symbolic link is created by the generic code, which is also added
> by this patch.
> 
> The second patch is an example of how to convert a driver to this new scheme.
> 
> v1..v2:
> 
> - used fixed name "ddc" for the symbolic link in order to make it easy for
> userspace to find the i2c adapter
> 
> v2..v3:
> 
> - converted as many drivers as possible.
> 
> PATCHES 3/22-22/22 SHOULD BE CONSIDERED RFC!
> 
> Andrzej Pietrasiewicz (22):
>   drm: Include ddc adapter pointer in struct drm_connector
>   drm/exynos: Provide ddc symlink in connector's sysfs
>   drm: rockchip: Provide ddc symlink in rk3066_hdmi sysfs directory
>   drm: rockchip: Provide ddc symlink in inno_hdmi sysfs directory
>   drm/msm/hdmi: Provide ddc symlink in hdmi connector sysfs directory
>   drm/sun4i: hdmi: Provide ddc symlink in sun4i hdmi connector sysfs
>     directory
>   drm/mediatek: Provide ddc symlink in hdmi connector sysfs directory
>   drm/tegra: Provide ddc symlink in output connector sysfs directory
>   drm/imx: imx-ldb: Provide ddc symlink in connector's sysfs
>   drm/imx: imx-tve: Provide ddc symlink in connector's sysfs
>   drm/vc4: Provide ddc symlink in connector sysfs directory
>   drm: zte: Provide ddc symlink in hdmi connector sysfs directory
>   drm: zte: Provide ddc symlink in vga connector sysfs directory
>   drm/tilcdc: Provide ddc symlink in connector sysfs directory
>   drm: sti: Provide ddc symlink in hdmi connector sysfs directory
>   drm/mgag200: Provide ddc symlink in connector sysfs directory
>   drm/ast: Provide ddc symlink in connector sysfs directory
>   drm/bridge: dumb-vga-dac: Provide ddc symlink in connector sysfs
>     directory
>   drm/bridge: dw-hdmi: Provide ddc symlink in connector sysfs directory
>   drm/bridge: ti-tfp410: Provide ddc symlink in connector sysfs
>     directory
>   drm/amdgpu: Provide ddc symlink in connector sysfs directory
>   drm/radeon: Provide ddc symlink in connector sysfs directory
> 
>  .../gpu/drm/amd/amdgpu/amdgpu_connectors.c    | 70 +++++++++++-----
>  drivers/gpu/drm/ast/ast_mode.c                |  1 +
>  drivers/gpu/drm/bridge/dumb-vga-dac.c         | 19 ++---
>  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c     | 40 ++++-----
>  drivers/gpu/drm/bridge/ti-tfp410.c            | 19 ++---
>  drivers/gpu/drm/drm_sysfs.c                   |  7 ++
>  drivers/gpu/drm/exynos/exynos_hdmi.c          | 11 ++-
>  drivers/gpu/drm/imx/imx-ldb.c                 | 13 ++-
>  drivers/gpu/drm/imx/imx-tve.c                 |  8 +-
>  drivers/gpu/drm/mediatek/mtk_hdmi.c           |  9 +-
>  drivers/gpu/drm/mgag200/mgag200_mode.c        |  1 +
>  drivers/gpu/drm/msm/hdmi/hdmi_connector.c     |  1 +
>  drivers/gpu/drm/radeon/radeon_connectors.c    | 82 ++++++++++++++-----
>  drivers/gpu/drm/rockchip/inno_hdmi.c          | 17 ++--
>  drivers/gpu/drm/rockchip/rk3066_hdmi.c        | 17 ++--
>  drivers/gpu/drm/sti/sti_hdmi.c                |  1 +
>  drivers/gpu/drm/sun4i/sun4i_hdmi.h            |  1 -
>  drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c        | 14 ++--
>  drivers/gpu/drm/tegra/drm.h                   |  1 -
>  drivers/gpu/drm/tegra/output.c                | 12 +--
>  drivers/gpu/drm/tegra/sor.c                   |  6 +-
>  drivers/gpu/drm/tilcdc/tilcdc_tfp410.c        |  1 +
>  drivers/gpu/drm/vc4/vc4_hdmi.c                | 16 ++--
>  drivers/gpu/drm/zte/zx_hdmi.c                 | 25 ++----
>  drivers/gpu/drm/zte/zx_vga.c                  | 25 ++----
>  include/drm/drm_connector.h                   | 11 +++
>  26 files changed, 252 insertions(+), 176 deletions(-)
> 
> -- 
> 2.17.1
>
Daniel Vetter June 28, 2019, 4:45 p.m. UTC | #2
On Fri, Jun 28, 2019 at 06:01:14PM +0200, Andrzej Pietrasiewicz wrote:
> It is difficult for a user to know which of the i2c adapters is for which
> drm connector. This series addresses this problem.
> 
> The idea is to have a symbolic link in connector's sysfs directory, e.g.:
> 
> ls -l /sys/class/drm/card0-HDMI-A-1/ddc
> lrwxrwxrwx 1 root root 0 Jun 24 10:42 /sys/class/drm/card0-HDMI-A-1/ddc \
> 	-> ../../../../soc/13880000.i2c/i2c-2
> 
> The user then knows that their card0-HDMI-A-1 uses i2c-2 and can e.g. run
> ddcutil:
> 
> ddcutil -b 2 getvcp 0x10
> VCP code 0x10 (Brightness                    ): current value =    90, max value =   100
> 
> The first patch in the series adds struct i2c_adapter pointer to struct
> drm_connector. If the field is used by a particular driver, then an
> appropriate symbolic link is created by the generic code, which is also added
> by this patch.
> 
> The second patch is an example of how to convert a driver to this new scheme.
> 
> v1..v2:
> 
> - used fixed name "ddc" for the symbolic link in order to make it easy for
> userspace to find the i2c adapter
> 
> v2..v3:
> 
> - converted as many drivers as possible.
> 
> PATCHES 3/22-22/22 SHOULD BE CONSIDERED RFC!

There's a lot more drivers than this I think (i915 is absent as an
example, but there should be tons more). Why are those not possible?
-Daniel

> 
> Andrzej Pietrasiewicz (22):
>   drm: Include ddc adapter pointer in struct drm_connector
>   drm/exynos: Provide ddc symlink in connector's sysfs
>   drm: rockchip: Provide ddc symlink in rk3066_hdmi sysfs directory
>   drm: rockchip: Provide ddc symlink in inno_hdmi sysfs directory
>   drm/msm/hdmi: Provide ddc symlink in hdmi connector sysfs directory
>   drm/sun4i: hdmi: Provide ddc symlink in sun4i hdmi connector sysfs
>     directory
>   drm/mediatek: Provide ddc symlink in hdmi connector sysfs directory
>   drm/tegra: Provide ddc symlink in output connector sysfs directory
>   drm/imx: imx-ldb: Provide ddc symlink in connector's sysfs
>   drm/imx: imx-tve: Provide ddc symlink in connector's sysfs
>   drm/vc4: Provide ddc symlink in connector sysfs directory
>   drm: zte: Provide ddc symlink in hdmi connector sysfs directory
>   drm: zte: Provide ddc symlink in vga connector sysfs directory
>   drm/tilcdc: Provide ddc symlink in connector sysfs directory
>   drm: sti: Provide ddc symlink in hdmi connector sysfs directory
>   drm/mgag200: Provide ddc symlink in connector sysfs directory
>   drm/ast: Provide ddc symlink in connector sysfs directory
>   drm/bridge: dumb-vga-dac: Provide ddc symlink in connector sysfs
>     directory
>   drm/bridge: dw-hdmi: Provide ddc symlink in connector sysfs directory
>   drm/bridge: ti-tfp410: Provide ddc symlink in connector sysfs
>     directory
>   drm/amdgpu: Provide ddc symlink in connector sysfs directory
>   drm/radeon: Provide ddc symlink in connector sysfs directory
> 
>  .../gpu/drm/amd/amdgpu/amdgpu_connectors.c    | 70 +++++++++++-----
>  drivers/gpu/drm/ast/ast_mode.c                |  1 +
>  drivers/gpu/drm/bridge/dumb-vga-dac.c         | 19 ++---
>  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c     | 40 ++++-----
>  drivers/gpu/drm/bridge/ti-tfp410.c            | 19 ++---
>  drivers/gpu/drm/drm_sysfs.c                   |  7 ++
>  drivers/gpu/drm/exynos/exynos_hdmi.c          | 11 ++-
>  drivers/gpu/drm/imx/imx-ldb.c                 | 13 ++-
>  drivers/gpu/drm/imx/imx-tve.c                 |  8 +-
>  drivers/gpu/drm/mediatek/mtk_hdmi.c           |  9 +-
>  drivers/gpu/drm/mgag200/mgag200_mode.c        |  1 +
>  drivers/gpu/drm/msm/hdmi/hdmi_connector.c     |  1 +
>  drivers/gpu/drm/radeon/radeon_connectors.c    | 82 ++++++++++++++-----
>  drivers/gpu/drm/rockchip/inno_hdmi.c          | 17 ++--
>  drivers/gpu/drm/rockchip/rk3066_hdmi.c        | 17 ++--
>  drivers/gpu/drm/sti/sti_hdmi.c                |  1 +
>  drivers/gpu/drm/sun4i/sun4i_hdmi.h            |  1 -
>  drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c        | 14 ++--
>  drivers/gpu/drm/tegra/drm.h                   |  1 -
>  drivers/gpu/drm/tegra/output.c                | 12 +--
>  drivers/gpu/drm/tegra/sor.c                   |  6 +-
>  drivers/gpu/drm/tilcdc/tilcdc_tfp410.c        |  1 +
>  drivers/gpu/drm/vc4/vc4_hdmi.c                | 16 ++--
>  drivers/gpu/drm/zte/zx_hdmi.c                 | 25 ++----
>  drivers/gpu/drm/zte/zx_vga.c                  | 25 ++----
>  include/drm/drm_connector.h                   | 11 +++
>  26 files changed, 252 insertions(+), 176 deletions(-)
> 
> -- 
> 2.17.1
>
Emil Velikov July 2, 2019, 3:08 p.m. UTC | #3
On Fri, 28 Jun 2019 at 17:45, Daniel Vetter <daniel@ffwll.ch> wrote:
>
> On Fri, Jun 28, 2019 at 06:01:14PM +0200, Andrzej Pietrasiewicz wrote:
> > It is difficult for a user to know which of the i2c adapters is for which
> > drm connector. This series addresses this problem.
> >
> > The idea is to have a symbolic link in connector's sysfs directory, e.g.:
> >
> > ls -l /sys/class/drm/card0-HDMI-A-1/ddc
> > lrwxrwxrwx 1 root root 0 Jun 24 10:42 /sys/class/drm/card0-HDMI-A-1/ddc \
> >       -> ../../../../soc/13880000.i2c/i2c-2
> >
> > The user then knows that their card0-HDMI-A-1 uses i2c-2 and can e.g. run
> > ddcutil:
> >
> > ddcutil -b 2 getvcp 0x10
> > VCP code 0x10 (Brightness                    ): current value =    90, max value =   100
> >
> > The first patch in the series adds struct i2c_adapter pointer to struct
> > drm_connector. If the field is used by a particular driver, then an
> > appropriate symbolic link is created by the generic code, which is also added
> > by this patch.
> >
> > The second patch is an example of how to convert a driver to this new scheme.
> >
> > v1..v2:
> >
> > - used fixed name "ddc" for the symbolic link in order to make it easy for
> > userspace to find the i2c adapter
> >
> > v2..v3:
> >
> > - converted as many drivers as possible.
> >
> > PATCHES 3/22-22/22 SHOULD BE CONSIDERED RFC!
>
> There's a lot more drivers than this I think (i915 is absent as an
> example, but there should be tons more). Why are those not possible?

While I fully agree there are more drivers, at the same time I wonder.
Is it a good idea to expect all of those to be fixed in one go and
block patches addressing 15+ drivers?

Personally I think it's reasonable to have this, alongside a TODO
entry for other drivers.

HTH
Emil
Andrzej Pietrasiewicz July 5, 2019, 8:38 a.m. UTC | #4
W dniu 28.06.2019 o 18:11, Laurent Pinchart pisze:
> Hi Andrzej,
> 
> Just FYI, I have a patch series that reworks how bridges and connectors
> are handled, and it will heavily conflict with this. The purpose of the
> two series isn't the same, so both make sense. I will post the patches
> this weekend, and will then review this series in that context.
> Hopefully we'll get the best of both worlds :-)

Hi Laurent,

Did you have a chance to review my patch series?

Andrzej
Laurent Pinchart July 5, 2019, 8:39 a.m. UTC | #5
Hi Andrzej,

On Fri, Jul 05, 2019 at 10:38:27AM +0200, Andrzej Pietrasiewicz wrote:
> W dniu 28.06.2019 o 18:11, Laurent Pinchart pisze:
> > Hi Andrzej,
> > 
> > Just FYI, I have a patch series that reworks how bridges and connectors
> > are handled, and it will heavily conflict with this. The purpose of the
> > two series isn't the same, so both make sense. I will post the patches
> > this weekend, and will then review this series in that context.
> > Hopefully we'll get the best of both worlds :-)
> 
> Hi Laurent,
> 
> Did you have a chance to review my patch series?

Not yet I'm afraid. I've been fairly busy this week, and coupled with
some health issues (but I'm feeling better now, so nothing to worry
about) it delayed my reviews. I'll get to it as soon as possible. Thank
you for pinging me.