osd/lut: check and clear module_param [1/1]

PD#SWPL-155851

Problem:
clear module_param

Solution:
clear module_param

Verify:
a4

Change-Id: I4d51707a401d0f631e48948958981cfad3909104
Signed-off-by: Jian Cao <jian.cao@amlogic.com>
This commit is contained in:
Jian Cao
2024-02-23 13:46:02 +00:00
parent da5316f69f
commit ec3e455ca7
7 changed files with 254 additions and 96 deletions
@@ -419,8 +419,6 @@ static void set_lut_dma_phy_addr(u32 dma_dir, u32 channel)
}
static int bit_format;
MODULE_PARM_DESC(bit_format, "\n bit_format\n");
__module_param(bit_format, uint, 0664);
static int lut_dma_enable(u32 dma_dir, u32 channel)
{
int mode = 0, channel_sel = 0;
+13 -19
View File
@@ -12,6 +12,7 @@
#include "osd_io.h"
#include "osd_backup.h"
#include "osd_hw.h"
#include "osd_fb.h"
const u16 osd_reg_backup[OSD_REG_BACKUP_COUNT] = {
0x1a10, 0x1a13,
@@ -54,34 +55,27 @@ const u16 mali_afbc2_reg_t7_backup[MALI_AFBC2_REG_T7_BACKUP_COUNT] = {
0x3c77, 0x3c78, 0x3c79, 0x3c7a, 0x3c7b, 0x3c7c
};
//static u32 osd_backup_count = OSD_VALUE_COUNT;
//static u32 afbc_backup_count = OSD_AFBC_VALUE_COUNT;
//static u32 mali_afbc_backup_count = MALI_AFBC_REG_BACKUP_COUNT;
//static u32 mali_afbc_t7_backup_count = MALI_AFBC_REG_T7_BACKUP_COUNT;
//static u32 mali_afbc1_t7_backup_count = MALI_AFBC1_REG_T7_BACKUP_COUNT;
//static u32 mali_afbc2_t7_backup_count = MALI_AFBC2_REG_T7_BACKUP_COUNT;
u32 osd_backup[OSD_VALUE_COUNT];
u32 osd_afbc_backup[OSD_AFBC_VALUE_COUNT];
u32 mali_afbc_backup[MALI_AFBC_VALUE_COUNT];
u32 mali_afbc_t7_backup[MALI_AFBC_VALUE_T7_COUNT];
u32 mali_afbc1_t7_backup[MALI_AFBC1_VALUE_T7_COUNT];
u32 mali_afbc2_t7_backup[MALI_AFBC2_VALUE_T7_COUNT];
__module_param_array(osd_backup, uint, &osd_backup_count, 0444);
MODULE_PARM_DESC(osd_backup, "\n osd register backup\n");
__module_param_array(osd_afbc_backup, uint, &afbc_backup_count, 0444);
MODULE_PARM_DESC(osd_afbc_backup, "\n osd afbc register backup\n");
__module_param_array(mali_afbc_backup, uint, &mali_afbc_backup_count, 0444);
MODULE_PARM_DESC(mali_afbc_backup, "\n mali afbc register backup\n");
__module_param_array(mali_afbc_t7_backup, uint, &mali_afbc_t7_backup_count, 0444);
MODULE_PARM_DESC(mali_afbc_t7_backup, "\n mali afbc register t7 backup\n");
__module_param_array(mali_afbc1_t7_backup, uint, &mali_afbc1_t7_backup_count, 0444);
MODULE_PARM_DESC(mali_afbc1_t7_backup, "\n mali afbc1 register t7 backup\n");
__module_param_array(mali_afbc2_t7_backup, uint, &mali_afbc2_t7_backup_count, 0444);
MODULE_PARM_DESC(mali_afbc2_t7_backup, "\n mali afbc2 register t7 backup\n");
/* 0: not backup */
static u32 backup_enable;
__module_param(backup_enable, uint, 0644);
/* module parameter for debugging */
struct osd_module_debug_s debug_osd_backup[7] = {
{"osd_backup", osd_backup, OSD_VALUE_COUNT, 1},
{"osd_afbc_backup", osd_afbc_backup, OSD_AFBC_VALUE_COUNT, 1},
{"mali_afbc_backup", mali_afbc_backup, MALI_AFBC_REG_BACKUP_COUNT, 1},
{"mali_afbc_t7_backup", mali_afbc_t7_backup, MALI_AFBC_REG_T7_BACKUP_COUNT, 1},
{"mali_afbc1_t7_backup", mali_afbc1_t7_backup, MALI_AFBC1_REG_T7_BACKUP_COUNT, 1},
{"mali_afbc2_t7_backup", mali_afbc2_t7_backup, MALI_AFBC2_REG_T7_BACKUP_COUNT, 1},
{"backup_enable", &backup_enable, 1, 1}
};
void update_backup_reg(u32 addr, u32 value)
{
u32 base = OSD1_AFBCD_ENABLE;
+188
View File
@@ -4150,6 +4150,192 @@ static ssize_t show_file_info(struct device *device,
osd_hw.file_info_debug[3].fput_count);
}
static struct osd_module_debug_s *search_module_param(char *name)
{
struct osd_module_debug_s *find_param = NULL;
int i;
if (!name) {
pr_info("%s, NULL param\n", __func__);
return NULL;
}
for (i = 0; i < ARRAY_SIZE(debug_osd_backup); i++) {
if (!strncmp(name, debug_osd_backup[i].parm_name, 32))
find_param = &debug_osd_backup[i];
}
for (i = 0; i < ARRAY_SIZE(debug_osd_rdma); i++) {
if (!strncmp(name, debug_osd_rdma[i].parm_name, 32))
find_param = &debug_osd_rdma[i];
}
for (i = 0; i < ARRAY_SIZE(debug_osd_hw); i++) {
if (!strncmp(name, debug_osd_hw[i].parm_name, 32))
find_param = &debug_osd_hw[i];
}
return find_param;
}
static ssize_t show_module_debug(struct device *device,
struct device_attribute *attr,
char *buf)
{
int i, j;
ssize_t len = 0;
char *sysfs_node = "/sys/class/graphics/fb0/module_debug";
char *buff = NULL;
buff = kmalloc(256, GFP_KERNEL);
if (!buff)
return -ENOMEM;
pr_info("usage:\n");
pr_info("--- if reading module parameters ---\n");
for (i = 0; i < ARRAY_SIZE(debug_osd_backup); i++) {
pr_info("echo %s > %s\n",
debug_osd_backup[i].parm_name, sysfs_node);
}
for (i = 0; i < ARRAY_SIZE(debug_osd_rdma); i++) {
pr_info("echo %s > %s\n",
debug_osd_rdma[i].parm_name, sysfs_node);
}
for (i = 0; i < ARRAY_SIZE(debug_osd_hw); i++) {
pr_info("echo %s > %s\n",
(debug_osd_hw)[i].parm_name, sysfs_node);
}
pr_info("--- if writing module parameters ---\n");
for (i = 0; i < ARRAY_SIZE(debug_osd_backup); i++) {
if (debug_osd_backup[i].read_only)
continue;
len = sprintf(buff, "echo %s ",
debug_osd_backup[i].parm_name);
for (j = 0; j < debug_osd_backup[i].parm_cnt; j++)
len += sprintf(buff + len, "x ");
sprintf(buff + len, "> %s", sysfs_node);
pr_info("%s\n", buff);
}
for (i = 0; i < ARRAY_SIZE(debug_osd_rdma); i++) {
if (debug_osd_rdma[i].read_only)
continue;
len = sprintf(buff, "echo %s ",
(debug_osd_rdma)[i].parm_name);
for (j = 0; j < (debug_osd_rdma)[i].parm_cnt; j++)
len += sprintf(buff + len, "x ");
sprintf(buff + len, "> %s", sysfs_node);
pr_info("%s\n", buff);
}
for (i = 0; i < ARRAY_SIZE(debug_osd_hw); i++) {
if (debug_osd_hw[i].read_only)
continue;
len = sprintf(buff, "echo %s ",
debug_osd_hw[i].parm_name);
for (j = 0; j < debug_osd_hw[i].parm_cnt; j++)
len += sprintf(buff + len, "x ");
sprintf(buff + len, "> %s", sysfs_node);
pr_info("%s\n", buff);
}
kfree(buff);
return 0;
}
static int parse_param_ex(char *buf_orig, char **parm, int max_cnt)
{
char *ps, *token;
unsigned int n = 0;
char delim1[3] = " ";
char delim2[2] = "\n";
ps = buf_orig;
strcat(delim1, delim2);
while (1) {
token = strsep(&ps, delim1);
if (!token)
break;
if (*token == '\0')
continue;
if (n >= max_cnt) {
pr_info("%s, out of range\n", __func__);
return n;
}
parm[n++] = token;
}
return n;
}
static ssize_t store_module_debug(struct device *device,
struct device_attribute *attr,
const char *buf, size_t count)
{
char *buf_orig, *parm[32];
unsigned int i, parm_cnt, *parm_value, parse_cnt;
struct osd_module_debug_s *find_param = NULL;
int write = 0; /* 0: read 1: write*/
int len = 0;
char *buff = NULL;
ssize_t ret = count;
if (!buf)
return count;
buff = kmalloc(256, GFP_KERNEL);
if (!buff)
return -ENOMEM;
memset(parm, 0, sizeof(parm));
buf_orig = kstrdup(buf, GFP_KERNEL);
if (!buf_orig) {
ret = -ENOMEM;
goto free2;
}
parse_cnt = parse_param_ex(buf_orig, (char **)&parm, 32);
if (!parse_cnt) {
pr_info("need to input parameter(s)\n");
goto free1;
}
if (parse_cnt > 1)
write = 1;
find_param = search_module_param(parm[0]);
if (!find_param) {
pr_info("cannot find %s\n", parm[0]);
goto free1;
}
parm_cnt = find_param->parm_cnt;
parm_value = find_param->parm_value;
len = sprintf(buff, "%s ", parm[0]);
for (i = 0; i < parm_cnt; i++)
len += sprintf(buff + len, "%d ", parm_value[i]);
if (write) {
if (find_param->read_only) {
pr_info("%s is read only\n", parm[0]);
goto free1;
}
if ((parse_cnt - 1) < parm_cnt) {
pr_info("need to input %s and %d value(s)\n",
find_param->parm_name, parm_cnt);
goto free1;
}
len += sprintf(buff + len, "-> ");
for (i = 1; i <= find_param->parm_cnt; i++) {
if (kstrtou32(parm[i], 0, &parm_value[i - 1]) < 0) {
ret = -EINVAL;
goto free1;
}
len += sprintf(buff + len, "%d ", parm_value[i - 1]);
}
}
pr_info("%s\n", buff);
free1:
kfree(buf_orig);
free2:
kfree(buff);
return ret;
}
static inline int str2lower(char *str)
{
while (*str != '\0') {
@@ -4412,6 +4598,8 @@ static struct device_attribute osd_attrs[] = {
show_slice2ppc_test, store_slice2ppc_test),
__ATTR(rdma_enable, 0644,
show_rdma_enable, store_rdma_enable),
__ATTR(module_debug, 0644,
show_module_debug, store_module_debug),
};
static struct device_attribute osd_attrs_viu2[] = {
+11
View File
@@ -49,6 +49,13 @@ struct fb_dmabuf_export {
__u32 flags;
};
struct osd_module_debug_s {
char parm_name[32];
u32 *parm_value;
u32 parm_cnt;
u32 read_only; /* permission 0:read+write 1:read only */
};
#define OSD_INVALID_INFO 0xffffffff
#define OSD_FIRST_GROUP_START 1
#define OSD_SECOND_GROUP_START 4
@@ -69,4 +76,8 @@ extern unsigned int osd_game_mode[];
extern unsigned int osd_pi_debug, osd_pi_enable;
extern unsigned int osd_slice2ppc_debug, osd_slice2ppc_enable;
extern struct mutex preblend_lock;
extern struct osd_module_debug_s debug_osd_backup[7];
extern struct osd_module_debug_s debug_osd_rdma[14];
extern struct osd_module_debug_s debug_osd_hw[15];
#endif
+19 -36
View File
@@ -1784,23 +1784,10 @@ static unsigned int osd_h_filter_mode = 1;
#define BYTE_32_ALIGNED(x) (((x) + 31) & ~31)
#define BYTE_16_ALIGNED(x) (((x) + 15) & ~15)
#define BYTE_8_ALIGNED(x) (((x) + 7) & ~7)
__module_param(osd_h_filter_mode, uint, 0664);
MODULE_PARM_DESC(osd_h_filter_mode, "osd_h_filter_mode");
static unsigned int osd_v_filter_mode = 1;
__module_param(osd_v_filter_mode, uint, 0664);
MODULE_PARM_DESC(osd_v_filter_mode, "osd_v_filter_mode");
static unsigned int osd_auto_adjust_filter = 1;
__module_param(osd_auto_adjust_filter, uint, 0664);
MODULE_PARM_DESC(osd_auto_adjust_filter, "osd_auto_adjust_filter");
static int osd_logo_index = 1;
__module_param(osd_logo_index, int, 0664);
MODULE_PARM_DESC(osd_logo_index, "osd_logo_index");
__module_param(osd_afbc_dec_enable, int, 0664);
MODULE_PARM_DESC(osd_afbc_dec_enable, "osd_afbc_dec_enable");
static u32 osd_vpp_misc;
static u32 osd_vpp_misc_mask = OSD_RELATIVE_BITS;
@@ -1815,21 +1802,10 @@ static u32 osd_mali_afbcd_top_ctrl;
static u32 osd_mali_afbcd_top_ctrl_mask = 0x00ffbfff;
static u32 osd_mali_afbcd1_top_ctrl;
static u32 osd_mali_afbcd1_top_ctrl_mask = 0x00f7ffff;
__module_param(osd_vpp_misc, uint, 0444);
MODULE_PARM_DESC(osd_vpp_misc, "osd_vpp_misc");
static unsigned int rdarb_reqen_slv = 0xffff7f;
__module_param(rdarb_reqen_slv, uint, 0664);
MODULE_PARM_DESC(rdarb_reqen_slv, "rdarb_reqen_slv");
static unsigned int supsend_delay;
__module_param(supsend_delay, uint, 0664);
MODULE_PARM_DESC(supsend_delay, "supsend_delay");
int enable_vd_zorder = 1;
MODULE_PARM_DESC(enable_vd_zorder, "\n enable_vd_zorder\n");
__module_param(enable_vd_zorder, uint, 0664);
static int vsync_enter_line_max;
static int vsync_exit_line_max;
static int line_threshold = 5;
@@ -1837,18 +1813,25 @@ static int line_threshold_2 = 90;
static int vsync_threshold = 10;
static int vsync_adjust_hit;
static int cur_begin_line[VIU_COUNT];
__module_param_named(osd_vsync_enter_line_max, vsync_enter_line_max, uint, 0664);
__module_param_named(osd_vsync_exit_line_max, vsync_exit_line_max, uint, 0664);
MODULE_PARM_DESC(line_threshold, "\n line_threshold\n");
__module_param(line_threshold, uint, 0664);
MODULE_PARM_DESC(line_threshold_2, "\n line_threshold_2\n");
__module_param(line_threshold_2, uint, 0664);
MODULE_PARM_DESC(vsync_threshold, "\n vsync_threshold\n");
__module_param(vsync_threshold, uint, 0664);
MODULE_PARM_DESC(vsync_adjust_hit, "\n vsync_adjust_hit\n");
__module_param(vsync_adjust_hit, uint, 0664);
/* module parameter for debugging */
struct osd_module_debug_s debug_osd_hw[15] = {
{"osd_h_filter_mode", &osd_h_filter_mode, 1, 0},
{"osd_v_filter_mode", &osd_v_filter_mode, 1, 0},
{"osd_auto_adjust_filter", &osd_auto_adjust_filter, 1, 0},
{"osd_logo_index", &osd_logo_index, 1, 0},
{"osd_afbc_dec_enable", &osd_afbc_dec_enable, 1, 0},
{"osd_vpp_misc", &osd_vpp_misc, 1, 1},
{"rdarb_reqen_slv", &rdarb_reqen_slv, 1, 0},
{"supsend_delay", &supsend_delay, 1, 0},
{"enable_vd_zorder", &enable_vd_zorder, 1, 0},
{"vsync_enter_line_max", &vsync_enter_line_max, 1, 0},
{"vsync_exit_line_max", &vsync_exit_line_max, 1, 0},
{"line_threshold", &line_threshold, 1, 0},
{"line_threshold_2", &line_threshold_2, 1, 0},
{"vsync_threshold", &vsync_threshold, 1, 0},
{"vsync_adjust_hit", &vsync_adjust_hit, 1, 0}
};
static unsigned int osd_filter_coefs_bicubic_sharp[] = {
0x01fa008c, 0x01fa0100, 0xff7f0200, 0xfe7f0300,
+21 -37
View File
@@ -38,6 +38,7 @@
#include "osd_hw.h"
#include "osd_backup.h"
#include "osd_log.h"
#include "osd_fb.h"
#include <linux/amlogic/media/registers/register_map.h>
#define RDMA_TABLE_INTERNAL_COUNT 512
@@ -60,7 +61,7 @@ static bool osd_rdma_init_flag;
#define OSD_RDMA_UPDATE_RETRY_COUNT 10
static unsigned int debug_rdma_status[VPP_NUM];
static unsigned int rdma_irq_count[VPP_NUM];
//static unsigned int rdma_lost_count[VPP_NUM];
static unsigned int rdma_lost_count[VPP_NUM];
static unsigned int dump_reg_trigger;
static unsigned int rdma_recovery_count[VPP_NUM];
#ifdef OSD_RDMA_ISR
@@ -81,18 +82,10 @@ static struct rdma_table_item *rdma_temp_tbl[VPP_NUM];
static int support_64bit_addr = 1;
static struct rdma_warn_array recovery_table[WARN_TABLE];
static struct rdma_warn_array recovery_not_hit_table[WARN_TABLE];
//static uint num_reject = 2;
static int rdma_reject_cnt[2];
static int rdma_done_line[VPP_NUM];
__module_param_array(rdma_reject_cnt, uint, &num_reject, 0664);
MODULE_PARM_DESC(rdma_reject_cnt, "\n rdma_reject_cnt\n");
static int g_osd_rdma_item_count;
static int g_osd_rdma_item_count_max;
MODULE_PARM_DESC(g_osd_rdma_item_count, "\n g_osd_rdma_item_count\n");
__module_param(g_osd_rdma_item_count, uint, 0664);
MODULE_PARM_DESC(g_osd_rdma_item_count_max, "\n g_osd_rdma_item_count_max\n");
__module_param(g_osd_rdma_item_count_max, uint, 0664);
void *memcpy(void *dest, const void *src, size_t len);
@@ -1132,12 +1125,26 @@ int VSYNCOSD_IRQ_WR_MPEG_REG_VPP2(u32 addr, u32 val)
/* number lines before vsync for reset */
static unsigned int reset_line;
__module_param(reset_line, uint, 0664);
MODULE_PARM_DESC(reset_line, "reset_line");
static unsigned int disable_osd_rdma_reset;
__module_param(disable_osd_rdma_reset, uint, 0664);
MODULE_PARM_DESC(disable_osd_rdma_reset, "disable_osd_rdma_reset");
/* module parameter for debugging */
struct osd_module_debug_s debug_osd_rdma[14] = {
{"rdma_reject_cnt", rdma_reject_cnt, 2, 0},
{"g_osd_rdma_item_count", &g_osd_rdma_item_count, 1, 0},
{"g_osd_rdma_item_count_max", &g_osd_rdma_item_count_max, 1, 0},
{"reset_line", &reset_line, 1, 0},
{"disable_osd_rdma_reset", &disable_osd_rdma_reset, 1, 0},
{"item_count", item_count, VPP_NUM, 0},
// {"table_paddr", table_paddr, VPP_NUM, 0},
{"debug_rdma_status", debug_rdma_status, VPP_NUM, 0},
{"rdma_irq_count", rdma_irq_count, VPP_NUM, 0},
{"rdma_lost_count", rdma_lost_count, VPP_NUM, 0},
{"rdma_recovery_count", rdma_recovery_count, VPP_NUM, 0},
{"vsync_irq_count", vsync_irq_count, VPP_NUM, 0},
{"rdma_debug", &rdma_debug, 1, 0},
{"dump_reg_trigger", &dump_reg_trigger, 1, 0},
{"rdma_hdr_delay", &rdma_hdr_delay, 1, 0}
};
int get_rdma_irq_done_line(u32 vpp_index)
{
@@ -2368,26 +2375,3 @@ int osd_rdma_uninit(void)
return 0;
}
EXPORT_SYMBOL(osd_rdma_uninit);
//static int param_vpp_num = VPP_NUM;
__module_param_array(item_count, uint, &param_vpp_num, 0664);
MODULE_PARM_DESC(item_count, "\n item_count\n");
__module_param_array(table_paddr, ulong, &param_vpp_num, 0664);
MODULE_PARM_DESC(table_paddr, "\n table_paddr\n");
__module_param_array(debug_rdma_status, uint, &param_vpp_num, 0664);
MODULE_PARM_DESC(debug_rdma_status, "\n debug_rdma_status\n");
__module_param_array(rdma_irq_count, uint, &param_vpp_num, 0664);
MODULE_PARM_DESC(rdma_irq_count, "\n rdma_irq_count\n");
__module_param_array(rdma_lost_count, uint, &param_vpp_num, 0664);
MODULE_PARM_DESC(rdma_lost_count, "\n rdma_lost_count\n");
__module_param_array(rdma_recovery_count, uint, &param_vpp_num, 0664);
MODULE_PARM_DESC(rdma_recovery_count, "\n rdma_recovery_count\n");
__module_param_array(vsync_irq_count, uint, &param_vpp_num, 0664);
MODULE_PARM_DESC(vsync_irq_count, "\n vsync_irq_count\n");
MODULE_PARM_DESC(rdma_debug, "\n rdma_debug\n");
__module_param(rdma_debug, uint, 0664);
MODULE_PARM_DESC(dump_reg_trigger, "\n dump_reg_trigger\n");
__module_param(dump_reg_trigger, uint, 0664);
MODULE_PARM_DESC(rdma_hdr_delay, "\n rdma_hdr_delay\n");
__module_param(rdma_hdr_delay, uint, 0664);
+2 -2
View File
@@ -118,11 +118,11 @@ static struct fb_fix_screeninfo fb_def_fix = {
#ifdef SPI_DEBUG
static int spi_write_min;
__module_param(spi_write_min, int, 0664);
module_param(spi_write_min, int, 0664);
MODULE_PARM_DESC(spi_write_min, "spi_write_min");
static int spi_write_max;
__module_param(spi_write_max, int, 0664);
module_param(spi_write_max, int, 0664);
MODULE_PARM_DESC(spi_write_max, "spi_write_max");
#endif