Linux-LEDs Archive on lore.kernel.org
 help / color / Atom feed
* Query on using leds-gpio driver on a. GPIO with ACTIVE_HIGH
@ 2020-07-06  7:19 Vishwanatha Subbanna
  2020-07-09 21:59 ` Jacek Anaszewski
  0 siblings, 1 reply; 3+ messages in thread
From: Vishwanatha Subbanna @ 2020-07-06  7:19 UTC (permalink / raw)
  To: Jacek Anaszewski, pavel, dmurphy, linux-leds; +Cc: Vishwanatha Subbanna

Hello,

I have been a user of “leds-gpio” driver to manage the LEDs on IBM servers. So far, all these LEDs that were controlled by GPIO were ACTIVE_LOW.

Example from DTS.

        fan3 {
            retain-state-shutdown;
            default-state = "keep";
            gpios = <&pca0 3 GPIO_ACTIVE_LOW>;
        };

I wanted to know if it makes any difference to the user if the GPIO is ACTIVE_HIGH. I read through https://www.kernel.org/doc/Documentation/gpio/board.txt and it seemed we should be able to use it.

However, going through https://github.com/torvalds/linux/blob/master/drivers/leds/leds-pca955x.c, I am not quite sure if the ACTIVE_HIGH can be used same as ACTIVE_LOW since I saw these :


#define PCA955X_LS_LED_ON	0x0	/* Output LOW */
#define PCA955X_LS_LED_OFF	0x1	/* Output HI-Z */

#define PCA955X_GPIO_HIGH	LED_OFF
#define PCA955X_GPIO_LOW	LED_FULL


This will be my DT entry : 

        fan3 {
            retain-state-shutdown;
            default-state = "keep";
            gpios = <&pca0 3 GPIO_ACTIVE_HIGH>;
        };

Will I be able to use the same “leds-gpio” interfaces irrespective of GPIO_LOW / GPIO_HIGH ? 

I use these interfaces today:

echo 255 > brightness —> Turn Solid_ON
echo 0 > brightness —> Turn OFF
echo “timer” > trigger —> Initiate Blink
echo “none” > trigger —> Terminate Blink


Thank you,

!! Vishwa !

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

* Re: Query on using leds-gpio driver on a. GPIO with ACTIVE_HIGH
  2020-07-06  7:19 Query on using leds-gpio driver on a. GPIO with ACTIVE_HIGH Vishwanatha Subbanna
@ 2020-07-09 21:59 ` Jacek Anaszewski
       [not found]   ` <C025D36C-5408-494F-BAB6-B3BAD89FBB63@linux.vnet.ibm.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Jacek Anaszewski @ 2020-07-09 21:59 UTC (permalink / raw)
  To: Vishwanatha Subbanna, pavel, dmurphy, linux-leds

Hi Vishwanatha,

On 7/6/20 9:19 AM, Vishwanatha Subbanna wrote:
> Hello,
> 
> I have been a user of “leds-gpio” driver to manage the LEDs on IBM servers. So far, all these LEDs that were controlled by GPIO were ACTIVE_LOW.
> 
> Example from DTS.
> 
>          fan3 {
>              retain-state-shutdown;
>              default-state = "keep";
>              gpios = <&pca0 3 GPIO_ACTIVE_LOW>;
>          };
> 
> I wanted to know if it makes any difference to the user if the GPIO is ACTIVE_HIGH. I read through https://www.kernel.org/doc/Documentation/gpio/board.txt and it seemed we should be able to use it.
> 
> However, going through https://github.com/torvalds/linux/blob/master/drivers/leds/leds-pca955x.c, I am not quite sure if the ACTIVE_HIGH can be used same as ACTIVE_LOW since I saw these :
> 
> 
> #define PCA955X_LS_LED_ON	0x0	/* Output LOW */
> #define PCA955X_LS_LED_OFF	0x1	/* Output HI-Z */
> 
> #define PCA955X_GPO_HIGH	LED_OFF
> #define PCA955X_GPIO_LOW	LED_FULL
> 
> 
> This will be my DT entry :
> 
>          fan3 {
>              retain-state-shutdown;
>              default-state = "keep";
>              gpios = <&pca0 3 GPIO_ACTIVE_HIGH>;
>          };
> 
> Will I be able to use the same “leds-gpio” interfaces irrespective of GPIO_LOW / GPIO_HIGH ?
> 
> I use these interfaces today:
> 
> echo 255 > brightness —> Turn Solid_ON
> echo 0 > brightness —> Turn OFF
> echo “timer” > trigger —> Initiate Blink
> echo “none” > trigger —> Terminate Blink

 From what I can see in gpiolib sources GPIO_ACTIVE_LOW results
in reversing the logic, i.e. pca955x_gpio_set_value() will
be passed 0 when setting gpio to 1.

Experience doesn't corroborate that?

-- 
Best regards,
Jacek Anaszewski

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

* Re: Query on using leds-gpio driver on a. GPIO with ACTIVE_HIGH
       [not found]   ` <C025D36C-5408-494F-BAB6-B3BAD89FBB63@linux.vnet.ibm.com>
@ 2020-07-14 17:05     ` Pavel Machek
  0 siblings, 0 replies; 3+ messages in thread
From: Pavel Machek @ 2020-07-14 17:05 UTC (permalink / raw)
  To: Vishwanatha Subbanna; +Cc: Jacek Anaszewski, dmurphy, linux-leds


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

Hi!

> <html><head></head><body dir="auto" style="word-wrap: break-word;

Please don't use html on the lists.
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-06  7:19 Query on using leds-gpio driver on a. GPIO with ACTIVE_HIGH Vishwanatha Subbanna
2020-07-09 21:59 ` Jacek Anaszewski
     [not found]   ` <C025D36C-5408-494F-BAB6-B3BAD89FBB63@linux.vnet.ibm.com>
2020-07-14 17:05     ` Pavel Machek

Linux-LEDs Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-leds/0 linux-leds/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-leds linux-leds/ https://lore.kernel.org/linux-leds \
		linux-leds@vger.kernel.org
	public-inbox-index linux-leds

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-leds


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git