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: 13012517 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 CA4C5C4332F for ; Thu, 20 Oct 2022 00:05:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=LW73Nxa1u9CRlAHADL5fbj5BSDmYgBUX9G6tk5HZANo=; b=rUnLk8x81kgiWP 3ujwTDkd9qGpX2+ogLFMXMSlfP2p6z96458ATnpvGM/NuWesSeSCJ9DgOPfKwbKQgDNQoqRtHpeRi kV68oGJFsSx+K6WlYerzVvvHGdNXyB3o239Vcve9syOQl2QWMI4TozjGAoB5ul626uexqrinEzzQY ihQHPzJE9qSodQ2CTPKjlAWO2kSPyv3A16+3dQSh/xuztBGWKGEDHmk54lKEGOOWGqfNVpDPf+IEw wzOloG+KS7e2r0AInY1Y/nu5jmvYmUfOvz5IrzWvNjrN2hoE7M2vDUa8tH4G5LwCm0i9oLTFQYkHi SfutV9PpuMU/rTsRocBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1olJ2w-006xeY-DI; Thu, 20 Oct 2022 00:04:34 +0000 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1olJ2s-006x2U-VR for linux-arm-kernel@lists.infradead.org; Thu, 20 Oct 2022 00:04:24 +0000 Received: by mail-pg1-x52d.google.com with SMTP id u71so17733578pgd.2 for ; Wed, 19 Oct 2022 17:04:21 -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=NjVHKfJob0ow/UDip6hdpNwldZJniSu+I+tonGLzlwFMICoTd3kMwz+JYInMzYeBWZ vOQa1vZa++XSIU9mAFamCKUBZYC1606uG+pK8zpzS1+YoE/nZgB/k/4ZQG/gdot9xOIw 2LPwnCNl6hyAMui9eMwrW+qhWZvK3jgAo/o1be41OgKsS7RuaJ3OnW/k3zsrjDe9MnxR nOVuak9KK8bqEZ2+cMPfbpu9fGEt2e1LvpBlTTs+idC1JAP/Y3V8ndd4XXP/qKf/9GZR GbxH594ozIfhAjJ7mq0fKlzDXYKgPCeQcxLwH/7JVKJbRwz2DApULRoYtjf5u13RYP5y 58FA== X-Gm-Message-State: ACrzQf0maDAEOC7oO9h+D99NwVxxyNXBWERXe9WhtYkIeBDGouanDlzy ZxFPYDjdEDofoVOP0W4MXwveDA== X-Google-Smtp-Source: AMsMyM664xBzQRRznQW+wpuvkN2DiM8TEUvDJZUSO7BbmhIQUEq/kvX65aGrSxbs3usLThugxlDXJA== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221019_170423_039959_E143C2BC X-CRM114-Status: GOOD ( 14.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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: 13012516 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 678EBC4332F for ; Thu, 20 Oct 2022 00:05:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cgKcqLgX8ummARDtPLQpzPnwQAHJk+90YAv8GsuCxb4=; b=fYG5lBr9PdRW4j 467utWAAZX0M/xZqLnHPXBNa6w+zywpRbBZlXqy3vPrWwYVVL71qN8ZuEKQqx37oPjHgdGX03Qv5N MuX8z2IEoCi/4x6ISK0IPOXYPC0fvWHEE9ugJegGAKP5DVJdU359wf/fQn3jaQYMVeAl0AL2l6yPg 9mOGRn6jxbUJYkkO0ExMlACInHuuhvJ78OT0vYF6AY3+GLu6GfdkXuC6gtWxZn1R679lCbt/It+hd VQRKxIfrvV+XIRoefb0t/GU+mRHpN8BFqdrlxgQm9f9UoDAMGmnqF147ykbv5saM3otvBIil+UyPX Ol+b8+P+sFZ6Baeq+Wrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1olJ3J-006zb7-1N; Thu, 20 Oct 2022 00:04:49 +0000 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1olJ2v-006xSD-CZ for linux-arm-kernel@lists.infradead.org; Thu, 20 Oct 2022 00:04:26 +0000 Received: by mail-pf1-x436.google.com with SMTP id 67so18705322pfz.12 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=ZQ9gdWEP5xDPNyeaP2kRIBGwEEYylAp+8Qbj6/KfxuDmWCGR7MfcRX5P+faY+N+pdb jcryU47OC33Kdg9MrHK0Izt5c4VynLyKl0y+f+GpTbW84GMdN7cVqnF4mNxyBHncIIPu /y7QQJmNJ616aS0etFJdEKNL2xtLrBC0iBPI4uQigobNYrdgIOAGqYYCE0up8VOUKnxZ n5WiSQAfIsKshpK/64faA6THEdxFySxjLpKOr0cdHvi+A/T/WeUiybQMCKI+h9F52boR CgAyA2ZtTI2RbtuFi36ywLK+UUAA1kL2UJG8pS42HQrffswJBcR86Ls881S38sGE0bMD JonA== X-Gm-Message-State: ACrzQf0KYNXRk76gnHd2mdvvHOEZgbAuJlaypfxyS3FnIynOg2UUdsQe v87tC7nE5O3I4sTArc2XmbHRCg== X-Google-Smtp-Source: AMsMyM4/WuzkNI/KO9rd2JcSdJmmamHNIYsZ7bctseAbBQ/6EBWhOKRYCFsmPMPJl382wA/rvveujQ== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221019_170425_455303_C8346666 X-CRM114-Status: GOOD ( 12.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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, }, };