From: Akshay Gupta <akshay.gupta@amd.com>
To: <linux-kernel@vger.kernel.org>, <linux-hwmon@vger.kernel.org>
Cc: <gregkh@linuxfoundation.org>, <arnd@arndb.de>,
<linux@roeck-us.net>, <Anand.Umarji@amd.com>,
Akshay Gupta <akshay.gupta@amd.com>,
"Naveen Krishna Chatradhi" <naveenkrishna.chatradhi@amd.com>
Subject: [PATCH v1 1/5] misc: amd-sbi: Split core driver as separate module
Date: Mon, 28 Jul 2025 06:10:29 +0000 [thread overview]
Message-ID: <20250728061033.1604169-1-akshay.gupta@amd.com> (raw)
This change is in preparation for enabling SB-RMI access
over I3C along with present I2C bus.
Split the core APIs into a separate module, export those APIs
to be used by the I2C and I3C modules.
Introduce a config option in Kconfig and update Makefile accordingly.
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Signed-off-by: Akshay Gupta <akshay.gupta@amd.com>
---
drivers/misc/amd-sbi/Kconfig | 11 ++++++++++-
drivers/misc/amd-sbi/Makefile | 6 ++++--
drivers/misc/amd-sbi/rmi-core.c | 5 +++++
drivers/misc/amd-sbi/rmi-hwmon.c | 4 ++++
drivers/misc/amd-sbi/rmi-i2c.c | 1 +
5 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/drivers/misc/amd-sbi/Kconfig b/drivers/misc/amd-sbi/Kconfig
index 4840831c84ca..9b1abeb6ab1a 100644
--- a/drivers/misc/amd-sbi/Kconfig
+++ b/drivers/misc/amd-sbi/Kconfig
@@ -1,7 +1,14 @@
# SPDX-License-Identifier: GPL-2.0-only
+
+menu "AMD side band Interface(APML)"
+
+config AMD_SBRMI
+ bool
+
config AMD_SBRMI_I2C
- tristate "AMD side band RMI support"
+ tristate "AMD side band RMI support over I2C"
depends on I2C
+ select AMD_SBRMI
help
Side band RMI over I2C support for AMD out of band management.
@@ -16,3 +23,5 @@ config AMD_SBRMI_HWMON
This provides support for RMI device hardware monitoring. If enabled,
a hardware monitoring device will be created for each socket in
the system.
+
+endmenu
diff --git a/drivers/misc/amd-sbi/Makefile b/drivers/misc/amd-sbi/Makefile
index 38eaaa651fd9..6f3090fb9ff3 100644
--- a/drivers/misc/amd-sbi/Makefile
+++ b/drivers/misc/amd-sbi/Makefile
@@ -1,4 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
-sbrmi-i2c-objs += rmi-i2c.o rmi-core.o
-sbrmi-i2c-$(CONFIG_AMD_SBRMI_HWMON) += rmi-hwmon.o
+obj-$(CONFIG_AMD_SBRMI) += sbrmi_core.o
+sbrmi_core-y := rmi-core.o
+obj-$(CONFIG_AMD_SBRMI_HWMON) += rmi-hwmon.o
+sbrmi-i2c-y := rmi-i2c.o
obj-$(CONFIG_AMD_SBRMI_I2C) += sbrmi-i2c.o
diff --git a/drivers/misc/amd-sbi/rmi-core.c b/drivers/misc/amd-sbi/rmi-core.c
index 3dec2fc00124..6a7d0bb33bf8 100644
--- a/drivers/misc/amd-sbi/rmi-core.c
+++ b/drivers/misc/amd-sbi/rmi-core.c
@@ -352,6 +352,7 @@ int rmi_mailbox_xfer(struct sbrmi_data *data,
mutex_unlock(&data->lock);
return ret;
}
+EXPORT_SYMBOL_NS_GPL(rmi_mailbox_xfer, "AMD_SBRMI");
static int apml_rmi_reg_xfer(struct sbrmi_data *data,
struct apml_reg_xfer_msg __user *arg)
@@ -482,3 +483,7 @@ int create_misc_rmi_device(struct sbrmi_data *data,
return misc_register(&data->sbrmi_misc_dev);
}
+EXPORT_SYMBOL_NS_GPL(create_misc_rmi_device, "AMD_SBRMI");
+
+MODULE_DESCRIPTION("AMD SB-RMI common driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/misc/amd-sbi/rmi-hwmon.c b/drivers/misc/amd-sbi/rmi-hwmon.c
index f4f015605daa..e5d234549b5c 100644
--- a/drivers/misc/amd-sbi/rmi-hwmon.c
+++ b/drivers/misc/amd-sbi/rmi-hwmon.c
@@ -6,6 +6,7 @@
*/
#include <linux/err.h>
#include <linux/hwmon.h>
+#include <linux/module.h>
#include <uapi/misc/amd-apml.h>
#include "rmi-core.h"
@@ -118,3 +119,6 @@ int create_hwmon_sensor_device(struct device *dev, struct sbrmi_data *data)
&sbrmi_chip_info, NULL);
return PTR_ERR_OR_ZERO(hwmon_dev);
}
+EXPORT_SYMBOL(create_hwmon_sensor_device);
+
+MODULE_IMPORT_NS("AMD_SBRMI");
diff --git a/drivers/misc/amd-sbi/rmi-i2c.c b/drivers/misc/amd-sbi/rmi-i2c.c
index f891f5af4bc6..e90ab0a5f8eb 100644
--- a/drivers/misc/amd-sbi/rmi-i2c.c
+++ b/drivers/misc/amd-sbi/rmi-i2c.c
@@ -127,6 +127,7 @@ static struct i2c_driver sbrmi_driver = {
module_i2c_driver(sbrmi_driver);
+MODULE_IMPORT_NS("AMD_SBRMI");
MODULE_AUTHOR("Akshay Gupta <akshay.gupta@amd.com>");
MODULE_AUTHOR("Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>");
MODULE_DESCRIPTION("Hwmon driver for AMD SB-RMI emulated sensor");
--
2.25.1
next reply other threads:[~2025-07-28 6:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-28 6:10 Akshay Gupta [this message]
2025-07-28 6:10 ` [PATCH v1 2/5] misc: amd-sbi: Add support for SB-RMI over I3C Akshay Gupta
2025-07-28 6:37 ` Thomas Weißschuh
2025-08-11 11:02 ` Gupta, Akshay
2025-07-29 6:33 ` Krzysztof Kozlowski
2025-08-11 11:03 ` Gupta, Akshay
2025-07-28 6:10 ` [PATCH v1 3/5] dt-bindings: misc: Move amd,sbrmi.yaml from hwmon to misc Akshay Gupta
2025-07-29 6:29 ` Krzysztof Kozlowski
2025-08-11 11:54 ` Gupta, Akshay
2025-08-11 11:56 ` Krzysztof Kozlowski
2025-07-28 6:10 ` [PATCH v1 4/5] dt-bindings: misc: Update the "$id:" to misc path Akshay Gupta
2025-07-29 6:29 ` Krzysztof Kozlowski
2025-07-28 6:10 ` [PATCH v1 5/5] dt-bindings: misc: Add binding document for SB-RMI I3C Akshay Gupta
2025-07-29 6:31 ` Krzysztof Kozlowski
2025-08-11 11:55 ` Gupta, Akshay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250728061033.1604169-1-akshay.gupta@amd.com \
--to=akshay.gupta@amd.com \
--cc=Anand.Umarji@amd.com \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=naveenkrishna.chatradhi@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®