for rk2928 v86
authorwuhao <wuhao@wuhao@rock-chips.com>
Mon, 5 Nov 2012 10:44:40 +0000 (18:44 +0800)
committerwuhao <wuhao@wuhao@rock-chips.com>
Mon, 5 Nov 2012 10:44:40 +0000 (18:44 +0800)
arch/arm/mach-rk2928/Kconfig
arch/arm/mach-rk2928/board-rk2926-sdk.c
drivers/input/touchscreen/sitronix_ts_a720.c
drivers/mfd/tps65910.c
drivers/net/wireless/rkusbwifi/wifi_power.c
drivers/net/wireless/rkusbwifi/wifi_power_ops.c
drivers/usb/dwc_otg/usbdev_rk2928.c
drivers/video/display/screen/lcd_YQ70CPT9160.c

index c63611b501665b4ea4c64f0190d5168e27da53a0..05631679eb83ba2b1f096a969ccb5f11996a41e7 100644 (file)
@@ -15,6 +15,11 @@ config MACH_RK2928_SDK
 config MACH_RK2926_SDK
        bool "RK2926 SDK board"
 
+        config MACH_RK2926_V86
+               tristate "rk2926 v86 "
+               depends on MACH_RK2926_SDK
+
+
 config MACH_RK2928_PHONEPAD
        bool "RK2928_PhonePad board"
 
index f47eb46f472b3e85589684f49f0048086a1de56e..2a200dda334286f2d3c4951cb05961236fadeaaf 100755 (executable)
@@ -71,6 +71,17 @@ extern  int act8931_charge_det ;
 extern  int act8931_charge_ok  ;
 #endif
 
+#if defined(CONFIG_MACH_RK2926_V86)
+//#define V86_VERSION_1_0
+#define V86_VERSION_1_1
+#endif
+
+#if defined(V86_VERSION_1_1)
+#if defined(CONFIG_MFD_TPS65910)
+extern int tps65910_charge_ok ;
+#endif
+#endif
+
 
 static struct spi_board_info board_spi_devices[] = {
 };
@@ -86,19 +97,29 @@ static struct spi_board_info board_spi_devices[] = {
 #define PWM_GPIO         RK2928_PIN0_PD2
 #define PWM_EFFECT_VALUE  0
 
-//#define LCD_DISP_ON_PIN
+#if defined(V86_VERSION_1_1)
+#define LCD_DISP_ON_PIN
+#endif
 
 #ifdef  LCD_DISP_ON_PIN
-
+#if defined(V86_VERSION_1_1)
+#define BL_EN_PIN         RK2928_PIN3_PC1
+#define BL_EN_VALUE       GPIO_HIGH
+#define BL_EN_MUX_NAME   GPIO3C1_OTG_DRVVBUS_NAME
+#define BL_EN_MUX_MODE   GPIO3C_GPIO3C1
+#else
 #define BL_EN_PIN         RK2928_PIN1_PB0
 #define BL_EN_VALUE       GPIO_HIGH
 #endif
+#endif
 static int rk29_backlight_io_init(void)
 {
        int ret = 0;
        rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
 #ifdef  LCD_DISP_ON_PIN
-       // rk30_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
+       #if defined(V86_VERSION_1_1)
+       rk30_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
+       #endif
 
        ret = gpio_request(BL_EN_PIN, NULL);
        if (ret != 0) {
@@ -119,6 +140,16 @@ static int rk29_backlight_io_deinit(void)
        gpio_free(BL_EN_PIN);
 #endif
        rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
+
+       #if defined(V86_VERSION_1_0) || defined(V86_VERSION_1_1)
+       #if defined(CONFIG_MFD_TPS65910)        
+       if(g_pmic_type == PMIC_TYPE_TPS65910)
+       {
+               gpio_direction_output(PWM_GPIO, GPIO_HIGH);
+       }
+       #endif
+       #endif
+       
        return ret;
 }
 
@@ -132,7 +163,11 @@ static int rk29_backlight_pwm_suspend(void)
        }
        #if defined(CONFIG_MFD_TPS65910)        
         if (pmic_is_tps65910() )
+        #if defined(V86_VERSION_1_0) || defined(V86_VERSION_1_1)
+          gpio_direction_output(PWM_GPIO, GPIO_HIGH);
+        #else
           gpio_direction_output(PWM_GPIO, GPIO_LOW);
+        #endif
        #endif
        #if defined(CONFIG_REGULATOR_ACT8931)
         if (pmic_is_act8931() )
@@ -176,6 +211,22 @@ static struct platform_device rk29_device_backlight = {
        }
 };
 
+#if defined(V86_VERSION_1_0) || defined(V86_VERSION_1_1) //for v86 to modify flash lcd when startup
+static int __init set_pwm_gpio_high(void)
+{  
+        printk("%s, xhc", __func__);
+        rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
+       if (gpio_request(PWM_GPIO, NULL)) {
+               printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
+               return -1;
+       }
+       gpio_direction_output(PWM_GPIO, GPIO_HIGH);
+        gpio_free(PWM_GPIO);
+        return 0;
+}
+core_initcall(set_pwm_gpio_high);
+#endif
+
 #endif
 
 #ifdef CONFIG_FB_ROCKCHIP
@@ -217,6 +268,11 @@ static int rk_fb_io_disable(void)
                udelay(100);
        }
        #endif
+       
+       //#if defined(V86_VERSION_1_0)
+       msleep(30);
+       //#endif
+
         gpio_set_value(LCD_EN, !LCD_EN_VALUE);
        return 0;
 }
@@ -233,6 +289,10 @@ static int rk_fb_io_enable(void)
        }
        #endif
 
+      //#if defined(V86_VERSION_1_0)
+      msleep(100);
+      //#endif
+
         gpio_set_value(LCD_EN, LCD_EN_VALUE);
        return 0;
 }
@@ -331,9 +391,13 @@ static struct platform_device device_ion = {
 
 #if defined(CONFIG_TOUCHSCREEN_SITRONIX_A720)
 
-#define TOUCH_RESET_PIN         RK2928_PIN1_PA3
-#define TOUCH_INT_PIN   RK2928_PIN1_PB0
+#if defined(V86_VERSION_1_1)
+#define TOUCH_RESET_PIN         NULL
+#else
+#define TOUCH_RESET_PIN         RK2928_PIN1_PA3
 #endif
+#define TOUCH_INT_PIN   RK2928_PIN1_PB0
+
 int ft5306_init_platform_hw(void)
 {
 
@@ -363,7 +427,7 @@ struct ft5x0x_platform_data sitronix_info = {
         .model = 5007,
         .init_platform_hw= ft5306_init_platform_hw,
 };
-
+#endif
 
 /*MMA7660 gsensor*/
 #if defined (CONFIG_GS_MMA7660)
@@ -381,7 +445,15 @@ static struct sensor_platform_data mma7660_info = {
        .irq_enable = 1,
        .poll_delay_ms = 30,
         .init_platform_hw = mma7660_init_platform_hw,
+        #if defined(V86_VERSION_1_0) || defined(V86_VERSION_1_1)
+           #if defined(V86_VERSION_1_0)
+           .orientation = {1, 0, 0, 0, 0, -1, 0, -1, 0},
+            #else if defined(V86_VERSION_1_1)
+            .orientation = {0, 1, 0, 0, 0, -1, 1, 0, 0},
+            #endif
+        #else 
         .orientation = {-1, 0, 0, 0, 0, -1, 0, 1, 0},
+        #endif
 };
 #endif
 
@@ -415,7 +487,10 @@ struct regulator_init_data pwm_regulator_init_dcdc[1] =
 static struct pwm_platform_data pwm_regulator_info[1] = {
        {
                .pwm_id = 1,
+               #if defined(V86_VERSION_1_1)
+             #else
                .pwm_gpio = RK2928_PIN0_PD3,
+               #endif
                .pwm_iomux_name = GPIO0D3_PWM_1_NAME,
                .pwm_iomux_pwm = GPIO0D_PWM_1, 
                .pwm_iomux_gpio = GPIO0D_GPIO0D3,
@@ -575,6 +650,78 @@ static struct platform_device device_acodec = {
 #endif
 
 #ifdef CONFIG_BATTERY_RK30_ADC_FAC
+#if  defined(V86_VERSION_1_0) || defined(V86_VERSION_1_1)
+#define   DC_DET_PIN  RK2928_PIN1_PA5
+int rk30_battery_adc_io_init(void){
+       int ret = 0;
+               
+       //dc charge detect pin
+       ret = gpio_request(DC_DET_PIN, NULL);
+       if (ret) {
+               printk("failed to request dc_det gpio\n");
+               return ret ;
+       }
+
+       gpio_pull_updown(DC_DET_PIN, 0);//important
+       ret = gpio_direction_input(DC_DET_PIN);
+       if (ret) {
+               printk("failed to set gpio dc_det input\n");
+               return ret ;
+       }
+       
+       return 0;
+
+}
+#if defined(V86_VERSION_1_1)
+extern int tps65910_charge_ok;
+#if defined(CONFIG_MFD_TPS65910)
+int rk30_battery_adc_charging_ok( ){
+
+       if( gpio_get_value(DC_DET_PIN) == GPIO_LOW){
+       //printk(">>>>>>>>>> DC_DET_OK\n");
+           if( tps65910_charge_ok ){
+                //printk(">>>>>>>>>>return tps65910_charge_ok = %d \n",tps65910_charge_ok);
+                return 1 ;
+            }
+            //printk(">>>>>>>>>> tps65910_charge_ok = %d \n",tps65910_charge_ok);
+       }
+
+       return 0 ;
+}
+#endif
+#endif
+static struct rk30_adc_battery_platform_data rk30_adc_battery_platdata = {
+        .dc_det_pin      = DC_DET_PIN,//INVALID_GPIO,
+        .batt_low_pin    = INVALID_GPIO,
+        .charge_set_pin  = INVALID_GPIO,
+        .charge_ok_pin   = INVALID_GPIO,//RK2928_PIN1_PA5,
+        .dc_det_level    = GPIO_LOW,
+        .charge_ok_level = GPIO_HIGH,
+
+        .io_init = rk30_battery_adc_io_init,
+        #if defined(V86_VERSION_1_1)
+         .charging_ok     = rk30_battery_adc_charging_ok ,
+        #endif
+
+        .reference_voltage=3200,
+        .pull_up_res = 200 ,
+        .pull_down_res = 200 ,
+
+        .charging_sleep   = 0 ,        
+        .save_capacity   = 1 ,
+        .adc_channel     =0 ,
+        
+};
+
+static struct platform_device rk30_device_adc_battery = {
+        .name   = "rk30-battery",
+        .id     = -1,
+        .dev = {
+                .platform_data = &rk30_adc_battery_platdata,
+        },
+};
+
+#else
 #define   DC_DET_PIN  RK2928_PIN1_PA5
 int rk30_battery_adc_io_init(void){
        int ret = 0;
@@ -628,6 +775,7 @@ static struct platform_device rk30_device_adc_battery = {
         },
 };
 #endif
+#endif
 
 static struct platform_device *devices[] __initdata = {
 #ifdef CONFIG_FB_ROCKCHIP
@@ -652,7 +800,11 @@ static struct platform_device *devices[] __initdata = {
 //i2c
 #ifdef CONFIG_I2C0_RK30
 #ifdef CONFIG_MFD_TPS65910
+#if defined(V86_VERSION_1_0) || defined(V86_VERSION_1_1)
+#define TPS65910_HOST_IRQ        RK2928_PIN1_PB1
+#else
 #define TPS65910_HOST_IRQ        RK2928_PIN1_PB2
+#endif
 #define PMU_POWER_SLEEP RK2928_PIN1_PA1
 
 static struct pmu_info  tps65910_dcdc_info[] = {
index e79be53384938d14acdae4fedee8fa7e9be8c4af..a11912f4e25cfa791320ccc64afb42a3131fd496 100755 (executable)
@@ -825,7 +825,11 @@ static void sitronix_ts_work_func(struct work_struct *work)
                                input_report_abs(ts->input_dev,  ABS_MT_TRACKING_ID, i);
                                input_report_abs(ts->input_dev,  ABS_MT_TOUCH_MAJOR, 200);
                                input_report_abs(ts->input_dev,  ABS_MT_POSITION_X, MTDStructure[i].Pixel_X);
+                               #if defined(CONFIG_MACH_RK2926_V86_VERSION_1_1)
+                               input_report_abs(ts->input_dev,  ABS_MT_POSITION_Y, 480 - MTDStructure[i].Pixel_Y);
+                               #else
                                input_report_abs(ts->input_dev,  ABS_MT_POSITION_Y, MTDStructure[i].Pixel_Y);
+                                #endif
                                input_report_abs(ts->input_dev,  ABS_MT_WIDTH_MAJOR, 100);
                                DbgMsg("lr[%d](%d, %d)+\n", i, MTDStructure[i].Pixel_X, MTDStructure[i].Pixel_Y);
                        }else if(MTDStructure[i].Current_Pressed_area == AREA_NONE){
index 181d68aa59025d39c94f094792a2586ea43437bb..de3d2ace237c1b296b39bc56f05d58a324d4231b 100755 (executable)
 #include <linux/mfd/core.h>
 #include <linux/mfd/tps65910.h>
 
+#if defined(CONFIG_MACH_RK2926_V86)
+#include <linux/irq.h>
+#include <linux/interrupt.h>
+int tps65910_charge_ok = 0 ;
+EXPORT_SYMBOL(tps65910_charge_ok);
+#endif
+
 struct tps65910 *g_tps65910;
 
 static struct mfd_cell tps65910s[] = {
@@ -232,6 +239,22 @@ out:
 }
 EXPORT_SYMBOL_GPL(tps65910_clear_bits);
 
+#if defined(CONFIG_MACH_RK2926_V86)
+static irqreturn_t tps65910_gpio0_r_irq(int irq, void *irq_data)
+{
+       //printk("#########chg_ok_det######### %s\n",__func__);
+       tps65910_charge_ok = 1 ;
+       return IRQ_HANDLED;
+}
+
+static irqreturn_t tps65910_gpio0_f_irq(int irq, void *irq_data)
+{
+       //printk("#########chg_no_ok######### %s\n",__func__);
+       tps65910_charge_ok = 0 ;
+       return IRQ_HANDLED;
+}
+#endif
+
 static int tps65910_i2c_probe(struct i2c_client *i2c,
                            const struct i2c_device_id *id)
 {
@@ -291,6 +314,28 @@ static int tps65910_i2c_probe(struct i2c_client *i2c,
        if (ret < 0)
                goto err;
 
+       /************************* chg_ok det ******************/
+       #if defined(CONFIG_MACH_RK2926_V86)
+       if ( tps65910->irq_base) {
+               ret = request_threaded_irq( tps65910->irq_base +
+                       TPS65910_IRQ_GPIO_R,
+                        NULL, tps65910_gpio0_r_irq, IRQF_TRIGGER_RISING,
+                        "chg_ok", tps65910);
+               }
+       if (ret < 0)
+               printk( "chg_ok IRQ request failed: %d\n");
+               
+       if ( tps65910->irq_base) {
+               ret = request_threaded_irq( tps65910->irq_base +
+                       TPS65910_IRQ_GPIO_F,
+                        NULL, tps65910_gpio0_f_irq, IRQF_TRIGGER_FALLING,
+                        "chg_no_ok", tps65910);
+               }
+       if (ret < 0)
+               printk( "chg_ok IRQ request failed: %d\n");
+      #endif
+       /****************************************************/
+
        if (pmic_plat_data && pmic_plat_data->post_init) {
                ret = pmic_plat_data->post_init(tps65910);
                if (ret != 0) {
index a0dd91b7ad5af810838d9942c365b44b4db4fa36..2ebcd4b9b872cf5a7329b3b3046362d87347edae 100755 (executable)
@@ -39,11 +39,16 @@ EXPORT_SYMBOL(init_channel_plan);
  */
 struct wifi_power power_gpio = 
 {
+       #if defined(CONFIG_MACH_RK2926_V86)
+        POWER_USE_GPIO, 0,
+        0, 0, RK2928_PIN0_PD3, GPIO_LOW
+        #else
        POWER_NOT_USE_GPIO, 0, 0, 0, 0, 0 
 
        // RBOX
        //POWER_USE_GPIO, POWER_GPIO_IOMUX, 
        //GPIO5D6_SDMMC1PWREN_NAME, GPIO5H_GPIO5D6, RK29_PIN5_PD6, GPIO_HIGH 
+        #endif
 };
 
 /*
index 2c289e92665ab4e71add5de14b42165fb3f2e4b8..12b32eca9491601f745a7ae0bb1c7048c94cf735 100644 (file)
@@ -77,7 +77,13 @@ int wifi_gpio_operate(struct wifi_power *gpio, int flag)
  */\r
 int wifi_turn_on_rtl8192c_card(void)\r
 {\r
-       //wifi_gpio_operate(&power_gpio, GPIO_SWITCH_ON);\r
+        #if defined(CONFIG_MACH_RK2926_V86)\r
+        wifi_gpio_operate(&power_gpio, GPIO_SWITCH_ON);\r
+        //rk29sdk_wifi_power(1);\r
+        #else\r
+        //wifi_gpio_operate(&power_gpio, GPIO_SWITCH_ON);\r
+        rk29sdk_wifi_power(1);\r
+        #endif\r
         rk29sdk_wifi_power(1);\r
        if (power_gpio.use_gpio != POWER_NOT_USE_GPIO)\r
                msleep(1000);\r
@@ -96,8 +102,13 @@ int wifi_turn_on_card(int module)
 \r
 int wifi_turn_off_card(void)\r
 {\r
-       //wifi_gpio_operate(&power_gpio, GPIO_SWITCH_OFF);\r
+        #if defined(CONFIG_MACH_RK2926_V86)\r
+        wifi_gpio_operate(&power_gpio, GPIO_SWITCH_OFF);\r
+        //rk29sdk_wifi_power(0);\r
+        #else\r
+       //wifi_gpio_operate(&power_gpio, GPIO_SWITCH_OFF);\r
         rk29sdk_wifi_power(0);\r
+        #endif\r
        msleep(5);\r
 \r
        wifi_turn_off_callback();\r
index 1ac870749814318e6eb61cff585421174c8fd5b6..6f70546cb0a0ed4c94e413b2f20d5f9e97ea010b 100755 (executable)
@@ -104,7 +104,10 @@ void usb20otg_hw_init(void)
 #ifdef CONFIG_RK_CONFIG\r
     otg_drv_init(0);\r
 #else\r
-    rk30_mux_api_set(GPIO3C1_OTG_DRVVBUS_NAME, GPIO3C_OTG_DRVVBUS);    \r
+    #if defined(CONFIG_MACH_RK2926_V86)\r
+    #else\r
+    rk30_mux_api_set(GPIO3C1_OTG_DRVVBUS_NAME, GPIO3C_OTG_DRVVBUS);  \r
+    #endif  \r
 #endif\r
 }\r
 void usb20otg_phy_suspend(void* pdata, int suspend)\r
index dd080d6e2d9ed14bdb61de3dac73766e1433a224..63f80f1aa3adffeaf7867aa4d92ff670632500ea 100644 (file)
 #define V_FP                   22 //18
 
 /* Other */
-#define DCLK_POL               1
+#if defined(CONFIG_MACH_RK2926_V86)
+#define DCLK_POL               0
+#else
+#define DCLK_POL                1
+#endif
 #define SWAP_RB                        0
 
 #define LCD_WIDTH       154    //need modify