diff options
-rw-r--r-- | arch/arm/mach-tegra/board-dalmore-pinmux.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-dalmore-power.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-dalmore-sensors.c | 144 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-dalmore.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-pluto-pinmux-t11x.h | 4 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-pluto-pinmux.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-pluto-sensors.c | 118 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-pluto.h | 1 |
8 files changed, 149 insertions, 124 deletions
diff --git a/arch/arm/mach-tegra/board-dalmore-pinmux.c b/arch/arm/mach-tegra/board-dalmore-pinmux.c index 956643280fc1..0220eda2fb21 100644 --- a/arch/arm/mach-tegra/board-dalmore-pinmux.c +++ b/arch/arm/mach-tegra/board-dalmore-pinmux.c @@ -172,7 +172,6 @@ static __initdata struct tegra_pingroup_config dalmore_pinmux_set_nontristate[] DEFAULT_PINMUX(GPIO_PV1, RSVD, NORMAL, NORMAL, INPUT), DEFAULT_PINMUX(GPIO_PBB3, RSVD3, PULL_DOWN, NORMAL, OUTPUT), - DEFAULT_PINMUX(GPIO_PBB4, RSVD3, PULL_DOWN, NORMAL, OUTPUT), DEFAULT_PINMUX(GPIO_PBB5, RSVD3, PULL_DOWN, NORMAL, OUTPUT), DEFAULT_PINMUX(GPIO_PBB6, RSVD3, PULL_DOWN, NORMAL, OUTPUT), DEFAULT_PINMUX(GPIO_PBB7, RSVD3, PULL_DOWN, NORMAL, OUTPUT), diff --git a/arch/arm/mach-tegra/board-dalmore-power.c b/arch/arm/mach-tegra/board-dalmore-power.c index 74da766e7226..b0b1e5aac0c2 100644 --- a/arch/arm/mach-tegra/board-dalmore-power.c +++ b/arch/arm/mach-tegra/board-dalmore-power.c @@ -75,6 +75,7 @@ static struct regulator_consumer_supply tps65090_dcdc2_supply[] = { REGULATOR_SUPPLY("vdd_sys_dtv_3v3", NULL), REGULATOR_SUPPLY("vcc", "0-007c"), REGULATOR_SUPPLY("vcc", "0-0030"), + REGULATOR_SUPPLY("vin", "2-0030"), }; static struct regulator_consumer_supply tps65090_dcdc3_supply[] = { @@ -760,12 +761,14 @@ static struct regulator_consumer_supply fixed_reg_avdd_usb_hdmi_supply[] = { static struct regulator_consumer_supply fixed_reg_en_1v8_cam_supply[] = { REGULATOR_SUPPLY("dvdd_cam", NULL), REGULATOR_SUPPLY("vdd_cam_1v8", NULL), + REGULATOR_SUPPLY("vi2c", "2-0030"), }; /* EN_CAM_1v8 on e1611 From PMU GP6 */ static struct regulator_consumer_supply fixed_reg_en_1v8_cam_e1611_supply[] = { REGULATOR_SUPPLY("dvdd_cam", NULL), REGULATOR_SUPPLY("vdd_cam_1v8", NULL), + REGULATOR_SUPPLY("vi2c", "2-0030"), }; static struct regulator_consumer_supply fixed_reg_vdd_hdmi_5v0_supply[] = { diff --git a/arch/arm/mach-tegra/board-dalmore-sensors.c b/arch/arm/mach-tegra/board-dalmore-sensors.c index 5800908c64f9..f7fa7aeb02f2 100644 --- a/arch/arm/mach-tegra/board-dalmore-sensors.c +++ b/arch/arm/mach-tegra/board-dalmore-sensors.c @@ -30,30 +30,17 @@ #include <linux/i2c.h> #include <linux/delay.h> -#include <mach/gpio.h> -#include "gpio-names.h" -#include "board.h" -#include <mach/gpio.h> -#include <media/imx091.h> -#include <media/ov9772.h> -#include "board-dalmore.h" -#include "cpu-tegra.h" -#include <generated/mach-types.h> #include <linux/mpu.h> - -#include <linux/i2c.h> -#include <linux/delay.h> #include <linux/regulator/consumer.h> -#include <linux/i2c/pca954x.h> -#include <linux/i2c/pca953x.h> -#include <linux/nct1008.h> #include <linux/gpio.h> #include <linux/therm_est.h> - -#include <mach/fb.h> +#include <linux/nct1008.h> #include <mach/edp.h> -#include <mach/gpio.h> #include <mach/gpio-tegra.h> +#include <media/imx091.h> +#include <media/ov9772.h> +#include <media/as364x.h> +#include <generated/mach-types.h> #include "gpio-names.h" #include "board.h" @@ -119,6 +106,8 @@ static struct i2c_board_info dalmore_i2c4_nct1008_board_info[] = { } }; +static struct regulator *dalmore_vcmvdd; + static int dalmore_imx091_power_on(struct device *dev) { int i; @@ -172,6 +161,11 @@ static int dalmore_imx091_power_off(struct device *dev) return 0; } +struct imx091_platform_data dalmore_imx091_data = { + .power_on = dalmore_imx091_power_on, + .power_off = dalmore_imx091_power_off, +}; + static int dalmore_ov9772_power_on(struct device *dev) { int i; @@ -230,7 +224,7 @@ static struct nvc_gpio_pdata ov9772_gpio_pdata[] = { { OV9772_GPIO_TYPE_PWRDN, TEGRA_GPIO_PBB3, true, 0, }, }; -static struct ov9772_platform_data ov9772_pdata = { +static struct ov9772_platform_data dalmore_ov9772_pdata = { .num = 1, .dev_name = "camera", .gpio_count = ARRAY_SIZE(ov9772_gpio_pdata), @@ -239,9 +233,46 @@ static struct ov9772_platform_data ov9772_pdata = { .power_off = dalmore_ov9772_power_off, }; -struct imx091_platform_data dalmore_imx091_data = { - .power_on = dalmore_imx091_power_on, - .power_off = dalmore_imx091_power_off, +static int dalmore_as3648_power_on(struct as364x_power_rail *pw) +{ + if (!dalmore_vcmvdd) { + dalmore_vcmvdd = regulator_get(NULL, "vdd_af_cam1"); + if (unlikely(WARN_ON(IS_ERR(dalmore_vcmvdd)))) { + pr_err("%s: can't get regulator vdd_af_cam1: %ld\n", + __func__, PTR_ERR(dalmore_vcmvdd)); + dalmore_vcmvdd = NULL; + return -ENODEV; + } + } + + return regulator_enable(dalmore_vcmvdd); +} + +static int dalmore_as3648_power_off(struct as364x_power_rail *pw) +{ + if (!dalmore_vcmvdd) + return -ENODEV; + + return regulator_disable(dalmore_vcmvdd); +} + +static struct as364x_platform_data dalmore_as3648_pdata = { + .config = { + .max_total_current_mA = 1000, + .max_peak_current_mA = 600, + .strobe_type = 1, + }, + .pinstate = { + .mask = 1 << (CAM_FLASH_STROBE - TEGRA_GPIO_PBB0), + .values = 1 << (CAM_FLASH_STROBE - TEGRA_GPIO_PBB0) + }, + .dev_name = "torch", + .type = AS3648, + .gpio_strobe = CAM_FLASH_STROBE, + .led_mask = 3, + + .power_on_callback = dalmore_as3648_power_on, + .power_off_callback = dalmore_as3648_power_off, }; static struct i2c_board_info dalmore_i2c_board_info_e1625[] = { @@ -251,7 +282,11 @@ static struct i2c_board_info dalmore_i2c_board_info_e1625[] = { }, { I2C_BOARD_INFO("ov9772", 0x10), - .platform_data = &ov9772_pdata, + .platform_data = &dalmore_ov9772_pdata, + }, + { + I2C_BOARD_INFO("as3648", 0x30), + .platform_data = &dalmore_as3648_pdata, }, }; @@ -300,7 +335,7 @@ static int dalmore_camera_init(void) i2c_register_board_info(2, dalmore_i2c_board_info_e1625, ARRAY_SIZE(dalmore_i2c_board_info_e1625)); - + return 0; fail_free_gpio: while (i--) @@ -314,7 +349,8 @@ fail_free_gpio: static struct mpu_platform_data mpu9150_gyro_data = { .int_config = 0x10, .level_shifter = 0, - .orientation = MPU_GYRO_ORIENTATION, /* Located in board_[platformname].h */ + /* Located in board_[platformname].h */ + .orientation = MPU_GYRO_ORIENTATION, .sec_slave_type = SECONDARY_SLAVE_TYPE_COMPASS, .sec_slave_id = COMPASS_ID_AK8975, .secondary_i2c_addr = MPU_COMPASS_ADDR, @@ -338,39 +374,39 @@ static struct i2c_board_info dalmore_i2c_board_info_cm3218[] = { }; static struct i2c_board_info __initdata inv_mpu9150_i2c2_board_info[] = { - { - I2C_BOARD_INFO(MPU_GYRO_NAME, MPU_GYRO_ADDR), - .platform_data = &mpu9150_gyro_data, - }, + { + I2C_BOARD_INFO(MPU_GYRO_NAME, MPU_GYRO_ADDR), + .platform_data = &mpu9150_gyro_data, + }, }; static void mpuirq_init(void) { - int ret = 0; - unsigned gyro_irq_gpio = MPU_GYRO_IRQ_GPIO; - unsigned gyro_bus_num = MPU_GYRO_BUS_NUM; - char *gyro_name = MPU_GYRO_NAME; - - pr_info("*** MPU START *** mpuirq_init...\n"); - - ret = gpio_request(gyro_irq_gpio, gyro_name); - - if (ret < 0) { - pr_err("%s: gpio_request failed %d\n", __func__, ret); - return; - } - - ret = gpio_direction_input(gyro_irq_gpio); - if (ret < 0) { - pr_err("%s: gpio_direction_input failed %d\n", __func__, ret); - gpio_free(gyro_irq_gpio); - return; - } - pr_info("*** MPU END *** mpuirq_init...\n"); - - inv_mpu9150_i2c2_board_info[0].irq = gpio_to_irq(MPU_GYRO_IRQ_GPIO); - i2c_register_board_info(gyro_bus_num, inv_mpu9150_i2c2_board_info, - ARRAY_SIZE(inv_mpu9150_i2c2_board_info)); + int ret = 0; + unsigned gyro_irq_gpio = MPU_GYRO_IRQ_GPIO; + unsigned gyro_bus_num = MPU_GYRO_BUS_NUM; + char *gyro_name = MPU_GYRO_NAME; + + pr_info("*** MPU START *** mpuirq_init...\n"); + + ret = gpio_request(gyro_irq_gpio, gyro_name); + + if (ret < 0) { + pr_err("%s: gpio_request failed %d\n", __func__, ret); + return; + } + + ret = gpio_direction_input(gyro_irq_gpio); + if (ret < 0) { + pr_err("%s: gpio_direction_input failed %d\n", __func__, ret); + gpio_free(gyro_irq_gpio); + return; + } + pr_info("*** MPU END *** mpuirq_init...\n"); + + inv_mpu9150_i2c2_board_info[0].irq = gpio_to_irq(MPU_GYRO_IRQ_GPIO); + i2c_register_board_info(gyro_bus_num, inv_mpu9150_i2c2_board_info, + ARRAY_SIZE(inv_mpu9150_i2c2_board_info)); } static int dalmore_nct1008_init(void) diff --git a/arch/arm/mach-tegra/board-dalmore.h b/arch/arm/mach-tegra/board-dalmore.h index 1371b9cd3441..1c2cc6a7b6d0 100644 --- a/arch/arm/mach-tegra/board-dalmore.h +++ b/arch/arm/mach-tegra/board-dalmore.h @@ -68,6 +68,7 @@ /* Camera related GPIOs */ #define CAM_RSTN TEGRA_GPIO_PBB3 +#define CAM_FLASH_STROBE TEGRA_GPIO_PBB4 #define CAM1_POWER_DWN_GPIO TEGRA_GPIO_PBB5 #define CAM2_POWER_DWN_GPIO TEGRA_GPIO_PBB6 #define CAM_AF_PWDN TEGRA_GPIO_PBB7 diff --git a/arch/arm/mach-tegra/board-pluto-pinmux-t11x.h b/arch/arm/mach-tegra/board-pluto-pinmux-t11x.h index a40d81e2a732..443efe21dcc3 100644 --- a/arch/arm/mach-tegra/board-pluto-pinmux-t11x.h +++ b/arch/arm/mach-tegra/board-pluto-pinmux-t11x.h @@ -65,6 +65,9 @@ static __initdata struct tegra_pingroup_config pluto_pinmux_common[] = { /* VI_ALT1 pinmux */ VI_PINMUX(GPIO_PBB0, VI_ALT3, NORMAL, NORMAL, OUTPUT, DEFAULT, DEFAULT), + /* VGP4 pinmux */ + VI_PINMUX(GPIO_PBB4, VGP4, NORMAL, NORMAL, OUTPUT, DEFAULT, DEFAULT), + /* I2C2 pinmux */ I2C_PINMUX(GEN2_I2C_SCL, I2C2, NORMAL, NORMAL, INPUT, DISABLE, ENABLE), I2C_PINMUX(GEN2_I2C_SDA, I2C2, NORMAL, NORMAL, INPUT, DISABLE, ENABLE), @@ -237,7 +240,6 @@ static struct gpio_init_pin_info init_gpio_mode_pluto_common[] = { GPIO_INIT_PIN_MODE(TEGRA_GPIO_PO7, true, 0), GPIO_INIT_PIN_MODE(TEGRA_GPIO_PO0, true, 0), GPIO_INIT_PIN_MODE(TEGRA_GPIO_PBB3, false, 0), - GPIO_INIT_PIN_MODE(TEGRA_GPIO_PBB4, false, 0), GPIO_INIT_PIN_MODE(TEGRA_GPIO_PBB5, false, 0), GPIO_INIT_PIN_MODE(TEGRA_GPIO_PBB6, false, 0), GPIO_INIT_PIN_MODE(TEGRA_GPIO_PBB7, false, 0), diff --git a/arch/arm/mach-tegra/board-pluto-pinmux.c b/arch/arm/mach-tegra/board-pluto-pinmux.c index bd84d1708df4..595659fd92ba 100644 --- a/arch/arm/mach-tegra/board-pluto-pinmux.c +++ b/arch/arm/mach-tegra/board-pluto-pinmux.c @@ -165,7 +165,6 @@ static __initdata struct tegra_pingroup_config pluto_pinmux_set_nontristate[] = DEFAULT_PINMUX(ULPI_DATA7, ULPI, NORMAL, NORMAL, OUTPUT), DEFAULT_PINMUX(GPIO_PBB3, RSVD3, PULL_DOWN, NORMAL, OUTPUT), - DEFAULT_PINMUX(GPIO_PBB4, RSVD3, PULL_DOWN, NORMAL, OUTPUT), DEFAULT_PINMUX(GPIO_PBB5, RSVD3, PULL_DOWN, NORMAL, OUTPUT), DEFAULT_PINMUX(GPIO_PBB6, RSVD3, PULL_DOWN, NORMAL, OUTPUT), DEFAULT_PINMUX(GPIO_PBB7, RSVD3, PULL_DOWN, NORMAL, OUTPUT), diff --git a/arch/arm/mach-tegra/board-pluto-sensors.c b/arch/arm/mach-tegra/board-pluto-sensors.c index c1844cfe0d7c..597b8aa487c5 100644 --- a/arch/arm/mach-tegra/board-pluto-sensors.c +++ b/arch/arm/mach-tegra/board-pluto-sensors.c @@ -2,38 +2,35 @@ * arch/arm/mach-tegra/board-pluto-sensors.c * * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT + + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + + * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <linux/err.h> #include <linux/i2c.h> #include <linux/delay.h> #include <linux/regulator/consumer.h> -#include <mach/edp.h> #include <linux/gpio.h> #include <linux/mpu.h> #include <linux/max77665-charger.h> #include <linux/mfd/max77665.h> #include <linux/power/max17042_battery.h> -#include <mach/gpio.h> +#include <linux/nct1008.h> +#include <mach/edp.h> #include <mach/gpio-tegra.h> #include <media/max77665-flash.h> #include <media/imx091.h> #include <media/imx132.h> #include <media/ad5816.h> -#include <linux/nct1008.h> #include "gpio-names.h" #include "board.h" #include "board-pluto.h" @@ -41,11 +38,9 @@ #include "devices.h" #include "tegra-board-id.h" -#define CAMERA_FLASH_SYNC_GPIO TEGRA_GPIO_PBB4 #define NTC_10K_TGAIN 0xE6A2 #define NTC_10K_TOFF 0x2694 -static struct max77665_muic_platform_data max77665_muic; static struct board_info board_info; static struct max17042_config_data conf_data = { .valrt_thresh = 0xff00, @@ -114,27 +109,16 @@ static struct i2c_board_info max17042_device[] = { static struct max77665_f_platform_data pluto_max77665_flash_pdata = { .config = { .led_mask = 3, - .flash_on_torch = true, + .flash_on_torch = true, .max_total_current_mA = 1000, .max_peak_current_mA = 600, }, .pinstate = { - .mask = 1 << (CAMERA_FLASH_SYNC_GPIO - TEGRA_GPIO_PBB0), - .values = 1 << (CAMERA_FLASH_SYNC_GPIO - TEGRA_GPIO_PBB0) + .mask = 1 << (CAM_FLASH_STROBE - TEGRA_GPIO_PBB0), + .values = 1 << (CAM_FLASH_STROBE - TEGRA_GPIO_PBB0), }, .dev_name = "torch", - .gpio_strobe = CAMERA_FLASH_SYNC_GPIO, -}; - -static struct max77665_platform_data pluto_max77665_pdata = { - .irq_base = 0, -}; - -static const struct i2c_board_info pluto_i2c_board_info_max77665[] = { - { - I2C_BOARD_INFO("max77665", 0x66), - .platform_data = &pluto_max77665_pdata, - }, + .gpio_strobe = CAM_FLASH_STROBE, }; static struct max77665_charger_cable maxim_cable[] = { @@ -166,6 +150,33 @@ static struct max77665_charger_plat_data max77665_charger = { .cables = maxim_cable, }; +static struct max77665_muic_platform_data max77665_muic = { + .irq_base = 0, +}; + +static struct max77665_platform_data pluto_max77665_pdata = { + .irq_base = 0, + .muic_platform_data = { + .pdata = &max77665_muic, + .size = sizeof(max77665_muic), + }, + .charger_platform_data = { + .pdata = &max77665_charger, + .size = sizeof(max77665_charger), + }, + .flash_platform_data = { + .pdata = &pluto_max77665_flash_pdata, + .size = sizeof(pluto_max77665_flash_pdata), + }, +}; + +static const struct i2c_board_info pluto_i2c_board_info_max77665[] = { + { + I2C_BOARD_INFO("max77665", 0x66), + .platform_data = &pluto_max77665_pdata, + }, +}; + /* isl29029 support is provided by isl29028*/ static struct i2c_board_info pluto_i2c1_isl_board_info[] = { { @@ -617,8 +628,6 @@ late_initcall(pluto_skin_init); int __init pluto_sensors_init(void) { - struct platform_device *pd; - struct platform_device *charger_pd, *muic_pd; int err; tegra_get_board_info(&board_info); @@ -630,48 +639,23 @@ int __init pluto_sensors_init(void) if (err) return err; - i2c_register_board_info(0, pluto_i2c1_isl_board_info, + err = i2c_register_board_info(0, pluto_i2c1_isl_board_info, ARRAY_SIZE(pluto_i2c1_isl_board_info)); - mpuirq_init(); - - max77665_muic.irq_base = 0; - muic_pd = kmemdup(&max77665_muic, sizeof(max77665_muic), GFP_KERNEL); - if (muic_pd == NULL) { - pr_err("%s failed to allocate memory\n", __func__); - return -ENOMEM; - } - - pluto_max77665_pdata.muic_platform_data.pdata = muic_pd; - pluto_max77665_pdata.muic_platform_data.size = sizeof(*muic_pd); - - charger_pd = kmemdup(&max77665_charger, sizeof(max77665_charger), - GFP_KERNEL); - if (charger_pd == NULL) { - pr_err("%s failed to allocate memory\n", __func__); - return -ENOMEM; - } - - pluto_max77665_pdata.charger_platform_data.pdata = charger_pd; - pluto_max77665_pdata.charger_platform_data.size = sizeof(*charger_pd); - - pd = kmemdup(&pluto_max77665_flash_pdata, - sizeof(pluto_max77665_flash_pdata), GFP_KERNEL); - if (pd == NULL) { - pr_err("%s failed to allocate memory\n", __func__); - return -ENOMEM; - } + if (err) + pr_err("%s: isl board register failed.\n", __func__); - pluto_max77665_pdata.flash_platform_data.pdata = pd; - pluto_max77665_pdata.flash_platform_data.size = sizeof(*pd); + mpuirq_init(); err = i2c_register_board_info(4, pluto_i2c_board_info_max77665, ARRAY_SIZE(pluto_i2c_board_info_max77665)); - if (err) - pr_err("%s: platform device register failed.\n", __func__); + pr_err("%s: max77665 device register failed.\n", __func__); - i2c_register_board_info(0, max17042_device, + err = i2c_register_board_info(0, max17042_device, ARRAY_SIZE(max17042_device)); + if (err) + pr_err("%s: max17042 device register failed.\n", __func__); + return 0; } diff --git a/arch/arm/mach-tegra/board-pluto.h b/arch/arm/mach-tegra/board-pluto.h index b3a8d665f9c4..f8cf80e928ef 100644 --- a/arch/arm/mach-tegra/board-pluto.h +++ b/arch/arm/mach-tegra/board-pluto.h @@ -55,6 +55,7 @@ /* Camera related GPIOs */ #define CAM_RSTN TEGRA_GPIO_PBB3 +#define CAM_FLASH_STROBE TEGRA_GPIO_PBB4 #define CAM1_POWER_DWN_GPIO TEGRA_GPIO_PBB5 #define CAM2_POWER_DWN_GPIO TEGRA_GPIO_PBB6 #define CAM_AF_PWDN TEGRA_GPIO_PBB7 |