[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cb5d7483-9b6f-51c7-a2b1-9ff83c6e7c8a@quicinc.com>
Date: Mon, 27 Mar 2023 12:30:09 +0800
From: Fenglin Wu <quic_fenglinw@...cinc.com>
To: Pavel Machek <pavel@....cz>
CC: <linux-arm-msm@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<lee@...nel.org>, <krzysztof.kozlowski@...aro.org>,
<linux-leds@...r.kernel.org>, <quic_collinsd@...cinc.com>,
<quic_subbaram@...cinc.com>, Luca Weiss <luca.weiss@...rphone.com>
Subject: Re: [PATCH v8 1/2] leds: flash: add driver to support flash LED
module in QCOM PMICs
On 3/26/2023 1:09 AM, Pavel Machek wrote:
> Hi!
>> @@ -61,6 +61,21 @@ config LEDS_MT6360
>> Independent current sources supply for each flash LED support torch
>> and strobe mode.
>>
>> +config LEDS_QCOM_FLASH
>> + tristate "LED support for flash module inside Qualcomm Technologies, Inc. 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 together
>> + to supply one LED component to achieve current up to 2 A. In such case,
>> + 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..."
I can update it in a new change considering the initial change has been
applied.
>
>> +static int qcom_flash_led_brightness_set(struct led_classdev *led_cdev,
>> + enum led_brightness brightness)
>> +{
>> + struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev);
>> + struct qcom_flash_led *led = flcdev_to_qcom_fled(fled_cdev);
>> + u32 current_ma = brightness * led->max_torch_current_ma / LED_FULL;
>> + bool enable = !!brightness;
>> + int rc;
>> +
>> + rc = 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.
It does support multiple levels and the 'current_ma' is calculated based
on different brightness level.
>
> BR,
> Pavel
Powered by blists - more mailing lists