diff mbox

tchellRe: [19/38] ARM: dts: imx6-sabrelite: add video capture ports and connections

Message ID 576448DE.1040002@mentor.com (mailing list archive)
State New, archived
Headers show

Commit Message

Steve Longerbeam June 17, 2016, 7 p.m. UTC
On 06/17/2016 08:18 AM, Gary Bisson wrote:
> Steve, All,
>
> On Thu, Jun 16, 2016 at 10:32:31AM +0200, Gary Bisson wrote:
>> Steve, All,
>>
>> On Tue, Jun 14, 2016 at 03:49:15PM -0700, Steve Longerbeam wrote:
>>> Defines the host video capture device node and an OV5642 camera sensor
>>> node on i2c2. The host capture device connects to the OV5642 via the
>>> parallel-bus mux input on the ipu1_csi0_mux.
>>>
>>> Note there is a pin conflict with GPIO6. This pin functions as a power
>>> input pin to the OV5642, but ENET requires it to wake-up the ARM cores
>>> on normal RX and TX packet done events (see 6261c4c8). So by default,
>>> capture is disabled, enable by uncommenting __OV5642_CAPTURE__ macro.
>>> Ethernet will still work just not quite as well.
>> Actually the following patch fixes this issue and has already been
>> applied on Shawn's tree:
>> https://patchwork.kernel.org/patch/9153523/
>>
>> Also, this follow-up patch declared the HW workaround for SabreLite:
>> https://patchwork.kernel.org/patch/9153525/
>>
>> So ideally, once those two patches land on your base tree, you could get
>> rid of the #define and remove the HW workaround declaration.
>>
>> Finally, I'll test the series on Sabre-Lite this week.
> I've applied this series on top of Shawn tree (for-next branch) in order
> not to worry about the GPIO6 workaround.
>
> Although the camera seems to get enumerated properly, I can't seem to
> get anything from it. See log:
> http://pastebin.com/xnw1ujUq

Hi Gary, the driver does not implement vidioc_cropcap, it has
switched to the new selection APIs and v4l2src should be using
vidioc_g_selection instead of vidioc_cropcap.

>
> In your cover letter, you said that you have not run through
> v4l2-compliance. How have you tested the capture?

I use v4l2-ctl, and have used v4l2src in the past, but that was before
switching to the selection APIs. Try the attached hack that adds
vidioc_cropcap back in, and see how far you get on SabreLite with
v4l2src. I tried  the following on SabreAuto:

gst-launch-1.0 v4l2src io_mode=4 ! 
"video/x-raw,format=RGB16,width=640,height=480" ! fbdevsink

>
> Also, why isn't the OV5640 MIPI camera declared on the SabreLite device
> tree?

See Jack Mitchell's patch at http://ix.io/TTg. Thanks Jack! I will work on
incorporating it.


Steve

Comments

Hans Verkuil June 18, 2016, 9:05 a.m. UTC | #1
On 06/17/2016 09:00 PM, Steve Longerbeam wrote:
> 
> 
> On 06/17/2016 08:18 AM, Gary Bisson wrote:
>> Steve, All,
>>
>> On Thu, Jun 16, 2016 at 10:32:31AM +0200, Gary Bisson wrote:
>>> Steve, All,
>>>
>>> On Tue, Jun 14, 2016 at 03:49:15PM -0700, Steve Longerbeam wrote:
>>>> Defines the host video capture device node and an OV5642 camera sensor
>>>> node on i2c2. The host capture device connects to the OV5642 via the
>>>> parallel-bus mux input on the ipu1_csi0_mux.
>>>>
>>>> Note there is a pin conflict with GPIO6. This pin functions as a power
>>>> input pin to the OV5642, but ENET requires it to wake-up the ARM cores
>>>> on normal RX and TX packet done events (see 6261c4c8). So by default,
>>>> capture is disabled, enable by uncommenting __OV5642_CAPTURE__ macro.
>>>> Ethernet will still work just not quite as well.
>>> Actually the following patch fixes this issue and has already been
>>> applied on Shawn's tree:
>>> https://patchwork.kernel.org/patch/9153523/
>>>
>>> Also, this follow-up patch declared the HW workaround for SabreLite:
>>> https://patchwork.kernel.org/patch/9153525/
>>>
>>> So ideally, once those two patches land on your base tree, you could get
>>> rid of the #define and remove the HW workaround declaration.
>>>
>>> Finally, I'll test the series on Sabre-Lite this week.
>> I've applied this series on top of Shawn tree (for-next branch) in order
>> not to worry about the GPIO6 workaround.
>>
>> Although the camera seems to get enumerated properly, I can't seem to
>> get anything from it. See log:
>> http://pastebin.com/xnw1ujUq
> 
> Hi Gary, the driver does not implement vidioc_cropcap, it has
> switched to the new selection APIs and v4l2src should be using
> vidioc_g_selection instead of vidioc_cropcap.

The v4l2 core should emulate cropcap on top of the selection API,
so this should work (except for the known 4.7 regression, hopefully
that fix will be merged soon).

The only remaining need for cropcap would be to fill in the pixelaspect
ratio if the pixels aren't square.

Regards,

	Hans

> 
>>
>> In your cover letter, you said that you have not run through
>> v4l2-compliance. How have you tested the capture?
> 
> I use v4l2-ctl, and have used v4l2src in the past, but that was before
> switching to the selection APIs. Try the attached hack that adds
> vidioc_cropcap back in, and see how far you get on SabreLite with
> v4l2src. I tried  the following on SabreAuto:
> 
> gst-launch-1.0 v4l2src io_mode=4 ! 
> "video/x-raw,format=RGB16,width=640,height=480" ! fbdevsink
> 
>>
>> Also, why isn't the OV5640 MIPI camera declared on the SabreLite device
>> tree?
> 
> See Jack Mitchell's patch at http://ix.io/TTg. Thanks Jack! I will work on
> incorporating it.
> 
> 
> Steve
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/staging/media/imx/capture/imx-camif.c b/drivers/staging/media/imx/capture/imx-camif.c
index 9c247e0..2c51bc7 100644
--- a/drivers/staging/media/imx/capture/imx-camif.c
+++ b/drivers/staging/media/imx/capture/imx-camif.c
@@ -1561,6 +1561,23 @@  static int vidioc_s_parm(struct file *file, void *fh,
 	return v4l2_subdev_call(dev->sensor->sd, video, s_parm, a);
 }
 
+static int vidioc_cropcap(struct file *file, void *priv,
+			  struct v4l2_cropcap *cropcap)
+{
+	struct imxcam_ctx *ctx = file2ctx(file);
+	struct imxcam_dev *dev = ctx->dev;
+
+	if (cropcap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
+	    cropcap->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
+		return -EINVAL;
+
+	cropcap->bounds = dev->crop_bounds;
+	cropcap->defrect = dev->crop_defrect;
+	cropcap->pixelaspect.numerator = 1;
+	cropcap->pixelaspect.denominator = 1;
+	return 0;
+}
+
 static int vidioc_g_selection(struct file *file, void *priv,
 			      struct v4l2_selection *sel)
 {
@@ -1794,6 +1811,7 @@  static const struct v4l2_ioctl_ops imxcam_ioctl_ops = {
 	.vidioc_g_parm          = vidioc_g_parm,
 	.vidioc_s_parm          = vidioc_s_parm,
 
+	.vidioc_cropcap		= vidioc_cropcap,
 	.vidioc_g_selection     = vidioc_g_selection,
 	.vidioc_s_selection     = vidioc_s_selection,