aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorLee, Shawn C <shawn.c.lee@intel.com>2018-09-12 02:22:49 -0400
committerJani Nikula <jani.nikula@intel.com>2018-09-19 09:43:56 -0400
commit0b49bbbd9f10dd5bcce126aa99041a44320767f7 (patch)
tree78351ccdefb5cebfe94d73e0a42b36d1af12e6b9 /drivers/gpu
parent8f44ca223345a7d02e18ed4e70ff95178434e137 (diff)
drm: Add support for device_id based detection.
DP quirk list just compare sink or branch device's OUI so far. That means particular vendor's products will be applied specific change. This change would confirm device_id the same or not. Then driver can implement some changes for branch/sink device that really need additional WA. v2: use sizeof instead of hard coded '6' v3: add lost commit messages back for version 2 v4: send patch to both intel-gfx and dri-devel Cc: Jani Nikula <jani.nikula@intel.com> Cc: Cooper Chiou <cooper.chiou@intel.com> Cc: Matt Atwood <matthew.s.atwood@intel.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Cc: Clint Taylor <clinton.a.taylor@intel.com> Tested-by: Clint Taylor <clinton.a.taylor@intel.com> Signed-off-by: Lee, Shawn C <shawn.c.lee@intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/1536733371-25004-2-git-send-email-shawn.c.lee@intel.com
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/drm_dp_helper.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 8c6b9fd89f8a..07167604e8cc 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -1257,15 +1257,20 @@ EXPORT_SYMBOL(drm_dp_stop_crc);
1257 1257
1258struct dpcd_quirk { 1258struct dpcd_quirk {
1259 u8 oui[3]; 1259 u8 oui[3];
1260 u8 device_id[6];
1260 bool is_branch; 1261 bool is_branch;
1261 u32 quirks; 1262 u32 quirks;
1262}; 1263};
1263 1264
1264#define OUI(first, second, third) { (first), (second), (third) } 1265#define OUI(first, second, third) { (first), (second), (third) }
1266#define DEVICE_ID(first, second, third, fourth, fifth, sixth) \
1267 { (first), (second), (third), (fourth), (fifth), (sixth) }
1268
1269#define DEVICE_ID_ANY DEVICE_ID(0, 0, 0, 0, 0, 0)
1265 1270
1266static const struct dpcd_quirk dpcd_quirk_list[] = { 1271static const struct dpcd_quirk dpcd_quirk_list[] = {
1267 /* Analogix 7737 needs reduced M and N at HBR2 link rates */ 1272 /* Analogix 7737 needs reduced M and N at HBR2 link rates */
1268 { OUI(0x00, 0x22, 0xb9), true, BIT(DP_DPCD_QUIRK_LIMITED_M_N) }, 1273 { OUI(0x00, 0x22, 0xb9), DEVICE_ID_ANY, true, BIT(DP_DPCD_QUIRK_LIMITED_M_N) },
1269}; 1274};
1270 1275
1271#undef OUI 1276#undef OUI
@@ -1284,6 +1289,7 @@ drm_dp_get_quirks(const struct drm_dp_dpcd_ident *ident, bool is_branch)
1284 const struct dpcd_quirk *quirk; 1289 const struct dpcd_quirk *quirk;
1285 u32 quirks = 0; 1290 u32 quirks = 0;
1286 int i; 1291 int i;
1292 u8 any_device[] = DEVICE_ID_ANY;
1287 1293
1288 for (i = 0; i < ARRAY_SIZE(dpcd_quirk_list); i++) { 1294 for (i = 0; i < ARRAY_SIZE(dpcd_quirk_list); i++) {
1289 quirk = &dpcd_quirk_list[i]; 1295 quirk = &dpcd_quirk_list[i];
@@ -1294,12 +1300,19 @@ drm_dp_get_quirks(const struct drm_dp_dpcd_ident *ident, bool is_branch)
1294 if (memcmp(quirk->oui, ident->oui, sizeof(ident->oui)) != 0) 1300 if (memcmp(quirk->oui, ident->oui, sizeof(ident->oui)) != 0)
1295 continue; 1301 continue;
1296 1302
1303 if (memcmp(quirk->device_id, any_device, sizeof(any_device)) != 0 &&
1304 memcmp(quirk->device_id, ident->device_id, sizeof(ident->device_id)) != 0)
1305 continue;
1306
1297 quirks |= quirk->quirks; 1307 quirks |= quirk->quirks;
1298 } 1308 }
1299 1309
1300 return quirks; 1310 return quirks;
1301} 1311}
1302 1312
1313#undef DEVICE_ID_ANY
1314#undef DEVICE_ID
1315
1303/** 1316/**
1304 * drm_dp_read_desc - read sink/branch descriptor from DPCD 1317 * drm_dp_read_desc - read sink/branch descriptor from DPCD
1305 * @aux: DisplayPort AUX channel 1318 * @aux: DisplayPort AUX channel