[PATCH 0/3] Make genaral and simple for new sof machine driver
The series of features will make general and simple for new sof machine driver.
David Lin (3): ASoC: nau8825: add set_jack coponment support ASoC: nau8825: add disable jack detection support ASoC: nau8825: add clock management for power saving
sound/soc/codecs/nau8825.c | 49 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-)
Use set_jack ops to set jack for new machine drivers. Meanwhile, the old machine drivers can still call previous export function "nau8825_enable_jack_detect".
Co-Developed-by: Mac Chiang mac.chiang@intel.com Signed-off-by: David Lin CTLIN0@nuvoton.com --- sound/soc/codecs/nau8825.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c index 67de0e49ccf4..c845f19b7c41 100644 --- a/sound/soc/codecs/nau8825.c +++ b/sound/soc/codecs/nau8825.c @@ -2416,6 +2416,12 @@ static int __maybe_unused nau8825_resume(struct snd_soc_component *component) return 0; }
+static int nau8825_set_jack(struct snd_soc_component *component, + struct snd_soc_jack *jack, void *data) +{ + return nau8825_enable_jack_detect(component, jack); +} + static const struct snd_soc_component_driver nau8825_component_driver = { .probe = nau8825_component_probe, .remove = nau8825_component_remove, @@ -2430,6 +2436,7 @@ static const struct snd_soc_component_driver nau8825_component_driver = { .num_dapm_widgets = ARRAY_SIZE(nau8825_dapm_widgets), .dapm_routes = nau8825_dapm_routes, .num_dapm_routes = ARRAY_SIZE(nau8825_dapm_routes), + .set_jack = nau8825_set_jack, .suspend_bias_off = 1, .idle_bias_on = 1, .use_pmdown_time = 1,
On 10/26/21 4:38 AM, David Lin wrote:
Use set_jack ops to set jack for new machine drivers. Meanwhile, the old machine drivers can still call previous export function "nau8825_enable_jack_detect".
Co-Developed-by: Mac Chiang mac.chiang@intel.com
if you use the Co-developed-by: tag (no capital letter after 'C'), you still need to provide your Signed-off-by: tag
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#when-...
same comment for the 2 other patches in this series.
Signed-off-by: David Lin CTLIN0@nuvoton.com
sound/soc/codecs/nau8825.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c index 67de0e49ccf4..c845f19b7c41 100644 --- a/sound/soc/codecs/nau8825.c +++ b/sound/soc/codecs/nau8825.c @@ -2416,6 +2416,12 @@ static int __maybe_unused nau8825_resume(struct snd_soc_component *component) return 0; }
+static int nau8825_set_jack(struct snd_soc_component *component,
struct snd_soc_jack *jack, void *data)
+{
- return nau8825_enable_jack_detect(component, jack);
+}
static const struct snd_soc_component_driver nau8825_component_driver = { .probe = nau8825_component_probe, .remove = nau8825_component_remove, @@ -2430,6 +2436,7 @@ static const struct snd_soc_component_driver nau8825_component_driver = { .num_dapm_widgets = ARRAY_SIZE(nau8825_dapm_widgets), .dapm_routes = nau8825_dapm_routes, .num_dapm_routes = ARRAY_SIZE(nau8825_dapm_routes),
- .set_jack = nau8825_set_jack, .suspend_bias_off = 1, .idle_bias_on = 1, .use_pmdown_time = 1,
On Tue, Oct 26, 2021 at 12:35:33PM -0500, Pierre-Louis Bossart wrote:
On 10/26/21 4:38 AM, David Lin wrote:
Use set_jack ops to set jack for new machine drivers. Meanwhile, the old machine drivers can still call previous export function "nau8825_enable_jack_detect".
Co-Developed-by: Mac Chiang mac.chiang@intel.com
if you use the Co-developed-by: tag (no capital letter after 'C'), you still need to provide your Signed-off-by: tag
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#when-...
same comment for the 2 other patches in this series.
Signed-off-by: David Lin CTLIN0@nuvoton.com
The signoff is there AFAICT?
Co-Developed-by: Mac Chiang mac.chiang@intel.com
if you use the Co-developed-by: tag (no capital letter after 'C'), you still need to provide your Signed-off-by: tag
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#when-...
same comment for the 2 other patches in this series.
Signed-off-by: David Lin CTLIN0@nuvoton.com
The signoff is there AFAICT?
I meant the Signed-off-by: tag of the first co-developer. The rule is:
" Since Co-developed-by: denotes authorship, every Co-developed-by: must be immediately followed by a Signed-off-by: of the associated co-author. "
so each patch should be tagged as follows:
Co-developed-by: Mac Chiang mac.chiang@intel.com Signed-off-by: Mac Chiang mac.chiang@intel.com Signed-off-by: David Lin CTLIN0@nuvoton.com
On Tue, Oct 26, 2021 at 01:53:56PM -0500, Pierre-Louis Bossart wrote:
Signed-off-by: David Lin CTLIN0@nuvoton.com
The signoff is there AFAICT?
I meant the Signed-off-by: tag of the first co-developer. The rule is:
" Since Co-developed-by: denotes authorship, every Co-developed-by: must be immediately followed by a Signed-off-by: of the associated co-author. "
so each patch should be tagged as follows:
Co-developed-by: Mac Chiang mac.chiang@intel.com Signed-off-by: Mac Chiang mac.chiang@intel.com Signed-off-by: David Lin CTLIN0@nuvoton.com
Oh, that makes the whole thing seem substantially less purposeful than I'd though. David, please update to reflect this.
On 2021/10/27 上午 03:05, Mark Brown wrote:
On Tue, Oct 26, 2021 at 01:53:56PM -0500, Pierre-Louis Bossart wrote:
Signed-off-by: David Lin CTLIN0@nuvoton.com
The signoff is there AFAICT?
I meant the Signed-off-by: tag of the first co-developer. The rule is:
" Since Co-developed-by: denotes authorship, every Co-developed-by: must be immediately followed by a Signed-off-by: of the associated co-author. " so each patch should be tagged as follows: Co-developed-by: Mac Chiang mac.chiang@intel.com Signed-off-by: Mac Chiang mac.chiang@intel.com Signed-off-by: David Lin CTLIN0@nuvoton.com
Oh, that makes the whole thing seem substantially less purposeful than I'd though. David, please update to reflect this.
I appreciate your guide very much. I'll send patch again.
________________________________ ________________________________ The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton.
A feature for disabling jack detection support.
Co-Developed-by: Mac Chiang mac.chiang@intel.com Signed-off-by: David Lin CTLIN0@nuvoton.com --- sound/soc/codecs/nau8825.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c index c845f19b7c41..a356f26735bd 100644 --- a/sound/soc/codecs/nau8825.c +++ b/sound/soc/codecs/nau8825.c @@ -1434,6 +1434,13 @@ int nau8825_enable_jack_detect(struct snd_soc_component *component,
nau8825->jack = jack;
+ if (!nau8825->jack) { + regmap_update_bits(regmap, NAU8825_REG_HSD_CTRL, + NAU8825_HSD_AUTO_MODE | NAU8825_SPKR_DWN1R | + NAU8825_SPKR_DWN1L, 0); + return 0; + } + /* Ground HP Outputs[1:0], needed for headset auto detection * Enable Automatic Mic/Gnd switching reading on insert interrupt[6] */
Adjust dapm widget to manage clock from power event for power saving.
Co-Developed-by: Mac Chiang mac.chiang@intel.com Signed-off-by: David Lin CTLIN0@nuvoton.com --- sound/soc/codecs/nau8825.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c index a356f26735bd..eed017d5df4b 100644 --- a/sound/soc/codecs/nau8825.c +++ b/sound/soc/codecs/nau8825.c @@ -47,6 +47,7 @@
static int nau8825_configure_sysclk(struct nau8825 *nau8825, int clk_id, unsigned int freq); +static bool nau8825_is_jack_inserted(struct regmap *regmap);
struct nau8825_fll { int mclk_src; @@ -981,6 +982,31 @@ static int nau8825_output_dac_event(struct snd_soc_dapm_widget *w, return 0; }
+static int system_clock_control(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *k, int event) +{ + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct nau8825 *nau8825 = snd_soc_component_get_drvdata(component); + struct regmap *regmap = nau8825->regmap; + + if (SND_SOC_DAPM_EVENT_OFF(event)) { + dev_dbg(nau8825->dev, "system clock control : POWER OFF\n"); + /* Set clock source to disable or internal clock before the + * playback or capture end. Codec needs clock for Jack + * detection and button press if jack inserted; otherwise, + * the clock should be closed. + */ + if (nau8825_is_jack_inserted(regmap)) { + nau8825_configure_sysclk(nau8825, + NAU8825_CLK_INTERNAL, 0); + } else { + nau8825_configure_sysclk(nau8825, NAU8825_CLK_DIS, 0); + } + } + + return 0; +} + static int nau8825_biq_coeff_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { @@ -1094,6 +1120,9 @@ static const struct snd_kcontrol_new nau8825_dacr_mux = static const struct snd_soc_dapm_widget nau8825_dapm_widgets[] = { SND_SOC_DAPM_AIF_OUT("AIFTX", "Capture", 0, NAU8825_REG_I2S_PCM_CTRL2, 15, 1), + SND_SOC_DAPM_AIF_IN("AIFRX", "Playback", 0, SND_SOC_NOPM, 0, 0), + SND_SOC_DAPM_SUPPLY("System Clock", SND_SOC_NOPM, 0, 0, + system_clock_control, SND_SOC_DAPM_POST_PMD),
SND_SOC_DAPM_INPUT("MIC"), SND_SOC_DAPM_MICBIAS("MICBIAS", NAU8825_REG_MIC_BIAS, 8, 0), @@ -1182,9 +1211,11 @@ static const struct snd_soc_dapm_route nau8825_dapm_routes[] = { {"ADC", NULL, "ADC Clock"}, {"ADC", NULL, "ADC Power"}, {"AIFTX", NULL, "ADC"}, + {"AIFTX", NULL, "System Clock"},
- {"DDACL", NULL, "Playback"}, - {"DDACR", NULL, "Playback"}, + {"AIFRX", NULL, "System Clock"}, + {"DDACL", NULL, "AIFRX"}, + {"DDACR", NULL, "AIFRX"}, {"DDACL", NULL, "DDAC Clock"}, {"DDACR", NULL, "DDAC Clock"}, {"DACL Mux", "DACL", "DDACL"},
On Tue, 26 Oct 2021 17:38:25 +0800, David Lin wrote:
The series of features will make general and simple for new sof machine driver.
David Lin (3): ASoC: nau8825: add set_jack coponment support ASoC: nau8825: add disable jack detection support ASoC: nau8825: add clock management for power saving
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/3] ASoC: nau8825: add set_jack coponment support commit: c6167e10e76fb97d37613004046e66027b3a569b [2/3] ASoC: nau8825: add disable jack detection support (no commit info) [3/3] ASoC: nau8825: add clock management for power saving commit: 6133148ca08a097ed8c57d7f5a7826723273049b
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
participants (4)
-
AS50 CTLin0
-
David Lin
-
Mark Brown
-
Pierre-Louis Bossart