All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: ashishj3 <ashish.jangam@kpitcummins.com>
Cc: jic23@cam.ac.uk, linux-kernel@vger.kernel.org,
	Dajun <dajun.chen@diasemi.com>,
	grant@secretlab.ca
Subject: Re: [PATCH 02/11] GPIO: DA9052 GPIO module v1
Date: Wed, 29 Jun 2011 22:37:12 -0700	[thread overview]
Message-ID: <20110630053711.GB796@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1309355591.2344.4.camel@L-0532.kpit.com>

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.

  reply	other threads:[~2011-06-30  5:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-29 13:53 [PATCH 02/11] GPIO: DA9052 GPIO module v1 ashishj3
2011-06-30  5:37 ` Mark Brown [this message]
2011-06-30 11:40   ` Ashish Jangam
2011-06-30 15:32     ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110630053711.GB796@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=ashish.jangam@kpitcummins.com \
    --cc=dajun.chen@diasemi.com \
    --cc=grant@secretlab.ca \
    --cc=jic23@cam.ac.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.