mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* power: bq20z75: problem with optional battery detect gpio feature
@ 2011-07-25 13:55 Andrea Galbusera
  2011-07-25 13:59 ` Felipe Balbi
  0 siblings, 1 reply; 2+ messages in thread
From: Andrea Galbusera @ 2011-07-25 13:55 UTC (permalink / raw)
  To: LKML

Is the in-object feature really optional?
If battery_detect field in my bq20z75_platform_data structure is not
explicitly set, I suspect the driver ends up requesting an irq for the
GPIO number 0. This look indesirable.

Here is the relevant code snip form bq20z75_probe():

if (pdata) {
	bq20z75_device->gpio_detect =
		gpio_is_valid(pdata->battery_detect);    // GPIO 0 _IS_ a valid gpio !!
	bq20z75_device->pdata = pdata;
}

[...]

if (!bq20z75_device->gpio_detect)
	goto skip_gpio;

[...]

irq = gpio_to_irq(pdata->battery_detect);

[...]

rc = request_irq(irq, bq20z75_irq,
	IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
	dev_name(&client->dev), &bq20z75_device->power_supply);


I cannot find in gpio related headers any sort of "GPIO_INVALID"
symbol to explicitly declare that I don't want this feature. I'm
temporarily setting it to ARCH_NR_GPIOS but I believe we need to
disambiguate GPIO number 0 from "disable feature".
Correct?

Regards,
Andrea

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: power: bq20z75: problem with optional battery detect gpio feature
  2011-07-25 13:55 power: bq20z75: problem with optional battery detect gpio feature Andrea Galbusera
@ 2011-07-25 13:59 ` Felipe Balbi
  0 siblings, 0 replies; 2+ messages in thread
From: Felipe Balbi @ 2011-07-25 13:59 UTC (permalink / raw)
  To: Andrea Galbusera; +Cc: LKML, Grant Likely

[-- Attachment #1: Type: text/plain, Size: 437 bytes --]

On Mon, Jul 25, 2011 at 03:55:34PM +0200, Andrea Galbusera wrote:
> Is the in-object feature really optional?
> If battery_detect field in my bq20z75_platform_data structure is not
> explicitly set, I suspect the driver ends up requesting an irq for the
> GPIO number 0. This look indesirable.

set the gpio to -EINVAL. gpio 0 is a valid gpio number. Maybe we should
remap zero to 1, 1 to 2 and so forth... Grant ?

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-25 14:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-25 13:55 power: bq20z75: problem with optional battery detect gpio feature Andrea Galbusera
2011-07-25 13:59 ` Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®