简体   繁体   English

是什么导致v4l2中的“资源暂时不可用”

[英]What causes “resource temporarily unavailable” in v4l2

I have compiled adv7180 driver available here. 我已经在这里编译了adv7180驱动程序

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/. 我正在卸载ov5642 cameradriver(在我的情况下是内置的)并加载adv7180_tvin模块,并在加载mxcv4l2_capture模块之后,该模块在/ dev /中创建video0。 (dmesg command says: "mxc camera on IPU2_CSI1 registered as video0") (dmesg命令说:“ IPU2_CSI1上的mxc摄像机注册为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). 但是,当我尝试使用v4l2-ctl访问video0时,出现消息“资源暂时不可用”,或者当我使用gstreamer时,出现消息“无法打开/ dev / video0”(但设备确实已创建)。

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. 我需要补充一点,在adv7180之前,我为ov5642相机使用了以上设置(不包括cvbs设置),并且一切正常。

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. 当我在dmesg中加载模块时,显示消息“ mxc_v4l2_master_attach:ipu(0:1)/ csi(1:1)/ mipi(0:0)不匹配 ”。 But it only happens when ipu_id=<1 > in v4l2_cap device tree settings and in adv7180 settings. 但是仅在v4l2_cap设备树设置和adv7180设置中的ipu_id = <1 >时才会发生。 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. 当我在v4l2设置中将ipu_id更改为ipu_id = <0>且adv7180 dmesg现在显示“ 与IPU1 CSI1并行连接 ”时,我可以使用v4l2-ctl工具成功访问/ dev / video0

But In my case there is only one possibility to use IPU2_CSI1 . 但就我而言,只有一种可能使用IPU2_CSI1

Why can't I set IPU2 to adv7180 when I was using it successfully to ov5642 ? 成功将ov5642使用IPU2时,为什么不能将其设置为adv7180?

As per my knowledge i.MX6 having two IPUs. 据我所知, i.MX6有两个IPU。 I think by default IPU1 parallel interface is not enabled in the board file. 我认为默认情况下,在板文件中未启用IPU1并行接口。 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 / CSI1的IOMUXC_GPR1寄存器设置(位19和20),并在相机驱动程序中传递csi_id 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: 1.从董事会文件中:

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 2.从boardfile或相机驱动程序

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. 并且它已经成功地与ov5642相机一起使用。 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. 不,我没有看到adv7180驱动程序没有将ipu_id作为设备树的参数,因此我认为它正在使用默认的IPU(我认为是IPU1)。

I've been playing arround how to change settings in IOMUXC_GPR1. 我一直在玩如何更改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. 需要设置位20(“启用到IPU2 CSI1的并行接口)。但是在设备树中没有更多的想法。

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: 我无法使用mach-imx6q.c文件将IOMUXC_GPR1寄存器中的第20位设置为1,所以我这样做是这样的:

in console: 在控制台中:

sudo devmem2 0x20e0004 

and read the existing value (which was in my case 0x48643005). 并读取现有值(在我的情况下为0x48643005)。 Then I set bit 20 to one ("1") so I got 0x48743005 and I put this value into the register: 然后,将位20设置为1(“ 1”),这样我得到0x48743005并将此值放入寄存器:

sudo devmem2 0x20e0004 w 0x48743005

next I loaded adv7180_tvin and mxc_v4l2_capture modules and captured frames using gsreamer: 接下来,我加载了adv7180_tvin和mxc_v4l2_capture模块,并使用gsreamer捕获了帧:

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

Everything works great ! 一切正常! Thanks for help ! 感谢帮助 !

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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