All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: i.MX35-PDK Add regulator support
@ 2012-03-23 18:11 ` Alex Gershgorin
  0 siblings, 0 replies; 8+ messages in thread
From: Alex Gershgorin @ 2012-03-23 18:11 UTC (permalink / raw)
  To: Marc Reilly; +Cc: s.hauer, linux-kernel, linux-arm-kernel, Alex

From: Alex <alexg@meprolight.com>

Hi Marc,

Thanks for the patches.

v4 3/4 not directly applicable to Linux version 3.3,
I installed it manually, you could check it out?

> > I'm not very experienced with the regulator driver, but noticed a couple of 
> > minor things with your patch...

I think that my experience in the regulator driver a little less than you :-)

>  static struct resource mx35pdk_flash_resource = {
>  	.start	= MX35_CS0_BASE_ADDR,
> -	.end	= MX35_CS0_BASE_ADDR + SZ_64M - 1,
> +	.end    = MX35_CS0_BASE_ADDR + SZ_64M - 1,

> > did you mean to change this?

No, I will correct this.

> +static struct regulator_init_data vsd_init = {
> +	.constraints = {
> +		.name = "VSD",
> +		.min_uV = 1800000,
> +		.max_uV = 3150000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> +	}
> +};

> > I think this is on at power up too (for imx35)

Maybe you're right, but in this case, the i.MX35 PDK
Do not use PMIC "VSD" regulator, but instead it is used 
a different power source.
I think it can be removed from here :-)


Regards,
Alex Gershgorin





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

* [PATCH] regulator: i.MX35-PDK Add regulator support
@ 2012-03-23 18:11 ` Alex Gershgorin
  0 siblings, 0 replies; 8+ messages in thread
From: Alex Gershgorin @ 2012-03-23 18:11 UTC (permalink / raw)
  To: linux-arm-kernel

From: Alex <alexg@meprolight.com>

Hi Marc,

Thanks for the patches.

v4 3/4 not directly applicable to Linux version 3.3,
I installed it manually, you could check it out?

> > I'm not very experienced with the regulator driver, but noticed a couple of 
> > minor things with your patch...

I think that my experience in the regulator driver a little less than you :-)

>  static struct resource mx35pdk_flash_resource = {
>  	.start	= MX35_CS0_BASE_ADDR,
> -	.end	= MX35_CS0_BASE_ADDR + SZ_64M - 1,
> +	.end    = MX35_CS0_BASE_ADDR + SZ_64M - 1,

> > did you mean to change this?

No, I will correct this.

> +static struct regulator_init_data vsd_init = {
> +	.constraints = {
> +		.name = "VSD",
> +		.min_uV = 1800000,
> +		.max_uV = 3150000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> +	}
> +};

> > I think this is on at power up too (for imx35)

Maybe you're right, but in this case, the i.MX35 PDK
Do not use PMIC "VSD" regulator, but instead it is used 
a different power source.
I think it can be removed from here :-)


Regards,
Alex Gershgorin

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

* Re: [PATCH] regulator: i.MX35-PDK Add regulator support
  2012-03-23 18:11 ` Alex Gershgorin
@ 2012-03-23 22:43   ` Marc Reilly
  -1 siblings, 0 replies; 8+ messages in thread
From: Marc Reilly @ 2012-03-23 22:43 UTC (permalink / raw)
  To: Alex Gershgorin; +Cc: s.hauer, linux-kernel, linux-arm-kernel, Alex

Hi Alex, 

> Thanks for the patches.
> 
> v4 3/4 not directly applicable to Linux version 3.3,
> I installed it manually, you could check it out?

That patch series was based on mfd-2.6/for-next because it should be accepted 
in the kernel through the mfd tree. (look in the Maintainers file for the mfd 
git repo uri).

You could rebase it for 3.3 kernel for your own use. My guess is that the 
confilcts are in the Kconfig or Makefile so it won't be too much trouble.

Cheers,
Marc

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

* [PATCH] regulator: i.MX35-PDK Add regulator support
@ 2012-03-23 22:43   ` Marc Reilly
  0 siblings, 0 replies; 8+ messages in thread
From: Marc Reilly @ 2012-03-23 22:43 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Alex, 

> Thanks for the patches.
> 
> v4 3/4 not directly applicable to Linux version 3.3,
> I installed it manually, you could check it out?

That patch series was based on mfd-2.6/for-next because it should be accepted 
in the kernel through the mfd tree. (look in the Maintainers file for the mfd 
git repo uri).

You could rebase it for 3.3 kernel for your own use. My guess is that the 
confilcts are in the Kconfig or Makefile so it won't be too much trouble.

Cheers,
Marc

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

* Re: [PATCH] regulator: i.MX35-PDK Add regulator support
  2012-03-22 23:52 ` Alex
@ 2012-03-23  1:23   ` Marc Reilly
  -1 siblings, 0 replies; 8+ messages in thread
From: Marc Reilly @ 2012-03-23  1:23 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: Alex, Sascha Hauer, linux-kernel, Alex

Hi,

I'm not very experienced with the regulator driver, but noticed a couple of 
minor things with your patch..

<snip>

> 
>  static const struct imxuart_platform_data uart_pdata __initconst = {
> @@ -55,7 +58,7 @@ static struct physmap_flash_data mx35pdk_flash_data = {
> 
>  static struct resource mx35pdk_flash_resource = {
>  	.start	= MX35_CS0_BASE_ADDR,
> -	.end	= MX35_CS0_BASE_ADDR + SZ_64M - 1,
> +	.end    = MX35_CS0_BASE_ADDR + SZ_64M - 1,

did you mean to change this?

>  	.flags	= IORESOURCE_MEM,
>  };
> 
> @@ -120,8 +123,214 @@ static iomux_v3_cfg_t mx35pdk_pads[] = {
>  	/* I2C1 */
>  	MX35_PAD_I2C1_CLK__I2C1_SCL,
>  	MX35_PAD_I2C1_DAT__I2C1_SDA,
> +	/*PMIC IRQ*/
> +	MX35_PAD_GPIO2_0__GPIO2_0,
>  };
> 
> +static struct regulator_init_data sw1_init = {
> +	.constraints = {
> +		.name = "SW1",
> +		.min_uV = 600000,
> +		.max_uV = 1375000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> +		.valid_modes_mask = 0,
> +		.always_on = 1,
> +		.boot_on = 1,
> +	}
> +};
> +
> +static struct regulator_init_data sw2_init = {
> +	.constraints = {
> +		.name = "SW2",
> +		.min_uV = 900000,
> +		.max_uV = 1850000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> +		.always_on = 1,
> +		.boot_on = 1,
> +	}
> +};
> +
> +static struct regulator_init_data sw3_init = {
> +	.constraints = {
> +		.name = "SW3",
> +		.min_uV = 1100000,
> +		.max_uV = 1850000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> +		.always_on = 1,
> +		.boot_on = 1,
> +	}
> +};
> +
> +static struct regulator_init_data sw4_init = {
> +	.constraints = {
> +		.name = "SW4",
> +		.min_uV = 1100000,
> +		.max_uV = 1850000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> +		.always_on = 1,
> +		.boot_on = 1,
> +	}
> +};
> +
> +static struct regulator_init_data viohi_init = {
> +	.constraints = {
> +		.name = "VIOHI",
> +		.boot_on = 1,
> +	}
> +};
> +
> +static struct regulator_init_data vusb_init = {
> +	.constraints = {
> +		.name = "VUSB",
> +		.boot_on = 1,
> +	}
> +};
> +
> +static struct regulator_init_data vdig_init = {
> +	.constraints = {
> +		.name = "VDIG",
> +		.min_uV = 1050000,
> +		.max_uV = 1800000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> +		.boot_on = 1,
> +	}
> +};
> +
> +static struct regulator_init_data vpll_init = {
> +	.constraints = {
> +		.name = "VPLL",
> +		.min_uV = 1050000,
> +		.max_uV = 1800000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> +		.boot_on = 1,
> +	}
> +};
> +
> +static struct regulator_init_data vusb2_init = {
> +	.constraints = {
> +		.name = "VUSB2",
> +		.min_uV = 2400000,
> +		.max_uV = 2775000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> +		.boot_on = 1,
> +	}
> +};
> +
> +static struct regulator_init_data vvideo_init = {
> +	.constraints = {
> +		.name = "VVIDEO",
> +		.min_uV = 2500000,
> +		.max_uV = 2775000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> +		.boot_on = 1
> +	}
> +};
> +
> +static struct regulator_init_data vaudio_init = {
> +	.constraints = {
> +		.name = "VAUDIO",
> +		.min_uV = 2300000,
> +		.max_uV = 3000000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> +		.boot_on = 1
> +	}
> +};
> +
> +static struct regulator_init_data vsd_init = {
> +	.constraints = {
> +		.name = "VSD",
> +		.min_uV = 1800000,
> +		.max_uV = 3150000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> +	}
> +};

I think this is on at power up too (for imx35)

Cheers,
Marc

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

* [PATCH] regulator: i.MX35-PDK Add regulator support
@ 2012-03-23  1:23   ` Marc Reilly
  0 siblings, 0 replies; 8+ messages in thread
From: Marc Reilly @ 2012-03-23  1:23 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

I'm not very experienced with the regulator driver, but noticed a couple of 
minor things with your patch..

<snip>

> 
>  static const struct imxuart_platform_data uart_pdata __initconst = {
> @@ -55,7 +58,7 @@ static struct physmap_flash_data mx35pdk_flash_data = {
> 
>  static struct resource mx35pdk_flash_resource = {
>  	.start	= MX35_CS0_BASE_ADDR,
> -	.end	= MX35_CS0_BASE_ADDR + SZ_64M - 1,
> +	.end    = MX35_CS0_BASE_ADDR + SZ_64M - 1,

did you mean to change this?

>  	.flags	= IORESOURCE_MEM,
>  };
> 
> @@ -120,8 +123,214 @@ static iomux_v3_cfg_t mx35pdk_pads[] = {
>  	/* I2C1 */
>  	MX35_PAD_I2C1_CLK__I2C1_SCL,
>  	MX35_PAD_I2C1_DAT__I2C1_SDA,
> +	/*PMIC IRQ*/
> +	MX35_PAD_GPIO2_0__GPIO2_0,
>  };
> 
> +static struct regulator_init_data sw1_init = {
> +	.constraints = {
> +		.name = "SW1",
> +		.min_uV = 600000,
> +		.max_uV = 1375000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> +		.valid_modes_mask = 0,
> +		.always_on = 1,
> +		.boot_on = 1,
> +	}
> +};
> +
> +static struct regulator_init_data sw2_init = {
> +	.constraints = {
> +		.name = "SW2",
> +		.min_uV = 900000,
> +		.max_uV = 1850000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> +		.always_on = 1,
> +		.boot_on = 1,
> +	}
> +};
> +
> +static struct regulator_init_data sw3_init = {
> +	.constraints = {
> +		.name = "SW3",
> +		.min_uV = 1100000,
> +		.max_uV = 1850000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> +		.always_on = 1,
> +		.boot_on = 1,
> +	}
> +};
> +
> +static struct regulator_init_data sw4_init = {
> +	.constraints = {
> +		.name = "SW4",
> +		.min_uV = 1100000,
> +		.max_uV = 1850000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> +		.always_on = 1,
> +		.boot_on = 1,
> +	}
> +};
> +
> +static struct regulator_init_data viohi_init = {
> +	.constraints = {
> +		.name = "VIOHI",
> +		.boot_on = 1,
> +	}
> +};
> +
> +static struct regulator_init_data vusb_init = {
> +	.constraints = {
> +		.name = "VUSB",
> +		.boot_on = 1,
> +	}
> +};
> +
> +static struct regulator_init_data vdig_init = {
> +	.constraints = {
> +		.name = "VDIG",
> +		.min_uV = 1050000,
> +		.max_uV = 1800000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> +		.boot_on = 1,
> +	}
> +};
> +
> +static struct regulator_init_data vpll_init = {
> +	.constraints = {
> +		.name = "VPLL",
> +		.min_uV = 1050000,
> +		.max_uV = 1800000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> +		.boot_on = 1,
> +	}
> +};
> +
> +static struct regulator_init_data vusb2_init = {
> +	.constraints = {
> +		.name = "VUSB2",
> +		.min_uV = 2400000,
> +		.max_uV = 2775000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> +		.boot_on = 1,
> +	}
> +};
> +
> +static struct regulator_init_data vvideo_init = {
> +	.constraints = {
> +		.name = "VVIDEO",
> +		.min_uV = 2500000,
> +		.max_uV = 2775000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> +		.boot_on = 1
> +	}
> +};
> +
> +static struct regulator_init_data vaudio_init = {
> +	.constraints = {
> +		.name = "VAUDIO",
> +		.min_uV = 2300000,
> +		.max_uV = 3000000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> +		.boot_on = 1
> +	}
> +};
> +
> +static struct regulator_init_data vsd_init = {
> +	.constraints = {
> +		.name = "VSD",
> +		.min_uV = 1800000,
> +		.max_uV = 3150000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> +	}
> +};

I think this is on at power up too (for imx35)

Cheers,
Marc

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

* [PATCH] regulator: i.MX35-PDK Add regulator support
@ 2012-03-22 23:52 ` Alex
  0 siblings, 0 replies; 8+ messages in thread
From: Alex @ 2012-03-22 23:52 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: linux-arm-kernel, linux-kernel, Alex

This patch register MC13892 PMIC which connected
via I2C bus and allow set the voltage domains
and constraints for each regulator.

Signed-off-by: Alex Gershgorin <alexg@meprolight.com>
---
This patch is based on the following patches from Marc Reilly:
[PATCH v4 1/4] mfd: mc13xxx-core: Prepare for separate spi and i2c backends.
[PATCH v4 2/4] mfd: mc13xxx-core: use regmap for register access.
[PATCH v4 3/4] mfd: mc13xxx-core: Move spi specific code into separate module.
[PATCH v4 4/4] mfd: mc13xxx: Add i2c driver
---
 arch/arm/mach-imx/mach-mx35_3ds.c |  212 ++++++++++++++++++++++++++++++++++++-
 1 files changed, 211 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-imx/mach-mx35_3ds.c b/arch/arm/mach-imx/mach-mx35_3ds.c
index 0af6c9c..3096335 100644
--- a/arch/arm/mach-imx/mach-mx35_3ds.c
+++ b/arch/arm/mach-imx/mach-mx35_3ds.c
@@ -29,6 +29,8 @@
 #include <linux/usb/otg.h>
 
 #include <linux/mtd/physmap.h>
+#include <linux/mfd/mc13892.h>
+#include <linux/regulator/machine.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -43,6 +45,7 @@
 
 #include "devices-imx35.h"
 
+#define GPIO_PMIC_INT IMX_GPIO_NR(2, 0)
 #define EXPIO_PARENT_INT	gpio_to_irq(IMX_GPIO_NR(1, 1))
 
 static const struct imxuart_platform_data uart_pdata __initconst = {
@@ -55,7 +58,7 @@ static struct physmap_flash_data mx35pdk_flash_data = {
 
 static struct resource mx35pdk_flash_resource = {
 	.start	= MX35_CS0_BASE_ADDR,
-	.end	= MX35_CS0_BASE_ADDR + SZ_64M - 1,
+	.end    = MX35_CS0_BASE_ADDR + SZ_64M - 1,
 	.flags	= IORESOURCE_MEM,
 };
 
@@ -120,8 +123,214 @@ static iomux_v3_cfg_t mx35pdk_pads[] = {
 	/* I2C1 */
 	MX35_PAD_I2C1_CLK__I2C1_SCL,
 	MX35_PAD_I2C1_DAT__I2C1_SDA,
+	/*PMIC IRQ*/
+	MX35_PAD_GPIO2_0__GPIO2_0,
 };
 
+static struct regulator_init_data sw1_init = {
+	.constraints = {
+		.name = "SW1",
+		.min_uV = 600000,
+		.max_uV = 1375000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+		.valid_modes_mask = 0,
+		.always_on = 1,
+		.boot_on = 1,
+	}
+};
+
+static struct regulator_init_data sw2_init = {
+	.constraints = {
+		.name = "SW2",
+		.min_uV = 900000,
+		.max_uV = 1850000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+		.always_on = 1,
+		.boot_on = 1,
+	}
+};
+
+static struct regulator_init_data sw3_init = {
+	.constraints = {
+		.name = "SW3",
+		.min_uV = 1100000,
+		.max_uV = 1850000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+		.always_on = 1,
+		.boot_on = 1,
+	}
+};
+
+static struct regulator_init_data sw4_init = {
+	.constraints = {
+		.name = "SW4",
+		.min_uV = 1100000,
+		.max_uV = 1850000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+		.always_on = 1,
+		.boot_on = 1,
+	}
+};
+
+static struct regulator_init_data viohi_init = {
+	.constraints = {
+		.name = "VIOHI",
+		.boot_on = 1,
+	}
+};
+
+static struct regulator_init_data vusb_init = {
+	.constraints = {
+		.name = "VUSB",
+		.boot_on = 1,
+	}
+};
+
+static struct regulator_init_data vdig_init = {
+	.constraints = {
+		.name = "VDIG",
+		.min_uV = 1050000,
+		.max_uV = 1800000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+		.boot_on = 1,
+	}
+};
+
+static struct regulator_init_data vpll_init = {
+	.constraints = {
+		.name = "VPLL",
+		.min_uV = 1050000,
+		.max_uV = 1800000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+		.boot_on = 1,
+	}
+};
+
+static struct regulator_init_data vusb2_init = {
+	.constraints = {
+		.name = "VUSB2",
+		.min_uV = 2400000,
+		.max_uV = 2775000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+		.boot_on = 1,
+	}
+};
+
+static struct regulator_init_data vvideo_init = {
+	.constraints = {
+		.name = "VVIDEO",
+		.min_uV = 2500000,
+		.max_uV = 2775000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+		.boot_on = 1
+	}
+};
+
+static struct regulator_init_data vaudio_init = {
+	.constraints = {
+		.name = "VAUDIO",
+		.min_uV = 2300000,
+		.max_uV = 3000000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+		.boot_on = 1
+	}
+};
+
+static struct regulator_init_data vsd_init = {
+	.constraints = {
+		.name = "VSD",
+		.min_uV = 1800000,
+		.max_uV = 3150000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+	}
+};
+
+static struct regulator_init_data vcam_init = {
+	.constraints = {
+		.name = "VCAM",
+		.min_uV = 2500000,
+		.max_uV = 3000000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
+					REGULATOR_CHANGE_MODE,
+		.valid_modes_mask = REGULATOR_MODE_FAST | REGULATOR_MODE_NORMAL,
+		.boot_on = 1
+	},
+};
+
+static struct regulator_init_data vgen1_init = {
+	.constraints = {
+		.name = "VGEN1",
+		.min_uV = 1200000,
+		.max_uV = 3150000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+	}
+};
+
+static struct regulator_init_data vgen2_init = {
+	.constraints = {
+		.name = "VGEN2",
+		.min_uV = 1200000,
+		.max_uV = 3150000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+		.boot_on = 1,
+	}
+};
+
+static struct regulator_init_data vgen3_init = {
+	.constraints = {
+		.name = "VGEN3",
+		.min_uV = 1800000,
+		.max_uV = 2900000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+	}
+};
+
+static struct mc13xxx_regulator_init_data mx35_3ds_regulators[] = {
+	{ .id = MC13892_SW1, .init_data = &sw1_init },
+	{ .id = MC13892_SW2, .init_data = &sw2_init },
+	{ .id = MC13892_SW3, .init_data = &sw3_init },
+	{ .id = MC13892_SW4, .init_data = &sw4_init },
+	{ .id = MC13892_VIOHI, .init_data = &viohi_init },
+	{ .id = MC13892_VPLL, .init_data = &vpll_init },
+	{ .id = MC13892_VDIG, .init_data = &vdig_init },
+	{ .id = MC13892_VSD, .init_data = &vsd_init },
+	{ .id = MC13892_VUSB2, .init_data = &vusb2_init },
+	{ .id = MC13892_VVIDEO, .init_data = &vvideo_init },
+	{ .id = MC13892_VAUDIO, .init_data = &vaudio_init },
+	{ .id = MC13892_VCAM, .init_data = &vcam_init },
+	{ .id = MC13892_VGEN1, .init_data = &vgen1_init },
+	{ .id = MC13892_VGEN2, .init_data = &vgen2_init },
+	{ .id = MC13892_VGEN3, .init_data = &vgen3_init },
+	{ .id = MC13892_VUSB, .init_data = &vusb_init },
+};
+
+static struct mc13xxx_platform_data mx35_3ds_mc13892_data = {
+	.flags = MC13XXX_USE_RTC | MC13XXX_USE_TOUCHSCREEN,
+	.regulators = {
+		.num_regulators = ARRAY_SIZE(mx35_3ds_regulators),
+		.regulators = mx35_3ds_regulators,
+	},
+};
+
+static struct i2c_board_info mx35_3ds_i2c_mc13892 = {
+
+	I2C_BOARD_INFO("mc13892", 0x08),
+	.platform_data = &mx35_3ds_mc13892_data,
+	.irq = IMX_GPIO_TO_IRQ(GPIO_PMIC_INT),
+};
+
+static void __init imx35_3ds_init_mc13892(void)
+{
+	int ret = gpio_request_one(GPIO_PMIC_INT, GPIOF_DIR_IN, "pmic irq");
+
+	if (ret) {
+		pr_err("failed to get pmic irq: %d\n", ret);
+		return;
+	}
+
+	i2c_register_board_info(0, &mx35_3ds_i2c_mc13892, 1);
+}
+
 static int mx35_3ds_otg_init(struct platform_device *pdev)
 {
 	return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERNAL_PHY);
@@ -204,6 +413,7 @@ static void __init mx35_3ds_init(void)
 		pr_warn("Init of the debugboard failed, all "
 				"devices on the debugboard are unusable.\n");
 	imx35_add_imx_i2c0(&mx35_3ds_i2c0_data);
+	imx35_3ds_init_mc13892();
 }
 
 static void __init mx35pdk_timer_init(void)
-- 
1.7.1


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

* [PATCH] regulator: i.MX35-PDK Add regulator support
@ 2012-03-22 23:52 ` Alex
  0 siblings, 0 replies; 8+ messages in thread
From: Alex @ 2012-03-22 23:52 UTC (permalink / raw)
  To: linux-arm-kernel

This patch register MC13892 PMIC which connected
via I2C bus and allow set the voltage domains
and constraints for each regulator.

Signed-off-by: Alex Gershgorin <alexg@meprolight.com>
---
This patch is based on the following patches from Marc Reilly:
[PATCH v4 1/4] mfd: mc13xxx-core: Prepare for separate spi and i2c backends.
[PATCH v4 2/4] mfd: mc13xxx-core: use regmap for register access.
[PATCH v4 3/4] mfd: mc13xxx-core: Move spi specific code into separate module.
[PATCH v4 4/4] mfd: mc13xxx: Add i2c driver
---
 arch/arm/mach-imx/mach-mx35_3ds.c |  212 ++++++++++++++++++++++++++++++++++++-
 1 files changed, 211 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-imx/mach-mx35_3ds.c b/arch/arm/mach-imx/mach-mx35_3ds.c
index 0af6c9c..3096335 100644
--- a/arch/arm/mach-imx/mach-mx35_3ds.c
+++ b/arch/arm/mach-imx/mach-mx35_3ds.c
@@ -29,6 +29,8 @@
 #include <linux/usb/otg.h>
 
 #include <linux/mtd/physmap.h>
+#include <linux/mfd/mc13892.h>
+#include <linux/regulator/machine.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -43,6 +45,7 @@
 
 #include "devices-imx35.h"
 
+#define GPIO_PMIC_INT IMX_GPIO_NR(2, 0)
 #define EXPIO_PARENT_INT	gpio_to_irq(IMX_GPIO_NR(1, 1))
 
 static const struct imxuart_platform_data uart_pdata __initconst = {
@@ -55,7 +58,7 @@ static struct physmap_flash_data mx35pdk_flash_data = {
 
 static struct resource mx35pdk_flash_resource = {
 	.start	= MX35_CS0_BASE_ADDR,
-	.end	= MX35_CS0_BASE_ADDR + SZ_64M - 1,
+	.end    = MX35_CS0_BASE_ADDR + SZ_64M - 1,
 	.flags	= IORESOURCE_MEM,
 };
 
@@ -120,8 +123,214 @@ static iomux_v3_cfg_t mx35pdk_pads[] = {
 	/* I2C1 */
 	MX35_PAD_I2C1_CLK__I2C1_SCL,
 	MX35_PAD_I2C1_DAT__I2C1_SDA,
+	/*PMIC IRQ*/
+	MX35_PAD_GPIO2_0__GPIO2_0,
 };
 
+static struct regulator_init_data sw1_init = {
+	.constraints = {
+		.name = "SW1",
+		.min_uV = 600000,
+		.max_uV = 1375000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+		.valid_modes_mask = 0,
+		.always_on = 1,
+		.boot_on = 1,
+	}
+};
+
+static struct regulator_init_data sw2_init = {
+	.constraints = {
+		.name = "SW2",
+		.min_uV = 900000,
+		.max_uV = 1850000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+		.always_on = 1,
+		.boot_on = 1,
+	}
+};
+
+static struct regulator_init_data sw3_init = {
+	.constraints = {
+		.name = "SW3",
+		.min_uV = 1100000,
+		.max_uV = 1850000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+		.always_on = 1,
+		.boot_on = 1,
+	}
+};
+
+static struct regulator_init_data sw4_init = {
+	.constraints = {
+		.name = "SW4",
+		.min_uV = 1100000,
+		.max_uV = 1850000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+		.always_on = 1,
+		.boot_on = 1,
+	}
+};
+
+static struct regulator_init_data viohi_init = {
+	.constraints = {
+		.name = "VIOHI",
+		.boot_on = 1,
+	}
+};
+
+static struct regulator_init_data vusb_init = {
+	.constraints = {
+		.name = "VUSB",
+		.boot_on = 1,
+	}
+};
+
+static struct regulator_init_data vdig_init = {
+	.constraints = {
+		.name = "VDIG",
+		.min_uV = 1050000,
+		.max_uV = 1800000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+		.boot_on = 1,
+	}
+};
+
+static struct regulator_init_data vpll_init = {
+	.constraints = {
+		.name = "VPLL",
+		.min_uV = 1050000,
+		.max_uV = 1800000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+		.boot_on = 1,
+	}
+};
+
+static struct regulator_init_data vusb2_init = {
+	.constraints = {
+		.name = "VUSB2",
+		.min_uV = 2400000,
+		.max_uV = 2775000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+		.boot_on = 1,
+	}
+};
+
+static struct regulator_init_data vvideo_init = {
+	.constraints = {
+		.name = "VVIDEO",
+		.min_uV = 2500000,
+		.max_uV = 2775000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+		.boot_on = 1
+	}
+};
+
+static struct regulator_init_data vaudio_init = {
+	.constraints = {
+		.name = "VAUDIO",
+		.min_uV = 2300000,
+		.max_uV = 3000000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+		.boot_on = 1
+	}
+};
+
+static struct regulator_init_data vsd_init = {
+	.constraints = {
+		.name = "VSD",
+		.min_uV = 1800000,
+		.max_uV = 3150000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+	}
+};
+
+static struct regulator_init_data vcam_init = {
+	.constraints = {
+		.name = "VCAM",
+		.min_uV = 2500000,
+		.max_uV = 3000000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
+					REGULATOR_CHANGE_MODE,
+		.valid_modes_mask = REGULATOR_MODE_FAST | REGULATOR_MODE_NORMAL,
+		.boot_on = 1
+	},
+};
+
+static struct regulator_init_data vgen1_init = {
+	.constraints = {
+		.name = "VGEN1",
+		.min_uV = 1200000,
+		.max_uV = 3150000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+	}
+};
+
+static struct regulator_init_data vgen2_init = {
+	.constraints = {
+		.name = "VGEN2",
+		.min_uV = 1200000,
+		.max_uV = 3150000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+		.boot_on = 1,
+	}
+};
+
+static struct regulator_init_data vgen3_init = {
+	.constraints = {
+		.name = "VGEN3",
+		.min_uV = 1800000,
+		.max_uV = 2900000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+	}
+};
+
+static struct mc13xxx_regulator_init_data mx35_3ds_regulators[] = {
+	{ .id = MC13892_SW1, .init_data = &sw1_init },
+	{ .id = MC13892_SW2, .init_data = &sw2_init },
+	{ .id = MC13892_SW3, .init_data = &sw3_init },
+	{ .id = MC13892_SW4, .init_data = &sw4_init },
+	{ .id = MC13892_VIOHI, .init_data = &viohi_init },
+	{ .id = MC13892_VPLL, .init_data = &vpll_init },
+	{ .id = MC13892_VDIG, .init_data = &vdig_init },
+	{ .id = MC13892_VSD, .init_data = &vsd_init },
+	{ .id = MC13892_VUSB2, .init_data = &vusb2_init },
+	{ .id = MC13892_VVIDEO, .init_data = &vvideo_init },
+	{ .id = MC13892_VAUDIO, .init_data = &vaudio_init },
+	{ .id = MC13892_VCAM, .init_data = &vcam_init },
+	{ .id = MC13892_VGEN1, .init_data = &vgen1_init },
+	{ .id = MC13892_VGEN2, .init_data = &vgen2_init },
+	{ .id = MC13892_VGEN3, .init_data = &vgen3_init },
+	{ .id = MC13892_VUSB, .init_data = &vusb_init },
+};
+
+static struct mc13xxx_platform_data mx35_3ds_mc13892_data = {
+	.flags = MC13XXX_USE_RTC | MC13XXX_USE_TOUCHSCREEN,
+	.regulators = {
+		.num_regulators = ARRAY_SIZE(mx35_3ds_regulators),
+		.regulators = mx35_3ds_regulators,
+	},
+};
+
+static struct i2c_board_info mx35_3ds_i2c_mc13892 = {
+
+	I2C_BOARD_INFO("mc13892", 0x08),
+	.platform_data = &mx35_3ds_mc13892_data,
+	.irq = IMX_GPIO_TO_IRQ(GPIO_PMIC_INT),
+};
+
+static void __init imx35_3ds_init_mc13892(void)
+{
+	int ret = gpio_request_one(GPIO_PMIC_INT, GPIOF_DIR_IN, "pmic irq");
+
+	if (ret) {
+		pr_err("failed to get pmic irq: %d\n", ret);
+		return;
+	}
+
+	i2c_register_board_info(0, &mx35_3ds_i2c_mc13892, 1);
+}
+
 static int mx35_3ds_otg_init(struct platform_device *pdev)
 {
 	return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERNAL_PHY);
@@ -204,6 +413,7 @@ static void __init mx35_3ds_init(void)
 		pr_warn("Init of the debugboard failed, all "
 				"devices on the debugboard are unusable.\n");
 	imx35_add_imx_i2c0(&mx35_3ds_i2c0_data);
+	imx35_3ds_init_mc13892();
 }
 
 static void __init mx35pdk_timer_init(void)
-- 
1.7.1

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

end of thread, other threads:[~2012-03-23 23:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-23 18:11 [PATCH] regulator: i.MX35-PDK Add regulator support Alex Gershgorin
2012-03-23 18:11 ` Alex Gershgorin
2012-03-23 22:43 ` Marc Reilly
2012-03-23 22:43   ` Marc Reilly
  -- strict thread matches above, loose matches on Subject: below --
2012-03-22 23:52 Alex
2012-03-22 23:52 ` Alex
2012-03-23  1:23 ` Marc Reilly
2012-03-23  1:23   ` Marc Reilly

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.