Add support for cs42l45 into the Intel machine driver
Subsystems (5)
Charles Keepax
maintainercover Add support for cs42l45 into the Intel machine driver
Now that the full class driver is in place we can add support to the Intel machine driver for Cirrus's new SDCA audio CODEC the cs42l45. This makes some minor tweaks to the machine driver itself to support SDCA devices, and then adds the necessary tables etc. to define the device.
Note, this series shouldn't have any dependencies on the other series of improvements to the class driver that is already on the list. So either can be merged first.
Thanks,
Charles
Charles Keepax (7):
ASoC: SDCA: Align mute controls to ALSA expectations
ASoC: SDCA: Add terminal type into input/output widget name
ASoC: sdw_utils: Add codec_conf for every DAI
ASoC: sdw_utils: Move codec_name to dai info
ASoC: intel: sof_sdw: Add ability to have auxiliary devices
ASoC: sdw_utils: Add cs42l45 support functions
ASoC: intel: sof_sdw: Add codec_info for cs42l45
include/sound/sdca_function.h | 4 +- include/sound/soc_sdw_utils.h | 17 ++++- sound/soc/amd/acp/acp-sdw-legacy-mach.c | 19 +++-- sound/soc/amd/acp/acp-sdw-sof-mach.c | 12 +++- sound/soc/intel/boards/sof_sdw.c | 21 ++++-- sound/soc/sdca/sdca_asoc.c | 51 ++----------- sound/soc/sdca/sdca_functions.c | 56 ++++++++++++++- sound/soc/sdw_utils/Makefile | 1 + sound/soc/sdw_utils/soc_sdw_cs42l45.c | 80 +++++++++++++++++++++ sound/soc/sdw_utils/soc_sdw_utils.c | 95 +++++++++++++++++++------ 10 files changed, 275 insertions(+), 81 deletions(-) create mode 100644 sound/soc/sdw_utils/soc_sdw_cs42l45.c
Signature · 1 line
2.47.3
Charles Keepax
maintainerPATCH 1/7 ASoC: SDCA: Align mute controls to ALSA expectations
Currently mute controls will be called "FU xx Mute Switch" (note the switch is added programmatically outside the coverage of this patch) and the accompanying volume control would be called "FU xx Channel Volume". These names are taken from the SDCA specification, however, this does not mesh well with the ALSA naming system. ALSA generally expects enables rather than mutes and expects that mutes and volumes have matching names.
Update the names and invert the mute controls to make them more standard "FU XX Channel Switch", this does slightly deviate from the SDCA specification but it makes the rest of the Linux ecosystem a lot happier.
--- include/sound/sdca_function.h | 2 +- sound/soc/sdca/sdca_asoc.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)
include/sound/sdca_function.h +1 -1
@@ -611,7 +611,7 @@ enum sdca_entity0_controls {#define SDCA_CTL_NDAI_PACKETTYPE_NAME "NDAI Packet Type"#define SDCA_CTL_MIXER_NAME "Mixer"#define SDCA_CTL_SELECTOR_NAME "Selector" -#define SDCA_CTL_MUTE_NAME "Mute" +#define SDCA_CTL_MUTE_NAME "Channel"#define SDCA_CTL_CHANNEL_VOLUME_NAME "Channel Volume"#define SDCA_CTL_AGC_NAME "AGC"#define SDCA_CTL_BASS_BOOST_NAME "Bass Boost"
sound/soc/sdca/sdca_asoc.c +3 -0
@@ -886,6 +886,9 @@ static int populate_control(struct device *dev, mc->min =0 ; mc->max =clamp ((0x1ull << control->nbits) -1 ,0 ,type_max (mc->max)); +if (SDCA_CTL_TYPE (entity->type, control->sel) ==SDCA_CTL_TYPE_S (FU ,MUTE )) + mc->invert = true; + (*kctl)->name = control_name; (*kctl)->private_value = (unsigned long )mc; (*kctl)->iface =SNDRV_CTL_ELEM_IFACE_MIXER ;
Signature · 1 line
2.47.3
Mark Brown
maintainerRe: [PATCH 1/7] ASoC: SDCA: Align mute controls to ALSA expectations
Quoted 4 lines · Charles Keepax
Update the names and invert the mute controls to make them more standard "FU XX Channel Switch", this does slightly deviate from the SDCA specification but it makes the rest of the Linux ecosystem a lot happier.
And there was me thinking you were going to address the FU bit. :)
Quoted 37 lines
Signed-off-by Charles Keepax <[email protected]>--- include/sound/sdca_function.h | 2 +- sound/soc/sdca/sdca_asoc.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)include/sound/sdca_function.h +1
-1@@ -611,7 +611,7 @@ enum sdca_entity0_controls {#define SDCA_CTL_NDAI_PACKETTYPE_NAME "NDAI Packet Type"#define SDCA_CTL_MIXER_NAME "Mixer"#define SDCA_CTL_SELECTOR_NAME "Selector" -#define SDCA_CTL_MUTE_NAME "Mute" +#define SDCA_CTL_MUTE_NAME "Channel"#define SDCA_CTL_CHANNEL_VOLUME_NAME "Channel Volume"#define SDCA_CTL_AGC_NAME "AGC"#define SDCA_CTL_BASS_BOOST_NAME "Bass Boost"sound/soc/sdca/sdca_asoc.c +3
-0@@ -886,6 +886,9 @@ static int populate_control(struct device *dev, mc->min =0 ; mc->max =clamp ((0x1ull << control->nbits) -1 ,0 ,type_max (mc->max)); +if (SDCA_CTL_TYPE (entity->type, control->sel) ==SDCA_CTL_TYPE_S (FU ,MUTE )) + mc->invert = true; + (*kctl)->name = control_name; (*kctl)->private_value = (unsigned long )mc; (*kctl)->iface =SNDRV_CTL_ELEM_IFACE_MIXER ;Signature · 1 line
2.47.3
Charles Keepax
maintainerRe: [PATCH 1/7] ASoC: SDCA: Align mute controls to ALSA expectations
Quoted 8 lines · Mark Brown
Quoted 4 lines · Charles Keepax
Update the names and invert the mute controls to make them more standard "FU XX Channel Switch", this does slightly deviate from the SDCA specification but it makes the rest of the Linux ecosystem a lot happier.
And there was me thinking you were going to address the FU bit. :)
Lol, yes it's a spectacular choice isn't it, I mean it just screams Functional Unit.
Thanks,
Charles
Charles Keepax
maintainerPATCH 2/7 ASoC: SDCA: Add terminal type into input/output widget name
In reply to Charles KeepaxThere have been some complaints around the UCM files for SDCA devices that the control system is quite hard to follow. This is definitely true without the specification handy the naming can be a little cryptic. However, as most of the information is parsed from DisCo there are some limits to what the driver can safely do to improve this.
However, one area that can be improved is the non-streaming input/output terminals. These have a field (enum sdca_terminal_type) that describes the usage of that terminal. These types can be appended to the entity name to give the users a better clue as to the purpose. For example "OT 43", would now become "OT 43 Headphone". This would follow through into the jack controls which would change from "OT 43 Jack" to "OT 43 Headphone Jack", making the purpose much more obvious to the user.
This provides slightly more readable controls without relying on implicit knowledge that individual parts might not conform to.
--- include/sound/sdca_function.h | 2 ++ sound/soc/sdca/sdca_asoc.c | 48 ++-------------------------- sound/soc/sdca/sdca_functions.c | 56 ++++++++++++++++++++++++++++++++- 3 files changed, 59 insertions(+), 47 deletions(-)
include/sound/sdca_function.h +2 -0
@@ -1456,6 +1456,8 @@ int sdca_parse_function(struct device *dev, struct sdw_slave *sdw,struct sdca_function_desc *desc, 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,struct sdca_entity *entity,const int sel);
sound/soc/sdca/sdca_asoc.c +2 -46
66 lines not on this page · raw message
sound/soc/sdca/sdca_functions.c +55 -1
80 lines not on this page · raw message
Signature · 1 line
2.47.3
Charles Keepax
maintainerPATCH 3/7 ASoC: sdw_utils: Add codec_conf for every DAI
In reply to Charles KeepaxThe assumption so far is that all the DAI links for a given audio part would be on the same device. However, as SDCA implements each audio function on a separate auxiliary driver this will no longer be true. This means it is necessary to add additional codec_conf structures to get the prefix for an audio part to apply to all the auxiliary drivers that make up that part.
--- sound/soc/amd/acp/acp-sdw-legacy-mach.c | 9 ++++++--- sound/soc/intel/boards/sof_sdw.c | 9 ++++++--- sound/soc/sdw_utils/soc_sdw_utils.c | 19 ++++++++++--------- 3 files changed, 22 insertions(+), 15 deletions(-)
sound/soc/amd/acp/acp-sdw-legacy-mach.c +6 -3
@@ -364,6 +364,7 @@ static int soc_card_dai_links_create(struct snd_soc_card *card)struct snd_soc_dai_link *dai_links;int num_devs =0 ;int num_ends =0 ; +int num_confs;int num_links;int be_id =0 ;int ret;
@@ -374,6 +375,8 @@ static int soc_card_dai_links_create(struct snd_soc_card *card)return ret; } + num_confs = num_ends; +/* One per DAI link, worst case is a DAI link for every endpoint */ soc_dais =kcalloc (num_ends,sizeof (*soc_dais),GFP_KERNEL );if (!soc_dais)
@@ -384,7 +387,7 @@ static int soc_card_dai_links_create(struct snd_soc_card *card)if (!soc_ends)return -ENOMEM ; - ret =asoc_sdw_parse_sdw_endpoints (card, soc_dais, soc_ends, &num_devs); + ret =asoc_sdw_parse_sdw_endpoints (card, soc_dais, soc_ends, &num_confs);if (ret <0 )return ret;
@@ -396,7 +399,7 @@ static int soc_card_dai_links_create(struct snd_soc_card *card)dev_dbg (dev,"sdw %d, dmic %d" , sdw_be_num, dmic_num); - codec_conf =devm_kcalloc (dev, num_devs,sizeof (*codec_conf),GFP_KERNEL ); + codec_conf =devm_kcalloc (dev, num_confs,sizeof (*codec_conf),GFP_KERNEL );if (!codec_conf)return -ENOMEM ;
@@ -407,7 +410,7 @@ static int soc_card_dai_links_create(struct snd_soc_card *card)return -ENOMEM ; card->codec_conf = codec_conf; - card->num_configs = num_devs; + card->num_configs = num_confs; card->dai_link = dai_links; card->num_links = num_links;
sound/soc/intel/boards/sof_sdw.c +6 -3
@@ -1191,6 +1191,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)struct asoc_sdw_dailink *sof_dais;int num_devs =0 ;int num_ends =0 ; +int num_confs;struct snd_soc_dai_link *dai_links;int num_links;int be_id =0 ;
@@ -1204,6 +1205,8 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)return ret; } + num_confs = num_ends; +/* * One per DAI link, worst case is a DAI link for every endpoint, also * add one additional to act as a terminator such that code can iterate
@@ -1220,7 +1223,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) goto err_dai; } - ret =asoc_sdw_parse_sdw_endpoints (card, sof_dais, sof_ends, &num_devs); + ret =asoc_sdw_parse_sdw_endpoints (card, sof_dais, sof_ends, &num_confs);if (ret <0 ) goto err_end;
@@ -1268,7 +1271,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) sdw_be_num, ssp_num, dmic_num, intel_ctx->hdmi.idisp_codec ? hdmi_num : 0, bt_num); - codec_conf =devm_kcalloc (dev, num_devs,sizeof (*codec_conf),GFP_KERNEL ); + codec_conf =devm_kcalloc (dev, num_confs,sizeof (*codec_conf),GFP_KERNEL );if (!codec_conf) { ret = -ENOMEM ; goto err_end;
@@ -1283,7 +1286,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) } card->codec_conf = codec_conf; - card->num_configs = num_devs; + card->num_configs = num_confs; card->dai_link = dai_links; card->num_links = num_links;
sound/soc/sdw_utils/soc_sdw_utils.c +10 -9
@@ -1442,15 +1442,6 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card, ctx->ignore_internal_dmic |= codec_info->ignore_internal_dmic; - codec_name =asoc_sdw_get_codec_name (dev, codec_info, adr_link, i); -if (!codec_name) -return -ENOMEM ; - -dev_dbg (dev,"Adding prefix %s for %s\n" , - adr_dev->name_prefix, codec_name); - - soc_end->name_prefix = adr_dev->name_prefix; -if (codec_info->count_sidecar && codec_info->add_sidecar) { ret = codec_info->count_sidecar (card, &num_dais, num_devs);if (ret)
@@ -1538,6 +1529,16 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card, num_link_dailinks += !!list_empty (&soc_dai->endpoints);list_add_tail (&soc_end->list, &soc_dai->endpoints); + codec_name =asoc_sdw_get_codec_name (dev, codec_info, + adr_link, i); +if (!codec_name) +return -ENOMEM ; + +dev_dbg (dev,"Adding prefix %s for %s\n" , + adr_dev->name_prefix, codec_name); + + soc_end->name_prefix = adr_dev->name_prefix; + soc_end->link_mask = adr_link->mask; soc_end->codec_name = codec_name; soc_end->codec_info = codec_info;
Signature · 1 line
2.47.3
Charles Keepax
maintainerPATCH 4/7 ASoC: sdw_utils: Move codec_name to dai info
In reply to Charles KeepaxAs SDCA devices will support each DAI link on a different child device, move the codec name from codec_info to each dai_info. To allow the appropriate function device to be bound to each DAI link.
--- include/sound/soc_sdw_utils.h | 4 ++-- sound/soc/sdw_utils/soc_sdw_utils.c | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-)
include/sound/soc_sdw_utils.h +2 -2
@@ -45,6 +45,7 @@ struct asoc_sdw_codec_info;struct asoc_sdw_dai_info {const bool direction[2 ];/* playback & capture support */ +const char *codec_name;const char *dai_name;const char *component_name;const int dai_type;
@@ -67,7 +68,6 @@ struct asoc_sdw_dai_info {struct asoc_sdw_codec_info {const int part_id;const int version_id; -const char *codec_name;const char *name_prefix;int amp_num;const u8 acpi_id[ACPI_ID_LEN ];
@@ -131,7 +131,7 @@ int asoc_sdw_hw_free(struct snd_pcm_substream *substream);void asoc_sdw_shutdown (struct snd_pcm_substream *substream);const char *asoc_sdw_get_codec_name (struct device *dev, -const struct asoc_sdw_codec_info *codec_info, +const struct asoc_sdw_dai_info *dai_info,const struct snd_soc_acpi_link_adr *adr_link,int adr_index);
sound/soc/sdw_utils/soc_sdw_utils.c +10 -9
@@ -656,12 +656,12 @@ struct asoc_sdw_codec_info codec_info_list[] = { { .part_id = 0x4243, .name_prefix = "cs42l43", - .codec_name = "cs42l43-codec", .count_sidecar = asoc_sdw_bridge_cs35l56_count_sidecar, .add_sidecar = asoc_sdw_bridge_cs35l56_add_sidecar, .dais = { { .direction = {true, false}, + .codec_name = "cs42l43-codec", .dai_name = "cs42l43-dp5", .dai_type = SOC_SDW_DAI_TYPE_JACK, .dailink = {SOC_SDW_JACK_OUT_DAI_ID, SOC_SDW_UNUSED_DAI_ID},
@@ -673,6 +673,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .direction = {false, true}, + .codec_name = "cs42l43-codec", .dai_name = "cs42l43-dp1", .dai_type = SOC_SDW_DAI_TYPE_MIC, .dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_DMIC_DAI_ID},
@@ -684,12 +685,14 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .direction = {false, true}, + .codec_name = "cs42l43-codec", .dai_name = "cs42l43-dp2", .dai_type = SOC_SDW_DAI_TYPE_JACK, .dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_JACK_IN_DAI_ID}, }, { .direction = {true, false}, + .codec_name = "cs42l43-codec", .dai_name = "cs42l43-dp6", .dai_type = SOC_SDW_DAI_TYPE_AMP, .dailink = {SOC_SDW_AMP_OUT_DAI_ID, SOC_SDW_UNUSED_DAI_ID},
@@ -1094,7 +1097,6 @@ static bool asoc_sdw_is_unique_device(const struct snd_soc_acpi_link_adr *adr_li }static const char *_asoc_sdw_get_codec_name (struct device *dev, -const struct asoc_sdw_codec_info *codec_info,const struct snd_soc_acpi_link_adr *adr_link,int adr_index) {
@@ -1116,14 +1118,14 @@ static const char *_asoc_sdw_get_codec_name(struct device *dev, }const char *asoc_sdw_get_codec_name (struct device *dev, -const struct asoc_sdw_codec_info *codec_info, +const struct asoc_sdw_dai_info *dai_info,const struct snd_soc_acpi_link_adr *adr_link,int adr_index) { -if (codec_info->codec_name) -return devm_kstrdup (dev, codec_info->codec_name,GFP_KERNEL ); +if (dai_info->codec_name) +return devm_kstrdup (dev, dai_info->codec_name,GFP_KERNEL ); -return _asoc_sdw_get_codec_name (dev, codec_info, adr_link, adr_index); +return _asoc_sdw_get_codec_name (dev, adr_link, adr_index); }EXPORT_SYMBOL_NS (asoc_sdw_get_codec_name,"SND_SOC_SDW_UTILS" );
@@ -1354,8 +1356,7 @@ static int is_sdca_endpoint_present(struct device *dev, }kfree (dlc); - sdw_codec_name =_asoc_sdw_get_codec_name (dev, codec_info, - adr_link, adr_index); + sdw_codec_name =_asoc_sdw_get_codec_name (dev, adr_link, adr_index);if (!sdw_codec_name)return -ENOMEM ;
@@ -1529,7 +1530,7 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card, num_link_dailinks += !!list_empty (&soc_dai->endpoints);list_add_tail (&soc_end->list, &soc_dai->endpoints); - codec_name =asoc_sdw_get_codec_name (dev, codec_info, + codec_name =asoc_sdw_get_codec_name (dev, dai_info, adr_link, i);if (!codec_name)return -ENOMEM ;
Signature · 1 line
2.47.3
Charles Keepax
maintainerPATCH 5/7 ASoC: intel: sof_sdw: Add ability to have auxiliary devices
In reply to Charles KeepaxCurrently the sof_sdw machine driver assumes that all devices involved in the sound card are connected through a DAI link. However for SDCA devices we still want the HID (Human Interface Device, used for jack buttons) to be part of the sound card, but it contains no DAI links.
Add support into the machine driver to specify a list of auxiliary devices to merged into the card.
--- include/sound/soc_sdw_utils.h | 11 ++++++++++- sound/soc/amd/acp/acp-sdw-legacy-mach.c | 12 ++++++++++-- sound/soc/amd/acp/acp-sdw-sof-mach.c | 12 ++++++++++-- sound/soc/intel/boards/sof_sdw.c | 14 ++++++++++++-- sound/soc/sdw_utils/soc_sdw_utils.c | 23 ++++++++++++++++++++--- 5 files changed, 62 insertions(+), 10 deletions(-)
include/sound/soc_sdw_utils.h +10 -1
@@ -13,6 +13,7 @@#include <sound/soc-acpi.h> #define SOC_SDW_MAX_DAI_NUM 8 +#define SOC_SDW_MAX_AUX_NUM 2#define SOC_SDW_MAX_NO_PROPS 2#define SOC_SDW_JACK_JDSRC (quirk) ((quirk) & GENMASK(3, 0))
@@ -65,6 +66,10 @@ struct asoc_sdw_dai_info {bool quirk_exclude; }; +struct asoc_sdw_aux_info { +const char *codec_name; +}; +struct asoc_sdw_codec_info {const int part_id;const int version_id;
@@ -75,6 +80,8 @@ struct asoc_sdw_codec_info {const struct snd_soc_ops *ops;struct asoc_sdw_dai_info dais[SOC_SDW_MAX_DAI_NUM ];const int dai_num; +struct asoc_sdw_aux_info auxs[SOC_SDW_MAX_AUX_NUM ]; +const int aux_num;int (*codec_card_late_probe)(struct snd_soc_card *card);
@@ -165,13 +172,15 @@ int asoc_sdw_init_simple_dai_link(struct device *dev, struct snd_soc_dai_link *d int no_pcm, int (*init)(struct snd_soc_pcm_runtime *rtd), const struct snd_soc_ops *ops); -int asoc_sdw_count_sdw_endpoints (struct snd_soc_card *card,int *num_devs,int *num_ends); +int asoc_sdw_count_sdw_endpoints (struct snd_soc_card *card, +int *num_devs,int *num_ends,int *num_aux);struct asoc_sdw_dailink *asoc_sdw_find_dailink (struct asoc_sdw_dailink *dailinks,const struct snd_soc_acpi_endpoint *new);int asoc_sdw_get_dai_type (u32 type);int asoc_sdw_parse_sdw_endpoints (struct snd_soc_card *card, +struct snd_soc_aux_dev *soc_aux,struct asoc_sdw_dailink *soc_dais,struct asoc_sdw_endpoint *soc_ends,int *num_devs);
sound/soc/amd/acp/acp-sdw-legacy-mach.c +10 -2
@@ -360,16 +360,18 @@ static int soc_card_dai_links_create(struct snd_soc_card *card)struct snd_soc_acpi_mach_params *mach_params = &mach->mach_params; struct asoc_sdw_endpoint *soc_ends __free(kfree) = NULL; struct asoc_sdw_dailink *soc_dais __free(kfree) = NULL; +struct snd_soc_aux_dev *soc_aux;struct snd_soc_codec_conf *codec_conf;struct snd_soc_dai_link *dai_links;int num_devs =0 ;int num_ends =0 ; +int num_aux =0 ;int num_confs;int num_links;int be_id =0 ;int ret; - ret =asoc_sdw_count_sdw_endpoints (card, &num_devs, &num_ends); + ret =asoc_sdw_count_sdw_endpoints (card, &num_devs, &num_ends, &num_aux);if (ret <0 ) {dev_err (dev,"failed to count devices/endpoints: %d\n" , ret);return ret;
@@ -387,7 +389,11 @@ static int soc_card_dai_links_create(struct snd_soc_card *card)if (!soc_ends)return -ENOMEM ; - ret =asoc_sdw_parse_sdw_endpoints (card, soc_dais, soc_ends, &num_confs); + soc_aux =devm_kcalloc (dev, num_aux,sizeof (*soc_aux),GFP_KERNEL ); +if (!soc_aux) +return -ENOMEM ; + + ret =asoc_sdw_parse_sdw_endpoints (card, soc_aux, soc_dais, soc_ends, &num_confs);if (ret <0 )return ret;
@@ -413,6 +419,8 @@ static int soc_card_dai_links_create(struct snd_soc_card *card) card->num_configs = num_confs; card->dai_link = dai_links; card->num_links = num_links; + card->aux_dev = soc_aux; + card->num_aux_devs = num_aux;/* SDW */ if (sdw_be_num) {
sound/soc/amd/acp/acp-sdw-sof-mach.c +10 -2
@@ -272,15 +272,17 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)struct snd_soc_acpi_mach_params *mach_params = &mach->mach_params; struct asoc_sdw_endpoint *sof_ends __free(kfree) = NULL; struct asoc_sdw_dailink *sof_dais __free(kfree) = NULL; +struct snd_soc_aux_dev *sof_aux;struct snd_soc_codec_conf *codec_conf;struct snd_soc_dai_link *dai_links;int num_devs =0 ;int num_ends =0 ; +int num_aux =0 ;int num_links;int be_id =0 ;int ret; - ret =asoc_sdw_count_sdw_endpoints (card, &num_devs, &num_ends); + ret =asoc_sdw_count_sdw_endpoints (card, &num_devs, &num_ends, &num_aux);if (ret <0 ) {dev_err (dev,"failed to count devices/endpoints: %d\n" , ret);return ret;
@@ -296,7 +298,11 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)if (!sof_ends)return -ENOMEM ; - ret =asoc_sdw_parse_sdw_endpoints (card, sof_dais, sof_ends, &num_devs); + sof_aux =devm_kcalloc (dev, num_aux,sizeof (*sof_aux),GFP_KERNEL ); +if (!sof_aux) +return -ENOMEM ; + + ret =asoc_sdw_parse_sdw_endpoints (card, sof_aux, sof_dais, sof_ends, &num_devs);if (ret <0 )return ret;
@@ -322,6 +328,8 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) card->num_configs = num_devs; card->dai_link = dai_links; card->num_links = num_links; + card->aux_dev = sof_aux; + card->num_aux_devs = num_aux;/* SDW */ if (sdw_be_num) {
sound/soc/intel/boards/sof_sdw.c +12 -2
@@ -1189,8 +1189,10 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)struct asoc_sdw_codec_info *ssp_info;struct asoc_sdw_endpoint *sof_ends;struct asoc_sdw_dailink *sof_dais; +struct snd_soc_aux_dev *sof_aux;int num_devs =0 ;int num_ends =0 ; +int num_aux =0 ;int num_confs;struct snd_soc_dai_link *dai_links;int num_links;
@@ -1199,7 +1201,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)unsigned long ssp_mask;int ret; - ret =asoc_sdw_count_sdw_endpoints (card, &num_devs, &num_ends); + ret =asoc_sdw_count_sdw_endpoints (card, &num_devs, &num_ends, &num_aux);if (ret <0 ) {dev_err (dev,"failed to count devices/endpoints: %d\n" , ret);return ret;
@@ -1223,7 +1225,13 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) goto err_dai; } - ret =asoc_sdw_parse_sdw_endpoints (card, sof_dais, sof_ends, &num_confs); + sof_aux =devm_kcalloc (dev, num_aux,sizeof (*sof_aux),GFP_KERNEL ); +if (!sof_aux) { + ret = -ENOMEM ; + goto err_dai; + } + + ret =asoc_sdw_parse_sdw_endpoints (card, sof_aux, sof_dais, sof_ends, &num_confs);if (ret <0 ) goto err_end;
@@ -1289,6 +1297,8 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) card->num_configs = num_confs; card->dai_link = dai_links; card->num_links = num_links; + card->aux_dev = sof_aux; + card->num_aux_devs = num_aux;/* SDW */ if (sdw_be_num) {
sound/soc/sdw_utils/soc_sdw_utils.c +20 -3
@@ -1252,7 +1252,8 @@ int asoc_sdw_init_simple_dai_link(struct device *dev, struct snd_soc_dai_link *d }EXPORT_SYMBOL_NS (asoc_sdw_init_simple_dai_link,"SND_SOC_SDW_UTILS" ); -int asoc_sdw_count_sdw_endpoints (struct snd_soc_card *card,int *num_devs,int *num_ends) +int asoc_sdw_count_sdw_endpoints (struct snd_soc_card *card, +int *num_devs,int *num_ends,int *num_aux) {struct device *dev = card->dev;struct snd_soc_acpi_mach *mach =dev_get_platdata (dev);
@@ -1263,8 +1264,18 @@ int asoc_sdw_count_sdw_endpoints(struct snd_soc_card *card, int *num_devs, int *for (adr_link = mach_params->links; adr_link->num_adr; adr_link++) { *num_devs += adr_link->num_adr; -for (i =0 ; i < adr_link->num_adr; i++) - *num_ends += adr_link->adr_d[i].num_endpoints; +for (i =0 ; i < adr_link->num_adr; i++) { +const struct snd_soc_acpi_adr_device *adr_dev = &adr_link->adr_d[i]; +struct asoc_sdw_codec_info *codec_info; + + *num_ends += adr_dev->num_endpoints; + + codec_info =asoc_sdw_find_codec_info_part (adr_dev->adr); +if (!codec_info) +return -EINVAL ; + + *num_aux += codec_info->aux_num; + } }dev_dbg (dev,"Found %d devices with %d endpoints\n" , *num_devs, *num_ends);
@@ -1402,6 +1413,7 @@ static int is_sdca_endpoint_present(struct device *dev, }int asoc_sdw_parse_sdw_endpoints (struct snd_soc_card *card, +struct snd_soc_aux_dev *soc_aux,struct asoc_sdw_dailink *soc_dais,struct asoc_sdw_endpoint *soc_ends,int *num_devs)
@@ -1441,6 +1453,11 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card,if (!codec_info)return -EINVAL ; +for (j =0 ; j < codec_info->aux_num; j++) { + soc_aux->dlc.name = codec_info->auxs[j].codec_name; + soc_aux++; + } + ctx->ignore_internal_dmic |= codec_info->ignore_internal_dmic;if (codec_info->count_sidecar && codec_info->add_sidecar) {
Signature · 1 line
2.47.3
Charles Keepax
maintainerPATCH 6/7 ASoC: sdw_utils: Add cs42l45 support functions
In reply to Charles KeepaxAdd the helper functions into the machine driver for the cs42l45, this will register a jack for jack detection and add things into to the components string if they are needed.
--- include/sound/soc_sdw_utils.h | 2 + sound/soc/sdw_utils/Makefile | 1 + sound/soc/sdw_utils/soc_sdw_cs42l45.c | 80 +++++++++++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 sound/soc/sdw_utils/soc_sdw_cs42l45.c
include/sound/soc_sdw_utils.h +2 -0
@@ -257,6 +257,8 @@ int asoc_sdw_cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_daint asoc_sdw_cs42l43_hs_rtd_init (struct snd_soc_pcm_runtime *rtd,struct snd_soc_dai *dai);int asoc_sdw_cs42l43_spk_rtd_init (struct snd_soc_pcm_runtime *rtd,struct snd_soc_dai *dai);int asoc_sdw_cs42l43_dmic_rtd_init (struct snd_soc_pcm_runtime *rtd,struct snd_soc_dai *dai); +int asoc_sdw_cs42l45_hs_rtd_init (struct snd_soc_pcm_runtime *rtd,struct snd_soc_dai *dai); +int asoc_sdw_cs42l45_dmic_rtd_init (struct snd_soc_pcm_runtime *rtd,struct snd_soc_dai *dai);int asoc_sdw_cs_spk_rtd_init (struct snd_soc_pcm_runtime *rtd,struct snd_soc_dai *dai);int asoc_sdw_maxim_spk_rtd_init (struct snd_soc_pcm_runtime *rtd,struct snd_soc_dai *dai);/* TI */
sound/soc/sdw_utils/Makefile +1 -0
@@ -5,6 +5,7 @@ snd-soc-sdw-utils-y := soc_sdw_utils.o soc_sdw_dmic.o soc_sdw_rt_dmic.o \ soc_sdw_rt_amp.o soc_sdw_rt_mf_sdca.o \ soc_sdw_bridge_cs35l56.o \ soc_sdw_cs42l42.o soc_sdw_cs42l43.o \ + soc_sdw_cs42l45.o \ soc_sdw_cs_amp.o \ soc_sdw_maxim.o \ soc_sdw_ti_amp.o
sound/soc/sdw_utils/soc_sdw_cs42l45.c new file +80 -0
80 lines not on this page · raw message
Signature · 1 line
2.47.3
Charles Keepax
maintainerPATCH 7/7 ASoC: intel: sof_sdw: Add codec_info for cs42l45
In reply to Charles KeepaxAdd support for the Cirrus Logic CS42L45 standalone using SoundWire.
--- sound/soc/sdw_utils/soc_sdw_utils.c | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
sound/soc/sdw_utils/soc_sdw_utils.c +36 -0
@@ -707,6 +707,42 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, .dai_num = 4, }, + { + .part_id = 0x4245, + .name_prefix = "cs42l45", + .dais = { + { + .direction = {true, false}, + .codec_name = "snd_soc_sdca.UAJ.1", + .dai_name = "IT 41", + .dai_type = SOC_SDW_DAI_TYPE_JACK, + .dailink = {SOC_SDW_JACK_OUT_DAI_ID, SOC_SDW_UNUSED_DAI_ID}, + .rtd_init = asoc_sdw_cs42l45_hs_rtd_init, + }, + { + .direction = {false, true}, + .codec_name = "snd_soc_sdca.SmartMic.0", + .dai_name = "OT 113", + .dai_type = SOC_SDW_DAI_TYPE_MIC, + .dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_DMIC_DAI_ID}, + .rtd_init = asoc_sdw_cs42l45_dmic_rtd_init, + }, + { + .direction = {false, true}, + .codec_name = "snd_soc_sdca.UAJ.1", + .dai_name = "OT 36", + .dai_type = SOC_SDW_DAI_TYPE_JACK, + .dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_JACK_IN_DAI_ID}, + }, + }, + .dai_num = 3, + .auxs = { + { + .codec_name = "snd_soc_sdca.HID.2", + }, + }, + .aux_num = 1, + }, { .part_id = 0xaaaa, /* generic codec mockup */ .name_prefix = "sdw_mockup_mmulti-function",
Signature · 1 line
2.47.3
Mark Brown
maintainerQuoted 10 lines · Charles Keepax
Now that the full class driver is in place we can add support to the Intel machine driver for Cirrus's new SDCA audio CODEC the cs42l45. This makes some minor tweaks to the machine driver itself to support SDCA devices, and then adds the necessary tables etc. to define the device.
Note, this series shouldn't have any dependencies on the other series of improvements to the class driver that is already on the list. So either can be merged first.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/7] ASoC: SDCA: Align mute controls to ALSA expectations
commit: 5fee9edf791a50182382fae23f30690c93e16cec
[2/7] ASoC: SDCA: Add terminal type into input/output widget name
commit: 48fa77af2f4a55ab961520f2a0e50560dc0baca8
[3/7] ASoC: sdw_utils: Add codec_conf for every DAI
commit: 26ee34d2f5c7fba968fcc2f1fd94110e1c1660db
[4/7] ASoC: sdw_utils: Move codec_name to dai info
commit: 2ae4659533d8e2b5e06e8f570e2b4b7b88ae0716
[5/7] ASoC: intel: sof_sdw: Add ability to have auxiliary devices
commit: c66297d09e1a5813eb743bae8cda4e115b8a5c56
[6/7] ASoC: sdw_utils: Add cs42l45 support functions
commit: 3f6b562f2107ab2467908fa1543e1a6ea8442bd1
[7/7] ASoC: intel: sof_sdw: Add codec_info for cs42l45
commit: 1e645bca9d1e4c5970778114d2d9fc247fe12e7bAll being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark