Thread (9 messages) flat view 9 messages, 3 authors, 2021-07-22

Re: [PATCH v5 2/4] pwm: driver for qualcomm ipq6018 pwm block

From: Baruch Siach <baruch@tkos.co.il>
Date: 2021-07-22 10:09:00
Also in: linux-arm-msm, linux-devicetree, linux-pwm

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:
quoted
On Wed, Jul 14 2021, Uwe Kleine-König wrote:
quoted
On Tue, Jul 13, 2021 at 02:35:43PM +0300, Baruch Siach wrote:
quoted
+	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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help