devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	Javier Carrasco <javier.carrasco@wolfvision.net>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH 1/2] usb: typec: tps6598x: add reset gpio support
Date: Fri, 15 Sep 2023 12:03:28 +0200	[thread overview]
Message-ID: <b6828042-3e6b-7d63-c66d-5fc1dbf2b7dd@linaro.org> (raw)
In-Reply-To: <ca9075db-de92-4545-8c47-d6c292d57ad9@linaro.org>

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


  reply	other threads:[~2023-09-15 10:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-15  6:50 [PATCH 0/2] usb: typec: tps6598x: add reset gpio support Javier Carrasco
2023-09-15  6:50 ` [PATCH 1/2] " Javier Carrasco
2023-09-15  6:57   ` Krzysztof Kozlowski
2023-09-15  7:09     ` Javier Carrasco
2023-09-15  9:52   ` Bryan O'Donoghue
2023-09-15 10:03     ` Krzysztof Kozlowski [this message]
2023-09-15 10:07     ` Javier Carrasco
2023-09-15 10:23   ` Bryan O'Donoghue
2023-09-15  6:50 ` [PATCH 2/2] dt-bindings: usb: tps6598x: add reset-gpios property Javier Carrasco
2023-09-15  6:56   ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b6828042-3e6b-7d63-c66d-5fc1dbf2b7dd@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=javier.carrasco@wolfvision.net \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).