Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test LVDS controller #15

Open
2 of 4 tasks
EvanKrall opened this issue Jul 7, 2021 · 5 comments
Open
2 of 4 tasks

test LVDS controller #15

EvanKrall opened this issue Jul 7, 2021 · 5 comments
Assignees

Comments

@EvanKrall
Copy link
Owner

EvanKrall commented Jul 7, 2021

  • see if it enumerates on i2c
  • Write device tree overlay
  • figure out mode line?
  • ???
@EvanKrall EvanKrall self-assigned this Jul 7, 2021
@EvanKrall
Copy link
Owner Author

EvanKrall commented Aug 6, 2021

For posterity, my attempt at a kernel patch to drive this thing:

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 204674fccd64..eb1a5950247c 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -2570,15 +2570,15 @@ static const struct panel_desc lg_lp079qx1_sp0v = {
 };

 static const struct drm_display_mode lg_lp097qx1_spa1_mode = {
-       .clock = 205210,
-       .hdisplay = 2048,
-       .hsync_start = 2048 + 150,
-       .hsync_end = 2048 + 150 + 5,
-       .htotal = 2048 + 150 + 5 + 5,
-       .vdisplay = 1536,
-       .vsync_start = 1536 + 3,
-       .vsync_end = 1536 + 3 + 1,
-       .vtotal = 1536 + 3 + 1 + 9,
+       .clock = 205210,  // KHz
+       .hdisplay = 2048,  // Active
+       .hsync_start = 2048 + 150,  // Active + HFP
+       .hsync_end = 2048 + 150 + 5, // Active + HFP + Width-Active
+       .htotal = 2048 + 150 + 5 + 5, // Active + HFP + Width-Active + HBP
+       .vdisplay = 1536, // Active
+       .vsync_start = 1536 + 3, // Active + VFP
+       .vsync_end = 1536 + 3 + 1, // Active + VFP + Width-Active
+       .vtotal = 1536 + 3 + 1 + 9, // Active + VFP + Width-Active + VBP
 };

 static const struct panel_desc lg_lp097qx1_spa1 = {
@@ -3889,6 +3889,30 @@ static const struct drm_display_mode arm_rtsm_mode[] = {
        },
 };

+
+static const struct drm_display_mode lg_lp097x02_slq1_mode = {
+       .clock = 100030,  // KHz
+       .hdisplay = 1024,  // Active
+       .hsync_start = 1024 + 260,  // Active + HFP
+       .hsync_end = 1024 + 260 + 320, // Active + HFP + Width-Active
+       .htotal = 1024 + 260 + 320 + 480, // Active + HFP + Width-Active + HBP
+       .vdisplay = 768, // Active
+       .vsync_start = 768 + 16, // Active + VFP
+       .vsync_end = 768 + 16 + 10, // Active + VFP + Width-Active
+       .vtotal = 768 + 16 + 10 + 6, // Active + VFP + Width-Active + VBP
+};
+
+static const struct panel_desc lg_lp097x02_slq1 = {
+       .modes = &lg_lp097qx1_spa1_mode,
+       .num_modes = 1,
+       .size = {
+               .width = 210,
+               .height = 164,
+       },
+};
+
+
+
 static const struct panel_desc arm_rtsm = {
        .modes = arm_rtsm_mode,
        .num_modes = 1,
@@ -4300,6 +4324,9 @@ static const struct of_device_id platform_of_match[] = {
        }, {
                .compatible = "winstar,wf35ltiacd",
                .data = &winstar_wf35ltiacd,
+       }, {
+               .compatible = "lg,lp097x02-slq1",
+               .data = &lg_lp097x02_slq1,
        }, {
                /* Must be the last entry */
                .compatible = "panel-dpi",

I'm roughly following https://github.com/anholt/linux/wiki/Raspberry-Pi-and-other-MIPI-DSI-display-panels , though I'm first starting with panel-simple.c even though I have a bridge chip and it recommends to follow the panel-raspberrypi-touchscreen.c example.

@EvanKrall
Copy link
Owner Author

oh, sweet, someone got support for the sn65dsi83 into the linux kernel a few months ago: https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/bridge/ti-sn65dsi83.c

I guess I'll cherry-pick this.

@EvanKrall
Copy link
Owner Author

Only RGB888 pixel format is implemented, the
LVDS666 is not supported, but could be added if needed.

bummer

@EvanKrall
Copy link
Owner Author

I have this dtoverlay which loads the ti-sn65dsi83 driver:

/dts-v1/;
/plugin/;


/ {
    compatible = "brcm,bcm2835";
    fragment@0 {
        target-path = "/";
        __overlay__ {
            vdd_panel: fixedregulator {
                regulator-boot-on;
                compatible = "regulator-fixed";
                regulator-name = "lvds18";
                regulator-min-microvolt = <1800000>;
                regulator-max-microvolt = <1800000>;
                gpio = <&gpio 26 0>;
                startup-delay-us = <70000>;
                enable-active-high;
                vin-supply = <&vdd_3v3_reg>;
            };

            lcd_bl: backlight {
                compatible = "pwm-backlight";
                pwms = <&pwm 0 200000>;
                brightness-levels = <0 6 8 12 16 24 32 40 48 64 96 128 160 192 224 255>;
                default-brightness-level = <6>;
                power-supply = <&vdd_3v3_reg>;
                enable-gpios = <&gpio 13 0>;
                status = "okay";
            };

            panel_rgb: panel {
              compatible = "lg,lp097x02-slq1";
              // compatible = "koe,tx31d200vm0baa";
              power-supply = <&vdd_panel>;
              // backlight = <&lcd_bl>;
              status = "okay";
              port {
                panel_lvds_in: endpoint {
                  remote-endpoint = <&bridge_lvds_port>;
                };
              };
            };
        };
    };

    fragment@1 {
        target = <&i2c1>;
        __overlay__ {
            #address-cells = <1>;
            #size-cells = <0>;
            status = "okay";

            sn65dsi83_bridge: bridge@2d {
                compatible = "ti,sn65dsi83";
                reg = <0x2d>;
                status = "okay";
                enable-gpios = <&gpio 5 0>;
                power-supply = <&vdd_panel>;

                ports {                
                    #address-cells = <1>;
                    #size-cells = <0>;
                    port@0 {
                        reg = <0>; // TODO: double-check
                        bridge_dsi_port: endpoint {
                            data-lanes = <1 2>;
                            remote-endpoint = <&dsi_out_port>;
                        };
                    };

                    port@2{
                        reg = <2>;
                        bridge_lvds_port: endpoint {
                            remote-endpoint = <&panel_lvds_in>;
                        };
                    };
                };
            };
        };
    };

    fragment@2 {
        target = <&dsi1>;
        __overlay__ {
            compatible = "brcm,bcm2711-dsi1";
            status = "okay";
            port {
                dsi_out_port: endpoint {
                    remote-endpoint = <&bridge_dsi_port>;
                };
            };
        };
    };
};

I've got two problems at the moment:

  1. My backlight lights up, but I don't have any entries under /sys/class/backlight
  2. The screen is black, and at boot I'm getting the error message [ 5.403630] sn65dsi83 1-002d: failed to lock PLL, ret=-110

@EvanKrall
Copy link
Owner Author

I've switched over to the CM4IO using the 22-pin to 15-pin FFC meant for the CSI port, which I think should put clock and data lanes where my board expects them.

Now I'm getting basically this exact error: https://www.raspberrypi.org/forums/viewtopic.php?p=1860828&sid=ad26a9c56f475f1c54610b6eac4ca59f#p1860828

[    5.325798] Bogus possible_crtcs: [ENCODER:31:DSI-31] possible_crtcs=0x0 (full crtc mask=0x1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant