[PATCH 3/5] drm/panel/samsung-sofef00: make gpio optional
Caleb Connolly
caleb at connolly.tech
Tue Jul 20 16:24:15 UTC 2021
Hi Bjorn,
On 20/07/2021 17:03, Bjorn Andersson wrote:
> On Tue 20 Jul 10:33 CDT 2021, Caleb Connolly wrote:
>
>> The OnePlus 6T panel fails to initialise if it has been reset,
>> workaround this by allowing panels to not specify a reset GPIO.
>>
>> Signed-off-by: Caleb Connolly <caleb at connolly.tech>
>> ---
>> drivers/gpu/drm/panel/panel-samsung-sofef00.c | 7 +++++--
>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/panel/panel-samsung-sofef00.c b/drivers/gpu/drm/panel/panel-samsung-sofef00.c
>> index 8cb1853574bb..a20a5af14653 100644
>> --- a/drivers/gpu/drm/panel/panel-samsung-sofef00.c
>> +++ b/drivers/gpu/drm/panel/panel-samsung-sofef00.c
>> @@ -44,6 +44,8 @@ struct sofef00_panel *to_sofef00_panel(struct drm_panel *panel)
>>
>> static void sofef00_panel_reset(struct sofef00_panel *ctx)
>> {
>> + if (!ctx->reset_gpio)
> gpiod_set_value_cansleep(NULL, 1) is a perfectly valid nop, so I don't
> think you need to make this conditional.
Ah thanks, will revise.
>
> That said, don't you need this to get the panel out of reset once you
> apply power after it being powered off?
It seems like the panel is out of reset by default, my best guess for
this whole issue is that the bootloader does some initialisation
of the panel which we aren't able to reproduce, as the panel is left
initialised (for cont splash) we're able to just make use of it as is.
With these patches supplied the OnePlus 6T is able to boot and function
as expected, in the future it would be good to find a way to
properly set up the panel so that we aren't dependent on the bootloader...
>
>> + return;
>> gpiod_set_value_cansleep(ctx->reset_gpio, 0);
>> usleep_range(5000, 6000);
>> gpiod_set_value_cansleep(ctx->reset_gpio, 1);
>> @@ -137,7 +139,8 @@ static int sofef00_panel_prepare(struct drm_panel *panel)
>> ret = sofef00_panel_on(ctx);
>> if (ret < 0) {
>> dev_err(dev, "Failed to initialize panel: %d\n", ret);
>> - gpiod_set_value_cansleep(ctx->reset_gpio, 1);
>> + if (ctx->reset_gpio)
> Ditto.
>
>
> Regards,
> Bjorn
>
>> + gpiod_set_value_cansleep(ctx->reset_gpio, 1);
>> return ret;
>> }
>>
>> @@ -276,7 +279,7 @@ static int sofef00_panel_probe(struct mipi_dsi_device *dsi)
>> return ret;
>> }
>>
>> - ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
>> + ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
>> if (IS_ERR(ctx->reset_gpio)) {
>> ret = PTR_ERR(ctx->reset_gpio);
>> dev_warn(dev, "Failed to get reset-gpios: %d\n", ret);
>> --
>> 2.32.0
>>
>>
Kind Regards,
Caleb
More information about the dri-devel
mailing list