|
@@ -44,17 +44,6 @@ static inline void ipu_cm_write(struct ipu_soc *ipu, u32 value, unsigned offset)
|
|
writel(value, ipu->cm_reg + offset);
|
|
writel(value, ipu->cm_reg + offset);
|
|
}
|
|
}
|
|
|
|
|
|
-static inline u32 ipu_idmac_read(struct ipu_soc *ipu, unsigned offset)
|
|
|
|
-{
|
|
|
|
- return readl(ipu->idmac_reg + offset);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static inline void ipu_idmac_write(struct ipu_soc *ipu, u32 value,
|
|
|
|
- unsigned offset)
|
|
|
|
-{
|
|
|
|
- writel(value, ipu->idmac_reg + offset);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
void ipu_srm_dp_sync_update(struct ipu_soc *ipu)
|
|
void ipu_srm_dp_sync_update(struct ipu_soc *ipu)
|
|
{
|
|
{
|
|
u32 val;
|
|
u32 val;
|
|
@@ -65,457 +54,184 @@ void ipu_srm_dp_sync_update(struct ipu_soc *ipu)
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(ipu_srm_dp_sync_update);
|
|
EXPORT_SYMBOL_GPL(ipu_srm_dp_sync_update);
|
|
|
|
|
|
-struct ipu_ch_param __iomem *ipu_get_cpmem(struct ipuv3_channel *channel)
|
|
|
|
-{
|
|
|
|
- struct ipu_soc *ipu = channel->ipu;
|
|
|
|
-
|
|
|
|
- return ipu->cpmem_base + channel->num;
|
|
|
|
-}
|
|
|
|
-EXPORT_SYMBOL_GPL(ipu_get_cpmem);
|
|
|
|
-
|
|
|
|
-void ipu_cpmem_set_high_priority(struct ipuv3_channel *channel)
|
|
|
|
-{
|
|
|
|
- struct ipu_soc *ipu = channel->ipu;
|
|
|
|
- struct ipu_ch_param __iomem *p = ipu_get_cpmem(channel);
|
|
|
|
- u32 val;
|
|
|
|
-
|
|
|
|
- if (ipu->ipu_type == IPUV3EX)
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_ID, 1);
|
|
|
|
-
|
|
|
|
- val = ipu_idmac_read(ipu, IDMAC_CHA_PRI(channel->num));
|
|
|
|
- val |= 1 << (channel->num % 32);
|
|
|
|
- ipu_idmac_write(ipu, val, IDMAC_CHA_PRI(channel->num));
|
|
|
|
-};
|
|
|
|
-EXPORT_SYMBOL_GPL(ipu_cpmem_set_high_priority);
|
|
|
|
-
|
|
|
|
-void ipu_ch_param_write_field(struct ipu_ch_param __iomem *base, u32 wbs, u32 v)
|
|
|
|
-{
|
|
|
|
- u32 bit = (wbs >> 8) % 160;
|
|
|
|
- u32 size = wbs & 0xff;
|
|
|
|
- u32 word = (wbs >> 8) / 160;
|
|
|
|
- u32 i = bit / 32;
|
|
|
|
- u32 ofs = bit % 32;
|
|
|
|
- u32 mask = (1 << size) - 1;
|
|
|
|
- u32 val;
|
|
|
|
-
|
|
|
|
- pr_debug("%s %d %d %d\n", __func__, word, bit , size);
|
|
|
|
-
|
|
|
|
- val = readl(&base->word[word].data[i]);
|
|
|
|
- val &= ~(mask << ofs);
|
|
|
|
- val |= v << ofs;
|
|
|
|
- writel(val, &base->word[word].data[i]);
|
|
|
|
-
|
|
|
|
- if ((bit + size - 1) / 32 > i) {
|
|
|
|
- val = readl(&base->word[word].data[i + 1]);
|
|
|
|
- val &= ~(mask >> (ofs ? (32 - ofs) : 0));
|
|
|
|
- val |= v >> (ofs ? (32 - ofs) : 0);
|
|
|
|
- writel(val, &base->word[word].data[i + 1]);
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-EXPORT_SYMBOL_GPL(ipu_ch_param_write_field);
|
|
|
|
-
|
|
|
|
-u32 ipu_ch_param_read_field(struct ipu_ch_param __iomem *base, u32 wbs)
|
|
|
|
-{
|
|
|
|
- u32 bit = (wbs >> 8) % 160;
|
|
|
|
- u32 size = wbs & 0xff;
|
|
|
|
- u32 word = (wbs >> 8) / 160;
|
|
|
|
- u32 i = bit / 32;
|
|
|
|
- u32 ofs = bit % 32;
|
|
|
|
- u32 mask = (1 << size) - 1;
|
|
|
|
- u32 val = 0;
|
|
|
|
-
|
|
|
|
- pr_debug("%s %d %d %d\n", __func__, word, bit , size);
|
|
|
|
-
|
|
|
|
- val = (readl(&base->word[word].data[i]) >> ofs) & mask;
|
|
|
|
-
|
|
|
|
- if ((bit + size - 1) / 32 > i) {
|
|
|
|
- u32 tmp;
|
|
|
|
- tmp = readl(&base->word[word].data[i + 1]);
|
|
|
|
- tmp &= mask >> (ofs ? (32 - ofs) : 0);
|
|
|
|
- val |= tmp << (ofs ? (32 - ofs) : 0);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return val;
|
|
|
|
-}
|
|
|
|
-EXPORT_SYMBOL_GPL(ipu_ch_param_read_field);
|
|
|
|
-
|
|
|
|
-int ipu_cpmem_set_format_rgb(struct ipu_ch_param __iomem *p,
|
|
|
|
- const struct ipu_rgb *rgb)
|
|
|
|
-{
|
|
|
|
- int bpp = 0, npb = 0, ro, go, bo, to;
|
|
|
|
-
|
|
|
|
- ro = rgb->bits_per_pixel - rgb->red.length - rgb->red.offset;
|
|
|
|
- go = rgb->bits_per_pixel - rgb->green.length - rgb->green.offset;
|
|
|
|
- bo = rgb->bits_per_pixel - rgb->blue.length - rgb->blue.offset;
|
|
|
|
- to = rgb->bits_per_pixel - rgb->transp.length - rgb->transp.offset;
|
|
|
|
-
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_WID0, rgb->red.length - 1);
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_OFS0, ro);
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_WID1, rgb->green.length - 1);
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_OFS1, go);
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_WID2, rgb->blue.length - 1);
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_OFS2, bo);
|
|
|
|
-
|
|
|
|
- if (rgb->transp.length) {
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_WID3,
|
|
|
|
- rgb->transp.length - 1);
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_OFS3, to);
|
|
|
|
- } else {
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_WID3, 7);
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_OFS3,
|
|
|
|
- rgb->bits_per_pixel);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- switch (rgb->bits_per_pixel) {
|
|
|
|
- case 32:
|
|
|
|
- bpp = 0;
|
|
|
|
- npb = 15;
|
|
|
|
- break;
|
|
|
|
- case 24:
|
|
|
|
- bpp = 1;
|
|
|
|
- npb = 19;
|
|
|
|
- break;
|
|
|
|
- case 16:
|
|
|
|
- bpp = 3;
|
|
|
|
- npb = 31;
|
|
|
|
- break;
|
|
|
|
- case 8:
|
|
|
|
- bpp = 5;
|
|
|
|
- npb = 63;
|
|
|
|
- break;
|
|
|
|
- default:
|
|
|
|
- return -EINVAL;
|
|
|
|
- }
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_BPP, bpp);
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_NPB, npb);
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_PFS, 7); /* rgb mode */
|
|
|
|
-
|
|
|
|
- return 0;
|
|
|
|
-}
|
|
|
|
-EXPORT_SYMBOL_GPL(ipu_cpmem_set_format_rgb);
|
|
|
|
-
|
|
|
|
-int ipu_cpmem_set_format_passthrough(struct ipu_ch_param __iomem *p,
|
|
|
|
- int width)
|
|
|
|
|
|
+enum ipu_color_space ipu_drm_fourcc_to_colorspace(u32 drm_fourcc)
|
|
{
|
|
{
|
|
- int bpp = 0, npb = 0;
|
|
|
|
-
|
|
|
|
- switch (width) {
|
|
|
|
- case 32:
|
|
|
|
- bpp = 0;
|
|
|
|
- npb = 15;
|
|
|
|
- break;
|
|
|
|
- case 24:
|
|
|
|
- bpp = 1;
|
|
|
|
- npb = 19;
|
|
|
|
- break;
|
|
|
|
- case 16:
|
|
|
|
- bpp = 3;
|
|
|
|
- npb = 31;
|
|
|
|
- break;
|
|
|
|
- case 8:
|
|
|
|
- bpp = 5;
|
|
|
|
- npb = 63;
|
|
|
|
- break;
|
|
|
|
|
|
+ switch (drm_fourcc) {
|
|
|
|
+ case DRM_FORMAT_RGB565:
|
|
|
|
+ case DRM_FORMAT_BGR565:
|
|
|
|
+ case DRM_FORMAT_RGB888:
|
|
|
|
+ case DRM_FORMAT_BGR888:
|
|
|
|
+ case DRM_FORMAT_XRGB8888:
|
|
|
|
+ case DRM_FORMAT_XBGR8888:
|
|
|
|
+ case DRM_FORMAT_RGBX8888:
|
|
|
|
+ case DRM_FORMAT_BGRX8888:
|
|
|
|
+ case DRM_FORMAT_ARGB8888:
|
|
|
|
+ case DRM_FORMAT_ABGR8888:
|
|
|
|
+ case DRM_FORMAT_RGBA8888:
|
|
|
|
+ case DRM_FORMAT_BGRA8888:
|
|
|
|
+ return IPUV3_COLORSPACE_RGB;
|
|
|
|
+ case DRM_FORMAT_YUYV:
|
|
|
|
+ case DRM_FORMAT_UYVY:
|
|
|
|
+ case DRM_FORMAT_YUV420:
|
|
|
|
+ case DRM_FORMAT_YVU420:
|
|
|
|
+ case DRM_FORMAT_YUV422:
|
|
|
|
+ case DRM_FORMAT_YVU422:
|
|
|
|
+ case DRM_FORMAT_NV12:
|
|
|
|
+ case DRM_FORMAT_NV21:
|
|
|
|
+ case DRM_FORMAT_NV16:
|
|
|
|
+ case DRM_FORMAT_NV61:
|
|
|
|
+ return IPUV3_COLORSPACE_YUV;
|
|
default:
|
|
default:
|
|
- return -EINVAL;
|
|
|
|
|
|
+ return IPUV3_COLORSPACE_UNKNOWN;
|
|
}
|
|
}
|
|
-
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_BPP, bpp);
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_NPB, npb);
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_PFS, 6); /* raw mode */
|
|
|
|
-
|
|
|
|
- return 0;
|
|
|
|
}
|
|
}
|
|
-EXPORT_SYMBOL_GPL(ipu_cpmem_set_format_passthrough);
|
|
|
|
|
|
+EXPORT_SYMBOL_GPL(ipu_drm_fourcc_to_colorspace);
|
|
|
|
|
|
-void ipu_cpmem_set_yuv_interleaved(struct ipu_ch_param __iomem *p,
|
|
|
|
- u32 pixel_format)
|
|
|
|
|
|
+enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat)
|
|
{
|
|
{
|
|
- switch (pixel_format) {
|
|
|
|
|
|
+ switch (pixelformat) {
|
|
|
|
+ case V4L2_PIX_FMT_YUV420:
|
|
|
|
+ case V4L2_PIX_FMT_YVU420:
|
|
|
|
+ case V4L2_PIX_FMT_YUV422P:
|
|
case V4L2_PIX_FMT_UYVY:
|
|
case V4L2_PIX_FMT_UYVY:
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_BPP, 3); /* bits/pixel */
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_PFS, 0xA); /* pix format */
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_NPB, 31); /* burst size */
|
|
|
|
- break;
|
|
|
|
case V4L2_PIX_FMT_YUYV:
|
|
case V4L2_PIX_FMT_YUYV:
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_BPP, 3); /* bits/pixel */
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_PFS, 0x8); /* pix format */
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_NPB, 31); /* burst size */
|
|
|
|
- break;
|
|
|
|
|
|
+ case V4L2_PIX_FMT_NV12:
|
|
|
|
+ case V4L2_PIX_FMT_NV21:
|
|
|
|
+ case V4L2_PIX_FMT_NV16:
|
|
|
|
+ case V4L2_PIX_FMT_NV61:
|
|
|
|
+ return IPUV3_COLORSPACE_YUV;
|
|
|
|
+ case V4L2_PIX_FMT_RGB32:
|
|
|
|
+ case V4L2_PIX_FMT_BGR32:
|
|
|
|
+ case V4L2_PIX_FMT_RGB24:
|
|
|
|
+ case V4L2_PIX_FMT_BGR24:
|
|
|
|
+ case V4L2_PIX_FMT_RGB565:
|
|
|
|
+ return IPUV3_COLORSPACE_RGB;
|
|
|
|
+ default:
|
|
|
|
+ return IPUV3_COLORSPACE_UNKNOWN;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-EXPORT_SYMBOL_GPL(ipu_cpmem_set_yuv_interleaved);
|
|
|
|
|
|
+EXPORT_SYMBOL_GPL(ipu_pixelformat_to_colorspace);
|
|
|
|
|
|
-void ipu_cpmem_set_yuv_planar_full(struct ipu_ch_param __iomem *p,
|
|
|
|
- u32 pixel_format, int stride, int u_offset, int v_offset)
|
|
|
|
|
|
+bool ipu_pixelformat_is_planar(u32 pixelformat)
|
|
{
|
|
{
|
|
- switch (pixel_format) {
|
|
|
|
|
|
+ switch (pixelformat) {
|
|
case V4L2_PIX_FMT_YUV420:
|
|
case V4L2_PIX_FMT_YUV420:
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_SLUV, (stride / 2) - 1);
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_UBO, u_offset / 8);
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_VBO, v_offset / 8);
|
|
|
|
- break;
|
|
|
|
case V4L2_PIX_FMT_YVU420:
|
|
case V4L2_PIX_FMT_YVU420:
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_SLUV, (stride / 2) - 1);
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_UBO, v_offset / 8);
|
|
|
|
- ipu_ch_param_write_field(p, IPU_FIELD_VBO, u_offset / 8);
|
|
|
|
- break;
|
|
|
|
|
|
+ case V4L2_PIX_FMT_YUV422P:
|
|
|
|
+ case V4L2_PIX_FMT_NV12:
|
|
|
|
+ case V4L2_PIX_FMT_NV21:
|
|
|
|
+ case V4L2_PIX_FMT_NV16:
|
|
|
|
+ case V4L2_PIX_FMT_NV61:
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
-}
|
|
|
|
-EXPORT_SYMBOL_GPL(ipu_cpmem_set_yuv_planar_full);
|
|
|
|
-
|
|
|
|
-void ipu_cpmem_set_yuv_planar(struct ipu_ch_param __iomem *p, u32 pixel_format,
|
|
|
|
- int stride, int height)
|
|
|
|
-{
|
|
|
|
- int u_offset, v_offset;
|
|
|
|
- int uv_stride = 0;
|
|
|
|
|
|
|
|
- switch (pixel_format) {
|
|
|
|
- case V4L2_PIX_FMT_YUV420:
|
|
|
|
- case V4L2_PIX_FMT_YVU420:
|
|
|
|
- uv_stride = stride / 2;
|
|
|
|
- u_offset = stride * height;
|
|
|
|
- v_offset = u_offset + (uv_stride * height / 2);
|
|
|
|
- ipu_cpmem_set_yuv_planar_full(p, pixel_format, stride,
|
|
|
|
- u_offset, v_offset);
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
-EXPORT_SYMBOL_GPL(ipu_cpmem_set_yuv_planar);
|
|
|
|
-
|
|
|
|
-static const struct ipu_rgb def_rgb_32 = {
|
|
|
|
- .red = { .offset = 16, .length = 8, },
|
|
|
|
- .green = { .offset = 8, .length = 8, },
|
|
|
|
- .blue = { .offset = 0, .length = 8, },
|
|
|
|
- .transp = { .offset = 24, .length = 8, },
|
|
|
|
- .bits_per_pixel = 32,
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-static const struct ipu_rgb def_bgr_32 = {
|
|
|
|
- .red = { .offset = 0, .length = 8, },
|
|
|
|
- .green = { .offset = 8, .length = 8, },
|
|
|
|
- .blue = { .offset = 16, .length = 8, },
|
|
|
|
- .transp = { .offset = 24, .length = 8, },
|
|
|
|
- .bits_per_pixel = 32,
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-static const struct ipu_rgb def_rgb_24 = {
|
|
|
|
- .red = { .offset = 16, .length = 8, },
|
|
|
|
- .green = { .offset = 8, .length = 8, },
|
|
|
|
- .blue = { .offset = 0, .length = 8, },
|
|
|
|
- .transp = { .offset = 0, .length = 0, },
|
|
|
|
- .bits_per_pixel = 24,
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-static const struct ipu_rgb def_bgr_24 = {
|
|
|
|
- .red = { .offset = 0, .length = 8, },
|
|
|
|
- .green = { .offset = 8, .length = 8, },
|
|
|
|
- .blue = { .offset = 16, .length = 8, },
|
|
|
|
- .transp = { .offset = 0, .length = 0, },
|
|
|
|
- .bits_per_pixel = 24,
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-static const struct ipu_rgb def_rgb_16 = {
|
|
|
|
- .red = { .offset = 11, .length = 5, },
|
|
|
|
- .green = { .offset = 5, .length = 6, },
|
|
|
|
- .blue = { .offset = 0, .length = 5, },
|
|
|
|
- .transp = { .offset = 0, .length = 0, },
|
|
|
|
- .bits_per_pixel = 16,
|
|
|
|
-};
|
|
|
|
|
|
+EXPORT_SYMBOL_GPL(ipu_pixelformat_is_planar);
|
|
|
|
|
|
-static const struct ipu_rgb def_bgr_16 = {
|
|
|
|
- .red = { .offset = 0, .length = 5, },
|
|
|
|
- .green = { .offset = 5, .length = 6, },
|
|
|
|
- .blue = { .offset = 11, .length = 5, },
|
|
|
|
- .transp = { .offset = 0, .length = 0, },
|
|
|
|
- .bits_per_pixel = 16,
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-#define Y_OFFSET(pix, x, y) ((x) + pix->width * (y))
|
|
|
|
-#define U_OFFSET(pix, x, y) ((pix->width * pix->height) + \
|
|
|
|
- (pix->width * (y) / 4) + (x) / 2)
|
|
|
|
-#define V_OFFSET(pix, x, y) ((pix->width * pix->height) + \
|
|
|
|
- (pix->width * pix->height / 4) + \
|
|
|
|
- (pix->width * (y) / 4) + (x) / 2)
|
|
|
|
-
|
|
|
|
-int ipu_cpmem_set_fmt(struct ipu_ch_param __iomem *cpmem, u32 drm_fourcc)
|
|
|
|
|
|
+enum ipu_color_space ipu_mbus_code_to_colorspace(u32 mbus_code)
|
|
{
|
|
{
|
|
- switch (drm_fourcc) {
|
|
|
|
- case DRM_FORMAT_YUV420:
|
|
|
|
- case DRM_FORMAT_YVU420:
|
|
|
|
- /* pix format */
|
|
|
|
- ipu_ch_param_write_field(cpmem, IPU_FIELD_PFS, 2);
|
|
|
|
- /* burst size */
|
|
|
|
- ipu_ch_param_write_field(cpmem, IPU_FIELD_NPB, 63);
|
|
|
|
- break;
|
|
|
|
- case DRM_FORMAT_UYVY:
|
|
|
|
- /* bits/pixel */
|
|
|
|
- ipu_ch_param_write_field(cpmem, IPU_FIELD_BPP, 3);
|
|
|
|
- /* pix format */
|
|
|
|
- ipu_ch_param_write_field(cpmem, IPU_FIELD_PFS, 0xA);
|
|
|
|
- /* burst size */
|
|
|
|
- ipu_ch_param_write_field(cpmem, IPU_FIELD_NPB, 31);
|
|
|
|
- break;
|
|
|
|
- case DRM_FORMAT_YUYV:
|
|
|
|
- /* bits/pixel */
|
|
|
|
- ipu_ch_param_write_field(cpmem, IPU_FIELD_BPP, 3);
|
|
|
|
- /* pix format */
|
|
|
|
- ipu_ch_param_write_field(cpmem, IPU_FIELD_PFS, 0x8);
|
|
|
|
- /* burst size */
|
|
|
|
- ipu_ch_param_write_field(cpmem, IPU_FIELD_NPB, 31);
|
|
|
|
- break;
|
|
|
|
- case DRM_FORMAT_ABGR8888:
|
|
|
|
- case DRM_FORMAT_XBGR8888:
|
|
|
|
- ipu_cpmem_set_format_rgb(cpmem, &def_bgr_32);
|
|
|
|
- break;
|
|
|
|
- case DRM_FORMAT_ARGB8888:
|
|
|
|
- case DRM_FORMAT_XRGB8888:
|
|
|
|
- ipu_cpmem_set_format_rgb(cpmem, &def_rgb_32);
|
|
|
|
- break;
|
|
|
|
- case DRM_FORMAT_BGR888:
|
|
|
|
- ipu_cpmem_set_format_rgb(cpmem, &def_bgr_24);
|
|
|
|
- break;
|
|
|
|
- case DRM_FORMAT_RGB888:
|
|
|
|
- ipu_cpmem_set_format_rgb(cpmem, &def_rgb_24);
|
|
|
|
- break;
|
|
|
|
- case DRM_FORMAT_RGB565:
|
|
|
|
- ipu_cpmem_set_format_rgb(cpmem, &def_rgb_16);
|
|
|
|
- break;
|
|
|
|
- case DRM_FORMAT_BGR565:
|
|
|
|
- ipu_cpmem_set_format_rgb(cpmem, &def_bgr_16);
|
|
|
|
- break;
|
|
|
|
|
|
+ switch (mbus_code & 0xf000) {
|
|
|
|
+ case 0x1000:
|
|
|
|
+ return IPUV3_COLORSPACE_RGB;
|
|
|
|
+ case 0x2000:
|
|
|
|
+ return IPUV3_COLORSPACE_YUV;
|
|
default:
|
|
default:
|
|
- return -EINVAL;
|
|
|
|
|
|
+ return IPUV3_COLORSPACE_UNKNOWN;
|
|
}
|
|
}
|
|
-
|
|
|
|
- return 0;
|
|
|
|
}
|
|
}
|
|
-EXPORT_SYMBOL_GPL(ipu_cpmem_set_fmt);
|
|
|
|
|
|
+EXPORT_SYMBOL_GPL(ipu_mbus_code_to_colorspace);
|
|
|
|
|
|
-/*
|
|
|
|
- * The V4L2 spec defines packed RGB formats in memory byte order, which from
|
|
|
|
- * point of view of the IPU corresponds to little-endian words with the first
|
|
|
|
- * component in the least significant bits.
|
|
|
|
- * The DRM pixel formats and IPU internal representation are ordered the other
|
|
|
|
- * way around, with the first named component ordered at the most significant
|
|
|
|
- * bits. Further, V4L2 formats are not well defined:
|
|
|
|
- * http://linuxtv.org/downloads/v4l-dvb-apis/packed-rgb.html
|
|
|
|
- * We choose the interpretation which matches GStreamer behavior.
|
|
|
|
- */
|
|
|
|
-static int v4l2_pix_fmt_to_drm_fourcc(u32 pixelformat)
|
|
|
|
|
|
+int ipu_stride_to_bytes(u32 pixel_stride, u32 pixelformat)
|
|
{
|
|
{
|
|
switch (pixelformat) {
|
|
switch (pixelformat) {
|
|
- case V4L2_PIX_FMT_RGB565:
|
|
|
|
|
|
+ case V4L2_PIX_FMT_YUV420:
|
|
|
|
+ case V4L2_PIX_FMT_YVU420:
|
|
|
|
+ case V4L2_PIX_FMT_YUV422P:
|
|
|
|
+ case V4L2_PIX_FMT_NV12:
|
|
|
|
+ case V4L2_PIX_FMT_NV21:
|
|
|
|
+ case V4L2_PIX_FMT_NV16:
|
|
|
|
+ case V4L2_PIX_FMT_NV61:
|
|
/*
|
|
/*
|
|
- * Here we choose the 'corrected' interpretation of RGBP, a
|
|
|
|
- * little-endian 16-bit word with the red component at the most
|
|
|
|
- * significant bits:
|
|
|
|
- * g[2:0]b[4:0] r[4:0]g[5:3] <=> [16:0] R:G:B
|
|
|
|
|
|
+ * for the planar YUV formats, the stride passed to
|
|
|
|
+ * cpmem must be the stride in bytes of the Y plane.
|
|
|
|
+ * And all the planar YUV formats have an 8-bit
|
|
|
|
+ * Y component.
|
|
*/
|
|
*/
|
|
- return DRM_FORMAT_RGB565;
|
|
|
|
|
|
+ return (8 * pixel_stride) >> 3;
|
|
|
|
+ case V4L2_PIX_FMT_RGB565:
|
|
|
|
+ case V4L2_PIX_FMT_YUYV:
|
|
|
|
+ case V4L2_PIX_FMT_UYVY:
|
|
|
|
+ return (16 * pixel_stride) >> 3;
|
|
case V4L2_PIX_FMT_BGR24:
|
|
case V4L2_PIX_FMT_BGR24:
|
|
- /* B G R <=> [24:0] R:G:B */
|
|
|
|
- return DRM_FORMAT_RGB888;
|
|
|
|
case V4L2_PIX_FMT_RGB24:
|
|
case V4L2_PIX_FMT_RGB24:
|
|
- /* R G B <=> [24:0] B:G:R */
|
|
|
|
- return DRM_FORMAT_BGR888;
|
|
|
|
|
|
+ return (24 * pixel_stride) >> 3;
|
|
case V4L2_PIX_FMT_BGR32:
|
|
case V4L2_PIX_FMT_BGR32:
|
|
- /* B G R A <=> [32:0] A:B:G:R */
|
|
|
|
- return DRM_FORMAT_XRGB8888;
|
|
|
|
case V4L2_PIX_FMT_RGB32:
|
|
case V4L2_PIX_FMT_RGB32:
|
|
- /* R G B A <=> [32:0] A:B:G:R */
|
|
|
|
- return DRM_FORMAT_XBGR8888;
|
|
|
|
- case V4L2_PIX_FMT_UYVY:
|
|
|
|
- return DRM_FORMAT_UYVY;
|
|
|
|
- case V4L2_PIX_FMT_YUYV:
|
|
|
|
- return DRM_FORMAT_YUYV;
|
|
|
|
- case V4L2_PIX_FMT_YUV420:
|
|
|
|
- return DRM_FORMAT_YUV420;
|
|
|
|
- case V4L2_PIX_FMT_YVU420:
|
|
|
|
- return DRM_FORMAT_YVU420;
|
|
|
|
|
|
+ return (32 * pixel_stride) >> 3;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
|
|
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
+EXPORT_SYMBOL_GPL(ipu_stride_to_bytes);
|
|
|
|
|
|
-enum ipu_color_space ipu_drm_fourcc_to_colorspace(u32 drm_fourcc)
|
|
|
|
|
|
+int ipu_degrees_to_rot_mode(enum ipu_rotate_mode *mode, int degrees,
|
|
|
|
+ bool hflip, bool vflip)
|
|
{
|
|
{
|
|
- switch (drm_fourcc) {
|
|
|
|
- case DRM_FORMAT_RGB565:
|
|
|
|
- case DRM_FORMAT_BGR565:
|
|
|
|
- case DRM_FORMAT_RGB888:
|
|
|
|
- case DRM_FORMAT_BGR888:
|
|
|
|
- case DRM_FORMAT_XRGB8888:
|
|
|
|
- case DRM_FORMAT_XBGR8888:
|
|
|
|
- case DRM_FORMAT_RGBX8888:
|
|
|
|
- case DRM_FORMAT_BGRX8888:
|
|
|
|
- case DRM_FORMAT_ARGB8888:
|
|
|
|
- case DRM_FORMAT_ABGR8888:
|
|
|
|
- case DRM_FORMAT_RGBA8888:
|
|
|
|
- case DRM_FORMAT_BGRA8888:
|
|
|
|
- return IPUV3_COLORSPACE_RGB;
|
|
|
|
- case DRM_FORMAT_YUYV:
|
|
|
|
- case DRM_FORMAT_UYVY:
|
|
|
|
- case DRM_FORMAT_YUV420:
|
|
|
|
- case DRM_FORMAT_YVU420:
|
|
|
|
- return IPUV3_COLORSPACE_YUV;
|
|
|
|
|
|
+ u32 r90, vf, hf;
|
|
|
|
+
|
|
|
|
+ switch (degrees) {
|
|
|
|
+ case 0:
|
|
|
|
+ vf = hf = r90 = 0;
|
|
|
|
+ break;
|
|
|
|
+ case 90:
|
|
|
|
+ vf = hf = 0;
|
|
|
|
+ r90 = 1;
|
|
|
|
+ break;
|
|
|
|
+ case 180:
|
|
|
|
+ vf = hf = 1;
|
|
|
|
+ r90 = 0;
|
|
|
|
+ break;
|
|
|
|
+ case 270:
|
|
|
|
+ vf = hf = r90 = 1;
|
|
|
|
+ break;
|
|
default:
|
|
default:
|
|
- return IPUV3_COLORSPACE_UNKNOWN;
|
|
|
|
|
|
+ return -EINVAL;
|
|
}
|
|
}
|
|
-}
|
|
|
|
-EXPORT_SYMBOL_GPL(ipu_drm_fourcc_to_colorspace);
|
|
|
|
|
|
|
|
-int ipu_cpmem_set_image(struct ipu_ch_param __iomem *cpmem,
|
|
|
|
- struct ipu_image *image)
|
|
|
|
-{
|
|
|
|
- struct v4l2_pix_format *pix = &image->pix;
|
|
|
|
- int y_offset, u_offset, v_offset;
|
|
|
|
|
|
+ hf ^= (u32)hflip;
|
|
|
|
+ vf ^= (u32)vflip;
|
|
|
|
|
|
- pr_debug("%s: resolution: %dx%d stride: %d\n",
|
|
|
|
- __func__, pix->width, pix->height,
|
|
|
|
- pix->bytesperline);
|
|
|
|
|
|
+ *mode = (enum ipu_rotate_mode)((r90 << 2) | (hf << 1) | vf);
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL_GPL(ipu_degrees_to_rot_mode);
|
|
|
|
|
|
- ipu_cpmem_set_resolution(cpmem, image->rect.width,
|
|
|
|
- image->rect.height);
|
|
|
|
- ipu_cpmem_set_stride(cpmem, pix->bytesperline);
|
|
|
|
|
|
+int ipu_rot_mode_to_degrees(int *degrees, enum ipu_rotate_mode mode,
|
|
|
|
+ bool hflip, bool vflip)
|
|
|
|
+{
|
|
|
|
+ u32 r90, vf, hf;
|
|
|
|
|
|
- ipu_cpmem_set_fmt(cpmem, v4l2_pix_fmt_to_drm_fourcc(pix->pixelformat));
|
|
|
|
|
|
+ r90 = ((u32)mode >> 2) & 0x1;
|
|
|
|
+ hf = ((u32)mode >> 1) & 0x1;
|
|
|
|
+ vf = ((u32)mode >> 0) & 0x1;
|
|
|
|
+ hf ^= (u32)hflip;
|
|
|
|
+ vf ^= (u32)vflip;
|
|
|
|
|
|
- switch (pix->pixelformat) {
|
|
|
|
- case V4L2_PIX_FMT_YUV420:
|
|
|
|
- case V4L2_PIX_FMT_YVU420:
|
|
|
|
- y_offset = Y_OFFSET(pix, image->rect.left, image->rect.top);
|
|
|
|
- u_offset = U_OFFSET(pix, image->rect.left,
|
|
|
|
- image->rect.top) - y_offset;
|
|
|
|
- v_offset = V_OFFSET(pix, image->rect.left,
|
|
|
|
- image->rect.top) - y_offset;
|
|
|
|
-
|
|
|
|
- ipu_cpmem_set_yuv_planar_full(cpmem, pix->pixelformat,
|
|
|
|
- pix->bytesperline, u_offset, v_offset);
|
|
|
|
- ipu_cpmem_set_buffer(cpmem, 0, image->phys + y_offset);
|
|
|
|
|
|
+ switch ((enum ipu_rotate_mode)((r90 << 2) | (hf << 1) | vf)) {
|
|
|
|
+ case IPU_ROTATE_NONE:
|
|
|
|
+ *degrees = 0;
|
|
break;
|
|
break;
|
|
- case V4L2_PIX_FMT_UYVY:
|
|
|
|
- case V4L2_PIX_FMT_YUYV:
|
|
|
|
- ipu_cpmem_set_buffer(cpmem, 0, image->phys +
|
|
|
|
- image->rect.left * 2 +
|
|
|
|
- image->rect.top * image->pix.bytesperline);
|
|
|
|
|
|
+ case IPU_ROTATE_90_RIGHT:
|
|
|
|
+ *degrees = 90;
|
|
break;
|
|
break;
|
|
- case V4L2_PIX_FMT_RGB32:
|
|
|
|
- case V4L2_PIX_FMT_BGR32:
|
|
|
|
- ipu_cpmem_set_buffer(cpmem, 0, image->phys +
|
|
|
|
- image->rect.left * 4 +
|
|
|
|
- image->rect.top * image->pix.bytesperline);
|
|
|
|
|
|
+ case IPU_ROTATE_180:
|
|
|
|
+ *degrees = 180;
|
|
break;
|
|
break;
|
|
- case V4L2_PIX_FMT_RGB565:
|
|
|
|
- ipu_cpmem_set_buffer(cpmem, 0, image->phys +
|
|
|
|
- image->rect.left * 2 +
|
|
|
|
- image->rect.top * image->pix.bytesperline);
|
|
|
|
- break;
|
|
|
|
- case V4L2_PIX_FMT_RGB24:
|
|
|
|
- case V4L2_PIX_FMT_BGR24:
|
|
|
|
- ipu_cpmem_set_buffer(cpmem, 0, image->phys +
|
|
|
|
- image->rect.left * 3 +
|
|
|
|
- image->rect.top * image->pix.bytesperline);
|
|
|
|
|
|
+ case IPU_ROTATE_90_LEFT:
|
|
|
|
+ *degrees = 270;
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
@@ -523,27 +239,7 @@ int ipu_cpmem_set_image(struct ipu_ch_param __iomem *cpmem,
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
-EXPORT_SYMBOL_GPL(ipu_cpmem_set_image);
|
|
|
|
-
|
|
|
|
-enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat)
|
|
|
|
-{
|
|
|
|
- switch (pixelformat) {
|
|
|
|
- case V4L2_PIX_FMT_YUV420:
|
|
|
|
- case V4L2_PIX_FMT_YVU420:
|
|
|
|
- case V4L2_PIX_FMT_UYVY:
|
|
|
|
- case V4L2_PIX_FMT_YUYV:
|
|
|
|
- return IPUV3_COLORSPACE_YUV;
|
|
|
|
- case V4L2_PIX_FMT_RGB32:
|
|
|
|
- case V4L2_PIX_FMT_BGR32:
|
|
|
|
- case V4L2_PIX_FMT_RGB24:
|
|
|
|
- case V4L2_PIX_FMT_BGR24:
|
|
|
|
- case V4L2_PIX_FMT_RGB565:
|
|
|
|
- return IPUV3_COLORSPACE_RGB;
|
|
|
|
- default:
|
|
|
|
- return IPUV3_COLORSPACE_UNKNOWN;
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-EXPORT_SYMBOL_GPL(ipu_pixelformat_to_colorspace);
|
|
|
|
|
|
+EXPORT_SYMBOL_GPL(ipu_rot_mode_to_degrees);
|
|
|
|
|
|
struct ipuv3_channel *ipu_idmac_get(struct ipu_soc *ipu, unsigned num)
|
|
struct ipuv3_channel *ipu_idmac_get(struct ipu_soc *ipu, unsigned num)
|
|
{
|
|
{
|
|
@@ -587,7 +283,26 @@ void ipu_idmac_put(struct ipuv3_channel *channel)
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(ipu_idmac_put);
|
|
EXPORT_SYMBOL_GPL(ipu_idmac_put);
|
|
|
|
|
|
-#define idma_mask(ch) (1 << (ch & 0x1f))
|
|
|
|
|
|
+#define idma_mask(ch) (1 << ((ch) & 0x1f))
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * This is an undocumented feature, a write one to a channel bit in
|
|
|
|
+ * IPU_CHA_CUR_BUF and IPU_CHA_TRIPLE_CUR_BUF will reset the channel's
|
|
|
|
+ * internal current buffer pointer so that transfers start from buffer
|
|
|
|
+ * 0 on the next channel enable (that's the theory anyway, the imx6 TRM
|
|
|
|
+ * only says these are read-only registers). This operation is required
|
|
|
|
+ * for channel linking to work correctly, for instance video capture
|
|
|
|
+ * pipelines that carry out image rotations will fail after the first
|
|
|
|
+ * streaming unless this function is called for each channel before
|
|
|
|
+ * re-enabling the channels.
|
|
|
|
+ */
|
|
|
|
+static void __ipu_idmac_reset_current_buffer(struct ipuv3_channel *channel)
|
|
|
|
+{
|
|
|
|
+ struct ipu_soc *ipu = channel->ipu;
|
|
|
|
+ unsigned int chno = channel->num;
|
|
|
|
+
|
|
|
|
+ ipu_cm_write(ipu, idma_mask(chno), IPU_CHA_CUR_BUF(chno));
|
|
|
|
+}
|
|
|
|
|
|
void ipu_idmac_set_double_buffer(struct ipuv3_channel *channel,
|
|
void ipu_idmac_set_double_buffer(struct ipuv3_channel *channel,
|
|
bool doublebuffer)
|
|
bool doublebuffer)
|
|
@@ -605,10 +320,81 @@ void ipu_idmac_set_double_buffer(struct ipuv3_channel *channel,
|
|
reg &= ~idma_mask(channel->num);
|
|
reg &= ~idma_mask(channel->num);
|
|
ipu_cm_write(ipu, reg, IPU_CHA_DB_MODE_SEL(channel->num));
|
|
ipu_cm_write(ipu, reg, IPU_CHA_DB_MODE_SEL(channel->num));
|
|
|
|
|
|
|
|
+ __ipu_idmac_reset_current_buffer(channel);
|
|
|
|
+
|
|
spin_unlock_irqrestore(&ipu->lock, flags);
|
|
spin_unlock_irqrestore(&ipu->lock, flags);
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(ipu_idmac_set_double_buffer);
|
|
EXPORT_SYMBOL_GPL(ipu_idmac_set_double_buffer);
|
|
|
|
|
|
|
|
+static const struct {
|
|
|
|
+ int chnum;
|
|
|
|
+ u32 reg;
|
|
|
|
+ int shift;
|
|
|
|
+} idmac_lock_en_info[] = {
|
|
|
|
+ { .chnum = 5, .reg = IDMAC_CH_LOCK_EN_1, .shift = 0, },
|
|
|
|
+ { .chnum = 11, .reg = IDMAC_CH_LOCK_EN_1, .shift = 2, },
|
|
|
|
+ { .chnum = 12, .reg = IDMAC_CH_LOCK_EN_1, .shift = 4, },
|
|
|
|
+ { .chnum = 14, .reg = IDMAC_CH_LOCK_EN_1, .shift = 6, },
|
|
|
|
+ { .chnum = 15, .reg = IDMAC_CH_LOCK_EN_1, .shift = 8, },
|
|
|
|
+ { .chnum = 20, .reg = IDMAC_CH_LOCK_EN_1, .shift = 10, },
|
|
|
|
+ { .chnum = 21, .reg = IDMAC_CH_LOCK_EN_1, .shift = 12, },
|
|
|
|
+ { .chnum = 22, .reg = IDMAC_CH_LOCK_EN_1, .shift = 14, },
|
|
|
|
+ { .chnum = 23, .reg = IDMAC_CH_LOCK_EN_1, .shift = 16, },
|
|
|
|
+ { .chnum = 27, .reg = IDMAC_CH_LOCK_EN_1, .shift = 18, },
|
|
|
|
+ { .chnum = 28, .reg = IDMAC_CH_LOCK_EN_1, .shift = 20, },
|
|
|
|
+ { .chnum = 45, .reg = IDMAC_CH_LOCK_EN_2, .shift = 0, },
|
|
|
|
+ { .chnum = 46, .reg = IDMAC_CH_LOCK_EN_2, .shift = 2, },
|
|
|
|
+ { .chnum = 47, .reg = IDMAC_CH_LOCK_EN_2, .shift = 4, },
|
|
|
|
+ { .chnum = 48, .reg = IDMAC_CH_LOCK_EN_2, .shift = 6, },
|
|
|
|
+ { .chnum = 49, .reg = IDMAC_CH_LOCK_EN_2, .shift = 8, },
|
|
|
|
+ { .chnum = 50, .reg = IDMAC_CH_LOCK_EN_2, .shift = 10, },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+int ipu_idmac_lock_enable(struct ipuv3_channel *channel, int num_bursts)
|
|
|
|
+{
|
|
|
|
+ struct ipu_soc *ipu = channel->ipu;
|
|
|
|
+ unsigned long flags;
|
|
|
|
+ u32 bursts, regval;
|
|
|
|
+ int i;
|
|
|
|
+
|
|
|
|
+ switch (num_bursts) {
|
|
|
|
+ case 0:
|
|
|
|
+ case 1:
|
|
|
|
+ bursts = 0x00; /* locking disabled */
|
|
|
|
+ break;
|
|
|
|
+ case 2:
|
|
|
|
+ bursts = 0x01;
|
|
|
|
+ break;
|
|
|
|
+ case 4:
|
|
|
|
+ bursts = 0x02;
|
|
|
|
+ break;
|
|
|
|
+ case 8:
|
|
|
|
+ bursts = 0x03;
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (i = 0; i < ARRAY_SIZE(idmac_lock_en_info); i++) {
|
|
|
|
+ if (channel->num == idmac_lock_en_info[i].chnum)
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ if (i >= ARRAY_SIZE(idmac_lock_en_info))
|
|
|
|
+ return -EINVAL;
|
|
|
|
+
|
|
|
|
+ spin_lock_irqsave(&ipu->lock, flags);
|
|
|
|
+
|
|
|
|
+ regval = ipu_idmac_read(ipu, idmac_lock_en_info[i].reg);
|
|
|
|
+ regval &= ~(0x03 << idmac_lock_en_info[i].shift);
|
|
|
|
+ regval |= (bursts << idmac_lock_en_info[i].shift);
|
|
|
|
+ ipu_idmac_write(ipu, regval, idmac_lock_en_info[i].reg);
|
|
|
|
+
|
|
|
|
+ spin_unlock_irqrestore(&ipu->lock, flags);
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL_GPL(ipu_idmac_lock_enable);
|
|
|
|
+
|
|
int ipu_module_enable(struct ipu_soc *ipu, u32 mask)
|
|
int ipu_module_enable(struct ipu_soc *ipu, u32 mask)
|
|
{
|
|
{
|
|
unsigned long lock_flags;
|
|
unsigned long lock_flags;
|
|
@@ -661,30 +447,6 @@ int ipu_module_disable(struct ipu_soc *ipu, u32 mask)
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(ipu_module_disable);
|
|
EXPORT_SYMBOL_GPL(ipu_module_disable);
|
|
|
|
|
|
-int ipu_csi_enable(struct ipu_soc *ipu, int csi)
|
|
|
|
-{
|
|
|
|
- return ipu_module_enable(ipu, csi ? IPU_CONF_CSI1_EN : IPU_CONF_CSI0_EN);
|
|
|
|
-}
|
|
|
|
-EXPORT_SYMBOL_GPL(ipu_csi_enable);
|
|
|
|
-
|
|
|
|
-int ipu_csi_disable(struct ipu_soc *ipu, int csi)
|
|
|
|
-{
|
|
|
|
- return ipu_module_disable(ipu, csi ? IPU_CONF_CSI1_EN : IPU_CONF_CSI0_EN);
|
|
|
|
-}
|
|
|
|
-EXPORT_SYMBOL_GPL(ipu_csi_disable);
|
|
|
|
-
|
|
|
|
-int ipu_smfc_enable(struct ipu_soc *ipu)
|
|
|
|
-{
|
|
|
|
- return ipu_module_enable(ipu, IPU_CONF_SMFC_EN);
|
|
|
|
-}
|
|
|
|
-EXPORT_SYMBOL_GPL(ipu_smfc_enable);
|
|
|
|
-
|
|
|
|
-int ipu_smfc_disable(struct ipu_soc *ipu)
|
|
|
|
-{
|
|
|
|
- return ipu_module_disable(ipu, IPU_CONF_SMFC_EN);
|
|
|
|
-}
|
|
|
|
-EXPORT_SYMBOL_GPL(ipu_smfc_disable);
|
|
|
|
-
|
|
|
|
int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel)
|
|
int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel)
|
|
{
|
|
{
|
|
struct ipu_soc *ipu = channel->ipu;
|
|
struct ipu_soc *ipu = channel->ipu;
|
|
@@ -694,6 +456,30 @@ int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel)
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(ipu_idmac_get_current_buffer);
|
|
EXPORT_SYMBOL_GPL(ipu_idmac_get_current_buffer);
|
|
|
|
|
|
|
|
+bool ipu_idmac_buffer_is_ready(struct ipuv3_channel *channel, u32 buf_num)
|
|
|
|
+{
|
|
|
|
+ struct ipu_soc *ipu = channel->ipu;
|
|
|
|
+ unsigned long flags;
|
|
|
|
+ u32 reg = 0;
|
|
|
|
+
|
|
|
|
+ spin_lock_irqsave(&ipu->lock, flags);
|
|
|
|
+ switch (buf_num) {
|
|
|
|
+ case 0:
|
|
|
|
+ reg = ipu_cm_read(ipu, IPU_CHA_BUF0_RDY(channel->num));
|
|
|
|
+ break;
|
|
|
|
+ case 1:
|
|
|
|
+ reg = ipu_cm_read(ipu, IPU_CHA_BUF1_RDY(channel->num));
|
|
|
|
+ break;
|
|
|
|
+ case 2:
|
|
|
|
+ reg = ipu_cm_read(ipu, IPU_CHA_BUF2_RDY(channel->num));
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ spin_unlock_irqrestore(&ipu->lock, flags);
|
|
|
|
+
|
|
|
|
+ return ((reg & idma_mask(channel->num)) != 0);
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL_GPL(ipu_idmac_buffer_is_ready);
|
|
|
|
+
|
|
void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num)
|
|
void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num)
|
|
{
|
|
{
|
|
struct ipu_soc *ipu = channel->ipu;
|
|
struct ipu_soc *ipu = channel->ipu;
|
|
@@ -712,6 +498,34 @@ void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num)
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(ipu_idmac_select_buffer);
|
|
EXPORT_SYMBOL_GPL(ipu_idmac_select_buffer);
|
|
|
|
|
|
|
|
+void ipu_idmac_clear_buffer(struct ipuv3_channel *channel, u32 buf_num)
|
|
|
|
+{
|
|
|
|
+ struct ipu_soc *ipu = channel->ipu;
|
|
|
|
+ unsigned int chno = channel->num;
|
|
|
|
+ unsigned long flags;
|
|
|
|
+
|
|
|
|
+ spin_lock_irqsave(&ipu->lock, flags);
|
|
|
|
+
|
|
|
|
+ ipu_cm_write(ipu, 0xF0300000, IPU_GPR); /* write one to clear */
|
|
|
|
+ switch (buf_num) {
|
|
|
|
+ case 0:
|
|
|
|
+ ipu_cm_write(ipu, idma_mask(chno), IPU_CHA_BUF0_RDY(chno));
|
|
|
|
+ break;
|
|
|
|
+ case 1:
|
|
|
|
+ ipu_cm_write(ipu, idma_mask(chno), IPU_CHA_BUF1_RDY(chno));
|
|
|
|
+ break;
|
|
|
|
+ case 2:
|
|
|
|
+ ipu_cm_write(ipu, idma_mask(chno), IPU_CHA_BUF2_RDY(chno));
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ ipu_cm_write(ipu, 0x0, IPU_GPR); /* write one to set */
|
|
|
|
+
|
|
|
|
+ spin_unlock_irqrestore(&ipu->lock, flags);
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL_GPL(ipu_idmac_clear_buffer);
|
|
|
|
+
|
|
int ipu_idmac_enable_channel(struct ipuv3_channel *channel)
|
|
int ipu_idmac_enable_channel(struct ipuv3_channel *channel)
|
|
{
|
|
{
|
|
struct ipu_soc *ipu = channel->ipu;
|
|
struct ipu_soc *ipu = channel->ipu;
|
|
@@ -782,6 +596,8 @@ int ipu_idmac_disable_channel(struct ipuv3_channel *channel)
|
|
val &= ~idma_mask(channel->num);
|
|
val &= ~idma_mask(channel->num);
|
|
ipu_idmac_write(ipu, val, IDMAC_CHA_EN(channel->num));
|
|
ipu_idmac_write(ipu, val, IDMAC_CHA_EN(channel->num));
|
|
|
|
|
|
|
|
+ __ipu_idmac_reset_current_buffer(channel);
|
|
|
|
+
|
|
/* Set channel buffers NOT to be ready */
|
|
/* Set channel buffers NOT to be ready */
|
|
ipu_cm_write(ipu, 0xf0000000, IPU_GPR); /* write one to clear */
|
|
ipu_cm_write(ipu, 0xf0000000, IPU_GPR); /* write one to clear */
|
|
|
|
|
|
@@ -810,6 +626,31 @@ int ipu_idmac_disable_channel(struct ipuv3_channel *channel)
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(ipu_idmac_disable_channel);
|
|
EXPORT_SYMBOL_GPL(ipu_idmac_disable_channel);
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * The imx6 rev. D TRM says that enabling the WM feature will increase
|
|
|
|
+ * a channel's priority. Refer to Table 36-8 Calculated priority value.
|
|
|
|
+ * The sub-module that is the sink or source for the channel must enable
|
|
|
|
+ * watermark signal for this to take effect (SMFC_WM for instance).
|
|
|
|
+ */
|
|
|
|
+void ipu_idmac_enable_watermark(struct ipuv3_channel *channel, bool enable)
|
|
|
|
+{
|
|
|
|
+ struct ipu_soc *ipu = channel->ipu;
|
|
|
|
+ unsigned long flags;
|
|
|
|
+ u32 val;
|
|
|
|
+
|
|
|
|
+ spin_lock_irqsave(&ipu->lock, flags);
|
|
|
|
+
|
|
|
|
+ val = ipu_idmac_read(ipu, IDMAC_WM_EN(channel->num));
|
|
|
|
+ if (enable)
|
|
|
|
+ val |= 1 << (channel->num % 32);
|
|
|
|
+ else
|
|
|
|
+ val &= ~(1 << (channel->num % 32));
|
|
|
|
+ ipu_idmac_write(ipu, val, IDMAC_WM_EN(channel->num));
|
|
|
|
+
|
|
|
|
+ spin_unlock_irqrestore(&ipu->lock, flags);
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL_GPL(ipu_idmac_enable_watermark);
|
|
|
|
+
|
|
static int ipu_memory_reset(struct ipu_soc *ipu)
|
|
static int ipu_memory_reset(struct ipu_soc *ipu)
|
|
{
|
|
{
|
|
unsigned long timeout;
|
|
unsigned long timeout;
|
|
@@ -826,12 +667,66 @@ static int ipu_memory_reset(struct ipu_soc *ipu)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * Set the source mux for the given CSI. Selects either parallel or
|
|
|
|
+ * MIPI CSI2 sources.
|
|
|
|
+ */
|
|
|
|
+void ipu_set_csi_src_mux(struct ipu_soc *ipu, int csi_id, bool mipi_csi2)
|
|
|
|
+{
|
|
|
|
+ unsigned long flags;
|
|
|
|
+ u32 val, mask;
|
|
|
|
+
|
|
|
|
+ mask = (csi_id == 1) ? IPU_CONF_CSI1_DATA_SOURCE :
|
|
|
|
+ IPU_CONF_CSI0_DATA_SOURCE;
|
|
|
|
+
|
|
|
|
+ spin_lock_irqsave(&ipu->lock, flags);
|
|
|
|
+
|
|
|
|
+ val = ipu_cm_read(ipu, IPU_CONF);
|
|
|
|
+ if (mipi_csi2)
|
|
|
|
+ val |= mask;
|
|
|
|
+ else
|
|
|
|
+ val &= ~mask;
|
|
|
|
+ ipu_cm_write(ipu, val, IPU_CONF);
|
|
|
|
+
|
|
|
|
+ spin_unlock_irqrestore(&ipu->lock, flags);
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL_GPL(ipu_set_csi_src_mux);
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * Set the source mux for the IC. Selects either CSI[01] or the VDI.
|
|
|
|
+ */
|
|
|
|
+void ipu_set_ic_src_mux(struct ipu_soc *ipu, int csi_id, bool vdi)
|
|
|
|
+{
|
|
|
|
+ unsigned long flags;
|
|
|
|
+ u32 val;
|
|
|
|
+
|
|
|
|
+ spin_lock_irqsave(&ipu->lock, flags);
|
|
|
|
+
|
|
|
|
+ val = ipu_cm_read(ipu, IPU_CONF);
|
|
|
|
+ if (vdi) {
|
|
|
|
+ val |= IPU_CONF_IC_INPUT;
|
|
|
|
+ } else {
|
|
|
|
+ val &= ~IPU_CONF_IC_INPUT;
|
|
|
|
+ if (csi_id == 1)
|
|
|
|
+ val |= IPU_CONF_CSI_SEL;
|
|
|
|
+ else
|
|
|
|
+ val &= ~IPU_CONF_CSI_SEL;
|
|
|
|
+ }
|
|
|
|
+ ipu_cm_write(ipu, val, IPU_CONF);
|
|
|
|
+
|
|
|
|
+ spin_unlock_irqrestore(&ipu->lock, flags);
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL_GPL(ipu_set_ic_src_mux);
|
|
|
|
+
|
|
struct ipu_devtype {
|
|
struct ipu_devtype {
|
|
const char *name;
|
|
const char *name;
|
|
unsigned long cm_ofs;
|
|
unsigned long cm_ofs;
|
|
unsigned long cpmem_ofs;
|
|
unsigned long cpmem_ofs;
|
|
unsigned long srm_ofs;
|
|
unsigned long srm_ofs;
|
|
unsigned long tpm_ofs;
|
|
unsigned long tpm_ofs;
|
|
|
|
+ unsigned long csi0_ofs;
|
|
|
|
+ unsigned long csi1_ofs;
|
|
|
|
+ unsigned long ic_ofs;
|
|
unsigned long disp0_ofs;
|
|
unsigned long disp0_ofs;
|
|
unsigned long disp1_ofs;
|
|
unsigned long disp1_ofs;
|
|
unsigned long dc_tmpl_ofs;
|
|
unsigned long dc_tmpl_ofs;
|
|
@@ -845,6 +740,9 @@ static struct ipu_devtype ipu_type_imx51 = {
|
|
.cpmem_ofs = 0x1f000000,
|
|
.cpmem_ofs = 0x1f000000,
|
|
.srm_ofs = 0x1f040000,
|
|
.srm_ofs = 0x1f040000,
|
|
.tpm_ofs = 0x1f060000,
|
|
.tpm_ofs = 0x1f060000,
|
|
|
|
+ .csi0_ofs = 0x1f030000,
|
|
|
|
+ .csi1_ofs = 0x1f038000,
|
|
|
|
+ .ic_ofs = 0x1f020000,
|
|
.disp0_ofs = 0x1e040000,
|
|
.disp0_ofs = 0x1e040000,
|
|
.disp1_ofs = 0x1e048000,
|
|
.disp1_ofs = 0x1e048000,
|
|
.dc_tmpl_ofs = 0x1f080000,
|
|
.dc_tmpl_ofs = 0x1f080000,
|
|
@@ -858,6 +756,9 @@ static struct ipu_devtype ipu_type_imx53 = {
|
|
.cpmem_ofs = 0x07000000,
|
|
.cpmem_ofs = 0x07000000,
|
|
.srm_ofs = 0x07040000,
|
|
.srm_ofs = 0x07040000,
|
|
.tpm_ofs = 0x07060000,
|
|
.tpm_ofs = 0x07060000,
|
|
|
|
+ .csi0_ofs = 0x07030000,
|
|
|
|
+ .csi1_ofs = 0x07038000,
|
|
|
|
+ .ic_ofs = 0x07020000,
|
|
.disp0_ofs = 0x06040000,
|
|
.disp0_ofs = 0x06040000,
|
|
.disp1_ofs = 0x06048000,
|
|
.disp1_ofs = 0x06048000,
|
|
.dc_tmpl_ofs = 0x07080000,
|
|
.dc_tmpl_ofs = 0x07080000,
|
|
@@ -871,6 +772,9 @@ static struct ipu_devtype ipu_type_imx6q = {
|
|
.cpmem_ofs = 0x00300000,
|
|
.cpmem_ofs = 0x00300000,
|
|
.srm_ofs = 0x00340000,
|
|
.srm_ofs = 0x00340000,
|
|
.tpm_ofs = 0x00360000,
|
|
.tpm_ofs = 0x00360000,
|
|
|
|
+ .csi0_ofs = 0x00230000,
|
|
|
|
+ .csi1_ofs = 0x00238000,
|
|
|
|
+ .ic_ofs = 0x00220000,
|
|
.disp0_ofs = 0x00240000,
|
|
.disp0_ofs = 0x00240000,
|
|
.disp1_ofs = 0x00248000,
|
|
.disp1_ofs = 0x00248000,
|
|
.dc_tmpl_ofs = 0x00380000,
|
|
.dc_tmpl_ofs = 0x00380000,
|
|
@@ -895,8 +799,36 @@ static int ipu_submodules_init(struct ipu_soc *ipu,
|
|
struct device *dev = &pdev->dev;
|
|
struct device *dev = &pdev->dev;
|
|
const struct ipu_devtype *devtype = ipu->devtype;
|
|
const struct ipu_devtype *devtype = ipu->devtype;
|
|
|
|
|
|
|
|
+ ret = ipu_cpmem_init(ipu, dev, ipu_base + devtype->cpmem_ofs);
|
|
|
|
+ if (ret) {
|
|
|
|
+ unit = "cpmem";
|
|
|
|
+ goto err_cpmem;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ret = ipu_csi_init(ipu, dev, 0, ipu_base + devtype->csi0_ofs,
|
|
|
|
+ IPU_CONF_CSI0_EN, ipu_clk);
|
|
|
|
+ if (ret) {
|
|
|
|
+ unit = "csi0";
|
|
|
|
+ goto err_csi_0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ret = ipu_csi_init(ipu, dev, 1, ipu_base + devtype->csi1_ofs,
|
|
|
|
+ IPU_CONF_CSI1_EN, ipu_clk);
|
|
|
|
+ if (ret) {
|
|
|
|
+ unit = "csi1";
|
|
|
|
+ goto err_csi_1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ret = ipu_ic_init(ipu, dev,
|
|
|
|
+ ipu_base + devtype->ic_ofs,
|
|
|
|
+ ipu_base + devtype->tpm_ofs);
|
|
|
|
+ if (ret) {
|
|
|
|
+ unit = "ic";
|
|
|
|
+ goto err_ic;
|
|
|
|
+ }
|
|
|
|
+
|
|
ret = ipu_di_init(ipu, dev, 0, ipu_base + devtype->disp0_ofs,
|
|
ret = ipu_di_init(ipu, dev, 0, ipu_base + devtype->disp0_ofs,
|
|
- IPU_CONF_DI0_EN, ipu_clk);
|
|
|
|
|
|
+ IPU_CONF_DI0_EN, ipu_clk);
|
|
if (ret) {
|
|
if (ret) {
|
|
unit = "di0";
|
|
unit = "di0";
|
|
goto err_di_0;
|
|
goto err_di_0;
|
|
@@ -949,6 +881,14 @@ err_dc:
|
|
err_di_1:
|
|
err_di_1:
|
|
ipu_di_exit(ipu, 0);
|
|
ipu_di_exit(ipu, 0);
|
|
err_di_0:
|
|
err_di_0:
|
|
|
|
+ ipu_ic_exit(ipu);
|
|
|
|
+err_ic:
|
|
|
|
+ ipu_csi_exit(ipu, 1);
|
|
|
|
+err_csi_1:
|
|
|
|
+ ipu_csi_exit(ipu, 0);
|
|
|
|
+err_csi_0:
|
|
|
|
+ ipu_cpmem_exit(ipu);
|
|
|
|
+err_cpmem:
|
|
dev_err(&pdev->dev, "init %s failed with %d\n", unit, ret);
|
|
dev_err(&pdev->dev, "init %s failed with %d\n", unit, ret);
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
@@ -1025,6 +965,10 @@ static void ipu_submodules_exit(struct ipu_soc *ipu)
|
|
ipu_dc_exit(ipu);
|
|
ipu_dc_exit(ipu);
|
|
ipu_di_exit(ipu, 1);
|
|
ipu_di_exit(ipu, 1);
|
|
ipu_di_exit(ipu, 0);
|
|
ipu_di_exit(ipu, 0);
|
|
|
|
+ ipu_ic_exit(ipu);
|
|
|
|
+ ipu_csi_exit(ipu, 1);
|
|
|
|
+ ipu_csi_exit(ipu, 0);
|
|
|
|
+ ipu_cpmem_exit(ipu);
|
|
}
|
|
}
|
|
|
|
|
|
static int platform_remove_devices_fn(struct device *dev, void *unused)
|
|
static int platform_remove_devices_fn(struct device *dev, void *unused)
|
|
@@ -1201,6 +1145,44 @@ static void ipu_irq_exit(struct ipu_soc *ipu)
|
|
irq_domain_remove(ipu->domain);
|
|
irq_domain_remove(ipu->domain);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void ipu_dump(struct ipu_soc *ipu)
|
|
|
|
+{
|
|
|
|
+ int i;
|
|
|
|
+
|
|
|
|
+ dev_dbg(ipu->dev, "IPU_CONF = \t0x%08X\n",
|
|
|
|
+ ipu_cm_read(ipu, IPU_CONF));
|
|
|
|
+ dev_dbg(ipu->dev, "IDMAC_CONF = \t0x%08X\n",
|
|
|
|
+ ipu_idmac_read(ipu, IDMAC_CONF));
|
|
|
|
+ dev_dbg(ipu->dev, "IDMAC_CHA_EN1 = \t0x%08X\n",
|
|
|
|
+ ipu_idmac_read(ipu, IDMAC_CHA_EN(0)));
|
|
|
|
+ dev_dbg(ipu->dev, "IDMAC_CHA_EN2 = \t0x%08X\n",
|
|
|
|
+ ipu_idmac_read(ipu, IDMAC_CHA_EN(32)));
|
|
|
|
+ dev_dbg(ipu->dev, "IDMAC_CHA_PRI1 = \t0x%08X\n",
|
|
|
|
+ ipu_idmac_read(ipu, IDMAC_CHA_PRI(0)));
|
|
|
|
+ dev_dbg(ipu->dev, "IDMAC_CHA_PRI2 = \t0x%08X\n",
|
|
|
|
+ ipu_idmac_read(ipu, IDMAC_CHA_PRI(32)));
|
|
|
|
+ dev_dbg(ipu->dev, "IDMAC_BAND_EN1 = \t0x%08X\n",
|
|
|
|
+ ipu_idmac_read(ipu, IDMAC_BAND_EN(0)));
|
|
|
|
+ dev_dbg(ipu->dev, "IDMAC_BAND_EN2 = \t0x%08X\n",
|
|
|
|
+ ipu_idmac_read(ipu, IDMAC_BAND_EN(32)));
|
|
|
|
+ dev_dbg(ipu->dev, "IPU_CHA_DB_MODE_SEL0 = \t0x%08X\n",
|
|
|
|
+ ipu_cm_read(ipu, IPU_CHA_DB_MODE_SEL(0)));
|
|
|
|
+ dev_dbg(ipu->dev, "IPU_CHA_DB_MODE_SEL1 = \t0x%08X\n",
|
|
|
|
+ ipu_cm_read(ipu, IPU_CHA_DB_MODE_SEL(32)));
|
|
|
|
+ dev_dbg(ipu->dev, "IPU_FS_PROC_FLOW1 = \t0x%08X\n",
|
|
|
|
+ ipu_cm_read(ipu, IPU_FS_PROC_FLOW1));
|
|
|
|
+ dev_dbg(ipu->dev, "IPU_FS_PROC_FLOW2 = \t0x%08X\n",
|
|
|
|
+ ipu_cm_read(ipu, IPU_FS_PROC_FLOW2));
|
|
|
|
+ dev_dbg(ipu->dev, "IPU_FS_PROC_FLOW3 = \t0x%08X\n",
|
|
|
|
+ ipu_cm_read(ipu, IPU_FS_PROC_FLOW3));
|
|
|
|
+ dev_dbg(ipu->dev, "IPU_FS_DISP_FLOW1 = \t0x%08X\n",
|
|
|
|
+ ipu_cm_read(ipu, IPU_FS_DISP_FLOW1));
|
|
|
|
+ for (i = 0; i < 15; i++)
|
|
|
|
+ dev_dbg(ipu->dev, "IPU_INT_CTRL(%d) = \t%08X\n", i,
|
|
|
|
+ ipu_cm_read(ipu, IPU_INT_CTRL(i)));
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL_GPL(ipu_dump);
|
|
|
|
+
|
|
static int ipu_probe(struct platform_device *pdev)
|
|
static int ipu_probe(struct platform_device *pdev)
|
|
{
|
|
{
|
|
const struct of_device_id *of_id =
|
|
const struct of_device_id *of_id =
|
|
@@ -1243,6 +1225,12 @@ static int ipu_probe(struct platform_device *pdev)
|
|
ipu_base + devtype->cm_ofs + IPU_CM_IDMAC_REG_OFS);
|
|
ipu_base + devtype->cm_ofs + IPU_CM_IDMAC_REG_OFS);
|
|
dev_dbg(&pdev->dev, "cpmem: 0x%08lx\n",
|
|
dev_dbg(&pdev->dev, "cpmem: 0x%08lx\n",
|
|
ipu_base + devtype->cpmem_ofs);
|
|
ipu_base + devtype->cpmem_ofs);
|
|
|
|
+ dev_dbg(&pdev->dev, "csi0: 0x%08lx\n",
|
|
|
|
+ ipu_base + devtype->csi0_ofs);
|
|
|
|
+ dev_dbg(&pdev->dev, "csi1: 0x%08lx\n",
|
|
|
|
+ ipu_base + devtype->csi1_ofs);
|
|
|
|
+ dev_dbg(&pdev->dev, "ic: 0x%08lx\n",
|
|
|
|
+ ipu_base + devtype->ic_ofs);
|
|
dev_dbg(&pdev->dev, "disp0: 0x%08lx\n",
|
|
dev_dbg(&pdev->dev, "disp0: 0x%08lx\n",
|
|
ipu_base + devtype->disp0_ofs);
|
|
ipu_base + devtype->disp0_ofs);
|
|
dev_dbg(&pdev->dev, "disp1: 0x%08lx\n",
|
|
dev_dbg(&pdev->dev, "disp1: 0x%08lx\n",
|
|
@@ -1265,10 +1253,8 @@ static int ipu_probe(struct platform_device *pdev)
|
|
ipu->idmac_reg = devm_ioremap(&pdev->dev,
|
|
ipu->idmac_reg = devm_ioremap(&pdev->dev,
|
|
ipu_base + devtype->cm_ofs + IPU_CM_IDMAC_REG_OFS,
|
|
ipu_base + devtype->cm_ofs + IPU_CM_IDMAC_REG_OFS,
|
|
PAGE_SIZE);
|
|
PAGE_SIZE);
|
|
- ipu->cpmem_base = devm_ioremap(&pdev->dev,
|
|
|
|
- ipu_base + devtype->cpmem_ofs, PAGE_SIZE);
|
|
|
|
|
|
|
|
- if (!ipu->cm_reg || !ipu->idmac_reg || !ipu->cpmem_base)
|
|
|
|
|
|
+ if (!ipu->cm_reg || !ipu->idmac_reg)
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
|
|
|
|
ipu->clk = devm_clk_get(&pdev->dev, "bus");
|
|
ipu->clk = devm_clk_get(&pdev->dev, "bus");
|