Skip to contentSkip to conversation

Menelaus cleanup for DT, phase 1

PATCH New Aaro Koskinen 3 participants 18 messages Dec 27, 2014 – Jan 20, 2015

Subsystems (5)
lore
Share & tools
lore

Aaro Koskinen

author maintainer
#0 lore raw

cover Menelaus cleanup for DT, phase 1

Hi,

These patches start removal of board-specific callbacks from Menelaus:
delete platform data and a callback from the driver to the board files.

Tested on top of 3.19-rc1 on N800/N810 which are the only in-tree users for the driver.

Aaro Koskinen (7):
mfd: menelaus: delete omap_has_menelaus
mfd: menelaus: drop support for SW controller VCORE
mfd: menelaus: add initial DT support
ARM: OMAP: N8x0: configure menelaus using DT
mfd: menelaus: delete platform data support
mfd: menelaus: make vcore and regulator controls internal
mfd: menelaus: use macro for magic number

 Documentation/devicetree/bindings/mfd/menelaus.txt | 30 ++++++++
 arch/arm/boot/dts/omap2420-n8x0-common.dtsi        |  3 +
 arch/arm/mach-omap2/board-n8x0.c                   | 57 --------------
 arch/arm/mach-omap2/common-board-devices.h         |  2 -
 arch/arm/mach-omap2/pdata-quirks.c                 |  1 -
 drivers/mfd/menelaus.c                             | 86 ++++++++++++++--------
 include/linux/mfd/menelaus.h                       | 25 -------
 7 files changed, 87 insertions(+), 117 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/menelaus.txt
Signature · 1 line
2.2.0
author maintainer
#1 lore raw

PATCH 1/7 mfd: menelaus: delete omap_has_menelaus

Delete unused macro.

---
 include/linux/mfd/menelaus.h | 6 ------
 1 file changed, 6 deletions(-)
include/linux/mfd/menelaus.h +0 -6
index f097e89..a1e12bf3 100644
@@ -38,10 +38,4 @@ extern int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV);
 
 extern int menelaus_set_regulator_sleep(int enable, u32 val);
 
-#if defined(CONFIG_ARCH_OMAP2) && defined(CONFIG_MENELAUS)
-#define omap_has_menelaus()	1
-#else
-#define omap_has_menelaus()	0
-#endif
-
 #endif
Signature · 1 line
2.2.0
Applied
#2 lore raw

PATCH 1/7 mfd: menelaus: delete omap_has_menelaus

Quoted 6 lines · Aaro Koskinen

Delete unused macro.

---
 include/linux/mfd/menelaus.h | 6 ------
 1 file changed, 6 deletions(-)

Applied, thanks.

Quoted 15 lines
include/linux/mfd/menelaus.h +0 -6
index f097e89..a1e12bf3 100644
@@ -38,10 +38,4 @@ extern int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV);
 
 extern int menelaus_set_regulator_sleep(int enable, u32 val);
 
-#if defined(CONFIG_ARCH_OMAP2) && defined(CONFIG_MENELAUS)
-#define omap_has_menelaus()	1
-#else
-#define omap_has_menelaus()	0
-#endif
-
 #endif
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author maintainer
#3 lore raw

PATCH 2/7 mfd: menelaus: drop support for SW controller VCORE

In reply to Aaro Koskinen

Drop support for SW controlled VCORE, nobody uses it.

---
 drivers/mfd/menelaus.c       | 23 -----------------------
 include/linux/mfd/menelaus.h |  1 -
 2 files changed, 24 deletions(-)
drivers/mfd/menelaus.c +0 -23
index 9f01aef..917fa86 100644
@@ -532,29 +532,6 @@ static const struct menelaus_vtg_value vcore_values[] = {
 	{ 1450, 18 },
 };
 
-int menelaus_set_vcore_sw(unsigned int mV)
-{
-	int val, ret;
-	struct i2c_client *c = the_menelaus->client;
-
-	val = menelaus_get_vtg_value(mV, vcore_values,
-				     ARRAY_SIZE(vcore_values));
-	if (val < 0)
-		return -EINVAL;
-
-	dev_dbg(&c->dev, "Setting VCORE to %d mV (val 0x%02x)\n", mV, val);
-
-	/* Set SW mode and the voltage in one go. */
-	mutex_lock(&the_menelaus->lock);
-	ret = menelaus_write_reg(MENELAUS_VCORE_CTRL1, val);
-	if (ret == 0)
-		the_menelaus->vcore_hw_mode = 0;
-	mutex_unlock(&the_menelaus->lock);
-	msleep(1);
-
-	return ret;
-}
-
 int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV)
 {
 	int fval, rval, val, ret;
include/linux/mfd/menelaus.h +0 -1
index a1e12bf3..9e85ac0 100644
@@ -24,7 +24,6 @@ extern int menelaus_set_vaux(unsigned int mV);
 extern int menelaus_set_vdcdc(int dcdc, unsigned int mV);
 extern int menelaus_set_slot_sel(int enable);
 extern int menelaus_get_slot_pin_states(void);
-extern int menelaus_set_vcore_sw(unsigned int mV);
 extern int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV);
 
 #define EN_VPLL_SLEEP	(1 << 7)
Signature · 1 line
2.2.0
Applied
#4 lore raw

PATCH 2/7 mfd: menelaus: drop support for SW controller VCORE

Quoted 7 lines · Aaro Koskinen

Drop support for SW controlled VCORE, nobody uses it.

---
 drivers/mfd/menelaus.c       | 23 -----------------------
 include/linux/mfd/menelaus.h |  1 -
 2 files changed, 24 deletions(-)

Applied, thanks.

Quoted 46 lines
drivers/mfd/menelaus.c +0 -23
index 9f01aef..917fa86 100644
@@ -532,29 +532,6 @@ static const struct menelaus_vtg_value vcore_values[] = {
 	{ 1450, 18 },
 };
 
-int menelaus_set_vcore_sw(unsigned int mV)
-{
-	int val, ret;
-	struct i2c_client *c = the_menelaus->client;
-
-	val = menelaus_get_vtg_value(mV, vcore_values,
-				     ARRAY_SIZE(vcore_values));
-	if (val < 0)
-		return -EINVAL;
-
-	dev_dbg(&c->dev, "Setting VCORE to %d mV (val 0x%02x)\n", mV, val);
-
-	/* Set SW mode and the voltage in one go. */
-	mutex_lock(&the_menelaus->lock);
-	ret = menelaus_write_reg(MENELAUS_VCORE_CTRL1, val);
-	if (ret == 0)
-		the_menelaus->vcore_hw_mode = 0;
-	mutex_unlock(&the_menelaus->lock);
-	msleep(1);
-
-	return ret;
-}
-
 int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV)
 {
 	int fval, rval, val, ret;
include/linux/mfd/menelaus.h +0 -1
index a1e12bf3..9e85ac0 100644
@@ -24,7 +24,6 @@ extern int menelaus_set_vaux(unsigned int mV);
 extern int menelaus_set_vdcdc(int dcdc, unsigned int mV);
 extern int menelaus_set_slot_sel(int enable);
 extern int menelaus_get_slot_pin_states(void);
-extern int menelaus_set_vcore_sw(unsigned int mV);
 extern int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV);
 
 #define EN_VPLL_SLEEP	(1 << 7)
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author maintainer
#5 lore raw

PATCH 3/7 mfd: menelaus: add initial DT support

In reply to Aaro Koskinen

Add initial DT support.

---
 Documentation/devicetree/bindings/mfd/menelaus.txt | 30 +++++++++++++
 drivers/mfd/menelaus.c                             | 52 ++++++++++++++++++++--
 2 files changed, 78 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/menelaus.txt
Documentation/devicetree/bindings/mfd/menelaus.txt new file +30 -0
new file mode 100644
index 0000000..5f69f23
@@ -0,0 +1,30 @@
+Menelaus (Texas Instruments TWL92330) Power Management chip
+
+Menelaus provides facilities to control the power resources.
+
+Required properties:
+- compatible: must be "menelaus"
+- reg: I2C address of the chip
+
+Optional properties:
+- interrupts: the interrupt
+- ti,autosleep: All regulators are put to sleep by default.
+- ti,vcore-min-microvolt: Range floor for the HW controlled VCORE
+- ti,vcore-max-microvolt: Range roof for the HW controlled VCORE
+
+The use of ti,autosleep is recommended at least on Nokia N800/N810.
+
+Example:
+
+&i2c1 {
+	clock-frequency = <400000>;
+
+	pmic at 72 {
+		compatible = "menelaus";
+		reg = <0x72>;
+		interrupts = <7 IRQ_TYPE_EDGE_RISING>;
+		ti,autosleep;
+		ti,vcore-min-microvolt = <1050000>;
+		ti,vcore-max-microvolt = <1400000>;
+	};
+};
drivers/mfd/menelaus.c +48 -4

76 lines not on this page · raw message

Signature · 1 line
2.2.0
#6 lore raw

PATCH 3/7 mfd: menelaus: add initial DT support

Quoted 33 lines · Aaro Koskinen

Add initial DT support.

---
 Documentation/devicetree/bindings/mfd/menelaus.txt | 30 +++++++++++++
 drivers/mfd/menelaus.c                             | 52 ++++++++++++++++++++--
 2 files changed, 78 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/menelaus.txt
Documentation/devicetree/bindings/mfd/menelaus.txt new file +18 -0
new file mode 100644
index 0000000..5f69f23
@@ -0,0 +1,30 @@
+Menelaus (Texas Instruments TWL92330) Power Management chip
+
+Menelaus provides facilities to control the power resources.
+
+Required properties:
+- compatible: must be "menelaus"
+- reg: I2C address of the chip
+
+Optional properties:
+- interrupts: the interrupt
+- ti,autosleep: All regulators are put to sleep by default.
+- ti,vcore-min-microvolt: Range floor for the HW controlled VCORE
+- ti,vcore-max-microvolt: Range roof for the HW controlled VCORE
+
+The use of ti,autosleep is recommended at least on Nokia N800/N810.
+
+Example:
+

Documentation/devicetree/bindings/mfd/menelaus.txt line 28

Quoted 10 lines
Documentation/devicetree/bindings/mfd/menelaus.txt new file +10 -0
+&i2c1 {
+	clock-frequency = <400000>;
+
+	pmic at 72 {
+		compatible = "menelaus";
+		reg = <0x72>;
+		interrupts = <7 IRQ_TYPE_EDGE_RISING>;
+		ti,autosleep;
+		ti,vcore-min-microvolt = <1050000>;
+		ti,vcore-max-microvolt = <1400000>;

looks like these should be first converted to actual regulators otherwise we will have to maintain this binding forever which means that any effort of adding regulator fwk support for menelaus will become a lot more difficult because it'll have to cope with the legacy/bogus binding.

I started doing irqchip/irqdomain conversion but I don't have where to test and got side-tracked by other stuff. I'll see if I can restart that work early next year.

Then, if you change your series so that first you add proper regulator fwk support, we should be pretty good with menelaus.

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141227/813deaa7/attachment.sig>
author maintainer
#7 lore raw

PATCH 3/7 mfd: menelaus: add initial DT support

Hi,

Quoted 42 lines · Felipe Balbi
Quoted 41 lines · Aaro Koskinen

Add initial DT support.

---
 Documentation/devicetree/bindings/mfd/menelaus.txt | 30 +++++++++++++
 drivers/mfd/menelaus.c                             | 52 ++++++++++++++++++++--
 2 files changed, 78 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/menelaus.txt
Documentation/devicetree/bindings/mfd/menelaus.txt new file +26 -0
new file mode 100644
index 0000000..5f69f23
@@ -0,0 +1,30 @@
+Menelaus (Texas Instruments TWL92330) Power Management chip
+
+Menelaus provides facilities to control the power resources.
+
+Required properties:
+- compatible: must be "menelaus"
+- reg: I2C address of the chip
+
+Optional properties:
+- interrupts: the interrupt
+- ti,autosleep: All regulators are put to sleep by default.
+- ti,vcore-min-microvolt: Range floor for the HW controlled VCORE
+- ti,vcore-max-microvolt: Range roof for the HW controlled VCORE
+
+The use of ti,autosleep is recommended at least on Nokia N800/N810.
+
+Example:
+
+&i2c1 {
+	clock-frequency = <400000>;
+
+	pmic at 72 {
+		compatible = "menelaus";
+		reg = <0x72>;
+		interrupts = <7 IRQ_TYPE_EDGE_RISING>;
+		ti,autosleep;
Quoted 8 lines

Documentation/devicetree/bindings/mfd/menelaus.txt line 28

Quoted 2 lines
Documentation/devicetree/bindings/mfd/menelaus.txt new file +2 -0
+		ti,vcore-min-microvolt = <1050000>;
+		ti,vcore-max-microvolt = <1400000>;

looks like these should be first converted to actual regulators otherwise we will have to maintain this binding forever which means that any effort of adding regulator fwk support for menelaus will become a lot more difficult because it'll have to cope with the legacy/bogus binding.

I was thinking such conversion could be done with incremental patches... There's basically only one board (n8x0) that uses this and not likely to be any others. Is there a way to declare bindings unstable?

Quoted 6 lines

I started doing irqchip/irqdomain conversion but I don't have where to test and got side-tracked by other stuff. I'll see if I can restart that work early next year.

Then, if you change your series so that first you add proper regulator fwk support, we should be pretty good with menelaus.

Ok, let's see.

A.

#8 lore raw

PATCH 3/7 mfd: menelaus: add initial DT support

Hi,

Quoted 50 lines · Aaro Koskinen
Quoted 41 lines
Quoted 41 lines

Add initial DT support.

---
 Documentation/devicetree/bindings/mfd/menelaus.txt | 30 +++++++++++++
 drivers/mfd/menelaus.c                             | 52 ++++++++++++++++++++--
 2 files changed, 78 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/menelaus.txt
Documentation/devicetree/bindings/mfd/menelaus.txt new file +26 -0
new file mode 100644
index 0000000..5f69f23
@@ -0,0 +1,30 @@
+Menelaus (Texas Instruments TWL92330) Power Management chip
+
+Menelaus provides facilities to control the power resources.
+
+Required properties:
+- compatible: must be "menelaus"
+- reg: I2C address of the chip
+
+Optional properties:
+- interrupts: the interrupt
+- ti,autosleep: All regulators are put to sleep by default.
+- ti,vcore-min-microvolt: Range floor for the HW controlled VCORE
+- ti,vcore-max-microvolt: Range roof for the HW controlled VCORE
+
+The use of ti,autosleep is recommended at least on Nokia N800/N810.
+
+Example:
+
+&i2c1 {
+	clock-frequency = <400000>;
+
+	pmic at 72 {
+		compatible = "menelaus";
+		reg = <0x72>;
+		interrupts = <7 IRQ_TYPE_EDGE_RISING>;
+		ti,autosleep;
Quoted 8 lines

Documentation/devicetree/bindings/mfd/menelaus.txt line 28

Quoted 2 lines
Documentation/devicetree/bindings/mfd/menelaus.txt new file +2 -0
+		ti,vcore-min-microvolt = <1050000>;
+		ti,vcore-max-microvolt = <1400000>;

looks like these should be first converted to actual regulators otherwise we will have to maintain this binding forever which means that any effort of adding regulator fwk support for menelaus will become a lot more difficult because it'll have to cope with the legacy/bogus binding.

Quoted 3 lines

I was thinking such conversion could be done with incremental patches... There's basically only one board (n8x0) that uses this and not likely to be any others. Is there a way to declare bindings unstable?

AFAICT, once they hit a major release, they're stable for life :-)

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141229/34e7df09/attachment.sig>
author maintainer
#9 lore raw

PATCH 4/7 ARM: OMAP: N8x0: configure menelaus using DT

In reply to Aaro Koskinen

Configure Menelaus using DT.

---
 arch/arm/boot/dts/omap2420-n8x0-common.dtsi |  3 ++
 arch/arm/mach-omap2/board-n8x0.c            | 57 -----------------------------
 arch/arm/mach-omap2/pdata-quirks.c          |  1 -
 3 files changed, 3 insertions(+), 58 deletions(-)
arch/arm/boot/dts/omap2420-n8x0-common.dtsi +3 -0
index c9f1e93..c19718c 100644
@@ -32,6 +32,9 @@
 		compatible = "menelaus";
 		reg = <0x72>;
 		interrupts = <7 IRQ_TYPE_EDGE_RISING>;
+		ti,autosleep;
+		ti,vcore-min-microvolt = <1050000>;
+		ti,vcore-max-microvolt = <1400000>;
 	};
 };
 
arch/arm/mach-omap2/board-n8x0.c +0 -57

63 lines not on this page · raw message

arch/arm/mach-omap2/pdata-quirks.c +0 -1
index 3d7eee1..fca4650 100644
@@ -369,7 +369,6 @@ static struct pdata_init auxdata_quirks[] __initdata = {
 struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
 #ifdef CONFIG_MACH_NOKIA_N8X0
 	OF_DEV_AUXDATA("ti,omap2420-mmc", 0x4809c000, "mmci-omap.0", NULL),
-	OF_DEV_AUXDATA("menelaus", 0x72, "1-0072", &n8x0_menelaus_platform_data),
 	OF_DEV_AUXDATA("tlv320aic3x", 0x18, "2-0018", &n810_aic33_data),
 #endif
 #ifdef CONFIG_ARCH_OMAP3
Signature · 1 line
2.2.0
author maintainer
#10 lore raw

PATCH 5/7 mfd: menelaus: delete platform data support

In reply to Aaro Koskinen

Delete platform data support.

---
 arch/arm/mach-omap2/common-board-devices.h |  2 --
 drivers/mfd/menelaus.c                     | 10 +---------
 include/linux/mfd/menelaus.h               |  6 ------
 3 files changed, 1 insertion(+), 17 deletions(-)
arch/arm/mach-omap2/common-board-devices.h +0 -2
index 07c88ae..7a30228 100644
@@ -2,7 +2,6 @@
 #define __OMAP_COMMON_BOARD_DEVICES__
 
 #include <sound/tlv320aic3x.h>
-#include <linux/mfd/menelaus.h>
 #include "twl-common.h"
 
 #define NAND_BLOCK_SIZE	SZ_128K
@@ -14,7 +13,6 @@ void omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
 		       struct ads7846_platform_data *board_pdata);
 void *n8x0_legacy_init(void);
 
-extern struct menelaus_platform_data n8x0_menelaus_platform_data;
 extern struct aic3x_pdata n810_aic33_data;
 
 #endif /* __OMAP_COMMON_BOARD_DEVICES__ */
drivers/mfd/menelaus.c +1 -9
index 3e04c64..4a900cc 100644
@@ -1181,8 +1181,6 @@ static int menelaus_probe(struct i2c_client *client,
 	int			rev = 0;
 	int			err = 0;
 	struct device_node	*np = client->dev.of_node;
-	struct menelaus_platform_data *menelaus_pdata =
-					dev_get_platdata(&client->dev);
 
 	if (the_menelaus) {
 		dev_dbg(&client->dev, "only one %s for now\n",
@@ -1240,13 +1238,7 @@ static int menelaus_probe(struct i2c_client *client,
 	else
 		menelaus->vcore_hw_mode = 0;
 
-	if (menelaus_pdata != NULL) {
-		if (menelaus_pdata->late_init != NULL) {
-			err = menelaus_pdata->late_init(&client->dev);
-			if (err < 0)
-				goto fail;
-		}
-	} else if (np) {
+	if (np) {
 		u32 vcore_min;
 		u32 vcore_max;
 
include/linux/mfd/menelaus.h +0 -6
index 9e85ac0..21eeff5 100644
@@ -5,12 +5,6 @@
 #ifndef __ASM_ARCH_MENELAUS_H
 #define __ASM_ARCH_MENELAUS_H
 
-struct device;
-
-struct menelaus_platform_data {
-	int (* late_init)(struct device *dev);
-};
-
 extern int menelaus_register_mmc_callback(void (*callback)(void *data, u8 card_mask),
 					  void *data);
 extern void menelaus_unregister_mmc_callback(void);
Signature · 1 line
2.2.0
Applied
#11 lore raw

PATCH 5/7 mfd: menelaus: delete platform data support

Quoted 8 lines · Aaro Koskinen

Delete platform data support.

---
 arch/arm/mach-omap2/common-board-devices.h |  2 --
 drivers/mfd/menelaus.c                     | 10 +---------
 include/linux/mfd/menelaus.h               |  6 ------
 3 files changed, 1 insertion(+), 17 deletions(-)

Applied, thanks.

Quoted 65 lines
arch/arm/mach-omap2/common-board-devices.h +0 -2
index 07c88ae..7a30228 100644
@@ -2,7 +2,6 @@
 #define __OMAP_COMMON_BOARD_DEVICES__
 
 #include <sound/tlv320aic3x.h>
-#include <linux/mfd/menelaus.h>
 #include "twl-common.h"
 
 #define NAND_BLOCK_SIZE	SZ_128K
@@ -14,7 +13,6 @@ void omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
 		       struct ads7846_platform_data *board_pdata);
 void *n8x0_legacy_init(void);
 
-extern struct menelaus_platform_data n8x0_menelaus_platform_data;
 extern struct aic3x_pdata n810_aic33_data;
 
 #endif /* __OMAP_COMMON_BOARD_DEVICES__ */
drivers/mfd/menelaus.c +1 -9
index 3e04c64..4a900cc 100644
@@ -1181,8 +1181,6 @@ static int menelaus_probe(struct i2c_client *client,
 	int			rev = 0;
 	int			err = 0;
 	struct device_node	*np = client->dev.of_node;
-	struct menelaus_platform_data *menelaus_pdata =
-					dev_get_platdata(&client->dev);
 
 	if (the_menelaus) {
 		dev_dbg(&client->dev, "only one %s for now\n",
@@ -1240,13 +1238,7 @@ static int menelaus_probe(struct i2c_client *client,
 	else
 		menelaus->vcore_hw_mode = 0;
 
-	if (menelaus_pdata != NULL) {
-		if (menelaus_pdata->late_init != NULL) {
-			err = menelaus_pdata->late_init(&client->dev);
-			if (err < 0)
-				goto fail;
-		}
-	} else if (np) {
+	if (np) {
 		u32 vcore_min;
 		u32 vcore_max;
 
include/linux/mfd/menelaus.h +0 -6
index 9e85ac0..21eeff5 100644
@@ -5,12 +5,6 @@
 #ifndef __ASM_ARCH_MENELAUS_H
 #define __ASM_ARCH_MENELAUS_H
 
-struct device;
-
-struct menelaus_platform_data {
-	int (* late_init)(struct device *dev);
-};
-
 extern int menelaus_register_mmc_callback(void (*callback)(void *data, u8 card_mask),
 					  void *data);
 extern void menelaus_unregister_mmc_callback(void);
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author maintainer
#12 lore raw

PATCH 6/7 mfd: menelaus: make vcore and regulator controls internal

In reply to Aaro Koskinen

Make vcore and regulator control functions internal to the driver.

---
 drivers/mfd/menelaus.c       | 13 +++++++++++--
 include/linux/mfd/menelaus.h | 12 ------------
 2 files changed, 11 insertions(+), 14 deletions(-)
drivers/mfd/menelaus.c +11 -2
index 4a900cc..8660adf 100644
@@ -163,6 +163,15 @@
 #define MCT_PIN_ST_S1_CD_ST		(1 << 0)
 #define MCT_PIN_ST_S2_CD_ST		(1 << 1)
 
+#define EN_VPLL_SLEEP			(1 << 7)
+#define EN_VMMC_SLEEP			(1 << 6)
+#define EN_VAUX_SLEEP			(1 << 5)
+#define EN_VIO_SLEEP			(1 << 4)
+#define EN_VMEM_SLEEP			(1 << 3)
+#define EN_DC3_SLEEP			(1 << 2)
+#define EN_DC2_SLEEP			(1 << 1)
+#define EN_VC_SLEEP			(1 << 0)
+
 static void menelaus_work(struct work_struct *_menelaus);
 
 struct menelaus_chip {
@@ -534,7 +543,7 @@ static const struct menelaus_vtg_value vcore_values[] = {
 	{ 1450, 18 },
 };
 
-int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV)
+static int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV)
 {
 	int fval, rval, val, ret;
 	struct i2c_client *c = the_menelaus->client;
@@ -743,7 +752,7 @@ int menelaus_get_slot_pin_states(void)
 }
 EXPORT_SYMBOL(menelaus_get_slot_pin_states);
 
-int menelaus_set_regulator_sleep(int enable, u32 val)
+static int menelaus_set_regulator_sleep(int enable, u32 val)
 {
 	int t, ret;
 	struct i2c_client *c = the_menelaus->client;
include/linux/mfd/menelaus.h +0 -12
index 21eeff5..bcabc03 100644
@@ -18,17 +18,5 @@ extern int menelaus_set_vaux(unsigned int mV);
 extern int menelaus_set_vdcdc(int dcdc, unsigned int mV);
 extern int menelaus_set_slot_sel(int enable);
 extern int menelaus_get_slot_pin_states(void);
-extern int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV);
-
-#define EN_VPLL_SLEEP	(1 << 7)
-#define EN_VMMC_SLEEP	(1 << 6)
-#define EN_VAUX_SLEEP	(1 << 5)
-#define EN_VIO_SLEEP	(1 << 4)
-#define EN_VMEM_SLEEP	(1 << 3)
-#define EN_DC3_SLEEP	(1 << 2)
-#define EN_DC2_SLEEP	(1 << 1)
-#define EN_VC_SLEEP	(1 << 0)
-
-extern int menelaus_set_regulator_sleep(int enable, u32 val);
 
 #endif
Signature · 1 line
2.2.0
#13 lore raw

PATCH 6/7 mfd: menelaus: make vcore and regulator controls internal

Quoted 14 lines · Aaro Koskinen

Make vcore and regulator control functions internal to the driver.

---
 drivers/mfd/menelaus.c       | 13 +++++++++++--
 include/linux/mfd/menelaus.h | 12 ------------
 2 files changed, 11 insertions(+), 14 deletions(-)
drivers/mfd/menelaus.c +0 -0
index 4a900cc..8660adf 100644
@@ -163,6 +163,15 @@
 #define MCT_PIN_ST_S1_CD_ST		(1 << 0)

drivers/mfd/menelaus.c line 173

Quoted 10 lines
drivers/mfd/menelaus.c +8 -0
 #define MCT_PIN_ST_S2_CD_ST		(1 << 1)
 
+#define EN_VPLL_SLEEP			(1 << 7)
+#define EN_VMMC_SLEEP			(1 << 6)
+#define EN_VAUX_SLEEP			(1 << 5)
+#define EN_VIO_SLEEP			(1 << 4)
+#define EN_VMEM_SLEEP			(1 << 3)
+#define EN_DC3_SLEEP			(1 << 2)
+#define EN_DC2_SLEEP			(1 << 1)
+#define EN_VC_SLEEP			(1 << 0)

Better to use the BIT() macro for this kind of stuff.

Please take this opportunity to use it.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
Applied
#14 lore raw

PATCH 6/7 mfd: menelaus: make vcore and regulator controls internal

Quoted 29 lines · Lee Jones
Quoted 14 lines · Aaro Koskinen

Make vcore and regulator control functions internal to the driver.

---
 drivers/mfd/menelaus.c       | 13 +++++++++++--
 include/linux/mfd/menelaus.h | 12 ------------
 2 files changed, 11 insertions(+), 14 deletions(-)
drivers/mfd/menelaus.c +0 -0
index 4a900cc..8660adf 100644
@@ -163,6 +163,15 @@
 #define MCT_PIN_ST_S1_CD_ST		(1 << 0)

drivers/mfd/menelaus.c line 173

Quoted 10 lines
drivers/mfd/menelaus.c +8 -0
 #define MCT_PIN_ST_S2_CD_ST		(1 << 1)
 
+#define EN_VPLL_SLEEP			(1 << 7)
+#define EN_VMMC_SLEEP			(1 << 6)
+#define EN_VAUX_SLEEP			(1 << 5)
+#define EN_VIO_SLEEP			(1 << 4)
+#define EN_VMEM_SLEEP			(1 << 3)
+#define EN_DC3_SLEEP			(1 << 2)
+#define EN_DC2_SLEEP			(1 << 1)
+#define EN_VC_SLEEP			(1 << 0)

Better to use the BIT() macro for this kind of stuff.

Quoted 1 line

Please take this opportunity to use it.

In fact, nevermind. I'll do it from here.

Applied, thanks.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author maintainer
#15 lore raw

PATCH 7/7 mfd: menelaus: use macro for magic number

In reply to Aaro Koskinen

Use macro to check a register bit.

---
 drivers/mfd/menelaus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/menelaus.c +1 -1
index 8660adf..05bae40 100644
@@ -1242,7 +1242,7 @@ static int menelaus_probe(struct i2c_client *client,
 	err = menelaus_read_reg(MENELAUS_VCORE_CTRL1);
 	if (err < 0)
 		goto fail;
-	if (err & BIT(7))
+	if (err & VCORE_CTRL1_HW_NSW)
 		menelaus->vcore_hw_mode = 1;
 	else
 		menelaus->vcore_hw_mode = 0;
Signature · 1 line
2.2.0
Applied
#16 lore raw

PATCH 7/7 mfd: menelaus: use macro for magic number

Quoted 6 lines · Aaro Koskinen

Use macro to check a register bit.

---
 drivers/mfd/menelaus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Quoted 13 lines
drivers/mfd/menelaus.c +1 -1
index 8660adf..05bae40 100644
@@ -1242,7 +1242,7 @@ static int menelaus_probe(struct i2c_client *client,
 	err = menelaus_read_reg(MENELAUS_VCORE_CTRL1);
 	if (err < 0)
 		goto fail;
-	if (err & BIT(7))
+	if (err & VCORE_CTRL1_HW_NSW)
 		menelaus->vcore_hw_mode = 1;
 	else
 		menelaus->vcore_hw_mode = 0;
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#17 lore raw

cover Menelaus cleanup for DT, phase 1

In reply to Aaro Koskinen
Quoted 15 lines · Aaro Koskinen

These patches start removal of board-specific callbacks from Menelaus:
delete platform data and a callback from the driver to the board files.

Tested on top of 3.19-rc1 on N800/N810 which are the only in-tree users for the driver.

Aaro Koskinen (7):
mfd: menelaus: delete omap_has_menelaus
mfd: menelaus: drop support for SW controller VCORE
mfd: menelaus: add initial DT support
ARM: OMAP: N8x0: configure menelaus using DT
mfd: menelaus: delete platform data support
mfd: menelaus: make vcore and regulator controls internal
mfd: menelaus: use macro for magic number

Quoted 9 lines
 Documentation/devicetree/bindings/mfd/menelaus.txt | 30 ++++++++
 arch/arm/boot/dts/omap2420-n8x0-common.dtsi        |  3 +
 arch/arm/mach-omap2/board-n8x0.c                   | 57 --------------
 arch/arm/mach-omap2/common-board-devices.h         |  2 -
 arch/arm/mach-omap2/pdata-quirks.c                 |  1 -
 drivers/mfd/menelaus.c                             | 86 ++++++++++++++--------
 include/linux/mfd/menelaus.h                       | 25 -------
 7 files changed, 87 insertions(+), 117 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/menelaus.txt

Scrap that. Looks like I can't apply the other patches without 03/07. Please sort this out with Felipe and re-submit. Don't forget to apply my Ack to the patches I said I "applied".

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog