Skip to contentSkip to conversation

Add initial support for DA9150 Charger & Fuel-Gauge IC

PATCH Superseded Adam Thomson 5 participants 18 messages Jan 21, 2015 – Feb 17, 2015

Subsystems (4)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v6 cover Add initial support for DA9150 Charger & Fuel-Gauge IC

This patch set adds initial support for the Dialog DA9150 Integrated Charger & Fuel-Gauge IC. The device also provides GPIO and GPADC functionality.

In this patch set the following is provided:
- MFD Core support and DT bindings documentation.
- IIO GPADC support and DT bindings documentation.
- Power Supply Charger support and DT bindings documentation.
- Update to MAINTAINERS file to add DA9150 files to Dialog support list.

To keep patch submission from being too large, support for GPIO and Fuel-Gauge will come after initial support patches are accepted.

This patch set is baselined against the v3.19-rc5 kernel version.

Changes in v6:
- For GPADC driver, Use lower case extended names for IIO GPADC channels, and remove extended names for GPIO related channels.
- For charger driver, revert to no devm IRQ request/free functions as ordering is important, and probe failure scenario was not being correctly covered. A helper function for free IRQs has been added to make code cleaner.

Changes in v5:
- Use sizeof(*gpadc) instead of sizeof(struct da9150_gpadc) in GPADC driver.
- Fix erroneous goto for IRQ failure in GPADC driver. Now returns err directly.
- Remove IIO ABI document patch as this has been taken by maintainer.

Changes in v4:
- Correct MODULE_AUTHOR lines so e-mail addresses correctly surrounded with <>.
- Update to MFD binding document to remove unnecesary I2C reference, make module description generic, and add link to interrupt binding documentation.
- For GPADC driver, irq request moved above iio related calls in probe() to mirror correctly the remove() function ordering, as requested.
- For charger driver, remove additional sysfs entries as these are not necessary (debug only).
- For charger driver, add helper function for requesting IRQs, to make probe() function cleaner/simpler.

Changes in v3:
- IRQ register and remove helper functions removed from MFD, deemed unnecessary. Drivers using helper functions updated to use direct calls to relevant kernel framework functions.
- MFD I2C file removed and code folded into -core file as requested.
- MFD core now buildable as driver module.
- Platform data structure definition moved into core header, pdata.h removed.
- Update functions in GPADC driver to be static, where appropriate.
- Change units of GPADC readings to match ABI documentation. Updates to charger driver also made to align with this modification.
- Refactor GPADC temp calculations to use scale & offset method.
- Scale values now returned as FRACTIONAL to allow for accurate conversion in user-space.
- Tidy up of GPADC scale, offset and raw functions to return from case statements with correct return types.
- Update GPADC channel macros naming to prefix with DA9150, prevent conflict.
- GPADC GPIO voltage readings actually in 6V range, updated accordingly.
- Addition to IIO ABI document to add details on input current readings.
- Small style updates to address comments.

Changes in v2:
- Drop devicetree prefix patch as this is being dealt with separately.
- IIO framework fix patch removed from set, has already been accepted/merged.
- Use __ instead of _ for protecting #ifdefs in headers.
- Moved private data & definitions to source files and remove unwanted headers.
- Bug fix to EXPORT_SYMBOL for common functions in MFD core used by sub-devices, so they can be correctly built as kernel modules.
- Removed unnecessary channels from GPADC IIO driver to simplify code.
- For GPADC IIO driver, VBAT reading now provides scale and offset values as it is a linear scale.
- GPADC read code refactored to make it tidier.
- Remove use of flag to indicate GPADC availability. IIO framework should indicate need to defer if it's not yet instantiated.
- Unwanted comments removed.
- Removed conditional shutdown of device (Charger/MFD) as this is not needed.
- Removed AC type supply from charger as device cannot differentiate. Now just uses USB supply type.
- Removed use of invalid-tbat flag from platform data as it doesn't really add anything to the driver except forcing battery present status.
- Bug fix for checking of usb_phy validity in Charger probe() function.
- Addition of common IRQ release function to allow sub-devices to explicitly tidy up IRQs when devm clean up is too late.
- Improved tidy up of resources in charger.
- Fix location of IIO GPADC related devicetree binding document so it now resides correctly under 'adc' directory.
- Add update to MAINTAINERS file to include these files in Dialog support list.

Adam Thomson (7):
mfd: Add support for DA9150 combined charger & fuel-gauge device
mfd: da9150: Add DT binding documentation for core
iio: Add support for DA9150 GPADC
iio: da9150: Add DT binding documentation for GPADC
power: Add support for DA9150 Charger
power: da9150: Add DT binding documentation for charger
MAINTAINERS: Include DA9150 files in Dialog Semiconductor support
list.

 .../devicetree/bindings/iio/adc/da9150-gpadc.txt   |   16 +
 Documentation/devicetree/bindings/mfd/da9150.txt   |   43 +
 .../devicetree/bindings/power/da9150-charger.txt   |   26 +
 MAINTAINERS                                        |    4 +
 drivers/iio/adc/Kconfig                            |    9 +
 drivers/iio/adc/Makefile                           |    1 +
 drivers/iio/adc/da9150-gpadc.c                     |  407 +++++++
 drivers/mfd/Kconfig                                |   12 +
 drivers/mfd/Makefile                               |    2 +-
 drivers/mfd/da9150-core.c                          |  413 +++++++
 drivers/power/Kconfig                              |   12 +
 drivers/power/Makefile                             |    1 +
 drivers/power/da9150-charger.c                     |  688 ++++++++++++
 include/linux/mfd/da9150/core.h                    |   68 ++
 include/linux/mfd/da9150/registers.h               | 1155 ++++++++++++++++++++
 15 files changed, 2856 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/da9150-gpadc.txt
 create mode 100644 Documentation/devicetree/bindings/mfd/da9150.txt
 create mode 100644 Documentation/devicetree/bindings/power/da9150-charger.txt
 create mode 100644 drivers/iio/adc/da9150-gpadc.c
 create mode 100644 drivers/mfd/da9150-core.c
 create mode 100644 drivers/power/da9150-charger.c
 create mode 100644 include/linux/mfd/da9150/core.h
 create mode 100644 include/linux/mfd/da9150/registers.h

--
1.9.3

#1 lore raw

PATCH v6 1/7 mfd: Add support for DA9150 combined charger & fuel-gauge device

DA9150 is a combined Charger and Fuel-Gauge IC, with additional GPIO and GPADC functionality.

---
 drivers/mfd/Kconfig                  |   12 +
 drivers/mfd/Makefile                 |    2 +-
 drivers/mfd/da9150-core.c            |  413 ++++++++++++
 include/linux/mfd/da9150/core.h      |   68 ++
 include/linux/mfd/da9150/registers.h | 1155 ++++++++++++++++++++++++++++++++++
 5 files changed, 1649 insertions(+), 1 deletion(-)
 create mode 100644 drivers/mfd/da9150-core.c
 create mode 100644 include/linux/mfd/da9150/core.h
 create mode 100644 include/linux/mfd/da9150/registers.h
drivers/mfd/Kconfig +12 -0
index 2e6b731..56e80d2 100644
@@ -195,6 +195,18 @@ config MFD_DA9063
 	  Additional drivers must be enabled in order to use the functionality
 	  of the device.
 
+config MFD_DA9150
+	tristate "Dialog Semiconductor DA9150 Charger Fuel-Gauge chip"
+	depends on I2C=y
+	select MFD_CORE
+	select REGMAP_I2C
+	select REGMAP_IRQ
+	help
+	  This adds support for the DA9150 integrated charger and fuel-gauge
+	  chip. This driver provides common support for accessing the device.
+	  Additional drivers must be enabled in order to use the specific
+	  features of the device.
+
 config MFD_DLN2
 	tristate "Diolan DLN2 support"
 	select MFD_CORE
drivers/mfd/Makefile +1 -1
index 53467e2..f06f4c6 100644
@@ -113,7 +113,7 @@ obj-$(CONFIG_MFD_DA9055)	+= da9055.o
 
 da9063-objs			:= da9063-core.o da9063-irq.o da9063-i2c.o
 obj-$(CONFIG_MFD_DA9063)	+= da9063.o
-
+obj-$(CONFIG_MFD_DA9150)	+= da9150-core.o
 obj-$(CONFIG_MFD_MAX14577)	+= max14577.o
 obj-$(CONFIG_MFD_MAX77686)	+= max77686.o
 obj-$(CONFIG_MFD_MAX77693)	+= max77693.o
drivers/mfd/da9150-core.c new file +413 -0

413 lines not on this page · raw message

include/linux/mfd/da9150/core.h new file +68 -0

68 lines not on this page · raw message

include/linux/mfd/da9150/registers.h new file +1155 -0

1,155 lines not on this page · raw message

--
1.9.3

#2 lore raw

PATCH v6 2/7 mfd: da9150: Add DT binding documentation for core

In reply to Adam Thomson
---
 Documentation/devicetree/bindings/mfd/da9150.txt | 43 ++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/da9150.txt
Documentation/devicetree/bindings/mfd/da9150.txt new file +43 -0
new file mode 100644
index 0000000..d0588ea
@@ -0,0 +1,43 @@
+Dialog Semiconductor DA9150 Combined Charger/Fuel-Gauge MFD bindings
+
+DA9150 consists of a group of sub-devices:
+
+Device			 Description
+------			 -----------
+da9150-gpadc		: General Purpose ADC
+da9150-charger		: Battery Charger
+
+======
+
+Required properties:
+- compatible : Should be "dlg,da9150"
+- reg: Specifies the I2C slave address
+- interrupt-parent: Specifies the phandle of the interrupt controller to which
+  the IRQs from da9150 are delivered to.
+- interrupts: IRQ line info for da9150 chip.
+- interrupt-controller: da9150 has internal IRQs (own IRQ domain).
+  (See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt for
+   further information relating to interrupt properties)
+
+Sub-devices:
+- da9150-gpadc: See Documentation/devicetree/bindings/iio/adc/da9150-gpadc.txt
+- da9150-charger: See Documentation/devicetree/bindings/power/da9150-charger.txt
+
+
+Example:
+
+	charger_fg: da9150@58 {
+		compatible = "dlg,da9150";
+		reg = <0x58>;
+		interrupt-parent = <&gpio6>;
+		interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
+		interrupt-controller;
+
+		gpadc: da9150-gpadc {
+			...
+		};
+
+		da9150-charger {
+			...
+		};
+	};

--
1.9.3

#3 lore raw

PATCH v6 3/7 iio: Add support for DA9150 GPADC

In reply to Adam Thomson

This patch adds support for DA9150 Charger & Fuel-Gauge IC GPADC.

---
 drivers/iio/adc/Kconfig        |   9 +
 drivers/iio/adc/Makefile       |   1 +
 drivers/iio/adc/da9150-gpadc.c | 407 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 417 insertions(+)
 create mode 100644 drivers/iio/adc/da9150-gpadc.c
drivers/iio/adc/Kconfig +9 -0
index 0f79e47..6e00b81 100644
@@ -135,6 +135,15 @@ config AXP288_ADC
 	  device. Depending on platform configuration, this general purpose ADC can
 	  be used for sampling sensors such as thermal resistors.
 
+config DA9150_GPADC
+	tristate "Dialog DA9150 GPADC driver support"
+	depends on MFD_DA9150
+	help
+	  Say yes here to build support for Dialog DA9150 GPADC.
+
+	  This driver can also be built as a module. If chosen, the module name
+	  will be da9150-gpadc.
+
 config EXYNOS_ADC
 	tristate "Exynos ADC driver support"
 	depends on ARCH_EXYNOS || ARCH_S3C24XX || ARCH_S3C64XX || (OF && COMPILE_TEST)
drivers/iio/adc/Makefile +1 -0
index 701fdb7..d56ee9b 100644
@@ -15,6 +15,7 @@ obj-$(CONFIG_AD7887) += ad7887.o
 obj-$(CONFIG_AD799X) += ad799x.o
 obj-$(CONFIG_AT91_ADC) += at91_adc.o
 obj-$(CONFIG_AXP288_ADC) += axp288_adc.o
+obj-$(CONFIG_DA9150_GPADC) += da9150-gpadc.o
 obj-$(CONFIG_EXYNOS_ADC) += exynos_adc.o
 obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o
 obj-$(CONFIG_MAX1027) += max1027.o
drivers/iio/adc/da9150-gpadc.c new file +407 -0

407 lines not on this page · raw message

--
1.9.3

#6 lore raw

PATCH v6 4/7 iio: da9150: Add DT binding documentation for GPADC

In reply to Adam Thomson
---
 .../devicetree/bindings/iio/adc/da9150-gpadc.txt         | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/da9150-gpadc.txt
Documentation/devicetree/bindings/iio/adc/da9150-gpadc.txt new file +16 -0
new file mode 100644
index 0000000..c07228d
@@ -0,0 +1,16 @@
+Dialog Semiconductor DA9150 IIO GPADC bindings
+
+Required properties:
+- compatible: "dlg,da9150-gpadc" for DA9150 IIO GPADC
+- #io-channel-cells: Should be set to <1>
+  (See Documentation/devicetree/bindings/iio/iio-bindings.txt for further info)
+
+For further information on GPADC channels, see device datasheet.
+
+
+Example:
+
+	gpadc: da9150-gpadc {
+		compatible = "dlg,da9150-gpadc";
+		#io-channel-cells = <1>;
+	};

--
1.9.3

#7 lore raw

PATCH v6 5/7 power: Add support for DA9150 Charger

In reply to Adam Thomson

This patch adds support for DA9150 Charger & Fuel-Gauge IC Charger.

---
 drivers/power/Kconfig          |  12 +
 drivers/power/Makefile         |   1 +
 drivers/power/da9150-charger.c | 688 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 701 insertions(+)
 create mode 100644 drivers/power/da9150-charger.c
drivers/power/Kconfig +12 -0
index 0108c2a..eb79a7a 100644
@@ -192,6 +192,18 @@ config BATTERY_DA9052
 	  Say Y here to enable support for batteries charger integrated into
 	  DA9052 PMIC.
 
+config CHARGER_DA9150
+	tristate "Dialog Semiconductor DA9150 Charger support"
+	depends on MFD_DA9150
+	depends on DA9150_GPADC
+	depends on IIO
+	help
+	  Say Y here to enable support for charger unit of the DA9150
+	  Integrated Charger & Fuel-Gauge IC.
+
+	  This driver can also be built as a module. If so, the module will be
+	  called da9150-charger.
+
 config BATTERY_MAX17040
 	tristate "Maxim MAX17040 Fuel Gauge"
 	depends on I2C
drivers/power/Makefile +1 -0
index dfa8942..0c1896d 100644
@@ -31,6 +31,7 @@ obj-$(CONFIG_BATTERY_SBS)	+= sbs-battery.o
 obj-$(CONFIG_BATTERY_BQ27x00)	+= bq27x00_battery.o
 obj-$(CONFIG_BATTERY_DA9030)	+= da9030_battery.o
 obj-$(CONFIG_BATTERY_DA9052)	+= da9052-battery.o
+obj-$(CONFIG_CHARGER_DA9150)	+= da9150-charger.o
 obj-$(CONFIG_BATTERY_MAX17040)	+= max17040_battery.o
 obj-$(CONFIG_BATTERY_MAX17042)	+= max17042_battery.o
 obj-$(CONFIG_BATTERY_Z2)	+= z2_battery.o
drivers/power/da9150-charger.c new file +688 -0

688 lines not on this page · raw message

--
1.9.3

#10 lore raw

PATCH v6 6/7 power: da9150: Add DT binding documentation for charger

In reply to Adam Thomson
---
 .../devicetree/bindings/power/da9150-charger.txt   | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/da9150-charger.txt
Documentation/devicetree/bindings/power/da9150-charger.txt new file +26 -0
new file mode 100644
index 0000000..f390666
@@ -0,0 +1,26 @@
+Dialog Semiconductor DA9150 Charger Power Supply bindings
+
+Required properties:
+- compatible: "dlg,da9150-charger" for DA9150 Charger Power Supply
+
+Optional properties:
+- io-channels: List of phandle and IIO specifier pairs
+- io-channel-names: List of channel names used by charger
+      ["CHAN_IBUS", "CHAN_VBUS", "CHAN_TJUNC", "CHAN_VBAT"]
+  (See Documentation/devicetree/bindings/iio/iio-bindings.txt for further info)
+
+
+Example:
+
+	da9150-charger {
+		compatible = "dlg,da9150-charger";
+
+		io-channels = <&gpadc 0>,
+			      <&gpadc 2>,
+			      <&gpadc 8>,
+			      <&gpadc 5>;
+		io-channel-names = "CHAN_IBUS",
+				   "CHAN_VBUS",
+				   "CHAN_TJUNC",
+				   "CHAN_VBAT";
+	};

--
1.9.3

#11 lore raw

PATCH v6 7/7 MAINTAINERS: Include DA9150 files in Dialog Semiconductor support list.

In reply to Adam Thomson
---
 MAINTAINERS | 4 ++++
 1 file changed, 4 insertions(+)
MAINTAINERS +4 -0
index 2fa3853..1e46651 100644
@@ -3085,12 +3085,15 @@ S:	Supported
 F:	Documentation/hwmon/da90??
 F:	drivers/gpio/gpio-da90??.c
 F:	drivers/hwmon/da90??-hwmon.c
+F:	drivers/iio/adc/da91??-*.c
 F:	drivers/input/misc/da90??_onkey.c
 F:	drivers/input/touchscreen/da9052_tsi.c
 F:	drivers/leds/leds-da90??.c
 F:	drivers/mfd/da903x.c
 F:	drivers/mfd/da90??-*.c
+F:	drivers/mfd/da91??-*.c
 F:	drivers/power/da9052-battery.c
+F:	drivers/power/da91??-*.c
 F:	drivers/regulator/da903x.c
 F:	drivers/regulator/da9???-regulator.[ch]
 F:	drivers/rtc/rtc-da90??.c
@@ -3100,6 +3103,7 @@ F:	include/linux/mfd/da903x.h
 F:	include/linux/mfd/da9052/
 F:	include/linux/mfd/da9055/
 F:	include/linux/mfd/da9063/
+F:	include/linux/mfd/da9150/
 F:	include/sound/da[79]*.h
 F:	sound/soc/codecs/da[79]*.[ch]
 

--
1.9.3

#4 lore raw

Re: [PATCH v6 3/7] iio: Add support for DA9150 GPADC

In reply to Adam Thomson
Quoted 5 lines · Adam Thomson

This patch adds support for DA9150 Charger & Fuel-Gauge IC GPADC.

(...)

drivers/iio/adc/da9150-gpadc.c line 331

Quoted 10 lines
drivers/iio/adc/da9150-gpadc.c new file +10 -0
+
+static int da9150_gpadc_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct da9150 *da9150 = dev_get_drvdata(dev->parent);
+	struct da9150_gpadc *gpadc;
+	struct iio_dev *indio_dev;
+	int irq, ret;
+
+	indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*gpadc));

You can directly use *dev* instead of *&pdev->dev*

Signature · 2 lines
Thanks and Regards,
Varka Bhadram.
#8 lore raw

Re: [PATCH v6 5/7] power: Add support for DA9150 Charger

In reply to Adam Thomson
Quoted 4 lines · Adam Thomson

This patch adds support for DA9150 Charger & Fuel-Gauge IC Charger.

---

(...)

Quoted 6 lines
drivers/power/da9150-charger.c new file +6 -0
+static int da9150_charger_register_irq(struct platform_device *pdev,
+				       irq_handler_t handler,
+				       const char *irq_name)
+{
+	struct device *dev = &pdev->dev;
+	struct da9150_charger *charger = platform_get_drvdata(pdev);

drivers/power/da9150-charger.c line 479

Quoted 10 lines
drivers/power/da9150-charger.c new file +10 -0
+	int irq, ret;
+
+	irq = platform_get_irq_byname(pdev, irq_name);
+	if (irq < 0) {
+		dev_err(dev, "Failed to get IRQ CHG_STATUS: %d\n", irq);
+		return irq;
+	}
+
+	ret = request_threaded_irq(irq, NULL, handler, IRQF_ONESHOT, irq_name,
+				   charger);

Why don you use devm_* API..?

Quoted 24 lines
drivers/power/da9150-charger.c new file +24 -0
+	if (ret)
+		dev_err(dev, "Failed to request IRQ %d: %d\n", irq, ret);
+
+	return ret;
+}
+
+static void da9150_charger_unregister_irq(struct platform_device *pdev,
+					  const char *irq_name)
+{
+	struct device *dev = &pdev->dev;
+	struct da9150_charger *charger = platform_get_drvdata(pdev);
+	int irq;
+
+	irq = platform_get_irq_byname(pdev, irq_name);
+	if (irq < 0) {
+		dev_err(dev, "Failed to get IRQ CHG_STATUS: %d\n", irq);
+		return;
+	}
+
+	free_irq(irq, charger);
+}
+
+static int da9150_charger_probe(struct platform_device *pdev)
+{

drivers/power/da9150-charger.c line 513

Quoted 10 lines
drivers/power/da9150-charger.c new file +10 -0
+	struct device *dev = &pdev->dev;
+	struct da9150 *da9150 = dev_get_drvdata(dev->parent);
+	struct da9150_charger *charger;
+	struct power_supply *usb, *battery;
+	u8 reg;
+	int ret;
+
+	charger = devm_kzalloc(dev, sizeof(struct da9150_charger), GFP_KERNEL);
+	if (charger == NULL)
+		return -ENOMEM;

sizeof(struct da9150_charger) can be replaced with sizeof(*charger)...

*!* operator can be used in comparison with NULL...

(...)

Signature · 2 lines
Thanks and Regards,
Varka Bhadram.
#12 lore raw
In reply to Adam Thomson

Hi,

Quoted 12 lines · Adam Thomson

This patch set adds initial support for the Dialog DA9150 Integrated Charger & Fuel-Gauge IC. The device also provides GPIO and GPADC functionality.

In this patch set the following is provided:
- MFD Core support and DT bindings documentation.
- IIO GPADC support and DT bindings documentation.
- Power Supply Charger support and DT bindings documentation.
- Update to MAINTAINERS file to add DA9150 files to Dialog support list.

To keep patch submission from being too large, support for GPIO and Fuel-Gauge will come after initial support patches are accepted.

Quoted 8 lines

This patch set is baselined against the v3.19-rc5 kernel version.

Changes in v6:
- For GPADC driver, Use lower case extended names for IIO GPADC channels, and remove extended names for GPIO related channels.
- For charger driver, revert to no devm IRQ request/free functions as ordering is important, and probe failure scenario was not being correctly covered. A helper function for free IRQs has been added to make code cleaner.

Probably a devm_ variant of power_supply_register should be created, but for now this is ok for me.

Jonathan, Lee: I assume you are ok with the whole patchset going through the power supply subsystem?

-- Sebastian

#13 lore raw
Quoted 27 lines · Sebastian Reichel

Hi,

Quoted 1 line · Adam Thomson

This patch set adds initial support for the Dialog DA9150 Integrated

Charger &

Quoted 7 lines

Fuel-Gauge IC. The device also provides GPIO and GPADC functionality.

In this patch set the following is provided:
- MFD Core support and DT bindings documentation.
- IIO GPADC support and DT bindings documentation.
- Power Supply Charger support and DT bindings documentation.
- Update to MAINTAINERS file to add DA9150 files to Dialog support

list.

Quoted 2 lines

To keep patch submission from being too large, support for GPIO and

Fuel-Gauge

Quoted 6 lines

will come after initial support patches are accepted.

This patch set is baselined against the v3.19-rc5 kernel version.

Changes in v6:
- For GPADC driver, Use lower case extended names for IIO GPADC

channels, and

Quoted 2 lines

remove extended names for GPIO related channels.
- For charger driver, revert to no devm IRQ request/free functions as

ordering

Quoted 1 line

is important, and probe failure scenario was not being correctly

Quoted 9 lines

covered. A

Quoted 1 line

helper function for free IRQs has been added to make code cleaner.

Probably a devm_ variant of power_supply_register should be created, but for now this is ok for me.

Jonathan, Lee: I assume you are ok with the whole patchset going through the power supply subsystem?

Fine by me if either power supply or MFD.

Jonathan

Quoted 1 line

-- Sebastian

Signature · 5 lines
Sent from my Android device with K-9 Mail. Please excuse my brevity.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#14 lore raw
Quoted 33 lines · Jonathan Cameron
Quoted 30 lines · Sebastian Reichel

Hi,

Quoted 1 line · Adam Thomson

This patch set adds initial support for the Dialog DA9150 Integrated

Charger &

Quoted 7 lines

Fuel-Gauge IC. The device also provides GPIO and GPADC functionality.

In this patch set the following is provided:
- MFD Core support and DT bindings documentation.
- IIO GPADC support and DT bindings documentation.
- Power Supply Charger support and DT bindings documentation.
- Update to MAINTAINERS file to add DA9150 files to Dialog support

list.

Quoted 2 lines

To keep patch submission from being too large, support for GPIO and

Fuel-Gauge

Quoted 6 lines

will come after initial support patches are accepted.

This patch set is baselined against the v3.19-rc5 kernel version.

Changes in v6:
- For GPADC driver, Use lower case extended names for IIO GPADC

channels, and

Quoted 2 lines

remove extended names for GPIO related channels.
- For charger driver, revert to no devm IRQ request/free functions as

ordering

Quoted 1 line

is important, and probe failure scenario was not being correctly

covered. A

Quoted 1 line

helper function for free IRQs has been added to make code cleaner.

Quoted 7 lines
Quoted 6 lines

Probably a devm_ variant of power_supply_register should be created, but for now this is ok for me.

Jonathan, Lee: I assume you are ok with the whole patchset going through the power supply subsystem?

Fine by me if either power supply or MFD.

I am, but there is a lot of MFD code here, so I'd like to take it in as well. I'd like a tagged pull-request from Sebastian.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#5 lore raw

RE: [PATCH v6 3/7] iio: Add support for DA9150 GPADC

In reply to Varka Bhadram

T24gSmFudWFyeSAyMSwgMjAxNSAxNjowNywgVmFya2EgQmhhZHJhbSB3cm90ZToNCg0KPiBPbiBX ZWRuZXNkYXkgMjEgSmFudWFyeSAyMDE1IDA5OjE2IFBNLCBBZGFtIFRob21zb24gd3JvdGU6DQo+ ID4gVGhpcyBwYXRjaCBhZGRzIHN1cHBvcnQgZm9yIERBOTE1MCBDaGFyZ2VyICYgRnVlbC1HYXVn ZSBJQyBHUEFEQy4NCj4gPg0KPiA+IFNpZ25lZC1vZmYtYnk6IEFkYW0gVGhvbXNvbiA8QWRhbS5U aG9tc29uLk9wZW5zb3VyY2VAZGlhc2VtaS5jb20+DQo+ID4gUmV2aWV3ZWQtYnk6IEhhcnRtdXQg S25hYWNrIDxrbmFhY2suaEBnbXguZGU+DQo+ID4gQWNrZWQtYnk6IEpvbmF0aGFuIENhbWVyb24g PGppYzIzQGtlcm5lbC5vcmc+DQo+IA0KPiAoLi4uKQ0KPiANCj4gPiArDQo+ID4gK3N0YXRpYyBp bnQgZGE5MTUwX2dwYWRjX3Byb2JlKHN0cnVjdCBwbGF0Zm9ybV9kZXZpY2UgKnBkZXYpDQo+ID4g K3sNCj4gPiArCXN0cnVjdCBkZXZpY2UgKmRldiA9ICZwZGV2LT5kZXY7DQo+ID4gKwlzdHJ1Y3Qg ZGE5MTUwICpkYTkxNTAgPSBkZXZfZ2V0X2RydmRhdGEoZGV2LT5wYXJlbnQpOw0KPiA+ICsJc3Ry dWN0IGRhOTE1MF9ncGFkYyAqZ3BhZGM7DQo+ID4gKwlzdHJ1Y3QgaWlvX2RldiAqaW5kaW9fZGV2 Ow0KPiA+ICsJaW50IGlycSwgcmV0Ow0KPiA+ICsNCj4gPiArCWluZGlvX2RldiA9IGRldm1faWlv X2RldmljZV9hbGxvYygmcGRldi0+ZGV2LCBzaXplb2YoKmdwYWRjKSk7DQo+IA0KPiAgIFlvdSBj YW4gZGlyZWN0bHkgdXNlICpkZXYqIGluc3RlYWQgb2YgKiZwZGV2LT5kZXYqDQoNClllcyBhZ3Jl ZWQuIENhbiBmb2xsb3cgdXAgd2l0aCBjaGFuZ2UgZm9yIHRoaXMgYXMgaXQncyBub3QgdXJnZW50 IGFuZCB3b3VsZA0KcmF0aGVyIGxlYXZlIGN1cnJlbnQgcGF0Y2ggc2V0IGFzIGlzLg0K --
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw

RE: [PATCH v6 5/7] power: Add support for DA9150 Charger

In reply to Varka Bhadram
Quoted 18 lines · Varka Bhadram
Quoted 4 lines · Adam Thomson

This patch adds support for DA9150 Charger & Fuel-Gauge IC Charger.

---

(...)

Quoted 10 lines
drivers/power/da9150-charger.c new file +10 -0
+static int da9150_charger_register_irq(struct platform_device *pdev,
+				       irq_handler_t handler,
+				       const char *irq_name)
+{
+	struct device *dev = &pdev->dev;
+	struct da9150_charger *charger = platform_get_drvdata(pdev);
+	int irq, ret;
+
+	irq = platform_get_irq_byname(pdev, irq_name);
+	if (irq < 0) {
Quoted 8 lines

drivers/power/da9150-charger.c line 479

Quoted 6 lines
drivers/power/da9150-charger.c new file +6 -0
+		dev_err(dev, "Failed to get IRQ CHG_STATUS: %d\n", irq);
+		return irq;
+	}
+
+	ret = request_threaded_irq(irq, NULL, handler, IRQF_ONESHOT, irq_name,
+				   charger);

Why don you use devm_* API..?

As mentioned in previous discussions, the order of tidy up is important so devm_* functions cannot be used here.

Quoted 38 lines
Quoted 25 lines
drivers/power/da9150-charger.c new file +24 -0
+	if (ret)
+		dev_err(dev, "Failed to request IRQ %d: %d\n", irq, ret);
+
+	return ret;
+}
+
+static void da9150_charger_unregister_irq(struct platform_device *pdev,
+					  const char *irq_name)
+{
+	struct device *dev = &pdev->dev;
+	struct da9150_charger *charger = platform_get_drvdata(pdev);
+	int irq;
+
+	irq = platform_get_irq_byname(pdev, irq_name);
+	if (irq < 0) {
+		dev_err(dev, "Failed to get IRQ CHG_STATUS: %d\n", irq);
+		return;
+	}
+
+	free_irq(irq, charger);
+}
+
+static int da9150_charger_probe(struct platform_device *pdev)
+{

drivers/power/da9150-charger.c line 513

Quoted 10 lines
drivers/power/da9150-charger.c new file +10 -0
+	struct device *dev = &pdev->dev;
+	struct da9150 *da9150 = dev_get_drvdata(dev->parent);
+	struct da9150_charger *charger;
+	struct power_supply *usb, *battery;
+	u8 reg;
+	int ret;
+
+	charger = devm_kzalloc(dev, sizeof(struct da9150_charger), GFP_KERNEL);
+	if (charger == NULL)
+		return -ENOMEM;

sizeof(struct da9150_charger) can be replaced with sizeof(*charger)...

Quoted 2 lines

*!* operator can be used in comparison with NULL...

Yes, but functionally no different. Can maybe change this around later, but would like to avoid changing current patch set right now.

#15 lore raw
In reply to Lee Jones
Quoted 39 lines · Lee Jones
Quoted 3 lines · Jonathan Cameron

On 21 January 2015 16:52:50 GMT+00:00, Sebastian Reichel <[email protected]>

Quoted 33 lines · wrote:
Quoted 33 lines

Hi,

Quoted 1 line · Adam Thomson

This patch set adds initial support for the Dialog DA9150 Integrated

Charger &

Quoted 7 lines

Fuel-Gauge IC. The device also provides GPIO and GPADC functionality.

In this patch set the following is provided:
- MFD Core support and DT bindings documentation.
- IIO GPADC support and DT bindings documentation.
- Power Supply Charger support and DT bindings documentation.
- Update to MAINTAINERS file to add DA9150 files to Dialog support

list.

Quoted 2 lines

To keep patch submission from being too large, support for GPIO and

Fuel-Gauge

Quoted 6 lines

will come after initial support patches are accepted.

This patch set is baselined against the v3.19-rc5 kernel version.

Changes in v6:
- For GPADC driver, Use lower case extended names for IIO GPADC

channels, and

Quoted 2 lines

remove extended names for GPIO related channels.
- For charger driver, revert to no devm IRQ request/free functions as

ordering

Quoted 1 line

is important, and probe failure scenario was not being correctly

covered. A

Quoted 1 line

helper function for free IRQs has been added to make code cleaner.

Probably a devm_ variant of power_supply_register should be created, but for now this is ok for me.

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines

Jonathan, Lee: I assume you are ok with the whole patchset going through the power supply subsystem?

Fine by me if either power supply or MFD.

I am, but there is a lot of MFD code here, so I'd like to take it in as well. I'd like a tagged pull-request from Sebastian.

Hi Sebastien,

Just a quick one to see what the status is on this patch set? Just interested as to when it'll be pulled in.

Thanks
Adam

#16 lore raw

Hi,

Quoted 2 lines · Opensource [Adam Thomson]

Just a quick one to see what the status is on this patch set? Just interested as to when it'll be pulled in.

I plan to pull it into for-next once -rc1 has been tagged (probably about a week). Feel free to send a new version with the style fixes.

-- Sebastian

#17 lore raw
Quoted 8 lines · Sebastian Reichel

Hi,

Quoted 2 lines · Opensource [Adam Thomson]

Just a quick one to see what the status is on this patch set? Just interested as to when it'll be pulled in.

I plan to pull it into for-next once -rc1 has been tagged (probably about a week). Feel free to send a new version with the style fixes.

Ok thanks for the update. Will see if I can get the updates out before then.

Thanks
Adam