Quoting Srinivasa Rao Mandadapu (2021-10-29 08:04:36)
diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig index cc7c1de..d9ffcb7 100644 --- a/sound/soc/qcom/Kconfig +++ b/sound/soc/qcom/Kconfig @@ -152,4 +152,16 @@ config SND_SOC_SC7180 SC7180 SoC-based systems. Say Y if you want to use audio device on this SoCs.
+config SND_SOC_SC7280
tristate "SoC Machine driver for SC7280 boards"depends on I2C && SOUNDWIRE
Add || COMPILE_TEST so we can compile test this driver?
select SND_SOC_QCOM_COMMONselect SND_SOC_MAX98357Aselect SND_SOC_LPASS_RX_MACROselect SND_SOC_LPASS_TX_MACROhelpTo add support for audio on Qualcomm Technologies Inc.
Drop "To"?
SC7280 SoC-based systems.Say Y if you want to use audio device on this SoCs.endif #SND_SOC_QCOM diff --git a/sound/soc/qcom/sc7280.c b/sound/soc/qcom/sc7280.c new file mode 100644 index 0000000..1d73b4f --- /dev/null +++ b/sound/soc/qcom/sc7280.c @@ -0,0 +1,343 @@ +// SPDX-License-Identifier: GPL-2.0-only +// +// Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. +// +// sc7280.c -- ALSA SoC Machine driver for sc7280
Please remove filename from the comment as it's not useful and may change.
+#include <linux/gpio.h>
[...]
+static void sc7280_snd_shutdown(struct snd_pcm_substream *substream) +{
struct snd_soc_pcm_runtime *rtd = substream->private_data;struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);switch (cpu_dai->id) {case LPASS_CDC_DMA_RX0:case LPASS_CDC_DMA_TX3:case LPASS_CDC_DMA_VA_TX0:break;case MI2S_SECONDARY:break;case LPASS_DP_RX:break;default:dev_err(rtd->dev, "%s: invalid dai id %d\n", __func__, cpu_dai->id);break;}
The function doesn't do anything though. Why do we care?
+}
+static const struct snd_soc_ops sc7280_ops = {
.startup = sc7280_snd_startup,.shutdown = sc7280_snd_shutdown,.hw_params = sc7280_snd_hw_params,.hw_free = sc7280_snd_hw_free,.prepare = sc7280_snd_prepare,+};
+static const struct snd_soc_dapm_widget sc7280_snd_widgets[] = {
SND_SOC_DAPM_HP("Headphone Jack", NULL),SND_SOC_DAPM_MIC("Headset Mic", NULL),+};
+static int sc7280_snd_platform_probe(struct platform_device *pdev) +{
struct snd_soc_card *card;struct sc7280_snd_data *data;struct device *dev = &pdev->dev;struct snd_soc_dai_link *link;int ret, i;data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);if (!data)return -ENOMEM;card = &data->card;snd_soc_card_set_drvdata(card, data);card->owner = THIS_MODULE;card->driver_name = "SC7280";card->dev = dev;ret = qcom_snd_parse_of(card);if (ret)return ret;for_each_card_prelinks(card, i, link) {link->init = sc7280_init;link->ops = &sc7280_ops;}return devm_snd_soc_register_card(dev, card);+}
+static const struct of_device_id sc7280_snd_device_id[] = {
{.compatible = "google,sc7280-herobrine"},
Please add space after { and before }
{}+}; +MODULE_DEVICE_TABLE(of, sc7280_snd_device_id);