diff options
Diffstat (limited to 'sound/soc/fsl/fsl_ssi.c')
-rw-r--r-- | sound/soc/fsl/fsl_ssi.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 7939c337ed9..d1c855ade8f 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c | |||
@@ -93,6 +93,7 @@ struct fsl_ssi_private { | |||
93 | unsigned int playback; | 93 | unsigned int playback; |
94 | unsigned int capture; | 94 | unsigned int capture; |
95 | int asynchronous; | 95 | int asynchronous; |
96 | unsigned int fifo_depth; | ||
96 | struct snd_soc_dai_driver cpu_dai_drv; | 97 | struct snd_soc_dai_driver cpu_dai_drv; |
97 | struct device_attribute dev_attr; | 98 | struct device_attribute dev_attr; |
98 | struct platform_device *pdev; | 99 | struct platform_device *pdev; |
@@ -337,11 +338,20 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream, | |||
337 | 338 | ||
338 | /* | 339 | /* |
339 | * Set the watermark for transmit FIFI 0 and receive FIFO 0. We | 340 | * Set the watermark for transmit FIFI 0 and receive FIFO 0. We |
340 | * don't use FIFO 1. Since the SSI only supports stereo, the | 341 | * don't use FIFO 1. We program the transmit water to signal a |
341 | * watermark should never be an odd number. | 342 | * DMA transfer if there are only two (or fewer) elements left |
343 | * in the FIFO. Two elements equals one frame (left channel, | ||
344 | * right channel). This value, however, depends on the depth of | ||
345 | * the transmit buffer. | ||
346 | * | ||
347 | * We program the receive FIFO to notify us if at least two | ||
348 | * elements (one frame) have been written to the FIFO. We could | ||
349 | * make this value larger (and maybe we should), but this way | ||
350 | * data will be written to memory as soon as it's available. | ||
342 | */ | 351 | */ |
343 | out_be32(&ssi->sfcsr, | 352 | out_be32(&ssi->sfcsr, |
344 | CCSR_SSI_SFCSR_TFWM0(6) | CCSR_SSI_SFCSR_RFWM0(2)); | 353 | CCSR_SSI_SFCSR_TFWM0(ssi_private->fifo_depth - 2) | |
354 | CCSR_SSI_SFCSR_RFWM0(ssi_private->fifo_depth - 2)); | ||
345 | 355 | ||
346 | /* | 356 | /* |
347 | * We keep the SSI disabled because if we enable it, then the | 357 | * We keep the SSI disabled because if we enable it, then the |
@@ -622,6 +632,7 @@ static int __devinit fsl_ssi_probe(struct of_device *of_dev, | |||
622 | struct device_attribute *dev_attr = NULL; | 632 | struct device_attribute *dev_attr = NULL; |
623 | struct device_node *np = of_dev->dev.of_node; | 633 | struct device_node *np = of_dev->dev.of_node; |
624 | const char *p, *sprop; | 634 | const char *p, *sprop; |
635 | const uint32_t *iprop; | ||
625 | struct resource res; | 636 | struct resource res; |
626 | char name[64]; | 637 | char name[64]; |
627 | 638 | ||
@@ -678,6 +689,14 @@ static int __devinit fsl_ssi_probe(struct of_device *of_dev, | |||
678 | else | 689 | else |
679 | ssi_private->cpu_dai_drv.symmetric_rates = 1; | 690 | ssi_private->cpu_dai_drv.symmetric_rates = 1; |
680 | 691 | ||
692 | /* Determine the FIFO depth. */ | ||
693 | iprop = of_get_property(np, "fsl,fifo-depth", NULL); | ||
694 | if (iprop) | ||
695 | ssi_private->fifo_depth = *iprop; | ||
696 | else | ||
697 | /* Older 8610 DTs didn't have the fifo-depth property */ | ||
698 | ssi_private->fifo_depth = 8; | ||
699 | |||
681 | /* Initialize the the device_attribute structure */ | 700 | /* Initialize the the device_attribute structure */ |
682 | dev_attr = &ssi_private->dev_attr; | 701 | dev_attr = &ssi_private->dev_attr; |
683 | dev_attr->attr.name = "statistics"; | 702 | dev_attr->attr.name = "statistics"; |