Skip to contentSkip to conversation

pxa/z2: Add regulator support

PATCH Superseded Marek Vasut 2 participants 3 messages Jun 7, 2010

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pxa/z2: Add regulator support

Register TPS65023 regulator as found in Z2. The Z2 actually contains a TPS65021, but this chip is apparently compatible.

---
 arch/arm/mach-pxa/z2.c |   45 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)
arch/arm/mach-pxa/z2.c +45 -0
index 967e8cb..c9c9857 100644
@@ -27,6 +27,7 @@
 #include <linux/gpio.h>
 #include <linux/gpio_keys.h>
 #include <linux/delay.h>
+#include <linux/regulator/machine.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -610,6 +611,49 @@ static inline void z2_spi_init(void) {}
 #endif
 
 /******************************************************************************
+ * Core power regulator
+ ******************************************************************************/
+#if defined(CONFIG_REGULATOR_TPS65023) || \
+	defined(CONFIG_REGULATOR_TPS65023_MODULE)
+static struct regulator_consumer_supply z2_tps65021_consumers[] = {
+	{
+		.supply	= "vcc_core",
+	}
+};
+
+static struct regulator_init_data z2_tps65021_info[] = {
+	{
+		.constraints = {
+			.name		= "vcc_core range",
+			.min_uV		= 800000,
+			.max_uV		= 1600000,
+			.always_on	= 1,
+			.valid_ops_mask	= REGULATOR_CHANGE_VOLTAGE,
+		},
+		.consumer_supplies	= z2_tps65021_consumers,
+		.num_consumer_supplies	= ARRAY_SIZE(z2_tps65021_consumers),
+	},
+	/* The rest of the LDOs is unused */
+	{},{},{},{},
+};
+
+static struct i2c_board_info __initdata z2_pi2c_board_info[] = {
+	{
+		I2C_BOARD_INFO("tps65023", 0x48),
+		.platform_data	= &z2_tps65021_info,
+	},
+};
+
+static void __init z2_pmic_init(void)
+{
+	pxa27x_set_i2c_power_info(NULL);
+	i2c_register_board_info(1, ARRAY_AND_SIZE(z2_pi2c_board_info));
+}
+#else
+static inline void z2_pmic_init(void) {}
+#endif
+
+/******************************************************************************
  * Machine init
  ******************************************************************************/
 static void __init z2_init(void)
@@ -629,6 +673,7 @@ static void __init z2_init(void)
 	z2_pwm_init();
 	z2_leds_init();
 	z2_keys_init();
+	z2_pmic_init();
 }
 
 MACHINE_START(ZIPIT2, "Zipit Z2")
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 pxa/z2: Add regulator support

Quoted 2 lines · Marek Vasut

Register TPS65023 regulator as found in Z2. The Z2 actually contains a TPS65021, but this chip is apparently compatible.

If you're doing this you should register the chip that is actually present on the board and then modify the driver to bind to both device IDs. That way the driver will be able to handle any differences that do exist.

#2 lore raw

PATCH 1/1 pxa/z2: Add regulator support

Dne Po 7. ?ervna 2010 13:38:03 Mark Brown napsal(a):

Quoted 8 lines · Marek Vasut
Quoted 2 lines

Register TPS65023 regulator as found in Z2. The Z2 actually contains a TPS65021, but this chip is apparently compatible.

If you're doing this you should register the chip that is actually present on the board and then modify the driver to bind to both device IDs. That way the driver will be able to handle any differences that do exist.

Ok, I'll send a patch for this.