mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
ASLA: sound: Add support for compressed formats
Change enables the compressed format ioctls for ALSA driver clients. Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
This commit is contained in:
parent
09ab9ae7ae
commit
e592653395
5 changed files with 44 additions and 11 deletions
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include <linux/types.h>
|
||||
#include <sound/asound.h>
|
||||
#include <sound/compress_params.h>
|
||||
#include "compress_params.h"
|
||||
|
||||
|
||||
#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 0)
|
||||
|
@ -70,6 +70,7 @@ struct snd_compr_tstamp {
|
|||
snd_pcm_uframes_t pcm_frames;
|
||||
snd_pcm_uframes_t pcm_io_frames;
|
||||
__u32 sampling_rate;
|
||||
uint64_t timestamp;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -51,8 +51,6 @@
|
|||
#ifndef __SND_COMPRESS_PARAMS_H
|
||||
#define __SND_COMPRESS_PARAMS_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/* AUDIO CODECS SUPPORTED */
|
||||
#define MAX_NUM_CODECS 32
|
||||
#define MAX_NUM_CODEC_DESCRIPTORS 32
|
||||
|
@ -72,7 +70,10 @@
|
|||
#define SND_AUDIOCODEC_IEC61937 ((__u32) 0x0000000B)
|
||||
#define SND_AUDIOCODEC_G723_1 ((__u32) 0x0000000C)
|
||||
#define SND_AUDIOCODEC_G729 ((__u32) 0x0000000D)
|
||||
|
||||
#define SND_AUDIOCODEC_AC3 ((__u32) 0x0000000E)
|
||||
#define SND_AUDIOCODEC_DTS ((__u32) 0x0000000F)
|
||||
#define SND_AUDIOCODEC_AC3_PASS_THROUGH ((__u32) 0x00000010)
|
||||
#define SND_AUDIOCODEC_WMA_PRO ((__u32) 0x00000011)
|
||||
/*
|
||||
* Profile and modes are listed with bit masks. This allows for a
|
||||
* more compact representation of fields that will not evolve
|
||||
|
@ -237,6 +238,9 @@
|
|||
|
||||
struct snd_enc_wma {
|
||||
__u32 super_block_align; /* WMA Type-specific data */
|
||||
__u32 bits_per_sample;
|
||||
__u32 channelmask;
|
||||
__u32 encodeopt;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ struct snd_kcontrol_new {
|
|||
snd_ctl_elem_iface_t iface; /* interface identifier */
|
||||
unsigned int device; /* device/client number */
|
||||
unsigned int subdevice; /* subdevice (substream) number */
|
||||
const unsigned char *name; /* ASCII name of item */
|
||||
unsigned char *name; /* ASCII name of item */
|
||||
unsigned int index; /* index of item */
|
||||
unsigned int access; /* access rights */
|
||||
unsigned int count; /* count of same elements */
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* the Free Software Foundation; only version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@ -1030,7 +1029,7 @@ static int snd_interval_ratden(struct snd_interval *i,
|
|||
* Returns non-zero if the value is changed, zero if not changed.
|
||||
*/
|
||||
int snd_interval_list(struct snd_interval *i, unsigned int count,
|
||||
const unsigned int *list, unsigned int mask)
|
||||
unsigned int *list, unsigned int mask)
|
||||
{
|
||||
unsigned int k;
|
||||
struct snd_interval list_range;
|
||||
|
@ -1992,6 +1991,9 @@ static int pcm_sanity_check(struct snd_pcm_substream *substream)
|
|||
struct snd_pcm_runtime *runtime;
|
||||
if (PCM_RUNTIME_CHECK(substream))
|
||||
return -ENXIO;
|
||||
/* TODO: consider and -EINVAL here */
|
||||
if (substream->hw_no_buffer)
|
||||
snd_printd("%s: warning this PCM is host less\n", __func__);
|
||||
runtime = substream->runtime;
|
||||
if (snd_BUG_ON(!substream->ops->copy && !runtime->dma_area))
|
||||
return -EINVAL;
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* the Free Software Foundation; only version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@ -29,6 +28,7 @@
|
|||
#include <linux/dma-mapping.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/control.h>
|
||||
#include <sound/compress_offload.h>
|
||||
#include <sound/info.h>
|
||||
#include <sound/pcm.h>
|
||||
#include <sound/pcm_params.h>
|
||||
|
@ -843,6 +843,7 @@ static int snd_pcm_pre_start(struct snd_pcm_substream *substream, int state)
|
|||
if (runtime->status->state != SNDRV_PCM_STATE_PREPARED)
|
||||
return -EBADFD;
|
||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
|
||||
!substream->hw_no_buffer &&
|
||||
!snd_pcm_playback_data(substream))
|
||||
return -EPIPE;
|
||||
runtime->trigger_master = substream;
|
||||
|
@ -1520,6 +1521,19 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int snd_compressed_ioctl(struct snd_pcm_substream *substream,
|
||||
unsigned int cmd, void __user *arg)
|
||||
{
|
||||
struct snd_pcm_runtime *runtime;
|
||||
int err = 0;
|
||||
|
||||
if (PCM_RUNTIME_CHECK(substream))
|
||||
return -ENXIO;
|
||||
runtime = substream->runtime;
|
||||
pr_debug("%s called with cmd = %d\n", __func__, cmd);
|
||||
err = substream->ops->ioctl(substream, cmd, arg);
|
||||
return err;
|
||||
}
|
||||
/*
|
||||
* drop ioctl
|
||||
*
|
||||
|
@ -2041,6 +2055,12 @@ int snd_pcm_open_substream(struct snd_pcm *pcm, int stream,
|
|||
goto error;
|
||||
}
|
||||
|
||||
if (substream->ops == NULL) {
|
||||
snd_printd("cannot open back end PCMs directly\n");
|
||||
err = -ENODEV;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if ((err = substream->ops->open(substream)) < 0)
|
||||
goto error;
|
||||
|
||||
|
@ -2567,6 +2587,12 @@ static int snd_pcm_common_ioctl1(struct file *file,
|
|||
snd_pcm_stream_unlock_irq(substream);
|
||||
return res;
|
||||
}
|
||||
case SNDRV_COMPRESS_GET_CAPS:
|
||||
case SNDRV_COMPRESS_GET_CODEC_CAPS:
|
||||
case SNDRV_COMPRESS_SET_PARAMS:
|
||||
case SNDRV_COMPRESS_GET_PARAMS:
|
||||
case SNDRV_COMPRESS_TSTAMP:
|
||||
return snd_compressed_ioctl(substream, cmd, arg);
|
||||
}
|
||||
snd_printd("unknown ioctl = 0x%x\n", cmd);
|
||||
return -ENOTTY;
|
||||
|
@ -2739,7 +2765,7 @@ static long snd_pcm_playback_ioctl(struct file *file, unsigned int cmd,
|
|||
|
||||
pcm_file = file->private_data;
|
||||
|
||||
if (((cmd >> 8) & 0xff) != 'A')
|
||||
if ((((cmd >> 8) & 0xff) != 'A') && (((cmd >> 8) & 0xff) != 'C'))
|
||||
return -ENOTTY;
|
||||
|
||||
return snd_pcm_playback_ioctl1(file, pcm_file->substream, cmd,
|
||||
|
|
Loading…
Reference in a new issue