Skip to contentSkip to conversation

Regulator: DA9052 regulator support v3

PATCH In review ashishj3 3 participants 4 messages Jul 6, 2011 – Oct 7, 2011

Subsystems (2)
lore
Share & tools
lore

ashishj3

author
#0 lore raw

PATCH 5/11 Regulator: DA9052 regulator support v3

The DA9052 PMIC has below featured regulators:-
4 DVS Buck converters 0.5V - 3.6V upto 1Amp.
10 Programmable LDO's High PSSR, 1% accuracy.

This patch support all the DA9052 regulators. The output voltages are fully programmable via I2C or SPI interface. The platform data with regulation constraints is passed down from the board to the regulator.

---
Changes since v3
- Corrected verify_range function

Changes since v2
- Check for current min_uA < 700000
- Corrected current conversions from mA to uA

---
 drivers/regulator/Kconfig            |    7 +
 drivers/regulator/Makefile           |    1 +
 drivers/regulator/da9052-regulator.c |  546 ++++++++++++++++++++++++++++++++++
 3 files changed, 554 insertions(+), 0 deletions(-)
 create mode 100755 drivers/regulator/da9052-regulator.c
drivers/regulator/Kconfig +7 -0
index fa61fe2..ae80461 100644
@@ -167,6 +167,13 @@ config REGULATOR_DA903X
 	  Say y here to support the BUCKs and LDOs regulators found on
 	  Dialog Semiconductor DA9030/DA9034 PMIC.
 
+config REGULATOR_DA9052
+        tristate "Dialog DA9052 regulators"
+        depends on PMIC_DA9052
+        help
+          Say y here to support the BUCKs and LDOs regulators found on
+          Dialog Semiconductor DA9052 PMIC.
+
 config REGULATOR_PCF50633
 	tristate "PCF50633 regulator driver"
         depends on MFD_PCF50633
drivers/regulator/Makefile +1 -0
index 8cb6d0d..3738361 100644
@@ -28,6 +28,7 @@ obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o
 obj-$(CONFIG_REGULATOR_WM8994) += wm8994-regulator.o
 obj-$(CONFIG_REGULATOR_TPS6586X) += tps6586x-regulator.o
 obj-$(CONFIG_REGULATOR_DA903X)	+= da903x.o
+obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o
 obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o
 obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o
 obj-$(CONFIG_REGULATOR_MC13783) += mc13783-regulator.o
drivers/regulator/da9052-regulator.c new file +546 -0

546 lines not on this page · raw message

Acked-by on v1 5/11
#1 lore raw
Quoted 3 lines · On Wed, Jul 06, 2011 at 04:06:50PM +0530, ashishj3 wrote:

The DA9052 PMIC has below featured regulators:-
4 DVS Buck converters 0.5V - 3.6V upto 1Amp.
10 Programmable LDO's High PSSR, 1% accuracy.

#2 lore raw
In reply to ashishj3
Quoted 29 lines · (2011年07月06日 18:36), ashishj3 wrote:
drivers/regulator/da9052-regulator.c new file +29 -0
+static int __devinit da9052_regulator_probe(struct platform_device *pdev)
+{
+	struct da9052_regulator *regulator;
+	struct da9052 *da9052;
+	struct da9052_pdata *pdata;
+	int ret;
+
+	regulator = kzalloc(sizeof(struct da9052_regulator), GFP_KERNEL);
+	if (!regulator)
+		return -ENOMEM;
+
+	da9052 = dev_get_drvdata(pdev->dev.parent);
+	pdata = da9052->dev->platform_data;
+
+	regulator->info = find_regulator_info(pdev->id);
+	if (regulator->info == NULL) {
+		dev_err(&pdev->dev, "invalid regulator ID specified\n");
+		ret = -EINVAL;
+		goto err;
+	}
+
+	regulator->rdev = regulator_register(&regulator->info->reg_desc,
+					     &pdev->dev,
+					     pdata->regulators[pdev->id],
+					     regulator);
+	if (IS_ERR(regulator->rdev)) {
+		dev_err(&pdev->dev, "failed to register regulator %s\n",
+			regulator->info->reg_desc.name);
+		ret = PTR_ERR(regulator->rdev);

drivers/regulator/da9052-regulator.c line 510

Quoted 10 lines
drivers/regulator/da9052-regulator.c new file +10 -0
+		goto err;
+	}
+
+	platform_set_drvdata(pdev, regulator);
+
+	return 0;
+err:
+	kfree(regulator);
+	return ret;
+}

Hi Ashish,

It seems to me that in this function, regulator->da9052 isn't initialized.

Regards,
Paul

#3 lore raw
Quoted 51 lines

-----Original Message-----
From: Ying-Chun Liu (PaulLiu) [mailto:[email protected]]
Sent: Friday, October 07, 2011 2:54 PM
To: Ashish Jangam
Cc: Mark Brown; Dajun; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [Patch 5/11] Regulator: DA9052 regulator support v3

Quoted 29 lines · (2011年07月06日 18:36), ashishj3 wrote:
drivers/regulator/da9052-regulator.c new file +29 -0
+static int __devinit da9052_regulator_probe(struct platform_device *pdev)
+{
+	struct da9052_regulator *regulator;
+	struct da9052 *da9052;
+	struct da9052_pdata *pdata;
+	int ret;
+
+	regulator = kzalloc(sizeof(struct da9052_regulator), GFP_KERNEL);
+	if (!regulator)
+		return -ENOMEM;
+
+	da9052 = dev_get_drvdata(pdev->dev.parent);
+	pdata = da9052->dev->platform_data;
+
+	regulator->info = find_regulator_info(pdev->id);
+	if (regulator->info == NULL) {
+		dev_err(&pdev->dev, "invalid regulator ID specified\n");
+		ret = -EINVAL;
+		goto err;
+	}
+
+	regulator->rdev = regulator_register(&regulator->info->reg_desc,
+					     &pdev->dev,
+					     pdata->regulators[pdev->id],
+					     regulator);
+	if (IS_ERR(regulator->rdev)) {
+		dev_err(&pdev->dev, "failed to register regulator %s\n",
+			regulator->info->reg_desc.name);
+		ret = PTR_ERR(regulator->rdev);

drivers/regulator/da9052-regulator.c line 510

Quoted 10 lines
drivers/regulator/da9052-regulator.c new file +10 -0
+		goto err;
+	}
+
+	platform_set_drvdata(pdev, regulator);
+
+	return 0;
+err:
+	kfree(regulator);
+	return ret;
+}

Hi Ashish,

Quoted 2 lines

It seems to me that in this function, regulator->da9052 isn't initialized.

Today I'm going to post regulator patch for DA9052 and DA9053 that has got fixes for this and few more bugs. This patch is thoroughly tested for DA9052 and DA9053.

Quoted 2 lines

Regards,
Paul

���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m���� ������?�I�