rk3188 tb board:add mfd rk616
authoryxj <yxj@rock-chips.com>
Wed, 3 Apr 2013 10:10:42 +0000 (18:10 +0800)
committeryxj <yxj@rock-chips.com>
Wed, 3 Apr 2013 10:11:03 +0000 (18:11 +0800)
arch/arm/mach-rk30/board-rk3168-tb.c

index 0b9d9b314b5382312065dec762e2e5b893b8e974..f207a4b93cf063eea71e6c870154fe44b1686b20 100755 (executable)
 #include <linux/mfd/rk610_core.h>
 #endif
 
+#if defined(CONFIG_MFD_RK616)
+#include <linux/mfd/rk616.h>
+#endif
+
+
 #if defined(CONFIG_RK_HDMI)
        #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
 #endif
@@ -689,6 +694,55 @@ static struct rk610_ctl_platform_data rk610_ctl_pdata = {
 };
 #endif
 
+#if defined(CONFIG_MFD_RK616)
+#define RK616_RST_PIN                  RK30_PIN3_PB2
+#define RK616_PWREN_PIN                        RK30_PIN0_PA3
+#define RK616_SCL_RATE                 (100*1000)   //i2c scl rate
+static int rk616_power_on_init(void)
+{
+       int ret;
+
+       if(RK616_PWREN_PIN != INVALID_GPIO)
+       {
+               ret = gpio_request(RK616_PWREN_PIN, "rk616 pwren");
+               if (ret)
+               {
+                       printk(KERN_ERR "rk616 pwren gpio request fail\n");
+               }
+               else 
+               {
+                       gpio_direction_output(RK616_PWREN_PIN,GPIO_HIGH);
+               }
+       }
+       
+       if(RK616_RST_PIN != INVALID_GPIO)
+       {
+               ret = gpio_request(RK616_RST_PIN, "rk616 reset");
+               if (ret)
+               {
+                       printk(KERN_ERR "rk616 reset gpio request fail\n");
+               }
+               else 
+               {
+                       gpio_direction_output(RK616_RST_PIN, GPIO_HIGH);
+                       msleep(100);
+                       gpio_direction_output(RK616_RST_PIN, GPIO_LOW);
+                       msleep(100);
+                       gpio_set_value(RK616_RST_PIN, GPIO_HIGH);
+               }
+       }
+
+       return 0;
+       
+}
+
+
+static struct rk616_platform_data rk616_pdata = {
+       .power_init = rk616_power_on_init,
+       .scl_rate   = RK616_SCL_RATE,
+};
+#endif
+
 #ifdef CONFIG_SND_SOC_RK610
 static int rk610_codec_io_init(void)
 {
@@ -2052,6 +2106,15 @@ static struct i2c_board_info __initdata i2c3_info[] = {
 
 #ifdef CONFIG_I2C4_RK30
 static struct i2c_board_info __initdata i2c4_info[] = {
+#if defined (CONFIG_MFD_RK616)
+               {
+                       .type          = "rk616",
+                       .addr          = 0x50,
+                       .flags         = 0,
+                       .platform_data = &rk616_pdata,
+               },
+#endif
+
 };
 #endif