linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/8] mfd: twl-core: Rename struct twl4030_platform_data to twl_platform_data
@ 2016-03-29 19:22 Paul Kocialkowski
  2016-03-29 19:22 ` [PATCH 2/8] mfd: twl-core: Rename some non-model-specific structures, without model name Paul Kocialkowski
                   ` (7 more replies)
  0 siblings, 8 replies; 19+ messages in thread
From: Paul Kocialkowski @ 2016-03-29 19:22 UTC (permalink / raw)
  To: linux-kernel, linux-omap, linux-pm, devicetree
  Cc: Rob Herring, Tony Lindgren, Dmitry Torokhov, Sebastian Reichel,
	Dmitry Eremin-Solenikov, David Woodhouse, Paul Kocialkowski

Since twl4030_platform_data also holds platform data (e.g. regulators) for other
TWL chips, it makes sense to rename it to a non-model-specific name.

This will also allow hooking more platform data structure to it in the future.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 arch/arm/mach-omap2/board-ldp.c              |  2 +-
 arch/arm/mach-omap2/board-rx51-peripherals.c |  2 +-
 arch/arm/mach-omap2/twl-common.c             |  8 ++++----
 arch/arm/mach-omap2/twl-common.h             | 14 +++++++-------
 drivers/mfd/twl-core.c                       |  4 ++--
 include/linux/i2c/twl.h                      |  3 ++-
 6 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index d9c3ffc..b8c2e21 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -321,7 +321,7 @@ static struct regulator_init_data ldp_vpll2 = {
 	.consumer_supplies	= ldp_vpll2_supplies,
 };
 
-static struct twl4030_platform_data ldp_twldata = {
+static struct twl_platform_data ldp_twldata = {
 	/* platform_data for children goes here */
 	.vmmc1		= &ldp_vmmc1,
 	.vaux1		= &ldp_vaux1,
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index da174c0..3739bff 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -957,7 +957,7 @@ static struct twl4030_audio_data rx51_audio_data __initdata = {
 	.vibra		= &rx51_vibra_data,
 };
 
-static struct twl4030_platform_data rx51_twldata __initdata = {
+static struct twl_platform_data rx51_twldata __initdata = {
 	/* platform_data for children goes here */
 	.gpio			= &rx51_gpio_data,
 	.keypad			= &rx51_kp_data,
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index 292eca0..4e6532f 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -55,7 +55,7 @@ static int twl_get_voltage(void *data)
 
 void __init omap_pmic_init(int bus, u32 clkrate,
 			   const char *pmic_type, int pmic_irq,
-			   struct twl4030_platform_data *pmic_data)
+			   struct twl_platform_data *pmic_data)
 {
 	omap_mux_init_signal("sys_nirq", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
 	strlcpy(pmic_i2c_board_info.type, pmic_type,
@@ -68,7 +68,7 @@ void __init omap_pmic_init(int bus, u32 clkrate,
 
 #ifdef CONFIG_ARCH_OMAP4
 void __init omap4_pmic_init(const char *pmic_type,
-		    struct twl4030_platform_data *pmic_data,
+		    struct twl_platform_data *pmic_data,
 		    struct i2c_board_info *devices, int nr_devices)
 {
 	/* PMIC part*/
@@ -205,7 +205,7 @@ static struct twl_regulator_driver_data omap3_vdd2_drvdata = {
 	.set_voltage = twl_set_voltage,
 };
 
-void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
+void __init omap3_pmic_get_config(struct twl_platform_data *pmic_data,
 				  u32 pdata_flags, u32 regulators_flags)
 {
 	if (!pmic_data->vdd1) {
@@ -470,7 +470,7 @@ static struct regulator_init_data omap4_v2v1_idata = {
 	.consumer_supplies	= omap4_v2v1_supply,
 };
 
-void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data,
+void __init omap4_pmic_get_config(struct twl_platform_data *pmic_data,
 				  u32 pdata_flags, u32 regulators_flags)
 {
 	if (!pmic_data->vdd1) {
diff --git a/arch/arm/mach-omap2/twl-common.h b/arch/arm/mach-omap2/twl-common.h
index 24b65d0..e7caa23 100644
--- a/arch/arm/mach-omap2/twl-common.h
+++ b/arch/arm/mach-omap2/twl-common.h
@@ -30,35 +30,35 @@
 #define TWL_COMMON_REGULATOR_VPLL2	(1 << 5)
 
 
-struct twl4030_platform_data;
+struct twl_platform_data;
 struct twl6040_platform_data;
 struct omap_tw4030_pdata;
 struct i2c_board_info;
 
 void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq,
-		    struct twl4030_platform_data *pmic_data);
+		    struct twl_platform_data *pmic_data);
 void omap_pmic_late_init(void);
 
 static inline void omap2_pmic_init(const char *pmic_type,
-				   struct twl4030_platform_data *pmic_data)
+				   struct twl_platform_data *pmic_data)
 {
 	omap_pmic_init(2, 2600, pmic_type, 7 + OMAP_INTC_START, pmic_data);
 }
 
 static inline void omap3_pmic_init(const char *pmic_type,
-				   struct twl4030_platform_data *pmic_data)
+				   struct twl_platform_data *pmic_data)
 {
 	omap_pmic_init(1, 2600, pmic_type, 7 + OMAP_INTC_START, pmic_data);
 }
 
 void omap4_pmic_init(const char *pmic_type,
-		    struct twl4030_platform_data *pmic_data,
+		    struct twl_platform_data *pmic_data,
 		    struct i2c_board_info *devices, int nr_devices);
 
-void omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
+void omap3_pmic_get_config(struct twl_platform_data *pmic_data,
 			   u32 pdata_flags, u32 regulators_flags);
 
-void omap4_pmic_get_config(struct twl4030_platform_data *pmic_data,
+void omap4_pmic_get_config(struct twl_platform_data *pmic_data,
 			   u32 pdata_flags, u32 regulators_flags);
 
 void omap_twl4030_audio_init(char *card_name, struct omap_tw4030_pdata *pdata);
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 831696e..dae52f7 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -721,7 +721,7 @@ add_regulator(int num, struct regulator_init_data *pdata,
  */
 
 static int
-add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
+add_children(struct twl_platform_data *pdata, unsigned irq_base,
 		unsigned long features)
 {
 	struct device	*child;
@@ -1083,7 +1083,7 @@ static struct of_dev_auxdata twl_auxdata_lookup[] = {
 static int
 twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
 {
-	struct twl4030_platform_data	*pdata = dev_get_platdata(&client->dev);
+	struct twl_platform_data	*pdata = dev_get_platdata(&client->dev);
 	struct device_node		*node = client->dev.of_node;
 	struct platform_device		*pdev;
 	const struct regmap_config	*twl_regmap_config;
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 9ad7828..27bea30 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -704,7 +704,8 @@ struct twl4030_audio_data {
 	unsigned int irq_base;
 };
 
-struct twl4030_platform_data {
+struct twl_platform_data {
+	/* TWL4030 platform data */
 	struct twl4030_clock_init_data		*clock;
 	struct twl4030_bci_platform_data	*bci;
 	struct twl4030_gpio_platform_data	*gpio;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 2/8] mfd: twl-core: Rename some non-model-specific structures, without model name
  2016-03-29 19:22 [PATCH 1/8] mfd: twl-core: Rename struct twl4030_platform_data to twl_platform_data Paul Kocialkowski
@ 2016-03-29 19:22 ` Paul Kocialkowski
  2016-03-30 15:31   ` Grygorii Strashko
  2016-03-29 19:22 ` [PATCH 3/8] mfd: twl-core: Rename TWL4030_CORE Kconfig option to TWL_CORE Paul Kocialkowski
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 19+ messages in thread
From: Paul Kocialkowski @ 2016-03-29 19:22 UTC (permalink / raw)
  To: linux-kernel, linux-omap, linux-pm, devicetree
  Cc: Rob Herring, Tony Lindgren, Dmitry Torokhov, Sebastian Reichel,
	Dmitry Eremin-Solenikov, David Woodhouse, Paul Kocialkowski

Some of the structures exposed in the twl_platform_data structure are common
to various TWL chips, so it makes sense to rename them to a non-model-specific
name.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 arch/arm/mach-omap2/board-rx51-peripherals.c |  4 ++--
 arch/arm/mach-omap2/twl-common.c             |  6 +++---
 drivers/mfd/twl4030-audio.c                  |  6 +++---
 drivers/mfd/twl4030-power.c                  | 22 +++++++++++-----------
 include/linux/i2c/twl.h                      | 10 ++++++----
 5 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index 3739bff..8273439 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -942,7 +942,7 @@ static struct twl4030_resconfig twl4030_rconfig[] __initdata = {
 	{ 0, 0},
 };
 
-static struct twl4030_power_data rx51_t2scripts_data __initdata = {
+static struct twl_power_data rx51_t2scripts_data __initdata = {
 	.scripts        = twl4030_scripts,
 	.num = ARRAY_SIZE(twl4030_scripts),
 	.resource_config = twl4030_rconfig,
@@ -952,7 +952,7 @@ static struct twl4030_vibra_data rx51_vibra_data __initdata = {
 	.coexist	= 0,
 };
 
-static struct twl4030_audio_data rx51_audio_data __initdata = {
+static struct twl_audio_data rx51_audio_data __initdata = {
 	.audio_mclk	= 26000000,
 	.vibra		= &rx51_vibra_data,
 };
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index 4e6532f..6b5519e 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -122,7 +122,7 @@ static struct twl4030_madc_platform_data omap3_madc_pdata = {
 
 static struct twl4030_codec_data omap3_codec;
 
-static struct twl4030_audio_data omap3_audio_pdata = {
+static struct twl_audio_data omap3_audio_pdata = {
 	.audio_mclk = 26000000,
 	.codec = &omap3_codec,
 };
@@ -537,7 +537,7 @@ void __init omap4_pmic_get_config(struct twl_platform_data *pmic_data,
 #include <linux/platform_data/omap-twl4030.h>
 
 /* Commonly used configuration */
-static struct omap_tw4030_pdata omap_twl4030_audio_data;
+static struct omap_tw4030_pdata omap_twl_audio_data;
 
 static struct platform_device audio_device = {
 	.name		= "omap-twl4030",
@@ -548,7 +548,7 @@ void omap_twl4030_audio_init(char *card_name,
 				    struct omap_tw4030_pdata *pdata)
 {
 	if (!pdata)
-		pdata = &omap_twl4030_audio_data;
+		pdata = &omap_twl_audio_data;
 
 	pdata->card_name = card_name;
 
diff --git a/drivers/mfd/twl4030-audio.c b/drivers/mfd/twl4030-audio.c
index 0a16064..e7354f7 100644
--- a/drivers/mfd/twl4030-audio.c
+++ b/drivers/mfd/twl4030-audio.c
@@ -158,7 +158,7 @@ unsigned int twl4030_audio_get_mclk(void)
 }
 EXPORT_SYMBOL_GPL(twl4030_audio_get_mclk);
 
-static bool twl4030_audio_has_codec(struct twl4030_audio_data *pdata,
+static bool twl4030_audio_has_codec(struct twl_audio_data *pdata,
 			      struct device_node *node)
 {
 	if (pdata && pdata->codec)
@@ -170,7 +170,7 @@ static bool twl4030_audio_has_codec(struct twl4030_audio_data *pdata,
 	return false;
 }
 
-static bool twl4030_audio_has_vibra(struct twl4030_audio_data *pdata,
+static bool twl4030_audio_has_vibra(struct twl_audio_data *pdata,
 			      struct device_node *node)
 {
 	int vibra;
@@ -187,7 +187,7 @@ static bool twl4030_audio_has_vibra(struct twl4030_audio_data *pdata,
 static int twl4030_audio_probe(struct platform_device *pdev)
 {
 	struct twl4030_audio *audio;
-	struct twl4030_audio_data *pdata = dev_get_platdata(&pdev->dev);
+	struct twl_audio_data *pdata = dev_get_platdata(&pdev->dev);
 	struct device_node *node = pdev->dev.of_node;
 	struct mfd_cell *cell = NULL;
 	int ret, childs = 0;
diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
index 04b5398..b8ce270 100644
--- a/drivers/mfd/twl4030-power.c
+++ b/drivers/mfd/twl4030-power.c
@@ -265,7 +265,7 @@ out:
 }
 
 static int
-twl4030_config_wakeup12_sequence(const struct twl4030_power_data *pdata,
+twl4030_config_wakeup12_sequence(const struct twl_power_data *pdata,
 				 u8 address)
 {
 	int err = 0;
@@ -462,7 +462,7 @@ static int twl4030_configure_resource(struct twl4030_resconfig *rconfig)
 	return 0;
 }
 
-static int load_twl4030_script(const struct twl4030_power_data *pdata,
+static int load_twl4030_script(const struct twl_power_data *pdata,
 			       struct twl4030_script *tscript,
 			       u8 address)
 {
@@ -564,7 +564,7 @@ int twl4030_remove_script(u8 flags)
 }
 
 static int
-twl4030_power_configure_scripts(const struct twl4030_power_data *pdata)
+twl4030_power_configure_scripts(const struct twl_power_data *pdata)
 {
 	int err;
 	int i;
@@ -598,7 +598,7 @@ static void twl4030_patch_rconfig(struct twl4030_resconfig *common,
 }
 
 static int
-twl4030_power_configure_resources(const struct twl4030_power_data *pdata)
+twl4030_power_configure_resources(const struct twl_power_data *pdata)
 {
 	struct twl4030_resconfig *resconfig = pdata->resource_config;
 	struct twl4030_resconfig *boardconf = pdata->board_config;
@@ -677,7 +677,7 @@ void twl4030_power_off(void)
 		pr_err("TWL4030 Unable to power off\n");
 }
 
-static bool twl4030_power_use_poweroff(const struct twl4030_power_data *pdata,
+static bool twl4030_power_use_poweroff(const struct twl_power_data *pdata,
 					struct device_node *node)
 {
 	if (pdata && pdata->use_poweroff)
@@ -725,7 +725,7 @@ static struct twl4030_resconfig omap3_rconfig[] = {
 	{ 0, 0 },
 };
 
-static struct twl4030_power_data omap3_reset = {
+static struct twl_power_data omap3_reset = {
 	.scripts		= omap3_reset_scripts,
 	.num			= ARRAY_SIZE(omap3_reset_scripts),
 	.resource_config	= omap3_rconfig,
@@ -814,7 +814,7 @@ static struct twl4030_resconfig omap3_idle_rconfig[] = {
 	{ /* Terminator */ },
 };
 
-static struct twl4030_power_data omap3_idle = {
+static struct twl_power_data omap3_idle = {
 	.scripts		= omap3_idle_scripts,
 	.num			= ARRAY_SIZE(omap3_idle_scripts),
 	.resource_config	= omap3_idle_rconfig,
@@ -826,21 +826,21 @@ static struct twl4030_resconfig osc_off_rconfig[] = {
 	{ /* Terminator */ },
 };
 
-static struct twl4030_power_data osc_off_idle = {
+static struct twl_power_data osc_off_idle = {
 	.scripts		= omap3_idle_scripts,
 	.num			= ARRAY_SIZE(omap3_idle_scripts),
 	.resource_config	= omap3_idle_rconfig,
 	.board_config		= osc_off_rconfig,
 };
 
-static struct twl4030_power_data omap3_idle_ac_quirk = {
+static struct twl_power_data omap3_idle_ac_quirk = {
 	.scripts		= omap3_idle_scripts,
 	.num			= ARRAY_SIZE(omap3_idle_scripts),
 	.resource_config	= omap3_idle_rconfig,
 	.ac_charger_quirk	= true,
 };
 
-static struct twl4030_power_data omap3_idle_ac_quirk_osc_off = {
+static struct twl_power_data omap3_idle_ac_quirk_osc_off = {
 	.scripts		= omap3_idle_scripts,
 	.num			= ARRAY_SIZE(omap3_idle_scripts),
 	.resource_config	= omap3_idle_rconfig,
@@ -883,7 +883,7 @@ MODULE_DEVICE_TABLE(of, twl4030_power_of_match);
 
 static int twl4030_power_probe(struct platform_device *pdev)
 {
-	const struct twl4030_power_data *pdata = dev_get_platdata(&pdev->dev);
+	const struct twl_power_data *pdata = dev_get_platdata(&pdev->dev);
 	struct device_node *node = pdev->dev.of_node;
 	const struct of_device_id *match;
 	int err = 0;
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 27bea30..4e7ea5f 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -668,7 +668,7 @@ struct twl4030_resconfig {
 	u8 remap_sleep;	/* sleep state remapping */
 };
 
-struct twl4030_power_data {
+struct twl_power_data {
 	struct twl4030_script **scripts;
 	unsigned num;
 	struct twl4030_resconfig *resource_config;
@@ -693,7 +693,7 @@ struct twl4030_vibra_data {
 	unsigned int	coexist;
 };
 
-struct twl4030_audio_data {
+struct twl_audio_data {
 	unsigned int	audio_mclk;
 	struct twl4030_codec_data *codec;
 	struct twl4030_vibra_data *vibra;
@@ -705,6 +705,10 @@ struct twl4030_audio_data {
 };
 
 struct twl_platform_data {
+	/* Common platform data */
+	struct twl_audio_data			*audio;
+	struct twl_power_data			*power;
+
 	/* TWL4030 platform data */
 	struct twl4030_clock_init_data		*clock;
 	struct twl4030_bci_platform_data	*bci;
@@ -712,8 +716,6 @@ struct twl_platform_data {
 	struct twl4030_madc_platform_data	*madc;
 	struct twl4030_keypad_data		*keypad;
 	struct twl4030_usb_data			*usb;
-	struct twl4030_power_data		*power;
-	struct twl4030_audio_data		*audio;
 
 	/* Common LDO regulators for TWL4030/TWL6030 */
 	struct regulator_init_data		*vdac;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 3/8] mfd: twl-core: Rename TWL4030_CORE Kconfig option to TWL_CORE
  2016-03-29 19:22 [PATCH 1/8] mfd: twl-core: Rename struct twl4030_platform_data to twl_platform_data Paul Kocialkowski
  2016-03-29 19:22 ` [PATCH 2/8] mfd: twl-core: Rename some non-model-specific structures, without model name Paul Kocialkowski
@ 2016-03-29 19:22 ` Paul Kocialkowski
  2016-03-30 15:34   ` Grygorii Strashko
  2016-04-07  8:02   ` Lee Jones
  2016-03-29 19:22 ` [PATCH 4/8] mfd: Add TWL6030 power driver, with minimal support for power off Paul Kocialkowski
                   ` (5 subsequent siblings)
  7 siblings, 2 replies; 19+ messages in thread
From: Paul Kocialkowski @ 2016-03-29 19:22 UTC (permalink / raw)
  To: linux-kernel, linux-omap, linux-pm, devicetree
  Cc: Rob Herring, Tony Lindgren, Dmitry Torokhov, Sebastian Reichel,
	Dmitry Eremin-Solenikov, David Woodhouse, Paul Kocialkowski

Since the twl-core mfd driver is not limited to twl4030 support, but also
supports other chips of the TWL family, it makes sense to rename its matching
Kconfig opton to a non-model-specific name.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 arch/arm/mach-omap2/Kconfig     | 2 +-
 arch/arm/mach-omap2/Makefile    | 2 +-
 arch/arm/mach-omap2/pm.h        | 2 +-
 arch/arm/plat-omap/Kconfig      | 2 +-
 drivers/gpio/Kconfig            | 2 +-
 drivers/iio/adc/Kconfig         | 4 ++--
 drivers/input/keyboard/Kconfig  | 2 +-
 drivers/input/misc/Kconfig      | 4 ++--
 drivers/mfd/Kconfig             | 6 +++---
 drivers/mfd/Makefile            | 2 +-
 drivers/mfd/twl4030-irq.c       | 6 +++---
 drivers/phy/Kconfig             | 2 +-
 drivers/power/Kconfig           | 2 +-
 drivers/pwm/Kconfig             | 4 ++--
 drivers/regulator/Kconfig       | 2 +-
 drivers/rtc/Kconfig             | 2 +-
 drivers/usb/phy/Kconfig         | 2 +-
 drivers/video/backlight/Kconfig | 2 +-
 drivers/watchdog/Kconfig        | 2 +-
 include/linux/i2c/twl.h         | 4 ++--
 sound/soc/codecs/Kconfig        | 2 +-
 sound/soc/omap/Kconfig          | 4 ++--
 22 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 0517f0c..ada4c7a1 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -124,7 +124,7 @@ config ARCH_OMAP2PLUS_TYPICAL
 	select PM
 	select REGULATOR
 	select REGULATOR_FIXED_VOLTAGE
-	select TWL4030_CORE if ARCH_OMAP3 || ARCH_OMAP4
+	select TWL_CORE if ARCH_OMAP3 || ARCH_OMAP4
 	select TWL4030_POWER if ARCH_OMAP3 || ARCH_OMAP4
 	select VFP
 	help
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 0ba6a0e..6eb680a 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -27,7 +27,7 @@ ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),)
 obj-y += mcbsp.o
 endif
 
-obj-$(CONFIG_TWL4030_CORE) += omap_twl.o
+obj-$(CONFIG_TWL_CORE) += omap_twl.o
 obj-$(CONFIG_SOC_HAS_OMAP2_SDRC)	+= sdrc.o
 
 # SMP support ONLY available for OMAP4
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index b668719..bf4dac2 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -123,7 +123,7 @@ static inline int omap_devinit_smartreflex(void)
 static inline void omap_enable_smartreflex_on_init(void) {}
 #endif
 
-#ifdef CONFIG_TWL4030_CORE
+#ifdef CONFIG_TWL_CORE
 extern int omap3_twl_init(void);
 extern int omap4_twl_init(void);
 extern int omap3_twl_set_sr_bit(bool enable);
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index d055db3..8631a45 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -44,7 +44,7 @@ config POWER_AVS_OMAP
 
 config POWER_AVS_OMAP_CLASS3
 	bool "Class 3 mode of Smartreflex Implementation"
-	depends on POWER_AVS_OMAP && TWL4030_CORE
+	depends on POWER_AVS_OMAP && TWL_CORE
 	help
 	  Say Y to enable Class 3 implementation of Smartreflex
 
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 5f3429f..62ca9b4 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -933,7 +933,7 @@ config GPIO_TPS65912
 
 config GPIO_TWL4030
 	tristate "TWL4030, TWL5030, and TPS659x0 GPIOs"
-	depends on TWL4030_CORE
+	depends on TWL_CORE
 	help
 	  Say yes here to access the GPIO signals of various multi-function
 	  power management chips from Texas Instruments.
diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index af4aea7..3360492 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -440,7 +440,7 @@ config TI_AM335X_ADC
 
 config TWL4030_MADC
 	tristate "TWL4030 MADC (Monitoring A/D Converter)"
-	depends on TWL4030_CORE
+	depends on TWL_CORE
 	help
 	  This driver provides support for Triton TWL4030-MADC. The
 	  driver supports both RT and SW conversion methods.
@@ -450,7 +450,7 @@ config TWL4030_MADC
 
 config TWL6030_GPADC
 	tristate "TWL6030 GPADC (General Purpose A/D Converter) Support"
-	depends on TWL4030_CORE
+	depends on TWL_CORE
 	default n
 	help
 	  Say yes here if you want support for the TWL6030/TWL6032 General
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 509608c..9cfa09b 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -653,7 +653,7 @@ config KEYBOARD_TC3589X
 
 config KEYBOARD_TWL4030
 	tristate "TI TWL4030/TWL5030/TPS659x0 keypad support"
-	depends on TWL4030_CORE
+	depends on TWL_CORE
 	select INPUT_MATRIXKMAP
 	help
 	  Say Y here if your board use the keypad controller on
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 1f2337a..6abb6df 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -461,7 +461,7 @@ config INPUT_AXP20X_PEK
 
 config INPUT_TWL4030_PWRBUTTON
 	tristate "TWL4030 Power button Driver"
-	depends on TWL4030_CORE
+	depends on TWL_CORE
 	help
 	  Say Y here if you want to enable power key reporting via the
 	  TWL4030 family of chips.
@@ -471,7 +471,7 @@ config INPUT_TWL4030_PWRBUTTON
 
 config INPUT_TWL4030_VIBRA
 	tristate "Support for TWL4030 Vibrator"
-	depends on TWL4030_CORE
+	depends on TWL_CORE
 	select MFD_TWL4030_AUDIO
 	select INPUT_FF_MEMLESS
 	help
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index eea61e3..28bfe3d 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1266,7 +1266,7 @@ config MFD_TPS80031
 	  ADC, RTC, 2 PWM, System Voltage Regulator/Battery Charger with
 	  Power Path from USB, 32K clock generator.
 
-config TWL4030_CORE
+config TWL_CORE
 	bool "TI TWL4030/TWL5030/TWL6030/TPS659x0 Support"
 	depends on I2C=y
 	select IRQ_DOMAIN
@@ -1284,7 +1284,7 @@ config TWL4030_CORE
 
 config TWL4030_POWER
 	bool "TI TWL4030 power resources"
-	depends on TWL4030_CORE && ARM
+	depends on TWL_CORE && ARM
 	help
 	  Say yes here if you want to use the power resources on the
 	  TWL4030 family chips.  Most of these resources are regulators,
@@ -1297,7 +1297,7 @@ config TWL4030_POWER
 
 config MFD_TWL4030_AUDIO
 	bool "TI TWL4030 Audio"
-	depends on TWL4030_CORE
+	depends on TWL_CORE
 	select MFD_CORE
 	default n
 
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 5eaa6465d..7daeab5 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -81,7 +81,7 @@ obj-$(CONFIG_MFD_TPS65912_SPI)  += tps65912-spi.o
 obj-$(CONFIG_MFD_TPS80031)	+= tps80031.o
 obj-$(CONFIG_MENELAUS)		+= menelaus.o
 
-obj-$(CONFIG_TWL4030_CORE)	+= twl-core.o twl4030-irq.o twl6030-irq.o
+obj-$(CONFIG_TWL_CORE)	+= twl-core.o twl4030-irq.o twl6030-irq.o
 obj-$(CONFIG_TWL4030_POWER)    += twl4030-power.o
 obj-$(CONFIG_MFD_TWL4030_AUDIO)	+= twl4030-audio.o
 obj-$(CONFIG_TWL6040_CORE)	+= twl6040.o
diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c
index 40e51b0..52dc294 100644
--- a/drivers/mfd/twl4030-irq.c
+++ b/drivers/mfd/twl4030-irq.c
@@ -54,7 +54,7 @@
  *	base + 8  .. base + 15	SIH for PWR_INT
  *	base + 16 .. base + 33	SIH for GPIO
  */
-#define TWL4030_CORE_NR_IRQS	8
+#define TWL_CORE_NR_IRQS	8
 #define TWL4030_PWR_NR_IRQS	8
 
 /* PIH register offsets */
@@ -693,7 +693,7 @@ int twl4030_init_irq(struct device *dev, int irq_num)
 	 * the hwirqs numbers are defined contiguously from 1 to 15.
 	 * Create only one domain for both.
 	 */
-	nr_irqs = TWL4030_PWR_NR_IRQS + TWL4030_CORE_NR_IRQS;
+	nr_irqs = TWL4030_PWR_NR_IRQS + TWL_CORE_NR_IRQS;
 
 	irq_base = irq_alloc_descs(-1, 0, nr_irqs, 0);
 	if (IS_ERR_VALUE(irq_base)) {
@@ -704,7 +704,7 @@ int twl4030_init_irq(struct device *dev, int irq_num)
 	irq_domain_add_legacy(node, nr_irqs, irq_base, 0,
 			      &irq_domain_simple_ops, NULL);
 
-	irq_end = irq_base + TWL4030_CORE_NR_IRQS;
+	irq_end = irq_base + TWL_CORE_NR_IRQS;
 
 	/*
 	 * Mask and clear all TWL4030 interrupts since initially we do
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 26566db..6193565 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -164,7 +164,7 @@ config TI_PIPE3
 
 config TWL4030_USB
 	tristate "TWL4030 USB Transceiver Driver"
-	depends on TWL4030_CORE && REGULATOR_TWL4030 && USB_MUSB_OMAP2PLUS
+	depends on TWL_CORE && REGULATOR_TWL4030 && USB_MUSB_OMAP2PLUS
 	depends on USB_SUPPORT
 	select GENERIC_PHY
 	select USB_PHY
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index 421770d..cc5fe9a 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -323,7 +323,7 @@ config CHARGER_MAX8903
 
 config CHARGER_TWL4030
 	tristate "OMAP TWL4030 BCI charger driver"
-	depends on IIO && TWL4030_CORE
+	depends on IIO && TWL_CORE
 	help
 	  Say Y here to enable support for TWL4030 Battery Charge Interface.
 
diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index c182efc..6318f19 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -413,7 +413,7 @@ config  PWM_TIPWMSS
 
 config PWM_TWL
 	tristate "TWL4030/6030 PWM support"
-	depends on TWL4030_CORE
+	depends on TWL_CORE
 	help
 	  Generic PWM framework driver for TWL4030/6030.
 
@@ -422,7 +422,7 @@ config PWM_TWL
 
 config PWM_TWL_LED
 	tristate "TWL4030/6030 PWM support for LED drivers"
-	depends on TWL4030_CORE
+	depends on TWL_CORE
 	help
 	  Generic PWM framework driver for TWL4030/6030 LED terminals.
 
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index c77dc08..b62b4b4 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -803,7 +803,7 @@ config REGULATOR_TPS80031
 
 config REGULATOR_TWL4030
 	tristate "TI TWL4030/TWL5030/TWL6030/TPS659x0 PMIC"
-	depends on TWL4030_CORE
+	depends on TWL_CORE
 	help
 	  This driver supports the voltage regulators provided by
 	  this family of companion chips.
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 3e84315..198ac54 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -462,7 +462,7 @@ config RTC_DRV_TWL92330
 
 config RTC_DRV_TWL4030
 	tristate "TI TWL4030/TWL5030/TWL6030/TPS659x0"
-	depends on TWL4030_CORE
+	depends on TWL_CORE
 	help
 	  If you say yes here you get support for the RTC on the
 	  TWL4030/TWL5030/TWL6030 family chips, used mostly with OMAP3 platforms.
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index c690474..2911b11 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -80,7 +80,7 @@ config SAMSUNG_USBPHY
 
 config TWL6030_USB
 	tristate "TWL6030 USB Transceiver Driver"
-	depends on TWL4030_CORE && OMAP_USB2 && USB_MUSB_OMAP2PLUS
+	depends on TWL_CORE && OMAP_USB2 && USB_MUSB_OMAP2PLUS
 	help
 	  Enable this to support the USB OTG transceiver on TWL6030
 	  family chips. This TWL6030 transceiver has the VBUS and ID GND
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5ffa4b4..8d6e4e0 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -412,7 +412,7 @@ config BACKLIGHT_OT200
 
 config BACKLIGHT_PANDORA
 	tristate "Backlight driver for Pandora console"
-	depends on TWL4030_CORE
+	depends on TWL_CORE
 	help
 	  If you have a Pandora console, say Y to enable the
 	  backlight driver.
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index fb94765..4b24418 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -462,7 +462,7 @@ config COH901327_WATCHDOG
 
 config TWL4030_WATCHDOG
 	tristate "TWL4030 Watchdog"
-	depends on TWL4030_CORE
+	depends on TWL_CORE
 	select WATCHDOG_CORE
 	help
 	  Support for TI TWL4030 watchdog.  Say 'Y' here to enable the
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 4e7ea5f..2decb190 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -214,7 +214,7 @@ int twl6030_interrupt_unmask(u8 bit_mask, u8 offset);
 int twl6030_interrupt_mask(u8 bit_mask, u8 offset);
 
 /* Card detect Configuration for MMC1 Controller on OMAP4 */
-#ifdef CONFIG_TWL4030_CORE
+#ifdef CONFIG_TWL_CORE
 int twl6030_mmc_card_detect_config(void);
 #else
 static inline int twl6030_mmc_card_detect_config(void)
@@ -225,7 +225,7 @@ static inline int twl6030_mmc_card_detect_config(void)
 #endif
 
 /* MMC1 Controller on OMAP4 uses Phoenix irq for Card detect */
-#ifdef CONFIG_TWL4030_CORE
+#ifdef CONFIG_TWL_CORE
 int twl6030_mmc_card_detect(struct device *dev, int slot);
 #else
 static inline int twl6030_mmc_card_detect(struct device *dev, int slot)
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 649e92a..009feb4 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -134,7 +134,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_TPA6130A2 if I2C
 	select SND_SOC_TLV320DAC33 if I2C
 	select SND_SOC_TS3A227E if I2C
-	select SND_SOC_TWL4030 if TWL4030_CORE
+	select SND_SOC_TWL4030 if TWL_CORE
 	select SND_SOC_TWL6040 if TWL6040_CORE
 	select SND_SOC_UDA134X
 	select SND_SOC_UDA1380 if I2C
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index 5185a38..49af002 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -85,7 +85,7 @@ config SND_OMAP_SOC_AM3517EVM
 
 config SND_OMAP_SOC_OMAP_TWL4030
 	tristate "SoC Audio support for TI SoC based boards with twl4030 codec"
-	depends on TWL4030_CORE && SND_OMAP_SOC
+	depends on TWL_CORE && SND_OMAP_SOC
 	select SND_OMAP_SOC_MCBSP
 	select SND_SOC_TWL4030
 	help
@@ -117,7 +117,7 @@ config SND_OMAP_SOC_OMAP_ABE_TWL6040
 
 config SND_OMAP_SOC_OMAP3_PANDORA
 	tristate "SoC Audio support for OMAP3 Pandora"
-	depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP3_PANDORA
+	depends on TWL_CORE && SND_OMAP_SOC && MACH_OMAP3_PANDORA
 	select SND_OMAP_SOC_MCBSP
 	select SND_SOC_TWL4030
 	help
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 4/8] mfd: Add TWL6030 power driver, with minimal support for power off
  2016-03-29 19:22 [PATCH 1/8] mfd: twl-core: Rename struct twl4030_platform_data to twl_platform_data Paul Kocialkowski
  2016-03-29 19:22 ` [PATCH 2/8] mfd: twl-core: Rename some non-model-specific structures, without model name Paul Kocialkowski
  2016-03-29 19:22 ` [PATCH 3/8] mfd: twl-core: Rename TWL4030_CORE Kconfig option to TWL_CORE Paul Kocialkowski
@ 2016-03-29 19:22 ` Paul Kocialkowski
  2016-03-30 15:56   ` Grygorii Strashko
  2016-03-29 19:22 ` [PATCH 5/8] ARM: OMAP2+: Only select TWL4030_POWER for OMAP3 Paul Kocialkowski
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 19+ messages in thread
From: Paul Kocialkowski @ 2016-03-29 19:22 UTC (permalink / raw)
  To: linux-kernel, linux-omap, linux-pm, devicetree
  Cc: Rob Herring, Tony Lindgren, Dmitry Torokhov, Sebastian Reichel,
	Dmitry Eremin-Solenikov, David Woodhouse, Paul Kocialkowski

This adds a TWL6030 power driver, that currently only supports powering off the
device when the TWL is used as system power controller.

This driver might be extended to support more power-related features of the
TWL6030.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 .../devicetree/bindings/mfd/twl6030-power.txt      |  31 +++++++
 drivers/mfd/Kconfig                                |  10 ++
 drivers/mfd/Makefile                               |   5 +-
 drivers/mfd/twl-core.c                             |   8 ++
 drivers/mfd/twl6030-power.c                        | 102 +++++++++++++++++++++
 5 files changed, 154 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/twl6030-power.txt
 create mode 100644 drivers/mfd/twl6030-power.c

diff --git a/Documentation/devicetree/bindings/mfd/twl6030-power.txt b/Documentation/devicetree/bindings/mfd/twl6030-power.txt
new file mode 100644
index 0000000..97600e7
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/twl6030-power.txt
@@ -0,0 +1,31 @@
+Texas Instruments TWL family (twl6030) reset and power management module
+
+For now, the binding only supports the complete shutdown of the system after
+poweroff.
+
+Required properties:
+- compatible : must be
+	"ti,twl6030-power"
+
+Optional properties:
+
+- ti,system-power-controller: This indicates that TWL6030 is the
+  power supply master of the system. With this flag, the chip will
+  initiate an ACTIVE-to-OFF or SLEEP-to-OFF transition when the
+  system poweroffs.
+
+Example:
+&i2c1 {
+	clock-frequency = <2600000>;
+
+	twl: twl@48 {
+		reg = <0x48>;
+		interrupts = <7>; /* SYS_NIRQ cascaded to intc */
+		interrupt-parent = <&intc>;
+
+		twl_power: power {
+			compatible = "ti,twl6030-power";
+			ti,system-power-controller;
+		};
+	};
+};
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 28bfe3d..a0a8012 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1301,6 +1301,16 @@ config MFD_TWL4030_AUDIO
 	select MFD_CORE
 	default n
 
+config TWL6030_POWER
+	bool "TI TWL6030 power resources"
+	depends on TWL_CORE && ARM
+	help
+	  Say yes here if you want to use the power resources on the
+	  TWL6030 family chips.
+
+	  When used as system power controller, this driver allows turning off
+	  the main power supply.
+
 config TWL6040_CORE
 	bool "TI TWL6040 audio codec"
 	depends on I2C=y
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 7daeab5..5aa16c8 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -81,9 +81,10 @@ obj-$(CONFIG_MFD_TPS65912_SPI)  += tps65912-spi.o
 obj-$(CONFIG_MFD_TPS80031)	+= tps80031.o
 obj-$(CONFIG_MENELAUS)		+= menelaus.o
 
-obj-$(CONFIG_TWL_CORE)	+= twl-core.o twl4030-irq.o twl6030-irq.o
-obj-$(CONFIG_TWL4030_POWER)    += twl4030-power.o
+obj-$(CONFIG_TWL_CORE)		+= twl-core.o twl4030-irq.o twl6030-irq.o
+obj-$(CONFIG_TWL4030_POWER)	+= twl4030-power.o
 obj-$(CONFIG_MFD_TWL4030_AUDIO)	+= twl4030-audio.o
+obj-$(CONFIG_TWL6030_POWER)	+= twl6030-power.o
 obj-$(CONFIG_TWL6040_CORE)	+= twl6040.o
 
 obj-$(CONFIG_MFD_MX25_TSADC)	+= fsl-imx25-tsadc.o
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index dae52f7..74372bc 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -972,6 +972,14 @@ add_children(struct twl_platform_data *pdata, unsigned irq_base,
 			return PTR_ERR(child);
 	}
 
+	if (IS_ENABLED(CONFIG_TWL6030_POWER) && pdata->power) {
+		child = add_child(TWL_MODULE_PM_MASTER, "twl6030_power",
+				  pdata->power, sizeof(*pdata->power), false,
+				  0, 0);
+		if (IS_ERR(child))
+			return PTR_ERR(child);
+	}
+
 	return 0;
 }
 
diff --git a/drivers/mfd/twl6030-power.c b/drivers/mfd/twl6030-power.c
new file mode 100644
index 0000000..a0bb6d8
--- /dev/null
+++ b/drivers/mfd/twl6030-power.c
@@ -0,0 +1,102 @@
+/*
+ * TWL6030 power
+ *
+ * Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file "COPYING" in the main directory of this
+ * archive for more details.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <linux/module.h>
+#include <linux/pm.h>
+#include <linux/i2c/twl.h>
+#include <linux/platform_device.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+
+#define TWL6030_PHOENIX_DEV_ON		0x25
+
+#define TWL6030_PHOENIX_APP_DEVOFF	(1 << 0)
+#define TWL6030_PHOENIX_CON_DEVOFF	(1 << 1)
+#define TWL6030_PHOENIX_MOD_DEVOFF	(1 << 2)
+
+void twl6030_power_off(void)
+{
+	int err;
+
+	err = twl_i2c_write_u8(TWL6030_MODULE_ID0, TWL6030_PHOENIX_APP_DEVOFF |
+		TWL6030_PHOENIX_CON_DEVOFF | TWL6030_PHOENIX_MOD_DEVOFF,
+		TWL6030_PHOENIX_DEV_ON);
+	if (err)
+		pr_err("TWL6030 Unable to power off\n");
+}
+
+static bool twl6030_power_use_poweroff(const struct twl_power_data *pdata,
+	struct device_node *node)
+{
+	if (pdata && pdata->use_poweroff)
+		return true;
+
+	if (of_property_read_bool(node, "ti,system-power-controller"))
+		return true;
+
+	return false;
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id twl6030_power_of_match[] = {
+	{
+		.compatible = "ti,twl6030-power",
+	},
+	{ },
+};
+
+MODULE_DEVICE_TABLE(of, twl6030_power_of_match);
+#endif	/* CONFIG_OF */
+
+static int twl6030_power_probe(struct platform_device *pdev)
+{
+	const struct twl_power_data *pdata = dev_get_platdata(&pdev->dev);
+	struct device_node *node = pdev->dev.of_node;
+
+	if (!pdata && !node) {
+		dev_err(&pdev->dev, "Platform data is missing\n");
+		return -EINVAL;
+	}
+
+	/* Board has to be wired properly to use this feature */
+	if (twl6030_power_use_poweroff(pdata, node) && !pm_power_off)
+		pm_power_off = twl6030_power_off;
+
+	return 0;
+}
+
+static int twl6030_power_remove(struct platform_device *pdev)
+{
+	return 0;
+}
+
+static struct platform_driver twl6030_power_driver = {
+	.driver = {
+		.name	= "twl6030_power",
+		.of_match_table = of_match_ptr(twl6030_power_of_match),
+	},
+	.probe		= twl6030_power_probe,
+	.remove		= twl6030_power_remove,
+};
+
+module_platform_driver(twl6030_power_driver);
+
+MODULE_AUTHOR("Paul Kocialkowski <contact@paulk.fr>");
+MODULE_DESCRIPTION("Power management for TWL6030");
+MODULE_LICENSE("GPL");
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 5/8] ARM: OMAP2+: Only select TWL4030_POWER for OMAP3
  2016-03-29 19:22 [PATCH 1/8] mfd: twl-core: Rename struct twl4030_platform_data to twl_platform_data Paul Kocialkowski
                   ` (2 preceding siblings ...)
  2016-03-29 19:22 ` [PATCH 4/8] mfd: Add TWL6030 power driver, with minimal support for power off Paul Kocialkowski
@ 2016-03-29 19:22 ` Paul Kocialkowski
  2016-03-29 19:22 ` [PATCH 6/8] ARM: OMAP2+: Select TWL6030_POWER for OMAP4 Paul Kocialkowski
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Paul Kocialkowski @ 2016-03-29 19:22 UTC (permalink / raw)
  To: linux-kernel, linux-omap, linux-pm, devicetree
  Cc: Rob Herring, Tony Lindgren, Dmitry Torokhov, Sebastian Reichel,
	Dmitry Eremin-Solenikov, David Woodhouse, Paul Kocialkowski

The TWL4030 is generally used with the OMAP3, not with OMAP4.
The TWL6030 is generally used with the OMAP4 instead.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 arch/arm/mach-omap2/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index ada4c7a1..6ffa7f1 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -125,7 +125,7 @@ config ARCH_OMAP2PLUS_TYPICAL
 	select REGULATOR
 	select REGULATOR_FIXED_VOLTAGE
 	select TWL_CORE if ARCH_OMAP3 || ARCH_OMAP4
-	select TWL4030_POWER if ARCH_OMAP3 || ARCH_OMAP4
+	select TWL4030_POWER if ARCH_OMAP3
 	select VFP
 	help
 	  Compile a kernel suitable for booting most boards
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 6/8] ARM: OMAP2+: Select TWL6030_POWER for OMAP4
  2016-03-29 19:22 [PATCH 1/8] mfd: twl-core: Rename struct twl4030_platform_data to twl_platform_data Paul Kocialkowski
                   ` (3 preceding siblings ...)
  2016-03-29 19:22 ` [PATCH 5/8] ARM: OMAP2+: Only select TWL4030_POWER for OMAP3 Paul Kocialkowski
@ 2016-03-29 19:22 ` Paul Kocialkowski
  2016-03-29 19:22 ` [PATCH 7/8] input: misc: Add TWL6030 power button support to twl-pwrbutton Paul Kocialkowski
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Paul Kocialkowski @ 2016-03-29 19:22 UTC (permalink / raw)
  To: linux-kernel, linux-omap, linux-pm, devicetree
  Cc: Rob Herring, Tony Lindgren, Dmitry Torokhov, Sebastian Reichel,
	Dmitry Eremin-Solenikov, David Woodhouse, Paul Kocialkowski

The TWL6030 is generally used with the OMAP4.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 arch/arm/mach-omap2/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 6ffa7f1..2d67eaf 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -126,6 +126,7 @@ config ARCH_OMAP2PLUS_TYPICAL
 	select REGULATOR_FIXED_VOLTAGE
 	select TWL_CORE if ARCH_OMAP3 || ARCH_OMAP4
 	select TWL4030_POWER if ARCH_OMAP3
+	select TWL6030_POWER if ARCH_OMAP4
 	select VFP
 	help
 	  Compile a kernel suitable for booting most boards
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 7/8] input: misc: Add TWL6030 power button support to twl-pwrbutton
  2016-03-29 19:22 [PATCH 1/8] mfd: twl-core: Rename struct twl4030_platform_data to twl_platform_data Paul Kocialkowski
                   ` (4 preceding siblings ...)
  2016-03-29 19:22 ` [PATCH 6/8] ARM: OMAP2+: Select TWL6030_POWER for OMAP4 Paul Kocialkowski
@ 2016-03-29 19:22 ` Paul Kocialkowski
  2016-03-30 16:16   ` Grygorii Strashko
  2016-03-29 19:22 ` [PATCH 8/8] input: twl-pwrbutton: Rename interrupt routine for better consistency Paul Kocialkowski
  2016-03-30 15:20 ` [PATCH 1/8] mfd: twl-core: Rename struct twl4030_platform_data to twl_platform_data Grygorii Strashko
  7 siblings, 1 reply; 19+ messages in thread
From: Paul Kocialkowski @ 2016-03-29 19:22 UTC (permalink / raw)
  To: linux-kernel, linux-omap, linux-pm, devicetree
  Cc: Rob Herring, Tony Lindgren, Dmitry Torokhov, Sebastian Reichel,
	Dmitry Eremin-Solenikov, David Woodhouse, Paul Kocialkowski

This renames the twl4030-pwrbutton driver to twl-pwrbutton, since power button
handling is very similar on most TWL chips. This also introduces TWL6030 power
button support.

TWL6030 power button support requires the following additional changes:
* Devicetree binding and support
* Interrupt unmasking and remasking support

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 .../devicetree/bindings/input/twl-pwrbutton.txt    |  22 ++++
 .../bindings/input/twl4030-pwrbutton.txt           |  21 ---
 arch/arm/boot/dts/twl6030.dtsi                     |   5 +
 arch/arm/configs/omap2plus_defconfig               |   2 +-
 drivers/input/misc/Kconfig                         |   8 +-
 drivers/input/misc/Makefile                        |   2 +-
 drivers/input/misc/twl-pwrbutton.c                 | 143 +++++++++++++++++++++
 drivers/input/misc/twl4030-pwrbutton.c             | 116 -----------------
 drivers/mfd/twl-core.c                             |  12 +-
 include/linux/i2c/twl.h                            |   1 +
 10 files changed, 187 insertions(+), 145 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/input/twl-pwrbutton.txt
 delete mode 100644 Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
 create mode 100644 drivers/input/misc/twl-pwrbutton.c
 delete mode 100644 drivers/input/misc/twl4030-pwrbutton.c

diff --git a/Documentation/devicetree/bindings/input/twl-pwrbutton.txt b/Documentation/devicetree/bindings/input/twl-pwrbutton.txt
new file mode 100644
index 0000000..4931be4
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/twl-pwrbutton.txt
@@ -0,0 +1,22 @@
+Texas Instruments TWL family pwrbutton module
+
+This module is part of a TWL chip. For more details about the whole
+chip see Documentation/devicetree/bindings/mfd/twl-familly.txt.
+
+This module provides a simple power button event via an Interrupt.
+
+Required properties:
+- compatible: should be one of the following
+   - "ti,twl4030-pwrbutton": For controllers compatible with twl4030
+   - "ti,twl6030-pwrbutton": For controllers compatible with twl6030
+- interrupts: should be one of the following
+   - <8>: For controllers compatible with the twl
+
+Example:
+
+&twl {
+	twl_pwrbutton: pwrbutton {
+		compatible = "ti,twl4030-pwrbutton";
+		interrupts = <8>;
+	};
+};
diff --git a/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt b/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
deleted file mode 100644
index c864a46..0000000
--- a/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-Texas Instruments TWL family (twl4030) pwrbutton module
-
-This module is part of the TWL4030. For more details about the whole
-chip see Documentation/devicetree/bindings/mfd/twl-familly.txt.
-
-This module provides a simple power button event via an Interrupt.
-
-Required properties:
-- compatible: should be one of the following
-   - "ti,twl4030-pwrbutton": For controllers compatible with twl4030
-- interrupts: should be one of the following
-   - <8>: For controllers compatible with twl4030
-
-Example:
-
-&twl {
-	twl_pwrbutton: pwrbutton {
-		compatible = "ti,twl4030-pwrbutton";
-		interrupts = <8>;
-	};
-};
diff --git a/arch/arm/boot/dts/twl6030.dtsi b/arch/arm/boot/dts/twl6030.dtsi
index 55eb35f..6a52df1 100644
--- a/arch/arm/boot/dts/twl6030.dtsi
+++ b/arch/arm/boot/dts/twl6030.dtsi
@@ -99,4 +99,9 @@
 		compatible = "ti,twl6030-pwmled";
 		#pwm-cells = <2>;
 	};
+
+	twl_pwrbutton: pwrbutton {
+		compatible = "ti,twl6030-pwrbutton";
+		interrupts = <0>;
+	};
 };
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index 156bc88..ff9752a 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -217,7 +217,7 @@ CONFIG_TOUCHSCREEN_TSC2007=m
 CONFIG_TOUCHSCREEN_TI_AM335X_TSC=m
 CONFIG_INPUT_MISC=y
 CONFIG_INPUT_TPS65218_PWRBUTTON=m
-CONFIG_INPUT_TWL4030_PWRBUTTON=m
+CONFIG_INPUT_TWL_PWRBUTTON=m
 CONFIG_INPUT_PALMAS_PWRBUTTON=m
 CONFIG_SERIO=m
 # CONFIG_LEGACY_PTYS is not set
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 6abb6df..f643e14 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -459,15 +459,15 @@ config INPUT_AXP20X_PEK
 	  be called axp20x-pek.
 
 
-config INPUT_TWL4030_PWRBUTTON
-	tristate "TWL4030 Power button Driver"
+config INPUT_TWL_PWRBUTTON
+	tristate "TWL Power button Driver"
 	depends on TWL_CORE
 	help
 	  Say Y here if you want to enable power key reporting via the
-	  TWL4030 family of chips.
+	  TWL family of chips.
 
 	  To compile this driver as a module, choose M here. The module will
-	  be called twl4030_pwrbutton.
+	  be called twl_pwrbutton.
 
 config INPUT_TWL4030_VIBRA
 	tristate "Support for TWL4030 Vibrator"
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 0357a08..f77f5e7 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -66,7 +66,7 @@ obj-$(CONFIG_INPUT_SIRFSOC_ONKEY)	+= sirfsoc-onkey.o
 obj-$(CONFIG_INPUT_SOC_BUTTON_ARRAY)	+= soc_button_array.o
 obj-$(CONFIG_INPUT_SPARCSPKR)		+= sparcspkr.o
 obj-$(CONFIG_INPUT_TPS65218_PWRBUTTON)	+= tps65218-pwrbutton.o
-obj-$(CONFIG_INPUT_TWL4030_PWRBUTTON)	+= twl4030-pwrbutton.o
+obj-$(CONFIG_INPUT_TWL_PWRBUTTON)	+= twl-pwrbutton.o
 obj-$(CONFIG_INPUT_TWL4030_VIBRA)	+= twl4030-vibra.o
 obj-$(CONFIG_INPUT_TWL6040_VIBRA)	+= twl6040-vibra.o
 obj-$(CONFIG_INPUT_UINPUT)		+= uinput.o
diff --git a/drivers/input/misc/twl-pwrbutton.c b/drivers/input/misc/twl-pwrbutton.c
new file mode 100644
index 0000000..a7bc8ad
--- /dev/null
+++ b/drivers/input/misc/twl-pwrbutton.c
@@ -0,0 +1,143 @@
+/**
+ * twl4030-pwrbutton.c - TWL4030 Power Button Input Driver
+ *
+ * Copyright (C) 2008-2009 Nokia Corporation
+ *
+ * Written by Peter De Schrijver <peter.de-schrijver@nokia.com>
+ * Several fixes by Felipe Balbi <felipe.balbi@nokia.com>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file "COPYING" in the main directory of this
+ * archive for more details.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/i2c/twl.h>
+
+#define PWR_PWRON_IRQ (1 << 0)
+
+#define TWL4030_STS_HW_CONDITIONS 0x0f
+#define TWL6030_STS_HW_CONDITIONS 0x21
+
+static irqreturn_t powerbutton_irq(int irq, void *_pwr)
+{
+	struct input_dev *pwr = _pwr;
+	int err;
+	u8 value;
+
+	if (twl_class_is_4030())
+		err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &value,
+				TWL4030_STS_HW_CONDITIONS);
+	else
+		err = twl_i2c_read_u8(TWL6030_MODULE_ID0, &value,
+				TWL6030_STS_HW_CONDITIONS);
+
+	if (!err)  {
+		pm_wakeup_event(pwr->dev.parent, 0);
+		input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ);
+		input_sync(pwr);
+	} else {
+		dev_err(pwr->dev.parent, "twl4030: i2c error %d while reading"
+			" TWL4030 PM_MASTER STS_HW_CONDITIONS register\n", err);
+	}
+
+	return IRQ_HANDLED;
+}
+
+static int twl_pwrbutton_probe(struct platform_device *pdev)
+{
+	struct input_dev *pwr;
+	int irq = platform_get_irq(pdev, 0);
+	int err;
+
+	pwr = devm_input_allocate_device(&pdev->dev);
+	if (!pwr) {
+		dev_err(&pdev->dev, "Can't allocate power button\n");
+		return -ENOMEM;
+	}
+
+	pwr->evbit[0] = BIT_MASK(EV_KEY);
+	pwr->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);
+	pwr->name = "twl_pwrbutton";
+	pwr->phys = "twl_pwrbutton/input0";
+	pwr->dev.parent = &pdev->dev;
+
+	if (twl_class_is_6030()) {
+		twl6030_interrupt_unmask(TWL6030_PWRON_INT_MASK,
+			REG_INT_MSK_LINE_A);
+		twl6030_interrupt_unmask(TWL6030_PWRON_INT_MASK,
+			REG_INT_MSK_STS_A);
+	}
+
+	err = devm_request_threaded_irq(&pwr->dev, irq, NULL, powerbutton_irq,
+			IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING |
+			IRQF_ONESHOT,
+			"twl_pwrbutton", pwr);
+	if (err < 0) {
+		dev_err(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n", err);
+		return err;
+	}
+
+	err = input_register_device(pwr);
+	if (err) {
+		dev_err(&pdev->dev, "Can't register power button: %d\n", err);
+		return err;
+	}
+
+	platform_set_drvdata(pdev, pwr);
+	device_init_wakeup(&pdev->dev, true);
+
+	return 0;
+}
+
+static int twl_pwrbutton_remove(struct platform_device *pdev)
+{
+	if (twl_class_is_6030()) {
+		twl6030_interrupt_mask(TWL6030_PWRON_INT_MASK,
+			REG_INT_MSK_LINE_A);
+		twl6030_interrupt_mask(TWL6030_PWRON_INT_MASK,
+			REG_INT_MSK_STS_A);
+	}
+
+	return 0;
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id twl_pwrbutton_dt_match_table[] = {
+       { .compatible = "ti,twl4030-pwrbutton" },
+       { .compatible = "ti,twl6030-pwrbutton" },
+       {},
+};
+MODULE_DEVICE_TABLE(of, twl_pwrbutton_dt_match_table);
+#endif
+
+static struct platform_driver twl_pwrbutton_driver = {
+	.probe		= twl_pwrbutton_probe,
+	.remove		= twl_pwrbutton_remove,
+	.driver		= {
+		.name	= "twl_pwrbutton",
+		.of_match_table = of_match_ptr(twl_pwrbutton_dt_match_table),
+	},
+};
+module_platform_driver(twl_pwrbutton_driver);
+
+MODULE_ALIAS("platform:twl_pwrbutton");
+MODULE_DESCRIPTION("TWL Power Button");
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Peter De Schrijver <peter.de-schrijver@nokia.com>");
+MODULE_AUTHOR("Felipe Balbi <felipe.balbi@nokia.com>");
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
deleted file mode 100644
index 603fc2f..0000000
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- * twl4030-pwrbutton.c - TWL4030 Power Button Input Driver
- *
- * Copyright (C) 2008-2009 Nokia Corporation
- *
- * Written by Peter De Schrijver <peter.de-schrijver@nokia.com>
- * Several fixes by Felipe Balbi <felipe.balbi@nokia.com>
- *
- * This file is subject to the terms and conditions of the GNU General
- * Public License. See the file "COPYING" in the main directory of this
- * archive for more details.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/input.h>
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <linux/i2c/twl.h>
-
-#define PWR_PWRON_IRQ (1 << 0)
-
-#define STS_HW_CONDITIONS 0xf
-
-static irqreturn_t powerbutton_irq(int irq, void *_pwr)
-{
-	struct input_dev *pwr = _pwr;
-	int err;
-	u8 value;
-
-	err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &value, STS_HW_CONDITIONS);
-	if (!err)  {
-		pm_wakeup_event(pwr->dev.parent, 0);
-		input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ);
-		input_sync(pwr);
-	} else {
-		dev_err(pwr->dev.parent, "twl4030: i2c error %d while reading"
-			" TWL4030 PM_MASTER STS_HW_CONDITIONS register\n", err);
-	}
-
-	return IRQ_HANDLED;
-}
-
-static int twl4030_pwrbutton_probe(struct platform_device *pdev)
-{
-	struct input_dev *pwr;
-	int irq = platform_get_irq(pdev, 0);
-	int err;
-
-	pwr = devm_input_allocate_device(&pdev->dev);
-	if (!pwr) {
-		dev_err(&pdev->dev, "Can't allocate power button\n");
-		return -ENOMEM;
-	}
-
-	pwr->evbit[0] = BIT_MASK(EV_KEY);
-	pwr->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);
-	pwr->name = "twl4030_pwrbutton";
-	pwr->phys = "twl4030_pwrbutton/input0";
-	pwr->dev.parent = &pdev->dev;
-
-	err = devm_request_threaded_irq(&pwr->dev, irq, NULL, powerbutton_irq,
-			IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING |
-			IRQF_ONESHOT,
-			"twl4030_pwrbutton", pwr);
-	if (err < 0) {
-		dev_err(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n", err);
-		return err;
-	}
-
-	err = input_register_device(pwr);
-	if (err) {
-		dev_err(&pdev->dev, "Can't register power button: %d\n", err);
-		return err;
-	}
-
-	platform_set_drvdata(pdev, pwr);
-	device_init_wakeup(&pdev->dev, true);
-
-	return 0;
-}
-
-#ifdef CONFIG_OF
-static const struct of_device_id twl4030_pwrbutton_dt_match_table[] = {
-       { .compatible = "ti,twl4030-pwrbutton" },
-       {},
-};
-MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table);
-#endif
-
-static struct platform_driver twl4030_pwrbutton_driver = {
-	.probe		= twl4030_pwrbutton_probe,
-	.driver		= {
-		.name	= "twl4030_pwrbutton",
-		.of_match_table = of_match_ptr(twl4030_pwrbutton_dt_match_table),
-	},
-};
-module_platform_driver(twl4030_pwrbutton_driver);
-
-MODULE_ALIAS("platform:twl4030_pwrbutton");
-MODULE_DESCRIPTION("Triton2 Power Button");
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Peter De Schrijver <peter.de-schrijver@nokia.com>");
-MODULE_AUTHOR("Felipe Balbi <felipe.balbi@nokia.com>");
-
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 74372bc..a1bfe23 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -848,13 +848,21 @@ add_children(struct twl_platform_data *pdata, unsigned irq_base,
 			return PTR_ERR(child);
 	}
 
-	if (IS_ENABLED(CONFIG_INPUT_TWL4030_PWRBUTTON) && twl_class_is_4030()) {
-		child = add_child(TWL_MODULE_PM_MASTER, "twl4030_pwrbutton",
+	if (IS_ENABLED(CONFIG_INPUT_TWL_PWRBUTTON) && twl_class_is_4030()) {
+		child = add_child(TWL_MODULE_PM_MASTER, "twl_pwrbutton",
 				  NULL, 0, true, irq_base + 8 + 0, 0);
 		if (IS_ERR(child))
 			return PTR_ERR(child);
 	}
 
+	if (IS_ENABLED(CONFIG_INPUT_TWL_PWRBUTTON) && twl_class_is_6030()) {
+		child = add_child(TWL_MODULE_PM_MASTER, "twl_pwrbutton",
+				  NULL, 0, true, irq_base + 0, 0);
+		if (IS_ERR(child))
+			return PTR_ERR(child);
+	}
+
+
 	if (IS_ENABLED(CONFIG_MFD_TWL4030_AUDIO) && pdata->audio &&
 	    twl_class_is_4030()) {
 		child = add_child(TWL4030_MODULE_AUDIO_VOICE, "twl4030-audio",
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 2decb190..20d33b7 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -127,6 +127,7 @@ enum twl6030_module_ids {
 #define REG_INT_MSK_STS_C		0x08
 
 /* MASK INT REG GROUP A */
+#define TWL6030_PWRON_INT_MASK		0x01
 #define TWL6030_PWR_INT_MASK 		0x07
 #define TWL6030_RTC_INT_MASK 		0x18
 #define TWL6030_HOTDIE_INT_MASK 	0x20
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 8/8] input: twl-pwrbutton: Rename interrupt routine for better consistency
  2016-03-29 19:22 [PATCH 1/8] mfd: twl-core: Rename struct twl4030_platform_data to twl_platform_data Paul Kocialkowski
                   ` (5 preceding siblings ...)
  2016-03-29 19:22 ` [PATCH 7/8] input: misc: Add TWL6030 power button support to twl-pwrbutton Paul Kocialkowski
@ 2016-03-29 19:22 ` Paul Kocialkowski
  2016-03-30 15:20 ` [PATCH 1/8] mfd: twl-core: Rename struct twl4030_platform_data to twl_platform_data Grygorii Strashko
  7 siblings, 0 replies; 19+ messages in thread
From: Paul Kocialkowski @ 2016-03-29 19:22 UTC (permalink / raw)
  To: linux-kernel, linux-omap, linux-pm, devicetree
  Cc: Rob Herring, Tony Lindgren, Dmitry Torokhov, Sebastian Reichel,
	Dmitry Eremin-Solenikov, David Woodhouse, Paul Kocialkowski

This renames the twl-pwrbutton interrupt routing from powerbutton_irq to
twl_pwrbutton_irq, for better consistency with the driver name.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 drivers/input/misc/twl-pwrbutton.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/misc/twl-pwrbutton.c b/drivers/input/misc/twl-pwrbutton.c
index a7bc8ad..ced702a 100644
--- a/drivers/input/misc/twl-pwrbutton.c
+++ b/drivers/input/misc/twl-pwrbutton.c
@@ -34,7 +34,7 @@
 #define TWL4030_STS_HW_CONDITIONS 0x0f
 #define TWL6030_STS_HW_CONDITIONS 0x21
 
-static irqreturn_t powerbutton_irq(int irq, void *_pwr)
+static irqreturn_t twl_pwrbutton_irq(int irq, void *_pwr)
 {
 	struct input_dev *pwr = _pwr;
 	int err;
@@ -84,7 +84,7 @@ static int twl_pwrbutton_probe(struct platform_device *pdev)
 			REG_INT_MSK_STS_A);
 	}
 
-	err = devm_request_threaded_irq(&pwr->dev, irq, NULL, powerbutton_irq,
+	err = devm_request_threaded_irq(&pwr->dev, irq, NULL, twl_pwrbutton_irq,
 			IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING |
 			IRQF_ONESHOT,
 			"twl_pwrbutton", pwr);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/8] mfd: twl-core: Rename struct twl4030_platform_data to twl_platform_data
  2016-03-29 19:22 [PATCH 1/8] mfd: twl-core: Rename struct twl4030_platform_data to twl_platform_data Paul Kocialkowski
                   ` (6 preceding siblings ...)
  2016-03-29 19:22 ` [PATCH 8/8] input: twl-pwrbutton: Rename interrupt routine for better consistency Paul Kocialkowski
@ 2016-03-30 15:20 ` Grygorii Strashko
  2016-04-02 19:58   ` Paul Kocialkowski
  7 siblings, 1 reply; 19+ messages in thread
From: Grygorii Strashko @ 2016-03-30 15:20 UTC (permalink / raw)
  To: Paul Kocialkowski, linux-kernel, linux-omap, linux-pm, devicetree
  Cc: Rob Herring, Tony Lindgren, Dmitry Torokhov, Sebastian Reichel,
	Dmitry Eremin-Solenikov, David Woodhouse

On 03/29/2016 10:22 PM, Paul Kocialkowski wrote:
> Since twl4030_platform_data also holds platform data (e.g. regulators) for other
> TWL chips, it makes sense to rename it to a non-model-specific name.
>
> This will also allow hooking more platform data structure to it in the future.

Do we really need this patch?
In general ldb and r51 board files are going to be dropped soon and
it not expected to support this PMIC devices for non-DT use cases.
As result twl4030_platform_data will be dropped at all or made private.

>
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> ---
>   arch/arm/mach-omap2/board-ldp.c              |  2 +-
>   arch/arm/mach-omap2/board-rx51-peripherals.c |  2 +-
>   arch/arm/mach-omap2/twl-common.c             |  8 ++++----
>   arch/arm/mach-omap2/twl-common.h             | 14 +++++++-------
>   drivers/mfd/twl-core.c                       |  4 ++--
>   include/linux/i2c/twl.h                      |  3 ++-
>   6 files changed, 17 insertions(+), 16 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
> index d9c3ffc..b8c2e21 100644
> --- a/arch/arm/mach-omap2/board-ldp.c
> +++ b/arch/arm/mach-omap2/board-ldp.c
> @@ -321,7 +321,7 @@ static struct regulator_init_data ldp_vpll2 = {
>   	.consumer_supplies	= ldp_vpll2_supplies,
>   };
>
> -static struct twl4030_platform_data ldp_twldata = {
> +static struct twl_platform_data ldp_twldata = {
>   	/* platform_data for children goes here */
>   	.vmmc1		= &ldp_vmmc1,
>   	.vaux1		= &ldp_vaux1,
> diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
> index da174c0..3739bff 100644
> --- a/arch/arm/mach-omap2/board-rx51-peripherals.c
> +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
> @@ -957,7 +957,7 @@ static struct twl4030_audio_data rx51_audio_data __initdata = {
>   	.vibra		= &rx51_vibra_data,
>   };
>
> -static struct twl4030_platform_data rx51_twldata __initdata = {
> +static struct twl_platform_data rx51_twldata __initdata = {
>   	/* platform_data for children goes here */
>   	.gpio			= &rx51_gpio_data,
>   	.keypad			= &rx51_kp_data,
> diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
> index 292eca0..4e6532f 100644
> --- a/arch/arm/mach-omap2/twl-common.c
> +++ b/arch/arm/mach-omap2/twl-common.c
> @@ -55,7 +55,7 @@ static int twl_get_voltage(void *data)
>
>   void __init omap_pmic_init(int bus, u32 clkrate,
>   			   const char *pmic_type, int pmic_irq,
> -			   struct twl4030_platform_data *pmic_data)
> +			   struct twl_platform_data *pmic_data)
>   {
>   	omap_mux_init_signal("sys_nirq", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
>   	strlcpy(pmic_i2c_board_info.type, pmic_type,
> @@ -68,7 +68,7 @@ void __init omap_pmic_init(int bus, u32 clkrate,
>
>   #ifdef CONFIG_ARCH_OMAP4
>   void __init omap4_pmic_init(const char *pmic_type,
> -		    struct twl4030_platform_data *pmic_data,
> +		    struct twl_platform_data *pmic_data,
>   		    struct i2c_board_info *devices, int nr_devices)
>   {
>   	/* PMIC part*/
> @@ -205,7 +205,7 @@ static struct twl_regulator_driver_data omap3_vdd2_drvdata = {
>   	.set_voltage = twl_set_voltage,
>   };
>
> -void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
> +void __init omap3_pmic_get_config(struct twl_platform_data *pmic_data,
>   				  u32 pdata_flags, u32 regulators_flags)
>   {
>   	if (!pmic_data->vdd1) {
> @@ -470,7 +470,7 @@ static struct regulator_init_data omap4_v2v1_idata = {
>   	.consumer_supplies	= omap4_v2v1_supply,
>   };
>
> -void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data,
> +void __init omap4_pmic_get_config(struct twl_platform_data *pmic_data,
>   				  u32 pdata_flags, u32 regulators_flags)
>   {
>   	if (!pmic_data->vdd1) {
> diff --git a/arch/arm/mach-omap2/twl-common.h b/arch/arm/mach-omap2/twl-common.h
> index 24b65d0..e7caa23 100644
> --- a/arch/arm/mach-omap2/twl-common.h
> +++ b/arch/arm/mach-omap2/twl-common.h
> @@ -30,35 +30,35 @@
>   #define TWL_COMMON_REGULATOR_VPLL2	(1 << 5)
>
>
> -struct twl4030_platform_data;
> +struct twl_platform_data;
>   struct twl6040_platform_data;
>   struct omap_tw4030_pdata;
>   struct i2c_board_info;
>
>   void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq,
> -		    struct twl4030_platform_data *pmic_data);
> +		    struct twl_platform_data *pmic_data);
>   void omap_pmic_late_init(void);
>
>   static inline void omap2_pmic_init(const char *pmic_type,
> -				   struct twl4030_platform_data *pmic_data)
> +				   struct twl_platform_data *pmic_data)
>   {
>   	omap_pmic_init(2, 2600, pmic_type, 7 + OMAP_INTC_START, pmic_data);
>   }
>
>   static inline void omap3_pmic_init(const char *pmic_type,
> -				   struct twl4030_platform_data *pmic_data)
> +				   struct twl_platform_data *pmic_data)
>   {
>   	omap_pmic_init(1, 2600, pmic_type, 7 + OMAP_INTC_START, pmic_data);
>   }
>
>   void omap4_pmic_init(const char *pmic_type,
> -		    struct twl4030_platform_data *pmic_data,
> +		    struct twl_platform_data *pmic_data,
>   		    struct i2c_board_info *devices, int nr_devices);
>
> -void omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
> +void omap3_pmic_get_config(struct twl_platform_data *pmic_data,
>   			   u32 pdata_flags, u32 regulators_flags);
>
> -void omap4_pmic_get_config(struct twl4030_platform_data *pmic_data,
> +void omap4_pmic_get_config(struct twl_platform_data *pmic_data,
>   			   u32 pdata_flags, u32 regulators_flags);
>
>   void omap_twl4030_audio_init(char *card_name, struct omap_tw4030_pdata *pdata);
> diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
> index 831696e..dae52f7 100644
> --- a/drivers/mfd/twl-core.c
> +++ b/drivers/mfd/twl-core.c
> @@ -721,7 +721,7 @@ add_regulator(int num, struct regulator_init_data *pdata,
>    */
>
>   static int
> -add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
> +add_children(struct twl_platform_data *pdata, unsigned irq_base,
>   		unsigned long features)
>   {
>   	struct device	*child;
> @@ -1083,7 +1083,7 @@ static struct of_dev_auxdata twl_auxdata_lookup[] = {
>   static int
>   twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
>   {
> -	struct twl4030_platform_data	*pdata = dev_get_platdata(&client->dev);
> +	struct twl_platform_data	*pdata = dev_get_platdata(&client->dev);
>   	struct device_node		*node = client->dev.of_node;
>   	struct platform_device		*pdev;
>   	const struct regmap_config	*twl_regmap_config;
> diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
> index 9ad7828..27bea30 100644
> --- a/include/linux/i2c/twl.h
> +++ b/include/linux/i2c/twl.h
> @@ -704,7 +704,8 @@ struct twl4030_audio_data {
>   	unsigned int irq_base;
>   };
>
> -struct twl4030_platform_data {
> +struct twl_platform_data {
> +	/* TWL4030 platform data */
>   	struct twl4030_clock_init_data		*clock;
>   	struct twl4030_bci_platform_data	*bci;
>   	struct twl4030_gpio_platform_data	*gpio;
>


-- 
regards,
-grygorii

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/8] mfd: twl-core: Rename some non-model-specific structures, without model name
  2016-03-29 19:22 ` [PATCH 2/8] mfd: twl-core: Rename some non-model-specific structures, without model name Paul Kocialkowski
@ 2016-03-30 15:31   ` Grygorii Strashko
  0 siblings, 0 replies; 19+ messages in thread
From: Grygorii Strashko @ 2016-03-30 15:31 UTC (permalink / raw)
  To: Paul Kocialkowski, linux-kernel, linux-omap, linux-pm, devicetree
  Cc: Rob Herring, Tony Lindgren, Dmitry Torokhov, Sebastian Reichel,
	Dmitry Eremin-Solenikov, David Woodhouse

On 03/29/2016 10:22 PM, Paul Kocialkowski wrote:
> Some of the structures exposed in the twl_platform_data structure are common
> to various TWL chips, so it makes sense to rename them to a non-model-specific
> name.

the same comment.

>
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> ---
>   arch/arm/mach-omap2/board-rx51-peripherals.c |  4 ++--
>   arch/arm/mach-omap2/twl-common.c             |  6 +++---
>   drivers/mfd/twl4030-audio.c                  |  6 +++---
>   drivers/mfd/twl4030-power.c                  | 22 +++++++++++-----------
>   include/linux/i2c/twl.h                      | 10 ++++++----
>   5 files changed, 25 insertions(+), 23 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
> index 3739bff..8273439 100644
> --- a/arch/arm/mach-omap2/board-rx51-peripherals.c
> +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
> @@ -942,7 +942,7 @@ static struct twl4030_resconfig twl4030_rconfig[] __initdata = {
>   	{ 0, 0},
>   };
>
> -static struct twl4030_power_data rx51_t2scripts_data __initdata = {
> +static struct twl_power_data rx51_t2scripts_data __initdata = {
>   	.scripts        = twl4030_scripts,
>   	.num = ARRAY_SIZE(twl4030_scripts),
>   	.resource_config = twl4030_rconfig,
> @@ -952,7 +952,7 @@ static struct twl4030_vibra_data rx51_vibra_data __initdata = {
>   	.coexist	= 0,
>   };
>
> -static struct twl4030_audio_data rx51_audio_data __initdata = {
> +static struct twl_audio_data rx51_audio_data __initdata = {
>   	.audio_mclk	= 26000000,
>   	.vibra		= &rx51_vibra_data,
>   };
> diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
> index 4e6532f..6b5519e 100644
> --- a/arch/arm/mach-omap2/twl-common.c
> +++ b/arch/arm/mach-omap2/twl-common.c
> @@ -122,7 +122,7 @@ static struct twl4030_madc_platform_data omap3_madc_pdata = {
>
>   static struct twl4030_codec_data omap3_codec;
>
> -static struct twl4030_audio_data omap3_audio_pdata = {
> +static struct twl_audio_data omap3_audio_pdata = {
>   	.audio_mclk = 26000000,
>   	.codec = &omap3_codec,
>   };
> @@ -537,7 +537,7 @@ void __init omap4_pmic_get_config(struct twl_platform_data *pmic_data,
>   #include <linux/platform_data/omap-twl4030.h>
>
>   /* Commonly used configuration */
> -static struct omap_tw4030_pdata omap_twl4030_audio_data;
> +static struct omap_tw4030_pdata omap_twl_audio_data;
>
>   static struct platform_device audio_device = {
>   	.name		= "omap-twl4030",
> @@ -548,7 +548,7 @@ void omap_twl4030_audio_init(char *card_name,
>   				    struct omap_tw4030_pdata *pdata)
>   {
>   	if (!pdata)
> -		pdata = &omap_twl4030_audio_data;
> +		pdata = &omap_twl_audio_data;
>
>   	pdata->card_name = card_name;
>
> diff --git a/drivers/mfd/twl4030-audio.c b/drivers/mfd/twl4030-audio.c
> index 0a16064..e7354f7 100644
> --- a/drivers/mfd/twl4030-audio.c
> +++ b/drivers/mfd/twl4030-audio.c
> @@ -158,7 +158,7 @@ unsigned int twl4030_audio_get_mclk(void)
>   }
>   EXPORT_SYMBOL_GPL(twl4030_audio_get_mclk);
>
> -static bool twl4030_audio_has_codec(struct twl4030_audio_data *pdata,
> +static bool twl4030_audio_has_codec(struct twl_audio_data *pdata,
>   			      struct device_node *node)
>   {
>   	if (pdata && pdata->codec)
> @@ -170,7 +170,7 @@ static bool twl4030_audio_has_codec(struct twl4030_audio_data *pdata,
>   	return false;
>   }
>
> -static bool twl4030_audio_has_vibra(struct twl4030_audio_data *pdata,
> +static bool twl4030_audio_has_vibra(struct twl_audio_data *pdata,
>   			      struct device_node *node)
>   {
>   	int vibra;
> @@ -187,7 +187,7 @@ static bool twl4030_audio_has_vibra(struct twl4030_audio_data *pdata,
>   static int twl4030_audio_probe(struct platform_device *pdev)
>   {
>   	struct twl4030_audio *audio;
> -	struct twl4030_audio_data *pdata = dev_get_platdata(&pdev->dev);
> +	struct twl_audio_data *pdata = dev_get_platdata(&pdev->dev);
>   	struct device_node *node = pdev->dev.of_node;
>   	struct mfd_cell *cell = NULL;
>   	int ret, childs = 0;
> diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
> index 04b5398..b8ce270 100644
> --- a/drivers/mfd/twl4030-power.c
> +++ b/drivers/mfd/twl4030-power.c
> @@ -265,7 +265,7 @@ out:
>   }
>
>   static int
> -twl4030_config_wakeup12_sequence(const struct twl4030_power_data *pdata,
> +twl4030_config_wakeup12_sequence(const struct twl_power_data *pdata,
>   				 u8 address)
>   {
>   	int err = 0;
> @@ -462,7 +462,7 @@ static int twl4030_configure_resource(struct twl4030_resconfig *rconfig)
>   	return 0;
>   }
>
> -static int load_twl4030_script(const struct twl4030_power_data *pdata,
> +static int load_twl4030_script(const struct twl_power_data *pdata,
>   			       struct twl4030_script *tscript,
>   			       u8 address)
>   {
> @@ -564,7 +564,7 @@ int twl4030_remove_script(u8 flags)
>   }
>
>   static int
> -twl4030_power_configure_scripts(const struct twl4030_power_data *pdata)
> +twl4030_power_configure_scripts(const struct twl_power_data *pdata)
>   {
>   	int err;
>   	int i;
> @@ -598,7 +598,7 @@ static void twl4030_patch_rconfig(struct twl4030_resconfig *common,
>   }
>
>   static int
> -twl4030_power_configure_resources(const struct twl4030_power_data *pdata)
> +twl4030_power_configure_resources(const struct twl_power_data *pdata)
>   {
>   	struct twl4030_resconfig *resconfig = pdata->resource_config;
>   	struct twl4030_resconfig *boardconf = pdata->board_config;
> @@ -677,7 +677,7 @@ void twl4030_power_off(void)
>   		pr_err("TWL4030 Unable to power off\n");
>   }
>
> -static bool twl4030_power_use_poweroff(const struct twl4030_power_data *pdata,
> +static bool twl4030_power_use_poweroff(const struct twl_power_data *pdata,
>   					struct device_node *node)
>   {
>   	if (pdata && pdata->use_poweroff)
> @@ -725,7 +725,7 @@ static struct twl4030_resconfig omap3_rconfig[] = {
>   	{ 0, 0 },
>   };
>
> -static struct twl4030_power_data omap3_reset = {
> +static struct twl_power_data omap3_reset = {
>   	.scripts		= omap3_reset_scripts,
>   	.num			= ARRAY_SIZE(omap3_reset_scripts),
>   	.resource_config	= omap3_rconfig,
> @@ -814,7 +814,7 @@ static struct twl4030_resconfig omap3_idle_rconfig[] = {
>   	{ /* Terminator */ },
>   };
>
> -static struct twl4030_power_data omap3_idle = {
> +static struct twl_power_data omap3_idle = {
>   	.scripts		= omap3_idle_scripts,
>   	.num			= ARRAY_SIZE(omap3_idle_scripts),
>   	.resource_config	= omap3_idle_rconfig,
> @@ -826,21 +826,21 @@ static struct twl4030_resconfig osc_off_rconfig[] = {
>   	{ /* Terminator */ },
>   };
>
> -static struct twl4030_power_data osc_off_idle = {
> +static struct twl_power_data osc_off_idle = {
>   	.scripts		= omap3_idle_scripts,
>   	.num			= ARRAY_SIZE(omap3_idle_scripts),
>   	.resource_config	= omap3_idle_rconfig,
>   	.board_config		= osc_off_rconfig,
>   };
>
> -static struct twl4030_power_data omap3_idle_ac_quirk = {
> +static struct twl_power_data omap3_idle_ac_quirk = {
>   	.scripts		= omap3_idle_scripts,
>   	.num			= ARRAY_SIZE(omap3_idle_scripts),
>   	.resource_config	= omap3_idle_rconfig,
>   	.ac_charger_quirk	= true,
>   };
>
> -static struct twl4030_power_data omap3_idle_ac_quirk_osc_off = {
> +static struct twl_power_data omap3_idle_ac_quirk_osc_off = {
>   	.scripts		= omap3_idle_scripts,
>   	.num			= ARRAY_SIZE(omap3_idle_scripts),
>   	.resource_config	= omap3_idle_rconfig,
> @@ -883,7 +883,7 @@ MODULE_DEVICE_TABLE(of, twl4030_power_of_match);
>
>   static int twl4030_power_probe(struct platform_device *pdev)
>   {
> -	const struct twl4030_power_data *pdata = dev_get_platdata(&pdev->dev);
> +	const struct twl_power_data *pdata = dev_get_platdata(&pdev->dev);
>   	struct device_node *node = pdev->dev.of_node;
>   	const struct of_device_id *match;
>   	int err = 0;
> diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
> index 27bea30..4e7ea5f 100644
> --- a/include/linux/i2c/twl.h
> +++ b/include/linux/i2c/twl.h
> @@ -668,7 +668,7 @@ struct twl4030_resconfig {
>   	u8 remap_sleep;	/* sleep state remapping */
>   };
>
> -struct twl4030_power_data {
> +struct twl_power_data {
>   	struct twl4030_script **scripts;
>   	unsigned num;
>   	struct twl4030_resconfig *resource_config;
> @@ -693,7 +693,7 @@ struct twl4030_vibra_data {
>   	unsigned int	coexist;
>   };
>
> -struct twl4030_audio_data {
> +struct twl_audio_data {
>   	unsigned int	audio_mclk;
>   	struct twl4030_codec_data *codec;
>   	struct twl4030_vibra_data *vibra;
> @@ -705,6 +705,10 @@ struct twl4030_audio_data {
>   };
>
>   struct twl_platform_data {
> +	/* Common platform data */
> +	struct twl_audio_data			*audio;
> +	struct twl_power_data			*power;
> +
>   	/* TWL4030 platform data */
>   	struct twl4030_clock_init_data		*clock;
>   	struct twl4030_bci_platform_data	*bci;
> @@ -712,8 +716,6 @@ struct twl_platform_data {
>   	struct twl4030_madc_platform_data	*madc;
>   	struct twl4030_keypad_data		*keypad;
>   	struct twl4030_usb_data			*usb;
> -	struct twl4030_power_data		*power;
> -	struct twl4030_audio_data		*audio;
>
>   	/* Common LDO regulators for TWL4030/TWL6030 */
>   	struct regulator_init_data		*vdac;
>


-- 
regards,
-grygorii

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/8] mfd: twl-core: Rename TWL4030_CORE Kconfig option to TWL_CORE
  2016-03-29 19:22 ` [PATCH 3/8] mfd: twl-core: Rename TWL4030_CORE Kconfig option to TWL_CORE Paul Kocialkowski
@ 2016-03-30 15:34   ` Grygorii Strashko
  2016-04-02 20:12     ` Paul Kocialkowski
  2016-04-07  8:02   ` Lee Jones
  1 sibling, 1 reply; 19+ messages in thread
From: Grygorii Strashko @ 2016-03-30 15:34 UTC (permalink / raw)
  To: Paul Kocialkowski, linux-kernel, linux-omap, linux-pm, devicetree
  Cc: Rob Herring, Tony Lindgren, Dmitry Torokhov, Sebastian Reichel,
	Dmitry Eremin-Solenikov, David Woodhouse

On 03/29/2016 10:22 PM, Paul Kocialkowski wrote:
> Since the twl-core mfd driver is not limited to twl4030 support, but also
> supports other chips of the TWL family, it makes sense to rename its matching
> Kconfig opton to a non-model-specific name.

Personally I don't see too much reason for this, but it's up to maintainers to decide.
Regarding this patch - pls, do not mix Kconfig and code changes.

And it will be good to have cover letter.

> 
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> ---
>   arch/arm/mach-omap2/Kconfig     | 2 +-
>   arch/arm/mach-omap2/Makefile    | 2 +-
>   arch/arm/mach-omap2/pm.h        | 2 +-
>   arch/arm/plat-omap/Kconfig      | 2 +-
>   drivers/gpio/Kconfig            | 2 +-
>   drivers/iio/adc/Kconfig         | 4 ++--
>   drivers/input/keyboard/Kconfig  | 2 +-
>   drivers/input/misc/Kconfig      | 4 ++--
>   drivers/mfd/Kconfig             | 6 +++---
>   drivers/mfd/Makefile            | 2 +-
>   drivers/mfd/twl4030-irq.c       | 6 +++---
>   drivers/phy/Kconfig             | 2 +-
>   drivers/power/Kconfig           | 2 +-
>   drivers/pwm/Kconfig             | 4 ++--
>   drivers/regulator/Kconfig       | 2 +-
>   drivers/rtc/Kconfig             | 2 +-
>   drivers/usb/phy/Kconfig         | 2 +-
>   drivers/video/backlight/Kconfig | 2 +-
>   drivers/watchdog/Kconfig        | 2 +-
>   include/linux/i2c/twl.h         | 4 ++--
>   sound/soc/codecs/Kconfig        | 2 +-
>   sound/soc/omap/Kconfig          | 4 ++--
>   22 files changed, 31 insertions(+), 31 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
> index 0517f0c..ada4c7a1 100644
> --- a/arch/arm/mach-omap2/Kconfig
> +++ b/arch/arm/mach-omap2/Kconfig
> @@ -124,7 +124,7 @@ config ARCH_OMAP2PLUS_TYPICAL
>   	select PM
>   	select REGULATOR
>   	select REGULATOR_FIXED_VOLTAGE
> -	select TWL4030_CORE if ARCH_OMAP3 || ARCH_OMAP4
> +	select TWL_CORE if ARCH_OMAP3 || ARCH_OMAP4
>   	select TWL4030_POWER if ARCH_OMAP3 || ARCH_OMAP4
>   	select VFP
>   	help
> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> index 0ba6a0e..6eb680a 100644
> --- a/arch/arm/mach-omap2/Makefile
> +++ b/arch/arm/mach-omap2/Makefile
> @@ -27,7 +27,7 @@ ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),)
>   obj-y += mcbsp.o
>   endif
>   
> -obj-$(CONFIG_TWL4030_CORE) += omap_twl.o
> +obj-$(CONFIG_TWL_CORE) += omap_twl.o
>   obj-$(CONFIG_SOC_HAS_OMAP2_SDRC)	+= sdrc.o
>   
>   # SMP support ONLY available for OMAP4
> diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
> index b668719..bf4dac2 100644
> --- a/arch/arm/mach-omap2/pm.h
> +++ b/arch/arm/mach-omap2/pm.h
> @@ -123,7 +123,7 @@ static inline int omap_devinit_smartreflex(void)
>   static inline void omap_enable_smartreflex_on_init(void) {}
>   #endif
>   
> -#ifdef CONFIG_TWL4030_CORE
> +#ifdef CONFIG_TWL_CORE
>   extern int omap3_twl_init(void);
>   extern int omap4_twl_init(void);
>   extern int omap3_twl_set_sr_bit(bool enable);
> diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
> index d055db3..8631a45 100644
> --- a/arch/arm/plat-omap/Kconfig
> +++ b/arch/arm/plat-omap/Kconfig
> @@ -44,7 +44,7 @@ config POWER_AVS_OMAP
>   
>   config POWER_AVS_OMAP_CLASS3
>   	bool "Class 3 mode of Smartreflex Implementation"
> -	depends on POWER_AVS_OMAP && TWL4030_CORE
> +	depends on POWER_AVS_OMAP && TWL_CORE
>   	help
>   	  Say Y to enable Class 3 implementation of Smartreflex
>   
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index 5f3429f..62ca9b4 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -933,7 +933,7 @@ config GPIO_TPS65912
>   
>   config GPIO_TWL4030
>   	tristate "TWL4030, TWL5030, and TPS659x0 GPIOs"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>   	help
>   	  Say yes here to access the GPIO signals of various multi-function
>   	  power management chips from Texas Instruments.
> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
> index af4aea7..3360492 100644
> --- a/drivers/iio/adc/Kconfig
> +++ b/drivers/iio/adc/Kconfig
> @@ -440,7 +440,7 @@ config TI_AM335X_ADC
>   
>   config TWL4030_MADC
>   	tristate "TWL4030 MADC (Monitoring A/D Converter)"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>   	help
>   	  This driver provides support for Triton TWL4030-MADC. The
>   	  driver supports both RT and SW conversion methods.
> @@ -450,7 +450,7 @@ config TWL4030_MADC
>   
>   config TWL6030_GPADC
>   	tristate "TWL6030 GPADC (General Purpose A/D Converter) Support"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>   	default n
>   	help
>   	  Say yes here if you want support for the TWL6030/TWL6032 General
> diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
> index 509608c..9cfa09b 100644
> --- a/drivers/input/keyboard/Kconfig
> +++ b/drivers/input/keyboard/Kconfig
> @@ -653,7 +653,7 @@ config KEYBOARD_TC3589X
>   
>   config KEYBOARD_TWL4030
>   	tristate "TI TWL4030/TWL5030/TPS659x0 keypad support"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>   	select INPUT_MATRIXKMAP
>   	help
>   	  Say Y here if your board use the keypad controller on
> diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
> index 1f2337a..6abb6df 100644
> --- a/drivers/input/misc/Kconfig
> +++ b/drivers/input/misc/Kconfig
> @@ -461,7 +461,7 @@ config INPUT_AXP20X_PEK
>   
>   config INPUT_TWL4030_PWRBUTTON
>   	tristate "TWL4030 Power button Driver"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>   	help
>   	  Say Y here if you want to enable power key reporting via the
>   	  TWL4030 family of chips.
> @@ -471,7 +471,7 @@ config INPUT_TWL4030_PWRBUTTON
>   
>   config INPUT_TWL4030_VIBRA
>   	tristate "Support for TWL4030 Vibrator"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>   	select MFD_TWL4030_AUDIO
>   	select INPUT_FF_MEMLESS
>   	help
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index eea61e3..28bfe3d 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -1266,7 +1266,7 @@ config MFD_TPS80031
>   	  ADC, RTC, 2 PWM, System Voltage Regulator/Battery Charger with
>   	  Power Path from USB, 32K clock generator.
>   
> -config TWL4030_CORE
> +config TWL_CORE
>   	bool "TI TWL4030/TWL5030/TWL6030/TPS659x0 Support"
>   	depends on I2C=y
>   	select IRQ_DOMAIN
> @@ -1284,7 +1284,7 @@ config TWL4030_CORE
>   
>   config TWL4030_POWER
>   	bool "TI TWL4030 power resources"
> -	depends on TWL4030_CORE && ARM
> +	depends on TWL_CORE && ARM
>   	help
>   	  Say yes here if you want to use the power resources on the
>   	  TWL4030 family chips.  Most of these resources are regulators,
> @@ -1297,7 +1297,7 @@ config TWL4030_POWER
>   
>   config MFD_TWL4030_AUDIO
>   	bool "TI TWL4030 Audio"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>   	select MFD_CORE
>   	default n
>   
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index 5eaa6465d..7daeab5 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -81,7 +81,7 @@ obj-$(CONFIG_MFD_TPS65912_SPI)  += tps65912-spi.o
>   obj-$(CONFIG_MFD_TPS80031)	+= tps80031.o
>   obj-$(CONFIG_MENELAUS)		+= menelaus.o
>   
> -obj-$(CONFIG_TWL4030_CORE)	+= twl-core.o twl4030-irq.o twl6030-irq.o
> +obj-$(CONFIG_TWL_CORE)	+= twl-core.o twl4030-irq.o twl6030-irq.o
>   obj-$(CONFIG_TWL4030_POWER)    += twl4030-power.o
>   obj-$(CONFIG_MFD_TWL4030_AUDIO)	+= twl4030-audio.o
>   obj-$(CONFIG_TWL6040_CORE)	+= twl6040.o
> diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c
> index 40e51b0..52dc294 100644
> --- a/drivers/mfd/twl4030-irq.c
> +++ b/drivers/mfd/twl4030-irq.c
> @@ -54,7 +54,7 @@
>    *	base + 8  .. base + 15	SIH for PWR_INT
>    *	base + 16 .. base + 33	SIH for GPIO
>    */
> -#define TWL4030_CORE_NR_IRQS	8
> +#define TWL_CORE_NR_IRQS	8
>   #define TWL4030_PWR_NR_IRQS	8
>   
>   /* PIH register offsets */
> @@ -693,7 +693,7 @@ int twl4030_init_irq(struct device *dev, int irq_num)
>   	 * the hwirqs numbers are defined contiguously from 1 to 15.
>   	 * Create only one domain for both.
>   	 */
> -	nr_irqs = TWL4030_PWR_NR_IRQS + TWL4030_CORE_NR_IRQS;
> +	nr_irqs = TWL4030_PWR_NR_IRQS + TWL_CORE_NR_IRQS;
>   
>   	irq_base = irq_alloc_descs(-1, 0, nr_irqs, 0);
>   	if (IS_ERR_VALUE(irq_base)) {
> @@ -704,7 +704,7 @@ int twl4030_init_irq(struct device *dev, int irq_num)
>   	irq_domain_add_legacy(node, nr_irqs, irq_base, 0,
>   			      &irq_domain_simple_ops, NULL);
>   
> -	irq_end = irq_base + TWL4030_CORE_NR_IRQS;
> +	irq_end = irq_base + TWL_CORE_NR_IRQS;
>   
>   	/*
>   	 * Mask and clear all TWL4030 interrupts since initially we do
> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> index 26566db..6193565 100644
> --- a/drivers/phy/Kconfig
> +++ b/drivers/phy/Kconfig
> @@ -164,7 +164,7 @@ config TI_PIPE3
>   
>   config TWL4030_USB
>   	tristate "TWL4030 USB Transceiver Driver"
> -	depends on TWL4030_CORE && REGULATOR_TWL4030 && USB_MUSB_OMAP2PLUS
> +	depends on TWL_CORE && REGULATOR_TWL4030 && USB_MUSB_OMAP2PLUS
>   	depends on USB_SUPPORT
>   	select GENERIC_PHY
>   	select USB_PHY
> diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
> index 421770d..cc5fe9a 100644
> --- a/drivers/power/Kconfig
> +++ b/drivers/power/Kconfig
> @@ -323,7 +323,7 @@ config CHARGER_MAX8903
>   
>   config CHARGER_TWL4030
>   	tristate "OMAP TWL4030 BCI charger driver"
> -	depends on IIO && TWL4030_CORE
> +	depends on IIO && TWL_CORE
>   	help
>   	  Say Y here to enable support for TWL4030 Battery Charge Interface.
>   
> diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
> index c182efc..6318f19 100644
> --- a/drivers/pwm/Kconfig
> +++ b/drivers/pwm/Kconfig
> @@ -413,7 +413,7 @@ config  PWM_TIPWMSS
>   
>   config PWM_TWL
>   	tristate "TWL4030/6030 PWM support"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>   	help
>   	  Generic PWM framework driver for TWL4030/6030.
>   
> @@ -422,7 +422,7 @@ config PWM_TWL
>   
>   config PWM_TWL_LED
>   	tristate "TWL4030/6030 PWM support for LED drivers"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>   	help
>   	  Generic PWM framework driver for TWL4030/6030 LED terminals.
>   
> diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
> index c77dc08..b62b4b4 100644
> --- a/drivers/regulator/Kconfig
> +++ b/drivers/regulator/Kconfig
> @@ -803,7 +803,7 @@ config REGULATOR_TPS80031
>   
>   config REGULATOR_TWL4030
>   	tristate "TI TWL4030/TWL5030/TWL6030/TPS659x0 PMIC"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>   	help
>   	  This driver supports the voltage regulators provided by
>   	  this family of companion chips.
> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> index 3e84315..198ac54 100644
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -462,7 +462,7 @@ config RTC_DRV_TWL92330
>   
>   config RTC_DRV_TWL4030
>   	tristate "TI TWL4030/TWL5030/TWL6030/TPS659x0"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>   	help
>   	  If you say yes here you get support for the RTC on the
>   	  TWL4030/TWL5030/TWL6030 family chips, used mostly with OMAP3 platforms.
> diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
> index c690474..2911b11 100644
> --- a/drivers/usb/phy/Kconfig
> +++ b/drivers/usb/phy/Kconfig
> @@ -80,7 +80,7 @@ config SAMSUNG_USBPHY
>   
>   config TWL6030_USB
>   	tristate "TWL6030 USB Transceiver Driver"
> -	depends on TWL4030_CORE && OMAP_USB2 && USB_MUSB_OMAP2PLUS
> +	depends on TWL_CORE && OMAP_USB2 && USB_MUSB_OMAP2PLUS
>   	help
>   	  Enable this to support the USB OTG transceiver on TWL6030
>   	  family chips. This TWL6030 transceiver has the VBUS and ID GND
> diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
> index 5ffa4b4..8d6e4e0 100644
> --- a/drivers/video/backlight/Kconfig
> +++ b/drivers/video/backlight/Kconfig
> @@ -412,7 +412,7 @@ config BACKLIGHT_OT200
>   
>   config BACKLIGHT_PANDORA
>   	tristate "Backlight driver for Pandora console"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>   	help
>   	  If you have a Pandora console, say Y to enable the
>   	  backlight driver.
> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> index fb94765..4b24418 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -462,7 +462,7 @@ config COH901327_WATCHDOG
>   
>   config TWL4030_WATCHDOG
>   	tristate "TWL4030 Watchdog"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>   	select WATCHDOG_CORE
>   	help
>   	  Support for TI TWL4030 watchdog.  Say 'Y' here to enable the
> diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
> index 4e7ea5f..2decb190 100644
> --- a/include/linux/i2c/twl.h
> +++ b/include/linux/i2c/twl.h
> @@ -214,7 +214,7 @@ int twl6030_interrupt_unmask(u8 bit_mask, u8 offset);
>   int twl6030_interrupt_mask(u8 bit_mask, u8 offset);
>   
>   /* Card detect Configuration for MMC1 Controller on OMAP4 */
> -#ifdef CONFIG_TWL4030_CORE
> +#ifdef CONFIG_TWL_CORE
>   int twl6030_mmc_card_detect_config(void);
>   #else
>   static inline int twl6030_mmc_card_detect_config(void)
> @@ -225,7 +225,7 @@ static inline int twl6030_mmc_card_detect_config(void)
>   #endif
>   
>   /* MMC1 Controller on OMAP4 uses Phoenix irq for Card detect */
> -#ifdef CONFIG_TWL4030_CORE
> +#ifdef CONFIG_TWL_CORE
>   int twl6030_mmc_card_detect(struct device *dev, int slot);
>   #else
>   static inline int twl6030_mmc_card_detect(struct device *dev, int slot)
> diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
> index 649e92a..009feb4 100644
> --- a/sound/soc/codecs/Kconfig
> +++ b/sound/soc/codecs/Kconfig
> @@ -134,7 +134,7 @@ config SND_SOC_ALL_CODECS
>   	select SND_SOC_TPA6130A2 if I2C
>   	select SND_SOC_TLV320DAC33 if I2C
>   	select SND_SOC_TS3A227E if I2C
> -	select SND_SOC_TWL4030 if TWL4030_CORE
> +	select SND_SOC_TWL4030 if TWL_CORE
>   	select SND_SOC_TWL6040 if TWL6040_CORE
>   	select SND_SOC_UDA134X
>   	select SND_SOC_UDA1380 if I2C
> diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
> index 5185a38..49af002 100644
> --- a/sound/soc/omap/Kconfig
> +++ b/sound/soc/omap/Kconfig
> @@ -85,7 +85,7 @@ config SND_OMAP_SOC_AM3517EVM
>   
>   config SND_OMAP_SOC_OMAP_TWL4030
>   	tristate "SoC Audio support for TI SoC based boards with twl4030 codec"
> -	depends on TWL4030_CORE && SND_OMAP_SOC
> +	depends on TWL_CORE && SND_OMAP_SOC
>   	select SND_OMAP_SOC_MCBSP
>   	select SND_SOC_TWL4030
>   	help
> @@ -117,7 +117,7 @@ config SND_OMAP_SOC_OMAP_ABE_TWL6040
>   
>   config SND_OMAP_SOC_OMAP3_PANDORA
>   	tristate "SoC Audio support for OMAP3 Pandora"
> -	depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP3_PANDORA
> +	depends on TWL_CORE && SND_OMAP_SOC && MACH_OMAP3_PANDORA
>   	select SND_OMAP_SOC_MCBSP
>   	select SND_SOC_TWL4030
>   	help
> 


-- 
regards,
-grygorii

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 4/8] mfd: Add TWL6030 power driver, with minimal support for power off
  2016-03-29 19:22 ` [PATCH 4/8] mfd: Add TWL6030 power driver, with minimal support for power off Paul Kocialkowski
@ 2016-03-30 15:56   ` Grygorii Strashko
  2016-04-02 20:14     ` Paul Kocialkowski
  0 siblings, 1 reply; 19+ messages in thread
From: Grygorii Strashko @ 2016-03-30 15:56 UTC (permalink / raw)
  To: Paul Kocialkowski, linux-kernel, linux-omap, linux-pm, devicetree
  Cc: Rob Herring, Tony Lindgren, Dmitry Torokhov, Sebastian Reichel,
	Dmitry Eremin-Solenikov, David Woodhouse

On 03/29/2016 10:22 PM, Paul Kocialkowski wrote:
> This adds a TWL6030 power driver, that currently only supports powering off the
> device when the TWL is used as system power controller.
>
> This driver might be extended to support more power-related features of the
> TWL6030.
>
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> ---
>   .../devicetree/bindings/mfd/twl6030-power.txt      |  31 +++++++
>   drivers/mfd/Kconfig                                |  10 ++
>   drivers/mfd/Makefile                               |   5 +-
>   drivers/mfd/twl-core.c                             |   8 ++
>   drivers/mfd/twl6030-power.c                        | 102 +++++++++++++++++++++

Seems proper place for this driver is drivers/power/reset.


>   5 files changed, 154 insertions(+), 2 deletions(-)
>   create mode 100644 Documentation/devicetree/bindings/mfd/twl6030-power.txt
>   create mode 100644 drivers/mfd/twl6030-power.c
>
> diff --git a/Documentation/devicetree/bindings/mfd/twl6030-power.txt b/Documentation/devicetree/bindings/mfd/twl6030-power.txt
> new file mode 100644
> index 0000000..97600e7
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/twl6030-power.txt
> @@ -0,0 +1,31 @@
> +Texas Instruments TWL family (twl6030) reset and power management module
> +
> +For now, the binding only supports the complete shutdown of the system after
> +poweroff.
> +
> +Required properties:
> +- compatible : must be
> +	"ti,twl6030-power"
> +
> +Optional properties:
> +
> +- ti,system-power-controller: This indicates that TWL6030 is the
> +  power supply master of the system. With this flag, the chip will
> +  initiate an ACTIVE-to-OFF or SLEEP-to-OFF transition when the
> +  system poweroffs.
> +
> +Example:
> +&i2c1 {
> +	clock-frequency = <2600000>;
> +
> +	twl: twl@48 {
> +		reg = <0x48>;
> +		interrupts = <7>; /* SYS_NIRQ cascaded to intc */
> +		interrupt-parent = <&intc>;
> +
> +		twl_power: power {
> +			compatible = "ti,twl6030-power";
> +			ti,system-power-controller;
> +		};
> +	};
> +};
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 28bfe3d..a0a8012 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -1301,6 +1301,16 @@ config MFD_TWL4030_AUDIO
>   	select MFD_CORE
>   	default n
>
> +config TWL6030_POWER
> +	bool "TI TWL6030 power resources"
> +	depends on TWL_CORE && ARM
> +	help
> +	  Say yes here if you want to use the power resources on the
> +	  TWL6030 family chips.
> +
> +	  When used as system power controller, this driver allows turning off
> +	  the main power supply.
> +
>   config TWL6040_CORE
>   	bool "TI TWL6040 audio codec"
>   	depends on I2C=y
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index 7daeab5..5aa16c8 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -81,9 +81,10 @@ obj-$(CONFIG_MFD_TPS65912_SPI)  += tps65912-spi.o
>   obj-$(CONFIG_MFD_TPS80031)	+= tps80031.o
>   obj-$(CONFIG_MENELAUS)		+= menelaus.o
>
> -obj-$(CONFIG_TWL_CORE)	+= twl-core.o twl4030-irq.o twl6030-irq.o
> -obj-$(CONFIG_TWL4030_POWER)    += twl4030-power.o
> +obj-$(CONFIG_TWL_CORE)		+= twl-core.o twl4030-irq.o twl6030-irq.o
> +obj-$(CONFIG_TWL4030_POWER)	+= twl4030-power.o
>   obj-$(CONFIG_MFD_TWL4030_AUDIO)	+= twl4030-audio.o
> +obj-$(CONFIG_TWL6030_POWER)	+= twl6030-power.o
>   obj-$(CONFIG_TWL6040_CORE)	+= twl6040.o
>
>   obj-$(CONFIG_MFD_MX25_TSADC)	+= fsl-imx25-tsadc.o
> diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
> index dae52f7..74372bc 100644
> --- a/drivers/mfd/twl-core.c
> +++ b/drivers/mfd/twl-core.c
> @@ -972,6 +972,14 @@ add_children(struct twl_platform_data *pdata, unsigned irq_base,
>   			return PTR_ERR(child);
>   	}
>
> +	if (IS_ENABLED(CONFIG_TWL6030_POWER) && pdata->power) {
> +		child = add_child(TWL_MODULE_PM_MASTER, "twl6030_power",
> +				  pdata->power, sizeof(*pdata->power), false,
> +				  0, 0);
> +		if (IS_ERR(child))
> +			return PTR_ERR(child);
> +	}
> +

non-DT boot option is not supported for twl6030 any more and
all related code was removed already.

>   	return 0;
>   }
>
> diff --git a/drivers/mfd/twl6030-power.c b/drivers/mfd/twl6030-power.c
> new file mode 100644
> index 0000000..a0bb6d8
> --- /dev/null
> +++ b/drivers/mfd/twl6030-power.c
> @@ -0,0 +1,102 @@
> +/*
> + * TWL6030 power
> + *
> + * Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
> + *
> + * This file is subject to the terms and conditions of the GNU General
> + * Public License. See the file "COPYING" in the main directory of this
> + * archive for more details.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

I think header should look different now (but not sure).

> + */
> +
> +#include <linux/module.h>
> +#include <linux/pm.h>
> +#include <linux/i2c/twl.h>
> +#include <linux/platform_device.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
> +
> +#define TWL6030_PHOENIX_DEV_ON		0x25
> +
> +#define TWL6030_PHOENIX_APP_DEVOFF	(1 << 0)
> +#define TWL6030_PHOENIX_CON_DEVOFF	(1 << 1)
> +#define TWL6030_PHOENIX_MOD_DEVOFF	(1 << 2)
> +
> +void twl6030_power_off(void)
> +{
> +	int err;
> +
> +	err = twl_i2c_write_u8(TWL6030_MODULE_ID0, TWL6030_PHOENIX_APP_DEVOFF |
> +		TWL6030_PHOENIX_CON_DEVOFF | TWL6030_PHOENIX_MOD_DEVOFF,
> +		TWL6030_PHOENIX_DEV_ON);
> +	if (err)
> +		pr_err("TWL6030 Unable to power off\n");
> +}
> +
> +static bool twl6030_power_use_poweroff(const struct twl_power_data *pdata,
> +	struct device_node *node)
> +{
> +	if (pdata && pdata->use_poweroff)
> +		return true;

the same comment as above - only DT support for this PMIC as of now.

> +
> +	if (of_property_read_bool(node, "ti,system-power-controller"))
> +		return true;
> +
> +	return false;
> +}
> +
> +#ifdef CONFIG_OF
> +static const struct of_device_id twl6030_power_of_match[] = {
> +	{
> +		.compatible = "ti,twl6030-power",
> +	},
> +	{ },
> +};
> +
> +MODULE_DEVICE_TABLE(of, twl6030_power_of_match);
> +#endif	/* CONFIG_OF */
> +
> +static int twl6030_power_probe(struct platform_device *pdev)
> +{
> +	const struct twl_power_data *pdata = dev_get_platdata(&pdev->dev);
> +	struct device_node *node = pdev->dev.of_node;
> +
> +	if (!pdata && !node) {
> +		dev_err(&pdev->dev, "Platform data is missing\n");
> +		return -EINVAL;
> +	}
> +
> +	/* Board has to be wired properly to use this feature */
> +	if (twl6030_power_use_poweroff(pdata, node) && !pm_power_off)
> +		pm_power_off = twl6030_power_off;
> +
> +	return 0;
> +}
> +
> +static int twl6030_power_remove(struct platform_device *pdev)
> +{
> +	return 0;
> +}
> +
> +static struct platform_driver twl6030_power_driver = {
> +	.driver = {
> +		.name	= "twl6030_power",
> +		.of_match_table = of_match_ptr(twl6030_power_of_match),
> +	},
> +	.probe		= twl6030_power_probe,
> +	.remove		= twl6030_power_remove,
> +};
> +
> +module_platform_driver(twl6030_power_driver);
> +
> +MODULE_AUTHOR("Paul Kocialkowski <contact@paulk.fr>");
> +MODULE_DESCRIPTION("Power management for TWL6030");
> +MODULE_LICENSE("GPL");
>


-- 
regards,
-grygorii

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 7/8] input: misc: Add TWL6030 power button support to twl-pwrbutton
  2016-03-29 19:22 ` [PATCH 7/8] input: misc: Add TWL6030 power button support to twl-pwrbutton Paul Kocialkowski
@ 2016-03-30 16:16   ` Grygorii Strashko
  2016-04-02 20:30     ` Paul Kocialkowski
  0 siblings, 1 reply; 19+ messages in thread
From: Grygorii Strashko @ 2016-03-30 16:16 UTC (permalink / raw)
  To: Paul Kocialkowski, linux-kernel, linux-omap, linux-pm, devicetree
  Cc: Rob Herring, Tony Lindgren, Dmitry Torokhov, Sebastian Reichel,
	Dmitry Eremin-Solenikov, David Woodhouse

On 03/29/2016 10:22 PM, Paul Kocialkowski wrote:
> This renames the twl4030-pwrbutton driver to twl-pwrbutton, since power button
> handling is very similar on most TWL chips. This also introduces TWL6030 power
> button support.
> 
> TWL6030 power button support requires the following additional changes:
> * Devicetree binding and support
> * Interrupt unmasking and remasking support

Again. pls, do not mix clean up/beautification and adding new features.
And don't mix DT changes with code changes.

> 
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> ---
>   .../devicetree/bindings/input/twl-pwrbutton.txt    |  22 ++++
>   .../bindings/input/twl4030-pwrbutton.txt           |  21 ---
>   arch/arm/boot/dts/twl6030.dtsi                     |   5 +
>   arch/arm/configs/omap2plus_defconfig               |   2 +-
>   drivers/input/misc/Kconfig                         |   8 +-
>   drivers/input/misc/Makefile                        |   2 +-
>   drivers/input/misc/twl-pwrbutton.c                 | 143 +++++++++++++++++++++
>   drivers/input/misc/twl4030-pwrbutton.c             | 116 -----------------
>   drivers/mfd/twl-core.c                             |  12 +-
>   include/linux/i2c/twl.h                            |   1 +
>   10 files changed, 187 insertions(+), 145 deletions(-)
>   create mode 100644 Documentation/devicetree/bindings/input/twl-pwrbutton.txt
>   delete mode 100644 Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
>   create mode 100644 drivers/input/misc/twl-pwrbutton.c
>   delete mode 100644 drivers/input/misc/twl4030-pwrbutton.c
> 
> diff --git a/Documentation/devicetree/bindings/input/twl-pwrbutton.txt b/Documentation/devicetree/bindings/input/twl-pwrbutton.txt
> new file mode 100644
> index 0000000..4931be4
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/twl-pwrbutton.txt
> @@ -0,0 +1,22 @@
> +Texas Instruments TWL family pwrbutton module
> +
> +This module is part of a TWL chip. For more details about the whole
> +chip see Documentation/devicetree/bindings/mfd/twl-familly.txt.
> +
> +This module provides a simple power button event via an Interrupt.
> +
> +Required properties:
> +- compatible: should be one of the following
> +   - "ti,twl4030-pwrbutton": For controllers compatible with twl4030
> +   - "ti,twl6030-pwrbutton": For controllers compatible with twl6030
> +- interrupts: should be one of the following
> +   - <8>: For controllers compatible with the twl
> +
> +Example:
> +
> +&twl {
> +	twl_pwrbutton: pwrbutton {
> +		compatible = "ti,twl4030-pwrbutton";
> +		interrupts = <8>;
> +	};
> +};
> diff --git a/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt b/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
> deleted file mode 100644
> index c864a46..0000000
> --- a/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -Texas Instruments TWL family (twl4030) pwrbutton module
> -
> -This module is part of the TWL4030. For more details about the whole
> -chip see Documentation/devicetree/bindings/mfd/twl-familly.txt.
> -
> -This module provides a simple power button event via an Interrupt.
> -
> -Required properties:
> -- compatible: should be one of the following
> -   - "ti,twl4030-pwrbutton": For controllers compatible with twl4030
> -- interrupts: should be one of the following
> -   - <8>: For controllers compatible with twl4030
> -
> -Example:
> -
> -&twl {
> -	twl_pwrbutton: pwrbutton {
> -		compatible = "ti,twl4030-pwrbutton";
> -		interrupts = <8>;
> -	};
> -};
> diff --git a/arch/arm/boot/dts/twl6030.dtsi b/arch/arm/boot/dts/twl6030.dtsi
> index 55eb35f..6a52df1 100644
> --- a/arch/arm/boot/dts/twl6030.dtsi
> +++ b/arch/arm/boot/dts/twl6030.dtsi
> @@ -99,4 +99,9 @@
>   		compatible = "ti,twl6030-pwmled";
>   		#pwm-cells = <2>;
>   	};
> +
> +	twl_pwrbutton: pwrbutton {
> +		compatible = "ti,twl6030-pwrbutton";
> +		interrupts = <0>;
> +	};
>   };
> diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
> index 156bc88..ff9752a 100644
> --- a/arch/arm/configs/omap2plus_defconfig
> +++ b/arch/arm/configs/omap2plus_defconfig
> @@ -217,7 +217,7 @@ CONFIG_TOUCHSCREEN_TSC2007=m
>   CONFIG_TOUCHSCREEN_TI_AM335X_TSC=m
>   CONFIG_INPUT_MISC=y
>   CONFIG_INPUT_TPS65218_PWRBUTTON=m
> -CONFIG_INPUT_TWL4030_PWRBUTTON=m
> +CONFIG_INPUT_TWL_PWRBUTTON=m
>   CONFIG_INPUT_PALMAS_PWRBUTTON=m
>   CONFIG_SERIO=m
>   # CONFIG_LEGACY_PTYS is not set
> diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
> index 6abb6df..f643e14 100644
> --- a/drivers/input/misc/Kconfig
> +++ b/drivers/input/misc/Kconfig
> @@ -459,15 +459,15 @@ config INPUT_AXP20X_PEK
>   	  be called axp20x-pek.
>   
>   
> -config INPUT_TWL4030_PWRBUTTON
> -	tristate "TWL4030 Power button Driver"
> +config INPUT_TWL_PWRBUTTON
> +	tristate "TWL Power button Driver"
>   	depends on TWL_CORE
>   	help
>   	  Say Y here if you want to enable power key reporting via the
> -	  TWL4030 family of chips.
> +	  TWL family of chips.
>   
>   	  To compile this driver as a module, choose M here. The module will
> -	  be called twl4030_pwrbutton.
> +	  be called twl_pwrbutton.
>   
>   config INPUT_TWL4030_VIBRA
>   	tristate "Support for TWL4030 Vibrator"
> diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
> index 0357a08..f77f5e7 100644
> --- a/drivers/input/misc/Makefile
> +++ b/drivers/input/misc/Makefile
> @@ -66,7 +66,7 @@ obj-$(CONFIG_INPUT_SIRFSOC_ONKEY)	+= sirfsoc-onkey.o
>   obj-$(CONFIG_INPUT_SOC_BUTTON_ARRAY)	+= soc_button_array.o
>   obj-$(CONFIG_INPUT_SPARCSPKR)		+= sparcspkr.o
>   obj-$(CONFIG_INPUT_TPS65218_PWRBUTTON)	+= tps65218-pwrbutton.o
> -obj-$(CONFIG_INPUT_TWL4030_PWRBUTTON)	+= twl4030-pwrbutton.o
> +obj-$(CONFIG_INPUT_TWL_PWRBUTTON)	+= twl-pwrbutton.o
>   obj-$(CONFIG_INPUT_TWL4030_VIBRA)	+= twl4030-vibra.o
>   obj-$(CONFIG_INPUT_TWL6040_VIBRA)	+= twl6040-vibra.o
>   obj-$(CONFIG_INPUT_UINPUT)		+= uinput.o
> diff --git a/drivers/input/misc/twl-pwrbutton.c b/drivers/input/misc/twl-pwrbutton.c
> new file mode 100644
> index 0000000..a7bc8ad
> --- /dev/null
> +++ b/drivers/input/misc/twl-pwrbutton.c
> @@ -0,0 +1,143 @@
> +/**
> + * twl4030-pwrbutton.c - TWL4030 Power Button Input Driver
> + *
> + * Copyright (C) 2008-2009 Nokia Corporation
> + *
> + * Written by Peter De Schrijver <peter.de-schrijver@nokia.com>
> + * Several fixes by Felipe Balbi <felipe.balbi@nokia.com>
> + *
> + * This file is subject to the terms and conditions of the GNU General
> + * Public License. See the file "COPYING" in the main directory of this
> + * archive for more details.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
> + */
> +
> +#include <linux/module.h>
> +#include <linux/init.h>
> +#include <linux/kernel.h>
> +#include <linux/errno.h>
> +#include <linux/input.h>
> +#include <linux/interrupt.h>
> +#include <linux/platform_device.h>
> +#include <linux/i2c/twl.h>
> +
> +#define PWR_PWRON_IRQ (1 << 0)
> +
> +#define TWL4030_STS_HW_CONDITIONS 0x0f
> +#define TWL6030_STS_HW_CONDITIONS 0x21
> +
> +static irqreturn_t powerbutton_irq(int irq, void *_pwr)
> +{
> +	struct input_dev *pwr = _pwr;
> +	int err;
> +	u8 value;
> +
> +	if (twl_class_is_4030())

one of the benefits of using DT is that we can get rid of code
like above - compatible string should provide enough info.

> +		err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &value,
> +				TWL4030_STS_HW_CONDITIONS);
> +	else
> +		err = twl_i2c_read_u8(TWL6030_MODULE_ID0, &value,
> +				TWL6030_STS_HW_CONDITIONS);
> +
> +	if (!err)  {
> +		pm_wakeup_event(pwr->dev.parent, 0);
> +		input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ);
> +		input_sync(pwr);
> +	} else {
> +		dev_err(pwr->dev.parent, "twl4030: i2c error %d while reading"
> +			" TWL4030 PM_MASTER STS_HW_CONDITIONS register\n", err);
> +	}
> +
> +	return IRQ_HANDLED;
> +}
> +
> +static int twl_pwrbutton_probe(struct platform_device *pdev)
> +{
> +	struct input_dev *pwr;
> +	int irq = platform_get_irq(pdev, 0);

It may fail ?! and return -EPROBE_DEFER

> +	int err;
> +
> +	pwr = devm_input_allocate_device(&pdev->dev);
> +	if (!pwr) {
> +		dev_err(&pdev->dev, "Can't allocate power button\n");
> +		return -ENOMEM;
> +	}
> +
> +	pwr->evbit[0] = BIT_MASK(EV_KEY);
> +	pwr->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);
> +	pwr->name = "twl_pwrbutton";
> +	pwr->phys = "twl_pwrbutton/input0";
> +	pwr->dev.parent = &pdev->dev;
> +
> +	if (twl_class_is_6030()) {
> +		twl6030_interrupt_unmask(TWL6030_PWRON_INT_MASK,
> +			REG_INT_MSK_LINE_A);
> +		twl6030_interrupt_unmask(TWL6030_PWRON_INT_MASK,
> +			REG_INT_MSK_STS_A);

Seems it's time to update twl6030-irq.c and add enable_irq()/disable_irq() functionality.

> +	}
> +
> +	err = devm_request_threaded_irq(&pwr->dev, irq, NULL, powerbutton_irq,
> +			IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING |
> +			IRQF_ONESHOT,
> +			"twl_pwrbutton", pwr);
> +	if (err < 0) {
> +		dev_err(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n", err);
> +		return err;
> +	}
> +
> +	err = input_register_device(pwr);
> +	if (err) {
> +		dev_err(&pdev->dev, "Can't register power button: %d\n", err);
> +		return err;
> +	}
> +
> +	platform_set_drvdata(pdev, pwr);
> +	device_init_wakeup(&pdev->dev, true);
> +
> +	return 0;
> +}
> +
> +static int twl_pwrbutton_remove(struct platform_device *pdev)
> +{
> +	if (twl_class_is_6030()) {
> +		twl6030_interrupt_mask(TWL6030_PWRON_INT_MASK,
> +			REG_INT_MSK_LINE_A);
> +		twl6030_interrupt_mask(TWL6030_PWRON_INT_MASK,
> +			REG_INT_MSK_STS_A);
> +	}
	device_init_wakeup(&pdev->dev, 0);


> +
> +	return 0;
> +}
> +
> +#ifdef CONFIG_OF
> +static const struct of_device_id twl_pwrbutton_dt_match_table[] = {
> +       { .compatible = "ti,twl4030-pwrbutton" },
> +       { .compatible = "ti,twl6030-pwrbutton" },
> +       {},
> +};
> +MODULE_DEVICE_TABLE(of, twl_pwrbutton_dt_match_table);
> +#endif
> +
> +static struct platform_driver twl_pwrbutton_driver = {
> +	.probe		= twl_pwrbutton_probe,
> +	.remove		= twl_pwrbutton_remove,
> +	.driver		= {
> +		.name	= "twl_pwrbutton",
> +		.of_match_table = of_match_ptr(twl_pwrbutton_dt_match_table),
> +	},
> +};
> +module_platform_driver(twl_pwrbutton_driver);
> +
> +MODULE_ALIAS("platform:twl_pwrbutton");
> +MODULE_DESCRIPTION("TWL Power Button");
> +MODULE_LICENSE("GPL");
> +MODULE_AUTHOR("Peter De Schrijver <peter.de-schrijver@nokia.com>");
> +MODULE_AUTHOR("Felipe Balbi <felipe.balbi@nokia.com>");
> diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
> deleted file mode 100644
> index 603fc2f..0000000
> --- a/drivers/input/misc/twl4030-pwrbutton.c
> +++ /dev/null
> @@ -1,116 +0,0 @@
> -/**
> - * twl4030-pwrbutton.c - TWL4030 Power Button Input Driver
> - *
> - * Copyright (C) 2008-2009 Nokia Corporation
> - *
> - * Written by Peter De Schrijver <peter.de-schrijver@nokia.com>
> - * Several fixes by Felipe Balbi <felipe.balbi@nokia.com>
> - *
> - * This file is subject to the terms and conditions of the GNU General
> - * Public License. See the file "COPYING" in the main directory of this
> - * archive for more details.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
> - */
> -
> -#include <linux/module.h>
> -#include <linux/init.h>
> -#include <linux/kernel.h>
> -#include <linux/errno.h>
> -#include <linux/input.h>
> -#include <linux/interrupt.h>
> -#include <linux/platform_device.h>
> -#include <linux/i2c/twl.h>
> -
> -#define PWR_PWRON_IRQ (1 << 0)
> -
> -#define STS_HW_CONDITIONS 0xf
> -
> -static irqreturn_t powerbutton_irq(int irq, void *_pwr)
> -{
> -	struct input_dev *pwr = _pwr;
> -	int err;
> -	u8 value;
> -
> -	err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &value, STS_HW_CONDITIONS);
> -	if (!err)  {
> -		pm_wakeup_event(pwr->dev.parent, 0);
> -		input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ);
> -		input_sync(pwr);
> -	} else {
> -		dev_err(pwr->dev.parent, "twl4030: i2c error %d while reading"
> -			" TWL4030 PM_MASTER STS_HW_CONDITIONS register\n", err);
> -	}
> -
> -	return IRQ_HANDLED;
> -}
> -
> -static int twl4030_pwrbutton_probe(struct platform_device *pdev)
> -{
> -	struct input_dev *pwr;
> -	int irq = platform_get_irq(pdev, 0);
> -	int err;
> -
> -	pwr = devm_input_allocate_device(&pdev->dev);
> -	if (!pwr) {
> -		dev_err(&pdev->dev, "Can't allocate power button\n");
> -		return -ENOMEM;
> -	}
> -
> -	pwr->evbit[0] = BIT_MASK(EV_KEY);
> -	pwr->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);
> -	pwr->name = "twl4030_pwrbutton";
> -	pwr->phys = "twl4030_pwrbutton/input0";
> -	pwr->dev.parent = &pdev->dev;
> -
> -	err = devm_request_threaded_irq(&pwr->dev, irq, NULL, powerbutton_irq,
> -			IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING |
> -			IRQF_ONESHOT,
> -			"twl4030_pwrbutton", pwr);
> -	if (err < 0) {
> -		dev_err(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n", err);
> -		return err;
> -	}
> -
> -	err = input_register_device(pwr);
> -	if (err) {
> -		dev_err(&pdev->dev, "Can't register power button: %d\n", err);
> -		return err;
> -	}
> -
> -	platform_set_drvdata(pdev, pwr);
> -	device_init_wakeup(&pdev->dev, true);
> -
> -	return 0;
> -}
> -
> -#ifdef CONFIG_OF
> -static const struct of_device_id twl4030_pwrbutton_dt_match_table[] = {
> -       { .compatible = "ti,twl4030-pwrbutton" },
> -       {},
> -};
> -MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table);
> -#endif
> -
> -static struct platform_driver twl4030_pwrbutton_driver = {
> -	.probe		= twl4030_pwrbutton_probe,
> -	.driver		= {
> -		.name	= "twl4030_pwrbutton",
> -		.of_match_table = of_match_ptr(twl4030_pwrbutton_dt_match_table),
> -	},
> -};
> -module_platform_driver(twl4030_pwrbutton_driver);
> -
> -MODULE_ALIAS("platform:twl4030_pwrbutton");
> -MODULE_DESCRIPTION("Triton2 Power Button");
> -MODULE_LICENSE("GPL");
> -MODULE_AUTHOR("Peter De Schrijver <peter.de-schrijver@nokia.com>");
> -MODULE_AUTHOR("Felipe Balbi <felipe.balbi@nokia.com>");
> -
> diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
> index 74372bc..a1bfe23 100644
> --- a/drivers/mfd/twl-core.c
> +++ b/drivers/mfd/twl-core.c
> @@ -848,13 +848,21 @@ add_children(struct twl_platform_data *pdata, unsigned irq_base,
>   			return PTR_ERR(child);
>   	}
>   
> -	if (IS_ENABLED(CONFIG_INPUT_TWL4030_PWRBUTTON) && twl_class_is_4030()) {
> -		child = add_child(TWL_MODULE_PM_MASTER, "twl4030_pwrbutton",
> +	if (IS_ENABLED(CONFIG_INPUT_TWL_PWRBUTTON) && twl_class_is_4030()) {
> +		child = add_child(TWL_MODULE_PM_MASTER, "twl_pwrbutton",
>   				  NULL, 0, true, irq_base + 8 + 0, 0);
>   		if (IS_ERR(child))
>   			return PTR_ERR(child);
>   	}
>   
> +	if (IS_ENABLED(CONFIG_INPUT_TWL_PWRBUTTON) && twl_class_is_6030()) {
> +		child = add_child(TWL_MODULE_PM_MASTER, "twl_pwrbutton",
> +				  NULL, 0, true, irq_base + 0, 0);
> +		if (IS_ERR(child))
> +			return PTR_ERR(child);
> +	}
> +

no legacy code for twl6030 pls

> +
>   	if (IS_ENABLED(CONFIG_MFD_TWL4030_AUDIO) && pdata->audio &&
>   	    twl_class_is_4030()) {
>   		child = add_child(TWL4030_MODULE_AUDIO_VOICE, "twl4030-audio",
> diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
> index 2decb190..20d33b7 100644
> --- a/include/linux/i2c/twl.h
> +++ b/include/linux/i2c/twl.h
> @@ -127,6 +127,7 @@ enum twl6030_module_ids {
>   #define REG_INT_MSK_STS_C		0x08
>   
>   /* MASK INT REG GROUP A */
> +#define TWL6030_PWRON_INT_MASK		0x01
>   #define TWL6030_PWR_INT_MASK 		0x07
>   #define TWL6030_RTC_INT_MASK 		0x18
>   #define TWL6030_HOTDIE_INT_MASK 	0x20
> 


-- 
regards,
-grygorii

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/8] mfd: twl-core: Rename struct twl4030_platform_data to twl_platform_data
  2016-03-30 15:20 ` [PATCH 1/8] mfd: twl-core: Rename struct twl4030_platform_data to twl_platform_data Grygorii Strashko
@ 2016-04-02 19:58   ` Paul Kocialkowski
  0 siblings, 0 replies; 19+ messages in thread
From: Paul Kocialkowski @ 2016-04-02 19:58 UTC (permalink / raw)
  To: Grygorii Strashko, linux-kernel, linux-omap, linux-pm, devicetree
  Cc: Rob Herring, Tony Lindgren, Dmitry Torokhov, Sebastian Reichel,
	Dmitry Eremin-Solenikov, David Woodhouse

[-- Attachment #1: Type: text/plain, Size: 8310 bytes --]

Hi,

Le mercredi 30 mars 2016 à 18:20 +0300, Grygorii Strashko a écrit :
> On 03/29/2016 10:22 PM, Paul Kocialkowski wrote:
> > Since twl4030_platform_data also holds platform data (e.g. regulators) for
> > other
> > TWL chips, it makes sense to rename it to a non-model-specific name.
> > 
> > This will also allow hooking more platform data structure to it in the
> > future.
>
> Do we really need this patch?
> In general ldb and r51 board files are going to be dropped soon and
> it not expected to support this PMIC devices for non-DT use cases.
> As result twl4030_platform_data will be dropped at all or made private.

I understand. Depending on how soon these legacy boards are dropped, a cleanup
might still be a good thing to have. Either way, it doesn't hurt and the patch
is ready already.

However, I'll refrain from introducing more twl cleanups (which I had planned on
doing) until we get rid of all the platform data stuff.

> > Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> > ---
> >   arch/arm/mach-omap2/board-ldp.c              |  2 +-
> >   arch/arm/mach-omap2/board-rx51-peripherals.c |  2 +-
> >   arch/arm/mach-omap2/twl-common.c             |  8 ++++----
> >   arch/arm/mach-omap2/twl-common.h             | 14 +++++++-------
> >   drivers/mfd/twl-core.c                       |  4 ++--
> >   include/linux/i2c/twl.h                      |  3 ++-
> >   6 files changed, 17 insertions(+), 16 deletions(-)
> > 
> > diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-
> > ldp.c
> > index d9c3ffc..b8c2e21 100644
> > --- a/arch/arm/mach-omap2/board-ldp.c
> > +++ b/arch/arm/mach-omap2/board-ldp.c
> > @@ -321,7 +321,7 @@ static struct regulator_init_data ldp_vpll2 = {
> >   	.consumer_supplies	= ldp_vpll2_supplies,
> >   };
> > 
> > -static struct twl4030_platform_data ldp_twldata = {
> > +static struct twl_platform_data ldp_twldata = {
> >   	/* platform_data for children goes here */
> >   	.vmmc1		= &ldp_vmmc1,
> >   	.vaux1		= &ldp_vaux1,
> > diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-
> > omap2/board-rx51-peripherals.c
> > index da174c0..3739bff 100644
> > --- a/arch/arm/mach-omap2/board-rx51-peripherals.c
> > +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
> > @@ -957,7 +957,7 @@ static struct twl4030_audio_data rx51_audio_data
> > __initdata = {
> >   	.vibra		= &rx51_vibra_data,
> >   };
> > 
> > -static struct twl4030_platform_data rx51_twldata __initdata = {
> > +static struct twl_platform_data rx51_twldata __initdata = {
> >   	/* platform_data for children goes here */
> >   	.gpio			= &rx51_gpio_data,
> >   	.keypad			= &rx51_kp_data,
> > diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-
> > common.c
> > index 292eca0..4e6532f 100644
> > --- a/arch/arm/mach-omap2/twl-common.c
> > +++ b/arch/arm/mach-omap2/twl-common.c
> > @@ -55,7 +55,7 @@ static int twl_get_voltage(void *data)
> > 
> >   void __init omap_pmic_init(int bus, u32 clkrate,
> >   			   const char *pmic_type, int pmic_irq,
> > -			   struct twl4030_platform_data *pmic_data)
> > +			   struct twl_platform_data *pmic_data)
> >   {
> >   	omap_mux_init_signal("sys_nirq", OMAP_PIN_INPUT_PULLUP |
> > OMAP_PIN_OFF_WAKEUPENABLE);
> >   	strlcpy(pmic_i2c_board_info.type, pmic_type,
> > @@ -68,7 +68,7 @@ void __init omap_pmic_init(int bus, u32 clkrate,
> > 
> >   #ifdef CONFIG_ARCH_OMAP4
> >   void __init omap4_pmic_init(const char *pmic_type,
> > -		    struct twl4030_platform_data *pmic_data,
> > +		    struct twl_platform_data *pmic_data,
> >   		    struct i2c_board_info *devices, int nr_devices)
> >   {
> >   	/* PMIC part*/
> > @@ -205,7 +205,7 @@ static struct twl_regulator_driver_data
> > omap3_vdd2_drvdata = {
> >   	.set_voltage = twl_set_voltage,
> >   };
> > 
> > -void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
> > +void __init omap3_pmic_get_config(struct twl_platform_data *pmic_data,
> >   				  u32 pdata_flags, u32 regulators_flags)
> >   {
> >   	if (!pmic_data->vdd1) {
> > @@ -470,7 +470,7 @@ static struct regulator_init_data omap4_v2v1_idata = {
> >   	.consumer_supplies	= omap4_v2v1_supply,
> >   };
> > 
> > -void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data,
> > +void __init omap4_pmic_get_config(struct twl_platform_data *pmic_data,
> >   				  u32 pdata_flags, u32 regulators_flags)
> >   {
> >   	if (!pmic_data->vdd1) {
> > diff --git a/arch/arm/mach-omap2/twl-common.h b/arch/arm/mach-omap2/twl-
> > common.h
> > index 24b65d0..e7caa23 100644
> > --- a/arch/arm/mach-omap2/twl-common.h
> > +++ b/arch/arm/mach-omap2/twl-common.h
> > @@ -30,35 +30,35 @@
> >   #define TWL_COMMON_REGULATOR_VPLL2	(1 << 5)
> > 
> > 
> > -struct twl4030_platform_data;
> > +struct twl_platform_data;
> >   struct twl6040_platform_data;
> >   struct omap_tw4030_pdata;
> >   struct i2c_board_info;
> > 
> >   void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int
> > pmic_irq,
> > -		    struct twl4030_platform_data *pmic_data);
> > +		    struct twl_platform_data *pmic_data);
> >   void omap_pmic_late_init(void);
> > 
> >   static inline void omap2_pmic_init(const char *pmic_type,
> > -				   struct twl4030_platform_data *pmic_data)
> > +				   struct twl_platform_data *pmic_data)
> >   {
> >   	omap_pmic_init(2, 2600, pmic_type, 7 + OMAP_INTC_START,
> > pmic_data);
> >   }
> > 
> >   static inline void omap3_pmic_init(const char *pmic_type,
> > -				   struct twl4030_platform_data *pmic_data)
> > +				   struct twl_platform_data *pmic_data)
> >   {
> >   	omap_pmic_init(1, 2600, pmic_type, 7 + OMAP_INTC_START,
> > pmic_data);
> >   }
> > 
> >   void omap4_pmic_init(const char *pmic_type,
> > -		    struct twl4030_platform_data *pmic_data,
> > +		    struct twl_platform_data *pmic_data,
> >   		    struct i2c_board_info *devices, int nr_devices);
> > 
> > -void omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
> > +void omap3_pmic_get_config(struct twl_platform_data *pmic_data,
> >   			   u32 pdata_flags, u32 regulators_flags);
> > 
> > -void omap4_pmic_get_config(struct twl4030_platform_data *pmic_data,
> > +void omap4_pmic_get_config(struct twl_platform_data *pmic_data,
> >   			   u32 pdata_flags, u32 regulators_flags);
> > 
> >   void omap_twl4030_audio_init(char *card_name, struct omap_tw4030_pdata
> > *pdata);
> > diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
> > index 831696e..dae52f7 100644
> > --- a/drivers/mfd/twl-core.c
> > +++ b/drivers/mfd/twl-core.c
> > @@ -721,7 +721,7 @@ add_regulator(int num, struct regulator_init_data
> > *pdata,
> >    */
> > 
> >   static int
> > -add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
> > +add_children(struct twl_platform_data *pdata, unsigned irq_base,
> >   		unsigned long features)
> >   {
> >   	struct device	*child;
> > @@ -1083,7 +1083,7 @@ static struct of_dev_auxdata twl_auxdata_lookup[] = {
> >   static int
> >   twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
> >   {
> > -	struct twl4030_platform_data	*pdata =
> > dev_get_platdata(&client->dev);
> > +	struct twl_platform_data	*pdata = dev_get_platdata(&client-
> > >dev);
> >   	struct device_node		*node = client->dev.of_node;
> >   	struct platform_device		*pdev;
> >   	const struct regmap_config	*twl_regmap_config;
> > diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
> > index 9ad7828..27bea30 100644
> > --- a/include/linux/i2c/twl.h
> > +++ b/include/linux/i2c/twl.h
> > @@ -704,7 +704,8 @@ struct twl4030_audio_data {
> >   	unsigned int irq_base;
> >   };
> > 
> > -struct twl4030_platform_data {
> > +struct twl_platform_data {
> > +	/* TWL4030 platform data */
> >   	struct twl4030_clock_init_data		*clock;
> >   	struct twl4030_bci_platform_data	*bci;
> >   	struct twl4030_gpio_platform_data	*gpio;
> > 
> 

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/8] mfd: twl-core: Rename TWL4030_CORE Kconfig option to TWL_CORE
  2016-03-30 15:34   ` Grygorii Strashko
@ 2016-04-02 20:12     ` Paul Kocialkowski
  2016-04-05 10:21       ` Grygorii Strashko
  0 siblings, 1 reply; 19+ messages in thread
From: Paul Kocialkowski @ 2016-04-02 20:12 UTC (permalink / raw)
  To: Grygorii Strashko, linux-kernel, linux-omap, linux-pm, devicetree
  Cc: Rob Herring, Tony Lindgren, Dmitry Torokhov, Sebastian Reichel,
	Dmitry Eremin-Solenikov, David Woodhouse

[-- Attachment #1: Type: text/plain, Size: 17285 bytes --]

Le mercredi 30 mars 2016 à 18:34 +0300, Grygorii Strashko a écrit :
> On 03/29/2016 10:22 PM, Paul Kocialkowski wrote:
> > 
> > Since the twl-core mfd driver is not limited to twl4030 support, but also
> > supports other chips of the TWL family, it makes sense to rename its
> > matching
> > Kconfig opton to a non-model-specific name.
>
> Personally I don't see too much reason for this, but it's up to maintainers to
> decide.

I'm a strong advocate of consistency in naming and using twl4030 prefixes for
drivers that are common to more twl chips looks very inconsistent to me.
Besides, some common twl drivers are already using the twl prefix, so this can
also be seen as harmonisation.

> Regarding this patch - pls, do not mix Kconfig and code changes.

Do you mean that for code changes that are directly affected by Kconfig changes
(e.g. #ifdef CONFIG_)? Is the policy that "each commit must produce a working
result" or is it okay to break drivers in between commits of the same series?

> And it will be good to have cover letter.

Noted, I'll come up with something for v2.

> > Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> > ---
> >   arch/arm/mach-omap2/Kconfig     | 2 +-
> >   arch/arm/mach-omap2/Makefile    | 2 +-
> >   arch/arm/mach-omap2/pm.h        | 2 +-
> >   arch/arm/plat-omap/Kconfig      | 2 +-
> >   drivers/gpio/Kconfig            | 2 +-
> >   drivers/iio/adc/Kconfig         | 4 ++--
> >   drivers/input/keyboard/Kconfig  | 2 +-
> >   drivers/input/misc/Kconfig      | 4 ++--
> >   drivers/mfd/Kconfig             | 6 +++---
> >   drivers/mfd/Makefile            | 2 +-
> >   drivers/mfd/twl4030-irq.c       | 6 +++---
> >   drivers/phy/Kconfig             | 2 +-
> >   drivers/power/Kconfig           | 2 +-
> >   drivers/pwm/Kconfig             | 4 ++--
> >   drivers/regulator/Kconfig       | 2 +-
> >   drivers/rtc/Kconfig             | 2 +-
> >   drivers/usb/phy/Kconfig         | 2 +-
> >   drivers/video/backlight/Kconfig | 2 +-
> >   drivers/watchdog/Kconfig        | 2 +-
> >   include/linux/i2c/twl.h         | 4 ++--
> >   sound/soc/codecs/Kconfig        | 2 +-
> >   sound/soc/omap/Kconfig          | 4 ++--
> >   22 files changed, 31 insertions(+), 31 deletions(-)
> > 
> > diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
> > index 0517f0c..ada4c7a1 100644
> > --- a/arch/arm/mach-omap2/Kconfig
> > +++ b/arch/arm/mach-omap2/Kconfig
> > @@ -124,7 +124,7 @@ config ARCH_OMAP2PLUS_TYPICAL
> >   	select PM
> >   	select REGULATOR
> >   	select REGULATOR_FIXED_VOLTAGE
> > -	select TWL4030_CORE if ARCH_OMAP3 || ARCH_OMAP4
> > +	select TWL_CORE if ARCH_OMAP3 || ARCH_OMAP4
> >   	select TWL4030_POWER if ARCH_OMAP3 || ARCH_OMAP4
> >   	select VFP
> >   	help
> > diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> > index 0ba6a0e..6eb680a 100644
> > --- a/arch/arm/mach-omap2/Makefile
> > +++ b/arch/arm/mach-omap2/Makefile
> > @@ -27,7 +27,7 @@ ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),)
> >   obj-y += mcbsp.o
> >   endif
> >   
> > -obj-$(CONFIG_TWL4030_CORE) += omap_twl.o
> > +obj-$(CONFIG_TWL_CORE) += omap_twl.o
> >   obj-$(CONFIG_SOC_HAS_OMAP2_SDRC)	+= sdrc.o
> >   
> >   # SMP support ONLY available for OMAP4
> > diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
> > index b668719..bf4dac2 100644
> > --- a/arch/arm/mach-omap2/pm.h
> > +++ b/arch/arm/mach-omap2/pm.h
> > @@ -123,7 +123,7 @@ static inline int omap_devinit_smartreflex(void)
> >   static inline void omap_enable_smartreflex_on_init(void) {}
> >   #endif
> >   
> > -#ifdef CONFIG_TWL4030_CORE
> > +#ifdef CONFIG_TWL_CORE
> >   extern int omap3_twl_init(void);
> >   extern int omap4_twl_init(void);
> >   extern int omap3_twl_set_sr_bit(bool enable);
> > diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
> > index d055db3..8631a45 100644
> > --- a/arch/arm/plat-omap/Kconfig
> > +++ b/arch/arm/plat-omap/Kconfig
> > @@ -44,7 +44,7 @@ config POWER_AVS_OMAP
> >   
> >   config POWER_AVS_OMAP_CLASS3
> >   	bool "Class 3 mode of Smartreflex Implementation"
> > -	depends on POWER_AVS_OMAP && TWL4030_CORE
> > +	depends on POWER_AVS_OMAP && TWL_CORE
> >   	help
> >   	  Say Y to enable Class 3 implementation of Smartreflex
> >   
> > diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> > index 5f3429f..62ca9b4 100644
> > --- a/drivers/gpio/Kconfig
> > +++ b/drivers/gpio/Kconfig
> > @@ -933,7 +933,7 @@ config GPIO_TPS65912
> >   
> >   config GPIO_TWL4030
> >   	tristate "TWL4030, TWL5030, and TPS659x0 GPIOs"
> > -	depends on TWL4030_CORE
> > +	depends on TWL_CORE
> >   	help
> >   	  Say yes here to access the GPIO signals of various multi-
> > function
> >   	  power management chips from Texas Instruments.
> > diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
> > index af4aea7..3360492 100644
> > --- a/drivers/iio/adc/Kconfig
> > +++ b/drivers/iio/adc/Kconfig
> > @@ -440,7 +440,7 @@ config TI_AM335X_ADC
> >   
> >   config TWL4030_MADC
> >   	tristate "TWL4030 MADC (Monitoring A/D Converter)"
> > -	depends on TWL4030_CORE
> > +	depends on TWL_CORE
> >   	help
> >   	  This driver provides support for Triton TWL4030-MADC. The
> >   	  driver supports both RT and SW conversion methods.
> > @@ -450,7 +450,7 @@ config TWL4030_MADC
> >   
> >   config TWL6030_GPADC
> >   	tristate "TWL6030 GPADC (General Purpose A/D Converter) Support"
> > -	depends on TWL4030_CORE
> > +	depends on TWL_CORE
> >   	default n
> >   	help
> >   	  Say yes here if you want support for the TWL6030/TWL6032 General
> > diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
> > index 509608c..9cfa09b 100644
> > --- a/drivers/input/keyboard/Kconfig
> > +++ b/drivers/input/keyboard/Kconfig
> > @@ -653,7 +653,7 @@ config KEYBOARD_TC3589X
> >   
> >   config KEYBOARD_TWL4030
> >   	tristate "TI TWL4030/TWL5030/TPS659x0 keypad support"
> > -	depends on TWL4030_CORE
> > +	depends on TWL_CORE
> >   	select INPUT_MATRIXKMAP
> >   	help
> >   	  Say Y here if your board use the keypad controller on
> > diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
> > index 1f2337a..6abb6df 100644
> > --- a/drivers/input/misc/Kconfig
> > +++ b/drivers/input/misc/Kconfig
> > @@ -461,7 +461,7 @@ config INPUT_AXP20X_PEK
> >   
> >   config INPUT_TWL4030_PWRBUTTON
> >   	tristate "TWL4030 Power button Driver"
> > -	depends on TWL4030_CORE
> > +	depends on TWL_CORE
> >   	help
> >   	  Say Y here if you want to enable power key reporting via the
> >   	  TWL4030 family of chips.
> > @@ -471,7 +471,7 @@ config INPUT_TWL4030_PWRBUTTON
> >   
> >   config INPUT_TWL4030_VIBRA
> >   	tristate "Support for TWL4030 Vibrator"
> > -	depends on TWL4030_CORE
> > +	depends on TWL_CORE
> >   	select MFD_TWL4030_AUDIO
> >   	select INPUT_FF_MEMLESS
> >   	help
> > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> > index eea61e3..28bfe3d 100644
> > --- a/drivers/mfd/Kconfig
> > +++ b/drivers/mfd/Kconfig
> > @@ -1266,7 +1266,7 @@ config MFD_TPS80031
> >   	  ADC, RTC, 2 PWM, System Voltage Regulator/Battery Charger with
> >   	  Power Path from USB, 32K clock generator.
> >   
> > -config TWL4030_CORE
> > +config TWL_CORE
> >   	bool "TI TWL4030/TWL5030/TWL6030/TPS659x0 Support"
> >   	depends on I2C=y
> >   	select IRQ_DOMAIN
> > @@ -1284,7 +1284,7 @@ config TWL4030_CORE
> >   
> >   config TWL4030_POWER
> >   	bool "TI TWL4030 power resources"
> > -	depends on TWL4030_CORE && ARM
> > +	depends on TWL_CORE && ARM
> >   	help
> >   	  Say yes here if you want to use the power resources on the
> >   	  TWL4030 family chips.  Most of these resources are regulators,
> > @@ -1297,7 +1297,7 @@ config TWL4030_POWER
> >   
> >   config MFD_TWL4030_AUDIO
> >   	bool "TI TWL4030 Audio"
> > -	depends on TWL4030_CORE
> > +	depends on TWL_CORE
> >   	select MFD_CORE
> >   	default n
> >   
> > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> > index 5eaa6465d..7daeab5 100644
> > --- a/drivers/mfd/Makefile
> > +++ b/drivers/mfd/Makefile
> > @@ -81,7 +81,7 @@ obj-$(CONFIG_MFD_TPS65912_SPI)  += tps65912-spi.o
> >   obj-$(CONFIG_MFD_TPS80031)	+= tps80031.o
> >   obj-$(CONFIG_MENELAUS)		+= menelaus.o
> >   
> > -obj-$(CONFIG_TWL4030_CORE)	+= twl-core.o twl4030-irq.o twl6030-irq.o
> > +obj-$(CONFIG_TWL_CORE)	+= twl-core.o twl4030-irq.o twl6030-irq.o
> >   obj-$(CONFIG_TWL4030_POWER)    += twl4030-power.o
> >   obj-$(CONFIG_MFD_TWL4030_AUDIO)	+= twl4030-audio.o
> >   obj-$(CONFIG_TWL6040_CORE)	+= twl6040.o
> > diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c
> > index 40e51b0..52dc294 100644
> > --- a/drivers/mfd/twl4030-irq.c
> > +++ b/drivers/mfd/twl4030-irq.c
> > @@ -54,7 +54,7 @@
> >    *	base + 8  .. base + 15	SIH for PWR_INT
> >    *	base + 16 .. base + 33	SIH for GPIO
> >    */
> > -#define TWL4030_CORE_NR_IRQS	8
> > +#define TWL_CORE_NR_IRQS	8
> >   #define TWL4030_PWR_NR_IRQS	8
> >   
> >   /* PIH register offsets */
> > @@ -693,7 +693,7 @@ int twl4030_init_irq(struct device *dev, int irq_num)
> >   	 * the hwirqs numbers are defined contiguously from 1 to 15.
> >   	 * Create only one domain for both.
> >   	 */
> > -	nr_irqs = TWL4030_PWR_NR_IRQS + TWL4030_CORE_NR_IRQS;
> > +	nr_irqs = TWL4030_PWR_NR_IRQS + TWL_CORE_NR_IRQS;
> >   
> >   	irq_base = irq_alloc_descs(-1, 0, nr_irqs, 0);
> >   	if (IS_ERR_VALUE(irq_base)) {
> > @@ -704,7 +704,7 @@ int twl4030_init_irq(struct device *dev, int irq_num)
> >   	irq_domain_add_legacy(node, nr_irqs, irq_base, 0,
> >   			      &irq_domain_simple_ops, NULL);
> >   
> > -	irq_end = irq_base + TWL4030_CORE_NR_IRQS;
> > +	irq_end = irq_base + TWL_CORE_NR_IRQS;
> >   
> >   	/*
> >   	 * Mask and clear all TWL4030 interrupts since initially we do
> > diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> > index 26566db..6193565 100644
> > --- a/drivers/phy/Kconfig
> > +++ b/drivers/phy/Kconfig
> > @@ -164,7 +164,7 @@ config TI_PIPE3
> >   
> >   config TWL4030_USB
> >   	tristate "TWL4030 USB Transceiver Driver"
> > -	depends on TWL4030_CORE && REGULATOR_TWL4030 && USB_MUSB_OMAP2PLUS
> > +	depends on TWL_CORE && REGULATOR_TWL4030 && USB_MUSB_OMAP2PLUS
> >   	depends on USB_SUPPORT
> >   	select GENERIC_PHY
> >   	select USB_PHY
> > diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
> > index 421770d..cc5fe9a 100644
> > --- a/drivers/power/Kconfig
> > +++ b/drivers/power/Kconfig
> > @@ -323,7 +323,7 @@ config CHARGER_MAX8903
> >   
> >   config CHARGER_TWL4030
> >   	tristate "OMAP TWL4030 BCI charger driver"
> > -	depends on IIO && TWL4030_CORE
> > +	depends on IIO && TWL_CORE
> >   	help
> >   	  Say Y here to enable support for TWL4030 Battery Charge
> > Interface.
> >   
> > diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
> > index c182efc..6318f19 100644
> > --- a/drivers/pwm/Kconfig
> > +++ b/drivers/pwm/Kconfig
> > @@ -413,7 +413,7 @@ config  PWM_TIPWMSS
> >   
> >   config PWM_TWL
> >   	tristate "TWL4030/6030 PWM support"
> > -	depends on TWL4030_CORE
> > +	depends on TWL_CORE
> >   	help
> >   	  Generic PWM framework driver for TWL4030/6030.
> >   
> > @@ -422,7 +422,7 @@ config PWM_TWL
> >   
> >   config PWM_TWL_LED
> >   	tristate "TWL4030/6030 PWM support for LED drivers"
> > -	depends on TWL4030_CORE
> > +	depends on TWL_CORE
> >   	help
> >   	  Generic PWM framework driver for TWL4030/6030 LED terminals.
> >   
> > diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
> > index c77dc08..b62b4b4 100644
> > --- a/drivers/regulator/Kconfig
> > +++ b/drivers/regulator/Kconfig
> > @@ -803,7 +803,7 @@ config REGULATOR_TPS80031
> >   
> >   config REGULATOR_TWL4030
> >   	tristate "TI TWL4030/TWL5030/TWL6030/TPS659x0 PMIC"
> > -	depends on TWL4030_CORE
> > +	depends on TWL_CORE
> >   	help
> >   	  This driver supports the voltage regulators provided by
> >   	  this family of companion chips.
> > diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> > index 3e84315..198ac54 100644
> > --- a/drivers/rtc/Kconfig
> > +++ b/drivers/rtc/Kconfig
> > @@ -462,7 +462,7 @@ config RTC_DRV_TWL92330
> >   
> >   config RTC_DRV_TWL4030
> >   	tristate "TI TWL4030/TWL5030/TWL6030/TPS659x0"
> > -	depends on TWL4030_CORE
> > +	depends on TWL_CORE
> >   	help
> >   	  If you say yes here you get support for the RTC on the
> >   	  TWL4030/TWL5030/TWL6030 family chips, used mostly with OMAP3
> > platforms.
> > diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
> > index c690474..2911b11 100644
> > --- a/drivers/usb/phy/Kconfig
> > +++ b/drivers/usb/phy/Kconfig
> > @@ -80,7 +80,7 @@ config SAMSUNG_USBPHY
> >   
> >   config TWL6030_USB
> >   	tristate "TWL6030 USB Transceiver Driver"
> > -	depends on TWL4030_CORE && OMAP_USB2 && USB_MUSB_OMAP2PLUS
> > +	depends on TWL_CORE && OMAP_USB2 && USB_MUSB_OMAP2PLUS
> >   	help
> >   	  Enable this to support the USB OTG transceiver on TWL6030
> >   	  family chips. This TWL6030 transceiver has the VBUS and ID GND
> > diff --git a/drivers/video/backlight/Kconfig
> > b/drivers/video/backlight/Kconfig
> > index 5ffa4b4..8d6e4e0 100644
> > --- a/drivers/video/backlight/Kconfig
> > +++ b/drivers/video/backlight/Kconfig
> > @@ -412,7 +412,7 @@ config BACKLIGHT_OT200
> >   
> >   config BACKLIGHT_PANDORA
> >   	tristate "Backlight driver for Pandora console"
> > -	depends on TWL4030_CORE
> > +	depends on TWL_CORE
> >   	help
> >   	  If you have a Pandora console, say Y to enable the
> >   	  backlight driver.
> > diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> > index fb94765..4b24418 100644
> > --- a/drivers/watchdog/Kconfig
> > +++ b/drivers/watchdog/Kconfig
> > @@ -462,7 +462,7 @@ config COH901327_WATCHDOG
> >   
> >   config TWL4030_WATCHDOG
> >   	tristate "TWL4030 Watchdog"
> > -	depends on TWL4030_CORE
> > +	depends on TWL_CORE
> >   	select WATCHDOG_CORE
> >   	help
> >   	  Support for TI TWL4030 watchdog.  Say 'Y' here to enable the
> > diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
> > index 4e7ea5f..2decb190 100644
> > --- a/include/linux/i2c/twl.h
> > +++ b/include/linux/i2c/twl.h
> > @@ -214,7 +214,7 @@ int twl6030_interrupt_unmask(u8 bit_mask, u8 offset);
> >   int twl6030_interrupt_mask(u8 bit_mask, u8 offset);
> >   
> >   /* Card detect Configuration for MMC1 Controller on OMAP4 */
> > -#ifdef CONFIG_TWL4030_CORE
> > +#ifdef CONFIG_TWL_CORE
> >   int twl6030_mmc_card_detect_config(void);
> >   #else
> >   static inline int twl6030_mmc_card_detect_config(void)
> > @@ -225,7 +225,7 @@ static inline int twl6030_mmc_card_detect_config(void)
> >   #endif
> >   
> >   /* MMC1 Controller on OMAP4 uses Phoenix irq for Card detect */
> > -#ifdef CONFIG_TWL4030_CORE
> > +#ifdef CONFIG_TWL_CORE
> >   int twl6030_mmc_card_detect(struct device *dev, int slot);
> >   #else
> >   static inline int twl6030_mmc_card_detect(struct device *dev, int slot)
> > diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
> > index 649e92a..009feb4 100644
> > --- a/sound/soc/codecs/Kconfig
> > +++ b/sound/soc/codecs/Kconfig
> > @@ -134,7 +134,7 @@ config SND_SOC_ALL_CODECS
> >   	select SND_SOC_TPA6130A2 if I2C
> >   	select SND_SOC_TLV320DAC33 if I2C
> >   	select SND_SOC_TS3A227E if I2C
> > -	select SND_SOC_TWL4030 if TWL4030_CORE
> > +	select SND_SOC_TWL4030 if TWL_CORE
> >   	select SND_SOC_TWL6040 if TWL6040_CORE
> >   	select SND_SOC_UDA134X
> >   	select SND_SOC_UDA1380 if I2C
> > diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
> > index 5185a38..49af002 100644
> > --- a/sound/soc/omap/Kconfig
> > +++ b/sound/soc/omap/Kconfig
> > @@ -85,7 +85,7 @@ config SND_OMAP_SOC_AM3517EVM
> >   
> >   config SND_OMAP_SOC_OMAP_TWL4030
> >   	tristate "SoC Audio support for TI SoC based boards with twl4030
> > codec"
> > -	depends on TWL4030_CORE && SND_OMAP_SOC
> > +	depends on TWL_CORE && SND_OMAP_SOC
> >   	select SND_OMAP_SOC_MCBSP
> >   	select SND_SOC_TWL4030
> >   	help
> > @@ -117,7 +117,7 @@ config SND_OMAP_SOC_OMAP_ABE_TWL6040
> >   
> >   config SND_OMAP_SOC_OMAP3_PANDORA
> >   	tristate "SoC Audio support for OMAP3 Pandora"
> > -	depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP3_PANDORA
> > +	depends on TWL_CORE && SND_OMAP_SOC && MACH_OMAP3_PANDORA
> >   	select SND_OMAP_SOC_MCBSP
> >   	select SND_SOC_TWL4030
> >   	help
> > 
> 

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 4/8] mfd: Add TWL6030 power driver, with minimal support for power off
  2016-03-30 15:56   ` Grygorii Strashko
@ 2016-04-02 20:14     ` Paul Kocialkowski
  0 siblings, 0 replies; 19+ messages in thread
From: Paul Kocialkowski @ 2016-04-02 20:14 UTC (permalink / raw)
  To: Grygorii Strashko, linux-kernel, linux-omap, linux-pm, devicetree
  Cc: Rob Herring, Tony Lindgren, Dmitry Torokhov, Sebastian Reichel,
	Dmitry Eremin-Solenikov, David Woodhouse

[-- Attachment #1: Type: text/plain, Size: 8707 bytes --]

Le mercredi 30 mars 2016 à 18:56 +0300, Grygorii Strashko a écrit :
> On 03/29/2016 10:22 PM, Paul Kocialkowski wrote:
> > 
> > This adds a TWL6030 power driver, that currently only supports powering off
> > the
> > device when the TWL is used as system power controller.
> > 
> > This driver might be extended to support more power-related features of the
> > TWL6030.
> > 
> > Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> > ---
> >   .../devicetree/bindings/mfd/twl6030-power.txt      |  31 +++++++
> >   drivers/mfd/Kconfig                                |  10 ++
> >   drivers/mfd/Makefile                               |   5 +-
> >   drivers/mfd/twl-core.c                             |   8 ++
> >   drivers/mfd/twl6030-power.c                        | 102
> > +++++++++++++++++++++
> Seems proper place for this driver is drivers/power/reset.

twl4030-power is in drivers/mfd/ and contains similar functions. Should those be
split into a separate driver in driver/power/reset?

If not, I'd rather keep this basic driver in drivers/mfd/ since it might be
extended later to support more power-related things.

> >   5 files changed, 154 insertions(+), 2 deletions(-)
> >   create mode 100644 Documentation/devicetree/bindings/mfd/twl6030-power.txt
> >   create mode 100644 drivers/mfd/twl6030-power.c
> > 
> > diff --git a/Documentation/devicetree/bindings/mfd/twl6030-power.txt
> > b/Documentation/devicetree/bindings/mfd/twl6030-power.txt
> > new file mode 100644
> > index 0000000..97600e7
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mfd/twl6030-power.txt
> > @@ -0,0 +1,31 @@
> > +Texas Instruments TWL family (twl6030) reset and power management module
> > +
> > +For now, the binding only supports the complete shutdown of the system
> > after
> > +poweroff.
> > +
> > +Required properties:
> > +- compatible : must be
> > +	"ti,twl6030-power"
> > +
> > +Optional properties:
> > +
> > +- ti,system-power-controller: This indicates that TWL6030 is the
> > +  power supply master of the system. With this flag, the chip will
> > +  initiate an ACTIVE-to-OFF or SLEEP-to-OFF transition when the
> > +  system poweroffs.
> > +
> > +Example:
> > +&i2c1 {
> > +	clock-frequency = <2600000>;
> > +
> > +	twl: twl@48 {
> > +		reg = <0x48>;
> > +		interrupts = <7>; /* SYS_NIRQ cascaded to intc */
> > +		interrupt-parent = <&intc>;
> > +
> > +		twl_power: power {
> > +			compatible = "ti,twl6030-power";
> > +			ti,system-power-controller;
> > +		};
> > +	};
> > +};
> > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> > index 28bfe3d..a0a8012 100644
> > --- a/drivers/mfd/Kconfig
> > +++ b/drivers/mfd/Kconfig
> > @@ -1301,6 +1301,16 @@ config MFD_TWL4030_AUDIO
> >   	select MFD_CORE
> >   	default n
> > 
> > +config TWL6030_POWER
> > +	bool "TI TWL6030 power resources"
> > +	depends on TWL_CORE && ARM
> > +	help
> > +	  Say yes here if you want to use the power resources on the
> > +	  TWL6030 family chips.
> > +
> > +	  When used as system power controller, this driver allows turning
> > off
> > +	  the main power supply.
> > +
> >   config TWL6040_CORE
> >   	bool "TI TWL6040 audio codec"
> >   	depends on I2C=y
> > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> > index 7daeab5..5aa16c8 100644
> > --- a/drivers/mfd/Makefile
> > +++ b/drivers/mfd/Makefile
> > @@ -81,9 +81,10 @@ obj-$(CONFIG_MFD_TPS65912_SPI)  += tps65912-spi.o
> >   obj-$(CONFIG_MFD_TPS80031)	+= tps80031.o
> >   obj-$(CONFIG_MENELAUS)		+= menelaus.o
> > 
> > -obj-$(CONFIG_TWL_CORE)	+= twl-core.o twl4030-irq.o twl6030-irq.o
> > -obj-$(CONFIG_TWL4030_POWER)    += twl4030-power.o
> > +obj-$(CONFIG_TWL_CORE)		+= twl-core.o twl4030-irq.o twl6030-
> > irq.o
> > +obj-$(CONFIG_TWL4030_POWER)	+= twl4030-power.o
> >   obj-$(CONFIG_MFD_TWL4030_AUDIO)	+= twl4030-audio.o
> > +obj-$(CONFIG_TWL6030_POWER)	+= twl6030-power.o
> >   obj-$(CONFIG_TWL6040_CORE)	+= twl6040.o
> > 
> >   obj-$(CONFIG_MFD_MX25_TSADC)	+= fsl-imx25-tsadc.o
> > diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
> > index dae52f7..74372bc 100644
> > --- a/drivers/mfd/twl-core.c
> > +++ b/drivers/mfd/twl-core.c
> > @@ -972,6 +972,14 @@ add_children(struct twl_platform_data *pdata, unsigned
> > irq_base,
> >   			return PTR_ERR(child);
> >   	}
> > 
> > +	if (IS_ENABLED(CONFIG_TWL6030_POWER) && pdata->power) {
> > +		child = add_child(TWL_MODULE_PM_MASTER, "twl6030_power",
> > +				  pdata->power, sizeof(*pdata->power),
> > false,
> > +				  0, 0);
> > +		if (IS_ERR(child))
> > +			return PTR_ERR(child);
> > +	}
> > +
> non-DT boot option is not supported for twl6030 any more and
> all related code was removed already.
> 
> > 
> >   	return 0;
> >   }
> > 
> > diff --git a/drivers/mfd/twl6030-power.c b/drivers/mfd/twl6030-power.c
> > new file mode 100644
> > index 0000000..a0bb6d8
> > --- /dev/null
> > +++ b/drivers/mfd/twl6030-power.c
> > @@ -0,0 +1,102 @@
> > +/*
> > + * TWL6030 power
> > + *
> > + * Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
> > + *
> > + * This file is subject to the terms and conditions of the GNU General
> > + * Public License. See the file "COPYING" in the main directory of this
> > + * archive for more details.
> > + *
> > + * This program is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > + * GNU General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU General Public License
> > + * along with this program; if not, write to the Free Software
> > + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-
> > 1307  USA
> I think header should look different now (but not sure).
> 
> > 
> > + */
> > +
> > +#include <linux/module.h>
> > +#include <linux/pm.h>
> > +#include <linux/i2c/twl.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/of.h>
> > +#include <linux/of_device.h>
> > +
> > +#define TWL6030_PHOENIX_DEV_ON		0x25
> > +
> > +#define TWL6030_PHOENIX_APP_DEVOFF	(1 << 0)
> > +#define TWL6030_PHOENIX_CON_DEVOFF	(1 << 1)
> > +#define TWL6030_PHOENIX_MOD_DEVOFF	(1 << 2)
> > +
> > +void twl6030_power_off(void)
> > +{
> > +	int err;
> > +
> > +	err = twl_i2c_write_u8(TWL6030_MODULE_ID0,
> > TWL6030_PHOENIX_APP_DEVOFF |
> > +		TWL6030_PHOENIX_CON_DEVOFF | TWL6030_PHOENIX_MOD_DEVOFF,
> > +		TWL6030_PHOENIX_DEV_ON);
> > +	if (err)
> > +		pr_err("TWL6030 Unable to power off\n");
> > +}
> > +
> > +static bool twl6030_power_use_poweroff(const struct twl_power_data *pdata,
> > +	struct device_node *node)
> > +{
> > +	if (pdata && pdata->use_poweroff)
> > +		return true;
> the same comment as above - only DT support for this PMIC as of now.
> 
> > 
> > +
> > +	if (of_property_read_bool(node, "ti,system-power-controller"))
> > +		return true;
> > +
> > +	return false;
> > +}
> > +
> > +#ifdef CONFIG_OF
> > +static const struct of_device_id twl6030_power_of_match[] = {
> > +	{
> > +		.compatible = "ti,twl6030-power",
> > +	},
> > +	{ },
> > +};
> > +
> > +MODULE_DEVICE_TABLE(of, twl6030_power_of_match);
> > +#endif	/* CONFIG_OF */
> > +
> > +static int twl6030_power_probe(struct platform_device *pdev)
> > +{
> > +	const struct twl_power_data *pdata = dev_get_platdata(&pdev->dev);
> > +	struct device_node *node = pdev->dev.of_node;
> > +
> > +	if (!pdata && !node) {
> > +		dev_err(&pdev->dev, "Platform data is missing\n");
> > +		return -EINVAL;
> > +	}
> > +
> > +	/* Board has to be wired properly to use this feature */
> > +	if (twl6030_power_use_poweroff(pdata, node) && !pm_power_off)
> > +		pm_power_off = twl6030_power_off;
> > +
> > +	return 0;
> > +}
> > +
> > +static int twl6030_power_remove(struct platform_device *pdev)
> > +{
> > +	return 0;
> > +}
> > +
> > +static struct platform_driver twl6030_power_driver = {
> > +	.driver = {
> > +		.name	= "twl6030_power",
> > +		.of_match_table = of_match_ptr(twl6030_power_of_match),
> > +	},
> > +	.probe		= twl6030_power_probe,
> > +	.remove		= twl6030_power_remove,
> > +};
> > +
> > +module_platform_driver(twl6030_power_driver);
> > +
> > +MODULE_AUTHOR("Paul Kocialkowski <contact@paulk.fr>");
> > +MODULE_DESCRIPTION("Power management for TWL6030");
> > +MODULE_LICENSE("GPL");
> > 
> 

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 7/8] input: misc: Add TWL6030 power button support to twl-pwrbutton
  2016-03-30 16:16   ` Grygorii Strashko
@ 2016-04-02 20:30     ` Paul Kocialkowski
  0 siblings, 0 replies; 19+ messages in thread
From: Paul Kocialkowski @ 2016-04-02 20:30 UTC (permalink / raw)
  To: Grygorii Strashko, linux-kernel, linux-omap, linux-pm, devicetree
  Cc: Rob Herring, Tony Lindgren, Dmitry Torokhov, Sebastian Reichel,
	Dmitry Eremin-Solenikov, David Woodhouse

[-- Attachment #1: Type: text/plain, Size: 18972 bytes --]

Hi,

Le mercredi 30 mars 2016 à 19:16 +0300, Grygorii Strashko a écrit :
> On 03/29/2016 10:22 PM, Paul Kocialkowski wrote:
> > 
> > This renames the twl4030-pwrbutton driver to twl-pwrbutton, since power
> > button
> > handling is very similar on most TWL chips. This also introduces TWL6030
> > power
> > button support.
> > 
> > TWL6030 power button support requires the following additional changes:
> > * Devicetree binding and support
> > * Interrupt unmasking and remasking support
>
> Again. pls, do not mix clean up/beautification and adding new features.
> And don't mix DT changes with code changes.

Thanks for the review!

I'll split that one into smaller logical chunks then.

> > Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> > ---
> >   .../devicetree/bindings/input/twl-pwrbutton.txt    |  22 ++++
> >   .../bindings/input/twl4030-pwrbutton.txt           |  21 ---
> >   arch/arm/boot/dts/twl6030.dtsi                     |   5 +
> >   arch/arm/configs/omap2plus_defconfig               |   2 +-
> >   drivers/input/misc/Kconfig                         |   8 +-
> >   drivers/input/misc/Makefile                        |   2 +-
> >   drivers/input/misc/twl-pwrbutton.c                 | 143
> > +++++++++++++++++++++
> >   drivers/input/misc/twl4030-pwrbutton.c             | 116 -----------------
> >   drivers/mfd/twl-core.c                             |  12 +-
> >   include/linux/i2c/twl.h                            |   1 +
> >   10 files changed, 187 insertions(+), 145 deletions(-)
> >   create mode 100644 Documentation/devicetree/bindings/input/twl-
> > pwrbutton.txt
> >   delete mode 100644 Documentation/devicetree/bindings/input/twl4030-
> > pwrbutton.txt
> >   create mode 100644 drivers/input/misc/twl-pwrbutton.c
> >   delete mode 100644 drivers/input/misc/twl4030-pwrbutton.c
> > 
> > diff --git a/Documentation/devicetree/bindings/input/twl-pwrbutton.txt
> > b/Documentation/devicetree/bindings/input/twl-pwrbutton.txt
> > new file mode 100644
> > index 0000000..4931be4
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/input/twl-pwrbutton.txt
> > @@ -0,0 +1,22 @@
> > +Texas Instruments TWL family pwrbutton module
> > +
> > +This module is part of a TWL chip. For more details about the whole
> > +chip see Documentation/devicetree/bindings/mfd/twl-familly.txt.
> > +
> > +This module provides a simple power button event via an Interrupt.
> > +
> > +Required properties:
> > +- compatible: should be one of the following
> > +   - "ti,twl4030-pwrbutton": For controllers compatible with twl4030
> > +   - "ti,twl6030-pwrbutton": For controllers compatible with twl6030
> > +- interrupts: should be one of the following
> > +   - <8>: For controllers compatible with the twl
> > +
> > +Example:
> > +
> > +&twl {
> > +	twl_pwrbutton: pwrbutton {
> > +		compatible = "ti,twl4030-pwrbutton";
> > +		interrupts = <8>;
> > +	};
> > +};
> > diff --git a/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
> > b/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
> > deleted file mode 100644
> > index c864a46..0000000
> > --- a/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
> > +++ /dev/null
> > @@ -1,21 +0,0 @@
> > -Texas Instruments TWL family (twl4030) pwrbutton module
> > -
> > -This module is part of the TWL4030. For more details about the whole
> > -chip see Documentation/devicetree/bindings/mfd/twl-familly.txt.
> > -
> > -This module provides a simple power button event via an Interrupt.
> > -
> > -Required properties:
> > -- compatible: should be one of the following
> > -   - "ti,twl4030-pwrbutton": For controllers compatible with twl4030
> > -- interrupts: should be one of the following
> > -   - <8>: For controllers compatible with twl4030
> > -
> > -Example:
> > -
> > -&twl {
> > -	twl_pwrbutton: pwrbutton {
> > -		compatible = "ti,twl4030-pwrbutton";
> > -		interrupts = <8>;
> > -	};
> > -};
> > diff --git a/arch/arm/boot/dts/twl6030.dtsi b/arch/arm/boot/dts/twl6030.dtsi
> > index 55eb35f..6a52df1 100644
> > --- a/arch/arm/boot/dts/twl6030.dtsi
> > +++ b/arch/arm/boot/dts/twl6030.dtsi
> > @@ -99,4 +99,9 @@
> >   		compatible = "ti,twl6030-pwmled";
> >   		#pwm-cells = <2>;
> >   	};
> > +
> > +	twl_pwrbutton: pwrbutton {
> > +		compatible = "ti,twl6030-pwrbutton";
> > +		interrupts = <0>;
> > +	};
> >   };
> > diff --git a/arch/arm/configs/omap2plus_defconfig
> > b/arch/arm/configs/omap2plus_defconfig
> > index 156bc88..ff9752a 100644
> > --- a/arch/arm/configs/omap2plus_defconfig
> > +++ b/arch/arm/configs/omap2plus_defconfig
> > @@ -217,7 +217,7 @@ CONFIG_TOUCHSCREEN_TSC2007=m
> >   CONFIG_TOUCHSCREEN_TI_AM335X_TSC=m
> >   CONFIG_INPUT_MISC=y
> >   CONFIG_INPUT_TPS65218_PWRBUTTON=m
> > -CONFIG_INPUT_TWL4030_PWRBUTTON=m
> > +CONFIG_INPUT_TWL_PWRBUTTON=m
> >   CONFIG_INPUT_PALMAS_PWRBUTTON=m
> >   CONFIG_SERIO=m
> >   # CONFIG_LEGACY_PTYS is not set
> > diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
> > index 6abb6df..f643e14 100644
> > --- a/drivers/input/misc/Kconfig
> > +++ b/drivers/input/misc/Kconfig
> > @@ -459,15 +459,15 @@ config INPUT_AXP20X_PEK
> >   	  be called axp20x-pek.
> >   
> >   
> > -config INPUT_TWL4030_PWRBUTTON
> > -	tristate "TWL4030 Power button Driver"
> > +config INPUT_TWL_PWRBUTTON
> > +	tristate "TWL Power button Driver"
> >   	depends on TWL_CORE
> >   	help
> >   	  Say Y here if you want to enable power key reporting via the
> > -	  TWL4030 family of chips.
> > +	  TWL family of chips.
> >   
> >   	  To compile this driver as a module, choose M here. The module
> > will
> > -	  be called twl4030_pwrbutton.
> > +	  be called twl_pwrbutton.
> >   
> >   config INPUT_TWL4030_VIBRA
> >   	tristate "Support for TWL4030 Vibrator"
> > diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
> > index 0357a08..f77f5e7 100644
> > --- a/drivers/input/misc/Makefile
> > +++ b/drivers/input/misc/Makefile
> > @@ -66,7 +66,7 @@ obj-$(CONFIG_INPUT_SIRFSOC_ONKEY)	+= sirfsoc-
> > onkey.o
> >   obj-$(CONFIG_INPUT_SOC_BUTTON_ARRAY)	+= soc_button_array.o
> >   obj-$(CONFIG_INPUT_SPARCSPKR)		+= sparcspkr.o
> >   obj-$(CONFIG_INPUT_TPS65218_PWRBUTTON)	+= tps65218-pwrbutton.o
> > -obj-$(CONFIG_INPUT_TWL4030_PWRBUTTON)	+= twl4030-pwrbutton.o
> > +obj-$(CONFIG_INPUT_TWL_PWRBUTTON)	+= twl-pwrbutton.o
> >   obj-$(CONFIG_INPUT_TWL4030_VIBRA)	+= twl4030-vibra.o
> >   obj-$(CONFIG_INPUT_TWL6040_VIBRA)	+= twl6040-vibra.o
> >   obj-$(CONFIG_INPUT_UINPUT)		+= uinput.o
> > diff --git a/drivers/input/misc/twl-pwrbutton.c b/drivers/input/misc/twl-
> > pwrbutton.c
> > new file mode 100644
> > index 0000000..a7bc8ad
> > --- /dev/null
> > +++ b/drivers/input/misc/twl-pwrbutton.c
> > @@ -0,0 +1,143 @@
> > +/**
> > + * twl4030-pwrbutton.c - TWL4030 Power Button Input Driver

This should probably be changed, by the way.

> > + * Copyright (C) 2008-2009 Nokia Corporation
> > + *
> > + * Written by Peter De Schrijver <peter.de-schrijver@nokia.com>
> > + * Several fixes by Felipe Balbi <felipe.balbi@nokia.com>
> > + *
> > + * This file is subject to the terms and conditions of the GNU General
> > + * Public License. See the file "COPYING" in the main directory of this
> > + * archive for more details.
> > + *
> > + * This program is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > + * GNU General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU General Public License
> > + * along with this program; if not, write to the Free Software
> > + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-
> > 1307  USA
> > + */
> > +
> > +#include <linux/module.h>
> > +#include <linux/init.h>
> > +#include <linux/kernel.h>
> > +#include <linux/errno.h>
> > +#include <linux/input.h>
> > +#include <linux/interrupt.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/i2c/twl.h>
> > +
> > +#define PWR_PWRON_IRQ (1 << 0)
> > +
> > +#define TWL4030_STS_HW_CONDITIONS 0x0f
> > +#define TWL6030_STS_HW_CONDITIONS 0x21
> > +
> > +static irqreturn_t powerbutton_irq(int irq, void *_pwr)
> > +{
> > +	struct input_dev *pwr = _pwr;
> > +	int err;
> > +	u8 value;
> > +
> > +	if (twl_class_is_4030())
> one of the benefits of using DT is that we can get rid of code
> like above - compatible string should provide enough info.

I fully agree with you here, especially given what twl_class_is_4030 is actually
doing.

If we're not going to use platform data at all for supporting twl6030 on this
driver, let's just fallback to twl4030 when dt is not used.

> > +		err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &value,
> > +				TWL4030_STS_HW_CONDITIONS);
> > +	else
> > +		err = twl_i2c_read_u8(TWL6030_MODULE_ID0, &value,
> > +				TWL6030_STS_HW_CONDITIONS);
> > +
> > +	if (!err)  {
> > +		pm_wakeup_event(pwr->dev.parent, 0);
> > +		input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ);
> > +		input_sync(pwr);
> > +	} else {
> > +		dev_err(pwr->dev.parent, "twl4030: i2c error %d while
> > reading"
> > +			" TWL4030 PM_MASTER STS_HW_CONDITIONS register\n",
> > err);
> > +	}
> > +
> > +	return IRQ_HANDLED;
> > +}
> > +
> > +static int twl_pwrbutton_probe(struct platform_device *pdev)
> > +{
> > +	struct input_dev *pwr;
> > +	int irq = platform_get_irq(pdev, 0);
> It may fail ?! and return -EPROBE_DEFER

Fair enough, not that this is inherited from the previous driver, but a cleanup
won't hurt. I should probably have formatted the patch with -M though.

> > +	int err;
> > +
> > +	pwr = devm_input_allocate_device(&pdev->dev);
> > +	if (!pwr) {
> > +		dev_err(&pdev->dev, "Can't allocate power button\n");
> > +		return -ENOMEM;
> > +	}
> > +
> > +	pwr->evbit[0] = BIT_MASK(EV_KEY);
> > +	pwr->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);
> > +	pwr->name = "twl_pwrbutton";
> > +	pwr->phys = "twl_pwrbutton/input0";
> > +	pwr->dev.parent = &pdev->dev;
> > +
> > +	if (twl_class_is_6030()) {
> > +		twl6030_interrupt_unmask(TWL6030_PWRON_INT_MASK,
> > +			REG_INT_MSK_LINE_A);
> > +		twl6030_interrupt_unmask(TWL6030_PWRON_INT_MASK,
> > +			REG_INT_MSK_STS_A);
> Seems it's time to update twl6030-irq.c and add enable_irq()/disable_irq()
> functionality.

I'll look into that.

> > 
> > +	}
> > +
> > +	err = devm_request_threaded_irq(&pwr->dev, irq, NULL,
> > powerbutton_irq,
> > +			IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING |
> > +			IRQF_ONESHOT,
> > +			"twl_pwrbutton", pwr);
> > +	if (err < 0) {
> > +		dev_err(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n",
> > err);
> > +		return err;
> > +	}
> > +
> > +	err = input_register_device(pwr);
> > +	if (err) {
> > +		dev_err(&pdev->dev, "Can't register power button: %d\n",
> > err);
> > +		return err;
> > +	}
> > +
> > +	platform_set_drvdata(pdev, pwr);
> > +	device_init_wakeup(&pdev->dev, true);
> > +
> > +	return 0;
> > +}
> > +
> > +static int twl_pwrbutton_remove(struct platform_device *pdev)
> > +{
> > +	if (twl_class_is_6030()) {
> > +		twl6030_interrupt_mask(TWL6030_PWRON_INT_MASK,
> > +			REG_INT_MSK_LINE_A);
> > +		twl6030_interrupt_mask(TWL6030_PWRON_INT_MASK,
> > +			REG_INT_MSK_STS_A);
> > +	}
> 	device_init_wakeup(&pdev->dev, 0);
> 
> 
> > 
> > +
> > +	return 0;
> > +}
> > +
> > +#ifdef CONFIG_OF
> > +static const struct of_device_id twl_pwrbutton_dt_match_table[] = {
> > +       { .compatible = "ti,twl4030-pwrbutton" },
> > +       { .compatible = "ti,twl6030-pwrbutton" },
> > +       {},
> > +};
> > +MODULE_DEVICE_TABLE(of, twl_pwrbutton_dt_match_table);
> > +#endif
> > +
> > +static struct platform_driver twl_pwrbutton_driver = {
> > +	.probe		= twl_pwrbutton_probe,
> > +	.remove		= twl_pwrbutton_remove,
> > +	.driver		= {
> > +		.name	= "twl_pwrbutton",
> > +		.of_match_table =
> > of_match_ptr(twl_pwrbutton_dt_match_table),
> > +	},
> > +};
> > +module_platform_driver(twl_pwrbutton_driver);
> > +
> > +MODULE_ALIAS("platform:twl_pwrbutton");
> > +MODULE_DESCRIPTION("TWL Power Button");
> > +MODULE_LICENSE("GPL");
> > +MODULE_AUTHOR("Peter De Schrijver <peter.de-schrijver@nokia.com>");
> > +MODULE_AUTHOR("Felipe Balbi <felipe.balbi@nokia.com>");
> > diff --git a/drivers/input/misc/twl4030-pwrbutton.c
> > b/drivers/input/misc/twl4030-pwrbutton.c
> > deleted file mode 100644
> > index 603fc2f..0000000
> > --- a/drivers/input/misc/twl4030-pwrbutton.c
> > +++ /dev/null
> > @@ -1,116 +0,0 @@
> > -/**
> > - * twl4030-pwrbutton.c - TWL4030 Power Button Input Driver
> > - *
> > - * Copyright (C) 2008-2009 Nokia Corporation
> > - *
> > - * Written by Peter De Schrijver <peter.de-schrijver@nokia.com>
> > - * Several fixes by Felipe Balbi <felipe.balbi@nokia.com>
> > - *
> > - * This file is subject to the terms and conditions of the GNU General
> > - * Public License. See the file "COPYING" in the main directory of this
> > - * archive for more details.
> > - *
> > - * This program is distributed in the hope that it will be useful,
> > - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > - * GNU General Public License for more details.
> > - *
> > - * You should have received a copy of the GNU General Public License
> > - * along with this program; if not, write to the Free Software
> > - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-
> > 1307  USA
> > - */
> > -
> > -#include <linux/module.h>
> > -#include <linux/init.h>
> > -#include <linux/kernel.h>
> > -#include <linux/errno.h>
> > -#include <linux/input.h>
> > -#include <linux/interrupt.h>
> > -#include <linux/platform_device.h>
> > -#include <linux/i2c/twl.h>
> > -
> > -#define PWR_PWRON_IRQ (1 << 0)
> > -
> > -#define STS_HW_CONDITIONS 0xf
> > -
> > -static irqreturn_t powerbutton_irq(int irq, void *_pwr)
> > -{
> > -	struct input_dev *pwr = _pwr;
> > -	int err;
> > -	u8 value;
> > -
> > -	err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &value,
> > STS_HW_CONDITIONS);
> > -	if (!err)  {
> > -		pm_wakeup_event(pwr->dev.parent, 0);
> > -		input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ);
> > -		input_sync(pwr);
> > -	} else {
> > -		dev_err(pwr->dev.parent, "twl4030: i2c error %d while
> > reading"
> > -			" TWL4030 PM_MASTER STS_HW_CONDITIONS register\n",
> > err);
> > -	}
> > -
> > -	return IRQ_HANDLED;
> > -}
> > -
> > -static int twl4030_pwrbutton_probe(struct platform_device *pdev)
> > -{
> > -	struct input_dev *pwr;
> > -	int irq = platform_get_irq(pdev, 0);
> > -	int err;
> > -
> > -	pwr = devm_input_allocate_device(&pdev->dev);
> > -	if (!pwr) {
> > -		dev_err(&pdev->dev, "Can't allocate power button\n");
> > -		return -ENOMEM;
> > -	}
> > -
> > -	pwr->evbit[0] = BIT_MASK(EV_KEY);
> > -	pwr->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);
> > -	pwr->name = "twl4030_pwrbutton";
> > -	pwr->phys = "twl4030_pwrbutton/input0";
> > -	pwr->dev.parent = &pdev->dev;
> > -
> > -	err = devm_request_threaded_irq(&pwr->dev, irq, NULL,
> > powerbutton_irq,
> > -			IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING |
> > -			IRQF_ONESHOT,
> > -			"twl4030_pwrbutton", pwr);
> > -	if (err < 0) {
> > -		dev_err(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n",
> > err);
> > -		return err;
> > -	}
> > -
> > -	err = input_register_device(pwr);
> > -	if (err) {
> > -		dev_err(&pdev->dev, "Can't register power button: %d\n",
> > err);
> > -		return err;
> > -	}
> > -
> > -	platform_set_drvdata(pdev, pwr);
> > -	device_init_wakeup(&pdev->dev, true);
> > -
> > -	return 0;
> > -}
> > -
> > -#ifdef CONFIG_OF
> > -static const struct of_device_id twl4030_pwrbutton_dt_match_table[] = {
> > -       { .compatible = "ti,twl4030-pwrbutton" },
> > -       {},
> > -};
> > -MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table);
> > -#endif
> > -
> > -static struct platform_driver twl4030_pwrbutton_driver = {
> > -	.probe		= twl4030_pwrbutton_probe,
> > -	.driver		= {
> > -		.name	= "twl4030_pwrbutton",
> > -		.of_match_table =
> > of_match_ptr(twl4030_pwrbutton_dt_match_table),
> > -	},
> > -};
> > -module_platform_driver(twl4030_pwrbutton_driver);
> > -
> > -MODULE_ALIAS("platform:twl4030_pwrbutton");
> > -MODULE_DESCRIPTION("Triton2 Power Button");
> > -MODULE_LICENSE("GPL");
> > -MODULE_AUTHOR("Peter De Schrijver <peter.de-schrijver@nokia.com>");
> > -MODULE_AUTHOR("Felipe Balbi <felipe.balbi@nokia.com>");
> > -
> > diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
> > index 74372bc..a1bfe23 100644
> > --- a/drivers/mfd/twl-core.c
> > +++ b/drivers/mfd/twl-core.c
> > @@ -848,13 +848,21 @@ add_children(struct twl_platform_data *pdata, unsigned
> > irq_base,
> >   			return PTR_ERR(child);
> >   	}
> >   
> > -	if (IS_ENABLED(CONFIG_INPUT_TWL4030_PWRBUTTON) &&
> > twl_class_is_4030()) {
> > -		child = add_child(TWL_MODULE_PM_MASTER,
> > "twl4030_pwrbutton",
> > +	if (IS_ENABLED(CONFIG_INPUT_TWL_PWRBUTTON) && twl_class_is_4030())
> > {
> > +		child = add_child(TWL_MODULE_PM_MASTER, "twl_pwrbutton",
> >   				  NULL, 0, true, irq_base + 8 + 0, 0);
> >   		if (IS_ERR(child))
> >   			return PTR_ERR(child);
> >   	}
> >   
> > +	if (IS_ENABLED(CONFIG_INPUT_TWL_PWRBUTTON) && twl_class_is_6030())
> > {
> > +		child = add_child(TWL_MODULE_PM_MASTER, "twl_pwrbutton",
> > +				  NULL, 0, true, irq_base + 0, 0);
> > +		if (IS_ERR(child))
> > +			return PTR_ERR(child);
> > +	}
> > +
> no legacy code for twl6030 pls

That's fine with me.

> > 
> > +
> >   	if (IS_ENABLED(CONFIG_MFD_TWL4030_AUDIO) && pdata->audio &&
> >   	    twl_class_is_4030()) {
> >   		child = add_child(TWL4030_MODULE_AUDIO_VOICE, "twl4030-
> > audio",
> > diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
> > index 2decb190..20d33b7 100644
> > --- a/include/linux/i2c/twl.h
> > +++ b/include/linux/i2c/twl.h
> > @@ -127,6 +127,7 @@ enum twl6030_module_ids {
> >   #define REG_INT_MSK_STS_C		0x08
> >   
> >   /* MASK INT REG GROUP A */
> > +#define TWL6030_PWRON_INT_MASK		0x01
> >   #define TWL6030_PWR_INT_MASK 		0x07
> >   #define TWL6030_RTC_INT_MASK 		0x18
> >   #define TWL6030_HOTDIE_INT_MASK 	0x20
> > 
> 

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/8] mfd: twl-core: Rename TWL4030_CORE Kconfig option to TWL_CORE
  2016-04-02 20:12     ` Paul Kocialkowski
@ 2016-04-05 10:21       ` Grygorii Strashko
  0 siblings, 0 replies; 19+ messages in thread
From: Grygorii Strashko @ 2016-04-05 10:21 UTC (permalink / raw)
  To: Paul Kocialkowski, linux-kernel, linux-omap, linux-pm,
	devicetree, Lee Jones
  Cc: Rob Herring, Tony Lindgren, Dmitry Torokhov, Sebastian Reichel,
	Dmitry Eremin-Solenikov, David Woodhouse

On 04/02/2016 11:12 PM, Paul Kocialkowski wrote:
> Le mercredi 30 mars 2016 à 18:34 +0300, Grygorii Strashko a écrit :
>> On 03/29/2016 10:22 PM, Paul Kocialkowski wrote:
>>>
>>> Since the twl-core mfd driver is not limited to twl4030 support, but also
>>> supports other chips of the TWL family, it makes sense to rename its
>>> matching
>>> Kconfig opton to a non-model-specific name.
>>
>> Personally I don't see too much reason for this, but it's up to maintainers to
>> decide.
> 
> I'm a strong advocate of consistency in naming and using twl4030 prefixes for
> drivers that are common to more twl chips looks very inconsistent to me.
> Besides, some common twl drivers are already using the twl prefix, so this can
> also be seen as harmonisation.

Yah. May be.

But I see the problem with your series - small amount of functional changes
is hidden in the fog of huge amount of renaming/beautification ;)

But, again, this is my personal opinion - final decision is up to maintainers

+ cc: Lee Jones

> 
>> Regarding this patch - pls, do not mix Kconfig and code changes.
> 
> Do you mean that for code changes that are directly affected by Kconfig changes
> (e.g. #ifdef CONFIG_)? Is the policy that "each commit must produce a working
> result" or is it okay to break drivers in between commits of the same series?

I mean this:
  */
-#define TWL4030_CORE_NR_IRQS	8
+#define TWL_CORE_NR_IRQS	8
 #define TWL4030_PWR_NR_IRQS	8
 
 /* PIH register offsets */
@@ -693,7 +693,7 @@ int twl4030_init_irq(struct device *dev, int irq_num)
 	 * the hwirqs numbers are defined contiguously from 1 to 15.
 	 * Create only one domain for both.
 	 */
-	nr_irqs = TWL4030_PWR_NR_IRQS + TWL4030_CORE_NR_IRQS;
+	nr_irqs = TWL4030_PWR_NR_IRQS + TWL_CORE_NR_IRQS;
 
 	irq_base = irq_alloc_descs(-1, 0, nr_irqs, 0);
 	if (IS_ERR_VALUE(irq_base)) {
@@ -704,7 +704,7 @@ int twl4030_init_irq(struct device *dev, int irq_num)
 	irq_domain_add_legacy(node, nr_irqs, irq_base, 0,
 			      &irq_domain_simple_ops, NULL);
 
-	irq_end = irq_base + TWL4030_CORE_NR_IRQS;
+	irq_end = irq_base + TWL_CORE_NR_IRQS;

> 
>> And it will be good to have cover letter.
> 
> Noted, I'll come up with something for v2.
> 
>>> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
>>> ---
>>>    arch/arm/mach-omap2/Kconfig     | 2 +-
>>>    arch/arm/mach-omap2/Makefile    | 2 +-
>>>    arch/arm/mach-omap2/pm.h        | 2 +-
>>>    arch/arm/plat-omap/Kconfig      | 2 +-

[..]


-- 
regards,
-grygorii

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/8] mfd: twl-core: Rename TWL4030_CORE Kconfig option to TWL_CORE
  2016-03-29 19:22 ` [PATCH 3/8] mfd: twl-core: Rename TWL4030_CORE Kconfig option to TWL_CORE Paul Kocialkowski
  2016-03-30 15:34   ` Grygorii Strashko
@ 2016-04-07  8:02   ` Lee Jones
  1 sibling, 0 replies; 19+ messages in thread
From: Lee Jones @ 2016-04-07  8:02 UTC (permalink / raw)
  To: Paul Kocialkowski
  Cc: linux-kernel, linux-omap, linux-pm, devicetree, Rob Herring,
	Tony Lindgren, Dmitry Torokhov, Sebastian Reichel,
	Dmitry Eremin-Solenikov, David Woodhouse

On Tue, 29 Mar 2016, Paul Kocialkowski wrote:

> Since the twl-core mfd driver is not limited to twl4030 support, but also
> supports other chips of the TWL family, it makes sense to rename its matching
> Kconfig opton to a non-model-specific name.

No, it doesn't.  The naming convention is; unless there was already
forethought to make the name generic, it should be kept as the first
supported device i.e. in this case TWL4030.

It's also helpful if you Cc *all* of the maintainers for subsystems
you are attempting to make changes in.

> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> ---
>  arch/arm/mach-omap2/Kconfig     | 2 +-
>  arch/arm/mach-omap2/Makefile    | 2 +-
>  arch/arm/mach-omap2/pm.h        | 2 +-
>  arch/arm/plat-omap/Kconfig      | 2 +-
>  drivers/gpio/Kconfig            | 2 +-
>  drivers/iio/adc/Kconfig         | 4 ++--
>  drivers/input/keyboard/Kconfig  | 2 +-
>  drivers/input/misc/Kconfig      | 4 ++--
>  drivers/mfd/Kconfig             | 6 +++---
>  drivers/mfd/Makefile            | 2 +-
>  drivers/mfd/twl4030-irq.c       | 6 +++---
>  drivers/phy/Kconfig             | 2 +-
>  drivers/power/Kconfig           | 2 +-
>  drivers/pwm/Kconfig             | 4 ++--
>  drivers/regulator/Kconfig       | 2 +-
>  drivers/rtc/Kconfig             | 2 +-
>  drivers/usb/phy/Kconfig         | 2 +-
>  drivers/video/backlight/Kconfig | 2 +-
>  drivers/watchdog/Kconfig        | 2 +-
>  include/linux/i2c/twl.h         | 4 ++--
>  sound/soc/codecs/Kconfig        | 2 +-
>  sound/soc/omap/Kconfig          | 4 ++--
>  22 files changed, 31 insertions(+), 31 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
> index 0517f0c..ada4c7a1 100644
> --- a/arch/arm/mach-omap2/Kconfig
> +++ b/arch/arm/mach-omap2/Kconfig
> @@ -124,7 +124,7 @@ config ARCH_OMAP2PLUS_TYPICAL
>  	select PM
>  	select REGULATOR
>  	select REGULATOR_FIXED_VOLTAGE
> -	select TWL4030_CORE if ARCH_OMAP3 || ARCH_OMAP4
> +	select TWL_CORE if ARCH_OMAP3 || ARCH_OMAP4
>  	select TWL4030_POWER if ARCH_OMAP3 || ARCH_OMAP4
>  	select VFP
>  	help
> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> index 0ba6a0e..6eb680a 100644
> --- a/arch/arm/mach-omap2/Makefile
> +++ b/arch/arm/mach-omap2/Makefile
> @@ -27,7 +27,7 @@ ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),)
>  obj-y += mcbsp.o
>  endif
>  
> -obj-$(CONFIG_TWL4030_CORE) += omap_twl.o
> +obj-$(CONFIG_TWL_CORE) += omap_twl.o
>  obj-$(CONFIG_SOC_HAS_OMAP2_SDRC)	+= sdrc.o
>  
>  # SMP support ONLY available for OMAP4
> diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
> index b668719..bf4dac2 100644
> --- a/arch/arm/mach-omap2/pm.h
> +++ b/arch/arm/mach-omap2/pm.h
> @@ -123,7 +123,7 @@ static inline int omap_devinit_smartreflex(void)
>  static inline void omap_enable_smartreflex_on_init(void) {}
>  #endif
>  
> -#ifdef CONFIG_TWL4030_CORE
> +#ifdef CONFIG_TWL_CORE
>  extern int omap3_twl_init(void);
>  extern int omap4_twl_init(void);
>  extern int omap3_twl_set_sr_bit(bool enable);
> diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
> index d055db3..8631a45 100644
> --- a/arch/arm/plat-omap/Kconfig
> +++ b/arch/arm/plat-omap/Kconfig
> @@ -44,7 +44,7 @@ config POWER_AVS_OMAP
>  
>  config POWER_AVS_OMAP_CLASS3
>  	bool "Class 3 mode of Smartreflex Implementation"
> -	depends on POWER_AVS_OMAP && TWL4030_CORE
> +	depends on POWER_AVS_OMAP && TWL_CORE
>  	help
>  	  Say Y to enable Class 3 implementation of Smartreflex
>  
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index 5f3429f..62ca9b4 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -933,7 +933,7 @@ config GPIO_TPS65912
>  
>  config GPIO_TWL4030
>  	tristate "TWL4030, TWL5030, and TPS659x0 GPIOs"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>  	help
>  	  Say yes here to access the GPIO signals of various multi-function
>  	  power management chips from Texas Instruments.
> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
> index af4aea7..3360492 100644
> --- a/drivers/iio/adc/Kconfig
> +++ b/drivers/iio/adc/Kconfig
> @@ -440,7 +440,7 @@ config TI_AM335X_ADC
>  
>  config TWL4030_MADC
>  	tristate "TWL4030 MADC (Monitoring A/D Converter)"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>  	help
>  	  This driver provides support for Triton TWL4030-MADC. The
>  	  driver supports both RT and SW conversion methods.
> @@ -450,7 +450,7 @@ config TWL4030_MADC
>  
>  config TWL6030_GPADC
>  	tristate "TWL6030 GPADC (General Purpose A/D Converter) Support"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>  	default n
>  	help
>  	  Say yes here if you want support for the TWL6030/TWL6032 General
> diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
> index 509608c..9cfa09b 100644
> --- a/drivers/input/keyboard/Kconfig
> +++ b/drivers/input/keyboard/Kconfig
> @@ -653,7 +653,7 @@ config KEYBOARD_TC3589X
>  
>  config KEYBOARD_TWL4030
>  	tristate "TI TWL4030/TWL5030/TPS659x0 keypad support"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>  	select INPUT_MATRIXKMAP
>  	help
>  	  Say Y here if your board use the keypad controller on
> diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
> index 1f2337a..6abb6df 100644
> --- a/drivers/input/misc/Kconfig
> +++ b/drivers/input/misc/Kconfig
> @@ -461,7 +461,7 @@ config INPUT_AXP20X_PEK
>  
>  config INPUT_TWL4030_PWRBUTTON
>  	tristate "TWL4030 Power button Driver"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>  	help
>  	  Say Y here if you want to enable power key reporting via the
>  	  TWL4030 family of chips.
> @@ -471,7 +471,7 @@ config INPUT_TWL4030_PWRBUTTON
>  
>  config INPUT_TWL4030_VIBRA
>  	tristate "Support for TWL4030 Vibrator"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>  	select MFD_TWL4030_AUDIO
>  	select INPUT_FF_MEMLESS
>  	help
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index eea61e3..28bfe3d 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -1266,7 +1266,7 @@ config MFD_TPS80031
>  	  ADC, RTC, 2 PWM, System Voltage Regulator/Battery Charger with
>  	  Power Path from USB, 32K clock generator.
>  
> -config TWL4030_CORE
> +config TWL_CORE
>  	bool "TI TWL4030/TWL5030/TWL6030/TPS659x0 Support"
>  	depends on I2C=y
>  	select IRQ_DOMAIN
> @@ -1284,7 +1284,7 @@ config TWL4030_CORE
>  
>  config TWL4030_POWER
>  	bool "TI TWL4030 power resources"
> -	depends on TWL4030_CORE && ARM
> +	depends on TWL_CORE && ARM
>  	help
>  	  Say yes here if you want to use the power resources on the
>  	  TWL4030 family chips.  Most of these resources are regulators,
> @@ -1297,7 +1297,7 @@ config TWL4030_POWER
>  
>  config MFD_TWL4030_AUDIO
>  	bool "TI TWL4030 Audio"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>  	select MFD_CORE
>  	default n
>  
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index 5eaa6465d..7daeab5 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -81,7 +81,7 @@ obj-$(CONFIG_MFD_TPS65912_SPI)  += tps65912-spi.o
>  obj-$(CONFIG_MFD_TPS80031)	+= tps80031.o
>  obj-$(CONFIG_MENELAUS)		+= menelaus.o
>  
> -obj-$(CONFIG_TWL4030_CORE)	+= twl-core.o twl4030-irq.o twl6030-irq.o
> +obj-$(CONFIG_TWL_CORE)	+= twl-core.o twl4030-irq.o twl6030-irq.o
>  obj-$(CONFIG_TWL4030_POWER)    += twl4030-power.o
>  obj-$(CONFIG_MFD_TWL4030_AUDIO)	+= twl4030-audio.o
>  obj-$(CONFIG_TWL6040_CORE)	+= twl6040.o
> diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c
> index 40e51b0..52dc294 100644
> --- a/drivers/mfd/twl4030-irq.c
> +++ b/drivers/mfd/twl4030-irq.c
> @@ -54,7 +54,7 @@
>   *	base + 8  .. base + 15	SIH for PWR_INT
>   *	base + 16 .. base + 33	SIH for GPIO
>   */
> -#define TWL4030_CORE_NR_IRQS	8
> +#define TWL_CORE_NR_IRQS	8
>  #define TWL4030_PWR_NR_IRQS	8
>  
>  /* PIH register offsets */
> @@ -693,7 +693,7 @@ int twl4030_init_irq(struct device *dev, int irq_num)
>  	 * the hwirqs numbers are defined contiguously from 1 to 15.
>  	 * Create only one domain for both.
>  	 */
> -	nr_irqs = TWL4030_PWR_NR_IRQS + TWL4030_CORE_NR_IRQS;
> +	nr_irqs = TWL4030_PWR_NR_IRQS + TWL_CORE_NR_IRQS;
>  
>  	irq_base = irq_alloc_descs(-1, 0, nr_irqs, 0);
>  	if (IS_ERR_VALUE(irq_base)) {
> @@ -704,7 +704,7 @@ int twl4030_init_irq(struct device *dev, int irq_num)
>  	irq_domain_add_legacy(node, nr_irqs, irq_base, 0,
>  			      &irq_domain_simple_ops, NULL);
>  
> -	irq_end = irq_base + TWL4030_CORE_NR_IRQS;
> +	irq_end = irq_base + TWL_CORE_NR_IRQS;
>  
>  	/*
>  	 * Mask and clear all TWL4030 interrupts since initially we do
> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> index 26566db..6193565 100644
> --- a/drivers/phy/Kconfig
> +++ b/drivers/phy/Kconfig
> @@ -164,7 +164,7 @@ config TI_PIPE3
>  
>  config TWL4030_USB
>  	tristate "TWL4030 USB Transceiver Driver"
> -	depends on TWL4030_CORE && REGULATOR_TWL4030 && USB_MUSB_OMAP2PLUS
> +	depends on TWL_CORE && REGULATOR_TWL4030 && USB_MUSB_OMAP2PLUS
>  	depends on USB_SUPPORT
>  	select GENERIC_PHY
>  	select USB_PHY
> diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
> index 421770d..cc5fe9a 100644
> --- a/drivers/power/Kconfig
> +++ b/drivers/power/Kconfig
> @@ -323,7 +323,7 @@ config CHARGER_MAX8903
>  
>  config CHARGER_TWL4030
>  	tristate "OMAP TWL4030 BCI charger driver"
> -	depends on IIO && TWL4030_CORE
> +	depends on IIO && TWL_CORE
>  	help
>  	  Say Y here to enable support for TWL4030 Battery Charge Interface.
>  
> diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
> index c182efc..6318f19 100644
> --- a/drivers/pwm/Kconfig
> +++ b/drivers/pwm/Kconfig
> @@ -413,7 +413,7 @@ config  PWM_TIPWMSS
>  
>  config PWM_TWL
>  	tristate "TWL4030/6030 PWM support"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>  	help
>  	  Generic PWM framework driver for TWL4030/6030.
>  
> @@ -422,7 +422,7 @@ config PWM_TWL
>  
>  config PWM_TWL_LED
>  	tristate "TWL4030/6030 PWM support for LED drivers"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>  	help
>  	  Generic PWM framework driver for TWL4030/6030 LED terminals.
>  
> diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
> index c77dc08..b62b4b4 100644
> --- a/drivers/regulator/Kconfig
> +++ b/drivers/regulator/Kconfig
> @@ -803,7 +803,7 @@ config REGULATOR_TPS80031
>  
>  config REGULATOR_TWL4030
>  	tristate "TI TWL4030/TWL5030/TWL6030/TPS659x0 PMIC"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>  	help
>  	  This driver supports the voltage regulators provided by
>  	  this family of companion chips.
> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> index 3e84315..198ac54 100644
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -462,7 +462,7 @@ config RTC_DRV_TWL92330
>  
>  config RTC_DRV_TWL4030
>  	tristate "TI TWL4030/TWL5030/TWL6030/TPS659x0"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>  	help
>  	  If you say yes here you get support for the RTC on the
>  	  TWL4030/TWL5030/TWL6030 family chips, used mostly with OMAP3 platforms.
> diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
> index c690474..2911b11 100644
> --- a/drivers/usb/phy/Kconfig
> +++ b/drivers/usb/phy/Kconfig
> @@ -80,7 +80,7 @@ config SAMSUNG_USBPHY
>  
>  config TWL6030_USB
>  	tristate "TWL6030 USB Transceiver Driver"
> -	depends on TWL4030_CORE && OMAP_USB2 && USB_MUSB_OMAP2PLUS
> +	depends on TWL_CORE && OMAP_USB2 && USB_MUSB_OMAP2PLUS
>  	help
>  	  Enable this to support the USB OTG transceiver on TWL6030
>  	  family chips. This TWL6030 transceiver has the VBUS and ID GND
> diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
> index 5ffa4b4..8d6e4e0 100644
> --- a/drivers/video/backlight/Kconfig
> +++ b/drivers/video/backlight/Kconfig
> @@ -412,7 +412,7 @@ config BACKLIGHT_OT200
>  
>  config BACKLIGHT_PANDORA
>  	tristate "Backlight driver for Pandora console"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>  	help
>  	  If you have a Pandora console, say Y to enable the
>  	  backlight driver.
> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> index fb94765..4b24418 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -462,7 +462,7 @@ config COH901327_WATCHDOG
>  
>  config TWL4030_WATCHDOG
>  	tristate "TWL4030 Watchdog"
> -	depends on TWL4030_CORE
> +	depends on TWL_CORE
>  	select WATCHDOG_CORE
>  	help
>  	  Support for TI TWL4030 watchdog.  Say 'Y' here to enable the
> diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
> index 4e7ea5f..2decb190 100644
> --- a/include/linux/i2c/twl.h
> +++ b/include/linux/i2c/twl.h
> @@ -214,7 +214,7 @@ int twl6030_interrupt_unmask(u8 bit_mask, u8 offset);
>  int twl6030_interrupt_mask(u8 bit_mask, u8 offset);
>  
>  /* Card detect Configuration for MMC1 Controller on OMAP4 */
> -#ifdef CONFIG_TWL4030_CORE
> +#ifdef CONFIG_TWL_CORE
>  int twl6030_mmc_card_detect_config(void);
>  #else
>  static inline int twl6030_mmc_card_detect_config(void)
> @@ -225,7 +225,7 @@ static inline int twl6030_mmc_card_detect_config(void)
>  #endif
>  
>  /* MMC1 Controller on OMAP4 uses Phoenix irq for Card detect */
> -#ifdef CONFIG_TWL4030_CORE
> +#ifdef CONFIG_TWL_CORE
>  int twl6030_mmc_card_detect(struct device *dev, int slot);
>  #else
>  static inline int twl6030_mmc_card_detect(struct device *dev, int slot)
> diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
> index 649e92a..009feb4 100644
> --- a/sound/soc/codecs/Kconfig
> +++ b/sound/soc/codecs/Kconfig
> @@ -134,7 +134,7 @@ config SND_SOC_ALL_CODECS
>  	select SND_SOC_TPA6130A2 if I2C
>  	select SND_SOC_TLV320DAC33 if I2C
>  	select SND_SOC_TS3A227E if I2C
> -	select SND_SOC_TWL4030 if TWL4030_CORE
> +	select SND_SOC_TWL4030 if TWL_CORE
>  	select SND_SOC_TWL6040 if TWL6040_CORE
>  	select SND_SOC_UDA134X
>  	select SND_SOC_UDA1380 if I2C
> diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
> index 5185a38..49af002 100644
> --- a/sound/soc/omap/Kconfig
> +++ b/sound/soc/omap/Kconfig
> @@ -85,7 +85,7 @@ config SND_OMAP_SOC_AM3517EVM
>  
>  config SND_OMAP_SOC_OMAP_TWL4030
>  	tristate "SoC Audio support for TI SoC based boards with twl4030 codec"
> -	depends on TWL4030_CORE && SND_OMAP_SOC
> +	depends on TWL_CORE && SND_OMAP_SOC
>  	select SND_OMAP_SOC_MCBSP
>  	select SND_SOC_TWL4030
>  	help
> @@ -117,7 +117,7 @@ config SND_OMAP_SOC_OMAP_ABE_TWL6040
>  
>  config SND_OMAP_SOC_OMAP3_PANDORA
>  	tristate "SoC Audio support for OMAP3 Pandora"
> -	depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP3_PANDORA
> +	depends on TWL_CORE && SND_OMAP_SOC && MACH_OMAP3_PANDORA
>  	select SND_OMAP_SOC_MCBSP
>  	select SND_SOC_TWL4030
>  	help

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2016-04-07  8:02 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-29 19:22 [PATCH 1/8] mfd: twl-core: Rename struct twl4030_platform_data to twl_platform_data Paul Kocialkowski
2016-03-29 19:22 ` [PATCH 2/8] mfd: twl-core: Rename some non-model-specific structures, without model name Paul Kocialkowski
2016-03-30 15:31   ` Grygorii Strashko
2016-03-29 19:22 ` [PATCH 3/8] mfd: twl-core: Rename TWL4030_CORE Kconfig option to TWL_CORE Paul Kocialkowski
2016-03-30 15:34   ` Grygorii Strashko
2016-04-02 20:12     ` Paul Kocialkowski
2016-04-05 10:21       ` Grygorii Strashko
2016-04-07  8:02   ` Lee Jones
2016-03-29 19:22 ` [PATCH 4/8] mfd: Add TWL6030 power driver, with minimal support for power off Paul Kocialkowski
2016-03-30 15:56   ` Grygorii Strashko
2016-04-02 20:14     ` Paul Kocialkowski
2016-03-29 19:22 ` [PATCH 5/8] ARM: OMAP2+: Only select TWL4030_POWER for OMAP3 Paul Kocialkowski
2016-03-29 19:22 ` [PATCH 6/8] ARM: OMAP2+: Select TWL6030_POWER for OMAP4 Paul Kocialkowski
2016-03-29 19:22 ` [PATCH 7/8] input: misc: Add TWL6030 power button support to twl-pwrbutton Paul Kocialkowski
2016-03-30 16:16   ` Grygorii Strashko
2016-04-02 20:30     ` Paul Kocialkowski
2016-03-29 19:22 ` [PATCH 8/8] input: twl-pwrbutton: Rename interrupt routine for better consistency Paul Kocialkowski
2016-03-30 15:20 ` [PATCH 1/8] mfd: twl-core: Rename struct twl4030_platform_data to twl_platform_data Grygorii Strashko
2016-04-02 19:58   ` Paul Kocialkowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).