]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ASoC: SOF: Intel: refactor i915_get/put functions
authorKai Vehmanen <kai.vehmanen@linux.intel.com>
Mon, 20 Jan 2020 16:01:15 +0000 (18:01 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 27 Jan 2020 17:51:27 +0000 (17:51 +0000)
The current interface to control i915 display power is misleading.
The hda_codec_i915_get() and hda_codec_i915_put() names suggest
a refcounting based interface. This is confusing as no refcounting
is done and the underlying HDAC library interface does not support
refcounts eithers.

Clarify the code by replacing the functions with a single
hda_codec_i915_display_power() that is aligned with
snd_hdac_display_power().

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200120160117.29130-2-kai.vehmanen@linux.intel.com
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/intel/hda-codec.c
sound/soc/sof/intel/hda.c
sound/soc/sof/intel/hda.h

index 78dfd5f5c034ad7ab083a9c15b7abd7558595465..9106ab8dac6f62d6efc0251c5b26770ff1e856fb 100644 (file)
@@ -170,23 +170,14 @@ EXPORT_SYMBOL_NS(hda_codec_probe_bus, SND_SOC_SOF_HDA_AUDIO_CODEC);
 #if IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI) || \
        IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)
 
-void hda_codec_i915_get(struct snd_sof_dev *sdev)
+void hda_codec_i915_display_power(struct snd_sof_dev *sdev, bool enable)
 {
        struct hdac_bus *bus = sof_to_bus(sdev);
 
-       dev_dbg(bus->dev, "Turning i915 HDAC power on\n");
-       snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, true);
+       dev_dbg(bus->dev, "Turning i915 HDAC power %d\n", enable);
+       snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, enable);
 }
-EXPORT_SYMBOL_NS(hda_codec_i915_get, SND_SOC_SOF_HDA_AUDIO_CODEC_I915);
-
-void hda_codec_i915_put(struct snd_sof_dev *sdev)
-{
-       struct hdac_bus *bus = sof_to_bus(sdev);
-
-       dev_dbg(bus->dev, "Turning i915 HDAC power off\n");
-       snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false);
-}
-EXPORT_SYMBOL_NS(hda_codec_i915_put, SND_SOC_SOF_HDA_AUDIO_CODEC_I915);
+EXPORT_SYMBOL_NS(hda_codec_i915_display_power, SND_SOC_SOF_HDA_AUDIO_CODEC_I915);
 
 int hda_codec_i915_init(struct snd_sof_dev *sdev)
 {
@@ -198,7 +189,7 @@ int hda_codec_i915_init(struct snd_sof_dev *sdev)
        if (ret < 0)
                return ret;
 
-       hda_codec_i915_get(sdev);
+       hda_codec_i915_display_power(sdev, true);
 
        return 0;
 }
@@ -209,7 +200,7 @@ int hda_codec_i915_exit(struct snd_sof_dev *sdev)
        struct hdac_bus *bus = sof_to_bus(sdev);
        int ret;
 
-       hda_codec_i915_put(sdev);
+       hda_codec_i915_display_power(sdev, false);
 
        ret = snd_hdac_i915_exit(bus);
 
index d08462f481de38ce6af2ad8dab345906bca39cd3..54a7ba881150639ba6a149cf9826ead935789610 100644 (file)
@@ -380,7 +380,7 @@ static int hda_init_caps(struct snd_sof_dev *sdev)
        /* create codec instances */
        hda_codec_probe_bus(sdev, hda_codec_use_common_hdmi);
 
-       hda_codec_i915_put(sdev);
+       hda_codec_i915_display_power(sdev, false);
 
        /*
         * we are done probing so decrement link counts
index 47408ec0de404654bf05ee19c0d374298a78a35b..d1f87a107b9d121cebe3ebe18a2a131d6d14e2f7 100644 (file)
@@ -586,15 +586,14 @@ void hda_codec_jack_check(struct snd_sof_dev *sdev);
        (IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI) || \
         IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI))
 
-void hda_codec_i915_get(struct snd_sof_dev *sdev);
-void hda_codec_i915_put(struct snd_sof_dev *sdev);
+void hda_codec_i915_display_power(struct snd_sof_dev *sdev, bool enable);
 int hda_codec_i915_init(struct snd_sof_dev *sdev);
 int hda_codec_i915_exit(struct snd_sof_dev *sdev);
 
 #else
 
-static inline void hda_codec_i915_get(struct snd_sof_dev *sdev)  { }
-static inline void hda_codec_i915_put(struct snd_sof_dev *sdev)  { }
+static inline void hda_codec_i915_display_power(struct snd_sof_dev *sdev,
+                                               bool enable) { }
 static inline int hda_codec_i915_init(struct snd_sof_dev *sdev) { return 0; }
 static inline int hda_codec_i915_exit(struct snd_sof_dev *sdev) { return 0; }