From patchwork Mon Oct 9 18:10:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 732123 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B7D9CD611B for ; Mon, 9 Oct 2023 18:10:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377448AbjJISKq (ORCPT ); Mon, 9 Oct 2023 14:10:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377383AbjJISKq (ORCPT ); Mon, 9 Oct 2023 14:10:46 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6755E94 for ; Mon, 9 Oct 2023 11:10:44 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-5044dd5b561so5772517e87.1 for ; Mon, 09 Oct 2023 11:10:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696875042; x=1697479842; darn=vger.kernel.org; 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=Rhoq4A6nHUJ0zF6JqJTYHaFcA0Hv6qfy7RZdzUgcU3s=; b=bj7Z0esfbgn8ALGumfovY1+3HOHIMQdQ91YvRaLd5paAyfV3jFLps7yquKfcT5R3W0 DcnQCMACEvVRXb4JdB36xA6z8WUUaqNdFYrkI4nLnDBP6BPkEGqdq0EfTfKkWJtL5MNk A0QBHe+fEUmwpTGDHcwvkK7KWTn7/NuvC6RAtD+hxzJsLVHhjVT7AAP4oXmmt+2B9THy kmf3A1zAmkoHxGRFBqBTWJaJwLujihneIDLndPDEBsTAoByCtS5PKRnTwQNp1PWujM5s SJv4N4dS8sE8E5DBx6ncuhz1CqcRO0a43i0o3FfXSqxRVJnqvIMlP9Lo4fO3aZjAZyAc ToAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696875042; x=1697479842; 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=Rhoq4A6nHUJ0zF6JqJTYHaFcA0Hv6qfy7RZdzUgcU3s=; b=QPFD3VF3GAd875vC5GsWxFnnqFOHTnKdoguBwKKA+tGESNmqFqVt2wo0X9sx3yYM2t Mc5PsxDs6qijfWX+6HcX6/FtH7vJ64wAtrpCW1bm/lJ3Ov1OzLiny1i+kU7QSd/DBwtk RyEKEWngqntrVzKKWhAT5/cbhRNc5GlQQe/dDlUYCgRA6pigVQnl6bW9QUdJ+u9NuMob SQHaMbUyaBv5wBAsfZUWysPqVtYx1DspngVZgPx4MX3WbVEallq9wdvBlSlDiHltleZ+ WcOVE+PCk2wZKjprx0dVy3fM1xQXaNT/MJcXIonqJGqgNLe+F0Qt17C8zpwt8VeasSho BuVA== X-Gm-Message-State: AOJu0Yy883uvqP+1Zl6MhLudztM368oXslZ4UNXzKQtCkK0H2yqPvc0v Mcg9wCHq3dBYazBYqlPNJhyJ/A== X-Google-Smtp-Source: AGHT+IFgBxG8t5T/2IknHktWTchqFxzXq6gqgVoSNlOHSWDrSKIymWczVDmlLc+i1uSTJMn+TgHDNQ== X-Received: by 2002:a05:6512:5ce:b0:501:c996:1996 with SMTP id o14-20020a05651205ce00b00501c9961996mr11491384lfo.67.1696875042613; Mon, 09 Oct 2023 11:10:42 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id d6-20020ac25446000000b00505677e7a99sm1506963lfn.139.2023.10.09.11.10.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 11:10:41 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 01/13] drm/msm/dsi: switch to devm_drm_bridge_add() Date: Mon, 9 Oct 2023 21:10:28 +0300 Message-Id: <20231009181040.2743847-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> References: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Make MSM DSI driver use devm_drm_bridge_add() instead of plain drm_bridge_add(). As the driver doesn't require any additional cleanup, stop adding created bridge to the priv->bridges array. Reviewed-by: Rob Clark Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dsi/dsi.c | 28 +++++-------------------- drivers/gpu/drm/msm/dsi/dsi.h | 3 +-- drivers/gpu/drm/msm/dsi/dsi_manager.c | 30 +++++++++------------------ 3 files changed, 16 insertions(+), 45 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index d45e43024802..47f327e68471 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c @@ -215,20 +215,14 @@ void __exit msm_dsi_unregister(void) int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, struct drm_encoder *encoder) { - struct msm_drm_private *priv = dev->dev_private; int ret; - if (priv->num_bridges == ARRAY_SIZE(priv->bridges)) { - DRM_DEV_ERROR(dev->dev, "too many bridges\n"); - return -ENOSPC; - } - msm_dsi->dev = dev; ret = msm_dsi_host_modeset_init(msm_dsi->host, dev); if (ret) { DRM_DEV_ERROR(dev->dev, "failed to modeset init host: %d\n", ret); - goto fail; + return ret; } if (msm_dsi_is_bonded_dsi(msm_dsi) && @@ -242,32 +236,20 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, msm_dsi->encoder = encoder; - msm_dsi->bridge = msm_dsi_manager_bridge_init(msm_dsi->id); - if (IS_ERR(msm_dsi->bridge)) { - ret = PTR_ERR(msm_dsi->bridge); + ret = msm_dsi_manager_bridge_init(msm_dsi); + if (ret) { DRM_DEV_ERROR(dev->dev, "failed to create dsi bridge: %d\n", ret); - msm_dsi->bridge = NULL; - goto fail; + return ret; } ret = msm_dsi_manager_ext_bridge_init(msm_dsi->id); if (ret) { DRM_DEV_ERROR(dev->dev, "failed to create dsi connector: %d\n", ret); - goto fail; + return ret; } - priv->bridges[priv->num_bridges++] = msm_dsi->bridge; - return 0; -fail: - /* bridge/connector are normally destroyed by drm: */ - if (msm_dsi->bridge) { - msm_dsi_manager_bridge_destroy(msm_dsi->bridge); - msm_dsi->bridge = NULL; - } - - return ret; } void msm_dsi_snapshot(struct msm_disp_state *disp_state, struct msm_dsi *msm_dsi) diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h index d21867da78b8..a01c326774a6 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.h +++ b/drivers/gpu/drm/msm/dsi/dsi.h @@ -56,8 +56,7 @@ struct msm_dsi { }; /* dsi manager */ -struct drm_bridge *msm_dsi_manager_bridge_init(u8 id); -void msm_dsi_manager_bridge_destroy(struct drm_bridge *bridge); +int msm_dsi_manager_bridge_init(struct msm_dsi *msm_dsi); int msm_dsi_manager_ext_bridge_init(u8 id); int msm_dsi_manager_cmd_xfer(int id, const struct mipi_dsi_msg *msg); bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len); diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index 28b8012a21f2..17aa19bb6510 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -466,9 +466,8 @@ static const struct drm_bridge_funcs dsi_mgr_bridge_funcs = { }; /* initialize bridge */ -struct drm_bridge *msm_dsi_manager_bridge_init(u8 id) +int msm_dsi_manager_bridge_init(struct msm_dsi *msm_dsi) { - struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); struct drm_bridge *bridge = NULL; struct dsi_bridge *dsi_bridge; struct drm_encoder *encoder; @@ -476,31 +475,27 @@ struct drm_bridge *msm_dsi_manager_bridge_init(u8 id) dsi_bridge = devm_kzalloc(msm_dsi->dev->dev, sizeof(*dsi_bridge), GFP_KERNEL); - if (!dsi_bridge) { - ret = -ENOMEM; - goto fail; - } + if (!dsi_bridge) + return -ENOMEM; - dsi_bridge->id = id; + dsi_bridge->id = msm_dsi->id; encoder = msm_dsi->encoder; bridge = &dsi_bridge->base; bridge->funcs = &dsi_mgr_bridge_funcs; - drm_bridge_add(bridge); + ret = devm_drm_bridge_add(&msm_dsi->pdev->dev, bridge); + if (ret) + return ret; ret = drm_bridge_attach(encoder, bridge, NULL, 0); if (ret) - goto fail; + return ret; - return bridge; + msm_dsi->bridge = bridge; -fail: - if (bridge) - msm_dsi_manager_bridge_destroy(bridge); - - return ERR_PTR(ret); + return 0; } int msm_dsi_manager_ext_bridge_init(u8 id) @@ -557,11 +552,6 @@ int msm_dsi_manager_ext_bridge_init(u8 id) return 0; } -void msm_dsi_manager_bridge_destroy(struct drm_bridge *bridge) -{ - drm_bridge_remove(bridge); -} - int msm_dsi_manager_cmd_xfer(int id, const struct mipi_dsi_msg *msg) { struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); From patchwork Mon Oct 9 18:10:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 731067 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A511FCD611D for ; Mon, 9 Oct 2023 18:10:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377445AbjJISKs (ORCPT ); Mon, 9 Oct 2023 14:10:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376898AbjJISKr (ORCPT ); Mon, 9 Oct 2023 14:10:47 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3BFA9D for ; Mon, 9 Oct 2023 11:10:45 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-504b84d59cbso6378605e87.3 for ; Mon, 09 Oct 2023 11:10:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696875043; x=1697479843; darn=vger.kernel.org; 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=yo+Tbv6d2nOKlw4PvFCcvYipnGPPT636i5Xxfkjy52M=; b=PvLAkjwQFBYkwB7bQFe+ia9CemSz3Ve2kp7HMJdRieMA1ZAAIoSDTEvjY/2uqFyOzr bK9cfiFxrHn+qOUaq3+Yv8HQ5ViykAcMm47ehtOEeECTFV9hyIvUUvpIW8L2BAgIfna1 Y98kn5LO4gc2GoNZgUWLancwZK4YXngN4LTdlsRONg1/yHZUcjq2IxhZMcEBmNgRLBIH YAB+rPpqQBEJZ9C2ThCSzkrBcmU0lBauFsIGnbzx3mnnWYqpHavgDgJ3+ncZrzXB2kgh BNaa321gq4haPWJPVDUYCKoMiUkRlTNtuTkAnBmhLsInFlyqb8Qx33Vbfth2msBI+5so w0ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696875043; x=1697479843; 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=yo+Tbv6d2nOKlw4PvFCcvYipnGPPT636i5Xxfkjy52M=; b=Jl8QIcLh56NAHBToUagjAhQpChzIPBiSBrYKahgWNhG6otpfvcuv9tSF6R+kVNFnwm eBE+1RcgaWY76HDM/4+U8JgATb7KLstWCDZDIFkwZAjcBcegoT7czTc32My++H/YUqbL 9C2TkK3RsV/rHfgMsu9gk6CmsH5HmGZDI+8U1ibI18XLOUdV9Zneu+a63VaxYf8XIv+k emq5aPEGzby5hgLIDZd3h3rF2UJpms2TSHgRuuVsPy2fmbOXaLBJC1rZdBqhCWY7XeA1 wRKfqo3OFAaZ5Lq3/+YrQyb1O1gvxzss+9Z2CTRNpgNd7XHpYw4XkpgL3mxwV/Gh+7WP DYfw== X-Gm-Message-State: AOJu0Yw/58DHXBs2ha+5S56lv/8B7HdvJN/54J/IDQZnLVzH+ogA1xct kwfXQg4eJm81TUKP5DaGP0+eVA== X-Google-Smtp-Source: AGHT+IHsYTLLv3pichduCcVZyIWn3Q1VgNaZPfT4kj4iFfTQQ8zYXhA2XAxOTBNnfnHE7bN2hq4bAA== X-Received: by 2002:a19:a414:0:b0:503:ed:8616 with SMTP id q20-20020a19a414000000b0050300ed8616mr11682247lfc.59.1696875043563; Mon, 09 Oct 2023 11:10:43 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id d6-20020ac25446000000b00505677e7a99sm1506963lfn.139.2023.10.09.11.10.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 11:10:42 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 02/13] drm/msm/hdmi: switch to devm_drm_bridge_add() Date: Mon, 9 Oct 2023 21:10:29 +0300 Message-Id: <20231009181040.2743847-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> References: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Make MSM HDMI driver use devm_drm_bridge_add() instead of plain drm_bridge_add(). As the driver doesn't require any additional cleanup, stop adding created bridge to the priv->bridges array. Reviewed-by: Rob Clark Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/hdmi/hdmi.c | 22 +++++-------------- drivers/gpu/drm/msm/hdmi/hdmi.h | 5 ++--- drivers/gpu/drm/msm/hdmi/hdmi_bridge.c | 30 ++++++++------------------ drivers/gpu/drm/msm/hdmi/hdmi_hpd.c | 3 +-- 4 files changed, 17 insertions(+), 43 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c index b6bcb9f675fe..c8ebd75176bb 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -160,24 +160,16 @@ static int msm_hdmi_init(struct hdmi *hdmi) int msm_hdmi_modeset_init(struct hdmi *hdmi, struct drm_device *dev, struct drm_encoder *encoder) { - struct msm_drm_private *priv = dev->dev_private; int ret; - if (priv->num_bridges == ARRAY_SIZE(priv->bridges)) { - DRM_DEV_ERROR(dev->dev, "too many bridges\n"); - return -ENOSPC; - } - hdmi->dev = dev; hdmi->encoder = encoder; hdmi_audio_infoframe_init(&hdmi->audio.infoframe); - hdmi->bridge = msm_hdmi_bridge_init(hdmi); - if (IS_ERR(hdmi->bridge)) { - ret = PTR_ERR(hdmi->bridge); + ret = msm_hdmi_bridge_init(hdmi); + if (ret) { DRM_DEV_ERROR(dev->dev, "failed to create HDMI bridge: %d\n", ret); - hdmi->bridge = NULL; goto fail; } @@ -215,16 +207,9 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi, goto fail; } - priv->bridges[priv->num_bridges++] = hdmi->bridge; - return 0; fail: - /* bridge is normally destroyed by drm: */ - if (hdmi->bridge) { - msm_hdmi_bridge_destroy(hdmi->bridge); - hdmi->bridge = NULL; - } if (hdmi->connector) { hdmi->connector->funcs->destroy(hdmi->connector); hdmi->connector = NULL; @@ -395,6 +380,9 @@ static void msm_hdmi_unbind(struct device *dev, struct device *master, if (priv->hdmi->audio_pdev) platform_device_unregister(priv->hdmi->audio_pdev); + if (priv->hdmi->bridge) + msm_hdmi_hpd_disable(priv->hdmi); + msm_hdmi_destroy(priv->hdmi); priv->hdmi = NULL; } diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdmi.h index e8dbee50637f..ec5786440391 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.h +++ b/drivers/gpu/drm/msm/hdmi/hdmi.h @@ -224,14 +224,13 @@ void msm_hdmi_audio_set_sample_rate(struct hdmi *hdmi, int rate); * hdmi bridge: */ -struct drm_bridge *msm_hdmi_bridge_init(struct hdmi *hdmi); -void msm_hdmi_bridge_destroy(struct drm_bridge *bridge); +int msm_hdmi_bridge_init(struct hdmi *hdmi); void msm_hdmi_hpd_irq(struct drm_bridge *bridge); enum drm_connector_status msm_hdmi_bridge_detect( struct drm_bridge *bridge); int msm_hdmi_hpd_enable(struct drm_bridge *bridge); -void msm_hdmi_hpd_disable(struct hdmi_bridge *hdmi_bridge); +void msm_hdmi_hpd_disable(struct hdmi *hdmi); /* * i2c adapter for ddc: diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c index 9b1391d27ed3..0b7a6a56677e 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c @@ -11,14 +11,6 @@ #include "msm_kms.h" #include "hdmi.h" -void msm_hdmi_bridge_destroy(struct drm_bridge *bridge) -{ - struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge); - - msm_hdmi_hpd_disable(hdmi_bridge); - drm_bridge_remove(bridge); -} - static void msm_hdmi_power_on(struct drm_bridge *bridge) { struct drm_device *dev = bridge->dev; @@ -317,7 +309,7 @@ msm_hdmi_hotplug_work(struct work_struct *work) } /* initialize bridge */ -struct drm_bridge *msm_hdmi_bridge_init(struct hdmi *hdmi) +int msm_hdmi_bridge_init(struct hdmi *hdmi) { struct drm_bridge *bridge = NULL; struct hdmi_bridge *hdmi_bridge; @@ -325,10 +317,8 @@ struct drm_bridge *msm_hdmi_bridge_init(struct hdmi *hdmi) hdmi_bridge = devm_kzalloc(hdmi->dev->dev, sizeof(*hdmi_bridge), GFP_KERNEL); - if (!hdmi_bridge) { - ret = -ENOMEM; - goto fail; - } + if (!hdmi_bridge) + return -ENOMEM; hdmi_bridge->hdmi = hdmi; INIT_WORK(&hdmi_bridge->hpd_work, msm_hdmi_hotplug_work); @@ -341,17 +331,15 @@ struct drm_bridge *msm_hdmi_bridge_init(struct hdmi *hdmi) DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID; - drm_bridge_add(bridge); + ret = devm_drm_bridge_add(&hdmi->pdev->dev, bridge); + if (ret) + return ret; ret = drm_bridge_attach(hdmi->encoder, bridge, NULL, DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (ret) - goto fail; + return ret; - return bridge; + hdmi->bridge = bridge; -fail: - if (bridge) - msm_hdmi_bridge_destroy(bridge); - - return ERR_PTR(ret); + return 0; } diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c b/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c index bfa827b47989..9ce0ffa35417 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c @@ -147,9 +147,8 @@ int msm_hdmi_hpd_enable(struct drm_bridge *bridge) return ret; } -void msm_hdmi_hpd_disable(struct hdmi_bridge *hdmi_bridge) +void msm_hdmi_hpd_disable(struct hdmi *hdmi) { - struct hdmi *hdmi = hdmi_bridge->hdmi; const struct hdmi_platform_config *config = hdmi->config; struct device *dev = &hdmi->pdev->dev; int ret; From patchwork Mon Oct 9 18:10:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 731066 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76053CD6114 for ; Mon, 9 Oct 2023 18:10:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377449AbjJISKs (ORCPT ); Mon, 9 Oct 2023 14:10:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377383AbjJISKr (ORCPT ); Mon, 9 Oct 2023 14:10:47 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24955A3 for ; Mon, 9 Oct 2023 11:10:46 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-5041335fb9cso6074694e87.0 for ; Mon, 09 Oct 2023 11:10:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696875044; x=1697479844; darn=vger.kernel.org; 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=0zhzV+U7efpSn+723yIcdjzHoi8KO2DqRUVlFbifyeE=; b=cBO7lgzdum5LV3MwilEMZgV4CjDQRLVv5fyj2f/8LFXenCBZRpFM17C5SBQKTw+5ch i0AEQ9i1VQQW2nyMcKiOaOLXMSDxAtTwxPZAFN0hN9rSV8dQOTU6GJ35w5Nzu/noV7Vw cIJ6/9POwaI7tlwP2HU41Q3KbA2EHfHgJtB7WjnXznEMhUo08Cjzt7OCr+I+ELqw6Myx DbthH8LZsjkdJUSq7w9BsAGXtfNh80VFWTo2Jz9Na1qlCvgfbUn07Lb225mwlN6zYcbh ija11ZZCMMyl2oCawmwgfg7IFu9TMEKYPUDG2ri8me4iYG2NF+24odhEZs/J7EBVefx3 Z/vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696875044; x=1697479844; 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=0zhzV+U7efpSn+723yIcdjzHoi8KO2DqRUVlFbifyeE=; b=KFxXFkkhFvVoi96obEXmYYxp1UNMVE3qrI142TvimaIVTunQVioxMYTUhqvHUl66ty xyD7HurNpQOHvlvU4/drWO/nRLHPIaVWISHvJxp94eXQQivoUmLdfNcDEkzFzhWPOGxI gbsA8kLhb+X7vB7HkXd77xRfB0jXhn2aA8MfzOBL+XDLySBUJC4kOmwne3lscB+ALXj+ KMzKRihOqAVvwr2IJT3p1J+W6shKdozZbGkO0drZXNSNeIZCV6VZlATKJXEHR84lJ+Yp L4ZLLEULpu6vmvniDYcoc0dugM7WmnMo0wZW0QYl/187xQMgQVdbLoiUc2F5EEQF/n0G 9f/A== X-Gm-Message-State: AOJu0YztkB/HFWViks96irrndcK1X2kp7HBxrfnIMwymMcFif+2/aipq cQYn27ZQsMy7aQKf0Yza7j/haQ== X-Google-Smtp-Source: AGHT+IFmAdS1VzsJrY2RA16X9ZJRDThy7A/HeUgUe2JXph2AZoOw6bfFNxw2VxE5AJ+5etFYOBTxSg== X-Received: by 2002:ac2:4c4b:0:b0:503:cca:e52f with SMTP id o11-20020ac24c4b000000b005030ccae52fmr17520979lfk.51.1696875044264; Mon, 09 Oct 2023 11:10:44 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id d6-20020ac25446000000b00505677e7a99sm1506963lfn.139.2023.10.09.11.10.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 11:10:43 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 03/13] drm/msm/dp: move pdev from struct dp_display_private to struct msm_dp Date: Mon, 9 Oct 2023 21:10:30 +0300 Message-Id: <20231009181040.2743847-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> References: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The dp_drm needs accessing the DP's platform device. Move pdev to the public structure. Reviewed-by: Rob Clark Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dp/dp_display.c | 25 ++++++++++++------------- drivers/gpu/drm/msm/dp/dp_display.h | 1 + 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 0e1afff491af..172daa5ad004 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -88,7 +88,6 @@ struct dp_display_private { bool audio_supported; struct drm_device *drm_dev; - struct platform_device *pdev; struct dentry *root; struct dp_parser *parser; @@ -595,7 +594,7 @@ static int dp_hpd_plug_handle(struct dp_display_private *dp, u32 data) return 0; } - ret = dp_display_usbpd_configure_cb(&dp->pdev->dev); + ret = dp_display_usbpd_configure_cb(&dp->dp_display.pdev->dev); if (ret) { /* link train failed */ dp->hpd_state = ST_DISCONNECTED; } else { @@ -643,7 +642,7 @@ static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data) if (dp->link->sink_count == 0) { dp_display_host_phy_exit(dp); } - dp_display_notify_disconnect(&dp->pdev->dev); + dp_display_notify_disconnect(&dp->dp_display.pdev->dev); mutex_unlock(&dp->event_mutex); return 0; } else if (state == ST_DISCONNECT_PENDING) { @@ -653,7 +652,7 @@ static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data) dp_ctrl_off_link(dp->ctrl); dp_display_host_phy_exit(dp); dp->hpd_state = ST_DISCONNECTED; - dp_display_notify_disconnect(&dp->pdev->dev); + dp_display_notify_disconnect(&dp->dp_display.pdev->dev); mutex_unlock(&dp->event_mutex); return 0; } @@ -662,7 +661,7 @@ static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data) * We don't need separate work for disconnect as * connect/attention interrupts are disabled */ - dp_display_notify_disconnect(&dp->pdev->dev); + dp_display_notify_disconnect(&dp->dp_display.pdev->dev); if (state == ST_DISPLAY_OFF) { dp->hpd_state = ST_DISCONNECTED; @@ -704,7 +703,7 @@ static int dp_irq_hpd_handle(struct dp_display_private *dp, u32 data) return 0; } - dp_display_usbpd_attention_cb(&dp->pdev->dev); + dp_display_usbpd_attention_cb(&dp->dp_display.pdev->dev); drm_dbg_dp(dp->drm_dev, "After, type=%d hpd_state=%d\n", dp->dp_display.connector_type, state); @@ -725,12 +724,12 @@ static void dp_display_deinit_sub_modules(struct dp_display_private *dp) static int dp_init_sub_modules(struct dp_display_private *dp) { int rc = 0; - struct device *dev = &dp->pdev->dev; + struct device *dev = &dp->dp_display.pdev->dev; struct dp_panel_in panel_in = { .dev = dev, }; - dp->parser = dp_parser_get(dp->pdev); + dp->parser = dp_parser_get(dp->dp_display.pdev); if (IS_ERR(dp->parser)) { rc = PTR_ERR(dp->parser); DRM_ERROR("failed to initialize parser, rc = %d\n", rc); @@ -791,7 +790,7 @@ static int dp_init_sub_modules(struct dp_display_private *dp) goto error_ctrl; } - dp->audio = dp_audio_get(dp->pdev, dp->panel, dp->catalog); + dp->audio = dp_audio_get(dp->dp_display.pdev, dp->panel, dp->catalog); if (IS_ERR(dp->audio)) { rc = PTR_ERR(dp->audio); pr_err("failed to initialize audio, rc = %d\n", rc); @@ -1197,7 +1196,7 @@ int dp_display_request_irq(struct msm_dp *dp_display) dp = container_of(dp_display, struct dp_display_private, dp_display); - dp->irq = irq_of_parse_and_map(dp->pdev->dev.of_node, 0); + dp->irq = irq_of_parse_and_map(dp->dp_display.pdev->dev.of_node, 0); if (!dp->irq) { DRM_ERROR("failed to get irq\n"); return -EINVAL; @@ -1253,7 +1252,7 @@ static int dp_display_probe(struct platform_device *pdev) if (!desc) return -EINVAL; - dp->pdev = pdev; + dp->dp_display.pdev = pdev; dp->name = "drm_dp"; dp->id = desc->id; dp->dp_display.connector_type = desc->connector_type; @@ -1459,7 +1458,7 @@ void msm_dp_debugfs_init(struct msm_dp *dp_display, struct drm_minor *minor) int rc; dp = container_of(dp_display, struct dp_display_private, dp_display); - dev = &dp->pdev->dev; + dev = &dp->dp_display.pdev->dev; dp->debug = dp_debug_get(dev, dp->panel, dp->link, dp->dp_display.connector, @@ -1479,7 +1478,7 @@ static int dp_display_get_next_bridge(struct msm_dp *dp) struct device *dev; dp_priv = container_of(dp, struct dp_display_private, dp_display); - dev = &dp_priv->pdev->dev; + dev = &dp_priv->dp_display.pdev->dev; aux_bus = of_get_child_by_name(dev->of_node, "aux-bus"); if (aux_bus && dp->is_edp) { diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h index 1e9415ab15d8..f66cdbc35785 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.h +++ b/drivers/gpu/drm/msm/dp/dp_display.h @@ -12,6 +12,7 @@ struct msm_dp { struct drm_device *drm_dev; + struct platform_device *pdev; struct device *codec_dev; struct drm_bridge *bridge; struct drm_connector *connector; From patchwork Mon Oct 9 18:10:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 732121 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EDD7CD611A for ; Mon, 9 Oct 2023 18:10:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377454AbjJISKu (ORCPT ); Mon, 9 Oct 2023 14:10:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377450AbjJISKs (ORCPT ); Mon, 9 Oct 2023 14:10:48 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FC3994 for ; Mon, 9 Oct 2023 11:10:46 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-5068692b0d9so3841932e87.1 for ; Mon, 09 Oct 2023 11:10:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696875045; x=1697479845; darn=vger.kernel.org; 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=6/ggZZmOOvUZ/jHV96y3poAAIRXv6qRJqOXl/4SuAQc=; b=D1CB2eyrVs+Wse8pmQ0bVqZgLfFrzXyEhlC6ipbBNLimW+Of/zLJ/NQUG6eMoGoK55 QgAt4JB5RYjEQ24sKAwRX6p/D3+4v7CILK1XxJCzPrLqU+fYxY2jw0tq2Z0XNBcocnRh RinkSIyqylpHOwaMuUtj0puOEKqC3zZ5SjtEjC/dkBVvojl0F/s1u0N3pCZxk4EcG9OM yAusOdxK7tyhFKqjQYfSCgMMfdZ166Zx4QTKShXSLipaJOXyfal830I7BniIWEwPIPfH UxalKqxbsQmqIQPpW1R2EaPVb2mUHMbncp7lCqVwAqHRoqHPk9V52a+xb9ZZ2wQiXg6f XDjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696875045; x=1697479845; 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=6/ggZZmOOvUZ/jHV96y3poAAIRXv6qRJqOXl/4SuAQc=; b=mIIi4tAyaOTuNT0pNMgDaw1hNA+tiun/d6mqzS/3oED3K6fbqVZQi92HTP6V72mnAP BpSrByRtq2u1fPrpSTVDkTSADZ1U+FiLUu+Egh+nZce087h6T8dymvXG/1MqNiLIeDkG exvktZgZ5AIzxCPReOFMhdlKEq9+IdMrtdnc8kAOwVrLLcgqmFBihCe/GMjn44hz68cH hmKZfxpjSlkAo2y4ql/gpvJbpVZ9TBvnjjufWOMC5Ui/6390IVsQFEfu9hrW+qbiuJEQ TY9x1PxwHyLe1gHbwwizE/eFUuqd5Z4W5wURteqCKxvHgUw7GRn5Sa5h9OWFTpa3fWKm QSOw== X-Gm-Message-State: AOJu0Yzrg0STUTw5how+RL97aBlv32OjNZDWG/r1+2EO0dzmVgICmsbK uTNJju1EMZ1+vE86bH9rmcNL5A== X-Google-Smtp-Source: AGHT+IEkZphNwAOKp9JtA7qMk7prsRuhaPwpf+e6gDGlK1W+jDqKLj+YRJsuImLEuWVeqkYOfEBCIg== X-Received: by 2002:a05:6512:3b9a:b0:503:18c5:6833 with SMTP id g26-20020a0565123b9a00b0050318c56833mr17676101lfv.61.1696875044954; Mon, 09 Oct 2023 11:10:44 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id d6-20020ac25446000000b00505677e7a99sm1506963lfn.139.2023.10.09.11.10.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 11:10:44 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 04/13] drm/msm/dp: switch to devm_drm_bridge_add() Date: Mon, 9 Oct 2023 21:10:31 +0300 Message-Id: <20231009181040.2743847-5-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> References: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Make MSM DP driver use devm_drm_bridge_add() instead of plain drm_bridge_add(). As the driver doesn't require any additional cleanup, stop adding created bridge to the priv->bridges array. Reviewed-by: Rob Clark Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dp/dp_display.c | 9 ++------- drivers/gpu/drm/msm/dp/dp_drm.c | 21 +++++++++++++-------- drivers/gpu/drm/msm/dp/dp_drm.h | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 172daa5ad004..e329e03e068d 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -1530,7 +1530,6 @@ static int dp_display_get_next_bridge(struct msm_dp *dp) int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, struct drm_encoder *encoder) { - struct msm_drm_private *priv = dev->dev_private; struct dp_display_private *dp_priv; int ret; @@ -1548,17 +1547,13 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, if (ret) return ret; - dp_display->bridge = dp_bridge_init(dp_display, dev, encoder); - if (IS_ERR(dp_display->bridge)) { - ret = PTR_ERR(dp_display->bridge); + ret = dp_bridge_init(dp_display, dev, encoder); + if (ret) { DRM_DEV_ERROR(dev->dev, "failed to create dp bridge: %d\n", ret); - dp_display->bridge = NULL; return ret; } - priv->bridges[priv->num_bridges++] = dp_display->bridge; - dp_display->connector = dp_drm_connector_init(dp_display, encoder); if (IS_ERR(dp_display->connector)) { ret = PTR_ERR(dp_display->connector); diff --git a/drivers/gpu/drm/msm/dp/dp_drm.c b/drivers/gpu/drm/msm/dp/dp_drm.c index 785d76639497..284ff7df058a 100644 --- a/drivers/gpu/drm/msm/dp/dp_drm.c +++ b/drivers/gpu/drm/msm/dp/dp_drm.c @@ -272,7 +272,7 @@ static const struct drm_bridge_funcs edp_bridge_ops = { .atomic_check = edp_bridge_atomic_check, }; -struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device *dev, +int dp_bridge_init(struct msm_dp *dp_display, struct drm_device *dev, struct drm_encoder *encoder) { int rc; @@ -281,7 +281,7 @@ struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device * dp_bridge = devm_kzalloc(dev->dev, sizeof(*dp_bridge), GFP_KERNEL); if (!dp_bridge) - return ERR_PTR(-ENOMEM); + return -ENOMEM; dp_bridge->dp_display = dp_display; @@ -307,14 +307,18 @@ struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device * DRM_BRIDGE_OP_MODES; } - drm_bridge_add(bridge); + rc = devm_drm_bridge_add(&dp_display->pdev->dev, bridge); + if (rc) { + DRM_ERROR("failed to add bridge, rc=%d\n", rc); + + return rc; + } rc = drm_bridge_attach(encoder, bridge, NULL, DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (rc) { DRM_ERROR("failed to attach bridge, rc=%d\n", rc); - drm_bridge_remove(bridge); - return ERR_PTR(rc); + return rc; } if (dp_display->next_bridge) { @@ -323,12 +327,13 @@ struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device * DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (rc < 0) { DRM_ERROR("failed to attach panel bridge: %d\n", rc); - drm_bridge_remove(bridge); - return ERR_PTR(rc); + return rc; } } - return bridge; + dp_display->bridge = bridge; + + return 0; } /* connector initialization */ diff --git a/drivers/gpu/drm/msm/dp/dp_drm.h b/drivers/gpu/drm/msm/dp/dp_drm.h index afe79b85e183..b3d684db2383 100644 --- a/drivers/gpu/drm/msm/dp/dp_drm.h +++ b/drivers/gpu/drm/msm/dp/dp_drm.h @@ -20,7 +20,7 @@ struct msm_dp_bridge { #define to_dp_bridge(x) container_of((x), struct msm_dp_bridge, bridge) struct drm_connector *dp_drm_connector_init(struct msm_dp *dp_display, struct drm_encoder *encoder); -struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device *dev, +int dp_bridge_init(struct msm_dp *dp_display, struct drm_device *dev, struct drm_encoder *encoder); void dp_bridge_atomic_enable(struct drm_bridge *drm_bridge, From patchwork Mon Oct 9 18:10:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 732122 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00AC2CD611C for ; Mon, 9 Oct 2023 18:10:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376898AbjJISKt (ORCPT ); Mon, 9 Oct 2023 14:10:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377454AbjJISKs (ORCPT ); Mon, 9 Oct 2023 14:10:48 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 829AB9D for ; Mon, 9 Oct 2023 11:10:47 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-50437c618b4so6012183e87.2 for ; Mon, 09 Oct 2023 11:10:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696875046; x=1697479846; darn=vger.kernel.org; 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=PDffGe9s39I6J3ue64oALa7ElHnsr/uXc2xUK2PVAIo=; b=jo1Op/TkgJ4i6JTZljwbeCufS3aAK1ulikfayUF4O+pB7MtyOJhglx8SFRFs/wlLgi zxUJfvVkv0u2e91zKnpgss0fF12/LGPWAkvlAnj0Ut2/oYsC/wCqOn+jJOVRUy401TGQ QFETQdMGVMJAChczBkhKVUNzCxiOdLMMxLInqy6+RVFMVIrodWXi5VvsU7WIhngdz1mk C/61OEbiJp79krZo8Qr6n3/ztproJfnsryDg0LG48Kfc5D8EefG9/0v1ezSQxQdFo3UI WIbVMe+0Nb0XX29NBU6WEquC6evnnEtqUZS4FQigYgKH5KBTSrgqMw1lRmzm3o5PR5Jd clCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696875046; x=1697479846; 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=PDffGe9s39I6J3ue64oALa7ElHnsr/uXc2xUK2PVAIo=; b=Niqw7r/lpaSAC8vyt8CTaZ/tJX9iTfGmnuljTX7A2SUbH3BYLILV9d+rIgrN1FCwtG fR/u9nLUy5MAuahZ680Y0QAjeUVVT5QSCZAFX/SqDPiGcpTcsE+7uFThB3zWb8Se8rti WEcDantiXn/7YkoaW4jqQNIAIFPR94tF2iYeOkdoex0PMcAwyC2IKaRmM8hRfIWcmJR7 hlFAeWZRfWzuoZWTmi5/EqqxeLMo5pmN8G+fyqaf55ozz7Qjuk2HvnQLNtcG7t7878hg V7q1en8O2QNr80Flpc6WhTDqJ+9TTs2xaqvnW46VogTUBHWYG6QohmrXfGkH7HNCCA7h SMGg== X-Gm-Message-State: AOJu0Yzz239D2z3mMvDQlhyMekS3SP0BEKLpRRsmVTZGEpMX1Shvk4lM RjvAJmfGJc2bezIZOsZFbh3y1w== X-Google-Smtp-Source: AGHT+IEoGY8TGh+MeEfY49+EpGtxtl6bqUGlHjpkO9fRAkDexHyvI42sNQOanvPNMbrl/GeB9/SU9g== X-Received: by 2002:a05:6512:159d:b0:503:1722:9c5a with SMTP id bp29-20020a056512159d00b0050317229c5amr19024534lfb.3.1696875045806; Mon, 09 Oct 2023 11:10:45 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id d6-20020ac25446000000b00505677e7a99sm1506963lfn.139.2023.10.09.11.10.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 11:10:45 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 05/13] drm/msm: remove msm_drm_private::bridges field Date: Mon, 9 Oct 2023 21:10:32 +0300 Message-Id: <20231009181040.2743847-6-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> References: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org As all output devices have switched to devm_drm_bridge_add(), we can drop the bridges array from struct msm_drm_private. Reviewed-by: Rob Clark Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_drv.c | 4 ---- drivers/gpu/drm/msm/msm_drv.h | 3 --- 2 files changed, 7 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 5b937c3879af..7617c456475a 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -240,10 +240,6 @@ static int msm_drm_uninit(struct device *dev) drm_mode_config_cleanup(ddev); - for (i = 0; i < priv->num_bridges; i++) - drm_bridge_remove(priv->bridges[i]); - priv->num_bridges = 0; - if (kms) { pm_runtime_get_sync(dev); msm_irq_uninstall(ddev); diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 80085d644c1e..a6a29093bbe5 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -206,9 +206,6 @@ struct msm_drm_private { struct msm_drm_thread event_thread[MAX_CRTCS]; - unsigned int num_bridges; - struct drm_bridge *bridges[MAX_BRIDGES]; - /* VRAM carveout, used when no IOMMU: */ struct { unsigned long size; From patchwork Mon Oct 9 18:10:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 731065 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D4F1CD611F for ; Mon, 9 Oct 2023 18:10:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377450AbjJISKu (ORCPT ); Mon, 9 Oct 2023 14:10:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377383AbjJISKt (ORCPT ); Mon, 9 Oct 2023 14:10:49 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32D54A3 for ; Mon, 9 Oct 2023 11:10:48 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-504427aae4fso7207961e87.1 for ; Mon, 09 Oct 2023 11:10:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696875046; x=1697479846; darn=vger.kernel.org; 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=znTJnZe1eU48JjBsnTfzCMGOflPzOp8ZDEbta/LuWII=; b=DRvQPZUbd6hDs8+kTLXkAFVGtO1uYg/GGD4p4mq2vKFbT4uAc1mnhhte6inGPkQHag /6KX5/8Dn5Gm5y7K40OuDpbzAlNgTCJ9oLz6J7vu/7gsBYQFSuWdLyVlouU8IJjJLbs8 zRvrEEltx+G9ltsnWgONKE85GysXmnbq+vCzCry5+w4E9ySvUs2Cu50H2pFyl/Y4MKVD gpY/6sKw27VC7c0rmfEK8d6Bz50S9FZliZbmQqrfOjm+nU+7xlP/seYR/GhE21q68o4j 49vpD2J9fnlg5gpfGtjYfPwLHs82nJetwwFMUyLfsD+v8gwADtc9Fyb0XXSOtVFmLf7a mPRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696875046; x=1697479846; 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=znTJnZe1eU48JjBsnTfzCMGOflPzOp8ZDEbta/LuWII=; b=VO6p3wnHGS1fQt3QWpXlbqNAVvmFHaWqD4i72mh5Nhie6JtOvDv0F8KjhaPlDNS9Th N4a8Hw3s2JEpyaM5d5cEFQaJmJht2GhaQWvSjgcjdIC5S1BE8HIQWCtKNyZGeBJ4HYWg bIU0AkvdRD4EjxLkWT/BW/VZruTTUzUyTXAK9qRgi95VDeR+ebFO6qVeaYoTsZGbkDIP hVJbtY0SUWl1xY8MiUZOtfQUtC5v6aya+S82x2fnSrpPDi98b7MRtoH51UvVcVxh05bl RD2LEdy6yeVAu+j0LUTGbG2mGQxwSECOPxJhqaGAht6DBGUxtP3h9aOBaevcr31GyQRt KY5Q== X-Gm-Message-State: AOJu0YxtuNlTQ+VgWQi36mbGMYVGVzESRX7USBAD/0bvCkjN+FLgdJFA Uq8KLUJ4CqfDcD3RCOoXz+kZ+g== X-Google-Smtp-Source: AGHT+IHE6rUV6n/8/o3X/GGKBulZ/BEWEElLvf0NxLXzu3dOfhP4sDOjS2sIfxkEd+5dKWvsn3UBxw== X-Received: by 2002:a05:6512:3995:b0:4f8:586a:d6ca with SMTP id j21-20020a056512399500b004f8586ad6camr9733327lfu.9.1696875046534; Mon, 09 Oct 2023 11:10:46 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id d6-20020ac25446000000b00505677e7a99sm1506963lfn.139.2023.10.09.11.10.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 11:10:46 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 06/13] drm/msm: drop pm ops from the headless msm driver Date: Mon, 9 Oct 2023 21:10:33 +0300 Message-Id: <20231009181040.2743847-7-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> References: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The msm_pm_prepare()/msm_pm_complete() only make sense for the KMS-enabled devices, they have priv->kms guards inside. Drop global msm_pm_ops, which were used only by the headless msm device. Reviewed-by: Rob Clark Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/msm_drv.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 7617c456475a..fe885bfd9742 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -1122,11 +1122,6 @@ void msm_pm_complete(struct device *dev) drm_mode_config_helper_resume(ddev); } -static const struct dev_pm_ops msm_pm_ops = { - .prepare = msm_pm_prepare, - .complete = msm_pm_complete, -}; - /* * Componentized driver support: */ @@ -1305,7 +1300,6 @@ static struct platform_driver msm_platform_driver = { .shutdown = msm_drv_shutdown, .driver = { .name = "msm", - .pm = &msm_pm_ops, }, }; From patchwork Mon Oct 9 18:10:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 731064 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D147CD6121 for ; Mon, 9 Oct 2023 18:10:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377482AbjJISKv (ORCPT ); Mon, 9 Oct 2023 14:10:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377383AbjJISKv (ORCPT ); Mon, 9 Oct 2023 14:10:51 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6868D94 for ; Mon, 9 Oct 2023 11:10:49 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-505748580ceso6029825e87.3 for ; Mon, 09 Oct 2023 11:10:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696875047; x=1697479847; darn=vger.kernel.org; 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=ifZolr8J8pRMC1MF21MdWDJqO8xHcFjEBmzDjHRBYUI=; b=xXIh9b9UlMTmjm9UItnzy5WN7KMWXr/JReAX/gEMPIsXIPSEAiQbcxyF5VMun2+zcH LciFSnOFCaM7pbxKuvElKsuWATjveCXAQAZT4E12gKRex55ZTNuSvOFRQtqSIZUTo5wP sVglvlqzeBxMnjMQmoEUE9TigR8hhwO12YSJLyXeuz9txAe4AzMlfhMGq696BEGcN++u HLL2TPMqFzHFu27WjMGGaYSin+87PZ3WhYrqyKS2BfbvOJQpvL1ebz74N/ptsEnz3s1j ycujNziAiwoMrWABybOQC5GMGK1mVfbl1ofYVygwWCXIOK6KneTsCScliULs6dHNfow6 Sw0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696875047; x=1697479847; 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=ifZolr8J8pRMC1MF21MdWDJqO8xHcFjEBmzDjHRBYUI=; b=sFuwYiaBKjsRLkru6HVWNZNRLSTv0v76c5vNwv0LhBXJAjKh6ilylovhSrODB3oVO5 4m4xYBo9WPy65Vko5/JPH70cR30BuhGPggndeDVXDHjEvsT7wHWiTDZyDsmsawwtkNGf f+VC+d4T4U3jS+lfqrCNE9ufOJ6HZfUpWwBxCavp+oshPoGZUH/FE5mY8vhylRbjHSvc /lfdMovLHRHugnf6wrF6QUwWh8NZVrrqu2OHWlySgRjcb+kFCokFX1aR2CaNhFDwBNYw dzASIL8uvWa1QGxV72N62gL4buZfk5uOznvAsCJBCcfSfGWl9tTo8/gLTXGxJS3wFfr7 7Qpw== X-Gm-Message-State: AOJu0Yz7T9u2CpISPS0IwCpJjtrWF31zU148xdzOR2aCUGNbO6I8Ler5 CXLafThmcn48Nopt6jI7Oi23fQ== X-Google-Smtp-Source: AGHT+IETB9qHD6UMNe1JOlEW7KOoPOJKYdk0kJ8APv0qTfZQQEbMtXBZ0VbrfTht1hsJCagb4y0E/w== X-Received: by 2002:ac2:4da8:0:b0:500:bffa:5b85 with SMTP id h8-20020ac24da8000000b00500bffa5b85mr12377982lfe.32.1696875047373; Mon, 09 Oct 2023 11:10:47 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id d6-20020ac25446000000b00505677e7a99sm1506963lfn.139.2023.10.09.11.10.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 11:10:47 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 07/13] drm/msm: rename msm_pm_prepare/complete to note the KMS nature Date: Mon, 9 Oct 2023 21:10:34 +0300 Message-Id: <20231009181040.2743847-8-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> References: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Rename the msm_pm_prepare() and msm_pm_complete() to msm_kms_pm_prepare() and msm_kms_pm_complete() consequently. Reviewed-by: Rob Clark Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 4 ++-- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 4 ++-- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 4 ++-- drivers/gpu/drm/msm/msm_drv.c | 4 ++-- drivers/gpu/drm/msm/msm_drv.h | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 12d604b6b7e0..1f06c0c36533 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -1342,8 +1342,8 @@ static const struct dev_pm_ops dpu_pm_ops = { SET_RUNTIME_PM_OPS(dpu_runtime_suspend, dpu_runtime_resume, NULL) SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) - .prepare = msm_pm_prepare, - .complete = msm_pm_complete, + .prepare = msm_kms_pm_prepare, + .complete = msm_kms_pm_complete, }; static const struct of_device_id dpu_dt_match[] = { diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c index 18735bbaf798..386f61556789 100644 --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c @@ -501,8 +501,8 @@ static int mdp4_kms_init(struct drm_device *dev) } static const struct dev_pm_ops mdp4_pm_ops = { - .prepare = msm_pm_prepare, - .complete = msm_pm_complete, + .prepare = msm_kms_pm_prepare, + .complete = msm_kms_pm_complete, }; static int mdp4_probe(struct platform_device *pdev) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c index 68fcfd85d250..d936b6b958d1 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -960,8 +960,8 @@ static __maybe_unused int mdp5_runtime_resume(struct device *dev) static const struct dev_pm_ops mdp5_pm_ops = { SET_RUNTIME_PM_OPS(mdp5_runtime_suspend, mdp5_runtime_resume, NULL) - .prepare = msm_pm_prepare, - .complete = msm_pm_complete, + .prepare = msm_kms_pm_prepare, + .complete = msm_kms_pm_complete, }; static const struct of_device_id mdp5_dt_match[] = { diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index fe885bfd9742..76b69f605b9c 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -1100,7 +1100,7 @@ static const struct drm_driver msm_driver = { .patchlevel = MSM_VERSION_PATCHLEVEL, }; -int msm_pm_prepare(struct device *dev) +int msm_kms_pm_prepare(struct device *dev) { struct msm_drm_private *priv = dev_get_drvdata(dev); struct drm_device *ddev = priv ? priv->dev : NULL; @@ -1111,7 +1111,7 @@ int msm_pm_prepare(struct device *dev) return drm_mode_config_helper_suspend(ddev); } -void msm_pm_complete(struct device *dev) +void msm_kms_pm_complete(struct device *dev) { struct msm_drm_private *priv = dev_get_drvdata(dev); struct drm_device *ddev = priv ? priv->dev : NULL; diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index a6a29093bbe5..a28d93c09492 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -563,8 +563,8 @@ static inline unsigned long timeout_to_jiffies(const ktime_t *timeout) extern const struct component_master_ops msm_drm_ops; -int msm_pm_prepare(struct device *dev); -void msm_pm_complete(struct device *dev); +int msm_kms_pm_prepare(struct device *dev); +void msm_kms_pm_complete(struct device *dev); int msm_drv_probe(struct device *dev, int (*kms_init)(struct drm_device *dev), From patchwork Mon Oct 9 18:10:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 732120 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB143CD6114 for ; Mon, 9 Oct 2023 18:10:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377383AbjJISKw (ORCPT ); Mon, 9 Oct 2023 14:10:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377457AbjJISKw (ORCPT ); Mon, 9 Oct 2023 14:10:52 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFC779D for ; Mon, 9 Oct 2023 11:10:49 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-50433d8385cso6401495e87.0 for ; Mon, 09 Oct 2023 11:10:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696875048; x=1697479848; darn=vger.kernel.org; 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=rIiIl1qxmpZwJAax2zo4ZFB4kzioqbwuWWlEMohjM5o=; b=xH0B2U/eo+TY7dNACLPSuYFTsKTFM6oie1vCy1ZuFLqRAhbnrDefEdzJ/dlnk4agVT DlsFJiKAVcmOlZx667FH5sdRHyI3CdPA/M1uyzPL6s+ZCSrmJ55qJYJ13g+uBb1Sh4PQ JrOtbJDwCxQcSAJQnj2+98En/eMs3vclnoWQzGmu5OC6MyJASvgjQQHOtUr4fvuqY/wy gxDTPLBkTYryfK6t4NUvffWZa+74+F4i0GnsSSlWY2DfdqCEcHu6rK09Pyc9wnwW7i4L KNR+O2b11OL0U7RFwCCHPqgImtxhuDYqdoI3b4hORTmjx8AxX9zK22C08u0iSfVRJTYH EL6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696875048; x=1697479848; 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=rIiIl1qxmpZwJAax2zo4ZFB4kzioqbwuWWlEMohjM5o=; b=VkhhJhVbi2UcfV6bM7QJ0/KGXD+Y4Yixs5WyJcg51RRLgApRdmhbM5zwmmLXX0gdgN JbCEDVlJH750we/YSlFKRo5L/cchEsbfYsMxl4UW/NAz2JnLasLyCnb4Fugt5jtxlpKo 9h9yI15OhGUzYXeBd9erwsOxb7KF/hT/zGAIHTEOqFwMb7j6xHYwGDSVgzOZcUQB/aZF O4QEQPJt7WTg7x4GG922LW3c4lXEszWFFspvxBE2M7oU+X4RH/N3/4ysIMni44wYA1Zb szjMueB4WCOK9ry4KVUqPa1affhaBgsZZqP/pj9OKQmUQa2vQOTanyOpF/QO4iJQ43RY 9KZw== X-Gm-Message-State: AOJu0Yz64xRiKrxUW6YHvqlAxCVmouTOjZxkppzlN1MNHmg21AFwrhNY 29Jmz2j3rgvOn4it/+WSKBpdyg== X-Google-Smtp-Source: AGHT+IELzXLGkqfFXYHQEEg+Re6/uU4DLwq935JYwzvmyWABx/+281fRZT0fJSVsJMsGdurSBTxfLg== X-Received: by 2002:a05:6512:3e18:b0:505:7a65:ad5d with SMTP id i24-20020a0565123e1800b005057a65ad5dmr15542523lfv.56.1696875048162; Mon, 09 Oct 2023 11:10:48 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id d6-20020ac25446000000b00505677e7a99sm1506963lfn.139.2023.10.09.11.10.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 11:10:47 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 08/13] drm/msm: remove shutdown callback from msm_platform_driver Date: Mon, 9 Oct 2023 21:10:35 +0300 Message-Id: <20231009181040.2743847-9-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> References: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The msm_drv_shutdown only makes sense for the KMS-enabled devices, while msm_platform_driver is only used in the headless case. Remove the shutdown callback from the driver structure. Reviewed-by: Rob Clark Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_drv.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 76b69f605b9c..c2f989d1ff42 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -1297,7 +1297,6 @@ void msm_drv_shutdown(struct platform_device *pdev) static struct platform_driver msm_platform_driver = { .probe = msm_pdev_probe, .remove_new = msm_pdev_remove, - .shutdown = msm_drv_shutdown, .driver = { .name = "msm", }, From patchwork Mon Oct 9 18:10:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 732119 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4EE2CD6120 for ; Mon, 9 Oct 2023 18:10:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377502AbjJISKy (ORCPT ); Mon, 9 Oct 2023 14:10:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377484AbjJISKw (ORCPT ); Mon, 9 Oct 2023 14:10:52 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0DACA3 for ; Mon, 9 Oct 2023 11:10:50 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-5045cb9c091so6364556e87.3 for ; Mon, 09 Oct 2023 11:10:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696875049; x=1697479849; darn=vger.kernel.org; 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=D0cKqSV9NbSgEqSOU6qXa8xSoVPQYmAEiFyAsqDd81w=; b=EU2EKgbZnG3rYlBymVCZJK6lif5E1zpfNMaVWK13X9t04tj9Yis8YUCGIrTrVo9kNj RyPtmJcxTxl+DmevJyvvB7CkPam/dAunDxsySTpyEa0cPfQtabvE0sck8vk7F2vylFn3 sgomEsSLx2ZuuLQu1XqFebK+fJ3eU9Cbxx6FtLbUcvqG35ucjUBSrVd5cQLk9IGRTS/S 3y0stC8LMfln4UE2ML910C9Pu6d1sD5x+ArW3KWniZ0ygWwwOxCHFpC4GPSHKOr7aFzk C/wF0NXDzyLMJr0VQVvPxZnSpCfGaCAhfo8qo5t3pAHuXJD/zQvPSZuBh+ffw+9jPUig KWlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696875049; x=1697479849; 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=D0cKqSV9NbSgEqSOU6qXa8xSoVPQYmAEiFyAsqDd81w=; b=T+cP7XP7EIbcmrZAFaENqKjbq0fs/x7U/X/kHymrl+EVQYVAWWdWj9AndCt+AvKzry +VeJO09G+I7nxGkFoROw8XtuQIX2CjEmCI5Kzb0eR/AsU1gRg79yPejo2Nd8cPAEiTkH 3jkiq3YU7Ot+y1fh1uLhPhggh9BXpovb4YSF9lsmUXAEbPdcgvjHAgrnaF7WEqXjBbxQ W1fBuSWEFd8eYO9hAgENl0DbePvFREBu7jkq4AR4/rBqR2y8QI3e74CL2HI8QjdGU9MD xW969WJ3e9D+efZ9n8rci3thxF0wu5YaF5ygneOP5OQ0j19NDoR1cbG1ldA4shghwdPp bTzw== X-Gm-Message-State: AOJu0YwqMjKD62seSNCO0sFscxGpMUCFewHpUt8KxHfmt6T5i+EWBijH qDjya9mGq+6TTUXbgVBI6xX+7Q== X-Google-Smtp-Source: AGHT+IGjsZpPnq1qFxWqGVR/Mczr22fdRGnVqbtgHDPrubrJj1BfM24m7lxX3TfFDZBnuN9hSztSOA== X-Received: by 2002:a19:a414:0:b0:502:a55b:c2d7 with SMTP id q20-20020a19a414000000b00502a55bc2d7mr13573712lfc.60.1696875049054; Mon, 09 Oct 2023 11:10:49 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id d6-20020ac25446000000b00505677e7a99sm1506963lfn.139.2023.10.09.11.10.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 11:10:48 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 09/13] drm/msm: rename msm_drv_shutdown() to msm_kms_shutdown() Date: Mon, 9 Oct 2023 21:10:36 +0300 Message-Id: <20231009181040.2743847-10-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> References: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The msm_drv_shutdown function should only be used in the KMS case. Rename it accordingly. Reviewed-by: Rob Clark Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 2 +- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 2 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 2 +- drivers/gpu/drm/msm/msm_drv.c | 2 +- drivers/gpu/drm/msm/msm_drv.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 1f06c0c36533..fe7267b3bff5 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -1370,7 +1370,7 @@ MODULE_DEVICE_TABLE(of, dpu_dt_match); static struct platform_driver dpu_driver = { .probe = dpu_dev_probe, .remove_new = dpu_dev_remove, - .shutdown = msm_drv_shutdown, + .shutdown = msm_kms_shutdown, .driver = { .name = "msm_dpu", .of_match_table = dpu_dt_match, diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c index 386f61556789..4ba1cb74ad76 100644 --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c @@ -570,7 +570,7 @@ MODULE_DEVICE_TABLE(of, mdp4_dt_match); static struct platform_driver mdp4_platform_driver = { .probe = mdp4_probe, .remove_new = mdp4_remove, - .shutdown = msm_drv_shutdown, + .shutdown = msm_kms_shutdown, .driver = { .name = "mdp4", .of_match_table = mdp4_dt_match, diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c index d936b6b958d1..11d9fc2c6bf5 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -975,7 +975,7 @@ MODULE_DEVICE_TABLE(of, mdp5_dt_match); static struct platform_driver mdp5_driver = { .probe = mdp5_dev_probe, .remove_new = mdp5_dev_remove, - .shutdown = msm_drv_shutdown, + .shutdown = msm_kms_shutdown, .driver = { .name = "msm_mdp", .of_match_table = mdp5_dt_match, diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index c2f989d1ff42..8079f408c9ed 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -1278,7 +1278,7 @@ static void msm_pdev_remove(struct platform_device *pdev) component_master_del(&pdev->dev, &msm_drm_ops); } -void msm_drv_shutdown(struct platform_device *pdev) +void msm_kms_shutdown(struct platform_device *pdev) { struct msm_drm_private *priv = platform_get_drvdata(pdev); struct drm_device *drm = priv ? priv->dev : NULL; diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index a28d93c09492..cd5bf658df66 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -569,7 +569,7 @@ void msm_kms_pm_complete(struct device *dev); int msm_drv_probe(struct device *dev, int (*kms_init)(struct drm_device *dev), struct msm_kms *kms); -void msm_drv_shutdown(struct platform_device *pdev); +void msm_kms_shutdown(struct platform_device *pdev); #endif /* __MSM_DRV_H__ */ From patchwork Mon Oct 9 18:10:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 731063 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70C65CD611D for ; Mon, 9 Oct 2023 18:10:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377497AbjJISKx (ORCPT ); Mon, 9 Oct 2023 14:10:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377493AbjJISKw (ORCPT ); Mon, 9 Oct 2023 14:10:52 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50EBC94 for ; Mon, 9 Oct 2023 11:10:51 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-50585357903so6358574e87.2 for ; Mon, 09 Oct 2023 11:10:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696875049; x=1697479849; darn=vger.kernel.org; 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=7fO+sWOeSmRkDmpBJ32tICKPjdJ7k9e53PrGRnC7dXE=; b=ZTXbSFKAPiPDg1q39Qc2tMtrWC+AkLb+DPNnmsDEFkTEW0m0L4wiubqmrbRUu2MfXh 70Ee9BPNSqgO11OEbG6Rgum9jj1CmKKOJ5G52z16zfElLbxGk8aW4DAPjX7/aPqzOYPy s3VRV/VkdSJPFW3esZHPzbBtxlBLrD/Cp6c5EUNR3HHg5SU/K9L/7N3Bfh4/Zm5iXfom HiPBUcAQuJ2cpV2I9U+qR0zCpmvS0RguZvLBlduxqZjlHkEfUIue2x992zipjh4vwmTl kmu23gP2xUtzc1/I7Wk17n0vVhDOPoutKMCBK/GPlw95lBSYcak9ZnEngy3TbK9raU3U 9MNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696875049; x=1697479849; 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=7fO+sWOeSmRkDmpBJ32tICKPjdJ7k9e53PrGRnC7dXE=; b=pxsSQ36eZwBimrd5U585ToZy/NlIR1VCujcj63UQhKIyrn0f7w+QBPILBaZySHpF3v TwYAx6zPWUgXInwAawhDUc4mnLdR1urAPHjVwfFJuxardfF/TvncnnKL5ys2V6AbAgO9 Rr/DLFP8shleN+lrdzoJBAQQzqxcFvTqhD4/sThngkLumEPuqoj3wS5FnJo8ix7XJaWL NcKC2yqm0Ycey43fyqlnq6IQ+pPBOqknpZjEFbo6o5+IbHflokKGsk2uKeALzpjoSQP8 kD62Wir3Suln8AMe4g5oHuYeKa8/HKOtNozvqc6xRSplxqc1wHcD6hPUK794trnO0ZLu oYfA== X-Gm-Message-State: AOJu0Yw9UyE2wtQr5SIX+Rl/f7C/Z/GVdjDHDvHNa7YKLOUYCG7D2Nvw MD9SupP21DaIWOi30gXVxZ2OwQ== X-Google-Smtp-Source: AGHT+IHZ7AEHPT/cxBG7NCCQF47wnsevopIIA1mMp9bQWYMK3R/xYI3NkYAYd2aSmC4Qtnh1rgTQiQ== X-Received: by 2002:a05:6512:230d:b0:500:b7ed:105a with SMTP id o13-20020a056512230d00b00500b7ed105amr17536069lfu.29.1696875049664; Mon, 09 Oct 2023 11:10:49 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id d6-20020ac25446000000b00505677e7a99sm1506963lfn.139.2023.10.09.11.10.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 11:10:49 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 10/13] drm/msm: switch to drmm_mode_config_init() Date: Mon, 9 Oct 2023 21:10:37 +0300 Message-Id: <20231009181040.2743847-11-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> References: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Switch to drmm_mode_config_init() instead of drm_mode_config_init(). Drop drm_mode_config_cleanup() calls. Reviewed-by: Rob Clark Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/msm_drv.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 8079f408c9ed..00ed71c3d503 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -238,8 +238,6 @@ static int msm_drm_uninit(struct device *dev) if (kms) msm_disp_snapshot_destroy(ddev); - drm_mode_config_cleanup(ddev); - if (kms) { pm_runtime_get_sync(dev); msm_irq_uninstall(ddev); @@ -440,11 +438,13 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) might_lock(&priv->lru.lock); fs_reclaim_release(GFP_KERNEL); - drm_mode_config_init(ddev); + ret = drmm_mode_config_init(ddev); + if (ret) + goto err_destroy_wq; ret = msm_init_vram(ddev); if (ret) - goto err_cleanup_mode_config; + goto err_destroy_wq; dma_set_max_seg_size(dev, UINT_MAX); @@ -555,8 +555,7 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) err_deinit_vram: msm_deinit_vram(ddev); -err_cleanup_mode_config: - drm_mode_config_cleanup(ddev); +err_destroy_wq: destroy_workqueue(priv->wq); err_put_dev: drm_dev_put(ddev); From patchwork Mon Oct 9 18:10:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 731062 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51396CD6122 for ; Mon, 9 Oct 2023 18:10:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377484AbjJISKy (ORCPT ); Mon, 9 Oct 2023 14:10:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377457AbjJISKx (ORCPT ); Mon, 9 Oct 2023 14:10:53 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D840A6 for ; Mon, 9 Oct 2023 11:10:52 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-50567477b29so6217628e87.3 for ; Mon, 09 Oct 2023 11:10:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696875050; x=1697479850; darn=vger.kernel.org; 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=NMPNImdJ1XH1qKLcBF8egU3WJE3EwSdEbTA3EmbAyxE=; b=r9Uhgx14W+xAXrUCjDjTfqeU2/keBFNRH9E2HehNh7AJA7YHakniPVRrLMURmW+T56 mMb+1NbUjisMfGYQmzQt05NFtrKAp91fagP2bnJdhu2tnMgSv7qo0OmenZ6hjRtYkLES FgrRGBcRewypnb+WcYPlg/FrlLrXO0q/FImE6+UGsNHSQ32t7eREzBciO5OAQT9trgMv c8Rdh3DDsgrFeo+0eypCIBxicISlXUtVz4ea+sQLmVMg4TQJoTh5AGopb81GKd6+XCQX UAUgkdubVz/xUYsW7MBhs7rpihJ3vnfVNLCivuN4P+XakaDy9sn6RsoyXIIha1VnnH1n lmlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696875050; x=1697479850; 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=NMPNImdJ1XH1qKLcBF8egU3WJE3EwSdEbTA3EmbAyxE=; b=rItC+50O7p3jw4VPK5wTod0iyrmJCAWCJvjh107iHJ5LljSkWFv3xRgZoQs6g54N1f ElpsYvc2TAtXUmj0HtRsfJtPbnQApMTz1L3H+f3L6RlMLXYarlhPEVLmK5Vk1WAUx46c S0SGrZeikMtONIuJlzRMaWC3qyAAzM7JWVuHSp8jDa/1naLA0ugcK/yqsqNtrgCFQdAh ArJbT5UOPZRYMvDQzgd7lGVPgZ6u98fsSn17+30kIu5vHKn732hC7POLxHy0PzkZrcwC xCLyX3LlQQNdCBq8aQbt6a8yagLtprXIEJV5nqke3vH6aK/FJgUa9si2l5TubQtmkSsq 3ygw== X-Gm-Message-State: AOJu0YxlawDRKdQQxPVllz3QbzAPzRBMYFOyBWQgXR/LGCIaA8ud9QBO 96hmxXcbRs9PA/FiqW+hNGnY0Q== X-Google-Smtp-Source: AGHT+IGxFWo1cv7MZPWO4e5pj8qUwRrrnJfIcbY5MCcf9WtFviJE0fE4zMGxdE7ohyapXkTdwdxUSg== X-Received: by 2002:a05:6512:3b29:b0:503:293a:dc1b with SMTP id f41-20020a0565123b2900b00503293adc1bmr17109215lfv.30.1696875050408; Mon, 09 Oct 2023 11:10:50 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id d6-20020ac25446000000b00505677e7a99sm1506963lfn.139.2023.10.09.11.10.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 11:10:50 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 11/13] drm/msm: only register 'kms' debug file if KMS is used Date: Mon, 9 Oct 2023 21:10:38 +0300 Message-Id: <20231009181040.2743847-12-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> References: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org There is little point in having the empty debugfs file which always returns -ENODEV. Change this file to be created only if KMS is actually used. Reviewed-by: Rob Clark Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_debugfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_debugfs.c b/drivers/gpu/drm/msm/msm_debugfs.c index a0a936f80ae3..06fc632fd6f9 100644 --- a/drivers/gpu/drm/msm/msm_debugfs.c +++ b/drivers/gpu/drm/msm/msm_debugfs.c @@ -314,8 +314,9 @@ void msm_debugfs_init(struct drm_minor *minor) debugfs_create_file("gpu", S_IRUSR, minor->debugfs_root, dev, &msm_gpu_fops); - debugfs_create_file("kms", S_IRUSR, minor->debugfs_root, - dev, &msm_kms_fops); + if (priv->kms) + debugfs_create_file("kms", S_IRUSR, minor->debugfs_root, + dev, &msm_kms_fops); debugfs_create_u32("hangcheck_period_ms", 0600, minor->debugfs_root, &priv->hangcheck_period); From patchwork Mon Oct 9 18:10:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 732118 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E7D4CD611E for ; Mon, 9 Oct 2023 18:10:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377493AbjJISKz (ORCPT ); Mon, 9 Oct 2023 14:10:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377501AbjJISKy (ORCPT ); Mon, 9 Oct 2023 14:10:54 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B32F394 for ; Mon, 9 Oct 2023 11:10:52 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-50306b2920dso5897237e87.0 for ; Mon, 09 Oct 2023 11:10:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696875051; x=1697479851; darn=vger.kernel.org; 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=LZwa0pFgCMFZxcM0RszFBciS+5iPHBS674kLGB71TRA=; b=G0q4QKzNWE/Z9/JyJDVtfo9lrZHhSfg7ceF5fYqgQGfFf2b+RBWYu6VCTTuUKkDgXF Ngp8cxl8w0V/RcmKJ5evlYI5dTwRoVl1GgzywyoTbaGTbsyqU9KGfmHm+QbdrXWOlvJH kIsW+fR+fy6+TPZm/gC+VkLsWv6y5WqXsxsDt0sdh+EkaBNLvczFkMG0fDzAdWuPZ3yG E9eduJGos5Skq1BC/0R63ncMGS34RjCj5b+1RsCBItIQVByp3c3p6S8Ej1jLlPEflrHs ks4Pk3haRQwKD7RsNwE9sCBpA+0Vw686NUoQd+oe0f6Ig4nDTeapWCsNkiE7LGcH4iz0 cYQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696875051; x=1697479851; 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=LZwa0pFgCMFZxcM0RszFBciS+5iPHBS674kLGB71TRA=; b=mX9th4MnmndGVCV4ZzLmB1z8wWd/GWCnfx2yHhVnMyMQBjsdzt+j/+Clapn/BTcV5H UO5Vt1frgPL/3G6ObZWLLbl6hsnAXfFltNYpgxwZAEWtus7BM33BLWUB7dVisJA0kAli 65wi9WQ9NGQ73UIUuhFpDtWZ/5FCxxj+zK0Cv6/gum/gZE8+Nvwurv1dI4HamVBiqOBO yb0I7Jn1jkedBauU/pCygbgZW4zNurK38T16A8ttEIXbVNF+LCCmFZQ+ino6LDBMOVVn nA1optZv4NQN69P77jOoTcNXjHSU39v2N0frBisk2ew1ci7lWSjMEyNurfYNjGk1jwRd P9GQ== X-Gm-Message-State: AOJu0YyadrzN8MyMI3dKtEF5PLmAc6so250WhVu4AErZnWeDp9dcoaA2 jKlfkywNcUGuQYrfW1+iCsAAth+Qnglj0SaR0dAEXg== X-Google-Smtp-Source: AGHT+IHB8Mlg9v9SxjoA3EGE5SW6POwWDALdsXrDXYH3reUJFjnex74mPryQPf10KoMTICNodeQdIA== X-Received: by 2002:ac2:4d8a:0:b0:500:a93d:fc78 with SMTP id g10-20020ac24d8a000000b00500a93dfc78mr10614914lfe.31.1696875051018; Mon, 09 Oct 2023 11:10:51 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id d6-20020ac25446000000b00505677e7a99sm1506963lfn.139.2023.10.09.11.10.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 11:10:50 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 12/13] drm/msm: make fb debugfs file available only in KMS case Date: Mon, 9 Oct 2023 21:10:39 +0300 Message-Id: <20231009181040.2743847-13-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> References: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Don't register the 'fb' debugfs file, if there is no KMS (and so no framebuffers). Reviewed-by: Rob Clark Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_debugfs.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/msm_debugfs.c b/drivers/gpu/drm/msm/msm_debugfs.c index 06fc632fd6f9..04d304eed223 100644 --- a/drivers/gpu/drm/msm/msm_debugfs.c +++ b/drivers/gpu/drm/msm/msm_debugfs.c @@ -266,6 +266,9 @@ static int msm_fb_show(struct seq_file *m, void *arg) static struct drm_info_list msm_debugfs_list[] = { {"gem", msm_gem_show}, { "mm", msm_mm_show }, +}; + +static struct drm_info_list msm_kms_debugfs_list[] = { { "fb", msm_fb_show }, }; @@ -314,9 +317,13 @@ void msm_debugfs_init(struct drm_minor *minor) debugfs_create_file("gpu", S_IRUSR, minor->debugfs_root, dev, &msm_gpu_fops); - if (priv->kms) + if (priv->kms) { + drm_debugfs_create_files(msm_kms_debugfs_list, + ARRAY_SIZE(msm_kms_debugfs_list), + minor->debugfs_root, minor); debugfs_create_file("kms", S_IRUSR, minor->debugfs_root, dev, &msm_kms_fops); + } debugfs_create_u32("hangcheck_period_ms", 0600, minor->debugfs_root, &priv->hangcheck_period); From patchwork Mon Oct 9 18:10:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 731061 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1E28CD611A for ; Mon, 9 Oct 2023 18:10:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377507AbjJISK6 (ORCPT ); Mon, 9 Oct 2023 14:10:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377457AbjJISK5 (ORCPT ); Mon, 9 Oct 2023 14:10:57 -0400 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C044DA4 for ; Mon, 9 Oct 2023 11:10:53 -0700 (PDT) Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2c012232792so58556621fa.0 for ; Mon, 09 Oct 2023 11:10:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696875052; x=1697479852; darn=vger.kernel.org; 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=fSKwyY0AUZT7nYjKEozVOtIdyccNepLFZtN63/GLx98=; b=EbT3secgD5fQVbwfM+JWWl4uKEwa5O52IG+8p4GQu2RiHP7GHa6CVwopo4CR8KOxQj mP9uG9v+VgEDeoc8R41gi3Uf8fOxbluIP46wt8+eRGKi/4TaQs6gpZ9UIqknhlbCi1uj uCw2mME/hKf0J6gGdmREj0EltlHDUcoBKenZc4dln9j+gsN4HUQF2HMrq4n/lzTvQ02z 7e0zGUZYoikw+zaOkGY24r0EjbtUhnlWPF26Cdn6AvYSY3IFBBTql9W+xJVonE9Rc1Zy RDdAEXZqpVoRVL1JPuOjyqiWO0VsR0yMCjTLF8D4JRnPqFOhxhKYyQbsq8AkmOA+fkqb t8TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696875052; x=1697479852; 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=fSKwyY0AUZT7nYjKEozVOtIdyccNepLFZtN63/GLx98=; b=OeMEV5S3meD6CaOHIu9p98MSD5T/nK/efdJprCAT9E1w74va5ih/u3GGs4SdogaF79 uxg9PT0gj0s5pTu1BmJr2o1QmCaNHhCfWcE5bt0goTzHyNH3AVF6rM/z1XIfIDxkRg95 KYv+8FTOQyX1NjpwrPjPwKqEvijLKQPGy2MpvNFErV5HJyFyRYXrD54unTVEHuwgP5FL 4VSn/hVEGc/pQGMUfHjb577NXNwq52akLtGdqwxfACYSivc5LhgpMQKEROP8YXK4XFOJ /O08oYmcsrTctvAc5hr2mQUL5x7LHIQtWiDVZYs1rHceDy6/4ZDEZpL00Q4+dTywLfAe Yv5Q== X-Gm-Message-State: AOJu0YyMuH1uDcgf/aDDhGCK406A29+EMokrBX7Tr5gnvNI0wR9kSGDg 19FRS3En5ztqPoqewpjM42H+lA== X-Google-Smtp-Source: AGHT+IHuqxqoWKJc6nLsbCsGeXJTbqf54oc+eTQuVaowih6JBFl2Xb3GYsvxZt9bha+J0gxeav1yxw== X-Received: by 2002:ac2:44cb:0:b0:4fe:279b:8a02 with SMTP id d11-20020ac244cb000000b004fe279b8a02mr13372329lfm.67.1696875052002; Mon, 09 Oct 2023 11:10:52 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id d6-20020ac25446000000b00505677e7a99sm1506963lfn.139.2023.10.09.11.10.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 11:10:51 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 13/13] drm/msm: carve out KMS code from msm_drv.c Date: Mon, 9 Oct 2023 21:10:40 +0300 Message-Id: <20231009181040.2743847-14-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> References: <20231009181040.2743847-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The msm_drv.c contains generic code intermixed with KMS handling code. Move all KMS-related code to a separate msm_kms.c file, cleaning up init code while doing this move. This also prevents msm driver from registering modesetting / atomic interfaces in the headless case. Reviewed-by: Rob Clark Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/Makefile | 1 + drivers/gpu/drm/msm/msm_drv.c | 346 ++-------------------------------- drivers/gpu/drm/msm/msm_kms.c | 345 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/msm/msm_kms.h | 3 + 4 files changed, 365 insertions(+), 330 deletions(-) create mode 100644 drivers/gpu/drm/msm/msm_kms.c diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile index 8d02d8c33069..49671364fdcf 100644 --- a/drivers/gpu/drm/msm/Makefile +++ b/drivers/gpu/drm/msm/Makefile @@ -106,6 +106,7 @@ msm-y += \ msm_gpu_devfreq.o \ msm_io_utils.o \ msm_iommu.o \ + msm_kms.o \ msm_perf.o \ msm_rd.o \ msm_ringbuffer.o \ diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 00ed71c3d503..1efb31420094 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -6,30 +6,17 @@ */ #include -#include -#include #include -#include #include -#include -#include -#include #include #include #include -#include #include -#include -#include "disp/msm_disp_snapshot.h" #include "msm_drv.h" #include "msm_debugfs.h" -#include "msm_fence.h" -#include "msm_gem.h" -#include "msm_gpu.h" #include "msm_kms.h" -#include "msm_mmu.h" #include "adreno/adreno_gpu.h" /* @@ -56,16 +43,6 @@ static void msm_deinit_vram(struct drm_device *ddev); -static const struct drm_mode_config_funcs mode_config_funcs = { - .fb_create = msm_framebuffer_create, - .atomic_check = msm_atomic_check, - .atomic_commit = drm_atomic_helper_commit, -}; - -static const struct drm_mode_config_helper_funcs mode_config_helper_funcs = { - .atomic_commit_tail = msm_atomic_commit_tail, -}; - static char *vram = "16m"; MODULE_PARM_DESC(vram, "Configure VRAM size (for devices without IOMMU/GPUMMU)"); module_param(vram, charp, 0); @@ -83,125 +60,11 @@ DECLARE_FAULT_ATTR(fail_gem_alloc); DECLARE_FAULT_ATTR(fail_gem_iova); #endif -static irqreturn_t msm_irq(int irq, void *arg) -{ - struct drm_device *dev = arg; - struct msm_drm_private *priv = dev->dev_private; - struct msm_kms *kms = priv->kms; - - BUG_ON(!kms); - - return kms->funcs->irq(kms); -} - -static void msm_irq_preinstall(struct drm_device *dev) -{ - struct msm_drm_private *priv = dev->dev_private; - struct msm_kms *kms = priv->kms; - - BUG_ON(!kms); - - kms->funcs->irq_preinstall(kms); -} - -static int msm_irq_postinstall(struct drm_device *dev) -{ - struct msm_drm_private *priv = dev->dev_private; - struct msm_kms *kms = priv->kms; - - BUG_ON(!kms); - - if (kms->funcs->irq_postinstall) - return kms->funcs->irq_postinstall(kms); - - return 0; -} - -static int msm_irq_install(struct drm_device *dev, unsigned int irq) -{ - struct msm_drm_private *priv = dev->dev_private; - struct msm_kms *kms = priv->kms; - int ret; - - if (irq == IRQ_NOTCONNECTED) - return -ENOTCONN; - - msm_irq_preinstall(dev); - - ret = request_irq(irq, msm_irq, 0, dev->driver->name, dev); - if (ret) - return ret; - - kms->irq_requested = true; - - ret = msm_irq_postinstall(dev); - if (ret) { - free_irq(irq, dev); - return ret; - } - - return 0; -} - -static void msm_irq_uninstall(struct drm_device *dev) -{ - struct msm_drm_private *priv = dev->dev_private; - struct msm_kms *kms = priv->kms; - - kms->funcs->irq_uninstall(kms); - if (kms->irq_requested) - free_irq(kms->irq, dev); -} - -struct msm_vblank_work { - struct work_struct work; - struct drm_crtc *crtc; - bool enable; - struct msm_drm_private *priv; -}; - -static void vblank_ctrl_worker(struct work_struct *work) -{ - struct msm_vblank_work *vbl_work = container_of(work, - struct msm_vblank_work, work); - struct msm_drm_private *priv = vbl_work->priv; - struct msm_kms *kms = priv->kms; - - if (vbl_work->enable) - kms->funcs->enable_vblank(kms, vbl_work->crtc); - else - kms->funcs->disable_vblank(kms, vbl_work->crtc); - - kfree(vbl_work); -} - -static int vblank_ctrl_queue_work(struct msm_drm_private *priv, - struct drm_crtc *crtc, bool enable) -{ - struct msm_vblank_work *vbl_work; - - vbl_work = kzalloc(sizeof(*vbl_work), GFP_ATOMIC); - if (!vbl_work) - return -ENOMEM; - - INIT_WORK(&vbl_work->work, vblank_ctrl_worker); - - vbl_work->crtc = crtc; - vbl_work->enable = enable; - vbl_work->priv = priv; - - queue_work(priv->wq, &vbl_work->work); - - return 0; -} - static int msm_drm_uninit(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct msm_drm_private *priv = platform_get_drvdata(pdev); struct drm_device *ddev = priv->dev; - struct msm_kms *kms = priv->kms; - int i; /* * Shutdown the hw if we're far enough along where things might be on. @@ -212,7 +75,8 @@ static int msm_drm_uninit(struct device *dev) */ if (ddev->registered) { drm_dev_unregister(ddev); - drm_atomic_helper_shutdown(ddev); + if (priv->kms) + drm_atomic_helper_shutdown(ddev); } /* We must cancel and cleanup any pending vblank enable/disable @@ -222,30 +86,13 @@ static int msm_drm_uninit(struct device *dev) flush_workqueue(priv->wq); - /* clean up event worker threads */ - for (i = 0; i < priv->num_crtcs; i++) { - if (priv->event_thread[i].worker) - kthread_destroy_worker(priv->event_thread[i].worker); - } - msm_gem_shrinker_cleanup(ddev); - drm_kms_helper_poll_fini(ddev); - msm_perf_debugfs_cleanup(priv); msm_rd_debugfs_cleanup(priv); - if (kms) - msm_disp_snapshot_destroy(ddev); - - if (kms) { - pm_runtime_get_sync(dev); - msm_irq_uninstall(ddev); - pm_runtime_put_sync(dev); - } - - if (kms && kms->funcs) - kms->funcs->destroy(kms); + if (priv->kms) + msm_drm_kms_uninit(dev); msm_deinit_vram(ddev); @@ -259,42 +106,6 @@ static int msm_drm_uninit(struct device *dev) return 0; } -struct msm_gem_address_space *msm_kms_init_aspace(struct drm_device *dev) -{ - struct msm_gem_address_space *aspace; - struct msm_mmu *mmu; - struct device *mdp_dev = dev->dev; - struct device *mdss_dev = mdp_dev->parent; - struct device *iommu_dev; - - /* - * IOMMUs can be a part of MDSS device tree binding, or the - * MDP/DPU device. - */ - if (device_iommu_mapped(mdp_dev)) - iommu_dev = mdp_dev; - else - iommu_dev = mdss_dev; - - mmu = msm_iommu_new(iommu_dev, 0); - if (IS_ERR(mmu)) - return ERR_CAST(mmu); - - if (!mmu) { - drm_info(dev, "no IOMMU, fallback to phys contig buffers for scanout\n"); - return NULL; - } - - aspace = msm_gem_address_space_create(mmu, "mdp_kms", - 0x1000, 0x100000000 - 0x1000); - if (IS_ERR(aspace)) { - dev_err(mdp_dev, "aspace create, error %pe\n", aspace); - mmu->funcs->destroy(mmu); - } - - return aspace; -} - bool msm_use_mmu(struct drm_device *dev) { struct msm_drm_private *priv = dev->dev_private; @@ -400,8 +211,6 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) { struct msm_drm_private *priv = dev_get_drvdata(dev); struct drm_device *ddev; - struct msm_kms *kms; - struct drm_crtc *crtc; int ret; if (drm_firmware_drivers_only()) @@ -438,9 +247,11 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) might_lock(&priv->lru.lock); fs_reclaim_release(GFP_KERNEL); - ret = drmm_mode_config_init(ddev); - if (ret) - goto err_destroy_wq; + if (priv->kms_init) { + ret = drmm_mode_config_init(ddev); + if (ret) + goto err_destroy_wq; + } ret = msm_init_vram(ddev); if (ret) @@ -453,98 +264,33 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) if (ret) goto err_deinit_vram; - /* the fw fb could be anywhere in memory */ - ret = drm_aperture_remove_framebuffers(drv); - if (ret) - goto err_msm_uninit; - ret = msm_gem_shrinker_init(ddev); if (ret) goto err_msm_uninit; if (priv->kms_init) { - ret = priv->kms_init(ddev); - if (ret) { - DRM_DEV_ERROR(dev, "failed to load kms\n"); - priv->kms = NULL; + ret = msm_drm_kms_init(dev, drv); + if (ret) goto err_msm_uninit; - } - kms = priv->kms; } else { /* valid only for the dummy headless case, where of_node=NULL */ WARN_ON(dev->of_node); - kms = NULL; - } - - /* Enable normalization of plane zpos */ - ddev->mode_config.normalize_zpos = true; - - if (kms) { - kms->dev = ddev; - ret = kms->funcs->hw_init(kms); - if (ret) { - DRM_DEV_ERROR(dev, "kms hw init failed: %d\n", ret); - goto err_msm_uninit; - } - } - - drm_helper_move_panel_connectors_to_head(ddev); - - ddev->mode_config.funcs = &mode_config_funcs; - ddev->mode_config.helper_private = &mode_config_helper_funcs; - - drm_for_each_crtc(crtc, ddev) { - struct msm_drm_thread *ev_thread; - - /* initialize event thread */ - ev_thread = &priv->event_thread[drm_crtc_index(crtc)]; - ev_thread->dev = ddev; - ev_thread->worker = kthread_create_worker(0, "crtc_event:%d", crtc->base.id); - if (IS_ERR(ev_thread->worker)) { - ret = PTR_ERR(ev_thread->worker); - DRM_DEV_ERROR(dev, "failed to create crtc_event kthread\n"); - ev_thread->worker = NULL; - goto err_msm_uninit; - } - - sched_set_fifo(ev_thread->worker->task); - } - - ret = drm_vblank_init(ddev, priv->num_crtcs); - if (ret < 0) { - DRM_DEV_ERROR(dev, "failed to initialize vblank\n"); - goto err_msm_uninit; - } - - if (kms) { - pm_runtime_get_sync(dev); - ret = msm_irq_install(ddev, kms->irq); - pm_runtime_put_sync(dev); - if (ret < 0) { - DRM_DEV_ERROR(dev, "failed to install IRQ handler\n"); - goto err_msm_uninit; - } + ddev->driver_features &= ~DRIVER_MODESET; + ddev->driver_features &= ~DRIVER_ATOMIC; } ret = drm_dev_register(ddev, 0); if (ret) goto err_msm_uninit; - if (kms) { - ret = msm_disp_snapshot_init(ddev); - if (ret) - DRM_DEV_ERROR(dev, "msm_disp_snapshot_init failed ret = %d\n", ret); - } - drm_mode_config_reset(ddev); - ret = msm_debugfs_late_init(ddev); if (ret) goto err_msm_uninit; - drm_kms_helper_poll_init(ddev); - - if (kms) + if (priv->kms_init) { + drm_kms_helper_poll_init(ddev); msm_fbdev_setup(ddev); + } return 0; @@ -635,28 +381,6 @@ static void msm_postclose(struct drm_device *dev, struct drm_file *file) context_close(ctx); } -int msm_crtc_enable_vblank(struct drm_crtc *crtc) -{ - struct drm_device *dev = crtc->dev; - struct msm_drm_private *priv = dev->dev_private; - struct msm_kms *kms = priv->kms; - if (!kms) - return -ENXIO; - drm_dbg_vbl(dev, "crtc=%u", crtc->base.id); - return vblank_ctrl_queue_work(priv, crtc, true); -} - -void msm_crtc_disable_vblank(struct drm_crtc *crtc) -{ - struct drm_device *dev = crtc->dev; - struct msm_drm_private *priv = dev->dev_private; - struct msm_kms *kms = priv->kms; - if (!kms) - return; - drm_dbg_vbl(dev, "crtc=%u", crtc->base.id); - vblank_ctrl_queue_work(priv, crtc, false); -} - /* * DRM ioctls: */ @@ -1099,28 +823,6 @@ static const struct drm_driver msm_driver = { .patchlevel = MSM_VERSION_PATCHLEVEL, }; -int msm_kms_pm_prepare(struct device *dev) -{ - struct msm_drm_private *priv = dev_get_drvdata(dev); - struct drm_device *ddev = priv ? priv->dev : NULL; - - if (!priv || !priv->kms) - return 0; - - return drm_mode_config_helper_suspend(ddev); -} - -void msm_kms_pm_complete(struct device *dev) -{ - struct msm_drm_private *priv = dev_get_drvdata(dev); - struct drm_device *ddev = priv ? priv->dev : NULL; - - if (!priv || !priv->kms) - return; - - drm_mode_config_helper_resume(ddev); -} - /* * Componentized driver support: */ @@ -1277,22 +979,6 @@ static void msm_pdev_remove(struct platform_device *pdev) component_master_del(&pdev->dev, &msm_drm_ops); } -void msm_kms_shutdown(struct platform_device *pdev) -{ - struct msm_drm_private *priv = platform_get_drvdata(pdev); - struct drm_device *drm = priv ? priv->dev : NULL; - - /* - * Shutdown the hw if we're far enough along where things might be on. - * If we run this too early, we'll end up panicking in any variety of - * places. Since we don't register the drm device until late in - * msm_drm_init, drm_dev->registered is used as an indicator that the - * shutdown will be successful. - */ - if (drm && drm->registered && priv->kms) - drm_atomic_helper_shutdown(drm); -} - static struct platform_driver msm_platform_driver = { .probe = msm_pdev_probe, .remove_new = msm_pdev_remove, diff --git a/drivers/gpu/drm/msm/msm_kms.c b/drivers/gpu/drm/msm/msm_kms.c new file mode 100644 index 000000000000..84c21ec2ceea --- /dev/null +++ b/drivers/gpu/drm/msm/msm_kms.c @@ -0,0 +1,345 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2016-2018, 2020-2021 The Linux Foundation. All rights reserved. + * Copyright (C) 2013 Red Hat + * Author: Rob Clark + */ + +#include +#include +#include + +#include +#include +#include +#include + +#include "disp/msm_disp_snapshot.h" +#include "msm_drv.h" +#include "msm_gem.h" +#include "msm_kms.h" +#include "msm_mmu.h" + +static const struct drm_mode_config_funcs mode_config_funcs = { + .fb_create = msm_framebuffer_create, + .atomic_check = msm_atomic_check, + .atomic_commit = drm_atomic_helper_commit, +}; + +static const struct drm_mode_config_helper_funcs mode_config_helper_funcs = { + .atomic_commit_tail = msm_atomic_commit_tail, +}; + +static irqreturn_t msm_irq(int irq, void *arg) +{ + struct drm_device *dev = arg; + struct msm_drm_private *priv = dev->dev_private; + struct msm_kms *kms = priv->kms; + + BUG_ON(!kms); + + return kms->funcs->irq(kms); +} + +static void msm_irq_preinstall(struct drm_device *dev) +{ + struct msm_drm_private *priv = dev->dev_private; + struct msm_kms *kms = priv->kms; + + BUG_ON(!kms); + + kms->funcs->irq_preinstall(kms); +} + +static int msm_irq_postinstall(struct drm_device *dev) +{ + struct msm_drm_private *priv = dev->dev_private; + struct msm_kms *kms = priv->kms; + + BUG_ON(!kms); + + if (kms->funcs->irq_postinstall) + return kms->funcs->irq_postinstall(kms); + + return 0; +} + +static int msm_irq_install(struct drm_device *dev, unsigned int irq) +{ + struct msm_drm_private *priv = dev->dev_private; + struct msm_kms *kms = priv->kms; + int ret; + + if (irq == IRQ_NOTCONNECTED) + return -ENOTCONN; + + msm_irq_preinstall(dev); + + ret = request_irq(irq, msm_irq, 0, dev->driver->name, dev); + if (ret) + return ret; + + kms->irq_requested = true; + + ret = msm_irq_postinstall(dev); + if (ret) { + free_irq(irq, dev); + return ret; + } + + return 0; +} + +static void msm_irq_uninstall(struct drm_device *dev) +{ + struct msm_drm_private *priv = dev->dev_private; + struct msm_kms *kms = priv->kms; + + kms->funcs->irq_uninstall(kms); + if (kms->irq_requested) + free_irq(kms->irq, dev); +} + +struct msm_vblank_work { + struct work_struct work; + struct drm_crtc *crtc; + bool enable; + struct msm_drm_private *priv; +}; + +static void vblank_ctrl_worker(struct work_struct *work) +{ + struct msm_vblank_work *vbl_work = container_of(work, + struct msm_vblank_work, work); + struct msm_drm_private *priv = vbl_work->priv; + struct msm_kms *kms = priv->kms; + + if (vbl_work->enable) + kms->funcs->enable_vblank(kms, vbl_work->crtc); + else + kms->funcs->disable_vblank(kms, vbl_work->crtc); + + kfree(vbl_work); +} + +static int vblank_ctrl_queue_work(struct msm_drm_private *priv, + struct drm_crtc *crtc, bool enable) +{ + struct msm_vblank_work *vbl_work; + + vbl_work = kzalloc(sizeof(*vbl_work), GFP_ATOMIC); + if (!vbl_work) + return -ENOMEM; + + INIT_WORK(&vbl_work->work, vblank_ctrl_worker); + + vbl_work->crtc = crtc; + vbl_work->enable = enable; + vbl_work->priv = priv; + + queue_work(priv->wq, &vbl_work->work); + + return 0; +} + +int msm_crtc_enable_vblank(struct drm_crtc *crtc) +{ + struct drm_device *dev = crtc->dev; + struct msm_drm_private *priv = dev->dev_private; + struct msm_kms *kms = priv->kms; + if (!kms) + return -ENXIO; + drm_dbg_vbl(dev, "crtc=%u", crtc->base.id); + return vblank_ctrl_queue_work(priv, crtc, true); +} + +void msm_crtc_disable_vblank(struct drm_crtc *crtc) +{ + struct drm_device *dev = crtc->dev; + struct msm_drm_private *priv = dev->dev_private; + struct msm_kms *kms = priv->kms; + if (!kms) + return; + drm_dbg_vbl(dev, "crtc=%u", crtc->base.id); + vblank_ctrl_queue_work(priv, crtc, false); +} + +struct msm_gem_address_space *msm_kms_init_aspace(struct drm_device *dev) +{ + struct msm_gem_address_space *aspace; + struct msm_mmu *mmu; + struct device *mdp_dev = dev->dev; + struct device *mdss_dev = mdp_dev->parent; + struct device *iommu_dev; + + /* + * IOMMUs can be a part of MDSS device tree binding, or the + * MDP/DPU device. + */ + if (device_iommu_mapped(mdp_dev)) + iommu_dev = mdp_dev; + else + iommu_dev = mdss_dev; + + mmu = msm_iommu_new(iommu_dev, 0); + if (IS_ERR(mmu)) + return ERR_CAST(mmu); + + if (!mmu) { + drm_info(dev, "no IOMMU, fallback to phys contig buffers for scanout\n"); + return NULL; + } + + aspace = msm_gem_address_space_create(mmu, "mdp_kms", + 0x1000, 0x100000000 - 0x1000); + if (IS_ERR(aspace)) { + dev_err(mdp_dev, "aspace create, error %pe\n", aspace); + mmu->funcs->destroy(mmu); + } + + return aspace; +} + +void msm_drm_kms_uninit(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct msm_drm_private *priv = platform_get_drvdata(pdev); + struct drm_device *ddev = priv->dev; + struct msm_kms *kms = priv->kms; + int i; + + BUG_ON(!kms); + + /* clean up event worker threads */ + for (i = 0; i < priv->num_crtcs; i++) { + if (priv->event_thread[i].worker) + kthread_destroy_worker(priv->event_thread[i].worker); + } + + drm_kms_helper_poll_fini(ddev); + + msm_disp_snapshot_destroy(ddev); + + pm_runtime_get_sync(dev); + msm_irq_uninstall(ddev); + pm_runtime_put_sync(dev); + + if (kms && kms->funcs) + kms->funcs->destroy(kms); +} + +int msm_drm_kms_init(struct device *dev, const struct drm_driver *drv) +{ + struct msm_drm_private *priv = dev_get_drvdata(dev); + struct drm_device *ddev = priv->dev; + struct msm_kms *kms = priv->kms; + struct drm_crtc *crtc; + int ret; + + /* the fw fb could be anywhere in memory */ + ret = drm_aperture_remove_framebuffers(drv); + if (ret) + return ret; + + ret = priv->kms_init(ddev); + if (ret) { + DRM_DEV_ERROR(dev, "failed to load kms\n"); + priv->kms = NULL; + return ret; + } + + /* Enable normalization of plane zpos */ + ddev->mode_config.normalize_zpos = true; + + ddev->mode_config.funcs = &mode_config_funcs; + ddev->mode_config.helper_private = &mode_config_helper_funcs; + + kms->dev = ddev; + ret = kms->funcs->hw_init(kms); + if (ret) { + DRM_DEV_ERROR(dev, "kms hw init failed: %d\n", ret); + goto err_msm_uninit; + } + + drm_helper_move_panel_connectors_to_head(ddev); + + drm_for_each_crtc(crtc, ddev) { + struct msm_drm_thread *ev_thread; + + /* initialize event thread */ + ev_thread = &priv->event_thread[drm_crtc_index(crtc)]; + ev_thread->dev = ddev; + ev_thread->worker = kthread_create_worker(0, "crtc_event:%d", crtc->base.id); + if (IS_ERR(ev_thread->worker)) { + ret = PTR_ERR(ev_thread->worker); + DRM_DEV_ERROR(dev, "failed to create crtc_event kthread\n"); + ev_thread->worker = NULL; + goto err_msm_uninit; + } + + sched_set_fifo(ev_thread->worker->task); + } + + ret = drm_vblank_init(ddev, priv->num_crtcs); + if (ret < 0) { + DRM_DEV_ERROR(dev, "failed to initialize vblank\n"); + goto err_msm_uninit; + } + + pm_runtime_get_sync(dev); + ret = msm_irq_install(ddev, kms->irq); + pm_runtime_put_sync(dev); + if (ret < 0) { + DRM_DEV_ERROR(dev, "failed to install IRQ handler\n"); + goto err_msm_uninit; + } + + ret = msm_disp_snapshot_init(ddev); + if (ret) + DRM_DEV_ERROR(dev, "msm_disp_snapshot_init failed ret = %d\n", ret); + + drm_mode_config_reset(ddev); + + return 0; + +err_msm_uninit: + return ret; +} + +int msm_kms_pm_prepare(struct device *dev) +{ + struct msm_drm_private *priv = dev_get_drvdata(dev); + struct drm_device *ddev = priv ? priv->dev : NULL; + + if (!priv || !priv->kms) + return 0; + + return drm_mode_config_helper_suspend(ddev); +} + +void msm_kms_pm_complete(struct device *dev) +{ + struct msm_drm_private *priv = dev_get_drvdata(dev); + struct drm_device *ddev = priv ? priv->dev : NULL; + + if (!priv || !priv->kms) + return; + + drm_mode_config_helper_resume(ddev); +} + +void msm_kms_shutdown(struct platform_device *pdev) +{ + struct msm_drm_private *priv = platform_get_drvdata(pdev); + struct drm_device *drm = priv ? priv->dev : NULL; + + /* + * Shutdown the hw if we're far enough along where things might be on. + * If we run this too early, we'll end up panicking in any variety of + * places. Since we don't register the drm device until late in + * msm_drm_init, drm_dev->registered is used as an indicator that the + * shutdown will be successful. + */ + if (drm && drm->registered && priv->kms) + drm_atomic_helper_shutdown(drm); +} diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h index 086a3f1ff956..44aa435d68ce 100644 --- a/drivers/gpu/drm/msm/msm_kms.h +++ b/drivers/gpu/drm/msm/msm_kms.h @@ -195,4 +195,7 @@ static inline void msm_kms_destroy(struct msm_kms *kms) drm_for_each_crtc_reverse(crtc, dev) \ for_each_if (drm_crtc_mask(crtc) & (crtc_mask)) +int msm_drm_kms_init(struct device *dev, const struct drm_driver *drv); +void msm_drm_kms_uninit(struct device *dev); + #endif /* __MSM_KMS_H__ */