From 1543e317f1da31b75942316931e8f491a8920811 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Thu, 04 Jan 2024 10:08:02 +0000
Subject: [PATCH] disable FB
---
kernel/drivers/gpu/drm/bridge/adv7511/adv7533.c | 28 +++++++++++++---------------
1 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/kernel/drivers/gpu/drm/bridge/adv7511/adv7533.c b/kernel/drivers/gpu/drm/bridge/adv7511/adv7533.c
index aa19d5a..e0bdedf 100644
--- a/kernel/drivers/gpu/drm/bridge/adv7511/adv7533.c
+++ b/kernel/drivers/gpu/drm/bridge/adv7511/adv7533.c
@@ -100,26 +100,24 @@
regmap_write(adv->regmap_cec, 0x27, 0x0b);
}
-void adv7533_mode_set(struct adv7511 *adv, const struct drm_display_mode *mode)
+enum drm_mode_status adv7533_mode_valid(struct adv7511 *adv,
+ const struct drm_display_mode *mode)
{
+ unsigned long max_lane_freq;
struct mipi_dsi_device *dsi = adv->dsi;
- int lanes, ret;
+ u8 bpp = mipi_dsi_pixel_format_to_bpp(dsi->format);
- if (adv->num_dsi_lanes != 4)
- return;
+ /* Check max clock for either 7533 or 7535 */
+ if (mode->clock > (adv->type == ADV7533 ? 80000 : 148500))
+ return MODE_CLOCK_HIGH;
- if (mode->clock > 80000)
- lanes = 4;
- else
- lanes = 3;
+ /* Check max clock for each lane */
+ max_lane_freq = (adv->type == ADV7533 ? 800000 : 891000);
- if (lanes != dsi->lanes) {
- mipi_dsi_detach(dsi);
- dsi->lanes = lanes;
- ret = mipi_dsi_attach(dsi);
- if (ret)
- dev_err(&dsi->dev, "failed to change host lanes\n");
- }
+ if (mode->clock * bpp > max_lane_freq * adv->num_dsi_lanes)
+ return MODE_CLOCK_HIGH;
+
+ return MODE_OK;
}
int adv7533_patch_registers(struct adv7511 *adv)
--
Gitblit v1.6.2