From bf2d764b84abfd880eee50d6982dade9224d1734 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bossart Date: Thu, 27 Oct 2022 15:35:29 -0400 Subject: ASoC: SOF: Intel: hda-codec: add stop_cmd_io helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One more helper to split controller and codec Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan Link: https://lore.kernel.org/r/20221027193540.259520-11-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown --- sound/soc/sof/intel/hda-codec.c | 9 +++++++++ sound/soc/sof/intel/hda-ctrl.c | 6 ++---- sound/soc/sof/intel/hda.h | 2 ++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-codec.c index 73571ddb37a9..e1cd52ead7eb 100644 --- a/sound/soc/sof/intel/hda-codec.c +++ b/sound/soc/sof/intel/hda-codec.c @@ -269,6 +269,15 @@ void hda_codec_init_cmd_io(struct snd_sof_dev *sdev) } EXPORT_SYMBOL_NS_GPL(hda_codec_init_cmd_io, SND_SOC_SOF_HDA_AUDIO_CODEC); +void hda_codec_stop_cmd_io(struct snd_sof_dev *sdev) +{ + struct hdac_bus *bus = sof_to_bus(sdev); + + /* initialize the codec command I/O */ + snd_hdac_bus_stop_cmd_io(bus); +} +EXPORT_SYMBOL_NS_GPL(hda_codec_stop_cmd_io, SND_SOC_SOF_HDA_AUDIO_CODEC); + void hda_codec_rirb_status_clear(struct snd_sof_dev *sdev) { struct hdac_bus *bus = sof_to_bus(sdev); diff --git a/sound/soc/sof/intel/hda-ctrl.c b/sound/soc/sof/intel/hda-ctrl.c index 63a5b5961726..f94c6be336f3 100644 --- a/sound/soc/sof/intel/hda-ctrl.c +++ b/sound/soc/sof/intel/hda-ctrl.c @@ -299,10 +299,8 @@ void hda_dsp_ctrl_stop_chip(struct snd_sof_dev *sdev) snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, SOF_HDA_INTSTS, SOF_HDA_INT_CTRL_EN | SOF_HDA_INT_ALL_STREAM); -#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) - /* disable CORB/RIRB */ - snd_hdac_bus_stop_cmd_io(bus); -#endif + hda_codec_stop_cmd_io(sdev); + /* disable position buffer */ if (bus->use_posbuf && bus->posbuf.addr) { snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index a2b90784fac0..8fefff6fcce6 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -719,6 +719,7 @@ void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev, bool enable); void hda_codec_jack_check(struct snd_sof_dev *sdev); void hda_codec_check_for_state_change(struct snd_sof_dev *sdev); void hda_codec_init_cmd_io(struct snd_sof_dev *sdev); +void hda_codec_stop_cmd_io(struct snd_sof_dev *sdev); void hda_codec_detect_mask(struct snd_sof_dev *sdev); void hda_codec_rirb_status_clear(struct snd_sof_dev *sdev); void hda_codec_set_codec_wakeup(struct snd_sof_dev *sdev, bool status); @@ -731,6 +732,7 @@ static inline void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev, bool ena static inline void hda_codec_jack_check(struct snd_sof_dev *sdev) { } static inline void hda_codec_check_for_state_change(struct snd_sof_dev *sdev) { } static inline void hda_codec_init_cmd_io(struct snd_sof_dev *sdev) { } +static inline void hda_codec_stop_cmd_io(struct snd_sof_dev *sdev) { } static inline void hda_codec_detect_mask(struct snd_sof_dev *sdev) { } static inline void hda_codec_rirb_status_clear(struct snd_sof_dev *sdev) { } static inline void hda_codec_set_codec_wakeup(struct snd_sof_dev *sdev, bool status) { } -- cgit v1.2.3