ASoC: max98390: Added Amplifier Driver
PATCH v3 2/2 ASoC: max98390: Added Amplifier Driver
This is the initial amplifier driver for max98390.
---
Changes since V2:
* Removed warn massage in max98390_dsm_calib_get func and add comment.
Changes since v1:
* Updated according to Mark's comments.
* Updated according to Tzung-Bi's comments.
* Removed Enum structure and use TLV data for Volume control
sound/soc/codecs/Kconfig | 5 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/max98390.c | 1030 +++++++++++++++++++++++++++++++++++ sound/soc/codecs/max98390.h | 663 ++++++++++++++++++++++ 4 files changed, 1700 insertions(+) create mode 100644 sound/soc/codecs/max98390.c create mode 100644 sound/soc/codecs/max98390.h
sound/soc/codecs/Kconfig +5 -0
@@ -116,6 +116,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_MAX98926 imply SND_SOC_MAX98927 imply SND_SOC_MAX98373 + imply SND_SOC_MAX98390 imply SND_SOC_MAX9850 imply SND_SOC_MAX9860 imply SND_SOC_MAX9759
@@ -867,6 +868,10 @@ config SND_SOC_MAX98373 tristate "Maxim Integrated MAX98373 Speaker Amplifier" depends on I2C +config SND_SOC_MAX98390 + tristate "Maxim Integrated MAX98390 Speaker Amplifier" + depends on I2C + config SND_SOC_MAX9850 tristate depends on I2C
sound/soc/codecs/Makefile +2 -0
@@ -115,6 +115,7 @@ 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-max98390-objs := max98390.o snd-soc-max9850-objs := max9850.o snd-soc-max9860-objs := max9860.o snd-soc-mc13783-objs := mc13783.o
@@ -415,6 +416,7 @@ 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_MAX98390) += snd-soc-max98390.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/max98390.c new file +1030 -0
1,030 lines not on this page · raw message
sound/soc/codecs/max98390.h new file +663 -0
663 lines not on this page · raw message
Signature · 1 line
2.17.1
Mark Brown
maintainerQuoted 3 lines · Steve Lee
Changes since V2:
* Removed warn massage inmax98390_dsm_calib_getfunc and add comment.
The problem isn't the warning, the problem is that you have an empty operation. You should either implement the function (eg, by caching the value written) or remove it and fix whatever problems you were running into further up the stack when it's missing.
Quoted 11 lines · Mark Brown
Quoted 3 lines · Steve Lee
Changes since V2:
* Removed warn massage inmax98390_dsm_calib_getfunc and add comment.The problem isn't the warning, the problem is that you have an empty operation. You should either implement the function (eg, by caching the value written) or remove it and fix whatever problems you were running into further up the stack when it's missing.
The purpose for the mixer control is: to signal max98390 to start to calibrate from userspace.
Thus,max98390_dsm_calib_get() -> do nothing. max98390_dsm_calib_put() -> call max98390_dsm_calibrate().
Mark Brown
maintainerQuoted 12 lines · Tzung-Bi Shih
Quoted 10 lines · Mark Brown
Quoted 3 lines · Steve Lee
Changes since V2:
* Removed warn massage inmax98390_dsm_calib_getfunc and add comment.The problem isn't the warning, the problem is that you have an empty operation. You should either implement the function (eg, by caching the value written) or remove it and fix whatever problems you were running into further up the stack when it's missing.
Quoted 5 lines
The purpose for the mixer control is: to signal max98390 to start to calibrate from userspace.
Thus,max98390_dsm_calib_get()-> do nothing.max98390_dsm_calib_put()-> callmax98390_dsm_calibrate().
In that case it should probably do something like read back if a callibration is currently running.
Quoted 14 lines · Mark Brown
Quoted 11 lines · Tzung-Bi Shih
Quoted 10 lines · Mark Brown
Quoted 3 lines · Steve Lee
Changes since V2:
* Removed warn massage inmax98390_dsm_calib_getfunc and add comment.The problem isn't the warning, the problem is that you have an empty operation. You should either implement the function (eg, by caching the value written) or remove it and fix whatever problems you were running into further up the stack when it's missing.
Quoted 8 lines
Quoted 5 lines
The purpose for the mixer control is: to signal max98390 to start to calibrate from userspace.
Thus,max98390_dsm_calib_get()-> do nothing.max98390_dsm_calib_put()-> callmax98390_dsm_calibrate().In that case it should probably do something like read back if a callibration is currently running.
Thanks for feedback. I will follow this guide.
sound/soc/codecs/max98390.c line 7
Quoted 9 lines · Steve Lee
+++
b/sound/soc/codecs/max98390.csound/soc/codecs/max98390.c new file +7
-0@@ -0,0 +1,1030 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* max98390.c -- MAX98390 ALSA Soc Audio driver +* +* Copyright (C) 2020 Maxim Integrated Products +* +*/
My previous comments on Gerrit may confuse you. Please use C++ style comments (i.e. // for all lines) here as the maintainer asked.
Mark, may I ask why we need to do so? Is it also applicable to header files?
sound/soc/codecs/max98390.c line 633
Quoted 7 lines
sound/soc/codecs/max98390.c new file +7
-0+static int max98390_dsm_calib_get (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol) +{ +/* Do nothing. */ + +return 0 ; +}
This is an intentional NOP.
sound/soc/codecs/max98390.c line 644
Quoted 10 lines
sound/soc/codecs/max98390.c new file +10
-0+static int max98390_dsm_calib_put (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol) +{ +struct snd_soc_component *component = +snd_soc_kcontrol_component (kcontrol); + +max98390_dsm_calibrate (component); + +return 0 ; +}
Entry point from userspace to start to calibrate.
sound/soc/codecs/max98390.h line 4
Quoted 6 lines
sound/soc/codecs/max98390.h new file +5
-0+++ b/sound/soc/codecs/max98390.h@@ -0,0 +1,663 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) 2020, Maxim Integrated. +*/
I guess these block would also need to use C++ style comment.
Mark Brown
maintainerQuoted 14 lines · Tzung-Bi Shih
sound/soc/codecs/max98390.c line 7
Quoted 9 lines · Steve Lee
+++
b/sound/soc/codecs/max98390.csound/soc/codecs/max98390.c new file +7
-0@@ -0,0 +1,1030 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* max98390.c -- MAX98390 ALSA Soc Audio driver +* +* Copyright (C) 2020 Maxim Integrated Products +* +*/ My previous comments on Gerrit may confuse you. Please use C++ style comments (i.e. // for all lines) here as the maintainer asked.
Quoted 1 line
Mark, may I ask why we need to do so? Is it also applicable to header files?
It's to make things look neater - having the two comments immediately next to each other doesn't look intentional. Header files require a /* */ comment for the SPDX stuff so should do that.