sst: remove rest of aava bits and aava related code
PATCH 1/7 sst: remove rest of aava bits and aava related code
From: Vinod Koul <[email protected]>
This removes the remaining bit of aava dependent and related bits from driver
---
drivers/staging/intel_sst/intelmid.h | 5 -- drivers/staging/intel_sst/intelmid_v1_control.c | 50 ----------------------- drivers/staging/intel_sst/intelmid_v2_control.c | 2 - 3 files changed, 1 insertions(+), 56 deletions(-)
drivers/staging/intel_sst/intelmid.h +0 -5
@@ -178,9 +178,4 @@ extern struct snd_kcontrol_new snd_intelmad_controls_mrst[];extern struct snd_kcontrol_new snd_intelmad_controls_mfld[];extern struct snd_pmic_ops *intelmad_vendor_ops[]; -/* This is an enabler hook as the platform detection logic isn't yet -present and depends on some firmware and DMI support to detect AAVA -devices. It will vanish once the AAVA platform support is merged */ -#define is_aava () 0 -#endif /* __INTELMID_H */
drivers/staging/intel_sst/intelmid_v1_control.c +0 -50
56 lines not on this page · raw message
drivers/staging/intel_sst/intelmid_v2_control.c +1 -1
@@ -871,7 +871,7 @@ static int nc_set_selected_input_dev(u8 value) sc_access[2 ].mask =MASK6 ; sc_access[3 ].reg_addr =0x109 ; sc_access[3 ].mask =MASK6 ; - sc_access[3 ].value =0x40 ; + sc_access[3 ].value =0x00 ; num_val =4 ;break ;default :
PATCH 2/7 sst: Change the SST driver PCM interface
From: Vinod Koul <[email protected]>
The PCM interface in SST driver is cmds only, this patch changes the interface to open, close and cmd interface. This allows SST driver to keep easy track of handles open
---
drivers/staging/intel_sst/intel_sst.h | 8 + .../staging/intel_sst/intel_sst_app_interface.c | 25 +++- drivers/staging/intel_sst/intel_sst_common.h | 4 - .../staging/intel_sst/intel_sst_drv_interface.c | 118 +++++++++++++------- drivers/staging/intel_sst/intel_sst_fw_ipc.h | 1 drivers/staging/intel_sst/intel_sst_stream.c | 2 .../staging/intel_sst/intel_sst_stream_encoded.c | 9 +- drivers/staging/intel_sst/intelmid.c | 37 +++--- drivers/staging/intel_sst/intelmid_ctrl.c | 13 +- drivers/staging/intel_sst/intelmid_pvt.c | 10 +- 10 files changed, 136 insertions(+), 91 deletions(-)
drivers/staging/intel_sst/intel_sst.h +7 -1
@@ -29,6 +29,7 @@* and middleware. * This file is shared between the SST and MAD drivers */ +#include "intel_sst_ioctl.h" #define SST_CARD_NAMES "intel_mid_card"
@@ -107,10 +108,15 @@ struct snd_pmic_ops {int (*power_down_pmic) (void ); }; +struct intel_sst_pcm_control { +int (*open) (struct snd_sst_params *str_param); +int (*device_control) (int cmd,void *arg); +int (*close) (unsigned int str_id); +};struct intel_sst_card_ops {char *module_name;unsigned int vendor_id; -int (*control_set) (int control_element,void *value); +struct intel_sst_pcm_control *pcm_control;struct snd_pmic_ops *scard_ops; };
drivers/staging/intel_sst/intel_sst_app_interface.c +16 -9
@@ -34,10 +34,9 @@#include <linux/uaccess.h> #include <linux/firmware.h> #include <linux/ioctl.h> -#include <linux/smp_lock.h> #ifdef CONFIG_MRST_RAR_HANDLER -#include <linux/rar_register.h> -#include "../../../drivers/staging/memrar/memrar.h" +#include "../rar_register/rar_register.h" +#include "../memrar/memrar.h" #endif #include "intel_sst.h" #include "intel_sst_ioctl.h"
@@ -98,11 +97,15 @@ static int intel_sst_check_device(void)*/ int intel_sst_open (struct inode *i_node,struct file *file_ptr) { -int retval =intel_sst_check_device (); -if (retval) -return retval; +unsigned int retval;mutex_lock (&sst_drv_ctx->stream_lock); + retval =intel_sst_check_device (); +if (retval) { +mutex_unlock (&sst_drv_ctx->stream_lock); +return retval; + } +if (sst_drv_ctx->encoded_cnt <MAX_ENC_STREAM ) {struct ioctl_pvt_data *data =kzalloc (sizeof (struct ioctl_pvt_data ),GFP_KERNEL );
@@ -137,12 +140,16 @@ int intel_sst_open(struct inode *i_node, struct file *file_ptr)*/ int intel_sst_open_cntrl (struct inode *i_node,struct file *file_ptr) { -int retval =intel_sst_check_device (); -if (retval) -return retval; +unsigned int retval;/* audio manager open */ mutex_lock (&sst_drv_ctx->stream_lock); + retval =intel_sst_check_device (); +if (retval) { +mutex_unlock (&sst_drv_ctx->stream_lock); +return retval; + } +if (sst_drv_ctx->am_cnt <MAX_AM_HANDLES ) { sst_drv_ctx->am_cnt++;pr_debug ("sst: AM handle opened...\n" );
drivers/staging/intel_sst/intel_sst_common.h +2 -2
@@ -28,8 +28,8 @@* Common private declarations for SST */ -#define SST_DRIVER_VERSION "1.2.05" -#define SST_VERSION_NUM 0x1205 +#define SST_DRIVER_VERSION "1.2.09" +#define SST_VERSION_NUM 0x1209/* driver names */ #define SST_DRV_NAME "intel_sst_driver"
drivers/staging/intel_sst/intel_sst_drv_interface.c +78 -40
185 lines not on this page · raw message
drivers/staging/intel_sst/intel_sst_fw_ipc.h +1 -0
@@ -31,6 +31,7 @@*/ #define MAX_NUM_STREAMS_MRST 3 +#define MAX_NUM_STREAMS_MFLD 6#define MAX_NUM_STREAMS 6#define MAX_DBG_RW_BYTES 80#define MAX_NUM_SCATTER_BUFFERS 8
drivers/staging/intel_sst/intel_sst_stream.c +1 -1
@@ -45,7 +45,7 @@*/ int sst_check_device_type (u32 device,u32 num_chan,u32 *pcm_slot) { -if (device >=MAX_NUM_STREAMS ) { +if (device >MAX_NUM_STREAMS_MFLD ) {pr_debug ("sst: device type invalid %d\n" , device);return -EINVAL ; }
drivers/staging/intel_sst/intel_sst_stream_encoded.c +5 -4
@@ -30,9 +30,9 @@#include <linux/syscalls.h> #include <linux/firmware.h> #include <linux/sched.h> -#include <linux/rar_register.h> #ifdef CONFIG_MRST_RAR_HANDLER -#include "../../../drivers/staging/memrar/memrar.h" +#include "../rar_register/rar_register.h" +#include "../memrar/memrar.h" #endif #include "intel_sst_ioctl.h" #include "intel_sst.h"
@@ -878,13 +878,13 @@ static int sst_send_decode_mess(int str_id, struct stream_info *str_info,return retval; } +#ifdef CONFIG_MRST_RAR_HANDLER static int sst_prepare_input_buffers_rar (struct stream_info *str_info,struct snd_sst_dbufs *dbufs,int *input_index,int *in_copied,int *input_index_valid_size,int *new_entry_flag) {int retval =0 ; -#ifdef CONFIG_MRST_RAR_HANDLER int i;if (str_info->ops ==STREAM_OPS_PLAYBACK_DRM ) {
@@ -919,9 +919,10 @@ static int sst_prepare_input_buffers_rar(struct stream_info *str_info, str_info->decode_ibuf_type = dbufs->ibufs->type; *in_copied = str_info->decode_isize; } -#endif return retval; } +#endif +/*This function is used to prepare the kernel input buffers with contents before sending for decode*/ static int sst_prepare_input_buffers(struct stream_info *str_info,
drivers/staging/intel_sst/intelmid.c +16 -21
@@ -101,12 +101,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 +113,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 +176,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 +245,8 @@ static snd_pcm_uframes_t snd_intelmad_pcm_pointerif (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 +272,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
drivers/staging/intel_sst/intelmid_ctrl.c +6 -7
@@ -491,6 +491,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 +519,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 ]);
drivers/staging/intel_sst/intelmid_pvt.c +4 -6
@@ -92,10 +92,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 +116,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;
PATCH 3/7 sst: Add runtime PM support
In reply to Alan CoxFrom: Vinod Koul <[email protected]>
This adds runtime PM support for audio driver. This also fixes LPA audio mode for moorestown platform
---
drivers/staging/intel_sst/intel_sst.c | 44 ++++++++++++++++++-- .../staging/intel_sst/intel_sst_app_interface.c | 13 +++++- drivers/staging/intel_sst/intel_sst_common.h | 1 .../staging/intel_sst/intel_sst_drv_interface.c | 13 +++++- drivers/staging/intel_sst/intel_sst_dsp.c | 3 + drivers/staging/intel_sst/intel_sst_ipc.c | 1 6 files changed, 67 insertions(+), 8 deletions(-)
drivers/staging/intel_sst/intel_sst.c +40 -4
@@ -34,6 +34,7 @@#include <linux/interrupt.h> #include <linux/firmware.h> #include <linux/miscdevice.h> +#include <linux/pm_runtime.h> #include <asm/mrst.h> #include "intel_sst.h" #include "intel_sst_ioctl.h"
@@ -318,6 +319,9 @@ static int __devinit intel_sst_probe(struct pci_dev *pci, } } sst_drv_ctx->lpe_stalled =0 ; +pm_runtime_set_active (&pci->dev); +pm_runtime_enable (&pci->dev); +pm_runtime_allow (&pci->dev);pr_debug ("sst: ...successfully done!!!\n" );return ret;
@@ -405,9 +409,10 @@ int intel_sst_suspend(struct pci_dev *pci, pm_message_t state)union config_status_reg csr;pr_debug ("sst: intel_sst_suspend called\n" ); - -if (sst_drv_ctx->pb_streams !=0 || sst_drv_ctx->cp_streams !=0 ) -return -EPERM ; +if (sst_drv_ctx->stream_cnt) { +pr_err ("sst: active streams,not able to suspend\n" ); +return -EBUSY ; + }/*Assert RESET on LPE Processor*/ csr.full =sst_shim_read (sst_drv_ctx->shim,SST_CSR ); csr.full = csr.full |0x2 ;
@@ -437,7 +442,7 @@ int intel_sst_resume(struct pci_dev *pci)pr_debug ("sst: intel_sst_resume called\n" );if (sst_drv_ctx->sst_state !=SST_SUSPENDED ) {pr_err ("sst: SST is not in suspended state\n" ); -return -EPERM ; +return 0 ; } sst_drv_ctx =pci_get_drvdata (pci);pci_set_power_state (pci,PCI_D0 );
@@ -452,6 +457,34 @@ int intel_sst_resume(struct pci_dev *pci)return 0 ; } +static int intel_sst_runtime_suspend (struct device *dev) +{ +struct pci_dev *pci_dev =to_pci_dev (dev); +pr_debug ("sst: runtime_suspend called\n" ); +return intel_sst_suspend (pci_dev,PMSG_SUSPEND ); +} + +static int intel_sst_runtime_resume (struct device *dev) +{ +struct pci_dev *pci_dev =to_pci_dev (dev); +pr_debug ("sst: runtime_resume called\n" ); +return intel_sst_resume (pci_dev); +} + +static int intel_sst_runtime_idle (struct device *dev) +{ +pr_debug ("sst: runtime_idle called\n" ); +if (sst_drv_ctx->stream_cnt ==0 && sst_drv_ctx->am_cnt ==0 ) +pm_schedule_suspend (dev,SST_SUSPEND_DELAY ); +return -EBUSY ; +} + +static const struct dev_pm_ops intel_sst_pm = { + .runtime_suspend = intel_sst_runtime_suspend, + .runtime_resume = intel_sst_runtime_resume, + .runtime_idle = intel_sst_runtime_idle, +}; +/* PCI Routines */ static struct pci_device_id intel_sst_ids[] = { {PCI_VDEVICE (INTEL ,SST_MRST_PCI_ID ),3 },
@@ -468,6 +501,9 @@ static struct pci_driver driver = {#ifdef CONFIG_PM .suspend = intel_sst_suspend, .resume = intel_sst_resume, + .driver = { + .pm = &intel_sst_pm, + },#endif };
drivers/staging/intel_sst/intel_sst_app_interface.c +12 -1
@@ -33,6 +33,7 @@#include <linux/aio.h> #include <linux/uaccess.h> #include <linux/firmware.h> +#include <linux/pm_runtime.h> #include <linux/ioctl.h> #ifdef CONFIG_MRST_RAR_HANDLER #include "../rar_register/rar_register.h"
@@ -100,8 +101,10 @@ int intel_sst_open(struct inode *i_node, struct file *file_ptr)unsigned int retval;mutex_lock (&sst_drv_ctx->stream_lock); +pm_runtime_get_sync (&sst_drv_ctx->pci->dev); retval =intel_sst_check_device ();if (retval) { +pm_runtime_put (&sst_drv_ctx->pci->dev);mutex_unlock (&sst_drv_ctx->stream_lock);return retval; }
@@ -110,6 +113,7 @@ int intel_sst_open(struct inode *i_node, struct file *file_ptr)struct ioctl_pvt_data *data =kzalloc (sizeof (struct ioctl_pvt_data ),GFP_KERNEL );if (!data) { +pm_runtime_put (&sst_drv_ctx->pci->dev);mutex_unlock (&sst_drv_ctx->stream_lock);return -ENOMEM ; }
@@ -122,6 +126,7 @@ int intel_sst_open(struct inode *i_node, struct file *file_ptr)pr_debug ("sst: pvt_id handle = %d!\n" , data->pvt_id); }else { retval = -EUSERS ; +pm_runtime_put (&sst_drv_ctx->pci->dev);mutex_unlock (&sst_drv_ctx->stream_lock); }return retval;
@@ -144,8 +149,10 @@ int intel_sst_open_cntrl(struct inode *i_node, struct file *file_ptr)/* audio manager open */ mutex_lock (&sst_drv_ctx->stream_lock); +pm_runtime_get_sync (&sst_drv_ctx->pci->dev); retval =intel_sst_check_device ();if (retval) { +pm_runtime_put (&sst_drv_ctx->pci->dev);mutex_unlock (&sst_drv_ctx->stream_lock);return retval; }
@@ -154,8 +161,10 @@ int intel_sst_open_cntrl(struct inode *i_node, struct file *file_ptr) sst_drv_ctx->am_cnt++;pr_debug ("sst: AM handle opened...\n" ); file_ptr->private_data =NULL ; - }else + }else { retval = -EACCES ; +pm_runtime_put (&sst_drv_ctx->pci->dev); + }mutex_unlock (&sst_drv_ctx->stream_lock);return retval;
@@ -178,6 +187,7 @@ int intel_sst_release(struct inode *i_node, struct file *file_ptr)mutex_lock (&sst_drv_ctx->stream_lock); sst_drv_ctx->encoded_cnt--; sst_drv_ctx->stream_cnt--; +pm_runtime_put (&sst_drv_ctx->pci->dev);mutex_unlock (&sst_drv_ctx->stream_lock);free_stream_context (data->str_id);kfree (data);
@@ -189,6 +199,7 @@ int intel_sst_release_cntrl(struct inode *i_node, struct file *file_ptr)/* audio manager close */ mutex_lock (&sst_drv_ctx->stream_lock); sst_drv_ctx->am_cnt--; +pm_runtime_put (&sst_drv_ctx->pci->dev);mutex_unlock (&sst_drv_ctx->stream_lock);pr_debug ("sst: AM handle closed\n" );return 0 ;
drivers/staging/intel_sst/intel_sst_common.h +1 -0
@@ -37,6 +37,7 @@#define SST_FW_FILENAME_MFLD "fw_sst_082f.bin"#define SST_MRST_PCI_ID 0x080A#define SST_MFLD_PCI_ID 0x082F +#define SST_SUSPEND_DELAY 2000enum sst_states {SST_FW_LOADED =1 ,
drivers/staging/intel_sst/intel_sst_drv_interface.c +11 -2
@@ -30,6 +30,7 @@#include <linux/pci.h> #include <linux/fs.h> #include <linux/firmware.h> +#include <linux/pm_runtime.h> #include "intel_sst.h" #include "intel_sst_ioctl.h" #include "intel_sst_fw_ipc.h"
@@ -308,12 +309,15 @@ int sst_open_pcm_stream(struct snd_sst_params *str_param)struct stream_info *str_info;int retval; +pm_runtime_get_sync (&sst_drv_ctx->pci->dev); +if (sst_drv_ctx->sst_state ==SST_SUSPENDED ) {/*LPE is suspended, resume it before proceding*/ pr_debug ("sst: Resuming from Suspended state\n" ); retval =intel_sst_resume (sst_drv_ctx->pci);if (retval) {pr_err ("sst: Resume Failed = %#x, abort\n" , retval); +pm_runtime_put (&sst_drv_ctx->pci->dev);return retval; } }
@@ -323,21 +327,25 @@ int sst_open_pcm_stream(struct snd_sst_params *str_param) retval =sst_download_fw ();if (retval) {pr_err ("sst: FW download fail %x, abort\n" , retval); +pm_runtime_put (&sst_drv_ctx->pci->dev);return retval; }send_intial_rx_timeslot (); } -if (!str_param) +if (!str_param) { +pm_runtime_put (&sst_drv_ctx->pci->dev);return -EINVAL ; + } retval =sst_get_stream (str_param);if (retval >0 ) { sst_drv_ctx->stream_cnt++; str_info = &sst_drv_ctx->streams[retval]; str_info->src =MAD_DRV ; + }else +pm_runtime_put (&sst_drv_ctx->pci->dev); - }return retval; }
@@ -363,6 +371,7 @@ int sst_close_pcm_stream(unsigned int str_id) stream->period_elapsed =NULL ; sst_drv_ctx->stream_cnt--;pr_debug ("sst: will call runtime put now\n" ); +pm_runtime_put (&sst_drv_ctx->pci->dev);return 0 ; }/*
drivers/staging/intel_sst/intel_sst_dsp.c +2 -1
@@ -48,7 +48,8 @@ static int intel_sst_reset_dsp_mrst(void)union config_status_reg csr;pr_debug ("sst: Resetting the DSP in mrst\n" ); - csr.full =0x3a2 ; + csr.full =sst_shim_read (sst_drv_ctx->shim,SST_CSR ); + csr.full |=0x382 ;sst_shim_write (sst_drv_ctx->shim,SST_CSR , csr.full); csr.full =sst_shim_read (sst_drv_ctx->shim,SST_CSR ); csr.part.strb_cntr_rst =0 ;
drivers/staging/intel_sst/intel_sst_ipc.c +1 -0
@@ -180,6 +180,7 @@ int process_fw_init(struct sst_ipc_msg_wq *msg)sst_send_sound_card_type ();mutex_lock (&sst_drv_ctx->sst_lock); sst_drv_ctx->sst_state =SST_FW_RUNNING ; + sst_drv_ctx->lpe_stalled =0 ;mutex_unlock (&sst_drv_ctx->sst_lock);pr_debug ("sst: FW Version %x.%x\n" , init->fw_version.major, init->fw_version.minor);
PATCH 4/7 sst: Construct fw string name runtime
In reply to Alan CoxFrom: Vinod Koul <[email protected]>
The firmware name for each platform is appended by PCI id of device. This patch makes use of pci id to construct the string rather than hardcode the string.
---
drivers/staging/intel_sst/intel_sst_common.h | 3 +-- .../staging/intel_sst/intel_sst_drv_interface.c | 11 ++++++----- 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/staging/intel_sst/intel_sst_common.h +1 -2
@@ -33,10 +33,9 @@/* driver names */ #define SST_DRV_NAME "intel_sst_driver" -#define SST_FW_FILENAME_MRST "fw_sst_080a.bin" -#define SST_FW_FILENAME_MFLD "fw_sst_082f.bin"#define SST_MRST_PCI_ID 0x080A#define SST_MFLD_PCI_ID 0x082F +#define PCI_ID_LENGTH 4#define SST_SUSPEND_DELAY 2000enum sst_states {
drivers/staging/intel_sst/intel_sst_drv_interface.c +6 -5
@@ -46,13 +46,14 @@ int sst_download_fw(void) {int retval;const struct firmware *fw_sst; -const char *name; +char name[20 ]; +if (sst_drv_ctx->sst_state !=SST_UN_INIT )return -EPERM ; -if (sst_drv_ctx->pci_id ==SST_MRST_PCI_ID ) - name =SST_FW_FILENAME_MRST ; -else - name =SST_FW_FILENAME_MFLD ; + +snprintf (name,sizeof (name),"%s%04x%s" ,"fw_sst_" , + sst_drv_ctx->pci_id,".bin" ); +pr_debug ("sst: Downloading %s FW now...\n" , name); retval =request_firmware (&fw_sst, name, &sst_drv_ctx->pci->dev);if (retval) {
PATCH 5/7 sst: Firmware error codes force number values
In reply to Alan CoxFrom: Vinod Koul <[email protected]>
To avoid mismatch in driver and firmware error codes assign specfic values to each enum.
---
drivers/staging/intel_sst/intel_sst_fw_ipc.h | 110 +++++++++++++++----------- 1 files changed, 62 insertions(+), 48 deletions(-)
drivers/staging/intel_sst/intel_sst_fw_ipc.h +62 -48
@@ -142,73 +142,87 @@ enum sst_error_codes {/* Error code,response to msgId: Description */ /* Common error codes */ SST_SUCCESS =0 ,/* Success */ -SST_ERR_INVALID_STREAM_ID ,/* Invalid stream ID */ -SST_ERR_INVALID_MSG_ID ,/* Invalid message ID */ -SST_ERR_INVALID_STREAM_OP ,/* Invalid stream operation request */ -SST_ERR_INVALID_PARAMS ,/* Invalid params */ -SST_ERR_INVALID_CODEC ,/* Invalid codec type */ -SST_ERR_INVALID_MEDIA_TYPE ,/* Invalid media type */ -SST_ERR_STREAM_ERR ,/* ANY: Stream control or config or -processing error */ +SST_ERR_INVALID_STREAM_ID =1 , +SST_ERR_INVALID_MSG_ID =2 , +SST_ERR_INVALID_STREAM_OP =3 , +SST_ERR_INVALID_PARAMS =4 , +SST_ERR_INVALID_CODEC =5 , +SST_ERR_INVALID_MEDIA_TYPE =6 , +SST_ERR_STREAM_ERR =7 ,/* IPC specific error codes */ -SST_IPC_ERR_CALL_BACK_NOT_REGD ,/* Call back for msg not regd */ -SST_IPC_ERR_STREAM_NOT_ALLOCATED ,/* Stream is not allocated */ -SST_IPC_ERR_STREAM_ALLOC_FAILED ,/* ALLOC:Stream alloc failed */ -SST_IPC_ERR_GET_STREAM_FAILED ,/* ALLOC:Get stream id failed*/ -SST_ERR_MOD_NOT_AVAIL ,/* SET/GET: Mod(AEC/AGC/ALC) not available */ -SST_ERR_MOD_DNLD_RQD ,/* SET/GET: Mod(AEC/AGC/ALC) download required */ -SST_ERR_STREAM_STOPPED ,/* ANY: Stream is in stopped state */ -SST_ERR_STREAM_IN_USE ,/* ANY: Stream is already in use */ +SST_IPC_ERR_CALL_BACK_NOT_REGD =8 , +SST_IPC_ERR_STREAM_NOT_ALLOCATED =9 , +SST_IPC_ERR_STREAM_ALLOC_FAILED =10 , +SST_IPC_ERR_GET_STREAM_FAILED =11 , +SST_ERR_MOD_NOT_AVAIL =12 , +SST_ERR_MOD_DNLD_RQD =13 , +SST_ERR_STREAM_STOPPED =14 , +SST_ERR_STREAM_IN_USE =15 ,/* Capture specific error codes */ -SST_CAP_ERR_INCMPLTE_CAPTURE_MSG ,/* ANY:Incomplete message */ -SST_CAP_ERR_CAPTURE_FAIL ,/* ANY:Capture op failed */ -SST_CAP_ERR_GET_DDR_NEW_SGLIST , -SST_CAP_ERR_UNDER_RUN ,/* lack of input data */ -SST_CAP_ERR_OVERFLOW ,/* lack of output space */ +SST_CAP_ERR_INCMPLTE_CAPTURE_MSG =16 , +SST_CAP_ERR_CAPTURE_FAIL =17 , +SST_CAP_ERR_GET_DDR_NEW_SGLIST =18 , +SST_CAP_ERR_UNDER_RUN =19 , +SST_CAP_ERR_OVERFLOW =20 ,/* Playback specific error codes*/ -SST_PB_ERR_INCMPLTE_PLAY_MSG ,/* ANY: Incomplete message */ -SST_PB_ERR_PLAY_FAIL ,/* ANY: Playback operation failed */ -SST_PB_ERR_GET_DDR_NEW_SGLIST , +SST_PB_ERR_INCMPLTE_PLAY_MSG =21 , +SST_PB_ERR_PLAY_FAIL =22 , +SST_PB_ERR_GET_DDR_NEW_SGLIST =23 ,/* Codec manager specific error codes */ -SST_LIB_ERR_LIB_DNLD_REQUIRED ,/* ALLOC: Codec download required */ -SST_LIB_ERR_LIB_NOT_SUPPORTED ,/* Library is not supported */ +SST_LIB_ERR_LIB_DNLD_REQUIRED =24 , +SST_LIB_ERR_LIB_NOT_SUPPORTED =25 ,/* Library manager specific error codes */ -SST_SCC_ERR_PREP_DNLD_FAILED ,/* Failed to prepare for codec download */ -SST_SCC_ERR_LIB_DNLD_RES_FAILED ,/* Lib download resume failed */ +SST_SCC_ERR_PREP_DNLD_FAILED =26 , +SST_SCC_ERR_LIB_DNLD_RES_FAILED =27 ,/* Scheduler specific error codes */ -SST_SCH_ERR_FAIL ,/* REPORT: */ +SST_SCH_ERR_FAIL =28 ,/* DMA specific error codes */ -SST_DMA_ERR_NO_CHNL_AVAILABLE ,/* DMA Ch not available */ -SST_DMA_ERR_INVALID_INPUT_PARAMS ,/* Invalid input params */ -SST_DMA_ERR_CHNL_ALREADY_SUSPENDED ,/* Ch is suspended */ -SST_DMA_ERR_CHNL_ALREADY_STARTED ,/* Ch already started */ -SST_DMA_ERR_CHNL_NOT_ENABLED ,/* Ch not enabled */ -SST_DMA_ERR_TRANSFER_FAILED ,/* Transfer failed */ -SST_SSP_ERR_ALREADY_ENABLED ,/* REPORT: SSP already enabled */ -SST_SSP_ERR_ALREADY_DISABLED ,/* REPORT: SSP already disabled */ -SST_SSP_ERR_NOT_INITIALIZED , +SST_DMA_ERR_NO_CHNL_AVAILABLE =29 , +SST_DMA_ERR_INVALID_INPUT_PARAMS =30 , +SST_DMA_ERR_CHNL_ALREADY_SUSPENDED =31 , +SST_DMA_ERR_CHNL_ALREADY_STARTED =32 , +SST_DMA_ERR_CHNL_NOT_ENABLED =33 , +SST_DMA_ERR_TRANSFER_FAILED =34 , + +SST_SSP_ERR_ALREADY_ENABLED =35 , +SST_SSP_ERR_ALREADY_DISABLED =36 , +SST_SSP_ERR_NOT_INITIALIZED =37 , +SST_SSP_ERR_SRAM_NO_DMA_DATA =38 ,/* Other error codes */ -SST_ERR_MOD_INIT_FAIL ,/* Firmware Module init failed */ +SST_ERR_MOD_INIT_FAIL =39 ,/* FW init error codes */ -SST_RDR_ERR_IO_DEV_SEL_NOT_ALLOWED , -SST_RDR_ERR_ROUTE_ALREADY_STARTED , -SST_RDR_PREP_CODEC_DNLD_FAILED , +SST_RDR_ERR_IO_DEV_SEL_NOT_ALLOWED =40 , +SST_RDR_ERR_ROUTE_ALREADY_STARTED =41 , +SST_RDR_ERR_IO_DEV_SEL_FAILED =42 , +SST_RDR_PREP_CODEC_DNLD_FAILED =43 ,/* Memory debug error codes */ -SST_ERR_DBG_MEM_READ_FAIL , -SST_ERR_DBG_MEM_WRITE_FAIL , - -/* Decode error codes */ - SST_ERR_DEC_NEED_INPUT_BUF, - +SST_ERR_DBG_MEM_READ_FAIL =44 , +SST_ERR_DBG_MEM_WRITE_FAIL =45 , +SST_ERR_INSUFFICIENT_INPUT_SG_LIST =46 , +SST_ERR_INSUFFICIENT_OUTPUT_SG_LIST =47 , + +SST_ERR_BUFFER_NOT_AVAILABLE =48 , +SST_ERR_BUFFER_NOT_ALLOCATED =49 , +SST_ERR_INVALID_REGION_TYPE =50 , +SST_ERR_NULL_PTR =51 , +SST_ERR_INVALID_BUFFER_SIZE =52 , +SST_ERR_INVALID_BUFFER_INDEX =53 , + +/*IIPC specific error codes */ +SST_IIPC_QUEUE_FULL =54 , +SST_IIPC_ERR_MSG_SND_FAILED =55 , +SST_PB_ERR_UNDERRUN_OCCURED =56 , +SST_RDR_INSUFFICIENT_MIXER_BUFFER =57 , + SST_INVALID_TIME_SLOTS = 58, }; enum dbg_mem_data_type {
PATCH 6/7 sst: log error returned by scu ipc read/write
In reply to Alan CoxFrom: Vinod Koul <[email protected]>
scu ipc driver fails sometimes to read/write. This add logs with register addr and ret code when these errors occur.
---
drivers/staging/intel_sst/intelmid_pvt.c | 25 ++++++++++++------------- 1 files changed, 12 insertions(+), 13 deletions(-)
drivers/staging/intel_sst/intelmid_pvt.c +12 -13
@@ -143,30 +143,29 @@ int sst_sc_reg_access(struct sc_reg_access *sc_access,for (i =0 ; i < num_val; i++) { retval =intel_scu_ipc_iowrite8 (sc_access[i].reg_addr, sc_access[i].value); -if (retval) { -pr_err ("sst: IPC write failed!!! %d\n" , retval); -return retval; - } +if (retval) + goto err; } }else if (type ==PMIC_READ ) {for (i =0 ; i < num_val; i++) { retval =intel_scu_ipc_ioread8 (sc_access[i].reg_addr, &(sc_access[i].value)); -if (retval) { -pr_err ("sst: IPC read failed!!!!!%d\n" , retval); -return retval; - } +if (retval) + goto err; } }else {for (i =0 ; i < num_val; i++) { retval =intel_scu_ipc_update_register ( sc_access[i].reg_addr, sc_access[i].value, sc_access[i].mask); -if (retval) { -pr_err ("sst: IPC Modify failed!!!%d\n" , retval); -return retval; - } +if (retval) + goto err; } - } + } +return 0 ; +err: +pr_err ("sst: IPC failed for cmd!!!%d, %d\n" , retval, type); +pr_err ("reg:0x%2x addr:0x%2x\n" , + sc_access[i].reg_addr, sc_access[i].value);return retval; }
PATCH 7/7 sst: add ioctls for post processing algorithm interface
In reply to Alan CoxFrom: Vinod Koul <[email protected]>
This patch adds two new ioctls to intel_sst_ctrl device. This i/f can be used by application to send algorithm parameters
[This will need further discussion in the context of the final ALSA interface
but is fine for staging, ie anyone who relies on it should expect changes Also fixed a missing kmalloc fail check]
---
drivers/staging/intel_sst/intel_sst.c | 23 ++- .../staging/intel_sst/intel_sst_app_interface.c | 143 ++++++++++++++++++++ drivers/staging/intel_sst/intel_sst_common.h | 2 drivers/staging/intel_sst/intel_sst_fw_ipc.h | 2 drivers/staging/intel_sst/intel_sst_ioctl.h | 15 +- drivers/staging/intel_sst/intel_sst_ipc.c | 49 +++++++ 6 files changed, 213 insertions(+), 21 deletions(-)
drivers/staging/intel_sst/intel_sst.c +12 -11
@@ -304,18 +304,18 @@ static int __devinit intel_sst_probe(struct pci_dev *pci, goto do_unmap_dram;pr_debug ("sst: Registered IRQ 0x%x\n" , pci->irq); +/*Register LPE Control as misc driver*/ + ret =misc_register (&lpe_ctrl); +if (ret) { +pr_err ("sst: couldn't register control device\n" ); + goto do_free_irq; + } +if (sst_drv_ctx->pci_id ==SST_MRST_PCI_ID ) { ret =misc_register (&lpe_dev);if (ret) { -pr_err ("sst: couldn't register LPE device\n" ); - goto do_free_irq; - } - -/*Register LPE Control as misc driver*/ - ret =misc_register (&lpe_ctrl); -if (ret) {pr_err ("sst: couldn't register misc driver\n" ); - goto do_free_irq; + goto do_free_misc; } } sst_drv_ctx->lpe_stalled =0 ;
@@ -325,6 +325,8 @@ static int __devinit intel_sst_probe(struct pci_dev *pci,pr_debug ("sst: ...successfully done!!!\n" );return ret; +do_free_misc: +misc_deregister (&lpe_ctrl); do_free_irq:free_irq (pci->irq, sst_drv_ctx); do_unmap_dram:
@@ -369,10 +371,9 @@ static void __devexit intel_sst_remove(struct pci_dev *pci)mutex_lock (&sst_drv_ctx->sst_lock); sst_drv_ctx->sst_state =SST_UN_INIT ;mutex_unlock (&sst_drv_ctx->sst_lock); -if (sst_drv_ctx->pci_id ==SST_MRST_PCI_ID ) { +misc_deregister (&lpe_ctrl); +if (sst_drv_ctx->pci_id ==SST_MRST_PCI_ID )misc_deregister (&lpe_dev); -misc_deregister (&lpe_ctrl); - }free_irq (pci->irq, sst_drv_ctx);iounmap (sst_drv_ctx->dram);iounmap (sst_drv_ctx->iram);
drivers/staging/intel_sst/intel_sst_app_interface.c +143 -0
155 lines not on this page · raw message
drivers/staging/intel_sst/intel_sst_common.h +1 -1
@@ -392,7 +392,7 @@ struct intel_sst_drv {struct stream_info streams[MAX_NUM_STREAMS ];struct stream_alloc_block alloc_block[MAX_ACTIVE_STREAM ]; -struct sst_block tgt_dev_blk, fw_info_blk, +struct sst_block tgt_dev_blk, fw_info_blk, ppp_params_blk, vol_info_blk, mute_info_blk, hs_info_blk;struct mutex list_lock;/* mutex for IPC list locking */ spinlock_t list_spin_lock;/* mutex for IPC list locking */
drivers/staging/intel_sst/intel_sst_fw_ipc.h +2 -0
@@ -68,6 +68,8 @@#define IPC_IA_CAPT_VOICE 0x17#define IPC_IA_DECODE_FRAMES 0x18 +#define IPC_IA_ALG_PARAMS 0x1A +/* I2L Stream config/control msgs */ #define IPC_IA_ALLOC_STREAM 0x20/* Allocate a stream ID */ #define IPC_IA_FREE_STREAM 0x21/* Free the stream ID */
drivers/staging/intel_sst/intel_sst_ioctl.h +6 -9
@@ -190,21 +190,15 @@ struct snd_prp_params {__u32 reserved;/* No pre-processing defined yet */ }; -struct snd_params_block { -__u32 type;/*Type of the parameter*/ -__u32 size;/*size of the parameters in the block*/ -__u8 params[0 ];/*Parameters of the algorithm*/ -}; -/* Pre and post processing params structure */ struct snd_ppp_params { -enum sst_algo_types algo_id;/* Post/Pre processing algorithm ID */ +__u8 algo_id;/* Post/Pre processing algorithm ID */ __u8 str_id;/*Only 5 bits used 0 - 31 are valid*/ __u8 enable;/* 0= disable, 1= enable*/ __u8 reserved;__u32 size;/*Size of parameters for all blocks*/ -struct snd_params_block params[0 ]; -}; +void *params; +} __attribute__ ((packed));struct snd_sst_postproc_info {__u32 src_min;/* Supported SRC Min sampling freq */
@@ -431,5 +425,8 @@ struct snd_sst_dbufs {#define SNDRV_SST_FW_INFO _IOR('L', 0x20, struct snd_sst_fw_info *)#define SNDRV_SST_SET_TARGET_DEVICE _IOW('L', 0x21, \ struct snd_sst_target_device *) +/*DSP Ioctls on /dev/intel_sst_ctrl only*/ +#define SNDRV_SST_SET_ALGO _IOW('L', 0x30, struct snd_ppp_params *) +#define SNDRV_SST_GET_ALGO _IOWR('L', 0x31, struct snd_ppp_params *)#endif /* __INTEL_SST_IOCTL_H__ */
drivers/staging/intel_sst/intel_sst_ipc.c +49 -0
55 lines not on this page · raw message
Quoted 6 lines · Alan Cox
From: Vinod Koul <[email protected]>
This removes the remaining bit of aava dependent and related bits from driver
Signed-off-by Vinod Koul <[email protected]>Signed-off-by Alan Cox <[email protected]>
I edited this one by hand to get it to apply, but the other 7 were harder. Can you redo them and resend them as the pr_debug() changes that are now in staging-next are massivly conflicting with this series.
thanks,
greg k-h