rk2928_defconfig: support 'rk2928 phonepad'
authorkfx <kfx@rock-chips.com>
Thu, 25 Oct 2012 08:06:13 +0000 (16:06 +0800)
committerkfx <kfx@rock-chips.com>
Thu, 25 Oct 2012 08:06:13 +0000 (16:06 +0800)
arch/arm/configs/rk2928_defconfig
arch/arm/mach-rk2928/board-phonepad.c [new file with mode: 0644]
arch/arm/mach-rk2928/board-rk2928-config.c
arch/arm/mach-rk2928/board-rk2928.c
arch/arm/mach-rk2928/include/mach/config.h
arch/arm/plat-rk/include/plat/gpio.h
drivers/input/touchscreen/byd693x_ts.c
drivers/input/touchscreen/i30_ts.c

index eb939d032d0afdbef7a5bf9524971f4c7fee8aad..9ac8ea5c691672c62abe34c0d0fb8e948d990158 100644 (file)
@@ -195,6 +195,9 @@ CONFIG_BLK_DEV_LOOP=y
 CONFIG_MISC_DEVICES=y
 CONFIG_UID_STAT=y
 CONFIG_APANIC=y
+CONFIG_MODEM_SOUND=y
+CONFIG_3G_MODULE=y
+CONFIG_SC6610=y
 CONFIG_SCSI=y
 CONFIG_BLK_DEV_SD=y
 CONFIG_SCSI_MULTI_LUN=y
@@ -238,6 +241,8 @@ CONFIG_INPUT_TOUCHSCREEN=y
 CONFIG_EETI_EGALAX=y
 CONFIG_EETI_EGALAX_MAX_X=1087
 CONFIG_EETI_EGALAX_MAX_Y=800
+CONFIG_TOUCHSCREEN_I30=y
+CONFIG_TOUCHSCREEN_BYD693X=y
 CONFIG_TOUCHSCREEN_SITRONIX_A720=y
 CONFIG_INPUT_MISC=y
 CONFIG_INPUT_KEYCHORD=y
@@ -246,6 +251,10 @@ CONFIG_GS_MMA7660=y
 CONFIG_GS_MMA8452=y
 CONFIG_SENSOR_DEVICE=y
 CONFIG_GSENSOR_DEVICE=y
+CONFIG_LIGHT_DEVICE=y
+CONFIG_LS_AP321XX=y
+CONFIG_PROXIMITY_DEVICE=y
+CONFIG_PS_AP321XX=y
 # CONFIG_SERIO is not set
 # CONFIG_CONSOLE_TRANSLATIONS is not set
 # CONFIG_LEGACY_PTYS is not set
@@ -257,6 +266,7 @@ CONFIG_I2C0_CONTROLLER_RK30=y
 CONFIG_I2C1_CONTROLLER_RK30=y
 CONFIG_I2C2_CONTROLLER_RK30=y
 CONFIG_ADC_RK30=y
+CONFIG_RK_HEADSET_DET=y
 CONFIG_GPIO_SYSFS=y
 CONFIG_EXPANDED_GPIO_NUM=0
 CONFIG_EXPANDED_GPIO_IRQ_NUM=0
diff --git a/arch/arm/mach-rk2928/board-phonepad.c b/arch/arm/mach-rk2928/board-phonepad.c
new file mode 100644 (file)
index 0000000..da0d766
--- /dev/null
@@ -0,0 +1,227 @@
+#if defined(CONFIG_SC6610)
+#include <linux/mu509.h>
+#endif
+#if defined(CONFIG_MODEM_SOUND)
+#include "../../../drivers/misc/modem_sound.h"
+#endif
+#include "../../../drivers/headset_observe/rk_headset.h"
+/****************** default paramter *********************/
+enum {
+        DEF_AP_MDM = -1,
+        DEF_AP_HAS_ALSA = -1,
+        DEF_AP_MULTI_CARD = -1,
+        DEF_AP_DATA_ONLY = -1,
+};
+enum {
+        DEF_BP_PWR = 0x000003c2,
+        DEF_BP_RST = -1,
+        DEF_BP_WK_AP = 0x000003c3,
+        DEF_AP_WK_BP = 0x000003c4,
+        DEF_MDM_ASST = 0x000003c5,
+};
+enum {
+        DEF_HD_IO = 0x000001b4,
+        DEF_HK_IO = 0x000000d1,
+};
+enum {
+        DEF_SPKCTL_IO = 0x000003d4,
+};
+/*************************************************************/
+
+/* Android Parameter */
+static int ap_mdm = DEF_AP_MDM;
+module_param(ap_mdm, int, 0644);
+static int ap_has_alsa = DEF_AP_HAS_ALSA;
+module_param(ap_has_alsa, int, 0644);
+static int ap_multi_card = DEF_AP_MULTI_CARD;
+module_param(ap_multi_card, int, 0644);
+static int ap_data_only = DEF_AP_DATA_ONLY;
+module_param(ap_data_only, int, 0644);
+
+/* sc6610 */
+static int bp_pwr = DEF_BP_PWR;
+module_param(bp_pwr, int, 0644);
+static int bp_rst = DEF_BP_RST;
+module_param(bp_rst, int, 0644);
+static int bp_wk_ap = DEF_BP_WK_AP;
+module_param(bp_wk_ap, int, 0644);
+static int ap_wk_bp = DEF_AP_WK_BP;
+module_param(ap_wk_bp, int, 0644);
+static int mdm_asst = DEF_MDM_ASST;
+module_param(mdm_asst, int, 0644);
+int check_sc_param(void)
+{
+        return 0;
+}
+/* headset */
+static int hd_io = DEF_HD_IO;
+module_param(hd_io, int, 0644);
+static int hk_io = DEF_HK_IO;
+module_param(hk_io, int, 0644);
+int check_hd_param(void)
+{
+        return 0;
+}
+/* modem sound */
+static int spkctl_io = DEF_SPKCTL_IO;
+module_param(spkctl_io, int, 0644);
+int check_mdm_sound_param(void)
+{
+        return 0;
+}
+
+#if defined(CONFIG_SC6610)
+static int sc6610_io_init(void)
+{
+        return 0;
+}
+
+static int sc6610_io_deinit(void)
+{
+        return 0;
+}
+
+struct rk29_mu509_data rk29_sc6610_info = {
+        .io_init = sc6610_io_init,
+        .io_deinit = sc6610_io_deinit,
+};
+struct platform_device rk29_device_sc6610 = {
+        .name = "SC6610",
+        .id = -1,
+        .dev            = {
+                .platform_data = &rk29_sc6610_info,
+        }
+    };
+
+static int __init sc_board_init(void)
+{
+        if(check_sc_param() < 0)
+                return -EINVAL;
+        
+        rk29_sc6610_info.bp_power = get_port_config(bp_pwr).gpio;
+        rk29_sc6610_info.bp_reset = get_port_config(bp_rst).gpio;
+        rk29_sc6610_info.bp_wakeup_ap = get_port_config(bp_wk_ap).gpio;
+        rk29_sc6610_info.ap_wakeup_bp = get_port_config(ap_wk_bp).gpio;
+        rk29_sc6610_info.modem_assert = get_port_config(mdm_asst).gpio;
+
+        return 0;
+}
+#else
+static int __init sc_board_init(void)
+{
+        return 0;
+}
+#endif
+#if defined (CONFIG_RK_HEADSET_DET) || defined (CONFIG_RK_HEADSET_IRQ_HOOK_ADC_DET)
+static int rk_headset_io_init(int gpio, char *iomux_name, int iomux_mode)
+{
+       int ret;
+       ret = gpio_request(gpio, "headset_io");
+       if(ret) 
+               return ret;
+
+       rk30_mux_api_set(iomux_name, iomux_mode);
+       gpio_pull_updown(gpio, PullDisable);
+       gpio_direction_input(gpio);
+       mdelay(50);
+       return 0;
+};
+
+static int rk_hook_io_init(int gpio, char *iomux_name, int iomux_mode)
+{
+       int ret;
+       ret = gpio_request(gpio, "hook_io");
+       if(ret) 
+               return ret;
+
+       rk30_mux_api_set(iomux_name, iomux_mode);
+       gpio_pull_updown(gpio, PullDisable);
+       gpio_direction_input(gpio);
+       mdelay(50);
+       return 0;
+};
+
+struct rk_headset_pdata rk_headset_info = {
+               .headset_in_type = HEADSET_IN_HIGH,
+               .hook_key_code = KEY_MEDIA,
+               .headset_gpio_info = {"null", 0},
+               .headset_io_init = rk_headset_io_init,
+               .hook_gpio_info = {"null", 0},
+               .hook_io_init = rk_hook_io_init,
+};
+struct platform_device rk_device_headset = {
+               .name   = "rk_headsetdet",
+               .id     = 0,
+               .dev    = {
+                           .platform_data = &rk_headset_info,
+               }
+};
+
+static int __init hd_board_init(void)
+{
+        if(check_hd_param() < 0)
+                return -EINVAL;
+
+        rk_headset_info.Headset_gpio = get_port_config(hd_io).gpio;
+        rk_headset_info.Hook_gpio = get_port_config(hk_io).gpio;
+        return 0;
+}
+#else
+static int __init hd_board_init(void)
+{
+        return 0;
+}
+#endif
+
+
+#if defined(CONFIG_MODEM_SOUND)
+
+struct modem_sound_data modem_sound_info = {
+};
+
+struct platform_device modem_sound_device = {
+       .name = "modem_sound",
+       .id = -1,
+       .dev            = {
+       .platform_data = &modem_sound_info,
+               }
+       };
+static int __init mdm_sound_board_init(void)
+{
+        struct port_config port;
+        if(check_mdm_sound_param() < 0)
+                return -EINVAL;
+        port = get_port_config(spkctl_io);
+        modem_sound_info.spkctl_io = port.gpio;
+        modem_sound_info.spkctl_active = !port.io.active_low;
+        return 0;
+}
+#else
+static int __init mdm_sound_board_init(void)
+{
+        return 0;
+}
+
+#endif
+
+
+static struct platform_device *phonepad_devices[] __initdata = {
+#if defined(CONFIG_SC6610)
+        &rk29_device_sc6610,
+#endif
+#if defined (CONFIG_RK_HEADSET_DET) ||  defined (CONFIG_RK_HEADSET_IRQ_HOOK_ADC_DET)
+       &rk_device_headset,
+#endif
+#if defined (CONFIG_MODEM_SOUND)
+        &modem_sound_device,
+#endif
+};
+static void __init phonepad_board_init(void)
+{
+        sc_board_init();
+        hd_board_init();
+        mdm_sound_board_init();
+        platform_add_devices(phonepad_devices, ARRAY_SIZE(phonepad_devices));
+}
+
+
index 53a5c1db5e484b24be782f86de8db071d2a2b9a1..e3f690d567fbb3470bd7a31b2fc485080bd46754 100644 (file)
@@ -38,16 +38,6 @@ static struct pwm_io_config pwm_cfg[] = {
 };
 
 /*************************************** parameter ******************************************/
-/* Android Parameter */
-static int ap_mdm = DEF_AP_MDM;
-module_param(ap_mdm, int, 0644);
-static int ap_has_alsa = DEF_AP_HAS_ALSA;
-module_param(ap_has_alsa, int, 0644);
-static int ap_multi_card = DEF_AP_MULTI_CARD;
-module_param(ap_multi_card, int, 0644);
-static int ap_data_only = DEF_AP_DATA_ONLY;
-module_param(ap_data_only, int, 0644);
-
 /* keyboard */
 uint key_adc = DEF_KEY_ADC;
 uint key_val_size = 7;
@@ -117,7 +107,9 @@ static inline int check_gs_param(void)
 {
         int i;
 
-        if(gs_type <= GS_TYPE_NONE || gs_type > GS_TYPE_MAX){
+        if(gs_type == GS_TYPE_NONE)
+                return 0;
+        if(gs_type < GS_TYPE_NONE || gs_type > GS_TYPE_MAX){
                 CONFIG_ERR(gs_type, "gs_type");
                 return -EINVAL;
         }
@@ -137,6 +129,68 @@ static inline int check_gs_param(void)
         }
         return 0;
 }
+/* lsensor */
+static int ls_type = DEF_LS_TYPE;
+
+static int ls_i2c = DEF_LS_I2C;
+module_param(ls_i2c, int, 0644);
+static int ls_addr = DEF_LS_ADDR;
+module_param(ls_addr, int, 0644);
+static int ls_irq = DEF_LS_IRQ;
+module_param(ls_irq, int, 0644);
+static int ls_pwr = DEF_LS_PWR;
+module_param(ls_pwr, int, 0644);
+
+static inline int check_ls_param(void)
+{
+        if(ls_type == LS_TYPE_NONE)
+                return 0;
+        if(ls_type < LS_TYPE_NONE || ls_type > LS_TYPE_MAX){
+                CONFIG_ERR(ls_type, "ls_type");
+                return -EINVAL;
+        }
+        if(ls_i2c < 0 || ls_i2c > 3){
+                CONFIG_ERR(ls_i2c, "ls_i2c");
+                return -EINVAL;
+        }
+        if(ls_addr < 0 || ls_addr > 0x7f){
+                CONFIG_ERR(ls_i2c, "ls_addr");
+                return -EINVAL;
+        }
+        return 0;
+}
+
+
+/* psensor */
+static int ps_type = DEF_PS_TYPE;
+
+static int ps_i2c = DEF_PS_I2C;
+module_param(ps_i2c, int, 0644);
+static int ps_addr = DEF_PS_ADDR;
+module_param(ps_addr, int, 0644);
+static int ps_irq = DEF_PS_IRQ;
+module_param(ps_irq, int, 0644);
+static int ps_pwr = DEF_PS_PWR;
+module_param(ps_pwr, int, 0644);
+
+static inline int check_ps_param(void)
+{
+        if(ps_type == PS_TYPE_NONE)
+                return 0;
+        if(ps_type < PS_TYPE_NONE || ps_type > PS_TYPE_MAX){
+                CONFIG_ERR(ps_type, "ps_type");
+                return -EINVAL;
+        }
+        if(ps_i2c < 0 || ps_i2c > 3){
+                CONFIG_ERR(ps_i2c, "ps_i2c");
+                return -EINVAL;
+        }
+        if(ps_addr < 0 || ps_addr > 0x7f){
+                CONFIG_ERR(ps_i2c, "ps_addr");
+                return -EINVAL;
+        }
+        return 0;
+}
 
 /* pwm regulator */
 static int __sramdata reg_pwm = DEF_REG_PWM;
index c1c9facb42fc5e6904c29322849321b52c83b7ea..19134f74a0e4663d38f14497d3964674b247c5d0 100755 (executable)
@@ -50,6 +50,7 @@
 #include <linux/regulator/rk29-pwm-regulator.h>
 
 #include "board-rk2928-config.c" 
+#include "board-phonepad.c" 
 
 #if defined(CONFIG_HDMI_RK30)
        #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
@@ -570,14 +571,20 @@ extern  int act8931_charge_ok;
 int rk30_battery_adc_io_init(void){
        int ret = 0;
                
-        if(dc_det == -1)
-                return 0;
-
+        if(dc_det != -1){
         ret = port_input_init(dc_det, "dc_det");
-       if (ret) {
-                printk("%s: port(%d) input init faild\n", __func__, dc_det);
-               return ret ;
-       }
+               if (ret) {
+                        printk("%s: port(%d) input init faild\n", __func__, dc_det);
+                       return ret ;
+               }
+        }
+        if(chg_ok != -1){
+        ret = port_input_init(chg_ok, "chg_ok");
+               if (ret) {
+                        printk("%s: port(%d) input init faild\n", __func__, chg_ok);
+                       return ret ;
+               }
+        }
 
        return 0;
 }
@@ -654,6 +661,116 @@ static struct platform_device *devices[] __initdata = {
 #if defined (CONFIG_MFD_TPS65910) && defined (CONFIG_REGULATOR_ACT8931)
 #define TPS65910_HOST_IRQ INVALID_GPIO
 
+static struct pmu_info  tps65910_dcdc_info[] = {
+       {
+               .name          = "vdd_cpu",   //arm
+               .min_uv          = 1200000,\r
+               .max_uv         = 1200000,\r
+       },
+       {
+               .name          = "vdd2",    //ddr
+               .min_uv          = 1200000,
+               .max_uv         = 1200000,
+       },
+       {
+               .name          = "vio",   //vcc_io
+               .min_uv          = 3300000,\r
+               .max_uv         = 3300000,\r
+       },
+       
+};
+static  struct pmu_info  tps65910_ldo_info[] = {\r
+#if defined(RK2928_TB_DEFAULT_CONFIG) || defined(RK2926_TB_DEFAULT_CONFIG)\r
+       {
+               .name          = "vpll",   //vcc25
+               .min_uv          = 2500000,
+               .max_uv         = 2500000,
+       },\r
+       {\r
+               .name          = "vdig1",    //vcc18_cif
+               .min_uv          = 1800000,\r
+               .max_uv         = 1800000,\r
+       },\r
+       {\r
+               .name          = "vdac",   //vccio_wl
+               .min_uv          = 1800000,
+               .max_uv         = 1800000,
+       },\r
+#else\r
+       {\r
+               .name          = "vdig1",    //vcc18_cif
+               .min_uv          = 1500000,\r
+               .max_uv         = 1500000,\r
+       },\r
+\r
+       {
+               .name          = "vdig2",   //vdd11
+               .min_uv          = 1200000,\r
+               .max_uv         = 1200000,\r
+       },
+       {
+               .name          = "vaux1",   //vcc28_cif\r
+               .min_uv          = 2800000,\r
+               .max_uv         = 2800000,\r
+       },
+       {
+               .name          = "vaux2",   //vcca33
+               .min_uv          = 3300000,
+               .max_uv         = 3300000,
+       },
+       {
+               .name          = "vaux33",   //vcc_tp
+               .min_uv          = 3300000,
+               .max_uv         = 3300000,
+       },
+       {
+               .name          = "vmmc",   //\r
+               .min_uv          = 3300000,\r
+               .max_uv         = 3300000,\r
+       },
+#endif\r
+ };\r
+static struct pmu_info  act8931_dcdc_info[] = {\r
+       {
+               .name          = "act_dcdc1",   //vcc_io\r
+               .min_uv          = 3300000,\r
+               .max_uv         = 3300000,\r
+       },
+       {
+               .name          = "act_dcdc2",    //ddr\r
+               .min_uv          = 1500000,\r
+               .max_uv         = 1500000,\r
+       },
+       {
+               .name          = "vdd_cpu",   //vdd_arm\r
+               .min_uv          = 1200000,\r
+               .max_uv         = 1200000,\r
+       },
+       
+};
+static  struct pmu_info  act8931_ldo_info[] = {\r
+       {
+               .name          = "act_ldo1",   //vcc28_cif\r
+               .min_uv          = 2800000,\r
+               .max_uv         = 2800000,\r
+       },\r
+       {\r
+               .name          = "act_ldo2",    //vcc18_cif\r
+               .min_uv          = 1800000,\r
+               .max_uv         = 1800000,\r
+       },\r
+       {\r
+               .name          = "act_ldo3",    //vcca30\r
+               .min_uv          = 3000000,\r
+               .max_uv         = 3000000,\r
+       },\r
+       {\r
+               .name          = "act_ldo4",    //vcc_wl\r
+               .min_uv          = 3300000,\r
+               .max_uv         = 3300000,\r
+       },\r
+};\r
+
 #include "board-rk2928-sdk-tps65910.c"
 #include "board-rk2928-sdk-act8931.c"
 static struct i2c_board_info __initdata pmic_info = {
@@ -894,6 +1011,69 @@ static int __init gs_board_init(void)
         
         return 0;
 }
+#ifdef CONFIG_LS_AP321XX
+static struct sensor_platform_data ls_ap321xx_data = {
+       .type = SENSOR_TYPE_LIGHT,
+       .irq_enable = 1,
+       .poll_delay_ms = 500,
+};
+struct i2c_board_info __initdata ls_ap321xx_info = {
+        .type = "ls_ap321xx",
+        .flags = 0,
+        .platform_data = &ls_ap321xx_data,
+};
+#endif
+static int __init ls_board_init(void)
+{
+        struct port_config port;
+        int ret = check_ls_param();
+
+        if(ret < 0)
+                return ret;
+        port = get_port_config(ls_irq);
+        //ap321xx
+#if defined(CONFIG_LS_AP321XX)
+        if(ls_type == LS_TYPE_AP321XX){
+                ls_ap321xx_info.irq = port.gpio;
+                ls_ap321xx_info.addr = ls_addr;
+               i2c_register_board_info(ls_i2c, &ls_ap321xx_info, 1);
+        }
+#endif
+        return 0;
+}
+
+
+#ifdef CONFIG_PS_AP321XX
+static struct sensor_platform_data ps_ap321xx_data = {
+       .type = SENSOR_TYPE_PROXIMITY,
+       .irq_enable = 1,
+       .poll_delay_ms = 500,
+};
+struct i2c_board_info __initdata ps_ap321xx_info = {
+        .type = "ps_ap321xx",
+        .flags = 0,
+        .platform_data = &ps_ap321xx_data,
+};
+#endif
+static int __init ps_board_init(void)
+{
+        struct port_config port;
+        int ret = check_ps_param();
+
+        if(ret < 0)
+                return ret;
+        port = get_port_config(ps_irq);
+        //ap321xx
+#if defined(CONFIG_PS_AP321XX)
+        if(ps_type == PS_TYPE_AP321XX){
+                ps_ap321xx_info.irq = port.gpio;
+                ps_ap321xx_info.addr = ps_addr;
+               i2c_register_board_info(ps_i2c, &ps_ap321xx_info, 1);
+        }
+#endif
+        return 0;
+}
+
 
 #if defined (CONFIG_RTC_HYM8563)
 struct i2c_board_info __initdata rtc_info = {
@@ -945,6 +1125,12 @@ static int __init rk2928_config_init(void)
         if(ret < 0)
                 return ret;
         ret = gs_board_init();
+        if(ret < 0)
+                return ret;
+        ret = ls_board_init();
+        if(ret < 0)
+                return ret;
+        ret = ps_board_init();
         if(ret < 0)
                 return ret;
         ret = rtc_board_init();
@@ -1046,6 +1232,9 @@ static void __init rk2928_board_init(void)
        rk30_i2c_register_board_info();
        spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
        platform_add_devices(devices, ARRAY_SIZE(devices));
+#if defined(RK2928_PHONEPAD_DEFAULT_CONFIG)
+        phonepad_board_init();
+#endif
 
 }
 static void __init rk2928_reserve(void)
index 9b7aa3b29dd3e9267750695f02986107e17322bf..f79a53c0cc419aed14c6f243966f617c8471f00c 100644 (file)
@@ -2,10 +2,11 @@
 #define __MACH_CONFIG_H
 #include <mach/board.h>
 
-//#define RK2926_TB_DEFAULT_CONFIG
-#define RK2928_TB_DEFAULT_CONFIG
+#define RK2926_TB_DEFAULT_CONFIG
+//#define RK2928_TB_DEFAULT_CONFIG
 //#define RK2926_SDK_DEFAULT_CONFIG
 //#define RK2928_SDK_DEFAULT_CONFIG
+//#define RK2928_PHONEPAD_DEFAULT_CONFIG
 
 enum { 
         GS_TYPE_NONE = 0,
@@ -14,6 +15,16 @@ enum {
         GS_TYPE_KXTIK,
         GS_TYPE_MAX,
 };
+enum {
+        LS_TYPE_NONE = 0,
+        LS_TYPE_AP321XX,
+        LS_TYPE_MAX,
+};
+enum {
+        PS_TYPE_NONE = 0,
+        PS_TYPE_AP321XX,
+        PS_TYPE_MAX,
+};
 enum {
         WIFI_NONE = 0,
         WIFI_USB_NONE = 1<<4,
@@ -23,13 +34,6 @@ enum {
         //here: add sdio wifi type
         WIFI_SDIO_MAX,
 };
-/* android paramter */
-enum {
-        DEF_AP_MDM = -1,
-        DEF_AP_HAS_ALSA = -1,
-        DEF_AP_MULTI_CARD = -1,
-        DEF_AP_DATA_ONLY = -1,
-};
 
 /****************************  rk2926 top board ******************************/
 #if defined(RK2926_TB_DEFAULT_CONFIG)
@@ -65,7 +69,6 @@ enum {
                         202, 102, \
                         1, 0 }
 /* gsensor */
-
 enum {
         DEF_GS_TYPE = GS_TYPE_MMA8452,
         DEF_GS_I2C = 0,
@@ -74,6 +77,23 @@ enum {
         DEF_GS_PWR = -1,
 };
 #define DEF_GS_ORIG {-1, 0, 0, 0, 0, 1, 0,-1, 0}
+/* lsensor */
+enum {
+        DEF_LS_TYPE = LS_TYPE_NONE,
+        DEF_LS_I2C = -1,
+        DEF_LS_ADDR = -1,
+        DEF_LS_IRQ = -1,
+        DEF_LS_PWR = -1,
+};
+/* psensor */
+enum {
+        DEF_PS_TYPE = LS_TYPE_NONE,
+        DEF_PS_I2C = -1,
+        DEF_PS_ADDR = -1,
+        DEF_PS_IRQ = -1,
+        DEF_PS_PWR = -1,
+};
+
 /* pwm regulator */
 enum {
         DEF_REG_PWM = 1,
@@ -167,6 +187,24 @@ enum {
         DEF_GS_PWR = -1,
 };
 #define DEF_GS_ORIG {-1, 0, 0, 0, 0, 1, 0,-1, 0}
+/* lsensor */
+enum {
+        DEF_LS_TYPE = LS_TYPE_NONE,
+        DEF_LS_I2C = -1,
+        DEF_LS_ADDR = -1,
+        DEF_LS_IRQ = -1,
+        DEF_LS_PWR = -1,
+};
+/* psensor */
+enum {
+        DEF_PS_TYPE = LS_TYPE_NONE,
+        DEF_PS_I2C = -1,
+        DEF_PS_ADDR = -1,
+        DEF_PS_IRQ = -1,
+        DEF_PS_PWR = -1,
+};
+
+
 /* pwm regulator */
 enum {
         DEF_REG_PWM = 1,
@@ -261,6 +299,24 @@ enum {
         DEF_GS_PWR = -1,
 };
 #define DEF_GS_ORIG {-1, 0, 0, 0, 0, -1, 0, 1, 0}
+/* lsensor */
+enum {
+        DEF_LS_TYPE = LS_TYPE_NONE,
+        DEF_LS_I2C = -1,
+        DEF_LS_ADDR = -1,
+        DEF_LS_IRQ = -1,
+        DEF_LS_PWR = -1,
+};
+/* psensor */
+enum {
+        DEF_PS_TYPE = LS_TYPE_NONE,
+        DEF_PS_I2C = -1,
+        DEF_PS_ADDR = -1,
+        DEF_PS_IRQ = -1,
+        DEF_PS_PWR = -1,
+};
+
+
 /* pwm regulator */
 enum {
         DEF_REG_PWM = 1,
@@ -354,13 +410,31 @@ enum {
         DEF_GS_PWR = -1,
 };
 #define DEF_GS_ORIG {-1, 0, 0, 0, 0, 1, 0, -1, 0}
+/* lsensor */
+enum {
+        DEF_LS_TYPE = LS_TYPE_NONE,
+        DEF_LS_I2C = -1,
+        DEF_LS_ADDR = -1,
+        DEF_LS_IRQ = -1,
+        DEF_LS_PWR = -1,
+};
+/* psensor */
+enum {
+        DEF_PS_TYPE = LS_TYPE_NONE,
+        DEF_PS_I2C = -1,
+        DEF_PS_ADDR = -1,
+        DEF_PS_IRQ = -1,
+        DEF_PS_PWR = -1,
+};
+
+
 /* pwm regulator */
 enum {
         DEF_REG_PWM = 2,
 };
 /* pmic */
 enum {
-        DEF_PMIC_TYPE = PMIC_TYPE_ACT8931,
+        DEF_PMIC_TYPE = PMIC_TYPE_TPS65910,
         DEF_PMIC_SLP = 0x000000d0,
         DEF_PMIC_IRQ = 0x000003c6,
         DEF_PMIC_I2C = 0,
@@ -405,6 +479,118 @@ enum {
 enum {
         DEF_PWR_ON = 0x000001a1,
 };
+/****************************  rk2928 phonepad ******************************/
+#elif defined(RK2928_PHONEPAD_DEFAULT_CONFIG)
+/* keyboard */
+enum{
+        DEF_KEY_ADC = 1,
+        DEF_PLAY_KEY = 0x000101a4,
+        DEF_VOLDN_KEY = 512 | (1<<31),
+        DEF_VOLUP_KEY = 1  | (1<<31),
+        DEF_MENU_KEY = 0 | (1<<31),
+        DEF_ESC_KEY = 0  | (1<<31),
+        DEF_HOME_KEY = 0 | (1<<31),
+        DEF_CAM_KEY = 0  | (1<<31),
+};
+/* backlight */
+enum{
+        DEF_BL_PWM = 0,
+        DEF_BL_REF = 0,
+        DEF_BL_MIN = 80,
+        DEF_BL_EN = 0x000001b0,
+};
+/* lcd */
+enum {
+        DEF_LCD_CABC = -1,
+        DEF_LCD_EN = 0x000100c3,
+        DEF_LCD_STD = -1,
+};
+
+#define DEF_LCD_PARAM {SCREEN_RGB, OUT_P666, \
+                        30000000, 15000000, \
+                        48, 88, 800, 40, \
+                        3, 32, 480, 13, \
+                        154, 85, \
+                        1, 0 }
+/* gsensor */
+enum {
+        DEF_GS_TYPE = GS_TYPE_KXTIK,
+        DEF_GS_I2C = 1,
+        DEF_GS_ADDR = 0x0f,
+        DEF_GS_IRQ = 0x008003d1,
+        DEF_GS_PWR = -1,
+};
+#define DEF_GS_ORIG {-1, 0, 0, 0, 0, -1, 0, 1, 0}
+/* lsensor */
+enum {
+        DEF_LS_TYPE = LS_TYPE_AP321XX,
+        DEF_LS_I2C = 1,
+        DEF_LS_ADDR = 0x1e,
+        DEF_LS_IRQ = 0x008000c6,
+        DEF_LS_PWR = -1,
+};
+/* psensor */
+enum {
+        DEF_PS_TYPE = PS_TYPE_AP321XX,
+        DEF_PS_I2C = 1,
+        DEF_PS_ADDR = 0x1e,
+        DEF_PS_IRQ = 0x008000c6,
+        DEF_PS_PWR = -1,
+};
+
+
+/* pwm regulator */
+enum {
+        DEF_REG_PWM = 2,
+};
+/* pmic */
+enum {
+        DEF_PMIC_TYPE = PMIC_TYPE_TPS65910,
+        DEF_PMIC_SLP = 0x000001a1,
+        DEF_PMIC_IRQ = 0x000003c6,
+        DEF_PMIC_I2C = 0,
+        DEF_PMIC_ADDR = 0x5b, 
+};
+/* ion */
+enum {
+        DEF_ION_SIZE = 80 * 1024 * 1024,
+};
+/* codec */
+enum {
+        DEF_SPK_CTL = 0x000003d4,
+        DEF_HP_DET = -1,
+};
+/* sdmmc */
+enum {
+        DEF_SD_DET = 0x000101c1,
+};
+/* wifi */
+enum {
+        DEF_WIFI_RST = -1,
+        DEF_WIFI_PWR = -1,
+        DEF_WIFI_TYPE = WIFI_NONE, 
+};
+/* rtc */
+enum {
+        DEF_RTC_I2C = 0,
+        DEF_RTC_ADDR = 0x51,
+        DEF_RTC_IRQ = 0x008001a5,
+};
+/* charge */
+enum {
+        DEF_CHG_ADC = 0,
+        DEF_DC_DET = 0x001101a5,
+        DEF_BAT_LOW = -1,
+        DEF_CHG_OK = 0x002001a0,
+        DEF_CHG_SET = -1,
+        DEF_CHG_SEL = -1,
+};
+
+/* global */
+enum {
+        DEF_PWR_ON = 0x000001a2,
+};
+
 
 /****************************  other ******************************/
 #else
@@ -448,6 +634,24 @@ enum {
         DEF_GS_PWR = -1,
 };
 #define DEF_GS_ORIG {0, 0, 0, 0, 0, 0, 0, 0, 0}
+/* lsensor */
+enum {
+        DEF_LS_TYPE = LS_TYPE_NONE,
+        DEF_LS_I2C = -1,
+        DEF_LS_ADDR = -1,
+        DEF_LS_IRQ = -1,
+        DEF_LS_PWR = -1,
+};
+/* psensor */
+enum {
+        DEF_PS_TYPE = LS_TYPE_NONE,
+        DEF_PS_I2C = -1,
+        DEF_PS_ADDR = -1,
+        DEF_PS_IRQ = -1,
+        DEF_PS_PWR = -1,
+};
+
+
 /* pwm regulator */
 enum {
         DEF_REG_PWM = -1,
index fea57db44d88b78184921be7c85f5a7fac04ca13..f83ff524d2f14465c369f722f5621be93b936b09 100644 (file)
@@ -43,7 +43,10 @@ static inline struct port_config get_port_config(unsigned int value)
         struct port_config port;
 
         port.v = value;
-        port.gpio = PIN_BASE + port.io.bank * 32 + (port.io.goff - 0x0A) * 8 + port.io.off;
+        if(value == 0xffffffff)
+                port.gpio = INVALID_GPIO;
+        else
+                port.gpio = PIN_BASE + port.io.bank * 32 + (port.io.goff - 0x0A) * 8 + port.io.off;
 
         return port;
 }
index 02b4230405402e1893b1109eee79eb6659f45766..f3522f94bff4802b4c43a96a01004ec3b0ec37d7 100644 (file)
@@ -20,7 +20,9 @@
 #include <asm/io.h>\r
 #include <asm/uaccess.h>\r
 #include <linux/gpio.h>\r
-\r
+#ifdef CONFIG_RK_CONFIG\r
+#include <mach/config.h>\r
+#endif\r
 #include <mach/irqs.h>\r
 //#include <mach/system.h>\r
 //#include <mach/hardware.h>\r
@@ -32,7 +34,6 @@
     #include <linux/earlysuspend.h>\r
 #endif\r
 \r
-\r
 //#define      CONFIG_TS_FUNCTION_CALLED_DEBUG                 //Display the debug information whitch function is called\r
 //#define CONFIG_TS_PROBE_DEBUG                //Display the debug information in byd693x_ts_probe function\r
 //#define CONFIG_TS_I2C_TRANSFER_DEBUG         //Display the debug information of IIC transfer\r
@@ -58,6 +59,44 @@ struct ChipSetting {
 #define VERSION        "byd693x_20120731_16:52_V1.2_Charles@Raysens@Zed"\r
 #define CTP_NAME       "byd693x-ts"\r
 \r
+#define TP_MODULE_NAME  CTP_NAME\r
+#ifdef CONFIG_RK_CONFIG\r
+\r
+enum {\r
+#if defined(RK2928_PHONEPAD_DEFAULT_CONFIG)\r
+        DEF_EN = 1,\r
+#else\r
+        DEF_EN = 0,\r
+#endif\r
+        DEF_IRQ = 0x002003c7,\r
+        DEF_RST = 0X000003d5,\r
+        DEF_I2C = 2, \r
+        DEF_ADDR = 0x52,\r
+        DEF_X_MAX = 800,\r
+        DEF_Y_MAX = 480,\r
+};\r
+static int en = DEF_EN;\r
+module_param(en, int, 0644);\r
+\r
+static int irq = DEF_IRQ;\r
+module_param(irq, int, 0644);\r
+static int rst =DEF_RST;\r
+module_param(rst, int, 0644);\r
+\r
+static int i2c = DEF_I2C;            // i2c channel\r
+module_param(i2c, int, 0644);\r
+static int addr = DEF_ADDR;           // i2c addr\r
+module_param(addr, int, 0644);\r
+static int x_max = DEF_X_MAX;\r
+module_param(x_max, int, 0644);\r
+static int y_max = DEF_Y_MAX;\r
+module_param(y_max, int, 0644);\r
+\r
+#include "rk_tp.c"\r
+#endif\r
+\r
+\r
+\r
 struct byd_platform_data *byd6932_pdata; \r
 \r
 \r
@@ -352,9 +391,25 @@ static int byd693x_ts_probe(struct i2c_client *client,const struct i2c_device_id
        struct byd_platform_data *pdata = client->dev.platform_data;\r
        unsigned char tp_buf[1];\r
        int error = -1;\r
+#ifdef CONFIG_RK_CONFIG\r
+        struct port_config rst_cfg = get_port_config(rst);\r
+        struct port_config irq_cfg = get_port_config(irq);\r
+\r
+        if(!pdata){\r
+                pdata = kzalloc(sizeof(struct byd_platform_data), GFP_KERNEL);\r
+                if(!pdata){\r
+                       printk("byd693x_ts_probe: kzalloc Error!\n");\r
+                        return -ENOMEM;\r
+                };\r
+        }\r
+        pdata->rst_pin = rst_cfg.gpio;\r
+        pdata->int_pin = irq_cfg.gpio;\r
+        pdata->screen_max_x = x_max;\r
+        pdata->screen_max_y = y_max;\r
+#endif\r
 \r
 \r
-       byd6932_pdata = client->dev.platform_data;\r
+       byd6932_pdata = pdata;\r
        #ifdef CONFIG_TS_FUNCTION_CALLED_DEBUG\r
                printk("+-----------------------------------------+\n");\r
                printk("|       byd693x_ts_probe!                 |\n");\r
@@ -671,6 +726,13 @@ static char banner[] __initdata = KERN_INFO "BYD Touchscreen driver, (c) 2012 BY
 static int __init byd693x_ts_init(void)\r
 {\r
        int ret;\r
+\r
+#ifdef CONFIG_RK_CONFIG\r
+        ret = tp_board_init();\r
+\r
+        if(ret < 0)\r
+                return ret;\r
+#endif\r
        #ifdef CONFIG_TS_FUNCTION_CALLED_DEBUG\r
        printk("+-----------------------------------------+\n");\r
        printk("|       byd_ts_init!                      |\n");\r
index 87efe8b90438d061616757097531028ec2cc4751..82652144fe30a7b22f104b934ec312080d3f4b29 100755 (executable)
 //#include <mach/vpu_mem.h>
 #include <mach/sram.h>
 #include <linux/earlysuspend.h>
+#ifdef CONFIG_RK_CONFIG
+#include <mach/config.h>
+#include <linux/regulator/rk29-pwm-regulator.h>
+#endif
 static struct early_suspend ft5306_power;
 
 
@@ -86,6 +90,81 @@ static struct early_suspend ft5306_power;
 #define PMODE_STANDBY             0x02
 #define PMODE_HIBERNATE           0x03
 
+#define TP_MODULE_NAME  FT5X0X_NAME
+#ifdef CONFIG_RK_CONFIG
+
+enum {
+#if defined(RK2928_PHONEPAD_DEFAULT_CONFIG)
+        DEF_EN = 1,
+#else
+        DEF_EN = 0,
+#endif
+        DEF_IRQ = 0x002003c7,
+        DEF_RST = 0X000003d5,
+        DEF_I2C = 2, 
+        DEF_ADDR = 0x38,
+        DEF_X_MAX = 800,
+        DEF_Y_MAX = 480,
+};
+static int en = DEF_EN;
+module_param(en, int, 0644);
+
+static int irq = DEF_IRQ;
+module_param(irq, int, 0644);
+static int rst =DEF_RST;
+module_param(rst, int, 0644);
+
+static int i2c = DEF_I2C;            // i2c channel
+module_param(i2c, int, 0644);
+static int addr = DEF_ADDR;           // i2c addr
+module_param(addr, int, 0644);
+static int x_max = DEF_X_MAX;
+module_param(x_max, int, 0644);
+static int y_max = DEF_Y_MAX;
+module_param(y_max, int, 0644);
+
+static int tp_hw_init(void)
+{
+        int ret = 0;
+        struct regulator *ldo = regulator_get(NULL, "vaux33");
+
+       regulator_disable(ldo);
+        ret = gpio_request(get_port_config(irq).gpio, "tp_irq");
+        if(ret < 0){
+                printk("%s: gpio_request(irq gpio) failed\n", __func__);
+                return ret;
+        }
+
+        ret = port_output_init(rst, 1, "tp_rst");
+        if(ret < 0){
+                printk("%s: port(rst) output init faild\n", __func__);
+                return ret;
+        }
+        msleep(50);
+        regulator_enable(ldo);
+       regulator_put(ldo);
+        msleep(300);
+
+         return 0;
+}
+static int tp_hw_exit(void)
+{
+        return 0;
+}
+static int tp_hw_suspend(void)
+{
+        port_output_off(rst);
+        return 0;
+}
+static int tp_hw_resume(void)
+{
+        port_output_on(rst);
+        return 0;
+}
+#include "rk_tp.c"
+#endif
+
+
 
 struct ts_event {
        s16  cur_touch_id[MAX_POINT];
@@ -656,8 +735,12 @@ static int ft5306_suspend(struct i2c_client *client, pm_message_t mesg)
        struct ft5x0x_ts_data *ft5x0x_ts = i2c_get_clientdata(client);
        struct ft5306_platform_data *pdata = client->dev.platform_data;
        
+#ifdef CONFIG_RK_CONFIG
+        tp_hw_suspend();
+#else
        if (pdata->platform_sleep)                              
                pdata->platform_sleep();
+#endif
        disable_irq(ft5x0x_ts->irq);
        return 0;
 }
@@ -669,8 +752,12 @@ static int ft5306_resume(struct i2c_client *client)
        struct ft5306_platform_data *pdata = client->dev.platform_data;
        
        enable_irq(ft5x0x_ts->irq);
+#ifdef CONFIG_RK_CONFIG
+        tp_hw_resume();
+#else
        if (pdata->platform_wakeup)                              
                pdata->platform_wakeup();
+#endif
        return 0;
 }
 
@@ -712,15 +799,18 @@ static int  ft5306_probe(struct i2c_client *client ,const struct i2c_device_id *
     unsigned char reg_value;
     unsigned char reg_version;
 
+#ifdef CONFIG_RK_CONFIG
+         struct port_config irq_cfg = get_port_config(irq);
+        tp_hw_init();
+#else
        dev_info(&client->dev, "ft5x0x_ts_probe!\n");
        if (!pdata) {
                dev_err(&client->dev, "platform data is required!\n");
                return -EINVAL;
        }
-
        if (pdata->init_platform_hw)                              
                pdata->init_platform_hw();
-
+#endif
        if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)){
                dev_err(&client->dev, "Must have I2C_FUNC_I2C.\n");
                return -ENODEV;
@@ -755,7 +845,11 @@ static int  ft5306_probe(struct i2c_client *client ,const struct i2c_device_id *
                goto exit_input_dev_alloc_failed;
        }
        ft5x0x_ts->client = this_client = client;
+#ifdef CONFIG_RK_CONFIG
+        ft5x0x_ts->irq = get_port_config(irq).gpio;
+#else
        ft5x0x_ts->irq = pdata->irq_pin;
+#endif
        ft5x0x_ts->input_dev = input_dev;
 
        set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
@@ -765,15 +859,25 @@ static int  ft5306_probe(struct i2c_client *client ,const struct i2c_device_id *
        ft5306_init_touchid(ft5x0x_ts->event.cur_touch_id,MAX_POINT,-1);
        ft5306_init_touchid(ft5x0x_ts->event.last_touch_id,MAX_POINT,-1);
        input_mt_init_slots(input_dev, MAX_POINT);
+#ifdef CONFIG_RK_CONFIG
+       input_set_abs_params(input_dev,ABS_MT_POSITION_X, 0, x_max, 0, 0);
+       input_set_abs_params(input_dev,ABS_MT_POSITION_Y, 0, y_max, 0, 0);
+#else
        input_set_abs_params(input_dev,ABS_MT_POSITION_X, 0, SCREEN_MAX_X, 0, 0);
        input_set_abs_params(input_dev,ABS_MT_POSITION_Y, 0, SCREEN_MAX_Y, 0, 0);
+#endif
 #else
        set_bit(ABS_X, input_dev->absbit);
        set_bit(ABS_Y, input_dev->absbit);
        set_bit(ABS_PRESSURE, input_dev->absbit);
        set_bit(BTN_TOUCH, input_dev->keybit);
+#ifdef CONFIG_RK_CONFIG
+       input_set_abs_params(input_dev, ABS_X, 0, x_max, 0, 0);
+       input_set_abs_params(input_dev, ABS_Y, 0, y_max, 0, 0);
+#else
        input_set_abs_params(input_dev, ABS_X, 0, SCREEN_MAX_X, 0, 0);
        input_set_abs_params(input_dev, ABS_Y, 0, SCREEN_MAX_Y, 0, 0);
+#endif
        input_set_abs_params(input_dev, ABS_PRESSURE, 0, PRESS_MAX, 0 , 0);
 #endif
        
@@ -836,7 +940,11 @@ static int  ft5306_probe(struct i2c_client *client ,const struct i2c_device_id *
 #endif
 
        //printk("client->dev.driver->name %s  ,%d \n",client->dev.driver->name,ft5x0x_ts->irq);
+#ifdef CONFIG_RK_CONFIG
+       ret = request_irq(ft5x0x_ts->irq, ft5306_interrupt, irq_cfg.irq.irq_flags, client->dev.driver->name, ft5x0x_ts);
+#else
        ret = request_irq(ft5x0x_ts->irq, ft5306_interrupt, IRQF_TRIGGER_FALLING, client->dev.driver->name, ft5x0x_ts);
+#endif
        if (ret < 0) {
                dev_err(&client->dev, "irq %d busy?\n", ft5x0x_ts->irq);
                goto exit_irq_request_fail;
@@ -867,8 +975,12 @@ exit_input_register_device_failed:
        input_free_device(input_dev);
 exit_input_dev_alloc_failed:
 exit_i2c_test_fail:
+#ifdef CONFIG_RK_CONFIG
+        tp_hw_exit();
+#else
        if (pdata->exit_platform_hw)                              
                pdata->exit_platform_hw();
+#endif
        kfree(ft5x0x_ts);
        return err;
 }
@@ -894,6 +1006,13 @@ static struct i2c_driver ft5306_driver  = {
 
 static int __init ft5306_ts_init(void)
 {
+        
+#ifdef CONFIG_RK_CONFIG
+        int ret = tp_board_init();
+
+        if(ret < 0)
+                return ret;
+#endif
        return i2c_add_driver(&ft5306_driver);
 }