Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions Documentation/devicetree/bindings/sound/qcom,wcd9378-sdw.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/qcom,wcd9378-sdw.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Qualcomm WCD9378 (Tambora) SoundWire codec

maintainers:
- Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>

description:
Qualcomm WCD9378 (Tambora) SoundWire codec in SDCA compute mode.

properties:
compatible:
items:
- const: qcom,wcd9378c
- const: sdw20217011000

reg:
maxItems: 1

qcom,port-mapping:
description: |
Each entry maps a slave data port to a master data port.
Entries are in order starting from slave port 1; slave port 0
is reserved and not represented. Compute mode uses 8 entries
covering DP1..DP8.
$ref: /schemas/types.yaml#/definitions/uint32-array
minItems: 8
maxItems: 8

reset-gpios:
description: GPIO used to release the codec from reset.
maxItems: 1

vdd-buck-supply:
description: 1.8 V analog buck supply.

vdd-rxtx-supply:
description: 1.8 V RX/TX supply.

vdd-io-supply:
description: Digital I/O supply.

vdd-mic-bias-supply:
description: Mic bias supply.

'#sound-dai-cells':
const: 1

required:
- compatible
- reg
- qcom,port-mapping
- reset-gpios
- vdd-buck-supply
- vdd-rxtx-supply
- vdd-io-supply
- vdd-mic-bias-supply
- '#sound-dai-cells'

additionalProperties: false

examples:
- |
#include <dt-bindings/gpio/gpio.h>

soundwire@7630000 {
reg = <0x07630000 0x10000>;
#address-cells = <2>;
#size-cells = <0>;

wcd9378c_sdw: audio-codec@0,3 {
compatible = "qcom,wcd9378c", "sdw20217011000";
reg = <0 3>;

qcom,port-mapping = <2 2 3 4 5 6 7 8>;

reset-gpios = <&tlmm 191 GPIO_ACTIVE_LOW>;

vdd-buck-supply = <&vreg_l15b_1p8>;
vdd-rxtx-supply = <&vreg_l15b_1p8>;
vdd-io-supply = <&vreg_l18b_1p2>;
vdd-mic-bias-supply = <&vreg_bob1>;

#sound-dai-cells = <1>;
};
};
...
23 changes: 18 additions & 5 deletions include/sound/sdca.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,16 @@ enum sdca_quirk {
SDCA_QUIRKS_SKIP_FUNC_TYPE_PATCHING,
};

#if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SND_SOC_SDCA)
#if IS_ENABLED(CONFIG_SND_SOC_SDCA)

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

static inline void sdca_lookup_functions(struct sdw_slave *slave) {}
static inline void sdca_lookup_swft(struct sdw_slave *slave) {}
static inline void sdca_lookup_interface_revision(struct sdw_slave *slave) {}
static inline bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk)
{
return false;
Expand All @@ -88,4 +84,21 @@ static inline void sdca_dev_unregister_functions(struct sdw_slave *slave) {}

#endif

/*
* Called from the SoundWire bus during peripheral enumeration; gated on
* ACPI to avoid a soundwire_bus <-> snd_soc_sdca module cycle on DT builds
* (where the bodies are stubs anyway).
*/
#if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SND_SOC_SDCA)

void sdca_lookup_functions(struct sdw_slave *slave);
void sdca_lookup_interface_revision(struct sdw_slave *slave);

#else

static inline void sdca_lookup_functions(struct sdw_slave *slave) {}
static inline void sdca_lookup_interface_revision(struct sdw_slave *slave) {}

#endif

#endif
70 changes: 70 additions & 0 deletions include/sound/sdca_class.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* The MIPI SDCA specification is available for public downloads at
* https://www.mipi.org/mipi-sdca-v1-0-download
*
* Copyright (C) 2025 Cirrus Logic, Inc. and
* Cirrus Logic International Semiconductor Ltd.
*/

#ifndef __SDCA_CLASS_H__
#define __SDCA_CLASS_H__

#include <linux/completion.h>
#include <linux/mutex.h>
#include <linux/workqueue.h>

struct device;
struct dev_pm_ops;
struct regmap;
struct sdw_slave;
struct sdca_function_data;

/**
* struct sdca_class_ops - optional codec-provided class callbacks
* @populate_function: fill @function (entities, clusters, init_table, ...)
* from static tables in place of sdca_parse_function() on
* DT/non-DisCo platforms. Pure data source; performs no
* bus I/O. Return 0 on success or a negative errno.
*/
struct sdca_class_ops {
int (*populate_function)(struct sdw_slave *slave,
struct sdca_function_data *function);
};

struct sdca_class_drv {
struct device *dev;
struct regmap *dev_regmap;
struct sdw_slave *sdw;

struct sdca_interrupt_info *irq_info;

const struct sdca_class_ops *ops;

struct mutex regmap_lock;
/* Serialise function initialisations */
struct mutex init_lock;
struct work_struct boot_work;
};

/* Library helpers used by codec-specific SDCA SoundWire drivers. */
int sdca_class_probe(struct sdw_slave *sdw,
struct sdca_class_drv *drv,
const struct sdca_class_ops *ops);
void sdca_class_remove(struct sdca_class_drv *drv);

/*
* PM helpers. Codec drivers embed sdca_class_drv in their own priv,
* own dev_set_drvdata(), and compose these into their own dev_pm_ops:
*
* static int wcd_runtime_suspend(struct device *dev) {
* struct wcd_priv *priv = dev_get_drvdata(dev);
* return sdca_class_runtime_suspend(&priv->class);
* }
*/
int sdca_class_runtime_suspend(struct sdca_class_drv *drv);
int sdca_class_runtime_resume(struct sdca_class_drv *drv);
int sdca_class_system_suspend(struct sdca_class_drv *drv);
int sdca_class_system_resume(struct sdca_class_drv *drv);

#endif /* __SDCA_CLASS_H__ */
2 changes: 2 additions & 0 deletions include/sound/sdca_function.h
Original file line number Diff line number Diff line change
Expand Up @@ -1464,6 +1464,8 @@ static inline u32 sdca_range_search(struct sdca_control_range *range,

int sdca_parse_function(struct device *dev, struct sdca_function_data *function);

void sdca_apply_default_control_classifiers(struct sdca_function_data *function);

const char *sdca_find_terminal_name(enum sdca_terminal_type type);

struct sdca_control *sdca_selector_find_control(struct device *dev,
Expand Down
11 changes: 11 additions & 0 deletions sound/soc/codecs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2526,6 +2526,17 @@ config SND_SOC_WCD939X_SDW
The WCD9390/9395 is a audio codec IC Integrated in
Qualcomm SoCs like SM8650.

config SND_SOC_WCD9378_SDCA
tristate "Qualcomm Tambora (WCD9378) SDCA codec"
depends on SOUNDWIRE
depends on SND_SOC_SDCA_CLASS
help
This enables support for the Qualcomm Tambora (WCD9378) headset
codec when driven via the SDCA class driver on ARM platforms
without ACPI/DisCo tables. It provides the static SDCA topology
and SoundWire data port properties transcribed from the factory
ACPI tables.

config SND_SOC_WM0010
tristate
depends on SPI_MASTER
Expand Down
2 changes: 2 additions & 0 deletions sound/soc/codecs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ snd-soc-wcd938x-y := wcd938x.o
snd-soc-wcd938x-sdw-y := wcd938x-sdw.o
snd-soc-wcd939x-y := wcd939x.o
snd-soc-wcd939x-sdw-y := wcd939x-sdw.o
snd-soc-wcd9378-y := wcd9378-sdw.o wcd9378-sdca.o
snd-soc-wm-adsp-y := wm_adsp.o
snd-soc-wm-adsp-test-y := wm_adsp_fw_find_test.o
snd-soc-wm0010-y := wm0010.o
Expand Down Expand Up @@ -819,6 +820,7 @@ ifdef CONFIG_SND_SOC_WCD939X_SDW
# avoid link failure by forcing sdw code built-in when needed
obj-$(CONFIG_SND_SOC_WCD939X) += snd-soc-wcd939x-sdw.o
endif
obj-$(CONFIG_SND_SOC_WCD9378_SDCA) += snd-soc-wcd9378.o
obj-$(CONFIG_SND_SOC_WM0010) += snd-soc-wm0010.o
obj-$(CONFIG_SND_SOC_WM1250_EV1) += snd-soc-wm1250-ev1.o
obj-$(CONFIG_SND_SOC_WM2000) += snd-soc-wm2000.o
Expand Down
Loading