Commit graph

44 commits

Author SHA1 Message Date
Shuming Fan
74d71f628d
ASoC: rt1015: fix the first word being cut off
This patch adds a control that there are four options to control the digital volume output.
The user could select "immediate" to make volume updates immediately.
In default, the driver selects the volume update with "zero detection + soft inc/dec change".

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20230915020530.83452-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-15 13:16:24 +01:00
Linus Walleij
c7a7f4444b
ASoC: rt1015: Drop GPIO include
This driver include the GPIO legacy header <linux/gpio.h yet
doesn't use symbols from it. Drop the include.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org
Link: https://lore.kernel.org/r/20230812-descriptors-asoc-v1-2-eb4dca1f68af@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org
2023-08-13 19:37:50 +01:00
Uwe Kleine-König
9abcd24002
ASoC: Switch i2c drivers back to use .probe()
After commit b8a1a4cd5a ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
03c835f498 ("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-05-08 08:48:49 +09:00
Charles Keepax
a524837ddd
ASoC: rt*: 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-57-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-27 13:17:05 +01:00
Stephen Kitt
35b8885805
ASoC: rt*: use simple i2c probe function
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/20220405130326.2107293-1-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-04-06 23:37:55 +01:00
Colin Ian King
a4db95b282
ASoC: codecs: Fix spelling mistake "Unsupport" -> "Unsupported"
There are spelling mistakes in dev_err error messages. Fix them.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210924231003.144502-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-27 13:01:05 +01:00
Tzung-Bi Shih
d019403a77
ASoC: rt1015: remove possible unused variable `bclk_ms'
bclk_ms is possible unused by using the given config (see [1]).

sound/soc/codecs/rt1015.c:724:2: warning: Value stored to 'bclk_ms' is
never read [clang-analyzer-deadcode.DeadStores]
           bclk_ms = frame_size > 32;
           ^         ~~~~~~~~~~~~~~~

In addition, bclk_ms is meaningless and confusing after applying commit
a5db2ca513 ("ASoC: rt1015: remove unneeded variables in rt1015_priv").
The "> 32" in the expression looks like a typo but it was not.

Let's remove the confusing variable bclk_ms.

[1]: https://lkml.org/lkml/2021/8/23/305

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20210823153323.1297723-1-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-23 16:41:06 +01:00
Jack Yu
bc1c8e4eee
ASoC: rt1015: Remove unnecessary flush work on rt1015 driver
Remove workqueue of flush work in rt1015 driver since we don't need it
after internal discussion, and there is no impact on performance
without this workqueue.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/3ef458a6ad754589b96d6a94abda1e55@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-07-26 18:57:19 +01:00
Jack Yu
9f44673b7a
ASoC: rt1015: Add bclk detection and dc detection
Add bclk detection and dc detection before playback.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20210322055053.31797-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-25 13:58:56 +00:00
Pierre-Louis Bossart
4354ad55cd
ASoC: rt1015: clarify expression
cppcheck warning:

sound/soc/codecs/rt1015.c:894:61: style: Boolean result is used in
bitwise operation. Clarify expression with
parentheses. [clarifyCondition]
  (pll_code.m_bp ? 0 : pll_code.m_code) << RT1015_PLL_M_SFT |
                                                            ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210302212527.55158-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10 13:09:56 +00:00
Rikard Falkeborn
3084e5f7f7
ASoC: rt*: Constify static struct acpi_device_id
These are never modified, so make them const to allow the compiler to
put them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20210224211918.39109-4-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10 13:06:34 +00:00
Rikard Falkeborn
f9e56a34cd
ASoC: rt*: Constify static struct snd_soc_dai_ops
The only usage of them is to assign their address to the ops field in
the snd_soc_dai_driver struct, which is a pointer to const. Make them
const to allow the compiler to put them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20210224211918.39109-3-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10 13:06:33 +00:00
Jack Yu
0d2b6e3989
ASoC: rt1015: enable BCLK detection after calibration
Enable BCLK detection after calibration.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20210222090057.29532-2-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10 12:48:27 +00:00
Jack Yu
9e0bdaa9fc
ASoC: rt1015: fix i2c communication error
Remove 0x100 cache re-sync to solve i2c communication error.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20210222090057.29532-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10 12:48:25 +00:00
Tzung-Bi Shih
81a6320da7
ASoC: rt1015: remove bclk_ratio
bclk_ratio is unused.  Removes bclk_ratio and .set_bclk_ratio callback.

Removes snd_soc_dai_set_bclk_ratio() in a few machine drivers which are
obviously using rt1015.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20201224101854.3024823-1-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-05 14:34:18 +00:00
Tzung-Bi Shih
d750570e04
ASoC: rt1015: re-calibrate again when resuming
Assuming the calibration state gets lost after system suspend.
Re-calibrates again when resuming.

The rt1015_priv is alloced by kzalloc.  No need to initialize cali_done
to 0 in component probe callback.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20201225030845.4138497-1-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-05 14:34:17 +00:00
Tzung-Bi Shih
a5db2ca513
ASoC: rt1015: remove unneeded variables in rt1015_priv
- `lrck' is only used in .hw_params callback so that it can be local.
- `bclk' is unused.
- `id' is unused.
- `amp_ver' is unused.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20201224100607.3006171-6-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-29 13:18:48 +00:00
Tzung-Bi Shih
3128f1c3b5
ASoC: rt1015: refactor retry loop and rt1015_priv allocation
Refactors retry loop in flush DAC work.  It is more clear to use a
for-loop here.

Uses !rt1015 to check if NULL.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20201224100607.3006171-5-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-29 13:18:47 +00:00
Tzung-Bi Shih
e48b41e903
ASoC: rt1015: return error if any when setting bypass_boost
Returns -EBUSY if DAC is using when setting bypass_boost.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20201224100607.3006171-4-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-29 13:18:46 +00:00
Tzung-Bi Shih
bf1eb056ac
ASoC: rt1015: save boost_mode only if valid
Saves boost_mode only if valid.  Also returns -EINVAL if it is invalid.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20201224100607.3006171-3-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-29 13:18:46 +00:00
Tzung-Bi Shih
4ac275eda0
ASoC: rt1015: sort header inclusions
Sorts header inclusions.  ASCII value of 'r' is less than 's'.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20201224100607.3006171-2-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-29 13:18:45 +00:00
Jack Yu
6bdd75a1f6
ASoC: rt1015: modify calibration sequence for better performance
New calibration sequence to fix power issue in idle state.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/ec66399502514edbb1de3cf9bff08b1d@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-28 12:24:44 +00:00
Derek Fang
397e089bda
ASoC: rt1015: check the return value of regmap_read during i2c probe
In some projects, the device ID register is not read correctly.
This patch helps to verify the issue is caused from i2c host or client.

Signed-off-by: Derek Fang <derek.fang@realtek.com>
Link: https://lore.kernel.org/r/20201209091308.2823-1-derek.fang@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-09 12:13:44 +00:00
Mark Brown
e5879d9882
Merge branch 'for-5.10' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-5.11 2020-11-30 16:05:07 +00:00
Shuming Fan
106e6d8df4
ASoC: rt1015: increase the time to detect BCLK
To meet the most platform, the detection time should be increased to
avoid that the flushing DAC data fails.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20201113092125.19206-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-13 14:20:42 +00:00
Jack Yu
95370acdb8
ASoC: rt1015: modification for calibration to get better performance
Modification for calibration to get better performance.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20201109062958.16917-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-09 17:43:14 +00:00
Jack Yu
93bd813c17
ASoC: rt1015: add delay to fix pop noise from speaker
Add delay to fix pop noise from speaker.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20201105030804.31115-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-05 17:25:17 +00:00
Shuming Fan
7e9a2387c5
ASoC: rt1015: support TDM slot configuration
Add TDM slot callback function to support TDM configuration

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20201104092005.2227-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-04 17:51:55 +00:00
derek.fang
8d9a14fc73
ASoC: rt1015: Fix the failure to flush DAC data before playback
Fix the failure to flush DAC data before playback.

Signed-off-by: derek.fang <derek.fang@realtek.com>
Link: https://lore.kernel.org/r/1600073839-6762-2-git-send-email-derek.fang@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-14 13:53:57 +01:00
derek.fang
da145172b2
ASoC: rt1015: Fix DC calibration on bypass boost mode
Fix the DC calibration unsuccessful issue on rt1015
bypass boost mode.

Signed-off-by: derek.fang <derek.fang@realtek.com>
Link: https://lore.kernel.org/r/1600073839-6762-1-git-send-email-derek.fang@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-14 13:53:57 +01:00
Tzung-Bi Shih
72ac4a4bef
ASoC: rt1015: add missing header inclusion
To fix compilation error:

error: implicit declaration of function 'ACPI_PTR'
[-Werror,-Wimplicit-function-declaration]
                .acpi_match_table = ACPI_PTR(rt1015_acpi_match),
		                    ^

Adds the missing header "acpi.h" inclusion and sorts in alphabetical.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20200625153543.85039-4-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-25 19:21:02 +01:00
Jack Yu
668b1508cf
ASoC: rt1015: Flush DAC data before playback.
Flush DAC data before playback.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20200616023644.4523-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-16 12:39:33 +01:00
Jack Yu
e74a1e7eae
ASoC: rt1015: Update rt1015 default register value according to spec modification.
Update rt1015 default register value according to spec modification.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20200615032433.31061-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-15 15:18:33 +01:00
derek.fang
2aec8ccc1a
ASoC: rt1015: Enable class-D silence and clock detections
Avoid noise under bypass boost mode.

Signed-off-by: derek.fang <derek.fang@realtek.com>
Link: https://lore.kernel.org/r/1590750310-30085-1-git-send-email-derek.fang@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-29 13:30:06 +01:00
Jack Yu
d696a61413
ASoC: rt1015: Add condition to prevent SoC providing bclk in ratio of 50 times of sample rate.
Add condition to prevent SoC providing bclk in ratio of 50 times of sample rate.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20200504112013.2499-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-04 16:23:24 +01:00
Mark Brown
d98bf8894b
Merge branch 'for-5.6' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-5.7 2020-03-04 13:38:36 +00:00
Jack Yu
4b01618b62
ASoC: rt1015: modify pre-divider for sysclk
Modify pre-divider for system clock.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20200303025913.24499-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-03-03 14:00:01 +00:00
Mark Brown
cd1fa30142
Merge branch 'for-5.6' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-5.7 2020-03-02 14:39:08 +00:00
YueHaibing
a79ee2e095
ASoC: rt1015: set snd_soc_dai_ops in rt1015_dai driver
snd_soc_dai_driver should set ops in rt1015_dai driver.
Also make the two variable static to fix sparse warnings.

Fixes: df31007400 ("ASoC: rt1015: add rt1015 amplifier driver")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20200302070522.48104-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-03-02 14:31:45 +00:00
Jack Yu
d237851d5d
ASoC: rt1015: add operation callback function for rt1015_dai[]
Add operation callback function for rt1015_dai[].

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20200302015424.9075-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-03-02 13:52:34 +00:00
Jack Yu
4a88b7dec3
ASoC: rt1015: modify some structure to be static.
Modify rt1015_aif_dai_ops and rt1015_dai[] to be static.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20200227020637.15135-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-02-28 17:28:28 +00:00
Jack Yu
2f0b42034b
ASoC: rt1015: fix typo for bypass boost control
Fix typo for "Bypass Boost" control.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20200217020311.12793-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-02-17 16:03:56 +00:00
Nathan Chancellor
e91440ddfb
ASoC: rt1015: Remove unnecessary const
Clang warns:

../sound/soc/codecs/rt1015.c:392:14: warning: duplicate 'const'
declaration specifier [-Wduplicate-decl-specifier]
static const SOC_ENUM_SINGLE_DECL(rt1015_boost_mode_enum, 0, 0,
             ^
../include/sound/soc.h:355:2: note: expanded from macro
'SOC_ENUM_SINGLE_DECL'
        SOC_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xtexts)
        ^
../include/sound/soc.h:352:2: note: expanded from macro
'SOC_ENUM_DOUBLE_DECL'
        const struct soc_enum name = SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, \
        ^
1 warning generated.

Remove the const after static to fix it.

Fixes: df31007400 ("ASoC: rt1015: add rt1015 amplifier driver")
Link: https://github.com/ClangBuiltLinux/linux/issues/845
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Link: https://lore.kernel.org/r/20200124155750.33753-1-natechancellor@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-24 16:53:57 +00:00
Jack Yu
df31007400
ASoC: rt1015: add rt1015 amplifier driver
This is initial amplifier driver for rt1015.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20200115112519.22050-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-23 12:12:50 +00:00