From: George Moussalem <george.moussalem@outlook.com>
To: "Konrad Dybcio" <konrad.dybcio@oss.qualcomm.com>,
"Uwe Kleine-König" <ukleinek@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Baruch Siach" <baruch@tkos.co.il>,
"Bjorn Andersson" <andersson@kernel.org>,
"Konrad Dybcio" <konradybcio@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, linux-pwm@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Devi Priya <quic_devipriy@quicinc.com>,
Baruch Siach <baruch.siach@siklu.com>
Subject: Re: [PATCH v19 2/6] pwm: driver for qualcomm ipq6018 pwm block
Date: Mon, 8 Dec 2025 19:40:21 +0400 [thread overview]
Message-ID: <BL4PR19MB8902F80FE2D7FD5BCBE340689DA2A@BL4PR19MB8902.namprd19.prod.outlook.com> (raw)
In-Reply-To: <3aa86b13-9505-4f64-a168-4c46962b715e@oss.qualcomm.com>
On 11/28/25 15:32, Konrad Dybcio wrote:
> On 11/28/25 11:29 AM, George Moussalem via B4 Relay wrote:
>> From: Devi Priya <quic_devipriy@quicinc.com>
>>
>> Driver for the PWM block in Qualcomm IPQ6018 line of SoCs. Based on
>> driver from downstream Codeaurora kernel tree. Removed support for older
>> (V1) variants because I have no access to that hardware.
>>
>> Tested on IPQ5018 and IPQ6010 based hardware.
>>
>> Co-developed-by: Baruch Siach <baruch.siach@siklu.com>
>> Signed-off-by: Baruch Siach <baruch.siach@siklu.com>
>> Signed-off-by: Devi Priya <quic_devipriy@quicinc.com>
>> Reviewed-by: Bjorn Andersson <andersson@kernel.org>
>> Signed-off-by: George Moussalem <george.moussalem@outlook.com>
>> ---
>
> [...]
>
>> +/* The frequency range supported is 1 Hz to clock rate */
>> +#define IPQ_PWM_MAX_PERIOD_NS ((u64)NSEC_PER_SEC)
>> +
>> +/*
>> + * The max value specified for each field is based on the number of bits
>> + * in the pwm control register for that field
>> + */
>> +#define IPQ_PWM_MAX_DIV 0xFFFF
>> +
>> +/*
>> + * Two 32-bit registers for each PWM: REG0, and REG1.
>> + * Base offset for PWM #i is at 8 * #i.
>> + */
>> +#define IPQ_PWM_REG0 0
>> +#define IPQ_PWM_REG0_PWM_DIV GENMASK(15, 0)
>> +#define IPQ_PWM_REG0_HI_DURATION GENMASK(31, 16)
>> +
>> +#define IPQ_PWM_REG1 4
>> +#define IPQ_PWM_REG1_PRE_DIV GENMASK(15, 0)
>
> Sorry for coming in so late, you may consider this as material for a
> follow-up patch (I *really* don't want to hold off your v19..)
>
> I see that on ipq9574 the registers are named:
>
> base = 0x1941010 = tcsr + 0xa010
>
> 0x0 CFG0_R0
> 0x4 CFG1_R0
> 0x8 CFG0_R1
> 0xc CFG1_R1
> 0x10 CFG0_R2
> 0x14 CFG1_R2
> 0x18 CFG0_R3
> 0x1c CFG1_R3
>
> CFG0 and CFG1 are what you called REG0/REG1 and Rn is confusingly the
> index of the controller/output
>
> The other bits in CFG1 (29:16) are RESERVED so there's nothing you
> missed in there
thanks for your review and validation.
>
>> +
>> +/*
>> + * Enable bit is set to enable output toggling in pwm device.
>> + * Update bit is set to trigger the change and is unset automatically
>> + * to reflect the changed divider and high duration values in register.
>> + */
>> +#define IPQ_PWM_REG1_UPDATE BIT(30)
>> +#define IPQ_PWM_REG1_ENABLE BIT(31)
>> +
>> +struct ipq_pwm_chip {
>> + struct clk *clk;
>> + void __iomem *mem;
>> +};
>> +
>> +static struct ipq_pwm_chip *ipq_pwm_from_chip(struct pwm_chip *chip)
>> +{
>> + return pwmchip_get_drvdata(chip);
>> +}
>> +
>> +static unsigned int ipq_pwm_reg_read(struct pwm_device *pwm, unsigned int reg)
>> +{
>> + struct ipq_pwm_chip *ipq_chip = ipq_pwm_from_chip(pwm->chip);
>> + unsigned int off = 8 * pwm->hwpwm + reg;
>
> This magic 8 could be #defined as IPQ6018_PWM_CONTROLLER_STRIDE or so
good suggestion, will add it should another iteration be required.
>
> Konrad
BR,
George
next prev parent reply other threads:[~2025-12-08 15:40 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-28 10:29 [PATCH v19 0/6] Add PWM support for IPQ chipsets George Moussalem via B4 Relay
2025-11-28 10:29 ` [PATCH v19 1/6] dt-bindings: pwm: add IPQ6018 binding George Moussalem via B4 Relay
2025-11-28 11:18 ` Rob Herring (Arm)
2026-01-19 16:35 ` Uwe Kleine-König
2026-01-20 10:16 ` Konrad Dybcio
2025-11-28 10:29 ` [PATCH v19 2/6] pwm: driver for qualcomm ipq6018 pwm block George Moussalem via B4 Relay
2025-11-28 11:32 ` Konrad Dybcio
2025-12-08 15:40 ` George Moussalem [this message]
2026-01-19 16:41 ` Uwe Kleine-König
2026-01-19 16:30 ` Uwe Kleine-König
2026-02-04 10:47 ` George Moussalem
2025-11-28 10:29 ` [PATCH v19 3/6] arm64: dts: qcom: ipq6018: add pwm node George Moussalem via B4 Relay
2025-11-28 10:29 ` [PATCH v19 4/6] arm64: dts: qcom: ipq5018: " George Moussalem via B4 Relay
2025-11-28 10:29 ` [PATCH v19 5/6] arm64: dts: qcom: ipq5332: " George Moussalem via B4 Relay
2025-11-28 10:29 ` [PATCH v19 6/6] arm64: dts: qcom: ipq9574: " George Moussalem via B4 Relay
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=BL4PR19MB8902F80FE2D7FD5BCBE340689DA2A@BL4PR19MB8902.namprd19.prod.outlook.com \
--to=george.moussalem@outlook.com \
--cc=andersson@kernel.org \
--cc=baruch.siach@siklu.com \
--cc=baruch@tkos.co.il \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=konrad.dybcio@oss.qualcomm.com \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=quic_devipriy@quicinc.com \
--cc=robh@kernel.org \
--cc=ukleinek@kernel.org \
/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
all inboxes | Powered by JetHome®