Browse Source

soc: soundwire: update regmap support for soundwire

Update regmap support for soundwire interface. This change
adds init function to initialize soundwire register map.

Change-Id: I9a6eee5c0ca507cafdf6416a4adea4e60b714eba
Signed-off-by: Sudheer Papothi <[email protected]>
Sudheer Papothi 5 years ago
parent
commit
bb13c65f24
1 changed files with 36 additions and 1 deletions
  1. 36 1
      include/soc/soundwire.h

+ 36 - 1
include/soc/soundwire.h

@@ -7,10 +7,12 @@
 #define _LINUX_SOUNDWIRE_H
 #include <linux/device.h>
 #include <linux/mutex.h>
-#include "audio_mod_devicetable.h"
 #include <linux/irqdomain.h>
+#include <linux/regmap.h>
+#include "audio_mod_devicetable.h"
 
 extern struct bus_type soundwire_type;
+struct swr_device;
 
 /* Soundwire supports max. of 8 channels per port */
 #define SWR_MAX_CHANNEL_NUM	8
@@ -23,6 +25,39 @@ extern struct bus_type soundwire_type;
  */
 #define SWR_MAX_MSTR_PORT_NUM	(SWR_MAX_DEV_NUM * SWR_MAX_DEV_PORT_NUM)
 
+/* Regmap support for soundwire interface */
+struct regmap *__devm_regmap_init_swr(struct swr_device *dev,
+				      const struct regmap_config *config,
+				      struct lock_class_key *lock_key,
+				      const char *lock_name);
+
+/**
+ * regmap_init_swr(): Initialise register map
+ *
+ * @swr: Device that will be interacted with
+ * @config: Configuration for register map
+ *
+ * The return value will be an ERR_PTR() on error or a valid pointer to
+ * a struct regmap.
+ */
+#define regmap_init_swr(swr, config)					\
+	__regmap_lockdep_wrapper(__regmap_init_swr, #config,		\
+				swr, config)
+
+/**
+ * devm_regmap_init_swr(): Initialise managed register map
+ *
+ * @swr: Device that will be interacted with
+ * @config: Configuration for register map
+ *
+ * The return value will be an ERR_PTR() on error or a valid pointer
+ * to a struct regmap.  The regmap will be automatically freed by the
+ * device management code.
+ */
+#define devm_regmap_init_swr(swr, config)                              \
+	__regmap_lockdep_wrapper(__devm_regmap_init_swr, #config,       \
+				swr, config)
+
 /* Indicates soundwire devices group information */
 enum {
 	SWR_GROUP_NONE = 0,