ASoC: max98373: Added Amplifier Driver
PATCH v3 2/2 ASoC: max98373: Added Amplifier Driver
---
Changes since v2:
* Splitted dt bindings to the separated patch
* Changed 'interelave-mode' device property from u32 to boolean
Changes since v1:
* Removed 'codec' from 'max98373_priv' structure
: Now 'max98373_set_clock' function use 'dai->codec.dev' instead of using 'max98373->codec.dev'.
* Removed 'max98373_dai_set_sysclk' function
: This function is not necessary. Removed 'sysclk' from 'max98373_priv' as well.
* Removed 'iface' from 'max98373_priv' structure
: There is no function who refer max98373->iface variable.
* Added SPDX-License-Identifier
sound/soc/codecs/Kconfig | 5 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/max98373.c | 971 ++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/max98373.h | 212 ++++++++++ 4 files changed, 1190 insertions(+) create mode 100644 sound/soc/codecs/max98373.c create mode 100644 sound/soc/codecs/max98373.h
sound/soc/codecs/Kconfig +5 -0
@@ -95,6 +95,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_MAX98925 if I2C select SND_SOC_MAX98926 if I2C select SND_SOC_MAX98927 if I2C + select SND_SOC_MAX98373 if I2C select SND_SOC_MAX9850 if I2C select SND_SOC_MAX9860 if I2C select SND_SOC_MAX9768 if I2C
@@ -626,6 +627,10 @@ config SND_SOC_MAX98927 tristate "Maxim Integrated MAX98927 Speaker Amplifier" depends on I2C +config SND_SOC_MAX98373 + tristate "Maxim Integrated MAX98373 Speaker Amplifier" + depends on I2C + config SND_SOC_MAX9850 tristate
sound/soc/codecs/Makefile +2 -0
@@ -90,6 +90,7 @@ snd-soc-max9867-objs := max9867.o snd-soc-max98925-objs := max98925.o snd-soc-max98926-objs := max98926.o snd-soc-max98927-objs := max98927.o +snd-soc-max98373-objs := max98373.o snd-soc-max9850-objs := max9850.o snd-soc-max9860-objs := max9860.o snd-soc-mc13783-objs := mc13783.o
@@ -334,6 +335,7 @@ obj-$(CONFIG_SND_SOC_MAX9867) += snd-soc-max9867.o obj-$(CONFIG_SND_SOC_MAX98925) += snd-soc-max98925.o obj-$(CONFIG_SND_SOC_MAX98926) += snd-soc-max98926.o obj-$(CONFIG_SND_SOC_MAX98927) += snd-soc-max98927.o +obj-$(CONFIG_SND_SOC_MAX98373) += snd-soc-max98373.o obj-$(CONFIG_SND_SOC_MAX9850) += snd-soc-max9850.o obj-$(CONFIG_SND_SOC_MAX9860) += snd-soc-max9860.o obj-$(CONFIG_SND_SOC_MC13783) += snd-soc-mc13783.o
sound/soc/codecs/max98373.c new file +971 -0
971 lines not on this page · raw message
sound/soc/codecs/max98373.h new file +212 -0
212 lines not on this page · raw message
Signature · 1 line
2.7.4
Mark Brown
maintainerOn Wed, Jan 03, 2018 at 10:39:17AM -0800, Ryan Lee wrote:
This looks mostly good. There are a few smaller issues but I think at this point it's most sensible to apply and fix those incrementally so I'll do that, please follow up with patches fixing the remaining issues.
sound/soc/codecs/max98373.c line 2
Quoted 5 lines
sound/soc/codecs/max98373.c new file +2
-0@@ -0,0 +1,971 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (c) 2017, Maxim Integrated */
SPDX headers are supposed to be C++ comments, please send a followup patch fixing this.
sound/soc/codecs/max98373.c line 179
Quoted 11 lines
sound/soc/codecs/max98373.c new file +11
-0+static int max98373_get_bclk_sel (int bclk) +{ +int i; +/* match BCLKs per LRCLK */ +for (i =0 ; i <ARRAY_SIZE (bclk_sel_table); i++) { +if (bclk_sel_table[i] == bclk) +return i +2 ; + } +return 0 ; +} +static int max98373_set_clock(struct snd_soc_codec *codec,
Missing blank line between the functions.
sound/soc/codecs/max98373.c line 15
Quoted 2 lines
sound/soc/codecs/max98373.c new file +2
-0+ } +/* set DAI_SR to correct LRCLK frequency */
Another missing blank line.
sound/soc/codecs/max98373.c line 312
Quoted 12 lines
sound/soc/codecs/max98373.c new file +12
-0+static int max98373_dai_tdm_slot (struct snd_soc_dai *dai, +unsigned int tx_mask,unsigned int rx_mask, +int slots,int slot_width) +{ +struct snd_soc_codec *codec = dai->codec; +struct max98373_priv *max98373 =snd_soc_codec_get_drvdata (codec); +int bsel =0 ; +unsigned int chan_sz =0 ; +unsigned int mask; +int x, slot_found; + + max98373->tdm_mode = true;
This should really also support disabling TDM mode - if the parameters are all 0 just turn TDM off. Again can be fixed in a followup.
sound/soc/codecs/max98373.c line 616
Quoted 8 lines
sound/soc/codecs/max98373.c new file +8
-0+SOC_SINGLE_TLV ("DHT Gain Min" ,MAX98373_R20D1_DHT_CFG , +MAX98373_DHT_SPK_GAIN_MIN_SHIFT ,9 ,0 , max98373_dht_spkgain_min_tlv), +SOC_SINGLE_TLV ("DHT Rot Pnt" ,MAX98373_R20D1_DHT_CFG , +MAX98373_DHT_ROT_PNT_SHIFT ,15 ,0 , max98373_dht_rotation_point_tlv), +SOC_SINGLE_TLV ("DHT Attack Step" ,MAX98373_R20D2_DHT_ATTACK_CFG , +MAX98373_DHT_ATTACK_STEP_SHIFT ,4 ,0 , max98373_dht_step_size_tlv), +SOC_SINGLE_TLV ("DHT Release Step" ,MAX98373_R20D3_DHT_RELEASE_CFG , + MAX98373_DHT_RELEASE_STEP_SHIFT, 4, 0, max98373_dht_step_size_tlv),
You should add a Volume on the end of these control names so that userspace knows how to display them properly; it's a little confusing as they're not actually gains but it tends to work out better. Same for most of the other TLV controls.
Quoted 12 lines
-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Thursday, January 4, 2018 9:14 AM
To: Ryan Lee <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; m- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [V3 2/2] ASoC: max98373: Added Amplifier Driver
Quoted 5 lines
On Wed, Jan 03, 2018 at 10:39:17AM -0800, Ryan Lee wrote:
This looks mostly good. There are a few smaller issues but I think at this point it's most sensible to apply and fix those incrementally so I'll do that, please follow up with patches fixing the remaining issues.
Thank you. Let me follow up with patches fixing the remaining issues.
Quoted 10 lines
sound/soc/codecs/max98373.c line 2
Quoted 6 lines
sound/soc/codecs/max98373.c new file +2
-0@@ -0,0 +1,971 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (c) 2017, Maxim Integrated */ SPDX headers are supposed to be C++ comments, please send a followup patch fixing this.
Quoted 12 lines
sound/soc/codecs/max98373.c line 179
Quoted 10 lines
sound/soc/codecs/max98373.c new file +10
-0+static int max98373_get_bclk_sel (int bclk) { +int i; +/* match BCLKs per LRCLK */ +for (i =0 ; i <ARRAY_SIZE (bclk_sel_table); i++) { +if (bclk_sel_table[i] == bclk) +return i +2 ; + } +return 0 ; +} +static int max98373_set_clock(struct snd_soc_codec *codec,Missing blank line between the functions.
OK. Thanks.
Quoted 5 lines
sound/soc/codecs/max98373.c line 14
Quoted 3 lines
sound/soc/codecs/max98373.c new file +2
-0+ } +/* set DAI_SR to correct LRCLK frequency */ Another missing blank line.
OK. Let me fix.
Quoted 8 lines
sound/soc/codecs/max98373.c
Quoted 7 lines
sound/soc/codecs/max98373.c new file +6
-0+static int max98373_dai_tdm_slot (struct snd_soc_dai *dai, +unsigned int tx_mask,unsigned int rx_mask, +int slots,int slot_width) +{ +struct snd_soc_codec *codec = dai->codec; + struct max98373_priv *max98373 =
snd_soc_codec_get_drvdata(codec);
Quoted 9 lines
sound/soc/codecs/max98373.c line 312
Quoted 6 lines
sound/soc/codecs/max98373.c new file +6
-0+int bsel =0 ; +unsigned int chan_sz =0 ; +unsigned int mask; +int x, slot_found; + + max98373->tdm_mode = true;This should really also support disabling TDM mode - if the parameters are all 0 just turn TDM off. Again can be fixed in a followup.
OK. Let me apply it.
Quoted 11 lines
sound/soc/codecs/max98373.c line 29
Quoted 4 lines
sound/soc/codecs/max98373.c new file +3
-0+SOC_SINGLE_TLV ("DHT Gain Min" ,MAX98373_R20D1_DHT_CFG , +MAX98373_DHT_SPK_GAIN_MIN_SHIFT ,9 ,0 , +max98373_dht_spkgain_min_tlv), SOC_SINGLE_TLV("DHT Rot Pnt",
MAX98373_R20D1_DHT_CFG,sound/soc/codecs/max98373.c line 30
Quoted 1 line
sound/soc/codecs/max98373.c new file +1
-0+ MAX98373_DHT_ROT_PNT_SHIFT, 15, 0,
max98373_dht_rotation_point_tlv),sound/soc/codecs/max98373.c line 32
Quoted 2 lines
sound/soc/codecs/max98373.c new file +2
-0+SOC_SINGLE_TLV("DHT Attack Step", MAX98373_R20D2_DHT_ATTACK_CFG, + MAX98373_DHT_ATTACK_STEP_SHIFT, 4, 0,
max98373_dht_step_size_tlv),sound/soc/codecs/max98373.c line 33
Quoted 1 line
sound/soc/codecs/max98373.c new file +1
-0+SOC_SINGLE_TLV("DHT Release Step",
Quoted 8 lines
MAX98373_R20D3_DHT_RELEASE_CFG,sound/soc/codecs/max98373.c line 34
Quoted 1 line
sound/soc/codecs/max98373.c new file +1
-0+ MAX98373_DHT_RELEASE_STEP_SHIFT, 4, 0,
max98373_dht_step_size_tlv),You should add a Volume on the end of these control names so that userspace knows how to display them properly; it's a little confusing as they're not actually gains but it tends to work out better. Same for most of the other TLV controls.
OK. Thanks for your feedback.
Mark Brown
maintainerApplied "ASoC: max98373: Added Amplifier Driver" to the asoc tree
In reply to Ryan LeeThe patch
ASoC: max98373: Added Amplifier Driver
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
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
Quoted 1 line
From
2f3d24a1355ad32845300dfd0a375c361be7ab38Mon Sep 17 00:00:00 2001
From: Ryan Lee <[email protected]>
Date: Wed, 3 Jan 2018 10:39:17 -0800
Subject: [PATCH] ASoC: max98373: Added Amplifier Driver
--- sound/soc/codecs/Kconfig | 5 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/max98373.c | 971 ++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/max98373.h | 212 ++++++++++ 4 files changed, 1190 insertions(+) create mode 100644 sound/soc/codecs/max98373.c create mode 100644 sound/soc/codecs/max98373.h
sound/soc/codecs/Kconfig +5 -0
@@ -95,6 +95,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_MAX98925 if I2C select SND_SOC_MAX98926 if I2C select SND_SOC_MAX98927 if I2C + select SND_SOC_MAX98373 if I2C select SND_SOC_MAX9850 if I2C select SND_SOC_MAX9860 if I2C select SND_SOC_MAX9768 if I2C
@@ -623,6 +624,10 @@ config SND_SOC_MAX98927 tristate "Maxim Integrated MAX98927 Speaker Amplifier" depends on I2C +config SND_SOC_MAX98373 + tristate "Maxim Integrated MAX98373 Speaker Amplifier" + depends on I2C + config SND_SOC_MAX9850 tristate
sound/soc/codecs/Makefile +2 -0
@@ -90,6 +90,7 @@ snd-soc-max9867-objs := max9867.o snd-soc-max98925-objs := max98925.o snd-soc-max98926-objs := max98926.o snd-soc-max98927-objs := max98927.o +snd-soc-max98373-objs := max98373.o snd-soc-max9850-objs := max9850.o snd-soc-max9860-objs := max9860.o snd-soc-mc13783-objs := mc13783.o
@@ -330,6 +331,7 @@ obj-$(CONFIG_SND_SOC_MAX9867) += snd-soc-max9867.o obj-$(CONFIG_SND_SOC_MAX98925) += snd-soc-max98925.o obj-$(CONFIG_SND_SOC_MAX98926) += snd-soc-max98926.o obj-$(CONFIG_SND_SOC_MAX98927) += snd-soc-max98927.o +obj-$(CONFIG_SND_SOC_MAX98373) += snd-soc-max98373.o obj-$(CONFIG_SND_SOC_MAX9850) += snd-soc-max9850.o obj-$(CONFIG_SND_SOC_MAX9860) += snd-soc-max9860.o obj-$(CONFIG_SND_SOC_MC13783) += snd-soc-mc13783.o
sound/soc/codecs/max98373.c new file +971 -0
971 lines not on this page · raw message
sound/soc/codecs/max98373.h new file +212 -0
212 lines not on this page · raw message
Signature · 1 line
2.15.1