From patchwork Wed Jul 26 01:48:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandor Yu X-Patchwork-Id: 126041 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp142692vqo; Tue, 25 Jul 2023 20:01:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlHyD5LXHwV+zo2PcgSgI09By732GQ+H2emdo1HctiTupsXnr/F7KsVtREVb5NF5hN4QmOFk X-Received: by 2002:a17:906:1085:b0:99b:4e70:d09b with SMTP id u5-20020a170906108500b0099b4e70d09bmr487396eju.46.1690340498250; Tue, 25 Jul 2023 20:01:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1690340498; cv=pass; d=google.com; s=arc-20160816; b=vLOdqcjcBe4Mpg7E03NC9JFl09NpYrNF0JAkP1I60mbyiPyfywHhEtLpI61cEPeZ0t AjRzRZAYBFk0H9ErkpfvTCRSr7EPJPUmekRpQxO0UiT0aQncTywQnX9maKY5bE553BLy +lgYDcxtpt5SCvys1tr0MheeO1jWWAQ1hedKb97rTILej2m2qATDCfwq57mkowuNAXgt nEN+Lx3LCsV8TluWtVbjdQWUC31FaZTmlMPtYadlT5ejU5N1dWi44Bvo4Kh+kUlu1GG0 0D4SwGdGJSGmmjz+TrsLUr6meszUip5jlA4Rq1Cc9lVTjiSVGQEJqzvBIi3R6M3+Dl0D Zl0g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=gvdnAdk7QzctPMErf+ih3R5qpCemk0bDu3ZPzO6Aw/o=; fh=XOczGQ6bQKdviQgFLeVOO9HCRDOaV2hZGiI8G3UunSk=; b=CkhiNjuhf4jYXBYc2fPvIqICNsCZ1hDVZuh30MmpPikPyQyy470QqdHUGn2KleT42N ARnZthFASaNqSQTJFDHp0ieYVKbmiYpyxAKzrDBR7/RwzDEisX1zQO7TF8KssiZqaTks UbPQmpXfzokh/OTlKPgBR7vQaficJZHN86vZgOyCr9q5t3nHb75phqp+bNQROxlvEiar fkIqWPdIXxdRYuXAPmucpcFus1SZnxSouiMw6FqUt6YEt4wgPcfCy0sq1wBVF84MLhTB 4ekZLShcutYRBog7KMc8s4eL31vVhauf1JxYtLmxYzMChCP5zT2D/mdsBUvo21braA8u xYsg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=qReyIk1s; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lf5-20020a170907174500b00986f786c94asi9186161ejc.113.2023.07.25.20.01.14; Tue, 25 Jul 2023 20:01:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=qReyIk1s; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229897AbjGZBtZ (ORCPT + 99 others); Tue, 25 Jul 2023 21:49:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbjGZBtX (ORCPT ); Tue, 25 Jul 2023 21:49:23 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2065.outbound.protection.outlook.com [40.107.22.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2437B9B for ; Tue, 25 Jul 2023 18:49:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CV6bigJ0gbFQZfCw2FeG1NlRmrco31qYVSpT2TMTbPA0A8UPheYn4oWDniurWbrCVFPREeusNScbQKzf7wiKi/jZQwUhYfEiQlXVOt53ckRl3mPggsLcTOWSsATaQTdrFeqCMiOrB8u8iPz76h4uToV7b+Ekhko2R8boqLE56Z6ysFPPE+JBe6G7++3F8BO0dz3WGtRc5nGx0mm7qZElA+LuypYu4+XmEWBZRDUjjlBO/cMfKPgm2Paw6cAVJLhIQn74KlcKS4NW2+zPAyfiqLNsMgizGCKzI4oDoLDzwQjcA2hcMyUpw9w9bxL8aqLQs2KzKIvTVMrQexTZNYTmRg== 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=gvdnAdk7QzctPMErf+ih3R5qpCemk0bDu3ZPzO6Aw/o=; b=LWQD+NsreOpP65/kDzJW97J72HVOyh5CB9+Z1afQ55ugi9GIh/DzzHywgte5eQsuRW/eYL3MPQ4SPfb2MmPh2VjdO+VFuanfjT8TfGeocBkulWNJFNzixR0//KjOb5lnpTmb3WR9zvLvuommGtiOMrh/8u5C3nNUKRRh5ptSWT3exy/qP6SnBZW6Bw5gBBls8Eay+2yHFYQCaTVb6Of2maWwLf7zANPIwnWqCOHgfxdaN+hJhEgA1dwo8nXvA6KIoAsVeLFZvnBpZayUuo7my3k57V4jT9D1BPErljjQbnhQgoQv6t8CBuj0rbaiO0eytdcYHJX5tAw8BNAXDtL8ow== 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=gvdnAdk7QzctPMErf+ih3R5qpCemk0bDu3ZPzO6Aw/o=; b=qReyIk1sVRoOrkVmAHQMyCywTztGuoVsFClyZnMEgKSFv9/fcch9MJIkfVLYxKKz6u5mXc0RbJrJSc4yUC5biQ7IzJo1ReLnAo30e7rV84Bh9tPvwfZS/L8bBxgzc71pStu2u/0lPKG95es7GvyLaFQxn2eB49S+Nutj1NGAeEM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9448.eurprd04.prod.outlook.com (2603:10a6:102:2b1::21) by PR3PR04MB7322.eurprd04.prod.outlook.com (2603:10a6:102:8e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.33; Wed, 26 Jul 2023 01:49:19 +0000 Received: from PAXPR04MB9448.eurprd04.prod.outlook.com ([fe80::3505:c499:96d4:1429]) by PAXPR04MB9448.eurprd04.prod.outlook.com ([fe80::3505:c499:96d4:1429%4]) with mapi id 15.20.6609.032; Wed, 26 Jul 2023 01:49:18 +0000 From: Sandor Yu To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, adrian.larumbe@collabora.com, treding@nvidia.com, the.cheaterman@gmail.com, l.stach@pengutronix.de, ville.syrjala@linux.intel.com, cychiang@chromium.org, Sandor.yu@nxp.com, shengjiu.wang@nxp.com Subject: [PATCH] drm: bridge: dw_hdmi: Fix ELD is not updated issue Date: Wed, 26 Jul 2023 09:48:33 +0800 Message-Id: <20230726014833.1647244-1-Sandor.yu@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SGBP274CA0024.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b0::36) To PAXPR04MB9448.eurprd04.prod.outlook.com (2603:10a6:102:2b1::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9448:EE_|PR3PR04MB7322:EE_ X-MS-Office365-Filtering-Correlation-Id: 53e0ac55-0e35-4851-0467-08db8d7a86a0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Mj31pVqzgWG2eCKm1fRDv29ovWrKee16G3AjYekoFC7WSxhAdSh4U+vK/cbmrC5jzUQuiSlhcklX7oLKa5FWqtBY4VLyQMhIqELL9nHPBPkFKfHQx4IHl2SomfbMI6p3JR3RZXANNH6JAxANQb9Vcz6vPGfrkmDiWg68NcdInL1ZwMwzYQ8mb5FEJmV9dpPZSieU3ukA/ZSxw3zF835BbmrYfDu818k1KrCBv+LcLrxl1gZkMjIFXiSa5ok0W3Ce5Z2OUtUstLuxICPXhxsvI0fnK1Zv4iVCFN88dDJtWG6h1ATAHwpj/jKltZrbrAXvrMPRQwCLjgYDYS21Mj+Kegcdf0b4zJf1AurTK6paLPmL6AqMf+DxjReG6Elp4kmzieOuQSKUNm7rjAT/oXskH2eGbVUtkGcEZd7DYAg5sWl1Z7CSzA3GCS1Z1E7U+lQw7DP4yeiGINHILkM1Kgx351nWfxk3Bvz11G4jxnJS07S7QcUKkR6/81IG5/1AwkttPoEaQ3ny16tmi4uCZfg07KzQ6zdLKnf2gbLKqcVIk7DGnoO+dS0ydwKkBKcBPjVpsexE7nIoRMZ5PY8rf5lToxtgKZOWC1yj/juAAFGeIduBfAN8MXjMfs7Z5YX85VMH X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9448.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(39860400002)(136003)(366004)(396003)(376002)(451199021)(15650500001)(8676002)(8936002)(7416002)(5660300002)(41300700001)(316002)(4326008)(2906002)(66946007)(66476007)(66556008)(6512007)(26005)(52116002)(478600001)(186003)(6506007)(1076003)(6666004)(6486002)(86362001)(36756003)(2616005)(83380400001)(38100700002)(38350700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sNqHo2FvjED9FLNyJb9fPb1L59YwmqoosNsAnXuwWltkM/Q1nTNSui+fTXi6h2PsYEtmB2GCVopsqLDgg6arHCfW8doEfcbCW3RSY1I9+eMmK0Z9QBIQwI6KGg2y68u7n6qe84igdfiZt5MhlgOYkZO8vbAsjz+uPV5TNq8oNSSDbuYwTkOBErfpYAdSmoyRdHnkC0deOTP8X5gV/WvbQ0S0D5iy4gK0S1ErIHxeDtAWCYqsZTfeRqMCluz4MA56UN7BownEQ6mGGJAOV+oKg/vDoW4JB613qizkhsklSZPLRbnGNN5PU31RbySxfoYdbQ2k2k+jJu+ut9Kmvs6Df06oi2/dJAkoBu5N4rYmBapqLTrDf1iwc/UQARjjfq+s6WHXpEDSgLZsyAPSxkgAQhgFtv+4EIiAPFawKgDsgZM48W5hmjLIIzZ4qmNe843BCB44o+rd1oEKksHZbipG8FOucz+GpJiyB9LeFzInImAaj6HZuijlGEQ53Woh0TJTrNdNluSySnf5h6GN0H7UvC0178vArBJPaS3jwyjFXzlJ70JluwHfArie3XQsPodbIfNip9myLDq5vztFsQWjIwJCpOp0mB4TuxA653RCiAsFrhgWWY6XiM1w7xKpwCnoSQq1AcxzAWX/tDdbM7p5VuypbadhdIYdNpnUXWhAEmwaEVhVDGDbw2BRxxMmEvfwPCspI7ZJmxcmzqc/92gvHH2YBfd/8upHswvm9aw+wB+5vBeESHyMVeCiid5nbCYyX1vELusz8ROpEHhzcxe/wE8lOgEksizheb2vOvqDhoWFQccwHIGviUPXxzL0JXSSv5MVxh+CjUqxIDb+y1cJ0OB9Icl+0f1ysG+nxT2F13sWO6ubbDzaqUSiK+wYQzwlcq9DsXNVShHll/47vVVl04B4QGwd2fs4cOws7Iv3Xc3dV968CCIuJ9A3qGzs7Odb/LnEGW+wCab50BFFzKmkp1ae180rKL/mcnqMR6p86GeY+JDfV2Ds7tzMg6yqmBACyz5hSgxrsO0x1RgGns3eJwqxcB7NVQTTrvvgAPZXe1TI7MN+ER5xBRRqLfYJXQDZtGkafjZv1tsEYRB+npFV9R8ZyX9Fn8U2QofvwV99KDzS5Sr3+BJNf24Dj3stBO8RBw3jNZfJQmjrSkM8DUzZX2mvaCgvdLkAdOQHnRtHjjqAyo7GoS7xeHxyqTaVzUP1vgeZTPkI8la0/83eia8uXTjTQkJoav4MwmYRXX1wu9Vnk38YOk2HALUbyjer+XgJqs5NDF4KzXkcGtM2PDFB4L5JzeETnbioydyQTiDrQ3cS3hT280bU6hiReYcjalm0cp7BIzkecEzSVavPl/r7T40jNqnQ2LBvsOOVhA3YJtEN5wtgpIbrumCIFX8ozHiaWNiew/nrBI/wPusuFvp6/pHXLWj242i1VWdjbNQKrlcwqkaMfp7HGE54Sm64fojkPyY91Hbul1yuOPUh1fKcUlXEvvET7cJYxUa/fkmHLNA7cE9eMk3nVtZNaR6kif2/JXDFDEnP69VEtSJWgsrVPi/MPVwsD4PbUYvpxTQevYsHvlYjjqNl4lsPObG8ENbm X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 53e0ac55-0e35-4851-0467-08db8d7a86a0 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9448.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jul 2023 01:49:18.8973 (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: Nw/LO8a78HmavYOH/ATEMb+CZe0qPfmZ1bsnxH4RDcTE7ZXYY8GLEPbFAZ+Mque+3/fvFaUT2PMDo573kIWwhA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7322 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772450478038509887 X-GMAIL-MSGID: 1772450478038509887 The ELD (EDID-Like Data) is not updated when the HDMI cable is plugged into different HDMI monitors. This is because the EDID is not updated in the HDMI HPD function. As a result, the ELD data remains unchanged and may not reflect the capabilities of the newly connected HDMI sink device. To address this issue, the handle_plugged_change function should move to the bridge_atomic_enable and bridge_atomic_disable functions. Make sure the EDID is properly updated before updating ELD. Signed-off-by: Sandor Yu --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 9a3db5234a0e0..6fa4848591226 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -196,7 +196,6 @@ struct dw_hdmi { hdmi_codec_plugged_cb plugged_cb; struct device *codec_dev; - enum drm_connector_status last_connector_result; }; #define HDMI_IH_PHY_STAT0_RX_SENSE \ @@ -235,7 +234,7 @@ int dw_hdmi_set_plugged_cb(struct dw_hdmi *hdmi, hdmi_codec_plugged_cb fn, mutex_lock(&hdmi->mutex); hdmi->plugged_cb = fn; hdmi->codec_dev = codec_dev; - plugged = hdmi->last_connector_result == connector_status_connected; + plugged = hdmi->connector.status == connector_status_connected; handle_plugged_change(hdmi, plugged); mutex_unlock(&hdmi->mutex); @@ -2446,20 +2445,7 @@ static void dw_hdmi_update_phy_mask(struct dw_hdmi *hdmi) static enum drm_connector_status dw_hdmi_detect(struct dw_hdmi *hdmi) { - enum drm_connector_status result; - - result = hdmi->phy.ops->read_hpd(hdmi, hdmi->phy.data); - - mutex_lock(&hdmi->mutex); - if (result != hdmi->last_connector_result) { - dev_dbg(hdmi->dev, "read_hpd result: %d", result); - handle_plugged_change(hdmi, - result == connector_status_connected); - hdmi->last_connector_result = result; - } - mutex_unlock(&hdmi->mutex); - - return result; + return hdmi->phy.ops->read_hpd(hdmi, hdmi->phy.data); } static struct edid *dw_hdmi_get_edid(struct dw_hdmi *hdmi, @@ -2958,6 +2944,7 @@ static void dw_hdmi_bridge_atomic_disable(struct drm_bridge *bridge, hdmi->curr_conn = NULL; dw_hdmi_update_power(hdmi); dw_hdmi_update_phy_mask(hdmi); + handle_plugged_change(hdmi, false); mutex_unlock(&hdmi->mutex); } @@ -2976,6 +2963,7 @@ static void dw_hdmi_bridge_atomic_enable(struct drm_bridge *bridge, hdmi->curr_conn = connector; dw_hdmi_update_power(hdmi); dw_hdmi_update_phy_mask(hdmi); + handle_plugged_change(hdmi, true); mutex_unlock(&hdmi->mutex); } @@ -3369,7 +3357,6 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev, hdmi->rxsense = true; hdmi->phy_mask = (u8)~(HDMI_PHY_HPD | HDMI_PHY_RX_SENSE); hdmi->mc_clkdis = 0x7f; - hdmi->last_connector_result = connector_status_disconnected; mutex_init(&hdmi->mutex); mutex_init(&hdmi->audio_mutex);