#include <linux/sensor-dev.h>
#include <linux/mfd/tps65910.h>
#include <linux/regulator/rk29-pwm-regulator.h>
+
+#if defined(CONFIG_MFD_RK610)
+#include <linux/mfd/rk610_core.h>
+#endif
+
#if defined(CONFIG_HDMI_RK30)
#include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
#endif
#define RK30_FB0_MEM_SIZE 8*SZ_1M
#endif
-#include "board-rk3066b-sdk-camera.c"
+#include "board-rk3066b-m701-camera.c"
#include "board-rk3066b-m701-key.c"
#if defined(CONFIG_TOUCHSCREEN_GT8XX)
};
#endif
-#if defined (CONFIG_TOUCHSCREEN_FT5306)
+#if defined (CONFIG_TOUCHSCREEN_FT5306_AV)
#define TOUCH_RESET_PIN RK30_PIN2_PC0
#define TOUCH_INT_PIN RK30_PIN0_PD4
#define TOUCH_PWR_PIN RK30_PIN2_PB4
-static int ft5x0x_init_platform_hw(void)
+static int ft5306_init_platform_hw(void)
{
rk30_mux_api_set(GPIO2C0_LCDC1DATA16_SMCADDR0_TRACECLK_NAME, GPIO2C_GPIO2C0);
+ rk30_mux_api_set(GPIO0D4_SPI1RXD_NAME, GPIO0D_GPIO0D4);
rk30_mux_api_set(GPIO2B4_LCDC1DATA12_SMCDATA12_TRACEDATA12_NAME, GPIO2B_GPIO2B4);
//printk("%s:0x%x,0x%x\n",__func__,rk30_mux_api_get(GPIO2C0_LCDC1DATA16_SMCADDR0_TRACECLK_NAME),rk30_mux_api_get(GPIO2B4_LCDC1DATA12_SMCDATA12_TRACEDATA12_NAME));
- printk("==ft5x0x_init_platform_hw =\n");
+ printk("ft5306_init_platform_hw \n");
if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
gpio_free(TOUCH_RESET_PIN);
- printk("ft5606_init_platform_hw gpio_request error\n");
+ printk("ft5306_init_platform_hw gpio_request error\n");
return -EIO;
}
if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
gpio_free(TOUCH_INT_PIN);
- printk("ift5606_init_platform_hw gpio_request error\n");
+ printk("ift5306_init_platform_hw gpio_request error\n");
return -EIO;
}
return 0;
}
-void ft5x0x_exit_platform_hw(void)
+void ft5306_exit_platform_hw(void)
{
printk("ft5606_exit_platform_hw\n");
gpio_free(TOUCH_RESET_PIN);
gpio_free(TOUCH_INT_PIN);
}
-int ft5x0x_platform_sleep(void)
+int ft5306_platform_sleep(void)
{
printk("ft5606_platform_sleep\n");
gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
return 0;
}
-int ft5x0x_platform_wakeup(void)
+int ft5306_platform_wakeup(void)
{
printk("ft5606_platform_wakeup\n");
gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
return 0;
}
-static struct ft5606_platform_data ft5x0x_info = {
- .init_platform_hw= ft5x0x_init_platform_hw,
- .exit_platform_hw= ft5x0x_exit_platform_hw,
- .platform_sleep = ft5x0x_platform_sleep,
- .platform_wakeup = ft5x0x_platform_wakeup,
+struct ft5606_platform_data ft5306_info = {
+
+ .init_platform_hw= ft5306_init_platform_hw,
+ .exit_platform_hw= ft5306_exit_platform_hw,
+ .platform_sleep= ft5306_platform_sleep,
+ .platform_wakeup= ft5306_platform_wakeup,
};
#endif
{
int ret = 0;
#ifdef LCD_DISP_ON_PIN
+ gpio_direction_output(BL_EN_PIN, 0);
+ gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
gpio_free(BL_EN_PIN);
#endif
rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
+ gpio_request(PWM_GPIO, NULL);
+ gpio_direction_output(PWM_GPIO, GPIO_LOW);
return ret;
}
.bl_ref = PWM_EFFECT_VALUE,
.io_init = rk29_backlight_io_init,
.io_deinit = rk29_backlight_io_deinit,
+ .min_brightness = 48,
+ .delay_ms = 0,
.pwm_suspend = rk29_backlight_pwm_suspend,
.pwm_resume = rk29_backlight_pwm_resume,
};
#endif
+/*MMA7660 gsensor*/
#if defined (CONFIG_GS_MMA7660)
-#define MMA7660_INT_PIN RK30_PIN4_PC0
-static int gs_init_platform_hw(void)
+#define MMA7660_INT_PIN RK30_PIN3_PD7
+
+static int mma7660_init_platform_hw(void)
{
- rk30_mux_api_set(GPIO4C0_SMCDATA0_TRACEDATA0_NAME, GPIO4C_GPIO4C0);
- if(gpio_request(MMA7660_INT_PIN, NULL) != 0){
+ if(gpio_request(MMA7660_INT_PIN, NULL) != 0){
gpio_free(MMA7660_INT_PIN);
printk("gsensor gpio_request error\n");
return -EIO;
}
- //gpio_direction_input(MMA7660_INT_PIN);
- gpio_pull_updown(MMA7660_INT_PIN, 1);
- return 0;
+ //gpio_direction_input(MMA7660_INT_PIN);
+ return 0;
}
-
-static struct gs_platform_data mma7660_info = {
- .model= 7660,
- .swap_xy = 0,
- .init_platform_hw= gs_init_platform_hw,
+static struct sensor_platform_data mma7660_info = {
+ .type = SENSOR_TYPE_ACCEL,
+ .irq_enable = 1,
+ .poll_delay_ms = 30,
+ .init_platform_hw = mma7660_init_platform_hw,
+ .orientation = {0, 1, 0, 0, 0, -1, 1, 0, 0},
};
#endif
#ifdef CONFIG_FB_ROCKCHIP
-#define LCD_CS_PIN INVALID_GPIO
+#define LCD_CS_PIN RK30_PIN2_PB6
#define LCD_CS_VALUE GPIO_HIGH
#define LCD_EN_PIN RK30_PIN0_PB0
-#define LCD_EN_VALUE GPIO_HIGH
+#define LCD_EN_VALUE GPIO_LOW
+
+#define LCD_STB_PIN RK30_PIN2_PB3
+#define LCD_STB_VALUE GPIO_HIGH
static int rk_fb_io_init(struct rk29_fb_setting_info *fb_setting)
{
int ret = 0;
+ if(LCD_STB_PIN !=INVALID_GPIO)
+ {
+ ret = gpio_request(LCD_STB_PIN, NULL);
+ if (ret != 0)
+ {
+ gpio_free(LCD_STB_PIN);
+ printk(KERN_ERR "request lcd en pin fail!\n");
+ return -1;
+ }
+ else
+ {
+ gpio_direction_output(LCD_STB_PIN, LCD_STB_VALUE);
+ }
+ }
+
+ msleep(100);
if(LCD_CS_PIN !=INVALID_GPIO)
{
ret = gpio_request(LCD_CS_PIN, NULL);
gpio_direction_output(LCD_EN_PIN, LCD_EN_VALUE);
}
}
+
+
return 0;
}
static int rk_fb_io_disable(void)
{
+ if(LCD_STB_PIN !=INVALID_GPIO)
+ {
+ gpio_set_value(LCD_STB_PIN, !LCD_STB_VALUE);
+ }
+ msleep(50);
if(LCD_CS_PIN !=INVALID_GPIO)
{
gpio_set_value(LCD_CS_PIN, !LCD_CS_VALUE);
{
gpio_set_value(LCD_EN_PIN, !LCD_EN_VALUE);
}
+
return 0;
}
static int rk_fb_io_enable(void)
{
+ if(LCD_STB_PIN !=INVALID_GPIO)
+ {
+ gpio_set_value(LCD_STB_PIN, LCD_STB_VALUE);
+ }
+ msleep(50);
if(LCD_CS_PIN !=INVALID_GPIO)
{
gpio_set_value(LCD_CS_PIN, LCD_CS_VALUE);
return 0;
}
-#if defined(CONFIG_LCDC0_RK31)
+#if defined(CONFIG_LCDC0_RK3066B)
struct rk29fb_info lcdc0_screen_info = {
.prop = PRMRY, //primary display device
.io_init = rk_fb_io_init,
};
#endif
-#if defined(CONFIG_LCDC1_RK31)
+#if defined(CONFIG_LCDC1_RK3066B)
struct rk29fb_info lcdc1_screen_info = {
#if defined(CONFIG_HDMI_RK30)
.prop = EXTEND, //extend display device
};
#endif
-#if defined(CONFIG_LCDC0_RK31)
+#if defined(CONFIG_LCDC0_RK3066B)
static struct resource resource_lcdc0[] = {
[0] = {
.name = "lcdc0 reg",
},
};
#endif
-#if defined(CONFIG_LCDC1_RK31)
+#if defined(CONFIG_LCDC1_RK3066B)
static struct resource resource_lcdc1[] = {
[0] = {
.name = "lcdc1 reg",
};
#endif
+#if defined(CONFIG_MFD_RK610)
+#define RK610_RST_PIN_MUX_NAME GPIO2C5_LCDC1DATA21_SMCADDR5_NAME
+#define RK610_RST_PIN_MUX_MODE GPIO2C_GPIO2C5
+#define RK610_RST_PIN RK30_PIN2_PC5
+static int rk610_power_on_init(void)
+{
+ int ret;
+ if(RK610_RST_PIN != INVALID_GPIO)
+ {
+ rk30_mux_api_set(RK610_RST_PIN_MUX_NAME,RK610_RST_PIN_MUX_MODE);
+ ret = gpio_request(RK610_RST_PIN, "rk610 reset");
+ if (ret)
+ {
+ printk(KERN_ERR "rk610_control_probe request gpio fail\n");
+ }
+ else
+ {
+ gpio_direction_output(RK610_RST_PIN, GPIO_HIGH);
+ msleep(100);
+ gpio_direction_output(RK610_RST_PIN, GPIO_LOW);
+ msleep(100);
+ gpio_set_value(RK610_RST_PIN, GPIO_HIGH);
+ }
+ }
+
+ return 0;
+
+}
+
+
+static struct rk610_ctl_platform_data rk610_ctl_pdata = {
+ .rk610_power_on_init = rk610_power_on_init,
+};
+#endif
+
#ifdef CONFIG_ANDROID_TIMED_GPIO
static struct timed_gpio timed_gpios[] = {
{
static struct rk30_adc_battery_platform_data rk30_adc_battery_platdata = {
.dc_det_pin = RK30_PIN0_PB2,
.batt_low_pin = RK30_PIN0_PB1,
- .charge_set_pin = INVALID_GPIO,
+ .charge_set_pin = RK30_PIN2_PA7,
.charge_ok_pin = RK30_PIN0_PA6,
.dc_det_level = GPIO_LOW,
.charge_ok_level = GPIO_HIGH,
+ .charge_set_level = GPIO_HIGH,
};
static struct platform_device rk30_device_adc_battery = {
#ifdef CONFIG_FB_ROCKCHIP
&device_fb,
#endif
-#if defined(CONFIG_LCDC0_RK31)
+#if defined(CONFIG_LCDC0_RK3066B)
&device_lcdc0,
#endif
-#if defined(CONFIG_LCDC1_RK31)
+#if defined(CONFIG_LCDC1_RK3066B)
&device_lcdc1,
#endif
.type = "rk610_ctl",
.addr = 0x40,
.flags = 0,
+ .platform_data = &rk610_ctl_pdata,
},
#ifdef CONFIG_RK610_TVOUT
{
.flags = 0,
},
#endif
-#ifdef CONFIG_RK610_HDMI
+#ifdef CONFIG_HDMI_RK610
{
.type = "rk610_hdmi",
.addr = 0x46,
.flags = 0,
- .irq = RK29_PIN5_PA2,
+ .irq = RK30_PIN0_PB6,
},
#endif
#ifdef CONFIG_SND_SOC_RK610
};
#endif
-#define PMIC_TYPE_WM8326 1
-#define PMIC_TYPE_TPS65910 2
int __sramdata g_pmic_type = 0;
#ifdef CONFIG_I2C1_RK30
#ifdef CONFIG_MFD_WM831X_I2C
#include "board-rk3066b-sdk-wm8326.c"
#endif
#ifdef CONFIG_MFD_TPS65910
-#define TPS65910_HOST_IRQ RK30_PIN6_PA4
+#define TPS65910_HOST_IRQ RK30_PIN0_PB3
#include "board-rk3066b-sdk-tps65910.c"
#endif
void __sramfunc board_pmu_suspend(void)
{
#if defined (CONFIG_MFD_WM831X_I2C)
- if(g_pmic_type == PMIC_TYPE_WM8326)
+ if(pmic_is_wm8326())
board_pmu_wm8326_suspend();
#endif
#if defined (CONFIG_MFD_TPS65910)
- if(g_pmic_type == PMIC_TYPE_TPS65910)
+ if(pmic_is_tps65910())
board_pmu_tps65910_suspend();
#endif
}
void __sramfunc board_pmu_resume(void)
{
#if defined (CONFIG_MFD_WM831X_I2C)
- if(g_pmic_type == PMIC_TYPE_WM8326)
+ if(pmic_is_wm8326())
board_pmu_wm8326_resume();
#endif
#if defined (CONFIG_MFD_TPS65910)
- if(g_pmic_type == PMIC_TYPE_TPS65910)
+ if(pmic_is_tps65910())
board_pmu_tps65910_resume();
#endif
}
.platform_data = &goodix_info,
},
#endif
-#if defined (CONFIG_TOUCHSCREEN_FT5306)
+#if defined (CONFIG_TOUCHSCREEN_FT5306_AV)
{
.type = "ft5x0x_ts",
.addr = 0x38,
.flags = 0,
.irq = RK30_PIN0_PD4,
- .platform_data = &ft5x0x_info,
+ .platform_data = &ft5306_info,
},
#endif
#if defined (CONFIG_LS_CM3217)
}
//end of i2c
+#define POWEROFF_CHARGING_ANIMATION (1)
#define POWER_ON_PIN RK30_PIN0_PA0 //power_hold
static void rk30_pm_power_off(void)
{
- printk(KERN_ERR "rk30_pm_power_off start...\n");
+#if POWEROFF_CHARGING_ANIMATION
+ int pwr_cnt = 0;
+ struct rk30_adc_battery_platform_data *batt_plat_data = &rk30_adc_battery_platdata;
+ if (gpio_get_value (batt_plat_data->dc_det_pin) ==
+ batt_plat_data->dc_det_level) {
+ printk("AC Charging, try to restart...\n");
+ while (1) {
+ if (gpio_get_value (batt_plat_data->dc_det_pin) !=
+ batt_plat_data->dc_det_level ) {
+ pwr_cnt = 0;
+ break;
+ }
+ if (pwr_cnt++ > 40)
+ break;
+ mdelay(50);
+ }
+ if (pwr_cnt > 40) {
+ printk("AC Charging, will restart system...\n");
+ arm_pm_restart(0, NULL);
+ }
+ }
+#endif
+
+ printk("rk30_pm_power_off start...\n");
gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
#if defined(CONFIG_MFD_WM831X)
wm831x_set_bits(Wm831x,WM831X_GPIO_LEVEL,0x0001,0x0000); //set sys_pwr 0
#ifdef CONFIG_WIFI_CONTROL_FUNC
rk29sdk_wifi_bt_gpio_control_init();
#endif
+
+ // spk and ear switch
+ gpio_request(RK30_PIN2_PB1, NULL);
+ gpio_direction_output(RK30_PIN2_PB1, GPIO_HIGH);
}
static void __init rk30_reserve(void)
*/
static struct dvfs_arm_table dvfs_cpu_logic_table[] = {
#if 0
- {.frequency = 252 * 1000, .cpu_volt = 1075 * 1000, .logic_volt = 1125 * 1000},//0.975V/1.000V
+ {.frequency = 252 * 1000, .cpu_volt = 1075 * 1000, .logic_volt = 1125 * 1000},
#endif
- {.frequency = 504 * 1000, .cpu_volt = 975 * 1000, .logic_volt = 1000 * 1000},//0.975V/1.000V
- {.frequency = 816 * 1000, .cpu_volt = 1000 * 1000, .logic_volt = 1000 * 1000},//1.000V/1.025V
- {.frequency = 1200 * 1000, .cpu_volt = 1025 * 1000, .logic_volt = 1000 * 1000},//1.100V/1.050V
+ {.frequency = 504 * 1000, .cpu_volt = 1100 * 1000, .logic_volt = 1100 * 1000},
+ {.frequency = 816 * 1000, .cpu_volt = 1100 * 1000, .logic_volt = 1100 * 1000},
+ {.frequency = 1200 * 1000, .cpu_volt = 1100 * 1000, .logic_volt = 1100 * 1000},
#if 0
- {.frequency = 1008 * 1000, .cpu_volt = 1125 * 1000, .logic_volt = 1150 * 1000},//1.025V/1.050V
- {.frequency = 1272 * 1000, .cpu_volt = 1225 * 1000, .logic_volt = 1200 * 1000},//1.150V/1.100V
- {.frequency = 1416 * 1000, .cpu_volt = 1300 * 1000, .logic_volt = 1200 * 1000},//1.225V/1.100V
- {.frequency = 1512 * 1000, .cpu_volt = 1350 * 1000, .logic_volt = 1250 * 1000},//1.300V/1.150V
- {.frequency = 1608 * 1000, .cpu_volt = 1425 * 1000, .logic_volt = 1300 * 1000},//1.325V/1.175V
+ {.frequency = 1008 * 1000, .cpu_volt = 1125 * 1000, .logic_volt = 1150 * 1000},
+ {.frequency = 1272 * 1000, .cpu_volt = 1225 * 1000, .logic_volt = 1200 * 1000},
+ {.frequency = 1416 * 1000, .cpu_volt = 1300 * 1000, .logic_volt = 1200 * 1000},
+ {.frequency = 1512 * 1000, .cpu_volt = 1350 * 1000, .logic_volt = 1250 * 1000},
+ {.frequency = 1608 * 1000, .cpu_volt = 1425 * 1000, .logic_volt = 1300 * 1000},
#endif
{.frequency = CPUFREQ_TABLE_END},
};
static struct cpufreq_frequency_table dvfs_gpu_table[] = {
{.frequency = 266 * 1000, .index = 1000 * 1000},
{.frequency = 400 * 1000, .index = 1000 * 1000},
+ {.frequency = 600 * 1000, .index = 1200 * 1000},
{.frequency = CPUFREQ_TABLE_END},
};