devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Andrew F. Davis" <afd@ti.com>
To: Andreas Dannenberg <dannenberg@ti.com>,
	Sebastian Reichel <sre@kernel.org>,
	Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Laurentiu Palcu <laurentiu.palcu@intel.com>,
	Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 03/13] power: bq24257: Add basic support for bq24250/bq24251
Date: Tue, 1 Sep 2015 14:48:57 -0500	[thread overview]
Message-ID: <55E60129.1000706@ti.com> (raw)
In-Reply-To: <1441073435-12349-4-git-send-email-dannenberg@ti.com>

On 08/31/2015 09:10 PM, Andreas Dannenberg wrote:
> This patch adds basic support for bq24250 and bq24251 which are very
> similar to the bq24257 the driver was originally written for. Basic
> support means the ability to select a device through Kconfig, DT and
> ACPI, an instance variable allowing to check which chip is active, and
> the reporting back of the selected device through the
> POWER_SUPPLY_PROP_MODEL_NAME power supply sysfs property.
>
> This patch by itself is not sufficient to actually use those two added
> devices in a real-world setting due to some feature differences which
> are addressed by other patches in this series.
>
> Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
> ---
>   drivers/power/Kconfig           |  5 +++--
>   drivers/power/bq24257_charger.c | 34 +++++++++++++++++++++++++++++++---
>   2 files changed, 34 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
> index 08beeed..0a2b033 100644
> --- a/drivers/power/Kconfig
> +++ b/drivers/power/Kconfig
> @@ -396,11 +396,12 @@ config CHARGER_BQ24190
>   	  Say Y to enable support for the TI BQ24190 battery charger.
>
>   config CHARGER_BQ24257
> -	tristate "TI BQ24257 battery charger driver"
> +	tristate "TI BQ24250/251/257 battery charger driver"
>   	depends on I2C && GPIOLIB
>   	depends on REGMAP_I2C
>   	help
> -	  Say Y to enable support for the TI BQ24257 battery charger.
> +	  Say Y to enable support for the TI BQ24250, BQ24251, and BQ24257 battery
> +	  chargers.

I don't see this done very often, perhaps the additional devices make this
driver a good candidate for a rename? BQ2425X?

Regards,
Andrew

>
>   config CHARGER_BQ24735
>   	tristate "TI BQ24735 battery charger support"
> diff --git a/drivers/power/bq24257_charger.c b/drivers/power/bq24257_charger.c
> index 0b34528..45232bd 100644
> --- a/drivers/power/bq24257_charger.c
> +++ b/drivers/power/bq24257_charger.c
> @@ -13,6 +13,10 @@
>    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>    * GNU General Public License for more details.
>    *
> + * Datasheets:
> + * http://www.ti.com/product/bq24250
> + * http://www.ti.com/product/bq24251
> + * http://www.ti.com/product/bq24257
>    */
>
>   #include <linux/module.h>
> @@ -41,6 +45,12 @@
>
>   #define BQ24257_ILIM_SET_DELAY		1000	/* msec */
>
> +enum bq2425x_chip {
> +	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 +81,9 @@ struct bq24257_device {
>   	struct device *dev;
>   	struct power_supply *charger;
>
> +	enum bq2425x_chip chip;
> +	char chip_name[I2C_NAME_SIZE];
> +
>   	struct regmap *rmap;
>   	struct regmap_field *rmap_fields[F_MAX_FIELDS];
>
> @@ -250,6 +263,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 = bq->chip_name;
> +		break;
> +
>   	case POWER_SUPPLY_PROP_ONLINE:
>   		val->intval = state.power_good;
>   		break;
> @@ -574,6 +591,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,
> @@ -686,6 +704,8 @@ static int bq24257_probe(struct i2c_client *client,
>
>   	bq->client = client;
>   	bq->dev = dev;
> +	bq->chip = (enum bq2425x_chip)id->driver_data;
> +	strncpy(bq->chip_name, id->name, I2C_NAME_SIZE);
>
>   	mutex_init(&bq->lock);
>
> @@ -828,19 +848,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",
> +	},
>   	{ },
>   };
>   MODULE_DEVICE_TABLE(of, bq24257_of_match);
>
>   static const struct acpi_device_id bq24257_acpi_match[] = {
> -	{"BQ242570", 0},
> +	{ "BQ242500", BQ24250 },
> +	{ "BQ242510", BQ24251 },
> +	{ "BQ242570", BQ24257 },
>   	{},
>   };
>   MODULE_DEVICE_TABLE(acpi, bq24257_acpi_match);
>

  reply	other threads:[~2015-09-01 19:48 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-01  2:10 [PATCH 00/13] power: bq24257: Add support for bq24250/bq24251 Andreas Dannenberg
2015-09-01  2:10 ` [PATCH 01/13] power: bq24257: Add bit definition for temp sense enable Andreas Dannenberg
2015-09-01 19:42   ` Andrew F. Davis
2015-09-01  2:10 ` [PATCH 02/13] power: bq24257: Add dead battery reporting Andreas Dannenberg
2015-09-01 19:33   ` Andrew F. Davis
2015-09-01 21:04     ` Andreas Dannenberg
2015-09-01 21:16       ` Andrew F. Davis
2015-09-04 13:28         ` Laurentiu Palcu
2015-09-04 15:08           ` Andreas Dannenberg
     [not found] ` <1441073435-12349-1-git-send-email-dannenberg-l0cyMroinI0@public.gmane.org>
2015-09-01  2:10   ` [PATCH 03/13] power: bq24257: Add basic support for bq24250/bq24251 Andreas Dannenberg
2015-09-01 19:48     ` Andrew F. Davis [this message]
2015-09-01 21:24       ` Andreas Dannenberg
     [not found]     ` <1441073435-12349-4-git-send-email-dannenberg-l0cyMroinI0@public.gmane.org>
2015-09-02  8:19       ` Laurentiu Palcu
2015-09-02 14:16         ` Andreas Dannenberg
2015-09-02  8:07   ` [PATCH 00/13] power: bq24257: Add " Laurentiu Palcu
2015-09-02 14:09     ` Andreas Dannenberg
2015-09-01  2:10 ` [PATCH 04/13] power: bq24257: Allow manual setting of input current limit Andreas Dannenberg
2015-09-01 19:59   ` Andrew F. Davis
2015-09-02  8:23   ` Laurentiu Palcu
2015-09-01  2:10 ` [PATCH 05/13] power: bq24257: Add SW-based approach for Power Good determination Andreas Dannenberg
2015-09-01 20:01   ` Andrew F. Davis
     [not found]   ` <1441073435-12349-6-git-send-email-dannenberg-l0cyMroinI0@public.gmane.org>
2015-09-02  8:29     ` Laurentiu Palcu
2015-09-01  2:10 ` [PATCH 06/13] power: bq24257: Add over voltage protection setting support Andreas Dannenberg
2015-09-01 20:10   ` Andrew F. Davis
2015-09-01  2:10 ` [PATCH 07/13] power: bq24257: Add VINDPM voltage threshold " Andreas Dannenberg
2015-09-01 20:48   ` Andrew F. Davis
2015-09-01  2:10 ` [PATCH 08/13] power: bq24257: Extend scope of mutex protection Andreas Dannenberg
2015-09-01 20:34   ` Andrew F. Davis
2015-09-01 22:15     ` Andreas Dannenberg
2015-09-01  2:10 ` [PATCH 09/13] power: bq24257: Add charge type setting support Andreas Dannenberg
2015-09-01  2:10 ` [PATCH 10/13] power: bq24257: Add in_ilimit " Andreas Dannenberg
2015-09-01  2:10 ` [PATCH 11/13] power: bq24257: Add various device-specific sysfs properties Andreas Dannenberg
2015-09-01  2:10 ` [PATCH 12/13] power: bq24257: Add platform data based initialization Andreas Dannenberg
2015-09-01  2:10 ` [PATCH 13/13] dt: power: bq24257-charger: Cover additional devices Andreas Dannenberg
     [not found]   ` <1441073435-12349-14-git-send-email-dannenberg-l0cyMroinI0@public.gmane.org>
2015-09-02  5:24     ` Krzysztof Kozlowski
2015-09-02 14:03       ` Andreas Dannenberg
2015-09-03  1:31         ` Krzysztof Kozlowski
2015-09-03  1:47           ` Andreas Dannenberg
2015-09-03  1:57             ` Krzysztof Kozlowski
2015-09-03 16:09               ` Andreas Dannenberg
2015-09-03 23:50                 ` Krzysztof Kozlowski

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=55E60129.1000706@ti.com \
    --to=afd@ti.com \
    --cc=dannenberg@ti.com \
    --cc=dbaryshkov@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=k.kozlowski.k@gmail.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).