Skip to contentSkip to conversation

regulator: new drivers for AD5398 and AD5821

PATCH Superseded sonic zhang 2 participants 2 messages Jun 3, 2010

Subsystems (2)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 regulator: new drivers for AD5398 and AD5821

Quoted 1 line

From 75aeba6ffab1664102c470aad59533e36f0b861c Mon Sep 17 00:00:00 2001

From: Sonic Zhang <[email protected]>
Date: Thu, 3 Jun 2010 11:06:16 +0800
Subject: [PATCH v4] regulator: new drivers for AD5398 and AD5821

The AD5398 and AD5821 are single 10-bit DAC with 120 mA output current sink capability. They feature an internal reference and operates from a single 2.7 V to 5.5 V supply.

This driver supports both the AD5398 and the AD5821. It adapts into the voltage and current framework.

---
 drivers/regulator/Kconfig  |    6 +
 drivers/regulator/Makefile |    1 +
 drivers/regulator/ad5398.c |  300 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 307 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/ad5398.c
drivers/regulator/Kconfig +6 -0
index 04f2e08..679ea37 100644
@@ -201,5 +201,11 @@ config REGULATOR_88PM8607
 	help
 	  This driver supports 88PM8607 voltage regulator chips.
 
+config REGULATOR_AD5398
+	tristate "Analog Devices AD5398/AD5821 regulators"
+	depends on I2C
+	help
+	  This driver supports AD5398 and AD5821 current regulator chips.
+	  If building into module, its name is ad5398.ko.
 endif
 
drivers/regulator/Makefile +1 -0
index 4e7feec..c256668 100644
@@ -8,6 +8,7 @@ obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o
 obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o
 obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o
 
+obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o
 obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o
 obj-$(CONFIG_REGULATOR_DUMMY) += dummy.o
 obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o
drivers/regulator/ad5398.c new file +298 -0

298 lines not on this page · raw message

Signature · 1 line
1.6.0
#1 lore raw
Quoted 6 lines · sonic zhang

The AD5398 and AD5821 are single 10-bit DAC with 120 mA output current sink capability. They feature an internal reference and operates from a single 2.7 V to 5.5 V supply.

This driver supports both the AD5398 and the AD5821. It adapts into the voltage and current framework.

Looks good, just a few fairly small things.

drivers/regulator/ad5398.c line 241

Quoted 8 lines
drivers/regulator/ad5398.c new file +8 -0
+	if (chip->min_uA < init_data->constraints.min_uA)
+		chip->user_min_uA = init_data->constraints.min_uA;
+	else
+		chip->user_min_uA = chip->min_uA;
+	if (chip->max_uA > init_data->constraints.max_uA)
+		chip->user_max_uA = init_data->constraints.max_uA;
+	else
+		chip->user_max_uA = chip->max_uA;

Your driver should not be worrying about the constraints, the regulator core will take care of enforcing them.

drivers/regulator/ad5398.c line 298

Quoted 4 lines
drivers/regulator/ad5398.c new file +4 -0
+MODULE_DESCRIPTION("AD5398 and AD5821 current regulator driver");
+MODULE_AUTHOR("Sonic Zhang");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:ad5398-regulator");

This is an I2C device, not a platform device.