linux-davinci: Add MFD Touchscreen Driver from RidgeRun for da850-omapl138
authorRoger Monk <r-monk@ti.com>
Wed, 13 Jan 2010 21:45:13 +0000 (21:45 +0000)
committerKoen Kooi <koen@openembedded.org>
Mon, 12 Apr 2010 17:43:10 +0000 (19:43 +0200)
 * 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>
recipes/linux/linux-davinci/0001-tps6507x_regulator_refactor.patch [new file with mode: 0644]
recipes/linux/linux-davinci/0002-tps6507x_regulator_da850_integration.patch [new file with mode: 0644]
recipes/linux/linux-davinci/0003-tps6507x_mfd_driver.patch [new file with mode: 0644]
recipes/linux/linux-davinci/0004-tps6507x_regulator_naming_change.patch [new file with mode: 0644]
recipes/linux/linux-davinci/0005-tps6507x_regulator_mfd_integration.patch [new file with mode: 0644]
recipes/linux/linux-davinci/0006-tps6507x_touchscreen_driver.patch [new file with mode: 0644]
recipes/linux/linux-davinci/da850-omapl138-evm/defconfig
recipes/linux/linux-davinci/da850_omapl138_opp456mhz_increaseDcDc3.patch
recipes/linux/linux-davinci_git.bb

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 (file)
index 0000000..b3050c6
--- /dev/null
@@ -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 (file)
index 0000000..0cf24d3
--- /dev/null
@@ -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 (file)
index 0000000..0acbf8a
--- /dev/null
@@ -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 (file)
index 0000000..2bd9ac1
--- /dev/null
@@ -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 (file)
index 0000000..d962e82
--- /dev/null
@@ -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;
++      platform_set_drvdata(*pdev, tps6507x);
++      ret = platform_device_add(*pdev);
++      if (ret != 0) {
++              dev_err(tps6507x->dev, "Failed to register %s: %d\n", name, ret);
++              platform_device_put(*pdev);
++              *pdev = NULL;
++      }
++}
+ int tps6507x_device_init(struct tps6507x_dev *tps6507x, int irq,
+                      struct tps6507x_board *pdata)
+ {
+       int ret = 0;
++      struct platform_device *pdev;
++      tps6507x_client_dev_register(tps6507x, "tps6507x-pmic",
++                                   &pdev);
+       return ret;
+ }
+@@ -71,7 +99,6 @@
+ {
+       struct tps6507x_dev *tps6507x;
+       int ret = 0;
+-
+       tps6507x = kzalloc(sizeof(struct tps6507x_dev), GFP_KERNEL);
+       if (tps6507x == NULL) {
+               kfree(i2c);
+Index: git/drivers/regulator/tps6507x-regulator.c
+===================================================================
+--- git.orig/drivers/regulator/tps6507x-regulator.c    2010-01-12 08:43:01.125399079 -0600
++++ git/drivers/regulator/tps6507x-regulator.c 2010-01-12 08:53:16.586248235 -0600
+@@ -22,7 +22,6 @@
+ #include <linux/platform_device.h>
+ #include <linux/regulator/driver.h>
+ #include <linux/regulator/machine.h>
+-#include <linux/i2c.h>
+ #include <linux/delay.h>
+ #include <linux/mfd/tps6507x.h>
+@@ -105,9 +104,47 @@
+       unsigned reg_high:1;
+ };
++static const struct tps_info tps6507x_pmic_regs[] = {
++      {
++              .name = "VDCDC1",
++              .min_uV = 725000,
++              .max_uV = 3300000,
++              .table_len = ARRAY_SIZE(VDCDCx_VSEL_table),
++              .table = VDCDCx_VSEL_table,
++      },
++      {
++              .name = "VDCDC2",
++              .min_uV = 725000,
++              .max_uV = 3300000,
++              .table_len = ARRAY_SIZE(VDCDCx_VSEL_table),
++              .table = VDCDCx_VSEL_table,
++      },
++      {
++              .name = "VDCDC3",
++              .min_uV = 725000,
++              .max_uV = 3300000,
++              .table_len = ARRAY_SIZE(VDCDCx_VSEL_table),
++              .table = VDCDCx_VSEL_table,
++      },
++      {
++              .name = "LDO1",
++              .min_uV = 1000000,
++              .max_uV = 3300000,
++              .table_len = ARRAY_SIZE(LDO1_VSEL_table),
++              .table = LDO1_VSEL_table,
++      },
++      {
++              .name = "LDO2",
++              .min_uV = 725000,
++              .max_uV = 3300000,
++              .table_len = ARRAY_SIZE(LDO2_VSEL_table),
++              .table = LDO2_VSEL_table,
++      },
++};
++
+ struct tps_pmic {
+       struct regulator_desc desc[TPS6507X_NUM_REGULATOR];
+-      struct i2c_client *client;
++      struct tps6507x_dev *mfd;
+       struct regulator_dev *rdev[TPS6507X_NUM_REGULATOR];
+       struct tps_info *info[TPS6507X_NUM_REGULATOR];
+       struct mutex io_lock;
+@@ -115,12 +152,21 @@
+ static inline int tps6507x_pmic_read(struct tps_pmic *tps, u8 reg)
+ {
+-      return i2c_smbus_read_byte_data(tps->client, reg);
++      u8 val;
++      int err;
++
++      err = tps->mfd->read_dev(tps->mfd, reg, 1, &val);
++
++      if (err) {
++              return err;
++      }
++
++      return 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);
++      return tps->mfd->write_dev(tps->mfd, reg, 1, &val);
+ }
+ static int tps6507x_pmic_set_bits(struct tps_pmic *tps, u8 reg, u8 mask)
+@@ -131,7 +177,7 @@
+       data = tps6507x_pmic_read(tps, reg);
+       if (data < 0) {
+-              dev_err(&tps->client->dev, "Read from reg 0x%x failed\n", reg);
++              dev_err(tps->mfd->dev, "Read from reg 0x%x failed\n", reg);
+               err = data;
+               goto out;
+       }
+@@ -139,7 +185,7 @@
+       data |= mask;
+       err = tps6507x_pmic_write(tps, reg, data);
+       if (err)
+-              dev_err(&tps->client->dev, "Write for reg 0x%x failed\n", reg);
++              dev_err(tps->mfd->dev, "Write for reg 0x%x failed\n", reg);
+ out:
+       mutex_unlock(&tps->io_lock);
+@@ -154,7 +200,7 @@
+       data = tps6507x_pmic_read(tps, reg);
+       if (data < 0) {
+-              dev_err(&tps->client->dev, "Read from reg 0x%x failed\n", reg);
++              dev_err(tps->mfd->dev, "Read from reg 0x%x failed\n", reg);
+               err = data;
+               goto out;
+       }
+@@ -162,7 +208,7 @@
+       data &= ~mask;
+       err = tps6507x_pmic_write(tps, reg, data);
+       if (err)
+-              dev_err(&tps->client->dev, "Write for reg 0x%x failed\n", reg);
++              dev_err(tps->mfd->dev, "Write for reg 0x%x failed\n", reg);
+ out:
+       mutex_unlock(&tps->io_lock);
+@@ -177,7 +223,7 @@
+       data = tps6507x_pmic_read(tps, reg);
+       if (data < 0)
+-              dev_err(&tps->client->dev, "Read from reg 0x%x failed\n", reg);
++              dev_err(tps->mfd->dev, "Read from reg 0x%x failed\n", reg);
+       mutex_unlock(&tps->io_lock);
+       return data;
+@@ -191,7 +237,7 @@
+       err = tps6507x_pmic_write(tps, reg, val);
+       if (err < 0)
+-              dev_err(&tps->client->dev, "Write for reg 0x%x failed\n", reg);
++              dev_err(tps->mfd->dev, "Write for reg 0x%x failed\n", reg);
+       mutex_unlock(&tps->io_lock);
+       return err;
+@@ -494,27 +540,24 @@
+       .list_voltage = tps6507x_pmic_ldo_list_voltage,
+ };
+-static
+-int tps6507x_pmic_probe(struct i2c_client *client, const struct i2c_device_id *id)
++static __devinit
++int tps6507x_pmic_probe(struct platform_device *pdev)
+ {
++      struct tps6507x_dev *tps6507x_dev = platform_get_drvdata(pdev);
+       static int desc_id;
+-      struct tps_info *info = (void *)id->driver_data;
++      struct tps_info *info = &tps6507x_pmic_regs[0];
+       struct regulator_init_data *init_data;
+       struct regulator_dev *rdev;
+       struct tps_pmic *tps;
+-        struct tps6507x_board *tps_board;
++      struct tps6507x_board *tps_board;
+       int i;
+-      if (!i2c_check_functionality(client->adapter,
+-                              I2C_FUNC_SMBUS_BYTE_DATA))
+-              return -EIO;
+-
+       /**
+-       * tps_board points to tps6507x related constants
++       * tps_board points to pmic related constants
+        * coming from the board-evm file.
+        */
+-        tps_board = (struct tps6507x_board *)client->dev.platform_data;
++      tps_board = (struct tps6507x_board *)tps6507x_dev->dev->platform_data;
+       if (!tps_board)
+               return -EIO;
+@@ -536,7 +579,7 @@
+       mutex_init(&tps->io_lock);
+       /* common for all regulators */
+-      tps->client = client;
++      tps->mfd = tps6507x_dev;
+       for (i = 0; i < TPS6507X_NUM_REGULATOR; i++, info++, init_data++) {
+               /* Register the regulators */
+@@ -551,19 +594,16 @@
+               tps->desc[i].owner = THIS_MODULE;
+               rdev = regulator_register(&tps->desc[i],
+-                                      &client->dev, init_data, tps);
++                                      tps6507x_dev->dev, init_data, tps);
+               if (IS_ERR(rdev)) {
+-                      dev_err(&client->dev, "failed to register %s\n",
+-                              id->name);
++                      dev_err(tps6507x_dev->dev, "failed to register %s regulator\n",
++                              pdev->name);
+                       /* Unregister */
+                       while (i)
+                               regulator_unregister(tps->rdev[--i]);
+-                      tps->client = NULL;
+-
+-                      /* clear the client data in i2c */
+-                      i2c_set_clientdata(client, NULL);
++              tps->mfd = NULL;
+                       kfree(tps);
+                       return PTR_ERR(rdev);
+@@ -573,87 +613,34 @@
+               tps->rdev[i] = rdev;
+       }
+-      i2c_set_clientdata(client, tps);
++//    tps6507x_dev->pmic.pdev = pdev; // XXXX - but tps6507x_dev is pdev !!!
+       return 0;
+ }
+-/**
+- * 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 tps6507x_pmic_remove(struct i2c_client *client)
++static int __devexit tps6507x_pmic_remove(struct platform_device *pdev)
+ {
+-      struct tps_pmic *tps = i2c_get_clientdata(client);
++
++      struct tps_pmic *tps = platform_get_drvdata(pdev); //REVISIT this is wrong
+       int i;
+       for (i = 0; i < TPS6507X_NUM_REGULATOR; i++)
+               regulator_unregister(tps->rdev[i]);
+-      tps->client = NULL;
++      tps->mfd = NULL;
+-      /* clear the client data in i2c */
+-      i2c_set_clientdata(client, NULL);
+       kfree(tps);
+       return 0;
+ }
+-static const struct tps_info tps6507x_pmic_regs[] = {
+-      {
+-              .name = "VDCDC1",
+-              .min_uV = 725000,
+-              .max_uV = 3300000,
+-              .table_len = ARRAY_SIZE(VDCDCx_VSEL_table),
+-              .table = VDCDCx_VSEL_table,
+-      },
+-      {
+-              .name = "VDCDC2",
+-              .min_uV = 725000,
+-              .max_uV = 3300000,
+-              .table_len = ARRAY_SIZE(VDCDCx_VSEL_table),
+-              .table = VDCDCx_VSEL_table,
+-      },
+-      {
+-              .name = "VDCDC3",
+-              .min_uV = 725000,
+-              .max_uV = 3300000,
+-              .table_len = ARRAY_SIZE(VDCDCx_VSEL_table),
+-              .table = VDCDCx_VSEL_table,
+-      },
+-      {
+-              .name = "LDO1",
+-              .min_uV = 1000000,
+-              .max_uV = 3300000,
+-              .table_len = ARRAY_SIZE(LDO1_VSEL_table),
+-              .table = LDO1_VSEL_table,
+-      },
+-      {
+-              .name = "LDO2",
+-              .min_uV = 725000,
+-              .max_uV = 3300000,
+-              .table_len = ARRAY_SIZE(LDO2_VSEL_table),
+-              .table = LDO2_VSEL_table,
+-      },
+-};
+-
+-static const struct i2c_device_id tps6507x_pmic_id[] = {
+-      {.name = "tps6507x",
+-      .driver_data = (unsigned long) tps6507x_pmic_regs,},
+-      { },
+-};
+-MODULE_DEVICE_TABLE(i2c, tps6507x_pmic_id);
+-
+-static struct i2c_driver tps6507x_i2c_driver = {
++static struct platform_driver tps6507x_pmic_driver = {
+       .driver = {
+-              .name = "tps6507x",
++              .name = "tps6507x-pmic",
+               .owner = THIS_MODULE,
+       },
+       .probe = tps6507x_pmic_probe,
+       .remove = __devexit_p(tps6507x_pmic_remove),
+-      .id_table = tps6507x_pmic_id,
+ };
+ /**
+@@ -663,7 +650,7 @@
+  */
+ static int __init tps6507x_pmic_init(void)
+ {
+-      return i2c_add_driver(&tps6507x_i2c_driver);
++      return platform_driver_register(&tps6507x_pmic_driver);
+ }
+ subsys_initcall(tps6507x_pmic_init);
+@@ -674,10 +661,11 @@
+  */
+ static void __exit tps6507x_pmic_cleanup(void)
+ {
+-      i2c_del_driver(&tps6507x_i2c_driver);
++      platform_driver_unregister(&tps6507x_pmic_driver);
+ }
+ module_exit(tps6507x_pmic_cleanup);
+ MODULE_AUTHOR("Texas Instruments");
+ MODULE_DESCRIPTION("TPS6507x voltage regulator driver");
+ MODULE_LICENSE("GPL v2");
++MODULE_ALIAS("platform:tps6507x-pmic");
+Index: git/include/linux/mfd/tps6507x.h
+===================================================================
+--- git.orig/include/linux/mfd/tps6507x.h      2010-01-12 08:43:00.961383768 -0600
++++ git/include/linux/mfd/tps6507x.h   2010-01-12 08:52:41.753688570 -0600
+@@ -156,10 +156,13 @@
+       struct device *dev;
+       struct i2c_client *i2c_client;
+       int (*read_dev)(struct tps6507x_dev *tps6507x, char reg, int size,
+-                        void *dest);
++                      void *dest);
+       int (*write_dev)(struct tps6507x_dev *tps6507x, char reg, int size,
+-                         void *src);
++                       void *src);
+       struct mutex adc_mutex;
++
++      /* Client devices */
++      struct tps6507x_pmic *pmic;
+ };
+ #endif /*  __LINUX_MFD_TPS6507X_H */
diff --git a/recipes/linux/linux-davinci/0006-tps6507x_touchscreen_driver.patch b/recipes/linux/linux-davinci/0006-tps6507x_touchscreen_driver.patch
new file mode 100644 (file)
index 0000000..adfa7bb
--- /dev/null
@@ -0,0 +1,541 @@
+Index: git/drivers/input/touchscreen/Kconfig
+===================================================================
+--- git.orig/drivers/input/touchscreen/Kconfig 2010-01-06 16:23:19.000000000 -0600
++++ git/drivers/input/touchscreen/Kconfig      2010-01-12 08:46:20.229418722 -0600
+@@ -530,4 +530,17 @@
+         To compile this driver as a module, choose M here: the
+         module will be called pcap_ts.
++
++config TOUCHSCREEN_TPS6507X
++      tristate "TPS6507x based touchscreens"
++      depends on I2C
++      help
++        Say Y here if you have a TPS6507x based touchscreen
++        controller.
++
++        If unsure, say N.
++
++        To compile this driver as a module, choose M here: the
++        module will be called tps6507x_ts.
++
+ endif
+Index: git/drivers/input/touchscreen/Makefile
+===================================================================
+--- git.orig/drivers/input/touchscreen/Makefile        2010-01-06 16:23:19.000000000 -0600
++++ git/drivers/input/touchscreen/Makefile     2010-01-12 08:46:57.705432438 -0600
+@@ -42,3 +42,4 @@
+ obj-$(CONFIG_TOUCHSCREEN_WM97XX_ZYLONITE)     += zylonite-wm97xx.o
+ obj-$(CONFIG_TOUCHSCREEN_W90X900)     += w90p910_ts.o
+ obj-$(CONFIG_TOUCHSCREEN_PCAP)                += pcap_ts.o
++obj-$(CONFIG_TOUCHSCREEN_TPS6507X)    += tps6507x-ts.o
+Index: git/drivers/input/touchscreen/tps6507x-ts.c
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ git/drivers/input/touchscreen/tps6507x-ts.c        2010-01-12 08:51:49.781765078 -0600
+@@ -0,0 +1,403 @@
++/*
++ * drivers/input/touchscreen/tps6507x_ts.c
++ *
++ * Touchscreen driver for the tps6507x chip.
++ *
++ * Copyright (c) 2009 RidgeRun (todd.fischer@ridgerun.com)
++ *
++ * Credits:
++ *
++ *    Using code from tsc2007, MtekVision Co., Ltd.
++ *
++ * For licencing details see kernel-base/COPYING
++ *
++ * TPS65070, TPS65073, TPS650731, and TPS650732 support
++ * 10 bit touch screen interface.
++ */
++
++//#define DEBUG
++
++#include <linux/module.h>
++#include <linux/workqueue.h>
++#include <linux/slab.h>
++#include <linux/input.h>
++#include <linux/platform_device.h>
++#include <linux/mfd/tps6507x.h>
++#include <linux/i2c/tps6507x-ts.h>
++#include <linux/delay.h>
++
++#define TSC_DEFAULT_POLL_PERIOD 30 /* ms */
++#define TPS_DEFAULT_MIN_PRESSURE 0x30
++#define MAX_10BIT ((1 << 10) - 1)
++
++#define       TPS6507X_ADCONFIG_CONVERT_TS (TPS6507X_ADCONFIG_AD_ENABLE | \
++                                       TPS6507X_ADCONFIG_START_CONVERSION | \
++                                       TPS6507X_ADCONFIG_INPUT_REAL_TSC)
++#define       TPS6507X_ADCONFIG_POWER_DOWN_TS (TPS6507X_ADCONFIG_INPUT_REAL_TSC)
++
++struct ts_event {
++      u16     x;
++      u16     y;
++      u16     pressure;
++};
++
++struct tps6507x_ts {
++      struct input_dev        *input_dev;
++      struct device           *dev;
++      char                    phys[32];
++      struct workqueue_struct *wq;
++      struct delayed_work     work;
++      unsigned                polling;        /* polling is active */
++      struct ts_event         tc;
++      struct tps6507x_dev     *mfd;
++      u16                     model;
++      unsigned                pendown;
++      int                     irq;
++      void                    (*clear_penirq)(void);
++      unsigned long           poll_period;    /* ms */
++      u16                     min_pressure;
++      int                     vref;           /* non-zero to leave vref on */
++};
++
++static int tps6507x_read_u8(struct tps6507x_ts *tsc, u8 reg, u8 *data)
++{
++      int err;
++
++      err = tsc->mfd->read_dev(tsc->mfd, reg, 1, data);
++
++      if (err) {
++              return err;
++      }
++
++      return 0;
++}
++
++static int tps6507x_write_u8(struct tps6507x_ts *tsc, u8 reg, u8 data)
++{
++      return tsc->mfd->write_dev(tsc->mfd, reg, 1, &data);
++}
++
++static s32 tps6507x_adc_conversion(struct tps6507x_ts *tsc,
++                                 u8 tsc_mode, u16 *value)
++{
++      s32 ret;
++      u8 adc_status;
++      u8 result;
++
++      /* Route input signal to A/D converter */
++
++      ret = tps6507x_write_u8(tsc, TPS6507X_REG_TSCMODE, tsc_mode);
++      if (ret) {
++              dev_err(tsc->dev, "TSC mode read failed\n");
++              goto err;
++      }
++
++      /* Start A/D conversion */
++
++      ret = tps6507x_write_u8(tsc, TPS6507X_REG_ADCONFIG,
++                              TPS6507X_ADCONFIG_CONVERT_TS);
++      if (ret) {
++              dev_err(tsc->dev, "ADC config write failed\n");
++              return ret;
++      }
++
++      do {
++              ret = tps6507x_read_u8(tsc, TPS6507X_REG_ADCONFIG,
++                                     &adc_status);
++              if (ret) {
++                      dev_err(tsc->dev, "ADC config read failed\n");
++                      goto err;
++              }
++      } while (adc_status & TPS6507X_ADCONFIG_START_CONVERSION);
++
++      ret = tps6507x_read_u8(tsc, TPS6507X_REG_ADRESULT_2, &result);
++      if (ret) {
++              dev_err(tsc->dev, "ADC result 2 read failed\n");
++              goto err;
++      }
++
++      *value = (result & TPS6507X_REG_ADRESULT_2_MASK) << 8;
++
++      ret = tps6507x_read_u8(tsc, TPS6507X_REG_ADRESULT_1, &result);
++      if (ret) {
++              dev_err(tsc->dev, "ADC result 1 read failed\n");
++              goto err;
++      }
++
++      *value |= result;
++
++      dev_dbg(tsc->dev, "TSC channel %d = 0x%X\n", tsc_mode, *value);
++
++err:
++      return ret;
++}
++
++/* Need to call tps6507x_adc_standby() after using A/D converter for the
++ * touch screen interrupt to work properly.
++ */
++
++static s32 tps6507x_adc_standby(struct tps6507x_ts *tsc)
++{
++      s32 ret;
++      s32 loops = 0;
++      u8 val;
++
++      ret = tps6507x_write_u8(tsc,  TPS6507X_REG_ADCONFIG,
++                              TPS6507X_ADCONFIG_INPUT_TSC);
++      if (ret)
++              return ret;
++
++      ret = tps6507x_write_u8(tsc, TPS6507X_REG_TSCMODE,
++                              TPS6507X_TSCMODE_STANDBY);
++      if (ret)
++              return ret;
++
++      ret = tps6507x_read_u8(tsc, TPS6507X_REG_INT, &val);
++      if (ret)
++              return ret;
++
++      while (val & TPS6507X_REG_TSC_INT) {
++              mdelay(10);
++              ret = tps6507x_read_u8(tsc, TPS6507X_REG_INT, &val);
++              if (ret)
++                      return ret;
++              loops++;
++      }
++
++      return ret;
++}
++
++static void tps6507x_ts_handler(struct work_struct *work)
++{
++      struct tps6507x_ts *tsc =  container_of(work,
++                              struct tps6507x_ts, work.work);
++      struct input_dev *input_dev = tsc->input_dev;
++      int pendown;
++      int schd;
++      int poll = 0;
++      s32 ret;
++
++      ret =  tps6507x_adc_conversion(tsc, TPS6507X_TSCMODE_PRESSURE,
++                                     &tsc->tc.pressure);
++      if (ret)
++              goto done;
++
++      pendown = tsc->tc.pressure > tsc->min_pressure;
++
++      if (unlikely(!pendown && tsc->pendown)) {
++              dev_dbg(tsc->dev, "UP\n");
++              input_report_key(input_dev, BTN_TOUCH, 0);
++              input_report_abs(input_dev, ABS_PRESSURE, 0);
++              input_sync(input_dev);
++              tsc->pendown = 0;
++      }
++
++      if (pendown) {
++
++              if (!tsc->pendown) {
++                      dev_dbg(tsc->dev, "DOWN\n");
++                      input_report_key(input_dev, BTN_TOUCH, 1);
++              } else
++                      dev_dbg(tsc->dev, "still down\n");
++
++              ret =  tps6507x_adc_conversion(tsc, TPS6507X_TSCMODE_X_POSITION,
++                                             &tsc->tc.x);
++              if (ret)
++                      goto done;
++
++              ret =  tps6507x_adc_conversion(tsc, TPS6507X_TSCMODE_Y_POSITION,
++                                             &tsc->tc.y);
++              if (ret)
++                      goto done;
++
++              input_report_abs(input_dev, ABS_X, tsc->tc.x);
++              input_report_abs(input_dev, ABS_Y, tsc->tc.y);
++              input_report_abs(input_dev, ABS_PRESSURE, tsc->tc.pressure);
++              input_sync(input_dev);
++              tsc->pendown = 1;
++              poll = 1;
++      }
++
++      /* always poll if not using interrupts */
++      poll = 1;
++
++      if (poll) {
++              schd = queue_delayed_work(tsc->wq, &tsc->work,
++                                        tsc->poll_period * HZ / 1000);
++              if (schd)
++                      tsc->polling = 1;
++              else {
++                      tsc->polling = 0;
++                      dev_err(tsc->dev, "re-schedule failed");
++              }
++      } else
++              tsc->polling = 0;
++
++done:
++      ret = tps6507x_adc_standby(tsc);
++}
++
++static int tps6507x_ts_probe(struct platform_device *pdev)
++{
++      int error;
++      struct tps6507x_ts *tsc;
++      struct tps6507x_dev *tps6507x_dev = platform_get_drvdata(pdev);
++      struct touchscreen_init_data *init_data;
++      struct input_dev *input_dev;
++      struct tps6507x_board *tps_board;
++      int schd;
++
++      /**
++       * tps_board points to pmic related constants
++       * coming from the board-evm file.
++       */
++
++      tps_board = (struct tps6507x_board *)tps6507x_dev->dev->platform_data;
++
++      if (!tps_board) {
++              dev_err(tps6507x_dev->dev, "Could not find tps6507x platform data\n");
++              return -EIO;
++      }
++
++      /**
++       * init_data points to array of regulator_init structures
++       * coming from the board-evm file.
++       */
++
++      init_data = tps_board->tps6507x_ts_init_data;
++
++      tsc = kzalloc(sizeof(struct tps6507x_ts), GFP_KERNEL);
++      if (!tsc) {
++              dev_err(tps6507x_dev->dev, "failed to allocate driver data\n");
++              error = -ENOMEM;
++              goto err0;
++      }
++
++      tps6507x_dev->ts = tsc;
++      tsc->mfd = tps6507x_dev;
++      tsc->dev = tps6507x_dev->dev;
++      input_dev = input_allocate_device();
++      if (!input_dev) {
++              dev_err(tsc->dev, "Failed to allocate input device.\n");
++              error = -ENOMEM;
++              goto err1;
++      }
++
++      input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
++      input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
++
++      input_set_abs_params(input_dev, ABS_X, 0, MAX_10BIT, 0, 0);
++      input_set_abs_params(input_dev, ABS_Y, 0, MAX_10BIT, 0, 0);
++      input_set_abs_params(input_dev, ABS_PRESSURE, 0, MAX_10BIT, 0, 0);
++
++      input_dev->name = "TPS6507x Touchscreen";
++      input_dev->id.bustype = BUS_I2C;
++      input_dev->dev.parent = tsc->dev;
++
++      snprintf(tsc->phys, sizeof(tsc->phys),
++               "%s/input0", dev_name(tsc->dev));
++      input_dev->phys = tsc->phys;
++
++      dev_dbg(tsc->dev, "device: %s\n", input_dev->phys);
++
++      input_set_drvdata(input_dev, tsc);
++
++      tsc->input_dev = input_dev;
++
++      INIT_DELAYED_WORK(&tsc->work, tps6507x_ts_handler);
++      tsc->wq = create_workqueue("TPS6507x Touchscreen");
++
++      if (init_data) {
++              tsc->poll_period = init_data->poll_period;
++              tsc->vref = init_data->vref;
++              tsc->min_pressure = init_data->min_pressure;
++              input_dev->id.vendor = init_data->vendor;
++              input_dev->id.product = init_data->product;
++              input_dev->id.version = init_data->version;
++      } else {
++              tsc->poll_period = TSC_DEFAULT_POLL_PERIOD;
++              tsc->min_pressure = TPS_DEFAULT_MIN_PRESSURE;
++      }
++
++      error = tps6507x_adc_standby(tsc);
++      if (error)
++              goto err2;
++
++      error = input_register_device(input_dev);
++      if (error)
++              goto err2;
++
++      schd = queue_delayed_work(tsc->wq, &tsc->work,
++                                tsc->poll_period * HZ / 1000);
++
++      if (schd)
++              tsc->polling = 1;
++      else {
++              tsc->polling = 0;
++              dev_err(tsc->dev, "schedule failed");
++              goto err2;
++       }
++
++      return 0;
++
++err2:
++      cancel_delayed_work(&tsc->work);
++      flush_workqueue(tsc->wq);
++      destroy_workqueue(tsc->wq);
++      tsc->wq = 0;
++      input_free_device(input_dev);
++err1:
++      kfree(tsc);
++      tps6507x_dev->ts = NULL;
++err0:
++      return error;
++}
++
++static int __devexit tps6507x_ts_remove(struct platform_device *pdev)
++{
++      struct tps6507x_dev *tps6507x_dev = platform_get_drvdata(pdev);
++      struct tps6507x_ts *tsc = tps6507x_dev->ts;
++      struct input_dev *input_dev = tsc->input_dev;
++
++      if (! tsc) {
++          return 0;
++      }
++
++      cancel_delayed_work(&tsc->work);
++      flush_workqueue(tsc->wq);
++      destroy_workqueue(tsc->wq);
++      tsc->wq = 0;
++
++      input_free_device(input_dev);
++
++      tps6507x_dev->ts = NULL;
++      kfree(tsc);
++
++      return 0;
++}
++
++static struct platform_driver tps6507x_ts_driver = {
++      .driver = {
++              .name = "tps6507x-ts",
++              .owner = THIS_MODULE,
++      },
++      .probe = tps6507x_ts_probe,
++      .remove = __devexit_p(tps6507x_ts_remove),
++};
++
++static int __init tps6507x_ts_init(void)
++{
++      return platform_driver_register(&tps6507x_ts_driver);
++}
++module_init(tps6507x_ts_init);
++
++static void __exit tps6507x_ts_exit(void)
++{
++      platform_driver_unregister(&tps6507x_ts_driver);
++}
++module_exit(tps6507x_ts_exit);
++
++MODULE_AUTHOR("Todd Fischer <todd.fischer@ridgerun.com>");
++MODULE_DESCRIPTION("TPS6507x - TouchScreen driver");
++MODULE_LICENSE("GPL v2");
++MODULE_ALIAS("platform:tps6507x-tsc");
+Index: git/include/linux/i2c/tps6507x-ts.h
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ git/include/linux/i2c/tps6507x-ts.h        2010-01-12 08:46:00.745554017 -0600
+@@ -0,0 +1,24 @@
++/* linux/i2c/tps6507x-ts.h
++ *
++ * Functions to access TPS65070 touch screen chip.
++ *
++ * Copyright (c) 2009 RidgeRun (todd.fischer@ridgerun.com)
++ *
++ *
++ *  For licencing details see kernel-base/COPYING
++ */
++
++#ifndef __LINUX_I2C_TPS6507X_TS_H
++#define __LINUX_I2C_TPS6507X_TS_H
++
++/* Board specific touch screen initial values */
++struct touchscreen_init_data {
++      int     poll_period;    /* ms */
++      int     vref;           /* non-zero to leave vref on */
++      __u16   min_pressure;   /* min reading to be treated as a touch */
++      __u16   vendor;
++      __u16   product;
++      __u16   version;
++};
++
++#endif /*  __LINUX_I2C_TPS6507X_TS_H */
+Index: git/include/linux/mfd/tps6507x.h
+===================================================================
+--- git.orig/include/linux/mfd/tps6507x.h      2010-01-12 08:43:01.000000000 -0600
++++ git/include/linux/mfd/tps6507x.h   2010-01-12 08:46:00.745554017 -0600
+@@ -142,6 +142,7 @@
+ struct tps6507x_board {
+       struct regulator_init_data *tps6507x_pmic_init_data;
++      struct touchscreen_init_data *tps6507x_ts_init_data;
+ };
+ /**
+@@ -163,6 +164,7 @@
+       /* Client devices */
+       struct tps6507x_pmic *pmic;
++      struct tps6507x_ts *ts;
+ };
+ #endif /*  __LINUX_MFD_TPS6507X_H */
+Index: git/arch/arm/mach-davinci/board-da850-evm.c
+===================================================================
+--- git.orig/arch/arm/mach-davinci/board-da850-evm.c   2010-01-12 08:43:00.000000000 -0600
++++ git/arch/arm/mach-davinci/board-da850-evm.c        2010-01-12 08:47:55.901370217 -0600
+@@ -25,6 +25,8 @@
+ #include <linux/mtd/partitions.h>
+ #include <linux/mtd/physmap.h>
+ #include <linux/regulator/machine.h>
++#include <linux/mfd/tps6507x.h>
++#include <linux/i2c/tps6507x-ts.h>
+ #include <linux/spi/spi.h>
+ #include <linux/spi/flash.h>
+ #include <linux/spi/davinci_spi_master.h>
+@@ -644,8 +646,18 @@
+       },
+ };
++static struct touchscreen_init_data tps6507x_touchscreen_data = {
++        .poll_period =  30,             /* ms between touch samples */
++        .min_pressure = 0x30,   /* Zoom touch screen */
++        .vref = 0,              /* turn off vref when not using A/D */
++        .vendor = 0,    /* /sys/class/input/input?/id/vendor */
++        .product = 65070,       /* /sys/class/input/input?/id/product */
++        .version = 0x100,       /* /sys/class/input/input?/id/version */
++};
++
+ static struct tps6507x_board tps_board = {
+       .tps6507x_pmic_init_data = &tps65070_regulator_data[0],
++        .tps6507x_ts_init_data = &tps6507x_touchscreen_data,
+ };
+ static struct i2c_board_info __initdata da850evm_tps65070_info[] = {
+Index: git/drivers/mfd/tps6507x.c
+===================================================================
+--- git.orig/drivers/mfd/tps6507x.c    2010-01-12 08:43:01.000000000 -0600
++++ git/drivers/mfd/tps6507x.c 2010-01-12 08:51:03.997870214 -0600
+@@ -91,6 +91,8 @@
+       tps6507x_client_dev_register(tps6507x, "tps6507x-pmic",
+                                    &pdev);
++      tps6507x_client_dev_register(tps6507x, "tps6507x-ts",
++                                   &pdev);
+       return ret;
+ }
+@@ -99,6 +101,7 @@
+ {
+       struct tps6507x_dev *tps6507x;
+       int ret = 0;
++
+       tps6507x = kzalloc(sizeof(struct tps6507x_dev), GFP_KERNEL);
+       if (tps6507x == NULL) {
+               kfree(i2c);
index c57ad71..b03f6a8 100644 (file)
@@ -798,6 +798,7 @@ CONFIG_INPUT_TOUCHSCREEN=y
 # CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
 # CONFIG_TOUCHSCREEN_TSC2007 is not set
 # CONFIG_TOUCHSCREEN_W90X900 is not set
+CONFIG_TOUCHSCREEN_TPS6507X=y
 # CONFIG_INPUT_MISC is not set
 
 #
@@ -969,6 +970,7 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_HTC_EGPIO is not set
 # CONFIG_HTC_PASIC3 is not set
 # CONFIG_TPS65010 is not set
+CONFIG_TPS6507x=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_MFD_T7L66XB is not set
index 113eeb0..955bfd6 100644 (file)
@@ -1,6 +1,6 @@
 --- old/arch/arm/mach-davinci/board-da850-evm.c                2010-01-11 14:49:21.000000000 +0000
 +++ new/arch/arm/mach-davinci/board-da850-evm.c                2010-01-11 14:47:44.000000000 +0000
-@@ -606,7 +606,7 @@
+@@ -609,7 +609,7 @@
        {
                .constraints = {
                        .min_uV = 950000,
index 61922f5..1b7144d 100644 (file)
@@ -68,6 +68,12 @@ SRC_URI_append_hawkboard          = ${ARAGO_L1_URI}
 SRC_URI_append_da850-omapl138-evm = "file://logo_linux_clut224.ppm \
                                      file://0001-CheckRegisterForDCDC.patch;patch=1 \
                                      file://0002-DefDcDcTiedhigh.patch;patch=1 \
+                                     file://0001-tps6507x_regulator_refactor.patch;patch=1 \
+                                     file://0002-tps6507x_regulator_da850_integration.patch;patch=1 \
+                                     file://0003-tps6507x_mfd_driver.patch;patch=1 \
+                                     file://0004-tps6507x_regulator_naming_change.patch;patch=1 \
+                                     file://0005-tps6507x_regulator_mfd_integration.patch;patch=1 \
+                                     file://0006-tps6507x_touchscreen_driver.patch;patch=1 \
                                      file://da850_omapl138_opp456mhz.patch;patch=1 \
                                      file://da850_omapl138_opp408mhz.patch;patch=1 \
                                      file://da850_omapl138_opp456mhz_increaseDcDc3.patch;patch=1"