[PATCH v2 6/8] drm/panel: add driver for samsung amb655x

Caleb Connolly caleb at postmarketos.org
Tue Jul 2 09:42:58 UTC 2024



On 01/07/2024 22:32, Dmitry Baryshkov wrote:
> On Sun, Jun 30, 2024 at 08:36:29PM GMT, Caleb Connolly wrote:
>> This is a 1080x2400 120hz panel used on the OnePlus 8T. It uses DSC but
>> with many non-standard DCS commands.
>>
>> The only user of this panel (the OnePlus 8T) has a bug somewhere in the
>> DSI stack whereby it isn't possible to properly initialize this panel
>> after a reset. As a result, the reset GPIO is made optional so it can be
>> left unused on that device.
>>
>> Signed-off-by: Caleb Connolly <caleb at postmarketos.org>
>> ---
>>   MAINTAINERS                                   |   7 +
>>   drivers/gpu/drm/panel/Kconfig                 |   9 +
>>   drivers/gpu/drm/panel/Makefile                |   1 +
>>   drivers/gpu/drm/panel/panel-samsung-amb655x.c | 399 ++++++++++++++++++++++++++
>>   4 files changed, 416 insertions(+)
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 807feae089c4..2b9cfbf92d7a 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -7142,8 +7142,15 @@ M:	Robert Chiras <robert.chiras at nxp.com>
>>   S:	Maintained
>>   F:	Documentation/devicetree/bindings/display/panel/raydium,rm67191.yaml
>>   F:	drivers/gpu/drm/panel/panel-raydium-rm67191.c
>>   
>> +DRM DRIVER FOR SAMSUNG AMB655X PANEL
>> +M:	Caleb Connolly <caleb at postmarketos.org>
>> +S:	Maintained
>> +T:	git https://gitlab.freedesktop.org/drm/misc/kernel.git
>> +F:	Documentation/devicetree/bindings/display/panel/samsung,amb655x.yaml
>> +F:	drivers/gpu/drm/panel/panel-samsung-amb655x.c
>> +
>>   DRM DRIVER FOR SAMSUNG DB7430 PANELS
>>   M:	Linus Walleij <linus.walleij at linaro.org>
>>   S:	Maintained
>>   T:	git https://gitlab.freedesktop.org/drm/misc/kernel.git
>> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
>> index bf4eadfe21cb..7203d16ab20a 100644
>> --- a/drivers/gpu/drm/panel/Kconfig
>> +++ b/drivers/gpu/drm/panel/Kconfig
>> @@ -590,8 +590,17 @@ config DRM_PANEL_SAMSUNG_S6E88A0_AMS452EF01
>>   	depends on OF
>>   	select DRM_MIPI_DSI
>>   	select VIDEOMODE_HELPERS
>>   
>> +config DRM_PANEL_SAMSUNG_AMB655X
>> +	tristate "Samsung AMB655X DSI panel"
>> +	depends on OF
>> +	depends on DRM_MIPI_DSI
>> +	depends on BACKLIGHT_CLASS_DEVICE
>> +	help
>> +	  DRM panel driver for the Samsung AMB655X panel.
>> +	  This panel has a resolution of 1080x2400 @ 60hz or 120Hz.
>> +
>>   config DRM_PANEL_SAMSUNG_ATNA33XC20
>>   	tristate "Samsung ATNA33XC20 eDP panel"
>>   	depends on OF
>>   	depends on BACKLIGHT_CLASS_DEVICE
>> diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
>> index 051b75b3df7b..be6d500a56a4 100644
>> --- a/drivers/gpu/drm/panel/Makefile
>> +++ b/drivers/gpu/drm/panel/Makefile
>> @@ -58,8 +58,9 @@ obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM67191) += panel-raydium-rm67191.o
>>   obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM68200) += panel-raydium-rm68200.o
>>   obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM692E5) += panel-raydium-rm692e5.o
>>   obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM69380) += panel-raydium-rm69380.o
>>   obj-$(CONFIG_DRM_PANEL_RONBO_RB070D30) += panel-ronbo-rb070d30.o
>> +obj-$(CONFIG_DRM_PANEL_SAMSUNG_AMB655X) += panel-samsung-amb655x.o
>>   obj-$(CONFIG_DRM_PANEL_SAMSUNG_ATNA33XC20) += panel-samsung-atna33xc20.o
>>   obj-$(CONFIG_DRM_PANEL_SAMSUNG_DB7430) += panel-samsung-db7430.o
>>   obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o
>>   obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D16D0) += panel-samsung-s6d16d0.o
> 
> 
>> +static int samsung_amb655x_prepare(struct drm_panel *panel)
>> +{
>> +	struct samsung_amb655x *ctx = to_samsung_amb655x(panel);
>> +	struct device *dev = &ctx->dsi->dev;
>> +	int ret;
>> +
>> +	/*
>> +	 * During the first call to prepare, the regulators are already enabled
>> +	 * since they're boot-on. Avoid enabling them twice so we keep the refcounts
>> +	 * balanced.
> 
> I see your intent, but I don't think this is fully correct. If the
> driver gets rebound, then it will perform one extra disable call. On the
> next driver probe / enable / disable / remove cycle the driver will
> perform one more, underflowing enable count. I think
> regulator_init_complete_work_function should give the phone enough time
> to boot the panel.

I do make an extra call to regulator_bulk_enable() in probe(), does that 
balance things out?
> 
>> +	 */
>> +	if (!regulator_is_enabled(ctx->supplies[0].consumer)) {
>> +		ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
>> +		if (ret) {
>> +			dev_err(dev, "Failed to enable regulators: %d\n", ret);
>> +			return ret;
>> +		}
>> +	}
>> +
> 


More information about the dri-devel mailing list