summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/es8316.c
AgeCommit message (Collapse)Author
2024-05-03ASoC: codecs: Drop explicit initialization of struct ↵Uwe Kleine-König
i2c_device_id::driver_data to 0 These drivers don't use the driver_data member of struct i2c_device_id, so don't explicitly initialize this member. This prepares putting driver_data in an anonymous union which requires either no initialization or named designators. But it's also a nice cleanup on its own. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20240502074722.1103986-2-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-11ASoC: es8316: Enable support for MCLK div by 2Marian Postevca
To properly support a line of Huawei laptops with an AMD CPU and an ES8336 codec connected to the ACP3X module, we need to enable the codec option to divide the MCLK by 2. This is needed because for at least one SKU that has a 48Mhz MCLK the sound is distorted unless the MCLK div by 2 option is enabled. The option to divide the MCLK will first be tried. If no suitable clocking can be generated from this frequency, then the normal non-halved MCLK frequency will be tried. Signed-off-by: Marian Postevca <posteuca@mutex.one> Link: https://lore.kernel.org/r/20230829220116.1159-4-posteuca@mutex.one Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-11ASoC: es8316: Replace NR_SUPPORTED_MCLK_LRCK_RATIOS with ARRAY_SIZE()Marian Postevca
No need for a special define since we can use ARRAY_SIZE() directly, and won't need to worry to keep it in sync. Signed-off-by: Marian Postevca <posteuca@mutex.one> Link: https://lore.kernel.org/r/20230829220116.1159-3-posteuca@mutex.one Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-11ASoC: es8316: Enable support for S32 LE formatMarian Postevca
This CODEC does support the S32 LE format in es8316_pcm_hw_params(), but doesn't have it enabled in ES8316_FORMATS. Enable it so that we have more options to match with components. Signed-off-by: Marian Postevca <posteuca@mutex.one> Link: https://lore.kernel.org/r/20230829220116.1159-2-posteuca@mutex.one Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-24Merge branch 'for-linus' into for-nextTakashi Iwai
Back-merge the 6.5-devel branch for the clean patch application for 6.6 and resolving merge conflicts. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-25ASoc: codecs: ES8316: Fix DMIC configEdgar
According to the datasheet, the DMIC config should be changed to { 0, 2 ,3 } Signed-off-by: Edgar <ljijcj@163.com> Link: https://lore.kernel.org/r/20230719054722.401954-1-ljijcj@163.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-09ASoC: codecs: es8316: Add support for S24_3LE formatCezary Rojewski
Codec supports words that are 16/18/20/24/32 bits long. In case of 24, it should be treated as 24/24 not 24/32 i.e.: 24 valid bit-depth in 24 bit-depth container. For compatibility reasons, S24_LE is left as is. Cc: Zhu Ning <zhuning@everest-semi.com> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20230629112449.1755928-3-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-09ASoC: codecs: es8316: Add support for 24 MHz MCLKCezary Rojewski
MCLK operates on 24MHz on Intel KabyLake-based platforms. To support that frequency add new MCLK-LRCK ratio. While at it, utilize ARRAY_SIZE rather than hardcode to improve robustness. Cc: Zhu Ning <zhuning@everest-semi.com> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20230629112449.1755928-2-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-06-19ASoC: es8316: Use maple tree register cacheMark Brown
The es8316 can only support single register read and write operations so does not benefit from block writes. This means it gets no benefit from using the rbtree register cache over the maple tree register cache so convert it to use maple trees instead, it is more modern. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20230609-asoc-es-maple-v1-1-45ada77f5643@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-05-30ES8316 audio codec fixes on Rock5BMark Brown
Merge series from Cristian Ciocaltea <cristian.ciocaltea@collabora.com>: This patch series handles a few issues related to the ES8316 audio codec, discovered while doing some testing on the Rock 5B board.
2023-05-30ASoC: es8316: Do not set rate constraints for unsupported MCLKsCristian Ciocaltea
When using the codec through the generic audio graph card, there are at least two calls of es8316_set_dai_sysclk(), with the effect of limiting the allowed sample rates according to the MCLK/LRCK ratios supported by the codec: 1. During audio card setup, to set the initial MCLK - see asoc_simple_init_dai(). 2. Before opening a stream, to update MCLK, according to the stream sample rate and the multiplication factor - see asoc_simple_hw_params(). In some cases the initial MCLK might be set to a frequency that doesn't match any of the supported ratios, e.g. 12287999 instead of 12288000, which is only 1 Hz below the supported clock, as that is what the hardware reports. This creates an empty list of rate constraints, which is further passed to snd_pcm_hw_constraint_list() via es8316_pcm_startup(), and causes the following error on the very first access of the sound card: $ speaker-test -D hw:Analog,0 -F S16_LE -c 2 -t wav Broken configuration for playback: no configurations available: Invalid argument Setting of hwparams failed: Invalid argument Note that all subsequent retries succeed thanks to the updated MCLK set at point 2 above, which uses a computed frequency value instead of a reading from the hardware registers. Normally this would have mitigated the issue, but es8316_pcm_startup() executes before the 2nd call to es8316_set_dai_sysclk(), hence it cannot make use of the updated constraints. Since es8316_pcm_hw_params() performs anyway a final validation of MCLK against the stream sample rate and the supported MCLK/LRCK ratios, fix the issue by ensuring that sysclk_constraints list is only set when at least one supported sample rate is autodetected by the codec. Fixes: b8b88b70875a ("ASoC: add es8316 codec driver") Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Link: https://lore.kernel.org/r/20230530181140.483936-3-cristian.ciocaltea@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-05-30ASoC: es8316: Increment max value for ALC Capture Target Volume controlCristian Ciocaltea
The following error occurs when trying to restore a previously saved ALSA mixer state (tested on a Rock 5B board): $ alsactl --no-ucm -f /tmp/asound.state store hw:Analog $ alsactl --no-ucm -I -f /tmp/asound.state restore hw:Analog alsactl: set_control:1475: Cannot write control '2:0:0:ALC Capture Target Volume:0' : Invalid argument According to ES8316 datasheet, the register at address 0x2B, which is related to the above mixer control, contains by default the value 0xB0. Considering the corresponding ALC target bits (ALCLVL) are 7:4, the control is initialized with 11, which is one step above the maximum value allowed by the driver: ALCLVL | dB gain -------+-------- 0000 | -16.5 0001 | -15.0 0010 | -13.5 .... | ..... 0111 | -6.0 1000 | -4.5 1001 | -3.0 1010 | -1.5 .... | ..... 1111 | -1.5 The tests performed using the VU meter feature (--vumeter=TYPE) of arecord/aplay confirm the specs are correct and there is no measured gain if the 1011-1111 range would have been mapped to 0 dB: dB gain | VU meter % --------+----------- -6.0 | 30-31 -4.5 | 35-36 -3.0 | 42-43 -1.5 | 50-51 0.0 | 50-51 Increment the max value allowed for ALC Capture Target Volume control, so that it matches the hardware default. Additionally, update the related TLV to prevent an artificial extension of the dB gain range. Fixes: b8b88b70875a ("ASoC: add es8316 codec driver") Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Link: https://lore.kernel.org/r/20230530181140.483936-2-cristian.ciocaltea@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-05-08ASoC: Switch i2c drivers back to use .probe()Uwe Kleine-König
After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new() call-back type"), all drivers being converted to .probe_new() and then 03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert back to (the new) .probe() to be able to eventually drop .probe_new() from struct i2c_driver. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de Link: https://lore.kernel.org/r/20230425095716.331419-1-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org
2023-04-20ASoC: es8316: Don't use ranges based register lookup for a single registerMark Brown
The es8316 driver uses a register range to specify the single volatile register it has. While the cost will be in the noise this is a bunch of overhead compared to just having a volatile_reg() callback so switch to the callback. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20230419-asoc-es8316-volatile-v1-1-2074ec93d8f1@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-28ASoC: es8316: Handle optional IRQ assignmentCristian Ciocaltea
The driver is able to work fine without relying on a mandatory interrupt being assigned to the I2C device. This is only needed when making use of the jack-detect support. However, the following warning message is always emitted when there is no such interrupt available: es8316 0-0011: Failed to get IRQ 0: -22 Do not attempt to request an IRQ if it is not available/valid. This also ensures the rather misleading message is not displayed anymore. Also note the IRQ validation relies on commit dab472eb931bc291 ("i2c / ACPI: Use 0 to indicate that device does not have interrupt assigned"). Fixes: 822257661031 ("ASoC: es8316: Add jack-detect support") Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20230328094901.50763-1-cristian.ciocaltea@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-03Merge tag 'asoc-v6.1' of ↵Takashi Iwai
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus ASoC: Updates for v6.1 This has been a very quiet release for the core but quite a busy one for drivers with a big crop of new drivers and lots of feature additions and fixes to existing ones: - A new string helper parse_int_array_user(). - Improvements to the SOF IPC4 code, especially around trace. - Support for AMD Rembrant DSPs, AMD Pink Sardine ACP 6.2, Apple Silcon systems, Everest ES8326, Intel Sky Lake and Kaby Lake, MediaTek MT8186 support, NXP i.MX8ULP DSPs, Qualcomm SC8280XP, SM8250 and SM8450 and Texas Instruments SRC4392 There is a conflict with the conversion of I2C remove functions to void in the cs42l42 driver which is fairly straightforward to resolve but should be highlighted to Linus.
2022-09-22ASoC: es8316: fix register sync error in suspend/resume testsPierre-Louis Bossart
The SOF CI tests report failures with the following error thrown kernel: es8316 i2c-ESSX8336:00: Unable to sync registers 0x0-0x1. -121 ES8336 only supports I2C read/write one byte a time, so we do need to set the .use_single_read and .use_single_write flags to avoid this sync issue. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: FRED OH <fred.oh@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20220922095912.27010-1-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-08-25ASoC: codecs: add suspend and resume for ES8316Zhu Ning
The registers may be lost after suspend due to powerdown. regcache_sync solves this issue. Signed-off-by: Zhu Ning <zhuning@everest-semi.com> Link: https://lore.kernel.org/r/20220825014952.1038508-1-zhuning0077@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-07-04ASoC: codes: Add support for ES8316 producer modeZhu Ning
The AMD acp-es8336 machine driver requires ES8316 run in producer mode, which is not supported previously. Signed-off-by: David Yang <yangxiaohua@everest-semi.com> Signed-off-by: Zhu Ning <zhuning0077@gmail.com> Link: https://lore.kernel.org/r/20220704012416.3165-1-zhuning0077@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-27ASoC: es*: Remove now redundant non_legacy_dai_naming flagCharles Keepax
The ASoC core has now been changed to default to the non-legacy DAI naming, as such drivers using the new scheme no longer need to specify the non_legacy_dai_naming flag. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220623125250.2355471-52-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-04-11ASoC: es83*: use simple i2c probe functionStephen Kitt
The i2c probe functions here don't use the id information provided in their second argument, so the single-parameter i2c probe function ("probe_new") can be used instead. This avoids scanning the identifier tables during probes. Signed-off-by: Stephen Kitt <steve@sk2.org> Link: https://lore.kernel.org/r/20220405165836.2165310-4-steve@sk2.org Signed-off-by: Mark Brown <broonie@kernel.org>
2022-02-28ASoC: es8316: Use modern ASoC DAI format terminologyMark Brown
As part of moving to remove the old style defines for the bus clocks update the es8316 driver to use more modern terminology for clocking. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20220222223453.3190333-1-broonie@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-29ASoC: es8316: add support for ESSX8336 ACPI _HIDPierre-Louis Bossart
The same codec seems to have different personalities. ESSX8316 was used for Baytrail/CherryTrail, ESSX8336 seems to be used for AppoloLake, GeminiLake, JasperLake and TigerLake devices. BugLink: https://github.com/thesofproject/linux/issues/2955 Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>-e Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20211029011109.23633-1-yung-chuan.liao@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-04ASoC: es8316: Use IRQF_NO_AUTOEN when requesting the IRQHans de Goede
Use the new IRQF_NO_AUTOEN flag when requesting the IRQ, rather then disabling it immediately after requesting it. This fixes a possible race where the IRQ might trigger between requesting and disabling it; and this also leads to a small code cleanup. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20211003132255.31743-1-hdegoede@redhat.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10ASoC: es8316: Simplify adc_pga_gain_tlv tableHans de Goede
Most steps in this table are steps of 3dB (300 centi-dB), so we can simplify the table. This not only reduces the amount of space it takes inside the kernel, this also makes alsa-lib's mixer code actually accept the table, where as before this change alsa-lib saw the "ADC PGA Gain" control as a control without a dB scale. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20210228160441.241110-1-hdegoede@redhat.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-21ASoC: es*: sync parameter naming (rate/sample_bits)Kuninori Morimoto
This patch syncs naming rule. - xxx_rates; + xxx_rate; - xxx_samplebits; + xxx_sample_bits; Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/874kjiolga.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-12ASoC: es8316: Fix possible NULL pointer deref in es8316_disable_jack_detect()Hans de Goede
sound/soc/soc-core.c: soc_remove_component() unconditionally calls snd_soc_component_set_jack(component, NULL, NULL); on any components being removed. This means that on machines where the machine-driver does not provide a jack through snd_soc_component_set_jack() es8316_disable_jack_detect() will still get called and at this time es8316->jack will be NULL and the es8316->jack->status check in es8316_disable_jack_detect() will lead to a NULL pointer deref. Fix this by checking for es8316->jack bein NULL at the start of es8316_disable_jack_detect() and turn the function into a no-op in that case. Cc: russianneuromancer <russianneuromancer@ya.ru> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20210112101725.44200-1-hdegoede@redhat.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-26ASoC: es8316: skip of_device_id table when !CONFIG_OFKrzysztof Kozlowski
The driver can match by multiple methods. Its of_device_id table is referenced via of_match_ptr() so it will be unused for !CONFIG_OF builds: sound/soc/codecs/es8316.c:837:34: warning: ‘es8316_of_match’ defined but not used [-Wunused-const-variable=] Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Link: https://lore.kernel.org/r/20201125164452.89239-21-krzk@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-16ASoC: codecs: es*: merge .digital_mute() into .mute_stream()Kuninori Morimoto
snd_soc_dai_digital_mute() is internally using both mute_stream() (1) or digital_mute() (2), but the difference between these 2 are only handling direction. We can merge digital_mute() into mute_stream int snd_soc_dai_digital_mute(xxx, int direction) { ... else if (dai->driver->ops->mute_stream) (1) return dai->driver->ops->mute_stream(xxx, direction); else if (direction == SNDRV_PCM_STREAM_PLAYBACK && dai->driver->ops->digital_mute) (2) return dai->driver->ops->digital_mute(xxx); ... } Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Link: https://lore.kernel.org/r/87tuyhwiwm.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-09ASoC: codecs: es8316: fix 'defined but not used' warningPierre-Louis Bossart
Fix W=1 warning sound/soc/codecs/es8316.c:842:36: warning: 'es8316_acpi_match' defined but not used [-Wunused-const-variable=] 842 | static const struct acpi_device_id es8316_acpi_match[] = { | ^~~~~~~~~~~~~~~~~ Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20200707190612.97799-12-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-09-09Merge branch 'asoc-5.4' into asoc-nextMark Brown
2019-09-09ASoC: es8316: support fixed and variable both clock ratesKatsuhiro Suzuki
This patch supports some type of machine drivers that set 0 to mclk when sound device goes to idle state. After applied this patch, sysclk == 0 means there is no constraint of sound rate and other values will set constraints which is derived by sysclk setting. Original code refuses sysclk == 0 setting. But some boards and SoC (such as RockPro64 and RockChip I2S) has connected SoC MCLK out to ES8316 MCLK in. In this case, SoC side I2S will choose suitable frequency of MCLK such as fs * mclk-fs when user starts playing or capturing. Bad scenario as follows (mclk-fs = 256): - Initialize sysclk by correct value (Ex. 12.288MHz) - ES8316 set constraints of PCM rate by sysclk 48kHz (1/256), 32kHz (1/384), 30.720kHz (1/400), 24kHz (1/512), 16kHz (1/768), 12kHz (1/1024) - Play 48kHz sound, it's acceptable - Sysclk is not changed - Play 32kHz sound, it's acceptable - Set sysclk by 8.192MHz (= fs * mclk-fs = 32k * 256) - ES8316 set constraints of PCM rate by sysclk 32kHz (1/256), 21.33kHz (1/384), 20.48kHz (1/400), 16kHz (1/512), 10.66kHz (1/768), 8kHz (1/1024) - Play 48kHz again, but it's NOT acceptable because constraints list does not allow 48kHz Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net> Link: https://lore.kernel.org/r/20190907163653.9382-2-katsuhiro@katsuster.net Signed-off-by: Mark Brown <broonie@kernel.org>
2019-09-09ASoC: es8316: fix redundant codes of clockKatsuhiro Suzuki
This patch removes redundant null checks for optional MCLK clock. And fix DT binding document for changing clock property to optional from required. Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net> Link: https://lore.kernel.org/r/20190907163653.9382-1-katsuhiro@katsuster.net Signed-off-by: Mark Brown <broonie@kernel.org>
2019-09-03ASoC: es8316: add clock control of MCLKKatsuhiro Suzuki
This patch introduce clock property for MCLK master freq control. Driver will set rate of MCLK master if set_sysclk is called and changing sysclk by board driver. [Modified slightly to apply without an earlier patch in the series due to context diffs -- broonie] Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net> Link: https://lore.kernel.org/r/20190903165322.20791-2-katsuhiro@katsuster.net Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-27ASoC: es8316: fix inverted L/R of headphone mixer volumeKatsuhiro Suzuki
This patch fixes inverted Left-Right channel of headphone mixer volume by wrong shift_left, shift_right values. Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net> Reviewed-by: Daniel Drake <drake@endlessm.com> Link: https://lore.kernel.org/r/20190826153900.25969-2-katsuhiro@katsuster.net Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-27ASoC: es8316: fix headphone mixer volume tableKatsuhiro Suzuki
This patch fix setting table of Headphone mixer volume. Current code uses 4 ... 7 values but these values are prohibited. Correct settings are the following: 0000 -12dB 0001 -10.5dB 0010 -9dB 0011 -7.5dB 0100 -6dB 1000 -4.5dB 1001 -3dB 1010 -1.5dB 1011 0dB Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net> Reviewed-by: Daniel Drake <drake@endlessm.com> Link: https://lore.kernel.org/r/20190826153900.25969-1-katsuhiro@katsuster.net Signed-off-by: Mark Brown <broonie@kernel.org>
2019-06-19treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500Thomas Gleixner
Based on 2 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation # extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 4122 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Enrico Weigelt <info@metux.net> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-01ASoC: es8316: Add support for inverted jack detectPaul Cercueil
On some devices (Teclast X98+ II tablet, maybe others), the jack detection has been wired backwards, so when the ES8316 reports headphones being present it means they are actually not plugged. Use a quirk around this incorrect behaviour, which can be enabled through the 'everest,jack-detect-inverted' boolean device property. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-07ASoC: es8316: remove unused constant variablesPierre-Louis Bossart
Fix warnings with W=1 If these variables are useful this driver should be modified to expose them. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-04ASoC: es8316: Add DAC mono mix switch mixer controlHans de Goede
Export the DAC functionality to mix left + right together and then output the same (mixed) signal on both outputs. Various (x86) tablets with an ES8316 codec use a single speaker connected between the headhpone LOUT and ROUT pins, expecting the output to be in a mono differential mode. Presumably this is done to use the power of both the left and right outputs to allow the speaker to be louder. The ES8316 codec does not have a differential output mode, but we can emulate this by making both channels output the same through the mono mix switch, combined with setting the Playback Polarity control to "R Invert", which applias a 180 degrees phase inversion to the right channel. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-04ASoC: es8316: Add jack-detect supportHans de Goede
Adding jack-detect support may seem weird for a codec with only a single output, but it is necessary. The ES8316 appnote showing the intended usage uses a jack-receptacle which physically disconnects the speakers from the output when a jack is plugged in. But all 3 devices using the es8316 which I have (2 Cherry Trail devices and one Bay Trail CR device), use an analog mux to disconnect the speakers, driven by a GPIO. In order to enable/disable the speakers at the right time, we need jack-detect. The same goes for the microphone where we must correctly set the mux for the single ADC to either the internal or the headset microphone. All devices I have support the es8316's builtin jack-detect functionality. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-12ASoC: es8316: replace codec to componentKuninori Morimoto
Now we can replace Codec to Component. Let's do it. Note: xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 1 -> .idle_bias_on = 0 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-18ASoC: codecs: constify snd_soc_dai_ops structuresArvind Yadav
snd_soc_dai_ops are not supposed to change at runtime. All functions working with snd_soc_dai_ops provided by <sound/soc-dai.h> work with const snd_soc_dai_ops. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-10ASoC: codecs: add const to snd_soc_codec_driver structuresBhumika Goyal
Declare snd_soc_codec_driver structures as const as they are only passed as an argument to the function snd_soc_register_codec. This argument is of type const, so declare the structures with this property as const. In file codecs/sn95031.c, snd_soc_codec_driver structure is also used in a copy operation along with getting passed to snd_soc_register_codec. So, it can be made const too. Done using Coccinelle: @match disable optional_qualifier@ identifier s; position p; @@ static struct snd_soc_codec_driver s@p={...}; @good1@ identifier match.s; position p; @@ snd_soc_register_codec(...,&s@p,...) @bad@ identifier match.s; position p!={match.p,good1.p}; @@ s@p @depends on !bad disable optional_qualifier@ identifier match.s; @@ static +const struct snd_soc_codec_driver s={...}; Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-06-13ASoC: add es8316 codec driverDaniel Drake
Add a codec driver for the Everest ES8316, based on code provided by David Yang from Everest Semi. I limited the functionality to items where the vendor code was clear, and things that can be tested on the Weibu F3C (Intel Cherry Trail). As a result the initial implementation only supports running in slave mode at single speed (up to 48kHz sample rate) using I2S. HPD is not supported. Signed-off-by: David Yang <yangxiaohua@everest-semi.com> [drake@endlessm.com: significant cleanups and simplifications, remove dead/unclear code] Signed-off-by: Daniel Drake <drake@endlessm.com> Signed-off-by: Mark Brown <broonie@kernel.org>