Alsa-devel
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
June 2017
- 105 participants
- 297 discussions
Hi,
this is a kind of gleaning work, a collection of small cleanups of
ALSA PCM implementations.
Takashi
===
Takashi Iwai (6):
ALSA: pcm: Clean up SNDRV_PCM_IOCTL_PAUSE code
ALSA: pcm: Apply power lock globally to common ioctls
ALSA: pcm: Allow dropping stream directly after resume
ALSA: pcm: Preprocess PAUSED or SUSPENDED stream before PREPARE
ALSA: pcm: Use common PCM_RUNTIME_CHECK() for sanity checks
ALSA: pcm: Skip ack callback without actual appl_ptr update
sound/core/pcm_lib.c | 3 ++
sound/core/pcm_native.c | 84 +++++++++++++++++++++----------------------------
2 files changed, 39 insertions(+), 48 deletions(-)
--
2.13.1
2
8
Re: [alsa-devel] broonie-sound/for-next build: 207 builds: 13 failed, 194 passed, 38 errors, 9 warnings (v4.12-rc5-151-g2eb01858cc80)
by Mark Brown 14 Jun '17
by Mark Brown 14 Jun '17
14 Jun '17
On Tue, Jun 13, 2017 at 03:51:41PM -0700, kernelci.org bot wrote:
Morimoto-san, it looks like your simple-card changes break the build -
it's late so I'm not going to fix right now but it looks like you're
missing some EXPORT_SYMBOL_GPLs.
> Full Build Summary: https://kernelci.org/build/broonie-sound/branch/for-next/kernel/v4.12-rc5-1…
>
> Tree: broonie-sound
> Branch: for-next
> Git Describe: v4.12-rc5-151-g2eb01858cc80
> Git Commit: 2eb01858cc80d3b9a29f1a8d355eeaef5830ce3c
> Git URL: http://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
> Built: 4 unique architectures
>
> Build Failures Detected:
>
> arm64: gcc version 5.3.1 20160412 (Linaro GCC 5.3-2016.05)
>
> allmodconfig: FAIL
>
> arm: gcc version 5.3.1 20160412 (Linaro GCC 5.3-2016.05)
>
> davinci_all_defconfig: FAIL
> multi_v7_defconfig: FAIL
> multi_v7_defconfig+CONFIG_ARM_LPAE=y: FAIL
> multi_v7_defconfig+CONFIG_CPU_BIG_ENDIAN=y: FAIL
> multi_v7_defconfig+CONFIG_EFI=y: FAIL
> multi_v7_defconfig+CONFIG_EFI=y+CONFIG_ARM_LPAE=y: FAIL
> multi_v7_defconfig+CONFIG_LKDTM=y: FAIL
> multi_v7_defconfig+CONFIG_PROVE_LOCKING=y: FAIL
> multi_v7_defconfig+CONFIG_SMP=n: FAIL
> multi_v7_defconfig+CONFIG_THUMB2_KERNEL=y+CONFIG_ARM_MODULE_PLTS=y: FAIL
> omap2plus_defconfig: FAIL
>
> x86: gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
>
> allmodconfig: FAIL
>
> Errors and Warnings Detected:
>
> arm64: gcc version 5.3.1 20160412 (Linaro GCC 5.3-2016.05)
>
> allmodconfig: 8 errors
> defconfig+CONFIG_KASAN=y: 4 warnings
>
> arm: gcc version 5.3.1 20160412 (Linaro GCC 5.3-2016.05)
>
> davinci_all_defconfig: 2 errors
> multi_v7_defconfig: 2 errors
> multi_v7_defconfig+CONFIG_ARM_LPAE=y: 2 errors
> multi_v7_defconfig+CONFIG_CPU_BIG_ENDIAN=y: 2 errors
> multi_v7_defconfig+CONFIG_EFI=y: 2 errors
> multi_v7_defconfig+CONFIG_EFI=y+CONFIG_ARM_LPAE=y: 2 errors
> multi_v7_defconfig+CONFIG_LKDTM=y: 2 errors
> multi_v7_defconfig+CONFIG_PROVE_LOCKING=y: 2 errors
> multi_v7_defconfig+CONFIG_SMP=n: 2 errors
> multi_v7_defconfig+CONFIG_THUMB2_KERNEL=y+CONFIG_ARM_MODULE_PLTS=y: 2 errors
> omap2plus_defconfig: 2 errors
>
> x86: gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
>
> allmodconfig: 8 errors
> defconfig+CONFIG_KASAN=y: 5 warnings
>
> Errors summary:
>
> 13 ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
> 13 ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
> 2 ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-simple-scu-card.ko] undefined!
> 2 ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-audio-graph-scu-card.ko] undefined!
> 2 ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-audio-graph-card.ko] undefined!
> 2 ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-simple-scu-card.ko] undefined!
> 2 ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-audio-graph-scu-card.ko] undefined!
> 2 ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-audio-graph-card.ko] undefined!
>
> Warnings summary:
>
> 1 net/wireless/nl80211.c:5779:1: warning: the frame size of 2064 bytes is larger than 2048 bytes [-Wframe-larger-than=]
> 1 net/wireless/nl80211.c:4476:1: warning: the frame size of 2240 bytes is larger than 2048 bytes [-Wframe-larger-than=]
> 1 net/wireless/nl80211.c:4476:1: warning: the frame size of 2224 bytes is larger than 2048 bytes [-Wframe-larger-than=]
> 1 net/wireless/nl80211.c:1905:1: warning: the frame size of 3904 bytes is larger than 2048 bytes [-Wframe-larger-than=]
> 1 net/wireless/nl80211.c:1905:1: warning: the frame size of 3848 bytes is larger than 2048 bytes [-Wframe-larger-than=]
> 1 net/wireless/nl80211.c:1411:1: warning: the frame size of 2216 bytes is larger than 2048 bytes [-Wframe-larger-than=]
> 1 net/wireless/nl80211.c:1411:1: warning: the frame size of 2208 bytes is larger than 2048 bytes [-Wframe-larger-than=]
> 1 net/bridge/br_netlink.c:1356:1: warning: the frame size of 2544 bytes is larger than 2048 bytes [-Wframe-larger-than=]
> 1 drivers/tty/vt/keyboard.c:1471:1: warning: the frame size of 2344 bytes is larger than 2048 bytes [-Wframe-larger-than=]
>
> ================================================================================
>
> Detailed per-defconfig build reports:
>
> --------------------------------------------------------------------------------
> acs5k_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> acs5k_tiny_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> allmodconfig (x86) — FAIL, 8 errors, 0 warnings, 0 section mismatches
>
> Errors:
> ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-simple-scu-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-simple-scu-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-audio-graph-scu-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-audio-graph-scu-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-audio-graph-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-audio-graph-card.ko] undefined!
>
> --------------------------------------------------------------------------------
> allmodconfig (arm64) — FAIL, 8 errors, 0 warnings, 0 section mismatches
>
> Errors:
> ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-simple-scu-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-simple-scu-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-audio-graph-scu-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-audio-graph-scu-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-audio-graph-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-audio-graph-card.ko] undefined!
>
> --------------------------------------------------------------------------------
> allmodconfig+CONFIG_OF=n (x86) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> allnoconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> allnoconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> allnoconfig (arm64) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> allnoconfig (x86) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> am200epdkit_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> ar7_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> aspeed_g4_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> aspeed_g5_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> assabet_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> at91_dt_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> ath25_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> ath79_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> axm55xx_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> badge4_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> bcm2835_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> bcm47xx_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> bcm63xx_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> bigsur_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> bmips_be_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> bmips_stb_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> capcella_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> cavium_octeon_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> cerfcube_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> ci20_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> clps711x_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> cm_x2xx_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> cm_x300_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> cns3420vb_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> cobalt_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> colibri_pxa270_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> colibri_pxa300_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> collie_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> corgi_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> davinci_all_defconfig (arm) — FAIL, 2 errors, 0 warnings, 0 section mismatches
>
> Errors:
> ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
>
> --------------------------------------------------------------------------------
> db1xxx_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> decstation_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> defconfig (arm64) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> defconfig+CONFIG_CPU_BIG_ENDIAN=y (arm64) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> defconfig+CONFIG_EXPERT=y+CONFIG_ACPI=y (arm64) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> defconfig+CONFIG_KASAN=y (x86) — PASS, 0 errors, 5 warnings, 0 section mismatches
>
> Warnings:
> net/wireless/nl80211.c:1411:1: warning: the frame size of 2216 bytes is larger than 2048 bytes [-Wframe-larger-than=]
> net/wireless/nl80211.c:4476:1: warning: the frame size of 2224 bytes is larger than 2048 bytes [-Wframe-larger-than=]
> net/wireless/nl80211.c:5779:1: warning: the frame size of 2064 bytes is larger than 2048 bytes [-Wframe-larger-than=]
> net/wireless/nl80211.c:1905:1: warning: the frame size of 3848 bytes is larger than 2048 bytes [-Wframe-larger-than=]
> drivers/tty/vt/keyboard.c:1471:1: warning: the frame size of 2344 bytes is larger than 2048 bytes [-Wframe-larger-than=]
>
> --------------------------------------------------------------------------------
> defconfig+CONFIG_KASAN=y (arm64) — PASS, 0 errors, 4 warnings, 0 section mismatches
>
> Warnings:
> net/bridge/br_netlink.c:1356:1: warning: the frame size of 2544 bytes is larger than 2048 bytes [-Wframe-larger-than=]
> net/wireless/nl80211.c:1411:1: warning: the frame size of 2208 bytes is larger than 2048 bytes [-Wframe-larger-than=]
> net/wireless/nl80211.c:1905:1: warning: the frame size of 3904 bytes is larger than 2048 bytes [-Wframe-larger-than=]
> net/wireless/nl80211.c:4476:1: warning: the frame size of 2240 bytes is larger than 2048 bytes [-Wframe-larger-than=]
>
> --------------------------------------------------------------------------------
> defconfig+CONFIG_LKDTM=y (x86) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> defconfig+CONFIG_LKDTM=y (arm64) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> defconfig+CONFIG_LKDTM=y (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> defconfig+CONFIG_OF_UNITTEST=y (x86) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> defconfig+CONFIG_OF_UNITTEST=y (arm64) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> defconfig+CONFIG_RANDOMIZE_BASE=y (arm64) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> dove_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> e55_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> ebsa110_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> efm32_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> em_x270_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> ep93xx_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> eseries_pxa_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> exynos_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> ezx_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> footbridge_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> fuloong2e_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> gemini_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> generic_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> gpr_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> h3600_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> h5000_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> hackkit_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> hisi_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> i386_defconfig (x86) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> imote2_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> imx_v4_v5_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> imx_v6_v7_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> integrator_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> iop13xx_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> iop32x_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> iop33x_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> ip22_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> ip27_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> ip28_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> ip32_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> ixp4xx_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> jazz_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> jmr3927_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> jornada720_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> keystone_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> ks8695_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> lart_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> lasat_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> lemote2f_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> loongson1b_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> loongson1c_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> loongson3_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> lpc18xx_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> lpc32xx_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> lpd270_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> lubbock_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> magician_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> mainstone_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> malta_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> malta_kvm_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> malta_kvm_guest_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> malta_qemu_32r6_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> maltaaprp_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> maltasmvp_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> maltasmvp_eva_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> maltaup_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> maltaup_xpa_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> markeins_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> mini2440_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> mips_paravirt_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> mmp2_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> moxart_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> mpc30x_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> mps2_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> msp71xx_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> mtx1_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> multi_v4t_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> multi_v5_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> multi_v7_defconfig (arm) — FAIL, 2 errors, 0 warnings, 0 section mismatches
>
> Errors:
> ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
>
> --------------------------------------------------------------------------------
> multi_v7_defconfig+CONFIG_ARM_LPAE=y (arm) — FAIL, 2 errors, 0 warnings, 0 section mismatches
>
> Errors:
> ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
>
> --------------------------------------------------------------------------------
> multi_v7_defconfig+CONFIG_CPU_BIG_ENDIAN=y (arm) — FAIL, 2 errors, 0 warnings, 0 section mismatches
>
> Errors:
> ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
>
> --------------------------------------------------------------------------------
> multi_v7_defconfig+CONFIG_EFI=y (arm) — FAIL, 2 errors, 0 warnings, 0 section mismatches
>
> Errors:
> ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
>
> --------------------------------------------------------------------------------
> multi_v7_defconfig+CONFIG_EFI=y+CONFIG_ARM_LPAE=y (arm) — FAIL, 2 errors, 0 warnings, 0 section mismatches
>
> Errors:
> ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
>
> --------------------------------------------------------------------------------
> multi_v7_defconfig+CONFIG_LKDTM=y (arm) — FAIL, 2 errors, 0 warnings, 0 section mismatches
>
> Errors:
> ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
>
> --------------------------------------------------------------------------------
> multi_v7_defconfig+CONFIG_PROVE_LOCKING=y (arm) — FAIL, 2 errors, 0 warnings, 0 section mismatches
>
> Errors:
> ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
>
> --------------------------------------------------------------------------------
> multi_v7_defconfig+CONFIG_SMP=n (arm) — FAIL, 2 errors, 0 warnings, 0 section mismatches
>
> Errors:
> ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
>
> --------------------------------------------------------------------------------
> multi_v7_defconfig+CONFIG_THUMB2_KERNEL=y+CONFIG_ARM_MODULE_PLTS=y (arm) — FAIL, 2 errors, 0 warnings, 0 section mismatches
>
> Errors:
> ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
>
> --------------------------------------------------------------------------------
> mv78xx0_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> mvebu_v5_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> mvebu_v7_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> mvebu_v7_defconfig+CONFIG_CPU_BIG_ENDIAN=y (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> mxs_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> neponset_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> netwinder_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> netx_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> nhk8815_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> nlm_xlp_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> nlm_xlr_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> nuc910_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> nuc950_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> nuc960_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> omap1_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> omap2plus_defconfig (arm) — FAIL, 2 errors, 0 warnings, 0 section mismatches
>
> Errors:
> ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
> ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
>
> --------------------------------------------------------------------------------
> orion5x_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> palmz72_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> pcm027_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> pic32mzda_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> pistachio_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> pleb_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> pnx8335_stb225_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> prima2_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> pxa168_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> pxa255-idp_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> pxa3xx_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> pxa910_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> pxa_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> qcom_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> qi_lb60_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> raumfeld_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> rb532_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> rbtx49xx_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> realview_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> rm200_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> rpc_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> rt305x_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> s3c2410_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> s3c6400_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> s5pv210_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> sama5_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> sb1250_swarm_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> shannon_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> shmobile_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> simpad_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> socfpga_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> spear13xx_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> spear3xx_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> spear6xx_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> spitz_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> stm32_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> sunxi_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> tango4_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> tb0219_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> tb0226_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> tb0287_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> tct_hammer_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> tegra_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> tinyconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> tinyconfig (x86) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> tinyconfig (arm64) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> tinyconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> trizeps4_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> u300_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> u8500_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> versatile_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> versatile_defconfig+CONFIG_OF_UNITTEST=y (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> vexpress_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> viper_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> vt8500_v6_v7_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> workpad_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> x86_64_defconfig (x86) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> xcep_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> xilfpga_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> xway_defconfig (mips) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> zeus_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> --------------------------------------------------------------------------------
> zx_defconfig (arm) — PASS, 0 errors, 0 warnings, 0 section mismatches
>
> ---
> For more info write to <info(a)kernelci.org>
2
1
Re: [alsa-devel] Applied "ASoC: rsnd: don't call free_irq() on Parent SSI" to the asoc tree
by Kuninori Morimoto 14 Jun '17
by Kuninori Morimoto 14 Jun '17
14 Jun '17
Hi Mark
> > This patch was accepted on your topic branch now
> > 1f8754d4daea5f257370a52a30fcb22798c54516
> > ("ASoC: rsnd: don't call free_irq() on Parent SSI")
> >
> > I'm sorry, but, this is needed to fix branch for v4.12-rcX too.
> > How to handle it ? can you cherry-pick it to mark/fix/rcar or can I
> > post it ?
>
> I picked it over.
Thank you
Best regards
---
Kuninori Morimoto
1
0
Add a codec driver for the Everest ES8316, based on code provided by
David Yang from Everest Semi.
I limited the functionality to items where the vendor code was clear,
and things that can be tested on the Weibu F3C (Intel Cherry Trail).
As a result the initial implementation only supports running in slave
mode at single speed (up to 48kHz sample rate) using I2S. HPD is not
supported.
Signed-off-by: David Yang <yangxiaohua(a)everest-semi.com>
[drake(a)endlessm.com: significant cleanups and simplifications,
remove dead/unclear code]
Signed-off-by: Daniel Drake <drake(a)endlessm.com>
---
Notes:
v4:
- use newer macros for dB scale tlv
- fix ADC PGA gain and HP Mixer gain according to datasheet
- add missing register write in probe
v3:
- move to boolean controls where appropriate
- name controls with Volume suffix where appropriate
- clean up probe routine
- control more registers with DAPM, replacing set_bias_level
- improve DAPM widget naming consistency
- fix i2c device id
v2:
- Add sign-off from David Yang
- Only support whole number rates calculated with mclk ratios
sound/soc/codecs/Kconfig | 4 +
sound/soc/codecs/Makefile | 2 +
sound/soc/codecs/es8316.c | 637 ++++++++++++++++++++++++++++++++++++++++++++++
sound/soc/codecs/es8316.h | 129 ++++++++++
4 files changed, 772 insertions(+)
create mode 100644 sound/soc/codecs/es8316.c
create mode 100644 sound/soc/codecs/es8316.h
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 883ed4c8a551..c6286e5ba511 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -72,6 +72,7 @@ config SND_SOC_ALL_CODECS
select SND_SOC_DA9055 if I2C
select SND_SOC_DIO2125
select SND_SOC_DMIC
+ select SND_SOC_ES8316 if I2C
select SND_SOC_ES8328_SPI if SPI_MASTER
select SND_SOC_ES8328_I2C if I2C
select SND_SOC_ES7134
@@ -543,6 +544,9 @@ config SND_SOC_HDMI_CODEC
config SND_SOC_ES7134
tristate "Everest Semi ES7134 CODEC"
+config SND_SOC_ES8316
+ tristate "Everest Semi ES8316 CODEC"
+
config SND_SOC_ES8328
tristate
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 28a63fdaf982..e878306ce46e 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -65,6 +65,7 @@ snd-soc-da732x-objs := da732x.o
snd-soc-da9055-objs := da9055.o
snd-soc-dmic-objs := dmic.o
snd-soc-es7134-objs := es7134.o
+snd-soc-es8316-objs := es8316.o
snd-soc-es8328-objs := es8328.o
snd-soc-es8328-i2c-objs := es8328-i2c.o
snd-soc-es8328-spi-objs := es8328-spi.o
@@ -300,6 +301,7 @@ obj-$(CONFIG_SND_SOC_DA732X) += snd-soc-da732x.o
obj-$(CONFIG_SND_SOC_DA9055) += snd-soc-da9055.o
obj-$(CONFIG_SND_SOC_DMIC) += snd-soc-dmic.o
obj-$(CONFIG_SND_SOC_ES7134) += snd-soc-es7134.o
+obj-$(CONFIG_SND_SOC_ES8316) += snd-soc-es8316.o
obj-$(CONFIG_SND_SOC_ES8328) += snd-soc-es8328.o
obj-$(CONFIG_SND_SOC_ES8328_I2C)+= snd-soc-es8328-i2c.o
obj-$(CONFIG_SND_SOC_ES8328_SPI)+= snd-soc-es8328-spi.o
diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c
new file mode 100644
index 000000000000..ecc02449c569
--- /dev/null
+++ b/sound/soc/codecs/es8316.c
@@ -0,0 +1,637 @@
+/*
+ * es8316.c -- es8316 ALSA SoC audio driver
+ * Copyright Everest Semiconductor Co.,Ltd
+ *
+ * Authors: David Yang <yangxiaohua(a)everest-semi.com>,
+ * Daniel Drake <drake(a)endlessm.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/acpi.h>
+#include <linux/delay.h>
+#include <linux/i2c.h>
+#include <linux/mod_devicetable.h>
+#include <linux/regmap.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/soc.h>
+#include <sound/soc-dapm.h>
+#include <sound/tlv.h>
+#include "es8316.h"
+
+/* In slave mode at single speed, the codec is documented as accepting 5
+ * MCLK/LRCK ratios, but we also add ratio 400, which is commonly used on
+ * Intel Cherry Trail platforms (19.2MHz MCLK, 48kHz LRCK).
+ */
+#define NR_SUPPORTED_MCLK_LRCK_RATIOS 6
+static const unsigned int supported_mclk_lrck_ratios[] = {
+ 256, 384, 400, 512, 768, 1024
+};
+
+struct es8316_priv {
+ unsigned int sysclk;
+ unsigned int allowed_rates[NR_SUPPORTED_MCLK_LRCK_RATIOS];
+ struct snd_pcm_hw_constraint_list sysclk_constraints;
+};
+
+/*
+ * ES8316 controls
+ */
+static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(dac_vol_tlv, -9600, 50, 1);
+static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(adc_vol_tlv, -9600, 50, 1);
+static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(alc_max_gain_tlv, -650, 150, 0);
+static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(alc_min_gain_tlv, -1200, 150, 0);
+static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(alc_target_tlv, -1650, 150, 0);
+static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(hpmixer_gain_tlv, -1200, 150, 0);
+
+static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(adc_pga_gain_tlv,
+ 0, 0, TLV_DB_SCALE_ITEM(-350, 0, 0),
+ 1, 1, TLV_DB_SCALE_ITEM(0, 0, 0),
+ 2, 2, TLV_DB_SCALE_ITEM(250, 0, 0),
+ 3, 3, TLV_DB_SCALE_ITEM(450, 0, 0),
+ 4, 4, TLV_DB_SCALE_ITEM(700, 0, 0),
+ 5, 5, TLV_DB_SCALE_ITEM(1000, 0, 0),
+ 6, 6, TLV_DB_SCALE_ITEM(1300, 0, 0),
+ 7, 7, TLV_DB_SCALE_ITEM(1600, 0, 0),
+ 8, 8, TLV_DB_SCALE_ITEM(1800, 0, 0),
+ 9, 9, TLV_DB_SCALE_ITEM(2100, 0, 0),
+ 10, 10, TLV_DB_SCALE_ITEM(2400, 0, 0),
+);
+
+static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(hpout_vol_tlv,
+ 0, 0, TLV_DB_SCALE_ITEM(-4800, 0, 0),
+ 1, 3, TLV_DB_SCALE_ITEM(-2400, 1200, 0),
+);
+
+static const char * const ng_type_txt[] =
+ { "Constant PGA Gain", "Mute ADC Output" };
+static const struct soc_enum ng_type =
+ SOC_ENUM_SINGLE(ES8316_ADC_ALC_NG, 6, 2, ng_type_txt);
+
+static const char * const adcpol_txt[] = { "Normal", "Invert" };
+static const struct soc_enum adcpol =
+ SOC_ENUM_SINGLE(ES8316_ADC_MUTE, 1, 2, adcpol_txt);
+static const char *const dacpol_txt[] =
+ { "Normal", "R Invert", "L Invert", "L + R Invert" };
+static const struct soc_enum dacpol =
+ SOC_ENUM_SINGLE(ES8316_DAC_SET1, 0, 4, dacpol_txt);
+
+static const struct snd_kcontrol_new es8316_snd_controls[] = {
+ SOC_DOUBLE_TLV("Headphone Playback Volume", ES8316_CPHP_ICAL_VOL,
+ 4, 0, 3, 1, hpout_vol_tlv),
+ SOC_DOUBLE_TLV("Headphone Mixer Volume", ES8316_HPMIX_VOL,
+ 0, 4, 7, 0, hpmixer_gain_tlv),
+
+ SOC_ENUM("Playback Polarity", dacpol),
+ SOC_DOUBLE_R_TLV("DAC Playback Volume", ES8316_DAC_VOLL,
+ ES8316_DAC_VOLR, 0, 0xc0, 1, dac_vol_tlv),
+ SOC_SINGLE("DAC Soft Ramp Switch", ES8316_DAC_SET1, 4, 1, 1),
+ SOC_SINGLE("DAC Soft Ramp Rate", ES8316_DAC_SET1, 2, 4, 0),
+ SOC_SINGLE("DAC Notch Filter Switch", ES8316_DAC_SET2, 6, 1, 0),
+ SOC_SINGLE("DAC Double Fs Switch", ES8316_DAC_SET2, 7, 1, 0),
+ SOC_SINGLE("DAC Stereo Enhancement", ES8316_DAC_SET3, 0, 7, 0),
+
+ SOC_ENUM("Capture Polarity", adcpol),
+ SOC_SINGLE("Mic Boost Switch", ES8316_ADC_D2SEPGA, 0, 1, 0),
+ SOC_SINGLE_TLV("ADC Capture Volume", ES8316_ADC_VOLUME,
+ 0, 0xc0, 1, adc_vol_tlv),
+ SOC_SINGLE_TLV("ADC PGA Gain Volume", ES8316_ADC_PGAGAIN,
+ 4, 10, 0, adc_pga_gain_tlv),
+ SOC_SINGLE("ADC Soft Ramp Switch", ES8316_ADC_MUTE, 4, 1, 0),
+ SOC_SINGLE("ADC Double Fs Switch", ES8316_ADC_DMIC, 4, 1, 0),
+
+ SOC_SINGLE("ALC Capture Switch", ES8316_ADC_ALC1, 6, 1, 0),
+ SOC_SINGLE_TLV("ALC Capture Max Volume", ES8316_ADC_ALC1, 0, 28, 0,
+ alc_max_gain_tlv),
+ SOC_SINGLE_TLV("ALC Capture Min Volume", ES8316_ADC_ALC2, 0, 28, 0,
+ alc_min_gain_tlv),
+ SOC_SINGLE_TLV("ALC Capture Target Volume", ES8316_ADC_ALC3, 4, 10, 0,
+ alc_target_tlv),
+ SOC_SINGLE("ALC Capture Hold Time", ES8316_ADC_ALC3, 0, 10, 0),
+ SOC_SINGLE("ALC Capture Decay Time", ES8316_ADC_ALC4, 4, 10, 0),
+ SOC_SINGLE("ALC Capture Attack Time", ES8316_ADC_ALC4, 0, 10, 0),
+ SOC_SINGLE("ALC Capture Noise Gate Switch", ES8316_ADC_ALC_NG,
+ 5, 1, 0),
+ SOC_SINGLE("ALC Capture Noise Gate Threshold", ES8316_ADC_ALC_NG,
+ 0, 31, 0),
+ SOC_ENUM("ALC Capture Noise Gate Type", ng_type),
+};
+
+/* Analog Input Mux */
+static const char * const es8316_analog_in_txt[] = {
+ "lin1-rin1",
+ "lin2-rin2",
+ "lin1-rin1 with 20db Boost",
+ "lin2-rin2 with 20db Boost"
+};
+static const unsigned int es8316_analog_in_values[] = { 0, 1, 2, 3 };
+static const struct soc_enum es8316_analog_input_enum =
+ SOC_VALUE_ENUM_SINGLE(ES8316_ADC_PDN_LINSEL, 4, 3,
+ ARRAY_SIZE(es8316_analog_in_txt),
+ es8316_analog_in_txt,
+ es8316_analog_in_values);
+static const struct snd_kcontrol_new es8316_analog_in_mux_controls =
+ SOC_DAPM_ENUM("Route", es8316_analog_input_enum);
+
+static const char * const es8316_dmic_txt[] = {
+ "dmic disable",
+ "dmic data at high level",
+ "dmic data at low level",
+};
+static const unsigned int es8316_dmic_values[] = { 0, 1, 2 };
+static const struct soc_enum es8316_dmic_src_enum =
+ SOC_VALUE_ENUM_SINGLE(ES8316_ADC_DMIC, 0, 3,
+ ARRAY_SIZE(es8316_dmic_txt),
+ es8316_dmic_txt,
+ es8316_dmic_values);
+static const struct snd_kcontrol_new es8316_dmic_src_controls =
+ SOC_DAPM_ENUM("Route", es8316_dmic_src_enum);
+
+/* hp mixer mux */
+static const char * const es8316_hpmux_texts[] = {
+ "lin1-rin1",
+ "lin2-rin2",
+ "lin-rin with Boost",
+ "lin-rin with Boost and PGA"
+};
+
+static const unsigned int es8316_hpmux_values[] = { 0, 1, 2, 3 };
+
+static SOC_ENUM_SINGLE_DECL(es8316_left_hpmux_enum, ES8316_HPMIX_SEL,
+ 4, es8316_hpmux_texts);
+
+static const struct snd_kcontrol_new es8316_left_hpmux_controls =
+ SOC_DAPM_ENUM("Route", es8316_left_hpmux_enum);
+
+static SOC_ENUM_SINGLE_DECL(es8316_right_hpmux_enum, ES8316_HPMIX_SEL,
+ 0, es8316_hpmux_texts);
+
+static const struct snd_kcontrol_new es8316_right_hpmux_controls =
+ SOC_DAPM_ENUM("Route", es8316_right_hpmux_enum);
+
+/* headphone Output Mixer */
+static const struct snd_kcontrol_new es8316_out_left_mix[] = {
+ SOC_DAPM_SINGLE("LLIN Switch", ES8316_HPMIX_SWITCH, 6, 1, 0),
+ SOC_DAPM_SINGLE("Left DAC Switch", ES8316_HPMIX_SWITCH, 7, 1, 0),
+};
+static const struct snd_kcontrol_new es8316_out_right_mix[] = {
+ SOC_DAPM_SINGLE("RLIN Switch", ES8316_HPMIX_SWITCH, 2, 1, 0),
+ SOC_DAPM_SINGLE("Right DAC Switch", ES8316_HPMIX_SWITCH, 3, 1, 0),
+};
+
+/* DAC data source mux */
+static const char * const es8316_dacsrc_texts[] = {
+ "LDATA TO LDAC, RDATA TO RDAC",
+ "LDATA TO LDAC, LDATA TO RDAC",
+ "RDATA TO LDAC, RDATA TO RDAC",
+ "RDATA TO LDAC, LDATA TO RDAC",
+};
+
+static const unsigned int es8316_dacsrc_values[] = { 0, 1, 2, 3 };
+
+static SOC_ENUM_SINGLE_DECL(es8316_dacsrc_mux_enum, ES8316_DAC_SET1,
+ 6, es8316_dacsrc_texts);
+
+static const struct snd_kcontrol_new es8316_dacsrc_mux_controls =
+ SOC_DAPM_ENUM("Route", es8316_dacsrc_mux_enum);
+
+static const struct snd_soc_dapm_widget es8316_dapm_widgets[] = {
+ SND_SOC_DAPM_SUPPLY("Bias", ES8316_SYS_PDN, 3, 1, NULL, 0),
+ SND_SOC_DAPM_SUPPLY("Analog power", ES8316_SYS_PDN, 4, 1, NULL, 0),
+ SND_SOC_DAPM_SUPPLY("Mic Bias", ES8316_SYS_PDN, 5, 1, NULL, 0),
+
+ SND_SOC_DAPM_INPUT("DMIC"),
+ SND_SOC_DAPM_INPUT("MIC1"),
+ SND_SOC_DAPM_INPUT("MIC2"),
+
+ /* Input Mux */
+ SND_SOC_DAPM_MUX("Differential Mux", SND_SOC_NOPM, 0, 0,
+ &es8316_analog_in_mux_controls),
+
+ SND_SOC_DAPM_SUPPLY("ADC Vref", ES8316_SYS_PDN, 1, 1, NULL, 0),
+ SND_SOC_DAPM_SUPPLY("ADC bias", ES8316_SYS_PDN, 2, 1, NULL, 0),
+ SND_SOC_DAPM_SUPPLY("ADC Clock", ES8316_CLKMGR_CLKSW, 3, 0, NULL, 0),
+ SND_SOC_DAPM_PGA("Line input PGA", ES8316_ADC_PDN_LINSEL,
+ 7, 1, NULL, 0),
+ SND_SOC_DAPM_ADC("Mono ADC", NULL, ES8316_ADC_PDN_LINSEL, 6, 1),
+ SND_SOC_DAPM_MUX("Digital Mic Mux", SND_SOC_NOPM, 0, 0,
+ &es8316_dmic_src_controls),
+
+ /* Digital Interface */
+ SND_SOC_DAPM_AIF_OUT("I2S OUT", "I2S1 Capture", 1,
+ ES8316_SERDATA_ADC, 6, 1),
+ SND_SOC_DAPM_AIF_IN("I2S IN", "I2S1 Playback", 0,
+ SND_SOC_NOPM, 0, 0),
+
+ SND_SOC_DAPM_MUX("DAC Source Mux", SND_SOC_NOPM, 0, 0,
+ &es8316_dacsrc_mux_controls),
+
+ SND_SOC_DAPM_SUPPLY("DAC Vref", ES8316_SYS_PDN, 0, 1, NULL, 0),
+ SND_SOC_DAPM_SUPPLY("DAC Clock", ES8316_CLKMGR_CLKSW, 2, 0, NULL, 0),
+ SND_SOC_DAPM_DAC("Right DAC", NULL, ES8316_DAC_PDN, 0, 1),
+ SND_SOC_DAPM_DAC("Left DAC", NULL, ES8316_DAC_PDN, 4, 1),
+
+ /* Headphone Output Side */
+ SND_SOC_DAPM_MUX("Left Headphone Mux", SND_SOC_NOPM, 0, 0,
+ &es8316_left_hpmux_controls),
+ SND_SOC_DAPM_MUX("Right Headphone Mux", SND_SOC_NOPM, 0, 0,
+ &es8316_right_hpmux_controls),
+ SND_SOC_DAPM_MIXER("Left Headphone Mixer", ES8316_HPMIX_PDN,
+ 5, 1, &es8316_out_left_mix[0],
+ ARRAY_SIZE(es8316_out_left_mix)),
+ SND_SOC_DAPM_MIXER("Right Headphone Mixer", ES8316_HPMIX_PDN,
+ 1, 1, &es8316_out_right_mix[0],
+ ARRAY_SIZE(es8316_out_right_mix)),
+ SND_SOC_DAPM_PGA("Left Headphone Mixer Out", ES8316_HPMIX_PDN,
+ 4, 1, NULL, 0),
+ SND_SOC_DAPM_PGA("Right Headphone Mixer Out", ES8316_HPMIX_PDN,
+ 0, 1, NULL, 0),
+
+ SND_SOC_DAPM_OUT_DRV("Left Headphone Charge Pump", ES8316_CPHP_OUTEN,
+ 6, 0, NULL, 0),
+ SND_SOC_DAPM_OUT_DRV("Right Headphone Charge Pump", ES8316_CPHP_OUTEN,
+ 2, 0, NULL, 0),
+ SND_SOC_DAPM_SUPPLY("Headphone Charge Pump", ES8316_CPHP_PDN2,
+ 5, 1, NULL, 0),
+ SND_SOC_DAPM_SUPPLY("Headphone Charge Pump Clock", ES8316_CLKMGR_CLKSW,
+ 4, 0, NULL, 0),
+
+ SND_SOC_DAPM_OUT_DRV("Left Headphone Driver", ES8316_CPHP_OUTEN,
+ 5, 0, NULL, 0),
+ SND_SOC_DAPM_OUT_DRV("Right Headphone Driver", ES8316_CPHP_OUTEN,
+ 1, 0, NULL, 0),
+ SND_SOC_DAPM_SUPPLY("Headphone Out", ES8316_CPHP_PDN1, 2, 1, NULL, 0),
+
+ /* pdn_Lical and pdn_Rical bits are documented as Reserved, but must
+ * be explicitly unset in order to enable HP output
+ */
+ SND_SOC_DAPM_SUPPLY("Left Headphone ical", ES8316_CPHP_ICAL_VOL,
+ 7, 1, NULL, 0),
+ SND_SOC_DAPM_SUPPLY("Right Headphone ical", ES8316_CPHP_ICAL_VOL,
+ 3, 1, NULL, 0),
+
+ SND_SOC_DAPM_OUTPUT("HPOL"),
+ SND_SOC_DAPM_OUTPUT("HPOR"),
+};
+
+static const struct snd_soc_dapm_route es8316_dapm_routes[] = {
+ /* Recording */
+ {"MIC1", NULL, "Mic Bias"},
+ {"MIC2", NULL, "Mic Bias"},
+ {"MIC1", NULL, "Bias"},
+ {"MIC2", NULL, "Bias"},
+ {"MIC1", NULL, "Analog power"},
+ {"MIC2", NULL, "Analog power"},
+
+ {"Differential Mux", "lin1-rin1", "MIC1"},
+ {"Differential Mux", "lin2-rin2", "MIC2"},
+ {"Line input PGA", NULL, "Differential Mux"},
+
+ {"Mono ADC", NULL, "ADC Clock"},
+ {"Mono ADC", NULL, "ADC Vref"},
+ {"Mono ADC", NULL, "ADC bias"},
+ {"Mono ADC", NULL, "Line input PGA"},
+
+ /* It's not clear why, but to avoid recording only silence,
+ * the DAC clock must be running for the ADC to work.
+ */
+ {"Mono ADC", NULL, "DAC Clock"},
+
+ {"Digital Mic Mux", "dmic disable", "Mono ADC"},
+
+ {"I2S OUT", NULL, "Digital Mic Mux"},
+
+ /* Playback */
+ {"DAC Source Mux", "LDATA TO LDAC, RDATA TO RDAC", "I2S IN"},
+
+ {"Left DAC", NULL, "DAC Clock"},
+ {"Right DAC", NULL, "DAC Clock"},
+
+ {"Left DAC", NULL, "DAC Vref"},
+ {"Right DAC", NULL, "DAC Vref"},
+
+ {"Left DAC", NULL, "DAC Source Mux"},
+ {"Right DAC", NULL, "DAC Source Mux"},
+
+ {"Left Headphone Mux", "lin-rin with Boost and PGA", "Line input PGA"},
+ {"Right Headphone Mux", "lin-rin with Boost and PGA", "Line input PGA"},
+
+ {"Left Headphone Mixer", "LLIN Switch", "Left Headphone Mux"},
+ {"Left Headphone Mixer", "Left DAC Switch", "Left DAC"},
+
+ {"Right Headphone Mixer", "RLIN Switch", "Right Headphone Mux"},
+ {"Right Headphone Mixer", "Right DAC Switch", "Right DAC"},
+
+ {"Left Headphone Mixer Out", NULL, "Left Headphone Mixer"},
+ {"Right Headphone Mixer Out", NULL, "Right Headphone Mixer"},
+
+ {"Left Headphone Charge Pump", NULL, "Left Headphone Mixer Out"},
+ {"Right Headphone Charge Pump", NULL, "Right Headphone Mixer Out"},
+
+ {"Left Headphone Charge Pump", NULL, "Headphone Charge Pump"},
+ {"Right Headphone Charge Pump", NULL, "Headphone Charge Pump"},
+
+ {"Left Headphone Charge Pump", NULL, "Headphone Charge Pump Clock"},
+ {"Right Headphone Charge Pump", NULL, "Headphone Charge Pump Clock"},
+
+ {"Left Headphone Driver", NULL, "Left Headphone Charge Pump"},
+ {"Right Headphone Driver", NULL, "Right Headphone Charge Pump"},
+
+ {"HPOL", NULL, "Left Headphone Driver"},
+ {"HPOR", NULL, "Right Headphone Driver"},
+
+ {"HPOL", NULL, "Left Headphone ical"},
+ {"HPOR", NULL, "Right Headphone ical"},
+
+ {"Headphone Out", NULL, "Bias"},
+ {"Headphone Out", NULL, "Analog power"},
+ {"HPOL", NULL, "Headphone Out"},
+ {"HPOR", NULL, "Headphone Out"},
+};
+
+static int es8316_set_dai_sysclk(struct snd_soc_dai *codec_dai,
+ int clk_id, unsigned int freq, int dir)
+{
+ struct snd_soc_codec *codec = codec_dai->codec;
+ struct es8316_priv *es8316 = snd_soc_codec_get_drvdata(codec);
+ int i;
+ int count = 0;
+
+ es8316->sysclk = freq;
+
+ if (freq == 0)
+ return 0;
+
+ /* Limit supported sample rates to ones that can be autodetected
+ * by the codec running in slave mode.
+ */
+ for (i = 0; i < NR_SUPPORTED_MCLK_LRCK_RATIOS; i++) {
+ const unsigned int ratio = supported_mclk_lrck_ratios[i];
+
+ if (freq % ratio == 0)
+ es8316->allowed_rates[count++] = freq / ratio;
+ }
+
+ es8316->sysclk_constraints.list = es8316->allowed_rates;
+ es8316->sysclk_constraints.count = count;
+
+ return 0;
+}
+
+static int es8316_set_dai_fmt(struct snd_soc_dai *codec_dai,
+ unsigned int fmt)
+{
+ struct snd_soc_codec *codec = codec_dai->codec;
+ u8 serdata1 = 0;
+ u8 serdata2 = 0;
+ u8 clksw;
+ u8 mask;
+
+ if ((fmt & SND_SOC_DAIFMT_MASTER_MASK) != SND_SOC_DAIFMT_CBS_CFS) {
+ dev_err(codec->dev, "Codec driver only supports slave mode\n");
+ return -EINVAL;
+ }
+
+ if ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) != SND_SOC_DAIFMT_I2S) {
+ dev_err(codec->dev, "Codec driver only supports I2S format\n");
+ return -EINVAL;
+ }
+
+ /* Clock inversion */
+ switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
+ case SND_SOC_DAIFMT_NB_NF:
+ break;
+ case SND_SOC_DAIFMT_IB_IF:
+ serdata1 |= ES8316_SERDATA1_BCLK_INV;
+ serdata2 |= ES8316_SERDATA2_ADCLRP;
+ break;
+ case SND_SOC_DAIFMT_IB_NF:
+ serdata1 |= ES8316_SERDATA1_BCLK_INV;
+ break;
+ case SND_SOC_DAIFMT_NB_IF:
+ serdata2 |= ES8316_SERDATA2_ADCLRP;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ mask = ES8316_SERDATA1_MASTER | ES8316_SERDATA1_BCLK_INV;
+ snd_soc_update_bits(codec, ES8316_SERDATA1, mask, serdata1);
+
+ mask = ES8316_SERDATA2_FMT_MASK | ES8316_SERDATA2_ADCLRP;
+ snd_soc_update_bits(codec, ES8316_SERDATA_ADC, mask, serdata2);
+ snd_soc_update_bits(codec, ES8316_SERDATA_DAC, mask, serdata2);
+
+ /* Enable BCLK and MCLK inputs in slave mode */
+ clksw = ES8316_CLKMGR_CLKSW_MCLK_ON | ES8316_CLKMGR_CLKSW_BCLK_ON;
+ snd_soc_update_bits(codec, ES8316_CLKMGR_CLKSW, clksw, clksw);
+
+ return 0;
+}
+
+static int es8316_pcm_startup(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+ struct snd_soc_codec *codec = dai->codec;
+ struct es8316_priv *es8316 = snd_soc_codec_get_drvdata(codec);
+
+ if (es8316->sysclk == 0) {
+ dev_err(codec->dev, "No sysclk provided\n");
+ return -EINVAL;
+ }
+
+ /* The set of sample rates that can be supported depends on the
+ * MCLK supplied to the CODEC.
+ */
+ snd_pcm_hw_constraint_list(substream->runtime, 0,
+ SNDRV_PCM_HW_PARAM_RATE,
+ &es8316->sysclk_constraints);
+
+ return 0;
+}
+
+static int es8316_pcm_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params,
+ struct snd_soc_dai *dai)
+{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_codec *codec = rtd->codec;
+ struct es8316_priv *es8316 = snd_soc_codec_get_drvdata(codec);
+ u8 wordlen = 0;
+
+ if (!es8316->sysclk) {
+ dev_err(codec->dev, "No MCLK configured\n");
+ return -EINVAL;
+ }
+
+ switch (params_format(params)) {
+ case SNDRV_PCM_FORMAT_S16_LE:
+ wordlen = ES8316_SERDATA2_LEN_16;
+ break;
+ case SNDRV_PCM_FORMAT_S20_3LE:
+ wordlen = ES8316_SERDATA2_LEN_20;
+ break;
+ case SNDRV_PCM_FORMAT_S24_LE:
+ wordlen = ES8316_SERDATA2_LEN_24;
+ break;
+ case SNDRV_PCM_FORMAT_S32_LE:
+ wordlen = ES8316_SERDATA2_LEN_32;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ snd_soc_update_bits(codec, ES8316_SERDATA_DAC,
+ ES8316_SERDATA2_LEN_MASK, wordlen);
+ snd_soc_update_bits(codec, ES8316_SERDATA_ADC,
+ ES8316_SERDATA2_LEN_MASK, wordlen);
+ return 0;
+}
+
+static int es8316_mute(struct snd_soc_dai *dai, int mute)
+{
+ snd_soc_update_bits(dai->codec, ES8316_DAC_SET1, 0x20,
+ mute ? 0x20 : 0);
+ return 0;
+}
+
+#define ES8316_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
+ SNDRV_PCM_FMTBIT_S24_LE)
+
+static struct snd_soc_dai_ops es8316_ops = {
+ .startup = es8316_pcm_startup,
+ .hw_params = es8316_pcm_hw_params,
+ .set_fmt = es8316_set_dai_fmt,
+ .set_sysclk = es8316_set_dai_sysclk,
+ .digital_mute = es8316_mute,
+};
+
+static struct snd_soc_dai_driver es8316_dai = {
+ .name = "ES8316 HiFi",
+ .playback = {
+ .stream_name = "Playback",
+ .channels_min = 1,
+ .channels_max = 2,
+ .rates = SNDRV_PCM_RATE_8000_48000,
+ .formats = ES8316_FORMATS,
+ },
+ .capture = {
+ .stream_name = "Capture",
+ .channels_min = 1,
+ .channels_max = 2,
+ .rates = SNDRV_PCM_RATE_8000_48000,
+ .formats = ES8316_FORMATS,
+ },
+ .ops = &es8316_ops,
+ .symmetric_rates = 1,
+};
+
+static int es8316_probe(struct snd_soc_codec *codec)
+{
+ /* Reset codec and enable current state machine */
+ snd_soc_write(codec, ES8316_RESET, 0x3f);
+ usleep_range(5000, 5500);
+ snd_soc_write(codec, ES8316_RESET, ES8316_RESET_CSM_ON);
+ msleep(30);
+
+ /*
+ * Documentation is unclear, but this value from the vendor driver is
+ * needed otherwise audio output is silent.
+ */
+ snd_soc_write(codec, ES8316_SYS_VMIDSEL, 0xff);
+
+ /*
+ * Documentation for this register is unclear and incomplete,
+ * but here is a vendor-provided value that improves volume
+ * and quality for Intel CHT platforms.
+ */
+ snd_soc_write(codec, ES8316_CLKMGR_ADCOSR, 0x32);
+
+ return 0;
+}
+
+static struct snd_soc_codec_driver soc_codec_dev_es8316 = {
+ .probe = es8316_probe,
+ .idle_bias_off = true,
+
+ .component_driver = {
+ .controls = es8316_snd_controls,
+ .num_controls = ARRAY_SIZE(es8316_snd_controls),
+ .dapm_widgets = es8316_dapm_widgets,
+ .num_dapm_widgets = ARRAY_SIZE(es8316_dapm_widgets),
+ .dapm_routes = es8316_dapm_routes,
+ .num_dapm_routes = ARRAY_SIZE(es8316_dapm_routes),
+ },
+};
+
+static const struct regmap_config es8316_regmap = {
+ .reg_bits = 8,
+ .val_bits = 8,
+ .max_register = 0x53,
+ .cache_type = REGCACHE_RBTREE,
+};
+
+static int es8316_i2c_probe(struct i2c_client *i2c_client,
+ const struct i2c_device_id *id)
+{
+ struct es8316_priv *es8316;
+ struct regmap *regmap;
+
+ es8316 = devm_kzalloc(&i2c_client->dev, sizeof(struct es8316_priv),
+ GFP_KERNEL);
+ if (es8316 == NULL)
+ return -ENOMEM;
+
+ i2c_set_clientdata(i2c_client, es8316);
+
+ regmap = devm_regmap_init_i2c(i2c_client, &es8316_regmap);
+ if (IS_ERR(regmap))
+ return PTR_ERR(regmap);
+
+ return snd_soc_register_codec(&i2c_client->dev, &soc_codec_dev_es8316,
+ &es8316_dai, 1);
+}
+
+static int es8316_i2c_remove(struct i2c_client *client)
+{
+ snd_soc_unregister_codec(&client->dev);
+ return 0;
+}
+
+static const struct i2c_device_id es8316_i2c_id[] = {
+ {"es8316", 0 },
+ {}
+};
+MODULE_DEVICE_TABLE(i2c, es8316_i2c_id);
+
+static const struct of_device_id es8316_of_match[] = {
+ { .compatible = "everest,es8316", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, es8316_of_match);
+
+static const struct acpi_device_id es8316_acpi_match[] = {
+ {"ESSX8316", 0},
+ {},
+};
+MODULE_DEVICE_TABLE(acpi, es8316_acpi_match);
+
+static struct i2c_driver es8316_i2c_driver = {
+ .driver = {
+ .name = "es8316",
+ .acpi_match_table = ACPI_PTR(es8316_acpi_match),
+ .of_match_table = of_match_ptr(es8316_of_match),
+ },
+ .probe = es8316_i2c_probe,
+ .remove = es8316_i2c_remove,
+ .id_table = es8316_i2c_id,
+};
+module_i2c_driver(es8316_i2c_driver);
+
+MODULE_DESCRIPTION("Everest Semi ES8316 ALSA SoC Codec Driver");
+MODULE_AUTHOR("David Yang <yangxiaohua(a)everest-semi.com>");
+MODULE_LICENSE("GPL v2");
diff --git a/sound/soc/codecs/es8316.h b/sound/soc/codecs/es8316.h
new file mode 100644
index 000000000000..6bcdd63ea459
--- /dev/null
+++ b/sound/soc/codecs/es8316.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright Everest Semiconductor Co.,Ltd
+ *
+ * Author: David Yang <yangxiaohua(a)everest-semi.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#ifndef _ES8316_H
+#define _ES8316_H
+
+/*
+ * ES8316 register space
+ */
+
+/* Reset Control */
+#define ES8316_RESET 0x00
+
+/* Clock Management */
+#define ES8316_CLKMGR_CLKSW 0x01
+#define ES8316_CLKMGR_CLKSEL 0x02
+#define ES8316_CLKMGR_ADCOSR 0x03
+#define ES8316_CLKMGR_ADCDIV1 0x04
+#define ES8316_CLKMGR_ADCDIV2 0x05
+#define ES8316_CLKMGR_DACDIV1 0x06
+#define ES8316_CLKMGR_DACDIV2 0x07
+#define ES8316_CLKMGR_CPDIV 0x08
+
+/* Serial Data Port Control */
+#define ES8316_SERDATA1 0x09
+#define ES8316_SERDATA_ADC 0x0a
+#define ES8316_SERDATA_DAC 0x0b
+
+/* System Control */
+#define ES8316_SYS_VMIDSEL 0x0c
+#define ES8316_SYS_PDN 0x0d
+#define ES8316_SYS_LP1 0x0e
+#define ES8316_SYS_LP2 0x0f
+#define ES8316_SYS_VMIDLOW 0x10
+#define ES8316_SYS_VSEL 0x11
+#define ES8316_SYS_REF 0x12
+
+/* Headphone Mixer */
+#define ES8316_HPMIX_SEL 0x13
+#define ES8316_HPMIX_SWITCH 0x14
+#define ES8316_HPMIX_PDN 0x15
+#define ES8316_HPMIX_VOL 0x16
+
+/* Charge Pump Headphone driver */
+#define ES8316_CPHP_OUTEN 0x17
+#define ES8316_CPHP_ICAL_VOL 0x18
+#define ES8316_CPHP_PDN1 0x19
+#define ES8316_CPHP_PDN2 0x1a
+#define ES8316_CPHP_LDOCTL 0x1b
+
+/* Calibration */
+#define ES8316_CAL_TYPE 0x1c
+#define ES8316_CAL_SET 0x1d
+#define ES8316_CAL_HPLIV 0x1e
+#define ES8316_CAL_HPRIV 0x1f
+#define ES8316_CAL_HPLMV 0x20
+#define ES8316_CAL_HPRMV 0x21
+
+/* ADC Control */
+#define ES8316_ADC_PDN_LINSEL 0x22
+#define ES8316_ADC_PGAGAIN 0x23
+#define ES8316_ADC_D2SEPGA 0x24
+#define ES8316_ADC_DMIC 0x25
+#define ES8316_ADC_MUTE 0x26
+#define ES8316_ADC_VOLUME 0x27
+#define ES8316_ADC_ALC1 0x29
+#define ES8316_ADC_ALC2 0x2a
+#define ES8316_ADC_ALC3 0x2b
+#define ES8316_ADC_ALC4 0x2c
+#define ES8316_ADC_ALC5 0x2d
+#define ES8316_ADC_ALC_NG 0x2e
+
+/* DAC Control */
+#define ES8316_DAC_PDN 0x2f
+#define ES8316_DAC_SET1 0x30
+#define ES8316_DAC_SET2 0x31
+#define ES8316_DAC_SET3 0x32
+#define ES8316_DAC_VOLL 0x33
+#define ES8316_DAC_VOLR 0x34
+
+/* GPIO */
+#define ES8316_GPIO_SEL 0x4d
+#define ES8316_GPIO_DEBOUNCE 0x4e
+#define ES8316_GPIO_FLAG 0x4f
+
+/* Test mode */
+#define ES8316_TESTMODE 0x50
+#define ES8316_TEST1 0x51
+#define ES8316_TEST2 0x52
+#define ES8316_TEST3 0x53
+
+/*
+ * Field definitions
+ */
+
+/* ES8316_RESET */
+#define ES8316_RESET_CSM_ON 0x80
+
+/* ES8316_CLKMGR_CLKSW */
+#define ES8316_CLKMGR_CLKSW_MCLK_ON 0x40
+#define ES8316_CLKMGR_CLKSW_BCLK_ON 0x20
+
+/* ES8316_SERDATA1 */
+#define ES8316_SERDATA1_MASTER 0x80
+#define ES8316_SERDATA1_BCLK_INV 0x20
+
+/* ES8316_SERDATA_ADC and _DAC */
+#define ES8316_SERDATA2_FMT_MASK 0x3
+#define ES8316_SERDATA2_FMT_I2S 0x00
+#define ES8316_SERDATA2_FMT_LEFTJ 0x01
+#define ES8316_SERDATA2_FMT_RIGHTJ 0x02
+#define ES8316_SERDATA2_FMT_PCM 0x03
+#define ES8316_SERDATA2_ADCLRP 0x20
+#define ES8316_SERDATA2_LEN_MASK 0x1c
+#define ES8316_SERDATA2_LEN_24 0x00
+#define ES8316_SERDATA2_LEN_20 0x04
+#define ES8316_SERDATA2_LEN_18 0x08
+#define ES8316_SERDATA2_LEN_16 0x0c
+#define ES8316_SERDATA2_LEN_32 0x10
+
+#endif
--
2.11.0
2
2
Add a codec driver for the Everest ES8316, based on code provided by
David Yang from Everest Semi.
I limited the functionality to items where the vendor code was clear,
and things that can be tested on the Weibu F3C (Intel Cherry Trail).
As a result the initial implementation only supports running in slave
mode at single speed (up to 48kHz sample rate) using I2S. HPD is not
supported.
Signed-off-by: David Yang <yangxiaohua(a)everest-semi.com>
[drake(a)endlessm.com: significant cleanups and simplifications,
remove dead/unclear code]
Signed-off-by: Daniel Drake <drake(a)endlessm.com>
---
Notes:
v3:
- move to boolean controls where appropriate
- name controls with Volume suffix where appropriate
- clean up probe routine
- control more registers with DAPM, replacing set_bias_level
- improve DAPM widget naming consistency
- fix i2c device id
v2:
- Add sign-off from David Yang
- Only support whole number rates calculated with mclk ratios
sound/soc/codecs/Kconfig | 4 +
sound/soc/codecs/Makefile | 2 +
sound/soc/codecs/es8316.c | 629 ++++++++++++++++++++++++++++++++++++++++++++++
sound/soc/codecs/es8316.h | 129 ++++++++++
4 files changed, 764 insertions(+)
create mode 100644 sound/soc/codecs/es8316.c
create mode 100644 sound/soc/codecs/es8316.h
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 883ed4c8a551..c6286e5ba511 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -72,6 +72,7 @@ config SND_SOC_ALL_CODECS
select SND_SOC_DA9055 if I2C
select SND_SOC_DIO2125
select SND_SOC_DMIC
+ select SND_SOC_ES8316 if I2C
select SND_SOC_ES8328_SPI if SPI_MASTER
select SND_SOC_ES8328_I2C if I2C
select SND_SOC_ES7134
@@ -543,6 +544,9 @@ config SND_SOC_HDMI_CODEC
config SND_SOC_ES7134
tristate "Everest Semi ES7134 CODEC"
+config SND_SOC_ES8316
+ tristate "Everest Semi ES8316 CODEC"
+
config SND_SOC_ES8328
tristate
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 28a63fdaf982..e878306ce46e 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -65,6 +65,7 @@ snd-soc-da732x-objs := da732x.o
snd-soc-da9055-objs := da9055.o
snd-soc-dmic-objs := dmic.o
snd-soc-es7134-objs := es7134.o
+snd-soc-es8316-objs := es8316.o
snd-soc-es8328-objs := es8328.o
snd-soc-es8328-i2c-objs := es8328-i2c.o
snd-soc-es8328-spi-objs := es8328-spi.o
@@ -300,6 +301,7 @@ obj-$(CONFIG_SND_SOC_DA732X) += snd-soc-da732x.o
obj-$(CONFIG_SND_SOC_DA9055) += snd-soc-da9055.o
obj-$(CONFIG_SND_SOC_DMIC) += snd-soc-dmic.o
obj-$(CONFIG_SND_SOC_ES7134) += snd-soc-es7134.o
+obj-$(CONFIG_SND_SOC_ES8316) += snd-soc-es8316.o
obj-$(CONFIG_SND_SOC_ES8328) += snd-soc-es8328.o
obj-$(CONFIG_SND_SOC_ES8328_I2C)+= snd-soc-es8328-i2c.o
obj-$(CONFIG_SND_SOC_ES8328_SPI)+= snd-soc-es8328-spi.o
diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c
new file mode 100644
index 000000000000..ced60a56b4cb
--- /dev/null
+++ b/sound/soc/codecs/es8316.c
@@ -0,0 +1,629 @@
+/*
+ * es8316.c -- es8316 ALSA SoC audio driver
+ * Copyright Everest Semiconductor Co.,Ltd
+ *
+ * Authors: David Yang <yangxiaohua(a)everest-semi.com>,
+ * Daniel Drake <drake(a)endlessm.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/acpi.h>
+#include <linux/delay.h>
+#include <linux/i2c.h>
+#include <linux/mod_devicetable.h>
+#include <linux/regmap.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/soc.h>
+#include <sound/soc-dapm.h>
+#include <sound/tlv.h>
+#include "es8316.h"
+
+/* In slave mode at single speed, the codec is documented as accepting 5
+ * MCLK/LRCK ratios, but we also add ratio 400, which is commonly used on
+ * Intel Cherry Trail platforms (19.2MHz MCLK, 48kHz LRCK).
+ */
+#define NR_SUPPORTED_MCLK_LRCK_RATIOS 6
+static const unsigned int supported_mclk_lrck_ratios[] = {
+ 256, 384, 400, 512, 768, 1024
+};
+
+struct es8316_priv {
+ unsigned int sysclk;
+ unsigned int allowed_rates[NR_SUPPORTED_MCLK_LRCK_RATIOS];
+ struct snd_pcm_hw_constraint_list sysclk_constraints;
+};
+
+/*
+ * ES8316 controls
+ */
+static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -9600, 50, 1);
+static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -9600, 50, 1);
+static const DECLARE_TLV_DB_SCALE(alc_max_gain_tlv, -650, 150, 0);
+static const DECLARE_TLV_DB_SCALE(alc_min_gain_tlv, -1200, 150, 0);
+static const DECLARE_TLV_DB_SCALE(alc_target_tlv, -1650, 150, 0);
+static const DECLARE_TLV_DB_SCALE(hpmixer_gain_tlv, -1200, 150, 0);
+
+static unsigned int adc_pga_gain_tlv[] = {
+ TLV_DB_RANGE_HEAD(12),
+ 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0),
+ 1, 1, TLV_DB_SCALE_ITEM(300, 0, 0),
+ 2, 2, TLV_DB_SCALE_ITEM(600, 0, 0),
+ 3, 3, TLV_DB_SCALE_ITEM(900, 0, 0),
+ 4, 4, TLV_DB_SCALE_ITEM(1200, 0, 0),
+ 5, 5, TLV_DB_SCALE_ITEM(1500, 0, 0),
+ 6, 6, TLV_DB_SCALE_ITEM(1800, 0, 0),
+ 7, 7, TLV_DB_SCALE_ITEM(2100, 0, 0),
+ 8, 8, TLV_DB_SCALE_ITEM(2400, 0, 0),
+};
+static unsigned int hpout_vol_tlv[] = {
+ TLV_DB_RANGE_HEAD(1),
+ 0, 3, TLV_DB_SCALE_ITEM(-4800, 1200, 0),
+};
+
+static const char * const ng_type_txt[] =
+ { "Constant PGA Gain", "Mute ADC Output" };
+static const struct soc_enum ng_type =
+ SOC_ENUM_SINGLE(ES8316_ADC_ALC_NG, 6, 2, ng_type_txt);
+
+static const char * const adcpol_txt[] = { "Normal", "Invert" };
+static const struct soc_enum adcpol =
+ SOC_ENUM_SINGLE(ES8316_ADC_MUTE, 1, 2, adcpol_txt);
+static const char *const dacpol_txt[] =
+ { "Normal", "R Invert", "L Invert", "L + R Invert" };
+static const struct soc_enum dacpol =
+ SOC_ENUM_SINGLE(ES8316_DAC_SET1, 0, 4, dacpol_txt);
+
+static const struct snd_kcontrol_new es8316_snd_controls[] = {
+ SOC_DOUBLE_TLV("HP Playback Volume", ES8316_CPHP_ICAL_VOL,
+ 4, 0, 0, 1, hpout_vol_tlv),
+ SOC_DOUBLE_TLV("HP Mixer Volume", ES8316_HPMIX_VOL,
+ 0, 4, 7, 0, hpmixer_gain_tlv),
+
+ SOC_ENUM("Playback Polarity", dacpol),
+ SOC_DOUBLE_R_TLV("DAC Playback Volume", ES8316_DAC_VOLL,
+ ES8316_DAC_VOLR, 0, 0xc0, 1, dac_vol_tlv),
+ SOC_SINGLE("DAC Soft Ramp Switch", ES8316_DAC_SET1, 4, 1, 1),
+ SOC_SINGLE("DAC Soft Ramp Rate", ES8316_DAC_SET1, 2, 4, 0),
+ SOC_SINGLE("DAC Notch Filter Switch", ES8316_DAC_SET2, 6, 1, 0),
+ SOC_SINGLE("DAC Double Fs Switch", ES8316_DAC_SET2, 7, 1, 0),
+ SOC_SINGLE("DAC Stereo Enhancement", ES8316_DAC_SET3, 0, 7, 0),
+
+ SOC_ENUM("Capture Polarity", adcpol),
+ SOC_SINGLE("Mic Boost Switch", ES8316_ADC_D2SEPGA, 0, 1, 0),
+ SOC_SINGLE_TLV("ADC Capture Volume", ES8316_ADC_VOLUME,
+ 0, 0xc0, 1, adc_vol_tlv),
+ SOC_SINGLE_TLV("ADC PGA Gain Volume", ES8316_ADC_PGAGAIN,
+ 4, 8, 0, adc_pga_gain_tlv),
+ SOC_SINGLE("ADC Soft Ramp Switch", ES8316_ADC_MUTE, 4, 1, 0),
+ SOC_SINGLE("ADC Double Fs Switch", ES8316_ADC_DMIC, 4, 1, 0),
+
+ SOC_SINGLE("ALC Capture Switch", ES8316_ADC_ALC1, 6, 1, 0),
+ SOC_SINGLE_TLV("ALC Capture Max Volume", ES8316_ADC_ALC1, 0, 28, 0,
+ alc_max_gain_tlv),
+ SOC_SINGLE_TLV("ALC Capture Min Volume", ES8316_ADC_ALC2, 0, 28, 0,
+ alc_min_gain_tlv),
+ SOC_SINGLE_TLV("ALC Capture Target Volume", ES8316_ADC_ALC3, 4, 10, 0,
+ alc_target_tlv),
+ SOC_SINGLE("ALC Capture Hold Time", ES8316_ADC_ALC3, 0, 10, 0),
+ SOC_SINGLE("ALC Capture Decay Time", ES8316_ADC_ALC4, 4, 10, 0),
+ SOC_SINGLE("ALC Capture Attack Time", ES8316_ADC_ALC4, 0, 10, 0),
+ SOC_SINGLE("ALC Capture Noise Gate Switch", ES8316_ADC_ALC_NG,
+ 5, 1, 0),
+ SOC_SINGLE("ALC Capture Noise Gate Threshold", ES8316_ADC_ALC_NG,
+ 0, 31, 0),
+ SOC_ENUM("ALC Capture Noise Gate Type", ng_type),
+};
+
+/* Analog Input Mux */
+static const char * const es8316_analog_in_txt[] = {
+ "lin1-rin1",
+ "lin2-rin2",
+ "lin1-rin1 with 20db Boost",
+ "lin2-rin2 with 20db Boost"
+};
+static const unsigned int es8316_analog_in_values[] = { 0, 1, 2, 3 };
+static const struct soc_enum es8316_analog_input_enum =
+ SOC_VALUE_ENUM_SINGLE(ES8316_ADC_PDN_LINSEL, 4, 3,
+ ARRAY_SIZE(es8316_analog_in_txt),
+ es8316_analog_in_txt,
+ es8316_analog_in_values);
+static const struct snd_kcontrol_new es8316_analog_in_mux_controls =
+ SOC_DAPM_ENUM("Route", es8316_analog_input_enum);
+
+static const char * const es8316_dmic_txt[] = {
+ "dmic disable",
+ "dmic data at high level",
+ "dmic data at low level",
+};
+static const unsigned int es8316_dmic_values[] = { 0, 1, 2 };
+static const struct soc_enum es8316_dmic_src_enum =
+ SOC_VALUE_ENUM_SINGLE(ES8316_ADC_DMIC, 0, 3,
+ ARRAY_SIZE(es8316_dmic_txt),
+ es8316_dmic_txt,
+ es8316_dmic_values);
+static const struct snd_kcontrol_new es8316_dmic_src_controls =
+ SOC_DAPM_ENUM("Route", es8316_dmic_src_enum);
+
+/* hp mixer mux */
+static const char * const es8316_hpmux_texts[] = {
+ "lin1-rin1",
+ "lin2-rin2",
+ "lin-rin with Boost",
+ "lin-rin with Boost and PGA"
+};
+
+static const unsigned int es8316_hpmux_values[] = { 0, 1, 2, 3 };
+
+static SOC_ENUM_SINGLE_DECL(es8316_left_hpmux_enum, ES8316_HPMIX_SEL,
+ 4, es8316_hpmux_texts);
+
+static const struct snd_kcontrol_new es8316_left_hpmux_controls =
+ SOC_DAPM_ENUM("Route", es8316_left_hpmux_enum);
+
+static SOC_ENUM_SINGLE_DECL(es8316_right_hpmux_enum, ES8316_HPMIX_SEL,
+ 0, es8316_hpmux_texts);
+
+static const struct snd_kcontrol_new es8316_right_hpmux_controls =
+ SOC_DAPM_ENUM("Route", es8316_right_hpmux_enum);
+
+/* headphone Output Mixer */
+static const struct snd_kcontrol_new es8316_out_left_mix[] = {
+ SOC_DAPM_SINGLE("LLIN Switch", ES8316_HPMIX_SWITCH, 6, 1, 0),
+ SOC_DAPM_SINGLE("Left DAC Switch", ES8316_HPMIX_SWITCH, 7, 1, 0),
+};
+static const struct snd_kcontrol_new es8316_out_right_mix[] = {
+ SOC_DAPM_SINGLE("RLIN Switch", ES8316_HPMIX_SWITCH, 2, 1, 0),
+ SOC_DAPM_SINGLE("Right DAC Switch", ES8316_HPMIX_SWITCH, 3, 1, 0),
+};
+
+/* DAC data source mux */
+static const char * const es8316_dacsrc_texts[] = {
+ "LDATA TO LDAC, RDATA TO RDAC",
+ "LDATA TO LDAC, LDATA TO RDAC",
+ "RDATA TO LDAC, RDATA TO RDAC",
+ "RDATA TO LDAC, LDATA TO RDAC",
+};
+
+static const unsigned int es8316_dacsrc_values[] = { 0, 1, 2, 3 };
+
+static SOC_ENUM_SINGLE_DECL(es8316_dacsrc_mux_enum, ES8316_DAC_SET1,
+ 6, es8316_dacsrc_texts);
+
+static const struct snd_kcontrol_new es8316_dacsrc_mux_controls =
+ SOC_DAPM_ENUM("Route", es8316_dacsrc_mux_enum);
+
+static const struct snd_soc_dapm_widget es8316_dapm_widgets[] = {
+ SND_SOC_DAPM_SUPPLY("Bias", ES8316_SYS_PDN, 3, 1, NULL, 0),
+ SND_SOC_DAPM_SUPPLY("Analog power", ES8316_SYS_PDN, 4, 1, NULL, 0),
+ SND_SOC_DAPM_SUPPLY("Mic Bias", ES8316_SYS_PDN, 5, 1, NULL, 0),
+
+ SND_SOC_DAPM_INPUT("DMIC"),
+ SND_SOC_DAPM_INPUT("MIC1"),
+ SND_SOC_DAPM_INPUT("MIC2"),
+
+ /* Input Mux */
+ SND_SOC_DAPM_MUX("Differential Mux", SND_SOC_NOPM, 0, 0,
+ &es8316_analog_in_mux_controls),
+
+ SND_SOC_DAPM_SUPPLY("ADC Vref", ES8316_SYS_PDN, 1, 1, NULL, 0),
+ SND_SOC_DAPM_SUPPLY("ADC bias", ES8316_SYS_PDN, 2, 1, NULL, 0),
+ SND_SOC_DAPM_SUPPLY("ADC Clock", ES8316_CLKMGR_CLKSW, 3, 0, NULL, 0),
+ SND_SOC_DAPM_PGA("Line input PGA", ES8316_ADC_PDN_LINSEL,
+ 7, 1, NULL, 0),
+ SND_SOC_DAPM_ADC("Mono ADC", NULL, ES8316_ADC_PDN_LINSEL, 6, 1),
+ SND_SOC_DAPM_MUX("Digital Mic Mux", SND_SOC_NOPM, 0, 0,
+ &es8316_dmic_src_controls),
+
+ /* Digital Interface */
+ SND_SOC_DAPM_AIF_OUT("I2S OUT", "I2S1 Capture", 1,
+ ES8316_SERDATA_ADC, 6, 1),
+ SND_SOC_DAPM_AIF_IN("I2S IN", "I2S1 Playback", 0,
+ SND_SOC_NOPM, 0, 0),
+
+ SND_SOC_DAPM_MUX("DAC Source Mux", SND_SOC_NOPM, 0, 0,
+ &es8316_dacsrc_mux_controls),
+
+ SND_SOC_DAPM_SUPPLY("DAC Vref", ES8316_SYS_PDN, 0, 1, NULL, 0),
+ SND_SOC_DAPM_SUPPLY("DAC Clock", ES8316_CLKMGR_CLKSW, 2, 0, NULL, 0),
+ SND_SOC_DAPM_DAC("Right DAC", NULL, ES8316_DAC_PDN, 0, 1),
+ SND_SOC_DAPM_DAC("Left DAC", NULL, ES8316_DAC_PDN, 4, 1),
+
+ /* Headphone Output Side */
+ SND_SOC_DAPM_MUX("Left Headphone Mux", SND_SOC_NOPM, 0, 0,
+ &es8316_left_hpmux_controls),
+ SND_SOC_DAPM_MUX("Right Headphone Mux", SND_SOC_NOPM, 0, 0,
+ &es8316_right_hpmux_controls),
+ SND_SOC_DAPM_MIXER("Left Headphone Mixer", ES8316_HPMIX_PDN,
+ 5, 1, &es8316_out_left_mix[0],
+ ARRAY_SIZE(es8316_out_left_mix)),
+ SND_SOC_DAPM_MIXER("Right Headphone Mixer", ES8316_HPMIX_PDN,
+ 1, 1, &es8316_out_right_mix[0],
+ ARRAY_SIZE(es8316_out_right_mix)),
+ SND_SOC_DAPM_PGA("Left Headphone Mixer Out", ES8316_HPMIX_PDN,
+ 4, 1, NULL, 0),
+ SND_SOC_DAPM_PGA("Right Headphone Mixer Out", ES8316_HPMIX_PDN,
+ 0, 1, NULL, 0),
+
+ SND_SOC_DAPM_OUT_DRV("Left Headphone Charge Pump", ES8316_CPHP_OUTEN,
+ 6, 0, NULL, 0),
+ SND_SOC_DAPM_OUT_DRV("Right Headphone Charge Pump", ES8316_CPHP_OUTEN,
+ 2, 0, NULL, 0),
+ SND_SOC_DAPM_SUPPLY("Headphone Charge Pump", ES8316_CPHP_PDN2,
+ 5, 1, NULL, 0),
+ SND_SOC_DAPM_SUPPLY("Headphone Charge Pump Clock", ES8316_CLKMGR_CLKSW,
+ 4, 0, NULL, 0),
+
+ SND_SOC_DAPM_OUT_DRV("Left Headphone Driver", ES8316_CPHP_OUTEN,
+ 5, 0, NULL, 0),
+ SND_SOC_DAPM_OUT_DRV("Right Headphone Driver", ES8316_CPHP_OUTEN,
+ 1, 0, NULL, 0),
+ SND_SOC_DAPM_SUPPLY("Headphone Out", ES8316_CPHP_PDN1, 2, 1, NULL, 0),
+
+ /* pdn_Lical and pdn_Rical bits are documented as Reserved, but must
+ * be explicitly unset in order to enable HP output
+ */
+ SND_SOC_DAPM_SUPPLY("Left Headphone ical", ES8316_CPHP_ICAL_VOL,
+ 7, 1, NULL, 0),
+ SND_SOC_DAPM_SUPPLY("Right Headphone ical", ES8316_CPHP_ICAL_VOL,
+ 3, 1, NULL, 0),
+
+ SND_SOC_DAPM_OUTPUT("HPOL"),
+ SND_SOC_DAPM_OUTPUT("HPOR"),
+};
+
+static const struct snd_soc_dapm_route es8316_dapm_routes[] = {
+ /* Recording */
+ {"MIC1", NULL, "Mic Bias"},
+ {"MIC2", NULL, "Mic Bias"},
+ {"MIC1", NULL, "Bias"},
+ {"MIC2", NULL, "Bias"},
+ {"MIC1", NULL, "Analog power"},
+ {"MIC2", NULL, "Analog power"},
+
+ {"Differential Mux", "lin1-rin1", "MIC1"},
+ {"Differential Mux", "lin2-rin2", "MIC2"},
+ {"Line input PGA", NULL, "Differential Mux"},
+
+ {"Mono ADC", NULL, "ADC Clock"},
+ {"Mono ADC", NULL, "ADC Vref"},
+ {"Mono ADC", NULL, "ADC bias"},
+ {"Mono ADC", NULL, "Line input PGA"},
+
+ /* It's not clear why, but to avoid recording only silence,
+ * the DAC clock must be running for the ADC to work.
+ */
+ {"Mono ADC", NULL, "DAC Clock"},
+
+ {"Digital Mic Mux", "dmic disable", "Mono ADC"},
+
+ {"I2S OUT", NULL, "Digital Mic Mux"},
+
+ /* Playback */
+ {"DAC Source Mux", "LDATA TO LDAC, RDATA TO RDAC", "I2S IN"},
+
+ {"Left DAC", NULL, "DAC Clock"},
+ {"Right DAC", NULL, "DAC Clock"},
+
+ {"Left DAC", NULL, "DAC Vref"},
+ {"Right DAC", NULL, "DAC Vref"},
+
+ {"Left DAC", NULL, "DAC Source Mux"},
+ {"Right DAC", NULL, "DAC Source Mux"},
+
+ {"Left Headphone Mux", "lin-rin with Boost and PGA", "Line input PGA"},
+ {"Right Headphone Mux", "lin-rin with Boost and PGA", "Line input PGA"},
+
+ {"Left Headphone Mixer", "LLIN Switch", "Left Headphone Mux"},
+ {"Left Headphone Mixer", "Left DAC Switch", "Left DAC"},
+
+ {"Right Headphone Mixer", "RLIN Switch", "Right Headphone Mux"},
+ {"Right Headphone Mixer", "Right DAC Switch", "Right DAC"},
+
+ {"Left Headphone Mixer Out", NULL, "Left Headphone Mixer"},
+ {"Right Headphone Mixer Out", NULL, "Right Headphone Mixer"},
+
+ {"Left Headphone Charge Pump", NULL, "Left Headphone Mixer Out"},
+ {"Right Headphone Charge Pump", NULL, "Right Headphone Mixer Out"},
+
+ {"Left Headphone Charge Pump", NULL, "Headphone Charge Pump"},
+ {"Right Headphone Charge Pump", NULL, "Headphone Charge Pump"},
+
+ {"Left Headphone Charge Pump", NULL, "Headphone Charge Pump Clock"},
+ {"Right Headphone Charge Pump", NULL, "Headphone Charge Pump Clock"},
+
+ {"Left Headphone Driver", NULL, "Left Headphone Charge Pump"},
+ {"Right Headphone Driver", NULL, "Right Headphone Charge Pump"},
+
+ {"HPOL", NULL, "Left Headphone Driver"},
+ {"HPOR", NULL, "Right Headphone Driver"},
+
+ {"HPOL", NULL, "Left Headphone ical"},
+ {"HPOR", NULL, "Right Headphone ical"},
+
+ {"Headphone Out", NULL, "Bias"},
+ {"Headphone Out", NULL, "Analog power"},
+ {"HPOL", NULL, "Headphone Out"},
+ {"HPOR", NULL, "Headphone Out"},
+};
+
+static int es8316_set_dai_sysclk(struct snd_soc_dai *codec_dai,
+ int clk_id, unsigned int freq, int dir)
+{
+ struct snd_soc_codec *codec = codec_dai->codec;
+ struct es8316_priv *es8316 = snd_soc_codec_get_drvdata(codec);
+ int i;
+ int count = 0;
+
+ es8316->sysclk = freq;
+
+ if (freq == 0)
+ return 0;
+
+ /* Limit supported sample rates to ones that can be autodetected
+ * by the codec running in slave mode.
+ */
+ for (i = 0; i < NR_SUPPORTED_MCLK_LRCK_RATIOS; i++) {
+ const unsigned int ratio = supported_mclk_lrck_ratios[i];
+
+ if (freq % ratio == 0)
+ es8316->allowed_rates[count++] = freq / ratio;
+ }
+
+ es8316->sysclk_constraints.list = es8316->allowed_rates;
+ es8316->sysclk_constraints.count = count;
+
+ return 0;
+}
+
+static int es8316_set_dai_fmt(struct snd_soc_dai *codec_dai,
+ unsigned int fmt)
+{
+ struct snd_soc_codec *codec = codec_dai->codec;
+ u8 serdata1 = 0;
+ u8 serdata2 = 0;
+ u8 clksw;
+ u8 mask;
+
+ if ((fmt & SND_SOC_DAIFMT_MASTER_MASK) != SND_SOC_DAIFMT_CBS_CFS) {
+ dev_err(codec->dev, "Codec driver only supports slave mode\n");
+ return -EINVAL;
+ }
+
+ if ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) != SND_SOC_DAIFMT_I2S) {
+ dev_err(codec->dev, "Codec driver only supports I2S format\n");
+ return -EINVAL;
+ }
+
+ /* Clock inversion */
+ switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
+ case SND_SOC_DAIFMT_NB_NF:
+ break;
+ case SND_SOC_DAIFMT_IB_IF:
+ serdata1 |= ES8316_SERDATA1_BCLK_INV;
+ serdata2 |= ES8316_SERDATA2_ADCLRP;
+ break;
+ case SND_SOC_DAIFMT_IB_NF:
+ serdata1 |= ES8316_SERDATA1_BCLK_INV;
+ break;
+ case SND_SOC_DAIFMT_NB_IF:
+ serdata2 |= ES8316_SERDATA2_ADCLRP;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ mask = ES8316_SERDATA1_MASTER | ES8316_SERDATA1_BCLK_INV;
+ snd_soc_update_bits(codec, ES8316_SERDATA1, mask, serdata1);
+
+ mask = ES8316_SERDATA2_FMT_MASK | ES8316_SERDATA2_ADCLRP;
+ snd_soc_update_bits(codec, ES8316_SERDATA_ADC, mask, serdata2);
+ snd_soc_update_bits(codec, ES8316_SERDATA_DAC, mask, serdata2);
+
+ /* Enable BCLK and MCLK inputs in slave mode */
+ clksw = ES8316_CLKMGR_CLKSW_MCLK_ON | ES8316_CLKMGR_CLKSW_BCLK_ON;
+ snd_soc_update_bits(codec, ES8316_CLKMGR_CLKSW, clksw, clksw);
+
+ return 0;
+}
+
+static int es8316_pcm_startup(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+ struct snd_soc_codec *codec = dai->codec;
+ struct es8316_priv *es8316 = snd_soc_codec_get_drvdata(codec);
+
+ if (es8316->sysclk == 0) {
+ dev_err(codec->dev, "No sysclk provided\n");
+ return -EINVAL;
+ }
+
+ /* The set of sample rates that can be supported depends on the
+ * MCLK supplied to the CODEC.
+ */
+ snd_pcm_hw_constraint_list(substream->runtime, 0,
+ SNDRV_PCM_HW_PARAM_RATE,
+ &es8316->sysclk_constraints);
+
+ return 0;
+}
+
+static int es8316_pcm_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params,
+ struct snd_soc_dai *dai)
+{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_codec *codec = rtd->codec;
+ struct es8316_priv *es8316 = snd_soc_codec_get_drvdata(codec);
+ u8 wordlen = 0;
+
+ if (!es8316->sysclk) {
+ dev_err(codec->dev, "No MCLK configured\n");
+ return -EINVAL;
+ }
+
+ switch (params_format(params)) {
+ case SNDRV_PCM_FORMAT_S16_LE:
+ wordlen = ES8316_SERDATA2_LEN_16;
+ break;
+ case SNDRV_PCM_FORMAT_S20_3LE:
+ wordlen = ES8316_SERDATA2_LEN_20;
+ break;
+ case SNDRV_PCM_FORMAT_S24_LE:
+ wordlen = ES8316_SERDATA2_LEN_24;
+ break;
+ case SNDRV_PCM_FORMAT_S32_LE:
+ wordlen = ES8316_SERDATA2_LEN_32;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ snd_soc_update_bits(codec, ES8316_SERDATA_DAC,
+ ES8316_SERDATA2_LEN_MASK, wordlen);
+ snd_soc_update_bits(codec, ES8316_SERDATA_ADC,
+ ES8316_SERDATA2_LEN_MASK, wordlen);
+ return 0;
+}
+
+static int es8316_mute(struct snd_soc_dai *dai, int mute)
+{
+ snd_soc_update_bits(dai->codec, ES8316_DAC_SET1, 0x20,
+ mute ? 0x20 : 0);
+ return 0;
+}
+
+#define ES8316_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
+ SNDRV_PCM_FMTBIT_S24_LE)
+
+static struct snd_soc_dai_ops es8316_ops = {
+ .startup = es8316_pcm_startup,
+ .hw_params = es8316_pcm_hw_params,
+ .set_fmt = es8316_set_dai_fmt,
+ .set_sysclk = es8316_set_dai_sysclk,
+ .digital_mute = es8316_mute,
+};
+
+static struct snd_soc_dai_driver es8316_dai = {
+ .name = "ES8316 HiFi",
+ .playback = {
+ .stream_name = "Playback",
+ .channels_min = 1,
+ .channels_max = 2,
+ .rates = SNDRV_PCM_RATE_8000_48000,
+ .formats = ES8316_FORMATS,
+ },
+ .capture = {
+ .stream_name = "Capture",
+ .channels_min = 1,
+ .channels_max = 2,
+ .rates = SNDRV_PCM_RATE_8000_48000,
+ .formats = ES8316_FORMATS,
+ },
+ .ops = &es8316_ops,
+ .symmetric_rates = 1,
+};
+
+static int es8316_probe(struct snd_soc_codec *codec)
+{
+ /* Reset codec and enable current state machine */
+ snd_soc_write(codec, ES8316_RESET, 0x3f);
+ usleep_range(5000, 5500);
+ snd_soc_write(codec, ES8316_RESET, ES8316_RESET_CSM_ON);
+ msleep(30);
+
+ /*
+ * Documentation for this register is unclear and incomplete,
+ * but here is a vendor-provided value that improves volume
+ * and quality for Intel CHT platforms.
+ */
+ snd_soc_write(codec, ES8316_CLKMGR_ADCOSR, 0x32);
+
+ return 0;
+}
+
+static struct snd_soc_codec_driver soc_codec_dev_es8316 = {
+ .probe = es8316_probe,
+ .idle_bias_off = true,
+
+ .component_driver = {
+ .controls = es8316_snd_controls,
+ .num_controls = ARRAY_SIZE(es8316_snd_controls),
+ .dapm_widgets = es8316_dapm_widgets,
+ .num_dapm_widgets = ARRAY_SIZE(es8316_dapm_widgets),
+ .dapm_routes = es8316_dapm_routes,
+ .num_dapm_routes = ARRAY_SIZE(es8316_dapm_routes),
+ },
+};
+
+static const struct regmap_config es8316_regmap = {
+ .reg_bits = 8,
+ .val_bits = 8,
+ .max_register = 0x53,
+ .cache_type = REGCACHE_RBTREE,
+};
+
+static int es8316_i2c_probe(struct i2c_client *i2c_client,
+ const struct i2c_device_id *id)
+{
+ struct es8316_priv *es8316;
+ struct regmap *regmap;
+
+ es8316 = devm_kzalloc(&i2c_client->dev, sizeof(struct es8316_priv),
+ GFP_KERNEL);
+ if (es8316 == NULL)
+ return -ENOMEM;
+
+ i2c_set_clientdata(i2c_client, es8316);
+
+ regmap = devm_regmap_init_i2c(i2c_client, &es8316_regmap);
+ if (IS_ERR(regmap))
+ return PTR_ERR(regmap);
+
+ return snd_soc_register_codec(&i2c_client->dev, &soc_codec_dev_es8316,
+ &es8316_dai, 1);
+}
+
+static int es8316_i2c_remove(struct i2c_client *client)
+{
+ snd_soc_unregister_codec(&client->dev);
+ return 0;
+}
+
+static const struct i2c_device_id es8316_i2c_id[] = {
+ {"es8316", 0 },
+ {}
+};
+MODULE_DEVICE_TABLE(i2c, es8316_i2c_id);
+
+static const struct of_device_id es8316_of_match[] = {
+ { .compatible = "everest,es8316", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, es8316_of_match);
+
+static const struct acpi_device_id es8316_acpi_match[] = {
+ {"ESSX8316", 0},
+ {},
+};
+MODULE_DEVICE_TABLE(acpi, es8316_acpi_match);
+
+static struct i2c_driver es8316_i2c_driver = {
+ .driver = {
+ .name = "es8316",
+ .acpi_match_table = ACPI_PTR(es8316_acpi_match),
+ .of_match_table = of_match_ptr(es8316_of_match),
+ },
+ .probe = es8316_i2c_probe,
+ .remove = es8316_i2c_remove,
+ .id_table = es8316_i2c_id,
+};
+module_i2c_driver(es8316_i2c_driver);
+
+MODULE_DESCRIPTION("Everest Semi ES8316 ALSA SoC Codec Driver");
+MODULE_AUTHOR("David Yang <yangxiaohua(a)everest-semi.com>");
+MODULE_LICENSE("GPL v2");
diff --git a/sound/soc/codecs/es8316.h b/sound/soc/codecs/es8316.h
new file mode 100644
index 000000000000..6bcdd63ea459
--- /dev/null
+++ b/sound/soc/codecs/es8316.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright Everest Semiconductor Co.,Ltd
+ *
+ * Author: David Yang <yangxiaohua(a)everest-semi.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#ifndef _ES8316_H
+#define _ES8316_H
+
+/*
+ * ES8316 register space
+ */
+
+/* Reset Control */
+#define ES8316_RESET 0x00
+
+/* Clock Management */
+#define ES8316_CLKMGR_CLKSW 0x01
+#define ES8316_CLKMGR_CLKSEL 0x02
+#define ES8316_CLKMGR_ADCOSR 0x03
+#define ES8316_CLKMGR_ADCDIV1 0x04
+#define ES8316_CLKMGR_ADCDIV2 0x05
+#define ES8316_CLKMGR_DACDIV1 0x06
+#define ES8316_CLKMGR_DACDIV2 0x07
+#define ES8316_CLKMGR_CPDIV 0x08
+
+/* Serial Data Port Control */
+#define ES8316_SERDATA1 0x09
+#define ES8316_SERDATA_ADC 0x0a
+#define ES8316_SERDATA_DAC 0x0b
+
+/* System Control */
+#define ES8316_SYS_VMIDSEL 0x0c
+#define ES8316_SYS_PDN 0x0d
+#define ES8316_SYS_LP1 0x0e
+#define ES8316_SYS_LP2 0x0f
+#define ES8316_SYS_VMIDLOW 0x10
+#define ES8316_SYS_VSEL 0x11
+#define ES8316_SYS_REF 0x12
+
+/* Headphone Mixer */
+#define ES8316_HPMIX_SEL 0x13
+#define ES8316_HPMIX_SWITCH 0x14
+#define ES8316_HPMIX_PDN 0x15
+#define ES8316_HPMIX_VOL 0x16
+
+/* Charge Pump Headphone driver */
+#define ES8316_CPHP_OUTEN 0x17
+#define ES8316_CPHP_ICAL_VOL 0x18
+#define ES8316_CPHP_PDN1 0x19
+#define ES8316_CPHP_PDN2 0x1a
+#define ES8316_CPHP_LDOCTL 0x1b
+
+/* Calibration */
+#define ES8316_CAL_TYPE 0x1c
+#define ES8316_CAL_SET 0x1d
+#define ES8316_CAL_HPLIV 0x1e
+#define ES8316_CAL_HPRIV 0x1f
+#define ES8316_CAL_HPLMV 0x20
+#define ES8316_CAL_HPRMV 0x21
+
+/* ADC Control */
+#define ES8316_ADC_PDN_LINSEL 0x22
+#define ES8316_ADC_PGAGAIN 0x23
+#define ES8316_ADC_D2SEPGA 0x24
+#define ES8316_ADC_DMIC 0x25
+#define ES8316_ADC_MUTE 0x26
+#define ES8316_ADC_VOLUME 0x27
+#define ES8316_ADC_ALC1 0x29
+#define ES8316_ADC_ALC2 0x2a
+#define ES8316_ADC_ALC3 0x2b
+#define ES8316_ADC_ALC4 0x2c
+#define ES8316_ADC_ALC5 0x2d
+#define ES8316_ADC_ALC_NG 0x2e
+
+/* DAC Control */
+#define ES8316_DAC_PDN 0x2f
+#define ES8316_DAC_SET1 0x30
+#define ES8316_DAC_SET2 0x31
+#define ES8316_DAC_SET3 0x32
+#define ES8316_DAC_VOLL 0x33
+#define ES8316_DAC_VOLR 0x34
+
+/* GPIO */
+#define ES8316_GPIO_SEL 0x4d
+#define ES8316_GPIO_DEBOUNCE 0x4e
+#define ES8316_GPIO_FLAG 0x4f
+
+/* Test mode */
+#define ES8316_TESTMODE 0x50
+#define ES8316_TEST1 0x51
+#define ES8316_TEST2 0x52
+#define ES8316_TEST3 0x53
+
+/*
+ * Field definitions
+ */
+
+/* ES8316_RESET */
+#define ES8316_RESET_CSM_ON 0x80
+
+/* ES8316_CLKMGR_CLKSW */
+#define ES8316_CLKMGR_CLKSW_MCLK_ON 0x40
+#define ES8316_CLKMGR_CLKSW_BCLK_ON 0x20
+
+/* ES8316_SERDATA1 */
+#define ES8316_SERDATA1_MASTER 0x80
+#define ES8316_SERDATA1_BCLK_INV 0x20
+
+/* ES8316_SERDATA_ADC and _DAC */
+#define ES8316_SERDATA2_FMT_MASK 0x3
+#define ES8316_SERDATA2_FMT_I2S 0x00
+#define ES8316_SERDATA2_FMT_LEFTJ 0x01
+#define ES8316_SERDATA2_FMT_RIGHTJ 0x02
+#define ES8316_SERDATA2_FMT_PCM 0x03
+#define ES8316_SERDATA2_ADCLRP 0x20
+#define ES8316_SERDATA2_LEN_MASK 0x1c
+#define ES8316_SERDATA2_LEN_24 0x00
+#define ES8316_SERDATA2_LEN_20 0x04
+#define ES8316_SERDATA2_LEN_18 0x08
+#define ES8316_SERDATA2_LEN_16 0x0c
+#define ES8316_SERDATA2_LEN_32 0x10
+
+#endif
--
2.11.0
3
5
[alsa-devel] [PATCH] ASoC: rt5663: Check the JD status in the resume function
by Oder Chiou 13 Jun '17
by Oder Chiou 13 Jun '17
13 Jun '17
In the suspend, the IRQ function will not work in some machines. So the JD
status should be checked in the resume function.
Signed-off-by: Oder Chiou <oder_chiou(a)realtek.com>
---
sound/soc/codecs/rt5663.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c
index 8569e8c..a33202a 100644
--- a/sound/soc/codecs/rt5663.c
+++ b/sound/soc/codecs/rt5663.c
@@ -2847,6 +2847,8 @@ static int rt5663_resume(struct snd_soc_codec *codec)
regcache_cache_only(rt5663->regmap, false);
regcache_sync(rt5663->regmap);
+ rt5663_irq(0, rt5663);
+
return 0;
}
#else
--
2.7.4
2
1
[alsa-devel] [PATCH] ASoC: rsnd: don't call free_irq() on Parent SSI
by Kuninori Morimoto 13 Jun '17
by Kuninori Morimoto 13 Jun '17
13 Jun '17
From: Kuninori Morimoto <kuninori.morimoto.gx(a)renesas.com>
If SSI uses shared pin, some SSI will be used as parent SSI.
Then, normal SSI's remove and Parent SSI's remove
(these are same SSI) will be called when unbind or remove timing.
In this case, free_irq() will be called twice.
This patch solve this issue.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx(a)renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx(a)renesas.com>
---
sound/soc/sh/rcar/ssi.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 5960042..e23fcab 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -726,6 +726,11 @@ static int rsnd_ssi_dma_remove(struct rsnd_mod *mod,
struct rsnd_priv *priv)
{
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
+ struct rsnd_mod *ssi_parent_mod = rsnd_io_to_mod_ssip(io);
+
+ /* Do nothing for SSI parent mod */
+ if (ssi_parent_mod == mod)
+ return 0;
/* PIO will request IRQ again */
free_irq(ssi->irq, mod);
--
1.9.1
2
4
Hi,
this is a series of trivial patches to add const prefix appropriately
to the possible hw_constraint static objects like the previous
patchset for other ALSA drivers. It's just for hardening.
thanks,
Takashi
===
Takashi Iwai (7):
ASoC: cs35l34: Constify hw_constraints
ASoC: cs53l30: Constify hw_constraints
ASoC: intel: bxt: Constify hw_constraints
ASoC: intel: byt: Constify hw_constraints
ASoC: intel: skl: Constify hw_constraints
ASoC: mediatek: Constify hw_constraints
ASoC: samsung: Constify hw_constraints
sound/soc/codecs/cs35l34.c | 4 ++--
sound/soc/codecs/cs53l30.c | 2 +-
sound/soc/intel/boards/bxt_da7219_max98357a.c | 12 ++++++------
sound/soc/intel/boards/bxt_rt298.c | 12 ++++++------
sound/soc/intel/boards/bytcht_nocodec.c | 4 ++--
sound/soc/intel/boards/bytcr_rt5651.c | 4 ++--
sound/soc/intel/boards/skl_nau88l25_max98357a.c | 16 ++++++++--------
sound/soc/intel/boards/skl_nau88l25_ssm4567.c | 16 ++++++++--------
sound/soc/intel/boards/skl_rt286.c | 12 ++++++------
sound/soc/mediatek/mt2701/mt2701-cs42448.c | 2 +-
sound/soc/samsung/s3c24xx_uda134x.c | 2 +-
11 files changed, 43 insertions(+), 43 deletions(-)
--
2.13.0
5
19
[alsa-devel] [PATCH] ASoC: rsnd: add detail explanation of L/R conversion timing
by Kuninori Morimoto 13 Jun '17
by Kuninori Morimoto 13 Jun '17
13 Jun '17
From: Kuninori Morimoto <kuninori.morimoto.gx(a)renesas.com>
Renesas Sound device *Hardware* L/R and Linux *Software* L/R are
inverted. Because of this background, it needs to convert L/R.
Then, DVC needs *Hardware* L/R, and Linux needs *Software* L/R.
Because Playback/Capture needs different timing, and there is no
explanation about it on source code / git log, this patch adds it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx(a)renesas.com>
---
sound/soc/sh/rcar/core.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 7c68f9d..1bf261d 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -310,6 +310,24 @@ u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
u32 val = 0x76543210;
u32 mask = ~0;
+ /*
+ * *Hardware* L/R and *Software* L/R are inverted.
+ * We need to care about inversion timing to control
+ * Playback/Capture correctly.
+ * The point is [DVC] needs *Hardware* L/R, [MEM] needs *Software* L/R
+ *
+ * sL/R : software L/R
+ * hL/R : hardware L/R
+ * (*) : conversion timing
+ *
+ * Playback
+ * sL/R (*) hL/R hL/R hL/R hL/R hL/R
+ * [MEM] -> [SRC] -> [DVC] -> [CMD] -> [SSIU] -> [SSI] -> codec
+ *
+ * Capture
+ * hL/R hL/R hL/R hL/R hL/R (*) sL/R
+ * codec -> [SSI] -> [SSIU] -> [SRC] -> [DVC] -> [CMD] -> [MEM]
+ */
if (rsnd_io_is_play(io)) {
struct rsnd_mod *src = rsnd_io_to_mod_src(io);
--
1.9.1
2
1
13 Jun '17
Hi Mark
Current rsnd driver has strange behavior if we do
Ctrl-Z + fg, and its related operation.
These patches fix these issues.
Kuninori Morimoto (3):
ASoC: rsnd: tidyup src->convert_rate reset timing
ASoC: rsnd: merge rsnd_kctrl_new_m/s/e into rsnd_kctrl_new()
ASoC: rsnd: control kctrl items acceptance anytime/runtime
sound/soc/sh/rcar/core.c | 113 +++++++++++++++++++++--------------------------
sound/soc/sh/rcar/ctu.c | 6 +++
sound/soc/sh/rcar/dvc.c | 13 ++++--
sound/soc/sh/rcar/rsnd.h | 54 +++++++++++-----------
sound/soc/sh/rcar/src.c | 5 ++-
5 files changed, 97 insertions(+), 94 deletions(-)
--
1.9.1
2
8