From: andy.shevchenko@gmail.com
To: Naresh Solanki <naresh.solanki@9elements.com>
Cc: Patrick Rudolph <patrick.rudolph@9elements.com>,
Linus Walleij <linus.walleij@linaro.org>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] pinctrl: cy8c95x0: Add reset support
Date: Thu, 20 Jul 2023 23:10:20 +0300 [thread overview]
Message-ID: <ZLmUrA1ANfAVJYHi@surfacebook> (raw)
In-Reply-To: <20230714081902.2621771-2-Naresh.Solanki@9elements.com>
Fri, Jul 14, 2023 at 10:19:01AM +0200, Naresh Solanki kirjoitti:
> From: Patrick Rudolph <patrick.rudolph@9elements.com>
>
> This patch adds support for an optional "reset" GPIO pin in the cy8c95x0
Find "This patch" in the Submitting Patches documentation and modify this
accordingly.
> pinctrl driver. On probe, the reset pin is pulled low to bring chip out
> of reset. The reset pin has an internal pull-down and can be left
> floating if not required.
>
> The datasheet doesn't mention any timing related to the reset pin.
>
> Based on empirical tests, it was found that the chip requires a
> delay of 250 milliseconds before accepting I2C transfers after driving
> the reset pin low. Therefore, a delay of 250ms is added before
> proceeding with I2C transfers.
...
> + /* bring the chip out of reset if reset pin is provided */
> + chip->gpio_reset = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_HIGH);
&client->dev
> + if (IS_ERR(chip->gpio_reset)) {
> + ret = dev_err_probe(chip->dev, PTR_ERR(chip->gpio_reset),
chip->dev
Why inconsistent?
> + "Failed to get GPIO 'reset'\n");
> + goto err_exit;
I haven't looked at the context, but this seems like a smoke, we usually don't
have such in devm-enabled drivers.
> + } else if (chip->gpio_reset) {
> + usleep_range(1000, 2000);
> + gpiod_set_value_cansleep(chip->gpio_reset, 0);
> + usleep_range(250000, 300000);
This is incorrect use of usleep_range(). Please, read documentation
Documentation/timers/timers-howto.rst on the topic. The fix can be switching to
fsleep() in both branches.
> + gpiod_set_consumer_name(chip->gpio_reset, "CY8C95X0 RESET");
This can be done uncoditionally before toggling the reset.
> + }
...
This change wasn't Cc'ed to me, however I was contributing a lot into this driver.
I would recommend to use my "smart" script [1] to send patches. It has some
heuristics which works well in 98% of the cases for me.
[1]: https://github.com/andy-shev/home-bin-tools/blob/master/ge2maintainer.sh
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2023-07-20 20:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-14 8:19 [PATCH v3 1/2] dt-bindings: pinctrl: cypress,cy8c95x0: Add reset pin Naresh Solanki
2023-07-14 8:19 ` [PATCH v3 2/2] pinctrl: cy8c95x0: Add reset support Naresh Solanki
2023-07-20 20:10 ` andy.shevchenko [this message]
2023-07-14 8:51 ` [PATCH v3 1/2] dt-bindings: pinctrl: cypress,cy8c95x0: Add reset pin Krzysztof Kozlowski
2023-07-20 19:19 ` Linus Walleij
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=ZLmUrA1ANfAVJYHi@surfacebook \
--to=andy.shevchenko@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=naresh.solanki@9elements.com \
--cc=patrick.rudolph@9elements.com \
/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).