[ARM] ventana: register i2c, touchscreen & regulator

register I2C controllers, regulator consumers and the panjit
touchscreen platform_device

Change-Id: Ife13c0d86084f26c734dea2c358f8c4fd3e27a8e
Signed-off-by: Gary King <gking@nvidia.com>
This commit is contained in:
Gary King
2010-07-28 13:05:45 -07:00
committed by Colin Cross
parent 367c3aab79
commit 76f8650a12
4 changed files with 250 additions and 2 deletions

View File

@@ -40,3 +40,4 @@ obj-${CONFIG_MACH_HARMONY} += board-harmony-sdhci.o
obj-${CONFIG_MACH_VENTANA} += board-ventana.o
obj-${CONFIG_MACH_VENTANA} += board-ventana-pinmux.o
obj-${CONFIG_MACH_VENTANA} += board-ventana-sdhci.o
obj-${CONFIG_MACH_VENTANA} += board-ventana-power.o

View File

@@ -0,0 +1,138 @@
/*
* Copyright (C) 2010 NVIDIA, Inc.
*
* 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 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., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307, USA
*/
#include <linux/i2c.h>
#include <linux/regulator/machine.h>
#include <linux/mfd/tps6586x.h>
#include <linux/gpio.h>
static struct regulator_consumer_supply tps658621_sm0_supply[] = {
REGULATOR_SUPPLY("vdd_core", NULL),
};
static struct regulator_consumer_supply tps658621_sm1_supply[] = {
REGULATOR_SUPPLY("vdd_cpu", NULL),
};
static struct regulator_consumer_supply tps658621_sm2_supply[] = {
REGULATOR_SUPPLY("vdd_sm2", NULL),
};
static struct regulator_consumer_supply tps658621_ldo0_supply[] = {
REGULATOR_SUPPLY("p_cam_avdd", NULL),
};
static struct regulator_consumer_supply tps658621_ldo1_supply[] = {
REGULATOR_SUPPLY("avdd_pll", NULL),
};
static struct regulator_consumer_supply tps658621_ldo2_supply[] = {
REGULATOR_SUPPLY("vdd_rtc", NULL),
};
static struct regulator_consumer_supply tps658621_ldo3_supply[] = {
REGULATOR_SUPPLY("avdd_usb", NULL),
REGULATOR_SUPPLY("avdd_usb_pll", NULL),
};
static struct regulator_consumer_supply tps658621_ldo4_supply[] = {
REGULATOR_SUPPLY("avdd_osc", NULL),
REGULATOR_SUPPLY("vddio_sys", "panjit_touch"),
};
static struct regulator_consumer_supply tps658621_ldo5_supply[] = {
REGULATOR_SUPPLY("vcore_mmc", "sdhci-tegra.1"),
REGULATOR_SUPPLY("vcore_mmc", "sdhci-tegra.3"),
};
static struct regulator_consumer_supply tps658621_ldo6_supply[] = {
REGULATOR_SUPPLY("vddio_vi", NULL),
};
static struct regulator_consumer_supply tps658621_ldo7_supply[] = {
REGULATOR_SUPPLY("avdd_hdmi", NULL),
REGULATOR_SUPPLY("vdd_fuse", NULL),
};
static struct regulator_consumer_supply tps658621_ldo8_supply[] = {
REGULATOR_SUPPLY("avdd_hdmi_pll", NULL),
};
static struct regulator_consumer_supply tps658621_ldo9_supply[] = {
REGULATOR_SUPPLY("avdd_2v85", NULL),
REGULATOR_SUPPLY("vdd_ddr_rx", NULL),
REGULATOR_SUPPLY("avdd_amp", NULL),
};
#define REGULATOR_INIT(_id, _minmv, _maxmv) \
{ \
.constraints = { \
.min_uV = (_minmv)*1000, \
.max_uV = (_maxmv)*1000, \
.valid_modes_mask = (REGULATOR_MODE_NORMAL | \
REGULATOR_MODE_STANDBY), \
.valid_ops_mask = (REGULATOR_CHANGE_MODE | \
REGULATOR_CHANGE_STATUS | \
REGULATOR_CHANGE_VOLTAGE), \
}, \
.num_consumer_supplies = ARRAY_SIZE(tps658621_##_id##_supply),\
.consumer_supplies = tps658621_##_id##_supply, \
}
static struct regulator_init_data sm0_data = REGULATOR_INIT(sm0, 725, 1500);
static struct regulator_init_data sm1_data = REGULATOR_INIT(sm1, 725, 1500);
static struct regulator_init_data sm2_data = REGULATOR_INIT(sm2, 3000, 4550);
static struct regulator_init_data ldo0_data = REGULATOR_INIT(ldo0, 1250, 3300);
static struct regulator_init_data ldo1_data = REGULATOR_INIT(ldo1, 725, 1500);
static struct regulator_init_data ldo2_data = REGULATOR_INIT(ldo2, 725, 1500);
static struct regulator_init_data ldo3_data = REGULATOR_INIT(ldo3, 1250, 3300);
static struct regulator_init_data ldo4_data = REGULATOR_INIT(ldo4, 1700, 2475);
static struct regulator_init_data ldo5_data = REGULATOR_INIT(ldo5, 1250, 3300);
static struct regulator_init_data ldo6_data = REGULATOR_INIT(ldo6, 1250, 3300);
static struct regulator_init_data ldo7_data = REGULATOR_INIT(ldo7, 1250, 3300);
static struct regulator_init_data ldo8_data = REGULATOR_INIT(ldo8, 1250, 3300);
static struct regulator_init_data ldo9_data = REGULATOR_INIT(ldo9, 1250, 3300);
#define TPS_REG(_id, _data) \
{ \
.id = TPS6586X_ID_##_id, \
.name = "tps6586x-regulator", \
.platform_data = _data, \
}
static struct tps6586x_subdev_info tps_devs[] = {
TPS_REG(SM_0, &sm0_data),
TPS_REG(SM_1, &sm1_data),
TPS_REG(SM_2, &sm2_data),
TPS_REG(LDO_0, &ldo0_data),
TPS_REG(LDO_1, &ldo1_data),
TPS_REG(LDO_2, &ldo2_data),
TPS_REG(LDO_3, &ldo3_data),
TPS_REG(LDO_4, &ldo4_data),
TPS_REG(LDO_5, &ldo5_data),
TPS_REG(LDO_6, &ldo6_data),
TPS_REG(LDO_7, &ldo7_data),
TPS_REG(LDO_8, &ldo8_data),
TPS_REG(LDO_9, &ldo9_data),
};
static struct tps6586x_platform_data tps_platform = {
.num_subdevs = ARRAY_SIZE(tps_devs),
.subdevs = tps_devs,
.gpio_base = TEGRA_NR_GPIOS,
};
static struct i2c_board_info __initdata ventana_regulators[] = {
{
I2C_BOARD_INFO("tps6586x", 0x34),
.platform_data = &tps_platform,
},
};
int __init ventana_regulator_init(void)
{
i2c_register_board_info(4, ventana_regulators, 1);
return 0;
}

View File

@@ -29,6 +29,8 @@
#include <linux/pda_power.h>
#include <linux/dma-mapping.h>
#include <linux/delay.h>
#include <linux/i2c-tegra.h>
#include <linux/gpio.h>
#include <mach/iomap.h>
#include <mach/irqs.h>
@@ -41,6 +43,9 @@
#include "board.h"
#include "clock.h"
#include "board-ventana.h"
#include "devices.h"
#include "gpio-names.h"
static struct plat_serial8250_port debug_uart_platform_data[] = {
{
@@ -106,6 +111,56 @@ static struct platform_device tegra_gart_dev = {
.resource = tegra_gart_resources
};
static struct tegra_i2c_platform_data ventana_i2c1_platform_data = {
.adapter_nr = 0,
.bus_count = 1,
.bus_clk_rate = { 400000, 0 },
};
static const struct tegra_pingroup_config i2c2_ddc = {
.pingroup = TEGRA_PINGROUP_DDC,
.func = TEGRA_MUX_I2C2,
};
static const struct tegra_pingroup_config i2c2_gen2 = {
.pingroup = TEGRA_PINGROUP_PTA,
.func = TEGRA_MUX_I2C2,
};
static struct tegra_i2c_platform_data ventana_i2c2_platform_data = {
.adapter_nr = 1,
.bus_count = 2,
.bus_clk_rate = { 400000, 100000 },
.bus_mux = { &i2c2_ddc, &i2c2_gen2 },
.bus_mux_len = { 1, 1 },
};
static struct tegra_i2c_platform_data ventana_i2c3_platform_data = {
.adapter_nr = 3,
.bus_count = 1,
.bus_clk_rate = { 400000, 0 },
};
static struct tegra_i2c_platform_data ventana_dvc_platform_data = {
.adapter_nr = 4,
.bus_count = 1,
.bus_clk_rate = { 400000, 0 },
.is_dvc = true,
};
static void ventana_i2c_init(void)
{
tegra_i2c_device1.dev.platform_data = &ventana_i2c1_platform_data;
tegra_i2c_device2.dev.platform_data = &ventana_i2c2_platform_data;
tegra_i2c_device3.dev.platform_data = &ventana_i2c3_platform_data;
tegra_i2c_device4.dev.platform_data = &ventana_dvc_platform_data;
platform_device_register(&tegra_i2c_device4);
platform_device_register(&tegra_i2c_device3);
platform_device_register(&tegra_i2c_device2);
platform_device_register(&tegra_i2c_device1);
}
static struct platform_device *ventana_devices[] __initdata = {
&debug_uart,
&tegra_udc_device,
@@ -113,8 +168,35 @@ static struct platform_device *ventana_devices[] __initdata = {
&tegra_gart_dev,
};
extern int __init ventana_sdhci_init(void);
extern int __init ventana_pinmux_init(void);
static int ventana_touch_reset(void)
{
gpio_set_value(TEGRA_GPIO_PQ7, 1);
msleep(50);
gpio_set_value(TEGRA_GPIO_PQ7, 0);
msleep(50);
return 0;
}
static const struct i2c_board_info ventana_i2c_bus1_touch_info[] = {
{
I2C_BOARD_INFO("panjit_touch", 0x3),
.irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PV6),
},
};
static int __init ventana_touch_init(void)
{
tegra_gpio_enable(TEGRA_GPIO_PV6);
tegra_gpio_enable(TEGRA_GPIO_PQ7);
gpio_request(TEGRA_GPIO_PQ7, "touch_reset");
gpio_direction_output(TEGRA_GPIO_PQ7, 1);
ventana_touch_reset();
i2c_register_board_info(0, ventana_i2c_bus1_touch_info, 1);
return 0;
}
static void __init tegra_ventana_init(void)
{
@@ -125,6 +207,9 @@ static void __init tegra_ventana_init(void)
platform_add_devices(ventana_devices, ARRAY_SIZE(ventana_devices));
ventana_sdhci_init();
ventana_i2c_init();
ventana_regulator_init();
ventana_touch_init();
}
MACHINE_START(VENTANA, "ventana")

View File

@@ -0,0 +1,24 @@
/*
* arch/arm/mach-tegra/board-ventana.h
*
* Copyright (C) 2010 Google, Inc.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that 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.
*
*/
#ifndef _MACH_TEGRA_BOARD_VENTANA_H
#define _MACH_TEGRA_BOARD_VENTANA_H
int ventana_regulator_init(void);
int ventana_sdhci_init(void);
int ventana_pinmux_init(void);
#endif