From 1d67f599378a7d57cd09f1284c9ae0bb4d7ff24f Mon Sep 17 00:00:00 2001 From: Yi Zhou Date: Fri, 12 Apr 2019 21:04:03 +0800 Subject: [PATCH] dv: add polling interface for systemcontrol [1/1] PD#SWPL-6338 Problem: add polling interface for systemcontrol Solution: add polling interface for systemcontrol Verify: tm2 Change-Id: I1a0a9a3028592ee0df77b33c9c617cbdd9b07d70 Signed-off-by: Yi Zhou --- .../enhancement/amdolby_vision/amdolby_vision.c | 33 ++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c b/drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c index 1f5812d..a32dec5 100644 --- a/drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c +++ b/drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c @@ -41,6 +41,8 @@ #include #include #include +#include +#include #include "amdolby_vision.h" #include @@ -69,6 +71,7 @@ struct amdolby_vision_dev_s { dev_t devno; struct device *dev; struct class *clsp; + wait_queue_head_t dv_queue; }; static struct amdolby_vision_dev_s amdolby_vision_dev; struct dv_device_data_s dv_meson_dev; @@ -377,7 +380,7 @@ uint16_t L2PQ_500_4000[] = { static uint32_t tv_max_lin = 200; static uint16_t tv_max_pq = 2372; -static unsigned int panel_max_lumin = 300; +static unsigned int panel_max_lumin = 350; module_param(panel_max_lumin, uint, 0664); MODULE_PARM_DESC(panel_max_lumin, "\n panel_max_lumin\n"); @@ -1207,6 +1210,24 @@ static int WRITE_VPP_DV_REG(u32 adr, const u32 val) return 0; } +void amdolby_vision_wakeup_queue(void) +{ + struct amdolby_vision_dev_s *devp = &amdolby_vision_dev; + + wake_up(&devp->dv_queue); +} + +static unsigned int amdolby_vision_poll(struct file *file, poll_table *wait) +{ + struct amdolby_vision_dev_s *devp = file->private_data; + unsigned int mask = 0; + + poll_wait(file, &devp->dv_queue, wait); + mask = (POLLIN | POLLRDNORM); + + return mask; +} + static int is_graphics_output_off(void) { if (is_meson_g12() || is_meson_tm2_stbmode()) @@ -4941,7 +4962,7 @@ static void calculate_panel_max_pq( max_lin = (max_lin / 100) * 100 + 500; max_pq = L2PQ_500_4000[(max_lin - 500) / 100]; } - pr_info("panel max lumin changed from %d(%d) to %d(%d)\n", + pr_dolby_dbg("panel max lumin changed from %d(%d) to %d(%d)\n", tv_max_lin, tv_max_pq, max_lin, max_pq); tv_max_lin = max_lin; tv_max_pq = max_pq; @@ -5276,6 +5297,7 @@ int dolby_vision_parse_metadata( h = (vf->type & VIDTYPE_COMPRESS) ? vf->compHeight : vf->height; } + if ((src_format == FORMAT_DOVI) && meta_flag_bl && meta_flag_el) { /* dovi frame no meta or meta error */ @@ -6000,6 +6022,11 @@ int dolby_vision_process(struct vframe_s *vf, u32 display_size, if (!is_meson_box() && !is_meson_txlx() && !is_meson_tm2()) return -1; + if ((dolby_vision_enable == 1) && (tv_mode == 1)) { + amdolby_vision_wakeup_queue(); + pr_dolby_dbg("wake up dv status queue\n"); + } + if (dolby_vision_flags & FLAG_CERTIFICAION) { if (vf) { h_size = (vf->type & VIDTYPE_COMPRESS) ? @@ -6673,6 +6700,7 @@ static const struct file_operations amdolby_vision_fops = { #ifdef CONFIG_COMPAT .compat_ioctl = amdolby_vision_compat_ioctl, #endif + .poll = amdolby_vision_poll, }; static void parse_param_amdolby_vision(char *buf_orig, char **parm) @@ -6919,6 +6947,7 @@ static int amdolby_vision_probe(struct platform_device *pdev) } dolby_vision_init_receiver(pdev); + init_waitqueue_head(&devp->dv_queue); pr_info("%s: ok\n", __func__); return 0; -- 2.7.4