lcd: add tcon_status debug interface [1/1]
authorshaochan.liu <shaochan.liu@amlogic.com>
Wed, 23 Oct 2019 13:01:26 +0000 (21:01 +0800)
committerTao Zeng <tao.zeng@amlogic.com>
Thu, 24 Oct 2019 03:01:38 +0000 (20:01 -0700)
PD#TV-11404

Problem:
need tcon_status debug interface

Solution:
add tcon_status debug interface

Verify:
x301

Change-Id: If6bd857b52138faef61dc4ecef3b846af315176e
Signed-off-by: shaochan.liu <shaochan.liu@amlogic.com>
drivers/amlogic/media/vout/lcd/lcd_debug.c
drivers/amlogic/media/vout/lcd/lcd_tcon.c
include/linux/amlogic/media/vout/lcd/lcd_vout.h

index bb501a5..ddfbf6d 100644 (file)
@@ -3545,6 +3545,14 @@ static ssize_t lcd_tcon_debug_show(struct class *class,
        return sprintf(buf, "%s\n", lcd_debug_tcon_usage_str);
 }
 
+static ssize_t lcd_tcon_status_show(struct class *class,
+                                   struct class_attribute *attr, char *buf)
+{
+       struct aml_lcd_drv_s *lcd_drv = aml_lcd_get_driver();
+
+       return sprintf(buf, "%d\n", lcd_drv->tcon_status);
+}
+
 static ssize_t lcd_ttl_debug_store(struct class *class,
                struct class_attribute *attr, const char *buf, size_t count)
 {
@@ -4573,6 +4581,8 @@ static struct class_attribute lcd_debug_class_attrs_mlvds[] = {
                lcd_phy_debug_show, lcd_phy_debug_store),
        __ATTR(tcon,   0644,
                lcd_tcon_debug_show, lcd_tcon_debug_store),
+       __ATTR(tcon_status,   0644,
+              lcd_tcon_status_show, NULL),
        __ATTR(null,   0644, NULL, NULL),
 };
 
@@ -4583,6 +4593,8 @@ static struct class_attribute lcd_debug_class_attrs_p2p[] = {
                lcd_phy_debug_show, lcd_phy_debug_store),
        __ATTR(tcon,   0644,
                lcd_tcon_debug_show, lcd_tcon_debug_store),
+       __ATTR(tcon_status,   0644,
+              lcd_tcon_status_show, NULL),
        __ATTR(null,   0644, NULL, NULL),
 };
 
index 57d8fc6..e2fc83f 100644 (file)
@@ -261,6 +261,7 @@ static void lcd_tcon_chpi_bbc_init_tl1(int delay)
 
 static int lcd_tcon_enable_tl1(struct lcd_config_s *pconf)
 {
+       struct aml_lcd_drv_s *lcd_drv = aml_lcd_get_driver();
        unsigned int n = 10;
        int ret;
 
@@ -283,6 +284,11 @@ static int lcd_tcon_enable_tl1(struct lcd_config_s *pconf)
                }
        }
 
+       if (lcd_tcon_getb_byte(0x23d, 0, 1))
+               lcd_drv->tcon_status = 3;
+       else
+               lcd_drv->tcon_status = 0;
+
        /* step 3: tcon_top_output_set */
        lcd_tcon_write(TCON_OUT_CH_SEL0, 0x76543210);
        lcd_tcon_write(TCON_OUT_CH_SEL1, 0xba98);
@@ -740,7 +746,13 @@ int lcd_tcon_probe(struct aml_lcd_drv_s *lcd_drv)
        }
        if (lcd_tcon_data == NULL)
                return 0;
+       if (lcd_tcon_data->tcon_valid == 0)
+               return 0;
 
+       if (lcd_tcon_getb_byte(0x23d, 0, 1))
+               lcd_drv->tcon_status = 3;
+       else
+               lcd_drv->tcon_status = 0;
        /* init reserved memory */
        ret = of_reserved_mem_device_init(lcd_drv->dev);
        if (ret) {
index 5a978f5..fb38bf5 100644 (file)
@@ -503,6 +503,8 @@ struct aml_lcd_drv_s {
        int fr_mode;
        struct lcd_duration_s std_duration;
 
+       int tcon_status;
+
        void (*driver_init_pre)(void);
        void (*driver_disable_post)(void);
        int (*driver_init)(void);