From 9ab3fee861d0c4a617af9be6c94b9dc49b79d68c Mon Sep 17 00:00:00 2001 From: shiguangyuan1029 Date: Tue, 18 Feb 2025 15:47:09 +0800 Subject: [PATCH] dirver: i2s: implement ma1026 support for ACPI --- sound/soc/codecs/Kconfig | 8 ++++---- sound/soc/codecs/Makefile | 4 ++-- sound/soc/codecs/ma1026.c | 20 +++++++++++++------- sound/soc/phytium/Kconfig | 15 ++++++++------- sound/soc/phytium/Makefile | 6 +++--- sound/soc/phytium/pmdk_ma1026.c | 0 6 files changed, 30 insertions(+), 23 deletions(-) mode change 100644 => 100755 sound/soc/codecs/Kconfig mode change 100644 => 100755 sound/soc/codecs/Makefile mode change 100644 => 100755 sound/soc/phytium/Makefile mode change 100644 => 100755 sound/soc/phytium/pmdk_ma1026.c diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig old mode 100644 new mode 100755 index 11fe420cf3b..365deb65c19 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -182,7 +182,6 @@ config SND_SOC_ALL_CODECS imply SND_SOC_SI476X imply SND_SOC_SIMPLE_AMPLIFIER imply SND_SOC_SIRF_AUDIO_CODEC - imply SND_SOC_MA1026 if I2C imply SND_SOC_SPDIF imply SND_SOC_SSM2305 imply SND_SOC_SSM2518 @@ -840,6 +839,10 @@ config SND_SOC_LOCHNAGAR_SC This driver support the sound card functionality of the Cirrus Logic Lochnagar audio development board. +config SND_SOC_MA1026 + tristate "Cubiclattice MA1026 CODEC" + depends on I2C + config SND_SOC_MADERA tristate default y if SND_SOC_CS47L15=y @@ -1257,9 +1260,6 @@ config SND_SOC_SIRF_AUDIO_CODEC tristate "SiRF SoC internal audio codec" select REGMAP_MMIO -config SND_SOC_MA1026 - tristate "Cubiclattice MA1026 CODEC" - config SND_SOC_SPDIF tristate "S/PDIF CODEC" diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile old mode 100644 new mode 100755 index 344f0bf6151..ff15be1667f --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -105,6 +105,7 @@ snd-soc-l3-objs := l3.o snd-soc-lm4857-objs := lm4857.o snd-soc-lm49453-objs := lm49453.o snd-soc-lochnagar-sc-objs := lochnagar-sc.o +snd-soc-ma1026-objs := ma1026.o snd-soc-madera-objs := madera.o snd-soc-max9759-objs := max9759.o snd-soc-max9768-objs := max9768.o @@ -198,7 +199,6 @@ snd-soc-sigmadsp-i2c-objs := sigmadsp-i2c.o snd-soc-sigmadsp-regmap-objs := sigmadsp-regmap.o snd-soc-si476x-objs := si476x.o snd-soc-sirf-audio-codec-objs := sirf-audio-codec.o -snd-soc-ma1026-objs := ma1026.o snd-soc-spdif-tx-objs := spdif_transmitter.o snd-soc-spdif-rx-objs := spdif_receiver.o snd-soc-ssm2305-objs := ssm2305.o @@ -417,6 +417,7 @@ obj-$(CONFIG_SND_SOC_L3) += snd-soc-l3.o obj-$(CONFIG_SND_SOC_LM4857) += snd-soc-lm4857.o obj-$(CONFIG_SND_SOC_LM49453) += snd-soc-lm49453.o obj-$(CONFIG_SND_SOC_LOCHNAGAR_SC) += snd-soc-lochnagar-sc.o +obj-$(CONFIG_SND_SOC_MA1026) += snd-soc-ma1026.o obj-$(CONFIG_SND_SOC_MADERA) += snd-soc-madera.o obj-$(CONFIG_SND_SOC_MAX9759) += snd-soc-max9759.o obj-$(CONFIG_SND_SOC_MAX9768) += snd-soc-max9768.o @@ -510,7 +511,6 @@ obj-$(CONFIG_SND_SOC_SIGMADSP_REGMAP) += snd-soc-sigmadsp-regmap.o obj-$(CONFIG_SND_SOC_SI476X) += snd-soc-si476x.o obj-$(CONFIG_SND_SOC_SPDIF) += snd-soc-spdif-rx.o snd-soc-spdif-tx.o obj-$(CONFIG_SND_SOC_SIRF_AUDIO_CODEC) += sirf-audio-codec.o -obj-$(CONFIG_SND_SOC_MA1026) += snd-soc-ma1026.o obj-$(CONFIG_SND_SOC_SSM2305) += snd-soc-ssm2305.o obj-$(CONFIG_SND_SOC_SSM2518) += snd-soc-ssm2518.o obj-$(CONFIG_SND_SOC_SSM2602) += snd-soc-ssm2602.o diff --git a/sound/soc/codecs/ma1026.c b/sound/soc/codecs/ma1026.c index c3d6ad74f3d..a544d6c0885 100755 --- a/sound/soc/codecs/ma1026.c +++ b/sound/soc/codecs/ma1026.c @@ -43,7 +43,7 @@ snd_soc_component_write(codec, addr, value); #define snd_soc_update_ma1026(component, reg, mask, val) \ snd_soc_component_update_bits(component, reg, mask, val) -#elif (LINUX_VERSION_CODE < KERNEL_VERSION(6, 00, 0)) +#else #define snd_soc_write_ma1026(codec, addr, value) \ snd_soc_component_write(codec, addr, value); #define snd_soc_update_ma1026(component, reg, mask, val) \ @@ -56,7 +56,7 @@ #elif (LINUX_VERSION_CODE < KERNEL_VERSION(5, 00, 0)) #define snd_soc_read_ma1026(codec, addr) \ snd_soc_component_read32(codec, addr); -#elif (LINUX_VERSION_CODE < KERNEL_VERSION(6, 00, 0)) +#else #define snd_soc_read_ma1026(codec, addr) \ snd_soc_component_read(codec, addr); #endif @@ -185,7 +185,7 @@ static int ma1026_set_bias_level( struct snd_soc_codec *codec, #elif (LINUX_VERSION_CODE < KERNEL_VERSION(5, 00, 0)) struct snd_soc_component *codec, -#elif (LINUX_VERSION_CODE < KERNEL_VERSION(6, 00, 0)) +#else struct snd_soc_component *codec, #endif enum snd_soc_bias_level level) @@ -1017,6 +1017,11 @@ static void ma1026_i2c_shutdown(struct i2c_client *client) } } +static const struct i2c_device_id ma1026_id[] = { + {"ma1026", 0}, + {} +}; +MODULE_DEVICE_TABLE(i2c, ma1026_id); static const struct of_device_id ma1026_of_match[] = { {.compatible = "Phytium, ma1026", }, @@ -1025,16 +1030,17 @@ static const struct of_device_id ma1026_of_match[] = { MODULE_DEVICE_TABLE(of, ma1026_of_match); -static const struct i2c_device_id ma1026_id[] = { - {"ma1026", 0}, - {} +static const struct acpi_device_id ma1026_acpi_match[] = { + { "MAMA1026", 0}, + { } }; -MODULE_DEVICE_TABLE(i2c, ma1026_id); +MODULE_DEVICE_TABLE(acpi, ma1026_acpi_match); static struct i2c_driver ma1026_i2c_driver = { .driver = { .name = "ma1026", .of_match_table = ma1026_of_match, + .acpi_match_table = ma1026_acpi_match, }, .probe = ma1026_i2c_probe, .remove = ma1026_i2c_remove, diff --git a/sound/soc/phytium/Kconfig b/sound/soc/phytium/Kconfig index fb394641d02..74e3735b9fb 100755 --- a/sound/soc/phytium/Kconfig +++ b/sound/soc/phytium/Kconfig @@ -21,6 +21,14 @@ config SND_PMDK_ES8336 Say Y if you want to add Phytium machine support for ES8336 codecs. +config SND_PMDK_MA1026 + tristate "Phytium machine support with MA1026" + depends on I2C && SND_SOC_PHYTIUM_I2S + select SND_SOC_MA1026 + help + Say Y if you want to add Phytium machine support for + MA1026 codecs. + config SND_PMDK_DP tristate "Phytium machine support with DP" depends on I2C && SND_SOC_PHYTIUM_I2S @@ -28,10 +36,3 @@ config SND_PMDK_DP help Say Y if you want to add Phytium machine support for Displayport. - -config SND_PMDK_MA1026 - tristate "Phytium machine support with MA1026" - depends on I2C && SND_SOC_PHYTIUM_I2S - select SND_SOC_MA1026 - help - Say Y if you want to add Phytium machine support for MA1026 \ No newline at end of file diff --git a/sound/soc/phytium/Makefile b/sound/soc/phytium/Makefile old mode 100644 new mode 100755 index 066ffc3116a..cc6d8d29619 --- a/sound/soc/phytium/Makefile +++ b/sound/soc/phytium/Makefile @@ -9,8 +9,8 @@ obj-$(CONFIG_SND_PMDK_ES8388) += snd-soc-pmdk-es8388.o snd-soc-pmdk-es8336-objs :=pmdk_es8336.o obj-$(CONFIG_SND_PMDK_ES8336) += snd-soc-pmdk-es8336.o -snd-soc-pmdk-dp-objs :=pmdk_dp.o -obj-$(CONFIG_SND_PMDK_DP) += snd-soc-pmdk-dp.o - snd-soc-pmdk-ma1026-objs :=pmdk_ma1026.o obj-$(CONFIG_SND_PMDK_MA1026) += snd-soc-pmdk-ma1026.o + +snd-soc-pmdk-dp-objs :=pmdk_dp.o +obj-$(CONFIG_SND_PMDK_DP) += snd-soc-pmdk-dp.o diff --git a/sound/soc/phytium/pmdk_ma1026.c b/sound/soc/phytium/pmdk_ma1026.c old mode 100644 new mode 100755 -- Gitee