History

pwm: lpss: Clarify the bypass member semantics in struct pwm_lpss_boardinfo

Instead of an odd comment, cite the documentation, which says more clearly what's going on with the programming flow on some of the Intel SoCs.

Andy Shevchenko committed 1 year ago

Commit 6edf3151 parent a1e062a1 file · +30 −3Browse files

Unified · Split

include/linux/platform_data/x86/pwm-lpss.h+30−3
@@ -15,9 +15,36 @@ struct pwm_lpss_boardinfo { · 14 unmodified lines
1515 unsigned int npwm;
1616 unsigned long base_unit_bits;
1717 /*
18− * Some versions of the IP may stuck in the state machine if enable
19− * bit is not set, and hence update bit will show busy status till
20− * the reset. For the rest it may be otherwise.
18+ * NOTE:
19+ * Intel Broxton, Apollo Lake, and Gemini Lake have different programming flow.
20+ *
21+ * Initial Enable or First Activation
22+ * 1. Program the base unit and on time divisor values.
23+ * 2. Set the software update bit.
24+ * 3. Poll in a loop on the PWMCTRL bit until software update bit is cleared.+
25+ * 4. Enable the PWM output by setting PWM Enable.
26+ * 5. Repeat the above steps for the next PWM Module.
27+ *
28+ * Dynamic update while PWM is Enabled
29+ * 1. Program the base unit and on-time divisor values.
30+ * 2. Set the software update bit.
31+ * 3. Repeat the above steps for the next PWM module.
32+ *
33+ * + After setting PWMCTRL register's SW update bit, hardware automatically
34+ * deasserts the SW update bit after a brief delay. It was observed that
35+ * setting of PWM enable is typically done via read-modify-write of the PWMCTRL
36+ * register. If there is no/little delay between setting software update bit
37+ * and setting enable bit via read-modify-write, it is possible that the read
38+ * could return with software enable as 1. In that case, the last write to set
39+ * enable to 1 could also set sw_update to 1. If this happens, sw_update gets
40+ * stuck and the driver code can hang as it explicitly waits for sw_update bit
41+ * to be 0 after setting the enable bit to 1. To avoid this race condition,
42+ * SW should poll on the software update bit to make sure that it is 0 before
43+ * doing the read-modify-write to set the enable bit to 1.
44+ *
45+ * Also, we noted that if sw_update bit was set in step #1 above then when it
46+ * is set again in step #2, sw_update bit never gets cleared and the flow hangs.
47+ * As such, we need to make sure that sw_update bit is 0 when doing step #1.
2148 */
2249 bool bypass;
2350 /*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t