arm: removed some unnecessary files.
This commit is contained in:
parent
1ba3e2deca
commit
8dc5f7b605
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,177 +0,0 @@
|
||||
/* linux/arch/arm/mach-msm/board-halibut-keypad.c
|
||||
*
|
||||
* Copyright (C) 2007 Google, Inc.
|
||||
* Author: Brian Swetland <swetland@google.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/gpio_event.h>
|
||||
|
||||
#undef MODULE_PARAM_PREFIX
|
||||
#define MODULE_PARAM_PREFIX "board_halibut."
|
||||
static int halibut_ffa;
|
||||
module_param_named(ffa, halibut_ffa, int, S_IRUGO | S_IWUSR | S_IWGRP);
|
||||
|
||||
#define SCAN_FUNCTION_KEYS 0 /* don't turn this on without updating the ffa support */
|
||||
|
||||
static unsigned int halibut_row_gpios[] = {
|
||||
31, 32, 33, 34, 35, 41
|
||||
#if SCAN_FUNCTION_KEYS
|
||||
, 42
|
||||
#endif
|
||||
};
|
||||
|
||||
static unsigned int halibut_col_gpios[] = { 36, 37, 38, 39, 40 };
|
||||
|
||||
/* FFA:
|
||||
36: KEYSENSE_N(0)
|
||||
37: KEYSENSE_N(1)
|
||||
38: KEYSENSE_N(2)
|
||||
39: KEYSENSE_N(3)
|
||||
40: KEYSENSE_N(4)
|
||||
|
||||
31: KYPD_17
|
||||
32: KYPD_15
|
||||
33: KYPD_13
|
||||
34: KYPD_11
|
||||
35: KYPD_9
|
||||
41: KYPD_MEMO
|
||||
*/
|
||||
|
||||
#define KEYMAP_INDEX(row, col) ((row)*ARRAY_SIZE(halibut_col_gpios) + (col))
|
||||
|
||||
static const unsigned short halibut_keymap[ARRAY_SIZE(halibut_col_gpios) * ARRAY_SIZE(halibut_row_gpios)] = {
|
||||
[KEYMAP_INDEX(0, 0)] = KEY_5,
|
||||
[KEYMAP_INDEX(0, 1)] = KEY_9,
|
||||
[KEYMAP_INDEX(0, 2)] = 229, /* SOFT1 */
|
||||
[KEYMAP_INDEX(0, 3)] = KEY_6,
|
||||
[KEYMAP_INDEX(0, 4)] = KEY_LEFT,
|
||||
|
||||
[KEYMAP_INDEX(1, 0)] = KEY_0,
|
||||
[KEYMAP_INDEX(1, 1)] = KEY_RIGHT,
|
||||
[KEYMAP_INDEX(1, 2)] = KEY_1,
|
||||
[KEYMAP_INDEX(1, 3)] = 228, /* KEY_SHARP */
|
||||
[KEYMAP_INDEX(1, 4)] = KEY_SEND,
|
||||
|
||||
[KEYMAP_INDEX(2, 0)] = KEY_VOLUMEUP,
|
||||
[KEYMAP_INDEX(2, 1)] = KEY_HOME, /* FA */
|
||||
[KEYMAP_INDEX(2, 2)] = KEY_F8, /* QCHT */
|
||||
[KEYMAP_INDEX(2, 3)] = KEY_F6, /* R+ */
|
||||
[KEYMAP_INDEX(2, 4)] = KEY_F7, /* R- */
|
||||
|
||||
[KEYMAP_INDEX(3, 0)] = KEY_UP,
|
||||
[KEYMAP_INDEX(3, 1)] = KEY_CLEAR,
|
||||
[KEYMAP_INDEX(3, 2)] = KEY_4,
|
||||
[KEYMAP_INDEX(3, 3)] = KEY_MUTE, /* SPKR */
|
||||
[KEYMAP_INDEX(3, 4)] = KEY_2,
|
||||
|
||||
[KEYMAP_INDEX(4, 0)] = 230, /* SOFT2 */
|
||||
[KEYMAP_INDEX(4, 1)] = 232, /* KEY_CENTER */
|
||||
[KEYMAP_INDEX(4, 2)] = KEY_DOWN,
|
||||
[KEYMAP_INDEX(4, 3)] = KEY_BACK, /* FB */
|
||||
[KEYMAP_INDEX(4, 4)] = KEY_8,
|
||||
|
||||
[KEYMAP_INDEX(5, 0)] = KEY_VOLUMEDOWN,
|
||||
[KEYMAP_INDEX(5, 1)] = 227, /* KEY_STAR */
|
||||
[KEYMAP_INDEX(5, 2)] = KEY_MAIL, /* MESG */
|
||||
[KEYMAP_INDEX(5, 3)] = KEY_3,
|
||||
[KEYMAP_INDEX(5, 4)] = KEY_7,
|
||||
|
||||
#if SCAN_FUNCTION_KEYS
|
||||
[KEYMAP_INDEX(6, 0)] = KEY_F5,
|
||||
[KEYMAP_INDEX(6, 1)] = KEY_F4,
|
||||
[KEYMAP_INDEX(6, 2)] = KEY_F3,
|
||||
[KEYMAP_INDEX(6, 3)] = KEY_F2,
|
||||
[KEYMAP_INDEX(6, 4)] = KEY_F1
|
||||
#endif
|
||||
};
|
||||
|
||||
static const unsigned short halibut_keymap_ffa[ARRAY_SIZE(halibut_col_gpios) * ARRAY_SIZE(halibut_row_gpios)] = {
|
||||
/*[KEYMAP_INDEX(0, 0)] = ,*/
|
||||
/*[KEYMAP_INDEX(0, 1)] = ,*/
|
||||
[KEYMAP_INDEX(0, 2)] = KEY_1,
|
||||
[KEYMAP_INDEX(0, 3)] = KEY_SEND,
|
||||
[KEYMAP_INDEX(0, 4)] = KEY_LEFT,
|
||||
|
||||
[KEYMAP_INDEX(1, 0)] = KEY_3,
|
||||
[KEYMAP_INDEX(1, 1)] = KEY_RIGHT,
|
||||
[KEYMAP_INDEX(1, 2)] = KEY_VOLUMEUP,
|
||||
/*[KEYMAP_INDEX(1, 3)] = ,*/
|
||||
[KEYMAP_INDEX(1, 4)] = KEY_6,
|
||||
|
||||
[KEYMAP_INDEX(2, 0)] = KEY_HOME, /* A */
|
||||
[KEYMAP_INDEX(2, 1)] = KEY_BACK, /* B */
|
||||
[KEYMAP_INDEX(2, 2)] = KEY_0,
|
||||
[KEYMAP_INDEX(2, 3)] = 228, /* KEY_SHARP */
|
||||
[KEYMAP_INDEX(2, 4)] = KEY_9,
|
||||
|
||||
[KEYMAP_INDEX(3, 0)] = KEY_UP,
|
||||
[KEYMAP_INDEX(3, 1)] = 232, /* KEY_CENTER */ /* i */
|
||||
[KEYMAP_INDEX(3, 2)] = KEY_4,
|
||||
/*[KEYMAP_INDEX(3, 3)] = ,*/
|
||||
[KEYMAP_INDEX(3, 4)] = KEY_2,
|
||||
|
||||
[KEYMAP_INDEX(4, 0)] = KEY_VOLUMEDOWN,
|
||||
[KEYMAP_INDEX(4, 1)] = KEY_SOUND,
|
||||
[KEYMAP_INDEX(4, 2)] = KEY_DOWN,
|
||||
[KEYMAP_INDEX(4, 3)] = KEY_8,
|
||||
[KEYMAP_INDEX(4, 4)] = KEY_5,
|
||||
|
||||
/*[KEYMAP_INDEX(5, 0)] = ,*/
|
||||
[KEYMAP_INDEX(5, 1)] = 227, /* KEY_STAR */
|
||||
[KEYMAP_INDEX(5, 2)] = 230, /*SOFT2*/ /* 2 */
|
||||
[KEYMAP_INDEX(5, 3)] = KEY_MENU, /* 1 */
|
||||
[KEYMAP_INDEX(5, 4)] = KEY_7,
|
||||
};
|
||||
|
||||
static struct gpio_event_matrix_info halibut_matrix_info = {
|
||||
.info.func = gpio_event_matrix_func,
|
||||
.keymap = halibut_keymap,
|
||||
.output_gpios = halibut_row_gpios,
|
||||
.input_gpios = halibut_col_gpios,
|
||||
.noutputs = ARRAY_SIZE(halibut_row_gpios),
|
||||
.ninputs = ARRAY_SIZE(halibut_col_gpios),
|
||||
.settle_time.tv.nsec = 0,
|
||||
.poll_time.tv.nsec = 20 * NSEC_PER_MSEC,
|
||||
.flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_DRIVE_INACTIVE | GPIOKPF_PRINT_UNMAPPED_KEYS /*| GPIOKPF_PRINT_MAPPED_KEYS*/
|
||||
};
|
||||
|
||||
struct gpio_event_info *halibut_keypad_info[] = {
|
||||
&halibut_matrix_info.info
|
||||
};
|
||||
|
||||
static struct gpio_event_platform_data halibut_keypad_data = {
|
||||
.name = "halibut_keypad",
|
||||
.info = halibut_keypad_info,
|
||||
.info_count = ARRAY_SIZE(halibut_keypad_info)
|
||||
};
|
||||
|
||||
static struct platform_device halibut_keypad_device = {
|
||||
.name = GPIO_EVENT_DEV_NAME,
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &halibut_keypad_data,
|
||||
},
|
||||
};
|
||||
|
||||
static int __init halibut_init_keypad(void)
|
||||
{
|
||||
if (!machine_is_halibut())
|
||||
return 0;
|
||||
if (halibut_ffa)
|
||||
halibut_matrix_info.keymap = halibut_keymap_ffa;
|
||||
return platform_device_register(&halibut_keypad_device);
|
||||
}
|
||||
|
||||
device_initcall(halibut_init_keypad);
|
@ -1,73 +0,0 @@
|
||||
/* linux/arch/arm/mach-msm/board-halibut-mddi.c
|
||||
** Author: Brian Swetland <swetland@google.com>
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/bootmem.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/gpio.h>
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include <mach/msm_fb.h>
|
||||
#include <mach/vreg.h>
|
||||
|
||||
#include "proc_comm.h"
|
||||
#include "devices.h"
|
||||
#include "board-halibut.h"
|
||||
|
||||
static void halibut_mddi_power_client(struct msm_mddi_client_data *mddi,
|
||||
int on)
|
||||
{
|
||||
}
|
||||
|
||||
static struct resource resources_msm_fb = {
|
||||
.start = MSM_FB_BASE,
|
||||
.end = MSM_FB_BASE + MSM_FB_SIZE - 1,
|
||||
.flags = IORESOURCE_MEM,
|
||||
};
|
||||
|
||||
static struct msm_fb_data fb_data = {
|
||||
.xres = 800,
|
||||
.yres = 480,
|
||||
.output_format = 0,
|
||||
};
|
||||
|
||||
static struct msm_mddi_platform_data mddi_pdata = {
|
||||
.clk_rate = 122880000,
|
||||
.power_client = halibut_mddi_power_client,
|
||||
.fb_resource = &resources_msm_fb,
|
||||
.num_clients = 1,
|
||||
.client_platform_data = {
|
||||
{
|
||||
.product_id = (0x4474 << 16 | 0xc065),
|
||||
.name = "mddi_c_dummy",
|
||||
.id = 0,
|
||||
.client_data = &fb_data,
|
||||
.clk_rate = 0,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
int __init halibut_init_panel(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (!machine_is_halibut())
|
||||
return 0;
|
||||
|
||||
rc = platform_device_register(&msm_device_mdp);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
msm_device_mddi0.dev.platform_data = &mddi_pdata;
|
||||
return platform_device_register(&msm_device_mddi0);
|
||||
}
|
||||
|
||||
device_initcall(halibut_init_panel);
|
@ -1,482 +0,0 @@
|
||||
/* linux/arch/arm/mach-msm/board-halibut.c
|
||||
*
|
||||
* Copyright (C) 2007 Google, Inc.
|
||||
* Author: Brian Swetland <swetland@google.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/bootmem.h>
|
||||
|
||||
#include <mach/hardware.h>
|
||||
#include <mach/irqs.h>
|
||||
#include <mach/gpio.h>
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/mach/map.h>
|
||||
#include <asm/mach/flash.h>
|
||||
#include <asm/setup.h>
|
||||
|
||||
#include <mach/irqs.h>
|
||||
#include <mach/board.h>
|
||||
#include <mach/msm_iomap.h>
|
||||
#include <mach/msm_hsusb.h>
|
||||
#include <mach/camera.h>
|
||||
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/android_pmem.h>
|
||||
#include <linux/usb/android_composite.h>
|
||||
|
||||
#include "devices.h"
|
||||
#include "board-halibut.h"
|
||||
#include "proc_comm.h"
|
||||
|
||||
static struct resource smc91x_resources[] = {
|
||||
[0] = {
|
||||
.start = 0x9C004300,
|
||||
.end = 0x9C004400,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
[1] = {
|
||||
.start = MSM_GPIO_TO_INT(49),
|
||||
.end = MSM_GPIO_TO_INT(49),
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device smc91x_device = {
|
||||
.name = "smc91x",
|
||||
.id = 0,
|
||||
.num_resources = ARRAY_SIZE(smc91x_resources),
|
||||
.resource = smc91x_resources,
|
||||
};
|
||||
|
||||
static struct i2c_board_info i2c_devices[] = {
|
||||
#ifdef CONFIG_MT9D112
|
||||
{
|
||||
I2C_BOARD_INFO("mt9d112", 0x78 >> 1),
|
||||
},
|
||||
#endif
|
||||
#ifdef CONFIG_S5K3E2FX
|
||||
{
|
||||
I2C_BOARD_INFO("s5k3e2fx", 0x20 >> 1),
|
||||
},
|
||||
#endif
|
||||
#ifdef CONFIG_MT9P012
|
||||
{
|
||||
I2C_BOARD_INFO("mt9p012", 0x6C >> 1),
|
||||
},
|
||||
#endif
|
||||
#if defined(CONFIG_MT9T013) || defined(CONFIG_SENSORS_MT9T013)
|
||||
{
|
||||
I2C_BOARD_INFO("mt9t013", 0x6C), // 0x78>>1
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef CONFIG_MSM_CAMERA
|
||||
static uint32_t camera_off_gpio_table[] = {
|
||||
/* parallel CAMERA interfaces */
|
||||
PCOM_GPIO_CFG(0, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT0 */
|
||||
PCOM_GPIO_CFG(1, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT1 */
|
||||
PCOM_GPIO_CFG(2, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT2 */
|
||||
PCOM_GPIO_CFG(3, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT3 */
|
||||
PCOM_GPIO_CFG(4, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT4 */
|
||||
PCOM_GPIO_CFG(5, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT5 */
|
||||
PCOM_GPIO_CFG(6, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT6 */
|
||||
PCOM_GPIO_CFG(7, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT7 */
|
||||
PCOM_GPIO_CFG(8, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT8 */
|
||||
PCOM_GPIO_CFG(9, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT9 */
|
||||
PCOM_GPIO_CFG(10, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT10 */
|
||||
PCOM_GPIO_CFG(11, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT11 */
|
||||
PCOM_GPIO_CFG(12, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* PCLK */
|
||||
PCOM_GPIO_CFG(13, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* HSYNC_IN */
|
||||
PCOM_GPIO_CFG(14, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* VSYNC_IN */
|
||||
PCOM_GPIO_CFG(15, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA), /* MCLK */
|
||||
};
|
||||
|
||||
static uint32_t camera_on_gpio_table[] = {
|
||||
/* parallel CAMERA interfaces */
|
||||
PCOM_GPIO_CFG(0, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT0 */
|
||||
PCOM_GPIO_CFG(1, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT1 */
|
||||
PCOM_GPIO_CFG(2, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT2 */
|
||||
PCOM_GPIO_CFG(3, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT3 */
|
||||
PCOM_GPIO_CFG(4, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT4 */
|
||||
PCOM_GPIO_CFG(5, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT5 */
|
||||
PCOM_GPIO_CFG(6, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT6 */
|
||||
PCOM_GPIO_CFG(7, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT7 */
|
||||
PCOM_GPIO_CFG(8, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT8 */
|
||||
PCOM_GPIO_CFG(9, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT9 */
|
||||
PCOM_GPIO_CFG(10, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT10 */
|
||||
PCOM_GPIO_CFG(11, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT11 */
|
||||
PCOM_GPIO_CFG(12, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_16MA), /* PCLK */
|
||||
PCOM_GPIO_CFG(13, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* HSYNC_IN */
|
||||
PCOM_GPIO_CFG(14, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* VSYNC_IN */
|
||||
PCOM_GPIO_CFG(15, 1, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_16MA), /* MCLK */
|
||||
};
|
||||
|
||||
static void config_gpio_table(uint32_t *table, int len)
|
||||
{
|
||||
int n;
|
||||
unsigned id;
|
||||
for (n = 0; n < len; n++) {
|
||||
id = table[n];
|
||||
msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &id, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void config_camera_on_gpios(void)
|
||||
{
|
||||
config_gpio_table(camera_on_gpio_table,
|
||||
ARRAY_SIZE(camera_on_gpio_table));
|
||||
}
|
||||
|
||||
static void config_camera_off_gpios(void)
|
||||
{
|
||||
config_gpio_table(camera_off_gpio_table,
|
||||
ARRAY_SIZE(camera_off_gpio_table));
|
||||
}
|
||||
|
||||
static struct msm_camera_device_platform_data msm_camera_device_data = {
|
||||
.camera_gpio_on = config_camera_on_gpios,
|
||||
.camera_gpio_off = config_camera_off_gpios,
|
||||
.ioext.mdcphy = MSM_MDC_PHYS,
|
||||
.ioext.mdcsz = MSM_MDC_SIZE,
|
||||
.ioext.appphy = MSM_CLK_CTL_PHYS,
|
||||
.ioext.appsz = MSM_CLK_CTL_SIZE,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_MT9D112
|
||||
static struct msm_camera_sensor_info msm_camera_sensor_mt9d112_data = {
|
||||
.sensor_name = "mt9d112",
|
||||
.sensor_reset = 89,
|
||||
.sensor_pwd = 85,
|
||||
.vcm_pwd = 0,
|
||||
.pdata = &msm_camera_device_data,
|
||||
};
|
||||
|
||||
static struct platform_device msm_camera_sensor_mt9d112 = {
|
||||
.name = "msm_camera_mt9d112",
|
||||
.dev = {
|
||||
.platform_data = &msm_camera_sensor_mt9d112_data,
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_S5K3E2FX
|
||||
static struct msm_camera_sensor_info msm_camera_sensor_s5k3e2fx_data = {
|
||||
.sensor_name = "s5k3e2fx",
|
||||
.sensor_reset = 89,
|
||||
.sensor_pwd = 85,
|
||||
.vcm_pwd = 0,
|
||||
.pdata = &msm_camera_device_data,
|
||||
};
|
||||
|
||||
static struct platform_device msm_camera_sensor_s5k3e2fx = {
|
||||
.name = "msm_camera_s5k3e2fx",
|
||||
.dev = {
|
||||
.platform_data = &msm_camera_sensor_s5k3e2fx_data,
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MT9P012
|
||||
static struct msm_camera_sensor_info msm_camera_sensor_mt9p012_data = {
|
||||
.sensor_name = "mt9p012",
|
||||
.sensor_reset = 89,
|
||||
.sensor_pwd = 85,
|
||||
.vcm_pwd = 88,
|
||||
.pdata = &msm_camera_device_data,
|
||||
};
|
||||
|
||||
static struct platform_device msm_camera_sensor_mt9p012 = {
|
||||
.name = "msm_camera_mt9p012",
|
||||
.dev = {
|
||||
.platform_data = &msm_camera_sensor_mt9p012_data,
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MT9T013
|
||||
static struct msm_camera_sensor_info msm_camera_sensor_mt9t013_data = {
|
||||
.sensor_name = "mt9t013",
|
||||
.sensor_reset = 89,
|
||||
.sensor_pwd = 85,
|
||||
.vcm_pwd = 0,
|
||||
.pdata = &msm_camera_device_data,
|
||||
};
|
||||
|
||||
static struct platform_device msm_camera_sensor_mt9t013 = {
|
||||
.name = "msm_camera_mt9t013",
|
||||
.dev = {
|
||||
.platform_data = &msm_camera_sensor_mt9t013_data,
|
||||
},
|
||||
};
|
||||
#endif
|
||||
#endif /*CONFIG_MSM_CAMERA*/
|
||||
|
||||
#define SND(desc, num) { .name = #desc, .id = num }
|
||||
static struct snd_endpoint snd_endpoints_list[] = {
|
||||
SND(HANDSET, 0),
|
||||
SND(HEADSET, 2),
|
||||
SND(SPEAKER, 6),
|
||||
SND(BT, 12),
|
||||
SND(CURRENT, 25),
|
||||
};
|
||||
#undef SND
|
||||
|
||||
static struct msm_snd_endpoints halibut_snd_endpoints = {
|
||||
.endpoints = snd_endpoints_list,
|
||||
.num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint)
|
||||
};
|
||||
|
||||
static struct platform_device halibut_snd = {
|
||||
.name = "msm_snd",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &halibut_snd_endpoints
|
||||
},
|
||||
};
|
||||
|
||||
static struct android_pmem_platform_data android_pmem_pdata = {
|
||||
.name = "pmem",
|
||||
.start = MSM_PMEM_MDP_BASE,
|
||||
.size = MSM_PMEM_MDP_SIZE,
|
||||
.no_allocator = 0,
|
||||
.cached = 1,
|
||||
};
|
||||
|
||||
static struct android_pmem_platform_data android_pmem_camera_pdata = {
|
||||
.name = "pmem_camera",
|
||||
.start = MSM_PMEM_CAMERA_BASE,
|
||||
.size = MSM_PMEM_CAMERA_SIZE,
|
||||
.no_allocator = 1,
|
||||
.cached = 1,
|
||||
};
|
||||
|
||||
static struct android_pmem_platform_data android_pmem_adsp_pdata = {
|
||||
.name = "pmem_adsp",
|
||||
.start = MSM_PMEM_ADSP_BASE,
|
||||
.size = MSM_PMEM_ADSP_SIZE,
|
||||
.no_allocator = 0,
|
||||
.cached = 0,
|
||||
};
|
||||
|
||||
static struct android_pmem_platform_data android_pmem_gpu0_pdata = {
|
||||
.name = "pmem_gpu0",
|
||||
.start = MSM_PMEM_GPU0_BASE,
|
||||
.size = MSM_PMEM_GPU0_SIZE,
|
||||
.no_allocator = 1,
|
||||
.cached = 0,
|
||||
};
|
||||
|
||||
static struct android_pmem_platform_data android_pmem_gpu1_pdata = {
|
||||
.name = "pmem_gpu1",
|
||||
.start = MSM_PMEM_GPU1_BASE,
|
||||
.size = MSM_PMEM_GPU1_SIZE,
|
||||
.no_allocator = 1,
|
||||
.cached = 0,
|
||||
};
|
||||
|
||||
static struct platform_device android_pmem_device = {
|
||||
.name = "android_pmem",
|
||||
.id = 0,
|
||||
.dev = { .platform_data = &android_pmem_pdata },
|
||||
};
|
||||
|
||||
static struct platform_device android_pmem_adsp_device = {
|
||||
.name = "android_pmem",
|
||||
.id = 1,
|
||||
.dev = { .platform_data = &android_pmem_adsp_pdata },
|
||||
};
|
||||
|
||||
static struct platform_device android_pmem_gpu0_device = {
|
||||
.name = "android_pmem",
|
||||
.id = 2,
|
||||
.dev = { .platform_data = &android_pmem_gpu0_pdata },
|
||||
};
|
||||
|
||||
static struct platform_device android_pmem_gpu1_device = {
|
||||
.name = "android_pmem",
|
||||
.id = 3,
|
||||
.dev = { .platform_data = &android_pmem_gpu1_pdata },
|
||||
};
|
||||
|
||||
static struct platform_device android_pmem_camera_device = {
|
||||
.name = "android_pmem",
|
||||
.id = 4,
|
||||
.dev = { .platform_data = &android_pmem_camera_pdata },
|
||||
};
|
||||
|
||||
static int halibut_phy_init_seq[] = { 0x1D, 0x0D, 0x1D, 0x10, -1 };
|
||||
|
||||
static struct msm_hsusb_platform_data msm_hsusb_pdata = {
|
||||
.phy_init_seq = halibut_phy_init_seq,
|
||||
};
|
||||
|
||||
static struct usb_mass_storage_platform_data mass_storage_pdata = {
|
||||
.nluns = 1,
|
||||
.vendor = "Qualcomm",
|
||||
.product = "Halibut",
|
||||
.release = 0x0100,
|
||||
};
|
||||
|
||||
static struct platform_device usb_mass_storage_device = {
|
||||
.name = "usb_mass_storage",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &mass_storage_pdata,
|
||||
},
|
||||
};
|
||||
|
||||
static char *usb_functions[] = { "usb_mass_storage" };
|
||||
static char *usb_functions_adb[] = { "usb_mass_storage", "adb" };
|
||||
|
||||
static struct android_usb_product usb_products[] = {
|
||||
{
|
||||
.product_id = 0x0c01,
|
||||
.num_functions = ARRAY_SIZE(usb_functions),
|
||||
.functions = usb_functions,
|
||||
},
|
||||
{
|
||||
.product_id = 0x0c02,
|
||||
.num_functions = ARRAY_SIZE(usb_functions_adb),
|
||||
.functions = usb_functions_adb,
|
||||
},
|
||||
};
|
||||
|
||||
static struct android_usb_platform_data android_usb_pdata = {
|
||||
.vendor_id = 0x18d1,
|
||||
.product_id = 0x0c01,
|
||||
.version = 0x0100,
|
||||
.serial_number = "42",
|
||||
.product_name = "Halibutdroid",
|
||||
.manufacturer_name = "Qualcomm",
|
||||
.num_products = ARRAY_SIZE(usb_products),
|
||||
.products = usb_products,
|
||||
.num_functions = ARRAY_SIZE(usb_functions_adb),
|
||||
.functions = usb_functions_adb,
|
||||
};
|
||||
|
||||
static struct platform_device android_usb_device = {
|
||||
.name = "android_usb",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &android_usb_pdata,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device fish_battery_device = {
|
||||
.name = "fish_battery",
|
||||
};
|
||||
|
||||
static struct platform_device *devices[] __initdata = {
|
||||
#if !defined(CONFIG_MSM_SERIAL_DEBUGGER)
|
||||
&msm_device_uart3,
|
||||
#endif
|
||||
&msm_device_smd,
|
||||
&msm_device_nand,
|
||||
&msm_device_hsusb,
|
||||
&usb_mass_storage_device,
|
||||
&android_usb_device,
|
||||
&msm_device_i2c,
|
||||
&smc91x_device,
|
||||
&halibut_snd,
|
||||
#ifdef CONFIG_MT9T013
|
||||
&msm_camera_sensor_mt9t013,
|
||||
#endif
|
||||
#ifdef CONFIG_MT9D112
|
||||
&msm_camera_sensor_mt9d112,
|
||||
#endif
|
||||
#ifdef CONFIG_S5K3E2FX
|
||||
&msm_camera_sensor_s5k3e2fx,
|
||||
#endif
|
||||
#ifdef CONFIG_MT9P012
|
||||
&msm_camera_sensor_mt9p012,
|
||||
#endif
|
||||
&android_pmem_device,
|
||||
&android_pmem_adsp_device,
|
||||
&android_pmem_gpu0_device,
|
||||
&android_pmem_gpu1_device,
|
||||
&android_pmem_camera_device,
|
||||
&fish_battery_device,
|
||||
};
|
||||
|
||||
extern struct sys_timer msm_timer;
|
||||
|
||||
static void __init halibut_init_irq(void)
|
||||
{
|
||||
msm_init_irq();
|
||||
}
|
||||
|
||||
static struct msm_acpu_clock_platform_data halibut_clock_data = {
|
||||
.acpu_switch_time_us = 50,
|
||||
.max_speed_delta_khz = 256000,
|
||||
.vdd_switch_time_us = 62,
|
||||
.power_collapse_khz = 19200000,
|
||||
.wait_for_irq_khz = 128000000,
|
||||
};
|
||||
|
||||
extern void msm_serial_debug_init(unsigned int base, int irq,
|
||||
struct device *clk_device, int signal_irq);
|
||||
|
||||
static void __init halibut_init(void)
|
||||
{
|
||||
#if defined(CONFIG_MSM_SERIAL_DEBUGGER)
|
||||
msm_serial_debug_init(MSM_UART3_PHYS, INT_UART3,
|
||||
&msm_device_uart3.dev, 1);
|
||||
#endif
|
||||
msm_device_hsusb.dev.platform_data = &msm_hsusb_pdata;
|
||||
msm_acpu_clock_init(&halibut_clock_data);
|
||||
#ifdef CONFIG_MSM_CAMERA
|
||||
config_camera_off_gpios(); /* might not be necessary */
|
||||
#endif
|
||||
i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
|
||||
platform_add_devices(devices, ARRAY_SIZE(devices));
|
||||
i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
|
||||
msm_hsusb_set_vbus_state(1);
|
||||
}
|
||||
|
||||
static void __init halibut_fixup(struct machine_desc *desc, struct tag *tags,
|
||||
char **cmdline, struct meminfo *mi)
|
||||
{
|
||||
mi->nr_banks = 1;
|
||||
mi->bank[0].start = PHYS_OFFSET;
|
||||
mi->bank[0].node = PHYS_TO_NID(PHYS_OFFSET);
|
||||
mi->bank[0].size = (101*1024*1024);
|
||||
}
|
||||
|
||||
static void __init halibut_map_io(void)
|
||||
{
|
||||
msm_map_common_io();
|
||||
msm_clock_init();
|
||||
}
|
||||
|
||||
MACHINE_START(HALIBUT, "Halibut Board (QCT SURF7200A)")
|
||||
#ifdef CONFIG_MSM_DEBUG_UART
|
||||
.phys_io = MSM_DEBUG_UART_PHYS,
|
||||
.io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
|
||||
#endif
|
||||
.boot_params = 0x10000100,
|
||||
.fixup = halibut_fixup,
|
||||
.map_io = halibut_map_io,
|
||||
.init_irq = halibut_init_irq,
|
||||
.init_machine = halibut_init,
|
||||
.timer = &msm_timer,
|
||||
MACHINE_END
|
@ -1,20 +0,0 @@
|
||||
/* linux/arch/arm/mach-msm/board-trout.h
|
||||
* ** Author: Brian Swetland <swetland@google.com>
|
||||
* */
|
||||
#ifndef __ARCH_ARM_MACH_MSM_BOARD_HALIBUT_H
|
||||
#define __ARCH_ARM_MACH_MSM_BOARD_HALIBUT_H
|
||||
|
||||
#define MSM_PMEM_GPU0_BASE (0x10000000 + 64*SZ_1M)
|
||||
#define MSM_PMEM_GPU0_SIZE 0x800000
|
||||
#define MSM_PMEM_MDP_BASE (MSM_PMEM_GPU0_BASE + MSM_PMEM_GPU0_SIZE)
|
||||
#define MSM_PMEM_MDP_SIZE 0x800000
|
||||
#define MSM_PMEM_ADSP_BASE (MSM_PMEM_MDP_BASE + MSM_PMEM_MDP_SIZE)
|
||||
#define MSM_PMEM_ADSP_SIZE 0x800000
|
||||
#define MSM_PMEM_GPU1_BASE (MSM_PMEM_ADSP_BASE + MSM_PMEM_ADSP_SIZE)
|
||||
#define MSM_PMEM_GPU1_SIZE 0x800000
|
||||
#define MSM_FB_BASE (MSM_PMEM_GPU1_BASE + MSM_PMEM_GPU1_SIZE)
|
||||
#define MSM_FB_SIZE 0x200000
|
||||
#define MSM_PMEM_CAMERA_BASE (MSM_FB_BASE + MSM_FB_SIZE)
|
||||
#define MSM_PMEM_CAMERA_SIZE 0xA00000
|
||||
|
||||
#endif
|
@ -1,320 +0,0 @@
|
||||
/* arch/arm/mach-msm/board-supersonic-audio.c
|
||||
*
|
||||
* Copyright (C) 2009 HTC Corporation
|
||||
* Copyright (C) 2009 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/delay.h>
|
||||
#include <mach/msm_qdsp6_audio.h>
|
||||
#include <mach/htc_acoustic_qsd.h>
|
||||
#include <mach/tpa6130.h>
|
||||
#include <mach/tpa2018d1.h>
|
||||
#include <mach/vreg.h>
|
||||
|
||||
#include "board-supersonic.h"
|
||||
#include "proc_comm.h"
|
||||
#include "pmic.h"
|
||||
|
||||
#if 1
|
||||
#define D(fmt, args...) printk(KERN_INFO "Audio: "fmt, ##args)
|
||||
#else
|
||||
#define D(fmt, args...) do {} while (0)
|
||||
#endif
|
||||
|
||||
static struct mutex mic_lock;
|
||||
static struct mutex bt_sco_lock;
|
||||
static struct mutex hdmi_i2s_lock;
|
||||
static int headset_status = 0;
|
||||
|
||||
static struct q6_hw_info q6_audio_hw[Q6_HW_COUNT] = {
|
||||
[Q6_HW_HANDSET] = {
|
||||
.min_gain = -2000,
|
||||
.max_gain = 0,
|
||||
},
|
||||
[Q6_HW_HEADSET] = {
|
||||
.min_gain = -2000,
|
||||
.max_gain = 0,
|
||||
},
|
||||
[Q6_HW_SPEAKER] = {
|
||||
.min_gain = -1500,
|
||||
.max_gain = 0,
|
||||
},
|
||||
[Q6_HW_TTY] = {
|
||||
.min_gain = -2000,
|
||||
.max_gain = 0,
|
||||
},
|
||||
[Q6_HW_BT_SCO] = {
|
||||
.min_gain = -2000,
|
||||
.max_gain = 0,
|
||||
},
|
||||
[Q6_HW_BT_A2DP] = {
|
||||
.min_gain = -2000,
|
||||
.max_gain = 0,
|
||||
},
|
||||
};
|
||||
|
||||
void supersonic_headset_enable(int en)
|
||||
{
|
||||
D("%s %d\n", __func__, en);
|
||||
/* enable audio amp */
|
||||
if (en != headset_status) {
|
||||
headset_status = en;
|
||||
if(en) {
|
||||
gpio_set_value(SUPERSONIC_AUD_JACKHP_EN, 1);
|
||||
mdelay(10);
|
||||
if (system_rev == 0)
|
||||
set_headset_amp(1);
|
||||
} else {
|
||||
if (system_rev == 0)
|
||||
set_headset_amp(0);
|
||||
gpio_set_value(SUPERSONIC_AUD_JACKHP_EN, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void supersonic_speaker_enable(int en)
|
||||
{
|
||||
struct spkr_config_mode scm;
|
||||
memset(&scm, 0, sizeof(scm));
|
||||
|
||||
D("%s %d\n", __func__, en);
|
||||
if (en) {
|
||||
scm.is_right_chan_en = 0;
|
||||
scm.is_left_chan_en = 1;
|
||||
scm.is_stereo_en = 0;
|
||||
scm.is_hpf_en = 1;
|
||||
pmic_spkr_en_mute(LEFT_SPKR, 0);
|
||||
pmic_set_spkr_configuration(&scm);
|
||||
pmic_spkr_en(LEFT_SPKR, 1);
|
||||
|
||||
/* unmute */
|
||||
pmic_spkr_en_mute(LEFT_SPKR, 1);
|
||||
} else {
|
||||
pmic_spkr_en_mute(LEFT_SPKR, 0);
|
||||
|
||||
pmic_spkr_en(LEFT_SPKR, 0);
|
||||
|
||||
pmic_set_spkr_configuration(&scm);
|
||||
}
|
||||
set_speaker_amp(en);
|
||||
|
||||
}
|
||||
|
||||
void supersonic_receiver_enable(int en)
|
||||
{
|
||||
/* After XB*/
|
||||
if (system_rev >= 1) {
|
||||
struct spkr_config_mode scm;
|
||||
memset(&scm, 0, sizeof(scm));
|
||||
|
||||
D("%s %d\n", __func__, en);
|
||||
if (en) {
|
||||
scm.is_right_chan_en = 1;
|
||||
scm.is_left_chan_en = 0;
|
||||
scm.is_stereo_en = 0;
|
||||
scm.is_hpf_en = 1;
|
||||
pmic_spkr_en_mute(RIGHT_SPKR, 0);
|
||||
pmic_set_spkr_configuration(&scm);
|
||||
pmic_spkr_en(RIGHT_SPKR, 1);
|
||||
|
||||
/* unmute */
|
||||
pmic_spkr_en_mute(RIGHT_SPKR, 1);
|
||||
} else {
|
||||
pmic_spkr_en_mute(RIGHT_SPKR, 0);
|
||||
|
||||
pmic_spkr_en(RIGHT_SPKR, 0);
|
||||
|
||||
pmic_set_spkr_configuration(&scm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t hdmi_i2s_enable[] = {
|
||||
PCOM_GPIO_CFG(SUPERSONIC_I2S_CLK, 2, GPIO_OUTPUT,
|
||||
GPIO_PULL_DOWN, GPIO_2MA),
|
||||
PCOM_GPIO_CFG(SUPERSONIC_I2S_WS, 1, GPIO_OUTPUT,
|
||||
GPIO_PULL_DOWN, GPIO_2MA),
|
||||
PCOM_GPIO_CFG(SUPERSONIC_I2S_DOUT, 1, GPIO_OUTPUT,
|
||||
GPIO_PULL_DOWN, GPIO_2MA),
|
||||
};
|
||||
|
||||
static uint32_t hdmi_i2s_disable[] = {
|
||||
PCOM_GPIO_CFG(SUPERSONIC_I2S_CLK, 0, GPIO_OUTPUT,
|
||||
GPIO_PULL_DOWN, GPIO_2MA),
|
||||
PCOM_GPIO_CFG(SUPERSONIC_I2S_WS, 0, GPIO_OUTPUT,
|
||||
GPIO_PULL_DOWN, GPIO_2MA),
|
||||
PCOM_GPIO_CFG(SUPERSONIC_I2S_DOUT, 0, GPIO_OUTPUT,
|
||||
GPIO_PULL_DOWN, GPIO_2MA),
|
||||
};
|
||||
|
||||
void supersonic_hdmi_i2s_enable(int en)
|
||||
{
|
||||
static int hdmi_i2s_refcount;
|
||||
D("%s %d\n", __func__, en);
|
||||
mutex_lock(&hdmi_i2s_lock);
|
||||
if (en) {
|
||||
if (++hdmi_i2s_refcount == 1)
|
||||
config_gpio_table(hdmi_i2s_enable,
|
||||
ARRAY_SIZE(hdmi_i2s_enable));
|
||||
} else {
|
||||
if (--hdmi_i2s_refcount == 0) {
|
||||
config_gpio_table(hdmi_i2s_disable, ARRAY_SIZE(hdmi_i2s_disable));
|
||||
}
|
||||
}
|
||||
mutex_unlock(&hdmi_i2s_lock);
|
||||
}
|
||||
|
||||
|
||||
static uint32_t bt_sco_enable[] = {
|
||||
PCOM_GPIO_CFG(SUPERSONIC_BT_PCM_OUT, 1, GPIO_INPUT,
|
||||
GPIO_PULL_DOWN, GPIO_2MA),
|
||||
PCOM_GPIO_CFG(SUPERSONIC_BT_PCM_IN, 1, GPIO_INPUT,
|
||||
GPIO_PULL_DOWN, GPIO_2MA),
|
||||
PCOM_GPIO_CFG(SUPERSONIC_BT_PCM_SYNC, 2, GPIO_INPUT,
|
||||
GPIO_PULL_DOWN, GPIO_2MA),
|
||||
PCOM_GPIO_CFG(SUPERSONIC_BT_PCM_CLK, 2, GPIO_INPUT,
|
||||
GPIO_PULL_DOWN, GPIO_2MA),
|
||||
};
|
||||
|
||||
static uint32_t bt_sco_disable[] = {
|
||||
PCOM_GPIO_CFG(SUPERSONIC_BT_PCM_OUT, 0, GPIO_OUTPUT,
|
||||
GPIO_NO_PULL, GPIO_2MA),
|
||||
PCOM_GPIO_CFG(SUPERSONIC_BT_PCM_IN, 0, GPIO_INPUT,
|
||||
GPIO_PULL_UP, GPIO_2MA),
|
||||
PCOM_GPIO_CFG(SUPERSONIC_BT_PCM_SYNC, 0, GPIO_OUTPUT,
|
||||
GPIO_NO_PULL, GPIO_2MA),
|
||||
PCOM_GPIO_CFG(SUPERSONIC_BT_PCM_CLK, 0, GPIO_OUTPUT,
|
||||
GPIO_NO_PULL, GPIO_2MA),
|
||||
};
|
||||
|
||||
void supersonic_bt_sco_enable(int en)
|
||||
{
|
||||
static int bt_sco_refcount;
|
||||
D("%s %d\n", __func__, en);
|
||||
mutex_lock(&bt_sco_lock);
|
||||
if (en) {
|
||||
if (++bt_sco_refcount == 1)
|
||||
config_gpio_table(bt_sco_enable,
|
||||
ARRAY_SIZE(bt_sco_enable));
|
||||
} else {
|
||||
if (--bt_sco_refcount == 0) {
|
||||
config_gpio_table(bt_sco_disable, ARRAY_SIZE(bt_sco_disable));
|
||||
gpio_set_value(SUPERSONIC_BT_PCM_OUT, 0);
|
||||
gpio_set_value(SUPERSONIC_BT_PCM_SYNC,0);
|
||||
gpio_set_value(SUPERSONIC_BT_PCM_CLK,0);
|
||||
}
|
||||
}
|
||||
mutex_unlock(&bt_sco_lock);
|
||||
}
|
||||
|
||||
void supersonic_int_mic_enable(int en)
|
||||
{
|
||||
D("%s %d\n", __func__, en);
|
||||
if (en)
|
||||
pmic_mic_en(ON_CMD);
|
||||
else
|
||||
pmic_mic_en(OFF_CMD);
|
||||
}
|
||||
|
||||
void supersonic_ext_mic_enable(int en)
|
||||
{
|
||||
static int old_state = 0, new_state = 0;
|
||||
|
||||
D("%s %d\n", __func__, en);
|
||||
|
||||
mutex_lock(&mic_lock);
|
||||
if (!!en)
|
||||
new_state++;
|
||||
else
|
||||
new_state--;
|
||||
|
||||
if (new_state == 1 && old_state == 0) {
|
||||
gpio_set_value(SUPERSONIC_AUD_2V5_EN, 1);
|
||||
} else if (new_state == 0 && old_state == 1)
|
||||
gpio_set_value(SUPERSONIC_AUD_2V5_EN, 0);
|
||||
else
|
||||
D("%s: do nothing %d %d\n", __func__, old_state, new_state);
|
||||
|
||||
old_state = new_state;
|
||||
mutex_unlock(&mic_lock);
|
||||
}
|
||||
|
||||
void supersonic_analog_init(void)
|
||||
{
|
||||
D("%s\n", __func__);
|
||||
/* stereo pmic init */
|
||||
pmic_spkr_set_gain(LEFT_SPKR, SPKR_GAIN_PLUS12DB);
|
||||
pmic_spkr_set_gain(RIGHT_SPKR, SPKR_GAIN_00DB);
|
||||
pmic_spkr_en_right_chan(OFF_CMD);
|
||||
pmic_spkr_en_left_chan(OFF_CMD);
|
||||
pmic_spkr_add_right_left_chan(OFF_CMD);
|
||||
pmic_spkr_en_stereo(OFF_CMD);
|
||||
pmic_spkr_select_usb_with_hpf_20hz(OFF_CMD);
|
||||
pmic_spkr_bypass_mux(OFF_CMD);
|
||||
pmic_spkr_en_hpf(ON_CMD);
|
||||
pmic_spkr_en_sink_curr_from_ref_volt_cir(OFF_CMD);
|
||||
pmic_spkr_set_mux_hpf_corner_freq(SPKR_FREQ_0_73KHZ);
|
||||
pmic_mic_set_volt(MIC_VOLT_1_80V);
|
||||
pmic_set_speaker_delay(SPKR_DLY_100MS);
|
||||
|
||||
gpio_direction_output(SUPERSONIC_AUD_JACKHP_EN, 0);
|
||||
gpio_set_value(SUPERSONIC_AUD_JACKHP_EN, 0);
|
||||
|
||||
mutex_lock(&bt_sco_lock);
|
||||
config_gpio_table(bt_sco_disable, ARRAY_SIZE(bt_sco_disable));
|
||||
gpio_set_value(SUPERSONIC_BT_PCM_OUT, 0);
|
||||
gpio_set_value(SUPERSONIC_BT_PCM_SYNC,0);
|
||||
gpio_set_value(SUPERSONIC_BT_PCM_CLK,0);
|
||||
mutex_unlock(&bt_sco_lock);
|
||||
}
|
||||
|
||||
int supersonic_get_rx_vol(uint8_t hw, int level)
|
||||
{
|
||||
struct q6_hw_info *info;
|
||||
int vol;
|
||||
|
||||
info = &q6_audio_hw[hw];
|
||||
vol = info->min_gain + ((info->max_gain - info->min_gain) * level) / 100;
|
||||
D("%s %d\n", __func__, vol);
|
||||
return vol;
|
||||
}
|
||||
|
||||
static struct qsd_acoustic_ops acoustic = {
|
||||
.enable_mic_bias = supersonic_ext_mic_enable,
|
||||
};
|
||||
|
||||
static struct q6audio_analog_ops ops = {
|
||||
.init = supersonic_analog_init,
|
||||
.speaker_enable = supersonic_speaker_enable,
|
||||
.headset_enable = supersonic_headset_enable,
|
||||
.receiver_enable = supersonic_receiver_enable,
|
||||
.bt_sco_enable = supersonic_bt_sco_enable,
|
||||
.int_mic_enable = supersonic_int_mic_enable,
|
||||
.ext_mic_enable = supersonic_ext_mic_enable,
|
||||
.i2s_enable = supersonic_hdmi_i2s_enable,
|
||||
.get_rx_vol = supersonic_get_rx_vol,
|
||||
};
|
||||
|
||||
void __init supersonic_audio_init(void)
|
||||
{
|
||||
mutex_init(&mic_lock);
|
||||
mutex_init(&bt_sco_lock);
|
||||
mutex_init(&hdmi_i2s_lock);
|
||||
#if defined(CONFIG_QSD_AUDIO)
|
||||
q6audio_register_analog_ops(&ops);
|
||||
#endif
|
||||
acoustic_register_ops(&acoustic);
|
||||
}
|
||||
|
@ -1,96 +0,0 @@
|
||||
/* arch/arm/mach-msm/board-supersonic-keypad.c
|
||||
*
|
||||
* Copyright (C) 2009 Google, Inc
|
||||
* Copyright (C) 2009 HTC Corporation.
|
||||
*
|
||||
* Author: Dima Zavin <dima@android.com>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <linux/gpio_event.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <mach/vreg.h>
|
||||
#include <linux/keyreset.h>
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include "board-supersonic.h"
|
||||
|
||||
|
||||
static struct gpio_event_direct_entry supersonic_keypad_nav_map[] = {
|
||||
{ SUPERSONIC_POWER_KEY, KEY_POWER },
|
||||
{ SUPERSONIC_VOLUME_UP, KEY_VOLUMEUP },
|
||||
{ SUPERSONIC_VOLUME_DOWN, KEY_VOLUMEDOWN },
|
||||
};
|
||||
|
||||
static struct gpio_event_input_info supersonic_keypad_nav_info = {
|
||||
.info.func = gpio_event_input_func,
|
||||
.flags = GPIOEDF_PRINT_KEYS,
|
||||
.type = EV_KEY,
|
||||
.keymap = supersonic_keypad_nav_map,
|
||||
.debounce_time.tv.nsec = 20 * NSEC_PER_MSEC,
|
||||
.keymap_size = ARRAY_SIZE(supersonic_keypad_nav_map)
|
||||
};
|
||||
|
||||
static struct gpio_event_info *supersonic_keypad_info[] = {
|
||||
&supersonic_keypad_nav_info.info,
|
||||
};
|
||||
|
||||
static struct gpio_event_platform_data supersonic_keypad_data = {
|
||||
.name = "supersonic-keypad",
|
||||
.info = supersonic_keypad_info,
|
||||
.info_count = ARRAY_SIZE(supersonic_keypad_info)
|
||||
};
|
||||
|
||||
static struct platform_device supersonic_keypad_device = {
|
||||
.name = GPIO_EVENT_DEV_NAME,
|
||||
.id = 0,
|
||||
.dev = {
|
||||
.platform_data = &supersonic_keypad_data,
|
||||
},
|
||||
};
|
||||
|
||||
static struct keyreset_platform_data supersonic_reset_keys_pdata = {
|
||||
.keys_down = {
|
||||
KEY_POWER,
|
||||
KEY_VOLUMEUP,
|
||||
KEY_VOLUMEDOWN,
|
||||
0
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device supersonic_reset_keys_device = {
|
||||
.name = KEYRESET_NAME,
|
||||
.dev.platform_data = &supersonic_reset_keys_pdata,
|
||||
};
|
||||
|
||||
static int __init supersonic_init_keypad(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!machine_is_supersonic())
|
||||
return 0;
|
||||
|
||||
if (platform_device_register(&supersonic_reset_keys_device))
|
||||
printk(KERN_WARNING "%s: register reset key fail\n", __func__);
|
||||
|
||||
ret = platform_device_register(&supersonic_keypad_device);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
device_initcall(supersonic_init_keypad);
|
||||
|
||||
|
@ -1,437 +0,0 @@
|
||||
/* arch/arm/mach-msm/board-supersonic-microp.c
|
||||
* Copyright (C) 2009 HTC Corporation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
#ifdef CONFIG_MICROP_COMMON
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <asm/mach-types.h>
|
||||
#include <mach/atmega_microp.h>
|
||||
#include <linux/capella_cm3602.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <mach/vreg.h>
|
||||
#include <linux/wakelock.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
#include "board-supersonic.h"
|
||||
|
||||
#define INT_PSENSOR (1<<4)
|
||||
|
||||
static int misc_opened;
|
||||
static unsigned int als_power_control;
|
||||
static struct mutex als_power_lock;
|
||||
|
||||
static void p_sensor_do_work(struct work_struct *w);
|
||||
static DECLARE_WORK(p_sensor_work, p_sensor_do_work);
|
||||
|
||||
struct wake_lock proximity_wake_lock;
|
||||
|
||||
static struct capella_cm3602_data {
|
||||
struct input_dev *input_dev;
|
||||
struct capella_cm3602_platform_data *pdata;
|
||||
int enabled;
|
||||
struct workqueue_struct *p_sensor_wq;
|
||||
} the_data;
|
||||
|
||||
static int psensor_intr_enable(uint8_t enable)
|
||||
{
|
||||
int ret;
|
||||
uint8_t addr, data[2];
|
||||
|
||||
if (enable)
|
||||
addr = MICROP_I2C_WCMD_GPI_INT_CTL_EN;
|
||||
else
|
||||
addr = MICROP_I2C_WCMD_GPI_INT_CTL_DIS;
|
||||
|
||||
data[0] = INT_PSENSOR >> 8;
|
||||
data[1] = INT_PSENSOR & 0xFF;
|
||||
ret = microp_i2c_write(addr, data, 2);
|
||||
if (ret < 0)
|
||||
pr_err("%s: %s p-sensor interrupt failed\n",
|
||||
__func__, (enable ? "enable" : "disable"));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int supersonic_microp_function_init(struct i2c_client *client)
|
||||
{
|
||||
struct microp_i2c_platform_data *pdata;
|
||||
struct microp_i2c_client_data *cdata;
|
||||
uint8_t data[20];
|
||||
int i, j;
|
||||
int ret;
|
||||
|
||||
pdata = client->dev.platform_data;
|
||||
cdata = i2c_get_clientdata(client);
|
||||
|
||||
/* Headset remote key */
|
||||
ret = microp_function_check(client, MICROP_FUNCTION_REMOTEKEY);
|
||||
if (ret >= 0) {
|
||||
i = ret;
|
||||
pdata->function_node[MICROP_FUNCTION_REMOTEKEY] = i;
|
||||
cdata->int_pin.int_remotekey =
|
||||
pdata->microp_function[i].int_pin;
|
||||
|
||||
for (j = 0; j < 6; j++) {
|
||||
data[j] = (uint8_t)(pdata->microp_function[i].levels[j] >> 8);
|
||||
data[j + 6] = (uint8_t)(pdata->microp_function[i].levels[j]);
|
||||
}
|
||||
ret = microp_i2c_write(MICROP_I2C_WCMD_REMOTEKEY_TABLE,
|
||||
data, 12);
|
||||
if (ret)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* Reset button interrupt */
|
||||
ret = microp_write_interrupt(client, (1<<8), 1);
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
/* HDMI interrupt */
|
||||
ret = microp_write_interrupt(client, (1 << 1), 1);
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
return 0;
|
||||
|
||||
exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int report_psensor_data(void)
|
||||
{
|
||||
int ret, ps_data = 0;
|
||||
uint8_t data[3] = {0, 0, 0};
|
||||
|
||||
ret = microp_i2c_read(MICROP_I2C_RCMD_GPIO_STATUS, data, 3);
|
||||
if (ret < 0)
|
||||
pr_err("%s: read data failed\n", __func__);
|
||||
else {
|
||||
ps_data = (data[2] & 0x10) ? 1 : 0;
|
||||
pr_info("proximity %s\n", ps_data ? "FAR" : "NEAR");
|
||||
|
||||
/* 0 is close, 1 is far */
|
||||
input_report_abs(the_data.input_dev, ABS_DISTANCE, ps_data);
|
||||
input_sync(the_data.input_dev);
|
||||
|
||||
wake_lock_timeout(&proximity_wake_lock, 2*HZ);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int capella_cm3602_enable(struct capella_cm3602_data *data)
|
||||
{
|
||||
int rc;
|
||||
pr_info("%s\n", __func__);
|
||||
if (data->enabled) {
|
||||
pr_info("%s: already enabled\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* dummy report */
|
||||
input_report_abs(data->input_dev, ABS_DISTANCE, -1);
|
||||
input_sync(data->input_dev);
|
||||
|
||||
rc = data->pdata->power(PS_PWR_ON, 1);
|
||||
if (rc < 0)
|
||||
return -EIO;
|
||||
|
||||
rc = gpio_direction_output(data->pdata->p_en, 0);
|
||||
if (rc < 0) {
|
||||
pr_err("%s: set psesnor enable failed!!",
|
||||
__func__);
|
||||
return -EIO;
|
||||
}
|
||||
msleep(220);
|
||||
rc = psensor_intr_enable(1);
|
||||
if (rc < 0)
|
||||
return -EIO;
|
||||
|
||||
data->enabled = 1;
|
||||
report_psensor_data();
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int capella_cm3602_disable(struct capella_cm3602_data *data)
|
||||
{
|
||||
int rc = -EIO;
|
||||
pr_info("%s\n", __func__);
|
||||
if (!data->enabled) {
|
||||
pr_info("%s: already disabled\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
rc = psensor_intr_enable(0);
|
||||
if (rc < 0)
|
||||
return -EIO;
|
||||
|
||||
rc = gpio_direction_output(data->pdata->p_en, 1);
|
||||
if (rc < 0) {
|
||||
pr_err("%s: set GPIO failed!!", __func__);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
rc = data->pdata->power(PS_PWR_ON, 0);
|
||||
if (rc < 0)
|
||||
return -EIO;
|
||||
|
||||
data->enabled = 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static ssize_t capella_cm3602_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = sprintf(buf, "proximity enabled = %d\n", the_data.enabled);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t capella_cm3602_store(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf,
|
||||
size_t count
|
||||
)
|
||||
{
|
||||
ssize_t val;
|
||||
|
||||
val = -1;
|
||||
sscanf(buf, "%u", &val);
|
||||
if (val < 0 || val > 1)
|
||||
return -EINVAL;
|
||||
|
||||
/* Enable capella_cm3602*/
|
||||
if (val == 1)
|
||||
capella_cm3602_enable(&the_data);
|
||||
|
||||
/* Disable capella_cm3602*/
|
||||
if (val == 0)
|
||||
capella_cm3602_disable(&the_data);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(proximity, 0644, capella_cm3602_show, capella_cm3602_store);
|
||||
|
||||
static int capella_cm3602_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
pr_info("%s\n", __func__);
|
||||
if (misc_opened)
|
||||
return -EBUSY;
|
||||
misc_opened = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int capella_cm3602_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
pr_info("%s\n", __func__);
|
||||
misc_opened = 0;
|
||||
return capella_cm3602_disable(&the_data);
|
||||
}
|
||||
|
||||
static long capella_cm3602_ioctl(struct file *file,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
int val;
|
||||
pr_info("%s cmd %d\n", __func__, _IOC_NR(cmd));
|
||||
switch (cmd) {
|
||||
case CAPELLA_CM3602_IOCTL_ENABLE:
|
||||
if (get_user(val, (unsigned long __user *)arg))
|
||||
return -EFAULT;
|
||||
if (val)
|
||||
return capella_cm3602_enable(&the_data);
|
||||
else
|
||||
return capella_cm3602_disable(&the_data);
|
||||
break;
|
||||
case CAPELLA_CM3602_IOCTL_GET_ENABLED:
|
||||
return put_user(the_data.enabled, (unsigned long __user *)arg);
|
||||
break;
|
||||
default:
|
||||
pr_err("%s: invalid cmd %d\n", __func__, _IOC_NR(cmd));
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
static void p_sensor_do_work(struct work_struct *w)
|
||||
{
|
||||
report_psensor_data();
|
||||
}
|
||||
|
||||
static irqreturn_t p_sensor_irq_handler(int irq, void *data)
|
||||
{
|
||||
struct capella_cm3602_data *ip = data;
|
||||
queue_work(ip->p_sensor_wq, &p_sensor_work);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static struct file_operations capella_cm3602_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = capella_cm3602_open,
|
||||
.release = capella_cm3602_release,
|
||||
.unlocked_ioctl = capella_cm3602_ioctl
|
||||
};
|
||||
|
||||
static struct miscdevice capella_cm3602_misc = {
|
||||
.minor = MISC_DYNAMIC_MINOR,
|
||||
.name = "cm3602",
|
||||
.fops = &capella_cm3602_fops
|
||||
};
|
||||
|
||||
static int capella_cm3602_probe(struct platform_device *pdev)
|
||||
{
|
||||
int rc = -1;
|
||||
struct input_dev *input_dev;
|
||||
struct capella_cm3602_data *ip;
|
||||
struct capella_cm3602_platform_data *pdata;
|
||||
|
||||
struct class *proximity_attr_class;
|
||||
struct device *proximity_attr_dev;
|
||||
|
||||
pr_info("%s: probe\n", __func__);
|
||||
|
||||
pdata = dev_get_platdata(&pdev->dev);
|
||||
|
||||
ip = &the_data;
|
||||
platform_set_drvdata(pdev, ip);
|
||||
|
||||
input_dev = input_allocate_device();
|
||||
if (!input_dev) {
|
||||
pr_err("%s: could not allocate input device\n", __func__);
|
||||
rc = -ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
ip->input_dev = input_dev;
|
||||
ip->pdata = pdata;
|
||||
input_set_drvdata(input_dev, ip);
|
||||
|
||||
input_dev->name = "proximity";
|
||||
|
||||
set_bit(EV_ABS, input_dev->evbit);
|
||||
input_set_abs_params(input_dev, ABS_DISTANCE, 0, 1, 0, 0);
|
||||
|
||||
rc = input_register_device(input_dev);
|
||||
if (rc < 0) {
|
||||
pr_err("%s: could not register input device\n", __func__);
|
||||
goto err_free_input_device;
|
||||
}
|
||||
|
||||
rc = misc_register(&capella_cm3602_misc);
|
||||
if (rc < 0) {
|
||||
pr_err("%s: could not register misc device\n", __func__);
|
||||
goto err_unregister_input_device;
|
||||
}
|
||||
|
||||
wake_lock_init(&proximity_wake_lock, WAKE_LOCK_SUSPEND, "proximity");
|
||||
|
||||
proximity_attr_class = class_create(THIS_MODULE, "sensors");
|
||||
if (IS_ERR(proximity_attr_class)) {
|
||||
pr_err("%s: class_create failed\n", __func__);
|
||||
rc = PTR_ERR(proximity_attr_class);
|
||||
proximity_attr_class = NULL;
|
||||
goto err_create_class;
|
||||
}
|
||||
|
||||
proximity_attr_dev = device_create(proximity_attr_class,
|
||||
NULL, 0, "%s", "proximity_sensor");
|
||||
if (unlikely(IS_ERR(proximity_attr_dev))) {
|
||||
pr_err("%s: device create failed\n", __func__);
|
||||
rc = PTR_ERR(proximity_attr_dev);
|
||||
proximity_attr_dev = NULL;
|
||||
goto err_create_proximity_attr_device;
|
||||
}
|
||||
|
||||
rc = device_create_file(proximity_attr_dev, &dev_attr_proximity);
|
||||
if (rc) {
|
||||
pr_err("%s: device_create_file failed\n", __func__);
|
||||
goto err_create_proximity_device_file;
|
||||
}
|
||||
|
||||
ip->p_sensor_wq = create_workqueue("p-sensor_microp_wq");
|
||||
if (ip->p_sensor_wq == NULL) {
|
||||
pr_err("%s: create_workqueue failed\n", __func__);
|
||||
goto err_create_workqueue;
|
||||
}
|
||||
|
||||
rc = gpio_request(pdata->p_en, "gpio_proximity_en");
|
||||
if (rc < 0) {
|
||||
pr_err("%s: gpio %d request failed (%d)\n",
|
||||
__func__, pdata->p_en, rc);
|
||||
goto err_request_proximity_en;
|
||||
}
|
||||
|
||||
rc = request_irq(pdata->p_out, p_sensor_irq_handler,
|
||||
IRQF_TRIGGER_NONE, "p-sensor_microp", ip);
|
||||
if (rc < 0) {
|
||||
pr_err("%s: request_irq(%d) failed for (%d)\n",
|
||||
__func__, pdata->p_out, rc);
|
||||
goto err_request_proximity_irq;
|
||||
}
|
||||
|
||||
goto done;
|
||||
|
||||
err_request_proximity_irq:
|
||||
gpio_free(pdata->p_en);
|
||||
err_request_proximity_en:
|
||||
destroy_workqueue(ip->p_sensor_wq);
|
||||
err_create_workqueue:
|
||||
device_remove_file(proximity_attr_dev, &dev_attr_proximity);
|
||||
err_create_proximity_device_file:
|
||||
device_unregister(proximity_attr_dev);
|
||||
err_create_proximity_attr_device:
|
||||
class_destroy(proximity_attr_class);
|
||||
err_create_class:
|
||||
misc_deregister(&capella_cm3602_misc);
|
||||
err_unregister_input_device:
|
||||
input_unregister_device(input_dev);
|
||||
err_free_input_device:
|
||||
input_free_device(input_dev);
|
||||
done:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static struct microp_ops ops = {
|
||||
.init_microp_func = supersonic_microp_function_init,
|
||||
};
|
||||
|
||||
void __init supersonic_microp_init(void)
|
||||
{
|
||||
microp_register_ops(&ops);
|
||||
}
|
||||
|
||||
static struct platform_driver capella_cm3602_driver = {
|
||||
.probe = capella_cm3602_probe,
|
||||
.driver = {
|
||||
.name = "supersonic_proximity",
|
||||
.owner = THIS_MODULE
|
||||
},
|
||||
};
|
||||
|
||||
static int __init supersonic_capella_cm3602_init(void)
|
||||
{
|
||||
if (!machine_is_supersonic())
|
||||
return 0;
|
||||
|
||||
return platform_driver_register(&capella_cm3602_driver);
|
||||
}
|
||||
|
||||
device_initcall(supersonic_capella_cm3602_init);
|
||||
|
||||
#endif
|
@ -1,464 +0,0 @@
|
||||
/* linux/arch/arm/mach-msm/board-supersonic-mmc.c
|
||||
*
|
||||
* Copyright (C) 2009 Google, Inc.
|
||||
* Copyright (C) 2009 HTC Corporation
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/mmc/host.h>
|
||||
#include <linux/mmc/sdio_ids.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/gpio.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/mach/mmc.h>
|
||||
|
||||
#include <mach/vreg.h>
|
||||
|
||||
#include "board-supersonic.h"
|
||||
#include "devices.h"
|
||||
#include "proc_comm.h"
|
||||
|
||||
#define DEBUG_SDSLOT_VDD 1
|
||||
|
||||
static bool opt_disable_sdcard;
|
||||
static int __init supersonic_disablesdcard_setup(char *str)
|
||||
{
|
||||
opt_disable_sdcard = (bool)simple_strtol(str, NULL, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
__setup("board_supersonic.disable_sdcard=", supersonic_disablesdcard_setup);
|
||||
|
||||
static uint32_t sdcard_on_gpio_table[] = {
|
||||
PCOM_GPIO_CFG(62, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), /* CLK */
|
||||
PCOM_GPIO_CFG(63, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), /* CMD */
|
||||
PCOM_GPIO_CFG(64, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), /* DAT3 */
|
||||
PCOM_GPIO_CFG(65, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), /* DAT2 */
|
||||
PCOM_GPIO_CFG(66, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT1 */
|
||||
PCOM_GPIO_CFG(67, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT0 */
|
||||
};
|
||||
|
||||
static uint32_t sdcard_off_gpio_table[] = {
|
||||
PCOM_GPIO_CFG(62, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* CLK */
|
||||
PCOM_GPIO_CFG(63, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* CMD */
|
||||
PCOM_GPIO_CFG(64, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT3 */
|
||||
PCOM_GPIO_CFG(65, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT2 */
|
||||
PCOM_GPIO_CFG(66, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT1 */
|
||||
PCOM_GPIO_CFG(67, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT0 */
|
||||
};
|
||||
|
||||
static struct vreg *sdslot_vreg;
|
||||
static uint32_t sdslot_vdd = 0xffffffff;
|
||||
static uint32_t sdslot_vreg_enabled;
|
||||
|
||||
static struct {
|
||||
int mask;
|
||||
int level;
|
||||
} mmc_vdd_table[] = {
|
||||
{ MMC_VDD_28_29, 2850 },
|
||||
{ MMC_VDD_29_30, 2900 },
|
||||
};
|
||||
|
||||
static uint32_t supersonic_sdslot_switchvdd(struct device *dev, unsigned int vdd)
|
||||
{
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
if (vdd == sdslot_vdd)
|
||||
return 0;
|
||||
|
||||
sdslot_vdd = vdd;
|
||||
|
||||
if (vdd == 0) {
|
||||
#if DEBUG_SDSLOT_VDD
|
||||
printk(KERN_INFO "%s: Disabling SD slot power\n", __func__);
|
||||
#endif
|
||||
config_gpio_table(sdcard_off_gpio_table,
|
||||
ARRAY_SIZE(sdcard_off_gpio_table));
|
||||
vreg_disable(sdslot_vreg);
|
||||
sdslot_vreg_enabled = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!sdslot_vreg_enabled) {
|
||||
mdelay(5);
|
||||
ret = vreg_enable(sdslot_vreg);
|
||||
if (ret)
|
||||
pr_err("%s: Error enabling vreg (%d)\n", __func__, ret);
|
||||
udelay(500);
|
||||
config_gpio_table(sdcard_on_gpio_table,
|
||||
ARRAY_SIZE(sdcard_on_gpio_table));
|
||||
sdslot_vreg_enabled = 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(mmc_vdd_table); i++) {
|
||||
if (mmc_vdd_table[i].mask != (1 << vdd))
|
||||
continue;
|
||||
ret = vreg_set_level(sdslot_vreg, mmc_vdd_table[i].level);
|
||||
if (ret)
|
||||
pr_err("%s: Error setting level (%d)\n", __func__, ret);
|
||||
#if DEBUG_SDSLOT_VDD
|
||||
printk(KERN_INFO "%s: Setting level to %u (%s)\n",
|
||||
__func__, mmc_vdd_table[i].level,
|
||||
ret?"Failed":"Success");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
pr_err("%s: Invalid VDD (%d) specified\n", __func__, vdd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned int supersonic_sdslot_status(struct device *dev)
|
||||
{
|
||||
return (system_rev > 0)?1:!gpio_get_value(SUPERSONIC_GPIO_SDMC_CD_N);
|
||||
}
|
||||
|
||||
#define SUPERSONIC_MMC_VDD (MMC_VDD_28_29 | MMC_VDD_29_30)
|
||||
|
||||
static unsigned int supersonic_sdslot_type = MMC_TYPE_SD;
|
||||
|
||||
static struct mmc_platform_data supersonic_sdslot_data = {
|
||||
.ocr_mask = SUPERSONIC_MMC_VDD,
|
||||
.status = supersonic_sdslot_status,
|
||||
.translate_vdd = supersonic_sdslot_switchvdd,
|
||||
.slot_type = &supersonic_sdslot_type,
|
||||
};
|
||||
|
||||
int msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat,
|
||||
unsigned int stat_irq, unsigned long stat_irq_flags);
|
||||
|
||||
|
||||
|
||||
/* ---- WIFI ---- */
|
||||
|
||||
static uint32_t wifi_on_gpio_table[] = {
|
||||
PCOM_GPIO_CFG(51, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT3 */
|
||||
PCOM_GPIO_CFG(52, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT2 */
|
||||
PCOM_GPIO_CFG(53, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT1 */
|
||||
PCOM_GPIO_CFG(54, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT0 */
|
||||
PCOM_GPIO_CFG(55, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), /* CMD */
|
||||
PCOM_GPIO_CFG(56, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), /* CLK */
|
||||
PCOM_GPIO_CFG(152, 0, GPIO_INPUT, GPIO_NO_PULL, GPIO_4MA), /* WLAN IRQ */
|
||||
};
|
||||
|
||||
static uint32_t wifi_off_gpio_table[] = {
|
||||
PCOM_GPIO_CFG(51, 0, GPIO_INPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT3 */
|
||||
PCOM_GPIO_CFG(52, 0, GPIO_INPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT2 */
|
||||
PCOM_GPIO_CFG(53, 0, GPIO_INPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT1 */
|
||||
PCOM_GPIO_CFG(54, 0, GPIO_INPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT0 */
|
||||
PCOM_GPIO_CFG(55, 0, GPIO_INPUT, GPIO_PULL_UP, GPIO_4MA), /* CMD */
|
||||
PCOM_GPIO_CFG(56, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* CLK */
|
||||
PCOM_GPIO_CFG(152, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_4MA), /* WLAN IRQ */
|
||||
};
|
||||
|
||||
/* BCM4329 returns wrong sdio_vsn(1) when we read cccr,
|
||||
* we use predefined value (sdio_vsn=2) here to initial sdio driver well
|
||||
*/
|
||||
static struct embedded_sdio_data supersonic_wifi_emb_data = {
|
||||
.cccr = {
|
||||
.sdio_vsn = 2,
|
||||
.multi_block = 1,
|
||||
.low_speed = 0,
|
||||
.wide_bus = 0,
|
||||
.high_power = 1,
|
||||
.high_speed = 1,
|
||||
},
|
||||
};
|
||||
|
||||
static void (*wifi_status_cb)(int card_present, void *dev_id);
|
||||
static void *wifi_status_cb_devid;
|
||||
|
||||
static int
|
||||
supersonic_wifi_status_register(void (*callback)(int card_present, void *dev_id),
|
||||
void *dev_id)
|
||||
{
|
||||
if (wifi_status_cb)
|
||||
return -EAGAIN;
|
||||
wifi_status_cb = callback;
|
||||
wifi_status_cb_devid = dev_id;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int supersonic_wifi_cd; /* WiFi virtual 'card detect' status */
|
||||
|
||||
static unsigned int supersonic_wifi_status(struct device *dev)
|
||||
{
|
||||
return supersonic_wifi_cd;
|
||||
}
|
||||
|
||||
static struct mmc_platform_data supersonic_wifi_data = {
|
||||
.ocr_mask = MMC_VDD_28_29,
|
||||
.status = supersonic_wifi_status,
|
||||
.register_status_notify = supersonic_wifi_status_register,
|
||||
.embedded_sdio = &supersonic_wifi_emb_data,
|
||||
};
|
||||
|
||||
int supersonic_wifi_set_carddetect(int val)
|
||||
{
|
||||
printk(KERN_INFO "%s: %d\n", __func__, val);
|
||||
supersonic_wifi_cd = val;
|
||||
if (wifi_status_cb)
|
||||
wifi_status_cb(val, wifi_status_cb_devid);
|
||||
else
|
||||
printk(KERN_WARNING "%s: Nobody to notify\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(supersonic_wifi_set_carddetect);
|
||||
|
||||
int supersonic_wifi_power(int on)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
printk(KERN_INFO "%s: %d\n", __func__, on);
|
||||
|
||||
if (on) {
|
||||
config_gpio_table(wifi_on_gpio_table,
|
||||
ARRAY_SIZE(wifi_on_gpio_table));
|
||||
mdelay(50);
|
||||
if (rc)
|
||||
return rc;
|
||||
} else {
|
||||
config_gpio_table(wifi_off_gpio_table,
|
||||
ARRAY_SIZE(wifi_off_gpio_table));
|
||||
}
|
||||
|
||||
mdelay(100);
|
||||
gpio_set_value(SUPERSONIC_GPIO_WIFI_SHUTDOWN_N, on); /* WIFI_SHUTDOWN */
|
||||
mdelay(100);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(supersonic_wifi_power);
|
||||
|
||||
int supersonic_wifi_reset(int on)
|
||||
{
|
||||
printk(KERN_INFO "%s: do nothing\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* ---------------- WiMAX GPIO Settings --------------- */
|
||||
static uint32_t wimax_power_pin_gpio_table[] = {
|
||||
PCOM_GPIO_CFG(48, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(106, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(154, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(155, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(156, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA)
|
||||
};
|
||||
|
||||
static uint32_t wimax_on_gpio_table[] = {
|
||||
PCOM_GPIO_CFG(88, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), /* CLK */
|
||||
PCOM_GPIO_CFG(89, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), /* CMD */
|
||||
PCOM_GPIO_CFG(90, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), /* DAT3 */
|
||||
PCOM_GPIO_CFG(91, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), /* DAT2 */
|
||||
PCOM_GPIO_CFG(92, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), /* DAT1 */
|
||||
PCOM_GPIO_CFG(93, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), /* DAT0 */
|
||||
/*WiMax_Host_2*/
|
||||
PCOM_GPIO_CFG(159, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA),
|
||||
};
|
||||
|
||||
static uint32_t wimax_off_gpio_table[] = {
|
||||
PCOM_GPIO_CFG(88, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), /* CLK */
|
||||
PCOM_GPIO_CFG(89, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), /* CMD */
|
||||
PCOM_GPIO_CFG(90, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), /* DAT3 */
|
||||
PCOM_GPIO_CFG(91, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), /* DAT2 */
|
||||
PCOM_GPIO_CFG(92, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), /* DAT1 */
|
||||
PCOM_GPIO_CFG(93, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), /* DAT0 */
|
||||
/*WiMax_Host_2*/
|
||||
PCOM_GPIO_CFG(159, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA),
|
||||
};
|
||||
|
||||
|
||||
static void (*wimax_status_cb)(int card_present, void *dev_id);
|
||||
static void *wimax_status_cb_devid;
|
||||
static int mmc_wimax_cd = 0;
|
||||
static int mmc_wimax_sdio_status = 0;
|
||||
static int mmc_wimax_hostwakeup_gpio = 40; // GPIO40
|
||||
|
||||
static int supersonic_wimax_status_register(void (*callback)(int card_present, void *dev_id), void *dev_id)
|
||||
{
|
||||
if (wimax_status_cb)
|
||||
return -EAGAIN;
|
||||
printk("%s\n", __func__);
|
||||
wimax_status_cb = callback;
|
||||
wimax_status_cb_devid = dev_id;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned int supersonic_wimax_status(struct device *dev)
|
||||
{
|
||||
printk("%s\n", __func__);
|
||||
return mmc_wimax_cd;
|
||||
}
|
||||
|
||||
void mmc_wimax_set_carddetect(int val)
|
||||
{
|
||||
printk("%s: %d\n", __func__, val);
|
||||
mmc_wimax_cd = val;
|
||||
if (wimax_status_cb) {
|
||||
wimax_status_cb(val, wimax_status_cb_devid);
|
||||
} else
|
||||
printk(KERN_WARNING "%s: Nobody to notify\n", __func__);
|
||||
}
|
||||
EXPORT_SYMBOL(mmc_wimax_set_carddetect);
|
||||
|
||||
static unsigned int supersonic_wimax_type = MMC_TYPE_SDIO_WIMAX;
|
||||
|
||||
static struct mmc_platform_data supersonic_wimax_data = {
|
||||
.ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29 | MMC_VDD_29_30,
|
||||
.status = supersonic_wimax_status,
|
||||
.register_status_notify = supersonic_wimax_status_register,
|
||||
.embedded_sdio = NULL,
|
||||
.slot_type = &supersonic_wimax_type,
|
||||
};
|
||||
|
||||
struct _vreg
|
||||
{
|
||||
const char *name;
|
||||
unsigned id;
|
||||
};
|
||||
|
||||
|
||||
/* 2 : wimax UART, 1 : CPU uart, 0 : usb
|
||||
CPU_WIMAX_SW -> GPIO160 (SUPERSONIC_WIMAX_CPU_UARTz_SW)
|
||||
USB_UART#_SW -> GPIO33 (SUPERSONIC_USB_UARTz_SW)
|
||||
|
||||
XA : GPIO33 = 0 -> USB
|
||||
GPIO33 = 1 -> CPU UART
|
||||
|
||||
XB : GPIO33 = 0 -> USB
|
||||
GPIO33 = 1 , GPIO160 = 0 -> CPU UART
|
||||
GPIO33 = 1 , GPIO160 = 1 -> Wimax UART
|
||||
*/
|
||||
int mmc_wimax_uart_switch(int uart)
|
||||
{
|
||||
printk("%s uart:%d\n", __func__, uart);
|
||||
|
||||
gpio_set_value(SUPERSONIC_USB_UARTz_SW, uart?1:0);
|
||||
if(system_rev && uart)
|
||||
gpio_set_value(SUPERSONIC_WIMAX_CPU_UARTz_SW, uart==2?1:0);
|
||||
return uart?1:0;
|
||||
}
|
||||
EXPORT_SYMBOL(mmc_wimax_uart_switch);
|
||||
|
||||
int mmc_wimax_power(int on)
|
||||
{
|
||||
printk("%s\n", __func__);
|
||||
|
||||
if (on) {
|
||||
/*Power ON sequence*/
|
||||
gpio_set_value(154, 1);
|
||||
gpio_set_value(48, 1);
|
||||
mdelay(5);
|
||||
gpio_set_value(106, 0);
|
||||
gpio_set_value(156, 1);
|
||||
gpio_set_value(155, 1);
|
||||
mdelay(5);
|
||||
gpio_set_value(106, 1);
|
||||
mdelay(1150);
|
||||
|
||||
config_gpio_table(wimax_on_gpio_table,
|
||||
ARRAY_SIZE(wimax_on_gpio_table));
|
||||
} else {
|
||||
/*Power OFF sequence*/
|
||||
config_gpio_table(wimax_off_gpio_table,
|
||||
ARRAY_SIZE(wimax_off_gpio_table));
|
||||
gpio_set_value(88, 0); /*WiMax_SDIO_CLK_1 OL*/
|
||||
gpio_set_value(159, 0); /*WiMax_Host_2 OL*/
|
||||
|
||||
gpio_set_value(106, 1);
|
||||
mdelay(5);
|
||||
gpio_set_value(156, 0);
|
||||
gpio_set_value(155, 0);
|
||||
gpio_set_value(106, 0);
|
||||
mdelay(5);
|
||||
gpio_set_value(154, 0);
|
||||
gpio_set_value(48, 0);
|
||||
mdelay(5);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(mmc_wimax_power);
|
||||
|
||||
int mmc_wimax_set_status(int on)
|
||||
{
|
||||
printk(KERN_INFO "%s on:%d\n", __func__, on);
|
||||
mmc_wimax_sdio_status = on;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(mmc_wimax_set_status);
|
||||
|
||||
int mmc_wimax_get_status()
|
||||
{
|
||||
//printk(KERN_INFO "%s status:%d\n", __func__, mmc_wimax_sdio_status);
|
||||
return mmc_wimax_sdio_status;
|
||||
}
|
||||
EXPORT_SYMBOL(mmc_wimax_get_status);
|
||||
|
||||
int mmc_wimax_get_hostwakeup_gpio(void)
|
||||
{
|
||||
return mmc_wimax_hostwakeup_gpio;
|
||||
}
|
||||
EXPORT_SYMBOL(mmc_wimax_get_hostwakeup_gpio);
|
||||
|
||||
int __init supersonic_init_mmc(unsigned int sys_rev)
|
||||
{
|
||||
uint32_t id;
|
||||
|
||||
wifi_status_cb = NULL;
|
||||
|
||||
printk(KERN_INFO "%s()+\n", __func__);
|
||||
|
||||
/* initial WIFI_SHUTDOWN# */
|
||||
id = PCOM_GPIO_CFG(SUPERSONIC_GPIO_WIFI_SHUTDOWN_N, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA),
|
||||
msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &id, 0);
|
||||
gpio_set_value(SUPERSONIC_GPIO_WIFI_SHUTDOWN_N, 0);
|
||||
|
||||
msm_add_sdcc(1, &supersonic_wifi_data, 0, 0);
|
||||
|
||||
/* Initial WiMAX */
|
||||
printk("config wimax power gpio table\n");
|
||||
config_gpio_table(wimax_power_pin_gpio_table,
|
||||
ARRAY_SIZE(wimax_power_pin_gpio_table));
|
||||
|
||||
msm_add_sdcc(3, &supersonic_wimax_data,0,0);
|
||||
|
||||
if (opt_disable_sdcard) {
|
||||
pr_info("%s: sdcard disabled on cmdline\n", __func__);
|
||||
goto done;
|
||||
}
|
||||
|
||||
sdslot_vreg_enabled = 0;
|
||||
|
||||
sdslot_vreg = vreg_get(0, "gp6");
|
||||
if (IS_ERR(sdslot_vreg))
|
||||
return PTR_ERR(sdslot_vreg);
|
||||
|
||||
if (system_rev == 0) { /* XA board */
|
||||
set_irq_wake(MSM_GPIO_TO_INT(SUPERSONIC_GPIO_SDMC_CD_N), 1);
|
||||
|
||||
msm_add_sdcc(2, &supersonic_sdslot_data,
|
||||
MSM_GPIO_TO_INT(SUPERSONIC_GPIO_SDMC_CD_N),
|
||||
IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE);
|
||||
} else
|
||||
msm_add_sdcc(2, &supersonic_sdslot_data, 0, 0);
|
||||
|
||||
done:
|
||||
printk(KERN_INFO "%s()-\n", __func__);
|
||||
return 0;
|
||||
}
|
@ -1,921 +0,0 @@
|
||||
/* linux/arch/arm/mach-msm/board-supersonic-panel.c
|
||||
*
|
||||
* Copyright (C) 2008 HTC Corporation.
|
||||
* Author: Jay Tu <jay_tu@htc.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/gpio.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/mach-types.h>
|
||||
#include <mach/msm_fb.h>
|
||||
#include <mach/msm_iomap.h>
|
||||
#include <mach/vreg.h>
|
||||
/* #include <mach/pmic.h> */
|
||||
|
||||
#include "board-supersonic.h"
|
||||
#include "devices.h"
|
||||
#include "proc_comm.h"
|
||||
|
||||
#if 1
|
||||
#define B(s...) printk(s)
|
||||
#else
|
||||
#define B(s...) do {} while(0)
|
||||
#endif
|
||||
extern int panel_type;
|
||||
enum {
|
||||
PANEL_SHARP,
|
||||
PANEL_AUO,
|
||||
};
|
||||
|
||||
static struct cabc_t {
|
||||
struct led_classdev lcd_backlight;
|
||||
struct msm_mddi_client_data *client_data;
|
||||
struct mutex lock;
|
||||
unsigned long status;
|
||||
} cabc;
|
||||
|
||||
enum {
|
||||
GATE_ON = 1 << 0,
|
||||
};
|
||||
static struct vreg *vreg_lcd_2v8;
|
||||
static struct vreg *vreg_lcd_1v8;
|
||||
|
||||
#define REG_WAIT (0xffff)
|
||||
struct nov_regs {
|
||||
unsigned reg;
|
||||
unsigned val;
|
||||
} nov_init_seq[] = {
|
||||
{0xc000, 0x86},
|
||||
{0xc001, 0x00},
|
||||
{0xc002, 0x86},
|
||||
{0xc003, 0x00},
|
||||
{0xc100, 0x40},
|
||||
{0xc200, 0x02},
|
||||
{0xc202, 0x32},
|
||||
{0xe000, 0x0e},
|
||||
{0xe001, 0x34},
|
||||
{0xe002, 0x3F},
|
||||
{0xe003, 0x49},
|
||||
{0xe004, 0x1D},
|
||||
{0xe005, 0x2C},
|
||||
{0xe006, 0x5F},
|
||||
{0xe007, 0x3A},
|
||||
{0xe008, 0x20},
|
||||
{0xe009, 0x28},
|
||||
{0xe00a, 0x80},
|
||||
{0xe00b, 0x13},
|
||||
{0xe00c, 0x32},
|
||||
{0xe00d, 0x56},
|
||||
{0xe00e, 0x79},
|
||||
{0xe00f, 0xB8},
|
||||
{0xe010, 0x55},
|
||||
{0xe011, 0x57},
|
||||
{0xe100, 0x0e},
|
||||
{0xe101, 0x34},
|
||||
{0xe102, 0x3F},
|
||||
{0xe103, 0x49},
|
||||
{0xe104, 0x1D},
|
||||
{0xe105, 0x2C},
|
||||
{0xe106, 0x5F},
|
||||
{0xe107, 0x3A},
|
||||
{0xe108, 0x20},
|
||||
{0xe109, 0x28},
|
||||
{0xe10a, 0x80},
|
||||
{0xe10b, 0x13},
|
||||
{0xe10c, 0x32},
|
||||
{0xe10d, 0x56},
|
||||
{0xe10e, 0x79},
|
||||
{0xe10f, 0xB8},
|
||||
{0xe110, 0x55},
|
||||
{0xe111, 0x57},
|
||||
|
||||
{0xe200, 0x0E},
|
||||
{0xe201, 0x34},
|
||||
{0xe202, 0x3F},
|
||||
{0xe203, 0x49},
|
||||
{0xe204, 0x1D},
|
||||
{0xe205, 0x2C},
|
||||
{0xe206, 0x5F},
|
||||
{0xe207, 0x3A},
|
||||
{0xe208, 0x20},
|
||||
{0xe209, 0x28},
|
||||
{0xe20A, 0x80},
|
||||
{0xe20B, 0x13},
|
||||
{0xe20C, 0x32},
|
||||
{0xe20D, 0x56},
|
||||
{0xe20E, 0x79},
|
||||
{0xe20F, 0xB8},
|
||||
{0xe210, 0x55},
|
||||
{0xe211, 0x57},
|
||||
|
||||
{0xe300, 0x0E},
|
||||
{0xe301, 0x34},
|
||||
{0xe302, 0x3F},
|
||||
{0xe303, 0x49},
|
||||
{0xe304, 0x1D},
|
||||
{0xe305, 0x2C},
|
||||
{0xe306, 0x5F},
|
||||
{0xe307, 0x3A},
|
||||
{0xe308, 0x20},
|
||||
{0xe309, 0x28},
|
||||
{0xe30A, 0x80},
|
||||
{0xe30B, 0x13},
|
||||
{0xe30C, 0x32},
|
||||
{0xe30D, 0x56},
|
||||
{0xe30E, 0x79},
|
||||
{0xe30F, 0xB8},
|
||||
{0xe310, 0x55},
|
||||
{0xe311, 0x57},
|
||||
{0xe400, 0x0E},
|
||||
{0xe401, 0x34},
|
||||
{0xe402, 0x3F},
|
||||
{0xe403, 0x49},
|
||||
{0xe404, 0x1D},
|
||||
{0xe405, 0x2C},
|
||||
{0xe406, 0x5F},
|
||||
{0xe407, 0x3A},
|
||||
{0xe408, 0x20},
|
||||
{0xe409, 0x28},
|
||||
{0xe40A, 0x80},
|
||||
{0xe40B, 0x13},
|
||||
{0xe40C, 0x32},
|
||||
{0xe40D, 0x56},
|
||||
{0xe40E, 0x79},
|
||||
{0xe40F, 0xB8},
|
||||
{0xe410, 0x55},
|
||||
{0xe411, 0x57},
|
||||
{0xe500, 0x0E},
|
||||
{0xe501, 0x34},
|
||||
{0xe502, 0x3F},
|
||||
{0xe503, 0x49},
|
||||
{0xe504, 0x1D},
|
||||
{0xe505, 0x2C},
|
||||
{0xe506, 0x5F},
|
||||
{0xe507, 0x3A},
|
||||
{0xe508, 0x20},
|
||||
{0xe509, 0x28},
|
||||
{0xe50A, 0x80},
|
||||
{0xe50B, 0x13},
|
||||
{0xe50C, 0x32},
|
||||
{0xe50D, 0x56},
|
||||
{0xe50E, 0x79},
|
||||
{0xe50F, 0xB8},
|
||||
{0xe510, 0x55},
|
||||
{0xe511, 0x57},
|
||||
|
||||
{0x3a00, 0x05},
|
||||
|
||||
/* cabc */
|
||||
{0x4e00, 0x00},
|
||||
{0x5e00, 0x00},
|
||||
{0x6a01, 0x00},
|
||||
{0x6a02, 0x03},
|
||||
{0x5100, 0xff},
|
||||
{0x5301, 0x10},
|
||||
{0x6A18, 0xff},
|
||||
{0x6A17, 0x01},
|
||||
{0xF402, 0x14},
|
||||
|
||||
{0x3500, 0x00},
|
||||
{0x1100, 0x0},
|
||||
{REG_WAIT, 120},
|
||||
};
|
||||
|
||||
struct s1d_regs {
|
||||
unsigned reg;
|
||||
unsigned val;
|
||||
} s1d13775_init_seq[] = {
|
||||
{0x001C, 0x1500},
|
||||
{0x0020, 0x3047},
|
||||
{0x0024, 0x401A},
|
||||
{0x0028, 0x031A},
|
||||
{0x002C, 0x0001},
|
||||
{REG_WAIT, 0x0004}, /* increase delay 1ms -> 4ms */
|
||||
{0x0084, 0x0215},
|
||||
{0x0088, 0x0038},
|
||||
{0x008C, 0x2113},
|
||||
{0x002C, 0x0002},
|
||||
{REG_WAIT, 0x0004}, /* increase delay 1ms -> 4ms */
|
||||
{0x002C, 0x0003},
|
||||
{0x0100, 0x3702},
|
||||
{0x0104, 0x0180},
|
||||
{0x0140, 0x003F},
|
||||
{0x0144, 0x00EF},
|
||||
{0x0148, 0x0016},
|
||||
{0x014C, 0x0005},
|
||||
{0x0150, 0x0006},
|
||||
{0x0154, 0x032B},
|
||||
{0x0158, 0x031F},
|
||||
{0x015C, 0x0009},
|
||||
{0x0160, 0x0002},
|
||||
{0x0164, 0x0003},
|
||||
{0x0168, 0x00A2},
|
||||
{0x0180, 0x0057},
|
||||
{0x0184, 0x00DB},
|
||||
{0x0188, 0x00E3},
|
||||
{0x018C, 0x0000},
|
||||
{0x0190, 0x0000},
|
||||
{0x0280, 0x0000},
|
||||
{0x0284, 0x0002},
|
||||
{0x0288, 0x0000},
|
||||
{0x028C, 0x0001},
|
||||
{0x0294, 0x0000},
|
||||
{0x0400, 0x8000},
|
||||
{0x0404, 0x1001},
|
||||
{0x0480, 0x0001},
|
||||
{0x0500, 0x0000},
|
||||
{0x0504, 0x0011},
|
||||
{0x0508, 0x0000},
|
||||
{0x0510, 0x0000},
|
||||
{0x0518, 0x002E},
|
||||
{0x051C, 0x00c7},
|
||||
{0x0520, 0x01DF},
|
||||
{0x0524, 0x031f},
|
||||
{0x0528, 0x0000},
|
||||
{0x052C, 0x0000},
|
||||
{0x0530, 0x0000},
|
||||
{0x0534, 0x0000},
|
||||
|
||||
{0x0604, 0x0108},
|
||||
{0x060C, 0x0000},
|
||||
{0x0610, 0x00ff},
|
||||
|
||||
{0x0648, 0x0020},
|
||||
{0x0800, 0x0000},
|
||||
{0x0804, 0x000A},
|
||||
{0x0808, 0x0400},
|
||||
{0x080C, 0x0400},
|
||||
{0x0814, 0x0000},
|
||||
{0x081C, 0x0000},
|
||||
{0x0824, 0x002E},
|
||||
{0x0828, 0x00C7},
|
||||
{0x082C, 0x01DF},
|
||||
{0x0830, 0x031F},
|
||||
{0x0834, 0x0000},
|
||||
{0x0838, 0x0000},
|
||||
{0x083C, 0x0000},
|
||||
{0x0840, 0x0000},
|
||||
{0x0844, 0x01DF},
|
||||
{0x0848, 0x031F},
|
||||
{0x0870, 0x0064},
|
||||
{0x0874, 0x0064},
|
||||
{0x0878, 0x00C7},
|
||||
{0x087C, 0x00C7},
|
||||
{0x1410, 0x0004},
|
||||
{0x1414, 0x00FF},
|
||||
{0x1420, 0x0000},
|
||||
{0x1424, 0x0000},
|
||||
{0x1428, 0x01DF},
|
||||
{0x142C, 0x031F},
|
||||
{0x1430, 0xDC00},
|
||||
{0x1434, 0x0005},
|
||||
{0x1440, 0x0000},
|
||||
{0x1444, 0x0000},
|
||||
{0x1448, 0x01DF},
|
||||
{0x144C, 0x031F},
|
||||
{0x1450, 0x0000},
|
||||
{0x1454, 0x0000},
|
||||
{0x1458, 0x01DF},
|
||||
{0x145C, 0x031F},
|
||||
{0x1460, 0x0000},
|
||||
{0x1464, 0x0000},
|
||||
{0x1468, 0x01DF},
|
||||
{0x146C, 0x031F},
|
||||
{0x1470, 0x0000},
|
||||
{0x1474, 0x0000},
|
||||
{0x1478, 0x01DF},
|
||||
{0x147C, 0x031F},
|
||||
{0x14A4, 0x0110},
|
||||
{0x14A8, 0xAFC8},
|
||||
{0x14AC, 0x0FF0},
|
||||
{0x14B0, 0x0202},
|
||||
{0x14B4, 0x0080},
|
||||
{0x14A0, 0x0002},
|
||||
{0x1508, 0x0000},
|
||||
{0x150C, 0x0000},
|
||||
{0x1510, 0x0000},
|
||||
{0x1514, 0x0000},
|
||||
{0x1520, 0x0000},
|
||||
{0x1524, 0x0000},
|
||||
{0x1528, 0x0000},
|
||||
{0x152C, 0x0000},
|
||||
{0x1530, 0x0000},
|
||||
{0x1534, 0x0000},
|
||||
{0x1538, 0x0000},
|
||||
{0x153C, 0x0000},
|
||||
{0x1540, 0x0000},
|
||||
{0x1544, 0x0000},
|
||||
{0x1548, 0x0000},
|
||||
{0x154C, 0x0000},
|
||||
{0x1550, 0x0000},
|
||||
{0x1554, 0x0000},
|
||||
{0x1558, 0x0000},
|
||||
{0x1600, 0x0000},
|
||||
{0x1604, 0x0020},
|
||||
{0x1608, 0x0040},
|
||||
{0x160C, 0x0060},
|
||||
{0x1610, 0x0080},
|
||||
{0x1614, 0x00A0},
|
||||
{0x1618, 0x00C0},
|
||||
{0x161C, 0x00E0},
|
||||
{0x1620, 0x0100},
|
||||
{0x1624, 0x0000},
|
||||
{0x1628, 0x0020},
|
||||
{0x162C, 0x0040},
|
||||
{0x1630, 0x0060},
|
||||
{0x1634, 0x0080},
|
||||
{0x1638, 0x00A0},
|
||||
{0x163C, 0x00C0},
|
||||
{0x1640, 0x00E0},
|
||||
{0x1644, 0x0100},
|
||||
{0x1648, 0x0000},
|
||||
{0x164C, 0x0020},
|
||||
{0x1650, 0x0040},
|
||||
{0x1654, 0x0060},
|
||||
{0x1658, 0x0080},
|
||||
{0x165C, 0x00A0},
|
||||
{0x1660, 0x00C0},
|
||||
{0x1664, 0x00E0},
|
||||
{0x1668, 0x0100},
|
||||
{0x1680, 0x0000},
|
||||
{0x1684, 0x0000},
|
||||
{0x1688, 0x0000},
|
||||
{0x168C, 0x0000},
|
||||
{0x1694, 0x0000},
|
||||
{0x16A0, 0x0000},
|
||||
{0x16A4, 0x0000},
|
||||
{0x16A8, 0x0000},
|
||||
{0x16AC, 0x0000},
|
||||
{0x16B4, 0x0000},
|
||||
{0x16C0, 0x0000},
|
||||
{0x16C4, 0x0000},
|
||||
{0x16C8, 0x0000},
|
||||
{0x16CC, 0x0000},
|
||||
{0x16D4, 0x0000},
|
||||
{0x16E0, 0x0000},
|
||||
{0x16E4, 0x0000},
|
||||
{0x16E8, 0x0000},
|
||||
{0x16EC, 0x0000},
|
||||
{0x16F4, 0x0000},
|
||||
{0x1700, 0x0000},
|
||||
{0x1704, 0x0000},
|
||||
{0x1708, 0x0000},
|
||||
{0x170C, 0x0000},
|
||||
{0x1714, 0x0000},
|
||||
{0x1720, 0x0000},
|
||||
{0x1724, 0x0000},
|
||||
{0x1728, 0x0000},
|
||||
{0x172C, 0x0000},
|
||||
{0x1734, 0x0000},
|
||||
{0x1740, 0x0000},
|
||||
{0x1744, 0x0000},
|
||||
{0x1748, 0x0000},
|
||||
{0x174C, 0x0000},
|
||||
{0x1754, 0x0000},
|
||||
{0x1760, 0x0000},
|
||||
{0x1764, 0x0000},
|
||||
{0x1768, 0x0000},
|
||||
{0x176C, 0x0000},
|
||||
{0x1774, 0x0000},
|
||||
{0x0300, 0x7000},
|
||||
{0x0304, 0x0000},
|
||||
{0x0308, 0x0000},
|
||||
{0x030C, 0x0000},
|
||||
{0x0310, 0x0000},
|
||||
{0x0314, 0x0000},
|
||||
{0x0318, 0xF7FF},
|
||||
{0x031C, 0xFFFF},
|
||||
{0x0320, 0x000F},
|
||||
{0x0324, 0x0000},
|
||||
{0x0328, 0x0000},
|
||||
{0x032C, 0x0000},
|
||||
};
|
||||
|
||||
struct s1d_regs pwm_seq[] = {
|
||||
{0x001C, 0x0010},
|
||||
{0x14A0, 0x0001},
|
||||
{0x14A4, 0x0110},
|
||||
{0x14B0, 0x3030},
|
||||
{0x14A8, 0x09C4},
|
||||
{0x14AC, 0x0FF0},
|
||||
};
|
||||
extern int qspi_send_9bit(unsigned char id, unsigned data);
|
||||
extern int qspi_send_16bit(unsigned char id, unsigned data);
|
||||
|
||||
static void suc_set_brightness(struct led_classdev *led_cdev,
|
||||
enum led_brightness val)
|
||||
{
|
||||
struct msm_mddi_client_data *client = cabc.client_data;
|
||||
unsigned int shrink_br = val;
|
||||
|
||||
printk(KERN_DEBUG "set brightness = %d\n", val);
|
||||
if (test_bit(GATE_ON, &cabc.status) == 0)
|
||||
return;
|
||||
|
||||
if (val < 30)
|
||||
shrink_br = 5;
|
||||
else if ((val >= 30) && (val <= 143))
|
||||
shrink_br = 104 * (val - 30) / 113 + 5;
|
||||
else
|
||||
shrink_br = 145 * (val - 144) / 111 + 110;
|
||||
mutex_lock(&cabc.lock);
|
||||
if (panel_type == PANEL_SHARP) {
|
||||
int i, reg, val;
|
||||
for (i = 0; i < ARRAY_SIZE(pwm_seq); i++) {
|
||||
reg = pwm_seq[i].reg;
|
||||
val = pwm_seq[i].val;
|
||||
if (reg == REG_WAIT)
|
||||
hr_msleep(val);
|
||||
else
|
||||
client->remote_write(client, cpu_to_le32(val), reg);
|
||||
}
|
||||
client->remote_write(client, shrink_br, 0x14B4);
|
||||
} else {
|
||||
qspi_send_16bit(0x1, 0x55);
|
||||
qspi_send_16bit(0x0, 0x00);
|
||||
qspi_send_16bit(0x2, 0x00);
|
||||
|
||||
qspi_send_16bit(0x1, 0x51);
|
||||
qspi_send_16bit(0x0, 0x00);
|
||||
qspi_send_16bit(0x2, shrink_br);
|
||||
}
|
||||
mutex_unlock(&cabc.lock);
|
||||
}
|
||||
|
||||
static enum led_brightness
|
||||
suc_get_brightness(struct led_classdev *led_cdev)
|
||||
{
|
||||
struct msm_mddi_client_data *client = cabc.client_data;
|
||||
if (panel_type == PANEL_SHARP)
|
||||
return client->remote_read(client, 0x14B4);
|
||||
else
|
||||
return client->remote_read(client, 0x5100);
|
||||
}
|
||||
|
||||
#define DEFAULT_BRIGHTNESS 100
|
||||
static void suc_backlight_switch(int on)
|
||||
{
|
||||
enum led_brightness val;
|
||||
|
||||
if (on) {
|
||||
printk(KERN_DEBUG "turn on backlight\n");
|
||||
set_bit(GATE_ON, &cabc.status);
|
||||
val = cabc.lcd_backlight.brightness;
|
||||
|
||||
/* LED core uses get_brightness for default value
|
||||
* If the physical layer is not ready, we should
|
||||
* not count on it */
|
||||
if (val == 0)
|
||||
val = DEFAULT_BRIGHTNESS;
|
||||
suc_set_brightness(&cabc.lcd_backlight, val);
|
||||
} else {
|
||||
clear_bit(GATE_ON, &cabc.status);
|
||||
suc_set_brightness(&cabc.lcd_backlight, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static int suc_backlight_probe(struct platform_device *pdev)
|
||||
{
|
||||
int err = -EIO;
|
||||
|
||||
mutex_init(&cabc.lock);
|
||||
cabc.client_data = pdev->dev.platform_data;
|
||||
cabc.lcd_backlight.name = "lcd-backlight";
|
||||
cabc.lcd_backlight.brightness_set = suc_set_brightness;
|
||||
cabc.lcd_backlight.brightness_get = suc_get_brightness;
|
||||
err = led_classdev_register(&pdev->dev, &cabc.lcd_backlight);
|
||||
if (err)
|
||||
goto err_register_lcd_bl;
|
||||
return 0;
|
||||
|
||||
err_register_lcd_bl:
|
||||
led_classdev_unregister(&cabc.lcd_backlight);
|
||||
return err;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
|
||||
static struct resource resources_msm_fb[] = {
|
||||
{
|
||||
.start = MSM_FB_BASE,
|
||||
.end = MSM_FB_BASE + MSM_FB_SIZE - 1,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
};
|
||||
|
||||
static int
|
||||
supersonic_mddi_init(struct msm_mddi_bridge_platform_data *bridge_data,
|
||||
struct msm_mddi_client_data *client_data)
|
||||
{
|
||||
int i = 0, ret;
|
||||
unsigned reg, val;
|
||||
|
||||
if (panel_type == PANEL_SHARP) {
|
||||
client_data->auto_hibernate(client_data, 0);
|
||||
for (i = 0; i < ARRAY_SIZE(s1d13775_init_seq); i++) {
|
||||
reg = s1d13775_init_seq[i].reg;
|
||||
val = s1d13775_init_seq[i].val;
|
||||
if (reg == REG_WAIT)
|
||||
hr_msleep(val);
|
||||
else
|
||||
client_data->remote_write(client_data, cpu_to_le32(val), reg);
|
||||
}
|
||||
client_data->auto_hibernate(client_data, 1);
|
||||
|
||||
struct spi_cmd {
|
||||
unsigned char reg;
|
||||
unsigned char val;
|
||||
unsigned int delay;
|
||||
} sharp_spi[] = {
|
||||
{0x0, 0x11, 100},
|
||||
|
||||
{0x0, 0xB9, 0},
|
||||
{0x1, 0xFF, 0},
|
||||
{0x1, 0x83, 0},
|
||||
{0x1, 0x63, 0},
|
||||
|
||||
{0x0, 0x3A, 0},
|
||||
{0x1, 0x50, 0},
|
||||
};
|
||||
|
||||
/* FIXME */
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(sharp_spi); i++) {
|
||||
ret = qspi_send_9bit(sharp_spi[i].reg, sharp_spi[i].val);
|
||||
if (ret < 0)
|
||||
printk("%s: spi_write fail!\n", __func__);
|
||||
else if (sharp_spi[i].delay)
|
||||
hr_msleep(sharp_spi[i].delay);
|
||||
}
|
||||
}
|
||||
else {
|
||||
client_data->auto_hibernate(client_data, 0);
|
||||
for (i = 0; i < ARRAY_SIZE(nov_init_seq); i++) {
|
||||
reg = cpu_to_le32(nov_init_seq[i].reg);
|
||||
val = cpu_to_le32(nov_init_seq[i].val);
|
||||
if (reg == REG_WAIT)
|
||||
msleep(val);
|
||||
else
|
||||
client_data->remote_write(client_data, val, reg);
|
||||
}
|
||||
client_data->auto_hibernate(client_data, 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
supersonic_mddi_uninit(struct msm_mddi_bridge_platform_data *bridge_data,
|
||||
struct msm_mddi_client_data *client_data)
|
||||
{
|
||||
if (panel_type == PANEL_SHARP) {
|
||||
int i, ret;
|
||||
struct spi_cmd {
|
||||
unsigned char reg;
|
||||
unsigned char val;
|
||||
unsigned int delay;
|
||||
} sharp_spi[] = {
|
||||
{0x0, 0x28, 0},
|
||||
{0x0, 0x10, 100},
|
||||
};
|
||||
|
||||
/* FIXME */
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(sharp_spi); i++) {
|
||||
ret = qspi_send_9bit(sharp_spi[i].reg, sharp_spi[i].val);
|
||||
if (ret < 0)
|
||||
printk("%s: spi_write fail!\n", __func__);
|
||||
else if (sharp_spi[i].delay)
|
||||
hr_msleep(sharp_spi[i].delay);
|
||||
}
|
||||
}
|
||||
else
|
||||
client_data->remote_write(client_data, 0, 0x2800);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* FIXME: remove after XA03 */
|
||||
static int backlight_control(int on)
|
||||
{
|
||||
struct i2c_adapter *adap = i2c_get_adapter(0);
|
||||
struct i2c_msg msg;
|
||||
u8 buf[] = {0x90, 0x00, 0x00, 0x08};
|
||||
int ret = -EIO, max_retry = 3;
|
||||
|
||||
msg.addr = 0xcc >> 1;
|
||||
msg.flags = 0;
|
||||
msg.len = sizeof(buf);
|
||||
msg.buf = buf;
|
||||
|
||||
if (on == 0)
|
||||
buf[0] = 0x91;
|
||||
|
||||
while (max_retry--) {
|
||||
ret = i2c_transfer(adap, &msg, 1);
|
||||
if (ret != 1)
|
||||
msleep(1);
|
||||
else {
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
ret = -EIO;
|
||||
}
|
||||
|
||||
if (ret)
|
||||
printk(KERN_ERR "backlight control fail\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
supersonic_panel_blank(struct msm_mddi_bridge_platform_data *bridge_data,
|
||||
struct msm_mddi_client_data *client_data)
|
||||
{
|
||||
B(KERN_DEBUG "%s\n", __func__);
|
||||
suc_backlight_switch(LED_OFF);
|
||||
backlight_control(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
supersonic_panel_unblank(struct msm_mddi_bridge_platform_data *bridge_data,
|
||||
struct msm_mddi_client_data *client_data)
|
||||
{
|
||||
B(KERN_DEBUG "%s\n", __func__);
|
||||
if (panel_type == PANEL_AUO) {
|
||||
suc_backlight_switch(LED_FULL);
|
||||
client_data->remote_write(client_data, 0x00, 0x2900);
|
||||
msleep(100);
|
||||
client_data->remote_write(client_data, 0x24, 0x5300);
|
||||
} else {
|
||||
suc_backlight_switch(LED_FULL);
|
||||
client_data->remote_write(client_data, 0x4000, 0x0600);
|
||||
msleep(10);
|
||||
qspi_send_9bit(0x0, 0x29);
|
||||
client_data->remote_write(client_data, 0x7000, 0x0324);
|
||||
client_data->remote_write(client_data, 0x4000, 0x0600);
|
||||
}
|
||||
|
||||
backlight_control(1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct msm_mddi_bridge_platform_data novatec_client_data = {
|
||||
.init = supersonic_mddi_init,
|
||||
.uninit = supersonic_mddi_uninit,
|
||||
.blank = supersonic_panel_blank,
|
||||
.unblank = supersonic_panel_unblank,
|
||||
.fb_data = {
|
||||
.xres = 480,
|
||||
.yres = 800,
|
||||
.width = 48,
|
||||
.height = 80,
|
||||
.output_format = 0,
|
||||
},
|
||||
.panel_conf = {
|
||||
.caps = MSMFB_CAP_CABC,
|
||||
},
|
||||
};
|
||||
|
||||
static struct msm_mddi_bridge_platform_data epson_client_data = {
|
||||
.init = supersonic_mddi_init,
|
||||
.uninit = supersonic_mddi_uninit,
|
||||
.blank = supersonic_panel_blank,
|
||||
.unblank = supersonic_panel_unblank,
|
||||
.fb_data = {
|
||||
.xres = 480,
|
||||
.yres = 800,
|
||||
.width = 48,
|
||||
.height = 80,
|
||||
.output_format = 0,
|
||||
},
|
||||
.panel_conf = {
|
||||
.caps = MSMFB_CAP_CABC,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
#define SPI_CLK 17
|
||||
#define SPI_DO 18
|
||||
#define SPI_DI 19
|
||||
#define SPI_CS 20
|
||||
|
||||
#define LCM_GPIO_CFG(gpio, func) \
|
||||
PCOM_GPIO_CFG(gpio, func, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_16MA)
|
||||
static uint32_t spi_on_gpio_table[] = {
|
||||
LCM_GPIO_CFG(SPI_CLK, 1),
|
||||
LCM_GPIO_CFG(SPI_CS, 1),
|
||||
LCM_GPIO_CFG(SPI_DO, 1),
|
||||
PCOM_GPIO_CFG(SPI_DI, 1, GPIO_INPUT, GPIO_NO_PULL, GPIO_16MA),
|
||||
};
|
||||
|
||||
static uint32_t spi_off_gpio_table[] = {
|
||||
LCM_GPIO_CFG(SPI_CLK, 0),
|
||||
LCM_GPIO_CFG(SPI_CS, 0),
|
||||
LCM_GPIO_CFG(SPI_DO, 0),
|
||||
PCOM_GPIO_CFG(SPI_DI, 0, GPIO_INPUT, GPIO_NO_PULL, GPIO_16MA),
|
||||
};
|
||||
|
||||
static int spi_gpio_switch(int on)
|
||||
{
|
||||
config_gpio_table(
|
||||
!!on ? spi_on_gpio_table : spi_off_gpio_table,
|
||||
ARRAY_SIZE(spi_on_gpio_table));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
mddi_novatec_power(struct msm_mddi_client_data *client_data, int on)
|
||||
{
|
||||
unsigned id, on_off = 1;
|
||||
|
||||
B(KERN_DEBUG "%s: power %s.\n", __func__, on ? "on" : "off");
|
||||
|
||||
if (on) {
|
||||
on_off = 1;
|
||||
/* 2V8 */
|
||||
id = PM_VREG_PDOWN_SYNT_ID;
|
||||
msm_proc_comm(PCOM_VREG_PULLDOWN, &on_off, &id);
|
||||
vreg_enable(vreg_lcd_2v8);
|
||||
|
||||
/* 1V8 */
|
||||
id = PM_VREG_PDOWN_AUX_ID;
|
||||
msm_proc_comm(PCOM_VREG_PULLDOWN, &on_off, &id);
|
||||
vreg_enable(vreg_lcd_1v8);
|
||||
hr_msleep(15);
|
||||
|
||||
gpio_set_value(SUPERSONIC_LCD_RST, 1);
|
||||
hr_msleep(1);
|
||||
gpio_set_value(SUPERSONIC_LCD_RST, 0);
|
||||
hr_msleep(5);
|
||||
gpio_set_value(SUPERSONIC_LCD_RST, 1);
|
||||
hr_msleep(50);
|
||||
spi_gpio_switch(1);
|
||||
} else {
|
||||
on_off = 0;
|
||||
gpio_set_value(SUPERSONIC_LCD_RST, 0);
|
||||
hr_msleep(120);
|
||||
|
||||
/* 1V8 */
|
||||
id = PM_VREG_PDOWN_AUX_ID;
|
||||
msm_proc_comm(PCOM_VREG_PULLDOWN, &on_off, &id);
|
||||
vreg_disable(vreg_lcd_1v8);
|
||||
|
||||
/* 2V8 */
|
||||
id = PM_VREG_PDOWN_SYNT_ID;
|
||||
msm_proc_comm(PCOM_VREG_PULLDOWN, &on_off, &id);
|
||||
vreg_disable(vreg_lcd_2v8);
|
||||
spi_gpio_switch(0);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
mddi_epson_power(struct msm_mddi_client_data *client_data, int on)
|
||||
{
|
||||
unsigned id, on_off = 1;
|
||||
|
||||
B(KERN_DEBUG "%s: power %s.\n", __func__, on ? "on" : "off");
|
||||
|
||||
if (on) {
|
||||
on_off = 1;
|
||||
/* 2V8 */
|
||||
gpio_set_value(149, 1);
|
||||
id = PM_VREG_PDOWN_SYNT_ID;
|
||||
msm_proc_comm(PCOM_VREG_PULLDOWN, &on_off, &id);
|
||||
vreg_enable(vreg_lcd_2v8);
|
||||
hr_msleep(5);
|
||||
/* 1V8 */
|
||||
gpio_set_value(16, 1);
|
||||
id = PM_VREG_PDOWN_AUX_ID;
|
||||
msm_proc_comm(PCOM_VREG_PULLDOWN, &on_off, &id);
|
||||
vreg_enable(vreg_lcd_1v8);
|
||||
hr_msleep(10);
|
||||
|
||||
gpio_set_value(151, 1);
|
||||
hr_msleep(2);
|
||||
|
||||
gpio_set_value(SUPERSONIC_LCD_RST, 1);
|
||||
hr_msleep(1);
|
||||
gpio_set_value(SUPERSONIC_LCD_RST, 0);
|
||||
hr_msleep(5);
|
||||
gpio_set_value(SUPERSONIC_LCD_RST, 1);
|
||||
hr_msleep(50);
|
||||
spi_gpio_switch(1);
|
||||
} else {
|
||||
on_off = 0;
|
||||
gpio_set_value(SUPERSONIC_LCD_RST, 0);
|
||||
hr_msleep(2);
|
||||
gpio_set_value(151, 0);
|
||||
hr_msleep(120);
|
||||
|
||||
/* 1V8 */
|
||||
gpio_set_value(16, 0);
|
||||
id = PM_VREG_PDOWN_AUX_ID;
|
||||
msm_proc_comm(PCOM_VREG_PULLDOWN, &on_off, &id);
|
||||
vreg_disable(vreg_lcd_1v8);
|
||||
hr_msleep(5);
|
||||
/* 2V8 */
|
||||
gpio_set_value(149, 0);
|
||||
id = PM_VREG_PDOWN_SYNT_ID;
|
||||
msm_proc_comm(PCOM_VREG_PULLDOWN, &on_off, &id);
|
||||
vreg_disable(vreg_lcd_2v8);
|
||||
spi_gpio_switch(0);
|
||||
}
|
||||
}
|
||||
|
||||
static struct msm_mddi_platform_data mddi_pdata = {
|
||||
.clk_rate = 384000000,
|
||||
.fb_resource = resources_msm_fb,
|
||||
.num_clients = 2,
|
||||
.client_platform_data = {
|
||||
{
|
||||
.product_id = (0xb9f6 << 16 | 0x5582),
|
||||
.name = "mddi_c_b9f6_5582",
|
||||
.id = 1,
|
||||
.client_data = &novatec_client_data,
|
||||
.clk_rate = 0,
|
||||
},
|
||||
{
|
||||
.product_id = (0x4ca3 << 16 | 0x0000),
|
||||
.name = "mddi_c_4ca3_0000",
|
||||
.id = 0,
|
||||
.client_data = &epson_client_data,
|
||||
.clk_rate = 0,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_driver suc_backlight_driver = {
|
||||
.probe = suc_backlight_probe,
|
||||
.driver = {
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
};
|
||||
|
||||
static struct msm_mdp_platform_data mdp_pdata = {
|
||||
.dma_channel = MDP_DMA_S,
|
||||
};
|
||||
|
||||
int __init supersonic_init_panel(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
B(KERN_INFO "%s: enter.\n", __func__);
|
||||
|
||||
vreg_lcd_1v8 = vreg_get(0, "gp4");
|
||||
if (IS_ERR(vreg_lcd_1v8))
|
||||
return PTR_ERR(vreg_lcd_1v8);
|
||||
|
||||
vreg_lcd_2v8 = vreg_get(0, "synt");
|
||||
if (IS_ERR(vreg_lcd_2v8))
|
||||
return PTR_ERR(vreg_lcd_2v8);
|
||||
|
||||
if (panel_type == PANEL_SHARP)
|
||||
mdp_pdata.overrides |= MSM_MDP_PANEL_IGNORE_PIXEL_DATA;
|
||||
else
|
||||
mdp_pdata.overrides &= ~MSM_MDP_PANEL_IGNORE_PIXEL_DATA;
|
||||
|
||||
msm_device_mdp.dev.platform_data = &mdp_pdata;
|
||||
rc = platform_device_register(&msm_device_mdp);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
if (panel_type)
|
||||
mddi_pdata.power_client = mddi_novatec_power;
|
||||
else
|
||||
mddi_pdata.power_client = mddi_epson_power;
|
||||
|
||||
msm_device_mddi0.dev.platform_data = &mddi_pdata;
|
||||
rc = platform_device_register(&msm_device_mddi0);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
if (panel_type)
|
||||
suc_backlight_driver.driver.name = "nov_cabc";
|
||||
else
|
||||
suc_backlight_driver.driver.name = "eps_cabc";
|
||||
rc = platform_driver_register(&suc_backlight_driver);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,357 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2009 Google, Inc.
|
||||
* Copyright (C) 2009 HTC Corporation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Control bluetooth power for supersonic platform */
|
||||
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/rfkill.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include "gpio_chip.h"
|
||||
#include "proc_comm.h"
|
||||
#include "board-supersonic.h"
|
||||
|
||||
#define HTC_RFKILL_DBG
|
||||
|
||||
static struct rfkill *bt_rfk;
|
||||
static const char bt_name[] = "bcm4329";
|
||||
static int pre_state;
|
||||
|
||||
static uint32_t supersonic_bt_init_table[] = {
|
||||
/* BT_RTS */
|
||||
PCOM_GPIO_CFG(SUPERSONIC_GPIO_BT_UART1_RTS,
|
||||
0,
|
||||
GPIO_OUTPUT,
|
||||
GPIO_NO_PULL,
|
||||
GPIO_8MA),
|
||||
/* BT_CTS */
|
||||
PCOM_GPIO_CFG(SUPERSONIC_GPIO_BT_UART1_CTS,
|
||||
0,
|
||||
GPIO_INPUT,
|
||||
GPIO_PULL_UP,
|
||||
GPIO_8MA),
|
||||
/* BT_RX */
|
||||
PCOM_GPIO_CFG(SUPERSONIC_GPIO_BT_UART1_RX,
|
||||
0,
|
||||
GPIO_INPUT,
|
||||
GPIO_PULL_UP,
|
||||
GPIO_8MA),
|
||||
/* BT_TX */
|
||||
PCOM_GPIO_CFG(SUPERSONIC_GPIO_BT_UART1_TX,
|
||||
0,
|
||||
GPIO_OUTPUT,
|
||||
GPIO_NO_PULL,
|
||||
GPIO_8MA),
|
||||
|
||||
/* BT_SHUTDOWN_N */
|
||||
PCOM_GPIO_CFG(SUPERSONIC_GPIO_BT_SHUTDOWN_N,
|
||||
0,
|
||||
GPIO_OUTPUT,
|
||||
GPIO_NO_PULL,
|
||||
GPIO_4MA),
|
||||
/* BT_RESET_N */
|
||||
PCOM_GPIO_CFG(SUPERSONIC_GPIO_BT_RESET_N,
|
||||
0,
|
||||
GPIO_OUTPUT,
|
||||
GPIO_NO_PULL,
|
||||
GPIO_4MA),
|
||||
|
||||
/* BT_HOST_WAKE */
|
||||
PCOM_GPIO_CFG(SUPERSONIC_GPIO_BT_HOST_WAKE,
|
||||
0,
|
||||
GPIO_INPUT,
|
||||
GPIO_PULL_UP,
|
||||
GPIO_4MA),
|
||||
/* BT_CHIP_WAKE */
|
||||
PCOM_GPIO_CFG(SUPERSONIC_GPIO_BT_CHIP_WAKE,
|
||||
0,
|
||||
GPIO_OUTPUT,
|
||||
GPIO_NO_PULL,
|
||||
GPIO_4MA),
|
||||
};
|
||||
|
||||
static uint32_t supersonic_bt_on_table[] = {
|
||||
/* BT_RTS */
|
||||
PCOM_GPIO_CFG(SUPERSONIC_GPIO_BT_UART1_RTS,
|
||||
2,
|
||||
GPIO_OUTPUT,
|
||||
GPIO_PULL_UP,
|
||||
GPIO_8MA),
|
||||
/* BT_CTS */
|
||||
PCOM_GPIO_CFG(SUPERSONIC_GPIO_BT_UART1_CTS,
|
||||
2,
|
||||
GPIO_INPUT,
|
||||
GPIO_PULL_UP,
|
||||
GPIO_8MA),
|
||||
/* BT_RX */
|
||||
PCOM_GPIO_CFG(SUPERSONIC_GPIO_BT_UART1_RX,
|
||||
2,
|
||||
GPIO_INPUT,
|
||||
GPIO_PULL_UP,
|
||||
GPIO_8MA),
|
||||
/* BT_TX */
|
||||
PCOM_GPIO_CFG(SUPERSONIC_GPIO_BT_UART1_TX,
|
||||
2,
|
||||
GPIO_OUTPUT,
|
||||
GPIO_PULL_UP,
|
||||
GPIO_8MA),
|
||||
|
||||
/* BT_HOST_WAKE */
|
||||
PCOM_GPIO_CFG(SUPERSONIC_GPIO_BT_HOST_WAKE,
|
||||
0,
|
||||
GPIO_INPUT,
|
||||
GPIO_NO_PULL,
|
||||
GPIO_4MA),
|
||||
/* BT_CHIP_WAKE */
|
||||
PCOM_GPIO_CFG(SUPERSONIC_GPIO_BT_CHIP_WAKE,
|
||||
0,
|
||||
GPIO_OUTPUT,
|
||||
GPIO_NO_PULL,
|
||||
GPIO_4MA),
|
||||
};
|
||||
|
||||
static uint32_t supersonic_bt_off_table[] = {
|
||||
/* BT_RTS */
|
||||
PCOM_GPIO_CFG(SUPERSONIC_GPIO_BT_UART1_RTS,
|
||||
0,
|
||||
GPIO_OUTPUT,
|
||||
GPIO_NO_PULL,
|
||||
GPIO_8MA),
|
||||
/* BT_CTS */
|
||||
PCOM_GPIO_CFG(SUPERSONIC_GPIO_BT_UART1_CTS,
|
||||
0,
|
||||
GPIO_INPUT,
|
||||
GPIO_PULL_UP,
|
||||
GPIO_8MA),
|
||||
/* BT_RX */
|
||||
PCOM_GPIO_CFG(SUPERSONIC_GPIO_BT_UART1_RX,
|
||||
0,
|
||||
GPIO_INPUT,
|
||||
GPIO_PULL_UP,
|
||||
GPIO_8MA),
|
||||
/* BT_TX */
|
||||
PCOM_GPIO_CFG(SUPERSONIC_GPIO_BT_UART1_TX,
|
||||
0,
|
||||
GPIO_OUTPUT,
|
||||
GPIO_NO_PULL,
|
||||
GPIO_8MA),
|
||||
|
||||
/* BT_HOST_WAKE */
|
||||
PCOM_GPIO_CFG(SUPERSONIC_GPIO_BT_HOST_WAKE,
|
||||
0,
|
||||
GPIO_INPUT,
|
||||
GPIO_PULL_UP,
|
||||
GPIO_4MA),
|
||||
/* BT_CHIP_WAKE */
|
||||
PCOM_GPIO_CFG(SUPERSONIC_GPIO_BT_CHIP_WAKE,
|
||||
0,
|
||||
GPIO_OUTPUT,
|
||||
GPIO_NO_PULL,
|
||||
GPIO_4MA),
|
||||
};
|
||||
|
||||
static void config_bt_table(uint32_t *table, int len)
|
||||
{
|
||||
int n;
|
||||
unsigned id;
|
||||
for (n = 0; n < len; n++) {
|
||||
id = table[n];
|
||||
msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &id, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void supersonic_config_bt_init(void)
|
||||
{
|
||||
/* set bt initial configuration*/
|
||||
config_bt_table(supersonic_bt_init_table,
|
||||
ARRAY_SIZE(supersonic_bt_init_table));
|
||||
/* BT_RESET_N */
|
||||
gpio_configure(SUPERSONIC_GPIO_BT_RESET_N,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_LOW);
|
||||
mdelay(5);
|
||||
|
||||
/* BT_SHUTDOWN_N */
|
||||
gpio_configure(SUPERSONIC_GPIO_BT_SHUTDOWN_N,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_HIGH);
|
||||
/* BT_RESET_N */
|
||||
gpio_configure(SUPERSONIC_GPIO_BT_RESET_N,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_HIGH);
|
||||
mdelay(15);
|
||||
|
||||
/* BT_RESET_N */
|
||||
gpio_configure(SUPERSONIC_GPIO_BT_RESET_N,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_LOW);
|
||||
/* BT_SHUTDOWN_N */
|
||||
gpio_configure(SUPERSONIC_GPIO_BT_SHUTDOWN_N,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_LOW);
|
||||
|
||||
/* BT_RTS */
|
||||
gpio_configure(SUPERSONIC_GPIO_BT_UART1_RTS,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_LOW);
|
||||
/* BT_TX */
|
||||
gpio_configure(SUPERSONIC_GPIO_BT_UART1_TX,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_LOW);
|
||||
|
||||
/* BT_CHIP_WAKE */
|
||||
gpio_configure(SUPERSONIC_GPIO_BT_CHIP_WAKE,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_LOW);
|
||||
}
|
||||
|
||||
static void supersonic_config_bt_on(void)
|
||||
{
|
||||
|
||||
#ifdef HTC_RFKILL_DBG
|
||||
printk(KERN_INFO "-- RK ON --\n");
|
||||
#endif
|
||||
|
||||
/* set bt on configuration*/
|
||||
config_bt_table(supersonic_bt_on_table,
|
||||
ARRAY_SIZE(supersonic_bt_on_table));
|
||||
mdelay(5);
|
||||
/* BT_SHUTDOWN_N */
|
||||
gpio_configure(SUPERSONIC_GPIO_BT_SHUTDOWN_N,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_HIGH);
|
||||
/* BT_RESET_N */
|
||||
gpio_configure(SUPERSONIC_GPIO_BT_RESET_N,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_HIGH);
|
||||
mdelay(5);
|
||||
|
||||
/* BT_CHIP_WAKE */
|
||||
gpio_configure(SUPERSONIC_GPIO_BT_CHIP_WAKE,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_HIGH);
|
||||
}
|
||||
|
||||
static void supersonic_config_bt_off(void)
|
||||
{
|
||||
#ifdef HTC_RFKILL_DBG
|
||||
printk(KERN_INFO "-- RK OFF --\n");
|
||||
#endif
|
||||
|
||||
/* BT_RESET_N */
|
||||
gpio_configure(SUPERSONIC_GPIO_BT_RESET_N,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_LOW);
|
||||
/* BT_SHUTDOWN_N */
|
||||
gpio_configure(SUPERSONIC_GPIO_BT_SHUTDOWN_N,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_LOW);
|
||||
|
||||
config_bt_table(supersonic_bt_off_table,
|
||||
ARRAY_SIZE(supersonic_bt_off_table));
|
||||
mdelay(5);
|
||||
|
||||
/* BT_RTS */
|
||||
gpio_configure(SUPERSONIC_GPIO_BT_UART1_RTS,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_LOW);
|
||||
/* BT_TX */
|
||||
gpio_configure(SUPERSONIC_GPIO_BT_UART1_TX,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_LOW);
|
||||
|
||||
/* BT_CHIP_WAKE */
|
||||
gpio_configure(SUPERSONIC_GPIO_BT_CHIP_WAKE,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_LOW);
|
||||
}
|
||||
|
||||
static int bluetooth_set_power(void *data, bool blocked)
|
||||
{
|
||||
if (pre_state == blocked) {
|
||||
#ifdef HTC_RFKILL_DBG
|
||||
printk(KERN_INFO "-- SAME ST --\n");
|
||||
#endif
|
||||
return 0;
|
||||
} else
|
||||
pre_state = blocked;
|
||||
|
||||
if (!blocked)
|
||||
supersonic_config_bt_on();
|
||||
else
|
||||
supersonic_config_bt_off();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct rfkill_ops supersonic_rfkill_ops = {
|
||||
.set_block = bluetooth_set_power,
|
||||
};
|
||||
|
||||
static int supersonic_rfkill_probe(struct platform_device *pdev)
|
||||
{
|
||||
int rc = 0;
|
||||
bool default_state = true; /* off */
|
||||
|
||||
supersonic_config_bt_init(); /* bt gpio initial config */
|
||||
|
||||
bluetooth_set_power(NULL, default_state);
|
||||
|
||||
bt_rfk = rfkill_alloc(bt_name, &pdev->dev, RFKILL_TYPE_BLUETOOTH,
|
||||
&supersonic_rfkill_ops, NULL);
|
||||
if (!bt_rfk) {
|
||||
rc = -ENOMEM;
|
||||
goto err_rfkill_reset;
|
||||
}
|
||||
|
||||
rfkill_set_states(bt_rfk, default_state, false);
|
||||
|
||||
/* userspace cannot take exclusive control */
|
||||
rc = rfkill_register(bt_rfk);
|
||||
if (rc)
|
||||
goto err_rfkill_reg;
|
||||
|
||||
return 0;
|
||||
|
||||
err_rfkill_reg:
|
||||
rfkill_destroy(bt_rfk);
|
||||
err_rfkill_reset:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int supersonic_rfkill_remove(struct platform_device *dev)
|
||||
{
|
||||
rfkill_unregister(bt_rfk);
|
||||
rfkill_destroy(bt_rfk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver supersonic_rfkill_driver = {
|
||||
.probe = supersonic_rfkill_probe,
|
||||
.remove = supersonic_rfkill_remove,
|
||||
.driver = {
|
||||
.name = "supersonic_rfkill",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
};
|
||||
|
||||
static int __init supersonic_rfkill_init(void)
|
||||
{
|
||||
pre_state = -1;
|
||||
if (!machine_is_supersonic())
|
||||
return 0;
|
||||
|
||||
return platform_driver_register(&supersonic_rfkill_driver);
|
||||
}
|
||||
|
||||
static void __exit supersonic_rfkill_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&supersonic_rfkill_driver);
|
||||
}
|
||||
|
||||
module_init(supersonic_rfkill_init);
|
||||
module_exit(supersonic_rfkill_exit);
|
||||
MODULE_DESCRIPTION("supersonic rfkill");
|
||||
MODULE_AUTHOR("Nick Pelly <npelly@google.com>");
|
||||
MODULE_LICENSE("GPL");
|
@ -1,219 +0,0 @@
|
||||
/* linux/arch/arm/mach-msm/board-supersonic-wifi.c
|
||||
* Copyright (C) 2009 HTC Corporation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/err.h>
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/gpio.h>
|
||||
#include <asm/io.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/wifi_tiwlan.h>
|
||||
|
||||
#include "board-supersonic.h"
|
||||
|
||||
int supersonic_wifi_power(int on);
|
||||
int supersonic_wifi_reset(int on);
|
||||
int supersonic_wifi_set_carddetect(int on);
|
||||
|
||||
#define PREALLOC_WLAN_NUMBER_OF_SECTIONS 4
|
||||
#define PREALLOC_WLAN_NUMBER_OF_BUFFERS 160
|
||||
#define PREALLOC_WLAN_SECTION_HEADER 24
|
||||
|
||||
#define WLAN_SECTION_SIZE_0 (PREALLOC_WLAN_NUMBER_OF_BUFFERS * 128)
|
||||
#define WLAN_SECTION_SIZE_1 (PREALLOC_WLAN_NUMBER_OF_BUFFERS * 128)
|
||||
#define WLAN_SECTION_SIZE_2 (PREALLOC_WLAN_NUMBER_OF_BUFFERS * 512)
|
||||
#define WLAN_SECTION_SIZE_3 (PREALLOC_WLAN_NUMBER_OF_BUFFERS * 1024)
|
||||
|
||||
#define WLAN_SKB_BUF_NUM 16
|
||||
|
||||
static struct sk_buff *wlan_static_skb[WLAN_SKB_BUF_NUM];
|
||||
|
||||
typedef struct wifi_mem_prealloc_struct {
|
||||
void *mem_ptr;
|
||||
unsigned long size;
|
||||
} wifi_mem_prealloc_t;
|
||||
|
||||
static wifi_mem_prealloc_t wifi_mem_array[PREALLOC_WLAN_NUMBER_OF_SECTIONS] = {
|
||||
{ NULL, (WLAN_SECTION_SIZE_0 + PREALLOC_WLAN_SECTION_HEADER) },
|
||||
{ NULL, (WLAN_SECTION_SIZE_1 + PREALLOC_WLAN_SECTION_HEADER) },
|
||||
{ NULL, (WLAN_SECTION_SIZE_2 + PREALLOC_WLAN_SECTION_HEADER) },
|
||||
{ NULL, (WLAN_SECTION_SIZE_3 + PREALLOC_WLAN_SECTION_HEADER) }
|
||||
};
|
||||
|
||||
static void *supersonic_wifi_mem_prealloc(int section, unsigned long size)
|
||||
{
|
||||
if (section == PREALLOC_WLAN_NUMBER_OF_SECTIONS)
|
||||
return wlan_static_skb;
|
||||
if ((section < 0) || (section > PREALLOC_WLAN_NUMBER_OF_SECTIONS))
|
||||
return NULL;
|
||||
if (wifi_mem_array[section].size < size)
|
||||
return NULL;
|
||||
return wifi_mem_array[section].mem_ptr;
|
||||
}
|
||||
|
||||
int __init supersonic_init_wifi_mem(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0;( i < WLAN_SKB_BUF_NUM );i++) {
|
||||
if (i < (WLAN_SKB_BUF_NUM/2))
|
||||
wlan_static_skb[i] = dev_alloc_skb(4096);
|
||||
else
|
||||
wlan_static_skb[i] = dev_alloc_skb(8192);
|
||||
}
|
||||
for(i=0;( i < PREALLOC_WLAN_NUMBER_OF_SECTIONS );i++) {
|
||||
wifi_mem_array[i].mem_ptr = kmalloc(wifi_mem_array[i].size,
|
||||
GFP_KERNEL);
|
||||
if (wifi_mem_array[i].mem_ptr == NULL)
|
||||
return -ENOMEM;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct resource supersonic_wifi_resources[] = {
|
||||
[0] = {
|
||||
.name = "bcm4329_wlan_irq",
|
||||
.start = MSM_GPIO_TO_INT(SUPERSONIC_GPIO_WIFI_IRQ),
|
||||
.end = MSM_GPIO_TO_INT(SUPERSONIC_GPIO_WIFI_IRQ),
|
||||
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
|
||||
},
|
||||
};
|
||||
|
||||
static struct wifi_platform_data supersonic_wifi_control = {
|
||||
.set_power = supersonic_wifi_power,
|
||||
.set_reset = supersonic_wifi_reset,
|
||||
.set_carddetect = supersonic_wifi_set_carddetect,
|
||||
.mem_prealloc = supersonic_wifi_mem_prealloc,
|
||||
.dot11n_enable = 1,
|
||||
};
|
||||
|
||||
static struct platform_device supersonic_wifi_device = {
|
||||
.name = "bcm4329_wlan",
|
||||
.id = 1,
|
||||
.num_resources = ARRAY_SIZE(supersonic_wifi_resources),
|
||||
.resource = supersonic_wifi_resources,
|
||||
.dev = {
|
||||
.platform_data = &supersonic_wifi_control,
|
||||
},
|
||||
};
|
||||
|
||||
extern unsigned char *get_wifi_nvs_ram(void);
|
||||
|
||||
static unsigned supersonic_wifi_update_nvs(char *str)
|
||||
{
|
||||
#define NVS_LEN_OFFSET 0x0C
|
||||
#define NVS_DATA_OFFSET 0x40
|
||||
unsigned char *ptr;
|
||||
unsigned len;
|
||||
|
||||
if (!str)
|
||||
return -EINVAL;
|
||||
ptr = get_wifi_nvs_ram();
|
||||
/* Size in format LE assumed */
|
||||
memcpy(&len, ptr + NVS_LEN_OFFSET, sizeof(len));
|
||||
|
||||
/* the last bye in NVRAM is 0, trim it */
|
||||
if (ptr[NVS_DATA_OFFSET + len -1] == 0)
|
||||
len -= 1;
|
||||
|
||||
strcpy(ptr + NVS_DATA_OFFSET + len, str);
|
||||
len += strlen(str);
|
||||
memcpy(ptr + NVS_LEN_OFFSET, &len, sizeof(len));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned strip_nvs_param(char* param)
|
||||
{
|
||||
unsigned char *nvs_data;
|
||||
|
||||
unsigned param_len;
|
||||
int start_idx, end_idx;
|
||||
|
||||
unsigned char *ptr;
|
||||
unsigned len;
|
||||
|
||||
if (!param)
|
||||
return -EINVAL;
|
||||
ptr = get_wifi_nvs_ram();
|
||||
/* Size in format LE assumed */
|
||||
memcpy(&len, ptr + NVS_LEN_OFFSET, sizeof(len));
|
||||
|
||||
/* the last bye in NVRAM is 0, trim it */
|
||||
if (ptr[NVS_DATA_OFFSET + len -1] == 0)
|
||||
len -= 1;
|
||||
|
||||
nvs_data = ptr + NVS_DATA_OFFSET;
|
||||
|
||||
param_len = strlen(param);
|
||||
|
||||
/* search param */
|
||||
for (start_idx = 0; start_idx < len - param_len; start_idx++) {
|
||||
if (memcmp(&nvs_data[start_idx], param, param_len) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
end_idx = 0;
|
||||
if (start_idx < len - param_len) {
|
||||
/* search end-of-line */
|
||||
for (end_idx = start_idx + param_len; end_idx < len; end_idx++) {
|
||||
if (nvs_data[end_idx] == '\n' || nvs_data[end_idx] == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (start_idx < end_idx) {
|
||||
/* move the remain data forward */
|
||||
for (; end_idx + 1 < len; start_idx++, end_idx++) {
|
||||
nvs_data[start_idx] = nvs_data[end_idx+1];
|
||||
}
|
||||
len = len - (end_idx - start_idx + 1);
|
||||
memcpy(ptr + NVS_LEN_OFFSET, &len, sizeof(len));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __init supersonic_wifi_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!machine_is_supersonic())
|
||||
return 0;
|
||||
|
||||
printk("%s: start\n", __func__);
|
||||
supersonic_wifi_update_nvs("sd_oobonly=1\n");
|
||||
supersonic_wifi_update_nvs("btc_params80=0\n");
|
||||
|
||||
strip_nvs_param("pa0maxpwr");
|
||||
supersonic_wifi_update_nvs("pa0maxpwr=78\n");
|
||||
|
||||
strip_nvs_param("mcs2gpo0");
|
||||
supersonic_wifi_update_nvs("mcs2gpo0=0xCCCC\n");
|
||||
|
||||
strip_nvs_param("mcs2gpo1");
|
||||
supersonic_wifi_update_nvs("mcs2gpo1=0xCCCC\n");
|
||||
|
||||
strip_nvs_param("rxpo2g");
|
||||
supersonic_wifi_update_nvs("rxpo2g=0\n");
|
||||
|
||||
supersonic_init_wifi_mem();
|
||||
ret = platform_device_register(&supersonic_wifi_device);
|
||||
return ret;
|
||||
}
|
||||
|
||||
device_initcall(supersonic_wifi_init);
|
File diff suppressed because it is too large
Load Diff
@ -1,196 +0,0 @@
|
||||
/* arch/arm/mach-msm/board-supersonic.h
|
||||
*
|
||||
* Copyright (C) 2009 HTC Corporation.
|
||||
*
|
||||
* 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 __ARCH_ARM_MACH_MSM_BOARD_SUPERSONIC_H
|
||||
#define __ARCH_ARM_MACH_MSM_BOARD_SUPERSONIC_H
|
||||
|
||||
#include <mach/board.h>
|
||||
|
||||
#define MSM_SMI_BASE 0x02B00000
|
||||
#define MSM_SMI_SIZE 0x01500000
|
||||
|
||||
#define MSM_HDMI_FB_BASE 0x02B00000
|
||||
#define MSM_HDMI_FB_SIZE 0x00400000
|
||||
|
||||
#define MSM_PMEM_VENC_BASE 0x02F00000
|
||||
#define MSM_PMEM_VENC_SIZE 0x00800000
|
||||
|
||||
#define MSM_GPU_MEM_BASE 0x03700000
|
||||
#define MSM_GPU_MEM_SIZE 0x00300000
|
||||
|
||||
#define MSM_RAM_CONSOLE_BASE 0x03A00000
|
||||
#define MSM_RAM_CONSOLE_SIZE 0x00040000
|
||||
|
||||
#ifdef CONFIG_BUILD_CIQ
|
||||
#define MSM_PMEM_CIQ_BASE MSM_RAM_CONSOLE_BASE + MSM_RAM_CONSOLE_SIZE
|
||||
#define MSM_PMEM_CIQ_SIZE SZ_64K
|
||||
#define MSM_PMEM_CIQ1_BASE MSM_PMEM_CIQ_BASE
|
||||
#define MSM_PMEM_CIQ1_SIZE MSM_PMEM_CIQ_SIZE
|
||||
#define MSM_PMEM_CIQ2_BASE MSM_PMEM_CIQ_BASE
|
||||
#define MSM_PMEM_CIQ2_SIZE MSM_PMEM_CIQ_SIZE
|
||||
#define MSM_PMEM_CIQ3_BASE MSM_PMEM_CIQ_BASE
|
||||
#define MSM_PMEM_CIQ3_SIZE MSM_PMEM_CIQ_SIZE
|
||||
#endif
|
||||
|
||||
#define MSM_FB_BASE 0x03B00000
|
||||
#define MSM_FB_SIZE 0x00300000
|
||||
|
||||
#define MSM_EBI1_BANK0_BASE 0x20000000
|
||||
//#define MSM_EBI1_BANK0_SIZE 0x0E000000 /* radio < 3210 */
|
||||
#define MSM_EBI1_BANK0_SIZE 0x0E800000 /*for radio >=3210 */
|
||||
|
||||
/* 4Gb/512MB DRAM */
|
||||
#define MSM_EBI1_BANK1_BASE 0x30000000
|
||||
#define MSM_EBI1_BANK1_SIZE 0x0C000000
|
||||
|
||||
#define MSM_PMEM_MDP_BASE 0x3C000000
|
||||
#define MSM_PMEM_MDP_SIZE 0x02000000
|
||||
|
||||
#define MSM_PMEM_ADSP_BASE 0x3E000000
|
||||
#define MSM_PMEM_ADSP_SIZE 0x02000000
|
||||
|
||||
#define SUPERSONIC_GPIO_UP_INT_N 35
|
||||
#define SUPERSONIC_GPIO_UP_RESET_N 108
|
||||
|
||||
#define SUPERSONIC_GPIO_TP_RST 34
|
||||
#define SUPERSONIC_GPIO_TP_INT_N 38
|
||||
#define SUPERSONIC_GPIO_TP_EN 100 /* V_TP3V3_EN */
|
||||
|
||||
//#define SUPERSONIC_GPIO_POWER_KEY 94
|
||||
#define SUPERSONIC_GPIO_SDMC_CD_N 28
|
||||
|
||||
/* BT */
|
||||
#define SUPERSONIC_GPIO_BT_UART1_RTS (43)
|
||||
#define SUPERSONIC_GPIO_BT_UART1_CTS (44)
|
||||
#define SUPERSONIC_GPIO_BT_UART1_RX (45)
|
||||
#define SUPERSONIC_GPIO_BT_UART1_TX (46)
|
||||
#define SUPERSONIC_GPIO_BT_RESET_N (27)
|
||||
#define SUPERSONIC_GPIO_BT_SHUTDOWN_N (146)
|
||||
#define SUPERSONIC_GPIO_BT_HOST_WAKE (86)
|
||||
#define SUPERSONIC_GPIO_BT_CHIP_WAKE (87)
|
||||
|
||||
#define SUPERSONIC_GPIO_COMPASS_RST_N 107
|
||||
#define SUPERSONIC_GPIO_COMPASS_INT_N 36
|
||||
#define SUPERSONIC_PROJECT_NAME "supersonic"
|
||||
#define SUPERSONIC_LAYOUTS { \
|
||||
{ { 0, 1, 0}, { -1, 0, 0}, {0, 0, 1} }, \
|
||||
{ { 0, -1, 0}, { -1, 0, 0}, {0, 0, 1} }, \
|
||||
{ { -1, 0, 0}, { 0, -1, 0}, {0, 0, 1} }, \
|
||||
{ { 1, 0, 0}, { 0, 0, 1}, {0, 1, 0} } \
|
||||
}
|
||||
|
||||
/* Proximity */
|
||||
#define SUPERSONIC_GPIO_PROXIMITY_EN_N 109
|
||||
|
||||
/* Battery */
|
||||
#define SUPERSONIC_GPIO_MBAT_IN 39
|
||||
#define SUPERSONIC_GPIO_MCHG_EN_N 22
|
||||
#define SUPERSONIC_GPIO_ISET 16
|
||||
|
||||
/*Audio */
|
||||
#define SUPERSONIC_AUD_JACKHP_EN 157
|
||||
#define SUPERSONIC_AUD_2V5_EN 26
|
||||
#define SUPERSONIC_AUD_SPK_EN 129
|
||||
|
||||
/* Bluetooth PCM */
|
||||
#define SUPERSONIC_BT_PCM_OUT 68
|
||||
#define SUPERSONIC_BT_PCM_IN 69
|
||||
#define SUPERSONIC_BT_PCM_SYNC 70
|
||||
#define SUPERSONIC_BT_PCM_CLK 71
|
||||
|
||||
//#define SUPERSONIC_MENU_KEY 40
|
||||
#define SUPERSONIC_VOLUME_UP 41
|
||||
#define SUPERSONIC_VOLUME_DOWN 42
|
||||
#define SUPERSONIC_POWER_KEY 94
|
||||
|
||||
/* flash light */
|
||||
#define SUPERSONIC_GPIO_FLASHLIGHT_FLASH (84)
|
||||
#define SUPERSONIC_GPIO_FLASHLIGHT_TORCH (85)
|
||||
#define SUPERSONIC_GPIO_FLASHLIGHT_FLASH_ADJ (31)
|
||||
|
||||
/* AP Key Led turn on*/
|
||||
#define SUPERSONIC_AP_KEY_LED_EN (32)
|
||||
|
||||
/* UART/USB switch : high -> UART, low -> HSUSB */
|
||||
#define SUPERSONIC_USB_UARTz_SW 33
|
||||
#define SUPERSONIC_WIMAX_CPU_UARTz_SW 160
|
||||
|
||||
/* USB PHY 3V3 enable*/
|
||||
#define SUPERSONIC_USB_PHY_3V3_ENABLE (104)
|
||||
#define SUPERSONIC_GPIO_USB_CABLE_IN_PIN (82)
|
||||
#define SUPERSONIC_GPIO_USB_ID_PIN (37)
|
||||
/* 35mm headset */
|
||||
#define SUPERSONIC_GPIO_35MM_HEADSET_DET (153)
|
||||
#if 0 /* TODO */
|
||||
//#define SUPERSONIC_GPIO_H2W_POWER (27)
|
||||
//#define SUPERSONIC_GPIO_CABLE_IN1 (38)
|
||||
#define SUPERSONIC_GPIO_CABLE_IN (37)
|
||||
//#define SUPERSONIC_GPIO_H2W_DATA (139)
|
||||
//#define SUPERSONIC_GPIO_H2W_CLK (140)
|
||||
#endif
|
||||
|
||||
/* UART1*/
|
||||
#define SUPERSONIC_GPIO_UART1_RX (139)
|
||||
#define SUPERSONIC_GPIO_UART1_TX (140)
|
||||
|
||||
/* Wifi */
|
||||
#define SUPERSONIC_GPIO_WIFI_SHUTDOWN_N 147
|
||||
#define SUPERSONIC_GPIO_WIFI_IRQ 152
|
||||
/*camera*/
|
||||
#define SUPERSONIC_MAINCAM_PWD 105
|
||||
#define SUPERSONIC_MAINCAM_RST 99
|
||||
#define SUPERSONIC_2NDCAM_PWD 120
|
||||
#define SUPERSONIC_CLK_SWITCH 102
|
||||
|
||||
#define SUPERSONIC_LCD_RST (113)
|
||||
unsigned supersonic_get_skuid(void);
|
||||
|
||||
/* HDMI */
|
||||
#define HDMI_RST (111)
|
||||
#define V_HDMI_1V2_EN (119)
|
||||
#define V_VGA_5V_SIL9022A_EN (127)
|
||||
#define V_HDMI_3V3_EN (128)
|
||||
#define SUPERSONIC_I2S_CLK (142)
|
||||
#define SUPERSONIC_I2S_WS (143)
|
||||
#define SUPERSONIC_I2S_DOUT (145)
|
||||
|
||||
/* LCD RGB */
|
||||
#define SUPERSONIC_LCD_R0 (114)
|
||||
#define SUPERSONIC_LCD_R1 (115)
|
||||
#define SUPERSONIC_LCD_R2 (116)
|
||||
#define SUPERSONIC_LCD_R3 (117)
|
||||
#define SUPERSONIC_LCD_R4 (118)
|
||||
|
||||
#define SUPERSONIC_LCD_G0 (121)
|
||||
#define SUPERSONIC_LCD_G1 (122)
|
||||
#define SUPERSONIC_LCD_G2 (123)
|
||||
#define SUPERSONIC_LCD_G3 (124)
|
||||
#define SUPERSONIC_LCD_G4 (125)
|
||||
#define SUPERSONIC_LCD_G5 (126)
|
||||
|
||||
#define SUPERSONIC_LCD_B0 (130)
|
||||
#define SUPERSONIC_LCD_B1 (131)
|
||||
#define SUPERSONIC_LCD_B2 (132)
|
||||
#define SUPERSONIC_LCD_B3 (133)
|
||||
#define SUPERSONIC_LCD_B4 (134)
|
||||
|
||||
#define SUPERSONIC_LCD_PCLK (135)
|
||||
#define SUPERSONIC_LCD_VSYNC (136)
|
||||
#define SUPERSONIC_LCD_HSYNC (137)
|
||||
#define SUPERSONIC_LCD_DE (138)
|
||||
|
||||
#define SUPERSONIC_GPIO_PS_HOLD (25)
|
||||
int __init supersonic_init_panel(void);
|
||||
|
||||
#endif /* __ARCH_ARM_MACH_MSM_BOARD_SUPERSONIC_H */
|
@ -1,177 +0,0 @@
|
||||
/* linux/arch/arm/mach-msm/board-swordfish-keypad.c
|
||||
*
|
||||
* Copyright (C) 2007 Google, Inc.
|
||||
* Author: Brian Swetland <swetland@google.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/gpio_event.h>
|
||||
|
||||
#undef MODULE_PARAM_PREFIX
|
||||
#define MODULE_PARAM_PREFIX "board_swordfish."
|
||||
static int swordfish_ffa;
|
||||
module_param_named(ffa, swordfish_ffa, int, S_IRUGO | S_IWUSR | S_IWGRP);
|
||||
|
||||
#define SCAN_FUNCTION_KEYS 0 /* don't turn this on without updating the ffa support */
|
||||
|
||||
static unsigned int swordfish_row_gpios[] = {
|
||||
31, 32, 33, 34, 35, 41
|
||||
#if SCAN_FUNCTION_KEYS
|
||||
, 42
|
||||
#endif
|
||||
};
|
||||
|
||||
static unsigned int swordfish_col_gpios[] = { 36, 37, 38, 39, 40 };
|
||||
|
||||
/* FFA:
|
||||
36: KEYSENSE_N(0)
|
||||
37: KEYSENSE_N(1)
|
||||
38: KEYSENSE_N(2)
|
||||
39: KEYSENSE_N(3)
|
||||
40: KEYSENSE_N(4)
|
||||
|
||||
31: KYPD_17
|
||||
32: KYPD_15
|
||||
33: KYPD_13
|
||||
34: KYPD_11
|
||||
35: KYPD_9
|
||||
41: KYPD_MEMO
|
||||
*/
|
||||
|
||||
#define KEYMAP_INDEX(row, col) ((row)*ARRAY_SIZE(swordfish_col_gpios) + (col))
|
||||
|
||||
static const unsigned short swordfish_keymap[ARRAY_SIZE(swordfish_col_gpios) * ARRAY_SIZE(swordfish_row_gpios)] = {
|
||||
[KEYMAP_INDEX(0, 0)] = KEY_5,
|
||||
[KEYMAP_INDEX(0, 1)] = KEY_9,
|
||||
[KEYMAP_INDEX(0, 2)] = 229, /* SOFT1 */
|
||||
[KEYMAP_INDEX(0, 3)] = KEY_6,
|
||||
[KEYMAP_INDEX(0, 4)] = KEY_LEFT,
|
||||
|
||||
[KEYMAP_INDEX(1, 0)] = KEY_0,
|
||||
[KEYMAP_INDEX(1, 1)] = KEY_RIGHT,
|
||||
[KEYMAP_INDEX(1, 2)] = KEY_1,
|
||||
[KEYMAP_INDEX(1, 3)] = 228, /* KEY_SHARP */
|
||||
[KEYMAP_INDEX(1, 4)] = KEY_SEND,
|
||||
|
||||
[KEYMAP_INDEX(2, 0)] = KEY_VOLUMEUP,
|
||||
[KEYMAP_INDEX(2, 1)] = KEY_HOME, /* FA */
|
||||
[KEYMAP_INDEX(2, 2)] = KEY_F8, /* QCHT */
|
||||
[KEYMAP_INDEX(2, 3)] = KEY_F6, /* R+ */
|
||||
[KEYMAP_INDEX(2, 4)] = KEY_F7, /* R- */
|
||||
|
||||
[KEYMAP_INDEX(3, 0)] = KEY_UP,
|
||||
[KEYMAP_INDEX(3, 1)] = KEY_CLEAR,
|
||||
[KEYMAP_INDEX(3, 2)] = KEY_4,
|
||||
[KEYMAP_INDEX(3, 3)] = KEY_MUTE, /* SPKR */
|
||||
[KEYMAP_INDEX(3, 4)] = KEY_2,
|
||||
|
||||
[KEYMAP_INDEX(4, 0)] = 230, /* SOFT2 */
|
||||
[KEYMAP_INDEX(4, 1)] = 232, /* KEY_CENTER */
|
||||
[KEYMAP_INDEX(4, 2)] = KEY_DOWN,
|
||||
[KEYMAP_INDEX(4, 3)] = KEY_BACK, /* FB */
|
||||
[KEYMAP_INDEX(4, 4)] = KEY_8,
|
||||
|
||||
[KEYMAP_INDEX(5, 0)] = KEY_VOLUMEDOWN,
|
||||
[KEYMAP_INDEX(5, 1)] = 227, /* KEY_STAR */
|
||||
[KEYMAP_INDEX(5, 2)] = KEY_MAIL, /* MESG */
|
||||
[KEYMAP_INDEX(5, 3)] = KEY_3,
|
||||
[KEYMAP_INDEX(5, 4)] = KEY_7,
|
||||
|
||||
#if SCAN_FUNCTION_KEYS
|
||||
[KEYMAP_INDEX(6, 0)] = KEY_F5,
|
||||
[KEYMAP_INDEX(6, 1)] = KEY_F4,
|
||||
[KEYMAP_INDEX(6, 2)] = KEY_F3,
|
||||
[KEYMAP_INDEX(6, 3)] = KEY_F2,
|
||||
[KEYMAP_INDEX(6, 4)] = KEY_F1
|
||||
#endif
|
||||
};
|
||||
|
||||
static const unsigned short swordfish_keymap_ffa[ARRAY_SIZE(swordfish_col_gpios) * ARRAY_SIZE(swordfish_row_gpios)] = {
|
||||
/*[KEYMAP_INDEX(0, 0)] = ,*/
|
||||
/*[KEYMAP_INDEX(0, 1)] = ,*/
|
||||
[KEYMAP_INDEX(0, 2)] = KEY_1,
|
||||
[KEYMAP_INDEX(0, 3)] = KEY_SEND,
|
||||
[KEYMAP_INDEX(0, 4)] = KEY_LEFT,
|
||||
|
||||
[KEYMAP_INDEX(1, 0)] = KEY_3,
|
||||
[KEYMAP_INDEX(1, 1)] = KEY_RIGHT,
|
||||
[KEYMAP_INDEX(1, 2)] = KEY_VOLUMEUP,
|
||||
/*[KEYMAP_INDEX(1, 3)] = ,*/
|
||||
[KEYMAP_INDEX(1, 4)] = KEY_6,
|
||||
|
||||
[KEYMAP_INDEX(2, 0)] = KEY_HOME, /* A */
|
||||
[KEYMAP_INDEX(2, 1)] = KEY_BACK, /* B */
|
||||
[KEYMAP_INDEX(2, 2)] = KEY_0,
|
||||
[KEYMAP_INDEX(2, 3)] = 228, /* KEY_SHARP */
|
||||
[KEYMAP_INDEX(2, 4)] = KEY_9,
|
||||
|
||||
[KEYMAP_INDEX(3, 0)] = KEY_UP,
|
||||
[KEYMAP_INDEX(3, 1)] = 232, /* KEY_CENTER */ /* i */
|
||||
[KEYMAP_INDEX(3, 2)] = KEY_4,
|
||||
/*[KEYMAP_INDEX(3, 3)] = ,*/
|
||||
[KEYMAP_INDEX(3, 4)] = KEY_2,
|
||||
|
||||
[KEYMAP_INDEX(4, 0)] = KEY_VOLUMEDOWN,
|
||||
[KEYMAP_INDEX(4, 1)] = KEY_SOUND,
|
||||
[KEYMAP_INDEX(4, 2)] = KEY_DOWN,
|
||||
[KEYMAP_INDEX(4, 3)] = KEY_8,
|
||||
[KEYMAP_INDEX(4, 4)] = KEY_5,
|
||||
|
||||
/*[KEYMAP_INDEX(5, 0)] = ,*/
|
||||
[KEYMAP_INDEX(5, 1)] = 227, /* KEY_STAR */
|
||||
[KEYMAP_INDEX(5, 2)] = 230, /*SOFT2*/ /* 2 */
|
||||
[KEYMAP_INDEX(5, 3)] = KEY_MENU, /* 1 */
|
||||
[KEYMAP_INDEX(5, 4)] = KEY_7,
|
||||
};
|
||||
|
||||
static struct gpio_event_matrix_info swordfish_matrix_info = {
|
||||
.info.func = gpio_event_matrix_func,
|
||||
.keymap = swordfish_keymap,
|
||||
.output_gpios = swordfish_row_gpios,
|
||||
.input_gpios = swordfish_col_gpios,
|
||||
.noutputs = ARRAY_SIZE(swordfish_row_gpios),
|
||||
.ninputs = ARRAY_SIZE(swordfish_col_gpios),
|
||||
.settle_time.tv.nsec = 0,
|
||||
.poll_time.tv.nsec = 20 * NSEC_PER_MSEC,
|
||||
.flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_DRIVE_INACTIVE | GPIOKPF_PRINT_UNMAPPED_KEYS /*| GPIOKPF_PRINT_MAPPED_KEYS*/
|
||||
};
|
||||
|
||||
struct gpio_event_info *swordfish_keypad_info[] = {
|
||||
&swordfish_matrix_info.info
|
||||
};
|
||||
|
||||
static struct gpio_event_platform_data swordfish_keypad_data = {
|
||||
.name = "swordfish_keypad",
|
||||
.info = swordfish_keypad_info,
|
||||
.info_count = ARRAY_SIZE(swordfish_keypad_info)
|
||||
};
|
||||
|
||||
static struct platform_device swordfish_keypad_device = {
|
||||
.name = GPIO_EVENT_DEV_NAME,
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &swordfish_keypad_data,
|
||||
},
|
||||
};
|
||||
|
||||
static int __init swordfish_init_keypad(void)
|
||||
{
|
||||
if (!machine_is_swordfish())
|
||||
return 0;
|
||||
if (swordfish_ffa)
|
||||
swordfish_matrix_info.keymap = swordfish_keymap_ffa;
|
||||
return platform_device_register(&swordfish_keypad_device);
|
||||
}
|
||||
|
||||
device_initcall(swordfish_init_keypad);
|
@ -1,263 +0,0 @@
|
||||
/* linux/arch/arm/mach-msm/board-swordfish-mmc.c
|
||||
*
|
||||
* Copyright (C) 2008 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.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/mmc/host.h>
|
||||
#include <linux/mmc/sdio_ids.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include <asm/gpio.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/mach/mmc.h>
|
||||
|
||||
#include <mach/vreg.h>
|
||||
|
||||
#include "proc_comm.h"
|
||||
#include "devices.h"
|
||||
|
||||
#define FPGA_BASE 0x70000000
|
||||
#define FPGA_SDIO_STATUS 0x280
|
||||
|
||||
static void __iomem *fpga_base;
|
||||
|
||||
#define DEBUG_SWORDFISH_MMC 1
|
||||
|
||||
extern int msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat,
|
||||
unsigned int stat_irq, unsigned long stat_irq_flags);
|
||||
|
||||
static int config_gpio_table(unsigned *table, int len, int enable)
|
||||
{
|
||||
int n;
|
||||
int rc = 0;
|
||||
|
||||
for (n = 0; n < len; n++) {
|
||||
unsigned dis = !enable;
|
||||
unsigned id = table[n];
|
||||
|
||||
if (msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &id, &dis)) {
|
||||
pr_err("%s: id=0x%08x dis=%d\n", __func__, table[n],
|
||||
dis);
|
||||
rc = -1;
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static unsigned sdc1_gpio_table[] = {
|
||||
PCOM_GPIO_CFG(51, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(52, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(53, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(54, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(55, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(56, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA),
|
||||
};
|
||||
|
||||
static unsigned sdc2_gpio_table[] = {
|
||||
PCOM_GPIO_CFG(62, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA),
|
||||
PCOM_GPIO_CFG(63, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(64, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(65, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(66, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(67, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA),
|
||||
};
|
||||
|
||||
static unsigned sdc3_gpio_table[] = {
|
||||
PCOM_GPIO_CFG(88, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA),
|
||||
PCOM_GPIO_CFG(89, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(90, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(91, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(92, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(93, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA),
|
||||
};
|
||||
|
||||
static unsigned sdc4_gpio_table[] = {
|
||||
PCOM_GPIO_CFG(142, 3, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA),
|
||||
PCOM_GPIO_CFG(143, 3, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(144, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(145, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(146, 3, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(147, 3, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA),
|
||||
};
|
||||
|
||||
struct sdc_info {
|
||||
unsigned *table;
|
||||
unsigned len;
|
||||
};
|
||||
|
||||
static struct sdc_info sdcc_gpio_tables[] = {
|
||||
[0] = {
|
||||
.table = sdc1_gpio_table,
|
||||
.len = ARRAY_SIZE(sdc1_gpio_table),
|
||||
},
|
||||
[1] = {
|
||||
.table = sdc2_gpio_table,
|
||||
.len = ARRAY_SIZE(sdc2_gpio_table),
|
||||
},
|
||||
[2] = {
|
||||
.table = sdc3_gpio_table,
|
||||
.len = ARRAY_SIZE(sdc3_gpio_table),
|
||||
},
|
||||
[3] = {
|
||||
.table = sdc4_gpio_table,
|
||||
.len = ARRAY_SIZE(sdc4_gpio_table),
|
||||
},
|
||||
};
|
||||
|
||||
static int swordfish_sdcc_setup_gpio(int dev_id, unsigned enable)
|
||||
{
|
||||
struct sdc_info *info;
|
||||
|
||||
if (dev_id < 1 || dev_id > 4)
|
||||
return -1;
|
||||
|
||||
info = &sdcc_gpio_tables[dev_id - 1];
|
||||
return config_gpio_table(info->table, info->len, enable);
|
||||
}
|
||||
|
||||
struct mmc_vdd_xlat {
|
||||
int mask;
|
||||
int level;
|
||||
};
|
||||
|
||||
static struct mmc_vdd_xlat mmc_vdd_table[] = {
|
||||
{ MMC_VDD_165_195, 1800 },
|
||||
{ MMC_VDD_20_21, 2050 },
|
||||
{ MMC_VDD_21_22, 2150 },
|
||||
{ MMC_VDD_22_23, 2250 },
|
||||
{ MMC_VDD_23_24, 2350 },
|
||||
{ MMC_VDD_24_25, 2450 },
|
||||
{ MMC_VDD_25_26, 2550 },
|
||||
{ MMC_VDD_26_27, 2650 },
|
||||
{ MMC_VDD_27_28, 2750 },
|
||||
{ MMC_VDD_28_29, 2850 },
|
||||
{ MMC_VDD_29_30, 2950 },
|
||||
};
|
||||
|
||||
static struct vreg *vreg_sdcc;
|
||||
static unsigned int vreg_sdcc_enabled;
|
||||
static unsigned int sdcc_vdd = 0xffffffff;
|
||||
|
||||
static uint32_t sdcc_translate_vdd(struct device *dev, unsigned int vdd)
|
||||
{
|
||||
int i;
|
||||
int rc = 0;
|
||||
struct platform_device *pdev;
|
||||
|
||||
pdev = container_of(dev, struct platform_device, dev);
|
||||
BUG_ON(!vreg_sdcc);
|
||||
|
||||
if (vdd == sdcc_vdd)
|
||||
return 0;
|
||||
|
||||
sdcc_vdd = vdd;
|
||||
|
||||
/* enable/disable the signals to the slot */
|
||||
swordfish_sdcc_setup_gpio(pdev->id, !!vdd);
|
||||
|
||||
/* power down */
|
||||
if (vdd == 0) {
|
||||
#if DEBUG_SWORDFISH_MMC
|
||||
pr_info("%s: disable sdcc power\n", __func__);
|
||||
#endif
|
||||
vreg_disable(vreg_sdcc);
|
||||
vreg_sdcc_enabled = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!vreg_sdcc_enabled) {
|
||||
rc = vreg_enable(vreg_sdcc);
|
||||
if (rc)
|
||||
pr_err("%s: Error enabling vreg (%d)\n", __func__, rc);
|
||||
vreg_sdcc_enabled = 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(mmc_vdd_table); i++) {
|
||||
if (mmc_vdd_table[i].mask != (1 << vdd))
|
||||
continue;
|
||||
#if DEBUG_SWORDFISH_MMC
|
||||
pr_info("%s: Setting level to %u\n", __func__,
|
||||
mmc_vdd_table[i].level);
|
||||
#endif
|
||||
rc = vreg_set_level(vreg_sdcc, mmc_vdd_table[i].level);
|
||||
if (rc)
|
||||
pr_err("%s: Error setting vreg level (%d)\n", __func__, rc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
pr_err("%s: Invalid VDD %d specified\n", __func__, vdd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned int swordfish_sdcc_slot_status (struct device *dev)
|
||||
{
|
||||
struct platform_device *pdev;
|
||||
uint32_t sdcc_stat;
|
||||
|
||||
pdev = container_of(dev, struct platform_device, dev);
|
||||
|
||||
sdcc_stat = readl(fpga_base + FPGA_SDIO_STATUS);
|
||||
|
||||
/* bit 0 - sdcc1 crd_det
|
||||
* bit 1 - sdcc1 wr_prt
|
||||
* bit 2 - sdcc2 crd_det
|
||||
* bit 3 - sdcc2 wr_prt
|
||||
* etc...
|
||||
*/
|
||||
|
||||
/* crd_det is active low */
|
||||
return !(sdcc_stat & (1 << ((pdev->id - 1) << 1)));
|
||||
}
|
||||
|
||||
#define SWORDFISH_MMC_VDD (MMC_VDD_165_195 | MMC_VDD_20_21 | MMC_VDD_21_22 \
|
||||
| MMC_VDD_22_23 | MMC_VDD_23_24 | MMC_VDD_24_25 \
|
||||
| MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 \
|
||||
| MMC_VDD_28_29 | MMC_VDD_29_30)
|
||||
|
||||
static struct mmc_platform_data swordfish_sdcc_data = {
|
||||
.ocr_mask = SWORDFISH_MMC_VDD/*MMC_VDD_27_28 | MMC_VDD_28_29*/,
|
||||
.status = swordfish_sdcc_slot_status,
|
||||
.translate_vdd = sdcc_translate_vdd,
|
||||
};
|
||||
|
||||
int __init swordfish_init_mmc(void)
|
||||
{
|
||||
vreg_sdcc_enabled = 0;
|
||||
vreg_sdcc = vreg_get(NULL, "gp5");
|
||||
if (IS_ERR(vreg_sdcc)) {
|
||||
pr_err("%s: vreg get failed (%ld)\n",
|
||||
__func__, PTR_ERR(vreg_sdcc));
|
||||
return PTR_ERR(vreg_sdcc);
|
||||
}
|
||||
|
||||
fpga_base = ioremap(FPGA_BASE, SZ_4K);
|
||||
if (!fpga_base) {
|
||||
pr_err("%s: Can't ioremap FPGA base address (0x%08x)\n",
|
||||
__func__, FPGA_BASE);
|
||||
vreg_put(vreg_sdcc);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
msm_add_sdcc(1, &swordfish_sdcc_data, 0, 0);
|
||||
msm_add_sdcc(4, &swordfish_sdcc_data, 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,116 +0,0 @@
|
||||
/* linux/arch/arm/mach-msm/board-swordfish-panel.c
|
||||
*
|
||||
* Copyright (c) 2009 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.
|
||||
*
|
||||
* Author: Dima Zavin <dima@android.com>
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/err.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include <mach/msm_fb.h>
|
||||
|
||||
#include "board-swordfish.h"
|
||||
#include "devices.h"
|
||||
|
||||
#define CLK_NS_TO_RATE(ns) (1000000000UL / (ns))
|
||||
|
||||
int swordfish_panel_blank(struct msm_lcdc_panel_ops *ops)
|
||||
{
|
||||
/* TODO: Turn backlight off? */
|
||||
return 0;
|
||||
}
|
||||
|
||||
int swordfish_panel_unblank(struct msm_lcdc_panel_ops *ops)
|
||||
{
|
||||
/* TODO: Turn backlight on? */
|
||||
return 0;
|
||||
}
|
||||
|
||||
int swordfish_panel_init(struct msm_lcdc_panel_ops *ops)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct resource resources_msm_fb[] = {
|
||||
{
|
||||
.start = MSM_FB_BASE,
|
||||
.end = MSM_FB_BASE + MSM_FB_SIZE,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
};
|
||||
|
||||
static struct msm_lcdc_timing swordfish_lcdc_timing = {
|
||||
.clk_rate = CLK_NS_TO_RATE(26),
|
||||
.hsync_pulse_width = 60,
|
||||
.hsync_back_porch = 81,
|
||||
.hsync_front_porch = 81,
|
||||
.hsync_skew = 0,
|
||||
.vsync_pulse_width = 2,
|
||||
.vsync_back_porch = 20,
|
||||
.vsync_front_porch = 27,
|
||||
.vsync_act_low = 0,
|
||||
.hsync_act_low = 0,
|
||||
.den_act_low = 0,
|
||||
};
|
||||
|
||||
static struct msm_fb_data swordfish_lcdc_fb_data = {
|
||||
.xres = 800,
|
||||
.yres = 480,
|
||||
.width = 94,
|
||||
.height = 57,
|
||||
.output_format = 0,
|
||||
};
|
||||
|
||||
static struct msm_lcdc_panel_ops swordfish_lcdc_panel_ops = {
|
||||
.init = swordfish_panel_init,
|
||||
.blank = swordfish_panel_blank,
|
||||
.unblank = swordfish_panel_unblank,
|
||||
};
|
||||
|
||||
static struct msm_lcdc_platform_data swordfish_lcdc_platform_data = {
|
||||
.panel_ops = &swordfish_lcdc_panel_ops,
|
||||
.timing = &swordfish_lcdc_timing,
|
||||
.fb_id = 0,
|
||||
.fb_data = &swordfish_lcdc_fb_data,
|
||||
.fb_resource = &resources_msm_fb[0],
|
||||
};
|
||||
|
||||
static struct platform_device swordfish_lcdc_device = {
|
||||
.name = "msm_mdp_lcdc",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &swordfish_lcdc_platform_data,
|
||||
},
|
||||
};
|
||||
|
||||
int __init swordfish_init_panel(void)
|
||||
{
|
||||
int rc;
|
||||
if (!machine_is_swordfish())
|
||||
return 0;
|
||||
|
||||
if ((rc = platform_device_register(&msm_device_mdp)) != 0)
|
||||
return rc;
|
||||
|
||||
if ((rc = platform_device_register(&swordfish_lcdc_device)) != 0)
|
||||
return rc;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
device_initcall(swordfish_init_panel);
|
@ -1,365 +0,0 @@
|
||||
/* linux/arch/arm/mach-msm/board-swordfish.c
|
||||
*
|
||||
* Copyright (C) 2009 Google, Inc.
|
||||
* Author: Brian Swetland <swetland@google.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/android_pmem.h>
|
||||
#include <linux/msm_kgsl.h>
|
||||
|
||||
#include <mach/hardware.h>
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/mach/map.h>
|
||||
#include <asm/setup.h>
|
||||
|
||||
#include <mach/board.h>
|
||||
#include <mach/irqs.h>
|
||||
#include <mach/msm_iomap.h>
|
||||
#include <mach/msm_hsusb.h>
|
||||
#include <mach/msm_ts.h>
|
||||
#include <linux/usb/android_composite.h>
|
||||
|
||||
#include "board-swordfish.h"
|
||||
#include "devices.h"
|
||||
#include "proc_comm.h"
|
||||
|
||||
extern int swordfish_init_mmc(void);
|
||||
|
||||
static struct resource smc91x_resources[] = {
|
||||
[0] = {
|
||||
.start = 0x70000300,
|
||||
.end = 0x70000400,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
[1] = {
|
||||
.start = MSM_GPIO_TO_INT(156),
|
||||
.end = MSM_GPIO_TO_INT(156),
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device smc91x_device = {
|
||||
.name = "smc91x",
|
||||
.id = 0,
|
||||
.num_resources = ARRAY_SIZE(smc91x_resources),
|
||||
.resource = smc91x_resources,
|
||||
};
|
||||
|
||||
static int swordfish_phy_init_seq[] = {
|
||||
0x0C, 0x31,
|
||||
0x1D, 0x0D,
|
||||
0x1D, 0x10,
|
||||
-1
|
||||
};
|
||||
|
||||
static void swordfish_usb_phy_reset(void)
|
||||
{
|
||||
u32 id;
|
||||
int ret;
|
||||
|
||||
id = PCOM_CLKRGM_APPS_RESET_USB_PHY;
|
||||
ret = msm_proc_comm(PCOM_CLK_REGIME_SEC_RESET_ASSERT, &id, NULL);
|
||||
if (ret) {
|
||||
pr_err("%s: Cannot assert (%d)\n", __func__, ret);
|
||||
return;
|
||||
}
|
||||
|
||||
msleep(1);
|
||||
|
||||
id = PCOM_CLKRGM_APPS_RESET_USB_PHY;
|
||||
ret = msm_proc_comm(PCOM_CLK_REGIME_SEC_RESET_DEASSERT, &id, NULL);
|
||||
if (ret) {
|
||||
pr_err("%s: Cannot assert (%d)\n", __func__, ret);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void swordfish_usb_hw_reset(bool enable)
|
||||
{
|
||||
u32 id;
|
||||
int ret;
|
||||
u32 func;
|
||||
|
||||
id = PCOM_CLKRGM_APPS_RESET_USBH;
|
||||
if (enable)
|
||||
func = PCOM_CLK_REGIME_SEC_RESET_ASSERT;
|
||||
else
|
||||
func = PCOM_CLK_REGIME_SEC_RESET_DEASSERT;
|
||||
ret = msm_proc_comm(func, &id, NULL);
|
||||
if (ret)
|
||||
pr_err("%s: Cannot set reset to %d (%d)\n", __func__, enable,
|
||||
ret);
|
||||
}
|
||||
|
||||
|
||||
static struct msm_hsusb_platform_data msm_hsusb_pdata = {
|
||||
.phy_init_seq = swordfish_phy_init_seq,
|
||||
.phy_reset = swordfish_usb_phy_reset,
|
||||
.hw_reset = swordfish_usb_hw_reset,
|
||||
};
|
||||
|
||||
static struct usb_mass_storage_platform_data mass_storage_pdata = {
|
||||
.nluns = 1,
|
||||
.vendor = "Qualcomm",
|
||||
.product = "Swordfish",
|
||||
.release = 0x0100,
|
||||
};
|
||||
|
||||
static struct platform_device usb_mass_storage_device = {
|
||||
.name = "usb_mass_storage",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &mass_storage_pdata,
|
||||
},
|
||||
};
|
||||
|
||||
static struct resource msm_kgsl_resources[] = {
|
||||
{
|
||||
.name = "kgsl_reg_memory",
|
||||
.start = MSM_GPU_REG_PHYS,
|
||||
.end = MSM_GPU_REG_PHYS + MSM_GPU_REG_SIZE - 1,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
{
|
||||
.name = "kgsl_phys_memory",
|
||||
.start = MSM_GPU_MEM_BASE,
|
||||
.end = MSM_GPU_MEM_BASE + MSM_GPU_MEM_SIZE - 1,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
{
|
||||
.start = INT_GRAPHICS,
|
||||
.end = INT_GRAPHICS,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device msm_kgsl_device = {
|
||||
.name = "kgsl",
|
||||
.id = -1,
|
||||
.resource = msm_kgsl_resources,
|
||||
.num_resources = ARRAY_SIZE(msm_kgsl_resources),
|
||||
};
|
||||
|
||||
static struct android_pmem_platform_data mdp_pmem_pdata = {
|
||||
.name = "pmem",
|
||||
.start = MSM_PMEM_MDP_BASE,
|
||||
.size = MSM_PMEM_MDP_SIZE,
|
||||
.no_allocator = 0,
|
||||
.cached = 1,
|
||||
};
|
||||
|
||||
static struct android_pmem_platform_data android_pmem_gpu0_pdata = {
|
||||
.name = "pmem_gpu0",
|
||||
.start = MSM_PMEM_GPU0_BASE,
|
||||
.size = MSM_PMEM_GPU0_SIZE,
|
||||
.no_allocator = 0,
|
||||
.cached = 0,
|
||||
};
|
||||
|
||||
static struct android_pmem_platform_data android_pmem_gpu1_pdata = {
|
||||
.name = "pmem_gpu1",
|
||||
.start = MSM_PMEM_GPU1_BASE,
|
||||
.size = MSM_PMEM_GPU1_SIZE,
|
||||
.no_allocator = 0,
|
||||
.cached = 0,
|
||||
};
|
||||
|
||||
static struct android_pmem_platform_data android_pmem_adsp_pdata = {
|
||||
.name = "pmem_adsp",
|
||||
.start = MSM_PMEM_ADSP_BASE,
|
||||
.size = MSM_PMEM_ADSP_SIZE,
|
||||
.no_allocator = 0,
|
||||
.cached = 0,
|
||||
};
|
||||
|
||||
static struct platform_device android_pmem_mdp_device = {
|
||||
.name = "android_pmem",
|
||||
.id = 0,
|
||||
.dev = {
|
||||
.platform_data = &mdp_pmem_pdata
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device android_pmem_adsp_device = {
|
||||
.name = "android_pmem",
|
||||
.id = 1,
|
||||
.dev = {
|
||||
.platform_data = &android_pmem_adsp_pdata,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device android_pmem_gpu0_device = {
|
||||
.name = "android_pmem",
|
||||
.id = 2,
|
||||
.dev = {
|
||||
.platform_data = &android_pmem_gpu0_pdata,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device android_pmem_gpu1_device = {
|
||||
.name = "android_pmem",
|
||||
.id = 3,
|
||||
.dev = {
|
||||
.platform_data = &android_pmem_gpu1_pdata,
|
||||
},
|
||||
};
|
||||
|
||||
static char *usb_functions[] = { "usb_mass_storage" };
|
||||
static char *usb_functions_adb[] = { "usb_mass_storage", "adb" };
|
||||
|
||||
static struct android_usb_product usb_products[] = {
|
||||
{
|
||||
.product_id = 0x0c01,
|
||||
.num_functions = ARRAY_SIZE(usb_functions),
|
||||
.functions = usb_functions,
|
||||
},
|
||||
{
|
||||
.product_id = 0x0c02,
|
||||
.num_functions = ARRAY_SIZE(usb_functions_adb),
|
||||
.functions = usb_functions_adb,
|
||||
},
|
||||
};
|
||||
|
||||
static struct android_usb_platform_data android_usb_pdata = {
|
||||
.vendor_id = 0x18d1,
|
||||
.product_id = 0x0d01,
|
||||
.version = 0x0100,
|
||||
.serial_number = "42",
|
||||
.product_name = "Swordfishdroid",
|
||||
.manufacturer_name = "Qualcomm",
|
||||
.num_products = ARRAY_SIZE(usb_products),
|
||||
.products = usb_products,
|
||||
.num_functions = ARRAY_SIZE(usb_functions_adb),
|
||||
.functions = usb_functions_adb,
|
||||
};
|
||||
|
||||
static struct platform_device android_usb_device = {
|
||||
.name = "android_usb",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &android_usb_pdata,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device fish_battery_device = {
|
||||
.name = "fish_battery",
|
||||
};
|
||||
|
||||
static struct msm_ts_platform_data swordfish_ts_pdata = {
|
||||
.min_x = 296,
|
||||
.max_x = 3800,
|
||||
.min_y = 296,
|
||||
.max_y = 3800,
|
||||
.min_press = 0,
|
||||
.max_press = 256,
|
||||
.inv_x = 4096,
|
||||
.inv_y = 4096,
|
||||
};
|
||||
|
||||
static struct platform_device *devices[] __initdata = {
|
||||
#if !defined(CONFIG_MSM_SERIAL_DEBUGGER)
|
||||
&msm_device_uart3,
|
||||
#endif
|
||||
&msm_device_smd,
|
||||
&msm_device_nand,
|
||||
&msm_device_hsusb,
|
||||
&usb_mass_storage_device,
|
||||
&android_usb_device,
|
||||
&fish_battery_device,
|
||||
&smc91x_device,
|
||||
&msm_device_touchscreen,
|
||||
&android_pmem_mdp_device,
|
||||
&android_pmem_adsp_device,
|
||||
&android_pmem_gpu0_device,
|
||||
&android_pmem_gpu1_device,
|
||||
&msm_kgsl_device,
|
||||
};
|
||||
|
||||
extern struct sys_timer msm_timer;
|
||||
|
||||
static struct msm_acpu_clock_platform_data swordfish_clock_data = {
|
||||
.acpu_switch_time_us = 20,
|
||||
.max_speed_delta_khz = 256000,
|
||||
.vdd_switch_time_us = 62,
|
||||
.power_collapse_khz = 128000000,
|
||||
.wait_for_irq_khz = 128000000,
|
||||
};
|
||||
|
||||
void msm_serial_debug_init(unsigned int base, int irq,
|
||||
struct device *clk_device, int signal_irq);
|
||||
|
||||
static void __init swordfish_init(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
msm_acpu_clock_init(&swordfish_clock_data);
|
||||
#if defined(CONFIG_MSM_SERIAL_DEBUGGER)
|
||||
msm_serial_debug_init(MSM_UART3_PHYS, INT_UART3,
|
||||
&msm_device_uart3.dev, 1);
|
||||
#endif
|
||||
msm_device_hsusb.dev.platform_data = &msm_hsusb_pdata;
|
||||
msm_device_touchscreen.dev.platform_data = &swordfish_ts_pdata;
|
||||
platform_add_devices(devices, ARRAY_SIZE(devices));
|
||||
msm_hsusb_set_vbus_state(1);
|
||||
rc = swordfish_init_mmc();
|
||||
if (rc)
|
||||
pr_crit("%s: MMC init failure (%d)\n", __func__, rc);
|
||||
}
|
||||
|
||||
static void __init swordfish_fixup(struct machine_desc *desc, struct tag *tags,
|
||||
char **cmdline, struct meminfo *mi)
|
||||
{
|
||||
mi->nr_banks = 1;
|
||||
mi->bank[0].start = PHYS_OFFSET;
|
||||
mi->bank[0].node = PHYS_TO_NID(PHYS_OFFSET);
|
||||
mi->bank[0].size = (101*1024*1024);
|
||||
}
|
||||
|
||||
static void __init swordfish_map_io(void)
|
||||
{
|
||||
msm_map_common_io();
|
||||
msm_clock_init();
|
||||
}
|
||||
|
||||
MACHINE_START(SWORDFISH, "Swordfish Board (QCT SURF8250)")
|
||||
#ifdef CONFIG_MSM_DEBUG_UART
|
||||
.phys_io = MSM_DEBUG_UART_PHYS,
|
||||
.io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
|
||||
#endif
|
||||
.boot_params = 0x20000100,
|
||||
.fixup = swordfish_fixup,
|
||||
.map_io = swordfish_map_io,
|
||||
.init_irq = msm_init_irq,
|
||||
.init_machine = swordfish_init,
|
||||
.timer = &msm_timer,
|
||||
MACHINE_END
|
||||
|
||||
MACHINE_START(QSD8X50_FFA, "qsd8x50 FFA Board (QCT FFA8250)")
|
||||
#ifdef CONFIG_MSM_DEBUG_UART
|
||||
.phys_io = MSM_DEBUG_UART_PHYS,
|
||||
.io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
|
||||
#endif
|
||||
.boot_params = 0x20000100,
|
||||
.fixup = swordfish_fixup,
|
||||
.map_io = swordfish_map_io,
|
||||
.init_irq = msm_init_irq,
|
||||
.init_machine = swordfish_init,
|
||||
.timer = &msm_timer,
|
||||
MACHINE_END
|
@ -1,48 +0,0 @@
|
||||
/* arch/arm/mach-msm/board-swordfish.h
|
||||
*
|
||||
* Copyright (C) 2009 Google Inc.
|
||||
* Author: Dima Zavin <dima@android.com>
|
||||
*
|
||||
* 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 __ARCH_ARM_MACH_MSM_BOARD_SWORDFISH_H
|
||||
#define __ARCH_ARM_MACH_MSM_BOARD_SWORDFISH_H
|
||||
|
||||
#include <mach/board.h>
|
||||
|
||||
#define MSM_SMI_BASE 0x02B00000
|
||||
#define MSM_SMI_SIZE 0x01500000
|
||||
|
||||
#define MSM_PMEM_MDP_BASE 0x03000000
|
||||
#define MSM_PMEM_MDP_SIZE 0x01000000
|
||||
|
||||
#define MSM_EBI1_BASE 0x20000000
|
||||
#define MSM_EBI1_SIZE 0x0E000000
|
||||
|
||||
#define MSM_PMEM_ADSP_BASE 0x2A300000
|
||||
#define MSM_PMEM_ADSP_SIZE 0x02000000
|
||||
|
||||
#define MSM_PMEM_GPU1_BASE 0x2C300000
|
||||
#define MSM_PMEM_GPU1_SIZE 0x01400000
|
||||
|
||||
#define MSM_PMEM_GPU0_BASE 0x2D700000
|
||||
#define MSM_PMEM_GPU0_SIZE 0x00400000
|
||||
|
||||
#define MSM_GPU_MEM_BASE 0x2DB00000
|
||||
#define MSM_GPU_MEM_SIZE 0x00200000
|
||||
|
||||
#define MSM_RAM_CONSOLE_BASE 0x2DD00000
|
||||
#define MSM_RAM_CONSOLE_SIZE 0x00040000
|
||||
|
||||
#define MSM_FB_BASE 0x2DE00000
|
||||
#define MSM_FB_SIZE 0x00200000
|
||||
|
||||
#endif /* __ARCH_ARM_MACH_MSM_BOARD_SWORDFISH_H */
|
@ -1,305 +0,0 @@
|
||||
/* arch/arm/mach-msm/board-trout-gpio.c
|
||||
*
|
||||
* Copyright (C) 2008 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/sysdev.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/gpio.h>
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include <mach/htc_pwrsink.h>
|
||||
|
||||
#include "board-trout.h"
|
||||
#include "gpio_chip.h"
|
||||
|
||||
#undef MODULE_PARAM_PREFIX
|
||||
#define MODULE_PARAM_PREFIX "board_trout."
|
||||
|
||||
static uint cpld_usb_h2w_sw;
|
||||
module_param_named(usb_h2w_sw, cpld_usb_h2w_sw, uint, 0);
|
||||
|
||||
static uint8_t trout_cpld_shadow[4] = {
|
||||
#if defined(CONFIG_MSM_DEBUG_UART1)
|
||||
/* H2W pins <-> UART1 */
|
||||
[0] = 0x40, // for serial debug, low current
|
||||
#else
|
||||
/* H2W pins <-> UART3, Bluetooth <-> UART1 */
|
||||
[0] = 0x80, // for serial debug, low current
|
||||
#endif
|
||||
[1] = 0x04, // I2C_PULL
|
||||
[3] = 0x04, // mmdi 32k en
|
||||
};
|
||||
static uint8_t trout_int_mask[2] = {
|
||||
[0] = 0xff, /* mask all interrupts */
|
||||
[1] = 0xff,
|
||||
};
|
||||
static uint8_t trout_sleep_int_mask[] = {
|
||||
[0] = 0xff,
|
||||
[1] = 0xff,
|
||||
};
|
||||
static int trout_suspended;
|
||||
|
||||
static int trout_gpio_read(struct gpio_chip *chip, unsigned n)
|
||||
{
|
||||
uint8_t b;
|
||||
int reg;
|
||||
if (n >= TROUT_GPIO_VIRTUAL_BASE)
|
||||
n += TROUT_GPIO_VIRTUAL_TO_REAL_OFFSET;
|
||||
b = 1U << (n & 7);
|
||||
reg = (n & 0x78) >> 2; // assumes base is 128
|
||||
return !!(readb(TROUT_CPLD_BASE + reg) & b);
|
||||
}
|
||||
|
||||
static void update_pwrsink(unsigned gpio, unsigned on)
|
||||
{
|
||||
switch(gpio) {
|
||||
case TROUT_GPIO_UI_LED_EN:
|
||||
htc_pwrsink_set(PWRSINK_LED_BUTTON, on ? 100 : 0);
|
||||
break;
|
||||
case TROUT_GPIO_QTKEY_LED_EN:
|
||||
htc_pwrsink_set(PWRSINK_LED_KEYBOARD, on ? 100 : 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t trout_gpio_write_shadow(unsigned n, unsigned on)
|
||||
{
|
||||
uint8_t b = 1U << (n & 7);
|
||||
int reg = (n & 0x78) >> 2; // assumes base is 128
|
||||
|
||||
if(on)
|
||||
return trout_cpld_shadow[reg >> 1] |= b;
|
||||
else
|
||||
return trout_cpld_shadow[reg >> 1] &= ~b;
|
||||
}
|
||||
|
||||
static int trout_gpio_write(struct gpio_chip *chip, unsigned n, unsigned on)
|
||||
{
|
||||
int reg = (n & 0x78) >> 2; // assumes base is 128
|
||||
unsigned long flags;
|
||||
uint8_t reg_val;
|
||||
|
||||
if ((reg >> 1) >= ARRAY_SIZE(trout_cpld_shadow)) {
|
||||
printk(KERN_ERR "trout_gpio_write called on input %d\n", n);
|
||||
return -ENOTSUPP;
|
||||
}
|
||||
|
||||
local_irq_save(flags);
|
||||
update_pwrsink(n, on);
|
||||
reg_val = trout_gpio_write_shadow(n, on);
|
||||
writeb(reg_val, TROUT_CPLD_BASE + reg);
|
||||
local_irq_restore(flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int trout_gpio_configure(struct gpio_chip *chip, unsigned int gpio, unsigned long flags)
|
||||
{
|
||||
if(flags & (GPIOF_OUTPUT_LOW | GPIOF_OUTPUT_HIGH))
|
||||
trout_gpio_write(chip, gpio, flags & GPIOF_OUTPUT_HIGH);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int trout_gpio_get_irq_num(struct gpio_chip *chip, unsigned int gpio, unsigned int *irqp, unsigned long *irqnumflagsp)
|
||||
{
|
||||
if ((gpio < TROUT_GPIO_BANK0_FIRST_INT_SOURCE ||
|
||||
gpio > TROUT_GPIO_BANK0_LAST_INT_SOURCE) &&
|
||||
(gpio < TROUT_GPIO_BANK1_FIRST_INT_SOURCE ||
|
||||
gpio > TROUT_GPIO_BANK1_LAST_INT_SOURCE))
|
||||
return -ENOENT;
|
||||
*irqp = TROUT_GPIO_TO_INT(gpio);
|
||||
if(irqnumflagsp)
|
||||
*irqnumflagsp = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void trout_gpio_irq_ack(unsigned int irq)
|
||||
{
|
||||
int bank = TROUT_INT_TO_BANK(irq);
|
||||
uint8_t mask = TROUT_INT_TO_MASK(irq);
|
||||
int reg = TROUT_BANK_TO_STAT_REG(bank);
|
||||
/*printk(KERN_INFO "trout_gpio_irq_ack irq %d\n", irq);*/
|
||||
writeb(mask, TROUT_CPLD_BASE + reg);
|
||||
}
|
||||
|
||||
static void trout_gpio_irq_mask(unsigned int irq)
|
||||
{
|
||||
unsigned long flags;
|
||||
uint8_t reg_val;
|
||||
int bank = TROUT_INT_TO_BANK(irq);
|
||||
uint8_t mask = TROUT_INT_TO_MASK(irq);
|
||||
int reg = TROUT_BANK_TO_MASK_REG(bank);
|
||||
|
||||
local_irq_save(flags);
|
||||
reg_val = trout_int_mask[bank] |= mask;
|
||||
/*printk(KERN_INFO "trout_gpio_irq_mask irq %d => %d:%02x\n",
|
||||
irq, bank, reg_val);*/
|
||||
if (!trout_suspended)
|
||||
writeb(reg_val, TROUT_CPLD_BASE + reg);
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
|
||||
static void trout_gpio_irq_unmask(unsigned int irq)
|
||||
{
|
||||
unsigned long flags;
|
||||
uint8_t reg_val;
|
||||
int bank = TROUT_INT_TO_BANK(irq);
|
||||
uint8_t mask = TROUT_INT_TO_MASK(irq);
|
||||
int reg = TROUT_BANK_TO_MASK_REG(bank);
|
||||
|
||||
local_irq_save(flags);
|
||||
reg_val = trout_int_mask[bank] &= ~mask;
|
||||
/*printk(KERN_INFO "trout_gpio_irq_unmask irq %d => %d:%02x\n",
|
||||
irq, bank, reg_val);*/
|
||||
if (!trout_suspended)
|
||||
writeb(reg_val, TROUT_CPLD_BASE + reg);
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
|
||||
int trout_gpio_irq_set_wake(unsigned int irq, unsigned int on)
|
||||
{
|
||||
unsigned long flags;
|
||||
int bank = TROUT_INT_TO_BANK(irq);
|
||||
uint8_t mask = TROUT_INT_TO_MASK(irq);
|
||||
|
||||
local_irq_save(flags);
|
||||
if(on)
|
||||
trout_sleep_int_mask[bank] &= ~mask;
|
||||
else
|
||||
trout_sleep_int_mask[bank] |= mask;
|
||||
local_irq_restore(flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void trout_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
|
||||
{
|
||||
int j, m;
|
||||
unsigned v;
|
||||
int bank;
|
||||
int stat_reg;
|
||||
int int_base = TROUT_INT_START;
|
||||
uint8_t int_mask;
|
||||
|
||||
for (bank = 0; bank < 2; bank++) {
|
||||
stat_reg = TROUT_BANK_TO_STAT_REG(bank);
|
||||
v = readb(TROUT_CPLD_BASE + stat_reg);
|
||||
int_mask = trout_int_mask[bank];
|
||||
if (v & int_mask) {
|
||||
writeb(v & int_mask, TROUT_CPLD_BASE + stat_reg);
|
||||
printk(KERN_ERR "trout_gpio_irq_handler: got masked "
|
||||
"interrupt: %d:%02x\n", bank, v & int_mask);
|
||||
}
|
||||
v &= ~int_mask;
|
||||
while (v) {
|
||||
m = v & -v;
|
||||
j = fls(m) - 1;
|
||||
/*printk(KERN_INFO "msm_gpio_irq_handler %d:%02x %02x b"
|
||||
"it %d irq %d\n", bank, v, m, j, int_base + j);*/
|
||||
v &= ~m;
|
||||
generic_handle_irq(int_base + j);
|
||||
}
|
||||
int_base += TROUT_INT_BANK0_COUNT;
|
||||
}
|
||||
desc->chip->ack(irq);
|
||||
}
|
||||
|
||||
static int trout_sysdev_suspend(struct sys_device *dev, pm_message_t state)
|
||||
{
|
||||
trout_suspended = 1;
|
||||
writeb(trout_sleep_int_mask[0],
|
||||
TROUT_CPLD_BASE + TROUT_GPIO_INT_MASK0_REG);
|
||||
writeb(trout_sleep_int_mask[1],
|
||||
TROUT_CPLD_BASE + TROUT_GPIO_INT_MASK1_REG);
|
||||
writeb(trout_sleep_int_mask[0],
|
||||
TROUT_CPLD_BASE + TROUT_GPIO_INT_STAT0_REG);
|
||||
writeb(trout_sleep_int_mask[1],
|
||||
TROUT_CPLD_BASE + TROUT_GPIO_INT_STAT1_REG);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int trout_sysdev_resume(struct sys_device *dev)
|
||||
{
|
||||
writeb(trout_int_mask[0], TROUT_CPLD_BASE + TROUT_GPIO_INT_MASK0_REG);
|
||||
writeb(trout_int_mask[1], TROUT_CPLD_BASE + TROUT_GPIO_INT_MASK1_REG);
|
||||
trout_suspended = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct irq_chip trout_gpio_irq_chip = {
|
||||
.name = "troutgpio",
|
||||
.ack = trout_gpio_irq_ack,
|
||||
.mask = trout_gpio_irq_mask,
|
||||
.unmask = trout_gpio_irq_unmask,
|
||||
.set_wake = trout_gpio_irq_set_wake,
|
||||
//.set_type = trout_gpio_irq_set_type,
|
||||
};
|
||||
|
||||
static struct gpio_chip trout_gpio_chip = {
|
||||
.start = TROUT_GPIO_START,
|
||||
.end = TROUT_GPIO_END,
|
||||
.configure = trout_gpio_configure,
|
||||
.get_irq_num = trout_gpio_get_irq_num,
|
||||
.read = trout_gpio_read,
|
||||
.write = trout_gpio_write,
|
||||
// .read_detect_status = trout_gpio_read_detect_status,
|
||||
// .clear_detect_status = trout_gpio_clear_detect_status
|
||||
};
|
||||
|
||||
struct sysdev_class trout_sysdev_class = {
|
||||
.name = "troutgpio_irq",
|
||||
.suspend = trout_sysdev_suspend,
|
||||
.resume = trout_sysdev_resume,
|
||||
};
|
||||
|
||||
static struct sys_device trout_irq_device = {
|
||||
.cls = &trout_sysdev_class,
|
||||
};
|
||||
|
||||
static int __init trout_init_gpio(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!machine_is_trout())
|
||||
return 0;
|
||||
|
||||
/* adjust GPIOs based on bootloader request */
|
||||
pr_info("trout_init_gpio: cpld_usb_hw2_sw = %d\n", cpld_usb_h2w_sw);
|
||||
trout_gpio_write_shadow(TROUT_GPIO_USB_H2W_SW, cpld_usb_h2w_sw);
|
||||
|
||||
for(i = 0; i < ARRAY_SIZE(trout_cpld_shadow); i++)
|
||||
writeb(trout_cpld_shadow[i], TROUT_CPLD_BASE + i * 2);
|
||||
|
||||
for(i = TROUT_INT_START; i <= TROUT_INT_END; i++) {
|
||||
set_irq_chip(i, &trout_gpio_irq_chip);
|
||||
set_irq_handler(i, handle_edge_irq);
|
||||
set_irq_flags(i, IRQF_VALID);
|
||||
}
|
||||
|
||||
register_gpio_chip(&trout_gpio_chip);
|
||||
|
||||
set_irq_type(MSM_GPIO_TO_INT(17), IRQF_TRIGGER_HIGH);
|
||||
set_irq_chained_handler(MSM_GPIO_TO_INT(17), trout_gpio_irq_handler);
|
||||
set_irq_wake(MSM_GPIO_TO_INT(17), 1);
|
||||
|
||||
if(sysdev_class_register(&trout_sysdev_class) == 0)
|
||||
sysdev_register(&trout_irq_device);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
postcore_initcall(trout_init_gpio);
|
@ -1,345 +0,0 @@
|
||||
/* arch/arm/mach-msm/board-trout-keypad.c
|
||||
*
|
||||
* Copyright (C) 2008 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/gpio_event.h>
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include "board-trout.h"
|
||||
|
||||
static char *keycaps = "--qwerty";
|
||||
#undef MODULE_PARAM_PREFIX
|
||||
#define MODULE_PARAM_PREFIX "board_trout."
|
||||
module_param_named(keycaps, keycaps, charp, 0);
|
||||
|
||||
|
||||
static unsigned int trout_col_gpios[] = { 35, 34, 33, 32, 31, 23, 30, 78 };
|
||||
static unsigned int trout_row_gpios[] = { 42, 41, 40, 39, 38, 37, 36 };
|
||||
|
||||
#define KEYMAP_INDEX(col, row) ((col)*ARRAY_SIZE(trout_row_gpios) + (row))
|
||||
|
||||
static const unsigned short trout_keymap[ARRAY_SIZE(trout_col_gpios) * ARRAY_SIZE(trout_row_gpios)] = {
|
||||
[KEYMAP_INDEX(0, 0)] = KEY_BACK,
|
||||
[KEYMAP_INDEX(0, 1)] = KEY_HOME,
|
||||
// [KEYMAP_INDEX(0, 2)] = KEY_,
|
||||
[KEYMAP_INDEX(0, 3)] = KEY_BACKSPACE,
|
||||
[KEYMAP_INDEX(0, 4)] = KEY_ENTER,
|
||||
[KEYMAP_INDEX(0, 5)] = KEY_RIGHTALT,
|
||||
[KEYMAP_INDEX(0, 6)] = KEY_P,
|
||||
|
||||
[KEYMAP_INDEX(1, 0)] = KEY_MENU,
|
||||
// [KEYMAP_INDEX(1, 0)] = 229, // SOFT1
|
||||
[KEYMAP_INDEX(1, 1)] = KEY_SEND,
|
||||
[KEYMAP_INDEX(1, 2)] = KEY_END,
|
||||
[KEYMAP_INDEX(1, 3)] = KEY_LEFTALT,
|
||||
[KEYMAP_INDEX(1, 4)] = KEY_A,
|
||||
[KEYMAP_INDEX(1, 5)] = KEY_LEFTSHIFT,
|
||||
[KEYMAP_INDEX(1, 6)] = KEY_Q,
|
||||
|
||||
[KEYMAP_INDEX(2, 0)] = KEY_U,
|
||||
[KEYMAP_INDEX(2, 1)] = KEY_7,
|
||||
[KEYMAP_INDEX(2, 2)] = KEY_K,
|
||||
[KEYMAP_INDEX(2, 3)] = KEY_J,
|
||||
[KEYMAP_INDEX(2, 4)] = KEY_M,
|
||||
[KEYMAP_INDEX(2, 5)] = KEY_SLASH,
|
||||
[KEYMAP_INDEX(2, 6)] = KEY_8,
|
||||
|
||||
[KEYMAP_INDEX(3, 0)] = KEY_5,
|
||||
[KEYMAP_INDEX(3, 1)] = KEY_6,
|
||||
[KEYMAP_INDEX(3, 2)] = KEY_B,
|
||||
[KEYMAP_INDEX(3, 3)] = KEY_H,
|
||||
[KEYMAP_INDEX(3, 4)] = KEY_N,
|
||||
[KEYMAP_INDEX(3, 5)] = KEY_SPACE,
|
||||
[KEYMAP_INDEX(3, 6)] = KEY_Y,
|
||||
|
||||
[KEYMAP_INDEX(4, 0)] = KEY_4,
|
||||
[KEYMAP_INDEX(4, 1)] = KEY_R,
|
||||
[KEYMAP_INDEX(4, 2)] = KEY_V,
|
||||
[KEYMAP_INDEX(4, 3)] = KEY_G,
|
||||
[KEYMAP_INDEX(4, 4)] = KEY_C,
|
||||
//[KEYMAP_INDEX(4, 5)] = KEY_,
|
||||
[KEYMAP_INDEX(4, 6)] = KEY_T,
|
||||
|
||||
[KEYMAP_INDEX(5, 0)] = KEY_2,
|
||||
[KEYMAP_INDEX(5, 1)] = KEY_W,
|
||||
[KEYMAP_INDEX(5, 2)] = KEY_COMPOSE,
|
||||
[KEYMAP_INDEX(5, 3)] = KEY_VOLUMEUP,
|
||||
[KEYMAP_INDEX(5, 4)] = KEY_S,
|
||||
[KEYMAP_INDEX(5, 5)] = KEY_Z,
|
||||
[KEYMAP_INDEX(5, 6)] = KEY_1,
|
||||
|
||||
[KEYMAP_INDEX(6, 0)] = KEY_I,
|
||||
[KEYMAP_INDEX(6, 1)] = KEY_0,
|
||||
[KEYMAP_INDEX(6, 2)] = KEY_O,
|
||||
[KEYMAP_INDEX(6, 3)] = KEY_L,
|
||||
[KEYMAP_INDEX(6, 4)] = KEY_DOT,
|
||||
[KEYMAP_INDEX(6, 5)] = KEY_COMMA,
|
||||
[KEYMAP_INDEX(6, 6)] = KEY_9,
|
||||
|
||||
[KEYMAP_INDEX(7, 0)] = KEY_3,
|
||||
[KEYMAP_INDEX(7, 1)] = KEY_E,
|
||||
[KEYMAP_INDEX(7, 2)] = KEY_EMAIL, // @
|
||||
[KEYMAP_INDEX(7, 3)] = KEY_VOLUMEDOWN,
|
||||
[KEYMAP_INDEX(7, 4)] = KEY_X,
|
||||
[KEYMAP_INDEX(7, 5)] = KEY_F,
|
||||
[KEYMAP_INDEX(7, 6)] = KEY_D
|
||||
};
|
||||
|
||||
static unsigned int trout_col_gpios_evt2[] = { 35, 34, 33, 32, 31, 23, 30, 109 };
|
||||
static unsigned int trout_row_gpios_evt2[] = { 42, 41, 40, 39, 38, 37, 36 };
|
||||
|
||||
static const unsigned short trout_keymap_evt2_1[ARRAY_SIZE(trout_col_gpios) * ARRAY_SIZE(trout_row_gpios)] = {
|
||||
[KEYMAP_INDEX(0, 0)] = KEY_BACK,
|
||||
[KEYMAP_INDEX(0, 1)] = KEY_HOME,
|
||||
// [KEYMAP_INDEX(0, 2)] = KEY_,
|
||||
[KEYMAP_INDEX(0, 3)] = KEY_BACKSPACE,
|
||||
[KEYMAP_INDEX(0, 4)] = KEY_ENTER,
|
||||
[KEYMAP_INDEX(0, 5)] = KEY_RIGHTSHIFT,
|
||||
[KEYMAP_INDEX(0, 6)] = KEY_P,
|
||||
|
||||
[KEYMAP_INDEX(1, 0)] = KEY_MENU,
|
||||
[KEYMAP_INDEX(1, 1)] = KEY_SEND,
|
||||
// [KEYMAP_INDEX(1, 2)] = KEY_,
|
||||
[KEYMAP_INDEX(1, 3)] = KEY_LEFTSHIFT,
|
||||
[KEYMAP_INDEX(1, 4)] = KEY_A,
|
||||
[KEYMAP_INDEX(1, 5)] = KEY_COMPOSE,
|
||||
[KEYMAP_INDEX(1, 6)] = KEY_Q,
|
||||
|
||||
[KEYMAP_INDEX(2, 0)] = KEY_U,
|
||||
[KEYMAP_INDEX(2, 1)] = KEY_7,
|
||||
[KEYMAP_INDEX(2, 2)] = KEY_K,
|
||||
[KEYMAP_INDEX(2, 3)] = KEY_J,
|
||||
[KEYMAP_INDEX(2, 4)] = KEY_M,
|
||||
[KEYMAP_INDEX(2, 5)] = KEY_SLASH,
|
||||
[KEYMAP_INDEX(2, 6)] = KEY_8,
|
||||
|
||||
[KEYMAP_INDEX(3, 0)] = KEY_5,
|
||||
[KEYMAP_INDEX(3, 1)] = KEY_6,
|
||||
[KEYMAP_INDEX(3, 2)] = KEY_B,
|
||||
[KEYMAP_INDEX(3, 3)] = KEY_H,
|
||||
[KEYMAP_INDEX(3, 4)] = KEY_N,
|
||||
[KEYMAP_INDEX(3, 5)] = KEY_SPACE,
|
||||
[KEYMAP_INDEX(3, 6)] = KEY_Y,
|
||||
|
||||
[KEYMAP_INDEX(4, 0)] = KEY_4,
|
||||
[KEYMAP_INDEX(4, 1)] = KEY_R,
|
||||
[KEYMAP_INDEX(4, 2)] = KEY_V,
|
||||
[KEYMAP_INDEX(4, 3)] = KEY_G,
|
||||
[KEYMAP_INDEX(4, 4)] = KEY_C,
|
||||
// [KEYMAP_INDEX(4, 5)] = KEY_,
|
||||
[KEYMAP_INDEX(4, 6)] = KEY_T,
|
||||
|
||||
[KEYMAP_INDEX(5, 0)] = KEY_2,
|
||||
[KEYMAP_INDEX(5, 1)] = KEY_W,
|
||||
[KEYMAP_INDEX(5, 2)] = KEY_LEFTALT,
|
||||
[KEYMAP_INDEX(5, 3)] = KEY_VOLUMEUP,
|
||||
[KEYMAP_INDEX(5, 4)] = KEY_S,
|
||||
[KEYMAP_INDEX(5, 5)] = KEY_Z,
|
||||
[KEYMAP_INDEX(5, 6)] = KEY_1,
|
||||
|
||||
[KEYMAP_INDEX(6, 0)] = KEY_I,
|
||||
[KEYMAP_INDEX(6, 1)] = KEY_0,
|
||||
[KEYMAP_INDEX(6, 2)] = KEY_O,
|
||||
[KEYMAP_INDEX(6, 3)] = KEY_L,
|
||||
[KEYMAP_INDEX(6, 4)] = KEY_COMMA,
|
||||
[KEYMAP_INDEX(6, 5)] = KEY_DOT,
|
||||
[KEYMAP_INDEX(6, 6)] = KEY_9,
|
||||
|
||||
[KEYMAP_INDEX(7, 0)] = KEY_3,
|
||||
[KEYMAP_INDEX(7, 1)] = KEY_E,
|
||||
[KEYMAP_INDEX(7, 2)] = KEY_EMAIL, // @
|
||||
[KEYMAP_INDEX(7, 3)] = KEY_VOLUMEDOWN,
|
||||
[KEYMAP_INDEX(7, 4)] = KEY_X,
|
||||
[KEYMAP_INDEX(7, 5)] = KEY_F,
|
||||
[KEYMAP_INDEX(7, 6)] = KEY_D
|
||||
};
|
||||
|
||||
static const unsigned short trout_keymap_evt2_2[ARRAY_SIZE(trout_col_gpios) * ARRAY_SIZE(trout_row_gpios)] = {
|
||||
[KEYMAP_INDEX(0, 0)] = KEY_BACK,
|
||||
[KEYMAP_INDEX(0, 1)] = KEY_HOME,
|
||||
// [KEYMAP_INDEX(0, 2)] = KEY_,
|
||||
[KEYMAP_INDEX(0, 3)] = KEY_BACKSPACE,
|
||||
[KEYMAP_INDEX(0, 4)] = KEY_ENTER,
|
||||
[KEYMAP_INDEX(0, 5)] = KEY_RIGHTSHIFT,
|
||||
[KEYMAP_INDEX(0, 6)] = KEY_P,
|
||||
|
||||
[KEYMAP_INDEX(1, 0)] = KEY_MENU, /* external menu key */
|
||||
[KEYMAP_INDEX(1, 1)] = KEY_SEND,
|
||||
// [KEYMAP_INDEX(1, 2)] = KEY_,
|
||||
[KEYMAP_INDEX(1, 3)] = KEY_LEFTSHIFT,
|
||||
[KEYMAP_INDEX(1, 4)] = KEY_A,
|
||||
[KEYMAP_INDEX(1, 5)] = KEY_F1, /* qwerty menu key */
|
||||
[KEYMAP_INDEX(1, 6)] = KEY_Q,
|
||||
|
||||
[KEYMAP_INDEX(2, 0)] = KEY_U,
|
||||
[KEYMAP_INDEX(2, 1)] = KEY_7,
|
||||
[KEYMAP_INDEX(2, 2)] = KEY_K,
|
||||
[KEYMAP_INDEX(2, 3)] = KEY_J,
|
||||
[KEYMAP_INDEX(2, 4)] = KEY_M,
|
||||
[KEYMAP_INDEX(2, 5)] = KEY_DOT,
|
||||
[KEYMAP_INDEX(2, 6)] = KEY_8,
|
||||
|
||||
[KEYMAP_INDEX(3, 0)] = KEY_5,
|
||||
[KEYMAP_INDEX(3, 1)] = KEY_6,
|
||||
[KEYMAP_INDEX(3, 2)] = KEY_B,
|
||||
[KEYMAP_INDEX(3, 3)] = KEY_H,
|
||||
[KEYMAP_INDEX(3, 4)] = KEY_N,
|
||||
[KEYMAP_INDEX(3, 5)] = KEY_SPACE,
|
||||
[KEYMAP_INDEX(3, 6)] = KEY_Y,
|
||||
|
||||
[KEYMAP_INDEX(4, 0)] = KEY_4,
|
||||
[KEYMAP_INDEX(4, 1)] = KEY_R,
|
||||
[KEYMAP_INDEX(4, 2)] = KEY_V,
|
||||
[KEYMAP_INDEX(4, 3)] = KEY_G,
|
||||
[KEYMAP_INDEX(4, 4)] = KEY_C,
|
||||
[KEYMAP_INDEX(4, 5)] = KEY_EMAIL, // @
|
||||
[KEYMAP_INDEX(4, 6)] = KEY_T,
|
||||
|
||||
[KEYMAP_INDEX(5, 0)] = KEY_2,
|
||||
[KEYMAP_INDEX(5, 1)] = KEY_W,
|
||||
[KEYMAP_INDEX(5, 2)] = KEY_LEFTALT,
|
||||
[KEYMAP_INDEX(5, 3)] = KEY_VOLUMEUP,
|
||||
[KEYMAP_INDEX(5, 4)] = KEY_S,
|
||||
[KEYMAP_INDEX(5, 5)] = KEY_Z,
|
||||
[KEYMAP_INDEX(5, 6)] = KEY_1,
|
||||
|
||||
[KEYMAP_INDEX(6, 0)] = KEY_I,
|
||||
[KEYMAP_INDEX(6, 1)] = KEY_0,
|
||||
[KEYMAP_INDEX(6, 2)] = KEY_O,
|
||||
[KEYMAP_INDEX(6, 3)] = KEY_L,
|
||||
[KEYMAP_INDEX(6, 4)] = KEY_COMMA,
|
||||
[KEYMAP_INDEX(6, 5)] = KEY_RIGHTALT,
|
||||
[KEYMAP_INDEX(6, 6)] = KEY_9,
|
||||
|
||||
[KEYMAP_INDEX(7, 0)] = KEY_3,
|
||||
[KEYMAP_INDEX(7, 1)] = KEY_E,
|
||||
[KEYMAP_INDEX(7, 2)] = KEY_COMPOSE,
|
||||
[KEYMAP_INDEX(7, 3)] = KEY_VOLUMEDOWN,
|
||||
[KEYMAP_INDEX(7, 4)] = KEY_X,
|
||||
[KEYMAP_INDEX(7, 5)] = KEY_F,
|
||||
[KEYMAP_INDEX(7, 6)] = KEY_D
|
||||
};
|
||||
|
||||
static struct gpio_event_matrix_info trout_keypad_matrix_info = {
|
||||
.info.func = gpio_event_matrix_func,
|
||||
.keymap = trout_keymap,
|
||||
.output_gpios = trout_col_gpios,
|
||||
.input_gpios = trout_row_gpios,
|
||||
.noutputs = ARRAY_SIZE(trout_col_gpios),
|
||||
.ninputs = ARRAY_SIZE(trout_row_gpios),
|
||||
.settle_time.tv.nsec = 40 * NSEC_PER_USEC,
|
||||
.poll_time.tv.nsec = 20 * NSEC_PER_MSEC,
|
||||
.flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_REMOVE_PHANTOM_KEYS |GPIOKPF_PRINT_UNMAPPED_KEYS /*| GPIOKPF_PRINT_MAPPED_KEYS*/
|
||||
};
|
||||
|
||||
static struct gpio_event_direct_entry trout_keypad_nav_map[] = {
|
||||
{ TROUT_POWER_KEY, KEY_POWER },
|
||||
{ TROUT_GPIO_CAM_BTN_STEP1_N, KEY_CAMERA-1 }, //steal KEY_HP
|
||||
{ TROUT_GPIO_CAM_BTN_STEP2_N, KEY_CAMERA },
|
||||
};
|
||||
|
||||
static struct gpio_event_direct_entry trout_keypad_nav_map_evt2[] = {
|
||||
{ TROUT_POWER_KEY, KEY_END },
|
||||
{ TROUT_GPIO_CAM_BTN_STEP1_N, KEY_CAMERA-1 }, //steal KEY_HP
|
||||
{ TROUT_GPIO_CAM_BTN_STEP2_N, KEY_CAMERA },
|
||||
};
|
||||
|
||||
static struct gpio_event_input_info trout_keypad_nav_info = {
|
||||
.info.func = gpio_event_input_func,
|
||||
.flags = 0,
|
||||
.type = EV_KEY,
|
||||
.keymap = trout_keypad_nav_map,
|
||||
.keymap_size = ARRAY_SIZE(trout_keypad_nav_map)
|
||||
};
|
||||
|
||||
static struct gpio_event_direct_entry trout_keypad_switch_map[] = {
|
||||
{ TROUT_GPIO_SLIDING_DET, SW_LID }
|
||||
};
|
||||
|
||||
static struct gpio_event_input_info trout_keypad_switch_info = {
|
||||
.info.func = gpio_event_input_func,
|
||||
.flags = 0,
|
||||
.type = EV_SW,
|
||||
.keymap = trout_keypad_switch_map,
|
||||
.keymap_size = ARRAY_SIZE(trout_keypad_switch_map)
|
||||
};
|
||||
|
||||
static struct gpio_event_info *trout_keypad_info[] = {
|
||||
&trout_keypad_matrix_info.info,
|
||||
&trout_keypad_nav_info.info,
|
||||
&trout_keypad_switch_info.info,
|
||||
};
|
||||
|
||||
static struct gpio_event_platform_data trout_keypad_data = {
|
||||
.name = "trout-keypad",
|
||||
.info = trout_keypad_info,
|
||||
.info_count = ARRAY_SIZE(trout_keypad_info)
|
||||
};
|
||||
|
||||
static struct platform_device trout_keypad_device = {
|
||||
.name = GPIO_EVENT_DEV_NAME,
|
||||
.id = 0,
|
||||
.dev = {
|
||||
.platform_data = &trout_keypad_data,
|
||||
},
|
||||
};
|
||||
|
||||
static int __init trout_init_keypad(void)
|
||||
{
|
||||
if (!machine_is_trout())
|
||||
return 0;
|
||||
|
||||
switch (system_rev) {
|
||||
case 0:
|
||||
/* legacy default keylayout */
|
||||
break;
|
||||
case 1:
|
||||
/* v1 has a new keyboard layout */
|
||||
trout_keypad_matrix_info.keymap = trout_keymap_evt2_1;
|
||||
trout_keypad_matrix_info.output_gpios = trout_col_gpios_evt2;
|
||||
trout_keypad_matrix_info.input_gpios = trout_row_gpios_evt2;
|
||||
|
||||
/* v1 has new direct keys */
|
||||
trout_keypad_nav_info.keymap = trout_keypad_nav_map_evt2;
|
||||
trout_keypad_nav_info.keymap_size = ARRAY_SIZE(trout_keypad_nav_map_evt2);
|
||||
|
||||
/* userspace needs to know about these changes as well */
|
||||
trout_keypad_data.name = "trout-keypad-v2";
|
||||
break;
|
||||
default: /* 2, 3, 4 currently */
|
||||
/* v2 has a new keyboard layout */
|
||||
trout_keypad_matrix_info.keymap = trout_keymap_evt2_2;
|
||||
trout_keypad_matrix_info.output_gpios = trout_col_gpios_evt2;
|
||||
trout_keypad_matrix_info.input_gpios = trout_row_gpios_evt2;
|
||||
|
||||
/* v2 has new direct keys */
|
||||
trout_keypad_nav_info.keymap = trout_keypad_nav_map_evt2;
|
||||
trout_keypad_nav_info.keymap_size = ARRAY_SIZE(trout_keypad_nav_map_evt2);
|
||||
|
||||
/* userspace needs to know about these changes as well */
|
||||
if (!strcmp(keycaps, "qwertz")) {
|
||||
trout_keypad_data.name = "trout-keypad-qwertz";
|
||||
} else {
|
||||
trout_keypad_data.name = "trout-keypad-v3";
|
||||
}
|
||||
break;
|
||||
}
|
||||
return platform_device_register(&trout_keypad_device);
|
||||
}
|
||||
|
||||
device_initcall(trout_init_keypad);
|
||||
|
@ -1,438 +0,0 @@
|
||||
/* linux/arch/arm/mach-msm/board-trout-mmc.c
|
||||
** Author: Brian Swetland <swetland@google.com>
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/mmc/host.h>
|
||||
#include <linux/mmc/sdio_ids.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/debugfs.h>
|
||||
|
||||
#include <asm/gpio.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#include <mach/vreg.h>
|
||||
#include <mach/htc_pwrsink.h>
|
||||
|
||||
#include <asm/mach/mmc.h>
|
||||
|
||||
#include "devices.h"
|
||||
|
||||
#include "board-trout.h"
|
||||
|
||||
#include "proc_comm.h"
|
||||
|
||||
#define DEBUG_SDSLOT_VDD 1
|
||||
|
||||
extern int msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat,
|
||||
unsigned int stat_irq, unsigned long stat_irq_flags);
|
||||
|
||||
/* ---- COMMON ---- */
|
||||
static void config_gpio_table(uint32_t *table, int len)
|
||||
{
|
||||
int n;
|
||||
unsigned id;
|
||||
for(n = 0; n < len; n++) {
|
||||
id = table[n];
|
||||
msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &id, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* ---- SDCARD ---- */
|
||||
|
||||
static uint32_t sdcard_on_gpio_table[] = {
|
||||
PCOM_GPIO_CFG(62, 2, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), /* CLK */
|
||||
PCOM_GPIO_CFG(63, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), /* CMD */
|
||||
PCOM_GPIO_CFG(64, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), /* DAT3 */
|
||||
PCOM_GPIO_CFG(65, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), /* DAT2 */
|
||||
PCOM_GPIO_CFG(66, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT1 */
|
||||
PCOM_GPIO_CFG(67, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT0 */
|
||||
};
|
||||
|
||||
static uint32_t sdcard_off_gpio_table[] = {
|
||||
PCOM_GPIO_CFG(62, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* CLK */
|
||||
PCOM_GPIO_CFG(63, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* CMD */
|
||||
PCOM_GPIO_CFG(64, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT3 */
|
||||
PCOM_GPIO_CFG(65, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT2 */
|
||||
PCOM_GPIO_CFG(66, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT1 */
|
||||
PCOM_GPIO_CFG(67, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT0 */
|
||||
};
|
||||
|
||||
static uint opt_disable_sdcard;
|
||||
|
||||
static int __init trout_disablesdcard_setup(char *str)
|
||||
{
|
||||
int cal = simple_strtol(str, NULL, 0);
|
||||
|
||||
opt_disable_sdcard = cal;
|
||||
return 1;
|
||||
}
|
||||
|
||||
__setup("board_trout.disable_sdcard=", trout_disablesdcard_setup);
|
||||
|
||||
static struct vreg *vreg_sdslot; /* SD slot power */
|
||||
|
||||
struct mmc_vdd_xlat {
|
||||
int mask;
|
||||
int level;
|
||||
};
|
||||
|
||||
static struct mmc_vdd_xlat mmc_vdd_table[] = {
|
||||
{ MMC_VDD_165_195, 1800 },
|
||||
{ MMC_VDD_20_21, 2050 },
|
||||
{ MMC_VDD_21_22, 2150 },
|
||||
{ MMC_VDD_22_23, 2250 },
|
||||
{ MMC_VDD_23_24, 2350 },
|
||||
{ MMC_VDD_24_25, 2450 },
|
||||
{ MMC_VDD_25_26, 2550 },
|
||||
{ MMC_VDD_26_27, 2650 },
|
||||
{ MMC_VDD_27_28, 2750 },
|
||||
{ MMC_VDD_28_29, 2850 },
|
||||
{ MMC_VDD_29_30, 2950 },
|
||||
};
|
||||
|
||||
static unsigned int sdslot_vdd = 0xffffffff;
|
||||
static unsigned int sdslot_vreg_enabled;
|
||||
|
||||
static uint32_t trout_sdslot_switchvdd(struct device *dev, unsigned int vdd)
|
||||
{
|
||||
int i, rc;
|
||||
|
||||
BUG_ON(!vreg_sdslot);
|
||||
|
||||
if (vdd == sdslot_vdd)
|
||||
return 0;
|
||||
|
||||
sdslot_vdd = vdd;
|
||||
|
||||
if (vdd == 0) {
|
||||
#if DEBUG_SDSLOT_VDD
|
||||
printk("%s: Disabling SD slot power\n", __func__);
|
||||
#endif
|
||||
config_gpio_table(sdcard_off_gpio_table,
|
||||
ARRAY_SIZE(sdcard_off_gpio_table));
|
||||
vreg_disable(vreg_sdslot);
|
||||
sdslot_vreg_enabled = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!sdslot_vreg_enabled) {
|
||||
rc = vreg_enable(vreg_sdslot);
|
||||
if (rc) {
|
||||
printk(KERN_ERR "%s: Error enabling vreg (%d)\n",
|
||||
__func__, rc);
|
||||
}
|
||||
config_gpio_table(sdcard_on_gpio_table,
|
||||
ARRAY_SIZE(sdcard_on_gpio_table));
|
||||
sdslot_vreg_enabled = 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(mmc_vdd_table); i++) {
|
||||
if (mmc_vdd_table[i].mask == (1 << vdd)) {
|
||||
#if DEBUG_SDSLOT_VDD
|
||||
printk("%s: Setting level to %u\n",
|
||||
__func__, mmc_vdd_table[i].level);
|
||||
#endif
|
||||
rc = vreg_set_level(vreg_sdslot,
|
||||
mmc_vdd_table[i].level);
|
||||
if (rc) {
|
||||
printk(KERN_ERR
|
||||
"%s: Error setting vreg level (%d)\n",
|
||||
__func__, rc);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
printk(KERN_ERR "%s: Invalid VDD %d specified\n", __func__, vdd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned int trout_sdslot_status(struct device *dev)
|
||||
{
|
||||
unsigned int status;
|
||||
|
||||
status = (unsigned int) gpio_get_value(TROUT_GPIO_SDMC_CD_N);
|
||||
return (!status);
|
||||
}
|
||||
|
||||
#define TROUT_MMC_VDD MMC_VDD_165_195 | MMC_VDD_20_21 | MMC_VDD_21_22 \
|
||||
| MMC_VDD_22_23 | MMC_VDD_23_24 | MMC_VDD_24_25 \
|
||||
| MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 \
|
||||
| MMC_VDD_28_29 | MMC_VDD_29_30
|
||||
|
||||
static struct mmc_platform_data trout_sdslot_data = {
|
||||
.ocr_mask = TROUT_MMC_VDD,
|
||||
.status = trout_sdslot_status,
|
||||
.translate_vdd = trout_sdslot_switchvdd,
|
||||
};
|
||||
|
||||
/* ---- WIFI ---- */
|
||||
|
||||
static uint32_t wifi_on_gpio_table[] = {
|
||||
PCOM_GPIO_CFG(51, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT3 */
|
||||
PCOM_GPIO_CFG(52, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT2 */
|
||||
PCOM_GPIO_CFG(53, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT1 */
|
||||
PCOM_GPIO_CFG(54, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT0 */
|
||||
PCOM_GPIO_CFG(55, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), /* CMD */
|
||||
PCOM_GPIO_CFG(56, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), /* CLK */
|
||||
PCOM_GPIO_CFG(29, 0, GPIO_INPUT, GPIO_NO_PULL, GPIO_4MA), /* WLAN IRQ */
|
||||
};
|
||||
|
||||
static uint32_t wifi_off_gpio_table[] = {
|
||||
PCOM_GPIO_CFG(51, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT3 */
|
||||
PCOM_GPIO_CFG(52, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT2 */
|
||||
PCOM_GPIO_CFG(53, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT1 */
|
||||
PCOM_GPIO_CFG(54, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT0 */
|
||||
PCOM_GPIO_CFG(55, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* CMD */
|
||||
PCOM_GPIO_CFG(56, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* CLK */
|
||||
PCOM_GPIO_CFG(29, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* WLAN IRQ */
|
||||
};
|
||||
|
||||
static struct vreg *vreg_wifi_osc; /* WIFI 32khz oscilator */
|
||||
static int trout_wifi_cd = 0; /* WIFI virtual 'card detect' status */
|
||||
|
||||
static struct sdio_embedded_func wifi_func = {
|
||||
.f_class = SDIO_CLASS_WLAN,
|
||||
.f_maxblksize = 512,
|
||||
};
|
||||
|
||||
static struct embedded_sdio_data trout_wifi_emb_data = {
|
||||
.cis = {
|
||||
.vendor = 0x104c,
|
||||
.device = 0x9066,
|
||||
.blksize = 512,
|
||||
/*.max_dtr = 24000000, Max of chip - no worky on Trout */
|
||||
.max_dtr = 20000000,
|
||||
},
|
||||
.cccr = {
|
||||
.multi_block = 0,
|
||||
.low_speed = 0,
|
||||
.wide_bus = 1,
|
||||
.high_power = 0,
|
||||
.high_speed = 0,
|
||||
},
|
||||
.funcs = &wifi_func,
|
||||
.num_funcs = 1,
|
||||
};
|
||||
|
||||
static void (*wifi_status_cb)(int card_present, void *dev_id);
|
||||
static void *wifi_status_cb_devid;
|
||||
|
||||
static int trout_wifi_status_register(void (*callback)(int card_present, void *dev_id), void *dev_id)
|
||||
{
|
||||
if (wifi_status_cb)
|
||||
return -EAGAIN;
|
||||
wifi_status_cb = callback;
|
||||
wifi_status_cb_devid = dev_id;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned int trout_wifi_status(struct device *dev)
|
||||
{
|
||||
return trout_wifi_cd;
|
||||
}
|
||||
|
||||
int trout_wifi_set_carddetect(int val)
|
||||
{
|
||||
printk("%s: %d\n", __func__, val);
|
||||
trout_wifi_cd = val;
|
||||
if (wifi_status_cb) {
|
||||
wifi_status_cb(val, wifi_status_cb_devid);
|
||||
} else
|
||||
printk(KERN_WARNING "%s: Nobody to notify\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
#ifndef CONFIG_WIFI_CONTROL_FUNC
|
||||
EXPORT_SYMBOL(trout_wifi_set_carddetect);
|
||||
#endif
|
||||
|
||||
static int trout_wifi_power_state;
|
||||
|
||||
int trout_wifi_power(int on)
|
||||
{
|
||||
int rc;
|
||||
|
||||
printk("%s: %d\n", __func__, on);
|
||||
|
||||
if (on) {
|
||||
config_gpio_table(wifi_on_gpio_table,
|
||||
ARRAY_SIZE(wifi_on_gpio_table));
|
||||
rc = vreg_enable(vreg_wifi_osc);
|
||||
if (rc)
|
||||
return rc;
|
||||
htc_pwrsink_set(PWRSINK_WIFI, 70);
|
||||
} else {
|
||||
config_gpio_table(wifi_off_gpio_table,
|
||||
ARRAY_SIZE(wifi_off_gpio_table));
|
||||
htc_pwrsink_set(PWRSINK_WIFI, 0);
|
||||
}
|
||||
gpio_set_value( TROUT_GPIO_MAC_32K_EN, on);
|
||||
mdelay(100);
|
||||
gpio_set_value( TROUT_GPIO_WIFI_EN, on);
|
||||
mdelay(100);
|
||||
if (!on) {
|
||||
vreg_disable(vreg_wifi_osc);
|
||||
}
|
||||
trout_wifi_power_state = on;
|
||||
return 0;
|
||||
}
|
||||
#ifndef CONFIG_WIFI_CONTROL_FUNC
|
||||
EXPORT_SYMBOL(trout_wifi_power);
|
||||
#endif
|
||||
|
||||
static int trout_wifi_reset_state;
|
||||
int trout_wifi_reset(int on)
|
||||
{
|
||||
printk("%s: %d\n", __func__, on);
|
||||
gpio_set_value( TROUT_GPIO_WIFI_PA_RESETX, !on );
|
||||
trout_wifi_reset_state = on;
|
||||
mdelay(50);
|
||||
return 0;
|
||||
}
|
||||
#ifndef CONFIG_WIFI_CONTROL_FUNC
|
||||
EXPORT_SYMBOL(trout_wifi_reset);
|
||||
#endif
|
||||
|
||||
static struct mmc_platform_data trout_wifi_data = {
|
||||
.ocr_mask = MMC_VDD_28_29,
|
||||
.status = trout_wifi_status,
|
||||
.register_status_notify = trout_wifi_status_register,
|
||||
.embedded_sdio = &trout_wifi_emb_data,
|
||||
};
|
||||
|
||||
int __init trout_init_mmc(unsigned int sys_rev)
|
||||
{
|
||||
wifi_status_cb = NULL;
|
||||
|
||||
sdslot_vreg_enabled = 0;
|
||||
|
||||
vreg_sdslot = vreg_get(0, "gp6");
|
||||
if (IS_ERR(vreg_sdslot))
|
||||
return PTR_ERR(vreg_sdslot);
|
||||
vreg_wifi_osc = vreg_get(0, "mmc");
|
||||
if (IS_ERR(vreg_wifi_osc))
|
||||
return PTR_ERR(vreg_wifi_osc);
|
||||
|
||||
set_irq_wake(TROUT_GPIO_TO_INT(TROUT_GPIO_SDMC_CD_N), 1);
|
||||
|
||||
msm_add_sdcc(1, &trout_wifi_data, 0, 0);
|
||||
|
||||
if (!opt_disable_sdcard)
|
||||
msm_add_sdcc(2, &trout_sdslot_data,
|
||||
TROUT_GPIO_TO_INT(TROUT_GPIO_SDMC_CD_N), 0);
|
||||
else
|
||||
printk(KERN_INFO "trout: SD-Card interface disabled\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_DEBUG_FS)
|
||||
static int troutmmc_dbg_wifi_reset_set(void *data, u64 val)
|
||||
{
|
||||
trout_wifi_reset((int) val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int troutmmc_dbg_wifi_reset_get(void *data, u64 *val)
|
||||
{
|
||||
*val = trout_wifi_reset_state;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int troutmmc_dbg_wifi_cd_set(void *data, u64 val)
|
||||
{
|
||||
trout_wifi_set_carddetect((int) val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int troutmmc_dbg_wifi_cd_get(void *data, u64 *val)
|
||||
{
|
||||
*val = trout_wifi_cd;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int troutmmc_dbg_wifi_pwr_set(void *data, u64 val)
|
||||
{
|
||||
trout_wifi_power((int) val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int troutmmc_dbg_wifi_pwr_get(void *data, u64 *val)
|
||||
{
|
||||
|
||||
*val = trout_wifi_power_state;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int troutmmc_dbg_sd_pwr_set(void *data, u64 val)
|
||||
{
|
||||
trout_sdslot_switchvdd(NULL, (unsigned int) val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int troutmmc_dbg_sd_pwr_get(void *data, u64 *val)
|
||||
{
|
||||
*val = sdslot_vdd;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int troutmmc_dbg_sd_cd_set(void *data, u64 val)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static int troutmmc_dbg_sd_cd_get(void *data, u64 *val)
|
||||
{
|
||||
*val = trout_sdslot_status(NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_SIMPLE_ATTRIBUTE(troutmmc_dbg_wifi_reset_fops,
|
||||
troutmmc_dbg_wifi_reset_get,
|
||||
troutmmc_dbg_wifi_reset_set, "%llu\n");
|
||||
|
||||
DEFINE_SIMPLE_ATTRIBUTE(troutmmc_dbg_wifi_cd_fops,
|
||||
troutmmc_dbg_wifi_cd_get,
|
||||
troutmmc_dbg_wifi_cd_set, "%llu\n");
|
||||
|
||||
DEFINE_SIMPLE_ATTRIBUTE(troutmmc_dbg_wifi_pwr_fops,
|
||||
troutmmc_dbg_wifi_pwr_get,
|
||||
troutmmc_dbg_wifi_pwr_set, "%llu\n");
|
||||
|
||||
DEFINE_SIMPLE_ATTRIBUTE(troutmmc_dbg_sd_pwr_fops,
|
||||
troutmmc_dbg_sd_pwr_get,
|
||||
troutmmc_dbg_sd_pwr_set, "%llu\n");
|
||||
|
||||
DEFINE_SIMPLE_ATTRIBUTE(troutmmc_dbg_sd_cd_fops,
|
||||
troutmmc_dbg_sd_cd_get,
|
||||
troutmmc_dbg_sd_cd_set, "%llu\n");
|
||||
|
||||
static int __init troutmmc_dbg_init(void)
|
||||
{
|
||||
struct dentry *dent;
|
||||
|
||||
dent = debugfs_create_dir("troutmmc_dbg", 0);
|
||||
if (IS_ERR(dent))
|
||||
return PTR_ERR(dent);
|
||||
|
||||
debugfs_create_file("wifi_reset", 0644, dent, NULL,
|
||||
&troutmmc_dbg_wifi_reset_fops);
|
||||
debugfs_create_file("wifi_cd", 0644, dent, NULL,
|
||||
&troutmmc_dbg_wifi_cd_fops);
|
||||
debugfs_create_file("wifi_pwr", 0644, dent, NULL,
|
||||
&troutmmc_dbg_wifi_pwr_fops);
|
||||
|
||||
debugfs_create_file("sd_pwr", 0644, dent, NULL,
|
||||
&troutmmc_dbg_sd_pwr_fops);
|
||||
debugfs_create_file("sd_cd", 0644, dent, NULL,
|
||||
&troutmmc_dbg_sd_cd_fops);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
device_initcall(troutmmc_dbg_init);
|
||||
|
||||
#endif
|
@ -1,642 +0,0 @@
|
||||
/* linux/arch/arm/mach-msm/board-trout-mddi.c
|
||||
** Author: Brian Swetland <swetland@google.com>
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/err.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/gpio.h>
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include <mach/msm_fb.h>
|
||||
#include <mach/vreg.h>
|
||||
#include <mach/htc_pwrsink.h>
|
||||
|
||||
#include "board-trout.h"
|
||||
#include "proc_comm.h"
|
||||
#include "devices.h"
|
||||
|
||||
#define TROUT_DEFAULT_BACKLIGHT_BRIGHTNESS 255
|
||||
|
||||
static struct clk *gp_clk;
|
||||
static int trout_backlight_off;
|
||||
static int trout_backlight_brightness = TROUT_DEFAULT_BACKLIGHT_BRIGHTNESS;
|
||||
static int trout_new_backlight = 1;
|
||||
static uint8_t trout_backlight_last_level = 33;
|
||||
static DEFINE_MUTEX(trout_backlight_lock);
|
||||
|
||||
static void trout_set_backlight_level(uint8_t level)
|
||||
{
|
||||
unsigned percent = ((int)level * 100) / 255;
|
||||
|
||||
if (trout_new_backlight) {
|
||||
unsigned long flags;
|
||||
int i = 0;
|
||||
level = (int)level * 34 / 256;
|
||||
|
||||
if (trout_backlight_last_level == level)
|
||||
return;
|
||||
|
||||
if (level == 0) {
|
||||
gpio_set_value(27, 0);
|
||||
msleep(2);
|
||||
} else {
|
||||
local_irq_save(flags);
|
||||
if (trout_backlight_last_level == 0) {
|
||||
gpio_set_value(27, 1);
|
||||
udelay(40);
|
||||
trout_backlight_last_level = 33;
|
||||
}
|
||||
i = (trout_backlight_last_level - level + 33) % 33;
|
||||
while (i-- > 0) {
|
||||
gpio_set_value(27, 0);
|
||||
udelay(1);
|
||||
gpio_set_value(27, 1);
|
||||
udelay(1);
|
||||
}
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
trout_backlight_last_level = level;
|
||||
}
|
||||
else {
|
||||
if(level) {
|
||||
clk_enable(gp_clk);
|
||||
writel((1U << 16) | (~level & 0xffff),
|
||||
MSM_CLK_CTL_BASE + 0x58);
|
||||
/* Going directly to a 100% duty cycle does not
|
||||
* seem to work */
|
||||
if(level == 255) {
|
||||
writel((~127 << 16) | 0xb20,
|
||||
MSM_CLK_CTL_BASE + 0x5c);
|
||||
udelay(1);
|
||||
}
|
||||
writel((~127 << 16) | 0xb58, MSM_CLK_CTL_BASE + 0x5c);
|
||||
}
|
||||
else {
|
||||
writel(0x0, MSM_CLK_CTL_BASE + 0x5c);
|
||||
clk_disable(gp_clk);
|
||||
}
|
||||
}
|
||||
htc_pwrsink_set(PWRSINK_BACKLIGHT, percent);
|
||||
}
|
||||
|
||||
#define MDDI_CLIENT_CORE_BASE 0x108000
|
||||
#define LCD_CONTROL_BLOCK_BASE 0x110000
|
||||
#define SPI_BLOCK_BASE 0x120000
|
||||
#define I2C_BLOCK_BASE 0x130000
|
||||
#define PWM_BLOCK_BASE 0x140000
|
||||
#define GPIO_BLOCK_BASE 0x150000
|
||||
#define SYSTEM_BLOCK1_BASE 0x160000
|
||||
#define SYSTEM_BLOCK2_BASE 0x170000
|
||||
|
||||
|
||||
#define DPSUS (MDDI_CLIENT_CORE_BASE|0x24)
|
||||
#define SYSCLKENA (MDDI_CLIENT_CORE_BASE|0x2C)
|
||||
#define PWM0OFF (PWM_BLOCK_BASE|0x1C)
|
||||
|
||||
#define V_VDDE2E_VDD2_GPIO 0
|
||||
#define MDDI_RST_N 82
|
||||
|
||||
#define MDDICAP0 (MDDI_CLIENT_CORE_BASE|0x00)
|
||||
#define MDDICAP1 (MDDI_CLIENT_CORE_BASE|0x04)
|
||||
#define MDDICAP2 (MDDI_CLIENT_CORE_BASE|0x08)
|
||||
#define MDDICAP3 (MDDI_CLIENT_CORE_BASE|0x0C)
|
||||
#define MDCAPCHG (MDDI_CLIENT_CORE_BASE|0x10)
|
||||
#define MDCRCERC (MDDI_CLIENT_CORE_BASE|0x14)
|
||||
#define TTBUSSEL (MDDI_CLIENT_CORE_BASE|0x18)
|
||||
#define DPSET0 (MDDI_CLIENT_CORE_BASE|0x1C)
|
||||
#define DPSET1 (MDDI_CLIENT_CORE_BASE|0x20)
|
||||
#define DPSUS (MDDI_CLIENT_CORE_BASE|0x24)
|
||||
#define DPRUN (MDDI_CLIENT_CORE_BASE|0x28)
|
||||
#define SYSCKENA (MDDI_CLIENT_CORE_BASE|0x2C)
|
||||
#define TESTMODE (MDDI_CLIENT_CORE_BASE|0x30)
|
||||
#define FIFOMONI (MDDI_CLIENT_CORE_BASE|0x34)
|
||||
#define INTMONI (MDDI_CLIENT_CORE_BASE|0x38)
|
||||
#define MDIOBIST (MDDI_CLIENT_CORE_BASE|0x3C)
|
||||
#define MDIOPSET (MDDI_CLIENT_CORE_BASE|0x40)
|
||||
#define BITMAP0 (MDDI_CLIENT_CORE_BASE|0x44)
|
||||
#define BITMAP1 (MDDI_CLIENT_CORE_BASE|0x48)
|
||||
#define BITMAP2 (MDDI_CLIENT_CORE_BASE|0x4C)
|
||||
#define BITMAP3 (MDDI_CLIENT_CORE_BASE|0x50)
|
||||
#define BITMAP4 (MDDI_CLIENT_CORE_BASE|0x54)
|
||||
|
||||
#define SRST (LCD_CONTROL_BLOCK_BASE|0x00)
|
||||
#define PORT_ENB (LCD_CONTROL_BLOCK_BASE|0x04)
|
||||
#define START (LCD_CONTROL_BLOCK_BASE|0x08)
|
||||
#define PORT (LCD_CONTROL_BLOCK_BASE|0x0C)
|
||||
#define CMN (LCD_CONTROL_BLOCK_BASE|0x10)
|
||||
#define GAMMA (LCD_CONTROL_BLOCK_BASE|0x14)
|
||||
#define INTFLG (LCD_CONTROL_BLOCK_BASE|0x18)
|
||||
#define INTMSK (LCD_CONTROL_BLOCK_BASE|0x1C)
|
||||
#define MPLFBUF (LCD_CONTROL_BLOCK_BASE|0x20)
|
||||
#define HDE_LEFT (LCD_CONTROL_BLOCK_BASE|0x24)
|
||||
#define VDE_TOP (LCD_CONTROL_BLOCK_BASE|0x28)
|
||||
#define PXL (LCD_CONTROL_BLOCK_BASE|0x30)
|
||||
#define HCYCLE (LCD_CONTROL_BLOCK_BASE|0x34)
|
||||
#define HSW (LCD_CONTROL_BLOCK_BASE|0x38)
|
||||
#define HDE_START (LCD_CONTROL_BLOCK_BASE|0x3C)
|
||||
#define HDE_SIZE (LCD_CONTROL_BLOCK_BASE|0x40)
|
||||
#define VCYCLE (LCD_CONTROL_BLOCK_BASE|0x44)
|
||||
#define VSW (LCD_CONTROL_BLOCK_BASE|0x48)
|
||||
#define VDE_START (LCD_CONTROL_BLOCK_BASE|0x4C)
|
||||
#define VDE_SIZE (LCD_CONTROL_BLOCK_BASE|0x50)
|
||||
#define WAKEUP (LCD_CONTROL_BLOCK_BASE|0x54)
|
||||
#define WSYN_DLY (LCD_CONTROL_BLOCK_BASE|0x58)
|
||||
#define REGENB (LCD_CONTROL_BLOCK_BASE|0x5C)
|
||||
#define VSYNIF (LCD_CONTROL_BLOCK_BASE|0x60)
|
||||
#define WRSTB (LCD_CONTROL_BLOCK_BASE|0x64)
|
||||
#define RDSTB (LCD_CONTROL_BLOCK_BASE|0x68)
|
||||
#define ASY_DATA (LCD_CONTROL_BLOCK_BASE|0x6C)
|
||||
#define ASY_DATB (LCD_CONTROL_BLOCK_BASE|0x70)
|
||||
#define ASY_DATC (LCD_CONTROL_BLOCK_BASE|0x74)
|
||||
#define ASY_DATD (LCD_CONTROL_BLOCK_BASE|0x78)
|
||||
#define ASY_DATE (LCD_CONTROL_BLOCK_BASE|0x7C)
|
||||
#define ASY_DATF (LCD_CONTROL_BLOCK_BASE|0x80)
|
||||
#define ASY_DATG (LCD_CONTROL_BLOCK_BASE|0x84)
|
||||
#define ASY_DATH (LCD_CONTROL_BLOCK_BASE|0x88)
|
||||
#define ASY_CMDSET (LCD_CONTROL_BLOCK_BASE|0x8C)
|
||||
|
||||
#define SSICTL (SPI_BLOCK_BASE|0x00)
|
||||
#define SSITIME (SPI_BLOCK_BASE|0x04)
|
||||
#define SSITX (SPI_BLOCK_BASE|0x08)
|
||||
#define SSIRX (SPI_BLOCK_BASE|0x0C)
|
||||
#define SSIINTC (SPI_BLOCK_BASE|0x10)
|
||||
#define SSIINTS (SPI_BLOCK_BASE|0x14)
|
||||
#define SSIDBG1 (SPI_BLOCK_BASE|0x18)
|
||||
#define SSIDBG2 (SPI_BLOCK_BASE|0x1C)
|
||||
#define SSIID (SPI_BLOCK_BASE|0x20)
|
||||
|
||||
#define WKREQ (SYSTEM_BLOCK1_BASE|0x00)
|
||||
#define CLKENB (SYSTEM_BLOCK1_BASE|0x04)
|
||||
#define DRAMPWR (SYSTEM_BLOCK1_BASE|0x08)
|
||||
#define INTMASK (SYSTEM_BLOCK1_BASE|0x0C)
|
||||
#define GPIOSEL (SYSTEM_BLOCK2_BASE|0x00)
|
||||
|
||||
#define GPIODATA (GPIO_BLOCK_BASE|0x00)
|
||||
#define GPIODIR (GPIO_BLOCK_BASE|0x04)
|
||||
#define GPIOIS (GPIO_BLOCK_BASE|0x08)
|
||||
#define GPIOIBE (GPIO_BLOCK_BASE|0x0C)
|
||||
#define GPIOIEV (GPIO_BLOCK_BASE|0x10)
|
||||
#define GPIOIE (GPIO_BLOCK_BASE|0x14)
|
||||
#define GPIORIS (GPIO_BLOCK_BASE|0x18)
|
||||
#define GPIOMIS (GPIO_BLOCK_BASE|0x1C)
|
||||
#define GPIOIC (GPIO_BLOCK_BASE|0x20)
|
||||
#define GPIOOMS (GPIO_BLOCK_BASE|0x24)
|
||||
#define GPIOPC (GPIO_BLOCK_BASE|0x28)
|
||||
#define GPIOID (GPIO_BLOCK_BASE|0x30)
|
||||
|
||||
#define SPI_WRITE(reg, val) \
|
||||
{ SSITX, 0x00010000 | (((reg) & 0xff) << 8) | ((val) & 0xff) }, \
|
||||
{ 0, 5 },
|
||||
|
||||
#define SPI_WRITE1(reg) \
|
||||
{ SSITX, (reg) & 0xff }, \
|
||||
{ 0, 5 },
|
||||
|
||||
struct mddi_table {
|
||||
uint32_t reg;
|
||||
uint32_t value;
|
||||
};
|
||||
static struct mddi_table mddi_toshiba_init_table[] = {
|
||||
{ DPSET0, 0x09e90046 },
|
||||
{ DPSET1, 0x00000118 },
|
||||
{ DPSUS, 0x00000000 },
|
||||
{ DPRUN, 0x00000001 },
|
||||
{ 1, 14 }, /* msleep 14 */
|
||||
{ SYSCKENA, 0x00000001 },
|
||||
//{ CLKENB, 0x000000EF },
|
||||
{ CLKENB, 0x0000A1EF }, /* # SYS.CLKENB # Enable clocks for each module (without DCLK , i2cCLK) */
|
||||
//{ CLKENB, 0x000025CB }, /* Clock enable register */
|
||||
|
||||
{ GPIODATA, 0x02000200 }, /* # GPI .GPIODATA # GPIO2(RESET_LCD_N) set to 0 , GPIO3(eDRAM_Power) set to 0 */
|
||||
{ GPIODIR, 0x000030D }, /* 24D # GPI .GPIODIR # Select direction of GPIO port (0,2,3,6,9 output) */
|
||||
{ GPIOSEL, 0/*0x00000173*/}, /* # SYS.GPIOSEL # GPIO port multiplexing control */
|
||||
{ GPIOPC, 0x03C300C0 }, /* # GPI .GPIOPC # GPIO2,3 PD cut */
|
||||
{ WKREQ, 0x00000000 }, /* # SYS.WKREQ # Wake-up request event is VSYNC alignment */
|
||||
|
||||
{ GPIOIBE, 0x000003FF },
|
||||
{ GPIOIS, 0x00000000 },
|
||||
{ GPIOIC, 0x000003FF },
|
||||
{ GPIOIE, 0x00000000 },
|
||||
|
||||
{ GPIODATA, 0x00040004 }, /* # GPI .GPIODATA # eDRAM VD supply */
|
||||
{ 1, 1 }, /* msleep 1 */
|
||||
{ GPIODATA, 0x02040004 }, /* # GPI .GPIODATA # eDRAM VD supply */
|
||||
{ DRAMPWR, 0x00000001 }, /* eDRAM power */
|
||||
};
|
||||
|
||||
static struct mddi_table mddi_toshiba_panel_init_table[] = {
|
||||
{ SRST, 0x00000003 }, /* FIFO/LCDC not reset */
|
||||
{ PORT_ENB, 0x00000001 }, /* Enable sync. Port */
|
||||
{ START, 0x00000000 }, /* To stop operation */
|
||||
//{ START, 0x00000001 }, /* To start operation */
|
||||
{ PORT, 0x00000004 }, /* Polarity of VS/HS/DE. */
|
||||
{ CMN, 0x00000000 },
|
||||
{ GAMMA, 0x00000000 }, /* No Gamma correction */
|
||||
{ INTFLG, 0x00000000 }, /* VSYNC interrupt flag clear/status */
|
||||
{ INTMSK, 0x00000000 }, /* VSYNC interrupt mask is off. */
|
||||
{ MPLFBUF, 0x00000000 }, /* Select frame buffer's base address. */
|
||||
{ HDE_LEFT, 0x00000000 }, /* The value of HDE_LEFT. */
|
||||
{ VDE_TOP, 0x00000000 }, /* The value of VDE_TPO. */
|
||||
{ PXL, 0x00000001 }, /* 1. RGB666 */
|
||||
/* 2. Data is valid from 1st frame of beginning. */
|
||||
{ HDE_START, 0x00000006 }, /* HDE_START= 14 PCLK */
|
||||
{ HDE_SIZE, 0x0000009F }, /* HDE_SIZE=320 PCLK */
|
||||
{ HSW, 0x00000004 }, /* HSW= 10 PCLK */
|
||||
{ VSW, 0x00000001 }, /* VSW=2 HCYCLE */
|
||||
{ VDE_START, 0x00000003 }, /* VDE_START=4 HCYCLE */
|
||||
{ VDE_SIZE, 0x000001DF }, /* VDE_SIZE=480 HCYCLE */
|
||||
{ WAKEUP, 0x000001e2 }, /* Wakeup position in VSYNC mode. */
|
||||
{ WSYN_DLY, 0x00000000 }, /* Wakeup position in VSIN mode. */
|
||||
{ REGENB, 0x00000001 }, /* Set 1 to enable to change the value of registers. */
|
||||
{ CLKENB, 0x000025CB }, /* Clock enable register */
|
||||
|
||||
{ SSICTL, 0x00000170 }, /* SSI control register */
|
||||
{ SSITIME, 0x00000250 }, /* SSI timing control register */
|
||||
{ SSICTL, 0x00000172 }, /* SSI control register */
|
||||
};
|
||||
|
||||
|
||||
static struct mddi_table mddi_sharp_init_table[] = {
|
||||
{ VCYCLE, 0x000001eb },
|
||||
{ HCYCLE, 0x000000ae },
|
||||
{ REGENB, 0x00000001 }, /* Set 1 to enable to change the value of registers. */
|
||||
{ GPIODATA, 0x00040000 }, /* GPIO2 low */
|
||||
{ GPIODIR, 0x00000004 }, /* GPIO2 out */
|
||||
{ 1, 1 }, /* msleep 1 */
|
||||
{ GPIODATA, 0x00040004 }, /* GPIO2 high */
|
||||
{ 1, 10 }, /* msleep 10 */
|
||||
SPI_WRITE(0x5f, 0x01)
|
||||
SPI_WRITE1(0x11)
|
||||
{ 1, 200 }, /* msleep 200 */
|
||||
SPI_WRITE1(0x29)
|
||||
SPI_WRITE1(0xde)
|
||||
{ START, 0x00000001 }, /* To start operation */
|
||||
};
|
||||
|
||||
static struct mddi_table mddi_sharp_deinit_table[] = {
|
||||
{ 1, 200 }, /* msleep 200 */
|
||||
SPI_WRITE(0x10, 0x1)
|
||||
{ 1, 100 }, /* msleep 100 */
|
||||
{ GPIODATA, 0x00040004 }, /* GPIO2 high */
|
||||
{ GPIODIR, 0x00000004 }, /* GPIO2 out */
|
||||
{ GPIODATA, 0x00040000 }, /* GPIO2 low */
|
||||
{ 1, 10 }, /* msleep 10 */
|
||||
};
|
||||
|
||||
static struct mddi_table mddi_tpo_init_table[] = {
|
||||
{ VCYCLE, 0x000001e5 },
|
||||
{ HCYCLE, 0x000000ac },
|
||||
{ REGENB, 0x00000001 }, /* Set 1 to enable to change the value of registers. */
|
||||
{ 0, 20 }, /* udelay 20 */
|
||||
{ GPIODATA, 0x00000004 }, /* GPIO2 high */
|
||||
{ GPIODIR, 0x00000004 }, /* GPIO2 out */
|
||||
{ 0, 20 }, /* udelay 20 */
|
||||
|
||||
SPI_WRITE(0x08, 0x01)
|
||||
{ 0, 500 }, /* udelay 500 */
|
||||
SPI_WRITE(0x08, 0x00)
|
||||
SPI_WRITE(0x02, 0x00)
|
||||
SPI_WRITE(0x03, 0x04)
|
||||
SPI_WRITE(0x04, 0x0e)
|
||||
SPI_WRITE(0x09, 0x02)
|
||||
SPI_WRITE(0x0b, 0x08)
|
||||
SPI_WRITE(0x0c, 0x53)
|
||||
SPI_WRITE(0x0d, 0x01)
|
||||
SPI_WRITE(0x0e, 0xe0)
|
||||
SPI_WRITE(0x0f, 0x01)
|
||||
SPI_WRITE(0x10, 0x58)
|
||||
SPI_WRITE(0x20, 0x1e)
|
||||
SPI_WRITE(0x21, 0x0a)
|
||||
SPI_WRITE(0x22, 0x0a)
|
||||
SPI_WRITE(0x23, 0x1e)
|
||||
SPI_WRITE(0x25, 0x32)
|
||||
SPI_WRITE(0x26, 0x00)
|
||||
SPI_WRITE(0x27, 0xac)
|
||||
SPI_WRITE(0x29, 0x06)
|
||||
SPI_WRITE(0x2a, 0xa4)
|
||||
SPI_WRITE(0x2b, 0x45)
|
||||
SPI_WRITE(0x2c, 0x45)
|
||||
SPI_WRITE(0x2d, 0x15)
|
||||
SPI_WRITE(0x2e, 0x5a)
|
||||
SPI_WRITE(0x2f, 0xff)
|
||||
SPI_WRITE(0x30, 0x6b)
|
||||
SPI_WRITE(0x31, 0x0d)
|
||||
SPI_WRITE(0x32, 0x48)
|
||||
SPI_WRITE(0x33, 0x82)
|
||||
SPI_WRITE(0x34, 0xbd)
|
||||
SPI_WRITE(0x35, 0xe7)
|
||||
SPI_WRITE(0x36, 0x18)
|
||||
SPI_WRITE(0x37, 0x94)
|
||||
SPI_WRITE(0x38, 0x01)
|
||||
SPI_WRITE(0x39, 0x5d)
|
||||
SPI_WRITE(0x3a, 0xae)
|
||||
SPI_WRITE(0x3b, 0xff)
|
||||
SPI_WRITE(0x07, 0x09)
|
||||
{ 0, 10 }, /* udelay 10 */
|
||||
{ START, 0x00000001 }, /* To start operation */
|
||||
};
|
||||
|
||||
static struct mddi_table mddi_tpo_deinit_table[] = {
|
||||
SPI_WRITE(0x07, 0x19)
|
||||
{ START, 0x00000000 }, /* To stop operation */
|
||||
{ GPIODATA, 0x00040004 }, /* GPIO2 high */
|
||||
{ GPIODIR, 0x00000004 }, /* GPIO2 out */
|
||||
{ GPIODATA, 0x00040000 }, /* GPIO2 low */
|
||||
{ 0, 5 }, /* usleep 5 */
|
||||
};
|
||||
|
||||
|
||||
#define GPIOSEL_VWAKEINT (1U << 0)
|
||||
#define INTMASK_VWAKEOUT (1U << 0)
|
||||
|
||||
static void trout_process_mddi_table(struct msm_mddi_client_data *client_data,
|
||||
struct mddi_table *table, size_t count)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < count; i++) {
|
||||
uint32_t reg = table[i].reg;
|
||||
uint32_t value = table[i].value;
|
||||
|
||||
if (reg == 0)
|
||||
udelay(value);
|
||||
else if (reg == 1)
|
||||
msleep(value);
|
||||
else
|
||||
client_data->remote_write(client_data, value, reg);
|
||||
}
|
||||
}
|
||||
|
||||
static struct vreg *vreg_mddi_1v5;
|
||||
static struct vreg *vreg_lcm_2v85;
|
||||
|
||||
static void trout_mddi_power_client(struct msm_mddi_client_data *client_data,
|
||||
int on)
|
||||
{
|
||||
unsigned id, on_off;
|
||||
if(on) {
|
||||
on_off = 0;
|
||||
id = PM_VREG_PDOWN_MDDI_ID;
|
||||
msm_proc_comm(PCOM_VREG_PULLDOWN, &on_off, &id);
|
||||
vreg_enable(vreg_mddi_1v5);
|
||||
mdelay(5); // delay time >5ms and <10ms
|
||||
gpio_set_value(V_VDDE2E_VDD2_GPIO, 1);
|
||||
gpio_set_value(TROUT_GPIO_MDDI_32K_EN, 1);
|
||||
msleep(3);
|
||||
id = PM_VREG_PDOWN_AUX_ID;
|
||||
msm_proc_comm(PCOM_VREG_PULLDOWN, &on_off, &id);
|
||||
vreg_enable(vreg_lcm_2v85);
|
||||
msleep(3);
|
||||
gpio_set_value(MDDI_RST_N, 1);
|
||||
msleep(10);
|
||||
} else {
|
||||
gpio_set_value(TROUT_GPIO_MDDI_32K_EN, 0);
|
||||
gpio_set_value(MDDI_RST_N, 0);
|
||||
msleep(10);
|
||||
vreg_disable(vreg_lcm_2v85);
|
||||
on_off = 1;
|
||||
id = PM_VREG_PDOWN_AUX_ID;
|
||||
msm_proc_comm(PCOM_VREG_PULLDOWN, &on_off, &id);
|
||||
msleep(5);
|
||||
gpio_set_value(V_VDDE2E_VDD2_GPIO, 0);
|
||||
msleep(200);
|
||||
vreg_disable(vreg_mddi_1v5);
|
||||
id = PM_VREG_PDOWN_MDDI_ID;
|
||||
msm_proc_comm(PCOM_VREG_PULLDOWN, &on_off, &id);
|
||||
}
|
||||
}
|
||||
|
||||
static int trout_mddi_toshiba_client_init(
|
||||
struct msm_mddi_bridge_platform_data *bridge_data,
|
||||
struct msm_mddi_client_data *client_data)
|
||||
{
|
||||
int panel_id;
|
||||
|
||||
client_data->auto_hibernate(client_data, 0);
|
||||
trout_process_mddi_table(client_data, mddi_toshiba_init_table,
|
||||
ARRAY_SIZE(mddi_toshiba_init_table));
|
||||
client_data->auto_hibernate(client_data, 1);
|
||||
panel_id = (client_data->remote_read(client_data, GPIODATA) >> 4) & 3;
|
||||
if (panel_id > 1) {
|
||||
printk("unknown panel id at mddi_enable\n");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int trout_mddi_toshiba_client_uninit(
|
||||
struct msm_mddi_bridge_platform_data *bridge_data,
|
||||
struct msm_mddi_client_data *client_data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int trout_mddi_panel_unblank(
|
||||
struct msm_mddi_bridge_platform_data *bridge_data,
|
||||
struct msm_mddi_client_data *client_data)
|
||||
{
|
||||
|
||||
int panel_id, ret = 0;
|
||||
|
||||
trout_set_backlight_level(0);
|
||||
client_data->auto_hibernate(client_data, 0);
|
||||
trout_process_mddi_table(client_data, mddi_toshiba_panel_init_table,
|
||||
ARRAY_SIZE(mddi_toshiba_panel_init_table));
|
||||
panel_id = (client_data->remote_read(client_data, GPIODATA) >> 4) & 3;
|
||||
switch(panel_id) {
|
||||
case 0:
|
||||
printk("init sharp panel\n");
|
||||
trout_process_mddi_table(client_data,
|
||||
mddi_sharp_init_table,
|
||||
ARRAY_SIZE(mddi_sharp_init_table));
|
||||
break;
|
||||
case 1:
|
||||
printk("init tpo panel\n");
|
||||
trout_process_mddi_table(client_data,
|
||||
mddi_tpo_init_table,
|
||||
ARRAY_SIZE(mddi_tpo_init_table));
|
||||
break;
|
||||
default:
|
||||
printk("unknown panel_id: %d\n", panel_id);
|
||||
ret = -1;
|
||||
};
|
||||
mutex_lock(&trout_backlight_lock);
|
||||
trout_set_backlight_level(trout_backlight_brightness);
|
||||
trout_backlight_off = 0;
|
||||
mutex_unlock(&trout_backlight_lock);
|
||||
client_data->auto_hibernate(client_data, 1);
|
||||
client_data->remote_write(client_data, GPIOSEL_VWAKEINT, GPIOSEL);
|
||||
client_data->remote_write(client_data, INTMASK_VWAKEOUT, INTMASK);
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
static int trout_mddi_panel_blank(
|
||||
struct msm_mddi_bridge_platform_data *bridge_data,
|
||||
struct msm_mddi_client_data *client_data)
|
||||
{
|
||||
int panel_id, ret = 0;
|
||||
|
||||
panel_id = (client_data->remote_read(client_data, GPIODATA) >> 4) & 3;
|
||||
client_data->auto_hibernate(client_data, 0);
|
||||
switch(panel_id) {
|
||||
case 0:
|
||||
printk("deinit sharp panel\n");
|
||||
trout_process_mddi_table(client_data,
|
||||
mddi_sharp_deinit_table,
|
||||
ARRAY_SIZE(mddi_sharp_deinit_table));
|
||||
break;
|
||||
case 1:
|
||||
printk("deinit tpo panel\n");
|
||||
trout_process_mddi_table(client_data,
|
||||
mddi_tpo_deinit_table,
|
||||
ARRAY_SIZE(mddi_tpo_deinit_table));
|
||||
break;
|
||||
default:
|
||||
printk("unknown panel_id: %d\n", panel_id);
|
||||
ret = -1;
|
||||
};
|
||||
client_data->auto_hibernate(client_data, 1);
|
||||
mutex_lock(&trout_backlight_lock);
|
||||
trout_set_backlight_level(0);
|
||||
trout_backlight_off = 1;
|
||||
mutex_unlock(&trout_backlight_lock);
|
||||
client_data->remote_write(client_data, 0, SYSCLKENA);
|
||||
client_data->remote_write(client_data, 1, DPSUS);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void trout_brightness_set(struct led_classdev *led_cdev, enum led_brightness value)
|
||||
{
|
||||
mutex_lock(&trout_backlight_lock);
|
||||
trout_backlight_brightness = value;
|
||||
if(!trout_backlight_off)
|
||||
trout_set_backlight_level(trout_backlight_brightness);
|
||||
mutex_unlock(&trout_backlight_lock);
|
||||
}
|
||||
|
||||
static struct led_classdev trout_backlight_led = {
|
||||
.name = "lcd-backlight",
|
||||
.brightness = TROUT_DEFAULT_BACKLIGHT_BRIGHTNESS,
|
||||
.brightness_set = trout_brightness_set,
|
||||
};
|
||||
|
||||
static int trout_backlight_probe(struct platform_device *pdev)
|
||||
{
|
||||
led_classdev_register(&pdev->dev, &trout_backlight_led);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int trout_backlight_remove(struct platform_device *pdev)
|
||||
{
|
||||
led_classdev_unregister(&trout_backlight_led);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver trout_backlight_driver = {
|
||||
.probe = trout_backlight_probe,
|
||||
.remove = trout_backlight_remove,
|
||||
.driver = {
|
||||
.name = "trout-backlight",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
};
|
||||
|
||||
static struct resource resources_msm_fb[] = {
|
||||
{
|
||||
.start = MSM_FB_BASE,
|
||||
.end = MSM_FB_BASE + MSM_FB_SIZE,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
};
|
||||
|
||||
struct msm_mddi_bridge_platform_data toshiba_client_data = {
|
||||
.init = trout_mddi_toshiba_client_init,
|
||||
.uninit = trout_mddi_toshiba_client_uninit,
|
||||
.blank = trout_mddi_panel_blank,
|
||||
.unblank = trout_mddi_panel_unblank,
|
||||
.fb_data = {
|
||||
.xres = 320,
|
||||
.yres = 480,
|
||||
.width = 45,
|
||||
.height = 67,
|
||||
.output_format = 0,
|
||||
},
|
||||
};
|
||||
|
||||
static struct msm_mddi_platform_data mddi_pdata = {
|
||||
.clk_rate = 122880000,
|
||||
.power_client = trout_mddi_power_client,
|
||||
.fb_resource = resources_msm_fb,
|
||||
.num_clients = 1,
|
||||
.client_platform_data = {
|
||||
{
|
||||
.product_id = (0xd263 << 16 | 0),
|
||||
.name = "mddi_c_d263_0000",
|
||||
//.name = "mddi_c_dummy",
|
||||
.id = 0,
|
||||
.client_data = &toshiba_client_data,
|
||||
//.client_data = &toshiba_client_data.fb_data,
|
||||
.clk_rate = 0,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device trout_backlight = {
|
||||
.name = "trout-backlight",
|
||||
};
|
||||
|
||||
int __init trout_init_panel(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (!machine_is_trout())
|
||||
return 0;
|
||||
vreg_mddi_1v5 = vreg_get(0, "gp2");
|
||||
if (IS_ERR(vreg_mddi_1v5))
|
||||
return PTR_ERR(vreg_mddi_1v5);
|
||||
vreg_lcm_2v85 = vreg_get(0, "gp4");
|
||||
if (IS_ERR(vreg_lcm_2v85))
|
||||
return PTR_ERR(vreg_lcm_2v85);
|
||||
|
||||
trout_new_backlight = system_rev >= 5;
|
||||
if (trout_new_backlight) {
|
||||
uint32_t config = PCOM_GPIO_CFG(27, 0, GPIO_OUTPUT,
|
||||
GPIO_NO_PULL, GPIO_8MA);
|
||||
msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &config, 0);
|
||||
}
|
||||
else {
|
||||
uint32_t config = PCOM_GPIO_CFG(27, 1, GPIO_OUTPUT,
|
||||
GPIO_NO_PULL, GPIO_8MA);
|
||||
msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &config, 0);
|
||||
|
||||
gp_clk = clk_get(NULL, "gp_clk");
|
||||
if (IS_ERR(gp_clk)) {
|
||||
printk(KERN_ERR "trout_init_panel: could not get gp"
|
||||
"clock\n");
|
||||
gp_clk = NULL;
|
||||
}
|
||||
rc = clk_set_rate(gp_clk, 19200000);
|
||||
if (rc)
|
||||
printk(KERN_ERR "trout_init_panel: set clock rate "
|
||||
"failed\n");
|
||||
}
|
||||
|
||||
rc = platform_device_register(&msm_device_mdp);
|
||||
if (rc)
|
||||
return rc;
|
||||
msm_device_mddi0.dev.platform_data = &mddi_pdata;
|
||||
rc = platform_device_register(&msm_device_mddi0);
|
||||
if (rc)
|
||||
return rc;
|
||||
platform_device_register(&trout_backlight);
|
||||
return platform_driver_register(&trout_backlight_driver);
|
||||
}
|
||||
|
||||
device_initcall(trout_init_panel);
|
@ -1,101 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Google, Inc.
|
||||
* Author: Nick Pelly <npelly@google.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Control bluetooth power for trout platform */
|
||||
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/rfkill.h>
|
||||
#include <linux/delay.h>
|
||||
#include <asm/gpio.h>
|
||||
|
||||
#include "board-trout.h"
|
||||
|
||||
static struct rfkill *bt_rfk;
|
||||
static const char bt_name[] = "brf6300";
|
||||
|
||||
static int bluetooth_set_power(void *data, bool blocked)
|
||||
{
|
||||
if (!blocked) {
|
||||
gpio_set_value(TROUT_GPIO_BT_32K_EN, 1);
|
||||
udelay(10);
|
||||
gpio_direction_output(101, 1);
|
||||
} else {
|
||||
gpio_direction_output(101, 0);
|
||||
gpio_set_value(TROUT_GPIO_BT_32K_EN, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct rfkill_ops trout_rfkill_ops = {
|
||||
.set_block = bluetooth_set_power,
|
||||
};
|
||||
|
||||
static int trout_rfkill_probe(struct platform_device *pdev)
|
||||
{
|
||||
int rc = 0;
|
||||
bool default_state = true; /* off */
|
||||
|
||||
bluetooth_set_power(NULL, default_state);
|
||||
|
||||
bt_rfk = rfkill_alloc(bt_name, &pdev->dev, RFKILL_TYPE_BLUETOOTH,
|
||||
&trout_rfkill_ops, NULL);
|
||||
if (!bt_rfk)
|
||||
return -ENOMEM;
|
||||
|
||||
rfkill_set_states(bt_rfk, default_state, false);
|
||||
|
||||
/* userspace cannot take exclusive control */
|
||||
|
||||
rc = rfkill_register(bt_rfk);
|
||||
|
||||
if (rc)
|
||||
rfkill_destroy(bt_rfk);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int trout_rfkill_remove(struct platform_device *dev)
|
||||
{
|
||||
rfkill_unregister(bt_rfk);
|
||||
rfkill_destroy(bt_rfk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver trout_rfkill_driver = {
|
||||
.probe = trout_rfkill_probe,
|
||||
.remove = trout_rfkill_remove,
|
||||
.driver = {
|
||||
.name = "trout_rfkill",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
};
|
||||
|
||||
static int __init trout_rfkill_init(void)
|
||||
{
|
||||
return platform_driver_register(&trout_rfkill_driver);
|
||||
}
|
||||
|
||||
static void __exit trout_rfkill_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&trout_rfkill_driver);
|
||||
}
|
||||
|
||||
module_init(trout_rfkill_init);
|
||||
module_exit(trout_rfkill_exit);
|
||||
MODULE_DESCRIPTION("trout rfkill");
|
||||
MODULE_AUTHOR("Nick Pelly <npelly@google.com>");
|
||||
MODULE_LICENSE("GPL");
|
@ -1,74 +0,0 @@
|
||||
/* arch/arm/mach-msm/board-trout-wifi.c
|
||||
*
|
||||
* Copyright (C) 2008 Google, Inc.
|
||||
* Author: Dmitry Shmidt <dimitrysh@google.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_WIFI_CONTROL_FUNC
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/wifi_tiwlan.h>
|
||||
|
||||
extern int trout_wifi_set_carddetect(int val);
|
||||
extern int trout_wifi_power(int on);
|
||||
extern int trout_wifi_reset(int on);
|
||||
|
||||
#ifdef CONFIG_WIFI_MEM_PREALLOC
|
||||
typedef struct wifi_mem_prealloc_struct {
|
||||
void *mem_ptr;
|
||||
unsigned long size;
|
||||
} wifi_mem_prealloc_t;
|
||||
|
||||
static wifi_mem_prealloc_t wifi_mem_array[WMPA_NUMBER_OF_SECTIONS] = {
|
||||
{ NULL, (WMPA_SECTION_SIZE_0 + WMPA_SECTION_HEADER) },
|
||||
{ NULL, (WMPA_SECTION_SIZE_1 + WMPA_SECTION_HEADER) },
|
||||
{ NULL, (WMPA_SECTION_SIZE_2 + WMPA_SECTION_HEADER) }
|
||||
};
|
||||
|
||||
static void *trout_wifi_mem_prealloc(int section, unsigned long size)
|
||||
{
|
||||
if( (section < 0) || (section >= WMPA_NUMBER_OF_SECTIONS) )
|
||||
return NULL;
|
||||
if( wifi_mem_array[section].size < size )
|
||||
return NULL;
|
||||
return wifi_mem_array[section].mem_ptr;
|
||||
}
|
||||
|
||||
int __init trout_init_wifi_mem( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0;( i < WMPA_NUMBER_OF_SECTIONS );i++) {
|
||||
wifi_mem_array[i].mem_ptr = vmalloc(wifi_mem_array[i].size);
|
||||
if( wifi_mem_array[i].mem_ptr == NULL )
|
||||
return -ENOMEM;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct wifi_platform_data trout_wifi_control = {
|
||||
.set_power = trout_wifi_power,
|
||||
.set_reset = trout_wifi_reset,
|
||||
.set_carddetect = trout_wifi_set_carddetect,
|
||||
#ifdef CONFIG_WIFI_MEM_PREALLOC
|
||||
.mem_prealloc = trout_wifi_mem_prealloc,
|
||||
#else
|
||||
.mem_prealloc = NULL,
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
@ -1,869 +0,0 @@
|
||||
/* arch/arm/mach-msm/board-trout.c
|
||||
*
|
||||
* Copyright (C) 2008 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/keyreset.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/switch.h>
|
||||
#include <../../../drivers/staging/android/timed_gpio.h>
|
||||
#include <linux/synaptics_i2c_rmi.h>
|
||||
#include <linux/akm8976.h>
|
||||
#include <linux/sysdev.h>
|
||||
#include <linux/android_pmem.h>
|
||||
|
||||
#include <linux/delay.h>
|
||||
|
||||
#include <asm/gpio.h>
|
||||
#include <mach/hardware.h>
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/mach/map.h>
|
||||
#include <asm/mach/flash.h>
|
||||
#include <asm/system.h>
|
||||
#include <mach/system.h>
|
||||
#include <mach/vreg.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/delay.h>
|
||||
#include <asm/setup.h>
|
||||
|
||||
#include <linux/gpio_event.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
|
||||
#include <asm/mach/mmc.h>
|
||||
#include <linux/mmc/sdio_ids.h>
|
||||
#include <linux/msm_audio.h>
|
||||
|
||||
#include "board-trout.h"
|
||||
|
||||
#include "gpio_chip.h"
|
||||
|
||||
#include <mach/board.h>
|
||||
#include <mach/board_htc.h>
|
||||
#include <mach/msm_serial_debugger.h>
|
||||
#include <mach/msm_serial_hs.h>
|
||||
#include <mach/htc_pwrsink.h>
|
||||
#ifdef CONFIG_HTC_HEADSET
|
||||
#include <mach/htc_headset.h>
|
||||
#endif
|
||||
#ifdef CONFIG_WIFI_CONTROL_FUNC
|
||||
#include <linux/wifi_tiwlan.h>
|
||||
#endif
|
||||
|
||||
#include "proc_comm.h"
|
||||
#include "devices.h"
|
||||
|
||||
void msm_init_irq(void);
|
||||
void msm_init_gpio(void);
|
||||
|
||||
extern int trout_init_mmc(unsigned int);
|
||||
#ifdef CONFIG_WIFI_CONTROL_FUNC
|
||||
#ifdef CONFIG_WIFI_MEM_PREALLOC
|
||||
extern int trout_init_wifi_mem(void);
|
||||
#endif
|
||||
extern struct wifi_platform_data trout_wifi_control;
|
||||
#endif
|
||||
|
||||
struct trout_axis_info {
|
||||
struct gpio_event_axis_info info;
|
||||
uint16_t in_state;
|
||||
uint16_t out_state;
|
||||
};
|
||||
static bool nav_just_on;
|
||||
static int nav_on_jiffies;
|
||||
|
||||
uint16_t trout_axis_map(struct gpio_event_axis_info *info, uint16_t in)
|
||||
{
|
||||
struct trout_axis_info *ai = container_of(info, struct trout_axis_info, info);
|
||||
uint16_t out = ai->out_state;
|
||||
|
||||
if (nav_just_on) {
|
||||
if (jiffies == nav_on_jiffies || jiffies == nav_on_jiffies + 1)
|
||||
goto ignore;
|
||||
nav_just_on = 0;
|
||||
}
|
||||
if((ai->in_state ^ in) & 1)
|
||||
out--;
|
||||
if((ai->in_state ^ in) & 2)
|
||||
out++;
|
||||
ai->out_state = out;
|
||||
ignore:
|
||||
ai->in_state = in;
|
||||
return out;
|
||||
}
|
||||
|
||||
int trout_nav_power(const struct gpio_event_platform_data *pdata, bool on)
|
||||
{
|
||||
gpio_set_value(TROUT_GPIO_JOG_EN, on);
|
||||
if (on) {
|
||||
nav_just_on = 1;
|
||||
nav_on_jiffies = jiffies;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint32_t trout_4_x_axis_gpios[] = {
|
||||
TROUT_4_BALL_LEFT_0, TROUT_4_BALL_RIGHT_0
|
||||
};
|
||||
static uint32_t trout_5_x_axis_gpios[] = {
|
||||
TROUT_5_BALL_LEFT_0, TROUT_5_BALL_RIGHT_0
|
||||
};
|
||||
|
||||
static struct trout_axis_info trout_x_axis = {
|
||||
.info = {
|
||||
.info.func = gpio_event_axis_func,
|
||||
.count = ARRAY_SIZE(trout_5_x_axis_gpios),
|
||||
.type = EV_REL,
|
||||
.code = REL_X,
|
||||
.decoded_size = 1U << ARRAY_SIZE(trout_5_x_axis_gpios),
|
||||
.map = trout_axis_map,
|
||||
.gpio = trout_5_x_axis_gpios,
|
||||
.flags = GPIOEAF_PRINT_UNKNOWN_DIRECTION /*| GPIOEAF_PRINT_RAW | GPIOEAF_PRINT_EVENT */
|
||||
}
|
||||
};
|
||||
|
||||
static uint32_t trout_4_y_axis_gpios[] = {
|
||||
TROUT_4_BALL_UP_0, TROUT_4_BALL_DOWN_0
|
||||
};
|
||||
static uint32_t trout_5_y_axis_gpios[] = {
|
||||
TROUT_5_BALL_UP_0, TROUT_5_BALL_DOWN_0
|
||||
};
|
||||
|
||||
static struct trout_axis_info trout_y_axis = {
|
||||
.info = {
|
||||
.info.func = gpio_event_axis_func,
|
||||
.count = ARRAY_SIZE(trout_5_y_axis_gpios),
|
||||
.type = EV_REL,
|
||||
.code = REL_Y,
|
||||
.decoded_size = 1U << ARRAY_SIZE(trout_5_y_axis_gpios),
|
||||
.map = trout_axis_map,
|
||||
.gpio = trout_5_y_axis_gpios,
|
||||
.flags = GPIOEAF_PRINT_UNKNOWN_DIRECTION /*| GPIOEAF_PRINT_RAW | GPIOEAF_PRINT_EVENT */
|
||||
}
|
||||
};
|
||||
|
||||
static struct gpio_event_direct_entry trout_nav_buttons[] = {
|
||||
{ TROUT_GPIO_NAVI_ACT_N, BTN_MOUSE }
|
||||
};
|
||||
|
||||
static struct gpio_event_input_info trout_nav_button_info = {
|
||||
.info.func = gpio_event_input_func,
|
||||
.flags = 0,
|
||||
.type = EV_KEY,
|
||||
.keymap = trout_nav_buttons,
|
||||
.keymap_size = ARRAY_SIZE(trout_nav_buttons)
|
||||
};
|
||||
|
||||
static struct gpio_event_info *trout_nav_info[] = {
|
||||
&trout_x_axis.info.info,
|
||||
&trout_y_axis.info.info,
|
||||
&trout_nav_button_info.info
|
||||
};
|
||||
|
||||
static struct gpio_event_platform_data trout_nav_data = {
|
||||
.name = "trout-nav",
|
||||
.info = trout_nav_info,
|
||||
.info_count = ARRAY_SIZE(trout_nav_info),
|
||||
.power = trout_nav_power,
|
||||
};
|
||||
|
||||
static struct platform_device trout_nav_device = {
|
||||
.name = GPIO_EVENT_DEV_NAME,
|
||||
.id = 2,
|
||||
.dev = {
|
||||
.platform_data = &trout_nav_data,
|
||||
},
|
||||
};
|
||||
|
||||
static int trout_reset_keys_up[] = {
|
||||
BTN_MOUSE,
|
||||
0
|
||||
};
|
||||
|
||||
static struct keyreset_platform_data trout_reset_keys_pdata = {
|
||||
.keys_up = trout_reset_keys_up,
|
||||
.keys_down = {
|
||||
KEY_SEND,
|
||||
KEY_MENU,
|
||||
KEY_END,
|
||||
0
|
||||
},
|
||||
};
|
||||
|
||||
struct platform_device trout_reset_keys_device = {
|
||||
.name = KEYRESET_NAME,
|
||||
.dev.platform_data = &trout_reset_keys_pdata,
|
||||
};
|
||||
|
||||
static int trout_ts_power(int on)
|
||||
{
|
||||
int tp_ls_gpio = system_rev < 5 ? TROUT_4_TP_LS_EN : TROUT_5_TP_LS_EN;
|
||||
if (on) {
|
||||
gpio_set_value(TROUT_GPIO_TP_I2C_PULL, 1);
|
||||
gpio_set_value(TROUT_GPIO_TP_EN, 1);
|
||||
/* touchscreen must be powered before we enable i2c pullup */
|
||||
msleep(2);
|
||||
/* enable touch panel level shift */
|
||||
gpio_set_value(tp_ls_gpio, 1);
|
||||
msleep(2);
|
||||
}
|
||||
else {
|
||||
gpio_set_value(tp_ls_gpio, 0);
|
||||
udelay(50);
|
||||
gpio_set_value(TROUT_GPIO_TP_EN, 0);
|
||||
gpio_set_value(TROUT_GPIO_TP_I2C_PULL, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct synaptics_i2c_rmi_platform_data trout_ts_data[] = {
|
||||
{
|
||||
.version = 0x010c,
|
||||
.power = trout_ts_power,
|
||||
.flags = SYNAPTICS_FLIP_Y | SYNAPTICS_SNAP_TO_INACTIVE_EDGE,
|
||||
.inactive_left = -100 * 0x10000 / 4334,
|
||||
.inactive_right = -100 * 0x10000 / 4334,
|
||||
.inactive_top = -40 * 0x10000 / 6696,
|
||||
.inactive_bottom = -40 * 0x10000 / 6696,
|
||||
.snap_left_on = 300 * 0x10000 / 4334,
|
||||
.snap_left_off = 310 * 0x10000 / 4334,
|
||||
.snap_right_on = 300 * 0x10000 / 4334,
|
||||
.snap_right_off = 310 * 0x10000 / 4334,
|
||||
.snap_top_on = 100 * 0x10000 / 6696,
|
||||
.snap_top_off = 110 * 0x10000 / 6696,
|
||||
.snap_bottom_on = 100 * 0x10000 / 6696,
|
||||
.snap_bottom_off = 110 * 0x10000 / 6696,
|
||||
},
|
||||
{
|
||||
.flags = SYNAPTICS_FLIP_Y | SYNAPTICS_SNAP_TO_INACTIVE_EDGE,
|
||||
.inactive_left = ((4674 - 4334) / 2 + 200) * 0x10000 / 4334,
|
||||
.inactive_right = ((4674 - 4334) / 2 + 200) * 0x10000 / 4334,
|
||||
.inactive_top = ((6946 - 6696) / 2) * 0x10000 / 6696,
|
||||
.inactive_bottom = ((6946 - 6696) / 2) * 0x10000 / 6696,
|
||||
}
|
||||
};
|
||||
|
||||
static struct akm8976_platform_data compass_platform_data = {
|
||||
.reset = TROUT_GPIO_COMPASS_RST_N,
|
||||
.clk_on = TROUT_GPIO_COMPASS_32K_EN,
|
||||
.intr = TROUT_GPIO_COMPASS_IRQ,
|
||||
};
|
||||
|
||||
static struct i2c_board_info i2c_devices[] = {
|
||||
{
|
||||
I2C_BOARD_INFO(SYNAPTICS_I2C_RMI_NAME, 0x20),
|
||||
.platform_data = trout_ts_data,
|
||||
.irq = TROUT_GPIO_TO_INT(TROUT_GPIO_TP_ATT_N)
|
||||
},
|
||||
{
|
||||
I2C_BOARD_INFO("elan-touch", 0x10),
|
||||
.irq = TROUT_GPIO_TO_INT(TROUT_GPIO_TP_ATT_N),
|
||||
},
|
||||
{
|
||||
I2C_BOARD_INFO("akm8976", 0x1C),
|
||||
.platform_data = &compass_platform_data,
|
||||
.irq = TROUT_GPIO_TO_INT(TROUT_GPIO_COMPASS_IRQ),
|
||||
},
|
||||
{
|
||||
I2C_BOARD_INFO("pca963x", 0x62),
|
||||
},
|
||||
#if defined(CONFIG_MSM_CAMERA) && defined(CONFIG_MT9T013)
|
||||
{
|
||||
I2C_BOARD_INFO("mt9t013", 0x6C),
|
||||
},
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_MT9T013
|
||||
{
|
||||
I2C_BOARD_INFO("mt9t013", 0x6C >> 1),
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct timed_gpio timed_gpios[] = {
|
||||
{
|
||||
.name = "vibrator",
|
||||
.gpio = TROUT_GPIO_HAPTIC_PWM,
|
||||
.max_timeout = 15000,
|
||||
},
|
||||
{
|
||||
.name = "flash",
|
||||
.gpio = TROUT_GPIO_FLASH_EN,
|
||||
.max_timeout = 400,
|
||||
},
|
||||
};
|
||||
|
||||
static struct timed_gpio_platform_data timed_gpio_data = {
|
||||
.num_gpios = ARRAY_SIZE(timed_gpios),
|
||||
.gpios = timed_gpios,
|
||||
};
|
||||
|
||||
static struct platform_device android_timed_gpios = {
|
||||
.name = "timed-gpio",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &timed_gpio_data,
|
||||
},
|
||||
};
|
||||
|
||||
static struct gpio_led android_led_list[] = {
|
||||
{
|
||||
.name = "spotlight",
|
||||
.gpio = TROUT_GPIO_SPOTLIGHT_EN,
|
||||
},
|
||||
{
|
||||
.name = "keyboard-backlight",
|
||||
.gpio = TROUT_GPIO_QTKEY_LED_EN,
|
||||
},
|
||||
{
|
||||
.name = "button-backlight",
|
||||
.gpio = TROUT_GPIO_UI_LED_EN,
|
||||
},
|
||||
};
|
||||
|
||||
static struct gpio_led_platform_data android_leds_data = {
|
||||
.num_leds = ARRAY_SIZE(android_led_list),
|
||||
.leds = android_led_list,
|
||||
};
|
||||
|
||||
static struct platform_device android_leds = {
|
||||
.name = "leds-gpio",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &android_leds_data,
|
||||
},
|
||||
};
|
||||
|
||||
static struct gpio_switch_platform_data sd_door_switch_data = {
|
||||
.name = "sd-door",
|
||||
.gpio = TROUT_GPIO_SD_DOOR_N,
|
||||
.state_on = "open",
|
||||
.state_off = "closed",
|
||||
};
|
||||
|
||||
static struct platform_device sd_door_switch = {
|
||||
.name = "switch-gpio",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &sd_door_switch_data,
|
||||
},
|
||||
};
|
||||
|
||||
#ifdef CONFIG_HTC_HEADSET
|
||||
static void h2w_config_cpld(int route)
|
||||
{
|
||||
switch (route) {
|
||||
case H2W_UART3:
|
||||
gpio_set_value(TROUT_GPIO_H2W_SEL0, 0);
|
||||
gpio_set_value(TROUT_GPIO_H2W_SEL1, 1);
|
||||
break;
|
||||
case H2W_GPIO:
|
||||
gpio_set_value(TROUT_GPIO_H2W_SEL0, 0);
|
||||
gpio_set_value(TROUT_GPIO_H2W_SEL1, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void h2w_init_cpld(void)
|
||||
{
|
||||
h2w_config_cpld(H2W_UART3);
|
||||
gpio_set_value(TROUT_GPIO_H2W_CLK_DIR, 0);
|
||||
gpio_set_value(TROUT_GPIO_H2W_DAT_DIR, 0);
|
||||
}
|
||||
|
||||
static struct h2w_platform_data trout_h2w_data = {
|
||||
.cable_in1 = TROUT_GPIO_CABLE_IN1,
|
||||
.cable_in2 = TROUT_GPIO_CABLE_IN2,
|
||||
.h2w_clk = TROUT_GPIO_H2W_CLK_GPI,
|
||||
.h2w_data = TROUT_GPIO_H2W_DAT_GPI,
|
||||
.debug_uart = H2W_UART3,
|
||||
.config_cpld = h2w_config_cpld,
|
||||
.init_cpld = h2w_init_cpld,
|
||||
};
|
||||
|
||||
static struct platform_device trout_h2w = {
|
||||
.name = "h2w",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &trout_h2w_data,
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
||||
static void trout_phy_reset(void)
|
||||
{
|
||||
gpio_set_value(TROUT_GPIO_USB_PHY_RST_N, 0);
|
||||
mdelay(10);
|
||||
gpio_set_value(TROUT_GPIO_USB_PHY_RST_N, 1);
|
||||
mdelay(10);
|
||||
}
|
||||
|
||||
static void config_camera_on_gpios(void);
|
||||
static void config_camera_off_gpios(void);
|
||||
|
||||
#ifdef CONFIG_MSM_CAMERA
|
||||
static struct msm_camera_device_platform_data msm_camera_device_data = {
|
||||
.camera_gpio_on = config_camera_on_gpios,
|
||||
.camera_gpio_off = config_camera_off_gpios,
|
||||
.ioext.mdcphy = MSM_MDC_PHYS,
|
||||
.ioext.mdcsz = MSM_MDC_SIZE,
|
||||
.ioext.appphy = MSM_CLK_CTL_PHYS,
|
||||
.ioext.appsz = MSM_CLK_CTL_SIZE,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_MT9T013
|
||||
static struct msm_camera_sensor_info msm_camera_sensor_mt9t013_data = {
|
||||
.sensor_name = "mt9t013",
|
||||
.sensor_reset = 108,
|
||||
.sensor_pwd = 85,
|
||||
.vcm_pwd = TROUT_GPIO_VCM_PWDN,
|
||||
.pdata = &msm_camera_device_data,
|
||||
};
|
||||
|
||||
static struct platform_device msm_camera_sensor_mt9t013 = {
|
||||
.name = "msm_camera_mt9t013",
|
||||
.dev = {
|
||||
.platform_data = &msm_camera_sensor_mt9t013_data,
|
||||
},
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SENSORS_MT9T013
|
||||
static struct msm_camera_legacy_device_platform_data msm_camera_device_mt9t013 = {
|
||||
.sensor_reset = 108,
|
||||
.sensor_pwd = 85,
|
||||
.vcm_pwd = TROUT_GPIO_VCM_PWDN,
|
||||
.config_gpio_on = config_camera_on_gpios,
|
||||
.config_gpio_off = config_camera_off_gpios,
|
||||
};
|
||||
|
||||
static struct platform_device trout_camera = {
|
||||
.name = "camera",
|
||||
.dev = {
|
||||
.platform_data = &msm_camera_device_mt9t013,
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
||||
static struct pwr_sink trout_pwrsink_table[] = {
|
||||
{
|
||||
.id = PWRSINK_AUDIO,
|
||||
.ua_max = 90000,
|
||||
},
|
||||
{
|
||||
.id = PWRSINK_BACKLIGHT,
|
||||
.ua_max = 128000,
|
||||
},
|
||||
{
|
||||
.id = PWRSINK_LED_BUTTON,
|
||||
.ua_max = 17000,
|
||||
},
|
||||
{
|
||||
.id = PWRSINK_LED_KEYBOARD,
|
||||
.ua_max = 22000,
|
||||
},
|
||||
{
|
||||
.id = PWRSINK_GP_CLK,
|
||||
.ua_max = 30000,
|
||||
},
|
||||
{
|
||||
.id = PWRSINK_BLUETOOTH,
|
||||
.ua_max = 15000,
|
||||
},
|
||||
{
|
||||
.id = PWRSINK_CAMERA,
|
||||
.ua_max = 0,
|
||||
},
|
||||
{
|
||||
.id = PWRSINK_SDCARD,
|
||||
.ua_max = 0,
|
||||
},
|
||||
{
|
||||
.id = PWRSINK_VIDEO,
|
||||
.ua_max = 0,
|
||||
},
|
||||
{
|
||||
.id = PWRSINK_WIFI,
|
||||
.ua_max = 200000,
|
||||
},
|
||||
{
|
||||
.id = PWRSINK_SYSTEM_LOAD,
|
||||
.ua_max = 100000,
|
||||
.percent_util = 38,
|
||||
},
|
||||
};
|
||||
|
||||
static struct pwr_sink_platform_data trout_pwrsink_data = {
|
||||
.num_sinks = ARRAY_SIZE(trout_pwrsink_table),
|
||||
.sinks = trout_pwrsink_table,
|
||||
.suspend_late = NULL,
|
||||
.resume_early = NULL,
|
||||
.suspend_early = NULL,
|
||||
.resume_late = NULL,
|
||||
};
|
||||
|
||||
static struct platform_device trout_pwr_sink = {
|
||||
.name = "htc_pwrsink",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &trout_pwrsink_data,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device trout_rfkill = {
|
||||
.name = "trout_rfkill",
|
||||
.id = -1,
|
||||
};
|
||||
|
||||
static struct msm_pmem_setting pmem_setting = {
|
||||
.pmem_start = MSM_PMEM_MDP_BASE,
|
||||
.pmem_size = MSM_PMEM_MDP_SIZE,
|
||||
.pmem_adsp_start = MSM_PMEM_ADSP_BASE,
|
||||
.pmem_adsp_size = MSM_PMEM_ADSP_SIZE,
|
||||
.pmem_gpu0_start = MSM_PMEM_GPU0_BASE,
|
||||
.pmem_gpu0_size = MSM_PMEM_GPU0_SIZE,
|
||||
.pmem_gpu1_start = MSM_PMEM_GPU1_BASE,
|
||||
.pmem_gpu1_size = MSM_PMEM_GPU1_SIZE,
|
||||
.pmem_camera_start = MSM_PMEM_CAMERA_BASE,
|
||||
.pmem_camera_size = MSM_PMEM_CAMERA_SIZE,
|
||||
.ram_console_start = MSM_RAM_CONSOLE_BASE,
|
||||
.ram_console_size = MSM_RAM_CONSOLE_SIZE,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_WIFI_CONTROL_FUNC
|
||||
static struct platform_device trout_wifi = {
|
||||
.name = "msm_wifi",
|
||||
.id = 1,
|
||||
.num_resources = 0,
|
||||
.resource = NULL,
|
||||
.dev = {
|
||||
.platform_data = &trout_wifi_control,
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
||||
#define SND(num, desc) { .name = desc, .id = num }
|
||||
static struct snd_endpoint snd_endpoints_list[] = {
|
||||
SND(0, "HANDSET"),
|
||||
SND(1, "SPEAKER"),
|
||||
SND(2, "HEADSET"),
|
||||
SND(3, "BT"),
|
||||
SND(44, "BT_EC_OFF"),
|
||||
SND(10, "HEADSET_AND_SPEAKER"),
|
||||
SND(256, "CURRENT"),
|
||||
|
||||
/* Bluetooth accessories. */
|
||||
|
||||
SND(12, "HTC BH S100"),
|
||||
SND(13, "HTC BH M100"),
|
||||
SND(14, "Motorola H500"),
|
||||
SND(15, "Nokia HS-36W"),
|
||||
SND(16, "PLT 510v.D"),
|
||||
SND(17, "M2500 by Plantronics"),
|
||||
SND(18, "Nokia HDW-3"),
|
||||
SND(19, "HBH-608"),
|
||||
SND(20, "HBH-DS970"),
|
||||
SND(21, "i.Tech BlueBAND"),
|
||||
SND(22, "Nokia BH-800"),
|
||||
SND(23, "Motorola H700"),
|
||||
SND(24, "HTC BH M200"),
|
||||
SND(25, "Jabra JX10"),
|
||||
SND(26, "320Plantronics"),
|
||||
SND(27, "640Plantronics"),
|
||||
SND(28, "Jabra BT500"),
|
||||
SND(29, "Motorola HT820"),
|
||||
SND(30, "HBH-IV840"),
|
||||
SND(31, "6XXPlantronics"),
|
||||
SND(32, "3XXPlantronics"),
|
||||
SND(33, "HBH-PV710"),
|
||||
SND(34, "Motorola H670"),
|
||||
SND(35, "HBM-300"),
|
||||
SND(36, "Nokia BH-208"),
|
||||
SND(37, "Samsung WEP410"),
|
||||
SND(38, "Jabra BT8010"),
|
||||
SND(39, "Motorola S9"),
|
||||
SND(40, "Jabra BT620s"),
|
||||
SND(41, "Nokia BH-902"),
|
||||
SND(42, "HBH-DS220"),
|
||||
SND(43, "HBH-DS980"),
|
||||
};
|
||||
#undef SND
|
||||
|
||||
static struct msm_snd_endpoints trout_snd_endpoints = {
|
||||
.endpoints = snd_endpoints_list,
|
||||
.num = ARRAY_SIZE(snd_endpoints_list),
|
||||
};
|
||||
|
||||
static struct platform_device trout_snd = {
|
||||
.name = "msm_snd",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &trout_snd_endpoints,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device *devices[] __initdata = {
|
||||
&msm_device_smd,
|
||||
&msm_device_nand,
|
||||
&msm_device_i2c,
|
||||
&msm_device_uart1,
|
||||
#if !defined(CONFIG_MSM_SERIAL_DEBUGGER) && !defined(CONFIG_TROUT_H2W)
|
||||
&msm_device_uart3,
|
||||
#endif
|
||||
#ifdef CONFIG_SERIAL_MSM_HS
|
||||
&msm_device_uart_dm1,
|
||||
#endif
|
||||
&trout_nav_device,
|
||||
&trout_reset_keys_device,
|
||||
&android_leds,
|
||||
&sd_door_switch,
|
||||
&android_timed_gpios,
|
||||
#ifdef CONFIG_MT9T013
|
||||
&msm_camera_sensor_mt9t013,
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_MT9T013
|
||||
&trout_camera,
|
||||
#endif
|
||||
&trout_rfkill,
|
||||
#ifdef CONFIG_WIFI_CONTROL_FUNC
|
||||
&trout_wifi,
|
||||
#endif
|
||||
#ifdef CONFIG_HTC_HEADSET
|
||||
&trout_h2w,
|
||||
#endif
|
||||
#ifdef CONFIG_HTC_PWRSINK
|
||||
&trout_pwr_sink,
|
||||
#endif
|
||||
&trout_snd,
|
||||
};
|
||||
|
||||
extern struct sys_timer msm_timer;
|
||||
|
||||
static void __init trout_init_irq(void)
|
||||
{
|
||||
printk("trout_init_irq()\n");
|
||||
msm_init_irq();
|
||||
}
|
||||
|
||||
static uint opt_disable_uart3;
|
||||
|
||||
module_param_named(disable_uart3, opt_disable_uart3, uint, 0);
|
||||
|
||||
static void trout_reset(void)
|
||||
{
|
||||
gpio_set_value(TROUT_GPIO_PS_HOLD, 0);
|
||||
}
|
||||
|
||||
static uint32_t gpio_table[] = {
|
||||
/* BLUETOOTH */
|
||||
#ifdef CONFIG_SERIAL_MSM_HS
|
||||
PCOM_GPIO_CFG(43, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* RTS */
|
||||
PCOM_GPIO_CFG(44, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* CTS */
|
||||
PCOM_GPIO_CFG(45, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* RX */
|
||||
PCOM_GPIO_CFG(46, 3, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* TX */
|
||||
#else
|
||||
PCOM_GPIO_CFG(43, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* RTS */
|
||||
PCOM_GPIO_CFG(44, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* CTS */
|
||||
PCOM_GPIO_CFG(45, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* RX */
|
||||
PCOM_GPIO_CFG(46, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* TX */
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
static uint32_t camera_off_gpio_table[] = {
|
||||
/* CAMERA */
|
||||
PCOM_GPIO_CFG(2, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT2 */
|
||||
PCOM_GPIO_CFG(3, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT3 */
|
||||
PCOM_GPIO_CFG(4, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT4 */
|
||||
PCOM_GPIO_CFG(5, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT5 */
|
||||
PCOM_GPIO_CFG(6, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT6 */
|
||||
PCOM_GPIO_CFG(7, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT7 */
|
||||
PCOM_GPIO_CFG(8, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT8 */
|
||||
PCOM_GPIO_CFG(9, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT9 */
|
||||
PCOM_GPIO_CFG(10, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT10 */
|
||||
PCOM_GPIO_CFG(11, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT11 */
|
||||
PCOM_GPIO_CFG(12, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* PCLK */
|
||||
PCOM_GPIO_CFG(13, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* HSYNC_IN */
|
||||
PCOM_GPIO_CFG(14, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* VSYNC_IN */
|
||||
PCOM_GPIO_CFG(15, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* MCLK */
|
||||
};
|
||||
|
||||
static uint32_t camera_on_gpio_table[] = {
|
||||
/* CAMERA */
|
||||
PCOM_GPIO_CFG(2, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT2 */
|
||||
PCOM_GPIO_CFG(3, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT3 */
|
||||
PCOM_GPIO_CFG(4, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT4 */
|
||||
PCOM_GPIO_CFG(5, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT5 */
|
||||
PCOM_GPIO_CFG(6, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT6 */
|
||||
PCOM_GPIO_CFG(7, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT7 */
|
||||
PCOM_GPIO_CFG(8, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT8 */
|
||||
PCOM_GPIO_CFG(9, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT9 */
|
||||
PCOM_GPIO_CFG(10, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT10 */
|
||||
PCOM_GPIO_CFG(11, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT11 */
|
||||
PCOM_GPIO_CFG(12, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_16MA), /* PCLK */
|
||||
PCOM_GPIO_CFG(13, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* HSYNC_IN */
|
||||
PCOM_GPIO_CFG(14, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* VSYNC_IN */
|
||||
PCOM_GPIO_CFG(15, 1, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_16MA), /* MCLK */
|
||||
};
|
||||
|
||||
static void config_gpio_table(uint32_t *table, int len)
|
||||
{
|
||||
int n;
|
||||
unsigned id;
|
||||
for(n = 0; n < len; n++) {
|
||||
id = table[n];
|
||||
msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &id, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void config_camera_on_gpios(void)
|
||||
{
|
||||
config_gpio_table(camera_on_gpio_table,
|
||||
ARRAY_SIZE(camera_on_gpio_table));
|
||||
}
|
||||
|
||||
static void config_camera_off_gpios(void)
|
||||
{
|
||||
config_gpio_table(camera_off_gpio_table,
|
||||
ARRAY_SIZE(camera_off_gpio_table));
|
||||
}
|
||||
|
||||
static void __init config_gpios(void)
|
||||
{
|
||||
config_gpio_table(gpio_table, ARRAY_SIZE(gpio_table));
|
||||
config_camera_off_gpios();
|
||||
}
|
||||
|
||||
static struct msm_acpu_clock_platform_data trout_clock_data = {
|
||||
.acpu_switch_time_us = 20,
|
||||
.max_speed_delta_khz = 256000,
|
||||
.vdd_switch_time_us = 62,
|
||||
.power_collapse_khz = 19200000,
|
||||
.wait_for_irq_khz = 128000000,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_SERIAL_MSM_HS
|
||||
static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = {
|
||||
.rx_wakeup_irq = MSM_GPIO_TO_INT(45),
|
||||
.inject_rx_on_wakeup = 1,
|
||||
.rx_to_inject = 0x32,
|
||||
};
|
||||
#endif
|
||||
|
||||
static void __init trout_init(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
printk("trout_init() revision=%d\n", system_rev);
|
||||
|
||||
/*
|
||||
* Setup common MSM GPIOS
|
||||
*/
|
||||
config_gpios();
|
||||
|
||||
msm_hw_reset_hook = trout_reset;
|
||||
|
||||
gpio_direction_output(system_rev < 5 ?
|
||||
TROUT_4_TP_LS_EN : TROUT_5_TP_LS_EN, 0);
|
||||
|
||||
msm_acpu_clock_init(&trout_clock_data);
|
||||
|
||||
#if defined(CONFIG_MSM_SERIAL_DEBUGGER)
|
||||
if (!opt_disable_uart3)
|
||||
msm_serial_debug_init(MSM_UART3_PHYS, INT_UART3,
|
||||
&msm_device_uart3.dev, 1,
|
||||
MSM_GPIO_TO_INT(86));
|
||||
#endif
|
||||
|
||||
/* gpio_configure(108, IRQF_TRIGGER_LOW); */
|
||||
|
||||
/* put the AF VCM in powerdown mode to avoid noise */
|
||||
gpio_set_value(TROUT_GPIO_VCM_PWDN, 1);
|
||||
mdelay(100);
|
||||
|
||||
if (system_rev < 5) {
|
||||
trout_x_axis.info.gpio = trout_4_x_axis_gpios;
|
||||
trout_y_axis.info.gpio = trout_4_y_axis_gpios;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SERIAL_MSM_HS
|
||||
msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
|
||||
#endif
|
||||
msm_add_usb_devices(trout_phy_reset);
|
||||
|
||||
msm_add_mem_devices(&pmem_setting);
|
||||
|
||||
rc = trout_init_mmc(system_rev);
|
||||
if (rc)
|
||||
printk(KERN_CRIT "%s: MMC init failure (%d)\n", __func__, rc);
|
||||
|
||||
#ifdef CONFIG_WIFI_MEM_PREALLOC
|
||||
rc = trout_init_wifi_mem();
|
||||
if (rc)
|
||||
printk(KERN_CRIT "%s: WiFi Memory init failure (%d)\n", __func__, rc);
|
||||
#endif
|
||||
|
||||
platform_add_devices(devices, ARRAY_SIZE(devices));
|
||||
i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
|
||||
|
||||
/* SD card door should wake the device */
|
||||
set_irq_wake(TROUT_GPIO_TO_INT(TROUT_GPIO_SD_DOOR_N), 1);
|
||||
}
|
||||
|
||||
static struct map_desc trout_io_desc[] __initdata = {
|
||||
{
|
||||
.virtual = TROUT_CPLD_BASE,
|
||||
.pfn = __phys_to_pfn(TROUT_CPLD_START),
|
||||
.length = TROUT_CPLD_SIZE,
|
||||
.type = MT_DEVICE_NONSHARED
|
||||
}
|
||||
};
|
||||
|
||||
static void __init trout_fixup(struct machine_desc *desc, struct tag *tags,
|
||||
char **cmdline, struct meminfo *mi)
|
||||
{
|
||||
mi->nr_banks=1;
|
||||
mi->bank[0].start = PHYS_OFFSET;
|
||||
mi->bank[0].node = PHYS_TO_NID(PHYS_OFFSET);
|
||||
mi->bank[0].size = (101*1024*1024);
|
||||
}
|
||||
|
||||
static void __init trout_map_io(void)
|
||||
{
|
||||
msm_map_common_io();
|
||||
iotable_init(trout_io_desc, ARRAY_SIZE(trout_io_desc));
|
||||
msm_clock_init();
|
||||
}
|
||||
|
||||
MACHINE_START(TROUT, "trout")
|
||||
/* Maintainer: Brian Swetland <swetland@google.com> */
|
||||
#ifdef CONFIG_MSM_DEBUG_UART
|
||||
.phys_io = MSM_DEBUG_UART_PHYS,
|
||||
.io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
|
||||
#endif
|
||||
.boot_params = 0x10000100,
|
||||
.fixup = trout_fixup,
|
||||
.map_io = trout_map_io,
|
||||
.init_irq = trout_init_irq,
|
||||
.init_machine = trout_init,
|
||||
.timer = &msm_timer,
|
||||
MACHINE_END
|
@ -1,162 +0,0 @@
|
||||
/* linux/arch/arm/mach-msm/board-trout.h
|
||||
** Author: Brian Swetland <swetland@google.com>
|
||||
*/
|
||||
#ifndef __ARCH_ARM_MACH_MSM_BOARD_TROUT_H
|
||||
#define __ARCH_ARM_MACH_MSM_BOARD_TROUT_H
|
||||
|
||||
#include <mach/board.h>
|
||||
|
||||
#define MSM_SMI_BASE 0x00000000
|
||||
#define MSM_SMI_SIZE 0x00800000
|
||||
|
||||
#define MSM_EBI_BASE 0x10000000
|
||||
#define MSM_EBI_SIZE 0x06e00000
|
||||
|
||||
#define MSM_PMEM_GPU0_BASE 0x00000000
|
||||
#define MSM_PMEM_GPU0_SIZE 0x00700000
|
||||
|
||||
#define MSM_PMEM_MDP_BASE 0x02000000
|
||||
#define MSM_PMEM_MDP_SIZE 0x00800000
|
||||
|
||||
#define MSM_PMEM_ADSP_BASE 0x02800000
|
||||
#define MSM_PMEM_ADSP_SIZE 0x00800000
|
||||
|
||||
#define MSM_PMEM_CAMERA_BASE 0x03000000
|
||||
#define MSM_PMEM_CAMERA_SIZE 0x00800000
|
||||
|
||||
#define MSM_FB_BASE 0x03800000
|
||||
#define MSM_FB_SIZE 0x00100000
|
||||
|
||||
#define MSM_LINUX_BASE MSM_EBI_BASE
|
||||
#define MSM_LINUX_SIZE 0x06500000
|
||||
|
||||
#define MSM_PMEM_GPU1_SIZE 0x800000
|
||||
#define MSM_PMEM_GPU1_BASE MSM_RAM_CONSOLE_BASE - MSM_PMEM_GPU1_SIZE
|
||||
|
||||
#define MSM_RAM_CONSOLE_BASE MSM_EBI_BASE + 0x6d00000
|
||||
#define MSM_RAM_CONSOLE_SIZE 128 * SZ_1K
|
||||
|
||||
#if (MSM_FB_BASE + MSM_FB_SIZE) >= (MSM_PMEM_GPU1_BASE)
|
||||
#error invalid memory map
|
||||
#endif
|
||||
|
||||
#define DECLARE_MSM_IOMAP
|
||||
#include <mach/msm_iomap.h>
|
||||
|
||||
#define TROUT_4_BALL_UP_0 1
|
||||
#define TROUT_4_BALL_LEFT_0 18
|
||||
#define TROUT_4_BALL_DOWN_0 57
|
||||
#define TROUT_4_BALL_RIGHT_0 91
|
||||
|
||||
#define TROUT_5_BALL_UP_0 94
|
||||
#define TROUT_5_BALL_LEFT_0 18
|
||||
#define TROUT_5_BALL_DOWN_0 90
|
||||
#define TROUT_5_BALL_RIGHT_0 19
|
||||
|
||||
#define TROUT_POWER_KEY 20
|
||||
|
||||
#define TROUT_4_TP_LS_EN 19
|
||||
#define TROUT_5_TP_LS_EN 1
|
||||
|
||||
#define TROUT_CPLD_BASE 0xFA000000
|
||||
#define TROUT_CPLD_START 0x98000000
|
||||
#define TROUT_CPLD_SIZE SZ_4K
|
||||
|
||||
#define TROUT_GPIO_CABLE_IN1 (83)
|
||||
#define TROUT_GPIO_CABLE_IN2 (49)
|
||||
|
||||
#define TROUT_GPIO_START (128)
|
||||
|
||||
#define TROUT_GPIO_INT_MASK0_REG (0x0c)
|
||||
#define TROUT_GPIO_INT_STAT0_REG (0x0e)
|
||||
#define TROUT_GPIO_INT_MASK1_REG (0x14)
|
||||
#define TROUT_GPIO_INT_STAT1_REG (0x10)
|
||||
|
||||
#define TROUT_GPIO_HAPTIC_PWM (28)
|
||||
#define TROUT_GPIO_PS_HOLD (25)
|
||||
|
||||
#define TROUT_GPIO_MISC2_BASE (TROUT_GPIO_START + 0x00)
|
||||
#define TROUT_GPIO_MISC3_BASE (TROUT_GPIO_START + 0x08)
|
||||
#define TROUT_GPIO_MISC4_BASE (TROUT_GPIO_START + 0x10)
|
||||
#define TROUT_GPIO_MISC5_BASE (TROUT_GPIO_START + 0x18)
|
||||
#define TROUT_GPIO_INT2_BASE (TROUT_GPIO_START + 0x20)
|
||||
#define TROUT_GPIO_MISC1_BASE (TROUT_GPIO_START + 0x28)
|
||||
#define TROUT_GPIO_VIRTUAL_BASE (TROUT_GPIO_START + 0x30)
|
||||
#define TROUT_GPIO_INT5_BASE (TROUT_GPIO_START + 0x48)
|
||||
|
||||
#define TROUT_GPIO_CHARGER_EN (TROUT_GPIO_MISC2_BASE + 0)
|
||||
#define TROUT_GPIO_ISET (TROUT_GPIO_MISC2_BASE + 1)
|
||||
#define TROUT_GPIO_H2W_DAT_DIR (TROUT_GPIO_MISC2_BASE + 2)
|
||||
#define TROUT_GPIO_H2W_CLK_DIR (TROUT_GPIO_MISC2_BASE + 3)
|
||||
#define TROUT_GPIO_H2W_DAT_GPO (TROUT_GPIO_MISC2_BASE + 4)
|
||||
#define TROUT_GPIO_H2W_CLK_GPO (TROUT_GPIO_MISC2_BASE + 5)
|
||||
#define TROUT_GPIO_H2W_SEL0 (TROUT_GPIO_MISC2_BASE + 6)
|
||||
#define TROUT_GPIO_H2W_SEL1 (TROUT_GPIO_MISC2_BASE + 7)
|
||||
|
||||
#define TROUT_GPIO_SPOTLIGHT_EN (TROUT_GPIO_MISC3_BASE + 0)
|
||||
#define TROUT_GPIO_FLASH_EN (TROUT_GPIO_MISC3_BASE + 1)
|
||||
#define TROUT_GPIO_I2C_PULL (TROUT_GPIO_MISC3_BASE + 2)
|
||||
#define TROUT_GPIO_TP_I2C_PULL (TROUT_GPIO_MISC3_BASE + 3)
|
||||
#define TROUT_GPIO_TP_EN (TROUT_GPIO_MISC3_BASE + 4)
|
||||
#define TROUT_GPIO_JOG_EN (TROUT_GPIO_MISC3_BASE + 5)
|
||||
#define TROUT_GPIO_UI_LED_EN (TROUT_GPIO_MISC3_BASE + 6)
|
||||
#define TROUT_GPIO_QTKEY_LED_EN (TROUT_GPIO_MISC3_BASE + 7)
|
||||
|
||||
#define TROUT_GPIO_VCM_PWDN (TROUT_GPIO_MISC4_BASE + 0)
|
||||
#define TROUT_GPIO_USB_H2W_SW (TROUT_GPIO_MISC4_BASE + 1)
|
||||
#define TROUT_GPIO_COMPASS_RST_N (TROUT_GPIO_MISC4_BASE + 2)
|
||||
#define TROUT_GPIO_HAPTIC_EN_UP (TROUT_GPIO_MISC4_BASE + 3)
|
||||
#define TROUT_GPIO_HAPTIC_EN_MAIN (TROUT_GPIO_MISC4_BASE + 4)
|
||||
#define TROUT_GPIO_USB_PHY_RST_N (TROUT_GPIO_MISC4_BASE + 5)
|
||||
#define TROUT_GPIO_WIFI_PA_RESETX (TROUT_GPIO_MISC4_BASE + 6)
|
||||
#define TROUT_GPIO_WIFI_EN (TROUT_GPIO_MISC4_BASE + 7)
|
||||
|
||||
#define TROUT_GPIO_BT_32K_EN (TROUT_GPIO_MISC5_BASE + 0)
|
||||
#define TROUT_GPIO_MAC_32K_EN (TROUT_GPIO_MISC5_BASE + 1)
|
||||
#define TROUT_GPIO_MDDI_32K_EN (TROUT_GPIO_MISC5_BASE + 2)
|
||||
#define TROUT_GPIO_COMPASS_32K_EN (TROUT_GPIO_MISC5_BASE + 3)
|
||||
|
||||
#define TROUT_GPIO_NAVI_ACT_N (TROUT_GPIO_INT2_BASE + 0)
|
||||
#define TROUT_GPIO_COMPASS_IRQ (TROUT_GPIO_INT2_BASE + 1)
|
||||
#define TROUT_GPIO_SLIDING_DET (TROUT_GPIO_INT2_BASE + 2)
|
||||
#define TROUT_GPIO_AUD_HSMIC_DET_N (TROUT_GPIO_INT2_BASE + 3)
|
||||
#define TROUT_GPIO_SD_DOOR_N (TROUT_GPIO_INT2_BASE + 4)
|
||||
#define TROUT_GPIO_CAM_BTN_STEP1_N (TROUT_GPIO_INT2_BASE + 5)
|
||||
#define TROUT_GPIO_CAM_BTN_STEP2_N (TROUT_GPIO_INT2_BASE + 6)
|
||||
#define TROUT_GPIO_TP_ATT_N (TROUT_GPIO_INT2_BASE + 7)
|
||||
#define TROUT_GPIO_BANK0_FIRST_INT_SOURCE (TROUT_GPIO_NAVI_ACT_N)
|
||||
#define TROUT_GPIO_BANK0_LAST_INT_SOURCE (TROUT_GPIO_TP_ATT_N)
|
||||
|
||||
#define TROUT_GPIO_H2W_DAT_GPI (TROUT_GPIO_MISC1_BASE + 0)
|
||||
#define TROUT_GPIO_H2W_CLK_GPI (TROUT_GPIO_MISC1_BASE + 1)
|
||||
#define TROUT_GPIO_CPLD128_VER_0 (TROUT_GPIO_MISC1_BASE + 4)
|
||||
#define TROUT_GPIO_CPLD128_VER_1 (TROUT_GPIO_MISC1_BASE + 5)
|
||||
#define TROUT_GPIO_CPLD128_VER_2 (TROUT_GPIO_MISC1_BASE + 6)
|
||||
#define TROUT_GPIO_CPLD128_VER_3 (TROUT_GPIO_MISC1_BASE + 7)
|
||||
|
||||
#define TROUT_GPIO_SDMC_CD_N (TROUT_GPIO_VIRTUAL_BASE + 0)
|
||||
#define TROUT_GPIO_END (TROUT_GPIO_SDMC_CD_N)
|
||||
#define TROUT_GPIO_BANK1_FIRST_INT_SOURCE (TROUT_GPIO_SDMC_CD_N)
|
||||
#define TROUT_GPIO_BANK1_LAST_INT_SOURCE (TROUT_GPIO_SDMC_CD_N)
|
||||
|
||||
#define TROUT_GPIO_VIRTUAL_TO_REAL_OFFSET \
|
||||
(TROUT_GPIO_INT5_BASE - TROUT_GPIO_VIRTUAL_BASE)
|
||||
|
||||
#define TROUT_INT_START (NR_MSM_IRQS + NR_GPIO_IRQS)
|
||||
#define TROUT_INT_BANK0_COUNT (8)
|
||||
#define TROUT_INT_BANK1_START (TROUT_INT_START + TROUT_INT_BANK0_COUNT)
|
||||
#define TROUT_INT_BANK1_COUNT (1)
|
||||
#define TROUT_INT_END (TROUT_INT_START + TROUT_INT_BANK0_COUNT + \
|
||||
TROUT_INT_BANK1_COUNT - 1)
|
||||
#define TROUT_GPIO_TO_INT(n) (((n) <= TROUT_GPIO_BANK0_LAST_INT_SOURCE) ? \
|
||||
(TROUT_INT_START - TROUT_GPIO_BANK0_FIRST_INT_SOURCE + (n)) : \
|
||||
(TROUT_INT_BANK1_START - TROUT_GPIO_BANK1_FIRST_INT_SOURCE + (n)))
|
||||
|
||||
#define TROUT_INT_TO_BANK(n) ((n - TROUT_INT_START) / TROUT_INT_BANK0_COUNT)
|
||||
#define TROUT_INT_TO_MASK(n) (1U << ((n - TROUT_INT_START) & 7))
|
||||
#define TROUT_BANK_TO_MASK_REG(bank) \
|
||||
(bank ? TROUT_GPIO_INT_MASK1_REG : TROUT_GPIO_INT_MASK0_REG)
|
||||
#define TROUT_BANK_TO_STAT_REG(bank) \
|
||||
(bank ? TROUT_GPIO_INT_STAT1_REG : TROUT_GPIO_INT_STAT0_REG)
|
||||
|
||||
#endif /* GUARD */
|
@ -1,504 +0,0 @@
|
||||
/* linux/arch/arm/mach-msm/devices.c
|
||||
*
|
||||
* Copyright (C) 2008 Google, Inc.
|
||||
* Copyright (C) 2007-2009 HTC Corporation.
|
||||
* Author: Thomas Tsai <thomas_tsai@htc.com>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <mach/msm_iomap.h>
|
||||
#include <mach/dma.h>
|
||||
#include "gpio_chip.h"
|
||||
#include "devices.h"
|
||||
#include <mach/board.h>
|
||||
#include <mach/board_htc.h>
|
||||
#include <mach/msm_hsusb.h>
|
||||
#include <linux/usb/android_composite.h>
|
||||
|
||||
#include <asm/mach/flash.h>
|
||||
#include <asm/setup.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/android_pmem.h>
|
||||
#include <mach/msm_rpcrouter.h>
|
||||
#include <mach/msm_iomap.h>
|
||||
#include <asm/mach/mmc.h>
|
||||
|
||||
static char *df_serialno = "000000000000";
|
||||
|
||||
#if 0
|
||||
struct platform_device *devices[] __initdata = {
|
||||
&msm_device_nand,
|
||||
&msm_device_smd,
|
||||
&msm_device_i2c,
|
||||
};
|
||||
|
||||
void __init msm_add_devices(void)
|
||||
{
|
||||
platform_add_devices(devices, ARRAY_SIZE(devices));
|
||||
}
|
||||
#endif
|
||||
|
||||
#define HSUSB_API_INIT_PHY_PROC 2
|
||||
#define HSUSB_API_PROG 0x30000064
|
||||
#define HSUSB_API_VERS MSM_RPC_VERS(1,1)
|
||||
|
||||
static void internal_phy_reset(void)
|
||||
{
|
||||
struct msm_rpc_endpoint *usb_ep;
|
||||
int rc;
|
||||
struct hsusb_phy_start_req {
|
||||
struct rpc_request_hdr hdr;
|
||||
} req;
|
||||
|
||||
printk(KERN_INFO "msm_hsusb_phy_reset\n");
|
||||
|
||||
usb_ep = msm_rpc_connect(HSUSB_API_PROG, HSUSB_API_VERS, 0);
|
||||
if (IS_ERR(usb_ep)) {
|
||||
printk(KERN_ERR "%s: init rpc failed! error: %ld\n",
|
||||
__func__, PTR_ERR(usb_ep));
|
||||
goto close;
|
||||
}
|
||||
rc = msm_rpc_call(usb_ep, HSUSB_API_INIT_PHY_PROC,
|
||||
&req, sizeof(req), 5 * HZ);
|
||||
if (rc < 0)
|
||||
printk(KERN_ERR "%s: rpc call failed! (%d)\n", __func__, rc);
|
||||
|
||||
close:
|
||||
msm_rpc_close(usb_ep);
|
||||
}
|
||||
|
||||
/* adjust eye diagram, disable vbusvalid interrupts */
|
||||
static int hsusb_phy_init_seq[] = { 0x40, 0x31, 0x1D, 0x0D, 0x1D, 0x10, -1 };
|
||||
|
||||
struct msm_hsusb_platform_data msm_hsusb_pdata = {
|
||||
.phy_reset = internal_phy_reset,
|
||||
.phy_init_seq = hsusb_phy_init_seq,
|
||||
.usb_connected = notify_usb_connected,
|
||||
};
|
||||
|
||||
static struct usb_mass_storage_platform_data mass_storage_pdata = {
|
||||
.nluns = 1,
|
||||
.vendor = "HTC ",
|
||||
.product = "Android Phone ",
|
||||
.release = 0x0100,
|
||||
};
|
||||
|
||||
static struct platform_device usb_mass_storage_device = {
|
||||
.name = "usb_mass_storage",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &mass_storage_pdata,
|
||||
},
|
||||
};
|
||||
|
||||
#ifdef CONFIG_USB_ANDROID_RNDIS
|
||||
static struct usb_ether_platform_data rndis_pdata = {
|
||||
/* ethaddr is filled by board_serialno_setup */
|
||||
.vendorID = 0x0bb4,
|
||||
.vendorDescr = "HTC",
|
||||
};
|
||||
|
||||
static struct platform_device rndis_device = {
|
||||
.name = "rndis",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &rndis_pdata,
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
||||
static char *usb_functions_ums[] = {
|
||||
"usb_mass_storage",
|
||||
};
|
||||
|
||||
static char *usb_functions_ums_adb[] = {
|
||||
"usb_mass_storage",
|
||||
"adb",
|
||||
};
|
||||
|
||||
static char *usb_functions_rndis[] = {
|
||||
"rndis",
|
||||
};
|
||||
|
||||
static char *usb_functions_rndis_adb[] = {
|
||||
"rndis",
|
||||
"adb",
|
||||
};
|
||||
|
||||
static char *usb_functions_all[] = {
|
||||
#ifdef CONFIG_USB_ANDROID_RNDIS
|
||||
"rndis",
|
||||
#endif
|
||||
"usb_mass_storage",
|
||||
"adb",
|
||||
#ifdef CONFIG_USB_ANDROID_ACM
|
||||
"acm",
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct android_usb_product usb_products[] = {
|
||||
{
|
||||
.product_id = 0x0c01,
|
||||
.num_functions = ARRAY_SIZE(usb_functions_ums),
|
||||
.functions = usb_functions_ums,
|
||||
},
|
||||
{
|
||||
.product_id = 0x0c02,
|
||||
.num_functions = ARRAY_SIZE(usb_functions_ums_adb),
|
||||
.functions = usb_functions_ums_adb,
|
||||
},
|
||||
{
|
||||
.product_id = 0x0ffe,
|
||||
.num_functions = ARRAY_SIZE(usb_functions_rndis),
|
||||
.functions = usb_functions_rndis,
|
||||
},
|
||||
{
|
||||
.product_id = 0x0ffc,
|
||||
.num_functions = ARRAY_SIZE(usb_functions_rndis_adb),
|
||||
.functions = usb_functions_rndis_adb,
|
||||
},
|
||||
};
|
||||
|
||||
static struct android_usb_platform_data android_usb_pdata = {
|
||||
.vendor_id = 0x0bb4,
|
||||
.product_id = 0x0c01,
|
||||
.version = 0x0100,
|
||||
.product_name = "Android Phone",
|
||||
.manufacturer_name = "HTC",
|
||||
.num_products = ARRAY_SIZE(usb_products),
|
||||
.products = usb_products,
|
||||
.num_functions = ARRAY_SIZE(usb_functions_all),
|
||||
.functions = usb_functions_all,
|
||||
};
|
||||
|
||||
static struct platform_device android_usb_device = {
|
||||
.name = "android_usb",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &android_usb_pdata,
|
||||
},
|
||||
};
|
||||
|
||||
void __init msm_add_usb_devices(void (*phy_reset) (void))
|
||||
{
|
||||
/* setup */
|
||||
if (phy_reset)
|
||||
msm_hsusb_pdata.phy_reset = phy_reset;
|
||||
msm_device_hsusb.dev.platform_data = &msm_hsusb_pdata;
|
||||
platform_device_register(&msm_device_hsusb);
|
||||
#ifdef CONFIG_USB_ANDROID_RNDIS
|
||||
platform_device_register(&rndis_device);
|
||||
#endif
|
||||
platform_device_register(&usb_mass_storage_device);
|
||||
platform_device_register(&android_usb_device);
|
||||
}
|
||||
|
||||
static struct android_pmem_platform_data pmem_pdata = {
|
||||
.name = "pmem",
|
||||
.no_allocator = 1,
|
||||
.cached = 1,
|
||||
};
|
||||
|
||||
static struct android_pmem_platform_data pmem_adsp_pdata = {
|
||||
.name = "pmem_adsp",
|
||||
.no_allocator = 0,
|
||||
.cached = 0,
|
||||
};
|
||||
|
||||
static struct android_pmem_platform_data pmem_camera_pdata = {
|
||||
.name = "pmem_camera",
|
||||
.no_allocator = 1,
|
||||
.cached = 0,
|
||||
};
|
||||
|
||||
static struct platform_device pmem_device = {
|
||||
.name = "android_pmem",
|
||||
.id = 0,
|
||||
.dev = { .platform_data = &pmem_pdata },
|
||||
};
|
||||
|
||||
static struct platform_device pmem_adsp_device = {
|
||||
.name = "android_pmem",
|
||||
.id = 1,
|
||||
.dev = { .platform_data = &pmem_adsp_pdata },
|
||||
};
|
||||
|
||||
static struct platform_device pmem_camera_device = {
|
||||
.name = "android_pmem",
|
||||
.id = 2,
|
||||
.dev = { .platform_data = &pmem_camera_pdata },
|
||||
};
|
||||
|
||||
static struct resource ram_console_resource[] = {
|
||||
{
|
||||
.flags = IORESOURCE_MEM,
|
||||
}
|
||||
};
|
||||
|
||||
static struct platform_device ram_console_device = {
|
||||
.name = "ram_console",
|
||||
.id = -1,
|
||||
.num_resources = ARRAY_SIZE(ram_console_resource),
|
||||
.resource = ram_console_resource,
|
||||
};
|
||||
|
||||
static struct resource resources_hw3d[] = {
|
||||
{
|
||||
.start = 0xA0000000,
|
||||
.end = 0xA00fffff,
|
||||
.flags = IORESOURCE_MEM,
|
||||
.name = "regs",
|
||||
},
|
||||
{
|
||||
.flags = IORESOURCE_MEM,
|
||||
.name = "smi",
|
||||
},
|
||||
{
|
||||
.flags = IORESOURCE_MEM,
|
||||
.name = "ebi",
|
||||
},
|
||||
{
|
||||
.start = INT_GRAPHICS,
|
||||
.end = INT_GRAPHICS,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
.name = "gfx",
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device hw3d_device = {
|
||||
.name = "msm_hw3d",
|
||||
.id = 0,
|
||||
.num_resources = ARRAY_SIZE(resources_hw3d),
|
||||
.resource = resources_hw3d,
|
||||
};
|
||||
|
||||
void __init msm_add_mem_devices(struct msm_pmem_setting *setting)
|
||||
{
|
||||
if (setting->pmem_size) {
|
||||
pmem_pdata.start = setting->pmem_start;
|
||||
pmem_pdata.size = setting->pmem_size;
|
||||
platform_device_register(&pmem_device);
|
||||
}
|
||||
|
||||
if (setting->pmem_adsp_size) {
|
||||
pmem_adsp_pdata.start = setting->pmem_adsp_start;
|
||||
pmem_adsp_pdata.size = setting->pmem_adsp_size;
|
||||
platform_device_register(&pmem_adsp_device);
|
||||
}
|
||||
|
||||
if (setting->pmem_gpu0_size && setting->pmem_gpu1_size) {
|
||||
struct resource *res;
|
||||
|
||||
res = platform_get_resource_byname(&hw3d_device, IORESOURCE_MEM,
|
||||
"smi");
|
||||
res->start = setting->pmem_gpu0_start;
|
||||
res->end = res->start + setting->pmem_gpu0_size - 1;
|
||||
|
||||
res = platform_get_resource_byname(&hw3d_device, IORESOURCE_MEM,
|
||||
"ebi");
|
||||
res->start = setting->pmem_gpu1_start;
|
||||
res->end = res->start + setting->pmem_gpu1_size - 1;
|
||||
platform_device_register(&hw3d_device);
|
||||
}
|
||||
|
||||
if (setting->pmem_camera_size) {
|
||||
pmem_camera_pdata.start = setting->pmem_camera_start;
|
||||
pmem_camera_pdata.size = setting->pmem_camera_size;
|
||||
platform_device_register(&pmem_camera_device);
|
||||
}
|
||||
|
||||
if (setting->ram_console_size) {
|
||||
ram_console_resource[0].start = setting->ram_console_start;
|
||||
ram_console_resource[0].end = setting->ram_console_start
|
||||
+ setting->ram_console_size - 1;
|
||||
platform_device_register(&ram_console_device);
|
||||
}
|
||||
}
|
||||
|
||||
#define PM_LIBPROG 0x30000061
|
||||
#if (CONFIG_MSM_AMSS_VERSION == 6220) || (CONFIG_MSM_AMSS_VERSION == 6225)
|
||||
#define PM_LIBVERS 0xfb837d0b
|
||||
#else
|
||||
#define PM_LIBVERS 0x10001
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static struct platform_device *msm_serial_devices[] __initdata = {
|
||||
&msm_device_uart1,
|
||||
&msm_device_uart2,
|
||||
&msm_device_uart3,
|
||||
#ifdef CONFIG_SERIAL_MSM_HS
|
||||
&msm_device_uart_dm1,
|
||||
&msm_device_uart_dm2,
|
||||
#endif
|
||||
};
|
||||
|
||||
int __init msm_add_serial_devices(unsigned num)
|
||||
{
|
||||
if (num > MSM_SERIAL_NUM)
|
||||
return -EINVAL;
|
||||
|
||||
return platform_device_register(msm_serial_devices[num]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define ATAG_SMI 0x4d534D71
|
||||
/* setup calls mach->fixup, then parse_tags, parse_cmdline
|
||||
* We need to setup meminfo in mach->fixup, so this function
|
||||
* will need to traverse each tag to find smi tag.
|
||||
*/
|
||||
int __init parse_tag_smi(const struct tag *tags)
|
||||
{
|
||||
int smi_sz = 0, find = 0;
|
||||
struct tag *t = (struct tag *)tags;
|
||||
|
||||
for (; t->hdr.size; t = tag_next(t)) {
|
||||
if (t->hdr.tag == ATAG_SMI) {
|
||||
printk(KERN_DEBUG "find the smi tag\n");
|
||||
find = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!find)
|
||||
return -1;
|
||||
|
||||
printk(KERN_DEBUG "parse_tag_smi: smi size = %d\n", t->u.mem.size);
|
||||
smi_sz = t->u.mem.size;
|
||||
return smi_sz;
|
||||
}
|
||||
__tagtable(ATAG_SMI, parse_tag_smi);
|
||||
|
||||
|
||||
#define ATAG_HWID 0x4d534D72
|
||||
int __init parse_tag_hwid(const struct tag *tags)
|
||||
{
|
||||
int hwid = 0, find = 0;
|
||||
struct tag *t = (struct tag *)tags;
|
||||
|
||||
for (; t->hdr.size; t = tag_next(t)) {
|
||||
if (t->hdr.tag == ATAG_HWID) {
|
||||
printk(KERN_DEBUG "find the hwid tag\n");
|
||||
find = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (find)
|
||||
hwid = t->u.revision.rev;
|
||||
printk(KERN_DEBUG "parse_tag_hwid: hwid = 0x%x\n", hwid);
|
||||
return hwid;
|
||||
}
|
||||
__tagtable(ATAG_HWID, parse_tag_hwid);
|
||||
|
||||
#define ATAG_SKUID 0x4d534D73
|
||||
int __init parse_tag_skuid(const struct tag *tags)
|
||||
{
|
||||
int skuid = 0, find = 0;
|
||||
struct tag *t = (struct tag *)tags;
|
||||
|
||||
for (; t->hdr.size; t = tag_next(t)) {
|
||||
if (t->hdr.tag == ATAG_SKUID) {
|
||||
printk(KERN_DEBUG "find the skuid tag\n");
|
||||
find = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (find)
|
||||
skuid = t->u.revision.rev;
|
||||
printk(KERN_DEBUG "parse_tag_skuid: hwid = 0x%x\n", skuid);
|
||||
return skuid;
|
||||
}
|
||||
__tagtable(ATAG_SKUID, parse_tag_skuid);
|
||||
|
||||
#define ATAG_ENGINEERID 0x4d534D75
|
||||
int __init parse_tag_engineerid(const struct tag *tags)
|
||||
{
|
||||
int engineerid = 0, find = 0;
|
||||
struct tag *t = (struct tag *)tags;
|
||||
|
||||
for (; t->hdr.size; t = tag_next(t)) {
|
||||
if (t->hdr.tag == ATAG_ENGINEERID) {
|
||||
printk(KERN_DEBUG "find the engineer tag\n");
|
||||
find = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (find)
|
||||
engineerid = t->u.revision.rev;
|
||||
printk(KERN_DEBUG "parse_tag_engineerid: hwid = 0x%x\n", engineerid);
|
||||
return engineerid;
|
||||
}
|
||||
__tagtable(ATAG_ENGINEERID, parse_tag_engineerid);
|
||||
|
||||
static int mfg_mode;
|
||||
int __init board_mfg_mode_init(char *s)
|
||||
{
|
||||
if (!strcmp(s, "normal"))
|
||||
mfg_mode = 0;
|
||||
else if (!strcmp(s, "factory2"))
|
||||
mfg_mode = 1;
|
||||
else if (!strcmp(s, "recovery"))
|
||||
mfg_mode = 2;
|
||||
else if (!strcmp(s, "charge"))
|
||||
mfg_mode = 3;
|
||||
else if (!strcmp(s, "power_test"))
|
||||
mfg_mode = 4;
|
||||
else if (!strcmp(s, "offmode_charging"))
|
||||
mfg_mode = 5;
|
||||
|
||||
return 1;
|
||||
}
|
||||
__setup("androidboot.mode=", board_mfg_mode_init);
|
||||
|
||||
|
||||
int board_mfg_mode(void)
|
||||
{
|
||||
return mfg_mode;
|
||||
}
|
||||
|
||||
static int __init board_serialno_setup(char *serialno)
|
||||
{
|
||||
#ifdef CONFIG_USB_ANDROID_RNDIS
|
||||
int i;
|
||||
char *src;
|
||||
#endif
|
||||
char *str;
|
||||
|
||||
/* use default serial number when mode is factory2 */
|
||||
if (mfg_mode == 1 || !strlen(serialno))
|
||||
str = df_serialno;
|
||||
else
|
||||
str = serialno;
|
||||
|
||||
#ifdef CONFIG_USB_ANDROID_RNDIS
|
||||
/* create a fake MAC address from our serial number.
|
||||
* first byte is 0x02 to signify locally administered.
|
||||
*/
|
||||
rndis_pdata.ethaddr[0] = 0x02;
|
||||
src = str;
|
||||
for (i = 0; *src; i++) {
|
||||
/* XOR the USB serial across the remaining bytes */
|
||||
rndis_pdata.ethaddr[i % (ETH_ALEN - 1) + 1] ^= *src++;
|
||||
}
|
||||
#endif
|
||||
android_usb_pdata.serial_number = str;
|
||||
return 1;
|
||||
}
|
||||
|
||||
__setup("androidboot.serialno=", board_serialno_setup);
|
@ -1,145 +0,0 @@
|
||||
/* arch/arm/mach-msm/fish_battery.c
|
||||
*
|
||||
* Copyright (C) 2008 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.
|
||||
*
|
||||
* based on: arch/arm/mach-msm/htc_battery.c
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/power_supply.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
static enum power_supply_property fish_battery_properties[] = {
|
||||
POWER_SUPPLY_PROP_STATUS,
|
||||
POWER_SUPPLY_PROP_HEALTH,
|
||||
POWER_SUPPLY_PROP_PRESENT,
|
||||
POWER_SUPPLY_PROP_TECHNOLOGY,
|
||||
POWER_SUPPLY_PROP_CAPACITY,
|
||||
};
|
||||
|
||||
static enum power_supply_property fish_power_properties[] = {
|
||||
POWER_SUPPLY_PROP_ONLINE,
|
||||
};
|
||||
|
||||
static char *supply_list[] = {
|
||||
"battery",
|
||||
};
|
||||
|
||||
static int fish_power_get_property(struct power_supply *psy,
|
||||
enum power_supply_property psp,
|
||||
union power_supply_propval *val);
|
||||
|
||||
static int fish_battery_get_property(struct power_supply *psy,
|
||||
enum power_supply_property psp,
|
||||
union power_supply_propval *val);
|
||||
|
||||
static struct power_supply fish_power_supplies[] = {
|
||||
{
|
||||
.name = "battery",
|
||||
.type = POWER_SUPPLY_TYPE_BATTERY,
|
||||
.properties = fish_battery_properties,
|
||||
.num_properties = ARRAY_SIZE(fish_battery_properties),
|
||||
.get_property = fish_battery_get_property,
|
||||
},
|
||||
{
|
||||
.name = "ac",
|
||||
.type = POWER_SUPPLY_TYPE_MAINS,
|
||||
.supplied_to = supply_list,
|
||||
.num_supplicants = ARRAY_SIZE(supply_list),
|
||||
.properties = fish_power_properties,
|
||||
.num_properties = ARRAY_SIZE(fish_power_properties),
|
||||
.get_property = fish_power_get_property,
|
||||
},
|
||||
};
|
||||
|
||||
static int fish_power_get_property(struct power_supply *psy,
|
||||
enum power_supply_property psp,
|
||||
union power_supply_propval *val)
|
||||
{
|
||||
switch (psp) {
|
||||
case POWER_SUPPLY_PROP_ONLINE:
|
||||
if (psy->type == POWER_SUPPLY_TYPE_MAINS)
|
||||
val->intval = 1;
|
||||
else
|
||||
val->intval = 0;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fish_battery_get_property(struct power_supply *psy,
|
||||
enum power_supply_property psp,
|
||||
union power_supply_propval *val)
|
||||
{
|
||||
switch (psp) {
|
||||
case POWER_SUPPLY_PROP_STATUS:
|
||||
val->intval = POWER_SUPPLY_STATUS_FULL;
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_HEALTH:
|
||||
val->intval = POWER_SUPPLY_HEALTH_GOOD;
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_PRESENT:
|
||||
val->intval = 1;
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_TECHNOLOGY:
|
||||
val->intval = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_CAPACITY:
|
||||
val->intval = 100;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fish_battery_probe(struct platform_device *pdev)
|
||||
{
|
||||
int i;
|
||||
int rc;
|
||||
|
||||
/* init power supplier framework */
|
||||
for (i = 0; i < ARRAY_SIZE(fish_power_supplies); i++) {
|
||||
rc = power_supply_register(&pdev->dev, &fish_power_supplies[i]);
|
||||
if (rc)
|
||||
pr_err("%s: Failed to register power supply (%d)\n",
|
||||
__func__, rc);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver fish_battery_driver = {
|
||||
.probe = fish_battery_probe,
|
||||
.driver = {
|
||||
.name = "fish_battery",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
};
|
||||
|
||||
static int __init fish_battery_init(void)
|
||||
{
|
||||
platform_driver_register(&fish_battery_driver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
module_init(fish_battery_init);
|
||||
MODULE_DESCRIPTION("Qualcomm fish battery driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
Loading…
x
Reference in New Issue
Block a user