mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 12:44:11 +08:00
[ARM] pxa: add namespace on ssp
In order to prevent code ambiguous, add namespace on functions in ssp driver. Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
This commit is contained in:
parent
2503991a56
commit
baffe1699c
@ -159,28 +159,28 @@ struct ssp_device {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ssp_write_reg - Write to a SSP register
|
* pxa_ssp_write_reg - Write to a SSP register
|
||||||
*
|
*
|
||||||
* @dev: SSP device to access
|
* @dev: SSP device to access
|
||||||
* @reg: Register to write to
|
* @reg: Register to write to
|
||||||
* @val: Value to be written.
|
* @val: Value to be written.
|
||||||
*/
|
*/
|
||||||
static inline void ssp_write_reg(struct ssp_device *dev, u32 reg, u32 val)
|
static inline void pxa_ssp_write_reg(struct ssp_device *dev, u32 reg, u32 val)
|
||||||
{
|
{
|
||||||
__raw_writel(val, dev->mmio_base + reg);
|
__raw_writel(val, dev->mmio_base + reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ssp_read_reg - Read from a SSP register
|
* pxa_ssp_read_reg - Read from a SSP register
|
||||||
*
|
*
|
||||||
* @dev: SSP device to access
|
* @dev: SSP device to access
|
||||||
* @reg: Register to read from
|
* @reg: Register to read from
|
||||||
*/
|
*/
|
||||||
static inline u32 ssp_read_reg(struct ssp_device *dev, u32 reg)
|
static inline u32 pxa_ssp_read_reg(struct ssp_device *dev, u32 reg)
|
||||||
{
|
{
|
||||||
return __raw_readl(dev->mmio_base + reg);
|
return __raw_readl(dev->mmio_base + reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ssp_device *ssp_request(int port, const char *label);
|
struct ssp_device *pxa_ssp_request(int port, const char *label);
|
||||||
void ssp_free(struct ssp_device *);
|
void pxa_ssp_free(struct ssp_device *);
|
||||||
#endif /* __ASM_ARCH_SSP_H */
|
#endif /* __ASM_ARCH_SSP_H */
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
static DEFINE_MUTEX(ssp_lock);
|
static DEFINE_MUTEX(ssp_lock);
|
||||||
static LIST_HEAD(ssp_list);
|
static LIST_HEAD(ssp_list);
|
||||||
|
|
||||||
struct ssp_device *ssp_request(int port, const char *label)
|
struct ssp_device *pxa_ssp_request(int port, const char *label)
|
||||||
{
|
{
|
||||||
struct ssp_device *ssp = NULL;
|
struct ssp_device *ssp = NULL;
|
||||||
|
|
||||||
@ -58,9 +58,9 @@ struct ssp_device *ssp_request(int port, const char *label)
|
|||||||
|
|
||||||
return ssp;
|
return ssp;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(ssp_request);
|
EXPORT_SYMBOL(pxa_ssp_request);
|
||||||
|
|
||||||
void ssp_free(struct ssp_device *ssp)
|
void pxa_ssp_free(struct ssp_device *ssp)
|
||||||
{
|
{
|
||||||
mutex_lock(&ssp_lock);
|
mutex_lock(&ssp_lock);
|
||||||
if (ssp->use_count) {
|
if (ssp->use_count) {
|
||||||
@ -70,9 +70,9 @@ void ssp_free(struct ssp_device *ssp)
|
|||||||
dev_err(&ssp->pdev->dev, "device already free\n");
|
dev_err(&ssp->pdev->dev, "device already free\n");
|
||||||
mutex_unlock(&ssp_lock);
|
mutex_unlock(&ssp_lock);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(ssp_free);
|
EXPORT_SYMBOL(pxa_ssp_free);
|
||||||
|
|
||||||
static int __devinit ssp_probe(struct platform_device *pdev)
|
static int __devinit pxa_ssp_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
const struct platform_device_id *id = platform_get_device_id(pdev);
|
const struct platform_device_id *id = platform_get_device_id(pdev);
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
@ -164,7 +164,7 @@ err_free:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __devexit ssp_remove(struct platform_device *pdev)
|
static int __devexit pxa_ssp_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
struct ssp_device *ssp;
|
struct ssp_device *ssp;
|
||||||
@ -196,9 +196,9 @@ static const struct platform_device_id ssp_id_table[] = {
|
|||||||
{ },
|
{ },
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct platform_driver ssp_driver = {
|
static struct platform_driver pxa_ssp_driver = {
|
||||||
.probe = ssp_probe,
|
.probe = pxa_ssp_probe,
|
||||||
.remove = __devexit_p(ssp_remove),
|
.remove = __devexit_p(pxa_ssp_remove),
|
||||||
.driver = {
|
.driver = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.name = "pxa2xx-ssp",
|
.name = "pxa2xx-ssp",
|
||||||
@ -208,12 +208,12 @@ static struct platform_driver ssp_driver = {
|
|||||||
|
|
||||||
static int __init pxa_ssp_init(void)
|
static int __init pxa_ssp_init(void)
|
||||||
{
|
{
|
||||||
return platform_driver_register(&ssp_driver);
|
return platform_driver_register(&pxa_ssp_driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit pxa_ssp_exit(void)
|
static void __exit pxa_ssp_exit(void)
|
||||||
{
|
{
|
||||||
platform_driver_unregister(&ssp_driver);
|
platform_driver_unregister(&pxa_ssp_driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
arch_initcall(pxa_ssp_init);
|
arch_initcall(pxa_ssp_init);
|
||||||
|
@ -1465,7 +1465,7 @@ static int __init pxa2xx_spi_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
platform_info = dev->platform_data;
|
platform_info = dev->platform_data;
|
||||||
|
|
||||||
ssp = ssp_request(pdev->id, pdev->name);
|
ssp = pxa_ssp_request(pdev->id, pdev->name);
|
||||||
if (ssp == NULL) {
|
if (ssp == NULL) {
|
||||||
dev_err(&pdev->dev, "failed to request SSP%d\n", pdev->id);
|
dev_err(&pdev->dev, "failed to request SSP%d\n", pdev->id);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
@ -1475,7 +1475,7 @@ static int __init pxa2xx_spi_probe(struct platform_device *pdev)
|
|||||||
master = spi_alloc_master(dev, sizeof(struct driver_data) + 16);
|
master = spi_alloc_master(dev, sizeof(struct driver_data) + 16);
|
||||||
if (!master) {
|
if (!master) {
|
||||||
dev_err(&pdev->dev, "cannot alloc spi_master\n");
|
dev_err(&pdev->dev, "cannot alloc spi_master\n");
|
||||||
ssp_free(ssp);
|
pxa_ssp_free(ssp);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
drv_data = spi_master_get_devdata(master);
|
drv_data = spi_master_get_devdata(master);
|
||||||
@ -1604,7 +1604,7 @@ out_error_irq_alloc:
|
|||||||
|
|
||||||
out_error_master_alloc:
|
out_error_master_alloc:
|
||||||
spi_master_put(master);
|
spi_master_put(master);
|
||||||
ssp_free(ssp);
|
pxa_ssp_free(ssp);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1648,7 +1648,7 @@ static int pxa2xx_spi_remove(struct platform_device *pdev)
|
|||||||
free_irq(ssp->irq, drv_data);
|
free_irq(ssp->irq, drv_data);
|
||||||
|
|
||||||
/* Release SSP */
|
/* Release SSP */
|
||||||
ssp_free(ssp);
|
pxa_ssp_free(ssp);
|
||||||
|
|
||||||
/* Disconnect from the SPI framework */
|
/* Disconnect from the SPI framework */
|
||||||
spi_unregister_master(drv_data->master);
|
spi_unregister_master(drv_data->master);
|
||||||
|
@ -56,15 +56,15 @@ struct ssp_priv {
|
|||||||
static void dump_registers(struct ssp_device *ssp)
|
static void dump_registers(struct ssp_device *ssp)
|
||||||
{
|
{
|
||||||
dev_dbg(&ssp->pdev->dev, "SSCR0 0x%08x SSCR1 0x%08x SSTO 0x%08x\n",
|
dev_dbg(&ssp->pdev->dev, "SSCR0 0x%08x SSCR1 0x%08x SSTO 0x%08x\n",
|
||||||
ssp_read_reg(ssp, SSCR0), ssp_read_reg(ssp, SSCR1),
|
pxa_ssp_read_reg(ssp, SSCR0), pxa_ssp_read_reg(ssp, SSCR1),
|
||||||
ssp_read_reg(ssp, SSTO));
|
pxa_ssp_read_reg(ssp, SSTO));
|
||||||
|
|
||||||
dev_dbg(&ssp->pdev->dev, "SSPSP 0x%08x SSSR 0x%08x SSACD 0x%08x\n",
|
dev_dbg(&ssp->pdev->dev, "SSPSP 0x%08x SSSR 0x%08x SSACD 0x%08x\n",
|
||||||
ssp_read_reg(ssp, SSPSP), ssp_read_reg(ssp, SSSR),
|
pxa_ssp_read_reg(ssp, SSPSP), pxa_ssp_read_reg(ssp, SSSR),
|
||||||
ssp_read_reg(ssp, SSACD));
|
pxa_ssp_read_reg(ssp, SSACD));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ssp_enable(struct ssp_device *ssp)
|
static void pxa_ssp_enable(struct ssp_device *ssp)
|
||||||
{
|
{
|
||||||
uint32_t sscr0;
|
uint32_t sscr0;
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ static void ssp_enable(struct ssp_device *ssp)
|
|||||||
__raw_writel(sscr0, ssp->mmio_base + SSCR0);
|
__raw_writel(sscr0, ssp->mmio_base + SSCR0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ssp_disable(struct ssp_device *ssp)
|
static void pxa_ssp_disable(struct ssp_device *ssp)
|
||||||
{
|
{
|
||||||
uint32_t sscr0;
|
uint32_t sscr0;
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ struct pxa2xx_pcm_dma_data {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static struct pxa2xx_pcm_dma_params *
|
static struct pxa2xx_pcm_dma_params *
|
||||||
ssp_get_dma_params(struct ssp_device *ssp, int width4, int out)
|
pxa_ssp_get_dma_params(struct ssp_device *ssp, int width4, int out)
|
||||||
{
|
{
|
||||||
struct pxa2xx_pcm_dma_data *dma;
|
struct pxa2xx_pcm_dma_data *dma;
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ static int pxa_ssp_startup(struct snd_pcm_substream *substream,
|
|||||||
|
|
||||||
if (!cpu_dai->active) {
|
if (!cpu_dai->active) {
|
||||||
clk_enable(ssp->clk);
|
clk_enable(ssp->clk);
|
||||||
ssp_disable(ssp);
|
pxa_ssp_disable(ssp);
|
||||||
}
|
}
|
||||||
|
|
||||||
kfree(snd_soc_dai_get_dma_data(cpu_dai, substream));
|
kfree(snd_soc_dai_get_dma_data(cpu_dai, substream));
|
||||||
@ -136,7 +136,7 @@ static void pxa_ssp_shutdown(struct snd_pcm_substream *substream,
|
|||||||
struct ssp_device *ssp = priv->ssp;
|
struct ssp_device *ssp = priv->ssp;
|
||||||
|
|
||||||
if (!cpu_dai->active) {
|
if (!cpu_dai->active) {
|
||||||
ssp_disable(ssp);
|
pxa_ssp_disable(ssp);
|
||||||
clk_disable(ssp->clk);
|
clk_disable(ssp->clk);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ static int pxa_ssp_suspend(struct snd_soc_dai *cpu_dai)
|
|||||||
priv->to = __raw_readl(ssp->mmio_base + SSTO);
|
priv->to = __raw_readl(ssp->mmio_base + SSTO);
|
||||||
priv->psp = __raw_readl(ssp->mmio_base + SSPSP);
|
priv->psp = __raw_readl(ssp->mmio_base + SSPSP);
|
||||||
|
|
||||||
ssp_disable(ssp);
|
pxa_ssp_disable(ssp);
|
||||||
clk_disable(ssp->clk);
|
clk_disable(ssp->clk);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -179,7 +179,7 @@ static int pxa_ssp_resume(struct snd_soc_dai *cpu_dai)
|
|||||||
__raw_writel(priv->psp, ssp->mmio_base + SSPSP);
|
__raw_writel(priv->psp, ssp->mmio_base + SSPSP);
|
||||||
|
|
||||||
if (cpu_dai->active)
|
if (cpu_dai->active)
|
||||||
ssp_enable(ssp);
|
pxa_ssp_enable(ssp);
|
||||||
else
|
else
|
||||||
clk_disable(ssp->clk);
|
clk_disable(ssp->clk);
|
||||||
|
|
||||||
@ -195,9 +195,9 @@ static int pxa_ssp_resume(struct snd_soc_dai *cpu_dai)
|
|||||||
* ssp_set_clkdiv - set SSP clock divider
|
* ssp_set_clkdiv - set SSP clock divider
|
||||||
* @div: serial clock rate divider
|
* @div: serial clock rate divider
|
||||||
*/
|
*/
|
||||||
static void ssp_set_scr(struct ssp_device *ssp, u32 div)
|
static void pxa_ssp_set_scr(struct ssp_device *ssp, u32 div)
|
||||||
{
|
{
|
||||||
u32 sscr0 = ssp_read_reg(ssp, SSCR0);
|
u32 sscr0 = pxa_ssp_read_reg(ssp, SSCR0);
|
||||||
|
|
||||||
if (cpu_is_pxa25x() && ssp->type == PXA25x_SSP) {
|
if (cpu_is_pxa25x() && ssp->type == PXA25x_SSP) {
|
||||||
sscr0 &= ~0x0000ff00;
|
sscr0 &= ~0x0000ff00;
|
||||||
@ -206,15 +206,15 @@ static void ssp_set_scr(struct ssp_device *ssp, u32 div)
|
|||||||
sscr0 &= ~0x000fff00;
|
sscr0 &= ~0x000fff00;
|
||||||
sscr0 |= (div - 1) << 8; /* 1..4096 */
|
sscr0 |= (div - 1) << 8; /* 1..4096 */
|
||||||
}
|
}
|
||||||
ssp_write_reg(ssp, SSCR0, sscr0);
|
pxa_ssp_write_reg(ssp, SSCR0, sscr0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ssp_get_clkdiv - get SSP clock divider
|
* pxa_ssp_get_clkdiv - get SSP clock divider
|
||||||
*/
|
*/
|
||||||
static u32 ssp_get_scr(struct ssp_device *ssp)
|
static u32 pxa_ssp_get_scr(struct ssp_device *ssp)
|
||||||
{
|
{
|
||||||
u32 sscr0 = ssp_read_reg(ssp, SSCR0);
|
u32 sscr0 = pxa_ssp_read_reg(ssp, SSCR0);
|
||||||
u32 div;
|
u32 div;
|
||||||
|
|
||||||
if (cpu_is_pxa25x() && ssp->type == PXA25x_SSP)
|
if (cpu_is_pxa25x() && ssp->type == PXA25x_SSP)
|
||||||
@ -234,7 +234,7 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
|
|||||||
struct ssp_device *ssp = priv->ssp;
|
struct ssp_device *ssp = priv->ssp;
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
u32 sscr0 = ssp_read_reg(ssp, SSCR0) &
|
u32 sscr0 = pxa_ssp_read_reg(ssp, SSCR0) &
|
||||||
~(SSCR0_ECS | SSCR0_NCS | SSCR0_MOD | SSCR0_ACS);
|
~(SSCR0_ECS | SSCR0_NCS | SSCR0_MOD | SSCR0_ACS);
|
||||||
|
|
||||||
dev_dbg(&ssp->pdev->dev,
|
dev_dbg(&ssp->pdev->dev,
|
||||||
@ -262,7 +262,7 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
|
|||||||
break;
|
break;
|
||||||
case PXA_SSP_CLK_AUDIO:
|
case PXA_SSP_CLK_AUDIO:
|
||||||
priv->sysclk = 0;
|
priv->sysclk = 0;
|
||||||
ssp_set_scr(ssp, 1);
|
pxa_ssp_set_scr(ssp, 1);
|
||||||
sscr0 |= SSCR0_ACS;
|
sscr0 |= SSCR0_ACS;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -273,8 +273,8 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
|
|||||||
* on PXA2xx. On PXA3xx it must be enabled when doing so. */
|
* on PXA2xx. On PXA3xx it must be enabled when doing so. */
|
||||||
if (!cpu_is_pxa3xx())
|
if (!cpu_is_pxa3xx())
|
||||||
clk_disable(ssp->clk);
|
clk_disable(ssp->clk);
|
||||||
val = ssp_read_reg(ssp, SSCR0) | sscr0;
|
val = pxa_ssp_read_reg(ssp, SSCR0) | sscr0;
|
||||||
ssp_write_reg(ssp, SSCR0, val);
|
pxa_ssp_write_reg(ssp, SSCR0, val);
|
||||||
if (!cpu_is_pxa3xx())
|
if (!cpu_is_pxa3xx())
|
||||||
clk_enable(ssp->clk);
|
clk_enable(ssp->clk);
|
||||||
|
|
||||||
@ -293,11 +293,11 @@ static int pxa_ssp_set_dai_clkdiv(struct snd_soc_dai *cpu_dai,
|
|||||||
|
|
||||||
switch (div_id) {
|
switch (div_id) {
|
||||||
case PXA_SSP_AUDIO_DIV_ACDS:
|
case PXA_SSP_AUDIO_DIV_ACDS:
|
||||||
val = (ssp_read_reg(ssp, SSACD) & ~0x7) | SSACD_ACDS(div);
|
val = (pxa_ssp_read_reg(ssp, SSACD) & ~0x7) | SSACD_ACDS(div);
|
||||||
ssp_write_reg(ssp, SSACD, val);
|
pxa_ssp_write_reg(ssp, SSACD, val);
|
||||||
break;
|
break;
|
||||||
case PXA_SSP_AUDIO_DIV_SCDB:
|
case PXA_SSP_AUDIO_DIV_SCDB:
|
||||||
val = ssp_read_reg(ssp, SSACD);
|
val = pxa_ssp_read_reg(ssp, SSACD);
|
||||||
val &= ~SSACD_SCDB;
|
val &= ~SSACD_SCDB;
|
||||||
#if defined(CONFIG_PXA3xx)
|
#if defined(CONFIG_PXA3xx)
|
||||||
if (cpu_is_pxa3xx())
|
if (cpu_is_pxa3xx())
|
||||||
@ -320,10 +320,10 @@ static int pxa_ssp_set_dai_clkdiv(struct snd_soc_dai *cpu_dai,
|
|||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
ssp_write_reg(ssp, SSACD, val);
|
pxa_ssp_write_reg(ssp, SSACD, val);
|
||||||
break;
|
break;
|
||||||
case PXA_SSP_DIV_SCR:
|
case PXA_SSP_DIV_SCR:
|
||||||
ssp_set_scr(ssp, div);
|
pxa_ssp_set_scr(ssp, div);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
@ -340,11 +340,11 @@ static int pxa_ssp_set_dai_pll(struct snd_soc_dai *cpu_dai, int pll_id,
|
|||||||
{
|
{
|
||||||
struct ssp_priv *priv = cpu_dai->private_data;
|
struct ssp_priv *priv = cpu_dai->private_data;
|
||||||
struct ssp_device *ssp = priv->ssp;
|
struct ssp_device *ssp = priv->ssp;
|
||||||
u32 ssacd = ssp_read_reg(ssp, SSACD) & ~0x70;
|
u32 ssacd = pxa_ssp_read_reg(ssp, SSACD) & ~0x70;
|
||||||
|
|
||||||
#if defined(CONFIG_PXA3xx)
|
#if defined(CONFIG_PXA3xx)
|
||||||
if (cpu_is_pxa3xx())
|
if (cpu_is_pxa3xx())
|
||||||
ssp_write_reg(ssp, SSACDD, 0);
|
pxa_ssp_write_reg(ssp, SSACDD, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (freq_out) {
|
switch (freq_out) {
|
||||||
@ -382,7 +382,7 @@ static int pxa_ssp_set_dai_pll(struct snd_soc_dai *cpu_dai, int pll_id,
|
|||||||
val = tmp;
|
val = tmp;
|
||||||
|
|
||||||
val = (val << 16) | 64;
|
val = (val << 16) | 64;
|
||||||
ssp_write_reg(ssp, SSACDD, val);
|
pxa_ssp_write_reg(ssp, SSACDD, val);
|
||||||
|
|
||||||
ssacd |= (0x6 << 4);
|
ssacd |= (0x6 << 4);
|
||||||
|
|
||||||
@ -396,7 +396,7 @@ static int pxa_ssp_set_dai_pll(struct snd_soc_dai *cpu_dai, int pll_id,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssp_write_reg(ssp, SSACD, ssacd);
|
pxa_ssp_write_reg(ssp, SSACD, ssacd);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -411,7 +411,7 @@ static int pxa_ssp_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai,
|
|||||||
struct ssp_device *ssp = priv->ssp;
|
struct ssp_device *ssp = priv->ssp;
|
||||||
u32 sscr0;
|
u32 sscr0;
|
||||||
|
|
||||||
sscr0 = ssp_read_reg(ssp, SSCR0);
|
sscr0 = pxa_ssp_read_reg(ssp, SSCR0);
|
||||||
sscr0 &= ~(SSCR0_MOD | SSCR0_SlotsPerFrm(8) | SSCR0_EDSS | SSCR0_DSS);
|
sscr0 &= ~(SSCR0_MOD | SSCR0_SlotsPerFrm(8) | SSCR0_EDSS | SSCR0_DSS);
|
||||||
|
|
||||||
/* set slot width */
|
/* set slot width */
|
||||||
@ -428,10 +428,10 @@ static int pxa_ssp_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai,
|
|||||||
sscr0 |= SSCR0_SlotsPerFrm(slots);
|
sscr0 |= SSCR0_SlotsPerFrm(slots);
|
||||||
|
|
||||||
/* set active slot mask */
|
/* set active slot mask */
|
||||||
ssp_write_reg(ssp, SSTSA, tx_mask);
|
pxa_ssp_write_reg(ssp, SSTSA, tx_mask);
|
||||||
ssp_write_reg(ssp, SSRSA, rx_mask);
|
pxa_ssp_write_reg(ssp, SSRSA, rx_mask);
|
||||||
}
|
}
|
||||||
ssp_write_reg(ssp, SSCR0, sscr0);
|
pxa_ssp_write_reg(ssp, SSCR0, sscr0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -446,12 +446,12 @@ static int pxa_ssp_set_dai_tristate(struct snd_soc_dai *cpu_dai,
|
|||||||
struct ssp_device *ssp = priv->ssp;
|
struct ssp_device *ssp = priv->ssp;
|
||||||
u32 sscr1;
|
u32 sscr1;
|
||||||
|
|
||||||
sscr1 = ssp_read_reg(ssp, SSCR1);
|
sscr1 = pxa_ssp_read_reg(ssp, SSCR1);
|
||||||
if (tristate)
|
if (tristate)
|
||||||
sscr1 &= ~SSCR1_TTE;
|
sscr1 &= ~SSCR1_TTE;
|
||||||
else
|
else
|
||||||
sscr1 |= SSCR1_TTE;
|
sscr1 |= SSCR1_TTE;
|
||||||
ssp_write_reg(ssp, SSCR1, sscr1);
|
pxa_ssp_write_reg(ssp, SSCR1, sscr1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -475,14 +475,14 @@ static int pxa_ssp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* we can only change the settings if the port is not in use */
|
/* we can only change the settings if the port is not in use */
|
||||||
if (ssp_read_reg(ssp, SSCR0) & SSCR0_SSE) {
|
if (pxa_ssp_read_reg(ssp, SSCR0) & SSCR0_SSE) {
|
||||||
dev_err(&ssp->pdev->dev,
|
dev_err(&ssp->pdev->dev,
|
||||||
"can't change hardware dai format: stream is in use");
|
"can't change hardware dai format: stream is in use");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reset port settings */
|
/* reset port settings */
|
||||||
sscr0 = ssp_read_reg(ssp, SSCR0) &
|
sscr0 = pxa_ssp_read_reg(ssp, SSCR0) &
|
||||||
(SSCR0_ECS | SSCR0_NCS | SSCR0_MOD | SSCR0_ACS);
|
(SSCR0_ECS | SSCR0_NCS | SSCR0_MOD | SSCR0_ACS);
|
||||||
sscr1 = SSCR1_RxTresh(8) | SSCR1_TxTresh(7);
|
sscr1 = SSCR1_RxTresh(8) | SSCR1_TxTresh(7);
|
||||||
sspsp = 0;
|
sspsp = 0;
|
||||||
@ -534,9 +534,9 @@ static int pxa_ssp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssp_write_reg(ssp, SSCR0, sscr0);
|
pxa_ssp_write_reg(ssp, SSCR0, sscr0);
|
||||||
ssp_write_reg(ssp, SSCR1, sscr1);
|
pxa_ssp_write_reg(ssp, SSCR1, sscr1);
|
||||||
ssp_write_reg(ssp, SSPSP, sspsp);
|
pxa_ssp_write_reg(ssp, SSPSP, sspsp);
|
||||||
|
|
||||||
dump_registers(ssp);
|
dump_registers(ssp);
|
||||||
|
|
||||||
@ -565,7 +565,7 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
|
|||||||
u32 sscr0;
|
u32 sscr0;
|
||||||
u32 sspsp;
|
u32 sspsp;
|
||||||
int width = snd_pcm_format_physical_width(params_format(params));
|
int width = snd_pcm_format_physical_width(params_format(params));
|
||||||
int ttsa = ssp_read_reg(ssp, SSTSA) & 0xf;
|
int ttsa = pxa_ssp_read_reg(ssp, SSTSA) & 0xf;
|
||||||
struct pxa2xx_pcm_dma_params *dma_data;
|
struct pxa2xx_pcm_dma_params *dma_data;
|
||||||
|
|
||||||
dma_data = snd_soc_dai_get_dma_data(dai, substream);
|
dma_data = snd_soc_dai_get_dma_data(dai, substream);
|
||||||
@ -577,22 +577,22 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
|
|||||||
* to force 16-bit frame width on the wire (for S16_LE), even
|
* to force 16-bit frame width on the wire (for S16_LE), even
|
||||||
* with two channels. Use 16-bit DMA transfers for this case.
|
* with two channels. Use 16-bit DMA transfers for this case.
|
||||||
*/
|
*/
|
||||||
dma_data = ssp_get_dma_params(ssp,
|
dma_data = pxa_ssp_get_dma_params(ssp,
|
||||||
((chn == 2) && (ttsa != 1)) || (width == 32),
|
((chn == 2) && (ttsa != 1)) || (width == 32),
|
||||||
substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
|
substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
|
||||||
|
|
||||||
snd_soc_dai_set_dma_data(dai, substream, dma_data);
|
snd_soc_dai_set_dma_data(dai, substream, dma_data);
|
||||||
|
|
||||||
/* we can only change the settings if the port is not in use */
|
/* we can only change the settings if the port is not in use */
|
||||||
if (ssp_read_reg(ssp, SSCR0) & SSCR0_SSE)
|
if (pxa_ssp_read_reg(ssp, SSCR0) & SSCR0_SSE)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* clear selected SSP bits */
|
/* clear selected SSP bits */
|
||||||
sscr0 = ssp_read_reg(ssp, SSCR0) & ~(SSCR0_DSS | SSCR0_EDSS);
|
sscr0 = pxa_ssp_read_reg(ssp, SSCR0) & ~(SSCR0_DSS | SSCR0_EDSS);
|
||||||
ssp_write_reg(ssp, SSCR0, sscr0);
|
pxa_ssp_write_reg(ssp, SSCR0, sscr0);
|
||||||
|
|
||||||
/* bit size */
|
/* bit size */
|
||||||
sscr0 = ssp_read_reg(ssp, SSCR0);
|
sscr0 = pxa_ssp_read_reg(ssp, SSCR0);
|
||||||
switch (params_format(params)) {
|
switch (params_format(params)) {
|
||||||
case SNDRV_PCM_FORMAT_S16_LE:
|
case SNDRV_PCM_FORMAT_S16_LE:
|
||||||
#ifdef CONFIG_PXA3xx
|
#ifdef CONFIG_PXA3xx
|
||||||
@ -608,13 +608,13 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
|
|||||||
sscr0 |= (SSCR0_EDSS | SSCR0_DataSize(16));
|
sscr0 |= (SSCR0_EDSS | SSCR0_DataSize(16));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ssp_write_reg(ssp, SSCR0, sscr0);
|
pxa_ssp_write_reg(ssp, SSCR0, sscr0);
|
||||||
|
|
||||||
switch (priv->dai_fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
|
switch (priv->dai_fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
|
||||||
case SND_SOC_DAIFMT_I2S:
|
case SND_SOC_DAIFMT_I2S:
|
||||||
sspsp = ssp_read_reg(ssp, SSPSP);
|
sspsp = pxa_ssp_read_reg(ssp, SSPSP);
|
||||||
|
|
||||||
if ((ssp_get_scr(ssp) == 4) && (width == 16)) {
|
if ((pxa_ssp_get_scr(ssp) == 4) && (width == 16)) {
|
||||||
/* This is a special case where the bitclk is 64fs
|
/* This is a special case where the bitclk is 64fs
|
||||||
* and we're not dealing with 2*32 bits of audio
|
* and we're not dealing with 2*32 bits of audio
|
||||||
* samples.
|
* samples.
|
||||||
@ -648,7 +648,7 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
|
|||||||
sspsp |= SSPSP_DMYSTRT(1);
|
sspsp |= SSPSP_DMYSTRT(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ssp_write_reg(ssp, SSPSP, sspsp);
|
pxa_ssp_write_reg(ssp, SSPSP, sspsp);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -679,45 +679,45 @@ static int pxa_ssp_trigger(struct snd_pcm_substream *substream, int cmd,
|
|||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case SNDRV_PCM_TRIGGER_RESUME:
|
case SNDRV_PCM_TRIGGER_RESUME:
|
||||||
ssp_enable(ssp);
|
pxa_ssp_enable(ssp);
|
||||||
break;
|
break;
|
||||||
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
|
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
|
||||||
val = ssp_read_reg(ssp, SSCR1);
|
val = pxa_ssp_read_reg(ssp, SSCR1);
|
||||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
|
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
|
||||||
val |= SSCR1_TSRE;
|
val |= SSCR1_TSRE;
|
||||||
else
|
else
|
||||||
val |= SSCR1_RSRE;
|
val |= SSCR1_RSRE;
|
||||||
ssp_write_reg(ssp, SSCR1, val);
|
pxa_ssp_write_reg(ssp, SSCR1, val);
|
||||||
val = ssp_read_reg(ssp, SSSR);
|
val = pxa_ssp_read_reg(ssp, SSSR);
|
||||||
ssp_write_reg(ssp, SSSR, val);
|
pxa_ssp_write_reg(ssp, SSSR, val);
|
||||||
break;
|
break;
|
||||||
case SNDRV_PCM_TRIGGER_START:
|
case SNDRV_PCM_TRIGGER_START:
|
||||||
val = ssp_read_reg(ssp, SSCR1);
|
val = pxa_ssp_read_reg(ssp, SSCR1);
|
||||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
|
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
|
||||||
val |= SSCR1_TSRE;
|
val |= SSCR1_TSRE;
|
||||||
else
|
else
|
||||||
val |= SSCR1_RSRE;
|
val |= SSCR1_RSRE;
|
||||||
ssp_write_reg(ssp, SSCR1, val);
|
pxa_ssp_write_reg(ssp, SSCR1, val);
|
||||||
ssp_enable(ssp);
|
pxa_ssp_enable(ssp);
|
||||||
break;
|
break;
|
||||||
case SNDRV_PCM_TRIGGER_STOP:
|
case SNDRV_PCM_TRIGGER_STOP:
|
||||||
val = ssp_read_reg(ssp, SSCR1);
|
val = pxa_ssp_read_reg(ssp, SSCR1);
|
||||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
|
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
|
||||||
val &= ~SSCR1_TSRE;
|
val &= ~SSCR1_TSRE;
|
||||||
else
|
else
|
||||||
val &= ~SSCR1_RSRE;
|
val &= ~SSCR1_RSRE;
|
||||||
ssp_write_reg(ssp, SSCR1, val);
|
pxa_ssp_write_reg(ssp, SSCR1, val);
|
||||||
break;
|
break;
|
||||||
case SNDRV_PCM_TRIGGER_SUSPEND:
|
case SNDRV_PCM_TRIGGER_SUSPEND:
|
||||||
ssp_disable(ssp);
|
pxa_ssp_disable(ssp);
|
||||||
break;
|
break;
|
||||||
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
||||||
val = ssp_read_reg(ssp, SSCR1);
|
val = pxa_ssp_read_reg(ssp, SSCR1);
|
||||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
|
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
|
||||||
val &= ~SSCR1_TSRE;
|
val &= ~SSCR1_TSRE;
|
||||||
else
|
else
|
||||||
val &= ~SSCR1_RSRE;
|
val &= ~SSCR1_RSRE;
|
||||||
ssp_write_reg(ssp, SSCR1, val);
|
pxa_ssp_write_reg(ssp, SSCR1, val);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -739,7 +739,7 @@ static int pxa_ssp_probe(struct platform_device *pdev,
|
|||||||
if (!priv)
|
if (!priv)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
priv->ssp = ssp_request(dai->id + 1, "SoC audio");
|
priv->ssp = pxa_ssp_request(dai->id + 1, "SoC audio");
|
||||||
if (priv->ssp == NULL) {
|
if (priv->ssp == NULL) {
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
goto err_priv;
|
goto err_priv;
|
||||||
@ -759,7 +759,7 @@ static void pxa_ssp_remove(struct platform_device *pdev,
|
|||||||
struct snd_soc_dai *dai)
|
struct snd_soc_dai *dai)
|
||||||
{
|
{
|
||||||
struct ssp_priv *priv = dai->private_data;
|
struct ssp_priv *priv = dai->private_data;
|
||||||
ssp_free(priv->ssp);
|
pxa_ssp_free(priv->ssp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PXA_SSP_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\
|
#define PXA_SSP_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\
|
||||||
|
Loading…
Reference in New Issue
Block a user