From 4e00cc84f23d629915ee654e2413f28af2b9e02f Mon Sep 17 00:00:00 2001 From: "shaochan.liu" Date: Wed, 23 Oct 2019 21:01:26 +0800 Subject: [PATCH] lcd: add tcon_status debug interface [1/1] 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 --- drivers/amlogic/media/vout/lcd/lcd_debug.c | 12 ++++++++++++ drivers/amlogic/media/vout/lcd/lcd_tcon.c | 12 ++++++++++++ include/linux/amlogic/media/vout/lcd/lcd_vout.h | 2 ++ 3 files changed, 26 insertions(+) diff --git a/drivers/amlogic/media/vout/lcd/lcd_debug.c b/drivers/amlogic/media/vout/lcd/lcd_debug.c index bb501a5..ddfbf6d 100644 --- a/drivers/amlogic/media/vout/lcd/lcd_debug.c +++ b/drivers/amlogic/media/vout/lcd/lcd_debug.c @@ -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), }; diff --git a/drivers/amlogic/media/vout/lcd/lcd_tcon.c b/drivers/amlogic/media/vout/lcd/lcd_tcon.c index 57d8fc6..e2fc83f 100644 --- a/drivers/amlogic/media/vout/lcd/lcd_tcon.c +++ b/drivers/amlogic/media/vout/lcd/lcd_tcon.c @@ -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) { diff --git a/include/linux/amlogic/media/vout/lcd/lcd_vout.h b/include/linux/amlogic/media/vout/lcd/lcd_vout.h index 5a978f52..fb38bf5 100644 --- a/include/linux/amlogic/media/vout/lcd/lcd_vout.h +++ b/include/linux/amlogic/media/vout/lcd/lcd_vout.h @@ -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); -- 2.7.4