ASoC: add RT5677 CODEC driver
Subsystems (3)
Oder Chiou
maintainerPATCH 1/1 ASoC: add RT5677 CODEC driver
This patch adds the Realtek ALC5677 codec driver.
--- include/sound/rt5677.h | 21 + sound/soc/codecs/Kconfig | 4 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/rt5677.c | 3498 +++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/rt5677.h | 1451 +++++++++++++++++++ 5 files changed, 4976 insertions(+) create mode 100644 include/sound/rt5677.h create mode 100644 sound/soc/codecs/rt5677.c create mode 100644 sound/soc/codecs/rt5677.h
include/sound/rt5677.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* linux/sound/rt5677.h -- Platform data for RT5677 +* +* Copyright 2013 Realtek Semiconductor Corp. +* Author: Oder Chiou <[email protected]> +* +* 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 __LINUX_SND_RT5677_H +#define __LINUX_SND_RT5677_H + +struct rt5677_platform_data { +/* IN1 IN2 can optionally be differential */ +bool in1_diff; +bool in2_diff; +}; + +#endif
sound/soc/codecs/Kconfig +4 -0
@@ -74,6 +74,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_RT5640 if I2C select SND_SOC_RT5645 if I2C select SND_SOC_RT5651 if I2C + select SND_SOC_RT5677 if I2C select SND_SOC_SGTL5000 if I2C select SND_SOC_SI476X if MFD_SI476X_CORE select SND_SOC_SIRF_AUDIO_CODEC
@@ -414,6 +415,9 @@ config SND_SOC_RT5645 config SND_SOC_RT5651 tristate +config SND_SOC_RT5677 + tristate + #Freescale sgtl5000 codec config SND_SOC_SGTL5000 tristate "Freescale SGTL5000 CODEC"
sound/soc/codecs/Makefile +2 -0
@@ -64,6 +64,7 @@ snd-soc-rt5631-objs := rt5631.o snd-soc-rt5640-objs := rt5640.o snd-soc-rt5645-objs := rt5645.o snd-soc-rt5651-objs := rt5651.o +snd-soc-rt5677-objs := rt5677.o snd-soc-sgtl5000-objs := sgtl5000.o snd-soc-alc5623-objs := alc5623.o snd-soc-alc5632-objs := alc5632.o
@@ -220,6 +221,7 @@ obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o obj-$(CONFIG_SND_SOC_RT5640) += snd-soc-rt5640.o obj-$(CONFIG_SND_SOC_RT5645) += snd-soc-rt5645.o obj-$(CONFIG_SND_SOC_RT5651) += snd-soc-rt5651.o +obj-$(CONFIG_SND_SOC_RT5677) += snd-soc-rt5677.o obj-$(CONFIG_SND_SOC_SGTL5000) += snd-soc-sgtl5000.o obj-$(CONFIG_SND_SOC_SIGMADSP) += snd-soc-sigmadsp.o obj-$(CONFIG_SND_SOC_SI476X) += snd-soc-si476x.o
sound/soc/codecs/rt5677.c new file +3498 -0
2,949 lines not on this page · raw message
sound/soc/codecs/rt5677.h new file +1451 -0
1,451 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.8.1.1.439.g50a6b54
Part of the diff is not shown here. View the raw message.
Mark Brown
maintainerQuoted 1 line · Oder Chiou
This patch adds the Realtek ALC5677 codec driver.
This looks nice but some minor things need fixing. Since they're so minor especially in the context of such a large and generally good driver I've gone ahead and applied this, please submit followup patches for the issues below.
sound/soc/codecs/rt5677.c line 609
Quoted 4 lines
sound/soc/codecs/rt5677.c new file +4
-0+/* ADC Boost Volume Control */ +SOC_DOUBLE_TLV ("STO1 ADC Boost Gain" ,RT5677_STO1_2_ADC_BST , +RT5677_STO1_ADC_L_BST_SFT ,RT5677_STO1_ADC_R_BST_SFT ,3 ,0 , + adc_bst_tlv),
Gain controls of all kinds should be called Volume so UIs do the right thing.
sound/soc/codecs/rt5677.c line 1152
Quoted 2 lines
sound/soc/codecs/rt5677.c new file +2
-0+static const struct snd_kcontrol_new rt5677_sto2_dmic_mux = +SOC_DAPM_ENUM ("Stereo2 DMIC source" , rt5677_stereo2_dmic_enum);
The general style is to capitalise each word so "Stereo2 DMIC Source".
sound/soc/codecs/rt5677.c line 1671
Quoted 12 lines
sound/soc/codecs/rt5677.c new file +12
-0+static int rt5677_set_micbias1_event (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *kcontrol,int event) +{ +struct snd_soc_codec *codec = w->codec; +struct rt5677_priv *rt5677 =snd_soc_codec_get_drvdata (codec); + +switch (event) { +case SND_SOC_DAPM_POST_PMU : +regmap_update_bits (rt5677->regmap,RT5677_PWR_ANLG2 , +RT5677_PWR_CLK_MB1 |RT5677_PWR_PP_MB1 | +RT5677_PWR_CLK_MB ,RT5677_PWR_CLK_MB1 | +RT5677_PWR_PP_MB1 |RT5677_PWR_CLK_MB );
What does this do - I note we never undo this?
sound/soc/codecs/rt5677.c line 1689
Quoted 4 lines
sound/soc/codecs/rt5677.c new file +4
-0+/* Input Side */ +/* micbias */ +SND_SOC_DAPM_SUPPLY ("micbias1" ,RT5677_PWR_ANLG2 ,RT5677_PWR_MB1_BIT , + 0, rt5677_set_micbias1_event, SND_SOC_DAPM_POST_PMU),
Idiomaticlaly this would be "MICBIAS1".
sound/soc/codecs/rt5677.c line 3494
Quoted 11 lines
sound/soc/codecs/rt5677.c new file +11
-0+static int __init rt5677_modinit (void ) +{ +return i2c_add_driver (&rt5677_i2c_driver); +} +module_init (rt5677_modinit); + +static void __exit rt5677_modexit(void) +{ +i2c_del_driver (&rt5677_i2c_driver); +} +module_exit (rt5677_modexit);
module_i2c_driver().
Oder Chiou
maintainerQuoted 5 lines
Quoted 5 lines
sound/soc/codecs/rt5677.c new file +5
-0+static int rt5677_set_micbias1_event (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *kcontrol,int event) { +struct snd_soc_codec *codec = w->codec; +struct rt5677_priv *rt5677 =snd_soc_codec_get_drvdata (codec); +
Quoted 9 lines
sound/soc/codecs/rt5677.c line 1671
Quoted 6 lines
sound/soc/codecs/rt5677.c new file +6
-0+switch (event) { +case SND_SOC_DAPM_POST_PMU : +regmap_update_bits (rt5677->regmap,RT5677_PWR_ANLG2 , +RT5677_PWR_CLK_MB1 |RT5677_PWR_PP_MB1 | +RT5677_PWR_CLK_MB ,RT5677_PWR_CLK_MB1 | +RT5677_PWR_PP_MB1 |RT5677_PWR_CLK_MB );What does this do - I note we never undo this?
We will add a PMD case for this event, thanks.