From: Akshay Gupta <akshay.gupta@xxxxxxx> - AMD provides socket power information from out of band which can be read by sensors. - mfd cell will probe the drivers/hwmon/sbrmi as a platform device and share the sbrmi device data. Signed-off-by: Akshay Gupta <Akshay.Gupta@xxxxxxx> Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@xxxxxxx> --- drivers/mfd/sbrmi-i2c.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/sbrmi-i2c.c b/drivers/mfd/sbrmi-i2c.c index 96215e986740..c19f0b3eb0cd 100644 --- a/drivers/mfd/sbrmi-i2c.c +++ b/drivers/mfd/sbrmi-i2c.c @@ -10,6 +10,7 @@ #include <linux/err.h> #include <linux/i2c.h> #include <linux/init.h> +#include <linux/mfd/core.h> #include <linux/mfd/amd-sb.h> #include <linux/module.h> #include <linux/mutex.h> @@ -17,6 +18,10 @@ #define SBRMI_CTRL 0x1 +static struct mfd_cell apml_sbrmi[] = { + { .name = "sbrmi-hwmon" }, +}; + static int sbrmi_enable_alert(struct i2c_client *client) { int ctrl; @@ -72,7 +77,17 @@ static int sbrmi_i2c_probe(struct i2c_client *client) return ret; /* Cache maximum power limit */ - return sbrmi_get_max_pwr_limit(data); + ret = sbrmi_get_max_pwr_limit(data); + if (ret < 0) + return ret; + + dev_set_drvdata(dev, (void *)data); + + ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, apml_sbrmi, + ARRAY_SIZE(apml_sbrmi), NULL, 0, NULL); + if (ret) + dev_err(dev, "Failed to register for sub-devices: %d\n", ret); + return ret; } static const struct i2c_device_id sbrmi_id[] = { -- 2.25.1