From c6fc7404456ff42e161dbbf58efb02b5deea9e80 Mon Sep 17 00:00:00 2001 From: hang cheng Date: Mon, 15 Apr 2024 20:29:56 +0800 Subject: [PATCH] cvbs: add video mute test api [1/1] PD#SWPL-167292 Problem: need cvbs video mute api for special test Solution: add cvbs video mute api for drm: call cvbs_video_mute(true / false) to mute/unmute CVBS video output, it will keep video mute even set cvbs output again, until drm call unmute. Verify: s1a Test: CVBS video mute/unmute + hotplug hdmitx and check cvbs mute Change-Id: I5f6d5c28596f0cdf26c9356a2500b1fe8fe43fd7 Signed-off-by: hang cheng --- drivers/media/vout/cvbs/cvbs_out.c | 16 +++++++++++++++- drivers/media/vout/cvbs/cvbs_out.h | 2 ++ include/linux/amlogic/media/vout/cvbs.h | 9 +++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 include/linux/amlogic/media/vout/cvbs.h diff --git a/drivers/media/vout/cvbs/cvbs_out.c b/drivers/media/vout/cvbs/cvbs_out.c index 2e4fb1fac..6d100f7b8 100644 --- a/drivers/media/vout/cvbs/cvbs_out.c +++ b/drivers/media/vout/cvbs/cvbs_out.c @@ -62,6 +62,7 @@ #include #include #include +#include #ifdef CONFIG_AMLOGIC_VOUT_CC_BYPASS /* interrupt source */ @@ -466,6 +467,7 @@ static int cvbs_out_setmode(void) cvbs_out_reg_write(ENCI_VIDEO_EN, 0); set_vmode_clk(); ret = cvbs_out_set_venc(local_cvbs_mode); + cvbs_bist_test(cvbs_drv->video_mute ? 8 : 0, NULL); if (ret) { mutex_lock(&setmode_mutex); return -1; @@ -910,6 +912,14 @@ static void cvbs_bist_test(unsigned int bist, void *data) } } +void cvbs_video_mute(bool mute) +{ + mutex_lock(&setmode_mutex); + cvbs_bist_test(mute ? 8 : 0, NULL); + cvbs_drv->video_mute = mute; + mutex_unlock(&setmode_mutex); +} + static ssize_t aml_CVBS_attr_vdac_power_show(struct class *class, struct class_attribute *attr, char *buf) @@ -1314,6 +1324,10 @@ static void cvbs_debug_store(const char *buf) pr_info("cvbs: invalid bist\n"); goto DEBUG_END; } + if (bist == 0) + cvbs_drv->video_mute = false; + else + cvbs_drv->video_mute = true; cvbs_bist_test(bist, NULL); break; @@ -2109,7 +2123,7 @@ static int cvbsout_probe(struct platform_device *pdev) cvbs_drv->cvbs_data = (struct meson_cvbsout_data *)match->data; cvbs_log_dbg("%s, cpu_id:%d,name:%s\n", __func__, cvbs_drv->cvbs_data->cpu_id, cvbs_drv->cvbs_data->name); - + cvbs_drv->video_mute = false; if (cvbs_drv->cvbs_data->cpu_id <= CVBS_CPU_TYPE_S1A && cvbs_drv->cvbs_data->cpu_id >= CVBS_CPU_TYPE_S4) cvbsout_clktree_probe(&pdev->dev); diff --git a/drivers/media/vout/cvbs/cvbs_out.h b/drivers/media/vout/cvbs/cvbs_out.h index 13911caa0..f4255e476 100644 --- a/drivers/media/vout/cvbs/cvbs_out.h +++ b/drivers/media/vout/cvbs/cvbs_out.h @@ -116,6 +116,8 @@ struct cvbs_drv_s { /*DRM related*/ int drm_cvbs_id; + /* for external video mute */ + bool video_mute; }; static DEFINE_MUTEX(cvbs_mutex); diff --git a/include/linux/amlogic/media/vout/cvbs.h b/include/linux/amlogic/media/vout/cvbs.h new file mode 100644 index 000000000..8ce381b17 --- /dev/null +++ b/include/linux/amlogic/media/vout/cvbs.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ +/* + * Copyright (c) 2019 Amlogic, Inc. All rights reserved. + */ + +#ifndef __CVBS_H__ +#define __CVBS_H__ +void cvbs_video_mute(bool mute); +#endif