ADV7180 on IPU2_CSI1 with i.mx6q Device Tree bindings

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ADV7180 on IPU2_CSI1 with i.mx6q Device Tree bindings

4,834 Views
michik
Contributor I

Hi,

I have no prior experience of interfacing Cameras with I.mx6 but sensors I do.I am currently having trouble interfacing ADV7180 with two cameras CVBS1 & 2 connected on AIN1 and AIN2. PCAM_D0 to PCAM_D7 are tied to IPU2_CSI1 ... of the i.mx6q module. The board is a custom design.

I am using linux 3.10.17 with device tree support. The following are my current device tree bindings:

#ifdef SMX6_CPU_IMX6Q

        adv7180: adv7180@20 {

                compatible = "adv,adv7180";

                reg = <0x20>;

                pinctrl-names = "default";

                pinctrl-0 = <&pinctrl_ipu2_csi>;

                clocks = <&clks 201>;

                clock-names = "csi_mclk";

                DOVDD-supply = <&reg_3p3v>; /* 3.3v, enabled via 2.8 VGEN6 */

                AVDD-supply = <&reg_3p3v>;  /* 1.8v */

                DVDD-supply = <&reg_3p3v>;  /* 1.8v */

                PVDD-supply = <&reg_3p3v>;  /* 1.8v */

                rst-gpios = <&gpio3 3 0>;  /* tied to P111 GPIO3_CAM1_RST */

                csi_id = <1>;

                mclk = <24000000>;

                mclk_source = <0>;

                cvbs = <1>;

                };

#endif

   

v4l2_cap_0 {

                compatible = "fsl,imx6q-v4l2-capture";

                ipu_id = <1>;

                csi_id = <1>;

                mclk_source = <0>;

                status = "okay";

        };

#ifdef SMX6_CPU_IMX6Q

         ipu1 {

               pinctrl_ipu2_csi: ipu2-csi {

                       fsl,pins = <

                                MX6QDL_PAD_EIM_A17__IPU2_CSI1_DATA12 0x80000000

                               MX6QDL_PAD_EIM_A18__IPU2_CSI1_DATA13 0x80000000

                               MX6QDL_PAD_EIM_A19__IPU2_CSI1_DATA14 0x80000000

                               MX6QDL_PAD_EIM_A20__IPU2_CSI1_DATA15 0x80000000

                               MX6QDL_PAD_EIM_A21__IPU2_CSI1_DATA16 0x80000000

                               MX6QDL_PAD_EIM_A22__IPU2_CSI1_DATA17 0x80000000

                               MX6QDL_PAD_EIM_A23__IPU2_CSI1_DATA18 0x80000000

                               MX6QDL_PAD_EIM_A24__IPU2_CSI1_DATA19 0x80000000

                               MX6QDL_PAD_EIM_EB3__IPU2_CSI1_HSYNC 0x80000000

                              MX6QDL_PAD_EIM_D17__IPU2_CSI1_PIXCLK 0x80000000

                               MX6QDL_PAD_EIM_DA12__IPU2_CSI1_VSYNC 0x80000000

                            >;

               };

               pinctrl_cam1_rst: cam1_rst {

                       fsl,pins = <

                                  MX6QDL_PAD_EIM_DA3__GPIO3_IO03 0x4000b0b1

                                >;

                };

        };

#endif

After Linux boots up I get the following in dmesg:

DBG sensor data is at 7f002110

adv7180 1-0020: no sensor pwdn pin available

ERROR: v4l2 capture: slave not found!

Additionaly v4l2 dmesg entries:

root@linaro-ubuntu-desktop:~# dmesg | grep v4l2

mxc_v4l2_output v4l2_out.29: V4L2 device registered as video16

mxc_v4l2_output v4l2_out.29: V4L2 device registered as video17

mxc_v4l2_output v4l2_out.29: V4L2 device registered as video18

mxc_v4l2_output v4l2_out.29: V4L2 device registered as video19

ERROR: v4l2 capture: slave not found!

Both PCAM_ON_CSI0 and PCAM_ON_CSI1 are floating from the Module.

With the bindings I have also swapped CSI ID to 0, but same output.

I currently have no clue to what is going wrong.

Any advice or suggestion I would really appreaciate. Also, which tool from the v4l2 packages can i use to simply test if the camera is detected.?

Labels (4)
6 Replies

1,678 Views
josa
Contributor II

Hi

I am also trying to get an ADV7180 working on imx6, i use a karo tx6 imx6dl module.

(i have a kernel 3.16 and also a kernel 4.3 running with a display )

I am only getting the i2c driver loaded, but am stuck with the CSI & V4l drivers not loading ( no /dev/video0 ...)

Could you help me ?

Best regards ,Johan (sagaert.johan@skynet.be)

i have this in mijn main dts section :

cap0: v4l2_cap_0 {

        compatible = "fsl,imx6q-v4l2-capture";

        ipu_id = <0>;

        csi_id = <0>;

        mclk_source = <0>;

        status = "okay";

    };

and at the end:

&i2c3 {

    status = "okay";

       

    /* Analog VideoIn */

    videoin: adv7180@20 {

        compatible = "adi,adv7180";

        reg = <0x20>;

        pinctrl-names = "default";

        pinctrl-0 = <&pinctrl_ipu1>; /* IPU1_CSI0 no DE */

        clocks = <&clks 201>;

        clock-names = "csi_mclk";

        DOVDD-supply = <&reg_3v3>;

        AVDD-supply = <&reg_arm>;

        DVDD-supply = <&reg_arm>;

        PVDD-supply = <&reg_arm>;

        pwn-gpios = <&gpio5 20 GPIO_ACTIVE_LOW>;  /* powerdown */

        /* mclk required but not used */

        mclk = <24000000>;

        mclk_source = <0>;

        ipu_id = <0>;

        csi_id = <0>;

        cvbs = <1>;

       

        port {

                /* With 1 endpoint per port no need for addresses. */

                adv7180_1: endpoint {

                    bus-width = <8>;

                    remote-endpoint = <&csi0>;

                    hsync-active = <1>;

                    vsync-active = <0>;

                    data-active = <1>;

                    pclk-sample = <1>;

                };

        };

    };

};

&ipu1

{

    ipu1_csi0: port@0 {

                     #address-cells = <1>;

                       #size-cells = <0>;

                       reg = <0>;

                       /* Parallel bus */

                       csi0: endpoint@0 {

                           reg = <0>;

                           remote-endpoint = <&videoin>;

                       };

              };

};

&iomuxc {

    videoin {

            pinctrl_ipu1: ipu1grp { /* IPU1_CSI0: 8-bit input */

            fsl,pins = <

                MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12        0x80000000

                MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13        0x80000000

                MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14        0x80000000

                MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15        0x80000000

                MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16        0x80000000

                MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17        0x80000000

                MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18        0x80000000

                MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19        0x80000000

                MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK    0x80000000

                MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC        0x80000000

                MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC        0x80000000

            >;

        };

    };

};

0 Kudos

1,678 Views
michik
Contributor I


next steps ---
Following the parallel Camera section from the SMARC design guide I pull the pin PCAM_ON_CSI1 to GND.

As a next step I figured out I was missing the required ipu2 settings including port related information. So here is my current configuration:

#ifdef SMX6_CPU_IMX6Q

        adv7180: adv7180@20 {

                compatible = "adv,adv7180";

                reg = <0x20>;

                pinctrl-names = "default";

                pinctrl-0 = <&pinctrl_ipu2_csi>;

                clocks = <&clks 201>;

                clock-names = "csi_mclk";

                DOVDD-supply = <&reg_3p3v>; /* 3.3v, enabled via 2.8 VGEN6 */

                AVDD-supply = <&reg_3p3v>;  /* 1.8v */

                DVDD-supply = <&reg_3p3v>;  /* 1.8v */

                PVDD-supply = <&reg_3p3v>;  /* 1.8v */

                pwn-gpios = <&gpio3 16 0>; /* currently on an undefied gpio */

                rst-gpios = <&gpio3 3 0>;  /* tied to P111 GPIO3_CAM1_RST */

                csi_id = <1>;

                mclk = <24000000>;

                mclk_source = <0>;

                cvbs = <1>;

                         port {

                                adv7180_1: endpoint {

                                remote-endpoint = <&csi1>;

                                bus-width = <8>;

                                 data-shift = <12>; /* Lines 19:12 used */

                                hsync-active = <1>;

                                vsync-active = <1>;

                                inputs = <0x00 0x01>;

                                input-names = "ADV7180 Composite on Ain1",

                                               "ADV7180 Composite on Ain2";

                              };

                        };

                };

#endif

/

soc {

                ipu2: ipu@02800000 {

                        compatible = "fsl,imx6q-ipu";

//                      compatible = "fsl,imx6q-ipuv3";

                        reg = <0x02800000 0x400000>;

                        interrupts = <0 8 0x4 0 7 0x4>;

                        clocks = <&clks 133>, <&clks 134>, <&clks 137>, <&clks 41>, <&clks 42>;

//                      clock-names = "bus", "di0", "di1", "di0_sel", "di1_sel", "ldb_di0", "ldb_di1";

                        clock-names = "ipu2", "ipu2_di0", "ipu2_di1", "ipu2_di0_sel", "ipu2_di1_sel";

                        resets = <&src 4>;

                        bypass_reset = <0>;

                        ipu2_csi0: port@0 {

                                reg = <0>;

                        };

                        ipu2_csi1: port@1 {

                               #address-cells = <1>;

                               #size-cells = <0>;

                               reg = <1>;

                                /* Parallel bus */

                                csi1: endpoint@0 {

                                reg = <0>;

                                remote-endpoint = <&adv7180_1>;

                       };

               };

                };

};

Now I get the following error on Linux boot-up:

DBG sensor data is at 7f002110

ERROR: v4l2 capture: get invalid ipu

Unable to handle kernel NULL pointer dereference at virtual address 00000034

pgd = a8b9c000

[00000034] *pgd=389d8831, *pte=00000000, *ppte=00000000

Internal error: Oops: 817 [#1] PREEMPT SMP ARM

Modules linked in: mxc_v4l2_capture(+) ipu_fg_overlay_sdc ipu_csi_enc ipu_prp_enc ipu_still ipu_bg_overlay_sdc adv7180_tvin

CPU: 3 PID: 483 Comm: modprobe Not tainted 3.10.17-rel1.0+g232293e #3

task: a8ae1a40 ti: a8b6e000 task.ti: a8b6e000

PC is at mxc_v4l2_probe+0x348/0x4ac [mxc_v4l2_capture]

LR is at mxc_v4l2_probe+0x494/0x4ac [mxc_v4l2_capture]

pc : [<7f01e6fc>]    lr : [<7f01e848>]    psr: 400f0013

sp : a8b6fd88  ip : 00000000  fp : 00000000

r10: a85d6fe4  r9 : 7f020cbc  r8 : 8105ad0c

r7 : a81a5e10  r6 : 808243d8  r5 : 7f021d28  r4 : a8772000

r3 : 00000000  r2 : a8b6fd00  r1 : 81076a94  r0 : 00000024

Flags: nZcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user

Control: 10c53c7d  Table: 38b9c04a  DAC: 00000015

Process modprobe (pid: 483, stack limit = 0xa8b6e238)

Stack: (0xa8b6fd88 to 0xa8b70000)

...

...

...

Code: e5853160 e3015d28 e5943874 e3475f02 (e5834034)

---[ end trace 789dd23e0b664d13 ]---

I notice my IPU is not being properly initialized. May be I am not feeding/connecting the clocks & clock-names correctly. At this point I would really appreciate an IPU expert to comment on this.

0 Kudos

1,678 Views
timharvey
Contributor IV

Michael,

We use the adv7180 on the Gateworks Ventana boards. You can take a look at our 3.10.17 kernel here: Gateworks/linux-imx6 at gateworks_3.10.17_1.0.0_ga · GitHub

Specifically, take a look at the device-tree setups in arch/arm/boot/dts/imx6qdl-gw*.dts* and the patches I have made to the adv7180 driver. I suspect perhaps you need the following patch that sets IOMUXC_GPR1 properly: media: adv7180: set IOMUX_GPR for enabling parallel bus · Gateworks/linux-imx6@1b37ca7 · GitHub . You may also be interested in a patch that fixes media detection: media: adv7180: fixed media detection · Gateworks/linux-imx6@40596ce · GitHub . Also I see that your device-tree is using 0x80000000 for the pinmux configs which tells the iomux driver to configure pinmux but not padctl meaning padctl is whatever it was when the processor came out of reset or whatever the bootloader set it to. While this may not be an issue for you (check the padctl's) it is generally agreed that you should specify a valid padctl in the device-tree files.

I'm not familiar with the 'port' device-tree node configuration you've added - that looks like something that is recent in mainline Linux but not Freescale's 3.10 kernel.

With regards to which input is selected, that is outside of the scope of the capture driver - I always just tell our users to select the input with i2c-tools - see Yocto/Video_In – Gateworks

Hope this helps,

Tim

1,678 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi,

After checking at the linux Documentation/devicetree/bindings I cannot find a way to describe that the adv7180 decoder will use 2 inputs.

I checked L3.14.28 but it seems that the documentation for the adv7180 was removed.

FabioEstevam​  sorry to bother you, but I wonder if you have a clue  about this.

Thanks a lot,

/Alejandro

0 Kudos

1,678 Views
fabio_estevam
NXP Employee
NXP Employee

Hi Alejandro,

Sorry, not familar with this driver.

0 Kudos

1,678 Views
alejandrolozan1
NXP Employee
NXP Employee

I understand Fabio.
Do you know who might be able to provide some information?

Best Regards,

Alejandro

0 Kudos