* [PATCH v2 0/2] power: max17042-battery: Modify max17042 battery driver
@ 2015-04-03 8:26 Beomho Seo
2015-04-03 8:26 ` [PATCH v2 1/2] power: max17042_battery: Use reg type instead of chip type Beomho Seo
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Beomho Seo @ 2015-04-03 8:26 UTC (permalink / raw)
To: sre, k.kozlowski
Cc: linux-pm, linux-kernel, cw00.choi, inki.dae, sangbae90.lee, Beomho Seo
This patch modify max17042-battery.c fuel gauge driver for use max77843 fuel
gauge. and then, fix minor cording style issue.
This patchset is written based on recently battery git tree.
Changes in v2
- Remove Ncked patcheset.
- Remove reg_type.
- Fix patch description.
- Add Reviewed-by label.
Beomho Seo (2):
power: max17042_battery: Use reg type instead of chip type
power: max17042_battery: add missed blank
drivers/power/max17042_battery.c | 35 +++++++++++---------------------
include/linux/power/max17042_battery.h | 9 +++++++-
2 files changed, 20 insertions(+), 24 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] power: max17042_battery: Use reg type instead of chip type
2015-04-03 8:26 [PATCH v2 0/2] power: max17042-battery: Modify max17042 battery driver Beomho Seo
@ 2015-04-03 8:26 ` Beomho Seo
2015-04-03 9:01 ` Krzysztof Kozlowski
2015-04-03 8:26 ` [PATCH v2 2/2] power: max17042_battery: add missed blank Beomho Seo
2015-04-06 15:54 ` [PATCH v2 0/2] power: max17042-battery: Modify max17042 battery driver Sebastian Reichel
2 siblings, 1 reply; 6+ messages in thread
From: Beomho Seo @ 2015-04-03 8:26 UTC (permalink / raw)
To: sre, k.kozlowski
Cc: linux-pm, linux-kernel, cw00.choi, inki.dae, sangbae90.lee, Beomho Seo
Currently, max17042 battery driver choose register map by MAX17042_DevName
register. But it is return IC specific firmware version. So other maxim chip
hard to use this drvier. This patch choose chip type from driver_data.
Cc: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
---
drivers/power/max17042_battery.c | 33 ++++++++++----------------------
include/linux/power/max17042_battery.h | 9 ++++++++-
2 files changed, 18 insertions(+), 24 deletions(-)
diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c
index e5645ea..bf5a82c 100644
--- a/drivers/power/max17042_battery.c
+++ b/drivers/power/max17042_battery.c
@@ -63,9 +63,6 @@
#define dP_ACC_100 0x1900
#define dP_ACC_200 0x3200
-#define MAX17042_IC_VERSION 0x0092
-#define MAX17047_IC_VERSION 0x00AC /* same for max17050 */
-
struct max17042_chip {
struct i2c_client *client;
struct regmap *regmap;
@@ -131,7 +128,7 @@ static int max17042_get_property(struct power_supply *psy,
val->intval *= 20000; /* Units of LSB = 20mV */
break;
case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
- if (chip->chip_type == MAX17042)
+ if (chip->chip_type == MAXIM_DEVICE_TYPE_MAX17042)
ret = regmap_read(map, MAX17042_V_empty, &data);
else
ret = regmap_read(map, MAX17047_V_empty, &data);
@@ -378,7 +375,8 @@ static void max17042_write_config_regs(struct max17042_chip *chip)
regmap_write(map, MAX17042_FilterCFG,
config->filter_cfg);
regmap_write(map, MAX17042_RelaxCFG, config->relax_cfg);
- if (chip->chip_type == MAX17047)
+ if (chip->chip_type == MAXIM_DEVICE_TYPE_MAX17047 ||
+ chip->chip_type == MAXIM_DEVICE_TYPE_MAX17050)
regmap_write(map, MAX17047_FullSOCThr,
config->full_soc_thresh);
}
@@ -391,7 +389,7 @@ static void max17042_write_custom_regs(struct max17042_chip *chip)
max17042_write_verify_reg(map, MAX17042_RCOMP0, config->rcomp0);
max17042_write_verify_reg(map, MAX17042_TempCo, config->tcompc0);
max17042_write_verify_reg(map, MAX17042_ICHGTerm, config->ichgt_term);
- if (chip->chip_type == MAX17042) {
+ if (chip->chip_type == MAXIM_DEVICE_TYPE_MAX17042) {
regmap_write(map, MAX17042_EmptyTempCo, config->empty_tempco);
max17042_write_verify_reg(map, MAX17042_K_empty0,
config->kempty0);
@@ -500,14 +498,14 @@ static inline void max17042_override_por_values(struct max17042_chip *chip)
max17042_override_por(map, MAX17042_FullCAP, config->fullcap);
max17042_override_por(map, MAX17042_FullCAPNom, config->fullcapnom);
- if (chip->chip_type == MAX17042)
+ if (chip->chip_type == MAXIM_DEVICE_TYPE_MAX17042)
max17042_override_por(map, MAX17042_SOC_empty,
config->socempty);
max17042_override_por(map, MAX17042_LAvg_empty, config->lavg_empty);
max17042_override_por(map, MAX17042_dQacc, config->dqacc);
max17042_override_por(map, MAX17042_dPacc, config->dpacc);
- if (chip->chip_type == MAX17042)
+ if (chip->chip_type == MAXIM_DEVICE_TYPE_MAX17042)
max17042_override_por(map, MAX17042_V_empty, config->vempty);
else
max17042_override_por(map, MAX17047_V_empty, config->vempty);
@@ -709,20 +707,9 @@ static int max17042_probe(struct i2c_client *client,
}
i2c_set_clientdata(client, chip);
+ chip->chip_type = id->driver_data;
psy_cfg.drv_data = chip;
- regmap_read(chip->regmap, MAX17042_DevName, &val);
- if (val == MAX17042_IC_VERSION) {
- dev_dbg(&client->dev, "chip type max17042 detected\n");
- chip->chip_type = MAX17042;
- } else if (val == MAX17047_IC_VERSION) {
- dev_dbg(&client->dev, "chip type max17047/50 detected\n");
- chip->chip_type = MAX17047;
- } else {
- dev_err(&client->dev, "device version mismatch: %x\n", val);
- return -EIO;
- }
-
/* When current is not measured,
* CURRENT_NOW and CURRENT_AVG properties should be invisible. */
if (!chip->pdata->enable_current_sense)
@@ -834,9 +821,9 @@ MODULE_DEVICE_TABLE(of, max17042_dt_match);
#endif
static const struct i2c_device_id max17042_id[] = {
- { "max17042", 0 },
- { "max17047", 1 },
- { "max17050", 2 },
+ { "max17042", MAXIM_DEVICE_TYPE_MAX17042 },
+ { "max17047", MAXIM_DEVICE_TYPE_MAX17047 },
+ { "max17050", MAXIM_DEVICE_TYPE_MAX17050 },
{ }
};
MODULE_DEVICE_TABLE(i2c, max17042_id);
diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/max17042_battery.h
index 89dd84f..cf112b4 100644
--- a/include/linux/power/max17042_battery.h
+++ b/include/linux/power/max17042_battery.h
@@ -126,7 +126,14 @@ enum max17047_register {
MAX17047_QRTbl30 = 0x42,
};
-enum max170xx_chip_type {MAX17042, MAX17047};
+enum max170xx_chip_type {
+ MAXIM_DEVICE_TYPE_UNKNOWN = 0,
+ MAXIM_DEVICE_TYPE_MAX17042,
+ MAXIM_DEVICE_TYPE_MAX17047,
+ MAXIM_DEVICE_TYPE_MAX17050,
+
+ MAXIM_DEVICE_TYPE_NUM
+};
/*
* used for setting a register to a desired value
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] power: max17042_battery: add missed blank
2015-04-03 8:26 [PATCH v2 0/2] power: max17042-battery: Modify max17042 battery driver Beomho Seo
2015-04-03 8:26 ` [PATCH v2 1/2] power: max17042_battery: Use reg type instead of chip type Beomho Seo
@ 2015-04-03 8:26 ` Beomho Seo
2015-04-06 15:54 ` [PATCH v2 0/2] power: max17042-battery: Modify max17042 battery driver Sebastian Reichel
2 siblings, 0 replies; 6+ messages in thread
From: Beomho Seo @ 2015-04-03 8:26 UTC (permalink / raw)
To: sre, k.kozlowski
Cc: linux-pm, linux-kernel, cw00.choi, inki.dae, sangbae90.lee, Beomho Seo
This patch add missed blank line after decalations.
Cc: Sebastian Reichel <sre@kernel.org>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
---
drivers/power/max17042_battery.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c
index bf5a82c..6cc5e87 100644
--- a/drivers/power/max17042_battery.c
+++ b/drivers/power/max17042_battery.c
@@ -268,6 +268,7 @@ static inline void max17042_override_por(struct regmap *map,
static inline void max10742_unlock_model(struct max17042_chip *chip)
{
struct regmap *map = chip->regmap;
+
regmap_write(map, MAX17042_MLOCKReg1, MODEL_UNLOCK1);
regmap_write(map, MAX17042_MLOCKReg2, MODEL_UNLOCK2);
}
@@ -285,6 +286,7 @@ static inline void max17042_write_model_data(struct max17042_chip *chip,
{
struct regmap *map = chip->regmap;
int i;
+
for (i = 0; i < size; i++)
regmap_write(map, addr + i,
chip->pdata->config_data->cell_char_tbl[i]);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] power: max17042_battery: Use reg type instead of chip type
2015-04-03 8:26 ` [PATCH v2 1/2] power: max17042_battery: Use reg type instead of chip type Beomho Seo
@ 2015-04-03 9:01 ` Krzysztof Kozlowski
2015-04-06 13:34 ` Beomho Seo
0 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Kozlowski @ 2015-04-03 9:01 UTC (permalink / raw)
To: Beomho Seo
Cc: sre, linux-pm, linux-kernel, cw00.choi, inki.dae, sangbae90.lee,
Krzysztof Kozlowski
2015-04-03 10:26 GMT+02:00 Beomho Seo <beomho.seo@samsung.com>:
> Currently, max17042 battery driver choose register map by MAX17042_DevName
> register. But it is return IC specific firmware version. So other maxim chip
> hard to use this drvier. This patch choose chip type from driver_data.
>
> Cc: Sebastian Reichel <sre@kernel.org>
> Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
> ---
> drivers/power/max17042_battery.c | 33 ++++++++++----------------------
> include/linux/power/max17042_battery.h | 9 ++++++++-
> 2 files changed, 18 insertions(+), 24 deletions(-)
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] power: max17042_battery: Use reg type instead of chip type
2015-04-03 9:01 ` Krzysztof Kozlowski
@ 2015-04-06 13:34 ` Beomho Seo
0 siblings, 0 replies; 6+ messages in thread
From: Beomho Seo @ 2015-04-06 13:34 UTC (permalink / raw)
To: sre
Cc: Krzysztof Kozlowski, linux-pm, linux-kernel, cw00.choi, inki.dae,
sangbae90.lee
On 04/03/2015 06:01 PM, Krzysztof Kozlowski wrote:
> 2015-04-03 10:26 GMT+02:00 Beomho Seo <beomho.seo@samsung.com>:
>> Currently, max17042 battery driver choose register map by MAX17042_DevName
>> register. But it is return IC specific firmware version. So other maxim chip
>> hard to use this drvier. This patch choose chip type from driver_data.
>>
>> Cc: Sebastian Reichel <sre@kernel.org>
>> Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
>> ---
>> drivers/power/max17042_battery.c | 33 ++++++++++----------------------
>> include/linux/power/max17042_battery.h | 9 ++++++++-
>> 2 files changed, 18 insertions(+), 24 deletions(-)
>
> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
>
> Best regards,
> Krzysztof
>
Thanks Krzysztof for your reviews.
Sebastian, Could you please merge that your git tree?
Best regards
Beomho
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] power: max17042-battery: Modify max17042 battery driver
2015-04-03 8:26 [PATCH v2 0/2] power: max17042-battery: Modify max17042 battery driver Beomho Seo
2015-04-03 8:26 ` [PATCH v2 1/2] power: max17042_battery: Use reg type instead of chip type Beomho Seo
2015-04-03 8:26 ` [PATCH v2 2/2] power: max17042_battery: add missed blank Beomho Seo
@ 2015-04-06 15:54 ` Sebastian Reichel
2 siblings, 0 replies; 6+ messages in thread
From: Sebastian Reichel @ 2015-04-06 15:54 UTC (permalink / raw)
To: Beomho Seo
Cc: k.kozlowski, linux-pm, linux-kernel, cw00.choi, inki.dae, sangbae90.lee
[-- Attachment #1: Type: text/plain, Size: 491 bytes --]
Hi Beomho,
On Fri, Apr 03, 2015 at 05:26:07PM +0900, Beomho Seo wrote:
> This patch modify max17042-battery.c fuel gauge driver for use max77843 fuel
> gauge. and then, fix minor cording style issue.
>
> This patchset is written based on recently battery git tree.
Thanks, pulled:
http://git.infradead.org/battery-2.6.git/commit/709c2c70c8ea73f488971f1de3c39fbdac995951
http://git.infradead.org/battery-2.6.git/commit/bbaeeaaf314aaf5e32e20070378bc14792ae3752
-- Sebastian
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-04-06 15:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-03 8:26 [PATCH v2 0/2] power: max17042-battery: Modify max17042 battery driver Beomho Seo
2015-04-03 8:26 ` [PATCH v2 1/2] power: max17042_battery: Use reg type instead of chip type Beomho Seo
2015-04-03 9:01 ` Krzysztof Kozlowski
2015-04-06 13:34 ` Beomho Seo
2015-04-03 8:26 ` [PATCH v2 2/2] power: max17042_battery: add missed blank Beomho Seo
2015-04-06 15:54 ` [PATCH v2 0/2] power: max17042-battery: Modify max17042 battery driver Sebastian Reichel
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).