From 41fa035ce1480aa87d42e4af0ed8ea841944c2c9 Mon Sep 17 00:00:00 2001
From: Simon Glass <sjg@chromium.org>
Date: Sat, 30 Jan 2016 16:38:00 -0700
Subject: [PATCH] tegra: Convert CONFIG_PWM_TEGRA to Kconfig

Move this option to Kconfig and clean up the header files. Adjust the only
user (the LCD driver) to work with the new driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
---
 configs/colibri_t20_defconfig | 1 +
 configs/harmony_defconfig     | 1 +
 configs/medcom-wide_defconfig | 1 +
 configs/nyan-big_defconfig    | 1 +
 configs/paz00_defconfig       | 1 +
 configs/seaboard_defconfig    | 1 +
 configs/tec_defconfig         | 1 +
 configs/ventana_defconfig     | 1 +
 drivers/pwm/Kconfig           | 8 ++++++++
 include/configs/colibri_t20.h | 1 -
 include/configs/harmony.h     | 1 -
 include/configs/medcom-wide.h | 1 -
 include/configs/nyan-big.h    | 1 -
 include/configs/paz00.h       | 1 -
 include/configs/seaboard.h    | 1 -
 include/configs/tec.h         | 1 -
 include/configs/ventana.h     | 1 -
 17 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/configs/colibri_t20_defconfig b/configs/colibri_t20_defconfig
index 84e5bc5807..e8b3e0cb14 100644
--- a/configs/colibri_t20_defconfig
+++ b/configs/colibri_t20_defconfig
@@ -14,6 +14,7 @@ CONFIG_CMD_GPIO=y
 CONFIG_DM_PMIC=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_PWM=y
+CONFIG_PWM_TEGRA=y
 CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
diff --git a/configs/harmony_defconfig b/configs/harmony_defconfig
index 8a41118be9..14125b44f3 100644
--- a/configs/harmony_defconfig
+++ b/configs/harmony_defconfig
@@ -15,6 +15,7 @@ CONFIG_CMD_GPIO=y
 CONFIG_DM_PMIC=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_PWM=y
+CONFIG_PWM_TEGRA=y
 CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
diff --git a/configs/medcom-wide_defconfig b/configs/medcom-wide_defconfig
index 7aff258480..49687cf857 100644
--- a/configs/medcom-wide_defconfig
+++ b/configs/medcom-wide_defconfig
@@ -15,6 +15,7 @@ CONFIG_CMD_GPIO=y
 CONFIG_DM_PMIC=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_PWM=y
+CONFIG_PWM_TEGRA=y
 CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
diff --git a/configs/nyan-big_defconfig b/configs/nyan-big_defconfig
index 12377bde09..1243006598 100644
--- a/configs/nyan-big_defconfig
+++ b/configs/nyan-big_defconfig
@@ -26,6 +26,7 @@ CONFIG_DM_PMIC=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_PWM=y
+CONFIG_PWM_TEGRA=y
 CONFIG_SYS_NS16550=y
 CONFIG_TEGRA114_SPI=y
 CONFIG_TPM_TIS_INFINEON=y
diff --git a/configs/paz00_defconfig b/configs/paz00_defconfig
index ea9fe444d2..546933171c 100644
--- a/configs/paz00_defconfig
+++ b/configs/paz00_defconfig
@@ -15,6 +15,7 @@ CONFIG_CMD_GPIO=y
 CONFIG_DM_PMIC=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_PWM=y
+CONFIG_PWM_TEGRA=y
 CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
diff --git a/configs/seaboard_defconfig b/configs/seaboard_defconfig
index 528707f469..7956670f25 100644
--- a/configs/seaboard_defconfig
+++ b/configs/seaboard_defconfig
@@ -15,6 +15,7 @@ CONFIG_CMD_GPIO=y
 CONFIG_DM_PMIC=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_PWM=y
+CONFIG_PWM_TEGRA=y
 CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
diff --git a/configs/tec_defconfig b/configs/tec_defconfig
index 9ba3062908..274fc9d8f8 100644
--- a/configs/tec_defconfig
+++ b/configs/tec_defconfig
@@ -15,6 +15,7 @@ CONFIG_CMD_GPIO=y
 CONFIG_DM_PMIC=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_PWM=y
+CONFIG_PWM_TEGRA=y
 CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
diff --git a/configs/ventana_defconfig b/configs/ventana_defconfig
index 08abea2be4..66c9e264ac 100644
--- a/configs/ventana_defconfig
+++ b/configs/ventana_defconfig
@@ -15,6 +15,7 @@ CONFIG_CMD_GPIO=y
 CONFIG_DM_PMIC=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_PWM=y
+CONFIG_PWM_TEGRA=y
 CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index cd8f3570f0..e5880ac84f 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -17,3 +17,11 @@ config PWM_ROCKCHIP
 	  programmable period and duty cycle. A 32-bit counter is used.
 	  Various options provided in the hardware (such as capture mode and
 	  continuous/single-shot) are not supported by the driver.
+
+config PWM_TEGRA
+	bool "Enable support for the Tegra PWM"
+	help
+	  This PWM is found on Tegra 20 and other Nvidia SoCs. It supports
+	  four channels with a programmable period and duty cycle. Only a
+	  32KHz clock is supported by the driver but the duty cycle is
+	  configurable.
diff --git a/include/configs/colibri_t20.h b/include/configs/colibri_t20.h
index 61d04b76e4..f3a1c9609b 100644
--- a/include/configs/colibri_t20.h
+++ b/include/configs/colibri_t20.h
@@ -53,7 +53,6 @@
 #define CONFIG_TFTP_TSIZE
 
 /* LCD support */
-#define CONFIG_PWM_TEGRA
 #define CONFIG_SYS_WHITE_ON_BLACK
 #define CONFIG_CONSOLE_SCROLL_LINES	10
 #define CONFIG_CMD_BMP
diff --git a/include/configs/harmony.h b/include/configs/harmony.h
index a78f7c4db9..353caec22f 100644
--- a/include/configs/harmony.h
+++ b/include/configs/harmony.h
@@ -60,7 +60,6 @@
 #define CONFIG_CMD_DHCP
 
 /* LCD support */
-#define CONFIG_PWM_TEGRA
 #define CONFIG_SYS_WHITE_ON_BLACK
 #define CONFIG_CONSOLE_SCROLL_LINES	10
 
diff --git a/include/configs/medcom-wide.h b/include/configs/medcom-wide.h
index c3e91283c7..cd89fa537b 100644
--- a/include/configs/medcom-wide.h
+++ b/include/configs/medcom-wide.h
@@ -48,7 +48,6 @@
 #define CONFIG_CMD_DHCP
 
 /* LCD support */
-#define CONFIG_PWM_TEGRA
 #define CONFIG_SYS_WHITE_ON_BLACK
 
 /* support the new (FDT-based) image format */
diff --git a/include/configs/nyan-big.h b/include/configs/nyan-big.h
index eb00f2e8da..d99d93c18b 100644
--- a/include/configs/nyan-big.h
+++ b/include/configs/nyan-big.h
@@ -38,7 +38,6 @@
 #define CONFIG_ENV_OFFSET		(-CONFIG_ENV_SIZE)
 
 /* LCD support */
-#define CONFIG_PWM_TEGRA
 #define CONFIG_AS3722_POWER
 #define CONFIG_SYS_WHITE_ON_BLACK
 #define CONFIG_CMD_BMP
diff --git a/include/configs/paz00.h b/include/configs/paz00.h
index 04ddb1b0e8..6acecb1e27 100644
--- a/include/configs/paz00.h
+++ b/include/configs/paz00.h
@@ -48,7 +48,6 @@
 #define CONFIG_CMD_DHCP
 
 /* LCD support */
-#define CONFIG_PWM_TEGRA
 #define CONFIG_SYS_WHITE_ON_BLACK
 #define CONFIG_CONSOLE_SCROLL_LINES	10
 
diff --git a/include/configs/seaboard.h b/include/configs/seaboard.h
index 01650e4f61..fb9a106da3 100644
--- a/include/configs/seaboard.h
+++ b/include/configs/seaboard.h
@@ -66,7 +66,6 @@
 #define CONFIG_USB_KEYBOARD
 
 /* LCD support */
-#define CONFIG_PWM_TEGRA
 #define CONFIG_SYS_WHITE_ON_BLACK
 #define CONFIG_CONSOLE_SCROLL_LINES	10
 
diff --git a/include/configs/tec.h b/include/configs/tec.h
index 9c2311bc34..50b9e97fe7 100644
--- a/include/configs/tec.h
+++ b/include/configs/tec.h
@@ -48,7 +48,6 @@
 #define CONFIG_CMD_DHCP
 
 /* LCD support */
-#define CONFIG_PWM_TEGRA
 #define CONFIG_SYS_WHITE_ON_BLACK
 
 /* support the new (FDT-based) image format */
diff --git a/include/configs/ventana.h b/include/configs/ventana.h
index 8d10ddebb1..7f970d011d 100644
--- a/include/configs/ventana.h
+++ b/include/configs/ventana.h
@@ -49,7 +49,6 @@
 #define CONFIG_USB_KEYBOARD
 
 /* LCD support */
-#define CONFIG_PWM_TEGRA
 #define CONFIG_SYS_WHITE_ON_BLACK
 #define CONFIG_CONSOLE_SCROLL_LINES	10
 
-- 
2.39.5