Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 567e4f9

Browse files
Sean Crossbroonie
authored andcommitted
ASoC: add es8328 codec driver
Add a codec driver for the Everest ES8328. It supports two separate audio outputs and two separate audio inputs. Signed-off-by: Sean Cross <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent d4f7fac commit 567e4f9

File tree

7 files changed

+1236
-0
lines changed

7 files changed

+1236
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Everest ES8328 audio CODEC
2+
3+
This device supports both I2C and SPI.
4+
5+
Required properties:
6+
7+
- compatible : "everest,es8328"
8+
- DVDD-supply : Regulator providing digital core supply voltage 1.8 - 3.6V
9+
- AVDD-supply : Regulator providing analog supply voltage 3.3V
10+
- PVDD-supply : Regulator providing digital IO supply voltage 1.8 - 3.6V
11+
- IPVDD-supply : Regulator providing analog output voltage 3.3V
12+
- clocks : A 22.5792 or 11.2896 MHz clock
13+
- reg : the I2C address of the device for I2C, the chip select number for SPI
14+
15+
Pins on the device (for linking into audio routes):
16+
17+
* LOUT1
18+
* LOUT2
19+
* ROUT1
20+
* ROUT2
21+
* LINPUT1
22+
* RINPUT1
23+
* LINPUT2
24+
* RINPUT2
25+
* Mic Bias
26+
27+
28+
Example:
29+
30+
codec: es8328@11 {
31+
compatible = "everest,es8328";
32+
DVDD-supply = <&reg_3p3v>;
33+
AVDD-supply = <&reg_3p3v>;
34+
PVDD-supply = <&reg_3p3v>;
35+
HPVDD-supply = <&reg_3p3v>;
36+
clocks = <&clks 169>;
37+
reg = <0x11>;
38+
};

sound/soc/codecs/Kconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ config SND_SOC_ALL_CODECS
5757
select SND_SOC_DA732X if I2C
5858
select SND_SOC_DA9055 if I2C
5959
select SND_SOC_BT_SCO
60+
select SND_SOC_ES8328_SPI if SPI_MASTER
61+
select SND_SOC_ES8328_I2C if I2C
6062
select SND_SOC_ISABELLE if I2C
6163
select SND_SOC_JZ4740_CODEC
6264
select SND_SOC_LM4857 if I2C
@@ -405,6 +407,17 @@ config SND_SOC_DMIC
405407
config SND_SOC_HDMI_CODEC
406408
tristate "HDMI stub CODEC"
407409

410+
config SND_SOC_ES8328
411+
tristate "Everest Semi ES8328 CODEC"
412+
413+
config SND_SOC_ES8328_I2C
414+
tristate
415+
select SND_SOC_ES8328
416+
417+
config SND_SOC_ES8328_SPI
418+
tristate
419+
select SND_SOC_ES8328
420+
408421
config SND_SOC_ISABELLE
409422
tristate
410423

sound/soc/codecs/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ snd-soc-da732x-objs := da732x.o
4949
snd-soc-da9055-objs := da9055.o
5050
snd-soc-bt-sco-objs := bt-sco.o
5151
snd-soc-dmic-objs := dmic.o
52+
snd-soc-es8328-objs := es8328.o
53+
snd-soc-es8328-i2c-objs := es8328-i2c.o
54+
snd-soc-es8328-spi-objs := es8328-spi.o
5255
snd-soc-isabelle-objs := isabelle.o
5356
snd-soc-jz4740-codec-objs := jz4740.o
5457
snd-soc-l3-objs := l3.o
@@ -220,6 +223,9 @@ obj-$(CONFIG_SND_SOC_DA732X) += snd-soc-da732x.o
220223
obj-$(CONFIG_SND_SOC_DA9055) += snd-soc-da9055.o
221224
obj-$(CONFIG_SND_SOC_BT_SCO) += snd-soc-bt-sco.o
222225
obj-$(CONFIG_SND_SOC_DMIC) += snd-soc-dmic.o
226+
obj-$(CONFIG_SND_SOC_ES8328) += snd-soc-es8328.o
227+
obj-$(CONFIG_SND_SOC_ES8328_I2C)+= snd-soc-es8328-i2c.o
228+
obj-$(CONFIG_SND_SOC_ES8328_SPI)+= snd-soc-es8328-spi.o
223229
obj-$(CONFIG_SND_SOC_ISABELLE) += snd-soc-isabelle.o
224230
obj-$(CONFIG_SND_SOC_JZ4740_CODEC) += snd-soc-jz4740-codec.o
225231
obj-$(CONFIG_SND_SOC_L3) += snd-soc-l3.o

sound/soc/codecs/es8328-i2c.c

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* es8328-i2c.c -- ES8328 ALSA SoC I2C Audio driver
3+
*
4+
* Copyright 2014 Sutajio Ko-Usagi PTE LTD
5+
*
6+
* Author: Sean Cross <[email protected]>
7+
*
8+
* This program is free software; you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License version 2 as
10+
* published by the Free Software Foundation.
11+
*/
12+
13+
#include <linux/module.h>
14+
#include <linux/i2c.h>
15+
#include <linux/regmap.h>
16+
17+
#include <sound/soc.h>
18+
19+
#include "es8328.h"
20+
21+
static const struct i2c_device_id es8328_id[] = {
22+
{ "everest,es8328", 0 },
23+
{ }
24+
};
25+
MODULE_DEVICE_TABLE(i2c, es8328_id);
26+
27+
static const struct of_device_id es8328_of_match[] = {
28+
{ .compatible = "everest,es8328", },
29+
{ }
30+
};
31+
MODULE_DEVICE_TABLE(of, es8328_of_match);
32+
33+
static int es8328_i2c_probe(struct i2c_client *i2c,
34+
const struct i2c_device_id *id)
35+
{
36+
return es8328_probe(&i2c->dev,
37+
devm_regmap_init_i2c(i2c, &es8328_regmap_config));
38+
}
39+
40+
static int es8328_i2c_remove(struct i2c_client *i2c)
41+
{
42+
snd_soc_unregister_codec(&i2c->dev);
43+
return 0;
44+
}
45+
46+
static struct i2c_driver es8328_i2c_driver = {
47+
.driver = {
48+
.name = "es8328",
49+
.of_match_table = es8328_of_match,
50+
},
51+
.probe = es8328_i2c_probe,
52+
.remove = es8328_i2c_remove,
53+
.id_table = es8328_id,
54+
};
55+
56+
module_i2c_driver(es8328_i2c_driver);
57+
58+
MODULE_DESCRIPTION("ASoC ES8328 audio CODEC I2C driver");
59+
MODULE_AUTHOR("Sean Cross <[email protected]>");
60+
MODULE_LICENSE("GPL");

sound/soc/codecs/es8328-spi.c

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* es8328.c -- ES8328 ALSA SoC SPI Audio driver
3+
*
4+
* Copyright 2014 Sutajio Ko-Usagi PTE LTD
5+
*
6+
* Author: Sean Cross <[email protected]>
7+
*
8+
* This program is free software; you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License version 2 as
10+
* published by the Free Software Foundation.
11+
*/
12+
13+
#include <linux/module.h>
14+
#include <linux/regmap.h>
15+
#include <linux/spi/spi.h>
16+
#include <sound/soc.h>
17+
#include "es8328.h"
18+
19+
static const struct of_device_id es8328_of_match[] = {
20+
{ .compatible = "everest,es8328", },
21+
{ }
22+
};
23+
MODULE_DEVICE_TABLE(of, es8328_of_match);
24+
25+
static int es8328_spi_probe(struct spi_device *spi)
26+
{
27+
return es8328_probe(&spi->dev,
28+
devm_regmap_init_spi(spi, &es8328_regmap_config));
29+
}
30+
31+
static int es8328_spi_remove(struct spi_device *spi)
32+
{
33+
snd_soc_unregister_codec(&spi->dev);
34+
return 0;
35+
}
36+
37+
static struct spi_driver es8328_spi_driver = {
38+
.driver = {
39+
.name = "es8328",
40+
.of_match_table = es8328_of_match,
41+
},
42+
.probe = es8328_spi_probe,
43+
.remove = es8328_spi_remove,
44+
};
45+
46+
module_spi_driver(es8328_spi_driver);
47+
MODULE_DESCRIPTION("ASoC ES8328 audio CODEC SPI driver");
48+
MODULE_AUTHOR("Sean Cross <[email protected]>");
49+
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)