rk2928phonepad:
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-rk2928 / board-rk2928-phonepad.c
index 353ae71ad3f1dea7068eda192c3314bb40f72518..66dc02bead5e5abcb957ee87c072176e9c62a9a2 100755 (executable)
 #include <linux/sensor-dev.h>
 #include <linux/mfd/tps65910.h>
 #include <linux/regulator/rk29-pwm-regulator.h>
+#if defined(CONFIG_MODEM_SOUND)
+#include "../../../drivers/misc/modem_sound.h"
+#endif
 #if defined(CONFIG_HDMI_RK30)
        #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
 #endif
+#include "../../../drivers/headset_observe/rk_headset.h"
 
 #if defined(CONFIG_SPIM_RK29)
 #include "../../../drivers/spi/rk29_spim.h"
@@ -378,6 +382,18 @@ struct ft5306_platform_data ft5306_info = {
 };
 #endif
 
+#if defined(CONFIG_TOUCHSCREEN_BYD693X)
+
+#define TOUCH_RESET_PIN RK2928_PIN3_PD5
+#define TOUCH_INT_PIN   RK2928_PIN3_PC7
+struct byd_platform_data byd693x_info = {
+       .int_pin = TOUCH_INT_PIN,
+       .rst_pin = TOUCH_RESET_PIN,
+       .screen_max_x = 800,
+       .screen_max_y = 480,
+       .xpol = -1,
+};
+#endif
 
 /*MMA7660 gsensor*/
 #if defined (CONFIG_GS_MMA7660)
@@ -555,6 +571,22 @@ struct platform_device pwm_regulator_device[1] = {
        },
 };
 #endif
+
+#if defined(CONFIG_MODEM_SOUND)
+
+struct modem_sound_data modem_sound_info = {
+       .spkctl_io = RK2928_PIN3_PD4,
+       .spkctl_active = GPIO_HIGH,
+};
+
+struct platform_device modem_sound_device = {
+       .name = "modem_sound",
+       .id = -1,
+       .dev            = {
+       .platform_data = &modem_sound_info,
+               }
+       };
+#endif
 /**************************************************************************************************
  * SDMMC devices,  include the module of SD,MMC,and sdio.noted by xbw at 2012-03-05
 **************************************************************************************************/
@@ -675,8 +707,8 @@ struct rk29_sdmmc_platform_data default_sdmmc1_data = {
        .status = rk29sdk_wifi_status,
        .register_status_notify = rk29sdk_wifi_status_register,
 #endif
-#if 0
-       .detect_irq = RK29SDK_WIFI_SDIO_CARD_DETECT_N,
+#if 1
+       .detect_irq = INVALID_GPIO,//RK29SDK_WIFI_SDIO_CARD_DETECT_N,
 #endif
 
 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
@@ -724,6 +756,53 @@ struct platform_device rk29_device_sc6610 = {
         }
     };
 #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_gpio           = RK2928_PIN1_PB4,
+               .Hook_gpio  = RK2928_PIN0_PD1,
+               .headset_in_type = HEADSET_IN_HIGH,
+               .hook_key_code = KEY_MEDIA,
+               .headset_gpio_info = {GPIO1B4_SPI_CSN1_NAME, GPIO1B_GPIO1B4},
+               .headset_io_init = rk_headset_io_init,
+               .hook_gpio_info = {GPIO0D1_UART2_CTSN_NAME, GPIO0D_GPIO0D1},
+               .hook_io_init = rk_hook_io_init,
+};
+struct platform_device rk_device_headset = {
+               .name   = "rk_headsetdet",
+               .id     = 0,
+               .dev    = {
+                           .platform_data = &rk_headset_info,
+               }
+};
+#endif
 #ifdef CONFIG_SND_SOC_RK2928
 static struct resource resources_acodec[] = {
        {
@@ -765,11 +844,17 @@ static struct platform_device *devices[] __initdata = {
 
 #if defined(CONFIG_BATTERY_RK30_ADC)||defined(CONFIG_BATTERY_RK30_ADC_FAC)
        &rk30_device_adc_battery,
-
+#endif
 #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
 };
 //i2c
 #ifdef CONFIG_I2C0_RK30
@@ -883,6 +968,15 @@ static struct i2c_board_info __initdata i2c2_info[] = {
                .platform_data = &ft5306_info,
        },
 #endif
+#if defined(CONFIG_TOUCHSCREEN_BYD693X)
+       {
+               .type          = "byd693x-ts",
+               .addr          = 0x52,
+               .flags         = 0,
+               .irq           = TOUCH_INT_PIN,
+               .platform_data = &byd693x_info,
+       },
+#endif
 };
 #endif
 #ifdef CONFIG_I2C3_RK30
@@ -977,22 +1071,22 @@ static void __init rk2928_reserve(void)
  * comments    : min arm/logic voltage
  */
 static struct dvfs_arm_table dvfs_cpu_logic_table[] = {
-       {.frequency = 216 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},//0.975V/1.000V
-       {.frequency = 312 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},//0.975V/1.000V
-       {.frequency = 408 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},//1.000V/1.025V
-       {.frequency = 504 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},//1.000V/1.025V
-       {.frequency = 600 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},//1.025V/1.050V
-       {.frequency = 696 * 1000,       .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},//1.000V/1.025V
-       {.frequency = 816 * 1000,       .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},//1.100V/1.050V
-       //{.frequency = 912 * 1000,     .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},//1.100V/1.050V
-       //{.frequency = 1008 * 1000,    .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},//1.100V/1.050V
+       {.frequency = 216 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},
+       {.frequency = 312 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},
+       {.frequency = 408 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},
+       {.frequency = 504 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},
+       {.frequency = 600 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},
+       {.frequency = 696 * 1000,       .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},
+       {.frequency = 816 * 1000,       .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},
+       //{.frequency = 912 * 1000,     .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},
+       //{.frequency = 1008 * 1000,    .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},
 #if 0
-       {.frequency = 1104 * 1000,      .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},//1.100V/1.050V
-       {.frequency = 1200 * 1000,      .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},//1.100V/1.050V
-       {.frequency = 1104 * 1000,      .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},//1.100V/1.050V
-       {.frequency = 1248 * 1000,      .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},//1.100V/1.050V
+       {.frequency = 1104 * 1000,      .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},
+       {.frequency = 1200 * 1000,      .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},
+       {.frequency = 1104 * 1000,      .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},
+       {.frequency = 1248 * 1000,      .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},
 #endif
-       //{.frequency = 1000 * 1000,    .cpu_volt = 1225 * 1000,        .logic_volt = 1200 * 1000},//1.150V/1.100V
+       //{.frequency = 1000 * 1000,    .cpu_volt = 1225 * 1000,        .logic_volt = 1200 * 1000},
        {.frequency = CPUFREQ_TABLE_END},
 };