Enable HDA Codec support on Intel Platforms
Subsystems (4)
v8 cover Enable HDA Codec support on Intel Platforms
Many Intel platforms (SKL, KBL) etc. in the market supports enhanced audio capabilities which also includes DSP processing. The default HDaudio legacy driver does not allow for the use of the DSP, this patch set makes it possible while reusing existing code for HDAudio codecs and without significant changes to the legacy driver.
This v8 is based on Marks' for-next branch - the merge of topic/drm_audio_component is not included here.
Tests were run successfully on multiple platforms (Dell XPS13, KBL NUC, APL NUC and LeafHill reference board). Both the HDaudio and HDMI outputs were tested.
Credits: all the initial code was written by Rakesh Ughreja, the rebase to broonie/for-next, cleanups and additional tests were done by Pierre Bossart.
TODO in future update:
1. fix the HDMI jack detection which only works after the mixer values are set, which isn't practical for headless devices always connected (this is a problem in the hdac_hdmi codec that was present before this series was submitted)
2. when the screen goes blank, HDMI playback stops. This isn't related to this patchset since we rely on the existing hdac_hdmi codec, but will need additional investigations.
Changes v8: (comments from Takashi)
- move hda_codec.h to include/sound (from sound/pci/hda)
- remove unnecessary includes (local.h)
- remove Kconfig option to control HDaudio suppport
Changes v7
- fix route count for headless boards such as Up2 to enable all 3 iDisp routes (only iDisp3 was set-up due to a bad macro).
Changes v6 (comments from Mark and Takashi)
- simplify Kconfig options, remove FORCE for now and make code simpler
- change SPDIX style to C++ for C files
- add log message if invalid configuration reached
- remove static int counter, added private counter in context instead
- fixed a couple of indendation issues to make checkpatch.pl --strict happy
Changes v5 (comments from Vinod)
- fix SPDIF style across patches
- patch 1: update commit message to remove reference to "fix"
- patch 3: remove platform name assignment and Xmas tree style
- patch 7: simplify error handling, add missing _put() on errors, remove tests on ops, add switch statement, fix alignment
- patch 8: fix indentation issues, use bool instead of tristate
Changes v4:
- rebase/update on Takashi's topic/drm_audio_component branch
- changes in the HDaudio detection to avoid adding a fake ACPI ID
- new Kconfigs to control HDaudio detection
Changes v3:
- port to component model
- additional tests on ApolloLake and KabyLake NUC devices
- cleanups (alignment, typos, etc)
Changes v2:
- Resolved review comments and rebased to latest kernel.
- added module load support for codec drivers.
Pierre-Louis Bossart (2):
ALSA: hda: move hda_codec.h to include/sound
ASoC: Intel: common: add table for HDA-based platforms
Rakesh Ughreja (5):
ASoC: Intel: Boards: Machine driver for SKL+ w/ HDAudio codecs
ASoC: Intel: Skylake: use HDAudio if ACPI enumeration fails
ASoC: Intel: Skylake: add HDA BE DAIs
ASoC: Intel: Skylake: use hda_bus instead of hdac_bus
ASoC: hdac_hda: add asoc extension for legacy HDA codec drivers
{sound/pci/hda => include/sound}/hda_codec.h | 0
include/sound/soc-acpi-intel-match.h | 6 +
sound/pci/hda/hda_auto_parser.c | 2 +-
sound/pci/hda/hda_beep.h | 2 +-
sound/pci/hda/hda_bind.c | 14 +-
sound/pci/hda/hda_codec.c | 2 +-
sound/pci/hda/hda_controller.h | 2 +-
sound/pci/hda/hda_eld.c | 2 +-
sound/pci/hda/hda_generic.c | 2 +-
sound/pci/hda/hda_hwdep.c | 2 +-
sound/pci/hda/hda_intel.c | 2 +-
sound/pci/hda/hda_jack.c | 2 +-
sound/pci/hda/hda_proc.c | 2 +-
sound/pci/hda/hda_sysfs.c | 2 +-
sound/pci/hda/hda_tegra.c | 2 +-
sound/pci/hda/patch_analog.c | 2 +-
sound/pci/hda/patch_ca0110.c | 2 +-
sound/pci/hda/patch_ca0132.c | 2 +-
sound/pci/hda/patch_cirrus.c | 2 +-
sound/pci/hda/patch_cmedia.c | 2 +-
sound/pci/hda/patch_conexant.c | 2 +-
sound/pci/hda/patch_hdmi.c | 2 +-
sound/pci/hda/patch_realtek.c | 2 +-
sound/pci/hda/patch_si3054.c | 2 +-
sound/pci/hda/patch_sigmatel.c | 2 +-
sound/pci/hda/patch_via.c | 2 +-
sound/soc/codecs/Kconfig | 5 +
sound/soc/codecs/Makefile | 2 +
sound/soc/codecs/hdac_hda.c | 484 ++++++++++++++++++
sound/soc/codecs/hdac_hda.h | 24 +
sound/soc/intel/boards/Kconfig | 9 +
sound/soc/intel/boards/Makefile | 2 +
sound/soc/intel/boards/skl_hda_dsp_common.c | 127 +++++
sound/soc/intel/boards/skl_hda_dsp_common.h | 38 ++
sound/soc/intel/boards/skl_hda_dsp_generic.c | 182 +++++++
sound/soc/intel/common/Makefile | 3 +-
.../intel/common/soc-acpi-intel-hda-match.c | 40 ++
sound/soc/intel/skylake/skl-pcm.c | 70 ++-
sound/soc/intel/skylake/skl.c | 96 +++-
sound/soc/intel/skylake/skl.h | 12 +-
40 files changed, 1109 insertions(+), 51 deletions(-)
rename {sound/pci/hda => include/sound}/hda_codec.h (100%)
create mode 100644 sound/soc/codecs/hdac_hda.c
create mode 100644 sound/soc/codecs/hdac_hda.h
create mode 100644 sound/soc/intel/boards/skl_hda_dsp_common.c
create mode 100644 sound/soc/intel/boards/skl_hda_dsp_common.h
create mode 100644 sound/soc/intel/boards/skl_hda_dsp_generic.c
create mode 100644 sound/soc/intel/common/soc-acpi-intel-hda-match.cSignature · 1 line
2.17.1
PATCH v8 1/7 ALSA: hda: move hda_codec.h to include/sound
As suggested by Takashi, move this header file to make it easier to include from e.g. the Intel Skylake driver in follow-up patches
---
{sound/pci/hda => include/sound}/hda_codec.h | 0
sound/pci/hda/hda_auto_parser.c | 2 +-
sound/pci/hda/hda_beep.h | 2 +-
sound/pci/hda/hda_bind.c | 2 +-
sound/pci/hda/hda_codec.c | 2 +-
sound/pci/hda/hda_controller.h | 2 +-
sound/pci/hda/hda_eld.c | 2 +-
sound/pci/hda/hda_generic.c | 2 +-
sound/pci/hda/hda_hwdep.c | 2 +-
sound/pci/hda/hda_intel.c | 2 +-
sound/pci/hda/hda_jack.c | 2 +-
sound/pci/hda/hda_proc.c | 2 +-
sound/pci/hda/hda_sysfs.c | 2 +-
sound/pci/hda/hda_tegra.c | 2 +-
sound/pci/hda/patch_analog.c | 2 +-
sound/pci/hda/patch_ca0110.c | 2 +-
sound/pci/hda/patch_ca0132.c | 2 +-
sound/pci/hda/patch_cirrus.c | 2 +-
sound/pci/hda/patch_cmedia.c | 2 +-
sound/pci/hda/patch_conexant.c | 2 +-
sound/pci/hda/patch_hdmi.c | 2 +-
sound/pci/hda/patch_realtek.c | 2 +-
sound/pci/hda/patch_si3054.c | 2 +-
sound/pci/hda/patch_sigmatel.c | 2 +-
sound/pci/hda/patch_via.c | 2 +-
25 files changed, 24 insertions(+), 24 deletions(-)
rename {sound/pci/hda => include/sound}/hda_codec.h (100%)include/sound/hda_codec.h renamed from sound/pci/hda/hda_codec.h +0 -0
sound/pci/hda/hda_auto_parser.c +1 -1
@@ -13,7 +13,7 @@#include <linux/export.h> #include <linux/sort.h> #include <sound/core.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include "hda_local.h" #include "hda_auto_parser.h"
sound/pci/hda/hda_beep.h +1 -1
@@ -9,7 +9,7 @@#ifndef __SOUND_HDA_BEEP_H#define __SOUND_HDA_BEEP_H -#include "hda_codec.h" +#include <sound/hda_codec.h> #define HDA_BEEP_MODE_OFF 0#define HDA_BEEP_MODE_ON 1
sound/pci/hda/hda_bind.c +1 -1
@@ -11,7 +11,7 @@#include <linux/pm.h> #include <linux/pm_runtime.h> #include <sound/core.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include "hda_local.h" /*
sound/pci/hda/hda_codec.c +1 -1
@@ -27,7 +27,7 @@#include <linux/pm.h> #include <linux/pm_runtime.h> #include <sound/core.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include <sound/asoundef.h> #include <sound/tlv.h> #include <sound/initval.h>
sound/pci/hda/hda_controller.h +1 -1
@@ -20,7 +20,7 @@#include <sound/core.h> #include <sound/pcm.h> #include <sound/initval.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include <sound/hda_register.h> #define AZX_MAX_CODECS HDA_MAX_CODECS
sound/pci/hda/hda_eld.c +1 -1
@@ -27,7 +27,7 @@#include <sound/core.h> #include <asm/unaligned.h> #include <sound/hda_chmap.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include "hda_local.h" enum eld_versions {
sound/pci/hda/hda_generic.c +1 -1
@@ -32,7 +32,7 @@#include <sound/core.h> #include <sound/jack.h> #include <sound/tlv.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include "hda_local.h" #include "hda_auto_parser.h" #include "hda_jack.h"
sound/pci/hda/hda_hwdep.c +1 -1
@@ -23,7 +23,7 @@#include <linux/compat.h> #include <linux/nospec.h> #include <sound/core.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include "hda_local.h" #include <sound/hda_hwdep.h> #include <sound/minors.h>
sound/pci/hda/hda_intel.c +1 -1
@@ -63,7 +63,7 @@#include <linux/vgaarb.h> #include <linux/vga_switcheroo.h> #include <linux/firmware.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include "hda_controller.h" #include "hda_intel.h"
sound/pci/hda/hda_jack.c +1 -1
@@ -15,7 +15,7 @@#include <sound/core.h> #include <sound/control.h> #include <sound/jack.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include "hda_local.h" #include "hda_auto_parser.h" #include "hda_jack.h"
sound/pci/hda/hda_proc.c +1 -1
@@ -25,7 +25,7 @@#include <linux/slab.h> #include <sound/core.h> #include <linux/module.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include "hda_local.h" static int dump_coef =-1 ;
sound/pci/hda/hda_sysfs.c +1 -1
@@ -14,7 +14,7 @@#include <linux/string.h> #include <linux/export.h> #include <sound/core.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include "hda_local.h" #include <sound/hda_hwdep.h> #include <sound/minors.h>
sound/pci/hda/hda_tegra.c +1 -1
@@ -35,7 +35,7 @@#include <sound/core.h> #include <sound/initval.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include "hda_controller.h" /* Defines for Nvidia Tegra HDA support */
sound/pci/hda/patch_analog.c +1 -1
@@ -24,7 +24,7 @@#include <linux/module.h> #include <sound/core.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include "hda_local.h" #include "hda_auto_parser.h" #include "hda_beep.h"
sound/pci/hda/patch_ca0110.c +1 -1
@@ -22,7 +22,7 @@#include <linux/slab.h> #include <linux/module.h> #include <sound/core.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include "hda_local.h" #include "hda_auto_parser.h" #include "hda_jack.h"
sound/pci/hda/patch_ca0132.c +1 -1
@@ -32,7 +32,7 @@#include <linux/io.h> #include <linux/pci.h> #include <sound/core.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include "hda_local.h" #include "hda_auto_parser.h" #include "hda_jack.h"
sound/pci/hda/patch_cirrus.c +1 -1
@@ -23,7 +23,7 @@#include <linux/module.h> #include <sound/core.h> #include <sound/tlv.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include "hda_local.h" #include "hda_auto_parser.h" #include "hda_jack.h"
sound/pci/hda/patch_cmedia.c +1 -1
@@ -25,7 +25,7 @@#include <linux/slab.h> #include <linux/module.h> #include <sound/core.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include "hda_local.h" #include "hda_auto_parser.h" #include "hda_jack.h"
sound/pci/hda/patch_conexant.c +1 -1
@@ -27,7 +27,7 @@#include <sound/core.h> #include <sound/jack.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include "hda_local.h" #include "hda_auto_parser.h" #include "hda_beep.h"
sound/pci/hda/patch_hdmi.c +1 -1
@@ -41,7 +41,7 @@#include <sound/hdaudio.h> #include <sound/hda_i915.h> #include <sound/hda_chmap.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include "hda_local.h" #include "hda_jack.h"
sound/pci/hda/patch_realtek.c +1 -1
@@ -32,7 +32,7 @@#include <linux/input.h> #include <sound/core.h> #include <sound/jack.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include "hda_local.h" #include "hda_auto_parser.h" #include "hda_jack.h"
sound/pci/hda/patch_si3054.c +1 -1
@@ -27,7 +27,7 @@#include <linux/slab.h> #include <linux/module.h> #include <sound/core.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include "hda_local.h" /* si3054 verbs */
sound/pci/hda/patch_sigmatel.c +1 -1
@@ -32,7 +32,7 @@#include <linux/module.h> #include <sound/core.h> #include <sound/jack.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include "hda_local.h" #include "hda_auto_parser.h" #include "hda_beep.h"
sound/pci/hda/patch_via.c +1 -1
@@ -52,7 +52,7 @@#include <linux/module.h> #include <sound/core.h> #include <sound/asoundef.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include "hda_local.h" #include "hda_auto_parser.h" #include "hda_jack.h"
Signature · 1 line
2.17.1
PATCH v8 2/7 ASoC: Intel: common: add table for HDA-based platforms
In reply to Pierre-Louis BossartExpose a table containing machine driver information for HDAudio-based platforms handled by ASoC on Intel hardware.
We only set constant values that are valid across multiple platforms. The firmware name used by the DSP will be set dynamically for each platform.
The table is made of a single entry for now, if we need more complicated set-up where HDAudio is mixed with ACPI-enumerated devices (I2C, SoundWire) then we'd expect the differentiation to be handled through information provided by the BIOS (as done for KBL Chromebooks).
--- include/sound/soc-acpi-intel-match.h | 6 +++ sound/soc/intel/common/Makefile | 3 +- .../intel/common/soc-acpi-intel-hda-match.c | 40 +++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 sound/soc/intel/common/soc-acpi-intel-hda-match.c
include/sound/soc-acpi-intel-match.h +6 -0
@@ -25,4 +25,10 @@ extern struct snd_soc_acpi_mach snd_soc_acpi_intel_bxt_machines[];extern struct snd_soc_acpi_mach snd_soc_acpi_intel_glk_machines[];extern struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_machines[]; +/* +* generic table used for HDA codec-based platforms, possibly with +* additional ACPI-enumerated codecs +*/ +extern struct snd_soc_acpi_mach snd_soc_acpi_intel_hda_machines[]; +#endif
sound/soc/intel/common/Makefile +2 -1
@@ -7,7 +7,8 @@ snd-soc-acpi-intel-match-objs := soc-acpi-intel-byt-match.o soc-acpi-intel-cht-m soc-acpi-intel-hsw-bdw-match.o \ soc-acpi-intel-skl-match.o soc-acpi-intel-kbl-match.o \ soc-acpi-intel-bxt-match.o soc-acpi-intel-glk-match.o \ - soc-acpi-intel-cnl-match.o + soc-acpi-intel-cnl-match.o \ + soc-acpi-intel-hda-match.o obj-$(CONFIG_SND_SOC_INTEL_SST) += snd-soc-sst-dsp.o snd-soc-sst-ipc.o obj-$(CONFIG_SND_SOC_INTEL_SST_ACPI) += snd-soc-sst-acpi.o
sound/soc/intel/common/soc-acpi-intel-hda-match.c new file +40 -0
@@ -0,0 +1,40 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (c) 2018, Intel Corporation. + +/* +* soc-apci-intel-hda-match.c - tables and support for HDA+ACPI enumeration. +* +*/ + +#include <sound/soc-acpi.h> +#include <sound/soc-acpi-intel-match.h> +#include "../skylake/skl.h" + +static struct skl_machine_pdata hda_pdata = { + .use_tplg_pcm = true, +}; + +struct snd_soc_acpi_mach snd_soc_acpi_intel_hda_machines[] = { + { +/* .id is not used in this file */ + .drv_name ="skl_hda_dsp_generic" , + +/* .fw_filename is dynamically set in skylake driver */ + +/* .sof_fw_filename is dynamically set in sof/intel driver */ + + .sof_tplg_filename ="intel/sof-hda-generic.tplg" , + +/* +* .machine_quirk and .quirk_data are not used here but +* can be used if we need a more complicated machine driver +* combining HDA+other device (e.g. DMIC). +*/ + .pdata = &hda_pdata, + }, + {}, +}; +EXPORT_SYMBOL_GPL (snd_soc_acpi_intel_hda_machines); + +MODULE_LICENSE ("GPL v2" ); +MODULE_DESCRIPTION ("Intel Common ACPI Match module" );
Signature · 1 line
2.17.1
PATCH v8 3/7 ASoC: Intel: Boards: Machine driver for SKL+ w/ HDAudio codecs
In reply to Pierre-Louis BossartFrom: Rakesh Ughreja <[email protected]>
Add machine driver for Intel platforms (SKL/KBL/BXT/APL) with HDA and iDisp codecs. This patch adds support for only iDisp (HDMI/DP) codec. In the following patches support for HDA codecs will be added.
This should work for other Intel platforms as well e.g. GLK,CNL however this series is not tested on all the platforms.
--- sound/soc/intel/boards/Kconfig | 8 ++ sound/soc/intel/boards/Makefile | 2 + sound/soc/intel/boards/skl_hda_dsp_common.c | 103 +++++++++++++ sound/soc/intel/boards/skl_hda_dsp_common.h | 38 +++++ sound/soc/intel/boards/skl_hda_dsp_generic.c | 144 +++++++++++++++++++ sound/soc/intel/skylake/skl.h | 2 + 6 files changed, 297 insertions(+) create mode 100644 sound/soc/intel/boards/skl_hda_dsp_common.c create mode 100644 sound/soc/intel/boards/skl_hda_dsp_common.h create mode 100644 sound/soc/intel/boards/skl_hda_dsp_generic.c
sound/soc/intel/boards/Kconfig +8 -0
@@ -279,6 +279,14 @@ config SND_SOC_INTEL_KBL_DA7219_MAX98357A_MACH This adds support for ASoC Onboard Codec I2S machine driver. This will create an alsa sound card for DA7219 + MAX98357A I2S audio codec. Say Y if you have such a device. + +config SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH + tristate "SKL/KBL/BXT/APL with HDA Codecs" + select SND_SOC_HDAC_HDMI + help + This adds support for ASoC machine driver for Intel platforms + SKL/KBL/BXT/APL with iDisp, HDA audio codecs. + Say Y or m if you have such a device. This is a recommended option. If unsure select "N". config SND_SOC_INTEL_GLK_RT5682_MAX98357A_MACH
sound/soc/intel/boards/Makefile +2 -0
@@ -20,6 +20,7 @@ snd-soc-kbl_da7219_max98357a-objs := kbl_da7219_max98357a.o snd-soc-kbl_rt5663_max98927-objs := kbl_rt5663_max98927.o snd-soc-kbl_rt5663_rt5514_max98927-objs := kbl_rt5663_rt5514_max98927.o snd-soc-skl_rt286-objs := skl_rt286.o +snd-soc-skl_hda_dsp-objs := skl_hda_dsp_generic.o skl_hda_dsp_common.o snd-skl_nau88l25_max98357a-objs := skl_nau88l25_max98357a.o snd-soc-skl_nau88l25_ssm4567-objs := skl_nau88l25_ssm4567.o
@@ -46,3 +47,4 @@ obj-$(CONFIG_SND_SOC_INTEL_KBL_RT5663_RT5514_MAX98927_MACH) += snd-soc-kbl_rt566 obj-$(CONFIG_SND_SOC_INTEL_SKL_RT286_MACH) += snd-soc-skl_rt286.o obj-$(CONFIG_SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH) += snd-skl_nau88l25_max98357a.o obj-$(CONFIG_SND_SOC_INTEL_SKL_NAU88L25_SSM4567_MACH) += snd-soc-skl_nau88l25_ssm4567.o +obj-$(CONFIG_SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH) += snd-soc-skl_hda_dsp.o
sound/soc/intel/boards/skl_hda_dsp_common.c new file +103 -0
103 lines not on this page · raw message
sound/soc/intel/boards/skl_hda_dsp_common.h new file +38 -0
@@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright(c) 2015-18 Intel Corporation. +*/ + +/* +* This file defines data structures used in Machine Driver for Intel +* platforms with HDA Codecs. +*/ + +#ifndef __SOUND_SOC_HDA_DSP_COMMON_H +#define __SOUND_SOC_HDA_DSP_COMMON_H +#include <linux/module.h> +#include <linux/platform_device.h> +#include <sound/core.h> +#include <sound/jack.h> + +#define HDA_DSP_MAX_BE_DAI_LINKS 3 + +struct skl_hda_hdmi_pcm { +struct list_head head; +struct snd_soc_dai *codec_dai; +struct snd_soc_jack hdmi_jack; +int device; +}; + +struct skl_hda_private { +struct list_head hdmi_pcm_list; +int pcm_count; +int dai_index; +const char *platform_name; +}; + +extern struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS ]; +int skl_hda_hdmi_jack_init (struct snd_soc_card *card); +int skl_hda_hdmi_add_pcm (struct snd_soc_card *card,int device); + +#endif /* __SOUND_SOC_HDA_DSP_COMMON_H */
sound/soc/intel/boards/skl_hda_dsp_generic.c new file +144 -0
144 lines not on this page · raw message
sound/soc/intel/skylake/skl.h +2 -0
@@ -117,6 +117,8 @@ struct skl_dma_params {struct skl_machine_pdata {u32 dmic_num;bool use_tplg_pcm;/* use dais and dai links from topology */ +const char *platform; +u32 codec_mask; };struct skl_dsp_ops {
Signature · 1 line
2.17.1
PATCH v8 4/7 ASoC: Intel: Skylake: use HDAudio if ACPI enumeration fails
In reply to Pierre-Louis BossartFrom: Rakesh Ughreja <[email protected]>
When no I2S based codec entries are found in the BIOS, check if there are any HDA codecs detected on the bus. Based on the number of codecs found take appropriate action in machine driver. If there are two HDA codecs i.e. iDisp + HDA found on the bus, register DAIs and DAI links for both. If only one codec i.e. iDisp is found then load only iDisp machine driver.
--- sound/soc/intel/skylake/skl.c | 38 ++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-)
sound/soc/intel/skylake/skl.c +33 -5
@@ -472,6 +472,25 @@ static struct skl_ssp_clk skl_ssp_clks[] = { {.name = "ssp5_sclkfs"}, }; +static struct snd_soc_acpi_mach *skl_find_hda_machine (struct skl *skl, +struct snd_soc_acpi_mach *machines) +{ +struct hdac_bus *bus =skl_to_bus (skl); +struct snd_soc_acpi_mach *mach; + +/* check if we have any codecs detected on bus */ +if (bus->codec_mask ==0 ) +return NULL ; + +/* point to common table */ + mach = snd_soc_acpi_intel_hda_machines; + +/* all entries in the machine table use the same firmware */ + mach->fw_filename = machines->fw_filename; + +return mach; +} +static int skl_find_machine (struct skl *skl,void *driver_data) {struct hdac_bus *bus =skl_to_bus (skl);
@@ -479,9 +498,13 @@ static int skl_find_machine(struct skl *skl, void *driver_data)struct skl_machine_pdata *pdata; mach =snd_soc_acpi_find_machine (mach); -if (mach ==NULL ) { -dev_err (bus->dev,"No matching machine driver found\n" ); -return -ENODEV ; +if (!mach) { +dev_dbg (bus->dev,"No matching I2S machine driver found\n" ); + mach =skl_find_hda_machine (skl, driver_data); +if (!mach) { +dev_err (bus->dev,"No matching machine driver found\n" ); +return -ENODEV ; + } } skl->mach = mach;
@@ -498,8 +521,9 @@ static int skl_find_machine(struct skl *skl, void *driver_data)static int skl_machine_device_register (struct skl *skl) { -struct hdac_bus *bus =skl_to_bus (skl);struct snd_soc_acpi_mach *mach = skl->mach; +struct hdac_bus *bus =skl_to_bus (skl); +struct skl_machine_pdata *pdata;struct platform_device *pdev;int ret;
@@ -516,8 +540,12 @@ static int skl_machine_device_register(struct skl *skl)return -EIO ; } -if (mach->pdata) +if (mach->pdata) { + pdata = (struct skl_machine_pdata *)mach->pdata; + pdata->platform =dev_name (bus->dev); + pdata->codec_mask = bus->codec_mask;dev_set_drvdata (&pdev->dev, mach->pdata); + } skl->i2s_dev = pdev;
Signature · 1 line
2.17.1
PATCH v8 5/7 ASoC: Intel: Skylake: add HDA BE DAIs
In reply to Pierre-Louis BossartFrom: Rakesh Ughreja <[email protected]>
Add support for HDA BE DAIs in SKL platform driver.
--- sound/soc/intel/skylake/skl-pcm.c | 70 +++++++++++++++++++++++++------ 1 file changed, 58 insertions(+), 12 deletions(-)
sound/soc/intel/skylake/skl-pcm.c +58 -12
@@ -32,6 +32,7 @@#define HDA_MONO 1#define HDA_STEREO 2#define HDA_QUAD 4 +#define HDA_MAX 8static const struct snd_pcm_hardware azx_pcm_hw = { .info = (SNDRV_PCM_INFO_MMAP |
@@ -569,7 +570,10 @@ static int skl_link_hw_params(struct snd_pcm_substream *substream, stream_tag =hdac_stream (link_dev)->stream_tag;/* set the stream tag in the codec dai dma params */ -snd_soc_dai_set_tdm_slot (codec_dai, stream_tag,0 ,0 ,0 ); +if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) +snd_soc_dai_set_tdm_slot (codec_dai, stream_tag,0 ,0 ,0 ); +else +snd_soc_dai_set_tdm_slot (codec_dai,0 , stream_tag,0 ,0 ); p_params.s_fmt =snd_pcm_format_width (params_format (params)); p_params.ch =params_channels (params);
@@ -995,21 +999,63 @@ static struct snd_soc_dai_driver skl_platform_dai[] = { }, }, { - .name = "HD-Codec Pin", + .name = "Analog CPU DAI", .ops = &skl_link_dai_ops, .playback = { - .stream_name = "HD-Codec Tx", - .channels_min = HDA_STEREO, - .channels_max = HDA_STEREO, - .rates = SNDRV_PCM_RATE_48000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .stream_name = "Analog CPU Playback", + .channels_min = HDA_MONO, + .channels_max = HDA_MAX, + .rates = SNDRV_PCM_RATE_8000_192000, + .formats =SNDRV_PCM_FMTBIT_S16_LE |SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S32_LE, }, .capture = { - .stream_name = "HD-Codec Rx", - .channels_min = HDA_STEREO, - .channels_max = HDA_STEREO, - .rates = SNDRV_PCM_RATE_48000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .stream_name = "Analog CPU Capture", + .channels_min = HDA_MONO, + .channels_max = HDA_MAX, + .rates = SNDRV_PCM_RATE_8000_192000, + .formats =SNDRV_PCM_FMTBIT_S16_LE |SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S32_LE, + }, +}, +{ + .name = "Alt Analog CPU DAI", + .ops = &skl_link_dai_ops, + .playback = { + .stream_name = "Alt Analog CPU Playback", + .channels_min = HDA_MONO, + .channels_max = HDA_MAX, + .rates = SNDRV_PCM_RATE_8000_192000, + .formats =SNDRV_PCM_FMTBIT_S16_LE |SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S32_LE, + }, + .capture = { + .stream_name = "Alt Analog CPU Capture", + .channels_min = HDA_MONO, + .channels_max = HDA_MAX, + .rates = SNDRV_PCM_RATE_8000_192000, + .formats =SNDRV_PCM_FMTBIT_S16_LE |SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S32_LE, + }, +}, +{ + .name = "Digital CPU DAI", + .ops = &skl_link_dai_ops, + .playback = { + .stream_name = "Digital CPU Playback", + .channels_min = HDA_MONO, + .channels_max = HDA_MAX, + .rates = SNDRV_PCM_RATE_8000_192000, + .formats =SNDRV_PCM_FMTBIT_S16_LE |SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S32_LE, + }, + .capture = { + .stream_name = "Digital CPU Capture", + .channels_min = HDA_MONO, + .channels_max = HDA_MAX, + .rates = SNDRV_PCM_RATE_8000_192000, + .formats =SNDRV_PCM_FMTBIT_S16_LE |SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S32_LE, }, }, };
Signature · 1 line
2.17.1
PATCH v8 6/7 ASoC: Intel: Skylake: use hda_bus instead of hdac_bus
In reply to Pierre-Louis BossartFrom: Rakesh Ughreja <[email protected]>
Use hda_bus instead of hdac_bus in the SKL ASoC platform driver to enable reuse of legacy HDA codec drivers.
--- sound/soc/intel/skylake/skl.c | 11 +++++++++-- sound/soc/intel/skylake/skl.h | 10 +++++++--- 2 files changed, 16 insertions(+), 5 deletions(-)
sound/soc/intel/skylake/skl.c +9 -2
@@ -33,6 +33,7 @@#include <sound/hda_register.h> #include <sound/hdaudio.h> #include <sound/hda_i915.h> +#include <sound/hda_codec.h> #include "skl.h" #include "skl-sst-dsp.h" #include "skl-sst-ipc.h"
@@ -673,7 +674,7 @@ static int probe_codec(struct hdac_bus *bus, int addr)mutex_unlock (&bus->cmd_mutex);if (res ==-1 )return -EIO ; -dev_dbg (bus->dev,"codec #%d probed OK\n" , addr); +dev_dbg (bus->dev,"codec #%d probed OK: %x\n" , addr, res); hdev =devm_kzalloc (&skl->pci->dev,sizeof (*hdev),GFP_KERNEL );if (!hdev)
@@ -816,7 +817,7 @@ static int skl_create(struct pci_dev *pci, {struct skl *skl;struct hdac_bus *bus; - +struct hda_bus *hbus;int err; *rskl =NULL ;
@@ -831,6 +832,7 @@ static int skl_create(struct pci_dev *pci,return -ENOMEM ; } + hbus =skl_to_hbus (skl); bus =skl_to_bus (skl);snd_hdac_ext_bus_init (bus, &pci->dev, &bus_core_ops, io_ops,NULL ); bus->use_posbuf =1 ;
@@ -838,6 +840,11 @@ static int skl_create(struct pci_dev *pci,INIT_WORK (&skl->probe_work, skl_probe_work); bus->bdl_pos_adj =0 ; +mutex_init (&hbus->prepare_mutex); + hbus->pci = pci; + hbus->mixer_assigned =-1 ; + hbus->modelname ="sklbus" ; + *rskl = skl;return 0 ;
sound/soc/intel/skylake/skl.h +7 -3
@@ -23,6 +23,7 @@#include <sound/hda_register.h> #include <sound/hdaudio_ext.h> +#include <sound/hda_codec.h> #include <sound/soc.h> #include "skl-nhlt.h" #include "skl-ssp-clk.h"
@@ -71,7 +72,7 @@ struct skl_fw_config { };struct skl { -struct hdac_bus hbus; +struct hda_bus hbus;struct pci_dev *pci;unsigned int init_done:1 ;/* delayed init status */
@@ -105,8 +106,11 @@ struct skl {struct snd_soc_acpi_mach *mach; }; -#define skl_to_bus (s) (&(s)->hbus) -#define bus_to_skl (bus) container_of(bus, struct skl, hbus) +#define skl_to_bus (s) (&(s)->hbus.core) +#define bus_to_skl (bus) container_of(bus, struct skl, hbus.core) + +#define skl_to_hbus (s) (&(s)->hbus) +#define hbus_to_skl (hbus) container_of((hbus), struct skl, (hbus))/* to pass dai dma data */ struct skl_dma_params {
Signature · 1 line
2.17.1
Mark Brown
maintainerApplied "ASoC: Intel: Skylake: use hda_bus instead of hdac_bus" to the asoc tree
The patch
ASoC: Intel: Skylake: use hda_bus instead of hdac_bus
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
00deadb5d86a3c1e691aaa073a8852a198595099Mon Sep 17 00:00:00 2001
From: Rakesh Ughreja <[email protected]>
Date: Wed, 22 Aug 2018 15:25:02 -0500
Subject: [PATCH] ASoC: Intel: Skylake: use hda_bus instead of hdac_bus
Use hda_bus instead of hdac_bus in the SKL ASoC platform driver to enable reuse of legacy HDA codec drivers.
--- sound/soc/intel/skylake/skl.c | 11 +++++++++-- sound/soc/intel/skylake/skl.h | 10 +++++++--- 2 files changed, 16 insertions(+), 5 deletions(-)
sound/soc/intel/skylake/skl.c +9 -2
@@ -33,6 +33,7 @@#include <sound/hda_register.h> #include <sound/hdaudio.h> #include <sound/hda_i915.h> +#include <sound/hda_codec.h> #include "skl.h" #include "skl-sst-dsp.h" #include "skl-sst-ipc.h"
@@ -673,7 +674,7 @@ static int probe_codec(struct hdac_bus *bus, int addr)mutex_unlock (&bus->cmd_mutex);if (res ==-1 )return -EIO ; -dev_dbg (bus->dev,"codec #%d probed OK\n" , addr); +dev_dbg (bus->dev,"codec #%d probed OK: %x\n" , addr, res); hdev =devm_kzalloc (&skl->pci->dev,sizeof (*hdev),GFP_KERNEL );if (!hdev)
@@ -816,7 +817,7 @@ static int skl_create(struct pci_dev *pci, {struct skl *skl;struct hdac_bus *bus; - +struct hda_bus *hbus;int err; *rskl =NULL ;
@@ -831,6 +832,7 @@ static int skl_create(struct pci_dev *pci,return -ENOMEM ; } + hbus =skl_to_hbus (skl); bus =skl_to_bus (skl);snd_hdac_ext_bus_init (bus, &pci->dev, &bus_core_ops, io_ops,NULL ); bus->use_posbuf =1 ;
@@ -838,6 +840,11 @@ static int skl_create(struct pci_dev *pci,INIT_WORK (&skl->probe_work, skl_probe_work); bus->bdl_pos_adj =0 ; +mutex_init (&hbus->prepare_mutex); + hbus->pci = pci; + hbus->mixer_assigned =-1 ; + hbus->modelname ="sklbus" ; + *rskl = skl;return 0 ;
sound/soc/intel/skylake/skl.h +7 -3
@@ -23,6 +23,7 @@#include <sound/hda_register.h> #include <sound/hdaudio_ext.h> +#include <sound/hda_codec.h> #include <sound/soc.h> #include "skl-nhlt.h" #include "skl-ssp-clk.h"
@@ -71,7 +72,7 @@ struct skl_fw_config { };struct skl { -struct hdac_bus hbus; +struct hda_bus hbus;struct pci_dev *pci;unsigned int init_done:1 ;/* delayed init status */
@@ -105,8 +106,11 @@ struct skl {struct snd_soc_acpi_mach *mach; }; -#define skl_to_bus (s) (&(s)->hbus) -#define bus_to_skl (bus) container_of(bus, struct skl, hbus) +#define skl_to_bus (s) (&(s)->hbus.core) +#define bus_to_skl (bus) container_of(bus, struct skl, hbus.core) + +#define skl_to_hbus (s) (&(s)->hbus) +#define hbus_to_skl (hbus) container_of((hbus), struct skl, (hbus))/* to pass dai dma data */ struct skl_dma_params {
Signature · 1 line
2.18.0
PATCH v8 7/7 ASoC: hdac_hda: add asoc extension for legacy HDA codec drivers
In reply to Pierre-Louis BossartFrom: Rakesh Ughreja <[email protected]>
This patch adds a kernel module which is used by the legacy HDA codec drivers as library. This implements hdac_ext_bus_ops to enable the reuse of legacy HDA codec drivers with ASoC platform drivers.
--- sound/pci/hda/hda_bind.c | 12 + sound/soc/codecs/Kconfig | 5 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/hdac_hda.c | 484 +++++++++++++++++++ sound/soc/codecs/hdac_hda.h | 24 + sound/soc/intel/boards/Kconfig | 1 + sound/soc/intel/boards/skl_hda_dsp_common.c | 24 + sound/soc/intel/boards/skl_hda_dsp_common.h | 2 +- sound/soc/intel/boards/skl_hda_dsp_generic.c | 38 ++ sound/soc/intel/skylake/skl.c | 47 +- 10 files changed, 634 insertions(+), 5 deletions(-) create mode 100644 sound/soc/codecs/hdac_hda.c create mode 100644 sound/soc/codecs/hdac_hda.h
sound/pci/hda/hda_bind.c +12 -0
@@ -81,6 +81,12 @@ static int hda_codec_driver_probe(struct device *dev)hda_codec_patch_t patch;int err; +if (codec->bus->core.ext_ops) { +if (WARN_ON (!codec->bus->core.ext_ops->hdev_attach)) +return -EINVAL ; +return codec->bus->core.ext_ops->hdev_attach (&codec->core); + } +if (WARN_ON (!codec->preset))return -EINVAL ;
@@ -134,6 +140,12 @@ static int hda_codec_driver_remove(struct device *dev) {struct hda_codec *codec =dev_to_hda_codec (dev); +if (codec->bus->core.ext_ops) { +if (WARN_ON (!codec->bus->core.ext_ops->hdev_detach)) +return -EINVAL ; +return codec->bus->core.ext_ops->hdev_detach (&codec->core); + } +if (codec->patch_ops.free) codec->patch_ops.free (codec);snd_hda_codec_cleanup_for_unbind (codec);
sound/soc/codecs/Kconfig +5 -0
@@ -82,6 +82,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_ES7241 select SND_SOC_GTM601 select SND_SOC_HDAC_HDMI + select SND_SOC_HDAC_HDA select SND_SOC_ICS43432 select SND_SOC_INNO_RK3036 select SND_SOC_ISABELLE if I2C
@@ -615,6 +616,10 @@ config SND_SOC_HDAC_HDMI select SND_PCM_ELD select HDMI +config SND_SOC_HDAC_HDA + tristate + select SND_HDA + config SND_SOC_ICS43432 tristate
sound/soc/codecs/Makefile +2 -0
@@ -78,6 +78,7 @@ snd-soc-es8328-i2c-objs := es8328-i2c.o snd-soc-es8328-spi-objs := es8328-spi.o snd-soc-gtm601-objs := gtm601.o snd-soc-hdac-hdmi-objs := hdac_hdmi.o +snd-soc-hdac-hda-objs := hdac_hda.o snd-soc-ics43432-objs := ics43432.o snd-soc-inno-rk3036-objs := inno_rk3036.o snd-soc-isabelle-objs := isabelle.o
@@ -338,6 +339,7 @@ obj-$(CONFIG_SND_SOC_ES8328_I2C)+= snd-soc-es8328-i2c.o obj-$(CONFIG_SND_SOC_ES8328_SPI)+= snd-soc-es8328-spi.o obj-$(CONFIG_SND_SOC_GTM601) += snd-soc-gtm601.o obj-$(CONFIG_SND_SOC_HDAC_HDMI) += snd-soc-hdac-hdmi.o +obj-$(CONFIG_SND_SOC_HDAC_HDA) += snd-soc-hdac-hda.o obj-$(CONFIG_SND_SOC_ICS43432) += snd-soc-ics43432.o obj-$(CONFIG_SND_SOC_INNO_RK3036) += snd-soc-inno-rk3036.o obj-$(CONFIG_SND_SOC_ISABELLE) += snd-soc-isabelle.o
sound/soc/codecs/hdac_hda.c new file +484 -0
484 lines not on this page · raw message
sound/soc/codecs/hdac_hda.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright(c) 2015-18 Intel Corporation. +*/ + +#ifndef __HDAC_HDA_H__ +#define __HDAC_HDA_H__ + +struct hdac_hda_pcm { +int stream_tag[2 ]; +}; + +struct hdac_hda_priv { +struct hda_codec codec; +struct hdac_hda_pcm pcm[2 ]; +}; + +#define hdac_to_hda_priv (_hdac) \ + container_of(_hdac, struct hdac_hda_priv, codec.core) +#define hdac_to_hda_codec (_hdac) container_of(_hdac, struct hda_codec, core) + +struct hdac_ext_bus_ops *snd_soc_hdac_hda_get_ops (void ); + +#endif /* __HDAC_HDA_H__ */
sound/soc/intel/boards/Kconfig +1 -0
@@ -283,6 +283,7 @@ config SND_SOC_INTEL_KBL_DA7219_MAX98357A_MACH config SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH tristate "SKL/KBL/BXT/APL with HDA Codecs" select SND_SOC_HDAC_HDMI + select SND_SOC_HDAC_HDA help This adds support for ASoC machine driver for Intel platforms SKL/KBL/BXT/APL with iDisp, HDA audio codecs.
sound/soc/intel/boards/skl_hda_dsp_common.c +24 -0
@@ -69,6 +69,30 @@ struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS] = { .dpcm_playback = 1, .no_pcm = 1, }, + { + .name = "Analog Playback and Capture", + .id = 4, + .cpu_dai_name = "Analog CPU DAI", + .codec_name = "ehdaudio0D0", + .codec_dai_name = "Analog Codec DAI", + .platform_name = "0000:00:1f.3", + .dpcm_playback = 1, + .dpcm_capture = 1, + .init = NULL, + .no_pcm = 1, + }, + { + .name = "Digital Playback and Capture", + .id = 5, + .cpu_dai_name = "Digital CPU DAI", + .codec_name = "ehdaudio0D0", + .codec_dai_name = "Digital Codec DAI", + .platform_name = "0000:00:1f.3", + .dpcm_playback = 1, + .dpcm_capture = 1, + .init = NULL, + .no_pcm = 1, + }, };int skl_hda_hdmi_jack_init (struct snd_soc_card *card)
sound/soc/intel/boards/skl_hda_dsp_common.h +1 -1
@@ -15,7 +15,7 @@#include <sound/core.h> #include <sound/jack.h> -#define HDA_DSP_MAX_BE_DAI_LINKS 3 +#define HDA_DSP_MAX_BE_DAI_LINKS 5struct skl_hda_hdmi_pcm {struct list_head head;
sound/soc/intel/boards/skl_hda_dsp_generic.c +38 -0
@@ -16,6 +16,15 @@#include "../skylake/skl.h" #include "skl_hda_dsp_common.h" +static const struct snd_soc_dapm_widget skl_hda_widgets[] = { +SND_SOC_DAPM_HP ("Analog Out" ,NULL ), +SND_SOC_DAPM_MIC ("Analog In" ,NULL ), +SND_SOC_DAPM_HP ("Alt Analog Out" ,NULL ), +SND_SOC_DAPM_MIC ("Alt Analog In" ,NULL ), +SND_SOC_DAPM_SPK ("Digital Out" ,NULL ), +SND_SOC_DAPM_MIC ("Digital In" ,NULL ), +}; +static const struct snd_soc_dapm_route skl_hda_map[] = { {"hifi3" ,NULL ,"iDisp3 Tx" }, {"iDisp3 Tx" ,NULL ,"iDisp3_out" },
@@ -23,6 +32,29 @@ static const struct snd_soc_dapm_route skl_hda_map[] = { { "iDisp2 Tx", NULL, "iDisp2_out"}, { "hifi1", NULL, "iDisp1 Tx"}, { "iDisp1 Tx", NULL, "iDisp1_out"}, + + { "Analog Out", NULL, "Codec Output Pin1" }, + { "Digital Out", NULL, "Codec Output Pin2" }, + { "Alt Analog Out", NULL, "Codec Output Pin3" }, + + { "Codec Input Pin1", NULL, "Analog In" }, + { "Codec Input Pin2", NULL, "Digital In" }, + { "Codec Input Pin3", NULL, "Alt Analog In" }, + +/* CODEC BE connections */ + { "Analog Codec Playback", NULL, "Analog CPU Playback" }, + { "Analog CPU Playback", NULL, "codec0_out" }, + { "Digital Codec Playback", NULL, "Digital CPU Playback" }, + { "Digital CPU Playback", NULL, "codec1_out" }, + { "Alt Analog Codec Playback", NULL, "Alt Analog CPU Playback" }, + { "Alt Analog CPU Playback", NULL, "codec2_out" }, + + { "codec0_in", NULL, "Analog CPU Capture" }, + { "Analog CPU Capture", NULL, "Analog Codec Capture" }, + { "codec1_in", NULL, "Digital CPU Capture" }, + { "Digital CPU Capture", NULL, "Digital Codec Capture" }, + { "codec2_in", NULL, "Alt Analog CPU Capture" }, + { "Alt Analog CPU Capture", NULL, "Alt Analog Codec Capture" }, };static int skl_hda_card_late_probe (struct snd_soc_card *card)
@@ -57,6 +89,7 @@ static struct snd_soc_card hda_soc_card = { .name = "skl_hda_card", .owner = THIS_MODULE, .dai_link = skl_hda_be_dai_links, + .dapm_widgets = skl_hda_widgets, .dapm_routes = skl_hda_map, .add_dai_link = skl_hda_add_dai_link, .fully_routed = true,
@@ -80,6 +113,11 @@ static int skl_hda_fill_card_info(struct skl_machine_pdata *pdata)if (codec_count ==1 && pdata->codec_mask &IDISP_CODEC_MASK ) { num_links =IDISP_DAI_COUNT ; num_route =IDISP_ROUTE_COUNT ; + }else if (codec_count ==2 && codec_mask &IDISP_CODEC_MASK ) { + num_links =ARRAY_SIZE (skl_hda_be_dai_links); + num_route =ARRAY_SIZE (skl_hda_map), + card->dapm_widgets = skl_hda_widgets; + card->num_dapm_widgets =ARRAY_SIZE (skl_hda_widgets); }else {return -EINVAL ; }
sound/soc/intel/skylake/skl.c +43 -4
86 lines not on this page · raw message
Signature · 1 line
2.17.1
Mark Brown
maintainerApplied "ASoC: hdac_hda: add asoc extension for legacy HDA codec drivers" to the asoc tree
The patch
ASoC: hdac_hda: add asoc extension for legacy HDA codec drivers
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
6bae5ea9498926440ffc883f3dbceb0adc65e492Mon Sep 17 00:00:00 2001
From: Rakesh Ughreja <[email protected]>
Date: Wed, 22 Aug 2018 15:25:03 -0500
Subject: [PATCH] ASoC: hdac_hda: add asoc extension for legacy HDA codec
drivers
This patch adds a kernel module which is used by the legacy HDA codec drivers as library. This implements hdac_ext_bus_ops to enable the reuse of legacy HDA codec drivers with ASoC platform drivers.
--- sound/pci/hda/hda_bind.c | 12 + sound/soc/codecs/Kconfig | 5 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/hdac_hda.c | 484 +++++++++++++++++++ sound/soc/codecs/hdac_hda.h | 24 + sound/soc/intel/boards/Kconfig | 1 + sound/soc/intel/boards/skl_hda_dsp_common.c | 24 + sound/soc/intel/boards/skl_hda_dsp_common.h | 2 +- sound/soc/intel/boards/skl_hda_dsp_generic.c | 38 ++ sound/soc/intel/skylake/skl.c | 47 +- 10 files changed, 634 insertions(+), 5 deletions(-) create mode 100644 sound/soc/codecs/hdac_hda.c create mode 100644 sound/soc/codecs/hdac_hda.h
sound/pci/hda/hda_bind.c +12 -0
@@ -81,6 +81,12 @@ static int hda_codec_driver_probe(struct device *dev)hda_codec_patch_t patch;int err; +if (codec->bus->core.ext_ops) { +if (WARN_ON (!codec->bus->core.ext_ops->hdev_attach)) +return -EINVAL ; +return codec->bus->core.ext_ops->hdev_attach (&codec->core); + } +if (WARN_ON (!codec->preset))return -EINVAL ;
@@ -134,6 +140,12 @@ static int hda_codec_driver_remove(struct device *dev) {struct hda_codec *codec =dev_to_hda_codec (dev); +if (codec->bus->core.ext_ops) { +if (WARN_ON (!codec->bus->core.ext_ops->hdev_detach)) +return -EINVAL ; +return codec->bus->core.ext_ops->hdev_detach (&codec->core); + } +if (codec->patch_ops.free) codec->patch_ops.free (codec);snd_hda_codec_cleanup_for_unbind (codec);
sound/soc/codecs/Kconfig +5 -0
@@ -82,6 +82,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_ES7241 select SND_SOC_GTM601 select SND_SOC_HDAC_HDMI + select SND_SOC_HDAC_HDA select SND_SOC_ICS43432 select SND_SOC_INNO_RK3036 select SND_SOC_ISABELLE if I2C
@@ -615,6 +616,10 @@ config SND_SOC_HDAC_HDMI select SND_PCM_ELD select HDMI +config SND_SOC_HDAC_HDA + tristate + select SND_HDA + config SND_SOC_ICS43432 tristate
sound/soc/codecs/Makefile +2 -0
@@ -78,6 +78,7 @@ snd-soc-es8328-i2c-objs := es8328-i2c.o snd-soc-es8328-spi-objs := es8328-spi.o snd-soc-gtm601-objs := gtm601.o snd-soc-hdac-hdmi-objs := hdac_hdmi.o +snd-soc-hdac-hda-objs := hdac_hda.o snd-soc-ics43432-objs := ics43432.o snd-soc-inno-rk3036-objs := inno_rk3036.o snd-soc-isabelle-objs := isabelle.o
@@ -338,6 +339,7 @@ obj-$(CONFIG_SND_SOC_ES8328_I2C)+= snd-soc-es8328-i2c.o obj-$(CONFIG_SND_SOC_ES8328_SPI)+= snd-soc-es8328-spi.o obj-$(CONFIG_SND_SOC_GTM601) += snd-soc-gtm601.o obj-$(CONFIG_SND_SOC_HDAC_HDMI) += snd-soc-hdac-hdmi.o +obj-$(CONFIG_SND_SOC_HDAC_HDA) += snd-soc-hdac-hda.o obj-$(CONFIG_SND_SOC_ICS43432) += snd-soc-ics43432.o obj-$(CONFIG_SND_SOC_INNO_RK3036) += snd-soc-inno-rk3036.o obj-$(CONFIG_SND_SOC_ISABELLE) += snd-soc-isabelle.o
sound/soc/codecs/hdac_hda.c new file +484 -0
484 lines not on this page · raw message
sound/soc/codecs/hdac_hda.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright(c) 2015-18 Intel Corporation. +*/ + +#ifndef __HDAC_HDA_H__ +#define __HDAC_HDA_H__ + +struct hdac_hda_pcm { +int stream_tag[2 ]; +}; + +struct hdac_hda_priv { +struct hda_codec codec; +struct hdac_hda_pcm pcm[2 ]; +}; + +#define hdac_to_hda_priv (_hdac) \ + container_of(_hdac, struct hdac_hda_priv, codec.core) +#define hdac_to_hda_codec (_hdac) container_of(_hdac, struct hda_codec, core) + +struct hdac_ext_bus_ops *snd_soc_hdac_hda_get_ops (void ); + +#endif /* __HDAC_HDA_H__ */
sound/soc/intel/boards/Kconfig +1 -0
@@ -283,6 +283,7 @@ config SND_SOC_INTEL_KBL_DA7219_MAX98357A_MACH config SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH tristate "SKL/KBL/BXT/APL with HDA Codecs" select SND_SOC_HDAC_HDMI + select SND_SOC_HDAC_HDA help This adds support for ASoC machine driver for Intel platforms SKL/KBL/BXT/APL with iDisp, HDA audio codecs.
sound/soc/intel/boards/skl_hda_dsp_common.c +24 -0
@@ -69,6 +69,30 @@ struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS] = { .dpcm_playback = 1, .no_pcm = 1, }, + { + .name = "Analog Playback and Capture", + .id = 4, + .cpu_dai_name = "Analog CPU DAI", + .codec_name = "ehdaudio0D0", + .codec_dai_name = "Analog Codec DAI", + .platform_name = "0000:00:1f.3", + .dpcm_playback = 1, + .dpcm_capture = 1, + .init = NULL, + .no_pcm = 1, + }, + { + .name = "Digital Playback and Capture", + .id = 5, + .cpu_dai_name = "Digital CPU DAI", + .codec_name = "ehdaudio0D0", + .codec_dai_name = "Digital Codec DAI", + .platform_name = "0000:00:1f.3", + .dpcm_playback = 1, + .dpcm_capture = 1, + .init = NULL, + .no_pcm = 1, + }, };int skl_hda_hdmi_jack_init (struct snd_soc_card *card)
sound/soc/intel/boards/skl_hda_dsp_common.h +1 -1
@@ -15,7 +15,7 @@#include <sound/core.h> #include <sound/jack.h> -#define HDA_DSP_MAX_BE_DAI_LINKS 3 +#define HDA_DSP_MAX_BE_DAI_LINKS 5struct skl_hda_hdmi_pcm {struct list_head head;
sound/soc/intel/boards/skl_hda_dsp_generic.c +38 -0
@@ -16,6 +16,15 @@#include "../skylake/skl.h" #include "skl_hda_dsp_common.h" +static const struct snd_soc_dapm_widget skl_hda_widgets[] = { +SND_SOC_DAPM_HP ("Analog Out" ,NULL ), +SND_SOC_DAPM_MIC ("Analog In" ,NULL ), +SND_SOC_DAPM_HP ("Alt Analog Out" ,NULL ), +SND_SOC_DAPM_MIC ("Alt Analog In" ,NULL ), +SND_SOC_DAPM_SPK ("Digital Out" ,NULL ), +SND_SOC_DAPM_MIC ("Digital In" ,NULL ), +}; +static const struct snd_soc_dapm_route skl_hda_map[] = { {"hifi3" ,NULL ,"iDisp3 Tx" }, {"iDisp3 Tx" ,NULL ,"iDisp3_out" },
@@ -23,6 +32,29 @@ static const struct snd_soc_dapm_route skl_hda_map[] = { { "iDisp2 Tx", NULL, "iDisp2_out"}, { "hifi1", NULL, "iDisp1 Tx"}, { "iDisp1 Tx", NULL, "iDisp1_out"}, + + { "Analog Out", NULL, "Codec Output Pin1" }, + { "Digital Out", NULL, "Codec Output Pin2" }, + { "Alt Analog Out", NULL, "Codec Output Pin3" }, + + { "Codec Input Pin1", NULL, "Analog In" }, + { "Codec Input Pin2", NULL, "Digital In" }, + { "Codec Input Pin3", NULL, "Alt Analog In" }, + +/* CODEC BE connections */ + { "Analog Codec Playback", NULL, "Analog CPU Playback" }, + { "Analog CPU Playback", NULL, "codec0_out" }, + { "Digital Codec Playback", NULL, "Digital CPU Playback" }, + { "Digital CPU Playback", NULL, "codec1_out" }, + { "Alt Analog Codec Playback", NULL, "Alt Analog CPU Playback" }, + { "Alt Analog CPU Playback", NULL, "codec2_out" }, + + { "codec0_in", NULL, "Analog CPU Capture" }, + { "Analog CPU Capture", NULL, "Analog Codec Capture" }, + { "codec1_in", NULL, "Digital CPU Capture" }, + { "Digital CPU Capture", NULL, "Digital Codec Capture" }, + { "codec2_in", NULL, "Alt Analog CPU Capture" }, + { "Alt Analog CPU Capture", NULL, "Alt Analog Codec Capture" }, };static int skl_hda_card_late_probe (struct snd_soc_card *card)
@@ -57,6 +89,7 @@ static struct snd_soc_card hda_soc_card = { .name = "skl_hda_card", .owner = THIS_MODULE, .dai_link = skl_hda_be_dai_links, + .dapm_widgets = skl_hda_widgets, .dapm_routes = skl_hda_map, .add_dai_link = skl_hda_add_dai_link, .fully_routed = true,
@@ -80,6 +113,11 @@ static int skl_hda_fill_card_info(struct skl_machine_pdata *pdata)if (codec_count ==1 && pdata->codec_mask &IDISP_CODEC_MASK ) { num_links =IDISP_DAI_COUNT ; num_route =IDISP_ROUTE_COUNT ; + }else if (codec_count ==2 && codec_mask &IDISP_CODEC_MASK ) { + num_links =ARRAY_SIZE (skl_hda_be_dai_links); + num_route =ARRAY_SIZE (skl_hda_map), + card->dapm_widgets = skl_hda_widgets; + card->num_dapm_widgets =ARRAY_SIZE (skl_hda_widgets); }else {return -EINVAL ; }
sound/soc/intel/skylake/skl.c +43 -4
86 lines not on this page · raw message
Signature · 1 line
2.18.0