Commit c771f42f authored by Robert Jarzmik's avatar Robert Jarzmik Committed by Mauro Carvalho Chehab

[media] media: platform: pxa_camera: add missing sensor power on

During sensors binding, there is a window where the sensor is switched
off, while there is a call it to set a new format, which can end up in
an access to the sensor, especially an I2C based sensor.

Remove this window by activating the sensor.
Signed-off-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 6dfcd296
...@@ -2125,17 +2125,22 @@ static int pxa_camera_sensor_bound(struct v4l2_async_notifier *notifier, ...@@ -2125,17 +2125,22 @@ static int pxa_camera_sensor_bound(struct v4l2_async_notifier *notifier,
pix->bytesperline, pix->height); pix->bytesperline, pix->height);
pix->pixelformat = pcdev->current_fmt->host_fmt->fourcc; pix->pixelformat = pcdev->current_fmt->host_fmt->fourcc;
v4l2_fill_mbus_format(mf, pix, pcdev->current_fmt->code); v4l2_fill_mbus_format(mf, pix, pcdev->current_fmt->code);
err = sensor_call(pcdev, pad, set_fmt, NULL, &format);
err = sensor_call(pcdev, core, s_power, 1);
if (err) if (err)
goto out; goto out;
err = sensor_call(pcdev, pad, set_fmt, NULL, &format);
if (err)
goto out_sensor_poweroff;
v4l2_fill_pix_format(pix, mf); v4l2_fill_pix_format(pix, mf);
pr_info("%s(): colorspace=0x%x pixfmt=0x%x\n", pr_info("%s(): colorspace=0x%x pixfmt=0x%x\n",
__func__, pix->colorspace, pix->pixelformat); __func__, pix->colorspace, pix->pixelformat);
err = pxa_camera_init_videobuf2(pcdev); err = pxa_camera_init_videobuf2(pcdev);
if (err) if (err)
goto out; goto out_sensor_poweroff;
err = video_register_device(&pcdev->vdev, VFL_TYPE_GRABBER, -1); err = video_register_device(&pcdev->vdev, VFL_TYPE_GRABBER, -1);
if (err) { if (err) {
...@@ -2146,6 +2151,9 @@ static int pxa_camera_sensor_bound(struct v4l2_async_notifier *notifier, ...@@ -2146,6 +2151,9 @@ static int pxa_camera_sensor_bound(struct v4l2_async_notifier *notifier,
"PXA Camera driver attached to camera %s\n", "PXA Camera driver attached to camera %s\n",
subdev->name); subdev->name);
} }
out_sensor_poweroff:
err = sensor_call(pcdev, core, s_power, 0);
out: out:
mutex_unlock(&pcdev->mlock); mutex_unlock(&pcdev->mlock);
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment