diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2011-09-05 07:26:20 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-11-03 16:28:43 -0400 |
commit | da83d9dc0ac18ffb07b5b344e237005a0ba08089 (patch) | |
tree | a33d785935b0a25896e7933f15645c83c4727451 /drivers | |
parent | 489759c0ca26bcd405c82966bdce7ff7fec5a110 (diff) |
[media] V4L: sh_mobile_csi2: do not guess the client, the host tells us
We do not have to scan the list of subdevices to find our client - the
sensor, the host has already set our grp_id value.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/sh_mobile_csi2.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/drivers/media/video/sh_mobile_csi2.c b/drivers/media/video/sh_mobile_csi2.c index 6f9f2b7ee453..91c680a72849 100644 --- a/drivers/media/video/sh_mobile_csi2.c +++ b/drivers/media/video/sh_mobile_csi2.c | |||
@@ -201,22 +201,13 @@ static void sh_csi2_hwinit(struct sh_csi2 *priv) | |||
201 | static int sh_csi2_client_connect(struct sh_csi2 *priv) | 201 | static int sh_csi2_client_connect(struct sh_csi2 *priv) |
202 | { | 202 | { |
203 | struct sh_csi2_pdata *pdata = priv->pdev->dev.platform_data; | 203 | struct sh_csi2_pdata *pdata = priv->pdev->dev.platform_data; |
204 | struct v4l2_subdev *sd, *csi2_sd = &priv->subdev; | 204 | struct soc_camera_device *icd = (struct soc_camera_device *)priv->subdev.grp_id; |
205 | struct soc_camera_device *icd = NULL; | 205 | struct v4l2_subdev *client_sd = soc_camera_to_subdev(icd); |
206 | struct device *dev = v4l2_get_subdevdata(&priv->subdev); | 206 | struct device *dev = v4l2_get_subdevdata(&priv->subdev); |
207 | struct v4l2_mbus_config cfg; | 207 | struct v4l2_mbus_config cfg; |
208 | unsigned long common_flags, csi2_flags; | 208 | unsigned long common_flags, csi2_flags; |
209 | int i, ret; | 209 | int i, ret; |
210 | 210 | ||
211 | v4l2_device_for_each_subdev(sd, csi2_sd->v4l2_dev) | ||
212 | if (sd->grp_id) { | ||
213 | icd = (struct soc_camera_device *)sd->grp_id; | ||
214 | break; | ||
215 | } | ||
216 | |||
217 | if (!icd) | ||
218 | return -EINVAL; | ||
219 | |||
220 | for (i = 0; i < pdata->num_clients; i++) | 211 | for (i = 0; i < pdata->num_clients; i++) |
221 | if (&pdata->clients[i].pdev->dev == icd->pdev) | 212 | if (&pdata->clients[i].pdev->dev == icd->pdev) |
222 | break; | 213 | break; |
@@ -246,7 +237,7 @@ static int sh_csi2_client_connect(struct sh_csi2 *priv) | |||
246 | } | 237 | } |
247 | 238 | ||
248 | cfg.type = V4L2_MBUS_CSI2; | 239 | cfg.type = V4L2_MBUS_CSI2; |
249 | ret = v4l2_subdev_call(sd, video, g_mbus_config, &cfg); | 240 | ret = v4l2_subdev_call(client_sd, video, g_mbus_config, &cfg); |
250 | if (ret == -ENOIOCTLCMD) | 241 | if (ret == -ENOIOCTLCMD) |
251 | common_flags = csi2_flags; | 242 | common_flags = csi2_flags; |
252 | else if (!ret) | 243 | else if (!ret) |
@@ -262,8 +253,6 @@ static int sh_csi2_client_connect(struct sh_csi2 *priv) | |||
262 | priv->mipi_flags = common_flags; | 253 | priv->mipi_flags = common_flags; |
263 | priv->client = pdata->clients + i; | 254 | priv->client = pdata->clients + i; |
264 | 255 | ||
265 | csi2_sd->grp_id = (long)icd; | ||
266 | |||
267 | pm_runtime_get_sync(dev); | 256 | pm_runtime_get_sync(dev); |
268 | 257 | ||
269 | sh_csi2_hwinit(priv); | 258 | sh_csi2_hwinit(priv); |
@@ -274,7 +263,6 @@ static int sh_csi2_client_connect(struct sh_csi2 *priv) | |||
274 | static void sh_csi2_client_disconnect(struct sh_csi2 *priv) | 263 | static void sh_csi2_client_disconnect(struct sh_csi2 *priv) |
275 | { | 264 | { |
276 | priv->client = NULL; | 265 | priv->client = NULL; |
277 | priv->subdev.grp_id = 0; | ||
278 | 266 | ||
279 | pm_runtime_put(v4l2_get_subdevdata(&priv->subdev)); | 267 | pm_runtime_put(v4l2_get_subdevdata(&priv->subdev)); |
280 | } | 268 | } |