From: Prashant Malani <pmalani@chromium.org>
To: Stephen Boyd <swboyd@chromium.org>
Cc: Lee Jones <lee.jones@linaro.org>,
linux-kernel@vger.kernel.org, patches@lists.linux.dev,
Tzung-Bi Shih <tzungbi@kernel.org>,
Daisuke Nojiri <dnojiri@chromium.org>,
Benson Leung <bleung@chromium.org>,
Guenter Roeck <groeck@chromium.org>,
chrome-platform@lists.linux.dev
Subject: Re: [PATCH v2] mfd: cros_ec_dev: Only register PCHG device if present
Date: Tue, 19 Apr 2022 00:22:19 +0000 [thread overview]
Message-ID: <Yl4Au/O/am/ZbX9J@chromium.org> (raw)
In-Reply-To: <20220419000408.3202635-1-swboyd@chromium.org>
Hey Stephen,
On Apr 18 17:04, Stephen Boyd wrote:
> Don't create a device for the peripheral charger (PCHG) if there aren't
> any peripheral charger ports. This removes a device on most ChromeOS
> systems, because the peripheral charger functionality isn't always
> present.
>
> Cc: Prashant Malani <pmalani@chromium.org>
> Cc: Tzung-Bi Shih <tzungbi@kernel.org>
> Cc: Daisuke Nojiri <dnojiri@chromium.org>
> Cc: Benson Leung <bleung@chromium.org>
> Cc: Guenter Roeck <groeck@chromium.org>
> Cc: <chrome-platform@lists.linux.dev>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
FWIW:
Reviewed-by: Prashant Malani <pmalani@chromium.org>
> ---
>
> Changes from v1 (https://lore.kernel.org/r/20220415003253.1973106-1-swboyd@chromium.org):
> * Use cros_ec_command()
> * Drop the other patches that aren't needed anymore
>
> drivers/mfd/cros_ec_dev.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
> index 546feef851ab..596731caf407 100644
> --- a/drivers/mfd/cros_ec_dev.c
> +++ b/drivers/mfd/cros_ec_dev.c
> @@ -114,6 +114,9 @@ static const struct mfd_cell cros_ec_platform_cells[] = {
> { .name = "cros-ec-chardev", },
> { .name = "cros-ec-debugfs", },
> { .name = "cros-ec-sysfs", },
> +};
> +
> +static const struct mfd_cell cros_ec_pchg_cells[] = {
> { .name = "cros-ec-pchg", },
> };
>
> @@ -137,6 +140,7 @@ static int ec_device_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> struct cros_ec_platform *ec_platform = dev_get_platdata(dev);
> struct cros_ec_dev *ec = kzalloc(sizeof(*ec), GFP_KERNEL);
> + struct ec_response_pchg_count pchg_count;
> int i;
>
> if (!ec)
> @@ -242,6 +246,21 @@ static int ec_device_probe(struct platform_device *pdev)
> }
> }
>
> + /*
> + * The PCHG device cannot be detected by sending EC_FEATURE_GET_CMD, but
> + * it can be detected by querying the number of peripheral chargers.
> + */
> + retval = cros_ec_command(ec->ec_dev, 0, EC_CMD_PCHG_COUNT, NULL, 0,
> + &pchg_count, sizeof(pchg_count));
> + if (retval >= 0 && pchg_count.port_count) {
> + retval = mfd_add_hotplug_devices(ec->dev,
> + cros_ec_pchg_cells,
> + ARRAY_SIZE(cros_ec_pchg_cells));
> + if (retval)
> + dev_warn(ec->dev, "failed to add pchg: %d\n",
> + retval);
Tiny nit: Can this fit in 1 line (100 chars[1])?
BR,
-Prashant
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bdc48fa11e46f867ea4d75fa59ee87a7f48be144
next prev parent reply other threads:[~2022-04-19 0:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-19 0:04 [PATCH v2] mfd: cros_ec_dev: Only register PCHG device if present Stephen Boyd
2022-04-19 0:22 ` Prashant Malani [this message]
2022-04-19 14:55 ` Stephen Boyd
2022-04-19 14:58 ` Prashant Malani
2022-04-19 18:26 ` Daisuke Nojiri
2022-04-26 14:18 ` Lee Jones
2022-04-26 14:19 ` Lee Jones
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=Yl4Au/O/am/ZbX9J@chromium.org \
--to=pmalani@chromium.org \
--cc=bleung@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--cc=dnojiri@chromium.org \
--cc=groeck@chromium.org \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=swboyd@chromium.org \
--cc=tzungbi@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