Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 170155
b: refs/heads/master
c: bb26276
h: refs/heads/master
i:
  170153: 5355b44
  170151: f2cdf27
v: v3
  • Loading branch information
Takashi Iwai committed Oct 1, 2009
1 parent 296c76d commit 9f12698
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 95 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aa983d9d63c38f596fb87754205da9b7a8d2f6fd
refs/heads/master: bb26276744a80d066681836f4d49c70010b129d6
1 change: 0 additions & 1 deletion trunk/include/sound/soc-dai.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ struct snd_pcm_substream;
#define SND_SOC_DAIFMT_DSP_A 3 /* L data MSB after FRM LRC */
#define SND_SOC_DAIFMT_DSP_B 4 /* L data MSB during FRM LRC */
#define SND_SOC_DAIFMT_AC97 5 /* AC97 */
#define SND_SOC_DAIFMT_PDM 6 /* Pulse density modulation */

/* left and right justified also known as MSB and LSB respectively */
#define SND_SOC_DAIFMT_MSB SND_SOC_DAIFMT_LEFT_J
Expand Down
7 changes: 4 additions & 3 deletions trunk/sound/soc/codecs/wm8711.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/pm.h>
#include <linux/i2c.h>
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
Expand Down Expand Up @@ -632,9 +633,9 @@ static int __init wm8711_modinit(void)
}
#endif
#if defined(CONFIG_SPI_MASTER)
ret = spi_register_driver(&wm8731_spi_driver);
ret = spi_register_driver(&wm8711_spi_driver);
if (ret != 0) {
printk(KERN_ERR "Failed to register WM8731 SPI driver: %d\n",
printk(KERN_ERR "Failed to register WM8711 SPI driver: %d\n",
ret);
}
#endif
Expand All @@ -648,7 +649,7 @@ static void __exit wm8711_exit(void)
i2c_del_driver(&wm8711_i2c_driver);
#endif
#if defined(CONFIG_SPI_MASTER)
spi_unregister_driver(&wm8731_spi_driver);
spi_unregister_driver(&wm8711_spi_driver);
#endif
}
module_exit(wm8711_exit);
Expand Down
23 changes: 10 additions & 13 deletions trunk/sound/soc/codecs/wm8974.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,38 +281,36 @@ static int wm8974_add_widgets(struct snd_soc_codec *codec)
}

struct pll_ {
unsigned int pre_div:1;
unsigned int pre_div:4; /* prescale - 1 */
unsigned int n:4;
unsigned int k;
};

static struct pll_ pll_div;

/* The size in bits of the pll divide multiplied by 10
* to allow rounding later */
#define FIXED_PLL_SIZE ((1 << 24) * 10)

static void pll_factors(struct pll_ *pll_div,
unsigned int target, unsigned int source)
static void pll_factors(unsigned int target, unsigned int source)
{
unsigned long long Kpart;
unsigned int K, Ndiv, Nmod;

/* There is a fixed divide by 4 in the output path */
target *= 4;

Ndiv = target / source;
if (Ndiv < 6) {
source /= 2;
pll_div->pre_div = 1;
source >>= 1;
pll_div.pre_div = 1;
Ndiv = target / source;
} else
pll_div->pre_div = 0;
pll_div.pre_div = 0;

if ((Ndiv < 6) || (Ndiv > 12))
printk(KERN_WARNING
"WM8974 N value %u outwith recommended range!\n",
Ndiv);

pll_div->n = Ndiv;
pll_div.n = Ndiv;
Nmod = target % source;
Kpart = FIXED_PLL_SIZE * (long long)Nmod;

Expand All @@ -327,14 +325,13 @@ static void pll_factors(struct pll_ *pll_div,
/* Move down to proper range now rounding is done */
K /= 10;

pll_div->k = K;
pll_div.k = K;
}

static int wm8974_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
int source, unsigned int freq_in, unsigned int freq_out)
{
struct snd_soc_codec *codec = codec_dai->codec;
struct pll_ pll_div;
u16 reg;

if (freq_in == 0 || freq_out == 0) {
Expand All @@ -348,7 +345,7 @@ static int wm8974_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
return 0;
}

pll_factors(&pll_div, freq_out, freq_in);
pll_factors(freq_out*4, freq_in);

snd_soc_write(codec, WM8974_PLLN, (pll_div.pre_div << 4) | pll_div.n);
snd_soc_write(codec, WM8974_PLLK1, pll_div.k >> 18);
Expand Down
36 changes: 27 additions & 9 deletions trunk/sound/soc/codecs/wm8993.c
Original file line number Diff line number Diff line change
Expand Up @@ -1572,15 +1572,33 @@ static int wm8993_i2c_probe(struct i2c_client *i2c,
/* Use automatic clock configuration */
snd_soc_update_bits(codec, WM8993_CLOCKING_4, WM8993_SR_MODE, 0);

wm_hubs_handle_analogue_pdata(codec, wm8993->pdata.lineout1_diff,
wm8993->pdata.lineout2_diff,
wm8993->pdata.lineout1fb,
wm8993->pdata.lineout2fb,
wm8993->pdata.jd_scthr,
wm8993->pdata.jd_thr,
wm8993->pdata.micbias1_lvl,
wm8993->pdata.micbias2_lvl);

if (!wm8993->pdata.lineout1_diff)
snd_soc_update_bits(codec, WM8993_LINE_MIXER1,
WM8993_LINEOUT1_MODE,
WM8993_LINEOUT1_MODE);
if (!wm8993->pdata.lineout2_diff)
snd_soc_update_bits(codec, WM8993_LINE_MIXER2,
WM8993_LINEOUT2_MODE,
WM8993_LINEOUT2_MODE);

if (wm8993->pdata.lineout1fb)
snd_soc_update_bits(codec, WM8993_ADDITIONAL_CONTROL,
WM8993_LINEOUT1_FB, WM8993_LINEOUT1_FB);

if (wm8993->pdata.lineout2fb)
snd_soc_update_bits(codec, WM8993_ADDITIONAL_CONTROL,
WM8993_LINEOUT2_FB, WM8993_LINEOUT2_FB);

/* Apply the microphone bias/detection configuration - the
* platform data is directly applicable to the register. */
snd_soc_update_bits(codec, WM8993_MICBIAS,
WM8993_JD_SCTHR_MASK | WM8993_JD_THR_MASK |
WM8993_MICB1_LVL | WM8993_MICB2_LVL,
wm8993->pdata.jd_scthr << WM8993_JD_SCTHR_SHIFT |
wm8993->pdata.jd_thr << WM8993_JD_THR_SHIFT |
wm8993->pdata.micbias1_lvl |
wm8993->pdata.micbias1_lvl << 1);

ret = wm8993_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
if (ret != 0)
goto err;
Expand Down
35 changes: 0 additions & 35 deletions trunk/sound/soc/codecs/wm_hubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,41 +738,6 @@ int wm_hubs_add_analogue_routes(struct snd_soc_codec *codec,
}
EXPORT_SYMBOL_GPL(wm_hubs_add_analogue_routes);

int wm_hubs_handle_analogue_pdata(struct snd_soc_codec *codec,
int lineout1_diff, int lineout2_diff,
int lineout1fb, int lineout2fb,
int jd_scthr, int jd_thr, int micbias1_lvl,
int micbias2_lvl)
{
if (!lineout1_diff)
snd_soc_update_bits(codec, WM8993_LINE_MIXER1,
WM8993_LINEOUT1_MODE,
WM8993_LINEOUT1_MODE);
if (!lineout2_diff)
snd_soc_update_bits(codec, WM8993_LINE_MIXER2,
WM8993_LINEOUT2_MODE,
WM8993_LINEOUT2_MODE);

if (lineout1fb)
snd_soc_update_bits(codec, WM8993_ADDITIONAL_CONTROL,
WM8993_LINEOUT1_FB, WM8993_LINEOUT1_FB);

if (lineout2fb)
snd_soc_update_bits(codec, WM8993_ADDITIONAL_CONTROL,
WM8993_LINEOUT2_FB, WM8993_LINEOUT2_FB);

snd_soc_update_bits(codec, WM8993_MICBIAS,
WM8993_JD_SCTHR_MASK | WM8993_JD_THR_MASK |
WM8993_MICB1_LVL | WM8993_MICB2_LVL,
jd_scthr << WM8993_JD_SCTHR_SHIFT |
jd_thr << WM8993_JD_THR_SHIFT |
micbias1_lvl |
micbias2_lvl << WM8993_MICB2_LVL_SHIFT);

return 0;
}
EXPORT_SYMBOL_GPL(wm_hubs_handle_analogue_pdata);

MODULE_DESCRIPTION("Shared support for Wolfson hubs products");
MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
MODULE_LICENSE("GPL");
5 changes: 0 additions & 5 deletions trunk/sound/soc/codecs/wm_hubs.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,5 @@ extern const unsigned int wm_hubs_spkmix_tlv[];

extern int wm_hubs_add_analogue_controls(struct snd_soc_codec *);
extern int wm_hubs_add_analogue_routes(struct snd_soc_codec *, int, int);
extern int wm_hubs_handle_analogue_pdata(struct snd_soc_codec *,
int lineout1_diff, int lineout2_diff,
int lineout1fb, int lineout2fb,
int jd_scthr, int jd_thr,
int micbias1_lvl, int micbias2_lvl);

#endif
2 changes: 0 additions & 2 deletions trunk/sound/soc/davinci/davinci-i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,6 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream,
}

dma_params->acnt = dma_params->data_type;
dma_params->fifo_level = 0;

rcr |= DAVINCI_MCBSP_RCR_RFRLEN1(1);
xcr |= DAVINCI_MCBSP_XCR_XFRLEN1(1);

Expand Down
17 changes: 10 additions & 7 deletions trunk/sound/soc/davinci/davinci-mcasp.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,13 +714,16 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
struct davinci_pcm_dma_params *dma_params =
&dev->dma_params[substream->stream];
int word_length;
u8 fifo_level;
u8 numevt;

davinci_hw_common_param(dev, substream->stream);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
fifo_level = dev->txnumevt;
numevt = dev->txnumevt;
else
fifo_level = dev->rxnumevt;
numevt = dev->rxnumevt;

if (!numevt)
numevt = 1;

if (dev->op_mode == DAVINCI_MCASP_DIT_MODE)
davinci_hw_dit_param(dev);
Expand Down Expand Up @@ -748,12 +751,12 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
}

if (dev->version == MCASP_VERSION_2 && !fifo_level)
dma_params->acnt = 4;
else
if (dev->version == MCASP_VERSION_2) {
dma_params->data_type *= numevt;
dma_params->acnt = 4 * numevt;
} else
dma_params->acnt = dma_params->data_type;

dma_params->fifo_level = fifo_level;
davinci_config_channel_size(dev, word_length);

return 0;
Expand Down
21 changes: 3 additions & 18 deletions trunk/sound/soc/davinci/davinci-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,53 +66,38 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream)
dma_addr_t dma_pos;
dma_addr_t src, dst;
unsigned short src_bidx, dst_bidx;
unsigned short src_cidx, dst_cidx;
unsigned int data_type;
unsigned short acnt;
unsigned int count;
unsigned int fifo_level;

period_size = snd_pcm_lib_period_bytes(substream);
dma_offset = prtd->period * period_size;
dma_pos = runtime->dma_addr + dma_offset;
fifo_level = prtd->params->fifo_level;

pr_debug("davinci_pcm: audio_set_dma_params_play channel = %d "
"dma_ptr = %x period_size=%x\n", lch, dma_pos, period_size);

data_type = prtd->params->data_type;
count = period_size / data_type;
if (fifo_level)
count /= fifo_level;

if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
src = dma_pos;
dst = prtd->params->dma_addr;
src_bidx = data_type;
dst_bidx = 0;
src_cidx = data_type * fifo_level;
dst_cidx = 0;
} else {
src = prtd->params->dma_addr;
dst = dma_pos;
src_bidx = 0;
dst_bidx = data_type;
src_cidx = 0;
dst_cidx = data_type * fifo_level;
}

acnt = prtd->params->acnt;
edma_set_src(lch, src, INCR, W8BIT);
edma_set_dest(lch, dst, INCR, W8BIT);

edma_set_src_index(lch, src_bidx, src_cidx);
edma_set_dest_index(lch, dst_bidx, dst_cidx);

if (!fifo_level)
edma_set_transfer_params(lch, acnt, count, 1, 0, ASYNC);
else
edma_set_transfer_params(lch, acnt, fifo_level, count,
fifo_level, ABSYNC);
edma_set_src_index(lch, src_bidx, 0);
edma_set_dest_index(lch, dst_bidx, 0);
edma_set_transfer_params(lch, acnt, count, 1, 0, ASYNC);

prtd->period++;
if (unlikely(prtd->period >= runtime->periods))
Expand Down
1 change: 0 additions & 1 deletion trunk/sound/soc/davinci/davinci-pcm.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ struct davinci_pcm_dma_params {
enum dma_event_q eventq_no; /* event queue number */
unsigned char data_type; /* xfer data type */
unsigned char convert_mono_stereo;
unsigned int fifo_level;
};


Expand Down

0 comments on commit 9f12698

Please sign in to comment.