int ccorr_coef_interface(unsigned int ccorr_coef_ref[3][3], void *handle) { int y, x; DISP_CCORR_COEF_T *ccorr; if (g_disp_ccorr_coef[DISP_CCORR0] == NULL) { g_disp_ccorr_coef[DISP_CCORR0] = kmalloc(sizeof(DISP_CCORR_COEF_T), GFP_KERNEL); if (g_disp_ccorr_coef[DISP_CCORR0] == NULL) { CCORR_ERR("disp_ccorr_set_coef: no memory\n"); return -EFAULT; } CCORR_DBG("ccorr_interface_for_color:allocate coef buffer"); ccorr = g_disp_ccorr_coef[DISP_CCORR0]; } else { ccorr = g_disp_ccorr_coef[DISP_CCORR0]; } for (y = 0; y < 3; y += 1) for (x = 0; x < 3; x += 1) ccorr->coef[y][x] = ccorr_coef_ref[y][x]; CCORR_DBG("== CCORR Coefficient =="); CCORR_DBG("%4d %4d %4d", ccorr->coef[0][0], ccorr->coef[0][1], ccorr->coef[0][2]); CCORR_DBG("%4d %4d %4d", ccorr->coef[1][0], ccorr->coef[1][1], ccorr->coef[1][2]); CCORR_DBG("%4d %4d %4d", ccorr->coef[2][0], ccorr->coef[2][1], ccorr->coef[2][2]); disp_ccorr_write_coef_reg(handle, DISP_CCORR0, 1); return 0; }
static void disp_ccorr_init(disp_ccorr_id_t id, unsigned int width, unsigned int height, void *cmdq) { DISP_REG_SET(cmdq, DISP_REG_CCORR_SIZE, (width << 16) | height); #ifndef CONFIG_FPGA_EARLY_PORTING disp_ccorr_write_coef_reg(cmdq, id, 1); #else DISP_REG_SET(cmdq, DISP_REG_CCORR_EN, 1); #endif }
static int disp_ccorr_start(DISP_MODULE_ENUM module, void *cmdq) { #ifndef CONFIG_FPGA_EARLY_PORTING disp_ccorr_write_coef_reg(cmdq, 0, 1); #else DISP_REG_SET(cmdq, DISP_REG_CCORR_EN, 1); CCORR_DBG("FPGA_EARLY_PORTING"); #endif return 0; }
static int disp_ccorr_set_coef(const DISP_CCORR_COEF_T __user *user_color_corr, void *cmdq) { int ret = 0; DISP_CCORR_COEF_T *ccorr, *old_ccorr; disp_ccorr_id_t id; ccorr = kmalloc(sizeof(DISP_CCORR_COEF_T), GFP_KERNEL); if (ccorr == NULL) { pr_err("[GAMMA] disp_ccorr_set_coef: no memory\n"); return -EFAULT; } if (copy_from_user(ccorr, user_color_corr, sizeof(DISP_CCORR_COEF_T)) != 0) { ret = -EFAULT; kfree(ccorr); } else { id = ccorr->hw_id; if (0 <= id && id < DISP_CCORR_TOTAL) { mutex_lock(&g_gamma_global_lock); old_ccorr = g_disp_ccorr_coef[id]; g_disp_ccorr_coef[id] = ccorr; ret = disp_ccorr_write_coef_reg(cmdq, id, 0); mutex_unlock(&g_gamma_global_lock); if (old_ccorr != NULL) kfree(old_ccorr); disp_ccorr_trigger_refresh(id); } else { pr_err("[GAMMA] disp_ccorr_set_coef: invalid ID = %d\n", id); ret = -EFAULT; } } return ret; }
static void disp_ccorr_init(disp_ccorr_id_t id, unsigned int width, unsigned int height, void *cmdq) { disp_ccorr_write_coef_reg(cmdq, id, 1); }