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 #4756

Open
wants to merge 13 commits into
base: topic/sof-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions sound/soc/codecs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1076,13 +1076,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 @@ -116,6 +116,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 @@ -505,6 +506,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
20 changes: 18 additions & 2 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 @@ -689,8 +690,13 @@ static void es8316_enable_jack_detect(struct snd_soc_component *component,
* guarantee that the bytchr-es8316 driver, which might set this
* property, will probe before us.
*/
es8316->jd_inverted = device_property_read_bool(component->dev,
"everest,jack-detect-inverted");

if (device_property_read_bool(component->dev,
"everest,jack-detect-inverted"))
es8316->jd_inverted = true;
if (device_property_read_bool(component->dev,
"everest,jack-detect-not-inverted"))
es8316->jd_inverted = false;

mutex_lock(&es8316->lock);

Expand Down Expand Up @@ -862,6 +868,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
17 changes: 15 additions & 2 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 @@ -907,8 +908,9 @@ static int es8326_probe(struct snd_soc_component *component)
int ret;

es8326->component = component;
es8326->jd_inverted = device_property_read_bool(component->dev,
"everest,jack-detect-inverted");
if (device_property_read_bool(component->dev,
"everest,jack-detect-inverted"))
es8326->jd_inverted = true;

ret = device_property_read_u8(component->dev, "everest,mic1-src", &es8326->mic1_src);
if (ret != 0) {
Expand Down Expand Up @@ -1020,13 +1022,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