gpu: ipu-v3: Register the CSI modules
authorPhilipp Zabel <p.zabel@pengutronix.de>
Wed, 23 May 2012 15:08:19 +0000 (17:08 +0200)
committerPhilipp Zabel <p.zabel@pengutronix.de>
Wed, 4 Jun 2014 09:07:12 +0000 (11:07 +0200)
This patch registers the two CSI platform devices per IPU.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
drivers/gpu/ipu-v3/ipu-common.c
include/video/imx-ipu-v3.h

index 1442b9e1cf8d09db0d02ce6f6c5c6ec1c9520ce2..719788ce7d9f7d56f4e605a3b79fdc1e102047c6 100644 (file)
@@ -1014,6 +1014,7 @@ static void platform_device_unregister_children(struct platform_device *pdev)
 struct ipu_platform_reg {
        struct ipu_client_platformdata pdata;
        const char *name;
+       int reg_offset;
 };
 
 static const struct ipu_platform_reg client_reg[] = {
@@ -1035,13 +1036,29 @@ static const struct ipu_platform_reg client_reg[] = {
                        .dma[1] = -EINVAL,
                },
                .name = "imx-ipuv3-crtc",
+       }, {
+               .pdata = {
+                       .csi = 0,
+                       .dma[0] = IPUV3_CHANNEL_CSI0,
+                       .dma[1] = -EINVAL,
+               },
+               .reg_offset = IPU_CM_CSI0_REG_OFS,
+               .name = "imx-ipuv3-camera",
+       }, {
+               .pdata = {
+                       .csi = 1,
+                       .dma[0] = IPUV3_CHANNEL_CSI1,
+                       .dma[1] = -EINVAL,
+               },
+               .reg_offset = IPU_CM_CSI1_REG_OFS,
+               .name = "imx-ipuv3-camera",
        },
 };
 
 static DEFINE_MUTEX(ipu_client_id_mutex);
 static int ipu_client_id;
 
-static int ipu_add_client_devices(struct ipu_soc *ipu)
+static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base)
 {
        struct device *dev = ipu->dev;
        unsigned i;
@@ -1055,9 +1072,19 @@ static int ipu_add_client_devices(struct ipu_soc *ipu)
        for (i = 0; i < ARRAY_SIZE(client_reg); i++) {
                const struct ipu_platform_reg *reg = &client_reg[i];
                struct platform_device *pdev;
-
-               pdev = platform_device_register_data(dev, reg->name,
-                       id++, &reg->pdata, sizeof(reg->pdata));
+               struct resource res;
+
+               if (reg->reg_offset) {
+                       memset(&res, 0, sizeof(res));
+                       res.flags = IORESOURCE_MEM;
+                       res.start = ipu_base + ipu->devtype->cm_ofs + reg->reg_offset;
+                       res.end = res.start + PAGE_SIZE - 1;
+                       pdev = platform_device_register_resndata(dev, reg->name,
+                               id++, &res, 1, &reg->pdata, sizeof(reg->pdata));
+               } else {
+                       pdev = platform_device_register_data(dev, reg->name,
+                               id++, &reg->pdata, sizeof(reg->pdata));
+               }
 
                if (IS_ERR(pdev))
                        goto err_register;
@@ -1253,7 +1280,7 @@ static int ipu_probe(struct platform_device *pdev)
        if (ret)
                goto failed_submodules_init;
 
-       ret = ipu_add_client_devices(ipu);
+       ret = ipu_add_client_devices(ipu, ipu_base);
        if (ret) {
                dev_err(&pdev->dev, "adding client devices failed with %d\n",
                                ret);
index fe6053e6ae6d6d3fa531f528496ebd83cfa06f30..61d6d25caf95820ee9f978fcc12031163653b90f 100644 (file)
@@ -331,6 +331,7 @@ static inline void ipu_cpmem_set_burstsize(struct ipu_ch_param __iomem *p,
 };
 
 struct ipu_client_platformdata {
+       int csi;
        int di;
        int dc;
        int dp;