#define codec_in_pm(codec) atomic_read(&(codec)->in_pm)
#define hda_codec_is_power_on(codec) \
(!pm_runtime_suspended(hda_codec_dev(codec)))
-
-static void hda_call_pm_notify(struct hda_codec *codec, bool power_up)
-{
- struct hda_bus *bus = codec->bus;
-
- if ((power_up && codec->pm_up_notified) ||
- (!power_up && !codec->pm_up_notified))
- return;
- if (bus->ops.pm_notify)
- bus->ops.pm_notify(bus, power_up);
- codec->pm_up_notified = power_up;
-}
-
#else
#define codec_in_pm(codec) 0
#define hda_codec_is_power_on(codec) 1
-#define hda_call_pm_notify(codec, state) {}
#endif
/**
snd_array_free(&codec->spdif_out);
remove_conn_list(codec);
codec->bus->caddr_tbl[codec->addr] = NULL;
- hda_call_pm_notify(codec, false); /* cancel leftover refcounts */
+ clear_bit(codec->addr, &codec->bus->codec_powered);
snd_hda_sysfs_clear(codec);
free_hda_cache(&codec->amp_cache);
free_hda_cache(&codec->cmd_cache);
* the caller has to power down appropriatley after initialization
* phase.
*/
+ set_bit(codec->addr, &bus->codec_powered);
pm_runtime_set_active(hda_codec_dev(codec));
pm_runtime_get_noresume(hda_codec_dev(codec));
codec->power_jiffies = jiffies;
- hda_call_pm_notify(codec, true);
#endif
snd_hda_sysfs_init(codec);
#endif
codec->epss = snd_hda_codec_get_supported_ps(codec, fg,
AC_PWRST_EPSS);
-#ifdef CONFIG_PM
- if (!codec->d3_stop_clk || !codec->epss)
- bus->power_keep_link_on = 1;
-#endif
-
/* power-up all before initialization */
hda_set_power_state(codec, AC_PWRST_D0);
hda_mark_cmd_cache_dirty(codec);
codec->power_jiffies = jiffies;
- hda_call_pm_notify(codec, true);
hda_set_power_state(codec, AC_PWRST_D0);
restore_shutup_pins(codec);
for (i = 0; i < codec->num_pcms; i++)
snd_pcm_suspend_all(codec->pcm_info[i].pcm);
state = hda_call_codec_suspend(codec);
- if (!codec->bus->power_keep_link_on && (state & AC_PWRST_CLK_STOP_OK))
- hda_call_pm_notify(codec, false);
+ if (codec->d3_stop_clk && codec->epss && (state & AC_PWRST_CLK_STOP_OK))
+ clear_bit(codec->addr, &codec->bus->codec_powered);
return 0;
}
static int hda_codec_runtime_resume(struct device *dev)
{
- hda_call_codec_resume(dev_to_hda_codec(dev));
+ struct hda_codec *codec = dev_to_hda_codec(dev);
+
+ set_bit(codec->addr, &codec->bus->codec_powered);
+ hda_call_codec_resume(codec);
pm_runtime_mark_last_busy(dev);
return 0;
}
struct hda_pcm *pcm);
/* reset bus for retry verb */
void (*bus_reset)(struct hda_bus *bus);
-#ifdef CONFIG_PM
- /* notify power-up/down from codec to controller */
- void (*pm_notify)(struct hda_bus *bus, bool power_up);
-#endif
#ifdef CONFIG_SND_HDA_DSP_LOADER
/* prepare DSP transfer */
int (*load_dsp_prepare)(struct hda_bus *bus, unsigned int format,
unsigned int rirb_error:1; /* error in codec communication */
unsigned int response_reset:1; /* controller was reset */
unsigned int in_reset:1; /* during reset operation */
- unsigned int power_keep_link_on:1; /* don't power off HDA link */
unsigned int no_response_fallback:1; /* don't fallback at RIRB error */
int primary_dig_out_type; /* primary digital out PCM type */
+ unsigned long codec_powered; /* bit flags of powered codecs */
};
/*
unsigned int dump_coef:1; /* dump processing coefs in codec proc file */
#ifdef CONFIG_PM
unsigned int d3_stop_clk:1; /* support D3 operation without BCLK */
- unsigned int pm_up_notified:1; /* PM notified to controller */
atomic_t in_pm; /* suspend/resume being performed */
unsigned long power_on_acct;
unsigned long power_off_acct;
bus->in_reset = 0;
}
-#ifdef CONFIG_PM
-/* power-up/down the controller */
-static void azx_power_notify(struct hda_bus *bus, bool power_up)
-{
- struct azx *chip = bus->private_data;
-
- if (!azx_has_pm_runtime(chip))
- return;
-
- if (power_up)
- pm_runtime_get_sync(chip->card->dev);
- else
- pm_runtime_put_sync(chip->card->dev);
-}
-#endif
-
static int get_jackpoll_interval(struct azx *chip)
{
int i;
.get_response = azx_get_response,
.attach_pcm = azx_attach_pcm_stream,
.bus_reset = azx_bus_reset,
-#ifdef CONFIG_PM
- .pm_notify = azx_power_notify,
-#endif
#ifdef CONFIG_SND_HDA_DSP_LOADER
.load_dsp_prepare = azx_load_dsp_prepare,
.load_dsp_trigger = azx_load_dsp_trigger,