void ccorr_test(const char *cmd, char *debug_output) { unsigned long offset; unsigned long value, mask; CCORR_DBG("ccorr_test(%s)", cmd); debug_output[0] = '\0'; if (strncmp(cmd, "set:", 4) == 0) { int count = ccorr_parse_triple(cmd + 4, &offset, &value, &mask); if (count == 3) DISP_REG_MASK(NULL, DISPSYS_CCORR_BASE + offset, value, mask); else if (count == 2) { DISP_REG_SET(NULL, DISPSYS_CCORR_BASE + offset, value); mask = 0xffffffff; } if (count >= 2) { CCORR_DBG("[+0x%031lx] = 0x%08lx(%d) & 0x%08lx", offset, value, (int)value, mask); } } else if (strncmp(cmd, "coef:", 5) == 0) { ccorr_parse_coef(cmd+5, NULL); } else if (strncmp(cmd, "dump", 4) == 0) { ccorr_dump_reg(); } else if (strncmp(cmd, "en:", 3) == 0) { int enabled = (cmd[3] == '1' ? 1 : 0); if (enabled == 1) { DISP_REG_MASK(NULL, DISPSYS_CCORR_BASE, 0x1, 0x1); DISP_REG_MASK(NULL, DISPSYS_CCORR_BASE + 0x20, 0x2, 0x3); } else { DISP_REG_MASK(NULL, DISPSYS_CCORR_BASE, 0x0, 0x1); DISP_REG_MASK(NULL, DISPSYS_CCORR_BASE + 0x20, 0x1, 0x3); } } else if (strncmp(cmd, "dbg:", 4) == 0) { corr_dbg_en = cmd[4] - '0'; corr_dbg_en = (corr_dbg_en > 1) ? 1 : corr_dbg_en; CCORR_DBG("debug log status:%d", corr_dbg_en); } else { } disp_ccorr_trigger_refresh(DISP_CCORR0); }
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; }