Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83012a7c authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: hda - Clean up CONFIG_SND_HDA_POWER_SAVE



CONFIG_SND_HDA_POWER_SAVE is no longer an experimental feature and its
behavior can be well controlled via the default value and module
parameter.  Let's just replace it with the standard CONFIG_PM.

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 432c641e
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -228,17 +228,9 @@ config SND_HDA_GENERIC
	  Say Y here to enable the generic HD-audio codec parser
	  in snd-hda-intel driver.

config SND_HDA_POWER_SAVE
	bool "Aggressive power-saving on HD-audio"
	depends on PM
	help
	  Say Y here to enable more aggressive power-saving mode on
	  HD-audio driver.  The power-saving timeout can be configured
	  via power_save option or over sysfs on-the-fly.

config SND_HDA_POWER_SAVE_DEFAULT
	int "Default time-out for HD-audio power-save mode"
	depends on SND_HDA_POWER_SAVE
	depends on PM
	default 0
	help
	  The default time-out value in seconds for HD-audio automatic
+9 −14
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset)
}
EXPORT_SYMBOL_HDA(snd_hda_delete_codec_preset);

#ifdef CONFIG_SND_HDA_POWER_SAVE
#ifdef CONFIG_PM
static void hda_power_work(struct work_struct *work);
static void hda_keep_power_on(struct hda_codec *codec);
#define hda_codec_is_power_on(codec)	((codec)->power_on)
@@ -1192,7 +1192,7 @@ static void snd_hda_codec_free(struct hda_codec *codec)
		return;
	snd_hda_jack_tbl_clear(codec);
	restore_init_pincfgs(codec);
#ifdef CONFIG_SND_HDA_POWER_SAVE
#ifdef CONFIG_PM
	cancel_delayed_work(&codec->power_work);
	flush_workqueue(codec->bus->workq);
#endif
@@ -1205,7 +1205,7 @@ static void snd_hda_codec_free(struct hda_codec *codec)
	codec->bus->caddr_tbl[codec->addr] = NULL;
	if (codec->patch_ops.free)
		codec->patch_ops.free(codec);
#ifdef CONFIG_SND_HDA_POWER_SAVE
#ifdef CONFIG_PM
	if (codec->power_on)
		hda_call_pm_notify(codec->bus, false);
#endif
@@ -1273,7 +1273,7 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus,
	snd_array_init(&codec->conn_lists, sizeof(hda_nid_t), 64);
	snd_array_init(&codec->spdif_out, sizeof(struct hda_spdif_out), 16);

#ifdef CONFIG_SND_HDA_POWER_SAVE
#ifdef CONFIG_PM
	spin_lock_init(&codec->power_lock);
	INIT_DELAYED_WORK(&codec->power_work, hda_power_work);
	/* snd_hda_codec_new() marks the codec as power-up, and leave it as is.
@@ -1331,7 +1331,7 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus,
					   AC_VERB_GET_SUBSYSTEM_ID, 0);
	}

#ifdef CONFIG_SND_HDA_POWER_SAVE
#ifdef CONFIG_PM
	codec->d3_stop_clk = snd_hda_codec_get_supported_ps(codec,
					codec->afg ? codec->afg : codec->mfg,
					AC_PWRST_CLKSTOP);
@@ -2353,7 +2353,7 @@ int snd_hda_codec_reset(struct hda_codec *codec)

	/* OK, let it free */

#ifdef CONFIG_SND_HDA_POWER_SAVE
#ifdef CONFIG_PM
	cancel_delayed_work_sync(&codec->power_work);
	codec->power_on = 0;
	codec->power_transition = 0;
@@ -3572,7 +3572,7 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
	int count;
	unsigned int state;

#ifdef CONFIG_SND_HDA_POWER_SAVE
#ifdef CONFIG_PM
	codec->d3_stop_clk_ok = 0;
#endif

@@ -3599,7 +3599,7 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
			break;
	}

#ifdef CONFIG_SND_HDA_POWER_SAVE
#ifdef CONFIG_PM
	if (!codec->bus->power_keep_link_on && power_state == AC_PWRST_D3
		&& codec->d3_stop_clk && (state & AC_PWRST_CLK_STOP_OK))
		codec->d3_stop_clk_ok = 1;
@@ -3629,7 +3629,6 @@ static void hda_call_codec_suspend(struct hda_codec *codec)
	hda_set_power_state(codec,
			    codec->afg ? codec->afg : codec->mfg,
			    AC_PWRST_D3);
#ifdef CONFIG_SND_HDA_POWER_SAVE
	cancel_delayed_work(&codec->power_work);
	spin_lock(&codec->power_lock);
	snd_hda_update_power_acct(codec);
@@ -3638,7 +3637,6 @@ static void hda_call_codec_suspend(struct hda_codec *codec)
	codec->power_transition = 0;
	codec->power_jiffies = jiffies;
	spin_unlock(&codec->power_lock);
#endif
}

/*
@@ -4434,7 +4432,7 @@ int snd_hda_add_new_ctls(struct hda_codec *codec,
}
EXPORT_SYMBOL_HDA(snd_hda_add_new_ctls);

#ifdef CONFIG_SND_HDA_POWER_SAVE
#ifdef CONFIG_PM
static void hda_power_work(struct work_struct *work)
{
	struct hda_codec *codec =
@@ -5107,9 +5105,6 @@ EXPORT_SYMBOL_HDA(snd_hda_suspend);
 * @bus: the HDA bus
 *
 * Returns 0 if successful.
 *
 * This function is defined only when POWER_SAVE isn't set.
 * In the power-save mode, the codec is resumed dynamically.
 */
int snd_hda_resume(struct hda_bus *bus)
{
+4 −6
Original line number Diff line number Diff line
@@ -614,7 +614,7 @@ struct hda_bus_ops {
			  struct hda_pcm *pcm);
	/* reset bus for retry verb */
	void (*bus_reset)(struct hda_bus *bus);
#ifdef CONFIG_SND_HDA_POWER_SAVE
#ifdef CONFIG_PM
	/* notify power-up/down from codec to controller */
	void (*pm_notify)(struct hda_bus *bus, bool power_up);
#endif
@@ -712,8 +712,6 @@ struct hda_codec_ops {
#ifdef CONFIG_PM
	int (*suspend)(struct hda_codec *codec);
	int (*resume)(struct hda_codec *codec);
#endif
#ifdef CONFIG_SND_HDA_POWER_SAVE
	int (*check_power_status)(struct hda_codec *codec, hda_nid_t nid);
#endif
	void (*reboot_notify)(struct hda_codec *codec);
@@ -867,7 +865,7 @@ struct hda_codec {
	unsigned int no_jack_detect:1;	/* Machine has no jack-detection */
	unsigned int pcm_format_first:1; /* PCM format must be set first */
	unsigned int epss:1;		/* supporting EPSS? */
#ifdef CONFIG_SND_HDA_POWER_SAVE
#ifdef CONFIG_PM
	unsigned int power_on :1;	/* current (global) power-state */
	int power_transition;	/* power-state in transition */
	int power_count;	/* current (global) power refcount */
@@ -1049,7 +1047,7 @@ int snd_hda_resume(struct hda_bus *bus);
static inline
int hda_call_check_power_status(struct hda_codec *codec, hda_nid_t nid)
{
#ifdef CONFIG_SND_HDA_POWER_SAVE
#ifdef CONFIG_PM
	if (codec->patch_ops.check_power_status)
		return codec->patch_ops.check_power_status(codec, nid);
#endif
@@ -1066,7 +1064,7 @@ const char *snd_hda_get_jack_location(u32 cfg);
/*
 * power saving
 */
#ifdef CONFIG_SND_HDA_POWER_SAVE
#ifdef CONFIG_PM
void snd_hda_power_save(struct hda_codec *codec, int delta, bool d3wait);
void snd_hda_update_power_acct(struct hda_codec *codec);
#else
+4 −4
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ struct hda_gspec {

	struct list_head nid_list;	/* list of widgets */

#ifdef CONFIG_SND_HDA_POWER_SAVE
#ifdef CONFIG_PM
#define MAX_LOOPBACK_AMPS	7
	struct hda_loopback_check loopback;
	int num_loopbacks;
@@ -654,7 +654,7 @@ static int parse_input(struct hda_codec *codec)
	return 0;
}

#ifdef CONFIG_SND_HDA_POWER_SAVE
#ifdef CONFIG_PM
static void add_input_loopback(struct hda_codec *codec, hda_nid_t nid,
			       int dir, int idx)
{
@@ -1028,7 +1028,7 @@ static int build_generic_pcms(struct hda_codec *codec)
	return 0;
}

#ifdef CONFIG_SND_HDA_POWER_SAVE
#ifdef CONFIG_PM
static int generic_check_power_status(struct hda_codec *codec, hda_nid_t nid)
{
	struct hda_gspec *spec = codec->spec;
@@ -1043,7 +1043,7 @@ static struct hda_codec_ops generic_patch_ops = {
	.build_controls = build_generic_controls,
	.build_pcms = build_generic_pcms,
	.free = snd_hda_generic_free,
#ifdef CONFIG_SND_HDA_POWER_SAVE
#ifdef CONFIG_PM
	.check_power_status = generic_check_power_status,
#endif
};
+2 −2
Original line number Diff line number Diff line
@@ -155,7 +155,7 @@ int /*__devinit*/ snd_hda_create_hwdep(struct hda_codec *codec)
	return 0;
}

#ifdef CONFIG_SND_HDA_POWER_SAVE
#ifdef CONFIG_PM
static ssize_t power_on_acct_show(struct device *dev,
				  struct device_attribute *attr,
				  char *buf)
@@ -191,7 +191,7 @@ int snd_hda_hwdep_add_power_sysfs(struct hda_codec *codec)
					  hwdep->device, &power_attrs[i]);
	return 0;
}
#endif /* CONFIG_SND_HDA_POWER_SAVE */
#endif /* CONFIG_PM */

#ifdef CONFIG_SND_HDA_RECONFIG

Loading