[PATCH] OMAP: Fixing build warning with omap3_defconfig

2010-03-02 Thread Anuj Aggarwal
Fixes the below build warning when compiled with omap3_defconfig:

  CC  arch/arm/mach-omap2/board-am3517evm.o
  In file included from arch/arm/mach-omap2/board-am3517evm.c:23:
  include/linux/i2c/pca953x.h:14: warning: 'struct i2c_client' declared
inside parameter list
  include/linux/i2c/pca953x.h:14: warning: its scope is only this definition
or declaration, which is probably not what you want
  include/linux/i2c/pca953x.h:17: warning: 'struct i2c_client' declared inside
parameter list
  CC  arch/arm/mach-omap2/usb-musb.o

Signed-off-by: Anuj Aggarwal 
---
 include/linux/i2c/pca953x.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/linux/i2c/pca953x.h b/include/linux/i2c/pca953x.h
index 81736d6..6c8f853 100644
--- a/include/linux/i2c/pca953x.h
+++ b/include/linux/i2c/pca953x.h
@@ -1,4 +1,5 @@
 /* platform data for the PCA9539 16-bit I/O expander driver */
+#include 
 
 struct pca953x_platform_data {
/* number of the first GPIO */
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv3 4/4] Regulator: OMAP: Use common regulator supplies and init data structs

2010-03-02 Thread Anuj Aggarwal
Removing the common supplies and regulator init data structs for various
OMAP3 platforms and referring them from the twl4030 common file.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/board-3430sdp.c  |  135 ++---
 arch/arm/mach-omap2/board-cm-t35.c   |   47 +
 arch/arm/mach-omap2/board-igep0020.c |   24 +
 arch/arm/mach-omap2/board-ldp.c  |   24 +
 arch/arm/mach-omap2/board-omap3beagle.c  |   47 +
 arch/arm/mach-omap2/board-omap3evm.c |   47 +
 arch/arm/mach-omap2/board-omap3touchbook.c   |   47 +
 arch/arm/mach-omap2/board-overo.c|   23 +
 arch/arm/mach-omap2/board-zoom-peripherals.c |   71 ++
 9 files changed, 47 insertions(+), 418 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index f312b15..e414371 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -47,6 +47,7 @@
 #include "sdram-qimonda-hyb18m512160af-6.h"
 #include "hsmmc.h"
 #include "pm.h"
+#include "twl4030-pmic.h"

 #define CONFIG_DISABLE_HFCLK 1

@@ -365,18 +366,6 @@ static struct omap2_hsmmc_info mmc[] = {
{}  /* Terminator */
 };

-static struct regulator_consumer_supply sdp3430_vmmc1_supply = {
-   .supply = "vmmc",
-};
-
-static struct regulator_consumer_supply sdp3430_vsim_supply = {
-   .supply = "vmmc_aux",
-};
-
-static struct regulator_consumer_supply sdp3430_vmmc2_supply = {
-   .supply = "vmmc",
-};
-
 static int sdp3430_twl_gpio_setup(struct device *dev,
unsigned gpio, unsigned ngpio)
 {
@@ -390,9 +379,9 @@ static int sdp3430_twl_gpio_setup(struct device *dev,
/* link regulators to MMC adapters ... we "know" the
 * regulators will be set up only *after* we return.
 */
-   sdp3430_vmmc1_supply.dev = mmc[0].dev;
-   sdp3430_vsim_supply.dev = mmc[0].dev;
-   sdp3430_vmmc2_supply.dev = mmc[1].dev;
+   twl4030_vmmc1_supply.dev = mmc[0].dev;
+   twl4030_vsim_supply.dev = mmc[0].dev;
+   twl4030_vmmc2_supply.dev = mmc[1].dev;

/* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */
gpio_request(gpio + 7, "sub_lcd_en_bkl");
@@ -422,108 +411,6 @@ static struct twl4030_madc_platform_data 
sdp3430_madc_data = {
.irq_line   = 1,
 };

-/*
- * Apply all the fixed voltages since most versions of U-Boot
- * don't bother with that initialization.
- */
-
-/* VAUX1 for mainboard (irda and sub-lcd) */
-static struct regulator_init_data sdp3430_vaux1 = {
-   .constraints = {
-   .min_uV = 280,
-   .max_uV = 280,
-   .apply_uV   = true,
-   .valid_modes_mask   = REGULATOR_MODE_NORMAL
-   | REGULATOR_MODE_STANDBY,
-   .valid_ops_mask = REGULATOR_CHANGE_MODE
-   | REGULATOR_CHANGE_STATUS,
-   },
-};
-
-/* VAUX2 for camera module */
-static struct regulator_init_data sdp3430_vaux2 = {
-   .constraints = {
-   .min_uV = 280,
-   .max_uV = 280,
-   .apply_uV   = true,
-   .valid_modes_mask   = REGULATOR_MODE_NORMAL
-   | REGULATOR_MODE_STANDBY,
-   .valid_ops_mask = REGULATOR_CHANGE_MODE
-   | REGULATOR_CHANGE_STATUS,
-   },
-};
-
-/* VAUX3 for LCD board */
-static struct regulator_init_data sdp3430_vaux3 = {
-   .constraints = {
-   .min_uV = 280,
-   .max_uV = 280,
-   .apply_uV   = true,
-   .valid_modes_mask   = REGULATOR_MODE_NORMAL
-   | REGULATOR_MODE_STANDBY,
-   .valid_ops_mask = REGULATOR_CHANGE_MODE
-   | REGULATOR_CHANGE_STATUS,
-   },
-};
-
-/* VAUX4 for OMAP VDD_CSI2 (camera) */
-static struct regulator_init_data sdp3430_vaux4 = {
-   .constraints = {
-   .min_uV = 180,
-   .max_uV = 180,
-   .apply_uV   = true,
-   .valid_modes_mask   = REGULATOR_MODE_NORMAL
-   | REGULATOR_MODE_STANDBY,
-   .valid_ops_mask = REGULATOR_CHANGE_MODE
-   | REGULATOR_CHANGE_STATUS,
-   },
-};
-
-/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
-static struct regulator_init_data sdp3430_vmmc1 = {
-   .constraints = {
-   .min_uV   

[PATCHv3 3/4] Regulator: OMAP: Kconfig modified to select TWL4030 for OMAP3-platforms

2010-03-02 Thread Anuj Aggarwal
Kconfig is modified so that PMIC TWL4030 is automatically selected for
platforms using it. It is required to compile twl4030-pmic.c in the build.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/Kconfig |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 1974dda..f58f321 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -57,6 +57,7 @@ config MACH_OMAP3_BEAGLE
bool "OMAP3 BEAGLE board"
depends on ARCH_OMAP3
select OMAP_PACKAGE_CBB
+   select PMIC_TWL4030

 config MACH_DEVKIT8000
 bool "DEVKIT8000 board"
@@ -66,16 +67,19 @@ config MACH_OMAP_LDP
bool "OMAP3 LDP board"
depends on ARCH_OMAP3
select OMAP_PACKAGE_CBB
+   select PMIC_TWL4030

 config MACH_OVERO
bool "Gumstix Overo board"
depends on ARCH_OMAP3
select OMAP_PACKAGE_CBB
+   select PMIC_TWL4030

 config MACH_OMAP3EVM
bool "OMAP 3530 EVM board"
depends on ARCH_OMAP3
select OMAP_PACKAGE_CBB
+   select PMIC_TWL4030

 config PMIC_TWL4030
bool "TWL4030/TPS65950 Power Module"
@@ -100,11 +104,13 @@ config MACH_OMAP3_TOUCHBOOK
bool "OMAP3 Touch Book"
depends on ARCH_OMAP3
select BACKLIGHT_CLASS_DEVICE
+   select PMIC_TWL4030

 config MACH_OMAP_3430SDP
bool "OMAP 3430 SDP board"
depends on ARCH_OMAP3
select OMAP_PACKAGE_CBB
+   select PMIC_TWL4030

 config MACH_NOKIA_N800
bool
@@ -131,27 +137,32 @@ config MACH_OMAP_ZOOM2
bool "OMAP3 Zoom2 board"
depends on ARCH_OMAP3
select OMAP_PACKAGE_CBB
+   select PMIC_TWL4030

 config MACH_OMAP_ZOOM3
bool "OMAP3630 Zoom3 board"
depends on ARCH_OMAP3
select OMAP_PACKAGE_CBP
+   select PMIC_TWL4030

 config MACH_CM_T35
bool "CompuLab CM-T35 module"
depends on ARCH_OMAP3
select OMAP_PACKAGE_CUS
select OMAP_MUX
+   select PMIC_TWL4030

 config MACH_IGEP0020
bool "IGEP v2 board"
depends on ARCH_OMAP3
select OMAP_PACKAGE_CBB
+   select PMIC_TWL4030

 config MACH_OMAP_3630SDP
bool "OMAP3630 SDP board"
depends on ARCH_OMAP3
select OMAP_PACKAGE_CBP
+   select PMIC_TWL4030

 config MACH_OMAP_4430SDP
bool "OMAP 4430 SDP board"
--
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv3 2/4] Regulator: OMAP: Modifying Kconfig/Makefile to choose from available PMICs

2010-03-02 Thread Anuj Aggarwal
Kconfig is modified for OMAP3 EVM so that user can choose the appropriate
PMIC (currently only TWL4030). Config options for other PMICs will be
added later on.
Makefile is modified so that twl4030-pmic.c gets compiled for the
platforms having TWL4030 as the PMIC.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/Kconfig  |9 +
 arch/arm/mach-omap2/Makefile |1 +
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index a8a3d1e..1974dda 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -77,6 +77,15 @@ config MACH_OMAP3EVM
depends on ARCH_OMAP3
select OMAP_PACKAGE_CBB

+config PMIC_TWL4030
+   bool "TWL4030/TPS65950 Power Module"
+   default y
+   select TWL4030_CORE
+   select REGULATOR_TWL4030 if REGULATOR
+   help
+ Say yes here if you are using the TWL4030/TPS65950 based power module
+ for the EVM boards.
+
 config MACH_OMAP3517EVM
bool "OMAP3517/ AM3517 EVM board"
depends on ARCH_OMAP3
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 2069fb3..c33e24d 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -137,6 +137,7 @@ obj-$(CONFIG_MACH_IGEP0020) += board-igep0020.o \
   hsmmc.o
 obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK) += board-omap3touchbook.o \
   hsmmc.o
+obj-$(CONFIG_PMIC_TWL4030) += twl4030-pmic.o
 obj-$(CONFIG_MACH_OMAP_4430SDP)+= board-4430sdp.o

 obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o
--
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv3 1/4] Regulator: OMAP: Creating TWL4030 file having supplies & init data

2010-03-02 Thread Anuj Aggarwal
A new file for TWL4030/TPS65950 is created which has common supplies
and regulator init data structures. They will be referenced from the
various board-evm files depending upon the EVM requirements, using
the twl4030-pmic.h header file.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/twl4030-pmic.c |  175 
 arch/arm/mach-omap2/twl4030-pmic.h |   34 +++
 2 files changed, 209 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/twl4030-pmic.c
 create mode 100644 arch/arm/mach-omap2/twl4030-pmic.h

diff --git a/arch/arm/mach-omap2/twl4030-pmic.c 
b/arch/arm/mach-omap2/twl4030-pmic.c
new file mode 100644
index 000..0c0a860
--- /dev/null
+++ b/arch/arm/mach-omap2/twl4030-pmic.c
@@ -0,0 +1,175 @@
+/*
+ * twl4030-pmic.c
+ *
+ * Common regulator supplies and init data structs for TWL4030/TPS65950
+ * PMIC for OMAP3 based EVMs. They can be used in various board-evm
+ * files for OMAP3 based platforms using TWL4030.
+ *
+ * Copyright (C) 2010 Texas Instrument Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+
+/* VDAC */
+struct regulator_consumer_supply twl4030_vdac_supply = {
+   .supply = "vdac",
+};
+
+/* VMMC1 */
+struct regulator_consumer_supply twl4030_vmmc1_supply = {
+   .supply = "vmmc",
+};
+
+/* VMMC2 */
+struct regulator_consumer_supply twl4030_vmmc2_supply = {
+   .supply = "vmmc",
+};
+
+/* VSIM */
+struct regulator_consumer_supply twl4030_vsim_supply = {
+   .supply = "vmmc_aux",
+};
+
+/* VPLL2 for digital video outputs */
+struct regulator_consumer_supply twl4030_vpll2_supply = {
+   .supply = "vdvi",
+};
+
+/* Regulator initialization data */
+/* VAUX1 */
+struct regulator_init_data twl4030_vaux1_data = {
+   .constraints = {
+   .min_uV = 280,
+   .max_uV = 280,
+   .apply_uV   = true,
+   .valid_modes_mask   = REGULATOR_MODE_NORMAL
+   | REGULATOR_MODE_STANDBY,
+   .valid_ops_mask = REGULATOR_CHANGE_MODE
+   | REGULATOR_CHANGE_STATUS,
+   },
+};
+
+/* VAUX2 */
+struct regulator_init_data twl4030_vaux2_data = {
+   .constraints = {
+   .min_uV = 280,
+   .max_uV = 280,
+   .apply_uV   = true,
+   .valid_modes_mask   = REGULATOR_MODE_NORMAL
+   | REGULATOR_MODE_STANDBY,
+   .valid_ops_mask = REGULATOR_CHANGE_MODE
+   | REGULATOR_CHANGE_STATUS,
+   },
+};
+
+/* VAUX3 */
+struct regulator_init_data twl4030_vaux3_data = {
+   .constraints = {
+   .min_uV = 280,
+   .max_uV = 280,
+   .apply_uV   = true,
+   .valid_modes_mask   = REGULATOR_MODE_NORMAL
+   | REGULATOR_MODE_STANDBY,
+   .valid_ops_mask = REGULATOR_CHANGE_MODE
+   | REGULATOR_CHANGE_STATUS,
+   },
+};
+
+/* VAUX4 */
+struct regulator_init_data twl4030_vaux4_data = {
+   .constraints = {
+   .min_uV = 180,
+   .max_uV = 180,
+   .apply_uV   = true,
+   .valid_modes_mask   = REGULATOR_MODE_NORMAL
+   | REGULATOR_MODE_STANDBY,
+   .valid_ops_mask = REGULATOR_CHANGE_MODE
+   | REGULATOR_CHANGE_STATUS,
+   },
+};
+
+/* VMMC1 */
+struct regulator_init_data twl4030_vmmc1_data = {
+   .constraints = {
+   .min_uV = 185,
+   .max_uV = 315,
+   .valid_modes_mask   = REGULATOR_MODE_NORMAL
+   | REGULATOR_MODE_STANDBY,
+   .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
+   | REGULATOR_CHANGE_MODE
+   | REGULATOR_CHANGE_STATUS,
+   },
+   .num_consumer_supplies  = 1,
+   .consumer_supplies  = &twl4030_vmmc1_supply,
+};
+
+/* VMMC2 */
+struct regulator_init_data twl4030_vmmc2_data = {
+   .constraints = {
+ 

[PATCHv3 0/4] Regulator: OMAP: Removing common code for TWL4030 from OMAP3-board-evms

2010-03-02 Thread Anuj Aggarwal
Sending version 3 of this patch-set after rebasing it against the for-next
branch in the linux-omap tree. The previous series can be found at:
  http://marc.info/?l=linux-omap&m=126328763822497&w=2

This patch set is created to clean up various OMAP3-board-evm files
and remove common TWL4030 specific regulator suplies and init data
structs. These structures are instead placed in a new generic file -
twl4030-pmic.c - and are referenced from the OMAP3 board-evm
files depending on the platform requirements. Regulator having specific
supplies or init data structs are not changed in their respective
board-evms.

uImage built and tested for OMAP3EVM; compile-tested for SDP3430 and all OMAP
platforms (using omap3_defconfig).

Anuj Aggarwal (4):
  Regulator: OMAP: Creating TWL4030 file having supplies & init data
  Regulator: OMAP: Modifying Kconfig/Makefile to choose from available
PMICs
  Regulator: OMAP: Kconfig modified to select TWL4030 for
OMAP3-platforms
  Regulator: OMAP: Use common regulator supplies and init data structs

 arch/arm/mach-omap2/Kconfig  |   20 +++
 arch/arm/mach-omap2/Makefile |1 +
 arch/arm/mach-omap2/board-3430sdp.c  |  135 ++--
 arch/arm/mach-omap2/board-cm-t35.c   |   47 +--
 arch/arm/mach-omap2/board-igep0020.c |   24 +---
 arch/arm/mach-omap2/board-ldp.c  |   24 +---
 arch/arm/mach-omap2/board-omap3beagle.c  |   47 +--
 arch/arm/mach-omap2/board-omap3evm.c |   47 +--
 arch/arm/mach-omap2/board-omap3touchbook.c   |   47 +--
 arch/arm/mach-omap2/board-overo.c|   23 +---
 arch/arm/mach-omap2/board-zoom-peripherals.c |   71 +--
 arch/arm/mach-omap2/twl4030-pmic.c   |  175 ++
 arch/arm/mach-omap2/twl4030-pmic.h   |   34 +
 13 files changed, 277 insertions(+), 418 deletions(-)
 create mode 100644 arch/arm/mach-omap2/twl4030-pmic.c
 create mode 100644 arch/arm/mach-omap2/twl4030-pmic.h

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] ASoC: AM3517: ASoC driver not getting compiled

2010-01-29 Thread Anuj Aggarwal
Commit 761c9d45 (ASoC: Fix build of OMAP sound drivers) changes
CONFIG_MACH_OMAP3517EVM -> CONFIG_SND_OMAP_SOC_OMAP3517EVM in the
Makefile. Whereas the config option defined in Kconfig is
SND_OMAP_SOC_AM3517EVM. Because of this, ASoC driver for AM3517
was not getting compiled.

Signed-off-by: Anuj Aggarwal 
---
 sound/soc/omap/Makefile |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index 3db8a6c..19283e5 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -25,7 +25,7 @@ obj-$(CONFIG_SND_OMAP_SOC_OSK5912) += snd-soc-osk5912.o
 obj-$(CONFIG_SND_OMAP_SOC_OVERO) += snd-soc-overo.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP2EVM) += snd-soc-omap2evm.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP3EVM) += snd-soc-omap3evm.o
-obj-$(CONFIG_SND_OMAP_SOC_OMAP3517EVM) += snd-soc-am3517evm.o
+obj-$(CONFIG_SND_OMAP_SOC_AM3517EVM) += snd-soc-am3517evm.o
 obj-$(CONFIG_SND_OMAP_SOC_SDP3430) += snd-soc-sdp3430.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE) += snd-soc-omap3beagle.o
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] ASoC: AIC23: Fixing writes to non-existing registers in resume function

2010-01-29 Thread Anuj Aggarwal
Commit e9ff5eb2 (Fixing infinite loop in resume path) uses wrong AIC23
register in resume function because of which register writes happen
on some non-existing registers.

Signed-off-by: Anuj Aggarwal 
---
 sound/soc/codecs/tlv320aic23.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
index a9dc5fb..da589d8 100644
--- a/sound/soc/codecs/tlv320aic23.c
+++ b/sound/soc/codecs/tlv320aic23.c
@@ -627,7 +627,7 @@ static int tlv320aic23_resume(struct platform_device *pdev)
u16 reg;
 
/* Sync reg_cache with the hardware */
-   for (reg = 0; reg < TLV320AIC23_RESET; reg++) {
+   for (reg = 0; reg <= TLV320AIC23_ACTIVE; reg++) {
u16 val = tlv320aic23_read_reg_cache(codec, reg);
tlv320aic23_write(codec, reg, val);
}
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [alsa-devel] Audio suspend/resume status on OMAP3 based platforms

2010-01-12 Thread Anuj Aggarwal
On Tue, Jan 12, 2010 at 9:41 PM, Mark Brown
 wrote:
>
> On Tue, Jan 12, 2010 at 09:35:15PM +0530, Aggarwal, Anuj wrote:
>
> > b) same command, when audio loopback is running in
> > background
>
> It'd be helpful to specify what you mean by audio loopback here - I
> think you mean something along the lines of 'arecord | aplay -' but
> it'd be good to confirm since there's multiple meanings people use for
> the term.
Thanks for pointing it out, I meant the same:
arecord -f cd | aplay &
echo mem > /sys/power/state
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv2 4/4] Regulator: OMAP: Use common regulator supplies and init data structs

2010-01-12 Thread Anuj Aggarwal
Removing the common supplies and regulator init data structs for various
OMAP3 platforms and referring them from the twl4030 common file.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/board-3430sdp.c  |  135 ++---
 arch/arm/mach-omap2/board-cm-t35.c   |   47 +
 arch/arm/mach-omap2/board-igep0020.c |   24 +
 arch/arm/mach-omap2/board-ldp.c  |   24 +
 arch/arm/mach-omap2/board-omap3beagle.c  |   47 +
 arch/arm/mach-omap2/board-omap3evm.c |   47 +
 arch/arm/mach-omap2/board-omap3touchbook.c   |   47 +
 arch/arm/mach-omap2/board-overo.c|   23 +
 arch/arm/mach-omap2/board-zoom-peripherals.c |   71 ++
 9 files changed, 47 insertions(+), 418 deletions(-)
 mode change 100755 => 100644 arch/arm/mach-omap2/board-zoom-peripherals.c

diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index c90b0d0..39860fb 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -44,6 +44,7 @@
 #include "mux.h"
 #include "sdram-qimonda-hyb18m512160af-6.h"
 #include "mmc-twl4030.h"
+#include "twl4030-pmic.h"
 
 #define CONFIG_DISABLE_HFCLK 1
 
@@ -343,18 +344,6 @@ static struct twl4030_hsmmc_info mmc[] = {
{}  /* Terminator */
 };
 
-static struct regulator_consumer_supply sdp3430_vmmc1_supply = {
-   .supply = "vmmc",
-};
-
-static struct regulator_consumer_supply sdp3430_vsim_supply = {
-   .supply = "vmmc_aux",
-};
-
-static struct regulator_consumer_supply sdp3430_vmmc2_supply = {
-   .supply = "vmmc",
-};
-
 static int sdp3430_twl_gpio_setup(struct device *dev,
unsigned gpio, unsigned ngpio)
 {
@@ -368,9 +357,9 @@ static int sdp3430_twl_gpio_setup(struct device *dev,
/* link regulators to MMC adapters ... we "know" the
 * regulators will be set up only *after* we return.
 */
-   sdp3430_vmmc1_supply.dev = mmc[0].dev;
-   sdp3430_vsim_supply.dev = mmc[0].dev;
-   sdp3430_vmmc2_supply.dev = mmc[1].dev;
+   twl4030_vmmc1_supply.dev = mmc[0].dev;
+   twl4030_vsim_supply.dev = mmc[0].dev;
+   twl4030_vmmc2_supply.dev = mmc[1].dev;
 
/* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */
gpio_request(gpio + 7, "sub_lcd_en_bkl");
@@ -400,108 +389,6 @@ static struct twl4030_madc_platform_data 
sdp3430_madc_data = {
.irq_line   = 1,
 };
 
-/*
- * Apply all the fixed voltages since most versions of U-Boot
- * don't bother with that initialization.
- */
-
-/* VAUX1 for mainboard (irda and sub-lcd) */
-static struct regulator_init_data sdp3430_vaux1 = {
-   .constraints = {
-   .min_uV = 280,
-   .max_uV = 280,
-   .apply_uV   = true,
-   .valid_modes_mask   = REGULATOR_MODE_NORMAL
-   | REGULATOR_MODE_STANDBY,
-   .valid_ops_mask = REGULATOR_CHANGE_MODE
-   | REGULATOR_CHANGE_STATUS,
-   },
-};
-
-/* VAUX2 for camera module */
-static struct regulator_init_data sdp3430_vaux2 = {
-   .constraints = {
-   .min_uV = 280,
-   .max_uV = 280,
-   .apply_uV   = true,
-   .valid_modes_mask   = REGULATOR_MODE_NORMAL
-   | REGULATOR_MODE_STANDBY,
-   .valid_ops_mask = REGULATOR_CHANGE_MODE
-   | REGULATOR_CHANGE_STATUS,
-   },
-};
-
-/* VAUX3 for LCD board */
-static struct regulator_init_data sdp3430_vaux3 = {
-   .constraints = {
-   .min_uV = 280,
-   .max_uV = 280,
-   .apply_uV   = true,
-   .valid_modes_mask   = REGULATOR_MODE_NORMAL
-   | REGULATOR_MODE_STANDBY,
-   .valid_ops_mask = REGULATOR_CHANGE_MODE
-   | REGULATOR_CHANGE_STATUS,
-   },
-};
-
-/* VAUX4 for OMAP VDD_CSI2 (camera) */
-static struct regulator_init_data sdp3430_vaux4 = {
-   .constraints = {
-   .min_uV = 180,
-   .max_uV = 180,
-   .apply_uV   = true,
-   .valid_modes_mask   = REGULATOR_MODE_NORMAL
-   | REGULATOR_MODE_STANDBY,
-   .valid_ops_mask = REGULATOR_CHANGE_MODE
-   | REGULATOR_CHANGE_STATUS,
-   },
-};
-
-/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
-static struct regu

[PATCHv2 3/4] Regulator: OMAP: Kconfig modified to select TWL4030 for OMAP3-platforms

2010-01-12 Thread Anuj Aggarwal
Kconfig is modified so that PMIC TWL4030 is automatically selected for
platforms using it. It is required to compile twl4030-pmic.c in the build.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/Kconfig |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 69173f3..9a5c3b4 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -66,16 +66,19 @@ config MACH_OMAP3_BEAGLE
bool "OMAP3 BEAGLE board"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select OMAP_PACKAGE_CBB
+   select PMIC_TWL4030
 
 config MACH_OMAP_LDP
bool "OMAP3 LDP board"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select OMAP_PACKAGE_CBB
+   select PMIC_TWL4030
 
 config MACH_OVERO
bool "Gumstix Overo board"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select OMAP_PACKAGE_CBB
+   select PMIC_TWL4030
 
 config MACH_OMAP3EVM
bool "OMAP 3530 EVM board"
@@ -100,16 +103,19 @@ config MACH_OMAP3_PANDORA
bool "OMAP3 Pandora"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select OMAP_PACKAGE_CBB
+   select PMIC_TWL4030
 
 config MACH_OMAP3_TOUCHBOOK
bool "OMAP3 Touch Book"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select BACKLIGHT_CLASS_DEVICE
+   select PMIC_TWL4030
 
 config MACH_OMAP_3430SDP
bool "OMAP 3430 SDP board"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select OMAP_PACKAGE_CBB
+   select PMIC_TWL4030
 
 config MACH_NOKIA_N800
bool
@@ -136,27 +142,32 @@ config MACH_OMAP_ZOOM2
bool "OMAP3 Zoom2 board"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select OMAP_PACKAGE_CBB
+   select PMIC_TWL4030
 
 config MACH_OMAP_ZOOM3
bool "OMAP3630 Zoom3 board"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select OMAP_PACKAGE_CBP
+   select PMIC_TWL4030
 
 config MACH_CM_T35
bool "CompuLab CM-T35 module"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select OMAP_PACKAGE_CUS
select OMAP_MUX
+   select PMIC_TWL4030
 
 config MACH_IGEP0020
bool "IGEP0020"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select OMAP_PACKAGE_CBB
+   select PMIC_TWL4030
 
 config MACH_OMAP_3630SDP
bool "OMAP3630 SDP board"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select OMAP_PACKAGE_CBP
+   select PMIC_TWL4030
 
 config MACH_OMAP_4430SDP
bool "OMAP 4430 SDP board"
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv2 2/4] Regulator: OMAP:Modifying Kconfig/Makefile to choose from available PMICs

2010-01-12 Thread Anuj Aggarwal
Kconfig is modified for OMAP3 EVM so that user can choose the appropriate
PMIC (currently only TWL4030). Config options for other PMICs will be
added later on.
Makefile is modified so that twl4030-pmic.c gets compiled for the
platforms having TWL4030 as the PMIC.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/Kconfig  |9 +
 arch/arm/mach-omap2/Makefile |1 +
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 606bf04..69173f3 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -82,6 +82,15 @@ config MACH_OMAP3EVM
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select OMAP_PACKAGE_CBB
 
+config PMIC_TWL4030
+   bool "TWL4030/TPS65950 Power Module"
+   default y
+   select TWL4030_CORE
+   select REGULATOR_TWL4030 if REGULATOR
+   help
+ Say yes here if you are using the TWL4030/TPS65950 based power module
+ for the EVM boards.
+
 config MACH_OMAP3517EVM
bool "OMAP3517/ AM3517 EVM board"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index b32678b..de6ace5 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -107,6 +107,7 @@ obj-$(CONFIG_MACH_IGEP0020) += board-igep0020.o \
   mmc-twl4030.o
 obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK) += board-omap3touchbook.o \
   mmc-twl4030.o
+obj-$(CONFIG_PMIC_TWL4030) += twl4030-pmic.o
 obj-$(CONFIG_MACH_OMAP_4430SDP)+= board-4430sdp.o
 
 obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv2 0/4] Regulator: OMAP: Removing common code for TWL4030 from OMAP3- board-evms

2010-01-12 Thread Anuj Aggarwal
Sending version 2 of this patch set after taking all those comments. First
series can be found at:
  http://marc.info/?l=linux-omap&m=126297346131188&w=2

This patch set is created to clean up various OMAP3-board-evm files
and remove common TWL4030 specific regulator suplies and init data
structs. These structures are instead placed in a new generic file -
twl4030-pmic.c - and are referenced from the OMAP3 board-evm
files depending on the platform requirements. Regulator having specific
supplies or init data structs are not changed in their respective
board-evms.

The main advantages of having one common file for these structures
are redundant code removal, easy maintainability and single copy of 
common structure(s) in case uImage for multiple platforms is built.

Anuj Aggarwal (4):
  Regulator: OMAP: Creating TWL4030 file having supplies & init data
  Regulator: OMAP:Modifying Kconfig/Makefile to choose from available
PMICs
  Regulator: OMAP: Kconfig modified to select TWL4030 for
OMAP3-platforms
  Regulator: OMAP: Use common regulator supplies and init data structs

 arch/arm/mach-omap2/Kconfig  |   20 +++
 arch/arm/mach-omap2/Makefile |1 +
 arch/arm/mach-omap2/board-3430sdp.c  |  135 ++--
 arch/arm/mach-omap2/board-cm-t35.c   |   47 +--
 arch/arm/mach-omap2/board-igep0020.c |   24 +---
 arch/arm/mach-omap2/board-ldp.c  |   24 +---
 arch/arm/mach-omap2/board-omap3beagle.c  |   47 +--
 arch/arm/mach-omap2/board-omap3evm.c |   47 +--
 arch/arm/mach-omap2/board-omap3touchbook.c   |   47 +--
 arch/arm/mach-omap2/board-overo.c|   23 +---
 arch/arm/mach-omap2/board-zoom-peripherals.c |   71 +--
 arch/arm/mach-omap2/twl4030-pmic.c   |  175 ++
 arch/arm/mach-omap2/twl4030-pmic.h   |   34 +
 13 files changed, 277 insertions(+), 418 deletions(-)
 mode change 100755 => 100644 arch/arm/mach-omap2/board-zoom-peripherals.c
 create mode 100644 arch/arm/mach-omap2/twl4030-pmic.c
 create mode 100644 arch/arm/mach-omap2/twl4030-pmic.h

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv2 1/4] Regulator: OMAP: Creating TWL4030 file having supplies & init data

2010-01-12 Thread Anuj Aggarwal
A new file for TWL4030/TPS65950 is created which has common supplies
and regulator init data structures. They will be referenced from the
various board-evm files depending upon the EVM requirements, using
the twl4030-pmic.h header file.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/twl4030-pmic.c |  175 
 arch/arm/mach-omap2/twl4030-pmic.h |   34 +++
 2 files changed, 209 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/twl4030-pmic.c
 create mode 100644 arch/arm/mach-omap2/twl4030-pmic.h

diff --git a/arch/arm/mach-omap2/twl4030-pmic.c 
b/arch/arm/mach-omap2/twl4030-pmic.c
new file mode 100644
index 000..0c0a860
--- /dev/null
+++ b/arch/arm/mach-omap2/twl4030-pmic.c
@@ -0,0 +1,175 @@
+/*
+ * twl4030-pmic.c
+ *
+ * Common regulator supplies and init data structs for TWL4030/TPS65950
+ * PMIC for OMAP3 based EVMs. They can be used in various board-evm
+ * files for OMAP3 based platforms using TWL4030.
+ *
+ * Copyright (C) 2010 Texas Instrument Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+
+/* VDAC */
+struct regulator_consumer_supply twl4030_vdac_supply = {
+   .supply = "vdac",
+};
+
+/* VMMC1 */
+struct regulator_consumer_supply twl4030_vmmc1_supply = {
+   .supply = "vmmc",
+};
+
+/* VMMC2 */
+struct regulator_consumer_supply twl4030_vmmc2_supply = {
+   .supply = "vmmc",
+};
+
+/* VSIM */
+struct regulator_consumer_supply twl4030_vsim_supply = {
+   .supply = "vmmc_aux",
+};
+
+/* VPLL2 for digital video outputs */
+struct regulator_consumer_supply twl4030_vpll2_supply = {
+   .supply = "vdvi",
+};
+
+/* Regulator initialization data */
+/* VAUX1 */
+struct regulator_init_data twl4030_vaux1_data = {
+   .constraints = {
+   .min_uV = 280,
+   .max_uV = 280,
+   .apply_uV   = true,
+   .valid_modes_mask   = REGULATOR_MODE_NORMAL
+   | REGULATOR_MODE_STANDBY,
+   .valid_ops_mask = REGULATOR_CHANGE_MODE
+   | REGULATOR_CHANGE_STATUS,
+   },
+};
+
+/* VAUX2 */
+struct regulator_init_data twl4030_vaux2_data = {
+   .constraints = {
+   .min_uV = 280,
+   .max_uV = 280,
+   .apply_uV   = true,
+   .valid_modes_mask   = REGULATOR_MODE_NORMAL
+   | REGULATOR_MODE_STANDBY,
+   .valid_ops_mask = REGULATOR_CHANGE_MODE
+   | REGULATOR_CHANGE_STATUS,
+   },
+};
+
+/* VAUX3 */
+struct regulator_init_data twl4030_vaux3_data = {
+   .constraints = {
+   .min_uV = 280,
+   .max_uV = 280,
+   .apply_uV   = true,
+   .valid_modes_mask   = REGULATOR_MODE_NORMAL
+   | REGULATOR_MODE_STANDBY,
+   .valid_ops_mask = REGULATOR_CHANGE_MODE
+   | REGULATOR_CHANGE_STATUS,
+   },
+};
+
+/* VAUX4 */
+struct regulator_init_data twl4030_vaux4_data = {
+   .constraints = {
+   .min_uV = 180,
+   .max_uV = 180,
+   .apply_uV   = true,
+   .valid_modes_mask   = REGULATOR_MODE_NORMAL
+   | REGULATOR_MODE_STANDBY,
+   .valid_ops_mask = REGULATOR_CHANGE_MODE
+   | REGULATOR_CHANGE_STATUS,
+   },
+};
+
+/* VMMC1 */
+struct regulator_init_data twl4030_vmmc1_data = {
+   .constraints = {
+   .min_uV = 185,
+   .max_uV = 315,
+   .valid_modes_mask   = REGULATOR_MODE_NORMAL
+   | REGULATOR_MODE_STANDBY,
+   .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
+   | REGULATOR_CHANGE_MODE
+   | REGULATOR_CHANGE_STATUS,
+   },
+   .num_consumer_supplies  = 1,
+   .consumer_supplies  = &twl4030_vmmc1_supply,
+};
+
+/* VMMC2 */
+struct regulator_init_data twl4030_vmmc2_data = {
+   .constraints = {
+ 

[PATCH 1/1] Regulator: Registering USB internal LDOs for TWL4030

2010-01-11 Thread Anuj Aggarwal
Adding member variables for USB internal LDOs in twl4030_platform_data
and registering them in twl-core.c if the variables are populated
from board-evm file.

Signed-off-by: Anuj Aggarwal 
---
 drivers/mfd/twl-core.c  |   12 
 include/linux/i2c/twl.h |4 
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 2a76065..6cde051 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -791,6 +791,18 @@ add_children(struct twl4030_platform_data *pdata, unsigned 
long features)
child = add_regulator(TWL4030_REG_VAUX4, pdata->vaux4);
if (IS_ERR(child))
return PTR_ERR(child);
+
+   child = add_regulator(TWL4030_REG_VUSB1V5, pdata->vusb1v5);
+   if (IS_ERR(child))
+   return PTR_ERR(child);
+
+   child = add_regulator(TWL4030_REG_VUSB1V8, pdata->vusb1v8);
+   if (IS_ERR(child))
+   return PTR_ERR(child);
+
+   child = add_regulator(TWL4030_REG_VUSB3V1, pdata->vusb3v1);
+   if (IS_ERR(child))
+   return PTR_ERR(child);
}
 
/* twl6030 regulators */
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index bf1c5be..7be0b34 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -578,6 +578,10 @@ struct twl4030_platform_data {
struct regulator_init_data  *vintana1;
struct regulator_init_data  *vintana2;
struct regulator_init_data  *vintdig;
+   struct regulator_init_data  *vusb1v5;
+   struct regulator_init_data  *vusb1v8;
+   struct regulator_init_data  *vusb3v1;
+
/* TWL6030 LDO regulators */
struct regulator_init_data  *vmmc;
struct regulator_init_data  *vpp;
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/6] Regulator: Kconfig modified to select TWL4030 for OMAP3 based platforms

2010-01-08 Thread Anuj Aggarwal
Kconfig is modified so that PMIC TWL4030 is automatically selected for
platforms using it. It is required to compile board-omap35x-twl4030-pmic.c
in the build.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/Kconfig |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 95b8eb2..ab3abc9 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -66,16 +66,19 @@ config MACH_OMAP3_BEAGLE
bool "OMAP3 BEAGLE board"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select OMAP_PACKAGE_CBB
+   select PMIC_TWL4030
 
 config MACH_OMAP_LDP
bool "OMAP3 LDP board"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select OMAP_PACKAGE_CBB
+   select PMIC_TWL4030
 
 config MACH_OVERO
bool "Gumstix Overo board"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select OMAP_PACKAGE_CBB
+   select PMIC_TWL4030
 
 config MACH_OMAP3EVM
bool "OMAP 3530 EVM board"
@@ -100,16 +103,19 @@ config MACH_OMAP3_PANDORA
bool "OMAP3 Pandora"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select OMAP_PACKAGE_CBB
+   select PMIC_TWL4030
 
 config MACH_OMAP3_TOUCHBOOK
bool "OMAP3 Touch Book"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select BACKLIGHT_CLASS_DEVICE
+   select PMIC_TWL4030
 
 config MACH_OMAP_3430SDP
bool "OMAP 3430 SDP board"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select OMAP_PACKAGE_CBB
+   select PMIC_TWL4030
 
 config MACH_NOKIA_N800
bool
@@ -136,27 +142,32 @@ config MACH_OMAP_ZOOM2
bool "OMAP3 Zoom2 board"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select OMAP_PACKAGE_CBB
+   select PMIC_TWL4030
 
 config MACH_OMAP_ZOOM3
bool "OMAP3630 Zoom3 board"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select OMAP_PACKAGE_CBP
+   select PMIC_TWL4030
 
 config MACH_CM_T35
bool "CompuLab CM-T35 module"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select OMAP_PACKAGE_CUS
select OMAP_MUX
+   select PMIC_TWL4030
 
 config MACH_IGEP0020
bool "IGEP0020"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select OMAP_PACKAGE_CBB
+   select PMIC_TWL4030
 
 config MACH_OMAP_3630SDP
bool "OMAP3630 SDP board"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select OMAP_PACKAGE_CBP
+   select PMIC_TWL4030
 
 config MACH_OMAP_4430SDP
bool "OMAP 4430 SDP board"
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/6] Regulator: Makefile modified to include TWL4030-PMIC specific file

2010-01-08 Thread Anuj Aggarwal
Makefile is modified so that board-omap35x-twl4030-pmic.c gets compiled
for the platforms having TWL4030 as the PMIC.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/Makefile |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index b32678b..181be39 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -107,6 +107,7 @@ obj-$(CONFIG_MACH_IGEP0020) += board-igep0020.o \
   mmc-twl4030.o
 obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK) += board-omap3touchbook.o \
   mmc-twl4030.o
+obj-$(CONFIG_PMIC_TWL4030) += board-omap35x-twl4030-pmic.o
 obj-$(CONFIG_MACH_OMAP_4430SDP)+= board-4430sdp.o
 
 obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/6] Regulator: Modifying Kconfig to choose from the available PMICs

2010-01-08 Thread Anuj Aggarwal
Kconfig is modified for OMAP3 EVM so that user can choose the appropriate
PMIC (currently only TWL4030). Config options for other PMICs will be
added later on.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/Kconfig |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 606bf04..95b8eb2 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -82,6 +82,15 @@ config MACH_OMAP3EVM
depends on ARCH_OMAP3 && ARCH_OMAP34XX
select OMAP_PACKAGE_CBB
 
+config PMIC_TWL4030
+   bool "TWL4030/TPS65950 Power Module"
+   default y
+   depends on TWL4030_CORE && MACH_OMAP3EVM
+   select REGULATOR_TWL4030 if REGULATOR
+   help
+ Say yes here if you are using the TWL4030/TPS65950 based power module
+ for the EVM boards.
+
 config MACH_OMAP3517EVM
bool "OMAP3517/ AM3517 EVM board"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/6] Regulator: Use common regulator supplies and init data structs

2010-01-08 Thread Anuj Aggarwal
Common TWL4030 specific regulator supplies and init data structs are
used instead of platform specific ones. Only one copy of the common
structs will be included in the image, built for multiple OMAP3 based
platforms.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/board-3430sdp.c  |   32 +
 arch/arm/mach-omap2/board-cm-t35.c   |   14 ---
 arch/arm/mach-omap2/board-igep0020.c |7 -
 arch/arm/mach-omap2/board-ldp.c  |7 -
 arch/arm/mach-omap2/board-omap3beagle.c  |   14 ---
 arch/arm/mach-omap2/board-omap3evm.c |   25 +---
 arch/arm/mach-omap2/board-omap3pandora.c |   14 ---
 arch/arm/mach-omap2/board-omap3touchbook.c   |   14 ---
 arch/arm/mach-omap2/board-overo.c|8 +-
 arch/arm/mach-omap2/board-zoom-peripherals.c |   21 +++-
 10 files changed, 108 insertions(+), 48 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index 2951029..b1267eb 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -55,6 +55,18 @@
 
 #define TWL4030_MSECURE_GPIO 22
 
+extern struct regulator_consumer_supply twl4030_vmmc1_supply;
+extern struct regulator_consumer_supply twl4030_vmmc2_supply;
+extern struct regulator_consumer_supply twl4030_vsim_supply;
+
+extern struct regulator_init_data vaux1_data;
+extern struct regulator_init_data vaux2_data;
+extern struct regulator_init_data vaux3_data;
+extern struct regulator_init_data vaux4_data;
+extern struct regulator_init_data vmmc1_data;
+extern struct regulator_init_data vmmc2_data;
+extern struct regulator_init_data vsim_data;
+
 static int board_keymap[] = {
KEY(0, 0, KEY_LEFT),
KEY(0, 1, KEY_RIGHT),
@@ -356,9 +368,9 @@ static int sdp3430_twl_gpio_setup(struct device *dev,
/* link regulators to MMC adapters ... we "know" the
 * regulators will be set up only *after* we return.
 */
-   sdp3430_vmmc1_supply.dev = mmc[0].dev;
-   sdp3430_vsim_supply.dev = mmc[0].dev;
-   sdp3430_vmmc2_supply.dev = mmc[1].dev;
+   twl4030_vmmc1_supply.dev = mmc[0].dev;
+   twl4030_vsim_supply.dev = mmc[0].dev;
+   twl4030_vmmc2_supply.dev = mmc[1].dev;
 
/* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */
gpio_request(gpio + 7, "sub_lcd_en_bkl");
@@ -451,13 +463,13 @@ static struct twl4030_platform_data sdp3430_twldata = {
.usb= &sdp3430_usb_data,
.codec  = &sdp3430_codec,
 
-   .vaux1  = &sdp3430_vaux1,
-   .vaux2  = &sdp3430_vaux2,
-   .vaux3  = &sdp3430_vaux3,
-   .vaux4  = &sdp3430_vaux4,
-   .vmmc1  = &sdp3430_vmmc1,
-   .vmmc2  = &sdp3430_vmmc2,
-   .vsim   = &sdp3430_vsim,
+   .vaux1  = &vaux1_data,
+   .vaux2  = &vaux2_data,
+   .vaux3  = &vaux3_data,
+   .vaux4  = &vaux4_data,
+   .vmmc1  = &vmmc1_data,
+   .vmmc2  = &vmmc2_data,
+   .vsim   = &vsim_data,
.vdac   = &sdp3430_vdac,
.vpll2  = &sdp3430_vpll2,
 };
diff --git a/arch/arm/mach-omap2/board-cm-t35.c 
b/arch/arm/mach-omap2/board-cm-t35.c
index b0a5a68..282d188 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -59,6 +59,12 @@
 #define GPMC_CS0_BASE  0x60
 #define GPMC_CS0_BASE_ADDR (OMAP34XX_GPMC_VIRT + GPMC_CS0_BASE)
 
+extern struct regulator_consumer_supply twl4030_vmmc1_supply;
+extern struct regulator_consumer_supply twl4030_vsim_supply;
+
+extern struct regulator_init_data vmmc1_data;
+extern struct regulator_init_data vsim_data;
+
 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
 #include 
 
@@ -378,8 +384,8 @@ static int cm_t35_twl_gpio_setup(struct device *dev, 
unsigned gpio,
twl4030_mmc_init(mmc);
 
/* link regulators to MMC adapters */
-   cm_t35_vmmc1_supply.dev = mmc[0].dev;
-   cm_t35_vsim_supply.dev = mmc[0].dev;
+   twl4030_vmmc1_supply.dev = mmc[0].dev;
+   twl4030_vsim_supply.dev = mmc[0].dev;
 
/* setup USB with proper PHY reset GPIOs */
ehci_pdata.reset_gpio_port[0] = gpio + 6;
@@ -405,8 +411,8 @@ static struct twl4030_platform_data cm_t35_twldata = {
.keypad = &cm_t35_kp_data,
.usb= &cm_t35_usb_data,
.gpio   = &cm_t35_gpio_data,
-   .vmmc1  = &cm_t35_vmmc1,
-   .vsim   = &cm_t35_vsim,
+   .vmmc1  = &vmmc1_data,
+   .vsim   = &vsim_data,
 };
 
 static struct i2c_board_info __initdata cm_t35_i2c_boardinfo[] = {
diff --git a/arch/arm/mach-omap2/board-igep0020.c 
b/arch/arm/mach-omap2/board-igep0020.c

[PATCH 2/6] Regulator: Removing the common supplies and regulator init data structs

2010-01-08 Thread Anuj Aggarwal
Removing the common supplies and regulator init data structs for various
OMAP3 platforms. They all have been moved to a common TWL4030 specific file
and will be referenced from there.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/board-3430sdp.c  |  114 --
 arch/arm/mach-omap2/board-cm-t35.c   |   38 -
 arch/arm/mach-omap2/board-igep0020.c |   19 
 arch/arm/mach-omap2/board-ldp.c  |   19 
 arch/arm/mach-omap2/board-omap3beagle.c  |   38 -
 arch/arm/mach-omap2/board-omap3evm.c |   38 -
 arch/arm/mach-omap2/board-omap3pandora.c |   38 -
 arch/arm/mach-omap2/board-omap3touchbook.c   |   38 -
 arch/arm/mach-omap2/board-overo.c|   18 
 arch/arm/mach-omap2/board-zoom-peripherals.c |   57 -
 10 files changed, 0 insertions(+), 417 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index c90b0d0..2951029 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -343,18 +343,6 @@ static struct twl4030_hsmmc_info mmc[] = {
{}  /* Terminator */
 };
 
-static struct regulator_consumer_supply sdp3430_vmmc1_supply = {
-   .supply = "vmmc",
-};
-
-static struct regulator_consumer_supply sdp3430_vsim_supply = {
-   .supply = "vmmc_aux",
-};
-
-static struct regulator_consumer_supply sdp3430_vmmc2_supply = {
-   .supply = "vmmc",
-};
-
 static int sdp3430_twl_gpio_setup(struct device *dev,
unsigned gpio, unsigned ngpio)
 {
@@ -400,108 +388,6 @@ static struct twl4030_madc_platform_data 
sdp3430_madc_data = {
.irq_line   = 1,
 };
 
-/*
- * Apply all the fixed voltages since most versions of U-Boot
- * don't bother with that initialization.
- */
-
-/* VAUX1 for mainboard (irda and sub-lcd) */
-static struct regulator_init_data sdp3430_vaux1 = {
-   .constraints = {
-   .min_uV = 280,
-   .max_uV = 280,
-   .apply_uV   = true,
-   .valid_modes_mask   = REGULATOR_MODE_NORMAL
-   | REGULATOR_MODE_STANDBY,
-   .valid_ops_mask = REGULATOR_CHANGE_MODE
-   | REGULATOR_CHANGE_STATUS,
-   },
-};
-
-/* VAUX2 for camera module */
-static struct regulator_init_data sdp3430_vaux2 = {
-   .constraints = {
-   .min_uV = 280,
-   .max_uV = 280,
-   .apply_uV   = true,
-   .valid_modes_mask   = REGULATOR_MODE_NORMAL
-   | REGULATOR_MODE_STANDBY,
-   .valid_ops_mask = REGULATOR_CHANGE_MODE
-   | REGULATOR_CHANGE_STATUS,
-   },
-};
-
-/* VAUX3 for LCD board */
-static struct regulator_init_data sdp3430_vaux3 = {
-   .constraints = {
-   .min_uV = 280,
-   .max_uV = 280,
-   .apply_uV   = true,
-   .valid_modes_mask   = REGULATOR_MODE_NORMAL
-   | REGULATOR_MODE_STANDBY,
-   .valid_ops_mask = REGULATOR_CHANGE_MODE
-   | REGULATOR_CHANGE_STATUS,
-   },
-};
-
-/* VAUX4 for OMAP VDD_CSI2 (camera) */
-static struct regulator_init_data sdp3430_vaux4 = {
-   .constraints = {
-   .min_uV = 180,
-   .max_uV = 180,
-   .apply_uV   = true,
-   .valid_modes_mask   = REGULATOR_MODE_NORMAL
-   | REGULATOR_MODE_STANDBY,
-   .valid_ops_mask = REGULATOR_CHANGE_MODE
-   | REGULATOR_CHANGE_STATUS,
-   },
-};
-
-/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
-static struct regulator_init_data sdp3430_vmmc1 = {
-   .constraints = {
-   .min_uV = 185,
-   .max_uV = 315,
-   .valid_modes_mask   = REGULATOR_MODE_NORMAL
-   | REGULATOR_MODE_STANDBY,
-   .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
-   | REGULATOR_CHANGE_MODE
-   | REGULATOR_CHANGE_STATUS,
-   },
-   .num_consumer_supplies  = 1,
-   .consumer_supplies  = &sdp3430_vmmc1_supply,
-};
-
-/* VMMC2 for MMC2 card */
-static struct regulator_init_data sdp3430_vmmc2 = {
-   .constraints = {
-   .min_uV = 185,
-   .max_uV = 185,
-  

[PATCH 1/6] Regulator: Creating TWL4030 specific file having supplies & init data

2010-01-08 Thread Anuj Aggarwal
A new file for TWL4030/TPS65950 is created which has common supplies
and regulator init data structures. They will be referenced from the
various board-evm files depending upon the EVM requirements.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/board-omap35x-twl4030-pmic.c |  175 ++
 1 files changed, 175 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/board-omap35x-twl4030-pmic.c

diff --git a/arch/arm/mach-omap2/board-omap35x-twl4030-pmic.c 
b/arch/arm/mach-omap2/board-omap35x-twl4030-pmic.c
new file mode 100644
index 000..0b7cd74
--- /dev/null
+++ b/arch/arm/mach-omap2/board-omap35x-twl4030-pmic.c
@@ -0,0 +1,175 @@
+/*
+ * board-omap35x-twl4030-pmic.c
+ *
+ * Common regulator supplies and init data structs for TWL4030/TPS65950
+ * PMIC for OMAP3 based EVMs. They can be used in various board-evm
+ * files for OMAP3 based platforms using TWL4030.
+ *
+ * Copyright (C) 2010 Texas Instrument Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+
+/* VDAC */
+struct regulator_consumer_supply twl4030_vdac_supply = {
+   .supply = "vdac",
+};
+
+/* VMMC1 */
+struct regulator_consumer_supply twl4030_vmmc1_supply = {
+   .supply = "vmmc",
+};
+
+/* VMMC2 */
+struct regulator_consumer_supply twl4030_vmmc2_supply = {
+   .supply = "vmmc",
+};
+
+/* VSIM */
+struct regulator_consumer_supply twl4030_vsim_supply = {
+   .supply = "vmmc_aux",
+};
+
+/* VPLL2 for digital video outputs */
+struct regulator_consumer_supply twl4030_vpll2_supply = {
+   .supply = "vdvi",
+};
+
+/* Regulator initialization data */
+/* VAUX1 */
+struct regulator_init_data vaux1_data = {
+   .constraints = {
+   .min_uV = 280,
+   .max_uV = 280,
+   .apply_uV   = true,
+   .valid_modes_mask   = REGULATOR_MODE_NORMAL
+   | REGULATOR_MODE_STANDBY,
+   .valid_ops_mask = REGULATOR_CHANGE_MODE
+   | REGULATOR_CHANGE_STATUS,
+   },
+};
+
+/* VAUX2 */
+struct regulator_init_data vaux2_data = {
+   .constraints = {
+   .min_uV = 280,
+   .max_uV = 280,
+   .apply_uV   = true,
+   .valid_modes_mask   = REGULATOR_MODE_NORMAL
+   | REGULATOR_MODE_STANDBY,
+   .valid_ops_mask = REGULATOR_CHANGE_MODE
+   | REGULATOR_CHANGE_STATUS,
+   },
+};
+
+/* VAUX3 */
+struct regulator_init_data vaux3_data = {
+   .constraints = {
+   .min_uV = 280,
+   .max_uV = 280,
+   .apply_uV   = true,
+   .valid_modes_mask   = REGULATOR_MODE_NORMAL
+   | REGULATOR_MODE_STANDBY,
+   .valid_ops_mask = REGULATOR_CHANGE_MODE
+   | REGULATOR_CHANGE_STATUS,
+   },
+};
+
+/* VAUX4 */
+struct regulator_init_data vaux4_data = {
+   .constraints = {
+   .min_uV = 180,
+   .max_uV = 180,
+   .apply_uV   = true,
+   .valid_modes_mask   = REGULATOR_MODE_NORMAL
+   | REGULATOR_MODE_STANDBY,
+   .valid_ops_mask = REGULATOR_CHANGE_MODE
+   | REGULATOR_CHANGE_STATUS,
+   },
+};
+
+/* VMMC1 */
+struct regulator_init_data vmmc1_data = {
+   .constraints = {
+   .min_uV = 185,
+   .max_uV = 315,
+   .valid_modes_mask   = REGULATOR_MODE_NORMAL
+   | REGULATOR_MODE_STANDBY,
+   .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
+   | REGULATOR_CHANGE_MODE
+   | REGULATOR_CHANGE_STATUS,
+   },
+   .num_consumer_supplies  = 1,
+   .consumer_supplies  = &twl4030_vmmc1_supply,
+};
+
+/* VMMC2 */
+struct regulator_init_data vmmc2_data = {
+   .constraints = {
+   .min_uV = 185,
+   .max_uV = 185,
+   .

[PATCH 0/6] Regulator: Removing common code for TWL4030 PMIC from various OMAP3 board-evms

2010-01-08 Thread Anuj Aggarwal
Based on the discussions and feedback received, this patch set is
created which cleans up various OMAP3-board-evm files and removes
common TWL4030 specific regulator suuplies and init data structs.
These structures are instead placed in a new file - 
board-omap35x-twl4030-pmic.c and are referenced from the board-evm
files depending on the platform requirements. Regulator having specific
supplies or init data structs are not changed in their respective
board-evms.

The main advantages of having one common file for these structures
are redundant code removal, easy maintainability and single copy of 
common structure(s) in case uImage for multiple platforms is built.

Please see the following links for previous discussions:
  http://marc.info/?l=linux-omap&m=12579548775&w=2
  http://marc.info/?l=linux-omap&m=125795068502904&w=2 

I have tested these patches on OMAP3EVM and the image boots fine. I
have compile-tested them for SDP3430 and all OMAP platforms (using
omap3_defconfig) and the build went fine. If someone can test them
on their hardware, that would be great !!!

Anuj Aggarwal (6):
  Regulator: Creating TWL4030 specific file having supplies & init data
  Regulator: Removing the common supplies and regulator init data
structs
  Regulator: Use common regulator supplies and init data structs
  Regulator: Modifying Kconfig to choose from the available PMICs
  Regulator: Kconfig modified to select TWL4030 for OMAP3 based
platforms
  Regulator: Makefile modified to include TWL4030-PMIC specific file

 arch/arm/mach-omap2/Kconfig  |   20 +++
 arch/arm/mach-omap2/Makefile |1 +
 arch/arm/mach-omap2/board-3430sdp.c  |  146 +++---
 arch/arm/mach-omap2/board-cm-t35.c   |   52 ++-
 arch/arm/mach-omap2/board-igep0020.c |   26 +---
 arch/arm/mach-omap2/board-ldp.c  |   26 +---
 arch/arm/mach-omap2/board-omap35x-twl4030-pmic.c |  175 ++
 arch/arm/mach-omap2/board-omap3beagle.c  |   52 ++-
 arch/arm/mach-omap2/board-omap3evm.c |   63 ++--
 arch/arm/mach-omap2/board-omap3pandora.c |   52 ++-
 arch/arm/mach-omap2/board-omap3touchbook.c   |   52 ++-
 arch/arm/mach-omap2/board-overo.c|   26 +---
 arch/arm/mach-omap2/board-zoom-peripherals.c |   78 ++
 13 files changed, 304 insertions(+), 465 deletions(-)
 create mode 100644 arch/arm/mach-omap2/board-omap35x-twl4030-pmic.c

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ASoC: AIC23: Fixing infinite loop in resume path

2009-11-27 Thread Anuj Aggarwal
This patch fixes two issues:
a) Infinite loop in resume function
b) Writes to non-existing registers in resume function

Signed-off-by: Anuj Aggarwal 
---
 sound/soc/codecs/tlv320aic23.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
index 6b24d8b..90a0264 100644
--- a/sound/soc/codecs/tlv320aic23.c
+++ b/sound/soc/codecs/tlv320aic23.c
@@ -625,11 +625,10 @@ static int tlv320aic23_resume(struct platform_device 
*pdev)
 {
struct snd_soc_device *socdev = platform_get_drvdata(pdev);
struct snd_soc_codec *codec = socdev->card->codec;
-   int i;
u16 reg;
 
/* Sync reg_cache with the hardware */
-   for (reg = 0; reg < ARRAY_SIZE(tlv320aic23_reg); i++) {
+   for (reg = 0; reg < TLV320AIC23_RESET; reg++) {
u16 val = tlv320aic23_read_reg_cache(codec, reg);
tlv320aic23_write(codec, reg, val);
}
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ASoC: AM3517: Fix AIC23 suspend/resume hang

2009-11-25 Thread Anuj Aggarwal
System hang is observed While trying to do suspend. It was because
of an infinite loop in the AIC23 resume path which was trying to
restore AIC23 register values from the register cache.

This patch fixes the problem by correcting the resume path and
properly activating/deactivating the digital interface while
doing the suspend / off transitions.

Signed-off-by: Anuj Aggarwal 
---
 sound/soc/codecs/tlv320aic23.c |   16 +++-
 1 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
index 6b24d8b..cabe60c 100644
--- a/sound/soc/codecs/tlv320aic23.c
+++ b/sound/soc/codecs/tlv320aic23.c
@@ -565,13 +565,12 @@ static int tlv320aic23_set_bias_level(struct 
snd_soc_codec *codec,
case SND_SOC_BIAS_PREPARE:
break;
case SND_SOC_BIAS_STANDBY:
-   /* everything off except vref/vmid, */
-   tlv320aic23_write(codec, TLV320AIC23_PWR, reg | 0x0040);
+   /* Activate the digital interface */
+   tlv320aic23_write(codec, TLV320AIC23_ACTIVE, 0x1);
break;
case SND_SOC_BIAS_OFF:
-   /* everything off, dac mute, inactive */
+   /* Deactivate the digital interface */
tlv320aic23_write(codec, TLV320AIC23_ACTIVE, 0x0);
-   tlv320aic23_write(codec, TLV320AIC23_PWR, 0x);
break;
}
codec->bias_level = level;
@@ -615,7 +614,6 @@ static int tlv320aic23_suspend(struct platform_device *pdev,
struct snd_soc_device *socdev = platform_get_drvdata(pdev);
struct snd_soc_codec *codec = socdev->card->codec;
 
-   tlv320aic23_write(codec, TLV320AIC23_ACTIVE, 0x0);
tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_OFF);
 
return 0;
@@ -625,14 +623,6 @@ static int tlv320aic23_resume(struct platform_device *pdev)
 {
struct snd_soc_device *socdev = platform_get_drvdata(pdev);
struct snd_soc_codec *codec = socdev->card->codec;
-   int i;
-   u16 reg;
-
-   /* Sync reg_cache with the hardware */
-   for (reg = 0; reg < ARRAY_SIZE(tlv320aic23_reg); i++) {
-   u16 val = tlv320aic23_read_reg_cache(codec, reg);
-   tlv320aic23_write(codec, reg, val);
-   }
 
tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
tlv320aic23_set_bias_level(codec, codec->suspend_bias_level);
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] AM3517: MMC: Add low-level init code for HSMMC controller

2009-11-23 Thread Anuj Aggarwal
Add init code for HSMMC controller for AM3517 platform.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/mmc-am3517evm.c |  267 +++
 arch/arm/mach-omap2/mmc-am3517evm.h |   22 +++
 2 files changed, 289 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/mmc-am3517evm.c
 create mode 100644 arch/arm/mach-omap2/mmc-am3517evm.h

diff --git a/arch/arm/mach-omap2/mmc-am3517evm.c 
b/arch/arm/mach-omap2/mmc-am3517evm.c
new file mode 100644
index 000..7995239
--- /dev/null
+++ b/arch/arm/mach-omap2/mmc-am3517evm.c
@@ -0,0 +1,267 @@
+/*
+ * linux/arch/arm/mach-omap2/mmc-am3517evm.c
+ *
+ * Copyright (C) 2009 Texas Instruments Incorporated
+ * Author: Anuj Aggarwal 
+ *
+ * Based on mach-omap2/mmc-twl4030.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include "mmc-am3517evm.h"
+
+#define LDO_CLR0x00
+#define VSEL_S2_CLR0x40
+
+#define VMMC1_DEV_GRP  0x27
+#define VMMC1_CLR  0x00
+#define VMMC1_315V 0x03
+#define VMMC1_300V 0x02
+#define VMMC1_285V 0x01
+#define VMMC1_185V 0x00
+#define VMMC1_DEDICATED0x2A
+
+#define VMMC2_DEV_GRP  0x2B
+#define VMMC2_CLR  0x40
+#define VMMC2_315V 0x0c
+#define VMMC2_300V 0x0b
+#define VMMC2_285V 0x0a
+#define VMMC2_260V 0x08
+#define VMMC2_185V 0x06
+#define VMMC2_DEDICATED0x2E
+
+#define VMMC_DEV_GRP_P10x20
+
+#define HSMMC_NAME_LEN 9
+
+#if defined(CONFIG_REGULATOR) || \
+   (defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
+defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE))
+
+/*
+ * MMC definitions
+ *
+ */
+static struct mmc_controller {
+   struct omap_mmc_platform_data   *mmc;
+   u8  vmmc_dev_grp;
+   u8  vmmc_dedicated;
+   charname[HSMMC_NAME_LEN];
+} hsmmc[] = {
+   {
+   .vmmc_dev_grp   = VMMC1_DEV_GRP,
+   .vmmc_dedicated = VMMC1_DEDICATED,
+   },
+   {
+   .vmmc_dev_grp   = VMMC2_DEV_GRP,
+   .vmmc_dedicated = VMMC2_DEDICATED,
+   },
+};
+
+static int mmc_card_detect(int irq)
+{
+   unsigned i;
+
+   for (i = 0; i < ARRAY_SIZE(hsmmc); i++) {
+   struct omap_mmc_platform_data *mmc;
+
+   mmc = hsmmc[i].mmc;
+   if (!mmc)
+   continue;
+   if (irq != mmc->slots[0].card_detect_irq)
+   continue;
+
+   /* NOTE: assumes card detect signal is active-low */
+   return !gpio_get_value_cansleep(mmc->slots[0].switch_pin);
+   }
+   return -ENOSYS;
+}
+
+static int mmc_get_ro(struct device *dev, int slot)
+{
+   struct omap_mmc_platform_data *mmc = dev->platform_data;
+
+   /* NOTE: assumes write protect signal is active-high */
+   return gpio_get_value_cansleep(mmc->slots[0].gpio_wp);
+}
+
+/*
+ * MMC Slot Initialization.
+ */
+static int mmc_late_init(struct device *dev)
+{
+   struct omap_mmc_platform_data *mmc = dev->platform_data;
+   int ret = 0;
+   int i;
+
+   ret = gpio_request(mmc->slots[0].switch_pin, "mmc_cd");
+   if (ret)
+   goto done;
+   ret = gpio_direction_input(mmc->slots[0].switch_pin);
+   if (ret)
+   goto err;
+
+   for (i = 0; i < ARRAY_SIZE(hsmmc); i++) {
+   if (hsmmc[i].name == mmc->slots[0].name) {
+   hsmmc[i].mmc = mmc;
+   break;
+   }
+   }
+
+   return 0;
+
+err:
+   gpio_free(mmc->slots[0].switch_pin);
+done:
+   mmc->slots[0].card_detect_irq = 0;
+   mmc->slots[0].card_detect = NULL;
+
+   dev_err(dev, "err %d configuring card detect\n", ret);
+   return ret;
+}
+
+static void mmc_cleanup(struct device *dev)
+{
+   struct omap_mmc_platform_data *mmc = dev->platform_data;
+
+   gpio_free(mmc->slots[0].switch_pin);
+}
+
+#ifdef CONFIG_PM
+
+static int mmc_suspend(struct device *dev, int slot)
+{
+   struct omap_mmc_platform_data *mmc = dev->platform_data;
+
+   disable_irq(mmc->slots[0].card_detect_irq);
+   return 0;
+}
+
+static int mmc_resume(struct device *dev, int slot)
+{
+   struct omap_mmc_platform_data *mmc = dev->platform_data;
+
+   enable_irq(mmc->slots[0].card_detect_irq);
+   return 0;
+}
+
+#else
+#define mmc_suspendNULL
+#define mmc_resume NULL
+#endif
+
+/*
+ * the MM

[PATCH 4/4] AM3517: MMC: Make HSMMC driver built-in

2009-11-23 Thread Anuj Aggarwal
Make HSMMC driver as a built-in module for AM3517 platform.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/configs/am3517_evm_defconfig |   21 -
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/arch/arm/configs/am3517_evm_defconfig 
b/arch/arm/configs/am3517_evm_defconfig
index ad54e92..601f1f5 100644
--- a/arch/arm/configs/am3517_evm_defconfig
+++ b/arch/arm/configs/am3517_evm_defconfig
@@ -818,7 +818,26 @@ CONFIG_USB_STORAGE=y
 #
 # CONFIG_USB_GPIO_VBUS is not set
 # CONFIG_NOP_USB_XCEIV is not set
-# CONFIG_MMC is not set
+CONFIG_MMC=y
+# CONFIG_MMC_DEBUG is not set
+# CONFIG_MMC_UNSAFE_RESUME is not set
+
+#
+# MMC/SD/SDIO Card Drivers
+#
+CONFIG_MMC_BLOCK=y
+CONFIG_MMC_BLOCK_BOUNCE=y
+# CONFIG_SDIO_UART is not set
+# CONFIG_MMC_TEST is not set
+
+#
+# MMC/SD/SDIO Host Controller Drivers
+#
+# CONFIG_MMC_SDHCI is not set
+# CONFIG_MMC_OMAP is not set
+CONFIG_MMC_OMAP_HS=y
+# CONFIG_MMC_AT91 is not set
+# CONFIG_MMC_ATMELMCI is not set
 # CONFIG_MEMSTICK is not set
 # CONFIG_NEW_LEDS is not set
 # CONFIG_ACCESSIBILITY is not set
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] AM3517: MMC: Modifying board-evm file to add mmc_init

2009-11-23 Thread Anuj Aggarwal
Modifying the board-evm file for AM3517 and adding the mmc_init
function in it.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/board-am3517evm.c |   22 ++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-am3517evm.c 
b/arch/arm/mach-omap2/board-am3517evm.c
index 415a13d..30f8b00 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 
+#include "mmc-am3517evm.h"
 /*
  * Board initialization
  */
@@ -60,6 +61,24 @@ static struct ehci_hcd_omap_platform_data ehci_pdata 
__initdata = {
.reset_gpio_port[2]  = -EINVAL
 };
 
+static struct am3517_hsmmc_info mmc[] = {
+   {
+   .mmc= 1,
+   .wires  = 4,
+   /* TODO: Need to change */
+   .gpio_cd= 127,
+   .gpio_wp= 126,
+   },
+   {
+   .mmc= 2,
+   .wires  = 4,
+   /* TODO: Need to change */
+   .gpio_cd= 128,
+   .gpio_wp= 129,
+   },
+   {}  /* Terminator */
+};
+
 static void __init am3517_evm_init(void)
 {
platform_add_devices(am3517_evm_devices,
@@ -67,6 +86,9 @@ static void __init am3517_evm_init(void)
 
omap_serial_init();
usb_ehci_init(&ehci_pdata);
+
+   /* MMC init function */
+   am3517_mmc_init(mmc);
 }
 
 static void __init am3517_evm_map_io(void)
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] AM3517: MMC: Modifying Makefile to enable MMC init

2009-11-23 Thread Anuj Aggarwal
Modifying Makefile to build mmc-am3517.c for AM3517 platform, this
file has the mmc_init function for 3517 EVM.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/Makefile |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 59b0ccc..77ec48b 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -93,7 +93,8 @@ obj-$(CONFIG_MACH_IGEP0020)   += board-igep0020.o \
 
 obj-$(CONFIG_MACH_OMAP_4430SDP)+= board-4430sdp.o
 
-obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o
+obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o \
+  mmc-am3517evm.o
 
 # Platform specific device init code
 obj-y  += usb-musb.o
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/4] AM3517: MMC: Add support for HSMMC

2009-11-23 Thread Anuj Aggarwal
This patch series adds support for HSMMC for AM3517 platform.
It also enables the HSMMC driver in the AM3517 defconfig.

Anuj Aggarwal (4):
  AM3517: MMC: Add low-level init code for HSMMC controller
  AM3517: MMC: Modifying board-evm file to add mmc_init
  AM3517: MMC: Modifying Makefile to enable MMC init
  AM3517: MMC: Make HSMMC driver built-in

 arch/arm/configs/am3517_evm_defconfig |   21 +++-
 arch/arm/mach-omap2/Makefile  |3 +-
 arch/arm/mach-omap2/board-am3517evm.c |   22 +++
 arch/arm/mach-omap2/mmc-am3517evm.c   |  267 +
 arch/arm/mach-omap2/mmc-am3517evm.h   |   22 +++
 5 files changed, 333 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-omap2/mmc-am3517evm.c
 create mode 100644 arch/arm/mach-omap2/mmc-am3517evm.h

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [alsa-devel] [PATCH 1/2] OMAP3: MCBSP: Suspend/resume failure fix

2009-11-20 Thread Anuj Aggarwal
On Fri, Nov 20, 2009 at 7:39 PM, Eero Nurkkala
 wrote:
> On Fri, 2009-11-20 at 14:53 +0100, ext Jarkko Nikula wrote:
>> On Fri, 20 Nov 2009 09:51:13 +0200
>> Peter Ujfalusi  wrote:
>>
>> > > My question is: is sysfs the only way to choose threshold or can it be 
>> > > made
>> > >  as default? I could not see that happening in the code so thinking of 
>> > > the
>> > >  possible reason of choosing not to do so. Because the user who wants to
>> > >  hit suspend will not like to issue driver specific commands. Any 
>> > > specific
>> > >  reason of not doing that by default?
>> >
>> > It is not selected as default on OMAP3, since it is a new feature, and we 
>> > don't
>> > want to change the behavior of the audio. If the reports are positive 
>> > regarding
>> > to the threshold mode, than we can make it as default on OMAP3, at least 
>> > that is
>> > the plan AFAIK.
>>
>> Yep. Currently we want to keep DMA behaviour consistent across the
>> OMAPs and McBSP ports since the large internal FIFO is found only
>> from McBSP2 on OMAP3.
>>
>> This is good finding that you have found that it's the audio preventing
>> the suspend and the threshold transfer mode can make it hit better.
>>
>> But anyway, I'm afraid that threshold mode doesn't help to create
>> robust suspend. Threshold allow the DMA and core to be mode in idle
>> between the FIFO fills and probably that's why suspend might work
>> during these idle periods. For robust implementation there must be
>> explicit code stopping and resuming all activity gracefully so that it
>> can hit the suspend also if the fill is happening or if using another
>> transfer mode.
>>
>>
>
> Looking at the very original patch, I don't know how things could get
> into deep sleep by disabling the fclk only... need to disable the iclk
> also. In threshold mode, HW autogates the iclk, so you may be just
> "lucky".
[Anuj] No, I am not :(. I had to modify the original patch to include
the disable part for the ICLK too. Without that, I was not able to hit
retention.
I will try to do some further regression on OMAP3 EVM and post my
findings. As of now, audio is working fine with these patches + ICLK
modification.
>
> One may want to be aware of this also:
>
> http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commitdiff;h=72cc6d715d5b018e2cff4adb68966855850d4e77
>
> I think it's an undocumented feature.
>
> - Eero
>
> ___
> Alsa-devel mailing list
> alsa-de...@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [alsa-devel] [PATCH 1/2] OMAP3: MCBSP: Suspend/resume failure fix

2009-11-19 Thread Anuj Aggarwal
On Thu, Nov 19, 2009 at 1:04 PM, Jarkko Nikula  wrote:
> On Wed, Nov 18, 2009 at 8:28 PM, Aggarwal, Anuj wrote:
>
>> > If no API or feature would require active McBSP block before the
>> > omap_mcbsp_start call, then the clock management could be done inside
>> > the omap_mcbsp_start/-stop functions.
>> [Aggarwal, Anuj] I tried doing that but it didn't work because before
>> _start, we need to call set_hw_params which configures mcbsp, for which
>> clocks are required.
>> >
>>
>
> First modification to .../plat-omap/mcbsp.c could be just a patch which
> keeps the
> clocks on only when needed. I.e. keep them disabled when returning from
> request
> and activate them only when accessing the McBSP registers or when it is
> running.
>
> But that said, I don't know are there some use case or API which requires
> active
> clocks after request so that should be checked.
>
>
>> > Also context save/restore operations belongs more to PM callbacks
>> > of .../plat-omap/mcbsp.c. Or probably that can be done also dynamically
>> > inside the omap_mcbsp_start/-stop for keeping the whole McBSP shutdown
>> > whenever it is idle.
>> [Aggarwal, Anuj] I am sorry I couldn't understand that. Did you mean that
>> PM hooks can be added in the mcbsp driver which can be registered and
>> called
>> As and when required? Any reference driver for this, if my understanding
>> is correct?
>> >
>>
>
> Yep, the PM hooks in .../plat-omap/mcbsp.c should take care of saving the
> McBSP registers before going into suspend or restore them back when
> resuming.
> This would be second patch after the clock change patch.
>
> The comment about dynamic PM was an idea that if McBSP could be unpowered
> whenever it's not running and do the resume only when calling
> omap_mcbsp_start.
> But that would be some future improvements after basic suspend/resume
> functionality.
>
>> I think it's worth to look McBSP register cache concept [1] from Janusz
>> > Krzysztofik would it help all of this context save/restore operations.
>> [Aggarwal, Anuj] I tried these two patches on omap3 evm but they didn't
>> work for me. The system doesn't go to the suspend state when I do:
>> echo mem > /sys/power/state
>> And the culprits were core (think sdma) and per domain. I tried
>> disabling the mcbsp i/f clock as well but it didn't help. On mcbsp
>> register dump, I couldn't find the sysconfig register getting
>> configured. Could that be the root cause?
>>
>
> Does it go into suspend if the audio is not running (i.e. McBSP not
> requested) or
> if you don't even compile the McBSP support? I haven't looked are there
> checks
> for active clocks in PM core but PM is easier to start with bare minimum and
> to
> see that system can do suspend/resume and then add more features one by one.
[Anuj] Yes, w/o audio, it goes into suspend neatly.
After going through the entire patch series "[PATCHv5 00/20] OMAP
ASoC changes in DMA utilization", which I missed earlier, I found that the
sysfs entry dma_op_mode can be toggled among element/frame/threshold,
by default which is element hence not allowing the mcbsp driver to go into
idle state. I changed that at run time and after that I am able to hit
the suspend
state while playing back audio (at least the log doesn't
show that the system is not able to hit suspend).
My question is: is sysfs the only way to choose threshold or can it be made as
default? I could not see that happening in the code so thinking of the possible
reason of choosing not to do so. Because the user who wants to hit suspend
will not like to issue driver specific commands. Any specific reason of not
doing that by default?
>
> --
> Jarkko
> ___
> Alsa-devel mailing list
> alsa-de...@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>



-- 
Best Regards,
Anuj Aggarwal
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] ASoC: Modifying the license string GPLv2 for OMAP3 EVM

2009-11-17 Thread Anuj Aggarwal
Correcting the license string from GPLv2 -> GPL v2.
Found the problem while building OMAP3 ASoC driver as
module.

Signed-off-by: Anuj Aggarwal 
---
 sound/soc/omap/omap3evm.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sound/soc/omap/omap3evm.c b/sound/soc/omap/omap3evm.c
index 41a91b5..627fadb 100644
--- a/sound/soc/omap/omap3evm.c
+++ b/sound/soc/omap/omap3evm.c
@@ -144,4 +144,4 @@ module_exit(omap3evm_soc_exit);
 
 MODULE_AUTHOR("Anuj Aggarwal ");
 MODULE_DESCRIPTION("ALSA SoC OMAP3 EVM");
-MODULE_LICENSE("GPLv2");
+MODULE_LICENSE("GPL v2");
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] ASoC: Correcting the config options in soc/omap/Makefile

2009-11-17 Thread Anuj Aggarwal
Wrong config options were being used in the soc/omap/Makefile
for OMAP2 & OMAP3 and AM3517 EVMs.

Signed-off-by: Anuj Aggarwal 
---
 sound/soc/omap/Makefile |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index 02d6947..a69bd04 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -21,8 +21,8 @@ obj-$(CONFIG_SND_OMAP_SOC_N810) += snd-soc-n810.o
 obj-$(CONFIG_SND_OMAP_SOC_AMS_DELTA) += snd-soc-ams-delta.o
 obj-$(CONFIG_SND_OMAP_SOC_OSK5912) += snd-soc-osk5912.o
 obj-$(CONFIG_SND_OMAP_SOC_OVERO) += snd-soc-overo.o
-obj-$(CONFIG_MACH_OMAP2EVM) += snd-soc-omap2evm.o
-obj-$(CONFIG_MACH_OMAP3EVM) += snd-soc-omap3evm.o
+obj-$(CONFIG_SND_OMAP_SOC_OMAP2EVM) += snd-soc-omap2evm.o
+obj-$(CONFIG_SND_SOC_OMAP_OMAP3EVM) += snd-soc-omap3evm.o
 obj-$(CONFIG_SND_OMAP_SOC_SDP3430) += snd-soc-sdp3430.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE) += snd-soc-omap3beagle.o
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] OMAP: Exporting functions doing common register access

2009-11-16 Thread Anuj Aggarwal
These functions need to be exported so that drivers (e.g. McBSP) can
be configured as modules.

McBSP driver gets built as a module when ASoC driver for OMAP3 EVM
is configured as module. McBSP driver uses functions like
omap_ctrl_readl/omap_ctrl_writel, which are defined in control.c
file but not exported. Without that, McBSP driver fails to build as
a module.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/control.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index 6adb360..8285e1f 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -36,29 +36,35 @@ u8 omap_ctrl_readb(u16 offset)
 {
return __raw_readb(OMAP_CTRL_REGADDR(offset));
 }
+EXPORT_SYMBOL(omap_ctrl_readb);
 
 u16 omap_ctrl_readw(u16 offset)
 {
return __raw_readw(OMAP_CTRL_REGADDR(offset));
 }
+EXPORT_SYMBOL(omap_ctrl_readw);
 
 u32 omap_ctrl_readl(u16 offset)
 {
return __raw_readl(OMAP_CTRL_REGADDR(offset));
 }
+EXPORT_SYMBOL(omap_ctrl_readl);
 
 void omap_ctrl_writeb(u8 val, u16 offset)
 {
__raw_writeb(val, OMAP_CTRL_REGADDR(offset));
 }
+EXPORT_SYMBOL(omap_ctrl_writeb);
 
 void omap_ctrl_writew(u16 val, u16 offset)
 {
__raw_writew(val, OMAP_CTRL_REGADDR(offset));
 }
+EXPORT_SYMBOL(omap_ctrl_writew);
 
 void omap_ctrl_writel(u32 val, u16 offset)
 {
__raw_writel(val, OMAP_CTRL_REGADDR(offset));
 }
+EXPORT_SYMBOL(omap_ctrl_writel);
 
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] Regulator: Modifying Kconfig to choose from the available PMICs

2009-11-11 Thread Anuj Aggarwal
Kconfig is modified so that the user can choose the appropriate
PMIC in the underlying EVM.
Config options for other PMICs will be added later on.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/Kconfig |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 8685df5..7c45801 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -64,6 +64,14 @@ config MACH_OVERO
 config MACH_OMAP3EVM
bool "OMAP 3530 EVM board"
depends on ARCH_OMAP3 && ARCH_OMAP34XX
+config PMIC_TWL4030
+   bool "TWL4030/TPS65950 Power Module"
+   default y
+   depends on TWL4030_CORE && MACH_OMAP3EVM
+   select REGULATOR_TWL4030 if REGULATOR
+   help
+ Say yes here if you are using the TWL4030/TPS65950 based power module
+ for the EVM boards.
 
 config MACH_OMAP3_PANDORA
bool "OMAP3 Pandora"
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] Regulator: Modifying board-3430sdp.c to use PMIC-init-macros or wrappers

2009-11-11 Thread Anuj Aggarwal
Modified board-3430sdp.c to use PMIC initialization macros / wrappers
for TWL4030 regulator.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/board-3430sdp.c |  196 +--
 1 files changed, 51 insertions(+), 145 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index a3c1271..d87e50d 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -44,6 +44,8 @@
 #include "sdram-qimonda-hyb18m512160af-6.h"
 #include "mmc-twl4030.h"
 
+#include "board-omap35x-pmic.h"
+
 #define CONFIG_DISABLE_HFCLK 1
 
 #define SDP3430_TS_GPIO_IRQ_SDPV1  3
@@ -157,15 +159,10 @@ static struct platform_device sdp3430_lcd_device = {
.id = -1,
 };
 
-static struct regulator_consumer_supply sdp3430_vdac_supply = {
-   .supply = "vdac",
-   .dev= &sdp3430_lcd_device.dev,
-};
-
-static struct regulator_consumer_supply sdp3430_vdvi_supply = {
-   .supply = "vdvi",
-   .dev= &sdp3430_lcd_device.dev,
-};
+/* Create a single supply for VDAC */
+REGULATOR_CONSUMER_SINGLE_SUPPLY(vdac, vdac, &sdp3430_lcd_device.dev);
+/* Create a single supply for VDAC */
+REGULATOR_CONSUMER_SINGLE_SUPPLY(vpll2, vdvi, &sdp3430_lcd_device.dev);
 
 static struct platform_device *sdp3430_devices[] __initdata = {
&sdp3430_lcd_device,
@@ -221,17 +218,12 @@ static struct twl4030_hsmmc_info mmc[] = {
{}  /* Terminator */
 };
 
-static struct regulator_consumer_supply sdp3430_vmmc1_supply = {
-   .supply = "vmmc",
-};
-
-static struct regulator_consumer_supply sdp3430_vsim_supply = {
-   .supply = "vmmc_aux",
-};
-
-static struct regulator_consumer_supply sdp3430_vmmc2_supply = {
-   .supply = "vmmc",
-};
+/* Create default supply for VMMC1 */
+TWL_VMMC1_SUPPLY;
+/* Create default supply for VSIM */
+TWL_VSIM_SUPPLY;
+/* Create default supply for VMMC2 */
+TWL_VMMC2_SUPPLY;
 
 static int sdp3430_twl_gpio_setup(struct device *dev,
unsigned gpio, unsigned ngpio)
@@ -246,9 +238,9 @@ static int sdp3430_twl_gpio_setup(struct device *dev,
/* link regulators to MMC adapters ... we "know" the
 * regulators will be set up only *after* we return.
 */
-   sdp3430_vmmc1_supply.dev = mmc[0].dev;
-   sdp3430_vsim_supply.dev = mmc[0].dev;
-   sdp3430_vmmc2_supply.dev = mmc[1].dev;
+   vmmc1_consumers[0].dev = mmc[0].dev;
+   vsim_consumers[0].dev = mmc[0].dev;
+   vmmc2_consumers[0].dev = mmc[1].dev;
 
/* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */
gpio_request(gpio + 7, "sub_lcd_en_bkl");
@@ -282,133 +274,45 @@ static struct twl4030_madc_platform_data 
sdp3430_madc_data = {
  * Apply all the fixed voltages since most versions of U-Boot
  * don't bother with that initialization.
  */
-
+/* VAUX1 doesn't supply to anyone */
+REGULATOR_CONSUMER_NO_SUPPLY(vaux1);
+/* VAUX2 doesn't supply to anyone */
+REGULATOR_CONSUMER_NO_SUPPLY(vaux2);
+/* VAUX3 doesn't supply to anyone */
+REGULATOR_CONSUMER_NO_SUPPLY(vaux3);
+/* VAUX4 doesn't supply to anyone */
+REGULATOR_CONSUMER_NO_SUPPLY(vaux4);
+
+/* Create regulator initialization data for various regulators */
 /* VAUX1 for mainboard (irda and sub-lcd) */
-static struct regulator_init_data sdp3430_vaux1 = {
-   .constraints = {
-   .min_uV = 280,
-   .max_uV = 280,
-   .apply_uV   = true,
-   .valid_modes_mask   = REGULATOR_MODE_NORMAL
-   | REGULATOR_MODE_STANDBY,
-   .valid_ops_mask = REGULATOR_CHANGE_MODE
-   | REGULATOR_CHANGE_STATUS,
-   },
-};
-
+TWL_VAUX1_DATA;
 /* VAUX2 for camera module */
-static struct regulator_init_data sdp3430_vaux2 = {
-   .constraints = {
-   .min_uV = 280,
-   .max_uV = 280,
-   .apply_uV   = true,
-   .valid_modes_mask   = REGULATOR_MODE_NORMAL
-   | REGULATOR_MODE_STANDBY,
-   .valid_ops_mask = REGULATOR_CHANGE_MODE
-   | REGULATOR_CHANGE_STATUS,
-   },
-};
-
+TWL_VAUX2_DATA;
 /* VAUX3 for LCD board */
-static struct regulator_init_data sdp3430_vaux3 = {
-   .constraints = {
-   .min_uV = 280,
-   .max_uV = 280,
-   .apply_uV   = true,
-   .valid_modes_mask   = REGULATOR_MODE_NORMAL
-   | REGULATOR_MODE_STANDBY,
-   .valid_ops_mask  

[PATCH 2/4] Regulator: Modifying board-omap3evm.c to use PMIC-init-macros or wrappers

2009-11-11 Thread Anuj Aggarwal
Modified board-omap3evm.c to use PMIC initialization macros / wrappers
for TWL4030 regulators.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/board-omap3evm.c |   82 -
 1 files changed, 40 insertions(+), 42 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c 
b/arch/arm/mach-omap2/board-omap3evm.c
index b9b0f4c..4df83c6 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -44,6 +44,8 @@
 #include "sdram-micron-mt46h32m32lf-6.h"
 #include "mmc-twl4030.h"
 
+#include "board-omap35x-pmic.h"
+
 #define OMAP3_EVM_TS_GPIO  175
 
 #define OMAP3EVM_ETHR_START0x2c00
@@ -94,43 +96,10 @@ static inline void __init omap3evm_init_smc911x(void)
gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ);
 }
 
-static struct regulator_consumer_supply omap3evm_vmmc1_supply = {
-   .supply = "vmmc",
-};
-
-static struct regulator_consumer_supply omap3evm_vsim_supply = {
-   .supply = "vmmc_aux",
-};
-
-/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
-static struct regulator_init_data omap3evm_vmmc1 = {
-   .constraints = {
-   .min_uV = 185,
-   .max_uV = 315,
-   .valid_modes_mask   = REGULATOR_MODE_NORMAL
-   | REGULATOR_MODE_STANDBY,
-   .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
-   | REGULATOR_CHANGE_MODE
-   | REGULATOR_CHANGE_STATUS,
-   },
-   .num_consumer_supplies  = 1,
-   .consumer_supplies  = &omap3evm_vmmc1_supply,
-};
-
-/* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */
-static struct regulator_init_data omap3evm_vsim = {
-   .constraints = {
-   .min_uV = 180,
-   .max_uV = 300,
-   .valid_modes_mask   = REGULATOR_MODE_NORMAL
-   | REGULATOR_MODE_STANDBY,
-   .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
-   | REGULATOR_CHANGE_MODE
-   | REGULATOR_CHANGE_STATUS,
-   },
-   .num_consumer_supplies  = 1,
-   .consumer_supplies  = &omap3evm_vsim_supply,
-};
+/* Create default supply for VMMC1 */
+TWL_VMMC1_SUPPLY;
+/* Create default supply for VSIM */
+TWL_VSIM_SUPPLY;
 
 static struct twl4030_hsmmc_info mmc[] = {
{
@@ -165,7 +134,6 @@ static struct platform_device leds_gpio = {
},
 };
 
-
 static int omap3evm_twl_gpio_setup(struct device *dev,
unsigned gpio, unsigned ngpio)
 {
@@ -175,8 +143,8 @@ static int omap3evm_twl_gpio_setup(struct device *dev,
twl4030_mmc_init(mmc);
 
/* link regulators to MMC adapters */
-   omap3evm_vmmc1_supply.dev = mmc[0].dev;
-   omap3evm_vsim_supply.dev = mmc[0].dev;
+   vmmc1_consumers[0].dev = mmc[0].dev;
+   vsim_consumers[0].dev = mmc[0].dev;
 
/*
 * Most GPIOs are for USB OTG.  Some are mostly sent to
@@ -238,6 +206,32 @@ static struct twl4030_madc_platform_data 
omap3evm_madc_data = {
.irq_line   = 1,
 };
 
+/* Create init data for VMMC1 */
+REGULATOR_INIT_DATA(vmmc1, VMMC1, 185, 315,
+   TWL_REGULATOR_MODES_DEFAULT,
+   TWL_REGULATOR_OPS_DEFAULT | REGULATOR_CHANGE_VOLTAGE,
+   false);
+
+/* Create init data for VSIM */
+REGULATOR_INIT_DATA(vsim, VSIM, 180, 300,
+   TWL_REGULATOR_MODES_DEFAULT,
+   TWL_REGULATOR_OPS_DEFAULT | REGULATOR_CHANGE_VOLTAGE,
+   false);
+
+/* Create default supply for VDAC */
+TWL_VDAC_SUPPLY;
+/* Create default supply for VPLL2 */
+TWL_VPLL2_SUPPLY;
+
+/* Create init data for VDAC */
+TWL_VDAC_DATA;
+
+/* Create init data for VPLL2 */
+REGULATOR_INIT_DATA(vpll2, VDVI, 180, 180,
+   TWL_REGULATOR_MODES_DEFAULT,
+   TWL_REGULATOR_OPS_DEFAULT,
+   true);
+
 static struct twl4030_platform_data omap3evm_twldata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
@@ -247,8 +241,10 @@ static struct twl4030_platform_data omap3evm_twldata = {
.madc   = &omap3evm_madc_data,
.usb= &omap3evm_usb_data,
.gpio   = &omap3evm_gpio_data,
-   .vmmc1  = &omap3evm_vmmc1,
-   .vsim   = &omap3evm_vsim,
+   .vmmc1  = &vmmc1_data[0],
+   .vsim   = &vsim_data[0],
+   .vdac   = &vdac_data[0],
+   .vpll2  = &vpll2_data[0],
 };
 
 static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = {
@@ -359,6 +355,8 @@ static void __init omap3_evm_init(void)
 {
om

[PATCH 1/4] Regulator: Adding header file for initializing OMAP35x PMICs

2009-11-11 Thread Anuj Aggarwal
This header file is created to provide user generic macros for
providing regulator supplies and regulator init data. Wrappers
are created using these macros which could be used in default
scenarios. In other cases, user can use the macros to provide
his own configuration information.

Wrappers are created only for TWL4030/TPS65950 right now. For
other PMICs, they will be added later on.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/board-omap35x-pmic.h |  191 ++
 1 files changed, 191 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/board-omap35x-pmic.h

diff --git a/arch/arm/mach-omap2/board-omap35x-pmic.h 
b/arch/arm/mach-omap2/board-omap35x-pmic.h
new file mode 100644
index 000..a370fdd
--- /dev/null
+++ b/arch/arm/mach-omap2/board-omap35x-pmic.h
@@ -0,0 +1,191 @@
+/*
+ * board-omap35x-pmic.h
+ *
+ * Macros to create regulator supplies and regulator init data, along with the
+ * default wrappers for various TI PMICs like TWL4030/TPS65950, TPS65023 etc.
+ *
+ * Copyright (C) 2009 Texas Instrument Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+/* Create supplies for a specific regulator */
+#define REGULATOR_COMSUMER_START(regulator) \
+   static struct regulator_consumer_supply regulator##_consumers[]
+/* Add/define supplies to the specific regulator */
+#define REGULATOR_COMSUMER_DEFINE(s, device) \
+   { \
+   .supply = #s, \
+   .dev = device, \
+   }
+
+/* Define regulator with no supplies attached to it */
+#define REGULATOR_CONSUMER_NO_SUPPLY(regulator) \
+   REGULATOR_COMSUMER_START(regulator) = {}
+
+/* Define regulator with a single supply attached to it */
+#define REGULATOR_CONSUMER_SINGLE_SUPPLY(regulator, s, device) \
+   REGULATOR_COMSUMER_START(regulator) = { \
+   REGULATOR_COMSUMER_DEFINE(s, device), \
+   }
+
+/* Define regulator with multiple supplies attached to it like */
+   /*
+   REGULATOR_COMSUMER_START(name) = {
+   REGULATOR_COMSUMER_DEFINE(supply, device),
+   REGULATOR_COMSUMER_DEFINE(supply, device),
+   REGULATOR_COMSUMER_DEFINE(supply, device),
+   }
+   */
+
+/* Define regulation constraints */
+#define REGULATOR_CONSTRAINTS(n, min, max, modes, ops, apply_uv_f) \
+   { \
+   .name = #n, \
+   .min_uV = min, \
+   .max_uV = max, \
+   .valid_modes_mask = modes, \
+   .valid_ops_mask = ops, \
+   .apply_uV = apply_uv_f, \
+   },
+
+/* Declare the regulator initialization data */
+#define REGULATOR_INIT_DATA_START(regulator) \
+   static struct regulator_init_data regulator##_data[]
+
+/* Populate various fields in the regulator initialization data */
+#define REGULATOR_INIT_DATA_DEFINE(regulator, n, min, max, modes, ops, \
+   apply_uv_f) \
+   { \
+   .constraints = REGULATOR_CONSTRAINTS(n, min, max, modes, ops, \
+   apply_uv_f) \
+   .num_consumer_supplies = ARRAY_SIZE(regulator##_consumers), \
+   .consumer_supplies = regulator##_consumers, \
+   },
+
+/* Define regulator initialization data */
+#define REGULATOR_INIT_DATA(regulator, n, min, max, modes, ops, apply_uv_f) \
+   REGULATOR_INIT_DATA_START(regulator) = { \
+   REGULATOR_INIT_DATA_DEFINE(regulator, n, min, max, modes, ops, \
+   apply_uv_f) \
+   }
+
+/*
+ * Default wrappers specific to TWL4030/TPS65950 PMIC
+ */
+#if defined(CONFIG_PMIC_TWL4030) || defined(CONFIG_TWL4030_CORE)
+#define TWL_REGULATOR_MODES_DEFAULT(REGULATOR_MODE_NORMAL | \
+   REGULATOR_MODE_STANDBY)
+#define TWL_REGULATOR_OPS_DEFAULT  (REGULATOR_CHANGE_MODE | \
+   REGULATOR_CHANGE_STATUS)
+
+/* Default supplies for TWL4030 regulators */
+#define TWL_VAUX1_SUPPLY   REGULATOR_CONSUMER_SINGLE_SUPPLY(vaux1, \
+   vaux1, NULL)
+#define TWL_VAUX2_SUPPLY   REGULATOR_CONSUMER_SINGLE_SUPPLY(vaux2, \
+   vaux2, NULL)
+#define TWL_VAUX3_SUPPLY   REGULATOR_CONSUMER_SINGLE_SUPPLY(vaux3, \
+   vaux3, NULL)
+#define TWL_VAUX4_SUPPLY   REGULATOR_CONSUMER_SINGLE_SUPPLY(vaux4, \
+   v

[PATCH 0/4] Regulator: Providing regulator initialization macros/wrappers

2009-11-11 Thread Anuj Aggarwal
Based on the discussion at:
  http://marc.info/?l=linux-omap&m=125775124829936&w=2

Header file board-omap35x-pmic.h is created to provide generic macros for
initializing regulator supplies and regulator init data. Wrappers are
also created using these macros which could be used in default scenarios.

Modified board-3430sdp.c and board-omap3evm.c to use the macros/wrappers
instead, to avoid duplication of common code. On the similar lines, other
board-evm files can be modified and new code can be added using these
macros.

Anuj Aggarwal (4):
  Regulator: Adding header file for initializing OMAP35x PMICs
  Regulator: Modifying board-omap3evm.c to use PMIC-init-macros or
wrappers
  Regulator: Modifying board-3430sdp.c to use PMIC-init-macros or
wrappers
  Regulator: Modifying Kconfig to choose from the available PMICs

 arch/arm/mach-omap2/Kconfig  |8 ++
 arch/arm/mach-omap2/board-3430sdp.c  |  196 --
 arch/arm/mach-omap2/board-omap35x-pmic.h |  191 +
 arch/arm/mach-omap2/board-omap3evm.c |   82 ++---
 4 files changed, 290 insertions(+), 187 deletions(-)
 create mode 100644 arch/arm/mach-omap2/board-omap35x-pmic.h

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] Audio: Modifying the defconfig for OMAP3517 / AM3517 EVM

2009-10-29 Thread Anuj Aggarwal
Enabling Audio for OMAP3517 / AM3517 EVM in the defconfig.

Also enabling McBSP and I2C drivers as both are required for
audio on this EVM.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/configs/am3517_evm_defconfig |   78 +++-
 1 files changed, 75 insertions(+), 3 deletions(-)

diff --git a/arch/arm/configs/am3517_evm_defconfig 
b/arch/arm/configs/am3517_evm_defconfig
index 787f295..316cbaa 100644
--- a/arch/arm/configs/am3517_evm_defconfig
+++ b/arch/arm/configs/am3517_evm_defconfig
@@ -202,7 +202,7 @@ CONFIG_ARCH_OMAP3=y
 # CONFIG_OMAP_DEBUG_CLOCKDOMAIN is not set
 CONFIG_OMAP_RESET_CLOCKS=y
 # CONFIG_OMAP_MUX is not set
-# CONFIG_OMAP_MCBSP is not set
+CONFIG_OMAP_MCBSP=y
 # CONFIG_OMAP_MBOX_FWK is not set
 # CONFIG_OMAP_MPU_TIMER is not set
 CONFIG_OMAP_32K_TIMER=y
@@ -590,7 +590,46 @@ CONFIG_HW_RANDOM=y
 # CONFIG_R3964 is not set
 # CONFIG_RAW_DRIVER is not set
 # CONFIG_TCG_TPM is not set
-# CONFIG_I2C is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
+# CONFIG_I2C_CHARDEV is not set
+CONFIG_I2C_HELPER_AUTO=y
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+# CONFIG_I2C_DESIGNWARE is not set
+# CONFIG_I2C_GPIO is not set
+# CONFIG_I2C_OCORES is not set
+CONFIG_I2C_OMAP=y
+# CONFIG_I2C_SIMTEC is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_STUB is not set
+
+#
+# Miscellaneous I2C Chip support
+#
+# CONFIG_DS1682 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
 # CONFIG_SPI is not set
 
 #
@@ -666,7 +705,40 @@ CONFIG_SSB_POSSIBLE=y
 #
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
-# CONFIG_SOUND is not set
+CONFIG_SOUND=y
+# CONFIG_SOUND_OSS_CORE is not set
+CONFIG_SND=y
+CONFIG_SND_TIMER=y
+CONFIG_SND_PCM=y
+CONFIG_SND_JACK=y
+# CONFIG_SND_SEQUENCER is not set
+# CONFIG_SND_MIXER_OSS is not set
+# CONFIG_SND_PCM_OSS is not set
+# CONFIG_SND_HRTIMER is not set
+# CONFIG_SND_DYNAMIC_MINORS is not set
+CONFIG_SND_SUPPORT_OLD_API=y
+CONFIG_SND_VERBOSE_PROCFS=y
+# CONFIG_SND_VERBOSE_PRINTK is not set
+# CONFIG_SND_DEBUG is not set
+# CONFIG_SND_RAWMIDI_SEQ is not set
+# CONFIG_SND_OPL3_LIB_SEQ is not set
+# CONFIG_SND_OPL4_LIB_SEQ is not set
+# CONFIG_SND_SBAWE_SEQ is not set
+# CONFIG_SND_EMU10K1_SEQ is not set
+CONFIG_SND_DRIVERS=y
+# CONFIG_SND_DUMMY is not set
+# CONFIG_SND_MTPAV is not set
+# CONFIG_SND_SERIAL_U16550 is not set
+# CONFIG_SND_MPU401 is not set
+CONFIG_SND_ARM=y
+CONFIG_SND_SOC=y
+CONFIG_SND_OMAP_SOC=y
+CONFIG_SND_OMAP_SOC_MCBSP=y
+CONFIG_SND_OMAP_SOC_AM3517EVM=y
+CONFIG_SND_SOC_I2C_AND_SPI=y
+# CONFIG_SND_SOC_ALL_CODECS is not set
+CONFIG_SND_SOC_TLV320AIC23=y
+# CONFIG_SOUND_PRIME is not set
 # CONFIG_HID_SUPPORT is not set
 # CONFIG_USB_SUPPORT is not set
 # CONFIG_MMC is not set
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] Audio: Modifying board-evm file for audio codec

2009-10-29 Thread Anuj Aggarwal
Adding I2C bus registration code in board-evm file for OMAP3517 /
AM3517 EVM for AIC23 audio codec.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/board-am3517evm.c |   21 +
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-am3517evm.c 
b/arch/arm/mach-omap2/board-am3517evm.c
index 23cf949..5f5f3ee 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -30,6 +30,25 @@
 #include 
 
 /*
+ * I2C
+ */
+static struct i2c_board_info __initdata am3517evm_i2c_boardinfo[] = {
+   {
+   I2C_BOARD_INFO("tlv320aic23", 0x1A),
+   },
+};
+
+static int __init am3517_evm_i2c_init(void)
+{
+   omap_register_i2c_bus(1, 400, NULL, 0);
+   omap_register_i2c_bus(2, 400, am3517evm_i2c_boardinfo,
+   ARRAY_SIZE(am3517evm_i2c_boardinfo));
+   omap_register_i2c_bus(3, 400, NULL, 0);
+
+   return 0;
+}
+
+/*
  * Board initialization
  */
 static struct omap_board_config_kernel am3517_evm_config[] __initdata = {
@@ -50,6 +69,8 @@ static void __init am3517_evm_init_irq(void)
 
 static void __init am3517_evm_init(void)
 {
+   am3517_evm_i2c_init();
+
platform_add_devices(am3517_evm_devices,
ARRAY_SIZE(am3517_evm_devices));
 
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] Audio: Modifying Kconfig/Makefile for AM3517 EVM

2009-10-29 Thread Anuj Aggarwal
Modifying the Kconfig and Makefile in sound/soc/omap folder
to add support for OMAP3517 / AM3517 EVM in Alsa SoC.

Signed-off-by: Anuj Aggarwal 
---
 sound/soc/omap/Kconfig  |9 +
 sound/soc/omap/Makefile |2 ++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index 2dee983..6344456 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -55,6 +55,15 @@ config SND_OMAP_SOC_OMAP3EVM
help
  Say Y if you want to add support for SoC audio on the omap3evm board.
 
+config SND_OMAP_SOC_AM3517EVM
+   tristate "SoC Audio support for OMAP3517 / AM3517 EVM"
+   depends on SND_OMAP_SOC && MACH_OMAP3517EVM && I2C
+   select SND_OMAP_SOC_MCBSP
+   select SND_SOC_TLV320AIC23
+   help
+ Say Y if you want to add support for SoC audio on the OMAP3517 / 
AM3517
+ EVM.
+
 config SND_OMAP_SOC_SDP3430
tristate "SoC Audio support for Texas Instruments SDP3430"
depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP_3430SDP
diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index 02d6947..0c78ae4 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -12,6 +12,7 @@ snd-soc-osk5912-objs := osk5912.o
 snd-soc-overo-objs := overo.o
 snd-soc-omap2evm-objs := omap2evm.o
 snd-soc-omap3evm-objs := omap3evm.o
+snd-soc-am3517evm-objs := am3517evm.o
 snd-soc-sdp3430-objs := sdp3430.o
 snd-soc-omap3pandora-objs := omap3pandora.o
 snd-soc-omap3beagle-objs := omap3beagle.o
@@ -23,6 +24,7 @@ obj-$(CONFIG_SND_OMAP_SOC_OSK5912) += snd-soc-osk5912.o
 obj-$(CONFIG_SND_OMAP_SOC_OVERO) += snd-soc-overo.o
 obj-$(CONFIG_MACH_OMAP2EVM) += snd-soc-omap2evm.o
 obj-$(CONFIG_MACH_OMAP3EVM) += snd-soc-omap3evm.o
+obj-$(CONFIG_MACH_OMAP3517EVM) += snd-soc-am3517evm.o
 obj-$(CONFIG_SND_OMAP_SOC_SDP3430) += snd-soc-sdp3430.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE) += snd-soc-omap3beagle.o
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] Audio: Adding OMAP3517 / AM3517 EVM support in ASOC

2009-10-29 Thread Anuj Aggarwal
Adding support for OMAP3517 / AM3517 EVM in Alsa SoC.

Signed-off-by: Anuj Aggarwal 
---
 sound/soc/omap/am3517evm.c |  202 
 1 files changed, 202 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/omap/am3517evm.c

diff --git a/sound/soc/omap/am3517evm.c b/sound/soc/omap/am3517evm.c
new file mode 100644
index 000..135901b
--- /dev/null
+++ b/sound/soc/omap/am3517evm.c
@@ -0,0 +1,202 @@
+/*
+ * am3517evm.c  -- ALSA SoC support for OMAP3517 / AM3517 EVM
+ *
+ * Author: Anuj Aggarwal 
+ *
+ * Based on sound/soc/omap/beagle.c by Steve Sakoman
+ *
+ * Copyright (C) 2009 Texas Instruments Incorporated
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "omap-mcbsp.h"
+#include "omap-pcm.h"
+
+#include "../codecs/tlv320aic23.h"
+
+#define CODEC_CLOCK1200
+
+static int am3517evm_hw_params(struct snd_pcm_substream *substream,
+   struct snd_pcm_hw_params *params)
+{
+   struct snd_soc_pcm_runtime *rtd = substream->private_data;
+   struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
+   struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
+   int ret;
+
+   /* Set codec DAI configuration */
+   ret = snd_soc_dai_set_fmt(codec_dai,
+ SND_SOC_DAIFMT_DSP_B |
+ SND_SOC_DAIFMT_NB_NF |
+ SND_SOC_DAIFMT_CBM_CFM);
+   if (ret < 0) {
+   printk(KERN_ERR "can't set codec DAI configuration\n");
+   return ret;
+   }
+
+   /* Set cpu DAI configuration */
+   ret = snd_soc_dai_set_fmt(cpu_dai,
+ SND_SOC_DAIFMT_DSP_B |
+ SND_SOC_DAIFMT_NB_NF |
+ SND_SOC_DAIFMT_CBM_CFM);
+   if (ret < 0) {
+   printk(KERN_ERR "can't set cpu DAI configuration\n");
+   return ret;
+   }
+
+   /* Set the codec system clock for DAC and ADC */
+   ret = snd_soc_dai_set_sysclk(codec_dai, 0,
+   CODEC_CLOCK, SND_SOC_CLOCK_IN);
+   if (ret < 0) {
+   printk(KERN_ERR "can't set codec system clock\n");
+   return ret;
+   }
+
+   ret = snd_soc_dai_set_sysclk(cpu_dai, OMAP_MCBSP_CLKR_SRC_CLKX, 0,
+   SND_SOC_CLOCK_IN);
+   if (ret < 0) {
+   printk(KERN_ERR "can't set CPU system clock 
OMAP_MCBSP_CLKR_SRC_CLKX\n");
+   return ret;
+   }
+
+   snd_soc_dai_set_sysclk(cpu_dai, OMAP_MCBSP_FSR_SRC_FSX, 0,
+   SND_SOC_CLOCK_IN);
+   if (ret < 0) {
+   printk(KERN_ERR "can't set CPU system clock 
OMAP_MCBSP_FSR_SRC_FSX\n");
+   return ret;
+   }
+
+   return 0;
+}
+
+static struct snd_soc_ops am3517evm_ops = {
+   .hw_params = am3517evm_hw_params,
+};
+
+/* am3517evm machine dapm widgets */
+static const struct snd_soc_dapm_widget tlv320aic23_dapm_widgets[] = {
+   SND_SOC_DAPM_HP("Line Out", NULL),
+   SND_SOC_DAPM_LINE("Line In", NULL),
+   SND_SOC_DAPM_MIC("Mic In", NULL),
+};
+
+static const struct snd_soc_dapm_route audio_map[] = {
+   /* Line Out connected to LLOUT, RLOUT */
+   {"Line Out", NULL, "LOUT"},
+   {"Line Out", NULL, "ROUT"},
+
+   {"LLINEIN", NULL, "Line In"},
+   {"RLINEIN", NULL, "Line In"},
+
+   {"MICIN", NULL, "Mic In"},
+};
+
+static int am3517evm_aic23_init(struct snd_soc_codec *codec)
+{
+   /* Add am3517-evm specific widgets */
+   snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets,
+ ARRAY_SIZE(tlv320aic23_dapm_widgets));
+
+   /* Set up davinci-evm specific audio path audio_map */
+   snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
+
+   /* always connected */
+   snd_soc_dapm_enable_pin(codec, "Line Out");
+   snd_soc_dapm_enable_pin(codec, "Line In");
+   snd_soc_dapm_enable_pin(codec, "Mic In");
+
+   snd_soc_dapm_sync(codec);
+
+   return 0;
+}
+
+/* Digital audio interface glue - connects codec <--> CPU */
+static st

[PATCH 0/4] ASOC: Add AM3517 EVM support in ASOC

2009-10-29 Thread Anuj Aggarwal
This patch series add support for OMAP3517 / AM3517 EVM in ASOC.
It also enables the required drivers - I2C and McBSP, along with
Alsa SoC subsystem, in the default configuration for the EVM.

Anuj Aggarwal (4):
  Audio: Adding OMAP3517 / AM3517 EVM support in ASOC
  Audio: Modifying Kconfig/Makefile for AM3517 EVM
  Audio: Modifying board-evm file for audio codec
  Audio: Modifying the defconfig for OMAP3517 / AM3517 EVM

 arch/arm/configs/am3517_evm_defconfig |   78 -
 arch/arm/mach-omap2/board-am3517evm.c |   21 
 sound/soc/omap/Kconfig|9 ++
 sound/soc/omap/Makefile   |2 +
 sound/soc/omap/am3517evm.c|  202 +
 5 files changed, 309 insertions(+), 3 deletions(-)
 create mode 100644 sound/soc/omap/am3517evm.c

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] SDMA: Fixing bug in omap_dma_set_global_params()

2009-10-05 Thread Anuj Aggarwal
Argument tparams was not being used to program
global register GCR.HI_THREAD_RESERVED. This patch fixes the same.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/plat-omap/dma.c |   15 +--
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index fd3154a..0eb676d 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -829,10 +829,10 @@ EXPORT_SYMBOL(omap_free_dma);
  *
  * @param arb_rate
  * @param max_fifo_depth
- * @param tparams - Number of thereads to reserve : DMA_THREAD_RESERVE_NORM
- * DMA_THREAD_RESERVE_ONET
- * DMA_THREAD_RESERVE_TWOT
- * DMA_THREAD_RESERVE_THREET
+ * @param tparams - Number of threads to reserve : DMA_THREAD_RESERVE_NORM
+ *DMA_THREAD_RESERVE_ONET
+ *DMA_THREAD_RESERVE_TWOT
+ *DMA_THREAD_RESERVE_THREET
  */
 void
 omap_dma_set_global_params(int arb_rate, int max_fifo_depth, int tparams)
@@ -844,11 +844,14 @@ omap_dma_set_global_params(int arb_rate, int 
max_fifo_depth, int tparams)
return;
}
 
+   if (max_fifo_depth == 0)
+   max_fifo_depth = 1;
if (arb_rate == 0)
arb_rate = 1;
 
-   reg = (arb_rate & 0xff) << 16;
-   reg |= (0xff & max_fifo_depth);
+   reg = 0xff & max_fifo_depth;
+   reg |= (0x3 & tparams) << 12;
+   reg |= (arb_rate & 0xff) << 16;
 
dma_write(reg, GCR);
 }
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] SDMA: Fixing bug in omap_dma_set_global_params()

2009-09-23 Thread Anuj Aggarwal
Argument tparams was not being used to program
global register GCR.HI_THREAD_RESERVED. This patch fixes the same.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/plat-omap/dma.c |   13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index bf08634..7a7b6df 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -829,10 +829,10 @@ EXPORT_SYMBOL(omap_free_dma);
  *
  * @param arb_rate
  * @param max_fifo_depth
- * @param tparams - Number of thereads to reserve : DMA_THREAD_RESERVE_NORM
- * DMA_THREAD_RESERVE_ONET
- * DMA_THREAD_RESERVE_TWOT
- * DMA_THREAD_RESERVE_THREET
+ * @param tparams - Number of threads to reserve : DMA_THREAD_RESERVE_NORM
+ *DMA_THREAD_RESERVE_ONET
+ *DMA_THREAD_RESERVE_TWOT
+ *DMA_THREAD_RESERVE_THREET
  */
 void
 omap_dma_set_global_params(int arb_rate, int max_fifo_depth, int tparams)
@@ -847,8 +847,9 @@ omap_dma_set_global_params(int arb_rate, int 
max_fifo_depth, int tparams)
if (arb_rate == 0)
arb_rate = 1;
 
-   reg = (arb_rate & 0xff) << 16;
-   reg |= (0xff & max_fifo_depth);
+   reg = 0xff & max_fifo_depth;
+   reg |= (0x3 & tparams) << 12;
+   reg |= (arb_rate & 0xff) << 16;
 
dma_write(reg, GCR);
 }
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ASoC: OMAP3EVM: Use the twl4030_setup_data for headset pop-removal

2009-09-23 Thread Anuj Aggarwal
The pop-removal specific values are configured for TWL4030 codec
for OMAP3EVM through this patch.

Signed-off-by: Anuj Aggarwal 
---
 sound/soc/omap/omap3evm.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/sound/soc/omap/omap3evm.c b/sound/soc/omap/omap3evm.c
index 9114c26..8deb59b 100644
--- a/sound/soc/omap/omap3evm.c
+++ b/sound/soc/omap/omap3evm.c
@@ -93,10 +93,17 @@ static struct snd_soc_card snd_soc_omap3evm = {
.num_links = 1,
 };
 
+/* twl4030 setup */
+static struct twl4030_setup_data twl4030_setup = {
+   .ramp_delay_value = 4,
+   .sysclk = 26000,
+};
+
 /* Audio subsystem */
 static struct snd_soc_device omap3evm_snd_devdata = {
.card = &snd_soc_omap3evm,
.codec_dev = &soc_codec_dev_twl4030,
+   .codec_data = &twl4030_setup,
 };
 
 static struct platform_device *omap3evm_snd_device;
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC][PATCH] ARM: OMAP: McBSP: Use register cache

2009-09-05 Thread Anuj Aggarwal
On Fri, Sep 4, 2009 at 4:37 PM, Eero
Nurkkala wrote:
> On Fri, 2009-09-04 at 12:34 +0200, ext Janusz Krzysztofik wrote:
>> in normal (handset) mode, the noise level seems still acceptable. The only
>> missing piece of a puzzle is my patch, that prevents the kernel driver from
>> putting corrupted values into the McBSP control registers.
>>
>> That learned, please reconsider:
>> 1. Can my patch break anything, related or not?
>
> That needs to be investigated in more detail.
>
>> 2. How does it affect performance of otherwise unaffected machines?
>
> Like you already know, shouldn't.
>
>> 3. Is correcting a poorly designed machine behaviour worth of the change?
>>
>> Thanks,
>> Janusz
>
>
> I'd say this is in the right track. All McBSP registers
> (not status etc) will need to be stored in memory. (Now, they're not).
> And all those register contents will need to be written back
> in certain situations. So this is the case when there is an external
> audio chip, that takes audio in in bursts. So once the
> burst is complete, all McBSP clocks will be disabled for a duration.
>
> Then (at least >= 3430) device will hit OFF mode, meaning
> all register contents are lost, also McBSP's. They will
> need to be written back at some point.
Isn't the better way to achieve this thing, at least from the OFF mode
perspective, is to provide similar implementation for McBSP in
omap3_core_save_context () / omap3_core_restore_context(), in
file arch/arm/mach-omap2/pm34xx.c? Code for other core peripherals
is already there and we have to add support for rest of the core-domain
peripherals.
>
> My quick verdict is, that your patch is, going into right
> direction. But the thing is that my words don't count much ;)
>
> (Possibly worth taking the patch in, if guaranteed to not break
>  any others).
>
> - Eero
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



-- 
Best Regards,
Anuj Aggarwal
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv3 2/3] Regulator: Add TPS6507x regulator driver

2009-08-20 Thread Anuj Aggarwal
Adding support for TI TPS6507x regulator driver

Signed-off-by: Anuj Aggarwal 
---
 drivers/regulator/tps6507x-regulator.c |  713 
 1 files changed, 713 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/tps6507x-regulator.c

diff --git a/drivers/regulator/tps6507x-regulator.c 
b/drivers/regulator/tps6507x-regulator.c
new file mode 100644
index 000..1aa3636
--- /dev/null
+++ b/drivers/regulator/tps6507x-regulator.c
@@ -0,0 +1,713 @@
+/*
+ * tps6507x-regulator.c
+ *
+ * Regulator driver for TPS65073 PMIC
+ *
+ * Copyright (C) 2009 Texas Instrument Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Register definitions */
+#defineTPS6507X_REG_PPATH1 0X01
+#defineTPS6507X_REG_INT0X02
+#defineTPS6507X_REG_CHGCONFIG0 0X03
+#defineTPS6507X_REG_CHGCONFIG1 0X04
+#defineTPS6507X_REG_CHGCONFIG2 0X05
+#defineTPS6507X_REG_CHGCONFIG3 0X06
+#defineTPS6507X_REG_REG_ADCONFIG   0X07
+#defineTPS6507X_REG_TSCMODE0X08
+#defineTPS6507X_REG_ADRESULT_1 0X09
+#defineTPS6507X_REG_ADRESULT_2 0X0A
+#defineTPS6507X_REG_PGOOD  0X0B
+#defineTPS6507X_REG_PGOODMASK  0X0C
+#defineTPS6507X_REG_CON_CTRL1  0X0D
+#defineTPS6507X_REG_CON_CTRL2  0X0E
+#defineTPS6507X_REG_CON_CTRL3  0X0F
+#defineTPS6507X_REG_DEFDCDC1   0X10
+#defineTPS6507X_REG_DEFDCDC2_LOW   0X11
+#defineTPS6507X_REG_DEFDCDC2_HIGH  0X12
+#defineTPS6507X_REG_DEFDCDC3_LOW   0X13
+#defineTPS6507X_REG_DEFDCDC3_HIGH  0X14
+#defineTPS6507X_REG_DEFSLEW0X15
+#defineTPS6507X_REG_LDO_CTRL1  0X16
+#defineTPS6507X_REG_DEFLDO20X17
+#defineTPS6507X_REG_WLED_CTRL1 0X18
+#defineTPS6507X_REG_WLED_CTRL2 0X19
+
+/* CON_CTRL1 bitfields */
+#defineTPS6507X_CON_CTRL1_DCDC1_ENABLE BIT(4)
+#defineTPS6507X_CON_CTRL1_DCDC2_ENABLE BIT(3)
+#defineTPS6507X_CON_CTRL1_DCDC3_ENABLE BIT(2)
+#defineTPS6507X_CON_CTRL1_LDO1_ENABLE  BIT(1)
+#defineTPS6507X_CON_CTRL1_LDO2_ENABLE  BIT(0)
+
+/* DEFDCDC1 bitfields */
+#define TPS6507X_DEFDCDC1_DCDC1_EXT_ADJ_EN BIT(7)
+#define TPS6507X_DEFDCDC1_DCDC1_MASK   0X3F
+
+/* DEFDCDC2_LOW bitfields */
+#define TPS6507X_DEFDCDC2_LOW_DCDC2_MASK   0X3F
+
+/* DEFDCDC2_HIGH bitfields */
+#define TPS6507X_DEFDCDC2_HIGH_DCDC2_MASK  0X3F
+
+/* DEFDCDC3_LOW bitfields */
+#define TPS6507X_DEFDCDC3_LOW_DCDC3_MASK   0X3F
+
+/* DEFDCDC3_HIGH bitfields */
+#define TPS6507X_DEFDCDC3_HIGH_DCDC3_MASK  0X3F
+
+/* TPS6507X_REG_LDO_CTRL1 bitfields */
+#define TPS6507X_REG_LDO_CTRL1_LDO1_MASK   0X0F
+
+/* TPS6507X_REG_DEFLDO2 bitfields */
+#define TPS6507X_REG_DEFLDO2_LDO2_MASK 0X3F
+
+/* VDCDC MASK */
+#define TPS6507X_DEFDCDCX_DCDC_MASK0X3F
+
+/* DCDC's */
+#define TPS6507X_DCDC_10
+#define TPS6507X_DCDC_21
+#define TPS6507X_DCDC_32
+/* LDOs */
+#define TPS6507X_LDO_1 3
+#define TPS6507X_LDO_2 4
+
+#define TPS6507X_MAX_REG_IDTPS6507X_LDO_2
+
+/* Number of step-down converters available */
+#define TPS6507X_NUM_DCDC  3
+/* Number of LDO voltage regulators  available */
+#define TPS6507X_NUM_LDO   2
+/* Number of total regulators available */
+#define TPS6507X_NUM_REGULATOR (TPS6507X_NUM_DCDC + TPS6507X_NUM_LDO)
+
+/* Supported voltage values for regulators (in milliVolts) */
+static const u16 VDCDCx_VSEL_table[] = {
+   725, 750, 775, 800,
+   825, 850, 875, 900,
+   925, 950, 975, 1000,
+   1025, 1050, 1075, 1100,
+   1125, 1

[PATCHv3 3/3] Regulator: Adding TPS65023 and TPS6507x in Kconfig and Makefile

2009-08-20 Thread Anuj Aggarwal
Adding TPS65023 and TPS6507x regulator driver support in
drivers/regulator/Makefile and drivers/regulator/Kconfig

Signed-off-by: Anuj Aggarwal 
---
 drivers/regulator/Kconfig  |   16 
 drivers/regulator/Makefile |3 +++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index f431779..8568f3e 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -117,4 +117,20 @@ config REGULATOR_LP3971
 Say Y here to support the voltage regulators and convertors
 on National Semiconductors LP3971 PMIC
 
+config REGULATOR_TPS65023
+   tristate "TI TPS65023 Power regulators"
+   depends on I2C
+   help
+ This driver supports TPS65023 voltage regulator chips. TPS65023 
provides
+ three step-down converters and two general-purpose LDO voltage 
regulators.
+ It supports TI's software based Class-2 SmartReflex implementation.
+
+config REGULATOR_TPS6507X
+   tristate "TI TPS6507X Power regulators"
+   depends on I2C
+   help
+ This driver supports TPS6507X voltage regulator chips. TPS6507X 
provides
+ three step-down converters and two general-purpose LDO voltage 
regulators.
+ It supports TI's software based Class-2 SmartReflex implementation.
+
 endif
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 4d762c4..5263913 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -17,4 +17,7 @@ obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o
 obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
 obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o
 
+obj-$(CONFIG_REGULATOR_TPS65023) += tps65023-regulator.o
+obj-$(CONFIG_REGULATOR_TPS6507X) += tps6507x-regulator.o
+
 ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv3 1/3] Regulator: Add TPS65023 regulator driver

2009-08-20 Thread Anuj Aggarwal
Adding support for TI TPS65023 regulator driver

Signed-off-by: Anuj Aggarwal 
---
 drivers/regulator/tps65023-regulator.c |  631 
 1 files changed, 631 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/tps65023-regulator.c

diff --git a/drivers/regulator/tps65023-regulator.c 
b/drivers/regulator/tps65023-regulator.c
new file mode 100644
index 000..1e54f46
--- /dev/null
+++ b/drivers/regulator/tps65023-regulator.c
@@ -0,0 +1,631 @@
+/*
+ * tps65023-regulator.c
+ *
+ * Supports TPS65023 Regulator
+ *
+ * Copyright (C) 2009 Texas Instrument Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Register definitions */
+#defineTPS65023_REG_VERSION0
+#defineTPS65023_REG_PGOODZ 1
+#defineTPS65023_REG_MASK   2
+#defineTPS65023_REG_REG_CTRL   3
+#defineTPS65023_REG_CON_CTRL   4
+#defineTPS65023_REG_CON_CTRL2  5
+#defineTPS65023_REG_DEF_CORE   6
+#defineTPS65023_REG_DEFSLEW7
+#defineTPS65023_REG_LDO_CTRL   8
+
+/* PGOODZ bitfields */
+#defineTPS65023_PGOODZ_PWRFAILZBIT(7)
+#defineTPS65023_PGOODZ_LOWBATTZBIT(6)
+#defineTPS65023_PGOODZ_VDCDC1  BIT(5)
+#defineTPS65023_PGOODZ_VDCDC2  BIT(4)
+#defineTPS65023_PGOODZ_VDCDC3  BIT(3)
+#defineTPS65023_PGOODZ_LDO2BIT(2)
+#defineTPS65023_PGOODZ_LDO1BIT(1)
+
+/* MASK bitfields */
+#defineTPS65023_MASK_PWRFAILZ  BIT(7)
+#defineTPS65023_MASK_LOWBATTZ  BIT(6)
+#defineTPS65023_MASK_VDCDC1BIT(5)
+#defineTPS65023_MASK_VDCDC2BIT(4)
+#defineTPS65023_MASK_VDCDC3BIT(3)
+#defineTPS65023_MASK_LDO2  BIT(2)
+#defineTPS65023_MASK_LDO1  BIT(1)
+
+/* REG_CTRL bitfields */
+#define TPS65023_REG_CTRL_VDCDC1_ENBIT(5)
+#define TPS65023_REG_CTRL_VDCDC2_ENBIT(4)
+#define TPS65023_REG_CTRL_VDCDC3_ENBIT(3)
+#define TPS65023_REG_CTRL_LDO2_EN  BIT(2)
+#define TPS65023_REG_CTRL_LDO1_EN  BIT(1)
+
+/* LDO_CTRL bitfields */
+#define TPS65023_LDO_CTRL_LDOx_SHIFT(ldo_id)   ((ldo_id)*4)
+#define TPS65023_LDO_CTRL_LDOx_MASK(ldo_id)(0xF0 >> ((ldo_id)*4))
+
+/* Number of step-down converters available */
+#define TPS65023_NUM_DCDC  3
+/* Number of LDO voltage regulators  available */
+#define TPS65023_NUM_LDO   2
+/* Number of total regulators available */
+#define TPS65023_NUM_REGULATOR (TPS65023_NUM_DCDC + TPS65023_NUM_LDO)
+
+/* DCDCs */
+#define TPS65023_DCDC_10
+#define TPS65023_DCDC_21
+#define TPS65023_DCDC_32
+/* LDOs */
+#define TPS65023_LDO_1 3
+#define TPS65023_LDO_2 4
+
+#define TPS65023_MAX_REG_IDTPS65023_LDO_2
+
+/* Supported voltage values for regulators */
+static const u16 VDCDC1_VSEL_table[] = {
+   800, 825, 850, 875,
+   900, 925, 950, 975,
+   1000, 1025, 1050, 1075,
+   1100, 1125, 1150, 1175,
+   1200, 1225, 1250, 1275,
+   1300, 1325, 1350, 1375,
+   1400, 1425, 1450, 1475,
+   1500, 1525, 1550, 1600,
+};
+
+static const u16 LDO1_VSEL_table[] = {
+   1000, 1100, 1300, 1800,
+   2200, 2600, 2800, 3150,
+};
+
+static const u16 LDO2_VSEL_table[] = {
+   1050, 1200, 1300, 1800,
+   2500, 2800, 3000, 3300,
+};
+
+static unsigned int num_voltages[] = {ARRAY_SIZE(VDCDC1_VSEL_table),
+   0, 0, ARRAY_SIZE(LDO1_VSEL_table),
+   ARRAY_SIZE(LDO2_VSEL_table)};
+
+/* Regulator specific details */
+struct tps_info {
+   const char *name;
+   unsigned min_uV;
+   unsigned max_uV;
+   bool fixed;
+   u8 table_len;
+   const u16 *table;
+};
+
+/* PMIC details */
+struct tps_pmic {
+   struct regulator_desc desc[TPS65023_NUM_REGULATOR];
+   struct i2c_client *client;
+   struct regulator_dev *rdev[TPS65023_NUM_REGULATOR];
+   const struct tps_info *info[TPS65023_NUM_REGULATOR];
+   struct mutex io_lock;
+};
+
+static inline int tps_65023_read(struct tps_pmic *tps, u8 reg)
+{
+   return i2c_smbus_read_byte_data(tps->client, reg);
+}
+
+static inline int tps_65023_write(struct tps_pmic *

[PATCHv2 3/3] Regulator: Adding TPS65023 and TPS6507x in Kconfig and Makefile

2009-08-20 Thread Anuj Aggarwal
Adding TPS65023 and TPS6507x regulator driver support in
drivers/regulator/Makefile and drivers/regulator/Kconfig
---
 drivers/regulator/Kconfig  |   16 
 drivers/regulator/Makefile |3 +++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index f431779..8568f3e 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -117,4 +117,20 @@ config REGULATOR_LP3971
 Say Y here to support the voltage regulators and convertors
 on National Semiconductors LP3971 PMIC
 
+config REGULATOR_TPS65023
+   tristate "TI TPS65023 Power regulators"
+   depends on I2C
+   help
+ This driver supports TPS65023 voltage regulator chips. TPS65023 
provides
+ three step-down converters and two general-purpose LDO voltage 
regulators.
+ It supports TI's software based Class-2 SmartReflex implementation.
+
+config REGULATOR_TPS6507X
+   tristate "TI TPS6507X Power regulators"
+   depends on I2C
+   help
+ This driver supports TPS6507X voltage regulator chips. TPS6507X 
provides
+ three step-down converters and two general-purpose LDO voltage 
regulators.
+ It supports TI's software based Class-2 SmartReflex implementation.
+
 endif
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 4d762c4..5263913 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -17,4 +17,7 @@ obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o
 obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
 obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o
 
+obj-$(CONFIG_REGULATOR_TPS65023) += tps65023-regulator.o
+obj-$(CONFIG_REGULATOR_TPS6507X) += tps6507x-regulator.o
+
 ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv2 2/3] Regulator: Add TPS6507x regulator driver

2009-08-20 Thread Anuj Aggarwal
Adding support for TI TPS6507x regulator driver
---
 drivers/regulator/tps6507x-regulator.c |  713 
 1 files changed, 713 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/tps6507x-regulator.c

diff --git a/drivers/regulator/tps6507x-regulator.c 
b/drivers/regulator/tps6507x-regulator.c
new file mode 100644
index 000..6d7a815
--- /dev/null
+++ b/drivers/regulator/tps6507x-regulator.c
@@ -0,0 +1,713 @@
+/*
+ * tps6507x-regulator.c
+ *
+ * Regulator driver for TPS65073 PMIC
+ *
+ * Copyright (C) 2009 Texas Instrument Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Register definitions */
+#defineTPS6507X_REG_PPATH1 0X01
+#defineTPS6507X_REG_INT0X02
+#defineTPS6507X_REG_CHGCONFIG0 0X03
+#defineTPS6507X_REG_CHGCONFIG1 0X04
+#defineTPS6507X_REG_CHGCONFIG2 0X05
+#defineTPS6507X_REG_CHGCONFIG3 0X06
+#defineTPS6507X_REG_REG_ADCONFIG   0X07
+#defineTPS6507X_REG_TSCMODE0X08
+#defineTPS6507X_REG_ADRESULT_1 0X09
+#defineTPS6507X_REG_ADRESULT_2 0X0A
+#defineTPS6507X_REG_PGOOD  0X0B
+#defineTPS6507X_REG_PGOODMASK  0X0C
+#defineTPS6507X_REG_CON_CTRL1  0X0D
+#defineTPS6507X_REG_CON_CTRL2  0X0E
+#defineTPS6507X_REG_CON_CTRL3  0X0F
+#defineTPS6507X_REG_DEFDCDC1   0X10
+#defineTPS6507X_REG_DEFDCDC2_LOW   0X11
+#defineTPS6507X_REG_DEFDCDC2_HIGH  0X12
+#defineTPS6507X_REG_DEFDCDC3_LOW   0X13
+#defineTPS6507X_REG_DEFDCDC3_HIGH  0X14
+#defineTPS6507X_REG_DEFSLEW0X15
+#defineTPS6507X_REG_LDO_CTRL1  0X16
+#defineTPS6507X_REG_DEFLDO20X17
+#defineTPS6507X_REG_WLED_CTRL1 0X18
+#defineTPS6507X_REG_WLED_CTRL2 0X19
+
+/* CON_CTRL1 bitfields */
+#defineTPS6507X_CON_CTRL1_DCDC1_ENABLE BIT(4)
+#defineTPS6507X_CON_CTRL1_DCDC2_ENABLE BIT(3)
+#defineTPS6507X_CON_CTRL1_DCDC3_ENABLE BIT(2)
+#defineTPS6507X_CON_CTRL1_LDO1_ENABLE  BIT(1)
+#defineTPS6507X_CON_CTRL1_LDO2_ENABLE  BIT(0)
+
+/* DEFDCDC1 bitfields */
+#define TPS6507X_DEFDCDC1_DCDC1_EXT_ADJ_EN BIT(7)
+#define TPS6507X_DEFDCDC1_DCDC1_MASK   0X3F
+
+/* DEFDCDC2_LOW bitfields */
+#define TPS6507X_DEFDCDC2_LOW_DCDC2_MASK   0X3F
+
+/* DEFDCDC2_HIGH bitfields */
+#define TPS6507X_DEFDCDC2_HIGH_DCDC2_MASK  0X3F
+
+/* DEFDCDC3_LOW bitfields */
+#define TPS6507X_DEFDCDC3_LOW_DCDC3_MASK   0X3F
+
+/* DEFDCDC3_HIGH bitfields */
+#define TPS6507X_DEFDCDC3_HIGH_DCDC3_MASK  0X3F
+
+/* TPS6507X_REG_LDO_CTRL1 bitfields */
+#define TPS6507X_REG_LDO_CTRL1_LDO1_MASK   0X0F
+
+/* TPS6507X_REG_DEFLDO2 bitfields */
+#define TPS6507X_REG_DEFLDO2_LDO2_MASK 0X3F
+
+/* VDCDC MASK */
+#define TPS6507X_DEFDCDCX_DCDC_MASK0X3F
+
+/* DCDC's */
+#define TPS6507X_DCDC_10
+#define TPS6507X_DCDC_21
+#define TPS6507X_DCDC_32
+/* LDOs */
+#define TPS6507X_LDO_1 3
+#define TPS6507X_LDO_2 4
+
+#define TPS6507X_MAX_REG_IDTPS6507X_LDO_2
+
+/* Number of step-down converters available */
+#define TPS6507X_NUM_DCDC  3
+/* Number of LDO voltage regulators  available */
+#define TPS6507X_NUM_LDO   2
+/* Number of total regulators available */
+#define TPS6507X_NUM_REGULATOR (TPS6507X_NUM_DCDC + TPS6507X_NUM_LDO)
+
+/* Supported voltage values for regulators (in milliVolts) */
+static const u16 VDCDCx_VSEL_table[] = {
+   725, 750, 775, 800,
+   825, 850, 875, 900,
+   925, 950, 975, 1000,
+   1025, 1050, 1075, 1100,
+   1125, 1150, 1175, 1200,
+   1225, 1250, 1275, 1300,
+   132

[PATCHv2 1/3] Regulator: Add TPS65023 regulator driver

2009-08-20 Thread Anuj Aggarwal
Adding support for TI TPS65023 regulator driver
---
 drivers/regulator/tps65023-regulator.c |  631 
 1 files changed, 631 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/tps65023-regulator.c

diff --git a/drivers/regulator/tps65023-regulator.c 
b/drivers/regulator/tps65023-regulator.c
new file mode 100644
index 000..1e54f46
--- /dev/null
+++ b/drivers/regulator/tps65023-regulator.c
@@ -0,0 +1,631 @@
+/*
+ * tps65023-regulator.c
+ *
+ * Supports TPS65023 Regulator
+ *
+ * Copyright (C) 2009 Texas Instrument Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Register definitions */
+#defineTPS65023_REG_VERSION0
+#defineTPS65023_REG_PGOODZ 1
+#defineTPS65023_REG_MASK   2
+#defineTPS65023_REG_REG_CTRL   3
+#defineTPS65023_REG_CON_CTRL   4
+#defineTPS65023_REG_CON_CTRL2  5
+#defineTPS65023_REG_DEF_CORE   6
+#defineTPS65023_REG_DEFSLEW7
+#defineTPS65023_REG_LDO_CTRL   8
+
+/* PGOODZ bitfields */
+#defineTPS65023_PGOODZ_PWRFAILZBIT(7)
+#defineTPS65023_PGOODZ_LOWBATTZBIT(6)
+#defineTPS65023_PGOODZ_VDCDC1  BIT(5)
+#defineTPS65023_PGOODZ_VDCDC2  BIT(4)
+#defineTPS65023_PGOODZ_VDCDC3  BIT(3)
+#defineTPS65023_PGOODZ_LDO2BIT(2)
+#defineTPS65023_PGOODZ_LDO1BIT(1)
+
+/* MASK bitfields */
+#defineTPS65023_MASK_PWRFAILZ  BIT(7)
+#defineTPS65023_MASK_LOWBATTZ  BIT(6)
+#defineTPS65023_MASK_VDCDC1BIT(5)
+#defineTPS65023_MASK_VDCDC2BIT(4)
+#defineTPS65023_MASK_VDCDC3BIT(3)
+#defineTPS65023_MASK_LDO2  BIT(2)
+#defineTPS65023_MASK_LDO1  BIT(1)
+
+/* REG_CTRL bitfields */
+#define TPS65023_REG_CTRL_VDCDC1_ENBIT(5)
+#define TPS65023_REG_CTRL_VDCDC2_ENBIT(4)
+#define TPS65023_REG_CTRL_VDCDC3_ENBIT(3)
+#define TPS65023_REG_CTRL_LDO2_EN  BIT(2)
+#define TPS65023_REG_CTRL_LDO1_EN  BIT(1)
+
+/* LDO_CTRL bitfields */
+#define TPS65023_LDO_CTRL_LDOx_SHIFT(ldo_id)   ((ldo_id)*4)
+#define TPS65023_LDO_CTRL_LDOx_MASK(ldo_id)(0xF0 >> ((ldo_id)*4))
+
+/* Number of step-down converters available */
+#define TPS65023_NUM_DCDC  3
+/* Number of LDO voltage regulators  available */
+#define TPS65023_NUM_LDO   2
+/* Number of total regulators available */
+#define TPS65023_NUM_REGULATOR (TPS65023_NUM_DCDC + TPS65023_NUM_LDO)
+
+/* DCDCs */
+#define TPS65023_DCDC_10
+#define TPS65023_DCDC_21
+#define TPS65023_DCDC_32
+/* LDOs */
+#define TPS65023_LDO_1 3
+#define TPS65023_LDO_2 4
+
+#define TPS65023_MAX_REG_IDTPS65023_LDO_2
+
+/* Supported voltage values for regulators */
+static const u16 VDCDC1_VSEL_table[] = {
+   800, 825, 850, 875,
+   900, 925, 950, 975,
+   1000, 1025, 1050, 1075,
+   1100, 1125, 1150, 1175,
+   1200, 1225, 1250, 1275,
+   1300, 1325, 1350, 1375,
+   1400, 1425, 1450, 1475,
+   1500, 1525, 1550, 1600,
+};
+
+static const u16 LDO1_VSEL_table[] = {
+   1000, 1100, 1300, 1800,
+   2200, 2600, 2800, 3150,
+};
+
+static const u16 LDO2_VSEL_table[] = {
+   1050, 1200, 1300, 1800,
+   2500, 2800, 3000, 3300,
+};
+
+static unsigned int num_voltages[] = {ARRAY_SIZE(VDCDC1_VSEL_table),
+   0, 0, ARRAY_SIZE(LDO1_VSEL_table),
+   ARRAY_SIZE(LDO2_VSEL_table)};
+
+/* Regulator specific details */
+struct tps_info {
+   const char *name;
+   unsigned min_uV;
+   unsigned max_uV;
+   bool fixed;
+   u8 table_len;
+   const u16 *table;
+};
+
+/* PMIC details */
+struct tps_pmic {
+   struct regulator_desc desc[TPS65023_NUM_REGULATOR];
+   struct i2c_client *client;
+   struct regulator_dev *rdev[TPS65023_NUM_REGULATOR];
+   const struct tps_info *info[TPS65023_NUM_REGULATOR];
+   struct mutex io_lock;
+};
+
+static inline int tps_65023_read(struct tps_pmic *tps, u8 reg)
+{
+   return i2c_smbus_read_byte_data(tps->client, reg);
+}
+
+static inline int tps_65023_write(struct tps_pmic *tps, u8 reg, u8 val)
+{
+   return i2c_smbus_wr

[PATCHv2 0/3] Adding TI TPS PMICs support in the regulator framework

2009-08-20 Thread Anuj Aggarwal
This patch set adds support for TI TPS65023 and TPS6507x PMICs in the voltage
regulator framework. The patches also take care of the comments received
earlier.

Anuj Aggarwal (3):
  Regulator: Add TPS65023 regulator driver
  Regulator: Add TPS6507x regulator driver
  Regulator: Adding TPS65023 and TPS6507x in Kconfig and Makefile

 drivers/regulator/Kconfig  |   16 +
 drivers/regulator/Makefile |3 +
 drivers/regulator/tps65023-regulator.c |  631 
 drivers/regulator/tps6507x-regulator.c |  713 
 4 files changed, 1363 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/tps65023-regulator.c
 create mode 100644 drivers/regulator/tps6507x-regulator.c

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv2 1/8] Regulator: Add TPS65023 regulator driver

2009-08-11 Thread Anuj Aggarwal
Adding support for TI TPS65023 regulator driver

Signed-off-by: Anuj Aggarwal 
---
 drivers/regulator/tps65023-regulator.c |  638 
 1 files changed, 638 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/tps65023-regulator.c

diff --git a/drivers/regulator/tps65023-regulator.c 
b/drivers/regulator/tps65023-regulator.c
new file mode 100644
index 000..dbaf295
--- /dev/null
+++ b/drivers/regulator/tps65023-regulator.c
@@ -0,0 +1,638 @@
+/*
+ * tps65023-regulator.c
+ *
+ * Supports TPS65023 Regulator
+ *
+ * Copyright (C) 2009 Texas Instrument Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Register definitions */
+#defineTPS65023_REG_VERSION0
+#defineTPS65023_REG_PGOODZ 1
+#defineTPS65023_REG_MASK   2
+#defineTPS65023_REG_REG_CTRL   3
+#defineTPS65023_REG_CON_CTRL   4
+#defineTPS65023_REG_CON_CTRL2  5
+#defineTPS65023_REG_DEF_CORE   6
+#defineTPS65023_REG_DEFSLEW7
+#defineTPS65023_REG_LDO_CTRL   8
+
+/* PGOODZ bitfields */
+#defineTPS65023_PGOODZ_PWRFAILZBIT(7)
+#defineTPS65023_PGOODZ_LOWBATTZBIT(6)
+#defineTPS65023_PGOODZ_VDCDC1  BIT(5)
+#defineTPS65023_PGOODZ_VDCDC2  BIT(4)
+#defineTPS65023_PGOODZ_VDCDC3  BIT(3)
+#defineTPS65023_PGOODZ_LDO2BIT(2)
+#defineTPS65023_PGOODZ_LDO1BIT(1)
+
+/* MASK bitfields */
+#defineTPS65023_MASK_PWRFAILZ  BIT(7)
+#defineTPS65023_MASK_LOWBATTZ  BIT(6)
+#defineTPS65023_MASK_VDCDC1BIT(5)
+#defineTPS65023_MASK_VDCDC2BIT(4)
+#defineTPS65023_MASK_VDCDC3BIT(3)
+#defineTPS65023_MASK_LDO2  BIT(2)
+#defineTPS65023_MASK_LDO1  BIT(1)
+
+/* REG_CTRL bitfields */
+#define TPS65023_REG_CTRL_VDCDC1_ENBIT(5)
+#define TPS65023_REG_CTRL_VDCDC2_ENBIT(4)
+#define TPS65023_REG_CTRL_VDCDC3_ENBIT(3)
+#define TPS65023_REG_CTRL_LDO2_EN  BIT(2)
+#define TPS65023_REG_CTRL_LDO1_EN  BIT(1)
+
+/* LDO_CTRL bitfields */
+#define TPS65023_LDO_CTRL_LDOx_SHIFT(ldo_id)   ((ldo_id)*4)
+#define TPS65023_LDO_CTRL_LDOx_MASK(ldo_id)(0xF0 >> ((ldo_id)*4))
+
+/* Number of step-down converters available */
+#define TPS65023_NUM_DCDC  3
+/* Number of LDO voltage regulators  available */
+#define TPS65023_NUM_LDO   2
+/* Number of total regulators available */
+#define TPS65023_NUM_REGULATOR (TPS65023_NUM_DCDC + TPS65023_NUM_LDO)
+
+/* DCDCs */
+#define TPS65023_DCDC_10
+#define TPS65023_DCDC_21
+#define TPS65023_DCDC_32
+/* LDOs */
+#define TPS65023_LDO_1 3
+#define TPS65023_LDO_2 4
+
+#define TPS65023_MAX_REG_IDTPS65023_LDO_2
+
+/* Supported voltage values for regulators */
+static const u16 VDCDC1_VSEL_table[] = {
+   800, 825, 850, 875,
+   900, 925, 950, 975,
+   1000, 1025, 1050, 1075,
+   1100, 1125, 1150, 1175,
+   1200, 1225, 1250, 1275,
+   1300, 1325, 1350, 1375,
+   1400, 1425, 1450, 1475,
+   1500, 1525, 1550, 1600,
+};
+
+static const u16 LDO1_VSEL_table[] = {
+   1000, 1100, 1300, 1800,
+   2200, 2600, 2800, 3150,
+};
+
+static const u16 LDO2_VSEL_table[] = {
+   1050, 1200, 1300, 1800,
+   2500, 2800, 3000, 3300,
+};
+
+static unsigned int num_voltages[] = {ARRAY_SIZE(VDCDC1_VSEL_table),
+   0, 0, ARRAY_SIZE(LDO1_VSEL_table),
+   ARRAY_SIZE(LDO2_VSEL_table)};
+
+/* Regulator specific details */
+struct tps_info {
+   const char *name;
+   unsigned min_uV;
+   unsigned max_uV;
+   bool fixed;
+   u8 table_len;
+   const u16 *table;
+};
+
+/* PMIC details */
+struct tps_pmic {
+   struct regulator_desc desc[TPS65023_NUM_REGULATOR];
+   struct i2c_client *client;
+   struct regulator_dev *rdev[TPS65023_NUM_REGULATOR];
+   const struct tps_info *info[TPS65023_NUM_REGULATOR];
+   struct mutex io_lock;
+};
+
+static inline int tps_65023_read(struct tps_pmic *tps, u8 reg)
+{
+   return i2c_smbus_read_byte_data(tps->client, reg);
+}
+
+static inline int tps_65023_write(struct tps_pmic *

[PATCH 8/8] Regulator: Added board-dependent code for TPS65073

2009-08-07 Thread Anuj Aggarwal
Added OMAP35x specific code for TPS65073 in board-omap35x-pmic.c

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/board-omap35x-pmic.c |   95 +-
 1 files changed, 94 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap35x-pmic.c 
b/arch/arm/mach-omap2/board-omap35x-pmic.c
index 0bf47fd..2c33965 100644
--- a/arch/arm/mach-omap2/board-omap35x-pmic.c
+++ b/arch/arm/mach-omap2/board-omap35x-pmic.c
@@ -124,6 +124,98 @@ static struct i2c_board_info __initdata 
board_tps65023_instances[] = {
 /*
  * Definitions specific to TPS65073
  */
+#if defined(CONFIG_OMAP3EVM_TPS65073)
+/* MPU voltage regulator of DCDC type */
+struct regulator_consumer_supply tps65073_mpu_consumers = {
+   .supply = "vdd1",
+};
+
+/* CORE voltage regulator of DCDC type */
+struct regulator_consumer_supply tps65073_core_consumers = {
+   .supply = "vdd2",
+};
+
+/* SRAM/MEM/WKUP_BG/VDDS voltage regulator of DCDC type */
+struct regulator_consumer_supply tps65073_vdds_consumers = {
+   .supply = "vdds",
+};
+
+/* DPLL voltage regulator of LDO type */
+struct regulator_consumer_supply tps65073_dpll_consumers = {
+   .supply = "dpll",
+};
+
+/* MMC voltage regulator of LDO type */
+struct regulator_consumer_supply tps65073_mmc_consumers = {
+   .supply = "mmc",
+};
+
+struct regulator_init_data tps65073_regulator_data[] = {
+   {
+   .constraints = {
+   .min_uV = 725000,
+   .max_uV = 330,
+   .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
+   REGULATOR_CHANGE_STATUS),
+   .boot_on = 1,
+   },
+   .num_consumer_supplies = 1,
+   .consumer_supplies = &tps65073_vdds_consumers,
+   },
+   {
+   .constraints = {
+   .min_uV = 725000,
+   .max_uV = 330,
+   .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
+   REGULATOR_CHANGE_STATUS),
+   .boot_on = 1,
+   },
+   .num_consumer_supplies = 1,
+   .consumer_supplies = &tps65073_core_consumers,
+   },
+   {
+   .constraints = {
+   .min_uV = 725000,
+   .max_uV = 330,
+   .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
+   REGULATOR_CHANGE_STATUS),
+   .boot_on = 1,
+   },
+   .num_consumer_supplies = 1,
+   .consumer_supplies = &tps65073_mpu_consumers,
+   },
+   {
+   .constraints = {
+   .min_uV = 100,
+   .max_uV = 330,
+   .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
+   REGULATOR_CHANGE_STATUS),
+   .boot_on = 1,
+   },
+   .num_consumer_supplies = 1,
+   .consumer_supplies = &tps65073_dpll_consumers,
+   },
+   {
+   .constraints = {
+   .min_uV = 725000,
+   .max_uV = 330,
+   .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
+   REGULATOR_CHANGE_STATUS),
+   .boot_on = 1,
+   },
+   .num_consumer_supplies = 1,
+   .consumer_supplies = &tps65073_mmc_consumers,
+   },
+};
+
+static struct i2c_board_info __initdata board_tps65073_instances[] = {
+   {
+   I2C_BOARD_INFO("tps6507x", 0x48),
+   .flags = I2C_CLIENT_WAKE,
+   .platform_data = &tps65073_regulator_data[0],
+   },
+};
+#endif
 
 static int flag_pmic_twl4030;
 static int flag_pmic_tps6235x;
@@ -204,7 +296,8 @@ int oma35x_pmic_init(void)
 #endif
 
 #if defined(CONFIG_OMAP3EVM_TPS65073)
-   /* do stuff specific to TPS65073 */
+   omap_register_i2c_bus(1, 400, board_tps65073_instances,
+   ARRAY_SIZE(board_tps65073_instances));
 #endif
 
return 0;
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/8] Regulator: Added board-dependent code for TPS65023

2009-08-07 Thread Anuj Aggarwal
Added OMAP35x specific code for TPS65023 in board-omap35x-pmic.c

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/board-omap35x-pmic.c |   93 +-
 1 files changed, 92 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap35x-pmic.c 
b/arch/arm/mach-omap2/board-omap35x-pmic.c
index 11db66f..0bf47fd 100644
--- a/arch/arm/mach-omap2/board-omap35x-pmic.c
+++ b/arch/arm/mach-omap2/board-omap35x-pmic.c
@@ -30,6 +30,96 @@
 /*
  * Definitions specific to TPS65023
  */
+#if defined(CONFIG_OMAP3EVM_TPS65023)
+/* MPU voltage regulator of DCDC type */
+struct regulator_consumer_supply tps65023_mpu_consumers = {
+   .supply = "vdd1",
+};
+
+/* CORE voltage regulator of DCDC type */
+struct regulator_consumer_supply tps65023_core_consumers = {
+   .supply = "vdd2",
+};
+
+/* SRAM/MEM/WKUP_BG voltage regulator of DCDC type */
+struct regulator_consumer_supply tps65023_vdds_consumers = {
+   .supply = "vdds",
+};
+
+/* DPLL voltage regulator of LDO type */
+struct regulator_consumer_supply tps65023_dpll_consumers = {
+   .supply = "dpll",
+};
+
+/* MMC voltage regulator of LDO type */
+struct regulator_consumer_supply tps65023_mmc_consumers = {
+   .supply = "mmc",
+};
+
+struct regulator_init_data tps65023_regulator_data[] = {
+   {
+   .constraints = {
+   .min_uV = 80,
+   .max_uV = 160,
+   .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
+   REGULATOR_CHANGE_STATUS),
+   .boot_on = 1,
+   },
+   .num_consumer_supplies = 1,
+   .consumer_supplies = &tps65023_mpu_consumers,
+   },
+   {
+   .constraints = {
+   .min_uV = 180,
+   .max_uV = 330,
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   .boot_on = 1,
+   },
+   .num_consumer_supplies = 1,
+   .consumer_supplies = &tps65023_core_consumers,
+   },
+   {
+   .constraints = {
+   .min_uV = 180,
+   .max_uV = 330,
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   .boot_on = 1,
+   },
+   .num_consumer_supplies = 1,
+   .consumer_supplies = &tps65023_vdds_consumers,
+   },
+   {
+   .constraints = {
+   .min_uV = 100,
+   .max_uV = 315,
+   .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
+   REGULATOR_CHANGE_STATUS),
+   .boot_on = 1,
+   },
+   .num_consumer_supplies = 1,
+   .consumer_supplies = &tps65023_dpll_consumers,
+   },
+   {
+   .constraints = {
+   .min_uV = 105,
+   .max_uV = 330,
+   .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
+   REGULATOR_CHANGE_STATUS),
+   .boot_on = 1,
+   },
+   .num_consumer_supplies = 1,
+   .consumer_supplies = &tps65023_mmc_consumers,
+   },
+};
+
+static struct i2c_board_info __initdata board_tps65023_instances[] = {
+   {
+   I2C_BOARD_INFO("tps65023", 0x48),
+   .flags = I2C_CLIENT_WAKE,
+   .platform_data = &tps65023_regulator_data[0],
+   },
+};
+#endif
 
 /*
  * Definitions specific to TPS65073
@@ -109,7 +199,8 @@ int oma35x_pmic_init(void)
 #endif
 
 #if defined(CONFIG_OMAP3EVM_TPS65023)
-   /* do stuff specific to TPS65023 */
+   omap_register_i2c_bus(1, 400, board_tps65023_instances,
+   ARRAY_SIZE(board_tps65023_instances));
 #endif
 
 #if defined(CONFIG_OMAP3EVM_TPS65073)
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/8] Regulator: Add board-omap35x-pmic.c to arch/arm/mach-omap2/

2009-08-07 Thread Anuj Aggarwal
Added arch/arm/mach-omap2/board-omap35x-pmic.c file which will
have the board specific information for different regulators
and will do the regulator initialization depending on the one
which is available.

Signed-off-by: Anuj Aggarwal 
---
 arch/arm/mach-omap2/board-omap35x-pmic.c |  121 ++
 1 files changed, 121 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/board-omap35x-pmic.c

diff --git a/arch/arm/mach-omap2/board-omap35x-pmic.c 
b/arch/arm/mach-omap2/board-omap35x-pmic.c
new file mode 100644
index 000..11db66f
--- /dev/null
+++ b/arch/arm/mach-omap2/board-omap35x-pmic.c
@@ -0,0 +1,121 @@
+/*
+ * board-omap35x-pmic.c
+ *
+ * Board specific information for different regulators and platforms.
+ *
+ * Copyright (C) 2009 Texas Instrument Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+
+/*
+ * Definitions specific to TWL4030
+ */
+
+/*
+ * Definitions specific to TPS6235x
+ */
+
+/*
+ * Definitions specific to TPS65023
+ */
+
+/*
+ * Definitions specific to TPS65073
+ */
+
+static int flag_pmic_twl4030;
+static int flag_pmic_tps6235x;
+static int flag_pmic_tps65023;
+static int flag_pmic_tps65073;
+
+/*
+ * Detect the current PMIC, set one of the flags
+ */
+static inline int detect_pmic(void)
+{
+#if defined(CONFIG_TWL4030_CORE)
+   flag_pmic_twl4030 = 1;
+#endif
+
+#if defined(CONFIG_OMAP3EVM_TPS6235X)
+   flag_pmic_tps6235x = 1;
+#endif
+
+#if defined(CONFIG_OMAP3EVM_TPS65023)
+   flag_pmic_tps65023 = 1;
+#endif
+
+#if defined(CONFIG_OMAP3EVM_TPS65073)
+   flag_pmic_tps65073 = 1;
+#endif
+
+   return 0;
+}
+
+/* Functions to detect which PMIC is present */
+
+int pmic_is_twl4030(void)
+{
+   return flag_pmic_twl4030;
+}
+
+int pmic_is_tps6235x(void)
+{
+   return flag_pmic_tps6235x;
+}
+
+int pmic_is_tps65020(void) { return 0; }
+
+int pmic_is_tps65021(void) { return 0; }
+
+int pmic_is_tps65022(void) { return 0; }
+
+int pmic_is_tps65023(void)
+{
+   return flag_pmic_tps65023;
+}
+
+int pmic_is_tps65073(void)
+{
+   return flag_pmic_tps65073;
+}
+
+int pmic_is_tps65950(void)
+{
+   return flag_pmic_twl4030;
+}
+
+/* Detects the PMIC and initializes it accordingly */
+int oma35x_pmic_init(void)
+{
+#if defined(CONFIG_TWL4030_CORE)
+   /* do stuff specific to TWL4030 */
+#endif
+
+#if defined(CONFIG_OMAP3EVM_TPS6235X)
+   /* do stuff specific to TPS62350 */
+#endif
+
+#if defined(CONFIG_OMAP3EVM_TPS65023)
+   /* do stuff specific to TPS65023 */
+#endif
+
+#if defined(CONFIG_OMAP3EVM_TPS65073)
+   /* do stuff specific to TPS65073 */
+#endif
+
+   return 0;
+}
+
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/8] Regulator: Adding TPS65023 and TPS6507x in Kconfig and Makefile

2009-08-07 Thread Anuj Aggarwal
Adding TPS65023 and TPS6507x regulator driver support in
drivers/regulator/Makefile and drivers/regulator/Kconfig

Signed-off-by: Anuj Aggarwal 
---
 drivers/regulator/Kconfig  |   16 
 drivers/regulator/Makefile |2 ++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index f431779..5f5b587 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -117,4 +117,20 @@ config REGULATOR_LP3971
 Say Y here to support the voltage regulators and convertors
 on National Semiconductors LP3971 PMIC
 
+config REGULATOR_TPS65023
+   tristate "TI TPS65023 Power regulators"
+   depends on OMAP3EVM_TPS65023
+   help
+ This driver supports TPS65023 voltage regulator chips. TPS65023 
provides
+ three step-down converters and two general-purpose LDO voltage 
regulators.
+ It supports TI's software based Class-2 SmartReflex implementation.
+
+config REGULATOR_TPS65073
+   tristate "TI TPS65073 Power regulators"
+   depends on OMAP3EVM_TPS65073
+   help
+ This driver supports TPS65073 voltage regulator chips. TPS65073 
provides
+ three step-down converters and two general-purpose LDO voltage 
regulators.
+ It supports TI's software based Class-2 SmartReflex implementation.
+
 endif
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 4d762c4..3863e3d 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -16,5 +16,7 @@ obj-$(CONFIG_REGULATOR_WM8350) += wm8350-regulator.o
 obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o
 obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
 obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o
+obj-$(CONFIG_REGULATOR_TPS65023) += tps65023-regulator.o
+obj-$(CONFIG_REGULATOR_TPS65073) += tps6507x-regulator.o
 
 ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/8] Regulator: Adding header file for TI TPS6507x regulator driver

2009-08-07 Thread Anuj Aggarwal

Signed-off-by: Anuj Aggarwal 
---
 include/linux/mfd/tps6507x.h |   93 ++
 1 files changed, 93 insertions(+), 0 deletions(-)
 create mode 100644 include/linux/mfd/tps6507x.h

diff --git a/include/linux/mfd/tps6507x.h b/include/linux/mfd/tps6507x.h
new file mode 100644
index 000..069b02a
--- /dev/null
+++ b/include/linux/mfd/tps6507x.h
@@ -0,0 +1,93 @@
+/*
+ * tps6507x.h
+ *
+ * Header file for TI TPS6507x Regulators
+ *
+ * Copyright (C) 2009 Texas Instrument Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+/* Register definitions */
+#defineTPS6507X_REG_PPATH1 0X01
+#defineTPS6507X_REG_INT0X02
+#defineTPS6507X_REG_CHGCONFIG0 0X03
+#defineTPS6507X_REG_CHGCONFIG1 0X04
+#defineTPS6507X_REG_CHGCONFIG2 0X05
+#defineTPS6507X_REG_CHGCONFIG3 0X06
+#defineTPS6507X_REG_REG_ADCONFIG   0X07
+#defineTPS6507X_REG_TSCMODE0X08
+#defineTPS6507X_REG_ADRESULT_1 0X09
+#defineTPS6507X_REG_ADRESULT_2 0X0A
+#defineTPS6507X_REG_PGOOD  0X0B
+#defineTPS6507X_REG_PGOODMASK  0X0C
+#defineTPS6507X_REG_CON_CTRL1  0X0D
+#defineTPS6507X_REG_CON_CTRL2  0X0E
+#defineTPS6507X_REG_CON_CTRL3  0X0F
+#defineTPS6507X_REG_DEFDCDC1   0X10
+#defineTPS6507X_REG_DEFDCDC2_LOW   0X11
+#defineTPS6507X_REG_DEFDCDC2_HIGH  0X12
+#defineTPS6507X_REG_DEFDCDC3_LOW   0X13
+#defineTPS6507X_REG_DEFDCDC3_HIGH  0X14
+#defineTPS6507X_REG_DEFSLEW0X15
+#defineTPS6507X_REG_LDO_CTRL1  0X16
+#defineTPS6507X_REG_DEFLDO20X17
+#defineTPS6507X_REG_WLED_CTRL1 0X18
+#defineTPS6507X_REG_WLED_CTRL2 0X19
+
+/* CON_CTRL1 bitfields */
+#defineTPS6507X_CON_CTRL1_DCDC1_ENABLE BIT(4)
+#defineTPS6507X_CON_CTRL1_DCDC2_ENABLE BIT(3)
+#defineTPS6507X_CON_CTRL1_DCDC3_ENABLE BIT(2)
+#defineTPS6507X_CON_CTRL1_LDO1_ENABLE  BIT(1)
+#defineTPS6507X_CON_CTRL1_LDO2_ENABLE  BIT(0)
+
+/* DEFDCDC1 bitfields */
+#define TPS6507X_DEFDCDC1_DCDC1_EXT_ADJ_EN BIT(7)
+#define TPS6507X_DEFDCDC1_DCDC1_MASK   0X3F
+
+/* DEFDCDC2_LOW bitfields */
+#define TPS6507X_DEFDCDC2_LOW_DCDC2_MASK   0X3F
+
+/* DEFDCDC2_HIGH bitfields */
+#define TPS6507X_DEFDCDC2_HIGH_DCDC2_MASK  0X3F
+
+/* DEFDCDC3_LOW bitfields */
+#define TPS6507X_DEFDCDC3_LOW_DCDC3_MASK   0X3F
+
+/* DEFDCDC3_HIGH bitfields */
+#define TPS6507X_DEFDCDC3_HIGH_DCDC3_MASK  0X3F
+
+/* TPS6507X_REG_LDO_CTRL1 bitfields */
+#define TPS6507X_REG_LDO_CTRL1_LDO1_MASK   0X0F
+
+/* TPS6507X_REG_DEFLDO2 bitfields */
+#define TPS6507X_REG_DEFLDO2_LDO2_MASK 0X3F
+
+/* VDCDC MASK */
+#define TPS6507X_DEFDCDCX_DCDC_MASK0X3F
+
+/* DCDC's */
+#define TPS6507X_DCDC_10
+#define TPS6507X_DCDC_21
+#define TPS6507X_DCDC_32
+/* LDOs */
+#define TPS6507X_LDO_1 3
+#define TPS6507X_LDO_2 4
+
+#define TPS6507X_MAX_REG_IDTPS6507X_LDO_2
+
+/* Number of step-down converters available */
+#define TPS6507X_NUM_DCDC  3
+/* Number of LDO voltage regulators  available */
+#define TPS6507X_NUM_LDO   2
+/* Number of total regulators available */
+#define TPS6507X_NUM_REGULATOR (TPS6507X_NUM_DCDC + TPS6507X_NUM_LDO)
+
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/8] Regulator: Add TPS6507x regulator driver

2009-08-07 Thread Anuj Aggarwal
Adding support for TI TPS6507x regulator driver

Signed-off-by: Anuj Aggarwal 
---
 drivers/regulator/tps6507x-regulator.c |  563 
 1 files changed, 563 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/tps6507x-regulator.c

diff --git a/drivers/regulator/tps6507x-regulator.c 
b/drivers/regulator/tps6507x-regulator.c
new file mode 100644
index 000..c5e319c
--- /dev/null
+++ b/drivers/regulator/tps6507x-regulator.c
@@ -0,0 +1,563 @@
+/*
+ * tps6507x-regulator.c
+ *
+ * Regulator driver for TPS65073 PMIC
+ *
+ * Copyright (C) 2009 Texas Instrument Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct tps_info {
+   const char *name;
+   unsigned min_uV;
+   unsigned max_uV;
+   bool fixed;
+   u8 table_len;
+   const u16 *table;
+};
+
+struct tps_pmic {
+   struct regulator_desc desc[TPS6507X_NUM_REGULATOR];
+   struct i2c_client *client;
+   struct regulator_dev *rdev[TPS6507X_NUM_REGULATOR];
+   struct tps_info *info[TPS6507X_NUM_REGULATOR];
+};
+
+static inline int tps_6507x_read_reg(struct tps_pmic *tps, u8 reg, u8 *val)
+{
+   int status;
+
+   status = i2c_smbus_read_byte_data(tps->client, reg);
+   *val = status;
+   if (status < 0)
+   return status;
+   return 0;
+}
+
+static inline int tps_6507x_write_reg(struct tps_pmic *tps, u8 reg, u8 val)
+{
+   return i2c_smbus_write_byte_data(tps->client, reg, val);
+}
+
+static int tps_6507x_set_bits(struct tps_pmic *tps, u8 reg, u8 mask)
+{
+   u8 data;
+   int err;
+
+   err = tps_6507x_read_reg(tps, reg, &data);
+   if (err) {
+   pr_err("Read from reg 0x%x failed\n", reg);
+   return err;
+   }
+
+   data |= mask;
+
+   return tps_6507x_write_reg(tps, reg, data);
+}
+
+static int tps_6507x_clear_bits(struct tps_pmic *tps, u8 reg, u8 mask)
+{
+   u8 data;
+   int err;
+
+   err = tps_6507x_read_reg(tps, reg, &data);
+   if (err) {
+   pr_err("Read from reg 0x%x failed\n", reg);
+   return err;
+   }
+
+   data &= ~mask;
+
+   return tps_6507x_write_reg(tps, reg, data);
+}
+
+static int tps6507x_dcdc_is_enabled(struct regulator_dev *dev)
+{
+   struct tps_pmic *tps = rdev_get_drvdata(dev);
+   int dcdc = rdev_get_id(dev);
+   int ret;
+   u8 shift;
+   unsigned char reg_ctrl;
+
+   if (dcdc < TPS6507X_DCDC_1 || dcdc > TPS6507X_DCDC_3)
+   return -EINVAL;
+
+   shift = TPS6507X_MAX_REG_ID - dcdc;
+   ret = tps_6507x_read_reg(tps, TPS6507X_REG_CON_CTRL1, ®_ctrl);
+
+   if (ret == 0) {
+   reg_ctrl &= (1 << shift);
+   return reg_ctrl ? 1 : 0;
+   } else
+   return ret;
+}
+
+static int tps6507x_ldo_is_enabled(struct regulator_dev *dev)
+{
+   struct tps_pmic *tps = rdev_get_drvdata(dev);
+   int ldo = rdev_get_id(dev);
+   int ret;
+   u8 shift;
+   unsigned char reg_ctrl;
+
+   if (ldo < TPS6507X_LDO_1 || ldo > TPS6507X_LDO_2)
+   return -EINVAL;
+
+   shift = TPS6507X_MAX_REG_ID - ldo;
+   ret = tps_6507x_read_reg(tps, TPS6507X_REG_CON_CTRL1, ®_ctrl);
+
+   if (ret == 0) {
+   reg_ctrl &= (1 << shift);
+   return reg_ctrl ? 1 : 0;
+   } else
+   return ret;
+}
+
+static int tps6507x_dcdc_enable(struct regulator_dev *dev)
+{
+   struct tps_pmic *tps = rdev_get_drvdata(dev);
+   int dcdc = rdev_get_id(dev);
+   u8 shift;
+
+   if (dcdc < TPS6507X_DCDC_1 || dcdc > TPS6507X_DCDC_3)
+   return -EINVAL;
+
+   shift = TPS6507X_MAX_REG_ID - dcdc;
+   return tps_6507x_set_bits(tps, TPS6507X_REG_CON_CTRL1, 1 << shift);
+}
+
+static int tps6507x_dcdc_disable(struct regulator_dev *dev)
+{
+   struct tps_pmic *tps = rdev_get_drvdata(dev);
+   int dcdc = rdev_get_id(dev);
+   u8 shift;
+
+   if (dcdc < TPS6507X_DCDC_1 || dcdc > TPS6507X_DCDC_3)
+   return -EINVAL;
+
+   shift = TPS6507X_MAX_REG_ID - dcdc;
+   return tps_6507x_clear_bits(tps, TPS6507X_REG_CON_CTRL1, 1 << shift);
+}
+
+static int tps6507x_ldo_enable(struct regulator_dev *dev)
+{
+   struct tps_pmic *tps = rdev_get_drvdata(dev);
+   int ldo = rdev_get_id(dev);
+

[PATCH 2/8] Regulator: Adding header file for TPS65023

2009-08-07 Thread Anuj Aggarwal

Signed-off-by: Anuj Aggarwal 
---
 include/linux/regulator/tps65023.h |   74 
 1 files changed, 74 insertions(+), 0 deletions(-)
 create mode 100644 include/linux/regulator/tps65023.h

diff --git a/include/linux/regulator/tps65023.h 
b/include/linux/regulator/tps65023.h
new file mode 100644
index 000..6afba6c
--- /dev/null
+++ b/include/linux/regulator/tps65023.h
@@ -0,0 +1,74 @@
+/*
+ * tps65023.h
+ *
+ * Header file for TI TPS65023 Regulator
+ *
+ * Copyright (C) 2009 Texas Instrument Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+/* Register definitions */
+#defineTPS65023_REG_VERSION0
+#defineTPS65023_REG_PGOODZ 1
+#defineTPS65023_REG_MASK   2
+#defineTPS65023_REG_REG_CTRL   3
+#defineTPS65023_REG_CON_CTRL   4
+#defineTPS65023_REG_CON_CTRL2  5
+#defineTPS65023_REG_DEF_CORE   6
+#defineTPS65023_REG_DEFSLEW7
+#defineTPS65023_REG_LDO_CTRL   8
+
+/* PGOODZ bitfields */
+#defineTPS65023_PGOODZ_PWRFAILZBIT(7)
+#defineTPS65023_PGOODZ_LOWBATTZBIT(6)
+#defineTPS65023_PGOODZ_VDCDC1  BIT(5)
+#defineTPS65023_PGOODZ_VDCDC2  BIT(4)
+#defineTPS65023_PGOODZ_VDCDC3  BIT(3)
+#defineTPS65023_PGOODZ_LDO2BIT(2)
+#defineTPS65023_PGOODZ_LDO1BIT(1)
+
+/* MASK bitfields */
+#defineTPS65023_MASK_PWRFAILZ  BIT(7)
+#defineTPS65023_MASK_LOWBATTZ  BIT(6)
+#defineTPS65023_MASK_VDCDC1BIT(5)
+#defineTPS65023_MASK_VDCDC2BIT(4)
+#defineTPS65023_MASK_VDCDC3BIT(3)
+#defineTPS65023_MASK_LDO2  BIT(2)
+#defineTPS65023_MASK_LDO1  BIT(1)
+
+/* REG_CTRL bitfields */
+#define TPS65023_REG_CTRL_VDCDC1_ENBIT(5)
+#define TPS65023_REG_CTRL_VDCDC2_ENBIT(4)
+#define TPS65023_REG_CTRL_VDCDC3_ENBIT(3)
+#define TPS65023_REG_CTRL_LDO2_EN  BIT(2)
+#define TPS65023_REG_CTRL_LDO1_EN  BIT(1)
+
+/* LDO_CTRL bitfields */
+#define TPS65023_LDO_CTRL_LDOx_SHIFT(ldo_id)   ((ldo_id)*4)
+#define TPS65023_LDO_CTRL_LDOx_MASK(ldo_id)(0xF0 >> ((ldo_id)*4))
+
+/* Number of step-down converters available */
+#define TPS65023_NUM_DCDC  3
+/* Number of LDO voltage regulators  available */
+#define TPS65023_NUM_LDO   2
+/* Number of total regulators available */
+#define TPS65023_NUM_REGULATOR (TPS65023_NUM_DCDC + TPS65023_NUM_LDO)
+
+/* DCDC's */
+#define TPS65023_DCDC_10
+#define TPS65023_DCDC_21
+#define TPS65023_DCDC_32
+/* LDOs */
+#define TPS65023_LDO_1 3
+#define TPS65023_LDO_2 4
+
+#define TPS65023_MAX_REG_IDTPS65023_LDO_2
+
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/8] Regulator: Add TPS65023 regulator driver

2009-08-07 Thread Anuj Aggarwal
Adding support for TI TPS65023 regulator driver

Signed-off-by: Anuj Aggarwal 
---
 drivers/regulator/tps65023-regulator.c |  496 
 1 files changed, 496 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/tps65023-regulator.c

diff --git a/drivers/regulator/tps65023-regulator.c 
b/drivers/regulator/tps65023-regulator.c
new file mode 100644
index 000..d112cbc
--- /dev/null
+++ b/drivers/regulator/tps65023-regulator.c
@@ -0,0 +1,496 @@
+/*
+ * tps65023-regulator.c
+ *
+ * Supports TPS65023 Regulator
+ *
+ * Copyright (C) 2009 Texas Instrument Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct tps_info {
+   const char *name;
+   unsigned min_uV;
+   unsigned max_uV;
+   bool fixed;
+   u8 table_len;
+   const u16 *table;
+};
+
+struct tps_pmic {
+   struct regulator_desc desc[TPS65023_NUM_REGULATOR];
+   struct i2c_client *client;
+   struct regulator_dev *rdev[TPS65023_NUM_REGULATOR];
+   const struct tps_info *info[TPS65023_NUM_REGULATOR];
+};
+
+static inline int tps_65023_read_reg(struct tps_pmic *tps, u8 reg, u8 *val)
+{
+   int status;
+
+   status = i2c_smbus_read_byte_data(tps->client, reg);
+   *val = status;
+   if (status < 0)
+   return status;
+   return 0;
+}
+
+static inline int tps_65023_write_reg(struct tps_pmic *tps, u8 reg, u8 val)
+{
+   return i2c_smbus_write_byte_data(tps->client, reg, val);
+}
+
+static int tps_65023_set_bits(struct tps_pmic *tps, u8 reg, u8 mask)
+{
+   u8 data;
+   int err;
+
+   err = tps_65023_read_reg(tps, reg, &data);
+   if (err) {
+   pr_err("Read from reg 0x%x failed\n", reg);
+   return err;
+   }
+
+   data |= mask;
+
+   return tps_65023_write_reg(tps, reg, data);
+}
+
+static int tps_65023_clear_bits(struct tps_pmic *tps, u8 reg, u8 mask)
+{
+   u8 data;
+   int err;
+
+   err = tps_65023_read_reg(tps, reg, &data);
+   if (err) {
+   pr_err("Read from reg 0x%x failed\n", reg);
+   return err;
+   }
+
+   data &= ~mask;
+
+   return tps_65023_write_reg(tps, reg, data);
+}
+
+static int tps65023_dcdc_is_enabled(struct regulator_dev *dev)
+{
+   unsigned char reg_ctrl;
+   struct tps_pmic *tps = rdev_get_drvdata(dev);
+   int dcdc = rdev_get_id(dev);
+   int ret;
+   u8 shift;
+
+   if (dcdc < TPS65023_DCDC_1 || dcdc > TPS65023_DCDC_3)
+   return -EINVAL;
+
+   shift = TPS65023_NUM_REGULATOR - dcdc;
+   ret = tps_65023_read_reg(tps, TPS65023_REG_REG_CTRL, ®_ctrl);
+
+   if (ret == 0) {
+   reg_ctrl &= (1 << shift);
+   return reg_ctrl ? 1 : 0;
+   } else
+   return ret;
+}
+
+static int tps65023_ldo_is_enabled(struct regulator_dev *dev)
+{
+   struct tps_pmic *tps = rdev_get_drvdata(dev);
+   int ldo = rdev_get_id(dev);
+   int ret;
+   u8 shift;
+   unsigned char reg_ctrl;
+
+   if (ldo < TPS65023_LDO_1 || ldo > TPS65023_LDO_2)
+   return -EINVAL;
+
+   shift = (ldo == TPS65023_LDO_1 ? 1 : 2);
+   ret = tps_65023_read_reg(tps, TPS65023_REG_REG_CTRL, ®_ctrl);
+
+   if (ret == 0) {
+   reg_ctrl &= (1 << shift);
+   return reg_ctrl ? 1 : 0;
+   } else
+   return ret;
+}
+
+static int tps65023_dcdc_enable(struct regulator_dev *dev)
+{
+   struct tps_pmic *tps = rdev_get_drvdata(dev);
+   int dcdc = rdev_get_id(dev);
+   u8 shift;
+
+   if (dcdc < TPS65023_DCDC_1 || dcdc > TPS65023_DCDC_3)
+   return -EINVAL;
+
+   shift = TPS65023_NUM_REGULATOR - dcdc;
+   return tps_65023_set_bits(tps, TPS65023_REG_REG_CTRL, 1 << shift);
+}
+
+static int tps65023_dcdc_disable(struct regulator_dev *dev)
+{
+   struct tps_pmic *tps = rdev_get_drvdata(dev);
+   int dcdc = rdev_get_id(dev);
+   u8 shift;
+
+   if (dcdc < TPS65023_DCDC_1 || dcdc > TPS65023_DCDC_3)
+   return -EINVAL;
+
+   shift = TPS65023_NUM_REGULATOR - dcdc;
+   return tps_65023_clear_bits(tps, TPS65023_REG_REG_CTRL, 1 << shift);
+}
+
+static int tps65023_ldo_enable(struct regulator_dev *dev)
+{
+   struct tps_pmic *tps = rdev_get_drvdata(dev);
+   int ldo = rdev_get_id

[PATCH 0/8] Adding TI TPS PMICs support in the regulator framework

2009-08-07 Thread Anuj Aggarwal
This patch set adds support for TI TPS65023 and TPS6507x PMICs in the voltage
regulator framework. It also creates a common board-omap35x-pmic.c file which
has the board related information for the TPS devices for the OMAP35x platforms.

The patches also take care of the comments received earlier when only TPS65023
regulator driver was submitted.

The earlier discussions can be found at:

 [1] Add pmic.c file to regulator framework
 http://marc.info/?l=linux-omap&m=124265188617999&w=2

 [2] Add TPS65023 Regulator Driver
 http://marc.info/?l=linux-omap&m=124181108318242&w=2

 [3] Added board-dependent code for TPS65023
 http://marc.info/?l=linux-omap&m=124264951114318&w=2

Anuj Aggarwal (8):
  Regulator: Add TPS65023 regulator driver
  Regulator: Adding header file for TPS65023
  Regulator: Add TPS6507x regulator driver
  Regulator: Adding header file for TI TPS6507x regulator driver
  Regulator: Adding TPS65023 and TPS6507x in Kconfig and Makefile
  Regulator: Add board-omap35x-pmic.c to arch/arm/mach-omap2/
  Regulator: Added board-dependent code for TPS65023
  Regulator: Added board-dependent code for TPS65073

 arch/arm/mach-omap2/board-omap35x-pmic.c |  305 
 drivers/regulator/Kconfig|   16 +
 drivers/regulator/Makefile   |2 +
 drivers/regulator/tps65023-regulator.c   |  496 ++
 drivers/regulator/tps6507x-regulator.c   |  563 ++
 include/linux/mfd/tps6507x.h |   93 +
 include/linux/regulator/tps65023.h   |   74 
 7 files changed, 1549 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/board-omap35x-pmic.c
 create mode 100644 drivers/regulator/tps65023-regulator.c
 create mode 100644 drivers/regulator/tps6507x-regulator.c
 create mode 100644 include/linux/mfd/tps6507x.h
 create mode 100644 include/linux/regulator/tps65023.h

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ASoC: Added OMAP3 EVM support in ASoC.

2009-05-14 Thread Anuj Aggarwal
Resending the patch after fixing the minor issues.

Signed-off-by: Anuj Aggarwal 
---
 sound/soc/omap/Kconfig|8 +++
 sound/soc/omap/Makefile   |2 +
 sound/soc/omap/omap3evm.c |  147 +
 3 files changed, 157 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/omap/omap3evm.c

diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index 675732e..b771238 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -39,6 +39,14 @@ config SND_OMAP_SOC_OMAP2EVM
help
  Say Y if you want to add support for SoC audio on the omap2evm board.
 
+config SND_OMAP_SOC_OMAP3EVM
+   tristate "SoC Audio support for OMAP3EVM board"
+   depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP3EVM
+   select SND_OMAP_SOC_MCBSP
+   select SND_SOC_TWL4030
+   help
+ Say Y if you want to add support for SoC audio on the omap3evm board.
+
 config SND_OMAP_SOC_SDP3430
tristate "SoC Audio support for Texas Instruments SDP3430"
depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP_3430SDP
diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index 0c9e4ac..a37f498 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -10,6 +10,7 @@ snd-soc-n810-objs := n810.o
 snd-soc-osk5912-objs := osk5912.o
 snd-soc-overo-objs := overo.o
 snd-soc-omap2evm-objs := omap2evm.o
+snd-soc-omap3evm-objs := omap3evm.o
 snd-soc-sdp3430-objs := sdp3430.o
 snd-soc-omap3pandora-objs := omap3pandora.o
 snd-soc-omap3beagle-objs := omap3beagle.o
@@ -18,6 +19,7 @@ obj-$(CONFIG_SND_OMAP_SOC_N810) += snd-soc-n810.o
 obj-$(CONFIG_SND_OMAP_SOC_OSK5912) += snd-soc-osk5912.o
 obj-$(CONFIG_SND_OMAP_SOC_OVERO) += snd-soc-overo.o
 obj-$(CONFIG_MACH_OMAP2EVM) += snd-soc-omap2evm.o
+obj-$(CONFIG_MACH_OMAP3EVM) += snd-soc-omap3evm.o
 obj-$(CONFIG_SND_OMAP_SOC_SDP3430) += snd-soc-sdp3430.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE) += snd-soc-omap3beagle.o
diff --git a/sound/soc/omap/omap3evm.c b/sound/soc/omap/omap3evm.c
new file mode 100644
index 000..9114c26
--- /dev/null
+++ b/sound/soc/omap/omap3evm.c
@@ -0,0 +1,147 @@
+/*
+ * omap3evm.c  -- ALSA SoC support for OMAP3 EVM
+ *
+ * Author: Anuj Aggarwal 
+ *
+ * Based on sound/soc/omap/beagle.c by Steve Sakoman
+ *
+ * Copyright (C) 2008 Texas Instruments, Incorporated
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "omap-mcbsp.h"
+#include "omap-pcm.h"
+#include "../codecs/twl4030.h"
+
+static int omap3evm_hw_params(struct snd_pcm_substream *substream,
+   struct snd_pcm_hw_params *params)
+{
+   struct snd_soc_pcm_runtime *rtd = substream->private_data;
+   struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
+   struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
+   int ret;
+
+   /* Set codec DAI configuration */
+   ret = snd_soc_dai_set_fmt(codec_dai,
+ SND_SOC_DAIFMT_I2S |
+ SND_SOC_DAIFMT_NB_NF |
+ SND_SOC_DAIFMT_CBM_CFM);
+   if (ret < 0) {
+   printk(KERN_ERR "Can't set codec DAI configuration\n");
+   return ret;
+   }
+
+   /* Set cpu DAI configuration */
+   ret = snd_soc_dai_set_fmt(cpu_dai,
+ SND_SOC_DAIFMT_I2S |
+ SND_SOC_DAIFMT_NB_NF |
+ SND_SOC_DAIFMT_CBM_CFM);
+   if (ret < 0) {
+   printk(KERN_ERR "Can't set cpu DAI configuration\n");
+   return ret;
+   }
+
+   /* Set the codec system clock for DAC and ADC */
+   ret = snd_soc_dai_set_sysclk(codec_dai, 0, 2600,
+SND_SOC_CLOCK_IN);
+   if (ret < 0) {
+   printk(KERN_ERR "Can't set codec system clock\n");
+   return ret;
+   }
+
+   return 0;
+}
+
+static struct snd_soc_ops omap3evm_ops = {
+   .hw_params = omap3evm_hw_params,
+};
+
+/* Digital audio interface glue - connects codec <--> CPU */
+static struct snd_soc_dai_link omap3evm_dai = {
+   .name   = "TWL4030",
+   .stream_name= "TWL4030",
+   .cpu_dai= &omap_

[PATCH 3/3] Regulator: Added board-dependent code for TPS65023

2009-05-08 Thread Anuj Aggarwal
Added OMAP3 EVM specific code for TPS65023 in pmic.c file.

Signed-off-by: Anuj Aggarwal 
---
 drivers/regulator/pmic.c |   92 ++
 1 files changed, 92 insertions(+), 0 deletions(-)

diff --git a/drivers/regulator/pmic.c b/drivers/regulator/pmic.c
index 36ed341..6e7276a 100644
--- a/drivers/regulator/pmic.c
+++ b/drivers/regulator/pmic.c
@@ -29,6 +29,96 @@
 /*
  * Definitions specific to TPS65023
  */
+#if defined(CONFIG_OMAP3EVM_TPS65023)
+/* MPU voltage regulator of DCDC type */
+struct regulator_consumer_supply tps65023_mpu_consumers = {
+   .supply = "vdd1",
+};
+
+/* CORE voltage regulator of DCDC type */
+struct regulator_consumer_supply tps65023_core_consumers = {
+   .supply = "vdd2",
+};
+
+/* SRAM/MEM/WKUP_BG voltage regulator of DCDC type */
+struct regulator_consumer_supply tps65023_vdds_consumers = {
+   .supply = "vdds",
+};
+
+/* DPLL voltage regulator of LDO type */
+struct regulator_consumer_supply tps65023_dpll_consumers = {
+   .supply = "dpll",
+};
+
+/* MMC voltage regulator of LDO type */
+struct regulator_consumer_supply tps65023_mmc_consumers = {
+   .supply = "mmc",
+};
+
+struct regulator_init_data tps65023_regulator_data[] = {
+   {
+   .constraints = {
+   .min_uV = 80,
+   .max_uV = 160,
+   .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
+   REGULATOR_CHANGE_STATUS),
+   .boot_on = 1,
+   },
+   .num_consumer_supplies  = 1,
+   .consumer_supplies  = &tps65023_mpu_consumers,
+   },
+   {
+   .constraints = {
+   .min_uV = 180,
+   .max_uV = 330,
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   .boot_on = 1,
+   },
+   .num_consumer_supplies  = 1,
+   .consumer_supplies  = &tps65023_core_consumers,
+   },
+   {
+   .constraints = {
+   .min_uV = 180,
+   .max_uV = 330,
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   .boot_on = 1,
+   },
+   .num_consumer_supplies  = 1,
+   .consumer_supplies  = &tps65023_vdds_consumers,
+   },
+   {
+   .constraints = {
+   .min_uV = 100,
+   .max_uV = 315,
+   .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
+   REGULATOR_CHANGE_STATUS),
+   .boot_on = 1,
+   },
+   .num_consumer_supplies  = 1,
+   .consumer_supplies  = &tps65023_dpll_consumers,
+   },
+   {
+   .constraints = {
+   .min_uV = 105,
+   .max_uV = 330,
+   .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
+   REGULATOR_CHANGE_STATUS),
+   .boot_on = 1,
+   },
+   .num_consumer_supplies  = 1,
+   .consumer_supplies  = &tps65023_mmc_consumers,
+   },
+};
+
+static struct i2c_board_info __initdata board_tps65023_instances[] = {
+   {
+   I2C_BOARD_INFO("tps65023", 0x48),
+   .flags = I2C_CLIENT_WAKE,
+   .platform_data = &tps65023_regulator_data[0],
+   },
+};
+#endif

 static int flag_pmic_twl4030;
 static int flag_pmic_tps6235x;
@@ -96,6 +186,8 @@ int pmic_init(void)

 #if defined(CONFIG_OMAP3EVM_TPS65023)
/* do stuff specific to TPS65023 */
+   omap_register_i2c_bus(1, 400, board_tps65023_instances,
+   ARRAY_SIZE(board_tps65023_instances));
 #endif

return 0;
--
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] Regulator: Add TPS65023 Regulator Driver

2009-05-08 Thread Anuj Aggarwal
Added regulator driver for TPS65023 and modified the Kconfig and Makefile for
the same.

Signed-off-by: Anuj Aggarwal 
---
 drivers/regulator/Kconfig  |8 +
 drivers/regulator/Makefile |1 +
 drivers/regulator/tps65023-regulator.c |  510 
 3 files changed, 519 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/tps65023-regulator.c

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index e58c0ce..28109e1 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -91,4 +91,12 @@ config REGULATOR_PCF50633
 Say Y here to support the voltage regulators and convertors
 on PCF50633

+config REGULATOR_TPS65023
+   tristate "TI TPS65023 Power regulators"
+   depends on OMAP3EVM_TPS65023
+   help
+ This driver supports TPS65023 voltage regulator chips. TPS65023 
provides
+ three step-down converters and two general-purpose LDO voltage 
regulators.
+ It supports TI's software based Class-2 SmartReflex implementation.
+
 endif
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index c0d87bf..28235b9 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -13,5 +13,6 @@ obj-$(CONFIG_REGULATOR_WM8350) += wm8350-regulator.o
 obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o
 obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
 obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o
+obj-$(CONFIG_REGULATOR_TPS65023) += tps65023-regulator.o

 ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG
diff --git a/drivers/regulator/tps65023-regulator.c 
b/drivers/regulator/tps65023-regulator.c
new file mode 100644
index 000..657c0c3
--- /dev/null
+++ b/drivers/regulator/tps65023-regulator.c
@@ -0,0 +1,510 @@
+/*
+ * tps65023-regulator.c -- Supports TPS65023 regulator
+ *
+ * Author : Anuj Aggarwal
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Register definitions */
+#defineTPS65023_REG_VERSION0
+#defineTPS65023_REG_PGOODZ 1
+#defineTPS65023_REG_MASK   2
+#defineTPS65023_REG_REG_CTRL   3
+#defineTPS65023_REG_CON_CTRL   4
+#defineTPS65023_REG_CON_CTRL2  5
+#defineTPS65023_REG_DEF_CORE   6
+#defineTPS65023_REG_DEFSLEW7
+#defineTPS65023_REG_LDO_CTRL   8
+
+/* PGOODZ bitfields */
+#defineTPS65023_PGOODZ_PWRFAILZBIT(7)
+#defineTPS65023_PGOODZ_LOWBATTZBIT(6)
+#defineTPS65023_PGOODZ_VDCDC1  BIT(5)
+#defineTPS65023_PGOODZ_VDCDC2  BIT(4)
+#defineTPS65023_PGOODZ_VDCDC3  BIT(3)
+#defineTPS65023_PGOODZ_LDO2BIT(2)
+#defineTPS65023_PGOODZ_LDO1BIT(1)
+
+/* MASK bitfields */
+#defineTPS65023_MASK_PWRFAILZ  BIT(7)
+#defineTPS65023_MASK_LOWBATTZ  BIT(6)
+#defineTPS65023_MASK_VDCDC1BIT(5)
+#defineTPS65023_MASK_VDCDC2BIT(4)
+#defineTPS65023_MASK_VDCDC3BIT(3)
+#defineTPS65023_MASK_LDO2  BIT(2)
+#defineTPS65023_MASK_LDO1  BIT(1)
+
+/* REG_CTRL bitfields */
+#define TPS65023_REG_CTRL_VDCDC1_ENBIT(5)
+#define TPS65023_REG_CTRL_VDCDC2_ENBIT(4)
+#define TPS65023_REG_CTRL_VDCDC3_ENBIT(3)
+#define TPS65023_REG_CTRL_LDO2_EN  BIT(2)
+#define TPS65023_REG_CTRL_LDO1_EN  BIT(1)
+
+/* LDO_CTRL bitfields */
+#define TPS65023_LDO_CTRL_LDOx_SHIFT   4
+#define TPS65023_LDO_CTRL_LDOx_MASK(ldo_id)(0xF0 >> (ldo_id*4))
+
+/* Number of step-down converters available */
+#define TPS65023_NUM_DCDC  3
+/* Number of LDO voltage regulators  available */
+#define TPS65023_NUM_LDO   2
+/* Number of total regulators available */
+#define TPS65023_NUM_REGULATOR (TPS65023_NUM_DCDC + TPS65023_NUM_LDO)
+
+struct tps_info {
+   const char  *name;
+   unsignedmin_uV;
+   unsignedmax_uV;
+   boolfixed;
+   u8  table_len;
+   const u16   *table;
+};
+
+struct tps {
+   struct regulator_desc   desc[TPS65023_NUM_REGULATOR];
+   struct i2c_client   *client;
+   struct regulator_dev*rdev[TPS65023_NUM_REGULATOR];
+   const struct tps_info   *info[TPS65023_NUM_REGULATOR];
+};
+
+static inline int tps_65023_read_reg(struct tps *tps, u8 reg, u8 *val)
+{
+   int status;
+
+   status = i2c_smbus_read_byte_data(tps->client, reg);
+   *val = status

[PATCH 0/3] Support multiple PMICs in Voltage Regulator Framework

2009-05-08 Thread Anuj Aggarwal
Based on the discussion we had at:

http://marc.info/?l=linux-omap&m=124083364321017&w=2

I am sending the following patches which allows one to move the board-dependent
regulator-specific code to a newly created file drivers\regulator\pmic.c. This
file will have the board specific information for different regulators and
it will do the regulator initialization depending on one which is available.

Anuj Aggarwal (3):
  Regulator: Add pmic.c file to regulator framework
  Regulator: Add TPS65023 Regulator Driver
  Regulator: Added board-dependent code for TPS65023

 drivers/regulator/Kconfig  |8 +
 drivers/regulator/Makefile |3 +-
 drivers/regulator/pmic.c   |  195 
 drivers/regulator/tps65023-regulator.c |  510 
 include/linux/regulator/pmic.h |   29 ++
 5 files changed, 744 insertions(+), 1 deletions(-)
 create mode 100644 drivers/regulator/pmic.c
 create mode 100644 drivers/regulator/tps65023-regulator.c
 create mode 100644 include/linux/regulator/pmic.h

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] Regulator: Add pmic.c file to regulator framework

2009-05-08 Thread Anuj Aggarwal
Added drivers\regulator\pmic.c file to the regulator framework which will
have the board specific information for different regulators and will do the
regulator initialization depending on one which is available.

Signed-off-by: Anuj Aggarwal 
---
 drivers/regulator/Makefile |2 +-
 drivers/regulator/pmic.c   |  103 
 include/linux/regulator/pmic.h |   29 +++
 3 files changed, 133 insertions(+), 1 deletions(-)
 create mode 100644 drivers/regulator/pmic.c
 create mode 100644 include/linux/regulator/pmic.h

diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index bac133a..c0d87bf 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -3,7 +3,7 @@
 #


-obj-$(CONFIG_REGULATOR) += core.o
+obj-$(CONFIG_REGULATOR) += core.o pmic.o
 obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o
 obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o

diff --git a/drivers/regulator/pmic.c b/drivers/regulator/pmic.c
new file mode 100644
index 000..36ed341
--- /dev/null
+++ b/drivers/regulator/pmic.c
@@ -0,0 +1,103 @@
+/*
+ * pmic.c
+ *
+ * Supports run-time detection of different Power Management ICs.
+ *
+ * Copyright (C) 2009 Texas Instrument Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or modify it 
under
+ * the terms of the GNU General Public License as  published by the Free
+ * Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+#include 
+#include 
+#include 
+
+/*
+ * Definitions specific to TWL4030
+ */
+
+/*
+ * Definitions specific to TPS62350
+ */
+
+/*
+ * Definitions specific to TPS65023
+ */
+
+static int flag_pmic_twl4030;
+static int flag_pmic_tps6235x;
+static int flag_pmic_tps65023;
+
+/*
+ * Detect the current PMIC, set one of the flags
+ */
+static inline int detect_pmic(void)
+{
+   /* How? Any suggestions?? This is a temporary solution. */
+#if defined(CONFIG_TWL4030_CORE)
+   flag_pmic_twl4030 = 1;
+#endif
+
+#if defined(CONFIG_OMAP3EVM_TPS6235X)
+   flag_pmic_tps6235x = 1;
+#endif
+
+#if defined(CONFIG_OMAP3EVM_TPS65023)
+   flag_pmic_tps65023 = 1;
+#endif
+
+   return 0;
+}
+
+/* Functions to detect which PMIC is present */
+
+int pmic_is_twl4030(void)
+{
+   return flag_pmic_twl4030;
+}
+
+int pmic_is_tps6235x(void)
+{
+   return flag_pmic_tps6235x;
+}
+
+int pmic_is_tps65020(void) { return 0; }
+
+int pmic_is_tps65021(void) { return 0; }
+
+int pmic_is_tps65022(void) { return 0; }
+
+int pmic_is_tps65023(void)
+{
+   return flag_pmic_tps65023;
+}
+
+int pmic_is_tps65950(void)
+{
+   return flag_pmic_twl4030;
+}
+
+/* Detects the PMIC and initializes it accordingly */
+int pmic_init(void)
+{
+#if defined(CONFIG_TWL4030_CORE)
+   /* do stuff specific to TWL4030 */
+#endif
+
+#if defined(CONFIG_OMAP3EVM_TPS6235X)
+   /* do stuff specific to TPS62350 */
+#endif
+
+#if defined(CONFIG_OMAP3EVM_TPS65023)
+   /* do stuff specific to TPS65023 */
+#endif
+
+   return 0;
+}
+
diff --git a/include/linux/regulator/pmic.h b/include/linux/regulator/pmic.h
new file mode 100644
index 000..5956740
--- /dev/null
+++ b/include/linux/regulator/pmic.h
@@ -0,0 +1,29 @@
+/*
+ * pmic.h
+ *
+ * Supports run-time detection of different Power Management ICs.
+ *
+ * Copyright (C) 2009 Texas Instrument Incorporated  http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or modify it 
under
+ * the terms of the GNU General Public License as  published by the Free
+ * Software Foundation version 2.
+ *
+ * This program is distributed as is WITHOUT ANY WARRANTY of any kind, whether
+ * express or implied; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+
+/* Functions to detect which PMIC is present */
+int pmic_is_twl4030(void);
+int pmic_is_tps6235x(void);
+int pmic_is_tps65020(void);
+int pmic_is_tps65021(void);
+int pmic_is_tps65022(void);
+int pmic_is_tps65023(void);
+int pmic_is_tps65950(void);
+
+/* Detects the PMIC and initializes it accordingly */
+int pmic_init(void);
+
--
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] ASoC: Added OMAP3 EVM support in ASoC.

2009-05-07 Thread Anuj Aggarwal

Signed-off-by: Anuj Aggarwal 
---
 sound/soc/omap/Kconfig|8 +++
 sound/soc/omap/Makefile   |2 +
 sound/soc/omap/omap3evm.c |  147 +
 3 files changed, 157 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/omap/omap3evm.c

diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index 675732e..b771238 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -39,6 +39,14 @@ config SND_OMAP_SOC_OMAP2EVM
help
  Say Y if you want to add support for SoC audio on the omap2evm board.
 
+config SND_OMAP_SOC_OMAP3EVM
+   tristate "SoC Audio support for OMAP3EVM board"
+   depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP3EVM
+   select SND_OMAP_SOC_MCBSP
+   select SND_SOC_TWL4030
+   help
+ Say Y if you want to add support for SoC audio on the omap3evm board.
+
 config SND_OMAP_SOC_SDP3430
tristate "SoC Audio support for Texas Instruments SDP3430"
depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP_3430SDP
diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index 0c9e4ac..a37f498 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -10,6 +10,7 @@ snd-soc-n810-objs := n810.o
 snd-soc-osk5912-objs := osk5912.o
 snd-soc-overo-objs := overo.o
 snd-soc-omap2evm-objs := omap2evm.o
+snd-soc-omap3evm-objs := omap3evm.o
 snd-soc-sdp3430-objs := sdp3430.o
 snd-soc-omap3pandora-objs := omap3pandora.o
 snd-soc-omap3beagle-objs := omap3beagle.o
@@ -18,6 +19,7 @@ obj-$(CONFIG_SND_OMAP_SOC_N810) += snd-soc-n810.o
 obj-$(CONFIG_SND_OMAP_SOC_OSK5912) += snd-soc-osk5912.o
 obj-$(CONFIG_SND_OMAP_SOC_OVERO) += snd-soc-overo.o
 obj-$(CONFIG_MACH_OMAP2EVM) += snd-soc-omap2evm.o
+obj-$(CONFIG_MACH_OMAP3EVM) += snd-soc-omap3evm.o
 obj-$(CONFIG_SND_OMAP_SOC_SDP3430) += snd-soc-sdp3430.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE) += snd-soc-omap3beagle.o
diff --git a/sound/soc/omap/omap3evm.c b/sound/soc/omap/omap3evm.c
new file mode 100644
index 000..2af5d93
--- /dev/null
+++ b/sound/soc/omap/omap3evm.c
@@ -0,0 +1,147 @@
+/*
+ * omap3evm.c  -- ALSA SoC support for OMAP3 EVM
+ *
+ * Author: Anuj Aggarwal 
+ *
+ * Based on sound/soc/omap/beagle.c by Steve Sakoman
+ *
+ * Copyright (C) 2008 Texas Instruments, Incorporated
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "omap-mcbsp.h"
+#include "omap-pcm.h"
+#include "../codecs/twl4030.h"
+
+static int omap3evm_hw_params(struct snd_pcm_substream *substream,
+   struct snd_pcm_hw_params *params)
+{
+   struct snd_soc_pcm_runtime *rtd = substream->private_data;
+   struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
+   struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
+   int ret;
+
+   /* Set codec DAI configuration */
+   ret = snd_soc_dai_set_fmt(codec_dai,
+ SND_SOC_DAIFMT_I2S |
+ SND_SOC_DAIFMT_NB_NF |
+ SND_SOC_DAIFMT_CBM_CFM);
+   if (ret < 0) {
+   printk(KERN_ERR "Can't set codec DAI configuration\n");
+   return ret;
+   }
+
+   /* Set cpu DAI configuration */
+   ret = snd_soc_dai_set_fmt(cpu_dai,
+ SND_SOC_DAIFMT_I2S |
+ SND_SOC_DAIFMT_NB_NF |
+ SND_SOC_DAIFMT_CBM_CFM);
+   if (ret < 0) {
+   printk(KERN_ERR "Can't set cpu DAI configuration\n");
+   return ret;
+   }
+
+   /* Set the codec system clock for DAC and ADC */
+   ret = snd_soc_dai_set_sysclk(codec_dai, 0, 2600,
+SND_SOC_CLOCK_IN);
+   if (ret < 0) {
+   printk(KERN_ERR "Can't set codec system clock\n");
+   return ret;
+   }
+
+   return 0;
+}
+
+static struct snd_soc_ops omap3evm_ops = {
+   .hw_params = omap3evm_hw_params,
+};
+
+/* Digital audio interface glue - connects codec <--> CPU */
+static struct snd_soc_dai_link omap3evm_dai = {
+   .name   = "TWL4030",
+   .stream_name= "TWL4030",
+   .cpu_dai= &omap_mcbsp_dai[0],
+   .codec_dai

[PATCH 0/1] ASoC: Added OMAP3 EVM Support

2009-05-07 Thread Anuj Aggarwal
With refernce to the discussion at:

http://marc.info/?l=linux-omap&m=124169330310075&w=2

I am resending the patch to add OMAP3 EVM support in ASoC. It
has been built/checked against the tip.

Anuj Aggarwal (1):
  ASoC: Added OMAP3 EVM support in ASoC.

 sound/soc/omap/Kconfig|8 +++
 sound/soc/omap/Makefile   |2 +
 sound/soc/omap/omap3evm.c |  147 +
 3 files changed, 157 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/omap/omap3evm.c

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


How to test regulator driver?

2009-03-09 Thread Anuj Aggarwal
Hi,

I want to test my regulator driver by writing a small kernel module.
But I am a little confused as what should be passed as the first
argument of regulator_get(). How would the kernel module know about
the device pointer that needs to be passed to the _get function?

Thanks,
Anuj Aggarwal
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: ASoC audio not working on OMAP3 EVM

2009-02-13 Thread Anuj Aggarwal
Hi All,

Thanks for your help, it came out as a hardware issue. Same image
worked fine when tried on a different EVM. Now the audio is playing
fine, except that I am hearing a very light pop-noise as soon I start
the playback.

Any suggestions on removing that? It didn't occur if I play something
second time.

Thanks,
Anuj

On Thu, Feb 12, 2009 at 4:31 PM, Koen Kooi  wrote:
>
> Op 12 feb 2009, om 10:49 heeft Jarkko Nikula het volgende geschreven:
>
>> On Thu, 12 Feb 2009 10:38:27 +0100
>> ext Anuj Aggarwal  wrote:
>>
>>> The patch doesn't help, result is same...
>>>
>>> Any help is welcome
>>>
>> My Beagle is working fine on top of l-o head (commit
>> 70ff4a1aafd2378c9e3ff153135ba6d0bde45215) and with Steve's patch
>>
>> http://git.kernel.org/?p=linux/kernel/git/tiwai/sound-2.6.git;a=commit;h=80c509fdd74f3b158267374cc55156965c8bf930
>>
>> What codec OMAP3 EVM is using? If AIC3x, then Eero's patch might help
>
> the same codec as beagle and overo (twl/tps)
>
> regards,
>
> Koen



--
Best Regards,
Anuj Aggarwal
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: ASoC audio not working on OMAP3 EVM

2009-02-12 Thread Anuj Aggarwal
The patch doesn't help, result is same...

Any help is welcome

On Thu, Feb 12, 2009 at 1:09 PM, Eero Nurkkala
 wrote:
>> Has anyone observed the same problems on other platforms as well? Do
>> we have a fix for them?
>
> Give this a try:
>
> http://marc.info/?l=linux-omap&m=123269333910864&w=2
>
> If you press down enter (or so), and the audio plays better,
> this will help. I dont know whether this EVM uses McBSP though.
> (if it doesn't apply, please merge manually)
>
>
> - Eero
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



-- 
Best Regards,
Anuj Aggarwal
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ASoC audio not working on OMAP3 EVM

2009-02-11 Thread Anuj Aggarwal
Hi,

I am on commit "Merge current mainline tree into linux-omap tree
(master)" id: de45215. I tried audio in ASoC on OMAP3 EVM but found
two major problems:

a) Songs are being played very slowly, something like audio in slow motion.
b) Capture plays noise even if no audio source is connected for
recording. It is not capturing 'silence' properly.

Has anyone observed the same problems on other platforms as well? Do
we have a fix for them?

Anuj Aggarwal
Texas Instruments
Bangalore, INDIA
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: v2.6.28-omap1 tagged, some bugs remain

2009-01-13 Thread Anuj Aggarwal
I tried ASoC by removing the commit "ARM: OMAP3: Mask interrupts when
disabling interrupts" (023ae898bbbed8c2bc4d38bfbd05d2fee91c3468) and
audio worked fine for me.

Regards,
Anuj

On Tue, Jan 13, 2009 at 12:38 PM, Jarkko Nikula  wrote:
>
> On Mon, 12 Jan 2009 18:15:20 +0200
> "ext Tony Lindgren"  wrote:
>
> > >> - According to Jarkko Nikula, ASoC does not currently work because of
> > >>  some recent clock changes.
> > >
> > > Confirmed on omap3evm.
> >
> > Thanks, can you try to git-bisect the breaking commit?
> >
> I did very short test on sunday and it was working at least when
> checkouting into 12081fce83c10221ccd1b282e3e2fbe56f742e21, i.e. commit
> before 60b8b431e47d8c5b8c02a2e4fa9af388aae20790 which was mentioned in
> the commit 818862e11bad091dc635baedace58265a126b5c8 :-)
>
> Paul was going to take a look tomorrow.
>
>
> Jarkko
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



--
Best Regards,
Anuj Aggarwal
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Fwd: [PATCH v2 20/23] OMAP2/3 clock: omap2_clk_enable(): fix usecount decrement bug

2009-01-06 Thread Anuj Aggarwal
I also found the same issue while reviewing the code. Thanks for the patch.

Regards,
Anuj Aggarwal

On Mon, Jan 5, 2009 at 8:05 AM, Paul Walmsley  wrote:
>
> If _omap2_clk_enable() fails, the clock's usecount must be decremented by
> one no matter whether the clock has a parent or not.
>
> Signed-off-by: Paul Walmsley 
> ---
>  arch/arm/mach-omap2/clock.c |6 ++
>  1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
> index 55f43d0..a9a2bbf 100644
> --- a/arch/arm/mach-omap2/clock.c
> +++ b/arch/arm/mach-omap2/clock.c
> @@ -502,12 +502,10 @@ int omap2_clk_enable(struct clk *clk)
>ret = _omap2_clk_enable(clk);
>
>if (ret != 0) {
> +   clk->usecount--;
>omap2_clkdm_clk_disable(clk->clkdm.ptr, clk);
> -
> -   if (clk->parent) {
> +   if (clk->parent)
>omap2_clk_disable(clk->parent);
> -   clk->usecount--;
> -   }
>}
>
>return ret;
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



--
Best Regards,
Anuj Aggarwal



--
Best Regards,
Anuj Aggarwal
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ASoC: Add support for OMAP3 EVM

2008-11-24 Thread Anuj Aggarwal
This patch adds ALSA SoC support for OMAP3 EVM using TWL4030 audio codec.

Signed-off-by: Anuj Aggarwal <[EMAIL PROTECTED]>
---
 sound/soc/omap/Kconfig|7 ++
 sound/soc/omap/Makefile   |2 +
 sound/soc/omap/omap3evm.c |  147 +
 3 files changed, 156 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/omap/omap3evm.c

diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index 6c56277..c465139 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -38,5 +38,12 @@ config SND_OMAP_SOC_OMAP2EVM
help
  Say Y if you want to add support for SoC audio on the omap2evm board.
 
+config SND_OMAP_SOC_OMAP3EVM
+   tristate "SoC Audio support for OMAP3EVM board"
+   depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP3EVM
+   select SND_OMAP_SOC_MCBSP
+   select SND_SOC_TWL4030
+   help
+ Say Y if you want to add support for SoC audio on the omap3evm board.
 
 
diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index f5da3cc..bbb3a77 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -10,9 +10,11 @@ snd-soc-n810-objs := n810.o
 snd-soc-osk5912-objs := osk5912.o
 snd-soc-overo-objs := overo.o
 snd-soc-omap2evm-objs := omap2evm.o
+snd-soc-omap3evm-objs := omap3evm.o
 
 obj-$(CONFIG_SND_OMAP_SOC_N810) += snd-soc-n810.o
 obj-$(CONFIG_SND_OMAP_SOC_OSK5912) += snd-soc-osk5912.o
 obj-$(CONFIG_SND_OMAP_SOC_OVERO) += snd-soc-overo.o
 obj-$(CONFIG_MACH_OMAP2EVM) += snd-soc-omap2evm.o
+obj-$(CONFIG_MACH_OMAP3EVM) += snd-soc-omap3evm.o
 
diff --git a/sound/soc/omap/omap3evm.c b/sound/soc/omap/omap3evm.c
new file mode 100644
index 000..570af55
--- /dev/null
+++ b/sound/soc/omap/omap3evm.c
@@ -0,0 +1,147 @@
+/*
+ * omap3evm.c  -- ALSA SoC support for OMAP3 EVM
+ *
+ * Author: Anuj Aggarwal <[EMAIL PROTECTED]>
+ *
+ * Based on sound/soc/omap/beagle.c by Steve Sakoman
+ *
+ * Copyright (C) 2008 Texas Instruments, Incorporated
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "omap-mcbsp.h"
+#include "omap-pcm.h"
+#include "../codecs/twl4030.h"
+
+static int omap3evm_hw_params(struct snd_pcm_substream *substream,
+   struct snd_pcm_hw_params *params)
+{
+   struct snd_soc_pcm_runtime *rtd = substream->private_data;
+   struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
+   struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
+   int ret;
+
+   /* Set codec DAI configuration */
+   ret = snd_soc_dai_set_fmt(codec_dai,
+ SND_SOC_DAIFMT_I2S |
+ SND_SOC_DAIFMT_NB_NF |
+ SND_SOC_DAIFMT_CBM_CFM);
+   if (ret < 0) {
+   printk(KERN_ERR "can't set codec DAI configuration\n");
+   return ret;
+   }
+
+   /* Set cpu DAI configuration */
+   ret = snd_soc_dai_set_fmt(cpu_dai,
+ SND_SOC_DAIFMT_I2S |
+ SND_SOC_DAIFMT_NB_NF |
+ SND_SOC_DAIFMT_CBM_CFM);
+   if (ret < 0) {
+   printk(KERN_ERR "can't set cpu DAI configuration\n");
+   return ret;
+   }
+
+   /* Set the codec system clock for DAC and ADC */
+   ret = snd_soc_dai_set_sysclk(codec_dai, 0, 2600,
+SND_SOC_CLOCK_IN);
+   if (ret < 0) {
+   printk(KERN_ERR "can't set codec system clock\n");
+   return ret;
+   }
+
+   return 0;
+}
+
+static struct snd_soc_ops omap3evm_ops = {
+   .hw_params = omap3evm_hw_params,
+};
+
+/* Digital audio interface glue - connects codec <--> CPU */
+static struct snd_soc_dai_link omap3evm_dai = {
+   .name = "TWL4030",
+   .stream_name = "TWL4030",
+   .cpu_dai = &omap_mcbsp_dai[0],
+   .codec_dai = &twl4030_dai,
+   .ops = &omap3evm_ops,
+};
+
+/* Audio machine driver */
+static struct snd_soc_machine snd_soc_machine_omap3evm = {
+   .name = "omap3evm",
+   .dai_link = &omap3evm_dai,
+   .num_links = 1,
+};
+
+/* Audio subsystem */
+static struct snd_soc_device omap3evm_snd_devdata = {
+   .machine = &snd_soc_machine_omap3evm,
+   .platform = &omap_soc_platfo

[PATCH] ASoC: Add support for OMAP3 EVM

2008-11-21 Thread Anuj Aggarwal
This patch adds ALSA SoC support for OMAP3 EVM using TWL4030 audio codec.

Signed-off-by: Anuj Aggarwal <[EMAIL PROTECTED]>
---
 sound/soc/omap/Kconfig|7 ++
 sound/soc/omap/Makefile   |2 +
 sound/soc/omap/omap3evm.c |  147 +
 3 files changed, 156 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/omap/omap3evm.c

diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index 6c56277..2a2a74e 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -38,5 +38,12 @@ config SND_OMAP_SOC_OMAP2EVM
help
  Say Y if you want to add support for SoC audio on the omap2evm board.

+config SND_OMAP_SOC_OMAP3EVM
+   tristate "SoC Audio support for OMAP3EVM board"
+   depends on SND_OMAP_SOC && MACH_OMAP3EVM
+   select SND_OMAP_SOC_MCBSP
+   select SND_SOC_TWL4030
+   help
+ Say Y if you want to add support for SoC audio on the omap3evm board.


diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index f5da3cc..bbb3a77 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -10,9 +10,11 @@ snd-soc-n810-objs := n810.o
 snd-soc-osk5912-objs := osk5912.o
 snd-soc-overo-objs := overo.o
 snd-soc-omap2evm-objs := omap2evm.o
+snd-soc-omap3evm-objs := omap3evm.o

 obj-$(CONFIG_SND_OMAP_SOC_N810) += snd-soc-n810.o
 obj-$(CONFIG_SND_OMAP_SOC_OSK5912) += snd-soc-osk5912.o
 obj-$(CONFIG_SND_OMAP_SOC_OVERO) += snd-soc-overo.o
 obj-$(CONFIG_MACH_OMAP2EVM) += snd-soc-omap2evm.o
+obj-$(CONFIG_MACH_OMAP3EVM) += snd-soc-omap3evm.o

diff --git a/sound/soc/omap/omap3evm.c b/sound/soc/omap/omap3evm.c
new file mode 100644
index 000..570af55
--- /dev/null
+++ b/sound/soc/omap/omap3evm.c
@@ -0,0 +1,147 @@
+/*
+ * omap3evm.c  -- ALSA SoC support for OMAP3 EVM
+ *
+ * Author: Anuj Aggarwal <[EMAIL PROTECTED]>
+ *
+ * Based on sound/soc/omap/beagle.c by Steve Sakoman
+ *
+ * Copyright (C) 2008 Texas Instruments, Incorporated
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "omap-mcbsp.h"
+#include "omap-pcm.h"
+#include "../codecs/twl4030.h"
+
+static int omap3evm_hw_params(struct snd_pcm_substream *substream,
+   struct snd_pcm_hw_params *params)
+{
+   struct snd_soc_pcm_runtime *rtd = substream->private_data;
+   struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
+   struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
+   int ret;
+
+   /* Set codec DAI configuration */
+   ret = snd_soc_dai_set_fmt(codec_dai,
+ SND_SOC_DAIFMT_I2S |
+ SND_SOC_DAIFMT_NB_NF |
+ SND_SOC_DAIFMT_CBM_CFM);
+   if (ret < 0) {
+   printk(KERN_ERR "can't set codec DAI configuration\n");
+   return ret;
+   }
+
+   /* Set cpu DAI configuration */
+   ret = snd_soc_dai_set_fmt(cpu_dai,
+ SND_SOC_DAIFMT_I2S |
+ SND_SOC_DAIFMT_NB_NF |
+ SND_SOC_DAIFMT_CBM_CFM);
+   if (ret < 0) {
+   printk(KERN_ERR "can't set cpu DAI configuration\n");
+   return ret;
+   }
+
+   /* Set the codec system clock for DAC and ADC */
+   ret = snd_soc_dai_set_sysclk(codec_dai, 0, 2600,
+SND_SOC_CLOCK_IN);
+   if (ret < 0) {
+   printk(KERN_ERR "can't set codec system clock\n");
+   return ret;
+   }
+
+   return 0;
+}
+
+static struct snd_soc_ops omap3evm_ops = {
+   .hw_params = omap3evm_hw_params,
+};
+
+/* Digital audio interface glue - connects codec <--> CPU */
+static struct snd_soc_dai_link omap3evm_dai = {
+   .name = "TWL4030",
+   .stream_name = "TWL4030",
+   .cpu_dai = &omap_mcbsp_dai[0],
+   .codec_dai = &twl4030_dai,
+   .ops = &omap3evm_ops,
+};
+
+/* Audio machine driver */
+static struct snd_soc_machine snd_soc_machine_omap3evm = {
+   .name = "omap3evm",
+   .dai_link = &omap3evm_dai,
+   .num_links = 1,
+};
+
+/* Audio subsystem */
+static struct snd_soc_device omap3evm_snd_devdata = {
+   .machine = &snd_soc_machine_omap3evm,
+   .platform = &omap_soc_platform,
+   

[PATCH] ALSA: ASoC: Add support for OMAP3 EVM

2008-11-16 Thread Anuj Aggarwal

Signed-off-by: Anuj Aggarwal <[EMAIL PROTECTED]>
---
 sound/soc/omap/Kconfig|8 +++
 sound/soc/omap/Makefile   |2 +
 sound/soc/omap/omap3evm.c |  147 +
 3 files changed, 157 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/omap/omap3evm.c

diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index 8b7766b..9255c6a 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -21,3 +21,11 @@ config SND_OMAP_SOC_OSK5912
select SND_SOC_TLV320AIC23
help
  Say Y if you want to add support for SoC audio on osk5912.
+
+config SND_OMAP_SOC_OMAP3EVM
+   tristate "SoC Audio support for OMAP3 EVM"
+   depends on SND_OMAP_SOC && MACH_OMAP3EVM
+   select SND_OMAP_SOC_MCBSP
+   select SND_SOC_TWL4030
+   help
+ Say Y if you want to add support for SoC audio on the OMAP3 EVM.
diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index e09d1f2..8633c3a 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -8,6 +8,8 @@ obj-$(CONFIG_SND_OMAP_SOC_MCBSP) += snd-soc-omap-mcbsp.o
 # OMAP Machine Support
 snd-soc-n810-objs := n810.o
 snd-soc-osk5912-objs := osk5912.o
+snd-soc-omap3evm-objs := omap3evm.o
 
 obj-$(CONFIG_SND_OMAP_SOC_N810) += snd-soc-n810.o
 obj-$(CONFIG_SND_OMAP_SOC_OSK5912) += snd-soc-osk5912.o
+obj-$(CONFIG_SND_OMAP_SOC_OMAP3EVM) += snd-soc-omap3evm.o
diff --git a/sound/soc/omap/omap3evm.c b/sound/soc/omap/omap3evm.c
new file mode 100644
index 000..6bef466
--- /dev/null
+++ b/sound/soc/omap/omap3evm.c
@@ -0,0 +1,147 @@
+/*
+ * omap3evm.c
+ *
+ * ALSA SoC support for OMAP3 EVM.
+ *
+ * Author: Anuj Aggarwal <[EMAIL PROTECTED]>
+ *
+ * Copyright (C) 2008 Texas Instruments, Incorporated
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "omap-mcbsp.h"
+#include "omap-pcm.h"
+#include "../codecs/twl4030.h"
+
+static int omap3evm_hw_params(struct snd_pcm_substream *substream,
+   struct snd_pcm_hw_params *params)
+{
+   struct snd_soc_pcm_runtime *rtd = substream->private_data;
+   struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
+   struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
+   int ret;
+
+   /* Set codec DAI configuration */
+   ret = snd_soc_dai_set_fmt(codec_dai,
+ SND_SOC_DAIFMT_I2S |
+ SND_SOC_DAIFMT_NB_NF |
+ SND_SOC_DAIFMT_CBM_CFM);
+   if (ret < 0) {
+   printk(KERN_ERR "can't set codec DAI configuration\n");
+   return ret;
+   }
+
+   /* Set cpu DAI configuration */
+   ret = snd_soc_dai_set_fmt(cpu_dai,
+ SND_SOC_DAIFMT_I2S |
+ SND_SOC_DAIFMT_NB_NF |
+ SND_SOC_DAIFMT_CBM_CFM);
+   if (ret < 0) {
+   printk(KERN_ERR "can't set cpu DAI configuration\n");
+   return ret;
+   }
+
+   /* Set the codec system clock for DAC and ADC */
+   ret = snd_soc_dai_set_sysclk(codec_dai, 0, 2600,
+SND_SOC_CLOCK_IN);
+   if (ret < 0) {
+   printk(KERN_ERR "can't set codec system clock\n");
+   return ret;
+   }
+
+   return 0;
+}
+
+static struct snd_soc_ops omap3evm_ops = {
+   .hw_params = omap3evm_hw_params,
+};
+
+/* Digital audio interface glue - connects codec <--> CPU */
+static struct snd_soc_dai_link omap3evm_dai = {
+   .name = "TWL4030",
+   .stream_name = "TWL4030",
+   .cpu_dai = &omap_mcbsp_dai[0],
+   .codec_dai = &twl4030_dai,
+   .ops = &omap3evm_ops,
+};
+
+/* Audio machine driver */
+static struct snd_soc_machine snd_soc_machine_omap3evm = {
+   .name = "omap3evm",
+   .dai_link = &omap3evm_dai,
+   .num_links = 1,
+};
+
+/* Audio subsystem */
+static struct snd_soc_device omap3evm_snd_devdata = {
+   .machine = &snd_soc_machine_omap3evm,
+   .platform = &omap_soc_platform,
+   .codec_dev = &soc_codec_dev_twl4030,
+};
+
+static struct platform_device *omap3evm_snd_device;
+
+static int __init omap3evm_soc_init(void)
+{
+   int ret;
+
+   if (!machine_is_omap3evm()) {
+   

ASOC Support for OMAP3 EVM + TWL4030

2008-11-05 Thread anuj aggarwal
Hi,

I was looking at the git tree using "v2.6.27-omap1" tag but could not
find ALSA-SOC support for OMAP3 EVM. Source code for TWL4030 codec is
also available in soc/codecs folder but there is no configuration
option available to choose it.

Is ASOC supported for OMAP3 EVM & TWL4030 codec in v2.6.27-omap1? If
no, which version should I look at?

Thanks in advance

Best Regards,
Anuj Aggarwal
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html