Re: [leds-pca9532] Add gpio capability
From: Wolfram Sang
Date: Sun Jan 30 2011 - 16:44:12 EST
> > Some Kconfig-magic is missing. Iff that feature is used, then it depends on
> > GENERIC_GPIO.
>
> I though about it just when I had hit send. I'll create an updated
> version where gpio capability is optional.
>
> GENERIC_GPIO? Shouldn't it be GPIOLIB in this case?
Yes, you are right. You are adding a gpiochip, so you need GPIOLIB.
> >> + if (gpios) {
> >> + data->gpio.label = "gpio-pca9532";
> >> + data->gpio.set = pca9532_gpio_set_value;
> >> + data->gpio.get = pca9532_gpio_get_value;
> >> + data->gpio.request = pca9532_gpio_request_pin;
> >> + data->gpio.can_sleep = 1;
> >> + data->gpio.base = pdata->gpio_base;
> >> + data->gpio.ngpio = 16;
> >> + data->gpio.dev = &client->dev;
> >> + data->gpio.owner = THIS_MODULE;
> >
> > I'd assume that you also need to define a direction_output-function which
> > always
> > returns success?
>
> Yes, you are right. It is not possible to set direction in hw, but I
> should provide them.
It should be okay to skip direction_input, because gpiolib will return an error
if it is not available. This is exactly why IMO you need a direction_output
returning 0. Otherwise drivers checking if that operation was successful, might
be fooled.
Regards,
Wolfram
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Attachment:
signature.asc
Description: Digital signature