tvafe: add control for tvconfig snow config [1/1]

PD#SWPL-5985

Problem:
display snow when snow config disabled

Solution:
add control for tvconfig snow config

Verify:
verify it on x301

Change-Id: I3466efc98577f2403f3a6cd638ad7dbf70ce34dc
Signed-off-by: Nian Jing <nian.jing@amlogic.com>
This commit is contained in:
Nian Jing
2019-03-15 19:20:40 +08:00
committed by Tao Zeng
parent 9a8f8ca251
commit 8adc2420fa
5 changed files with 52 additions and 5 deletions

View File

@@ -101,6 +101,8 @@ static int cutwindow_val_h_level2 = 18;
static int cutwindow_val_h_level3 = 20;
static int cutwindow_val_h_level4 = 62;/*48-->62 for ntsc-m*/
/*tvconfig snow config*/
static bool snow_cfg;
/*1: snow function on;*/
/*0: off snow function*/
bool tvafe_snow_function_flag;
@@ -822,6 +824,18 @@ static bool tvafe_cvbs_get_secam_phase(struct tvin_frontend_s *fe)
}
bool tvafe_get_snow_cfg(void)
{
return snow_cfg;
}
EXPORT_SYMBOL(tvafe_get_snow_cfg);
void tvafe_set_snow_cfg(bool cfg)
{
snow_cfg = cfg;
}
EXPORT_SYMBOL(tvafe_set_snow_cfg);
/**check frame skip,only for av input*/
static bool tvafe_cvbs_check_frame_skip(struct tvin_frontend_s *fe)
{
@@ -892,6 +906,7 @@ static long tvafe_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
long ret = 0;
unsigned int snowcfg = 0;
void __user *argp = (void __user *)arg;
struct tvafe_dev_s *devp = file->private_data;
struct tvafe_info_s *tvafe = &devp->tvafe;
@@ -907,8 +922,8 @@ static long tvafe_ioctl(struct file *file,
return -EPERM;
mutex_lock(&devp->afe_mutex);
if (!(devp->flags & TVAFE_FLAG_DEV_OPENED)) {
if (!(devp->flags & TVAFE_FLAG_DEV_OPENED) &&
cmd != TVIN_IOC_S_AFE_SONWCFG) {
tvafe_pr_info("%s, tvafe device is disable, ignore the command %d\n",
__func__, cmd);
mutex_unlock(&devp->afe_mutex);
@@ -936,6 +951,20 @@ static long tvafe_ioctl(struct file *file,
break;
}
case TVIN_IOC_S_AFE_SONWCFG:
/*tl1/txhd tvconfig snow en/disable*/
if (copy_from_user(&snowcfg, argp,
sizeof(unsigned int))) {
tvafe_pr_info("snowcfg: get param err\n");
ret = -EINVAL;
break;
}
if (snowcfg == 1)
tvafe_set_snow_cfg(true);
else
tvafe_set_snow_cfg(false);
tvafe_pr_info("tvconfig snow:%d\n", snow_cfg);
break;
case TVIN_IOC_S_AFE_SONWON:
devp->flags |= TVAFE_FLAG_DEV_SNOW_FLAG;
tvafe_snow_function_flag = true;

View File

@@ -32,7 +32,7 @@
/* ************************************************* */
/* *** macro definitions ********************************************* */
/* *********************************************************** */
#define TVAFE_VER "Ref.2018/06/27"
#define TVAFE_VER "Ref.2019/03/18"
/* used to set the flag of tvafe_dev_s */
#define TVAFE_FLAG_DEV_OPENED 0x00000010
@@ -94,6 +94,9 @@ struct tvafe_dev_s {
unsigned int sizeof_tvafe_dev_s;
};
bool tvafe_get_snow_cfg(void);
void tvafe_set_snow_cfg(bool cfg);
typedef int (*hook_func_t)(void);
extern void aml_fe_hook_cvd(hook_func_t atv_mode,
hook_func_t cvd_hv_lock, hook_func_t get_fmt);

View File

@@ -27,6 +27,7 @@
#include <linux/amlogic/media/frame_provider/tvin/tvin.h>
#include "../tvin_global.h"
#include "../tvin_format_table.h"
#include "tvafe.h"
#include "tvafe_regs.h"
#include "tvafe_cvd.h"
#include "tvafe_debug.h"
@@ -418,8 +419,9 @@ static void tvafe_cvd2_write_mode_reg(struct tvafe_cvd2_s *cvd2,
}
/*setting for txhd snow*/
if (tvafe_cpu_type() == CPU_TYPE_TXHD ||
tvafe_cpu_type() == CPU_TYPE_TL1) {
if (tvafe_get_snow_cfg() &&
(tvafe_cpu_type() == CPU_TYPE_TXHD ||
tvafe_cpu_type() == CPU_TYPE_TL1)) {
W_APB_BIT(CVD2_OUTPUT_CONTROL, 3, 5, 2);
W_APB_REG(ACD_REG_6C, 0x80500000);
}

View File

@@ -256,6 +256,18 @@ static ssize_t tvafe_store(struct device *dev,
}
} else if (!strncmp(buff, "afe_ver", strlen("afe_ver"))) {
tvafe_pr_info("tvafe version : %s\n", TVAFE_VER);
} else if (!strncmp(buff, "snowcfg", strlen("snowcfg"))) {
if (kstrtoul(parm[1], 10, &val) < 0) {
kfree(buf_orig);
return -EINVAL;
}
if (val) {
tvafe_set_snow_cfg(true);
tvafe_pr_info("[tvafe..]hadware snow cfg en\n");
} else {
tvafe_set_snow_cfg(false);
tvafe_pr_info("[tvafe..]hadware snow cfg dis\n");
}
} else if (!strncmp(buff, "snowon", strlen("snowon"))) {
if (kstrtoul(parm[1], 10, &val) < 0) {
kfree(buf_orig);

View File

@@ -465,6 +465,7 @@ struct tvafe_pin_mux_s {
#define TVIN_IOC_G_VDIN_HIST _IOW(_TM_T, 0x24, struct vdin_hist_s)
#define TVIN_IOC_S_VDIN_V4L2START _IOW(_TM_T, 0x25, struct vdin_v4l2_param_s)
#define TVIN_IOC_S_VDIN_V4L2STOP _IO(_TM_T, 0x26)
#define TVIN_IOC_S_AFE_SONWCFG _IOW(_TM_T, 0x27, unsigned int)
/*
*function defined applied for other driver