From 71743cbe28cf1d1f845a30bc9664c3b6a08f0d30 Mon Sep 17 00:00:00 2001 From: Nuno Sa Date: Mon, 28 Oct 2024 16:43:40 +0100 Subject: [PATCH 01/16] ASoC: codecs: adau1373: drop patform_data struct adau1373_platform_data" was not being used by any platform. Hence, drop it and move to firmware based support. All the configurations quirks present in the platform_data are now supported as firmware properties. Signed-off-by: Nuno Sa Link: https://patch.msgid.link/20241028-adau1373-shutdown-v2-3-647f56bbd182@analog.com Signed-off-by: Mark Brown --- include/sound/adau1373.h | 33 ------- sound/soc/codecs/adau1373.c | 172 +++++++++++++++++++++++++++--------- 2 files changed, 128 insertions(+), 77 deletions(-) delete mode 100644 include/sound/adau1373.h diff --git a/include/sound/adau1373.h b/include/sound/adau1373.h deleted file mode 100644 index 4c32ba1328ed..000000000000 --- a/include/sound/adau1373.h +++ /dev/null @@ -1,33 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Analog Devices ADAU1373 Audio Codec drive - * - * Copyright 2011 Analog Devices Inc. - * Author: Lars-Peter Clausen - */ - -#ifndef __SOUND_ADAU1373_H__ -#define __SOUND_ADAU1373_H__ - -enum adau1373_micbias_voltage { - ADAU1373_MICBIAS_2_9V = 0, - ADAU1373_MICBIAS_2_2V = 1, - ADAU1373_MICBIAS_2_6V = 2, - ADAU1373_MICBIAS_1_8V = 3, -}; - -#define ADAU1373_DRC_SIZE 13 - -struct adau1373_platform_data { - bool input_differential[4]; - bool lineout_differential; - bool lineout_ground_sense; - - unsigned int num_drc; - uint8_t drc_setting[3][ADAU1373_DRC_SIZE]; - - enum adau1373_micbias_voltage micbias1; - enum adau1373_micbias_voltage micbias2; -}; - -#endif diff --git a/sound/soc/codecs/adau1373.c b/sound/soc/codecs/adau1373.c index a910e252aa12..9568ff933e12 100644 --- a/sound/soc/codecs/adau1373.c +++ b/sound/soc/codecs/adau1373.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -18,7 +19,6 @@ #include #include #include -#include #include "adau1373.h" #include "adau-utils.h" @@ -30,9 +30,28 @@ struct adau1373_dai { bool clock_provider; }; +enum adau1373_micbias_voltage { + ADAU1373_MICBIAS_2_9V, + ADAU1373_MICBIAS_2_2V, + ADAU1373_MICBIAS_2_6V, + ADAU1373_MICBIAS_1_8V, +}; + +#define ADAU1373_DRC_SIZE 13 + struct adau1373 { struct regmap *regmap; struct adau1373_dai dais[3]; + + bool input_differential[4]; + bool lineout_differential; + bool lineout_ground_sense; + + unsigned int num_drc; + u8 drc_setting[3][ADAU1373_DRC_SIZE]; + + enum adau1373_micbias_voltage micbias1; + enum adau1373_micbias_voltage micbias2; }; #define ADAU1373_INPUT_MODE 0x00 @@ -1332,66 +1351,61 @@ static void adau1373_load_drc_settings(struct adau1373 *adau1373, regmap_write(adau1373->regmap, ADAU1373_DRC(nr) + i, drc[i]); } -static bool adau1373_valid_micbias(enum adau1373_micbias_voltage micbias) +static int adau1373_get_micbias(unsigned int val, + enum adau1373_micbias_voltage *micbias) { - switch (micbias) { - case ADAU1373_MICBIAS_2_9V: - case ADAU1373_MICBIAS_2_2V: - case ADAU1373_MICBIAS_2_6V: - case ADAU1373_MICBIAS_1_8V: - return true; + switch (val) { + case 2900000: + *micbias = ADAU1373_MICBIAS_2_9V; + return 0; + case 2200000: + *micbias = ADAU1373_MICBIAS_2_2V; + return 0; + case 2600000: + *micbias = ADAU1373_MICBIAS_2_6V; + return 0; + case 1800000: + *micbias = ADAU1373_MICBIAS_1_8V; + return 0; default: - break; + return -EINVAL; } - return false; } static int adau1373_probe(struct snd_soc_component *component) { struct adau1373 *adau1373 = snd_soc_component_get_drvdata(component); - struct adau1373_platform_data *pdata = component->dev->platform_data; - bool lineout_differential = false; unsigned int val; int i; - if (pdata) { - if (pdata->num_drc > ARRAY_SIZE(pdata->drc_setting)) - return -EINVAL; - - if (!adau1373_valid_micbias(pdata->micbias1) || - !adau1373_valid_micbias(pdata->micbias2)) - return -EINVAL; - - for (i = 0; i < pdata->num_drc; ++i) { - adau1373_load_drc_settings(adau1373, i, - pdata->drc_setting[i]); - } + for (i = 0; i < adau1373->num_drc; ++i) { + adau1373_load_drc_settings(adau1373, i, + adau1373->drc_setting[i]); + } - snd_soc_add_component_controls(component, adau1373_drc_controls, - pdata->num_drc); + snd_soc_add_component_controls(component, adau1373_drc_controls, + adau1373->num_drc); - val = 0; - for (i = 0; i < 4; ++i) { - if (pdata->input_differential[i]) - val |= BIT(i); - } - regmap_write(adau1373->regmap, ADAU1373_INPUT_MODE, val); + val = 0; + for (i = 0; i < ARRAY_SIZE(adau1373->input_differential); ++i) { + if (adau1373->input_differential[i]) + val |= BIT(i); + } + regmap_write(adau1373->regmap, ADAU1373_INPUT_MODE, val); - val = 0; - if (pdata->lineout_differential) - val |= ADAU1373_OUTPUT_CTRL_LDIFF; - if (pdata->lineout_ground_sense) - val |= ADAU1373_OUTPUT_CTRL_LNFBEN; - regmap_write(adau1373->regmap, ADAU1373_OUTPUT_CTRL, val); + val = 0; + if (adau1373->lineout_differential) + val |= ADAU1373_OUTPUT_CTRL_LDIFF; + if (adau1373->lineout_ground_sense) + val |= ADAU1373_OUTPUT_CTRL_LNFBEN; - lineout_differential = pdata->lineout_differential; + regmap_write(adau1373->regmap, ADAU1373_OUTPUT_CTRL, val); - regmap_write(adau1373->regmap, ADAU1373_EP_CTRL, - (pdata->micbias1 << ADAU1373_EP_CTRL_MICBIAS1_OFFSET) | - (pdata->micbias2 << ADAU1373_EP_CTRL_MICBIAS2_OFFSET)); - } + regmap_write(adau1373->regmap, ADAU1373_EP_CTRL, + (adau1373->micbias1 << ADAU1373_EP_CTRL_MICBIAS1_OFFSET) | + (adau1373->micbias2 << ADAU1373_EP_CTRL_MICBIAS2_OFFSET)); - if (!lineout_differential) { + if (!adau1373->lineout_differential) { snd_soc_add_component_controls(component, adau1373_lineout2_controls, ARRAY_SIZE(adau1373_lineout2_controls)); } @@ -1471,6 +1485,65 @@ static const struct snd_soc_component_driver adau1373_component_driver = { .endianness = 1, }; +static int adau1373_parse_fw(struct device *dev, struct adau1373 *adau1373) +{ + int ret, drc_count; + unsigned int val; + + if (device_property_present(dev, "adi,input1-differential")) + adau1373->input_differential[0] = true; + if (device_property_present(dev, "adi,input2-differential")) + adau1373->input_differential[1] = true; + if (device_property_present(dev, "adi,input3-differential")) + adau1373->input_differential[2] = true; + if (device_property_present(dev, "adi,input4-differential")) + adau1373->input_differential[3] = true; + + if (device_property_present(dev, "adi,lineout-differential")) + adau1373->lineout_differential = true; + if (device_property_present(dev, "adi,lineout-gnd-sense")) + adau1373->lineout_ground_sense = true; + + ret = device_property_read_u32(dev, "adi,micbias1-microvolt", &val); + if (!ret) { + ret = adau1373_get_micbias(val, &adau1373->micbias1); + if (ret) + return dev_err_probe(dev, ret, + "Failed to get micbias1(%u)\n", val); + } + + ret = device_property_read_u32(dev, "adi,micbias2-microvolt", &val); + if (!ret) { + ret = adau1373_get_micbias(val, &adau1373->micbias2); + if (ret) + return dev_err_probe(dev, ret, + "Failed to get micbias2(%u)\n", val); + } + + drc_count = device_property_count_u8(dev, "adi,drc-settings"); + if (drc_count < 0) + return 0; + if (drc_count % ADAU1373_DRC_SIZE != 0) + return dev_err_probe(dev, -EINVAL, + "DRC count(%u) not multiple of %u\n", + drc_count, ADAU1373_DRC_SIZE); + + adau1373->num_drc = drc_count / ADAU1373_DRC_SIZE; + if (adau1373->num_drc > ARRAY_SIZE(adau1373->drc_setting)) + return dev_err_probe(dev, -EINVAL, + "Too many DRC settings(%u)\n", + adau1373->num_drc); + + ret = device_property_read_u8_array(dev, "adi,drc-settings", + (u8 *)&adau1373->drc_setting[0], + drc_count); + if (ret) + return dev_err_probe(dev, ret, + "Failed to read DRC settings\n"); + + return 0; +} + static int adau1373_i2c_probe(struct i2c_client *client) { struct adau1373 *adau1373; @@ -1489,6 +1562,10 @@ static int adau1373_i2c_probe(struct i2c_client *client) dev_set_drvdata(&client->dev, adau1373); + ret = adau1373_parse_fw(&client->dev, adau1373); + if (ret) + return ret; + ret = devm_snd_soc_register_component(&client->dev, &adau1373_component_driver, adau1373_dai_driver, ARRAY_SIZE(adau1373_dai_driver)); @@ -1501,9 +1578,16 @@ static const struct i2c_device_id adau1373_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, adau1373_i2c_id); +static const struct of_device_id adau1373_of_match[] = { + { .compatible = "adi,adau1373", }, + { } +}; +MODULE_DEVICE_TABLE(of, adau1373_of_match); + static struct i2c_driver adau1373_i2c_driver = { .driver = { .name = "adau1373", + .of_match_table = adau1373_of_match, }, .probe = adau1373_i2c_probe, .id_table = adau1373_i2c_id, -- 2.51.0 From ba79bca407d3b7e6f5be209d9b3f73f81ee8d460 Mon Sep 17 00:00:00 2001 From: Nuno Sa Date: Mon, 28 Oct 2024 16:43:41 +0100 Subject: [PATCH 02/16] ASoC: codecs: adau1373: add powerdown gpio If the powerdown GPIO is specified, we use it for reset. Otherwise, fallback to a software reset. Signed-off-by: Nuno Sa Link: https://patch.msgid.link/20241028-adau1373-shutdown-v2-4-647f56bbd182@analog.com Signed-off-by: Mark Brown --- sound/soc/codecs/adau1373.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/adau1373.c b/sound/soc/codecs/adau1373.c index 9568ff933e12..16b9b2658341 100644 --- a/sound/soc/codecs/adau1373.c +++ b/sound/soc/codecs/adau1373.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -1485,6 +1486,11 @@ static const struct snd_soc_component_driver adau1373_component_driver = { .endianness = 1, }; +static void adau1373_reset(void *reset_gpio) +{ + gpiod_set_value_cansleep(reset_gpio, 1); +} + static int adau1373_parse_fw(struct device *dev, struct adau1373 *adau1373) { int ret, drc_count; @@ -1547,6 +1553,7 @@ static int adau1373_parse_fw(struct device *dev, struct adau1373 *adau1373) static int adau1373_i2c_probe(struct i2c_client *client) { struct adau1373 *adau1373; + struct gpio_desc *gpiod; int ret; adau1373 = devm_kzalloc(&client->dev, sizeof(*adau1373), GFP_KERNEL); @@ -1558,7 +1565,26 @@ static int adau1373_i2c_probe(struct i2c_client *client) if (IS_ERR(adau1373->regmap)) return PTR_ERR(adau1373->regmap); - regmap_write(adau1373->regmap, ADAU1373_SOFT_RESET, 0x00); + /* + * If the powerdown GPIO is specified, we use it for reset. Otherwise + * a software reset is done. + */ + gpiod = devm_gpiod_get_optional(&client->dev, "powerdown", + GPIOD_OUT_HIGH); + if (IS_ERR(gpiod)) + return PTR_ERR(gpiod); + + if (gpiod) { + gpiod_set_value_cansleep(gpiod, 0); + fsleep(10); + + ret = devm_add_action_or_reset(&client->dev, adau1373_reset, + gpiod); + if (ret) + return ret; + } else { + regmap_write(adau1373->regmap, ADAU1373_SOFT_RESET, 0x00); + } dev_set_drvdata(&client->dev, adau1373); -- 2.51.0 From c087a94bea49acf34d651f7308506fe462a937b3 Mon Sep 17 00:00:00 2001 From: Lad Prabhakar Date: Fri, 25 Oct 2024 16:05:07 +0100 Subject: [PATCH 03/16] ASoC: Rename "sh" to "renesas" Rename the "sh" folder to "renesas" to better reflect the Renesas-specific drivers. Signed-off-by: Lad Prabhakar Acked-by: Kuninori Morimoto Link: https://patch.msgid.link/20241025150511.722040-2-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Mark Brown --- sound/soc/Kconfig | 2 +- sound/soc/Makefile | 2 +- sound/soc/{sh => renesas}/Kconfig | 0 sound/soc/{sh => renesas}/Makefile | 0 sound/soc/{sh => renesas}/dma-sh7760.c | 0 sound/soc/{sh => renesas}/fsi.c | 0 sound/soc/{sh => renesas}/hac.c | 0 sound/soc/{sh => renesas}/migor.c | 0 sound/soc/{sh => renesas}/rcar/Makefile | 0 sound/soc/{sh => renesas}/rcar/adg.c | 0 sound/soc/{sh => renesas}/rcar/cmd.c | 0 sound/soc/{sh => renesas}/rcar/core.c | 0 sound/soc/{sh => renesas}/rcar/ctu.c | 0 sound/soc/{sh => renesas}/rcar/debugfs.c | 0 sound/soc/{sh => renesas}/rcar/dma.c | 0 sound/soc/{sh => renesas}/rcar/dvc.c | 0 sound/soc/{sh => renesas}/rcar/gen.c | 0 sound/soc/{sh => renesas}/rcar/mix.c | 0 sound/soc/{sh => renesas}/rcar/rsnd.h | 0 sound/soc/{sh => renesas}/rcar/src.c | 0 sound/soc/{sh => renesas}/rcar/ssi.c | 0 sound/soc/{sh => renesas}/rcar/ssiu.c | 0 sound/soc/{sh => renesas}/rz-ssi.c | 0 sound/soc/{sh => renesas}/sh7760-ac97.c | 0 sound/soc/{sh => renesas}/siu.h | 0 sound/soc/{sh => renesas}/siu_dai.c | 0 sound/soc/{sh => renesas}/siu_pcm.c | 0 sound/soc/{sh => renesas}/ssi.c | 0 28 files changed, 2 insertions(+), 2 deletions(-) rename sound/soc/{sh => renesas}/Kconfig (100%) rename sound/soc/{sh => renesas}/Makefile (100%) rename sound/soc/{sh => renesas}/dma-sh7760.c (100%) rename sound/soc/{sh => renesas}/fsi.c (100%) rename sound/soc/{sh => renesas}/hac.c (100%) rename sound/soc/{sh => renesas}/migor.c (100%) rename sound/soc/{sh => renesas}/rcar/Makefile (100%) rename sound/soc/{sh => renesas}/rcar/adg.c (100%) rename sound/soc/{sh => renesas}/rcar/cmd.c (100%) rename sound/soc/{sh => renesas}/rcar/core.c (100%) rename sound/soc/{sh => renesas}/rcar/ctu.c (100%) rename sound/soc/{sh => renesas}/rcar/debugfs.c (100%) rename sound/soc/{sh => renesas}/rcar/dma.c (100%) rename sound/soc/{sh => renesas}/rcar/dvc.c (100%) rename sound/soc/{sh => renesas}/rcar/gen.c (100%) rename sound/soc/{sh => renesas}/rcar/mix.c (100%) rename sound/soc/{sh => renesas}/rcar/rsnd.h (100%) rename sound/soc/{sh => renesas}/rcar/src.c (100%) rename sound/soc/{sh => renesas}/rcar/ssi.c (100%) rename sound/soc/{sh => renesas}/rcar/ssiu.c (100%) rename sound/soc/{sh => renesas}/rz-ssi.c (100%) rename sound/soc/{sh => renesas}/sh7760-ac97.c (100%) rename sound/soc/{sh => renesas}/siu.h (100%) rename sound/soc/{sh => renesas}/siu_dai.c (100%) rename sound/soc/{sh => renesas}/siu_pcm.c (100%) rename sound/soc/{sh => renesas}/ssi.c (100%) diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig index 8e01b421fe8d..5efba76abb31 100644 --- a/sound/soc/Kconfig +++ b/sound/soc/Kconfig @@ -106,10 +106,10 @@ source "sound/soc/meson/Kconfig" source "sound/soc/mxs/Kconfig" source "sound/soc/pxa/Kconfig" source "sound/soc/qcom/Kconfig" +source "sound/soc/renesas/Kconfig" source "sound/soc/rockchip/Kconfig" source "sound/soc/samsung/Kconfig" source "sound/soc/sdca/Kconfig" -source "sound/soc/sh/Kconfig" source "sound/soc/sof/Kconfig" source "sound/soc/spear/Kconfig" source "sound/soc/sprd/Kconfig" diff --git a/sound/soc/Makefile b/sound/soc/Makefile index 5307b0b62a93..08baaa11d813 100644 --- a/sound/soc/Makefile +++ b/sound/soc/Makefile @@ -59,10 +59,10 @@ obj-$(CONFIG_SND_SOC) += mxs/ obj-$(CONFIG_SND_SOC) += kirkwood/ obj-$(CONFIG_SND_SOC) += pxa/ obj-$(CONFIG_SND_SOC) += qcom/ +obj-$(CONFIG_SND_SOC) += renesas/ obj-$(CONFIG_SND_SOC) += rockchip/ obj-$(CONFIG_SND_SOC) += samsung/ obj-$(CONFIG_SND_SOC) += sdca/ -obj-$(CONFIG_SND_SOC) += sh/ obj-$(CONFIG_SND_SOC) += sof/ obj-$(CONFIG_SND_SOC) += spear/ obj-$(CONFIG_SND_SOC) += sprd/ diff --git a/sound/soc/sh/Kconfig b/sound/soc/renesas/Kconfig similarity index 100% rename from sound/soc/sh/Kconfig rename to sound/soc/renesas/Kconfig diff --git a/sound/soc/sh/Makefile b/sound/soc/renesas/Makefile similarity index 100% rename from sound/soc/sh/Makefile rename to sound/soc/renesas/Makefile diff --git a/sound/soc/sh/dma-sh7760.c b/sound/soc/renesas/dma-sh7760.c similarity index 100% rename from sound/soc/sh/dma-sh7760.c rename to sound/soc/renesas/dma-sh7760.c diff --git a/sound/soc/sh/fsi.c b/sound/soc/renesas/fsi.c similarity index 100% rename from sound/soc/sh/fsi.c rename to sound/soc/renesas/fsi.c diff --git a/sound/soc/sh/hac.c b/sound/soc/renesas/hac.c similarity index 100% rename from sound/soc/sh/hac.c rename to sound/soc/renesas/hac.c diff --git a/sound/soc/sh/migor.c b/sound/soc/renesas/migor.c similarity index 100% rename from sound/soc/sh/migor.c rename to sound/soc/renesas/migor.c diff --git a/sound/soc/sh/rcar/Makefile b/sound/soc/renesas/rcar/Makefile similarity index 100% rename from sound/soc/sh/rcar/Makefile rename to sound/soc/renesas/rcar/Makefile diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/renesas/rcar/adg.c similarity index 100% rename from sound/soc/sh/rcar/adg.c rename to sound/soc/renesas/rcar/adg.c diff --git a/sound/soc/sh/rcar/cmd.c b/sound/soc/renesas/rcar/cmd.c similarity index 100% rename from sound/soc/sh/rcar/cmd.c rename to sound/soc/renesas/rcar/cmd.c diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/renesas/rcar/core.c similarity index 100% rename from sound/soc/sh/rcar/core.c rename to sound/soc/renesas/rcar/core.c diff --git a/sound/soc/sh/rcar/ctu.c b/sound/soc/renesas/rcar/ctu.c similarity index 100% rename from sound/soc/sh/rcar/ctu.c rename to sound/soc/renesas/rcar/ctu.c diff --git a/sound/soc/sh/rcar/debugfs.c b/sound/soc/renesas/rcar/debugfs.c similarity index 100% rename from sound/soc/sh/rcar/debugfs.c rename to sound/soc/renesas/rcar/debugfs.c diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/renesas/rcar/dma.c similarity index 100% rename from sound/soc/sh/rcar/dma.c rename to sound/soc/renesas/rcar/dma.c diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/renesas/rcar/dvc.c similarity index 100% rename from sound/soc/sh/rcar/dvc.c rename to sound/soc/renesas/rcar/dvc.c diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/renesas/rcar/gen.c similarity index 100% rename from sound/soc/sh/rcar/gen.c rename to sound/soc/renesas/rcar/gen.c diff --git a/sound/soc/sh/rcar/mix.c b/sound/soc/renesas/rcar/mix.c similarity index 100% rename from sound/soc/sh/rcar/mix.c rename to sound/soc/renesas/rcar/mix.c diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/renesas/rcar/rsnd.h similarity index 100% rename from sound/soc/sh/rcar/rsnd.h rename to sound/soc/renesas/rcar/rsnd.h diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/renesas/rcar/src.c similarity index 100% rename from sound/soc/sh/rcar/src.c rename to sound/soc/renesas/rcar/src.c diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/renesas/rcar/ssi.c similarity index 100% rename from sound/soc/sh/rcar/ssi.c rename to sound/soc/renesas/rcar/ssi.c diff --git a/sound/soc/sh/rcar/ssiu.c b/sound/soc/renesas/rcar/ssiu.c similarity index 100% rename from sound/soc/sh/rcar/ssiu.c rename to sound/soc/renesas/rcar/ssiu.c diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/renesas/rz-ssi.c similarity index 100% rename from sound/soc/sh/rz-ssi.c rename to sound/soc/renesas/rz-ssi.c diff --git a/sound/soc/sh/sh7760-ac97.c b/sound/soc/renesas/sh7760-ac97.c similarity index 100% rename from sound/soc/sh/sh7760-ac97.c rename to sound/soc/renesas/sh7760-ac97.c diff --git a/sound/soc/sh/siu.h b/sound/soc/renesas/siu.h similarity index 100% rename from sound/soc/sh/siu.h rename to sound/soc/renesas/siu.h diff --git a/sound/soc/sh/siu_dai.c b/sound/soc/renesas/siu_dai.c similarity index 100% rename from sound/soc/sh/siu_dai.c rename to sound/soc/renesas/siu_dai.c diff --git a/sound/soc/sh/siu_pcm.c b/sound/soc/renesas/siu_pcm.c similarity index 100% rename from sound/soc/sh/siu_pcm.c rename to sound/soc/renesas/siu_pcm.c diff --git a/sound/soc/sh/ssi.c b/sound/soc/renesas/ssi.c similarity index 100% rename from sound/soc/sh/ssi.c rename to sound/soc/renesas/ssi.c -- 2.51.0 From 94c0a8a10f05782a4426a67343e3081601ad3f1a Mon Sep 17 00:00:00 2001 From: Lad Prabhakar Date: Fri, 25 Oct 2024 16:05:08 +0100 Subject: [PATCH 04/16] ASoC: renesas, rsnd: Update file path The "sound/soc/sh" directory has been renamed to "sound/soc/renesas". Update the reference in renesas,rsnd.txt to reflect the new file path for consistency. Signed-off-by: Lad Prabhakar Acked-by: Kuninori Morimoto Link: https://patch.msgid.link/20241025150511.722040-3-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Mark Brown --- Documentation/devicetree/bindings/sound/renesas,rsnd.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt index dfd768b1ad7d..3f07b072d995 100644 --- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt +++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt @@ -109,7 +109,7 @@ For more detail information, see below - Register Description - CTUn Scale Value exx Register (CTUn_SVxxR) - ${LINUX}/sound/soc/sh/rcar/ctu.c + ${LINUX}/sound/soc/renesas/rcar/ctu.c - comment of header You need to use "simple-scu-audio-card" or "audio-graph-scu-card" for it. -- 2.51.0 From 1b3130e9e77e4286a2e495b4b3c3efcf54848633 Mon Sep 17 00:00:00 2001 From: Lad Prabhakar Date: Fri, 25 Oct 2024 16:05:09 +0100 Subject: [PATCH 05/16] ASoC: audio-graph-card2: Update comment with renamed file path The "sound/soc/sh" directory has been renamed to "sound/soc/renesas". Update the comment in audio-graph-card2.c to reflect the new file path for better accuracy. Signed-off-by: Lad Prabhakar Acked-by: Kuninori Morimoto Link: https://patch.msgid.link/20241025150511.722040-4-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Mark Brown --- sound/soc/generic/audio-graph-card2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c index 4ad3d1b0714f..747afe7d6f34 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -50,7 +50,7 @@ snd_soc_runtime_get_dai_fmt() sample driver - linux/sound/soc/sh/rcar/core.c + linux/sound/soc/renesas/rcar/core.c linux/sound/soc/codecs/ak4613.c linux/sound/soc/codecs/pcm3168a.c linux/sound/soc/soc-utils.c -- 2.51.0 From 3dc2c89473a43b1ab83a7f0196e41eb3145844d6 Mon Sep 17 00:00:00 2001 From: Lad Prabhakar Date: Fri, 25 Oct 2024 16:05:10 +0100 Subject: [PATCH 06/16] MAINTAINERS: Add entry for Renesas R-Car and FSI ASoC drivers Add a new entry to the MAINTAINERS file for Renesas R-CAR and FSI ASoC drivers. Signed-off-by: Lad Prabhakar Acked-by: Kuninori Morimoto Link: https://patch.msgid.link/20241025150511.722040-5-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Mark Brown --- MAINTAINERS | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 877b53abba49..674f14783552 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19667,6 +19667,17 @@ S: Maintained F: Documentation/devicetree/bindings/sound/renesas,idt821034.yaml F: sound/soc/codecs/idt821034.c +RENESAS R-CAR & FSI AUDIO (ASoC) DRIVERS +M: Kuninori Morimoto +L: linux-sound@vger.kernel.org +L: linux-renesas-soc@vger.kernel.org +S: Supported +F: Documentation/devicetree/bindings/sound/renesas,rsnd.* +F: Documentation/devicetree/bindings/sound/renesas,fsi.yaml +F: sound/soc/renesas/rcar/ +F: sound/soc/renesas/fsi.c +F: include/sound/sh_fsi.h + RENESAS R-CAR GEN3 & RZ/N1 NAND CONTROLLER DRIVER M: Miquel Raynal L: linux-mtd@lists.infradead.org -- 2.51.0 From 8fc6907ee343336dc5ae75665883fdbf7e012d26 Mon Sep 17 00:00:00 2001 From: Lad Prabhakar Date: Fri, 25 Oct 2024 16:05:11 +0100 Subject: [PATCH 07/16] MAINTAINERS: Add entry for Renesas RZ ASoC driver Add a new entry to the MAINTAINERS file for Renesas RZ ASoC driver. Signed-off-by: Lad Prabhakar Acked-by: Biju Das Link: https://patch.msgid.link/20241025150511.722040-6-prabhakar.mahadev-lad.rj@bp.renesas.com Acked-by: Kuninori Morimoto Signed-off-by: Mark Brown --- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 674f14783552..a870d5798e81 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19726,6 +19726,15 @@ S: Supported F: Documentation/devicetree/bindings/i2c/renesas,riic.yaml F: drivers/i2c/busses/i2c-riic.c +RENESAS RZ AUDIO (ASoC) DRIVER +M: Biju Das +M: Lad Prabhakar +L: linux-sound@vger.kernel.org +L: linux-renesas-soc@vger.kernel.org +S: Supported +F: Documentation/devicetree/bindings/sound/renesas,rz-ssi.yaml +F: sound/soc/renesas/rz-ssi.c + RENESAS RZ/G2L A/D DRIVER M: Lad Prabhakar L: linux-iio@vger.kernel.org -- 2.51.0 From 334d538e176ce0c70bea5321d067432df2299bca Mon Sep 17 00:00:00 2001 From: Jiapeng Chong Date: Wed, 30 Oct 2024 10:10:47 +0800 Subject: [PATCH 08/16] ASoC: cs42l84: Remove unused including ./sound/soc/codecs/cs42l84.c: 15 linux/version.h not needed. Reported-by: Abaci Robot Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=11570 Signed-off-by: Jiapeng Chong Link: https://patch.msgid.link/20241030021047.70543-1-jiapeng.chong@linux.alibaba.com Signed-off-by: Mark Brown --- sound/soc/codecs/cs42l84.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sound/soc/codecs/cs42l84.c b/sound/soc/codecs/cs42l84.c index d176add8c4a6..17d5c96e334d 100644 --- a/sound/soc/codecs/cs42l84.c +++ b/sound/soc/codecs/cs42l84.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include -- 2.51.0 From bd0aff85d5f3f3fc22735ab5869008dfd8ab4867 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Thu, 31 Oct 2024 12:33:02 +0200 Subject: [PATCH 09/16] ASoC: codecs: wcd937x: Remove unused of_gpio.h of_gpio.h is deprecated and subject to remove. The drivers in question don't use it, simply remove the unused header. Signed-off-by: Andy Shevchenko Link: https://patch.msgid.link/20241031103302.2450830-1-andriy.shevchenko@linux.intel.com Signed-off-by: Mark Brown --- sound/soc/codecs/wcd937x.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sound/soc/codecs/wcd937x.c b/sound/soc/codecs/wcd937x.c index 45f32d281908..a11f9be91da4 100644 --- a/sound/soc/codecs/wcd937x.c +++ b/sound/soc/codecs/wcd937x.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include -- 2.51.0 From 019610566757a749dde7e0c92777d2c1613afef8 Mon Sep 17 00:00:00 2001 From: anish kumar Date: Wed, 30 Oct 2024 20:58:29 -0700 Subject: [PATCH 10/16] ASoC: doc: update clock api details Added ASoC clock api kernel doc in this document. Signed-off-by: anish kumar Link: https://patch.msgid.link/20241031035829.54852-1-yesanishhere@gmail.com Signed-off-by: Mark Brown --- Documentation/sound/soc/clocking.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Documentation/sound/soc/clocking.rst b/Documentation/sound/soc/clocking.rst index 32122d6877a3..25d016ea8b65 100644 --- a/Documentation/sound/soc/clocking.rst +++ b/Documentation/sound/soc/clocking.rst @@ -42,5 +42,17 @@ rate, number of channels and word size) to save on power. It is also desirable to use the codec (if possible) to drive (or master) the audio clocks as it usually gives more accurate sample rates than the CPU. +ASoC provided clock APIs +------------------------ +.. kernel-doc:: sound/soc/soc-dai.c + :identifiers: snd_soc_dai_set_sysclk +.. kernel-doc:: sound/soc/soc-dai.c + :identifiers: snd_soc_dai_set_clkdiv + +.. kernel-doc:: sound/soc/soc-dai.c + :identifiers: snd_soc_dai_set_pll + +.. kernel-doc:: sound/soc/soc-dai.c + :identifiers: snd_soc_dai_set_bclk_ratio -- 2.51.0 From 40e47e2db6864aa053a62477bd71a16be9dd4066 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 24 Oct 2024 01:29:13 +0000 Subject: [PATCH 11/16] ASoC: rename rtd->num to rtd->id Current rtd has "num". It sounds/looks like size of rtd or something, but it will be mainly used at snd_pcm_new() as "device index". This naming is confusable. Let's rename it to "id" Some drivers are using rtd->num, so let's keep it so far, and remove it if all user was switched. Signed-off-by: Kuninori Morimoto Link: https://patch.msgid.link/87zfmub85z.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- include/sound/soc-dai.h | 4 ++-- include/sound/soc.h | 9 +++++---- sound/soc/soc-compress.c | 10 +++++----- sound/soc/soc-core.c | 15 ++++++++------- sound/soc/soc-dai.c | 4 ++-- sound/soc/soc-pcm.c | 16 ++++++++-------- 6 files changed, 30 insertions(+), 28 deletions(-) diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index 0d1b215f24f4..9dbeedf6da13 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -217,7 +217,7 @@ void snd_soc_dai_shutdown(struct snd_soc_dai *dai, void snd_soc_dai_suspend(struct snd_soc_dai *dai); void snd_soc_dai_resume(struct snd_soc_dai *dai); int snd_soc_dai_compress_new(struct snd_soc_dai *dai, - struct snd_soc_pcm_runtime *rtd, int num); + struct snd_soc_pcm_runtime *rtd, int id); bool snd_soc_dai_stream_valid(const struct snd_soc_dai *dai, int stream); void snd_soc_dai_action(struct snd_soc_dai *dai, int stream, int action); @@ -275,7 +275,7 @@ struct snd_soc_dai_ops { int (*probe)(struct snd_soc_dai *dai); int (*remove)(struct snd_soc_dai *dai); /* compress dai */ - int (*compress_new)(struct snd_soc_pcm_runtime *rtd, int num); + int (*compress_new)(struct snd_soc_pcm_runtime *rtd, int id); /* Optional Callback used at pcm creation*/ int (*pcm_new)(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); diff --git a/include/sound/soc.h b/include/sound/soc.h index 5c240ea34027..51840ceb3cd4 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -486,11 +486,11 @@ struct snd_soc_component *snd_soc_lookup_component_nolocked(struct device *dev, struct snd_soc_component *snd_soc_lookup_component(struct device *dev, const char *driver_name); -int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num); +int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int id); #ifdef CONFIG_SND_SOC_COMPRESS -int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num); +int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int id); #else -static inline int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) +static inline int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int id) { return 0; } @@ -1195,7 +1195,8 @@ struct snd_soc_pcm_runtime { struct dentry *debugfs_dpcm_root; #endif - unsigned int num; /* 0-based and monotonic increasing */ + unsigned int num; /* REMOVE ME */ + unsigned int id; /* 0-based and monotonic increasing */ struct list_head list; /* rtd list of the soc card */ /* function mark */ diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index a0c55246f424..fb664c775dda 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c @@ -537,11 +537,11 @@ static struct snd_compr_ops soc_compr_dyn_ops = { * snd_soc_new_compress - create a new compress. * * @rtd: The runtime for which we will create compress - * @num: the device index number (zero based - shared with normal PCMs) + * @id: the device index number (zero based - shared with normal PCMs) * * Return: 0 for success, else error. */ -int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) +int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int id) { struct snd_soc_component *component; struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); @@ -617,7 +617,7 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) snprintf(new_name, sizeof(new_name), "(%s)", rtd->dai_link->stream_name); - ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, num, + ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, id, playback, capture, &be_pcm); if (ret < 0) { dev_err(rtd->card->dev, @@ -638,7 +638,7 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) memcpy(compr->ops, &soc_compr_dyn_ops, sizeof(soc_compr_dyn_ops)); } else { snprintf(new_name, sizeof(new_name), "%s %s-%d", - rtd->dai_link->stream_name, codec_dai->name, num); + rtd->dai_link->stream_name, codec_dai->name, id); memcpy(compr->ops, &soc_compr_ops, sizeof(soc_compr_ops)); } @@ -652,7 +652,7 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) break; } - ret = snd_compress_new(rtd->card->snd_card, num, direction, + ret = snd_compress_new(rtd->card->snd_card, id, direction, new_name, compr); if (ret < 0) { component = snd_soc_rtd_to_codec(rtd, 0)->component; diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index f04b671ce33e..3cb748279166 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -558,7 +558,8 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime( */ rtd->card = card; rtd->dai_link = dai_link; - rtd->num = card->num_rtd++; + rtd->id = card->num_rtd++; + rtd->num = rtd->id; /* REMOVE ME */ rtd->pmdown_time = pmdown_time; /* default power off timeout */ /* see for_each_card_rtds */ @@ -1458,7 +1459,7 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link = rtd->dai_link; struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); struct snd_soc_component *component; - int ret, num, i; + int ret, id, i; /* do machine specific initialization */ ret = snd_soc_link_init(rtd); @@ -1473,7 +1474,7 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card, /* add DPCM sysfs entries */ soc_dpcm_debugfs_add(rtd); - num = rtd->num; + id = rtd->id; /* * most drivers will register their PCMs using DAI link ordering but @@ -1485,18 +1486,18 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card, continue; if (rtd->dai_link->no_pcm) - num += component->driver->be_pcm_base; + id += component->driver->be_pcm_base; else - num = rtd->dai_link->id; + id = rtd->dai_link->id; } /* create compress_device if possible */ - ret = snd_soc_dai_compress_new(cpu_dai, rtd, num); + ret = snd_soc_dai_compress_new(cpu_dai, rtd, id); if (ret != -ENOTSUPP) goto err; /* create the pcm */ - ret = soc_new_pcm(rtd, num); + ret = soc_new_pcm(rtd, id); if (ret < 0) { dev_err(card->dev, "ASoC: can't create pcm %s :%d\n", dai_link->stream_name, ret); diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c index 4a1c85ad5a8d..2feb76bf57bb 100644 --- a/sound/soc/soc-dai.c +++ b/sound/soc/soc-dai.c @@ -457,12 +457,12 @@ void snd_soc_dai_shutdown(struct snd_soc_dai *dai, } int snd_soc_dai_compress_new(struct snd_soc_dai *dai, - struct snd_soc_pcm_runtime *rtd, int num) + struct snd_soc_pcm_runtime *rtd, int id) { int ret = -ENOTSUPP; if (dai->driver->ops && dai->driver->ops->compress_new) - ret = dai->driver->ops->compress_new(rtd, num); + ret = dai->driver->ops->compress_new(rtd, id); return soc_dai_ret(dai, ret); } diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 678400e76e53..81b63e547a09 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -2891,7 +2891,7 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd, static int soc_create_pcm(struct snd_pcm **pcm, struct snd_soc_pcm_runtime *rtd, - int playback, int capture, int num) + int playback, int capture, int id) { char new_name[64]; int ret; @@ -2901,13 +2901,13 @@ static int soc_create_pcm(struct snd_pcm **pcm, snprintf(new_name, sizeof(new_name), "codec2codec(%s)", rtd->dai_link->stream_name); - ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, num, + ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, id, playback, capture, pcm); } else if (rtd->dai_link->no_pcm) { snprintf(new_name, sizeof(new_name), "(%s)", rtd->dai_link->stream_name); - ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, num, + ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, id, playback, capture, pcm); } else { if (rtd->dai_link->dynamic) @@ -2916,9 +2916,9 @@ static int soc_create_pcm(struct snd_pcm **pcm, else snprintf(new_name, sizeof(new_name), "%s %s-%d", rtd->dai_link->stream_name, - soc_codec_dai_name(rtd), num); + soc_codec_dai_name(rtd), id); - ret = snd_pcm_new(rtd->card->snd_card, new_name, num, playback, + ret = snd_pcm_new(rtd->card->snd_card, new_name, id, playback, capture, pcm); } if (ret < 0) { @@ -2926,13 +2926,13 @@ static int soc_create_pcm(struct snd_pcm **pcm, new_name, rtd->dai_link->name, ret); return ret; } - dev_dbg(rtd->card->dev, "ASoC: registered pcm #%d %s\n",num, new_name); + dev_dbg(rtd->card->dev, "ASoC: registered pcm #%d %s\n", id, new_name); return 0; } /* create a new pcm */ -int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) +int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int id) { struct snd_soc_component *component; struct snd_pcm *pcm; @@ -2943,7 +2943,7 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) if (ret < 0) return ret; - ret = soc_create_pcm(&pcm, rtd, playback, capture, num); + ret = soc_create_pcm(&pcm, rtd, playback, capture, id); if (ret < 0) return ret; -- 2.51.0 From eae33f737c7a929d92b559fe1a1002d597b7b903 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 24 Oct 2024 01:29:20 +0000 Subject: [PATCH 12/16] ASoC: fsl: switch to use rtd->id from rtd->num Now rtd->num is renamed to rtd->id. Let's switch. Signed-off-by: Kuninori Morimoto Link: https://patch.msgid.link/87y12eb85r.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- sound/soc/fsl/imx-card.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c index 0f11f20dc51a..95a57fda0250 100644 --- a/sound/soc/fsl/imx-card.c +++ b/sound/soc/fsl/imx-card.c @@ -275,7 +275,7 @@ static unsigned long akcodec_get_mclk_rate(struct snd_pcm_substream *substream, struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); struct imx_card_data *data = snd_soc_card_get_drvdata(rtd->card); const struct imx_card_plat_data *plat_data = data->plat_data; - struct dai_link_data *link_data = &data->link_data[rtd->num]; + struct dai_link_data *link_data = &data->link_data[rtd->id]; unsigned int width = slots * slot_width; unsigned int rate = params_rate(params); int i; @@ -313,7 +313,7 @@ static int imx_aif_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); struct snd_soc_card *card = rtd->card; struct imx_card_data *data = snd_soc_card_get_drvdata(card); - struct dai_link_data *link_data = &data->link_data[rtd->num]; + struct dai_link_data *link_data = &data->link_data[rtd->id]; struct imx_card_plat_data *plat_data = data->plat_data; struct device *dev = card->dev; struct snd_soc_dai *codec_dai; @@ -435,7 +435,7 @@ static int imx_aif_startup(struct snd_pcm_substream *substream) struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); struct snd_soc_card *card = rtd->card; struct imx_card_data *data = snd_soc_card_get_drvdata(card); - struct dai_link_data *link_data = &data->link_data[rtd->num]; + struct dai_link_data *link_data = &data->link_data[rtd->id]; static struct snd_pcm_hw_constraint_list constraint_rates; static struct snd_pcm_hw_constraint_list constraint_channels; int ret = 0; -- 2.51.0 From b19f75df8fa9f8d4aa8b5886dca0f2d832a76baa Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 24 Oct 2024 01:29:27 +0000 Subject: [PATCH 13/16] ASoC: meson: switch to use rtd->id from rtd->num Now rtd->num is renamed to rtd->id. Let's switch. Signed-off-by: Kuninori Morimoto Acked-by: Jerome Brunet Link: https://patch.msgid.link/87wmhyb85l.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- sound/soc/meson/axg-card.c | 6 +++--- sound/soc/meson/gx-card.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/meson/axg-card.c b/sound/soc/meson/axg-card.c index 5ebf287fe700..a2dfccb7990f 100644 --- a/sound/soc/meson/axg-card.c +++ b/sound/soc/meson/axg-card.c @@ -43,7 +43,7 @@ static int axg_card_tdm_be_hw_params(struct snd_pcm_substream *substream, struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); struct meson_card *priv = snd_soc_card_get_drvdata(rtd->card); struct axg_dai_link_tdm_data *be = - (struct axg_dai_link_tdm_data *)priv->link_data[rtd->num]; + (struct axg_dai_link_tdm_data *)priv->link_data[rtd->id]; return meson_card_i2s_set_sysclk(substream, params, be->mclk_fs); } @@ -56,7 +56,7 @@ static int axg_card_tdm_dai_init(struct snd_soc_pcm_runtime *rtd) { struct meson_card *priv = snd_soc_card_get_drvdata(rtd->card); struct axg_dai_link_tdm_data *be = - (struct axg_dai_link_tdm_data *)priv->link_data[rtd->num]; + (struct axg_dai_link_tdm_data *)priv->link_data[rtd->id]; struct snd_soc_dai *codec_dai; int ret, i; @@ -86,7 +86,7 @@ static int axg_card_tdm_dai_lb_init(struct snd_soc_pcm_runtime *rtd) { struct meson_card *priv = snd_soc_card_get_drvdata(rtd->card); struct axg_dai_link_tdm_data *be = - (struct axg_dai_link_tdm_data *)priv->link_data[rtd->num]; + (struct axg_dai_link_tdm_data *)priv->link_data[rtd->id]; int ret; /* The loopback rx_mask is the pad tx_mask */ diff --git a/sound/soc/meson/gx-card.c b/sound/soc/meson/gx-card.c index 455f6bfc9f8f..b408cc2bbc91 100644 --- a/sound/soc/meson/gx-card.c +++ b/sound/soc/meson/gx-card.c @@ -32,7 +32,7 @@ static int gx_card_i2s_be_hw_params(struct snd_pcm_substream *substream, struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); struct meson_card *priv = snd_soc_card_get_drvdata(rtd->card); struct gx_dai_link_i2s_data *be = - (struct gx_dai_link_i2s_data *)priv->link_data[rtd->num]; + (struct gx_dai_link_i2s_data *)priv->link_data[rtd->id]; return meson_card_i2s_set_sysclk(substream, params, be->mclk_fs); } -- 2.51.0 From 970a874b76d09d6a5880e8832e572850cfcb4008 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 24 Oct 2024 01:29:34 +0000 Subject: [PATCH 14/16] ASoC: sh: switch to use rtd->id from rtd->num Now rtd->num is renamed to rtd->id. Let's switch. Signed-off-by: Kuninori Morimoto Link: https://patch.msgid.link/87v7xib85e.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- sound/soc/renesas/rcar/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/renesas/rcar/core.c b/sound/soc/renesas/rcar/core.c index c32e88d6a141..e2234928c9e8 100644 --- a/sound/soc/renesas/rcar/core.c +++ b/sound/soc/renesas/rcar/core.c @@ -1843,7 +1843,7 @@ int rsnd_kctrl_new(struct rsnd_mod *mod, .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = name, .info = rsnd_kctrl_info, - .index = rtd->num, + .index = rtd->id, .get = rsnd_kctrl_get, .put = rsnd_kctrl_put, }; -- 2.51.0 From 742e622db67efc32affb5893fdcc0149f374533e Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 24 Oct 2024 01:29:39 +0000 Subject: [PATCH 15/16] ASoC: generic: switch to use rtd->id from rtd->num Now rtd->num is renamed to rtd->id. Let's switch. Signed-off-by: Kuninori Morimoto Link: https://patch.msgid.link/87ttd2b858.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- sound/soc/generic/simple-card-utils.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index fedae7f6f70c..d47c372228b3 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -296,7 +296,7 @@ int simple_util_startup(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); struct simple_util_priv *priv = snd_soc_card_get_drvdata(rtd->card); - struct simple_dai_props *props = simple_priv_to_props(priv, rtd->num); + struct simple_dai_props *props = simple_priv_to_props(priv, rtd->id); struct simple_util_dai *dai; unsigned int fixed_sysclk = 0; int i1, i2, i; @@ -357,7 +357,7 @@ void simple_util_shutdown(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); struct simple_util_priv *priv = snd_soc_card_get_drvdata(rtd->card); - struct simple_dai_props *props = simple_priv_to_props(priv, rtd->num); + struct simple_dai_props *props = simple_priv_to_props(priv, rtd->id); struct simple_util_dai *dai; int i; @@ -448,7 +448,7 @@ int simple_util_hw_params(struct snd_pcm_substream *substream, struct simple_util_dai *pdai; struct snd_soc_dai *sdai; struct simple_util_priv *priv = snd_soc_card_get_drvdata(rtd->card); - struct simple_dai_props *props = simple_priv_to_props(priv, rtd->num); + struct simple_dai_props *props = simple_priv_to_props(priv, rtd->id); unsigned int mclk, mclk_fs = 0; int i, ret; @@ -517,7 +517,7 @@ int simple_util_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params) { struct simple_util_priv *priv = snd_soc_card_get_drvdata(rtd->card); - struct simple_dai_props *dai_props = simple_priv_to_props(priv, rtd->num); + struct simple_dai_props *dai_props = simple_priv_to_props(priv, rtd->id); struct simple_util_data *data = &dai_props->adata; struct snd_interval *rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); struct snd_interval *channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); @@ -628,7 +628,7 @@ static int simple_init_for_codec2codec(struct snd_soc_pcm_runtime *rtd, int simple_util_dai_init(struct snd_soc_pcm_runtime *rtd) { struct simple_util_priv *priv = snd_soc_card_get_drvdata(rtd->card); - struct simple_dai_props *props = simple_priv_to_props(priv, rtd->num); + struct simple_dai_props *props = simple_priv_to_props(priv, rtd->id); struct simple_util_dai *dai; int i, ret; -- 2.51.0 From c59db5ed233a19f6aadd086fb89149ec5f6fa855 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 24 Oct 2024 01:29:45 +0000 Subject: [PATCH 16/16] ASoC: remove rtd->num No one is using rtd->num. Let's remove it. Signed-off-by: Kuninori Morimoto Link: https://patch.msgid.link/87sesmb852.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- include/sound/soc.h | 1 - sound/soc/soc-core.c | 1 - 2 files changed, 2 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index 51840ceb3cd4..21a50a8057eb 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1195,7 +1195,6 @@ struct snd_soc_pcm_runtime { struct dentry *debugfs_dpcm_root; #endif - unsigned int num; /* REMOVE ME */ unsigned int id; /* 0-based and monotonic increasing */ struct list_head list; /* rtd list of the soc card */ diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 3cb748279166..233c91e60f0c 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -559,7 +559,6 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime( rtd->card = card; rtd->dai_link = dai_link; rtd->id = card->num_rtd++; - rtd->num = rtd->id; /* REMOVE ME */ rtd->pmdown_time = pmdown_time; /* default power off timeout */ /* see for_each_card_rtds */ -- 2.51.0