Skip to content

Commit 5447f72

Browse files
Gary_Genasus-leslieyu
authored andcommitted
Hdmi: add workaround to avoid display shaking in specific monitor
When detect iex monitor, adjust npll for pixel clock.(1366x768@60, 1360x768@60, 1024x768@75) Change-Id: I054de1c38e68aa4777b9a67df24acbff83308fac
1 parent 8ad1803 commit 5447f72

File tree

6 files changed

+45
-2
lines changed

6 files changed

+45
-2
lines changed

drivers/clk/rockchip/clk-pll.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,6 @@ rockchip_rk3066_pll_clk_set_by_auto(struct rockchip_clk_pll *pll,
350350
}
351351
}
352352
}
353-
354353
/* output the best PLL setting */
355354
if ((nr_out <= PLL_NR_MAX) && (no_out > 0)) {
356355
rate_table->nr = nr_out;
@@ -359,7 +358,6 @@ rockchip_rk3066_pll_clk_set_by_auto(struct rockchip_clk_pll *pll,
359358
} else {
360359
return NULL;
361360
}
362-
363361
return rate_table;
364362
}
365363

@@ -368,8 +366,17 @@ static const struct rockchip_pll_rate_table *rockchip_get_pll_settings(
368366
{
369367
const struct rockchip_pll_rate_table *rate_table = pll->rate_table;
370368
int i;
369+
bool iex_monitor = false;
370+
371+
iex_monitor = detect_iex_monitor();
371372

372373
for (i = 0; i < pll->rate_count; i++) {
374+
if( (rate == 85750000) && !iex_monitor)
375+
continue;
376+
if( (rate == 85500000) && (rate_table[i].nr == 4) && iex_monitor)
377+
continue;
378+
if( (rate == 78750000) && !iex_monitor)
379+
continue;
373380
if (rate == rate_table[i].rate) {
374381
if (i < pll->sel) {
375382
pll->scaling = rate;

drivers/clk/rockchip/clk-rk3288.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ static struct rockchip_pll_rate_table rk3288_npll_rates[] = {
146146
RK3066_PLL_RATE_NB(146250000, 6, 585, 16, 32),
147147
RK3066_PLL_RATE_NB(108000000, 1, 54, 12, 32),
148148
RK3066_PLL_RATE_NB(106500000, 4, 213, 12, 32),
149+
RK3066_PLL_RATE_NB(85750000, 4, 343, 12, 32),//1366*768@60 iex
149150
RK3066_PLL_RATE_NB(85500000, 4, 171, 12, 32),
151+
RK3066_PLL_RATE_NB(85500000, 2, 171, 12, 32),//1360*768@60 iex
152+
RK3066_PLL_RATE_NB(78750000, 4, 210, 16, 32),//1024*768@75 iex
150153
RK3066_PLL_RATE_NB(74250000, 4, 198, 16, 32),
151154
};
152155

drivers/clk/rockchip/clk.h

100644100755
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ struct clk;
185185
#define RK3399_PMU_RSTNHOLD_CON(x) ((x) * 0x4 + 0x120)
186186
#define RK3399_PMU_GATEDIS_CON(x) ((x) * 0x4 + 0x130)
187187

188+
extern bool detect_iex_monitor(void);
189+
188190
enum rockchip_pll_type {
189191
pll_rk3036,
190192
pll_rk3066,

drivers/gpu/drm/drm_edid.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,6 +1264,10 @@ static const u8 edid_header[] = {
12641264
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
12651265
};
12661266

1267+
static const u8 iex_edid[] = {
1268+
0x24, 0xb8, 0x85, 0x01
1269+
};
1270+
12671271
/**
12681272
* drm_edid_header_is_valid - sanity check the header of the base EDID block
12691273
* @raw_edid: pointer to raw base EDID block
@@ -1284,6 +1288,21 @@ int drm_edid_header_is_valid(const u8 *raw_edid)
12841288
}
12851289
EXPORT_SYMBOL(drm_edid_header_is_valid);
12861290

1291+
bool drm_dect_iex_edid(struct edid *edid)
1292+
{
1293+
int i, score = 0;
1294+
u8 *raw_edid = (u8 *)edid;
1295+
for (i = 0; i < sizeof(iex_edid); i++)
1296+
if (raw_edid[8+i] == iex_edid[i])
1297+
score++;
1298+
1299+
if (score == 4)
1300+
return true;
1301+
else
1302+
return false;
1303+
}
1304+
EXPORT_SYMBOL(drm_dect_iex_edid);
1305+
12871306
static int edid_fixup __read_mostly = 6;
12881307
module_param_named(edid_fixup, edid_fixup, int, 0400);
12891308
MODULE_PARM_DESC(edid_fixup,

drivers/gpu/drm/drm_probe_helper.c

100644100755
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
*/
5757

5858
static bool drm_kms_helper_poll = true;
59+
static bool drm_iex_monitor = false;
5960
module_param_named(poll, drm_kms_helper_poll, bool, 0600);
6061

6162
static enum drm_mode_status
@@ -131,6 +132,7 @@ static int drm_helper_probe_single_connector_modes_merge_bits(struct drm_connect
131132
uint32_t maxX, uint32_t maxY, bool merge_type_bits)
132133
{
133134
struct drm_device *dev = connector->dev;
135+
struct edid *edid_manufacturer;
134136
struct drm_display_mode *mode;
135137
const struct drm_connector_helper_funcs *connector_funcs =
136138
connector->helper_private;
@@ -259,6 +261,9 @@ static int drm_helper_probe_single_connector_modes_merge_bits(struct drm_connect
259261

260262
DRM_DEBUG_KMS("[CONNECTOR:%d:%s] probed modes :\n", connector->base.id,
261263
connector->name);
264+
265+
edid_manufacturer = (struct edid *) connector->edid_blob_ptr->data;
266+
drm_iex_monitor = drm_dect_iex_edid(edid_manufacturer);
262267
list_for_each_entry(mode, &connector->modes, head) {
263268
drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
264269
drm_mode_debug_printmodeline(mode);
@@ -267,6 +272,12 @@ static int drm_helper_probe_single_connector_modes_merge_bits(struct drm_connect
267272
return count;
268273
}
269274

275+
bool detect_iex_monitor(void)
276+
{
277+
return drm_iex_monitor;
278+
}
279+
EXPORT_SYMBOL(detect_iex_monitor);
280+
270281
/**
271282
* drm_helper_probe_single_connector_modes - get complete set of display modes
272283
* @connector: connector to probe

include/drm/drm_crtc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,6 +2011,7 @@ extern void drm_set_preferred_mode(struct drm_connector *connector,
20112011
int hpref, int vpref);
20122012

20132013
extern int drm_edid_header_is_valid(const u8 *raw_edid);
2014+
extern bool drm_dect_iex_edid(struct edid *edid);
20142015
extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid,
20152016
bool *edid_corrupt);
20162017
extern bool drm_edid_is_valid(struct edid *edid);

0 commit comments

Comments
 (0)