/* update registers: * PREVIEW path: * CIPRCLRSA1 ~ CIPRCLRSA4 * CIPRTRGFMT * CIPRCTRL * CIPRSCCTRL * CIPRTAREA * CODEC path: * CICOYSA1 ~ CICOYSA4 * CICOCBSA1 ~ CICOCBSA4 * CICOCRSA1 ~ CICOCRSA4 * CICOTRGFMT * CICOCTRL * CICOTAREA */ static void __inline__ update_target_fmt_regs(struct s3c2440camif_dev * pdev) { u32 ciprtrgfmt; u32 ciprctrl; u32 ciprscctrl; u32 mainBurstSize, remainedBurstSize; /* CIPRCLRSA1 ~ CIPRCLRSA4. */ iowrite32(img_buff[0].phy_base, S3C244X_CIPRCLRSA1); iowrite32(img_buff[1].phy_base, S3C244X_CIPRCLRSA2); iowrite32(img_buff[2].phy_base, S3C244X_CIPRCLRSA3); iowrite32(img_buff[3].phy_base, S3C244X_CIPRCLRSA4); /* CIPRTRGFMT. */ ciprtrgfmt = (pdev->preTargetHsize<<16) // horizontal pixel number of target image |(0<<14) // don't mirror or rotation. |(pdev->preTargetVsize<<0); // vertical pixel number of target image iowrite32(ciprtrgfmt, S3C244X_CIPRTRGFMT); /* CIPRCTRL. */ calc_burst_size(2, pdev->preTargetHsize, &mainBurstSize, &remainedBurstSize); ciprctrl = (mainBurstSize<<19)|(remainedBurstSize<<14); iowrite32(ciprctrl, S3C244X_CIPRCTRL); /* CIPRSCCTRL. */ ciprscctrl = ioread32(S3C244X_CIPRSCCTRL); ciprscctrl &= 1<<15; // clear all other info except 'preview scaler start'. ciprscctrl |= 0<<30; // 16-bits RGB iowrite32(ciprscctrl, S3C244X_CIPRSCCTRL); // 16-bit RGB /* CIPRTAREA. */ iowrite32(pdev->preTargetHsize * pdev->preTargetVsize, S3C244X_CIPRTAREA); }
/* update registers: * PREVIEW path: * CIPRCLRSA1 ~ CIPRCLRSA4 * CIPRTRGFMT * CIPRCTRL * CIPRSCCTRL * CIPRTAREA * CODEC path: * CICOYSA1 ~ CICOYSA4 * CICOCBSA1 ~ CICOCBSA4 * CICOCRSA1 ~ CICOCRSA4 * CICOTRGFMT * CICOCTRL * CICOTAREA */ static void __inline__ update_target_fmt_regs(s3c2440camif_dev * pdev) { u32 ciprtrgfmt; u32 ciprctrl; u32 ciprscctrl; u32 cicrtrgfmt; u32 cicrctrl; u32 cicrscctrl; u32 cicoscctrl; u32 ciccoctrl; u32 YmainBurstSize, YremainedBurstSize; u32 CbCrmainBurstSize, CbCrremainedBurstSize; /* CIPRCLRSA1 ~ CIPRCLRSA4. */ #if 0 iowrite32(img_buff[0].phy_base, S3C244X_CIPRCLRSA1); iowrite32(img_buff[1].phy_base, S3C244X_CIPRCLRSA2); iowrite32(img_buff[2].phy_base, S3C244X_CIPRCLRSA3); iowrite32(img_buff[3].phy_base, S3C244X_CIPRCLRSA4); #else //TODO: convert to proper use of video4linux buffers iowrite32(virt_to_bus(pdev->frame[0].Y_virt_base), S3C244X_CICOYSA1); iowrite32(virt_to_bus(pdev->frame[1].Y_virt_base), S3C244X_CICOYSA2); iowrite32(virt_to_bus(pdev->frame[2].Y_virt_base), S3C244X_CICOYSA3); iowrite32(virt_to_bus(pdev->frame[3].Y_virt_base), S3C244X_CICOYSA4); iowrite32(virt_to_bus(pdev->frame[0].CB_virt_base), S3C244X_CICOCBSA1); iowrite32(virt_to_bus(pdev->frame[1].CB_virt_base), S3C244X_CICOCBSA2); iowrite32(virt_to_bus(pdev->frame[2].CB_virt_base), S3C244X_CICOCBSA3); iowrite32(virt_to_bus(pdev->frame[3].CB_virt_base), S3C244X_CICOCBSA4); iowrite32(virt_to_bus(pdev->frame[0].CR_virt_base), S3C244X_CICOCRSA1); iowrite32(virt_to_bus(pdev->frame[1].CR_virt_base), S3C244X_CICOCRSA2); iowrite32(virt_to_bus(pdev->frame[2].CR_virt_base), S3C244X_CICOCRSA3); iowrite32(virt_to_bus(pdev->frame[3].CR_virt_base), S3C244X_CICOCRSA4); /* iowrite32(0, S3C244X_CICOCBSA1); iowrite32(0, S3C244X_CICOCBSA2); iowrite32(0, S3C244X_CICOCBSA3); iowrite32(0, S3C244X_CICOCBSA4); iowrite32(0, S3C244X_CICOCRSA1); iowrite32(0, S3C244X_CICOCRSA2); iowrite32(0, S3C244X_CICOCRSA3); iowrite32(0, S3C244X_CICOCRSA4); */ #endif #if 0 /* CIPRTRGFMT. */ ciprtrgfmt = (pdev->preTargetHsize<<16) // horizontal pixel number of target image |(0<<14) // don't mirror or rotation. |(pdev->preTargetVsize<<0); // vertical pixel number of target image iowrite32(ciprtrgfmt, S3C244X_CIPRTRGFMT); /* CIPRCTRL. */ calc_burst_size(2, pdev->preTargetHsize, &mainBurstSize, &remainedBurstSize); ciprctrl = (mainBurstSize<<19)|(remainedBurstSize<<14); iowrite32(ciprctrl, S3C244X_CIPRCTRL); /* CIPRSCCTRL. */ ciprscctrl = ioread32(S3C244X_CIPRSCCTRL); ciprscctrl &= 1<<15; // clear all other info except 'preview scaler start'. ciprscctrl |= 0<<30; // 16-bits RGB iowrite32(ciprscctrl, S3C244X_CIPRSCCTRL); // 16-bit RGB /* CIPRTAREA. */ iowrite32(pdev->preTargetHsize * pdev->preTargetVsize, S3C244X_CIPRTAREA); #else /* CICOTRGFMT. */ cicrtrgfmt = (1<<31) //use input YCbCr:422 mode |(1<<30) //use output YCbCr:422 mode |(pdev->v2f.fmt.pix.width<<16) // horizontal pixel number of target image |(0<<14) // don't mirror or rotation. |(pdev->v2f.fmt.pix.height<<0); // vertical pixel number of target image iowrite32(cicrtrgfmt, S3C244X_CICOTRGFMT); /* CICOCTRL. */ //YCrCb420 calc_burst_size(4, pdev->v2f.fmt.pix.width, &YmainBurstSize, &YremainedBurstSize); calc_burst_size(4, pdev->v2f.fmt.pix.width/2, &CbCrmainBurstSize, &CbCrremainedBurstSize); ciccoctrl = (YmainBurstSize<<19) |(YremainedBurstSize<<14)| (CbCrmainBurstSize<<9)|(CbCrremainedBurstSize<<4); iowrite32(ciccoctrl, S3C244X_CICOCTRL); /* CICOSCCTRL. */ //cicoscctrl = ioread32(S3C244X_CICOSCCTRL); //cicoscctrl &= 1<<15; // clear all other info except 'codec scaler start ?'. /*cicoscctrl |=|(1<<30) |(1<<29) |(1<<16) //horizontal 1:1 scale |(1<<0 ) ; //vertical 1:1 scale ? iowrite32(cicoscctrl, S3C244X_CICOSCCTRL); */ /* CICOTAREA. */ iowrite32(pdev->v2f.fmt.pix.width*pdev->v2f.fmt.pix.height, S3C244X_CICOTAREA); #endif }