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 /sound | |
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>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/davinci/davinci-mcasp.c | 27 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-mcasp.h | 2 |
2 files changed, 28 insertions, 1 deletions
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; |