From 197fdaa076dafff760918945fa6a7fe205e9f665 Mon Sep 17 00:00:00 2001 From: NexyHo <68454650@qq.com> Date: Wed, 18 Dec 2024 01:16:11 -0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BB=A5=E4=B8=8B?= =?UTF-8?q?=E5=86=85=E5=AE=B9=20=201.=E6=8C=89=E7=85=A7=E9=A3=9E=E8=85=BE?= =?UTF-8?q?=E8=A6=81=E6=B1=82=E6=B7=BB=E5=8A=A0MA1026=E9=9F=B3=E9=A2=91?= =?UTF-8?q?=E5=8E=BB=E9=A9=B1=E5=8A=A8=20=202.=E4=BF=AE=E6=94=B9=E9=83=A8?= =?UTF-8?q?=E5=88=86Kconfig=E4=B8=8EMakefile=203.=E6=B7=BB=E5=8A=A0PHYT801?= =?UTF-8?q?3=20=E7=9A=84ACPI=E7=9A=84ID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arch/arm64/boot/dts/phytium/Makefile | 2 +- .../phytium/e2000d-miniitx-board-ma1026.dts | 275 ++++ sound/soc/codecs/Kconfig | 4 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/ma1026.c | 1186 +++++++++++++++++ sound/soc/codecs/ma1026.h | 127 ++ sound/soc/phytium/Kconfig | 8 + sound/soc/phytium/Makefile | 3 + sound/soc/phytium/pmdk_ma1026.c | 103 ++ 9 files changed, 1709 insertions(+), 1 deletion(-) create mode 100644 arch/arm64/boot/dts/phytium/e2000d-miniitx-board-ma1026.dts create mode 100644 sound/soc/codecs/ma1026.c create mode 100644 sound/soc/codecs/ma1026.h create mode 100644 sound/soc/phytium/pmdk_ma1026.c diff --git a/arch/arm64/boot/dts/phytium/Makefile b/arch/arm64/boot/dts/phytium/Makefile index 3847a7ed6af..68414d87ac4 100644 --- a/arch/arm64/boot/dts/phytium/Makefile +++ b/arch/arm64/boot/dts/phytium/Makefile @@ -3,6 +3,7 @@ dtb-$(CONFIG_ARCH_PHYTIUM) += e2000d-demo-board.dtb dtb-$(CONFIG_ARCH_PHYTIUM) += e2000s-demo-board.dtb dtb-$(CONFIG_ARCH_PHYTIUM) += e2000q-miniitx-board.dtb dtb-$(CONFIG_ARCH_PHYTIUM) += e2000d-miniitx-board.dtb +dtb-$(CONFIG_ARCH_PHYTIUM) += e2000d-miniitx-board-ma1026.dtb dtb-$(CONFIG_ARCH_PHYTIUM) += e2000q-vpx-board.dtb dtb-$(CONFIG_ARCH_PHYTIUM) += e2000q-edu-board.dtb dtb-$(CONFIG_ARCH_PHYTIUM) += e2000q-come-board.dtb @@ -10,6 +11,5 @@ dtb-$(CONFIG_ARCH_PHYTIUM) += e2000d-power-board.dtb dtb-$(CONFIG_ARCH_PHYTIUM) += e2000q-hanwei-board.dtb dtb-$(CONFIG_ARCH_PHYTIUM) += phytiumpi_firefly.dtb dtb-$(CONFIG_ARCH_PHYTIUM) += e2000d-chillipi-edu-board.dtb - #Enable support for device-tree overlay DTC_FLAGS += -@ diff --git a/arch/arm64/boot/dts/phytium/e2000d-miniitx-board-ma1026.dts b/arch/arm64/boot/dts/phytium/e2000d-miniitx-board-ma1026.dts new file mode 100644 index 00000000000..472783e71ea --- /dev/null +++ b/arch/arm64/boot/dts/phytium/e2000d-miniitx-board-ma1026.dts @@ -0,0 +1,275 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * DTS file for Phytium Pe2202 miniitx board + * + * Copyright (c) 2022-2024 Phytium Technology Co., Ltd. + * + * Hongmin Qi + */ + +/dts-v1/; +/memreserve/ 0x80000000 0x10000; + +#include "pe2202.dtsi" + +/{ + model = "Pe2202 MINIITX Board"; + compatible = "phytium,pe2202"; + + chosen { + stdout-path = "serial1:115200n8"; + }; + + memory@00{ + device_type = "memory"; + reg = <0x0 0x80000000 0x1 0x00000000>; + }; + + sound_card: sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,name = "phytium,pe220x-i2s-audio"; + simple-audio-card,cpu { + sound-dai = <&i2s0>; + }; + simple-audio-card,codec { + sound-dai = <&codec0>; + }; + }; +}; + +&soc { + mio0: uart@28014000 { + compatible = "arm,pl011","arm,primecell"; + reg = <0x0 0x28014000 0x0 0x1000>; + interrupts = ; + clocks = <&sysclk_50mhz &sysclk_50mhz>; + clock-names = "uartclk", "apb_pclk"; + status = "disabled"; + }; + + mio1: uart@28016000 { + compatible = "arm,pl011","arm,primecell"; + reg = <0x0 0x28016000 0x0 0x1000>; + interrupts = ; + clocks = <&sysclk_50mhz &sysclk_50mhz>; + clock-names = "uartclk", "apb_pclk"; + status = "disabled"; + }; + + mio9: i2c@28026000 { + compatible = "phytium,i2c"; + reg = <0x0 0x28026000 0x0 0x1000>; + interrupts = ; + clocks = <&sysclk_50mhz>; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + rtc@68 { + compatible = "dallas,ds1339"; + reg = <0x68>; + }; + + codec0:ma1026@42 { + status = "okay"; + #sound-dai-cells = <0x0>; + compatible = "Phytium,ma1026"; + reg = <0x42>; + }; + }; + + mio6: uart@28020000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x0 0x28020000 0x0 0x1000>; + interrupts = ; + clocks = <&sysclk_50mhz &sysclk_50mhz>; + clock-names = "uartclk", "apb_pclk"; + status = "okay"; + }; + + mio7: uart@28022000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x0 0x28022000 0x0 0x1000>; + interrupts = ; + clocks = <&sysclk_50mhz &sysclk_50mhz>; + clock-names = "uartclk", "apb_pclk"; + status = "okay"; + }; + + mio15: uart@28032000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x0 0x28032000 0x0 0x1000>; + interrupts = ; + clocks = <&sysclk_50mhz &sysclk_50mhz>; + clock-names = "uartclk", "apb_pclk"; + status = "okay"; + }; +}; + +&pcie { + status = "okay"; +}; + +&usb3_0 { + status = "okay"; +}; + +&usb3_1 { + status = "okay"; +}; + +&usb2_0 { + dr_mode = "otg"; + status = "okay"; +}; + +&usb2_1 { + dr_mode = "host"; + status = "disabled"; +}; + +&usb2_2 { + dr_mode = "host"; + status = "disabled"; +}; + +&usb2_3 { + dr_mode = "host"; + status = "okay"; +}; + +&usb2_4 { + dr_mode = "host"; + status = "okay"; +}; + +&macb0 { + phy-mode = "sgmii"; + use-mii; + status = "okay"; +}; + +&macb1 { + phy-mode = "sgmii"; + use-mii; + status = "disabled"; +}; + +&macb2 { + phy-mode = "sgmii"; + use-mii; + status = "okay"; +}; + +&macb3 { + phy-mode = "sgmii"; + use-mii; + status = "disabled"; +}; + +&can0 { + status = "okay"; +}; + +&can1 { + status = "okay"; +}; + +&qspi0 { + status = "okay"; + + flash@0 { + status = "okay"; + }; +}; + +&spi0 { + global-cs = <1>; + status = "disabled"; + + flash: w25q128@0 { + compatible = "winbond,w25q128", "jedec,spi-nor"; + spi-tx-bus-width = <1>; + spi-rx-bus-width = <1>; + spi-max-frequency = <12000000>; + reg = <0x00>; + status = "disabled"; + }; +}; + +&spi2 { + global-cs = <1>; + status = "disabled"; +}; + +&spi3 { + global-cs = <1>; + status = "disabled"; +}; + +&mmc0 { + status = "okay"; + bus-width = <0x4>; + max-frequency = <50000000>; + cap-sdio-irq; + cap-sd-highspeed; + no-mmc; +}; + +&uart0 { + status = "okay"; +}; + +&uart1 { + status = "okay"; +}; + +&uart2 { + status = "okay"; +}; + +&uart3 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&gpio4 { + status = "okay"; +}; + +&sata0 { + status = "okay"; +}; + +&sata1 { + status = "okay"; +}; + +&dc0 { + status = "okay"; + pipe_mask = [02]; + edp_mask = [00]; +}; + +&i2s0 { + #sound-dai-cells = <0>; + dai-name = "phytium-i2s-lsd"; + status = "okay"; +}; + +&pwm1 { + phytium,db = <0 0 0 1000 1000 0>; + status = "okay"; +}; diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 75e8f638996..03b6027d84a 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -146,6 +146,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_SI476X if MFD_SI476X_CORE select SND_SOC_SIMPLE_AMPLIFIER select SND_SOC_SIRF_AUDIO_CODEC + select SND_SOC_MA1026 if I2C select SND_SOC_SPDIF select SND_SOC_SSM2305 select SND_SOC_SSM2518 if I2C @@ -914,6 +915,9 @@ config SND_SOC_SIRF_AUDIO_CODEC tristate "SiRF SoC internal audio codec" select REGMAP_MMIO +config SND_SOC_MA1026 + tristate "Phytium MA1026 CODEC" + config SND_SOC_SPDIF tristate "S/PDIF CODEC" diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index 1ba362d2dd6..56121cfd536 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -158,6 +158,7 @@ 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 @@ -420,6 +421,7 @@ 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 new file mode 100644 index 00000000000..34f81893ebd --- /dev/null +++ b/sound/soc/codecs/ma1026.c @@ -0,0 +1,1186 @@ + +#include + + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + + +#include "ma1026.h" + +#define MA_DBG(fmt...) printk(fmt) +// do { +// printk("ma1026 [%s]-%d:", __FUNCTION__, __LINE__); +// printk(fmt); +// }while(0) + + + + + +#define ma1026_LRCK (SNDRV_PCM_RATE_8000_48000 | SNDRV_PCM_RATE_KNOT) +#define ma1026_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S24_LE) + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 00, 0)) + #define snd_soc_write_ma1026(codec,addr,value) snd_soc_write(codec, addr, value); + #define snd_soc_update_ma1026(component,reg,mask,val) snd_soc_update_bits(component,reg,mask,val) +#elif (LINUX_VERSION_CODE < KERNEL_VERSION(5, 00, 0)) + #define snd_soc_write_ma1026(codec,addr,value) 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)) + #define snd_soc_write_ma1026(codec,addr,value) 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) +#endif + + + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 00, 0)) + #define snd_soc_read_ma1026(codec,addr) snd_soc_read(codec, addr); +#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)) + #define snd_soc_read_ma1026(codec,addr) snd_soc_component_read(codec, addr); +#endif + + +struct sp_config { + u8 spc, mmcc, spfs; + u32 lrckfreq; +}; + +struct ma1026_priv{ + struct gpio_desc *gpiod_spk_ctl; + struct sp_config config; + struct regmap *regmap; + struct clk *mclk; + unsigned int sysclk; + struct snd_pcm_hw_constraint_list *sysclk_constraints; + int shutdwn_delay; + bool hp_mute; + bool hp_inserted; + long force_muted; //--强制静音 + + + long playback_path; + long capture_path; + +}; + +struct snd_pcm_constr_list { + int count; + u32 *list; +}; + + +struct ma1026_mclk_div { + u32 mclk, lrckfreq; + u8 mmcc; +}; + +static struct ma1026_mclk_div ma1026_mclk_coeffs[] = { + /* MCLK, LRCK, MMCC[5:0] */ + {5644800, 11025, 0x30}, + {5644800, 22050, 0x20}, + {5644800, 44100, 0x10}, + + {6144000, 8000, 0x38}, + {6144000, 12000, 0x30}, + {6144000, 16000, 0x28}, + {6144000, 24000, 0x20}, + {6144000, 32000, 0x18}, + {6144000, 48000, 0x10}, + +}; + + +struct ma1026_priv *globe_ma1026; +static struct snd_soc_component *ma1026_codec; + +struct workqueue_struct *spk_monitor_wq; +struct delayed_work spk_delay_work; + + +static unsigned int rates_12288[] = { + 8000, 12000, 16000, 24000, 24000, 32000, 48000, 96000, +}; + +static struct snd_pcm_hw_constraint_list constraints_12288 = { + .count = ARRAY_SIZE(rates_12288), + .list = rates_12288, +}; + +static unsigned int rates_112896[] = { + 8000, 11025, 22050, 44100, +}; + +static struct snd_pcm_hw_constraint_list constraints_112896 = { + .count = ARRAY_SIZE(rates_112896), + .list = rates_112896, +}; + +static unsigned int rates_12[] = { + 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, + 48000, 88235, 96000, +}; + +static struct snd_pcm_hw_constraint_list constraints_12 = { + .count = ARRAY_SIZE(rates_12), + .list = rates_12, +}; + +// void ma1026_enable_spk(struct ma1026_priv *ma1026, bool enable) +// { +// if (!ma1026 || !ma1026->gpiod_spk_ctl) +// return; +// MA_DBG("ma1026" "enable = %d\n", enable); +// gpiod_set_value(ma1026->gpiod_spk_ctl, enable); +// } + +// static void spk_delay_work_handle(struct work_struct *work) +// { +// MA_DBG("ma1026" "globe_ma1026->hp_inserted = %d\n", globe_ma1026->hp_inserted); +// if (!globe_ma1026->hp_inserted) +// ma1026_enable_spk(globe_ma1026, true); +// } + + +static bool ma1026_volatile_reg(struct device *dev, unsigned int reg) +{ + if (reg <= 255) + return true; + else + return false; +} + +static bool ma1026_readable_reg(struct device *dev, unsigned int reg) +{ + if (reg <= 255) + return true; + else + return false; +} +static const struct reg_default ma1026_reg_defaults[] = { + { 1, 0xF1 },{ 2, 0xDF },{ 3, 0x3F },{ 4, 0x60 }, + { 5, 0x77 },{ 6, 0x04 },{ 7, 0x00 },{ 8, 0x15 }, + { 9, 0x06 },{ 10, 0x00 },{ 11, 0x00 },{ 12, 0x00 }, + { 13, 0x00 },{ 14, 0x00 },{ 15, 0x00 },{ 16, 0x00 }, + { 17, 0x00 },{ 18, 0x02 },{ 19, 0x02 },{ 20, 0x00 }, + { 21, 0x00 },{ 22, 0x00 },{ 23, 0x7F },{ 24, 0x03 }, + { 25, 0x00 },{ 26, 0x3F },{ 27, 0xE1 },{ 28, 0x00 }, + { 29, 0x00 },{ 30, 0x08 },{ 31, 0x3F },{ 32, 0x3F }, + { 33, 0x00 },{ 34, 0x00 },{ 35, 0x00 },{ 36, 0x00 }, + { 37, 0x3F },{ 38, 0x3F },{ 94, 0x00 }, +}; + +static struct regmap_config ma1026_regmap = { + .reg_bits = 8, + .val_bits = 8, + // .reg_bits = 32, + // .val_bits = 32, + + .max_register = MA1026_MAX_REGISTER, + .reg_defaults = ma1026_reg_defaults, + .num_reg_defaults = ARRAY_SIZE(ma1026_reg_defaults), + .volatile_reg = ma1026_volatile_reg, + .readable_reg = ma1026_readable_reg, + .cache_type = REGCACHE_RBTREE, +}; + + + + +static int ma1026_set_bias_level( +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 00, 0)) + 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)) + struct snd_soc_component *codec, +#endif + enum snd_soc_bias_level level) +{ + MA_DBG("ma1026" "set ma1026 bias level level = %d \n",level); + if (level == SND_SOC_BIAS_ON) { + snd_soc_component_update_bits(codec, MA1026_DMMCC, MA1026_MCLKDIS, 0); + snd_soc_component_update_bits(codec, MA1026_PWRCTRL1, MA1026_PDN, 0); + }else { + //snd_soc_update_bits(codec, ma1026_PWRCTRL1, ma1026_PDN, 1); + //snd_soc_update_bits(codec, ma1026_DMMCC, ma1026_MCLKDIS, 1); + } + //codec->dapm.bias_level = level; + + return 0; +} + + +static DECLARE_TLV_DB_SCALE(micpga_tlv, 0, 100, 0); +static DECLARE_TLV_DB_SCALE(ipdig_tlv, -9600, 100, 0); +static DECLARE_TLV_DB_SCALE(adc_20db_tlv, 0, 2000, 0); + +static const char * const ma1026_pgaa[] = { "Line 1", "Mic 1" }; +static const char * const ma1026_pgab[] = { "Line 2", "Mic 2" }; + +static const struct soc_enum pgaa_enum = + SOC_ENUM_SINGLE(MA1026_ADCIPC, 3, ARRAY_SIZE(ma1026_pgaa), ma1026_pgaa); +static const struct soc_enum pgab_enum = + SOC_ENUM_SINGLE(MA1026_ADCIPC, 7, ARRAY_SIZE(ma1026_pgab), ma1026_pgab); + +static const char * const ma1026_ip_swap[] = {"Stereo", "Mono 1", "Mono 2", "Swap 1/2"}; +static const struct soc_enum ip_swap_enum = + SOC_ENUM_SINGLE(MA1026_MIOPC, 6, ARRAY_SIZE(ma1026_ip_swap), ma1026_ip_swap); + +static const char * const ma1026_ng_delay[] = {"50ms", "100ms", "150ms", "200ms"}; +static const struct soc_enum ng_delay_enum = + SOC_ENUM_SINGLE(MA1026_NGCAB, 0, ARRAY_SIZE(ma1026_ng_delay), ma1026_ng_delay); + + + +static const struct snd_kcontrol_new pgaa_mux = + SOC_DAPM_ENUM("Left Analog Input Capture Mux", pgaa_enum); +static const struct snd_kcontrol_new pgab_mux = + SOC_DAPM_ENUM("Right Analog Input Capture Mux", pgab_enum); +static const struct snd_kcontrol_new input_left_mixer[] = { + SOC_DAPM_SINGLE("ADC Left Input", MA1026_PWRCTRL1, 5, 1, 1), + SOC_DAPM_SINGLE("DMIC Left Input", MA1026_PWRCTRL1, 4, 1, 1),}; +static const struct snd_kcontrol_new input_right_mixer[] = { + SOC_DAPM_SINGLE("ADC Right Input", MA1026_PWRCTRL1, 7, 1, 1), + SOC_DAPM_SINGLE("DMIC Right Input", MA1026_PWRCTRL1, 6, 1, 1),}; + + + + +// static const unsigned int hpd_tlv[] = {TLV_DB_RANGE_HEAD(2), +// -102, 0, TLV_DB_SCALE_ITEM(-10200, 50, 0), +// 1, 12, TLV_DB_SCALE_ITEM(0, 50, 0), +// }; +static DECLARE_TLV_DB_SCALE(hpd_tlv, -10200, 50, 0); +static DECLARE_TLV_DB_SCALE(hpa_tlv, -5400, 200, 0); + + +//--这边逻辑取反 +static const unsigned int limiter_tlv[] = {TLV_DB_RANGE_HEAD(2), + 0, 2, TLV_DB_SCALE_ITEM(-3000, 600, 0), // --假设给的值是0 那么逻辑取反的话就是 0B111 对应的值是 -30dB + // 值是1 那么逻辑取反的话就是 0B110 对应的值是 -24dB + // 值是2 那么逻辑取反的话就是 0B101 对应的值是 -18dB + 3, 7, TLV_DB_SCALE_ITEM(-1200, 300, 0),}; + +static const char * const ma1026_playback_path_mode[] = { + "OPEN SPK","CLOSE SPK", "OPEN HP A","CLOSE HP A","OPEN HP B","CLOSE HP B","OPEN HP","CLOSE HP" +}; +static const char * const ma1026_capture_path_mode[] = { + "OPEN DIGITAL MIC", "CLOSE DIGITAL MIC", "OPEN MIC A", "CLOSE MIC A" , "OPEN MIC B" ,"CLOSE MIC B" +}; +static const char * const ma1026_mute_mode[] = { + "MUTE OFF", "MUTE ON", +}; + +static SOC_ENUM_SINGLE_DECL(ma1026_playback_path_type, + 0, 0, ma1026_playback_path_mode); + +static SOC_ENUM_SINGLE_DECL(ma1026_capture_path_type, + 0, 0, ma1026_capture_path_mode); + +static SOC_ENUM_SINGLE_DECL(ma1026_mute_type, + 0, 0, ma1026_mute_mode); + + + +static int ma1026_playback_path_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct ma1026_priv* ma1026 = snd_soc_component_get_drvdata(component); + + MA_DBG("ma1026 %s : playback_path %ld\n", __func__, ma1026->playback_path); + + ucontrol->value.integer.value[0] = ma1026->playback_path; + + return 0; +} + +static int ma1026_playback_path_config(struct snd_soc_component *component, + long int pre_path, long int target_path) +{ + + int reg = 0; + struct ma1026_priv *ma1026 = snd_soc_component_get_drvdata(component); + + ma1026->playback_path = target_path; + + // mutex_lock(&ma1026->clk_lock); + // if (ma1026->playback_path != OFF) { + // if (ma1026->clk_playback == 0) { + // clk_prepare_enable(ma1026->mclk); + // ma1026->clk_playback++; + // } + // } else { + // if (ma1026->clk_playback > 0) { + // clk_disable_unprepare(ma1026->mclk); + // ma1026->clk_playback--; + // } + // } + // mutex_unlock(&ma1026->clk_lock); + switch (ma1026->playback_path) { + case OPEN_SPK_E: + + break; + case CLOSE_SPK: + break; + + case OPEN_HP_A: + snd_soc_update_ma1026(component,MA1026_MICBSVDDA,MA1026_MICBSVDDA_HPA,1<<5); //设置HPA 打开 + snd_soc_update_ma1026(component,MA1026_PWRCTRL3,MA1026_PDN_HP,0); + break; + case CLOSE_HP_A: + snd_soc_update_ma1026(component,MA1026_MICBSVDDA,MA1026_MICBSVDDA_HPA,0<<5); //设置HPA 关闭 + reg = snd_soc_read_ma1026(component,MA1026_MICBSVDDA); + MA_DBG("ma1026" "%s : MA1026_MICBSVDDA = %x\n",__func__,reg); + if((reg&MA1026_MICBSVDDA_HPB) ==0 ) + snd_soc_update_ma1026(component,MA1026_PWRCTRL3,MA1026_PDN_HP,1); + break; + + case OPEN_HP_B: + snd_soc_update_ma1026(component,MA1026_MICBSVDDA,MA1026_MICBSVDDA_HPB,1<<6); //设置HPB 打开 + snd_soc_update_ma1026(component,MA1026_PWRCTRL3,MA1026_PDN_HP,0); + break; + case CLOSE_HP_B: + snd_soc_update_ma1026(component,MA1026_MICBSVDDA,MA1026_MICBSVDDA_HPB,0<<6); //设置HPB 关闭 + reg = snd_soc_read_ma1026(component,MA1026_MICBSVDDA); + MA_DBG("ma1026" "%s : ma1026_MICBSVDDA = %x\n",__func__,reg); + if((reg&MA1026_MICBSVDDA_HPA) ==0 ) + snd_soc_update_ma1026(component,MA1026_PWRCTRL3,MA1026_PDN_HP,1); + break; + case OPEN_HP: + snd_soc_update_ma1026(component,MA1026_MICBSVDDA,MA1026_MICBSVDDA_HPA,1<<5); //设置HPA 打开 + snd_soc_update_ma1026(component,MA1026_MICBSVDDA,MA1026_MICBSVDDA_HPB,1<<6); + break; + case CLOSE_HP: + snd_soc_update_ma1026(component,MA1026_MICBSVDDA,MA1026_MICBSVDDA_HPB,0<<6); //设置HPB 打开 + snd_soc_update_ma1026(component,MA1026_MICBSVDDA,MA1026_MICBSVDDA_HPB,0<<5); //设置HPA 关闭 + snd_soc_update_ma1026(component,MA1026_PWRCTRL3,MA1026_PDN_HP,1); + break; + } + return 0; + + +} +static int ma1026_playback_path_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct ma1026_priv *ma1026 = snd_soc_component_get_drvdata(component); + static int isSet = 0; + if (ma1026->playback_path == ucontrol->value.integer.value[0] && isSet == 1) { + MA_DBG("ma1026" "%s : playback_path is not changed!\n", + __func__); + return 0; + } + isSet = 1; + return ma1026_playback_path_config(component, ma1026->playback_path, + ucontrol->value.integer.value[0]); +} + + +static int ma1026_capture_path_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct ma1026_priv* ma1026 = snd_soc_component_get_drvdata(component); + + MA_DBG("ma1026 %s : capture_path %ld\n", __func__,ma1026->capture_path); + + ucontrol->value.integer.value[0] = ma1026->capture_path; + return 0; +} + + +static int ma1026_capture_path_config(struct snd_soc_component *component, + long pre_path, long target_path) +{ + struct ma1026_priv *ma1026 = snd_soc_component_get_drvdata(component); + + ma1026->capture_path = target_path; + + switch (ma1026->capture_path) + { + case OPEN_DIGITAL_MIC: + snd_soc_update_ma1026(component,MA1026_PWRCTRL1,MA1026_PDN_DMICB,0<<6); + snd_soc_update_ma1026(component,MA1026_PWRCTRL1,MA1026_PDN_DMICB,0<<4); + snd_soc_update_ma1026(component,MA1026_PWRCTRL1,MA1026_PDN_ADCB,1<<7); + snd_soc_update_ma1026(component,MA1026_PWRCTRL1,MA1026_PDN_ADCA,1<<5); + break; + case CLOSE_DIGITAL_MIC: + snd_soc_update_ma1026(component,MA1026_PWRCTRL1,MA1026_PDN_DMICB,0<<6); + snd_soc_update_ma1026(component,MA1026_PWRCTRL1,MA1026_PDN_DMICB,0<<4); + snd_soc_update_ma1026(component,MA1026_PWRCTRL1,MA1026_PDN_ADCB,0<<7); + snd_soc_update_ma1026(component,MA1026_PWRCTRL1,MA1026_PDN_ADCA,0<<5); + break; + + case SELECT_MIC_A: + snd_soc_update_ma1026(component,MA1026_ADCIPC,MA1026_ADCIPC_MICB_LINEB,1<<7); + + break; + case SELECT_LINE_A: + snd_soc_update_ma1026(component,MA1026_ADCIPC,MA1026_ADCIPC_MICB_LINEB,0<<7); + break; + + + case SELECT_MIC_B: + snd_soc_update_ma1026(component,MA1026_ADCIPC,MA1026_ADCIPC_MICA_LINEA,1<<3); + break; + case SELECT_LINE_B: + snd_soc_update_ma1026(component,MA1026_ADCIPC,MA1026_ADCIPC_MICA_LINEA,0<<3); + break; + + default: + break; + } + return 0; +} + + +static int ma1026_capture_path_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct ma1026_priv* ma1026 = snd_soc_component_get_drvdata(component); + static int isSet = 0; + if (ma1026->capture_path == ucontrol->value.integer.value[0] && isSet == 1) { + MA_DBG("ma1026" "%s : capture_path is not changed!\n", + __func__); + return 0; + } + isSet = 1; + return ma1026_capture_path_config(component, ma1026->capture_path, + ucontrol->value.integer.value[0]); +} + +static int ma1026_mute_path_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct ma1026_priv* ma1026 = snd_soc_component_get_drvdata(component); + + MA_DBG("ma1026 %s : force_muted %ld\n", __func__,ma1026->force_muted); + + ucontrol->value.integer.value[0] = ma1026->force_muted; + return 0; +} + +static int ma1026_muted_path_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct ma1026_priv* ma1026 = snd_soc_component_get_drvdata(component); + + + if(!ucontrol->value.integer.value[0]){ + ma1026->force_muted = 0; + snd_soc_update_ma1026(component,MA1026_HPDC,1<<1,0<<1); + snd_soc_update_ma1026(component,MA1026_HPDC,1<<0,0<<0); + }else { + ma1026->force_muted = 1; + snd_soc_update_ma1026(component,MA1026_HPDC,1<<1,1<<1); + snd_soc_update_ma1026(component,MA1026_HPDC,1<<0,1<<0); + } + + return 0; +} + + + + + +//--这边逻辑取反 +static const DECLARE_TLV_DB_SCALE(attn_tlv, -6300, 100, 1); + + +static const struct snd_kcontrol_new ma1026_snd_controls[] = { + // SOC_DOUBLE_R_SX_TLV("HP Analog Playback Volume", + // ma1026_HPAAVOL, ma1026_HPBAVOL, 0, + // 0x4c, 0x06, hpa_tlv), + // SOC_DOUBLE_R_SX_TLV("HP Digital Playback Volume", + // ma1026_HPADVOL, ma1026_HPBDVOL,0x00, + // 0x00,0x34,hpd_tlv), + + SOC_DOUBLE_R_S_TLV("HP_A_PlaybackVolume", //HP Analog Playback Volume + MA1026_HPAAVOL, MA1026_HPBAVOL,1, + -27,3,5,0,hpa_tlv), //范围从0~30 0:27 + + + SOC_DOUBLE_R_S_TLV("HP_D_PlaybackVolume", //HP Digital Playback Volume + MA1026_HPADVOL, MA1026_HPBDVOL,0x00, + -204,24,7,0,hpd_tlv), // 范围从0~228 0:204 真正读出来的值需要做 v= v & 0x010000;不然读出来的数值有误的 + + + SOC_DOUBLE_R("HP Analog Playback Mute", MA1026_HPAAVOL, + MA1026_HPBAVOL, 7, 1, 1), + + // SOC_DOUBLE_R_SX_TLV("Input PGA Analog Volume", + // MA1026_MICPGAAVOL,MA1026_MICPGABVOL, 5, + // 0x00,0x30, micpga_tlv), + SOC_DOUBLE_R_TLV("Input PGA Analog Volume", + MA1026_MICPGAAVOL, MA1026_MICPGABVOL, 0, + 0x18, 0, micpga_tlv), //范围从0~24 0:0 + + // SOC_DOUBLE_R_SX_TLV("Input Path Digital Volume", + // MA1026_IPADVOL,MA1026_IPBDVOL, 0, + // 0xA0, 0x0C, ipdig_tlv), + + SOC_DOUBLE_R_S_TLV("Input Path Digital Volume", + MA1026_IPADVOL, MA1026_IPBDVOL,0x00, + -96,12,7,0,ipdig_tlv), //范围从0~108 0:96 + + + SOC_DOUBLE_R("MIC Preamp Switch", MA1026_MICPGAAVOL, + MA1026_MICPGABVOL, 6, 1, 1), + + SOC_SINGLE_TLV("ADC A 20db", + MA1026_ADCIPC, 2, + 0x01, 1, adc_20db_tlv), + + SOC_SINGLE_TLV("ADC B 20db", + MA1026_ADCIPC, 6, + 0x01, 1, adc_20db_tlv), + + SOC_DOUBLE("Input Path Digital Mute", MA1026_ADCIPC, 0, 4, 1, 1), + SOC_DOUBLE("HP Digital Playback left Mute", MA1026_HPDC, 0, 1, 1, 1), + SOC_SINGLE("PGA Soft Ramp Switch", MA1026_MIOPC, 3, 1, 0), + SOC_SINGLE("Analog 0 Cross Switch", MA1026_MIOPC, 2, 1, 0), + SOC_SINGLE("Digital Soft Ramp Switch", MA1026_MIOPC, 1, 1, 0), + SOC_SINGLE("Analog Output Soft Ramp Switch", MA1026_MIOPC, 0, 1, 0), + + SOC_DOUBLE("ADC Signal Polarity Switch", MA1026_ADCIPC, 1, 5, 1, 0), + + SOC_SINGLE("HP Limiter Attack Rate", MA1026_LIMATTRATEHP, 0, 0x3F, 0), + SOC_SINGLE("HP Limiter Release Rate", MA1026_LIMRLSRATEHP, 0, 0x3F, 0), + SOC_SINGLE("HP Limiter Switch", MA1026_LIMRLSRATEHP, 7, 1, 0), + SOC_SINGLE("HP Limiter All Channels Switch", MA1026_LIMRLSRATEHP, 6, 1, 0), + + + + SOC_SINGLE_TLV("HP Limiter Max Threshold Vol", MA1026_LMAXMINHP, 5, 7, 1, limiter_tlv), + SOC_SINGLE_TLV("HP Limiter Min Threshold Vol", MA1026_LMAXMINHP, 2, 7, 1, limiter_tlv), + + + SOC_SINGLE("ALC Attack Rate Volume", MA1026_ALCARATE, 0, 0x3F, 0), + SOC_SINGLE("ALC Release Rate Volume", MA1026_ALCRRATE, 0, 0x3F, 0), + SOC_DOUBLE("ALC Switch", MA1026_ALCARATE, 6, 7, 1, 0), + + + SOC_SINGLE_TLV("ALC Max Threshold Volume", MA1026_ALCMINMAX, 5, 7, 0, limiter_tlv), + SOC_SINGLE_TLV("ALC Min Threshold Volume", MA1026_ALCMINMAX, 2, 7, 0, limiter_tlv), + + + + SOC_DOUBLE("NG Enable Switch", MA1026_NGCAB, 6, 7, 1, 0), + SOC_SINGLE("NG Boost Switch", MA1026_NGCAB, 5, 1, 0), + SOC_SINGLE("NG Threshold", MA1026_NGCAB, 2, 7, 0), + SOC_SINGLE("HP Amp CTRL", MA1026_PWRCTRL3, 0, 1,0), + + + + SOC_ENUM("NG Delay", ng_delay_enum), + + SOC_DOUBLE_R_TLV("IP2ASP Volume", MA1026_IPA2ASPA, MA1026_IPB2ASPB, 0, 0x3F, 1, attn_tlv), + SOC_DOUBLE_R_TLV("ASP2ASP Volume", MA1026_ASPA2ASPA, MA1026_ASPB2ASPB, 0, 0x3F, 1, attn_tlv), + SOC_DOUBLE_R_TLV("IP2HP Volume", MA1026_IPA2HPA, MA1026_IPB2HPB, 0, 0x3F, 1, attn_tlv), + SOC_DOUBLE_R_TLV("ASP2HP Volume", MA1026_ASPA2HPA, MA1026_ASPB2HPB, 0, 0x3F, 1, attn_tlv), + + + SOC_ENUM("IP Digital Swap/Mono Select", ip_swap_enum), + + SOC_ENUM_EXT("Playback Opt", ma1026_playback_path_type, + ma1026_playback_path_get, ma1026_playback_path_put), + + SOC_ENUM_EXT("Capture MIC Opt", ma1026_capture_path_type, + ma1026_capture_path_get, ma1026_capture_path_put), + + SOC_ENUM_EXT("Mute", ma1026_mute_type, + ma1026_mute_path_get, ma1026_muted_path_put), +}; + + + + + + +static int ma1026_init_regs( +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 00, 0)) + struct snd_soc_codec *codec +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(4, 00, 0)) + struct snd_soc_component *codec +#endif + ) +{ + MA_DBG("ma1026" " init all regs...\n"); + +#if 0 + snd_soc_write_ma1026(codec, 0x00, 0x68); + snd_soc_write_ma1026(codec, ma1026_PWRCTRL1, 0x00); + // snd_soc_write_ma1026(codec, ma1026_PWRCTRL1, 0x08);//打开LDO电源 + snd_soc_update_ma1026(codec,ma1026_PWRCTRL1,ma1026_PDN_LDO,1<<3); + snd_soc_update_ma1026(codec,ma1026_PWRCTRL1,ma1026_PDN,0); + + snd_soc_update_ma1026(codec,ma1026_DMMCC,ma1026_FREQ_DIV,2<<1); //设置主频分频比值 + snd_soc_update_ma1026(codec,ma1026_DMMCC,ma1026_MCLKDIS,0); + + + snd_soc_update_ma1026(codec,ma1026_PWRCTRL2,ma1026_PDN_ASP_SDO,0); //打开I2S 输入输出 + snd_soc_update_ma1026(codec,ma1026_PWRCTRL2,ma1026_PDN_ASP_SDI,0); //打开I2S 输入输出 + + +#endif +#if 1 + snd_soc_write_ma1026(codec, 0x00, 0x68); + snd_soc_write_ma1026(codec, 0x0A, 0x88); + snd_soc_write_ma1026(codec, 0x01, 0x00); + snd_soc_write_ma1026(codec, 0x01, 0x08); + snd_soc_write_ma1026(codec, 0x05, 0x65); + snd_soc_write_ma1026(codec, 0x02, 0x1F); + snd_soc_write_ma1026(codec, 0x06, 0x04); + snd_soc_write_ma1026(codec, 0x02, 0x13); + // snd_soc_write_ma1026(codec, 0x39, 0x14); + snd_soc_write_ma1026(codec, 0x12, 0x02); + snd_soc_write_ma1026(codec, 0x13, 0x02); + + snd_soc_write_ma1026(codec, 0x21, 0x00); + snd_soc_write_ma1026(codec, 0x22, 0x00); + snd_soc_write_ma1026(codec, 0x23, 0x00); + snd_soc_write_ma1026(codec, 0x24, 0x00); + snd_soc_write_ma1026(codec, 0x03, 0x1c); +#endif + ////////////////////////// + //snd_soc_write_ma1026(codec, 0x1F, 0x00); + //snd_soc_write_ma1026(codec, 0x20, 0x00); + snd_soc_write_ma1026(codec, 0x2c, 0xc1); + // snd_soc_write_ma1026(codec, 0x20, 0x3F); + // 关闭mic输出到headset + // //////////////////////////////// + // snd_soc_write_ma1026(codec, 0x21, 0x00); + // snd_soc_write_ma1026(codec, 0x22, 0x00); + // snd_soc_write_ma1026(codec, 0x23, 0x00); + // snd_soc_write_ma1026(codec, 0x24, 0x00); + return 0; +} + +static int ma1026_probe( +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 00, 0)) + struct snd_soc_codec *codec +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(4, 00, 0)) + struct snd_soc_component *codec +#endif + ) +{ + int ret = 0; +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 00, 0)) + struct ma1026_priv*ma1026 = snd_soc_codec_get_drvdata(codec); +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(4, 00, 0)) + struct ma1026_priv*ma1026 = snd_soc_component_get_drvdata(codec); +#endif + ma1026_codec = codec; + + MA_DBG("ma1026" " alsa start ....\n"); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 00, 0)) + codec->control_data = ma1026->regmap; +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(4, 00, 0)) + snd_soc_component_init_regmap(codec, ma1026->regmap); +#endif + +// ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP); +// if (ret < 0) { +// dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); +// return ret; +// } + + ma1026_set_bias_level(codec, SND_SOC_BIAS_ON); + + /* initialize codec */ + //MA_DBG("ma1026" " ma1026_PWRCTRL1 0x%x \n",snd_soc_read(codec, ma1026_PWRCTRL1)); + //MA_DBG("ma1026" " ma1026_PWRCTRL2 0x%x \n",snd_soc_read(codec, ma1026_PWRCTRL2)); + + ma1026_init_regs(codec); + //MA_DBG("ma1026" " ma1026_PWRCTRL3 0x%x \n",snd_soc_read(codec, 0x06)); + /* select EXT CLK as mclk */ + //ma1026->mclksel = ma1026_CLKID; + ma1026->mclk = devm_clk_get(codec->dev, "mclk"); + if (PTR_ERR(ma1026->mclk) == -EPROBE_DEFER) + return -EPROBE_DEFER; + + + //shiguangyuan delete clk + //MA_DBG("ma1026" "alsa get the mclk=%ld\n",clk_get_rate(ma1026->mclk)); + //ret = clk_prepare_enable(ma1026->mclk); + MA_DBG("ma1026" "alsa driver finish.... \n"); + return ret; +} + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 00, 0)) +static int ma1026_remove( + struct snd_soc_codec *codec +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(4, 00, 0)) +static void ma1026_remove( + struct snd_soc_component *codec +#endif + ) +{ + ma1026_set_bias_level(codec, SND_SOC_BIAS_OFF); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 00, 0)) + return 0; +#endif +} + + +static int ma1026_suspend( +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 00, 0)) + struct snd_soc_codec *codec +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(4, 00, 0)) + struct snd_soc_component *codec +#endif + ) +{ + MA_DBG("ma1026" " suspend ...\n"); + ma1026_set_bias_level(codec, SND_SOC_BIAS_OFF); + + return 0; +} + +static int ma1026_resume( +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 00, 0)) + struct snd_soc_codec *codec +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(4, 00, 0)) + struct snd_soc_component *codec +#endif + ) +{ + MA_DBG("ma1026" " resume ...\n"); + ma1026_set_bias_level(codec, SND_SOC_BIAS_STANDBY); + return 0; +} + + +static const struct snd_soc_dapm_widget dit_widgets[] = { + SND_SOC_DAPM_OUTPUT("HPOUTA"), + SND_SOC_DAPM_OUTPUT("HPOUTB"), + + SND_SOC_DAPM_INPUT("LINEIN1"), + SND_SOC_DAPM_INPUT("LINEIN2"), + SND_SOC_DAPM_INPUT("MIC1"), + SND_SOC_DAPM_INPUT("MIC2"), + + SND_SOC_DAPM_DAC("HP Amp", NULL,MA1026_PWRCTRL3, 0, 0), + + SND_SOC_DAPM_MIXER_NAMED_CTL("Input Left Capture", SND_SOC_NOPM, + 0, 0, input_left_mixer, ARRAY_SIZE(input_left_mixer)), + SND_SOC_DAPM_MIXER_NAMED_CTL("Input Right Capture", SND_SOC_NOPM, + 0, 0, input_right_mixer, ARRAY_SIZE(input_right_mixer)), + + SND_SOC_DAPM_ADC("DMIC Left", NULL, MA1026_PWRCTRL1, 6, 0), + SND_SOC_DAPM_ADC("DMIC Right", NULL, MA1026_PWRCTRL1, 4, 0), + +}; + +//-- +static const struct snd_soc_dapm_route dit_routes[] = { + + {"HPOUTA", NULL, "ASP Playback"}, + {"HPOUTA", NULL, "ASP Playback"}, + + + +}; + + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 00, 0)) +static struct snd_soc_codec_driver soc_codec_dev_ma1026 = { +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(4, 00, 0)) +static struct snd_soc_component_driver soc_codec_dev_ma1026 = { +#endif + .probe = ma1026_probe, + .remove = ma1026_remove, + .suspend = ma1026_suspend, + .resume = ma1026_resume, + .set_bias_level = ma1026_set_bias_level, + // .dapm_widgets = ma1026_dapm_widgets, + // .num_dapm_widgets = ARRAY_SIZE(ma1026_dapm_widgets), + // .dapm_routes = ma1026_audio_map, + // .num_dapm_routes = ARRAY_SIZE(ma1026_audio_map), + + .dapm_widgets = dit_widgets, + .num_dapm_widgets = ARRAY_SIZE(dit_widgets), + .dapm_routes = dit_routes, + .num_dapm_routes = ARRAY_SIZE(dit_routes), + + + .controls = ma1026_snd_controls, + .num_controls = ARRAY_SIZE(ma1026_snd_controls), + + +}; + + +static int ma1026_pcm_startup(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + bool playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); + if (playback) { + msleep(50); + } else { + + } + return 0; +} + + +static int ma1026_pcm_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, + struct snd_soc_dai *dai) +{ +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 00, 0)) + struct snd_soc_codec *codec = dai->codec; + struct ma1026_priv *priv = snd_soc_codec_get_drvdata(codec); +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(4, 00, 0)) + struct snd_soc_component *codec = dai->component; + struct ma1026_priv *priv = snd_soc_component_get_drvdata(codec); +#endif + int lrckfreq = params_rate(params); + int i, index = -1; + if (priv->config.mmcc & MA1026_MS_MASTER) { + + for (i = 0; i < ARRAY_SIZE(ma1026_mclk_coeffs); i++) { + if (//ma1026_mclk_coeffs[i].mclk == priv->mclk && + ma1026_mclk_coeffs[i].lrckfreq == lrckfreq) + index = i; + } + + if (index < 0){ + MA_DBG("ma1026" " ma1026_pcm_hw_params, mclk = %d\n", index); + return -EINVAL; + } + + dev_dbg(codec->dev, + "DAI[ ]: lrckfreq %u, MMCC[5:0] = %x\n", + lrckfreq,ma1026_mclk_coeffs[index].mmcc); + + + priv->config.mmcc &= 0xC0; + priv->config.mmcc |= ma1026_mclk_coeffs[index].mmcc; + priv->config.spc &= 0xFC; + /* Use SCLK=64*Fs */ + //if (priv->mclk >= 6400000) + // priv->config.spc |= ma1026_MCK_SCLK_64FS; + //else + // priv->config.spc |= ma1026_MCK_SCLK_MCLK; + } else { + priv->config.spc &= 0xFC; + priv->config.spc |= MA1026_MCK_SCLK_64FS; + } + + priv->config.lrckfreq = lrckfreq; + + //snd_soc_write(codec, ma1026_ASPC, priv->config.spc); + snd_soc_write_ma1026(codec, MA1026_ASPMMCC, priv->config.mmcc); + + return 0; +} +static int ma1026_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) +{ + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 00, 0)) + struct snd_soc_codec *codec = codec_dai->codec; + struct ma1026_priv*priv = snd_soc_codec_get_drvdata(codec); +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(4, 00, 0)) + struct snd_soc_component *codec = codec_dai->component; + struct ma1026_priv *priv = snd_soc_component_get_drvdata(codec); +#endif + + u8 spc, mmcc; + + spc = snd_soc_read_ma1026(codec, MA1026_ASPC); + mmcc = snd_soc_read_ma1026(codec, MA1026_ASPMMCC); + + if (fmt == SND_SOC_DAIFMT_CBM_CFM) { + mmcc |= MA1026_MS_MASTER; + } else { + mmcc &= ~MA1026_MS_MASTER; + } + + if (fmt == SND_SOC_DAIFMT_I2S) { + spc &= ~MA1026_SPDIF_PCM; + } else { + spc |= MA1026_SPDIF_PCM; + } + +// inv = (fmt & SND_SOC_DAIFMT_INV_MASK); + + if (spc & MA1026_SPDIF_PCM) { + spc &= ~MA1026_PCM_BIT_ORDER; +// switch (format) { +// case SND_SOC_DAIFMT_DSP_B: +// if (inv == SND_SOC_DAIFMT_IB_IF) +// spc |= ma1026_PCM_MODE0; +// if (inv == SND_SOC_DAIFMT_IB_NF) +// spc |= ma1026_PCM_MODE1; +// break; +// case SND_SOC_DAIFMT_DSP_A: +// if (inv == SND_SOC_DAIFMT_IB_IF) +// spc |= ma1026_PCM_MODE1; +// break; +// default: +// return -EINVAL; +// } + } + + priv->config.spc = spc; + priv->config.mmcc = mmcc; + + return 0; +} + +static int ma1026_set_dai_sysclk(struct snd_soc_dai *codec_dai, + int clk_id, unsigned int freq, int dir) +{ +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 00, 0)) + struct snd_soc_codec *codec = codec_dai->codec; + struct ma1026_priv *ma1026 = snd_soc_codec_get_drvdata(codec); +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(4, 00, 0)) + struct snd_soc_component *codec = codec_dai->component; + struct ma1026_priv *ma1026 = snd_soc_component_get_drvdata(codec); +#endif + MA_DBG("ma1026" " ma1026_set_dai_sysclk, freq = %d\n", freq); + + switch (freq) { + case 11289600: + case 18432000: + case 22579200: + case 36864000: + ma1026->sysclk_constraints = &constraints_112896; + ma1026->sysclk = freq; + return 0; + case 12288000: + case 19200000: + case 16934400: + case 24576000: + case 33868800: + ma1026->sysclk_constraints = &constraints_12288; + ma1026->sysclk = freq; + return 0; + case 12000000: + ma1026->sysclk_constraints = &constraints_12; + ma1026->sysclk = freq; + return 0; + } + return -EINVAL; + // return 0; + +} +static int ma1026_mute(struct snd_soc_dai *dai, int mute +#if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 00, 0)) + ,int stream +#endif +) +{ + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 00, 0)) + struct snd_soc_codec *codec = dai->codec; + struct ma1026_priv *ma1026 = snd_soc_codec_get_drvdata(codec); +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(4, 00, 0)) + struct snd_soc_component *codec = dai->component; + struct ma1026_priv *ma1026 = snd_soc_component_get_drvdata(codec); +#endif + + MA_DBG("ma1026" " ma1026_mute, mute = %d\n", mute); + //ma1026->muted = mute; + if(ma1026->force_muted) + return 0; + if(mute){ + // cancel_delayed_work(&spk_delay_work); + //off + // ma1026_enable_spk(ma1026, false); + // msleep(100); + + snd_soc_update_ma1026(codec,MA1026_HPDC,1<<1,1<<1); + snd_soc_update_ma1026(codec,MA1026_HPDC,1<<0,1<<0); + + }else {//if (dai->playback_active) + + snd_soc_update_ma1026(codec,MA1026_HPDC,1<<1,0<<1); + snd_soc_update_ma1026(codec,MA1026_HPDC,1<<0,0<<0); + + //on + // queue_delayed_work(spk_monitor_wq, &spk_delay_work,msecs_to_jiffies(150)); + } + return 0; +} +#if 0 //CONFIG_PM +static void ma1026_pcm_shutdown(struct snd_pcm_substream *substream,struct snd_soc_dai *dai) +{ + MA_DBG("ma1026" " ma1026_pcm_shutdown\n"); + //struct snd_soc_codec *codec = dai->codec; + //struct cl4016_priv *cl4016 = snd_soc_codec_get_drvdata(codec); + return; +} +#else +#define ma1026_pcm_shutdown NULL +#endif +static struct snd_soc_dai_ops ma1026_ops = { + .startup = ma1026_pcm_startup, + .hw_params = ma1026_pcm_hw_params, + .set_fmt = ma1026_set_dai_fmt, + .set_sysclk = ma1026_set_dai_sysclk, +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 00, 0)) + .digital_mute = ma1026_mute, +#else + .mute_stream = ma1026_mute, +#endif + + // .shutdown = ma1026_pcm_shutdown, + +}; + +static struct snd_soc_dai_driver ma1026_dai = { + .name = "ma1026-asp", + .playback = { + .stream_name = "ASP Playback", + .channels_min = 1, + .channels_max = 2, + .rates = ma1026_LRCK, + .formats = ma1026_FORMATS, + }, + .capture = { + .stream_name = "ASP Capture", + .channels_min = 1, + .channels_max = 2, + .rates = ma1026_LRCK, + .formats = ma1026_FORMATS, + }, + .ops = &ma1026_ops, + .symmetric_rates = 1, +}; + + +static int ma1026_i2c_probe(struct i2c_client *i2c_client, + const struct i2c_device_id *id) +{ + struct ma1026_priv*ma1026; + int ret; + + MA_DBG("ma1026" " run driver .... \n"); + + ma1026 = devm_kzalloc(&i2c_client->dev, sizeof(struct ma1026_priv), + GFP_KERNEL); + if (!ma1026) { + MA_DBG("ma1026 " "could not allocate codec\n"); + return -ENOMEM; + } + memset(ma1026,0x00,sizeof(struct ma1026_priv)); + ma1026->regmap = devm_regmap_init_i2c(i2c_client, &ma1026_regmap); + if (IS_ERR(ma1026->regmap)) { + ret = PTR_ERR(ma1026->regmap); + MA_DBG("ma1026 ""regmap_init() failed: %d\n", ret); + return ret; + } + + i2c_set_clientdata(i2c_client, ma1026); + + + globe_ma1026 = ma1026; + + ma1026->hp_mute = 1; + + // regcache_cache_bypass(ma1026->regmap, true); + // MA_DBG("ma1026" " Cubic Lattice ma1026 0x3F"); + // regcache_cache_bypass(ma1026->regmap, false); + + + // ma1026->gpiod_spk_ctl = devm_gpiod_get_optional(&i2c_client->dev,"spk-con",GPIOD_OUT_LOW); + // if (IS_ERR(ma1026->gpiod_spk_ctl)) { + // ret = IS_ERR(ma1026->gpiod_spk_ctl); + // ma1026->gpiod_spk_ctl = NULL; + // dev_warn(&i2c_client->dev, "cannot get spk-con-gpio %d\n", ret); + // } + // else{ + // gpiod_export(ma1026->gpiod_spk_ctl,0); + // } +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)) + ret = snd_soc_register_codec(&i2c_client->dev, + &soc_codec_dev_ma1026, &ma1026_dai, 1); +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(4, 19, 0)) + ret = devm_snd_soc_register_component(&i2c_client->dev, &soc_codec_dev_ma1026, + &ma1026_dai, 1); + +#endif + if (ret < 0) { + MA_DBG("ma1026 ""%s() register codec error %d\n", + __func__, ret); + return ret; + } + // spk_monitor_wq = alloc_ordered_workqueue("%s",WQ_MEM_RECLAIM | WQ_FREEZABLE, "spk-monitor-wq"); + // INIT_DELAYED_WORK(&spk_delay_work, spk_delay_work_handle); + + MA_DBG("ma1026" " load end ret=%d\n",ret); + + return 0; +} +static int ma1026_i2c_remove(struct i2c_client *client) +{ + + snd_soc_unregister_component(&client->dev); + return 0; +} +static void ma1026_i2c_shutdown(struct i2c_client *client) +{ + // struct ma1026_priv *ma1026 = i2c_get_clientdata(client); + + if (ma1026_codec != NULL) { + // ma1026_enable_spk(ma1026, false); + msleep(20); + ma1026_set_bias_level(ma1026_codec, SND_SOC_BIAS_OFF); + } +} + + +static const struct of_device_id ma1026_of_match[] = { + { .compatible = "Phytium,ma1026", }, + { } +}; +MODULE_DEVICE_TABLE(of, ma1026_of_match); + +static const struct i2c_device_id ma1026_id[] = { + {"ma1026", 0}, + {} +}; +MODULE_DEVICE_TABLE(i2c, ma1026_id); + +static struct i2c_driver ma1026_i2c_driver = { + .driver = { + .name = "ma1026", + .of_match_table = ma1026_of_match, + }, + .probe = ma1026_i2c_probe, + .remove = ma1026_i2c_remove, + .shutdown = ma1026_i2c_shutdown, + .id_table = ma1026_id, +}; +module_i2c_driver(ma1026_i2c_driver); + +MODULE_DESCRIPTION("ASoC ma1026 driver"); +MODULE_AUTHOR("CB Ltd"); +MODULE_LICENSE("GPL"); diff --git a/sound/soc/codecs/ma1026.h b/sound/soc/codecs/ma1026.h new file mode 100644 index 00000000000..05aeb15fb3d --- /dev/null +++ b/sound/soc/codecs/ma1026.h @@ -0,0 +1,127 @@ +#ifndef __MA1026_H__ +#define __MA1026_H__ + +/* I2C Registers */ +#define MA1026_PWRCTRL1 0x01 /* Power Ctrl 1. */ +#define MA1026_PWRCTRL2 0x02 /* Power Ctrl 2. */ +#define MA1026_PWRCTRL3 0x03 /* Power Ctrl 3. */ +#define MA1026_CPFCHC 0x04 /* Charge Pump Freq. Class H Ctrl. */ +#define MA1026_MICBSVDDA 0x05 /* MIC Bias & VDDA Voltage*/ +#define MA1026_DMMCC 0x06 /* Digital MIC & Master Clock Ctrl. */ +#define MA1026_ASPC 0x07 /* Audio Serial Port (ASP) Control. */ +#define MA1026_ASPMMCC 0x08 /* ASP Master Mode Control. */ +#define MA1026_MIOPC 0x09 /* Input & Output Path Control. */ +#define MA1026_ADCIPC 0x0A /* ADC/IP Control. */ +#define MA1026_MICPGAAVOL 0x0B /* MIC 1 PreAmp, PGAA Vol. */ +#define MA1026_MICPGABVOL 0x0C /* MIC 2 PreAmp, PGAB Vol. */ +#define MA1026_IPADVOL 0x0D /* Input Path A Digital Volume. */ +#define MA1026_IPBDVOL 0x0E /* Input Path B Digital Volume. */ +#define MA1026_HPDC 0x0F /* HP Digital Control. */ +#define MA1026_HPADVOL 0x10 /* HP A Digital Vol. */ +#define MA1026_HPBDVOL 0x11 /* HP B Digital Vol. */ +#define MA1026_HPAAVOL 0x12 /* HP A Analog Volume. */ +#define MA1026_HPBAVOL 0x13 /* HP B Analog Volume. */ +#define MA1026_ANAINVOL 0x14 /* Analog Input Path Advisory Vol. */ +#define MA1026_ASPINVOL 0x15 /* ASP Input Path Advisory Vol. */ +#define MA1026_LIMATTRATEHP 0x16 /* Limit Attack Rate HP. */ +#define MA1026_LIMRLSRATEHP 0x17 /* Limit Release Rate HP. */ +#define MA1026_LMAXMINHP 0x18 /* Limit Thresholds HP. */ +#define MA1026_ALCARATE 0x19 /* ALC Enable, Attack Rate AB. */ +#define MA1026_ALCRRATE 0x1A /* ALC Release Rate AB. */ +#define MA1026_ALCMINMAX 0x1B /* ALC Thresholds AB. */ +#define MA1026_NGCAB 0x1C /* Noise Gate Ctrl AB. */ +#define MA1026_ALCNG 0x1D /* ALC & Noise Gate Ctrl. */ +#define MA1026_MIXERCTL 0x1E /* Mixer Control. */ +#define MA1026_IPA2HPA 0x1F /* HP Left Mixer */ +#define MA1026_IPB2HPB 0x20 /* HP Right Mixer */ +#define MA1026_ASPA2HPA 0x21 /* HP Left Mixer */ +#define MA1026_ASPB2HPB 0x22 /* HP Right Mixer */ +#define MA1026_IPA2ASPA 0x23 /* ASP Left Mixer */ +#define MA1026_IPB2ASPB 0x24 /* ASP Right Mixer */ +#define MA1026_ASPA2ASPA 0x25 /* ASP Left Mixer */ +#define MA1026_ASPB2ASPB 0x26 /* ASP Right Mixer */ +#define MA1026_IM 0x5E /* Interrupt Mask */ +#define MA1026_IS 0x60 /* Interrupt Status */ +#define MA1026_MAX_REGISTER 0xff /* Total Registers */ +/* Bitfield Definitions */ + +/* MA1026_PWRCTRL1 */ +#define MA1026_PDN_ADCB (1 << 7) +#define MA1026_PDN_DMICB (1 << 6) +#define MA1026_PDN_ADCA (1 << 5) +#define MA1026_PDN_DMICA (1 << 4) +#define MA1026_PDN_LDO (1 << 3) +#define MA1026_PDN (1 << 0) + +/* MA1026_PWRCTRL2 */ +#define MA1026_PDN_MICBS2 (1 << 7) +#define MA1026_PDN_MICBS1 (1 << 6) +#define MA1026_PDN_ASP_SDO (1 << 3) +#define MA1026_PDN_ASP_SDI (1 << 2) + +/* MA1026_PWRCTRL3 */ +#define MA1026_PDN_HP (1 << 0) + +#define MA1026_CP_MASK (0xF0) + +/* MA1026_ASPC */ +#define MA1026_SP_3ST (1 << 7) +#define MA1026_SPDIF_PCM (1 << 6) +#define MA1026_PCM_BIT_ORDER (1 << 3) +#define MA1026_MCK_SCLK_64FS (0 << 0) +#define MA1026_MCK_SCLK_MCLK (2 << 0) +#define MA1026_MCK_SCLK_PREMCLK (3 << 0) + +/* MA1026_ASPMMCC */ +#define MA1026_MS_MASTER (1 << 7) + + +/* MA1026_DMMCC */ +#define MA1026_MCLKDIS (1 << 0) +#define MA1026_FREQ_DIV (2 << 1) +/* IS1, IM1 */ +#define MA1026_MIC_SDET (1 << 6) + +/* Analog Softramp */ +#define MA1026_ANLGOSFT (1 << 0) + +/* MA1026 MCLK 0 from EXT CLK; 1 from PLL OUTPUT*/ +#define MA1026_CLKID 0 + +/*MA1026_MICBSVDDA */ +#define MA1026_MICBSVDDA_HPA (1<<5) +#define MA1026_MICBSVDDA_HPB (1<<6) + +/*MA1026_ADCIPC */ +#define MA1026_ADCIPC_MICB_LINEB (1<<7) +#define MA1026_ADCIPC_MICA_LINEA (1<<3) + +enum output +{ + OPEN_SPK_E, + CLOSE_SPK, + + OPEN_HP_A, + CLOSE_HP_A, + + OPEN_HP_B, + CLOSE_HP_B, + + OPEN_HP, + CLOSE_HP, +} ; +enum input +{ + OPEN_DIGITAL_MIC, + CLOSE_DIGITAL_MIC, + + SELECT_MIC_A, + SELECT_LINE_A, + + SELECT_MIC_B, + SELECT_LINE_B, + +}; + + +#endif /* __MA1026_H__ */ diff --git a/sound/soc/phytium/Kconfig b/sound/soc/phytium/Kconfig index bce2cd9d94a..ac26a5f6242 100755 --- a/sound/soc/phytium/Kconfig +++ b/sound/soc/phytium/Kconfig @@ -28,3 +28,11 @@ config SND_PMDK_DP help Say Y if you want to add Phytium machine support for Displayport on Px210. + +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 + SN6040 codecs. diff --git a/sound/soc/phytium/Makefile b/sound/soc/phytium/Makefile index db3c0659e84..066ffc3116a 100644 --- a/sound/soc/phytium/Makefile +++ b/sound/soc/phytium/Makefile @@ -11,3 +11,6 @@ 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 diff --git a/sound/soc/phytium/pmdk_ma1026.c b/sound/soc/phytium/pmdk_ma1026.c new file mode 100644 index 00000000000..36b9eeec836 --- /dev/null +++ b/sound/soc/phytium/pmdk_ma1026.c @@ -0,0 +1,103 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2021-2024 Phytium Technology Co., Ltd. + */ + +#include +#include +#include +#include +#include + +#define PMDK_ma1026_VERSION "1.0.0" + +/* PMDK widgets */ +static const struct snd_soc_dapm_widget pmdk_ma1026_dapm_widgets[] = { + SND_SOC_DAPM_HP("HP", NULL), + SND_SOC_DAPM_MIC("Int Mic", NULL), + SND_SOC_DAPM_MIC("Mic In", NULL), +}; + +/* PMDK control */ +static const struct snd_kcontrol_new pmdk_ma1026_controls[] = { + SOC_DAPM_PIN_SWITCH("HP"), + SOC_DAPM_PIN_SWITCH("Int Mic"), + SOC_DAPM_PIN_SWITCH("Mic In"), +}; + +/* PMDK connections */ +static const struct snd_soc_dapm_route pmdk_ma1026_audio_map[] = { + {"DMIC", NULL, "Int Mic"}, + {"MIC1", NULL, "Mic In"}, + {"MIC2", NULL, "Mic In"}, + + {"HP", NULL, "HPOL"}, + {"HP", NULL, "HPOR"}, +}; + +#define PMDK_DAI_FMT (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | \ + SND_SOC_DAIFMT_CBS_CFS) + +static struct snd_soc_dai_link pmdk_dai[] = { + { + .name = "ma1026 HIFI", + .stream_name = "ma1026 HIFI", + .cpu_dai_name = "phytium-i2s-lsd", + .codec_dai_name = "ma1026-hifi", + .platform_name = "snd-soc-dummy", + .codec_name = "i2c-ma1026:00", + .dai_fmt = PMDK_DAI_FMT, + }, +}; + +static struct snd_soc_card pmdk = { + .name = "PMDK-I2S", + .owner = THIS_MODULE, + .dai_link = pmdk_dai, + .num_links = ARRAY_SIZE(pmdk_dai), + + .dapm_widgets = pmdk_ma1026_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(pmdk_ma1026_dapm_widgets), + .controls = pmdk_ma1026_controls, + .num_controls = ARRAY_SIZE(pmdk_ma1026_controls), + .dapm_routes = pmdk_ma1026_audio_map, + .num_dapm_routes = ARRAY_SIZE(pmdk_ma1026_audio_map), +}; + +static int pmdk_sound_probe(struct platform_device *pdev) +{ + struct snd_soc_card *card = &pmdk; + struct device *dev = &pdev->dev; + card->dev = dev; + return devm_snd_soc_register_card(&pdev->dev, card); +} + +static const struct acpi_device_id pmdk_sound_acpi_match[] = { + { "PHYT8013", 0}, + { } +}; +MODULE_DEVICE_TABLE(acpi, pmdk_sound_acpi_match); + +static const struct of_device_id phytium_ma1026_of_match[] = { + { .compatible = "phytium,audio-ma1026", }, + {}, +}; + +static struct platform_driver pmdk_sound_driver = { + .probe = pmdk_sound_probe, + .driver = { + .name = "pmdk_ma1026", + .acpi_match_table = pmdk_sound_acpi_match, + .of_match_table = phytium_ma1026_of_match, +#ifdef CONFIG_PM + .pm = &snd_soc_pm_ops, +#endif + }, +}; + +module_platform_driver(pmdk_sound_driver); + +MODULE_AUTHOR("Zhang Yiqun "); +MODULE_DESCRIPTION("ALSA SoC PMDK ma1026"); +MODULE_LICENSE("GPL"); +MODULE_VERSION(PMDK_ma1026_VERSION); -- Gitee From ceda722cb3b9ba9094e631149e80d4b8d8580168 Mon Sep 17 00:00:00 2001 From: NexyHo <68454650@qq.com> Date: Sun, 22 Dec 2024 18:44:49 -0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=8C=89=E7=85=A7=E9=A3=9E=E8=85=BE?= =?UTF-8?q?=E8=A6=81=E6=B1=82=E4=BF=AE=E6=94=B9=E4=BA=86=E9=83=A8=E5=88=86?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sound/soc/codecs/Kconfig | 2 +- sound/soc/phytium/Kconfig | 3 +-- sound/soc/phytium/pmdk_ma1026.c | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 03b6027d84a..42f2bff4f1d 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -916,7 +916,7 @@ config SND_SOC_SIRF_AUDIO_CODEC select REGMAP_MMIO config SND_SOC_MA1026 - tristate "Phytium MA1026 CODEC" + tristate "Cubiclattice MA1026 CODEC" config SND_SOC_SPDIF tristate "S/PDIF CODEC" diff --git a/sound/soc/phytium/Kconfig b/sound/soc/phytium/Kconfig index ac26a5f6242..191020f15b6 100755 --- a/sound/soc/phytium/Kconfig +++ b/sound/soc/phytium/Kconfig @@ -34,5 +34,4 @@ config SND_PMDK_MA1026 depends on I2C && SND_SOC_PHYTIUM_I2S select SND_SOC_MA1026 help - Say Y if you want to add Phytium machine support for - SN6040 codecs. + Say Y if you want to add Phytium machine support for MA1026 diff --git a/sound/soc/phytium/pmdk_ma1026.c b/sound/soc/phytium/pmdk_ma1026.c index 36b9eeec836..6cbb73fb4dc 100644 --- a/sound/soc/phytium/pmdk_ma1026.c +++ b/sound/soc/phytium/pmdk_ma1026.c @@ -97,7 +97,7 @@ static struct platform_driver pmdk_sound_driver = { module_platform_driver(pmdk_sound_driver); -MODULE_AUTHOR("Zhang Yiqun "); +MODULE_AUTHOR("harry guo "); MODULE_DESCRIPTION("ALSA SoC PMDK ma1026"); MODULE_LICENSE("GPL"); MODULE_VERSION(PMDK_ma1026_VERSION); -- Gitee