From: Troy Kisky <troy.kisky@boundarydevices.com>
To: alsa-devel@alsa-project.org
Cc: arunks@mistralsolutions.com, broonie@sirena.org.uk,
Troy Kisky <troy.kisky@boundarydevices.com>
Subject: [PATCH 1/1] [ALSA] ASoC: TLV320AIC23B Support more sample rates
Date: Thu, 6 Nov 2008 16:11:08 -0700 [thread overview]
Message-ID: <1226013068-22508-1-git-send-email-troy.kisky@boundarydevices.com> (raw)
In-Reply-To: <20081105220550.GA29007@sirena.org.uk>
Add support for more sample rates, different crystals
and split playback/capture rates.
Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Mark, this is an incremental patch to the #ifdef DEBUG version
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
index 0096842..8a9ef21 100644
--- a/sound/soc/codecs/tlv320aic23.c
+++ b/sound/soc/codecs/tlv320aic23.c
@@ -301,30 +301,25 @@ static const unsigned char sr_dac_mult_table[] = {
A(2), A(11), A(2), A(11), A(0), A(0), A(0), A(1)
};
-unsigned get_score(int adc, int adc_l, int adc_h, int need_adc,
+static unsigned get_score(int adc, int adc_l, int adc_h, int need_adc,
int dac, int dac_l, int dac_h, int need_dac)
{
if ((adc >= adc_l) && (adc <= adc_h) &&
(dac >= dac_l) && (dac <= dac_h)) {
- unsigned diff_adc = need_adc - adc;
- unsigned diff_dac = need_dac - dac;
- unsigned score;
- if (((int)diff_adc) < 0)
- diff_adc = -diff_adc;
- if (((int)diff_dac) < 0)
- diff_dac = -diff_dac;
- score = diff_adc + diff_dac;
- return score;
+ int diff_adc = need_adc - adc;
+ int diff_dac = need_dac - dac;
+ return abs(diff_adc) + abs(diff_dac);
}
- return 0xffffffff;
+ return UINT_MAX;
}
-int find_rate(int mclk, u32 need_adc, u32 need_dac)
+
+static int find_rate(int mclk, u32 need_adc, u32 need_dac)
{
int i, j;
int best_i = -1;
int best_j = -1;
int best_div = 0;
- unsigned best_score = 0xffffffff;
+ unsigned best_score = UINT_MAX;
int adc_l, adc_h, dac_l, dac_h;
need_adc *= SR_MULT;
@@ -359,7 +354,7 @@ int find_rate(int mclk, u32 need_adc, u32 need_dac)
score = get_score((adc >> 1), adc_l, adc_h, need_adc,
(dac >> 1), dac_l, dac_h, need_dac);
/* prefer to have a /2 */
- if ((score != 0xffffffff) && (best_score >= score)) {
+ if ((score != UINT_MAX) && (best_score >= score)) {
best_score = score;
best_i = i;
best_j = j;
--
1.5.4.3
next prev parent reply other threads:[~2008-11-06 23:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-05 18:52 [PATCH 0/4] ASoC updates Mark Brown
2008-11-05 18:53 ` [PATCH 1/4] ASoC: TLV320AIC23B Support more sample rates Mark Brown
2008-11-05 18:53 ` [PATCH 2/4] ASoC: Add Palm/PXA27x unified ASoC audio driver Mark Brown
2008-11-05 18:53 ` [PATCH 3/4] ASoC: Remove core version number Mark Brown
2008-11-05 18:53 ` [PATCH 4/4] ASoC: Add new parameter to s3c24xx_pcm_enqueue Mark Brown
2008-11-05 19:35 ` [PATCH 2/4] ASoC: Add Palm/PXA27x unified ASoC audio driver Marek Vasut
2008-11-05 20:35 ` Takashi Iwai
2008-11-05 21:54 ` Mark Brown
2008-11-05 20:35 ` [PATCH 1/4] ASoC: TLV320AIC23B Support more sample rates Takashi Iwai
2008-11-05 22:05 ` Mark Brown
2008-11-06 23:11 ` Troy Kisky [this message]
2008-11-07 14:10 ` [PATCH 1/1] [ALSA] " Mark Brown
2008-11-06 10:49 ` [PATCH 1/4] " Mark Brown
2008-11-06 11:03 ` Takashi Iwai
2008-11-06 11:23 ` Takashi Iwai
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=1226013068-22508-1-git-send-email-troy.kisky@boundarydevices.com \
--to=troy.kisky@boundarydevices.com \
--cc=alsa-devel@alsa-project.org \
--cc=arunks@mistralsolutions.com \
--cc=broonie@sirena.org.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox