All of lore.kernel.org
 help / color / mirror / Atom feed
From: vishwanatha subbanna <vishwa@linux.vnet.ibm.com>
To: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Cc: vishwanatha subbanna <vishwa@linux.vnet.ibm.com>,
	Joel Stanley <joel@jms.id.au>, Andrew Jeffery <andrew@aj.id.au>,
	linux-leds@vger.kernel.org, Eddie James <eajames@linux.ibm.com>
Subject: Re: [PATCH linux dev-5.10 06/35] ARM: dts: aspeed: rainier: Add leds that are off PCA9552
Date: Wed, 28 Apr 2021 13:00:43 +0530	[thread overview]
Message-ID: <2F05B835-8710-4E2F-864F-1EB2984E24A8@linux.vnet.ibm.com> (raw)
In-Reply-To: <babf3846-f1fd-d541-6c74-e5f167575105@gmail.com>

Hi Jacek,

Thanks for reverting. The setup seems fine because, when we express these as PCA955X_TYPE_GPIO and then define the
LEDs under “compatibility=gpio-leds” section, then the LEDs do retain the states post BMC reboot with Andrew Jeffrey’s patch: https://github.com/torvalds/linux/commit/f5808ac158f2b16b686a3d3c0879c5d6048aba14

Problem is only when we express LEDs as PCA955X_TYPE_LED. With Andrew Jeffrey’s help now, I got some better understanding of load/unload. I then created this hack, but that does not do the trick as well.

--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -442,9 +442,9 @@ void led_classdev_unregister(struct led_classdev *led_cdev)
 	led_cdev->flags |= LED_UNREGISTERING;
 
 	/* Stop blinking */
-	led_stop_software_blink(led_cdev);
+    /* led_stop_software_blink(led_cdev); */
 
-	led_set_brightness(led_cdev, LED_OFF);
+	/*led_set_brightness(led_cdev, LED_OFF); */
 
 	flush_work(&led_cdev->set_brightness_work);
 
diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
index f1f718d..833a16b 100644
--- a/drivers/leds/led-core.c
+++ b/drivers/leds/led-core.c
@@ -121,8 +121,8 @@ static void set_brightness_delayed(struct work_struct *ws)
 	int ret = 0;
 
 	if (test_and_clear_bit(LED_BLINK_DISABLE, &led_cdev->work_flags)) {
-		led_cdev->delayed_set_value = LED_OFF;
-		led_stop_software_blink(led_cdev);
+		/* led_cdev->delayed_set_value = LED_OFF; */
+		/* led_stop_software_blink(led_cdev); */
 	}
 
 	ret = __led_set_brightness(led_cdev, led_cdev->delayed_set_value);
— 

Thank you,
!! Vishwa !!

> On 28-Apr-2021, at 2:52 AM, Jacek Anaszewski <jacek.anaszewski@gmail.com> wrote:
> 
> Hi Vishwanatha,
> 
> On 4/26/21 7:59 AM, vishwanatha subbanna wrote:
>> Joel,
>> With the experiments that I have done, I can not express LEDs with PCA955X_TYPE_LED predominantly because LEDs won’t
>> retain states after the BMC reboot. I cooked a patch and tried but it does not work. I did an experiment where
>> I put the patch and then did a reboot and saw that the LEDs were [OFF] in the very early stage of probe itself.
>>> From a9fe9e956c624c15a455b88cc05262358519a541 Mon Sep 17 00:00:00 2001
>> From: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
>> Date: Fri, 23 Apr 2021 06:57:56 -0500
>> Subject: [PATCH 1/2] leds: pca955x: Add support for default-state
>> Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
>> ---
>>  drivers/leds/leds-pca955x.c | 12 ++++++++++--
>>  1 file changed, 10 insertions(+), 2 deletions(-)
>> diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c
>> index bf7ead4..987415b 100644
>> --- a/drivers/leds/leds-pca955x.c
>> +++ b/drivers/leds/leds-pca955x.c
>> @@ -130,6 +130,7 @@ struct pca955x_led {
>>  	char			name[32];
>>  	u32			type;
>>  	const char		*default_trigger;
>> +	const char		*default_state;
>>  };
>>    struct pca955x_platform_data {
>> @@ -408,6 +409,8 @@ static int pca955x_gpio_direction_output(struct gpio_chip *gc,
>>  		fwnode_property_read_u32(child, "type", &pdata->leds[reg].type);
>>  		fwnode_property_read_string(child, "linux,default-trigger",
>>  					&pdata->leds[reg].default_trigger);
>> +		fwnode_property_read_string(child, "default-state",
>> +					&pdata->leds[reg].default_state);
>>  	}
>>    	pdata->num_leds = chip->bits;
>> @@ -520,8 +523,13 @@ static int pca955x_probe(struct i2c_client *client,
>>  			if (err)
>>  				return err;
>>  -			/* Turn off LED */
>> -			err = pca955x_led_set(&pca955x_led->led_cdev, LED_OFF);
>> +			/* If the default-state is "keep", don't change states */
>> +			if (strcmp(pdata->leds[i].default_state, "keep")) {
>> +				if (!strcmp(pdata->leds[i].default_state, "on"))
>> +					err = pca955x_led_set(&pca955x_led->led_cdev, LED_ON);
>> +				else
>> +					err = pca955x_led_set(&pca955x_led->led_cdev, LED_OFF);
>> +			}
>>  			if (err)
>>  				return err;
>>  		}
>> —
>> 1.8.3.1
>> For `leds-gpio`, Andrew had put a patch, but I don’t see how that can be mapped to PCA955X. https://github.com/torvalds/linux/commit/f5808ac158f2b16b686a3d3c0879c5d6048aba14
>> Jacek,
>> Please could you help me here ?.. I need to express LEDs as PCA955X_TYPE_LED and also retain states post BMC reboot.
> 
> If in your setup the LED controller loses power on reboot then there
> is nothing you can do to retain the state.
> 
> -- 
> Best regards,
> Jacek Anaszewski


  reply	other threads:[~2021-04-28  7:30 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08 22:53 [PATCH linux dev-5.10 00/35] Rainier and Everest system updates Eddie James
2021-03-08 22:53 ` [PATCH linux dev-5.10 01/35] ARM: dts: aspeed: rainier: Add Operator Panel LEDs Eddie James
2021-03-12  0:05   ` Joel Stanley
2021-03-08 22:53 ` [PATCH linux dev-5.10 02/35] ARM: dts: aspeed: rainier: Add directly controlled LEDs Eddie James
2021-03-12  0:04   ` Joel Stanley
2021-03-08 22:53 ` [PATCH linux dev-5.10 03/35] ARM: dts: aspeed: rainier: Add gpio-keys-polled for fans Eddie James
2021-03-12  0:06   ` Joel Stanley
2021-03-08 22:53 ` [PATCH linux dev-5.10 04/35] ARM: dts: aspeed: rainier: Set MAX31785 config Eddie James
2021-03-12  0:07   ` Joel Stanley
2021-03-08 22:53 ` [PATCH linux dev-5.10 05/35] ARM: dts: aspeed: rainier: Add additional processor CFAMs Eddie James
2021-03-12  0:07   ` Joel Stanley
2021-03-08 22:53 ` [PATCH linux dev-5.10 06/35] ARM: dts: aspeed: rainier: Add leds that are off PCA9552 Eddie James
2021-03-12  0:09   ` Joel Stanley
2021-03-12  0:21   ` Milton Miller II
2021-03-12  0:30     ` Joel Stanley
     [not found]       ` <6ACEC474-8CFD-4BA9-B8FF-CCD41007AA67@linux.vnet.ibm.com>
2021-03-24 23:43         ` Joel Stanley
2021-04-26  5:59           ` vishwanatha subbanna
2021-04-26  5:59             ` vishwanatha subbanna
2021-04-27 21:22             ` Jacek Anaszewski
2021-04-27 21:22               ` Jacek Anaszewski
2021-04-28  7:30               ` vishwanatha subbanna [this message]
2021-03-08 22:53 ` [PATCH linux dev-5.10 07/35] ARM: dts: aspeed: rainier: Add leds that are off pic16f882 Eddie James
2021-03-12  0:10   ` Joel Stanley
2021-03-08 22:53 ` [PATCH linux dev-5.10 08/35] ARM: dts: aspeed: rainier: Add leds on optional DASD cards Eddie James
2021-03-12  0:10   ` Joel Stanley
2021-03-08 22:53 ` [PATCH linux dev-5.10 09/35] ARM: dts: aspeed: rainier: Add leds that are on optional PCI cable cards Eddie James
2021-03-12  0:11   ` Joel Stanley
2021-03-08 22:53 ` [PATCH linux dev-5.10 10/35] ARM: dts: aspeed: rainier: Add presence GPIOs Eddie James
2021-03-12  0:14   ` Joel Stanley
2021-03-08 22:53 ` [PATCH linux dev-5.10 11/35] ARM: dts: aspeed: rainier: Mark controllers as restricted Eddie James
2021-03-12  0:15   ` Joel Stanley
2021-03-08 22:53 ` [PATCH linux dev-5.10 12/35] ARM: dts: aspeed: rainier 4U: Fix fan configuration Eddie James
2021-03-12  0:17   ` Joel Stanley
2021-03-08 22:53 ` [PATCH linux dev-5.10 13/35] dt: bindings: mmc: Add phase control properties for the Aspeed SDHCI Eddie James
2021-03-12  0:19   ` Joel Stanley
2021-04-12  3:21     ` Andrew Jeffery
2021-03-08 22:53 ` [PATCH linux dev-5.10 14/35] mmc: sdhci: aspeed: Expose data sample phase delay tuning Eddie James
2021-03-08 22:53 ` [PATCH linux dev-5.10 15/35] ARM: dts: aspeed: tacoma: Add data sample phase delay for eMMC Eddie James
2021-03-08 22:54 ` [PATCH linux dev-5.10 16/35] ARM: dts: aspeed: tacoma: Remove CFAM reset GPIO Eddie James
2021-03-08 22:54 ` [PATCH linux dev-5.10 17/35] ARM: dts: aspeed: Everest: Add I2C components Eddie James
2021-03-08 22:54 ` [PATCH linux dev-5.10 18/35] ARM: dts: Aspeed: Everest: Add max31785 fan controller device Eddie James
2021-03-08 22:54 ` [PATCH linux dev-5.10 19/35] ARM: dts: Aspeed: Everest: Add FSI CFAMs and re-number engines Eddie James
2021-03-08 22:54 ` [PATCH linux dev-5.10 20/35] ARM: dts: Aspeed: Everest: Add pca9552 fan presence Eddie James
2021-03-08 22:54 ` [PATCH linux dev-5.10 21/35] ARM: dts: aspeed: everest: Add power supply i2c devices Eddie James
2021-03-08 22:54 ` [PATCH linux dev-5.10 22/35] ARM: dts: aspeed: everest: Add UCD90320 power sequencer Eddie James
2021-03-08 22:54 ` [PATCH linux dev-5.10 23/35] ARM: dts: aspeed: everest: GPIOs support Eddie James
2021-03-08 22:54 ` [PATCH linux dev-5.10 24/35] ARM: dts: Aspeed: Everest: Add RTC Eddie James
2021-03-08 22:54 ` [PATCH linux dev-5.10 25/35] ARM: dts: aspeed: rainier: Support pass 2 planar Eddie James
2021-03-08 22:54 ` [PATCH linux dev-5.10 26/35] fsi: scom: Handle FSI2PIB timeout Eddie James
2021-03-12  0:20   ` Joel Stanley
2021-03-08 22:54 ` [PATCH linux dev-5.10 27/35] net/ncsi: Avoid channel_monitor hrtimer deadlock Eddie James
2021-03-12  0:35   ` Joel Stanley
2021-03-08 22:54 ` [PATCH linux dev-5.10 28/35] ftgmac100: Restart MAC HW once Eddie James
2021-03-08 22:54 ` [PATCH linux dev-5.10 29/35] hwmon: (pmbus) Add a PMBUS_NO_CAPABILITY platform data flag Eddie James
2021-03-08 22:54 ` [PATCH linux dev-5.10 30/35] hwmon: (pmbus/ibm-cffps) Set the PMBUS_NO_CAPABILITY flag Eddie James
2021-03-12  0:23   ` Joel Stanley
2021-03-08 22:54 ` [PATCH linux dev-5.10 31/35] i2c: Allow throttling of transfers to client devices Eddie James
2021-03-08 22:54 ` [PATCH linux dev-5.10 32/35] pmbus: (ucd9000) Throttle SMBus transfers to avoid poor behaviour Eddie James
2021-03-08 22:54 ` [PATCH linux dev-5.10 33/35] pmbus: (core) Add a one-shot retry in pmbus_set_page() Eddie James
2021-03-09 20:21   ` Andrei Kartashev
2021-03-12  0:35   ` Joel Stanley
2021-03-08 22:54 ` [PATCH linux dev-5.10 34/35] pmbus: (max31785) Add a local pmbus_set_page() implementation Eddie James
2021-03-08 22:54 ` [PATCH linux dev-5.10 35/35] pmbus: (max31785) Retry enabling fans after writing MFR_FAN_CONFIG Eddie James
2021-03-12  0:37 ` [PATCH linux dev-5.10 00/35] Rainier and Everest system updates Joel Stanley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2F05B835-8710-4E2F-864F-1EB2984E24A8@linux.vnet.ibm.com \
    --to=vishwa@linux.vnet.ibm.com \
    --cc=andrew@aj.id.au \
    --cc=eajames@linux.ibm.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=joel@jms.id.au \
    --cc=linux-leds@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.