summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKoen Kooi <k-kooi@ti.com>2010-01-30 12:29:29 +0100
committerKoen Kooi <koen@openembedded.org>2010-01-30 16:47:02 +0100
commitba84d5c9e9c0265bed8cd62f7873957c5b68638a (patch)
tree8702829f214f5bb9dd29dd2ccc1e5770a76fb44d
parent66e25f7afb4b89386f2b43065321be4d540df57d (diff)
linux-omap-pm 2.6.29: merge in touchbook updates from AI repo
-rw-r--r--recipes/linux/linux-omap-pm-2.6.29/omap3-touchbook/battery1-tps65950-charging-management-3.patch126
-rw-r--r--recipes/linux/linux-omap-pm-2.6.29/omap3-touchbook/board-omap3touchbook.c59
-rw-r--r--recipes/linux/linux-omap-pm-2.6.29/omap3-touchbook/touchscreen-ads7846-rotation-fixed.patch21
-rw-r--r--recipes/linux/linux-omap-pm_2.6.29.bb3
4 files changed, 201 insertions, 8 deletions
diff --git a/recipes/linux/linux-omap-pm-2.6.29/omap3-touchbook/battery1-tps65950-charging-management-3.patch b/recipes/linux/linux-omap-pm-2.6.29/omap3-touchbook/battery1-tps65950-charging-management-3.patch
new file mode 100644
index 0000000000..2247056177
--- /dev/null
+++ b/recipes/linux/linux-omap-pm-2.6.29/omap3-touchbook/battery1-tps65950-charging-management-3.patch
@@ -0,0 +1,126 @@
+--- a/drivers/power/twl4030_bci_battery.c 2010-01-16 13:48:46.745838675 -0800
++++ b/drivers/power/twl4030_bci_battery.c 2010-01-16 13:41:47.317595764 -0800
+@@ -598,11 +598,31 @@
+ static int twl4030battery_voltage(void)
+ {
+ int volt = read_bci_val(T2_BATTERY_VOLT);
+-
+ return (volt * VOLT_STEP_SIZE) / VOLT_PSR_R;
+ }
+
+ /*
++ * Get latest battery voltage (using MADC)
++ *
++ * When the BCI is not charging, the BCI voltage registers are not
++ * updated and are 'frozen' but the data can be read through the
++ * MADC.
++ */
++static int twl4030battery_voltage_madc(void)
++{
++ struct twl4030_madc_request req;
++
++ req.channels = (1 << 12);
++ req.do_avg = 0;
++ req.method = TWL4030_MADC_SW1;
++ req.active = 0;
++ req.func_cb = NULL;
++ twl4030_madc_conversion(&req);
++
++ return (((int) req.rbuf[12]) * VOLT_STEP_SIZE) / VOLT_PSR_R;
++}
++
++/*
+ * Return the battery current
+ * Or < 0 on failure.
+ */
+@@ -840,21 +860,21 @@
+
+ static void twl4030_bci_battery_read_status(struct twl4030_bci_device_info *di)
+ {
+- di->temp_C = twl4030battery_temperature(di);
+- di->voltage_uV = twl4030battery_voltage();
+- di->current_uA = twl4030battery_current();
++ if(di->charge_status != POWER_SUPPLY_STATUS_DISCHARGING) {
++ di->temp_C = twl4030battery_temperature(di);
++ di->voltage_uV = twl4030battery_voltage();
++ di->current_uA = twl4030battery_current();
++ }
+ }
+
+ static void
+ twl4030_bci_battery_update_status(struct twl4030_bci_device_info *di)
+ {
+- twl4030_bci_battery_read_status(di);
+- di->charge_status = POWER_SUPPLY_STATUS_UNKNOWN;
+-
+ if (power_supply_am_i_supplied(&di->bat))
+ di->charge_status = POWER_SUPPLY_STATUS_CHARGING;
+ else
+ di->charge_status = POWER_SUPPLY_STATUS_DISCHARGING;
++ twl4030_bci_battery_read_status(di);
+ }
+
+ static void twl4030_bci_battery_work(struct work_struct *work)
+@@ -960,7 +980,15 @@
+
+ return count;
+ }
++
++static ssize_t
++show_voltage(struct device *dev, struct device_attribute *attr, char *buf)
++{
++ return sprintf(buf, "%d\n", twl4030battery_voltage_madc());
++}
++
+ static DEVICE_ATTR(charge_current, S_IRUGO | S_IWUGO, show_charge_current, set_charge_current);
++static DEVICE_ATTR(voltage_now_madc, S_IRUGO, show_voltage, NULL);
+
+ static int twl4030_bk_bci_battery_get_property(struct power_supply *psy,
+ enum power_supply_property psp,
+@@ -998,10 +1026,23 @@
+
+ switch (psp) {
+ case POWER_SUPPLY_PROP_VOLTAGE_NOW:
+- val->intval = di->voltage_uV;
++ {
++ /* Get latest data from MADC -- not done periodically by
++ worker as this is more expensive, so only do it when we
++ are actually asked for the data... */
++ if(di->charge_status == POWER_SUPPLY_STATUS_DISCHARGING)
++ val->intval = twl4030battery_voltage_madc();
++ else
++ val->intval = di->voltage_uV;
++
+ break;
++ }
+ case POWER_SUPPLY_PROP_CURRENT_NOW:
+- val->intval = di->current_uA;
++ /* FIXME: Get from MADC */
++ if(di->charge_status == POWER_SUPPLY_STATUS_DISCHARGING)
++ val->intval = 0;
++ else
++ val->intval = di->current_uA;
+ break;
+ case POWER_SUPPLY_PROP_TEMP:
+ val->intval = di->temp_C;
+@@ -1016,6 +1057,12 @@
+ val->intval = 0;
+ break;
+ case POWER_SUPPLY_PROP_CAPACITY:
++ /* Get latest data from MADC -- not done periodically by
++ worker as this is more expensive, so only do it when we
++ are actually asked for the data... */
++ if(di->charge_status == POWER_SUPPLY_STATUS_DISCHARGING)
++ di->voltage_uV = twl4030battery_voltage_madc();
++
+ /*
+ * need to get the correct percentage value per the
+ * battery characteristics. Approx values for now.
+@@ -1145,6 +1192,7 @@
+ }
+ }
+
++ ret = device_create_file(di->bat.dev, &dev_attr_voltage_now_madc);
+ ret = device_create_file(di->bat.dev, &dev_attr_charge_current);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to create sysfs entries\n");
diff --git a/recipes/linux/linux-omap-pm-2.6.29/omap3-touchbook/board-omap3touchbook.c b/recipes/linux/linux-omap-pm-2.6.29/omap3-touchbook/board-omap3touchbook.c
index 99651114e6..59d89f3fd9 100644
--- a/recipes/linux/linux-omap-pm-2.6.29/omap3-touchbook/board-omap3touchbook.c
+++ b/recipes/linux/linux-omap-pm-2.6.29/omap3-touchbook/board-omap3touchbook.c
@@ -70,9 +70,12 @@
#define OMAP3_AC_GPIO 136 //Int1 DRDY
#define OMAP3_TS_GPIO 162
+#define OMAP3_CHACHA_GPIO 154
#define TB_BL_PWM_TIMER 9
#define TB_KILL_POWER_GPIO 168
+unsigned int ai_revision = 2;
+
static struct mtd_partition omap3touchbook_nand_partitions[] = {
/* All the partition sizes are listed in terms of NAND block size */
{
@@ -298,6 +301,10 @@ static struct twl4030_bci_platform_data touchbook_bci_data = {
.no_backup_battery = 1,
};
+static struct twl4030_madc_platform_data touchbook_madc_data = {
+ .irq_line = 1,
+};
+
static struct twl4030_platform_data touchbook_twldata = {
.irq_base = TWL4030_IRQ_BASE,
.irq_end = TWL4030_IRQ_END,
@@ -313,6 +320,7 @@ static struct twl4030_platform_data touchbook_twldata = {
/* TouchBook BCI */
.bci = &touchbook_bci_data,
+ .madc = &touchbook_madc_data,
};
static struct i2c_board_info __initdata touchbook_i2c_boardinfo[] = {
@@ -328,10 +336,16 @@ static struct i2c_board_info __initdata touchBook_i2c_boardinfo[] = {
{
I2C_BOARD_INFO("bq27200", 0x55),
},
+// {
+// I2C_BOARD_INFO("chacha_mt8c", 0x40),
+// .irq = OMAP_GPIO_IRQ(OMAP3_CHACHA_GPIO),
+// },
};
-static int __init omap3_touchbook_i2c_init(void)
+static void __init omap3_touchbook_i2c_init(void)
{
+ int ret;
+
/* Standard TouchBook bus */
omap_register_i2c_bus(1, 2600, touchbook_i2c_boardinfo,
ARRAY_SIZE(touchbook_i2c_boardinfo));
@@ -340,7 +354,14 @@ static int __init omap3_touchbook_i2c_init(void)
omap_register_i2c_bus(3, 100, touchBook_i2c_boardinfo,
ARRAY_SIZE(touchBook_i2c_boardinfo));
- return 0;
+/* ret = gpio_request(OMAP3_CHACHA_GPIO, "chacha_mt8c");
+ if (ret < 0) {
+ printk(KERN_ERR "Failed to request GPIO %d for chacha_mt8c IRQ\n", OMAP3_CHACHA_GPIO);
+ return;
+ }
+
+ gpio_direction_input(OMAP3_CHACHA_GPIO);*/
+ return;
}
static void __init omap3_ads7846_init(void)
@@ -438,6 +459,7 @@ static struct gpio_keys_button gpio_buttons[] = {
.gpio = 183,
.desc = "power",
.wakeup = 1,
+ .active_low = 1,
},
};
@@ -643,14 +665,25 @@ static int touchbook_backlight_update(struct backlight_device *bd)
- You have (164*0.85) => ~140 levels of brightness.
*/
- /* Convert from 0-100 range to 0-140 range */
- value = (value * 14) / 10 / 2;
+ /* Halve input brightness */
+ value /= 2;
/* For maximum brightness, just stop the timer... */
if(value != bd->props.max_brightness)
{
- omap_dm_timer_set_load(touchbook_backlight_pwm, 1, -164);
- omap_dm_timer_set_match(touchbook_backlight_pwm, 1, -24 - value);
+ /* Load the appropriate value for 200Hz PWM */
+ u32 period = clk_get_rate(omap_dm_timer_get_fclk(touchbook_backlight_pwm)) / 200;
+
+ /* Minimum duty cycle is 15% */
+ u32 minimum = (period * 3) / 20;
+ u32 maximum = (period * 17) / 20;
+
+ /* Work out match value */
+ u32 match = (maximum * value) / 100;
+
+ /* Start... */
+ omap_dm_timer_set_load(touchbook_backlight_pwm, 1, 0xFFFFFFFF - period - 1);
+ omap_dm_timer_set_match(touchbook_backlight_pwm, 1, 0xFFFFFFFF - minimum - match);
omap_dm_timer_write_counter(touchbook_backlight_pwm, -1);
//omap_dm_timer_stop(touchbook_backlight_pwm);
omap_dm_timer_start(touchbook_backlight_pwm);
@@ -676,7 +709,7 @@ static void __init omap3_touchbook_backlight_init(void)
{
touchbook_backlight_pwm = omap_dm_timer_request_specific(TB_BL_PWM_TIMER);
omap_dm_timer_enable(touchbook_backlight_pwm);
- omap_dm_timer_set_source(touchbook_backlight_pwm, OMAP_TIMER_SRC_32_KHZ);
+ omap_dm_timer_set_source(touchbook_backlight_pwm, OMAP_TIMER_SRC_SYS_CLK);
omap_dm_timer_set_pwm(touchbook_backlight_pwm, 1, 1, OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE);
bd->props.max_brightness = 100;
@@ -699,6 +732,16 @@ static void omap3_touchbook_poweroff(void)
gpio_direction_output(TB_KILL_POWER_GPIO, 0);
}
+static int __init ai_revision_instance(char *str)
+{
+ if (!str)
+ return -EINVAL;
+
+ ai_revision = simple_strtoul(str, NULL, 10);
+
+ return 0;
+}
+
static void __init omap3_touchbook_init(void)
{
pm_power_off = omap3_touchbook_poweroff;
@@ -733,6 +776,8 @@ static void __init omap3_touchbook_map_io(void)
omap2_map_common_io();
}
+early_param("air", ai_revision_instance);
+
MACHINE_START(OMAP3_TOUCHBOOK, "OMAP3 Touch Book")
/* Maintainer: Gregoire Gentil - http://www.alwaysinnovating.com */
.phys_io = 0x48000000,
diff --git a/recipes/linux/linux-omap-pm-2.6.29/omap3-touchbook/touchscreen-ads7846-rotation-fixed.patch b/recipes/linux/linux-omap-pm-2.6.29/omap3-touchbook/touchscreen-ads7846-rotation-fixed.patch
new file mode 100644
index 0000000000..dbdfc40bb6
--- /dev/null
+++ b/recipes/linux/linux-omap-pm-2.6.29/omap3-touchbook/touchscreen-ads7846-rotation-fixed.patch
@@ -0,0 +1,21 @@
+--- a/drivers/input/touchscreen/ads7846.c 2009-12-21 02:43:57.000000000 -0800
++++ b/drivers/input/touchscreen/ads7846.c 2009-12-21 02:56:03.000000000 -0800
+@@ -596,6 +596,7 @@
+ {
+ struct ads7846 *ts = ads;
+ struct ads7846_packet *packet = ts->packet;
++ struct ads7846_platform_data *pdata = ts->spi->dev.platform_data;
+ unsigned Rt;
+ u16 x, y, z1, z2;
+
+@@ -666,8 +667,8 @@
+ dev_dbg(&ts->spi->dev, "DOWN\n");
+ #endif
+ }
+- input_report_abs(input, ABS_X, x);
+- input_report_abs(input, ABS_Y, y);
++ input_report_abs(input, ABS_X, pdata->x_max - x + pdata->x_min);
++ input_report_abs(input, ABS_Y, pdata->y_max - y + pdata->y_min);
+ input_report_abs(input, ABS_PRESSURE, Rt);
+
+ input_sync(input);
diff --git a/recipes/linux/linux-omap-pm_2.6.29.bb b/recipes/linux/linux-omap-pm_2.6.29.bb
index 9112c7dd8a..bbf5d36bbb 100644
--- a/recipes/linux/linux-omap-pm_2.6.29.bb
+++ b/recipes/linux/linux-omap-pm_2.6.29.bb
@@ -170,7 +170,7 @@ SRC_URI_append_omap3-touchbook = " file://logo_linux_clut224.ppm \
file://accelerometer-mma7455l.patch;patch=1 \
file://accelerometer-touchscreen-mux-spi.patch;patch=1 \
file://touchscreen-ads7846-export-settings.patch;patch=1 \
- file://touchscreen-ads7846-rotation-support.patch;patch=1 \
+ file://touchscreen-ads7846-rotation-fixed.patch;patch=1 \
file://dspbridge.patch;patch=1 \
file://battery2-bq27200-no-error-message.patch;patch=1 \
file://sound-headphone-detection.patch;patch=1 \
@@ -180,6 +180,7 @@ SRC_URI_append_omap3-touchbook = " file://logo_linux_clut224.ppm \
file://dss2-export-status.patch;patch=1 \
file://usb-otg-pc-connection.patch;patch=1 \
file://battery1-tps65950-charging-management-2.patch;patch=1 \
+ file://battery1-tps65950-charging-management-3.patch;patch=1 \
file://memory-move-malloc-end.patch;patch=1 \
file://aufs-1.patch;patch=1 \
file://aufs-2.patch;patch=1 \