linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/5] misc: amd-sbi: Split core driver as separate module
@ 2025-07-28  6:10 Akshay Gupta
  2025-07-28  6:10 ` [PATCH v1 2/5] misc: amd-sbi: Add support for SB-RMI over I3C Akshay Gupta
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Akshay Gupta @ 2025-07-28  6:10 UTC (permalink / raw)
  To: linux-kernel, linux-hwmon
  Cc: gregkh, arnd, linux, Anand.Umarji, Akshay Gupta,
	Naveen Krishna Chatradhi

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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2025-08-11 11:56 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-28  6:10 [PATCH v1 1/5] misc: amd-sbi: Split core driver as separate module Akshay Gupta
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).