All of lore.kernel.org
 help / color / mirror / Atom feed
From: Annaliese McDermond <nh6z@nh6z.net>
To: broonie@kernel.org, alsa-devel@alsa-project.org
Cc: team@nwdigitalradio.com, Annaliese McDermond <nh6z@nh6z.net>
Subject: [PATCH v2 07/12] ASoC: tlv320aic32x4: Move aosr and dosr setting to separate functions
Date: Tue, 19 Mar 2019 21:51:24 -0700	[thread overview]
Message-ID: <20190320045129.6859-8-nh6z@nh6z.net> (raw)
In-Reply-To: <20190320045129.6859-1-nh6z@nh6z.net>

Move these to separate helper functions.  This looks cleaner and fits
better with the new clock setting in CCF.

Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
---
 sound/soc/codecs/tlv320aic32x4.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c
index b9d0c4a72015..dffabbf7c921 100644
--- a/sound/soc/codecs/tlv320aic32x4.c
+++ b/sound/soc/codecs/tlv320aic32x4.c
@@ -716,6 +716,20 @@ static int aic32x4_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
 	return 0;
 }
 
+static int aic32x4_set_aosr(struct snd_soc_component *component, u8 aosr)
+{
+	return snd_soc_component_write(component, AIC32X4_AOSR, aosr);
+}
+
+static int aic32x4_set_dosr(struct snd_soc_component *component, u16 dosr)
+{
+	snd_soc_component_write(component, AIC32X4_DOSRMSB, dosr >> 8);
+	snd_soc_component_write(component, AIC32X4_DOSRLSB,
+		      (dosr & 0xff));
+
+	return 0;
+}
+
 static int aic32x4_setup_clocks(struct snd_soc_component *component,
 				unsigned int sample_rate,
 				unsigned int parent_rate)
@@ -748,13 +762,8 @@ static int aic32x4_setup_clocks(struct snd_soc_component *component,
 	clk_set_rate(clocks[3].clk, aic32x4_divs[i].ndac_rate);
 	clk_set_rate(clocks[4].clk, aic32x4_divs[i].mdac_rate);
 	clk_set_rate(clocks[5].clk, aic32x4_divs[i].bdiv_rate);
-
-	/* DOSR MSB & LSB values */
-	snd_soc_component_write(component, AIC32X4_DOSRMSB, aic32x4_divs[i].dosr >> 8);
-	snd_soc_component_write(component, AIC32X4_DOSRLSB, (aic32x4_divs[i].dosr & 0xff));
-
-	/* AOSR value */
-	snd_soc_component_write(component, AIC32X4_AOSR, aic32x4_divs[i].aosr);
+	aic32x4_set_aosr(component, aic32x4_divs[i].aosr);
+	aic32x4_set_dosr(component, aic32x4_divs[i].dosr);
 
 	return 0;
 }
-- 
2.19.1

  parent reply	other threads:[~2019-03-20  4:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20  4:51 [PATCH v2 00/12] ASoC: tlv320aic32x4: Rework Clock Setting Annaliese McDermond
2019-03-20  4:51 ` [PATCH v2 01/12] ASoC: tlv320aic32x4: Break out clock setting into separate function Annaliese McDermond
2019-03-20  4:51 ` [PATCH v2 02/12] ASoC: tlv320aic32x4: Model PLL in CCF Annaliese McDermond
2019-03-20  4:51 ` [PATCH v2 03/12] ASoC: tlv320aic32x4: Model CODEC_CLKIN " Annaliese McDermond
2019-03-20  4:51 ` [PATCH v2 04/12] ASoC: tlv320aic32x4: Model DAC/ADC dividers " Annaliese McDermond
2019-03-20  4:51 ` [PATCH v2 05/12] ASoC: tlv320aic32x4: Model BDIV divider " Annaliese McDermond
2019-03-20  4:51 ` [PATCH v2 06/12] ASoC: tlv320aic32x4: Control clock gating with CCF Annaliese McDermond
2019-03-20  4:51 ` Annaliese McDermond [this message]
2019-03-20  4:51 ` [PATCH v2 08/12] ASoC: tlv320aic32x4: Dynamically Determine Clocking Annaliese McDermond
2019-03-20  4:51 ` [PATCH v2 09/12] ASoC: tlv320aic32x4: Restructure set_dai_sysclk Annaliese McDermond
2019-03-20  4:51 ` [PATCH v2 10/12] ASoC: tlv320aic32x4: Remove mclk references Annaliese McDermond
2019-03-20  4:51 ` [PATCH v2 11/12] ASoC: tlv320aic32x4: Propery Set Processing Blocks Annaliese McDermond
2019-03-20  4:51 ` [PATCH v2 12/12] ASoC: tlv320aic32x4: Allow 192000 Sample Rate Annaliese McDermond

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190320045129.6859-8-nh6z@nh6z.net \
    --to=nh6z@nh6z.net \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=team@nwdigitalradio.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.