[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>
This commit is contained in:
committed by
Mauro Carvalho Chehab
parent
489759c0ca
commit
da83d9dc0a
@@ -201,22 +201,13 @@ static void sh_csi2_hwinit(struct sh_csi2 *priv)
|
|||||||
static int sh_csi2_client_connect(struct sh_csi2 *priv)
|
static int sh_csi2_client_connect(struct sh_csi2 *priv)
|
||||||
{
|
{
|
||||||
struct sh_csi2_pdata *pdata = priv->pdev->dev.platform_data;
|
struct sh_csi2_pdata *pdata = priv->pdev->dev.platform_data;
|
||||||
struct v4l2_subdev *sd, *csi2_sd = &priv->subdev;
|
struct soc_camera_device *icd = (struct soc_camera_device *)priv->subdev.grp_id;
|
||||||
struct soc_camera_device *icd = NULL;
|
struct v4l2_subdev *client_sd = soc_camera_to_subdev(icd);
|
||||||
struct device *dev = v4l2_get_subdevdata(&priv->subdev);
|
struct device *dev = v4l2_get_subdevdata(&priv->subdev);
|
||||||
struct v4l2_mbus_config cfg;
|
struct v4l2_mbus_config cfg;
|
||||||
unsigned long common_flags, csi2_flags;
|
unsigned long common_flags, csi2_flags;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
v4l2_device_for_each_subdev(sd, csi2_sd->v4l2_dev)
|
|
||||||
if (sd->grp_id) {
|
|
||||||
icd = (struct soc_camera_device *)sd->grp_id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!icd)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
for (i = 0; i < pdata->num_clients; i++)
|
for (i = 0; i < pdata->num_clients; i++)
|
||||||
if (&pdata->clients[i].pdev->dev == icd->pdev)
|
if (&pdata->clients[i].pdev->dev == icd->pdev)
|
||||||
break;
|
break;
|
||||||
@@ -246,7 +237,7 @@ static int sh_csi2_client_connect(struct sh_csi2 *priv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
cfg.type = V4L2_MBUS_CSI2;
|
cfg.type = V4L2_MBUS_CSI2;
|
||||||
ret = v4l2_subdev_call(sd, video, g_mbus_config, &cfg);
|
ret = v4l2_subdev_call(client_sd, video, g_mbus_config, &cfg);
|
||||||
if (ret == -ENOIOCTLCMD)
|
if (ret == -ENOIOCTLCMD)
|
||||||
common_flags = csi2_flags;
|
common_flags = csi2_flags;
|
||||||
else if (!ret)
|
else if (!ret)
|
||||||
@@ -262,8 +253,6 @@ static int sh_csi2_client_connect(struct sh_csi2 *priv)
|
|||||||
priv->mipi_flags = common_flags;
|
priv->mipi_flags = common_flags;
|
||||||
priv->client = pdata->clients + i;
|
priv->client = pdata->clients + i;
|
||||||
|
|
||||||
csi2_sd->grp_id = (long)icd;
|
|
||||||
|
|
||||||
pm_runtime_get_sync(dev);
|
pm_runtime_get_sync(dev);
|
||||||
|
|
||||||
sh_csi2_hwinit(priv);
|
sh_csi2_hwinit(priv);
|
||||||
@@ -274,7 +263,6 @@ static int sh_csi2_client_connect(struct sh_csi2 *priv)
|
|||||||
static void sh_csi2_client_disconnect(struct sh_csi2 *priv)
|
static void sh_csi2_client_disconnect(struct sh_csi2 *priv)
|
||||||
{
|
{
|
||||||
priv->client = NULL;
|
priv->client = NULL;
|
||||||
priv->subdev.grp_id = 0;
|
|
||||||
|
|
||||||
pm_runtime_put(v4l2_get_subdevdata(&priv->subdev));
|
pm_runtime_put(v4l2_get_subdevdata(&priv->subdev));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user