162306a36Sopenharmony_ci// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) 262306a36Sopenharmony_ci// 362306a36Sopenharmony_ci// This file is provided under a dual BSD/GPLv2 license. When using or 462306a36Sopenharmony_ci// redistributing this file, you may do so under either license. 562306a36Sopenharmony_ci// 662306a36Sopenharmony_ci// Copyright(c) 2023 Advanced Micro Devices, Inc. 762306a36Sopenharmony_ci// 862306a36Sopenharmony_ci// Authors: Venkata Prasad Potturu <venkataprasad.potturu@amd.com> 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci/* 1162306a36Sopenharmony_ci * Hardware interface for Audio DSP on Vangogh platform 1262306a36Sopenharmony_ci */ 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#include <linux/platform_device.h> 1562306a36Sopenharmony_ci#include <linux/module.h> 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci#include "../ops.h" 1862306a36Sopenharmony_ci#include "../sof-audio.h" 1962306a36Sopenharmony_ci#include "acp.h" 2062306a36Sopenharmony_ci#include "acp-dsp-offset.h" 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ci#define I2S_HS_INSTANCE 0 2362306a36Sopenharmony_ci#define I2S_BT_INSTANCE 1 2462306a36Sopenharmony_ci#define I2S_SP_INSTANCE 2 2562306a36Sopenharmony_ci#define PDM_DMIC_INSTANCE 3 2662306a36Sopenharmony_ci#define I2S_HS_VIRTUAL_INSTANCE 4 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_cistatic struct snd_soc_dai_driver vangogh_sof_dai[] = { 2962306a36Sopenharmony_ci [I2S_HS_INSTANCE] = { 3062306a36Sopenharmony_ci .id = I2S_HS_INSTANCE, 3162306a36Sopenharmony_ci .name = "acp-sof-hs", 3262306a36Sopenharmony_ci .playback = { 3362306a36Sopenharmony_ci .rates = SNDRV_PCM_RATE_8000_96000, 3462306a36Sopenharmony_ci .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 3562306a36Sopenharmony_ci SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 3662306a36Sopenharmony_ci .channels_min = 2, 3762306a36Sopenharmony_ci .channels_max = 8, 3862306a36Sopenharmony_ci .rate_min = 8000, 3962306a36Sopenharmony_ci .rate_max = 96000, 4062306a36Sopenharmony_ci }, 4162306a36Sopenharmony_ci .capture = { 4262306a36Sopenharmony_ci .rates = SNDRV_PCM_RATE_8000_48000, 4362306a36Sopenharmony_ci .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 4462306a36Sopenharmony_ci SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 4562306a36Sopenharmony_ci /* Supporting only stereo for I2S HS controller capture */ 4662306a36Sopenharmony_ci .channels_min = 2, 4762306a36Sopenharmony_ci .channels_max = 2, 4862306a36Sopenharmony_ci .rate_min = 8000, 4962306a36Sopenharmony_ci .rate_max = 48000, 5062306a36Sopenharmony_ci }, 5162306a36Sopenharmony_ci }, 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ci [I2S_BT_INSTANCE] = { 5462306a36Sopenharmony_ci .id = I2S_BT_INSTANCE, 5562306a36Sopenharmony_ci .name = "acp-sof-bt", 5662306a36Sopenharmony_ci .playback = { 5762306a36Sopenharmony_ci .rates = SNDRV_PCM_RATE_8000_96000, 5862306a36Sopenharmony_ci .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 5962306a36Sopenharmony_ci SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 6062306a36Sopenharmony_ci .channels_min = 2, 6162306a36Sopenharmony_ci .channels_max = 8, 6262306a36Sopenharmony_ci .rate_min = 8000, 6362306a36Sopenharmony_ci .rate_max = 96000, 6462306a36Sopenharmony_ci }, 6562306a36Sopenharmony_ci .capture = { 6662306a36Sopenharmony_ci .rates = SNDRV_PCM_RATE_8000_48000, 6762306a36Sopenharmony_ci .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 6862306a36Sopenharmony_ci SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 6962306a36Sopenharmony_ci /* Supporting only stereo for I2S BT controller capture */ 7062306a36Sopenharmony_ci .channels_min = 2, 7162306a36Sopenharmony_ci .channels_max = 2, 7262306a36Sopenharmony_ci .rate_min = 8000, 7362306a36Sopenharmony_ci .rate_max = 48000, 7462306a36Sopenharmony_ci }, 7562306a36Sopenharmony_ci }, 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_ci [I2S_SP_INSTANCE] = { 7862306a36Sopenharmony_ci .id = I2S_SP_INSTANCE, 7962306a36Sopenharmony_ci .name = "acp-sof-sp", 8062306a36Sopenharmony_ci .playback = { 8162306a36Sopenharmony_ci .rates = SNDRV_PCM_RATE_8000_96000, 8262306a36Sopenharmony_ci .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 8362306a36Sopenharmony_ci SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 8462306a36Sopenharmony_ci .channels_min = 2, 8562306a36Sopenharmony_ci .channels_max = 8, 8662306a36Sopenharmony_ci .rate_min = 8000, 8762306a36Sopenharmony_ci .rate_max = 96000, 8862306a36Sopenharmony_ci }, 8962306a36Sopenharmony_ci .capture = { 9062306a36Sopenharmony_ci .rates = SNDRV_PCM_RATE_8000_48000, 9162306a36Sopenharmony_ci .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 9262306a36Sopenharmony_ci SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 9362306a36Sopenharmony_ci /* Supporting only stereo for I2S SP controller capture */ 9462306a36Sopenharmony_ci .channels_min = 2, 9562306a36Sopenharmony_ci .channels_max = 2, 9662306a36Sopenharmony_ci .rate_min = 8000, 9762306a36Sopenharmony_ci .rate_max = 48000, 9862306a36Sopenharmony_ci }, 9962306a36Sopenharmony_ci }, 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_ci [PDM_DMIC_INSTANCE] = { 10262306a36Sopenharmony_ci .id = PDM_DMIC_INSTANCE, 10362306a36Sopenharmony_ci .name = "acp-sof-dmic", 10462306a36Sopenharmony_ci .capture = { 10562306a36Sopenharmony_ci .rates = SNDRV_PCM_RATE_8000_48000, 10662306a36Sopenharmony_ci .formats = SNDRV_PCM_FMTBIT_S32_LE, 10762306a36Sopenharmony_ci .channels_min = 2, 10862306a36Sopenharmony_ci .channels_max = 4, 10962306a36Sopenharmony_ci .rate_min = 8000, 11062306a36Sopenharmony_ci .rate_max = 48000, 11162306a36Sopenharmony_ci }, 11262306a36Sopenharmony_ci }, 11362306a36Sopenharmony_ci 11462306a36Sopenharmony_ci [I2S_HS_VIRTUAL_INSTANCE] = { 11562306a36Sopenharmony_ci .id = I2S_HS_VIRTUAL_INSTANCE, 11662306a36Sopenharmony_ci .name = "acp-sof-hs-virtual", 11762306a36Sopenharmony_ci .playback = { 11862306a36Sopenharmony_ci .rates = SNDRV_PCM_RATE_8000_96000, 11962306a36Sopenharmony_ci .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 12062306a36Sopenharmony_ci SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 12162306a36Sopenharmony_ci .channels_min = 2, 12262306a36Sopenharmony_ci .channels_max = 8, 12362306a36Sopenharmony_ci .rate_min = 8000, 12462306a36Sopenharmony_ci .rate_max = 96000, 12562306a36Sopenharmony_ci }, 12662306a36Sopenharmony_ci .capture = { 12762306a36Sopenharmony_ci .rates = SNDRV_PCM_RATE_8000_48000, 12862306a36Sopenharmony_ci .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 12962306a36Sopenharmony_ci SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 13062306a36Sopenharmony_ci /* Supporting only stereo for I2S HS-Virtual controller capture */ 13162306a36Sopenharmony_ci .channels_min = 2, 13262306a36Sopenharmony_ci .channels_max = 2, 13362306a36Sopenharmony_ci .rate_min = 8000, 13462306a36Sopenharmony_ci .rate_max = 48000, 13562306a36Sopenharmony_ci }, 13662306a36Sopenharmony_ci }, 13762306a36Sopenharmony_ci}; 13862306a36Sopenharmony_ci 13962306a36Sopenharmony_ci/* Vangogh ops */ 14062306a36Sopenharmony_cistruct snd_sof_dsp_ops sof_vangogh_ops; 14162306a36Sopenharmony_ciEXPORT_SYMBOL_NS(sof_vangogh_ops, SND_SOC_SOF_AMD_COMMON); 14262306a36Sopenharmony_ci 14362306a36Sopenharmony_ciint sof_vangogh_ops_init(struct snd_sof_dev *sdev) 14462306a36Sopenharmony_ci{ 14562306a36Sopenharmony_ci const struct dmi_system_id *dmi_id; 14662306a36Sopenharmony_ci 14762306a36Sopenharmony_ci /* common defaults */ 14862306a36Sopenharmony_ci memcpy(&sof_vangogh_ops, &sof_acp_common_ops, sizeof(struct snd_sof_dsp_ops)); 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ci sof_vangogh_ops.drv = vangogh_sof_dai; 15162306a36Sopenharmony_ci sof_vangogh_ops.num_drv = ARRAY_SIZE(vangogh_sof_dai); 15262306a36Sopenharmony_ci 15362306a36Sopenharmony_ci dmi_id = dmi_first_match(acp_sof_quirk_table); 15462306a36Sopenharmony_ci if (dmi_id && dmi_id->driver_data) 15562306a36Sopenharmony_ci sof_vangogh_ops.load_firmware = acp_sof_load_signed_firmware; 15662306a36Sopenharmony_ci 15762306a36Sopenharmony_ci return 0; 15862306a36Sopenharmony_ci} 15962306a36Sopenharmony_ci 16062306a36Sopenharmony_ciMODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); 16162306a36Sopenharmony_ciMODULE_DESCRIPTION("VANGOGH SOF Driver"); 16262306a36Sopenharmony_ciMODULE_LICENSE("Dual BSD/GPL"); 163