Revert "ASoC: msm: Flexible period size for pcm playback"

This reverts commit 2c0066767d.
This commit is contained in:
Iliyan Malchev 2013-03-29 11:08:39 -07:00 committed by Artem Borisov
parent c071c08a01
commit 796ae158b5

View file

@ -39,12 +39,11 @@ struct snd_msm {
struct snd_pcm *pcm;
};
#define PLAYBACK_NUM_PERIODS 8
#define PLAYBACK_MAX_PERIOD_SIZE 4096
#define PLAYBACK_MIN_PERIOD_SIZE 1024
#define CAPTURE_NUM_PERIODS 2
#define CAPTURE_MAX_PERIOD_SIZE 4096
#define CAPTURE_MIN_PERIOD_SIZE 320
#define PLAYBACK_NUM_PERIODS 8
#define PLAYBACK_PERIOD_SIZE 2048
#define CAPTURE_NUM_PERIODS 2
#define CAPTURE_MAX_PERIOD_SIZE 4096
#define CAPTURE_MIN_PERIOD_SIZE 320
static struct snd_pcm_hardware msm_pcm_hardware_capture = {
.info = (SNDRV_PCM_INFO_MMAP |
@ -78,9 +77,9 @@ static struct snd_pcm_hardware msm_pcm_hardware_playback = {
.rate_max = 48000,
.channels_min = 1,
.channels_max = 2,
.buffer_bytes_max = PLAYBACK_NUM_PERIODS * PLAYBACK_MAX_PERIOD_SIZE,
.period_bytes_min = PLAYBACK_MIN_PERIOD_SIZE,
.period_bytes_max = PLAYBACK_MAX_PERIOD_SIZE,
.buffer_bytes_max = PLAYBACK_NUM_PERIODS * PLAYBACK_PERIOD_SIZE,
.period_bytes_min = PLAYBACK_PERIOD_SIZE,
.period_bytes_max = PLAYBACK_PERIOD_SIZE,
.periods_min = PLAYBACK_NUM_PERIODS,
.periods_max = PLAYBACK_NUM_PERIODS,
.fifo_size = 0,
@ -363,17 +362,6 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
pr_err("snd_pcm_hw_constraint_integer failed\n");
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
ret = snd_pcm_hw_constraint_minmax(runtime,
SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
PLAYBACK_NUM_PERIODS * PLAYBACK_MIN_PERIOD_SIZE,
PLAYBACK_NUM_PERIODS * PLAYBACK_MAX_PERIOD_SIZE);
if (ret < 0) {
pr_err("constraint for buffer bytes min max ret = %d\n",
ret);
}
}
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
ret = snd_pcm_hw_constraint_minmax(runtime,
SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
@ -680,10 +668,18 @@ static int msm_pcm_hw_params(struct snd_pcm_substream *substream,
prtd->session_id, substream->stream);
}
ret = q6asm_audio_client_buf_alloc_contiguous(dir,
if (dir == OUT) {
ret = q6asm_audio_client_buf_alloc_contiguous(dir,
prtd->audio_client,
(params_buffer_bytes(params) / params_periods(params)),
params_periods(params));
params_periods(params));
} else {
ret = q6asm_audio_client_buf_alloc_contiguous(dir,
prtd->audio_client,
runtime->hw.period_bytes_min,
runtime->hw.periods_max);
}
if (ret < 0) {
pr_err("Audio Start: Buffer Allocation failed \
rc = %d\n", ret);
@ -700,7 +696,10 @@ static int msm_pcm_hw_params(struct snd_pcm_substream *substream,
dma_buf->area = buf[0].data;
dma_buf->addr = buf[0].phys;
dma_buf->bytes = runtime->hw.buffer_bytes_max;
dma_buf->bytes = params_buffer_bytes(params);
if (dir == IN)
dma_buf->bytes = runtime->hw.buffer_bytes_max;
else
dma_buf->bytes = params_buffer_bytes(params);
if (!dma_buf->area)
return -ENOMEM;