mirror of
https://github.com/hardkernel/kernel_common_drivers.git
synced 2026-06-25 12:03:48 +09:00
ldim: add fw iparam [1/1]
PD#SWPL-179609 Problem: miss fw iparam Solution: add fw iparam Verify: t5m Change-Id: I8c7663b75173cea55117b69cf9ebabab745b6f43 Signed-off-by: donghui.wang <donghui.wang@amlogic.com>
This commit is contained in:
committed by
gerrit autosubmit
parent
80c4c64863
commit
ed7fe68586
@@ -666,7 +666,7 @@ static ssize_t ldim_attr_store(struct class *cla, struct class_attribute *attr,
|
||||
|
||||
ldim_drv->level_idx = (unsigned char)val1;
|
||||
|
||||
fw->fw_ctrl &= ~0xf;
|
||||
fw->fw_ctrl &= ~FW_CTRL_LEVEL_IDX;
|
||||
fw->fw_ctrl |= ldim_drv->level_idx;
|
||||
|
||||
fw_pq = ldim_pq.pqdata[ldim_drv->level_idx];
|
||||
@@ -1089,6 +1089,24 @@ static ssize_t ldim_debug_store(struct class *class, struct class_attribute *att
|
||||
ldim_time_print(ldim_drv->arithmetic_time);
|
||||
pr_info("xfer_time:\n");
|
||||
ldim_time_print(ldim_drv->xfer_time);
|
||||
} else if (!strcmp(parm[0], "fw_iparam")) {
|
||||
if (!fw->iparam)
|
||||
goto ldim_debug_store_err;
|
||||
if (parm[2]) {
|
||||
if (kstrtouint(parm[1], 0, &temp) < 0)
|
||||
goto ldim_debug_store_err;
|
||||
if (kstrtouint(parm[2], 0, &val) < 0)
|
||||
goto ldim_debug_store_err;
|
||||
fw->iparam[temp] = val;
|
||||
}
|
||||
for (i = 0; i < FW_IPARAM_LEN; i++)
|
||||
pr_info("iparam[%d]: 0x%x\n", i, fw->iparam[i]);
|
||||
} else if (!strcmp(parm[0], "fw_oparam")) {
|
||||
if (!fw->oparam)
|
||||
goto ldim_debug_store_err;
|
||||
|
||||
for (i = 0; i < FW_IPARAM_LEN; i++)
|
||||
pr_info("oparam[%d]:0x%x\n", i, fw->oparam[i]);
|
||||
} else {
|
||||
pr_info("no support cmd!!!\n");
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ static int ldim_power_on(void)
|
||||
LDIMPR("%s\n", __func__);
|
||||
|
||||
if (fw || ldim_driver.dev_drv) {
|
||||
fw->fw_ctrl |= 0x0800; // FW_CTRL_RESUME
|
||||
fw->fw_ctrl |= FW_CTRL_RESUME;
|
||||
if (ldim_driver.dev_drv->spi_sync == SPI_DMA_TRIG)
|
||||
ldim_wr_vcbus(VPP_INT_LINE_NUM, ldim_driver.dev_drv->spi_line_n);
|
||||
|
||||
@@ -311,6 +311,7 @@ static int ldim_set_level(unsigned int level)
|
||||
} else {
|
||||
level &= 0xfff;
|
||||
ldim_driver.litgain = (unsigned int)level;
|
||||
ldim_driver.fw->litgain = ldim_driver.litgain;
|
||||
ldim_driver.level_update = 1;
|
||||
}
|
||||
|
||||
@@ -344,8 +345,9 @@ static void ldim_ld_sel_ctrl(int flag)
|
||||
}
|
||||
|
||||
if (ldim_driver.fw) {
|
||||
ldim_driver.fw->fw_ctrl &= ~0x10;//bit 4
|
||||
ldim_driver.fw->fw_ctrl |= ldim_driver.ld_sel << 4;
|
||||
ldim_driver.fw->fw_ctrl &= ~FW_CTRL_LD_SEL;//bit 4
|
||||
if (ldim_driver.ld_sel)
|
||||
ldim_driver.fw->fw_ctrl |= FW_CTRL_LD_SEL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,6 +387,7 @@ static void ldim_fw_vsync_update(void)
|
||||
ldim_driver.resolution_update = 0;
|
||||
fw->res_update = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ldim_vs_arithmetic(struct aml_ldim_driver_s *ldim_drv)
|
||||
@@ -777,7 +780,7 @@ static long ldim_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
ldim_driver.fw->fw_ctrl &= ~0xf;
|
||||
ldim_driver.fw->fw_ctrl &= ~FW_CTRL_LEVEL_IDX;
|
||||
ldim_driver.fw->fw_ctrl |= ldim_driver.level_idx;
|
||||
|
||||
fw_pq = ldim_pq.pqdata[ldim_driver.level_idx];
|
||||
@@ -852,7 +855,7 @@ static long ldim_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||
vfree(bl_matrix);
|
||||
return -EFAULT;
|
||||
}
|
||||
fw->fw_ctrl |= 0x1000;//FW_CTRL_BYPASS_REMAP_BL
|
||||
fw->fw_ctrl |= FW_CTRL_BYPASS_REMAP_BL;
|
||||
if (fw->fw_rmem_duty_set)
|
||||
fw->fw_rmem_duty_set(bl_matrix);
|
||||
vfree(bl_matrix);
|
||||
@@ -1050,6 +1053,7 @@ static int aml_ldim_malloc(struct platform_device *pdev, struct ldim_drv_data_s
|
||||
unsigned int zone_num = row * col;
|
||||
unsigned int mem_size;
|
||||
int i, ret = 0;
|
||||
struct ldim_fw_s *fw = aml_ldim_get_fw();
|
||||
struct ldim_fw_custom_s *fw_cus = aml_ldim_get_fw_cus();
|
||||
|
||||
/* init reserved memory */
|
||||
@@ -1099,8 +1103,23 @@ static int aml_ldim_malloc(struct platform_device *pdev, struct ldim_drv_data_s
|
||||
goto ldim_malloc_t7_err4;
|
||||
}
|
||||
|
||||
if (fw) {
|
||||
fw->iparam = kcalloc(FW_IPARAM_LEN, sizeof(int), GFP_KERNEL);
|
||||
if (!fw->iparam)
|
||||
goto ldim_malloc_t7_err5;
|
||||
fw->oparam = kcalloc(FW_IPARAM_LEN, sizeof(int), GFP_KERNEL);
|
||||
if (!fw->oparam)
|
||||
goto ldim_malloc_t7_err6;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
ldim_malloc_t7_err6:
|
||||
if (fw)
|
||||
kfree(fw->iparam);
|
||||
ldim_malloc_t7_err5:
|
||||
if (fw_cus)
|
||||
kfree(fw_cus->param);
|
||||
ldim_malloc_t7_err4:
|
||||
kfree(ldim_driver.test_matrix);
|
||||
ldim_malloc_t7_err3:
|
||||
|
||||
@@ -27,8 +27,9 @@
|
||||
/*20230915: add cus_fw set pq */
|
||||
/*20231108: remove ldim_off_vs_brightness */
|
||||
/*20231208: support spi dma trig interface */
|
||||
/*20240730: add fw iparam */
|
||||
|
||||
#define LDIM_DRV_VER "20231208"
|
||||
#define LDIM_DRV_VER "20240730"
|
||||
|
||||
enum spi_sync_type_e {
|
||||
SPI_SYNC = 0x00,
|
||||
@@ -43,6 +44,8 @@ enum spiout_type_e {
|
||||
SPIOUT_MAX,
|
||||
};
|
||||
|
||||
#define FW_IPARAM_LEN 16
|
||||
|
||||
#define LDIM_DBG_PR_VSYNC_ISR 0x80
|
||||
#define LDIM_DBG_PR_PWM_VS_ISR 0x40
|
||||
#define LDIM_DBG_PR_DEV_DBG_INFO 0x20
|
||||
|
||||
@@ -34,8 +34,11 @@ static struct ldim_fw_s ldim_fw = {
|
||||
.func_en = 1,
|
||||
.remap_en = 0,
|
||||
.res_update = 0,
|
||||
.fw_ctrl = 0x10,/*bit4:ld_sel*/
|
||||
.litgain = LD_DATA_MAX,
|
||||
.fw_ctrl = FW_CTRL_LD_SEL,/*bit4:ld_sel*/
|
||||
.fw_state = 0,
|
||||
.iparam = NULL,
|
||||
.oparam = NULL,
|
||||
|
||||
.bl_matrix_dbg = 0,
|
||||
.fw_hist_print = 0,
|
||||
|
||||
@@ -45,8 +45,8 @@ struct ldim_config_s {
|
||||
};
|
||||
|
||||
#define LDIM_DEV_NAME_MAX 30
|
||||
#define LDIM_INIT_ON_MAX 1000
|
||||
#define LDIM_INIT_OFF_MAX 24
|
||||
#define LDIM_INIT_ON_MAX 2000
|
||||
#define LDIM_INIT_OFF_MAX 100
|
||||
struct ldim_dev_driver_s {
|
||||
unsigned char index;
|
||||
char name[LDIM_DEV_NAME_MAX];
|
||||
|
||||
@@ -123,6 +123,26 @@ struct fw_pqdata_s {
|
||||
struct fw_pq_s pqdata[4];
|
||||
};
|
||||
|
||||
/* fw_ctrl description
|
||||
* bit31: pqbypass
|
||||
* bit30: get hist
|
||||
* bit29: bypass alg
|
||||
* bit28: bypass remap bl
|
||||
* bit27: resume
|
||||
* bit5: boost_en
|
||||
* bit4: ld sel
|
||||
* bit3--0: level_idx
|
||||
*/
|
||||
#define FW_CTRL_PQBYPASS 0x80000000
|
||||
#define FW_CTRL_GET_HIST 0x40000000
|
||||
#define FW_CTRL_BYPASS_ALG 0x20000000
|
||||
#define FW_CTRL_BYPASS_REMAP_BL 0x10000000
|
||||
#define FW_CTRL_RESUME 0x08000000
|
||||
|
||||
#define FW_CTRL_BOOST_EN 0x00000020
|
||||
#define FW_CTRL_LD_SEL 0x00000010
|
||||
#define FW_CTRL_LEVEL_IDX 0x0000000F
|
||||
|
||||
struct ldim_fw_s {
|
||||
/* header */
|
||||
unsigned int para_ver;
|
||||
@@ -138,8 +158,16 @@ struct ldim_fw_s {
|
||||
unsigned char func_en;
|
||||
unsigned char remap_en;
|
||||
unsigned char res_update;
|
||||
unsigned int litgain;
|
||||
unsigned int fw_ctrl;
|
||||
|
||||
/* fw_state description
|
||||
* bit1: boost change state
|
||||
* bit0: bbd state
|
||||
*/
|
||||
unsigned int fw_state;
|
||||
int *iparam;
|
||||
int *oparam;
|
||||
|
||||
unsigned int bl_matrix_dbg;
|
||||
unsigned char fw_hist_print;
|
||||
@@ -193,8 +221,9 @@ struct ldim_fw_custom_s {
|
||||
|
||||
/* if struct ldim_fw_s changed, FW_PARA_VER must be update */
|
||||
/*20221118 version 1*/
|
||||
/*20230915 version 2*/
|
||||
#define FW_PARA_VER 2
|
||||
/*20230915 version 2 modify interface for set pq*/
|
||||
/*20230915 version 3 add in_param, out_param*/
|
||||
#define FW_PARA_VER 3
|
||||
|
||||
struct ldim_fw_s *aml_ldim_get_fw(void);
|
||||
struct ldim_fw_custom_s *aml_ldim_get_fw_cus(void);
|
||||
|
||||
Reference in New Issue
Block a user