History log of /linux-master/sound/soc/codecs/max98373.c
Revision Date Author Comments
# d3091d09 11-Sep-2023 Linus Walleij <linus.walleij@linaro.org>

ASoC: max98373: Convert to use GPIO descriptors

Instead of relying on legacy interfaces, convert the driver to
use GPIO descriptors. This is a straight-forward conversion,
we support also sdw devices providing GPIO descriptor tables
if they so desire.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230911-descriptors-asoc-max-v2-3-b9d793fb768e@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# c5cb83a1 25-Aug-2023 Linus Walleij <linus.walleij@linaro.org>

ASoC: max98373: Convert to use GPIO descriptors

Instead of relying on legacy interfaces, convert the driver to
use GPIO descriptors. This is a straight-forward conversion,
we support also sdw devices providing GPIO descriptor tables
if they so desire.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230825-descriptors-asoc-max-v1-3-b212292b2f08@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 352e1eb1 06-Apr-2023 Long Wang <long.wang@analog.com>

ASoC: max98373: change power down sequence for smart amp

In order to avoid pop noise which occurs when switching
device from speaker to headphone, the amplifier should
power down first when stopping playback.

Signed-off-by: Long Wang <long.wang@analog.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20230406154535.18205-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# d2d3219e 23-Jun-2022 Charles Keepax <ckeepax@opensource.cirrus.com>

ASoC: max*: Remove now redundant non_legacy_dai_naming flag

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-53-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 011e397f 16-Jun-2022 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: codecs: soundwire: call pm_runtime_resume() in component probe

Make sure that the bus and codecs are pm_runtime active when the card
is registered/created. This avoid timeouts when accessing registers.

BugLink: https://github.com/thesofproject/linux/issues/3651
BugLink: https://github.com/thesofproject/linux/issues/3650
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220616210825.132093-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7a0d8849 24-Mar-2021 Ryan Lee <ryans.lee@maximintegrated.com>

ASoC: max98373: Added controls for autorestart config

3 new controls are added.
"OVC Autorestart Switch" : controls whether or not the speaker amplifier
automatically re-enables after an overcurrent fault condition.
"THERM Autorestart Switch" : controls whether or not the device
automatically resumes playback when the die temperature recovers from
thermal shutdown.
"CMON Autorestart Switch" : controls whether or not the device
automatically resumes playback when the clock returns after stopping.

Above Auto Restart functions are enabled by default.

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Link: https://lore.kernel.org/r/20210325033555.29377-3-ryans.lee@maximintegrated.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3a27875e 24-Mar-2021 Ryan Lee <ryans.lee@maximintegrated.com>

ASoC: max98373: Added 30ms turn on/off time delay

Amp requires 10 ~ 30ms for the power ON and OFF.
Added 30ms delay for stability.

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Link: https://lore.kernel.org/r/20210325033555.29377-2-ryans.lee@maximintegrated.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# ded055ee 27-Jan-2021 Judy Hsiao <judyhsiao@google.com>

ASoC: max98373: Fixes a typo in max98373_feedback_get

The snd_soc_put_volsw in max98373_feedback_get is a typo, change it
to snd_soc_get_volsw.

Fixes: 349dd23931d1 ("ASoC: max98373: don't access volatile registers in bias level off")
Signed-off-by: Judy Hsiao <judyhsiao@google.com>
Link: https://lore.kernel.org/r/20210127135620.1143942-1-judyhsiao@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 349dd239 17-Dec-2020 Bard Liao <yung-chuan.liao@linux.intel.com>

ASoC: max98373: don't access volatile registers in bias level off

We will set regcache_cache_only true in suspend. As a result,
regmap_read will return error when we try to read volatile
registers in suspend. Besides, it doesn't make sense to read
feedback data when codec is not active. To make userspace
happy, this patch returns a cached value shich should be a
valid value.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20201217074556.32370-1-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 56a5b791 08-Jul-2020 Ryan Lee <ryans.lee@maximintegrated.com>

ASoC: codecs: max98373: add SoundWire support

Add SoundWire specific parts and extend common ones already split from
I2C.

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Signed-off-by: Naveen Manohar <naveen.m@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200708203215.231776-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# d7ee0c72 08-Jul-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: codecs: max98373: split I2C and common parts

To prepare support for SoundWire, let's first split the I2C and common
parts. No new functionality, just indents and formatting to make
checkpatch happy.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200708203215.231776-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0fd3935e 07-Jul-2020 randerwang <rander.wang@linux.intel.com>

ASoc: codecs: max98373: remove Idle_bias_on to let codec suspend

Idle_bias_on is used to decide bias on/off in standby state by dapm.
When Idle_bias_on is set to one, dapm will keep max98373 active at
idle time. Max98373 is doing nothing in this state, so remove
idle_bias_on setting to let max98373 get suspended when it is idle.

Signed-off-by: randerwang <rander.wang@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ryan Lee <ryans.lee@maximintegrated.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200707205740.114927-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# a53bacc0 07-Jul-2020 Ryan Lee <ryans.lee@maximintegrated.com>

ASoC: codecs: max98373: Removed superfluous volume control from chip default

Volume control in probe function is not necessary.

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200707205740.114927-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1a446873 01-May-2020 Yong Zhi <yong.zhi@intel.com>

ASoC: max98373: reorder max98373_reset() in resume

During S3 test, the following error was observed:

[ 726.174237] i2c_designware i2c_designware.0: platform_pm_resume+0x0/0x3d returned 0 after 0 usecs
[ 726.184187] max98373 i2c-MX98373:00: calling max98373_resume+0x0/0x30 [snd_soc_max98373] @ 12698, parent: i2c-11
[ 726.195589] max98373 i2c-MX98373:00: Reset command failed. (ret:-16)

When calling regmap_update_bits(), since map->reg_update_bits is NULL,
_regmap_read() is entered with the following logic:

if (!map->cache_bypass) {
ret = regcache_read(map, reg, val);
if (ret == 0)
return 0;
}

if (map->cache_only)
return -EBUSY;

regcache_read() hits -EINVAL because MAX98373_R2000_SW_RESET is volatile,
as map->cache_only is set by codec suspend, thus -EBUSY is returned.
Fix by moving max98373_reset() after cache_only set to false in max98373_resume().

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Link: https://lore.kernel.org/r/1588376661-29799-1-git-send-email-yong.zhi@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# e44f3d49 04-Nov-2019 Yong Zhi <yong.zhi@intel.com>

ASoC: max98373: replace gpio_request with devm_gpio_request

Use devm_gpio_request() to automatic unroll when fails and avoid
resource leaks at error paths.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Link: https://lore.kernel.org/r/1572905399-22402-1-git-send-email-yong.zhi@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4bb41984 28-Sep-2019 Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>

ASoC: max98373: check for device node before parsing

Below Oops is caused in a system which uses ACPI instead of device node:

of_get_named_gpiod_flags: can't parse 'maxim,reset-gpio' property of node '(null)[0]'
BUG: kernel NULL pointer dereference, address: 0000000000000010

This patch avoids NULL pointer deferencing by adding a check before parsing
and initializes to make reset-gpio pin as invalid.

Signed-off-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
Signed-off-by: Jairaj Arava <jairaj.arava@intel.com>
Link: https://lore.kernel.org/r/1569702150-11976-1-git-send-email-sathyanarayana.nujella@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7c076764 06-Aug-2019 Mark Brown <broonie@kernel.org>

ASoC: max98373: Remove executable bits

Signed-off-by: Mark Brown <broonie@kernel.org>


# b9da500b 31-Jul-2019 fengchunguo <chunguo.feng@amlogic.com>

ASoC: max98373: add 88200 and 96000 sampling rate support

88200 and 96000 sampling rate was not enabled on driver, so can't be played.

The error information:
max98373 3-0031:rate 96000 not supported
max98373 3-0031:ASoC: can't set max98373-aif1 hw params: -22

Signed-off-by: fengchunguo <chunguo.feng@amlogic.com>
Link: https://lore.kernel.org/r/20190731074156.5620-1-chunguo.feng@amlogic.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 96cd3b97 15-Jul-2019 fengchunguo <chunguo.feng@amlogic.com>

ASoC: max98383: fix i2c probe failure

Added reset_gpio configuration for i2c probe successfully.
If not,i2c address can't be found rightly.

Error information:
max98373 3-0031: Failed to read: 0x21FF

Fixed:
[3.761299@3] max98373 3-0031: MAX98373 revisionID: 0x43
[3.828911@3] asoc-aml-card auge_sound: max98373-aif1 <-> TDM-B mapping ok

Signed-off-by: fengchunguo <chunguo.feng@amlogic.com>
Link: https://lore.kernel.org/r/20190715095556.1614-1-chunguo.feng@amlogic.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7c3727ba 04-Jan-2019 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: max98383: fix boolean assignments to true/false

Reported by Coccinelle:

sound/soc/codecs/max98373.c:411:2-20: WARNING: Assignment of bool to 0/1
sound/soc/codecs/max98373.c:922:2-27: WARNING: Assignment of bool to 0/1
sound/soc/codecs/max98373.c:924:2-27: WARNING: Assignment of bool to 0/1

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 20f2ab24 29-Nov-2018 Ryan Lee <RyanS.Lee@maximintegrated.com>

ASoC: max98373: Added max98373_reset for stable amp reset

This patch added max98373_reset function to avoid amp software reset failure and code duplication.
Reset verification step has been added for stable amp reset and it repeats verification maximum 3 times when it is failed.
Chip revision ID is available when the amp is in the idle state which means software reset is completed well.
Additional 10ms delay was added for every retrial and maximum 30ms delay can be applied.

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a23f5dc8 10-Oct-2018 Ryan Lee <RyanS.Lee@maximintegrated.com>

ASoC: max98373: Sort DHT Rot Pnt Volume in reverse order

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# d34c8f37 10-Oct-2018 Ryan Lee <RyanS.Lee@maximintegrated.com>

ASoC: max98373: Sort max98373_bde_gain_tlv in reverse order

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6c3beeca 10-Oct-2018 Ryan Lee <RyanS.Lee@maximintegrated.com>

ASoC: max98373: Sort BDE Limiter Thresh Volume in reverse order

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4cbbc916 10-Oct-2018 Ryan Lee <RyanS.Lee@maximintegrated.com>

ASoC: max98373: Sort Digital Volume in reverse order

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3004136b 06-Sep-2018 Grant Grundler <grundler@chromium.org>

ASoC: max98373: usleep_range() needs include/delay.h

Commit ca917f9fe1a0fab added use of usleep_range() but not
the corresponding "include <linux/delay.h>". The result is
with Chrome OS won't build because warnings are forced
to be errors:
mnt/host/source/src/third_party/kernel/v4.4/sound/soc/codecs/max98373.c:734:2: error: implicit declaration of function 'usleep_range' [-Werror,-Wimplicit-function-declaration]
usleep_range(10000, 11000);
^

Including delay.h "fixes" this.

Signed-off-by: Grant Grundler <grundler@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ca917f9f 23-Aug-2018 Ryan Lee <ryans.lee@maximintegrated.com>

ASoC: max98373: Added 10ms sleep after amp software reset

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0d228252 15-Aug-2018 Ryan Lee <ryans.lee@maximintegrated.com>

ASoC: max98373: Added speaker FS gain cotnrol register to volatile.

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0717edbd 07-Aug-2018 Ryan Lee <ryans.lee@maximintegrated.com>

ASoC: max98373: Added software reset register to readable registers

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 41572b54 28-Jan-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: max98373: replace codec to component

Now we can replace Codec to Component. Let's do it.

Note:
xxx_codec_xxx() -> xxx_component_xxx()
.idle_bias_off = 0 -> .idle_bias_on = 1
.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>


# 180cad3c 18-Jan-2018 Ryan Lee <RyanS.Lee@maximintegrated.com>

ASoC: max98373 Changed SPDX header in C++ comments style

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# b6158323 09-Jan-2018 Ryan Lee <RyanS.Lee@maximintegrated.com>

ASoC: max98373: Modified control names for TLV controls

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3831a5b8 09-Jan-2018 Ryan Lee <RyanS.Lee@maximintegrated.com>

ASoC: max98373: Added TDM off if parameters are all zeroes

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# e1053262 09-Jan-2018 Ryan Lee <RyanS.Lee@maximintegrated.com>

ASoC: max98373: Added missing blank lines

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2f3d24a1 03-Jan-2018 Ryan Lee <ryans.lee@maximintegrated.com>

ASoC: max98373: Added Amplifier Driver

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Signed-off-by: Mark Brown <broonie@kernel.org>