From: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
To: Hans de Goede <hdegoede@redhat.com>
Cc: linux-pm@vger.kernel.org
Subject: Re: [PATCH 1/2] power: supply: max17042_battery: Add support for ACPI enumeration
Date: Tue, 29 Aug 2017 10:42:33 +0200 [thread overview]
Message-ID: <20170829084233.ybgwmovegkjwe5dz@earth> (raw)
In-Reply-To: <20170814201811.21110-1-hdegoede@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2690 bytes --]
Hi,
On Mon, Aug 14, 2017 at 10:18:10PM +0200, Hans de Goede wrote:
> Some x86 devices enumerate a max17047 fuel-gauge through a MAX17047
> ACPI firmware-node, add support for this.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
Thanks, queued.
-- Sebastian
> drivers/power/supply/max17042_battery.c | 22 +++++++++++++++++++++-
> 1 file changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c
> index aecaaa2b0586..b2ddb7eb69c6 100644
> --- a/drivers/power/supply/max17042_battery.c
> +++ b/drivers/power/supply/max17042_battery.c
> @@ -22,6 +22,7 @@
> * This driver is based on max17040_battery.c
> */
>
> +#include <linux/acpi.h>
> #include <linux/init.h>
> #include <linux/module.h>
> #include <linux/slab.h>
> @@ -982,6 +983,8 @@ static int max17042_probe(struct i2c_client *client,
> struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
> const struct power_supply_desc *max17042_desc = &max17042_psy_desc;
> struct power_supply_config psy_cfg = {};
> + const struct acpi_device_id *acpi_id;
> + struct device *dev = &client->dev;
> struct max17042_chip *chip;
> int ret;
> int i;
> @@ -995,7 +998,15 @@ static int max17042_probe(struct i2c_client *client,
> return -ENOMEM;
>
> chip->client = client;
> - chip->chip_type = id->driver_data;
> + if (id) {
> + chip->chip_type = id->driver_data;
> + } else {
> + acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev);
> + if (!acpi_id)
> + return -ENODEV;
> +
> + chip->chip_type = acpi_id->driver_data;
> + }
> chip->regmap = devm_regmap_init_i2c(client, &max17042_regmap_config);
> if (IS_ERR(chip->regmap)) {
> dev_err(&client->dev, "Failed to initialize regmap\n");
> @@ -1104,6 +1115,14 @@ static int max17042_resume(struct device *dev)
> static SIMPLE_DEV_PM_OPS(max17042_pm_ops, max17042_suspend,
> max17042_resume);
>
> +#ifdef CONFIG_ACPI
> +static const struct acpi_device_id max17042_acpi_match[] = {
> + { "MAX17047", MAXIM_DEVICE_TYPE_MAX17047 },
> + { }
> +};
> +MODULE_DEVICE_TABLE(acpi, max17042_acpi_match);
> +#endif
> +
> #ifdef CONFIG_OF
> static const struct of_device_id max17042_dt_match[] = {
> { .compatible = "maxim,max17042" },
> @@ -1125,6 +1144,7 @@ MODULE_DEVICE_TABLE(i2c, max17042_id);
> static struct i2c_driver max17042_i2c_driver = {
> .driver = {
> .name = "max17042",
> + .acpi_match_table = ACPI_PTR(max17042_acpi_match),
> .of_match_table = of_match_ptr(max17042_dt_match),
> .pm = &max17042_pm_ops,
> },
> --
> 2.13.4
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2017-08-29 8:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-14 20:18 [PATCH 1/2] power: supply: max17042_battery: Add support for ACPI enumeration Hans de Goede
2017-08-14 20:18 ` [PATCH 2/2] power: supply: max17042_battery: Fix ACPI interrupt issues Hans de Goede
2017-08-29 8:43 ` Sebastian Reichel
2017-08-29 8:42 ` Sebastian Reichel [this message]
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=20170829084233.ybgwmovegkjwe5dz@earth \
--to=sebastian.reichel@collabora.co.uk \
--cc=hdegoede@redhat.com \
--cc=linux-pm@vger.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