From patchwork Thu Oct 20 00:03:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 5944 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp597630wrs; Wed, 19 Oct 2022 17:09:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4klp7a10cKNvFE1b79sEbr/gNCu3wdFksbjwVumXvyz4G5ZHgcmmgilAeppN+OVtUr66Fn X-Received: by 2002:a17:902:a416:b0:178:a030:5f94 with SMTP id p22-20020a170902a41600b00178a0305f94mr11134423plq.162.1666224594550; Wed, 19 Oct 2022 17:09:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666224594; cv=none; d=google.com; s=arc-20160816; b=RpXNFgsCi8mNE3hipxmnzvYscIYKNGkfh0qcC4GHU3IgK5n/Gj4jviLVSrGIUDWTNY Kp2mDrmTPKuGdivXD/9AkVrd2WA5I26Z6AfvixrRYnQzr3L9qpYYrPy4GUb+6sJprpFv lTlPK6IUt55xHgS3fldz39otw30JH7HCifIPdrlzqY8vaTQZDZIgbYlFkOMQaqUNVgY3 Gk5CL+xUrRJkzsHd1FY30VqHxVV50xr+pE4xb7FZwayxsyvgdnaWAf1hxx+AECtsarLA io7l9b1QnuLx/eI/7Wcbx/SuFdUWAEdgykHXVUZaVMmuhc6vN6G53jHe4Pmy6auGfG0J M2RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=sTMXfwPxByKhRbLMaBxfNCc3mPRoF7RiiHgqUtdhFi8=; b=sZ+VMQj++EX3yhoA5VAX5sjDE7Raw/kYiv3NiX50+Qw37/PCr0T3AFdbmv8NV9zAb7 6ar66+Ns4ifHnYevKYdsnXUNceoNJGKgzlrKqar59F4xBvyn6eUHHEckFueXb/84eXFQ aEvDqfvcit8hyD/MBa26OQgMFVEPUV+e5uleSDm3EfO1T3kQdk7l1zZbMH8t+T1Inm3I sQH/eM80KMjSqC3PaLCoXWUJ4tpYzEDLpVGyaPMx3QyiOYBXnPePGSVaGHfmjRiauLT+ K1AkJUBlc+rgj1mjAnxhiGxkR3gsFvxEoXrShdBZS/XhxTScHwI+68ld5XRqyAEpA56Q mmWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NzPUtom5; 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=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x207-20020a6331d8000000b00438d81d22a3si18965851pgx.112.2022.10.19.17.09.41; Wed, 19 Oct 2022 17:09:54 -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=@chromium.org header.s=google header.b=NzPUtom5; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230461AbiJTAEj (ORCPT + 99 others); Wed, 19 Oct 2022 20:04:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230098AbiJTAEe (ORCPT ); Wed, 19 Oct 2022 20:04:34 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9F322639 for ; Wed, 19 Oct 2022 17:04:22 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id h13so18729916pfr.7 for ; Wed, 19 Oct 2022 17:04:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=sTMXfwPxByKhRbLMaBxfNCc3mPRoF7RiiHgqUtdhFi8=; b=NzPUtom58NR34m2Vw7sS73ERU30rhe3RyOvvFRL8c790qf5KuZz3KvN69al/nH052u 65SRaYt/WHp0PKjIXDaLYCni7KlNbgouTs8KNf5Fy7byqei7PQ3KRgBHVXjhzqsdhzY0 or9yFqOg4L7gMu66IIQ9eWmxSPJ7xk7vRk2RQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=sTMXfwPxByKhRbLMaBxfNCc3mPRoF7RiiHgqUtdhFi8=; b=WKRYG0GahfdSj90TyUJ7A4Ou5SnXJ6ktq99nHmCHj9bF0QHkDXDGua5i0tWoItNbD9 dRvKmE+MU0RlDsNyURPaocwy8DZrCtMQjo7WIUNqoiPYqG8ajQyWsRDMz0WrhqTePi2h CuLSru2oTXWcSUJFwR0Vc535fHASxv0e63k9e4uxruDlX4EkpHpi6AVGZo6hHX55LrV9 0Z6AJ+O0QCts4xOxpPy5uV4mA8mON7FUwk29QE3bQc2/vrHznpQh7qq2Xh/YwnkE/0gz 17pZlUgG9mCwWF4mcFLMwpj0IrlKSlf+fRFP1Kzk45h+dW7uJ6D5F3KBhm7Niy/iZpOC v2dg== X-Gm-Message-State: ACrzQf3BSWZ+rTcIOkRQe9NEWNs5sUURdQAkyxkYyIn8a1knXiQ/gVrV xpB/dKa3rSXK2NTBwPRwjWtD2A== X-Received: by 2002:a63:4283:0:b0:457:dced:8ba3 with SMTP id p125-20020a634283000000b00457dced8ba3mr9328251pga.220.1666224261493; Wed, 19 Oct 2022 17:04:21 -0700 (PDT) Received: from localhost ([2620:15c:9d:2:57b7:1f0e:44d1:f252]) by smtp.gmail.com with UTF8SMTPSA id lb13-20020a17090b4a4d00b0020a825fc912sm459119pjb.45.2022.10.19.17.04.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Oct 2022 17:04:21 -0700 (PDT) From: Brian Norris To: =?utf-8?q?Heiko_St=C3=BCbner?= Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Sandy Huang , linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Heiko Stuebner , Helen Koike , Brian Norris , stable@vger.kernel.org Subject: [PATCH 1/2] drm/rockchip: dsi: Clean up 'usage_mode' when failing to attach Date: Wed, 19 Oct 2022 17:03:48 -0700 Message-Id: <20221019170255.1.Ia68dfb27b835d31d22bfe23812baf366ee1c6eac@changeid> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog MIME-Version: 1.0 X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747163120620400936?= X-GMAIL-MSGID: =?utf-8?q?1747163120620400936?= If we fail to attach the first time (especially: EPROBE_DEFER), we fail to clean up 'usage_mode', and thus will fail to attach on any subsequent attempts, with "dsi controller already in use". Re-set to DW_DSI_USAGE_IDLE on attach failure. This is especially common to hit when enabling asynchronous probe on a duel-DSI system (such as RK3399 Gru/Scarlet), such that we're more likely to fail dw_mipi_dsi_rockchip_find_second() the first time. Fixes: 71f68fe7f121 ("drm/rockchip: dsi: add ability to work as a phy instead of full dsi") Cc: Signed-off-by: Brian Norris --- drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c index bf6948125b84..d222c6811207 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c @@ -1051,23 +1051,31 @@ static int dw_mipi_dsi_rockchip_host_attach(void *priv_data, if (ret) { DRM_DEV_ERROR(dsi->dev, "Failed to register component: %d\n", ret); - return ret; + goto out; } second = dw_mipi_dsi_rockchip_find_second(dsi); - if (IS_ERR(second)) - return PTR_ERR(second); + if (IS_ERR(second)) { + ret = PTR_ERR(second); + goto out; + } if (second) { ret = component_add(second, &dw_mipi_dsi_rockchip_ops); if (ret) { DRM_DEV_ERROR(second, "Failed to register component: %d\n", ret); - return ret; + goto out; } } return 0; + +out: + mutex_lock(&dsi->usage_mutex); + dsi->usage_mode = DW_DSI_USAGE_IDLE; + mutex_unlock(&dsi->usage_mutex); + return ret; } static int dw_mipi_dsi_rockchip_host_detach(void *priv_data, From patchwork Thu Oct 20 00:03:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 5943 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp597055wrs; Wed, 19 Oct 2022 17:08:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4AWv9S69CaTgCh8pTTbGolqSpgkg/60lqFegkau2jCW5O46t8UHOq+S0DkqDzx+21LU0Jw X-Received: by 2002:a17:907:1c0a:b0:791:a477:10e9 with SMTP id nc10-20020a1709071c0a00b00791a47710e9mr6631998ejc.513.1666224499864; Wed, 19 Oct 2022 17:08:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666224499; cv=none; d=google.com; s=arc-20160816; b=nFxPE/fnszjqchyrp3eFWEbJdz9hFsDqeV8BqLXONAOlIWdMKx0+wyVWIvAv6wd57+ zZvaCtS3TmvY0xgYjoBn9ByQW/RRXAqjUNWSWrLR9WcufZONDFXDGNichUzOwgN/NGeo O5E+GdKj1vQRyCQZibkPmZPIhDZKlvZnvspeHY+0vrkmJqX70XMBRk+NywHuw0AQxOkH bpTPbimcpP4YU7BCJ1t2d0zNExz9JonZZsjLw7ki+1g81vskcDM1LKqDcERXDzjjeGIO kNlnZ1/izk7wX+vUO8MCXQrkySvXZpuHoJVX63W1ZsxksnRXj/nbYeCYpFeil6eCNqAK Zxew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JFEAuRVxYze/rS1o+HmtzgS2VnFodVUCCckeeNQBPJo=; b=ZZ6hujvDy2OIV8sLEi76SH+fZ1c90v7VoVSfSWwHlAkZrA3hhfjhkvmHrZxRyo2+1V oA056VUX12BnKQLZ2RuwPTZ+ufXv78IYrKqtNCBeLOu4WjFCt4NPSxLGJ7gn4BvN3Cz7 4YFyM8BBQXMXY6gMtioU5vh5RLg1BwvteYZNnTtSiS7hjUYTzEw9u/CCL8e0CRosZcIB Fp9aGStN2WbjW2gWPJelI7yn0WyrCPpksKlYS718cglLX41Sh1bEv3DU8cKxkggzww2C vZ8HOK0+kKIbENwwAI9cB3VxuteBOLjhvvhmqviXeqC8vOygKQ/rUN+rYMOVrB3vqgkQ PKTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Qaz4H1Kw; 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=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cs13-20020a170906dc8d00b0077b4248b138si15246131ejc.127.2022.10.19.17.07.51; Wed, 19 Oct 2022 17:08:19 -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=@chromium.org header.s=google header.b=Qaz4H1Kw; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230054AbiJTAEh (ORCPT + 99 others); Wed, 19 Oct 2022 20:04:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230127AbiJTAEe (ORCPT ); Wed, 19 Oct 2022 20:04:34 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8ECCE5F80 for ; Wed, 19 Oct 2022 17:04:24 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id s196so16413164pgs.3 for ; Wed, 19 Oct 2022 17:04:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JFEAuRVxYze/rS1o+HmtzgS2VnFodVUCCckeeNQBPJo=; b=Qaz4H1KwKV2rEH1XylJDVh+Jyd+kjjCT40sHv0yltr24IPXS3A7bCxHahuIbL/aKxK HQymcu6lvjyUm4M3opQtknDcwkb3CpXipIAuZsVPTT02+205ImH7Ygnwl0k1o1zk3Lfe PIFtNfZeI46Af+097eiyWVE6XVf79YgCLePDI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JFEAuRVxYze/rS1o+HmtzgS2VnFodVUCCckeeNQBPJo=; b=ybrhsAumCfuUVLnxowCDgol9NFm8Fcfyl9n3Ad7hNTZ3App8AqXriFm4VKLlZQspac Ibb8DhheXY82xrPxoe5E0v4kN/AtMwNzyZSUBXOHxV6kO/VVjTFexdEwkGZICRLlDshz jwkIH9nbgI2CzKsX5bzYrXLkFgCF+8TvWtYydXtHSLa3o5UfFsss5yFCk5IKaSTz3slJ XVTtFFHSGKXr8GrCl+mo+SAV88Ta0E3L8wMaH9avj8drqf0qYKBx/WHYLQcPy/xBBf9J VLuJ8zzH9xzCifDhxSLq1GMF7gZVO/c0OjOTVCXERLslTg8hilXlSYZucUDL4rWFtCxX RKZQ== X-Gm-Message-State: ACrzQf2ePlmp7Yr58xrYMEixYPogwqyMulWbQUoLb83/Iv1eLq6DtSGe Ntmyc8yAkHo/NTdQtNIAlH+wYcgvTLL4KQ== X-Received: by 2002:a63:4426:0:b0:464:4e1d:80e3 with SMTP id r38-20020a634426000000b004644e1d80e3mr9460506pga.106.1666224263585; Wed, 19 Oct 2022 17:04:23 -0700 (PDT) Received: from localhost ([2620:15c:9d:2:57b7:1f0e:44d1:f252]) by smtp.gmail.com with UTF8SMTPSA id b11-20020a17090a6acb00b00200a85fa777sm541885pjm.1.2022.10.19.17.04.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Oct 2022 17:04:23 -0700 (PDT) From: Brian Norris To: =?utf-8?q?Heiko_St=C3=BCbner?= Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Sandy Huang , linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Heiko Stuebner , Helen Koike , Brian Norris , stable@vger.kernel.org Subject: [PATCH 2/2] drm/rockchip: dsi: Force synchronous probe Date: Wed, 19 Oct 2022 17:03:49 -0700 Message-Id: <20221019170255.2.I6b985b0ca372b7e35c6d9ea970b24bcb262d4fc1@changeid> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog In-Reply-To: <20221019170255.1.Ia68dfb27b835d31d22bfe23812baf366ee1c6eac@changeid> References: <20221019170255.1.Ia68dfb27b835d31d22bfe23812baf366ee1c6eac@changeid> MIME-Version: 1.0 X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747163021360187389?= X-GMAIL-MSGID: =?utf-8?q?1747163021360187389?= We can't safely probe a dual-DSI display asynchronously (driver_async_probe='*' or driver_async_probe='dw-mipi-dsi-rockchip' cmdline), because dw_mipi_dsi_rockchip_find_second() pokes one DSI device's drvdata from the other device without any locking. Request synchronous probe, at least until this driver learns some appropriate locking for dual-DSI initialization. Cc: Signed-off-by: Brian Norris --- drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c index d222c6811207..528ddce144e5 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c @@ -1689,5 +1689,11 @@ struct platform_driver dw_mipi_dsi_rockchip_driver = { .of_match_table = dw_mipi_dsi_rockchip_dt_ids, .pm = &dw_mipi_dsi_rockchip_pm_ops, .name = "dw-mipi-dsi-rockchip", + /* + * For dual-DSI display, one DSI pokes at the other DSI's + * drvdata in dw_mipi_dsi_rockchip_find_second(). This is not + * safe for asynchronous probe. + */ + .probe_type = PROBE_FORCE_SYNCHRONOUS, }, };