Add es9356 focused SoundWire CODEC
Subsystems (3)
v2 cover Add es9356 focused SoundWire CODEC
This patch chain adds support for the ES9356 PC focused SoundWire CODEC.
v2 -> v1:
-Adjusted mutexes in the ES9356 driver -Use macros to replace certain values -Adjusted some ordering issues in Kconfig.
v1 -> v0:
-Modified snd_soc_dapm_add_routes in soc_sdw_es9356
Zhang Yi (6):
ASoC: sdw_utils: Add ES9356 support functions
ASoC: sdw_utils: add ES9356 in codec_info_list
ASoC: sdw_utils: add soc_sdw_es9356
ASoC: es9356-sdca: Add ES9356 SDCA driver
ASoC: Intel: soc-acpi: arl: Add es9356 support
ASoC: Intel: sof_sdw: add es9356 support
include/sound/soc_sdw_utils.h | 15 + sound/soc/codecs/Kconfig | 6 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/es9356.c | 1487 +++++++++++++++++ sound/soc/codecs/es9356.h | 228 +++ sound/soc/intel/boards/Kconfig | 1 + .../intel/common/soc-acpi-intel-arl-match.c | 52 + sound/soc/sdw_utils/Makefile | 1 + sound/soc/sdw_utils/soc_sdw_es9356.c | 275 +++ sound/soc/sdw_utils/soc_sdw_utils.c | 50 + 10 files changed, 2117 insertions(+) create mode 100644 sound/soc/codecs/es9356.c create mode 100644 sound/soc/codecs/es9356.h create mode 100644 sound/soc/sdw_utils/soc_sdw_es9356.c
Signature · 1 line
2.17.1
PATCH v2 1/6 ASoC: sdw_utils: Add ES9356 support functions
Add the functions into the machine driver for the es9356
--- include/sound/soc_sdw_utils.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
include/sound/soc_sdw_utils.h +15 -0
@@ -220,6 +220,18 @@ int asoc_sdw_cs42l43_spk_init(struct snd_soc_card *card,struct asoc_sdw_codec_info *info, bool playback); +/*es9356 codec support*/ +int asoc_sdw_es9356_init (struct snd_soc_card *card, +struct snd_soc_dai_link *dai_links, +struct asoc_sdw_codec_info *info, +bool playback); +int asoc_sdw_es9356_amp_init (struct snd_soc_card *card, +struct snd_soc_dai_link *dai_links, +struct asoc_sdw_codec_info *info, +bool playback); +int asoc_sdw_es9356_exit (struct snd_soc_card *card,struct snd_soc_dai_link *dai_link); +int asoc_sdw_es9356_amp_exit (struct snd_soc_card *card,struct snd_soc_dai_link *dai_link); +/* CS AMP support */ int asoc_sdw_bridge_cs35l56_count_sidecar (struct snd_soc_card *card,int *num_dais,int *num_devs);
@@ -269,5 +281,8 @@ int asoc_sdw_ti_amp_init(struct snd_soc_card *card,int asoc_sdw_ti_spk_rtd_init (struct snd_soc_pcm_runtime *rtd,struct snd_soc_dai *dai);int asoc_sdw_ti_amp_initial_settings (struct snd_soc_card *card,const char *name_prefix); +int asoc_sdw_es9356_rtd_init (struct snd_soc_pcm_runtime *rtd,struct snd_soc_dai *dai); +int asoc_sdw_es9356_spk_rtd_init (struct snd_soc_pcm_runtime *rtd,struct snd_soc_dai *dai); +int asoc_sdw_es9356_dmic_rtd_init (struct snd_soc_pcm_runtime *rtd,struct snd_soc_dai *dai);#endif
Signature · 1 line
2.17.1
PATCH v2 2/6 ASoC: sdw_utils: add ES9356 in codec_info_list
In reply to Zhang YiAdd ES9356 in codec_info_list
--- sound/soc/sdw_utils/soc_sdw_utils.c | 50 +++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
sound/soc/sdw_utils/soc_sdw_utils.c +50 -0
@@ -759,6 +759,56 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, .aux_num = 1, }, + { + .part_id = 0x9356, + .name_prefix = "es9356", + .version_id = 3, + .dais = { + { + .direction = {true, false}, + .dai_name = "es9356-sdp-aif1", + .dai_type = SOC_SDW_DAI_TYPE_JACK, + .dailink = {SOC_SDW_JACK_OUT_DAI_ID, SOC_SDW_UNUSED_DAI_ID}, + .init = asoc_sdw_es9356_init, + .exit = asoc_sdw_es9356_exit, + .rtd_init = asoc_sdw_es9356_rtd_init, + .controls = generic_jack_controls, + .num_controls = ARRAY_SIZE(generic_jack_controls), + .widgets = generic_jack_widgets, + .num_widgets = ARRAY_SIZE(generic_jack_widgets), + }, + { + .direction = {false, true}, + .dai_name = "es9356-sdp-aif4", + .dai_type = SOC_SDW_DAI_TYPE_MIC, + .dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_DMIC_DAI_ID}, + .rtd_init = asoc_sdw_es9356_dmic_rtd_init, + .widgets = generic_dmic_widgets, + .num_widgets = ARRAY_SIZE(generic_dmic_widgets), + }, + { + .direction = {false, true}, + .dai_name = "es9356-sdp-aif2", + .dai_type = SOC_SDW_DAI_TYPE_JACK, + .dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_JACK_IN_DAI_ID}, + }, + { + .direction = {true, false}, + .dai_name = "es9356-sdp-aif3", + .component_name = "es9356", + .dai_type = SOC_SDW_DAI_TYPE_AMP, + .dailink = {SOC_SDW_AMP_OUT_DAI_ID, SOC_SDW_UNUSED_DAI_ID}, + .init = asoc_sdw_es9356_amp_init, + .exit = asoc_sdw_es9356_amp_exit, + .rtd_init = asoc_sdw_es9356_spk_rtd_init, + .controls = generic_spk_controls, + .num_controls = ARRAY_SIZE(generic_spk_controls), + .widgets = generic_spk_widgets, + .num_widgets = ARRAY_SIZE(generic_spk_widgets), + }, + }, + .dai_num = 4, + }, { .part_id = 0xaaaa, /* generic codec mockup */ .name_prefix = "sdw_mockup_mmulti-function",
Signature · 1 line
2.17.1
PATCH v2 3/6 ASoC: sdw_utils: add soc_sdw_es9356
In reply to Zhang YiAdd a utility program for handling ES9356 in the universal machine driver
--- sound/soc/sdw_utils/Makefile | 1 + sound/soc/sdw_utils/soc_sdw_es9356.c | 275 +++++++++++++++++++++++++++ 2 files changed, 276 insertions(+) create mode 100644 sound/soc/sdw_utils/soc_sdw_es9356.c
sound/soc/sdw_utils/Makefile +1 -0
@@ -7,6 +7,7 @@ snd-soc-sdw-utils-y := soc_sdw_utils.o soc_sdw_dmic.o soc_sdw_rt_dmic.o \ soc_sdw_cs42l42.o soc_sdw_cs42l43.o \ soc_sdw_cs42l45.o \ soc_sdw_cs_amp.o \ + soc_sdw_es9356.o \ soc_sdw_maxim.o \ soc_sdw_ti_amp.o obj-$(CONFIG_SND_SOC_SDW_UTILS) += snd-soc-sdw-utils.o
sound/soc/sdw_utils/soc_sdw_es9356.c new file +275 -0
275 lines not on this page · raw message
Signature · 1 line
2.17.1
Pierre-Louis Bossart
reviewerRe: [PATCH v2 3/6] ASoC: sdw_utils: add soc_sdw_es9356
Quoted 27 lines · Zhang Yi
Add a utility program for handling ES9356 in the universal machine driver
Signed-off-by Zhang Yi <[email protected]>--- sound/soc/sdw_utils/Makefile | 1 + sound/soc/sdw_utils/soc_sdw_es9356.c | 275 +++++++++++++++++++++++++++ 2 files changed, 276 insertions(+) create mode 100644 sound/soc/sdw_utils/soc_sdw_es9356.csound/soc/sdw_utils/Makefile +1
-0@@ -7,6 +7,7 @@ snd-soc-sdw-utils-y := soc_sdw_utils.o soc_sdw_dmic.o soc_sdw_rt_dmic.o \ soc_sdw_cs42l42.o soc_sdw_cs42l43.o \ soc_sdw_cs42l45.o \ soc_sdw_cs_amp.o \ + soc_sdw_es9356.o \ soc_sdw_maxim.o \ soc_sdw_ti_amp.o obj-$(CONFIG_SND_SOC_SDW_UTILS) += snd-soc-sdw-utils.osound/soc/sdw_utils/soc_sdw_es9356.c new file +0
-0
sound/soc/sdw_utils/soc_sdw_es9356.c line 2
Quoted 2 lines
sound/soc/sdw_utils/soc_sdw_es9356.c new file +2
-0@@ -0,0 +1,275 @@ +// SPDX-License-Identifier: GPL-2.0-only +// Copyright (c) 2020 Intel Corporation
this doesn't seem right, and I mentioned it in the previous review...
Quoted 21 lines
sound/soc/sdw_utils/soc_sdw_es9356.c new file +21
-0+int asoc_sdw_es9356_amp_init (struct snd_soc_card *card, +struct snd_soc_dai_link *dai_links, +struct asoc_sdw_codec_info *info, +bool playback) +{ +struct asoc_sdw_mc_private *ctx =snd_soc_card_get_drvdata (card); +struct device *sdw_dev1, *sdw_dev2; +int ret; + +if (!playback) +return 0 ; + + info->amp_num++; + +if (info->amp_num ==2 ) { + sdw_dev1 =bus_find_device_by_name (&sdw_bus_type,NULL , dai_links->codecs[0 ].name); + +if (!sdw_dev1) +return -EPROBE_DEFER ; + + ret =es9356_add_codec_device_props (sdw_dev1, ctx->mc_quirk);
sound/soc/sdw_utils/soc_sdw_es9356.c line 246
Quoted 10 lines
sound/soc/sdw_utils/soc_sdw_es9356.c new file +10
-0+if (ret <0 ) { +put_device (sdw_dev1); +return ret; + } + ctx->amp_dev1 = sdw_dev1; + + sdw_dev2 =bus_find_device_by_name (&sdw_bus_type,NULL , dai_links->codecs[1 ].name); + +if (!sdw_dev2) +return -EPROBE_DEFER ;
that doesn't seem right, since you've already added stuff for sdw_dev1.
sound/soc/sdw_utils/soc_sdw_es9356.c line 250
Quoted 4 lines
sound/soc/sdw_utils/soc_sdw_es9356.c new file +4
-0+ + ret =es9356_add_codec_device_props (sdw_dev2, ctx->mc_quirk); +if (ret <0 ) { +put_device (sdw_dev2);
this error handling seems weird, shouldn't you also do a put_device(sdw_dev1) here?
maybe the right thing is to check that both sdw_dev1 and sdw_dev2 can be found. Then you can add properties for both.
I didn't find any other example of code where we deal with two sets of properties.
Quoted 7 lines
sound/soc/sdw_utils/soc_sdw_es9356.c new file +7
-0+return ret; + } + ctx->amp_dev2 = sdw_dev2; + } +return 0 ; +} +EXPORT_SYMBOL_NS (asoc_sdw_es9356_amp_init,"SND_SOC_SDW_UTILS" );
PATCH v2 4/6 ASoC: es9356-sdca: Add ES9356 SDCA driver
In reply to Zhang YiThis is the codec driver for es9356-sdca.
--- sound/soc/codecs/Kconfig | 6 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/es9356.c | 1487 +++++++++++++++++++++++++++++++++++++ sound/soc/codecs/es9356.h | 228 ++++++ 4 files changed, 1723 insertions(+) create mode 100644 sound/soc/codecs/es9356.c create mode 100644 sound/soc/codecs/es9356.h
sound/soc/codecs/Kconfig +6 -0
@@ -123,6 +123,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_ES8328_I2C imply SND_SOC_ES8375 imply SND_SOC_ES8389 + imply SND_SOC_ES9356 imply SND_SOC_ES7134 imply SND_SOC_ES7241 imply SND_SOC_FRAMER
@@ -1284,6 +1285,11 @@ config SND_SOC_ES8389 tristate "Everest Semi ES8389 CODEC" depends on I2C +config SND_SOC_ES9356 + tristate "Everest Semi ES9356 CODEC SDW" + depends on SOUNDWIRE + select REGMAP_SOUNDWIRE + config SND_SOC_FRAMER tristate "Framer codec" depends on GENERIC_FRAMER
sound/soc/codecs/Makefile +2 -0
@@ -138,6 +138,7 @@ snd-soc-es8328-i2c-y := es8328-i2c.o snd-soc-es8328-spi-y := es8328-spi.o snd-soc-es8375-y := es8375.o snd-soc-es8389-y := es8389.o +snd-soc-es9356-y := es9356.o snd-soc-framer-y := framer-codec.o snd-soc-fs-amp-lib-y := fs-amp-lib.o snd-soc-fs210x-y := fs210x.o
@@ -574,6 +575,7 @@ 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_ES8375) += snd-soc-es8375.o obj-$(CONFIG_SND_SOC_ES8389) += snd-soc-es8389.o +obj-$(CONFIG_SND_SOC_ES9356) += snd-soc-es9356.o obj-$(CONFIG_SND_SOC_FRAMER) += snd-soc-framer.o obj-$(CONFIG_SND_SOC_FS_AMP_LIB)+= snd-soc-fs-amp-lib.o obj-$(CONFIG_SND_SOC_FS210X) += snd-soc-fs210x.o
sound/soc/codecs/es9356.c new file +1487 -0
1,487 lines not on this page · raw message
sound/soc/codecs/es9356.h new file +228 -0
228 lines not on this page · raw message
Signature · 1 line
2.17.1
Pierre-Louis Bossart
reviewerRe: [PATCH v2 4/6] ASoC: es9356-sdca: Add ES9356 SDCA driver
Quoted 5 lines
sound/soc/codecs/es9356.c new file +5
-0+static void es9356_pde_transition_delay (struct es9356_sdw_priv *es9356,unsigned char func, +unsigned char entity,unsigned char ps) +{ +unsigned int delay =1000 , val; +
sound/soc/codecs/es9356.c line 314
Quoted 10 lines
sound/soc/codecs/es9356.c new file +10
-0+pm_runtime_mark_last_busy (&es9356->slave->dev); + +/* waiting for Actual PDE becomes to PS0/PS3 */ +while (delay) { +regmap_read (es9356->regmap, +SDW_SDCA_HCTL (func, entity,ES9356_SDCA_CTL_ACTUAL_POWER_STATE ,0 ), &val); +if (val == ps) +break ; + +usleep_range (1000 ,1500 );
this is a delay
sound/soc/codecs/es9356.c line 315
Quoted 1 line
sound/soc/codecs/es9356.c new file +1
-0+ delay--;
and this isn't a delay, it's a loop/iteration counter.
sound/soc/codecs/es9356.c line 318
Quoted 3 lines
sound/soc/codecs/es9356.c new file +3
-0+ } +if (!delay) { +dev_warn (&es9356->slave->dev,"%s PDE to %s is NOT ready" , __func__, ps?"PS3" :"PS0" );
it's a constant discussion on this list to figure out if dev_warn() is really useful. I don't think it is. You also have a number of dev_err() that will likely pollute the logs without giving the user much information. dev_dbg() is more useful for developers IMHO.
Quoted 17 lines
sound/soc/codecs/es9356.c new file +17
-0+static int es9356_sdw_pcm_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params, +struct snd_soc_dai *dai) +{ +struct snd_soc_component *component = dai->component; +struct es9356_sdw_priv *es9356 =snd_soc_component_get_drvdata (component); +struct sdw_stream_config stream_config = {0 }; +struct sdw_port_config port_config = {0 }; +struct sdw_stream_runtime *sdw_stream =snd_soc_dai_get_dma_data (dai, substream); +enum sdw_data_direction direction; +int ret, num_channels; +unsigned int rate; + +if (!sdw_stream) +return -EINVAL ; + +if (!es9356->slave)
sound/soc/codecs/es9356.c line 881
Quoted 10 lines
sound/soc/codecs/es9356.c new file +10
-0+return -EINVAL ; + +/* SoundWire specific configuration */ +snd_sdw_params_to_config (substream, params, &stream_config, &port_config); + +if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { + port_config.num = dai->id; + }else { + port_config.num = dai->id; + }
looks like a useless test to me if both branches do the same thing? Consider using a static checker for stuff like this...
Quoted 80 lines
(quoted diff) +79
-0+ + ret = sdw_stream_add_slave(es9356->slave, &stream_config, + &port_config, 1, sdw_stream); + if (ret) + dev_err(dai->dev, "Unable to configure port\n"); + + switch (params_rate(params)) { + case 16000: + rate = ES9356_SDCA_RATE_16000HZ; + break; + case 44100: + rate = ES9356_SDCA_RATE_44100HZ; + break; + case 48000: + rate = ES9356_SDCA_RATE_48000HZ; + break; + case 96000: + rate = ES9356_SDCA_RATE_96000HZ; + break; + default: + dev_err(component->dev, "%s: Rate %d is not supported\n", + __func__, params_rate(params)); + return -EINVAL; + } + + if (dai->id == ES9356_DMIC) + regmap_write(es9356->regmap, + SDW_SDCA_HCTL(FUNC_NUM_MIC, ES9356_SDCA_ENT_CS113, ES9356_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), rate); + if (dai->id == ES9356_AMP) + regmap_write(es9356->regmap, + SDW_SDCA_HCTL(FUNC_NUM_AMP, ES9356_SDCA_ENT_CS21, ES9356_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), rate); + if ((dai->id == ES9356_JACK_IN) | (dai->id == ES9356_JACK_OUT)) { + regmap_write(es9356->regmap, + SDW_SDCA_HCTL(FUNC_NUM_UAJ, ES9356_SDCA_ENT_CS41, ES9356_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), rate); + regmap_write(es9356->regmap, + SDW_SDCA_HCTL(FUNC_NUM_UAJ, ES9356_SDCA_ENT_CS36, ES9356_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), rate); + } + return ret; +} +static void es9356_register_init(struct es9356_sdw_priv *es9356) +{ + regmap_write(es9356->regmap, ES9356_STATE, 0x02); + regmap_write(es9356->regmap, ES9356_ENDPOINT_MODE, 0x24); + regmap_write(es9356->regmap, ES9356_PRE_DIV_CTL, 0x00); + regmap_write(es9356->regmap, ES9356_ADC_OSR, 0x18); + regmap_write(es9356->regmap, ES9356_ADC_OSRGAIN, 0x13); + regmap_write(es9356->regmap, ES9356_DAC_OSR, 0x16); + regmap_write(es9356->regmap, ES9356_CLK_CTL, 0x0f); + regmap_write(es9356->regmap, ES9356_CSM_RESET, 0x01); + regmap_write(es9356->regmap, ES9356_CLK_SEL, 0x30); + + regmap_write(es9356->regmap, ES9356_DETCLK_CTL, 0x51); + regmap_write(es9356->regmap, ES9356_HP_TYPE, 0x10); + regmap_write(es9356->regmap, ES9356_MICBIAS_CTL, 0x10); + regmap_write(es9356->regmap, ES9356_HPDETECT_CTL, 0x07); + regmap_write(es9356->regmap, ES9356_ADC_ANA, 0x30); + regmap_write(es9356->regmap, ES9356_PGA_CTL, 0xa8); + regmap_write(es9356->regmap, ES9356_ADC_INT, 0xaa); + regmap_write(es9356->regmap, ES9356_ADC_LP, 0x19); + regmap_write(es9356->regmap, ES9356_VMID1SEL, 0xbc); + regmap_write(es9356->regmap, ES9356_VMID_TIME, 0x0b); + regmap_write(es9356->regmap, ES9356_STATE_TIME, 0xbb); + regmap_write(es9356->regmap, ES9356_HP_SPK_TIME, 0x77); + regmap_write(es9356->regmap, ES9356_HP_DETECTTIME, 0xa4); + regmap_write(es9356->regmap, ES9356_MICBIAS_SEL, 0x15); + regmap_write(es9356->regmap, ES9356_KEY_PRESS_TIME, 0xff); + regmap_write(es9356->regmap, ES9356_KEY_RELEASE_TIME, 0xff); + regmap_write(es9356->regmap, ES9356_KEY_HOLD_TIME, 0x0f); + regmap_write(es9356->regmap, ES9356_BTSEL_REF, 0x00); + regmap_write(es9356->regmap, ES9356_KEYD_DETECT, 0x18); + regmap_write(es9356->regmap, ES9356_MICBIAS_RES, 0x03); + regmap_write(es9356->regmap, ES9356_BUTTON_CHARGE, 0x00); + regmap_write(es9356->regmap, ES9356_CALIBRATION_TIME, 0x13); + regmap_write(es9356->regmap, ES9356_CALIBRATION_SETTING, 0xf4); + + regmap_write(es9356->regmap, ES9356_SPK_VOLUME, 0x33); + regmap_write(es9356->regmap, ES9356_DAC_VROI, 0x01); + regmap_write(es9356->regmap, ES9356_DAC_LP, 0x00); + regmap_write(es9356->regmap, ES9356_HP_IBIAS, 0x04);
Review
Quoted 10 lines
(quoted diff) +10
-0+ regmap_write(es9356->regmap, ES9356_HP_LP, 0x03); + regmap_write(es9356->regmap, ES9356_SPKLDO_CTL, 0x65); + regmap_write(es9356->regmap, ES9356_SPKBIAS_COMP, 0x09); + regmap_write(es9356->regmap, ES9356_VMID1STL, 0x00); + regmap_write(es9356->regmap, ES9356_VMID2STL, 0x00); + regmap_write(es9356->regmap, ES9356_VSEL, 0xfc); + + regmap_write(es9356->regmap, ES9356_IBIASGEN, 0x10); + regmap_write(es9356->regmap, ES9356_ADC_AMIC_CTL, 0x0d); + regmap_write(es9356->regmap, SDW_SCP_BUS_CLOCK_BASE, 0x01);
this is wrong, all standard codec registers should be handled by the core, not by the codec driver with regmap. please remove this regmap definition
Mark Brown
maintainerRe: [PATCH v2 4/6] ASoC: es9356-sdca: Add ES9356 SDCA driver
In reply to Zhang Yisound/soc/codecs/es9356.c line 118
Quoted 9 lines · Zhang Yi
sound/soc/codecs/es9356.c new file +8
-0+static int es9356_sdca_set_gain_get (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol) +{ + ret =pm_runtime_get_sync (&es9356->slave->dev); +if (ret <0 && ret != -EACCES ) { +dev_info (&es9356->slave->dev,"%s:Failed to enable clock : %d\n" , __func__, ret); +return ret; + }
pm_runtime_get_sync() very helpfully leaves the usage count for the device incremented even on error so this leaks :/
sound/soc/codecs/es9356.c line 275
Quoted 8 lines
sound/soc/codecs/es9356.c new file +7
-0+static int es9356_sdca_set_volume_put (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol) +{ +SOC_SINGLE_EXT_TLV ("FU11 Capture Gain" , +SDW_SDCA_CTL (FUNC_NUM_MIC ,ES9356_SDCA_ENT_FU11 , +ES9356_SDCA_CTL_FU_CH_GAIN ,0 ),0 ,0x03 ,0 , + es9356_sdca_set_gain_get, es9356_sdca_set_gain_put, dmic_gain_tlv),
This should be a Volume control too.
sound/soc/codecs/es9356.c line 819
Quoted 13 lines
sound/soc/codecs/es9356.c new file +13
-0+static void es9356_button_detect_handler (struct work_struct *work) +{ +struct es9356_sdw_priv *es9356 = + container_of(work, struct es9356_sdw_priv, button_detect_work.work); +unsigned int reg, offset; +int ret, idx, btn_type =0 ; +unsigned int button[3 ]; + +regmap_read (es9356->regmap, +SDW_SDCA_CTL (FUNC_NUM_UAJ ,ES9356_SDCA_ENT_GE35 ,ES9356_SDCA_CTL_DETECTED_MODE ,0 ), ®); + +if (ret <0 ) + goto io_error;
ret is an uninitialised value here, you need to assign the return value of regmap_read().
sound/soc/codecs/es9356.c line 838
Quoted 5 lines
sound/soc/codecs/es9356.c new file +5
-0+snd_soc_jack_report (es9356->hs_jack, btn_type, +SND_JACK_HEADSET | +SND_JACK_BTN_0 |SND_JACK_BTN_1 | +SND_JACK_BTN_2 |SND_JACK_BTN_3 | +SND_JACK_BTN_4 |SND_JACK_BTN_5 );
This reports SND_JACK_HEADSET but we didn't actually look at the headset state in this function AFAICT, only the btn_type (and that'll be 0 when reporting a button release), so we'll misreport the headset state.
sound/soc/codecs/es9356.c line 1019
Quoted 9 lines
sound/soc/codecs/es9356.c new file +9
-0+static const struct regmap_config es9356_sdca_regmap = { + .reg_bits =32 , + .val_bits =8 , + .volatile_reg = es9356_sdca_volatile_register, + .max_register =0x45ffffff , + .cache_type =REGCACHE_RBTREE , + .use_single_read = true, + .use_single_write = true, +};
You should use REGCACHE_MAPLE unless you've got a specific reason to use something else.
sound/soc/codecs/es9356.c line 1107
Quoted 8 lines
sound/soc/codecs/es9356.c new file +8
-0+regmap_write (es9356->regmap, +SDW_SDCA_CTL_MBQ (FUNC_NUM_AMP ,ES9356_SDCA_ENT_FU21 ,ES9356_SDCA_CTL_FU_VOLUME ,CH_L ),0x00 ); +regmap_write (es9356->regmap, +SDW_SDCA_CTL (FUNC_NUM_AMP ,ES9356_SDCA_ENT_FU21 ,ES9356_SDCA_CTL_FU_VOLUME ,CH_L ),0x00 ); +regmap_write (es9356->regmap, +SDW_SDCA_CTL_MBQ (FUNC_NUM_AMP ,ES9356_SDCA_ENT_FU21 ,ES9356_SDCA_CTL_FU_VOLUME ,CH_R ),0x00 ); +regmap_write (es9356->regmap, +SDW_SDCA_CTL (FUNC_NUM_AMP ,ES9356_SDCA_ENT_FU21 ,ES9356_SDCA_CTL_FU_VOLUME ,CH_R ),0x00 );
You should generally leave user visible controls like volumes at the chip default.
PATCH v2 5/6 ASoC: Intel: soc-acpi: arl: Add es9356 support
In reply to Zhang YiAdd support for the es9356 codec in the ARL board configuration.
--- .../intel/common/soc-acpi-intel-arl-match.c | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+)
sound/soc/intel/common/soc-acpi-intel-arl-match.c +52 -0
@@ -192,6 +192,42 @@ static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = { }, }; +static const struct snd_soc_acpi_endpoint es9356_endpoints[] = { + {/* Jack Playback Endpoint */ + .num =0 , + .aggregated =0 , + .group_position =0 , + .group_id =0 , + }, + {/* DMIC Capture Endpoint */ + .num =1 , + .aggregated =0 , + .group_position =0 , + .group_id =0 , + }, + {/* Jack Capture Endpoint */ + .num =2 , + .aggregated =0 , + .group_position =0 , + .group_id =0 , + }, + {/* Speaker Playback Endpoint */ + .num =3 , + .aggregated =0 , + .group_position =0 , + .group_id =0 , + }, +}; + +static const struct snd_soc_acpi_adr_device es9356_adr[] = { + { + .adr =0x00013004b3935601ull , + .num_endpoints =ARRAY_SIZE (es9356_endpoints), + .endpoints = es9356_endpoints, + .name_prefix ="es9356" + } +}; +static const struct snd_soc_acpi_adr_device cs42l43_0_adr[] = { { .adr =0x00003001FA424301ull ,
@@ -255,6 +291,15 @@ static const struct snd_soc_acpi_adr_device rt1320_2_single_adr[] = { } }; +static const struct snd_soc_acpi_link_adr arl_n_mrd_es9356_link0[] = { + { + .mask =BIT (1 ), + .num_adr =ARRAY_SIZE (es9356_adr), + .adr_d = es9356_adr, + }, + {} +}; +static const struct snd_soc_acpi_link_adr arl_cs42l43_l0[] = { { .mask =BIT (0 ),
@@ -528,6 +573,13 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_arl_sdw_machines[] = { .sof_tplg_filename = "sof-arl-rt722-l0_rt1320-l2.tplg", .get_function_tplg_files = sof_sdw_get_tplg_files, }, + { + .link_mask = BIT(1), + .links = arl_n_mrd_es9356_link0, + .drv_name = "sof_sdw", + .sof_tplg_filename = "sof-arl-es9356.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, + }, {}, };EXPORT_SYMBOL_GPL (snd_soc_acpi_intel_arl_sdw_machines);
Signature · 1 line
2.17.1
PATCH v2 6/6 ASoC: Intel: sof_sdw: add es9356 support
In reply to Zhang Yiadd Everest-semi ES9356 support
--- sound/soc/intel/boards/Kconfig | 1 + 1 file changed, 1 insertion(+)
sound/soc/intel/boards/Kconfig +1 -0
@@ -534,6 +534,7 @@ config SND_SOC_INTEL_SOUNDWIRE_SOF_MACH select SPI_CS42L43 select SND_SOC_CS35L56_SPI select SND_SOC_CS35L56_SDW + select SND_SOC_ES9356 select SND_SOC_DMIC select SND_SOC_INTEL_HDA_DSP_COMMON imply SND_SOC_SDW_MOCKUP
Signature · 1 line
2.17.1
Mark Brown
maintainerQuoted 9 lines · Zhang Yi
This patch chain adds support for the ES9356 PC focused SoundWire CODEC.
v2 -> v1:
-Adjusted mutexes in the ES9356 driver -Use macros to replace certain values -Adjusted some ordering issues inKconfig.[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/6] ASoC: sdw_utils: Add ES9356 support functions
(no commit info)
[2/6] ASoC: sdw_utils: add ES9356 in codec_info_list
https://git.kernel.org/broonie/misc/c/4ff4fc6fea57 [3/6] ASoC: sdw_utils: add soc_sdw_es9356 https://git.kernel.org/broonie/misc/c/5d03a4f35710 [4/6] ASoC: es9356-sdca: Add ES9356 SDCA driver https://git.kernel.org/broonie/misc/c/5d9cb740cd38 [5/6] ASoC: Intel: soc-acpi: arl: Add es9356 support https://git.kernel.org/broonie/misc/c/25b905940832 [6/6] ASoC: Intel: sof_sdw: add es9356 support https://git.kernel.org/broonie/misc/c/f1e35606d618
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark