ASoC: intel: Add Broadwell rt5650 machine driver
Subsystems (3)
PATCH RESEND 1/1 ASoC: intel: Add Broadwell rt5650 machine driver
From: Ben Zhang <[email protected]>
Add machine driver for Broadwell + rt5650.
--- sound/soc/intel/boards/Kconfig | 11 + sound/soc/intel/boards/Makefile | 2 + sound/soc/intel/boards/bdw-rt5650.c | 310 ++++++++++++++++++ .../common/soc-acpi-intel-hsw-bdw-match.c | 5 + 4 files changed, 328 insertions(+) create mode 100644 sound/soc/intel/boards/bdw-rt5650.c
sound/soc/intel/boards/Kconfig +11 -0
@@ -31,6 +31,17 @@ endif ## SND_SOC_INTEL_HASWELL if SND_SOC_INTEL_HASWELL || SND_SOC_SOF_BROADWELL +config SND_SOC_INTEL_BDW_RT5650_MACH + tristate "Broadwell with RT5650 codec" + depends on SND_SOC_INTEL_SST && X86_INTEL_LPSS && DW_DMAC + select SND_COMPRESS_OFFLOAD + select SND_SOC_RT5645 + help + This adds the ASoC machine driver for Intel Broadwell platforms with + the RT5650 codec. + Say Y if you have such a device + If unsure select "N". + config SND_SOC_INTEL_BDW_RT5677_MACH tristate "Broadwell with RT5677 codec" depends on I2C
sound/soc/intel/boards/Makefile +2 -0
@@ -2,6 +2,7 @@ snd-soc-sst-haswell-objs := haswell.o snd-soc-sst-byt-rt5640-mach-objs := byt-rt5640.o snd-soc-sst-byt-max98090-mach-objs := byt-max98090.o +snd-soc-sst-bdw-rt5650-mach-objs := bdw-rt5650.o snd-soc-sst-bdw-rt5677-mach-objs := bdw-rt5677.o snd-soc-sst-broadwell-objs := broadwell.o snd-soc-sst-bxt-da7219_max98357a-objs := bxt_da7219_max98357a.o hda_dsp_common.o
@@ -37,6 +38,7 @@ obj-$(CONFIG_SND_SOC_INTEL_BXT_DA7219_MAX98357A_COMMON) += snd-soc-sst-bxt-da721 obj-$(CONFIG_SND_SOC_INTEL_BXT_RT298_MACH) += snd-soc-sst-bxt-rt298.o obj-$(CONFIG_SND_SOC_INTEL_GLK_RT5682_MAX98357A_MACH) += snd-soc-sst-glk-rt5682_max98357a.o obj-$(CONFIG_SND_SOC_INTEL_BROADWELL_MACH) += snd-soc-sst-broadwell.o +obj-$(CONFIG_SND_SOC_INTEL_BDW_RT5650_MACH) += snd-soc-sst-bdw-rt5650-mach.o obj-$(CONFIG_SND_SOC_INTEL_BDW_RT5677_MACH) += snd-soc-sst-bdw-rt5677-mach.o obj-$(CONFIG_SND_SOC_INTEL_BYTCR_RT5640_MACH) += snd-soc-sst-bytcr-rt5640.o obj-$(CONFIG_SND_SOC_INTEL_BYTCR_RT5651_MACH) += snd-soc-sst-bytcr-rt5651.o
sound/soc/intel/boards/bdw-rt5650.c new file +310 -0
310 lines not on this page · raw message
sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c +5 -0
@@ -29,6 +29,11 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_broadwell_machines[] = { .sof_fw_filename = "sof-bdw.ri", .sof_tplg_filename = "sof-bdw-rt286.tplg", }, + { + .id = "10EC5650", + .drv_name = "bdw-rt5650", + .fw_filename = "intel/IntcSST2.bin", + }, { .id = "RT5677CE", .drv_name = "bdw-rt5677",
Signature · 6 lines
2.24.0.393.g34dc348eaf-goog _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 3 lines · Curtis Malainey
From: Ben Zhang <[email protected]>
Add machine driver for Broadwell + rt5650.
Curtis, you may want to take a look at the comments posted on July 22. I quickly re-added the obvious ones below.
We can improve this a bit and make it SOF-ready - or at least avoid build conflicts.
Quoted 19 lines
Signed-off-by Bard Liao <[email protected]>Signed-off-by Ben Zhang <[email protected]>Signed-off-by Mac Chiang <[email protected]>Signed-off-by Jon Flatley <[email protected]>Signed-off-by Curtis Malainey <[email protected]>--- sound/soc/intel/boards/Kconfig | 11 + sound/soc/intel/boards/Makefile | 2 + sound/soc/intel/boards/bdw-rt5650.c | 310 ++++++++++++++++++ .../common/soc-acpi-intel-hsw-bdw-match.c | 5 + 4 files changed, 328 insertions(+)create mode 100644
sound/soc/intel/boards/bdw-rt5650.csound/soc/intel/boards/Kconfig +0
-0
sound/soc/intel/boards/Kconfig endif ## SND_SOC_INTEL_HASWELL · line 36
Quoted 6 lines
sound/soc/intel/boards/Kconfig +3
-0@@ -31,6 +31,17 @@ endif ## SND_SOC_INTEL_HASWELL if SND_SOC_INTEL_HASWELL || SND_SOC_SOF_BROADWELL +config SND_SOC_INTEL_BDW_RT5650_MACH + tristate "Broadwell with RT5650 codec" + depends on SND_SOC_INTEL_SST && X86_INTEL_LPSS && DW_DMAC
Intel sst is not needed
Also need to aligned with other machine drivers.
sound/soc/intel/boards/Kconfig endif ## SND_SOC_INTEL_HASWELL · line 37
Quoted 1 line
sound/soc/intel/boards/Kconfig +1
-0+ select SND_COMPRESS_OFFLOAD
not needed?
sound/soc/intel/boards/Kconfig endif ## SND_SOC_INTEL_HASWELL · line 46
Quoted 9 lines
sound/soc/intel/boards/Kconfig +9
-0+#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/gpio/consumer.h> +#include <linux/delay.h> +#include <sound/core.h> +#include <sound/pcm.h> +#include <sound/soc.h> +#include <sound/pcm_params.h> +#include <sound/jack.h>
sound/soc-acpi.h
Quoted 17 lines
sound/soc/intel/boards/Kconfig +16
-0+ +#include "../common/sst-dsp.h" +#include "../haswell/sst-haswell-ipc.h" + +static struct snd_soc_ops bdw_rt5650_ops = { + .hw_params = bdw_rt5650_hw_params, +}; + +static int bdw_rt5650_rtd_init(struct snd_soc_pcm_runtime *rtd) +{ + struct snd_soc_component *component = + snd_soc_rtdcom_lookup(rtd, DRV_NAME); + struct sst_pdata *pdata = dev_get_platdata(component->dev); + struct sst_hsw *broadwell = pdata->dsp; + int ret; +
sound/soc/intel/boards/Kconfig endif ## SND_SOC_INTEL_HASWELL
Quoted 10 lines
sound/soc/intel/boards/Kconfig +10
-0+ /* Set ADSP SSP port settings + * clock_divider = 4 means BCLK = MCLK/5 = 24MHz/5 = 4.8MHz + */ + ret = sst_hsw_device_set_config(broadwell, SST_HSW_DEVICE_SSP_0, + SST_HSW_DEVICE_MCLK_FREQ_24_MHZ, + SST_HSW_DEVICE_TDM_CLOCK_MASTER, 4); + if (ret < 0) { + dev_err(rtd->dev, "error: failed to set device config\n"); + return ret; + }
add ifdef for SOF
Quoted 21 lines
sound/soc/intel/boards/Kconfig +21
-0+ + return 0; +} + +static int bdw_rt5650_init(struct snd_soc_pcm_runtime *rtd) +{ + struct bdw_rt5650_priv *bdw_rt5650 = + snd_soc_card_get_drvdata(rtd->card); + struct snd_soc_component *component = rtd->codec_dai->component; + struct snd_soc_dai *codec_dai = rtd->codec_dai; + int ret; + + /* Enable codec ASRC function for Stereo DAC/Stereo1 ADC/DMIC/I2S1. + * The ASRC clock source is clk_i2s1_asrc. + */ + rt5645_sel_asrc_clk_src(component, + RT5645_DA_STEREO_FILTER | + RT5645_DA_MONO_L_FILTER | + RT5645_DA_MONO_R_FILTER | + RT5645_AD_STEREO_FILTER | + RT5645_AD_MONO_L_FILTER |
sound/soc/intel/boards/Kconfig
Quoted 10 lines
sound/soc/intel/boards/Kconfig +10
-0+ RT5645_AD_MONO_R_FILTER, + RT5645_CLK_SEL_I2S1_ASRC); + + /* TDM 4 slots 24 bit, set Rx & Tx bitmask to 4 active slots */ + ret = snd_soc_dai_set_tdm_slot(codec_dai, 0xF, 0xF, 4, 24); + + if (ret < 0) { + dev_err(rtd->dev, "can't set codec TDM slot %d\n", ret); + return ret; + }
move to use format defined by topology for SOF?
sound/soc/intel/boards/Kconfig
Quoted 4 lines
sound/soc/intel/boards/Kconfig +4
-0+/* ASoC machine driver for Broadwell DSP + RT5650 */ +static struct snd_soc_card bdw_rt5650_card = { + .name = "bdw-rt5650", + .owner = THIS_MODULE,
is this needed?
Quoted 12 lines
sound/soc/intel/boards/Kconfig +12
-0+ .dai_link = bdw_rt5650_dais, + .num_links = ARRAY_SIZE(bdw_rt5650_dais), + .dapm_widgets = bdw_rt5650_widgets, + .num_dapm_widgets = ARRAY_SIZE(bdw_rt5650_widgets), + .dapm_routes = bdw_rt5650_map, + .num_dapm_routes = ARRAY_SIZE(bdw_rt5650_map), + .controls = bdw_rt5650_controls, + .num_controls = ARRAY_SIZE(bdw_rt5650_controls), + .fully_routed = true, +}; + +static int bdw_rt5650_probe(struct platform_device *pdev)
sound/soc/intel/boards/Kconfig
Quoted 10 lines
sound/soc/intel/boards/Kconfig +10
-0+{ + struct bdw_rt5650_priv *bdw_rt5650; + + bdw_rt5650_card.dev = &pdev->dev; + + /* Allocate driver private struct */ + bdw_rt5650 = devm_kzalloc(&pdev->dev, sizeof(struct bdw_rt5650_priv), + GFP_KERNEL); + if (!bdw_rt5650) + return -ENOMEM;
platform override stuff needed.
Quoted 7 lines
sound/soc/intel/boards/Kconfig +7
-0+ snd_soc_card_set_drvdata(&bdw_rt5650_card, bdw_rt5650); + + return snd_soc_register_card(&bdw_rt5650_card); +} + +static int bdw_rt5650_remove(struct platform_device *pdev) +{
sound/soc/intel/boards/Kconfig
Quoted 10 lines
sound/soc/intel/boards/Kconfig +10
-0+ snd_soc_unregister_card(&bdw_rt5650_card); + return 0; +} + +static struct platform_driver bdw_rt5650_audio = { + .probe = bdw_rt5650_probe, + .remove = bdw_rt5650_remove, + .driver = { + .name = "bdw-rt5650", + .owner = THIS_MODULE,
is this needed?
Quoted 15 lines
sound/soc/intel/boards/Kconfig +10
-0+ }, +}; + +module_platform_driver(bdw_rt5650_audio) + +/* Module information */ +MODULE_AUTHOR("Ben Zhang <[email protected]>"); +MODULE_DESCRIPTION("Intel Broadwell RT5650 machine driver"); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:bdw-rt5650");sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c +0
-0
sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c struct snd_soc_acpi_mach snd_soc_acpi_intel_broadwell_machines[] = { · line 35
Quoted 7 lines
sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c +4
-0@@ -29,6 +29,11 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_broadwell_machines[] = { .sof_fw_filename = "sof-bdw.ri", .sof_tplg_filename = "sof-bdw-rt286.tplg", }, + { + .id = "10EC5650", + .drv_name = "bdw-rt5650", + .fw_filename = "intel/IntcSST2.bin",
add SOF files?
sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c struct snd_soc_acpi_mach snd_soc_acpi_intel_broadwell_machines[] = { · line 39
Quoted 5 lines
sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c +1
-0+ }, { .id = "RT5677CE", .drv_name = "bdw-rt5677",
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Curtis Malainey | Software Engineer | [email protected] | 650-898-3849
Quoted 6 lines · Pierre-Louis Bossart
Quoted 2 lines · Curtis Malainey
From: Ben Zhang <[email protected]>
Quoted 8 lines
Quoted 1 line
Add machine driver for Broadwell + rt5650.
Curtis, you may want to take a look at the comments posted on July 22. I quickly re-added the obvious ones below.
We can improve this a bit and make it SOF-ready - or at least avoid build conflicts.
Ah sorry about that, I missed that email and only found the email requesting which board this was. Yes, let's definitely make this SOF ready. I will update the patch and send V2 later today.
Quoted 1 line
Quoted 1 line
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 7 lines
sound/soc/intel/boards/bdw-rt5650.c line 261
Quoted 5 lines
sound/soc/intel/boards/bdw-rt5650.c new file +4
-0+/* ASoC machine driver for Broadwell DSP + RT5650 */ +static struct snd_soc_card bdw_rt5650_card = { + .name ="bdw-rt5650" , + .owner =THIS_MODULE ,is this needed?
Left over from older conventions, any harm in keeping it? All modules from that era appear to have it on the card.
Quoted 8 lines
Quoted 7 lines
sound/soc/intel/boards/bdw-rt5650.c new file +6
-0+ .dai_link = bdw_rt5650_dais, + .num_links = ARRAY_SIZE(bdw_rt5650_dais), + .dapm_widgets = bdw_rt5650_widgets, + .num_dapm_widgets = ARRAY_SIZE(bdw_rt5650_widgets), + .dapm_routes = bdw_rt5650_map, + .num_dapm_routes = ARRAY_SIZE(bdw_rt5650_map),
Quoted 8 lines
sound/soc/intel/boards/bdw-rt5650.c line 300
Quoted 6 lines
sound/soc/intel/boards/bdw-rt5650.c new file +6
-0+static struct platform_driver bdw_rt5650_audio = { + .probe = bdw_rt5650_probe, + .remove = bdw_rt5650_remove, + .driver = { + .name ="bdw-rt5650" , + .owner =THIS_MODULE ,is this needed?
Same as above comment
Quoted 3 lines
Review
Quoted 3 lines
(quoted diff) +2
-0+ }, +};
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 24 lines · Curtis Malainey
Quoted 7 lines
sound/soc/intel/boards/bdw-rt5650.c line 261
Quoted 5 lines
sound/soc/intel/boards/bdw-rt5650.c new file +4
-0+/* ASoC machine driver for Broadwell DSP + RT5650 */ +static struct snd_soc_card bdw_rt5650_card = { + .name ="bdw-rt5650" , + .owner =THIS_MODULE ,is this needed?
Left over from older conventions, any harm in keeping it? All modules from that era appear to have it on the card.
Quoted 15 lines
Quoted 14 lines
sound/soc/intel/boards/bdw-rt5650.c new file +12
-0+ .dai_link = bdw_rt5650_dais, + .num_links = ARRAY_SIZE(bdw_rt5650_dais), + .dapm_widgets = bdw_rt5650_widgets, + .num_dapm_widgets = ARRAY_SIZE(bdw_rt5650_widgets), + .dapm_routes = bdw_rt5650_map, + .num_dapm_routes =ARRAY_SIZE (bdw_rt5650_map), +static struct platform_driver bdw_rt5650_audio = { + .probe = bdw_rt5650_probe, + .remove = bdw_rt5650_remove, + .driver = { + .name ="bdw-rt5650" , + .owner =THIS_MODULE ,
Quoted 2 lines
Quoted 1 line
is this needed?
Same as above comment
I am pretty sure Coccinelle detects this pattern and would tell you the core takes care of the .owner for platform drivers. I can't recall for snd_soc_card.
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel