Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp72627rdb; Wed, 17 Jan 2024 17:59:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IGNxwaQ6nepTTjkzwToRJtrmDoy8iJ4IC3bH6HvYwUMgSGGbGoACFRUTqxO93cCpH2Sy0iJ X-Received: by 2002:a2e:b80b:0:b0:2cd:1d93:115 with SMTP id u11-20020a2eb80b000000b002cd1d930115mr75311ljo.77.1705543172831; Wed, 17 Jan 2024 17:59:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705543172; cv=pass; d=google.com; s=arc-20160816; b=NWGqIqpakZGgm++juqqOLEHbGpIOqPkIZp8IfTZDpqbM5wSab39LSo8BcdisyLUony 5bTKEfrCFT5dPMXIXNVRa1vk9+hh/7SHbMKGTqMSeCFJCQUyOzBk0f3knEAQijWwNsI0 hsTc8my+nFt9XhYWKWVOCv9i0fKlli3pRNiUJmUAqtrth+hI7yqeW50EQ8/1GB6Qlj7/ qbGhQceBVTCZw18xE7XaDaU8Nan0ASVYC9J2CIN40Y9VPoZzSoyL4yvXN4Kj2smzli/u KpqN70tK88kUSJ2mz6xz+Lr0OFKJ4dQXJkywpQKRNbKLwkk/+OTHw2d4P7WtCSXwlRMa 7JDQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=C0aZ0gh2nMEIgtdl3btOXR1faHkRWy2p55YtG63QiVs=; fh=Ra9YZcG+R3hhV0k+8RyU3JCd4XRciEj8mF3FOJRcKxg=; b=HINcJergpupo9E28gfilYLg/pmOw1gI1vhYdS4ZShPDPBlJ3JTIbGpA/PfeJ618JVT 3W6Cu6W4GKY5t9r5mJyvf7PSJ5TzOwsQ3E0/OhqjWx5okBdob0+tSEHAOIB0Y2G7cZ2R fh3AhXM9kUChwcvwJcJrSB+Qd9DnGZEWgegdBzvMDF5mAGebXTXSQYIovHZNrtZZ+OzX oYek7VARDC64nH4OcTr1PYtGJ9dKkTLCNi6WsQbv55A5/eMYF3t8qu2UmGX7v7MzOBPa Ri/P4rFYyYV77Ln+7MwlEtPwUPeoW3tGAZma1Yc3cFcnnYksFynkRV+p6L7wqHwYFwcP sFgw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Qfviq2ln; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-29641-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29641-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id x7-20020a056402414700b00559678c9a0csi3063535eda.603.2024.01.17.17.59.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 17:59:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29641-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Qfviq2ln; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-29641-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29641-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5CF351F210F0 for ; Thu, 18 Jan 2024 01:59:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A1DAF4688; Thu, 18 Jan 2024 01:59:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Qfviq2ln" Received: from mail-oo1-f50.google.com (mail-oo1-f50.google.com [209.85.161.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C8AA28FD for ; Thu, 18 Jan 2024 01:59:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705543163; cv=none; b=nE/7AZBVXQqrS7tzeIvNfLckBW7UHsXOuPa7xlzto3ncr5uPWX05bIjtW9Eso1N28Axl/d5JHwDD7WluDf2/znA2biLjzfXHLFn4OPXdqxDNXESeml8F5WNr4x2E/+195WqE/Uwka796jdfpQKTSvBacd3gA9PCoUu2IdcA2QJE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705543163; c=relaxed/simple; bh=qUn0tXssemFdVBvSxGg93sz4Fd7eoMBJDAi5n1ms+/A=; h=Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Google-Smtp-Source:X-Received:Received:From: To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; b=Fxc0kHKUHbwvsKI/bKlrfbAAsIyyYfxIQrKACF/uiRdQuE2muRoVxUMnkj4fbPhJX40H5LxoTx3Dc797gX3dciS99xl2VrftMTUKycizIm+Y04II0CSL0IQA2CpeObTPrl3bwey3ly4CRUQVX5ITVIniyKhgTYpdykxg+vI6U9Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Qfviq2ln; arc=none smtp.client-ip=209.85.161.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-oo1-f50.google.com with SMTP id 006d021491bc7-5988e55ede0so4346243eaf.2 for ; Wed, 17 Jan 2024 17:59:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1705543161; x=1706147961; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=C0aZ0gh2nMEIgtdl3btOXR1faHkRWy2p55YtG63QiVs=; b=Qfviq2lneXjktAlOHn5A7YrzGJDC8zkDNy2bCtV/OTt/i+Eqb8gzNPVOGg6LYH0Ew3 ls+gPNICcPrdeGjI2o8KQL0OD+usPsADdSacMjgTzopK8Rlzdt4RZZYAI0vSYsA1wQLr w52eKV5YqFzu23Hf5YdMSQD2LByd93tgtCj7w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705543161; x=1706147961; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=C0aZ0gh2nMEIgtdl3btOXR1faHkRWy2p55YtG63QiVs=; b=GbI05I8ZDs0TK2l/uuEWip0Dy+vJoScHp7L0MxsymN61peBreNmtvmHNCzwn8febRK 3I0TXwcMDkC9Gr1IEZEuuaYZr0hfBr82Tmzz486guL09ta3vH6zNDkaa6RyQdRqAYXjI rl7N2BhSq6Yl8PBogxbSofYECLni8AuquhM7UTx92DulnFs0qU0rscs59h/d02qNJ7hu TaprEniPX4JSYDRtdXXCvKOkn26DMN/Sh28WgtFz+5Ds961PMg88q/GlqKtLint87jKl ddCWDLKEfU9vlTsIw1z/lFaWUhSfnvKR1O0UlMjaguFeF4OGO5Rj9KcNS2QuuBtQwqML Cq1w== X-Gm-Message-State: AOJu0Yz62B0ty65sgefkrlSb487Y4MFrgjd7pJA2eeovtH+U/Srz6e0Y oaP4NI1GadDgJPajNCsEdPOFpKcKbZWbGX20QsE1YHe+dsBgNF6krbY3T6Ox1Q== X-Received: by 2002:a4a:d490:0:b0:598:8de8:be69 with SMTP id o16-20020a4ad490000000b005988de8be69mr175483oos.10.1705543161418; Wed, 17 Jan 2024 17:59:21 -0800 (PST) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:2557:c164:9ba8:60b]) by smtp.gmail.com with ESMTPSA id h10-20020a65638a000000b005c2420fb198sm270879pgv.37.2024.01.17.17.59.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 17:59:21 -0800 (PST) From: Hsin-Yi Wang To: Douglas Anderson , dri-devel@lists.freedesktop.org Cc: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Xin Ji , Pin-yen Lin , linux-kernel@vger.kernel.org Subject: [PATCH] drm/bridge: anx7625: Ensure bridge is suspended in disable() Date: Wed, 17 Jan 2024 17:58:14 -0800 Message-ID: <20240118015916.2296741-1-hsinyi@chromium.org> X-Mailer: git-send-email 2.43.0.381.gb435a96ce8-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Similar to commit 26db46bc9c67 ("drm/bridge: parade-ps8640: Ensure bridge is suspended in .post_disable()"). Add a mutex to ensure that aux transfer won't race with atomic_disable by holding the PM reference and prevent the bridge from suspend. Also we need to use pm_runtime_put_sync_suspend() to suspend the bridge instead of idle with pm_runtime_put_sync(). Fixes: 3203e497eb76 ("drm/bridge: anx7625: Synchronously run runtime suspend.") Fixes: adca62ec370c ("drm/bridge: anx7625: Support reading edid through aux channel") Signed-off-by: Hsin-Yi Wang Tested-by: Xuxin Xiong --- drivers/gpu/drm/bridge/analogix/anx7625.c | 7 ++++++- drivers/gpu/drm/bridge/analogix/anx7625.h | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index ef31033439bc..29d91493b101 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -1762,6 +1762,7 @@ static ssize_t anx7625_aux_transfer(struct drm_dp_aux *aux, u8 request = msg->request & ~DP_AUX_I2C_MOT; int ret = 0; + mutex_lock(&ctx->aux_lock); pm_runtime_get_sync(dev); msg->reply = 0; switch (request) { @@ -1778,6 +1779,7 @@ static ssize_t anx7625_aux_transfer(struct drm_dp_aux *aux, msg->size, msg->buffer); pm_runtime_mark_last_busy(dev); pm_runtime_put_autosuspend(dev); + mutex_unlock(&ctx->aux_lock); return ret; } @@ -2474,7 +2476,9 @@ static void anx7625_bridge_atomic_disable(struct drm_bridge *bridge, ctx->connector = NULL; anx7625_dp_stop(ctx); - pm_runtime_put_sync(dev); + mutex_lock(&ctx->aux_lock); + pm_runtime_put_sync_suspend(dev); + mutex_unlock(&ctx->aux_lock); } static enum drm_connector_status @@ -2668,6 +2672,7 @@ static int anx7625_i2c_probe(struct i2c_client *client) mutex_init(&platform->lock); mutex_init(&platform->hdcp_wq_lock); + mutex_init(&platform->aux_lock); INIT_DELAYED_WORK(&platform->hdcp_work, hdcp_check_work_func); platform->hdcp_workqueue = create_workqueue("hdcp workqueue"); diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.h b/drivers/gpu/drm/bridge/analogix/anx7625.h index 66ebee7f3d83..39ed35d33836 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.h +++ b/drivers/gpu/drm/bridge/analogix/anx7625.h @@ -475,6 +475,8 @@ struct anx7625_data { struct workqueue_struct *hdcp_workqueue; /* Lock for hdcp work queue */ struct mutex hdcp_wq_lock; + /* Lock for aux transfer and disable */ + struct mutex aux_lock; char edid_block; struct display_timing dt; u8 display_timing_valid; -- 2.43.0.381.gb435a96ce8-goog