* author: zyw@rock-chips.com
*****************************************************************************************/
#define FB_ID 0
-#define FB_DISPLAY_ON_PIN RK29_PIN6_PD0
+#define FB_DISPLAY_ON_PIN INVALID_GPIO// RK29_PIN6_PD0
#define FB_LCD_STANDBY_PIN RK29_PIN6_PD1
#define FB_LCD_CABC_EN_PIN RK29_PIN6_PD2
#define FB_MCU_FMK_PIN INVALID_GPIO
.io_deinit = rk29_lcd_io_deinit,
};
+int rk29_fb_io_enable(void)
+{
+ if(FB_DISPLAY_ON_PIN != INVALID_GPIO)
+ {
+ gpio_direction_output(FB_DISPLAY_ON_PIN, 0);
+ gpio_set_value(FB_DISPLAY_ON_PIN, FB_DISPLAY_ON_VALUE);
+ }
+ if(FB_LCD_STANDBY_PIN != INVALID_GPIO)
+ {
+ gpio_direction_output(FB_LCD_STANDBY_PIN, 0);
+ gpio_set_value(FB_LCD_STANDBY_PIN, FB_LCD_STANDBY_VALUE);
+ }
+}
+
+int rk29_fb_io_disable(void)
+{
+ if(FB_DISPLAY_ON_PIN != INVALID_GPIO)
+ {
+ gpio_direction_output(FB_DISPLAY_ON_PIN, 0);
+ gpio_set_value(FB_DISPLAY_ON_PIN, !FB_DISPLAY_ON_VALUE);
+ }
+ if(FB_LCD_STANDBY_PIN != INVALID_GPIO)
+ {
+ gpio_direction_output(FB_LCD_STANDBY_PIN, 0);
+ gpio_set_value(FB_LCD_STANDBY_PIN, !FB_LCD_STANDBY_VALUE);
+ }
+}
static int rk29_fb_io_init(struct rk29_fb_setting_info *fb_setting)
{
gpio_direction_output(FB_LCD_CABC_EN_PIN, 0);
gpio_set_value(FB_LCD_CABC_EN_PIN, GPIO_LOW);
}
+
+ rk29_fb_io_enable(); //enable it
return ret;
}
+
static struct rk29fb_info rk29_fb_info = {
.fb_id = FB_ID,
- .disp_on_pin = FB_DISPLAY_ON_PIN,
- .disp_on_value = FB_DISPLAY_ON_VALUE,
- .standby_pin = FB_LCD_STANDBY_PIN,
- .standby_value = FB_LCD_STANDBY_VALUE,
.mcu_fmk_pin = FB_MCU_FMK_PIN,
.lcd_info = &rk29_lcd_info,
.io_init = rk29_fb_io_init,
+ .io_enable = rk29_fb_io_enable,
+ .io_disable = rk29_fb_io_disable,
};
/* rk29 fb resource */
#define PWM_GPIO RK29_PIN1_PB5
#define PWM_EFFECT_VALUE 1
-//#define LCD_DISP_ON_PIN
+#define LCD_DISP_ON_PIN
#ifdef LCD_DISP_ON_PIN
-#define BL_EN_MUX_NAME GPIOF34_UART3_SEL_NAME
-#define BL_EN_MUX_MODE IOMUXB_GPIO1_B34
+//#define BL_EN_MUX_NAME GPIOF34_UART3_SEL_NAME
+//#define BL_EN_MUX_MODE IOMUXB_GPIO1_B34
-#define BL_EN_PIN GPIO0L_GPIO0A5
+#define BL_EN_PIN RK29_PIN6_PD0
#define BL_EN_VALUE GPIO_HIGH
#endif
static int rk29_backlight_io_init(void)
rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
#ifdef LCD_DISP_ON_PIN
- rk29_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
+ // rk29_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
ret = gpio_request(BL_EN_PIN, NULL);
if(ret != 0)
gpio_free(BL_EN_PIN);
#endif
rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
+
return ret;
}
return -1;
}
gpio_direction_output(PWM_GPIO, GPIO_LOW);
+ #ifdef LCD_DISP_ON_PIN
+ gpio_direction_output(BL_EN_PIN, 0);
+ gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
+ #endif
return ret;
}
{
gpio_free(PWM_GPIO);
rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
+
+ #ifdef LCD_DISP_ON_PIN
+ msleep(30);
+ gpio_direction_output(BL_EN_PIN, 1);
+ gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
+ #endif
return 0;
}
#endif
static struct wake_lock idlelock; /* only for fb */
-void set_lcd_pin(struct platform_device *pdev, int enable)
-{
- struct rk29fb_info *mach_info = pdev->dev.platform_data;
-
- unsigned display_on = mach_info->disp_on_pin;
- unsigned lcd_standby = mach_info->standby_pin;
-
- int display_on_pol = mach_info->disp_on_value;
- int lcd_standby_pol = mach_info->standby_value;
-
- fbprintk(">>>>>> %s : %s \n", __FILE__, __FUNCTION__);
- fbprintk(">>>>>> display_on(%d) = %d \n", display_on, enable ? display_on_pol : !display_on_pol);
- fbprintk(">>>>>> lcd_standby(%d) = %d \n", lcd_standby, enable ? lcd_standby_pol : !lcd_standby_pol);
-
- // set display_on
-
- if(display_on != INVALID_GPIO)
- {
- gpio_direction_output(display_on, 0);
- gpio_set_value(display_on, enable ? display_on_pol : !display_on_pol);
- }
- if(lcd_standby != INVALID_GPIO)
- {
- gpio_direction_output(lcd_standby, 0);
- gpio_set_value(lcd_standby, enable ? lcd_standby_pol : !lcd_standby_pol);
- }
-}
-
int mcu_do_refresh(struct rk29fb_inf *inf)
{
if(inf->mcu_stopflush) return 0;
{
struct rk29fb_inf *inf = platform_get_drvdata(g_pdev);
// struct rk29fb_info *mach_info = g_pdev->dev.platform_data;
+ struct rk29fb_info *mach_info = g_pdev->dev.platform_data;
memcpy(&inf->panel2_info, screen, sizeof( struct rk29fb_screen ));
if(inf->cur_screen->standby) inf->cur_screen->standby(1);
// operate the display_on pin to power down the lcd
- set_lcd_pin(g_pdev, (enable==0));
-
+
+ if(enable && mach_info->io_disable)mach_info->io_disable(); //close lcd out
+ else if (mach_info->io_enable)mach_info->io_enable(); //open lcd out
+
load_screen(inf->fb0, 0);
mcu_refresh(inf);
early_suspend);
struct rk29fb_inf *inf = info->inf;
+ struct rk29fb_info *mach_info = g_pdev->dev.platform_data;
fbprintk(">>>>>> %s : %s\n", __FILE__, __FUNCTION__);
return;
}
- if(inf->cur_screen != &inf->panel2_info) // close lcd pwr when output screen is lcd
- set_lcd_pin(g_pdev, 0);
+ if((inf->cur_screen != &inf->panel2_info) && mach_info->io_disable) // close lcd pwr when output screen is lcd
+ mach_info->io_disable(); //close lcd out
if(inf->cur_screen->standby)
{
struct rk29fb_inf *inf = info->inf;
struct rk29fb_screen *screen = inf->cur_screen;
+ struct rk29fb_info *mach_info = g_pdev->dev.platform_data;
fbprintk(">>>>>> %s : %s\n", __FILE__, __FUNCTION__);
if(!inf) {
fbprintk(">>>>>> power on the screen! \n");
inf->cur_screen->standby(0);
}
- msleep(100);
- if(inf->cur_screen != &inf->panel2_info) // open lcd pwr when output screen is lcd
- set_lcd_pin(g_pdev, 1);
- memcpy((u8*)inf->preg, (u8*)&inf->regbak, 0xa4); //resume reg
+ msleep(10);
+ memcpy((u8*)inf->preg, (u8*)&inf->regbak, 0xa4); //resume reg
+ msleep(40);
+
+ if((inf->cur_screen != &inf->panel2_info) && mach_info->io_enable) // open lcd pwr when output screen is lcd
+ mach_info->io_enable(); //close lcd out
+
}
static struct suspend_info suspend_info = {
mach_info->io_init(&fb_setting);
}
- set_lcd_pin(pdev, 1);
+ //set_lcd_pin(pdev, 1);
mdelay(10);
g_pdev = pdev;
inf->mcu_usetimer = 1;
free_irq(gpio_to_irq(mach_info->mcu_fmk_pin), pdev);
}
- set_lcd_pin(pdev, 0);
+ if(mach_info->io_disable)
+ mach_info->io_disable(); //close lcd out
// blank the lcdc
if(inf->fb1)
static void rk29fb_shutdown(struct platform_device *pdev)
{
struct rk29fb_inf *inf = platform_get_drvdata(pdev);
+ struct rk29fb_info *mach_info = pdev->dev.platform_data;;
fbprintk("----------------------------rk29fb_shutdown----------------------------\n");
- set_lcd_pin(pdev, 0);
+ if(mach_info->io_disable)
+ mach_info->io_disable(); //close lcd out
+
if(!inf->in_suspend)
{
LcdMskReg(inf, DSP_CTRL1, m_BLANK_MODE , v_BLANK_MODE(1));