AM67: dsi display testing

Part Number: AM67

Tool/software:

Hi 

Target:

i was working on a special case need to measure the dsi signal from am67

There are few methods i try it bf

  • loading k3-j722s-evm-dsi-rpi-7inch-panel.dtbo in the device and overlay in the nEnv.txt
  •  i try to modified driver as a fake panel to output
    1. still using k3-j722s-evm-dsi-rpi-7inch-panel.dtbo as device tree
    2. modified panel-simple.c 
      1. ->panel_simple_get_modes
        1. fose to one mode and fixed reolution
        2. add hard-coded panel modes
  • Result->

mipi-dsi 30500000.dsi.0: deferred probe pending: mipi-dsi: supplier bridge-regulator not ready

platform bridge-regulator: deferred probe pending: platform: supplier 3-0045 not ready

platform 30220000.dss: deferred probe pending: tidss: port 1 probe failed

As i know, mostly dsi panel needs to connect to the bridge.

So i decide to pass the check from driver

  • bypassing power dependency checks
  • cdns-dsi.c
    • without bridge
    • force marking DSI host as ready
  • tidss_drv.c
    • tidss_probe->force enabling port 


but i can't find cdns-dsi.c in the sdk 

could you tell me where is the cdns-dsi.c location

Or could you tell me what method i can bypass directly detect dsi signal from am67

CPU → DSI Controller → DSI Panel

  • Hello,

    The concerned expert is out of office today. Please expect a response by Monday.

    Regards,

    Nihar Potturu

  • Hi,
    Are you looking for: drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c ?

  • Yes, appreciate that. i have no idea, it got -core after dsi.

    Another interesting thing i found, there is  Test Pattern Generator (TVG) in the cdns-dsi-core.c

    could you provide the enable method for us to open tvg on the evm to output dsi signal for testing?

    thx

    will

  • yes, i understand the debugging process as link.

    But all the methods need the dsi panel connected to evm, and that's what we try bf. The main target for us is to isolate the problem, that's why we need the dsi output only without any connection.

    So as my understand, this "modetest -M tidss -s 50@48:1920x1080 -s 40@38:1920x1200" is an output test pattern.

    I'll fix the config as an input so that i can output without a connection, i'll let you know the good news.

  • Hi Divyansh,

    i just try the driver i mpodified to open test patten after probe.

    And i can measure the clk p and clk n, and also 3.3v 
    Could i clam that the 3.3v output mean drm and test patten is workable? because there is no reason my data output smaller than 100mv, it doesn't seems correct.

    thx

    Will 

  • Hi,
    For k3-j722s-evm-dsi-rpi-7inch-panel.dtbo, you need an RPi panel connected to the board, since there is an initial handshake in the driver which fails and throws those errors. Please connect the panel before proceeding further.

  • Hi Divyansh,

    I modified the cdns-dsi-core.c

    The mindset is when cdns driver probe success 

    cdns_dsi_drm_probe
    start clock
    arrange tvg test patten


    probe function as below 

    static int cdns_dsi_drm_probe(struct platform_device *pdev)
    {
    struct cdns_dsi *dsi;
    struct cdns_dsi_input *input;
    int ret, irq;
    u32 val,tmp;

    dsi = devm_kzalloc(&pdev->dev, sizeof(*dsi), GFP_KERNEL);
    if (!dsi)
    return -ENOMEM;

    platform_set_drvdata(pdev, dsi);

    input = &dsi->input;

    dsi->regs = devm_platform_ioremap_resource(pdev, 0);
    if (IS_ERR(dsi->regs))
    return PTR_ERR(dsi->regs);

    dsi->dsi_p_clk = devm_clk_get(&pdev->dev, "dsi_p_clk");
    if (IS_ERR(dsi->dsi_p_clk))
    return PTR_ERR(dsi->dsi_p_clk);

    dsi->dsi_p_rst = devm_reset_control_get_optional_exclusive(&pdev->dev,
    "dsi_p_rst");
    if (IS_ERR(dsi->dsi_p_rst))
    return PTR_ERR(dsi->dsi_p_rst);

    dsi->dsi_sys_clk = devm_clk_get(&pdev->dev, "dsi_sys_clk");
    if (IS_ERR(dsi->dsi_sys_clk))
    return PTR_ERR(dsi->dsi_sys_clk);

    irq = platform_get_irq(pdev, 0);
    if (irq < 0)
    return irq;

    dsi->dphy = devm_phy_get(&pdev->dev, "dphy");
    if (IS_ERR(dsi->dphy))
    return PTR_ERR(dsi->dphy);

    ret = clk_prepare_enable(dsi->dsi_p_clk);
    if (ret)
    return ret;

    val = readl(dsi->regs + ID_REG);
    if (REV_VENDOR_ID(val) != 0xcad) {
    dev_err(&pdev->dev, "invalid vendor id\n");
    ret = -EINVAL;
    goto err_disable_pclk;
    }

    dsi->platform_ops = of_device_get_match_data(&pdev->dev);

    val = readl(dsi->regs + IP_CONF);
    dsi->direct_cmd_fifo_depth = 1 << (DIRCMD_FIFO_DEPTH(val) + 2);
    dsi->rx_fifo_depth = RX_FIFO_DEPTH(val);
    init_completion(&dsi->direct_cmd_comp);

    writel(0, dsi->regs + MCTL_MAIN_DATA_CTL);
    writel(0, dsi->regs + MCTL_MAIN_EN);
    writel(0, dsi->regs + MCTL_MAIN_PHY_CTL);

    /*
    * We only support the DPI input, so force input->id to
    * CDNS_DPI_INPUT.
    */
    input->id = CDNS_DPI_INPUT;
    input->bridge.funcs = &cdns_dsi_bridge_funcs;
    input->bridge.of_node = pdev->dev.of_node;

    /* Mask all interrupts before registering the IRQ handler. */
    writel(0, dsi->regs + MCTL_MAIN_STS_CTL);
    writel(0, dsi->regs + MCTL_DPHY_ERR_CTL1);
    writel(0, dsi->regs + CMD_MODE_STS_CTL);
    writel(0, dsi->regs + DIRECT_CMD_STS_CTL);
    writel(0, dsi->regs + DIRECT_CMD_RD_STS_CTL);
    writel(0, dsi->regs + VID_MODE_STS_CTL);
    writel(0, dsi->regs + TVG_STS_CTL);
    writel(0, dsi->regs + DPI_IRQ_EN);
    ret = devm_request_irq(&pdev->dev, irq, cdns_dsi_interrupt, 0,
    dev_name(&pdev->dev), dsi);
    if (ret)
    goto err_disable_pclk;

    pm_runtime_enable(&pdev->dev);
    dsi->base.dev = &pdev->dev;
    dsi->base.ops = &cdns_dsi_ops;

    if (dsi->platform_ops && dsi->platform_ops->init) {
    ret = dsi->platform_ops->init(dsi);
    if (ret != 0) {
    dev_err(&pdev->dev, "platform initialization failed: %d\n",
    ret);
    goto err_disable_runtime_pm;
    }
    }

    ret = mipi_dsi_host_register(&dsi->base);
    if (ret)
    goto err_deinit_platform;

    clk_disable_unprepare(dsi->dsi_p_clk);
    // ==================== boot then start test mode ====================
    // 重新啟用時鐘以便配置 TVG
    ret = clk_prepare_enable(dsi->dsi_p_clk);
    if (ret) {
    dev_warn(&pdev->dev, "Failed to enable clock for TVG, but continuing...\n");
    } else {
    // 配置 TVG 測試圖案 - 800x480 垂直條紋
    writel(TVG_LINE_SIZE(800) | TVG_NBLINES(480), dsi->regs + TVG_IMG_SIZE);
    writel(TVG_COL1_RED(0xFF) | TVG_COL1_GREEN(0x00), dsi->regs + TVG_COLOR1);
    writel(TVG_COL1_BLUE(0x00), dsi->regs + TVG_COLOR1_BIS);
    writel(TVG_STRIPE_SIZE(40) | TVG_MODE_VSTRIPES | TVG_RUN, dsi->regs + TVG_CTL);

    // 選擇 TVG 作為數據源
    tmp = readl(dsi->regs + MCTL_MAIN_DATA_CTL);
    tmp |= TVG_SEL; // 啟用 TVG
    tmp &= ~IF_VID_MODE; // 禁用 Video Mode
    writel(tmp, dsi->regs + MCTL_MAIN_DATA_CTL);

    clk_disable_unprepare(dsi->dsi_p_clk);

    dev_info(&pdev->dev, "DSI TVG test pattern enabled on boot - Vertical Stripes 800x480\n");
    }
    // ====================test mode finished ====================


    return 0;

    err_deinit_platform:
    if (dsi->platform_ops && dsi->platform_ops->deinit)
    dsi->platform_ops->deinit(dsi);

    err_disable_runtime_pm:
    pm_runtime_disable(&pdev->dev);

    err_disable_pclk:
    clk_disable_unprepare(dsi->dsi_p_clk);

    return ret;
    }
  • As discussed offline, you are currently working on enabling 4 lanes instead of 1 in the driver. Feel free to ping on this thread for any further queries.

  • Yes, i missed this information. I'm modified the 4 lanes driver. And i'll let you know if it work s or not. It's good method for customer to verified the dsi signal. 

  • Hi Divyansh,

    Sorry to say that, i was missed the information, the output signal should keep in video mode -> so my solution doesn't match the situation.

    So my new method would like to modify tidss_drv.c->tidss_probe

    ->

    for (i = 0; i < tidss->dispc->num_ports; i++) {
    tidss->dispc->ports[i].available = true;
    tidss->dispc->ports[i].enabled = true;
    dev_info(dev, "Force enabling display port %d\n", i);
    }
    // ==================

    My question is which file i should switch, bc i didn't see the tidss_drv.ko in the device.

    thx

    Will

  • Not sure I understand your question. I see the following on the device:

    root@am62pxx-evm:~# find / | grep tidss
    /usr/lib/modules/6.12.35-ti-00915-ge3e551586dfa/kernel/drivers/gpu/drm/tidss
    /usr/lib/modules/6.12.35-ti-00915-ge3e551586dfa/kernel/drivers/gpu/drm/tidss/tidss.ko
    /usr/lib/modules/6.12.35-ge3e551586dfa-dirty/kernel/drivers/gpu/drm/tidss
    /usr/lib/modules/6.12.35-ge3e551586dfa-dirty/kernel/drivers/gpu/drm/tidss/tidss.ko
    /usr/lib/dri/tidss_dri.so

  • Hi Divyansh,

    Yes, appreciate that. 

    I have a free question about control the direct frame buffer.

    When i was working on this case. I found that the menuconfig for kernel have a option can control frame buffer.

    Do you have any example or usecase on open kernel config to control frame buffer for testing the display signal?

    Thx 

    Will

  • Not sure I got which config you are pointing to, can you provide its name: CONFIG_xxxxx.

  • Hi Divyansh,

    As I know ti drm/kms system provides a test pattern function.

    So, i plane to call test patten api or function in the panel-simple.c
    Could you tell me where can i find the test pattern function or api to call?

    I'm not sure which one is correct it call at too many places

    Thx

  • Do you mean the following?

    kmsxxtest --device=/dev/dri/by-path/platform-30220000.dss-card

    Note kmsxxtest is kmstest in SDK < 11.1.

  • No, this is an application.

    I'm asking for the library such as 

    dispc_set_test_pattern
    {}

    Maybe in the Tidss_CRTC or others  but i'm asking where  they called the test pattern function.

    I miss around bc too many test pattern libraries i do like to know which is the core one? 

    thx

    Will

  • I don't know of any test pattern libraries included within the core DRM framework. The primary search results I see for test_pattern are for vendor specific augmentations of the driver but not in the core driver. This would be expected because, even if you have something like that in the core framework, you would need a userspace app to actually call that.

    Instead, we directly use userpace app to create test patterns. Maybe tracing the system calls in https://github.com/tomba/kmsxx/tree/master/utils example help your case?

  • Divyansh,


    1. Under DRM, is there a way to output DSI signal if panel or target device is not connected? Is there a dummy node which we can output DSI signal without real device?

    2. Is there a simple way to generate test patten under DRM with or without panel/device? 

    3. Without DRM, can we do the same with direct frame buffer to output DSI signals?

    4. Without DRM, can we output test pattern with direct frame buffer to output DSI signals?

    BR, Rich  

  • Hi Rich,
    1. No. The driver expects and check for the panel connected, including checking existence of device regulator and touch controllers on the panel. Without this the probe will fail.
    2. Device will get registered within DRM only after its probe is successful. DRM driver itself does not have a test pattern generator. You may check the TVG pattern generator at [FAQ] AM62P: Display SubSystem (DSS): Basic Debugging and Forum Best Practices But note: this will generate pattern from the DSI bridge and not from DSS. Not sure if this is useful to your case. We typically use this when the driver probes and you do not see a screen display. Not sure if it is helpful if your driver itself is not probing successfully.
    3,4. Framebuffer based approach is legacy and we no more support that. You can enable CONFIG_FBDEV_EMULATION to enumerate fb devices but we will not be able to help with any tests/experiments using that.