[v1] led: flash: various minor fixes for leds-qcom-flash driver

Message ID 20230718092439.2482320-1-quic_fenglinw@quicinc.com
State New
Headers
Series [v1] led: flash: various minor fixes for leds-qcom-flash driver |

Commit Message

Fenglin Wu July 18, 2023, 9:24 a.m. UTC
  Update the driver to address following minor issues:
 - Add a sentence in Kconfig to explain the driver can be compiled
   as a module
 - strobe off the LED channel before setting flash current to prevent
   the flash LED being lit with an incorrect brightness if it was
   already active in torch mode
 - put the child node if register any flash LED device failed.

Signed-off-by: Fenglin Wu <quic_fenglinw@quicinc.com>
---
 drivers/leds/flash/Kconfig           | 2 ++
 drivers/leds/flash/leds-qcom-flash.c | 5 +++++
 2 files changed, 7 insertions(+)
  

Comments

Krzysztof Kozlowski July 18, 2023, 9:32 a.m. UTC | #1
On 18/07/2023 11:24, Fenglin Wu wrote:
> Update the driver to address following minor issues:
>  - Add a sentence in Kconfig to explain the driver can be compiled
>    as a module
>  - strobe off the LED channel before setting flash current to prevent
>    the flash LED being lit with an incorrect brightness if it was
>    already active in torch mode
>  - put the child node if register any flash LED device failed.

Don't mix different fixes and changes in one commit.

Also, please use scripts/get_maintainers.pl to get a list of necessary
people and lists to CC (and consider --no-git-fallback argument). I
really do not see a point why I am cc-ed here.

Best regards,
Krzysztof
  
Fenglin Wu July 18, 2023, 9:52 a.m. UTC | #2
On 7/18/2023 5:32 PM, Krzysztof Kozlowski wrote:
> On 18/07/2023 11:24, Fenglin Wu wrote:
>> Update the driver to address following minor issues:
>>   - Add a sentence in Kconfig to explain the driver can be compiled
>>     as a module
>>   - strobe off the LED channel before setting flash current to prevent
>>     the flash LED being lit with an incorrect brightness if it was
>>     already active in torch mode
>>   - put the child node if register any flash LED device failed.
> 
> Don't mix different fixes and changes in one commit.
> 
> Also, please use scripts/get_maintainers.pl to get a list of necessary
> people and lists to CC (and consider --no-git-fallback argument). I
> really do not see a point why I am cc-ed here.
> 
> Best regards,
> Krzysztof

I understood that we should separate the changes for different fixes.

I am trying to address the review comment from Pavel that was coming 
late after the original changes were applied: 
https://lore.kernel.org/linux-arm-msm/20230325170957.GA2904@bug/ (sorry 
for just got time to work on this), since all of them are small ones and 
all related with the same driver, so I thought it might be good to put 
them together and update with a single patch?

BTW, you are copied because you also reviewed the original changes.
Thanks



>
  
Lee Jones July 19, 2023, 8:50 a.m. UTC | #3
On Tue, 18 Jul 2023, Fenglin Wu wrote:

> 
> 
> On 7/18/2023 5:32 PM, Krzysztof Kozlowski wrote:
> > On 18/07/2023 11:24, Fenglin Wu wrote:
> > > Update the driver to address following minor issues:
> > >   - Add a sentence in Kconfig to explain the driver can be compiled
> > >     as a module
> > >   - strobe off the LED channel before setting flash current to prevent
> > >     the flash LED being lit with an incorrect brightness if it was
> > >     already active in torch mode
> > >   - put the child node if register any flash LED device failed.
> > 
> > Don't mix different fixes and changes in one commit.
> > 
> > Also, please use scripts/get_maintainers.pl to get a list of necessary
> > people and lists to CC (and consider --no-git-fallback argument). I
> > really do not see a point why I am cc-ed here.
> > 
> > Best regards,
> > Krzysztof
> 
> I understood that we should separate the changes for different fixes.
> 
> I am trying to address the review comment from Pavel that was coming late
> after the original changes were applied:
> https://lore.kernel.org/linux-arm-msm/20230325170957.GA2904@bug/ (sorry for
> just got time to work on this), since all of them are small ones and all
> related with the same driver, so I thought it might be good to put them
> together and update with a single patch?

Separate patches - one per functional change please.
  
Fenglin Wu July 19, 2023, 8:52 a.m. UTC | #4
On 7/19/2023 4:50 PM, Lee Jones wrote:
> On Tue, 18 Jul 2023, Fenglin Wu wrote:
> 
>>
>>
>> On 7/18/2023 5:32 PM, Krzysztof Kozlowski wrote:
>>> On 18/07/2023 11:24, Fenglin Wu wrote:
>>>> Update the driver to address following minor issues:
>>>>    - Add a sentence in Kconfig to explain the driver can be compiled
>>>>      as a module
>>>>    - strobe off the LED channel before setting flash current to prevent
>>>>      the flash LED being lit with an incorrect brightness if it was
>>>>      already active in torch mode
>>>>    - put the child node if register any flash LED device failed.
>>>
>>> Don't mix different fixes and changes in one commit.
>>>
>>> Also, please use scripts/get_maintainers.pl to get a list of necessary
>>> people and lists to CC (and consider --no-git-fallback argument). I
>>> really do not see a point why I am cc-ed here.
>>>
>>> Best regards,
>>> Krzysztof
>>
>> I understood that we should separate the changes for different fixes.
>>
>> I am trying to address the review comment from Pavel that was coming late
>> after the original changes were applied:
>> https://lore.kernel.org/linux-arm-msm/20230325170957.GA2904@bug/ (sorry for
>> just got time to work on this), since all of them are small ones and all
>> related with the same driver, so I thought it might be good to put them
>> together and update with a single patch?
> 
> Separate patches - one per functional change please.
sure. I will separate them and send them out.
Thanks

>
  

Patch

diff --git a/drivers/leds/flash/Kconfig b/drivers/leds/flash/Kconfig
index 4ed2efc65434..4e08dbc05709 100644
--- a/drivers/leds/flash/Kconfig
+++ b/drivers/leds/flash/Kconfig
@@ -89,6 +89,8 @@  config LEDS_QCOM_FLASH
 	  the total LED current will be split symmetrically on each channel and
 	  they will be enabled/disabled at the same time.
 
+	  This driver can be built as a module, it will be called "leds-qcom-flash".
+
 config LEDS_RT4505
 	tristate "LED support for RT4505 flashlight controller"
 	depends on I2C && OF
diff --git a/drivers/leds/flash/leds-qcom-flash.c b/drivers/leds/flash/leds-qcom-flash.c
index b089ca1a1901..a73d3ea5c97a 100644
--- a/drivers/leds/flash/leds-qcom-flash.c
+++ b/drivers/leds/flash/leds-qcom-flash.c
@@ -309,6 +309,10 @@  static int qcom_flash_strobe_set(struct led_classdev_flash *fled_cdev, bool stat
 	struct qcom_flash_led *led = flcdev_to_qcom_fled(fled_cdev);
 	int rc;
 
+	rc = set_flash_strobe(led, SW_STROBE, false);
+	if (rc)
+		return rc;
+
 	rc = set_flash_current(led, led->flash_current_ma, FLASH_MODE);
 	if (rc)
 		return rc;
@@ -745,6 +749,7 @@  static int qcom_flash_led_probe(struct platform_device *pdev)
 	return 0;
 
 release:
+	fwnode_handle_put(child);
 	while (flash_data->v4l2_flash[flash_data->leds_count] && flash_data->leds_count)
 		v4l2_flash_release(flash_data->v4l2_flash[flash_data->leds_count--]);
 	return rc;