From patchwork Wed Dec 20 13:54:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Abildgaard Svendsen X-Patchwork-Id: 13500129 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1184AC3DA6E for ; Wed, 20 Dec 2023 13:54:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0442410E5A2; Wed, 20 Dec 2023 13:54:16 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2127.outbound.protection.outlook.com [40.107.21.127]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9A3ED10E5C9 for ; Wed, 20 Dec 2023 13:54:14 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i1ZHYtzL2Kg+OnCGmcfH1R8cByDlMqmgD1MCIzf9cBQwqvIaQ01FyIbn957DrwTG662HXZyqw1dWoNSgslHV/StOWD7Z6VAJ/QD9NEcs5xNGpH666Gu8aGaFrW06LEoXEu7neDiC6uo9WOIyaPfUiM6JoO4weXlXONzm1uTTZ7cqcUl9sgiOYj538zvcOOED4385cwxenu66tsJWsqeg8hkzQBmIAtdWZl3SXVt9tt8VQT1c6pQkm7SYN5YdfBa1YTuBCaBPOB5GvvWuJ8dmK0RzN+9Mdd9SlaTIt8+xvPsjglW4xg0uxSjyO7d/CzVyegjgjdeIUMXtP7wbrbKFFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/h79rPHptj33/p0a9XGuhp1v71FXU06Q62jJ05eKGug=; b=VCcr2Pca8pRt46HW/iRKYE3Zw93jg/woMQe9eesbzujVJYwufVs+dfuRnc8iSuOpIc7jCtDdkQAq+4TMWaiXaLYZuvYvf7Dzoqgwsi5lN8FefTkP2koo5aNf55FxluiieriZofIAS/bqYGmN/GxsASESYb/cgAKdfJ8lWJsvegiPVzcAWOtmS0ar3BLT585kjt9LyJD6xLskKX4a0Yv4HStLADo5CtdO+xbhxttbZpMIz6buTbMgVW5Wt1AWUiCj6xyQWHCytygb5Z5rg7lY9GrzyZdl5v7DLQEPu0aHY1Z8CYTd6vdwlcKJJHco5YF1Qa08okxu9dJxXx4oiAHPaw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=bang-olufsen.dk; dmarc=pass action=none header.from=bang-olufsen.dk; dkim=pass header.d=bang-olufsen.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bang-olufsen.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/h79rPHptj33/p0a9XGuhp1v71FXU06Q62jJ05eKGug=; b=hQRL0mrrSlNdsVxEXRjdDCHHsjj/I+jxSTepN5KvTH2EFpptVYhRCplQ/eUNRU9W7t6aF5ria4Agg9Jn2r/Y0d3EWGbqXb3myta9aVy+o6uLSxJEeJGMm0qE/QV0LBL3O2WrEuFHp8f/eaAu2SGhvMv1uwyKTYMzsr9yMhw4TSw= Received: from VI1PR03MB4942.eurprd03.prod.outlook.com (2603:10a6:803:b6::20) by AS4PR03MB8745.eurprd03.prod.outlook.com (2603:10a6:20b:574::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.18; Wed, 20 Dec 2023 13:54:11 +0000 Received: from VI1PR03MB4942.eurprd03.prod.outlook.com ([fe80::67c9:f19a:51af:df35]) by VI1PR03MB4942.eurprd03.prod.outlook.com ([fe80::67c9:f19a:51af:df35%7]) with mapi id 15.20.7091.034; Wed, 20 Dec 2023 13:54:11 +0000 From: Emil Abildgaard Svendsen To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Lars-Peter Clausen Subject: [PATCH v3 1/2] drm: bridge: adv7511: fix reading edid segments Thread-Topic: [PATCH v3 1/2] drm: bridge: adv7511: fix reading edid segments Thread-Index: AQHaM0wCqc0YD3Ch8kmtNsN2ucnlEQ== Date: Wed, 20 Dec 2023 13:54:11 +0000 Message-ID: <20231220135406.2318148-1-emas@bang-olufsen.dk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=bang-olufsen.dk; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: VI1PR03MB4942:EE_|AS4PR03MB8745:EE_ x-ms-office365-filtering-correlation-id: eca1dd98-c51a-4180-48d2-08dc016324e2 x-ms-exchange-atpmessageproperties: SA x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: sRa47bPjlRBWBY2paIFsM5WW/exIWiK8H30I582DSwhF7/YP3s9F4RBmnYr0izcdBqkC9lb4QnUEwmMbxpjakHLaYZG/YnA55Y6uH5W5M6whXjlMzxdVUj5HJH8K37TbW/20fi6BjbuIZqQz1CKSHl8AL93jsmkx5tooTGQPlZWUpyitHdjYGXC8YM4P0+zvjfeLdUNdBHrzxeDLG4s7Xs03sUstu/mfk0M8bJck33+5kAm6uew6rs67FfgfOgIYtQIWzrEWyqbUm2ICUWpew+feWOg9zIqG7+BVPEv8xlialmxL3+RintmkzpqMmajqhzacjL+AqrQ5k5IDUcL+w3uLW4xy2Dsz5sRCqhTVKEgeoak2i7LkZxPtx0YmrT+I5kPddAQ2lLQW5BXPmsA0GntmD8wtQycClFR/Hw+VhvPpknTTakSPxrOkxcCsxHhhGbFgNNaodgzUMx6jnA+csYyyhoyFUr/2L3P7Wabs2nO0ris0N6LxBGQ3BDdfAw+p/Fa/xXC/GYWYIFn7Cky4+2WZGhKuRzq/qZjtLo+EJtBJt4TvAstmJGlpjIFzZ3S1NiRMZHQcfoGAeHPE5cuw26nEli7nspHlqnr+w203osbJHMdnc7C6cBptoCY/Bn1Mk8GraR49PTzb98rCn0Mu7g== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR03MB4942.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(376002)(396003)(346002)(39850400004)(366004)(451199024)(64100799003)(186009)(1800799012)(8676002)(8976002)(8936002)(4326008)(2906002)(6512007)(71200400001)(66946007)(316002)(64756008)(66446008)(66556008)(66476007)(54906003)(7416002)(83380400001)(110136005)(91956017)(5660300002)(76116006)(86362001)(122000001)(38100700002)(478600001)(2616005)(1076003)(26005)(6486002)(6506007)(41300700001)(36756003)(921008)(38070700009); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?MXQRsCT/yWPHquP9fx8hJGG?= =?iso-8859-1?q?QaFeT1Pu87dJiS8WkMouSyYLEsrof7qSP08XaNxPBdNjolDslIHHu1ZfATyA?= =?iso-8859-1?q?ob6EiLNbwrsjKsCvdjDnjBOc1YZptkqD6pvigIhmxxSSlp2tKepRWWNgyFLq?= =?iso-8859-1?q?NeTGuzir7Wfo+AC2ZWu52c0jdVTyaA3nrrARQKDrAUfCD9m6fHfDVufJ8LDP?= =?iso-8859-1?q?cdzbL2Pf5bhDoF6Z7lOPnhx9WJvKuJ3JZhEGR8P6gj4tVQZMqPP/Hf4GvVDA?= =?iso-8859-1?q?Z7GTtuMjZ6ZxZKh9mDoHLaNvMwff/kuhQwaxUzh7xKT8HSpyPVPCqvsuDhmA?= =?iso-8859-1?q?khJ2BG9E1QKSfvM6EkzQkQnmIhPDzEtfSnaTE/fFeD8o/v5cq+P0jC274VuG?= =?iso-8859-1?q?T3kJW22Rhs7+IJVl+kHChcmPpTrbHUMYU/xxCDqDH6PpklW3iWJVkcI4g+NL?= =?iso-8859-1?q?eG7zjSChB9xOQfsGGzv+l+W+jJfewnSPQ4bZ6JUyTSvr3iQ+an2zKOPPiQ5s?= =?iso-8859-1?q?C8ajIa1IuFadLTYtns0n6m/oXS1hfyVXJezA9E2QikIKmCdavkhM1ckGjCI/?= =?iso-8859-1?q?r5m50dVkwco62hd/mpLZfyK+yOaCWsTQ69EfTvTKY0YHPiO/oZudknf1jHXb?= =?iso-8859-1?q?AwYqrMVEXyO8fak+sk66W5zUOlwndkzfc83CBuzDQ4oBOJed42CV6lmeTWHV?= =?iso-8859-1?q?rxuyM+rLgy0mHxb948/QTORoWHc/QxVc4kFQt8NbjAITKGQzjZi4WRgDFIWY?= =?iso-8859-1?q?J9e3UVidaseFaJrAQZD3qm+Gwflq9mAPrQmJvl0Z8cEed4xzec9dHU2iJdOt?= =?iso-8859-1?q?tTBAOvv7oApQcrHufUTYK+3f7wN2ypJgfk5Qn9StmGTqoWIrbpHpLiwAfhiU?= =?iso-8859-1?q?Vj2TB7tO7lfKrwQTFahLIo4znRtDfcYJPU330M+94yHwzS8qRh32sMXSVocz?= =?iso-8859-1?q?Okxwjft3S5EDLGnWmAzFNLUDk07wC9lJZeBAa8tRZuuiiLoQuoJJAf5E17fy?= =?iso-8859-1?q?BzIUFAEItHkvJvsL05Vy2ucCR5+8b4g4bCTiBD4b4kE+KcU7lyMkzczzGI5M?= =?iso-8859-1?q?X5qrVNCyeuwWvVb9d4YvPEiTls4ierxZCPspl6q06PvIyt+DoX//YvFSvGG2?= =?iso-8859-1?q?L8/LIK3SJLc8D4WMN1yV87asETBnG8Bl7ROCQzpYBUpHlG/sYGW7TjObcDPx?= =?iso-8859-1?q?91nhqQJ4alTlr/tDp7oOJJ47L6BmmbVEs9RFupT7g7u2z3XX3ConqfeQZ7hE?= =?iso-8859-1?q?H/d5tNNS4KG0qo7InDaBb5seQMtf3ZwnHxQLHQgKrLUA0hQiRgRRTaOwWCci?= =?iso-8859-1?q?un7F1ZHADlQVTlwJq1wIV3pA+wjJxZ5nWJgZNli4b75MXD9bBpbzHQr7fvQA?= =?iso-8859-1?q?9AVm4gUddsG2NYQ4KpftjyHQRiuO33RspP74Ecrb+HEsxluK2Aj71uYJSSro?= =?iso-8859-1?q?Dqs1SFekbel8k/Nw75GP3QUCQMqKWfu2zvAhPd80K3KotQt36J9yrGdiOFgY?= =?iso-8859-1?q?t9AllWwLFMNc8XAl6iqKOLyd/PDSIDToY/3dmmkAf+fPXonglZrovbaEtIVT?= =?iso-8859-1?q?esJm0S48tuNtiYHEd2hRQbZ82jygGLBPAjjcou0Pi8OQaBpcV2ch/6Uu2E9h?= =?iso-8859-1?q?G1z3dmWWMDtENJh5641B2sS8mIA/ixei9YYtUvg=3D=3D?= MIME-Version: 1.0 X-OriginatorOrg: bang-olufsen.dk X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4942.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: eca1dd98-c51a-4180-48d2-08dc016324e2 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Dec 2023 13:54:11.1568 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 210d08b8-83f7-470a-bc96-381193ca14a1 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: XjmWXZaYIeScjdholm1qmfe7WGtgaITx5vUZN+TVCLQiguJOw4XcT0QP8wBSX+cT0Uu+THUyF/5w+640wdiwqg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR03MB8745 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "dri-devel@lists.freedesktop.org" , Emil Abildgaard Svendsen , "frieder.schrempf@kontron.de" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Currently reading EDID only works because usually only two EDID blocks of 128 bytes is used. Where an EDID segment holds 256 bytes or two EDID blocks. And the first EDID segment read works fine but E-EDID specifies up to 128 segments. The logic is broken so change EDID segment index to multiple of 256 bytes and not 128 (block size). Fixes: 9c8af882bf12 ("drm: Add adv7511 encoder driver") Signed-off-by: Emil Svendsen --- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 8be235144f6d..9b6294120516 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -537,6 +537,7 @@ static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block, size_t len) { struct adv7511 *adv7511 = data; + int edid_segment = block / 2; struct i2c_msg xfer[2]; uint8_t offset; unsigned int i; @@ -545,7 +546,7 @@ static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block, if (len > 128) return -EINVAL; - if (adv7511->current_edid_segment != block / 2) { + if (adv7511->current_edid_segment != edid_segment) { unsigned int status; ret = regmap_read(adv7511->regmap, ADV7511_REG_DDC_STATUS, @@ -556,7 +557,7 @@ static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block, if (status != 2) { adv7511->edid_read = false; regmap_write(adv7511->regmap, ADV7511_REG_EDID_SEGMENT, - block); + edid_segment); ret = adv7511_wait_for_edid(adv7511, 200); if (ret < 0) return ret; @@ -589,7 +590,7 @@ static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block, offset += 64; } - adv7511->current_edid_segment = block / 2; + adv7511->current_edid_segment = edid_segment; } if (block % 2 == 0) From patchwork Wed Dec 20 13:54:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Abildgaard Svendsen X-Patchwork-Id: 13500130 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5C603C3DA6E for ; Wed, 20 Dec 2023 13:54:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0FB7C10E5B0; Wed, 20 Dec 2023 13:54:19 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2127.outbound.protection.outlook.com [40.107.21.127]) by gabe.freedesktop.org (Postfix) with ESMTPS id 093AE10E5C9 for ; Wed, 20 Dec 2023 13:54:15 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dDUthKx/F5ZN8KC7ras07CxY+O7IP4wfhWHfFkizdiEf9Kepb1LAajwIR+jHgklB2vGbBXb1h+ssswa+WOO7XnY0BlivCmIXPbReG3+ouYTLazKgYnRdv7BeBIuBiUsUtQ+qx9cPkB9FXSF48MK0nySIMhVefg5nKCW8J32Bmd8qwAb59TebEnaXarfg21kQdLda67C4cIwBhe3dTvST8DNgf46MttPyCUIUITL5WeNsGNVnfGuqbU+xOtdXz4QPwAeujH5luKsL8VQS8DJT76kH4qK2/Wbtqwu2E6AsH89fTLxh6tZU9/F5pq6lLnbFB23mKFYJBU7aftgpzf+xRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wpGpDqO0cKZZaBZLIgNyZiwpN10fXY1FZTiWEJTC450=; b=CGlvhVW2ZuMxqjZVRn3fSy3CtH5oe9N2uQiTXwsJL6nF113YyTO0HSOFL0rsYTXn+pt3pJCATq67gVpp80fAw9qD36ksems8c3K5P8iiKkq3ygJZVOAFnm3R9EinOxl9YTNIWeoLLCHayd6kJ28AScsb7Vaz5XuWijNCxfXq1e5MJbPlSs34ZSXqpyRcLMEgpKuoB3/Y4ZxnjZBZuI77Ji14hVin07eQAsX9G0FGDYYufswzqpcsOIIzevKZr6wuzAZU5Cy8oaPIYMDmKRXV0R7vk35F4UrtgYPVVAOMLrABXqjhAo5jhcY7WSkX11QGMYfkoieV+cmAy/liM1bB8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=bang-olufsen.dk; dmarc=pass action=none header.from=bang-olufsen.dk; dkim=pass header.d=bang-olufsen.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bang-olufsen.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wpGpDqO0cKZZaBZLIgNyZiwpN10fXY1FZTiWEJTC450=; b=pM3Ue7+pyLf1i0GOE3Ls+gTuXInmy3Ef3QsJteK1cxho51PiJXAsTOoEx0EiDXGuv4N4ckclorU6srT0ePl/5lHrDPU91H7Ff41jFwVdOnYE4rE9NgFByrzaUSKeSaC3TayuwCM4GTbh+VcqGgACZIgi6W4QmAii/Yg4jNJTvnM= Received: from VI1PR03MB4942.eurprd03.prod.outlook.com (2603:10a6:803:b6::20) by AS4PR03MB8745.eurprd03.prod.outlook.com (2603:10a6:20b:574::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.18; Wed, 20 Dec 2023 13:54:12 +0000 Received: from VI1PR03MB4942.eurprd03.prod.outlook.com ([fe80::67c9:f19a:51af:df35]) by VI1PR03MB4942.eurprd03.prod.outlook.com ([fe80::67c9:f19a:51af:df35%7]) with mapi id 15.20.7091.034; Wed, 20 Dec 2023 13:54:12 +0000 From: Emil Abildgaard Svendsen To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Lars-Peter Clausen Subject: [PATCH v3 2/2] drm: bridge: adv7511: fix edid read in hdcp state Thread-Topic: [PATCH v3 2/2] drm: bridge: adv7511: fix edid read in hdcp state Thread-Index: AQHaM0wCPbiHr5EVEE6fduOswVHF7g== Date: Wed, 20 Dec 2023 13:54:11 +0000 Message-ID: <20231220135406.2318148-2-emas@bang-olufsen.dk> References: <20231220135406.2318148-1-emas@bang-olufsen.dk> In-Reply-To: <20231220135406.2318148-1-emas@bang-olufsen.dk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=bang-olufsen.dk; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: VI1PR03MB4942:EE_|AS4PR03MB8745:EE_ x-ms-office365-filtering-correlation-id: d648703d-c91c-4646-41c8-08dc0163255e x-ms-exchange-atpmessageproperties: SA x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: UUo2Xmbo+guVkge11STiGWlkNwF1SMGl+uIJ8d8Z7gMoLBqje9Zin4btKgnClwzgoPUEBUzuo2INVzuziCYYk0DENPzUuxOcb4U8uy0nm+Z3HTmzqX4WM39WLjVfs2n+BSgZgOOC7+ejnr5Zj+r/Fcu/491dgkE+gIgUi/4i4528LO0aOSDYSJdmIbbOavx56lP3U2ukmTFZy3PMQGMkU4wJfULMlZLMO/uuKCjI1g/BUy/iDvAUxCzb1/zLctTEZSVB+lgpDiLNN37eYqzjaoczLJhvF1zdgPlagLW5ty357mNoeGOie+RTd2RWr95P3WnLza1hhSOXZKBJMrNwLxwovVXrU+J4ybOsYCrJMvNlH1TX+MJiZblkW1Oc+XqP6xyi8Gwminh+eyEgAUAdip1/qS4lAdjZAkAVF//ONZy/l1S4NWMQNHEyBrg6udjJvl9pTXIkCjxFOMUDB2GMVIG8JQdB2PlmUwzoLaOsPA4E40HkACvpYYskV20uKx0sX8zeQkcIrPwLongnYc6V5qOLlA0n6I/ATcdrGfRX1D4WYio9I2BxO32kFOB4O2kDUIhx9+gbXj3VhJTTJSh7nDOm27Bqec4JGI2aOEdAfodneNoSp7iXeRAmQWs29bjH01jHq7shXEAiXscO74lAsg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR03MB4942.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(376002)(396003)(346002)(39850400004)(366004)(451199024)(64100799003)(186009)(1800799012)(8676002)(8976002)(8936002)(4326008)(2906002)(6512007)(71200400001)(66946007)(316002)(64756008)(66446008)(66556008)(66476007)(54906003)(7416002)(83380400001)(110136005)(91956017)(5660300002)(76116006)(86362001)(122000001)(38100700002)(478600001)(2616005)(1076003)(26005)(6486002)(6506007)(41300700001)(36756003)(921008)(38070700009); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?gFVWA36JfcJxk5/mpYK32/L?= =?iso-8859-1?q?hi86RcDc/+47W8bArACuEp4j/+WEk9UwtEtLBanmRLYFQQK2Sl76bT6QImFq?= =?iso-8859-1?q?ww2StXD/24d45k8v6FYnahtxAiWalVEkgipxeKapmR4IXF2aL1tRacX0tAJU?= =?iso-8859-1?q?CIwBWjsXj4HANdqTQCzAIVM2SoysoKhx5OedthoWfc4MwbJhMty1IzGxNslG?= =?iso-8859-1?q?mIuwnb2r2nE4gGO75sSM6e0fbDbIRrpmPsh5w8BMJ9T0PD0hauV6UFv5PLBy?= =?iso-8859-1?q?lBS0As8ThA71TRTNF6GDAFDHDVvxnmRgoGhA0alPmpGNNd7okcoWC0Ksn1Jg?= =?iso-8859-1?q?o/2DxQBtQsoG9QZW1Z7DpgZ9BGogPV7BTIW/RYqq8mm9ICm5oYjtyMggX10i?= =?iso-8859-1?q?XmhbjbCObr5oFUykrOXp/7492tVaV+1wsvTinUK+5kiIMoZWW6Wgq7TjBswu?= =?iso-8859-1?q?cLI4t+wuX2YxgejBnoAF2fJFZ22cPlL9KRUCvA/gjCkrtoCCEJ5C86XaO402?= =?iso-8859-1?q?F04ht76q3SvsLpIT7g2YpIOWstbBRIL/0Qw2sm/5vQTLkkcIThYifi/IAB06?= =?iso-8859-1?q?SHAYYXD7V/HrrdFm6gC1llipUc8E6OaS8j26HnbHeZomxT1OaLc2ISPx2HNd?= =?iso-8859-1?q?vu7+Rk4S2K8xqSoo80M+UEqHe0Mpr8UsG5GqzfhkS8k5plE/c7BrKFynopu2?= =?iso-8859-1?q?PIuZpSajUp8rhbImRvWuX8d/yd8uwyo4WSLZIlUjRbA4ITmb0xUcBv2hLOii?= =?iso-8859-1?q?+Zf6moNtWw8UjrGRGCI+r9lT9Prm5fD8al2Xjv//CWC1e1eKJyzH1Kk2hFgT?= =?iso-8859-1?q?157t1AfOntxKX4vIyOWFvoBppSjKICOYrbbSl49CFCK2SOYhlM3xMWmDFzho?= =?iso-8859-1?q?II7aOs5aIVHwltPEMJmnMdHbXt+epWgeZYGp3KY3AvzVqhZSIwsnLJ0LWKCy?= =?iso-8859-1?q?STtgpv08qemUlzihrKpBTP6gD+uke6hBzexx13gEGhRBjiSlaZTt0kR4JNvp?= =?iso-8859-1?q?SkAXimwVM8jB/JqXQi2OO+fn6v0ZzHqGqEzjLRwo9Zc5r4GCBqPtzf/CaE1a?= =?iso-8859-1?q?bsi0jxJH4QRLqmP9CfN1BlhnEmwKdsBzt8j54TaBMagF3uSVYNBy0Yn1sOdX?= =?iso-8859-1?q?vw5kDIHbR+O2x/f2y9zqildOCIPF+D8xXrK3/PSNObRRKEm4RhvNdMfP3ITp?= =?iso-8859-1?q?fQMtjhc7GSJjd0ZTjJKeVceJ2Dm+Ok6454xW2Naxxx9e6RQJplf4+9J1MNSI?= =?iso-8859-1?q?GaUqqdgjeQb/jR/fJuGVGbL04Sy7KphxoNwGZnyqmab7RP8XPP8cjLay2Jby?= =?iso-8859-1?q?GTbp3xnHea/+PiwQj/8x2qp5VaV4xuk/1+2SrD8G8j696PsgLaPXrP+8OPRw?= =?iso-8859-1?q?tNcF9ki6eq/2Try7+dlcm+fcEyBpIPVUd554jVJqjkpfycIlQQ0sRzEK2GuE?= =?iso-8859-1?q?3PH8UZycviprj9wOyAo2A2S+Oed9GUUVp20oKgkSlGFKFv9ansK1NJIOp4+z?= =?iso-8859-1?q?IJDCDCgsXTLxKXvRJoMt/IqOfeMW3OxUFcEr21sxP3LuHY6jsBtgCerNpWum?= =?iso-8859-1?q?5cHMsMFUx5HntbP511Hp3nii4i3oJORJb1ajeTyPK0bp23cLz/HLLpfFWsuv?= =?iso-8859-1?q?4sh9A0S1wifDTpz5kb6YbLrm7IFbSY0avWDAcig=3D=3D?= MIME-Version: 1.0 X-OriginatorOrg: bang-olufsen.dk X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4942.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d648703d-c91c-4646-41c8-08dc0163255e X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Dec 2023 13:54:11.9657 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 210d08b8-83f7-470a-bc96-381193ca14a1 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: mxHzWNIPypn2ir4ZYjSNzA4q8EysZhXsr7OZpGB8yDJi0MQacdxUjp5SRb8yj2S0JZG1MWQBsE5AkrlZb1Wd9A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR03MB8745 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "dri-devel@lists.freedesktop.org" , Emil Abildgaard Svendsen , "frieder.schrempf@kontron.de" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Change check of DDC status. Instead of silently not reading EDID when in "IDLE" state [1]. Wait for HDCP being initialized because the EDID and HDCP block shares memory [2]. [1] ADV7511 Programming Guide revision G: Table 11: DDCController Status: 0xC8 [3:0] DDC Controller State 0b0000 In Reset (No Hot Plug Detected) 0b0001 Reading EDID 0b0010 IDLE (Waiting for HDCP Requested) 0b0011 Initializing HDCP 0b0100 HDCP Enabled 0b0101 Initializing HDCP Repeater [2] ADV7511 Programming Guide revision G: 4.6.1.1 EDID Definitions: EDID and HDCP use a shared memory space. During HDCP repeater initialization, the EDID data is overwritten with HDCP information. EDID is not re-read after HDCP initialization. If the user would like to re-buffer an EDID segment the EDID re-read register described in section 4.6.1.4 should be used. Fixes: 9c8af882bf12 ("drm: Add adv7511 encoder driver") Signed-off-by: Emil Svendsen --- drivers/gpu/drm/bridge/adv7511/adv7511.h | 9 +++ drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 65 ++++++++++++++++---- 2 files changed, 62 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511.h b/drivers/gpu/drm/bridge/adv7511/adv7511.h index 39c9ece373b0..16d77f4a0aa8 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511.h +++ b/drivers/gpu/drm/bridge/adv7511/adv7511.h @@ -247,6 +247,15 @@ enum adv7511_input_sync_pulse { ADV7511_INPUT_SYNC_PULSE_NONE = 3, }; +enum adv7511_ddc_status { + ADV7511_DDC_STATUS_IN_RESET = 0, + ADV7511_DDC_STATUS_READING_EDID = 1, + ADV7511_DDC_STATUS_WAIT_HDCP = 2, + ADV7511_DDC_STATUS_INIT_HDCP = 3, + ADV7511_DDC_STATUS_HDCP_ENABLED = 4, + ADV7511_DDC_STATUS_INIT_HDCP_REPEATER = 5, +}; + /** * enum adv7511_sync_polarity - Polarity for the input sync signals * @ADV7511_SYNC_POLARITY_PASSTHROUGH: Sync polarity matches that of diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 9b6294120516..f50efb3beb69 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -533,6 +533,48 @@ static int adv7511_wait_for_edid(struct adv7511 *adv7511, int timeout) return adv7511->edid_read ? 0 : -EIO; } +static int adv7511_wait_for_hdcp(struct adv7511 *adv7511) +{ + struct device *dev = &adv7511->i2c_edid->dev; + unsigned int status = 0; + const int interval = 25; + int timeout = 100; + int ret = -EINVAL; + + for (; timeout > 0; timeout -= interval) { + ret = regmap_read(adv7511->regmap, ADV7511_REG_DDC_STATUS, + &status); + if (ret < 0) + return ret; + + status &= 0x0F; + + switch (status) { + case ADV7511_DDC_STATUS_IN_RESET: + case ADV7511_DDC_STATUS_READING_EDID: + case ADV7511_DDC_STATUS_HDCP_ENABLED: + return 0; + case ADV7511_DDC_STATUS_WAIT_HDCP: + case ADV7511_DDC_STATUS_INIT_HDCP: + case ADV7511_DDC_STATUS_INIT_HDCP_REPEATER: + dev_dbg(dev, "DDC status 0x%x\n", status); + break; + default: + dev_err(dev, "Unknown status 0x%x\n", status); + return -EIO; + } + + msleep(interval); + } + + if (status) { + dev_warn(dev, "Stuck in HDCP state 0x%x\n", status); + ret = -EAGAIN; + } + + return ret; +} + static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block, size_t len) { @@ -547,21 +589,20 @@ static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block, return -EINVAL; if (adv7511->current_edid_segment != edid_segment) { - unsigned int status; - - ret = regmap_read(adv7511->regmap, ADV7511_REG_DDC_STATUS, - &status); + /* + * EDID and HDCP shares memory so make sure HDCP is done before + * reading EDID. + */ + ret = adv7511_wait_for_hdcp(adv7511); if (ret < 0) return ret; - if (status != 2) { - adv7511->edid_read = false; - regmap_write(adv7511->regmap, ADV7511_REG_EDID_SEGMENT, - edid_segment); - ret = adv7511_wait_for_edid(adv7511, 200); - if (ret < 0) - return ret; - } + adv7511->edid_read = false; + regmap_write(adv7511->regmap, ADV7511_REG_EDID_SEGMENT, + edid_segment); + ret = adv7511_wait_for_edid(adv7511, 200); + if (ret < 0) + return ret; /* Break this apart, hopefully more I2C controllers will * support 64 byte transfers than 256 byte transfers