Mario Limonciello <[email protected]> writes:
> Attach the connector LUMINANCE property for MIPI DBI compatible panels
> and retain the legacy backlight class interface only when DRM_LUMINANCE is
> disabled.
>
> Signed-off-by: Mario Limonciello <[email protected]>
> ---
> drivers/gpu/drm/tiny/Kconfig | 2 +-
> drivers/gpu/drm/tiny/panel-mipi-dbi.c | 3 +++
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/tiny/Kconfig b/drivers/gpu/drm/tiny/Kconfig
> index f0e72d4b6a470..e61a429538bc0 100644
> --- a/drivers/gpu/drm/tiny/Kconfig
> +++ b/drivers/gpu/drm/tiny/Kconfig
> @@ -73,7 +73,7 @@ config DRM_PANEL_MIPI_DBI
> select DRM_KMS_HELPER
> select DRM_GEM_DMA_HELPER
> select DRM_MIPI_DBI
> - select BACKLIGHT_CLASS_DEVICE
> + select BACKLIGHT_CLASS_DEVICE if !DRM_LUMINANCE
> select VIDEOMODE_HELPERS
> help
> Say Y here if you want to enable support for MIPI DBI compatible
> diff --git a/drivers/gpu/drm/tiny/panel-mipi-dbi.c
> b/drivers/gpu/drm/tiny/panel-mipi-dbi.c
> index 60cd65cae41d8..730f1b219fdec 100644
> --- a/drivers/gpu/drm/tiny/panel-mipi-dbi.c
> +++ b/drivers/gpu/drm/tiny/panel-mipi-dbi.c
> @@ -485,6 +485,9 @@ static int panel_mipi_dbi_spi_probe(struct spi_device
> *spi)
> if (ret)
> return ret;
> drm_connector_helper_add(connector,
> &panel_mipi_dbi_connector_helper_funcs);
> + ret = drm_mipi_dbi_connector_attach_luminance_property(connector);
> + if (ret)
> + return ret;
>
I don't see how this could work...
The drm_mipi_dbi_connector_attach_luminance_property() helper only attaches a
LUMINANCE property to the connector if DRM_LUMINANCE is enabled and backlight
is not NULL.
But if DRM_LUMINANCE is enabled, then backlight will always be NULL given that
the drivers/gpu/drm/tiny/panel-mipi-dbi.c driver does:
dbidev->backlight = devm_of_find_backlight(dev);
and devm_of_find_backlight() is just a stub that unconditionally return NULL if
BACKLIGHT_CLASS_DEVICE is disabled:
https://elixir.bootlin.com/linux/v7.3-rc5/source/include/linux/backlight.h#L441
I don't think we will be able to add support for the LUMINANCE property to MIPI
DBI drivers unless the drivers DT binding are changed. Or maybe what this shows
is that a backlight backend is really needed.
I would leave these drivers out for now and then later figure out how to make
them work without breaking the backlight sysfs interface.
Maybe what can be done is to add a new CONFIG_BACKLIGHT_SYSFS Kconfig symbol,
that defaults to y but allows the sysfs interface to be disabled. That way,
you could still have CONFIG_BACKLIGHT_CLASS_DEVICE enabled but prevent the
uAPI breakage.
Then in this MIPI DBI drivers you could do:
select DRM_LUMINANCE if !CONFIG_BACKLIGHT_SYSFS, or something like that.
--
Best regards,
Javier Martinez Canillas
Core Platforms
Red Hat