|
Re: [PATCH v2] regulator: Add GPIO enable control to fixed voltage regulat: msg#12017linux-kernel
On Fri, Jul 31, 2009 at 8:38 PM, pHilipp Zabel<philipp.zabel@xxxxxxxxx> wrote: > On Fri, Jul 31, 2009 at 7:20 PM, Mark > Brown<broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote: >> On Fri, Jul 31, 2009 at 07:19:49PM +0300, Roger Quadros wrote: >> >> >>> + ret = gpio_get_value(config->gpio); >> >> Can this fail? It returns an int... > > No, gpio_get_value(_cansleep) return either zero or non-zero. > I think some I2C gpio chips just return zero when the read fails. > Also that's the return value if a gpiochip doesn't define the .get method. > > Only problem: drivers/gpio/gpiolib.c contains this piece of wisdom: > > /* Drivers MUST set GPIO direction before making get/set calls. In > * some cases this is done in early boot, before IRQs are enabled. > [...] > */ > Not having gpio_get_direction() in gpiolib is a limitation I think. Can we just do the following for now ? (i.e. disable regulator by default) Will there be any glitch? If yes, then how? ret = gpio_request(config->gpio, config->supply_name); ... - ret = gpio_get_value(config->gpio); - ret = gpio_direction_output(config->gpio, ret); + ret = gpio_direction_output(config->gpio, !config->enable_high); if (ret) { dev_err(&pdev->dev, "Could not configure enable GPIO %d direction: %d\n", config->gpio, ret); goto err_gpio; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|
|
||||||||||||||||||||||||||
|
|
|
| News | Mail Home | sitemap | FAQ | advertise |