aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/soc_camera/mx3_camera.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2013-07-30 01:59:49 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2013-08-18 08:06:37 -0400
commit4dbfd040757b8bf22f4ac17e80b39c068061a16c (patch)
treea2b870228cecc9d6da02c55730b8831927b50e83 /drivers/media/platform/soc_camera/mx3_camera.c
parent2bcccaec9937a49a65c258789d33ecc5ee1f8fff (diff)
[media] V4L2: mx3_camera: add support for asynchronous subdevice registration
The soc-camera core does all the work on supporting asynchronous subdevice probing, host drivers only have to pass a subdevice list to soc-camera. Typically this list is provided by the platform. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/platform/soc_camera/mx3_camera.c')
-rw-r--r--drivers/media/platform/soc_camera/mx3_camera.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/media/platform/soc_camera/mx3_camera.c b/drivers/media/platform/soc_camera/mx3_camera.c
index 83592e4ae532..8f9f6211c52e 100644
--- a/drivers/media/platform/soc_camera/mx3_camera.c
+++ b/drivers/media/platform/soc_camera/mx3_camera.c
@@ -1144,6 +1144,7 @@ static struct soc_camera_host_ops mx3_soc_camera_host_ops = {
1144 1144
1145static int mx3_camera_probe(struct platform_device *pdev) 1145static int mx3_camera_probe(struct platform_device *pdev)
1146{ 1146{
1147 struct mx3_camera_pdata *pdata = pdev->dev.platform_data;
1147 struct mx3_camera_dev *mx3_cam; 1148 struct mx3_camera_dev *mx3_cam;
1148 struct resource *res; 1149 struct resource *res;
1149 void __iomem *base; 1150 void __iomem *base;
@@ -1155,6 +1156,9 @@ static int mx3_camera_probe(struct platform_device *pdev)
1155 if (IS_ERR(base)) 1156 if (IS_ERR(base))
1156 return PTR_ERR(base); 1157 return PTR_ERR(base);
1157 1158
1159 if (!pdata)
1160 return -EINVAL;
1161
1158 mx3_cam = devm_kzalloc(&pdev->dev, sizeof(*mx3_cam), GFP_KERNEL); 1162 mx3_cam = devm_kzalloc(&pdev->dev, sizeof(*mx3_cam), GFP_KERNEL);
1159 if (!mx3_cam) { 1163 if (!mx3_cam) {
1160 dev_err(&pdev->dev, "Could not allocate mx3 camera object\n"); 1164 dev_err(&pdev->dev, "Could not allocate mx3 camera object\n");
@@ -1165,8 +1169,8 @@ static int mx3_camera_probe(struct platform_device *pdev)
1165 if (IS_ERR(mx3_cam->clk)) 1169 if (IS_ERR(mx3_cam->clk))
1166 return PTR_ERR(mx3_cam->clk); 1170 return PTR_ERR(mx3_cam->clk);
1167 1171
1168 mx3_cam->pdata = pdev->dev.platform_data; 1172 mx3_cam->pdata = pdata;
1169 mx3_cam->platform_flags = mx3_cam->pdata->flags; 1173 mx3_cam->platform_flags = pdata->flags;
1170 if (!(mx3_cam->platform_flags & MX3_CAMERA_DATAWIDTH_MASK)) { 1174 if (!(mx3_cam->platform_flags & MX3_CAMERA_DATAWIDTH_MASK)) {
1171 /* 1175 /*
1172 * Platform hasn't set available data widths. This is bad. 1176 * Platform hasn't set available data widths. This is bad.
@@ -1185,7 +1189,7 @@ static int mx3_camera_probe(struct platform_device *pdev)
1185 if (mx3_cam->platform_flags & MX3_CAMERA_DATAWIDTH_15) 1189 if (mx3_cam->platform_flags & MX3_CAMERA_DATAWIDTH_15)
1186 mx3_cam->width_flags |= 1 << 14; 1190 mx3_cam->width_flags |= 1 << 14;
1187 1191
1188 mx3_cam->mclk = mx3_cam->pdata->mclk_10khz * 10000; 1192 mx3_cam->mclk = pdata->mclk_10khz * 10000;
1189 if (!mx3_cam->mclk) { 1193 if (!mx3_cam->mclk) {
1190 dev_warn(&pdev->dev, 1194 dev_warn(&pdev->dev,
1191 "mclk_10khz == 0! Please, fix your platform data. " 1195 "mclk_10khz == 0! Please, fix your platform data. "
@@ -1210,6 +1214,11 @@ static int mx3_camera_probe(struct platform_device *pdev)
1210 if (IS_ERR(mx3_cam->alloc_ctx)) 1214 if (IS_ERR(mx3_cam->alloc_ctx))
1211 return PTR_ERR(mx3_cam->alloc_ctx); 1215 return PTR_ERR(mx3_cam->alloc_ctx);
1212 1216
1217 if (pdata->asd_sizes) {
1218 soc_host->asd = pdata->asd;
1219 soc_host->asd_sizes = pdata->asd_sizes;
1220 }
1221
1213 err = soc_camera_host_register(soc_host); 1222 err = soc_camera_host_register(soc_host);
1214 if (err) 1223 if (err)
1215 goto ecamhostreg; 1224 goto ecamhostreg;
@@ -1249,6 +1258,7 @@ static int mx3_camera_remove(struct platform_device *pdev)
1249static struct platform_driver mx3_camera_driver = { 1258static struct platform_driver mx3_camera_driver = {
1250 .driver = { 1259 .driver = {
1251 .name = MX3_CAM_DRV_NAME, 1260 .name = MX3_CAM_DRV_NAME,
1261 .owner = THIS_MODULE,
1252 }, 1262 },
1253 .probe = mx3_camera_probe, 1263 .probe = mx3_camera_probe,
1254 .remove = mx3_camera_remove, 1264 .remove = mx3_camera_remove,