From patchwork Fri Apr 15 02:42:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandor Yu X-Patchwork-Id: 12814217 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 76AECC433EF for ; Fri, 15 Apr 2022 02:43:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E6AF810E202; Fri, 15 Apr 2022 02:43:55 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2074.outbound.protection.outlook.com [40.107.21.74]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7B63B10E37D for ; Fri, 15 Apr 2022 02:43:54 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jg6QvygHmr3N5lHXXCQBhWMuzzbJfbHOngD+OBPnLUDlSVtnAHBN+C0z7oX9IpR+BzlSQv1+MYLkmk2NDEIRujf1oIImGaAEDIMoH6tfdimQYlZ2avPc6MMNY8gYLOiQtL0tFJJvXy6RjAI7sGoeExvoirFTOxBrTwOJurIr+TmJxoTzXLxZqRZLQN3JJY5JPGVdJorzo1MaEbjKI4NnAVr9wlPfsYmSbnCovGMjJfvl9ZK3CzwzMmNbcnVL6//SIgYyOPGUgY/0VpPkfH22GGW7+eFmgYtjH+8EbX4Uf6kAVauvETHEUUFRKGtS4+xXKut5hgpNaRkQfxn3R2vKNA== 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=CqBJQSA9E0WGVeLfPfjJYljmppdDVBVI74FcicKmHHs=; b=AoXLRC4PXlzM9TS99hsArhIH53f/WOywKXYMC4X5artXkPZjcAJVoGQOEqDenrU/sgy9xUfQtA3knAwnYcAg5liIevFh5M8u626KSGOa1hURMPSvFfJv9I41ZoXBC44PZ0HRpr7MlCeiPPgdCEUj9cMkvU9bcyE6LCTZJmjAfMhP0EzuQunfiyEIDvcfsz/8mEVYg645DxWZMyVdMTia6R6KzxCtpLxhDqLH7cjBXECYwBNqS85pJ6SW40x1OhdTxwF7AYihhOD6rWVSDnExfT40obZfJxWcDncOUt1cLpCT02YA58gD4zM717AZe9FmxY1TPhCawyXo3x1nrcZudA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CqBJQSA9E0WGVeLfPfjJYljmppdDVBVI74FcicKmHHs=; b=XA0jigT8fcaquypKtdHDVUWfp5DNRQHNAqCBzm0zAWNlD4PxWdpTp4gPaDKS0SeZsgm830olPWbEseHTaqLbIC3QefKnBEWjW3dVpD4nF2I4RzYQhmFtXeZTsKum2DWI+fbk6lXxmuDYExGytYkLmhnbn6wgWfCoxnEPT9xKaLE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB7PR04MB5450.eurprd04.prod.outlook.com (2603:10a6:10:86::11) by DU2PR04MB9132.eurprd04.prod.outlook.com (2603:10a6:10:2f7::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Fri, 15 Apr 2022 02:43:51 +0000 Received: from DB7PR04MB5450.eurprd04.prod.outlook.com ([fe80::7997:2892:d230:2430]) by DB7PR04MB5450.eurprd04.prod.outlook.com ([fe80::7997:2892:d230:2430%7]) with mapi id 15.20.5144.030; Fri, 15 Apr 2022 02:43:51 +0000 From: Sandor.yu@nxp.com To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, andrzej.hajda@intel.com, narmstrong@baylibre.com, robert.foss@linaro.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, hverkuil-cisco@xs4all.nl Subject: [PATCH v3 1/4] drm: bridge: dw_hdmi: default enable workaround to clear the overflow Date: Fri, 15 Apr 2022 10:42:47 +0800 Message-Id: <561951005a85574dcdd108e5d6a3a87df930ea3d.1649989179.git.Sandor.yu@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0013.APCP153.PROD.OUTLOOK.COM (2603:1096::23) To DB7PR04MB5450.eurprd04.prod.outlook.com (2603:10a6:10:86::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 92d782b2-645c-438f-3e55-08da1e89c610 X-MS-TrafficTypeDiagnostic: DU2PR04MB9132:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g+r4Bb3bdFliFz9qkNCr59rn0eXa+Canj7Bf1ghZg0pTrEJ54SyihMb8u4cC9E2rsevetxmCVTdMA5NSmRjrAKRWcFirPXy+ZOtFQG4UqgHDmt7o6JlL3ZQAo2G77R7FHWVxHeNtqwC4xm/x2O6DwFi0YS6dRLmRc1yblw5L+tCH0cjwTORIzYMB3hicG68FBedBFidZd747j5XfNllImTVrHKzb/45XWJkBHo0sJnPcGgki4Q4Na1fU2h/Pa/sg1Qek7VnOKiJecTtcal8cBqLBJar/fz/uyuw6MuR9kaV4lZJyjdjkXJbvjfi1uQlI2OvywC3x7kEVC1tUZtoYurPX+0E57AkImhfoD6gHqRI3nCJZ6A+1qJdzYm+Z3ZsQ5Ck6m+YNte6zw+8hZMED6W7DPNm23ituNmX7honF0+IE0yHPIGcBXebFDljHBL+3wwH6XkYbRoOhafm4f+93Nt2yF1V2q7q9WkV2apUtYbtuMg9NrT3XSK9tnLj7p8xMZ+GSlrqr5ZG9R9gczp1Q1ygUkHqOK6AomhfjZYzPINDwsVHMlQ1JJHOZ4ChzlYn83NCGYLTemxZRL7kzXp7afuqwPIyRIdfst+uli8WgSW8kph9j5QuFRi1RO0ZTs7bhm2jVqdnXejuB03A/Mm4Aie8eemQsk2QppXVe4jfvqPiu1WlWD8c7Jqxe27CgJ9xJ/uOEp8lo9XGILyBVTK+6EQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR04MB5450.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(83380400001)(2906002)(6512007)(26005)(2616005)(9686003)(186003)(6506007)(38100700002)(38350700002)(86362001)(66476007)(66556008)(66946007)(4326008)(7416002)(508600001)(8676002)(316002)(5660300002)(6486002)(36756003)(8936002)(52116002)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KAHpQI/yj1rKb/z+HeyPh4/L0LhAbTZfJmBbFOLW5ifK9DLnrkqIxmBh5iV9jKOpyOLUk2FoSg8PSkIjvOxMACpVc4h8PxYWHDWFeLXdXW48LNTc2F7DPqj1AkwPJKF1w6zkjhuR2kkb9RpAau5O2zoiWXXukR2EzDHG1jQEYI+cJVSyXdtsqIXQwxyq+/+Qfi7EFvghwoO89C/B7mYge23lfglmbVU6gUWaqf0QKPa2m78rQVCx91Kkx7OuVZw8MWA9xQTBi1fHijh/tpD3XAHuv/mbMRksb9g1BaJKc2oGVj02XmeLn31QbHm8aUe3XEFIYctwECdvbWIeOxFPXZV4SdxBeEaszBlZqooZ1+Ny8i3AB62FyCCLGVk9eouoIfLIusCZWB6U31Ox/eXgwvdq7rzXgIS4Q8BtRNbtc3vu4D8FdVcCRGLlS8morIYMEGM5x79YDwlWd6lP7QYzQoQT+GonEzheuZmjP8Mpf0KEdOXCUfVNfBSvid+D7v/rCp40nWGpR/qYEZnvXY7JnCa+v3B98snwVgakOBn5snVJwS5YiQkn5bptcLusCoV2NwFKOuhUYqbsxZ5Mr97io2F6WlgwCt2hol6dWV4zToNRnp1/Kt0TQXsrrSs1tcbvDiU0AG53qXY70QNFtD7+RGNbykTF8itHQhM5gE+cqzQFwleZmd04WVami4ouPhYgqZvXxRGVfe3nGc491WjViL48c4TzTx2CkxoJmNM7+ivONTHNDg7zBWQMxnM1wTusbFhwMixxK1BfNXm9SKsXIRLCWujAh2EvxuXNZaxSchnDh/WWSdTS2byxonabGigys5Lj+qSxLDy5v7zCWZ2egczDopshqtWqfnMsTm8/jCqDlTGssPCDZJSwCxYUXRUApuzSpDlKPXE8HGCkDBBeO7lGXtCniS1+vpmsLnuuWdWK9Jf+DmACzB7Njr4G81wjzpHWlovJMhK/Xmmr99QTuL6J4HWAmMpfxwSeuvESJMHcTPYt1ZKITazrpXBTXM4n+qOcSk+Syr3/tthLzQHbx36+QHmKpOnjxjlBue2G5aX390BOBifhYfmHD/iYDdBZNFYSk7Jsw42rMgAnE36gIO3nEQTmPpwPCluSn0xMfy/G5YyhZAS3J+6V+ZCFEh/+4eRuZUcwRF9wVSDn7tMnqJlZOutvhkKCe1zHlumadCwEBl5UFdtwWjYaWKzaLJAe93dQB60NDwB2rFW9kAgExNaBscKO+dxGqlCZ6N96tNiizWw/OThgOj7NYn9Sh38Q/CApJ6QX8DljxNt+piXUTdmt40micQKkbMLXRKdrN7TVMyaYWWf3Vf5iX5TMCR+t5U0MGxZul704VxrnmnuAHkBEFBJDjHczEgop8tE3RAM3yWkEIRwnCGR8++tRbn5DDmwnQJAyH9cTnHfajVzMBjoFpQYzpI7jJH9WnPGD7UzBvYPPLRvKURapr8DDg/s9OahrRVugcsw8O9bo8V0dFS64q/lFq+V0qzkWhV3oWZFvAgJ6wp3k4pU6ALRsSh02jagyurwAX2ohqnfRC3YFigZub0wws9Kot7tX1L8CVBuMcXMmYJivsKJN/3lPSdwk/YMAU7l8wQlRmclrJPgckLkNNjGd0qXikeiVoqUdJLMyx8XGSEKt8EbWjNQpNY3Cv2TcM872wvHpMtdZG8yOdUihke2MfdTyMUXlYz3XZUCpy7G2ywf5GJlvQqWgAPJej66cQVEpG16Pr94lBhjDaA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 92d782b2-645c-438f-3e55-08da1e89c610 X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB5450.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Apr 2022 02:43:51.0527 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Veqyv3uHf8sSQcz0+VaG/7eoa8YfQdZ1ashtRDdPMtxwhKCwZI2IkaObQP/FMQcYD2uAoze4eLJOKmdIyZIPvg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9132 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: Sandor.yu@nxp.com, shengjiu.wang@nxp.com, cai.huoqing@linux.dev, maxime@cerno.tech Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sandor Yu i.MX8MPlus (v2.13a) has verified need the workaround to clear the overflow with one iteration. Only i.MX6Q(v1.30a) need the workaround with 4 iterations, the others versions later than v1.3a have been identified as needing the workaround with a single iteration. Default enable the workaround with one iteration for all versions later than v1.30a. Signed-off-by: Sandor Yu Acked-by: Neil Armstrong --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 4befc104d220..02d8f7e08814 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2086,30 +2086,21 @@ static void dw_hdmi_clear_overflow(struct dw_hdmi *hdmi) * then write one of the FC registers several times. * * The number of iterations matters and depends on the HDMI TX revision - * (and possibly on the platform). So far i.MX6Q (v1.30a), i.MX6DL - * (v1.31a) and multiple Allwinner SoCs (v1.32a) have been identified - * as needing the workaround, with 4 iterations for v1.30a and 1 - * iteration for others. - * The Amlogic Meson GX SoCs (v2.01a) have been identified as needing - * the workaround with a single iteration. - * The Rockchip RK3288 SoC (v2.00a) and RK3328/RK3399 SoCs (v2.11a) have - * been identified as needing the workaround with a single iteration. + * (and possibly on the platform). + * 4 iterations for i.MX6Q(v1.30a) and 1 iteration for others. + * i.MX6DL (v1.31a), Allwinner SoCs (v1.32a), Rockchip RK3288 SoC (v2.00a), + * Amlogic Meson GX SoCs (v2.01a), RK3328/RK3399 SoCs (v2.11a) + * and i.MX8MPlus (v2.13a) have been identified as needing the workaround + * with a single iteration. */ switch (hdmi->version) { case 0x130a: count = 4; break; - case 0x131a: - case 0x132a: - case 0x200a: - case 0x201a: - case 0x211a: - case 0x212a: + default: count = 1; break; - default: - return; } /* TMDS software reset */ From patchwork Fri Apr 15 02:42:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandor Yu X-Patchwork-Id: 12814218 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 ED745C433F5 for ; Fri, 15 Apr 2022 02:44:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 237CF10E2F7; Fri, 15 Apr 2022 02:44:01 +0000 (UTC) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80048.outbound.protection.outlook.com [40.107.8.48]) by gabe.freedesktop.org (Postfix) with ESMTPS id 96C1110E2FE for ; Fri, 15 Apr 2022 02:43:59 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KkKNmLINe+2J7euduTrxnZnfPPAAvb6sJsAJ4Y2Ye5WY8k8xlD0Z2Bs3LQ526OoIDjTFMJD5W1BKhBHHWkW16jkql1ULACvl/qVkXzkzwBo9ktXyGv+D7miQ0DMCUYf3CuoEzlliX6sbR6mOw0OmGkW4sLOQYU2IS0dhu3JJDShorSt1R4N0mewk6sb8rll68VGp7BQl2BnPy1UkLx/THRJt/tNE9ZJdmjR2TIIBCFfh70XLGqDNc23+smYBC3SHeH5yEXz8huPMtkUdkrWvnpbXOi7ax+6D1sZxm9ZfL/Q07Kzn5ZhkUnHRrK4P13sc7xRgam9z2FFxVoRJf75cWg== 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=VrU20bF+mQVqWwDSOStpYw2NvS4T7OG8L+C7AKwydEQ=; b=ijKBYSd4riTMkB85Y5SXyUIx/uZslmtaoPE7NWejtglQE4sAPiWBtaZ0RIVvgaejTHAGSp09FW8fs6m3w83jE6AFgLqPrwDoUpM30L60oKXTW4pwZeogRAxYQFAUVOb+rx7IWaZwxj0UCpV+BiP/5Jk30GBtKKDw6A01AH/KwpP62PQIbpj7ePHhzfiLZZRThsDIc4Tf4k4OwLtlRp1pqsZg8PojggNFYTkL4IGWT49uCywjphqfuv6U7HvnYFsqTOtuMPoDp44H5z09V8qiqHRS/pdLhlKp1zlZmfDBLjB5E+X3hQ+3SYzyv5FP6RHv48eELKmisYxIbeDyVJKFWA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VrU20bF+mQVqWwDSOStpYw2NvS4T7OG8L+C7AKwydEQ=; b=QuPU2dQM0ij8nZdeaDb/qwKiUHkYGyJ+sHD2U2X24Hf9CKLoExkgNPYPXr4ObGLqZUoKPtRsUT0Gqn9xSQFH0c2vWJYfXAdPtXrJzyfs5zFw7TRv1+O9My6MU4WZcahP+ney5TwkpIzaQxUmDTcaywqS6RrDdKNxzOlKe3onqPA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB7PR04MB5450.eurprd04.prod.outlook.com (2603:10a6:10:86::11) by DU2PR04MB9132.eurprd04.prod.outlook.com (2603:10a6:10:2f7::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Fri, 15 Apr 2022 02:43:55 +0000 Received: from DB7PR04MB5450.eurprd04.prod.outlook.com ([fe80::7997:2892:d230:2430]) by DB7PR04MB5450.eurprd04.prod.outlook.com ([fe80::7997:2892:d230:2430%7]) with mapi id 15.20.5144.030; Fri, 15 Apr 2022 02:43:55 +0000 From: Sandor.yu@nxp.com To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, andrzej.hajda@intel.com, narmstrong@baylibre.com, robert.foss@linaro.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, hverkuil-cisco@xs4all.nl Subject: [PATCH v3 2/4] drm: bridge: dw_hdmi: Enable GCP only for Deep Color Date: Fri, 15 Apr 2022 10:42:48 +0800 Message-Id: <78fa41e4fb3d3d53354034bc221fcf870dbac617.1649989179.git.Sandor.yu@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0013.APCP153.PROD.OUTLOOK.COM (2603:1096::23) To DB7PR04MB5450.eurprd04.prod.outlook.com (2603:10a6:10:86::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9c4b4e44-a86a-4b3f-778b-08da1e89c89d X-MS-TrafficTypeDiagnostic: DU2PR04MB9132:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qWCGiZRY9+iisX+UhPEHGo/1Rp+0ZWQ+P2QyYoWT/5LU5l9N/8JcVKNaln+N56oVcqefRp4ixQPZPRDI1h/GF9Pt3UMU9XfMIon9KS753HN9Ea6cv3PgObR6ghGuF9XhGB9Ipolv2ztyQZZoD6nDpZ6OMl6dffMg9Nwa2VSc9tdvl53O2uosBoUncavSJUcgfhVv7nSZLYwbxNZmzurTLuDNajg6JvXStHQHWso5IYfoRdFIrPV2cXwsU09TzaiNax7LyYg+w4g7WV9+ZUGr9gXvHeBp30Zhb+kqO/xwiXsezXpLIIjfTegjAQrgPNo1c8jBzQZEyLdrk7skKQ/3LCC/4lkG8WBtbPJzhGTgiqOhmqeEFqFaWtaIPkR5sMnEA4r68NnRoELWwTQpvw1FG02fGb8MHVLUb7LG+cIjSSNXRXD8uUP859E8idJWMvCuTj1HeVzEblx5LVmiG20eYaY+LDnDeGcgy8caWlyVAzounx+kNzDIwawamask+c9i4f0D3vl+KJpqBnijZWmFE4NEZXCP4v7pVSWLjaXMXqbpCbkKAOrT+3Zv39rjOZIg0sP5Ct3vKjkBiEYS4j+FGZ9t5KvoRA7OYz5HbIYmz2MQaQKkslJkq1ESZlAvw4At4VkKLrlDQzHZMEZ3Yn9o/cYs6Zwo2bCktPuus7eU9D0kmtCP0iPjU5mCI0Anz5n3Z6eRI5xKb/u4IVFox+lkbA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR04MB5450.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(2906002)(6512007)(26005)(2616005)(9686003)(186003)(6506007)(38100700002)(38350700002)(86362001)(66476007)(66556008)(66946007)(4326008)(7416002)(508600001)(8676002)(316002)(5660300002)(6486002)(36756003)(8936002)(52116002)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5Fcy9m8uAD+9Z4nwifG0KUfPYDis8OCB5iNoGjZwuX401ttiP6anwBXEqTLdGZKHi4op8uh4xxqElVFgE1gB0Jej6Xh94eyqAX7+p8z2dHta36lo+n/gl3sO6M/Hy+1x0AayP8lFLRjfg7jxqCm8pglpQwixpUDcuqcIVGWKZTASxaTydnHq2S/ykaxqbsoVZXJmCvVNgS1aiLHx8w6Dqxw0Yp0bGRM1odqXmFS3W7LQk05iyh4WuSdWG1ApfObDw6eZSpf8i0sKuRkcIoNfUuDbIyq1McDISLUooRW/s7z1SA6yoXiTq9nA/zskC2+dWIPXbd4yTzcCMQBGmGiPRDzFOd+W2Tkkv0g6dQGzqJRhQWAr469Ta51YnQdNFkjv2/twdA7z0jx+b+7WmnhER99HNE6TF3Wm02HccVDpZ5Uf6d54jpPiRUMYUQLxqHmdqiogN5nhNc0112FGgbf4stVfOGCX3yjj/wjiWxAmvgycLA1ft4OLs8v9BhzFKh35NrYJbwUNID43Ku+d/hr2Sn2eLZXzegTMZY9tYvb4tNKd8qze+WLm8sGbLuM5wV3EMy1vdj5RhdapyXj4zagmCGck/L2rsHG4FcTsbq+iN1hWhP3DalcMsjEXt/E5HhO7+4foIW5LIptdlWA39m5fg4YZa9nv3zbUf//6qX9qm+x0cPhdjq+mMMYboYzFPUcypVevzCtRmz+AsuHiqT9WjSYmvXP7/MmXeaC8Z62QxZ5134j93hDjMwQaJ4b8cfyfREGcRALNyE9gc08Ik8KJIl/fnHwkqbe/XdQS0fIzvvLYy7ju0c2DYlcfD/QW+k/rfZW9ZhfUQNej53lL6ewDm5D4b7yG4EHEttoYSDc4Xt9s3b6h2yt5aHe8iG4Sl/6N1MPnbuCa7YB80iN2OTb4k5cJWlhDz+62vykqh66pqi7dvATtgNiohEeWF9m/eHMPmnW0MAYJb50sh6nknTHoRdjxDwRKIjGIceGEp9aAlIpXSk6P89gPe3R2AwTW5AuB0ybYPndI1tOzkuX5NyXdLMYUuuIDFNOqB5/1w/d39LaX9yNou2IaU5JHm/BTFuUA5npIuPghB84PFYmuPXxLYBO0W+yoOShFCW1HDFard97KOaRDhDM6eLq2C9dLIAH5lDQP278ncfO8o98PYhaC+W5yWYK2FnDmUXamlBtEXdVo95scmkEJwkbUJrqEeCICvC+CmSpx+ldRDyOt04cDy9zGIRfPAReSlZHWV2DnJH3vWkhwXkCywUObK9DrpTbNrmP+szLDUxHOg1GJseBRA5ZrZQp9paO/qKnTOzxSoat2aHQ6QW+b0tIUClfIpSnnkFH60fI4aUcWeqTuKlLdp5NQv7w9SNuu5Zi3y1XdQkbUQ3I+AitRNKB5tRPMEOhzoHm3n18KIrk2DJhQo6Gu2yu/1NLFI0LaJllumfNGmgfd3Fogao/URsL43F0JWynNV1LZ9D0qt9WgqwHqKENtkLzkUG7K63N+jfBWAb3oUoFIHmhFISG1XkHoOFjxFGl+PTcChoXYsSjLLJ8t3OQXdDe0uHzCvH4IWjEekciMd6t1pg0qqbZV8uAeA50hXv7kZaX57mMpfnyp4ccqV+Xq7I++jklgp8luREDHtxrO7PbyFeYNelZRG5t6cBpQtBzqxT4eEUM9A9lI1qFTBajMNqj5o3/dFXm/nCT80U5dUb3lExR3fCG/+ayQheHOKl5pSbxnVKNO6YJENRKs/StY0w== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9c4b4e44-a86a-4b3f-778b-08da1e89c89d X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB5450.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Apr 2022 02:43:55.2868 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zPtB/DhPrAv6rWi2H53ithVpFwZFgCF9VY+Re808pUxPttLGO58HjRZtD/jnjjLcqtnKMOA303f8EayZGua7xQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9132 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: Sandor.yu@nxp.com, shengjiu.wang@nxp.com, cai.huoqing@linux.dev, maxime@cerno.tech Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sandor Yu HDMI1.4b specification section 6.5.3: Source shall only send GCPs with non-zero CD to sinks that indicate support for Deep Color. DW HDMI GCP default enabled, but only transmit CD and do not handle AVMUTE, PP norDefault_Phase (yet). Disable Auto GCP when 24-bit color for sinks that not support Deep Color. Signed-off-by: Sandor Yu Reviewed-by: Neil Armstrong --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 17 +++++++++++++++++ drivers/gpu/drm/bridge/synopsys/dw-hdmi.h | 3 +++ 2 files changed, 20 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 02d8f7e08814..312500921754 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -1108,6 +1108,8 @@ static void hdmi_video_packetize(struct dw_hdmi *hdmi) unsigned int output_select = HDMI_VP_CONF_OUTPUT_SELECTOR_PP; struct hdmi_data_info *hdmi_data = &hdmi->hdmi_data; u8 val, vp_conf; + u8 clear_gcp_auto = 0; + if (hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format) || hdmi_bus_fmt_is_yuv444(hdmi->hdmi_data.enc_out_bus_format) || @@ -1117,6 +1119,7 @@ static void hdmi_video_packetize(struct dw_hdmi *hdmi) case 8: color_depth = 4; output_select = HDMI_VP_CONF_OUTPUT_SELECTOR_BYPASS; + clear_gcp_auto = 1; break; case 10: color_depth = 5; @@ -1136,6 +1139,7 @@ static void hdmi_video_packetize(struct dw_hdmi *hdmi) case 0: case 8: remap_size = HDMI_VP_REMAP_YCC422_16bit; + clear_gcp_auto = 1; break; case 10: remap_size = HDMI_VP_REMAP_YCC422_20bit; @@ -1160,6 +1164,19 @@ static void hdmi_video_packetize(struct dw_hdmi *hdmi) HDMI_VP_PR_CD_DESIRED_PR_FACTOR_MASK); hdmi_writeb(hdmi, val, HDMI_VP_PR_CD); + /* HDMI1.4b specification section 6.5.3: + * Source shall only send GCPs with non-zero CD to sinks + * that indicate support for Deep Color. + * GCP only transmit CD and do not handle AVMUTE, PP norDefault_Phase (yet). + * Disable Auto GCP when 24-bit color for sinks that not support Deep Color. + */ + val = hdmi_readb(hdmi, HDMI_FC_DATAUTO3); + if (clear_gcp_auto == 1) + val &= ~HDMI_FC_DATAUTO3_GCP_AUTO; + else + val |= HDMI_FC_DATAUTO3_GCP_AUTO; + hdmi_writeb(hdmi, val, HDMI_FC_DATAUTO3); + hdmi_modb(hdmi, HDMI_VP_STUFF_PR_STUFFING_STUFFING_MODE, HDMI_VP_STUFF_PR_STUFFING_MASK, HDMI_VP_STUFF); diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h index 1999db05bc3b..18df3e119553 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h @@ -850,6 +850,9 @@ enum { HDMI_FC_DATAUTO0_VSD_MASK = 0x08, HDMI_FC_DATAUTO0_VSD_OFFSET = 3, +/* FC_DATAUTO3 field values */ + HDMI_FC_DATAUTO3_GCP_AUTO = 0x04, + /* PHY_CONF0 field values */ HDMI_PHY_CONF0_PDZ_MASK = 0x80, HDMI_PHY_CONF0_PDZ_OFFSET = 7, From patchwork Fri Apr 15 02:42:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandor Yu X-Patchwork-Id: 12814219 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 A8FF3C433EF for ; Fri, 15 Apr 2022 02:44:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EB00710E2FE; Fri, 15 Apr 2022 02:44:05 +0000 (UTC) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80085.outbound.protection.outlook.com [40.107.8.85]) by gabe.freedesktop.org (Postfix) with ESMTPS id BCEFB10E2FE for ; Fri, 15 Apr 2022 02:44:01 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kux1KD6m61U//9JQ4eYSf3voEM38mzLX372gTax1rmdAXOwOcq7U0pTR0gQxUyUUbCBIqbtTaaLEn4qIBGUhZNyLQQWmZcfwY2998NNsHKdays1flly/YGE6vs4+MUNJDw23lg+ecyGgqWalpfWR7sAolvoBNRCVfTL/4py7ahpVDvsN3Y7EfPHynimpJitNdiBwSyNGpbtOolbJfu6bWC/QZ9RfgxnmjGUzTke0JrRcqiUhcMiMYiwJt2MwTSUn9nOYc4nvLW5cFcDVU7+B19AyHCx6+rNFdQXOB053bYNPATmchUF+EN/CFnnZT5MMQrvr4ZkXQhzqmpdQxdirpQ== 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=EGiOoaay09Uo4oeYBskqha5KC/AD+waHnh7UzjMDDwY=; b=T0OeAHYXWR3fSxkY1x2MbBxyfdObjNHRqSWw6nIyKsAO++Hd2qd64cg0aPXHebk3BZDJNDtzZoQD/akBHaonKqjTPPMz0JLbriB7DaS7Swuu4qtHyGC0Nv8gBg/79eD565QQrVOG5gPbvj/Pa9sFbOcBrxFsRhEtuqYyInTiY/c8RchSBc01pnpVP0KXRDTyI8uFX8Bn2umIuM+hN55qnn74HI+lScdu22WjTucfng+1Rj9EAzaGTxEe4sPZvydlr4ijvTWZv14bbmOHcqi0fzP0GLfeIlaXhbqbjvDd1eTBr9nrtoDLnCnpu3OwLkC3EQlmcl7aP2bmE1PC5tXNMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EGiOoaay09Uo4oeYBskqha5KC/AD+waHnh7UzjMDDwY=; b=EbkJPYNapu7WTsK1zFleu2vEXa+Xh0MjpLT8uQVXxvi0asjGaaCOPe1YjetXsPpmmoUnpIkVNWi9mdLKfeM1uISBmuhxsZvwb1mmihfHWAoApogJZsm9drN+zu3HU0S5HTT33CGu5Kzey2WyCATMxxsNQne/X/ogr24SYeJoH7I= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB7PR04MB5450.eurprd04.prod.outlook.com (2603:10a6:10:86::11) by DU2PR04MB9132.eurprd04.prod.outlook.com (2603:10a6:10:2f7::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Fri, 15 Apr 2022 02:43:59 +0000 Received: from DB7PR04MB5450.eurprd04.prod.outlook.com ([fe80::7997:2892:d230:2430]) by DB7PR04MB5450.eurprd04.prod.outlook.com ([fe80::7997:2892:d230:2430%7]) with mapi id 15.20.5144.030; Fri, 15 Apr 2022 02:43:59 +0000 From: Sandor.yu@nxp.com To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, andrzej.hajda@intel.com, narmstrong@baylibre.com, robert.foss@linaro.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, hverkuil-cisco@xs4all.nl Subject: [PATCH v3 3/4] drm: bridge: dw_hdmi: add reset function for PHY GEN1 Date: Fri, 15 Apr 2022 10:42:49 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0013.APCP153.PROD.OUTLOOK.COM (2603:1096::23) To DB7PR04MB5450.eurprd04.prod.outlook.com (2603:10a6:10:86::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e097da42-00e0-47c6-c549-08da1e89cb1e X-MS-TrafficTypeDiagnostic: DU2PR04MB9132:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jkIcF9kvPGhlN75l6psSFcLqiOIuJx1CunDMWnxViFZoWdsOZaIvrOodIxqUyXMadHo0nFcs28I7vccDiP6eox/ODPo7qauGslW23FuYZOVtsGsHJSv7Cr2IcSYNF04aj+3NMPlhzyhMzcTRRpFjFUGEoZOkR70FRtoxAb1I0yLiFeGjIR6GaxlMwctfBr/TJPrUTjCSuoZ4z10EUCPBXWv1YBYdqZP48rZhc9sjwIOge0KcxIfQSCFrI2BBMk9t8cq5Xt4uBGYkCJgSHQd4+sWJsWdsAQowGAF6iiayAG2+yDn6i51500R+RdxM264dfWi+eScntQJjL+nSX1zHzJXB4kRU2yhMJPQtgw47Am7Aob7QXcR5Se2/X7TIRO68gXydPTj1ebq4fnS81s+O3cCHaHWGjUXyq5Je/07u4maw0qlyMbwKhNtU9e8tZTStCV6DWxEcow1cFLzmjM8zyUbaDfuUhfxts+DlESI38ByjQSL/HYXbRKEB3SLNz3sI6EeuZX5z3HEEXe10ZX7VnuTbDTo0hR+R6yORe2f8wTcYXoJrPhxhtq+riyT484nid9Ji1OQfmpeRcXFlciReRHJIK2Usx1/mG1DtFdnvUXNwlxUN0/YzdidJbdwkaJReYlDLk9C6THANeBCQawc3Rx6BCM/hYoRHHFfF7kHm48mfAZ6aWD94qZt/7W7vwCTv/JqCd9gfbu5bOD7R8YQMOw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR04MB5450.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(83380400001)(2906002)(6512007)(26005)(2616005)(9686003)(186003)(6506007)(38100700002)(38350700002)(86362001)(66476007)(66556008)(66946007)(4326008)(7416002)(508600001)(8676002)(316002)(5660300002)(6486002)(36756003)(8936002)(52116002)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hj6Ybqhwp9EZ4KIw8a/3VBmrAxB534U5RafXpfGGmE65Ei/9wllj/ThSqOsb/tNlYnKRG3vzT/UrAbPt34u+djq3ptOlz8B3+FyA8jRdJPn/8pDRjtsq/jrOKlcyW94pZZ+rx97GxhbiA0oEeis5SPWRzMui9s6x7Wg22sVgokNOEKFeHCq4cBb7xcRBE9HlBCjjDkfYhN3ATvFWLTcSu8CrJNWe0dfguqNZk+i8PnCGQp/n8LtMyQJmQ3Cta4Zw0rCMIkDfDHBz1Zbow6ZQdXrkfv995q7eH/1ZXIioFUaahk3oBhgghxw39yGivGkFGLe7eKV/tStDl2oAP5p9y1t90l2vy/j9yql9PJ5QJRWiKpk267lGA8MotUMx7NcIIitMRUb0SuqIGlsprWfmLEmQ0tAHtY/5uOTMjYSl4p6PjpOSNl9P3KnmldeLqp3O8zKPN42WoED8VQ8EjqmD5o6PHHrjiFYlXdqg6WtC1W5R+BPshlM52iavYmS0e6TRxTuvXlyl1CDYm6QrzJ1m7BzQHA1vNz6QoQp9dot0QOnYxBpC7KDKAqkypTAf9wynjSKCKBJ30TBb1BkIGxn3B+9TYX8vGNyVVUB+02R5gAKTNj8dwVKo5iTdomyDeGuNE7RxjltPE7TLdQ8y7bdRFUXP5JhmW3XTB3Buh06uz+9CRz2H2NDoa9wSi1wqbKDHPIe2EcmJYKmuzeXJCapIQYQBVKyt4OSOGSjH1Ifu4qFl7ZFhXO9QCk+wnaaHV41SAWXB6g8VjEkHzcuCp6tjDYtp1o/Nsx5q6oKDNeyST6MWc7dJiYkRZya8tjNd3rhZKfVR9/i9H5vVoigGnKmFVBqaDGNRgxn4NY0ukS7MH+LrMR98hQY0A3Kc3ItV6167gUYdPzL8vr1GN7s/bZU7gkTVbwEJQcFH8np0B2igkfUTcPHXz2W1l5rg/iQhmaKOGS9H4yY+esVi9MqStA6jiwjj1YEhjpvZELQ5FMYsun19UDwX2Wo5f3y81zULchE4sCfYzccZICzbvOIsK30HSdmtUviYJcYnWVAiKqP8ZRwKIl8K9KfUBhs+FDOqlFsDtDlitgjAbZLAA+AxkNEwM0F8Cv7VpTfOvXe7EdQrqhE8dkt3FJN5t5q+r6dJUOu5wzPHJvUB1eU7W5/O8ch8PqOhUdieVZz5ORPM+RXQ+gkFj00hj3TEMFsS6LsQJnjhmnGF7csZapfEB7S1hLKk8bZ8BvC2UnF/HzOo8NWBzjZ1+dKSEXyqOAYiyBKh1sIAaQ0gsWBS8GeMUMDgUiZiD4KHIreyrDPaiGYtXidcPYySpkscUPA3aomnVl5DZKvQpzgyn6/IeBSFdyCaH8xdHXO4HH4deFpJAawMzgCmpV6ULB+AuAuuAoz4fnD3pSa4jVqp00JCnZPOBT9F8R0OLYjj7gz3/WLfrGSQOLAMdvQFcJw2VryTktA2tThhfJpUFdNzqEtLrhKQzLlXj5+23ohwBMXZb300/iFIVn9iv0saBzlkNrmimkLXOjBzcz3FDh9LJz0NhYYfh/0/++kIOm9dY+AIA7EhOFbymkF9Rx83af4o9QbEG1lm/akpsoTPIH0FqhXTGyDIn+FzrxtjEVQvrBHYsW6ep5EsBxxyYYRO9GbNysJNC3Jfyigj41RhUBUdHZ9IYb3lcK2U0V9S68E9UzFqAWKUN1cY5v6C0lEerzuFIuWjaAc5ky2J6L19QlTN/bSePEqqUEnK8G0sCg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e097da42-00e0-47c6-c549-08da1e89cb1e X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB5450.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Apr 2022 02:43:59.5678 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lP8Mo0Rx1oDJXOEsjgsiNHwKIvAczb4NnO6+eVFPazQCuDI7CU0gyHNDdmayLc0pDo/9hQe1aKYg9pxqd9R4mw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9132 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: Sandor.yu@nxp.com, shengjiu.wang@nxp.com, cai.huoqing@linux.dev, maxime@cerno.tech Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sandor Yu PHY reset register(MC_PHYRSTZ) active high reset control for PHY GEN2, and active low reset control for PHY GEN1. Rename function dw_hdmi_phy_reset to dw_hdmi_phy_gen2_reset. Add dw_hdmi_phy_gen1_reset function for PHY GEN1. Signed-off-by: Sandor Yu Reviewed-by: Neil Armstrong Acked-by: Jernej Skrabec --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 14 +++++++++++--- drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 2 +- include/drm/bridge/dw_hdmi.h | 4 +++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 312500921754..ac98605a6811 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -1374,13 +1374,21 @@ static void dw_hdmi_phy_sel_interface_control(struct dw_hdmi *hdmi, u8 enable) HDMI_PHY_CONF0_SELDIPIF_MASK); } -void dw_hdmi_phy_reset(struct dw_hdmi *hdmi) +void dw_hdmi_phy_gen1_reset(struct dw_hdmi *hdmi) +{ + /* PHY reset. The reset signal is active low on Gen1 PHYs. */ + hdmi_writeb(hdmi, 0, HDMI_MC_PHYRSTZ); + hdmi_writeb(hdmi, HDMI_MC_PHYRSTZ_PHYRSTZ, HDMI_MC_PHYRSTZ); +} +EXPORT_SYMBOL_GPL(dw_hdmi_phy_gen1_reset); + +void dw_hdmi_phy_gen2_reset(struct dw_hdmi *hdmi) { /* PHY reset. The reset signal is active high on Gen2 PHYs. */ hdmi_writeb(hdmi, HDMI_MC_PHYRSTZ_PHYRSTZ, HDMI_MC_PHYRSTZ); hdmi_writeb(hdmi, 0, HDMI_MC_PHYRSTZ); } -EXPORT_SYMBOL_GPL(dw_hdmi_phy_reset); +EXPORT_SYMBOL_GPL(dw_hdmi_phy_gen2_reset); void dw_hdmi_phy_i2c_set_addr(struct dw_hdmi *hdmi, u8 address) { @@ -1534,7 +1542,7 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi, if (phy->has_svsret) dw_hdmi_phy_enable_svsret(hdmi, 1); - dw_hdmi_phy_reset(hdmi); + dw_hdmi_phy_gen2_reset(hdmi); hdmi_writeb(hdmi, HDMI_MC_HEACPHY_RST_ASSERT, HDMI_MC_HEACPHY_RST); diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c index 5e2b0175df36..2860e6bff8b7 100644 --- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c @@ -135,7 +135,7 @@ static int sun8i_hdmi_phy_config_a83t(struct dw_hdmi *hdmi, dw_hdmi_phy_gen2_txpwron(hdmi, 0); dw_hdmi_phy_gen2_pddq(hdmi, 1); - dw_hdmi_phy_reset(hdmi); + dw_hdmi_phy_gen2_reset(hdmi); dw_hdmi_phy_gen2_pddq(hdmi, 0); diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h index 2a1f85f9a8a3..70082f80a8c8 100644 --- a/include/drm/bridge/dw_hdmi.h +++ b/include/drm/bridge/dw_hdmi.h @@ -187,9 +187,11 @@ void dw_hdmi_phy_i2c_set_addr(struct dw_hdmi *hdmi, u8 address); void dw_hdmi_phy_i2c_write(struct dw_hdmi *hdmi, unsigned short data, unsigned char addr); +void dw_hdmi_phy_gen1_reset(struct dw_hdmi *hdmi); + void dw_hdmi_phy_gen2_pddq(struct dw_hdmi *hdmi, u8 enable); void dw_hdmi_phy_gen2_txpwron(struct dw_hdmi *hdmi, u8 enable); -void dw_hdmi_phy_reset(struct dw_hdmi *hdmi); +void dw_hdmi_phy_gen2_reset(struct dw_hdmi *hdmi); enum drm_connector_status dw_hdmi_phy_read_hpd(struct dw_hdmi *hdmi, void *data); From patchwork Fri Apr 15 02:42:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandor Yu X-Patchwork-Id: 12814220 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 576C0C433FE for ; Fri, 15 Apr 2022 02:44:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6B10B10E425; Fri, 15 Apr 2022 02:44:09 +0000 (UTC) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70059.outbound.protection.outlook.com [40.107.7.59]) by gabe.freedesktop.org (Postfix) with ESMTPS id E3AD710E425 for ; Fri, 15 Apr 2022 02:44:06 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j0jAFOK4ms2tIkyRmNyZtNmttQGW64b9qR1AiRAFjb73lj//64R3dTLpVWYHgojKTE48RDduYf2r8aEZNjp83sQg+3NUn9Ce/TcLeryEhMqRUfW0bGtzzXCvJ10NO0jH5FcCAMYjF2GjHT/pct9U5pToi3jx0wYZ85Rxjd7Y2xK7g0FmUh8WCxHTbHAeA6QzK572EbVKj2rybFEGJiTDTY1Gr+IPRX/GEwndDlPt5hqfhOe/AK/aZhp0Zh9x7LUxjqxe7Qz69kTMmWsDrTNqiTMlZjnMjMw123XyEXotIodY4tn4soypm+B8xMERCUvB7Axt13TCbLan7QtLKHYYjA== 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=I1gKlCgDhKRGC1DvS2sZB3tLGwTvsrHYpdscJGGSSRE=; b=F2TnBI+Wd8HDDQ/d+St5JDkMHwwXhBPUWTc/1AtdLZkUe54Zoof8guHCElAuOAxqBoW3/UnEG3lgFIMGq2qFrf2Ai0YPHcyb9zdDHqnjCoGTy9NTHNNkUxE4asBHybT0hIUK7nJWO5Lf7D2DT697F1NRbIsz4r+Ms+z0l93QdyF6SQh0v7L045zy08Y3v4J4YyPQm+G5UyIrN+as5n3lPvDf8lihb8Evu6glleU+3KOAIUxY1V9Yz5m0qtkUJnhTgoLIGZip+29INb98aNHEHOGNo9tyYgDgUqaTAnLXnfygyj4jsZfrpD2qafYZQf8JYuFGQVuyEv0+s7DGpcGJCA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I1gKlCgDhKRGC1DvS2sZB3tLGwTvsrHYpdscJGGSSRE=; b=UO1w31L15d5PPCI5gqu/2KIQkjpm8hYgeRzQhSqanJDyZ80SNstKGB6CPDg1oK0iCYiFMYQPUn7Z4wNdSmpAGl3qftHagLkwiL3n6WtJmrcLEn/M04rmF+hGlZk4SlvCMXfjfjQVRvkIb6aior2i79JAhXTE17IHd+uxhu6fktg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB7PR04MB5450.eurprd04.prod.outlook.com (2603:10a6:10:86::11) by DU2PR04MB9132.eurprd04.prod.outlook.com (2603:10a6:10:2f7::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Fri, 15 Apr 2022 02:44:04 +0000 Received: from DB7PR04MB5450.eurprd04.prod.outlook.com ([fe80::7997:2892:d230:2430]) by DB7PR04MB5450.eurprd04.prod.outlook.com ([fe80::7997:2892:d230:2430%7]) with mapi id 15.20.5144.030; Fri, 15 Apr 2022 02:44:03 +0000 From: Sandor.yu@nxp.com To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, andrzej.hajda@intel.com, narmstrong@baylibre.com, robert.foss@linaro.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, hverkuil-cisco@xs4all.nl Subject: [PATCH v3 4/4] drm: bridge: dw_hdmi: Audio: Add General Parallel Audio (GPA) driver Date: Fri, 15 Apr 2022 10:42:50 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0013.APCP153.PROD.OUTLOOK.COM (2603:1096::23) To DB7PR04MB5450.eurprd04.prod.outlook.com (2603:10a6:10:86::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e2bbbfe7-5314-4680-9c3c-08da1e89cda9 X-MS-TrafficTypeDiagnostic: DU2PR04MB9132:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oLeY9sfcI8JhOgnRODoPCRXSB5rLg3to6a+MGKMLisMGImNtMiKiQ6aG1nYbWTG9KdE2xInuyuklUklmDc57Q1b9JiwkwxMwKLQmduvW9Qr/oUfx1JvVt9KMUDs7BsT8Y4QtYWcz7XTb1LBwcp5wlCUHeCEcjHKodI/Hha3kM0bPgvwTSuBpMizPhEZKk5jbUCjF8zlCNoAFYZAdqpVaa0/mrihqHmy1kTzGqZRkf3sNuk9jUYVNFn12+6bXa9K8CkCEHf/3h/5xEuNu9gdW5vl3T/I75uscNB8a83Q2w2lKDA6vk48ylO5vXQrqjH1MqZhrV6iKHntfxLXADEpmoomb1nRS3Yveic8ROUDXEz7YTueSyfiknNu+iddak5UI7bmAmh3ijRgBiH7ttboBLP5LsM+MeZP/567dpquw0+aXGex5neiBiIWuPH6EgITYqoxOI4WtLkJh8gLABvn1/X69D6EvkX7zTa4tSejhg4sLUmWr5h22MXWMjx/itYLxMVaWRXv0eRLf1JjiytNeFNaU/0FvcKXR8C3MHc51EyPs/k9BmuFonHc0LMArGKTl4dCbOuI3dIi8j1p2Q4OMAVx9sxTNDhB9jpKHT5y+ns9MhgQT19hrh8OSaBxLp+p7VPCep4wqhbPKkaCd8OI8c9ed5Gj4Vxqxky2cn0nj7uak2b4RMTSSHO99/dN52nRlEQfSoIK44tRgH7/RhKJiLA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR04MB5450.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(83380400001)(2906002)(6512007)(26005)(2616005)(9686003)(186003)(6506007)(38100700002)(38350700002)(86362001)(66476007)(66556008)(66946007)(4326008)(7416002)(508600001)(8676002)(316002)(5660300002)(30864003)(6486002)(36756003)(8936002)(52116002)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 39PWWfLKocOe6jct3HFQ8rPLvJul5oo56PwvpyJXSmV+k1Tn3lMXjcMVLUxc2Sd1/UUu7SZkO+pu2pty4oMdGFRxaL4i40ocYfBh3Ep9ewYgn224W2DNNvZ5BfNck29UYHtzX0pJii1CXPCrKtemngJ9Z2OKKv8aoEaf+9IKcevCFGkdhRtK8ABHFiaiKFzW+uIdU/NwbIfMpvnC7OjFT05D2m2D4Ozs0kBz5Ts+8Y4jq021RbEgoo/H1snZn7mPaOGG3w7I1tk2WWH4XG/YJT7CgYuHeaNBhNIkrWqxtXtVdsVI8CDSx3shriL6diWRctwlie/B5HBC7wGP1hUM5kamIJ2vE+9rKiqwgkoyAqkeFTIv3kJ05HyP0BtOP4rzHFYWsylvE3vkDHypiWo4bJBzdSeXyhDMGvB7dk2ZXAczHmjStus326VJ1bSz2HjLTxQo5HBi1XM86lAR7rYiXDfcqiPBBs4ummFVf6aFgdfY5UH35ythWLjnTz8bu6rO1sYqVO+VQlAdoD02g627girtnF8c6Vyoz7mwVy6ydQ20Us0Snmqe6cnBaye1OSMrwyne2rOa+OwkB+Fww8wBgxcX8hP0QQQfgYTtR9j832hdyjKNxOKF99S/6WCREOUqUIYoaFq01rbX53+v97D/UnNlKGKlYtxFXdawT2ZoHdb0yXUFnZFMyG2pY4/J6zOk8FY2JluMJGp0a+bbY03FfCjekOChgY8HgAEzmaO7P8yIZDInjjkXAmZi7rjhLR+/ABROOiE0drcfLWVMF/9dbhufao1rsDKADaXttdSwY0GPdMmLUNIvZpYp5rXWMYGeSKJSJKoUPZ4zBE4gk40W4eHkanxj6cOL/uBfPZD0fiXdBVMYpIe7LKM2Jx10obCiMPhUr9cTwqu/qyCWHb/DYaGCTDhsSIit6de4jh8Wa+S281Pxu5TCNTduT6d9EIvDyNeqb1FDjWw35l5nnCWaTpZqw3OQo1uNFq47W6iadCDUS+2jHWm7GMFEWqyDI/q8XuvPQkQi1Doii9NgQBu51e5LVtQnmb1futTl6HnaYFFEp7A9HLgSZw6thikKmnzDhhQajedmF3AIScjsFAM0NHa4rCnuD9aIZhfGt1jbTXNvWdPMalwzPSJUJvK0PRDREvUngVtPHfrlUkyfqAnyk2EL7XzD1G8HU65i8Ui4vNv1uUqabj/AiErqH604VbMMqWsqvVhgeJrgquhkH5kHgcrfjErEBg7e6sP8c++rePCTxkUNUE5JOMwcrAQC35uiuurBIhkkbKjO5ywCaDbs56ebE01VWCpmUSJh7rACzwjlh4z9UDRTLMBsDHBu5B55c19kNZSfjRJN8zW4bVZA1Y7RPYXeMSWARljQRcosv/hoQTqPTZMIuDDFn0n1/Nk+dxxii49CzUFgQ9m8AGpUsPZr7vXhfBjOtS0NEJPUiwfBt7g2op1Yx8jHLMOdxg0fWDXjLOKUhhyugEtW4HB2FfvsTC1QaTujZPM30Xuj/lo11Nui5A7WKDzuUu35WDtCbMbRZIjq01MsgS/2j84uBtG/Fpn50cDcvTR30/CJu0K73e7FqCGI7p7Z20lnOeiiHE4nnwBH1rbYPpvIq4FoHmisc6v6l6Kx0FHIitQGQhH8AcT7gwGMUsyQuGId4wEwk06nE9f+SfFcEAGyT4E5t+OfpYbp/gO8JOz9V840dRqS841cpFa3Rbdb8o2TGWeXqEIOXDa+gh1mPnSvpmernA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e2bbbfe7-5314-4680-9c3c-08da1e89cda9 X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB5450.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Apr 2022 02:44:03.8487 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UEMjCCRS0+lHFeIOnrtdgVQSMtAqgQAqLutDGr6O6+TDuWyOooxhSN9q3ucn6AS2pwgT8tT4Vd90CTVyLzbVMA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9132 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: Sandor.yu@nxp.com, shengjiu.wang@nxp.com, cai.huoqing@linux.dev, maxime@cerno.tech Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sandor Yu General Parallel Audio (GPA) interface is one of the supported audio interface for synopsys HDMI module, which has verified for i.MX8MPlus platform. This is initial version for GPA. Signed-off-by: Shengjiu Wang Signed-off-by: Sandor Yu Reviewed-by: Neil Armstrong --- drivers/gpu/drm/bridge/synopsys/Kconfig | 10 + drivers/gpu/drm/bridge/synopsys/Makefile | 1 + .../drm/bridge/synopsys/dw-hdmi-gp-audio.c | 199 ++++++++++++++++++ drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 132 +++++++++++- drivers/gpu/drm/bridge/synopsys/dw-hdmi.h | 13 +- include/drm/bridge/dw_hdmi.h | 7 + 6 files changed, 358 insertions(+), 4 deletions(-) create mode 100644 drivers/gpu/drm/bridge/synopsys/dw-hdmi-gp-audio.c diff --git a/drivers/gpu/drm/bridge/synopsys/Kconfig b/drivers/gpu/drm/bridge/synopsys/Kconfig index 21a1be3ced0f..a4a31b669b65 100644 --- a/drivers/gpu/drm/bridge/synopsys/Kconfig +++ b/drivers/gpu/drm/bridge/synopsys/Kconfig @@ -25,6 +25,16 @@ config DRM_DW_HDMI_I2S_AUDIO Support the I2S Audio interface which is part of the Synopsys Designware HDMI block. +config DRM_DW_HDMI_GP_AUDIO + tristate "Synopsys Designware GP Audio interface" + depends on DRM_DW_HDMI && SND + select SND_PCM + select SND_PCM_ELD + select SND_PCM_IEC958 + help + Support the GP Audio interface which is part of the Synopsys + Designware HDMI block. + config DRM_DW_HDMI_CEC tristate "Synopsis Designware CEC interface" depends on DRM_DW_HDMI diff --git a/drivers/gpu/drm/bridge/synopsys/Makefile b/drivers/gpu/drm/bridge/synopsys/Makefile index 91d746ad5de1..ce715562e9e5 100644 --- a/drivers/gpu/drm/bridge/synopsys/Makefile +++ b/drivers/gpu/drm/bridge/synopsys/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_DRM_DW_HDMI) += dw-hdmi.o obj-$(CONFIG_DRM_DW_HDMI_AHB_AUDIO) += dw-hdmi-ahb-audio.o +obj-$(CONFIG_DRM_DW_HDMI_GP_AUDIO) += dw-hdmi-gp-audio.o obj-$(CONFIG_DRM_DW_HDMI_I2S_AUDIO) += dw-hdmi-i2s-audio.o obj-$(CONFIG_DRM_DW_HDMI_CEC) += dw-hdmi-cec.o diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-gp-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-gp-audio.c new file mode 100644 index 000000000000..8ca401b0dc2b --- /dev/null +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-gp-audio.c @@ -0,0 +1,199 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * dw-hdmi-gp-audio.c + * + * Copyright 2020-2022 NXP + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "dw-hdmi-audio.h" + +#define DRIVER_NAME "dw-hdmi-gp-audio" +#define DRV_NAME "hdmi-gp-audio" + +struct snd_dw_hdmi { + struct dw_hdmi_audio_data data; + struct platform_device *audio_pdev; + unsigned int pos; +}; + +struct dw_hdmi_channel_conf { + u8 conf1; + u8 ca; +}; + +/* + * The default mapping of ALSA channels to HDMI channels and speaker + * allocation bits. Note that we can't do channel remapping here - + * channels must be in the same order. + * + * Mappings for alsa-lib pcm/surround*.conf files: + * + * Front Sur4.0 Sur4.1 Sur5.0 Sur5.1 Sur7.1 + * Channels 2 4 6 6 6 8 + * + * Our mapping from ALSA channel to CEA686D speaker name and HDMI channel: + * + * Number of ALSA channels + * ALSA Channel 2 3 4 5 6 7 8 + * 0 FL:0 = = = = = = + * 1 FR:1 = = = = = = + * 2 FC:3 RL:4 LFE:2 = = = + * 3 RR:5 RL:4 FC:3 = = + * 4 RR:5 RL:4 = = + * 5 RR:5 = = + * 6 RC:6 = + * 7 RLC/FRC RLC/FRC + */ +static struct dw_hdmi_channel_conf default_hdmi_channel_config[7] = { + { 0x03, 0x00 }, /* FL,FR */ + { 0x0b, 0x02 }, /* FL,FR,FC */ + { 0x33, 0x08 }, /* FL,FR,RL,RR */ + { 0x37, 0x09 }, /* FL,FR,LFE,RL,RR */ + { 0x3f, 0x0b }, /* FL,FR,LFE,FC,RL,RR */ + { 0x7f, 0x0f }, /* FL,FR,LFE,FC,RL,RR,RC */ + { 0xff, 0x13 }, /* FL,FR,LFE,FC,RL,RR,[FR]RC,[FR]LC */ +}; + +static int audio_hw_params(struct device *dev, void *data, + struct hdmi_codec_daifmt *daifmt, + struct hdmi_codec_params *params) +{ + struct snd_dw_hdmi *dw = dev_get_drvdata(dev); + int ret = 0; + u8 ca; + + dw_hdmi_set_sample_rate(dw->data.hdmi, params->sample_rate); + + ca = default_hdmi_channel_config[params->channels - 2].ca; + + dw_hdmi_set_channel_count(dw->data.hdmi, params->channels); + dw_hdmi_set_channel_allocation(dw->data.hdmi, ca); + + dw_hdmi_set_sample_non_pcm(dw->data.hdmi, + params->iec.status[0] & IEC958_AES0_NONAUDIO); + dw_hdmi_set_sample_width(dw->data.hdmi, params->sample_width); + + return ret; +} + +static void audio_shutdown(struct device *dev, void *data) +{ +} + +static int audio_mute_stream(struct device *dev, void *data, + bool enable, int direction) +{ + struct snd_dw_hdmi *dw = dev_get_drvdata(dev); + int ret = 0; + + if (!enable) + dw_hdmi_audio_enable(dw->data.hdmi); + else + dw_hdmi_audio_disable(dw->data.hdmi); + + return ret; +} + +static int audio_get_eld(struct device *dev, void *data, + u8 *buf, size_t len) +{ + struct dw_hdmi_audio_data *audio = data; + u8 *eld; + + eld = audio->get_eld(audio->hdmi); + if (eld) + memcpy(buf, eld, min_t(size_t, MAX_ELD_BYTES, len)); + else + /* Pass en empty ELD if connector not available */ + memset(buf, 0, len); + + return 0; +} + +static int audio_hook_plugged_cb(struct device *dev, void *data, + hdmi_codec_plugged_cb fn, + struct device *codec_dev) +{ + struct snd_dw_hdmi *dw = dev_get_drvdata(dev); + + return dw_hdmi_set_plugged_cb(dw->data.hdmi, fn, codec_dev); +} + +static const struct hdmi_codec_ops audio_codec_ops = { + .hw_params = audio_hw_params, + .audio_shutdown = audio_shutdown, + .mute_stream = audio_mute_stream, + .get_eld = audio_get_eld, + .hook_plugged_cb = audio_hook_plugged_cb, +}; + +static int snd_dw_hdmi_probe(struct platform_device *pdev) +{ + struct dw_hdmi_audio_data *data = pdev->dev.platform_data; + struct snd_dw_hdmi *dw; + + const struct hdmi_codec_pdata codec_data = { + .i2s = 1, + .spdif = 0, + .ops = &audio_codec_ops, + .max_i2s_channels = 8, + .data = data, + }; + + dw = devm_kzalloc(&pdev->dev, sizeof(*dw), GFP_KERNEL); + if (!dw) + return -ENOMEM; + + dw->data = *data; + + platform_set_drvdata(pdev, dw); + + dw->audio_pdev = platform_device_register_data(&pdev->dev, + HDMI_CODEC_DRV_NAME, 1, + &codec_data, + sizeof(codec_data)); + + return PTR_ERR_OR_ZERO(dw->audio_pdev); +} + +static int snd_dw_hdmi_remove(struct platform_device *pdev) +{ + struct snd_dw_hdmi *dw = platform_get_drvdata(pdev); + + platform_device_unregister(dw->audio_pdev); + + return 0; +} + +static struct platform_driver snd_dw_hdmi_driver = { + .probe = snd_dw_hdmi_probe, + .remove = snd_dw_hdmi_remove, + .driver = { + .name = DRIVER_NAME, + }, +}; + +module_platform_driver(snd_dw_hdmi_driver); + +MODULE_AUTHOR("Shengjiu Wang "); +MODULE_DESCRIPTION("Synopsys Designware HDMI GPA ALSA interface"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:" DRIVER_NAME); diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index ac98605a6811..f51e199a7493 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -191,7 +191,10 @@ struct dw_hdmi { spinlock_t audio_lock; struct mutex audio_mutex; + unsigned int sample_non_pcm; + unsigned int sample_width; unsigned int sample_rate; + unsigned int channels; unsigned int audio_cts; unsigned int audio_n; bool audio_enable; @@ -589,6 +592,8 @@ static unsigned int hdmi_compute_n(unsigned int freq, unsigned long pixel_clk) n = 4096; else if (pixel_clk == 74176000 || pixel_clk == 148352000) n = 11648; + else if (pixel_clk == 297000000) + n = 3072; else n = 4096; n *= mult; @@ -601,6 +606,8 @@ static unsigned int hdmi_compute_n(unsigned int freq, unsigned long pixel_clk) n = 17836; else if (pixel_clk == 148352000) n = 8918; + else if (pixel_clk == 297000000) + n = 4704; else n = 6272; n *= mult; @@ -615,6 +622,8 @@ static unsigned int hdmi_compute_n(unsigned int freq, unsigned long pixel_clk) n = 11648; else if (pixel_clk == 148352000) n = 5824; + else if (pixel_clk == 297000000) + n = 5120; else n = 6144; n *= mult; @@ -659,8 +668,8 @@ static void hdmi_set_clk_regenerator(struct dw_hdmi *hdmi, config3 = hdmi_readb(hdmi, HDMI_CONFIG3_ID); - /* Only compute CTS when using internal AHB audio */ - if (config3 & HDMI_CONFIG3_AHBAUDDMA) { + /* Compute CTS when using internal AHB audio or General Parallel audio*/ + if ((config3 & HDMI_CONFIG3_AHBAUDDMA) || (config3 & HDMI_CONFIG3_GPAUD)) { /* * Compute the CTS value from the N value. Note that CTS and N * can be up to 20 bits in total, so we need 64-bit math. Also @@ -702,6 +711,22 @@ static void hdmi_clk_regenerator_update_pixel_clock(struct dw_hdmi *hdmi) mutex_unlock(&hdmi->audio_mutex); } +void dw_hdmi_set_sample_width(struct dw_hdmi *hdmi, unsigned int width) +{ + mutex_lock(&hdmi->audio_mutex); + hdmi->sample_width = width; + mutex_unlock(&hdmi->audio_mutex); +} +EXPORT_SYMBOL_GPL(dw_hdmi_set_sample_width); + +void dw_hdmi_set_sample_non_pcm(struct dw_hdmi *hdmi, unsigned int non_pcm) +{ + mutex_lock(&hdmi->audio_mutex); + hdmi->sample_non_pcm = non_pcm; + mutex_unlock(&hdmi->audio_mutex); +} +EXPORT_SYMBOL_GPL(dw_hdmi_set_sample_non_pcm); + void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate) { mutex_lock(&hdmi->audio_mutex); @@ -717,6 +742,7 @@ void dw_hdmi_set_channel_count(struct dw_hdmi *hdmi, unsigned int cnt) u8 layout; mutex_lock(&hdmi->audio_mutex); + hdmi->channels = cnt; /* * For >2 channel PCM audio, we need to select layout 1 @@ -765,6 +791,89 @@ static u8 *hdmi_audio_get_eld(struct dw_hdmi *hdmi) return hdmi->curr_conn->eld; } +static void dw_hdmi_gp_audio_enable(struct dw_hdmi *hdmi) +{ + const struct dw_hdmi_plat_data *pdata = hdmi->plat_data; + int sample_freq = 0x2, org_sample_freq = 0xD; + int ch_mask = BIT(hdmi->channels) - 1; + + switch (hdmi->sample_rate) { + case 32000: + sample_freq = 0x03; + org_sample_freq = 0x0C; + break; + case 44100: + sample_freq = 0x00; + org_sample_freq = 0x0F; + break; + case 48000: + sample_freq = 0x02; + org_sample_freq = 0x0D; + break; + case 88200: + sample_freq = 0x08; + org_sample_freq = 0x07; + break; + case 96000: + sample_freq = 0x0A; + org_sample_freq = 0x05; + break; + case 176400: + sample_freq = 0x0C; + org_sample_freq = 0x03; + break; + case 192000: + sample_freq = 0x0E; + org_sample_freq = 0x01; + break; + default: + break; + } + + hdmi_set_cts_n(hdmi, hdmi->audio_cts, hdmi->audio_n); + hdmi_enable_audio_clk(hdmi, true); + + hdmi_writeb(hdmi, 0x1, HDMI_FC_AUDSCHNLS0); + hdmi_writeb(hdmi, hdmi->channels, HDMI_FC_AUDSCHNLS2); + hdmi_writeb(hdmi, 0x22, HDMI_FC_AUDSCHNLS3); + hdmi_writeb(hdmi, 0x22, HDMI_FC_AUDSCHNLS4); + hdmi_writeb(hdmi, 0x11, HDMI_FC_AUDSCHNLS5); + hdmi_writeb(hdmi, 0x11, HDMI_FC_AUDSCHNLS6); + hdmi_writeb(hdmi, (0x3 << 4) | sample_freq, HDMI_FC_AUDSCHNLS7); + hdmi_writeb(hdmi, (org_sample_freq << 4) | 0xb, HDMI_FC_AUDSCHNLS8); + + hdmi_writeb(hdmi, ch_mask, HDMI_GP_CONF1); + hdmi_writeb(hdmi, 0x02, HDMI_GP_CONF2); + hdmi_writeb(hdmi, 0x01, HDMI_GP_CONF0); + + hdmi_modb(hdmi, 0x3, 0x3, HDMI_FC_DATAUTO3); + + /* hbr */ + if (hdmi->sample_rate == 192000 && hdmi->channels == 8 && + hdmi->sample_width == 32 && hdmi->sample_non_pcm) + hdmi_modb(hdmi, 0x01, 0x01, HDMI_GP_CONF2); + + if (pdata->enable_audio) + pdata->enable_audio(hdmi, + hdmi->channels, + hdmi->sample_width, + hdmi->sample_rate, + hdmi->sample_non_pcm); +} + +static void dw_hdmi_gp_audio_disable(struct dw_hdmi *hdmi) +{ + const struct dw_hdmi_plat_data *pdata = hdmi->plat_data; + + hdmi_set_cts_n(hdmi, hdmi->audio_cts, 0); + + hdmi_modb(hdmi, 0, 0x3, HDMI_FC_DATAUTO3); + if (pdata->disable_audio) + pdata->disable_audio(hdmi); + + hdmi_enable_audio_clk(hdmi, false); +} + static void dw_hdmi_ahb_audio_enable(struct dw_hdmi *hdmi) { hdmi_set_cts_n(hdmi, hdmi->audio_cts, hdmi->audio_n); @@ -3258,6 +3367,7 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev, hdmi->plat_data = plat_data; hdmi->dev = dev; hdmi->sample_rate = 48000; + hdmi->channels = 2; hdmi->disabled = true; hdmi->rxsense = true; hdmi->phy_mask = (u8)~(HDMI_PHY_HPD | HDMI_PHY_RX_SENSE); @@ -3481,6 +3591,24 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev, pdevinfo.size_data = sizeof(audio); pdevinfo.dma_mask = DMA_BIT_MASK(32); hdmi->audio = platform_device_register_full(&pdevinfo); + } else if (iores && config3 & HDMI_CONFIG3_GPAUD) { + struct dw_hdmi_audio_data audio; + + audio.phys = iores->start; + audio.base = hdmi->regs; + audio.irq = irq; + audio.hdmi = hdmi; + audio.get_eld = hdmi_audio_get_eld; + + hdmi->enable_audio = dw_hdmi_gp_audio_enable; + hdmi->disable_audio = dw_hdmi_gp_audio_disable; + + pdevinfo.name = "dw-hdmi-gp-audio"; + pdevinfo.id = PLATFORM_DEVID_NONE; + pdevinfo.data = &audio; + pdevinfo.size_data = sizeof(audio); + pdevinfo.dma_mask = DMA_BIT_MASK(32); + hdmi->audio = platform_device_register_full(&pdevinfo); } if (!plat_data->disable_cec && (config0 & HDMI_CONFIG0_CEC)) { diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h index 18df3e119553..af43a0414b78 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h @@ -158,8 +158,17 @@ #define HDMI_FC_SPDDEVICEINF 0x1062 #define HDMI_FC_AUDSCONF 0x1063 #define HDMI_FC_AUDSSTAT 0x1064 -#define HDMI_FC_AUDSCHNLS7 0x106e -#define HDMI_FC_AUDSCHNLS8 0x106f +#define HDMI_FC_AUDSV 0x1065 +#define HDMI_FC_AUDSU 0x1066 +#define HDMI_FC_AUDSCHNLS0 0x1067 +#define HDMI_FC_AUDSCHNLS1 0x1068 +#define HDMI_FC_AUDSCHNLS2 0x1069 +#define HDMI_FC_AUDSCHNLS3 0x106A +#define HDMI_FC_AUDSCHNLS4 0x106B +#define HDMI_FC_AUDSCHNLS5 0x106C +#define HDMI_FC_AUDSCHNLS6 0x106D +#define HDMI_FC_AUDSCHNLS7 0x106E +#define HDMI_FC_AUDSCHNLS8 0x106F #define HDMI_FC_DATACH0FILL 0x1070 #define HDMI_FC_DATACH1FILL 0x1071 #define HDMI_FC_DATACH2FILL 0x1072 diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h index 70082f80a8c8..f668e75fbabe 100644 --- a/include/drm/bridge/dw_hdmi.h +++ b/include/drm/bridge/dw_hdmi.h @@ -143,6 +143,11 @@ struct dw_hdmi_plat_data { const struct drm_display_info *info, const struct drm_display_mode *mode); + /* Platform-specific audio enable/disable (optional) */ + void (*enable_audio)(struct dw_hdmi *hdmi, int channel, + int width, int rate, int non_pcm); + void (*disable_audio)(struct dw_hdmi *hdmi); + /* Vendor PHY support */ const struct dw_hdmi_phy_ops *phy_ops; const char *phy_name; @@ -173,6 +178,8 @@ void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense); int dw_hdmi_set_plugged_cb(struct dw_hdmi *hdmi, hdmi_codec_plugged_cb fn, struct device *codec_dev); +void dw_hdmi_set_sample_non_pcm(struct dw_hdmi *hdmi, unsigned int non_pcm); +void dw_hdmi_set_sample_width(struct dw_hdmi *hdmi, unsigned int width); void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate); void dw_hdmi_set_channel_count(struct dw_hdmi *hdmi, unsigned int cnt); void dw_hdmi_set_channel_status(struct dw_hdmi *hdmi, u8 *channel_status);