From 8fdc80c21f34a2171495e0714dbda57e7a29da47 Mon Sep 17 00:00:00 2001 From: mattis fjallstrom Date: Tue, 23 Jun 2015 08:08:39 -0700 Subject: Sashas device tree and low power mods PLUS reintroducing to the board file those things that aren't yet in the DT. Change-Id: I99853ac272380ae07a533d8f0c9dffff9478c684 --- arch/arm/boot/dts/omap3.dtsi | 3 +- arch/arm/boot/dts/omap3_h1.dts | 236 +++++-- arch/arm/mach-omap2/board-omap3h1-bluetooth.c | 29 +- arch/arm/mach-omap2/board-omap3h1.c | 872 +------------------------- arch/arm/mach-omap2/opp.c | 2 - arch/arm/mach-omap2/pm.c | 9 +- drivers/gpio/gpio-tps65910.c | 4 +- drivers/mfd/tps65910.c | 31 +- drivers/regulator/core.c | 13 +- drivers/regulator/omap-pmic-regulator.c | 32 + 10 files changed, 274 insertions(+), 957 deletions(-) diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi index 78e97bea7af..f5ddf6aac1e 100644 --- a/arch/arm/boot/dts/omap3.dtsi +++ b/arch/arm/boot/dts/omap3.dtsi @@ -225,7 +225,7 @@ ti,hwmods = "uart3"; clock-frequency = <48000000>; }; - /* + i2c1: i2c@48070000 { compatible = "ti,omap3-i2c"; #address-cells = <1>; @@ -233,6 +233,7 @@ ti,hwmods = "i2c1"; }; + /* i2c2: i2c@48072000 { compatible = "ti,omap3-i2c"; #address-cells = <1>; diff --git a/arch/arm/boot/dts/omap3_h1.dts b/arch/arm/boot/dts/omap3_h1.dts index c0551e82502..089b32a375f 100644 --- a/arch/arm/boot/dts/omap3_h1.dts +++ b/arch/arm/boot/dts/omap3_h1.dts @@ -26,12 +26,35 @@ 800000 1275000 /* 1000000 1337500 */ >; + cpu0-supply = <&omap_tps65910>; /* OPP tolerance in percentage */ voltage-tolerance = <0>; reset-voltage = <1275000>; }; }; + vbat: fixedregulator@0 { + compatible = "regulator-fixed"; + regulator-name = "vbat"; + regulator-min-microvolt = <3700000>; + regulator-max-microvolt = <3700000>; + regulator-boot-on; + }; + + omap_pimic { + omap_tps65910: omap_vdd1 { + compatible = "ti,omap-tps65910-vdd1"; + ti,boot-voltage-micro-volts = <1275000>; + ti,vp = <&vp_mpu>; + }; + + omap_tps65910_vdd2: omap_vdd2 { + compatible = "ti,omap-tps65910-vdd2"; + ti,boot-voltage-micro-volts = <1200000>; + ti,vp = <&vp_core>; + }; + }; + pad-wkup { /* on omap, the irqs are calculated as follows: * for the 96 intc IRQs @@ -54,7 +77,8 @@ /* off IRQ handle */ ti,pad_irq = <0x16e 90 1>, /* uart3 - serial rx */ <0x9f6 143 1>, /* mpu6515 irq pin */ - <0x9f4 123 1>; /* BT host wake */ + <0x9f4 123 1>, /* BT host wake */ + <0x1b0 23 1>; /* sys_nirq */ }; }; @@ -117,14 +141,14 @@ 0x1a0 0x000 /* MCSPI1_CS1, MODE0 | OUTPUT */ /* CKE pin for memory */ - 0x232 0x000 /* SDRC_CKE0, MODE0 | OUTPUT */ - 0x234 0x000 /* SDRC_CKE1, MODE0 | OUTPUT */ + 0x232 0x000 /* SDRC_CKE0, MODE0 | OUTPUT */ + 0x234 0x000 /* SDRC_CKE1, MODE0 | OUTPUT */ /* touch reset */ 0x0f2 0x11c /* CAM_D6, MODE4 | INPUT_PULLUP */ 0x5ba 0x004 /* ETK_D7, MODE4 | OUTPUT */ - 0x1b0 0x100 /* SYS_NIRQ, MODE0 | INPUT */ + 0x1b0 0x4100 /* SYS_NIRQ, MODE0 | INPUT | OFFWAKEUP */ 0x0dc 0x004 /* CAM_HS, MODE4 | OUTPUT */ /* USB */ @@ -155,6 +179,20 @@ >; }; + i2c1_pins: pinmux_i2c1_pins { + pinctrl-single,pins = < + 0x18a 0x118 /* I2C1_SCL, MODE0 | INPUT_PULLUP */ + 0x18c 0x118 /* I2C1_SCA, MODE0 | INPUT_PULLUP */ + >; + }; + + i2c2_pins: pinmux_i2c2_pins { + pinctrl-single,pins = < + 0x18e 0x118 /* I2C2_SCL, MODE0 | INPUT_PULLUP */ + 0x190 0x118 /* I2C2_SDA, MODE0 | INPUT_PULLUP */ + >; + }; + uart1_pins: pinmux_uart1_pins { pinctrl-single,pins = < /* uart1 */ @@ -170,8 +208,6 @@ 0x170 0x000 /* UART3_TX, MODE0 | OUTPUT */ >; }; - - }; &omap3_pmx_wkup { /* pinmux@0x48002a00 */ @@ -193,6 +229,138 @@ }; }; +&i2c1 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c1_pins>; + + status = "okay"; + clock-frequency = <400000>; + + tps: tps@2d { + reg = <0x2d>; + }; +}; + +#include "tps65910.dtsi" + +&tps { + interrupts = <7>; /* SYS_NIRQ */ + interrupt-parent = <&intc>; + + #interrupt-cells = <2>; + interrupt-controller; + + ti,en-ck32k-xtal; + /* set SR_CTL_I2C_SEL - access to smartreflex registers by control i2c */ + ti,system-power-controller; + + vcc1-supply = <&vbat>; + vcc2-supply = <&vbat>; + vcc3-supply = <&vbat>; + vcc4-supply = <&vbat>; + vcc5-supply = <&vbat>; + vcc6-supply = <&vbat>; + vcc7-supply = <&vbat>; + vccio-supply = <&vbat>; + + regulators { + vrtc_reg: regulator@0 { + regulator-always-on; + }; + + /* DSS is on this one */ + vio_reg: regulator@1 { + regulator-name = "vdds_dsi"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + + vdd1_reg: regulator@2 { + /* VDD_MPU voltage limits 0.95V - 1.26V with +/-4% tolerance */ + /* + regulator-boot-on; + regulator-always-on; + */ + /* external sleep control by means of SYS_OFF_MODE signal */ + regulator-name = "vdd_mpu_iva"; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <1350000>; + ti,regulator-ext-sleep-control = <8>; + }; + + vdd2_reg: regulator@3 { + /* VDD_CORE voltage limits 0.95V - 1.1V with +/-4% tolerance */ + /* + regulator-boot-on; + regulator-always-on; + */ + /* external sleep control by means of SYS_OFF_MODE signal */ + regulator-name = "vdd_core"; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <1200000>; + ti,regulator-ext-sleep-control = <8>; + }; + + /* not used, I think */ + vdd3_reg: regulator@4 { + status = "disabled"; + }; + + vdig1_reg: regulator@5 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + + /* vdig2_reg: regulator@6 {}; unused */ + vdig2_reg: regulator@6 { + status = "disabled"; + }; + + /* Nobody is explicitly using this rail, but it seems like it goes to + * VDDA_DPLL_PER on the chip. So we need it. + */ + vpll_reg: regulator@7 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + + /* vdac_reg: regulator@8 {}; unused */ + vdac_reg: regulator@8 { + status = "disabled"; + }; + + vaux1_reg: regulator@9 { /* not used, 2.85V by default */ + status = "disabled"; + }; + + vaux2_reg: regulator@10 { + regulator-name = "vaux2"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + vaux33_reg: regulator@11 { + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + /* This one goes to both SPI (for DSS) and touch. How can I + * specify two consumers in DT? (vdd for dss, avdd for touch). + */ + vmmc_reg: regulator@12 { + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + }; +}; + + /* leave gpio bank interface clocks on during suspend * to avoid race condition in gpio_irq_handler */ &gpio1 { @@ -233,62 +401,6 @@ }; -#if 0 /* Not currently used */ -&i2c1 { - /* clock-frequency = <400000>; */ - /* PMIC ONLY */ -}; - - -/* I2C-2 has everything other than PMIC. */ - -&i2c2 { - clock-frequency = <400000>; - - mxt224@4a { /* Taken from Minnow, needs to be updated */ - compatible = "atmel,maxtouch"; /* OLIO */ - reg = <0x4a>; /* OLIO */ - interrupt-parent = <&gpio4>; - interrupts = <3 0>; /* gpio-99 32 * 3 + 3 */ - wakeup-source; - atmel,cfg-name = ""; /* needs setting, OLIO */ - atmel,reset_gpio = <>; /* needs setting, OLIO */ - - /* below is from minnow */ - - /* gpios = <&gpio4 3 0>, /\* IRQ gpio-099 *\/ */ - /* <&gpio6 4 0>; /\* RESET gpio-164*\/ */ - - /* pinctrl-names = "pullup", "pulldown"; */ - /* pinctrl-0 = <&atmxt_int_pullup>; */ - /* pinctrl-1 = <&atmxt_int_pulldown>; */ - /* support-snowflake = <1>; */ - }; - - mpu6515@68 { - }; - - /* This driver does not yet support device tree - lm3530-led@38 { - };*/ - - /* This driver does not yet support device tree - cm3391@10 { - };*/ - - - -}; - -&i2c3 { - clock-frequency = <400000>; - - /* This driver does not yet support device tree - bq274xx@55 { - }; */ -}; - -#endif &uart1 { pinctrl-0 = <&uart1_pins>; diff --git a/arch/arm/mach-omap2/board-omap3h1-bluetooth.c b/arch/arm/mach-omap2/board-omap3h1-bluetooth.c index 3cec4bee656..323ec99ac6b 100644 --- a/arch/arm/mach-omap2/board-omap3h1-bluetooth.c +++ b/arch/arm/mach-omap2/board-omap3h1-bluetooth.c @@ -43,6 +43,7 @@ static void update_host_wake_locked(int); #define BT_REG_GPIO 180 +#define BT_RESET_GPIO 179 #define BT_WAKE_GPIO 93 #define BT_HOST_WAKE_GPIO 11 @@ -68,11 +69,12 @@ struct bcm_bt_lpm { static int bcm20702_bt_rfkill_set_power(void *data, bool blocked) { - // rfkill_ops callback. Turn transmitter on when blocked is false + // rfkill_ops callback. Turn transmitter on when blocked is false if (!blocked) { if (clk32ksys_reg && !bt_enabled) regulator_enable(clk32ksys_reg); + gpio_set_value(BT_RESET_GPIO, 1); gpio_set_value(BT_REG_GPIO, 1); } else { @@ -80,6 +82,7 @@ static int bcm20702_bt_rfkill_set_power(void *data, bool blocked) // we don't hold the wake_lock until chip wakes up again. update_host_wake_locked(0); + gpio_set_value(BT_RESET_GPIO, 0); gpio_set_value(BT_REG_GPIO, 0); if (clk32ksys_reg && bt_enabled) regulator_disable(clk32ksys_reg); @@ -256,15 +259,15 @@ static int bcm20702_bluetooth_probe(struct platform_device *pdev) int rc = 0; int ret = 0; -// rc = gpio_request(BT_RESET_GPIO, "bcm20702_nreset_gpip"); -// if (unlikely(rc)) { -// return rc; -// } + rc = gpio_request(BT_RESET_GPIO, "bcm20702_nreset_gpip"); + if (unlikely(rc)) { + return rc; + } rc = gpio_request(BT_REG_GPIO, "bcm20702_nshutdown_gpio"); if (unlikely(rc)) { - //gpio_free(BT_RESET_GPIO); - return rc; + gpio_free(BT_RESET_GPIO); + return rc; } clk32ksys_reg = regulator_get(0, "clk32ksys"); @@ -274,14 +277,14 @@ static int bcm20702_bluetooth_probe(struct platform_device *pdev) } gpio_direction_output(BT_REG_GPIO, 1); - //gpio_direction_output(BT_RESET_GPIO, 1); + gpio_direction_output(BT_RESET_GPIO, 1); bt_rfkill = rfkill_alloc("bcm20702 Bluetooth", &pdev->dev, RFKILL_TYPE_BLUETOOTH, &bcm20702_bt_rfkill_ops, NULL); if (unlikely(!bt_rfkill)) { - //gpio_free(BT_RESET_GPIO); + gpio_free(BT_RESET_GPIO); gpio_free(BT_REG_GPIO); return -ENOMEM; } @@ -291,7 +294,7 @@ static int bcm20702_bluetooth_probe(struct platform_device *pdev) if (unlikely(rc)) { rfkill_destroy(bt_rfkill); - //gpio_free(BT_RESET_GPIO); + gpio_free(BT_RESET_GPIO); gpio_free(BT_REG_GPIO); return -1; } @@ -301,7 +304,7 @@ static int bcm20702_bluetooth_probe(struct platform_device *pdev) rfkill_unregister(bt_rfkill); rfkill_destroy(bt_rfkill); - //gpio_free(BT_RESET_GPIO); + gpio_free(BT_RESET_GPIO); gpio_free(BT_REG_GPIO); } @@ -322,7 +325,7 @@ static int bcm20702_bluetooth_remove(struct platform_device *pdev) debugfs_remove(btdebugdent); gpio_free(BT_REG_GPIO); - //gpio_free(BT_RESET_GPIO); + gpio_free(BT_RESET_GPIO); gpio_free(BT_WAKE_GPIO); gpio_free(BT_HOST_WAKE_GPIO); regulator_put(clk32ksys_reg); @@ -337,7 +340,7 @@ int bcm4430_bluetooth_suspend(struct platform_device *pdev, pm_message_t state) int host_wake; disable_irq(irq); - host_wake = gpio_get_value(BT_HOST_WAKE_GPIO); /* Never goes low - what's up? */ + host_wake = gpio_get_value(BT_HOST_WAKE_GPIO); if (host_wake) { enable_irq(irq); diff --git a/arch/arm/mach-omap2/board-omap3h1.c b/arch/arm/mach-omap2/board-omap3h1.c index 54cf6126f10..9c161fb4678 100644 --- a/arch/arm/mach-omap2/board-omap3h1.c +++ b/arch/arm/mach-omap2/board-omap3h1.c @@ -88,12 +88,12 @@ #define LCD_RESET_GPIO 122 #endif -static struct accelerometer_wake { - int awake; - struct wake_lock lock; - char lock_name[100]; - int user_pid; -} acc_wake; +static struct of_device_id omap_dt_match_table[] __initdata = { + { .compatible = "olio,omap3-h1", }, + { .compatible = "simple-bus", }, + { .compatible = "ti,omap-infra", }, + { } +}; static struct mtd_partition omap3h1_nand_partitions[] = { /* All the partition sizes are listed in terms of NAND block size */ @@ -259,492 +259,6 @@ static struct platform_device nop_phy_device = { /* }; */ -/* --------------------------------------------------------------------------- */ -/* REGULATOR - Fixed first - */ - -static struct regulator_init_data omap3h1_vbat_data = { - .constraints.always_on = true, - .constraints.valid_modes_mask = REGULATOR_MODE_NORMAL, - .constraints.valid_ops_mask = REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, -}; - -static struct fixed_voltage_config omap3h1_vbat_pdata = { - .supply_name = "VBAT", - .microvolts = 3800000, - .init_data = &omap3h1_vbat_data, - .gpio = -EINVAL, -}; - -static struct platform_device omap3h1_vbat = { - .name = "reg-fixed-voltage", - .id = -1, - .dev = { - .platform_data = &omap3h1_vbat_pdata, - }, -}; - - -/* --------------------------------------------------------------------------- */ - -static struct regulator_init_data tps65910_dummy = { - .supply_regulator = "VBAT", - .constraints.always_on = false, - .constraints.valid_ops_mask = REGULATOR_CHANGE_STATUS, -}; - -/* --------------------------------------------------------------------------- */ -/* This one is required for the display to work. - */ - -static struct regulator_consumer_supply tps65910_touch3_supply[] = { - REGULATOR_SUPPLY("avdd", "2-004a"), - REGULATOR_SUPPLY("vdd", "spi1.1"), -}; - -static struct regulator_init_data tps65910_touch3 = { - .supply_regulator = "VBAT", - .constraints = { - .min_uV = 3300000, - .max_uV = 3300000, - .valid_modes_mask = REGULATOR_MODE_NORMAL | REGULATOR_MODE_STANDBY, - .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE, - .always_on = false, - .apply_uV = true, - - .state_mem = { - .uV = 0, - .mode = REGULATOR_MODE_STANDBY, - .disabled = 1, - }, - .state_disk = { - .uV = 0, - .mode = REGULATOR_MODE_STANDBY, - .disabled = 1, - }, - .state_standby = { - .uV = 0, - .mode = REGULATOR_MODE_STANDBY, - .disabled = 1, - }, - }, - - .num_consumer_supplies = ARRAY_SIZE(tps65910_touch3_supply), - .consumer_supplies = tps65910_touch3_supply, -}; - -/* --------------------------------------------------------------------------- */ -/* This regulator is for the vibrator. We currently lack a way of enabling / - * disabling this since we lack a driver for the vibrator (we're just accessing - * it's registers through the i2c bus). - * - * Hence, it's always on. - */ - -static struct regulator_consumer_supply tps65910_vibrator_supply[] = { - REGULATOR_SUPPLY("vaux2", "drv2605"), -}; - -static struct regulator_init_data tps65910_vibrator = { - .supply_regulator = "VBAT", - .constraints = { - .min_uV = 3300000, - .max_uV = 3300000, - .valid_modes_mask = REGULATOR_MODE_NORMAL | REGULATOR_MODE_STANDBY, - .valid_ops_mask = REGULATOR_CHANGE_MODE, - .always_on = false, - .apply_uV = true, - - .state_mem = { - .disabled = 1, - }, - .state_disk = { - .disabled = 1, - }, - .state_standby = { - .disabled = 1, - }, - }, - .num_consumer_supplies = ARRAY_SIZE(tps65910_vibrator_supply), - .consumer_supplies = tps65910_vibrator_supply, -}; - - - -/* --------------------------------------------------------------------------- */ -/* Seems like this one has to be on. It doesn't have any "official" consumers - * ... but it's definitely needed. Bluetooth relies on it. - */ - -/* -static struct regulator_consumer_supply tps65910_bluetooth_3v3[] = { - REGULATOR_SUPPLY("clk32ksys", 0), -}; -*/ - -static struct regulator_init_data tps65910_3v3 = { - .supply_regulator = "VBAT", - .constraints = { - .min_uV = 3300000, - .max_uV = 3300000, - .valid_modes_mask = REGULATOR_MODE_NORMAL | REGULATOR_MODE_STANDBY, - .valid_ops_mask = REGULATOR_CHANGE_MODE | - REGULATOR_CHANGE_STATUS, - .always_on = true, - .apply_uV = true, - - .state_mem = { - .disabled = 1, - }, - .state_disk = { - .disabled = 1, - }, - .state_standby = { - .disabled = 1, - }, - }, - -}; - - -/* --------------------------------------------------------------------------- */ -/* This is the OMAP display subsystem. Part of the OMAP processor OCP stuff. - * USB also depends on this, so if you want to transfer files it has to be - * always on. - * NAND flash and UART3 (which we don't use) requires it - * as well. And the i2c bus, and lots of other stuff. - * - * Setting always_on to "false" resulted in almost no power savings, at - * least in the current setting. - */ - -static struct regulator_consumer_supply tps65910_1v8_supply[] = { - REGULATOR_SUPPLY("vdds_dsi", "omapdss"), -}; - -static struct regulator_init_data tps65910_1v8 = { - .supply_regulator = "VBAT", - .constraints = { - .min_uV = 1800000, - .max_uV = 1800000, - .valid_modes_mask = REGULATOR_MODE_NORMAL | REGULATOR_MODE_IDLE | REGULATOR_MODE_STANDBY, - .valid_ops_mask = REGULATOR_CHANGE_MODE, - .always_on = true, - .apply_uV = true, - }, - .num_consumer_supplies = ARRAY_SIZE(tps65910_1v8_supply), - .consumer_supplies = tps65910_1v8_supply, -}; - -/* --------------------------------------------------------------------------- */ -/* There's no driver explicitly using this one, but it goes to VDDA_DPLL_PER - * on the OMAP chip. So it's used internally by the DPLL devices in PER, I think. - */ - -static struct regulator_consumer_supply tps65910_vpll_supply[] = { - -}; - -static struct regulator_init_data tps65910_vpll = { - .supply_regulator = "VBAT", - .constraints = { - .min_uV = 1800000, - .max_uV = 1800000, - .valid_modes_mask = REGULATOR_MODE_NORMAL | REGULATOR_MODE_STANDBY, - .valid_ops_mask = REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, - .always_on = true, - .apply_uV = true, - }, - .num_consumer_supplies = ARRAY_SIZE(tps65910_vpll_supply), - .consumer_supplies = tps65910_vpll_supply, -}; - - -/* --------------------------------------------------------------------------- */ -/* Touch power supply part 2. - */ - -static struct regulator_consumer_supply tps65910_touch_supply[] = { - REGULATOR_SUPPLY("vdd", "2-004a" ), -}; - -static struct regulator_init_data tps65910_touch = { - .supply_regulator = "VBAT", - .constraints = { - .min_uV = 1800000, - .max_uV = 1800000, - .valid_modes_mask = REGULATOR_MODE_NORMAL | REGULATOR_MODE_STANDBY, - .valid_ops_mask = REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, - .always_on = false, - .apply_uV = true, - - .state_mem = { - .uV = 1, - .mode = REGULATOR_MODE_STANDBY, - .disabled = 1, - }, - .state_disk = { - .uV = 1, - .mode = REGULATOR_MODE_STANDBY, - .disabled = 1, - }, - .state_standby = { - .uV = 1, - .mode = REGULATOR_MODE_STANDBY, - .disabled = 1, - }, - - }, - .num_consumer_supplies = ARRAY_SIZE(tps65910_touch_supply), - .consumer_supplies = tps65910_touch_supply, -}; - -/* =========================================================================== */ - -/* --------------------------------------------------------------------------- */ - -/* This one only works if 'always_on' is set to true. Do I need to do something - * special otherwise to turn it on? Maybe the driver doesn't enable it. - * - * The accelerometer driver isn't using regulators properly, hence this needs to - * be always on. - */ - -static struct regulator_consumer_supply tps65910_accel_supply[] = { - REGULATOR_SUPPLY("vdd", "mpu6515"), -}; - -static struct regulator_init_data tps65910_accel = { - .supply_regulator = "VBAT", - .constraints = { - .min_uV = 1800000, - .max_uV = 1800000, - .valid_modes_mask = REGULATOR_MODE_NORMAL | REGULATOR_MODE_IDLE | REGULATOR_MODE_STANDBY, - .valid_ops_mask = REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, - .always_on = true, - .apply_uV = true, - - .state_mem = { - .uV = 1, - .mode = REGULATOR_MODE_STANDBY, - .disabled = 1, - }, - .state_disk = { - .uV = 1, - .mode = REGULATOR_MODE_STANDBY, - .disabled = 1, - }, - .state_standby = { - .uV = 1, - .mode = REGULATOR_MODE_STANDBY, - .disabled = 1, - }, - }, - .num_consumer_supplies = ARRAY_SIZE(tps65910_accel_supply), - .consumer_supplies = tps65910_accel_supply, -}; - -/* --------------------------------------------------------------------------- */ -/* Supplies the MPU PD and friends. - */ - -static struct regulator_consumer_supply tps65910_vdd1_supply[] = { - REGULATOR_SUPPLY("vcc", "cpu0"), -}; - -static struct regulator_init_data tps65910_vdd1 = { - .supply_regulator = "VBAT", - .constraints = { - .name = "vdd_mpu_iva", - .min_uV = 900000, - .max_uV = 1350000, - .valid_modes_mask = REGULATOR_MODE_NORMAL | REGULATOR_MODE_FAST, - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, - .always_on = false, - - .state_mem = { - .mode = REGULATOR_MODE_STANDBY, - .enabled = 1, - .disabled = 0, - }, - .state_disk = { - .mode = REGULATOR_MODE_STANDBY, - .enabled = 1, - .disabled = 0, - }, - .state_standby = { - .mode = REGULATOR_MODE_STANDBY, - .enabled = 1, - .disabled = 0, - }, - }, - - .num_consumer_supplies = ARRAY_SIZE(tps65910_vdd1_supply), - .consumer_supplies = tps65910_vdd1_supply, -}; - -/* --------------------------------------------------------------------------- */ -/* I seem to need always on, but the TWL code gets by without it. So... - */ - -static struct regulator_consumer_supply tps65910_vdd2_supply[] = { - REGULATOR_SUPPLY("vdd_core", "l3_main.0"), -}; - -static struct regulator_init_data tps65910_vdd2 = { - .supply_regulator = "VBAT", - .constraints = { - .name = "vdd_core", - .min_uV = 900000, - .max_uV = 1200000, - .valid_modes_mask = REGULATOR_MODE_NORMAL | REGULATOR_MODE_FAST, - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, - .always_on = false, - - .state_mem = { - .mode = REGULATOR_MODE_STANDBY, - .enabled = 1, - .disabled = 0, - }, - .state_disk = { - .mode = REGULATOR_MODE_STANDBY, - .enabled = 1, - .disabled = 0, - }, - .state_standby = { - .mode = REGULATOR_MODE_STANDBY, - .enabled = 1, - .disabled = 0, - }, - }, - - .num_consumer_supplies = ARRAY_SIZE(tps65910_vdd2_supply), - .consumer_supplies = tps65910_vdd2_supply, -}; - -/* --------------------------------------------------------------------------- */ - -/* The clock has to be ON, probably because we're not enabling it properly. */ -/* If I set i2chs_keepon to 6, UBIfs fails to mount (!?). Again, probably - * not enabling it properly. - * - * And even with therm set, the screen acts weird (looking really dark during - * boot, touch not working when up). - */ - -/* -static struct tps65910_sleep_keepon_data olio_slp_keepon = { - .therm_keepon = 0, - .clkout32k_keepon = 0, - .i2chs_keepon = 1, - };*/ - - - -static struct tps65910_board omap3h1_tps65910_pdata = { - /* .irq = 7 + OMAP_INTC_START, */ /* Getting this at runtime instead. */ - .en_ck32k_xtal = true, - /* .en_dev_slp = true, */ - - /* .slp_keepon = &olio_slp_keepon, */ - - .tps65910_pmic_init_data[TPS65910_REG_VIO] = &tps65910_1v8, - .tps65910_pmic_init_data[TPS65910_REG_VDD1] = &tps65910_vdd1, - .tps65910_pmic_init_data[TPS65910_REG_VDD2] = &tps65910_vdd2, - .tps65910_pmic_init_data[TPS65910_REG_VDIG1] = &tps65910_accel, - .tps65910_pmic_init_data[TPS65910_REG_VDIG2] = &tps65910_touch, - .tps65910_pmic_init_data[TPS65910_REG_VPLL] = &tps65910_vpll, - - .tps65910_pmic_init_data[TPS65910_REG_VMMC] = &tps65910_touch3, - .tps65910_pmic_init_data[TPS65910_REG_VAUX2] = &tps65910_vibrator, - - /* This one is connected to BT ... maybe more? */ - - .tps65910_pmic_init_data[TPS65910_REG_VAUX33] = &tps65910_3v3, - - /* not actually used */ - - .tps65910_pmic_init_data[TPS65910_REG_VRTC] = &tps65910_dummy, - .tps65910_pmic_init_data[TPS65910_REG_VDAC] = &tps65910_dummy, - .tps65910_pmic_init_data[TPS65910_REG_VAUX1] = &tps65910_dummy, /* 2v85 */ - .tps65910_pmic_init_data[TPS65910_REG_VDD3] = &tps65910_dummy, - - .pm_off = true, -}; - - -/* ====================================================================== */ -/* Voltage domain settings */ - - -#define OMAP3_SRI2C_SLAVE_ADDR 0x12 -#define OMAP3_VDD_MPU_SR_CONTROL_REG 0x00 -#define OMAP3_VDD_CORE_SR_CONTROL_REG 0x01 -#define OMAP3_VP_CONFIG_ERROROFFSET 0x00 -#define OMAP3_VP_VSTEPMIN_VSTEPMIN 0x1 -#define OMAP3_VP_VSTEPMAX_VSTEPMAX 0x04 -#define OMAP3_VP_VLIMITTO_TIMEOUT_US 200 - - -static unsigned long olio_vsel_to_uv(const u8 vsel) -{ - return (((vsel * 125) + 6000)) * 100; -} - -static u8 olio_uv_to_vsel(unsigned long uv) -{ - return DIV_ROUND_UP(uv - 600000, 12500); -} - - -static struct omap_voltdm_pmic omap3_mpu_pmic = { - .slew_rate = 12500, - .step_size = 12500, - .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET, - .vp_vstepmin = OMAP3_VP_VSTEPMIN_VSTEPMIN, - .vp_vstepmax = OMAP3_VP_VSTEPMAX_VSTEPMAX, - .vddmin = 900000, - .vddmax = 1350000, - .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US, - .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR, - .volt_reg_addr = OMAP3_VDD_MPU_SR_CONTROL_REG, - .i2c_high_speed = true, - .vsel_to_uv = olio_vsel_to_uv, - .uv_to_vsel = olio_uv_to_vsel, -}; - -static struct omap_voltdm_pmic omap3_core_pmic = { - .slew_rate = 12500, - .step_size = 12500, - .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET, - .vp_vstepmin = OMAP3_VP_VSTEPMIN_VSTEPMIN, - .vp_vstepmax = OMAP3_VP_VSTEPMAX_VSTEPMAX, - .vddmin = 900000, - .vddmax = 1200000, - .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US, - .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR, - .volt_reg_addr = OMAP3_VDD_CORE_SR_CONTROL_REG, - .i2c_high_speed = true, - .vsel_to_uv = olio_vsel_to_uv, - .uv_to_vsel = olio_uv_to_vsel, -}; - -int __init omap3_voltdm_init(void) -{ - struct voltagedomain *voltdm; - - if (!cpu_is_omap34xx()) - return -ENODEV; - - voltdm = voltdm_lookup("mpu_iva"); - omap_voltage_register_pmic(voltdm, &omap3_mpu_pmic); - - voltdm = voltdm_lookup("core"); - omap_voltage_register_pmic(voltdm, &omap3_core_pmic); - - return 0; -} - /* ====================================================================== */ @@ -752,8 +266,6 @@ int __init omap3_voltdm_init(void) static struct i2c_board_info __initdata omap3h1_i2c1_board_info[] = { { - I2C_BOARD_INFO("tps65910", 0x2d), - .platform_data = &omap3h1_tps65910_pdata, }, #ifdef CONFIG_MACH_OMAP3_H1_DVT2 }; @@ -786,274 +298,6 @@ static struct i2c_board_info __initdata omap3h1_i2c3_board_info[] = { }, }; -#ifdef ONLY_KEEPING_THIS_STUFF_FOR_NOSTALGIC_REASONS - -/* --------------------------------------------------------------------------- */ -/* Create debugfs entry - * - * We need to have this so that our wake-up thread can tell us it's PID. - * That PID will then be used when waking the system up. - */ - -struct dentry * pidfile; - -#define SIG_OLIO_WAKE 44 // we choose 44 as our signal number (real-time signals are in the range of 33 to 64) - -static ssize_t write_pid(struct file *file, - const char __user *buf, - size_t count, - loff_t *ppos) -{ - char mybuf[10]; - int pid = 0; - - /* read the value from user space */ - - if(count > 10) - return -EINVAL; - if (copy_from_user(mybuf, buf, count) != 0) { - /* nothing read?? */ - printk ("OLIO: write_pid: Error??\n"); - return 0; - } - - sscanf(mybuf, "%d", &pid); - - printk("pid read = %d\n", pid); - - acc_wake.user_pid = pid; - - return count; -} - -static ssize_t send_wake_signal (void) { - int ret; - struct siginfo info; - struct task_struct *t; - - /* send the signal */ - - printk ("Now sending signal!\n"); - - memset(&info, 0, sizeof(struct siginfo)); - - /* this is bit of a trickery: SI_QUEUE is normally used by sigqueue from user space, - * and kernel space should use SI_KERNEL. But if SI_KERNEL is used the real_time data - * is not delivered to the user space signal handler function. - */ - - info.si_signo = SIG_OLIO_WAKE; - info.si_code = SI_QUEUE; - - /* real time signals may have 32 bits of data. */ - - info.si_int = 1234; - - rcu_read_lock(); - - t = pid_task(find_pid_ns(acc_wake.user_pid, &init_pid_ns), PIDTYPE_PID); - - if(t == NULL){ - rcu_read_unlock(); - printk("no such pid\n"); - return -ENODEV; - } - - rcu_read_unlock(); - - /* send the signal */ - - ret = send_sig_info(SIG_OLIO_WAKE, &info, t); - - if (ret < 0) { - printk("error sending signal\n"); - } - return ret; -} - -static const struct file_operations h1_fops = { - .write = write_pid, -}; - - -/*************************************************************************** - * acc_irq_handler - handle interrupt from accelerometer - * - * This routine gets called when an interrupt from the accelerometer - * happens. Time out is in milliseconds. - * - * TODO: BREAK this all out, place it in it's own kernel driver together - * with the configuration stuff for the accelerometer (the low power sleep - * mode stuff). - */ - -#define OLIO_DOUBLE_TAP 500 -#define OLIO_ONE_SECOND 1000 -#define OLIO_DT_WAIT 3000 - -static unsigned long previous; -static unsigned long previous_double; - -static irqreturn_t acc_irq_handler_thr(int irq, void * omap3h1_d) { - /* struct platform_device** omap3h1_devs = (struct platform_device **) omap3h1_d; */ - - int ret = 99; - unsigned long now; - - printk (KERN_DEBUG "acc_irq_handler_thr: Entered!\n"); - - now = jiffies; - - if (jiffies_to_msecs(now - previous) < OLIO_DOUBLE_TAP) { - - /* ignore double clicks that happens too soon from the previous one - - * filters out inadvertent wake-ups - */ - - if (jiffies_to_msecs (now - previous_double) < OLIO_DT_WAIT) - { - previous = 0; - return IRQ_HANDLED; - } - - printk (KERN_DEBUG "Double tap detected!\n"); - - /* We want to wake up. Take wake lock (and send signal to user space?) - * BT driver only takes wake lock, then lets higher levels handle - * everything ... but what if there's nothing there to take the lock? - */ - - send_wake_signal(); - - wake_lock_timeout (&acc_wake.lock, msecs_to_jiffies (20 * OLIO_ONE_SECOND)); - - previous_double = now; - previous = 0; - } else { - previous = now; - } - - printk (KERN_DEBUG "acc_irq_handler_thr: Leaving! (ret = %d)\n", ret); - - return IRQ_HANDLED; -} - -static irqreturn_t acc_irq_handler(int irq, void * omap3h1_d) { - printk (KERN_DEBUG "acc_irq_handler: Entered!\n"); - - /* nothing to do, other than wake the main thread */ - - printk (KERN_DEBUG "acc_irq_handler: Leaving!\n"); - return IRQ_WAKE_THREAD; -} - -static int __init omap3_acc_irq_init (int irq, void * dev_id) { - irq_set_irq_wake(irq, 1); - - if (request_threaded_irq (irq, acc_irq_handler, - acc_irq_handler_thr, - IRQF_SHARED | IRQF_TRIGGER_RISING, - "acc_wake", - dev_id)) { - printk (KERN_DEBUG "Couldn't register handler for accelerometer IRQ\n"); - } - - /* Should check the return value ... but if it fails, what do we do? */ - - return 0; -} - -static int __init omap3_wake_init (void) { - pidfile = debugfs_create_file("wake_signal_pid", 0200, NULL, NULL, &h1_fops); - acc_wake.user_pid = 0; /* No user thread yet */ - - snprintf(acc_wake.lock_name, sizeof(acc_wake.lock_name), - "Accelerometer"); - wake_lock_init(&acc_wake.lock, WAKE_LOCK_SUSPEND, - acc_wake.lock_name); - return 0; -} - - -#endif /* ONLY_KEEPING_THIS_STUFF_FOR_NOSTALGIC_REASONS */ - - -/*************************************************************************** - * omap_uart data - */ - -/* Some notes: - .dma_enabled = false, - .dma_rx_buf_size = DEFAULT_RXDMA_BUFSIZE, - .dma_rx_poll_rate = DEFAULT_RXDMA_POLLRATE, - .dma_rx_timeout = DEFAULT_RXDMA_TIMEOUT, - .autosuspend_timeout = DEFAULT_AUTOSUSPEND_DELAY, ( -1 or X ms. ) - - .wakelock_timeout - for minnow, this is 150 (BT) or 50 (M4 debug). - Can be left out. - - .DTR_* -> can be left out. I can't find anyone using it. - - int DTR_gpio; - int DTR_inverted; - int DTR_present; - bool wakeup_capable; - - bool open_close_pm; - Minnow uses this for c55 only - unsigned int rx_trig; Minnow, BT & debug only -*/ - -static struct omap_uart_port_info omap_uart_ports[] = { - { - .dma_enabled = false, /* To specify DMA Mode */ - .dma_rx_buf_size = DEFAULT_RXDMA_BUFSIZE, - .dma_rx_timeout = DEFAULT_RXDMA_TIMEOUT, - .dma_rx_poll_rate = DEFAULT_RXDMA_POLLRATE, - .autosuspend_timeout = 5000, - .wakeup_capable = false, - }, - { - .dma_enabled = false, /* To specify DMA Mode */ - .dma_rx_buf_size = DEFAULT_RXDMA_BUFSIZE, - .dma_rx_timeout = DEFAULT_RXDMA_TIMEOUT, - .dma_rx_poll_rate = DEFAULT_RXDMA_POLLRATE, - .autosuspend_timeout = 5000, - .wakeup_capable = false, - }, - { - .dma_enabled = false, /* To specify DMA Mode */ - .dma_rx_buf_size = DEFAULT_RXDMA_BUFSIZE, - .dma_rx_timeout = DEFAULT_RXDMA_TIMEOUT, - .dma_rx_poll_rate = DEFAULT_RXDMA_POLLRATE, - .autosuspend_timeout = -1, - .wakeup_capable = true, - }, - { - .dma_enabled = false, /* To specify DMA Mode */ - .dma_rx_buf_size = DEFAULT_RXDMA_BUFSIZE, - .dma_rx_timeout = DEFAULT_RXDMA_TIMEOUT, - .dma_rx_poll_rate = DEFAULT_RXDMA_POLLRATE, - .autosuspend_timeout = 5000, - .wakeup_capable = false, - }, -}; - - -/*************************************************************************** - * DEVICE TREE STUFF - * - * Trying to include some DT stuff with our board file. Not sure how this - * will work out... - */ - -static struct of_device_id omap_dt_match_table[] __initdata = { - { .compatible = "olio,omap3-h1", }, - { .compatible = "simple-bus", }, - { .compatible = "ti,omap-infra", }, - { } -}; - - /*************************************************************************** * omap3_h1_i2c_init - init the i2c buses * @@ -1077,8 +321,8 @@ static int __init omap3_h1_i2c_init(void) omap3h1_i2c2_board_info[2].irq = gpio_to_irq(ATMEL_MXT_GPIO); omap3h1_i2c2_board_info[0].irq = acc_irq; - ((struct tps65910_board *) (omap3h1_i2c1_board_info[0].platform_data))->irq = - gpio_to_irq (TPS_SYS_NIRQ); + // ((struct tps65910_board *) (omap3h1_i2c1_board_info[0].platform_data))->irq = + // gpio_to_irq (TPS_SYS_NIRQ); #else omap3h1_i2c1_board_info[3].irq = gpio_to_irq(ATMEL_MXT_GPIO); omap3h1_i2c1_board_info[1].irq = acc_irq; @@ -1088,7 +332,7 @@ static int __init omap3_h1_i2c_init(void) /* Register buses */ - omap_register_i2c_bus(1, 400, omap3h1_i2c1_board_info, ARRAY_SIZE(omap3h1_i2c1_board_info)); + // omap_register_i2c_bus(1, 400, omap3h1_i2c1_board_info, ARRAY_SIZE(omap3h1_i2c1_board_info)); #ifdef CONFIG_MACH_OMAP3_H1_DVT2 omap_register_i2c_bus(2, 400, omap3h1_i2c2_board_info, ARRAY_SIZE(omap3h1_i2c2_board_info)); #else @@ -1104,84 +348,11 @@ static int __init omap3_h1_i2c_init(void) static struct platform_device *omap3h1_devices[] __initdata = { - &omap3h1_vbat, &bcm20702_bluetooth_device, &nop_phy_device, &omap3h1_dmic_codec, }; - -#ifdef CONFIG_OMAP_MUX -static struct omap_board_mux board_mux[] __initdata = { - -#if defined(CONFIG_MACH_OMAP3_H1_DVT1) || defined(CONFIG_MACH_OMAP3_H1_DVT2) - OMAP3_MUX(CAM_HS, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), -#else - OMAP3_MUX(HSUSB0_DIR, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), -#endif - OMAP3_MUX(DSS_PCLK, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - OMAP3_MUX(DSS_HSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - OMAP3_MUX(DSS_VSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - OMAP3_MUX(DSS_DATA0, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - OMAP3_MUX(DSS_DATA1, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - OMAP3_MUX(DSS_DATA2, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - OMAP3_MUX(DSS_DATA3, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - OMAP3_MUX(DSS_DATA4, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - OMAP3_MUX(DSS_DATA5, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - OMAP3_MUX(DSS_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - OMAP3_MUX(DSS_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - OMAP3_MUX(DSS_DATA8, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - OMAP3_MUX(DSS_DATA9, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - OMAP3_MUX(DSS_DATA10, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - OMAP3_MUX(DSS_DATA11, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - OMAP3_MUX(DSS_DATA12, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - OMAP3_MUX(DSS_DATA13, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - OMAP3_MUX(DSS_DATA14, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - OMAP3_MUX(DSS_DATA15, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - OMAP3_MUX(DSS_DATA16, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - OMAP3_MUX(DSS_DATA17, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - - OMAP3_MUX(MCSPI1_CLK, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - OMAP3_MUX(MCSPI1_SIMO, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - OMAP3_MUX(MCSPI1_SOMI, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), - OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), - - /* TOUCH_RESET */ - - OMAP3_MUX(CAM_D6, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP), - -#if defined(CONFIG_MACH_OMAP3_H1_DVT1) || defined(CONFIG_MACH_OMAP3_H1_DVT2) - /* USB pin settings (mUSB) */ - - OMAP3_MUX(HSUSB0_CLK, (OMAP_MUX_MODE0 | OMAP_PIN_INPUT)), - OMAP3_MUX(HSUSB0_DATA0, (OMAP_MUX_MODE0 | OMAP_PIN_INPUT)), - OMAP3_MUX(HSUSB0_DATA1, (OMAP_MUX_MODE0 | OMAP_PIN_INPUT)), - OMAP3_MUX(HSUSB0_DATA2, (OMAP_MUX_MODE0 | OMAP_PIN_INPUT)), - OMAP3_MUX(HSUSB0_DATA3, (OMAP_MUX_MODE0 | OMAP_PIN_INPUT)), - OMAP3_MUX(HSUSB0_DATA4, (OMAP_MUX_MODE0 | OMAP_PIN_INPUT)), - OMAP3_MUX(HSUSB0_DATA5, (OMAP_MUX_MODE0 | OMAP_PIN_INPUT)), - OMAP3_MUX(HSUSB0_DATA6, (OMAP_MUX_MODE0 | OMAP_PIN_INPUT)), - OMAP3_MUX(HSUSB0_DATA7, (OMAP_MUX_MODE0 | OMAP_PIN_INPUT)), - OMAP3_MUX(HSUSB0_DIR, (OMAP_MUX_MODE0 | OMAP_PIN_INPUT)), - OMAP3_MUX(HSUSB0_NXT, (OMAP_MUX_MODE0 | OMAP_PIN_INPUT)), - OMAP3_MUX(HSUSB0_STP, (OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT)), -#endif /* CONFIG_MACH_OMAP3_H1_DVT */ - - /* accelerometer */ - - OMAP3_MUX(JTAG_EMU1, (OMAP_MUX_MODE4 | OMAP_PIN_INPUT - | OMAP_PIN_OFF_WAKEUPENABLE)), - - /* USB on */ - - OMAP3_MUX(ETK_D7, (OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT)), - - OMAP3_MUX(SYS_NIRQ, (OMAP_MUX_MODE0 | OMAP_PIN_INPUT)), - - { .reg_offset = OMAP_MUX_TERMINATOR }, -}; -#endif - static void __init omap3_h1_init(void) { /* Read what we can from the device tree */ @@ -1194,42 +365,17 @@ static void __init omap3_h1_init(void) omap_sdrc_init(mt29c8g96_sdrc_params, mt29c8g96_sdrc_params); - /* This is done in our device tree file now */ - /* omap3_mux_init(board_mux, OMAP_PACKAGE_CBP); */ - omap3_h1_i2c_init(); - /* Set up the voltage domains */ - omap3_voltdm_init(); - platform_add_devices(omap3h1_devices, ARRAY_SIZE(omap3h1_devices)); omap3h1_spi_init(); -#if 0 - omap_serial_board_init(omap_uart_ports); -#endif - omap_display_init(&omap3h1_dss_data); usb_bind_phy("musb-hdrc.0.auto", 0, "nop_usb_xceiv"); /* "tusb-usb-h1" */ usb_musb_init(&musb_board_data); - -#ifdef ONLY_KEEPING_THIS_STUFF_FOR_NOSTALGIC_REASONS - - /* For handling interrupts from the accelerometer */ - - previous = jiffies; - - /* Init the code that handles wake ups */ - - omap3_wake_init(); - - omap3_acc_irq_init(omap3h1_i2c2_board_info[0].irq, (void *) &omap3h1_devices); - -#endif /* ONLY_KEEPING_THIS_STUFF_FOR_NOSTALGIC_REASONS */ - } static const char *omap3_h1_boards_compat[] __initdata = { diff --git a/arch/arm/mach-omap2/opp.c b/arch/arm/mach-omap2/opp.c index 7149f838be4..82fd8c72f75 100644 --- a/arch/arm/mach-omap2/opp.c +++ b/arch/arm/mach-omap2/opp.c @@ -41,10 +41,8 @@ int __init omap_init_opp_table(struct omap_opp_def *opp_def, { int i, r; - /* OLIO HACK if (of_have_populated_dt()) return -EINVAL; - */ if (!opp_def || !opp_def_size) { pr_err("%s: invalid params!\n", __func__); diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c index b2dc18a6b82..b06b22c3f64 100644 --- a/arch/arm/mach-omap2/pm.c +++ b/arch/arm/mach-omap2/pm.c @@ -276,8 +276,6 @@ static inline void omap_init_cpufreq(void) devinfo.name = "omap-cpufreq"; else devinfo.name = "cpufreq-cpu0"; - - devinfo.name = "omap-cpufreq"; /* OLIO HACK */ platform_device_register_full(&devinfo); } @@ -311,6 +309,13 @@ int __init omap2_common_pm_late_init(void) /* Smartreflex device init */ omap_devinit_smartreflex(); + } else { + struct device_node *np; + np = of_find_node_by_name(NULL, "omap_pimic"); + if (np) { + of_platform_populate(np, NULL, NULL, NULL); + of_node_put(np); + } } /* cpufreq dummy device instantiation */ diff --git a/drivers/gpio/gpio-tps65910.c b/drivers/gpio/gpio-tps65910.c index d64de51db97..06146219d9d 100644 --- a/drivers/gpio/gpio-tps65910.c +++ b/drivers/gpio/gpio-tps65910.c @@ -82,7 +82,7 @@ static int tps65910_gpio_input(struct gpio_chip *gc, unsigned offset) GPIO_CFG_MASK); } -#if 0 /* #ifdef CONFIG_OF - olio: We DO have a DT, but no tps info there. */ +#ifdef CONFIG_OF static struct tps65910_board *tps65910_parse_dt_for_gpio(struct device *dev, struct tps65910 *tps65910, int chip_ngpio) { @@ -149,7 +149,7 @@ static int tps65910_gpio_probe(struct platform_device *pdev) tps65910_gpio->gpio_chip.set = tps65910_gpio_set; tps65910_gpio->gpio_chip.get = tps65910_gpio_get; tps65910_gpio->gpio_chip.dev = &pdev->dev; -#if 0 /* #ifdef CONFIG_OF_GPIO */ +#ifdef CONFIG_OF_GPIO tps65910_gpio->gpio_chip.of_node = tps65910->dev->of_node; #endif if (pdata && pdata->gpio_base) diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c index f4b99d84396..28219d12a9f 100644 --- a/drivers/mfd/tps65910.c +++ b/drivers/mfd/tps65910.c @@ -312,6 +312,23 @@ static int tps65910_ck32k_init(struct tps65910 *tps65910, return 0; } +static void tps65910_clear_interrupts(struct tps65910 *tps65910) +{ + u32 val; + int ret; + + ret = tps65910_reg_read(tps65910, TPS65910_INT_STS, &val); + + /* interrupts are cleared by writing '1' to the bit */ + if (val) + ret = tps65910_reg_write(tps65910, TPS65910_INT_STS, val); + + ret = tps65910_reg_read(tps65910, TPS65910_INT_STS2, &val); + + if (val) + ret = tps65910_reg_write(tps65910, TPS65910_INT_STS2, val); +} + static int tps65910_sleepinit(struct tps65910 *tps65910, struct tps65910_board *pmic_pdata) { @@ -320,8 +337,13 @@ static int tps65910_sleepinit(struct tps65910 *tps65910, dev = tps65910->dev; - if (!pmic_pdata->en_dev_slp) - return 0; + /* set polarity of SLLEEPSIG requst ot enter OFF mode */ + ret = tps65910_reg_set_bits(tps65910, TPS65910_DEVCTRL2, + DEVCTRL2_SLEEPSIG_POL_MASK); + if (ret < 0) { + dev_err(dev, "set sleepsig_pol failed: %d\n", ret); + goto err_sleep_init; + } /* enabling SLEEP device state */ ret = tps65910_reg_set_bits(tps65910, TPS65910_DEVCTRL, @@ -497,6 +519,11 @@ static int tps65910_i2c_probe(struct i2c_client *i2c, init_data->irq = pmic_plat_data->irq; init_data->irq_base = pmic_plat_data->irq_base; + /* + * clear pending interrupts - power on event generate several + * interrupts. + */ + tps65910_clear_interrupts(tps65910); tps65910_irq_init(tps65910, init_data->irq, init_data); tps65910_ck32k_init(tps65910, pmic_plat_data); tps65910_sleepinit(tps65910, pmic_plat_data); diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 7c75ab88f9b..815d6df8bd5 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -3673,9 +3673,8 @@ regulator_register(const struct regulator_desc *regulator_desc, add_dev: /* add consumers devices */ - if (init_data) { - for (i = 0; i < init_data->num_consumer_supplies; i++) { + for (i = 0; i < init_data->num_consumer_supplies; i++) { ret = set_consumer_device_supply(rdev, init_data->consumer_supplies[i].dev_name, init_data->consumer_supplies[i].supply); @@ -3685,14 +3684,13 @@ add_dev: goto unset_supplies; } } - } + } list_add(&rdev->list, ®ulator_list); rdev_init_debugfs(rdev); out: mutex_unlock(®ulator_list_mutex); - return rdev; unset_supplies: @@ -3712,8 +3710,7 @@ wash: clean: kfree(rdev); rdev = ERR_PTR(ret); - - goto out; + goto out; } EXPORT_SYMBOL_GPL(regulator_register); @@ -3983,12 +3980,8 @@ static int __init regulator_init_complete(void) * with DT to provide them just assume that a DT enabled * system has full constraints. */ - -#if 0 - // TODO OLIO: This assumption isn't true for us. Not yet, at least. if (of_have_populated_dt()) has_full_constraints = true; -#endif mutex_lock(®ulator_list_mutex); diff --git a/drivers/regulator/omap-pmic-regulator.c b/drivers/regulator/omap-pmic-regulator.c index 2eab7c158e2..ca71c9fd85b 100644 --- a/drivers/regulator/omap-pmic-regulator.c +++ b/drivers/regulator/omap-pmic-regulator.c @@ -518,6 +518,36 @@ static const struct omap_pmic_info omap_tps65912_dcdc4 = { .voltage_selector_zero = true, }; +static const struct omap_pmic_info omap_tps65910_vdd1 = { + .slave_addr = 0x12, + .voltage_reg_addr = 0x22, + .cmd_reg_addr = 0x23, + .i2c_timeout_us = 200, + .slew_rate_uV = 7500, + .step_size_uV = 12500, + .min_uV = 562500, + .max_uV = 1350000, + .voltage_selector_offset = 0, + .voltage_selector_mask = 0x7F, + .voltage_selector_setbits = 0x0, + .voltage_selector_zero = true, +}; + +static const struct omap_pmic_info omap_tps65910_vdd2 = { + .slave_addr = 0x12, + .voltage_reg_addr = 0x24, + .cmd_reg_addr = 0x25, + .i2c_timeout_us = 200, + .slew_rate_uV = 7500, + .step_size_uV = 12500, + .min_uV = 562500, + .max_uV = 1200000, + .voltage_selector_offset = 0, + .voltage_selector_mask = 0x7F, + .voltage_selector_setbits = 0x0, + .voltage_selector_zero = true, +}; + static const struct of_device_id omap_pmic_of_match_tbl[] = { {.compatible = "ti,omap-twl4030-vdd1", .data = &omap_twl4030_vdd1,}, {.compatible = "ti,omap-twl4030-vdd2", .data = &omap_twl4030_vdd2,}, @@ -533,6 +563,8 @@ static const struct of_device_id omap_pmic_of_match_tbl[] = { {.compatible = "ti,omap-twl6035-smps8", .data = &omap_twl6035_smps8,}, {.compatible = "ti,omap-tps65912-dcdc1", .data = &omap_tps65912_dcdc1,}, {.compatible = "ti,omap-tps65912-dcdc4", .data = &omap_tps65912_dcdc4,}, + {.compatible = "ti,omap-tps65910-vdd1", .data = &omap_tps65910_vdd1,}, + {.compatible = "ti,omap-tps65910-vdd2", .data = &omap_tps65910_vdd2,}, {}, }; MODULE_DEVICE_TABLE(of, omap_pmic_of_match_tbl); -- cgit v1.2.3-70-g09d2