From: "Luca Weiss" <luca@z3ntu.xyz>
To: "Bjorn Andersson" <bjorn.andersson@linaro.org>,
"Pavel Machek" <pavel@ucw.cz>, "Dan Murphy" <dmurphy@ti.com>,
"Rob Herring" <robh+dt@kernel.org>,
"Andy Gross" <agross@kernel.org>,
"Thierry Reding" <thierry.reding@gmail.com>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Lee Jones" <lee.jones@linaro.org>,
"Martin Botka" <martin.botka1@gmail.com>
Cc: <linux-leds@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>,
<linux-pwm@vger.kernel.org>
Subject: Re: [PATCH v4 2/4] leds: Add driver for Qualcomm LPG
Date: Wed, 07 Oct 2020 09:40:45 +0000 [thread overview]
Message-ID: <C66K5YFY5LGN.1S3H72H0QQQAI@arch-vps> (raw)
In-Reply-To: <20200929031544.1000204-3-bjorn.andersson@linaro.org>
Hi Bjorn,
On Mon Sep 28, 2020 at 8:15 PM, Bjorn Andersson wrote:
> The Light Pulse Generator (LPG) is a PWM-block found in a wide range of
> PMICs from Qualcomm. It can operate on fixed parameters or based on a
> lookup-table, altering the duty cycle over time - which provides the
> means for e.g. hardware assisted transitions of LED brightness.
>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
>
> Changes since v3:
> - Adopt multicolor model
> - Simplified hw_pattern implementation
>
> drivers/leds/Kconfig | 9 +
> drivers/leds/Makefile | 1 +
> drivers/leds/leds-qcom-lpg.c | 1213 ++++++++++++++++++++++++++++++++++
> 3 files changed, 1223 insertions(+)
> create mode 100644 drivers/leds/leds-qcom-lpg.c
<snip>
> +static int lpg_pwm_request(struct pwm_chip *chip, struct pwm_device
> *pwm)
> +{
> + struct lpg *lpg = container_of(chip, struct lpg, pwm);
> + struct lpg_channel *chan = &lpg->channels[pwm->hwpwm];
> +
> + return chan->in_use ? -EBUSY : 0;
> +}
> +
> +static int lpg_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
> + const struct pwm_state *state)
> +{
> + struct lpg *lpg = container_of(chip, struct lpg, pwm);
> + struct lpg_channel *chan = &lpg->channels[pwm->hwpwm];
> +
> + lpg_calc_freq(chan, state->period / NSEC_PER_USEC);
> + lpg_calc_duty(chan, state->duty_cycle / NSEC_PER_USEC);
As written on IRC this has to be wrapped div_u64() to compile on arm32;
should also fix the buildbot failure.
> + chan->enabled = state->enabled;
> +
> + lpg_apply(chan);
> +
> + triled_set(lpg, chan->triled_mask, chan->enabled);
> +
> + return 0;
> +}
Other than that, this works great on msm8974-fairphone-fp2 (pm8941)
with reg 7 (red), 6 (green) & 5 (blue). Thanks for updating this
patchset!
Regards
Luca
next prev parent reply other threads:[~2020-10-07 9:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-29 3:15 [PATCH v4 0/4] Qualcomm Light Pulse Generator Bjorn Andersson
2020-09-29 3:15 ` [PATCH v4 1/4] dt-bindings: leds: Add Qualcomm Light Pulse Generator binding Bjorn Andersson
2020-09-29 14:48 ` Rob Herring
2020-09-29 14:51 ` Rob Herring
2020-09-29 3:15 ` [PATCH v4 2/4] leds: Add driver for Qualcomm LPG Bjorn Andersson
2020-10-07 9:40 ` Luca Weiss [this message]
2020-09-29 3:15 ` [PATCH v4 3/4] arm64: dts: qcom: msm8996: Add mpp and lpg blocks Bjorn Andersson
2020-10-01 15:22 ` Konrad Dybcio
2020-10-01 16:21 ` Bjorn Andersson
2020-09-29 3:15 ` [PATCH v4 4/4] arm64: dts: qcom: Add user LEDs on db820c Bjorn Andersson
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=C66K5YFY5LGN.1S3H72H0QQQAI@arch-vps \
--to=luca@z3ntu.xyz \
--cc=agross@kernel.org \
--cc=bjorn.andersson@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=dmurphy@ti.com \
--cc=lee.jones@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=martin.botka1@gmail.com \
--cc=pavel@ucw.cz \
--cc=robh+dt@kernel.org \
--cc=thierry.reding@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).