board rk3066 rk3066b m701: add rk610 power ioctl
authoryxj <yxj@rock-chips.com>
Fri, 14 Sep 2012 06:01:01 +0000 (14:01 +0800)
committeryxj <yxj@rock-chips.com>
Mon, 17 Sep 2012 03:24:46 +0000 (11:24 +0800)
arch/arm/mach-rk30/board-rk30-sdk.c
arch/arm/mach-rk30/board-rk3066b-m701.c
arch/arm/mach-rk30/board-rk3066b-sdk.c

index ba9dc209f46567605d78b5565612c3a1206f0ea8..7da6525dda3a8f091c6eaf96fee682ea3ad6ccee 100755 (executable)
 #include <linux/rfkill-rk.h>
 #include <linux/sensor-dev.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
@@ -701,6 +706,41 @@ static struct platform_device device_lcdc1 = {
 };
 #endif
 
+#if defined(CONFIG_MFD_RK610)
+#define RK610_RST_PIN_MUX_NAME         GPIO0C6_TRACECLK_SMCADDR2_NAME  
+#define RK610_RST_PIN_MUX_MODE         GPIO0C_GPIO0C6
+#define RK610_RST_PIN                  RK30_PIN0_PC6
+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[] = {
        {
@@ -1302,6 +1342,7 @@ static struct i2c_board_info __initdata i2c0_info[] = {
                        .type                   = "rk610_ctl",
                        .addr                   = 0x40,
                        .flags                  = 0,
+                       .platform_data          = &rk610_power_on_init,
                },
 #ifdef CONFIG_RK610_TVOUT
                {
index 94ba8c63dff22c017d53c0e08c3a4432a43da44c..fb3b4ffc4371c527f405351679c97d627a16b301 100755 (executable)
 #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
@@ -773,6 +778,41 @@ static struct platform_device device_lcdc1 = {
 };
 #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[] = {
        {
@@ -1324,6 +1364,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
                {
index ebfec737d24f12209686dfc6b1a44881cda5a732..5d3d699a4d731428a662afcf750a588cebb27b69 100755 (executable)
 #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
@@ -622,6 +627,41 @@ static struct platform_device device_lcdc1 = {
 };
 #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[] = {
        {
@@ -1155,6 +1195,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
                {