Skip to content

Commit

Permalink
Merge remote-tracking branches 'asoc/topic/wm8804' and 'asoc/topic/wm…
Browse files Browse the repository at this point in the history
…9713' into asoc-next
  • Loading branch information
Mark Brown committed Jun 3, 2014
3 parents 3253944 + 06109f4 + a7f0b83 commit a2fbbbf
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
17 changes: 14 additions & 3 deletions sound/soc/codecs/wm8804.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ struct wm8804_priv {
struct regmap *regmap;
struct regulator_bulk_data supplies[WM8804_NUM_SUPPLIES];
struct notifier_block disable_nb[WM8804_NUM_SUPPLIES];
int mclk_div;
};

static int txsrc_get(struct snd_kcontrol *kcontrol,
Expand Down Expand Up @@ -318,7 +319,7 @@ static struct {

#define FIXED_PLL_SIZE ((1ULL << 22) * 10)
static int pll_factors(struct pll_div *pll_div, unsigned int target,
unsigned int source)
unsigned int source, unsigned int mclk_div)
{
u64 Kpart;
unsigned long int K, Ndiv, Nmod, tmp;
Expand All @@ -330,7 +331,8 @@ static int pll_factors(struct pll_div *pll_div, unsigned int target,
*/
for (i = 0; i < ARRAY_SIZE(post_table); i++) {
tmp = target * post_table[i].div;
if (tmp >= 90000000 && tmp <= 100000000) {
if ((tmp >= 90000000 && tmp <= 100000000) &&
(mclk_div == post_table[i].mclkdiv)) {
pll_div->freqmode = post_table[i].freqmode;
pll_div->mclkdiv = post_table[i].mclkdiv;
target *= post_table[i].div;
Expand Down Expand Up @@ -387,8 +389,12 @@ static int wm8804_set_pll(struct snd_soc_dai *dai, int pll_id,
} else {
int ret;
struct pll_div pll_div;
struct wm8804_priv *wm8804;

ret = pll_factors(&pll_div, freq_out, freq_in);
wm8804 = snd_soc_codec_get_drvdata(codec);

ret = pll_factors(&pll_div, freq_out, freq_in,
wm8804->mclk_div);
if (ret)
return ret;

Expand Down Expand Up @@ -452,13 +458,18 @@ static int wm8804_set_clkdiv(struct snd_soc_dai *dai,
int div_id, int div)
{
struct snd_soc_codec *codec;
struct wm8804_priv *wm8804;

codec = dai->codec;
switch (div_id) {
case WM8804_CLKOUT_DIV:
snd_soc_update_bits(codec, WM8804_PLL5, 0x30,
(div & 0x3) << 4);
break;
case WM8804_MCLK_DIV:
wm8804 = snd_soc_codec_get_drvdata(codec);
wm8804->mclk_div = div;
break;
default:
dev_err(dai->dev, "Unknown clock divider: %d\n", div_id);
return -EINVAL;
Expand Down
4 changes: 4 additions & 0 deletions sound/soc/codecs/wm8804.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,9 @@
#define WM8804_CLKOUT_SRC_OSCCLK 4

#define WM8804_CLKOUT_DIV 1
#define WM8804_MCLK_DIV 2

#define WM8804_MCLKDIV_256FS 0
#define WM8804_MCLKDIV_128FS 1

#endif /* _WM8804_H */
3 changes: 1 addition & 2 deletions sound/soc/codecs/wm9713.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ static const char *wm9713_rec_src[] =
"Mono Out", "Zh"};
static const char *wm9713_rec_gain[] = {"+1.5dB Steps", "+0.75dB Steps"};
static const char *wm9713_alc_select[] = {"None", "Left", "Right", "Stereo"};
static const char *wm9713_mono_pga[] = {"Vmid", "Zh", "Mono", "Inv",
"Mono Vmid", "Inv Vmid"};
static const char *wm9713_mono_pga[] = {"Vmid", "Zh", "Mono", "Inv"};
static const char *wm9713_spk_pga[] =
{"Vmid", "Zh", "Headphone", "Speaker", "Inv", "Headphone Vmid",
"Speaker Vmid", "Inv Vmid"};
Expand Down

0 comments on commit a2fbbbf

Please sign in to comment.