25 Jul
2012
25 Jul
'12
3:18 p.m.
On Wed, Jul 25, 2012 at 09:03:29AM +0200, Daniel Mack wrote:
In the process of moving over from static board files to the device tree, reset pins of peripheral reset pins should be handled by their corresponding drivers.
Add a reset-gpio DT property to the cs4270 driver, and de-assert it before probing the chip. The logic could be augmented some day to re-assert it when codec is put to suspend.
I'm missing 1/2... Please also don't bury patches in the middle of previous threads.
enum of_gpio_flags flags;
int gpio = of_get_named_gpio_flags(np, "reset-gpio", 0, &flags);
if (gpio_is_valid(gpio))
devm_gpio_request_one(&i2c_client->dev, gpio,
flags & OF_GPIO_ACTIVE_LOW ?
GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH,
"cs4270 reset");
This ignores the return code and won't work well with probe deferral, if we manage to get a GPIO from the DT then we should fail if we're unable request it. Passing back the return code should get you deferral support for free in 3.6 and onwards.