summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Monk <r-monk@ti.com>2010-01-13 21:45:13 +0000
committerKoen Kooi <koen@openembedded.org>2010-04-12 19:43:10 +0200
commite336f40a7e07a00402e8b7820f45ce6d02d98991 (patch)
treedcea857af17ec54ca8869d98e70abd026198b8f5
parent730a22f771d51f474e146eb58e5a600afc19bf08 (diff)
linux-davinci: Add MFD Touchscreen Driver from RidgeRun for da850-omapl138
* Add Touchscreen patches (rebased on top of regulator fix patches)i * Update defconfig to enable MFD/TS * Rebase OPP DCDC3 patch * Add patches to recipe * Bump PR Signed-off-by: Koen Kooi <k-kooi@ti.com>
-rw-r--r--recipes/linux/linux-davinci/0001-tps6507x_regulator_refactor.patch222
-rw-r--r--recipes/linux/linux-davinci/0002-tps6507x_regulator_da850_integration.patch83
-rw-r--r--recipes/linux/linux-davinci/0003-tps6507x_mfd_driver.patch214
-rw-r--r--recipes/linux/linux-davinci/0004-tps6507x_regulator_naming_change.patch418
-rw-r--r--recipes/linux/linux-davinci/0005-tps6507x_regulator_mfd_integration.patch397
-rw-r--r--recipes/linux/linux-davinci/0006-tps6507x_touchscreen_driver.patch541
-rw-r--r--recipes/linux/linux-davinci/da850-omapl138-evm/defconfig2
-rw-r--r--recipes/linux/linux-davinci/da850_omapl138_opp456mhz_increaseDcDc3.patch2
-rw-r--r--recipes/linux/linux-davinci_git.bb6
9 files changed, 1884 insertions, 1 deletions
diff --git a/recipes/linux/linux-davinci/0001-tps6507x_regulator_refactor.patch b/recipes/linux/linux-davinci/0001-tps6507x_regulator_refactor.patch
new file mode 100644
index 0000000000..b3050c6dfe
--- /dev/null
+++ b/recipes/linux/linux-davinci/0001-tps6507x_regulator_refactor.patch
@@ -0,0 +1,222 @@
+Index: git/drivers/regulator/tps6507x-regulator.c
+===================================================================
+--- git.orig/drivers/regulator/tps6507x-regulator.c 2010-01-11 02:59:57.000000000 -0700
++++ git/drivers/regulator/tps6507x-regulator.c 2010-01-11 02:59:59.000000000 -0700
+@@ -24,65 +24,7 @@
+ #include <linux/regulator/machine.h>
+ #include <linux/i2c.h>
+ #include <linux/delay.h>
+-
+-/* Register definitions */
+-#define TPS6507X_REG_PPATH1 0X01
+-#define TPS6507X_REG_INT 0X02
+-#define TPS6507X_REG_CHGCONFIG0 0X03
+-#define TPS6507X_REG_CHGCONFIG1 0X04
+-#define TPS6507X_REG_CHGCONFIG2 0X05
+-#define TPS6507X_REG_CHGCONFIG3 0X06
+-#define TPS6507X_REG_REG_ADCONFIG 0X07
+-#define TPS6507X_REG_TSCMODE 0X08
+-#define TPS6507X_REG_ADRESULT_1 0X09
+-#define TPS6507X_REG_ADRESULT_2 0X0A
+-#define TPS6507X_REG_PGOOD 0X0B
+-#define TPS6507X_REG_PGOODMASK 0X0C
+-#define TPS6507X_REG_CON_CTRL1 0X0D
+-#define TPS6507X_REG_CON_CTRL2 0X0E
+-#define TPS6507X_REG_CON_CTRL3 0X0F
+-#define TPS6507X_REG_DEFDCDC1 0X10
+-#define TPS6507X_REG_DEFDCDC2_LOW 0X11
+-#define TPS6507X_REG_DEFDCDC2_HIGH 0X12
+-#define TPS6507X_REG_DEFDCDC3_LOW 0X13
+-#define TPS6507X_REG_DEFDCDC3_HIGH 0X14
+-#define TPS6507X_REG_DEFSLEW 0X15
+-#define TPS6507X_REG_LDO_CTRL1 0X16
+-#define TPS6507X_REG_DEFLDO2 0X17
+-#define TPS6507X_REG_WLED_CTRL1 0X18
+-#define TPS6507X_REG_WLED_CTRL2 0X19
+-
+-/* CON_CTRL1 bitfields */
+-#define TPS6507X_CON_CTRL1_DCDC1_ENABLE BIT(4)
+-#define TPS6507X_CON_CTRL1_DCDC2_ENABLE BIT(3)
+-#define TPS6507X_CON_CTRL1_DCDC3_ENABLE BIT(2)
+-#define TPS6507X_CON_CTRL1_LDO1_ENABLE BIT(1)
+-#define TPS6507X_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_MASK 0X3F
++#include <linux/mfd/tps6507x.h>
+
+ /* DCDC's */
+ #define TPS6507X_DCDC_1 0
+Index: git/drivers/regulator/Kconfig
+===================================================================
+--- git.orig/drivers/regulator/Kconfig 2010-01-11 02:59:57.000000000 -0700
++++ git/drivers/regulator/Kconfig 2010-01-11 02:59:59.000000000 -0700
+@@ -152,6 +152,7 @@
+ config REGULATOR_TPS6507X
+ tristate "TI TPS6507X Power regulators"
+ depends on I2C
++ depends on CPU_FREQ
+ help
+ This driver supports TPS6507X voltage regulator chips. TPS6507X provides
+ three step-down converters and two general-purpose LDO voltage regulators.
+Index: git/include/linux/mfd/tps6507x.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/include/linux/mfd/tps6507x.h 2010-01-11 03:00:38.000000000 -0700
+@@ -0,0 +1,134 @@
++/* linux/mfd/tps6507x.h
++ *
++ * Functions to access TPS65070 power management chip.
++ *
++ * Copyright (c) 2009 RidgeRun (todd.fischer@ridgerun.com)
++ *
++ *
++ * For licencing details see kernel-base/COPYING
++ */
++
++#ifndef __LINUX_MFD_TPS6507X_H
++#define __LINUX_MFD_TPS6507X_H
++
++/*
++ * ----------------------------------------------------------------------------
++ * Registers, all 8 bits
++ * ----------------------------------------------------------------------------
++ */
++
++
++/* Register definitions */
++#define TPS6507X_REG_PPATH1 0X01
++#define TPS6507X_CHG_USB BIT(7)
++#define TPS6507X_CHG_AC BIT(6)
++#define TPS6507X_CHG_USB_PW_ENABLE BIT(5)
++#define TPS6507X_CHG_AC_PW_ENABLE BIT(4)
++#define TPS6507X_CHG_AC_CURRENT BIT(2)
++#define TPS6507X_CHG_USB_CURRENT BIT(0)
++
++#define TPS6507X_REG_INT 0X02
++#define TPS6507X_REG_MASK_AC_USB BIT(7)
++#define TPS6507X_REG_MASK_TSC BIT(6)
++#define TPS6507X_REG_MASK_PB_IN BIT(5)
++#define TPS6507X_REG_TSC_INT BIT(3)
++#define TPS6507X_REG_PB_IN_INT BIT(2)
++#define TPS6507X_REG_AC_USB_APPLIED BIT(1)
++#define TPS6507X_REG_AC_USB_REMOVED BIT(0)
++
++#define TPS6507X_REG_CHGCONFIG0 0X03
++
++#define TPS6507X_REG_CHGCONFIG1 0X04
++#define TPS6507X_CON_CTRL1_DCDC1_ENABLE BIT(4)
++#define TPS6507X_CON_CTRL1_DCDC2_ENABLE BIT(3)
++#define TPS6507X_CON_CTRL1_DCDC3_ENABLE BIT(2)
++#define TPS6507X_CON_CTRL1_LDO1_ENABLE BIT(1)
++#define TPS6507X_CON_CTRL1_LDO2_ENABLE BIT(0)
++
++#define TPS6507X_REG_CHGCONFIG2 0X05
++
++#define TPS6507X_REG_CHGCONFIG3 0X06
++
++#define TPS6507X_REG_ADCONFIG 0X07
++#define TPS6507X_ADCONFIG_AD_ENABLE BIT(7)
++#define TPS6507X_ADCONFIG_START_CONVERSION BIT(6)
++#define TPS6507X_ADCONFIG_CONVERSION_DONE BIT(5)
++#define TPS6507X_ADCONFIG_VREF_ENABLE BIT(4)
++#define TPS6507X_ADCONFIG_INPUT_AD_IN1 0
++#define TPS6507X_ADCONFIG_INPUT_AD_IN2 1
++#define TPS6507X_ADCONFIG_INPUT_AD_IN3 2
++#define TPS6507X_ADCONFIG_INPUT_AD_IN4 3
++#define TPS6507X_ADCONFIG_INPUT_TS_PIN 4
++#define TPS6507X_ADCONFIG_INPUT_BAT_CURRENT 5
++#define TPS6507X_ADCONFIG_INPUT_AC_VOLTAGE 6
++#define TPS6507X_ADCONFIG_INPUT_SYS_VOLTAGE 7
++#define TPS6507X_ADCONFIG_INPUT_CHARGER_VOLTAGE 8
++#define TPS6507X_ADCONFIG_INPUT_BAT_VOLTAGE 9
++#define TPS6507X_ADCONFIG_INPUT_THRESHOLD_VOLTAGE 10
++#define TPS6507X_ADCONFIG_INPUT_ISET1_VOLTAGE 11
++#define TPS6507X_ADCONFIG_INPUT_ISET2_VOLTAGE 12
++#define TPS6507X_ADCONFIG_INPUT_REAL_TSC 14
++#define TPS6507X_ADCONFIG_INPUT_TSC 15
++
++#define TPS6507X_REG_TSCMODE 0X08
++#define TPS6507X_TSCMODE_X_POSITION 0
++#define TPS6507X_TSCMODE_Y_POSITION 1
++#define TPS6507X_TSCMODE_PRESSURE 2
++#define TPS6507X_TSCMODE_X_PLATE 3
++#define TPS6507X_TSCMODE_Y_PLATE 4
++#define TPS6507X_TSCMODE_STANDBY 5
++#define TPS6507X_TSCMODE_ADC_INPUT 6
++#define TPS6507X_TSCMODE_DISABLE 7
++
++#define TPS6507X_REG_ADRESULT_1 0X09
++
++#define TPS6507X_REG_ADRESULT_2 0X0A
++#define TPS6507X_REG_ADRESULT_2_MASK (BIT(1) | BIT(0))
++
++#define TPS6507X_REG_PGOOD 0X0B
++
++#define TPS6507X_REG_PGOODMASK 0X0C
++
++#define TPS6507X_REG_CON_CTRL1 0X0D
++#define TPS6507X_CON_CTRL1_DCDC1_ENABLE BIT(4)
++#define TPS6507X_CON_CTRL1_DCDC2_ENABLE BIT(3)
++#define TPS6507X_CON_CTRL1_DCDC3_ENABLE BIT(2)
++#define TPS6507X_CON_CTRL1_LDO1_ENABLE BIT(1)
++#define TPS6507X_CON_CTRL1_LDO2_ENABLE BIT(0)
++
++#define TPS6507X_REG_CON_CTRL2 0X0E
++
++#define TPS6507X_REG_CON_CTRL3 0X0F
++
++#define TPS6507X_REG_DEFDCDC1 0X10
++#define TPS6507X_DEFDCDC1_DCDC1_EXT_ADJ_EN BIT(7)
++#define TPS6507X_DEFDCDC1_DCDC1_MASK 0X3F
++
++#define TPS6507X_REG_DEFDCDC2_LOW 0X11
++#define TPS6507X_DEFDCDC2_LOW_DCDC2_MASK 0X3F
++
++#define TPS6507X_REG_DEFDCDC2_HIGH 0X12
++#define TPS6507X_DEFDCDC2_HIGH_DCDC2_MASK 0X3F
++
++#define TPS6507X_REG_DEFDCDC3_LOW 0X13
++#define TPS6507X_DEFDCDC3_LOW_DCDC3_MASK 0X3F
++
++#define TPS6507X_REG_DEFDCDC3_HIGH 0X14
++#define TPS6507X_DEFDCDC3_HIGH_DCDC3_MASK 0X3F
++
++#define TPS6507X_REG_DEFSLEW 0X15
++
++#define TPS6507X_REG_LDO_CTRL1 0X16
++#define TPS6507X_REG_LDO_CTRL1_LDO1_MASK 0X0F
++
++#define TPS6507X_REG_DEFLDO2 0X17
++#define TPS6507X_REG_DEFLDO2_LDO2_MASK 0X3F
++
++#define TPS6507X_REG_WLED_CTRL1 0X18
++
++#define TPS6507X_REG_WLED_CTRL2 0X19
++
++/* VDCDC MASK */
++#define TPS6507X_DEFDCDCX_DCDC_MASK 0X3F
++
++#endif /* __LINUX_MFD_TPS6507X_H */
diff --git a/recipes/linux/linux-davinci/0002-tps6507x_regulator_da850_integration.patch b/recipes/linux/linux-davinci/0002-tps6507x_regulator_da850_integration.patch
new file mode 100644
index 0000000000..0cf24d3eb4
--- /dev/null
+++ b/recipes/linux/linux-davinci/0002-tps6507x_regulator_da850_integration.patch
@@ -0,0 +1,83 @@
+Index: git/arch/arm/mach-davinci/board-da850-evm.c
+===================================================================
+--- git.orig/arch/arm/mach-davinci/board-da850-evm.c 2010-01-06 16:23:17.000000000 -0600
++++ git/arch/arm/mach-davinci/board-da850-evm.c 2010-01-12 08:54:24.921995195 -0600
+@@ -17,6 +17,7 @@
+ #include <linux/i2c.h>
+ #include <linux/i2c/at24.h>
+ #include <linux/i2c/pca953x.h>
++#include <linux/mfd/tps6507x.h>
+ #include <linux/gpio.h>
+ #include <linux/platform_device.h>
+ #include <linux/mtd/mtd.h>
+@@ -643,10 +644,14 @@
+ },
+ };
+
++static struct tps6507x_board tps_board = {
++ .tps6507x_pmic_init_data = &tps65070_regulator_data[0],
++};
++
+ static struct i2c_board_info __initdata da850evm_tps65070_info[] = {
+ {
+ I2C_BOARD_INFO("tps6507x", 0x48),
+- .platform_data = &tps65070_regulator_data[0],
++ .platform_data = &tps_board,
+ },
+ };
+
+Index: git/drivers/regulator/tps6507x-regulator.c
+===================================================================
+--- git.orig/drivers/regulator/tps6507x-regulator.c 2010-01-12 08:43:00.561370246 -0600
++++ git/drivers/regulator/tps6507x-regulator.c 2010-01-12 08:53:30.261440110 -0600
+@@ -502,6 +502,7 @@
+ struct regulator_init_data *init_data;
+ struct regulator_dev *rdev;
+ struct tps_pmic *tps;
++ struct tps6507x_board *tps_board;
+ int i;
+
+ if (!i2c_check_functionality(client->adapter,
+@@ -509,10 +510,21 @@
+ return -EIO;
+
+ /**
++ * tps_board points to tps6507x related constants
++ * coming from the board-evm file.
++ */
++
++ tps_board = (struct tps6507x_board *)client->dev.platform_data;
++
++ if (!tps_board)
++ return -EIO;
++
++ /**
+ * init_data points to array of regulator_init structures
+ * coming from the board-evm file.
+ */
+- init_data = client->dev.platform_data;
++
++ init_data = tps_board->tps6507x_pmic_init_data;
+
+ if (!init_data)
+ return -EIO;
+Index: git/include/linux/mfd/tps6507x.h
+===================================================================
+--- git.orig/include/linux/mfd/tps6507x.h 2010-01-12 08:43:00.561370246 -0600
++++ git/include/linux/mfd/tps6507x.h 2010-01-12 08:53:59.849433723 -0600
+@@ -131,4 +131,15 @@
+ /* VDCDC MASK */
+ #define TPS6507X_DEFDCDCX_DCDC_MASK 0X3F
+
++/**
++ * struct tps6507x_board - packages regulator and touchscreen init data
++ * @tps6507x_regulator_data: regulator initialization values
++ *
++ * Board data may be used to initialize regulator and touchscreen.
++ */
++
++struct tps6507x_board {
++ struct regulator_init_data *tps6507x_pmic_init_data;
++};
++
+ #endif /* __LINUX_MFD_TPS6507X_H */
diff --git a/recipes/linux/linux-davinci/0003-tps6507x_mfd_driver.patch b/recipes/linux/linux-davinci/0003-tps6507x_mfd_driver.patch
new file mode 100644
index 0000000000..0acbf8a26b
--- /dev/null
+++ b/recipes/linux/linux-davinci/0003-tps6507x_mfd_driver.patch
@@ -0,0 +1,214 @@
+Index: git/drivers/mfd/Kconfig
+===================================================================
+--- git.orig/drivers/mfd/Kconfig 2010-01-06 16:23:19.000000000 -0600
++++ git/drivers/mfd/Kconfig 2010-01-12 08:43:00.961383768 -0600
+@@ -84,6 +84,17 @@
+ This driver can also be built as a module. If so, the module
+ will be called tps65010.
+
++config TPS6507x
++ tristate "TPS6507x Power Management / Touch Screen chips"
++ depends on I2C
++ help
++ If you say yes here you get support for the TPS6507x series of
++ Power Management / Touch Screen chips. These include voltage
++ regulators, lithium ion/polymer battery charging, touch screen
++ and other features that are often used in portable devices.
++ This driver can also be built as a module. If so, the module
++ will be called tps6507x.
++
+ config MENELAUS
+ bool "Texas Instruments TWL92330/Menelaus PM chip"
+ depends on I2C=y && ARCH_OMAP24XX
+Index: git/drivers/mfd/Makefile
+===================================================================
+--- git.orig/drivers/mfd/Makefile 2010-01-06 16:23:19.000000000 -0600
++++ git/drivers/mfd/Makefile 2010-01-12 08:43:00.961383768 -0600
+@@ -22,6 +22,7 @@
+ obj-$(CONFIG_MFD_WM8350_I2C) += wm8350-i2c.o
+
+ obj-$(CONFIG_TPS65010) += tps65010.o
++obj-$(CONFIG_TPS6507x) += tps6507x.o
+ obj-$(CONFIG_MENELAUS) += menelaus.o
+
+ obj-$(CONFIG_TWL4030_CORE) += twl4030-core.o twl4030-irq.o
+Index: git/drivers/mfd/tps6507x.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/drivers/mfd/tps6507x.c 2010-01-12 08:53:53.009504942 -0600
+@@ -0,0 +1,139 @@
++/*
++ * tps6507x.c -- TPS6507x chip family multi-function driver
++ *
++ * Copyright (c) 2010 RidgeRun (todd.fischer@ridgerun.com)
++ *
++ * Author: Todd Fischer
++ * todd.fischer@ridgerun.com
++ *
++ * Credits:
++ *
++ * Using code from wm8350-i2c.c, Wolfson Microelectronics PLC.
++ *
++ * For licencing details see kernel-base/COPYING
++ *
++ */
++
++#include <linux/module.h>
++#include <linux/moduleparam.h>
++#include <linux/init.h>
++#include <linux/i2c.h>
++#include <linux/platform_device.h>
++#include <linux/mfd/tps6507x.h>
++
++static int tps6507x_i2c_read_device(struct tps6507x_dev *tps6507x, char reg,
++ int bytes, void *dest)
++{
++ int ret;
++
++ ret = i2c_master_send(tps6507x->i2c_client, &reg, 1);
++ if (ret < 0)
++ return ret;
++ ret = i2c_master_recv(tps6507x->i2c_client, dest, bytes);
++ if (ret < 0)
++ return ret;
++ if (ret != bytes)
++ return -EIO;
++ return 0;
++}
++
++static int tps6507x_i2c_write_device(struct tps6507x_dev *tps6507x, char reg,
++ int bytes, void *src)
++{
++ /* we add 1 byte for device register */
++ u8 msg[(TPS6507X_MAX_REGISTER << 1) + 1];
++ int ret;
++
++ if (bytes > ((TPS6507X_MAX_REGISTER << 1) + 1))
++ return -EINVAL;
++
++ msg[0] = reg;
++ memcpy(&msg[1], src, bytes);
++ ret = i2c_master_send(tps6507x->i2c_client, msg, bytes + 1);
++ if (ret < 0)
++ return ret;
++ if (ret != bytes + 1)
++ return -EIO;
++ return 0;
++}
++
++
++int tps6507x_device_init(struct tps6507x_dev *tps6507x, int irq,
++ struct tps6507x_board *pdata)
++{
++ int ret = 0;
++
++ return ret;
++}
++
++static int tps6507x_i2c_probe(struct i2c_client *i2c,
++ const struct i2c_device_id *id)
++{
++ struct tps6507x_dev *tps6507x;
++ int ret = 0;
++
++ tps6507x = kzalloc(sizeof(struct tps6507x_dev), GFP_KERNEL);
++ if (tps6507x == NULL) {
++ kfree(i2c);
++ return -ENOMEM;
++ }
++
++ i2c_set_clientdata(i2c, tps6507x);
++ tps6507x->dev = &i2c->dev;
++ tps6507x->i2c_client = i2c;
++ tps6507x->read_dev = tps6507x_i2c_read_device;
++ tps6507x->write_dev = tps6507x_i2c_write_device;
++ mutex_init(&tps6507x->adc_mutex);
++
++ ret = tps6507x_device_init(tps6507x, i2c->irq, i2c->dev.platform_data);
++ if (ret < 0)
++ goto err;
++
++ return ret;
++
++err:
++ kfree(tps6507x);
++ return ret;
++}
++
++static int tps6507x_i2c_remove(struct i2c_client *i2c)
++{
++ struct tps6507x_dev *tps6507x = i2c_get_clientdata(i2c);
++
++ kfree(tps6507x);
++
++ return 0;
++}
++
++static const struct i2c_device_id tps6507x_i2c_id[] = {
++ { "tps6507x", 0 },
++ { }
++};
++MODULE_DEVICE_TABLE(i2c, tps6507x_i2c_id);
++
++
++static struct i2c_driver tps6507x_i2c_driver = {
++ .driver = {
++ .name = "tps6507x",
++ .owner = THIS_MODULE,
++ },
++ .probe = tps6507x_i2c_probe,
++ .remove = tps6507x_i2c_remove,
++ .id_table = tps6507x_i2c_id,
++};
++
++static int __init tps6507x_i2c_init(void)
++{
++ return i2c_add_driver(&tps6507x_i2c_driver);
++}
++/* init early so consumer devices can complete system boot */
++subsys_initcall(tps6507x_i2c_init);
++
++static void __exit tps6507x_i2c_exit(void)
++{
++ i2c_del_driver(&tps6507x_i2c_driver);
++}
++module_exit(tps6507x_i2c_exit);
++
++MODULE_DESCRIPTION("TPS6507x chip family multi-function driver")
++MODULE_LICENSE("GPL");
+Index: git/include/linux/mfd/tps6507x.h
+===================================================================
+--- git.orig/include/linux/mfd/tps6507x.h 2010-01-12 08:43:00.797384396 -0600
++++ git/include/linux/mfd/tps6507x.h 2010-01-12 08:53:28.437624848 -0600
+@@ -131,6 +131,8 @@
+ /* VDCDC MASK */
+ #define TPS6507X_DEFDCDCX_DCDC_MASK 0X3F
+
++#define TPS6507X_MAX_REGISTER 0X19
++
+ /**
+ * struct tps6507x_board - packages regulator and touchscreen init data
+ * @tps6507x_regulator_data: regulator initialization values
+@@ -142,4 +144,22 @@
+ struct regulator_init_data *tps6507x_pmic_init_data;
+ };
+
++/**
++ * struct tps6507x_dev - tps6507x sub-driver chip access routines
++ * @read_dev() - I2C register read function
++ * @write_dev() - I2C register write function
++ *
++ * Device data may be used to access the TPS6507x chip
++ */
++
++struct tps6507x_dev {
++ struct device *dev;
++ struct i2c_client *i2c_client;
++ int (*read_dev)(struct tps6507x_dev *tps6507x, char reg, int size,
++ void *dest);
++ int (*write_dev)(struct tps6507x_dev *tps6507x, char reg, int size,
++ void *src);
++ struct mutex adc_mutex;
++};
++
+ #endif /* __LINUX_MFD_TPS6507X_H */
diff --git a/recipes/linux/linux-davinci/0004-tps6507x_regulator_naming_change.patch b/recipes/linux/linux-davinci/0004-tps6507x_regulator_naming_change.patch
new file mode 100644
index 0000000000..2bd9ac174b
--- /dev/null
+++ b/recipes/linux/linux-davinci/0004-tps6507x_regulator_naming_change.patch
@@ -0,0 +1,418 @@
+Index: git/drivers/regulator/tps6507x-regulator.c
+===================================================================
+--- git.orig/drivers/regulator/tps6507x-regulator.c 2010-01-09 17:30:10.000000000 -0700
++++ git/drivers/regulator/tps6507x-regulator.c 2010-01-09 17:31:39.000000000 -0700
+@@ -113,23 +113,23 @@
+ struct mutex io_lock;
+ };
+
+-static inline int tps_6507x_read(struct tps_pmic *tps, u8 reg)
++static inline int tps6507x_pmic_read(struct tps_pmic *tps, u8 reg)
+ {
+ return i2c_smbus_read_byte_data(tps->client, reg);
+ }
+
+-static inline int tps_6507x_write(struct tps_pmic *tps, u8 reg, u8 val)
++static inline int tps6507x_pmic_write(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)
++static int tps6507x_pmic_set_bits(struct tps_pmic *tps, u8 reg, u8 mask)
+ {
+ int err, data;
+
+ mutex_lock(&tps->io_lock);
+
+- data = tps_6507x_read(tps, reg);
++ data = tps6507x_pmic_read(tps, reg);
+ if (data < 0) {
+ dev_err(&tps->client->dev, "Read from reg 0x%x failed\n", reg);
+ err = data;
+@@ -137,7 +137,7 @@
+ }
+
+ data |= mask;
+- err = tps_6507x_write(tps, reg, data);
++ err = tps6507x_pmic_write(tps, reg, data);
+ if (err)
+ dev_err(&tps->client->dev, "Write for reg 0x%x failed\n", reg);
+
+@@ -146,13 +146,13 @@
+ return err;
+ }
+
+-static int tps_6507x_clear_bits(struct tps_pmic *tps, u8 reg, u8 mask)
++static int tps6507x_pmic_clear_bits(struct tps_pmic *tps, u8 reg, u8 mask)
+ {
+ int err, data;
+
+ mutex_lock(&tps->io_lock);
+
+- data = tps_6507x_read(tps, reg);
++ data = tps6507x_pmic_read(tps, reg);
+ if (data < 0) {
+ dev_err(&tps->client->dev, "Read from reg 0x%x failed\n", reg);
+ err = data;
+@@ -160,7 +160,7 @@
+ }
+
+ data &= ~mask;
+- err = tps_6507x_write(tps, reg, data);
++ err = tps6507x_pmic_write(tps, reg, data);
+ if (err)
+ dev_err(&tps->client->dev, "Write for reg 0x%x failed\n", reg);
+
+@@ -169,13 +169,13 @@
+ return err;
+ }
+
+-static int tps_6507x_reg_read(struct tps_pmic *tps, u8 reg)
++static int tps6507x_pmic_reg_read(struct tps_pmic *tps, u8 reg)
+ {
+ int data;
+
+ mutex_lock(&tps->io_lock);
+
+- data = tps_6507x_read(tps, reg);
++ data = tps6507x_pmic_read(tps, reg);
+ if (data < 0)
+ dev_err(&tps->client->dev, "Read from reg 0x%x failed\n", reg);
+
+@@ -183,13 +183,13 @@
+ return data;
+ }
+
+-static int tps_6507x_reg_write(struct tps_pmic *tps, u8 reg, u8 val)
++static int tps6507x_pmic_reg_write(struct tps_pmic *tps, u8 reg, u8 val)
+ {
+ int err;
+
+ mutex_lock(&tps->io_lock);
+
+- err = tps_6507x_write(tps, reg, val);
++ err = tps6507x_pmic_write(tps, reg, val);
+ if (err < 0)
+ dev_err(&tps->client->dev, "Write for reg 0x%x failed\n", reg);
+
+@@ -197,7 +197,7 @@
+ return err;
+ }
+
+-static int tps6507x_dcdc_is_enabled(struct regulator_dev *dev)
++static int tps6507x_pmic_dcdc_is_enabled(struct regulator_dev *dev)
+ {
+ struct tps_pmic *tps = rdev_get_drvdata(dev);
+ int data, dcdc = rdev_get_id(dev);
+@@ -207,7 +207,7 @@
+ return -EINVAL;
+
+ shift = TPS6507X_MAX_REG_ID - dcdc;
+- data = tps_6507x_reg_read(tps, TPS6507X_REG_CON_CTRL1);
++ data = tps6507x_pmic_reg_read(tps, TPS6507X_REG_CON_CTRL1);
+
+ if (data < 0)
+ return data;
+@@ -215,7 +215,7 @@
+ return (data & 1<<shift) ? 1 : 0;
+ }
+
+-static int tps6507x_ldo_is_enabled(struct regulator_dev *dev)
++static int tps6507x_pmic_ldo_is_enabled(struct regulator_dev *dev)
+ {
+ struct tps_pmic *tps = rdev_get_drvdata(dev);
+ int data, ldo = rdev_get_id(dev);
+@@ -225,7 +225,7 @@
+ return -EINVAL;
+
+ shift = TPS6507X_MAX_REG_ID - ldo;
+- data = tps_6507x_reg_read(tps, TPS6507X_REG_CON_CTRL1);
++ data = tps6507x_pmic_reg_read(tps, TPS6507X_REG_CON_CTRL1);
+
+ if (data < 0)
+ return data;
+@@ -233,7 +233,7 @@
+ return (data & 1<<shift) ? 1 : 0;
+ }
+
+-static int tps6507x_dcdc_enable(struct regulator_dev *dev)
++static int tps6507x_pmic_dcdc_enable(struct regulator_dev *dev)
+ {
+ struct tps_pmic *tps = rdev_get_drvdata(dev);
+ int dcdc = rdev_get_id(dev);
+@@ -243,10 +243,10 @@
+ return -EINVAL;
+
+ shift = TPS6507X_MAX_REG_ID - dcdc;
+- return tps_6507x_set_bits(tps, TPS6507X_REG_CON_CTRL1, 1 << shift);
++ return tps6507x_pmic_set_bits(tps, TPS6507X_REG_CON_CTRL1, 1 << shift);
+ }
+
+-static int tps6507x_dcdc_disable(struct regulator_dev *dev)
++static int tps6507x_pmic_dcdc_disable(struct regulator_dev *dev)
+ {
+ struct tps_pmic *tps = rdev_get_drvdata(dev);
+ int dcdc = rdev_get_id(dev);
+@@ -256,10 +256,10 @@
+ return -EINVAL;
+
+ shift = TPS6507X_MAX_REG_ID - dcdc;
+- return tps_6507x_clear_bits(tps, TPS6507X_REG_CON_CTRL1, 1 << shift);
++ return tps6507x_pmic_clear_bits(tps, TPS6507X_REG_CON_CTRL1, 1 << shift);
+ }
+
+-static int tps6507x_ldo_enable(struct regulator_dev *dev)
++static int tps6507x_pmic_ldo_enable(struct regulator_dev *dev)
+ {
+ struct tps_pmic *tps = rdev_get_drvdata(dev);
+ int ldo = rdev_get_id(dev);
+@@ -269,10 +269,10 @@
+ return -EINVAL;
+
+ shift = TPS6507X_MAX_REG_ID - ldo;
+- return tps_6507x_set_bits(tps, TPS6507X_REG_CON_CTRL1, 1 << shift);
++ return tps6507x_pmic_set_bits(tps, TPS6507X_REG_CON_CTRL1, 1 << shift);
+ }
+
+-static int tps6507x_ldo_disable(struct regulator_dev *dev)
++static int tps6507x_pmic_ldo_disable(struct regulator_dev *dev)
+ {
+ struct tps_pmic *tps = rdev_get_drvdata(dev);
+ int ldo = rdev_get_id(dev);
+@@ -282,10 +282,10 @@
+ return -EINVAL;
+
+ shift = TPS6507X_MAX_REG_ID - ldo;
+- return tps_6507x_clear_bits(tps, TPS6507X_REG_CON_CTRL1, 1 << shift);
++ return tps6507x_pmic_clear_bits(tps, TPS6507X_REG_CON_CTRL1, 1 << shift);
+ }
+
+-static int tps6507x_dcdc_get_voltage(struct regulator_dev *dev)
++static int tps6507x_pmic_dcdc_get_voltage(struct regulator_dev *dev)
+ {
+ struct tps_pmic *tps = rdev_get_drvdata(dev);
+ int data, dcdc = rdev_get_id(dev);
+@@ -311,7 +311,7 @@
+ return -EINVAL;
+ }
+
+- data = tps_6507x_reg_read(tps, reg);
++ data = tps6507x_pmic_reg_read(tps, reg);
+ if (data < 0)
+ return data;
+
+@@ -319,7 +319,7 @@
+ return tps->info[dcdc]->table[data] * 1000;
+ }
+
+-static int tps6507x_dcdc_set_voltage(struct regulator_dev *dev,
++static int tps6507x_pmic_dcdc_set_voltage(struct regulator_dev *dev,
+ int min_uV, int max_uV)
+ {
+ struct tps_pmic *tps = rdev_get_drvdata(dev);
+@@ -366,17 +366,17 @@
+ if (vsel == tps->info[dcdc]->table_len)
+ return -EINVAL;
+
+- data = tps_6507x_reg_read(tps, reg);
++ data = tps6507x_pmic_reg_read(tps, reg);
+ if (data < 0)
+ return data;
+
+ data &= ~TPS6507X_DEFDCDCX_DCDC_MASK;
+ data |= vsel;
+
+- return tps_6507x_reg_write(tps, reg, data);
++ return tps6507x_pmic_reg_write(tps, reg, data);
+ }
+
+-static int tps6507x_ldo_get_voltage(struct regulator_dev *dev)
++static int tps6507x_pmic_ldo_get_voltage(struct regulator_dev *dev)
+ {
+ struct tps_pmic *tps = rdev_get_drvdata(dev);
+ int data, ldo = rdev_get_id(dev);
+@@ -392,7 +392,7 @@
+ TPS6507X_REG_DEFLDO2_LDO2_MASK);
+ }
+
+- data = tps_6507x_reg_read(tps, reg);
++ data = tps6507x_pmic_reg_read(tps, reg);
+ if (data < 0)
+ return data;
+
+@@ -400,7 +400,7 @@
+ return tps->info[ldo]->table[data] * 1000;
+ }
+
+-static int tps6507x_ldo_set_voltage(struct regulator_dev *dev,
++static int tps6507x_pmic_ldo_set_voltage(struct regulator_dev *dev,
+ int min_uV, int max_uV)
+ {
+ struct tps_pmic *tps = rdev_get_drvdata(dev);
+@@ -434,17 +434,17 @@
+ if (vsel == tps->info[ldo]->table_len)
+ return -EINVAL;
+
+- data = tps_6507x_reg_read(tps, reg);
++ data = tps6507x_pmic_reg_read(tps, reg);
+ if (data < 0)
+ return data;
+
+ data &= ~mask;
+ data |= vsel;
+
+- return tps_6507x_reg_write(tps, reg, data);
++ return tps6507x_pmic_reg_write(tps, reg, data);
+ }
+
+-static int tps6507x_dcdc_list_voltage(struct regulator_dev *dev,
++static int tps6507x_pmic_dcdc_list_voltage(struct regulator_dev *dev,
+ unsigned selector)
+ {
+ struct tps_pmic *tps = rdev_get_drvdata(dev);
+@@ -459,7 +459,7 @@
+ return tps->info[dcdc]->table[selector] * 1000;
+ }
+
+-static int tps6507x_ldo_list_voltage(struct regulator_dev *dev,
++static int tps6507x_pmic_ldo_list_voltage(struct regulator_dev *dev,
+ unsigned selector)
+ {
+ struct tps_pmic *tps = rdev_get_drvdata(dev);
+@@ -475,27 +475,27 @@
+ }
+
+ /* Operations permitted on VDCDCx */
+-static struct regulator_ops tps6507x_dcdc_ops = {
+- .is_enabled = tps6507x_dcdc_is_enabled,
+- .enable = tps6507x_dcdc_enable,
+- .disable = tps6507x_dcdc_disable,
+- .get_voltage = tps6507x_dcdc_get_voltage,
+- .set_voltage = tps6507x_dcdc_set_voltage,
+- .list_voltage = tps6507x_dcdc_list_voltage,
++static struct regulator_ops tps6507x_pmic_dcdc_ops = {
++ .is_enabled = tps6507x_pmic_dcdc_is_enabled,
++ .enable = tps6507x_pmic_dcdc_enable,
++ .disable = tps6507x_pmic_dcdc_disable,
++ .get_voltage = tps6507x_pmic_dcdc_get_voltage,
++ .set_voltage = tps6507x_pmic_dcdc_set_voltage,
++ .list_voltage = tps6507x_pmic_dcdc_list_voltage,
+ };
+
+ /* Operations permitted on LDOx */
+-static struct regulator_ops tps6507x_ldo_ops = {
+- .is_enabled = tps6507x_ldo_is_enabled,
+- .enable = tps6507x_ldo_enable,
+- .disable = tps6507x_ldo_disable,
+- .get_voltage = tps6507x_ldo_get_voltage,
+- .set_voltage = tps6507x_ldo_set_voltage,
+- .list_voltage = tps6507x_ldo_list_voltage,
++static struct regulator_ops tps6507x_pmic_ldo_ops = {
++ .is_enabled = tps6507x_pmic_ldo_is_enabled,
++ .enable = tps6507x_pmic_ldo_enable,
++ .disable = tps6507x_pmic_ldo_disable,
++ .get_voltage = tps6507x_pmic_ldo_get_voltage,
++ .set_voltage = tps6507x_pmic_ldo_set_voltage,
++ .list_voltage = tps6507x_pmic_ldo_list_voltage,
+ };
+
+ static
+-int tps_6507x_probe(struct i2c_client *client, const struct i2c_device_id *id)
++int tps6507x_pmic_probe(struct i2c_client *client, const struct i2c_device_id *id)
+ {
+ static int desc_id;
+ struct tps_info *info = (void *)id->driver_data;
+@@ -546,7 +546,7 @@
+ tps->desc[i].id = desc_id++;
+ tps->desc[i].n_voltages = num_voltages[i];
+ tps->desc[i].ops = (i > TPS6507X_DCDC_3 ?
+- &tps6507x_ldo_ops : &tps6507x_dcdc_ops);
++ &tps6507x_pmic_ldo_ops : &tps6507x_pmic_dcdc_ops);
+ tps->desc[i].type = REGULATOR_VOLTAGE;
+ tps->desc[i].owner = THIS_MODULE;
+
+@@ -579,12 +579,12 @@
+ }
+
+ /**
+- * tps_6507x_remove - TPS6507x driver i2c remove handler
++ * tps6507x_remove - TPS6507x driver i2c remove handler
+ * @client: i2c driver client device structure
+ *
+ * Unregister TPS driver as an i2c client device driver
+ */
+-static int __devexit tps_6507x_remove(struct i2c_client *client)
++static int __devexit tps6507x_pmic_remove(struct i2c_client *client)
+ {
+ struct tps_pmic *tps = i2c_get_clientdata(client);
+ int i;
+@@ -601,7 +601,7 @@
+ return 0;
+ }
+
+-static const struct tps_info tps6507x_regs[] = {
++static const struct tps_info tps6507x_pmic_regs[] = {
+ {
+ .name = "VDCDC1",
+ .min_uV = 725000,
+@@ -639,44 +639,44 @@
+ },
+ };
+
+-static const struct i2c_device_id tps_6507x_id[] = {
++static const struct i2c_device_id tps6507x_pmic_id[] = {
+ {.name = "tps6507x",
+- .driver_data = (unsigned long) tps6507x_regs,},
++ .driver_data = (unsigned long) tps6507x_pmic_regs,},
+ { },
+ };
+-MODULE_DEVICE_TABLE(i2c, tps_6507x_id);
++MODULE_DEVICE_TABLE(i2c, tps6507x_pmic_id);
+
+-static struct i2c_driver tps_6507x_i2c_driver = {
++static struct i2c_driver tps6507x_i2c_driver = {
+ .driver = {
+ .name = "tps6507x",
+ .owner = THIS_MODULE,
+ },
+- .probe = tps_6507x_probe,
+- .remove = __devexit_p(tps_6507x_remove),
+- .id_table = tps_6507x_id,
++ .probe = tps6507x_pmic_probe,
++ .remove = __devexit_p(tps6507x_pmic_remove),
++ .id_table = tps6507x_pmic_id,
+ };
+
+ /**
+- * tps_6507x_init
++ * tps6507x_pmic_init
+ *
+ * Module init function
+ */
+-static int __init tps_6507x_init(void)
++static int __init tps6507x_pmic_init(void)
+ {
+- return i2c_add_driver(&tps_6507x_i2c_driver);
++ return i2c_add_driver(&tps6507x_i2c_driver);
+ }
+-subsys_initcall(tps_6507x_init);
++subsys_initcall(tps6507x_pmic_init);
+
+ /**
+- * tps_6507x_cleanup
++ * tps6507x_pmic_cleanup
+ *
+ * Module exit function
+ */
+-static void __exit tps_6507x_cleanup(void)
++static void __exit tps6507x_pmic_cleanup(void)
+ {
+- i2c_del_driver(&tps_6507x_i2c_driver);
++ i2c_del_driver(&tps6507x_i2c_driver);
+ }
+-module_exit(tps_6507x_cleanup);
++module_exit(tps6507x_pmic_cleanup);
+
+ MODULE_AUTHOR("Texas Instruments");
+ MODULE_DESCRIPTION("TPS6507x voltage regulator driver");
diff --git a/recipes/linux/linux-davinci/0005-tps6507x_regulator_mfd_integration.patch b/recipes/linux/linux-davinci/0005-tps6507x_regulator_mfd_integration.patch
new file mode 100644
index 0000000000..d962e82b6d
--- /dev/null
+++ b/recipes/linux/linux-davinci/0005-tps6507x_regulator_mfd_integration.patch
@@ -0,0 +1,397 @@
+Index: git/drivers/mfd/tps6507x.c
+===================================================================
+--- git.orig/drivers/mfd/tps6507x.c 2010-01-12 08:43:00.961383768 -0600
++++ git/drivers/mfd/tps6507x.c 2010-01-12 08:52:41.725819096 -0600
+@@ -57,12 +57,40 @@
+ return 0;
+ }
+
++/*
++ * Register a client device. This is non-fatal since there is no need to
++ * fail the entire device init due to a single platform device failing.
++ */
++static void tps6507x_client_dev_register(struct tps6507x_dev *tps6507x,
++ const char *name,
++ struct platform_device **pdev)
++{
++ int ret;
++
++ *pdev = platform_device_alloc(name, -1);
++ if (*pdev == NULL) {
++ dev_err(tps6507x->dev, "Failed to allocate %s\n", name);
++ return;
++ }
++
++ (*pdev)->dev.parent = tps6507x->dev;