[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87zfd7cdmw.fsf@minerva.mail-host-address-is-not-set>
Date: Mon, 14 Jul 2025 11:42:15 +0200
From: Javier Martinez Canillas <javierm@...hat.com>
To: Thomas Zimmermann <tzimmermann@...e.de>, linux-kernel@...r.kernel.org
Cc: ipedrosa@...hat.com, David Airlie <airlied@...il.com>, Maarten Lankhorst
<maarten.lankhorst@...ux.intel.com>, Marcus Folkesson
<marcus.folkesson@...il.com>, Maxime Ripard <mripard@...nel.org>, Simona
Vetter <simona@...ll.ch>, dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH 2/3] drm/sitronix/st7571-i2c: Make the reset GPIO to be
optional
Thomas Zimmermann <tzimmermann@...e.de> writes:
Hello Thomas,
> Hi
>
> Am 10.07.25 um 12:24 schrieb Javier Martinez Canillas:
>> Some Sitronix LCD controllers (such as the ST7567) don't have a reset pin,
>> so lets relax this in the driver and make the reset GPIO to be optional.
>>
>> The devm_gpiod_get_optional() helper is similar to devm_gpiod_get(), but
>> returns NULL when there isn't a reset-gpios property defined in a DT node.
>>
>> The DT binding schema for "sitronix,st7571" that require a reset GPIO will
>> enforce the "reset-gpios" to be present, due being a required DT property.
>> But in the driver itself the property can be made optional if not defined.
>>
>> Signed-off-by: Javier Martinez Canillas <javierm@...hat.com>
>> ---
>>
>> drivers/gpu/drm/sitronix/st7571-i2c.c | 8 ++++++--
>> 1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/sitronix/st7571-i2c.c b/drivers/gpu/drm/sitronix/st7571-i2c.c
>> index eec846892962..73e8db25f895 100644
>> --- a/drivers/gpu/drm/sitronix/st7571-i2c.c
>> +++ b/drivers/gpu/drm/sitronix/st7571-i2c.c
>> @@ -802,15 +802,19 @@ static int st7571_parse_dt(struct st7571_device *st7571)
>> st7571->nlines = dt.vactive.typ;
>> st7571->ncols = dt.hactive.typ;
>>
>> - st7571->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
>> + st7571->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
>> if (IS_ERR(st7571->reset))
>> - return PTR_ERR(st7571->reset);
>> + return dev_err_probe(dev, PTR_ERR(st7571->reset),
>> + "Failed to get reset gpio\n");
>>
>> return 0;
>> }
>>
>> static void st7571_reset(struct st7571_device *st7571)
>> {
>> + if (!st7571->reset)
>> + return;
>> +
>
> My interpretation of this function is that calling it guarantees a
> device reset (or an error). So I'd push this test into the caller.
>
That's a good point. I'll then do the check in the caller.
Actually... at the end I didn't need a st7571_reset() call for ST7567
since it has its own struct st7571_panel_data .init callback function.
So I can just drop the test for st7571->reset being NULL.
--
Best regards,
Javier Martinez Canillas
Core Platforms
Red Hat
Powered by blists - more mailing lists