Add ES8328 audio codec
Subsystems (5)
v5 cover Add ES8328 audio codec
This patchset adds support for the Everest Semi ES8328 audio codec. It also adds support for using the es8328 on IMX boards.
We write a machine driver rather than using simple-card because the machine driver needs to support regulators for the speaker amps and as well as supporting headphone jacks.
This requires support for DT clock reparenting in order to get the codec its 22.5792 MHz supply frequency.
Changes since v4:
- Simplify clock handling and use assigned-clock-parents
- Move the codec regulator from the machine driver to the codec
- Specify all four regulators, and require their presence
- Fix audio recording, such that it enables the PGA
Changes since v3:
- Add OF bindings for everest,es8328
- Add back in patch to add everest as a vendor prefix
- Give clocks more generic names
- Document required clocks in DT bindings document
Changes since v2:
- Change deemph to a bool, and update based on sample rate
- Replace value enums with regular enums
- Break SPI and I2C drivers into their own modules
- Rename everest,es8328 to es8328 as the module wasn't getting detected. Because of this, the patch to vendor-prefixes.txt has been dropped.
Changes since v1:
- Rename HP/Speaker to OUT1/OUT2
- Use DAPM widgets for startup/shutdown
- Add regulator support to machine driver
Sean Cross (3):
devicetree: bindings: Add Everest Semicodunctor
ASoC: add es8328 codec driver
ASoC: fsl: add imx-es8328 machine driver
Documentation/devicetree/bindings/sound/es8328.txt | 24 + .../devicetree/bindings/sound/imx-audio-es8328.txt | 63 ++ .../devicetree/bindings/vendor-prefixes.txt | 1 + sound/soc/codecs/Kconfig | 13 + sound/soc/codecs/Makefile | 6 + sound/soc/codecs/es8328-i2c.c | 60 ++ sound/soc/codecs/es8328-spi.c | 49 ++ sound/soc/codecs/es8328.c | 694 +++++++++++++++++++++ sound/soc/codecs/es8328.h | 313 ++++++++++ sound/soc/fsl/Kconfig | 14 + sound/soc/fsl/Makefile | 2 + sound/soc/fsl/imx-es8328.c | 263 ++++++++ 12 files changed, 1502 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/es8328.txt create mode 100644 Documentation/devicetree/bindings/sound/imx-audio-es8328.txt create mode 100644 sound/soc/codecs/es8328-i2c.c create mode 100644 sound/soc/codecs/es8328-spi.c create mode 100644 sound/soc/codecs/es8328.c create mode 100644 sound/soc/codecs/es8328.h create mode 100644 sound/soc/fsl/imx-es8328.c
Signature · 6 lines
2.0.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v5 1/3 devicetree: bindings: Add Everest Semicodunctor
In reply to a message not in the archiveEverest Semiconductor makes audio codecs.
--- Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
@@ -46,6 +46,7 @@ epfl Ecole Polytechnique Fédérale de Lausanne epson Seiko Epson Corp. est ESTeem Wireless Modems eukrea Eukréa Electromatique +everest Everest Semiconductor Co. Ltd. excito Excito fsl Freescale Semiconductor GEFanuc GE Fanuc Intelligent Platforms Embedded Systems, Inc.
Signature · 6 lines
2.0.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v5 2/3 ASoC: add es8328 codec driver
In reply to a message not in the archiveAdd a codec driver for the Everest ES8328. It supports two separate audio outputs and two separate audio inputs.
--- Documentation/devicetree/bindings/sound/es8328.txt | 24 + sound/soc/codecs/Kconfig | 13 + sound/soc/codecs/Makefile | 6 + sound/soc/codecs/es8328-i2c.c | 60 ++ sound/soc/codecs/es8328-spi.c | 49 ++ sound/soc/codecs/es8328.c | 694 +++++++++++++++++++++ sound/soc/codecs/es8328.h | 313 ++++++++++ 7 files changed, 1159 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/es8328.txt create mode 100644 sound/soc/codecs/es8328-i2c.c create mode 100644 sound/soc/codecs/es8328-spi.c create mode 100644 sound/soc/codecs/es8328.c create mode 100644 sound/soc/codecs/es8328.h
Documentation/devicetree/bindings/sound/es8328.txt new file +24 -0
@@ -0,0 +1,24 @@ +Everest ES8328 audio CODEC + +This device supports both I2C and SPI (configured with pin strapping +on the board). + +Required properties: + + - compatible : "everest,es8328" + - DVDD-supply : Regulator providing digital core supply voltage 1.8 - 3.6V + - AVDD-supply : Regulator providing analog supply voltage 3.3V + - PVDD-supply : Regulator providing digital IO supply voltage 1.8 - 3.6V + - IPVDD-supply : Regulator providing analog output voltage 3.3V + - reg : the I2C address of the device for I2C, the chip select number for SPI + +Example: + +codec: es8328@11 { + compatible = "everest,es8328"; + DVDD-supply = <®_3p3v>; + AVDD-supply = <®_3p3v>; + PVDD-supply = <®_3p3v>; + HPVDD-supply = <®_3p3v>; + reg = <0x11>; +};
sound/soc/codecs/Kconfig +13 -0
@@ -56,6 +56,8 @@ config SND_SOC_ALL_CODECS select SND_SOC_DA732X if I2C select SND_SOC_DA9055 if I2C select SND_SOC_BT_SCO + select SND_SOC_ES8328_SPI if SPI_MASTER + select SND_SOC_ES8328_I2C if I2C select SND_SOC_ISABELLE if I2C select SND_SOC_JZ4740_CODEC select SND_SOC_LM4857 if I2C
@@ -396,6 +398,17 @@ config SND_SOC_DMIC config SND_SOC_HDMI_CODEC tristate "HDMI stub CODEC" +config SND_SOC_ES8328 + tristate "Everest Semi ES8328 CODEC" + +config SND_SOC_ES8328_I2C + tristate + select SND_SOC_ES8328 + +config SND_SOC_ES8328_SPI + tristate + select SND_SOC_ES8328 + config SND_SOC_ISABELLE tristate
sound/soc/codecs/Makefile +6 -0
@@ -48,6 +48,9 @@ snd-soc-da732x-objs := da732x.o snd-soc-da9055-objs := da9055.o snd-soc-bt-sco-objs := bt-sco.o snd-soc-dmic-objs := dmic.o +snd-soc-es8328-objs := es8328.o +snd-soc-es8328-i2c-objs := es8328-i2c.o +snd-soc-es8328-spi-objs := es8328-spi.o snd-soc-isabelle-objs := isabelle.o snd-soc-jz4740-codec-objs := jz4740.o snd-soc-l3-objs := l3.o
@@ -213,6 +216,9 @@ obj-$(CONFIG_SND_SOC_DA732X) += snd-soc-da732x.o obj-$(CONFIG_SND_SOC_DA9055) += snd-soc-da9055.o obj-$(CONFIG_SND_SOC_BT_SCO) += snd-soc-bt-sco.o obj-$(CONFIG_SND_SOC_DMIC) += snd-soc-dmic.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 obj-$(CONFIG_SND_SOC_ISABELLE) += snd-soc-isabelle.o obj-$(CONFIG_SND_SOC_JZ4740_CODEC) += snd-soc-jz4740-codec.o obj-$(CONFIG_SND_SOC_L3) += snd-soc-l3.o
sound/soc/codecs/es8328-i2c.c new file +60 -0
60 lines not on this page · raw message
sound/soc/codecs/es8328-spi.c new file +49 -0
49 lines not on this page · raw message
sound/soc/codecs/es8328.c new file +694 -0
694 lines not on this page · raw message
sound/soc/codecs/es8328.h new file +313 -0
313 lines not on this page · raw message
Signature · 6 lines
2.0.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v5 3/3 ASoC: fsl: add imx-es8328 machine driver
In reply to a message not in the archiveThis adds an initial machine driver for the ES8328 audio codec on Freescale boards. The driver supports headphones and an audio regulator for an onboard speaker amp.
--- .../devicetree/bindings/sound/imx-audio-es8328.txt | 63 +++++ sound/soc/fsl/Kconfig | 14 ++ sound/soc/fsl/Makefile | 2 + sound/soc/fsl/imx-es8328.c | 263 +++++++++++++++++++++ 4 files changed, 342 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/imx-audio-es8328.txt create mode 100644 sound/soc/fsl/imx-es8328.c
Documentation/devicetree/bindings/sound/imx-audio-es8328.txt new file +63 -0
@@ -0,0 +1,63 @@ +Freescale i.MX audio complex with ES8328 codec + +Required properties: +- compatible : "fsl,imx-audio-es8328" +- model : The user-visible name of this sound complex +- clocks : A clock that generates a 22.5792 MHz signal +- ssi-controller : The phandle of the i.MX SSI controller +- jack-gpio : Optional GPIO for headphone jack +- audio-amp-supply : Power regulator for speaker amps +- audio-codec : The phandle of the ES8328 audio codec +- audio-routing : A list of the connections between audio components. + Each entry is a pair of strings, the first being the connection's sink, + the second being the connection's source. Valid names could be power + supplies, ES8328 pins, and the jacks on the board: + + Power supplies: + * audio-amp + + ES8328 pins: + * LOUT1 + * LOUT2 + * ROUT1 + * ROUT2 + + Board connectors: + * Headphone + * Speaker + +- mux-int-port : The internal port of the i.MX audio muxer (AUDMUX) +- mux-ext-port : The external port of the i.MX audio muxer + +Note: The AUDMUX port numbering should start at 1, which is consistent with +hardware manual. + +Example: + +sound { + compatible = "fsl,imx-audio-es8328"; + model = "imx-audio-es8328"; + clocks = <&clks 169>; + assigned-clocks = <&clks 201>, <&clks 57>, + <&clks 173>, <&clks 169>; + assigned-clock-parents = <&clks 169>, <&clks 203>, + <&clks 3>, <&clks 100>; + assigned-clock-rates = <0>, <0>, + <722534400>, <22579200>; + ssi-controller = <&ssi1>; + audio-codec = <&codec>; + jack-gpio = <&gpio5 15 0>; + audio-amp-supply = <®_audio_amp>; + audio-routing = + "Speaker", "LOUT2", + "Speaker", "ROUT2", + "Speaker", "audio-amp", + "Headphone", "ROUT1", + "Headphone", "LOUT1", + "LINPUT1", "Mic Jack", + "RINPUT1", "Mic Jack", + "Mic Jack", "Mic Bias"; + mux-int-port = <1>; + mux-ext-port = <3>; +}; +
sound/soc/fsl/Kconfig +14 -0
@@ -229,6 +229,20 @@ config SND_SOC_IMX_WM8962 Say Y if you want to add support for SoC audio on an i.MX board with a wm8962 codec. +config SND_SOC_IMX_ES8328 + tristate "SoC Audio support for i.MX boards with the ES8328 codec" + depends on OF && (I2C || SPI) + select SND_SOC_ES8328_I2C if I2C + select SND_SOC_ES8328_SPI if SPI_MASTER + select SND_SOC_IMX_PCM_DMA + select SND_SOC_IMX_AUDMUX + select SND_SOC_FSL_SSI + select SND_SOC_FSL_UTILS + select SND_SOC_IMX_PCM_FIQ + help + Say Y if you want to add support for the ES8328 audio codec connected + via SSI/I2S over either SPI or I2C. + config SND_SOC_IMX_SGTL5000 tristate "SoC Audio support for i.MX boards with sgtl5000" depends on OF && I2C
sound/soc/fsl/Makefile +2 -0
@@ -48,6 +48,7 @@ snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o snd-soc-phycore-ac97-objs := phycore-ac97.o snd-soc-mx27vis-aic32x4-objs := mx27vis-aic32x4.o snd-soc-wm1133-ev1-objs := wm1133-ev1.o +snd-soc-imx-es8328-objs := imx-es8328.o snd-soc-imx-sgtl5000-objs := imx-sgtl5000.o snd-soc-imx-wm8962-objs := imx-wm8962.o snd-soc-imx-spdif-objs := imx-spdif.o
@@ -57,6 +58,7 @@ obj-$(CONFIG_SND_SOC_EUKREA_TLV320) += snd-soc-eukrea-tlv320.o obj-$(CONFIG_SND_SOC_PHYCORE_AC97) += snd-soc-phycore-ac97.o obj-$(CONFIG_SND_SOC_MX27VIS_AIC32X4) += snd-soc-mx27vis-aic32x4.o obj-$(CONFIG_SND_MXC_SOC_WM1133_EV1) += snd-soc-wm1133-ev1.o +obj-$(CONFIG_SND_SOC_IMX_ES8328) += snd-soc-imx-es8328.o obj-$(CONFIG_SND_SOC_IMX_SGTL5000) += snd-soc-imx-sgtl5000.o obj-$(CONFIG_SND_SOC_IMX_WM8962) += snd-soc-imx-wm8962.o obj-$(CONFIG_SND_SOC_IMX_SPDIF) += snd-soc-imx-spdif.o
sound/soc/fsl/imx-es8328.c new file +263 -0
263 lines not on this page · raw message
Signature · 6 lines
2.0.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [alsa-devel] [PATCH v5 3/3] ASoC: fsl: add imx-es8328 machine driver
In reply to a message not in the archiveQuoted 6 lines · Sean Cross
This adds an initial machine driver for the ES8328 audio codec on Freescale boards. The driver supports headphones and an audio regulator for an onboard speaker amp.
Signed-off-by Sean Cross <[email protected]>---
<snip>
sound/soc/fsl/imx-es8328.c line 96
Quoted 6 lines
sound/soc/fsl/imx-es8328.c new file +6
-0+static int imx_set_frequency (struct imx_es8328_data *data,int freq) +{ +int ret; + +return ret; +}
This function returns an uninitialised variable and is not used anywhere, so I assume can be removed.
Thanks,
Charles
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 2/3] ASoC: add es8328 codec driver
In reply to a message not in the archivesound/soc/codecs/es8328.c line 417
Quoted 7 lines · Sean Cross
sound/soc/codecs/es8328.c new file +7
-0+if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) + reg =ES8328_DACCONTROL2 ; + +else if (substream->stream ==SNDRV_PCM_STREAM_CAPTURE ) + reg =ES8328_ADCCONTROL5 ; +else +return -EINVAL ;
Idiomatically this is just a single if/else, if you weren't doing that then it ought to be a switch but really there's no need to do something non-idiomatic.
sound/soc/codecs/es8328.c line 487
Quoted 4 lines
sound/soc/codecs/es8328.c new file +4
-0+/* Master serial port mode */ +snd_soc_write (codec,ES8328_MASTERMODE , +ES8328_MASTERMODE_MCLKDIV2 | +ES8328_MASTERMODE_MSC );
It seems a bit unfortunate that set_sysclk() doesn't manage MCLKDIV2 - if that isn't badly named the driver could easily support both the current fixed SYSCLK rate and twice that.
sound/soc/codecs/es8328.c line 524
Quoted 7 lines
sound/soc/codecs/es8328.c new file +7
-0+case SND_SOC_BIAS_PREPARE : +/* VREF, VMID=2x50k, digital enabled */ +snd_soc_write (codec,ES8328_CHIPPOWER , pwr_reg); +snd_soc_write (codec,ES8328_CONTROL1 , + cc1_reg | + ES8328_CONTROL1_VMIDSEL_50k | +ES8328_CONTROL1_ENREF );
snd_soc_update_bits() as I'm fairly sure I said last time.
sound/soc/codecs/es8328.c line 602
Quoted 5 lines
sound/soc/codecs/es8328.c new file +5
-0+static int es8328_suspend (struct snd_soc_codec *codec) +{ +es8328_set_bias_level (codec,SND_SOC_BIAS_OFF ); +return 0 ; +}
Neither this nor set_bias_level() restores the register cache after suspend - this will mean suspend and resume is broken in systems where power is removed from the device over suspend.
sound/soc/codecs/es8328.c line 626
Quoted 6 lines
sound/soc/codecs/es8328.c new file +6
-0+ ret =devm_regulator_bulk_get (codec->dev,ARRAY_SIZE (es8328->supplies), + es8328->supplies); +if (ret) { +dev_err (codec->dev,"!!! Unable to get regulators\n" ); +return ret; + }
Print the error code and format the messages normally - none of this !!! stuff please.
Re: [PATCH v5 3/3] ASoC: fsl: add imx-es8328 machine driver
In reply to a message not in the archiveDocumentation/devicetree/bindings/sound/imx-audio-es8328.txt line 23
Quoted 5 lines · Sean Cross
Documentation/devicetree/bindings/sound/imx-audio-es8328.txt new file +5
-0+ ES8328 pins: + * LOUT1 + * LOUT2 + * ROUT1 + * ROUT2
These should be covered in the binding document for the CODEC.
sound/soc/fsl/imx-es8328.c line 181
Quoted 13 lines
sound/soc/fsl/imx-es8328.c new file +13
-0+/* Setup clocks */ + data->codec_clk =devm_clk_get (dev,NULL ); +if (IS_ERR (data->codec_clk)) { +dev_err (dev, +"codec clock missing or invalid\n" ); + goto fail; + } + + ret =clk_prepare_enable (data->codec_clk); +if (ret) { +dev_err (data->dev,"unable to prepare codec clk\n" ); +return ret; + }
The CODEC driver should manage the clock for the CODEC, if it's mapped properly attempting to look it up using the card device should fail.