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

ASoC: max98357a: Drop pointless include

This driver is already using solely GPIO descriptors and
do not need to include the legacy header <linux/gpio.h>.
Drop it.

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


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

ASoC: max98357a: Drop pointless include

This driver is already using solely GPIO descriptors and
do not need to include the legacy header <linux/gpio.h>.
Drop it.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230825-descriptors-asoc-max-v1-2-b212292b2f08@linaro.org
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>


# 04a646ff 21-Jul-2020 Tzung-Bi Shih <tzungbi@google.com>

ASoC: max98357a: move control of SD_MODE back to DAI ops

Partially reverts commit 128f825aeab7 ("ASoC: max98357a: move control
of SD_MODE to DAPM").

In order to have mute control of max98357 from machine drivers, commit
128f825aeab7 ("ASoC: max98357a: move control of SD_MODE to DAPM")
moves the control of SD_MODE from DAI ops to DAPM events. However, pop
noise has been observed on rk3399-gru-kevin boards due to this commit.

The commit 128f825aeab7 caused sequence of DAI clocks and SD_MODE
changed on rk3399-gru-kevin boards.

With the commit 128f825aeab7:
- SD_MODE will be set to 1 before DAI clocks start.
- SD_MODE will be set to 0 after DAI clocks stop.
As a result, pop noise.

Moves the control of SD_MODE back to DAI ops. In the meantime, uses an
additional flag in DAPM event to provide chance of mute control for
machine drivers.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Tested-By: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20200721114232.2812254-1-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3aad07b8 04-Jun-2020 Tzung-Bi Shih <tzungbi@google.com>

ASoC: max98357a: add compatible string for MAX98360A

Maxim MAX98360A audio amplifier is functionally identical to MAX98357A.
Adds compatible string "maxim,max98360a" for driver reuse.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20200605034931.107713-2-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1a0f2433 13-Mar-2020 Yong Zhi <yong.zhi@intel.com>

ASoC: max98357a: Add ACPI HID MAX98360A

Maxim MAX98360A audio amplifier is functionally identical to MAX98357A,
add ACPI ID "MAX98360A" for driver reuse.

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


# 128f825a 11-Feb-2020 Tzung-Bi Shih <tzungbi@google.com>

ASoC: max98357a: move control of SD_MODE to DAPM

Some machine may share the same I2S lines for multiple codecs. For
example, mediatek/mt8183/mt8183-da7219-max98357 shares the same lines
between max98357a and da7219. When writing audio data through the I2S
lines, all codecs on the lines would try to generate sound if they
accepts DO line. As a result, multiple codecs generate sound at a
time.

Moves control of SD_MODE to DAPM so that machine drivers have chances
to manipulate DAPM widget to turn on/off max98357a.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20200212124608.1.I73b26b5e319de173d05823e79f5861bf1826261c@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6cd249cf 08-Jul-2019 Tzung-Bi Shih <tzungbi@google.com>

ASoC: max98357a: use mdelay for sdmode-delay

max98357a_daiops_trigger() is possible to be called in atomic context if
the .nonatomic flag is equal to 0 in the DAI links.

When cancel_delayed_work_sync() in max98357a_daiops_trigger() is called
in atomic context, kernel emits the following message: "BUG: sleeping
function called from invalid context".

According to the DT binding document, value less than or equal to 5ms of
sdmod-delay should be sufficient to avoid the pop noise. Use mdelay
(i.e. busy loop) for such low delay should be acceptable.

Fixes: cec5b01f8f1c ("ASoC: max98357a: avoid speaker pop when playback
startup")

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20190708141901.68797-1-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# cec5b01f 19-Jun-2019 Mac Chiang <mac.chiang@intel.com>

ASoC: max98357a: avoid speaker pop when playback startup

Loud speaker pop happens during playback even when in slience
playback. Specify Max98357a amp delay times to make sure
clocks are always earlier than sdmode on.

Signed-off-by: Mac Chiang <mac.chiang@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 97fb5e8d 29-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284

Based on 1 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 and
only version 2 as published by the free software foundation this
program is distributed in the hope that it will be useful but
without any warranty without even the implied warranty of
merchantability or fitness for a particular purpose see the gnu
general public license for more details

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 294 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190529141900.825281744@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# bcd93822 08-May-2019 Tzung-Bi Shih <tzungbi@google.com>

ASoC: max98357a: request GPIO when device get probed

devm_gpiod_get_optional() returns EBUSY after component rebound.

Request GPIO in max98357a_platform_probe() to support component
rebinding.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# fdf34366 04-Apr-2019 Jerome Brunet <jbrunet@baylibre.com>

ASoC: max98357a: add missing supported rates

According the publicly available datasheet (and some test) the max98357a
also supports 32, 44.1 and 88.2 kHz sample rate.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


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

ASoC: max98357a: 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>


# a180ba45 03-Aug-2017 Bhumika Goyal <bhumirks@gmail.com>

ASoC: codecs: add const to snd_soc_codec_driver structures

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>


# b071a0bc 08-Aug-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: codec duplicated callback function goes to component on wm98357a

codec driver and component driver has duplicated callback functions,
and codec side functions are just copied to component side when
register timing. This was quick-hack, but no longer needed.
This patch moves these functions from codec driver to component driver.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5c27087e 11-Dec-2015 Rohit Ainapure <rohit.m.ainapure@intel.com>

ASoC: max98357a: Add ACPI ID for Maxim

Adding ACPI ID "MX98357A" for the MAXIM 98357A amp.

Signed-off-by: Rohit Ainapure <rohit.m.ainapure@intel.com>
Signed-off-by: Fang, Yang A <yang.a.fang@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 64793047 15-Jul-2015 Axel Lin <axel.lin@ingics.com>

ASoC: Constify snd_soc_dai_ops variables

The snd_soc_dai_ops variables are not modified after initialization in
these drivers, so make them const.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4ab0c591 12-Jul-2015 Anatol Pomozov <anatol.pomozov@gmail.com>

ASoC: max98357a: Do not print error message on asoc/gpio errors

gpiolib/asoc system already prints enough info if there are any problems.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 508e6195 12-Jul-2015 Anatol Pomozov <anatol.pomozov@gmail.com>

ASoC: max98357a: Use DAI input as a dapm widget

Spec does not say anything about DAC called SDMode.
It makes more sense to use DAI input that created automatically by DAPM
and route it to Speaker output.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5119222f 12-Jul-2015 Anatol Pomozov <anatol.pomozov@gmail.com>

ASoC: max98357a: Make 'sdmode-gpios' dts property optional

The option is not needed if chip is always on or managed by some other part
of system like platform card driver.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5edf1e06 19-May-2015 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

ASoC: max98357a: use flags argument of devm_gpiod_get to set direction

Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions)
which appeared in v3.17-rc1, the gpiod_get* functions take an additional
parameter that allows to specify direction and initial value for output.

Use this to simplify the driver. Furthermore this is one caller less
that stops us making the flags argument to gpiod_get*() mandatory.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Kenneth Westfield <kwestfie@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 92b2ad2c 24-Feb-2015 Kenneth Westfield <kwestfie@codeaurora.org>

ASoC: max98357a: Use standard DAI names

Use the standard naming convention for the codec DAI.

Signed-off-by: Kenneth Westfield <kwestfie@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7ff5eabc 17-Feb-2015 Kenneth Westfield <kwestfie@codeaurora.org>

ASoC: max98357a: Remove use of DRV_NAME

Remove use of DRV_NAME define.

Signed-off-by: Kenneth Westfield <kwestfie@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 08d0a55c 17-Feb-2015 Kenneth Westfield <kwestfie@codeaurora.org>

ASoC: max98357a: Add missing header files

Add missing header files to avoid implicit
declarations and indirect inclusions.

Signed-off-by: Kenneth Westfield <kwestfie@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5c8be987 11-Feb-2015 Vincent Stehlé <vincent.stehle@laposte.net>

ASoC: max98357a: Fix missing include

This fixes the following compilation errors:

sound/soc/codecs/max98357a.c: In function ‘max98357a_daiops_trigger’:
sound/soc/codecs/max98357a.c:30:3: error: implicit declaration of function ‘gpiod_set_value’ [-Werror=implicit-function-declaration]
sound/soc/codecs/max98357a.c: In function ‘max98357a_codec_probe’:
sound/soc/codecs/max98357a.c:55:2: error: implicit declaration of function ‘devm_gpiod_get’ [-Werror=implicit-function-declaration]
sound/soc/codecs/max98357a.c:61:2: error: implicit declaration of function ‘gpiod_direction_output’ [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors

Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net>
Cc: Kenneth Westfield <kwestfie@codeaurora.org>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3efa130d 08-Feb-2015 Mark Brown <broonie@kernel.org>

ASoC: max98357a: Fix build in !CONFIG_OF case

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Mark Brown <broonie@kernel.org>


# af5adf12 05-Feb-2015 Kenneth Westfield <kwestfie@codeaurora.org>

ASoC: max98357a: Add MAX98357A codec driver

Add codec driver for the Maxim MAX98357A DAC.

Signed-off-by: Kenneth Westfield <kwestfie@codeaurora.org>
Acked-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>