summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/bridge/adv7511
diff options
context:
space:
mode:
authorRobert Chiras <robert.chiras@nxp.com>2019-06-07 10:11:23 +0300
committerDong Aisheng <aisheng.dong@nxp.com>2021-11-02 16:38:43 +0800
commit6aac619d87c57a95ef8c60f99ad6fb1fc2233080 (patch)
treef6998f6e59ac076cf469bf3f5b259b8274e2b0f0 /drivers/gpu/drm/bridge/adv7511
parentd71532359489ce10016c43a0eead7105c16eaff8 (diff)
MLK-21958-13: drm/bridge: adv7511: Limit supported clocks
Some modes are not working with this converter. Until we find a real fix to make any mode working, just limit the supported modes by their clocks. Signed-off-by: Robert Chiras <robert.chiras@nxp.com> Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
Diffstat (limited to 'drivers/gpu/drm/bridge/adv7511')
-rw-r--r--drivers/gpu/drm/bridge/adv7511/adv7511_drv.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
index 5683c2b0efa0..f4578788dc6b 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
@@ -76,6 +76,26 @@ static const uint8_t adv7511_register_defaults[] = {
0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
+/*
+ * TODO: Currently, filter-out unsupported modes by their clocks.
+ * Need to find a better way to do this.
+ * These are the pixel clocks that the converter can handle successfully.
+ */
+
+static const int valid_clocks[] = {
+ 148500,
+ 135000,
+ 132000,
+ 119000,
+ 108000,
+ 78750,
+ 74250,
+ 65000,
+ 49500,
+ 40000,
+ 31500,
+};
+
static bool adv7511_register_volatile(struct device *dev, unsigned int reg)
{
switch (reg) {
@@ -697,9 +717,21 @@ adv7511_detect(struct adv7511 *adv7511, struct drm_connector *connector)
static enum drm_mode_status adv7511_mode_valid(struct adv7511 *adv7511,
struct drm_display_mode *mode)
{
+ size_t i, num_modes = ARRAY_SIZE(valid_clocks);
+ bool clock_ok = false;
+
if (mode->clock > 165000)
return MODE_CLOCK_HIGH;
+ for (i = 0; i < num_modes; i++)
+ if (mode->clock == valid_clocks[i]) {
+ clock_ok = true;
+ break;
+ }
+
+ if (!clock_ok)
+ return MODE_NOCLOCK;
+
return MODE_OK;
}