linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] leds:lp55xx: fix firmware loading error
@ 2015-06-29  0:39 Milo Kim
  2015-06-29 14:58 ` Jacek Anaszewski
  0 siblings, 1 reply; 3+ messages in thread
From: Milo Kim @ 2015-06-29  0:39 UTC (permalink / raw)
  To: cooloney; +Cc: Milo Kim, Jacek Anaszewski, linux-leds

LP55xx driver uses not firmware file but raw data to load program through
the firmware interface.(Documents/leds/leds-lp55xx.txt)

  For example, here is how to run blinking green channel pattern.
  (The second engine is seleted and MUX is mapped to 'RGB' mode)
  echo 2 > /sys/bus/i2c/devices/xxxx/select_engine
  echo "RGB" > /sys/bus/i2c/devices/xxxx/engine_mux
  echo 1 > /sys/class/firmware/lp5562/loading
  echo "4000600040FF6000" > /sys/class/firmware/lp5562/data
  echo 0 > /sys/class/firmware/lp5562/loading
  echo 1 > /sys/bus/i2c/devices/xxxx/run_engine

However, '/sys/class/firmware/<device name>' is not created after the
firmware loader user helper was introduced.
This feature is used in the case below.

  As soon as the firmware download is requested by the driver, firmware
  class subsystem tries to find the binary file.
  If it gets failed, then it just falls back to user helper to load
  raw data manually. Here, you can see the device file under
  /sys/class/firmware/.

To make it happen, LP55xx driver requires two configurations.

  1. Enable CONFIG_FW_LOADER_USER_HELPER_FALLBACK in Kconfig
  2. Set option, 'FW_OPT_USERHELPER' on requesting the firmware data.
     It means the second option should be 'false' in
     request_firmware_nowait().
     This option enables to load firmware data manually by calling
     fw_load_from_user_helper().

Cc: Bryan Wu <cooloney@gmail.com>
Cc: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: linux-leds@vger.kernel.org
Signed-off-by: Milo Kim <milo.kim@ti.com>
---
 drivers/leds/Kconfig              | 1 +
 drivers/leds/leds-lp55xx-common.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 966b960..a39d608 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -206,6 +206,7 @@ config LEDS_LP55XX_COMMON
 	tristate "Common Driver for TI/National LP5521/5523/55231/5562/8501"
 	depends on LEDS_LP5521 || LEDS_LP5523 || LEDS_LP5562 || LEDS_LP8501
 	select FW_LOADER
+	select FW_LOADER_USER_HELPER_FALLBACK
 	help
 	  This option supports common operations for LP5521/5523/55231/5562/8501
 	  devices.
diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c
index 77c26bc..96d51e9 100644
--- a/drivers/leds/leds-lp55xx-common.c
+++ b/drivers/leds/leds-lp55xx-common.c
@@ -223,7 +223,7 @@ static int lp55xx_request_firmware(struct lp55xx_chip *chip)
 	const char *name = chip->cl->name;
 	struct device *dev = &chip->cl->dev;
 
-	return request_firmware_nowait(THIS_MODULE, true, name, dev,
+	return request_firmware_nowait(THIS_MODULE, false, name, dev,
 				GFP_KERNEL, chip, lp55xx_firmware_loaded);
 }
 
-- 
1.9.1

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

* Re: [PATCH RESEND] leds:lp55xx: fix firmware loading error
  2015-06-29  0:39 [PATCH RESEND] leds:lp55xx: fix firmware loading error Milo Kim
@ 2015-06-29 14:58 ` Jacek Anaszewski
  2015-06-29 17:11   ` Bryan Wu
  0 siblings, 1 reply; 3+ messages in thread
From: Jacek Anaszewski @ 2015-06-29 14:58 UTC (permalink / raw)
  To: Milo Kim; +Cc: cooloney, linux-leds

Hi Milo,

Thanks for the update.

On 06/29/2015 02:39 AM, Milo Kim wrote:
> LP55xx driver uses not firmware file but raw data to load program through
> the firmware interface.(Documents/leds/leds-lp55xx.txt)
>
>    For example, here is how to run blinking green channel pattern.
>    (The second engine is seleted and MUX is mapped to 'RGB' mode)
>    echo 2 > /sys/bus/i2c/devices/xxxx/select_engine
>    echo "RGB" > /sys/bus/i2c/devices/xxxx/engine_mux
>    echo 1 > /sys/class/firmware/lp5562/loading
>    echo "4000600040FF6000" > /sys/class/firmware/lp5562/data
>    echo 0 > /sys/class/firmware/lp5562/loading
>    echo 1 > /sys/bus/i2c/devices/xxxx/run_engine
>
> However, '/sys/class/firmware/<device name>' is not created after the
> firmware loader user helper was introduced.
> This feature is used in the case below.
>
>    As soon as the firmware download is requested by the driver, firmware
>    class subsystem tries to find the binary file.
>    If it gets failed, then it just falls back to user helper to load
>    raw data manually. Here, you can see the device file under
>    /sys/class/firmware/.
>
> To make it happen, LP55xx driver requires two configurations.
>
>    1. Enable CONFIG_FW_LOADER_USER_HELPER_FALLBACK in Kconfig
>    2. Set option, 'FW_OPT_USERHELPER' on requesting the firmware data.
>       It means the second option should be 'false' in
>       request_firmware_nowait().
>       This option enables to load firmware data manually by calling
>       fw_load_from_user_helper().
>
> Cc: Bryan Wu <cooloney@gmail.com>
> Cc: Jacek Anaszewski <j.anaszewski@samsung.com>
> Cc: linux-leds@vger.kernel.org
> Signed-off-by: Milo Kim <milo.kim@ti.com>
> ---
>   drivers/leds/Kconfig              | 1 +
>   drivers/leds/leds-lp55xx-common.c | 2 +-
>   2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
> index 966b960..a39d608 100644
> --- a/drivers/leds/Kconfig
> +++ b/drivers/leds/Kconfig
> @@ -206,6 +206,7 @@ config LEDS_LP55XX_COMMON
>   	tristate "Common Driver for TI/National LP5521/5523/55231/5562/8501"
>   	depends on LEDS_LP5521 || LEDS_LP5523 || LEDS_LP5562 || LEDS_LP8501
>   	select FW_LOADER
> +	select FW_LOADER_USER_HELPER_FALLBACK
>   	help
>   	  This option supports common operations for LP5521/5523/55231/5562/8501
>   	  devices.
> diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c
> index 77c26bc..96d51e9 100644
> --- a/drivers/leds/leds-lp55xx-common.c
> +++ b/drivers/leds/leds-lp55xx-common.c
> @@ -223,7 +223,7 @@ static int lp55xx_request_firmware(struct lp55xx_chip *chip)
>   	const char *name = chip->cl->name;
>   	struct device *dev = &chip->cl->dev;
>
> -	return request_firmware_nowait(THIS_MODULE, true, name, dev,
> +	return request_firmware_nowait(THIS_MODULE, false, name, dev,
>   				GFP_KERNEL, chip, lp55xx_firmware_loaded);
>   }
>
>

Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com>

-- 
Best Regards,
Jacek Anaszewski

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

* Re: [PATCH RESEND] leds:lp55xx: fix firmware loading error
  2015-06-29 14:58 ` Jacek Anaszewski
@ 2015-06-29 17:11   ` Bryan Wu
  0 siblings, 0 replies; 3+ messages in thread
From: Bryan Wu @ 2015-06-29 17:11 UTC (permalink / raw)
  To: Jacek Anaszewski; +Cc: Milo Kim, Linux LED Subsystem

On Mon, Jun 29, 2015 at 7:58 AM, Jacek Anaszewski
<j.anaszewski@samsung.com> wrote:
> Hi Milo,
>
> Thanks for the update.
>
>
> On 06/29/2015 02:39 AM, Milo Kim wrote:
>>
>> LP55xx driver uses not firmware file but raw data to load program through
>> the firmware interface.(Documents/leds/leds-lp55xx.txt)
>>
>>    For example, here is how to run blinking green channel pattern.
>>    (The second engine is seleted and MUX is mapped to 'RGB' mode)
>>    echo 2 > /sys/bus/i2c/devices/xxxx/select_engine
>>    echo "RGB" > /sys/bus/i2c/devices/xxxx/engine_mux
>>    echo 1 > /sys/class/firmware/lp5562/loading
>>    echo "4000600040FF6000" > /sys/class/firmware/lp5562/data
>>    echo 0 > /sys/class/firmware/lp5562/loading
>>    echo 1 > /sys/bus/i2c/devices/xxxx/run_engine
>>
>> However, '/sys/class/firmware/<device name>' is not created after the
>> firmware loader user helper was introduced.
>> This feature is used in the case below.
>>
>>    As soon as the firmware download is requested by the driver, firmware
>>    class subsystem tries to find the binary file.
>>    If it gets failed, then it just falls back to user helper to load
>>    raw data manually. Here, you can see the device file under
>>    /sys/class/firmware/.
>>
>> To make it happen, LP55xx driver requires two configurations.
>>
>>    1. Enable CONFIG_FW_LOADER_USER_HELPER_FALLBACK in Kconfig
>>    2. Set option, 'FW_OPT_USERHELPER' on requesting the firmware data.
>>       It means the second option should be 'false' in
>>       request_firmware_nowait().
>>       This option enables to load firmware data manually by calling
>>       fw_load_from_user_helper().
>>
>> Cc: Bryan Wu <cooloney@gmail.com>
>> Cc: Jacek Anaszewski <j.anaszewski@samsung.com>
>> Cc: linux-leds@vger.kernel.org
>> Signed-off-by: Milo Kim <milo.kim@ti.com>
>> ---
>>   drivers/leds/Kconfig              | 1 +
>>   drivers/leds/leds-lp55xx-common.c | 2 +-
>>   2 files changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
>> index 966b960..a39d608 100644
>> --- a/drivers/leds/Kconfig
>> +++ b/drivers/leds/Kconfig
>> @@ -206,6 +206,7 @@ config LEDS_LP55XX_COMMON
>>         tristate "Common Driver for TI/National
>> LP5521/5523/55231/5562/8501"
>>         depends on LEDS_LP5521 || LEDS_LP5523 || LEDS_LP5562 ||
>> LEDS_LP8501
>>         select FW_LOADER
>> +       select FW_LOADER_USER_HELPER_FALLBACK
>>         help
>>           This option supports common operations for
>> LP5521/5523/55231/5562/8501
>>           devices.
>> diff --git a/drivers/leds/leds-lp55xx-common.c
>> b/drivers/leds/leds-lp55xx-common.c
>> index 77c26bc..96d51e9 100644
>> --- a/drivers/leds/leds-lp55xx-common.c
>> +++ b/drivers/leds/leds-lp55xx-common.c
>> @@ -223,7 +223,7 @@ static int lp55xx_request_firmware(struct lp55xx_chip
>> *chip)
>>         const char *name = chip->cl->name;
>>         struct device *dev = &chip->cl->dev;
>>
>> -       return request_firmware_nowait(THIS_MODULE, true, name, dev,
>> +       return request_firmware_nowait(THIS_MODULE, false, name, dev,
>>                                 GFP_KERNEL, chip, lp55xx_firmware_loaded);
>>   }
>>
>>
>
> Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com>
>
Merged thanks.
-Bryan

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

end of thread, other threads:[~2015-06-29 17:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-29  0:39 [PATCH RESEND] leds:lp55xx: fix firmware loading error Milo Kim
2015-06-29 14:58 ` Jacek Anaszewski
2015-06-29 17:11   ` Bryan Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).