From: Andreas Dannenberg <dannenberg@ti.com>
To: Laurentiu Palcu <laurentiu.palcu@intel.com>
Cc: Sebastian Reichel <sre@kernel.org>,
Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
Krzysztof Kozlowski <k.kozlowski@samsung.com>,
linux-pm@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 02/13] power: bq24257: Add basic support for bq24250/bq24251
Date: Thu, 10 Sep 2015 11:19:44 -0500 [thread overview]
Message-ID: <20150910161944.GA16768@borg> (raw)
In-Reply-To: <20150910124210.GD21512@lpalcu-desk>
On Thu, Sep 10, 2015 at 03:42:11PM +0300, Laurentiu Palcu wrote:
> On Tue, Sep 08, 2015 at 07:12:26PM -0500, Andreas Dannenberg wrote:
> [...]
> >
> > #include <linux/module.h>
> > @@ -41,6 +45,18 @@
> >
> > #define BQ24257_ILIM_SET_DELAY 1000 /* msec */
> >
> > +enum bq2425x_chip {
> > + BQ24250,
> > + BQ24251,
> > + BQ24257,
> > +};
> > +
> > +static const char *bq2425x_chip_name[] = {
> static const char *const bq2425x_chip_name[]
>
> That's safer and it also makes checkpatch happy.
Ok changed.
> > + "bq24250",
> > + "bq24251",
> > + "bq24257",
> > +};
> > +
> > enum bq24257_fields {
> > F_WD_FAULT, F_WD_EN, F_STAT, F_FAULT, /* REG 1 */
> > F_RESET, F_IILIMIT, F_EN_STAT, F_EN_TERM, F_CE, F_HZ_MODE, /* REG 2 */
> > @@ -71,6 +87,8 @@ struct bq24257_device {
> > struct device *dev;
> > struct power_supply *charger;
> >
> > + enum bq2425x_chip chip;
> > +
> > struct regmap *rmap;
> > struct regmap_field *rmap_fields[F_MAX_FIELDS];
> >
> > @@ -250,6 +268,10 @@ static int bq24257_power_supply_get_property(struct power_supply *psy,
> > val->strval = BQ24257_MANUFACTURER;
> > break;
> >
> > + case POWER_SUPPLY_PROP_MODEL_NAME:
> > + val->strval = bq2425x_chip_name[bq->chip];
> > + break;
> > +
> > case POWER_SUPPLY_PROP_ONLINE:
> > val->intval = state.power_good;
> > break;
> > @@ -570,6 +592,7 @@ static int bq24257_hw_init(struct bq24257_device *bq)
> >
> > static enum power_supply_property bq24257_power_supply_props[] = {
> > POWER_SUPPLY_PROP_MANUFACTURER,
> > + POWER_SUPPLY_PROP_MODEL_NAME,
> > POWER_SUPPLY_PROP_STATUS,
> > POWER_SUPPLY_PROP_ONLINE,
> > POWER_SUPPLY_PROP_HEALTH,
> > @@ -667,6 +690,7 @@ static int bq24257_probe(struct i2c_client *client,
> > {
> > struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
> > struct device *dev = &client->dev;
> > + const struct acpi_device_id *acpi_id;
> > struct bq24257_device *bq;
> > int ret;
> > int i;
> > @@ -683,6 +707,18 @@ static int bq24257_probe(struct i2c_client *client,
> > bq->client = client;
> > bq->dev = dev;
> >
> > + if (ACPI_HANDLE(dev)) {
> > + acpi_id = acpi_match_device(dev->driver->acpi_match_table,
> > + &client->dev);
> > + if (!acpi_id) {
> > + dev_err(dev, "Failed to match ACPI device\n");
> > + return -ENODEV;
> > + }
> > + bq->chip = (enum bq2425x_chip)acpi_id->driver_data;
> > + } else {
> > + bq->chip = (enum bq2425x_chip)id->driver_data;
> > + }
> > +
> > mutex_init(&bq->lock);
> >
> > bq->rmap = devm_regmap_init_i2c(client, &bq24257_regmap_config);
> > @@ -824,19 +860,27 @@ static const struct dev_pm_ops bq24257_pm = {
> > };
> >
> > static const struct i2c_device_id bq24257_i2c_ids[] = {
> > - { "bq24257", 0 },
> > + { "bq24250", BQ24250 },
> > + { "bq24251", BQ24251 },
> > + { "bq24257", BQ24257 },
> > {},
> > };
> > MODULE_DEVICE_TABLE(i2c, bq24257_i2c_ids);
> >
> > static const struct of_device_id bq24257_of_match[] = {
> > - { .compatible = "ti,bq24257", },
> > + {
> > + .compatible = "ti,bq24250",
> > + .compatible = "ti,bq24251",
> > + .compatible = "ti,bq24257",
> > + },
> Maybe you wanted:
> { .compatible = "ti,bq24250", },
> { .compatible = "ti,bq24251", },
> { .compatible = "ti,bq24252", },
Yes that's what I wanted. Interestingly in my testing the device
configured in the device tree was identified correctly, but I suppose
this worked because of some other fallback mechanism (maybe using the
i2c_device_id?). Anyways it's fixed now.
> > { },
> > };
>
> BTW, ACPI enumeration works fine. I tested the series on my setup
> (before starting to review the patches :D).
Thanks for going the extra mile and testing ACPI support, I really
appreciate it. I should get my MinnowBoard on Saturday (it'll make for a
fun weekend!) so I should be able to do such testing for this and other
TI drivers myself.
--
Andreas Dannenberg
Texas Instruments Inc
>
> laurentiu
next prev parent reply other threads:[~2015-09-10 16:19 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-09 0:12 [PATCH v2 00/13] power: bq24257: Add support for bq24250/bq24251 Andreas Dannenberg
2015-09-09 0:12 ` [PATCH v2 01/13] power: bq24257: Add bit definition for temp sense enable Andreas Dannenberg
2015-09-10 12:31 ` Laurentiu Palcu
2015-09-09 0:12 ` [PATCH v2 02/13] power: bq24257: Add basic support for bq24250/bq24251 Andreas Dannenberg
2015-09-10 12:42 ` Laurentiu Palcu
2015-09-10 16:19 ` Andreas Dannenberg [this message]
2015-09-09 0:12 ` [PATCH v2 03/13] power: bq24257: Allow manual setting of input current limit Andreas Dannenberg
[not found] ` <1441757557-7266-4-git-send-email-dannenberg-l0cyMroinI0@public.gmane.org>
2015-09-10 12:50 ` Laurentiu Palcu
2015-09-09 0:12 ` [PATCH v2 04/13] power: bq24257: Add SW-based approach for Power Good determination Andreas Dannenberg
[not found] ` <1441757557-7266-5-git-send-email-dannenberg-l0cyMroinI0@public.gmane.org>
2015-09-10 12:57 ` Laurentiu Palcu
2015-09-09 0:12 ` [PATCH v2 05/13] power: bq24257: Add over voltage protection setting support Andreas Dannenberg
[not found] ` <1441757557-7266-6-git-send-email-dannenberg-l0cyMroinI0@public.gmane.org>
2015-09-10 13:07 ` Laurentiu Palcu
2015-09-09 0:12 ` [PATCH v2 06/13] power: bq24257: Add input DPM voltage threshold " Andreas Dannenberg
2015-09-10 13:27 ` Laurentiu Palcu
2015-09-09 0:12 ` [PATCH v2 07/13] power: bq24257: Extend scope of mutex protection Andreas Dannenberg
2015-09-10 13:43 ` Laurentiu Palcu
2015-09-10 17:05 ` Andreas Dannenberg
2015-09-09 0:12 ` [PATCH v2 08/13] power: bq24257: Add charge type setting support Andreas Dannenberg
[not found] ` <1441757557-7266-9-git-send-email-dannenberg-l0cyMroinI0@public.gmane.org>
2015-09-10 13:56 ` Laurentiu Palcu
2015-09-10 18:50 ` Andreas Dannenberg
2015-09-09 0:12 ` [PATCH v2 09/13] power: bq24257: Allow input current limit sysfs access Andreas Dannenberg
2015-09-10 14:06 ` Laurentiu Palcu
2015-09-09 0:12 ` [PATCH v2 12/13] power: bq24257: Renaming for consistency Andreas Dannenberg
2015-09-10 14:41 ` Laurentiu Palcu
[not found] ` <1441757557-7266-1-git-send-email-dannenberg-l0cyMroinI0@public.gmane.org>
2015-09-09 0:12 ` [PATCH v2 10/13] power: bq24257: Add various device-specific sysfs properties Andreas Dannenberg
[not found] ` <1441757557-7266-11-git-send-email-dannenberg-l0cyMroinI0@public.gmane.org>
2015-09-10 14:13 ` Laurentiu Palcu
2015-09-10 18:53 ` Andreas Dannenberg
2015-09-09 0:12 ` [PATCH v2 11/13] power: bq24257: Add platform data based initialization Andreas Dannenberg
2015-09-10 14:40 ` Laurentiu Palcu
2015-09-10 19:49 ` Andreas Dannenberg
2015-09-09 0:12 ` [PATCH v2 13/13] dt: power: bq2425x-charger: Cover additional devices Andreas Dannenberg
2015-09-09 0:27 ` Krzysztof Kozlowski
2015-09-09 2:48 ` Andreas Dannenberg
2015-09-09 4:58 ` Krzysztof Kozlowski
2015-09-09 20:15 ` Andreas Dannenberg
2015-09-10 0:15 ` Krzysztof Kozlowski
2015-09-10 15:00 ` Laurentiu Palcu
2015-09-10 21:05 ` Andreas Dannenberg
2015-09-10 20:57 ` Andreas Dannenberg
2015-09-11 0:34 ` Krzysztof Kozlowski
2015-09-11 14:47 ` Andreas Dannenberg
2015-09-10 12:26 ` [PATCH v2 00/13] power: bq24257: Add support for bq24250/bq24251 Laurentiu Palcu
2015-09-10 21:26 ` Andreas Dannenberg
2015-09-11 8:26 ` Laurentiu Palcu
2015-09-11 15:06 ` Andreas Dannenberg
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=20150910161944.GA16768@borg \
--to=dannenberg@ti.com \
--cc=dbaryshkov@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dwmw2@infradead.org \
--cc=k.kozlowski@samsung.com \
--cc=laurentiu.palcu@intel.com \
--cc=linux-pm@vger.kernel.org \
--cc=sre@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).