Skip to content

Commit 2c8b3a8

Browse files
charleskeepaxbroonie
authored andcommitted
ASoC: SDCA: Create DAPM widgets and routes from DisCo
Use the previously parsed DisCo information from ACPI to create DAPM widgets and routes representing a SDCA Function. For the most part SDCA maps well to the DAPM abstractions. The primary point of interest is the SDCA Power Domain Entities (PDEs), which actually control the power status of the device. Whilst these PDEs are the primary widgets the other parts of the SDCA graph are added to maintain a consistency with the hardware abstract, and allow routing to take effect. As for the PDEs themselves the code currently only handle PS0 and PS3 (basically on and off), the two intermediate power states are not commonly used and don't map well to ASoC/DAPM. Other minor points of slightly complexity include, the Group Entities (GEs) these set the value of several other controls, typically Selector Units (SUs) for enabling a cetain jack configuration. Multiple SUs being controlled by a GE are easily modelled creating a single control and sharing it among the controlled muxes. SDCA also has a slight habit of having fully connected paths, relying more on activating the PDEs to enable functionality. This doesn't map quite so perfectly to DAPM which considers the path a reason to power the PDE. Whilst in the current specification Mixer Units are defined as fixed-function, in DAPM we create a virtual control for each input (which defaults to connected). This allows paths to be connected/disconnected, providing a more ASoC style approach to managing the power. PIN_SWITCHs will also be added for non-dataport terminal entities in a later patch along with the other ALSA controls, providing greater flexibility in power management. A top level helper sdca_asoc_populate_component() is exported that counts and allocates everything, however, the intermediate counting and population functions are also exported. This will allow end drivers to do allocation and add custom handling, which is probably fairly likely for the early SDCA devices. Clock muxes are currently not fully supported, so some future work will also be required there. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev> Link: https://patch.msgid.link/20250516131011.221310-6-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 737379e commit 2c8b3a8

File tree

4 files changed

+911
-1
lines changed

4 files changed

+911
-1
lines changed

include/sound/sdca_asoc.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
/*
3+
* The MIPI SDCA specification is available for public downloads at
4+
* https://www.mipi.org/mipi-sdca-v1-0-download
5+
*
6+
* Copyright (C) 2025 Cirrus Logic, Inc. and
7+
* Cirrus Logic International Semiconductor Ltd.
8+
*/
9+
10+
#ifndef __SDCA_ASOC_H__
11+
#define __SDCA_ASOC_H__
12+
13+
struct device;
14+
struct sdca_function_data;
15+
struct snd_soc_component_driver;
16+
struct snd_soc_dapm_route;
17+
struct snd_soc_dapm_widget;
18+
19+
int sdca_asoc_count_component(struct device *dev, struct sdca_function_data *function,
20+
int *num_widgets, int *num_routes);
21+
22+
int sdca_asoc_populate_dapm(struct device *dev, struct sdca_function_data *function,
23+
struct snd_soc_dapm_widget *widgets,
24+
struct snd_soc_dapm_route *routes);
25+
26+
int sdca_asoc_populate_component(struct device *dev,
27+
struct sdca_function_data *function,
28+
struct snd_soc_component_driver *component_drv);
29+
30+
#endif // __SDCA_ASOC_H__

include/sound/sdca_function.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,14 @@ enum sdca_pde_controls {
257257
SDCA_CTL_PDE_ACTUAL_PS = 0x10,
258258
};
259259

260+
/**
261+
* enum sdca_requested_ps_range - Column definitions for Requested PS
262+
*/
263+
enum sdca_requested_ps_range {
264+
SDCA_REQUESTED_PS_STATE = 0,
265+
SDCA_REQUESTED_PS_NCOLS = 1,
266+
};
267+
260268
/**
261269
* enum sdca_ge_controls - SDCA Controls for Group Unit
262270
*
@@ -268,6 +276,15 @@ enum sdca_ge_controls {
268276
SDCA_CTL_GE_DETECTED_MODE = 0x02,
269277
};
270278

279+
/**
280+
* enum sdca_selected_mode_range - Column definitions for Selected Mode
281+
*/
282+
enum sdca_selected_mode_range {
283+
SDCA_SELECTED_MODE_INDEX = 0,
284+
SDCA_SELECTED_MODE_TERM_TYPE = 1,
285+
SDCA_SELECTED_MODE_NCOLS = 2,
286+
};
287+
271288
/**
272289
* enum sdca_spe_controls - SDCA Controls for Security & Privacy Unit
273290
*
@@ -773,6 +790,25 @@ enum sdca_terminal_type {
773790
SDCA_TERM_TYPE_PRIVACY_INDICATORS = 0x747,
774791
};
775792

793+
#define SDCA_TERM_TYPE_LINEIN_STEREO_NAME "LineIn Stereo"
794+
#define SDCA_TERM_TYPE_LINEIN_FRONT_LR_NAME "LineIn Front-LR"
795+
#define SDCA_TERM_TYPE_LINEIN_CENTER_LFE_NAME "LineIn Center-LFE"
796+
#define SDCA_TERM_TYPE_LINEIN_SURROUND_LR_NAME "LineIn Surround-LR"
797+
#define SDCA_TERM_TYPE_LINEIN_REAR_LR_NAME "LineIn Rear-LR"
798+
#define SDCA_TERM_TYPE_LINEOUT_STEREO_NAME "LineOut Stereo"
799+
#define SDCA_TERM_TYPE_LINEOUT_FRONT_LR_NAME "LineOut Front-LR"
800+
#define SDCA_TERM_TYPE_LINEOUT_CENTER_LFE_NAME "LineOut Center-LFE"
801+
#define SDCA_TERM_TYPE_LINEOUT_SURROUND_LR_NAME "LineOut Surround-LR"
802+
#define SDCA_TERM_TYPE_LINEOUT_REAR_LR_NAME "LineOut Rear-LR"
803+
#define SDCA_TERM_TYPE_MIC_JACK_NAME "Microphone"
804+
#define SDCA_TERM_TYPE_STEREO_JACK_NAME "Speaker Stereo"
805+
#define SDCA_TERM_TYPE_FRONT_LR_JACK_NAME "Speaker Front-LR"
806+
#define SDCA_TERM_TYPE_CENTER_LFE_JACK_NAME "Speaker Center-LFE"
807+
#define SDCA_TERM_TYPE_SURROUND_LR_JACK_NAME "Speaker Surround-LR"
808+
#define SDCA_TERM_TYPE_REAR_LR_JACK_NAME "Speaker Rear-LR"
809+
#define SDCA_TERM_TYPE_HEADPHONE_JACK_NAME "Headphone"
810+
#define SDCA_TERM_TYPE_HEADSET_JACK_NAME "Headset"
811+
776812
/**
777813
* enum sdca_connector_type - SDCA Connector Types
778814
*

sound/soc/sdca/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22

3-
snd-soc-sdca-y := sdca_functions.o sdca_device.o sdca_regmap.o
3+
snd-soc-sdca-y := sdca_functions.o sdca_device.o sdca_regmap.o sdca_asoc.o
44

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

0 commit comments

Comments
 (0)