From patchwork Fri Nov 8 00:21:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13867359 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 091FAD5D699 for ; Fri, 8 Nov 2024 00:21:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7289610E327; Fri, 8 Nov 2024 00:21:55 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="zeSuB1ga"; dkim-atps=neutral Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) by gabe.freedesktop.org (Postfix) with ESMTPS id B788610E90D for ; Fri, 8 Nov 2024 00:21:53 +0000 (UTC) Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2fb3c3d5513so15807781fa.1 for ; Thu, 07 Nov 2024 16:21:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731025312; x=1731630112; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=iqTmYkI1sTYF3qb4f0/yZ60dAOKRHc0Ytx57Zzv01ak=; b=zeSuB1gaETh363RQnSrVe9994MV95EVxAhkr0gdbv8Z+MvJziQbMGVYdBzOK0HKaU2 atQ87CZRxeHZprh9CYdtsSjnnqXxYOXYtIoY0UwB/HhBVG0TaXe5rrgxSgozQj5R989f 5Auue+Ik/c3hqng4GkGcH3IxPzTjP57qROhNrJZ+rz3l6LnXK4TGvUAtPg7DmOPhhABZ VjHfH8AW43GbLMxuLRYiyD/27ppRC1WkjmboFUrul7ZGIPhNe7bWX7O1nLK338CiX1sy kMiQOPivEJzk4KWQiWIcMJjGZy9UJAwmrHD1qPQAiliPH5VOMwM2W1+ttqrcjRrWJoCk CW1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731025312; x=1731630112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iqTmYkI1sTYF3qb4f0/yZ60dAOKRHc0Ytx57Zzv01ak=; b=bUMIQwgBnSUgecdbCF3q0B5sFttOfR8iJUcv/RGykIx1tWV/aXeXCNYJiRvX7f1+EY /+lB+TxR4AxVBKBA/CwaoY23clfi7Qj9XMvCbms6BHn36Mg9z9CGYJ7VdxVJ1+5ziXaQ c+9h1s6ERNvPvuNXhiQNEYUrevGrYT5Dla/kkuvlf8MwhlfXNCM/CiBMTr+a4r5SlmUN Vcb4nWS3X4BvepFnw1wg1h5OKlM8IPxHWUDGm0dTy3OmYhMlsBimTaDPdlpC3ChW4at+ MW2aH/KaN6HVP2QdIhYGHR9Uz05tSPlXZnF7d98AbcNmnQZNGUi/sks2fl7HLxpCsl5r 4xug== X-Forwarded-Encrypted: i=1; AJvYcCUWabywJcZ4bmS5iZkBmZ8yyDqX4alNXEGfkeC3jJAgJdCAR4aNcQHyG33quEVf59k+LYtr9s6/ZIc=@lists.freedesktop.org X-Gm-Message-State: AOJu0Ywrw5HV8RTHy1gTmHKdHQti3TemV/R65p8n/acKOuhmlU4nozhR /Xe06eqLVfkXt9y+MfjO9ckN8LvDm8GMue1U+QDfOani+Qkd8zM5Wu7Hf6H/4f0= X-Google-Smtp-Source: AGHT+IFB3EtcuwSPXXvmrgYqcgPpMCEm7lQHTJceygQenOEGhO5aTkUQzo7cPBTWOwghLKXmByPdtw== X-Received: by 2002:a05:651c:1512:b0:2fb:382e:4120 with SMTP id 38308e7fff4ca-2ff2027179cmr3948591fa.38.1731025311803; Thu, 07 Nov 2024 16:21:51 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ff17900a63sm4195191fa.47.2024.11.07.16.21.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 16:21:50 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 08 Nov 2024 02:21:36 +0200 Subject: [PATCH 05/14] drm/msm/dp: move I/O functions to global header MIME-Version: 1.0 Message-Id: <20241108-fd-dp-audio-fixup-v1-5-40c8eeb60cf5@linaro.org> References: <20241108-fd-dp-audio-fixup-v1-0-40c8eeb60cf5@linaro.org> In-Reply-To: <20241108-fd-dp-audio-fixup-v1-0-40c8eeb60cf5@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter , Paloma Arellano Cc: Douglas Anderson , Stephen Boyd , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Dmitry Baryshkov X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5678; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=tnEeIrByurbE7rTzcskKZuqjBOLJnljywD+1OL2NWBk=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnLVmPPIrBWCFun0FcX9KyCze1YM7zEISmrTGr9 dW/f+yzSbyJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZy1ZjwAKCRCLPIo+Aiko 1egpCACgI95kC95g/HFjhz0RngHTkYApUNtYnbpwdJH5CtIQ8/YUZD1RlXX49flEX3PmRoeJUC3 YO8qFg2+3jROdG7ygfBhMhPeXwvIIFFrrwjZlQhNzWNZeps4vAwM/utgNmglDC9Vif1+t5i6tzo 0w4jNFkqTr1EMNuDm3velteWAn9zHdqgN+zl8I9Hm1Mp8uekC8LU+NRIse1SjscMqP+uclzylNf nyakI28pKS1bPD0r6LmU8gOR+uEQ+/veyfXwp9f1Oia84da65TBN8CfecwT7LcxZnFnoVMvVc5R Znuy8PLxDS9+0t+6HuuMupJAHONEm4KkUGUQNGfzHrS8dc2q X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Move msm_dp_read()/msm_write_foo() functions to the dp_catalog.h, allowing other modules to access the data directly. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dp/dp_catalog.c | 65 ------------------------------------ drivers/gpu/drm/msm/dp/dp_catalog.h | 66 +++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 65 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c b/drivers/gpu/drm/msm/dp/dp_catalog.c index a8193581eaaaed9234a061283577af068ada0ad6..24bd9167fc2a8a5ff749a1f84e2eb76347ed8590 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.c +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c @@ -78,71 +78,6 @@ void msm_dp_catalog_snapshot(struct msm_dp_catalog *msm_dp_catalog, struct msm_d msm_disp_snapshot_add_block(disp_state, msm_dp_catalog->p0_len, msm_dp_catalog->p0_base, "dp_p0"); } -static inline u32 msm_dp_read_aux(struct msm_dp_catalog *msm_dp_catalog, u32 offset) -{ - return readl_relaxed(msm_dp_catalog->aux_base + offset); -} - -static inline void msm_dp_write_aux(struct msm_dp_catalog *msm_dp_catalog, - u32 offset, u32 data) -{ - /* - * To make sure aux reg writes happens before any other operation, - * this function uses writel() instread of writel_relaxed() - */ - writel(data, msm_dp_catalog->aux_base + offset); -} - -static inline u32 msm_dp_read_ahb(const struct msm_dp_catalog *msm_dp_catalog, u32 offset) -{ - return readl_relaxed(msm_dp_catalog->ahb_base + offset); -} - -static inline void msm_dp_write_ahb(struct msm_dp_catalog *msm_dp_catalog, - u32 offset, u32 data) -{ - /* - * To make sure phy reg writes happens before any other operation, - * this function uses writel() instread of writel_relaxed() - */ - writel(data, msm_dp_catalog->ahb_base + offset); -} - -static inline void msm_dp_write_p0(struct msm_dp_catalog *msm_dp_catalog, - u32 offset, u32 data) -{ - /* - * To make sure interface reg writes happens before any other operation, - * this function uses writel() instread of writel_relaxed() - */ - writel(data, msm_dp_catalog->p0_base + offset); -} - -static inline u32 msm_dp_read_p0(struct msm_dp_catalog *msm_dp_catalog, - u32 offset) -{ - /* - * To make sure interface reg writes happens before any other operation, - * this function uses writel() instread of writel_relaxed() - */ - return readl_relaxed(msm_dp_catalog->p0_base + offset); -} - -static inline u32 msm_dp_read_link(struct msm_dp_catalog *msm_dp_catalog, u32 offset) -{ - return readl_relaxed(msm_dp_catalog->link_base + offset); -} - -static inline void msm_dp_write_link(struct msm_dp_catalog *msm_dp_catalog, - u32 offset, u32 data) -{ - /* - * To make sure link reg writes happens before any other operation, - * this function uses writel() instread of writel_relaxed() - */ - writel(data, msm_dp_catalog->link_base + offset); -} - /* aux related catalog functions */ u32 msm_dp_catalog_aux_read_data(struct msm_dp_catalog *msm_dp_catalog) { diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.h b/drivers/gpu/drm/msm/dp/dp_catalog.h index af54f8850a88f86e3c998cf6b5d1bdb93d42ba94..42ae8dae68bd0639172350e5aef0c522c1b02f6f 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.h +++ b/drivers/gpu/drm/msm/dp/dp_catalog.h @@ -63,6 +63,72 @@ struct msm_dp_catalog { size_t p0_len; }; +/* IO */ +static inline u32 msm_dp_read_aux(struct msm_dp_catalog *msm_dp_catalog, u32 offset) +{ + return readl_relaxed(msm_dp_catalog->aux_base + offset); +} + +static inline void msm_dp_write_aux(struct msm_dp_catalog *msm_dp_catalog, + u32 offset, u32 data) +{ + /* + * To make sure aux reg writes happens before any other operation, + * this function uses writel() instread of writel_relaxed() + */ + writel(data, msm_dp_catalog->aux_base + offset); +} + +static inline u32 msm_dp_read_ahb(const struct msm_dp_catalog *msm_dp_catalog, u32 offset) +{ + return readl_relaxed(msm_dp_catalog->ahb_base + offset); +} + +static inline void msm_dp_write_ahb(struct msm_dp_catalog *msm_dp_catalog, + u32 offset, u32 data) +{ + /* + * To make sure phy reg writes happens before any other operation, + * this function uses writel() instread of writel_relaxed() + */ + writel(data, msm_dp_catalog->ahb_base + offset); +} + +static inline void msm_dp_write_p0(struct msm_dp_catalog *msm_dp_catalog, + u32 offset, u32 data) +{ + /* + * To make sure interface reg writes happens before any other operation, + * this function uses writel() instread of writel_relaxed() + */ + writel(data, msm_dp_catalog->p0_base + offset); +} + +static inline u32 msm_dp_read_p0(struct msm_dp_catalog *msm_dp_catalog, + u32 offset) +{ + /* + * To make sure interface reg writes happens before any other operation, + * this function uses writel() instread of writel_relaxed() + */ + return readl_relaxed(msm_dp_catalog->p0_base + offset); +} + +static inline u32 msm_dp_read_link(struct msm_dp_catalog *msm_dp_catalog, u32 offset) +{ + return readl_relaxed(msm_dp_catalog->link_base + offset); +} + +static inline void msm_dp_write_link(struct msm_dp_catalog *msm_dp_catalog, + u32 offset, u32 data) +{ + /* + * To make sure link reg writes happens before any other operation, + * this function uses writel() instread of writel_relaxed() + */ + writel(data, msm_dp_catalog->link_base + offset); +} + /* Debug module */ void msm_dp_catalog_snapshot(struct msm_dp_catalog *msm_dp_catalog, struct msm_disp_state *disp_state);