Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve quirks detection for es8336 #4112

Closed
wants to merge 10 commits into from
5 changes: 5 additions & 0 deletions sound/soc/codecs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -925,13 +925,18 @@ config SND_SOC_ES7134
config SND_SOC_ES7241
tristate "Everest Semi ES7241 CODEC"

config SND_SOC_ES83XX_DSM_COMMON
tristate

config SND_SOC_ES8316
tristate "Everest Semi ES8316 CODEC"
depends on I2C
select SND_SOC_ES83XX_DSM_COMMON if ACPI

config SND_SOC_ES8326
tristate "Everest Semi ES8326 CODEC"
depends on I2C
select SND_SOC_ES83XX_DSM_COMMON if ACPI

config SND_SOC_ES8328
tristate
Expand Down
2 changes: 2 additions & 0 deletions sound/soc/codecs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ snd-soc-da9055-objs := da9055.o
snd-soc-dmic-objs := dmic.o
snd-soc-es7134-objs := es7134.o
snd-soc-es7241-objs := es7241.o
snd-soc-es83xx-dsm-common-objs := es83xx-dsm-common.o
snd-soc-es8316-objs := es8316.o
snd-soc-es8326-objs := es8326.o
snd-soc-es8328-objs := es8328.o
Expand Down Expand Up @@ -462,6 +463,7 @@ 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_ES7241) += snd-soc-es7241.o
obj-$(CONFIG_SND_SOC_ES83XX_DSM_COMMON) += snd-soc-es83xx-dsm-common.o
obj-$(CONFIG_SND_SOC_ES8316) += snd-soc-es8316.o
obj-$(CONFIG_SND_SOC_ES8326) += snd-soc-es8326.o
obj-$(CONFIG_SND_SOC_ES8328) += snd-soc-es8328.o
Expand Down
11 changes: 11 additions & 0 deletions sound/soc/codecs/es8316.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <sound/tlv.h>
#include <sound/jack.h>
#include "es8316.h"
#include "es83xx-dsm-common.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
Expand Down Expand Up @@ -833,6 +834,16 @@ static int es8316_i2c_probe(struct i2c_client *i2c_client)
if (es8316 == NULL)
return -ENOMEM;

es83xx_dsm_dump(dev);

/* read jack information from _DSM */
ret = es83xx_dsm_jack_inverted(dev);
if (ret < 0)
dev_warn(dev, "%s: Could not get jack detection information with ACPI _DSM method\n",
__func__);
else
es8316->jd_inverted = ret;

i2c_set_clientdata(i2c_client, es8316);

es8316->regmap = devm_regmap_init_i2c(i2c_client, &es8316_regmap);
Expand Down
12 changes: 12 additions & 0 deletions sound/soc/codecs/es8326.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <sound/soc-dapm.h>
#include <sound/tlv.h>
#include "es8326.h"
#include "es83xx-dsm-common.h"

struct es8326_priv {
struct clk *mclk;
Expand Down Expand Up @@ -816,13 +817,24 @@ static const struct snd_soc_component_driver soc_component_dev_es8326 = {

static int es8326_i2c_probe(struct i2c_client *i2c)
{
struct device *dev = &i2c->dev;
struct es8326_priv *es8326;
int ret;

es8326 = devm_kzalloc(&i2c->dev, sizeof(struct es8326_priv), GFP_KERNEL);
if (!es8326)
return -ENOMEM;

es83xx_dsm_dump(dev);

/* read jack information from _DSM */
ret = es83xx_dsm_jack_inverted(dev);
if (ret < 0)
dev_warn(dev, "%s: Could not get jack detection information with ACPI _DSM method\n",
__func__);
else
es8326->jd_inverted = ret;

i2c_set_clientdata(i2c, es8326);
es8326->i2c = i2c;
mutex_init(&es8326->lock);
Expand Down
Loading