[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110630053711.GB796@opensource.wolfsonmicro.com>
Date: Wed, 29 Jun 2011 22:37:12 -0700
From: Mark Brown <broonie@...nsource.wolfsonmicro.com>
To: ashishj3 <ashish.jangam@...tcummins.com>
Cc: jic23@....ac.uk, linux-kernel@...r.kernel.org,
Dajun <dajun.chen@...semi.com>, grant@...retlab.ca
Subject: Re: [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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists