ALSA: Reorganize HD-audio driver code
Subsystems (8)
cover ALSA: Reorganize HD-audio driver code
HD-audio driver is known to be quite messy in both file structures and its design, but until now I haven't touched its files paths so much because I set a higher priority for the easiness of backport to stable kernels. But, you can't leave garbages forever, it's been already high time for a large clean up -- so here it is.
The basic idea is to move the code from sound/pci/hda/* into different subdirectories in sound/hda/ per functionality, as most of the stuff are independent from PCI, but rather HD-audio bus specific.
So, now the all HD-audio driver code are moved under sound/hda:
% ls sound/hda
codecs/ common/ controllers/ core/ Kconfig Makefile
* The former hda core code is found in sound/hda/core.
* The former snd-hda-codec code is found in sound/hda/common.
* The former snd-hda-intel, tegra and acpi are put in sound/hda/controllers.
* The former patch_* and co are put to sound/hda/codecs.
* Realtek codec driver is split to several modules as sound/hda/codecs/realtek/alc*.
* Cirrus codec driver is split to cs420x and cs421x, put under sound/hda/codecs/cirrus together with cs8409.
* HDMI codec driver is split to several modules under sound/hda/codecs/hdmi
* Cirrus and TI sub-codecs are put under sound/hda/codecs/side-codecs
Also, the probe of the HD-audio codec driver is moved into the driver's ops instead of the ugly patch_ops embedded in hda_codec object. (As of now, hda_codec_driver.ops is a pointer, but it can be embedded later, too.)
This change required some code to be modified without the dynamic override of callbacks.
In future, we may convert the runtime PM handling to use the standard pm_ops, too. This was raised some time ago during the discussion with Realtek devs.
The tree applying those patches is found in topic/hda-reorg branch of sound git tree:
https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/log/?h=topic/hda-reorg
Takashi
===
Takashi Iwai (27):
ALSA: hda: Move widget capability macros into hdaudio.h
ALSA: hda: Move HD-audio core stuff into sound/hda/core
ALSA: hda: Move common codec driver into sound/hda/common directory
ALSA: hda: Move CONFIG_SND_HDA_PREALLOC_SIZE into sound/hda/common
ALSA: hda: Move controller drivers into sound/hda/controllers
directory
ALSA: hda: Move codec drivers into sound/hda/codecs directory
ALSA: hda: Split Realtek HD-audio codec driver
ALSA: hda/hdmi: Split vendor codec drivers
ALSA: hda: Introduce hda_codec_driver ops
ALSA: hda/generic: Rewrite to new probe method
ALSA: hda/realtek: Rewrite to new probe method
ALSA: hda/cmedia: Rewrite to new probe method
ALSA: hda/analog: Rewrite to new probe method
ALSA: hda/ca0110: Rewrite to new probe method
ALSA: hda/cirrus: Split to cs420x and cs421x drivers
ALSA: hda/cs8409: Rewrite to new probe method
ALSA: hda/conexant: Rewrite to new probe method
ALSA: hda/senary: Rewrite to new probe method
ALSA: hda/si3054: Rewrite to new probe method
ALSA: hda/via: Rewrite to new probe method
ALSA: hda/sigmatel: Rewrite to new probe method
ALSA: hda/ca0132: Rewrite to new probe method
ALSA: hda/hdmi: Rewrite to new probe method
ALSA: hda: Drop old codec binding method
ALSA: hda: Drop superfluous driver->ops NULL checks
MAINTAINERS: Adjust to the new HD-audio driver paths
ALSA: hda: Return the codec init error properly at
snd_hda_codec_build_controls()
MAINTAINERS | 10 +-
include/sound/hda_codec.h | 40 +-
include/sound/hdaudio.h | 24 +
sound/hda/Kconfig | 70 +-
sound/hda/Makefile | 28 +-
sound/hda/codecs/Kconfig | 137 +
sound/hda/codecs/Makefile | 34 +
.../patch_analog.c => hda/codecs/analog.c} | 223 +-
.../patch_ca0110.c => hda/codecs/ca0110.c} | 37 +-
.../patch_ca0132.c => hda/codecs/ca0132.c} | 105 +-
sound/{pci/hda => hda/codecs}/ca0132_regs.h | 2 +-
sound/hda/codecs/cirrus/Kconfig | 31 +
sound/hda/codecs/cirrus/Makefile | 10 +
.../codecs/cirrus/cs420x.c} | 528 +-
sound/hda/codecs/cirrus/cs421x.c | 590 ++
.../codecs/cirrus/cs8409-tables.c} | 4 +-
.../codecs/cirrus/cs8409.c} | 57 +-
.../codecs/cirrus/cs8409.h} | 6 +-
.../patch_cmedia.c => hda/codecs/cm9825.c} | 140 +-
sound/hda/codecs/cmedia.c | 106 +
.../codecs/conexant.c} | 110 +-
.../hda_generic.c => hda/codecs/generic.c} | 57 +-
.../hda_generic.h => hda/codecs/generic.h} | 2 +-
sound/hda/codecs/hdmi/Kconfig | 68 +
sound/hda/codecs/hdmi/Makefile | 18 +
sound/hda/codecs/hdmi/atihdmi.c | 615 ++
.../hda/hda_eld.c => hda/codecs/hdmi/eld.c} | 172 -
sound/hda/codecs/hdmi/hdmi.c | 2416 +++++++
sound/hda/codecs/hdmi/hdmi_local.h | 302 +
sound/hda/codecs/hdmi/intelhdmi.c | 811 +++
sound/hda/codecs/hdmi/nvhdmi-mcp.c | 384 ++
sound/hda/codecs/hdmi/nvhdmi.c | 223 +
sound/hda/codecs/hdmi/simplehdmi.c | 251 +
sound/hda/codecs/hdmi/tegrahdmi.c | 316 +
.../codecs/helpers/hp_x360.c} | 0
.../codecs/helpers/ideapad_hotkey_led.c} | 0
.../codecs/helpers/ideapad_s740.c} | 0
.../codecs/helpers/thinkpad.c} | 0
sound/hda/codecs/realtek/Kconfig | 90 +
sound/hda/codecs/realtek/Makefile | 26 +
sound/hda/codecs/realtek/alc260.c | 290 +
sound/hda/codecs/realtek/alc262.c | 213 +
sound/hda/codecs/realtek/alc268.c | 190 +
.../codecs/realtek/alc269.c} | 5828 +----------------
sound/hda/codecs/realtek/alc662.c | 1116 ++++
sound/hda/codecs/realtek/alc680.c | 67 +
sound/hda/codecs/realtek/alc861.c | 163 +
sound/hda/codecs/realtek/alc861vd.c | 137 +
sound/hda/codecs/realtek/alc880.c | 509 ++
sound/hda/codecs/realtek/alc882.c | 861 +++
sound/hda/codecs/realtek/realtek.c | 2299 +++++++
sound/hda/codecs/realtek/realtek.h | 298 +
.../codecs/senarytech.c} | 50 +-
.../patch_si3054.c => hda/codecs/si3054.c} | 53 +-
sound/hda/codecs/side-codecs/Kconfig | 128 +
sound/hda/codecs/side-codecs/Makefile | 28 +
.../codecs/side-codecs}/cirrus_scodec.c | 0
.../codecs/side-codecs}/cirrus_scodec.h | 0
.../codecs/side-codecs}/cirrus_scodec_test.c | 0
.../codecs/side-codecs}/cs35l41_hda.c | 2 +-
.../codecs/side-codecs}/cs35l41_hda.h | 0
.../codecs/side-codecs}/cs35l41_hda_i2c.c | 0
.../side-codecs}/cs35l41_hda_property.c | 0
.../side-codecs}/cs35l41_hda_property.h | 0
.../codecs/side-codecs}/cs35l41_hda_spi.c | 0
.../codecs/side-codecs}/cs35l56_hda.c | 2 +-
.../codecs/side-codecs}/cs35l56_hda.h | 0
.../codecs/side-codecs}/cs35l56_hda_i2c.c | 0
.../codecs/side-codecs}/cs35l56_hda_spi.c | 0
.../codecs/side-codecs}/hda_component.c | 0
.../codecs/side-codecs}/hda_component.h | 0
.../codecs/side-codecs}/tas2781_hda.c | 0
.../codecs/side-codecs}/tas2781_hda.h | 0
.../codecs/side-codecs}/tas2781_hda_i2c.c | 2 +-
.../codecs/side-codecs}/tas2781_hda_spi.c | 2 +-
.../codecs/sigmatel.c} | 402 +-
.../{pci/hda/patch_via.c => hda/codecs/via.c} | 447 +-
sound/hda/common/Kconfig | 97 +
sound/hda/common/Makefile | 13 +
.../common/auto_parser.c} | 0
.../{pci/hda/hda_beep.c => hda/common/beep.c} | 0
.../{pci/hda/hda_bind.c => hda/common/bind.c} | 29 +-
.../hda/hda_codec.c => hda/common/codec.c} | 57 +-
.../common/controller.c} | 2 +-
.../common/controller_trace.h} | 2 +-
.../{pci/hda => hda/common}/hda_auto_parser.h | 0
sound/{pci/hda => hda/common}/hda_beep.h | 0
.../{pci/hda => hda/common}/hda_controller.h | 0
sound/{pci/hda => hda/common}/hda_jack.h | 0
sound/{pci/hda => hda/common}/hda_local.h | 13 +-
.../hda/hda_hwdep.c => hda/common/hwdep.c} | 0
.../{pci/hda/hda_jack.c => hda/common/jack.c} | 0
.../{pci/hda/hda_proc.c => hda/common/proc.c} | 0
.../hda/hda_sysfs.c => hda/common/sysfs.c} | 0
sound/hda/controllers/Kconfig | 42 +
sound/hda/controllers/Makefile | 13 +
.../hda/hda_acpi.c => hda/controllers/acpi.c} | 0
.../hda_intel.c => hda/controllers/intel.c} | 5 +-
.../hda_intel.h => hda/controllers/intel.h} | 0
.../controllers/intel_trace.h} | 2 +-
.../hda_tegra.c => hda/controllers/tegra.c} | 0
sound/hda/core/Kconfig | 51 +
sound/hda/core/Makefile | 22 +
sound/hda/{ => core}/array.c | 0
sound/hda/{hdac_bus.c => core/bus.c} | 0
.../{hdac_component.c => core/component.c} | 0
.../{hdac_controller.c => core/controller.c} | 0
sound/hda/{hdac_device.c => core/device.c} | 8 +-
sound/hda/{ => core}/ext/Makefile | 2 +-
.../{ext/hdac_ext_bus.c => core/ext/bus.c} | 0
.../ext/controller.c} | 0
.../hdac_ext_stream.c => core/ext/stream.c} | 0
sound/hda/{ => core}/hda_bus_type.c | 0
sound/hda/{ => core}/hdmi_chmap.c | 0
sound/hda/{hdac_i915.c => core/i915.c} | 0
sound/hda/{ => core}/intel-dsp-config.c | 0
sound/hda/{ => core}/intel-nhlt.c | 0
sound/hda/{ => core}/intel-sdw-acpi.c | 0
sound/hda/{ => core}/local.h | 21 -
sound/hda/{hdac_regmap.c => core/regmap.c} | 0
sound/hda/{hdac_stream.c => core/stream.c} | 0
sound/hda/{hdac_sysfs.c => core/sysfs.c} | 14 +-
sound/hda/{ => core}/trace.c | 0
sound/hda/{ => core}/trace.h | 0
sound/pci/Kconfig | 2 -
sound/pci/Makefile | 1 -
sound/pci/hda/Kconfig | 436 --
sound/pci/hda/Makefile | 84 -
sound/pci/hda/patch_hdmi.c | 4695 -------------
sound/soc/codecs/hda.c | 17 +-
sound/soc/codecs/hdac_hda.c | 29 +-
sound/soc/codecs/hdac_hdmi.c | 21 +-
132 files changed, 14057 insertions(+), 12751 deletions(-)
create mode 100644 sound/hda/codecs/Kconfig
create mode 100644 sound/hda/codecs/Makefile
rename sound/{pci/hda/patch_analog.c => hda/codecs/analog.c} (90%)
rename sound/{pci/hda/patch_ca0110.c => hda/codecs/ca0110.c} (75%)
rename sound/{pci/hda/patch_ca0132.c => hda/codecs/ca0132.c} (99%)
rename sound/{pci/hda => hda/codecs}/ca0132_regs.h (99%)
create mode 100644 sound/hda/codecs/cirrus/Kconfig
create mode 100644 sound/hda/codecs/cirrus/Makefile
rename sound/{pci/hda/patch_cirrus.c => hda/codecs/cirrus/cs420x.c} (61%)
create mode 100644 sound/hda/codecs/cirrus/cs421x.c
rename sound/{pci/hda/patch_cs8409-tables.c => hda/codecs/cirrus/cs8409-tables.c} (99%)
rename sound/{pci/hda/patch_cs8409.c => hda/codecs/cirrus/cs8409.c} (98%)
rename sound/{pci/hda/patch_cs8409.h => hda/codecs/cirrus/cs8409.h} (98%)
rename sound/{pci/hda/patch_cmedia.c => hda/codecs/cm9825.c} (73%)
create mode 100644 sound/hda/codecs/cmedia.c
rename sound/{pci/hda/patch_conexant.c => hda/codecs/conexant.c} (93%)
rename sound/{pci/hda/hda_generic.c => hda/codecs/generic.c} (99%)
rename sound/{pci/hda/hda_generic.h => hda/codecs/generic.h} (99%)
create mode 100644 sound/hda/codecs/hdmi/Kconfig
create mode 100644 sound/hda/codecs/hdmi/Makefile
create mode 100644 sound/hda/codecs/hdmi/atihdmi.c
rename sound/{pci/hda/hda_eld.c => hda/codecs/hdmi/eld.c} (51%)
create mode 100644 sound/hda/codecs/hdmi/hdmi.c
create mode 100644 sound/hda/codecs/hdmi/hdmi_local.h
create mode 100644 sound/hda/codecs/hdmi/intelhdmi.c
create mode 100644 sound/hda/codecs/hdmi/nvhdmi-mcp.c
create mode 100644 sound/hda/codecs/hdmi/nvhdmi.c
create mode 100644 sound/hda/codecs/hdmi/simplehdmi.c
create mode 100644 sound/hda/codecs/hdmi/tegrahdmi.c
rename sound/{pci/hda/hp_x360_helper.c => hda/codecs/helpers/hp_x360.c} (100%)
rename sound/{pci/hda/ideapad_hotkey_led_helper.c => hda/codecs/helpers/ideapad_hotkey_led.c} (100%)
rename sound/{pci/hda/ideapad_s740_helper.c => hda/codecs/helpers/ideapad_s740.c} (100%)
rename sound/{pci/hda/thinkpad_helper.c => hda/codecs/helpers/thinkpad.c} (100%)
create mode 100644 sound/hda/codecs/realtek/Kconfig
create mode 100644 sound/hda/codecs/realtek/Makefile
create mode 100644 sound/hda/codecs/realtek/alc260.c
create mode 100644 sound/hda/codecs/realtek/alc262.c
create mode 100644 sound/hda/codecs/realtek/alc268.c
rename sound/{pci/hda/patch_realtek.c => hda/codecs/realtek/alc269.c} (63%)
create mode 100644 sound/hda/codecs/realtek/alc662.c
create mode 100644 sound/hda/codecs/realtek/alc680.c
create mode 100644 sound/hda/codecs/realtek/alc861.c
create mode 100644 sound/hda/codecs/realtek/alc861vd.c
create mode 100644 sound/hda/codecs/realtek/alc880.c
create mode 100644 sound/hda/codecs/realtek/alc882.c
create mode 100644 sound/hda/codecs/realtek/realtek.c
create mode 100644 sound/hda/codecs/realtek/realtek.h
rename sound/{pci/hda/patch_senarytech.c => hda/codecs/senarytech.c} (87%)
rename sound/{pci/hda/patch_si3054.c => hda/codecs/si3054.c} (88%)
create mode 100644 sound/hda/codecs/side-codecs/Kconfig
create mode 100644 sound/hda/codecs/side-codecs/Makefile
rename sound/{pci/hda => hda/codecs/side-codecs}/cirrus_scodec.c (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cirrus_scodec.h (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cirrus_scodec_test.c (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cs35l41_hda.c (99%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cs35l41_hda.h (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cs35l41_hda_i2c.c (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cs35l41_hda_property.c (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cs35l41_hda_property.h (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cs35l41_hda_spi.c (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cs35l56_hda.c (99%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cs35l56_hda.h (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cs35l56_hda_i2c.c (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cs35l56_hda_spi.c (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/hda_component.c (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/hda_component.h (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/tas2781_hda.c (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/tas2781_hda.h (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/tas2781_hda_i2c.c (99%)
rename sound/{pci/hda => hda/codecs/side-codecs}/tas2781_hda_spi.c (99%)
rename sound/{pci/hda/patch_sigmatel.c => hda/codecs/sigmatel.c} (94%)
rename sound/{pci/hda/patch_via.c => hda/codecs/via.c} (78%)
create mode 100644 sound/hda/common/Kconfig
create mode 100644 sound/hda/common/Makefile
rename sound/{pci/hda/hda_auto_parser.c => hda/common/auto_parser.c} (100%)
rename sound/{pci/hda/hda_beep.c => hda/common/beep.c} (100%)
rename sound/{pci/hda/hda_bind.c => hda/common/bind.c} (93%)
rename sound/{pci/hda/hda_codec.c => hda/common/codec.c} (98%)
rename sound/{pci/hda/hda_controller.c => hda/common/controller.c} (99%)
rename sound/{pci/hda/hda_controller_trace.h => hda/common/controller_trace.h} (97%)
rename sound/{pci/hda => hda/common}/hda_auto_parser.h (100%)
rename sound/{pci/hda => hda/common}/hda_beep.h (100%)
rename sound/{pci/hda => hda/common}/hda_controller.h (100%)
rename sound/{pci/hda => hda/common}/hda_jack.h (100%)
rename sound/{pci/hda => hda/common}/hda_local.h (99%)
rename sound/{pci/hda/hda_hwdep.c => hda/common/hwdep.c} (100%)
rename sound/{pci/hda/hda_jack.c => hda/common/jack.c} (100%)
rename sound/{pci/hda/hda_proc.c => hda/common/proc.c} (100%)
rename sound/{pci/hda/hda_sysfs.c => hda/common/sysfs.c} (100%)
create mode 100644 sound/hda/controllers/Kconfig
create mode 100644 sound/hda/controllers/Makefile
rename sound/{pci/hda/hda_acpi.c => hda/controllers/acpi.c} (100%)
rename sound/{pci/hda/hda_intel.c => hda/controllers/intel.c} (99%)
rename sound/{pci/hda/hda_intel.h => hda/controllers/intel.h} (100%)
rename sound/{pci/hda/hda_intel_trace.h => hda/controllers/intel_trace.h} (95%)
rename sound/{pci/hda/hda_tegra.c => hda/controllers/tegra.c} (100%)
create mode 100644 sound/hda/core/Kconfig
create mode 100644 sound/hda/core/Makefile
rename sound/hda/{ => core}/array.c (100%)
rename sound/hda/{hdac_bus.c => core/bus.c} (100%)
rename sound/hda/{hdac_component.c => core/component.c} (100%)
rename sound/hda/{hdac_controller.c => core/controller.c} (100%)
rename sound/hda/{hdac_device.c => core/device.c} (99%)
rename sound/hda/{ => core}/ext/Makefile (54%)
rename sound/hda/{ext/hdac_ext_bus.c => core/ext/bus.c} (100%)
rename sound/hda/{ext/hdac_ext_controller.c => core/ext/controller.c} (100%)
rename sound/hda/{ext/hdac_ext_stream.c => core/ext/stream.c} (100%)
rename sound/hda/{ => core}/hda_bus_type.c (100%)
rename sound/hda/{ => core}/hdmi_chmap.c (100%)
rename sound/hda/{hdac_i915.c => core/i915.c} (100%)
rename sound/hda/{ => core}/intel-dsp-config.c (100%)
rename sound/hda/{ => core}/intel-nhlt.c (100%)
rename sound/hda/{ => core}/intel-sdw-acpi.c (100%)
rename sound/hda/{ => core}/local.h (66%)
rename sound/hda/{hdac_regmap.c => core/regmap.c} (100%)
rename sound/hda/{hdac_stream.c => core/stream.c} (100%)
rename sound/hda/{hdac_sysfs.c => core/sysfs.c} (95%)
rename sound/hda/{ => core}/trace.c (100%)
rename sound/hda/{ => core}/trace.h (100%)
delete mode 100644 sound/pci/hda/Kconfig
delete mode 100644 sound/pci/hda/Makefile
delete mode 100644 sound/pci/hda/patch_hdmi.cSignature · 1 line
2.50.0
PATCH 1/27 ALSA: hda: Move widget capability macros into hdaudio.h
The get_wcaps() and co are used not only by HD-audio core but also other driver code, hence it'd be better to put into the common header instead of local.h.
OTOH, there are macros of the same name like get_wcaps() that are still used in sound/pci/hda/* locally, and those conflict with each other. So we need to rename get_wcaps() (to be moved from hda-core) with the proper snd_hdac prefix for avoiding name conflicts, and define in the common hdaudio.h.
--- include/sound/hdaudio.h | 24 ++++++++++++++++++++++++ sound/hda/hdac_device.c | 8 ++++---- sound/hda/hdac_sysfs.c | 14 +++++++------- sound/hda/local.h | 21 --------------------- sound/soc/codecs/hdac_hdmi.c | 21 ++++++++++----------- 5 files changed, 45 insertions(+), 43 deletions(-)
include/sound/hdaudio.h +24 -0
@@ -680,6 +680,30 @@ static inline void snd_hdac_dsp_cleanup(struct hdac_stream *azx_dev, }#endif /* CONFIG_SND_HDA_DSP_LOADER */ +/* +* Easy macros for widget capabilities +*/ +#define snd_hdac_get_wcaps (codec, nid) \ + snd_hdac_read_parm(codec, nid, AC_PAR_AUDIO_WIDGET_CAP) + +/* get the widget type from widget capability bits */ +static inline int snd_hdac_get_wcaps_type (unsigned int wcaps) +{ +if (!wcaps) +return -1 ;/* invalid type */ +return (wcaps &AC_WCAP_TYPE ) >>AC_WCAP_TYPE_SHIFT ; +} + +/* get the number of supported channels */ +static inline unsigned int snd_hdac_get_wcaps_channels (u32 wcaps) +{ +unsigned int chans; + + chans = (wcaps &AC_WCAP_CHAN_CNT_EXT ) >>13 ; + chans = (chans +1 ) *2 ; + +return chans; +}/* * generic array helpers
sound/hda/hdac_device.c +4 -4
@@ -436,11 +436,11 @@ EXPORT_SYMBOL_GPL(snd_hdac_refresh_widgets);/* return CONNLIST_LEN parameter of the given widget */ static unsigned int get_num_conns (struct hdac_device *codec,hda_nid_t nid) { -unsigned int wcaps =get_wcaps (codec, nid); +unsigned int wcaps =snd_hdac_get_wcaps (codec, nid);unsigned int parm;if (!(wcaps &AC_WCAP_CONN_LIST ) && -get_wcaps_type (wcaps) !=AC_WID_VOL_KNB ) +snd_hdac_get_wcaps_type (wcaps) !=AC_WID_VOL_KNB )return 0 ; parm =snd_hdac_read_parm (codec, nid,AC_PAR_CONNLIST_LEN );
@@ -854,7 +854,7 @@ static unsigned int query_pcm_param(struct hdac_device *codec, hda_nid_t nid)unsigned int val =0 ;if (nid != codec->afg && - (get_wcaps (codec, nid) &AC_WCAP_FORMAT_OVRD )) + (snd_hdac_get_wcaps (codec, nid) &AC_WCAP_FORMAT_OVRD )) val =snd_hdac_read_parm (codec, nid,AC_PAR_PCM );if (!val || val ==-1 ) val =snd_hdac_read_parm (codec, codec->afg,AC_PAR_PCM );
@@ -894,7 +894,7 @@ int snd_hdac_query_supported_pcm(struct hdac_device *codec, hda_nid_t nid, {unsigned int i, val, wcaps; - wcaps =get_wcaps (codec, nid); + wcaps =snd_hdac_get_wcaps (codec, nid); val =query_pcm_param (codec, nid);if (ratesp) {
sound/hda/hdac_sysfs.c +7 -7
@@ -161,13 +161,13 @@ static const struct kobj_type widget_ktype = {static ssize_t caps_show (struct hdac_device *codec,hda_nid_t nid,struct widget_attribute *attr,char *buf) { -return sysfs_emit (buf,"0x%08x\n" ,get_wcaps (codec, nid)); +return sysfs_emit (buf,"0x%08x\n" ,snd_hdac_get_wcaps (codec, nid)); }static ssize_t pin_caps_show (struct hdac_device *codec,hda_nid_t nid,struct widget_attribute *attr,char *buf) { -if (get_wcaps_type (get_wcaps (codec, nid)) !=AC_WID_PIN ) +if (snd_hdac_get_wcaps_type (snd_hdac_get_wcaps (codec, nid)) !=AC_WID_PIN )return 0 ;return sysfs_emit (buf,"0x%08x\n" ,snd_hdac_read_parm (codec, nid,AC_PAR_PIN_CAP ));
@@ -178,7 +178,7 @@ static ssize_t pin_cfg_show(struct hdac_device *codec, hda_nid_t nid, {unsigned int val; -if (get_wcaps_type (get_wcaps (codec, nid)) !=AC_WID_PIN ) +if (snd_hdac_get_wcaps_type (snd_hdac_get_wcaps (codec, nid)) !=AC_WID_PIN )return 0 ;if (snd_hdac_read (codec, nid,AC_VERB_GET_CONFIG_DEFAULT ,0 , &val))return 0 ;
@@ -189,7 +189,7 @@ static bool has_pcm_cap(struct hdac_device *codec, hda_nid_t nid) {if (nid == codec->afg || nid == codec->mfg)return true; -switch (get_wcaps_type (get_wcaps (codec, nid))) { +switch (snd_hdac_get_wcaps_type (snd_hdac_get_wcaps (codec, nid))) {case AC_WID_AUD_OUT :case AC_WID_AUD_IN :return true;
@@ -219,7 +219,7 @@ static ssize_t pcm_formats_show(struct hdac_device *codec, hda_nid_t nid,static ssize_t amp_in_caps_show (struct hdac_device *codec,hda_nid_t nid,struct widget_attribute *attr,char *buf) { -if (nid != codec->afg && !(get_wcaps (codec, nid) &AC_WCAP_IN_AMP )) +if (nid != codec->afg && !(snd_hdac_get_wcaps (codec, nid) &AC_WCAP_IN_AMP ))return 0 ;return sysfs_emit (buf,"0x%08x\n" ,snd_hdac_read_parm (codec, nid,AC_PAR_AMP_IN_CAP ));
@@ -228,7 +228,7 @@ static ssize_t amp_in_caps_show(struct hdac_device *codec, hda_nid_t nid,static ssize_t amp_out_caps_show (struct hdac_device *codec,hda_nid_t nid,struct widget_attribute *attr,char *buf) { -if (nid != codec->afg && !(get_wcaps (codec, nid) &AC_WCAP_OUT_AMP )) +if (nid != codec->afg && !(snd_hdac_get_wcaps (codec, nid) &AC_WCAP_OUT_AMP ))return 0 ;return sysfs_emit (buf,"0x%08x\n" ,snd_hdac_read_parm (codec, nid,AC_PAR_AMP_OUT_CAP ));
@@ -237,7 +237,7 @@ static ssize_t amp_out_caps_show(struct hdac_device *codec, hda_nid_t nid,static ssize_t power_caps_show (struct hdac_device *codec,hda_nid_t nid,struct widget_attribute *attr,char *buf) { -if (nid != codec->afg && !(get_wcaps (codec, nid) &AC_WCAP_POWER )) +if (nid != codec->afg && !(snd_hdac_get_wcaps (codec, nid) &AC_WCAP_POWER ))return 0 ;return sysfs_emit (buf,"0x%08x\n" ,snd_hdac_read_parm (codec, nid,AC_PAR_POWER_STATE ));
sound/hda/local.h +0 -21
@@ -6,27 +6,6 @@#ifndef __HDAC_LOCAL_H#define __HDAC_LOCAL_H -#define get_wcaps (codec, nid) \ - snd_hdac_read_parm(codec, nid, AC_PAR_AUDIO_WIDGET_CAP) - -/* get the widget type from widget capability bits */ -static inline int get_wcaps_type (unsigned int wcaps) -{ -if (!wcaps) -return -1 ;/* invalid type */ -return (wcaps &AC_WCAP_TYPE ) >>AC_WCAP_TYPE_SHIFT ; -} - -static inline unsigned int get_wcaps_channels (u32 wcaps) -{ -unsigned int chans; - - chans = (wcaps &AC_WCAP_CHAN_CNT_EXT ) >>13 ; - chans = (chans +1 ) *2 ; - -return chans; -} -extern const struct attribute_group *hdac_dev_attr_groups[];int hda_widget_sysfs_init (struct hdac_device *codec); int hda_widget_sysfs_reinit(struct hdac_device *codec, hda_nid_t start_nid,
sound/soc/codecs/hdac_hdmi.c +10 -11
@@ -24,7 +24,6 @@#include <sound/hda_i915.h> #include <sound/pcm_drm_eld.h> #include <sound/hda_chmap.h> -#include "../../hda/local.h" #include "hdac_hdmi.h" #define NAME_SIZE 32
@@ -221,8 +220,8 @@ static int hdac_hdmi_get_port_len(struct hdac_device *hdev, hda_nid_t nid)unsigned int caps;unsigned int type, param; - caps =get_wcaps (hdev, nid); - type =get_wcaps_type (caps); + caps =snd_hdac_get_wcaps (hdev, nid); + type =snd_hdac_get_wcaps_type (caps);if (!(caps &AC_WCAP_DIGITAL ) || (type !=AC_WID_PIN ))return 0 ;
@@ -492,10 +491,10 @@ static int hdac_hdmi_query_port_connlist(struct hdac_device *hdev, struct hdac_hdmi_pin *pin, struct hdac_hdmi_port *port) { -if (!(get_wcaps (hdev, pin->nid) &AC_WCAP_CONN_LIST )) { +if (!(snd_hdac_get_wcaps (hdev, pin->nid) &AC_WCAP_CONN_LIST )) {dev_warn (&hdev->dev,"HDMI: pin %d wcaps %#x does not support connection list\n" , - pin->nid,get_wcaps (hdev, pin->nid)); + pin->nid,snd_hdac_get_wcaps (hdev, pin->nid));return -EINVAL ; }
@@ -660,8 +659,8 @@ hdac_hdmi_query_cvt_params(struct hdac_device *hdev, struct hdac_hdmi_cvt *cvt)struct hdac_hdmi_priv *hdmi =hdev_to_hdmi_priv (hdev);int err; - chans =get_wcaps (hdev, cvt->nid); - chans =get_wcaps_channels (chans); + chans =snd_hdac_get_wcaps (hdev, cvt->nid); + chans =snd_hdac_get_wcaps_channels (chans); cvt->params.channels_min =2 ;
@@ -743,7 +742,7 @@ static void hdac_hdmi_set_power_state(struct hdac_device *hdev,int count;unsigned int state; -if (get_wcaps (hdev, nid) &AC_WCAP_POWER ) { +if (snd_hdac_get_wcaps (hdev, nid) &AC_WCAP_POWER ) {if (!snd_hdac_check_power_state (hdev, nid, pwr_state)) {for (count =0 ; count <10 ; count++) { snd_hdac_codec_read(hdev, nid, 0,
@@ -761,7 +760,7 @@ static void hdac_hdmi_set_power_state(struct hdac_device *hdev,static void hdac_hdmi_set_amp (struct hdac_device *hdev,hda_nid_t nid,int val) { -if (get_wcaps (hdev, nid) &AC_WCAP_OUT_AMP ) +if (snd_hdac_get_wcaps (hdev, nid) &AC_WCAP_OUT_AMP )snd_hdac_codec_write (hdev, nid,0 ,AC_VERB_SET_AMP_GAIN_MUTE , val); }
@@ -1648,8 +1647,8 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_device *hdev,unsigned int caps;unsigned int type; - caps =get_wcaps (hdev, nid); - type =get_wcaps_type (caps); + caps =snd_hdac_get_wcaps (hdev, nid); + type =snd_hdac_get_wcaps_type (caps);if (!(caps &AC_WCAP_DIGITAL ))continue ;
Signature · 1 line
2.50.0
Re: [PATCH 01/27] ALSA: hda: Move widget capability macros into hdaudio.h
Quoted 1 line · Takashi Iwai
The
get_wcaps()and co are used not only by HD-audio core but also
What is 'co'? Meaning get_wpacs() and friends?
Quoted 8 lines
other driver code, hence it'd be better to put into the common header instead of
local.h.OTOH, there are macros of the same name like
get_wcaps()that are still used insound/pci/hda/*locally, and those conflict with each other. So we need to renameget_wcaps()(to be moved from hda-core) with the propersnd_hdacprefix for avoiding name conflicts, and define in the commonhdaudio.h.
No problems found, just some nitpicks.
Quoted 15 lines
Signed-off-by Takashi Iwai <[email protected]>--- include/sound/hdaudio.h | 24 ++++++++++++++++++++++++ sound/hda/hdac_device.c | 8 ++++---- sound/hda/hdac_sysfs.c | 14 +++++++------- sound/hda/local.h | 21 --------------------- sound/soc/codecs/hdac_hdmi.c | 21 ++++++++++----------- 5 files changed, 45 insertions(+), 43 deletions(-)include/sound/hdaudio.h +0
-0
include/sound/hdaudio.h static inline void snd_hdac_dsp_cleanup(struct hdac_stream *azx_dev, · line 685
Quoted 6 lines
include/sound/hdaudio.h +3
-0@@ -680,6 +680,30 @@ static inline void snd_hdac_dsp_cleanup(struct hdac_stream *azx_dev, }#endif /* CONFIG_SND_HDA_DSP_LOADER */ +/* +* Easy macros for widget capabilities +*/
Nitpick: there is just one macro here.
TBH perhaps there is a better location for it - where all snd_hdac_read_parm() could lie - but that's probably a subject for a different tale.
include/sound/hdaudio.h static inline void snd_hdac_dsp_cleanup(struct hdac_stream *azx_dev, · line 687
Quoted 2 lines
include/sound/hdaudio.h +2
-0+#define snd_hdac_get_wcaps (codec, nid) \ + snd_hdac_read_parm(codec, nid, AC_PAR_AUDIO_WIDGET_CAP)
In future wording for "parameter" could also be streamlined. Typically I see 'param' in the code. "parm" is more of an outlier.
Quoted 19 lines
include/sound/hdaudio.h +19
-0+ +/* get the widget type from widget capability bits */ +static inline int snd_hdac_get_wcaps_type (unsigned int wcaps) +{ +if (!wcaps) +return -1 ;/* invalid type */ +return (wcaps &AC_WCAP_TYPE ) >>AC_WCAP_TYPE_SHIFT ; +} + +/* get the number of supported channels */ +static inline unsigned int snd_hdac_get_wcaps_channels (u32 wcaps) +{ +unsigned int chans; + + chans = (wcaps &AC_WCAP_CHAN_CNT_EXT ) >>13 ; + chans = (chans +1 ) *2 ; + +return chans; +}
PATCH 2/27 ALSA: hda: Move HD-audio core stuff into sound/hda/core
In reply to Takashi IwaiThis is a part of HD-audio code restructuring.
Simply move the current code of sound/hda/* into the subdirectory sound/hda/core, so that more stuff can be moved into sound/hda cleanly later.
Most of file names with hdac_ and hdac_ext_ prefix are renamed without the prefix, since they can be identified well in the directory name and superfluous.
---
sound/hda/Kconfig | 67 +------------------
sound/hda/Makefile | 22 +-----
sound/hda/core/Kconfig | 67 +++++++++++++++++++
sound/hda/core/Makefile | 22 ++++++
sound/hda/{ => core}/array.c | 0
sound/hda/{hdac_bus.c => core/bus.c} | 0
.../{hdac_component.c => core/component.c} | 0
.../{hdac_controller.c => core/controller.c} | 0
sound/hda/{hdac_device.c => core/device.c} | 0
sound/hda/{ => core}/ext/Makefile | 2 +-
.../{ext/hdac_ext_bus.c => core/ext/bus.c} | 0
.../ext/controller.c} | 0
.../hdac_ext_stream.c => core/ext/stream.c} | 0
sound/hda/{ => core}/hda_bus_type.c | 0
sound/hda/{ => core}/hdmi_chmap.c | 0
sound/hda/{hdac_i915.c => core/i915.c} | 0
sound/hda/{ => core}/intel-dsp-config.c | 0
sound/hda/{ => core}/intel-nhlt.c | 0
sound/hda/{ => core}/intel-sdw-acpi.c | 0
sound/hda/{ => core}/local.h | 0
sound/hda/{hdac_regmap.c => core/regmap.c} | 0
sound/hda/{hdac_stream.c => core/stream.c} | 0
sound/hda/{hdac_sysfs.c => core/sysfs.c} | 0
sound/hda/{ => core}/trace.c | 0
sound/hda/{ => core}/trace.h | 0
25 files changed, 92 insertions(+), 88 deletions(-)
create mode 100644 sound/hda/core/Kconfig
create mode 100644 sound/hda/core/Makefile
rename sound/hda/{ => core}/array.c (100%)
rename sound/hda/{hdac_bus.c => core/bus.c} (100%)
rename sound/hda/{hdac_component.c => core/component.c} (100%)
rename sound/hda/{hdac_controller.c => core/controller.c} (100%)
rename sound/hda/{hdac_device.c => core/device.c} (100%)
rename sound/hda/{ => core}/ext/Makefile (54%)
rename sound/hda/{ext/hdac_ext_bus.c => core/ext/bus.c} (100%)
rename sound/hda/{ext/hdac_ext_controller.c => core/ext/controller.c} (100%)
rename sound/hda/{ext/hdac_ext_stream.c => core/ext/stream.c} (100%)
rename sound/hda/{ => core}/hda_bus_type.c (100%)
rename sound/hda/{ => core}/hdmi_chmap.c (100%)
rename sound/hda/{hdac_i915.c => core/i915.c} (100%)
rename sound/hda/{ => core}/intel-dsp-config.c (100%)
rename sound/hda/{ => core}/intel-nhlt.c (100%)
rename sound/hda/{ => core}/intel-sdw-acpi.c (100%)
rename sound/hda/{ => core}/local.h (100%)
rename sound/hda/{hdac_regmap.c => core/regmap.c} (100%)
rename sound/hda/{hdac_stream.c => core/stream.c} (100%)
rename sound/hda/{hdac_sysfs.c => core/sysfs.c} (100%)
rename sound/hda/{ => core}/trace.c (100%)
rename sound/hda/{ => core}/trace.h (100%)sound/hda/Kconfig +1 -66
@@ -1,67 +1,2 @@ # SPDX-License-Identifier: GPL-2.0-only -config SND_HDA_CORE - tristate - select REGMAP - -config SND_HDA_DSP_LOADER - bool - -config SND_HDA_ALIGNED_MMIO - bool - -config SND_HDA_COMPONENT - bool - -config SND_HDA_I915 - bool - select SND_HDA_COMPONENT - -config SND_HDA_EXT_CORE - tristate - select SND_HDA_CORE - -config SND_HDA_PREALLOC_SIZE - int "Pre-allocated buffer size for HD-audio driver" - range 0 32768 - default 0 if SND_DMA_SGBUF - default 64 if !SND_DMA_SGBUF - help - Specifies the default pre-allocated buffer-size in kB for the - HD-audio driver. A larger buffer (e.g. 2048) is preferred - for systems using PulseAudio. The default 64 is chosen just - for compatibility reasons. - On x86 systems, the default is zero as S/G allocation works - and no preallocation is needed in most cases. - - Note that the pre-allocation size can be changed dynamically - via a proc file (/proc/asound/card*/pcm*/sub*/prealloc), too. - -config SND_INTEL_NHLT - bool - # this config should be selected only for Intel ACPI platforms. - # A fallback is provided so that the code compiles in all cases. - -config SND_INTEL_DSP_CONFIG - tristate - select ACPI_NHLT if ACPI - select SND_INTEL_NHLT if ACPI - select SND_INTEL_SOUNDWIRE_ACPI if ACPI - # this config should be selected only for Intel DSP platforms. - # A fallback is provided so that the code compiles in all cases. - -config SND_INTEL_SOUNDWIRE_ACPI - tristate - -config SND_INTEL_BYT_PREFER_SOF - bool "Prefer SOF driver over SST on BY/CHT platforms" - depends on SND_SST_ATOM_HIFI2_PLATFORM_ACPI && SND_SOC_SOF_BAYTRAIL - default n - help - The kernel has 2 drivers for the Low Power Engine audio-block on - Bay- and Cherry-Trail SoCs. The old SST driver and the new SOF - driver. If both drivers are enabled then the kernel will default - to using the old SST driver, unless told otherwise through the - snd_intel_dspcfg.dsp_driver module-parameter. - - Set this option to Y to make the kernel default to the new SOF - driver instead. +source "sound/hda/core/Kconfig"
sound/hda/Makefile +1 -21
@@ -1,22 +1,2 @@ # SPDX-License-Identifier: GPL-2.0 -snd-hda-core-y := hda_bus_type.o hdac_bus.o hdac_device.o hdac_sysfs.o \ - hdac_regmap.o hdac_controller.o hdac_stream.o array.o hdmi_chmap.o - -snd-hda-core-y += trace.o -CFLAGS_trace.o := -I$(src) - -# for sync with i915 gfx driver -snd-hda-core-$(CONFIG_SND_HDA_COMPONENT) += hdac_component.o -snd-hda-core-$(CONFIG_SND_HDA_I915) += hdac_i915.o - -obj-$(CONFIG_SND_HDA_CORE) += snd-hda-core.o - -#extended hda -obj-$(CONFIG_SND_HDA_EXT_CORE) += ext/ - -snd-intel-dspcfg-y := intel-dsp-config.o -snd-intel-dspcfg-$(CONFIG_SND_INTEL_NHLT) += intel-nhlt.o -obj-$(CONFIG_SND_INTEL_DSP_CONFIG) += snd-intel-dspcfg.o - -snd-intel-sdw-acpi-y := intel-sdw-acpi.o -obj-$(CONFIG_SND_INTEL_SOUNDWIRE_ACPI) += snd-intel-sdw-acpi.o +obj-y += core/
sound/hda/core/Kconfig new file +67 -0
67 lines not on this page · raw message
sound/hda/core/Makefile new file +22 -0
@@ -0,0 +1,22 @@ +# SPDX-License-Identifier: GPL-2.0 +snd-hda-core-y := hda_bus_type.o bus.o device.o sysfs.o \ + regmap.o controller.o stream.o array.o hdmi_chmap.o + +snd-hda-core-y += trace.o +CFLAGS_trace.o := -I$(src) + +# for sync with i915 gfx driver +snd-hda-core-$(CONFIG_SND_HDA_COMPONENT) += component.o +snd-hda-core-$(CONFIG_SND_HDA_I915) += i915.o + +obj-$(CONFIG_SND_HDA_CORE) += snd-hda-core.o + +#extended hda +obj-$(CONFIG_SND_HDA_EXT_CORE) += ext/ + +snd-intel-dspcfg-y := intel-dsp-config.o +snd-intel-dspcfg-$(CONFIG_SND_INTEL_NHLT) += intel-nhlt.o +obj-$(CONFIG_SND_INTEL_DSP_CONFIG) += snd-intel-dspcfg.o + +snd-intel-sdw-acpi-y := intel-sdw-acpi.o +obj-$(CONFIG_SND_INTEL_SOUNDWIRE_ACPI) += snd-intel-sdw-acpi.o
sound/hda/core/array.c renamed from sound/hda/array.c +0 -0
sound/hda/core/bus.c renamed from sound/hda/hdac_bus.c +0 -0
sound/hda/core/component.c renamed from sound/hda/hdac_component.c +0 -0
sound/hda/core/controller.c renamed from sound/hda/hdac_controller.c +0 -0
sound/hda/core/device.c renamed from sound/hda/hdac_device.c +0 -0
sound/hda/core/ext/Makefile renamed from sound/hda/ext/Makefile +1 -1
@@ -1,4 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only -snd-hda-ext-core-y := hdac_ext_bus.o hdac_ext_controller.o hdac_ext_stream.o +snd-hda-ext-core-y := bus.o controller.o stream.o obj-$(CONFIG_SND_HDA_EXT_CORE) += snd-hda-ext-core.o
sound/hda/core/ext/bus.c renamed from sound/hda/ext/hdac_ext_bus.c +0 -0
sound/hda/core/ext/controller.c renamed from sound/hda/ext/hdac_ext_controller.c +0 -0
sound/hda/core/ext/stream.c renamed from sound/hda/ext/hdac_ext_stream.c +0 -0
sound/hda/core/hda_bus_type.c renamed from sound/hda/hda_bus_type.c +0 -0
sound/hda/core/hdmi_chmap.c renamed from sound/hda/hdmi_chmap.c +0 -0
sound/hda/core/i915.c renamed from sound/hda/hdac_i915.c +0 -0
sound/hda/core/intel-dsp-config.c renamed from sound/hda/intel-dsp-config.c +0 -0
sound/hda/core/intel-nhlt.c renamed from sound/hda/intel-nhlt.c +0 -0
sound/hda/core/intel-sdw-acpi.c renamed from sound/hda/intel-sdw-acpi.c +0 -0
sound/hda/core/local.h renamed from sound/hda/local.h +0 -0
sound/hda/core/regmap.c renamed from sound/hda/hdac_regmap.c +0 -0
sound/hda/core/stream.c renamed from sound/hda/hdac_stream.c +0 -0
sound/hda/core/sysfs.c renamed from sound/hda/hdac_sysfs.c +0 -0
sound/hda/core/trace.c renamed from sound/hda/trace.c +0 -0
sound/hda/core/trace.h renamed from sound/hda/trace.h +0 -0
Signature · 1 line
2.50.0
Re: [PATCH 02/27] ALSA: hda: Move HD-audio core stuff into sound/hda/core
Quoted 4 lines · Takashi Iwai
This is a part of HD-audio code restructuring.
Simply move the current code ofsound/hda/*into the subdirectorysound/hda/core, so that more stuff can be moved intosound/hdacleanly later.
Nitpicks: I'd suggest to drop 'stuff' in the title, 'HD-audio core' is enough. Same with 'Simply move'. 'Move' is sufficient.
Quoted 5 lines
Most of file names with
hdac_andhdac_ext_prefix are renamed without the prefix, since they can be identified well in the directory name and superfluous.
Just nitpicks - nothing TODO as a must, looks good as is.
Quoted 51 lines
Signed-off-by Takashi Iwai <[email protected]>--- sound/hda/Kconfig | 67 +------------------ sound/hda/Makefile | 22 +----- sound/hda/core/Kconfig | 67 +++++++++++++++++++ sound/hda/core/Makefile | 22 ++++++ sound/hda/{ => core}/array.c | 0 sound/hda/{hdac_bus.c => core/bus.c} | 0 .../{hdac_component.c => core/component.c} | 0 .../{hdac_controller.c => core/controller.c} | 0 sound/hda/{hdac_device.c => core/device.c} | 0 sound/hda/{ => core}/ext/Makefile | 2 +- .../{ext/hdac_ext_bus.c => core/ext/bus.c} | 0 .../ext/controller.c} | 0 .../hdac_ext_stream.c => core/ext/stream.c} | 0 sound/hda/{ => core}/hda_bus_type.c | 0 sound/hda/{ => core}/hdmi_chmap.c | 0 sound/hda/{hdac_i915.c => core/i915.c} | 0 sound/hda/{ => core}/intel-dsp-config.c | 0 sound/hda/{ => core}/intel-nhlt.c | 0 sound/hda/{ => core}/intel-sdw-acpi.c | 0 sound/hda/{ => core}/local.h | 0 sound/hda/{hdac_regmap.c => core/regmap.c} | 0 sound/hda/{hdac_stream.c => core/stream.c} | 0 sound/hda/{hdac_sysfs.c => core/sysfs.c} | 0 sound/hda/{ => core}/trace.c | 0 sound/hda/{ => core}/trace.h | 0 25 files changed, 92 insertions(+), 88 deletions(-)create mode 100644
sound/hda/core/Kconfig
create mode 100644sound/hda/core/Makefile
renamesound/hda/{=>core}/array.c(100%)
renamesound/hda/{hdac_bus.c=>core/bus.c} (100%)
renamesound/hda/{hdac_component.c=>core/component.c} (100%) renamesound/hda/{hdac_controller.c=>core/controller.c} (100%) renamesound/hda/{hdac_device.c=>core/device.c} (100%)
renamesound/hda/{=> core}/ext/Makefile (54%)
renamesound/hda/{ext/hdac_ext_bus.c=>core/ext/bus.c} (100%) renamesound/hda/{ext/hdac_ext_controller.c=>core/ext/controller.c} (100%) renamesound/hda/{ext/hdac_ext_stream.c=>core/ext/stream.c} (100%) renamesound/hda/{=>core}/hda_bus_type.c(100%)
renamesound/hda/{=>core}/hdmi_chmap.c(100%)
renamesound/hda/{hdac_i915.c=>core/i915.c} (100%)
renamesound/hda/{=>core}/intel-dsp-config.c(100%)
renamesound/hda/{=>core}/intel-nhlt.c(100%)
renamesound/hda/{=>core}/intel-sdw-acpi.c(100%)
renamesound/hda/{=>core}/local.h(100%)
renamesound/hda/{hdac_regmap.c=>core/regmap.c} (100%)
renamesound/hda/{hdac_stream.c=>core/stream.c} (100%)
renamesound/hda/{hdac_sysfs.c=>core/sysfs.c} (100%)
renamesound/hda/{=>core}/trace.c(100%)
renamesound/hda/{=>core}/trace.h(100%)
PATCH 3/27 ALSA: hda: Move common codec driver into sound/hda/common directory
In reply to Takashi IwaiThe snd-hda-codec module contains the most of common code used by both HD-audio controller and codec drivers, and it's basically independent from PCI. Let's move the code to sound/hda/common directory as a part of code reorganization.
The hda_ prefix is dropped from the most of file names as it's rather superfluous.
---
sound/hda/Kconfig | 5 ++
sound/hda/Makefile | 1 +
sound/hda/common/Kconfig | 80 +++++++++++++++++++
sound/hda/common/Makefile | 13 +++
.../common/auto_parser.c} | 0
.../{pci/hda/hda_beep.c => hda/common/beep.c} | 0
.../{pci/hda/hda_bind.c => hda/common/bind.c} | 0
.../hda/hda_codec.c => hda/common/codec.c} | 0
.../common/controller.c} | 2 +-
.../common/controller_trace.h} | 2 +-
.../{pci/hda => hda/common}/hda_auto_parser.h | 0
sound/{pci/hda => hda/common}/hda_beep.h | 0
.../{pci/hda => hda/common}/hda_controller.h | 0
sound/{pci/hda => hda/common}/hda_jack.h | 0
sound/{pci/hda => hda/common}/hda_local.h | 0
.../hda/hda_hwdep.c => hda/common/hwdep.c} | 0
.../{pci/hda/hda_jack.c => hda/common/jack.c} | 0
.../{pci/hda/hda_proc.c => hda/common/proc.c} | 0
.../hda/hda_sysfs.c => hda/common/sysfs.c} | 0
sound/pci/hda/Kconfig | 76 ------------------
sound/pci/hda/Makefile | 13 +--
21 files changed, 103 insertions(+), 89 deletions(-)
create mode 100644 sound/hda/common/Kconfig
create mode 100644 sound/hda/common/Makefile
rename sound/{pci/hda/hda_auto_parser.c => hda/common/auto_parser.c} (100%)
rename sound/{pci/hda/hda_beep.c => hda/common/beep.c} (100%)
rename sound/{pci/hda/hda_bind.c => hda/common/bind.c} (100%)
rename sound/{pci/hda/hda_codec.c => hda/common/codec.c} (100%)
rename sound/{pci/hda/hda_controller.c => hda/common/controller.c} (99%)
rename sound/{pci/hda/hda_controller_trace.h => hda/common/controller_trace.h} (97%)
rename sound/{pci/hda => hda/common}/hda_auto_parser.h (100%)
rename sound/{pci/hda => hda/common}/hda_beep.h (100%)
rename sound/{pci/hda => hda/common}/hda_controller.h (100%)
rename sound/{pci/hda => hda/common}/hda_jack.h (100%)
rename sound/{pci/hda => hda/common}/hda_local.h (100%)
rename sound/{pci/hda/hda_hwdep.c => hda/common/hwdep.c} (100%)
rename sound/{pci/hda/hda_jack.c => hda/common/jack.c} (100%)
rename sound/{pci/hda/hda_proc.c => hda/common/proc.c} (100%)
rename sound/{pci/hda/hda_sysfs.c => hda/common/sysfs.c} (100%)sound/hda/Kconfig +5 -0
@@ -1,2 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only +menu "HD-Audio" + +source "sound/hda/common/Kconfig" source "sound/hda/core/Kconfig" + +endmenu
sound/hda/Makefile +1 -0
@@ -1,2 +1,3 @@ # SPDX-License-Identifier: GPL-2.0 obj-y += core/ +obj-$(CONFIG_SND_HDA) += common/
sound/hda/common/Kconfig new file +80 -0
80 lines not on this page · raw message
sound/hda/common/Makefile new file +13 -0
@@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0 +snd-hda-codec-y := bind.o codec.o jack.o auto_parser.o sysfs.o +snd-hda-codec-y += controller.o +snd-hda-codec-$(CONFIG_SND_PROC_FS) += proc.o + +snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hwdep.o +snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += beep.o + +# for trace-points +CFLAGS_controller.o := -I$(src) + +# common driver +obj-$(CONFIG_SND_HDA) := snd-hda-codec.o
sound/hda/common/auto_parser.c renamed from sound/pci/hda/hda_auto_parser.c +0 -0
sound/hda/common/beep.c renamed from sound/pci/hda/hda_beep.c +0 -0
sound/hda/common/bind.c renamed from sound/pci/hda/hda_bind.c +0 -0
sound/hda/common/codec.c renamed from sound/pci/hda/hda_codec.c +0 -0
sound/hda/common/controller.c renamed from sound/pci/hda/hda_controller.c +1 -1
@@ -29,7 +29,7 @@#include "hda_local.h" #define CREATE_TRACE_POINTS -#include "hda_controller_trace.h" +#include "controller_trace.h" /* DSP lock helpers */ #define dsp_lock (dev) snd_hdac_dsp_lock(azx_stream(dev))
sound/hda/common/controller_trace.h renamed from sound/pci/hda/hda_controller_trace.h +1 -1
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: GPL-2.0 */ #undef TRACE_SYSTEM#define TRACE_SYSTEM hda_controller -#define TRACE_INCLUDE_FILE hda_controller_trace +#define TRACE_INCLUDE_FILE controller_trace#if !defined(_TRACE_HDA_CONTROLLER_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_HDA_CONTROLLER_H
sound/hda/common/hda_auto_parser.h renamed from sound/pci/hda/hda_auto_parser.h +0 -0
sound/hda/common/hda_beep.h renamed from sound/pci/hda/hda_beep.h +0 -0
sound/hda/common/hda_controller.h renamed from sound/pci/hda/hda_controller.h +0 -0
sound/hda/common/hda_jack.h renamed from sound/pci/hda/hda_jack.h +0 -0
sound/hda/common/hda_local.h renamed from sound/pci/hda/hda_local.h +0 -0
sound/hda/common/hwdep.c renamed from sound/pci/hda/hda_hwdep.c +0 -0
sound/hda/common/jack.c renamed from sound/pci/hda/hda_jack.c +0 -0
sound/hda/common/proc.c renamed from sound/pci/hda/hda_proc.c +0 -0
sound/hda/common/sysfs.c renamed from sound/pci/hda/hda_sysfs.c +0 -0
sound/pci/hda/Kconfig +0 -76
100 lines not on this page · raw message
sound/pci/hda/Makefile +2 -11
@@ -3,17 +3,11 @@ snd-hda-intel-y := hda_intel.o snd-hda-tegra-y := hda_tegra.o snd-hda-acpi-y := hda_acpi.o -snd-hda-codec-y := hda_bind.o hda_codec.o hda_jack.o hda_auto_parser.o hda_sysfs.o -snd-hda-codec-y += hda_controller.o -snd-hda-codec-$(CONFIG_SND_PROC_FS) += hda_proc.o - -snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o -snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o - # for trace-points -CFLAGS_hda_controller.o := -I$(src) CFLAGS_hda_intel.o := -I$(src) +subdir-ccflags-y += -I$(src)/../../hda/common + snd-hda-codec-generic-y := hda_generic.o snd-hda-codec-realtek-y := patch_realtek.o snd-hda-codec-cmedia-y := patch_cmedia.o
@@ -43,9 +37,6 @@ snd-hda-scodec-tas2781-y := tas2781_hda.o snd-hda-scodec-tas2781-i2c-y := tas2781_hda_i2c.o snd-hda-scodec-tas2781-spi-y := tas2781_hda_spi.o -# common driver -obj-$(CONFIG_SND_HDA) := snd-hda-codec.o - # codec drivers obj-$(CONFIG_SND_HDA_GENERIC) += snd-hda-codec-generic.o obj-$(CONFIG_SND_HDA_CODEC_REALTEK) += snd-hda-codec-realtek.o
Signature · 1 line
2.50.0
PATCH 4/27 ALSA: hda: Move CONFIG_SND_HDA_PREALLOC_SIZE into sound/hda/common
In reply to Takashi IwaiCONFIG_SND_HDA_PREALLOC_SIZE is used only by controller.c in sound/hda/common, hence it depends on CONFIG_SND_HDA.
Move the definition to the right place inside SND_HDA if/endif block in sound/hda/common/Kconfig.
--- sound/hda/common/Kconfig | 17 +++++++++++++++++ sound/hda/core/Kconfig | 16 ---------------- 2 files changed, 17 insertions(+), 16 deletions(-)
sound/hda/common/Kconfig +17 -0
@@ -77,4 +77,21 @@ config SND_HDA_CTL_DEV_ID The old behaviour (Y) is obsolete and will be removed. Consider to not enable this option. + +config SND_HDA_PREALLOC_SIZE + int "Pre-allocated buffer size for HD-audio driver" + range 0 32768 + default 0 if SND_DMA_SGBUF + default 64 if !SND_DMA_SGBUF + help + Specifies the default pre-allocated buffer-size in kB for the + HD-audio driver. A larger buffer (e.g. 2048) is preferred + for systems using PulseAudio. The default 64 is chosen just + for compatibility reasons. + On x86 systems, the default is zero as S/G allocation works + and no preallocation is needed in most cases. + + Note that the pre-allocation size can be changed dynamically + via a proc file (/proc/asound/card*/pcm*/sub*/prealloc), too. + endif
sound/hda/core/Kconfig +0 -16
@@ -20,22 +20,6 @@ config SND_HDA_EXT_CORE tristate select SND_HDA_CORE -config SND_HDA_PREALLOC_SIZE - int "Pre-allocated buffer size for HD-audio driver" - range 0 32768 - default 0 if SND_DMA_SGBUF - default 64 if !SND_DMA_SGBUF - help - Specifies the default pre-allocated buffer-size in kB for the - HD-audio driver. A larger buffer (e.g. 2048) is preferred - for systems using PulseAudio. The default 64 is chosen just - for compatibility reasons. - On x86 systems, the default is zero as S/G allocation works - and no preallocation is needed in most cases. - - Note that the pre-allocation size can be changed dynamically - via a proc file (/proc/asound/card*/pcm*/sub*/prealloc), too. - config SND_INTEL_NHLT bool # this config should be selected only for Intel ACPI platforms.
Signature · 1 line
2.50.0
PATCH 5/27 ALSA: hda: Move controller drivers into sound/hda/controllers directory
In reply to Takashi IwaiNow HD-audio controller drivers are moved into sound/hda/controllers directory as a part of HD-audio code reorganization. Most of drivers are independent from PCI bus, hence it makes more sense to put under sound/hda.
The hda_ prefix is dropped from most of files at moving, as it's more or less superfluous.
---
sound/hda/Kconfig | 1 +
sound/hda/Makefile | 4 ++
sound/hda/controllers/Kconfig | 42 +++++++++++++++++++
sound/hda/controllers/Makefile | 13 ++++++
.../hda/hda_acpi.c => hda/controllers/acpi.c} | 0
.../hda_intel.c => hda/controllers/intel.c} | 5 +--
.../hda_intel.h => hda/controllers/intel.h} | 0
.../controllers/intel_trace.h} | 2 +-
.../hda_tegra.c => hda/controllers/tegra.c} | 0
sound/pci/hda/Kconfig | 42 -------------------
sound/pci/hda/Makefile | 14 -------
11 files changed, 63 insertions(+), 60 deletions(-)
create mode 100644 sound/hda/controllers/Kconfig
create mode 100644 sound/hda/controllers/Makefile
rename sound/{pci/hda/hda_acpi.c => hda/controllers/acpi.c} (100%)
rename sound/{pci/hda/hda_intel.c => hda/controllers/intel.c} (99%)
rename sound/{pci/hda/hda_intel.h => hda/controllers/intel.h} (100%)
rename sound/{pci/hda/hda_intel_trace.h => hda/controllers/intel_trace.h} (95%)
rename sound/{pci/hda/hda_tegra.c => hda/controllers/tegra.c} (100%)sound/hda/Kconfig +1 -0
@@ -2,6 +2,7 @@ menu "HD-Audio" source "sound/hda/common/Kconfig" +source "sound/hda/controllers/Kconfig" source "sound/hda/core/Kconfig" endmenu
sound/hda/Makefile +4 -0
@@ -1,3 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 obj-y += core/ obj-$(CONFIG_SND_HDA) += common/ +# this must be the last entry after codec drivers; +# otherwise the codec patches won't be hooked before the PCI probe +# when built in kernel +obj-$(CONFIG_SND_HDA) += controllers/
sound/hda/controllers/Kconfig new file +42 -0
42 lines not on this page · raw message
sound/hda/controllers/Makefile new file +13 -0
@@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0 +snd-hda-intel-y := intel.o +snd-hda-tegra-y := tegra.o +snd-hda-acpi-y := acpi.o + +subdir-ccflags-y += -I$(src)/../common + +# for trace-points +CFLAGS_intel.o := -I$(src) + +obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o +obj-$(CONFIG_SND_HDA_TEGRA) += snd-hda-tegra.o +obj-$(CONFIG_SND_HDA_ACPI) += snd-hda-acpi.o
sound/hda/controllers/acpi.c renamed from sound/pci/hda/hda_acpi.c +0 -0
sound/hda/controllers/intel.c renamed from sound/pci/hda/hda_intel.c +2 -3
@@ -54,11 +54,10 @@#include <linux/apple-gmux.h> #include <linux/firmware.h> #include <sound/hda_codec.h> -#include "hda_controller.h" -#include "hda_intel.h" +#include "intel.h" #define CREATE_TRACE_POINTS -#include "hda_intel_trace.h" +#include "intel_trace.h" /* position fix mode */ enum {
sound/hda/controllers/intel.h renamed from sound/pci/hda/hda_intel.h +0 -0
sound/hda/controllers/intel_trace.h renamed from sound/pci/hda/hda_intel_trace.h +1 -1
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: GPL-2.0 */ #undef TRACE_SYSTEM#define TRACE_SYSTEM hda_intel -#define TRACE_INCLUDE_FILE hda_intel_trace +#define TRACE_INCLUDE_FILE intel_trace#if !defined(_TRACE_HDA_INTEL_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_HDA_INTEL_H
sound/hda/controllers/tegra.c renamed from sound/pci/hda/hda_tegra.c +0 -0
sound/pci/hda/Kconfig +0 -42
48 lines not on this page · raw message
sound/pci/hda/Makefile +0 -14
@@ -1,11 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 -snd-hda-intel-y := hda_intel.o -snd-hda-tegra-y := hda_tegra.o -snd-hda-acpi-y := hda_acpi.o - -# for trace-points -CFLAGS_hda_intel.o := -I$(src) - subdir-ccflags-y += -I$(src)/../../hda/common snd-hda-codec-generic-y := hda_generic.o
@@ -66,10 +59,3 @@ obj-$(CONFIG_SND_HDA_SCODEC_COMPONENT) += snd-hda-scodec-component.o obj-$(CONFIG_SND_HDA_SCODEC_TAS2781) += snd-hda-scodec-tas2781.o obj-$(CONFIG_SND_HDA_SCODEC_TAS2781_I2C) += snd-hda-scodec-tas2781-i2c.o obj-$(CONFIG_SND_HDA_SCODEC_TAS2781_SPI) += snd-hda-scodec-tas2781-spi.o - -# this must be the last entry after codec drivers; -# otherwise the codec patches won't be hooked before the PCI probe -# when built in kernel -obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o -obj-$(CONFIG_SND_HDA_TEGRA) += snd-hda-tegra.o -obj-$(CONFIG_SND_HDA_ACPI) += snd-hda-acpi.o
Signature · 1 line
2.50.0
[REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Takashi Iwai <[email protected]>:
Quoted 9 lines
Now HD-audio controller drivers are moved into
sound/hda/controllersdirectory as a part of HD-audio code reorganization. Most of drivers are independent from PCI bus, hence it makes more sense to put undersound/hda.The
hda_prefix is dropped from most of files at moving, as it's more or less superfluous.Signed-off-by Takashi Iwai <[email protected]>
This patch broke my laptop's speakers.
My laptop is Dell Precision 7780.
Here is output of "sudo lspci -vvvvv":
https://zerobin.net/?bb0d52d5c33a1ca8#Z4cktfC0ofZhkzBU4/AFGpYAVJFXrus46nDeLQOV22s=
(This output was collected on Linux 6.12.43+deb13-amd64, audio works there.)
My OS is Debian Trixie.
If you need my config, then here is my config I tested with linux-next:
https://zerobin.net/?989789b5698e0afe#DKjA80yFwRFnLkYwo3ZnNZEVGowGyn5N78aSy8omoGY=
It was tested with current linux-next:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tag/?h=next-20251013
(and audio didn't work).
#regzbot introduced: 2d9223d2d64cb5216859ced6cc33fb3b04e5f98f
Signature · 1 line
Askar Safin
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Quoted 22 lines · Askar Safin
Takashi Iwai <[email protected]>:
Quoted 9 lines
Now HD-audio controller drivers are moved into
sound/hda/controllersdirectory as a part of HD-audio code reorganization. Most of drivers are independent from PCI bus, hence it makes more sense to put undersound/hda.The
hda_prefix is dropped from most of files at moving, as it's more or less superfluous.Signed-off-by Takashi Iwai <[email protected]>This patch broke my laptop's speakers.
My laptop is Dell Precision 7780.
Here is output of "sudo lspci -vvvvv":
https://zerobin.net/?bb0d52d5c33a1ca8#Z4cktfC0ofZhkzBU4/AFGpYAVJFXrus46nDeLQOV22s=
(This output was collected on Linux 6.12.43+deb13-amd64, audio works there.)My OS is Debian Trixie.
Quoted 7 lines
If you need my config, then here is my config I tested with linux-next:
https://zerobin.net/?989789b5698e0afe#DKjA80yFwRFnLkYwo3ZnNZEVGowGyn5N78aSy8omoGY=
It was tested with current linux-next:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tag/?h=next-20251013
(and audio didn't work).#regzbot introduced:
2d9223d2d64cb5216859ced6cc33fb3b04e5f98f
The oft-seen "regression" reports for 6.17 were rather the incorrect kconfig setup, and that's your case, too, I suppose. In 6.17, HD-audio Realtek (and other) codec drivers were split, and each of them can be enable/disabled individually when CONFIG_EXPERT is set, where people often leave them off blindly.
So, please check your kernel config between working and non-working cases. I guess you had CONFIG_SND_HDA_CODEC_REALTEK beforehand, and now it's off.
thanks,
Takashi
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Quoted 1 line · Takashi Iwai
The oft-seen "regression" reports for 6.17 were rather the incorrect
My config indeed didn't have CONFIG_SND_HDA_CODEC_REALTEK.
I set it to "m" and did test again.
And audio still doesn't work.
My new test was on v6.18-rc1. Here is my new config:
https://zerobin.net/?93d5992bfc6b71fb#t3wlNqOtO4CA68ixHQA5+20xXFAh009/I0d4SlIpS9A=
Signature · 1 line
Askar Safin
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Quoted 8 lines · Askar Safin
Quoted 1 line · Takashi Iwai
The oft-seen "regression" reports for 6.17 were rather the incorrect
My config indeed didn't have
CONFIG_SND_HDA_CODEC_REALTEK.I set it to "m" and did test again.
And audio still doesn't work.
You have to enable CONFIG_SND_HDA_CODEC_ALC* config, too. (I guess CONFIG_SND_HDA_CODEC_ALC269=m alone should suffice, but you can set all to m.)
As already mentioned, those are the new config of each Realtek codec driver that now became selectable individually when CONFIG_EXPERT=y (so you say you're an expert :)
Takashi
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Quoted 1 line · Takashi Iwai
You have to enable CONFIG_SND_HDA_CODEC_ALC* config, too.
I just did another experiment. I enabled everything in "audio hd" menu in v6.18-rc1.
And still no sound.
Kernel version is v6.18-rc1. Config is here:
https://zerobin.net/?e345ae7df1223a43#h3Dm4HiKvM3GWbTl3f8ErMAS5cm8gd3MOM/IZP0Ta6w=
As you can see, all CONFIG_SND_HDA_CODEC_ALC* options are enabled there.
Quoted 3 lines
As already mentioned, those are the new config of each Realtek codec driver that now became selectable individually when
CONFIG_EXPERT=y(so you say you're an expert :)
CONFIG_EXPERT is indeed set to "y". This is because this config was generated using "localmodconfig" from Debian's config, which has CONFIG_EXPERT.
Signature · 1 line
Askar Safin
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Quoted 11 lines · Askar Safin
Quoted 1 line · Takashi Iwai
You have to enable CONFIG_SND_HDA_CODEC_ALC* config, too.
I just did another experiment. I enabled everything in "audio hd" menu in v6.18-rc1.
And still no sound.
Kernel version is v6.18-rc1. Config is here:
https://zerobin.net/?e345ae7df1223a43#h3Dm4HiKvM3GWbTl3f8ErMAS5cm8gd3MOM/IZP0Ta6w=As you can see, all CONFIG_SND_HDA_CODEC_ALC* options are enabled there.
And have you unmuted all sounds properly?
Please give alsa-info.sh output (at best from both and non-working cases). Run the script with --no-upload and attach the outputs.
Takashi
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Quoted 1 line · Takashi Iwai
And have you unmuted all sounds properly?
KDE volume widget shows that I have no audio devices. So I cannot unmute anything.
Quoted 2 lines
Please give
alsa-info.shoutput (at best from both and non-working cases). Run the script with --no-upload and attach the outputs.
Okay. First is pre-culprit kernel, i. e. 146355ee880e6d15ba12e2baf5be70e5efe07796, i. e. patch #4 in this patchset ("ALSA: hda: Move CONFIG_SND_HDA_PREALLOC_SIZE into sound/hda/common"). Config is attachment "config-6.16.0-rc4-preculp". "alsa-info" output is attachment "alsa-preculp".
Then culprit kernel, i. e. 2d9223d2d64cb5216859ced6cc33fb3b04e5f98f, i. e. patch #5 in this patchset ("ALSA: hda: Move controller drivers into sound/hda/controllers directory").
Config is attachment "config-6.16.0-rc4-culp".
"alsa-info" output is attachment "alsa-culp".
These two configs are same, they differ in order of parameters only.
Signature · 1 line
Askar Safin
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Quoted 17 lines · Askar Safin
Quoted 1 line · Takashi Iwai
And have you unmuted all sounds properly?
KDE volume widget shows that I have no audio devices. So I cannot unmute anything.
Quoted 2 lines
Please give
alsa-info.shoutput (at best from both and non-working cases). Run the script with --no-upload and attach the outputs.Okay. First is pre-culprit kernel, i. e.
146355ee880e6d15ba12e2baf5be70e5efe07796, i. e. patch #4 in this patchset ("ALSA: hda: MoveCONFIG_SND_HDA_PREALLOC_SIZEintosound/hda/common"). Config is attachment "config-6.16.0-rc4-preculp". "alsa-info" output is attachment "alsa-preculp".
Quoted 7 lines
Then culprit kernel, i. e.
2d9223d2d64cb5216859ced6cc33fb3b04e5f98f, i. e. patch #5 in this patchset ("ALSA: hda: Move controller drivers intosound/hda/controllersdirectory").
Config is attachment "config-6.16.0-rc4-culp".
"alsa-info" output is attachment "alsa-culp".These two configs are same, they differ in order of parameters only.
The dmesg snippet in the new kernel shows:
[ 3.990348] snd_soc_avs 0000:00:1f.3: enabling device (0000 -> 0002) [ 3.990686] snd_soc_avs 0000:00:1f.3: bound 0000:00:02.0 (ops intel_audio_component_bind_ops [i915]) [ 4.029315] snd_soc_avs 0000:00:1f.3: Direct firmware load for intel/avs/adl/dsp_basefw.bin failed with error -2 [ 4.029319] snd_soc_avs 0000:00:1f.3: request firmware failed: -2 [ 4.029346] snd_soc_avs 0000:00:1f.3: firmware boot failed: -2
... which implies that another new driver (ASoC AVS) takes over the device instead of the previous HDA-Intel, and its probe failed due to the lack of the firmware. It seems that Intel didn't release the firmware for avs with ADL platform.
If that's the case, try to choose HDA-Intel driver by passing snd_intel_dspcfg.dsp_driver=1 boot option. Or disabling CONFIG_SND_SOC_INTEL_AVS could help, too.
BTW, you also miss HDMI/DP audio.
Set CONFIG_SND_HDA_CODEC_HDMI=m and CONFIG_SND_HDA_CODEC_HDMI_INTEL=m in addition.
Takashi
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Takashi Iwai <[email protected]>:
Quoted 3 lines
If that's the case, try to choose HDA-Intel driver by passing snd_intel_dspcfg.dsp_driver=1 boot option. Or disabling
CONFIG_SND_SOC_INTEL_AVScould help, too.
Passing snd_intel_dspcfg.dsp_driver=1 indeed helped me.
Signature · 1 line
Askar Safin
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Quoted 7 lines · Askar Safin
Takashi Iwai <[email protected]>:
Quoted 3 lines
If that's the case, try to choose HDA-Intel driver by passing snd_intel_dspcfg.dsp_driver=1 boot option. Or disabling
CONFIG_SND_SOC_INTEL_AVScould help, too.Passing snd_intel_dspcfg.dsp_driver=1 indeed helped me.
Good to hear. So a part of the problem was the incomplete kconfig setup. It worked casually because HDA-Intel was probed first in the first, although basically SOF Alderlake driver should support it. Since your config disabled SOF Alderlake, the HDA-Intel was probed as a fallback. Now, by some subtle change, a different driver (AVS) gets probed, and it failed.
I believe we should drop the Alderlake entries from AVS probe table unless the firmware becomes available publicly. (FWIW, this case was RPL_S).
Cezary, Amadeusz, what do you think?
Takashi
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Quoted 1 line · Takashi Iwai
Good to hear. So a part of the problem was the incomplete kconfig
Another data point: Debian's experimental kernel (6.17.2-1~exp1) does contain culprit (2d9223d2d64c), yet it works.
So, it seems that Debian's people somehow cope with this bug.
Also, when I take vanilla stable kernel 6.17.2 and apply to it Debian patches, listed in this file:
https://salsa.debian.org/kernel-team/linux/-/blob/debian/6.17.2-1_exp1/debian/patches/series?ref_type=tags
and build with Debian's config (with "localmodconfig"), then... the bug happens.
I. e. Debian's kernel has some unknown magic, and I cannot reproduce it by taking vanilla kernel, applying Debian's patches and Debian's config.
Signature · 1 line
Askar Safin
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Quoted 4 lines · Askar Safin
Quoted 1 line · Takashi Iwai
Good to hear. So a part of the problem was the incomplete kconfig
Quoted 8 lines
Another data point: Debian's experimental kernel (6.17.2-1~exp1) does contain culprit (
2d9223d2d64c), yet it works.
So, it seems that Debian's people somehow cope with this bug.Also, when I take vanilla stable kernel 6.17.2 and apply to it Debian patches, listed in this file:
https://salsa.debian.org/kernel-team/linux/-/blob/debian/6.17.2-1_exp1/debian/patches/series?ref_type=tags
and build with Debian's config (with "localmodconfig"), then... the bug happens.
Did you boot (Debian's) 6.17.2 kernel, copy its config from /proc/config.* to .config, then run "make localmodconfig"? If the problem is seen with it, we'd have to take a deeper look.
Basically you can forget the bisection result. You felt into a local minimum during the bisection, and it doesn't point to the real issue.
Takashi
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Quoted 3 lines · Takashi Iwai
Did you boot (Debian's) 6.17.2 kernel, copy its config from
/proc/config.*to .config, then run "make localmodconfig"? If the problem is seen with it, we'd have to take a deeper look.
Yes! Here are more details:
- I installed Debian's kernel 6.17.2-1~exp1. Note that it is "experimental" (this is even more unstable status than "unstable")
- I booted into it
- I noticed that audio works
- Here is config of that kernel: (attached "config-6.17.2-amd64")
- Then I downloaded sources of vanilla stable kernel 6.17.2 from kernel.org
- I applied Debian's patches to it. I took them from here:
https://salsa.debian.org/kernel-team/linux/-/blob/debian/6.17.2-1_exp1/debian/patches/series?ref_type=tags
- I copied Debian's config (see above) to .config (note: there is no /proc/config*
in Debian kernels, there is /boot/config*)
- I run "make localmodconfig", then "make"
- I rebooted into this new kernel
- Here is its config: ("config-6.17.2-debdeb")
- Audio doesn't work
So, it seems Debian does some inexplicable magic when building its kernels. Debian's kernel work, but attempting to reproduce what they do doesn't work.
Also: I'm totally okay with doing more experiments. Just say me what to do, and I will do.
--
Askar Safin
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Quoted 7 lines · Askar Safin
- I installed Debian's kernel 6.17.2-1~exp1. Note that it is "experimental" (this is even more unstable status than "unstable")
- I booted into it
- I noticed that audio works
- Here is config of that kernel: (attached "config-6.17.2-amd64")
- Then I downloaded sources of vanilla stable kernel 6.17.2 from kernel.org
- I applied Debian's patches to it. I took them from here:
Quoted 8 lines
https://salsa.debian.org/kernel-team/linux/-/blob/debian/6.17.2-1_exp1/debian/patches/series?ref_type=tags
- I copied Debian's config (see above) to .config (note: there is no/proc/config*
in Debian kernels, there is/boot/config*)
- I run "make localmodconfig", then "make"
- I rebooted into this new kernel
- Here is its config: ("config-6.17.2-debdeb")
- Audio doesn't work
Okay, I just did exactly same thing, but without "make localmodconfig".
Here is resulting config: (attachment "config-6.17.2-aa"). I. e. "make" instead of "make localmodconfig; make". And audio worked.
So, presumably there is a bug in "localmodconfig". I CC kbuild people.
Signature · 1 line
Askar Safin
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
I did another experiment.
This time with v6.18-rc1.
And I collected more info.
- Here is Debian config for 6.17.2: [attachment config-6.17.2-amd64]
- I downloaded vanilla Linux v6.18-rc1 from kernel.org
- I copied that Debian config (see above) as .config to Linux sources
- I did "LOCALVERSION=-first make --silent -j32 < /dev/null" ("< /dev/null", because I don't want to answer any questions)
- This is output: [attachment first-out]
- Then I booted into it
- Audio works
- Here is config of this kernel: [attachment config-6.18.0-rc1-first]
- Here is "find /lib/modules/6.18.0-rc1-first": [attachment find-6.18.0-rc1-first]
- Here is alsa-info: [attachment alsa-info-first]
- Here is lsmod: [attachment first-lsmod]
- Then I "cd" into kernel source (note that ".config" remained since last time)
- I typed "make localmodconfig < /dev/null"
- Here is output: [attachment localmodconfig-out]
- I did "LOCALVERSION=-second make --silent -j32"
- This command didn't produce any output and didn't ask any questions
- Then I booted into new kernel
- Audio doesn't work
- Here is config of this kernel: [attachment config-6.18.0-rc1-second]
- Here is "find /lib/modules/6.18.0-rc1-second": [attachment find-6.18.0-rc1-second]
- Here is alsa-info: [attachment alsa-info-second]
- Here is lsmod: [attachment second-lsmod]
(Please, say me, if there are any missing files.)
If you need more experiments, ask me.
Signature · 1 line
Askar Safin
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Quoted 30 lines · Askar Safin
I did another experiment.
This time with v6.18-rc1.
And I collected more info.
- Here is Debian config for 6.17.2: [attachment config-6.17.2-amd64]
- I downloaded vanilla Linux v6.18-rc1 from kernel.org
- I copied that Debian config (see above) as .config to Linux sources
- I did "LOCALVERSION=-first make --silent -j32 </dev/null" ("</dev/null", because I don't want to answer any questions)
- This is output: [attachment first-out]
- Then I booted into it
- Audio works
- Here is config of this kernel: [attachment config-6.18.0-rc1-first]
- Here is "find/lib/modules/6.18.0-rc1-first": [attachment find-6.18.0-rc1-first]
- Here is alsa-info: [attachment alsa-info-first]
- Here is lsmod: [attachment first-lsmod]
- Then I "cd" into kernel source (note that ".config" remained since last time)
- I typed "make localmodconfig </dev/null"
- Here is output: [attachment localmodconfig-out]
- I did "LOCALVERSION=-second make --silent -j32"
- This command didn't produce any output and didn't ask any questions
- Then I booted into new kernel
- Audio doesn't work
- Here is config of this kernel: [attachment config-6.18.0-rc1-second]
- Here is "find/lib/modules/6.18.0-rc1-second": [attachment find-6.18.0-rc1-second]
- Here is alsa-info: [attachment alsa-info-second]
- Here is lsmod: [attachment second-lsmod]
Quoted 3 lines
(Please, say me, if there are any missing files.)
If you need more experiments, ask me.
Thanks for detailed logs! Now the situation became clearer.
Could you try to just enable CONFIG_SND_SOC_SOF_ALDERLAKE=m on top of the broken config? If my guess is right, this should make the audio working again.
If yes, it's a problem of a kernel tristate config that doesn't have the own module but referred only for constructing a probe table in snd-intel-dspcfg. This is not really a fault of localmodconfig, but a long-standing design problem. (I'm not sure why this surfaced suddenly, though.) There are a few options to address it, and we have to evaluate / decide what to do.
Takashi
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Quoted 35 lines · Takashi Iwai
Quoted 32 lines · Askar Safin
I did another experiment.
This time with v6.18-rc1.
And I collected more info.
- Here is Debian config for 6.17.2: [attachment config-6.17.2-amd64]
- I downloaded vanilla Linux v6.18-rc1 from kernel.org
- I copied that Debian config (see above) as .config to Linux sources
- I did "LOCALVERSION=-first make --silent -j32 </dev/null" ("</dev/null", because I don't want to answer any questions)
- This is output: [attachment first-out]
- Then I booted into it
- Audio works
- Here is config of this kernel: [attachment config-6.18.0-rc1-first]
- Here is "find/lib/modules/6.18.0-rc1-first": [attachment find-6.18.0-rc1-first]
- Here is alsa-info: [attachment alsa-info-first]
- Here is lsmod: [attachment first-lsmod]
- Then I "cd" into kernel source (note that ".config" remained since last time)
- I typed "make localmodconfig </dev/null"
- Here is output: [attachment localmodconfig-out]
- I did "LOCALVERSION=-second make --silent -j32"
- This command didn't produce any output and didn't ask any questions
- Then I booted into new kernel
- Audio doesn't work
- Here is config of this kernel: [attachment config-6.18.0-rc1-second]
- Here is "find/lib/modules/6.18.0-rc1-second": [attachment find-6.18.0-rc1-second]
- Here is alsa-info: [attachment alsa-info-second]
- Here is lsmod: [attachment second-lsmod](Please, say me, if there are any missing files.)
Quoted 7 lines
Quoted 1 line
If you need more experiments, ask me.
Thanks for detailed logs! Now the situation became clearer.
Could you try to just enable
CONFIG_SND_SOC_SOF_ALDERLAKE=mon top of the broken config? If my guess is right, this should make the audio working again.
Askar, have you tried the above? I was off in the last week, so wondering whether I missed your follow up.
thanks,
Takashi
Quoted 9 lines
If yes, it's a problem of a kernel tristate config that doesn't have the own module but referred only for constructing a probe table in snd-intel-dspcfg. This is not really a fault of localmodconfig, but a long-standing design problem. (I'm not sure why this surfaced suddenly, though.) There are a few options to address it, and we have to evaluate / decide what to do.
Takashi
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Quoted 1 line · Takashi Iwai
Askar, have you tried the above? I was off in the last week, so
I will try later. Possibly after two weeks.
Signature · 1 line
Askar Safin
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
In reply to Takashi IwaiI just noticed (when debugging unrelated bug) another thing: whether audio works depends on what initramfs
generator I use. "initramfs-tools" vs hand-written one. So it seems that set of modules loaded by initramfs affects whether audio works.
Signature · 1 line
Askar Safin
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
In reply to Takashi IwaiQuoted 3 lines · Takashi Iwai
Could you try to just enable
CONFIG_SND_SOC_SOF_ALDERLAKE=mon top of the broken config? If my guess is right, this should make the audio working again.
I did this. And the audio indeed works now.
Here are detailed logs:
- Here is Debian config for 6.18-rc7: [config-6.18-amd64]
- I downloaded vanilla Linux 6.18-rc7 from kernel.org
- I copied that Debian config (see above) as .config to Linux sources
- I did "LOCALVERSION=-first make --silent -j32 < /dev/null" ("< /dev/null", because I don't want to answer any questions)
- This is output: [attachment first-out]
- Then I booted into it
- Audio works
- Here is config of this kernel: [config-6.18.0-rc7-first]
- Here is "find /lib/modules/6.18.0-rc7-first": [find-6.18.0-rc7-first]
- Here is alsa-info: [attachment alsa-info-first]
- Here is lsmod: [attachment first-lsmod]
- Then I "cd" into kernel source (note that ".config" remained since last time)
- I typed "make localmodconfig < /dev/null"
- Here is output: [attachment localmodconfig-out]
- I did "LOCALVERSION=-second make --silent -j32"
- This command didn't produce any output and didn't ask any questions
- Then I booted into new kernel
- Audio doesn't work
- Here is config of this kernel: [config-6.18.0-rc7-second]
- Here is "find /lib/modules/6.18.0-rc7-second": [find-6.18.0-rc7-second]
- Here is alsa-info: [attachment alsa-info-second]
- Here is lsmod: [attachment second-lsmod]
- I enabled CONFIG_SND_SOC_SOF_ALDERLAKE=m
- Then I booted into new kernel
- Audio works (!!!)
- Here is config: [config-6.18.0-rc7-third]
- Here is alsa-info: [alsa-info-third]
I used default Debian initramfs generator during all these tests.
Signature · 1 line
Askar Safin
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Quoted 39 lines · Askar Safin
Quoted 3 lines · Takashi Iwai
Could you try to just enable
CONFIG_SND_SOC_SOF_ALDERLAKE=mon top of the broken config? If my guess is right, this should make the audio working again.I did this. And the audio indeed works now.
Here are detailed logs:
- Here is Debian config for 6.18-rc7: [config-6.18-amd64]
- I downloaded vanilla Linux 6.18-rc7 from kernel.org
- I copied that Debian config (see above) as .config to Linux sources
- I did "LOCALVERSION=-first make --silent -j32 </dev/null" ("</dev/null", because I don't want to answer any questions)
- This is output: [attachment first-out]
- Then I booted into it
- Audio works
- Here is config of this kernel: [config-6.18.0-rc7-first]
- Here is "find/lib/modules/6.18.0-rc7-first": [find-6.18.0-rc7-first]
- Here is alsa-info: [attachment alsa-info-first]
- Here is lsmod: [attachment first-lsmod]
- Then I "cd" into kernel source (note that ".config" remained since last time)
- I typed "make localmodconfig </dev/null"
- Here is output: [attachment localmodconfig-out]
- I did "LOCALVERSION=-second make --silent -j32"
- This command didn't produce any output and didn't ask any questions
- Then I booted into new kernel
- Audio doesn't work
- Here is config of this kernel: [config-6.18.0-rc7-second]
- Here is "find/lib/modules/6.18.0-rc7-second": [find-6.18.0-rc7-second]
- Here is alsa-info: [attachment alsa-info-second]
- Here is lsmod: [attachment second-lsmod]
- I enabledCONFIG_SND_SOC_SOF_ALDERLAKE=m
- Then I booted into new kernel
- Audio works (!!!)
- Here is config: [config-6.18.0-rc7-third]
- Here is alsa-info: [alsa-info-third]
Quoted 1 line
I used default Debian initramfs generator during all these tests.
Then the problem is that snd-intel-dspcfg assigns SND_INTEL_DSP_DRIVER_ANY because no corresponding entry matches to your device without CONFIG_SND_SOC_SOF_ALDERLAKE. This leads to let AVS probing it, then failing.
A rather hackish fix would be something like below. Instead of dropping the SOF-only entries via ifdef, make them dumb entries instead, so that the legacy driver are assigned for those when the kconfigs aren't set.
The below patch is to the latest Linus tree, and for older kernels, you might need to adjust it, but you see what to be done there.
thanks,
Takashi
-- 8< --
sound/hda/core/intel-dsp-config.c +135 -111
@@ -29,6 +29,9 @@ MODULE_PARM_DESC(dsp_driver, "Force the DSP driver for Intel DSP (0=auto, 1=lega#define FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE (FLAG_SOF_ONLY_IF_DMIC | \ FLAG_SOF_ONLY_IF_SOUNDWIRE) +/* Enable SOF only the given kconfig is enabled, otherwise fallback to legacy */ +#define FLAG_SOF_DEP (cfg) (IS_ENABLED(cfg) ? FLAG_SOF : 0) +struct config_entry {u32 flags;u16 device;
@@ -209,11 +212,13 @@ static const struct config_entry config_table[] = { .device = PCI_DEVICE_ID_INTEL_HDA_CNL_LP, .codec_hid = &essx_83x6, }, +#endif { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_CANNONLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_CNL_LP, }, -#endif +/* Coffelake */ #if IS_ENABLED (CONFIG_SND_SOC_SOF_COFFEELAKE )
@@ -230,11 +235,12 @@ static const struct config_entry config_table[] = { {} } }, +#endif { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_COFFEELAKE) |\ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_CNL_H, }, -#endif#if IS_ENABLED (CONFIG_SND_SOC_SOF_COMETLAKE )/* Cometlake-LP */
@@ -269,10 +275,6 @@ static const struct config_entry config_table[] = { .device = PCI_DEVICE_ID_INTEL_HDA_CML_LP, .codec_hid = &essx_83x6, }, - { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, - .device = PCI_DEVICE_ID_INTEL_HDA_CML_LP, - },/* Cometlake-H */ { .flags = FLAG_SOF,
@@ -298,11 +300,17 @@ static const struct config_entry config_table[] = { .device = PCI_DEVICE_ID_INTEL_HDA_CML_H, .codec_hid = &essx_83x6, }, +#endif { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_COMETLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_CML_H, }, -#endif + { + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_COMETLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .device = PCI_DEVICE_ID_INTEL_HDA_CML_LP, + }, /* Icelake */ #if IS_ENABLED(CONFIG_SND_SOC_SOF_ICELAKE)
@@ -324,11 +332,12 @@ static const struct config_entry config_table[] = { .device = PCI_DEVICE_ID_INTEL_HDA_ICL_LP, .codec_hid = &essx_83x6, }, +#endif { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_ICELAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_ICL_LP, }, -#endif /* Jasper Lake */ #if IS_ENABLED (CONFIG_SND_SOC_SOF_JASPERLAKE )
@@ -356,11 +365,12 @@ static const struct config_entry config_table[] = { .device = PCI_DEVICE_ID_INTEL_HDA_JSL_N, .codec_hid = &essx_83x6, }, +#endif { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_JASPERLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC, .device = PCI_DEVICE_ID_INTEL_HDA_JSL_N, }, -#endif /* Tigerlake */ #if IS_ENABLED (CONFIG_SND_SOC_SOF_TIGERLAKE )
@@ -388,137 +398,150 @@ static const struct config_entry config_table[] = { .device = PCI_DEVICE_ID_INTEL_HDA_TGL_LP, .codec_hid = &essx_83x6, }, +#endif { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_TIGERLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_TGL_LP, }, { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_TIGERLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_TGL_H, }, -#endif /* Elkhart Lake */ -#if IS_ENABLED(CONFIG_SND_SOC_SOF_ELKHARTLAKE) { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_ELKHARTLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC, .device = PCI_DEVICE_ID_INTEL_HDA_EHL_0, }, { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_ELKHARTLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC, .device = PCI_DEVICE_ID_INTEL_HDA_EHL_3, }, -#endif /* Alder Lake / Raptor Lake */ #if IS_ENABLED(CONFIG_SND_SOC_SOF_ALDERLAKE) { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF, + .device = PCI_DEVICE_ID_INTEL_HDA_ADL_P, + .dmi_table = (const struct dmi_system_id []) { + { + .ident = "Google Chromebooks", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Google"), + } + }, + {} + } + }, + { + .flags = FLAG_SOF, + .device = PCI_DEVICE_ID_INTEL_HDA_ADL_P, + .codec_hid = &essx_83x6, + }, + { + .flags = FLAG_SOF, + .device = PCI_DEVICE_ID_INTEL_HDA_ADL_PS, + .codec_hid = &essx_83x6, + }, + { + .flags = FLAG_SOF, + .device = PCI_DEVICE_ID_INTEL_HDA_ADL_N, + .dmi_table = (const struct dmi_system_id []) { + { + .ident = "Google Chromebooks", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Google"), + } + }, + {} + } + }, + { + .flags = FLAG_SOF, + .device = PCI_DEVICE_ID_INTEL_HDA_RPL_P_0, + .dmi_table = (const struct dmi_system_id []) { + { + .ident = "Google Chromebooks", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Google"), + } + }, + {} + } + }, + { + .flags = FLAG_SOF, + .device = PCI_DEVICE_ID_INTEL_HDA_RPL_P_1, + .dmi_table = (const struct dmi_system_id []) { + { + .ident = "Google Chromebooks", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Google"), + } + }, + {} + } + }, +#endif + { + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_ALDERLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_ADL_S, }, { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_ALDERLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_RPL_S, }, { - .flags = FLAG_SOF, - .device = PCI_DEVICE_ID_INTEL_HDA_ADL_P, - .dmi_table = (const struct dmi_system_id []) { - { - .ident = "Google Chromebooks", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Google"), - } - }, - {} - } - }, - { - .flags = FLAG_SOF, - .device = PCI_DEVICE_ID_INTEL_HDA_ADL_P, - .codec_hid = &essx_83x6, - }, - { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_ALDERLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_ADL_P, }, { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_ALDERLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_ADL_PX, }, { - .flags = FLAG_SOF, - .device = PCI_DEVICE_ID_INTEL_HDA_ADL_PS, - .codec_hid = &essx_83x6, - }, - { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_ALDERLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_ADL_PS, }, { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_ALDERLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_ADL_M, }, { - .flags = FLAG_SOF, - .device = PCI_DEVICE_ID_INTEL_HDA_ADL_N, - .dmi_table = (const struct dmi_system_id []) { - { - .ident = "Google Chromebooks", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Google"), - } - }, - {} - } - }, - { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_ALDERLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_ADL_N, }, { - .flags = FLAG_SOF, - .device = PCI_DEVICE_ID_INTEL_HDA_RPL_P_0, - .dmi_table = (const struct dmi_system_id []) { - { - .ident = "Google Chromebooks", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Google"), - } - }, - {} - } - }, - { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_ALDERLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_RPL_P_0, }, { - .flags = FLAG_SOF, - .device = PCI_DEVICE_ID_INTEL_HDA_RPL_P_1, - .dmi_table = (const struct dmi_system_id []) { - { - .ident = "Google Chromebooks", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Google"), - } - }, - {} - } - }, - { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_ALDERLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_RPL_P_1, }, { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_ALDERLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_RPL_M, }, { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_ALDERLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_RPL_PX, }, -#endif /* Meteor Lake */ #if IS_ENABLED(CONFIG_SND_SOC_SOF_METEORLAKE)
@@ -536,55 +559,56 @@ static const struct config_entry config_table[] = { {} } }, +#endif { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_METEORLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_MTL, }, /* ArrowLake-S */ { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_METEORLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_ARL_S, }, /* ArrowLake */ { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_METEORLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_ARL, }, -#endif /* Lunar Lake */ -#if IS_ENABLED(CONFIG_SND_SOC_SOF_LUNARLAKE) /* Lunarlake-P */ { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_LUNARLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_LNL_P, }, -#endif /* Panther Lake, Wildcat Lake */ -#if IS_ENABLED(CONFIG_SND_SOC_SOF_PANTHERLAKE) { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_PANTHERLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_PTL, }, { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_PANTHERLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_PTL_H, }, { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_PANTHERLAKE) | \ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_WCL, }, -#endif - /* Nova Lake */ -#if IS_ENABLED(CONFIG_SND_SOC_SOF_NOVALAKE) { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .flags = FLAG_SOF_DEP(CONFIG_SND_SOC_SOF_NOVALAKE) |\ + FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_NVL_S, }, -#endif };
Askar Safin
Tested-byRe: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Quoted 1 line · Takashi Iwai
A rather hackish fix would be something like below. Instead of
I tested. This patch works. Thank you!
Signature · 1 line
Askar Safin
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Quoted 6 lines · Askar Safin
Quoted 1 line · Takashi Iwai
A rather hackish fix would be something like below. Instead of
I tested. This patch works. Thank you!
Tested-by Askar Safin <[email protected]>
Thanks for testing!
On the second thought, a better fix would be just to change the default fallback from ANY to LEGACY, so a oneliner change like below. Could you test it instead of the previous one?
It was set to ANY as we assumed that all drivers should cover the devices generally, but in the end, SOF or AVS need specific firmware files, hence it doesn't make sense to bind to them if specific kconfig is enabled.
Takashi
-- 8< --
sound/hda/core/intel-dsp-config.c +1 -1
@@ -718,7 +718,7 @@ int snd_intel_dsp_driver_probe(struct pci_dev *pci)/* find the configuration for the specific device */ cfg =snd_intel_dsp_find_config (pci, config_table,ARRAY_SIZE (config_table));if (!cfg) -return SND_INTEL_DSP_DRIVER_ANY ; +return SND_INTEL_DSP_DRIVER_LEGACY ;if (cfg->flags &FLAG_SOF ) { if (cfg->flags & FLAG_SOF_ONLY_IF_SOUNDWIRE &&
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Quoted 12 lines · Takashi Iwai
Quoted 6 lines · Askar Safin
Quoted 1 line · Takashi Iwai
A rather hackish fix would be something like below. Instead of
I tested. This patch works. Thank you!
Tested-by Askar Safin <[email protected]>Thanks for testing!
Quoted 8 lines
On the second thought, a better fix would be just to change the default fallback from ANY to LEGACY, so a oneliner change like below. Could you test it instead of the previous one?
It was set to ANY as we assumed that all drivers should cover the devices generally, but in the end, SOF or AVS need specific firmware files, hence it doesn't make sense to bind to them if specific kconfig is enabled.
The below one is a revised fix, just to be safer in case the legacy driver is disabled, too. Give it a try.
Takashi
-- 8< --
From: Takashi Iwai <[email protected]>
Subject: [PATCH] ALSA: hda: intel-dsp-config: Prefer legacy driver as fallback
When config table entries don't match with the device to be probed, currently we fall back to SND_INTEL_DSP_DRIVER_ANY, which means to allow any drivers to bind with it.
This was set so with the assumption (or hope) that all controller drivers should cover the devices generally, but in practice, this caused a problem as reported recently. Namely, when a specific kconfig for SOF isn't set for the modern Intel chips like Alderlake, a wrong driver (AVS) got probed and failed. This is because we have entries like:
/* Alder Lake / Raptor Lake */
{
.flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE,
.device = PCI_DEVICE_ID_INTEL_HDA_ADL_S,
},....
so this entry is effective only when CONFIG_SND_SOC_SOF_ALDERLAKE is set. If not set, there is no matching entry, hence it returns SND_INTEL_DSP_DRIVER_ANY as fallback. OTOH, if the kconfig is set, it explicitly falls back to SND_INTEL_DSP_DRIVER_LEGACY when no DMIC or SoundWire is found -- that was the working scenario. That being said, the current setup may be broken for modern Intel chips that are supposed to work with either SOF or legacy driver when the corresponding kconfig were missing.
For addressing the problem above, this patch changes the fallback driver to the legacy driver as much as possible, i.e. return SND_INTEL_DSP_DRIVER_LEGACY type. When CONFIG_SND_HDA_INTEL is also off, the fallback is set to SND_INTEL_DSP_DRIVER_ANY type, just to be sure.
--- sound/hda/core/intel-dsp-config.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/hda/core/intel-dsp-config.c +2 -1
@@ -718,7 +718,8 @@ int snd_intel_dsp_driver_probe(struct pci_dev *pci)/* find the configuration for the specific device */ cfg =snd_intel_dsp_find_config (pci, config_table,ARRAY_SIZE (config_table));if (!cfg) -return SND_INTEL_DSP_DRIVER_ANY ; +return IS_ENABLED (CONFIG_SND_HDA_INTEL ) ? +SND_INTEL_DSP_DRIVER_LEGACY :SND_INTEL_DSP_DRIVER_ANY ;if (cfg->flags &FLAG_SOF ) { if (cfg->flags & FLAG_SOF_ONLY_IF_SOUNDWIRE &&
Signature · 1 line
2.52.0
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Quoted 2 lines · Takashi Iwai
The below one is a revised fix, just to be safer in case the legacy driver is disabled, too. Give it a try.
I just tested both patches (this and previous). Both work.
Also, please, add this for regzbot:
Quoted 2 lines
Fixes 2d9223d2d64c ("ALSA: hda: Move controller drivers into sound/hda/controllers directory")Reported-by Askar Safin <[email protected]>
Signature · 1 line
Askar Safin
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Quoted 9 lines · Askar Safin
Quoted 2 lines · Takashi Iwai
The below one is a revised fix, just to be safer in case the legacy driver is disabled, too. Give it a try.
I just tested both patches (this and previous). Both work.
Also, please, add this for regzbot:
Quoted 1 line
Fixes 2d9223d2d64c ("ALSA: hda: Move controller drivers into sound/hda/controllers directory")
Actually this tag isn't really right. This commit casually surfaced the issue in your particular case, but the bug itself was introduced from the very beginning, and it could hit earlier.
thanks,
Takashi
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
Quoted 8 lines · Takashi Iwai
On Wed, 10 Dec 2025 02:45:55 +0100,
Quoted 3 lines · Takashi Iwai
Also, please, add this for regzbot:
Quoted 1 line
Fixes 2d9223d2d64c ("ALSA: hda: Move controller drivers into sound/hda/controllers directory")Actually this tag isn't really right. This commit casually surfaced the issue in your particular case, but the bug itself was introduced from the very beginning, and it could hit earlier.
And for the record: regzbot notices when a commit that is tracked to have caused as regression is mentioned, but only takes a note, as one commit can cause different regressions that need separate fixes.
What counts for regzbot is the link to the report (e.g.
https://lore.kernel.org/all/[email protected]/)
in the fix using a Link or Closes tag. And Takashi usually adds those iirc.
Ciao, Thorsten
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
In reply to Takashi IwaiQuoted 3 lines · Takashi Iwai
Actually this tag isn't really right. This commit casually surfaced the issue in your particular case, but the bug itself was introduced from the very beginning, and it could hit earlier.
Then, please, add this:
Quoted 2 lines
Fixes 82d9d54a6c0e ("ALSA: hda: add Intel DSP configuration / probe code")Cc <[email protected]>
82d9d54a6c0e is commit, which introduced "intel-dsp-config.c" (the file was renamed since then, but I think stable devs will able to figure this out)
Signature · 1 line
Askar Safin
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
In reply to Takashi IwaiTakashi Iwai <[email protected]>:
Quoted 3 lines
If that's the case, try to choose HDA-Intel driver by passing snd_intel_dspcfg.dsp_driver=1 boot option. Or disabling
CONFIG_SND_SOC_INTEL_AVScould help, too.
Disabling CONFIG_SND_SOC_INTEL_AVS didn't help.
Signature · 1 line
Askar Safin
Re: [REGRESSION][BISECTED] My audio broke (was: [PATCH 05/27] ALSA: hda: Move controller drivers into sound/hda/controllers directory)
In reply to Takashi IwaiQuoted 1 line · Takashi Iwai
The oft-seen "regression" reports for 6.17 were rather the incorrect
Okay, I did another test. I tested pre-culprit kernel ( 146355ee880e6d15ba12e2baf5be70e5efe07796 ) and culprit kernel
( 2d9223d2d64cb5216859ced6cc33fb3b04e5f98f ).
Here is config used for pre-culprit kernel:
https://zerobin.net/?41f6e4dd438b4671#cZc42NliA0eUaXz03w17ZOJcIVNW8FCMZ9f8lQhdmkM=
And here is config used for culprit kernel:
https://zerobin.net/?c1ba4914bf3f0852#DBGkXE/9LgBc1Q+T4tWrePa0EGsJ8oBoaviaMvE3VRI=
As you can see, they are same, they differ in order only. Here is diff:
$ diff -u /boot/config-6.16.0-rc4-preculp /boot/config-6.16.0-rc4-culp --- /boot/config-6.16.0-rc4-preculp 2025-10-15 07:45:14.096152974 +0300 +++ /boot/config-6.16.0-rc4-culp 2025-10-15 07:48:42.585031860 +0300 @@ -4794,8 +4794,6 @@ # HD-Audio # CONFIG_SND_HDA_GENERIC_LEDS=y -CONFIG_SND_HDA_INTEL=m -# CONFIG_SND_HDA_ACPI is not set CONFIG_SND_HDA_SCODEC_COMPONENT=m # CONFIG_SND_HDA_SCODEC_CS35L41_I2C is not set # CONFIG_SND_HDA_SCODEC_CS35L41_SPI is not set @@ -4832,6 +4830,8 @@ CONFIG_SND_HDA_POWER_SAVE_DEFAULT=10 # CONFIG_SND_HDA_CTL_DEV_ID is not set CONFIG_SND_HDA_PREALLOC_SIZE=2048 +CONFIG_SND_HDA_INTEL=m +# CONFIG_SND_HDA_ACPI is not set CONFIG_SND_HDA_CORE=m CONFIG_SND_HDA_DSP_LOADER=y CONFIG_SND_HDA_COMPONENT=y
And yet audio works in preculprit and doesn't work in culprit. So it seems like an actual bug.
Signature · 1 line
Askar Safin
PATCH 6/27 ALSA: hda: Move codec drivers into sound/hda/codecs directory
In reply to Takashi IwaiNow move the all remaining codec drivers from sound/pci/hda to sound/hda/codecs subdirectory. Some drivers are put under the further vendor subdirectory, and the vendor helper code (*_helper.c) are put under helpers subdirectory. Also the sub-codec drivers are moved under a different subdirectory, sound/hda/codecs/sub-codecs, for distinguishing from the main HD-audio codec drivers.
The prefix patch_ and hda_ as well as the suffix _helper are dropped from file names as they are mostly superfluous.
No functional changes but just file path shuffling.
---
sound/hda/Kconfig | 1 +
sound/hda/Makefile | 1 +
sound/{pci/hda => hda/codecs}/Kconfig | 158 +-----------------
sound/hda/codecs/Makefile | 31 ++++
.../patch_analog.c => hda/codecs/analog.c} | 2 +-
.../patch_ca0110.c => hda/codecs/ca0110.c} | 2 +-
.../patch_ca0132.c => hda/codecs/ca0132.c} | 2 +-
sound/{pci/hda => hda/codecs}/ca0132_regs.h | 0
sound/hda/codecs/cirrus/Kconfig | 21 +++
sound/hda/codecs/cirrus/Makefile | 8 +
.../codecs/cirrus/cirrus.c} | 2 +-
.../codecs/cirrus/cs8409-tables.c} | 4 +-
.../codecs/cirrus/cs8409.c} | 2 +-
.../codecs/cirrus/cs8409.h} | 2 +-
.../patch_cmedia.c => hda/codecs/cmedia.c} | 2 +-
.../codecs/conexant.c} | 6 +-
.../hda_generic.c => hda/codecs/generic.c} | 2 +-
.../hda_generic.h => hda/codecs/generic.h} | 0
sound/hda/codecs/hdmi/Makefile | 6 +
.../hda/hda_eld.c => hda/codecs/hdmi/eld.c} | 0
.../patch_hdmi.c => hda/codecs/hdmi/hdmi.c} | 2 +-
.../codecs/helpers/hp_x360.c} | 0
.../codecs/helpers/ideapad_hotkey_led.c} | 0
.../codecs/helpers/ideapad_s740.c} | 0
.../codecs/helpers/thinkpad.c} | 0
.../patch_realtek.c => hda/codecs/realtek.c} | 12 +-
.../codecs/senarytech.c} | 4 +-
.../patch_si3054.c => hda/codecs/si3054.c} | 0
sound/hda/codecs/side-codecs/Kconfig | 128 ++++++++++++++
sound/hda/codecs/side-codecs/Makefile | 28 ++++
.../codecs/side-codecs}/cirrus_scodec.c | 0
.../codecs/side-codecs}/cirrus_scodec.h | 0
.../codecs/side-codecs}/cirrus_scodec_test.c | 0
.../codecs/side-codecs}/cs35l41_hda.c | 2 +-
.../codecs/side-codecs}/cs35l41_hda.h | 0
.../codecs/side-codecs}/cs35l41_hda_i2c.c | 0
.../side-codecs}/cs35l41_hda_property.c | 0
.../side-codecs}/cs35l41_hda_property.h | 0
.../codecs/side-codecs}/cs35l41_hda_spi.c | 0
.../codecs/side-codecs}/cs35l56_hda.c | 2 +-
.../codecs/side-codecs}/cs35l56_hda.h | 0
.../codecs/side-codecs}/cs35l56_hda_i2c.c | 0
.../codecs/side-codecs}/cs35l56_hda_spi.c | 0
.../codecs/side-codecs}/hda_component.c | 0
.../codecs/side-codecs}/hda_component.h | 0
.../codecs/side-codecs}/tas2781_hda.c | 0
.../codecs/side-codecs}/tas2781_hda.h | 0
.../codecs/side-codecs}/tas2781_hda_i2c.c | 2 +-
.../codecs/side-codecs}/tas2781_hda_spi.c | 2 +-
.../codecs/sigmatel.c} | 4 +-
.../{pci/hda/patch_via.c => hda/codecs/via.c} | 2 +-
sound/pci/Kconfig | 2 -
sound/pci/Makefile | 1 -
sound/pci/hda/Makefile | 61 -------
54 files changed, 257 insertions(+), 247 deletions(-)
rename sound/{pci/hda => hda/codecs}/Kconfig (55%)
create mode 100644 sound/hda/codecs/Makefile
rename sound/{pci/hda/patch_analog.c => hda/codecs/analog.c} (99%)
rename sound/{pci/hda/patch_ca0110.c => hda/codecs/ca0110.c} (98%)
rename sound/{pci/hda/patch_ca0132.c => hda/codecs/ca0132.c} (99%)
rename sound/{pci/hda => hda/codecs}/ca0132_regs.h (100%)
create mode 100644 sound/hda/codecs/cirrus/Kconfig
create mode 100644 sound/hda/codecs/cirrus/Makefile
rename sound/{pci/hda/patch_cirrus.c => hda/codecs/cirrus/cirrus.c} (99%)
rename sound/{pci/hda/patch_cs8409-tables.c => hda/codecs/cirrus/cs8409-tables.c} (99%)
rename sound/{pci/hda/patch_cs8409.c => hda/codecs/cirrus/cs8409.c} (99%)
rename sound/{pci/hda/patch_cs8409.h => hda/codecs/cirrus/cs8409.h} (99%)
rename sound/{pci/hda/patch_cmedia.c => hda/codecs/cmedia.c} (99%)
rename sound/{pci/hda/patch_conexant.c => hda/codecs/conexant.c} (99%)
rename sound/{pci/hda/hda_generic.c => hda/codecs/generic.c} (99%)
rename sound/{pci/hda/hda_generic.h => hda/codecs/generic.h} (100%)
create mode 100644 sound/hda/codecs/hdmi/Makefile
rename sound/{pci/hda/hda_eld.c => hda/codecs/hdmi/eld.c} (100%)
rename sound/{pci/hda/patch_hdmi.c => hda/codecs/hdmi/hdmi.c} (99%)
rename sound/{pci/hda/hp_x360_helper.c => hda/codecs/helpers/hp_x360.c} (100%)
rename sound/{pci/hda/ideapad_hotkey_led_helper.c => hda/codecs/helpers/ideapad_hotkey_led.c} (100%)
rename sound/{pci/hda/ideapad_s740_helper.c => hda/codecs/helpers/ideapad_s740.c} (100%)
rename sound/{pci/hda/thinkpad_helper.c => hda/codecs/helpers/thinkpad.c} (100%)
rename sound/{pci/hda/patch_realtek.c => hda/codecs/realtek.c} (99%)
rename sound/{pci/hda/patch_senarytech.c => hda/codecs/senarytech.c} (98%)
rename sound/{pci/hda/patch_si3054.c => hda/codecs/si3054.c} (100%)
create mode 100644 sound/hda/codecs/side-codecs/Kconfig
create mode 100644 sound/hda/codecs/side-codecs/Makefile
rename sound/{pci/hda => hda/codecs/side-codecs}/cirrus_scodec.c (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cirrus_scodec.h (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cirrus_scodec_test.c (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cs35l41_hda.c (99%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cs35l41_hda.h (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cs35l41_hda_i2c.c (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cs35l41_hda_property.c (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cs35l41_hda_property.h (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cs35l41_hda_spi.c (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cs35l56_hda.c (99%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cs35l56_hda.h (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cs35l56_hda_i2c.c (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/cs35l56_hda_spi.c (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/hda_component.c (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/hda_component.h (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/tas2781_hda.c (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/tas2781_hda.h (100%)
rename sound/{pci/hda => hda/codecs/side-codecs}/tas2781_hda_i2c.c (99%)
rename sound/{pci/hda => hda/codecs/side-codecs}/tas2781_hda_spi.c (99%)
rename sound/{pci/hda/patch_sigmatel.c => hda/codecs/sigmatel.c} (99%)
rename sound/{pci/hda/patch_via.c => hda/codecs/via.c} (99%)
delete mode 100644 sound/pci/hda/Makefilesound/hda/Kconfig +1 -0
@@ -3,6 +3,7 @@ menu "HD-Audio" source "sound/hda/common/Kconfig" source "sound/hda/controllers/Kconfig" +source "sound/hda/codecs/Kconfig" source "sound/hda/core/Kconfig" endmenu
sound/hda/Makefile +1 -0
@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 obj-y += core/ obj-$(CONFIG_SND_HDA) += common/ +obj-$(CONFIG_SND_HDA) += codecs/ # this must be the last entry after codec drivers; # otherwise the codec patches won't be hooked before the PCI probe # when built in kernel
sound/hda/codecs/Kconfig renamed from sound/pci/hda/Kconfig +4 -154
176 lines not on this page · raw message
sound/hda/codecs/Makefile new file +31 -0
@@ -0,0 +1,31 @@ +# SPDX-License-Identifier: GPL-2.0 +subdir-ccflags-y += -I$(src)/../common + +snd-hda-codec-generic-y := generic.o +snd-hda-codec-analog-y := analog.o +snd-hda-codec-ca0110-y := ca0110.o +snd-hda-codec-ca0132-y := ca0132.o +snd-hda-codec-cmedia-y := cmedia.o +snd-hda-codec-conexant-y := conexant.o +snd-hda-codec-idt-y := sigmatel.o +snd-hda-codec-realtek-y := realtek.o +snd-hda-codec-senarytech-y := senarytech.o +snd-hda-codec-si3054-y := si3054.o +snd-hda-codec-via-y := via.o + +obj-y += cirrus/ +obj-y += hdmi/ +obj-y += side-codecs/ + +# codec drivers +obj-$(CONFIG_SND_HDA_GENERIC) += snd-hda-codec-generic.o +obj-$(CONFIG_SND_HDA_CODEC_ANALOG) += snd-hda-codec-analog.o +obj-$(CONFIG_SND_HDA_CODEC_CA0110) += snd-hda-codec-ca0110.o +obj-$(CONFIG_SND_HDA_CODEC_CA0132) += snd-hda-codec-ca0132.o +obj-$(CONFIG_SND_HDA_CODEC_CMEDIA) += snd-hda-codec-cmedia.o +obj-$(CONFIG_SND_HDA_CODEC_CONEXANT) += snd-hda-codec-conexant.o +obj-$(CONFIG_SND_HDA_CODEC_SIGMATEL) += snd-hda-codec-idt.o +obj-$(CONFIG_SND_HDA_CODEC_REALTEK) += snd-hda-codec-realtek.o +obj-$(CONFIG_SND_HDA_CODEC_SENARYTECH) += snd-hda-codec-senarytech.o +obj-$(CONFIG_SND_HDA_CODEC_SI3054) += snd-hda-codec-si3054.o +obj-$(CONFIG_SND_HDA_CODEC_VIA) += snd-hda-codec-via.o
sound/hda/codecs/analog.c renamed from sound/pci/hda/patch_analog.c +1 -1
@@ -16,7 +16,7 @@#include "hda_auto_parser.h" #include "hda_beep.h" #include "hda_jack.h" -#include "hda_generic.h" +#include "generic.h" struct ad198x_spec {
sound/hda/codecs/ca0110.c renamed from sound/pci/hda/patch_ca0110.c +1 -1
@@ -13,7 +13,7 @@#include "hda_local.h" #include "hda_auto_parser.h" #include "hda_jack.h" -#include "hda_generic.h" +#include "generic.h" static const struct hda_codec_ops ca0110_patch_ops = {
sound/hda/codecs/ca0132.c renamed from sound/pci/hda/patch_ca0132.c +1 -1
@@ -4,7 +4,7 @@* * Copyright (c) 2011, Creative Technology Ltd. * -* Based on patch_ca0110.c +* Based on ca0110.c * Copyright (c) 2008 Takashi Iwai <[email protected]> */
sound/hda/codecs/ca0132_regs.h renamed from sound/pci/hda/ca0132_regs.h +0 -0
sound/hda/codecs/cirrus/Kconfig new file +21 -0
@@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config SND_HDA_CODEC_CIRRUS + tristate "Build Cirrus Logic codec support" + select SND_HDA_GENERIC + help + Say Y or M here to include Cirrus Logic codec support in + snd-hda-intel driver, such as CS4206. + +comment "Set to Y if you want auto-loading the codec driver" + depends on SND_HDA=y && SND_HDA_CODEC_CIRRUS=m + +config SND_HDA_CODEC_CS8409 + tristate "Build Cirrus Logic HDA bridge support" + select SND_HDA_GENERIC + help + Say Y or M here to include Cirrus Logic HDA bridge support in + snd-hda-intel driver, such as CS8409. + +comment "Set to Y if you want auto-loading the codec driver" + depends on SND_HDA=y && SND_HDA_CODEC_CS8409=m
sound/hda/codecs/cirrus/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0 +subdir-ccflags-y += -I$(src)/../../common + +snd-hda-codec-cirrus-y := cirrus.o +snd-hda-codec-cs8409-y := cs8409.o cs8409-tables.o + +obj-$(CONFIG_SND_HDA_CODEC_CIRRUS) += snd-hda-codec-cirrus.o +obj-$(CONFIG_SND_HDA_CODEC_CS8409) += snd-hda-codec-cs8409.o
sound/hda/codecs/cirrus/cirrus.c renamed from sound/pci/hda/patch_cirrus.c +1 -1
@@ -15,7 +15,7 @@#include "hda_local.h" #include "hda_auto_parser.h" #include "hda_jack.h" -#include "hda_generic.h" +#include "../generic.h" /* */
sound/hda/codecs/cirrus/cs8409-tables.c renamed from sound/pci/hda/patch_cs8409-tables.c +2 -2
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0-only /* -* patch_cs8409-tables.c -- HD audio interface patch for Cirrus Logic CS8409 HDA bridge chip +* cs8409-tables.c -- HD audio interface patch for Cirrus Logic CS8409 HDA bridge chip * * Copyright (C) 2021 Cirrus Logic, Inc. and * Cirrus Logic International Semiconductor Ltd.
@@ -8,7 +8,7 @@* Author: Lucas Tanure <[email protected]> */ -#include "patch_cs8409.h" +#include "cs8409.h" /****************************************************************************** * CS42L42 Specific Data
sound/hda/codecs/cirrus/cs8409.c renamed from sound/pci/hda/patch_cs8409.c +1 -1
@@ -13,7 +13,7 @@#include <linux/mutex.h> #include <linux/iopoll.h> -#include "patch_cs8409.h" +#include "cs8409.h" /****************************************************************************** * CS8409 Specific Functions
sound/hda/codecs/cirrus/cs8409.h renamed from sound/pci/hda/patch_cs8409.h +1 -1
@@ -17,7 +17,7 @@#include "hda_local.h" #include "hda_auto_parser.h" #include "hda_jack.h" -#include "hda_generic.h" +#include "../generic.h" /* CS8409 Specific Definitions */
sound/hda/codecs/cmedia.c renamed from sound/pci/hda/patch_cmedia.c +1 -1
@@ -15,7 +15,7 @@#include "hda_local.h" #include "hda_auto_parser.h" #include "hda_jack.h" -#include "hda_generic.h" +#include "generic.h" /* CM9825 Offset Definitions */
sound/hda/codecs/conexant.c renamed from sound/pci/hda/patch_conexant.c +3 -3
@@ -19,7 +19,7 @@#include "hda_auto_parser.h" #include "hda_beep.h" #include "hda_jack.h" -#include "hda_generic.h" +#include "generic.h" struct conexant_spec {struct hda_gen_spec gen;
@@ -312,10 +312,10 @@ enum { };/* for hda_fixup_thinkpad_acpi() */ -#include "thinkpad_helper.c" +#include "helpers/thinkpad.c" /* for hda_fixup_ideapad_acpi() */ -#include "ideapad_hotkey_led_helper.c" +#include "helpers/ideapad_hotkey_led.c" static void cxt_fixup_stereo_dmic (struct hda_codec *codec,const struct hda_fixup *fix,int action)
sound/hda/codecs/generic.c renamed from sound/pci/hda/hda_generic.c +1 -1
@@ -25,7 +25,7 @@#include "hda_auto_parser.h" #include "hda_jack.h" #include "hda_beep.h" -#include "hda_generic.h" +#include "generic.h" /**
sound/hda/codecs/generic.h renamed from sound/pci/hda/hda_generic.h +0 -0
sound/hda/codecs/hdmi/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0 +subdir-ccflags-y += -I$(src)/../../common + +snd-hda-codec-hdmi-y := hdmi.o eld.o + +obj-$(CONFIG_SND_HDA_CODEC_HDMI) += snd-hda-codec-hdmi.o
sound/hda/codecs/hdmi/eld.c renamed from sound/pci/hda/hda_eld.c +0 -0
sound/hda/codecs/hdmi/hdmi.c renamed from sound/pci/hda/patch_hdmi.c +1 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0-or-later /* * -* patch_hdmi.c - routines for HDMI/DisplayPort codecs +* hdmi.c - routines for HDMI/DisplayPort codecs * * Copyright(c) 2008-2010 Intel Corporation * Copyright (c) 2006 ATI Technologies Inc.
sound/hda/codecs/helpers/hp_x360.c renamed from sound/pci/hda/hp_x360_helper.c +0 -0
sound/hda/codecs/helpers/ideapad_hotkey_led.c renamed from sound/pci/hda/ideapad_hotkey_led_helper.c +0 -0
sound/hda/codecs/helpers/ideapad_s740.c renamed from sound/pci/hda/ideapad_s740_helper.c +0 -0
sound/hda/codecs/helpers/thinkpad.c renamed from sound/pci/hda/thinkpad_helper.c +0 -0
sound/hda/codecs/realtek.c renamed from sound/pci/hda/patch_realtek.c +6 -6
@@ -30,8 +30,8 @@#include "hda_auto_parser.h" #include "hda_beep.h" #include "hda_jack.h" -#include "hda_generic.h" -#include "hda_component.h" +#include "generic.h" +#include "side-codecs/hda_component.h" /* keep halting ALC5505 DSP, for power saving */ #define HALT_REALTEK_ALC5505
@@ -7120,7 +7120,7 @@ static void alc285_fixup_hp_beep(struct hda_codec *codec, }/* for hda_fixup_thinkpad_acpi() */ -#include "thinkpad_helper.c" +#include "helpers/thinkpad.c" static void alc_fixup_thinkpad_acpi (struct hda_codec *codec,const struct hda_fixup *fix,int action)
@@ -7130,7 +7130,7 @@ static void alc_fixup_thinkpad_acpi(struct hda_codec *codec, }/* for hda_fixup_ideapad_acpi() */ -#include "ideapad_hotkey_led_helper.c" +#include "helpers/ideapad_hotkey_led.c" static void alc_fixup_ideapad_acpi (struct hda_codec *codec,const struct hda_fixup *fix,int action)
@@ -7362,10 +7362,10 @@ static void alc256_fixup_acer_sfg16_micmute_led(struct hda_codec *codec,/* for alc295_fixup_hp_top_speakers */ -#include "hp_x360_helper.c" +#include "helpers/hp_x360.c" /* for alc285_fixup_ideapad_s740_coef() */ -#include "ideapad_s740_helper.c" +#include "helpers/ideapad_s740.c" static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {WRITE_COEF (0x10 ,0x0020 ),WRITE_COEF (0x24 ,0x0000 ),
sound/hda/codecs/senarytech.c renamed from sound/pci/hda/patch_senarytech.c +2 -2
@@ -2,7 +2,7 @@/* * HD audio interface patch for Senary HDA audio codec * -* Initially based on sound/pci/hda/patch_conexant.c +* Initially based on conexant.c */ #include <linux/init.h>
@@ -17,7 +17,7 @@#include "hda_auto_parser.h" #include "hda_beep.h" #include "hda_jack.h" -#include "hda_generic.h" +#include "generic.h" struct senary_spec {struct hda_gen_spec gen;
sound/hda/codecs/si3054.c renamed from sound/pci/hda/patch_si3054.c +0 -0
sound/hda/codecs/side-codecs/Kconfig new file +128 -0
128 lines not on this page · raw message
sound/hda/codecs/side-codecs/Makefile new file +28 -0
@@ -0,0 +1,28 @@ +# SPDX-License-Identifier: GPL-2.0 +subdir-ccflags-y += -I$(src)/../../common + +snd-hda-cirrus-scodec-y := cirrus_scodec.o +snd-hda-cirrus-scodec-test-y := cirrus_scodec_test.o +snd-hda-scodec-cs35l41-y := cs35l41_hda.o cs35l41_hda_property.o +snd-hda-scodec-cs35l41-i2c-y := cs35l41_hda_i2c.o +snd-hda-scodec-cs35l41-spi-y := cs35l41_hda_spi.o +snd-hda-scodec-cs35l56-y := cs35l56_hda.o +snd-hda-scodec-cs35l56-i2c-y := cs35l56_hda_i2c.o +snd-hda-scodec-cs35l56-spi-y := cs35l56_hda_spi.o +snd-hda-scodec-component-y := hda_component.o +snd-hda-scodec-tas2781-y := tas2781_hda.o +snd-hda-scodec-tas2781-i2c-y := tas2781_hda_i2c.o +snd-hda-scodec-tas2781-spi-y := tas2781_hda_spi.o + +obj-$(CONFIG_SND_HDA_CIRRUS_SCODEC) += snd-hda-cirrus-scodec.o +obj-$(CONFIG_SND_HDA_CIRRUS_SCODEC_KUNIT_TEST) += snd-hda-cirrus-scodec-test.o +obj-$(CONFIG_SND_HDA_SCODEC_CS35L41) += snd-hda-scodec-cs35l41.o +obj-$(CONFIG_SND_HDA_SCODEC_CS35L41_I2C) += snd-hda-scodec-cs35l41-i2c.o +obj-$(CONFIG_SND_HDA_SCODEC_CS35L41_SPI) += snd-hda-scodec-cs35l41-spi.o +obj-$(CONFIG_SND_HDA_SCODEC_CS35L56) += snd-hda-scodec-cs35l56.o +obj-$(CONFIG_SND_HDA_SCODEC_CS35L56_I2C) += snd-hda-scodec-cs35l56-i2c.o +obj-$(CONFIG_SND_HDA_SCODEC_CS35L56_SPI) += snd-hda-scodec-cs35l56-spi.o +obj-$(CONFIG_SND_HDA_SCODEC_COMPONENT) += snd-hda-scodec-component.o +obj-$(CONFIG_SND_HDA_SCODEC_TAS2781) += snd-hda-scodec-tas2781.o +obj-$(CONFIG_SND_HDA_SCODEC_TAS2781_I2C) += snd-hda-scodec-tas2781-i2c.o +obj-$(CONFIG_SND_HDA_SCODEC_TAS2781_SPI) += snd-hda-scodec-tas2781-spi.o
sound/hda/codecs/side-codecs/cirrus_scodec.c renamed from sound/pci/hda/cirrus_scodec.c +0 -0
sound/hda/codecs/side-codecs/cirrus_scodec.h renamed from sound/pci/hda/cirrus_scodec.h +0 -0
sound/hda/codecs/side-codecs/cirrus_scodec_test.c renamed from sound/pci/hda/cirrus_scodec_test.c +0 -0
sound/hda/codecs/side-codecs/cs35l41_hda.c renamed from sound/pci/hda/cs35l41_hda.c +1 -1
@@ -17,7 +17,7 @@#include "hda_local.h" #include "hda_auto_parser.h" #include "hda_jack.h" -#include "hda_generic.h" +#include "../generic.h" #include "hda_component.h" #include "cs35l41_hda.h" #include "cs35l41_hda_property.h"
sound/hda/codecs/side-codecs/cs35l41_hda.h renamed from sound/pci/hda/cs35l41_hda.h +0 -0
sound/hda/codecs/side-codecs/cs35l41_hda_i2c.c renamed from sound/pci/hda/cs35l41_hda_i2c.c +0 -0
sound/hda/codecs/side-codecs/cs35l41_hda_property.c renamed from sound/pci/hda/cs35l41_hda_property.c +0 -0
sound/hda/codecs/side-codecs/cs35l41_hda_property.h renamed from sound/pci/hda/cs35l41_hda_property.h +0 -0
sound/hda/codecs/side-codecs/cs35l41_hda_spi.c renamed from sound/pci/hda/cs35l41_hda_spi.c +0 -0
sound/hda/codecs/side-codecs/cs35l56_hda.c renamed from sound/pci/hda/cs35l56_hda.c +1 -1
@@ -20,7 +20,7 @@#include "cirrus_scodec.h" #include "cs35l56_hda.h" #include "hda_component.h" -#include "hda_generic.h" +#include "../generic.h" /* * The cs35l56_hda_dai_config[] reg sequence configures the device as
sound/hda/codecs/side-codecs/cs35l56_hda.h renamed from sound/pci/hda/cs35l56_hda.h +0 -0
sound/hda/codecs/side-codecs/cs35l56_hda_i2c.c renamed from sound/pci/hda/cs35l56_hda_i2c.c +0 -0
sound/hda/codecs/side-codecs/cs35l56_hda_spi.c renamed from sound/pci/hda/cs35l56_hda_spi.c +0 -0
sound/hda/codecs/side-codecs/hda_component.c renamed from sound/pci/hda/hda_component.c +0 -0
sound/hda/codecs/side-codecs/hda_component.h renamed from sound/pci/hda/hda_component.h +0 -0
sound/hda/codecs/side-codecs/tas2781_hda.c renamed from sound/pci/hda/tas2781_hda.c +0 -0
sound/hda/codecs/side-codecs/tas2781_hda.h renamed from sound/pci/hda/tas2781_hda.h +0 -0
sound/hda/codecs/side-codecs/tas2781_hda_i2c.c renamed from sound/pci/hda/tas2781_hda_i2c.c +1 -1
@@ -30,7 +30,7 @@#include "hda_auto_parser.h" #include "hda_component.h" #include "hda_jack.h" -#include "hda_generic.h" +#include "../generic.h" #include "tas2781_hda.h" #define TAS2563_CAL_VAR_NAME_MAX 16
sound/hda/codecs/side-codecs/tas2781_hda_spi.c renamed from sound/pci/hda/tas2781_hda_spi.c +1 -1
@@ -35,7 +35,7 @@#include "hda_auto_parser.h" #include "hda_component.h" #include "hda_jack.h" -#include "hda_generic.h" +#include "../generic.h" #include "tas2781_hda.h" #define TASDEVICE_RANGE_MAX_SIZE (256 * 128)
sound/hda/codecs/sigmatel.c renamed from sound/pci/hda/patch_sigmatel.c +2 -2
@@ -7,7 +7,7 @@* Copyright (c) 2005 Embedded Alley Solutions, Inc. * Matt Porter <[email protected]> * -* Based on patch_cmedia.c and patch_realtek.c +* Based on cmedia.c and realtek.c * Copyright (c) 2004 Takashi Iwai <[email protected]> */
@@ -24,7 +24,7 @@#include "hda_auto_parser.h" #include "hda_beep.h" #include "hda_jack.h" -#include "hda_generic.h" +#include "generic.h" enum {STAC_REF ,
sound/hda/codecs/via.c renamed from sound/pci/hda/patch_via.c +1 -1
@@ -43,7 +43,7 @@#include "hda_local.h" #include "hda_auto_parser.h" #include "hda_jack.h" -#include "hda_generic.h" +#include "generic.h" /* Pin Widget NID */ #define VT1708_HP_PIN_NID 0x20
sound/pci/Kconfig +0 -2
@@ -933,5 +933,3 @@ config SND_YMFPCI will be called snd-ymfpci. endif # SND_PCI - -source "sound/pci/hda/Kconfig"
sound/pci/Makefile +0 -1
@@ -69,7 +69,6 @@ obj-$(CONFIG_SND) += \ lx6464es/ \ echoaudio/ \ emu10k1/ \ - hda/ \ ice1712/ \ korg1212/ \ mixart/ \
sound/pci/hda/Makefile deleted +0 -61
61 lines not on this page · raw message
Signature · 1 line
2.50.0
Re: [PATCH 06/27] ALSA: hda: Move codec drivers into sound/hda/codecs directory
Quoted 7 lines · Takashi Iwai
Now move the all remaining codec drivers from
sound/pci/hdatosound/hda/codecssubdirectory. Some drivers are put under the further vendor subdirectory, and the vendor helper code (*_helper.c) are put under helpers subdirectory. Also the sub-codec drivers are moved under a different subdirectory,sound/hda/codecs/sub-codecs, for distinguishing from the main HD-audio codec drivers.
Quoted 6 lines
The prefix
patch_andhda_as well as the suffix_helperare dropped from file names as they are mostly superfluous.No functional changes but just file path shuffling.
Signed-off-by Takashi Iwai <[email protected]>
For the Cirrus files:
Re: [PATCH 06/27] ALSA: hda: Move codec drivers into sound/hda/codecs directory
In reply to Takashi IwaiQuoted 7 lines · Takashi Iwai
Now move the all remaining codec drivers from
sound/pci/hdatosound/hda/codecssubdirectory. Some drivers are put under the further vendor subdirectory, and the vendor helper code (*_helper.c) are put under helpers subdirectory. Also the sub-codec drivers are moved under a different subdirectory,sound/hda/codecs/sub-codecs, for distinguishing from the main HD-audio codec drivers.
Quoted 5 lines
The prefix
patch_andhda_as well as the suffix_helperare dropped from file names as they are mostly superfluous.No functional changes but just file path shuffling.
Path: codecs/side-codecs/ looks wierd. My suggestion is to avoid the repeat and stay with codecs/side/.
In regard to 'helpers', I believe some of these .c files could be converted to headers and lie in sound/hda/quirks/ directory. These are more of a platform-level files, not sound/hda/codecs/ per-se.
Quoted 107 lines
Signed-off-by Takashi Iwai <[email protected]>--- sound/hda/Kconfig | 1 + sound/hda/Makefile | 1 + sound/{pci/hda => hda/codecs}/Kconfig | 158 +----------------- sound/hda/codecs/Makefile | 31 ++++ .../patch_analog.c => hda/codecs/analog.c} | 2 +- .../patch_ca0110.c => hda/codecs/ca0110.c} | 2 +- .../patch_ca0132.c => hda/codecs/ca0132.c} | 2 +- sound/{pci/hda => hda/codecs}/ca0132_regs.h | 0 sound/hda/codecs/cirrus/Kconfig | 21 +++ sound/hda/codecs/cirrus/Makefile | 8 + .../codecs/cirrus/cirrus.c} | 2 +- .../codecs/cirrus/cs8409-tables.c} | 4 +- .../codecs/cirrus/cs8409.c} | 2 +- .../codecs/cirrus/cs8409.h} | 2 +- .../patch_cmedia.c => hda/codecs/cmedia.c} | 2 +- .../codecs/conexant.c} | 6 +- .../hda_generic.c => hda/codecs/generic.c} | 2 +- .../hda_generic.h => hda/codecs/generic.h} | 0 sound/hda/codecs/hdmi/Makefile | 6 + .../hda/hda_eld.c => hda/codecs/hdmi/eld.c} | 0 .../patch_hdmi.c => hda/codecs/hdmi/hdmi.c} | 2 +- .../codecs/helpers/hp_x360.c} | 0 .../codecs/helpers/ideapad_hotkey_led.c} | 0 .../codecs/helpers/ideapad_s740.c} | 0 .../codecs/helpers/thinkpad.c} | 0 .../patch_realtek.c => hda/codecs/realtek.c} | 12 +- .../codecs/senarytech.c} | 4 +- .../patch_si3054.c => hda/codecs/si3054.c} | 0 sound/hda/codecs/side-codecs/Kconfig | 128 ++++++++++++++ sound/hda/codecs/side-codecs/Makefile | 28 ++++ .../codecs/side-codecs}/cirrus_scodec.c | 0 .../codecs/side-codecs}/cirrus_scodec.h | 0 .../codecs/side-codecs}/cirrus_scodec_test.c | 0 .../codecs/side-codecs}/cs35l41_hda.c | 2 +- .../codecs/side-codecs}/cs35l41_hda.h | 0 .../codecs/side-codecs}/cs35l41_hda_i2c.c | 0 .../side-codecs}/cs35l41_hda_property.c | 0 .../side-codecs}/cs35l41_hda_property.h | 0 .../codecs/side-codecs}/cs35l41_hda_spi.c | 0 .../codecs/side-codecs}/cs35l56_hda.c | 2 +- .../codecs/side-codecs}/cs35l56_hda.h | 0 .../codecs/side-codecs}/cs35l56_hda_i2c.c | 0 .../codecs/side-codecs}/cs35l56_hda_spi.c | 0 .../codecs/side-codecs}/hda_component.c | 0 .../codecs/side-codecs}/hda_component.h | 0 .../codecs/side-codecs}/tas2781_hda.c | 0 .../codecs/side-codecs}/tas2781_hda.h | 0 .../codecs/side-codecs}/tas2781_hda_i2c.c | 2 +- .../codecs/side-codecs}/tas2781_hda_spi.c | 2 +- .../codecs/sigmatel.c} | 4 +- .../{pci/hda/patch_via.c => hda/codecs/via.c} | 2 +- sound/pci/Kconfig | 2 - sound/pci/Makefile | 1 - sound/pci/hda/Makefile | 61 ------- 54 files changed, 257 insertions(+), 247 deletions(-)rename
sound/{pci/hda=> hda/codecs}/Kconfig (55%)
create mode 100644sound/hda/codecs/Makefile
renamesound/{pci/hda/patch_analog.c=>hda/codecs/analog.c} (99%)
renamesound/{pci/hda/patch_ca0110.c=>hda/codecs/ca0110.c} (98%)
renamesound/{pci/hda/patch_ca0132.c=>hda/codecs/ca0132.c} (99%)
renamesound/{pci/hda=>hda/codecs}/ca0132_regs.h(100%)
create mode 100644sound/hda/codecs/cirrus/Kconfig
create mode 100644sound/hda/codecs/cirrus/Makefile
renamesound/{pci/hda/patch_cirrus.c=>hda/codecs/cirrus/cirrus.c} (99%)
renamesound/{pci/hda/patch_cs8409-tables.c=>hda/codecs/cirrus/cs8409-tables.c} (99%) renamesound/{pci/hda/patch_cs8409.c=>hda/codecs/cirrus/cs8409.c} (99%)
renamesound/{pci/hda/patch_cs8409.h=>hda/codecs/cirrus/cs8409.h} (99%)
renamesound/{pci/hda/patch_cmedia.c=>hda/codecs/cmedia.c} (99%)
renamesound/{pci/hda/patch_conexant.c=>hda/codecs/conexant.c} (99%)
renamesound/{pci/hda/hda_generic.c=>hda/codecs/generic.c} (99%)
renamesound/{pci/hda/hda_generic.h=>hda/codecs/generic.h} (100%)
create mode 100644sound/hda/codecs/hdmi/Makefile
renamesound/{pci/hda/hda_eld.c=>hda/codecs/hdmi/eld.c} (100%)
renamesound/{pci/hda/patch_hdmi.c=>hda/codecs/hdmi/hdmi.c} (99%)
renamesound/{pci/hda/hp_x360_helper.c=>hda/codecs/helpers/hp_x360.c} (100%) renamesound/{pci/hda/ideapad_hotkey_led_helper.c=>hda/codecs/helpers/ideapad_hotkey_led.c} (100%) renamesound/{pci/hda/ideapad_s740_helper.c=>hda/codecs/helpers/ideapad_s740.c} (100%) renamesound/{pci/hda/thinkpad_helper.c=>hda/codecs/helpers/thinkpad.c} (100%) renamesound/{pci/hda/patch_realtek.c=>hda/codecs/realtek.c} (99%)
renamesound/{pci/hda/patch_senarytech.c=>hda/codecs/senarytech.c} (98%)
renamesound/{pci/hda/patch_si3054.c=>hda/codecs/si3054.c} (100%)
create mode 100644sound/hda/codecs/side-codecs/Kconfig
create mode 100644sound/hda/codecs/side-codecs/Makefile
renamesound/{pci/hda=>hda/codecs/side-codecs}/cirrus_scodec.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cirrus_scodec.h(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cirrus_scodec_test.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l41_hda.c(99%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l41_hda.h(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l41_hda_i2c.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l41_hda_property.c(100%) renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l41_hda_property.h(100%) renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l41_hda_spi.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l56_hda.c(99%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l56_hda.h(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l56_hda_i2c.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l56_hda_spi.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/hda_component.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/hda_component.h(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/tas2781_hda.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/tas2781_hda.h(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/tas2781_hda_i2c.c(99%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/tas2781_hda_spi.c(99%)
renamesound/{pci/hda/patch_sigmatel.c=>hda/codecs/sigmatel.c} (99%)
renamesound/{pci/hda/patch_via.c=>hda/codecs/via.c} (99%)
delete mode 100644sound/pci/hda/Makefile
Re: [PATCH 06/27] ALSA: hda: Move codec drivers into sound/hda/codecs directory
Quoted 9 lines · Cezary Rojewski
Quoted 7 lines · Takashi Iwai
Now move the all remaining codec drivers from
sound/pci/hdatosound/hda/codecssubdirectory. Some drivers are put under the further vendor subdirectory, and the vendor helper code (*_helper.c) are put under helpers subdirectory. Also the sub-codec drivers are moved under a different subdirectory,sound/hda/codecs/sub-codecs, for distinguishing from the main HD-audio codec drivers.
Quoted 8 lines
Quoted 5 lines
The prefix
patch_andhda_as well as the suffix_helperare dropped from file names as they are mostly superfluous.No functional changes but just file path shuffling.
Path: codecs/side-codecs/ looks wierd. My suggestion is to avoid the repeat and stay with codecs/side/.
Sorry, too late, I already merged the stuff. (And IMO codecs/side doesn't sound intuitive.)
Since the directory names are more or less understandable, and Cirrus people seem OK with it, so let's leave as is.
thanks,
Takashi
Quoted 112 lines
In regard to 'helpers', I believe some of these .c files could be converted to headers and lie in
sound/hda/quirks/directory. These are more of a platform-level files, notsound/hda/codecs/per-se.Quoted 107 lines
Signed-off-by Takashi Iwai <[email protected]>--- sound/hda/Kconfig | 1 + sound/hda/Makefile | 1 + sound/{pci/hda => hda/codecs}/Kconfig | 158 +----------------- sound/hda/codecs/Makefile | 31 ++++ .../patch_analog.c => hda/codecs/analog.c} | 2 +- .../patch_ca0110.c => hda/codecs/ca0110.c} | 2 +- .../patch_ca0132.c => hda/codecs/ca0132.c} | 2 +- sound/{pci/hda => hda/codecs}/ca0132_regs.h | 0 sound/hda/codecs/cirrus/Kconfig | 21 +++ sound/hda/codecs/cirrus/Makefile | 8 + .../codecs/cirrus/cirrus.c} | 2 +- .../codecs/cirrus/cs8409-tables.c} | 4 +- .../codecs/cirrus/cs8409.c} | 2 +- .../codecs/cirrus/cs8409.h} | 2 +- .../patch_cmedia.c => hda/codecs/cmedia.c} | 2 +- .../codecs/conexant.c} | 6 +- .../hda_generic.c => hda/codecs/generic.c} | 2 +- .../hda_generic.h => hda/codecs/generic.h} | 0 sound/hda/codecs/hdmi/Makefile | 6 + .../hda/hda_eld.c => hda/codecs/hdmi/eld.c} | 0 .../patch_hdmi.c => hda/codecs/hdmi/hdmi.c} | 2 +- .../codecs/helpers/hp_x360.c} | 0 .../codecs/helpers/ideapad_hotkey_led.c} | 0 .../codecs/helpers/ideapad_s740.c} | 0 .../codecs/helpers/thinkpad.c} | 0 .../patch_realtek.c => hda/codecs/realtek.c} | 12 +- .../codecs/senarytech.c} | 4 +- .../patch_si3054.c => hda/codecs/si3054.c} | 0 sound/hda/codecs/side-codecs/Kconfig | 128 ++++++++++++++ sound/hda/codecs/side-codecs/Makefile | 28 ++++ .../codecs/side-codecs}/cirrus_scodec.c | 0 .../codecs/side-codecs}/cirrus_scodec.h | 0 .../codecs/side-codecs}/cirrus_scodec_test.c | 0 .../codecs/side-codecs}/cs35l41_hda.c | 2 +- .../codecs/side-codecs}/cs35l41_hda.h | 0 .../codecs/side-codecs}/cs35l41_hda_i2c.c | 0 .../side-codecs}/cs35l41_hda_property.c | 0 .../side-codecs}/cs35l41_hda_property.h | 0 .../codecs/side-codecs}/cs35l41_hda_spi.c | 0 .../codecs/side-codecs}/cs35l56_hda.c | 2 +- .../codecs/side-codecs}/cs35l56_hda.h | 0 .../codecs/side-codecs}/cs35l56_hda_i2c.c | 0 .../codecs/side-codecs}/cs35l56_hda_spi.c | 0 .../codecs/side-codecs}/hda_component.c | 0 .../codecs/side-codecs}/hda_component.h | 0 .../codecs/side-codecs}/tas2781_hda.c | 0 .../codecs/side-codecs}/tas2781_hda.h | 0 .../codecs/side-codecs}/tas2781_hda_i2c.c | 2 +- .../codecs/side-codecs}/tas2781_hda_spi.c | 2 +- .../codecs/sigmatel.c} | 4 +- .../{pci/hda/patch_via.c => hda/codecs/via.c} | 2 +- sound/pci/Kconfig | 2 - sound/pci/Makefile | 1 - sound/pci/hda/Makefile | 61 ------- 54 files changed, 257 insertions(+), 247 deletions(-)rename
sound/{pci/hda=> hda/codecs}/Kconfig (55%)
create mode 100644sound/hda/codecs/Makefile
renamesound/{pci/hda/patch_analog.c=>hda/codecs/analog.c} (99%)
renamesound/{pci/hda/patch_ca0110.c=>hda/codecs/ca0110.c} (98%)
renamesound/{pci/hda/patch_ca0132.c=>hda/codecs/ca0132.c} (99%)
renamesound/{pci/hda=>hda/codecs}/ca0132_regs.h(100%)
create mode 100644sound/hda/codecs/cirrus/Kconfig
create mode 100644sound/hda/codecs/cirrus/Makefile
renamesound/{pci/hda/patch_cirrus.c=>hda/codecs/cirrus/cirrus.c} (99%)
renamesound/{pci/hda/patch_cs8409-tables.c=>hda/codecs/cirrus/cs8409-tables.c} (99%) renamesound/{pci/hda/patch_cs8409.c=>hda/codecs/cirrus/cs8409.c} (99%)
renamesound/{pci/hda/patch_cs8409.h=>hda/codecs/cirrus/cs8409.h} (99%)
renamesound/{pci/hda/patch_cmedia.c=>hda/codecs/cmedia.c} (99%)
renamesound/{pci/hda/patch_conexant.c=>hda/codecs/conexant.c} (99%)
renamesound/{pci/hda/hda_generic.c=>hda/codecs/generic.c} (99%)
renamesound/{pci/hda/hda_generic.h=>hda/codecs/generic.h} (100%)
create mode 100644sound/hda/codecs/hdmi/Makefile
renamesound/{pci/hda/hda_eld.c=>hda/codecs/hdmi/eld.c} (100%)
renamesound/{pci/hda/patch_hdmi.c=>hda/codecs/hdmi/hdmi.c} (99%)
renamesound/{pci/hda/hp_x360_helper.c=>hda/codecs/helpers/hp_x360.c} (100%) renamesound/{pci/hda/ideapad_hotkey_led_helper.c=>hda/codecs/helpers/ideapad_hotkey_led.c} (100%) renamesound/{pci/hda/ideapad_s740_helper.c=>hda/codecs/helpers/ideapad_s740.c} (100%) renamesound/{pci/hda/thinkpad_helper.c=>hda/codecs/helpers/thinkpad.c} (100%) renamesound/{pci/hda/patch_realtek.c=>hda/codecs/realtek.c} (99%)
renamesound/{pci/hda/patch_senarytech.c=>hda/codecs/senarytech.c} (98%)
renamesound/{pci/hda/patch_si3054.c=>hda/codecs/si3054.c} (100%)
create mode 100644sound/hda/codecs/side-codecs/Kconfig
create mode 100644sound/hda/codecs/side-codecs/Makefile
renamesound/{pci/hda=>hda/codecs/side-codecs}/cirrus_scodec.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cirrus_scodec.h(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cirrus_scodec_test.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l41_hda.c(99%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l41_hda.h(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l41_hda_i2c.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l41_hda_property.c(100%) renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l41_hda_property.h(100%) renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l41_hda_spi.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l56_hda.c(99%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l56_hda.h(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l56_hda_i2c.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l56_hda_spi.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/hda_component.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/hda_component.h(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/tas2781_hda.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/tas2781_hda.h(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/tas2781_hda_i2c.c(99%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/tas2781_hda_spi.c(99%)
renamesound/{pci/hda/patch_sigmatel.c=>hda/codecs/sigmatel.c} (99%)
renamesound/{pci/hda/patch_via.c=>hda/codecs/via.c} (99%)
delete mode 100644sound/pci/hda/Makefile
Re: [PATCH 06/27] ALSA: hda: Move codec drivers into sound/hda/codecs directory
Quoted 17 lines · Takashi Iwai
Quoted 15 lines · Cezary Rojewski
Quoted 12 lines · Takashi Iwai
Now move the all remaining codec drivers from
sound/pci/hdatosound/hda/codecssubdirectory. Some drivers are put under the further vendor subdirectory, and the vendor helper code (*_helper.c) are put under helpers subdirectory. Also the sub-codec drivers are moved under a different subdirectory,sound/hda/codecs/sub-codecs, for distinguishing from the main HD-audio codec drivers.The prefix
patch_andhda_as well as the suffix_helperare dropped from file names as they are mostly superfluous.No functional changes but just file path shuffling.
Quoted 8 lines
Quoted 2 lines
Path: codecs/side-codecs/ looks wierd. My suggestion is to avoid the repeat and stay with codecs/side/.
Sorry, too late, I already merged the stuff. (And IMO codecs/side doesn't sound intuitive.)
Since the directory names are more or less understandable, and Cirrus people seem OK with it, so let's leave as is.
Oh, didn't notice. The series is large and I wasn't expecting it to get merged that quickly.
Guess no point in reviewing the rest then, thanks for the information!
Quoted 112 lines
Quoted 112 lines
In regard to 'helpers', I believe some of these .c files could be converted to headers and lie in
sound/hda/quirks/directory. These are more of a platform-level files, notsound/hda/codecs/per-se.Quoted 107 lines
Signed-off-by Takashi Iwai <[email protected]>--- sound/hda/Kconfig | 1 + sound/hda/Makefile | 1 + sound/{pci/hda => hda/codecs}/Kconfig | 158 +----------------- sound/hda/codecs/Makefile | 31 ++++ .../patch_analog.c => hda/codecs/analog.c} | 2 +- .../patch_ca0110.c => hda/codecs/ca0110.c} | 2 +- .../patch_ca0132.c => hda/codecs/ca0132.c} | 2 +- sound/{pci/hda => hda/codecs}/ca0132_regs.h | 0 sound/hda/codecs/cirrus/Kconfig | 21 +++ sound/hda/codecs/cirrus/Makefile | 8 + .../codecs/cirrus/cirrus.c} | 2 +- .../codecs/cirrus/cs8409-tables.c} | 4 +- .../codecs/cirrus/cs8409.c} | 2 +- .../codecs/cirrus/cs8409.h} | 2 +- .../patch_cmedia.c => hda/codecs/cmedia.c} | 2 +- .../codecs/conexant.c} | 6 +- .../hda_generic.c => hda/codecs/generic.c} | 2 +- .../hda_generic.h => hda/codecs/generic.h} | 0 sound/hda/codecs/hdmi/Makefile | 6 + .../hda/hda_eld.c => hda/codecs/hdmi/eld.c} | 0 .../patch_hdmi.c => hda/codecs/hdmi/hdmi.c} | 2 +- .../codecs/helpers/hp_x360.c} | 0 .../codecs/helpers/ideapad_hotkey_led.c} | 0 .../codecs/helpers/ideapad_s740.c} | 0 .../codecs/helpers/thinkpad.c} | 0 .../patch_realtek.c => hda/codecs/realtek.c} | 12 +- .../codecs/senarytech.c} | 4 +- .../patch_si3054.c => hda/codecs/si3054.c} | 0 sound/hda/codecs/side-codecs/Kconfig | 128 ++++++++++++++ sound/hda/codecs/side-codecs/Makefile | 28 ++++ .../codecs/side-codecs}/cirrus_scodec.c | 0 .../codecs/side-codecs}/cirrus_scodec.h | 0 .../codecs/side-codecs}/cirrus_scodec_test.c | 0 .../codecs/side-codecs}/cs35l41_hda.c | 2 +- .../codecs/side-codecs}/cs35l41_hda.h | 0 .../codecs/side-codecs}/cs35l41_hda_i2c.c | 0 .../side-codecs}/cs35l41_hda_property.c | 0 .../side-codecs}/cs35l41_hda_property.h | 0 .../codecs/side-codecs}/cs35l41_hda_spi.c | 0 .../codecs/side-codecs}/cs35l56_hda.c | 2 +- .../codecs/side-codecs}/cs35l56_hda.h | 0 .../codecs/side-codecs}/cs35l56_hda_i2c.c | 0 .../codecs/side-codecs}/cs35l56_hda_spi.c | 0 .../codecs/side-codecs}/hda_component.c | 0 .../codecs/side-codecs}/hda_component.h | 0 .../codecs/side-codecs}/tas2781_hda.c | 0 .../codecs/side-codecs}/tas2781_hda.h | 0 .../codecs/side-codecs}/tas2781_hda_i2c.c | 2 +- .../codecs/side-codecs}/tas2781_hda_spi.c | 2 +- .../codecs/sigmatel.c} | 4 +- .../{pci/hda/patch_via.c => hda/codecs/via.c} | 2 +- sound/pci/Kconfig | 2 - sound/pci/Makefile | 1 - sound/pci/hda/Makefile | 61 ------- 54 files changed, 257 insertions(+), 247 deletions(-)rename
sound/{pci/hda=> hda/codecs}/Kconfig (55%)
create mode 100644sound/hda/codecs/Makefile
renamesound/{pci/hda/patch_analog.c=>hda/codecs/analog.c} (99%)
renamesound/{pci/hda/patch_ca0110.c=>hda/codecs/ca0110.c} (98%)
renamesound/{pci/hda/patch_ca0132.c=>hda/codecs/ca0132.c} (99%)
renamesound/{pci/hda=>hda/codecs}/ca0132_regs.h(100%)
create mode 100644sound/hda/codecs/cirrus/Kconfig
create mode 100644sound/hda/codecs/cirrus/Makefile
renamesound/{pci/hda/patch_cirrus.c=>hda/codecs/cirrus/cirrus.c} (99%)
renamesound/{pci/hda/patch_cs8409-tables.c=>hda/codecs/cirrus/cs8409-tables.c} (99%) renamesound/{pci/hda/patch_cs8409.c=>hda/codecs/cirrus/cs8409.c} (99%)
renamesound/{pci/hda/patch_cs8409.h=>hda/codecs/cirrus/cs8409.h} (99%)
renamesound/{pci/hda/patch_cmedia.c=>hda/codecs/cmedia.c} (99%)
renamesound/{pci/hda/patch_conexant.c=>hda/codecs/conexant.c} (99%)
renamesound/{pci/hda/hda_generic.c=>hda/codecs/generic.c} (99%)
renamesound/{pci/hda/hda_generic.h=>hda/codecs/generic.h} (100%)
create mode 100644sound/hda/codecs/hdmi/Makefile
renamesound/{pci/hda/hda_eld.c=>hda/codecs/hdmi/eld.c} (100%)
renamesound/{pci/hda/patch_hdmi.c=>hda/codecs/hdmi/hdmi.c} (99%)
renamesound/{pci/hda/hp_x360_helper.c=>hda/codecs/helpers/hp_x360.c} (100%) renamesound/{pci/hda/ideapad_hotkey_led_helper.c=>hda/codecs/helpers/ideapad_hotkey_led.c} (100%) renamesound/{pci/hda/ideapad_s740_helper.c=>hda/codecs/helpers/ideapad_s740.c} (100%) renamesound/{pci/hda/thinkpad_helper.c=>hda/codecs/helpers/thinkpad.c} (100%) renamesound/{pci/hda/patch_realtek.c=>hda/codecs/realtek.c} (99%)
renamesound/{pci/hda/patch_senarytech.c=>hda/codecs/senarytech.c} (98%)
renamesound/{pci/hda/patch_si3054.c=>hda/codecs/si3054.c} (100%)
create mode 100644sound/hda/codecs/side-codecs/Kconfig
create mode 100644sound/hda/codecs/side-codecs/Makefile
renamesound/{pci/hda=>hda/codecs/side-codecs}/cirrus_scodec.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cirrus_scodec.h(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cirrus_scodec_test.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l41_hda.c(99%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l41_hda.h(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l41_hda_i2c.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l41_hda_property.c(100%) renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l41_hda_property.h(100%) renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l41_hda_spi.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l56_hda.c(99%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l56_hda.h(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l56_hda_i2c.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/cs35l56_hda_spi.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/hda_component.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/hda_component.h(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/tas2781_hda.c(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/tas2781_hda.h(100%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/tas2781_hda_i2c.c(99%)
renamesound/{pci/hda=>hda/codecs/side-codecs}/tas2781_hda_spi.c(99%)
renamesound/{pci/hda/patch_sigmatel.c=>hda/codecs/sigmatel.c} (99%)
renamesound/{pci/hda/patch_via.c=>hda/codecs/via.c} (99%)
delete mode 100644sound/pci/hda/Makefile
Re: [PATCH 06/27] ALSA: hda: Move codec drivers into sound/hda/codecs directory
Quoted 22 lines · Cezary Rojewski
Quoted 20 lines · Takashi Iwai
Quoted 17 lines · Cezary Rojewski
Quoted 7 lines · Takashi Iwai
Now move the all remaining codec drivers from
sound/pci/hdatosound/hda/codecssubdirectory. Some drivers are put under the further vendor subdirectory, and the vendor helper code (*_helper.c) are put under helpers subdirectory. Also the sub-codec drivers are moved under a different subdirectory,sound/hda/codecs/sub-codecs, for distinguishing from the main HD-audio codec drivers.Quoted 5 lines
The prefix
patch_andhda_as well as the suffix_helperare dropped from file names as they are mostly superfluous.No functional changes but just file path shuffling.
Path: codecs/side-codecs/ looks wierd. My suggestion is to avoid the repeat and stay with codecs/side/.
Quoted 8 lines
Quoted 5 lines
Sorry, too late, I already merged the stuff. (And IMO codecs/side doesn't sound intuitive.)
Since the directory names are more or less understandable, and Cirrus people seem OK with it, so let's leave as is.
Oh, didn't notice. The series is large and I wasn't expecting it to get merged that quickly.
There should be no much functional changes and the only matter is file name shuffling, and no much regression reports from 0-day, so I decided to merge for 6.17. Then earlier, better.
Currently no further code change is planned from my side for 6.17. Also some changes have been queued, they are post 6.17 materials.
Quoted 1 line
Guess no point in reviewing the rest then, thanks for the information!
We may still rename if something looks too worrisome, of course. If you have something in mind, let me know.
Thanks!
Takashi
Re: [PATCH 06/27] ALSA: hda: Move codec drivers into sound/hda/codecs directory
Quoted 37 lines · Takashi Iwai
Quoted 22 lines · Cezary Rojewski
Quoted 20 lines · Takashi Iwai
Quoted 17 lines · Cezary Rojewski
Quoted 7 lines · Takashi Iwai
Now move the all remaining codec drivers from
sound/pci/hdatosound/hda/codecssubdirectory. Some drivers are put under the further vendor subdirectory, and the vendor helper code (*_helper.c) are put under helpers subdirectory. Also the sub-codec drivers are moved under a different subdirectory,sound/hda/codecs/sub-codecs, for distinguishing from the main HD-audio codec drivers.Quoted 5 lines
The prefix
patch_andhda_as well as the suffix_helperare dropped from file names as they are mostly superfluous.No functional changes but just file path shuffling.
Path: codecs/side-codecs/ looks wierd. My suggestion is to avoid the repeat and stay with codecs/side/.
Quoted 8 lines
Quoted 5 lines
Sorry, too late, I already merged the stuff. (And IMO codecs/side doesn't sound intuitive.)
Since the directory names are more or less understandable, and Cirrus people seem OK with it, so let's leave as is.
Oh, didn't notice. The series is large and I wasn't expecting it to get merged that quickly.
There should be no much functional changes and the only matter is file name shuffling, and no much regression reports from 0-day, so I decided to merge for 6.17. Then earlier, better.
Quoted 7 lines
Currently no further code change is planned from my side for 6.17. Also some changes have been queued, they are post 6.17 materials.
Quoted 1 line
Guess no point in reviewing the rest then, thanks for the information!
We may still rename if something looks too worrisome, of course. If you have something in mind, let me know.
Thank you. I'll update my tactic a bit - rebase onto the new hda/ and reply/send patches separately if anything pops up.
There is a lot to look at and, at the same time it's very encouraging to see major work done in hda/ area :)
Kind regards,
Czarek
Re: [PATCH 06/27] ALSA: hda: Move codec drivers into sound/hda/codecs directory
Quoted 44 lines · Cezary Rojewski
Quoted 42 lines · Takashi Iwai
Quoted 22 lines · Cezary Rojewski
Quoted 20 lines · Takashi Iwai
Quoted 17 lines · Cezary Rojewski
Quoted 7 lines · Takashi Iwai
Now move the all remaining codec drivers from
sound/pci/hdatosound/hda/codecssubdirectory. Some drivers are put under the further vendor subdirectory, and the vendor helper code (*_helper.c) are put under helpers subdirectory. Also the sub-codec drivers are moved under a different subdirectory,sound/hda/codecs/sub-codecs, for distinguishing from the main HD-audio codec drivers.Quoted 5 lines
The prefix
patch_andhda_as well as the suffix_helperare dropped from file names as they are mostly superfluous.No functional changes but just file path shuffling.
Path: codecs/side-codecs/ looks wierd. My suggestion is to avoid the repeat and stay with codecs/side/.
Quoted 8 lines
Quoted 5 lines
Sorry, too late, I already merged the stuff. (And IMO codecs/side doesn't sound intuitive.)
Since the directory names are more or less understandable, and Cirrus people seem OK with it, so let's leave as is.
Oh, didn't notice. The series is large and I wasn't expecting it to get merged that quickly.
There should be no much functional changes and the only matter is file name shuffling, and no much regression reports from 0-day, so I decided to merge for 6.17. Then earlier, better.
Currently no further code change is planned from my side for 6.17. Also some changes have been queued, they are post 6.17 materials.
Quoted 1 line
Guess no point in reviewing the rest then, thanks for the information!
Quoted 8 lines
Quoted 2 lines
We may still rename if something looks too worrisome, of course. If you have something in mind, let me know.
Thank you. I'll update my tactic a bit - rebase onto the new hda/ and reply/send patches separately if anything pops up.
There is a lot to look at and, at the same time it's very encouraging to see major work done in hda/ area :)
Great, thanks!
Takashi
PATCH 7/27 ALSA: hda: Split Realtek HD-audio codec driver
In reply to Takashi IwaiThe snd-hda-codec-realtek driver supports many different codec models and accumulated lots of quirks. Now let's split it to multiple modules per probe function, i.e. for ALC260, ALC262, ALC269, etc.
The common code and quirks are provided by the common library module, snd-hda-codec-realtek-lib now. One drawback of this action is that many symbols have to be exported. But they are limited with SND_HDA_CODEC_REALTEK namespace, at least.
This patch tries to be idiomatic and doesn't try to rewrite the existing code. We can move the codec model-specific code into each codec driver later.
The HD-audio sub-codec component binding is currently specific to ALC269, hence the management is moved into alc269.c. After that, alc_free() became identical with snd_hda_gen_free(), and it's replaced as a macro just to call snd_hda_gen_free().
---
sound/hda/codecs/Kconfig | 14 +-
sound/hda/codecs/Makefile | 5 +-
sound/hda/codecs/realtek/Kconfig | 90 +
sound/hda/codecs/realtek/Makefile | 26 +
sound/hda/codecs/realtek/alc260.c | 276 +
sound/hda/codecs/realtek/alc262.c | 199 +
sound/hda/codecs/realtek/alc268.c | 176 +
.../codecs/{realtek.c => realtek/alc269.c} | 5727 +----------------
sound/hda/codecs/realtek/alc662.c | 1102 ++++
sound/hda/codecs/realtek/alc680.c | 53 +
sound/hda/codecs/realtek/alc861.c | 149 +
sound/hda/codecs/realtek/alc861vd.c | 123 +
sound/hda/codecs/realtek/alc880.c | 497 ++
sound/hda/codecs/realtek/alc882.c | 847 +++
sound/hda/codecs/realtek/realtek.c | 2314 +++++++
sound/hda/codecs/realtek/realtek.h | 302 +
16 files changed, 6191 insertions(+), 5709 deletions(-)
create mode 100644 sound/hda/codecs/realtek/Kconfig
create mode 100644 sound/hda/codecs/realtek/Makefile
create mode 100644 sound/hda/codecs/realtek/alc260.c
create mode 100644 sound/hda/codecs/realtek/alc262.c
create mode 100644 sound/hda/codecs/realtek/alc268.c
rename sound/hda/codecs/{realtek.c => realtek/alc269.c} (64%)
create mode 100644 sound/hda/codecs/realtek/alc662.c
create mode 100644 sound/hda/codecs/realtek/alc680.c
create mode 100644 sound/hda/codecs/realtek/alc861.c
create mode 100644 sound/hda/codecs/realtek/alc861vd.c
create mode 100644 sound/hda/codecs/realtek/alc880.c
create mode 100644 sound/hda/codecs/realtek/alc882.c
create mode 100644 sound/hda/codecs/realtek/realtek.c
create mode 100644 sound/hda/codecs/realtek/realtek.hsound/hda/codecs/Kconfig +1 -13
@@ -4,19 +4,6 @@ if SND_HDA config SND_HDA_GENERIC_LEDS bool -config SND_HDA_CODEC_REALTEK - tristate "Build Realtek HD-audio codec support" - depends on INPUT - select SND_HDA_GENERIC - select SND_HDA_GENERIC_LEDS - select SND_HDA_SCODEC_COMPONENT - help - Say Y or M here to include Realtek HD-audio codec support in - snd-hda-intel driver, such as ALC880. - -comment "Set to Y if you want auto-loading the codec driver" - depends on SND_HDA=y && SND_HDA_CODEC_REALTEK=m - config SND_HDA_CODEC_ANALOG tristate "Build Analog Devices HD-audio codec support" select SND_HDA_GENERIC
@@ -162,6 +149,7 @@ config SND_HDA_INTEL_HDMI_SILENT_STREAM This feature can impact power consumption as resources are kept reserved both at transmitter and receiver. +source "sound/hda/codecs/realtek/Kconfig" source "sound/hda/codecs/cirrus/Kconfig" source "sound/hda/codecs/side-codecs/Kconfig"
sound/hda/codecs/Makefile +3 -2
@@ -2,30 +2,31 @@ subdir-ccflags-y += -I$(src)/../common snd-hda-codec-generic-y := generic.o +snd-hda-codec-cmedia-y := cmedia.o snd-hda-codec-analog-y := analog.o snd-hda-codec-ca0110-y := ca0110.o snd-hda-codec-ca0132-y := ca0132.o snd-hda-codec-cmedia-y := cmedia.o snd-hda-codec-conexant-y := conexant.o snd-hda-codec-idt-y := sigmatel.o -snd-hda-codec-realtek-y := realtek.o snd-hda-codec-senarytech-y := senarytech.o snd-hda-codec-si3054-y := si3054.o snd-hda-codec-via-y := via.o obj-y += cirrus/ obj-y += hdmi/ +obj-y += realtek/ obj-y += side-codecs/ # codec drivers obj-$(CONFIG_SND_HDA_GENERIC) += snd-hda-codec-generic.o +obj-$(CONFIG_SND_HDA_CODEC_CMEDIA) += snd-hda-codec-cmedia.o obj-$(CONFIG_SND_HDA_CODEC_ANALOG) += snd-hda-codec-analog.o obj-$(CONFIG_SND_HDA_CODEC_CA0110) += snd-hda-codec-ca0110.o obj-$(CONFIG_SND_HDA_CODEC_CA0132) += snd-hda-codec-ca0132.o obj-$(CONFIG_SND_HDA_CODEC_CMEDIA) += snd-hda-codec-cmedia.o obj-$(CONFIG_SND_HDA_CODEC_CONEXANT) += snd-hda-codec-conexant.o obj-$(CONFIG_SND_HDA_CODEC_SIGMATEL) += snd-hda-codec-idt.o -obj-$(CONFIG_SND_HDA_CODEC_REALTEK) += snd-hda-codec-realtek.o obj-$(CONFIG_SND_HDA_CODEC_SENARYTECH) += snd-hda-codec-senarytech.o obj-$(CONFIG_SND_HDA_CODEC_SI3054) += snd-hda-codec-si3054.o obj-$(CONFIG_SND_HDA_CODEC_VIA) += snd-hda-codec-via.o
sound/hda/codecs/realtek/Kconfig new file +90 -0
90 lines not on this page · raw message
sound/hda/codecs/realtek/Makefile new file +26 -0
@@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0 +subdir-ccflags-y += -I$(src)/../../common + +snd-hda-codec-realtek-lib-y := realtek.o +snd-hda-codec-alc260-y := alc260.o +snd-hda-codec-alc262-y := alc262.o +snd-hda-codec-alc268-y := alc268.o +snd-hda-codec-alc269-y := alc269.o +snd-hda-codec-alc662-y := alc662.o +snd-hda-codec-alc680-y := alc680.o +snd-hda-codec-alc861-y := alc861.o +snd-hda-codec-alc861vd-y := alc861vd.o +snd-hda-codec-alc880-y := alc880.o +snd-hda-codec-alc882-y := alc882.o + +obj-$(CONFIG_SND_HDA_CODEC_REALTEK_LIB) += snd-hda-codec-realtek-lib.o +obj-$(CONFIG_SND_HDA_CODEC_ALC260) += snd-hda-codec-alc260.o +obj-$(CONFIG_SND_HDA_CODEC_ALC262) += snd-hda-codec-alc262.o +obj-$(CONFIG_SND_HDA_CODEC_ALC268) += snd-hda-codec-alc268.o +obj-$(CONFIG_SND_HDA_CODEC_ALC269) += snd-hda-codec-alc269.o +obj-$(CONFIG_SND_HDA_CODEC_ALC662) += snd-hda-codec-alc662.o +obj-$(CONFIG_SND_HDA_CODEC_ALC680) += snd-hda-codec-alc680.o +obj-$(CONFIG_SND_HDA_CODEC_ALC861) += snd-hda-codec-alc861.o +obj-$(CONFIG_SND_HDA_CODEC_ALC861VD) += snd-hda-codec-alc861vd.o +obj-$(CONFIG_SND_HDA_CODEC_ALC880) += snd-hda-codec-alc880.o +obj-$(CONFIG_SND_HDA_CODEC_ALC882) += snd-hda-codec-alc882.o
sound/hda/codecs/realtek/alc260.c new file +276 -0
276 lines not on this page · raw message
sound/hda/codecs/realtek/alc262.c new file +199 -0
199 lines not on this page · raw message
sound/hda/codecs/realtek/alc268.c new file +176 -0
176 lines not on this page · raw message
sound/hda/codecs/realtek/alc269.c renamed from sound/hda/codecs/realtek.c +33 -5694
2,174 lines not on this page · raw message
sound/hda/codecs/realtek/alc662.c new file +1102 -0
1,102 lines not on this page · raw message
sound/hda/codecs/realtek/alc680.c new file +53 -0
53 lines not on this page · raw message
sound/hda/codecs/realtek/alc861.c new file +149 -0
149 lines not on this page · raw message
sound/hda/codecs/realtek/alc861vd.c new file +123 -0
123 lines not on this page · raw message
sound/hda/codecs/realtek/alc880.c new file +497 -0
497 lines not on this page · raw message
sound/hda/codecs/realtek/alc882.c new file +847 -0
847 lines not on this page · raw message
sound/hda/codecs/realtek/realtek.c new file +2314 -0
2,314 lines not on this page · raw message
sound/hda/codecs/realtek/realtek.h new file +302 -0
302 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.50.0
Part of the diff is not shown here. View the raw message.
Re: [PATCH 07/27] ALSA: hda: Split Realtek HD-audio codec driver
Quoted 4 lines · Takashi Iwai
The snd-hda-codec-realtek driver supports many different codec models and accumulated lots of quirks. Now let's split it to multiple modules per probe function, i.e. for ALC260, ALC262, ALC269, etc.
Quoted 8 lines
The common code and quirks are provided by the common library module, snd-hda-codec-realtek-lib now. One drawback of this action is that many symbols have to be exported. But they are limited with
SND_HDA_CODEC_REALTEKnamespace, at least.This patch tries to be idiomatic and doesn't try to rewrite the existing code. We can move the codec model-specific code into each codec driver later.
Thank you for mentioning this.
Quoted 6 lines
The HD-audio sub-codec component binding is currently specific to ALC269, hence the management is moved into
alc269.c. After that,alc_free()became identical withsnd_hda_gen_free(), and it's replaced as a macro just to callsnd_hda_gen_free().
That's some outstanding work right there, Takashi. Given the commit message above, any refactoring shall be left for later. My only comment is related to: sound/hda/codecs/realtek/realtek.c :) Perhaps 'common.c/h' ?
Quoted 12,231 lines
Signed-off-by Takashi Iwai <[email protected]>--- sound/hda/codecs/Kconfig | 14 +- sound/hda/codecs/Makefile | 5 +- sound/hda/codecs/realtek/Kconfig | 90 + sound/hda/codecs/realtek/Makefile | 26 + sound/hda/codecs/realtek/alc260.c | 276 + sound/hda/codecs/realtek/alc262.c | 199 + sound/hda/codecs/realtek/alc268.c | 176 + .../codecs/{realtek.c => realtek/alc269.c} | 5727 +---------------- sound/hda/codecs/realtek/alc662.c | 1102 ++++ sound/hda/codecs/realtek/alc680.c | 53 + sound/hda/codecs/realtek/alc861.c | 149 + sound/hda/codecs/realtek/alc861vd.c | 123 + sound/hda/codecs/realtek/alc880.c | 497 ++ sound/hda/codecs/realtek/alc882.c | 847 +++ sound/hda/codecs/realtek/realtek.c | 2314 +++++++ sound/hda/codecs/realtek/realtek.h | 302 + 16 files changed, 6191 insertions(+), 5709 deletions(-)create mode 100644
sound/hda/codecs/realtek/Kconfigcreate mode 100644sound/hda/codecs/realtek/Makefilecreate mode 100644sound/hda/codecs/realtek/alc260.ccreate mode 100644sound/hda/codecs/realtek/alc262.ccreate mode 100644sound/hda/codecs/realtek/alc268.crenamesound/hda/codecs/{realtek.c=>realtek/alc269.c} (64%) create mode 100644sound/hda/codecs/realtek/alc662.ccreate mode 100644sound/hda/codecs/realtek/alc680.ccreate mode 100644sound/hda/codecs/realtek/alc861.ccreate mode 100644sound/hda/codecs/realtek/alc861vd.ccreate mode 100644sound/hda/codecs/realtek/alc880.ccreate mode 100644sound/hda/codecs/realtek/alc882.ccreate mode 100644sound/hda/codecs/realtek/realtek.ccreate mode 100644sound/hda/codecs/realtek/realtek.hsound/hda/codecs/Kconfig +1
-13@@ -4,19 +4,6 @@ if SND_HDA config SND_HDA_GENERIC_LEDS bool -config SND_HDA_CODEC_REALTEK - tristate "Build Realtek HD-audio codec support" - depends on INPUT - select SND_HDA_GENERIC - select SND_HDA_GENERIC_LEDS - select SND_HDA_SCODEC_COMPONENT - help - Say Y or M here to include Realtek HD-audio codec support in - snd-hda-intel driver, such as ALC880. - -comment "Set to Y if you want auto-loading the codec driver" - depends on SND_HDA=y && SND_HDA_CODEC_REALTEK=m - config SND_HDA_CODEC_ANALOG tristate "Build Analog Devices HD-audio codec support" select SND_HDA_GENERIC@@ -162,6 +149,7 @@ config SND_HDA_INTEL_HDMI_SILENT_STREAM This feature can impact power consumption as resources are kept reserved both at transmitter and receiver. +source "sound/hda/codecs/realtek/Kconfig" source "sound/hda/codecs/cirrus/Kconfig" source "sound/hda/codecs/side-codecs/Kconfig"sound/hda/codecs/Makefile +3
-2@@ -2,30 +2,31 @@ subdir-ccflags-y += -I$(src)/../common snd-hda-codec-generic-y := generic.o +snd-hda-codec-cmedia-y := cmedia.o snd-hda-codec-analog-y := analog.o snd-hda-codec-ca0110-y := ca0110.o snd-hda-codec-ca0132-y := ca0132.o snd-hda-codec-cmedia-y := cmedia.o snd-hda-codec-conexant-y := conexant.o snd-hda-codec-idt-y := sigmatel.o -snd-hda-codec-realtek-y := realtek.o snd-hda-codec-senarytech-y := senarytech.o snd-hda-codec-si3054-y := si3054.o snd-hda-codec-via-y := via.o obj-y += cirrus/ obj-y += hdmi/ +obj-y += realtek/ obj-y += side-codecs/ # codec drivers obj-$(CONFIG_SND_HDA_GENERIC) += snd-hda-codec-generic.o +obj-$(CONFIG_SND_HDA_CODEC_CMEDIA) += snd-hda-codec-cmedia.o obj-$(CONFIG_SND_HDA_CODEC_ANALOG) += snd-hda-codec-analog.o obj-$(CONFIG_SND_HDA_CODEC_CA0110) += snd-hda-codec-ca0110.o obj-$(CONFIG_SND_HDA_CODEC_CA0132) += snd-hda-codec-ca0132.o obj-$(CONFIG_SND_HDA_CODEC_CMEDIA) += snd-hda-codec-cmedia.o obj-$(CONFIG_SND_HDA_CODEC_CONEXANT) += snd-hda-codec-conexant.o obj-$(CONFIG_SND_HDA_CODEC_SIGMATEL) += snd-hda-codec-idt.o -obj-$(CONFIG_SND_HDA_CODEC_REALTEK) += snd-hda-codec-realtek.o obj-$(CONFIG_SND_HDA_CODEC_SENARYTECH) += snd-hda-codec-senarytech.o obj-$(CONFIG_SND_HDA_CODEC_SI3054) += snd-hda-codec-si3054.o obj-$(CONFIG_SND_HDA_CODEC_VIA) += snd-hda-codec-via.osound/hda/codecs/realtek/Kconfig new file +90
-0@@ -0,0 +1,90 @@ +# SPDX-License-Identifier: GPL-2.0-only + +menuconfig SND_HDA_CODEC_REALTEK + bool "Realtek HD-audio codec support" + +if SND_HDA_CODEC_REALTEK + +config SND_HDA_CODEC_REALTEK_LIB + tristate + select SND_HDA_GENERIC + select SND_HDA_GENERIC_LEDS + select SND_HDA_SCODEC_COMPONENT + +config SND_HDA_CODEC_ALC260 + tristate "Build Realtek ALC260 HD-audio codec support" + depends on INPUT + select SND_HDA_CODEC_REALTEK_LIB + help + Say Y or M here to include Realtek ALC260 HD-audio codec support + +config SND_HDA_CODEC_ALC262 + tristate "Build Realtek ALC262 HD-audio codec support" + depends on INPUT + select SND_HDA_CODEC_REALTEK_LIB + help + Say Y or M here to include Realtek ALC262 HD-audio codec support + +config SND_HDA_CODEC_ALC268 + tristate "Build Realtek ALC268 HD-audio codec support" + depends on INPUT + select SND_HDA_CODEC_REALTEK_LIB + help + Say Y or M here to include Realtek ALC268 and compatible HD-audio + codec support + +config SND_HDA_CODEC_ALC269 + tristate "Build Realtek ALC269 HD-audio codecs support" + depends on INPUT + select SND_HDA_CODEC_REALTEK_LIB + help + Say Y or M here to include Realtek ALC269 and compatible HD-audio + codec support + +config SND_HDA_CODEC_ALC662 + tristate "Build Realtek ALC662 HD-audio codecs support" + depends on INPUT + select SND_HDA_CODEC_REALTEK_LIB + help + Say Y or M here to include Realtek ALC662 and compatible HD-audio + codec support + +config SND_HDA_CODEC_ALC680 + tristate "Build Realtek ALC680 HD-audio codecs support" + depends on INPUT + select SND_HDA_CODEC_REALTEK_LIB + help + Say Y or M here to include Realtek ALC680 HD-audio codec support + +config SND_HDA_CODEC_ALC861 + tristate "Build Realtek ALC861 HD-audio codecs support" + depends on INPUT + select SND_HDA_CODEC_REALTEK_LIB + help + Say Y or M here to include Realtek ALC861 HD-audio codec support + +config SND_HDA_CODEC_ALC861VD + tristate "Build Realtek ALC861-VD HD-audio codecs support" + depends on INPUT + select SND_HDA_CODEC_REALTEK_LIB + help + Say Y or M here to include Realtek ALC861-VD HD-audio codec support + +config SND_HDA_CODEC_ALC880 + tristate "Build Realtek ALC880 HD-audio codecs support" + depends on INPUT + select SND_HDA_CODEC_REALTEK_LIB + help + Say Y or M here to include Realtek ALC880 HD-audio codec support + +config SND_HDA_CODEC_ALC882 + tristate "Build Realtek ALC882 HD-audio codecs support" + depends on INPUT + select SND_HDA_CODEC_REALTEK_LIB + help + Say Y or M here to include Realtek ALC882 and compatible HD-audio + codec support + +endif + +sound/hda/codecs/realtek/Makefile new file +26
-0@@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0 +subdir-ccflags-y += -I$(src)/../../common + +snd-hda-codec-realtek-lib-y := realtek.o +snd-hda-codec-alc260-y := alc260.o +snd-hda-codec-alc262-y := alc262.o +snd-hda-codec-alc268-y := alc268.o +snd-hda-codec-alc269-y := alc269.o +snd-hda-codec-alc662-y := alc662.o +snd-hda-codec-alc680-y := alc680.o +snd-hda-codec-alc861-y := alc861.o +snd-hda-codec-alc861vd-y := alc861vd.o +snd-hda-codec-alc880-y := alc880.o +snd-hda-codec-alc882-y := alc882.o + +obj-$(CONFIG_SND_HDA_CODEC_REALTEK_LIB) += snd-hda-codec-realtek-lib.o +obj-$(CONFIG_SND_HDA_CODEC_ALC260) += snd-hda-codec-alc260.o +obj-$(CONFIG_SND_HDA_CODEC_ALC262) += snd-hda-codec-alc262.o +obj-$(CONFIG_SND_HDA_CODEC_ALC268) += snd-hda-codec-alc268.o +obj-$(CONFIG_SND_HDA_CODEC_ALC269) += snd-hda-codec-alc269.o +obj-$(CONFIG_SND_HDA_CODEC_ALC662) += snd-hda-codec-alc662.o +obj-$(CONFIG_SND_HDA_CODEC_ALC680) += snd-hda-codec-alc680.o +obj-$(CONFIG_SND_HDA_CODEC_ALC861) += snd-hda-codec-alc861.o +obj-$(CONFIG_SND_HDA_CODEC_ALC861VD) += snd-hda-codec-alc861vd.o +obj-$(CONFIG_SND_HDA_CODEC_ALC880) += snd-hda-codec-alc880.o +obj-$(CONFIG_SND_HDA_CODEC_ALC882) += snd-hda-codec-alc882.osound/hda/codecs/realtek/alc260.c new file +276
-0@@ -0,0 +1,276 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// +// Realtek ALC260 codec +// + +#include <linux/init.h> +#include <linux/module.h> +#include "realtek.h" + +static int alc260_parse_auto_config (struct hda_codec *codec) +{ +static const hda_nid_t alc260_ignore[] = {0x17 ,0 }; +static const hda_nid_t alc260_ssids[] = {0x10 ,0x15 ,0x0f ,0 }; +return alc_parse_auto_config (codec, alc260_ignore, alc260_ssids); +} + +/* +* Pin config fixes +*/ +enum { +ALC260_FIXUP_HP_DC5750 , +ALC260_FIXUP_HP_PIN_0F , +ALC260_FIXUP_COEF , +ALC260_FIXUP_GPIO1 , +ALC260_FIXUP_GPIO1_TOGGLE , +ALC260_FIXUP_REPLACER , +ALC260_FIXUP_HP_B1900 , +ALC260_FIXUP_KN1 , +ALC260_FIXUP_FSC_S7020 , +ALC260_FIXUP_FSC_S7020_JWSE , +ALC260_FIXUP_VAIO_PINS , +}; + +static void alc260_gpio1_automute (struct hda_codec *codec) +{ +struct alc_spec *spec = codec->spec; + +alc_update_gpio_data (codec,0x01 , spec->gen.hp_jack_present); +} + +static void alc260_fixup_gpio1_toggle (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +struct alc_spec *spec = codec->spec; +if (action ==HDA_FIXUP_ACT_PROBE ) { +/* although the machine has only one output pin, we need to +* toggle GPIO1 according to the jack state +*/ + spec->gen.automute_hook = alc260_gpio1_automute; + spec->gen.detect_hp =1 ; + spec->gen.automute_speaker =1 ; + spec->gen.autocfg.hp_pins[0 ] =0x0f ;/* copy it for automute */ +snd_hda_jack_detect_enable_callback (codec,0x0f , + snd_hda_gen_hp_automute); +alc_setup_gpio (codec,0x01 ); + } +} + +static void alc260_fixup_kn1 (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +struct alc_spec *spec = codec->spec; +static const struct hda_pintbl pincfgs[] = { + {0x0f ,0x02214000 },/* HP/speaker */ + {0x12 ,0x90a60160 },/* int mic */ + {0x13 ,0x02a19000 },/* ext mic */ + {0x18 ,0x01446000 },/* SPDIF out */ +/* disable bogus I/O pins */ + {0x10 ,0x411111f0 }, + {0x11 ,0x411111f0 }, + {0x14 ,0x411111f0 }, + {0x15 ,0x411111f0 }, + {0x16 ,0x411111f0 }, + {0x17 ,0x411111f0 }, + {0x19 ,0x411111f0 }, + { } + }; + +switch (action) { +case HDA_FIXUP_ACT_PRE_PROBE : +snd_hda_apply_pincfgs (codec, pincfgs); + spec->init_amp =ALC_INIT_NONE ; +break ; + } +} + +static void alc260_fixup_fsc_s7020 (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +struct alc_spec *spec = codec->spec; +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) + spec->init_amp =ALC_INIT_NONE ; +} + +static void alc260_fixup_fsc_s7020_jwse (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +struct alc_spec *spec = codec->spec; +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { + spec->gen.add_jack_modes =1 ; + spec->gen.hp_mic =1 ; + } +} + +static const struct hda_fixup alc260_fixups[] = { + [ALC260_FIXUP_HP_DC5750 ] = { + .type =HDA_FIXUP_PINS , + .v.pins = (const struct hda_pintbl []) { + {0x11 ,0x90130110 },/* speaker */ + { } + } + }, + [ALC260_FIXUP_HP_PIN_0F ] = { + .type =HDA_FIXUP_PINS , + .v.pins = (const struct hda_pintbl []) { + {0x0f ,0x01214000 },/* HP */ + { } + } + }, + [ALC260_FIXUP_COEF ] = { + .type =HDA_FIXUP_VERBS , + .v.verbs = (const struct hda_verb []) { + {0x1a ,AC_VERB_SET_COEF_INDEX ,0x07 }, + {0x1a ,AC_VERB_SET_PROC_COEF ,0x3040 }, + { } + }, + }, + [ALC260_FIXUP_GPIO1 ] = { + .type =HDA_FIXUP_FUNC , + .v.func = alc_fixup_gpio1, + }, + [ALC260_FIXUP_GPIO1_TOGGLE ] = { + .type =HDA_FIXUP_FUNC , + .v.func = alc260_fixup_gpio1_toggle, + .chained = true, + .chain_id =ALC260_FIXUP_HP_PIN_0F , + }, + [ALC260_FIXUP_REPLACER ] = { + .type =HDA_FIXUP_VERBS , + .v.verbs = (const struct hda_verb []) { + {0x1a ,AC_VERB_SET_COEF_INDEX ,0x07 }, + {0x1a ,AC_VERB_SET_PROC_COEF ,0x3050 }, + { } + }, + .chained = true, + .chain_id =ALC260_FIXUP_GPIO1_TOGGLE , + }, + [ALC260_FIXUP_HP_B1900 ] = { + .type =HDA_FIXUP_FUNC , + .v.func = alc260_fixup_gpio1_toggle, + .chained = true, + .chain_id =ALC260_FIXUP_COEF , + }, + [ALC260_FIXUP_KN1 ] = { + .type =HDA_FIXUP_FUNC , + .v.func = alc260_fixup_kn1, + }, + [ALC260_FIXUP_FSC_S7020 ] = { + .type =HDA_FIXUP_FUNC , + .v.func = alc260_fixup_fsc_s7020, + }, + [ALC260_FIXUP_FSC_S7020_JWSE ] = { + .type =HDA_FIXUP_FUNC , + .v.func = alc260_fixup_fsc_s7020_jwse, + .chained = true, + .chain_id =ALC260_FIXUP_FSC_S7020 , + }, + [ALC260_FIXUP_VAIO_PINS ] = { + .type =HDA_FIXUP_PINS , + .v.pins = (const struct hda_pintbl []) { +/* Pin configs are missing completely on some VAIOs */ + {0x0f ,0x01211020 }, + {0x10 ,0x0001003f }, + {0x11 ,0x411111f0 }, + {0x12 ,0x01a15930 }, + {0x13 ,0x411111f0 }, + {0x14 ,0x411111f0 }, + {0x15 ,0x411111f0 }, + {0x16 ,0x411111f0 }, + {0x17 ,0x411111f0 }, + {0x18 ,0x411111f0 }, + {0x19 ,0x411111f0 }, + { } + } + }, +}; + +static const struct hda_quirk alc260_fixup_tbl[] = { +SND_PCI_QUIRK (0x1025 ,0x007b ,"Acer C20x" ,ALC260_FIXUP_GPIO1 ), +SND_PCI_QUIRK (0x1025 ,0x007f ,"Acer Aspire 9500" ,ALC260_FIXUP_COEF ), +SND_PCI_QUIRK (0x1025 ,0x008f ,"Acer" ,ALC260_FIXUP_GPIO1 ), +SND_PCI_QUIRK (0x103c ,0x280a ,"HP dc5750" ,ALC260_FIXUP_HP_DC5750 ), +SND_PCI_QUIRK (0x103c ,0x30ba ,"HP Presario B1900" ,ALC260_FIXUP_HP_B1900 ), +SND_PCI_QUIRK (0x104d ,0x81bb ,"Sony VAIO" ,ALC260_FIXUP_VAIO_PINS ), +SND_PCI_QUIRK (0x104d ,0x81e2 ,"Sony VAIO TX" ,ALC260_FIXUP_HP_PIN_0F ), +SND_PCI_QUIRK (0x10cf ,0x1326 ,"FSC LifeBook S7020" ,ALC260_FIXUP_FSC_S7020 ), +SND_PCI_QUIRK (0x1509 ,0x4540 ,"Favorit 100XS" ,ALC260_FIXUP_GPIO1 ), +SND_PCI_QUIRK (0x152d ,0x0729 ,"Quanta KN1" ,ALC260_FIXUP_KN1 ), +SND_PCI_QUIRK (0x161f ,0x2057 ,"Replacer 672V" ,ALC260_FIXUP_REPLACER ), +SND_PCI_QUIRK (0x1631 ,0xc017 ,"PB V7900" ,ALC260_FIXUP_COEF ), + {} +}; + +static const struct hda_model_fixup alc260_fixup_models[] = { + {.id =ALC260_FIXUP_GPIO1 , .name ="gpio1" }, + {.id =ALC260_FIXUP_COEF , .name ="coef" }, + {.id =ALC260_FIXUP_FSC_S7020 , .name ="fujitsu" }, + {.id =ALC260_FIXUP_FSC_S7020_JWSE , .name ="fujitsu-jwse" }, + {} +}; + +/* +*/ +static int patch_alc260 (struct hda_codec *codec) +{ +struct alc_spec *spec; +int err; + + err =alc_alloc_spec (codec,0x07 ); +if (err <0 ) +return err; + + spec = codec->spec; +/* as quite a few machines require HP amp for speaker outputs, +* it's easier to enable it unconditionally; even if it's unneeded, +* it's almost harmless. +*/ + spec->gen.prefer_hp_amp =1 ; + spec->gen.beep_nid =0x01 ; + + spec->shutup = alc_eapd_shutup; + +alc_pre_init (codec); + +snd_hda_pick_fixup (codec, alc260_fixup_models, alc260_fixup_tbl, + alc260_fixups); +snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PRE_PROBE ); + +/* automatic parse from the BIOS config */ + err =alc260_parse_auto_config (codec); +if (err <0 ) + goto error; + +if (!spec->gen.no_analog) { + err =set_beep_amp (spec,0x07 ,0x05 ,HDA_INPUT ); +if (err <0 ) + goto error; + } + +snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PROBE ); + +return 0 ; + + error: +alc_free (codec); +return err; +} + +/* +* driver entries +*/ +static const struct hda_device_id snd_hda_id_alc260[] = { +HDA_CODEC_ENTRY (0x10ec0260 ,"ALC260" , patch_alc260), + {}/* terminator */ +}; +MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_alc260); + +MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("Realtek ALC260 HD-audio codec" ); +MODULE_IMPORT_NS ("SND_HDA_CODEC_REALTEK" ); + +static struct hda_codec_driver alc260_driver = { + .id = snd_hda_id_alc260, +}; + +module_hda_codec_driver (alc260_driver);sound/hda/codecs/realtek/alc262.c new file +199
-0@@ -0,0 +1,199 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// +// Realtek ALC262 codec +// + +#include <linux/init.h> +#include <linux/module.h> +#include "realtek.h" + +static int alc262_parse_auto_config (struct hda_codec *codec) +{ +static const hda_nid_t alc262_ignore[] = {0x1d ,0 }; +static const hda_nid_t alc262_ssids[] = {0x15 ,0x1b ,0x14 ,0 }; +return alc_parse_auto_config (codec, alc262_ignore, alc262_ssids); +} + +/* +* Pin config fixes +*/ +enum { +ALC262_FIXUP_FSC_H270 , +ALC262_FIXUP_FSC_S7110 , +ALC262_FIXUP_HP_Z200 , +ALC262_FIXUP_TYAN , +ALC262_FIXUP_LENOVO_3000 , +ALC262_FIXUP_BENQ , +ALC262_FIXUP_BENQ_T31 , +ALC262_FIXUP_INV_DMIC , +ALC262_FIXUP_INTEL_BAYLEYBAY , +}; + +static const struct hda_fixup alc262_fixups[] = { + [ALC262_FIXUP_FSC_H270 ] = { + .type =HDA_FIXUP_PINS , + .v.pins = (const struct hda_pintbl []) { + {0x14 ,0x99130110 },/* speaker */ + {0x15 ,0x0221142f },/* front HP */ + {0x1b ,0x0121141f },/* rear HP */ + { } + } + }, + [ALC262_FIXUP_FSC_S7110 ] = { + .type =HDA_FIXUP_PINS , + .v.pins = (const struct hda_pintbl []) { + {0x15 ,0x90170110 },/* speaker */ + { } + }, + .chained = true, + .chain_id =ALC262_FIXUP_BENQ , + }, + [ALC262_FIXUP_HP_Z200 ] = { + .type =HDA_FIXUP_PINS , + .v.pins = (const struct hda_pintbl []) { + {0x16 ,0x99130120 },/* internal speaker */ + { } + } + }, + [ALC262_FIXUP_TYAN ] = { + .type =HDA_FIXUP_PINS , + .v.pins = (const struct hda_pintbl []) { + {0x14 ,0x1993e1f0 },/* int AUX */ + { } + } + }, + [ALC262_FIXUP_LENOVO_3000 ] = { + .type =HDA_FIXUP_PINCTLS , + .v.pins = (const struct hda_pintbl []) { + {0x19 ,PIN_VREF50 }, + {} + }, + .chained = true, + .chain_id =ALC262_FIXUP_BENQ , + }, + [ALC262_FIXUP_BENQ ] = { + .type =HDA_FIXUP_VERBS , + .v.verbs = (const struct hda_verb []) { + {0x20 ,AC_VERB_SET_COEF_INDEX ,0x07 }, + {0x20 ,AC_VERB_SET_PROC_COEF ,0x3070 }, + {} + } + }, + [ALC262_FIXUP_BENQ_T31 ] = { + .type =HDA_FIXUP_VERBS , + .v.verbs = (const struct hda_verb []) { + {0x20 ,AC_VERB_SET_COEF_INDEX ,0x07 }, + {0x20 ,AC_VERB_SET_PROC_COEF ,0x3050 }, + {} + } + }, + [ALC262_FIXUP_INV_DMIC ] = { + .type =HDA_FIXUP_FUNC , + .v.func = alc_fixup_inv_dmic, + }, + [ALC262_FIXUP_INTEL_BAYLEYBAY ] = { + .type =HDA_FIXUP_FUNC , + .v.func = alc_fixup_no_depop_delay, + }, +}; + +static const struct hda_quirk alc262_fixup_tbl[] = { +SND_PCI_QUIRK (0x103c ,0x170b ,"HP Z200" ,ALC262_FIXUP_HP_Z200 ), +SND_PCI_QUIRK (0x10cf ,0x1397 ,"Fujitsu Lifebook S7110" ,ALC262_FIXUP_FSC_S7110 ), +SND_PCI_QUIRK (0x10cf ,0x142d ,"Fujitsu Lifebook E8410" ,ALC262_FIXUP_BENQ ), +SND_PCI_QUIRK (0x10f1 ,0x2915 ,"Tyan Thunder n6650W" ,ALC262_FIXUP_TYAN ), +SND_PCI_QUIRK (0x1734 ,0x1141 ,"FSC ESPRIMO U9210" ,ALC262_FIXUP_FSC_H270 ), +SND_PCI_QUIRK (0x1734 ,0x1147 ,"FSC Celsius H270" ,ALC262_FIXUP_FSC_H270 ), +SND_PCI_QUIRK (0x17aa ,0x384e ,"Lenovo 3000" ,ALC262_FIXUP_LENOVO_3000 ), +SND_PCI_QUIRK (0x17ff ,0x0560 ,"Benq ED8" ,ALC262_FIXUP_BENQ ), +SND_PCI_QUIRK (0x17ff ,0x058d ,"Benq T31-16" ,ALC262_FIXUP_BENQ_T31 ), +SND_PCI_QUIRK (0x8086 ,0x7270 ,"BayleyBay" ,ALC262_FIXUP_INTEL_BAYLEYBAY ), + {} +}; + +static const struct hda_model_fixup alc262_fixup_models[] = { + {.id =ALC262_FIXUP_INV_DMIC , .name ="inv-dmic" }, + {.id =ALC262_FIXUP_FSC_H270 , .name ="fsc-h270" }, + {.id =ALC262_FIXUP_FSC_S7110 , .name ="fsc-s7110" }, + {.id =ALC262_FIXUP_HP_Z200 , .name ="hp-z200" }, + {.id =ALC262_FIXUP_TYAN , .name ="tyan" }, + {.id =ALC262_FIXUP_LENOVO_3000 , .name ="lenovo-3000" }, + {.id =ALC262_FIXUP_BENQ , .name ="benq" }, + {.id =ALC262_FIXUP_BENQ_T31 , .name ="benq-t31" }, + {.id =ALC262_FIXUP_INTEL_BAYLEYBAY , .name ="bayleybay" }, + {} +}; + +/* +*/ +static int patch_alc262 (struct hda_codec *codec) +{ +struct alc_spec *spec; +int err; + + err =alc_alloc_spec (codec,0x0b ); +if (err <0 ) +return err; + + spec = codec->spec; + spec->gen.shared_mic_vref_pin =0x18 ; + + spec->shutup = alc_eapd_shutup; + +#if 0 +/* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is +* under-run +*/ +alc_update_coefex_idx (codec,0x1a ,7 ,0 ,0x80 ); +#endif +alc_fix_pll_init (codec,0x20 ,0x0a ,10 ); + +alc_pre_init (codec); + +snd_hda_pick_fixup (codec, alc262_fixup_models, alc262_fixup_tbl, + alc262_fixups); +snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PRE_PROBE ); + +alc_auto_parse_customize_define (codec); + +if (has_cdefine_beep (codec)) + spec->gen.beep_nid =0x01 ; + +/* automatic parse from the BIOS config */ + err =alc262_parse_auto_config (codec); +if (err <0 ) + goto error; + +if (!spec->gen.no_analog && spec->gen.beep_nid) { + err =set_beep_amp (spec,0x0b ,0x05 ,HDA_INPUT ); +if (err <0 ) + goto error; + } + +snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PROBE ); + +return 0 ; + + error: +alc_free (codec); +return err; +} + +/* +* driver entries +*/ +static const struct hda_device_id snd_hda_id_alc262[] = { +HDA_CODEC_ENTRY (0x10ec0262 ,"ALC262" , patch_alc262), + {}/* terminator */ +}; +MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_alc262); + +MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("Realtek ALC262 HD-audio codec" ); +MODULE_IMPORT_NS ("SND_HDA_CODEC_REALTEK" ); + +static struct hda_codec_driver alc262_driver = { + .id = snd_hda_id_alc262, +}; + +module_hda_codec_driver (alc262_driver);sound/hda/codecs/realtek/alc268.c new file +176
-0@@ -0,0 +1,176 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include <linux/init.h> +#include <linux/module.h> +#include "realtek.h" + +/* bind Beep switches of both NID 0x0f and 0x10 */ +static int alc268_beep_switch_put (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol) +{ +struct hda_codec *codec =snd_kcontrol_chip (kcontrol); +unsigned long pval; +int err; + +mutex_lock (&codec->control_mutex); + pval = kcontrol->private_value; + kcontrol->private_value = (pval & ~0xff ) |0x0f ; + err =snd_hda_mixer_amp_switch_put (kcontrol, ucontrol); +if (err >=0 ) { + kcontrol->private_value = (pval & ~0xff ) |0x10 ; + err =snd_hda_mixer_amp_switch_put (kcontrol, ucontrol); + } + kcontrol->private_value = pval; +mutex_unlock (&codec->control_mutex); +return err; +} + +static const struct snd_kcontrol_new alc268_beep_mixer[] = { +HDA_CODEC_VOLUME ("Beep Playback Volume" ,0x1d ,0x0 ,HDA_INPUT ), + { + .iface =SNDRV_CTL_ELEM_IFACE_MIXER , + .name ="Beep Playback Switch" , + .subdevice =HDA_SUBDEV_AMP_FLAG , + .info = snd_hda_mixer_amp_switch_info, + .get = snd_hda_mixer_amp_switch_get, + .put = alc268_beep_switch_put, + .private_value =HDA_COMPOSE_AMP_VAL (0x0f ,3 ,1 ,HDA_INPUT ) + }, +}; + +/* set PCBEEP vol = 0, mute connections */ +static const struct hda_verb alc268_beep_init_verbs[] = { + {0x1d ,AC_VERB_SET_AMP_GAIN_MUTE ,AMP_IN_UNMUTE (0 )}, + {0x0f ,AC_VERB_SET_AMP_GAIN_MUTE ,AMP_IN_MUTE (1 )}, + {0x10 ,AC_VERB_SET_AMP_GAIN_MUTE ,AMP_IN_MUTE (1 )}, + { } +}; + +enum { +ALC268_FIXUP_INV_DMIC , +ALC268_FIXUP_HP_EAPD , +ALC268_FIXUP_SPDIF , +}; + +static const struct hda_fixup alc268_fixups[] = { + [ALC268_FIXUP_INV_DMIC ] = { + .type =HDA_FIXUP_FUNC , + .v.func = alc_fixup_inv_dmic, + }, + [ALC268_FIXUP_HP_EAPD ] = { + .type =HDA_FIXUP_VERBS , + .v.verbs = (const struct hda_verb []) { + {0x15 ,AC_VERB_SET_EAPD_BTLENABLE ,0 }, + {} + } + }, + [ALC268_FIXUP_SPDIF ] = { + .type =HDA_FIXUP_PINS , + .v.pins = (const struct hda_pintbl []) { + {0x1e ,0x014b1180 },/* enable SPDIF out */ + {} + } + }, +}; + +static const struct hda_model_fixup alc268_fixup_models[] = { + {.id =ALC268_FIXUP_INV_DMIC , .name ="inv-dmic" }, + {.id =ALC268_FIXUP_HP_EAPD , .name ="hp-eapd" }, + {.id =ALC268_FIXUP_SPDIF , .name ="spdif" }, + {} +}; + +static const struct hda_quirk alc268_fixup_tbl[] = { +SND_PCI_QUIRK (0x1025 ,0x0139 ,"Acer TravelMate 6293" ,ALC268_FIXUP_SPDIF ), +SND_PCI_QUIRK (0x1025 ,0x015b ,"Acer AOA 150 (ZG5)" ,ALC268_FIXUP_INV_DMIC ), +/* below is codec SSID since multiple Toshiba laptops have the +* same PCI SSID 1179:ff00 +*/ +SND_PCI_QUIRK (0x1179 ,0xff06 ,"Toshiba P200" ,ALC268_FIXUP_HP_EAPD ), + {} +}; + +/* +* BIOS auto configuration +*/ +static int alc268_parse_auto_config (struct hda_codec *codec) +{ +static const hda_nid_t alc268_ssids[] = {0x15 ,0x1b ,0x14 ,0 }; +return alc_parse_auto_config (codec,NULL , alc268_ssids); +} + +/* +*/ +static int patch_alc268 (struct hda_codec *codec) +{ +struct alc_spec *spec; +int i, err; + +/* ALC268 has no aa-loopback mixer */ + err =alc_alloc_spec (codec,0 ); +if (err <0 ) +return err; + + spec = codec->spec; +if (has_cdefine_beep (codec)) + spec->gen.beep_nid =0x01 ; + + spec->shutup = alc_eapd_shutup; + +alc_pre_init (codec); + +snd_hda_pick_fixup (codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups); +snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PRE_PROBE ); + +/* automatic parse from the BIOS config */ + err =alc268_parse_auto_config (codec); +if (err <0 ) + goto error; + +if (err >0 && !spec->gen.no_analog && + spec->gen.autocfg.speaker_pins[0 ] !=0x1d ) { +for (i =0 ; i <ARRAY_SIZE (alc268_beep_mixer); i++) { +if (!snd_hda_gen_add_kctl (&spec->gen,NULL , + &alc268_beep_mixer[i])) { + err = -ENOMEM ; + goto error; + } + } +snd_hda_add_verbs (codec, alc268_beep_init_verbs); +if (!query_amp_caps (codec,0x1d ,HDA_INPUT )) +/* override the amp caps for beep generator */ +snd_hda_override_amp_caps (codec,0x1d ,HDA_INPUT , + (0x0c <<AC_AMPCAP_OFFSET_SHIFT ) | + (0x0c <<AC_AMPCAP_NUM_STEPS_SHIFT ) | + (0x07 <<AC_AMPCAP_STEP_SIZE_SHIFT ) | + (0 <<AC_AMPCAP_MUTE_SHIFT )); + } + +snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PROBE ); + +return 0 ; + + error: +alc_free (codec); +return err; +} + +/* +* driver entries +*/ +static const struct hda_device_id snd_hda_id_alc268[] = { +HDA_CODEC_ENTRY (0x10ec0267 ,"ALC267" , patch_alc268), +HDA_CODEC_ENTRY (0x10ec0268 ,"ALC268" , patch_alc268), + {}/* terminator */ +}; +MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_alc268); + +MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("Realtek ALC267/268 HD-audio codec" ); +MODULE_IMPORT_NS ("SND_HDA_CODEC_REALTEK" ); + +static struct hda_codec_driver alc268_driver = { + .id = snd_hda_id_alc268, +}; + +module_hda_codec_driver (alc268_driver);sound/hda/codecs/realtek/alc269.c renamed from sound/hda/codecs/realtek.c +33
-5694@@ -1,3160 +1,15 @@// SPDX-License-Identifier: GPL-2.0-or-later -/* -* Universal Interface for Intel High Definition Audio Codec -* -* HD audio interface patch for Realtek ALC codecs -* -* Copyright (c) 2004 Kailang Yang <[email protected]> -* PeiSen Hou <[email protected]> -* Takashi Iwai <[email protected]> -* Jonathan Woithe <[email protected]> -*/ +// +// Realtek ALC269 and compatible codecs +// -#include <linux/acpi.h> -#include <linux/cleanup.h> #include <linux/init.h> -#include <linux/delay.h> -#include <linux/slab.h> -#include <linux/pci.h> -#include <linux/dmi.h> #include <linux/module.h> -#include <linux/i2c.h> -#include <linux/input.h> -#include <linux/leds.h> -#include <linux/ctype.h> -#include <linux/spi/spi.h> -#include <sound/core.h> -#include <sound/jack.h> -#include <sound/hda_codec.h> -#include "hda_local.h" -#include "hda_auto_parser.h" -#include "hda_beep.h" -#include "hda_jack.h" -#include "generic.h" -#include "side-codecs/hda_component.h" +#include "realtek.h" /* keep halting ALC5505 DSP, for power saving */ #define HALT_REALTEK_ALC5505 -/* extra amp-initialization sequence types */ -enum { -ALC_INIT_UNDEFINED , -ALC_INIT_NONE , -ALC_INIT_DEFAULT , -}; - -enum { -ALC_HEADSET_MODE_UNKNOWN , -ALC_HEADSET_MODE_UNPLUGGED , -ALC_HEADSET_MODE_HEADSET , -ALC_HEADSET_MODE_MIC , -ALC_HEADSET_MODE_HEADPHONE , -}; - -enum { -ALC_HEADSET_TYPE_UNKNOWN , -ALC_HEADSET_TYPE_CTIA , -ALC_HEADSET_TYPE_OMTP , -}; - -enum { -ALC_KEY_MICMUTE_INDEX , -}; - -struct alc_customize_define { -unsigned int sku_cfg; -unsigned char port_connectivity; -unsigned char check_sum; -unsigned char customization; -unsigned char external_amp; -unsigned int enable_pcbeep:1 ; -unsigned int platform_type:1 ; -unsigned int swap:1 ; -unsigned int override:1 ; -unsigned int fixup:1 ;/* Means that this sku is set by driver, not read from hw */ -}; - -struct alc_coef_led { -unsigned int idx; -unsigned int mask; -unsigned int on; -unsigned int off; -}; - -struct alc_spec { -struct hda_gen_spec gen;/* must be at head */ - -/* codec parameterization */ -struct alc_customize_define cdefine; -unsigned int parse_flags;/* flag for snd_hda_parse_pin_defcfg() */ - -/* GPIO bits */ -unsigned int gpio_mask; -unsigned int gpio_dir; -unsigned int gpio_data; -bool gpio_write_delay;/* add a delay before writing gpio_data */ - -/* mute LED for HP laptops, see vref_mute_led_set() */ -int mute_led_polarity; -int micmute_led_polarity; -hda_nid_t mute_led_nid; -hda_nid_t cap_mute_led_nid; - -unsigned int gpio_mute_led_mask; -unsigned int gpio_mic_led_mask; -struct alc_coef_led mute_led_coef; -struct alc_coef_led mic_led_coef; -struct mutex coef_mutex; - -hda_nid_t headset_mic_pin; -hda_nid_t headphone_mic_pin; -int current_headset_mode; -int current_headset_type; - -/* hooks */ -void (*init_hook)(struct hda_codec *codec); -void (*power_hook)(struct hda_codec *codec); -void (*shutup)(struct hda_codec *codec); - -int init_amp; -int codec_variant;/* flag for other variants */ -unsigned int has_alc5505_dsp:1 ; -unsigned int no_depop_delay:1 ; -unsigned int done_hp_init:1 ; -unsigned int no_shutup_pins:1 ; -unsigned int ultra_low_power:1 ; -unsigned int has_hs_key:1 ; -unsigned int no_internal_mic_pin:1 ; -unsigned int en_3kpull_low:1 ; -int num_speaker_amps; - -/* for PLL fix */ -hda_nid_t pll_nid; -unsigned int pll_coef_idx, pll_coef_bit; -unsigned int coef0; -struct input_dev *kb_dev; -u8 alc_mute_keycode_map[1 ]; - -/* component binding */ -struct hda_component_parent comps; -}; - -/* -* COEF access helper functions -*/ - -static void coef_mutex_lock (struct hda_codec *codec) -{ -struct alc_spec *spec = codec->spec; - -snd_hda_power_up_pm (codec); -mutex_lock (&spec->coef_mutex); -} - -static void coef_mutex_unlock (struct hda_codec *codec) -{ -struct alc_spec *spec = codec->spec; - -mutex_unlock (&spec->coef_mutex); -snd_hda_power_down_pm (codec); -} - -static int __alc_read_coefex_idx (struct hda_codec *codec,hda_nid_t nid, -unsigned int coef_idx) -{ -unsigned int val; - -snd_hda_codec_write (codec, nid,0 ,AC_VERB_SET_COEF_INDEX , coef_idx); - val =snd_hda_codec_read (codec, nid,0 ,AC_VERB_GET_PROC_COEF ,0 ); -return val; -} - -static int alc_read_coefex_idx (struct hda_codec *codec,hda_nid_t nid, -unsigned int coef_idx) -{ -unsigned int val; - -coef_mutex_lock (codec); - val =__alc_read_coefex_idx (codec, nid, coef_idx); -coef_mutex_unlock (codec); -return val; -} - -#define alc_read_coef_idx (codec, coef_idx) \ - alc_read_coefex_idx(codec, 0x20, coef_idx) - -static void __alc_write_coefex_idx (struct hda_codec *codec,hda_nid_t nid, -unsigned int coef_idx,unsigned int coef_val) -{ -snd_hda_codec_write (codec, nid,0 ,AC_VERB_SET_COEF_INDEX , coef_idx); -snd_hda_codec_write (codec, nid,0 ,AC_VERB_SET_PROC_COEF , coef_val); -} - -static void alc_write_coefex_idx (struct hda_codec *codec,hda_nid_t nid, -unsigned int coef_idx,unsigned int coef_val) -{ -coef_mutex_lock (codec); -__alc_write_coefex_idx (codec, nid, coef_idx, coef_val); -coef_mutex_unlock (codec); -} - -#define alc_write_coef_idx (codec, coef_idx, coef_val) \ - alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val) - -static void __alc_update_coefex_idx (struct hda_codec *codec,hda_nid_t nid, -unsigned int coef_idx,unsigned int mask, -unsigned int bits_set) -{ -unsigned int val =__alc_read_coefex_idx (codec, nid, coef_idx); - -if (val !=-1 ) -__alc_write_coefex_idx (codec, nid, coef_idx, - (val & ~mask) | bits_set); -} - -static void alc_update_coefex_idx (struct hda_codec *codec,hda_nid_t nid, -unsigned int coef_idx,unsigned int mask, -unsigned int bits_set) -{ -coef_mutex_lock (codec); -__alc_update_coefex_idx (codec, nid, coef_idx, mask, bits_set); -coef_mutex_unlock (codec); -} - -#define alc_update_coef_idx (codec, coef_idx, mask, bits_set) \ - alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set) - -/* a special bypass for COEF 0; read the cached value at the second time */ -static unsigned int alc_get_coef0 (struct hda_codec *codec) -{ -struct alc_spec *spec = codec->spec; - -if (!spec->coef0) - spec->coef0 =alc_read_coef_idx (codec,0 ); -return spec->coef0; -} - -/* coef writes/updates batch */ -struct coef_fw { -unsigned char nid; -unsigned char idx; -unsigned short mask; -unsigned short val; -}; - -#define UPDATE_COEFEX (_nid, _idx, _mask, _val) \ - { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) } -#define WRITE_COEFEX (_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val) -#define WRITE_COEF (_idx, _val) WRITE_COEFEX(0x20, _idx, _val) -#define UPDATE_COEF (_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val) - -static void alc_process_coef_fw (struct hda_codec *codec, -const struct coef_fw *fw) -{ -coef_mutex_lock (codec); -for (; fw->nid; fw++) { -if (fw->mask == (unsigned short )-1 ) -__alc_write_coefex_idx (codec, fw->nid, fw->idx, fw->val); -else -__alc_update_coefex_idx (codec, fw->nid, fw->idx, - fw->mask, fw->val); - } -coef_mutex_unlock (codec); -} - -/* -* GPIO setup tables, used in initialization -*/ - -/* Enable GPIO mask and set output */ -static void alc_setup_gpio (struct hda_codec *codec,unsigned int mask) -{ -struct alc_spec *spec = codec->spec; - - spec->gpio_mask |= mask; - spec->gpio_dir |= mask; - spec->gpio_data |= mask; -} - -static void alc_write_gpio_data (struct hda_codec *codec) -{ -struct alc_spec *spec = codec->spec; - -snd_hda_codec_write (codec,0x01 ,0 ,AC_VERB_SET_GPIO_DATA , - spec->gpio_data); -} - -static void alc_update_gpio_data (struct hda_codec *codec,unsigned int mask, -bool on) -{ -struct alc_spec *spec = codec->spec; -unsigned int oldval = spec->gpio_data; - -if (on) - spec->gpio_data |= mask; -else - spec->gpio_data &= ~mask; -if (oldval != spec->gpio_data) -alc_write_gpio_data (codec); -} - -static void alc_write_gpio (struct hda_codec *codec) -{ -struct alc_spec *spec = codec->spec; - -if (!spec->gpio_mask) -return ; - -snd_hda_codec_write (codec, codec->core.afg,0 , -AC_VERB_SET_GPIO_MASK , spec->gpio_mask); -snd_hda_codec_write (codec, codec->core.afg,0 , -AC_VERB_SET_GPIO_DIRECTION , spec->gpio_dir); -if (spec->gpio_write_delay) -msleep (1 ); -alc_write_gpio_data (codec); -} - -static void alc_fixup_gpio (struct hda_codec *codec,int action, -unsigned int mask) -{ -if (action ==HDA_FIXUP_ACT_PRE_PROBE ) -alc_setup_gpio (codec, mask); -} - -static void alc_fixup_gpio1 (struct hda_codec *codec, -const struct hda_fixup *fix,int action) -{ -alc_fixup_gpio (codec, action,0x01 ); -} - -static void alc_fixup_gpio2 (struct hda_codec *codec, -const struct hda_fixup *fix,int action) -{ -alc_fixup_gpio (codec, action,0x02 ); -} - -static void alc_fixup_gpio3 (struct hda_codec *codec, -const struct hda_fixup *fix,int action) -{ -alc_fixup_gpio (codec, action,0x03 ); -} - -static void alc_fixup_gpio4 (struct hda_codec *codec, -const struct hda_fixup *fix,int action) -{ -alc_fixup_gpio (codec, action,0x04 ); -} - -static void alc_fixup_micmute_led (struct hda_codec *codec, -const struct hda_fixup *fix,int action) -{ -if (action ==HDA_FIXUP_ACT_PRE_PROBE ) -snd_hda_gen_add_micmute_led_cdev (codec,NULL ); -} - -/* -* Fix hardware PLL issue -* On some codecs, the analog PLL gating control must be off while -* the default value is 1. -*/ -static void alc_fix_pll (struct hda_codec *codec) -{ -struct alc_spec *spec = codec->spec; - -if (spec->pll_nid) -alc_update_coefex_idx (codec, spec->pll_nid, spec->pll_coef_idx, -1 << spec->pll_coef_bit,0 ); -} - -static void alc_fix_pll_init (struct hda_codec *codec,hda_nid_t nid, -unsigned int coef_idx,unsigned int coef_bit) -{ -struct alc_spec *spec = codec->spec; - spec->pll_nid = nid; - spec->pll_coef_idx = coef_idx; - spec->pll_coef_bit = coef_bit; -alc_fix_pll (codec); -} - -/* update the master volume per volume-knob's unsol event */ -static void alc_update_knob_master (struct hda_codec *codec, -struct hda_jack_callback *jack) -{ -unsigned int val; -struct snd_kcontrol *kctl; -struct snd_ctl_elem_value *uctl; - - kctl =snd_hda_find_mixer_ctl (codec,"Master Playback Volume" ); -if (!kctl) -return ; - uctl =kzalloc (sizeof (*uctl),GFP_KERNEL ); -if (!uctl) -return ; - val =snd_hda_codec_read (codec, jack->nid,0 , -AC_VERB_GET_VOLUME_KNOB_CONTROL ,0 ); - val &=HDA_AMP_VOLMASK ; - uctl->value.integer.value[0 ] = val; - uctl->value.integer.value[1 ] = val; - kctl->put (kctl, uctl); -kfree (uctl); -} - -static void alc880_unsol_event (struct hda_codec *codec,unsigned int res) -{ -/* For some reason, the res given from ALC880 is broken. -Here we adjust it properly. */ -snd_hda_jack_unsol_event (codec, res >>2 ); -} - -/* Change EAPD to verb control */ -static void alc_fill_eapd_coef (struct hda_codec *codec) -{ -int coef; - - coef =alc_get_coef0 (codec); - -switch (codec->core.vendor_id) { -case 0x10ec0262 : -alc_update_coef_idx (codec,0x7 ,0 ,1 <<5 ); -break ; -case 0x10ec0267 : -case 0x10ec0268 : -alc_update_coef_idx (codec,0x7 ,0 ,1 <<13 ); -break ; -case 0x10ec0269 : -if ((coef &0x00f0 ) ==0x0010 ) -alc_update_coef_idx (codec,0xd ,0 ,1 <<14 ); -if ((coef &0x00f0 ) ==0x0020 ) -alc_update_coef_idx (codec,0x4 ,1 <<15 ,0 ); -if ((coef &0x00f0 ) ==0x0030 ) -alc_update_coef_idx (codec,0x10 ,1 <<9 ,0 ); -break ; -case 0x10ec0280 : -case 0x10ec0284 : -case 0x10ec0290 : -case 0x10ec0292 : -alc_update_coef_idx (codec,0x4 ,1 <<15 ,0 ); -break ; -case 0x10ec0225 : -case 0x10ec0295 : -case 0x10ec0299 : -alc_update_coef_idx (codec,0x67 ,0xf000 ,0x3000 ); - fallthrough; -case 0x10ec0215 : -case 0x10ec0236 : -case 0x10ec0245 : -case 0x10ec0256 : -case 0x10ec0257 : -case 0x10ec0285 : -case 0x10ec0289 : -alc_update_coef_idx (codec,0x36 ,1 <<13 ,0 ); - fallthrough; -case 0x10ec0230 : -case 0x10ec0233 : -case 0x10ec0235 : -case 0x10ec0255 : -case 0x19e58326 : -case 0x10ec0282 : -case 0x10ec0283 : -case 0x10ec0286 : -case 0x10ec0288 : -case 0x10ec0298 : -case 0x10ec0300 : -alc_update_coef_idx (codec,0x10 ,1 <<9 ,0 ); -break ; -case 0x10ec0275 : -alc_update_coef_idx (codec,0xe ,0 ,1 <<0 ); -break ; -case 0x10ec0287 : -alc_update_coef_idx (codec,0x10 ,1 <<9 ,0 ); -alc_write_coef_idx (codec,0x8 ,0x4ab7 ); -break ; -case 0x10ec0293 : -alc_update_coef_idx (codec,0xa ,1 <<13 ,0 ); -break ; -case 0x10ec0234 : -case 0x10ec0274 : -alc_write_coef_idx (codec,0x6e ,0x0c25 ); - fallthrough; -case 0x10ec0294 : -case 0x10ec0700 : -case 0x10ec0701 : -case 0x10ec0703 : -case 0x10ec0711 : -alc_update_coef_idx (codec,0x10 ,1 <<15 ,0 ); -break ; -case 0x10ec0662 : -if ((coef &0x00f0 ) ==0x0030 ) -alc_update_coef_idx (codec,0x4 ,1 <<10 ,0 );/* EAPD Ctrl */ -break ; -case 0x10ec0272 : -case 0x10ec0273 : -case 0x10ec0663 : -case 0x10ec0665 : -case 0x10ec0670 : -case 0x10ec0671 : -case 0x10ec0672 : -alc_update_coef_idx (codec,0xd ,0 ,1 <<14 );/* EAPD Ctrl */ -break ; -case 0x10ec0222 : -case 0x10ec0623 : -alc_update_coef_idx (codec,0x19 ,1 <<13 ,0 ); -break ; -case 0x10ec0668 : -alc_update_coef_idx (codec,0x7 ,3 <<13 ,0 ); -break ; -case 0x10ec0867 : -alc_update_coef_idx (codec,0x4 ,1 <<10 ,0 ); -break ; -case 0x10ec0888 : -if ((coef &0x00f0 ) ==0x0020 || (coef &0x00f0 ) ==0x0030 ) -alc_update_coef_idx (codec,0x7 ,1 <<5 ,0 ); -break ; -case 0x10ec0892 : -case 0x10ec0897 : -alc_update_coef_idx (codec,0x7 ,1 <<5 ,0 ); -break ; -case 0x10ec0899 : -case 0x10ec0900 : -case 0x10ec0b00 : -case 0x10ec1168 : -case 0x10ec1220 : -alc_update_coef_idx (codec,0x7 ,1 <<1 ,0 ); -break ; - } -} - -/* additional initialization for ALC888 variants */ -static void alc888_coef_init (struct hda_codec *codec) -{ -switch (alc_get_coef0 (codec) &0x00f0 ) { -/* alc888-VA */ -case 0x00 : -/* alc888-VB */ -case 0x10 : -alc_update_coef_idx (codec,7 ,0 ,0x2030 );/* Turn EAPD to High */ -break ; - } -} - -/* turn on/off EAPD control (only if available) */ -static void set_eapd (struct hda_codec *codec,hda_nid_t nid,int on) -{ -if (get_wcaps_type (get_wcaps (codec, nid)) !=AC_WID_PIN ) -return ; -if (snd_hda_query_pin_caps (codec, nid) &AC_PINCAP_EAPD ) -snd_hda_codec_write (codec, nid,0 ,AC_VERB_SET_EAPD_BTLENABLE , - on ?2 :0 ); -} - -/* turn on/off EAPD controls of the codec */ -static void alc_auto_setup_eapd (struct hda_codec *codec,bool on) -{ -/* We currently only handle front, HP */ -static const hda_nid_t pins[] = { -0x0f ,0x10 ,0x14 ,0x15 ,0x17 ,0 - }; -const hda_nid_t *p; -for (p = pins; *p; p++) -set_eapd (codec, *p, on); -} - -static int find_ext_mic_pin (struct hda_codec *codec); - -static void alc_headset_mic_no_shutup (struct hda_codec *codec) -{ -const struct hda_pincfg *pin; -int mic_pin =find_ext_mic_pin (codec); -int i; - -/* don't shut up pins when unloading the driver; otherwise it breaks -* the default pin setup at the next load of the driver -*/ -if (codec->bus->shutdown) -return ; - -snd_array_for_each (&codec->init_pins, i, pin) { -/* use read here for syncing after issuing each verb */ -if (pin->nid != mic_pin) -snd_hda_codec_read (codec, pin->nid,0 , -AC_VERB_SET_PIN_WIDGET_CONTROL ,0 ); - } - - codec->pins_shutup =1 ; -} - -static void alc_shutup_pins (struct hda_codec *codec) -{ -struct alc_spec *spec = codec->spec; - -if (spec->no_shutup_pins) -return ; - -switch (codec->core.vendor_id) { -case 0x10ec0236 : -case 0x10ec0256 : -case 0x10ec0257 : -case 0x19e58326 : -case 0x10ec0283 : -case 0x10ec0285 : -case 0x10ec0286 : -case 0x10ec0287 : -case 0x10ec0288 : -case 0x10ec0295 : -case 0x10ec0298 : -alc_headset_mic_no_shutup (codec); -break ; -default : -snd_hda_shutup_pins (codec); -break ; - } -} - -/* generic shutup callback; -* just turning off EAPD and a little pause for avoiding pop-noise -*/ -static void alc_eapd_shutup (struct hda_codec *codec) -{ -struct alc_spec *spec = codec->spec; - -alc_auto_setup_eapd (codec, false); -if (!spec->no_depop_delay) -msleep (200 ); -alc_shutup_pins (codec); -} - -/* generic EAPD initialization */ -static void alc_auto_init_amp (struct hda_codec *codec,int type) -{ -alc_auto_setup_eapd (codec, true); -alc_write_gpio (codec); -switch (type) { -case ALC_INIT_DEFAULT : -switch (codec->core.vendor_id) { -case 0x10ec0260 : -alc_update_coefex_idx (codec,0x1a ,7 ,0 ,0x2010 ); -break ; -case 0x10ec0880 : -case 0x10ec0882 : -case 0x10ec0883 : -case 0x10ec0885 : -alc_update_coef_idx (codec,7 ,0 ,0x2030 ); -break ; -case 0x10ec0888 : -alc888_coef_init (codec); -break ; - } -break ; - } -} - -/* get a primary headphone pin if available */ -static hda_nid_t alc_get_hp_pin (struct alc_spec *spec) -{ -if (spec->gen.autocfg.hp_pins[0 ]) -return spec->gen.autocfg.hp_pins[0 ]; -if (spec->gen.autocfg.line_out_type ==AC_JACK_HP_OUT ) -return spec->gen.autocfg.line_out_pins[0 ]; -return 0 ; -} - -/* -* Realtek SSID verification -*/ - -/* Could be any non-zero and even value. When used as fixup, tells -* the driver to ignore any present sku defines. -*/ -#define ALC_FIXUP_SKU_IGNORE (2) - -static void alc_fixup_sku_ignore (struct hda_codec *codec, -const struct hda_fixup *fix,int action) -{ -struct alc_spec *spec = codec->spec; -if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { - spec->cdefine.fixup =1 ; - spec->cdefine.sku_cfg =ALC_FIXUP_SKU_IGNORE ; - } -} - -static void alc_fixup_no_depop_delay (struct hda_codec *codec, -const struct hda_fixup *fix,int action) -{ -struct alc_spec *spec = codec->spec; - -if (action ==HDA_FIXUP_ACT_PROBE ) { - spec->no_depop_delay =1 ; - codec->depop_delay =0 ; - } -} - -static int alc_auto_parse_customize_define (struct hda_codec *codec) -{ -unsigned int ass, tmp, i; -unsigned nid =0 ; -struct alc_spec *spec = codec->spec; - - spec->cdefine.enable_pcbeep =1 ;/* assume always enabled */ - -if (spec->cdefine.fixup) { - ass = spec->cdefine.sku_cfg; -if (ass ==ALC_FIXUP_SKU_IGNORE ) -return -1 ; - goto do_sku; - } - -if (!codec->bus->pci) -return -1 ; - ass = codec->core.subsystem_id &0xffff ; -if (ass != codec->bus->pci->subsystem_device && (ass &1 )) - goto do_sku; - - nid =0x1d ; -if (codec->core.vendor_id ==0x10ec0260 ) - nid =0x17 ; - ass =snd_hda_codec_get_pincfg (codec, nid); - -if (!(ass &1 )) { -codec_info (codec,"%s: SKU not ready 0x%08x\n" , - codec->core.chip_name, ass); -return -1 ; - } - -/* check sum */ - tmp =0 ; -for (i =1 ; i <16 ; i++) { -if ((ass >> i) &1 ) - tmp++; - } -if (((ass >>16 ) &0xf ) != tmp) -return -1 ; - - spec->cdefine.port_connectivity = ass >>30 ; - spec->cdefine.enable_pcbeep = (ass &0x100000 ) >>20 ; - spec->cdefine.check_sum = (ass >>16 ) &0xf ; - spec->cdefine.customization = ass >>8 ; -do_sku: - spec->cdefine.sku_cfg = ass; - spec->cdefine.external_amp = (ass &0x38 ) >>3 ; - spec->cdefine.platform_type = (ass &0x4 ) >>2 ; - spec->cdefine.swap = (ass &0x2 ) >>1 ; - spec->cdefine.override = ass &0x1 ; - -codec_dbg (codec,"SKU: Nid=0x%x sku_cfg=0x%08x\n" , - nid, spec->cdefine.sku_cfg); -codec_dbg (codec,"SKU: port_connectivity=0x%x\n" , - spec->cdefine.port_connectivity); -codec_dbg (codec,"SKU: enable_pcbeep=0x%x\n" , spec->cdefine.enable_pcbeep); -codec_dbg (codec,"SKU: check_sum=0x%08x\n" , spec->cdefine.check_sum); -codec_dbg (codec,"SKU: customization=0x%08x\n" , spec->cdefine.customization); -codec_dbg (codec,"SKU: external_amp=0x%x\n" , spec->cdefine.external_amp); -codec_dbg (codec,"SKU: platform_type=0x%x\n" , spec->cdefine.platform_type); -codec_dbg (codec,"SKU: swap=0x%x\n" , spec->cdefine.swap); -codec_dbg (codec,"SKU: override=0x%x\n" , spec->cdefine.override); - -return 0 ; -} - -/* return the position of NID in the list, or -1 if not found */ -static int find_idx_in_nid_list (hda_nid_t nid,const hda_nid_t *list,int nums) -{ -int i; -for (i =0 ; i < nums; i++) -if (list[i] == nid) -return i; -return -1 ; -} -/* return true if the given NID is found in the list */ -static bool found_in_nid_list (hda_nid_t nid,const hda_nid_t *list,int nums) -{ -return find_idx_in_nid_list (nid, list, nums) >=0 ; -} - -/* check subsystem ID and set up device-specific initialization; -* return 1 if initialized, 0 if invalid SSID -*/ -/* 32-bit subsystem ID for BIOS loading in HD Audio codec. -* 31 ~ 16 : Manufacture ID -* 15 ~ 8 : SKU ID -* 7 ~ 0 : Assembly ID -* port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 -*/ -static int alc_subsystem_id (struct hda_codec *codec,const hda_nid_t *ports) -{ -unsigned int ass, tmp, i; -unsigned nid; -struct alc_spec *spec = codec->spec; - -if (spec->cdefine.fixup) { - ass = spec->cdefine.sku_cfg; -if (ass ==ALC_FIXUP_SKU_IGNORE ) -return 0 ; - goto do_sku; - } - - ass = codec->core.subsystem_id &0xffff ; -if (codec->bus->pci && - ass != codec->bus->pci->subsystem_device && (ass &1 )) - goto do_sku; - -/* invalid SSID, check the special NID pin defcfg instead */ -/* -* 31~30 : port connectivity -* 29~21 : reserve -* 20 : PCBEEP input -* 19~16 : Check sum (15:1) -* 15~1 : Custom -* 0 : override -*/ - nid =0x1d ; -if (codec->core.vendor_id ==0x10ec0260 ) - nid =0x17 ; - ass =snd_hda_codec_get_pincfg (codec, nid); -codec_dbg (codec, -"realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n" , - ass, nid); -if (!(ass &1 )) -return 0 ; -if ((ass >>30 ) !=1 )/* no physical connection */ -return 0 ; - -/* check sum */ - tmp =0 ; -for (i =1 ; i <16 ; i++) { -if ((ass >> i) &1 ) - tmp++; - } -if (((ass >>16 ) &0xf ) != tmp) -return 0 ; -do_sku: -codec_dbg (codec,"realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n" , - ass &0xffff , codec->core.vendor_id); -/* -* 0 : override -* 1 : Swap Jack -* 2 : 0 --> Desktop, 1 --> Laptop -* 3~5 : External Amplifier control -* 7~6 : Reserved -*/ - tmp = (ass &0x38 ) >>3 ;/* external Amp control */ -if (spec->init_amp ==ALC_INIT_UNDEFINED ) { -switch (tmp) { -case 1 : -alc_setup_gpio (codec,0x01 ); -break ; -case 3 : -alc_setup_gpio (codec,0x02 ); -break ; -case 7 : -alc_setup_gpio (codec,0x04 ); -break ; -case 5 : -default : - spec->init_amp =ALC_INIT_DEFAULT ; -break ; - } - } - -/* is laptop or Desktop and enable the function "Mute internal speaker -* when the external headphone out jack is plugged" -*/ -if (!(ass &0x8000 )) -return 1 ; -/* -* 10~8 : Jack location -* 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered -* 14~13: Resvered -* 15 : 1 --> enable the function "Mute internal speaker -* when the external headphone out jack is plugged" -*/ -if (!alc_get_hp_pin (spec)) { -hda_nid_t nid; - tmp = (ass >>11 ) &0x3 ;/* HP to chassis */ - nid = ports[tmp]; -if (found_in_nid_list (nid, spec->gen.autocfg.line_out_pins, - spec->gen.autocfg.line_outs)) -return 1 ; - spec->gen.autocfg.hp_pins[0 ] = nid; - } -return 1 ; -} - -/* Check the validity of ALC subsystem-id -* ports contains an array of 4 pin NIDs for port-A, E, D and I */ -static void alc_ssid_check (struct hda_codec *codec,const hda_nid_t *ports) -{ -if (!alc_subsystem_id (codec, ports)) { -struct alc_spec *spec = codec->spec; -if (spec->init_amp ==ALC_INIT_UNDEFINED ) { -codec_dbg (codec, -"realtek: Enable default setup for auto mode as fallback\n" ); - spec->init_amp =ALC_INIT_DEFAULT ; - } - } -} - -/* inverted digital-mic */ -static void alc_fixup_inv_dmic (struct hda_codec *codec, -const struct hda_fixup *fix,int action) -{ -struct alc_spec *spec = codec->spec; - - spec->gen.inv_dmic_split =1 ; -} - - -static int alc_build_controls (struct hda_codec *codec) -{ -int err; - - err =snd_hda_gen_build_controls (codec); -if (err <0 ) -return err; - -snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_BUILD ); -return 0 ; -} - - -/* -* Common callbacks -*/ - -static void alc_pre_init (struct hda_codec *codec) -{ -alc_fill_eapd_coef (codec); -} - -#define is_s3_resume (codec) \ - ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME) -#define is_s4_resume (codec) \ - ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE) -#define is_s4_suspend (codec) \ - ((codec)->core.dev.power.power_state.event == PM_EVENT_FREEZE) - -static int alc_init (struct hda_codec *codec) -{ -struct alc_spec *spec = codec->spec; - -/* hibernation resume needs the full chip initialization */ -if (is_s4_resume (codec)) -alc_pre_init (codec); - -if (spec->init_hook) - spec->init_hook (codec); - - spec->gen.skip_verbs =1 ;/* applied in below */ -snd_hda_gen_init (codec); -alc_fix_pll (codec); -alc_auto_init_amp (codec, spec->init_amp); -snd_hda_apply_verbs (codec);/* apply verbs here after own init */ - -snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_INIT ); - -return 0 ; -} - -/* forward declaration */ -static const struct component_master_ops comp_master_ops; - -static void alc_free (struct hda_codec *codec) -{ -struct alc_spec *spec = codec->spec; - -if (spec) -hda_component_manager_free (&spec->comps, &comp_master_ops); - -snd_hda_gen_free (codec); -} - -static inline void alc_shutup (struct hda_codec *codec) -{ -struct alc_spec *spec = codec->spec; - -if (!snd_hda_get_bool_hint (codec,"shutup" )) -return ;/* disabled explicitly by hints */ - -if (spec && spec->shutup) - spec->shutup (codec); -else -alc_shutup_pins (codec); -} - -static void alc_power_eapd (struct hda_codec *codec) -{ -alc_auto_setup_eapd (codec, false); -} - -static int alc_suspend (struct hda_codec *codec) -{ -struct alc_spec *spec = codec->spec; -alc_shutup (codec); -if (spec && spec->power_hook) - spec->power_hook (codec); -return 0 ; -} - -static int alc_resume (struct hda_codec *codec) -{ -struct alc_spec *spec = codec->spec; - -if (!spec->no_depop_delay) -msleep (150 );/* to avoid pop noise */ - codec->patch_ops.init (codec); -snd_hda_regmap_sync (codec); -hda_call_check_power_status (codec,0x01 ); -return 0 ; -} - -/* -*/ -static const struct hda_codec_ops alc_patch_ops = { - .build_controls = alc_build_controls, - .build_pcms = snd_hda_gen_build_pcms, - .init = alc_init, - .free = alc_free, - .unsol_event = snd_hda_jack_unsol_event, - .resume = alc_resume, - .suspend = alc_suspend, - .check_power_status = snd_hda_gen_check_power_status, -}; - - -#define alc_codec_rename (codec, name) snd_hda_codec_set_name(codec, name) - -/* -* Rename codecs appropriately from COEF value or subvendor id -*/ -struct alc_codec_rename_table { -unsigned int vendor_id; -unsigned short coef_mask; -unsigned short coef_bits; -const char *name; -}; - -struct alc_codec_rename_pci_table { -unsigned int codec_vendor_id; -unsigned short pci_subvendor; -unsigned short pci_subdevice; -const char *name; -}; - -static const struct alc_codec_rename_table rename_tbl[] = { - {0x10ec0221 ,0xf00f ,0x1003 ,"ALC231" }, - {0x10ec0269 ,0xfff0 ,0x3010 ,"ALC277" }, - {0x10ec0269 ,0xf0f0 ,0x2010 ,"ALC259" }, - {0x10ec0269 ,0xf0f0 ,0x3010 ,"ALC258" }, - {0x10ec0269 ,0x00f0 ,0x0010 ,"ALC269VB" }, - {0x10ec0269 ,0xffff ,0xa023 ,"ALC259" }, - {0x10ec0269 ,0xffff ,0x6023 ,"ALC281X" }, - {0x10ec0269 ,0x00f0 ,0x0020 ,"ALC269VC" }, - {0x10ec0269 ,0x00f0 ,0x0030 ,"ALC269VD" }, - {0x10ec0662 ,0xffff ,0x4020 ,"ALC656" }, - {0x10ec0887 ,0x00f0 ,0x0030 ,"ALC887-VD" }, - {0x10ec0888 ,0x00f0 ,0x0030 ,"ALC888-VD" }, - {0x10ec0888 ,0xf0f0 ,0x3020 ,"ALC886" }, - {0x10ec0899 ,0x2000 ,0x2000 ,"ALC899" }, - {0x10ec0892 ,0xffff ,0x8020 ,"ALC661" }, - {0x10ec0892 ,0xffff ,0x8011 ,"ALC661" }, - {0x10ec0892 ,0xffff ,0x4011 ,"ALC656" }, - { }/* terminator */ -}; - -static const struct alc_codec_rename_pci_table rename_pci_tbl[] = { - {0x10ec0280 ,0x1028 ,0 ,"ALC3220" }, - {0x10ec0282 ,0x1028 ,0 ,"ALC3221" }, - {0x10ec0283 ,0x1028 ,0 ,"ALC3223" }, - {0x10ec0288 ,0x1028 ,0 ,"ALC3263" }, - {0x10ec0292 ,0x1028 ,0 ,"ALC3226" }, - {0x10ec0293 ,0x1028 ,0 ,"ALC3235" }, - {0x10ec0255 ,0x1028 ,0 ,"ALC3234" }, - {0x10ec0668 ,0x1028 ,0 ,"ALC3661" }, - {0x10ec0275 ,0x1028 ,0 ,"ALC3260" }, - {0x10ec0899 ,0x1028 ,0 ,"ALC3861" }, - {0x10ec0298 ,0x1028 ,0 ,"ALC3266" }, - {0x10ec0236 ,0x1028 ,0 ,"ALC3204" }, - {0x10ec0256 ,0x1028 ,0 ,"ALC3246" }, - {0x10ec0225 ,0x1028 ,0 ,"ALC3253" }, - {0x10ec0295 ,0x1028 ,0 ,"ALC3254" }, - {0x10ec0299 ,0x1028 ,0 ,"ALC3271" }, - {0x10ec0670 ,0x1025 ,0 ,"ALC669X" }, - {0x10ec0676 ,0x1025 ,0 ,"ALC679X" }, - {0x10ec0282 ,0x1043 ,0 ,"ALC3229" }, - {0x10ec0233 ,0x1043 ,0 ,"ALC3236" }, - {0x10ec0280 ,0x103c ,0 ,"ALC3228" }, - {0x10ec0282 ,0x103c ,0 ,"ALC3227" }, - {0x10ec0286 ,0x103c ,0 ,"ALC3242" }, - {0x10ec0290 ,0x103c ,0 ,"ALC3241" }, - {0x10ec0668 ,0x103c ,0 ,"ALC3662" }, - {0x10ec0283 ,0x17aa ,0 ,"ALC3239" }, - {0x10ec0292 ,0x17aa ,0 ,"ALC3232" }, - {0x10ec0257 ,0x12f0 ,0 ,"ALC3328" }, - { }/* terminator */ -}; - -static int alc_codec_rename_from_preset (struct hda_codec *codec) -{ -const struct alc_codec_rename_table *p; -const struct alc_codec_rename_pci_table *q; - -for (p = rename_tbl; p->vendor_id; p++) { -if (p->vendor_id != codec->core.vendor_id) -continue ; -if ((alc_get_coef0 (codec) & p->coef_mask) == p->coef_bits) -return alc_codec_rename (codec, p->name); - } - -if (!codec->bus->pci) -return 0 ; -for (q = rename_pci_tbl; q->codec_vendor_id; q++) { -if (q->codec_vendor_id != codec->core.vendor_id) -continue ; -if (q->pci_subvendor != codec->bus->pci->subsystem_vendor) -continue ; -if (!q->pci_subdevice || - q->pci_subdevice == codec->bus->pci->subsystem_device) -return alc_codec_rename (codec, q->name); - } - -return 0 ; -} - - -/* -* Digital-beep handlers -*/ -#ifdef CONFIG_SND_HDA_INPUT_BEEP - -/* additional beep mixers; private_value will be overwritten */ -static const struct snd_kcontrol_new alc_beep_mixer[] = { -HDA_CODEC_VOLUME ("Beep Playback Volume" ,0 ,0 ,HDA_INPUT ), -HDA_CODEC_MUTE_BEEP ("Beep Playback Switch" ,0 ,0 ,HDA_INPUT ), -}; - -/* set up and create beep controls */ -static int set_beep_amp (struct alc_spec *spec,hda_nid_t nid, -int idx,int dir) -{ -struct snd_kcontrol_new *knew; -unsigned int beep_amp =HDA_COMPOSE_AMP_VAL (nid,3 , idx, dir); -int i; - -for (i =0 ; i <ARRAY_SIZE (alc_beep_mixer); i++) { - knew =snd_hda_gen_add_kctl (&spec->gen,NULL , - &alc_beep_mixer[i]); -if (!knew) -return -ENOMEM ; - knew->private_value = beep_amp; - } -return 0 ; -} - -static const struct snd_pci_quirk beep_allow_list[] = { -SND_PCI_QUIRK (0x1043 ,0x103c ,"ASUS" ,1 ), -SND_PCI_QUIRK (0x1043 ,0x115d ,"ASUS" ,1 ), -SND_PCI_QUIRK (0x1043 ,0x829f ,"ASUS" ,1 ), -SND_PCI_QUIRK (0x1043 ,0x8376 ,"EeePC" ,1 ), -SND_PCI_QUIRK (0x1043 ,0x83ce ,"EeePC" ,1 ), -SND_PCI_QUIRK (0x1043 ,0x831a ,"EeePC" ,1 ), -SND_PCI_QUIRK (0x1043 ,0x834a ,"EeePC" ,1 ), -SND_PCI_QUIRK (0x1458 ,0xa002 ,"GA-MA790X" ,1 ), -SND_PCI_QUIRK (0x8086 ,0xd613 ,"Intel" ,1 ), -/* denylist -- no beep available */ -SND_PCI_QUIRK (0x17aa ,0x309e ,"Lenovo ThinkCentre M73" ,0 ), -SND_PCI_QUIRK (0x17aa ,0x30a3 ,"Lenovo ThinkCentre M93" ,0 ), - {} -}; - -static inline int has_cdefine_beep (struct hda_codec *codec) -{ -struct alc_spec *spec = codec->spec; -const struct snd_pci_quirk *q; - q =snd_pci_quirk_lookup (codec->bus->pci, beep_allow_list); -if (q) -return q->value; -return spec->cdefine.enable_pcbeep; -} -#else -#define set_beep_amp (spec, nid, idx, dir) 0 -#define has_cdefine_beep (codec) 0 -#endif - -/* parse the BIOS configuration and set up the alc_spec */ -/* return 1 if successful, 0 if the proper config is not found, -* or a negative error code -*/ -static int alc_parse_auto_config (struct hda_codec *codec, -const hda_nid_t *ignore_nids, -const hda_nid_t *ssid_nids) -{ -struct alc_spec *spec = codec->spec; -struct auto_pin_cfg *cfg = &spec->gen.autocfg; -int err; - - err =snd_hda_parse_pin_defcfg (codec, cfg, ignore_nids, - spec->parse_flags); -if (err <0 ) -return err; - -if (ssid_nids) -alc_ssid_check (codec, ssid_nids); - - err =snd_hda_gen_parse_auto_config (codec, cfg); -if (err <0 ) -return err; - -return 1 ; -} - -/* common preparation job for alc_spec */ -static int alc_alloc_spec (struct hda_codec *codec,hda_nid_t mixer_nid) -{ -struct alc_spec *spec =kzalloc (sizeof (*spec),GFP_KERNEL ); -int err; - -if (!spec) -return -ENOMEM ; - codec->spec = spec; -snd_hda_gen_spec_init (&spec->gen); - spec->gen.mixer_nid = mixer_nid; - spec->gen.own_eapd_ctl =1 ; - codec->single_adc_amp =1 ; -/* FIXME: do we need this for all Realtek codec models? */ - codec->spdif_status_reset =1 ; - codec->forced_resume =1 ; - codec->patch_ops = alc_patch_ops; -mutex_init (&spec->coef_mutex); - - err =alc_codec_rename_from_preset (codec); -if (err <0 ) { -kfree (spec); -return err; - } -return 0 ; -} - -static int alc880_parse_auto_config (struct hda_codec *codec) -{ -static const hda_nid_t alc880_ignore[] = {0x1d ,0 }; -static const hda_nid_t alc880_ssids[] = {0x15 ,0x1b ,0x14 ,0 }; -return alc_parse_auto_config (codec, alc880_ignore, alc880_ssids); -} - -/* -* ALC880 fix-ups -*/ -enum { -ALC880_FIXUP_GPIO1 , -ALC880_FIXUP_GPIO2 , -ALC880_FIXUP_MEDION_RIM , -ALC880_FIXUP_LG , -ALC880_FIXUP_LG_LW25 , -ALC880_FIXUP_W810 , -ALC880_FIXUP_EAPD_COEF , -ALC880_FIXUP_TCL_S700 , -ALC880_FIXUP_VOL_KNOB , -ALC880_FIXUP_FUJITSU , -ALC880_FIXUP_F1734 , -ALC880_FIXUP_UNIWILL , -ALC880_FIXUP_UNIWILL_DIG , -ALC880_FIXUP_Z71V , -ALC880_FIXUP_ASUS_W5A , -ALC880_FIXUP_3ST_BASE , -ALC880_FIXUP_3ST , -ALC880_FIXUP_3ST_DIG , -ALC880_FIXUP_5ST_BASE , -ALC880_FIXUP_5ST , -ALC880_FIXUP_5ST_DIG , -ALC880_FIXUP_6ST_BASE , -ALC880_FIXUP_6ST , -ALC880_FIXUP_6ST_DIG , -ALC880_FIXUP_6ST_AUTOMUTE , -}; - -/* enable the volume-knob widget support on NID 0x21 */ -static void alc880_fixup_vol_knob (struct hda_codec *codec, -const struct hda_fixup *fix,int action) -{ -if (action ==HDA_FIXUP_ACT_PROBE ) -snd_hda_jack_detect_enable_callback (codec,0x21 , - alc_update_knob_master); -} - -static const struct hda_fixup alc880_fixups[] = { - [ALC880_FIXUP_GPIO1 ] = { - .type =HDA_FIXUP_FUNC , - .v.func = alc_fixup_gpio1, - }, - [ALC880_FIXUP_GPIO2 ] = { - .type =HDA_FIXUP_FUNC , - .v.func = alc_fixup_gpio2, - }, - [ALC880_FIXUP_MEDION_RIM ] = { - .type =HDA_FIXUP_VERBS , - .v.verbs = (const struct hda_verb []) { - {0x20 ,AC_VERB_SET_COEF_INDEX ,0x07 }, - {0x20 ,AC_VERB_SET_PROC_COEF ,0x3060 }, - { } - }, - .chained = true, - .chain_id =ALC880_FIXUP_GPIO2 , - }, - [ALC880_FIXUP_LG ] = { - .type =HDA_FIXUP_PINS , - .v.pins = (const struct hda_pintbl []) { -/* disable bogus unused pins */ - {0x16 ,0x411111f0 }, - {0x18 ,0x411111f0 }, - {0x1a ,0x411111f0 }, - { } - } - }, - [ALC880_FIXUP_LG_LW25 ] = { - .type =HDA_FIXUP_PINS , - .v.pins = (const struct hda_pintbl []) { - {0x1a ,0x0181344f },/* line-in */ - {0x1b ,0x0321403f },/* headphone */ - { } - } - }, - [ALC880_FIXUP_W810 ] = { - .type =HDA_FIXUP_PINS , - .v.pins = (const struct hda_pintbl []) { -/* disable bogus unused pins */ - {0x17 ,0x411111f0 }, - { } - }, - .chained = true, - .chain_id =ALC880_FIXUP_GPIO2 , - }, - [ALC880_FIXUP_EAPD_COEF ] = { - .type =HDA_FIXUP_VERBS , - .v.verbs = (const struct hda_verb []) { -/* change to EAPD mode */ - {0x20 ,AC_VERB_SET_COEF_INDEX ,0x07 }, - {0x20 ,AC_VERB_SET_PROC_COEF ,0x3060 }, - {} - }, - }, - [ALC880_FIXUP_TCL_S700 ] = { - .type =HDA_FIXUP_VERBS , - .v.verbs = (const struct hda_verb []) { -/* change to EAPD mode */ - {0x20 ,AC_VERB_SET_COEF_INDEX ,0x07 }, - {0x20 ,AC_VERB_SET_PROC_COEF ,0x3070 }, - {} - }, - .chained = true, - .chain_id =ALC880_FIXUP_GPIO2 , - }, - [ALC880_FIXUP_VOL_KNOB ] = { - .type =HDA_FIXUP_FUNC , - .v.func = alc880_fixup_vol_knob, - }, - [ALC880_FIXUP_FUJITSU ] = { -/* override all pins as BIOS on old Amilo is broken */ - .type =HDA_FIXUP_PINS , - .v.pins = (const struct hda_pintbl []) { - {0x14 ,0x0121401f },/* HP */ - {0x15 ,0x99030120 },/* speaker */ - {0x16 ,0x99030130 },/* bass speaker */ - {0x17 ,0x411111f0 },/* N/A */ - {0x18 ,0x411111f0 },/* N/A */ - {0x19 ,0x01a19950 },/* mic-in */ - {0x1a ,0x411111f0 },/* N/A */ - {0x1b ,0x411111f0 },/* N/A */ - {0x1c ,0x411111f0 },/* N/A */ - {0x1d ,0x411111f0 },/* N/A */ - {0x1e ,0x01454140 },/* SPDIF out */ - { } - }, - .chained = true, - .chain_id =ALC880_FIXUP_VOL_KNOB , - }, - [ALC880_FIXUP_F1734 ] = { -/* almost compatible with FUJITSU, but no bass and SPDIF */ - .type =HDA_FIXUP_PINS , - .v.pins = (const struct hda_pintbl []) { - {0x14 ,0x0121401f },/* HP */ - {0x15 ,0x99030120 },/* speaker */ - {0x16 ,0x411111f0 },/* N/A */ - {0x17 ,0x411111f0 },/* N/A */ - {0x18 ,0x411111f0 },/* N/A */ - {0x19 ,0x01a19950 },/* mic-in */ - {0x1a ,0x411111f0 },/* N/A */ - {0x1b ,0x411111f0 },/* N/A */ - {0x1c ,0x411111f0 },/* N/A */ - {0x1d ,0x411111f0 },/* N/A */ - {0x1e ,0x411111f0 },/* N/A */ - { } - }, - .chained = true, - .chain_id =ALC880_FIXUP_VOL_KNOB , - }, - [ALC880_FIXUP_UNIWILL ] = { -/* need to fix HP and speaker pins to be parsed correctly */ - .type =HDA_FIXUP_PINS , - .v.pins = (const struct hda_pintbl []) { - {0x14 ,0x0121411f },/* HP */ - {0x15 ,0x99030120 },/* speaker */ - {0x16 ,0x99030130 },/* bass speaker */ - { } - }, - }, - [ALC880_FIXUP_UNIWILL_DIG ] = { - .type =HDA_FIXUP_PINS , - .v.pins = (const struct hda_pintbl []) { -/* disable bogus unused pins */ - {0x17 ,0x411111f0 }, - {0x19 ,0x411111f0 }, - {0x1b ,0x411111f0 }, - {0x1f ,0x411111f0 }, - { } - } - }, - [ALC880_FIXUP_Z71V ] = { - .type =HDA_FIXUP_PINS , - .v.pins = (const struct hda_pintbl []) { -/* set up the whole pins as BIOS is utterly broken */ - {0x14 ,0x99030120 },/* speaker */ - {0x15 ,0x0121411f },/* HP */ - {0x16 ,0x411111f0 },/* N/A */ - {0x17 ,0x411111f0 },/* N/A */ - {0x18 ,0x01a19950 },/* mic-in */ - {0x19 ,0x411111f0 },/* N/A */ - {0x1a ,0x01813031 },/* line-in */ - {0x1b ,0x411111f0 },/* N/A */ - {0x1c ,0x411111f0 },/* N/A */ - {0x1d ,0x411111f0 },/* N/A */ - {0x1e ,0x0144111e },/* SPDIF */ - { } - } - }, - [ALC880_FIXUP_ASUS_W5A ] = { - .type =HDA_FIXUP_PINS , - .v.pins = (const struct hda_pintbl []) { -/* set up the whole pins as BIOS is utterly broken */ - {0x14 ,0x0121411f },/* HP */ - {0x15 ,0x411111f0 },/* N/A */ - {0x16 ,0x411111f0 },/* N/A */ - {0x17 ,0x411111f0 },/* N/A */ - {0x18 ,0x90a60160 },/* mic */ - {0x19 ,0x411111f0 },/* N/A */ - {0x1a ,0x411111f0 },/* N/A */ - {0x1b ,0x411111f0 },/* N/A */ - {0x1c ,0x411111f0 },/* N/A */ - {0x1d ,0x411111f0 },/* N/A */ - {0x1e ,0xb743111e },/* SPDIF out */ - { } - }, - .chained = true, - .chain_id =ALC880_FIXUP_GPIO1 , - }, - [ALC880_FIXUP_3ST_BASE ] = { - .type =HDA_FIXUP_PINS , - .v.pins = (const struct hda_pintbl []) { - {0x14 ,0x01014010 },/* line-out */ - {0x15 ,0x411111f0 },/* N/A */ - {0x16 ,0x411111f0 },/* N/A */ - {0x17 ,0x411111f0 },/* N/A */ - {0x18 ,0x01a19c30 },/* mic-in */ - {0x19 ,0x0121411f },/* HP */ - {0x1a ,0x01813031 },/* line-in */ - {0x1b ,0x02a19c40 },/* front-mic */ - {0x1c ,0x411111f0 },/* N/A */ - {0x1d ,0x411111f0 },/* N/A */ -/* 0x1e is filled in below */ - {0x1f ,0x411111f0 },/* N/A */ - { } - } - }, - [ALC880_FIXUP_3ST ] = { - .type =HDA_FIXUP_PINS , - .v.pins = (const struct hda_pintbl []) { - {0x1e ,0x411111f0 },/* N/A */ - { } - }, - .chained = true, - .chain_id =ALC880_FIXUP_3ST_BASE , - }, - [ALC880_FIXUP_3ST_DIG ] = { - .type =HDA_FIXUP_PINS , - .v.pins = (const struct hda_pintbl []) { - {0x1e ,0x0144111e },/* SPDIF */ - { } - }, - .chained = true, - .chain_id =ALC880_FIXUP_3ST_BASE , - }, - [ALC880_FIXUP_5ST_BASE ] = { - .type =HDA_FIXUP_PINS , - .v.pins = (const struct hda_pintbl []) { - {0x14 ,0x01014010 },/* front */ - {0x15 ,0x411111f0 },/* N/A */ - {0x16 ,0x01011411 },/* CLFE */ - {0x17 ,0x01016412 },/* surr */ - {0x18 ,0x01a19c30 },/* mic-in */ - {0x19 ,0x0121411f },/* HP */ - {0x1a ,0x01813031 },/* line-in */ - {0x1b ,0x02a19c40 },/* front-mic */ - {0x1c ,0x411111f0 },/* N/A */ - {0x1d ,0x411111f0 },/* N/A */ -/* 0x1e is filled in below */ - {0x1f ,0x411111f0 },/* N/A */ - { } - } - }, - [ALC880_FIXUP_5ST ] = { - .type =HDA_FIXUP_PINS , - .v.pins = (const struct hda_pintbl []) { - {0x1e ,0x411111f0 },/* N/A */ - { } - }, - .chained = true, - .chain_id =ALC880_FIXUP_5ST_BASE , - }, - [ALC880_FIXUP_5ST_DIG ] = { - .type =HDA_FIXUP_PINS , - .v.pins = (const struct hda_pintbl []) { - {0x1e ,0x0144111e },/* SPDIF */ - { } - }, - .chained = true, - .chain_id =ALC880_FIXUP_5ST_BASE , - }, - [ALC880_FIXUP_6ST_BASE ] = { - .type =HDA_FIXUP_PINS , - .v.pins = (const struct hda_pintbl []) { - {0x14 ,0x01014010 },/* front */ - {0x15 ,0x01016412 },/* surr */ - {0x16 ,0x01011411 },/* CLFE */ - {0x17 ,0x01012414 },/* side */ - {0x18 ,0x01a19c30 },/* mic-in */ - {0x19 ,0x02a19c40 },/* front-mic */ - {0x1a ,0x01813031 },/* line-in */ - {0x1b ,0x0121411f },/* HP */ - {0x1c ,0x411111f0 },/* N/A */ - {0x1d ,0x411111f0 },/* N/A */ -/* 0x1e is filled in below */ - {0x1f ,0x411111f0 },/* N/A */ - { } - } - }, - [ALC880_FIXUP_6ST ] = { - .type =HDA_FIXUP_PINS , - .v.pins = (const struct hda_pintbl []) { - {0x1e ,0x411111f0 },/* N/A */ - { } - }, - .chained = true, - .chain_id =ALC880_FIXUP_6ST_BASE , - }, - [ALC880_FIXUP_6ST_DIG ] = { - .type =HDA_FIXUP_PINS , - .v.pins = (const struct hda_pintbl []) { - {0x1e ,0x0144111e },/* SPDIF */ - { } - }, - .chained = true, - .chain_id =ALC880_FIXUP_6ST_BASE , - }, - [ALC880_FIXUP_6ST_AUTOMUTE ] = { - .type =HDA_FIXUP_PINS , - .v.pins = (const struct hda_pintbl []) { - {0x1b ,0x0121401f },/* HP with jack detect */ - { } - }, - .chained_before = true, - .chain_id =ALC880_FIXUP_6ST_BASE , - }, -}; - -static const struct hda_quirk alc880_fixup_tbl[] = { -SND_PCI_QUIRK (0x1019 ,0x0f69 ,"Coeus G610P" ,ALC880_FIXUP_W810 ), -SND_PCI_QUIRK (0x1043 ,0x10c3 ,"ASUS W5A" ,ALC880_FIXUP_ASUS_W5A ), -SND_PCI_QUIRK (0x1043 ,0x1964 ,"ASUS Z71V" ,ALC880_FIXUP_Z71V ), -SND_PCI_QUIRK_VENDOR (0x1043 ,"ASUS" ,ALC880_FIXUP_GPIO1 ), -SND_PCI_QUIRK (0x147b ,0x1045 ,"ABit AA8XE" ,ALC880_FIXUP_6ST_AUTOMUTE ), -SND_PCI_QUIRK (0x1558 ,0x5401 ,"Clevo GPIO2" ,ALC880_FIXUP_GPIO2 ), -SND_PCI_QUIRK_VENDOR (0x1558 ,"Clevo" ,ALC880_FIXUP_EAPD_COEF ), -SND_PCI_QUIRK (0x1584 ,0x9050 ,"Uniwill" ,ALC880_FIXUP_UNIWILL_DIG ), -SND_PCI_QUIRK (0x1584 ,0x9054 ,"Uniwill" ,ALC880_FIXUP_F1734 ), -SND_PCI_QUIRK (0x1584 ,0x9070 ,"Uniwill" ,ALC880_FIXUP_UNIWILL ), -SND_PCI_QUIRK (0x1584 ,0x9077 ,"Uniwill P53" ,ALC880_FIXUP_VOL_KNOB ), -SND_PCI_QUIRK (0x161f ,0x203d ,"W810" ,ALC880_FIXUP_W810 ), -SND_PCI_QUIRK (0x161f ,0x205d ,"Medion Rim 2150" ,ALC880_FIXUP_MEDION_RIM ), -SND_PCI_QUIRK (0x1631 ,0xe011 ,"PB 13201056" ,ALC880_FIXUP_6ST_AUTOMUTE ), -SND_PCI_QUIRK (0x1734 ,0x107c ,"FSC Amilo M1437" ,ALC880_FIXUP_FUJITSU ), -SND_PCI_QUIRK (0x1734 ,0x1094 ,"FSC Amilo M1451G" ,ALC880_FIXUP_FUJITSU ), -SND_PCI_QUIRK (0x1734 ,0x10ac ,"FSC AMILO Xi 1526" ,ALC880_FIXUP_F1734 ), -SND_PCI_QUIRK (0x1734 ,0x10b0 ,"FSC Amilo Pi1556" ,ALC880_FIXUP_FUJITSU ), -SND_PCI_QUIRK (0x1854 ,0x003b ,"LG" ,ALC880_FIXUP_LG ), -SND_PCI_QUIRK (0x1854 ,0x005f ,"LG P1 Express" ,ALC880_FIXUP_LG ), -SND_PCI_QUIRK (0x1854 ,0x0068 ,"LG w1" ,ALC880_FIXUP_LG ), -SND_PCI_QUIRK (0x1854 ,0x0077 ,"LG LW25" ,ALC880_FIXUP_LG_LW25 ), -SND_PCI_QUIRK (0x19db ,0x4188 ,"TCL S700" ,ALC880_FIXUP_TCL_S700 ), - -/* Below is the copied entries from alc880_quirks.c. -* It's not quite sure whether BIOS sets the correct pin-config table -* on these machines, thus they are kept to be compatible with -* the old static quirks. Once when it's confirmed to work without -* these overrides, it'd be better to remove. -*/ -SND_PCI_QUIRK (0x1019 ,0xa880 ,"ECS" ,ALC880_FIXUP_5ST_DIG ), -SND_PCI_QUIRK (0x1019 ,0xa884 ,"Acer APFV" ,ALC880_FIXUP_6ST ), -SND_PCI_QUIRK (0x1025 ,0x0070 ,"ULI" ,ALC880_FIXUP_3ST_DIG ), -SND_PCI_QUIRK (0x1025 ,0x0077 ,"ULI" ,ALC880_FIXUP_6ST_DIG ), -SND_PCI_QUIRK (0x1025 ,0x0078 ,"ULI" ,ALC880_FIXUP_6ST_DIG ), -SND_PCI_QUIRK (0x1025 ,0x0087 ,"ULI" ,ALC880_FIXUP_6ST_DIG ), -SND_PCI_QUIRK (0x1025 ,0xe309 ,"ULI" ,ALC880_FIXUP_3ST_DIG ), -SND_PCI_QUIRK (0x1025 ,0xe310 ,"ULI" ,ALC880_FIXUP_3ST ), -SND_PCI_QUIRK (0x1039 ,0x1234 ,NULL ,ALC880_FIXUP_6ST_DIG ), -SND_PCI_QUIRK (0x104d ,0x81a0 ,"Sony" ,ALC880_FIXUP_3ST ), -SND_PCI_QUIRK (0x104d ,0x81d6 ,"Sony" ,ALC880_FIXUP_3ST ), -SND_PCI_QUIRK (0x107b ,0x3032 ,"Gateway" ,ALC880_FIXUP_5ST ), -SND_PCI_QUIRK (0x107b ,0x3033 ,"Gateway" ,ALC880_FIXUP_5ST ), -SND_PCI_QUIRK (0x107b ,0x4039 ,"Gateway" ,ALC880_FIXUP_5ST ), -SND_PCI_QUIRK (0x1297 ,0xc790 ,"Shuttle ST20G5" ,ALC880_FIXUP_6ST_DIG ), -SND_PCI_QUIRK (0x1458 ,0xa102 ,"Gigabyte K8" ,ALC880_FIXUP_6ST_DIG ), -SND_PCI_QUIRK (0x1462 ,0x1150 ,"MSI" ,ALC880_FIXUP_6ST_DIG ), -SND_PCI_QUIRK (0x1509 ,0x925d ,"FIC P4M" ,ALC880_FIXUP_6ST_DIG ), -SND_PCI_QUIRK (0x1565 ,0x8202 ,"Biostar" ,ALC880_FIXUP_5ST_DIG ), -SND_PCI_QUIRK (0x1695 ,0x400d ,"EPoX" ,ALC880_FIXUP_5ST_DIG ), -SND_PCI_QUIRK (0x1695 ,0x4012 ,"EPox EP-5LDA" ,ALC880_FIXUP_5ST_DIG ), -SND_PCI_QUIRK (0x2668 ,0x8086 ,NULL ,ALC880_FIXUP_6ST_DIG ),/* broken BIOS */ -SND_PCI_QUIRK (0x8086 ,0x2668 ,NULL ,ALC880_FIXUP_6ST_DIG ), -SND_PCI_QUIRK (0x8086 ,0xa100 ,"Intel mobo" ,ALC880_FIXUP_5ST_DIG ), -SND_PCI_QUIRK (0x8086 ,0xd400 ,"Intel mobo" ,ALC880_FIXUP_5ST_DIG ), -SND_PCI_QUIRK (0x8086 ,0xd401 ,"Intel mobo" ,ALC880_FIXUP_5ST_DIG ), -SND_PCI_QUIRK (0x8086 ,0xd402 ,"Intel mobo" ,ALC880_FIXUP_3ST_DIG ), -SND_PCI_QUIRK (0x8086 ,0xe224 ,"Intel mobo" ,ALC880_FIXUP_5ST_DIG ), -SND_PCI_QUIRK (0x8086 ,0xe305 ,"Intel mobo" ,ALC880_FIXUP_3ST_DIG ), -SND_PCI_QUIRK (0x8086 ,0xe308 ,"Intel mobo" ,ALC880_FIXUP_3ST_DIG ), -SND_PCI_QUIRK (0x8086 ,0xe400 ,"Intel mobo" ,ALC880_FIXUP_5ST_DIG ), -SND_PCI_QUIRK (0x8086 ,0xe401 ,"Intel mobo" ,ALC880_FIXUP_5ST_DIG ), -SND_PCI_QUIRK (0x8086 ,0xe402 ,"Intel mobo" ,ALC880_FIXUP_5ST_DIG ), -/* default Intel */ -SND_PCI_QUIRK_VENDOR (0x8086 ,"Intel mobo" ,ALC880_FIXUP_3ST ), -SND_PCI_QUIRK (0xa0a0 ,0x0560 ,"AOpen i915GMm-HFS" ,ALC880_FIXUP_5ST_DIG ), -SND_PCI_QUIRK (0xe803 ,0x1019 ,NULL ,ALC880_FIXUP_6ST_DIG ), - {} -}; - -static const struct hda_model_fixup alc880_fixup_models[] = { - {.id =ALC880_FIXUP_3ST , .name ="3stack" }, - {.id =ALC880_FIXUP_3ST_DIG , .name ="3stack-digout" }, - {.id =ALC880_FIXUP_5ST , .name ="5stack" }, - {.id =ALC880_FIXUP_5ST_DIG , .name ="5stack-digout" }, - {.id =ALC880_FIXUP_6ST , .name ="6stack" }, - {.id =ALC880_FIXUP_6ST_DIG , .name ="6stack-digout" }, - {.id =ALC880_FIXUP_6ST_AUTOMUTE , .name ="6stack-automute" }, - {} -}; - - -/* -* OK, here we have finally the patch for ALC880 -*/ -static int patch_alc880 (struct hda_codec *codec) -{ -struct alc_spec *spec; -int err; - - err =alc_alloc_spec (codec,0x0b ); -if (err <0 ) -return err; - - spec = codec->spec; - spec->gen.need_dac_fix =1 ; - spec->gen.beep_nid =0x01 ; - - codec->patch_ops.unsol_event = alc880_unsol_event; - -alc_pre_init (codec); - -snd_hda_pick_fixup (codec, alc880_fixup_models, alc880_fixup_tbl, - alc880_fixups); -snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PRE_PROBE ); - -/* automatic parse from the BIOS config */ - err =alc880_parse_auto_config (codec); -if (err <0 ) - goto error; - -if (!spec->gen.no_analog) { - err =set_beep_amp (spec,0x0b ,0x05 ,HDA_INPUT ); -if (err <0 ) - goto error; - } - -snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PROBE ); - -return 0 ; - - error: -alc_free (codec); -return err; -} - - -/* -* ALC260 support -*/ -static int alc260_parse_auto_config (struct hda_codec *codec) -{ -static const hda_nid_t alc260_ignore[] = {0x17 ,0 }; -static const hda_nid_t alc260_ssids[] = {0x10 ,0x15 ,0x0f ,0 }; -return alc_parse_auto_config (codec, alc260_ignore, alc260_ssids); -} - -/* -* Pin config fixes -*/ -enum { -ALC260_FIXUP_HP_DC5750 , -ALC260_FIXUP_HP_PIN_0F , -ALC260_FIXUP_COEF , -ALC260_FIXUP_GPIO1 , -ALC260_FIXUP_GPIO1_TOGGLE , -ALC260_FIXUP_REPLACER , -ALC260_FIXUP_HP_B1900 , -ALC260_FIXUP_KN1 , -ALC260_FIXUP_FSC_S7020 , -ALC260_FIXUP_FSC_S7020_JWSE , -ALC260_FIXUP_VAIO_PINS , -}; - -static void alc260_gpio1_automute (struct hda_codec *codec) -{ -struct alc_spec *spec = codec->spec; - -alc_update_gpio_data (codec,0x01 , spec->gen.hp_jack_present); -} - -static void alc260_fixup_gpio1_toggle (struct hda_codec *codec, -const struct hda_fixup *fix,int action) -{ -struct alc_spec *spec = codec->spec; -if (action ==HDA_FIXUP_ACT_PROBE ) { -/* although the machine has only one output pin, we need to -* toggle GPIO1 according to the jack state -*/ - spec->gen.automute_hook = alc260_gpio1_automute; - spec->gen.detect_hp =1 ; - spec->gen.automute_speaker =1 ; - spec->gen.autocfg.hp_pins[0 ] =0x0f ;/* copy it for automute */ -snd_hda_jack_detect_enable_callback (codec,0x0f , - snd_hda_gen_hp_automute); -alc_setup_gpio (codec,0x01 ); - } -} - -static void alc260_fixup_kn1 (struct hda_codec *codec, -const struct hda_fixup *fix,int action) -{ -struct alc_spec *spec = codec->spec; -static const struct hda_pintbl pincfgs[] = { - {0x0f ,0x02214000 },/* HP/speaker */ - {0x12 ,0x90a60160 },/* int mic */ - {0x13 ,0x02a19000 },/* ext mic */ - {0x18 ,0x01446000 },/* SPDIF out */ -/* disable bogus I/O pins */ - {0x10 ,0x411111f0 }, - {0x11 ,0x411111f0 }, - {0x14 ,0x411111f0 }, - {0x15 ,0x411111f0 }, - {0x16 ,0x411111f0 }, - {0x17 ,0x411111f0 }, - {0x19 ,0x411111f0 }, - { } - }; - -switch (action) { -case HDA_FIXUP_ACT_PRE_PROBE : -snd_hda_apply_pincfgs (codec, pincfgs); - spec->init_amp =ALC_INIT_NONE ; -break ; - } -} - -static void alc260_fixup_fsc_s7020 (struct hda_codec *codec, -const struct hda_fixup *fix,int action) -{ -struct alc_spec *spec = codec->spec; -if (action ==HDA_FIXUP_ACT_PRE_PROBE ) - spec->init_amp =ALC_INIT_NONE ; -} - -static void alc260_fixup_fsc_s7020_jwse (struct hda_codec *codec, -const struct hda_fixup *fix,int action) -{ -struct alc_spec *spec = codec->spec; -if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { - spec->gen.add_jack_modes =1 ; - spec->gen.hp_mic =1 ; - } -} - -static const struct hda_fixup alc260_fixups[] = { - [ALC260_FIXUP_HP_DC5750 ] = { - .type =HDA_FIXUP_PINS , - .v.pins = (const struct hda_pintbl []) { - {0x11 ,0x90130110 },/* speaker */ - { } - } - }, - [ALC260_FIXUP_HP_PIN_0F ] = { - .type =HDA_FIXUP_PINS , - .v.pins = (const struct hda_pintbl []) { - {0x0f ,0x01214000 },/* HP */ - { } - } - }, - [ALC260_FIXUP_COEF ] = { - .type =HDA_FIXUP_VERBS , - .v.verbs = (const struct hda_verb []) { - {0x1a ,AC_VERB_SET_COEF_INDEX ,0x07 }, - {0x1a ,AC_VERB_SET_PROC_COEF ,0x3040 }, - { } - }, - }, - [ALC260_FIXUP_GPIO1 ] = { - .type =HDA_FIXUP_FUNC , - .v.func = alc_fixup_gpio1, - }, - [ALC260_FIXUP_GPIO1_TOGGLE ] = { - .type =HDA_FIXUP_FUNC , - .v.func = alc260_fixup_gpio1_toggle, - .chained = true, - .chain_id =ALC260_FIXUP_HP_PIN_0F , - }, - [ALC260_FIXUP_REPLACER ] = { - .type =HDA_FIXUP_VERBS , - .v.verbs = (const struct hda_verb []) { - {0x1a ,AC_VERB_SET_COEF_INDEX ,0x07 }, - {0x1a ,AC_VERB_SET_PROC_COEF ,0x3050 }, - { } - }, - .chained = true, - .chain_id =ALC260_FIXUP_GPIO1_TOGGLE , - }, - [ALC260_FIXUP_HP_B1900 ] = { - .type =HDA_FIXUP_FUNC , - .v.func = alc260_fixup_gpio1_toggle, - .chained = true, - .chain_id =ALC260_FIXUP_COEF , - }, - [ALC260_FIXUP_KN1 ] = { - .type =HDA_FIXUP_FUNC , - .v.func = alc260_fixup_kn1, - }, - [ALC260_FIXUP_FSC_S7020 ] = { - .type =HDA_FIXUP_FUNC , - .v.func = alc260_fixup_fsc_s7020, - }, - [ALC260_FIXUP_FSC_S7020_JWSE ] = { - .type =HDA_FIXUP_FUNC , - .v.func = alc260_fixup_fsc_s7020_jwse, - .chained = true, - .chain_id =ALC260_FIXUP_FSC_S7020 , - }, - [ALC260_FIXUP_VAIO_PINS ] = { - .type =HDA_FIXUP_PINS , - .v.pins = (const struct hda_pintbl []) { -/* Pin configs are missing completely on some VAIOs */ - {0x0f ,0x01211020 }, - {0x10 ,0x0001003f }, - {0x11 ,0x411111f0 }, - {0x12 ,0x01a15930 }, - {0x13 ,0x411111f0 }, - {0x14 ,0x411111f0 }, - {0x15 ,0x411111f0 }, - {0x16 ,0x411111f0 }, - {0x17 ,0x411111f0 }, - {0x18 ,0x411111f0 }, - {0x19 ,0x411111f0 }, - { } - } - }, -}; - -static const struct hda_quirk alc260_fixup_tbl[] = { -SND_PCI_QUIRK (0x1025 ,0x007b ,"Acer C20x" ,ALC260_FIXUP_GPIO1 ), -SND_PCI_QUIRK (0x1025 ,0x007f ,"Acer Aspire 9500" ,ALC260_FIXUP_COEF ), -SND_PCI_QUIRK (0x1025 ,0x008f ,"Acer" ,ALC260_FIXUP_GPIO1 ), -SND_PCI_QUIRK (0x103c ,0x280a ,"HP dc5750" ,ALC260_FIXUP_HP_DC5750 ), -SND_PCI_QUIRK (0x103c ,0x30ba ,"HP Presario B1900" ,ALC260_FIXUP_HP_B1900 ), -SND_PCI_QUIRK (0x104d ,0x81bb ,"Sony VAIO" ,ALC260_FIXUP_VAIO_PINS ), -SND_PCI_QUIRK (0x104d ,0x81e2 ,"Sony VAIO TX" ,ALC260_FIXUP_HP_PIN_0F ), -SND_PCI_QUIRK (0x10cf ,0x1326 ,"FSC LifeBook S7020" ,ALC260_FIXUP_FSC_S7020 ), -SND_PCI_QUIRK (0x1509 ,0x4540 ,"Favorit 100XS" ,ALC260_FIXUP_GPIO1 ), -SND_PCI_QUIRK (0x152d ,0x0729 ,"Quanta KN1" ,ALC260_FIXUP_KN1 ), -SND_PCI_QUIRK (0x161f ,0x2057 ,"Replacer 672V" ,ALC260_FIXUP_REPLACER ), -SND_PCI_QUIRK (0x1631 ,0xc017 ,"PB V7900" ,ALC260_FIXUP_COEF ), - {} -}; - -static const struct hda_model_fixup alc260_fixup_models[] = { - {.id =ALC260_FIXUP_GPIO1 , .name ="gpio1" }, - {.id =ALC260_FIXUP_COEF , .name ="coef" }, - {.id =ALC260_FIXUP_FSC_S7020 , .name ="fujitsu" }, - {.id =ALC260_FIXUP_FSC_S7020_JWSE , .name ="fujitsu-jwse" }, - {} -}; - -/* -*/ -static int patch_alc260 (struct hda_codec *codec) -{ -struct alc_spec *spec; -int err; - - err =alc_alloc_spec (codec,0x07 ); -if (err <0 ) -return err; - - spec = codec->spec; -/* as quite a few machines require HP amp for speaker outputs, -* it's easier to enable it unconditionally; even if it's unneeded, -* it's almost harmless. -*/ - spec->gen.prefer_hp_amp =1 ; - spec->gen.beep_nid =0x01 ; - - spec->shutup = alc_eapd_shutup; - -alc_pre_init (codec); - -snd_hda_pick_fixup (codec, alc260_fixup_models, alc260_fixup_tbl, - alc260_fixups); -snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PRE_PROBE ); - -/* automatic parse from the BIOS config */ - err =alc260_parse_auto_config (codec); -if (err <0 ) - goto error; - -if (!spec->gen.no_analog) { - err =set_beep_amp (spec,0x07 ,0x05 ,HDA_INPUT ); -if (err <0 ) - goto error; - } - -snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PROBE ); - -return 0 ; - - error: -alc_free (codec); -return err; -} - - -/* -* ALC882/883/885/888/889 support -* -* ALC882 is almost identical with ALC880 but has cleaner and more flexible -* configuration. Each pin widget can choose any input DACs and a mixer. -* Each ADC is connected from a mixer of all inputs. This makes possible -* 6-channel independent captures. -* -* In addition, an independent DAC for the multi-playback (not used in this -* driver yet). -*/ - -/* -* Pin config fixes -*/ -enum { -ALC882_FIXUP_ABIT_AW9D_MAX , -ALC882_FIXUP_LENOVO_Y530 , -ALC882_FIXUP_PB_M5210 , -ALC882_FIXUP_ACER_ASPIRE_7736 , -ALC882_FIXUP_ASUS_W90V , -ALC889_FIXUP_CD , -ALC889_FIXUP_FRONT_HP_NO_PRESENCE , -ALC889_FIXUP_VAIO_TT , -ALC888_FIXUP_EEE1601 , -ALC886_FIXUP_EAPD , -ALC882_FIXUP_EAPD , -ALC883_FIXUP_EAPD , -ALC883_FIXUP_ACER_EAPD , -ALC882_FIXUP_GPIO1 , -ALC882_FIXUP_GPIO2 , -ALC882_FIXUP_GPIO3 , -ALC889_FIXUP_COEF , -ALC882_FIXUP_ASUS_W2JC , -ALC882_FIXUP_ACER_ASPIRE_4930G , -ALC882_FIXUP_ACER_ASPIRE_8930G , -ALC882_FIXUP_ASPIRE_8930G_VERBS , -ALC885_FIXUP_MACPRO_GPIO , -ALC889_FIXUP_DAC_ROUTE , -ALC889_FIXUP_MBP_VREF , -ALC889_FIXUP_IMAC91_VREF , -ALC889_FIXUP_MBA11_VREF , -ALC889_FIXUP_MBA21_VREF , -ALC889_FIXUP_MP11_VREF , -ALC889_FIXUP_MP41_VREF , -ALC882_FIXUP_INV_DMIC , -ALC882_FIXUP_NO_PRIMARY_HP , -ALC887_FIXUP_ASUS_BASS , -ALC887_FIXUP_BASS_CHMAP , -ALC1220_FIXUP_GB_DUAL_CODECS , -ALC1220_FIXUP_GB_X570 , -ALC1220_FIXUP_CLEVO_P950 , -ALC1220_FIXUP_CLEVO_PB51ED , -ALC1220_FIXUP_CLEVO_PB51ED_PINS , -ALC887_FIXUP_ASUS_AUDIO , -ALC887_FIXUP_ASUS_HMIC , -ALCS1200A_FIXUP_MIC_VREF , -ALC888VD_FIXUP_MIC_100VREF , -}; - -static void alc889_fixup_coef (struct hda_codec *codec, -const struct hda_fixup *fix,int action) -{ -if (action !=HDA_FIXUP_ACT_INIT ) -return ; -alc_update_coef_idx (codec,7 ,0 ,0x2030 ); -} - -/* set up GPIO at initialization */ -static void alc885_fixup_macpro_gpio (struct hda_codec *codec, -const struct hda_fixup *fix,int action) -{ -struct alc_spec *spec = codec->spec; - - spec->gpio_write_delay = true; -alc_fixup_gpio3 (codec, fix, action); -} - -/* Fix the connection of some pins for ALC889: -* At least, Acer Aspire 5935 shows the connections to DAC3/4 don't -* work correctly (bko#42740) -*/ -static void alc889_fixup_dac_route (struct hda_codec *codec, -const struct hda_fixup *fix,int action) -{ -if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { -/* fake the connections during parsing the tree */ -static const hda_nid_t conn1[] = {0x0c ,0x0d }; -static const hda_nid_t conn2[] = {0x0e ,0x0f }; -snd_hda_override_conn_list (codec,0x14 ,ARRAY_SIZE (conn1), conn1); -snd_hda_override_conn_list (codec,0x15 ,ARRAY_SIZE (conn1), conn1); -snd_hda_override_conn_list (codec,0x18 ,ARRAY_SIZE (conn2), conn2); -snd_hda_override_conn_list (codec,0x1a ,ARRAY_SIZE (conn2), conn2); - }else if (action ==HDA_FIXUP_ACT_PROBE ) { -/* restore the connections */ -static const hda_nid_t conn[] = {0x0c ,0x0d ,0x0e ,0x0f ,0x26 }; -snd_hda_override_conn_list (codec,0x14 ,ARRAY_SIZE (conn), conn); -snd_hda_override_conn_list (codec,0x15 ,ARRAY_SIZE (conn), conn); -snd_hda_override_conn_list (codec,0x18 ,ARRAY_SIZE (conn), conn); -snd_hda_override_conn_list (codec,0x1a ,ARRAY_SIZE (conn), conn); - } -} - -/* Set VREF on HP pin */ -static void alc889_fixup_mbp_vref (struct hda_codec *codec, -const struct hda_fixup *fix,int action) -{ -static const hda_nid_t nids[] = {0x14 ,0x15 ,0x19 }; -struct alc_spec *spec = codec->spec; -int i; - -if (action !=HDA_FIXUP_ACT_INIT ) -return ; -for (i =0 ; i <ARRAY_SIZE (nids); i++) { -unsigned int val =snd_hda_codec_get_pincfg (codec, nids[i]); -if (get_defcfg_device (val) !=AC_JACK_HP_OUT ) -continue ; - val =snd_hda_codec_get_pin_target (codec, nids[i]); - val |=AC_PINCTL_VREF_80 ; -snd_hda_set_pin_ctl (codec, nids[i], val); - spec->gen.keep_vref_in_automute =1 ; -break ; - } -} - -static void alc889_fixup_mac_pins (struct hda_codec *codec, -const hda_nid_t *nids,int num_nids) -{ -struct alc_spec *spec = codec->spec; -int i; - -for (i =0 ; i < num_nids; i++) { -unsigned int val; - val =snd_hda_codec_get_pin_target (codec, nids[i]); - val |=AC_PINCTL_VREF_50 ; -snd_hda_set_pin_ctl (codec, nids[i], val); - } - spec->gen.keep_vref_in_automute =1 ; -} - -/* Set VREF on speaker pins on imac91 */ -static void alc889_fixup_imac91_vref (struct hda_codec *codec, -const struct hda_fixup *fix,int action) -{ -static const hda_nid_t nids[] = {0x18 ,0x1a }; - -if (action ==HDA_FIXUP_ACT_INIT ) -alc889_fixup_mac_pins (codec, nids,ARRAY_SIZE (nids)); -} - -/* Set VREF on speaker pins on mba11 */ -static void alc889_fixup_mba11_vref (struct hda_codec *codec, -const struct hda_fixup *fix,int action) -{ -static const hda_nid_t nids[] = {0x18 }; - -if (action ==HDA_FIXUP_ACT_INIT ) -alc889_fixup_mac_pins (codec, nids,ARRAY_SIZE (nids)); -} - -/* Set VREF on speaker pins on mba21 */ -static void alc889_fixup_mba21_vref (struct hda_codec *codec, -const struct hda_fixup *fix,int action) -{ -static const hda_nid_t nids[] = {0x18 ,0x19 }; - -if (action ==HDA_FIXUP_ACT_INIT ) -alc889_fixup_mac_pins (codec, nids,ARRAY_SIZE (nids)); -} - -/* Don't take HP output as primary -* Strangely, the speaker output doesn't work on Vaio Z and some Vaio -* all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05 -*/ -static void alc882_fixup_no_primary_hp (struct hda_codec *codec, -const struct hda_fixup *fix,int action) -{ -struct alc_spec *spec = codec->spec; -if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { - spec->gen.no_primary_hp =1 ; - spec->gen.no_multi_io =1 ; - } -} - -static void alc_fixup_bass_chmap (struct hda_codec *codec, -const struct hda_fixup *fix,int action); - -/* For dual-codec configuration, we need to disable some features to avoid -* conflicts of kctls and PCM streams -*/ -static void alc_fixup_dual_codecs (struct hda_codec *codec, -const struct hda_fixup *fix,int action) -{ -struct alc_spec *spec = codec->spec; - -if (action !=HDA_FIXUP_ACT_PRE_PROBE ) -return ; -/* disable vmaster */ - spec->gen.suppress_vmaster =1 ; -/* auto-mute and auto-mic switch don't work with multiple codecs */ - spec->gen.suppress_auto_mute =1 ; - spec->gen.suppress_auto_mic =1 ; -/* disable aamix as well */ - spec->gen.mixer_nid =0 ; -/* add location prefix to avoid conflicts */ - codec->force_pin_prefix =1 ; -} - -static void rename_ctl (struct hda_codec *codec,const char *oldname, -const char *newname) -{ -struct snd_kcontrol *kctl; - - kctl =snd_hda_find_mixer_ctl (codec, oldname); -if (kctl) -snd_ctl_rename (codec->card, kctl, newname); -} -Lines of this file are not shown. View the raw message.
sound/hda/codecs/realtek/alc662.c new file +1102
-0Lines of this file are not shown. View the raw message.
sound/hda/codecs/realtek/alc680.c new file +53
-0Lines of this file are not shown. View the raw message.
sound/hda/codecs/realtek/alc861.c new file +149
-0Lines of this file are not shown. View the raw message.
sound/hda/codecs/realtek/alc861vd.c new file +123
-0Lines of this file are not shown. View the raw message.
sound/hda/codecs/realtek/alc880.c new file +497
-0Lines of this file are not shown. View the raw message.
sound/hda/codecs/realtek/alc882.c new file +847
-0Lines of this file are not shown. View the raw message.
sound/hda/codecs/realtek/realtek.c new file +2314
-0Lines of this file are not shown. View the raw message.
sound/hda/codecs/realtek/realtek.h new file +302
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
PATCH 8/27 ALSA: hda/hdmi: Split vendor codec drivers
In reply to Takashi IwaiIn the past, we unified HD-audio HDMI codec driver once with a slight hope that more vendors will follow the standard, but in reality, the driver received more and more vendor-specific code. In order to make the messy code a bit more understandable, this patch splits the HDMI codec driver into multiple drivers again.
Namely, the vendor-specific code for Intel, AMD and Nvidia are moved into the own drivers, while we split the common HDMI code to two drivers, the generic HDMI driver and the simple HDMI driver. So, now we have:
- The generic HDMI driver (snd-hda-codec-hdmi):
providing the common helpers, also supports Glenfly HDMI codecs and some other codecs that don't need vendor-specific stuff
- The simple HDMI driver (snd-hda-codec-simplehdmi):
devices with no dynamic PCM assignment and with fixed channels, mostly used by some other drivers, but this driver alone suffices for VIA HDMI codec support, too
- Intel HDMI driver (snd-hda-codec-intelhdmi):
bound with i915 / Xe DRM, based on the generic HDMI driver
- AMD/ATI HDMI driver (snd-hda-codec-atihdmi):
optionally bound with radeon / amdgpu DRM, based on the generic HDMI driver
- Nvidia HDMI driver (snd-hda-codec-nvhdmi);
optionally bound with nouveau DRM, based on the generic HDMI driver
- Legacy Nvidia HDMI driver (snd-hda-codec-nvhdmi-mcp):
for 2ch or 8ch outputs, based on the simple HDMI driver
- Nvidia Tegra HDMI driver (snd-hda-codec-tegrahdmi):
based on the generic HDMI driver
Along with the driver split, the enable_silent_stream module option is moved to snd-hda-codec-intelhdmi, too, as it's an Intel-specific feature.
Most of the changes here are just to split and move the code to different files, as well as to rename/expose the functions that are commonly used by drivers.
The silent stream handling code is slightly modified for putting the stuff into Intel driver; now a new callback "silent_stream" is defined in hdmi_ops, and it's called in silent_stream_enable() and *_disable() functions. The runtime-PM handling in silent_stream_enable() was cleaned up, and rather taking the runtime PM refcount in the silent_stream() callback appropriately, instead.
Other than that, there should be no functional changes.
--- sound/hda/codecs/Kconfig | 31 +- sound/hda/codecs/hdmi/Kconfig | 68 + sound/hda/codecs/hdmi/Makefile | 12 + sound/hda/codecs/hdmi/atihdmi.c | 606 +++++++ sound/hda/codecs/hdmi/eld.c | 172 -- sound/hda/codecs/hdmi/hdmi.c | 2465 +--------------------------- sound/hda/codecs/hdmi/hdmi_local.h | 302 ++++ sound/hda/codecs/hdmi/intelhdmi.c | 760 +++++++++ sound/hda/codecs/hdmi/nvhdmi-mcp.c | 382 +++++ sound/hda/codecs/hdmi/nvhdmi.c | 218 +++ sound/hda/codecs/hdmi/simplehdmi.c | 241 +++ sound/hda/codecs/hdmi/tegrahdmi.c | 313 ++++ sound/hda/common/hda_local.h | 4 - 13 files changed, 2993 insertions(+), 2581 deletions(-) create mode 100644 sound/hda/codecs/hdmi/Kconfig create mode 100644 sound/hda/codecs/hdmi/atihdmi.c create mode 100644 sound/hda/codecs/hdmi/hdmi_local.h create mode 100644 sound/hda/codecs/hdmi/intelhdmi.c create mode 100644 sound/hda/codecs/hdmi/nvhdmi-mcp.c create mode 100644 sound/hda/codecs/hdmi/nvhdmi.c create mode 100644 sound/hda/codecs/hdmi/simplehdmi.c create mode 100644 sound/hda/codecs/hdmi/tegrahdmi.c
sound/hda/codecs/Kconfig +1 -30
@@ -35,21 +35,6 @@ config SND_HDA_CODEC_VIA comment "Set to Y if you want auto-loading the codec driver" depends on SND_HDA=y && SND_HDA_CODEC_VIA=m -config SND_HDA_CODEC_HDMI - tristate "Build HDMI/DisplayPort HD-audio codec support" - select SND_DYNAMIC_MINORS - select SND_PCM_ELD - help - Say Y or M here to include HDMI and DisplayPort HD-audio codec - support in snd-hda-intel driver. This includes all AMD/ATI, - Intel and Nvidia HDMI/DisplayPort codecs. - - Note that this option mandatorily enables CONFIG_SND_DYNAMIC_MINORS - to assure the multiple streams for DP-MST support. - -comment "Set to Y if you want auto-loading the codec driver" - depends on SND_HDA=y && SND_HDA_CODEC_HDMI=m - config SND_HDA_CODEC_CONEXANT tristate "Build Conexant HD-audio codec support" select SND_HDA_GENERIC
@@ -134,23 +119,9 @@ config SND_HDA_GENERIC comment "Set to Y if you want auto-loading the codec driver" depends on SND_HDA=y && SND_HDA_GENERIC=m -config SND_HDA_INTEL_HDMI_SILENT_STREAM - bool "Enable Silent Stream always for HDMI" - depends on SND_HDA_INTEL - help - Say Y to enable HD-Audio Keep Alive (KAE) aka Silent Stream - for HDMI on hardware that supports the feature. - - When enabled, the HDMI/DisplayPort codec will continue to provide - a continuous clock and a valid but silent data stream to - any connected external receiver. This allows to avoid gaps - at start of playback. Many receivers require multiple seconds - to start playing audio after the clock has been stopped. - This feature can impact power consumption as resources - are kept reserved both at transmitter and receiver. - source "sound/hda/codecs/realtek/Kconfig" source "sound/hda/codecs/cirrus/Kconfig" +source "sound/hda/codecs/hdmi/Kconfig" source "sound/hda/codecs/side-codecs/Kconfig" endif # SND_HDA
sound/hda/codecs/hdmi/Kconfig new file +68 -0
68 lines not on this page · raw message
sound/hda/codecs/hdmi/Makefile +12 -0
@@ -2,5 +2,17 @@ subdir-ccflags-y += -I$(src)/../../common snd-hda-codec-hdmi-y := hdmi.o eld.o +snd-hda-codec-simplehdmi-y := simplehdmi.o +snd-hda-codec-intelhdmi-y := intelhdmi.o +snd-hda-codec-atihdmi-y := atihdmi.o +snd-hda-codec-nvhdmi-y := nvhdmi.o +snd-hda-codec-nvhdmi-mcp-y := nvhdmi-mcp.o +snd-hda-codec-tegrahdmi-y := tegrahdmi.o obj-$(CONFIG_SND_HDA_CODEC_HDMI) += snd-hda-codec-hdmi.o +obj-$(CONFIG_SND_HDA_CODEC_HDMI_SIMPLE) += snd-hda-codec-simplehdmi.o +obj-$(CONFIG_SND_HDA_CODEC_HDMI_INTEL) += snd-hda-codec-intelhdmi.o +obj-$(CONFIG_SND_HDA_CODEC_HDMI_ATI) += snd-hda-codec-atihdmi.o +obj-$(CONFIG_SND_HDA_CODEC_HDMI_NVIDIA) += snd-hda-codec-nvhdmi.o +obj-$(CONFIG_SND_HDA_CODEC_HDMI_NVIDIA_MCP) += snd-hda-codec-nvhdmi-mcp.o +obj-$(CONFIG_SND_HDA_CODEC_HDMI_TEGRA) += snd-hda-codec-tegrahdmi.o
sound/hda/codecs/hdmi/atihdmi.c new file +606 -0
606 lines not on this page · raw message
sound/hda/codecs/hdmi/eld.c +0 -172
181 lines not on this page · raw message
sound/hda/codecs/hdmi/hdmi.c +90 -2375
2,083 lines not on this page · raw message
sound/hda/codecs/hdmi/hdmi_local.h new file +302 -0
302 lines not on this page · raw message
sound/hda/codecs/hdmi/intelhdmi.c new file +760 -0
760 lines not on this page · raw message
sound/hda/codecs/hdmi/nvhdmi-mcp.c new file +382 -0
382 lines not on this page · raw message
sound/hda/codecs/hdmi/nvhdmi.c new file +218 -0
218 lines not on this page · raw message
sound/hda/codecs/hdmi/simplehdmi.c new file +241 -0
241 lines not on this page · raw message
sound/hda/codecs/hdmi/tegrahdmi.c new file +313 -0
313 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.50.0
Part of the diff is not shown here. View the raw message.
PATCH 9/27 ALSA: hda: Introduce hda_codec_driver ops
In reply to Takashi IwaiUntil now, we use "patch_ops" embedded in hda_codec object for defining the callbacks that are used in various places to manage HD-audio codec. But from the device driver POV, this should have been rather the driver ops, instead of the callbacks in the codec object.
This patch defines the driver ops for HD-audio codec driver as the replacement. We reuse the same struct hda_codec_ops, and this is put as hda_codec_driver.ops. When the driver->ops callbacks are defined, they are called primarily instead of codec->patch_ops callbacks.
With converting to the driver ops, there is no need to pass the ugly patch_ops handling in hda_device_id tables. That is, driver_data field of hda_device_id becomes really optional and it can be used for passing the codec-specific data (e.g. specifying a model).
The codec entries after the conversion should be with HDA_CODEC_ID() and co, instead of the former HDA_CODEC_ENTRY().
Once after converting all codec drivers to use driver ops, we can get rid of codec patch_ops.
--- include/sound/hda_codec.h | 26 +++++++++++++++-- sound/hda/common/bind.c | 27 +++++++++++++---- sound/hda/common/codec.c | 56 ++++++++++++++++++++++++++---------- sound/hda/common/hda_local.h | 11 +++++++ sound/soc/codecs/hda.c | 27 +++++++++++------ sound/soc/codecs/hdac_hda.c | 28 +++++++++++++----- 6 files changed, 137 insertions(+), 38 deletions(-)
include/sound/hda_codec.h +24 -2
@@ -27,6 +27,7 @@ struct hda_beep;struct hda_codec ;struct hda_pcm ;struct hda_pcm_stream ; +struct hda_codec_ops ;/* * codec bus
@@ -79,6 +80,17 @@ typedef int (*hda_codec_patch_t)(struct hda_codec *);#define HDA_CODEC_ID_GENERIC_HDMI 0x00000101#define HDA_CODEC_ID_GENERIC 0x00000201 +#define HDA_CODEC_ID_REV_MODEL (_vid, _rev, _name, _model) \ + { .vendor_id = (_vid), .rev_id = (_rev), .name = (_name), \ + .api_version = HDA_DEV_LEGACY, .driver_data = (_model) } +#define HDA_CODEC_ID_MODEL (_vid, _name, _model) \ + HDA_CODEC_ID_REV_MODEL(_vid, 0, _name, _model) +#define HDA_CODEC_ID_REV (_vid, _rev, _name) \ + HDA_CODEC_ID_REV_MODEL(_vid, _rev, _name, 0) +#define HDA_CODEC_ID (_vid, _name) \ + HDA_CODEC_ID_REV(_vid, 0, _name) + +/* old macros for patch_ops -- to be deprecated */ #define HDA_CODEC_REV_ENTRY (_vid, _rev, _name, _patch) \ { .vendor_id = (_vid), .rev_id = (_rev), .name = (_name), \ .api_version = HDA_DEV_LEGACY, \
@@ -89,8 +101,12 @@ typedef int (*hda_codec_patch_t)(struct hda_codec *);struct hda_codec_driver {struct hdac_driver core;const struct hda_device_id *id; +const struct hda_codec_ops *ops; }; +#define hda_codec_to_driver (codec) \ + container_of((codec)->core.dev.driver, struct hda_codec_driver, core.driver) +int __hda_codec_driver_register (struct hda_codec_driver *drv,const char *name,struct module *owner);#define hda_codec_driver_register (drv) \
@@ -102,6 +118,8 @@ void hda_codec_driver_unregister(struct hda_codec_driver *drv);/* ops set by the preset patch */ struct hda_codec_ops { +int (*probe)(struct hda_codec *codec,const struct hda_device_id *id); +void (*remove)(struct hda_codec *codec);int (*build_controls)(struct hda_codec *codec);int (*build_pcms)(struct hda_codec *codec);int (*init)(struct hda_codec *codec);
@@ -184,7 +202,7 @@ struct hda_codec {/* set by patch */ struct hda_codec_ops patch_ops; -/* PCM to create, set by patch_ops.build_pcms callback */ +/* PCM to create, set by hda_codec_ops.build_pcms callback */ struct list_head pcm_list_head;refcount_t pcm_ref;wait_queue_head_t remove_sleep;
@@ -478,7 +496,11 @@ extern const struct dev_pm_ops hda_codec_driver_pm;static inline int hda_call_check_power_status (struct hda_codec *codec,hda_nid_t nid) { -if (codec->patch_ops.check_power_status) +struct hda_codec_driver *driver =hda_codec_to_driver (codec); + +if (driver->ops && driver->ops->check_power_status) +return driver->ops->check_power_status (codec, nid); +else if (codec->patch_ops.check_power_status)return codec->patch_ops.check_power_status (codec, nid);return 0 ; }
sound/hda/common/bind.c +21 -6
@@ -42,6 +42,7 @@ static int hda_codec_match(struct hdac_device *dev, const struct hdac_driver *drstatic void hda_codec_unsol_event (struct hdac_device *dev,unsigned int ev) { struct hda_codec *codec = container_of(dev, struct hda_codec, core); +struct hda_codec_driver *driver =hda_codec_to_driver (codec);/* ignore unsol events during shutdown */ if (codec->card->shutdown || codec->bus->shutdown)
@@ -51,7 +52,9 @@ static void hda_codec_unsol_event(struct hdac_device *dev, unsigned int ev)if (codec->core.dev.power.power_state.event !=PM_EVENT_ON )return ; -if (codec->patch_ops.unsol_event) +if (driver->ops && driver->ops->unsol_event) + driver->ops->unsol_event (codec, ev); +else if (codec->patch_ops.unsol_event) codec->patch_ops.unsol_event (codec, ev); }
@@ -87,6 +90,7 @@ static int hda_codec_driver_probe(struct device *dev) {struct hda_codec *codec =dev_to_hda_codec (dev);struct module *owner = dev->driver->owner; +struct hda_codec_driver *driver =hda_codec_to_driver (codec);hda_codec_patch_t patch;int err;
@@ -111,11 +115,17 @@ static int hda_codec_driver_probe(struct device *dev) goto error; } - patch = (hda_codec_patch_t )codec->preset->driver_data; -if (patch) { - err =patch (codec); +if (driver->ops && driver->ops->probe) { + err = driver->ops->probe (codec, codec->preset);if (err <0 ) goto error_module_put; + }else { + patch = (hda_codec_patch_t )codec->preset->driver_data; +if (patch) { + err =patch (codec); +if (err <0 ) + goto error_module_put; + } } err =snd_hda_codec_build_pcms (codec);
@@ -136,7 +146,9 @@ static int hda_codec_driver_probe(struct device *dev)return 0 ; error_module: -if (codec->patch_ops.free) +if (driver->ops && driver->ops->remove) + driver->ops->remove (codec); +else if (codec->patch_ops.free) codec->patch_ops.free (codec); error_module_put:module_put (owner);
@@ -150,6 +162,7 @@ static int hda_codec_driver_probe(struct device *dev)static int hda_codec_driver_remove (struct device *dev) {struct hda_codec *codec =dev_to_hda_codec (dev); +struct hda_codec_driver *driver =hda_codec_to_driver (codec);if (codec->bus->core.ext_ops) {if (WARN_ON (!codec->bus->core.ext_ops->hdev_detach))
@@ -163,7 +176,9 @@ static int hda_codec_driver_remove(struct device *dev)wait_event (codec->remove_sleep, !refcount_read (&codec->pcm_ref));snd_power_sync_ref (codec->bus->card); -if (codec->patch_ops.free) +if (driver->ops && driver->ops->remove) + driver->ops->remove (codec); +else if (codec->patch_ops.free) codec->patch_ops.free (codec);snd_hda_codec_cleanup_for_unbind (codec); codec->preset =NULL ;
sound/hda/common/codec.c +41 -15
139 lines not on this page · raw message
sound/hda/common/hda_local.h +11 -0
@@ -652,6 +652,17 @@ unsigned int snd_hda_codec_eapd_power_filter(struct hda_codec *codec,void snd_hda_codec_shutdown (struct hda_codec *codec); +static inline int snd_hda_codec_init (struct hda_codec *codec) +{ +struct hda_codec_driver *driver =hda_codec_to_driver (codec); + +if (driver->ops && driver->ops->init) +return driver->ops->init (codec); +else if (codec->patch_ops.init) +return codec->patch_ops.init (codec); +return 0 ; +} +/* * AMP control callbacks */
sound/soc/codecs/hda.c +19 -8
@@ -173,6 +173,7 @@ EXPORT_SYMBOL_GPL(hda_codec_probe_complete);static int hda_codec_probe (struct snd_soc_component *component) {struct hda_codec *codec =dev_to_hda_codec (component->dev); +struct hda_codec_driver *driver =hda_codec_to_driver (codec);struct hdac_device *hdev = &codec->core;struct hdac_bus *bus = hdev->bus;struct hdac_ext_link *hlink;
@@ -214,14 +215,19 @@ static int hda_codec_probe(struct snd_soc_component *component) goto err; } - patch = (hda_codec_patch_t )codec->preset->driver_data; -if (!patch) { -dev_err (&hdev->dev,"no patch specified\n" ); - ret = -EINVAL ; - goto err; +if (driver->ops && driver->ops->probe) { + ret = driver->ops->probe (codec, codec->preset); + }else { + patch = (hda_codec_patch_t )codec->preset->driver_data; +if (!patch) { +dev_err (&hdev->dev,"no patch specified\n" ); + ret = -EINVAL ; + goto err; + } + + ret =patch (codec); } - ret =patch (codec);if (ret <0 ) {dev_err (&hdev->dev,"codec init failed: %d\n" , ret); goto err;
@@ -252,7 +258,9 @@ static int hda_codec_probe(struct snd_soc_component *component) complete_err:hda_codec_unregister_dais (codec, component); parse_pcms_err: -if (codec->patch_ops.free) +if (driver->ops && driver->ops->remove) + driver->ops->remove (codec); +else if (codec->patch_ops.free) codec->patch_ops.free (codec); err:snd_hda_codec_cleanup_for_unbind (codec);
@@ -271,6 +279,7 @@ static int hda_codec_probe(struct snd_soc_component *component)static void hda_codec_remove (struct snd_soc_component *component) {struct hda_codec *codec =dev_to_hda_codec (component->dev); +struct hda_codec_driver *driver =hda_codec_to_driver (codec);struct hdac_device *hdev = &codec->core;struct hdac_bus *bus = hdev->bus;struct hdac_ext_link *hlink;
@@ -281,7 +290,9 @@ static void hda_codec_remove(struct snd_soc_component *component)hda_codec_unregister_dais (codec, component); -if (codec->patch_ops.free) +if (driver->ops && driver->ops->remove) + driver->ops->remove (codec); +else if (codec->patch_ops.free) codec->patch_ops.free (codec);snd_hda_codec_cleanup_for_unbind (codec);
sound/soc/codecs/hdac_hda.c +21 -7
@@ -409,6 +409,7 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component)snd_soc_component_get_dapm (component);struct hdac_device *hdev = &hda_pvt->codec->core;struct hda_codec *hcodec = hda_pvt->codec; +struct hda_codec_driver *driver =hda_codec_to_driver (hcodec);struct hdac_ext_link *hlink;hda_codec_patch_t patch;int ret;
@@ -484,15 +485,23 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component) goto error_pm; } - patch = (hda_codec_patch_t )hcodec->preset->driver_data; -if (patch) { - ret =patch (hcodec); +if (driver->ops && driver->ops->probe) { + ret = driver->ops->probe (hcodec, hcodec->preset);if (ret <0 ) { -dev_err (&hdev->dev,"%s: patch failed %d\n" , __func__, ret); +dev_err (&hdev->dev,"%s: probe failed %d\n" , __func__, ret); goto error_regmap; } }else { -dev_dbg (&hdev->dev,"%s: no patch file found\n" , __func__); + patch = (hda_codec_patch_t )hcodec->preset->driver_data; +if (patch) { + ret =patch (hcodec); +if (ret <0 ) { +dev_err (&hdev->dev,"%s: patch failed %d\n" , __func__, ret); + goto error_regmap; + } + }else { +dev_dbg (&hdev->dev,"%s: no patch file found\n" , __func__); + } } ret =snd_hda_codec_parse_pcms (hcodec);
@@ -531,7 +540,9 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component)return 0 ; error_patch: -if (hcodec->patch_ops.free) +if (driver->ops && driver->ops->remove) + driver->ops->remove (hcodec); +else if (hcodec->patch_ops.free) hcodec->patch_ops.free (hcodec); error_regmap:snd_hdac_regmap_exit (hdev);
@@ -548,6 +559,7 @@ static void hdac_hda_codec_remove(struct snd_soc_component *component)snd_soc_component_get_drvdata (component);struct hdac_device *hdev = &hda_pvt->codec->core;struct hda_codec *codec = hda_pvt->codec; +struct hda_codec_driver *driver =hda_codec_to_driver (codec);struct hdac_ext_link *hlink =NULL ; hlink =snd_hdac_ext_bus_get_hlink_by_name (hdev->bus,dev_name (&hdev->dev));
@@ -559,7 +571,9 @@ static void hdac_hda_codec_remove(struct snd_soc_component *component)pm_runtime_disable (&hdev->dev);snd_hdac_ext_bus_link_put (hdev->bus, hlink); -if (codec->patch_ops.free) +if (driver->ops && driver->ops->remove) + driver->ops->remove (codec); +else if (codec->patch_ops.free) codec->patch_ops.free (codec);snd_hda_codec_cleanup_for_unbind (codec);
Signature · 1 line
2.50.0
PATCH 10/27 ALSA: hda/generic: Rewrite to new probe method
In reply to Takashi IwaiConvert the generic HD-audio codec driver to use the new hda_codec_ops probe. No functional changes.
--- sound/hda/codecs/generic.c | 43 +++++++++++++++++++++++--------------- sound/hda/codecs/generic.h | 3 ++- 2 files changed, 28 insertions(+), 18 deletions(-)
sound/hda/codecs/generic.c +26 -17
@@ -4946,7 +4946,7 @@ static void mute_all_mixer_nid(struct hda_codec *codec, hda_nid_t mix)* @nid: audio widget * @on: power on/off flag * -* Set this in patch_ops.stream_pm. Only valid with power_save_node flag. +* Set this in hda_codec_ops.stream_pm. Only valid with power_save_node flag. */ void snd_hda_gen_stream_pm (struct hda_codec *codec,hda_nid_t nid,bool on) {
@@ -5230,7 +5230,7 @@ static const char * const follower_pfxs[] = {* snd_hda_gen_build_controls - Build controls from the parsed results * @codec: the HDA codec * -* Pass this to build_controls patch_ops. +* Pass this to build_controls hda_codec_ops. */ int snd_hda_gen_build_controls (struct hda_codec *codec) {
@@ -5743,7 +5743,7 @@ static void setup_pcm_stream(struct hda_pcm_stream *str,* snd_hda_gen_build_pcms - build PCM streams based on the parsed results * @codec: the HDA codec * -* Pass this to build_pcms patch_ops. +* Pass this to build_pcms hda_codec_ops. */ int snd_hda_gen_build_pcms (struct hda_codec *codec) {
@@ -6032,7 +6032,7 @@ static void clear_unsol_on_unused_pins(struct hda_codec *codec)* snd_hda_gen_init - initialize the generic spec * @codec: the HDA codec * -* This can be put as patch_ops init function. +* This can be put as hda_codec_ops init function. */ int snd_hda_gen_init (struct hda_codec *codec) {
@@ -6070,26 +6070,26 @@ int snd_hda_gen_init(struct hda_codec *codec)EXPORT_SYMBOL_GPL (snd_hda_gen_init);/** -* snd_hda_gen_free - free the generic spec +* snd_hda_gen_remove - free the generic spec * @codec: the HDA codec * -* This can be put as patch_ops free function. +* This can be put as hda_codec_ops remove function. */ -void snd_hda_gen_free (struct hda_codec *codec) +void snd_hda_gen_remove (struct hda_codec *codec) {snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_FREE );snd_hda_gen_spec_free (codec->spec);kfree (codec->spec); codec->spec =NULL ; } -EXPORT_SYMBOL_GPL (snd_hda_gen_free); +EXPORT_SYMBOL_GPL (snd_hda_gen_remove);/** * snd_hda_gen_check_power_status - check the loopback power save state * @codec: the HDA codec * @nid: NID to inspect * -* This can be put as patch_ops check_power_status function. +* This can be put as hda_codec_ops check_power_status function. */ int snd_hda_gen_check_power_status (struct hda_codec *codec,hda_nid_t nid) {
@@ -6112,11 +6112,8 @@ static const struct hda_codec_ops generic_patch_ops = { .check_power_status = snd_hda_gen_check_power_status, }; -/* -* snd_hda_parse_generic_codec - Generic codec parser -* @codec: the HDA codec -*/ -static int snd_hda_parse_generic_codec (struct hda_codec *codec) +static int snd_hda_gen_probe (struct hda_codec *codec, +const struct hda_device_id *id) {struct hda_gen_spec *spec;int err;
@@ -6139,19 +6136,31 @@ static int snd_hda_parse_generic_codec(struct hda_codec *codec)return 0 ; error: -snd_hda_gen_free (codec); +snd_hda_gen_remove (codec);return err; } +static const struct hda_codec_ops generic_codec_ops = { + .probe = snd_hda_gen_probe, + .remove = snd_hda_gen_remove, + .build_controls = snd_hda_gen_build_controls, + .build_pcms = snd_hda_gen_build_pcms, + .init = snd_hda_gen_init, + .unsol_event = snd_hda_jack_unsol_event, + .check_power_status = snd_hda_gen_check_power_status, + .stream_pm = snd_hda_gen_stream_pm, +}; +static const struct hda_device_id snd_hda_id_generic[] = { -HDA_CODEC_ENTRY (0x1af40021 ,"Generic" , snd_hda_parse_generic_codec),/* QEMU */ -HDA_CODEC_ENTRY (HDA_CODEC_ID_GENERIC ,"Generic" , snd_hda_parse_generic_codec), +HDA_CODEC_ID (0x1af40021 ,"Generic" ),/* QEMU */ +HDA_CODEC_ID (HDA_CODEC_ID_GENERIC ,"Generic" ), {}/* terminator */ };MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_generic);static struct hda_codec_driver generic_driver = { .id = snd_hda_id_generic, + .ops = &generic_codec_ops, };module_hda_codec_driver (generic_driver);
sound/hda/codecs/generic.h +2 -1
@@ -311,7 +311,8 @@ enum {int snd_hda_gen_spec_init (struct hda_gen_spec *spec);int snd_hda_gen_init (struct hda_codec *codec); -void snd_hda_gen_free (struct hda_codec *codec); +void snd_hda_gen_remove (struct hda_codec *codec); +#define snd_hda_gen_free snd_hda_gen_removeint snd_hda_get_path_idx (struct hda_codec *codec,struct nid_path *path);struct nid_path *snd_hda_get_path_from_idx (struct hda_codec *codec,int idx);
Signature · 1 line
2.50.0
PATCH 11/27 ALSA: hda/realtek: Rewrite to new probe method
In reply to Takashi IwaiConvert the Realtek codec drivers to use the new hda_codec_ops probe. No functional changes.
--- sound/hda/codecs/realtek/alc260.c | 20 ++++- sound/hda/codecs/realtek/alc262.c | 20 ++++- sound/hda/codecs/realtek/alc268.c | 22 +++++- sound/hda/codecs/realtek/alc269.c | 111 +++++++++++++++------------- sound/hda/codecs/realtek/alc662.c | 42 +++++++---- sound/hda/codecs/realtek/alc680.c | 20 ++++- sound/hda/codecs/realtek/alc861.c | 22 +++++- sound/hda/codecs/realtek/alc861vd.c | 22 +++++- sound/hda/codecs/realtek/alc880.c | 24 ++++-- sound/hda/codecs/realtek/alc882.c | 48 +++++++----- sound/hda/codecs/realtek/realtek.c | 17 +---- sound/hda/codecs/realtek/realtek.h | 4 - 12 files changed, 244 insertions(+), 128 deletions(-)
sound/hda/codecs/realtek/alc260.c +17 -3
@@ -211,7 +211,7 @@ static const struct hda_model_fixup alc260_fixup_models[] = {/* */ -static int patch_alc260 (struct hda_codec *codec) +static int alc260_probe (struct hda_codec *codec,const struct hda_device_id *id) {struct alc_spec *spec;int err;
@@ -252,15 +252,28 @@ static int patch_alc260(struct hda_codec *codec)return 0 ; error: -alc_free (codec); +snd_hda_gen_remove (codec);return err; } +static const struct hda_codec_ops alc260_codec_ops = { + .probe = alc260_probe, + .remove = snd_hda_gen_remove, + .build_controls = alc_build_controls, + .build_pcms = snd_hda_gen_build_pcms, + .init = alc_init, + .unsol_event = snd_hda_jack_unsol_event, + .resume = alc_resume, + .suspend = alc_suspend, + .check_power_status = snd_hda_gen_check_power_status, + .stream_pm = snd_hda_gen_stream_pm, +}; +/* * driver entries */ static const struct hda_device_id snd_hda_id_alc260[] = { -HDA_CODEC_ENTRY (0x10ec0260 ,"ALC260" , patch_alc260), +HDA_CODEC_ID (0x10ec0260 ,"ALC260" ), {}/* terminator */ };MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_alc260);
@@ -271,6 +284,7 @@ MODULE_IMPORT_NS("SND_HDA_CODEC_REALTEK");static struct hda_codec_driver alc260_driver = { .id = snd_hda_id_alc260, + .ops = &alc260_codec_ops, };module_hda_codec_driver (alc260_driver);
sound/hda/codecs/realtek/alc262.c +17 -3
@@ -126,7 +126,7 @@ static const struct hda_model_fixup alc262_fixup_models[] = {/* */ -static int patch_alc262 (struct hda_codec *codec) +static int alc262_probe (struct hda_codec *codec,const struct hda_device_id *id) {struct alc_spec *spec;int err;
@@ -175,15 +175,28 @@ static int patch_alc262(struct hda_codec *codec)return 0 ; error: -alc_free (codec); +snd_hda_gen_remove (codec);return err; } +static const struct hda_codec_ops alc262_codec_ops = { + .probe = alc262_probe, + .remove = snd_hda_gen_remove, + .build_controls = alc_build_controls, + .build_pcms = snd_hda_gen_build_pcms, + .init = alc_init, + .unsol_event = snd_hda_jack_unsol_event, + .resume = alc_resume, + .suspend = alc_suspend, + .check_power_status = snd_hda_gen_check_power_status, + .stream_pm = snd_hda_gen_stream_pm, +}; +/* * driver entries */ static const struct hda_device_id snd_hda_id_alc262[] = { -HDA_CODEC_ENTRY (0x10ec0262 ,"ALC262" , patch_alc262), +HDA_CODEC_ID (0x10ec0262 ,"ALC262" ), {}/* terminator */ };MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_alc262);
@@ -194,6 +207,7 @@ MODULE_IMPORT_NS("SND_HDA_CODEC_REALTEK");static struct hda_codec_driver alc262_driver = { .id = snd_hda_id_alc262, + .ops = &alc262_codec_ops, };module_hda_codec_driver (alc262_driver);
sound/hda/codecs/realtek/alc268.c +18 -4
@@ -101,7 +101,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec)/* */ -static int patch_alc268 (struct hda_codec *codec) +static int alc268_probe (struct hda_codec *codec,const struct hda_device_id *id) {struct alc_spec *spec;int i, err;
@@ -151,16 +151,29 @@ static int patch_alc268(struct hda_codec *codec)return 0 ; error: -alc_free (codec); +snd_hda_gen_remove (codec);return err; } +static const struct hda_codec_ops alc268_codec_ops = { + .probe = alc268_probe, + .remove = snd_hda_gen_remove, + .build_controls = alc_build_controls, + .build_pcms = snd_hda_gen_build_pcms, + .init = alc_init, + .unsol_event = snd_hda_jack_unsol_event, + .resume = alc_resume, + .suspend = alc_suspend, + .check_power_status = snd_hda_gen_check_power_status, + .stream_pm = snd_hda_gen_stream_pm, +}; +/* * driver entries */ static const struct hda_device_id snd_hda_id_alc268[] = { -HDA_CODEC_ENTRY (0x10ec0267 ,"ALC267" , patch_alc268), -HDA_CODEC_ENTRY (0x10ec0268 ,"ALC268" , patch_alc268), +HDA_CODEC_ID (0x10ec0267 ,"ALC267" ), +HDA_CODEC_ID (0x10ec0268 ,"ALC268" ), {}/* terminator */ };MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_alc268);
@@ -171,6 +184,7 @@ MODULE_IMPORT_NS("SND_HDA_CODEC_REALTEK");static struct hda_codec_driver alc268_driver = { .id = snd_hda_id_alc268, + .ops = &alc268_codec_ops, };module_hda_codec_driver (alc268_driver);
sound/hda/codecs/realtek/alc269.c +61 -50
158 lines not on this page · raw message
sound/hda/codecs/realtek/alc662.c +28 -14
67 lines not on this page · raw message
sound/hda/codecs/realtek/alc680.c +17 -3
@@ -14,7 +14,7 @@ static int alc680_parse_auto_config(struct hda_codec *codec)/* */ -static int patch_alc680 (struct hda_codec *codec) +static int alc680_probe (struct hda_codec *codec,const struct hda_device_id *id) {int err;
@@ -26,18 +26,31 @@ static int patch_alc680(struct hda_codec *codec)/* automatic parse from the BIOS config */ err =alc680_parse_auto_config (codec);if (err <0 ) { -alc_free (codec); +snd_hda_gen_remove (codec);return err; }return 0 ; } +static const struct hda_codec_ops alc680_codec_ops = { + .probe = alc680_probe, + .remove = snd_hda_gen_remove, + .build_controls = alc_build_controls, + .build_pcms = snd_hda_gen_build_pcms, + .init = alc_init, + .unsol_event = snd_hda_jack_unsol_event, + .resume = alc_resume, + .suspend = alc_suspend, + .check_power_status = snd_hda_gen_check_power_status, + .stream_pm = snd_hda_gen_stream_pm, +}; +/* * driver entries */ static const struct hda_device_id snd_hda_id_alc680[] = { -HDA_CODEC_ENTRY (0x10ec0680 ,"ALC680" , patch_alc680), +HDA_CODEC_ID (0x10ec0680 ,"ALC680" ), {}/* terminator */ };MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_alc680);
@@ -48,6 +61,7 @@ MODULE_IMPORT_NS("SND_HDA_CODEC_REALTEK");static struct hda_codec_driver alc680_driver = { .id = snd_hda_id_alc680, + .ops = &alc680_codec_ops, };module_hda_codec_driver (alc680_driver);
sound/hda/codecs/realtek/alc861.c +18 -4
@@ -88,7 +88,7 @@ static const struct hda_quirk alc861_fixup_tbl[] = {/* */ -static int patch_alc861 (struct hda_codec *codec) +static int alc861_probe (struct hda_codec *codec,const struct hda_device_id *id) {struct alc_spec *spec;int err;
@@ -124,16 +124,29 @@ static int patch_alc861(struct hda_codec *codec)return 0 ; error: -alc_free (codec); +snd_hda_gen_remove (codec);return err; } +static const struct hda_codec_ops alc861_codec_ops = { + .probe = alc861_probe, + .remove = snd_hda_gen_remove, + .build_controls = alc_build_controls, + .build_pcms = snd_hda_gen_build_pcms, + .init = alc_init, + .unsol_event = snd_hda_jack_unsol_event, + .resume = alc_resume, + .suspend = alc_suspend, + .check_power_status = snd_hda_gen_check_power_status, + .stream_pm = snd_hda_gen_stream_pm, +}; +/* * driver entries */ static const struct hda_device_id snd_hda_id_alc861[] = { -HDA_CODEC_REV_ENTRY (0x10ec0861 ,0x100340 ,"ALC660" , patch_alc861), -HDA_CODEC_ENTRY (0x10ec0861 ,"ALC861" , patch_alc861), +HDA_CODEC_ID_REV (0x10ec0861 ,0x100340 ,"ALC660" ), +HDA_CODEC_ID (0x10ec0861 ,"ALC861" ), {}/* terminator */ };MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_alc861);
@@ -144,6 +157,7 @@ MODULE_IMPORT_NS("SND_HDA_CODEC_REALTEK");static struct hda_codec_driver alc861_driver = { .id = snd_hda_id_alc861, + .ops = &alc861_codec_ops, };module_hda_codec_driver (alc861_driver);
sound/hda/codecs/realtek/alc861vd.c +18 -4
@@ -62,7 +62,7 @@ static const struct hda_quirk alc861vd_fixup_tbl[] = {/* */ -static int patch_alc861vd (struct hda_codec *codec) +static int alc861vd_probe (struct hda_codec *codec,const struct hda_device_id *id) {struct alc_spec *spec;int err;
@@ -98,16 +98,29 @@ static int patch_alc861vd(struct hda_codec *codec)return 0 ; error: -alc_free (codec); +snd_hda_gen_remove (codec);return err; } +static const struct hda_codec_ops alc861vd_codec_ops = { + .probe = alc861vd_probe, + .remove = snd_hda_gen_remove, + .build_controls = alc_build_controls, + .build_pcms = snd_hda_gen_build_pcms, + .init = alc_init, + .unsol_event = snd_hda_jack_unsol_event, + .resume = alc_resume, + .suspend = alc_suspend, + .check_power_status = snd_hda_gen_check_power_status, + .stream_pm = snd_hda_gen_stream_pm, +}; +/* * driver entries */ static const struct hda_device_id snd_hda_id_alc861vd[] = { -HDA_CODEC_ENTRY (0x10ec0660 ,"ALC660-VD" , patch_alc861vd), -HDA_CODEC_ENTRY (0x10ec0862 ,"ALC861-VD" , patch_alc861vd), +HDA_CODEC_ID (0x10ec0660 ,"ALC660-VD" ), +HDA_CODEC_ID (0x10ec0862 ,"ALC861-VD" ), {}/* terminator */ };MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_alc861vd);
@@ -118,6 +131,7 @@ MODULE_IMPORT_NS("SND_HDA_CODEC_REALTEK");static struct hda_codec_driver alc861vd_driver = { .id = snd_hda_id_alc861vd, + .ops = &alc861vd_codec_ops, };module_hda_codec_driver (alc861vd_driver);
sound/hda/codecs/realtek/alc880.c +18 -6
@@ -434,9 +434,9 @@ static const struct hda_model_fixup alc880_fixup_models[] = {/* -* OK, here we have finally the patch for ALC880 +* OK, here we have finally the probe for ALC880 */ -static int patch_alc880 (struct hda_codec *codec) +static int alc880_probe (struct hda_codec *codec,const struct hda_device_id *id) {struct alc_spec *spec;int err;
@@ -449,8 +449,6 @@ static int patch_alc880(struct hda_codec *codec) spec->gen.need_dac_fix =1 ; spec->gen.beep_nid =0x01 ; - codec->patch_ops.unsol_event = alc880_unsol_event; -alc_pre_init (codec); snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
@@ -473,15 +471,28 @@ static int patch_alc880(struct hda_codec *codec)return 0 ; error: -alc_free (codec); +snd_hda_gen_remove (codec);return err; } +static const struct hda_codec_ops alc880_codec_ops = { + .probe = alc880_probe, + .remove = snd_hda_gen_remove, + .build_controls = alc_build_controls, + .build_pcms = snd_hda_gen_build_pcms, + .init = alc_init, + .unsol_event = alc880_unsol_event, + .resume = alc_resume, + .suspend = alc_suspend, + .check_power_status = snd_hda_gen_check_power_status, + .stream_pm = snd_hda_gen_stream_pm, +}; +/* * driver entries */ static const struct hda_device_id snd_hda_id_alc880[] = { -HDA_CODEC_ENTRY (0x10ec0880 ,"ALC880" , patch_alc880), +HDA_CODEC_ID (0x10ec0880 ,"ALC880" ), {}/* terminator */ };MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_alc880);
@@ -492,6 +503,7 @@ MODULE_IMPORT_NS("SND_HDA_CODEC_REALTEK");static struct hda_codec_driver alc880_driver = { .id = snd_hda_id_alc880, + .ops = &alc880_codec_ops, };module_hda_codec_driver (alc880_driver);
sound/hda/codecs/realtek/alc882.c +31 -17
73 lines not on this page · raw message
sound/hda/codecs/realtek/realtek.c +1 -16
@@ -862,27 +862,13 @@ int alc_resume(struct hda_codec *codec)if (!spec->no_depop_delay)msleep (150 );/* to avoid pop noise */ - codec->patch_ops.init (codec); +snd_hda_codec_init (codec);snd_hda_regmap_sync (codec);hda_call_check_power_status (codec,0x01 );return 0 ; }EXPORT_SYMBOL_NS_GPL (alc_resume,"SND_HDA_CODEC_REALTEK" ); -/* -*/ -const struct hda_codec_ops alc_patch_ops = { - .build_controls = alc_build_controls, - .build_pcms = snd_hda_gen_build_pcms, - .init = alc_init, - .free = alc_free, - .unsol_event = snd_hda_jack_unsol_event, - .resume = alc_resume, - .suspend = alc_suspend, - .check_power_status = snd_hda_gen_check_power_status, -}; -EXPORT_SYMBOL_NS_GPL (alc_patch_ops,"SND_HDA_CODEC_REALTEK" ); -/* * Rename codecs appropriately from COEF value or subvendor id */
@@ -1082,7 +1068,6 @@ int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)/* FIXME: do we need this for all Realtek codec models? */ codec->spdif_status_reset =1 ; codec->forced_resume =1 ; - codec->patch_ops = alc_patch_ops;mutex_init (&spec->coef_mutex); err =alc_codec_rename_from_preset (codec);
sound/hda/codecs/realtek/realtek.h +0 -4
@@ -226,15 +226,11 @@ void alc_power_eapd(struct hda_codec *codec);int alc_suspend (struct hda_codec *codec);int alc_resume (struct hda_codec *codec); -#define alc_free snd_hda_gen_free -int alc_parse_auto_config (struct hda_codec *codec,const hda_nid_t *ignore_nids,const hda_nid_t *ssid_nids);int alc_alloc_spec (struct hda_codec *codec,hda_nid_t mixer_nid); -extern const struct hda_codec_ops alc_patch_ops; -#define alc_codec_rename (codec, name) snd_hda_codec_set_name(codec, name)#ifdef CONFIG_SND_HDA_INPUT_BEEP
Signature · 1 line
2.50.0
ALC887-VD line-in not visible
Earlier this year I could use line-in on an Asus PRIME B350M-A motherboard, with dmesg reporting:
snd_hda_codec_realtek hdaudioC0D0: autoconfig for ALC887-VD: line_outs=1 (0x14/
0x0/0x0/0x0/0x0) type:line
snd_hda_codec_realtek hdaudioC0D0: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0) snd_hda_codec_realtek hdaudioC0D0: hp_outs=1 (0x1b/0x0/0x0/0x0/0x0) snd_hda_codec_realtek hdaudioC0D0: mono: mono_out=0x0 snd_hda_codec_realtek hdaudioC0D0: dig-out=0x11/0x0 snd_hda_codec_realtek hdaudioC0D0: inputs: snd_hda_codec_realtek hdaudioC0D0: Rear Mic=0x18 snd_hda_codec_realtek hdaudioC0D0: Front Mic=0x19 snd_hda_codec_realtek hdaudioC0D0: Line=0x1a
input: HD-Audio Generic Rear Mic as /devices/pci0000:00/0000:00:08.1/0000:08:00
.6/sound/card0/input6
input: HD-Audio Generic Front Mic as /devices/pci0000:00/0000:00:08.1/0000:08:0
0.6/sound/card0/input7
input: HD-Audio Generic Line as /devices/pci0000:00/0000:00:08.1/0000:08:00.6/s
ound/card0/input8
input: HD-Audio Generic Line Out as /devices/pci0000:00/0000:00:08.1/0000:08:00
.6/sound/card0/input9
input: HD-Audio Generic Front Headphone as /devices/pci0000:00/0000:00:08.1/000
0:08:00.6/sound/card0/input10
After the post-6.16 updates, I now get:
snd_hda_codec_generic hdaudioC0D0: autoconfig for Generic: line_o
uts=1 (0x14/0x0/0x0/0x0/0x0) type:line
snd_hda_codec_generic hdaudioC0D0: speaker_outs=0 (0x0/0x0/0x0
/0x0/0x0)
snd_hda_codec_generic hdaudioC0D0: hp_outs=1 (0x1b/0x0/0x0/0x0
/0x0)
snd_hda_codec_generic hdaudioC0D0: mono: mono_out=0x0 snd_hda_codec_generic hdaudioC0D0: dig-out=0x11/0x0 snd_hda_codec_generic hdaudioC0D0: inputs: snd_hda_codec_generic hdaudioC0D0: Rear Mic=0x18 snd_hda_codec_generic hdaudioC0D0: Front Mic=0x19 snd_hda_codec_generic hdaudioC0D0: Line=0x1a
input: HD-Audio Generic Rear Mic as /devices/pci0000:00/0000:00:0
8.1/0000:08:00.6/sound/card0/input6
input: HD-Audio Generic Front Mic as /devices/pci0000:00/0000:00:
08.1/0000:08:00.6/sound/card0/input7
input: HD-Audio Generic Line as /devices/pci0000:00/0000:00:08.1/
0000:08:00.6/sound/card0/input8
input: HD-Audio Generic Line Out as /devices/pci0000:00/0000:00:0
8.1/0000:08:00.6/sound/card0/input9
input: HD-Audio Generic Front Headphone as /devices/pci0000:00/00
00:00:08.1/0000:08:00.6/sound/card0/input10
lspci reports:
lspci -v -s 0000:08:00.1
08:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Renoir Radeon High Definition Audio Controller
Subsystem: ASUSTeK Computer Inc. Device 8809
Flags: bus master, fast devsel, latency 0, IRQ 87, IOMMU group 11
Memory at fca88000 (32-bit, non-prefetchable) [size=16K]
Capabilities: [48] Vendor Specific Information: Len=08 <?>
Capabilities: [50] Power Management version 3
Capabilities: [64] Express Legacy Endpoint, IntMsgNum 0
Capabilities: [a0] MSI: Enable+ Count=1/1 Maskable- 64bit+
Capabilities: [100] Vendor Specific Information: ID=0001 Rev=1 Len=010 <?>
Capabilities: [2a0] Access Control Services
Kernel driver in use: snd_hda_intel
Kernel modules: snd_hda_intel
When using alsamixer, in the former case, I would get a "loopback" device, which when un-muted would enable line-in to work.
With the current git head kernel, I get no such loopback device and have been unable to get audio via line input.
Any suggestions welcome.
Re: ALC887-VD line-in not visible
Quoted 39 lines · Arthur Marsh
Earlier this year I could use line-in on an Asus PRIME B350M-A motherboard, with dmesg reporting:
snd_hda_codec_realtekhdaudioC0D0: autoconfig for ALC887-VD: line_outs=1 (0x14/
0x0/0x0/0x0/0x0) type:linesnd_hda_codec_realtek hdaudioC0D0: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0) snd_hda_codec_realtek hdaudioC0D0: hp_outs=1 (0x1b/0x0/0x0/0x0/0x0) snd_hda_codec_realtek hdaudioC0D0: mono: mono_out=0x0 snd_hda_codec_realtek hdaudioC0D0: dig-out=0x11/0x0 snd_hda_codec_realtek hdaudioC0D0: inputs: snd_hda_codec_realtek hdaudioC0D0: Rear Mic=0x18 snd_hda_codec_realtek hdaudioC0D0: Front Mic=0x19 snd_hda_codec_realtek hdaudioC0D0: Line=0x1ainput: HD-Audio Generic Rear Mic as /devices/pci0000:00/0000:00:08.1/0000:08:00
.6/sound/card0/input6
input: HD-Audio Generic Front Mic as /devices/pci0000:00/0000:00:08.1/0000:08:0
0.6/sound/card0/input7
input: HD-Audio Generic Line as /devices/pci0000:00/0000:00:08.1/0000:08:00.6/s
ound/card0/input8
input: HD-Audio Generic Line Out as /devices/pci0000:00/0000:00:08.1/0000:08:00
.6/sound/card0/input9
input: HD-Audio Generic Front Headphone as /devices/pci0000:00/0000:00:08.1/000
0:08:00.6/sound/card0/input10After the post-6.16 updates, I now get:
snd_hda_codec_generichdaudioC0D0: autoconfig for Generic:line_o
uts=1 (0x14/0x0/0x0/0x0/0x0) type:line
snd_hda_codec_generichdaudioC0D0: speaker_outs=0 (0x0/0x0/0x0
/0x0/0x0)
snd_hda_codec_generichdaudioC0D0: hp_outs=1 (0x1b/0x0/0x0/0x0
/0x0)snd_hda_codec_generic hdaudioC0D0: mono: mono_out=0x0 snd_hda_codec_generic hdaudioC0D0: dig-out=0x11/0x0 snd_hda_codec_generic hdaudioC0D0: inputs: snd_hda_codec_generic hdaudioC0D0: Rear Mic=0x18 snd_hda_codec_generic hdaudioC0D0: Front Mic=0x19 snd_hda_codec_generic hdaudioC0D0: Line=0x1a
Quoted 10 lines
input: HD-Audio Generic Rear Mic as /devices/pci0000:00/0000:00:0
8.1/0000:08:00.6/sound/card0/input6
input: HD-Audio Generic Front Mic as /devices/pci0000:00/0000:00:
08.1/0000:08:00.6/sound/card0/input7
input: HD-Audio Generic Line as /devices/pci0000:00/0000:00:08.1/
0000:08:00.6/sound/card0/input8
input: HD-Audio Generic Line Out as /devices/pci0000:00/0000:00:0
8.1/0000:08:00.6/sound/card0/input9
input: HD-Audio Generic Front Headphone as /devices/pci0000:00/00
00:00:08.1/0000:08:00.6/sound/card0/input10
Are you using the latest Linus tree for 6.17-rc1?
If so, there were changes related with HD-audio Kconfigs, and I guess you didn't enable the specific HD-audio codec driver you're using (e.g. CONFIG_SND_HDA_CODEC_ALC882).
Also, HDMI codec needs the additional Kconfig,
e.g. CONFIG_SND_HDA_CODEC_HDMI_INTEL, too.
I queued some changes to pick up those as default in for-linus branch of sound.git tree for avoiding such a pitfall now.
thanks,
Takashi
ALC887-VD line-in not visible
Thanks, I found the discussion with Linus about options and enabled:
CONFIG_SND_HDA_CODEC_ALC882
It still gets confusing that
CONFIG_SND_HDA_CODEC_ALC882
also applies to other ALC88* codecs.
I also enabled:
CONFIG_SND_HDA_CODEC_ALC882
even though I generally don't use HDMI out on this machine.
Arthur.
Re: ALC887-VD line-in not visible
Quoted 10 lines · Arthur Marsh
Thanks, I found the discussion with Linus about options and enabled:
CONFIG_SND_HDA_CODEC_ALC882It still gets confusing that
CONFIG_SND_HDA_CODEC_ALC882also applies to other ALC88* codecs.
There are hundreds of different Realtek HD-audio codecs and we can't put all in the driver names :) Basically the driver is for ALC882 and its compatible codecs.
Quoted 5 lines
I also enabled:
CONFIG_SND_HDA_CODEC_ALC882even though I generally don't use HDMI out on this machine.
Your problem is rather specific to Realtek codec, so it's only about CONFIG_SND_HDA_CODEC_ALC882. I'm not sure what made Linus' system broken, but my wild guess is that the lack of specific HDMI codec support caused the user-space side configuration mismatched somehow.
Takashi
ALC887-VD line-in not visible
Quoted 5 lines
I also enabled:
CONFIG_SND_HDA_CODEC_ALC882even though I generally don't use HDMI out on this machine.
Oops, I meant that I also enabled:
CONFIG_SND_HDA_CODEC_HDMI_INTEL
Regards,
Arthur.
PATCH 12/27 ALSA: hda/cmedia: Rewrite to new probe method
In reply to Takashi IwaiConvert the C-Media codec driver to use the new hda_codec_ops probe.
Since the CM9825 uses a completely different probe and codec ops, factor out to an individual codec driver, snd-hda-codec-cm9825.
Other than that, no functional changes.
--- sound/hda/codecs/Kconfig | 10 + sound/hda/codecs/Makefile | 2 + sound/hda/codecs/cm9825.c | 312 ++++++++++++++++++++++++++++++++ sound/hda/codecs/cmedia.c | 372 +++++--------------------------------- 4 files changed, 365 insertions(+), 331 deletions(-) create mode 100644 sound/hda/codecs/cm9825.c
sound/hda/codecs/Kconfig +10 -0
@@ -99,6 +99,16 @@ config SND_HDA_CODEC_CMEDIA comment "Set to Y if you want auto-loading the codec driver" depends on SND_HDA=y && SND_HDA_CODEC_CMEDIA=m +config SND_HDA_CODEC_CM9825 + tristate "Build C-Media CM9825 HD-audio codec support" + select SND_HDA_GENERIC + help + Say Y or M here to include C-Media CM9825 HD-audio codec support in + snd-hda-intel driver + +comment "Set to Y if you want auto-loading the codec driver" + depends on SND_HDA=y && SND_HDA_CODEC_CM9825=m + config SND_HDA_CODEC_SI3054 tristate "Build Silicon Labs 3054 HD-modem codec support" help
sound/hda/codecs/Makefile +2 -0
@@ -3,6 +3,7 @@ subdir-ccflags-y += -I$(src)/../common snd-hda-codec-generic-y := generic.o snd-hda-codec-cmedia-y := cmedia.o +snd-hda-codec-cm9825-y := cm9825.o snd-hda-codec-analog-y := analog.o snd-hda-codec-ca0110-y := ca0110.o snd-hda-codec-ca0132-y := ca0132.o
@@ -21,6 +22,7 @@ obj-y += side-codecs/ # codec drivers obj-$(CONFIG_SND_HDA_GENERIC) += snd-hda-codec-generic.o obj-$(CONFIG_SND_HDA_CODEC_CMEDIA) += snd-hda-codec-cmedia.o +obj-$(CONFIG_SND_HDA_CODEC_CM9825) += snd-hda-codec-cm9825.o obj-$(CONFIG_SND_HDA_CODEC_ANALOG) += snd-hda-codec-analog.o obj-$(CONFIG_SND_HDA_CODEC_CA0110) += snd-hda-codec-ca0110.o obj-$(CONFIG_SND_HDA_CODEC_CA0132) += snd-hda-codec-ca0132.o
sound/hda/codecs/cm9825.c new file +312 -0
312 lines not on this page · raw message
sound/hda/codecs/cmedia.c +41 -331
422 lines not on this page · raw message
Signature · 1 line
2.50.0
PATCH 13/27 ALSA: hda/analog: Rewrite to new probe method
In reply to Takashi IwaiConvert the Analog Device codec driver to use the new hda_codec_ops probe. The probe function had to be unified and branched with the model type specified via driver_data instead.
Other than that, no functional changes.
--- sound/hda/codecs/analog.c | 221 +++++++++++++++++++------------------- 1 file changed, 111 insertions(+), 110 deletions(-)
sound/hda/codecs/analog.c +111 -110
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0-or-later /* -* HD audio interface patch for AD1882, AD1884, AD1981HD, AD1983, AD1984, +* HD audio codec driver for AD1882, AD1884, AD1981HD, AD1983, AD1984, * AD1986A, AD1988 * * Copyright (c) 2005-2007 Takashi Iwai <[email protected]>
@@ -18,9 +18,18 @@#include "hda_jack.h" #include "generic.h" +enum { +MODEL_AD1882 , +MODEL_AD1884 , +MODEL_AD1981 , +MODEL_AD1983 , +MODEL_AD1986A , +MODEL_AD1988 , +};struct ad198x_spec {struct hda_gen_spec gen; +int model;/* for auto parser */ int smux_paths[4 ];
@@ -111,7 +120,7 @@ static void ad198x_power_eapd(struct hda_codec *codec) } } -static int ad198x_suspend (struct hda_codec *codec) +static int ad_codec_suspend (struct hda_codec *codec) {snd_hda_shutup_pins (codec);ad198x_power_eapd (codec);
@@ -137,7 +146,7 @@ static void ad_vmaster_eapd_hook(void *private_data, int enabled)* Automatic parse of I/O pins from the BIOS configuration */ -static int ad198x_auto_build_controls (struct hda_codec *codec) +static int ad_codec_build_controls (struct hda_codec *codec) {int err;
@@ -150,17 +159,6 @@ static int ad198x_auto_build_controls(struct hda_codec *codec)return 0 ; } -static const struct hda_codec_ops ad198x_auto_patch_ops = { - .build_controls = ad198x_auto_build_controls, - .build_pcms = snd_hda_gen_build_pcms, - .init = snd_hda_gen_init, - .free = snd_hda_gen_free, - .unsol_event = snd_hda_jack_unsol_event, - .check_power_status = snd_hda_gen_check_power_status, - .suspend = ad198x_suspend, -}; - -static int ad198x_parse_auto_config (struct hda_codec *codec,bool indep_hp) {struct ad198x_spec *spec = codec->spec;
@@ -198,7 +196,6 @@ static int alloc_ad_spec(struct hda_codec *codec)return -ENOMEM ; codec->spec = spec;snd_hda_gen_spec_init (&spec->gen); - codec->patch_ops = ad198x_auto_patch_ops;return 0 ; }
@@ -375,10 +372,10 @@ static const struct hda_model_fixup ad1986a_fixup_models[] = {/* */ -static int patch_ad1986a (struct hda_codec *codec) +static int ad1986a_probe (struct hda_codec *codec) {int err; -struct ad198x_spec *spec; +struct ad198x_spec *spec = codec->spec;static const hda_nid_t preferred_pairs[] = {0x1a ,0x03 ,0x1b ,0x03 ,
@@ -388,11 +385,6 @@ static int patch_ad1986a(struct hda_codec *codec) 0 }; - err =alloc_ad_spec (codec); -if (err <0 ) -return err; - spec = codec->spec; -/* AD1986A has the inverted EAPD implementation */ codec->inv_eapd =1 ;
@@ -418,10 +410,8 @@ static int patch_ad1986a(struct hda_codec *codec)snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PRE_PROBE ); err =ad198x_parse_auto_config (codec, false); -if (err <0 ) { -snd_hda_gen_free (codec); +if (err <0 )return err; - }snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PROBE );
@@ -507,18 +497,13 @@ static int ad1983_add_spdif_mux_ctl(struct hda_codec *codec)return 0 ; } -static int patch_ad1983 (struct hda_codec *codec) +static int ad1983_probe (struct hda_codec *codec) {static const hda_nid_t conn_0c[] = {0x08 };static const hda_nid_t conn_0d[] = {0x09 }; -struct ad198x_spec *spec; +struct ad198x_spec *spec = codec->spec;int err; - err =alloc_ad_spec (codec); -if (err <0 ) -return err; - spec = codec->spec; - spec->gen.mixer_nid =0x0e ; spec->gen.beep_nid =0x10 ;set_beep_amp (spec,0x10 ,0 ,HDA_OUTPUT );
@@ -529,15 +514,11 @@ static int patch_ad1983(struct hda_codec *codec) err =ad198x_parse_auto_config (codec, false);if (err <0 ) - goto error; +return err; err =ad1983_add_spdif_mux_ctl (codec);if (err <0 ) - goto error; +return err;return 0 ; - - error: -snd_hda_gen_free (codec); -return err; }
@@ -597,16 +578,11 @@ static const struct hda_quirk ad1981_fixup_tbl[] = { {} }; -static int patch_ad1981 (struct hda_codec *codec) +static int ad1981_probe (struct hda_codec *codec) { -struct ad198x_spec *spec; +struct ad198x_spec *spec = codec->spec;int err; - err =alloc_ad_spec (codec); -if (err <0 ) -return -ENOMEM ; - spec = codec->spec; - spec->gen.mixer_nid =0x0e ; spec->gen.beep_nid =0x10 ;set_beep_amp (spec,0x0d ,0 ,HDA_OUTPUT );
@@ -616,18 +592,14 @@ static int patch_ad1981(struct hda_codec *codec) err =ad198x_parse_auto_config (codec, false);if (err <0 ) - goto error; +return err; err =ad1983_add_spdif_mux_ctl (codec);if (err <0 ) - goto error; +return err;snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PROBE );return 0 ; - - error: -snd_hda_gen_free (codec); -return err; }
@@ -776,7 +748,7 @@ static const struct snd_kcontrol_new ad1988_auto_smux_mixer = { .put = ad1988_auto_smux_enum_put, }; -static int ad1988_auto_init (struct hda_codec *codec) +static int ad_codec_init (struct hda_codec *codec) {struct ad198x_spec *spec = codec->spec;int i, err;
@@ -784,6 +756,8 @@ static int ad1988_auto_init(struct hda_codec *codec) err =snd_hda_gen_init (codec);if (err <0 )return err; +if (spec->model !=MODEL_AD1988 ) +return 0 ;if (!spec->gen.autocfg.dig_outs)return 0 ;
@@ -854,8 +828,6 @@ static int ad1988_add_spdif_mux_ctl(struct hda_codec *codec)if (!snd_hda_gen_add_kctl (&spec->gen,NULL , &ad1988_auto_smux_mixer))return -ENOMEM ; - codec->patch_ops.init = ad1988_auto_init; -return 0 ; }
@@ -889,16 +861,11 @@ static const struct hda_model_fixup ad1988_fixup_models[] = { {} }; -static int patch_ad1988 (struct hda_codec *codec) +static int ad1988_probe (struct hda_codec *codec) { -struct ad198x_spec *spec; +struct ad198x_spec *spec = codec->spec;int err; - err =alloc_ad_spec (codec); -if (err <0 ) -return err; - spec = codec->spec; - spec->gen.mixer_nid =0x20 ; spec->gen.mixer_merge_nid =0x21 ; spec->gen.beep_nid =0x10 ;
@@ -909,18 +876,14 @@ static int patch_ad1988(struct hda_codec *codec) err =ad198x_parse_auto_config (codec, true);if (err <0 ) - goto error; +return err; err =ad1988_add_spdif_mux_ctl (codec);if (err <0 ) - goto error; +return err;snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PROBE );return 0 ; - - error: -snd_hda_gen_free (codec); -return err; }
@@ -1069,16 +1032,11 @@ static const struct hda_quirk ad1884_fixup_tbl[] = { }; -static int patch_ad1884 (struct hda_codec *codec) +static int ad1884_probe (struct hda_codec *codec) { -struct ad198x_spec *spec; +struct ad198x_spec *spec = codec->spec;int err; - err =alloc_ad_spec (codec); -if (err <0 ) -return err; - spec = codec->spec; - spec->gen.mixer_nid =0x20 ; spec->gen.mixer_merge_nid =0x21 ; spec->gen.beep_nid =0x10 ;
@@ -1089,18 +1047,14 @@ static int patch_ad1884(struct hda_codec *codec) err =ad198x_parse_auto_config (codec, true);if (err <0 ) - goto error; +return err; err =ad1983_add_spdif_mux_ctl (codec);if (err <0 ) - goto error; +return err;snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PROBE );return 0 ; - - error: -snd_hda_gen_free (codec); -return err; }/*
@@ -1115,53 +1069,99 @@ static int patch_ad1884(struct hda_codec *codec)* port-G - rear clfe-out (6stack) */ -static int patch_ad1882 (struct hda_codec *codec) +static int ad1882_probe (struct hda_codec *codec) { -struct ad198x_spec *spec; +struct ad198x_spec *spec = codec->spec;int err; - err =alloc_ad_spec (codec); -if (err <0 ) -return err; - spec = codec->spec; - spec->gen.mixer_nid =0x20 ; spec->gen.mixer_merge_nid =0x21 ; spec->gen.beep_nid =0x10 ;set_beep_amp (spec,0x10 ,0 ,HDA_OUTPUT ); err =ad198x_parse_auto_config (codec, true);if (err <0 ) - goto error; +return err; err =ad1988_add_spdif_mux_ctl (codec);if (err <0 ) - goto error; +return err;return 0 ; - - error: -snd_hda_gen_free (codec); -return err; } -/* -* patch entries +* driver entries */ +static int ad_codec_probe (struct hda_codec *codec, +const struct hda_device_id *id) +{ +struct ad198x_spec *spec; +int err; + + err =alloc_ad_spec (codec); +if (err <0 ) +return -ENOMEM ; + spec = codec->spec; + spec->model = id->driver_data; + +switch (spec->model) { +case MODEL_AD1882 : + err =ad1882_probe (codec); +break ; +case MODEL_AD1884 : + err =ad1884_probe (codec); +break ; +case MODEL_AD1981 : + err =ad1981_probe (codec); +break ; +case MODEL_AD1983 : + err =ad1983_probe (codec); +break ; +case MODEL_AD1986A : + err =ad1986a_probe (codec); +break ; +case MODEL_AD1988 : + err =ad1988_probe (codec); +break ; +default : + err = -EINVAL ; +break ; + } + +if (err <0 ) { +snd_hda_gen_remove (codec); +return err; + } + +return 0 ; +} + +static const struct hda_codec_ops ad_codec_ops = { + .probe = ad_codec_probe, + .remove = snd_hda_gen_remove, + .build_controls = ad_codec_build_controls, + .build_pcms = snd_hda_gen_build_pcms, + .init = ad_codec_init, + .unsol_event = snd_hda_jack_unsol_event, + .suspend = ad_codec_suspend, + .check_power_status = snd_hda_gen_check_power_status, + .stream_pm = snd_hda_gen_stream_pm, +}; +static const struct hda_device_id snd_hda_id_analog[] = { -HDA_CODEC_ENTRY (0x11d4184a ,"AD1884A" , patch_ad1884), -HDA_CODEC_ENTRY (0x11d41882 ,"AD1882" , patch_ad1882), -HDA_CODEC_ENTRY (0x11d41883 ,"AD1883" , patch_ad1884), -HDA_CODEC_ENTRY (0x11d41884 ,"AD1884" , patch_ad1884), -HDA_CODEC_ENTRY (0x11d4194a ,"AD1984A" , patch_ad1884), -HDA_CODEC_ENTRY (0x11d4194b ,"AD1984B" , patch_ad1884), -HDA_CODEC_ENTRY (0x11d41981 ,"AD1981" , patch_ad1981), -HDA_CODEC_ENTRY (0x11d41983 ,"AD1983" , patch_ad1983), -HDA_CODEC_ENTRY (0x11d41984 ,"AD1984" , patch_ad1884), -HDA_CODEC_ENTRY (0x11d41986 ,"AD1986A" , patch_ad1986a), -HDA_CODEC_ENTRY (0x11d41988 ,"AD1988" , patch_ad1988), -HDA_CODEC_ENTRY (0x11d4198b ,"AD1988B" , patch_ad1988), -HDA_CODEC_ENTRY (0x11d4882a ,"AD1882A" , patch_ad1882), -HDA_CODEC_ENTRY (0x11d4989a ,"AD1989A" , patch_ad1988), -HDA_CODEC_ENTRY (0x11d4989b ,"AD1989B" , patch_ad1988), +HDA_CODEC_ID_MODEL (0x11d4184a ,"AD1884A" ,MODEL_AD1884 ), +HDA_CODEC_ID_MODEL (0x11d41882 ,"AD1882" ,MODEL_AD1882 ), +HDA_CODEC_ID_MODEL (0x11d41883 ,"AD1883" ,MODEL_AD1884 ), +HDA_CODEC_ID_MODEL (0x11d41884 ,"AD1884" ,MODEL_AD1884 ), +HDA_CODEC_ID_MODEL (0x11d4194a ,"AD1984A" ,MODEL_AD1884 ), +HDA_CODEC_ID_MODEL (0x11d4194b ,"AD1984B" ,MODEL_AD1884 ), +HDA_CODEC_ID_MODEL (0x11d41981 ,"AD1981" ,MODEL_AD1981 ), +HDA_CODEC_ID_MODEL (0x11d41983 ,"AD1983" ,MODEL_AD1983 ), +HDA_CODEC_ID_MODEL (0x11d41984 ,"AD1984" ,MODEL_AD1884 ), +HDA_CODEC_ID_MODEL (0x11d41986 ,"AD1986A" ,MODEL_AD1986A ), +HDA_CODEC_ID_MODEL (0x11d41988 ,"AD1988" ,MODEL_AD1988 ), +HDA_CODEC_ID_MODEL (0x11d4198b ,"AD1988B" ,MODEL_AD1988 ), +HDA_CODEC_ID_MODEL (0x11d4882a ,"AD1882A" ,MODEL_AD1882 ), +HDA_CODEC_ID_MODEL (0x11d4989a ,"AD1989A" ,MODEL_AD1988 ), +HDA_CODEC_ID_MODEL (0x11d4989b ,"AD1989B" ,MODEL_AD1988 ), {}/* terminator */ };MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_analog);
@@ -1171,6 +1171,7 @@ MODULE_DESCRIPTION("Analog Devices HD-audio codec");static struct hda_codec_driver analog_driver = { .id = snd_hda_id_analog, + .ops = &ad_codec_ops, };module_hda_codec_driver (analog_driver);
Signature · 1 line
2.50.0
PATCH 14/27 ALSA: hda/ca0110: Rewrite to new probe method
In reply to Takashi IwaiConvert the CA0110 codec driver to use the new hda_codec_ops probe. No functional changes.
--- sound/hda/codecs/ca0110.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-)
sound/hda/codecs/ca0110.c +17 -18
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0-or-later /* -* HD audio interface patch for Creative X-Fi CA0110-IBG chip +* HD audio codec driver for Creative X-Fi CA0110-IBG chip * * Copyright (c) 2008 Takashi Iwai <[email protected]> */
@@ -15,15 +15,6 @@#include "hda_jack.h" #include "generic.h" - -static const struct hda_codec_ops ca0110_patch_ops = { - .build_controls = snd_hda_gen_build_controls, - .build_pcms = snd_hda_gen_build_pcms, - .init = snd_hda_gen_init, - .free = snd_hda_gen_free, - .unsol_event = snd_hda_jack_unsol_event, -}; -static int ca0110_parse_auto_config (struct hda_codec *codec) {struct hda_gen_spec *spec = codec->spec;
@@ -39,8 +30,7 @@ static int ca0110_parse_auto_config(struct hda_codec *codec)return 0 ; } - -static int patch_ca0110 (struct hda_codec *codec) +static int ca0110_probe (struct hda_codec *codec,const struct hda_device_id *id) {struct hda_gen_spec *spec;int err;
@@ -50,7 +40,6 @@ static int patch_ca0110(struct hda_codec *codec)return -ENOMEM ;snd_hda_gen_spec_init (spec); codec->spec = spec; - codec->patch_ops = ca0110_patch_ops; spec->multi_cap_vol =1 ; codec->bus->core.needs_damn_long_delay =1 ;
@@ -62,18 +51,27 @@ static int patch_ca0110(struct hda_codec *codec)return 0 ; error: -snd_hda_gen_free (codec); +snd_hda_gen_remove (codec);return err; } +static const struct hda_codec_ops ca0110_codec_ops = { + .probe = ca0110_probe, + .remove = snd_hda_gen_remove, + .build_controls = snd_hda_gen_build_controls, + .build_pcms = snd_hda_gen_build_pcms, + .init = snd_hda_gen_init, + .unsol_event = snd_hda_jack_unsol_event, +}; +/* -* patch entries +* driver entries */ static const struct hda_device_id snd_hda_id_ca0110[] = { -HDA_CODEC_ENTRY (0x1102000a ,"CA0110-IBG" , patch_ca0110), -HDA_CODEC_ENTRY (0x1102000b ,"CA0110-IBG" , patch_ca0110), -HDA_CODEC_ENTRY (0x1102000d ,"SB0880 X-Fi" , patch_ca0110), +HDA_CODEC_ID (0x1102000a ,"CA0110-IBG" ), +HDA_CODEC_ID (0x1102000b ,"CA0110-IBG" ), +HDA_CODEC_ID (0x1102000d ,"SB0880 X-Fi" ), {}/* terminator */ };MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_ca0110);
@@ -83,6 +81,7 @@ MODULE_DESCRIPTION("Creative CA0110-IBG HD-audio codec");static struct hda_codec_driver ca0110_driver = { .id = snd_hda_id_ca0110, + .ops = &ca0110_codec_ops, };module_hda_codec_driver (ca0110_driver);
Signature · 1 line
2.50.0
PATCH 15/27 ALSA: hda/cirrus: Split to cs420x and cs421x drivers
In reply to Takashi IwaiSince the codec ops for CS420x and CS421x are fairly independent, split the cirrus codec driver into two drivers, snd-hda-codec-cs420x and snd-hda-code-cs421x. Together with the split, convert to the new hda_codec_ops probe.
---
sound/hda/codecs/cirrus/Kconfig | 20 +-
sound/hda/codecs/cirrus/Makefile | 6 +-
.../hda/codecs/cirrus/{cirrus.c => cs420x.c} | 526 +---------------
sound/hda/codecs/cirrus/cs421x.c | 590 ++++++++++++++++++
4 files changed, 643 insertions(+), 499 deletions(-)
rename sound/hda/codecs/cirrus/{cirrus.c => cs420x.c} (61%)
create mode 100644 sound/hda/codecs/cirrus/cs421x.csound/hda/codecs/cirrus/Kconfig +15 -5
@@ -1,14 +1,24 @@ # SPDX-License-Identifier: GPL-2.0-only -config SND_HDA_CODEC_CIRRUS - tristate "Build Cirrus Logic codec support" +config SND_HDA_CODEC_CS420X + tristate "Build Cirrus Logic CS420x codec support" select SND_HDA_GENERIC help - Say Y or M here to include Cirrus Logic codec support in - snd-hda-intel driver, such as CS4206. + Say Y or M here to include Cirrus Logic CS420x codec support in + snd-hda-intel driver comment "Set to Y if you want auto-loading the codec driver" - depends on SND_HDA=y && SND_HDA_CODEC_CIRRUS=m + depends on SND_HDA=y && SND_HDA_CODEC_CS420X=m + +config SND_HDA_CODEC_CS421X + tristate "Build Cirrus Logic CS421x codec support" + select SND_HDA_GENERIC + help + Say Y or M here to include Cirrus Logic CS421x codec support in + snd-hda-intel driver + +comment "Set to Y if you want auto-loading the codec driver" + depends on SND_HDA=y && SND_HDA_CODEC_CS421X=m config SND_HDA_CODEC_CS8409 tristate "Build Cirrus Logic HDA bridge support"
sound/hda/codecs/cirrus/Makefile +4 -2
@@ -1,8 +1,10 @@ # SPDX-License-Identifier: GPL-2.0 subdir-ccflags-y += -I$(src)/../../common -snd-hda-codec-cirrus-y := cirrus.o +snd-hda-codec-cs420x-y := cs420x.o +snd-hda-codec-cs421x-y := cs421x.o snd-hda-codec-cs8409-y := cs8409.o cs8409-tables.o -obj-$(CONFIG_SND_HDA_CODEC_CIRRUS) += snd-hda-codec-cirrus.o +obj-$(CONFIG_SND_HDA_CODEC_CS420X) += snd-hda-codec-cs420x.o +obj-$(CONFIG_SND_HDA_CODEC_CS421X) += snd-hda-codec-cs421x.o obj-$(CONFIG_SND_HDA_CODEC_CS8409) += snd-hda-codec-cs8409.o
sound/hda/codecs/cirrus/cs420x.c renamed from sound/hda/codecs/cirrus/cirrus.c +34 -492
626 lines not on this page · raw message
sound/hda/codecs/cirrus/cs421x.c new file +590 -0
590 lines not on this page · raw message
Signature · 1 line
2.50.0
PATCH 16/27 ALSA: hda/cs8409: Rewrite to new probe method
In reply to Takashi IwaiConvert the CS8409 codec driver to use the new hda_codec_ops probe. The Dolphin support needs an override of unsol_event callback, and redirect via spec->unsol_event function pointer for now.
Other than that, no functional changes.
--- sound/hda/codecs/cirrus/cs8409-tables.c | 2 +- sound/hda/codecs/cirrus/cs8409.c | 55 +++++++++++++------------ sound/hda/codecs/cirrus/cs8409.h | 4 +- 3 files changed, 33 insertions(+), 28 deletions(-)
sound/hda/codecs/cirrus/cs8409-tables.c +1 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0-only /* -* cs8409-tables.c -- HD audio interface patch for Cirrus Logic CS8409 HDA bridge chip +* cs8409-tables.c -- HD audio codec driver for Cirrus Logic CS8409 HDA bridge chip * * Copyright (C) 2021 Cirrus Logic, Inc. and * Cirrus Logic International Semiconductor Ltd.
sound/hda/codecs/cirrus/cs8409.c +29 -26
127 lines not on this page · raw message
sound/hda/codecs/cirrus/cs8409.h +3 -1
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0-or-later */ /* -* HD audio interface patch for Cirrus Logic CS8409 HDA bridge chip +* HD audio codec driver for Cirrus Logic CS8409 HDA bridge chip * * Copyright (C) 2021 Cirrus Logic, Inc. and * Cirrus Logic International Semiconductor Ltd.
@@ -345,6 +345,8 @@ struct cs8409_spec {/* verb exec op override */ int (*exec_verb)(struct hdac_device *dev,unsigned int cmd,unsigned int flags,unsigned int *res); +/* unsol_event op override */ +void (*unsol_event)(struct hda_codec *codec,unsigned int res); };extern const struct snd_kcontrol_new cs42l42_dac_volume_mixer;
Signature · 1 line
2.50.0
Re: [PATCH 16/27] ALSA: hda/cs8409: Rewrite to new probe method
Quoted 7 lines · Takashi Iwai
Convert the CS8409 codec driver to use the new
hda_codec_opsprobe. The Dolphin support needs an override ofunsol_eventcallback, and redirect viaspec->unsol_eventfunction pointer for now.Other than that, no functional changes.
Signed-off-by Takashi Iwai <[email protected]>
PATCH 17/27 ALSA: hda/conexant: Rewrite to new probe method
In reply to Takashi IwaiConvert the Conexant codec driver to use the new hda_codec_ops probe. No functional changes.
--- sound/hda/codecs/conexant.c | 104 ++++++++++++++++++------------------ 1 file changed, 53 insertions(+), 51 deletions(-)
sound/hda/codecs/conexant.c +53 -51
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0-or-later /* -* HD audio interface patch for Conexant HDA audio codec +* HD audio codec driver for Conexant HDA audio codec * * Copyright (c) 2006 Pototskiy Akex <[email protected]> * Takashi Iwai <[email protected]>
@@ -185,7 +185,7 @@ static void cx_fixup_headset_recog(struct hda_codec *codec)snd_hda_codec_write (codec,0x19 ,0 ,AC_VERB_SET_PIN_WIDGET_CONTROL ,0x20 ); } -static int cx_auto_init (struct hda_codec *codec) +static int cx_init (struct hda_codec *codec) {struct conexant_spec *spec = codec->spec;snd_hda_gen_init (codec);
@@ -210,10 +210,10 @@ static void cx_auto_shutdown(struct hda_codec *codec)cx_auto_turn_eapd (codec, spec->num_eapds, spec->eapds, false); } -static void cx_auto_free (struct hda_codec *codec) +static void cx_remove (struct hda_codec *codec) {cx_auto_shutdown (codec); -snd_hda_gen_free (codec); +snd_hda_gen_remove (codec); }static void cx_process_headset_plugin (struct hda_codec *codec)
@@ -258,22 +258,12 @@ static void cx_update_headset_mic_vref(struct hda_codec *codec, struct hda_jack_cx_process_headset_plugin (codec); } -static int cx_auto_suspend (struct hda_codec *codec) +static int cx_suspend (struct hda_codec *codec) {cx_auto_shutdown (codec);return 0 ; } -static const struct hda_codec_ops cx_auto_patch_ops = { - .build_controls = snd_hda_gen_build_controls, - .build_pcms = snd_hda_gen_build_pcms, - .init = cx_auto_init, - .free = cx_auto_free, - .unsol_event = snd_hda_jack_unsol_event, - .suspend = cx_auto_suspend, - .check_power_status = snd_hda_gen_check_power_status, -}; -/* * pin fix-up */
@@ -1178,7 +1168,7 @@ static void add_cx5051_fake_mutes(struct hda_codec *codec) spec->gen.dac_min_mute = true; } -static int patch_conexant_auto (struct hda_codec *codec) +static int cx_probe (struct hda_codec *codec,const struct hda_device_id *id) {struct conexant_spec *spec;int err;
@@ -1190,7 +1180,6 @@ static int patch_conexant_auto(struct hda_codec *codec)return -ENOMEM ;snd_hda_gen_spec_init (&spec->gen); codec->spec = spec; - codec->patch_ops = cx_auto_patch_ops;/* init cx11880/sn6140 flag and reset headset_present_flag */ switch (codec->core.vendor_id) {
@@ -1276,47 +1265,59 @@ static int patch_conexant_auto(struct hda_codec *codec)return 0 ; error: -cx_auto_free (codec); +cx_remove (codec);return err; } +static const struct hda_codec_ops cx_codec_ops = { + .probe = cx_probe, + .remove = cx_remove, + .build_controls = snd_hda_gen_build_controls, + .build_pcms = snd_hda_gen_build_pcms, + .init = cx_init, + .unsol_event = snd_hda_jack_unsol_event, + .suspend = cx_suspend, + .check_power_status = snd_hda_gen_check_power_status, + .stream_pm = snd_hda_gen_stream_pm, +}; +/* */ static const struct hda_device_id snd_hda_id_conexant[] = { -HDA_CODEC_ENTRY (0x14f11f86 ,"CX11880" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f11f87 ,"SN6140" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f12008 ,"CX8200" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f120d0 ,"CX11970" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f120d1 ,"SN6180" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f15045 ,"CX20549 (Venice)" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f15047 ,"CX20551 (Waikiki)" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f15051 ,"CX20561 (Hermosa)" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f15066 ,"CX20582 (Pebble)" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f15067 ,"CX20583 (Pebble HSF)" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f15068 ,"CX20584" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f15069 ,"CX20585" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f1506c ,"CX20588" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f1506e ,"CX20590" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f15097 ,"CX20631" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f15098 ,"CX20632" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f150a1 ,"CX20641" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f150a2 ,"CX20642" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f150ab ,"CX20651" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f150ac ,"CX20652" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f150b8 ,"CX20664" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f150b9 ,"CX20665" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f150f1 ,"CX21722" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f150f2 ,"CX20722" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f150f3 ,"CX21724" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f150f4 ,"CX20724" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f1510f ,"CX20751/2" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f15110 ,"CX20751/2" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f15111 ,"CX20753/4" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f15113 ,"CX20755" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f15114 ,"CX20756" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f15115 ,"CX20757" , patch_conexant_auto), -HDA_CODEC_ENTRY (0x14f151d7 ,"CX20952" , patch_conexant_auto), +HDA_CODEC_ID (0x14f11f86 ,"CX11880" ), +HDA_CODEC_ID (0x14f11f87 ,"SN6140" ), +HDA_CODEC_ID (0x14f12008 ,"CX8200" ), +HDA_CODEC_ID (0x14f120d0 ,"CX11970" ), +HDA_CODEC_ID (0x14f120d1 ,"SN6180" ), +HDA_CODEC_ID (0x14f15045 ,"CX20549 (Venice)" ), +HDA_CODEC_ID (0x14f15047 ,"CX20551 (Waikiki)" ), +HDA_CODEC_ID (0x14f15051 ,"CX20561 (Hermosa)" ), +HDA_CODEC_ID (0x14f15066 ,"CX20582 (Pebble)" ), +HDA_CODEC_ID (0x14f15067 ,"CX20583 (Pebble HSF)" ), +HDA_CODEC_ID (0x14f15068 ,"CX20584" ), +HDA_CODEC_ID (0x14f15069 ,"CX20585" ), +HDA_CODEC_ID (0x14f1506c ,"CX20588" ), +HDA_CODEC_ID (0x14f1506e ,"CX20590" ), +HDA_CODEC_ID (0x14f15097 ,"CX20631" ), +HDA_CODEC_ID (0x14f15098 ,"CX20632" ), +HDA_CODEC_ID (0x14f150a1 ,"CX20641" ), +HDA_CODEC_ID (0x14f150a2 ,"CX20642" ), +HDA_CODEC_ID (0x14f150ab ,"CX20651" ), +HDA_CODEC_ID (0x14f150ac ,"CX20652" ), +HDA_CODEC_ID (0x14f150b8 ,"CX20664" ), +HDA_CODEC_ID (0x14f150b9 ,"CX20665" ), +HDA_CODEC_ID (0x14f150f1 ,"CX21722" ), +HDA_CODEC_ID (0x14f150f2 ,"CX20722" ), +HDA_CODEC_ID (0x14f150f3 ,"CX21724" ), +HDA_CODEC_ID (0x14f150f4 ,"CX20724" ), +HDA_CODEC_ID (0x14f1510f ,"CX20751/2" ), +HDA_CODEC_ID (0x14f15110 ,"CX20751/2" ), +HDA_CODEC_ID (0x14f15111 ,"CX20753/4" ), +HDA_CODEC_ID (0x14f15113 ,"CX20755" ), +HDA_CODEC_ID (0x14f15114 ,"CX20756" ), +HDA_CODEC_ID (0x14f15115 ,"CX20757" ), +HDA_CODEC_ID (0x14f151d7 ,"CX20952" ), {}/* terminator */ };MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_conexant);
@@ -1326,6 +1327,7 @@ MODULE_DESCRIPTION("Conexant HD-audio codec");static struct hda_codec_driver conexant_driver = { .id = snd_hda_id_conexant, + .ops = &cx_codec_ops, };module_hda_codec_driver (conexant_driver);
Signature · 1 line
2.50.0
PATCH 18/27 ALSA: hda/senary: Rewrite to new probe method
In reply to Takashi IwaiConvert the Senary codec driver to use the new hda_codec_ops probe. No functional changes.
--- sound/hda/codecs/senarytech.c | 46 ++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 22 deletions(-)
sound/hda/codecs/senarytech.c +24 -22
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0-or-later /* -* HD audio interface patch for Senary HDA audio codec +* HD audio codec driver for Senary HDA audio codec * * Initially based on conexant.c */
@@ -129,7 +129,7 @@ static void senary_init_gpio_led(struct hda_codec *codec) } } -static int senary_auto_init (struct hda_codec *codec) +static int senary_init (struct hda_codec *codec) {snd_hda_gen_init (codec);senary_init_gpio_led (codec);
@@ -138,7 +138,7 @@ static int senary_auto_init(struct hda_codec *codec)return 0 ; } -static void senary_auto_shutdown (struct hda_codec *codec) +static void senary_shutdown (struct hda_codec *codec) {struct senary_spec *spec = codec->spec;
@@ -148,29 +148,19 @@ static void senary_auto_shutdown(struct hda_codec *codec)senary_auto_turn_eapd (codec, spec->num_eapds, spec->eapds, false); } -static void senary_auto_free (struct hda_codec *codec) +static void senary_remove (struct hda_codec *codec) { -senary_auto_shutdown (codec); -snd_hda_gen_free (codec); +senary_shutdown (codec); +snd_hda_gen_remove (codec); } -static int senary_auto_suspend (struct hda_codec *codec) +static int senary_suspend (struct hda_codec *codec) { -senary_auto_shutdown (codec); +senary_shutdown (codec);return 0 ; } -static const struct hda_codec_ops senary_auto_patch_ops = { - .build_controls = snd_hda_gen_build_controls, - .build_pcms = snd_hda_gen_build_pcms, - .init = senary_auto_init, - .free = senary_auto_free, - .unsol_event = snd_hda_jack_unsol_event, - .suspend = senary_auto_suspend, - .check_power_status = snd_hda_gen_check_power_status, -}; - -static int patch_senary_auto (struct hda_codec *codec) +static int senary_probe (struct hda_codec *codec,const struct hda_device_id *id) {struct senary_spec *spec;int err;
@@ -182,7 +172,6 @@ static int patch_senary_auto(struct hda_codec *codec)return -ENOMEM ;snd_hda_gen_spec_init (&spec->gen); codec->spec = spec; - codec->patch_ops = senary_auto_patch_ops;senary_auto_parse_eapd (codec); spec->gen.own_eapd_ctl =1 ;
@@ -221,15 +210,27 @@ static int patch_senary_auto(struct hda_codec *codec)return 0 ; error: -senary_auto_free (codec); +senary_remove (codec);return err; } +static const struct hda_codec_ops senary_codec_ops = { + .probe = senary_probe, + .remove = senary_remove, + .build_controls = snd_hda_gen_build_controls, + .build_pcms = snd_hda_gen_build_pcms, + .init = senary_init, + .unsol_event = snd_hda_jack_unsol_event, + .suspend = senary_suspend, + .check_power_status = snd_hda_gen_check_power_status, + .stream_pm = snd_hda_gen_stream_pm, +}; +/* */ static const struct hda_device_id snd_hda_id_senary[] = { -HDA_CODEC_ENTRY (0x1fa86186 ,"SN6186" , patch_senary_auto), +HDA_CODEC_ID (0x1fa86186 ,"SN6186" ), {}/* terminator */ };MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_senary);
@@ -239,6 +240,7 @@ MODULE_DESCRIPTION("Senarytech HD-audio codec");static struct hda_codec_driver senary_driver = { .id = snd_hda_id_senary, + .ops = &senary_codec_ops, };module_hda_codec_driver (senary_driver);
Signature · 1 line
2.50.0
PATCH 19/27 ALSA: hda/si3054: Rewrite to new probe method
In reply to Takashi IwaiConvert the SI3054 codec driver to use the new hda_codec_ops probe. No functional changes.
--- sound/hda/codecs/si3054.c | 53 +++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 27 deletions(-)
sound/hda/codecs/si3054.c +26 -27
@@ -2,7 +2,7 @@/* * Universal Interface for Intel High Definition Audio Codec * -* HD audio interface patch for Silicon Labs 3054/5 modem codec +* HD audio codec driver for Silicon Labs 3054/5 modem codec * * Copyright (c) 2005 Sasha Khapyorsky <[email protected]> * Takashi Iwai <[email protected]>
@@ -246,50 +246,48 @@ static int si3054_init(struct hda_codec *codec)return 0 ; } -static void si3054_free (struct hda_codec *codec) +static void si3054_remove (struct hda_codec *codec) {kfree (codec->spec); } -/* */ -static const struct hda_codec_ops si3054_patch_ops = { - .build_controls = si3054_build_controls, - .build_pcms = si3054_build_pcms, - .init = si3054_init, - .free = si3054_free, -}; - -static int patch_si3054 (struct hda_codec *codec) +static int si3054_probe (struct hda_codec *codec,const struct hda_device_id *id) { -struct si3054_spec *spec =kzalloc (sizeof (*spec),GFP_KERNEL ); -if (spec ==NULL ) + codec->spec =kzalloc (sizeof (struct si3054_spec ),GFP_KERNEL ); +if (!codec->spec)return -ENOMEM ; - codec->spec = spec; - codec->patch_ops = si3054_patch_ops;return 0 ; } +static const struct hda_codec_ops si3054_codec_ops = { + .probe = si3054_probe, + .remove = si3054_remove, + .build_controls = si3054_build_controls, + .build_pcms = si3054_build_pcms, + .init = si3054_init, +}; +/* -* patch entries +* driver entries */ static const struct hda_device_id snd_hda_id_si3054[] = { -HDA_CODEC_ENTRY (0x163c3055 ,"Si3054" , patch_si3054), -HDA_CODEC_ENTRY (0x163c3155 ,"Si3054" , patch_si3054), -HDA_CODEC_ENTRY (0x11c13026 ,"Si3054" , patch_si3054), -HDA_CODEC_ENTRY (0x11c13055 ,"Si3054" , patch_si3054), -HDA_CODEC_ENTRY (0x11c13155 ,"Si3054" , patch_si3054), -HDA_CODEC_ENTRY (0x10573055 ,"Si3054" , patch_si3054), -HDA_CODEC_ENTRY (0x10573057 ,"Si3054" , patch_si3054), -HDA_CODEC_ENTRY (0x10573155 ,"Si3054" , patch_si3054), +HDA_CODEC_ID (0x163c3055 ,"Si3054" ), +HDA_CODEC_ID (0x163c3155 ,"Si3054" ), +HDA_CODEC_ID (0x11c13026 ,"Si3054" ), +HDA_CODEC_ID (0x11c13055 ,"Si3054" ), +HDA_CODEC_ID (0x11c13155 ,"Si3054" ), +HDA_CODEC_ID (0x10573055 ,"Si3054" ), +HDA_CODEC_ID (0x10573057 ,"Si3054" ), +HDA_CODEC_ID (0x10573155 ,"Si3054" ),/* VIA HDA on Clevo m540 */ -HDA_CODEC_ENTRY (0x11063288 ,"Si3054" , patch_si3054), +HDA_CODEC_ID (0x11063288 ,"Si3054" ),/* Asus A8J Modem (SM56) */ -HDA_CODEC_ENTRY (0x15433155 ,"Si3054" , patch_si3054), +HDA_CODEC_ID (0x15433155 ,"Si3054" ),/* LG LW20 modem */ -HDA_CODEC_ENTRY (0x18540018 ,"Si3054" , patch_si3054), +HDA_CODEC_ID (0x18540018 ,"Si3054" ), {} };MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_si3054);
@@ -299,6 +297,7 @@ MODULE_DESCRIPTION("Si3054 HD-audio modem codec");static struct hda_codec_driver si3054_driver = { .id = snd_hda_id_si3054, + .ops = &si3054_codec_ops, };module_hda_codec_driver (si3054_driver);
Signature · 1 line
2.50.0
PATCH 20/27 ALSA: hda/via: Rewrite to new probe method
In reply to Takashi IwaiConvert the VIA codec driver to use the new hda_codec_ops probe. No functional changes.
--- sound/hda/codecs/via.c | 445 +++++++++++++++++------------------------ 1 file changed, 186 insertions(+), 259 deletions(-)
sound/hda/codecs/via.c +186 -259
@@ -2,7 +2,7 @@/* * Universal Interface for Intel High Definition Audio Codec * -* HD audio interface patch for VIA VT17xx/VT18xx/VT20xx codec +* HD audio codec driver for VIA VT17xx/VT18xx/VT20xx codec * * (C) 2006-2009 VIA Technology, Inc. * (C) 2006-2008 Takashi Iwai <[email protected]>
@@ -52,8 +52,10 @@enum VIA_HDA_CODEC {UNKNOWN =-1 ,VT1708 , +VT1709 ,VT1709_10CH ,VT1709_6CH , +VT1708B ,VT1708B_8CH ,VT1708B_4CH ,VT1708S ,
@@ -66,6 +68,7 @@ enum VIA_HDA_CODEC {VT1802 ,VT1705CF ,VT1808 , +VT3476 , CODEC_TYPES, };
@@ -95,8 +98,6 @@ static void via_playback_pcm_hook(struct hda_pcm_stream *hinfo,struct snd_pcm_substream *substream, int action); -static const struct hda_codec_ops via_patch_ops;/* defined below */ -static struct via_spec *via_new_spec (struct hda_codec *codec) {struct via_spec *spec;
@@ -118,7 +119,6 @@ static struct via_spec *via_new_spec(struct hda_codec *codec) spec->gen.add_stereo_mix_input =HDA_HINT_STEREO_MIX_AUTO ; codec->power_save_node =1 ; spec->gen.power_down_unused =1 ; - codec->patch_ops = via_patch_ops;return spec; }
@@ -373,10 +373,10 @@ static void via_playback_pcm_hook(struct hda_pcm_stream *hinfo,vt1708_update_hp_work (codec); } -static void via_free (struct hda_codec *codec) +static void via_remove (struct hda_codec *codec) {vt1708_stop_hp_work (codec); -snd_hda_gen_free (codec); +snd_hda_gen_remove (codec); }static int via_suspend (struct hda_codec *codec)
@@ -395,7 +395,7 @@ static int via_resume(struct hda_codec *codec) {/* some delay here to make jack detection working (bko#98921) */ msleep (10 ); - codec->patch_ops.init (codec); +snd_hda_codec_init (codec);snd_hda_regmap_sync (codec);return 0 ; }
@@ -411,20 +411,6 @@ static int via_check_power_status(struct hda_codec *codec, hda_nid_t nid)/* */ -static int via_init (struct hda_codec *codec); - -static const struct hda_codec_ops via_patch_ops = { - .build_controls = snd_hda_gen_build_controls, - .build_pcms = snd_hda_gen_build_pcms, - .init = via_init, - .free = via_free, - .unsol_event = snd_hda_jack_unsol_event, - .suspend = via_suspend, - .resume = via_resume, - .check_power_status = via_check_power_status, -}; - -static const struct hda_verb vt1708_init_verbs[] = {/* power down jack detect function */ {0x1 ,0xf81 ,0x1 },
@@ -541,19 +527,21 @@ static int via_init(struct hda_codec *codec)return 0 ; } -static int vt1708_build_controls (struct hda_codec *codec) +static int via_build_controls (struct hda_codec *codec) {/* In order not to create "Phantom Jack" controls, temporary enable jackpoll */ int err;int old_interval = codec->jackpoll_interval; - codec->jackpoll_interval =msecs_to_jiffies (100 ); +if (old_interval) + codec->jackpoll_interval =msecs_to_jiffies (100 ); err =snd_hda_gen_build_controls (codec); - codec->jackpoll_interval = old_interval; +if (old_interval) + codec->jackpoll_interval = old_interval;return err; } -static int vt1708_build_pcms (struct hda_codec *codec) +static int via_build_pcms (struct hda_codec *codec) {struct via_spec *spec = codec->spec;int i, err;
@@ -580,19 +568,11 @@ static int vt1708_build_pcms(struct hda_codec *codec)return 0 ; } -static int patch_vt1708 (struct hda_codec *codec) +static int probe_vt1708 (struct hda_codec *codec) { -struct via_spec *spec; +struct via_spec *spec = codec->spec;int err; -/* create a codec specific record */ - spec =via_new_spec (codec); -if (spec ==NULL ) -return -ENOMEM ; - -/* override some patch_ops */ - codec->patch_ops.build_controls = vt1708_build_controls; - codec->patch_ops.build_pcms = vt1708_build_pcms; spec->gen.mixer_nid =0x17 ;/* set jackpoll_interval while parsing the codec */
@@ -611,81 +591,47 @@ static int patch_vt1708(struct hda_codec *codec) err =snd_hda_add_verbs (codec, vt1708_init_verbs);if (err <0 ) - goto error; +return err;/* automatic parse from the BIOS config */ err =via_parse_auto_config (codec);if (err <0 ) - goto error; +return err;/* add jack detect on/off control */ -if (!snd_hda_gen_add_kctl (&spec->gen,NULL , &vt1708_jack_detect_ctl)) { - err = -ENOMEM ; - goto error; - } +if (!snd_hda_gen_add_kctl (&spec->gen,NULL , &vt1708_jack_detect_ctl)) +return -ENOMEM ;/* clear jackpoll_interval again; it's set dynamically */ codec->jackpoll_interval =0 ;return 0 ; - - error: -via_free (codec); -return err; } -static int patch_vt1709 (struct hda_codec *codec) +static int probe_vt1709 (struct hda_codec *codec) { -struct via_spec *spec; -int err; - -/* create a codec specific record */ - spec =via_new_spec (codec); -if (spec ==NULL ) -return -ENOMEM ; +struct via_spec *spec = codec->spec; spec->gen.mixer_nid =0x18 ; - err =via_parse_auto_config (codec); -if (err <0 ) - goto error; - -return 0 ; - - error: -via_free (codec); -return err; +return via_parse_auto_config (codec); } -static int patch_vt1708S (struct hda_codec *codec); -static int patch_vt1708B (struct hda_codec *codec) +static int probe_vt1708S (struct hda_codec *codec); +static int probe_vt1708B (struct hda_codec *codec) { -struct via_spec *spec; -int err; +struct via_spec *spec = codec->spec;if (get_codec_type (codec) ==VT1708BCE ) -return patch_vt1708S (codec); - -/* create a codec specific record */ - spec =via_new_spec (codec); -if (spec ==NULL ) -return -ENOMEM ; +return probe_vt1708S (codec); spec->gen.mixer_nid =0x16 ;/* automatic parse from the BIOS config */ - err =via_parse_auto_config (codec); -if (err <0 ) - goto error; - -return 0 ; - - error: -via_free (codec); -return err; +return via_parse_auto_config (codec); } -/* Patch for VT1708S */ +/* Support for VT1708S */ static const struct hda_verb vt1708S_init_verbs[] = {/* Enable Mic Boost Volume backdoor */ {0x1 ,0xf98 ,0x1 },
@@ -706,16 +652,11 @@ static void override_mic_boost(struct hda_codec *codec, hda_nid_t pin, (0 << AC_AMPCAP_MUTE_SHIFT)); } -static int patch_vt1708S (struct hda_codec *codec) +static int probe_vt1708S (struct hda_codec *codec) { -struct via_spec *spec; +struct via_spec *spec = codec->spec;int err; -/* create a codec specific record */ - spec =via_new_spec (codec); -if (spec ==NULL ) -return -ENOMEM ; - spec->gen.mixer_nid =0x16 ;override_mic_boost (codec,0x1a ,0 ,3 ,40 );override_mic_boost (codec,0x1e ,0 ,3 ,40 );
@@ -729,21 +670,12 @@ static int patch_vt1708S(struct hda_codec *codec) err =snd_hda_add_verbs (codec, vt1708S_init_verbs);if (err <0 ) - goto error; +return err; -/* automatic parse from the BIOS config */ - err =via_parse_auto_config (codec); -if (err <0 ) - goto error; - -return 0 ; - - error: -via_free (codec); -return err; +return via_parse_auto_config (codec); } -/* Patch for VT1702 */ +/* Support for VT1702 */ static const struct hda_verb vt1702_init_verbs[] = {/* mixer enable */
@@ -753,16 +685,11 @@ static const struct hda_verb vt1702_init_verbs[] = { { } }; -static int patch_vt1702 (struct hda_codec *codec) +static int probe_vt1702 (struct hda_codec *codec) { -struct via_spec *spec; +struct via_spec *spec = codec->spec;int err; -/* create a codec specific record */ - spec =via_new_spec (codec); -if (spec ==NULL ) -return -ENOMEM ; - spec->gen.mixer_nid =0x1a ;/* limit AA path volume to 0 dB */
@@ -774,21 +701,13 @@ static int patch_vt1702(struct hda_codec *codec) err =snd_hda_add_verbs (codec, vt1702_init_verbs);if (err <0 ) - goto error; +return err;/* automatic parse from the BIOS config */ - err =via_parse_auto_config (codec); -if (err <0 ) - goto error; - -return 0 ; - - error: -via_free (codec); -return err; +return via_parse_auto_config (codec); } -/* Patch for VT1718S */ +/* Support for VT1718S */ static const struct hda_verb vt1718S_init_verbs[] = {/* Enable MW0 adjust Gain 5 */
@@ -836,16 +755,11 @@ static int add_secret_dac_path(struct hda_codec *codec) } -static int patch_vt1718S (struct hda_codec *codec) +static int probe_vt1718S (struct hda_codec *codec) { -struct via_spec *spec; +struct via_spec *spec = codec->spec;int err; -/* create a codec specific record */ - spec =via_new_spec (codec); -if (spec ==NULL ) -return -ENOMEM ; - spec->gen.mixer_nid =0x21 ;override_mic_boost (codec,0x2b ,0 ,3 ,40 );override_mic_boost (codec,0x29 ,0 ,3 ,40 );
@@ -853,21 +767,13 @@ static int patch_vt1718S(struct hda_codec *codec) err =snd_hda_add_verbs (codec, vt1718S_init_verbs);if (err <0 ) - goto error; +return err;/* automatic parse from the BIOS config */ - err =via_parse_auto_config (codec); -if (err <0 ) - goto error; - -return 0 ; - - error: -via_free (codec); -return err; +return via_parse_auto_config (codec); } -/* Patch for VT1716S */ +/* Support for VT1716S */ static int vt1716s_dmic_info (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_info *uinfo)
@@ -933,41 +839,30 @@ static const struct hda_verb vt1716S_init_verbs[] = { { } }; -static int patch_vt1716S (struct hda_codec *codec) +static int probe_vt1716S (struct hda_codec *codec) { -struct via_spec *spec; +struct via_spec *spec = codec->spec;int err; -/* create a codec specific record */ - spec =via_new_spec (codec); -if (spec ==NULL ) -return -ENOMEM ; - spec->gen.mixer_nid =0x16 ;override_mic_boost (codec,0x1a ,0 ,3 ,40 );override_mic_boost (codec,0x1e ,0 ,3 ,40 ); err =snd_hda_add_verbs (codec, vt1716S_init_verbs);if (err <0 ) - goto error; +return err;/* automatic parse from the BIOS config */ err =via_parse_auto_config (codec);if (err <0 ) - goto error; +return err;if (!snd_hda_gen_add_kctl (&spec->gen,NULL , &vt1716s_dmic_mixer_vol) || !snd_hda_gen_add_kctl (&spec->gen,NULL , &vt1716s_dmic_mixer_sw) || - !snd_hda_gen_add_kctl (&spec->gen,NULL , &vt1716S_mono_out_mixer)) { - err = -ENOMEM ; - goto error; - } + !snd_hda_gen_add_kctl (&spec->gen,NULL , &vt1716S_mono_out_mixer)) +return -ENOMEM ;return 0 ; - - error: -via_free (codec); -return err; }/* for vt2002P */
@@ -1055,17 +950,12 @@ static void fix_vt1802_connections(struct hda_codec *codec)snd_hda_override_conn_list (codec,0x33 ,ARRAY_SIZE (conn_33), conn_33); } -/* patch for vt2002P */ -static int patch_vt2002P (struct hda_codec *codec) +/* Support for vt2002P */ +static int probe_vt2002P (struct hda_codec *codec) { -struct via_spec *spec; +struct via_spec *spec = codec->spec;int err; -/* create a codec specific record */ - spec =via_new_spec (codec); -if (spec ==NULL ) -return -ENOMEM ; - spec->gen.mixer_nid =0x21 ;override_mic_boost (codec,0x2b ,0 ,3 ,40 );override_mic_boost (codec,0x29 ,0 ,3 ,40 );
@@ -1081,18 +971,10 @@ static int patch_vt2002P(struct hda_codec *codec)else err =snd_hda_add_verbs (codec, vt2002P_init_verbs);if (err <0 ) - goto error; +return err;/* automatic parse from the BIOS config */ - err =via_parse_auto_config (codec); -if (err <0 ) - goto error; - -return 0 ; - - error: -via_free (codec); -return err; +return via_parse_auto_config (codec); }/* for vt1812 */
@@ -1105,17 +987,11 @@ static const struct hda_verb vt1812_init_verbs[] = { { } }; -/* patch for vt1812 */ -static int patch_vt1812 (struct hda_codec *codec) +static int probe_vt1812 (struct hda_codec *codec) { -struct via_spec *spec; +struct via_spec *spec = codec->spec;int err; -/* create a codec specific record */ - spec =via_new_spec (codec); -if (spec ==NULL ) -return -ENOMEM ; - spec->gen.mixer_nid =0x21 ;override_mic_boost (codec,0x2b ,0 ,3 ,40 );override_mic_boost (codec,0x29 ,0 ,3 ,40 );
@@ -1123,21 +999,13 @@ static int patch_vt1812(struct hda_codec *codec) err =snd_hda_add_verbs (codec, vt1812_init_verbs);if (err <0 ) - goto error; +return err;/* automatic parse from the BIOS config */ - err =via_parse_auto_config (codec); -if (err <0 ) - goto error; - -return 0 ; - - error: -via_free (codec); -return err; +return via_parse_auto_config (codec); } -/* patch for vt3476 */ +/* Support for vt3476 */ static const struct hda_verb vt3476_init_verbs[] = {/* Enable DMic 8/16/32K */
@@ -1149,96 +1017,155 @@ static const struct hda_verb vt3476_init_verbs[] = { { } }; -static int patch_vt3476 (struct hda_codec *codec) +static int probe_vt3476 (struct hda_codec *codec) { -struct via_spec *spec; +struct via_spec *spec = codec->spec;int err; -/* create a codec specific record */ - spec =via_new_spec (codec); -if (spec ==NULL ) -return -ENOMEM ; - spec->gen.mixer_nid =0x3f ;add_secret_dac_path (codec); err =snd_hda_add_verbs (codec, vt3476_init_verbs);if (err <0 ) - goto error; +return err;/* automatic parse from the BIOS config */ - err =via_parse_auto_config (codec); -if (err <0 ) - goto error; +return via_parse_auto_config (codec); -return 0 ; - - error: -via_free (codec); -return err; }/* -* patch entries +* common driver probe +*/ +static int via_probe (struct hda_codec *codec,const struct hda_device_id *id) +{ +struct via_spec *spec; +int err; + +/* create a codec specific record */ + spec =via_new_spec (codec); +if (!spec) +return -ENOMEM ; + +switch (id->driver_data) { +case VT1708 : + err =probe_vt1708 (codec); +break ; +case VT1709 : + err =probe_vt1709 (codec); +break ; +case VT1708B : + err =probe_vt1708B (codec); +break ; +case VT1708S : + err =probe_vt1708S (codec); +break ; +case VT1702 : + err =probe_vt1702 (codec); +break ; +case VT1718S : + err =probe_vt1718S (codec); +break ; +case VT1716S : + err =probe_vt1716S (codec); +break ; +case VT2002P : + err =probe_vt2002P (codec); +break ; +case VT1812 : + err =probe_vt1812 (codec); +break ; +case VT3476 : + err =probe_vt3476 (codec); +break ; +default : + err = -EINVAL ; +break ; + } + +if (err <0 ) { +via_remove (codec); +return err; + } + +return 0 ; +} + +static const struct hda_codec_ops via_codec_ops = { + .probe = via_probe, + .remove = via_remove, + .build_controls = via_build_controls, + .build_pcms = via_build_pcms, + .init = via_init, + .unsol_event = snd_hda_jack_unsol_event, + .suspend = via_suspend, + .resume = via_resume, + .check_power_status = via_check_power_status, + .stream_pm = snd_hda_gen_stream_pm, +}; + +/* +* driver entries */ static const struct hda_device_id snd_hda_id_via[] = { -HDA_CODEC_ENTRY (0x11061708 ,"VT1708" , patch_vt1708), -HDA_CODEC_ENTRY (0x11061709 ,"VT1708" , patch_vt1708), -HDA_CODEC_ENTRY (0x1106170a ,"VT1708" , patch_vt1708), -HDA_CODEC_ENTRY (0x1106170b ,"VT1708" , patch_vt1708), -HDA_CODEC_ENTRY (0x1106e710 ,"VT1709 10-Ch" , patch_vt1709), -HDA_CODEC_ENTRY (0x1106e711 ,"VT1709 10-Ch" , patch_vt1709), -HDA_CODEC_ENTRY (0x1106e712 ,"VT1709 10-Ch" , patch_vt1709), -HDA_CODEC_ENTRY (0x1106e713 ,"VT1709 10-Ch" , patch_vt1709), -HDA_CODEC_ENTRY (0x1106e714 ,"VT1709 6-Ch" , patch_vt1709), -HDA_CODEC_ENTRY (0x1106e715 ,"VT1709 6-Ch" , patch_vt1709), -HDA_CODEC_ENTRY (0x1106e716 ,"VT1709 6-Ch" , patch_vt1709), -HDA_CODEC_ENTRY (0x1106e717 ,"VT1709 6-Ch" , patch_vt1709), -HDA_CODEC_ENTRY (0x1106e720 ,"VT1708B 8-Ch" , patch_vt1708B), -HDA_CODEC_ENTRY (0x1106e721 ,"VT1708B 8-Ch" , patch_vt1708B), -HDA_CODEC_ENTRY (0x1106e722 ,"VT1708B 8-Ch" , patch_vt1708B), -HDA_CODEC_ENTRY (0x1106e723 ,"VT1708B 8-Ch" , patch_vt1708B), -HDA_CODEC_ENTRY (0x1106e724 ,"VT1708B 4-Ch" , patch_vt1708B), -HDA_CODEC_ENTRY (0x1106e725 ,"VT1708B 4-Ch" , patch_vt1708B), -HDA_CODEC_ENTRY (0x1106e726 ,"VT1708B 4-Ch" , patch_vt1708B), -HDA_CODEC_ENTRY (0x1106e727 ,"VT1708B 4-Ch" , patch_vt1708B), -HDA_CODEC_ENTRY (0x11060397 ,"VT1708S" , patch_vt1708S), -HDA_CODEC_ENTRY (0x11061397 ,"VT1708S" , patch_vt1708S), -HDA_CODEC_ENTRY (0x11062397 ,"VT1708S" , patch_vt1708S), -HDA_CODEC_ENTRY (0x11063397 ,"VT1708S" , patch_vt1708S), -HDA_CODEC_ENTRY (0x11064397 ,"VT1705" , patch_vt1708S), -HDA_CODEC_ENTRY (0x11065397 ,"VT1708S" , patch_vt1708S), -HDA_CODEC_ENTRY (0x11066397 ,"VT1708S" , patch_vt1708S), -HDA_CODEC_ENTRY (0x11067397 ,"VT1708S" , patch_vt1708S), -HDA_CODEC_ENTRY (0x11060398 ,"VT1702" , patch_vt1702), -HDA_CODEC_ENTRY (0x11061398 ,"VT1702" , patch_vt1702), -HDA_CODEC_ENTRY (0x11062398 ,"VT1702" , patch_vt1702), -HDA_CODEC_ENTRY (0x11063398 ,"VT1702" , patch_vt1702), -HDA_CODEC_ENTRY (0x11064398 ,"VT1702" , patch_vt1702), -HDA_CODEC_ENTRY (0x11065398 ,"VT1702" , patch_vt1702), -HDA_CODEC_ENTRY (0x11066398 ,"VT1702" , patch_vt1702), -HDA_CODEC_ENTRY (0x11067398 ,"VT1702" , patch_vt1702), -HDA_CODEC_ENTRY (0x11060428 ,"VT1718S" , patch_vt1718S), -HDA_CODEC_ENTRY (0x11064428 ,"VT1718S" , patch_vt1718S), -HDA_CODEC_ENTRY (0x11060441 ,"VT2020" , patch_vt1718S), -HDA_CODEC_ENTRY (0x11064441 ,"VT1828S" , patch_vt1718S), -HDA_CODEC_ENTRY (0x11060433 ,"VT1716S" , patch_vt1716S), -HDA_CODEC_ENTRY (0x1106a721 ,"VT1716S" , patch_vt1716S), -HDA_CODEC_ENTRY (0x11060438 ,"VT2002P" , patch_vt2002P), -HDA_CODEC_ENTRY (0x11064438 ,"VT2002P" , patch_vt2002P), -HDA_CODEC_ENTRY (0x11060448 ,"VT1812" , patch_vt1812), -HDA_CODEC_ENTRY (0x11060440 ,"VT1818S" , patch_vt1708S), -HDA_CODEC_ENTRY (0x11060446 ,"VT1802" , patch_vt2002P), -HDA_CODEC_ENTRY (0x11068446 ,"VT1802" , patch_vt2002P), -HDA_CODEC_ENTRY (0x11064760 ,"VT1705CF" , patch_vt3476), -HDA_CODEC_ENTRY (0x11064761 ,"VT1708SCE" , patch_vt3476), -HDA_CODEC_ENTRY (0x11064762 ,"VT1808" , patch_vt3476), +HDA_CODEC_ID_MODEL (0x11061708 ,"VT1708" ,VT1708 ), +HDA_CODEC_ID_MODEL (0x11061709 ,"VT1708" ,VT1708 ), +HDA_CODEC_ID_MODEL (0x1106170a ,"VT1708" ,VT1708 ), +HDA_CODEC_ID_MODEL (0x1106170b ,"VT1708" ,VT1708 ), +HDA_CODEC_ID_MODEL (0x1106e710 ,"VT1709 10-Ch" ,VT1709 ), +HDA_CODEC_ID_MODEL (0x1106e711 ,"VT1709 10-Ch" ,VT1709 ), +HDA_CODEC_ID_MODEL (0x1106e712 ,"VT1709 10-Ch" ,VT1709 ), +HDA_CODEC_ID_MODEL (0x1106e713 ,"VT1709 10-Ch" ,VT1709 ), +HDA_CODEC_ID_MODEL (0x1106e714 ,"VT1709 6-Ch" ,VT1709 ), +HDA_CODEC_ID_MODEL (0x1106e715 ,"VT1709 6-Ch" ,VT1709 ), +HDA_CODEC_ID_MODEL (0x1106e716 ,"VT1709 6-Ch" ,VT1709 ), +HDA_CODEC_ID_MODEL (0x1106e717 ,"VT1709 6-Ch" ,VT1709 ), +HDA_CODEC_ID_MODEL (0x1106e720 ,"VT1708B 8-Ch" ,VT1708B ), +HDA_CODEC_ID_MODEL (0x1106e721 ,"VT1708B 8-Ch" ,VT1708B ), +HDA_CODEC_ID_MODEL (0x1106e722 ,"VT1708B 8-Ch" ,VT1708B ), +HDA_CODEC_ID_MODEL (0x1106e723 ,"VT1708B 8-Ch" ,VT1708B ), +HDA_CODEC_ID_MODEL (0x1106e724 ,"VT1708B 4-Ch" ,VT1708B ), +HDA_CODEC_ID_MODEL (0x1106e725 ,"VT1708B 4-Ch" ,VT1708B ), +HDA_CODEC_ID_MODEL (0x1106e726 ,"VT1708B 4-Ch" ,VT1708B ), +HDA_CODEC_ID_MODEL (0x1106e727 ,"VT1708B 4-Ch" ,VT1708B ), +HDA_CODEC_ID_MODEL (0x11060397 ,"VT1708S" ,VT1708S ), +HDA_CODEC_ID_MODEL (0x11061397 ,"VT1708S" ,VT1708S ), +HDA_CODEC_ID_MODEL (0x11062397 ,"VT1708S" ,VT1708S ), +HDA_CODEC_ID_MODEL (0x11063397 ,"VT1708S" ,VT1708S ), +HDA_CODEC_ID_MODEL (0x11064397 ,"VT1705" ,VT1708S ), +HDA_CODEC_ID_MODEL (0x11065397 ,"VT1708S" ,VT1708S ), +HDA_CODEC_ID_MODEL (0x11066397 ,"VT1708S" ,VT1708S ), +HDA_CODEC_ID_MODEL (0x11067397 ,"VT1708S" ,VT1708S ), +HDA_CODEC_ID_MODEL (0x11060398 ,"VT1702" ,VT1702 ), +HDA_CODEC_ID_MODEL (0x11061398 ,"VT1702" ,VT1702 ), +HDA_CODEC_ID_MODEL (0x11062398 ,"VT1702" ,VT1702 ), +HDA_CODEC_ID_MODEL (0x11063398 ,"VT1702" ,VT1702 ), +HDA_CODEC_ID_MODEL (0x11064398 ,"VT1702" ,VT1702 ), +HDA_CODEC_ID_MODEL (0x11065398 ,"VT1702" ,VT1702 ), +HDA_CODEC_ID_MODEL (0x11066398 ,"VT1702" ,VT1702 ), +HDA_CODEC_ID_MODEL (0x11067398 ,"VT1702" ,VT1702 ), +HDA_CODEC_ID_MODEL (0x11060428 ,"VT1718S" ,VT1718S ), +HDA_CODEC_ID_MODEL (0x11064428 ,"VT1718S" ,VT1718S ), +HDA_CODEC_ID_MODEL (0x11060441 ,"VT2020" ,VT1718S ), +HDA_CODEC_ID_MODEL (0x11064441 ,"VT1828S" ,VT1718S ), +HDA_CODEC_ID_MODEL (0x11060433 ,"VT1716S" ,VT1716S ), +HDA_CODEC_ID_MODEL (0x1106a721 ,"VT1716S" ,VT1716S ), +HDA_CODEC_ID_MODEL (0x11060438 ,"VT2002P" ,VT2002P ), +HDA_CODEC_ID_MODEL (0x11064438 ,"VT2002P" ,VT2002P ), +HDA_CODEC_ID_MODEL (0x11060448 ,"VT1812" ,VT1812 ), +HDA_CODEC_ID_MODEL (0x11060440 ,"VT1818S" ,VT1708S ), +HDA_CODEC_ID_MODEL (0x11060446 ,"VT1802" ,VT2002P ), +HDA_CODEC_ID_MODEL (0x11068446 ,"VT1802" ,VT2002P ), +HDA_CODEC_ID_MODEL (0x11064760 ,"VT1705CF" ,VT3476 ), +HDA_CODEC_ID_MODEL (0x11064761 ,"VT1708SCE" ,VT3476 ), +HDA_CODEC_ID_MODEL (0x11064762 ,"VT1808" ,VT3476 ), {}/* terminator */ };MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_via);static struct hda_codec_driver via_driver = { .id = snd_hda_id_via, + .ops = &via_codec_ops, };MODULE_LICENSE ("GPL" );
Signature · 1 line
2.50.0
PATCH 21/27 ALSA: hda/sigmatel: Rewrite to new probe method
In reply to Takashi IwaiConvert the Sigmatel/IDT codec driver to use the new hda_codec_ops probe. No functional changes.
--- sound/hda/codecs/sigmatel.c | 398 ++++++++++++++++++------------------ 1 file changed, 203 insertions(+), 195 deletions(-)
sound/hda/codecs/sigmatel.c +203 -195
@@ -2,7 +2,7 @@/* * Universal Interface for Intel High Definition Audio Codec * -* HD audio interface patch for SigmaTel STAC92xx +* HD audio codec driver for SigmaTel STAC92xx * * Copyright (c) 2005 Embedded Alley Solutions, Inc. * Matt Porter <[email protected]>
@@ -4391,8 +4391,6 @@ static int stac_init(struct hda_codec *codec)return 0 ; } -#define stac_free snd_hda_gen_free -#ifdef CONFIG_SND_PROC_FS static void stac92hd_proc_hook (struct snd_info_buffer *buffer,struct hda_codec *codec,hda_nid_t nid)
@@ -4454,15 +4452,6 @@ static int stac_suspend(struct hda_codec *codec)return 0 ; } -static const struct hda_codec_ops stac_patch_ops = { - .build_controls = snd_hda_gen_build_controls, - .build_pcms = snd_hda_gen_build_pcms, - .init = stac_init, - .free = stac_free, - .unsol_event = snd_hda_jack_unsol_event, - .suspend = stac_suspend, -}; -static int alloc_stac_spec (struct hda_codec *codec) {struct sigmatel_spec *spec;
@@ -4474,19 +4463,14 @@ static int alloc_stac_spec(struct hda_codec *codec) codec->spec = spec; codec->no_trigger_sense =1 ;/* seems common with STAC/IDT codecs */ spec->gen.dac_min_mute = true; - codec->patch_ops = stac_patch_ops;return 0 ; } -static int patch_stac9200 (struct hda_codec *codec) +static int probe_stac9200 (struct hda_codec *codec) {struct sigmatel_spec *spec;int err; - err =alloc_stac_spec (codec); -if (err <0 ) -return err; - spec = codec->spec; spec->linear_tone_beep =1 ; spec->gen.own_eapd_ctl =1 ;
@@ -4500,25 +4484,19 @@ static int patch_stac9200(struct hda_codec *codec)snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PRE_PROBE ); err =stac_parse_auto_config (codec); -if (err <0 ) { -stac_free (codec); +if (err <0 )return err; - }snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PROBE );return 0 ; } -static int patch_stac925x (struct hda_codec *codec) +static int probe_stac925x (struct hda_codec *codec) {struct sigmatel_spec *spec;int err; - err =alloc_stac_spec (codec); -if (err <0 ) -return err; - spec = codec->spec; spec->linear_tone_beep =1 ; spec->gen.own_eapd_ctl =1 ;
@@ -4530,26 +4508,20 @@ static int patch_stac925x(struct hda_codec *codec)snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PRE_PROBE ); err =stac_parse_auto_config (codec); -if (err <0 ) { -stac_free (codec); +if (err <0 )return err; - }snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PROBE );return 0 ; } -static int patch_stac92hd73xx (struct hda_codec *codec) +static int probe_stac92hd73xx (struct hda_codec *codec) {struct sigmatel_spec *spec;int err;int num_dacs; - err =alloc_stac_spec (codec); -if (err <0 ) -return err; - spec = codec->spec;/* enable power_save_node only for new 92HD89xx chips, as it causes * click noises on old 92HD73xx chips.
@@ -4604,10 +4576,8 @@ static int patch_stac92hd73xx(struct hda_codec *codec)snd_hda_add_verbs (codec, stac92hd73xx_core_init); err =stac_parse_auto_config (codec); -if (err <0 ) { -stac_free (codec); +if (err <0 )return err; - }/* Don't GPIO-mute speakers if there are no internal speakers, because * the GPIO might be necessary for Headphone
@@ -4646,15 +4616,11 @@ static void stac_setup_gpio(struct hda_codec *codec) } } -static int patch_stac92hd83xxx (struct hda_codec *codec) +static int probe_stac92hd83xxx (struct hda_codec *codec) {struct sigmatel_spec *spec;int err; - err =alloc_stac_spec (codec); -if (err <0 ) -return err; -/* longer delay needed for D3 */ codec->core.power_caps &= ~AC_PWRST_EPSS ;
@@ -4679,10 +4645,8 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)stac_setup_gpio (codec); err =stac_parse_auto_config (codec); -if (err <0 ) { -stac_free (codec); +if (err <0 )return err; - } codec->proc_widget_hook = stac92hd_proc_hook;
@@ -4695,15 +4659,11 @@ static const hda_nid_t stac92hd95_pwr_nids[] = { 0x0a, 0x0b, 0x0c, 0x0d }; -static int patch_stac92hd95 (struct hda_codec *codec) +static int probe_stac92hd95 (struct hda_codec *codec) {struct sigmatel_spec *spec;int err; - err =alloc_stac_spec (codec); -if (err <0 ) -return err; -/* longer delay needed for D3 */ codec->core.power_caps &= ~AC_PWRST_EPSS ;
@@ -4725,10 +4685,8 @@ static int patch_stac92hd95(struct hda_codec *codec)stac_setup_gpio (codec); err =stac_parse_auto_config (codec); -if (err <0 ) { -stac_free (codec); +if (err <0 )return err; - } codec->proc_widget_hook = stac92hd_proc_hook;
@@ -4737,16 +4695,12 @@ static int patch_stac92hd95(struct hda_codec *codec)return 0 ; } -static int patch_stac92hd71bxx (struct hda_codec *codec) +static int probe_stac92hd71bxx (struct hda_codec *codec) {struct sigmatel_spec *spec;const hda_nid_t *unmute_nids = stac92hd71bxx_unmute_nids;int err; - err =alloc_stac_spec (codec); -if (err <0 ) -return err; - spec = codec->spec;/* disabled power_save_node since it causes noises on a Dell machine */ /* codec->power_save_node = 1; */
@@ -4809,10 +4763,8 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)stac_setup_gpio (codec); err =stac_parse_auto_config (codec); -if (err <0 ) { -stac_free (codec); +if (err <0 )return err; - } codec->proc_widget_hook = stac92hd7x_proc_hook;
@@ -4821,15 +4773,11 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)return 0 ; } -static int patch_stac922x (struct hda_codec *codec) +static int probe_stac922x (struct hda_codec *codec) {struct sigmatel_spec *spec;int err; - err =alloc_stac_spec (codec); -if (err <0 ) -return err; - spec = codec->spec; spec->linear_tone_beep =1 ; spec->gen.own_eapd_ctl =1 ;
@@ -4848,10 +4796,8 @@ static int patch_stac922x(struct hda_codec *codec)snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PRE_PROBE ); err =stac_parse_auto_config (codec); -if (err <0 ) { -stac_free (codec); +if (err <0 )return err; - }snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PROBE );
@@ -4863,15 +4809,11 @@ static const char * const stac927x_spdif_labels[] = { "Analog Mux 2", "Analog Mux 3", NULL }; -static int patch_stac927x (struct hda_codec *codec) +static int probe_stac927x (struct hda_codec *codec) {struct sigmatel_spec *spec;int err; - err =alloc_stac_spec (codec); -if (err <0 ) -return err; - spec = codec->spec; spec->linear_tone_beep =1 ; spec->gen.own_eapd_ctl =1 ;
@@ -4897,10 +4839,8 @@ static int patch_stac927x(struct hda_codec *codec)snd_hda_add_verbs (codec, stac927x_core_init); err =stac_parse_auto_config (codec); -if (err <0 ) { -stac_free (codec); +if (err <0 )return err; - } codec->proc_widget_hook = stac927x_proc_hook;
@@ -4921,15 +4861,11 @@ static int patch_stac927x(struct hda_codec *codec)return 0 ; } -static int patch_stac9205 (struct hda_codec *codec) +static int probe_stac9205 (struct hda_codec *codec) {struct sigmatel_spec *spec;int err; - err =alloc_stac_spec (codec); -if (err <0 ) -return err; - spec = codec->spec; spec->linear_tone_beep =1 ; spec->gen.own_eapd_ctl =1 ;
@@ -4955,10 +4891,8 @@ static int patch_stac9205(struct hda_codec *codec)snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PRE_PROBE ); err =stac_parse_auto_config (codec); -if (err <0 ) { -stac_free (codec); +if (err <0 )return err; - } codec->proc_widget_hook = stac9205_proc_hook;
@@ -5008,15 +4942,11 @@ static const struct hda_quirk stac9872_fixup_tbl[] = { {}/* terminator */ }; -static int patch_stac9872 (struct hda_codec *codec) +static int probe_stac9872 (struct hda_codec *codec) {struct sigmatel_spec *spec;int err; - err =alloc_stac_spec (codec); -if (err <0 ) -return err; - spec = codec->spec; spec->linear_tone_beep =1 ; spec->gen.own_eapd_ctl =1 ;
@@ -5028,125 +4958,202 @@ static int patch_stac9872(struct hda_codec *codec)snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PRE_PROBE ); err =stac_parse_auto_config (codec); -if (err <0 ) { -stac_free (codec); -return -EINVAL ; - } +if (err <0 ) +return err;snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PROBE );return 0 ; } +/* +* common driver probe +*/ + +enum { +MODEL_STAC9200 , +MODEL_STAC9205 , +MODEL_STAC922X , +MODEL_STAC925X , +MODEL_STAC927X , +MODEL_STAC9872 , +MODEL_STAC92HD71BXX , +MODEL_STAC92HD73XX , +MODEL_STAC92HD83XXX , +MODEL_STAC92HD95 , +}; + +static int stac_probe (struct hda_codec *codec,const struct hda_device_id *id) +{ +int err; + + err =alloc_stac_spec (codec); +if (err <0 ) +return err; + +switch (id->driver_data) { +case MODEL_STAC9200 : + err =probe_stac9200 (codec); +break ; +case MODEL_STAC9205 : + err =probe_stac9205 (codec); +break ; +case MODEL_STAC922X : + err =probe_stac922x (codec); +break ; +case MODEL_STAC925X : + err =probe_stac925x (codec); +break ; +case MODEL_STAC927X : + err =probe_stac927x (codec); +break ; +case MODEL_STAC9872 : + err =probe_stac9872 (codec); +break ; +case MODEL_STAC92HD71BXX : + err =probe_stac92hd71bxx (codec); +break ; +case MODEL_STAC92HD73XX : + err =probe_stac92hd73xx (codec); +break ; +case MODEL_STAC92HD83XXX : + err =probe_stac92hd83xxx (codec); +break ; +case MODEL_STAC92HD95 : + err =probe_stac92hd95 (codec); +break ; +default : + err = -EINVAL ; +break ; + } + +if (err <0 ) { +snd_hda_gen_remove (codec); +return err; + } + +return 0 ; +} + +static const struct hda_codec_ops stac_codec_ops = { + .probe = stac_probe, + .remove = snd_hda_gen_remove, + .build_controls = snd_hda_gen_build_controls, + .build_pcms = snd_hda_gen_build_pcms, + .init = stac_init, + .unsol_event = snd_hda_jack_unsol_event, + .suspend = stac_suspend, + .stream_pm = snd_hda_gen_stream_pm, +};/* -* patch entries +* driver entries */ static const struct hda_device_id snd_hda_id_sigmatel[] = { -HDA_CODEC_ENTRY (0x83847690 ,"STAC9200" , patch_stac9200), -HDA_CODEC_ENTRY (0x83847882 ,"STAC9220 A1" , patch_stac922x), -HDA_CODEC_ENTRY (0x83847680 ,"STAC9221 A1" , patch_stac922x), -HDA_CODEC_ENTRY (0x83847880 ,"STAC9220 A2" , patch_stac922x), -HDA_CODEC_ENTRY (0x83847681 ,"STAC9220D/9223D A2" , patch_stac922x), -HDA_CODEC_ENTRY (0x83847682 ,"STAC9221 A2" , patch_stac922x), -HDA_CODEC_ENTRY (0x83847683 ,"STAC9221D A2" , patch_stac922x), -HDA_CODEC_ENTRY (0x83847618 ,"STAC9227" , patch_stac927x), -HDA_CODEC_ENTRY (0x83847619 ,"STAC9227" , patch_stac927x), -HDA_CODEC_ENTRY (0x83847638 ,"STAC92HD700" , patch_stac927x), -HDA_CODEC_ENTRY (0x83847616 ,"STAC9228" , patch_stac927x), -HDA_CODEC_ENTRY (0x83847617 ,"STAC9228" , patch_stac927x), -HDA_CODEC_ENTRY (0x83847614 ,"STAC9229" , patch_stac927x), -HDA_CODEC_ENTRY (0x83847615 ,"STAC9229" , patch_stac927x), -HDA_CODEC_ENTRY (0x83847620 ,"STAC9274" , patch_stac927x), -HDA_CODEC_ENTRY (0x83847621 ,"STAC9274D" , patch_stac927x), -HDA_CODEC_ENTRY (0x83847622 ,"STAC9273X" , patch_stac927x), -HDA_CODEC_ENTRY (0x83847623 ,"STAC9273D" , patch_stac927x), -HDA_CODEC_ENTRY (0x83847624 ,"STAC9272X" , patch_stac927x), -HDA_CODEC_ENTRY (0x83847625 ,"STAC9272D" , patch_stac927x), -HDA_CODEC_ENTRY (0x83847626 ,"STAC9271X" , patch_stac927x), -HDA_CODEC_ENTRY (0x83847627 ,"STAC9271D" , patch_stac927x), -HDA_CODEC_ENTRY (0x83847628 ,"STAC9274X5NH" , patch_stac927x), -HDA_CODEC_ENTRY (0x83847629 ,"STAC9274D5NH" , patch_stac927x), -HDA_CODEC_ENTRY (0x83847632 ,"STAC9202" , patch_stac925x), -HDA_CODEC_ENTRY (0x83847633 ,"STAC9202D" , patch_stac925x), -HDA_CODEC_ENTRY (0x83847634 ,"STAC9250" , patch_stac925x), -HDA_CODEC_ENTRY (0x83847635 ,"STAC9250D" , patch_stac925x), -HDA_CODEC_ENTRY (0x83847636 ,"STAC9251" , patch_stac925x), -HDA_CODEC_ENTRY (0x83847637 ,"STAC9250D" , patch_stac925x), -HDA_CODEC_ENTRY (0x83847645 ,"92HD206X" , patch_stac927x), -HDA_CODEC_ENTRY (0x83847646 ,"92HD206D" , patch_stac927x), +HDA_CODEC_ID_MODEL (0x83847690 ,"STAC9200" ,MODEL_STAC9200 ), +HDA_CODEC_ID_MODEL (0x83847882 ,"STAC9220 A1" ,MODEL_STAC922X ), +HDA_CODEC_ID_MODEL (0x83847680 ,"STAC9221 A1" ,MODEL_STAC922X ), +HDA_CODEC_ID_MODEL (0x83847880 ,"STAC9220 A2" ,MODEL_STAC922X ), +HDA_CODEC_ID_MODEL (0x83847681 ,"STAC9220D/9223D A2" ,MODEL_STAC922X ), +HDA_CODEC_ID_MODEL (0x83847682 ,"STAC9221 A2" ,MODEL_STAC922X ), +HDA_CODEC_ID_MODEL (0x83847683 ,"STAC9221D A2" ,MODEL_STAC922X ), +HDA_CODEC_ID_MODEL (0x83847618 ,"STAC9227" ,MODEL_STAC927X ), +HDA_CODEC_ID_MODEL (0x83847619 ,"STAC9227" ,MODEL_STAC927X ), +HDA_CODEC_ID_MODEL (0x83847638 ,"STAC92HD700" ,MODEL_STAC927X ), +HDA_CODEC_ID_MODEL (0x83847616 ,"STAC9228" ,MODEL_STAC927X ), +HDA_CODEC_ID_MODEL (0x83847617 ,"STAC9228" ,MODEL_STAC927X ), +HDA_CODEC_ID_MODEL (0x83847614 ,"STAC9229" ,MODEL_STAC927X ), +HDA_CODEC_ID_MODEL (0x83847615 ,"STAC9229" ,MODEL_STAC927X ), +HDA_CODEC_ID_MODEL (0x83847620 ,"STAC9274" ,MODEL_STAC927X ), +HDA_CODEC_ID_MODEL (0x83847621 ,"STAC9274D" ,MODEL_STAC927X ), +HDA_CODEC_ID_MODEL (0x83847622 ,"STAC9273X" ,MODEL_STAC927X ), +HDA_CODEC_ID_MODEL (0x83847623 ,"STAC9273D" ,MODEL_STAC927X ), +HDA_CODEC_ID_MODEL (0x83847624 ,"STAC9272X" ,MODEL_STAC927X ), +HDA_CODEC_ID_MODEL (0x83847625 ,"STAC9272D" ,MODEL_STAC927X ), +HDA_CODEC_ID_MODEL (0x83847626 ,"STAC9271X" ,MODEL_STAC927X ), +HDA_CODEC_ID_MODEL (0x83847627 ,"STAC9271D" ,MODEL_STAC927X ), +HDA_CODEC_ID_MODEL (0x83847628 ,"STAC9274X5NH" ,MODEL_STAC927X ), +HDA_CODEC_ID_MODEL (0x83847629 ,"STAC9274D5NH" ,MODEL_STAC927X ), +HDA_CODEC_ID_MODEL (0x83847632 ,"STAC9202" ,MODEL_STAC925X ), +HDA_CODEC_ID_MODEL (0x83847633 ,"STAC9202D" ,MODEL_STAC925X ), +HDA_CODEC_ID_MODEL (0x83847634 ,"STAC9250" ,MODEL_STAC925X ), +HDA_CODEC_ID_MODEL (0x83847635 ,"STAC9250D" ,MODEL_STAC925X ), +HDA_CODEC_ID_MODEL (0x83847636 ,"STAC9251" ,MODEL_STAC925X ), +HDA_CODEC_ID_MODEL (0x83847637 ,"STAC9250D" ,MODEL_STAC925X ), +HDA_CODEC_ID_MODEL (0x83847645 ,"92HD206X" ,MODEL_STAC927X ), +HDA_CODEC_ID_MODEL (0x83847646 ,"92HD206D" ,MODEL_STAC927X ),/* The following does not take into account .id=0x83847661 when subsys = * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are * currently not fully supported. */ -HDA_CODEC_ENTRY (0x83847661 ,"CXD9872RD/K" , patch_stac9872), -HDA_CODEC_ENTRY (0x83847662 ,"STAC9872AK" , patch_stac9872), -HDA_CODEC_ENTRY (0x83847664 ,"CXD9872AKD" , patch_stac9872), -HDA_CODEC_ENTRY (0x83847698 ,"STAC9205" , patch_stac9205), -HDA_CODEC_ENTRY (0x838476a0 ,"STAC9205" , patch_stac9205), -HDA_CODEC_ENTRY (0x838476a1 ,"STAC9205D" , patch_stac9205), -HDA_CODEC_ENTRY (0x838476a2 ,"STAC9204" , patch_stac9205), -HDA_CODEC_ENTRY (0x838476a3 ,"STAC9204D" , patch_stac9205), -HDA_CODEC_ENTRY (0x838476a4 ,"STAC9255" , patch_stac9205), -HDA_CODEC_ENTRY (0x838476a5 ,"STAC9255D" , patch_stac9205), -HDA_CODEC_ENTRY (0x838476a6 ,"STAC9254" , patch_stac9205), -HDA_CODEC_ENTRY (0x838476a7 ,"STAC9254D" , patch_stac9205), -HDA_CODEC_ENTRY (0x111d7603 ,"92HD75B3X5" , patch_stac92hd71bxx), -HDA_CODEC_ENTRY (0x111d7604 ,"92HD83C1X5" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d76d4 ,"92HD83C1C5" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d7605 ,"92HD81B1X5" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d76d5 ,"92HD81B1C5" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d76d1 ,"92HD87B1/3" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d76d9 ,"92HD87B2/4" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d7666 ,"92HD88B3" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d7667 ,"92HD88B1" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d7668 ,"92HD88B2" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d7669 ,"92HD88B4" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d7608 ,"92HD75B2X5" , patch_stac92hd71bxx), -HDA_CODEC_ENTRY (0x111d7674 ,"92HD73D1X5" , patch_stac92hd73xx), -HDA_CODEC_ENTRY (0x111d7675 ,"92HD73C1X5" , patch_stac92hd73xx), -HDA_CODEC_ENTRY (0x111d7676 ,"92HD73E1X5" , patch_stac92hd73xx), -HDA_CODEC_ENTRY (0x111d7695 ,"92HD95" , patch_stac92hd95), -HDA_CODEC_ENTRY (0x111d76b0 ,"92HD71B8X" , patch_stac92hd71bxx), -HDA_CODEC_ENTRY (0x111d76b1 ,"92HD71B8X" , patch_stac92hd71bxx), -HDA_CODEC_ENTRY (0x111d76b2 ,"92HD71B7X" , patch_stac92hd71bxx), -HDA_CODEC_ENTRY (0x111d76b3 ,"92HD71B7X" , patch_stac92hd71bxx), -HDA_CODEC_ENTRY (0x111d76b4 ,"92HD71B6X" , patch_stac92hd71bxx), -HDA_CODEC_ENTRY (0x111d76b5 ,"92HD71B6X" , patch_stac92hd71bxx), -HDA_CODEC_ENTRY (0x111d76b6 ,"92HD71B5X" , patch_stac92hd71bxx), -HDA_CODEC_ENTRY (0x111d76b7 ,"92HD71B5X" , patch_stac92hd71bxx), -HDA_CODEC_ENTRY (0x111d76c0 ,"92HD89C3" , patch_stac92hd73xx), -HDA_CODEC_ENTRY (0x111d76c1 ,"92HD89C2" , patch_stac92hd73xx), -HDA_CODEC_ENTRY (0x111d76c2 ,"92HD89C1" , patch_stac92hd73xx), -HDA_CODEC_ENTRY (0x111d76c3 ,"92HD89B3" , patch_stac92hd73xx), -HDA_CODEC_ENTRY (0x111d76c4 ,"92HD89B2" , patch_stac92hd73xx), -HDA_CODEC_ENTRY (0x111d76c5 ,"92HD89B1" , patch_stac92hd73xx), -HDA_CODEC_ENTRY (0x111d76c6 ,"92HD89E3" , patch_stac92hd73xx), -HDA_CODEC_ENTRY (0x111d76c7 ,"92HD89E2" , patch_stac92hd73xx), -HDA_CODEC_ENTRY (0x111d76c8 ,"92HD89E1" , patch_stac92hd73xx), -HDA_CODEC_ENTRY (0x111d76c9 ,"92HD89D3" , patch_stac92hd73xx), -HDA_CODEC_ENTRY (0x111d76ca ,"92HD89D2" , patch_stac92hd73xx), -HDA_CODEC_ENTRY (0x111d76cb ,"92HD89D1" , patch_stac92hd73xx), -HDA_CODEC_ENTRY (0x111d76cc ,"92HD89F3" , patch_stac92hd73xx), -HDA_CODEC_ENTRY (0x111d76cd ,"92HD89F2" , patch_stac92hd73xx), -HDA_CODEC_ENTRY (0x111d76ce ,"92HD89F1" , patch_stac92hd73xx), -HDA_CODEC_ENTRY (0x111d76df ,"92HD93BXX" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d76e0 ,"92HD91BXX" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d76e3 ,"92HD98BXX" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d76e5 ,"92HD99BXX" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d76e7 ,"92HD90BXX" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d76e8 ,"92HD66B1X5" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d76e9 ,"92HD66B2X5" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d76ea ,"92HD66B3X5" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d76eb ,"92HD66C1X5" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d76ec ,"92HD66C2X5" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d76ed ,"92HD66C3X5" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d76ee ,"92HD66B1X3" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d76ef ,"92HD66B2X3" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d76f0 ,"92HD66B3X3" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d76f1 ,"92HD66C1X3" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d76f2 ,"92HD66C2X3" , patch_stac92hd83xxx), -HDA_CODEC_ENTRY (0x111d76f3 ,"92HD66C3/65" , patch_stac92hd83xxx), +HDA_CODEC_ID_MODEL (0x83847661 ,"CXD9872RD/K" ,MODEL_STAC9872 ), +HDA_CODEC_ID_MODEL (0x83847662 ,"STAC9872AK" ,MODEL_STAC9872 ), +HDA_CODEC_ID_MODEL (0x83847664 ,"CXD9872AKD" ,MODEL_STAC9872 ), +HDA_CODEC_ID_MODEL (0x83847698 ,"STAC9205" ,MODEL_STAC9205 ), +HDA_CODEC_ID_MODEL (0x838476a0 ,"STAC9205" ,MODEL_STAC9205 ), +HDA_CODEC_ID_MODEL (0x838476a1 ,"STAC9205D" ,MODEL_STAC9205 ), +HDA_CODEC_ID_MODEL (0x838476a2 ,"STAC9204" ,MODEL_STAC9205 ), +HDA_CODEC_ID_MODEL (0x838476a3 ,"STAC9204D" ,MODEL_STAC9205 ), +HDA_CODEC_ID_MODEL (0x838476a4 ,"STAC9255" ,MODEL_STAC9205 ), +HDA_CODEC_ID_MODEL (0x838476a5 ,"STAC9255D" ,MODEL_STAC9205 ), +HDA_CODEC_ID_MODEL (0x838476a6 ,"STAC9254" ,MODEL_STAC9205 ), +HDA_CODEC_ID_MODEL (0x838476a7 ,"STAC9254D" ,MODEL_STAC9205 ), +HDA_CODEC_ID_MODEL (0x111d7603 ,"92HD75B3X5" ,MODEL_STAC92HD71BXX ), +HDA_CODEC_ID_MODEL (0x111d7604 ,"92HD83C1X5" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d76d4 ,"92HD83C1C5" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d7605 ,"92HD81B1X5" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d76d5 ,"92HD81B1C5" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d76d1 ,"92HD87B1/3" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d76d9 ,"92HD87B2/4" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d7666 ,"92HD88B3" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d7667 ,"92HD88B1" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d7668 ,"92HD88B2" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d7669 ,"92HD88B4" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d7608 ,"92HD75B2X5" ,MODEL_STAC92HD71BXX ), +HDA_CODEC_ID_MODEL (0x111d7674 ,"92HD73D1X5" ,MODEL_STAC92HD73XX ), +HDA_CODEC_ID_MODEL (0x111d7675 ,"92HD73C1X5" ,MODEL_STAC92HD73XX ), +HDA_CODEC_ID_MODEL (0x111d7676 ,"92HD73E1X5" ,MODEL_STAC92HD73XX ), +HDA_CODEC_ID_MODEL (0x111d7695 ,"92HD95" ,MODEL_STAC92HD95 ), +HDA_CODEC_ID_MODEL (0x111d76b0 ,"92HD71B8X" ,MODEL_STAC92HD71BXX ), +HDA_CODEC_ID_MODEL (0x111d76b1 ,"92HD71B8X" ,MODEL_STAC92HD71BXX ), +HDA_CODEC_ID_MODEL (0x111d76b2 ,"92HD71B7X" ,MODEL_STAC92HD71BXX ), +HDA_CODEC_ID_MODEL (0x111d76b3 ,"92HD71B7X" ,MODEL_STAC92HD71BXX ), +HDA_CODEC_ID_MODEL (0x111d76b4 ,"92HD71B6X" ,MODEL_STAC92HD71BXX ), +HDA_CODEC_ID_MODEL (0x111d76b5 ,"92HD71B6X" ,MODEL_STAC92HD71BXX ), +HDA_CODEC_ID_MODEL (0x111d76b6 ,"92HD71B5X" ,MODEL_STAC92HD71BXX ), +HDA_CODEC_ID_MODEL (0x111d76b7 ,"92HD71B5X" ,MODEL_STAC92HD71BXX ), +HDA_CODEC_ID_MODEL (0x111d76c0 ,"92HD89C3" ,MODEL_STAC92HD73XX ), +HDA_CODEC_ID_MODEL (0x111d76c1 ,"92HD89C2" ,MODEL_STAC92HD73XX ), +HDA_CODEC_ID_MODEL (0x111d76c2 ,"92HD89C1" ,MODEL_STAC92HD73XX ), +HDA_CODEC_ID_MODEL (0x111d76c3 ,"92HD89B3" ,MODEL_STAC92HD73XX ), +HDA_CODEC_ID_MODEL (0x111d76c4 ,"92HD89B2" ,MODEL_STAC92HD73XX ), +HDA_CODEC_ID_MODEL (0x111d76c5 ,"92HD89B1" ,MODEL_STAC92HD73XX ), +HDA_CODEC_ID_MODEL (0x111d76c6 ,"92HD89E3" ,MODEL_STAC92HD73XX ), +HDA_CODEC_ID_MODEL (0x111d76c7 ,"92HD89E2" ,MODEL_STAC92HD73XX ), +HDA_CODEC_ID_MODEL (0x111d76c8 ,"92HD89E1" ,MODEL_STAC92HD73XX ), +HDA_CODEC_ID_MODEL (0x111d76c9 ,"92HD89D3" ,MODEL_STAC92HD73XX ), +HDA_CODEC_ID_MODEL (0x111d76ca ,"92HD89D2" ,MODEL_STAC92HD73XX ), +HDA_CODEC_ID_MODEL (0x111d76cb ,"92HD89D1" ,MODEL_STAC92HD73XX ), +HDA_CODEC_ID_MODEL (0x111d76cc ,"92HD89F3" ,MODEL_STAC92HD73XX ), +HDA_CODEC_ID_MODEL (0x111d76cd ,"92HD89F2" ,MODEL_STAC92HD73XX ), +HDA_CODEC_ID_MODEL (0x111d76ce ,"92HD89F1" ,MODEL_STAC92HD73XX ), +HDA_CODEC_ID_MODEL (0x111d76df ,"92HD93BXX" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d76e0 ,"92HD91BXX" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d76e3 ,"92HD98BXX" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d76e5 ,"92HD99BXX" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d76e7 ,"92HD90BXX" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d76e8 ,"92HD66B1X5" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d76e9 ,"92HD66B2X5" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d76ea ,"92HD66B3X5" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d76eb ,"92HD66C1X5" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d76ec ,"92HD66C2X5" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d76ed ,"92HD66C3X5" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d76ee ,"92HD66B1X3" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d76ef ,"92HD66B2X3" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d76f0 ,"92HD66B3X3" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d76f1 ,"92HD66C1X3" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d76f2 ,"92HD66C2X3" ,MODEL_STAC92HD83XXX ), +HDA_CODEC_ID_MODEL (0x111d76f3 ,"92HD66C3/65" ,MODEL_STAC92HD83XXX ), {}/* terminator */ };MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_sigmatel);
@@ -5156,6 +5163,7 @@ MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec");static struct hda_codec_driver sigmatel_driver = { .id = snd_hda_id_sigmatel, + .ops = &stac_codec_ops, };module_hda_codec_driver (sigmatel_driver);
Signature · 1 line
2.50.0
PATCH 22/27 ALSA: hda/ca0132: Rewrite to new probe method
In reply to Takashi IwaiConvert the CA0132 codec driver to use the new hda_codec_ops probe. No functional changes.
--- sound/hda/codecs/ca0132.c | 103 +++++++++++++++++++++------------ sound/hda/codecs/ca0132_regs.h | 2 +- 2 files changed, 68 insertions(+), 37 deletions(-)
sound/hda/codecs/ca0132.c +67 -36
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0-or-later /* -* HD audio interface patch for Creative CA0132 chip +* HD audio codec driver for Creative CA0132 chip * * Copyright (c) 2011, Creative Technology Ltd. *
@@ -9118,7 +9118,7 @@ static void sbz_dsp_startup_check(struct hda_codec *codec)codec_info (codec,"Reloading... Tries left: %d" , reload);sbz_exit_chip (codec); spec->dsp_state =DSP_DOWNLOAD_INIT ; - codec->patch_ops.init (codec); +snd_hda_codec_init (codec); failure =0 ;for (i =0 ; i <4 ; i++) {chipio_read (codec, cur_address, &dsp_data_check[i]);
@@ -9694,30 +9694,6 @@ static void dbpro_free(struct hda_codec *codec)kfree (codec->spec); } -static int ca0132_suspend (struct hda_codec *codec) -{ -struct ca0132_spec *spec = codec->spec; - -cancel_delayed_work_sync (&spec->unsol_hp_work); -return 0 ; -} - -static const struct hda_codec_ops ca0132_patch_ops = { - .build_controls = ca0132_build_controls, - .build_pcms = ca0132_build_pcms, - .init = ca0132_init, - .free = ca0132_free, - .unsol_event = snd_hda_jack_unsol_event, - .suspend = ca0132_suspend, -}; - -static const struct hda_codec_ops dbpro_patch_ops = { - .build_controls = dbpro_build_controls, - .build_pcms = dbpro_build_pcms, - .init = dbpro_init, - .free = dbpro_free, -}; -static void ca0132_config (struct hda_codec *codec) {struct ca0132_spec *spec = codec->spec;
@@ -9982,12 +9958,23 @@ static void sbz_detect_quirk(struct hda_codec *codec) } } -static int patch_ca0132 (struct hda_codec *codec) +static void ca0132_codec_remove (struct hda_codec *codec) +{ +struct ca0132_spec *spec = codec->spec; + +if (ca0132_quirk (spec) ==QUIRK_ZXR_DBPRO ) +return dbpro_free (codec); +else +return ca0132_free (codec); +} + +static int ca0132_codec_probe (struct hda_codec *codec, +const struct hda_device_id *id) {struct ca0132_spec *spec;int err; -codec_dbg (codec,"patch_ca0132\n" ); +codec_dbg (codec,"%s\n" , __func__); spec =kzalloc (sizeof (*spec),GFP_KERNEL );if (!spec)
@@ -10000,11 +9987,6 @@ static int patch_ca0132(struct hda_codec *codec)if (ca0132_quirk (spec) ==QUIRK_SBZ )sbz_detect_quirk (codec); -if (ca0132_quirk (spec) ==QUIRK_ZXR_DBPRO ) - codec->patch_ops = dbpro_patch_ops; -else - codec->patch_ops = ca0132_patch_ops; - codec->pcm_format_first =1 ; codec->no_sticky_stream =1 ;
@@ -10100,15 +10082,63 @@ static int patch_ca0132(struct hda_codec *codec)return 0 ; error: -ca0132_free (codec); +ca0132_codec_remove (codec);return err; } +static int ca0132_codec_build_controls (struct hda_codec *codec) +{ +struct ca0132_spec *spec = codec->spec; + +if (ca0132_quirk (spec) ==QUIRK_ZXR_DBPRO ) +return dbpro_build_controls (codec); +else +return ca0132_build_controls (codec); +} + +static int ca0132_codec_build_pcms (struct hda_codec *codec) +{ +struct ca0132_spec *spec = codec->spec; + +if (ca0132_quirk (spec) ==QUIRK_ZXR_DBPRO ) +return dbpro_build_pcms (codec); +else +return ca0132_build_pcms (codec); +} + +static int ca0132_codec_init (struct hda_codec *codec) +{ +struct ca0132_spec *spec = codec->spec; + +if (ca0132_quirk (spec) ==QUIRK_ZXR_DBPRO ) +return dbpro_init (codec); +else +return ca0132_init (codec); +} + +static int ca0132_codec_suspend (struct hda_codec *codec) +{ +struct ca0132_spec *spec = codec->spec; + +cancel_delayed_work_sync (&spec->unsol_hp_work); +return 0 ; +} + +static const struct hda_codec_ops ca0132_codec_ops = { + .probe = ca0132_codec_probe, + .remove = ca0132_codec_remove, + .build_controls = ca0132_codec_build_controls, + .build_pcms = ca0132_codec_build_pcms, + .init = ca0132_codec_init, + .unsol_event = snd_hda_jack_unsol_event, + .suspend = ca0132_codec_suspend, +}; +/* -* patch entries +* driver entries */ static const struct hda_device_id snd_hda_id_ca0132[] = { -HDA_CODEC_ENTRY (0x11020011 ,"CA0132" , patch_ca0132), +HDA_CODEC_ID (0x11020011 ,"CA0132" ), {}/* terminator */ };MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_ca0132);
@@ -10118,6 +10148,7 @@ MODULE_DESCRIPTION("Creative Sound Core3D codec");static struct hda_codec_driver ca0132_driver = { .id = snd_hda_id_ca0132, + .ops = &ca0132_codec_ops, };module_hda_codec_driver (ca0132_driver);
sound/hda/codecs/ca0132_regs.h +1 -1
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0-or-later */ /* -* HD audio interface patch for Creative CA0132 chip. +* HD audio codec driver for Creative CA0132 chip. * CA0132 registers defines. * * Copyright (c) 2011, Creative Technology Ltd.
Signature · 1 line
2.50.0