From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Cc: Lee Jones <lee.jones@linaro.org>,
Rob Herring <robh+dt@kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
devicetree <devicetree@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-power <linux-power@fi.rohmeurope.com>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>
Subject: Re: [PATCH v5 09/19] gpio: support ROHM BD71815 GPOs
Date: Tue, 30 Mar 2021 13:11:39 +0300 [thread overview]
Message-ID: <CAHp75VdRobc6jpFzAkd3U65BhiiNPLrF4qsnCKmsQBKMYbG4sg@mail.gmail.com> (raw)
In-Reply-To: <118a6160880a212d20d0251f763cad295c741b4d.1617020713.git.matti.vaittinen@fi.rohmeurope.com>
On Mon, Mar 29, 2021 at 3:58 PM Matti Vaittinen
<matti.vaittinen@fi.rohmeurope.com> wrote:
>
> Support GPO(s) found from ROHM BD71815 power management IC. The IC has two
> GPO pins but only one is properly documented in data-sheet. The driver
in the datasheet
> exposes by default only the documented GPO. The second GPO is connected to
> E5 pin and is marked as GND in data-sheet. Control for this undocumented
in the datasheet
> pin can be enabled using a special DT property.
>
> This driver is derived from work by Peter Yang <yanglsh@embest-tech.com>
> although not so much of original is left.
of the original
It seems you ignored my comments about the commit message. :-(
> +struct bd71815_gpio {
> + struct gpio_chip chip;
> + struct device *dev;
Wondering why you need this. Is it the same as chip.parent?
> + struct regmap *regmap;
> +};
...
> + int ret, bit;
> +
> + bit = BIT(offset);
I prefer
int bit = BIT(offset);
int ret;
but I think we already discussed that. OK.
...
> + default:
> + break;
> + }
> + return -ENOTSUPP;
Here is a waste of line. Why break instead of direct return?
...
> +/* Template for GPIO chip */
> +static const struct gpio_chip bd71815gpo_chip = {
> + .label = "bd71815",
> + .owner = THIS_MODULE,
> + .get = bd71815gpo_get,
> + .get_direction = bd71815gpo_direction_get,
> + .set = bd71815gpo_set,
> + .set_config = bd71815_gpio_set_config,
> + .can_sleep = 1,
Strictly speaking this should be true (boolean type value).
> +};
...
> +#define BD71815_TWO_GPIOS 0x3UL
> +#define BD71815_ONE_GPIO 0x1UL
Are they masks? Can you use BIT() and GENMASK()?
...
> +/*
> + * Sigh. The BD71815 and BD71817 were originally designed to support two GPO
> + * pins. At some point it was noticed the second GPO pin which is the E5 pin
> + * located at the center of IC is hard to use on PCB (due to the location). It
> + * was decided to not promote this second GPO and pin is marked as GND in the
and the pin
> + * datasheet. The functionality is still there though! I guess driving a GPO
> + * connected to the ground is a bad idea. Thus we do not support it by default.
> + * OTOH - the original driver written by colleagues at Embest did support
> + * controlling this second GPO. It is thus possible this is used in some of the
> + * products.
> + *
> + * This driver does not by default support configuring this second GPO
> + * but allows using it by providing the DT property
> + * "rohm,enable-hidden-gpo".
> + */
...
> + /*
> + * As writing of this the sysfs interface for GPIO control does not
> + * respect the valid_mask. Do not trust it but rather set the ngpios
> + * to 1 if "rohm,enable-hidden-gpo" is not given.
> + *
> + * This check can be removed later if the sysfs export is fixed and
> + * if the fix is backported.
So, mark this comment with the TODO/FIXME keyword?
> + *
> + * For now it is safest to just set the ngpios though.
> + */
...
> + ret = devm_gpiochip_add_data(dev, &g->chip, g);
> + if (ret < 0) {
> + dev_err(dev, "could not register gpiochip, %d\n", ret);
> + return ret;
> + }
> +
> + return ret;
This entire piece can be simplified by
return devm_gpiochip_add_data(...);
...
> +static struct platform_driver gpo_bd71815_driver = {
> + .driver = {
> + .name = "bd71815-gpo",
> + .owner = THIS_MODULE,
Seems I commented on this. The module_*_driver() macro(s) will take care of it.
> + },
> + .probe = gpo_bd71815_probe,
> +};
> +
Extra blank line. Drop it.
> +module_platform_driver(gpo_bd71815_driver);
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2021-03-30 10:13 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-29 12:52 [PATCH v5 00/19] Support ROHM BD71815 PMIC Matti Vaittinen
2021-03-29 12:54 ` [PATCH v5 04/19] dt_bindings: regulator: Add ROHM BD71815 PMIC regulators Matti Vaittinen
2021-03-29 12:54 ` [PATCH v5 05/19] dt_bindings: mfd: Add ROHM BD71815 PMIC Matti Vaittinen
2021-03-29 12:55 ` [PATCH v5 08/19] mfd: Support for ROHM BD71815 PMIC core Matti Vaittinen
2021-03-29 12:56 ` [PATCH v5 09/19] gpio: support ROHM BD71815 GPOs Matti Vaittinen
2021-03-30 10:11 ` Andy Shevchenko [this message]
2021-03-30 10:43 ` Matti Vaittinen
2021-03-30 10:54 ` Andy Shevchenko
2021-03-30 11:02 ` Vaittinen, Matti
2021-03-30 12:06 ` Vaittinen, Matti
2021-03-30 12:10 ` Andy Shevchenko
2021-03-29 12:57 ` [PATCH v5 10/19] regulator: helpers: Export helper voltage listing Matti Vaittinen
2021-03-29 12:58 ` [PATCH v5 12/19] regulator: rohm-regulator: Support SNVS HW state Matti Vaittinen
2021-04-02 17:31 ` Mark Brown
2021-03-29 12:59 ` [PATCH v5 13/19] regulator: Add regmap helper for ramp-delay setting Matti Vaittinen
2021-03-29 12:59 ` [PATCH v5 14/19] regulator: bd718x7, bd71828: Use ramp-delay helper Matti Vaittinen
2021-04-02 17:33 ` Mark Brown
2021-03-29 12:59 ` [PATCH v5 15/19] regulator: Support ROHM BD71815 regulators Matti Vaittinen
2021-04-02 17:42 ` Mark Brown
2021-04-04 16:21 ` Vaittinen, Matti
2021-04-05 5:14 ` Vaittinen, Matti
2021-03-29 13:00 ` [PATCH v5 16/19] regulator: bd71815: use ramp-delay helper Matti Vaittinen
2021-04-02 19:02 ` Mark Brown
2021-04-04 16:19 ` Matti Vaittinen
2021-03-29 13:01 ` [PATCH v5 19/19] MAINTAINERS: Add ROHM BD71815AGW Matti Vaittinen
2021-03-30 11:06 ` [PATCH v5 00/19] Support ROHM BD71815 PMIC Vaittinen, Matti
2021-04-02 19:19 ` Mark Brown
2021-04-05 5:23 ` Vaittinen, Matti
2021-04-06 11:04 ` Mark Brown
2021-04-02 19:33 ` (subset) " Mark Brown
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=CAHp75VdRobc6jpFzAkd3U65BhiiNPLrF4qsnCKmsQBKMYbG4sg@mail.gmail.com \
--to=andy.shevchenko@gmail.com \
--cc=bgolaszewski@baylibre.com \
--cc=devicetree@vger.kernel.org \
--cc=lee.jones@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-power@fi.rohmeurope.com \
--cc=matti.vaittinen@fi.rohmeurope.com \
--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).