imx6q sabresd adv7180 android6.0

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

imx6q sabresd adv7180 android6.0

1,309 Views
blackhuang
Contributor I

Dear NXP fae,
I am sorry to bother you. I am using imx6q sabresd to transplant adv7180, and the system is using android6.0
Add the following to the device tree:
adv7180: adv7180@21 {
compatible = "adv,adv7180";
reg = <0x21>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ipu1_2>;
clocks = <&clks 201>;
clock-names = "csi_mclk";
DOVDD-supply = <&vgen6_reg>; /* 3.3v, enabled via 2.8 VGEN6 */
AVDD-supply = <&vgen4_reg>; /* 1.8v */
DVDD-supply = <&vgen4_reg>; /* 1.8v */
PVDD-supply = <&vgen4_reg>; /* 1.8v */

pwn-gpios = <&gpio1 16 1>; /* powerdown */
rst-gpios = <&gpio1 17 1>; /* tied to P111 GPIO3_CAM1_RST */
csi_id = <0>;
mclk = <24000000>;
mclk_source = <0>;
cvbs = <1>;
ipu_id = <1>;

};

the driver use:./drivers/media/platform/mxc/capture/adv7180.c


start logo:
vivid-000: using single planar format API
vivid-000: V4L2 capture device registered as video0
vivid-000: V4L2 output device registered as video1
vivid-000: V4L2 capture device registered as vbi0, supports raw and sliced VBI
vivid-000: V4L2 output device registered as vbi1, supports raw and sliced VBI
vivid-000: V4L2 capture device registered as swradio0
vivid-000: V4L2 receiver device registered as radio0
vivid-000: V4L2 transmitter device registered as radio1
vim2m vim2m.0: Device registered as /dev/video2
DBG sensor data is at c1251cb8
usb 1-1: new high-speed USB device number 2 using ci_hdrc
mxc_v4l2_output v4l2_out: V4L2 device registered as video16
mxc_v4l2_output v4l2_out: V4L2 device registered as video17
usbcore: registered new interface driver uvcvideo

Analog camera inserts:
ERROR: v4l2 capture: slave not found!

I would like to ask if you have any other mistakes.In addition, what is more important is how to conduct the test.
Is it convenient for you to provide relevant documents?

/unit_tests/mxc_v4l2_tvin.out How did the file get there?

No contact before, please give me more advice!!

0 Kudos
7 Replies

1,047 Views
igorpadykov
NXP Employee
NXP Employee

Hi black

for adv7180 one can look at sect.6.1.7 V4L2 Capture attached Linux Manual,

/unit_tests/mxc_v4l2_tvin.out can be found on

mxc_v4l2_test\test - imx-test - i.MX Driver Test Application Software 

also may be useful to check

ADV7180 on IPU2_CSI1 with i.mx6q Device Tree bindings 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,047 Views
blackhuang
Contributor I

hi igorpadykov

                  I can test it now,But the following results:

root@sabresd_6dq:/system/bin #  ./mxc-v4l2-tvin -ow 720 -oh 480
VIDIOC_DBG_G_CHIP_IDENT failed.
Setup v4l capture failed.
255|root@sabresd_6dq:/system/bin # mxc-v4l2-tvin -ow 800 -oh 480 -m 1    
VIDIOC_DBG_G_CHIP_IDENT failed.
Setup v4l capture failed.
255|root@sabresd_6dq:/system/bin # mxc-v4l2-capture  -ow 800 -oh 480 -m 1      
in_width = 176, in_height = 144
out_width = 800, out_height = 480
top = 0, left = 0
VIDIOC_DBG_G_CHIP_IDENT failed.
I did not use modprode to load the adv7180 driver,  It's directly compiled
pastedImage_1.png
   I am using android6.0      kernel is 4.1.15。
I have read your previous reply, but no good solution has been found.
Do you have any good Suggestions? I am looking forward to your help!!
0 Kudos

1,047 Views
igorpadykov
NXP Employee
NXP Employee

there is error "Setup v4l capture failed." - suggest to check

if ADV7180 is communicating through i2c channel.

Best regards
igor

0 Kudos

1,047 Views
blackhuang
Contributor I

hi igorpadykov

                     Thank you very much for your help. I have solved the problem

0 Kudos

1,047 Views
blackhuang
Contributor I

hi igorpadykov

                    Why can't I compile the driver into module,The kernel I used was 4.1.15。

The driver does not use the module to load whether it can

pastedImage_4.png

pastedImage_1.png

by the way,Whether it's related to the display I'm using?

0 Kudos

1,047 Views
blackhuang
Contributor I

hi igorpadykov

            Thank you for help,

  • I don't know how to tell if my I2C signal is normal, My i2c signal is Shared with pmic。

  • static int adv7180_probe(struct i2c_client *client,
    const struct i2c_device_id *id)
    {
    int rev_id;
    int ret = 0;
    u32 cvbs = true;
    struct pinctrl *pinctrl;
    struct device *dev = &client->dev;

    printk("adv7180 had probe ************************************************************\n");
    printk(KERN_ERR"DBG sensor data is at %p\n", &adv7180_data);

    /* ov5640 pinctrl */
    pinctrl = devm_pinctrl_get_select_default(dev);
    if (IS_ERR(pinctrl)) {
    dev_err(dev, "setup pinctrl failed\n");
    return PTR_ERR(pinctrl);
    }

    /* request power down pin */
    pwn_gpio = of_get_named_gpio(dev->of_node, "pwn-gpios", 0);
    if (!gpio_is_valid(pwn_gpio)) {
    dev_err(dev, "no sensor pwdn pin available\n");
    return -ENODEV;
    }
    ret = devm_gpio_request_one(dev, pwn_gpio, GPIOF_OUT_INIT_HIGH,
    "adv7180_pwdn");
    if (ret < 0) {
    dev_err(dev, "no power pin available!\n");
    return ret;
    }

    printk("adv7180 had probe ****************11111111111111******************\n");
    adv7180_regulator_enable(dev);

    adv7180_power_down(0);

    msleep(1);

    /* Set initial values for the sensor struct. */
    memset(&adv7180_data, 0, sizeof(adv7180_data));
    adv7180_data.sen.i2c_client = client;
    adv7180_data.sen.streamcap.timeperframe.denominator = 30;
    adv7180_data.sen.streamcap.timeperframe.numerator = 1;
    adv7180_data.std_id = V4L2_STD_ALL;
    video_idx = ADV7180_NOT_LOCKED;
    adv7180_data.sen.pix.width = video_fmts[video_idx].raw_width;
    adv7180_data.sen.pix.height = video_fmts[video_idx].raw_height;
    adv7180_data.sen.pix.pixelformat = V4L2_PIX_FMT_UYVY; /* YUV422 */
    adv7180_data.sen.pix.priv = 1; /* 1 is used to indicate TV in */
    adv7180_data.sen.on = true;

    adv7180_data.sen.sensor_clk = devm_clk_get(dev, "csi_mclk");

    printk("adv7180 had probe ****************222222222******************\n");


    if (IS_ERR(adv7180_data.sen.sensor_clk)) {
    dev_err(dev, "get mclk failed\n");
    return PTR_ERR(adv7180_data.sen.sensor_clk);
    }

    ret = of_property_read_u32(dev->of_node, "mclk",
    &adv7180_data.sen.mclk);
    if (ret) {
    dev_err(dev, "mclk frequency is invalid\n");
    return ret;
    }

    ret = of_property_read_u32(
    dev->of_node, "mclk_source",
    (u32 *) &(adv7180_data.sen.mclk_source));
    if (ret) {
    dev_err(dev, "mclk_source invalid\n");
    return ret;
    }

    ret = of_property_read_u32(dev->of_node, "csi_id",
    &(adv7180_data.sen.csi));
    if (ret) {
    dev_err(dev, "csi_id invalid\n");
    return ret;
    }

    printk("adv7180 had probe ****************333333333333333******************\n");

    clk_prepare_enable(adv7180_data.sen.sensor_clk);

  • dev_dbg(&adv7180_data.sen.i2c_client->dev,
    "%s:adv7180 probe i2c address is 0x%02X\n",
    __func__, adv7180_data.sen.i2c_client->addr);

  • printk("adv7180 had probe ****************4444444444444444******************\n");

    /*! Read the revision ID of the tvin chip */
    rev_id = adv7180_read(ADV7180_IDENT);
    dev_dbg(dev,
    "%s:Analog Device adv7%2X0 detected!\n", __func__,
    rev_id);

    ret = of_property_read_u32(dev->of_node, "cvbs", &(cvbs));
    if (ret) {
    dev_err(dev, "cvbs setting is not found\n");
    cvbs = true;
    }

    printk("adv7180 had probe ****************5555555555555******************\n");

    /*! ADV7180 initialization. */
    adv7180_hard_reset(cvbs);

    pr_debug(" type is %d (expect %d)\n",
    adv7180_int_device.type, v4l2_int_type_slave);
    pr_debug(" num ioctls is %d\n",
    adv7180_int_device.u.slave->num_ioctls);

    /* This function attaches this structure to the /dev/video0 device.
    * The pointer in priv points to the adv7180_data structure here.*/
    adv7180_int_device.priv = &adv7180_data;
    ret = v4l2_int_device_register(&adv7180_int_device);

    clk_disable_unprepare(adv7180_data.sen.sensor_clk);

    return ret;
    }

I can only see from the logo:

adv7180 had probe ************************************************************
DBG sensor data is at c12557c0
adv7180 had probe ****************11111111111111******************
adv7180 had probe ****************222222222******************
adv7180 had probe ****************333333333333333******************
adv7180 had probe ****************4444444444444444******************
adv7180 had probe ****************5555555555555******************

Can I now tell from the driver whether my i2c signal is normal or not?

If i2c signal is normal, does the logo contain i2c information?

0 Kudos

1,047 Views
blackhuang
Contributor I

Hi igorpadykov

      Thank you very much for your reply !     I found this file in my source code :android/external/linux-test/test     

 

How do I write these files into the system unit_test.  

0 Kudos