MFD: DA9052/53 MFD core module v6
Subsystems (2)
PATCH 1/11 MFD: DA9052/53 MFD core module v6
The DA9052/53 is a highly integrated PMIC subsystem with supply domain flexibility to support wide range of high performance application.
It provides voltage regulators, GPIO controller, Touch Screen, RTC, Battery control and other functionality.
---
Changes since v6:
- Move inlined device I/O functions to header file
Changes since v5:
- Inline device I/O
- Unhandle IRQ return RQ_NONE
- Remove register address conversion
Changes since v4:
- Modify KConfig
- Use device registration for detemining chip id
- Remove preprocessor directive with runtime bustype variable
- Replace module_init() for spi with subsys_initcall()
- Remove platform string from MODULE_ALIAS of spi module. Changes since v3:
- Code refactored to use REGMAP API.
- Add Battery resources.
- da9052_set_bits() and da9052_clear_bits() replaced by da9052_reg_update().
- Add support for DA9053 PMIC
Changes since v2:
- Drop da9052_irqs[] table.
- Move struct da9052_subdev_info[].
- Remove initialization of static member.
- Care for NULL pdata init().
- Check removal of subdevices on errors.
- Remove open source spi code.
- Remove '_spi' from the driver name.
- Move tbat_lookup table from header file.
- Remove irq.h
- Remove num_gpio variable from pdata
--- drivers/mfd/Kconfig | 26 ++ drivers/mfd/Makefile | 7 + drivers/mfd/da9052-core.c | 333 ++++++++++++++++ drivers/mfd/da9052-i2c.c | 142 +++++++ drivers/mfd/da9052-irq.c | 173 ++++++++ drivers/mfd/da9052-spi.c | 166 ++++++++ include/linux/mfd/da9052/da9052.h | 139 +++++++ include/linux/mfd/da9052/pdata.h | 42 ++ include/linux/mfd/da9052/reg.h | 777 +++++++++++++++++++++++++++++++++++++ 9 files changed, 1805 insertions(+), 0 deletions(-) create mode 100644 drivers/mfd/da9052-core.c create mode 100644 drivers/mfd/da9052-i2c.c create mode 100644 drivers/mfd/da9052-irq.c create mode 100644 drivers/mfd/da9052-spi.c create mode 100644 include/linux/mfd/da9052/da9052.h create mode 100644 include/linux/mfd/da9052/pdata.h create mode 100644 include/linux/mfd/da9052/reg.h
drivers/mfd/Kconfig +26 -0
@@ -343,6 +343,32 @@ config PMIC_DA903X individual components like LCD backlight, voltage regulators, LEDs and battery-charger under the corresponding menus. +config PMIC_DA9052 + bool + select MFD_CORE + +config MFD_DA9052_SPI + bool "Support Dialog Semiconductor DA9052/53 PMIC variants with SPI" + select REGMAP_SPI + select PMIC_DA9052 + depends on SPI_MASTER=y + help + Support for the Dialog Semiconductor DA9052 PMIC + when controlled using SPI. This driver provides common support + for accessing the device, additional drivers must be enabled in + order to use the functionality of the device. + +config MFD_DA9052_I2C + bool "Support Dialog Semiconductor DA9052/53 PMIC variants with I2C" + select REGMAP_I2C + select PMIC_DA9052 + depends on I2C=y + help + Support for the Dialog Semiconductor DA9052 PMIC + when controlled using I2C. This driver provides common support + for accessing the device, additional drivers must be enabled in + order to use the functionality of the device. + config PMIC_ADP5520 bool "Analog Devices ADP5520/01 MFD PMIC Core Support" depends on I2C=y
drivers/mfd/Makefile +7 -0
@@ -67,6 +67,13 @@ endif obj-$(CONFIG_UCB1400_CORE) += ucb1400_core.o obj-$(CONFIG_PMIC_DA903X) += da903x.o + +da9052-objs := da9052-core.o da9052-irq.o +obj-$(CONFIG_PMIC_DA9052) += da9052.o + +obj-$(CONFIG_MFD_DA9052_SPI) += da9052-spi.o +obj-$(CONFIG_MFD_DA9052_I2C) += da9052-i2c.o + max8925-objs := max8925-core.o max8925-i2c.o obj-$(CONFIG_MFD_MAX8925) += max8925.o obj-$(CONFIG_MFD_MAX8997) += max8997.o max8997-irq.o
drivers/mfd/da9052-core.c new file +333 -0
333 lines not on this page · raw message
drivers/mfd/da9052-i2c.c new file +142 -0
142 lines not on this page · raw message
drivers/mfd/da9052-irq.c new file +173 -0
173 lines not on this page · raw message
drivers/mfd/da9052-spi.c new file +166 -0
166 lines not on this page · raw message
include/linux/mfd/da9052/da9052.h new file +139 -0
139 lines not on this page · raw message
include/linux/mfd/da9052/pdata.h new file +42 -0
42 lines not on this page · raw message
include/linux/mfd/da9052/reg.h new file +777 -0
777 lines not on this page · raw message
Quoted 26 lines · (2011年09月19日 20:32), ashishj3 wrote:
drivers/mfd/da9052-i2c.c new file +23
-0@@ -0,0 +1,142 @@ +/* +* I2C access for DA9052 PMICs. +* +* Copyright(c) 2011 Dialog Semiconductor Ltd. +* +* Author: David Dajun Chen <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +*/ + +#include <linux/device.h> +#include <linux/input.h> +#include <linux/mfd/core.h> +#include <linux/i2c.h> +#include <linux/err.h> + +#include <linux/mfd/da9052/da9052.h> +#include <linux/mfd/da9052/reg.h> +
drivers/mfd/da9052-i2c.c line 33
Quoted 10 lines
drivers/mfd/da9052-i2c.c new file +10
-0+static int da9052_i2c_enable_multiwrite (struct da9052 *da9052) +{ +int reg_val, ret; + + ret =regmap_read (da9052->regmap,DA9052_CONTROL_B_REG , ®_val); +if (ret <0 ) +return ret; + +if (reg_val &DA9052_CONTROL_B_WRITEMODE ) { + reg_val = ~DA9052_CONTROL_B_WRITEMODE ;
Hi Ashish,
I think you should use reg_val &= ~DA9052_CONTROL_B_WRITEMODE; instead of just "=".
Regards,
Paul