Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp762100rwl; Sat, 25 Mar 2023 10:28:59 -0700 (PDT) X-Google-Smtp-Source: AKy350a3DEOhPpCSeJeTuMpME0/E5+0DkM4Ose7HZdlR1+kaSLFRV7QBJVgDUAKf40QNDW0sC6jE X-Received: by 2002:a17:90b:3b4d:b0:234:7ccf:3c7c with SMTP id ot13-20020a17090b3b4d00b002347ccf3c7cmr6544279pjb.9.1679765339081; Sat, 25 Mar 2023 10:28:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679765339; cv=none; d=google.com; s=arc-20160816; b=wmJQJd6ga0xT5KveWqjbO5n6O3E/nLRt7Od8O20FzVWp9VSLJO9eh9Lht8LvcvPsbH AXuaUMfVk8pgi48B4CYTkGNBBwbzrvs2dQNkqT1t2cZpnduOEGPwY5fQoUnNIZhIg8C6 TClbAY0iJFY/D0ZP26UQsbHPsQD/PJD9LsIHsGG/NsBm/BQPgKW7R3hf69K7zxMxI57J jpQf3ZTHujv4GwDvSKdZmKMZS/O0loU6r3sIS8H6tWXa31A3QcYFdT6mzscrinplSI32 TRNkdH2XMQyQHjb3H5Ull5bzreEAcp+m0DJBCxLzxFhMYOO40hotdV5mfTRIZv60OxWI ZOBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=2KJEOIv0WDWMx6CMw9Gy8zOmeN/VKM2AkbK4vySopPs=; b=ghDAA/Hon1yeebyzJTzn4gG8rfxxvnSg0dKP92TSmvc9EN3wYnYKkdKvyr/MnGBU4A MVlUEY2qDdiYuTASk4uwAXNOcnoVMDHLuQPtuWF4Xj8n1x0zgTMAz6b/vJqDRDSUUnC5 /ziXrHBTVTUn0oGirGj49XVbqbSZVQ5JjPDp8zJw5Dty/iVdcbMz8PS34tXneIAkDODb N/hlFUvGxJAfTGYI7ovnUVNrizS0B6z8HJILDRy7cYBNpekKgB8p/YsBgStCzvbC98c2 uXwMNqVui24MCHFKYo2msmzfT4bGG6dgik4hT2Inmz9BY2mQ9lkRghqp9T02uBjz/8ik Fk0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ucw.cz header.s=gen1 header.b=HIaaxeRL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ucw.cz Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pg11-20020a17090b1e0b00b00232dd9ab146si7185993pjb.13.2023.03.25.10.28.42; Sat, 25 Mar 2023 10:28:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ucw.cz header.s=gen1 header.b=HIaaxeRL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ucw.cz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230292AbjCYRKE (ORCPT + 99 others); Sat, 25 Mar 2023 13:10:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbjCYRKC (ORCPT ); Sat, 25 Mar 2023 13:10:02 -0400 Received: from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69C0CC15F; Sat, 25 Mar 2023 10:10:01 -0700 (PDT) Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 8C5C31C0AB2; Sat, 25 Mar 2023 18:09:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucw.cz; s=gen1; t=1679764199; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2KJEOIv0WDWMx6CMw9Gy8zOmeN/VKM2AkbK4vySopPs=; b=HIaaxeRLph/qsIzkGwDGhtqURhzPwYdTiSuQmXU8b+N3ySDDdBDrUlGSKEoqQFAU5AG/tP NED7Sp+6DaeugqL5Tvda8PQZvhnU7MS2H1qQ9xwsU82X/kws7u/mY4n71LmeSq7l/bvf+L 9mXq/0nYDuSz5Uz4By3u2Bfxsxt1ego= Date: Sat, 25 Mar 2023 18:09:57 +0100 From: Pavel Machek To: Fenglin Wu Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, lee@kernel.org, krzysztof.kozlowski@linaro.org, linux-leds@vger.kernel.org, quic_collinsd@quicinc.com, quic_subbaram@quicinc.com, Luca Weiss Subject: Re: [PATCH v8 1/2] leds: flash: add driver to support flash LED module in QCOM PMICs Message-ID: <20230325170957.GA2904@bug> References: <20230303095023.538917-1-quic_fenglinw@quicinc.com> <20230303095023.538917-2-quic_fenglinw@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20230303095023.538917-2-quic_fenglinw@quicinc.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! > @@ -61,6 +61,21 @@ config LEDS_MT6360 > Independent current sources supply for each flash LED support torch > and strobe mode. > =20 > +config LEDS_QCOM_FLASH > + tristate "LED support for flash module inside Qualcomm Technologies, In= c. PMIC" > + depends on MFD_SPMI_PMIC || COMPILE_TEST > + depends on LEDS_CLASS && OF > + depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS > + select REGMAP > + help > + This option enables support for the flash module found in Qualcomm > + Technologies, Inc. PMICs. The flash module can have 3 or 4 flash LED > + channels and each channel is programmable to support up to 1.5 A full > + scale current. It also supports connecting two channels' output toget= her > + to supply one LED component to achieve current up to 2 A. In such cas= e, > + the total LED current will be split symmetrically on each channel and > + they will be enabled/disabled at the same time. "This can be built as a module, module will be called..." > +static int qcom_flash_led_brightness_set(struct led_classdev *led_cdev, > + enum led_brightness brightness) > +{ > + struct led_classdev_flash *fled_cdev =3D lcdev_to_flcdev(led_cdev); > + struct qcom_flash_led *led =3D flcdev_to_qcom_fled(fled_cdev); > + u32 current_ma =3D brightness * led->max_torch_current_ma / LED_FULL; > + bool enable =3D !!brightness; > + int rc; > + > + rc =3D set_flash_current(led, current_ma, TORCH_MODE); > + if (rc) > + return rc; I'd not mind supporting more than one brightness level -- AFAICT hw can do = that. BR, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html