Commit ebdd1dbf authored by forum_service's avatar forum_service Committed by carbon

u-boot: weekly update 2023-09-06

Update mipi_tx
Update Jpeg driver

Change-Id: I5e1f2e64befbd52cbb45e2c235945effef136d91
parent 13bef985
......@@ -130,7 +130,7 @@ int jpeg_decoder(void *bs_addr, void *yuv_addr, int size)
int idx, ret = 0, all = 0;
mmio_write_32((void *)TOP_DDR_ADDR_MODE_REG, (1 << DAMR_REG_VD_REMAP_ADDR_39_32_OFFSET));
mmio_write_32((void *)VC_REG_BASE, (mmio_read_32(VC_REG_BASE) | (0x1f)));
mmio_write_32((void *)VC_REG_BASE, (mmio_read_32((void *)VC_REG_BASE) | (0x1f)));
#ifdef SUPPORT_INTERRUPT
request_irq(JPEG_CODEC_INTR_NUM, irq_handler_jpeg_codec, 0, "jpeg int", NULL);
......
......@@ -737,7 +737,7 @@ JpgRet JPU_DecStartOneFrame(JpgDecHandle handle, JpgDecParam *param)
JpuWriteReg(MJPEG_GBU_TT_CNT_REG + 4, 0);
JpuWriteReg(MJPEG_PIC_ERRMB_REG, 0);
val = pDecInfo->huffAcIdx << 10 | pDecInfo->huffDcIdx << 7 | pDecInfo->userHuffTab << 6;
val |= (JPU_CHECK_WRITE_RESPONSE_BVALID_SIGNAL << 2) | pDecInfo->usePartial);
val |= ((JPU_CHECK_WRITE_RESPONSE_BVALID_SIGNAL << 2) | pDecInfo->usePartial);
JpuWriteReg(MJPEG_PIC_CTRL_REG, val);
JpuWriteReg(MJPEG_PIC_SIZE_REG, (pDecInfo->alignedWidth << 16) | pDecInfo->alignedHeight);
......@@ -823,7 +823,7 @@ JpgRet JPU_DecStartOneFrame(JpgDecHandle handle, JpgDecParam *param)
val = (pDecInfo->frameIdx % (pDecInfo->numFrameBuffers / pDecInfo->bufNum));
for (i = 0; i < pDecInfo->bufNum; i++) {
addr = pDecInfo->frameBufPool[(val * pDecInfo->bufNum) + i].bufY
addr = pDecInfo->frameBufPool[(val * pDecInfo->bufNum) + i].bufY;
JpuWriteReg(MJPEG_DPB_BASE00_REG + (i * 12), addr);
addr = pDecInfo->frameBufPool[(val * pDecInfo->bufNum) + i].bufCb;
JpuWriteReg(MJPEG_DPB_BASE01_REG + (i * 12), addr);
......
......@@ -12,6 +12,8 @@
extern int sscanf(const char *str, const char *format, ...);
extern int __must_check kstrtoint(const char *s, unsigned int base, int *res);
static int FillSdramBurst(BufInfo *pBufInfo, Uint64 targetAddr,
PhysicalAddress bsBufStartAddr,
PhysicalAddress bsBufEndAddr, Uint32 size,
......@@ -947,17 +949,17 @@ int parseJpgCfgFile(ENC_CFG *pEncCfg, char *FileName)
// (444 only)
if (GetValue(Fp, "FRAME_FORMAT", sLine) == 0)
return 0;
ret = kstrtoint(sLine, 10, &pEncCfg->FrmFormat);//sscanf(sLine, "%d", &pEncCfg->FrmFormat);
pEncCfg->FrmFormat = (int)simple_strtol(sLine, NULL, 10);//sscanf(sLine, "%d", &pEncCfg->FrmFormat);
// width
if (GetValue(Fp, "PICTURE_WIDTH", sLine) == 0)
return 0;
ret = kstrtoint(sLine, 10, &pEncCfg->PicX);//sscanf(sLine, "%d", &pEncCfg->PicX);
pEncCfg->PicX = (int)simple_strtol(sLine, NULL, 10);//sscanf(sLine, "%d", &pEncCfg->PicX);
// height
if (GetValue(Fp, "PICTURE_HEIGHT", sLine) == 0)
return 0;
ret = kstrtoint(sLine, 10, &pEncCfg->PicY);//sscanf(sLine, "%d", &pEncCfg->PicY);
pEncCfg->PicY = (int)simple_strtol(sLine, NULL, 10);//sscanf(sLine, "%d", &pEncCfg->PicY);
// frame_rate
if (GetValue(Fp, "FRAME_RATE", sLine) == 0)
......@@ -990,22 +992,22 @@ int parseJpgCfgFile(ENC_CFG *pEncCfg, char *FileName)
if (GetValue(Fp, "FRAME_NUMBER_ENCODED", sLine) == 0)
return 0;
ret = kstrtoint(sLine, 10, &pEncCfg->NumFrame);//sscanf(sLine, "%d", &pEncCfg->NumFrame);
pEncCfg->NumFrame = (int)simple_strtol(sLine, NULL, 10);//sscanf(sLine, "%d", &pEncCfg->NumFrame);
if (GetValue(Fp, "VERSION_ID", sLine) == 0)
return 0;
ret = kstrtoint(sLine, 10, &pEncCfg->VersionID);//sscanf(sLine, "%d", &pEncCfg->VersionID);
pEncCfg->VersionID = (int)simple_strtol(sLine, NULL, 10);//sscanf(sLine, "%d", &pEncCfg->VersionID);
if (GetValue(Fp, "RESTART_INTERVAL", sLine) == 0)
return 0;
ret = kstrtoint(sLine, 10, &pEncCfg->RstIntval);//sscanf(sLine, "%d", &pEncCfg->RstIntval);
pEncCfg->RstIntval = (int)simple_strtol(sLine, NULL, 10);//sscanf(sLine, "%d", &pEncCfg->RstIntval);
if (GetValue(Fp, "IMG_FORMAT", sLine) == 0)
return 0;
ret = kstrtoint(sLine, 10, &pEncCfg->SrcFormat);//sscanf(sLine, "%d", &pEncCfg->SrcFormat);
pEncCfg->SrcFormat = (int)simple_strtol(sLine, NULL, 10);//sscanf(sLine, "%d", &pEncCfg->SrcFormat);
if (GetValue(Fp, "QMATRIX_TABLE", sLine) == 0)
return 0;
......
......@@ -20,8 +20,8 @@
#define JPEG_INTRPT_REQ 75
#define NPT_REG_SIZE 0x300
#define NPT_REG_BASE (0x10000000 + 0x3000)
#define VC_REG_BASE (0x0B000000 + 0x30000)
#define NPT_REG_BASE (void *)(0x10000000 + 0x3000)
#define VC_REG_BASE (void *)(0x0B000000 + 0x30000)
#define NPT_BASE 0x00
......
......@@ -114,22 +114,30 @@ int ilog2(int x)
void _cal_pll_reg(u32 clkkHz, u32 VCOR_10000, u32 *reg_txpll, u32 *reg_set, u32 factor)
{
u8 gain = 1 << ilog2(max((u32)1, (u32)(25000000UL / VCOR_10000)));
u8 gain = 1 << (u8)ilog2(max((u32)1, (u32)(25000000UL / VCOR_10000)));
u32 VCOC_1000 = VCOR_10000 * gain / 10;
u8 reg_disp_div_sel = VCOC_1000 / clkkHz;
u8 dig_dig = ilog2(gain);
u8 dig_dig = (u8)ilog2(gain);
u8 reg_divout_sel = min((u8)3, dig_dig);
u8 reg_div_sel = dig_dig - reg_divout_sel;
u8 loop_gain = (((VCOC_1000 / 266000) + 7) >> 3) << 3;
u8 loop_gain = (((VCOC_1000 / 133000) + 7) >> 3) << 3;
bool bt_div = reg_disp_div_sel > 0x7f;
u32 loop_c = 8 * ((VCOC_1000 / 133 / 8) + 500) / 1000;
u8 div_loop = loop_c > 32 ? 3 : loop_c / 8;
*reg_set = ((u64)(factor * loop_gain) << 26) / VCOC_1000;
*reg_txpll = (reg_div_sel << 10) | (reg_divout_sel << 8) | reg_disp_div_sel;
_reg_write_mask(reg_base + REG_DSI_PHY_TXPLL, 0x300000, div_loop << 20);
*reg_txpll = (reg_div_sel << 10) | (reg_divout_sel << 8) | reg_disp_div_sel;
#if 0
pr_info("clkkHz(%d) VCORx10000(%d) gain(%d)\n", clkkHz, VCOR_10000, gain);
pr_info("VCOCx1000(%d) dig_dig(%d) loop_gain(%d)\n", VCOC_1000, dig_dig, loop_gain);
pr_info("regs: disp_div_sel(%d), divout_sel(%d), set(%#x)\n", reg_disp_div_sel, reg_divout_sel, *reg_set);
pr_info("clkkHz(%d) VCOR_10000(%d) gain(%d)\n", clkkHz, VCOR_10000, gain);
pr_info("VCOC_1000(%d) dig_dig(%d) loop_gain(%d)\n", VCOC_1000, dig_dig, loop_gain);
pr_info("loop_c(%d) div_loop(%d) loop_gain1(%d)\n", loop_c, div_loop, div_loop * 2);
pr_info("regs: disp_div_sel(%d), divout_sel(%d), div_sel(%d), set(%#x)\n",
reg_disp_div_sel, reg_divout_sel, reg_div_sel, *reg_set);
#endif
pr_info("vip_sy : bt_div(%d)\n", bt_div);
}
void dphy_lvds_set_pll(u32 clkkHz, u8 link)
......
......@@ -1176,14 +1176,14 @@ int sclr_dsi_dcs_write_buffer(u8 di, const void *data, size_t len, bool sw_mode)
return -1;
}
if ((di == 0x06) || (di == 0x05) || (di == 0x04) || (di == 0x03)) {
if (di == 0x06 || di == 0x05 || di == 0x04 || di == 0x03) {
if (len != 1) {
printf("[cvi_mipi_tx] %s: cmd(0x%02x) should has 1 param.\n", __func__, di);
return -1;
}
return sclr_dsi_short_packet(di, data, len, sw_mode);
}
if ((di == 0x15) || (di == 0x37) || (di == 0x13) || (di == 0x14)) {
if (di == 0x15 || di == 0x37 || di == 0x13 || di == 0x14 || di == 0x23) {
if (len != 2) {
printf("[cvi_mipi_tx] %s: cmd(0x%02x) should has 2 param.\n", __func__, di);
return -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment