Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Fenglin Wu <quic_fenglinw@quicinc.com>
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 <luca.weiss@fairphone.com>
Subject: Re: [PATCH v8 1/2] leds: flash: add driver to support flash LED module in QCOM PMICs
Date: Sat, 25 Mar 2023 18:33:34 +0100	[thread overview]
Message-ID: <ZB8wbv93+Vmx3trt@duo.ucw.cz> (raw)
In-Reply-To: <20230303095023.538917-2-quic_fenglinw@quicinc.com>

[-- Attachment #1: Type: text/plain, Size: 1827 bytes --]

Hi!

> Add initial driver to support flash LED module found in Qualcomm
> Technologies, Inc. PMICs. The flash module can have 3 or 4 channels
> and each channel can be controlled indepedently and support full scale
> current up to 1.5 A. It also supports connecting two channels together
> to supply one LED component with full scale current up to 2 A. In that
> case, the current will be split on each channel symmetrically and the
> channels will be enabled and disabled at the same time.


> +static int qcom_flash_strobe_set(struct led_classdev_flash *fled_cdev, bool state)
> +{
> +	struct qcom_flash_led *led = flcdev_to_qcom_fled(fled_cdev);
> +	int rc;
> +
> +	rc = set_flash_current(led, led->flash_current_ma, FLASH_MODE);
> +	if (rc)
> +		return rc;
> +
> +	rc = set_flash_timeout(led, led->flash_timeout_ms);
> +	if (rc)
> +		return rc;
> +
> +	rc = set_flash_module_en(led, state);
> +	if (rc)
> +		return rc;
> +
> +	return set_flash_strobe(led, SW_STROBE, state);
> +}

Should we disable the module before setting the current? It might be
already active due to torch mode...


> +		return -EINVAL;
> +	}
> +
> +	flash_data->v4l2_flash = devm_kcalloc(dev, count,
> +			sizeof(*flash_data->v4l2_flash), GFP_KERNEL);
> +	if (!flash_data->v4l2_flash)
> +		return -ENOMEM;
> +
> +	device_for_each_child_node(dev, child) {
> +		led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL);
> +		if (!led) {
> +			rc = -ENOMEM;
> +			goto release;
> +		}
> +
> +		led->flash_data = flash_data;
> +		rc = qcom_flash_register_led_device(dev, child, led);
> +		if (rc < 0)
> +			goto release;
> +
> +		flash_data->leds_count++;
> +	}

Do you need to do of_node_put in error paths?

BR,
							Pavel
-- 
People of Russia, stop Putin before his war on Ukraine escalates.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  parent reply	other threads:[~2023-03-25 17:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-03  9:50 [PATCH v8 0/2] Add LED driver for flash module in QCOM PMICs Fenglin Wu
2023-03-03  9:50 ` [PATCH v8 1/2] leds: flash: add driver to support flash LED " Fenglin Wu
2023-03-15 17:09   ` Lee Jones
2023-03-25 17:09   ` Pavel Machek
2023-03-27  4:30     ` Fenglin Wu
2023-03-25 17:33   ` Pavel Machek [this message]
2023-03-28  8:02     ` Fenglin Wu
2023-03-25 17:36   ` Pavel Machek
2023-03-28  8:13     ` Fenglin Wu
2023-03-03  9:50 ` [PATCH v8 2/2] dt-bindings: leds: add QCOM flash LED controller Fenglin Wu
2023-03-15 17:10   ` Lee Jones

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=ZB8wbv93+Vmx3trt@duo.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=lee@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=luca.weiss@fairphone.com \
    --cc=quic_collinsd@quicinc.com \
    --cc=quic_fenglinw@quicinc.com \
    --cc=quic_subbaram@quicinc.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox