mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 18:43:33 +02:00
ASoC: Intel: avs: Add pcm3168a machine board
To support AVS-pcm3168a configuration add machine board connecting AVS platform component driver with pcm3168a codec one. Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://patch.msgid.link/20250203141051.2361323-5-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
7d92a38d67
commit
79ebb59620
|
|
@ -87,6 +87,16 @@ config SND_SOC_INTEL_AVS_MACH_NAU8825
|
|||
Say Y or m if you have such a device. This is a recommended option.
|
||||
If unsure select "N".
|
||||
|
||||
config SND_SOC_INTEL_AVS_MACH_PCM3168A
|
||||
tristate "pcm3168a I2S board"
|
||||
depends on I2C
|
||||
depends on MFD_INTEL_LPSS || COMPILE_TEST
|
||||
select SND_SOC_PCM3168A_I2C
|
||||
help
|
||||
This adds support for AVS with PCM3168A I2C codec configuration.
|
||||
Say Y or m if you have such a device. This is a recommended option.
|
||||
If unsure select "N".
|
||||
|
||||
config SND_SOC_INTEL_AVS_MACH_PROBE
|
||||
tristate "Probing (data) board"
|
||||
depends on DEBUG_FS
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ snd-soc-avs-max98927-y := max98927.o
|
|||
snd-soc-avs-max98357a-y := max98357a.o
|
||||
snd-soc-avs-max98373-y := max98373.o
|
||||
snd-soc-avs-nau8825-y := nau8825.o
|
||||
snd-soc-avs-pcm3168a-y := pcm3168a.o
|
||||
snd-soc-avs-probe-y := probe.o
|
||||
snd-soc-avs-rt274-y := rt274.o
|
||||
snd-soc-avs-rt286-y := rt286.o
|
||||
|
|
@ -27,6 +28,7 @@ obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_MAX98927) += snd-soc-avs-max98927.o
|
|||
obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_MAX98357A) += snd-soc-avs-max98357a.o
|
||||
obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_MAX98373) += snd-soc-avs-max98373.o
|
||||
obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_NAU8825) += snd-soc-avs-nau8825.o
|
||||
obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_PCM3168A) += snd-soc-avs-pcm3168a.o
|
||||
obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_PROBE) += snd-soc-avs-probe.o
|
||||
obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT274) += snd-soc-avs-rt274.o
|
||||
obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT286) += snd-soc-avs-rt286.o
|
||||
|
|
|
|||
143
sound/soc/intel/avs/boards/pcm3168a.c
Normal file
143
sound/soc/intel/avs/boards/pcm3168a.c
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
//
|
||||
// Copyright(c) 2024-2025 Intel Corporation
|
||||
//
|
||||
// Author: Cezary Rojewski <cezary.rojewski@intel.com>
|
||||
//
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/pcm.h>
|
||||
#include <sound/pcm_params.h>
|
||||
#include <sound/soc.h>
|
||||
|
||||
static const struct snd_soc_dapm_widget card_widgets[] = {
|
||||
SND_SOC_DAPM_HP("CPB Stereo HP 1", NULL),
|
||||
SND_SOC_DAPM_HP("CPB Stereo HP 2", NULL),
|
||||
SND_SOC_DAPM_HP("CPB Stereo HP 3", NULL),
|
||||
SND_SOC_DAPM_LINE("CPB Line Out", NULL),
|
||||
SND_SOC_DAPM_MIC("CPB Stereo Mic 1", NULL),
|
||||
SND_SOC_DAPM_MIC("CPB Stereo Mic 2", NULL),
|
||||
SND_SOC_DAPM_LINE("CPB Line In", NULL),
|
||||
};
|
||||
|
||||
static const struct snd_soc_dapm_route card_routes[] = {
|
||||
{ "CPB Stereo HP 1", NULL, "AOUT1L" },
|
||||
{ "CPB Stereo HP 1", NULL, "AOUT1R" },
|
||||
{ "CPB Stereo HP 2", NULL, "AOUT2L" },
|
||||
{ "CPB Stereo HP 2", NULL, "AOUT2R" },
|
||||
{ "CPB Stereo HP 3", NULL, "AOUT3L" },
|
||||
{ "CPB Stereo HP 3", NULL, "AOUT3R" },
|
||||
{ "CPB Line Out", NULL, "AOUT4L" },
|
||||
{ "CPB Line Out", NULL, "AOUT4R" },
|
||||
|
||||
{ "AIN1L", NULL, "CPB Stereo Mic 1" },
|
||||
{ "AIN1R", NULL, "CPB Stereo Mic 1" },
|
||||
{ "AIN2L", NULL, "CPB Stereo Mic 2" },
|
||||
{ "AIN2R", NULL, "CPB Stereo Mic 2" },
|
||||
{ "AIN3L", NULL, "CPB Line In" },
|
||||
{ "AIN3R", NULL, "CPB Line In" },
|
||||
};
|
||||
|
||||
static int avs_pcm3168a_be_fixup(struct snd_soc_pcm_runtime *runtime,
|
||||
struct snd_pcm_hw_params *params)
|
||||
{
|
||||
struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
|
||||
|
||||
/* Set SSP to 24 bit. */
|
||||
snd_mask_none(fmt);
|
||||
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SND_SOC_DAILINK_DEF(pcm3168a_dac,
|
||||
DAILINK_COMP_ARRAY(COMP_CODEC("i2c-PCM3168A:00", "pcm3168a-dac")));
|
||||
SND_SOC_DAILINK_DEF(pcm3168a_adc,
|
||||
DAILINK_COMP_ARRAY(COMP_CODEC("i2c-PCM3168A:00", "pcm3168a-adc")));
|
||||
SND_SOC_DAILINK_DEF(cpu_ssp0, DAILINK_COMP_ARRAY(COMP_CPU("SSP0 Pin")));
|
||||
SND_SOC_DAILINK_DEF(cpu_ssp2, DAILINK_COMP_ARRAY(COMP_CPU("SSP2 Pin")));
|
||||
|
||||
static int avs_create_dai_links(struct device *dev, struct snd_soc_dai_link **links, int *num_links)
|
||||
{
|
||||
struct snd_soc_dai_link_component *platform;
|
||||
struct snd_soc_dai_link *dl;
|
||||
const int num_dl = 2;
|
||||
|
||||
dl = devm_kcalloc(dev, num_dl, sizeof(*dl), GFP_KERNEL);
|
||||
platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL);
|
||||
if (!dl || !platform)
|
||||
return -ENOMEM;
|
||||
|
||||
platform->name = dev_name(dev);
|
||||
dl[0].num_cpus = 1;
|
||||
dl[0].num_codecs = 1;
|
||||
dl[0].platforms = platform;
|
||||
dl[0].num_platforms = 1;
|
||||
dl[0].dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP;
|
||||
dl[0].be_hw_params_fixup = avs_pcm3168a_be_fixup;
|
||||
dl[0].nonatomic = 1;
|
||||
dl[0].no_pcm = 1;
|
||||
memcpy(&dl[1], &dl[0], sizeof(*dl));
|
||||
|
||||
dl[0].name = "SSP0-Codec-dac";
|
||||
dl[0].cpus = cpu_ssp0;
|
||||
dl[0].codecs = pcm3168a_dac;
|
||||
dl[1].name = "SSP2-Codec-adc";
|
||||
dl[1].cpus = cpu_ssp2;
|
||||
dl[1].codecs = pcm3168a_adc;
|
||||
|
||||
*links = dl;
|
||||
*num_links = num_dl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int avs_pcm3168a_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct snd_soc_card *card;
|
||||
int ret;
|
||||
|
||||
card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL);
|
||||
if (!card)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = avs_create_dai_links(dev, &card->dai_link, &card->num_links);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
card->name = "avs_pcm3168a";
|
||||
card->dev = dev;
|
||||
card->owner = THIS_MODULE;
|
||||
card->dapm_widgets = card_widgets;
|
||||
card->num_dapm_widgets = ARRAY_SIZE(card_widgets);
|
||||
card->dapm_routes = card_routes;
|
||||
card->num_dapm_routes = ARRAY_SIZE(card_routes);
|
||||
card->fully_routed = true;
|
||||
|
||||
return devm_snd_soc_register_card(dev, card);
|
||||
}
|
||||
|
||||
static const struct platform_device_id avs_pcm3168a_driver_ids[] = {
|
||||
{
|
||||
.name = "avs_pcm3168a",
|
||||
},
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(platform, avs_pcm3168a_driver_ids);
|
||||
|
||||
static struct platform_driver avs_pcm3168a_driver = {
|
||||
.probe = avs_pcm3168a_probe,
|
||||
.driver = {
|
||||
.name = "avs_pcm3168a",
|
||||
.pm = &snd_soc_pm_ops,
|
||||
},
|
||||
.id_table = avs_pcm3168a_driver_ids,
|
||||
};
|
||||
|
||||
module_platform_driver(avs_pcm3168a_driver);
|
||||
|
||||
MODULE_DESCRIPTION("Intel pcm3168a machine driver");
|
||||
MODULE_AUTHOR("Cezary Rojewski <cezary.rojewski@intel.com>");
|
||||
MODULE_LICENSE("GPL");
|
||||
Loading…
Reference in New Issue
Block a user