rk30 lcdc: display lut support
[firefly-linux-kernel-4.4.55.git] / drivers / video / rk29_fb.c
index e36f6e21eb555974ee08dbabe388848de0ebaa3e..c1d1981e871e5e8204b207f33fc6ed8fcabd2fa9 100644 (file)
@@ -50,6 +50,7 @@
 
 #include <linux/hdmi.h>
 #endif
 
 #include <mach/iomux.h>
 #include <mach/gpio.h>
@@ -61,6 +62,9 @@
 
 #include "./display/screen/screen.h"
 
+#ifdef CONFIG_MFD_RK610
+#include "./display/lcd/rk610_lcd.h"
+#endif
 #define ANDROID_USE_THREE_BUFS  0       //android use three buffers to accelerate UI display in rgb plane
 #define CURSOR_BUF_SIZE         256     //RK2818 cursor need 256B buf
 int rk29_cursor_buf[CURSOR_BUF_SIZE];
@@ -330,7 +334,15 @@ static int rk29fb_notify(struct rk29fb_inf *inf, unsigned long event)
 {
        return blocking_notifier_call_chain(&rk29fb_notifier_list, event, inf->cur_screen);
 }
+void rk29_lcd_set(bool on)
+{
+    struct rk29fb_info *mach_info = g_pdev->dev.platform_data;
+    if(on == 1 &&mach_info->io_enable)
+        mach_info->io_enable();       //open lcd out
+    else if(mach_info->io_disable)
+        mach_info->io_disable();  //close lcd out
 
+}
 int mcu_do_refresh(struct rk29fb_inf *inf)
 {
     if(inf->mcu_stopflush)  return 0;
@@ -2922,10 +2934,19 @@ int FB_Switch_Screen( struct rk29fb_screen *screen, u32 enable )
 
     if(inf->cur_screen->standby)    inf->cur_screen->standby(1);
     // operate the display_on pin to power down the lcd
-   
+#ifdef CONFIG_HDMI_DUAL_DISP
+       if(inf->panel1_info.sscreen_get!=NULL)
+       inf->panel1_info.sscreen_get(&inf->panel1_info,inf->panel2_info.hdmi_resolution);
+       else
+               printk("warnig : LCD driver do not support dual display");
+       if(inf->panel1_info.sscreen_set!=NULL)
+       inf->panel1_info.sscreen_set(&inf->panel1_info,enable);
+       else
+               printk("warnig : LCD driver do not support dual display");
+#else
     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
-    
+#endif
     load_screen(inf->fb0, 0);
        mcu_refresh(inf);
 
@@ -2933,6 +2954,7 @@ int FB_Switch_Screen( struct rk29fb_screen *screen, u32 enable )
     fb0_set_par(inf->fb0);
     LcdMskReg(inf, DSP_CTRL1, m_BLACK_MODE,  v_BLACK_MODE(0));
     LcdWrReg(inf, REG_CFG_DONE, 0x01);
+
     rk29fb_notify(inf, enable ? RK29FB_EVENT_HDMI_ON : RK29FB_EVENT_HDMI_OFF);
     return 0;
 }
@@ -3070,10 +3092,13 @@ static void rk29fb_early_suspend(struct early_suspend *h)
 #ifdef CONFIG_CLOSE_WIN1_DYNAMIC   
      cancel_delayed_work_sync(&rk29_win1_check_work);
 #endif  
-
+#ifdef CONFIG_HDMI_DUAL_DISP
+    if(mach_info->io_disable)  // close lcd pwr when output screen is lcd
+       mach_info->io_disable();  //close lcd out 
+#else
     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 
-
+#endif
        if(inf->cur_screen->standby)
        {
                fbprintk(">>>>>> power down the screen! \n");
@@ -3158,10 +3183,13 @@ static void rk29fb_early_resume(struct early_suspend *h)
     usleep_range(10*1000, 10*1000);
     memcpy((u8*)inf->preg, (u8*)&inf->regbak, 0xa4);  //resume reg
     usleep_range(40*1000, 40*1000);
-    
+    #ifdef CONFIG_HDMI_DUAL_DISP
+    if(mach_info->io_enable)  // open lcd pwr when output screen is lcd
+       mach_info->io_enable();  //close lcd out 
+    #else
     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 
-               
+    #endif
 }
 
 static struct suspend_info suspend_info = {
@@ -3204,6 +3232,7 @@ static int __devinit rk29fb_probe (struct platform_device *pdev)
    #else
     set_lcd_info(&inf->panel1_info, mach_info->lcd_info);
    #endif
+
     inf->cur_screen = &inf->panel1_info;
     screen = inf->cur_screen;
     if(SCREEN_NULL==screen->type)
@@ -3486,7 +3515,9 @@ static int __devinit rk29fb_probe (struct platform_device *pdev)
             goto release_irq;
         }
     }
-
+ #ifdef CONFIG_MFD_RK610
+    rk610_lcd_scaler_set_param(&inf->panel1_info,0);
+ #endif
 #if !defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_LOGO)
     fb0_set_par(inf->fb0);
     if (fb_prepare_logo(inf->fb0, FB_ROTATE_UR)) {