Skip to contentSkip to conversation

Add i.MX7ULP EVK PWM backlight support

PATCH RESEND Superseded Anson Huang 2 participants 9 messages Mar 19, 2019

Subsystems (4)

v6 of 12 Superseded Latest is v12 →

lore
Share & tools
lore
#0 lore raw

v6 cover Add i.MX7ULP EVK PWM backlight support

i.MX7ULP EVK board has MIPI-DSI display, its backlight is supplied by TPM PWM module, this patch set enables i.MX7ULP TPM PWM driver support and also add backlight support for MIPI-DSI display.

Anson Huang (5):
dt-bindings: pwm: Add i.MX TPM PWM binding
pwm: Add i.MX TPM PWM driver support
ARM: imx_v6_v7_defconfig: Add TPM PWM support by default
ARM: dts: imx7ulp: Add pwm0 support
ARM: dts: imx7ulp-evk: Add backlight support

 .../devicetree/bindings/pwm/imx-tpm-pwm.txt        |  19 +
 arch/arm/boot/dts/imx7ulp-evk.dts                  |  20 +
 arch/arm/boot/dts/imx7ulp.dtsi                     |  10 +
 arch/arm/configs/imx_v6_v7_defconfig               |   1 +
 drivers/pwm/Kconfig                                |  11 +
 drivers/pwm/Makefile                               |   1 +
 drivers/pwm/pwm-imx-tpm.c                          | 436 +++++++++++++++++++++
 7 files changed, 498 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pwm/imx-tpm-pwm.txt
 create mode 100644 drivers/pwm/pwm-imx-tpm.c
Signature · 1 line
2.7.4
#1 lore raw

PATCH RESEND v6 1/5 dt-bindings: pwm: Add i.MX TPM PWM binding

Add i.MX TPM(Low Power Timer/Pulse Width Modulation Module) PWM binding.

---
Changes since V5:
- improve compatible string;
- change #pwm-cells to 3;
- "pwm" -> "PWM";

---
 .../devicetree/bindings/pwm/imx-tpm-pwm.txt        | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pwm/imx-tpm-pwm.txt
Documentation/devicetree/bindings/pwm/imx-tpm-pwm.txt new file +22 -0
new file mode 100644
index 0000000..94f1ad5
@@ -0,0 +1,22 @@
+Freescale i.MX TPM PWM controller
+
+Required properties:
+- compatible : Should be "fsl,imx-tpm".
+- reg: Physical base address and length of the controller's registers.
+- #pwm-cells: Should be 3. See pwm.txt in this directory for a description of the cells format.
+- clocks : The clock provided by the SoC to drive the PWM.
+- interrupts: The interrupt for the PWM controller.
+
+Note: The TPM counter and period counter are shared between multiple channels, so all channels
+should use same period setting.
+
+Example:
+
+pwm0: tpm@40250000 {
+	compatible = "fsl,imx-tpm";
+	reg = <0x40250000 0x1000>;
+	assigned-clocks = <&clks IMX7ULP_CLK_LPTPM4>;
+	assigned-clock-parents = <&clks IMX7ULP_CLK_SOSC_BUS_CLK>;
+	clocks = <&clks IMX7ULP_CLK_LPTPM4>;
+	#pwm-cells = <3>;
+};
Signature · 1 line
2.7.4
#2 lore raw

PATCH RESEND v6 2/5 pwm: Add i.MX TPM PWM driver support

In reply to Anson Huang

i.MX7ULP has TPM(Low Power Timer/Pulse Width Modulation Module) inside, it can support multiple PWM channels, all the channels share same counter and period setting, but each channel can configure its duty and polarity independently.

There are several TPM modules in i.MX7ULP, the number of channels in TPM modules are different, it can be read from each TPM module's PARAM register.

---
Changes since V5:
- improve commit message body;
- add period round function;
- use per channel data for saving channel's private data;
- improve error message output during probe;
- improve different period settings by different channels' handling;
- support #pwm-cells 3 cases.

---
 drivers/pwm/Kconfig       |  11 ++
 drivers/pwm/Makefile      |   1 +
 drivers/pwm/pwm-imx-tpm.c | 463 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 475 insertions(+)
 create mode 100644 drivers/pwm/pwm-imx-tpm.c
drivers/pwm/Kconfig +11 -0
index 54f8238..3ea0391 100644
@@ -210,6 +210,17 @@ config PWM_IMX27
 	  To compile this driver as a module, choose M here: the module
 	  will be called pwm-imx27.
 
+config PWM_IMX_TPM
+	tristate "i.MX TPM PWM support"
+	depends on ARCH_MXC || COMPILE_TEST
+	depends on HAVE_CLK && HAS_IOMEM
+	help
+	  Generic PWM framework driver for i.MX7ULP TPM module, TPM's full
+	  name is Low Power Timer/Pulse Width Modulation Module.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called pwm-imx-tpm.
+
 config PWM_JZ4740
 	tristate "Ingenic JZ47xx PWM support"
 	depends on MACH_INGENIC
drivers/pwm/Makefile +1 -0
index 448825e..c368599 100644
@@ -19,6 +19,7 @@ obj-$(CONFIG_PWM_HIBVT)		+= pwm-hibvt.o
 obj-$(CONFIG_PWM_IMG)		+= pwm-img.o
 obj-$(CONFIG_PWM_IMX1)		+= pwm-imx1.o
 obj-$(CONFIG_PWM_IMX27)		+= pwm-imx27.o
+obj-$(CONFIG_PWM_IMX_TPM)	+= pwm-imx-tpm.o
 obj-$(CONFIG_PWM_JZ4740)	+= pwm-jz4740.o
 obj-$(CONFIG_PWM_LP3943)	+= pwm-lp3943.o
 obj-$(CONFIG_PWM_LPC18XX_SCT)	+= pwm-lpc18xx-sct.o
drivers/pwm/pwm-imx-tpm.c new file +463 -0

463 lines not on this page · raw message

Signature · 1 line
2.7.4
#3 lore raw

PATCH RESEND v6 3/5 ARM: imx_v6_v7_defconfig: Add TPM PWM support by default

In reply to Anson Huang

Select CONFIG_PWM_IMX_TPM by default to support i.MX7ULP TPM PWM.

---
No changes.

---
 arch/arm/configs/imx_v6_v7_defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/configs/imx_v6_v7_defconfig +1 -0
index 5586a50..57862c6 100644
@@ -399,6 +399,7 @@ CONFIG_MPL3115=y
 CONFIG_PWM=y
 CONFIG_PWM_FSL_FTM=y
 CONFIG_PWM_IMX=y
+CONFIG_PWM_IMX_TPM=y
 CONFIG_NVMEM_IMX_OCOTP=y
 CONFIG_NVMEM_VF610_OCOTP=y
 CONFIG_TEE=y
Signature · 1 line
2.7.4
#4 lore raw

PATCH RESEND v6 4/5 ARM: dts: imx7ulp: Add pwm0 support

In reply to Anson Huang

Add i.MX7ULP EVK board PWM0 support.

---
Changes since V5:
- change #pwm-cells to 3.

---
 arch/arm/boot/dts/imx7ulp.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/boot/dts/imx7ulp.dtsi +10 -0
index eb349fd..15d04fb 100644
@@ -124,6 +124,16 @@
 			status = "disabled";
 		};
 
+		pwm0: pwm@40250000 {
+			compatible = "fsl,imx-tpm";
+			reg = <0x40250000 0x1000>;
+			assigned-clocks = <&pcc2 IMX7ULP_CLK_LPTPM4>;
+			assigned-clock-parents = <&scg1 IMX7ULP_CLK_SOSC_BUS_CLK>;
+			clocks = <&pcc2 IMX7ULP_CLK_LPTPM4>;
+			#pwm-cells = <3>;
+			status = "disabled";
+		};
+
 		tpm5: tpm@40260000 {
 			compatible = "fsl,imx7ulp-tpm";
 			reg = <0x40260000 0x1000>;
Signature · 1 line
2.7.4
#5 lore raw

PATCH RESEND v6 5/5 ARM: dts: imx7ulp-evk: Add backlight support

In reply to Anson Huang

This patch adds i.MX7ULP EVK board MIPI-DSI backlight support.

---
Changes since V5:
- change #pwm-cells to 3, add polarity settings.

---
 arch/arm/boot/dts/imx7ulp-evk.dts | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
arch/arm/boot/dts/imx7ulp-evk.dts +21 -0
index a09026a..7c44ffa 100644
@@ -8,6 +8,7 @@
 /dts-v1/;
 
 #include "imx7ulp.dtsi"
+#include <dt-bindings/pwm/pwm.h>
 
 / {
 	model = "NXP i.MX7ULP EVK";
@@ -22,6 +23,14 @@
 		reg = <0x60000000 0x40000000>;
 	};
 
+	backlight {
+		compatible = "pwm-backlight";
+		pwms = <&pwm0 1 50000 0>;
+		brightness-levels = <0 20 25 30 35 40 100>;
+		default-brightness-level = <6>;
+		status = "okay";
+	};
+
 	reg_vsd_3v3: regulator-vsd-3v3 {
 		compatible = "regulator-fixed";
 		regulator-name = "VSD_3V3";
@@ -40,6 +49,12 @@
 	status = "okay";
 };
 
+&pwm0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_pwm0>;
+	status = "okay";
+};
+
 &usdhc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_usdhc0>;
@@ -57,6 +72,12 @@
 		bias-pull-up;
 	};
 
+	pinctrl_pwm0: pwm0grp {
+		fsl,pins = <
+			IMX7ULP_PAD_PTF2__TPM4_CH1	0x2
+		>;
+	};
+
 	pinctrl_usdhc0: usdhc0grp {
 		fsl,pins = <
 			IMX7ULP_PAD_PTD1__SDHC0_CMD	0x43
Signature · 1 line
2.7.4
#6 lore raw
In reply to Anson Huang
Quoted 3 lines · Anson Huang

i.MX7ULP EVK board has MIPI-DSI display, its backlight is supplied by TPM PWM module, this patch set enables i.MX7ULP TPM PWM driver support and also add backlight support for MIPI-DSI display.

Given that you actually changed something compared to v6, this is not a resend but v7. Also I suggest to practise a bit of patience before sending out a new revision to prevent people still looking at the previous round. I just gave feedback to the original v6 which you obviously didn't address :-|

Also a highlevel changelog for the series (here something like: "Properly separate dt changes into soc-specific and machine-specific changes") is helpful.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#7 lore raw

Hi,

Best Regards!
Anson Huang

Quoted 21 lines

-----Original Message-----
From: Uwe Kleine-König [mailto:[email protected]]
Sent: 2019年3月19日 16:15
To: Anson Huang <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Leonard Crestez <[email protected]>; [email protected]; [email protected]; Robin Gong <[email protected]>; [email protected]; [email protected]; [email protected]; linux- [email protected]; dl-linux-imx <[email protected]>
Subject: Re: [PATCH RESEND V6 0/5] Add i.MX7ULP EVK PWM backlight support

Quoted 2 lines · Anson Huang

i.MX7ULP EVK board has MIPI-DSI display, its backlight is supplied by TPM PWM module, this patch set enables i.MX7ULP TPM PWM driver

support

Quoted 1 line

and also add backlight support for MIPI-DSI display.

Quoted 8 lines

Given that you actually changed something compared to v6, this is not a resend but v7. Also I suggest to practise a bit of patience before sending out a new revision to prevent people still looking at the previous round. I just gave feedback to the original v6 which you obviously didn't address :-|

Also a highlevel changelog for the series (here something like: "Properly separate dt changes into soc-specific and machine-specific changes") is helpful.

OK, will pay attention to that, the resend is just because the patch content is NOT Changed, just re-organize the DT patch.

Also, I understand that sending the patch version too quickly will result in too many Patch version in this thread, but I just want to address the comments ASAP when I Have time, hope that does NOT bother reviewer too much...

Thanks for your patience!
Anson.

Quoted 4 lines

Best regards
Uwe

Quoted 8 lines

--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions |
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.p
engutronix.de%2F&amp;data=02%7C01%7Canson.huang%40nxp.com%7C4f1 ff94e2e2a44199d3808d6ac42f916%7C686ea1d3bc2b4c6fa92cd99c5c301635% 7C0%7C0%7C636885800978790824&amp;sdata=p%2FK3suruuBFRPnW8nZ%2 BFZplV2r0i22N6Jq4Hi7DBwp4%3D&amp;reserved=0 |

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#8 lore raw
Quoted 35 lines · Anson Huang

Hi,

Best Regards!
Anson Huang

Quoted 21 lines

-----Original Message-----
From: Uwe Kleine-König [mailto:[email protected]]
Sent: 2019年3月19日 16:15
To: Anson Huang <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Leonard Crestez <[email protected]>; [email protected]; [email protected]; Robin Gong <[email protected]>; [email protected]; [email protected]; [email protected]; linux- [email protected]; dl-linux-imx <[email protected]>
Subject: Re: [PATCH RESEND V6 0/5] Add i.MX7ULP EVK PWM backlight support

Quoted 2 lines · Anson Huang

i.MX7ULP EVK board has MIPI-DSI display, its backlight is supplied by TPM PWM module, this patch set enables i.MX7ULP TPM PWM driver

support

Quoted 1 line

and also add backlight support for MIPI-DSI display.

Quoted 8 lines

Given that you actually changed something compared to v6, this is not a resend but v7. Also I suggest to practise a bit of patience before sending out a new revision to prevent people still looking at the previous round. I just gave feedback to the original v6 which you obviously didn't address :-|

Also a highlevel changelog for the series (here something like: "Properly separate dt changes into soc-specific and machine-specific changes") is helpful.

Quoted 6 lines

OK, will pay attention to that, the resend is just because the patch content is NOT Changed, just re-organize the DT patch.

Also, I understand that sending the patch version too quickly will result in too many Patch version in this thread, but I just want to address the comments ASAP when I Have time, hope that does NOT bother reviewer too much...

A middle way is to provide a git-tree somewhere and in reply to a review just say: I updated the patches according to your feedback, but will wait a bit more for further feedback before resending. If you're interested the current work in progress can be found at git://... in the xyz branch.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |