drm/tidss: Add support for AM625 DSS
authorAradhya Bhatia <a-bhatia1@ti.com>
Fri, 16 Jun 2023 15:09:00 +0000 (20:39 +0530)
committerTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Mon, 19 Jun 2023 08:30:12 +0000 (11:30 +0300)
Add support for the DSS controller on TI's AM625 SoC in the tidss
driver.

The AM625 DSS supports 2 video planes connecting to 2 video ports.
The first plane is a full plane supporting all the features, while the
2nd plane is a "lite" plane without scaling support.

The first video port in AM625 DSS internally provides DPI output to 2
OLDI transmitters. Each OLDI TX outputs 4 differential lanes of video
output and 1 of clock output.

This patch does not automatically enable the OLDI features of AM625 yet.
That support for OLDI will be added subsequently.

The second video port outputs DPI data directly out of the SoC. It has
24 data lines and can support a maximum of RGB888 output bus format.

Signed-off-by: Aradhya Bhatia <a-bhatia1@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230616150900.6617-3-a-bhatia1@ti.com
drivers/gpu/drm/tidss/tidss_dispc.c
drivers/gpu/drm/tidss/tidss_dispc.h
drivers/gpu/drm/tidss/tidss_drv.c

index dca077411f77ccbcb5d110f699b7018bdd7331bc..484da1aa27bbcccfac29f85cf76c1dfdd50caf68 100644 (file)
@@ -275,6 +275,55 @@ const struct dispc_features dispc_j721e_feats = {
        .vid_order = { 1, 3, 0, 2 },
 };
 
+const struct dispc_features dispc_am625_feats = {
+       .max_pclk_khz = {
+               [DISPC_VP_DPI] = 165000,
+               [DISPC_VP_INTERNAL] = 170000,
+       },
+
+       .scaling = {
+               .in_width_max_5tap_rgb = 1280,
+               .in_width_max_3tap_rgb = 2560,
+               .in_width_max_5tap_yuv = 2560,
+               .in_width_max_3tap_yuv = 4096,
+               .upscale_limit = 16,
+               .downscale_limit_5tap = 4,
+               .downscale_limit_3tap = 2,
+               /*
+                * The max supported pixel inc value is 255. The value
+                * of pixel inc is calculated like this: 1+(xinc-1)*bpp.
+                * The maximum bpp of all formats supported by the HW
+                * is 8. So the maximum supported xinc value is 32,
+                * because 1+(32-1)*8 < 255 < 1+(33-1)*4.
+                */
+               .xinc_max = 32,
+       },
+
+       .subrev = DISPC_AM625,
+
+       .common = "common",
+       .common_regs = tidss_am65x_common_regs,
+
+       .num_vps = 2,
+       .vp_name = { "vp1", "vp2" },
+       .ovr_name = { "ovr1", "ovr2" },
+       .vpclk_name =  { "vp1", "vp2" },
+       .vp_bus_type = { DISPC_VP_INTERNAL, DISPC_VP_DPI },
+
+       .vp_feat = { .color = {
+                       .has_ctm = true,
+                       .gamma_size = 256,
+                       .gamma_type = TIDSS_GAMMA_8BIT,
+               },
+       },
+
+       .num_planes = 2,
+       /* note: vid is plane_id 0 and vidl1 is plane_id 1 */
+       .vid_name = { "vid", "vidl1" },
+       .vid_lite = { false, true, },
+       .vid_order = { 1, 0 },
+};
+
 static const u16 *dispc_common_regmap;
 
 struct dss_vp_data {
@@ -776,6 +825,7 @@ dispc_irq_t dispc_read_and_clear_irqstatus(struct dispc_device *dispc)
        switch (dispc->feat->subrev) {
        case DISPC_K2G:
                return dispc_k2g_read_and_clear_irqstatus(dispc);
+       case DISPC_AM625:
        case DISPC_AM65X:
        case DISPC_J721E:
                return dispc_k3_read_and_clear_irqstatus(dispc);
@@ -791,6 +841,7 @@ void dispc_set_irqenable(struct dispc_device *dispc, dispc_irq_t mask)
        case DISPC_K2G:
                dispc_k2g_set_irqenable(dispc, mask);
                break;
+       case DISPC_AM625:
        case DISPC_AM65X:
        case DISPC_J721E:
                dispc_k3_set_irqenable(dispc, mask);
@@ -1281,6 +1332,7 @@ void dispc_ovr_set_plane(struct dispc_device *dispc, u32 hw_plane,
                dispc_k2g_ovr_set_plane(dispc, hw_plane, hw_videoport,
                                        x, y, layer);
                break;
+       case DISPC_AM625:
        case DISPC_AM65X:
                dispc_am65x_ovr_set_plane(dispc, hw_plane, hw_videoport,
                                          x, y, layer);
@@ -2199,6 +2251,7 @@ static void dispc_plane_init(struct dispc_device *dispc)
        case DISPC_K2G:
                dispc_k2g_plane_init(dispc);
                break;
+       case DISPC_AM625:
        case DISPC_AM65X:
        case DISPC_J721E:
                dispc_k3_plane_init(dispc);
@@ -2305,6 +2358,7 @@ static void dispc_vp_write_gamma_table(struct dispc_device *dispc,
        case DISPC_K2G:
                dispc_k2g_vp_write_gamma_table(dispc, hw_videoport);
                break;
+       case DISPC_AM625:
        case DISPC_AM65X:
                dispc_am65x_vp_write_gamma_table(dispc, hw_videoport);
                break;
@@ -2579,7 +2633,8 @@ int dispc_runtime_resume(struct dispc_device *dispc)
                REG_GET(dispc, DSS_SYSSTATUS, 2, 2),
                REG_GET(dispc, DSS_SYSSTATUS, 3, 3));
 
-       if (dispc->feat->subrev == DISPC_AM65X)
+       if (dispc->feat->subrev == DISPC_AM625 ||
+           dispc->feat->subrev == DISPC_AM65X)
                dev_dbg(dispc->dev, "OLDI RESETDONE %d,%d,%d\n",
                        REG_GET(dispc, DSS_SYSSTATUS, 5, 5),
                        REG_GET(dispc, DSS_SYSSTATUS, 6, 6),
index 946ed769caaf6a275be87d5a43ba337cea24331b..33ac5ad7a423d54a6bfc653747ab2738d6a3b429 100644 (file)
@@ -59,6 +59,7 @@ enum dispc_vp_bus_type {
 
 enum dispc_dss_subrevision {
        DISPC_K2G,
+       DISPC_AM625,
        DISPC_AM65X,
        DISPC_J721E,
 };
@@ -86,6 +87,7 @@ struct dispc_features {
 };
 
 extern const struct dispc_features dispc_k2g_feats;
+extern const struct dispc_features dispc_am625_feats;
 extern const struct dispc_features dispc_am65x_feats;
 extern const struct dispc_features dispc_j721e_feats;
 
index b00eecb2293f05d0a46a7b02a221ac035ca18c34..b88a0b123005d509e98b0708f9e184d62aa74588 100644 (file)
@@ -230,6 +230,7 @@ static void tidss_shutdown(struct platform_device *pdev)
 
 static const struct of_device_id tidss_of_table[] = {
        { .compatible = "ti,k2g-dss", .data = &dispc_k2g_feats, },
+       { .compatible = "ti,am625-dss", .data = &dispc_am625_feats, },
        { .compatible = "ti,am65x-dss", .data = &dispc_am65x_feats, },
        { .compatible = "ti,j721e-dss", .data = &dispc_j721e_feats, },
        { }