ASoC: SOF: Move DSP power state transitions to platform-specific ops
[linux-2.6-microblaze.git] / sound / soc / sof / ops.h
index 93512dc..7f532bc 100644 (file)
@@ -146,10 +146,11 @@ static inline int snd_sof_dsp_resume(struct snd_sof_dev *sdev)
        return 0;
 }
 
-static inline int snd_sof_dsp_suspend(struct snd_sof_dev *sdev)
+static inline int snd_sof_dsp_suspend(struct snd_sof_dev *sdev,
+                                     u32 target_state)
 {
        if (sof_ops(sdev)->suspend)
-               return sof_ops(sdev)->suspend(sdev);
+               return sof_ops(sdev)->suspend(sdev, target_state);
 
        return 0;
 }
@@ -193,14 +194,15 @@ static inline int snd_sof_dsp_set_clk(struct snd_sof_dev *sdev, u32 freq)
        return 0;
 }
 
-static inline int snd_sof_dsp_set_power_state(struct snd_sof_dev *sdev,
-                                             enum sof_d0_substate substate)
+static inline int
+snd_sof_dsp_set_power_state(struct snd_sof_dev *sdev,
+                           const struct sof_dsp_power_state *target_state)
 {
        if (sof_ops(sdev)->set_power_state)
-               return sof_ops(sdev)->set_power_state(sdev, substate);
+               return sof_ops(sdev)->set_power_state(sdev, target_state);
 
-       /* D0 substate is not supported */
-       return -ENOTSUPP;
+       /* D0 substate is not supported, do nothing here. */
+       return 0;
 }
 
 /* debug */
@@ -391,6 +393,40 @@ snd_sof_pcm_platform_pointer(struct snd_sof_dev *sdev,
        return 0;
 }
 
+/* machine driver */
+static inline int
+snd_sof_machine_register(struct snd_sof_dev *sdev, void *pdata)
+{
+       if (sof_ops(sdev) && sof_ops(sdev)->machine_register)
+               return sof_ops(sdev)->machine_register(sdev, pdata);
+
+       return 0;
+}
+
+static inline void
+snd_sof_machine_unregister(struct snd_sof_dev *sdev, void *pdata)
+{
+       if (sof_ops(sdev) && sof_ops(sdev)->machine_unregister)
+               sof_ops(sdev)->machine_unregister(sdev, pdata);
+}
+
+static inline void
+snd_sof_machine_select(struct snd_sof_dev *sdev)
+{
+       if (sof_ops(sdev) && sof_ops(sdev)->machine_select)
+               sof_ops(sdev)->machine_select(sdev);
+}
+
+static inline void
+snd_sof_set_mach_params(const struct snd_soc_acpi_mach *mach,
+                       struct device *dev)
+{
+       struct snd_sof_dev *sdev = dev_get_drvdata(dev);
+
+       if (sof_ops(sdev) && sof_ops(sdev)->set_mach_params)
+               sof_ops(sdev)->set_mach_params(mach, dev);
+}
+
 static inline const struct snd_sof_dsp_ops
 *sof_get_ops(const struct sof_dev_desc *d,
             const struct sof_ops_table mach_ops[], int asize)