[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b6828042-3e6b-7d63-c66d-5fc1dbf2b7dd@linaro.org>
Date: Fri, 15 Sep 2023 12:03:28 +0200
From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To: Bryan O'Donoghue <bryan.odonoghue@...aro.org>,
Javier Carrasco <javier.carrasco@...fvision.net>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org
Subject: Re: [PATCH 1/2] usb: typec: tps6598x: add reset gpio support
On 15/09/2023 11:52, Bryan O'Donoghue wrote:
>> + struct gpio_desc *reset;
>> struct typec_port *port;
>> struct typec_partner *partner;
>> struct usb_pd_identity partner_identity;
>> @@ -717,6 +722,13 @@ static int tps6598x_probe(struct i2c_client *client)
>> mutex_init(&tps->lock);
>> tps->dev = &client->dev;
>>
>> + tps->reset = devm_gpiod_get_optional(tps->dev, "reset", GPIOD_OUT_LOW);
>> + if (IS_ERR(tps->reset))
>> + return dev_err_probe(tps->dev, PTR_ERR(tps->reset),
>> + "failed to get reset GPIO\n");
>> + if (tps->reset)
>> + msleep(SETUP_MS);
>> +
>
> This looks a bit odd to me, shouldn't you drive reset to zero ?
>
> if (tps->reset) {
> gpiod_set_value_cansleep(tps->reset, 0);
It is driven by GPIOD_OUT_LOW.
> msleep(SETUP_MS);
> }
>
> also wouldn't it make sense to functionally decompose that and reuse in
> probe() and tps6598x_resume() ?
>
> tps6598x_reset() {
> if (tps->reset) {
> gpiod_set_value_cansleep(tps->reset, 0);
> msleep(SETUP_MS);
> }
> }
Best regards,
Krzysztof
Powered by blists - more mailing lists