From nobody Sun Feb 8 13:10:57 2026 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 961921411DE for ; Mon, 24 Feb 2025 08:01:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740384095; cv=none; b=RYa1JW2uimqFsZVo3AaOnZKMEqgHRUGvHXWdhFVmL6awNlUtPQkYX45BjxkTYLnCaDhyMlO0AaSHnBnZ0OrbSgpjooZEyfWWhhl4G2zJKdBIX2RbrNY8pAit9yG46WFoJazi9fXbB5rmnaA6akkC5XQ+O104WxfOM6iTkCnWai0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740384095; c=relaxed/simple; bh=fLnEiSETJ8+PZ13rLV26ADkS/jCTNTqwXysxo5sNB1Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=i0IBvhZSrwvvFgus/B3Vma3kIOdl+/N7rTKMiN0XhOIYDVyIwCVsQGVE+Y65S6PA1L9lmKbub6fjR5UtpW9AWhLXAMVOkJC4RcJqP1ptmGyXIQKjjlT0J7qmVc7hhBMt3CfZ+idwqme3nV7hDFsX9av2tqVAY6xEJmMmZ1QV1ao= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=rMBG1MHy; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="rMBG1MHy" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-439ac3216dcso21455005e9.1 for ; Mon, 24 Feb 2025 00:01:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1740384092; x=1740988892; darn=vger.kernel.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=VDvEBdyqb+LCUK8JJ/EhfQ/X2vzVVFCo3S0RnsiF8pI=; b=rMBG1MHytDMvfXTMelHJoNkoKbwfUApbDVwznlrfRZhea2Xjbqjg8Zfk2btKCCOaol yyKcI28Mabj6BEsYixaDDxzgEJk7h3AHBL0QGggrTLQAkcyrhAwUI0fyBwaVL+U+OeoF 9wmHM3y0TmXvc1KBme4KmlNeeDW1d+o9wkEYMTeQ1R8eYlL9PbEylsvFGUweze0bSImR EOr7DQsmi5YPR9ZnnRSKJzHC2UwRNYXw72ConwO18fCeTKjie+My5JQq0tgzjpYXftrc 309WA8pXgiVdTHHs0YoGmh3SXCd8RrGzn2ZsohrGjNClStPyk1VR/YuKAhddSEu+uaTg EMZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740384092; x=1740988892; 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=VDvEBdyqb+LCUK8JJ/EhfQ/X2vzVVFCo3S0RnsiF8pI=; b=YBnRRyBZHTvLot4vSXS04sexg//uWDEt6POQEKuJnl8zP/3EpnnfkSvBXSK5JkjImv w3sMmZ1EzUmAiYcxyfavWkJIZOvdtqAv6i0l7BxJtPWO8gTe2UzF2RVOpBNOi6OwthPG xxO0AknT4V3Y3x3FukbZaLGu38pqDPq9fI8vfGm+4o80GUEofoBkGenLZ9V7c2SPiINf TWJf2MEzdHcvHCPi4errGD8UEKrNM+5//QuZEJZQic19hYPQ3ruNbzjFMU86DKdIqjhd WJ9Z+DJ7ld9T7k98q9aiNBkWA/mpYiZz+decyYLnOwdIVlv7AojpTBIzbL9RQfiADrjt aN9Q== X-Forwarded-Encrypted: i=1; AJvYcCUGdp7v5BwfutS5HgxKhb0dLnsASyFGjLBmkmE2MTELzNeU//Ce82zg9za/ay+Q/5dDLjTd9lOJztClcTY=@vger.kernel.org X-Gm-Message-State: AOJu0Yx0ZBLEWgpfwi5ktQxK7FPMB6feEgnuguyCugbROMV1613EgofI eN4ZNVJ+0Ka5Tujok/xyvRVnTgjLt3mhDuSWKuBQGL/U4TgcaunJOXRHqLW9lXc= X-Gm-Gg: ASbGncu+k3suX2r4YL+fnURc1LBU+S2x6q/wLeDUE0lzfdqTFnuC8fDn09tJp0ujg+F qTawhDuGMuoafwslqVXNcoBlv9KTUJgdD5IDzSS3sx6sbHi7QhyUeGeaqtwsF3puO0SGZey6g8G cioj3uXY7gLQBJwjLovEi7ZG0e6eIyZrfh8gublwZVsh4MG/CPmRgkgkdCs1ApuVeEUN3G0320Q UZ8rCRFPWozCIRHTGbM4HQImvzCdsbIrRbEJTGj+wZQJ1ndDqKHmjhN5tdY2KIyGgpSJ3SQMYwt rNnhvC/YtRA4jbi5Rp5uY47Y1TdlhnOsAcUT1wazf4S/lzyNlpux4v0O74MZ416/+gMAKxq56t6 WtA+pkA== X-Google-Smtp-Source: AGHT+IE4ZDfn8IZlrI1hvBZaxOYiDGG0nYOPyFk3VkBXJ9hbsd17nkiDUQ2UUuMCC3IuQ80wYzn30w== X-Received: by 2002:a05:600c:4f92:b0:439:9377:fa22 with SMTP id 5b1f17b1804b1-439aeb3453dmr95707715e9.18.1740384091916; Mon, 24 Feb 2025 00:01:31 -0800 (PST) Received: from ta2.c.googlers.com (169.178.77.34.bc.googleusercontent.com. [34.77.178.169]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-439b0367533sm97690395e9.27.2025.02.24.00.01.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2025 00:01:31 -0800 (PST) From: Tudor Ambarus Date: Mon, 24 Feb 2025 08:01:22 +0000 Subject: [PATCH 1/3] firmware: exynos-acpm: rename exynos-acpm.h to exynos-acpm-xfer.h Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250224-acpm-debugfs-v1-1-2418a3ea1b17@linaro.org> References: <20250224-acpm-debugfs-v1-0-2418a3ea1b17@linaro.org> In-Reply-To: <20250224-acpm-debugfs-v1-0-2418a3ea1b17@linaro.org> To: Krzysztof Kozlowski , Alim Akhtar Cc: andre.draszik@linaro.org, peter.griffin@linaro.org, willmcvicker@google.com, kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Tudor Ambarus X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1740384089; l=2304; i=tudor.ambarus@linaro.org; s=20241212; h=from:subject:message-id; bh=fLnEiSETJ8+PZ13rLV26ADkS/jCTNTqwXysxo5sNB1Y=; b=3T+7vTI0DjoqdFOzA1ETT/a2YAOdtQrNmTHKgkHboovpHfmPcXLCAGDs1fKlPZGN1M4U2WRzg ZwS4rhbBJLnDhj8MJEGz0gLckLiY937y7lH/k1/+7pa1o+7yd1Nce7y X-Developer-Key: i=tudor.ambarus@linaro.org; a=ed25519; pk=uQzE0NXo3dIjeowMTOPCpIiPHEz12IA/MbyzrZVh9WI= Rename header file to better indicate what it is used for. This is a preparation patch, as exynos-acpm.h will be later on introduced and included between the core driver and its debugfs logging feature. Signed-off-by: Tudor Ambarus --- drivers/firmware/samsung/exynos-acpm-pmic.c | 2 +- drivers/firmware/samsung/{exynos-acpm.h =3D> exynos-acpm-xfer.h} | 6 +++--- drivers/firmware/samsung/exynos-acpm.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/firmware/samsung/exynos-acpm-pmic.c b/drivers/firmware= /samsung/exynos-acpm-pmic.c index 85e90d236da2..9ad4cb82fae1 100644 --- a/drivers/firmware/samsung/exynos-acpm-pmic.c +++ b/drivers/firmware/samsung/exynos-acpm-pmic.c @@ -9,7 +9,7 @@ #include #include =20 -#include "exynos-acpm.h" +#include "exynos-acpm-xfer.h" #include "exynos-acpm-pmic.h" =20 #define ACPM_PMIC_CHANNEL GENMASK(15, 12) diff --git a/drivers/firmware/samsung/exynos-acpm.h b/drivers/firmware/sams= ung/exynos-acpm-xfer.h similarity index 79% rename from drivers/firmware/samsung/exynos-acpm.h rename to drivers/firmware/samsung/exynos-acpm-xfer.h index 2d14cb58f98c..0b76a270b773 100644 --- a/drivers/firmware/samsung/exynos-acpm.h +++ b/drivers/firmware/samsung/exynos-acpm-xfer.h @@ -4,8 +4,8 @@ * Copyright 2020 Google LLC. * Copyright 2024 Linaro Ltd. */ -#ifndef __EXYNOS_ACPM_H__ -#define __EXYNOS_ACPM_H__ +#ifndef __EXYNOS_ACPM_XFER_H__ +#define __EXYNOS_ACPM_XFER_H__ =20 struct acpm_xfer { const u32 *txd; @@ -20,4 +20,4 @@ struct acpm_handle; int acpm_do_xfer(const struct acpm_handle *handle, const struct acpm_xfer *xfer); =20 -#endif /* __EXYNOS_ACPM_H__ */ +#endif /* __EXYNOS_ACPM_XFER_H__ */ diff --git a/drivers/firmware/samsung/exynos-acpm.c b/drivers/firmware/sams= ung/exynos-acpm.c index a85b2dbdd9f0..3c14afc89fd7 100644 --- a/drivers/firmware/samsung/exynos-acpm.c +++ b/drivers/firmware/samsung/exynos-acpm.c @@ -27,7 +27,7 @@ #include #include =20 -#include "exynos-acpm.h" +#include "exynos-acpm-xfer.h" #include "exynos-acpm-pmic.h" =20 #define ACPM_PROTOCOL_SEQNUM GENMASK(21, 16) --=20 2.48.1.601.g30ceb7b040-goog From nobody Sun Feb 8 13:10:57 2026 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF57B19DF4B for ; Mon, 24 Feb 2025 08:01:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740384096; cv=none; b=MqWesSUCdy0KXL62qAj9elQGN/dUYhFToLIQeURqpnnDVgn1FE/gTn7HHF87b6PRyhTE16/w+GURbLT+UZchkeebLYRnNfBQNTktTGvPnbKV9gaiq+4hucuF6vBjjmpJPiGSlNaM0lW2ocglTwRlmnE50rAeo08Rcp3qWaY5y4s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740384096; c=relaxed/simple; bh=hCBzOfJSymMyHvVROjcOk8C8vSA3TYnFB5U/O/rnkDE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uteDsqo89+H9hXa2FePt/J+/m0RXMOSqFoyklUuK8+NbqdnhkemAv6qoGsfoOAVBq+Z9SEnkhYkwoKVh7Xk7ndC4nNswfjUTuEK+JI/wxEjPn4Q7yFyRWgWy02EdOlp+yXPxOTEMQx4ioSJmSVTWEC8mmyrXCxd/JOOOGYShdw0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ZGU9s7nZ; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZGU9s7nZ" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-38a25d4b9d4so2306802f8f.0 for ; Mon, 24 Feb 2025 00:01:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1740384093; x=1740988893; darn=vger.kernel.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=eldJ3fyZ9RULfFnJAoQ78yq6LgsezdF6MepZXaC6j0I=; b=ZGU9s7nZyGIXGCA7gkVySgfwKjFLShwI0dJ0LbJft9bo8V7LVRU8iESS3TrOeo0EfI qCfr2mXHEGnyuH2YzUEb4e8ytEr9zSHV8XBbNiTMpQtVNUBEiMW3Yn/4NvWpWWeEqbHi Y/dzIyqLXLAe+JeLHZDP1UVHREQszryPpCSELOJyLjUBnwU3fHeJHS+ESnU3eMnIg3yX XhqtBLSjzeSxgy282vtRYEkZgyrmfydNiJq+eGZs/+vnGv+zC1G34NFVr+sc7pK3djl2 1lqNL9M0qB5XRhIoFEL0KW149A1Ann78LNhTmquv1qN6N7eEvtEWBPBd4mGuWKzk4FCF by/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740384093; x=1740988893; 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=eldJ3fyZ9RULfFnJAoQ78yq6LgsezdF6MepZXaC6j0I=; b=S1GQcDmR4Y9f6DLdb7lORJaWqf4w/CdzgYYaNSTFTSDGfvUnCIp1kWTgFJav7MVjIo A2XUbQonWU9IOIpNNRP3/QiWVQi8ikOSAnOPkF4GMA3RD85wcI2pcXPXCNErVJpjK1aK Dx+DjuGL3GRZJTN0l2zSoXnEPAZP1qFX08eOQ4IzLIAn01dqbIhvL9UjtcblK5aFyZsV vLvZlp3vGg8MwZyVY7lR7zKnfX8Csrxbaq9vwQ419wlcEa52O4vCS/F/kRSUs8OtTBuh 3WlXFsSC+7JQOkfg1g1BoutX7PdkDzBuK+MosbDi8goW7kpqpyKpa8m9CkfikLZWxFGm 7T4Q== X-Forwarded-Encrypted: i=1; AJvYcCWjZR2fZbj0whwosY2zxCByJSHxsWSkGYDnGIT0u+4vdPd7eheny/A4Q3/Yn8xNVKduGXVM20irtAZ3BsM=@vger.kernel.org X-Gm-Message-State: AOJu0Yw4JESrBVBje0frPaGPksFQGejwgqb2fztcH9I+mauBhjdsJ5mi tou7350NnaeWBY4eTDLwnSTR4HrFFRHp7uorjqS+Jkz2PqUo6fu6gShB9gdmb0A= X-Gm-Gg: ASbGnctj8S1JpPsRUmsPYxE9m/b5CBXcH7A4SY03XcnWMvWOxey/yXUoFrrxtP6Q5vq HdQKmaPQo3qGS48KTnIs1LY52cWYj5/RAG2vLxfp4g3ZXUOGEM6CUCizMDK9/d0Qy04lZyuivCh PhOa+fm7B3akexbEiJbFNFl77OSUUd7atY2bz91YE0lpYKYhoKmghI9qhSYaswazkyPk5r/87sr uzxm1nzzOaGNPXR2hQ1mpmJu5/SSiCOowp11IzKrz4Ijp0l3kF8S5moXob5CjzShm8AYXy0G1QI KMVSHtEIcundOqUMinamBTsVlvvC+x53MMXclZ/jmSZ/LoY7kOqEzJa45eTGx7CtFUICiZ974nr 9TFcitg== X-Google-Smtp-Source: AGHT+IHtf5uVeObOSZyCBZwbvEGvCzNRNum9va67etYAmQ/b61RunJpq5G91CksEuJbTMQeAIBjKag== X-Received: by 2002:a05:6000:144a:b0:38f:2766:7594 with SMTP id ffacd0b85a97d-38f6e95c60cmr8671320f8f.12.1740384093024; Mon, 24 Feb 2025 00:01:33 -0800 (PST) Received: from ta2.c.googlers.com (169.178.77.34.bc.googleusercontent.com. [34.77.178.169]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-439b0367533sm97690395e9.27.2025.02.24.00.01.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2025 00:01:32 -0800 (PST) From: Tudor Ambarus Date: Mon, 24 Feb 2025 08:01:23 +0000 Subject: [PATCH 2/3] firmware: exynos-acpm: move common structures to exynos-acpm.h Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250224-acpm-debugfs-v1-2-2418a3ea1b17@linaro.org> References: <20250224-acpm-debugfs-v1-0-2418a3ea1b17@linaro.org> In-Reply-To: <20250224-acpm-debugfs-v1-0-2418a3ea1b17@linaro.org> To: Krzysztof Kozlowski , Alim Akhtar Cc: andre.draszik@linaro.org, peter.griffin@linaro.org, willmcvicker@google.com, kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Tudor Ambarus X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1740384089; l=4949; i=tudor.ambarus@linaro.org; s=20241212; h=from:subject:message-id; bh=hCBzOfJSymMyHvVROjcOk8C8vSA3TYnFB5U/O/rnkDE=; b=ATLynd3c1Y0yvN4/G4Wd0ln2S20qs67kvDyIgdhR9p4lEnrThWwETuUT7EpmvVxuE4ICAf2Hk NacKRW6DfReDLvZ+0SKuVRyS5pZc2HH7MZxIvDXf0/JNF0VtXLnWvh9 X-Developer-Key: i=tudor.ambarus@linaro.org; a=ed25519; pk=uQzE0NXo3dIjeowMTOPCpIiPHEz12IA/MbyzrZVh9WI= Prepare for the ACPM logging feature addition. ACPM is capable of logging things to SRAM. The logging feature needs access to struct acpm_info in order to get the sram_base, to the configuration data from SRAM, and to the struct acpm_queue internal driver representation of a queue. Move these structs to a common exynos-acpm.h. Signed-off-by: Tudor Ambarus --- drivers/firmware/samsung/exynos-acpm.c | 48 +------------------------- drivers/firmware/samsung/exynos-acpm.h | 63 ++++++++++++++++++++++++++++++= ++++ 2 files changed, 64 insertions(+), 47 deletions(-) diff --git a/drivers/firmware/samsung/exynos-acpm.c b/drivers/firmware/sams= ung/exynos-acpm.c index 3c14afc89fd7..8d83841f1d62 100644 --- a/drivers/firmware/samsung/exynos-acpm.c +++ b/drivers/firmware/samsung/exynos-acpm.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -27,7 +26,7 @@ #include #include =20 -#include "exynos-acpm-xfer.h" +#include "exynos-acpm.h" #include "exynos-acpm-pmic.h" =20 #define ACPM_PROTOCOL_SEQNUM GENMASK(21, 16) @@ -38,20 +37,6 @@ =20 #define ACPM_GS101_INITDATA_BASE 0xa000 =20 -/** - * struct acpm_shmem - shared memory configuration information. - * @reserved: unused fields. - * @chans: offset to array of struct acpm_chan_shmem. - * @reserved1: unused fields. - * @num_chans: number of channels. - */ -struct acpm_shmem { - u32 reserved[2]; - u32 chans; - u32 reserved1[3]; - u32 num_chans; -}; - /** * struct acpm_chan_shmem - descriptor of a shared memory channel. * @@ -85,19 +70,6 @@ struct acpm_chan_shmem { u32 poll_completion; }; =20 -/** - * struct acpm_queue - exynos acpm queue. - * - * @rear: rear address of the queue. - * @front: front address of the queue. - * @base: base address of the queue. - */ -struct acpm_queue { - void __iomem *rear; - void __iomem *front; - void __iomem *base; -}; - /** * struct acpm_rx_data - RX queue data. * @@ -155,24 +127,6 @@ struct acpm_chan { struct acpm_rx_data rx_data[ACPM_SEQNUM_MAX]; }; =20 -/** - * struct acpm_info - driver's private data. - * @shmem: pointer to the SRAM configuration data. - * @sram_base: base address of SRAM. - * @chans: pointer to the ACPM channel parameters retrieved from SRAM. - * @dev: pointer to the exynos-acpm device. - * @handle: instance of acpm_handle to send to clients. - * @num_chans: number of channels available for this controller. - */ -struct acpm_info { - struct acpm_shmem __iomem *shmem; - void __iomem *sram_base; - struct acpm_chan *chans; - struct device *dev; - struct acpm_handle handle; - u32 num_chans; -}; - /** * struct acpm_match_data - of_device_id data. * @initdata_base: offset in SRAM where the channels configuration resides. diff --git a/drivers/firmware/samsung/exynos-acpm.h b/drivers/firmware/sams= ung/exynos-acpm.h new file mode 100644 index 000000000000..c212fe28758a --- /dev/null +++ b/drivers/firmware/samsung/exynos-acpm.h @@ -0,0 +1,63 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright 2020 Samsung Electronics Co., Ltd. + * Copyright 2020 Google LLC. + * Copyright 2024 Linaro Ltd. + */ +#ifndef __EXYNOS_ACPM_H__ +#define __EXYNOS_ACPM_H__ + +#include +#include +#include + +#include "exynos-acpm-xfer.h" + +/** + * struct acpm_shmem - shared memory configuration information. + * @reserved: unused fields. + * @chans: offset to array of struct acpm_chan_shmem. + * @reserved1: unused fields. + * @num_chans: number of channels. + */ +struct acpm_shmem { + u32 reserved[2]; + u32 chans; + u32 reserved1[3]; + u32 num_chans; +}; + +/** + * struct acpm_queue - exynos acpm queue. + * @rear: rear address of the queue. + * @front: front address of the queue. + * @base: base address of the queue. + */ +struct acpm_queue { + void __iomem *rear; + void __iomem *front; + void __iomem *base; +}; + +struct device; +struct acpm_chan; + +/** + * struct acpm_info - driver's private data. + * @shmem: pointer to the SRAM configuration data. + * @sram_base: base address of SRAM. + * @chans: pointer to the ACPM channel parameters retrieved from SRAM. + * @dev: pointer to the exynos-acpm device. + * @handle: instance of acpm_handle to send to clients. + * @num_chans: number of channels available for this controller. + */ +struct acpm_info { + struct acpm_shmem __iomem *shmem; + void __iomem *sram_base; + struct acpm_chan *chans; + struct device *dev; + struct acpm_handle handle; + u32 num_chans; +}; + +#endif /* __EXYNOS_ACPM_H__ */ --=20 2.48.1.601.g30ceb7b040-goog From nobody Sun Feb 8 13:10:57 2026 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E2B83241675 for ; Mon, 24 Feb 2025 08:01:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740384098; cv=none; b=iae/XnLb6WSMffovepWK5I0DuqMY5wCc+9K7unwnAHchUCrnHxqc2dvHQ4YRC8cksjAHVK4LRmwmlGYf1jP+qvW5CG2Ffpc1ByJ3zNBKNBUIgo5cnVSkMLUhHsLjb6bejALvFv315GQL2LM+vhB5mVaDhF59qfXn8kcqn3qb5no= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740384098; c=relaxed/simple; bh=yJbsmqHNsqYyrsA8KdtCD6cvsa5ry8OHqgcCrFKEErI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Gz/lc+Jz6/rU0o0rAytr9Np4oXc1no15y/E/quB8GRfBeYQMk48HwmMD/qwnSvm6jIoud+jDgZMJOMhYGUiCjvpnGRZmS0J0rtYkKrlPuwzbRT8MRklTVezFk10CFJV5/YPXy79zUzTts+nE7LJ3gGxjgvcSpk9U72vBQoraN3o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Kz2uMZgE; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Kz2uMZgE" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-43984e9cc90so28934305e9.1 for ; Mon, 24 Feb 2025 00:01:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1740384094; x=1740988894; darn=vger.kernel.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=ANBTnMfI9AQjQqjIoJpw4o9wa0/J78oX/h2BbyetABQ=; b=Kz2uMZgEMadeTS47FT1Zf1cNRjERKdtp4B3fx62Uz18EYt6RHhpEab7alConNa0dz1 k8P74GFLoAJky0lR9yaYhyL6nZqQ+pCr5uFHEDb8l6aGzoKXYR3kVi5Pi4h0CODOpBjn SX8VpSWepR9UdPwDu9jsOXgHr8pnKcRvARRpu7uZMeXpBn8iNENZboFsiTsun9dMU4xj 2BCLchcuCLcKPyIzji2wkj+xc6FYXlRBOyMekpr966e5httGXKuWBgvZv9bNpWW/VLHo bhc6MQSbfgMkD+lkTNJt9KFngblrDEfeHtxmjALLjpBICNCnDYEh4hREsk6lIraE/3qt efyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740384094; x=1740988894; 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=ANBTnMfI9AQjQqjIoJpw4o9wa0/J78oX/h2BbyetABQ=; b=QhhbBLWsvHFmoFoPreWmQi4jNfp5YkpLUDZQYMHRm59MX5m2J5e161cYSocN60cyPu yLdZBq4QYopbXBmpDHLQjCBzQsEJP0GukJTJIHsP9TKRlreQmuNK0mGvP2lffu5QRpf5 FQ1YxR/AHs2pWCL4AX3Wt0Vk6KhEO6/3WETV3XbBh1mKCvWVteez9wMfjyl6btbJQyfo 1e+nkq5IzoE0uk/XTeuo0uXxzjOa+HSZMoOeLVYAVlchwuCv+qntbuDAqkF8C8FrlVxw wlPzF8elkiy91xPUk5EibjqYlSEPjXsT2sqsGvA9mQlS4o4c2FSnP2TxW9GUygcx7RjG yQUQ== X-Forwarded-Encrypted: i=1; AJvYcCXE+tQhXCwu6X0MlnptU9wiTMnsX3Rcmpa0I+kyg9ZmcQReybTgyeb77nfY22UlIBsiE9COHAiwXHrFHSU=@vger.kernel.org X-Gm-Message-State: AOJu0YyarIMqQkzq2lKLKZiLgkgJ035VnWHfxcDMzIQsJLsJoe0ynjzL oehSfuGQNfWUd7KoG04H9BPDExwQRqausvblZimjfbfh3Ox9D/Zx03CQhQ9pPxg= X-Gm-Gg: ASbGncuNZPBorq1aP2TA298uzBICSxblwjmTiRzgPi72SV39mH+KrtEM0taGiTo5nne 2jEPfyFrhk0cZLdaGHLvz+IFCSA3PKYtAl/cFlR8jdCrVGv20WVF9cZW3BK5bWrNd97q+q3qVL6 6N+dYeIR9iR6FgYcBwymoWNmOjjYMzCD54Vj5OEM5SM6MctYiTQSz9y8SBtf/+T3495h0p42ZE6 d7D1z1YbdhciYYLwHUDTn4hDXfCMn1taI136tHrcRYD6N92Zz9NJ4oplooooEbMNKwCIjc1evP1 JqAxZXdYZrtwddg/NczB/kyKq4S9TncAuVxR2qLW5QMm0LDk29eIBi1OijuLC8LXbmAoK8m+t2J 5va+mNQ== X-Google-Smtp-Source: AGHT+IEqfqMAMX2FuVdCvP6EGCIXoyx24NwpIDqRPz+vP4XEI0A0Wy6Bj5qbITURwMDVrZtU+s5Seg== X-Received: by 2002:a5d:6d8e:0:b0:38d:e420:3942 with SMTP id ffacd0b85a97d-38f61499154mr12080345f8f.3.1740384093973; Mon, 24 Feb 2025 00:01:33 -0800 (PST) Received: from ta2.c.googlers.com (169.178.77.34.bc.googleusercontent.com. [34.77.178.169]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-439b0367533sm97690395e9.27.2025.02.24.00.01.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2025 00:01:33 -0800 (PST) From: Tudor Ambarus Date: Mon, 24 Feb 2025 08:01:24 +0000 Subject: [PATCH 3/3] firmware: samsung: add ACPM debugfs support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250224-acpm-debugfs-v1-3-2418a3ea1b17@linaro.org> References: <20250224-acpm-debugfs-v1-0-2418a3ea1b17@linaro.org> In-Reply-To: <20250224-acpm-debugfs-v1-0-2418a3ea1b17@linaro.org> To: Krzysztof Kozlowski , Alim Akhtar Cc: andre.draszik@linaro.org, peter.griffin@linaro.org, willmcvicker@google.com, kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Tudor Ambarus X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1740384089; l=16318; i=tudor.ambarus@linaro.org; s=20241212; h=from:subject:message-id; bh=yJbsmqHNsqYyrsA8KdtCD6cvsa5ry8OHqgcCrFKEErI=; b=4WepINivv1JjzEyjhrwc6g4Yvi0pDVfys7W1afXQ2GW7ziUplgb4Z4xyvzjR4PA/cdg/5qrC0 IeDT/72ZeonC/J/pHMioXXMC5bkqMwILOJ0MzA4O0AD/R/tawbzifYu X-Developer-Key: i=tudor.ambarus@linaro.org; a=ed25519; pk=uQzE0NXo3dIjeowMTOPCpIiPHEz12IA/MbyzrZVh9WI= The ACPM firmware saves debug information to SRAM. Add debugfs entries in order to expose the ACPM logs. acpm_framework/logb_gprio_level controls the ACPM print verbosity to the SRAM log buffer. It encodes a 64 bit value, 4 bits for each of the 16 Plugin IDs, with verbosity levels from 0xf (log error) to 0x0 (log debug). echo 0xffffffffffffff1f > /sys/kernel/debug/acpm_framework/logb_gprio_level Will allow only LOG_ERR prints for all Plugin IDs but Plugin ID 1, which will issue prints for any log levels greater or equal to 1. On the ACPM firmware side, logb_gprio_level has a default value of zero, all logs enabled for all Plugin IDs. acpm_framework/log_level has a maximum value of 2 and controls which SRAM log buffers are printed. Finally, acpm_framework/acpm_debug_cmd provides a way to issue ACPM DEBUG commands to the firmware. Add ACPM debugfs support with the above capabilities. Signed-off-by: Tudor Ambarus --- drivers/firmware/samsung/Makefile | 1 + drivers/firmware/samsung/exynos-acpm-debugfs.c | 359 +++++++++++++++++++++= ++++ drivers/firmware/samsung/exynos-acpm.c | 15 ++ drivers/firmware/samsung/exynos-acpm.h | 37 +++ 4 files changed, 412 insertions(+) diff --git a/drivers/firmware/samsung/Makefile b/drivers/firmware/samsung/M= akefile index 7b4c9f6f34f5..ca6b71872ac3 100644 --- a/drivers/firmware/samsung/Makefile +++ b/drivers/firmware/samsung/Makefile @@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only =20 acpm-protocol-objs :=3D exynos-acpm.o exynos-acpm-pmic.o +acpm-protocol-$(CONFIG_DEBUG_FS) +=3D exynos-acpm-debugfs.o obj-$(CONFIG_EXYNOS_ACPM_PROTOCOL) +=3D acpm-protocol.o diff --git a/drivers/firmware/samsung/exynos-acpm-debugfs.c b/drivers/firmw= are/samsung/exynos-acpm-debugfs.c new file mode 100644 index 000000000000..d839321d8901 --- /dev/null +++ b/drivers/firmware/samsung/exynos-acpm-debugfs.c @@ -0,0 +1,359 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright 2020 Samsung Electronics Co., Ltd. + * Copyright 2020 Google LLC. + * Copyright 2025 Linaro Ltd. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "exynos-acpm.h" + +#define ACPM_DEBUG_CMD BIT(14) + +#define ACPM_PRINT_CONFIG GENMASK(15, 14) +#define ACPM_PRINT_CMD BIT(13) +#define ACPM_PRINT_SET_LOGB_GPRIO_LEVEL 1 +#define ACPM_PRINT_GET_LOGB_GPRIO_LEVEL 3 + +#define ACPM_LOG_LEVEL_MAX 2 +#define ACPM_LOG_POLL_PERIOD_US 500 + +/* Tick runs at 49.152 MHz, the period below is in picoseconds. */ +#define ACPM_APM_SYSTICK_PERIOD_PS 20345 + +#define ACPM_DEBUGFS_ROOT "acpm_framework" + +enum acpm_debug_commands { + ACPM_DEBUG_DISABLE_WATCHDOG, + ACPM_DEBUG_ENABLE_WATCHDOG, + ACPM_DEBUG_SOFT_LOCKUP, + ACPM_DEBUG_HARD_LOCKUP, + ACPM_DBUG_EXCEPTION, + ACPM_DEBUG_NOTIFY_SHUTDOWN, + ACPM_DEBUG_RAMDUMP_ON, + ACPM_DEBUG_MAX, +}; + +struct acpm_log_buf { + struct acpm_queue q; + unsigned int qlen; + unsigned int mlen; + unsigned int rear_index; +}; + +struct acpm_log_info { + struct workqueue_struct *wq; + struct acpm_info *acpm; + struct delayed_work work; + struct acpm_log_buf normal; + struct acpm_log_buf preempt; + unsigned int level; + unsigned int poll_period; +}; + +union acpm_log_entry { + u32 raw[4]; + struct { + u32 systicks0 : 24; + u32 dummy : 2; + u32 is_err : 1; + u32 is_raw : 1; + u32 plugin_id : 4; + u32 systicks24; + u32 msg : 24; + u32 systicks56 : 8; + u32 data; + } __packed; +}; + +static struct dentry *rootdir; + +static DEFINE_MUTEX(acpm_log_level_mutex); + +static void acpm_log_print_entry(struct acpm_info *acpm, + const union acpm_log_entry *log_entry) +{ + u64 systicks, time, msg; + + if (log_entry->is_err) + return; + + if (log_entry->is_raw) { + dev_info(acpm->dev, "[ACPM_FW raw] : id:%u, %x, %x, %x\n", + log_entry->plugin_id, log_entry->raw[1], + log_entry->raw[2], log_entry->raw[3]); + } else { + systicks =3D ((u64)(log_entry->systicks56) << 56) + + ((u64)(log_entry->systicks24) << 24) + + log_entry->systicks0; + + /* report time in ns */ + time =3D mul_u64_u32_div(systicks, ACPM_APM_SYSTICK_PERIOD_PS, + 1000); + + msg =3D readl(acpm->sram_base + log_entry->msg); + + dev_info(acpm->dev, "[ACPM_FW] : %llu id:%u, %s, %x\n", time, + log_entry->plugin_id, (char *)&msg, log_entry->data); + } +} + +static void acpm_log_print_entries(struct acpm_info *acpm, + struct acpm_log_buf *lbuf) +{ + union acpm_log_entry log_entry =3D {0}; + u32 front, rear; + + front =3D readl(lbuf->q.front); + rear =3D lbuf->rear_index; + + while (rear !=3D front) { + __ioread32_copy(&log_entry, lbuf->q.base + lbuf->mlen * rear, + sizeof(log_entry) / 4); + + acpm_log_print_entry(acpm, &log_entry); + + if (lbuf->qlen =3D=3D rear + 1) + rear =3D 0; + else + rear++; + + lbuf->rear_index =3D rear; + front =3D readl(lbuf->q.front); + } +} + +static void acpm_log_print(struct acpm_info *acpm) +{ + struct acpm_log_info *acpm_log =3D acpm->log; + + guard(mutex)(&acpm_log_level_mutex); + + if (acpm_log->level =3D=3D 0) + return; + + if (acpm_log->level =3D=3D ACPM_LOG_LEVEL_MAX) + acpm_log_print_entries(acpm, &acpm_log->preempt); + + acpm_log_print_entries(acpm, &acpm_log->normal); +} + +static void acpm_work_fn(struct work_struct *work) +{ + struct acpm_log_info *acpm_log =3D + container_of(work, struct acpm_log_info, work.work); + struct acpm_info *acpm =3D acpm_log->acpm; + + acpm_log_print(acpm); + + queue_delayed_work(acpm_log->wq, &acpm_log->work, + msecs_to_jiffies(acpm_log->poll_period)); +} + +static int acpm_log_level_get(void *data, u64 *val) +{ + struct acpm_info *acpm =3D data; + + *val =3D acpm->log->level; + + return 0; +} + +static int acpm_log_level_set(void *data, u64 val) +{ + struct acpm_info *acpm =3D data; + struct acpm_log_info *acpm_log =3D acpm->log; + + if (val > ACPM_LOG_LEVEL_MAX) { + dev_err(acpm->dev, "Log level %llu out of range [0:%u]!\n", + val, ACPM_LOG_LEVEL_MAX); + return -EINVAL; + } + + scoped_guard(mutex, &acpm_log_level_mutex) + acpm_log->level =3D val; + + if (acpm_log->level =3D=3D 0) + cancel_delayed_work_sync(&acpm_log->work); + else + queue_delayed_work(acpm_log->wq, &acpm_log->work, + msecs_to_jiffies(acpm_log->poll_period)); + return 0; +} + +DEFINE_DEBUGFS_ATTRIBUTE(acpm_log_level_fops, acpm_log_level_get, + acpm_log_level_set, "0%llu\n"); + +/** + * acpm_logb_gprio_level_get() - get ACPM Log Buffer Group Priority logging + * level. + * @data: pointer to the driver data. + * @val: pointer where the ACPM Log Buffer Group Priority logging level + * will be saved. + * + * The 64 bit hex value encodes the plugin ID log level request on 4 bits, + * supporting a maximum of 16 plugin IDs. Plugin ID 0 is described by + * GENMASK(3, 0), followed by the other plugin IDs in ascending order, up = to + * plugin ID 15 which is described by GENMASK(63, 60). + * Value 0xf is log error level, and 0x0 is log debug level. + */ +static int acpm_logb_gprio_level_get(void *data, u64 *val) +{ + struct acpm_info *acpm =3D data; + struct acpm_xfer xfer; + u32 cmd[4] =3D {0}; + int ret; + + cmd[0] =3D ACPM_PRINT_CMD | + FIELD_PREP(ACPM_PRINT_CONFIG, ACPM_PRINT_GET_LOGB_GPRIO_LEVEL); + + xfer.txd =3D cmd; + xfer.txlen =3D sizeof(cmd); + xfer.rxd =3D cmd; + xfer.rxlen =3D sizeof(cmd); + xfer.acpm_chan_id =3D acpm->mbox_dbg_chan; + + ret =3D acpm_do_xfer(&acpm->handle, &xfer); + if (!ret) + *val =3D (((u64)xfer.rxd[2]) << 32) | xfer.rxd[1]; + + return ret; +} + +/** + * acpm_logb_gprio_level_set() - set ACPM Log Buffer Group Priority logging + * level. + * @data: pointer to the driver data. + * @val: 64 bit hex value to set. + * The 64 bit hex value encodes the plugin ID log level request on 4 bits, + * supporting a maximum of 16 plugin IDs. Plugin ID 0 is described by + * GENMASK(3, 0), followed by the other plugin IDs in ascending order, up = to + * plugin ID 15 which is described by GENMASK(63, 60). + * Value 0xf is log error level, and 0x0 is log debug level. + */ +static int acpm_logb_gprio_level_set(void *data, u64 val) +{ + struct acpm_info *acpm =3D data; + struct acpm_xfer xfer =3D {0}; + u32 cmd[4] =3D {0}; + + cmd[0] =3D ACPM_PRINT_CMD | + FIELD_PREP(ACPM_PRINT_CONFIG, ACPM_PRINT_SET_LOGB_GPRIO_LEVEL); + cmd[1] =3D val; + cmd[2] =3D val >> 32; + + xfer.txd =3D cmd; + xfer.txlen =3D sizeof(cmd); + xfer.acpm_chan_id =3D acpm->mbox_dbg_chan; + + return acpm_do_xfer(&acpm->handle, &xfer); +} + +DEFINE_DEBUGFS_ATTRIBUTE(acpm_logb_gprio_level_fops, acpm_logb_gprio_level= _get, + acpm_logb_gprio_level_set, "0x%016llx\n"); + +static int acpm_debug_cmd_set(void *data, u64 val) +{ + struct acpm_info *acpm =3D data; + struct acpm_xfer xfer =3D {0}; + u32 cmd[4] =3D {0}; + + if (val >=3D ACPM_DEBUG_MAX) { + dev_err(acpm->dev, "sub-cmd:%llu out of range!\n", val); + return 0; + } + + cmd[0] =3D val | ACPM_DEBUG_CMD; + + xfer.txd =3D cmd; + xfer.txlen =3D sizeof(cmd); + xfer.acpm_chan_id =3D acpm->mbox_dbg_chan; + + return acpm_do_xfer(&acpm->handle, &xfer); +} + +DEFINE_DEBUGFS_ATTRIBUTE(acpm_debug_cmd_fops, NULL, acpm_debug_cmd_set, + "0x%016llx\n"); + +static void acpm_debugfs_init(struct acpm_info *acpm) +{ + rootdir =3D debugfs_create_dir(ACPM_DEBUGFS_ROOT, NULL); + + debugfs_create_file("log_level", 0644, rootdir, acpm, + &acpm_log_level_fops); + debugfs_create_file("logb_gprio_level", 0644, rootdir, acpm, + &acpm_logb_gprio_level_fops); + debugfs_create_file("acpm_debug_cmd", 0644, rootdir, acpm, + &acpm_debug_cmd_fops); +} + +/** + * acpm_debug_get_params() - get debug parameters of the normal and preempt + * queues. + * @acpm: pointer to the driver data. + */ +static void acpm_debug_get_params(struct acpm_info *acpm) +{ + struct acpm_shmem __iomem *shmem =3D acpm->shmem; + void __iomem *base =3D acpm->sram_base; + struct acpm_log_info *acpm_log =3D acpm->log; + struct acpm_log_buf *lbuf; + + lbuf =3D &acpm_log->normal; + lbuf->q.base =3D base + readl(&shmem->log_base); + lbuf->q.rear =3D base + readl(&shmem->log_rear); + lbuf->q.front =3D base + readl(&shmem->log_front); + lbuf->qlen =3D readl(&shmem->log_qlen); + lbuf->mlen =3D readl(&shmem->log_mlen); + + lbuf =3D &acpm_log->preempt; + lbuf->q.base =3D base + readl(&shmem->preempt_log_base); + lbuf->q.rear =3D base + readl(&shmem->preempt_log_rear); + lbuf->q.front =3D base + readl(&shmem->preempt_log_front); + lbuf->qlen =3D readl(&shmem->preempt_log_qlen); + lbuf->mlen =3D acpm_log->normal.mlen; +} + +/** + * acpm_debugfs_register() - register ACPM debug capabilities via debugfs. + * @acpm: pointer to the driver data. + */ +int acpm_debugfs_register(struct acpm_info *acpm) +{ + struct acpm_log_info *acpm_log; + + acpm_log =3D devm_kzalloc(acpm->dev, sizeof(*acpm_log), GFP_KERNEL); + if (!acpm_log) + return -ENOMEM; + + acpm->log =3D acpm_log; + acpm_log->acpm =3D acpm; + + acpm_log->wq =3D alloc_workqueue("exynos-acpm-log-wq", 0, 0); + if (!acpm_log->wq) + return -ENOMEM; + + INIT_DELAYED_WORK(&acpm_log->work, acpm_work_fn); + acpm_log->poll_period =3D ACPM_LOG_POLL_PERIOD_US; + + acpm_debug_get_params(acpm); + + acpm_debugfs_init(acpm); + + return 0; +} + +void acpm_debugfs_remove(void) +{ + debugfs_remove_recursive(rootdir); +} diff --git a/drivers/firmware/samsung/exynos-acpm.c b/drivers/firmware/sams= ung/exynos-acpm.c index 8d83841f1d62..53f0d3db3400 100644 --- a/drivers/firmware/samsung/exynos-acpm.c +++ b/drivers/firmware/samsung/exynos-acpm.c @@ -36,6 +36,7 @@ #define ACPM_TX_TIMEOUT_US 500000 =20 #define ACPM_GS101_INITDATA_BASE 0xa000 +#define ACPM_GS101_MBOX_DBG_CHAN 4 =20 /** * struct acpm_chan_shmem - descriptor of a shared memory channel. @@ -130,9 +131,11 @@ struct acpm_chan { /** * struct acpm_match_data - of_device_id data. * @initdata_base: offset in SRAM where the channels configuration resides. + * @mbox_dbg_chan: mailbox channel number used for ACPM debug. */ struct acpm_match_data { loff_t initdata_base; + unsigned int mbox_dbg_chan; }; =20 #define client_to_acpm_chan(c) container_of(c, struct acpm_chan, cl) @@ -577,12 +580,17 @@ static int acpm_probe(struct platform_device *pdev) "Failed to get match data.\n"); =20 acpm->shmem =3D acpm->sram_base + match_data->initdata_base; + acpm->mbox_dbg_chan =3D match_data->mbox_dbg_chan; acpm->dev =3D dev; =20 ret =3D acpm_channels_init(acpm); if (ret) return ret; =20 + ret =3D acpm_debugfs_register(acpm); + if (ret) + return ret; + acpm_setup_ops(acpm); =20 platform_set_drvdata(pdev, acpm); @@ -590,6 +598,11 @@ static int acpm_probe(struct platform_device *pdev) return 0; } =20 +static void acpm_remove(struct platform_device *pdev) +{ + acpm_debugfs_remove(); +} + /** * acpm_handle_put() - release the handle acquired by acpm_get_by_phandle. * @handle: Handle acquired by acpm_get_by_phandle. @@ -698,6 +711,7 @@ const struct acpm_handle *devm_acpm_get_by_phandle(stru= ct device *dev, =20 static const struct acpm_match_data acpm_gs101 =3D { .initdata_base =3D ACPM_GS101_INITDATA_BASE, + .mbox_dbg_chan =3D ACPM_GS101_MBOX_DBG_CHAN, }; =20 static const struct of_device_id acpm_match[] =3D { @@ -711,6 +725,7 @@ MODULE_DEVICE_TABLE(of, acpm_match); =20 static struct platform_driver acpm_driver =3D { .probe =3D acpm_probe, + .remove =3D acpm_remove, .driver =3D { .name =3D "exynos-acpm-protocol", .of_match_table =3D acpm_match, diff --git a/drivers/firmware/samsung/exynos-acpm.h b/drivers/firmware/sams= ung/exynos-acpm.h index c212fe28758a..d22ffada29a6 100644 --- a/drivers/firmware/samsung/exynos-acpm.h +++ b/drivers/firmware/samsung/exynos-acpm.h @@ -19,12 +19,36 @@ * @chans: offset to array of struct acpm_chan_shmem. * @reserved1: unused fields. * @num_chans: number of channels. + * @reserved2: unused fields. + * @log_rear: rear pointer of APM log queue. + * @log_front: front pointer of APM log queue. + * @log_base: base address of APM log queue. + * @log_mlen: log message length. + * @log_qlen: log queue length. + * @reserved3: unused fields. + * @preempt_log_rear: rear pointer of APM preempt log queue. + * @preempt_log_front: front pointer of APM preempt log queue. + * @preempt_log_base: base address of APM preempt log queue. + * @preempt_log_qlen: preempt log queue length. + * @reserved4: unused fields. */ struct acpm_shmem { u32 reserved[2]; u32 chans; u32 reserved1[3]; u32 num_chans; + u32 reserved2[6]; + u32 log_rear; + u32 log_front; + u32 log_base; + u32 log_mlen; + u32 log_qlen; + u32 reserved3[24]; + u32 preempt_log_rear; + u32 preempt_log_front; + u32 preempt_log_base; + u32 preempt_log_qlen; + u32 reserved4[64]; }; =20 /** @@ -41,23 +65,36 @@ struct acpm_queue { =20 struct device; struct acpm_chan; +struct acpm_log_info; =20 /** * struct acpm_info - driver's private data. * @shmem: pointer to the SRAM configuration data. * @sram_base: base address of SRAM. + * @log: pointer to the ACPM logging info. * @chans: pointer to the ACPM channel parameters retrieved from SRAM. * @dev: pointer to the exynos-acpm device. * @handle: instance of acpm_handle to send to clients. + * @mbox_dbg_chan: mailbox debug channel. * @num_chans: number of channels available for this controller. */ struct acpm_info { struct acpm_shmem __iomem *shmem; void __iomem *sram_base; + struct acpm_log_info *log; struct acpm_chan *chans; struct device *dev; struct acpm_handle handle; + unsigned int mbox_dbg_chan; u32 num_chans; }; =20 +#ifdef CONFIG_DEBUG_FS +int acpm_debugfs_register(struct acpm_info *acpm); +void acpm_debugfs_remove(void); +#else +static inline int acpm_debugfs_register(struct acpm_info *acpm) {} +static inline void acpm_debugfs_remove(void) {} +#endif + #endif /* __EXYNOS_ACPM_H__ */ --=20 2.48.1.601.g30ceb7b040-goog