[Meego-kernel] [PATCH 02/10] Audio: Audio driver uses reworked PCM interface
Koul, Vinod
vinod.koul
Mon Sep 27 02:44:23 PDT 2010
>From a6848e2fef3f7571d494b5441499a7016338ff7b Mon Sep 17 00:00:00 2001
From: Vinod Koul <vinod.koul at intel.com>
Date: Wed, 22 Sep 2010 16:10:17 +0530
Subject: [PATCH 02/10] Audio: Audio driver uses reworked PCM interface
The patchs changes the intel MID sound card for the new SST driver
PCM open close and cmd interface.
Signed-off-by: Vinod Koul <vinod.koul at intel.com>
---
sound/pci/sst/intelmid.c | 38 +++++++++++++-------------------
sound/pci/sst/intelmid_ctrl.c | 14 +++++-------
sound/pci/sst/intelmid_msic_control.c | 1 -
sound/pci/sst/intelmid_pvt.c | 11 +++------
4 files changed, 26 insertions(+), 38 deletions(-)
diff --git a/sound/pci/sst/intelmid.c b/sound/pci/sst/intelmid.c
index a8e37c7..19e0a58 100644
--- a/sound/pci/sst/intelmid.c
+++ b/sound/pci/sst/intelmid.c
@@ -36,7 +36,6 @@
#include <sound/pcm_params.h>
#include <sound/initval.h>
#include <sound/intel_sst.h>
-#include <sound/intel_sst_ioctl.h>
#include "intelmid_snd_control.h"
#include "intelmid.h"
@@ -101,12 +100,10 @@ static struct snd_pcm_hardware snd_intelmad_stream = {
static int snd_intelmad_pcm_trigger(struct snd_pcm_substream *substream,
int cmd)
{
- int ret_val = 0;
+ int ret_val = 0, str_id;
struct snd_intelmad *intelmaddata;
struct mad_stream_pvt *stream;
- /*struct stream_buffer buffer_to_sst;*/
-
-
+ struct intel_sst_pcm_control *sst_ops;
WARN_ON(!substream);
@@ -115,38 +112,35 @@ static int snd_intelmad_pcm_trigger(struct snd_pcm_substream *substream,
WARN_ON(!intelmaddata->sstdrv_ops);
WARN_ON(!intelmaddata->sstdrv_ops->scard_ops);
+ sst_ops = intelmaddata->sstdrv_ops->pcm_control;
+ str_id = stream->stream_info.str_id;
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
pr_debug("sst: Trigger Start\n");
- ret_val = intelmaddata->sstdrv_ops->control_set(SST_SND_START,
- &stream->stream_info.str_id);
+ ret_val = sst_ops->device_control(SST_SND_START, &str_id);
if (ret_val)
return ret_val;
stream->stream_status = RUNNING;
stream->substream = substream;
- stream->stream_status = RUNNING;
break;
case SNDRV_PCM_TRIGGER_STOP:
pr_debug("sst: in stop\n");
- ret_val = intelmaddata->sstdrv_ops->control_set(SST_SND_DROP,
- &stream->stream_info.str_id);
+ ret_val = sst_ops->device_control(SST_SND_DROP, &str_id);
if (ret_val)
return ret_val;
stream->stream_status = DROPPED;
break;
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
pr_debug("sst: in pause\n");
- ret_val = intelmaddata->sstdrv_ops->control_set(SST_SND_PAUSE,
- &stream->stream_info.str_id);
+ ret_val = sst_ops->device_control(SST_SND_PAUSE, &str_id);
if (ret_val)
return ret_val;
stream->stream_status = PAUSED;
break;
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
pr_debug("sst: in pause release\n");
- ret_val = intelmaddata->sstdrv_ops->control_set(SST_SND_RESUME,
- &stream->stream_info.str_id);
+ ret_val = sst_ops->device_control(SST_SND_RESUME, &str_id);
if (ret_val)
return ret_val;
stream->stream_status = RUNNING;
@@ -181,8 +175,8 @@ static int snd_intelmad_pcm_prepare(struct snd_pcm_substream *substream)
if (stream->stream_info.str_id) {
pr_debug("sst: Prepare called for already set stream\n");
- ret_val = intelmaddata->sstdrv_ops->control_set(SST_SND_DROP,
- &stream->stream_info.str_id);
+ ret_val = intelmaddata->sstdrv_ops->pcm_control->device_control(
+ SST_SND_DROP, &stream->stream_info.str_id);
return ret_val;
}
@@ -250,8 +244,8 @@ static snd_pcm_uframes_t snd_intelmad_pcm_pointer
if (stream->stream_status == INIT)
return 0;
- ret_val = intelmaddata->sstdrv_ops->control_set(SST_SND_BUFFER_POINTER,
- &stream->stream_info);
+ ret_val = intelmaddata->sstdrv_ops->pcm_control->device_control(
+ SST_SND_BUFFER_POINTER, &stream->stream_info);
if (ret_val) {
pr_err("sst: error code = 0x%x\n", ret_val);
return ret_val;
@@ -277,20 +271,20 @@ static int snd_intelmad_close(struct snd_pcm_substream *substream)
{
struct snd_intelmad *intelmaddata;
struct mad_stream_pvt *stream;
- int ret_val = 0;
+ int ret_val = 0, str_id;
WARN_ON(!substream);
stream = substream->runtime->private_data;
+ str_id = stream->stream_info.str_id;
- pr_debug("sst: snd_intelmad_close called\n");
+ pr_debug("sst: snd_intelmad_close called for %d\n", str_id);
intelmaddata = snd_pcm_substream_chip(substream);
pr_debug("sst: str id = %d\n", stream->stream_info.str_id);
if (stream->stream_info.str_id) {
/* SST API to actually stop/free the stream */
- ret_val = intelmaddata->sstdrv_ops->control_set(SST_SND_FREE,
- &stream->stream_info.str_id);
+ ret_val = intelmaddata->sstdrv_ops->pcm_control->close(str_id);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
intelmaddata->playback_cnt--;
else
diff --git a/sound/pci/sst/intelmid_ctrl.c b/sound/pci/sst/intelmid_ctrl.c
index a85cc6c..105606e 100644
--- a/sound/pci/sst/intelmid_ctrl.c
+++ b/sound/pci/sst/intelmid_ctrl.c
@@ -28,7 +28,6 @@
#include <sound/control.h>
#include <sound/jack.h>
#include <sound/intel_sst.h>
-#include <sound/intel_sst_ioctl.h>
#include "intelmid_snd_control.h"
#include "intelmid.h"
@@ -491,6 +490,7 @@ static int snd_intelmad_device_set(struct snd_kcontrol *kcontrol,
struct snd_intelmad *intelmaddata;
struct snd_pmic_ops *scard_ops;
int ret_val = 0, vendor, status;
+ struct intel_sst_pcm_control *pcm_control;
pr_debug("sst: snd_intelmad_device_set called\n");
@@ -518,15 +518,13 @@ static int snd_intelmad_device_set(struct snd_kcontrol *kcontrol,
case INPUT_SEL:
vendor = intelmaddata->sstdrv_ops->vendor_id;
if ((vendor == SND_MX) || (vendor == SND_FS)) {
- if (uval->value.enumerated.item[0] == HS_MIC) {
+ pcm_control = intelmaddata->sstdrv_ops->pcm_control;
+ if (uval->value.enumerated.item[0] == HS_MIC)
status = 1;
- intelmaddata->sstdrv_ops->
- control_set(SST_ENABLE_RX_TIME_SLOT, &status);
- } else {
+ else
status = 0;
- intelmaddata->sstdrv_ops->
- control_set(SST_ENABLE_RX_TIME_SLOT, &status);
- }
+ pcm_control->device_control(
+ SST_ENABLE_RX_TIME_SLOT, &status);
}
ret_val = scard_ops->set_input_dev(
uval->value.enumerated.item[0]);
diff --git a/sound/pci/sst/intelmid_msic_control.c b/sound/pci/sst/intelmid_msic_control.c
index dfd9cc1..8b48746 100644
--- a/sound/pci/sst/intelmid_msic_control.c
+++ b/sound/pci/sst/intelmid_msic_control.c
@@ -27,7 +27,6 @@
#include <linux/pci.h>
#include <linux/file.h>
#include <sound/intel_sst.h>
-#include <sound/intel_sst_ioctl.h>
#include "intelmid_snd_control.h"
static int msic_init_card(void)
diff --git a/sound/pci/sst/intelmid_pvt.c b/sound/pci/sst/intelmid_pvt.c
index 0adefc4..4e20750 100644
--- a/sound/pci/sst/intelmid_pvt.c
+++ b/sound/pci/sst/intelmid_pvt.c
@@ -30,7 +30,6 @@
#include <sound/pcm.h>
#include <sound/jack.h>
#include <sound/intel_sst.h>
-#include <sound/intel_sst_ioctl.h>
#include "intelmid_snd_control.h"
#include "intelmid.h"
@@ -92,10 +91,8 @@ int snd_intelmad_alloc_stream(struct snd_pcm_substream *substream)
pr_debug("sst: Capture stream,Device %d\n", stream->device);
}
str_params.device_type = stream->device;
- ret_val = intelmaddata->sstdrv_ops->control_set(SST_SND_ALLOC,
- &str_params);
- pr_debug("sst: SST_SND_PLAY/CAPTURE ret_val = %x\n",
- ret_val);
+ ret_val = intelmaddata->sstdrv_ops->pcm_control->open(&str_params);
+ pr_debug("sst: SST_SND_PLAY/CAPTURE ret_val = %x\n", ret_val);
if (ret_val < 0)
return ret_val;
@@ -118,8 +115,8 @@ int snd_intelmad_init_stream(struct snd_pcm_substream *substream)
stream->stream_info.mad_substream = substream;
stream->stream_info.buffer_ptr = 0;
stream->stream_info.sfreq = substream->runtime->rate;
- ret_val = intelmaddata->sstdrv_ops->control_set(SST_SND_STREAM_INIT,
- &stream->stream_info);
+ ret_val = intelmaddata->sstdrv_ops->pcm_control->device_control(
+ SST_SND_STREAM_INIT, &stream->stream_info);
if (ret_val)
pr_err("sst: control_set ret error %d\n", ret_val);
return ret_val;
--
1.6.6.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Audio-Audio-driver-uses-reworked-PCM-interface.patch
Type: application/octet-stream
Size: 8072 bytes
Desc: 0002-Audio-Audio-driver-uses-reworked-PCM-interface.patch
URL: <http://lists.meego.com/pipermail/meego-kernel/attachments/20100927/047c91b8/attachment-0001.obj>
More information about the Meego-kernel
mailing list