From: wuhao Date: Mon, 5 Nov 2012 10:44:40 +0000 (+0800) Subject: for rk2928 v86 X-Git-Tag: firefly_0821_release~8275 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=cb6f8a8f312c9ee1420a1b1afeb4b550b958f1ac;p=firefly-linux-kernel-4.4.55.git for rk2928 v86 --- diff --git a/arch/arm/mach-rk2928/Kconfig b/arch/arm/mach-rk2928/Kconfig index c63611b50166..05631679eb83 100644 --- a/arch/arm/mach-rk2928/Kconfig +++ b/arch/arm/mach-rk2928/Kconfig @@ -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" diff --git a/arch/arm/mach-rk2928/board-rk2926-sdk.c b/arch/arm/mach-rk2928/board-rk2926-sdk.c index f47eb46f472b..2a200dda3342 100755 --- a/arch/arm/mach-rk2928/board-rk2926-sdk.c +++ b/arch/arm/mach-rk2928/board-rk2926-sdk.c @@ -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[] = { diff --git a/drivers/input/touchscreen/sitronix_ts_a720.c b/drivers/input/touchscreen/sitronix_ts_a720.c index e79be5338493..a11912f4e25c 100755 --- a/drivers/input/touchscreen/sitronix_ts_a720.c +++ b/drivers/input/touchscreen/sitronix_ts_a720.c @@ -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){ diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c index 181d68aa5902..de3d2ace237c 100755 --- a/drivers/mfd/tps65910.c +++ b/drivers/mfd/tps65910.c @@ -22,6 +22,13 @@ #include #include +#if defined(CONFIG_MACH_RK2926_V86) +#include +#include +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) { diff --git a/drivers/net/wireless/rkusbwifi/wifi_power.c b/drivers/net/wireless/rkusbwifi/wifi_power.c index a0dd91b7ad5a..2ebcd4b9b872 100755 --- a/drivers/net/wireless/rkusbwifi/wifi_power.c +++ b/drivers/net/wireless/rkusbwifi/wifi_power.c @@ -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 }; /* diff --git a/drivers/net/wireless/rkusbwifi/wifi_power_ops.c b/drivers/net/wireless/rkusbwifi/wifi_power_ops.c index 2c289e92665a..12b32eca9491 100644 --- a/drivers/net/wireless/rkusbwifi/wifi_power_ops.c +++ b/drivers/net/wireless/rkusbwifi/wifi_power_ops.c @@ -77,7 +77,13 @@ int wifi_gpio_operate(struct wifi_power *gpio, int flag) */ int wifi_turn_on_rtl8192c_card(void) { - //wifi_gpio_operate(&power_gpio, GPIO_SWITCH_ON); + #if defined(CONFIG_MACH_RK2926_V86) + wifi_gpio_operate(&power_gpio, GPIO_SWITCH_ON); + //rk29sdk_wifi_power(1); + #else + //wifi_gpio_operate(&power_gpio, GPIO_SWITCH_ON); + rk29sdk_wifi_power(1); + #endif rk29sdk_wifi_power(1); if (power_gpio.use_gpio != POWER_NOT_USE_GPIO) msleep(1000); @@ -96,8 +102,13 @@ int wifi_turn_on_card(int module) int wifi_turn_off_card(void) { - //wifi_gpio_operate(&power_gpio, GPIO_SWITCH_OFF); + #if defined(CONFIG_MACH_RK2926_V86) + wifi_gpio_operate(&power_gpio, GPIO_SWITCH_OFF); + //rk29sdk_wifi_power(0); + #else + //wifi_gpio_operate(&power_gpio, GPIO_SWITCH_OFF); rk29sdk_wifi_power(0); + #endif msleep(5); wifi_turn_off_callback(); diff --git a/drivers/usb/dwc_otg/usbdev_rk2928.c b/drivers/usb/dwc_otg/usbdev_rk2928.c index 1ac870749814..6f70546cb0a0 100755 --- a/drivers/usb/dwc_otg/usbdev_rk2928.c +++ b/drivers/usb/dwc_otg/usbdev_rk2928.c @@ -104,7 +104,10 @@ void usb20otg_hw_init(void) #ifdef CONFIG_RK_CONFIG otg_drv_init(0); #else - rk30_mux_api_set(GPIO3C1_OTG_DRVVBUS_NAME, GPIO3C_OTG_DRVVBUS); + #if defined(CONFIG_MACH_RK2926_V86) + #else + rk30_mux_api_set(GPIO3C1_OTG_DRVVBUS_NAME, GPIO3C_OTG_DRVVBUS); + #endif #endif } void usb20otg_phy_suspend(void* pdata, int suspend) diff --git a/drivers/video/display/screen/lcd_YQ70CPT9160.c b/drivers/video/display/screen/lcd_YQ70CPT9160.c index dd080d6e2d9e..63f80f1aa3ad 100644 --- a/drivers/video/display/screen/lcd_YQ70CPT9160.c +++ b/drivers/video/display/screen/lcd_YQ70CPT9160.c @@ -26,7 +26,11 @@ #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