ASoC: sirf: Move the tx rx enable from port to codec, that will not need register sharing
PATCH 1/1 ASoC: sirf: Move the tx rx enable from port to codec, that will not need register sharing
From: Rongjun Ying <[email protected]>
The port driver only used to register component and dmaengine pcm.
--- sound/soc/codecs/sirf-audio-codec.c | 74 +++++++++++++++++++++--- sound/soc/codecs/sirf-audio-codec.h | 50 ++++++++++++++++ sound/soc/sirf/sirf-audio-port.c | 107 ----------------------------------- sound/soc/sirf/sirf-audio-port.h | 62 -------------------- 4 files changed, 116 insertions(+), 177 deletions(-) delete mode 100644 sound/soc/sirf/sirf-audio-port.h
sound/soc/codecs/sirf-audio-codec.c +66 -8
@@ -279,13 +279,63 @@ static const struct snd_soc_dapm_route sirf_audio_codec_map[] = { {"Mic input mode mux", "Differential", "MICIN1"}, }; +static void sirf_audio_codec_tx_enable (struct sirf_audio_codec *sirf_audio_codec) +{ +regmap_update_bits (sirf_audio_codec->regmap,AUDIO_PORT_IC_TXFIFO_OP , +AUDIO_FIFO_RESET ,AUDIO_FIFO_RESET ); +regmap_update_bits (sirf_audio_codec->regmap,AUDIO_PORT_IC_TXFIFO_OP , +AUDIO_FIFO_RESET , ~AUDIO_FIFO_RESET ); +regmap_write (sirf_audio_codec->regmap,AUDIO_PORT_IC_TXFIFO_INT_MSK ,0 ); +regmap_write (sirf_audio_codec->regmap,AUDIO_PORT_IC_TXFIFO_OP ,0 ); +regmap_update_bits (sirf_audio_codec->regmap,AUDIO_PORT_IC_TXFIFO_OP , +AUDIO_FIFO_START ,AUDIO_FIFO_START ); +regmap_update_bits (sirf_audio_codec->regmap, +AUDIO_PORT_IC_CODEC_TX_CTRL ,IC_TX_ENABLE ,IC_TX_ENABLE ); +} + +static void sirf_audio_codec_tx_disable (struct sirf_audio_codec *sirf_audio_codec) +{ +regmap_write (sirf_audio_codec->regmap,AUDIO_PORT_IC_TXFIFO_OP ,0 ); +regmap_update_bits (sirf_audio_codec->regmap, +AUDIO_PORT_IC_CODEC_TX_CTRL ,IC_TX_ENABLE , ~IC_TX_ENABLE ); +} + +static void sirf_audio_codec_rx_enable (struct sirf_audio_codec *sirf_audio_codec, +int channels) +{ +regmap_update_bits (sirf_audio_codec->regmap,AUDIO_PORT_IC_RXFIFO_OP , +AUDIO_FIFO_RESET ,AUDIO_FIFO_RESET ); +regmap_update_bits (sirf_audio_codec->regmap,AUDIO_PORT_IC_RXFIFO_OP , +AUDIO_FIFO_RESET , ~AUDIO_FIFO_RESET ); +regmap_write (sirf_audio_codec->regmap, +AUDIO_PORT_IC_RXFIFO_INT_MSK ,0 ); +regmap_write (sirf_audio_codec->regmap,AUDIO_PORT_IC_RXFIFO_OP ,0 ); +regmap_update_bits (sirf_audio_codec->regmap,AUDIO_PORT_IC_RXFIFO_OP , +AUDIO_FIFO_START ,AUDIO_FIFO_START ); +if (channels ==1 ) +regmap_update_bits (sirf_audio_codec->regmap, +AUDIO_PORT_IC_CODEC_RX_CTRL , +IC_RX_ENABLE_MONO ,IC_RX_ENABLE_MONO ); +else +regmap_update_bits (sirf_audio_codec->regmap, +AUDIO_PORT_IC_CODEC_RX_CTRL , +IC_RX_ENABLE_STEREO ,IC_RX_ENABLE_STEREO ); +} + +static void sirf_audio_codec_rx_disable (struct sirf_audio_codec *sirf_audio_codec) +{ +regmap_update_bits (sirf_audio_codec->regmap, +AUDIO_PORT_IC_CODEC_RX_CTRL , +IC_RX_ENABLE_STEREO , ~IC_RX_ENABLE_STEREO ); +} +static int sirf_audio_codec_trigger (struct snd_pcm_substream *substream,int cmd,struct snd_soc_dai *dai) { -int playback = substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ;struct snd_soc_codec *codec = dai->codec; -u32 val =0 ; +struct sirf_audio_codec *sirf_audio_codec =snd_soc_codec_get_drvdata (codec); +int playback = substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ;/* * This is a workaround, When stop playback,
@@ -295,20 +345,28 @@ static int sirf_audio_codec_trigger(struct snd_pcm_substream *substream,case SNDRV_PCM_TRIGGER_STOP :case SNDRV_PCM_TRIGGER_SUSPEND :case SNDRV_PCM_TRIGGER_PAUSE_PUSH : +if (playback) { +snd_soc_update_bits (codec,AUDIO_IC_CODEC_CTRL0 , +IC_HSLEN |IC_HSREN ,0 ); +sirf_audio_codec_tx_disable (sirf_audio_codec); + }else +sirf_audio_codec_rx_disable (sirf_audio_codec);break ;case SNDRV_PCM_TRIGGER_START :case SNDRV_PCM_TRIGGER_RESUME :case SNDRV_PCM_TRIGGER_PAUSE_RELEASE : -if (playback) - val =IC_HSLEN |IC_HSREN ; +if (playback) { +sirf_audio_codec_tx_enable (sirf_audio_codec); +snd_soc_update_bits (codec,AUDIO_IC_CODEC_CTRL0 , +IC_HSLEN |IC_HSREN ,IC_HSLEN |IC_HSREN ); + }else +sirf_audio_codec_rx_enable (sirf_audio_codec, + substream->runtime->channels);break ;default :return -EINVAL ; } -if (playback) -snd_soc_update_bits (codec,AUDIO_IC_CODEC_CTRL0 , -IC_HSLEN |IC_HSREN , val);return 0 ; }
@@ -392,7 +450,7 @@ static const struct regmap_config sirf_audio_codec_regmap_config = { .reg_bits = 32, .reg_stride = 4, .val_bits = 32, - .max_register = AUDIO_IC_CODEC_CTRL3, + .max_register = AUDIO_PORT_IC_RXFIFO_INT_MSK, .cache_type = REGCACHE_NONE, };
sound/soc/codecs/sirf-audio-codec.h +50 -0
54 lines not on this page · raw message
sound/soc/sirf/sirf-audio-port.c +0 -107
150 lines not on this page · raw message
sound/soc/sirf/sirf-audio-port.h deleted +0 -62
62 lines not on this page · raw message
Signature · 1 line
1.7.5.4
Quoted 3 lines · RongJun Ying
From: Rongjun Ying <[email protected]>
The port driver only used to register component and dmaengine pcm.
Applied, thanks.
2014-03-22 3:20 GMT+08:00 Mark Brown <[email protected]>:
Quoted 6 lines · RongJun Ying
Quoted 3 lines
From: Rongjun Ying <[email protected]>
The port driver only used to register component and dmaengine pcm.
Applied, thanks.
Hi Mark:
You have applied this patch.
But you have not merge it into next branch.
Please check it.
Thanks.
----
RongJun Ying
Signature · 2 lines
------------------------------ Rongjun Ying
Mark Brown
maintainerQuoted 2 lines · RongJun Ying
You have applied this patch.
But you have not merge it into next branch.
We're in the merge window and this is new development.