Unverified Commit d4a3411c authored by Mark Brown's avatar Mark Brown
Browse files

Add SDCA class driver

Merge series from Charles Keepax <ckeepax@opensource.cirrus.com>:

This series adds an initial SDCA class driver, this consists of a
primary driver attached to the SoundWire device, and auxiliary drivers
representing each of the functions of the SDCA device. These drivers all
use the APIs added over the past series's to provide the class
functionality, as such these final drivers themselves are quite thin.

Also a few fix ups at the start of the series that have gathered up
whilst the last SDCA series was in review.
parents df919994 3af1815a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -355,4 +355,6 @@
/* Check the reserved and fixed bits in address */
#define SDW_SDCA_VALID_CTL(reg) (((reg) & (GENMASK(31, 25) | BIT(18) | BIT(13))) == BIT(30))

#define SDW_SDCA_MAX_REGISTER			0x47FFFFFF

#endif /* __SDW_REGISTERS_H */
+14 −0
Original line number Diff line number Diff line
@@ -13,19 +13,23 @@
#include <linux/kconfig.h>

struct acpi_table_swft;
struct fwnode_handle;
struct sdw_slave;
struct sdca_dev;

#define SDCA_MAX_FUNCTION_COUNT 8

/**
 * struct sdca_function_desc - short descriptor for an SDCA Function
 * @node: firmware node for the Function.
 * @func_dev: pointer to SDCA function device.
 * @name: Human-readable string.
 * @type: Function topology type.
 * @adr: ACPI address (used for SDCA register access).
 */
struct sdca_function_desc {
	struct fwnode_handle *node;
	struct sdca_dev *func_dev;
	const char *name;
	u32 type;
	u8 adr;
@@ -58,6 +62,8 @@ void sdca_lookup_functions(struct sdw_slave *slave);
void sdca_lookup_swft(struct sdw_slave *slave);
void sdca_lookup_interface_revision(struct sdw_slave *slave);
bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk);
int sdca_dev_register_functions(struct sdw_slave *slave);
void sdca_dev_unregister_functions(struct sdw_slave *slave);

#else

@@ -68,6 +74,14 @@ static inline bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_qu
{
	return false;
}

static inline int sdca_dev_register_functions(struct sdw_slave *slave)
{
	return 0;
}

static inline void sdca_dev_unregister_functions(struct sdw_slave *slave) {}

#endif

#endif
+2 −0
Original line number Diff line number Diff line
@@ -27,5 +27,7 @@ int sdca_regmap_populate_constants(struct device *dev, struct sdca_function_data

int sdca_regmap_write_defaults(struct device *dev, struct regmap *regmap,
			       struct sdca_function_data *function);
int sdca_regmap_write_init(struct device *dev, struct regmap *regmap,
			   struct sdca_function_data *function);

#endif // __SDCA_REGMAP_H__
+18 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ menu "SoundWire (SDCA)"
config SND_SOC_SDCA
	tristate
	depends on ACPI
	select AUXILIARY_BUS
	help
	  This option enables support for the MIPI SoundWire Device
	  Class for Audio (SDCA).
@@ -36,4 +37,21 @@ config SND_SOC_SDCA_FDL
config SND_SOC_SDCA_OPTIONAL
	def_tristate SND_SOC_SDCA || !SND_SOC_SDCA

config SND_SOC_SDCA_CLASS
	tristate "SDCA Class Driver"
	depends on SND_SOC_SDCA
	select SND_SOC_SDCA_CLASS_FUNCTION
	select SND_SOC_SDCA_FDL
	select SND_SOC_SDCA_HID
	select SND_SOC_SDCA_IRQ
	help
	  This option enables support for the SDCA Class driver which should
	  support any class compliant SDCA part.

config SND_SOC_SDCA_CLASS_FUNCTION
	tristate
	help
	  This option enables support for the SDCA Class Function drivers,
	  these implement the individual functions of the SDCA Class driver.

endmenu
+8 −2
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only

snd-soc-sdca-y := sdca_functions.o sdca_device.o sdca_regmap.o sdca_asoc.o \
		  sdca_ump.o
snd-soc-sdca-y := sdca_functions.o sdca_device.o sdca_function_device.o \
		  sdca_regmap.o sdca_asoc.o sdca_ump.o
snd-soc-sdca-$(CONFIG_SND_SOC_SDCA_HID) += sdca_hid.o
snd-soc-sdca-$(CONFIG_SND_SOC_SDCA_IRQ) += sdca_interrupts.o
snd-soc-sdca-$(CONFIG_SND_SOC_SDCA_FDL) += sdca_fdl.o

snd-soc-sdca-class-y := sdca_class.o
snd-soc-sdca-class-function-y := sdca_class_function.o

obj-$(CONFIG_SND_SOC_SDCA) += snd-soc-sdca.o

obj-$(CONFIG_SND_SOC_SDCA_CLASS) += snd-soc-sdca-class.o
obj-$(CONFIG_SND_SOC_SDCA_CLASS_FUNCTION) += snd-soc-sdca-class-function.o
Loading