.. | .. |
---|
1 | | -/* sound/soc/samsung/s3c2412-i2s.c |
---|
2 | | - * |
---|
3 | | - * ALSA Soc Audio Layer - S3C2412 I2S driver |
---|
4 | | - * |
---|
5 | | - * Copyright (c) 2006 Wolfson Microelectronics PLC. |
---|
6 | | - * Graeme Gregory graeme.gregory@wolfsonmicro.com |
---|
7 | | - * linux@wolfsonmicro.com |
---|
8 | | - * |
---|
9 | | - * Copyright (c) 2007, 2004-2005 Simtec Electronics |
---|
10 | | - * http://armlinux.simtec.co.uk/ |
---|
11 | | - * Ben Dooks <ben@simtec.co.uk> |
---|
12 | | - * |
---|
13 | | - * This program is free software; you can redistribute it and/or modify it |
---|
14 | | - * under the terms of the GNU General Public License as published by the |
---|
15 | | - * Free Software Foundation; either version 2 of the License, or (at your |
---|
16 | | - * option) any later version. |
---|
17 | | - */ |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0+ |
---|
| 2 | +// |
---|
| 3 | +// ALSA Soc Audio Layer - S3C2412 I2S driver |
---|
| 4 | +// |
---|
| 5 | +// Copyright (c) 2006 Wolfson Microelectronics PLC. |
---|
| 6 | +// Graeme Gregory graeme.gregory@wolfsonmicro.com |
---|
| 7 | +// linux@wolfsonmicro.com |
---|
| 8 | +// |
---|
| 9 | +// Copyright (c) 2007, 2004-2005 Simtec Electronics |
---|
| 10 | +// http://armlinux.simtec.co.uk/ |
---|
| 11 | +// Ben Dooks <ben@simtec.co.uk> |
---|
18 | 12 | |
---|
19 | 13 | #include <linux/delay.h> |
---|
20 | 14 | #include <linux/gpio.h> |
---|
.. | .. |
---|
24 | 18 | |
---|
25 | 19 | #include <sound/soc.h> |
---|
26 | 20 | #include <sound/pcm_params.h> |
---|
27 | | - |
---|
28 | | -#include <mach/gpio-samsung.h> |
---|
29 | | -#include <plat/gpio-cfg.h> |
---|
30 | 21 | |
---|
31 | 22 | #include "dma.h" |
---|
32 | 23 | #include "regs-i2s-v2.h" |
---|
.. | .. |
---|
55 | 46 | snd_soc_dai_init_dma_data(dai, &s3c2412_i2s_pcm_stereo_out, |
---|
56 | 47 | &s3c2412_i2s_pcm_stereo_in); |
---|
57 | 48 | |
---|
58 | | - ret = s3c_i2sv2_probe(dai, &s3c2412_i2s, S3C2410_PA_IIS); |
---|
| 49 | + ret = s3c_i2sv2_probe(dai, &s3c2412_i2s); |
---|
59 | 50 | if (ret) |
---|
60 | 51 | return ret; |
---|
61 | 52 | |
---|
.. | .. |
---|
75 | 66 | ret = clk_prepare_enable(s3c2412_i2s.iis_cclk); |
---|
76 | 67 | if (ret) |
---|
77 | 68 | goto err; |
---|
78 | | - |
---|
79 | | - /* Configure the I2S pins (GPE0...GPE4) in correct mode */ |
---|
80 | | - s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2), |
---|
81 | | - S3C_GPIO_PULL_NONE); |
---|
82 | 69 | |
---|
83 | 70 | return 0; |
---|
84 | 71 | |
---|
.. | .. |
---|
123 | 110 | return 0; |
---|
124 | 111 | } |
---|
125 | 112 | |
---|
| 113 | +#ifdef CONFIG_PM |
---|
| 114 | +static int s3c2412_i2s_suspend(struct snd_soc_component *component) |
---|
| 115 | +{ |
---|
| 116 | + struct s3c_i2sv2_info *i2s = snd_soc_component_get_drvdata(component); |
---|
| 117 | + u32 iismod; |
---|
| 118 | + |
---|
| 119 | + if (component->active) { |
---|
| 120 | + i2s->suspend_iismod = readl(i2s->regs + S3C2412_IISMOD); |
---|
| 121 | + i2s->suspend_iiscon = readl(i2s->regs + S3C2412_IISCON); |
---|
| 122 | + i2s->suspend_iispsr = readl(i2s->regs + S3C2412_IISPSR); |
---|
| 123 | + |
---|
| 124 | + /* some basic suspend checks */ |
---|
| 125 | + |
---|
| 126 | + iismod = readl(i2s->regs + S3C2412_IISMOD); |
---|
| 127 | + |
---|
| 128 | + if (iismod & S3C2412_IISCON_RXDMA_ACTIVE) |
---|
| 129 | + pr_warn("%s: RXDMA active?\n", __func__); |
---|
| 130 | + |
---|
| 131 | + if (iismod & S3C2412_IISCON_TXDMA_ACTIVE) |
---|
| 132 | + pr_warn("%s: TXDMA active?\n", __func__); |
---|
| 133 | + |
---|
| 134 | + if (iismod & S3C2412_IISCON_IIS_ACTIVE) |
---|
| 135 | + pr_warn("%s: IIS active\n", __func__); |
---|
| 136 | + } |
---|
| 137 | + |
---|
| 138 | + return 0; |
---|
| 139 | +} |
---|
| 140 | + |
---|
| 141 | +static int s3c2412_i2s_resume(struct snd_soc_component *component) |
---|
| 142 | +{ |
---|
| 143 | + struct s3c_i2sv2_info *i2s = snd_soc_component_get_drvdata(component); |
---|
| 144 | + |
---|
| 145 | + pr_info("component_active %d, IISMOD %08x, IISCON %08x\n", |
---|
| 146 | + component->active, i2s->suspend_iismod, i2s->suspend_iiscon); |
---|
| 147 | + |
---|
| 148 | + if (component->active) { |
---|
| 149 | + writel(i2s->suspend_iiscon, i2s->regs + S3C2412_IISCON); |
---|
| 150 | + writel(i2s->suspend_iismod, i2s->regs + S3C2412_IISMOD); |
---|
| 151 | + writel(i2s->suspend_iispsr, i2s->regs + S3C2412_IISPSR); |
---|
| 152 | + |
---|
| 153 | + writel(S3C2412_IISFIC_RXFLUSH | S3C2412_IISFIC_TXFLUSH, |
---|
| 154 | + i2s->regs + S3C2412_IISFIC); |
---|
| 155 | + |
---|
| 156 | + ndelay(250); |
---|
| 157 | + writel(0x0, i2s->regs + S3C2412_IISFIC); |
---|
| 158 | + } |
---|
| 159 | + |
---|
| 160 | + return 0; |
---|
| 161 | +} |
---|
| 162 | +#else |
---|
| 163 | +#define s3c2412_i2s_suspend NULL |
---|
| 164 | +#define s3c2412_i2s_resume NULL |
---|
| 165 | +#endif |
---|
| 166 | + |
---|
126 | 167 | #define S3C2412_I2S_RATES \ |
---|
127 | 168 | (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \ |
---|
128 | 169 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ |
---|
.. | .. |
---|
152 | 193 | |
---|
153 | 194 | static const struct snd_soc_component_driver s3c2412_i2s_component = { |
---|
154 | 195 | .name = "s3c2412-i2s", |
---|
| 196 | + .suspend = s3c2412_i2s_suspend, |
---|
| 197 | + .resume = s3c2412_i2s_resume, |
---|
155 | 198 | }; |
---|
156 | 199 | |
---|
157 | 200 | static int s3c2412_iis_dev_probe(struct platform_device *pdev) |
---|
.. | .. |
---|
177 | 220 | |
---|
178 | 221 | ret = samsung_asoc_dma_platform_register(&pdev->dev, |
---|
179 | 222 | pdata->dma_filter, |
---|
180 | | - NULL, NULL); |
---|
| 223 | + "tx", "rx", NULL); |
---|
181 | 224 | if (ret) { |
---|
182 | 225 | pr_err("failed to register the DMA: %d\n", ret); |
---|
183 | 226 | return ret; |
---|