Skip to contentSkip to conversation

MAX8952 PMIC Driver Initial Release

PATCH New MyungJoo Ham 5 participants 12 messages Aug 20, 2010 – Sep 1, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 MAX8952 PMIC Driver Initial Release

MAX8952 PMIC is used to provide voltage output between 770mV - 1400mV with DVS support. In this initial release, users can set voltages for four DVS modes, RAMP delay values, and SYNC frequency. Controlling FPWM/SYNC_MODE/Pull-Down/Ramp Modes and reading CHIP_ID is not supported in this release.

If GPIO of EN is not valid in platform data, the driver assumes that it is always-on. If GPIO of VID0 or VID1 is invalid, the driver pulls down VID0 and VID1 to fix DVS mode as 0 and disables DVS support.

We assume that V_OUT is capable to provide every voltage from 770mV to 1.40V in 10mV steps although the data sheet has some ambiguity on it.

--
v2:
- Style correction
- Can accept platform_data with invalid GPIOs
- Removed unnecessary features
- Improved error handling

---
 drivers/regulator/Kconfig         |    8 +
 drivers/regulator/Makefile        |    1 +
 drivers/regulator/max8952.c       |  360 +++++++++++++++++++++++++++++++++++++
 include/linux/regulator/max8952.h |  135 ++++++++++++++
 4 files changed, 504 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/max8952.c
 create mode 100644 include/linux/regulator/max8952.h
drivers/regulator/Kconfig +8 -0
index 172951b..4889caa 100644
@@ -100,6 +100,14 @@ config REGULATOR_MAX8925
 	help
 	  Say y here to support the voltage regulaltor of Maxim MAX8925 PMIC.
 
+config REGULATOR_MAX8952
+	tristate "Maxim MAX8952 Power Management IC"
+	depends on I2C
+	help
+	  This driver controls a Maxim 8952 voltage output regulator
+	  via I2C bus. Maxim 8952 has one voltage output and supports 4 DVS
+	  modes ranging from 0.77V to 1.40V by 0.01V steps.
+
 config REGULATOR_MAX8998
 	tristate "Maxim 8998 voltage regulator"
 	depends on MFD_MAX8998
drivers/regulator/Makefile +1 -0
index 8285fd8..beff6da 100644
@@ -17,6 +17,7 @@ obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o
 obj-$(CONFIG_REGULATOR_MAX8649)	+= max8649.o
 obj-$(CONFIG_REGULATOR_MAX8660) += max8660.o
 obj-$(CONFIG_REGULATOR_MAX8925) += max8925-regulator.o
+obj-$(CONFIG_REGULATOR_MAX8952) += max8952.o
 obj-$(CONFIG_REGULATOR_MAX8998) += max8998.o
 obj-$(CONFIG_REGULATOR_WM831X) += wm831x-dcdc.o
 obj-$(CONFIG_REGULATOR_WM831X) += wm831x-isink.o
drivers/regulator/max8952.c new file +360 -0

360 lines not on this page · raw message

include/linux/regulator/max8952.h new file +135 -0

135 lines not on this page · raw message

Signature · 1 line
1.6.3.3
#1 lore raw

PATCH v2 1/1 MAX8952 PMIC Driver Initial Release

Quoted 10 lines · MyungJoo Ham

MAX8952 PMIC is used to provide voltage output between 770mV - 1400mV with DVS support. In this initial release, users can set voltages for four DVS modes, RAMP delay values, and SYNC frequency. Controlling FPWM/SYNC_MODE/Pull-Down/Ramp Modes and reading CHIP_ID is not supported in this release.

If GPIO of EN is not valid in platform data, the driver assumes that it is always-on. If GPIO of VID0 or VID1 is invalid, the driver pulls down VID0 and VID1 to fix DVS mode as 0 and disables DVS support.

Quoted 5 lines

We assume that V_OUT is capable to provide every voltage from 770mV to 1.40V in 10mV steps although the data sheet has some ambiguity on it.

#2 lore raw

PATCH v2 1/1 MAX8952 PMIC Driver Initial Release

Quoted 11 lines · Mark Brown
Quoted 10 lines · MyungJoo Ham

MAX8952 PMIC is used to provide voltage output between 770mV - 1400mV with DVS support. In this initial release, users can set voltages for four DVS modes, RAMP delay values, and SYNC frequency. Controlling FPWM/SYNC_MODE/Pull-Down/Ramp Modes and reading CHIP_ID is not supported in this release.

If GPIO of EN is not valid in platform data, the driver assumes that it is always-on. If GPIO of VID0 or VID1 is invalid, the driver pulls down VID0 and VID1 to fix DVS mode as 0 and disables DVS support.

Quoted 7 lines
Quoted 5 lines

We assume that V_OUT is capable to provide every voltage from 770mV to 1.40V in 10mV steps although the data sheet has some ambiguity on it.

Applied.

Thanks

Liam

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
#3 lore raw

PATCH v2 1/1 MAX8952 PMIC Driver Initial Release

Quoted 11 lines · Mark Brown
Quoted 5 lines · Mark Brown
Quoted 4 lines · MyungJoo Ham

MAX8952 PMIC is used to provide voltage output between 770mV - 1400mV with DVS support. In this initial release, users can set voltages for four DVS modes, RAMP delay values, and SYNC frequency. Controlling FPWM/SYNC_MODE/Pull-Down/Ramp Modes and reading

CHIP_ID

Quoted 3 lines
Quoted 3 lines

is not supported in this release.

If GPIO of EN is not valid in platform data, the driver assumes that

it

Quoted 1 line
Quoted 1 line
Quoted 1 line

is always-on. If GPIO of VID0 or VID1 is invalid, the driver pulls

down

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

VID0 and VID1 to fix DVS mode as 0 and disables DVS support.

We assume that V_OUT is capable to provide every voltage from 770mV to 1.40V in 10mV steps although the data sheet has some ambiguity on it.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Applied.

Sorry for late opinion...just wondering...

Seems almost same between the operation of max8649 and max8952 except output voltage range.

How do you think that can support max8952 with small modifying max8649?

Quoted 8 lines

Thanks

Liam
--
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#4 lore raw

PATCH v2 1/1 MAX8952 PMIC Driver Initial Release

Quoted 4 lines · Kukjin Kim

Seems almost same between the operation of max8649 and max8952 except output voltage range.

How do you think that can support max8952 with small modifying max8649?

Take a look at something like the WM831x drivers for how you can handle multiple devices with one driver - you can register I2C IDs for multiple devices and then select behaviour based on the name that was quoted.

#5 lore raw

PATCH v2 1/1 MAX8952 PMIC Driver Initial Release

Quoted 4 lines · Mark Brown
Quoted 1 line · Kukjin Kim

Seems almost same between the operation of max8649 and max8952 except

Quoted 8 lines

output

Quoted 3 lines

voltage range.

How do you think that can support max8952 with small modifying max8649?

Take a look at something like the WM831x drivers for how you can handle multiple devices with one driver - you can register I2C IDs for multiple devices and then select behaviour based on the name that was quoted.

MM...but I'm not sure if I can submit other patch for max8952... Actually, Mr. Ham's max8952 code has been applied by Liam.

Anyway, could you please see below patch?
Basic functions are tested on the board...

From: Changhwan Youn <[email protected]>
---

drivers/regulator/max8649.c +9 -1
index 4520ace..a13bf1d 100644
@@ -22,6 +22,9 @@
 #define MAX8649_DCDC_STEP	10000		/* uV */
 #define MAX8649_VOL_MASK	0x3f
 
+/* difference between voltages of max8649 and max8952 */
+#define DIFF_DCDC_VOL		20000		/* uV */
+
 /* Registers */
 #define MAX8649_MODE0		0x00
 #define MAX8649_MODE1		0x01
@@ -138,7 +141,12 @@ static inline int check_range(int min_uV, int max_uV)
 
 static int max8649_list_voltage(struct regulator_dev *rdev, unsigned index)
 {
-	return (MAX8649_DCDC_VMIN + index * MAX8649_DCDC_STEP);
+	struct max8649_regulator_info *info = rdev_get_drvdata(rdev);
+	int ret = MAX8649_DCDC_VMIN + index * MAX8649_DCDC_STEP;
+
+	if (!strcmp(info->i2c->name, "max8952"))
+		ret += DIFF_DCDC_VOL;
+	return ret;
 }
 
 static int max8649_get_voltage(struct regulator_dev *rdev)
@@ -160,6 +168,11 @@ static int max8649_set_voltage(struct regulator_dev

*rdev,
struct max8649_regulator_info *info = rdev_get_drvdata(rdev); unsigned char data, mask;

+ if (!strcmp(info->i2c->name, "max8952")) {
+ min_uV -= DIFF_DCDC_VOL;
+ max_uV -= DIFF_DCDC_VOL;
+ }
+
if (check_range(min_uV, max_uV)) {
dev_err(info->dev, "invalid voltage range (%d, %d) uV\n",
min_uV, max_uV);
@@ -263,7 +276,6 @@ static struct regulator_ops max8649_dcdc_ops = {
.enable_time = max8649_enable_time,
.set_mode = max8649_set_mode,
.get_mode = max8649_get_mode,
-
};

static struct regulator_desc dcdc_desc = {
@@ -311,13 +323,13 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client,
break;
}

- ret = max8649_reg_read(info->i2c, MAX8649_CHIP_ID1);
+ ret = max8649_reg_read(info->i2c, MAX8649_CHIP_ID2);
if (ret < 0) {
dev_err(info->dev, "Failed to detect ID of MAX8649:%d\n",
ret);
goto out;
}
- dev_info(info->dev, "Detected MAX8649 (ID:%x)\n", ret);
+ dev_info(info->dev, "Detected %s (ID:%x)\n", id->name, ret);

/* enable VID0 & VID1 */
max8649_set_bits(info->i2c, MAX8649_CONTROL, MAX8649_VID_MASK, 0);
@@ -354,7 +366,7 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client,
goto out;
}

- dev_info(info->dev, "Max8649 regulator device is detected.\n");
+ dev_info(info->dev, "%s regulator device is detected.\n", id->name);
return 0;
out:
kfree(info);
@@ -376,6 +388,7 @@ static int __devexit max8649_regulator_remove(struct i2c_client *client)

static const struct i2c_device_id max8649_id[] = {
{ "max8649", 0 },
+ { "max8952", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, max8649_id);
--
1.6.2.5

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#6 lore raw

PATCH v2 1/1 MAX8952 PMIC Driver Initial Release

Quoted 2 lines · Kukjin Kim

MM...but I'm not sure if I can submit other patch for max8952... Actually, Mr. Ham's max8952 code has been applied by Liam.

We can always remove that if it makes more sense to combine the code.

drivers/regulator/max8649.c static inline int check_range(int min_uV, int max_uV) · line 147

Quoted 5 lines
drivers/regulator/max8649.c +4 -1
-	return (MAX8649_DCDC_VMIN + index * MAX8649_DCDC_STEP);
+	struct max8649_regulator_info *info = rdev_get_drvdata(rdev);
+	int ret = MAX8649_DCDC_VMIN + index * MAX8649_DCDC_STEP;
+
+	if (!strcmp(info->i2c->name, "max8952"))

Rather than doing a strcmp on the name you should use the id field here:

Review

Quoted 5 lines

static const struct i2c_device_id max8649_id[] = {

(quoted diff) +1 -0
 	{ "max8649", 0 },
+	{ "max8952", 0 },
 	{ }
 };

to pass in a value which you compare against. While it's probably not a performance issue on this chip this is much clearer and more idiomatic.

#7 lore raw

PATCH v2 1/1 MAX8952 PMIC Driver Initial Release

Quoted 8 lines · Mark Brown
Quoted 2 lines · Kukjin Kim

MM...but I'm not sure if I can submit other patch for max8952... Actually, Mr. Ham's max8952 code has been applied by Liam.

We can always remove that if it makes more sense to combine the code.

Quoted 8 lines

drivers/regulator/max8649.c static inline int check_range(int min_uV, int max_uV) · line 147

Quoted 5 lines
drivers/regulator/max8649.c +4 -1
-	return (MAX8649_DCDC_VMIN + index * MAX8649_DCDC_STEP);
+	struct max8649_regulator_info *info = rdev_get_drvdata(rdev);
+	int ret = MAX8649_DCDC_VMIN + index * MAX8649_DCDC_STEP;
+
+	if (!strcmp(info->i2c->name, "max8952"))

Rather than doing a strcmp on the name you should use the id field here:

Ok..will fix it.

Quoted 8 lines

Review

Quoted 5 lines

static const struct i2c_device_id max8649_id[] = {

(quoted diff) +1 -0
 	{ "max8649", 0 },
+	{ "max8952", 0 },
 	{ }
 };

to pass in a value which you compare against. While it's probably not a performance issue on this chip this is much clearer and more idiomatic.

Thanks for your review and suggestion.
Will submit as per your comments.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#8 lore raw

PATCH v2 1/1 MAX8952 PMIC Driver Initial Release

In reply to Kukjin Kim
Quoted 73 lines · Kukjin Kim
Quoted 4 lines · Mark Brown
Quoted 1 line · Kukjin Kim

Seems almost same between the operation of max8649 and max8952 except

Quoted 8 lines

output

Quoted 3 lines

voltage range.

How do you think that can support max8952 with small modifying max8649?

Take a look at something like the WM831x drivers for how you can handle multiple devices with one driver - you can register I2C IDs for multiple devices and then select behaviour based on the name that was quoted.

MM...but I'm not sure if I can submit other patch for max8952... Actually, Mr. Ham's max8952 code has been applied by Liam.

Anyway, could you please see below patch?
Basic functions are tested on the board...

From: Changhwan Youn <[email protected]>
---

drivers/regulator/max8649.c +0 -0
index 4520ace..a13bf1d 100644
@@ -22,6 +22,9 @@

?#define MAX8649_DCDC_STEP ? ? ?10000 ? ? ? ? ? /* uV */ ?#define MAX8649_VOL_MASK ? ? ? 0x3f

drivers/regulator/max8649.c +3 -0
+/* difference between voltages of max8649 and max8952 */
+#define DIFF_DCDC_VOL ? ? ? ? ?20000 ? ? ? ? ? /* uV */
+

?/* Registers */
?#define MAX8649_MODE0 ? ? ? ? ?0x00
?#define MAX8649_MODE1 ? ? ? ? ?0x01

drivers/regulator/max8649.c +11 -1
@@ -138,7 +141,12 @@ static inline int check_range(int min_uV, int max_uV)
 
 ?static int max8649_list_voltage(struct regulator_dev *rdev, unsigned index)
 ?{
- ? ? ? return (MAX8649_DCDC_VMIN + index * MAX8649_DCDC_STEP);
+ ? ? ? struct max8649_regulator_info *info = rdev_get_drvdata(rdev);
+ ? ? ? int ret = MAX8649_DCDC_VMIN + index * MAX8649_DCDC_STEP;
+
+ ? ? ? if (!strcmp(info->i2c->name, "max8952"))
+ ? ? ? ? ? ? ? ret += DIFF_DCDC_VOL;
+ ? ? ? return ret;
 ?}
 
 ?static int max8649_get_voltage(struct regulator_dev *rdev)
@@ -160,6 +168,11 @@ static int max8649_set_voltage(struct regulator_dev
 *rdev,
 ? ? ? ?struct max8649_regulator_info *info = rdev_get_drvdata(rdev);
 ? ? ? ?unsigned char data, mask;
 
+ ? ? ? if (!strcmp(info->i2c->name, "max8952")) {
+ ? ? ? ? ? ? ? min_uV -= DIFF_DCDC_VOL;
+ ? ? ? ? ? ? ? max_uV -= DIFF_DCDC_VOL;
+ ? ? ? }
+
 ? ? ? ?if (check_range(min_uV, max_uV)) {
 ? ? ? ? ? ? ? ?dev_err(info->dev, "invalid voltage range (%d, %d) uV\n",

? ? ? ? ? ? ? ? ? ? ? ?min_uV, max_uV);

drivers/regulator/max8649.c +0 -1
@@ -263,7 +276,6 @@ static struct regulator_ops max8649_dcdc_ops = {
 ? ? ? ?.enable_time ? ?= max8649_enable_time,
 ? ? ? ?.set_mode ? ? ? = max8649_set_mode,
 ? ? ? ?.get_mode ? ? ? = max8649_get_mode,
-
 ?};
 
 ?static struct regulator_desc dcdc_desc = {

drivers/regulator/max8649.c static int __devinit max8649_regulator_probe(struct · line 327

Quoted 6 lines
drivers/regulator/max8649.c +1 -1
@@ -311,13 +323,13 @@ static int __devinit max8649_regulator_probe(struct
 i2c_client *client,
 ? ? ? ? ? ? ? ?break;
 ? ? ? ?}
 
- ? ? ? ret = max8649_reg_read(info->i2c, MAX8649_CHIP_ID1);
+ ? ? ? ret = max8649_reg_read(info->i2c, MAX8649_CHIP_ID2);

Why do you read the ID2? original code read the ID1. With this change don't brake the max8649?

Quoted 46 lines
drivers/regulator/max8649.c +1 -1
 ? ? ? ?if (ret < 0) {
 ? ? ? ? ? ? ? ?dev_err(info->dev, "Failed to detect ID of MAX8649:%d\n",
 ? ? ? ? ? ? ? ? ? ? ? ?ret);
 ? ? ? ? ? ? ? ?goto out;
 ? ? ? ?}
- ? ? ? dev_info(info->dev, "Detected MAX8649 (ID:%x)\n", ret);
+ ? ? ? dev_info(info->dev, "Detected %s (ID:%x)\n", id->name, ret);
 

? ? ? ?/* enable VID0 & VID1 */
? ? ? ?max8649_set_bits(info->i2c, MAX8649_CONTROL, MAX8649_VID_MASK, 0);

drivers/regulator/max8649.c +1 -1
@@ -354,7 +366,7 @@ static int __devinit max8649_regulator_probe(struct
 i2c_client *client,
 ? ? ? ? ? ? ? ?goto out;
 ? ? ? ?}
 
- ? ? ? dev_info(info->dev, "Max8649 regulator device is detected.\n");
+ ? ? ? dev_info(info->dev, "%s regulator device is detected.\n", id->name);
 ? ? ? ?return 0;

?out:
? ? ? ?kfree(info);

drivers/regulator/max8649.c +1 -0
@@ -376,6 +388,7 @@ static int __devexit max8649_regulator_remove(struct
 i2c_client *client)
 
 ?static const struct i2c_device_id max8649_id[] = {
 ? ? ? ?{ "max8649", 0 },
+ ? ? ? { "max8952", 0 },
 ? ? ? ?{ }
 ?};

?MODULE_DEVICE_TABLE(i2c, max8649_id);
--
1.6.2.5

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html

#9 lore raw

PATCH v2 1/1 MAX8952 PMIC Driver Initial Release

Quoted 11 lines · Kyungmin Park
Quoted 9 lines · Kukjin Kim
Quoted 8 lines · Mark Brown
Quoted 1 line · Kukjin Kim

Seems almost same between the operation of max8649 and max8952 except

output

Quoted 3 lines

voltage range.

How do you think that can support max8952 with small modifying

max8649?

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Take a look at something like the WM831x drivers for how you can handle multiple devices with one driver - you can register I2C IDs for

multiple

Quoted 15 lines
Quoted 15 lines
Quoted 1 line

devices and then select behaviour based on the name that was quoted.

MM...but I'm not sure if I can submit other patch for max8952... Actually, Mr. Ham's max8952 code has been applied by Liam.

Anyway, could you please see below patch?
Basic functions are tested on the board...

From: Changhwan Youn <[email protected]>
---

drivers/regulator/max8649.c +0 -0
index 4520ace..a13bf1d 100644

(snip)

Quoted 1 line

drivers/regulator/max8649.c static int __devinit

Quoted 1 line
drivers/regulator/max8649.c +0 -0
@@ -311,13 +323,13 @@ static int __devinit

max8649_regulator_probe(struct

Quoted 8 lines

drivers/regulator/max8649.c static int __devinit · line 327

Quoted 6 lines
drivers/regulator/max8649.c +1 -1
 i2c_client *client,
                break;
        }
 
-       ret = max8649_reg_read(info->i2c, MAX8649_CHIP_ID1);
+       ret = max8649_reg_read(info->i2c, MAX8649_CHIP_ID2);

Why do you read the ID2? original code read the ID1. With this change don't brake the max8649?

It's no problem, because it is used only in the following printout.

And the reason of changing is that the CHIP_ID1 value of max8649 and max 8952 is same by 0x20.
So cannot distinguish them. If change to CHIP_ID2, can separate them in the printout.
(The CHIP_ID2 value of max 8649 is '0x0D', max8952 is '0x1A')

Quoted 10 lines
Quoted 10 lines
drivers/regulator/max8649.c +1 -1
        if (ret < 0) {
                dev_err(info->dev, "Failed to detect ID of MAX8649:%d\n",
                        ret);
                goto out;
        }
-       dev_info(info->dev, "Detected MAX8649 (ID:%x)\n", ret);
+       dev_info(info->dev, "Detected %s (ID:%x)\n", id->name, ret);
 
        /* enable VID0 & VID1 */

       max8649_set_bits(info->i2c, MAX8649_CONTROL, MAX8649_VID_MASK,

Quoted 8 lines

0);

drivers/regulator/max8649.c static int __devinit max8649_regulator_probe(struct · line 370

Quoted 7 lines
drivers/regulator/max8649.c +1 -1
@@ -354,7 +366,7 @@ static int __devinit max8649_regulator_probe(struct
 i2c_client *client,
                goto out;
        }
 
-       dev_info(info->dev, "Max8649 regulator device is detected.\n");
+       dev_info(info->dev, "%s regulator device is detected.\n",

id->name);

Quoted 6 lines
Quoted 6 lines
drivers/regulator/max8649.c +0 -0
        return 0;

 out:
       kfree(info);

drivers/regulator/max8649.c +0 -0
@@ -376,6 +388,7 @@ static int __devexit max8649_regulator_remove(struct
 i2c_client *client)
 
Quoted 10 lines
Quoted 10 lines
drivers/regulator/max8649.c +1 -0
  static const struct i2c_device_id max8649_id[] = {
        { "max8649", 0 },
+       { "max8952", 0 },
        { }
  };

 MODULE_DEVICE_TABLE(i2c, max8649_id);
--
1.6.2.5

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#10 lore raw

PATCH v2 1/1 MAX8952 PMIC Driver Initial Release

Quoted 46 lines · Kukjin Kim
Quoted 11 lines · Kyungmin Park
Quoted 9 lines · Kukjin Kim
Quoted 8 lines · Mark Brown
Quoted 1 line · Kukjin Kim

Seems almost same between the operation of max8649 and max8952 except

output

Quoted 3 lines

voltage range.

How do you think that can support max8952 with small modifying

max8649?

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Take a look at something like the WM831x drivers for how you can handle multiple devices with one driver - you can register I2C IDs for

multiple

Quoted 15 lines
Quoted 15 lines
Quoted 1 line

devices and then select behaviour based on the name that was quoted.

MM...but I'm not sure if I can submit other patch for max8952... Actually, Mr. Ham's max8952 code has been applied by Liam.

Anyway, could you please see below patch?
Basic functions are tested on the board...

From: Changhwan Youn <[email protected]>
---

drivers/regulator/max8649.c +0 -0
index 4520ace..a13bf1d 100644

(snip)

Quoted 1 line

drivers/regulator/max8649.c static int __devinit

Quoted 1 line
drivers/regulator/max8649.c +0 -0
@@ -311,13 +323,13 @@ static int __devinit

max8649_regulator_probe(struct

Quoted 8 lines

drivers/regulator/max8649.c static int __devinit · line 327

Quoted 6 lines
drivers/regulator/max8649.c +1 -1
 i2c_client *client,
 ? ? ? ? ? ? ? ?break;
 ? ? ? ?}
 
- ? ? ? ret = max8649_reg_read(info->i2c, MAX8649_CHIP_ID1);
+ ? ? ? ret = max8649_reg_read(info->i2c, MAX8649_CHIP_ID2);

Why do you read the ID2? original code read the ID1. With this change don't brake the max8649?

Quoted 7 lines

It's no problem, because it is used only in the following printout.

And the reason of changing is that the CHIP_ID1 value of max8649 and max 8952 is same by 0x20.
So cannot distinguish them. If change to CHIP_ID2, can separate them in the printout.
(The CHIP_ID2 value of max 8649 is '0x0D', max8952 is '0x1A')

As your word, first check the ID1 to detect the 8649 and 8952 and read ID2 again to distinguish it. But actually we pass the max8952 as platform device, so don't need to read ID2.

Thank you,
Kyungmin Park

Quoted 51 lines
Quoted 11 lines
Quoted 11 lines
drivers/regulator/max8649.c +1 -1
 ? ? ? ?if (ret < 0) {
 ? ? ? ? ? ? ? ?dev_err(info->dev, "Failed to detect ID of MAX8649:%d\n",
 ? ? ? ? ? ? ? ? ? ? ? ?ret);
 ? ? ? ? ? ? ? ?goto out;
 ? ? ? ?}
- ? ? ? dev_info(info->dev, "Detected MAX8649 (ID:%x)\n", ret);
+ ? ? ? dev_info(info->dev, "Detected %s (ID:%x)\n", id->name, ret);
 

? ? ? ?/* enable VID0 & VID1 */
? ? ? ?max8649_set_bits(info->i2c, MAX8649_CONTROL, MAX8649_VID_MASK,

Quoted 8 lines

0);

drivers/regulator/max8649.c static int __devinit max8649_regulator_probe(struct · line 370

Quoted 7 lines
drivers/regulator/max8649.c +1 -1
@@ -354,7 +366,7 @@ static int __devinit max8649_regulator_probe(struct
 i2c_client *client,
 ? ? ? ? ? ? ? ?goto out;
 ? ? ? ?}
 
- ? ? ? dev_info(info->dev, "Max8649 regulator device is detected.\n");
+ ? ? ? dev_info(info->dev, "%s regulator device is detected.\n",

id->name);

Quoted 6 lines
Quoted 6 lines
drivers/regulator/max8649.c +0 -0
 ? ? ? ?return 0;

?out:
? ? ? ?kfree(info);

drivers/regulator/max8649.c +0 -0
@@ -376,6 +388,7 @@ static int __devexit max8649_regulator_remove(struct
 i2c_client *client)
 
Quoted 10 lines
Quoted 10 lines
drivers/regulator/max8649.c +1 -0
 ?static const struct i2c_device_id max8649_id[] = {
 ? ? ? ?{ "max8649", 0 },
+ ? ? ? { "max8952", 0 },
 ? ? ? ?{ }
 ?};

?MODULE_DEVICE_TABLE(i2c, max8649_id);
--
1.6.2.5

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html

#11 lore raw

PATCH v2 1/1 MAX8952 PMIC Driver Initial Release

Quoted 3 lines · Kyungmin Park

As your word, first check the ID1 to detect the 8649 and 8952 and read ID2 again to distinguish it. But actually we pass the max8952 as platform device, so don't need to read ID2.

If you can read the ID from the chip it's always good to do so in order to verify that the user has supplied accurate information.