diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2013-08-31 05:23:17 +0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2013-12-11 12:59:20 +0400 |
commit | 11abbfd30f74f79fe78d9ff79cc3fcfa86a975c5 (patch) | |
tree | be69233e2baf10e6f924e92830ae7401950afd75 /drivers/staging/media/omap4iss/iss_ipipeif.c | |
parent | 1be9ba20e1b3dccc7fb972f0f370ae27c0187718 (diff) | |
download | linux-11abbfd30f74f79fe78d9ff79cc3fcfa86a975c5.tar.xz |
[media] v4l: omap4iss: Create and use register access functions
Replace the direct readl/writel calls with helper functions that take an
ISS pointer and compute the register memory address. Also add bit clear,
set and update helpers.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/staging/media/omap4iss/iss_ipipeif.c')
-rw-r--r-- | drivers/staging/media/omap4iss/iss_ipipeif.c | 94 |
1 files changed, 41 insertions, 53 deletions
diff --git a/drivers/staging/media/omap4iss/iss_ipipeif.c b/drivers/staging/media/omap4iss/iss_ipipeif.c index 28538512d043..2d11f62d0b12 100644 --- a/drivers/staging/media/omap4iss/iss_ipipeif.c +++ b/drivers/staging/media/omap4iss/iss_ipipeif.c @@ -40,15 +40,15 @@ static const unsigned int ipipeif_fmts[] = { */ #define IPIPEIF_PRINT_REGISTER(iss, name)\ dev_dbg(iss->dev, "###IPIPEIF " #name "=0x%08x\n", \ - readl(iss->regs[OMAP4_ISS_MEM_ISP_IPIPEIF] + IPIPEIF_##name)) + iss_reg_read(iss, OMAP4_ISS_MEM_ISP_IPIPEIF, IPIPEIF_##name)) #define ISIF_PRINT_REGISTER(iss, name)\ dev_dbg(iss->dev, "###ISIF " #name "=0x%08x\n", \ - readl(iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_##name)) + iss_reg_read(iss, OMAP4_ISS_MEM_ISP_ISIF, ISIF_##name)) #define ISP5_PRINT_REGISTER(iss, name)\ dev_dbg(iss->dev, "###ISP5 " #name "=0x%08x\n", \ - readl(iss->regs[OMAP4_ISS_MEM_ISP_SYS1] + ISP5_##name)) + iss_reg_read(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_##name)) static void ipipeif_print_status(struct iss_ipipeif_device *ipipeif) { @@ -83,10 +83,8 @@ static void ipipeif_write_enable(struct iss_ipipeif_device *ipipeif, u8 enable) { struct iss_device *iss = to_iss_device(ipipeif); - writel((readl(iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_SYNCEN) & - ~ISIF_SYNCEN_DWEN) | - (enable ? ISIF_SYNCEN_DWEN : 0), - iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_SYNCEN); + iss_reg_update(iss, OMAP4_ISS_MEM_ISP_ISIF, ISIF_SYNCEN, + ISIF_SYNCEN_DWEN, enable ? ISIF_SYNCEN_DWEN : 0); } /* @@ -98,10 +96,8 @@ static void ipipeif_enable(struct iss_ipipeif_device *ipipeif, u8 enable) { struct iss_device *iss = to_iss_device(ipipeif); - writel((readl(iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_SYNCEN) & - ~ISIF_SYNCEN_SYEN) | - (enable ? ISIF_SYNCEN_SYEN : 0), - iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_SYNCEN); + iss_reg_update(iss, OMAP4_ISS_MEM_ISP_ISIF, ISIF_SYNCEN, + ISIF_SYNCEN_SYEN, enable ? ISIF_SYNCEN_SYEN : 0); } /* ----------------------------------------------------------------------------- @@ -120,10 +116,10 @@ static void ipipeif_set_outaddr(struct iss_ipipeif_device *ipipeif, u32 addr) struct iss_device *iss = to_iss_device(ipipeif); /* Save address splitted in Base Address H & L */ - writel((addr >> (16 + 5)) & ISIF_CADU_MASK, - iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_CADU); - writel((addr >> 5) & ISIF_CADL_MASK, - iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_CADL); + iss_reg_write(iss, OMAP4_ISS_MEM_ISP_ISIF, ISIF_CADU, + (addr >> (16 + 5)) & ISIF_CADU_MASK); + iss_reg_write(iss, OMAP4_ISS_MEM_ISP_ISIF, ISIF_CADL, + (addr >> 5) & ISIF_CADL_MASK); } static void ipipeif_configure(struct iss_ipipeif_device *ipipeif) @@ -139,25 +135,20 @@ static void ipipeif_configure(struct iss_ipipeif_device *ipipeif) format = &ipipeif->formats[IPIPEIF_PAD_SINK]; /* IPIPEIF with YUV422 input from ISIF */ - writel(readl(iss->regs[OMAP4_ISS_MEM_ISP_IPIPEIF] + IPIPEIF_CFG1) & - ~(IPIPEIF_CFG1_INPSRC1_MASK | IPIPEIF_CFG1_INPSRC2_MASK), - iss->regs[OMAP4_ISS_MEM_ISP_IPIPEIF] + IPIPEIF_CFG1); + iss_reg_clr(iss, OMAP4_ISS_MEM_ISP_IPIPEIF, IPIPEIF_CFG1, + IPIPEIF_CFG1_INPSRC1_MASK | IPIPEIF_CFG1_INPSRC2_MASK); /* Select ISIF/IPIPEIF input format */ switch (format->code) { case V4L2_MBUS_FMT_UYVY8_1X16: case V4L2_MBUS_FMT_YUYV8_1X16: - writel((readl(iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_MODESET) & - ~(ISIF_MODESET_CCDMD | - ISIF_MODESET_INPMOD_MASK | - ISIF_MODESET_CCDW_MASK)) | - ISIF_MODESET_INPMOD_YCBCR16, - iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_MODESET); - - writel((readl(iss->regs[OMAP4_ISS_MEM_ISP_IPIPEIF] + IPIPEIF_CFG2) & - ~IPIPEIF_CFG2_YUV8) | - IPIPEIF_CFG2_YUV16, - iss->regs[OMAP4_ISS_MEM_ISP_IPIPEIF] + IPIPEIF_CFG2); + iss_reg_update(iss, OMAP4_ISS_MEM_ISP_ISIF, ISIF_MODESET, + ISIF_MODESET_CCDMD | ISIF_MODESET_INPMOD_MASK | + ISIF_MODESET_CCDW_MASK, + ISIF_MODESET_INPMOD_YCBCR16); + + iss_reg_update(iss, OMAP4_ISS_MEM_ISP_IPIPEIF, IPIPEIF_CFG2, + IPIPEIF_CFG2_YUV8, IPIPEIF_CFG2_YUV16); break; case V4L2_MBUS_FMT_SGRBG10_1X10: @@ -184,44 +175,41 @@ static void ipipeif_configure(struct iss_ipipeif_device *ipipeif) ISIF_CCOLP_CP2_F0_R | ISIF_CCOLP_CP3_F0_GR; cont_raw: - writel((readl(iss->regs[OMAP4_ISS_MEM_ISP_IPIPEIF] + IPIPEIF_CFG2) & - ~IPIPEIF_CFG2_YUV16), - iss->regs[OMAP4_ISS_MEM_ISP_IPIPEIF] + IPIPEIF_CFG2); + iss_reg_clr(iss, OMAP4_ISS_MEM_ISP_IPIPEIF, IPIPEIF_CFG2, + IPIPEIF_CFG2_YUV16); - writel((readl(iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_MODESET) & - ~(ISIF_MODESET_CCDMD | - ISIF_MODESET_INPMOD_MASK | - ISIF_MODESET_CCDW_MASK)) | - ISIF_MODESET_INPMOD_RAW | ISIF_MODESET_CCDW_2BIT, - iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_MODESET); + iss_reg_update(iss, OMAP4_ISS_MEM_ISP_ISIF, ISIF_MODESET, + ISIF_MODESET_CCDMD | ISIF_MODESET_INPMOD_MASK | + ISIF_MODESET_CCDW_MASK, ISIF_MODESET_INPMOD_RAW | + ISIF_MODESET_CCDW_2BIT); info = omap4iss_video_format_info(format->code); - writel((readl(iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_CGAMMAWD) & - ~ISIF_CGAMMAWD_GWDI_MASK) | - ISIF_CGAMMAWD_GWDI(info->bpp), - iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_CGAMMAWD); + iss_reg_update(iss, OMAP4_ISS_MEM_ISP_ISIF, ISIF_CGAMMAWD, + ISIF_CGAMMAWD_GWDI_MASK, + ISIF_CGAMMAWD_GWDI(info->bpp)); /* Set RAW Bayer pattern */ - writel(isif_ccolp, - iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_CCOLP); + iss_reg_write(iss, OMAP4_ISS_MEM_ISP_ISIF, ISIF_CCOLP, + isif_ccolp); break; } - writel(0 & ISIF_SPH_MASK, iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_SPH); - writel((format->width - 1) & ISIF_LNH_MASK, - iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_LNH); - writel((format->height - 1) & ISIF_LNV_MASK, - iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_LNV); + iss_reg_write(iss, OMAP4_ISS_MEM_ISP_ISIF, ISIF_SPH, 0 & ISIF_SPH_MASK); + iss_reg_write(iss, OMAP4_ISS_MEM_ISP_ISIF, ISIF_LNH, + (format->width - 1) & ISIF_LNH_MASK); + iss_reg_write(iss, OMAP4_ISS_MEM_ISP_ISIF, ISIF_LNV, + (format->height - 1) & ISIF_LNV_MASK); /* Generate ISIF0 on the last line of the image */ - writel(format->height - 1, - iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_VDINT(0)); + iss_reg_write(iss, OMAP4_ISS_MEM_ISP_ISIF, ISIF_VDINT(0), + format->height - 1); /* IPIPEIF_PAD_SOURCE_ISIF_SF */ format = &ipipeif->formats[IPIPEIF_PAD_SOURCE_ISIF_SF]; - writel((ipipeif->video_out.bpl_value >> 5) & ISIF_HSIZE_HSIZE_MASK, - iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_HSIZE); + iss_reg_write(iss, OMAP4_ISS_MEM_ISP_ISIF, ISIF_HSIZE, + (ipipeif->video_out.bpl_value >> 5) & + ISIF_HSIZE_HSIZE_MASK); /* IPIPEIF_PAD_SOURCE_VP */ /* Do nothing? */ |