GPIO: DA9052 GPIO module v1
Subsystems (3)
PATCH 2/11 GPIO: DA9052 GPIO module v1
DA9052 PMIC has 16 bit GPIO bus for peripheral control.
This patch add support for the GPIO pins on the DA9052.
--- drivers/gpio/Kconfig | 6 + drivers/gpio/Makefile | 1 + drivers/gpio/da9052-gpio.c | 258 +++++++++++++++++++++++++++++++++++++++ include/linux/mfd/da9052/gpio.h | 47 +++++++ 4 files changed, 312 insertions(+), 0 deletions(-) create mode 100755 drivers/gpio/da9052-gpio.c create mode 100755 include/linux/mfd/da9052/gpio.h
drivers/gpio/Kconfig +6 -0
@@ -65,6 +65,12 @@ config GPIO_SYSFS # put expanders in the right section, in alphabetical order +config GPIO_DA9052 + bool "Dialog DA9052 GPIO" + depends on PMIC_DA9052 + help + Say yes here to enable the GPIO driver for the DA9052 chip. + config GPIO_MAX730X tristate
drivers/gpio/Makefile +1 -0
@@ -11,6 +11,7 @@ obj-$(CONFIG_GPIOLIB) += gpiolib.o obj-$(CONFIG_GPIO_ADP5520) += adp5520-gpio.o obj-$(CONFIG_GPIO_ADP5588) += adp5588-gpio.o obj-$(CONFIG_GPIO_BASIC_MMIO) += basic_mmio_gpio.o +obj-$(CONFIG_GPIO_DA9052) += da9052-gpio.o obj-$(CONFIG_GPIO_LANGWELL) += langwell_gpio.o obj-$(CONFIG_GPIO_MAX730X) += max730x.o obj-$(CONFIG_GPIO_MAX7300) += max7300.o
drivers/gpio/da9052-gpio.c new file +258 -0
258 lines not on this page · raw message
include/linux/mfd/da9052/gpio.h new file +47 -0
47 lines not on this page · raw message
Quoted 3 lines · On Wed, Jun 29, 2011 at 07:23:11PM +0530, ashishj3 wrote:
DA9052 PMIC has 16 bit GPIO bus for peripheral control.
This patch add support for the GPIO pins on the DA9052.
You need to send this to Grant, the GPIO maintainer. CCed him.
drivers/gpio/Kconfig config GPIO_SYSFS · line 73
Quoted 6 lines
drivers/gpio/Kconfig +6
-0+config GPIO_DA9052 + bool "Dialog DA9052 GPIO" + depends on PMIC_DA9052 + help + Say yes here to enable the GPIO driver for the DA9052 chip. +
Why only bool?
drivers/gpio/da9052-gpio.c
Quoted 3 lines
drivers/gpio/da9052-gpio.c new file +0
-0
gpio-da9052.c
Quoted 7 lines
drivers/gpio/da9052-gpio.c new file +7
-0+static int da9052_gpio_get (struct gpio_chip *gc,unsigned offset) +{ +struct da9052_gpio *gpio =to_da9052_gpio (gc); +int da9052_port_direction =0 ; +int ret; + + ret = da9052_reg_read(gpio->da9052,
drivers/gpio/da9052-gpio.c line 58
Quoted 10 lines
drivers/gpio/da9052-gpio.c new file +10
-0+ DA9052_GPIO_0_1_REG + (offset >> 1)); +if (ret <0 ) +return ret; + +if (da9052_gpio_port_odd (offset)) { + da9052_port_direction = ret &DA9052_GPIO_ODD_PORT_PIN ; + da9052_port_direction >>=4 ; + } +else + da9052_port_direction = ret &DA9052_GPIO_EVEN_PORT_PIN ;
The indentation here needs to be checked up.
drivers/gpio/da9052-gpio.c line 174
Quoted 7 lines
drivers/gpio/da9052-gpio.c new file +7
-0+static int da9052_gpio_to_irq (struct gpio_chip *gc,u32 offset) +{ +struct da9052_gpio *gpio; + gpio =to_da9052_gpio (gc); + +return gpio->gp.base + offset; +}
This looks like it's returning a GPIO number... If nothing else "base" is confusingly named and should be something like irq_base.
drivers/gpio/da9052-gpio.c line 193
Quoted 8 lines
drivers/gpio/da9052-gpio.c new file +8
-0+ gpio->da9052 =dev_get_drvdata (pdev->dev.parent); + pdata = gpio->da9052->dev->platform_data; + +if (pdata ==NULL ) { +dev_err (&pdev->dev,"Failed no platform data for GPIO\n" ); + ret = -ENOMEM ; + goto err_mem; + }
Why insist on platform data? gpiolib can dynamically allocate a GPIO range to the device.
Quoted 13 lines
-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Thursday, June 30, 2011 11:07 AM
To: Ashish Jangam
Cc: [email protected]; [email protected]; Dajun; [email protected]
Subject: Re: [PATCH 02/11] GPIO: DA9052 GPIO module v1Quoted 3 lines · On Wed, Jun 29, 2011 at 07:23:11PM +0530, ashishj3 wrote:
DA9052 PMIC has 16 bit GPIO bus for peripheral control.
This patch add support for the GPIO pins on the DA9052.
Quoted 11 lines
drivers/gpio/da9052-gpio.c line 193
Quoted 8 lines
drivers/gpio/da9052-gpio.c new file +8
-0+ gpio->da9052 =dev_get_drvdata (pdev->dev.parent); + pdata = gpio->da9052->dev->platform_data; + +if (pdata ==NULL ) { +dev_err (&pdev->dev,"Failed no platform data for GPIO\n" ); + ret = -ENOMEM ; + goto err_mem; + }Why insist on platform data? gpiolib can dynamically allocate a GPIO range to the device.
Do you mean to use gpiochip_reserve() in machine file and not to have ngpio and base defined in GPIO platform driver but, this will fail the call to gpiochip_add()? Can you elaborate on it?
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Quoted 6 lines · Ashish Jangam
Quoted 2 lines
Why insist on platform data? gpiolib can dynamically allocate a GPIO range to the device.
Do you mean to use
gpiochip_reserve()in machine file and not to have ngpio and base defined in GPIO platform driver but, this will fail the call togpiochip_add()?
No, I mean that you should allow gpiolib to allocate a GPIO range if one is not already allocated like other gpiolib drivers do by supplying -1 as the base.