diff options
author | Misael Lopez Cruz | 2013-07-18 14:01:57 -0500 |
---|---|---|
committer | Misael Lopez Cruz | 2013-07-22 15:04:11 -0500 |
commit | e2f57538850b604bae31451ac1d751407a6d60a1 (patch) | |
tree | dd3a007d23764ac5ca2e25e44aa467529da691fd | |
parent | 99a1e07f426e010404b6bdadfbdb9286641a6602 (diff) | |
download | kernel-audio-e2f57538850b604bae31451ac1d751407a6d60a1.tar.gz kernel-audio-e2f57538850b604bae31451ac1d751407a6d60a1.tar.xz kernel-audio-e2f57538850b604bae31451ac1d751407a6d60a1.zip |
ASoC: davinci-mcasp: Pass pin inactive state via DT
The state of transmit/receive pins during inactive slots can be controlled through
DISMOD. Previously, the default state (Hi-Z) was used all the time, but that might
not fit well for all applications. So, the inactive state is passed via DT:
"tx-inactive-state" and "rx-inactive-state".
The inactive states can actually be set per serializer, but for the sake of simplicity
we only differentiate them by stream direction.
Additionally, the DISMOD macro is also fixed as the argument part was incorrect.
Change-Id: I0e099c29fde94dd59175c1017c098554c43d18fe
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
-rw-r--r-- | Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt | 6 | ||||
-rw-r--r-- | include/linux/platform_data/davinci_asp.h | 2 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-mcasp.c | 27 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-mcasp.h | 2 |
4 files changed, 36 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index 374e145c2ef1..6f269f3aca70 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt | |||
@@ -23,6 +23,10 @@ Optional properties: | |||
23 | - rx-num-evt : FIFO levels. | 23 | - rx-num-evt : FIFO levels. |
24 | - sram-size-playback : size of sram to be allocated during playback | 24 | - sram-size-playback : size of sram to be allocated during playback |
25 | - sram-size-capture : size of sram to be allocated during capture | 25 | - sram-size-capture : size of sram to be allocated during capture |
26 | - ti,tx-inactive-mode : Transmit pin mode while in an inactive slot (0 - Hi-Z, | ||
27 | 2 - Low, 3 - High) | ||
28 | - ti,rx-inactive-mode : Receive pin mode while in an inactive slot (0 - Hi-Z, | ||
29 | 2 - Low, 3 - High) | ||
26 | 30 | ||
27 | Example: | 31 | Example: |
28 | 32 | ||
@@ -42,4 +46,6 @@ mcasp0: mcasp0@1d00000 { | |||
42 | 2 0 0 0 >; | 46 | 2 0 0 0 >; |
43 | tx-num-evt = <1>; | 47 | tx-num-evt = <1>; |
44 | rx-num-evt = <1>; | 48 | rx-num-evt = <1>; |
49 | ti,tx-inactive-mode = <0>; /* 0: Hi-Z, 2: Low, 3: High */ | ||
50 | ti,rx-inactive-mode = <0>; /* 0: Hi-Z, 2: Low, 3: High */ | ||
45 | }; | 51 | }; |
diff --git a/include/linux/platform_data/davinci_asp.h b/include/linux/platform_data/davinci_asp.h index 8db5ae03b6e3..a78d0b0762b1 100644 --- a/include/linux/platform_data/davinci_asp.h +++ b/include/linux/platform_data/davinci_asp.h | |||
@@ -84,6 +84,8 @@ struct snd_platform_data { | |||
84 | u8 version; | 84 | u8 version; |
85 | u8 txnumevt; | 85 | u8 txnumevt; |
86 | u8 rxnumevt; | 86 | u8 rxnumevt; |
87 | u32 tx_dismod; | ||
88 | u32 rx_dismod; | ||
87 | }; | 89 | }; |
88 | 90 | ||
89 | enum { | 91 | enum { |
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 0aba39e7468d..99cdd6034c43 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c | |||
@@ -232,7 +232,7 @@ | |||
232 | * DAVINCI_MCASP_XRSRCTL_BASE_REG - Serializer Control Register Bits | 232 | * DAVINCI_MCASP_XRSRCTL_BASE_REG - Serializer Control Register Bits |
233 | */ | 233 | */ |
234 | #define MODE(val) (val) | 234 | #define MODE(val) (val) |
235 | #define DISMOD (val)(val<<2) | 235 | #define DISMOD(val) (val << 2) |
236 | #define TXSTATE BIT(4) | 236 | #define TXSTATE BIT(4) |
237 | #define RXSTATE BIT(5) | 237 | #define RXSTATE BIT(5) |
238 | #define SRMOD_MASK 3 | 238 | #define SRMOD_MASK 3 |
@@ -767,11 +767,17 @@ static int davinci_hw_common_param(struct davinci_audio_dev *dev, int stream, | |||
767 | dev->serial_dir[i]); | 767 | dev->serial_dir[i]); |
768 | if (dev->serial_dir[i] == TX_MODE && | 768 | if (dev->serial_dir[i] == TX_MODE && |
769 | tx_ser < max_active_serializers) { | 769 | tx_ser < max_active_serializers) { |
770 | mcasp_mod_bits(dev->base + DAVINCI_MCASP_XRSRCTL_REG(i), | ||
771 | DISMOD(dev->tx_dismod), DISMOD(3)); | ||
772 | |||
770 | mcasp_set_bits(dev->base + DAVINCI_MCASP_PDIR_REG, | 773 | mcasp_set_bits(dev->base + DAVINCI_MCASP_PDIR_REG, |
771 | AXR(i)); | 774 | AXR(i)); |
772 | tx_ser++; | 775 | tx_ser++; |
773 | } else if (dev->serial_dir[i] == RX_MODE && | 776 | } else if (dev->serial_dir[i] == RX_MODE && |
774 | rx_ser < max_active_serializers) { | 777 | rx_ser < max_active_serializers) { |
778 | mcasp_mod_bits(dev->base + DAVINCI_MCASP_XRSRCTL_REG(i), | ||
779 | DISMOD(dev->rx_dismod), DISMOD(3)); | ||
780 | |||
775 | mcasp_clr_bits(dev->base + DAVINCI_MCASP_PDIR_REG, | 781 | mcasp_clr_bits(dev->base + DAVINCI_MCASP_PDIR_REG, |
776 | AXR(i)); | 782 | AXR(i)); |
777 | rx_ser++; | 783 | rx_ser++; |
@@ -1195,6 +1201,23 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of( | |||
1195 | pdata->serial_dir = of_serial_dir; | 1201 | pdata->serial_dir = of_serial_dir; |
1196 | } | 1202 | } |
1197 | 1203 | ||
1204 | of_property_read_u32(np, "ti,tx-inactive-mode", &pdata->tx_dismod); | ||
1205 | |||
1206 | of_property_read_u32(np, "ti,rx-inactive-mode", &pdata->rx_dismod); | ||
1207 | |||
1208 | /* DISMOD = 1 is a reserved value */ | ||
1209 | if ((pdata->tx_dismod == 1) || (pdata->rx_dismod == 1)) { | ||
1210 | dev_err(&pdev->dev, "tx/rx-inactive-mode cannot be 1\n"); | ||
1211 | ret = -EINVAL; | ||
1212 | goto nodata; | ||
1213 | } | ||
1214 | |||
1215 | if ((pdata->tx_dismod > 3) || (pdata->rx_dismod > 3)) { | ||
1216 | dev_err(&pdev->dev, "invalid tx/rx-inactive-mode\n"); | ||
1217 | ret = -EINVAL; | ||
1218 | goto nodata; | ||
1219 | } | ||
1220 | |||
1198 | ret = of_property_read_u32(np, "tx-num-evt", &val); | 1221 | ret = of_property_read_u32(np, "tx-num-evt", &val); |
1199 | if (ret >= 0) | 1222 | if (ret >= 0) |
1200 | pdata->txnumevt = val; | 1223 | pdata->txnumevt = val; |
@@ -1275,6 +1298,8 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
1275 | dev->version = pdata->version; | 1298 | dev->version = pdata->version; |
1276 | dev->txnumevt = pdata->txnumevt; | 1299 | dev->txnumevt = pdata->txnumevt; |
1277 | dev->rxnumevt = pdata->rxnumevt; | 1300 | dev->rxnumevt = pdata->rxnumevt; |
1301 | dev->tx_dismod = pdata->tx_dismod; | ||
1302 | dev->rx_dismod = pdata->rx_dismod; | ||
1278 | dev->dev = &pdev->dev; | 1303 | dev->dev = &pdev->dev; |
1279 | 1304 | ||
1280 | dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]; | 1305 | dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]; |
diff --git a/sound/soc/davinci/davinci-mcasp.h b/sound/soc/davinci/davinci-mcasp.h index 3a73bcfa5984..8b98ed16b8ed 100644 --- a/sound/soc/davinci/davinci-mcasp.h +++ b/sound/soc/davinci/davinci-mcasp.h | |||
@@ -37,6 +37,8 @@ struct davinci_audio_dev { | |||
37 | u8 op_mode; | 37 | u8 op_mode; |
38 | u8 num_serializer; | 38 | u8 num_serializer; |
39 | u8 *serial_dir; | 39 | u8 *serial_dir; |
40 | u32 tx_dismod; | ||
41 | u32 rx_dismod; | ||
40 | u8 version; | 42 | u8 version; |
41 | u16 bclk_lrclk_ratio; | 43 | u16 bclk_lrclk_ratio; |
42 | unsigned int channels; | 44 | unsigned int channels; |