lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <0D753D10438DA54287A00B027084269764CEEDA479@AUSP01VMBX24.collaborationhost.net>
Date:	Mon, 31 Jan 2011 17:56:53 -0600
From:	H Hartley Sweeten <hartleys@...ionengravers.com>
To:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [leds-pca9532] Add gpio capability

>>>> + 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.

From the datasheet:


6.4 Pins used as GPIOs

LEDn pins not used to control LEDs can be used as General Purpose I/Os (GPIOs).

To use as input, set LEDn to high-impendance (00) and then read the pin state
via the INPUT0 or INPUT1 register.

For use as output, connect external pull-up resistor to the pin and size it
according to the DC recommended operating characteristics.  LEDn output is HIGH
when the output is programmed as high-impedance, and LOW when programmed LOW
through the 'LED selector' register.  The output can be pulse-width controlled
when PWM0 or PWM1 are used.


So, you should provide both a direction_input and direction_output.

Regards,
Hartley

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ