简体   繁体   中英

What causes “resource temporarily unavailable” in v4l2

I have compiled adv7180 driver available here.

I am unloading the ov5642 cameradriver(which in my case is built-in) and loading the adv7180_tvin module and after I am loading mxcv4l2_capture module which creates video0 in /dev/. (dmesg command says: "mxc camera on IPU2_CSI1 registered as video0")

But when I try to access video0 with v4l2-ctl I got a message "resource temporarily unavailable" or when I am using gstreamer I got message "Can not open /dev/video0" (but the device is really created).

Is that a problem in device tree settings or it can be caused by something else? Which tools should I use to find out what causes this issue?

My device tree settings look like below:

&i2c3{
adv7180: adv7180@20{
compatible = "adv,adv7180";
reg = <0x20>;
clocks = <&clks IMX6QDL_CLK_CKO2>;
clock-names = "csi_mclk";
pwn-gpios = <&gpio3 10 GPIO_ACTIVE_LOW>;
ipu_id = <1>;
csi_id = <1>;
mclk = <24000000>;
mclk_source = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_hummingboard2_parallel>;

cvbs = <1>;

};
};

I need to add that before adv7180 I was using above settings for ov5642 camera (excluding cvbs setting) and everything worked properly.

EDIT:

Ok I got one clue.

When I load modules in dmesg message " mxc_v4l2_master_attach: ipu(0:1)/csi(1:1)/mipi(0:0) doesn't match " shows. But it only happens when ipu_id=<1 > in v4l2_cap device tree settings and in adv7180 settings. When i change ipu_id to ipu_id=<0> in v4l2 settings and adv7180 dmesg now shows " parallel attach to IPU1 CSI1 and I can access the /dev/video0 succesfully with v4l2-ctl tool.

But In my case there is only one possibility to use IPU2_CSI1 .

Why can't I set IPU2 to adv7180 when I was using it successfully to ov5642 ?

As per my knowledge i.MX6 having two IPUs. I think by default IPU1 parallel interface is not enabled in the board file. So you need to check the IOMUXC_GPR1 register setting (bit 19 and 20) for IPU/CSI1 and pass the csi_id in your camera driver. IPU到CSI的连接

As you are using the parallel interface so check your pin muxing setting as well in your device tree. (which is not required for serial interface.)

Edit: There are two ways which you can follow to update the register setting from the kernel space (boardfile or camera driver) itself:

1. From the board file:

struct regmap *gpr
gpr = syscon_regmap_lookup_by_compatible("fsl,imx6q-iomuxc-gpr");
regmap_update_bits(gpr, IOMUXC_GPR1, 1 << 20, 1 << 20);

2. From the boardfile or camera driver

void __iomem *va_ipu2_address;
u32 reg_val;
va_ipu2_address = ioremap(0x20e0004,0xe0004);
reg_val = readl(va_ipu2_address);
/* Enable parallel interface to IPU2 CSI1.  */
writel(reg_val | 1 << 20, va_ipu2_address);

Thanks for Your answer. My pinmuxing looks like this:

 &iomuxc{
 hummingboard2{
  pinctrl_hummingboard2_parallel: hummingboard2_parallel{
 fsl,pins = <
 MX6QDL_PAD_EIM_A24__IPU2_CSI1_DATA19 0x0b0b1
 MX6QDL_PAD_EIM_A23__IPU2_CSI1_DATA18 0x0b0b1
 MX6QDL_PAD_EIM_A22__IPU2_CSI1_DATA17 0x0b0b1
 MX6QDL_PAD_EIM_A21__IPU2_CSI1_DATA16 0x0b0b1
 MX6QDL_PAD_EIM_A20__IPU2_CSI1_DATA15 0x0b0b1
 MX6QDL_PAD_EIM_A19__IPU2_CSI1_DATA14 0x0b0b1
 MX6QDL_PAD_EIM_A18__IPU2_CSI1_DATA13 0x0b0b1
 MX6QDL_PAD_EIM_A17__IPU2_CSI1_DATA12 0x0b0b1
 MX6QDL_PAD_EIM_DA11__IPU2_CSI1_HSYNC 0x0b0b1
 MX6QDL_PAD_EIM_DA12__IPU2_CSI1_VSYNC 0x0b0b1
 MX6QDL_PAD_EIM_A16__IPU2_CSI1_PIXCLK 0x0b0b1

 MX6QDL_PAD_EIM_DA10__GPIO3_IO10 0x400130b1    
 >;
 };
 };
 };

and it's been working succesively with ov5642 camera. No I see that the adv7180 driver does not take an ipu_id as an argument from device tree so I think it is using the default ipu which is (I think) IPU1.

I've been playing arround how to change settings in IOMUXC_GPR1. Bit 20 needs to be set ("enable parallel interface to IPU2 CSI1). But have got no more ideas how to do it in device tree.

Ok. I found it !

I couldn't set bit 20 in IOMUXC_GPR1 register using mach-imx6q.c file so I did it this way:

in console:

sudo devmem2 0x20e0004 

and read the existing value (which was in my case 0x48643005). Then I set bit 20 to one ("1") so I got 0x48743005 and I put this value into the register:

sudo devmem2 0x20e0004 w 0x48743005

next I loaded adv7180_tvin and mxc_v4l2_capture modules and captured frames using gsreamer:

gst-launch-1.0 imxv4l2videosrc device=/dev/video0 ! imxipuvideotransform ! autovideosink deinterlace=true

Everything works great ! Thanks for help !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM