Re: [PATCH 3/6] misc: sbrmi: Use regmap subsystem

From: Gupta, Akshay
Date: Thu Jul 04 2024 - 10:27:42 EST



On 7/4/2024 5:23 PM, Greg KH wrote:
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.


On Thu, Jul 04, 2024 at 11:16:21AM +0000, Akshay Gupta wrote:
- regmap subsystem provides multiple benefits over direct smbus APIs
In what way, please document.
Answered below.

- The susbsytem can be helpful in following cases
- Differnet types of bus (i2c/i3c)
- Different Register address size (1byte/2byte)
Is that what is happening here? I don't see i3c support...

This is a preparation for

1. I3C support: planning to add support, on AMD platforms BMC can communicate with SBRMI over I2C/I3C

2. patch 6/6 in patch series, is adding support for 2 bytes SBRMI register address size

--- a/include/misc/amd-sb.h
+++ b/include/misc/amd-sb.h
@@ -7,8 +7,8 @@
#define _AMD_SB_H_

#include <linux/mutex.h>
-#include <linux/i2c.h>
Why remove this?
In this patch "struct i2c_client" is removed, so no need for the header inclusion.

#include <linux/platform_device.h>
+#include <linux/regmap.h>
/*
* SB-RMI supports soft mailbox service request to MP1 (power management
* firmware) through SBRMI inbound/outbound message registers.
@@ -23,11 +23,11 @@ enum sbrmi_msg_id {

/* Each client has this additional data */
struct sbrmi_data {
- struct i2c_client *client;
+ struct regmap *regmap;
struct mutex lock;
struct platform_device *pdev;
u32 pwr_limit_max;
-};
+} __packed;
Why is this suddenly required to be __packed?

Isn't that going to cause more problems than it is worth? And why is it
worth it at all?
I will look into this and update.

thanks,

greg k-h