lkml.org 
[lkml]   [2011]   [Jun]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 02/11] GPIO: DA9052 GPIO module v1
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.

> +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?

> diff --git a/drivers/gpio/da9052-gpio.c b/drivers/gpio/da9052-gpio.c
> new file mode 100755
> index 0000000..3e1f854

gpio-da9052.c

> +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,
> + 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.

> +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.

> + 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.


\
 
 \ /
  Last update: 2011-06-30 07:39    [from the cache]
©2003-2011 Jasper Spaans