[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b3019ea0-a02f-9056-b8cd-8743a146570a@gmail.com>
Date: Wed, 11 Mar 2020 22:09:23 +0100
From: Jacek Anaszewski <jacek.anaszewski@...il.com>
To: Dan Murphy <dmurphy@...com>, Luca Weiss <luca@...tu.xyz>,
linux-leds@...r.kernel.org
Cc: Heiko Stuebner <heiko@...ech.de>, Icenowy Zheng <icenowy@...c.io>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Mark Rutland <mark.rutland@....com>,
Maxime Ripard <mripard@...nel.org>,
Pavel Machek <pavel@....cz>, Rob Herring <robh+dt@...nel.org>,
Shawn Guo <shawnguo@...nel.org>, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, ~postmarketos/upstreaming@...ts.sr.ht
Subject: Re: [PATCH 3/3] leds: add sgm3140 driver
Dan,
On 3/11/20 2:02 PM, Dan Murphy wrote:
> Luca
>
> On 3/9/20 3:35 PM, Luca Weiss wrote:
>> Add a driver for the SGMICRO SGM3140 Buck/Boost Charge Pump LED driver.
>>
>> This device is controlled by two GPIO pins, one for enabling and the
>> second one for switching between torch and flash mode.
>
> How does one enable torch and one enable flash?
>
> Is the flash-gpio control this or does the enable-gpio enable the flash?
>
> The DT binding did not indicate what the GPIOs are really going to control.
>
>>
>> Signed-off-by: Luca Weiss <luca@...tu.xyz>
>> ---
>> Changes since RFC:
>> - address review comments from Jacek Anaszewski:
>> - implement strobe_get op
>> - implement timeout_set op
>> - init v4l2_sd_cfg variable
>> - remove init_data.devicename assignemnt
>> - use devm_ version of led_classdev_flash_register_ext
>> - release child_node in case of success
>>
>> drivers/leds/Kconfig | 9 ++
>> drivers/leds/Makefile | 1 +
>> drivers/leds/leds-sgm3140.c | 260 ++++++++++++++++++++++++++++++++++++
>> 3 files changed, 270 insertions(+)
>> create mode 100644 drivers/leds/leds-sgm3140.c
>>
>> diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
>> index 4b68520ac251..9206fc66799d 100644
>> --- a/drivers/leds/Kconfig
>> +++ b/drivers/leds/Kconfig
>> @@ -836,6 +836,15 @@ config LEDS_LM36274
>> Say Y to enable the LM36274 LED driver for TI LMU devices.
>> This supports the LED device LM36274.
>> +config LEDS_SGM3140
>> + tristate "LED support for the SGM3140"
>> + depends on LEDS_CLASS_FLASH
>> + depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS
>
> What is the purpose of this? Enable if V4L2_FLASH_LED_CLASS is enabled
> or if it is not enabled?
>
> Seems to be a do nothing dependency in the Kconfig
See the patch: 58d1809b9d61 ("leds: fix aat1290 build errors")
and Documentation/kbuild/kconfig-language.rst,
chapter "Menu dependencies".
According to that ('!' <expr>) boils down to (2-/expr/),
where
"An expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2
respectively for calculations)".
In a result:
- in case V4L2_FLASH_LED_CLASS=n it evaluates to 2,
- in case V4L2_FLASH_LED_CLASS=m it evaluates to 1,
- in case V4L2_FLASH_LED_CLASS=y it evaluates to 0
And (<expr> '||' <expr>) returns the result of max(/expr/, /expr/).
It allows to restrict LEDS_SGM3140 to m if CONFIG_V4L2_FLASH_LED_CLASS=m
(we will have max(1,1) then)
and ignore the dependency if CONFIG_V4L2_FLASH_LED_CLASS=n
(max(0,2)).
--
Best regards,
Jacek Anaszewski
Powered by blists - more mailing lists