All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baruch Siach <baruch@tkos.co.il>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: linux-pwm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, Andy Gross <agross@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Kathiravan T <kathirav@codeaurora.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	kernel@pengutronix.de, Robert Marko <robert.marko@sartura.hr>,
	Lee Jones <lee.jones@linaro.org>,
	linux-arm-kernel@lists.infradead.org,
	Balaji Prakash J <bjagadee@codeaurora.org>
Subject: Re: [PATCH v5 2/4] pwm: driver for qualcomm ipq6018 pwm block
Date: Thu, 22 Jul 2021 13:08:47 +0300	[thread overview]
Message-ID: <87k0lizmmo.fsf@tarshish> (raw)
In-Reply-To: <20210716070427.kv7w6imp2zoxhyz5@pengutronix.de>

Hi Uwe,

On Fri, Jul 16 2021, Uwe Kleine-König wrote:
> On Fri, Jul 16, 2021 at 08:51:20AM +0300, Baruch Siach wrote:
>> On Wed, Jul 14 2021, Uwe Kleine-König wrote:
>> > On Tue, Jul 13, 2021 at 02:35:43PM +0300, Baruch Siach wrote:
>> >> +	val = FIELD_PREP(IPQ_PWM_REG0_HI_DURATION, hi_dur) |
>> >> +		FIELD_PREP(IPQ_PWM_REG0_PWM_DIV, pwm_div);
>> >> +	ipq_pwm_reg_write(pwm, IPQ_PWM_CFG_REG0, val);
>> >> +
>> >> +	val = FIELD_PREP(IPQ_PWM_REG1_PRE_DIV, pre_div);
>> >> +	ipq_pwm_reg_write(pwm, IPQ_PWM_CFG_REG1, val);
>> >> +
>> >> +	/* Enable needs a separate write to REG1 */
>> >> +	val |= IPQ_PWM_REG1_UPDATE;
>> >
>> > Setting this bit results in the two writes above being configured
>> > atomically so that no mixed settings happen to the output, right?
>> 
>> I guess so. I have no access to hardware documentation, mind you. I
>> first tried to do only one write to REG1, but it had no effect. The
>> existence of the UPDATE bit also indicates that hardware works as you
>> suggest.
>
> I wouldn't trust HW documentation here. If you have some means to
> inspect the waveform this is easy to test. Depending on how long you can
> make the periods an LED is enough. If you start with a slower parent
> clk, a big pre_div and hi_dur = 0 the LED is supposed to be off. Then
> set hi_dur = pwm_div/2 which either make the LED blink slowly or keeps
> off. Then setting pre_div = 2 either increased the blink frequency or it
> doesn't. ...

I currently have only access to DVM to measure the PWM effect. I'll try
to do more measures when I have access to better equipment.

baruch

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -

WARNING: multiple messages have this Message-ID (diff)
From: Baruch Siach <baruch@tkos.co.il>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: linux-pwm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, Andy Gross <agross@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Kathiravan T <kathirav@codeaurora.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	kernel@pengutronix.de, Robert Marko <robert.marko@sartura.hr>,
	Lee Jones <lee.jones@linaro.org>,
	linux-arm-kernel@lists.infradead.org,
	Balaji Prakash J <bjagadee@codeaurora.org>
Subject: Re: [PATCH v5 2/4] pwm: driver for qualcomm ipq6018 pwm block
Date: Thu, 22 Jul 2021 13:08:47 +0300	[thread overview]
Message-ID: <87k0lizmmo.fsf@tarshish> (raw)
In-Reply-To: <20210716070427.kv7w6imp2zoxhyz5@pengutronix.de>

Hi Uwe,

On Fri, Jul 16 2021, Uwe Kleine-König wrote:
> On Fri, Jul 16, 2021 at 08:51:20AM +0300, Baruch Siach wrote:
>> On Wed, Jul 14 2021, Uwe Kleine-König wrote:
>> > On Tue, Jul 13, 2021 at 02:35:43PM +0300, Baruch Siach wrote:
>> >> +	val = FIELD_PREP(IPQ_PWM_REG0_HI_DURATION, hi_dur) |
>> >> +		FIELD_PREP(IPQ_PWM_REG0_PWM_DIV, pwm_div);
>> >> +	ipq_pwm_reg_write(pwm, IPQ_PWM_CFG_REG0, val);
>> >> +
>> >> +	val = FIELD_PREP(IPQ_PWM_REG1_PRE_DIV, pre_div);
>> >> +	ipq_pwm_reg_write(pwm, IPQ_PWM_CFG_REG1, val);
>> >> +
>> >> +	/* Enable needs a separate write to REG1 */
>> >> +	val |= IPQ_PWM_REG1_UPDATE;
>> >
>> > Setting this bit results in the two writes above being configured
>> > atomically so that no mixed settings happen to the output, right?
>> 
>> I guess so. I have no access to hardware documentation, mind you. I
>> first tried to do only one write to REG1, but it had no effect. The
>> existence of the UPDATE bit also indicates that hardware works as you
>> suggest.
>
> I wouldn't trust HW documentation here. If you have some means to
> inspect the waveform this is easy to test. Depending on how long you can
> make the periods an LED is enough. If you start with a slower parent
> clk, a big pre_div and hi_dur = 0 the LED is supposed to be off. Then
> set hi_dur = pwm_div/2 which either make the LED blink slowly or keeps
> off. Then setting pre_div = 2 either increased the blink frequency or it
> doesn't. ...

I currently have only access to DVM to measure the PWM effect. I'll try
to do more measures when I have access to better equipment.

baruch

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-07-22 10:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-13 11:35 [PATCH v5 1/4] arm64: dts: ipq6018: correct TCSR block area Baruch Siach
2021-07-13 11:35 ` Baruch Siach
2021-07-13 11:35 ` [PATCH v5 2/4] pwm: driver for qualcomm ipq6018 pwm block Baruch Siach
2021-07-13 11:35   ` Baruch Siach
2021-07-13 18:07   ` kernel test robot
2021-07-13 21:26   ` kernel test robot
2021-07-14 20:18   ` Uwe Kleine-König
2021-07-14 20:18     ` Uwe Kleine-König
2021-07-16  5:51     ` Baruch Siach
2021-07-16  5:51       ` Baruch Siach
2021-07-16  7:04       ` Uwe Kleine-König
2021-07-16  7:04         ` Uwe Kleine-König
2021-07-22 10:08         ` Baruch Siach [this message]
2021-07-22 10:08           ` Baruch Siach
2021-07-13 11:35 ` [PATCH v5 3/4] dt-bindings: pwm: add IPQ6018 binding Baruch Siach
2021-07-13 11:35   ` Baruch Siach
2021-07-14  2:40   ` Rob Herring
2021-07-14  2:40     ` Rob Herring
2021-07-13 11:35 ` [PATCH v5 4/4] arm64: dts: ipq6018: add pwm node Baruch Siach
2021-07-13 11:35   ` Baruch Siach
2021-07-14 16:13 ` [PATCH v5 1/4] arm64: dts: ipq6018: correct TCSR block area Kathiravan T

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=87k0lizmmo.fsf@tarshish \
    --to=baruch@tkos.co.il \
    --cc=agross@kernel.org \
    --cc=bjagadee@codeaurora.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=kathirav@codeaurora.org \
    --cc=kernel@pengutronix.de \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=robert.marko@sartura.hr \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.