Commit d0f40c50 authored by Joe Perches's avatar Joe Perches Committed by Greg Kroah-Hartman

Staging: intel_sst: Use pr_fmt, fix misspellings

Remove leading "sst: " from format strings.
Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Prefix is changed from "sst: " to "snd_intel_sst: "
Add missing newlines
Trim trailing spaces after newlines
Fix several different misspellings
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 2ff81110
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
* This file contains all init functions * This file contains all init functions
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -169,17 +171,17 @@ static int __devinit intel_sst_probe(struct pci_dev *pci, ...@@ -169,17 +171,17 @@ static int __devinit intel_sst_probe(struct pci_dev *pci,
{ {
int i, ret = 0; int i, ret = 0;
pr_debug("sst: Probe for DID %x\n", pci->device); pr_debug("Probe for DID %x\n", pci->device);
mutex_lock(&drv_ctx_lock); mutex_lock(&drv_ctx_lock);
if (sst_drv_ctx) { if (sst_drv_ctx) {
pr_err("sst: Only one sst handle is supported\n"); pr_err("Only one sst handle is supported\n");
mutex_unlock(&drv_ctx_lock); mutex_unlock(&drv_ctx_lock);
return -EBUSY; return -EBUSY;
} }
sst_drv_ctx = kzalloc(sizeof(*sst_drv_ctx), GFP_KERNEL); sst_drv_ctx = kzalloc(sizeof(*sst_drv_ctx), GFP_KERNEL);
if (!sst_drv_ctx) { if (!sst_drv_ctx) {
pr_err("sst: intel_sst malloc fail\n"); pr_err("malloc fail\n");
mutex_unlock(&drv_ctx_lock); mutex_unlock(&drv_ctx_lock);
return -ENOMEM; return -ENOMEM;
} }
...@@ -226,7 +228,7 @@ static int __devinit intel_sst_probe(struct pci_dev *pci, ...@@ -226,7 +228,7 @@ static int __devinit intel_sst_probe(struct pci_dev *pci,
spin_lock_init(&sst_drv_ctx->list_spin_lock); spin_lock_init(&sst_drv_ctx->list_spin_lock);
sst_drv_ctx->max_streams = pci_id->driver_data; sst_drv_ctx->max_streams = pci_id->driver_data;
pr_debug("sst: Got drv data max stream %d\n", pr_debug("Got drv data max stream %d\n",
sst_drv_ctx->max_streams); sst_drv_ctx->max_streams);
for (i = 1; i <= sst_drv_ctx->max_streams; i++) { for (i = 1; i <= sst_drv_ctx->max_streams; i++) {
struct stream_info *stream = &sst_drv_ctx->streams[i]; struct stream_info *stream = &sst_drv_ctx->streams[i];
...@@ -241,18 +243,18 @@ static int __devinit intel_sst_probe(struct pci_dev *pci, ...@@ -241,18 +243,18 @@ static int __devinit intel_sst_probe(struct pci_dev *pci,
sst_drv_ctx->mmap_mem = sst_drv_ctx->mmap_mem =
kzalloc(sst_drv_ctx->mmap_len, GFP_KERNEL); kzalloc(sst_drv_ctx->mmap_len, GFP_KERNEL);
if (sst_drv_ctx->mmap_mem) { if (sst_drv_ctx->mmap_mem) {
pr_debug("sst: Got memory %p size 0x%x\n", pr_debug("Got memory %p size 0x%x\n",
sst_drv_ctx->mmap_mem, sst_drv_ctx->mmap_mem,
sst_drv_ctx->mmap_len); sst_drv_ctx->mmap_len);
break; break;
} }
if (sst_drv_ctx->mmap_len < (SST_MMAP_STEP*PAGE_SIZE)) { if (sst_drv_ctx->mmap_len < (SST_MMAP_STEP*PAGE_SIZE)) {
pr_err("sst: mem alloc fail...abort!!\n"); pr_err("mem alloc fail...abort!!\n");
ret = -ENOMEM; ret = -ENOMEM;
goto free_process_reply_wq; goto free_process_reply_wq;
} }
sst_drv_ctx->mmap_len -= (SST_MMAP_STEP * PAGE_SIZE); sst_drv_ctx->mmap_len -= (SST_MMAP_STEP * PAGE_SIZE);
pr_debug("sst:mem alloc failed...trying %d\n", pr_debug("mem alloc failed...trying %d\n",
sst_drv_ctx->mmap_len); sst_drv_ctx->mmap_len);
} }
} }
...@@ -260,7 +262,7 @@ static int __devinit intel_sst_probe(struct pci_dev *pci, ...@@ -260,7 +262,7 @@ static int __devinit intel_sst_probe(struct pci_dev *pci,
/* Init the device */ /* Init the device */
ret = pci_enable_device(pci); ret = pci_enable_device(pci);
if (ret) { if (ret) {
pr_err("sst: device cant be enabled\n"); pr_err("device cant be enabled\n");
goto do_free_mem; goto do_free_mem;
} }
sst_drv_ctx->pci = pci_dev_get(pci); sst_drv_ctx->pci = pci_dev_get(pci);
...@@ -273,25 +275,25 @@ static int __devinit intel_sst_probe(struct pci_dev *pci, ...@@ -273,25 +275,25 @@ static int __devinit intel_sst_probe(struct pci_dev *pci,
sst_drv_ctx->shim = pci_ioremap_bar(pci, 1); sst_drv_ctx->shim = pci_ioremap_bar(pci, 1);
if (!sst_drv_ctx->shim) if (!sst_drv_ctx->shim)
goto do_release_regions; goto do_release_regions;
pr_debug("sst: SST Shim Ptr %p\n", sst_drv_ctx->shim); pr_debug("SST Shim Ptr %p\n", sst_drv_ctx->shim);
/* Shared SRAM */ /* Shared SRAM */
sst_drv_ctx->mailbox = pci_ioremap_bar(pci, 2); sst_drv_ctx->mailbox = pci_ioremap_bar(pci, 2);
if (!sst_drv_ctx->mailbox) if (!sst_drv_ctx->mailbox)
goto do_unmap_shim; goto do_unmap_shim;
pr_debug("sst: SRAM Ptr %p\n", sst_drv_ctx->mailbox); pr_debug("SRAM Ptr %p\n", sst_drv_ctx->mailbox);
/* IRAM */ /* IRAM */
sst_drv_ctx->iram = pci_ioremap_bar(pci, 3); sst_drv_ctx->iram = pci_ioremap_bar(pci, 3);
if (!sst_drv_ctx->iram) if (!sst_drv_ctx->iram)
goto do_unmap_sram; goto do_unmap_sram;
pr_debug("sst:IRAM Ptr %p\n", sst_drv_ctx->iram); pr_debug("IRAM Ptr %p\n", sst_drv_ctx->iram);
/* DRAM */ /* DRAM */
sst_drv_ctx->dram = pci_ioremap_bar(pci, 4); sst_drv_ctx->dram = pci_ioremap_bar(pci, 4);
if (!sst_drv_ctx->dram) if (!sst_drv_ctx->dram)
goto do_unmap_iram; goto do_unmap_iram;
pr_debug("sst: DRAM Ptr %p\n", sst_drv_ctx->dram); pr_debug("DRAM Ptr %p\n", sst_drv_ctx->dram);
mutex_lock(&sst_drv_ctx->sst_lock); mutex_lock(&sst_drv_ctx->sst_lock);
sst_drv_ctx->sst_state = SST_UN_INIT; sst_drv_ctx->sst_state = SST_UN_INIT;
...@@ -301,24 +303,24 @@ static int __devinit intel_sst_probe(struct pci_dev *pci, ...@@ -301,24 +303,24 @@ static int __devinit intel_sst_probe(struct pci_dev *pci,
IRQF_SHARED, SST_DRV_NAME, sst_drv_ctx); IRQF_SHARED, SST_DRV_NAME, sst_drv_ctx);
if (ret) if (ret)
goto do_unmap_dram; goto do_unmap_dram;
pr_debug("sst: Registered IRQ 0x%x\n", pci->irq); pr_debug("Registered IRQ 0x%x\n", pci->irq);
if (sst_drv_ctx->pci_id == SST_MRST_PCI_ID) { if (sst_drv_ctx->pci_id == SST_MRST_PCI_ID) {
ret = misc_register(&lpe_dev); ret = misc_register(&lpe_dev);
if (ret) { if (ret) {
pr_err("sst: couldn't register LPE device\n"); pr_err("couldn't register LPE device\n");
goto do_free_irq; goto do_free_irq;
} }
/*Register LPE Control as misc driver*/ /*Register LPE Control as misc driver*/
ret = misc_register(&lpe_ctrl); ret = misc_register(&lpe_ctrl);
if (ret) { if (ret) {
pr_err("sst: couldn't register misc driver\n"); pr_err("couldn't register misc driver\n");
goto do_free_irq; goto do_free_irq;
} }
} }
sst_drv_ctx->lpe_stalled = 0; sst_drv_ctx->lpe_stalled = 0;
pr_debug("sst: ...successfully done!!!\n"); pr_debug("...successfully done!!!\n");
return ret; return ret;
do_free_irq: do_free_irq:
...@@ -347,7 +349,7 @@ static int __devinit intel_sst_probe(struct pci_dev *pci, ...@@ -347,7 +349,7 @@ static int __devinit intel_sst_probe(struct pci_dev *pci,
destroy_workqueue(sst_drv_ctx->mad_wq); destroy_workqueue(sst_drv_ctx->mad_wq);
do_free_drv_ctx: do_free_drv_ctx:
kfree(sst_drv_ctx); kfree(sst_drv_ctx);
pr_err("sst: Probe failed with 0x%x\n", ret); pr_err("Probe failed with 0x%x\n", ret);
return ret; return ret;
} }
...@@ -404,7 +406,7 @@ int intel_sst_suspend(struct pci_dev *pci, pm_message_t state) ...@@ -404,7 +406,7 @@ int intel_sst_suspend(struct pci_dev *pci, pm_message_t state)
{ {
union config_status_reg csr; union config_status_reg csr;
pr_debug("sst: intel_sst_suspend called\n"); pr_debug("intel_sst_suspend called\n");
if (sst_drv_ctx->pb_streams != 0 || sst_drv_ctx->cp_streams != 0) if (sst_drv_ctx->pb_streams != 0 || sst_drv_ctx->cp_streams != 0)
return -EPERM; return -EPERM;
...@@ -434,9 +436,9 @@ int intel_sst_resume(struct pci_dev *pci) ...@@ -434,9 +436,9 @@ int intel_sst_resume(struct pci_dev *pci)
{ {
int ret = 0; int ret = 0;
pr_debug("sst: intel_sst_resume called\n"); pr_debug("intel_sst_resume called\n");
if (sst_drv_ctx->sst_state != SST_SUSPENDED) { if (sst_drv_ctx->sst_state != SST_SUSPENDED) {
pr_err("sst: SST is not in suspended state\n"); pr_err("SST is not in suspended state\n");
return -EPERM; return -EPERM;
} }
sst_drv_ctx = pci_get_drvdata(pci); sst_drv_ctx = pci_get_drvdata(pci);
...@@ -444,7 +446,7 @@ int intel_sst_resume(struct pci_dev *pci) ...@@ -444,7 +446,7 @@ int intel_sst_resume(struct pci_dev *pci)
pci_restore_state(pci); pci_restore_state(pci);
ret = pci_enable_device(pci); ret = pci_enable_device(pci);
if (ret) if (ret)
pr_err("sst: device cant be enabled\n"); pr_err("device cant be enabled\n");
mutex_lock(&sst_drv_ctx->sst_lock); mutex_lock(&sst_drv_ctx->sst_lock);
sst_drv_ctx->sst_state = SST_UN_INIT; sst_drv_ctx->sst_state = SST_UN_INIT;
...@@ -482,14 +484,14 @@ static int __init intel_sst_init(void) ...@@ -482,14 +484,14 @@ static int __init intel_sst_init(void)
{ {
/* Init all variables, data structure etc....*/ /* Init all variables, data structure etc....*/
int ret = 0; int ret = 0;
pr_debug("sst: INFO: ******** SST DRIVER loading.. Ver: %s\n", pr_debug("INFO: ******** SST DRIVER loading.. Ver: %s\n",
SST_DRIVER_VERSION); SST_DRIVER_VERSION);
mutex_init(&drv_ctx_lock); mutex_init(&drv_ctx_lock);
/* Register with PCI */ /* Register with PCI */
ret = pci_register_driver(&driver); ret = pci_register_driver(&driver);
if (ret) if (ret)
pr_err("sst: PCI register failed\n"); pr_err("PCI register failed\n");
return ret; return ret;
} }
...@@ -504,7 +506,7 @@ static void __exit intel_sst_exit(void) ...@@ -504,7 +506,7 @@ static void __exit intel_sst_exit(void)
{ {
pci_unregister_driver(&driver); pci_unregister_driver(&driver);
pr_debug("sst: driver unloaded\n"); pr_debug("driver unloaded\n");
return; return;
} }
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
* Upper layer interfaces (MAD driver, MMF) to SST driver * Upper layer interfaces (MAD driver, MMF) to SST driver
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/fs.h> #include <linux/fs.h>
...@@ -52,10 +54,10 @@ int sst_download_fw(void) ...@@ -52,10 +54,10 @@ int sst_download_fw(void)
name = SST_FW_FILENAME_MRST; name = SST_FW_FILENAME_MRST;
else else
name = SST_FW_FILENAME_MFLD; name = SST_FW_FILENAME_MFLD;
pr_debug("sst: Downloading %s FW now...\n", name); pr_debug("Downloading %s FW now...\n", name);
retval = request_firmware(&fw_sst, name, &sst_drv_ctx->pci->dev); retval = request_firmware(&fw_sst, name, &sst_drv_ctx->pci->dev);
if (retval) { if (retval) {
pr_err("sst: request fw failed %d\n", retval); pr_err("request fw failed %d\n", retval);
return retval; return retval;
} }
sst_drv_ctx->alloc_block[0].sst_id = FW_DWNL_ID; sst_drv_ctx->alloc_block[0].sst_id = FW_DWNL_ID;
...@@ -66,7 +68,7 @@ int sst_download_fw(void) ...@@ -66,7 +68,7 @@ int sst_download_fw(void)
retval = sst_wait_timeout(sst_drv_ctx, &sst_drv_ctx->alloc_block[0]); retval = sst_wait_timeout(sst_drv_ctx, &sst_drv_ctx->alloc_block[0]);
if (retval) if (retval)
pr_err("sst: fw download failed %d\n" , retval); pr_err("fw download failed %d\n" , retval);
end_restore: end_restore:
release_firmware(fw_sst); release_firmware(fw_sst);
sst_drv_ctx->alloc_block[0].sst_id = BLOCK_UNINIT; sst_drv_ctx->alloc_block[0].sst_id = BLOCK_UNINIT;
...@@ -90,7 +92,7 @@ int sst_stalled(void) ...@@ -90,7 +92,7 @@ int sst_stalled(void)
retry--; retry--;
} }
pr_debug("sst: in Stalled State\n"); pr_debug("in Stalled State\n");
return retval; return retval;
} }
...@@ -138,23 +140,23 @@ int sst_get_stream_allocated(struct snd_sst_params *str_param, ...@@ -138,23 +140,23 @@ int sst_get_stream_allocated(struct snd_sst_params *str_param,
retval = sst_alloc_stream((char *) &str_param->sparams, str_param->ops, retval = sst_alloc_stream((char *) &str_param->sparams, str_param->ops,
str_param->codec, str_param->device_type); str_param->codec, str_param->device_type);
if (retval < 0) { if (retval < 0) {
pr_err("sst: sst_alloc_stream failed %d\n", retval); pr_err("sst_alloc_stream failed %d\n", retval);
return retval; return retval;
} }
pr_debug("sst: Stream allocated %d\n", retval); pr_debug("Stream allocated %d\n", retval);
str_id = retval; str_id = retval;
str_info = &sst_drv_ctx->streams[str_id]; str_info = &sst_drv_ctx->streams[str_id];
/* Block the call for reply */ /* Block the call for reply */
retval = sst_wait_interruptible_timeout(sst_drv_ctx, retval = sst_wait_interruptible_timeout(sst_drv_ctx,
&str_info->ctrl_blk, SST_BLOCK_TIMEOUT); &str_info->ctrl_blk, SST_BLOCK_TIMEOUT);
if ((retval != 0) || (str_info->ctrl_blk.ret_code != 0)) { if ((retval != 0) || (str_info->ctrl_blk.ret_code != 0)) {
pr_debug("sst: FW alloc failed retval %d, ret_code %d\n", pr_debug("FW alloc failed retval %d, ret_code %d\n",
retval, str_info->ctrl_blk.ret_code); retval, str_info->ctrl_blk.ret_code);
str_id = -str_info->ctrl_blk.ret_code; /*return error*/ str_id = -str_info->ctrl_blk.ret_code; /*return error*/
*lib_dnld = str_info->ctrl_blk.data; *lib_dnld = str_info->ctrl_blk.data;
sst_clean_stream(str_info); sst_clean_stream(str_info);
} else } else
pr_debug("sst: FW Stream allocated sucess\n"); pr_debug("FW Stream allocated success\n");
return str_id; /*will ret either error (in above if) or correct str id*/ return str_id; /*will ret either error (in above if) or correct str id*/
} }
...@@ -196,14 +198,14 @@ int sst_get_stream(struct snd_sst_params *str_param) ...@@ -196,14 +198,14 @@ int sst_get_stream(struct snd_sst_params *str_param)
/* codec download is required */ /* codec download is required */
struct snd_sst_alloc_response *response; struct snd_sst_alloc_response *response;
pr_debug("sst: Codec is required.... trying that\n"); pr_debug("Codec is required.... trying that\n");
if (lib_dnld == NULL) { if (lib_dnld == NULL) {
pr_err("sst: lib download null!!! abort\n"); pr_err("lib download null!!! abort\n");
return -EIO; return -EIO;
} }
i = sst_get_block_stream(sst_drv_ctx); i = sst_get_block_stream(sst_drv_ctx);
response = sst_drv_ctx->alloc_block[i].ops_block.data; response = sst_drv_ctx->alloc_block[i].ops_block.data;
pr_debug("sst: alloc block allocated = %d\n", i); pr_debug("alloc block allocated = %d\n", i);
if (i < 0) { if (i < 0) {
kfree(lib_dnld); kfree(lib_dnld);
return -ENOMEM; return -ENOMEM;
...@@ -213,15 +215,15 @@ int sst_get_stream(struct snd_sst_params *str_param) ...@@ -213,15 +215,15 @@ int sst_get_stream(struct snd_sst_params *str_param)
sst_drv_ctx->alloc_block[i].sst_id = BLOCK_UNINIT; sst_drv_ctx->alloc_block[i].sst_id = BLOCK_UNINIT;
if (!retval) { if (!retval) {
pr_debug("sst: codec was downloaded sucesfully\n"); pr_debug("codec was downloaded successfully\n");
retval = sst_get_stream_allocated(str_param, &lib_dnld); retval = sst_get_stream_allocated(str_param, &lib_dnld);
if (retval <= 0) if (retval <= 0)
goto err; goto err;
pr_debug("sst: Alloc done stream id %d\n", retval); pr_debug("Alloc done stream id %d\n", retval);
} else { } else {
pr_debug("sst: codec download failed\n"); pr_debug("codec download failed\n");
retval = -EIO; retval = -EIO;
goto err; goto err;
} }
...@@ -279,10 +281,10 @@ void sst_process_mad_ops(struct work_struct *work) ...@@ -279,10 +281,10 @@ void sst_process_mad_ops(struct work_struct *work)
retval = sst_start_stream(mad_ops->stream_id); retval = sst_start_stream(mad_ops->stream_id);
break; break;
case SST_SND_STREAM_PROCESS: case SST_SND_STREAM_PROCESS:
pr_debug("sst: play/capt frames...\n"); pr_debug("play/capt frames...\n");
break; break;
default: default:
pr_err("sst: wrong control_ops reported\n"); pr_err(" wrong control_ops reported\n");
} }
return; return;
} }
...@@ -301,19 +303,19 @@ int sst_control_set(int control_element, void *value) ...@@ -301,19 +303,19 @@ int sst_control_set(int control_element, void *value)
if (sst_drv_ctx->sst_state == SST_SUSPENDED) { if (sst_drv_ctx->sst_state == SST_SUSPENDED) {
/*LPE is suspended, resume it before proceding*/ /*LPE is suspended, resume it before proceding*/
pr_debug("sst: Resuming from Suspended state\n"); pr_debug("Resuming from Suspended state\n");
retval = intel_sst_resume(sst_drv_ctx->pci); retval = intel_sst_resume(sst_drv_ctx->pci);
if (retval) { if (retval) {
pr_err("sst: Resume Failed = %#x, abort\n", retval); pr_err("Resume Failed = %#x, abort\n", retval);
return retval; return retval;
} }
} }
if (sst_drv_ctx->sst_state == SST_UN_INIT) { if (sst_drv_ctx->sst_state == SST_UN_INIT) {
/* FW is not downloaded */ /* FW is not downloaded */
pr_debug("sst: DSP Downloading FW now...\n"); pr_debug("DSP Downloading FW now...\n");
retval = sst_download_fw(); retval = sst_download_fw();
if (retval) { if (retval) {
pr_err("sst: FW download fail %x, abort\n", retval); pr_err("FW download fail %x, abort\n", retval);
return retval; return retval;
} }
if (sst_drv_ctx->pci_id == SST_MRST_PCI_ID && if (sst_drv_ctx->pci_id == SST_MRST_PCI_ID &&
...@@ -361,7 +363,7 @@ int sst_control_set(int control_element, void *value) ...@@ -361,7 +363,7 @@ int sst_control_set(int control_element, void *value)
struct pcm_stream_info *str_info; struct pcm_stream_info *str_info;
struct stream_info *stream; struct stream_info *stream;
pr_debug("sst: stream init called\n"); pr_debug("stream init called\n");
str_info = (struct pcm_stream_info *)value; str_info = (struct pcm_stream_info *)value;
str_id = str_info->str_id; str_id = str_info->str_id;
retval = sst_validate_strid(str_id); retval = sst_validate_strid(str_id);
...@@ -369,7 +371,7 @@ int sst_control_set(int control_element, void *value) ...@@ -369,7 +371,7 @@ int sst_control_set(int control_element, void *value)
break; break;
stream = &sst_drv_ctx->streams[str_id]; stream = &sst_drv_ctx->streams[str_id];
pr_debug("sst: setting the period ptrs\n"); pr_debug("setting the period ptrs\n");
stream->pcm_substream = str_info->mad_substream; stream->pcm_substream = str_info->mad_substream;
stream->period_elapsed = str_info->period_elapsed; stream->period_elapsed = str_info->period_elapsed;
stream->sfreq = str_info->sfreq; stream->sfreq = str_info->sfreq;
...@@ -398,14 +400,14 @@ int sst_control_set(int control_element, void *value) ...@@ -398,14 +400,14 @@ int sst_control_set(int control_element, void *value)
+(str_id * sizeof(fw_tstamp))), +(str_id * sizeof(fw_tstamp))),
sizeof(fw_tstamp)); sizeof(fw_tstamp));
pr_debug("sst: Pointer Query on strid = %d ops %d\n", pr_debug("Pointer Query on strid = %d ops %d\n",
str_id, stream->ops); str_id, stream->ops);
if (stream->ops == STREAM_OPS_PLAYBACK) if (stream->ops == STREAM_OPS_PLAYBACK)
stream_info->buffer_ptr = fw_tstamp.samples_rendered; stream_info->buffer_ptr = fw_tstamp.samples_rendered;
else else
stream_info->buffer_ptr = fw_tstamp.samples_processed; stream_info->buffer_ptr = fw_tstamp.samples_processed;
pr_debug("sst: Samples rendered = %llu, buffer ptr %llu\n", pr_debug("Samples rendered = %llu, buffer ptr %llu\n",
fw_tstamp.samples_rendered, stream_info->buffer_ptr); fw_tstamp.samples_rendered, stream_info->buffer_ptr);
break; break;
} }
...@@ -417,7 +419,7 @@ int sst_control_set(int control_element, void *value) ...@@ -417,7 +419,7 @@ int sst_control_set(int control_element, void *value)
} }
default: default:
/* Illegal case */ /* Illegal case */
pr_warn("sst: illegal req\n"); pr_warn("illegal req\n");
return -EINVAL; return -EINVAL;
} }
...@@ -439,12 +441,12 @@ struct intel_sst_card_ops sst_pmic_ops = { ...@@ -439,12 +441,12 @@ struct intel_sst_card_ops sst_pmic_ops = {
int register_sst_card(struct intel_sst_card_ops *card) int register_sst_card(struct intel_sst_card_ops *card)
{ {
if (!sst_drv_ctx) { if (!sst_drv_ctx) {
pr_err("sst: No SST driver register card reject\n"); pr_err("No SST driver register card reject\n");
return -ENODEV; return -ENODEV;
} }
if (!card || !card->module_name) { if (!card || !card->module_name) {
pr_err("sst: Null Pointer Passed\n"); pr_err("Null Pointer Passed\n");
return -EINVAL; return -EINVAL;
} }
if (sst_drv_ctx->pmic_state == SND_MAD_UN_INIT) { if (sst_drv_ctx->pmic_state == SND_MAD_UN_INIT) {
...@@ -460,13 +462,13 @@ int register_sst_card(struct intel_sst_card_ops *card) ...@@ -460,13 +462,13 @@ int register_sst_card(struct intel_sst_card_ops *card)
sst_drv_ctx->scard_ops->card_status = SND_CARD_UN_INIT; sst_drv_ctx->scard_ops->card_status = SND_CARD_UN_INIT;
return 0; return 0;
} else { } else {
pr_err("sst: strcmp fail %s\n", card->module_name); pr_err("strcmp fail %s\n", card->module_name);
return -EINVAL; return -EINVAL;
} }
} else { } else {
/* already registered a driver */ /* already registered a driver */
pr_err("sst: Repeat for registeration..denied\n"); pr_err("Repeat for registration..denied\n");
return -EBADRQC; return -EBADRQC;
} }
return 0; return 0;
...@@ -486,7 +488,7 @@ void unregister_sst_card(struct intel_sst_card_ops *card) ...@@ -486,7 +488,7 @@ void unregister_sst_card(struct intel_sst_card_ops *card)
/* unreg */ /* unreg */
sst_pmic_ops.module_name = ""; sst_pmic_ops.module_name = "";
sst_drv_ctx->pmic_state = SND_MAD_UN_INIT; sst_drv_ctx->pmic_state = SND_MAD_UN_INIT;
pr_debug("sst: Unregistered %s\n", card->module_name); pr_debug("Unregistered %s\n", card->module_name);
} }
return; return;
} }
......
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
* This file contains all dsp controlling functions like firmware download, * This file contains all dsp controlling functions like firmware download,
* setting/resetting dsp cores, etc * setting/resetting dsp cores, etc
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/firmware.h> #include <linux/firmware.h>
...@@ -47,7 +50,7 @@ static int intel_sst_reset_dsp_mrst(void) ...@@ -47,7 +50,7 @@ static int intel_sst_reset_dsp_mrst(void)
{ {
union config_status_reg csr; union config_status_reg csr;
pr_debug("sst: Resetting the DSP in mrst\n"); pr_debug("Resetting the DSP in mrst\n");
csr.full = 0x3a2; csr.full = 0x3a2;
sst_shim_write(sst_drv_ctx->shim, SST_CSR, csr.full); sst_shim_write(sst_drv_ctx->shim, SST_CSR, csr.full);
csr.full = sst_shim_read(sst_drv_ctx->shim, SST_CSR); csr.full = sst_shim_read(sst_drv_ctx->shim, SST_CSR);
...@@ -68,7 +71,7 @@ static int intel_sst_reset_dsp_medfield(void) ...@@ -68,7 +71,7 @@ static int intel_sst_reset_dsp_medfield(void)
{ {
union config_status_reg csr; union config_status_reg csr;
pr_debug("sst: Resetting the DSP in medfield\n"); pr_debug("Resetting the DSP in medfield\n");
csr.full = 0x048303E2; csr.full = 0x048303E2;
sst_shim_write(sst_drv_ctx->shim, SST_CSR, csr.full); sst_shim_write(sst_drv_ctx->shim, SST_CSR, csr.full);
...@@ -90,7 +93,7 @@ static int sst_start_mrst(void) ...@@ -90,7 +93,7 @@ static int sst_start_mrst(void)
csr.part.run_stall = 0; csr.part.run_stall = 0;
csr.part.sst_reset = 0; csr.part.sst_reset = 0;
csr.part.strb_cntr_rst = 1; csr.part.strb_cntr_rst = 1;
pr_debug("sst: Setting SST to execute_mrst 0x%x\n", csr.full); pr_debug("Setting SST to execute_mrst 0x%x\n", csr.full);
sst_shim_write(sst_drv_ctx->shim, SST_CSR, csr.full); sst_shim_write(sst_drv_ctx->shim, SST_CSR, csr.full);
return 0; return 0;
...@@ -111,7 +114,7 @@ static int sst_start_medfield(void) ...@@ -111,7 +114,7 @@ static int sst_start_medfield(void)
sst_shim_write(sst_drv_ctx->shim, SST_CSR, csr.full); sst_shim_write(sst_drv_ctx->shim, SST_CSR, csr.full);
csr.full = 0x04830061; csr.full = 0x04830061;
sst_shim_write(sst_drv_ctx->shim, SST_CSR, csr.full); sst_shim_write(sst_drv_ctx->shim, SST_CSR, csr.full);
pr_debug("sst: Starting the DSP_medfld\n"); pr_debug("Starting the DSP_medfld\n");
return 0; return 0;
} }
...@@ -130,16 +133,16 @@ static int sst_parse_module(struct fw_module_header *module) ...@@ -130,16 +133,16 @@ static int sst_parse_module(struct fw_module_header *module)
u32 count; u32 count;
void __iomem *ram; void __iomem *ram;
pr_debug("sst: module sign %s size %x blocks %x type %x\n", pr_debug("module sign %s size %x blocks %x type %x\n",
module->signature, module->mod_size, module->signature, module->mod_size,
module->blocks, module->type); module->blocks, module->type);
pr_debug("sst: module entrypoint 0x%x\n", module->entry_point); pr_debug("module entrypoint 0x%x\n", module->entry_point);
block = (void *)module + sizeof(*module); block = (void *)module + sizeof(*module);
for (count = 0; count < module->blocks; count++) { for (count = 0; count < module->blocks; count++) {
if (block->size <= 0) { if (block->size <= 0) {
pr_err("sst: block size invalid\n"); pr_err("block size invalid\n");
return -EINVAL; return -EINVAL;
} }
switch (block->type) { switch (block->type) {
...@@ -150,7 +153,7 @@ static int sst_parse_module(struct fw_module_header *module) ...@@ -150,7 +153,7 @@ static int sst_parse_module(struct fw_module_header *module)
ram = sst_drv_ctx->dram; ram = sst_drv_ctx->dram;
break; break;
default: default:
pr_err("sst: wrong ram type0x%x in block0x%x\n", pr_err("wrong ram type0x%x in block0x%x\n",
block->type, count); block->type, count);
return -EINVAL; return -EINVAL;
} }
...@@ -184,10 +187,10 @@ static int sst_parse_fw_image(const struct firmware *sst_fw) ...@@ -184,10 +187,10 @@ static int sst_parse_fw_image(const struct firmware *sst_fw)
if ((strncmp(header->signature, SST_FW_SIGN, 4) != 0) || if ((strncmp(header->signature, SST_FW_SIGN, 4) != 0) ||
(sst_fw->size != header->file_size + sizeof(*header))) { (sst_fw->size != header->file_size + sizeof(*header))) {
/* Invalid FW signature */ /* Invalid FW signature */
pr_err("sst: InvalidFW sign/filesize mismatch\n"); pr_err("Invalid FW sign/filesize mismatch\n");
return -EINVAL; return -EINVAL;
} }
pr_debug("sst: header sign=%s size=%x modules=%x fmt=%x size=%x\n", pr_debug("header sign=%s size=%x modules=%x fmt=%x size=%x\n",
header->signature, header->file_size, header->modules, header->signature, header->file_size, header->modules,
header->file_format, sizeof(*header)); header->file_format, sizeof(*header));
module = (void *)sst_fw->data + sizeof(*header); module = (void *)sst_fw->data + sizeof(*header);
...@@ -214,7 +217,7 @@ int sst_load_fw(const struct firmware *fw, void *context) ...@@ -214,7 +217,7 @@ int sst_load_fw(const struct firmware *fw, void *context)
{ {
int ret_val; int ret_val;
pr_debug("sst: load_fw called\n"); pr_debug("load_fw called\n");
BUG_ON(!fw); BUG_ON(!fw);
if (sst_drv_ctx->pci_id == SST_MRST_PCI_ID) if (sst_drv_ctx->pci_id == SST_MRST_PCI_ID)
...@@ -239,7 +242,7 @@ int sst_load_fw(const struct firmware *fw, void *context) ...@@ -239,7 +242,7 @@ int sst_load_fw(const struct firmware *fw, void *context)
if (ret_val) if (ret_val)
return ret_val; return ret_val;
pr_debug("sst: fw loaded successful!!!\n"); pr_debug("fw loaded successful!!!\n");
return ret_val; return ret_val;
} }
...@@ -261,7 +264,7 @@ static int sst_download_library(const struct firmware *fw_lib, ...@@ -261,7 +264,7 @@ static int sst_download_library(const struct firmware *fw_lib,
pvt_id = sst_assign_pvt_id(sst_drv_ctx); pvt_id = sst_assign_pvt_id(sst_drv_ctx);
i = sst_get_block_stream(sst_drv_ctx); i = sst_get_block_stream(sst_drv_ctx);
pr_debug("sst: alloc block allocated = %d, pvt_id %d\n", i, pvt_id); pr_debug("alloc block allocated = %d, pvt_id %d\n", i, pvt_id);
if (i < 0) { if (i < 0) {
kfree(msg); kfree(msg);
return -ENOMEM; return -ENOMEM;
...@@ -281,11 +284,11 @@ static int sst_download_library(const struct firmware *fw_lib, ...@@ -281,11 +284,11 @@ static int sst_download_library(const struct firmware *fw_lib,
if (retval) { if (retval) {
/* error */ /* error */
sst_drv_ctx->alloc_block[i].sst_id = BLOCK_UNINIT; sst_drv_ctx->alloc_block[i].sst_id = BLOCK_UNINIT;
pr_err("sst: Prep codec downloaded failed %d\n", pr_err("Prep codec downloaded failed %d\n",
retval); retval);
return -EIO; return -EIO;
} }
pr_debug("sst: FW responded, ready for download now...\n"); pr_debug("FW responded, ready for download now...\n");
/* downloading on success */ /* downloading on success */
mutex_lock(&sst_drv_ctx->sst_lock); mutex_lock(&sst_drv_ctx->sst_lock);
sst_drv_ctx->sst_state = SST_FW_LOADED; sst_drv_ctx->sst_state = SST_FW_LOADED;
...@@ -325,7 +328,7 @@ static int sst_download_library(const struct firmware *fw_lib, ...@@ -325,7 +328,7 @@ static int sst_download_library(const struct firmware *fw_lib,
list_add_tail(&msg->node, &sst_drv_ctx->ipc_dispatch_list); list_add_tail(&msg->node, &sst_drv_ctx->ipc_dispatch_list);
spin_unlock(&sst_drv_ctx->list_spin_lock); spin_unlock(&sst_drv_ctx->list_spin_lock);
sst_post_message(&sst_drv_ctx->ipc_post_msg_wq); sst_post_message(&sst_drv_ctx->ipc_post_msg_wq);
pr_debug("sst: Waiting for FW response Download complete\n"); pr_debug("Waiting for FW response Download complete\n");
sst_drv_ctx->alloc_block[i].ops_block.condition = false; sst_drv_ctx->alloc_block[i].ops_block.condition = false;
retval = sst_wait_timeout(sst_drv_ctx, &sst_drv_ctx->alloc_block[i]); retval = sst_wait_timeout(sst_drv_ctx, &sst_drv_ctx->alloc_block[i]);
if (retval) { if (retval) {
...@@ -337,7 +340,7 @@ static int sst_download_library(const struct firmware *fw_lib, ...@@ -337,7 +340,7 @@ static int sst_download_library(const struct firmware *fw_lib,
return -EIO; return -EIO;
} }
pr_debug("sst: FW sucess on Download complete\n"); pr_debug("FW success on Download complete\n");
sst_drv_ctx->alloc_block[i].sst_id = BLOCK_UNINIT; sst_drv_ctx->alloc_block[i].sst_id = BLOCK_UNINIT;
mutex_lock(&sst_drv_ctx->sst_lock); mutex_lock(&sst_drv_ctx->sst_lock);
sst_drv_ctx->sst_state = SST_FW_RUNNING; sst_drv_ctx->sst_state = SST_FW_RUNNING;
...@@ -360,14 +363,14 @@ static int sst_validate_library(const struct firmware *fw_lib, ...@@ -360,14 +363,14 @@ static int sst_validate_library(const struct firmware *fw_lib,
header = (struct fw_header *)fw_lib->data; header = (struct fw_header *)fw_lib->data;
if (header->modules != 1) { if (header->modules != 1) {
pr_err("sst: Module no mismatch found\n "); pr_err("Module no mismatch found\n");
err = -EINVAL; err = -EINVAL;
goto exit; goto exit;
} }
module = (void *)fw_lib->data + sizeof(*header); module = (void *)fw_lib->data + sizeof(*header);
*entry_point = module->entry_point; *entry_point = module->entry_point;
pr_debug("sst: Module entry point 0x%x\n", *entry_point); pr_debug("Module entry point 0x%x\n", *entry_point);
pr_debug("sst: Module Sign %s, Size 0x%x, Blocks 0x%x Type 0x%x\n", pr_debug("Module Sign %s, Size 0x%x, Blocks 0x%x Type 0x%x\n",
module->signature, module->mod_size, module->signature, module->mod_size,
module->blocks, module->type); module->blocks, module->type);
...@@ -381,20 +384,20 @@ static int sst_validate_library(const struct firmware *fw_lib, ...@@ -381,20 +384,20 @@ static int sst_validate_library(const struct firmware *fw_lib,
dsize += block->size; dsize += block->size;
break; break;
default: default:
pr_err("sst: Invalid block type for 0x%x\n", n_blk); pr_err("Invalid block type for 0x%x\n", n_blk);
err = -EINVAL; err = -EINVAL;
goto exit; goto exit;
} }
block = (void *)block + sizeof(*block) + block->size; block = (void *)block + sizeof(*block) + block->size;
} }
if (isize > slot->iram_size || dsize > slot->dram_size) { if (isize > slot->iram_size || dsize > slot->dram_size) {
pr_err("sst: library exceeds size allocated\n"); pr_err("library exceeds size allocated\n");
err = -EINVAL; err = -EINVAL;
goto exit; goto exit;
} else } else
pr_debug("sst: Library is safe for download...\n"); pr_debug("Library is safe for download...\n");
pr_debug("sst: iram 0x%x, dram 0x%x, iram 0x%x, dram 0x%x\n", pr_debug("iram 0x%x, dram 0x%x, iram 0x%x, dram 0x%x\n",
isize, dsize, slot->iram_size, slot->dram_size); isize, dsize, slot->iram_size, slot->dram_size);
exit: exit:
return err; return err;
...@@ -414,15 +417,15 @@ int sst_load_library(struct snd_sst_lib_download *lib, u8 ops) ...@@ -414,15 +417,15 @@ int sst_load_library(struct snd_sst_lib_download *lib, u8 ops)
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
pr_debug("sst: Lib Type 0x%x, Slot 0x%x, ops 0x%x\n", pr_debug("Lib Type 0x%x, Slot 0x%x, ops 0x%x\n",
lib->lib_info.lib_type, lib->slot_info.slot_num, ops); lib->lib_info.lib_type, lib->slot_info.slot_num, ops);
pr_debug("sst: Version 0x%x, name %s, caps 0x%x media type 0x%x\n", pr_debug("Version 0x%x, name %s, caps 0x%x media type 0x%x\n",
lib->lib_info.lib_version, lib->lib_info.lib_name, lib->lib_info.lib_version, lib->lib_info.lib_name,
lib->lib_info.lib_caps, lib->lib_info.media_type); lib->lib_info.lib_caps, lib->lib_info.media_type);
pr_debug("sst: IRAM Size 0x%x, offset 0x%x\n", pr_debug("IRAM Size 0x%x, offset 0x%x\n",
lib->slot_info.iram_size, lib->slot_info.iram_offset); lib->slot_info.iram_size, lib->slot_info.iram_offset);
pr_debug("sst: DRAM Size 0x%x, offset 0x%x\n", pr_debug("DRAM Size 0x%x, offset 0x%x\n",
lib->slot_info.dram_size, lib->slot_info.dram_offset); lib->slot_info.dram_size, lib->slot_info.dram_offset);
switch (lib->lib_info.lib_type) { switch (lib->lib_info.lib_type) {
...@@ -442,7 +445,7 @@ int sst_load_library(struct snd_sst_lib_download *lib, u8 ops) ...@@ -442,7 +445,7 @@ int sst_load_library(struct snd_sst_lib_download *lib, u8 ops)
type = "wma9_"; type = "wma9_";
break; break;
default: default:
pr_err("sst: Invalid codec type\n"); pr_err("Invalid codec type\n");
error = -EINVAL; error = -EINVAL;
goto wake; goto wake;
} }
...@@ -458,11 +461,11 @@ int sst_load_library(struct snd_sst_lib_download *lib, u8 ops) ...@@ -458,11 +461,11 @@ int sst_load_library(struct snd_sst_lib_download *lib, u8 ops)
lib->slot_info.slot_num); lib->slot_info.slot_num);
len += snprintf(buf + len, sizeof(buf) - len, ".bin"); len += snprintf(buf + len, sizeof(buf) - len, ".bin");
pr_debug("sst: Requesting %s\n", buf); pr_debug("Requesting %s\n", buf);
error = request_firmware(&fw_lib, buf, &sst_drv_ctx->pci->dev); error = request_firmware(&fw_lib, buf, &sst_drv_ctx->pci->dev);
if (error) { if (error) {
pr_err("sst: library load failed %d\n", error); pr_err("library load failed %d\n", error);
goto wake; goto wake;
} }
error = sst_validate_library(fw_lib, &lib->slot_info, &entry_point); error = sst_validate_library(fw_lib, &lib->slot_info, &entry_point);
...@@ -476,7 +479,7 @@ int sst_load_library(struct snd_sst_lib_download *lib, u8 ops) ...@@ -476,7 +479,7 @@ int sst_load_library(struct snd_sst_lib_download *lib, u8 ops)
goto wake_free; goto wake_free;
/* lib is downloaded and init send alloc again */ /* lib is downloaded and init send alloc again */
pr_debug("sst: Library is downloaded now...\n"); pr_debug("Library is downloaded now...\n");
wake_free: wake_free:
/* sst_wake_up_alloc_block(sst_drv_ctx, pvt_id, error, NULL); */ /* sst_wake_up_alloc_block(sst_drv_ctx, pvt_id, error, NULL); */
release_firmware(fw_lib); release_firmware(fw_lib);
......
This diff is collapsed.
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
* This file contains all private functions * This file contains all private functions
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/firmware.h> #include <linux/firmware.h>
...@@ -60,7 +62,7 @@ int sst_get_block_stream(struct intel_sst_drv *sst_drv_ctx) ...@@ -60,7 +62,7 @@ int sst_get_block_stream(struct intel_sst_drv *sst_drv_ctx)
} }
} }
if (i == MAX_ACTIVE_STREAM) { if (i == MAX_ACTIVE_STREAM) {
pr_err("sst: max alloc_stream reached"); pr_err("max alloc_stream reached\n");
i = -EBUSY; /* active stream limit reached */ i = -EBUSY; /* active stream limit reached */
} }
return i; return i;
...@@ -84,14 +86,14 @@ int sst_wait_interruptible(struct intel_sst_drv *sst_drv_ctx, ...@@ -84,14 +86,14 @@ int sst_wait_interruptible(struct intel_sst_drv *sst_drv_ctx,
block->condition)) { block->condition)) {
/* event wake */ /* event wake */
if (block->ret_code < 0) { if (block->ret_code < 0) {
pr_err("sst: stream failed %d\n", block->ret_code); pr_err("stream failed %d\n", block->ret_code);
retval = -EBUSY; retval = -EBUSY;
} else { } else {
pr_debug("sst: event up\n"); pr_debug("event up\n");
retval = 0; retval = 0;
} }
} else { } else {
pr_err("sst: signal interrupted\n"); pr_err("signal interrupted\n");
retval = -EINTR; retval = -EINTR;
} }
return retval; return retval;
...@@ -115,18 +117,18 @@ int sst_wait_interruptible_timeout( ...@@ -115,18 +117,18 @@ int sst_wait_interruptible_timeout(
{ {
int retval = 0; int retval = 0;
pr_debug("sst: sst_wait_interruptible_timeout - waiting....\n"); pr_debug("sst_wait_interruptible_timeout - waiting....\n");
if (wait_event_interruptible_timeout(sst_drv_ctx->wait_queue, if (wait_event_interruptible_timeout(sst_drv_ctx->wait_queue,
block->condition, block->condition,
msecs_to_jiffies(timeout))) { msecs_to_jiffies(timeout))) {
if (block->ret_code < 0) if (block->ret_code < 0)
pr_err("sst: stream failed %d\n", block->ret_code); pr_err("stream failed %d\n", block->ret_code);
else else
pr_debug("sst: event up\n"); pr_debug("event up\n");
retval = block->ret_code; retval = block->ret_code;
} else { } else {
block->on = false; block->on = false;
pr_err("sst: timeout occured...\n"); pr_err("timeout occurred...\n");
/*setting firmware state as uninit so that the /*setting firmware state as uninit so that the
firmware will get re-downloaded on next request firmware will get re-downloaded on next request
this is because firmare not responding for 5 sec this is because firmare not responding for 5 sec
...@@ -156,18 +158,18 @@ int sst_wait_timeout(struct intel_sst_drv *sst_drv_ctx, ...@@ -156,18 +158,18 @@ int sst_wait_timeout(struct intel_sst_drv *sst_drv_ctx,
/* NOTE: /* NOTE:
Observed that FW processes the alloc msg and replies even Observed that FW processes the alloc msg and replies even
before the alloc thread has finished execution */ before the alloc thread has finished execution */
pr_debug("sst: waiting for %x, condition %x\n", pr_debug("waiting for %x, condition %x\n",
block->sst_id, block->ops_block.condition); block->sst_id, block->ops_block.condition);
if (wait_event_interruptible_timeout(sst_drv_ctx->wait_queue, if (wait_event_interruptible_timeout(sst_drv_ctx->wait_queue,
block->ops_block.condition, block->ops_block.condition,
msecs_to_jiffies(SST_BLOCK_TIMEOUT))) { msecs_to_jiffies(SST_BLOCK_TIMEOUT))) {
/* event wake */ /* event wake */
pr_debug("sst: Event wake %x\n", block->ops_block.condition); pr_debug("Event wake %x\n", block->ops_block.condition);
pr_debug("sst: message ret: %d\n", block->ops_block.ret_code); pr_debug("message ret: %d\n", block->ops_block.ret_code);
retval = block->ops_block.ret_code; retval = block->ops_block.ret_code;
} else { } else {
block->ops_block.on = false; block->ops_block.on = false;
pr_err("sst: Wait timed-out %x\n", block->ops_block.condition); pr_err("Wait timed-out %x\n", block->ops_block.condition);
/* settign firmware state as uninit so that the /* settign firmware state as uninit so that the
firmware will get redownloaded on next request firmware will get redownloaded on next request
this is because firmare not responding for 5 sec this is because firmare not responding for 5 sec
...@@ -192,14 +194,14 @@ int sst_create_large_msg(struct ipc_post **arg) ...@@ -192,14 +194,14 @@ int sst_create_large_msg(struct ipc_post **arg)
msg = kzalloc(sizeof(struct ipc_post), GFP_ATOMIC); msg = kzalloc(sizeof(struct ipc_post), GFP_ATOMIC);
if (!msg) { if (!msg) {
pr_err("sst: kzalloc msg failed\n"); pr_err("kzalloc msg failed\n");
return -ENOMEM; return -ENOMEM;
} }
msg->mailbox_data = kzalloc(SST_MAILBOX_SIZE, GFP_ATOMIC); msg->mailbox_data = kzalloc(SST_MAILBOX_SIZE, GFP_ATOMIC);
if (!msg->mailbox_data) { if (!msg->mailbox_data) {
kfree(msg); kfree(msg);
pr_err("sst: kzalloc mailbox_data failed"); pr_err("kzalloc mailbox_data failed");
return -ENOMEM; return -ENOMEM;
}; };
*arg = msg; *arg = msg;
...@@ -219,7 +221,7 @@ int sst_create_short_msg(struct ipc_post **arg) ...@@ -219,7 +221,7 @@ int sst_create_short_msg(struct ipc_post **arg)
msg = kzalloc(sizeof(*msg), GFP_ATOMIC); msg = kzalloc(sizeof(*msg), GFP_ATOMIC);
if (!msg) { if (!msg) {
pr_err("sst: kzalloc msg failed\n"); pr_err("kzalloc msg failed\n");
return -ENOMEM; return -ENOMEM;
} }
msg->mailbox_data = NULL; msg->mailbox_data = NULL;
...@@ -290,10 +292,10 @@ int sst_enable_rx_timeslot(int status) ...@@ -290,10 +292,10 @@ int sst_enable_rx_timeslot(int status)
struct ipc_post *msg = NULL; struct ipc_post *msg = NULL;
if (sst_create_short_msg(&msg)) { if (sst_create_short_msg(&msg)) {
pr_err("sst: mem allocation failed\n"); pr_err("mem allocation failed\n");
return -ENOMEM; return -ENOMEM;
} }
pr_debug("sst: ipc message sending: ENABLE_RX_TIME_SLOT\n"); pr_debug("ipc message sending: ENABLE_RX_TIME_SLOT\n");
sst_fill_header(&msg->header, IPC_IA_ENABLE_RX_TIME_SLOT, 0, 0); sst_fill_header(&msg->header, IPC_IA_ENABLE_RX_TIME_SLOT, 0, 0);
msg->header.part.data = status; msg->header.part.data = status;
sst_drv_ctx->hs_info_blk.condition = false; sst_drv_ctx->hs_info_blk.condition = false;
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
* This file contains the stream operations of SST driver * This file contains the stream operations of SST driver
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/firmware.h> #include <linux/firmware.h>
#include <linux/sched.h> #include <linux/sched.h>
...@@ -46,7 +48,7 @@ ...@@ -46,7 +48,7 @@
int sst_check_device_type(u32 device, u32 num_chan, u32 *pcm_slot) int sst_check_device_type(u32 device, u32 num_chan, u32 *pcm_slot)
{ {
if (device >= MAX_NUM_STREAMS) { if (device >= MAX_NUM_STREAMS) {
pr_debug("sst: device type invalid %d\n", device); pr_debug("device type invalid %d\n", device);
return -EINVAL; return -EINVAL;
} }
if (sst_drv_ctx->streams[device].status == STREAM_UN_INIT) { if (sst_drv_ctx->streams[device].status == STREAM_UN_INIT) {
...@@ -71,15 +73,15 @@ int sst_check_device_type(u32 device, u32 num_chan, u32 *pcm_slot) ...@@ -71,15 +73,15 @@ int sst_check_device_type(u32 device, u32 num_chan, u32 *pcm_slot)
else if (device == SND_SST_DEVICE_CAPTURE && num_chan == 4) else if (device == SND_SST_DEVICE_CAPTURE && num_chan == 4)
*pcm_slot = 0x0F; *pcm_slot = 0x0F;
else { else {
pr_debug("sst: No condition satisfied.. ret err\n"); pr_debug("No condition satisfied.. ret err\n");
return -EINVAL; return -EINVAL;
} }
} else { } else {
pr_debug("sst: this stream state is not uni-init, is %d\n", pr_debug("this stream state is not uni-init, is %d\n",
sst_drv_ctx->streams[device].status); sst_drv_ctx->streams[device].status);
return -EBADRQC; return -EBADRQC;
} }
pr_debug("sst: returning slot %x\n", *pcm_slot); pr_debug("returning slot %x\n", *pcm_slot);
return 0; return 0;
} }
/** /**
...@@ -96,7 +98,7 @@ static unsigned int get_mrst_stream_id(void) ...@@ -96,7 +98,7 @@ static unsigned int get_mrst_stream_id(void)
if (sst_drv_ctx->streams[i].status == STREAM_UN_INIT) if (sst_drv_ctx->streams[i].status == STREAM_UN_INIT)
return i; return i;
} }
pr_debug("sst: Didnt find empty stream for mrst\n"); pr_debug("Didnt find empty stream for mrst\n");
return -EBUSY; return -EBUSY;
} }
...@@ -305,7 +307,7 @@ int sst_pause_stream(int str_id) ...@@ -305,7 +307,7 @@ int sst_pause_stream(int str_id)
if (str_info->prev == STREAM_UN_INIT) if (str_info->prev == STREAM_UN_INIT)
return -EBADRQC; return -EBADRQC;
if (str_info->ctrl_blk.on == true) { if (str_info->ctrl_blk.on == true) {
pr_err("SST ERR: control path is in use\n "); pr_err("SST ERR: control path is in use\n");
return -EINVAL; return -EINVAL;
} }
if (sst_create_short_msg(&msg)) if (sst_create_short_msg(&msg))
...@@ -333,7 +335,7 @@ int sst_pause_stream(int str_id) ...@@ -333,7 +335,7 @@ int sst_pause_stream(int str_id)
} }
} else { } else {
retval = -EBADRQC; retval = -EBADRQC;
pr_err("SST ERR:BADQRC for stream\n "); pr_err("SST ERR: BADQRC for stream\n");
} }
return retval; return retval;
...@@ -468,7 +470,7 @@ int sst_drop_stream(int str_id) ...@@ -468,7 +470,7 @@ int sst_drop_stream(int str_id)
} }
} else { } else {
retval = -EBADRQC; retval = -EBADRQC;
pr_err("SST ERR:BADQRC for stream\n"); pr_err("SST ERR: BADQRC for stream\n");
} }
return retval; return retval;
} }
......
This diff is collapsed.
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* ALSA driver handling mixer controls for Intel MAD chipset * ALSA driver handling mixer controls for Intel MAD chipset
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <sound/core.h> #include <sound/core.h>
#include <sound/control.h> #include <sound/control.h>
#include "jack.h" #include "jack.h"
...@@ -216,7 +219,7 @@ static int snd_intelmad_volume_get(struct snd_kcontrol *kcontrol, ...@@ -216,7 +219,7 @@ static int snd_intelmad_volume_get(struct snd_kcontrol *kcontrol,
struct snd_intelmad *intelmaddata; struct snd_intelmad *intelmaddata;
struct snd_pmic_ops *scard_ops; struct snd_pmic_ops *scard_ops;
pr_debug("sst: snd_intelmad_volume_get called\n"); pr_debug("snd_intelmad_volume_get called\n");
WARN_ON(!uval); WARN_ON(!uval);
WARN_ON(!kcontrol); WARN_ON(!kcontrol);
...@@ -273,7 +276,7 @@ static int snd_intelmad_mute_get(struct snd_kcontrol *kcontrol, ...@@ -273,7 +276,7 @@ static int snd_intelmad_mute_get(struct snd_kcontrol *kcontrol,
struct snd_intelmad *intelmaddata; struct snd_intelmad *intelmaddata;
struct snd_pmic_ops *scard_ops; struct snd_pmic_ops *scard_ops;
pr_debug("sst: Mute_get called\n"); pr_debug("Mute_get called\n");
WARN_ON(!uval); WARN_ON(!uval);
WARN_ON(!kcontrol); WARN_ON(!kcontrol);
...@@ -332,7 +335,7 @@ static int snd_intelmad_volume_set(struct snd_kcontrol *kcontrol, ...@@ -332,7 +335,7 @@ static int snd_intelmad_volume_set(struct snd_kcontrol *kcontrol,
struct snd_intelmad *intelmaddata; struct snd_intelmad *intelmaddata;
struct snd_pmic_ops *scard_ops; struct snd_pmic_ops *scard_ops;
pr_debug("sst: volume set called:%ld %ld\n", pr_debug("volume set called:%ld %ld\n",
uval->value.integer.value[0], uval->value.integer.value[0],
uval->value.integer.value[1]); uval->value.integer.value[1]);
...@@ -387,7 +390,7 @@ static int snd_intelmad_mute_set(struct snd_kcontrol *kcontrol, ...@@ -387,7 +390,7 @@ static int snd_intelmad_mute_set(struct snd_kcontrol *kcontrol,
struct snd_intelmad *intelmaddata; struct snd_intelmad *intelmaddata;
struct snd_pmic_ops *scard_ops; struct snd_pmic_ops *scard_ops;
pr_debug("sst: snd_intelmad_mute_set called\n"); pr_debug("snd_intelmad_mute_set called\n");
WARN_ON(!uval); WARN_ON(!uval);
WARN_ON(!kcontrol); WARN_ON(!kcontrol);
...@@ -455,7 +458,7 @@ static int snd_intelmad_device_get(struct snd_kcontrol *kcontrol, ...@@ -455,7 +458,7 @@ static int snd_intelmad_device_get(struct snd_kcontrol *kcontrol,
{ {
struct snd_intelmad *intelmaddata; struct snd_intelmad *intelmaddata;
struct snd_pmic_ops *scard_ops; struct snd_pmic_ops *scard_ops;
pr_debug("sst: device_get called\n"); pr_debug("device_get called\n");
WARN_ON(!uval); WARN_ON(!uval);
WARN_ON(!kcontrol); WARN_ON(!kcontrol);
...@@ -492,7 +495,7 @@ static int snd_intelmad_device_set(struct snd_kcontrol *kcontrol, ...@@ -492,7 +495,7 @@ static int snd_intelmad_device_set(struct snd_kcontrol *kcontrol,
struct snd_pmic_ops *scard_ops; struct snd_pmic_ops *scard_ops;
int ret_val = 0, vendor, status; int ret_val = 0, vendor, status;
pr_debug("sst: snd_intelmad_device_set called\n"); pr_debug("snd_intelmad_device_set called\n");
WARN_ON(!uval); WARN_ON(!uval);
WARN_ON(!kcontrol); WARN_ON(!kcontrol);
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
* This file contains the control operations of msic vendors * This file contains the control operations of msic vendors
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/file.h> #include <linux/file.h>
#include "intel_sst.h" #include "intel_sst.h"
...@@ -83,7 +85,7 @@ static int msic_init_card(void) ...@@ -83,7 +85,7 @@ static int msic_init_card(void)
snd_msic_ops.cap_on = 0; snd_msic_ops.cap_on = 0;
snd_msic_ops.input_dev_id = DMIC; /*def dev*/ snd_msic_ops.input_dev_id = DMIC; /*def dev*/
snd_msic_ops.output_dev_id = STEREO_HEADPHONE; snd_msic_ops.output_dev_id = STEREO_HEADPHONE;
pr_debug("sst: msic init complete!!\n"); pr_debug("msic init complete!!\n");
return 0; return 0;
} }
...@@ -173,7 +175,7 @@ static int msic_power_up_pb(unsigned int device) ...@@ -173,7 +175,7 @@ static int msic_power_up_pb(unsigned int device)
return retval; return retval;
} }
pr_debug("sst: powering up pb.... Device %d\n", device); pr_debug("powering up pb.... Device %d\n", device);
sst_sc_reg_access(sc_access1, PMIC_WRITE, 4); sst_sc_reg_access(sc_access1, PMIC_WRITE, 4);
switch (device) { switch (device) {
case SND_SST_DEVICE_HEADSET: case SND_SST_DEVICE_HEADSET:
...@@ -205,7 +207,7 @@ static int msic_power_up_pb(unsigned int device) ...@@ -205,7 +207,7 @@ static int msic_power_up_pb(unsigned int device)
break; break;
default: default:
pr_warn("sst: Wrong Device %d, selected %d\n", pr_warn("Wrong Device %d, selected %d\n",
device, snd_msic_ops.output_dev_id); device, snd_msic_ops.output_dev_id);
} }
return sst_sc_reg_access(sc_access_pcm2, PMIC_READ_MODIFY, 1); return sst_sc_reg_access(sc_access_pcm2, PMIC_READ_MODIFY, 1);
...@@ -268,7 +270,7 @@ static int msic_power_up_cp(unsigned int device) ...@@ -268,7 +270,7 @@ static int msic_power_up_cp(unsigned int device)
return retval; return retval;
} }
pr_debug("sst: powering up cp....%d\n", snd_msic_ops.input_dev_id); pr_debug("powering up cp....%d\n", snd_msic_ops.input_dev_id);
sst_sc_reg_access(sc_access2, PMIC_READ_MODIFY, 1); sst_sc_reg_access(sc_access2, PMIC_READ_MODIFY, 1);
snd_msic_ops.cap_on = 1; snd_msic_ops.cap_on = 1;
if (snd_msic_ops.input_dev_id == AMIC) if (snd_msic_ops.input_dev_id == AMIC)
...@@ -283,7 +285,7 @@ static int msic_power_down(void) ...@@ -283,7 +285,7 @@ static int msic_power_down(void)
{ {
int retval = 0; int retval = 0;
pr_debug("sst: powering dn msic\n"); pr_debug("powering dn msic\n");
snd_msic_ops.pb_on = 0; snd_msic_ops.pb_on = 0;
snd_msic_ops.cap_on = 0; snd_msic_ops.cap_on = 0;
return retval; return retval;
...@@ -293,7 +295,7 @@ static int msic_power_down_pb(void) ...@@ -293,7 +295,7 @@ static int msic_power_down_pb(void)
{ {
int retval = 0; int retval = 0;
pr_debug("sst: powering dn pb....\n"); pr_debug("powering dn pb....\n");
snd_msic_ops.pb_on = 0; snd_msic_ops.pb_on = 0;
return retval; return retval;
} }
...@@ -302,7 +304,7 @@ static int msic_power_down_cp(void) ...@@ -302,7 +304,7 @@ static int msic_power_down_cp(void)
{ {
int retval = 0; int retval = 0;
pr_debug("sst: powering dn cp....\n"); pr_debug("powering dn cp....\n");
snd_msic_ops.cap_on = 0; snd_msic_ops.cap_on = 0;
return retval; return retval;
} }
...@@ -311,7 +313,7 @@ static int msic_set_selected_output_dev(u8 value) ...@@ -311,7 +313,7 @@ static int msic_set_selected_output_dev(u8 value)
{ {
int retval = 0; int retval = 0;
pr_debug("sst: msic set selected output:%d\n", value); pr_debug("msic set selected output:%d\n", value);
snd_msic_ops.output_dev_id = value; snd_msic_ops.output_dev_id = value;
if (snd_msic_ops.pb_on) if (snd_msic_ops.pb_on)
msic_power_up_pb(SND_SST_DEVICE_HEADSET); msic_power_up_pb(SND_SST_DEVICE_HEADSET);
...@@ -330,15 +332,15 @@ static int msic_set_selected_input_dev(u8 value) ...@@ -330,15 +332,15 @@ static int msic_set_selected_input_dev(u8 value)
}; };
int retval = 0; int retval = 0;
pr_debug("sst: msic_set_selected_input_dev:%d\n", value); pr_debug("msic_set_selected_input_dev:%d\n", value);
snd_msic_ops.input_dev_id = value; snd_msic_ops.input_dev_id = value;
switch (value) { switch (value) {
case AMIC: case AMIC:
pr_debug("sst: Selecting AMIC1\n"); pr_debug("Selecting AMIC1\n");
retval = sst_sc_reg_access(sc_access_amic, PMIC_WRITE, 1); retval = sst_sc_reg_access(sc_access_amic, PMIC_WRITE, 1);
break; break;
case DMIC: case DMIC:
pr_debug("sst: Selecting DMIC1\n"); pr_debug("Selecting DMIC1\n");
retval = sst_sc_reg_access(sc_access_dmic, PMIC_WRITE, 1); retval = sst_sc_reg_access(sc_access_dmic, PMIC_WRITE, 1);
break; break;
default: default:
......
...@@ -23,6 +23,9 @@ ...@@ -23,6 +23,9 @@
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* ALSA driver for Intel MID sound card chipset - holding private functions * ALSA driver for Intel MID sound card chipset - holding private functions
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/io.h> #include <linux/io.h>
#include <asm/intel_scu_ipc.h> #include <asm/intel_scu_ipc.h>
#include <sound/core.h> #include <sound/core.h>
...@@ -50,7 +53,7 @@ void period_elapsed(void *mad_substream) ...@@ -50,7 +53,7 @@ void period_elapsed(void *mad_substream)
if (stream->stream_status != RUNNING) if (stream->stream_status != RUNNING)
return; return;
pr_debug("sst: calling period elapsed\n"); pr_debug("calling period elapsed\n");
snd_pcm_period_elapsed(substream); snd_pcm_period_elapsed(substream);
return; return;
} }
...@@ -76,8 +79,8 @@ int snd_intelmad_alloc_stream(struct snd_pcm_substream *substream) ...@@ -76,8 +79,8 @@ int snd_intelmad_alloc_stream(struct snd_pcm_substream *substream)
param.uc.pcm_params.period_count = substream->runtime->period_size; param.uc.pcm_params.period_count = substream->runtime->period_size;
param.uc.pcm_params.ring_buffer_addr = param.uc.pcm_params.ring_buffer_addr =
virt_to_phys(substream->runtime->dma_area); virt_to_phys(substream->runtime->dma_area);
pr_debug("sst: period_cnt = %d\n", param.uc.pcm_params.period_count); pr_debug("period_cnt = %d\n", param.uc.pcm_params.period_count);
pr_debug("sst: sfreq= %d, wd_sz = %d\n", pr_debug("sfreq= %d, wd_sz = %d\n",
param.uc.pcm_params.sfreq, param.uc.pcm_params.pcm_wd_sz); param.uc.pcm_params.sfreq, param.uc.pcm_params.pcm_wd_sz);
str_params.sparams = param; str_params.sparams = param;
...@@ -85,16 +88,16 @@ int snd_intelmad_alloc_stream(struct snd_pcm_substream *substream) ...@@ -85,16 +88,16 @@ int snd_intelmad_alloc_stream(struct snd_pcm_substream *substream)
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
str_params.ops = STREAM_OPS_PLAYBACK; str_params.ops = STREAM_OPS_PLAYBACK;
pr_debug("sst: Playbck stream,Device %d\n", stream->device); pr_debug("Playbck stream,Device %d\n", stream->device);
} else { } else {
str_params.ops = STREAM_OPS_CAPTURE; str_params.ops = STREAM_OPS_CAPTURE;
stream->device = SND_SST_DEVICE_CAPTURE; stream->device = SND_SST_DEVICE_CAPTURE;
pr_debug("sst: Capture stream,Device %d\n", stream->device); pr_debug("Capture stream,Device %d\n", stream->device);
} }
str_params.device_type = stream->device; str_params.device_type = stream->device;
ret_val = intelmaddata->sstdrv_ops->control_set(SST_SND_ALLOC, ret_val = intelmaddata->sstdrv_ops->control_set(SST_SND_ALLOC,
&str_params); &str_params);
pr_debug("sst: SST_SND_PLAY/CAPTURE ret_val = %x\n", pr_debug("SST_SND_PLAY/CAPTURE ret_val = %x\n",
ret_val); ret_val);
if (ret_val < 0) if (ret_val < 0)
return ret_val; return ret_val;
...@@ -102,7 +105,7 @@ int snd_intelmad_alloc_stream(struct snd_pcm_substream *substream) ...@@ -102,7 +105,7 @@ int snd_intelmad_alloc_stream(struct snd_pcm_substream *substream)
stream->stream_info.str_id = ret_val; stream->stream_info.str_id = ret_val;
stream->stream_status = INIT; stream->stream_status = INIT;
stream->stream_info.buffer_ptr = 0; stream->stream_info.buffer_ptr = 0;
pr_debug("sst: str id : %d\n", stream->stream_info.str_id); pr_debug("str id : %d\n", stream->stream_info.str_id);
return ret_val; return ret_val;
} }
...@@ -113,7 +116,7 @@ int snd_intelmad_init_stream(struct snd_pcm_substream *substream) ...@@ -113,7 +116,7 @@ int snd_intelmad_init_stream(struct snd_pcm_substream *substream)
struct snd_intelmad *intelmaddata = snd_pcm_substream_chip(substream); struct snd_intelmad *intelmaddata = snd_pcm_substream_chip(substream);
int ret_val; int ret_val;
pr_debug("sst: setting buffer ptr param\n"); pr_debug("setting buffer ptr param\n");
stream->stream_info.period_elapsed = period_elapsed; stream->stream_info.period_elapsed = period_elapsed;
stream->stream_info.mad_substream = substream; stream->stream_info.mad_substream = substream;
stream->stream_info.buffer_ptr = 0; stream->stream_info.buffer_ptr = 0;
...@@ -121,7 +124,7 @@ int snd_intelmad_init_stream(struct snd_pcm_substream *substream) ...@@ -121,7 +124,7 @@ int snd_intelmad_init_stream(struct snd_pcm_substream *substream)
ret_val = intelmaddata->sstdrv_ops->control_set(SST_SND_STREAM_INIT, ret_val = intelmaddata->sstdrv_ops->control_set(SST_SND_STREAM_INIT,
&stream->stream_info); &stream->stream_info);
if (ret_val) if (ret_val)
pr_err("sst: control_set ret error %d\n", ret_val); pr_err("control_set ret error %d\n", ret_val);
return ret_val; return ret_val;
} }
...@@ -146,7 +149,7 @@ int sst_sc_reg_access(struct sc_reg_access *sc_access, ...@@ -146,7 +149,7 @@ int sst_sc_reg_access(struct sc_reg_access *sc_access,
retval = intel_scu_ipc_iowrite8(sc_access[i].reg_addr, retval = intel_scu_ipc_iowrite8(sc_access[i].reg_addr,
sc_access[i].value); sc_access[i].value);
if (retval) { if (retval) {
pr_err("sst: IPC write failed!!! %d\n", retval); pr_err("IPC write failed!!! %d\n", retval);
return retval; return retval;
} }
} }
...@@ -155,7 +158,7 @@ int sst_sc_reg_access(struct sc_reg_access *sc_access, ...@@ -155,7 +158,7 @@ int sst_sc_reg_access(struct sc_reg_access *sc_access,
retval = intel_scu_ipc_ioread8(sc_access[i].reg_addr, retval = intel_scu_ipc_ioread8(sc_access[i].reg_addr,
&(sc_access[i].value)); &(sc_access[i].value));
if (retval) { if (retval) {
pr_err("sst: IPC read failed!!!!!%d\n", retval); pr_err("IPC read failed!!!!!%d\n", retval);
return retval; return retval;
} }
} }
...@@ -165,7 +168,7 @@ int sst_sc_reg_access(struct sc_reg_access *sc_access, ...@@ -165,7 +168,7 @@ int sst_sc_reg_access(struct sc_reg_access *sc_access,
sc_access[i].reg_addr, sc_access[i].value, sc_access[i].reg_addr, sc_access[i].value,
sc_access[i].mask); sc_access[i].mask);
if (retval) { if (retval) {
pr_err("sst: IPC Modify failed!!!%d\n", retval); pr_err("IPC Modify failed!!!%d\n", retval);
return retval; return retval;
} }
} }
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
* This file contains the control operations of vendor 1 * This file contains the control operations of vendor 1
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/file.h> #include <linux/file.h>
#include "intel_sst.h" #include "intel_sst.h"
...@@ -151,7 +153,7 @@ static int fs_power_up_pb(unsigned int port) ...@@ -151,7 +153,7 @@ static int fs_power_up_pb(unsigned int port)
if (retval) if (retval)
return retval; return retval;
pr_debug("sst: in fs power up pb\n"); pr_debug("in fs power up pb\n");
return fs_enable_audiodac(UNMUTE); return fs_enable_audiodac(UNMUTE);
} }
...@@ -173,7 +175,7 @@ static int fs_power_down_pb(void) ...@@ -173,7 +175,7 @@ static int fs_power_down_pb(void)
if (retval) if (retval)
return retval; return retval;
pr_debug("sst: in fsl power down pb\n"); pr_debug("in fsl power down pb\n");
return fs_enable_audiodac(UNMUTE); return fs_enable_audiodac(UNMUTE);
} }
...@@ -380,7 +382,7 @@ static int fs_set_pcm_audio_params(int sfreq, int word_size, int num_channel) ...@@ -380,7 +382,7 @@ static int fs_set_pcm_audio_params(int sfreq, int word_size, int num_channel)
sst_sc_reg_access(sc_access, PMIC_READ_MODIFY, 2); sst_sc_reg_access(sc_access, PMIC_READ_MODIFY, 2);
} }
pr_debug("sst: sfreq:%d,Register value = %x\n", sfreq, config1); pr_debug("sfreq:%d,Register value = %x\n", sfreq, config1);
if (word_size == 24) { if (word_size == 24) {
sc_access[0].reg_addr = AUDIOPORT1; sc_access[0].reg_addr = AUDIOPORT1;
...@@ -438,18 +440,18 @@ static int fs_set_selected_input_dev(u8 value) ...@@ -438,18 +440,18 @@ static int fs_set_selected_input_dev(u8 value)
switch (value) { switch (value) {
case AMIC: case AMIC:
pr_debug("sst: Selecting amic not supported in mono cfg\n"); pr_debug("Selecting amic not supported in mono cfg\n");
return sst_sc_reg_access(sc_access_mic, PMIC_READ_MODIFY, 2); return sst_sc_reg_access(sc_access_mic, PMIC_READ_MODIFY, 2);
break; break;
case HS_MIC: case HS_MIC:
pr_debug("sst: Selecting hsmic\n"); pr_debug("Selecting hsmic\n");
return sst_sc_reg_access(sc_access_hsmic, return sst_sc_reg_access(sc_access_hsmic,
PMIC_READ_MODIFY, 2); PMIC_READ_MODIFY, 2);
break; break;
case DMIC: case DMIC:
pr_debug("sst: Selecting dmic\n"); pr_debug("Selecting dmic\n");
return sst_sc_reg_access(sc_access_dmic, PMIC_READ_MODIFY, 2); return sst_sc_reg_access(sc_access_dmic, PMIC_READ_MODIFY, 2);
break; break;
...@@ -505,7 +507,7 @@ static int fs_set_mute(int dev_id, u8 value) ...@@ -505,7 +507,7 @@ static int fs_set_mute(int dev_id, u8 value)
return retval; return retval;
pr_debug("sst: dev_id:0x%x value:0x%x\n", dev_id, value); pr_debug("dev_id:0x%x value:0x%x\n", dev_id, value);
switch (dev_id) { switch (dev_id) {
case PMIC_SND_DMIC_MUTE: case PMIC_SND_DMIC_MUTE:
sc_access[0].reg_addr = MICCTRL; sc_access[0].reg_addr = MICCTRL;
...@@ -606,7 +608,7 @@ static int fs_set_vol(int dev_id, int value) ...@@ -606,7 +608,7 @@ static int fs_set_vol(int dev_id, int value)
switch (dev_id) { switch (dev_id) {
case PMIC_SND_LEFT_PB_VOL: case PMIC_SND_LEFT_PB_VOL:
pr_debug("sst: PMIC_SND_LEFT_PB_VOL:%d\n", value); pr_debug("PMIC_SND_LEFT_PB_VOL:%d\n", value);
sc_access[0].value = sc_access[1].value = value; sc_access[0].value = sc_access[1].value = value;
sc_access[0].reg_addr = AUD16; sc_access[0].reg_addr = AUD16;
sc_access[1].reg_addr = AUD15; sc_access[1].reg_addr = AUD15;
...@@ -616,7 +618,7 @@ static int fs_set_vol(int dev_id, int value) ...@@ -616,7 +618,7 @@ static int fs_set_vol(int dev_id, int value)
break; break;
case PMIC_SND_RIGHT_PB_VOL: case PMIC_SND_RIGHT_PB_VOL:
pr_debug("sst: PMIC_SND_RIGHT_PB_VOL:%d\n", value); pr_debug("PMIC_SND_RIGHT_PB_VOL:%d\n", value);
sc_access[0].value = sc_access[1].value = value; sc_access[0].value = sc_access[1].value = value;
sc_access[0].reg_addr = AUD17; sc_access[0].reg_addr = AUD17;
sc_access[1].reg_addr = AUD15; sc_access[1].reg_addr = AUD15;
...@@ -629,7 +631,7 @@ static int fs_set_vol(int dev_id, int value) ...@@ -629,7 +631,7 @@ static int fs_set_vol(int dev_id, int value)
reg_num = 2; reg_num = 2;
break; break;
case PMIC_SND_CAPTURE_VOL: case PMIC_SND_CAPTURE_VOL:
pr_debug("sst: PMIC_SND_CAPTURE_VOL:%d\n", value); pr_debug("PMIC_SND_CAPTURE_VOL:%d\n", value);
sc_access[0].reg_addr = MICLICTRL1; sc_access[0].reg_addr = MICLICTRL1;
sc_access[1].reg_addr = MICLICTRL2; sc_access[1].reg_addr = MICLICTRL2;
sc_access[2].reg_addr = DMICCTRL1; sc_access[2].reg_addr = DMICCTRL1;
...@@ -726,17 +728,17 @@ static int fs_get_vol(int dev_id, int *value) ...@@ -726,17 +728,17 @@ static int fs_get_vol(int dev_id, int *value)
switch (dev_id) { switch (dev_id) {
case PMIC_SND_CAPTURE_VOL: case PMIC_SND_CAPTURE_VOL:
pr_debug("sst: PMIC_SND_CAPTURE_VOL\n"); pr_debug("PMIC_SND_CAPTURE_VOL\n");
sc_access.reg_addr = MICLICTRL1; sc_access.reg_addr = MICLICTRL1;
mask = (MASK5|MASK4|MASK3|MASK2|MASK1|MASK0); mask = (MASK5|MASK4|MASK3|MASK2|MASK1|MASK0);
break; break;
case PMIC_SND_LEFT_PB_VOL: case PMIC_SND_LEFT_PB_VOL:
pr_debug("sst: PMIC_SND_LEFT_PB_VOL\n"); pr_debug("PMIC_SND_LEFT_PB_VOL\n");
sc_access.reg_addr = AUD16; sc_access.reg_addr = AUD16;
mask = (MASK5|MASK4|MASK3|MASK2|MASK1|MASK0); mask = (MASK5|MASK4|MASK3|MASK2|MASK1|MASK0);
break; break;
case PMIC_SND_RIGHT_PB_VOL: case PMIC_SND_RIGHT_PB_VOL:
pr_debug("sst: PMIC_SND_RT_PB_VOL\n"); pr_debug("PMIC_SND_RT_PB_VOL\n");
sc_access.reg_addr = AUD17; sc_access.reg_addr = AUD17;
mask = (MASK5|MASK4|MASK3|MASK2|MASK1|MASK0); mask = (MASK5|MASK4|MASK3|MASK2|MASK1|MASK0);
break; break;
...@@ -745,9 +747,9 @@ static int fs_get_vol(int dev_id, int *value) ...@@ -745,9 +747,9 @@ static int fs_get_vol(int dev_id, int *value)
} }
retval = sst_sc_reg_access(&sc_access, PMIC_READ, 1); retval = sst_sc_reg_access(&sc_access, PMIC_READ, 1);
pr_debug("sst: value read = 0x%x\n", sc_access.value); pr_debug("value read = 0x%x\n", sc_access.value);
*value = (int) (sc_access.value & mask); *value = (int) (sc_access.value & mask);
pr_debug("sst: value returned = 0x%x\n", *value); pr_debug("value returned = 0x%x\n", *value);
return retval; return retval;
} }
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
* This file contains the control operations of vendor 2 * This file contains the control operations of vendor 2
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/file.h> #include <linux/file.h>
#include <asm/mrst.h> #include <asm/mrst.h>
...@@ -150,11 +152,11 @@ static int mx_init_capture_card(void) ...@@ -150,11 +152,11 @@ static int mx_init_capture_card(void)
retval = sst_sc_reg_access(sc_access, PMIC_WRITE, 8); retval = sst_sc_reg_access(sc_access, PMIC_WRITE, 8);
if (0 != retval) { if (0 != retval) {
/* pmic communication fails */ /* pmic communication fails */
pr_debug("sst: pmic commn failed\n"); pr_debug("pmic commn failed\n");
return retval; return retval;
} }
pr_debug("sst: Capture configuration complete!!\n"); pr_debug("Capture configuration complete!!\n");
return 0; return 0;
} }
...@@ -174,11 +176,11 @@ static int mx_init_playback_card(void) ...@@ -174,11 +176,11 @@ static int mx_init_playback_card(void)
retval = sst_sc_reg_access(sc_access, PMIC_WRITE, 9); retval = sst_sc_reg_access(sc_access, PMIC_WRITE, 9);
if (0 != retval) { if (0 != retval) {
/* pmic communication fails */ /* pmic communication fails */
pr_debug("sst: pmic commn failed\n"); pr_debug("pmic commn failed\n");
return retval; return retval;
} }
pr_debug("sst: Playback configuration complete!!\n"); pr_debug("Playback configuration complete!!\n");
return 0; return 0;
} }
...@@ -204,7 +206,7 @@ static int mx_enable_audiodac(int value) ...@@ -204,7 +206,7 @@ static int mx_enable_audiodac(int value)
retval = sst_sc_reg_access(sc_access, PMIC_READ_MODIFY, 2); retval = sst_sc_reg_access(sc_access, PMIC_READ_MODIFY, 2);
if (retval) if (retval)
return retval; return retval;
pr_debug("sst: mute status = %d", snd_pmic_ops_mx.mute_status); pr_debug("mute status = %d\n", snd_pmic_ops_mx.mute_status);
if (snd_pmic_ops_mx.mute_status == MUTE || if (snd_pmic_ops_mx.mute_status == MUTE ||
snd_pmic_ops_mx.master_mute == MUTE) snd_pmic_ops_mx.master_mute == MUTE)
return retval; return retval;
...@@ -412,7 +414,7 @@ static int mx_set_pcm_voice_params(void) ...@@ -412,7 +414,7 @@ static int mx_set_pcm_voice_params(void)
if (retval) if (retval)
return retval; return retval;
} }
pr_debug("sst: SST DBG mx_set_pcm_voice_params called\n"); pr_debug("SST DBG:mx_set_pcm_voice_params called\n");
return sst_sc_reg_access(sc_access, PMIC_WRITE, 44); return sst_sc_reg_access(sc_access, PMIC_WRITE, 44);
} }
...@@ -529,7 +531,7 @@ static int mx_set_selected_output_dev(u8 dev_id) ...@@ -529,7 +531,7 @@ static int mx_set_selected_output_dev(u8 dev_id)
return retval; return retval;
} }
pr_debug("sst: mx_set_selected_output_dev dev_id:0x%x\n", dev_id); pr_debug("mx_set_selected_output_dev dev_id:0x%x\n", dev_id);
snd_pmic_ops_mx.output_dev_id = dev_id; snd_pmic_ops_mx.output_dev_id = dev_id;
switch (dev_id) { switch (dev_id) {
case STEREO_HEADPHONE: case STEREO_HEADPHONE:
...@@ -549,7 +551,7 @@ static int mx_set_selected_output_dev(u8 dev_id) ...@@ -549,7 +551,7 @@ static int mx_set_selected_output_dev(u8 dev_id)
num_reg = 1; num_reg = 1;
break; break;
case RECEIVER: case RECEIVER:
pr_debug("sst: RECEIVER Koski selected\n"); pr_debug("RECEIVER Koski selected\n");
/* configuration - AS enable, receiver enable */ /* configuration - AS enable, receiver enable */
sc_access[0].reg_addr = 0xFF; sc_access[0].reg_addr = 0xFF;
...@@ -559,7 +561,7 @@ static int mx_set_selected_output_dev(u8 dev_id) ...@@ -559,7 +561,7 @@ static int mx_set_selected_output_dev(u8 dev_id)
num_reg = 1; num_reg = 1;
break; break;
default: default:
pr_err("sst: Not a valid output dev\n"); pr_err("Not a valid output dev\n");
return 0; return 0;
} }
return sst_sc_reg_access(sc_access, PMIC_WRITE, num_reg); return sst_sc_reg_access(sc_access, PMIC_WRITE, num_reg);
...@@ -598,7 +600,7 @@ static int mx_set_selected_input_dev(u8 dev_id) ...@@ -598,7 +600,7 @@ static int mx_set_selected_input_dev(u8 dev_id)
return retval; return retval;
} }
snd_pmic_ops_mx.input_dev_id = dev_id; snd_pmic_ops_mx.input_dev_id = dev_id;
pr_debug("sst: mx_set_selected_input_dev dev_id:0x%x\n", dev_id); pr_debug("mx_set_selected_input_dev dev_id:0x%x\n", dev_id);
switch (dev_id) { switch (dev_id) {
case AMIC: case AMIC:
...@@ -646,7 +648,7 @@ static int mx_set_mute(int dev_id, u8 value) ...@@ -646,7 +648,7 @@ static int mx_set_mute(int dev_id, u8 value)
} }
pr_debug("sst: set_mute dev_id:0x%x , value:%d\n", dev_id, value); pr_debug("set_mute dev_id:0x%x , value:%d\n", dev_id, value);
switch (dev_id) { switch (dev_id) {
case PMIC_SND_DMIC_MUTE: case PMIC_SND_DMIC_MUTE:
...@@ -760,7 +762,7 @@ static int mx_set_vol(int dev_id, int value) ...@@ -760,7 +762,7 @@ static int mx_set_vol(int dev_id, int value)
if (retval) if (retval)
return retval; return retval;
} }
pr_debug("sst: set_vol dev_id:0x%x ,value:%d\n", dev_id, value); pr_debug("set_vol dev_id:0x%x ,value:%d\n", dev_id, value);
switch (dev_id) { switch (dev_id) {
case PMIC_SND_RECEIVER_VOL: case PMIC_SND_RECEIVER_VOL:
return 0; return 0;
...@@ -875,7 +877,7 @@ static int mx_get_vol(int dev_id, int *value) ...@@ -875,7 +877,7 @@ static int mx_get_vol(int dev_id, int *value)
if (retval) if (retval)
return retval; return retval;
*value = -(sc_access.value & mask); *value = -(sc_access.value & mask);
pr_debug("sst: get volume value extracted %d\n", *value); pr_debug("get volume value extracted %d\n", *value);
return retval; return retval;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment