rk:move pmic_type to board.h
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-rk30 / board-rk3066b-sdk.c
old mode 100644 (file)
new mode 100755 (executable)
index 3878f61..8c01f5e
 #include <linux/regulator/machine.h>
 #include <linux/rfkill-rk.h>
 #include <linux/sensor-dev.h>
-#if defined(CONFIG_HDMI_RK30)
+#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_RK_HDMI)
        #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
 #endif
 
 #if defined(CONFIG_SPIM_RK29)
 #include "../../../drivers/spi/rk29_spim.h"
 #endif
+#if defined(CONFIG_GPS_RK)
+#include "../../../drivers/misc/gps/rk_gps/rk_gps.h"
+#endif
+
 #if defined(CONFIG_MU509)
 #include <linux/mu509.h>
 #endif
 
 #if defined(CONFIG_TOUCHSCREEN_GT8XX)
 #define TOUCH_RESET_PIN  RK30_PIN2_PC0
-#define TOUCH_PWR_PIN    INVALID_GPIO
+#define TOUCH_PWR_PIN    RK30_PIN2_PB4
 static int goodix_init_platform_hw(void)
 {
        int ret;
        
-#ifndef CONFIG_ARCH_RK3066B
-       rk30_mux_api_set(GPIO4D0_SMCDATA8_TRACEDATA8_NAME, GPIO4D_GPIO4D0);
-       rk30_mux_api_set(GPIO4C2_SMCDATA2_TRACEDATA2_NAME, GPIO4C_GPIO4C2);
-       printk("%s:0x%x,0x%x\n",__func__,rk30_mux_api_get(GPIO4D0_SMCDATA8_TRACEDATA8_NAME),rk30_mux_api_get(GPIO4C2_SMCDATA2_TRACEDATA2_NAME));
-#endif
+       rk30_mux_api_set(GPIO2C0_LCDC1DATA16_SMCADDR0_TRACECLK_NAME, GPIO2C_GPIO2C0);
+       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));
 
        if (TOUCH_PWR_PIN != INVALID_GPIO) {
                ret = gpio_request(TOUCH_PWR_PIN, "goodix power pin");
@@ -130,17 +139,17 @@ static struct spi_board_info board_spi_devices[] = {
 *      rk30  backlight
 ************************************************************/
 #ifdef CONFIG_BACKLIGHT_RK29_BL
-#define PWM_ID            0
-#define PWM_MUX_NAME      GPIO3D3_PWM0_NAME
-#define PWM_MUX_MODE      GPIO3D_PWM0
-#define PWM_MUX_MODE_GPIO GPIO3D_GPIO3D4
-#define PWM_GPIO         RK30_PIN3_PD4
+#define PWM_ID            2
+#define PWM_MUX_NAME      GPIO3D5_PWM2_JTAGTCK_OTGDRVVBUS_NAME
+#define PWM_MUX_MODE      GPIO3D_PWM2
+#define PWM_MUX_MODE_GPIO GPIO3D_GPIO3D5
+#define PWM_GPIO         RK30_PIN3_PD5
 #define PWM_EFFECT_VALUE  1
 
 #define LCD_DISP_ON_PIN
 
 #ifdef  LCD_DISP_ON_PIN
-#define BL_EN_PIN         RK30_PIN0_PA1
+#define BL_EN_PIN         RK30_PIN0_PA2
 #define BL_EN_VALUE       GPIO_HIGH
 #endif
 static int rk29_backlight_io_init(void)
@@ -168,6 +177,8 @@ static int rk29_backlight_io_deinit(void)
        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;
 }
 
@@ -353,10 +364,6 @@ struct platform_device rk29_device_mt6229 = {
 
 static int mma8452_init_platform_hw(void)
 {
-#ifndef CONFIG_ARCH_RK3066B
-       rk30_mux_api_set(GPIO4C0_SMCDATA0_TRACEDATA0_NAME, GPIO4C_GPIO4C0);
-#endif
-
        return 0;
 }
 
@@ -373,9 +380,6 @@ static struct sensor_platform_data mma8452_info = {
 
 static int lis3dh_init_platform_hw(void)
 {
-#ifndef CONFIG_ARCH_RK3066B
-        rk30_mux_api_set(GPIO4C0_SMCDATA0_TRACEDATA0_NAME, GPIO4C_GPIO4C0);
-#endif
 
         return 0;
 }
@@ -431,10 +435,6 @@ static struct sensor_platform_data akm8975_info =
 
 static int l3g4200d_init_platform_hw(void)
 {
-#ifndef CONFIG_ARCH_RK3066B
-       rk30_mux_api_set(GPIO4C3_SMCDATA3_TRACEDATA3_NAME, GPIO4C_GPIO4C3);
-#endif
-       
        return 0;
 }
 
@@ -462,53 +462,73 @@ static struct sensor_platform_data cm3217_info = {
 
 #ifdef CONFIG_FB_ROCKCHIP
 
-#define LCD_CS_PIN         RK30_PIN0_PB0
+#define LCD_CS_PIN         INVALID_GPIO
 #define LCD_CS_VALUE       GPIO_HIGH
 
 #define LCD_EN_PIN         RK30_PIN0_PB0
-#define LCD_EN_VALUE       GPIO_LOW
+#define LCD_EN_VALUE       GPIO_HIGH
 
 static int rk_fb_io_init(struct rk29_fb_setting_info *fb_setting)
 {
        int ret = 0;
-       ret = gpio_request(LCD_CS_PIN, NULL);
-       if (ret != 0)
-       {
-               gpio_free(LCD_CS_PIN);
-               printk(KERN_ERR "request lcd cs pin fail!\n");
-               return -1;
-       }
-       else
-       {
-               gpio_direction_output(LCD_CS_PIN, LCD_CS_VALUE);
-       }
-       ret = gpio_request(LCD_EN_PIN, NULL);
-       if (ret != 0)
+
+       if(LCD_CS_PIN !=INVALID_GPIO)
        {
-               gpio_free(LCD_EN_PIN);
-               printk(KERN_ERR "request lcd en pin fail!\n");
-               return -1;
+               ret = gpio_request(LCD_CS_PIN, NULL);
+               if (ret != 0)
+               {
+                       gpio_free(LCD_CS_PIN);
+                       printk(KERN_ERR "request lcd cs pin fail!\n");
+                       return -1;
+               }
+               else
+               {
+                       gpio_direction_output(LCD_CS_PIN, LCD_CS_VALUE);
+               }
        }
-       else
+
+       if(LCD_EN_PIN !=INVALID_GPIO)
        {
-               gpio_direction_output(LCD_EN_PIN, LCD_EN_VALUE);
+               ret = gpio_request(LCD_EN_PIN, NULL);
+               if (ret != 0)
+               {
+                       gpio_free(LCD_EN_PIN);
+                       printk(KERN_ERR "request lcd en pin fail!\n");
+                       return -1;
+               }
+               else
+               {
+                       gpio_direction_output(LCD_EN_PIN, LCD_EN_VALUE);
+               }
        }
        return 0;
 }
 static int rk_fb_io_disable(void)
 {
-       gpio_set_value(LCD_CS_PIN, LCD_CS_VALUE? 0:1);
-       gpio_set_value(LCD_EN_PIN, LCD_EN_VALUE? 0:1);
+       if(LCD_CS_PIN !=INVALID_GPIO)
+       {
+               gpio_set_value(LCD_CS_PIN, !LCD_CS_VALUE);
+       }
+       if(LCD_EN_PIN !=INVALID_GPIO)
+       {
+               gpio_set_value(LCD_EN_PIN, !LCD_EN_VALUE);
+       }
        return 0;
 }
 static int rk_fb_io_enable(void)
 {
-       gpio_set_value(LCD_CS_PIN, LCD_CS_VALUE);
-       gpio_set_value(LCD_EN_PIN, LCD_EN_VALUE);
+       if(LCD_CS_PIN !=INVALID_GPIO)
+       {
+               gpio_set_value(LCD_CS_PIN, LCD_CS_VALUE);
+       }
+       if(LCD_EN_PIN !=INVALID_GPIO)
+       {
+               gpio_set_value(LCD_EN_PIN, LCD_EN_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,
@@ -518,9 +538,9 @@ struct rk29fb_info lcdc0_screen_info = {
 };
 #endif
 
-#if defined(CONFIG_LCDC1_RK31)
+#if defined(CONFIG_LCDC1_RK3066B)
 struct rk29fb_info lcdc1_screen_info = {
-       #if defined(CONFIG_HDMI_RK30)
+       #if defined(CONFIG_RK_HDMI)
        .prop           = EXTEND,       //extend display device
        .lcd_info  = NULL,
        .set_screen_info = hdmi_init_lcdc,
@@ -557,11 +577,107 @@ static struct platform_device device_fb = {
 };
 #endif
 
+#if defined(CONFIG_LCDC0_RK3066B)
+static struct resource resource_lcdc0[] = {
+       [0] = {
+               .name  = "lcdc0 reg",
+               .start = RK30_LCDC0_PHYS,
+               .end   = RK30_LCDC0_PHYS + RK30_LCDC0_SIZE - 1,
+               .flags = IORESOURCE_MEM,
+       },
+       
+       [1] = {
+               .name  = "lcdc0 irq",
+               .start = IRQ_LCDC0,
+               .end   = IRQ_LCDC0,
+               .flags = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device device_lcdc0 = {
+       .name             = "rk30-lcdc",
+       .id               = 0,
+       .num_resources    = ARRAY_SIZE(resource_lcdc0),
+       .resource         = resource_lcdc0,
+       .dev            = {
+               .platform_data = &lcdc0_screen_info,
+       },
+};
+#endif
+#if defined(CONFIG_LCDC1_RK3066B) 
+static struct resource resource_lcdc1[] = {
+       [0] = {
+               .name  = "lcdc1 reg",
+               .start = RK30_LCDC1_PHYS,
+               .end   = RK30_LCDC1_PHYS + RK30_LCDC1_SIZE - 1,
+               .flags = IORESOURCE_MEM,
+       },
+       [1] = {
+               .name  = "lcdc1 irq",
+               .start = IRQ_LCDC1,
+               .end   = IRQ_LCDC1,
+               .flags = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device device_lcdc1 = {
+       .name             = "rk30-lcdc",
+       .id               = 1,
+       .num_resources    = ARRAY_SIZE(resource_lcdc1),
+       .resource         = resource_lcdc1,
+       .dev            = {
+               .platform_data = &lcdc1_screen_info,
+       },
+};
+#endif
+
+#if defined(CONFIG_MFD_RK610)
+#if 1
+#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
+#else
+#define RK610_RST_PIN_MUX_NAME         GPIO2D6_SMCCSN1_NAME 
+#define RK610_RST_PIN_MUX_MODE         GPIO2D_GPIO2D6
+#define RK610_RST_PIN                  RK30_PIN2_PD6
+
+#endif
+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[] = {
        {
                .name = "vibrator",
-               .gpio = RK30_PIN0_PA4,
+               .gpio = RK30_PIN3_PD3,
                .max_timeout = 1000,
                .active_low = 0,
                .adjust_time =20,      //adjust for diff product
@@ -855,6 +971,59 @@ static struct platform_device rk30_device_adc_battery = {
         },
 };
 #endif
+#ifdef CONFIG_RK30_PWM_REGULATOR
+const static int pwm_voltage_map[] = {
+       1000000, 1025000, 1050000, 1075000, 1100000, 1125000, 1150000, 1175000, 1200000, 1225000, 1250000, 1275000, 1300000, 1325000, 1350000, 1375000, 1400000
+};
+
+static struct regulator_consumer_supply pwm_dcdc1_consumers[] = {
+       {
+               .supply = "vdd_core",
+       }
+};
+
+struct regulator_init_data pwm_regulator_init_dcdc[1] =
+{
+       {
+               .constraints = {
+                       .name = "PWM_DCDC1",
+                       .min_uV = 600000,
+                       .max_uV = 1800000,      //0.6-1.8V
+                       .apply_uV = true,
+                       .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
+               },
+               .num_consumer_supplies = ARRAY_SIZE(pwm_dcdc1_consumers),
+               .consumer_supplies = pwm_dcdc1_consumers,
+       },
+};
+
+static struct pwm_platform_data pwm_regulator_info[1] = {
+       {
+               .pwm_id = 3,
+               .pwm_gpio = RK30_PIN3_PD6,
+               .pwm_iomux_name = GPIO3D6_PWM3_JTAGTMS_HOSTDRVVBUS_NAME,
+               .pwm_iomux_pwm = GPIO3D_PWM3,
+               .pwm_iomux_gpio = GPIO3D_GPIO3D6,
+               .pwm_voltage = 1100000,
+               .suspend_voltage = 1050000,
+               .min_uV = 1000000,
+               .max_uV = 1400000,
+               .coefficient = 455,     //45.5%
+               .pwm_voltage_map = pwm_voltage_map,
+               .init_data      = &pwm_regulator_init_dcdc[0],
+       },
+};
+
+struct platform_device pwm_regulator_device[1] = {
+       {
+               .name = "pwm-voltage-regulator",
+               .id = 0,
+               .dev            = {
+                       .platform_data = &pwm_regulator_info[0],
+               }
+       },
+};
+#endif
 
 #ifdef CONFIG_RK29_VMAC
 #define PHY_PWR_EN_GPIO        RK30_PIN1_PD6
@@ -867,29 +1036,29 @@ static struct rfkill_rk_platform_data rfkill_rk_platdata = {
     .type               = RFKILL_TYPE_BLUETOOTH,
 
     .poweron_gpio       = { // BT_REG_ON
-        .io             = RK30_PIN3_PC6, 
+        .io             = INVALID_GPIO, //RK30_PIN3_PC7,
         .enable         = GPIO_HIGH,
         .iomux          = {
-            .name       = GPIO3C6_SDMMC1DETECTN_RMIIRXERR_NAME,
-            .fgpio      = GPIO3C_GPIO3C6,
+            .name       = GPIO3C7_SDMMC1WRITEPRT_RMIICRS_NAME,
+            .fgpio      = GPIO3C_GPIO3C7,
         },
     },
 
     .reset_gpio         = { // BT_RST
-        .io             = RK30_PIN3_PD0, // set io to INVALID_GPIO for disable it
+        .io             = RK30_PIN3_PD1, // set io to INVALID_GPIO for disable it
         .enable         = GPIO_LOW,
         .iomux          = {
-            .name       = GPIO3D0_SDMMC1PWREN_MIIMD_NAME,
-            .fgpio      = GPIO3D_GPIO3D0,
-        },
-    },
+            .name       = GPIO3D1_SDMMC1BACKENDPWR_MIIMDCLK_NAME,
+            .fgpio      = GPIO3D_GPIO3D1,
+       },
+   }, 
 
     .wake_gpio          = { // BT_WAKE, use to control bt's sleep and wakeup
-        .io             = RK30_PIN3_PC5, // set io to INVALID_GPIO for disable it
+        .io             = RK30_PIN3_PC6, // set io to INVALID_GPIO for disable it
         .enable         = GPIO_HIGH,
         .iomux          = {
-            .name       = GPIO3C5_SDMMC1CLKOUT_RMIICLKOUT_RMIICLKIN_NAME,
-            .fgpio      = GPIO3C_GPIO3C5,
+            .name       = GPIO3C6_SDMMC1DETECTN_RMIIRXERR_NAME,
+            .fgpio      = GPIO3C_GPIO3C6,
         },
     },
 
@@ -923,13 +1092,108 @@ static struct platform_device device_rfkill_rk = {
 };
 #endif
 
-static struct platform_device *devices[] __initdata = {
-#ifdef CONFIG_BACKLIGHT_RK29_BL
-       &rk29_device_backlight,
+#if defined(CONFIG_GPS_RK)
+int rk_gps_io_init(void)
+{
+       printk("%s \n", __FUNCTION__);
+       
+       rk30_mux_api_set(GPIO1B5_UART3RTSN_NAME, GPIO1B_GPIO1B5);//VCC_EN
+       gpio_request(RK30_PIN1_PB5, NULL);
+       gpio_direction_output(RK30_PIN1_PB5, GPIO_LOW);
+
+       rk30_mux_api_set(GPIO1B4_UART3CTSN_GPSRFCLK_NAME, GPIO1B_GPSRFCLK);//GPS_CLK
+       rk30_mux_api_set(GPIO1B2_UART3SIN_GPSMAG_NAME, GPIO1B_GPSMAG);//GPS_MAG
+       rk30_mux_api_set(GPIO1B3_UART3SOUT_GPSSIG_NAME, GPIO1B_GPSSIG);//GPS_SIGN
+
+       rk30_mux_api_set(GPIO1A6_UART1CTSN_SPI0CLK_NAME, GPIO1A_GPIO1A6);//SPI_CLK
+       gpio_request(RK30_PIN1_PA6, NULL);
+       gpio_direction_output(RK30_PIN1_PA6, GPIO_LOW);
+
+       rk30_mux_api_set(GPIO1A5_UART1SOUT_SPI0TXD_NAME, GPIO1A_GPIO1A5);//SPI_MOSI
+       gpio_request(RK30_PIN1_PA5, NULL);
+       gpio_direction_output(RK30_PIN1_PA5, GPIO_LOW); 
+
+       rk30_mux_api_set(GPIO1A7_UART1RTSN_SPI0CSN0_NAME, GPIO1A_GPIO1A7);//SPI_CS
+       gpio_request(RK30_PIN1_PA7, NULL);
+       gpio_direction_output(RK30_PIN1_PA7, GPIO_LOW);         
+       return 0;
+}
+int rk_gps_power_up(void)
+{
+       printk("%s \n", __FUNCTION__);
+
+       return 0;
+}
+
+int rk_gps_power_down(void)
+{
+       printk("%s \n", __FUNCTION__);
+
+       return 0;
+}
+
+int rk_gps_reset_set(int level)
+{
+       return 0;
+}
+int rk_enable_hclk_gps(void)
+{
+       printk("%s \n", __FUNCTION__);
+       clk_enable(clk_get(NULL, "hclk_gps"));
+       return 0;
+}
+int rk_disable_hclk_gps(void)
+{
+       printk("%s \n", __FUNCTION__);
+       clk_disable(clk_get(NULL, "hclk_gps"));
+       return 0;
+}
+struct rk_gps_data rk_gps_info = {
+       .io_init = rk_gps_io_init,
+       .power_up = rk_gps_power_up,
+       .power_down = rk_gps_power_down,
+       .reset = rk_gps_reset_set,
+       .enable_hclk_gps = rk_enable_hclk_gps,
+       .disable_hclk_gps = rk_disable_hclk_gps,
+       .GpsSign = RK30_PIN1_PB3,
+       .GpsMag = RK30_PIN1_PB2,        //GPIO index
+       .GpsClk = RK30_PIN1_PB4,        //GPIO index
+       .GpsVCCEn = RK30_PIN1_PB5,     //GPIO index
+       .GpsSpi_CSO = RK30_PIN1_PA4,    //GPIO index
+       .GpsSpiClk = RK30_PIN1_PA5,     //GPIO index
+       .GpsSpiMOSI = RK30_PIN1_PA7,      //GPIO index
+       .GpsIrq = IRQ_GPS,
+       .GpsSpiEn = 0,
+       .GpsAdcCh = 2,
+       .u32GpsPhyAddr = RK30_GPS_PHYS,
+       .u32GpsPhySize = RK30_GPS_SIZE,
+};
+
+struct platform_device rk_device_gps = {
+       .name = "gps_hv5820b",
+       .id = -1,
+       .dev            = {
+       .platform_data = &rk_gps_info,
+               }
+       };
 #endif
+
+
+static struct platform_device *devices[] __initdata = {
 #ifdef CONFIG_FB_ROCKCHIP
        &device_fb,
 #endif
+#if defined(CONFIG_LCDC0_RK3066B)
+       &device_lcdc0,
+#endif
+#if defined(CONFIG_LCDC1_RK3066B)
+       &device_lcdc1,
+#endif
+
+#ifdef CONFIG_BACKLIGHT_RK29_BL
+       &rk29_device_backlight,
+#endif
+
 #ifdef CONFIG_ION
        &device_ion,
 #endif
@@ -963,6 +1227,10 @@ static struct platform_device *devices[] __initdata = {
 #ifdef CONFIG_RFKILL_RK
        &device_rfkill_rk,
 #endif
+#ifdef CONFIG_GPS_RK
+       &rk_device_gps,
+#endif
+
 };
 
 // i2c
@@ -1029,6 +1297,7 @@ static struct i2c_board_info __initdata i2c0_info[] = {
                        .type                   = "rk610_ctl",
                        .addr                   = 0x40,
                        .flags                  = 0,
+                       .platform_data          = &rk610_ctl_pdata,
                },
 #ifdef CONFIG_RK610_TVOUT
                {
@@ -1037,12 +1306,12 @@ static struct i2c_board_info __initdata i2c0_info[] = {
                        .flags                  = 0,
                },
 #endif
-#ifdef CONFIG_RK610_HDMI
+#ifdef CONFIG_HDMI_RK610
                {
                        .type                   = "rk610_hdmi",
                        .addr                   = 0x46,
                        .flags                  = 0,
-                       .irq                    = RK29_PIN5_PA2,
+                       .irq                    = INVALID_GPIO,
                },
 #endif
 #ifdef CONFIG_SND_SOC_RK610
@@ -1057,8 +1326,19 @@ static struct i2c_board_info __initdata i2c0_info[] = {
 };
 #endif
 
+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
+#ifdef CONFIG_ARCH_RK3066B
+#define TPS65910_HOST_IRQ        RK30_PIN0_PB3
+#else
+#define TPS65910_HOST_IRQ        RK30_PIN6_PA4
+#endif
+#include "board-rk3066b-sdk-tps65910.c"
+#endif
 
 static struct i2c_board_info __initdata i2c1_info[] = {
 #if defined (CONFIG_MFD_WM831X_I2C)
@@ -1070,9 +1350,89 @@ static struct i2c_board_info __initdata i2c1_info[] = {
                .platform_data = &wm831x_platdata,
        },
 #endif
+#if defined (CONFIG_MFD_TPS65910)
+       {
+        .type           = "tps65910",
+        .addr           = TPS65910_I2C_ID0,
+        .flags          = 0,
+        .irq            = TPS65910_HOST_IRQ,
+       .platform_data = &tps65910_data,
+       },
+#endif
 };
 #endif
 
+void __sramfunc board_pmu_suspend(void)
+{      
+       #if defined (CONFIG_MFD_WM831X_I2C)
+       if(pmic_is_wm8326())
+       board_pmu_wm8326_suspend();
+       #endif
+       #if defined (CONFIG_MFD_TPS65910)
+       if(pmic_is_tps65910())
+       board_pmu_tps65910_suspend(); 
+    #endif   
+}
+
+void __sramfunc board_pmu_resume(void)
+{      
+       #if defined (CONFIG_MFD_WM831X_I2C)
+       if(pmic_is_wm8326())
+       board_pmu_wm8326_resume();
+       #endif
+       #if defined (CONFIG_MFD_TPS65910)
+       if(pmic_is_tps65910())
+       board_pmu_tps65910_resume(); 
+       #endif
+}
+
+ int __sramdata gpio0d7_iomux,gpio0d7_do,gpio0d7_dir,gpio0d7_en;
+
+void __sramfunc rk30_pwm_logic_suspend_voltage(void)
+{
+#ifdef CONFIG_RK30_PWM_REGULATOR
+
+//     int gpio0d7_iomux,gpio0d7_do,gpio0d7_dir,gpio0d7_en;
+       sram_udelay(10000);
+       gpio0d7_iomux = readl_relaxed(GRF_GPIO0D_IOMUX);
+       gpio0d7_do = grf_readl(GRF_GPIO0H_DO);
+       gpio0d7_dir = grf_readl(GRF_GPIO0H_DIR);
+       gpio0d7_en = grf_readl(GRF_GPIO0H_EN);
+
+       writel_relaxed((1<<30), GRF_GPIO0D_IOMUX);
+       grf_writel((1<<31)|(1<<15), GRF_GPIO0H_DIR);
+       grf_writel((1<<31)|(1<<15), GRF_GPIO0H_DO);
+       grf_writel((1<<31)|(1<<15), GRF_GPIO0H_EN);
+#endif 
+}
+void __sramfunc rk30_pwm_logic_resume_voltage(void)
+{
+#ifdef CONFIG_RK30_PWM_REGULATOR
+       writel_relaxed((1<<30)|gpio0d7_iomux, GRF_GPIO0D_IOMUX);
+       grf_writel((1<<31)|gpio0d7_en, GRF_GPIO0H_EN);
+       grf_writel((1<<31)|gpio0d7_dir, GRF_GPIO0H_DIR);
+       grf_writel((1<<31)|gpio0d7_do, GRF_GPIO0H_DO);
+       sram_udelay(10000);
+
+#endif
+
+}
+extern void pwm_suspend_voltage(void);
+extern void pwm_resume_voltage(void);
+void  rk30_pwm_suspend_voltage_set(void)
+{
+#ifdef CONFIG_RK30_PWM_REGULATOR
+       pwm_suspend_voltage();
+#endif
+}
+void  rk30_pwm_resume_voltage_set(void)
+{
+#ifdef CONFIG_RK30_PWM_REGULATOR
+       pwm_resume_voltage();
+#endif
+}
+
+
 #ifdef CONFIG_I2C2_RK30
 static struct i2c_board_info __initdata i2c2_info[] = {
 #if defined (CONFIG_TOUCHSCREEN_GT8XX)
@@ -1165,7 +1525,7 @@ static void rk30_pm_power_off(void)
 
 static void __init machine_rk30_board_init(void)
 {
-       avs_init();
+       //avs_init();
        gpio_request(POWER_ON_PIN, "poweronpin");
        gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
        
@@ -1189,14 +1549,21 @@ static void __init rk30_reserve(void)
 #ifdef CONFIG_FB_ROCKCHIP
        resource_fb[0].start = board_mem_reserve_add("fb0", RK30_FB0_MEM_SIZE);
        resource_fb[0].end = resource_fb[0].start + RK30_FB0_MEM_SIZE - 1;
+       #if 0
        resource_fb[1].start = board_mem_reserve_add("ipp buf", RK30_FB0_MEM_SIZE);
        resource_fb[1].end = resource_fb[1].start + RK30_FB0_MEM_SIZE - 1;
        resource_fb[2].start = board_mem_reserve_add("fb2", RK30_FB0_MEM_SIZE);
        resource_fb[2].end = resource_fb[2].start + RK30_FB0_MEM_SIZE - 1;
+       #endif
 #endif
 #ifdef CONFIG_VIDEO_RK29
        rk30_camera_request_reserve_mem();
 #endif
+       
+#ifdef CONFIG_GPS_RK
+       //it must be more than 8MB
+       rk_gps_info.u32MemoryPhyAddr = board_mem_reserve_add("gps", SZ_8M);
+#endif
        board_mem_reserved();
 }
 
@@ -1208,30 +1575,31 @@ static void __init rk30_reserve(void)
  * comments    : min arm/logic voltage
  */
 static struct dvfs_arm_table dvfs_cpu_logic_table[] = {
-       {.frequency = 252 * 1000,       .cpu_volt = 1075 * 1000,        .logic_volt = 1125 * 1000},//0.975V/1.000V
-       {.frequency = 504 * 1000,       .cpu_volt = 1100 * 1000,        .logic_volt = 1125 * 1000},//0.975V/1.000V
-       {.frequency = 816 * 1000,       .cpu_volt = 1125 * 1000,        .logic_volt = 1150 * 1000},//1.000V/1.025V
-       {.frequency = 1008 * 1000,      .cpu_volt = 1125 * 1000,        .logic_volt = 1150 * 1000},//1.025V/1.050V
-       {.frequency = 1200 * 1000,      .cpu_volt = 1175 * 1000,        .logic_volt = 1200 * 1000},//1.100V/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 = 312 * 1000,       .cpu_volt = 750 * 1000,         .logic_volt = 900 * 1000},
+       {.frequency = 504 * 1000,       .cpu_volt = 800 * 1000,         .logic_volt = 900 * 1000},
+       {.frequency = 816 * 1000,       .cpu_volt = 850 * 1000,         .logic_volt = 900 * 1000},
+       {.frequency = 1008 * 1000,      .cpu_volt = 925 * 1000,         .logic_volt = 900 * 1000},
+       {.frequency = 1200 * 1000,      .cpu_volt = 1000 * 1000,        .logic_volt = 950 * 1000},
+       {.frequency = 1416 * 1000,      .cpu_volt = 1100 * 1000,        .logic_volt = 1050 * 1000},
+       {.frequency = 1608 * 1000,      .cpu_volt = 1200 * 1000,        .logic_volt = 1150 * 1000},
        {.frequency = CPUFREQ_TABLE_END},
 };
 
 static struct cpufreq_frequency_table dvfs_gpu_table[] = {
-       {.frequency = 266 * 1000,       .index = 1050 * 1000},
-       {.frequency = 400 * 1000,       .index = 1275 * 1000},
+       {.frequency = 100 * 1000,       .index = 900 * 1000},
+       {.frequency = 200 * 1000,       .index = 900 * 1000},
+       {.frequency = 266 * 1000,       .index = 900 * 1000},
+       {.frequency = 300 * 1000,       .index = 900 * 1000},
+       {.frequency = 400 * 1000,       .index = 950 * 1000},
+       {.frequency = 600 * 1000,       .index = 1100 * 1000},
        {.frequency = CPUFREQ_TABLE_END},
 };
 
 static struct cpufreq_frequency_table dvfs_ddr_table[] = {
-       {.frequency = 300 * 1000,       .index = 1050 * 1000},
-       {.frequency = 400 * 1000,       .index = 1125 * 1000},
+       {.frequency = 300 * 1000,       .index = 900 * 1000},
+       {.frequency = 400 * 1000,       .index = 950 * 1000},
        {.frequency = CPUFREQ_TABLE_END},
 };
-
 #define DVFS_CPU_TABLE_SIZE    (ARRAY_SIZE(dvfs_cpu_logic_table))
 static struct cpufreq_frequency_table cpu_dvfs_table[DVFS_CPU_TABLE_SIZE];
 static struct cpufreq_frequency_table dep_cpu2core_table[DVFS_CPU_TABLE_SIZE];