Linux-LEDs Archive on lore.kernel.org
 help / color / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Dan Murphy <dmurphy@ti.com>, Luca Weiss <luca@z3ntu.xyz>,
	linux-leds@vger.kernel.org
Cc: Heiko Stuebner <heiko@sntech.de>, Icenowy Zheng <icenowy@aosc.io>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Maxime Ripard <mripard@kernel.org>, Pavel Machek <pavel@ucw.cz>,
	Rob Herring <robh+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	~postmarketos/upstreaming@lists.sr.ht
Subject: Re: [PATCH 3/3] leds: add sgm3140 driver
Date: Wed, 11 Mar 2020 22:09:23 +0100
Message-ID: <b3019ea0-a02f-9056-b8cd-8743a146570a@gmail.com> (raw)
In-Reply-To: <22341236-8298-dc97-217b-46071a362207@ti.com>

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@z3ntu.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

  reply index

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-09 20:35 [PATCH 0/3] Add sgm3140 flash led driver Luca Weiss
2020-03-09 20:35 ` [PATCH 1/3] dt-bindings: Add vendor prefix for SG Micro Corp Luca Weiss
2020-03-23 20:54   ` Rob Herring
2020-03-09 20:35 ` [PATCH 2/3] dt-bindings: leds: Add binding for sgm3140 Luca Weiss
2020-03-09 22:22   ` Sakari Ailus
2020-03-11 12:49   ` Dan Murphy
2020-03-15 10:47     ` Luca Weiss
2020-03-15 10:53       ` Laurent Pinchart
2020-03-23 21:30         ` Dan Murphy
2020-03-23 20:57   ` Rob Herring
2020-03-24 20:02     ` Luca Weiss
2020-03-09 20:35 ` [PATCH 3/3] leds: add sgm3140 driver Luca Weiss
2020-03-09 22:18   ` Sakari Ailus
2020-03-09 22:49     ` Pavel Machek
2020-03-09 22:52       ` Luca Weiss
2020-03-11 13:02   ` Dan Murphy
2020-03-11 21:09     ` Jacek Anaszewski [this message]
2020-03-15 10:42     ` Luca Weiss

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=b3019ea0-a02f-9056-b8cd-8743a146570a@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmurphy@ti.com \
    --cc=heiko@sntech.de \
    --cc=icenowy@aosc.io \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=luca@z3ntu.xyz \
    --cc=mark.rutland@arm.com \
    --cc=mripard@kernel.org \
    --cc=pavel@ucw.cz \
    --cc=robh+dt@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /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

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