/*
* Copyright © 2007 Google, Inc.
* Copyright © 2008-2010, Code Aurora Forum. All rights reserved.
* Author: Brian Swetland
*
* 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
#include
#include
#include
#include
#include
#include
//#include
#include
#include
#include
#include
#include
#include
#include
#ifdef CONFIG_CACHE_L2X0
#include
#endif
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "devices.h"
#include "socinfo.h"
#include "clock.h"
#include "msm-keypad-devices.h"
#ifdef CONFIG_USB_ANDROID
#include
#endif
#include "pm.h"
#ifdef CONFIG_ARCH_MSM7X27
#include
#endif
#ifdef CONFIG_ZTE_PLATFORM
//#include "msm_usb_config.h"
#endif
#include
#if defined( CONFIG_TOUCHSCREEN_MSM_LEGACY)
#include
#elif defined( CONFIG_TOUCHSCREEN_MSM)
#include
#endif
#ifdef CONFIG_TOUCHSCREEN_MXT224
#include
extern struct atmel_i2c_platform_data atmel_data;
#endif
#ifdef CONFIG_ARCH_MSM7X25
#define MSM_PMEM_MDP_SIZE 0xb21000
#define MSM_PMEM_ADSP_SIZE 0x97b000
#define MSM_PMEM_AUDIO_SIZE 0x121000
#define MSM_FB_SIZE 0x200000
#define PMEM_KERNEL_EBI1_SIZE 0x64000
#endif
#ifdef CONFIG_ARCH_MSM7X27
#define MSM_PMEM_MDP_SIZE 0x1B76000
#define MSM_PMEM_ADSP_SIZE 0xB71000
#define MSM_PMEM_AUDIO_SIZE 0x5B000
#define MSM_FB_SIZE 0x177000
#define MSM_GPU_PHYS_SIZE SZ_2M
#define PMEM_KERNEL_EBI1_SIZE 0x1C000
/* Using lower 1MB of OEMSBL memory for GPU_PHYS */
#define MSM_GPU_PHYS_START_ADDR 0xD600000ul
#endif
#ifdef CONFIG_ANDROID_RAM_CONSOLE
#define MSM_RAM_CONSOLE_PHYS 0x02500000
#define MSM_RAM_CONSOLE_SIZE SZ_1M
#endif
static smem_global *global;
#ifdef CONFIG_ZTE_PLATFORM
static int g_zte_ftm_flag_fixup;
#endif
/* Using upper 1/2MB of Apps Bootloader memory*/
#define MSM_PMEM_AUDIO_START_ADDR 0x80000ul
static struct resource smc91x_resources[] = {
[0] = {
.start = 0x9C004300,
.end = 0x9C0043ff,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = MSM_GPIO_TO_INT(132),
.end = MSM_GPIO_TO_INT(132),
.flags = IORESOURCE_IRQ,
},
};
#ifdef CONFIG_USB_FUNCTION
#ifndef CONFIG_ZTE_PLATFORM
static struct usb_mass_storage_platform_data usb_mass_storage_pdata = {
.nluns = 0x02,
.buf_size = 16384,
.vendor = "GOOGLE",
.product = "Mass storage",
.release = 0xffff,
};
#endif
static struct platform_device mass_storage_device = {
.name = "usb_mass_storage",
.id = -1,
.dev = {
.platform_data = &usb_mass_storage_pdata,
},
};
#endif
#if 0
#ifdef CONFIG_USB_ANDROID
#define PRODUCT_ID_ALL_INTERFACE 0x1350
#define PRODUCT_ID_MS_ADB 0x1351
#define PRODUCT_ID_ADB 0x1352
#define PRODUCT_ID_MS 0x1353
#define PRODUCT_ID_DIAG 0x0112
#define PRODUCT_ID_DIAG_NMEA_MODEM 0x0111
#define PRODUCT_ID_MODEM_MS_ADB 0x1354
#define PRODUCT_ID_MODEM_MS 0x1355
#define PRODUCT_ID_MS_CDROM 0x0083
#define PRODUCT_ID_RNDIS_MS 0x1364
#define PRODUCT_ID_RNDIS_MS_ADB 0x1364
#define PRODUCT_ID_RNDIS 0x1365
#define PRODUCT_ID_DIAG_MODEM_NEMA_MS_AT 0x1367
#define PRODUCT_ID_DIAG_MODEM_NEMA_MS_ADB_AT 0x1366
#define PRODUCT_ID_RNDIS_ADB 0x1373
/* dynamic composition */
static struct usb_composition usb_func_composition[] = {
#ifdef CONFIG_ZTE_PLATFORM
{
/* MSC */
.product_id = PRODUCT_ID_MS,
.functions = 0x02,
.adb_product_id = PRODUCT_ID_MS_ADB,
.adb_functions = 0x12
},
{
/*
ADB*/
.product_id = PRODUCT_ID_ADB,
.functions = 0x01,
.adb_product_id = PRODUCT_ID_ADB,
.adb_functions = 0x01
},
{
/* diag + modem + nmea + ms +
adb*/
.product_id = PRODUCT_ID_ALL_INTERFACE,
.functions = 0x12764,
.adb_product_id = PRODUCT_ID_ALL_INTERFACE,
.adb_functions = 0x12764
},
{
/* diag + nmea + modem */
.product_id = PRODUCT_ID_DIAG_NMEA_MODEM,
.functions = 0x674,
.adb_product_id = PRODUCT_ID_DIAG_NMEA_MODEM,
.adb_functions = 0x674
},
{
/* diag */
.product_id = PRODUCT_ID_DIAG,
.functions = 0x4,
.adb_product_id = PRODUCT_ID_DIAG,
.adb_functions = 0x4
},
{
/* modem + ms +
adb */
.product_id = PRODUCT_ID_MODEM_MS,
.functions = 0x26,
.adb_product_id = PRODUCT_ID_MODEM_MS_ADB,
.adb_functions = 0x126
},
{
/* ms + CDROM */
.product_id = PRODUCT_ID_MS_CDROM,
.functions = 0x2,
.adb_product_id = PRODUCT_ID_MS_CDROM,
.adb_functions = 0x2
},
{
/* rndis + ms +
adb */
.product_id = PRODUCT_ID_RNDIS_MS,
.functions = 0x2A,
.adb_product_id = PRODUCT_ID_RNDIS_MS_ADB,
.adb_functions = 0x12A
},
{
/* rndis */
.product_id = PRODUCT_ID_RNDIS,
.functions = 0xA,
.adb_product_id = PRODUCT_ID_RNDIS,
.adb_functions = 0xA
},
{
/* rndis +
adb*/
.product_id = PRODUCT_ID_RNDIS_ADB,
.functions = 0xA,
.adb_product_id = PRODUCT_ID_RNDIS_ADB,
.adb_functions = 0x1A
},
{
/* diag+modm+nema+ms+at*/
.product_id = PRODUCT_ID_DIAG_MODEM_NEMA_MS_AT,
.functions = 0xB2764,
.adb_product_id = PRODUCT_ID_DIAG_MODEM_NEMA_MS_ADB_AT,
.adb_functions = 0xB12764
},
{
/* diag+modm+nema+ms+
adb+at*/
.product_id = PRODUCT_ID_DIAG_MODEM_NEMA_MS_ADB_AT,
.functions = 0xB12764,
.adb_product_id = PRODUCT_ID_DIAG_MODEM_NEMA_MS_ADB_AT,
.adb_functions = 0xB12764
},
#else
{
/* MSC */
.product_id = 0xF000,
.functions = 0x02,
.adb_product_id = 0x9015,
.adb_functions = 0x12
},
#ifdef CONFIG_USB_F_SERIAL
{
/* MODEM */
.product_id = 0xF00B,
.functions = 0x06,
.adb_product_id = 0x901E,
.adb_functions = 0x16,
},
#endif
#ifdef CONFIG_USB_ANDROID_DIAG
{
/* DIAG */
.product_id = 0x900E,
.functions = 0x04,
.adb_product_id = 0x901D,
.adb_functions = 0x14,
},
#endif
#if defined(CONFIG_USB_ANDROID_DIAG) && defined(CONFIG_USB_F_SERIAL)
{
/* DIAG + MODEM */
.product_id = 0x9004,
.functions = 0x64,
.adb_product_id = 0x901F,
.adb_functions = 0x0614,
},
{
/* DIAG + MODEM + NMEA*/
.product_id = 0x9016,
.functions = 0x764,
.adb_product_id = 0x9020,
.adb_functions = 0x7614,
},
{
/* DIAG + MODEM + NMEA + MSC */
.product_id = 0x9017,
.functions = 0x2764,
.adb_product_id = 0x9018,
.adb_functions = 0x27614,
},
#endif
#ifdef CONFIG_USB_ANDROID_CDC_ECM
{
/* MSC + CDC-ECM */
.product_id = 0x9014,
.functions = 0x82,
.adb_product_id = 0x9023,
.adb_functions = 0x812,
},
#endif
#ifdef CONFIG_USB_ANDROID_RMNET
{
/* DIAG + RMNET */
.product_id = 0x9021,
.functions = 0x94,
.adb_product_id = 0x9022,
.adb_functions = 0x914,
},
#endif
#ifdef CONFIG_USB_ANDROID_RNDIS
{
/* RNDIS */
.product_id = 0xF00E,
.functions = 0xA,
.adb_product_id = 0x9024,
.adb_functions = 0x1A,
},
#endif
#endif
};
static struct android_usb_platform_data android_usb_pdata = {
#ifdef CONFIG_ZTE_PLATFORM
.vendor_id = 0x19d2,
.version = 0x0100,
.compositions = usb_func_composition,
.num_compositions = ARRAY_SIZE(usb_func_composition),
.product_name = "ZTE HSUSB Device",
.manufacturer_name = "ZTE Incorporated",
.nluns = 1,
#else
.vendor_id = 0x05C6,
.version = 0x0100,
.compositions = usb_func_composition,
.num_compositions = ARRAY_SIZE(usb_func_composition),
.product_name = "Qualcomm HSUSB Device",
.manufacturer_name = "Qualcomm Incorporated",
.nluns = 1,
#endif
};
static struct platform_device android_usb_device = {
.name = "android_usb",
.id = -1,
.dev = {
.platform_data = &android_usb_pdata,
},
};
#endif
static struct platform_device smc91x_device = {
.name = "smc91x",
.id = 0,
.num_resources = ARRAY_SIZE(smc91x_resources),
.resource = smc91x_resources,
};
#ifndef CONFIG_ZTE_PLATFORM
#ifdef CONFIG_USB_FUNCTION
static struct usb_function_map usb_functions_map[] = {
{"diag", 0},
{"
adb", 1},
{"modem", 2},
{"nmea", 3},
{"mass_storage", 4},
{"ethernet", 5},
{"rmnet", 6},
};
/* dynamic composition */
static struct usb_composition usb_func_composition[] = {
{
.product_id = 0x9012,
.functions = 0x5, /* 0101 */
},
{
.product_id = 0x9013,
.functions = 0x15, /* 10101 */
},
{
.product_id = 0x9014,
.functions = 0x30, /* 110000 */
},
{
.product_id = 0x9016,
.functions = 0xD, /* 01101 */
},
{
.product_id = 0x9017,
.functions = 0x1D, /* 11101 */
},
{
.product_id = 0xF000,
.functions = 0x10, /* 10000 */
},
{
.product_id = 0xF009,
.functions = 0x20, /* 100000 */
},
{
.product_id = 0x9018,
.functions = 0x1F, /* 011111 */
},
#ifdef CONFIG_USB_FUNCTION_RMNET
{
.product_id = 0x9021,
/* DIAG + RMNET */
.functions = 0x41,
},
{
.product_id = 0x9022,
/* DIAG +
ADB + RMNET */
.functions = 0x43,
},
#endif
};
static struct msm_hsusb_platform_data msm_hsusb_pdata = {
.version = 0x0100,
.phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_65NM),
.vendor_id = 0x5c6,
.product_name = "Qualcomm HSUSB Device",
.serial_number = "1234567890ABCDEF",
.manufacturer_name = "Qualcomm Incorporated",
.compositions = usb_func_composition,
.num_compositions = ARRAY_SIZE(usb_func_composition),
.function_map = usb_functions_map,
.num_functions = ARRAY_SIZE(usb_functions_map),
.config_gpio = NULL,
};
#endif
#endif
#endif
static struct platform_device smc91x_device = {
.name = "smc91x",
.id = 0,
.num_resources = ARRAY_SIZE(smc91x_resources),
.resource = smc91x_resources,
};
#ifdef CONFIG_USB_ANDROID
#if 0
static char *usb_functions_default[] = {
"diag",
"modem",
"nmea",
"rmnet",
"usb_mass_storage",
};
static char *usb_functions_default_adb[] = {
"diag",
"
adb",
"modem",
"nmea",
"rmnet",
"usb_mass_storage",
};
static char *usb_functions_rndis_diag[] = {
"rndis",
"diag",
};
static char *usb_functions_rndis_adb_diag[] = {
"rndis",
"
adb",
"diag",
};
#endif
static char *usb_functions_all[] = {
#ifdef CONFIG_USB_ANDROID_RNDIS
"rndis",
#endif
#ifdef CONFIG_USB_ANDROID_DIAG
"diag",
#endif
"
adb",
#ifdef CONFIG_USB_F_SERIAL
"modem",
"nmea",
#endif
#ifdef CONFIG_USB_ANDROID_RMNET
"rmnet",
#endif
"usb_mass_storage",
#ifdef CONFIG_USB_ANDROID_ACM
"acm",
#endif
#ifdef CONFIG_USB_ANDROID_AT
"at"
#endif
};
#if 0
static struct android_usb_product usb_products[] = {
{
.product_id = 0x9026,
.num_functions = ARRAY_SIZE(usb_functions_default),
.functions = usb_functions_default,
},
{
.product_id = 0x9025,
.num_functions = ARRAY_SIZE(usb_functions_default_adb),
.functions = usb_functions_default_adb,
},
{
.product_id = 0x902C,
.num_functions = ARRAY_SIZE(usb_functions_rndis_diag),
.functions = usb_functions_rndis_diag,
},
{
.product_id = 0x902D,
.num_functions = ARRAY_SIZE(usb_functions_rndis_adb_diag),
.functions = usb_functions_rndis_adb_diag,
},
};
#else
#include "zte_usb_config.c"
#endif
static struct usb_mass_storage_platform_data mass_storage_pdata = {
.nluns = 1,
.vendor = "ZTE Incorporated",
.product = "Mass storage",
.release = 0x0100,
};
static struct platform_device usb_mass_storage_device = {
.name = "usb_mass_storage",
.id = -1,
.dev = {
.platform_data = &mass_storage_pdata,
},
};
#if 0
static struct usb_ether_platform_data rndis_pdata = {
/* ethaddr is filled by board_serialno_setup */
.vendorID = 0x05C6,
.vendorDescr = "Qualcomm Incorporated",
};
#endif
static struct platform_device rndis_device = {
.name = "rndis",
.id = -1,
.dev = {
.platform_data = &rndis_pdata,
},
};
#if 0
static struct android_usb_platform_data android_usb_pdata = {
.vendor_id = 0x05C6,
.product_id = 0x9026,
.version = 0x0100,
.product_name = "Qualcomm HSUSB Device",
.manufacturer_name = "Qualcomm Incorporated",
.num_products = ARRAY_SIZE(usb_products),
.products = usb_products,
.num_functions = ARRAY_SIZE(usb_functions_all),
.functions = usb_functions_all,
.serial_number = "1234567890ABCDEF",
};
#endif
static struct platform_device android_usb_device = {
.name = "android_usb",
.id = -1,
.dev = {
.platform_data = &android_usb_pdata,
},
};
#endif
#ifdef CONFIG_USB_MSM_OTG_72K
static int hsusb_rpc_connect(int connect)
{
if (connect)
return msm_hsusb_rpc_connect();
else
return msm_hsusb_rpc_close();
}
#endif
#ifdef CONFIG_USB_MSM_OTG_72K
struct vreg *vreg_3p3;
static int msm_hsusb_ldo_init(int init)
{
if (init) {
vreg_3p3 = vreg_get(NULL, "usb");
if (IS_ERR(vreg_3p3))
return PTR_ERR(vreg_3p3);
vreg_set_level(vreg_3p3, 3300);
} else
vreg_put(vreg_3p3);
return 0;
}
static int msm_hsusb_ldo_enable(int enable)
{
static int ldo_status;
if (!vreg_3p3 || IS_ERR(vreg_3p3))
return -ENODEV;
if (ldo_status == enable)
return 0;
ldo_status = enable;
pr_info("%s: %d", __func__, enable);
if (enable)
return vreg_enable(vreg_3p3);
return vreg_disable(vreg_3p3);
}
static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init)
{
int ret;
if (init) {
ret = msm_pm_app_rpc_init(callback);
} else {
msm_pm_app_rpc_deinit(callback);
ret = 0;
}
return ret;
}
#ifdef CONFIG_ZTE_PLATFORM
static int msm_hsusb_rpc_phy_reset(void __iomem *addr)
{
return msm_hsusb_phy_reset();
}
#endif
static struct msm_otg_platform_data msm_otg_pdata = {
.rpc_connect = hsusb_rpc_connect,
#ifdef CONFIG_ZTE_PLATFORM
.phy_reset = msm_hsusb_rpc_phy_reset,
#endif
.pmic_vbus_notif_init = msm_hsusb_pmic_notif_init,
.chg_vbus_draw = hsusb_chg_vbus_draw,
.chg_connected = hsusb_chg_connected,
.chg_init = hsusb_chg_init,
#ifdef CONFIG_USB_EHCI_MSM
.vbus_power = msm_hsusb_vbus_power,
#endif
.ldo_init = msm_hsusb_ldo_init,
.ldo_enable = msm_hsusb_ldo_enable,
.pclk_required_during_lpm = 1
};
#ifdef CONFIG_USB_GADGET
//static struct msm_hsusb_gadget_platform_data msm_gadget_pdata;
#endif
#endif
#define SND(desc, num) { .name = #desc, .id = num }
static struct snd_endpoint snd_endpoints_list[] = {
SND(HANDSET, 0),
SND(MONO_HEADSET, 2),
SND(HEADSET, 3),
SND(SPEAKER, 6),
SND(TTY_HEADSET, 8),
SND(TTY_VCO, 9),
SND(TTY_HCO, 10),
SND(BT, 12),
SND(IN_S_SADC_OUT_HANDSET, 16),
SND(IN_S_SADC_OUT_SPEAKER_PHONE, 25),
SND(HEADSET_AND_SPEAKER, 26),
SND(CURRENT, 28),
};
#undef SND
static struct msm_snd_endpoints msm_device_snd_endpoints = {
.endpoints = snd_endpoints_list,
.num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint)
};
static struct platform_device msm_device_snd = {
.name = "msm_snd",
.id = -1,
.dev = {
.platform_data = &msm_device_snd_endpoints
},
};
#define DEC0_FORMAT ((1< (1< (1< (1< (1< (1<#define DEC1_FORMAT ((1< (1< (1<#define DEC2_FORMAT ((1< (1< (1<
#ifdef CONFIG_ARCH_MSM7X25
#define DEC3_FORMAT 0
#define DEC4_FORMAT 0
#else
#define DEC3_FORMAT ((1< (1<#define DEC4_FORMAT (1<#endif
static unsigned int dec_concurrency_table[] = {
/* Audio LP */
(DEC0_FORMAT|(1< 0, 0, 0,
/* Concurrency 1 */
(DEC0_FORMAT|(1< (DEC1_FORMAT|(1< (DEC2_FORMAT|(1< (DEC3_FORMAT|(1< (DEC4_FORMAT),
/* Concurrency 2 */
(DEC0_FORMAT|(1< (DEC1_FORMAT|(1< (DEC2_FORMAT|(1< (DEC3_FORMAT|(1< (DEC4_FORMAT),
/* Concurrency 3 */
(DEC0_FORMAT|(1< (DEC1_FORMAT|(1< (DEC2_FORMAT|(1< (DEC3_FORMAT|(1< (DEC4_FORMAT),
/* Concurrency 4 */
(DEC0_FORMAT|(1< (DEC1_FORMAT|(1< (DEC2_FORMAT|(1< (DEC3_FORMAT|(1< (DEC4_FORMAT),
/* Concurrency 5 */
(DEC0_FORMAT|(1< (DEC1_FORMAT|(1< (DEC2_FORMAT|(1< (DEC3_FORMAT|(1< (DEC4_FORMAT),
/* Concurrency 6 */
(DEC0_FORMAT|(1< (DEC1_FORMAT|(1< (DEC2_FORMAT|(1< (DEC3_FORMAT|(1< (DEC4_FORMAT),
};
#define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \
.module_queueid = queueid, .module_decid = decid, \
.nr_codec_support = nr_codec}
static struct msm_adspdec_info dec_info_list[] = {
DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */
DEC_INFO("AUDPLAY1TASK", 14, 1, 5), /* AudPlay1BitStreamCtrlQueue */
DEC_INFO("AUDPLAY2TASK", 15, 2, 5), /* AudPlay2BitStreamCtrlQueue */
#ifdef CONFIG_ARCH_MSM7X25
DEC_INFO("AUDPLAY3TASK", 16, 3, 0), /* AudPlay3BitStreamCtrlQueue */
DEC_INFO("AUDPLAY4TASK", 17, 4, 0), /* AudPlay4BitStreamCtrlQueue */
#else
DEC_INFO("AUDPLAY3TASK", 16, 3, 4), /* AudPlay3BitStreamCtrlQueue */
DEC_INFO("AUDPLAY4TASK", 17, 4, 1), /* AudPlay4BitStreamCtrlQueue */
#endif
};
static struct msm_adspdec_database msm_device_adspdec_database = {
.num_dec = ARRAY_SIZE(dec_info_list),
.num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \
ARRAY_SIZE(dec_info_list)),
.dec_concurrency_table = dec_concurrency_table,
.dec_info_list = dec_info_list,
};
static struct platform_device msm_device_adspdec = {
.name = "msm_adspdec",
.id = -1,
.dev = {
.platform_data = &msm_device_adspdec_database
},
};
static struct android_pmem_platform_data android_pmem_kernel_ebi1_pdata = {
.name = PMEM_KERNEL_EBI1_DATA_NAME,
/* if no allocator_type, defaults to PMEM_ALLOCATORTYPE_BITMAP,
* the only valid choice at this time. The board structure is
* set to all zeros by the C runtime initialization and that is now
* the enum value of PMEM_ALLOCATORTYPE_BITMAP, now forced to 0 in
* include/linux/android_pmem.h.
*/
.cached = 0,
};
static struct android_pmem_platform_data android_pmem_pdata = {
.name = "pmem",
.allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
.cached = 1,
};
static struct android_pmem_platform_data android_pmem_adsp_pdata = {
.name = "pmem_adsp",
.allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
.cached = 0,
};
static struct android_pmem_platform_data android_pmem_audio_pdata = {
.name = "pmem_audio",
.allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
.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_audio_device = {
.name = "android_pmem",
.id = 2,
.dev = { .platform_data = &android_pmem_audio_pdata },
};
static struct platform_device android_pmem_kernel_ebi1_device = {
.name = "android_pmem",
.id = 4,
.dev = { .platform_data = &android_pmem_kernel_ebi1_pdata },
};
static struct msm_handset_platform_data hs_platform_data = {
.hs_name = "7k_handset",
.pwr_key_delay_ms = 500, /* 0 will disable end key */
};
static struct platform_device hs_device = {
.name = "msm-handset",
.id = -1,
.dev = {
.platform_data = &hs_platform_data,
},
};
#define LCDC_CONFIG_PROC 21
#define LCDC_UN_CONFIG_PROC 22
#define LCDC_API_PROG 0x30000066
#define LCDC_API_VERS 0x00010001
#ifdef CONFIG_ZTE_PLATFORM
//lcd reset & spi
#define GPIO_LCD_RESET_OUT 91
#define GPIO_LCD_SPI_CS_OUT 122
#define GPIO_LCD_SPI_SDO_OUT 123
#define GPIO_LCD_SPI_SCLK_OUT 124
#define GPIO_LCD_SPI_SDI_IN 132
#define GPIO_LCD_PANEL_ID 107
#else
#define GPIO_OUT_132 132
#define GPIO_OUT_131 131
#define GPIO_OUT_103 103
#define GPIO_OUT_102 102
#define GPIO_OUT_88 88
#endif
static struct msm_rpc_endpoint *lcdc_ep;
static int msm_fb_lcdc_config(int on)
{
int rc = 0;
struct rpc_request_hdr hdr;
if (on)
pr_info("lcdc config\n");
else
pr_info("lcdc un-config\n");
lcdc_ep = msm_rpc_connect_compatible(LCDC_API_PROG, LCDC_API_VERS, 0);
if (IS_ERR(lcdc_ep)) {
printk(KERN_ERR "%s: msm_rpc_connect failed! rc = %ld\n",
__func__, PTR_ERR(lcdc_ep));
return -EINVAL;
}
rc = msm_rpc_call(lcdc_ep,
(on) ? LCDC_CONFIG_PROC : LCDC_UN_CONFIG_PROC,
&hdr, sizeof(hdr),
5 * HZ);
if (rc)
printk(KERN_ERR
"%s: msm_rpc_call failed! rc = %d\n", __func__, rc);
msm_rpc_close(lcdc_ep);
return rc;
}
#ifdef CONFIG_ZTE_PLATFORM
static int gpio_array_num[] = {
GPIO_LCD_SPI_SCLK_OUT, /* spi_clk */
GPIO_LCD_SPI_CS_OUT, /* spi_cs */
GPIO_LCD_SPI_SDI_IN, /* spi_sdi */
GPIO_LCD_SPI_SDO_OUT, /* spi_sdoi */
GPIO_LCD_RESET_OUT,
GPIO_LCD_PANEL_ID,
};
static void lcdc_lead_gpio_init(void)
{
if (gpio_request(GPIO_LCD_SPI_SCLK_OUT, "spi_clk"))
pr_err("failed to request gpio spi_clk\n");
if (gpio_request(GPIO_LCD_SPI_CS_OUT, "spi_cs"))
pr_err("failed to request gpio spi_cs\n");
if (gpio_request(GPIO_LCD_SPI_SDI_IN, "spi_sdi"))
pr_err("failed to request gpio spi_sdi\n");
if (gpio_request(GPIO_LCD_SPI_SDO_OUT, "spi_sdoi"))
pr_err("failed to request gpio spi_sdoi\n");
if (gpio_request(GPIO_LCD_RESET_OUT, "gpio_dac"))
pr_err("failed to request gpio_dac\n");
if (gpio_request(GPIO_LCD_PANEL_ID, "gpio_id"))
pr_err("failed to request gpio_id\n");
}
static uint32_t lcdc_gpio_table[] = {
GPIO_CFG(GPIO_LCD_SPI_SCLK_OUT, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA),
GPIO_CFG(GPIO_LCD_SPI_CS_OUT, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA),
GPIO_CFG(GPIO_LCD_SPI_SDI_IN, 0, GPIO_INPUT, GPIO_PULL_UP, GPIO_2MA),
GPIO_CFG(GPIO_LCD_SPI_SDO_OUT, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA),
GPIO_CFG(GPIO_LCD_RESET_OUT, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA),
GPIO_CFG(GPIO_LCD_PANEL_ID, 0, GPIO_INPUT, GPIO_NO_PULL, GPIO_2MA),};
#else
static int gpio_array_num[] = {
GPIO_OUT_132, /* spi_clk */
GPIO_OUT_131, /* spi_cs */
GPIO_OUT_103, /* spi_sdi */
GPIO_OUT_102, /* spi_sdoi */
GPIO_OUT_88
};
static void lcdc_gordon_gpio_init(void)
{
if (gpio_request(GPIO_OUT_132, "spi_clk"))
pr_err("failed to request gpio spi_clk\n");
if (gpio_request(GPIO_OUT_131, "spi_cs"))
pr_err("failed to request gpio spi_cs\n");
if (gpio_request(GPIO_OUT_103, "spi_sdi"))
pr_err("failed to request gpio spi_sdi\n");
if (gpio_request(GPIO_OUT_102, "spi_sdoi"))
pr_err("failed to request gpio spi_sdoi\n");
if (gpio_request(GPIO_OUT_88, "gpio_dac"))
pr_err("failed to request gpio_dac\n");
}
static uint32_t lcdc_gpio_table[] = {
GPIO_CFG(GPIO_OUT_132, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA),
GPIO_CFG(GPIO_OUT_131, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA),
GPIO_CFG(GPIO_OUT_103, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA),
GPIO_CFG(GPIO_OUT_102, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA),
GPIO_CFG(GPIO_OUT_88, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA),
};
#endif
static void config_lcdc_gpio_table(uint32_t *table, int len, unsigned enable)
{
int n, rc;
for (n = 0; n < len; n++) {
rc = gpio_tlmm_config(table[n],
enable ? GPIO_ENABLE : GPIO_DISABLE);
if (rc) {
printk(KERN_ERR "%s: gpio_tlmm_config(%#x)=%d\n",
__func__, table[n], rc);
break;
}
}
}
#ifdef CONFIG_ZTE_PLATFORM
static void lcdc_lead_config_gpios(int enable)
#else
static void lcdc_gordon_config_gpios(int enable)
#endif
{
config_lcdc_gpio_table(lcdc_gpio_table,
ARRAY_SIZE(lcdc_gpio_table), enable);
}
static char *msm_fb_lcdc_vreg[] = {
"gp5"
};
static int msm_fb_lcdc_power_save(int on)
{
struct vreg *vreg[ARRAY_SIZE(msm_fb_lcdc_vreg)];
int i, rc = 0;
for (i = 0; i < ARRAY_SIZE(msm_fb_lcdc_vreg); i++) {
if (on) {
vreg[i] = vreg_get(0, msm_fb_lcdc_vreg[i]);
rc = vreg_enable(vreg[i]);
if (rc) {
printk(KERN_ERR "vreg_enable: %s vreg"
"operation failed \n",
msm_fb_lcdc_vreg[i]);
goto bail;
}
} else {
int tmp;
vreg[i] = vreg_get(0, msm_fb_lcdc_vreg[i]);
tmp = vreg_disable(vreg[i]);
if (tmp) {
printk(KERN_ERR "vreg_disable: %s vreg "
"operation failed \n",
msm_fb_lcdc_vreg[i]);
if (!rc)
rc = tmp;
}
/*
tmp = gpio_tlmm_config(GPIO_CFG(GPIO_LCD_RESET_OUT, 0,
GPIO_OUTPUT, GPIO_NO_PULL,
GPIO_2MA), GPIO_ENABLE);
if (tmp) {
printk(KERN_ERR "gpio_tlmm_config failed\n");
if (!rc)
rc = tmp;
}
gpio_set_value(91, 0);
mdelay(15);
gpio_set_value(91, 1);
mdelay(15);
*/
}
}
return rc;
bail:
if (on) {
for (; i > 0; i--)
vreg_disable(vreg[i - 1]);
}
return rc;
}
static struct lcdc_platform_data lcdc_pdata = {
.lcdc_gpio_config = msm_fb_lcdc_config,
.lcdc_power_save = msm_fb_lcdc_power_save,
};
#ifdef CONFIG_ZTE_PLATFORM
static struct msm_panel_common_pdata lcdc_qvga_panel_data = {
.panel_config_gpio = lcdc_lead_config_gpios,
.gpio_num = gpio_array_num,
};
static struct platform_device lcdc_qvga_panel_device = {
.name = "lcdc_panel_qvga",
.id = 0,
.dev = {
.platform_data = &lcdc_qvga_panel_data,
}
};
#else
static struct msm_panel_common_pdata lcdc_gordon_panel_data = {
.panel_config_gpio = lcdc_gordon_config_gpios,
.gpio_num = gpio_array_num,
};
static struct platform_device lcdc_gordon_panel_device = {
.name = "lcdc_gordon_vga",
.id = 0,
.dev = {
.platform_data = &lcdc_gordon_panel_data,
}
};
#endif
static struct resource msm_fb_resources[] = {
{
.flags = IORESOURCE_DMA,
}
};
static int msm_fb_detect_panel(const char *name)
{
int ret = -EPERM;
if (machine_is_msm7x25_ffa() || machine_is_msm7x27_ffa()) {
if (!strcmp(name, "lcdc_gordon_vga"))
ret = 0;
else
ret = -ENODEV;
}
return ret;
}
static struct msm_fb_platform_data msm_fb_pdata = {
.detect_client = msm_fb_detect_panel,
.mddi_prescan = 1,
};
static struct platform_device msm_fb_device = {
.name = "msm_fb",
.id = 0,
.num_resources = ARRAY_SIZE(msm_fb_resources),
.resource = msm_fb_resources,
.dev = {
.platform_data = &msm_fb_pdata,
}
};
#ifdef CONFIG_BT
static struct platform_device msm_bt_power_device = {
.name = "bt_power",
};
//compatible of qualcomm and broadcomm bluetooth chip
static struct platform_device msm_bcm_power_device = {
.name = "bcm_power",
};
//compatible of qualcomm and broadcomm bluetooth chip
enum {
BT_WAKE,
BT_RFR,
BT_CTS,
BT_RX,
BT_TX,
BT_PCM_DOUT,
BT_PCM_DIN,
BT_PCM_SYNC,
BT_PCM_CLK,
BT_HOST_WAKE,
};
static unsigned bt_config_power_on[] = {
GPIO_CFG(90, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA), /* WAKE*/
GPIO_CFG(43, 2, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA), /* RFR */
GPIO_CFG(44, 2, GPIO_INPUT, GPIO_NO_PULL, GPIO_2MA), /* CTS */
GPIO_CFG(45, 2, GPIO_INPUT, GPIO_NO_PULL, GPIO_2MA), /* Rx */
GPIO_CFG(46, 3, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA), /* Tx */
GPIO_CFG(68, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA), /* PCM_DOUT */
GPIO_CFG(69, 1, GPIO_INPUT, GPIO_NO_PULL, GPIO_2MA), /* PCM_DIN */
GPIO_CFG(70, 2, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA), /* PCM_SYNC */
GPIO_CFG(71, 2, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA), /* PCM_CLK */
GPIO_CFG(83, 0, GPIO_INPUT, GPIO_NO_PULL, GPIO_2MA), /* HOST_WAKE */
};
static unsigned bt_config_power_off[] = {
GPIO_CFG(90, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* WAKE */
GPIO_CFG(43, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* RFR */
GPIO_CFG(44, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* CTS */
GPIO_CFG(45, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* Rx */
GPIO_CFG(46, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* Tx */
GPIO_CFG(68, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* PCM_DOUT */
GPIO_CFG(69, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* PCM_DIN */
GPIO_CFG(70, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* PCM_SYNC */
GPIO_CFG(71, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* PCM_CLK */
GPIO_CFG(83, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* HOST_WAKE */
};
static int bluetooth_power(int on)
{
struct vreg *vreg_bt;
int pin, rc;
printk(KERN_DEBUG "%s\n", __func__);
/* do not have vreg bt defined, gp6 is the same */
/* vreg_get parameter 1 (struct device *) is ignored */
vreg_bt = vreg_get(NULL, "gp6");
if (IS_ERR(vreg_bt)) {
printk(KERN_ERR "%s: vreg get failed (%ld)\n",
__func__, PTR_ERR(vreg_bt));
return PTR_ERR(vreg_bt);
}
if (on) {
for (pin = 0; pin < ARRAY_SIZE(bt_config_power_on); pin++) {
rc = gpio_tlmm_config(bt_config_power_on[pin],
GPIO_ENABLE);
if (rc) {
printk(KERN_ERR
"%s: gpio_tlmm_config(%#x)=%d\n",
__func__, bt_config_power_on[pin], rc);
return -EIO;
}
}
/* units of mV, steps of 50 mV */
rc = vreg_set_level(vreg_bt, 1800);
if (rc) {
printk(KERN_ERR "%s: vreg set level failed (%d)\n",
__func__, rc);
return -EIO;
}
rc = vreg_enable(vreg_bt);
if (rc) {
printk(KERN_ERR "%s: vreg enable failed (%d)\n",
__func__, rc);
return -EIO;
}
rc = gpio_request(20, "bt_reset");
if(!rc)
{
gpio_direction_output(20, 1);
}
else
{
printk(KERN_ERR "gpio_request: %d failed!\n", 20);
}
gpio_free(20);
} else {
rc = vreg_disable(vreg_bt);
if (rc) {
printk(KERN_ERR "%s: vreg disable failed (%d)\n",
__func__, rc);
return -EIO;
}
for (pin = 0; pin < ARRAY_SIZE(bt_config_power_off); pin++) {
rc = gpio_tlmm_config(bt_config_power_off[pin],
GPIO_ENABLE);
if (rc) {
printk(KERN_ERR
"%s: gpio_tlmm_config(%#x)=%d\n",
__func__, bt_config_power_off[pin], rc);
return -EIO;
}
}
rc = gpio_request(20, "bt_reset");
if(!rc)
{
gpio_direction_output(20, 0);
}
else
{
printk(KERN_ERR "gpio_request: %d failed!\n", 20);
}
gpio_free(20);
}
return 0;
}
//compatible of qualcomm and broadcomm bluetooth chip
static int bcm_power(int on)
{
// struct vreg *vreg_bt;
int pin, rc;
printk(KERN_DEBUG "%s\n", __func__);
if (on) {
for (pin = 0; pin < ARRAY_SIZE(bt_config_power_on); pin++) {
rc = gpio_tlmm_config(bt_config_power_on[pin],
GPIO_ENABLE);
if (rc) {
printk(KERN_ERR
"%s: gpio_tlmm_config(%#x)=%d\n",
__func__, bt_config_power_on[pin], rc);
return -EIO;
}
}
rc = gpio_request(20, "bt_reset");
if(!rc)
{
gpio_direction_output(20, 0);
mdelay(1);
gpio_direction_output(20, 1);
}
else
{
printk(KERN_ERR "gpio_request: %d failed!\n", 20);
}
gpio_free(20);
} else {
for (pin = 0; pin < ARRAY_SIZE(bt_config_power_off); pin++) {
rc = gpio_tlmm_config(bt_config_power_off[pin],
GPIO_ENABLE);
if (rc) {
printk(KERN_ERR
"%s: gpio_tlmm_config(%#x)=%d\n",
__func__, bt_config_power_off[pin], rc);
return -EIO;
}
}
rc = gpio_request(20, "bt_reset");
if(!rc)
{
gpio_direction_output(20, 0);
}
else
{
printk(KERN_ERR "gpio_request: %d failed!\n", 20);
}
gpio_free(20);
}
return 0;
}
//compatible of qualcomm and broadcomm bluetooth chip
static void __init bt_power_init(void)
{
msm_bt_power_device.dev.platform_data = &bluetooth_power;
msm_bcm_power_device.dev.platform_data = &bcm_power; //compatible of qualcomm and broadcomm bluetooth chip
}
#else
#define bt_power_init(x) do {} while (0)
#endif
#ifdef CONFIG_ARCH_MSM7X27
static struct resource kgsl_resources[] = {
{
.name = "kgsl_reg_memory",
.start = 0xA0000000,
.end = 0xA001ffff,
.flags = IORESOURCE_MEM,
},
{
.name = "kgsl_yamato_irq",
.start = INT_GRAPHICS,
.end = INT_GRAPHICS,
.flags = IORESOURCE_IRQ,
},
};
static struct kgsl_platform_data kgsl_pdata;
static struct platform_device msm_device_kgsl = {
.name = "kgsl",
.id = -1,
.num_resources = ARRAY_SIZE(kgsl_resources),
.resource = kgsl_resources,
.dev = {
.platform_data = &kgsl_pdata,
},
};
#endif
static struct platform_device msm_device_pmic_leds = {
.name = "pmic-leds-status",
.id = -1,
};
static struct gpio_led android_led_list[] = {
{
.name = "button-backlight",
.gpio = 57,
},
};
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 resource bluesleep_resources[] = {
{
.name = "gpio_host_wake",
.start = 83,
.end = 83,
.flags = IORESOURCE_IO,
},
{
.name = "gpio_ext_wake",
.start = 90,
.end = 90,
.flags = IORESOURCE_IO,
},
{
.name = "host_wake",
.start = MSM_GPIO_TO_INT(83),
.end = MSM_GPIO_TO_INT(83),
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device msm_bluesleep_device = {
.name = "bluesleep",
.id = -1,
.num_resources = ARRAY_SIZE(bluesleep_resources),
.resource = bluesleep_resources,
};
//compatible of qualcomm and broadcomm bluetooth chip
static struct platform_device msm_bcmsleep_device = {
.name = "bcmsleep",
.id = -1,
.num_resources = ARRAY_SIZE(bluesleep_resources),
.resource = bluesleep_resources,
};
//compatible of qualcomm and broadcomm bluetooth chip
static struct lis302dl_platform_data gsensor = {
.gpio_intr1 = 84,
.gpio_intr2 = 85,
.scale = 2 ,
.int_active_low = 1,
};
static struct i2c_board_info i2c_devices[] = {
#ifdef CONFIG_SENSORS_AKM8962
{
I2C_BOARD_INFO("akm8962",0x0c),
},
#endif
#ifdef CONFIG_SENSOR_ACCELERATOR
{
.type = "accelerator",
.addr = 0x1d,
},
#endif
#ifdef CONFIG_SENSOR_LIS302DL
{
.type = "lis302dl",
.addr = 0x1C,
.platform_data = &gsensor,
},
#endif
#ifdef CONFIG_SENSOR_ADXL34X
{
I2C_BOARD_INFO("adxl34x", 0x53),
},
#endif
#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
#ifdef CONFIG_MT9P012_KM
{
I2C_BOARD_INFO("mt9p012_km", 0x6C >> 2),
},
#endif
#if defined(CONFIG_MT9T013) || defined(CONFIG_SENSORS_MT9T013)
{
I2C_BOARD_INFO("mt9t013", 0x6C),
},
#endif
#ifdef CONFIG_VB6801
{
I2C_BOARD_INFO("vb6801", 0x20),
},
#endif
#ifdef CONFIG_MT9P111
/*
* Commented by zhang.shengjie
*
* Refer to drivers/media/video/msm/mt9p111.c
* For MT9P111: 5.0Mp, 1/4-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
*
* Attention: I2C device is initialized in sensor's driver if "CONFIG_SENSOR_ADAPTER"
* is defined
*/
#if !defined(CONFIG_SENSOR_ADAPTER)
{
I2C_BOARD_INFO("mt9p111", 0x7A >> 1),
},
#else
//Do nothing
#endif
#endif
#ifdef CONFIG_MT9T11X
/*
*
*
* Refer to drivers/media/video/msm/mt9t11x.c
* For MT9T111: 3.1Mp, 1/4-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
* For MT9T112: 3.1Mp, 1/4-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
*
* Attention: I2C device is initialized in sensor's driver if "CONFIG_SENSOR_ADAPTER"
* is defined
*/
#if !defined(CONFIG_SENSOR_ADAPTER)
{
I2C_BOARD_INFO("mt9t11x", 0x7A >> 1),
},
#else
//Do nothing
#endif
#endif
#ifdef CONFIG_MT9D115
/*
*
*/
#if !defined(CONFIG_SENSOR_ADAPTER)
{
I2C_BOARD_INFO("mt9d115", 0x78 >> 1),
},
#else
//Do nothing
#endif
#endif
#ifdef CONFIG_MT9V113
/*
*
*
* Refer to drivers/media/video/msm/mt9v113.c
* For MT9V113: 0.3Mp, 1/11-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
*/
//mt9v113 is register to aux-i2c
#if !defined(CONFIG_MACH_SAILBOAT)
{
I2C_BOARD_INFO("mt9v113", 0x7a >> 1),
},
#endif
#endif
#ifdef CONFIG_OV5642
/*
* Commented by zhang.shengjie
*
* Refer to drivers/media/video/msm/ov5642.c
* For OV5642: 5.0Mp, 1/11-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
*
* Attention: I2C device is initialized in sensor's driver if "CONFIG_SENSOR_ADAPTER"
* is defined
*/
#if !defined(CONFIG_SENSOR_ADAPTER)
{
I2C_BOARD_INFO("ov5642", 0x78 >> 1),
},
#else
//Do nothing
#endif
#endif
#ifdef CONFIG_OV5640
/*
* Commented by zhang.shengjie
*
* Refer to drivers/media/video/msm/ov5640.c
* For OV5640: 5.0Mp, 1/11-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
*
* Attention: I2C device is initialized in sensor's driver if "CONFIG_SENSOR_ADAPTER"
* is defined
*/
#if !defined(CONFIG_SENSOR_ADAPTER)
{
I2C_BOARD_INFO("ov5640", 0x78 >> 1),
},
#else
//Do nothing
#endif
#endif
#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI
{
.type = "synaptics-rmi-ts",
/*.flags = ,*/
.addr = 0x22,
.irq = MSM_GPIO_TO_INT(18),
},
#endif
#ifdef CONFIG_TOUCHSCREEN_CYPRESS_I2C_RMI
{
.type = "cypress_touch",
/*.flags = ,*/
.addr = 0x0a,
.irq = MSM_GPIO_TO_INT(18),
},
#endif
#ifdef CONFIG_TOUCHSCREEN_FOCALTECH_NEW
{
.type = "ft5x0x_ts",
/*.flags = ,*/
.addr = 0x3E,
.irq = MSM_GPIO_TO_INT(18),
},
#endif
#ifdef CONFIG_TOUCHSCREEN_MXT224
{
I2C_BOARD_INFO(ATMEL_QT602240_NAME, 0x4a ),
.platform_data = &atmel_data,
.irq = MSM_GPIO_TO_INT(18),
},
#endif
};
//mt9v113 is register to aux-i2c udelay 40 -> 2
static struct i2c_gpio_platform_data aux_i2c_gpio_data = {
.sda_pin = 93,
.scl_pin = 92,
.sda_is_open_drain = 1,
.scl_is_open_drain = 1,
.udelay = 2,
};
static struct platform_device aux_i2c_gpio_device = {
.name = "i2c-gpio",
.id = 1,
.dev = {
.platform_data = &aux_i2c_gpio_data
},
};
static struct i2c_gpio_platform_data aux2_i2c_gpio_data = {
.sda_pin = 109,
.scl_pin = 107,
.sda_is_open_drain = 0,
.scl_is_open_drain = 1,
.udelay = 2,
};
static struct platform_device aux2_i2c_gpio_device = {
.name = "i2c-gpio",
.id = 2,
.dev = {
.platform_data = &aux2_i2c_gpio_data
},
};
#ifdef CONFIG_MSM_CAMERA
static uint32_t camera_off_gpio_table[] = {
/* parallel CAMERA interfaces */
/*
* Commented by zh.shj
*
* Refer to drivers/media/video/msm/mt9v113.c
* For MT9V113: 0.3Mp, 1/11-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
*
* Refer to drivers/media/video/msm/mt9p111.c
* For MT9P111: 5.0Mp, 1/4-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
*
* GPIO: 0, 1, 2, and 3 are configured as "CAM30_PWRDN", "CAM500_PWRDN", "CAM500_RST", and "FM_RST"
*/
#if 0
GPIO_CFG(0, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT0 */
GPIO_CFG(1, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT1 */
GPIO_CFG(2, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT2 */
GPIO_CFG(3, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT3 */
GPIO_CFG(4, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT4 */
GPIO_CFG(5, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT5 */
GPIO_CFG(6, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT6 */
GPIO_CFG(7, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT7 */
GPIO_CFG(8, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT8 */
GPIO_CFG(9, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT9 */
GPIO_CFG(10, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT10 */
GPIO_CFG(11, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT11 */
GPIO_CFG(12, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* PCLK */
GPIO_CFG(13, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* HSYNC_IN */
GPIO_CFG(14, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* VSYNC_IN */
GPIO_CFG(15, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA), /* MCLK */
#else
GPIO_CFG(4, 0, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), /* CIF_DATA <0> */
GPIO_CFG(5, 0, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), /* CIF_DATA <1> */
GPIO_CFG(6, 0, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), /* CIF_DATA <2> */
GPIO_CFG(7, 0, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), /* CIF_DATA <3> */
GPIO_CFG(8, 0, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), /* CIF_DATA <4> */
GPIO_CFG(9, 0, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), /* CIF_DATA <5> */
GPIO_CFG(10, 0, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), /* CIF_DATA <6> */
GPIO_CFG(11, 0, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), /* CIF_DATA <7> */
GPIO_CFG(12, 0, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), /* CIF_PCLK */
GPIO_CFG(13, 0, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), /* CIF_HSYNC */
GPIO_CFG(14, 0, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), /* CIF_VSYNC */
GPIO_CFG(15, 0, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), /* CIF_MCLK */
#endif
};
static uint32_t camera_on_gpio_table[] = {
/* parallel CAMERA interfaces */
/*
* Commented by zh.shj
*
* Refer to drivers/media/video/msm/mt9v113.c
* For MT9V113: 0.3Mp, 1/11-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
*
* Refer to drivers/media/video/msm/mt9p111.c
* For MT9P111: 5.0Mp, 1/4-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
*
* GPIO: 0, 1, 2, and 3 are configured as "CAM30_PWRDN", "CAM500_PWRDN", "CAM500_RST", and "FM_RST"
*/
#if 0
GPIO_CFG(0, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT0 */
GPIO_CFG(1, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT1 */
GPIO_CFG(2, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT2 */
GPIO_CFG(3, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT3 */
#endif
GPIO_CFG(4, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT4 */
GPIO_CFG(5, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT5 */
GPIO_CFG(6, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT6 */
GPIO_CFG(7, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT7 */
GPIO_CFG(8, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT8 */
GPIO_CFG(9, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT9 */
GPIO_CFG(10, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT10 */
GPIO_CFG(11, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT11 */
GPIO_CFG(12, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_16MA), /* PCLK */
GPIO_CFG(13, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* HSYNC_IN */
GPIO_CFG(14, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* VSYNC_IN */
GPIO_CFG(15, 1, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_16MA), /* MCLK */
};
static void config_gpio_table(uint32_t *table, int len)
{
int n, rc;
for (n = 0; n < len; n++) {
rc = gpio_tlmm_config(table[n], GPIO_ENABLE);
if (rc) {
printk(KERN_ERR "%s: gpio_tlmm_config(%#x)=%d\n",
__func__, table[n], rc);
break;
}
}
}
static struct vreg *vreg_gp2;
static struct vreg *vreg_gp3;
static void msm_camera_vreg_config(int vreg_en)
{
int rc;
if (vreg_gp2 == NULL) {
vreg_gp2 = vreg_get(NULL, "gp2");
if (IS_ERR(vreg_gp2)) {
printk(KERN_ERR "%s: vreg_get(%s) failed (%ld)\n",
__func__, "gp2", PTR_ERR(vreg_gp2));
return;
}
rc = vreg_set_level(vreg_gp2, 1800);
if (rc) {
printk(KERN_ERR "%s: GP2 set_level failed (%d)\n",
__func__, rc);
}
}
if (vreg_gp3 == NULL) {
vreg_gp3 = vreg_get(NULL, "gp3");
if (IS_ERR(vreg_gp3)) {
printk(KERN_ERR "%s: vreg_get(%s) failed (%ld)\n",
__func__, "gp3", PTR_ERR(vreg_gp3));
return;
}
rc = vreg_set_level(vreg_gp3, 2850);
if (rc) {
printk(KERN_ERR "%s: GP3 set level failed (%d)\n",
__func__, rc);
}
}
if (vreg_en) {
rc = vreg_enable(vreg_gp2);
if (rc) {
printk(KERN_ERR "%s: GP2 enable failed (%d)\n",
__func__, rc);
}
rc = vreg_enable(vreg_gp3);
if (rc) {
printk(KERN_ERR "%s: GP3 enable failed (%d)\n",
__func__, rc);
}
} else {
rc = vreg_disable(vreg_gp2);
if (rc) {
printk(KERN_ERR "%s: GP2 disable failed (%d)\n",
__func__, rc);
}
rc = vreg_disable(vreg_gp3);
if (rc) {
printk(KERN_ERR "%s: GP3 disable failed (%d)\n",
__func__, rc);
}
}
}
static void config_camera_on_gpios(void)
{
int vreg_en = 1;
if (machine_is_msm7x25_ffa() ||
machine_is_msm7x27_ffa())
msm_camera_vreg_config(vreg_en);
config_gpio_table(camera_on_gpio_table,
ARRAY_SIZE(camera_on_gpio_table));
//return 0;
}
static void config_camera_off_gpios(void)
{
int vreg_en = 0;
if (machine_is_msm7x25_ffa() ||
machine_is_msm7x27_ffa())
msm_camera_vreg_config(vreg_en);
config_gpio_table(camera_off_gpio_table,
ARRAY_SIZE(camera_off_gpio_table));
}
/*
*
*
* Camera power setting for backend sensor, i.e., MT9T111/MT9T112/OV5642
* For MT9T111: 3.1Mp, 1/4-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
* For MT9T112: 3.1Mp, 1/4-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
*/
#define MSM_CAMERA_POWER_BACKEND_DVDD_VAL (1800)
#define MSM_CAMERA_POWER_BACKEND_AVDD_VAL (2800)
//add n880 config judgment
#if defined (CONFIG_CAMERA_N880)
#define MSM_CAMERA_POWER_BACKEND_IOVDD_VAL (1800)
int32_t msm_camera_power_backend(enum msm_camera_pwr_mode_t pwr_mode)
{
struct vreg *vreg_cam_dvdd = NULL;
struct vreg *vreg_cam_avdd = NULL;
struct vreg *vreg_cam_iovdd = NULL;
struct vreg *vreg_cam_motor = NULL;
int32_t rc_cam_dvdd;
int32_t rc_cam_avdd;
int32_t rc_cam_iovdd;
int32_t rc_cam_motor;
CDBG("%s: entry\n", __func__);
/*
* Power-up Sequence according to datasheet of sensor:
*
* VREG_CAM_DVDD1V8 = VREG_GP2
* VREG_CAM_IOVDD2V8 = VREG_MSMP
* VREG_CAM_AVDD2V6 = VREG_GP3
*/
vreg_cam_dvdd = vreg_get(0, "gp2");
vreg_cam_iovdd = vreg_get(0, "gp4");
vreg_cam_avdd = vreg_get(0, "gp3");
vreg_cam_motor = vreg_get(0, "gp6");
if ((!vreg_cam_dvdd) || (!vreg_cam_iovdd) || (!vreg_cam_avdd) || (!vreg_cam_motor))
{
CCRT("%s: vreg_get failed!\n", __func__);
return -EIO;
}
switch (pwr_mode)
{
case MSM_CAMERA_PWRUP_MODE:
{
/* DVDD for both 5.0Mp and 3.0Mp camera on board-blade */
rc_cam_dvdd = vreg_set_level(vreg_cam_dvdd, MSM_CAMERA_POWER_BACKEND_DVDD_VAL);
if (rc_cam_dvdd)
{
CCRT("%s: vreg_set_level failed!\n", __func__);
return -EIO;
}
rc_cam_dvdd = vreg_enable(vreg_cam_dvdd);
if (rc_cam_dvdd)
{
CCRT("%s: vreg_enable failed!\n", __func__);
return -EIO;
}
mdelay(1);
rc_cam_iovdd = vreg_set_level(vreg_cam_iovdd, MSM_CAMERA_POWER_BACKEND_IOVDD_VAL);
if (rc_cam_iovdd)
{
CCRT("%s: vreg_set_level failed!\n", __func__);
return -EIO;
}
rc_cam_iovdd = vreg_enable(vreg_cam_iovdd);
if (rc_cam_iovdd)
{
CCRT("%s: vreg_enable failed!\n", __func__);
return -EIO;
}
mdelay(2);
/*
* AVDD for both 5.0Mp and 3.0Mp camera on board-blade
* AVDD and VCM are connected together on board-blade
*/
rc_cam_avdd = vreg_set_level(vreg_cam_avdd, MSM_CAMERA_POWER_BACKEND_AVDD_VAL);
if (rc_cam_avdd)
{
CCRT("%s: vreg_set_level failed!\n", __func__);
return -EIO;
}
rc_cam_avdd = vreg_enable(vreg_cam_avdd);
if (rc_cam_avdd)
{
CCRT("%s: vreg_enable failed!\n", __func__);
return -EIO;
}
rc_cam_motor = vreg_set_level(vreg_cam_motor, MSM_CAMERA_POWER_BACKEND_AVDD_VAL);
if (rc_cam_motor)
{
CCRT("%s: vreg_set_level failed!\n", __func__);
return -EIO;
}
rc_cam_motor = vreg_enable(vreg_cam_motor);
if (rc_cam_avdd)
{
CCRT("%s: vreg_enable failed!\n", __func__);
return -EIO;
}
mdelay(500);
break;
}
case MSM_CAMERA_STANDBY_MODE:
{
rc_cam_avdd = vreg_disable(vreg_cam_avdd);
if (rc_cam_avdd)
{
CCRT("%s: vreg_disable failed!\n", __func__);
return -EIO;
}
rc_cam_motor = vreg_disable(vreg_cam_motor);
if (rc_cam_motor)
{
CCRT("%s: vreg_disable failed!\n", __func__);
return -EIO;
}
break;
}
case MSM_CAMERA_NORMAL_MODE:
{
/*
* AVDD and VCM are connected together on board-blade
*/
rc_cam_avdd = vreg_set_level(vreg_cam_avdd, MSM_CAMERA_POWER_BACKEND_AVDD_VAL);
if (rc_cam_avdd)
{
CCRT("%s: vreg_set_level failed!\n", __func__);
return -EIO;
}
rc_cam_avdd = vreg_enable(vreg_cam_avdd);
if (rc_cam_avdd)
{
CCRT("%s: vreg_enable failed!\n", __func__);
return -EIO;
}
rc_cam_motor = vreg_set_level(vreg_cam_motor, MSM_CAMERA_POWER_BACKEND_AVDD_VAL);
if (rc_cam_motor)
{
CCRT("%s: vreg_set_level failed!\n", __func__);
return -EIO;
}
rc_cam_motor = vreg_enable(vreg_cam_motor);
if (rc_cam_avdd)
{
CCRT("%s: vreg_enable failed!\n", __func__);
return -EIO;
}
mdelay(100);
break;
}
case MSM_CAMERA_PWRDWN_MODE:
{
/*
* Attention: DVDD, AVDD, or MOTORVDD may be used by other devices
*/
rc_cam_dvdd = vreg_disable(vreg_cam_dvdd);
rc_cam_avdd = vreg_disable(vreg_cam_avdd);
if ((rc_cam_dvdd) || (rc_cam_avdd))
{
CCRT("%s: vreg_disable failed!\n", __func__);
return -EIO;
}
rc_cam_motor = vreg_disable(vreg_cam_motor);
if (rc_cam_motor)
{
CCRT("%s: vreg_disable failed!\n", __func__);
return -EIO;
}
break;
}
default:
{
CCRT("%s: parameter not supported!\n", __func__);
return -EIO;
}
}
return 0;
}
#elif defined (CONFIG_MACH_SAILBOAT)
#define MSM_CAMERA_POWER_BACKEND_IOVDD_VAL (2600)
int32_t msm_camera_power_backend(enum msm_camera_pwr_mode_t pwr_mode)
{
struct vreg *vreg_cam_dvdd = NULL;
struct vreg *vreg_cam_avdd = NULL;
struct vreg *vreg_cam_iovdd = NULL;
int32_t rc_cam_dvdd, rc_cam_avdd, rc_cam_iovdd;
CDBG("%s: entry\n", __func__);
/*
* Power-up Sequence according to datasheet of sensor:
*
* VREG_CAM_DVDD1V8 = VREG_GP2
* VREG_CAM_IOVDD2V8 = VREG_MSMP
* VREG_CAM_AVDD2V6 = VREG_GP3
*/
vreg_cam_dvdd = vreg_get(0, "gp2");
vreg_cam_iovdd = vreg_get(0, "gp4");
vreg_cam_avdd = vreg_get(0, "gp3");
if ((!vreg_cam_dvdd) || (!vreg_cam_iovdd) || (!vreg_cam_avdd))
{
CCRT("%s: vreg_get failed!\n", __func__);
return -EIO;
}
switch (pwr_mode)
{
case MSM_CAMERA_PWRUP_MODE:
{
/* DVDD for both 5.0Mp and 3.0Mp camera on board-blade */
rc_cam_dvdd = vreg_set_level(vreg_cam_dvdd, MSM_CAMERA_POWER_BACKEND_DVDD_VAL);
if (rc_cam_dvdd)
{
CCRT("%s: vreg_set_level failed!\n", __func__);
return -EIO;
}
rc_cam_dvdd = vreg_enable(vreg_cam_dvdd);
if (rc_cam_dvdd)
{
CCRT("%s: vreg_enable failed!\n", __func__);
return -EIO;
}
mdelay(1);
rc_cam_iovdd = vreg_set_level(vreg_cam_iovdd, MSM_CAMERA_POWER_BACKEND_IOVDD_VAL);
if (rc_cam_iovdd)
{
CCRT("%s: vreg_set_level failed!\n", __func__);
return -EIO;
}
rc_cam_iovdd = vreg_enable(vreg_cam_iovdd);
if (rc_cam_iovdd)
{
CCRT("%s: vreg_enable failed!\n", __func__);
return -EIO;
}
mdelay(2);
/*
* AVDD for both 5.0Mp and 3.0Mp camera on board-blade
* AVDD and VCM are connected together on board-blade
*/
rc_cam_avdd = vreg_set_level(vreg_cam_avdd, MSM_CAMERA_POWER_BACKEND_AVDD_VAL);
if (rc_cam_avdd)
{
CCRT("%s: vreg_set_level failed!\n", __func__);
return -EIO;
}
rc_cam_avdd = vreg_enable(vreg_cam_avdd);
if (rc_cam_avdd)
{
CCRT("%s: vreg_enable failed!\n", __func__);
return -EIO;
}
mdelay(500);
break;
}
case MSM_CAMERA_STANDBY_MODE:
{
rc_cam_avdd = vreg_disable(vreg_cam_avdd);
if (rc_cam_avdd)
{
CCRT("%s: vreg_disable failed!\n", __func__);
return -EIO;
}
break;
}
case MSM_CAMERA_NORMAL_MODE:
{
/*
* AVDD and VCM are connected together on board-blade
*/
rc_cam_avdd = vreg_set_level(vreg_cam_avdd, MSM_CAMERA_POWER_BACKEND_AVDD_VAL);
if (rc_cam_avdd)
{
CCRT("%s: vreg_set_level failed!\n", __func__);
return -EIO;
}
rc_cam_avdd = vreg_enable(vreg_cam_avdd);
if (rc_cam_avdd)
{
CCRT("%s: vreg_enable failed!\n", __func__);
return -EIO;
}
mdelay(100);
break;
}
case MSM_CAMERA_PWRDWN_MODE:
{
/*
* Attention: DVDD, AVDD, or MOTORVDD may be used by other devices
*/
rc_cam_dvdd = vreg_disable(vreg_cam_dvdd);
rc_cam_iovdd = vreg_disable(vreg_cam_iovdd); //close io vdd
rc_cam_avdd = vreg_disable(vreg_cam_avdd);
if ((rc_cam_dvdd) || (rc_cam_avdd))
{
CCRT("%s: vreg_disable failed!\n", __func__);
return -EIO;
}
break;
}
default:
{
CCRT("%s: parameter not supported!\n", __func__);
return -EIO;
}
}
return 0;
}
#else
#define MSM_CAMERA_POWER_BACKEND_IOVDD_VAL (2600)
int32_t msm_camera_power_backend(enum msm_camera_pwr_mode_t pwr_mode)
{
struct vreg *vreg_cam_dvdd = NULL;
struct vreg *vreg_cam_avdd = NULL;
struct vreg *vreg_cam_iovdd = NULL;
int32_t rc_cam_dvdd, rc_cam_avdd, rc_cam_iovdd;
CDBG("%s: entry\n", __func__);
/*
* Power-up Sequence according to datasheet of sensor:
*
* VREG_CAM_DVDD1V8 = VREG_GP2
* VREG_CAM_IOVDD2V8 = VREG_MSMP
* VREG_CAM_AVDD2V6 = VREG_GP3
*/
vreg_cam_dvdd = vreg_get(0, "gp2");
vreg_cam_iovdd = vreg_get(0, "msmp");
vreg_cam_avdd = vreg_get(0, "gp3");
if ((!vreg_cam_dvdd) || (!vreg_cam_iovdd) || (!vreg_cam_avdd))
{
CCRT("%s: vreg_get failed!\n", __func__);
return -EIO;
}
switch (pwr_mode)
{
case MSM_CAMERA_PWRUP_MODE:
{
/* DVDD for both 5.0Mp and 3.0Mp camera on board-blade */
rc_cam_dvdd = vreg_set_level(vreg_cam_dvdd, MSM_CAMERA_POWER_BACKEND_DVDD_VAL);
if (rc_cam_dvdd)
{
CCRT("%s: vreg_set_level failed!\n", __func__);
return -EIO;
}
rc_cam_dvdd = vreg_enable(vreg_cam_dvdd);
if (rc_cam_dvdd)
{
CCRT("%s: vreg_enable failed!\n", __func__);
return -EIO;
}
mdelay(1);
rc_cam_iovdd = vreg_set_level(vreg_cam_iovdd, MSM_CAMERA_POWER_BACKEND_IOVDD_VAL);
if (rc_cam_iovdd)
{
CCRT("%s: vreg_set_level failed!\n", __func__);
return -EIO;
}
rc_cam_iovdd = vreg_enable(vreg_cam_iovdd);
if (rc_cam_iovdd)
{
CCRT("%s: vreg_enable failed!\n", __func__);
return -EIO;
}
mdelay(2);
/*
* AVDD for both 5.0Mp and 3.0Mp camera on board-blade
* AVDD and VCM are connected together on board-blade
*/
rc_cam_avdd = vreg_set_level(vreg_cam_avdd, MSM_CAMERA_POWER_BACKEND_AVDD_VAL);
if (rc_cam_avdd)
{
CCRT("%s: vreg_set_level failed!\n", __func__);
return -EIO;
}
rc_cam_avdd = vreg_enable(vreg_cam_avdd);
if (rc_cam_avdd)
{
CCRT("%s: vreg_enable failed!\n", __func__);
return -EIO;
}
mdelay(500);
break;
}
case MSM_CAMERA_STANDBY_MODE:
{
rc_cam_avdd = vreg_disable(vreg_cam_avdd);
if (rc_cam_avdd)
{
CCRT("%s: vreg_disable failed!\n", __func__);
return -EIO;
}
break;
}
case MSM_CAMERA_NORMAL_MODE:
{
/*
* AVDD and VCM are connected together on board-blade
*/
rc_cam_avdd = vreg_set_level(vreg_cam_avdd, MSM_CAMERA_POWER_BACKEND_AVDD_VAL);
if (rc_cam_avdd)
{
CCRT("%s: vreg_set_level failed!\n", __func__);
return -EIO;
}
rc_cam_avdd = vreg_enable(vreg_cam_avdd);
if (rc_cam_avdd)
{
CCRT("%s: vreg_enable failed!\n", __func__);
return -EIO;
}
mdelay(100);
break;
}
case MSM_CAMERA_PWRDWN_MODE:
{
/*
* Attention: DVDD, AVDD, or MOTORVDD may be used by other devices
*/
rc_cam_dvdd = vreg_disable(vreg_cam_dvdd);
rc_cam_avdd = vreg_disable(vreg_cam_avdd);
if ((rc_cam_dvdd) || (rc_cam_avdd))
{
CCRT("%s: vreg_disable failed!\n", __func__);
return -EIO;
}
break;
}
default:
{
CCRT("%s: parameter not supported!\n", __func__);
return -EIO;
}
}
return 0;
}
#endif
/*
* Commented by zh.shj
*
* Camera power setting for frontend sensor, i.e., MT9V113
* For MT9V113: 0.3Mp, 1/11-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
*/
//mt9v113 is register to aux-i2c change io av value
#define MSM_CAMERA_POWER_FRONTEND_DVDD_VAL (1800)
#define MSM_CAMERA_POWER_FRONTEND_IOVDD_VAL (2600)
#define MSM_CAMERA_POWER_FRONTEND_AVDD_VAL (2800)
int32_t msm_camera_power_frontend(enum msm_camera_pwr_mode_t pwr_mode)
{
struct vreg *vreg_cam_dvdd = NULL;
struct vreg *vreg_cam_avdd = NULL;
struct vreg *vreg_cam_iovdd = NULL;
int32_t rc_cam_dvdd, rc_cam_avdd, rc_cam_iovdd;
CDBG("%s: entry\n", __func__);
/*
* Power-up Sequence according to datasheet of sensor:
*
* VREG_CAM_DVDD1V8 = VREG_GP2
* VREG_CAM30_2V8 = VREG_GP4
* VREG_CAM_AVDD2V6 = VREG_GP3
*/
vreg_cam_dvdd = vreg_get(0, "gp2");
vreg_cam_iovdd = vreg_get(0, "gp4");
vreg_cam_avdd = vreg_get(0, "gp3");
if ((!vreg_cam_dvdd) || (!vreg_cam_iovdd) || (!vreg_cam_avdd))
{
CCRT("%s: vreg_get failed!\n", __func__);
return -EIO;
}
switch (pwr_mode)
{
case MSM_CAMERA_PWRUP_MODE:
{
rc_cam_dvdd = vreg_set_level(vreg_cam_dvdd, MSM_CAMERA_POWER_FRONTEND_DVDD_VAL);
if (rc_cam_dvdd)
{
CCRT("%s: vreg_set_level failed!\n", __func__);
return -EIO;
}
rc_cam_dvdd = vreg_enable(vreg_cam_dvdd);
if (rc_cam_dvdd)
{
CCRT("%s: vreg_enable failed!\n", __func__);
return -EIO;
}
mdelay(1);
rc_cam_iovdd = vreg_set_level(vreg_cam_iovdd, MSM_CAMERA_POWER_FRONTEND_IOVDD_VAL);
if (rc_cam_iovdd)
{
CCRT("%s: vreg_set_level failed!\n", __func__);
return -EIO;
}
rc_cam_iovdd = vreg_enable(vreg_cam_iovdd);
if (rc_cam_iovdd)
{
CCRT("%s: vreg_enable failed!\n", __func__);
return -EIO;
}
mdelay(2);
rc_cam_avdd = vreg_set_level(vreg_cam_avdd, MSM_CAMERA_POWER_FRONTEND_AVDD_VAL);
if (rc_cam_avdd)
{
CCRT("%s: vreg_set_level failed!\n", __func__);
return -EIO;
}
rc_cam_avdd = vreg_enable(vreg_cam_avdd);
if (rc_cam_avdd)
{
CCRT("%s: vreg_enable failed!\n", __func__);
return -EIO;
}
mdelay(500);
break;
}
case MSM_CAMERA_STANDBY_MODE:
{
CCRT("%s: MSM_CAMERA_STANDBY_MODE not supported!\n", __func__);
return -EIO;
}
case MSM_CAMERA_NORMAL_MODE:
{
CCRT("%s: MSM_CAMERA_NORMAL_MODE not supported!\n", __func__);
return -EIO;
}
case MSM_CAMERA_PWRDWN_MODE:
{
rc_cam_dvdd = vreg_disable(vreg_cam_dvdd);
rc_cam_iovdd = vreg_disable(vreg_cam_iovdd);
rc_cam_avdd = vreg_disable(vreg_cam_avdd);
if ((rc_cam_dvdd) || (rc_cam_iovdd) || (rc_cam_avdd))
{
CCRT("%s: vreg_disable failed!\n", __func__);
return -EIO;
}
break;
}
default:
{
CCRT("%s: parameter not supported!\n", __func__);
return -EIO;
}
}
return 0;
}
/*
* Commented by zh.shj
*
* Camera clock switch for both frontend and backend sensors, i.e., MT9V113 and MT9P111
*
* For MT9V113: 0.3Mp, 1/11-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
* For MT9P111: 5.0Mp, 1/4-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
*
* switch_val: 0, to switch clock to frontend sensor, i.e., MT9V113, or
* 1, to switch clock to backend sensor, i.e., MT9P111
*/
int msm_camera_clk_switch(const struct msm_camera_sensor_info *data,
uint32_t gpio_switch,
uint32_t switch_val)
{
int rc;
CDBG("%s: entry\n", __func__);
rc = gpio_request(gpio_switch, data->sensor_name);
if (0 == rc)
{
/* ignore "rc" */
rc = gpio_direction_output(gpio_switch, switch_val);
/* time delay */
mdelay(1);
}
gpio_free(gpio_switch);
return rc;
}
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,
};
static struct msm_camera_sensor_flash_src msm_flash_src = {
.flash_sr_type = MSM_CAMERA_FLASH_SRC_PMIC,
._fsrc.pmic_src.low_current = 30,
._fsrc.pmic_src.high_current = 100,
};
#ifdef CONFIG_MT9D112
static struct msm_camera_sensor_flash_data flash_mt9d112 = {
.flash_type = MSM_CAMERA_FLASH_LED,
.flash_src = &msm_flash_src
};
static struct msm_camera_sensor_info msm_camera_sensor_mt9d112_data = {
.sensor_name = "mt9d112",
.sensor_reset = 89,
.sensor_pwd = 85,
.vcm_pwd = 0,
.vcm_enable = 0,
.pdata = &msm_camera_device_data,
.flash_data = &flash_mt9d112
};
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_flash_data flash_s5k3e2fx = {
.flash_type = MSM_CAMERA_FLASH_LED,
.flash_src = &msm_flash_src
};
static struct msm_camera_sensor_info msm_camera_sensor_s5k3e2fx_data = {
.sensor_name = "s5k3e2fx",
.sensor_reset = 89,
.sensor_pwd = 85,
.vcm_pwd = 0,
.vcm_enable = 0,
.pdata = &msm_camera_device_data,
.flash_data = &flash_s5k3e2fx
};
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_flash_data flash_mt9p012 = {
.flash_type = MSM_CAMERA_FLASH_LED,
.flash_src = &msm_flash_src
};
static struct msm_camera_sensor_info msm_camera_sensor_mt9p012_data = {
.sensor_name = "mt9p012",
.sensor_reset = 89,
.sensor_pwd = 85,
.vcm_pwd = 88,
.vcm_enable = 0,
.pdata = &msm_camera_device_data,
.flash_data = &flash_mt9p012
};
static struct platform_device msm_camera_sensor_mt9p012 = {
.name = "msm_camera_mt9p012",
.dev = {
.platform_data = &msm_camera_sensor_mt9p012_data,
},
};
#endif
#ifdef CONFIG_MT9P012_KM
static struct msm_camera_sensor_flash_data flash_mt9p012_km = {
.flash_type = MSM_CAMERA_FLASH_LED,
.flash_src = &msm_flash_src
};
static struct msm_camera_sensor_info msm_camera_sensor_mt9p012_km_data = {
.sensor_name = "mt9p012_km",
.sensor_reset = 89,
.sensor_pwd = 85,
.vcm_pwd = 88,
.vcm_enable = 0,
.pdata = &msm_camera_device_data,
.flash_data = &flash_mt9p012_km
};
static struct platform_device msm_camera_sensor_mt9p012_km = {
.name = "msm_camera_mt9p012_km",
.dev = {
.platform_data = &msm_camera_sensor_mt9p012_km_data,
},
};
#endif
#ifdef CONFIG_MT9T013
static struct msm_camera_sensor_flash_data flash_mt9t013 = {
.flash_type = MSM_CAMERA_FLASH_LED,
.flash_src = &msm_flash_src
};
static struct msm_camera_sensor_info msm_camera_sensor_mt9t013_data = {
.sensor_name = "mt9t013",
.sensor_reset = 89,
.sensor_pwd = 85,
.vcm_pwd = 0,
.vcm_enable = 0,
.pdata = &msm_camera_device_data,
.flash_data = &flash_mt9t013
};
static struct platform_device msm_camera_sensor_mt9t013 = {
.name = "msm_camera_mt9t013",
.dev = {
.platform_data = &msm_camera_sensor_mt9t013_data,
},
};
#endif
#ifdef CONFIG_VB6801
static struct msm_camera_sensor_flash_data flash_vb6801 = {
.flash_type = MSM_CAMERA_FLASH_LED,
.flash_src = &msm_flash_src
};
static struct msm_camera_sensor_info msm_camera_sensor_vb6801_data = {
.sensor_name = "vb6801",
.sensor_reset = 89,
.sensor_pwd = 88,
.vcm_pwd = 0,
.vcm_enable = 0,
.pdata = &msm_camera_device_data,
.flash_data = &flash_vb6801
};
static struct platform_device msm_camera_sensor_vb6801 = {
.name = "msm_camera_vb6801",
.dev = {
.platform_data = &msm_camera_sensor_vb6801_data,
},
};
#endif
#ifdef CONFIG_MT9P111
/*
* Commented by zhang.shengjie
*
* Refer to drivers/media/video/msm/mt9p111.c
* For MT9P111: 5.0Mp, 1/4-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
*
* ".vcm_pwd" are DISUSED
*/
/* CHG_CAM_20100401
* Commented by chg
* merge 5320 for camera flash.
*/
static struct msm_camera_sensor_flash_data flash_mt9p111 = {
.flash_type = MSM_CAMERA_FLASH_NONE,
.flash_src = &msm_flash_src
};
static struct msm_camera_sensor_info msm_camera_sensor_mt9p111_data = {
.sensor_name = "mt9p111",
.sensor_reset = 2,
.sensor_pwd = 1,
.vcm_pwd = 0,
.vcm_enable = 0,
.pdata = &msm_camera_device_data,
.flash_data = &flash_mt9p111
};
static struct platform_device msm_camera_sensor_mt9p111 = {
.name = "msm_camera_mt9p111",
.dev = {
.platform_data = &msm_camera_sensor_mt9p111_data,
},
};
#endif
#ifdef CONFIG_MT9T11X
/*
*
*
* Refer to drivers/media/video/msm/mt9t11x.c
* For MT9T111: 3.1Mp, 1/4-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
* For MT9T112: 3.1Mp, 1/4-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
*
* ".vcm_pwd" are DISUSED
*/
/* CHG_CAM_20100401
* Commented by chg
* merge 5320 for camera flash.
*/
static struct msm_camera_sensor_flash_data flash_mt9t11x = {
.flash_type = MSM_CAMERA_FLASH_NONE,
.flash_src = &msm_flash_src
};
static struct msm_camera_sensor_info msm_camera_sensor_mt9t11x_data = {
.sensor_name = "mt9t11x",
.sensor_reset = 2,
.sensor_pwd = 1,
.vcm_pwd = 0,
.vcm_enable = 0,
.pdata = &msm_camera_device_data,
.flash_data = &flash_mt9t11x
};
static struct platform_device msm_camera_sensor_mt9t11x = {
.name = "msm_camera_mt9t11x",
.dev = {
.platform_data = &msm_camera_sensor_mt9t11x_data,
},
};
#endif
#ifdef CONFIG_MT9D115
/*
* MT9D115-2.0Mp-FF-Socket
*/
static struct msm_camera_sensor_flash_data flash_mt9d115 = {
.flash_type = MSM_CAMERA_FLASH_NONE,
.flash_src = &msm_flash_src
};
static struct msm_camera_sensor_info msm_camera_sensor_mt9d115_data = {
.sensor_name = "mt9d115",
.sensor_reset = 2,
.sensor_pwd = 1,
.vcm_pwd = 0,
.vcm_enable = 0,
.pdata = &msm_camera_device_data,
.flash_data = &flash_mt9d115
};
static struct platform_device msm_camera_sensor_mt9d115 = {
.name = "msm_camera_mt9d115",
.dev = {
.platform_data = &msm_camera_sensor_mt9d115_data,
},
};
#endif
#ifdef CONFIG_MT9V113
/*
* Commented by zhang.shengjie
*
* Refer to drivers/media/video/msm/mt9v113.c
* For MT9V113: 0.3Mp, 1/11-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
*/
/* CHG_CAM_20100401
* Commented by chg
* merge 5320 for camera flash.
*/
static struct msm_camera_sensor_flash_data flash_mt9v113 = {
.flash_type = MSM_CAMERA_FLASH_NONE,
.flash_src = &msm_flash_src
};
//mt9v113 is register to aux-i2c reset gpio 26
static struct msm_camera_sensor_info msm_camera_sensor_mt9v113_data = {
.sensor_name = "mt9v113",
.sensor_reset = 26,
.sensor_pwd = 26,
.vcm_pwd = 0,
.vcm_enable = 0,
.pdata = &msm_camera_device_data,
.flash_data = &flash_mt9v113
};
static struct platform_device msm_camera_sensor_mt9v113 = {
.name = "msm_camera_mt9v113",
.dev = {
.platform_data = &msm_camera_sensor_mt9v113_data,
},
};
#endif
#ifdef CONFIG_OV5642
/*
* Commented by zhang.shengjie
*
* Refer to drivers/media/video/msm/ov5642.c
* For OV5642: 5.0Mp, 1/4-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
*
* ".vcm_pwd" are DISUSED
*/
/* CHG_CAM_20100401
* Commented by chg
* merge 5320 for camera flash.
*/
static struct msm_camera_sensor_flash_data flash_ov5642 = {
.flash_type = MSM_CAMERA_FLASH_NONE,
.flash_src = &msm_flash_src
};
static struct msm_camera_sensor_info msm_camera_sensor_ov5642_data = {
.sensor_name = "ov5642",
.sensor_reset = 2,
.sensor_pwd = 1,
.vcm_pwd = 0,
.vcm_enable = 0,
.pdata = &msm_camera_device_data,
.flash_data = &flash_ov5642
};
static struct platform_device msm_camera_sensor_ov5642 = {
.name = "msm_camera_ov5642",
.dev = {
.platform_data = &msm_camera_sensor_ov5642_data,
},
};
#endif
#ifdef CONFIG_OV5640
/*
* Commented by zhang.shengjie
*
* Refer to drivers/media/video/msm/ov5640.c
* For OV5640: 5.0Mp, 1/4-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
*
* ".vcm_pwd" are DISUSED
*/
/* CHG_CAM_20100401
* Commented by chg
* merge 5320 for camera flash.
*/
static struct msm_camera_sensor_flash_data flash_ov5640 = {
.flash_type = MSM_CAMERA_FLASH_NONE,
.flash_src = &msm_flash_src
};
static struct msm_camera_sensor_info msm_camera_sensor_ov5640_data = {
.sensor_name = "ov5640",
.sensor_reset = 2,
.sensor_pwd = 1,
.vcm_pwd = 0,
.vcm_enable = 0,
.pdata = &msm_camera_device_data,
.flash_data = &flash_ov5640
};
static struct platform_device msm_camera_sensor_ov5640 = {
.name = "msm_camera_ov5640",
.dev = {
.platform_data = &msm_camera_sensor_ov5640_data,
},
};
#endif
#endif
/*add touchsreen size definition for mooncake. QVGA*/
#if defined( CONFIG_TOUCHSCREEN_MSM_LEGACY)
struct msm_ts_platform_data msm_tssc_pdata ={
.x_max = 239,
.y_max = 319,
.pressure_max =255,
};
#elif defined( CONFIG_TOUCHSCREEN_MSM)
struct msm_ts_platform_data msm_tssc_pdata = {
.min_x = 0,
.max_x = 239,
.min_y = 0,
.max_y = 319,
.min_press =0,
.max_press =255,
.inv_y = 955,
};
#endif
#if 0
static u32 msm_calculate_batt_capacity(u32 current_voltage);
static struct msm_psy_batt_pdata msm_psy_batt_data = {
.voltage_min_design = 2800,
.voltage_max_design = 4300,
.avail_chg_sources = AC_CHG | USB_CHG ,
.batt_technology = POWER_SUPPLY_TECHNOLOGY_LION,
.calculate_capacity = &msm_calculate_batt_capacity,
};
static u32 msm_calculate_batt_capacity(u32 current_voltage)
{
u32 low_voltage = msm_psy_batt_data.voltage_min_design;
u32 high_voltage = msm_psy_batt_data.voltage_max_design;
return (current_voltage - low_voltage) * 100
/ (high_voltage - low_voltage);
}
static struct platform_device msm_batt_device = {
.name = "msm-battery",
.id = -1,
.dev.platform_data = &msm_psy_batt_data,
};
#else
static u32 msm_calculate_batt_capacity(u32 current_voltage);
typedef struct
{
u32 voltage;
u32 capacity;
} BattFuelCapacity;
static const BattFuelCapacity fuelCapacity[] = {
{3388, 0}, /* 0% */
{3500, 10}, /* 10%,3580 is 15% when 3660 is 20 */
{3660, 20}, /* 20% */
{3710, 30}, /* 30% */
{3761, 40}, /* 40% */
{3801, 50}, /* 50% */
{3842, 60}, /* 60% */
{3909, 70}, /* 70% */
{3977, 80}, /* 80% */
{4066, 90}, /* 90% */
{4150, 100} /* 100% */
};
static struct msm_psy_batt_pdata msm_psy_batt_data = {
.voltage_min_design = 2800,
.voltage_max_design = 4300,
.avail_chg_sources = AC_CHG | USB_CHG ,
.batt_technology = POWER_SUPPLY_TECHNOLOGY_LION,
.calculate_capacity = &msm_calculate_batt_capacity,
};
static u32 msm_calculate_batt_capacity(u32 current_voltage)
{
u8 step = sizeof(fuelCapacity)/sizeof(BattFuelCapacity);
u8 table_count;
if (current_voltage <= fuelCapacity[0].voltage)
{
return 0;
}
else if (current_voltage >= fuelCapacity[step-1].voltage)
{
return 100;
}
else
{
for (table_count = 1; table_count< step; table_count++)
{
if (current_voltage <= fuelCapacity[table_count].voltage)
{
return (fuelCapacity[table_count-1].capacity
+ ((current_voltage - fuelCapacity[table_count-1].voltage)*10
/(fuelCapacity[table_count].voltage -
fuelCapacity[table_count-1].voltage)));
}
}
}
printk("%s: error\n", __func__);
return 0;
}
static struct platform_device msm_batt_device = {
.name = "msm-battery",
.id = -1,
.dev.platform_data = &msm_psy_batt_data,
};
#endif
#ifdef CONFIG_ANDROID_RAM_CONSOLE
static struct resource ram_console_resource[] = {
{
.start = MSM_RAM_CONSOLE_PHYS,
.end = MSM_RAM_CONSOLE_PHYS + MSM_RAM_CONSOLE_SIZE - 1,
.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,
};
#endif
/* ATHENV */
static struct platform_device msm_wlan_ar6000_pm_device = {
.name = "wlan_ar6000_pm_dev",
.id = 1,
.num_resources = 0,
.resource = NULL,
};
/* ATHENV */
static struct platform_device *early_devices[] __initdata = {
#ifdef CONFIG_GPIOLIB
&msm_gpio_devices[0],
&msm_gpio_devices[1],
&msm_gpio_devices[2],
&msm_gpio_devices[3],
&msm_gpio_devices[4],
&msm_gpio_devices[5],
#endif
};
static struct platform_device *devices[] __initdata = {
/* ATHENV */
/*
* It is necessary to put here in order to support WoW.
* Put it before MMC host controller in worst case
*/
&msm_wlan_ar6000_pm_device,
/* ATHENV */
#if !defined(CONFIG_MSM_SERIAL_DEBUGGER)
&msm_device_uart3,
#endif
&msm_device_smd,
&msm_device_dmov,
&msm_device_nand,
#ifdef CONFIG_USB_MSM_OTG_72K
&msm_device_otg,
#ifdef CONFIG_USB_GADGET
&msm_device_gadget_peripheral,
#endif
#endif
#ifdef CONFIG_USB_FUNCTION
&msm_device_hsusb_peripheral,
&mass_storage_device,
#endif
#ifdef CONFIG_USB_ANDROID
&usb_mass_storage_device,
&rndis_device,
#ifdef CONFIG_USB_ANDROID_DIAG
&usb_diag_device,
#endif
&android_usb_device,
#endif
&msm_device_i2c,
&aux_i2c_gpio_device,
&aux2_i2c_gpio_device,
&smc91x_device,
#if defined( CONFIG_TOUCHSCREEN_MSM_LEGACY) || defined( CONFIG_TOUCHSCREEN_MSM)
&msm_device_tssc,
#endif
&android_pmem_kernel_ebi1_device,
&android_pmem_device,
&android_pmem_adsp_device,
&android_pmem_audio_device,
&msm_fb_device,
#ifdef CONFIG_ZTE_PLATFORM
&lcdc_qvga_panel_device,
#else
&lcdc_gordon_panel_device,
#endif
&msm_device_uart_dm1,
#ifdef CONFIG_BT
&msm_bt_power_device,
&msm_bcm_power_device, //compatible of qualcomm and broadcomm bluetooth chip
#endif
&msm_device_pmic_leds,
&android_leds, //button-backlight
&msm_device_snd,
&msm_device_adspdec,
#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
#ifdef CONFIG_MT9P012_KM
&msm_camera_sensor_mt9p012_km,
#endif
#ifdef CONFIG_VB6801
&msm_camera_sensor_vb6801,
#endif
&msm_bluesleep_device,
&msm_bcmsleep_device, //compatible of qualcomm and broadcomm bluetooth chip
#ifdef CONFIG_ARCH_MSM7X27
&msm_device_kgsl,
#endif
#ifdef CONFIG_MT9P111
/*
*
*
* Refer to drivers/media/video/msm/mt9p111.c
* For MT9P111: 5.0Mp, 1/4-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
*/
&msm_camera_sensor_mt9p111,
#endif
#ifdef CONFIG_MT9T11X
/*
*
*
* Refer to drivers/media/video/msm/mt9t11x.c
* For MT9T111: 3.1Mp, 1/4-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
* For MT9T112: 3.1Mp, 1/4-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
*/
&msm_camera_sensor_mt9t11x,
#endif
#ifdef CONFIG_MT9D115
/*
* MT9D115-2.0Mp-FF-Socket
*/
&msm_camera_sensor_mt9d115,
#endif
#ifdef CONFIG_MT9V113
/*
* Commented by zh.shj
*
* Refer to drivers/media/video/msm/mt9v113.c
* For MT9V113: 0.3Mp, 1/11-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
*/
&msm_camera_sensor_mt9v113,
#endif
#ifdef CONFIG_OV5642
/*
* Commented by zh.shj
*
* Refer to drivers/media/video/msm/ov5642.c
* For OV5642: 5.0Mp, 1/4-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
*/
&msm_camera_sensor_ov5642,
#endif
#ifdef CONFIG_OV5640
/*
* Commented by zh.shj
*
* Refer to drivers/media/video/msm/ov5640.c
* For OV5640: 5.0Mp, 1/4-Inch System-On-A-Chip (
SOC) CMOS Digital Image Sensor
*/
&msm_camera_sensor_ov5640,
#endif
&hs_device,
&msm_batt_device,
#ifdef CONFIG_ANDROID_RAM_CONSOLE
&ram_console_device,
#endif
};
static struct msm_panel_common_pdata mdp_pdata = {
.gpio = 97,
};
static void __init msm_fb_add_devices(void)
{
msm_fb_register_device("mdp", &mdp_pdata);
msm_fb_register_device("pmdh", 0);
msm_fb_register_device("lcdc", &lcdc_pdata);
}
static struct i2c_board_info aux_i2c_devices[] = {
#if 0
{
.type = "avago_ofn",
/*.flags = ,*/
.addr = 0x33,
.platform_data = &avago_ofn,
.irq = MSM_GPIO_TO_INT(35),
},
#endif
{
I2C_BOARD_INFO("si4708", 0x10),
},
{
.type = "taos",
.addr = 0x39,
.irq = MSM_GPIO_TO_INT(40),
},
{
.type = "isl29026",
.addr = 0x45,
},
{
.type = "ona3301",
.addr = 0x37,
},
#if defined(CONFIG_MACH_SAILBOAT)
{
I2C_BOARD_INFO("mt9v113", 0x7a>>1),
},
#endif
};
static struct i2c_board_info aux2_i2c_devices[] = {
#ifndef CONFIG_MSENSORS_FROM_AUXI2C_TO_I2C
{
I2C_BOARD_INFO("akm8973", 0x1c),
},
#endif
#ifndef CONFIG_GSENSORS_FROM_AUXI2C_TO_I2C
{
.type = "accelerator",
.addr = 0x1d,
},
#endif
};
extern struct sys_timer msm_timer;
static void __init msm7x2x_init_irq(void)
{
msm_init_irq();
}
static struct msm_acpu_clock_platform_data msm7x2x_clock_data = {
.acpu_switch_time_us = 50,
.max_speed_delta_khz = 400000,
.vdd_switch_time_us = 62,
.max_axi_khz = 160000,
};
void msm_serial_debug_init(unsigned int base, int irq,
struct device *clk_device, int signal_irq);
#ifdef CONFIG_USB_EHCI_MSM
static void msm_hsusb_vbus_power(unsigned phy_info, int on)
{
if (on)
msm_hsusb_vbus_powerup();
else
msm_hsusb_vbus_shutdown();
}
static struct msm_usb_host_platform_data msm_usb_host_pdata = {
.phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_65NM),
.vbus_power = msm_hsusb_vbus_power,
};
static void __init msm7x2x_init_host(void)
{
if (machine_is_msm7x25_ffa() || machine_is_msm7x27_ffa())
return;
msm_add_host(0, &msm_usb_host_pdata);
}
#endif
#if (defined(CONFIG_MMC_MSM_SDC1_SUPPORT)\
|| defined(CONFIG_MMC_MSM_SDC2_SUPPORT)\
|| defined(CONFIG_MMC_MSM_SDC3_SUPPORT)\
|| defined(CONFIG_MMC_MSM_SDC4_SUPPORT))
static unsigned long vreg_sts, gpio_sts;
static struct vreg *vreg_mmc;
static unsigned mpp_mmc = 2;
struct sdcc_gpio {
struct msm_gpio *cfg_data;
uint32_t size;
struct msm_gpio *sleep_cfg_data;
};
static struct msm_gpio sdc1_cfg_data[] = {
{GPIO_CFG(51, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), "sdc1_dat_3"},
{GPIO_CFG(52, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), "sdc1_dat_2"},
{GPIO_CFG(53, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), "sdc1_dat_1"},
{GPIO_CFG(54, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), "sdc1_dat_0"},
{GPIO_CFG(55, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), "sdc1_cmd"},
{GPIO_CFG(56, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), "sdc1_clk"},
};
static struct msm_gpio sdc2_cfg_data[] = {
{GPIO_CFG(62, 2, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), "sdc2_clk"},
{GPIO_CFG(63, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), "sdc2_cmd"},
{GPIO_CFG(64, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), "sdc2_dat_3"},
{GPIO_CFG(65, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), "sdc2_dat_2"},
{GPIO_CFG(66, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), "sdc2_dat_1"},
{GPIO_CFG(67, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), "sdc2_dat_0"},
};
static struct msm_gpio sdc2_sleep_cfg_data[] = {
{GPIO_CFG(62, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), "sdc2_clk"},
{GPIO_CFG(63, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), "sdc2_cmd"},
{GPIO_CFG(64, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), "sdc2_dat_3"},
{GPIO_CFG(65, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), "sdc2_dat_2"},
{GPIO_CFG(66, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), "sdc2_dat_1"},
{GPIO_CFG(67, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), "sdc2_dat_0"},
};
static struct msm_gpio sdc3_cfg_data[] = {
{GPIO_CFG(88, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), "sdc3_clk"},
{GPIO_CFG(89, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), "sdc3_cmd"},
{GPIO_CFG(90, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), "sdc3_dat_3"},
{GPIO_CFG(91, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), "sdc3_dat_2"},
{GPIO_CFG(92, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), "sdc3_dat_1"},
{GPIO_CFG(93, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), "sdc3_dat_0"},
};
static struct msm_gpio sdc4_cfg_data[] = {
{GPIO_CFG(19, 3, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), "sdc4_dat_3"},
{GPIO_CFG(20, 3, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), "sdc4_dat_2"},
{GPIO_CFG(21, 4, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), "sdc4_dat_1"},
{GPIO_CFG(107, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), "sdc4_cmd"},
{GPIO_CFG(108, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), "sdc4_dat_0"},
{GPIO_CFG(109, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), "sdc4_clk"},
};
static struct sdcc_gpio sdcc_cfg_data[] = {
{
.cfg_data = sdc1_cfg_data,
.size = ARRAY_SIZE(sdc1_cfg_data),
.sleep_cfg_data = NULL,
},
{
.cfg_data = sdc2_cfg_data,
.size = ARRAY_SIZE(sdc2_cfg_data),
.sleep_cfg_data = sdc2_sleep_cfg_data,
},
{
.cfg_data = sdc3_cfg_data,
.size = ARRAY_SIZE(sdc3_cfg_data),
.sleep_cfg_data = NULL,
},
{
.cfg_data = sdc4_cfg_data,
.size = ARRAY_SIZE(sdc4_cfg_data),
.sleep_cfg_data = NULL,
},
};
static void msm_sdcc_setup_gpio(int dev_id, unsigned int enable)
{
int rc = 0;
struct sdcc_gpio *curr;
curr = &sdcc_cfg_data[dev_id - 1];
if (!(test_bit(dev_id, &gpio_sts)^enable))
return;
if (enable) {
set_bit(dev_id, &gpio_sts);
rc = msm_gpios_request_enable(curr->cfg_data, curr->size);
if (rc)
printk(KERN_ERR "%s: Failed to turn on GPIOs for slot %d\n",
__func__, dev_id);
} else {
clear_bit(dev_id, &gpio_sts);
if (curr->sleep_cfg_data) {
msm_gpios_enable(curr->sleep_cfg_data, curr->size);
msm_gpios_free(curr->sleep_cfg_data, curr->size);
return;
}
msm_gpios_disable_free(curr->cfg_data, curr->size);
}
}
static uint32_t msm_sdcc_setup_power(struct device *dv, unsigned int vdd)
{
int rc = 0;
struct platform_device *pdev;
pdev = container_of(dv, struct platform_device, dev);
msm_sdcc_setup_gpio(pdev->id, !!vdd);
if(pdev->id==2){
return 0;
}
if (vdd == 0) {
if (!vreg_sts)
return 0;
clear_bit(pdev->id, &vreg_sts);
if (!vreg_sts) {
if (machine_is_msm7x25_ffa() ||
machine_is_msm7x27_ffa()) {
rc = mpp_config_digital_out(mpp_mmc,
MPP_CFG(MPP_DLOGIC_LVL_MSMP,
MPP_DLOGIC_OUT_CTRL_LOW));
} else
rc = vreg_disable(vreg_mmc);
if (rc)
printk(KERN_ERR "%s: return val: %d \n",
__func__, rc);
}
return 0;
}
if (!vreg_sts) {
if (machine_is_msm7x25_ffa() || machine_is_msm7x27_ffa()) {
rc = mpp_config_digital_out(mpp_mmc,
MPP_CFG(MPP_DLOGIC_LVL_MSMP,
MPP_DLOGIC_OUT_CTRL_HIGH));
} else {
rc = vreg_set_level(vreg_mmc, 2850);
if (!rc)
rc = vreg_enable(vreg_mmc);
}
if (rc)
printk(KERN_ERR "%s: return val: %d \n",
__func__, rc);
}
set_bit(pdev->id, &vreg_sts);
return 0;
}
/* ATHENV+++ */
static void (*wifi_status_notify_cb)(int card_present, void *dev_id);
void *wifi_devid;
//static int msm_sdcc_register_status_notify(void (*callback)(int card_present, void *dev_id), void *dev_id)
//{
// wifi_status_notify_cb = callback;
// wifi_devid = dev_id;
// printk("%s: callback %p devid %p\n", __func__, callback, dev_id);
// return 0;
//}
void wifi_detect_change(int on)
{
if (wifi_status_notify_cb) {
printk("%s: callback %p devid %p is called!!\n", __func__, wifi_status_notify_cb, wifi_devid);
wifi_status_notify_cb(on, wifi_devid);
}
}
EXPORT_SYMBOL(wifi_detect_change);
/* ATHENV---*/
#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
static struct mmc_platform_data msm7x2x_sdc1_data = {
.ocr_mask = MMC_VDD_28_29,
.translate_vdd = msm_sdcc_setup_power,
.mmc_bus_width = MMC_CAP_4_BIT_DATA,
.msmsdcc_fmin = 144000,
.msmsdcc_fmid = 24576000,
.msmsdcc_fmax = 49152000,
.nonremovable = 1,
};
#endif
#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
static struct mmc_platform_data msm7x2x_sdc2_data = {
.ocr_mask = MMC_VDD_28_29,
.translate_vdd = msm_sdcc_setup_power,
.mmc_bus_width = MMC_CAP_4_BIT_DATA,
#ifdef CONFIG_MMC_MSM_SDIO_SUPPORT
#if 0
.sdiowakeup_irq = MSM_GPIO_TO_INT(66),
#endif
#endif
.msmsdcc_fmin = 144000,
.msmsdcc_fmid = 24576000,
.msmsdcc_fmax = 49152000,
.nonremovable = 0,
.dummy52_required = 1,
};
#endif
#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
static struct mmc_platform_data msm7x2x_sdc3_data = {
.ocr_mask = MMC_VDD_28_29,
.translate_vdd = msm_sdcc_setup_power,
.mmc_bus_width = MMC_CAP_4_BIT_DATA,
.msmsdcc_fmin = 144000,
.msmsdcc_fmid = 24576000,
.msmsdcc_fmax = 49152000,
.nonremovable = 0,
};
#endif
#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT
static struct mmc_platform_data msm7x2x_sdc4_data = {
.ocr_mask = MMC_VDD_28_29,
.translate_vdd = msm_sdcc_setup_power,
.mmc_bus_width = MMC_CAP_4_BIT_DATA,
.msmsdcc_fmin = 144000,
.msmsdcc_fmid = 24576000,
.msmsdcc_fmax = 49152000,
.nonremovable = 0,
};
#endif
static void __init msm7x2x_init_mmc(void)
{
if (!machine_is_msm7x25_ffa() && !machine_is_msm7x27_ffa()) {
vreg_mmc = vreg_get(NULL, "mmc");
if (IS_ERR(vreg_mmc)) {
printk(KERN_ERR "%s: vreg get failed (%ld)\n",
__func__, PTR_ERR(vreg_mmc));
return;
}
}
#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
if (machine_is_msm7x27_ffa())
msm7x2x_sdc1_data.nonremovable = 0;
msm_add_sdcc(1, &msm7x2x_sdc1_data);
#endif
//if (machine_is_msm7x25_surf() || machine_is_msm7x27_surf() ||
//machine_is_msm7x27_ffa()) {
#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
if (machine_is_msm7x27_ffa())
msm7x2x_sdc2_data.nonremovable = 1;
msm_sdcc_setup_gpio(2, 1);
msm_add_sdcc(2, &msm7x2x_sdc2_data);
#endif
//}
if (machine_is_msm7x25_surf() || machine_is_msm7x27_surf()) {
#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
msm_add_sdcc(3, &msm7x2x_sdc3_data);
#endif
#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT
msm_add_sdcc(4, &msm7x2x_sdc4_data);
#endif
}
}
#else
#define msm7x2x_init_mmc() do {} while (0)
#endif
static struct msm_pm_platform_data msm7x25_pm_data[MSM_PM_SLEEP_MODE_NR] = {
[MSM_PM_SLEEP_MODE_POWER_COLLAPSE].latency = 16000,
[MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN].latency = 12000,
[MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency = 2000,
};
static struct msm_pm_platform_data msm7x27_pm_data[MSM_PM_SLEEP_MODE_NR] = {
[MSM_PM_SLEEP_MODE_POWER_COLLAPSE].supported = 1,
[MSM_PM_SLEEP_MODE_POWER_COLLAPSE].suspend_enabled = 1,
[MSM_PM_SLEEP_MODE_POWER_COLLAPSE].idle_enabled = 1,
[MSM_PM_SLEEP_MODE_POWER_COLLAPSE].latency = 16000,
[MSM_PM_SLEEP_MODE_POWER_COLLAPSE].residency = 20000,
[MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN].supported = 1,
[MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN].suspend_enabled = 1,
[MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN].idle_enabled = 1,
[MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN].latency = 12000,
[MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN].residency = 20000,
[MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].supported = 1,
[MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].suspend_enabled
= 1,
[MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].idle_enabled = 1,
[MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency = 2000,
[MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].residency = 0,
};
static void
msm_i2c_gpio_config(int iface, int config_type)
{
int gpio_scl;
int gpio_sda;
if (iface) {
gpio_scl = 92;
gpio_sda = 93;
} else {
gpio_scl = 60;
gpio_sda = 61;
}
if (config_type) {
gpio_tlmm_config(GPIO_CFG(gpio_scl, 1, GPIO_INPUT,
GPIO_NO_PULL, GPIO_16MA), GPIO_ENABLE);
gpio_tlmm_config(GPIO_CFG(gpio_sda, 1, GPIO_INPUT,
GPIO_NO_PULL, GPIO_16MA), GPIO_ENABLE);
} else {
gpio_tlmm_config(GPIO_CFG(gpio_scl, 0, GPIO_OUTPUT,
GPIO_NO_PULL, GPIO_16MA), GPIO_ENABLE);
gpio_tlmm_config(GPIO_CFG(gpio_sda, 0, GPIO_OUTPUT,
GPIO_NO_PULL, GPIO_16MA), GPIO_ENABLE);
}
}
static struct msm_i2c_platform_data msm_i2c_pdata = {
/*
* Commented by jia.jia, zh.shj
*
* Increase frequency of I2C clock from 100K to 400K (maximum value)
* in order to improve performances of startup and mode switch between
* preview and snapshot for camera ONLY
*
* Set frequency of I2C clock as 100K
*/
.clk_freq = 100000,
.rmutex = 0,
.pri_clk = 60,
.pri_dat = 61,
/*
* Commented by jia.jia, zh.shj
* Disable second msm-i2c interface (merged from v4735)
*/
#if 0
.aux_clk = 95,
.aux_dat = 96,
#endif
.msm_i2c_config_gpio = msm_i2c_gpio_config,
};
static void __init msm_device_i2c_init(void)
{
if (gpio_request(60, "i2c_pri_clk"))
pr_err("failed to request gpio i2c_pri_clk\n");
if (gpio_request(61, "i2c_pri_dat"))
pr_err("failed to request gpio i2c_pri_dat\n");
/*
* Commented by jia.jia, zh.shj
* Disable second msm-i2c interface (merged from v4735)
*/
#if 0
if (gpio_request(95, "i2c_sec_clk"))
pr_err("failed to request gpio i2c_sec_clk\n");
if (gpio_request(96, "i2c_sec_dat"))
pr_err("failed to request gpio i2c_sec_dat\n");
#endif
if (cpu_is_msm7x27())
msm_i2c_pdata.pm_lat =
msm7x27_pm_data[MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN]
.latency;
else
msm_i2c_pdata.pm_lat =
msm7x25_pm_data[MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN]
.latency;
msm_device_i2c.dev.platform_data = &msm_i2c_pdata;
}
#ifdef CONFIG_ZTE_PLATFORM
//USB-HML-001 : USB 3.3V control
#define MSM_GPIO_USB3V3 131
static unsigned usb_config_power_on = GPIO_CFG(MSM_GPIO_USB3V3, 0,
GPIO_OUTPUT, GPIO_PULL_UP, GPIO_2MA);
static int init_usb3v3(void)
{
int rc;
rc = gpio_tlmm_config(usb_config_power_on,GPIO_ENABLE);
if (rc) {
printk(KERN_ERR "%s: gpio_tlmm_config(%#x)=%d\n",__func__, MSM_GPIO_USB3V3, rc);
return -EIO;
}
rc = gpio_request(MSM_GPIO_USB3V3, "usb");
if(!rc)
{
gpio_direction_output(MSM_GPIO_USB3V3, 1);
gpio_set_value(MSM_GPIO_USB3V3, 1);
printk(KERN_ERR "gpio_request: %d ok!\n", MSM_GPIO_USB3V3);
}
else
{
printk(KERN_ERR "gpio_request: %d failed!\n", MSM_GPIO_USB3V3);
}
gpio_free(MSM_GPIO_USB3V3);
return 0;
}
//USB-HML-001 end
#endif
static void usb_mpp_init(void)
{
unsigned rc;
unsigned mpp_usb = 7;
if (machine_is_msm7x25_ffa() || machine_is_msm7x27_ffa()) {
rc = mpp_config_digital_out(mpp_usb,
MPP_CFG(MPP_DLOGIC_LVL_VDD,
MPP_DLOGIC_OUT_CTRL_HIGH));
if (rc)
pr_err("%s: configuring mpp pin"
"to enable 3.3V LDO failed\n", __func__);
}
}
extern void __init msm_init_pmic_vibrator(void);
static ssize_t debug_global_read(struct file *file, char __user *buf,
size_t len, loff_t *offset)
{
loff_t pos = *offset;
ssize_t count;
ssize_t size;
size = sizeof(smem_global);
if (pos >= size)
return 0;
count = min(len, (size_t)(size - pos));
if (copy_to_user(buf, (char *)global + pos, count))
return -EFAULT;
*offset += count;
return count;
}
static struct file_operations debug_global_file_ops = {
.owner = THIS_MODULE,
.read = debug_global_read,
};
#if defined(CONFIG_MACH_SAILBOAT)
static void touch_vdd(void)
{
gpio_tlmm_config(GPIO_CFG(60, 0, GPIO_OUTPUT,
GPIO_NO_PULL, GPIO_16MA), GPIO_ENABLE);
gpio_tlmm_config(GPIO_CFG(61, 0, GPIO_OUTPUT,
GPIO_NO_PULL, GPIO_16MA), GPIO_ENABLE);
gpio_direction_output(60, 0);
gpio_direction_output(61, 0);
gpio_direction_output(31, 0);
gpio_direction_output(29, 0);
msleep(250);
msleep(250);
gpio_direction_output(31, 1);
gpio_direction_input(29);
}
#endif
static void msm7x27_wlan_init(void)
{
int rc = 0;
/* TBD: if (machine_is_msm7x27_ffa_with_wcn1312()) */
if (machine_is_msm7x27_ffa()) {
rc = mpp_config_digital_out(3, MPP_CFG(MPP_DLOGIC_LVL_MSMP,
MPP_DLOGIC_OUT_CTRL_LOW));
if (rc)
printk(KERN_ERR "%s: return val: %d \n",
__func__, rc);
}
}
#ifdef CONFIG_TOUCHSCREEN_VIRTUAL_KEYS
struct kobject *android_touch_kobj;
static void touch_sysfs_init(void)
{
android_touch_kobj = kobject_create_and_add("board_properties", NULL);
if (android_touch_kobj == NULL) {
printk(KERN_ERR "%s: subsystem_register failed\n", __func__);
}
}
#endif
static void __init msm7x2x_init(void)
{
struct proc_dir_entry *entry;
#ifdef CONFIG_ZTE_FTM_FLAG_SUPPORT
zte_ftm_set_value(g_zte_ftm_flag_fixup);
#endif
if (socinfo_init() < 0)
BUG();
#ifdef CONFIG_ARCH_MSM7X25
msm_clock_init(msm_clocks_7x25, msm_num_clocks_7x25);
#elif CONFIG_ARCH_MSM7X27
msm_clock_init(msm_clocks_7x27, msm_num_clocks_7x27);
#endif
platform_add_devices(early_devices, ARRAY_SIZE(early_devices));
#if defined(CONFIG_MSM_SERIAL_DEBUGGER)
msm_serial_debug_init(MSM_UART3_PHYS, INT_UART3,
&msm_device_uart3.dev, 1);
#endif
if (machine_is_msm7x25_ffa() || machine_is_msm7x27_ffa()) {
smc91x_resources[0].start = 0x98000300;
smc91x_resources[0].end = 0x980003ff;
smc91x_resources[1].start = MSM_GPIO_TO_INT(85);
smc91x_resources[1].end = MSM_GPIO_TO_INT(85);
if (gpio_tlmm_config(GPIO_CFG(85, 0,
GPIO_INPUT,
GPIO_PULL_DOWN,
GPIO_2MA),
GPIO_ENABLE)) {
printk(KERN_ERR
"%s: Err: Config GPIO-85 INT\n",
__func__);
}
}
if (cpu_is_msm7x27())
msm7x2x_clock_data.max_axi_khz = 200000;
msm_acpu_clock_init(&msm7x2x_clock_data);
#ifdef CONFIG_ZTE_PLATFORM
init_usb3v3();//USB-HML-001 enable ldo.
#endif
#ifdef CONFIG_ARCH_MSM7X27
/* This value has been set to 160000 for power savings. */
/* OEMs may modify the value at their discretion for performance */
/* The appropriate maximum replacement for 160000 is: */
/* clk_get_max_axi_khz() */
kgsl_pdata.high_axi_3d = 160000;
/* 7x27 doesn't allow graphics clocks to be run asynchronously to */
/* the AXI bus */
kgsl_pdata.max_grp2d_freq = 0;
kgsl_pdata.min_grp2d_freq = 0;
kgsl_pdata.set_grp2d_async = NULL;
kgsl_pdata.max_grp3d_freq = 0;
kgsl_pdata.min_grp3d_freq = 0;
kgsl_pdata.set_grp3d_async = NULL;
kgsl_pdata.imem_clk_name = "imem_clk";
kgsl_pdata.grp3d_clk_name = "grp_clk";
kgsl_pdata.grp3d_pclk_name = "grp_pclk";
kgsl_pdata.grp2d0_clk_name = NULL;
kgsl_pdata.idle_timeout_3d = HZ/5;
kgsl_pdata.idle_timeout_2d = 0;
#ifdef CONFIG_KGSL_PER_PROCESS_PAGE_TABLE
kgsl_pdata.pt_va_size = SZ_32M;
#else
kgsl_pdata.pt_va_size = SZ_128M;
#endif
#endif
#if defined( CONFIG_TOUCHSCREEN_MSM_LEGACY) || defined( CONFIG_TOUCHSCREEN_MSM)
msm_device_tssc.dev.platform_data = &msm_tssc_pdata;
#endif
usb_mpp_init();
#ifdef CONFIG_USB_FUNCTION
msm_hsusb_pdata.swfi_latency =
msm7x27_pm_data
[MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency;
msm_device_hsusb_peripheral.dev.platform_data = &msm_hsusb_pdata;
#endif
#ifdef CONFIG_USB_MSM_OTG_72K
msm_device_otg.dev.platform_data = &msm_otg_pdata;
if (machine_is_msm7x25_surf() || machine_is_msm7x25_ffa()) {
msm_otg_pdata.pemp_level =
PRE_EMPHASIS_WITH_20_PERCENT;
msm_otg_pdata.drv_ampl = HS_DRV_AMPLITUDE_5_PERCENT;
msm_otg_pdata.cdr_autoreset = CDR_AUTO_RESET_ENABLE;
msm_otg_pdata.phy_reset_sig_inverted = 1;
}
if (machine_is_msm7x27_surf() || machine_is_msm7x27_ffa()) {
msm_otg_pdata.pemp_level =
PRE_EMPHASIS_WITH_10_PERCENT;
msm_otg_pdata.drv_ampl = HS_DRV_AMPLITUDE_5_PERCENT;
msm_otg_pdata.cdr_autoreset = CDR_AUTO_RESET_DISABLE;
msm_otg_pdata.phy_reset_sig_inverted = 1;
}
#ifdef CONFIG_USB_GADGET
// msm_gadget_pdata.swfi_latency =
// msm7x27_pm_data
// [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency;
// msm_device_gadget_peripheral.dev.platform_data = &msm_gadget_pdata;
#endif
#endif
msm_init_pmic_vibrator();
platform_add_devices(devices, ARRAY_SIZE(devices));
#ifdef CONFIG_MSM_CAMERA
// config_camera_off_gpios(); /* might not be necessary */
#endif
#if defined(CONFIG_MACH_SAILBOAT)
touch_vdd();
#endif
msm_device_i2c_init();
#ifdef CONFIG_TOUCHSCREEN_VIRTUAL_KEYS
touch_sysfs_init();
#endif
i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
i2c_register_board_info(1, aux_i2c_devices, ARRAY_SIZE(aux_i2c_devices));
i2c_register_board_info(2, aux2_i2c_devices, ARRAY_SIZE(aux2_i2c_devices));
#ifdef CONFIG_SURF_FFA_GPIO_KEYPAD
if (machine_is_msm7x25_ffa() || machine_is_msm7x27_ffa())
platform_device_register(&keypad_device_7k_ffa);
else
platform_device_register(&keypad_device_surf);
#endif
#ifdef CONFIG_ZTE_PLATFORM
lcdc_lead_gpio_init();
#else
lcdc_gordon_gpio_init();
#endif
msm_fb_add_devices();
#ifdef CONFIG_USB_EHCI_MSM
msm7x2x_init_host();
#endif
msm7x2x_init_mmc();
bt_power_init();
if (cpu_is_msm7x27())
msm_pm_set_platform_data(msm7x27_pm_data,
ARRAY_SIZE(msm7x27_pm_data));
else
msm_pm_set_platform_data(msm7x25_pm_data,
ARRAY_SIZE(msm7x25_pm_data));
msm7x27_wlan_init();
global = ioremap(SMEM_LOG_GLOBAL_BASE, sizeof(smem_global));
if (!global) {
printk(KERN_ERR "ioremap failed with SCL_SMEM_LOG_RAM_BASE\n");
return;
}
entry = create_proc_entry("smem_global", S_IFREG | S_IRUGO, NULL);
if (!entry) {
printk(KERN_ERR "smem_global: failed to create proc entry\n");
return;
}
entry->proc_fops = &debug_global_file_ops;
entry->size = sizeof(smem_global);
}
static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE;
static void __init pmem_kernel_ebi1_size_setup(char **p)
{
pmem_kernel_ebi1_size = memparse(*p, p);
}
__early_param("pmem_kernel_ebi1_size=", pmem_kernel_ebi1_size_setup);
static unsigned pmem_mdp_size = MSM_PMEM_MDP_SIZE;
static void __init pmem_mdp_size_setup(char **p)
{
pmem_mdp_size = memparse(*p, p);
}
__early_param("pmem_mdp_size=", pmem_mdp_size_setup);
static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
static void __init pmem_adsp_size_setup(char **p)
{
pmem_adsp_size = memparse(*p, p);
}
__early_param("pmem_adsp_size=", pmem_adsp_size_setup);
static unsigned fb_size = MSM_FB_SIZE;
static void __init fb_size_setup(char **p)
{
fb_size = memparse(*p, p);
}
__early_param("fb_size=", fb_size_setup);
static void __init msm_msm7x2x_allocate_memory_regions(void)
{
void *addr;
unsigned long size;
#if defined(CONFIG_ZTE_PLATFORM) && defined(CONFIG_F3_LOG)
unsigned int len;
smem_global *global_tmp = (smem_global *)(MSM_RAM_LOG_BASE + PAGE_SIZE) ;
len = global_tmp->f3log;
#endif
size = pmem_mdp_size;
if (size) {
addr = alloc_bootmem(size);
android_pmem_pdata.start = __pa(addr);
android_pmem_pdata.size = size;
pr_info("allocating %lu bytes at %p (%lx physical) for mdp "
"pmem arena\n", size, addr, __pa(addr));
}
size = pmem_adsp_size;
if (size) {
addr = alloc_bootmem(size);
android_pmem_adsp_pdata.start = __pa(addr);
android_pmem_adsp_pdata.size = size;
pr_info("allocating %lu bytes at %p (%lx physical) for adsp "
"pmem arena\n", size, addr, __pa(addr));
}
size = MSM_PMEM_AUDIO_SIZE ;
android_pmem_audio_pdata.start = MSM_PMEM_AUDIO_START_ADDR ;
android_pmem_audio_pdata.size = size;
pr_info("allocating %lu bytes (at %lx physical) for audio "
"pmem arena\n", size , MSM_PMEM_AUDIO_START_ADDR);
size = fb_size ? : MSM_FB_SIZE;
addr = alloc_bootmem(size);
msm_fb_resources[0].start = __pa(addr);
msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
size, addr, __pa(addr));
size = pmem_kernel_ebi1_size;
if (size) {
addr = alloc_bootmem_aligned(size, 0x100000);
android_pmem_kernel_ebi1_pdata.start = __pa(addr);
android_pmem_kernel_ebi1_pdata.size = size;
pr_info("allocating %lu bytes at %p (%lx physical) for kernel"
" ebi1 pmem arena\n", size, addr, __pa(addr));
}
#if defined(CONFIG_ZTE_PLATFORM) && defined(CONFIG_F3_LOG)
pr_info("length = %d ++ \n", len);
if (len > 12)
len = 12;
else
len = len/2*2;
pr_info("length = %d -- \n", len);
size = len;
if (size)
reserve_bootmem(0x08D00000, size*0x100000, BOOTMEM_DEFAULT);
addr = phys_to_virt(0x08D00000);
pr_info("allocating %lu M at %p (%lx physical) for F3\n",size, addr, __pa(addr));
#endif
}
static void __init msm7x2x_map_io(void)
{
msm_map_common_io();
msm_msm7x2x_allocate_memory_regions();
#if 0
#ifdef CONFIG_CACHE_L2X0
if (machine_is_msm7x27_surf() || machine_is_msm7x27_ffa() || machine_is_sailboat()) {
/* 7x27 has 256KB L2 cache:
64Kb/Way and 4-Way Associativity;
R/W latency: 3 cycles;
evmon/parity/share disabled. */
l2x0_init(MSM_L2CC_BASE, 0x00068012, 0xfe000000);
}
#endif
#endif
#ifdef CONFIG_CACHE_L2X0
l2x0_init(MSM_L2CC_BASE, 0x00068012, 0xfe000000);
#endif
}
#ifdef CONFIG_ZTE_PLATFORM
#define ATAG_ZTEFTM 0x5d53cd73
static int parse_tag_zteftm(const struct tag *tags)
{
int flag = 0, find = 0;
struct tag *t = (struct tag *)tags;
for (; t->hdr.size; t = tag_next(t)) {
if (t->hdr.tag == ATAG_ZTEFTM) {
printk(KERN_DEBUG "find the zte ftm tag\n");
find = 1;
break;
}
}
if (find)
flag = t->u.revision.rev;
printk(KERN_INFO "[ZYF@FTM]parse_tag_zteftm: zte FTM %s !\n",
flag?"enable":"disable");
return flag;
}
static void __init zte_fixup(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
g_zte_ftm_flag_fixup = parse_tag_zteftm((const struct tag *)tags);
}
int get_ftm_from_tag(void)
{
return g_zte_ftm_flag_fixup;
}
EXPORT_SYMBOL(get_ftm_from_tag);
#endif
//end
MACHINE_START(MSM7X27_SURF, "QCT MSM7x27 SURF")
#ifdef CONFIG_MSM_DEBUG_UART
.phys_io = MSM_DEBUG_UART_PHYS,
.io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
#endif
.boot_params = PHYS_OFFSET + 0x100,
.map_io = msm7x2x_map_io,
.init_irq = msm7x2x_init_irq,
.init_machine = msm7x2x_init,
.timer = &msm_timer,
MACHINE_END
MACHINE_START(MSM7X27_FFA, "QCT MSM7x27 FFA")
#ifdef CONFIG_MSM_DEBUG_UART
.phys_io = MSM_DEBUG_UART_PHYS,
.io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
#endif
.boot_params = PHYS_OFFSET + 0x100,
.map_io = msm7x2x_map_io,
.init_irq = msm7x2x_init_irq,
.init_machine = msm7x2x_init,
.timer = &msm_timer,
MACHINE_END
MACHINE_START(MSM7X25_SURF, "QCT MSM7x25 SURF")
#ifdef CONFIG_MSM_DEBUG_UART
.phys_io = MSM_DEBUG_UART_PHYS,
.io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
#endif
.boot_params = PHYS_OFFSET + 0x100,
.map_io = msm7x2x_map_io,
.init_irq = msm7x2x_init_irq,
.init_machine = msm7x2x_init,
.timer = &msm_timer,
MACHINE_END
MACHINE_START(MSM7X25_FFA, "QCT MSM7x25 FFA")
#ifdef CONFIG_MSM_DEBUG_UART
.phys_io = MSM_DEBUG_UART_PHYS,
.io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
#endif
.boot_params = PHYS_OFFSET + 0x100,
.map_io = msm7x2x_map_io,
.init_irq = msm7x2x_init_irq,
.init_machine = msm7x2x_init,
.timer = &msm_timer,
MACHINE_END
MACHINE_START(SAILBOAT, "sailboat")
#ifdef CONFIG_MSM_DEBUG_UART
.phys_io = MSM_DEBUG_UART_PHYS,
.io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
#endif
.boot_params = PHYS_OFFSET + 0x100,
#ifdef CONFIG_ZTE_PLATFORM
.fixup = zte_fixup,
#endif
.map_io = msm7x2x_map_io,
.init_irq = msm7x2x_init_irq,
.init_machine = msm7x2x_init,
.timer = &msm_timer,
MACHINE_END