Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH 00/12] ALSA: hda: Reduce CONFIG_PM dependencies
@ 2024-05-06 16:13 Takashi Iwai
  2024-05-06 16:13 ` [PATCH 01/12] ALSA: hda: intel: " Takashi Iwai
                   ` (11 more replies)
  0 siblings, 12 replies; 16+ messages in thread
From: Takashi Iwai @ 2024-05-06 16:13 UTC (permalink / raw)
  To: linux-sound

The legacy HD-audio drivers contain a fair amount of CONFIG_PM
dependent code.  As nowadays CONFIG_PM is de facto mandatory, this
makes code unnecessarily complex.

This patch series tries to reduce CONFIG_PM dependencies in HD-audio
drivers.

Lightly tested with different config sets.


Takashi

===

Takashi Iwai (12):
  ALSA: hda: intel: Reduce CONFIG_PM dependencies
  ALSA: hda: codec: Reduce CONFIG_PM dependencies
  ALSA: hda: generic: Reduce CONFIG_PM dependencies
  ALSA: hda: analog: Reduce CONFIG_PM dependencies
  ALSA: hda: ca0132: Reduce CONFIG_PM dependencies
  ALSA: hda: cirrus: Reduce CONFIG_PM dependencies
  ALSA: hda: conexant: Reduce CONFIG_PM dependencies
  ALSA: hda: cs4809: Reduce CONFIG_PM dependencies
  ALSA: hda: hdmi: Reduce CONFIG_PM dependencies
  ALSA: hda: realtek: Reduce CONFIG_PM dependencies
  ALSA: hda: sigmantel: Reduce CONFIG_PM dependencies
  ALSA: hda: via: Reduce CONFIG_PM dependencies

 include/sound/hda_codec.h       | 11 --------
 sound/pci/hda/hda_codec.c       | 37 +++++++-------------------
 sound/pci/hda/hda_controller.c  |  2 --
 sound/pci/hda/hda_generic.c     |  4 ---
 sound/pci/hda/hda_generic.h     |  2 --
 sound/pci/hda/hda_intel.c       | 46 ++++++++++-----------------------
 sound/pci/hda/hda_intel_trace.h |  2 --
 sound/pci/hda/hda_sysfs.c       |  4 ---
 sound/pci/hda/patch_analog.c    |  4 ---
 sound/pci/hda/patch_ca0132.c    |  4 ---
 sound/pci/hda/patch_cirrus.c    |  4 ---
 sound/pci/hda/patch_conexant.c  |  4 ---
 sound/pci/hda/patch_cs8409.c    |  8 ------
 sound/pci/hda/patch_hdmi.c      |  8 ------
 sound/pci/hda/patch_realtek.c   | 16 +-----------
 sound/pci/hda/patch_sigmatel.c  |  8 ------
 sound/pci/hda/patch_via.c       |  6 -----
 17 files changed, 25 insertions(+), 145 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 01/12] ALSA: hda: intel: Reduce CONFIG_PM dependencies
  2024-05-06 16:13 [PATCH 00/12] ALSA: hda: Reduce CONFIG_PM dependencies Takashi Iwai
@ 2024-05-06 16:13 ` Takashi Iwai
  2024-05-08 17:45   ` Andy Shevchenko
  2024-05-06 16:13 ` [PATCH 02/12] ALSA: hda: codec: " Takashi Iwai
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 16+ messages in thread
From: Takashi Iwai @ 2024-05-06 16:13 UTC (permalink / raw)
  To: linux-sound

snd-hda-intel contains lots of CONFIG_PM dependent code although
CONFIG_PM is almost mandatory nowadays, and it makes the code
unnecessarily complex.

Let's reduce the dependencies of CONFIG_PM in snd-hda-intel driver
code.  I left a few module options to be dependent on CONFIG_PM (which
are visible to users), but other places are either enabled or
optimized by compiler automatically.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/hda_intel.c       | 46 ++++++++++-----------------------
 sound/pci/hda/hda_intel_trace.h |  2 --
 2 files changed, 14 insertions(+), 34 deletions(-)

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 1b550c42db09..31b0c954b0c8 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -186,8 +186,10 @@ MODULE_PARM_DESC(pm_blacklist, "Enable power-management denylist");
 static bool power_save_controller = 1;
 module_param(power_save_controller, bool, 0644);
 MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode.");
-#else
+#else /* CONFIG_PM */
 #define power_save	0
+#define pm_blacklist	false
+#define power_save_controller	false
 #endif /* CONFIG_PM */
 
 static int align_buffer_size = -1;
@@ -890,7 +892,6 @@ static void __azx_shutdown_chip(struct azx *chip, bool skip_link_reset)
 	display_power(chip, false);
 }
 
-#ifdef CONFIG_PM
 static DEFINE_MUTEX(card_list_lock);
 static LIST_HEAD(card_list);
 
@@ -916,7 +917,7 @@ static void azx_del_card_list(struct azx *chip)
 }
 
 /* trigger power-save check at writing parameter */
-static int param_set_xint(const char *val, const struct kernel_param *kp)
+static int __maybe_unused param_set_xint(const char *val, const struct kernel_param *kp)
 {
 	struct hda_intel *hda;
 	struct azx *chip;
@@ -987,7 +988,6 @@ static void __azx_runtime_resume(struct azx *chip)
 		display_power(chip, false);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int azx_prepare(struct device *dev)
 {
 	struct snd_card *card = dev_get_drvdata(dev);
@@ -1046,7 +1046,7 @@ static int azx_suspend(struct device *dev)
 	return 0;
 }
 
-static int azx_resume(struct device *dev)
+static int __maybe_unused azx_resume(struct device *dev)
 {
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct azx *chip;
@@ -1097,9 +1097,8 @@ static int azx_thaw_noirq(struct device *dev)
 
 	return 0;
 }
-#endif /* CONFIG_PM_SLEEP */
 
-static int azx_runtime_suspend(struct device *dev)
+static int __maybe_unused azx_runtime_suspend(struct device *dev)
 {
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct azx *chip;
@@ -1116,7 +1115,7 @@ static int azx_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-static int azx_runtime_resume(struct device *dev)
+static int __maybe_unused azx_runtime_resume(struct device *dev)
 {
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct azx *chip;
@@ -1133,7 +1132,7 @@ static int azx_runtime_resume(struct device *dev)
 	return 0;
 }
 
-static int azx_runtime_idle(struct device *dev)
+static int __maybe_unused azx_runtime_idle(struct device *dev)
 {
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct azx *chip;
@@ -1159,23 +1158,14 @@ static int azx_runtime_idle(struct device *dev)
 }
 
 static const struct dev_pm_ops azx_pm = {
-	SET_SYSTEM_SLEEP_PM_OPS(azx_suspend, azx_resume)
-#ifdef CONFIG_PM_SLEEP
-	.prepare = azx_prepare,
-	.complete = azx_complete,
-	.freeze_noirq = azx_freeze_noirq,
-	.thaw_noirq = azx_thaw_noirq,
-#endif
+	SYSTEM_SLEEP_PM_OPS(azx_suspend, azx_resume)
+	.prepare = pm_sleep_ptr(azx_prepare),
+	.complete = pm_sleep_ptr(azx_complete),
+	.freeze_noirq = pm_sleep_ptr(azx_freeze_noirq),
+	.thaw_noirq = pm_sleep_ptr(azx_thaw_noirq),
 	SET_RUNTIME_PM_OPS(azx_runtime_suspend, azx_runtime_resume, azx_runtime_idle)
 };
 
-#define AZX_PM_OPS	&azx_pm
-#else
-#define azx_add_card_list(chip) /* NOP */
-#define azx_del_card_list(chip) /* NOP */
-#define AZX_PM_OPS	NULL
-#endif /* CONFIG_PM */
-
 
 static int azx_probe_continue(struct azx *chip);
 
@@ -2206,7 +2196,6 @@ static int azx_probe(struct pci_dev *pci,
 	return err;
 }
 
-#ifdef CONFIG_PM
 /* On some boards setting power_save to a non 0 value leads to clicking /
  * popping sounds when ever we enter/leave powersaving mode. Ideally we would
  * figure out how to avoid these sounds, but that is not always feasible.
@@ -2248,13 +2237,11 @@ static const struct snd_pci_quirk power_save_denylist[] = {
 	SND_PCI_QUIRK(0x1734, 0x1232, "KONTRON SinglePC", 0),
 	{}
 };
-#endif /* CONFIG_PM */
 
 static void set_default_power_save(struct azx *chip)
 {
 	int val = power_save;
 
-#ifdef CONFIG_PM
 	if (pm_blacklist) {
 		const struct snd_pci_quirk *q;
 
@@ -2265,7 +2252,6 @@ static void set_default_power_save(struct azx *chip)
 			val = 0;
 		}
 	}
-#endif /* CONFIG_PM */
 	snd_hda_set_power_save(&chip->bus, val * 1000);
 }
 
@@ -2321,10 +2307,6 @@ static int azx_probe_continue(struct azx *chip)
 					 chip->fw->data);
 		if (err < 0)
 			goto out_free;
-#ifndef CONFIG_PM
-		release_firmware(chip->fw); /* no longer needed */
-		chip->fw = NULL;
-#endif
 	}
 #endif
 
@@ -2765,7 +2747,7 @@ static struct pci_driver azx_driver = {
 	.remove = azx_remove,
 	.shutdown = azx_shutdown,
 	.driver = {
-		.pm = AZX_PM_OPS,
+		.pm = &azx_pm,
 	},
 };
 
diff --git a/sound/pci/hda/hda_intel_trace.h b/sound/pci/hda/hda_intel_trace.h
index 73a7adfa192d..2775fa81a500 100644
--- a/sound/pci/hda/hda_intel_trace.h
+++ b/sound/pci/hda/hda_intel_trace.h
@@ -34,7 +34,6 @@ DEFINE_EVENT(hda_pm, azx_resume,
 	TP_ARGS(chip)
 );
 
-#ifdef CONFIG_PM
 DEFINE_EVENT(hda_pm, azx_runtime_suspend,
 	TP_PROTO(struct azx *chip),
 	TP_ARGS(chip)
@@ -44,7 +43,6 @@ DEFINE_EVENT(hda_pm, azx_runtime_resume,
 	TP_PROTO(struct azx *chip),
 	TP_ARGS(chip)
 );
-#endif
 
 #endif /* _TRACE_HDA_INTEL_H */
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 02/12] ALSA: hda: codec: Reduce CONFIG_PM dependencies
  2024-05-06 16:13 [PATCH 00/12] ALSA: hda: Reduce CONFIG_PM dependencies Takashi Iwai
  2024-05-06 16:13 ` [PATCH 01/12] ALSA: hda: intel: " Takashi Iwai
@ 2024-05-06 16:13 ` Takashi Iwai
  2024-05-06 16:13 ` [PATCH 03/12] ALSA: hda: generic: " Takashi Iwai
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Takashi Iwai @ 2024-05-06 16:13 UTC (permalink / raw)
  To: linux-sound

CONFIG_PM is almost mandatory nowadays for real systems, but we have
lots of CONFIG_PM dependent code in snd-hda-codec helper code.

Let's reduce the dependencies of CONFIG_PM now.  The only visible
drawback would be a couple of superfluous trace entries for runtime
PM, but we can live with that.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 include/sound/hda_codec.h      | 11 ----------
 sound/pci/hda/hda_codec.c      | 37 +++++++++-------------------------
 sound/pci/hda/hda_controller.c |  2 --
 sound/pci/hda/hda_sysfs.c      |  4 ----
 4 files changed, 10 insertions(+), 44 deletions(-)

diff --git a/include/sound/hda_codec.h b/include/sound/hda_codec.h
index 9c94ba7c183d..575e55aa08ca 100644
--- a/include/sound/hda_codec.h
+++ b/include/sound/hda_codec.h
@@ -109,11 +109,9 @@ struct hda_codec_ops {
 	void (*unsol_event)(struct hda_codec *codec, unsigned int res);
 	void (*set_power_state)(struct hda_codec *codec, hda_nid_t fg,
 				unsigned int power_state);
-#ifdef CONFIG_PM
 	int (*suspend)(struct hda_codec *codec);
 	int (*resume)(struct hda_codec *codec);
 	int (*check_power_status)(struct hda_codec *codec, hda_nid_t nid);
-#endif
 	void (*stream_pm)(struct hda_codec *codec, hda_nid_t nid, bool on);
 };
 
@@ -259,11 +257,9 @@ struct hda_codec {
 	unsigned int no_stream_clean_at_suspend:1; /* do not clean streams at suspend */
 	unsigned int ctl_dev_id:1; /* old control element id build behaviour */
 
-#ifdef CONFIG_PM
 	unsigned long power_on_acct;
 	unsigned long power_off_acct;
 	unsigned long power_jiffies;
-#endif
 
 	/* filter the requested power state per nid */
 	unsigned int (*power_filter)(struct hda_codec *codec, hda_nid_t nid,
@@ -481,10 +477,8 @@ extern const struct dev_pm_ops hda_codec_driver_pm;
 static inline
 int hda_call_check_power_status(struct hda_codec *codec, hda_nid_t nid)
 {
-#ifdef CONFIG_PM
 	if (codec->patch_ops.check_power_status)
 		return codec->patch_ops.check_power_status(codec, nid);
-#endif
 	return 0;
 }
 
@@ -495,14 +489,9 @@ int hda_call_check_power_status(struct hda_codec *codec, hda_nid_t nid)
 #define snd_hda_power_up_pm(codec)	snd_hdac_power_up_pm(&(codec)->core)
 #define snd_hda_power_down(codec)	snd_hdac_power_down(&(codec)->core)
 #define snd_hda_power_down_pm(codec)	snd_hdac_power_down_pm(&(codec)->core)
-#ifdef CONFIG_PM
 void snd_hda_codec_set_power_save(struct hda_codec *codec, int delay);
 void snd_hda_set_power_save(struct hda_bus *bus, int delay);
 void snd_hda_update_power_acct(struct hda_codec *codec);
-#else
-static inline void snd_hda_codec_set_power_save(struct hda_codec *codec, int delay) {}
-static inline void snd_hda_set_power_save(struct hda_bus *bus, int delay) {}
-#endif
 
 static inline bool hda_codec_need_resume(struct hda_codec *codec)
 {
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 2cac337f5263..325e8f0b99a8 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -616,7 +616,6 @@ void snd_hda_shutup_pins(struct hda_codec *codec)
 }
 EXPORT_SYMBOL_GPL(snd_hda_shutup_pins);
 
-#ifdef CONFIG_PM
 /* Restore the pin controls cleared previously via snd_hda_shutup_pins() */
 static void restore_shutup_pins(struct hda_codec *codec)
 {
@@ -634,7 +633,6 @@ static void restore_shutup_pins(struct hda_codec *codec)
 	}
 	codec->pins_shutup = 0;
 }
-#endif
 
 static void hda_jackpoll_work(struct work_struct *work)
 {
@@ -1001,9 +999,7 @@ int snd_hda_codec_device_new(struct hda_bus *bus, struct snd_card *card,
 	codec->card = card;
 	codec->addr = codec_addr;
 
-#ifdef CONFIG_PM
 	codec->power_jiffies = jiffies;
-#endif
 
 	snd_hda_sysfs_init(codec);
 
@@ -1238,7 +1234,6 @@ static void purify_inactive_streams(struct hda_codec *codec)
 	}
 }
 
-#ifdef CONFIG_PM
 /* clean up all streams; called from suspend */
 static void hda_cleanup_all_streams(struct hda_codec *codec)
 {
@@ -1250,7 +1245,6 @@ static void hda_cleanup_all_streams(struct hda_codec *codec)
 			really_cleanup_stream(codec, p);
 	}
 }
-#endif
 
 /*
  * amp access functions
@@ -2858,7 +2852,6 @@ static void hda_exec_init_verbs(struct hda_codec *codec)
 static inline void hda_exec_init_verbs(struct hda_codec *codec) {}
 #endif
 
-#ifdef CONFIG_PM
 /* update the power on/off account with the current jiffies */
 static void update_power_acct(struct hda_codec *codec, bool on)
 {
@@ -2966,9 +2959,6 @@ static int hda_codec_runtime_resume(struct device *dev)
 	return 0;
 }
 
-#endif /* CONFIG_PM */
-
-#ifdef CONFIG_PM_SLEEP
 static int hda_codec_pm_prepare(struct device *dev)
 {
 	struct hda_codec *codec = dev_to_hda_codec(dev);
@@ -3023,22 +3013,19 @@ static int hda_codec_pm_restore(struct device *dev)
 	dev->power.power_state = PMSG_RESTORE;
 	return pm_runtime_force_resume(dev);
 }
-#endif /* CONFIG_PM_SLEEP */
 
 /* referred in hda_bind.c */
 const struct dev_pm_ops hda_codec_driver_pm = {
-#ifdef CONFIG_PM_SLEEP
-	.prepare = hda_codec_pm_prepare,
-	.complete = hda_codec_pm_complete,
-	.suspend = hda_codec_pm_suspend,
-	.resume = hda_codec_pm_resume,
-	.freeze = hda_codec_pm_freeze,
-	.thaw = hda_codec_pm_thaw,
-	.poweroff = hda_codec_pm_suspend,
-	.restore = hda_codec_pm_restore,
-#endif /* CONFIG_PM_SLEEP */
-	SET_RUNTIME_PM_OPS(hda_codec_runtime_suspend, hda_codec_runtime_resume,
-			   NULL)
+	.prepare = pm_sleep_ptr(hda_codec_pm_prepare),
+	.complete = pm_sleep_ptr(hda_codec_pm_complete),
+	.suspend = pm_sleep_ptr(hda_codec_pm_suspend),
+	.resume = pm_sleep_ptr(hda_codec_pm_resume),
+	.freeze = pm_sleep_ptr(hda_codec_pm_freeze),
+	.thaw = pm_sleep_ptr(hda_codec_pm_thaw),
+	.poweroff = pm_sleep_ptr(hda_codec_pm_suspend),
+	.restore = pm_sleep_ptr(hda_codec_pm_restore),
+	.runtime_suspend = pm_ptr(hda_codec_runtime_suspend),
+	.runtime_resume = pm_ptr(hda_codec_runtime_resume),
 };
 
 /* suspend the codec at shutdown; called from driver's shutdown callback */
@@ -3425,7 +3412,6 @@ int snd_hda_add_new_ctls(struct hda_codec *codec,
 }
 EXPORT_SYMBOL_GPL(snd_hda_add_new_ctls);
 
-#ifdef CONFIG_PM
 /**
  * snd_hda_codec_set_power_save - Configure codec's runtime PM
  * @codec: codec device to configure
@@ -3516,7 +3502,6 @@ int snd_hda_check_amp_list_power(struct hda_codec *codec,
 	return 0;
 }
 EXPORT_SYMBOL_GPL(snd_hda_check_amp_list_power);
-#endif
 
 /*
  * input MUX helper
@@ -4060,12 +4045,10 @@ void snd_hda_bus_reset_codecs(struct hda_bus *bus)
 		/* FIXME: maybe a better way needed for forced reset */
 		if (current_work() != &codec->jackpoll_work.work)
 			cancel_delayed_work_sync(&codec->jackpoll_work);
-#ifdef CONFIG_PM
 		if (hda_codec_is_power_on(codec)) {
 			hda_call_codec_suspend(codec);
 			hda_call_codec_resume(codec);
 		}
-#endif
 	}
 }
 
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
index 206306a0eb82..c7142eee9f35 100644
--- a/sound/pci/hda/hda_controller.c
+++ b/sound/pci/hda/hda_controller.c
@@ -1075,11 +1075,9 @@ irqreturn_t azx_interrupt(int irq, void *dev_id)
 	bool active, handled = false;
 	int repeat = 0; /* count for avoiding endless loop */
 
-#ifdef CONFIG_PM
 	if (azx_has_pm_runtime(chip))
 		if (!pm_runtime_active(chip->card->dev))
 			return IRQ_NONE;
-#endif
 
 	spin_lock(&bus->reg_lock);
 
diff --git a/sound/pci/hda/hda_sysfs.c b/sound/pci/hda/hda_sysfs.c
index 69ebc37a4d6f..265fd4737893 100644
--- a/sound/pci/hda/hda_sysfs.c
+++ b/sound/pci/hda/hda_sysfs.c
@@ -26,7 +26,6 @@ struct hda_hint {
 	const char *val;	/* contained in the same alloc as key */
 };
 
-#ifdef CONFIG_PM
 static ssize_t power_on_acct_show(struct device *dev,
 				  struct device_attribute *attr,
 				  char *buf)
@@ -47,7 +46,6 @@ static ssize_t power_off_acct_show(struct device *dev,
 
 static DEVICE_ATTR_RO(power_on_acct);
 static DEVICE_ATTR_RO(power_off_acct);
-#endif /* CONFIG_PM */
 
 #define CODEC_INFO_SHOW(type, field)				\
 static ssize_t type##_show(struct device *dev,			\
@@ -745,10 +743,8 @@ static struct attribute *hda_dev_attrs[] = {
 	&dev_attr_modelname.attr,
 	&dev_attr_init_pin_configs.attr,
 	&dev_attr_driver_pin_configs.attr,
-#ifdef CONFIG_PM
 	&dev_attr_power_on_acct.attr,
 	&dev_attr_power_off_acct.attr,
-#endif
 #ifdef CONFIG_SND_HDA_RECONFIG
 	&dev_attr_init_verbs.attr,
 	&dev_attr_hints.attr,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 03/12] ALSA: hda: generic: Reduce CONFIG_PM dependencies
  2024-05-06 16:13 [PATCH 00/12] ALSA: hda: Reduce CONFIG_PM dependencies Takashi Iwai
  2024-05-06 16:13 ` [PATCH 01/12] ALSA: hda: intel: " Takashi Iwai
  2024-05-06 16:13 ` [PATCH 02/12] ALSA: hda: codec: " Takashi Iwai
@ 2024-05-06 16:13 ` Takashi Iwai
  2024-05-06 16:13 ` [PATCH 04/12] ALSA: hda: analog: " Takashi Iwai
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Takashi Iwai @ 2024-05-06 16:13 UTC (permalink / raw)
  To: linux-sound

CONFIG_PM dependencies got reduced in HD-audio codec core driver, and
now it's time to reduce in HD-audio generic codec driver, too.

Simply drop CONFIG_PM ifdefs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/hda_generic.c | 4 ----
 sound/pci/hda/hda_generic.h | 2 --
 2 files changed, 6 deletions(-)

diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index de2a3d08c73c..f64d9dc197a3 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -6021,7 +6021,6 @@ void snd_hda_gen_free(struct hda_codec *codec)
 }
 EXPORT_SYMBOL_GPL(snd_hda_gen_free);
 
-#ifdef CONFIG_PM
 /**
  * snd_hda_gen_check_power_status - check the loopback power save state
  * @codec: the HDA codec
@@ -6035,7 +6034,6 @@ int snd_hda_gen_check_power_status(struct hda_codec *codec, hda_nid_t nid)
 	return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
 }
 EXPORT_SYMBOL_GPL(snd_hda_gen_check_power_status);
-#endif
 
 
 /*
@@ -6048,9 +6046,7 @@ static const struct hda_codec_ops generic_patch_ops = {
 	.init = snd_hda_gen_init,
 	.free = snd_hda_gen_free,
 	.unsol_event = snd_hda_jack_unsol_event,
-#ifdef CONFIG_PM
 	.check_power_status = snd_hda_gen_check_power_status,
-#endif
 };
 
 /*
diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h
index a8eea8367629..8f5ecf740c49 100644
--- a/sound/pci/hda/hda_generic.h
+++ b/sound/pci/hda/hda_generic.h
@@ -340,9 +340,7 @@ void snd_hda_gen_mic_autoswitch(struct hda_codec *codec,
 				struct hda_jack_callback *jack);
 void snd_hda_gen_update_outputs(struct hda_codec *codec);
 
-#ifdef CONFIG_PM
 int snd_hda_gen_check_power_status(struct hda_codec *codec, hda_nid_t nid);
-#endif
 unsigned int snd_hda_gen_path_power_filter(struct hda_codec *codec,
 					   hda_nid_t nid,
 					   unsigned int power_state);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 04/12] ALSA: hda: analog: Reduce CONFIG_PM dependencies
  2024-05-06 16:13 [PATCH 00/12] ALSA: hda: Reduce CONFIG_PM dependencies Takashi Iwai
                   ` (2 preceding siblings ...)
  2024-05-06 16:13 ` [PATCH 03/12] ALSA: hda: generic: " Takashi Iwai
@ 2024-05-06 16:13 ` Takashi Iwai
  2024-05-06 16:13 ` [PATCH 05/12] ALSA: hda: ca0132: " Takashi Iwai
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Takashi Iwai @ 2024-05-06 16:13 UTC (permalink / raw)
  To: linux-sound

CONFIG_PM dependencies got reduced in HD-audio codec core driver, and
now it's time to reduce in HD-audio analog codec driver, too.

Simply drop CONFIG_PM ifdefs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_analog.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 8afe6000f7da..1e9dadcdc51b 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -72,7 +72,6 @@ static int create_beep_ctls(struct hda_codec *codec)
 #define create_beep_ctls(codec)		0
 #endif
 
-#ifdef CONFIG_PM
 static void ad198x_power_eapd_write(struct hda_codec *codec, hda_nid_t front,
 				hda_nid_t hp)
 {
@@ -118,7 +117,6 @@ static int ad198x_suspend(struct hda_codec *codec)
 	ad198x_power_eapd(codec);
 	return 0;
 }
-#endif
 
 /* follow EAPD via vmaster hook */
 static void ad_vmaster_eapd_hook(void *private_data, int enabled)
@@ -158,10 +156,8 @@ static const struct hda_codec_ops ad198x_auto_patch_ops = {
 	.init = snd_hda_gen_init,
 	.free = snd_hda_gen_free,
 	.unsol_event = snd_hda_jack_unsol_event,
-#ifdef CONFIG_PM
 	.check_power_status = snd_hda_gen_check_power_status,
 	.suspend = ad198x_suspend,
-#endif
 };
 
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 05/12] ALSA: hda: ca0132: Reduce CONFIG_PM dependencies
  2024-05-06 16:13 [PATCH 00/12] ALSA: hda: Reduce CONFIG_PM dependencies Takashi Iwai
                   ` (3 preceding siblings ...)
  2024-05-06 16:13 ` [PATCH 04/12] ALSA: hda: analog: " Takashi Iwai
@ 2024-05-06 16:13 ` Takashi Iwai
  2024-05-06 16:13 ` [PATCH 06/12] ALSA: hda: cirrus: " Takashi Iwai
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Takashi Iwai @ 2024-05-06 16:13 UTC (permalink / raw)
  To: linux-sound

CONFIG_PM dependencies got reduced in HD-audio codec core driver, and
now it's time to reduce in HD-audio ca0132 codec driver, too.

Simply drop CONFIG_PM ifdefs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_ca0132.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index aa312441604f..e4673a71551a 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -9682,7 +9682,6 @@ static void dbpro_free(struct hda_codec *codec)
 	kfree(codec->spec);
 }
 
-#ifdef CONFIG_PM
 static int ca0132_suspend(struct hda_codec *codec)
 {
 	struct ca0132_spec *spec = codec->spec;
@@ -9690,7 +9689,6 @@ static int ca0132_suspend(struct hda_codec *codec)
 	cancel_delayed_work_sync(&spec->unsol_hp_work);
 	return 0;
 }
-#endif
 
 static const struct hda_codec_ops ca0132_patch_ops = {
 	.build_controls = ca0132_build_controls,
@@ -9698,9 +9696,7 @@ static const struct hda_codec_ops ca0132_patch_ops = {
 	.init = ca0132_init,
 	.free = ca0132_free,
 	.unsol_event = snd_hda_jack_unsol_event,
-#ifdef CONFIG_PM
 	.suspend = ca0132_suspend,
-#endif
 };
 
 static const struct hda_codec_ops dbpro_patch_ops = {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 06/12] ALSA: hda: cirrus: Reduce CONFIG_PM dependencies
  2024-05-06 16:13 [PATCH 00/12] ALSA: hda: Reduce CONFIG_PM dependencies Takashi Iwai
                   ` (4 preceding siblings ...)
  2024-05-06 16:13 ` [PATCH 05/12] ALSA: hda: ca0132: " Takashi Iwai
@ 2024-05-06 16:13 ` Takashi Iwai
  2024-05-06 16:13 ` [PATCH 07/12] ALSA: hda: conexant: " Takashi Iwai
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Takashi Iwai @ 2024-05-06 16:13 UTC (permalink / raw)
  To: linux-sound

CONFIG_PM dependencies got reduced in HD-audio codec core driver, and
now it's time to reduce in HD-audio cirrus codec driver, too.

Simply drop CONFIG_PM ifdefs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_cirrus.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 6807b4708a17..654724559355 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -1128,7 +1128,6 @@ static int cs421x_parse_auto_config(struct hda_codec *codec)
 	return 0;
 }
 
-#ifdef CONFIG_PM
 /*
  *	Manage PDREF, when transitioning to D3hot
  *	(DAC,ADC) -> D3, PDREF=1, AFG->D3
@@ -1153,7 +1152,6 @@ static int cs421x_suspend(struct hda_codec *codec)
 
 	return 0;
 }
-#endif
 
 static const struct hda_codec_ops cs421x_patch_ops = {
 	.build_controls = snd_hda_gen_build_controls,
@@ -1161,9 +1159,7 @@ static const struct hda_codec_ops cs421x_patch_ops = {
 	.init = cs421x_init,
 	.free = cs_free,
 	.unsol_event = snd_hda_jack_unsol_event,
-#ifdef CONFIG_PM
 	.suspend = cs421x_suspend,
-#endif
 };
 
 static int patch_cs4210(struct hda_codec *codec)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 07/12] ALSA: hda: conexant: Reduce CONFIG_PM dependencies
  2024-05-06 16:13 [PATCH 00/12] ALSA: hda: Reduce CONFIG_PM dependencies Takashi Iwai
                   ` (5 preceding siblings ...)
  2024-05-06 16:13 ` [PATCH 06/12] ALSA: hda: cirrus: " Takashi Iwai
@ 2024-05-06 16:13 ` Takashi Iwai
  2024-05-06 16:13 ` [PATCH 08/12] ALSA: hda: cs4809: " Takashi Iwai
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Takashi Iwai @ 2024-05-06 16:13 UTC (permalink / raw)
  To: linux-sound

CONFIG_PM dependencies got reduced in HD-audio codec core driver, and
now it's time to reduce in HD-audio conexant codec driver, too.

Simply drop CONFIG_PM ifdefs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_conexant.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index e8209178d87b..17389a3801bd 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -294,13 +294,11 @@ static void cx_jack_unsol_event(struct hda_codec *codec, unsigned int res)
 	snd_hda_jack_unsol_event(codec, res);
 }
 
-#ifdef CONFIG_PM
 static int cx_auto_suspend(struct hda_codec *codec)
 {
 	cx_auto_shutdown(codec);
 	return 0;
 }
-#endif
 
 static const struct hda_codec_ops cx_auto_patch_ops = {
 	.build_controls = snd_hda_gen_build_controls,
@@ -308,10 +306,8 @@ static const struct hda_codec_ops cx_auto_patch_ops = {
 	.init = cx_auto_init,
 	.free = cx_auto_free,
 	.unsol_event = cx_jack_unsol_event,
-#ifdef CONFIG_PM
 	.suspend = cx_auto_suspend,
 	.check_power_status = snd_hda_gen_check_power_status,
-#endif
 };
 
 /*
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 08/12] ALSA: hda: cs4809: Reduce CONFIG_PM dependencies
  2024-05-06 16:13 [PATCH 00/12] ALSA: hda: Reduce CONFIG_PM dependencies Takashi Iwai
                   ` (6 preceding siblings ...)
  2024-05-06 16:13 ` [PATCH 07/12] ALSA: hda: conexant: " Takashi Iwai
@ 2024-05-06 16:13 ` Takashi Iwai
  2024-05-06 16:13 ` [PATCH 09/12] ALSA: hda: hdmi: " Takashi Iwai
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Takashi Iwai @ 2024-05-06 16:13 UTC (permalink / raw)
  To: linux-sound

CONFIG_PM dependencies got reduced in HD-audio codec core driver, and
now it's time to reduce in HD-audio generic cs8409 driver, too.

Simply drop CONFIG_PM ifdefs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_cs8409.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/sound/pci/hda/patch_cs8409.c b/sound/pci/hda/patch_cs8409.c
index e41316e2e983..26f3c31600d7 100644
--- a/sound/pci/hda/patch_cs8409.c
+++ b/sound/pci/hda/patch_cs8409.c
@@ -909,7 +909,6 @@ static void cs42l42_resume(struct sub_codec *cs42l42)
 	cs42l42_enable_jack_detect(cs42l42);
 }
 
-#ifdef CONFIG_PM
 static void cs42l42_suspend(struct sub_codec *cs42l42)
 {
 	struct hda_codec *codec = cs42l42->codec;
@@ -948,7 +947,6 @@ static void cs42l42_suspend(struct sub_codec *cs42l42)
 	spec->gpio_data &= ~cs42l42->reset_gpio;
 	snd_hda_codec_write(codec, CS8409_PIN_AFG, 0, AC_VERB_SET_GPIO_DATA, spec->gpio_data);
 }
-#endif
 
 static void cs8409_free(struct hda_codec *codec)
 {
@@ -1003,7 +1001,6 @@ static void cs8409_cs42l42_jack_unsol_event(struct hda_codec *codec, unsigned in
 	}
 }
 
-#ifdef CONFIG_PM
 /* Manage PDREF, when transition to D3hot */
 static int cs8409_cs42l42_suspend(struct hda_codec *codec)
 {
@@ -1025,7 +1022,6 @@ static int cs8409_cs42l42_suspend(struct hda_codec *codec)
 
 	return 0;
 }
-#endif
 
 /* Vendor specific HW configuration
  * PLL, ASP, I2C, SPI, GPIOs, DMIC etc...
@@ -1080,9 +1076,7 @@ static const struct hda_codec_ops cs8409_cs42l42_patch_ops = {
 	.init = cs8409_init,
 	.free = cs8409_free,
 	.unsol_event = cs8409_cs42l42_jack_unsol_event,
-#ifdef CONFIG_PM
 	.suspend = cs8409_cs42l42_suspend,
-#endif
 };
 
 static int cs8409_cs42l42_exec_verb(struct hdac_device *dev, unsigned int cmd, unsigned int flags,
@@ -1310,9 +1304,7 @@ static const struct hda_codec_ops cs8409_dolphin_patch_ops = {
 	.init = cs8409_init,
 	.free = cs8409_free,
 	.unsol_event = dolphin_jack_unsol_event,
-#ifdef CONFIG_PM
 	.suspend = cs8409_cs42l42_suspend,
-#endif
 };
 
 static int dolphin_exec_verb(struct hdac_device *dev, unsigned int cmd, unsigned int flags,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 09/12] ALSA: hda: hdmi: Reduce CONFIG_PM dependencies
  2024-05-06 16:13 [PATCH 00/12] ALSA: hda: Reduce CONFIG_PM dependencies Takashi Iwai
                   ` (7 preceding siblings ...)
  2024-05-06 16:13 ` [PATCH 08/12] ALSA: hda: cs4809: " Takashi Iwai
@ 2024-05-06 16:13 ` Takashi Iwai
  2024-05-06 16:13 ` [PATCH 10/12] ALSA: hda: realtek: " Takashi Iwai
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Takashi Iwai @ 2024-05-06 16:13 UTC (permalink / raw)
  To: linux-sound

CONFIG_PM dependencies got reduced in HD-audio codec core driver, and
now it's time to reduce in HD-audio HDMI codec driver, too.

Simply drop CONFIG_PM ifdefs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_hdmi.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 495d63101186..b2c42cd54351 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -2513,7 +2513,6 @@ static void generic_hdmi_free(struct hda_codec *codec)
 	generic_spec_free(codec);
 }
 
-#ifdef CONFIG_PM
 static int generic_hdmi_suspend(struct hda_codec *codec)
 {
 	struct hdmi_spec *spec = codec->spec;
@@ -2540,7 +2539,6 @@ static int generic_hdmi_resume(struct hda_codec *codec)
 	}
 	return 0;
 }
-#endif
 
 static const struct hda_codec_ops generic_hdmi_patch_ops = {
 	.init			= generic_hdmi_init,
@@ -2548,10 +2546,8 @@ static const struct hda_codec_ops generic_hdmi_patch_ops = {
 	.build_pcms		= generic_hdmi_build_pcms,
 	.build_controls		= generic_hdmi_build_controls,
 	.unsol_event		= hdmi_unsol_event,
-#ifdef CONFIG_PM
 	.suspend		= generic_hdmi_suspend,
 	.resume			= generic_hdmi_resume,
-#endif
 };
 
 static const struct hdmi_ops generic_standard_hdmi_ops = {
@@ -2952,7 +2948,6 @@ static void i915_pin_cvt_fixup(struct hda_codec *codec,
 	}
 }
 
-#ifdef CONFIG_PM
 static int i915_adlp_hdmi_suspend(struct hda_codec *codec)
 {
 	struct hdmi_spec *spec = codec->spec;
@@ -3032,7 +3027,6 @@ static int i915_adlp_hdmi_resume(struct hda_codec *codec)
 
 	return res;
 }
-#endif
 
 /* precondition and allocation for Intel codecs */
 static int alloc_intel_hdmi(struct hda_codec *codec)
@@ -3167,10 +3161,8 @@ static int patch_i915_adlp_hdmi(struct hda_codec *codec)
 		if (spec->silent_stream_type) {
 			spec->silent_stream_type = SILENT_STREAM_KAE;
 
-#ifdef CONFIG_PM
 			codec->patch_ops.resume = i915_adlp_hdmi_resume;
 			codec->patch_ops.suspend = i915_adlp_hdmi_suspend;
-#endif
 		}
 	}
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 10/12] ALSA: hda: realtek: Reduce CONFIG_PM dependencies
  2024-05-06 16:13 [PATCH 00/12] ALSA: hda: Reduce CONFIG_PM dependencies Takashi Iwai
                   ` (8 preceding siblings ...)
  2024-05-06 16:13 ` [PATCH 09/12] ALSA: hda: hdmi: " Takashi Iwai
@ 2024-05-06 16:13 ` Takashi Iwai
  2024-05-06 16:13 ` [PATCH 11/12] ALSA: hda: sigmantel: " Takashi Iwai
  2024-05-06 16:13 ` [PATCH 12/12] ALSA: hda: via: " Takashi Iwai
  11 siblings, 0 replies; 16+ messages in thread
From: Takashi Iwai @ 2024-05-06 16:13 UTC (permalink / raw)
  To: linux-sound

CONFIG_PM dependencies got reduced in HD-audio codec core driver, and
now it's time to reduce in HD-audio realtek codec driver, too.

Simply drop CONFIG_PM ifdefs.  A superfluous __maybe_unused attribute
was dropped as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_realtek.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index b29739bd330b..944f36f94a5a 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -109,9 +109,7 @@ struct alc_spec {
 
 	/* hooks */
 	void (*init_hook)(struct hda_codec *codec);
-#ifdef CONFIG_PM
 	void (*power_hook)(struct hda_codec *codec);
-#endif
 	void (*shutup)(struct hda_codec *codec);
 
 	int init_amp;
@@ -947,7 +945,6 @@ static int alc_init(struct hda_codec *codec)
 
 #define alc_free	snd_hda_gen_free
 
-#ifdef CONFIG_PM
 static inline void alc_shutup(struct hda_codec *codec)
 {
 	struct alc_spec *spec = codec->spec;
@@ -986,7 +983,6 @@ static int alc_resume(struct hda_codec *codec)
 	hda_call_check_power_status(codec, 0x01);
 	return 0;
 }
-#endif
 
 /*
  */
@@ -996,11 +992,9 @@ static const struct hda_codec_ops alc_patch_ops = {
 	.init = alc_init,
 	.free = alc_free,
 	.unsol_event = snd_hda_jack_unsol_event,
-#ifdef CONFIG_PM
 	.resume = alc_resume,
 	.suspend = alc_suspend,
 	.check_power_status = snd_hda_gen_check_power_status,
-#endif
 };
 
 
@@ -4041,7 +4035,6 @@ static void alc5505_dsp_init(struct hda_codec *codec)
 #define alc5505_dsp_resume(codec)	alc5505_dsp_back_from_halt(codec)
 #endif
 
-#ifdef CONFIG_PM
 static int alc269_suspend(struct hda_codec *codec)
 {
 	struct alc_spec *spec = codec->spec;
@@ -4087,7 +4080,6 @@ static int alc269_resume(struct hda_codec *codec)
 
 	return 0;
 }
-#endif /* CONFIG_PM */
 
 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
 						 const struct hda_fixup *fix, int action)
@@ -7204,7 +7196,7 @@ static void alc287_alc1318_playback_pcm_hook(struct hda_pcm_stream *hinfo,
 	}
 }
 
-static void __maybe_unused alc287_s4_power_gpio3_default(struct hda_codec *codec)
+static void alc287_s4_power_gpio3_default(struct hda_codec *codec)
 {
 	if (is_s4_suspend(codec)) {
 		alc_write_coef_idx(codec, 0x10, 0x8806); /* Change MLK to GPIO3 */
@@ -7219,9 +7211,7 @@ static void alc287_fixup_lenovo_thinkpad_with_alc1318(struct hda_codec *codec,
 
 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
 		return;
-#ifdef CONFIG_PM
 	spec->power_hook = alc287_s4_power_gpio3_default;
-#endif
 	spec->gen.pcm_playback_hook = alc287_alc1318_playback_pcm_hook;
 }
 
@@ -11287,10 +11277,8 @@ static int patch_alc269(struct hda_codec *codec)
 	codec->power_save_node = 0;
 	spec->en_3kpull_low = true;
 
-#ifdef CONFIG_PM
 	codec->patch_ops.suspend = alc269_suspend;
 	codec->patch_ops.resume = alc269_resume;
-#endif
 	spec->shutup = alc_default_shutup;
 	spec->init_hook = alc_default_init;
 
@@ -11588,9 +11576,7 @@ static int patch_alc861(struct hda_codec *codec)
 	if (has_cdefine_beep(codec))
 		spec->gen.beep_nid = 0x23;
 
-#ifdef CONFIG_PM
 	spec->power_hook = alc_power_eapd;
-#endif
 
 	alc_pre_init(codec);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 11/12] ALSA: hda: sigmantel: Reduce CONFIG_PM dependencies
  2024-05-06 16:13 [PATCH 00/12] ALSA: hda: Reduce CONFIG_PM dependencies Takashi Iwai
                   ` (9 preceding siblings ...)
  2024-05-06 16:13 ` [PATCH 10/12] ALSA: hda: realtek: " Takashi Iwai
@ 2024-05-06 16:13 ` Takashi Iwai
  2024-05-06 16:13 ` [PATCH 12/12] ALSA: hda: via: " Takashi Iwai
  11 siblings, 0 replies; 16+ messages in thread
From: Takashi Iwai @ 2024-05-06 16:13 UTC (permalink / raw)
  To: linux-sound

CONFIG_PM dependencies got reduced in HD-audio codec core driver, and
now it's time to reduce in HD-audio sigmatel codec driver, too.

Simply drop CONFIG_PM ifdefs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_sigmatel.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 61258b0aac8d..ae1a34c68c61 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -2154,10 +2154,8 @@ static void stac92hd83xxx_fixup_hp_mic_led(struct hda_codec *codec,
 
 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
 		spec->mic_mute_led_gpio = 0x08; /* GPIO3 */
-#ifdef CONFIG_PM
 		/* resetting controller clears GPIO, so we need to keep on */
 		codec->core.power_caps &= ~AC_PWRST_CLKSTOP;
-#endif
 	}
 }
 
@@ -4442,7 +4440,6 @@ static void stac927x_proc_hook(struct snd_info_buffer *buffer,
 #define stac927x_proc_hook	NULL
 #endif
 
-#ifdef CONFIG_PM
 static int stac_suspend(struct hda_codec *codec)
 {
 	struct sigmatel_spec *spec = codec->spec;
@@ -4456,9 +4453,6 @@ static int stac_suspend(struct hda_codec *codec)
 
 	return 0;
 }
-#else
-#define stac_suspend		NULL
-#endif /* CONFIG_PM */
 
 static const struct hda_codec_ops stac_patch_ops = {
 	.build_controls = snd_hda_gen_build_controls,
@@ -4466,9 +4460,7 @@ static const struct hda_codec_ops stac_patch_ops = {
 	.init = stac_init,
 	.free = stac_free,
 	.unsol_event = snd_hda_jack_unsol_event,
-#ifdef CONFIG_PM
 	.suspend = stac_suspend,
-#endif
 };
 
 static int alloc_stac_spec(struct hda_codec *codec)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 12/12] ALSA: hda: via: Reduce CONFIG_PM dependencies
  2024-05-06 16:13 [PATCH 00/12] ALSA: hda: Reduce CONFIG_PM dependencies Takashi Iwai
                   ` (10 preceding siblings ...)
  2024-05-06 16:13 ` [PATCH 11/12] ALSA: hda: sigmantel: " Takashi Iwai
@ 2024-05-06 16:13 ` Takashi Iwai
  11 siblings, 0 replies; 16+ messages in thread
From: Takashi Iwai @ 2024-05-06 16:13 UTC (permalink / raw)
  To: linux-sound

CONFIG_PM dependencies got reduced in HD-audio codec core driver, and
now it's time to reduce in HD-audio via codec driver, too.

Simply drop CONFIG_PM ifdefs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_via.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 2994f85bc1b9..a8ef4bb70dd0 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -379,7 +379,6 @@ static void via_free(struct hda_codec *codec)
 	snd_hda_gen_free(codec);
 }
 
-#ifdef CONFIG_PM
 static int via_suspend(struct hda_codec *codec)
 {
 	struct via_spec *spec = codec->spec;
@@ -400,9 +399,7 @@ static int via_resume(struct hda_codec *codec)
 	snd_hda_regmap_sync(codec);
 	return 0;
 }
-#endif
 
-#ifdef CONFIG_PM
 static int via_check_power_status(struct hda_codec *codec, hda_nid_t nid)
 {
 	struct via_spec *spec = codec->spec;
@@ -410,7 +407,6 @@ static int via_check_power_status(struct hda_codec *codec, hda_nid_t nid)
 	vt1708_update_hp_work(codec);
 	return snd_hda_check_amp_list_power(codec, &spec->gen.loopback, nid);
 }
-#endif
 
 /*
  */
@@ -423,11 +419,9 @@ static const struct hda_codec_ops via_patch_ops = {
 	.init = via_init,
 	.free = via_free,
 	.unsol_event = snd_hda_jack_unsol_event,
-#ifdef CONFIG_PM
 	.suspend = via_suspend,
 	.resume = via_resume,
 	.check_power_status = via_check_power_status,
-#endif
 };
 
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 01/12] ALSA: hda: intel: Reduce CONFIG_PM dependencies
  2024-05-06 16:13 ` [PATCH 01/12] ALSA: hda: intel: " Takashi Iwai
@ 2024-05-08 17:45   ` Andy Shevchenko
  2024-05-09  7:05     ` Takashi Iwai
  0 siblings, 1 reply; 16+ messages in thread
From: Andy Shevchenko @ 2024-05-08 17:45 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: linux-sound

On Mon, May 06, 2024 at 06:13:44PM +0200, Takashi Iwai wrote:
> snd-hda-intel contains lots of CONFIG_PM dependent code although
> CONFIG_PM is almost mandatory nowadays, and it makes the code
> unnecessarily complex.
> 
> Let's reduce the dependencies of CONFIG_PM in snd-hda-intel driver
> code.  I left a few module options to be dependent on CONFIG_PM (which
> are visible to users), but other places are either enabled or
> optimized by compiler automatically.

...

> +static int __maybe_unused azx_resume(struct device *dev)

__maybe)unused is discouraged nowadays.
We have new PM macros (w/o SET_ prefix) along with pm_ptr() / pm_sleep_ptr()
macros. They are preferred. In complicated cases the PTR_IF() can be used
directly.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 01/12] ALSA: hda: intel: Reduce CONFIG_PM dependencies
  2024-05-08 17:45   ` Andy Shevchenko
@ 2024-05-09  7:05     ` Takashi Iwai
  2024-05-10 14:30       ` Andy Shevchenko
  0 siblings, 1 reply; 16+ messages in thread
From: Takashi Iwai @ 2024-05-09  7:05 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Takashi Iwai, linux-sound

On Wed, 08 May 2024 19:45:42 +0200,
Andy Shevchenko wrote:
> 
> On Mon, May 06, 2024 at 06:13:44PM +0200, Takashi Iwai wrote:
> > snd-hda-intel contains lots of CONFIG_PM dependent code although
> > CONFIG_PM is almost mandatory nowadays, and it makes the code
> > unnecessarily complex.
> > 
> > Let's reduce the dependencies of CONFIG_PM in snd-hda-intel driver
> > code.  I left a few module options to be dependent on CONFIG_PM (which
> > are visible to users), but other places are either enabled or
> > optimized by compiler automatically.
> 
> ...
> 
> > +static int __maybe_unused azx_resume(struct device *dev)
> 
> __maybe)unused is discouraged nowadays.
> We have new PM macros (w/o SET_ prefix) along with pm_ptr() / pm_sleep_ptr()
> macros. They are preferred. In complicated cases the PTR_IF() can be used
> directly.

Yeah, it was a dilemma there.  There seems no standard macro to use
pm_ptr() for runtime_suspend (there is only RUNTIME_PM_OPS()), so for
avoiding __maybe_unused, I'd have to expand them manually instead.


Takashi

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 01/12] ALSA: hda: intel: Reduce CONFIG_PM dependencies
  2024-05-09  7:05     ` Takashi Iwai
@ 2024-05-10 14:30       ` Andy Shevchenko
  0 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2024-05-10 14:30 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: linux-sound

On Thu, May 09, 2024 at 09:05:58AM +0200, Takashi Iwai wrote:
> On Wed, 08 May 2024 19:45:42 +0200,
> Andy Shevchenko wrote:
> > On Mon, May 06, 2024 at 06:13:44PM +0200, Takashi Iwai wrote:

> > > snd-hda-intel contains lots of CONFIG_PM dependent code although
> > > CONFIG_PM is almost mandatory nowadays, and it makes the code
> > > unnecessarily complex.
> > > 
> > > Let's reduce the dependencies of CONFIG_PM in snd-hda-intel driver
> > > code.  I left a few module options to be dependent on CONFIG_PM (which
> > > are visible to users), but other places are either enabled or
> > > optimized by compiler automatically.

...

> > > +static int __maybe_unused azx_resume(struct device *dev)
> > 
> > __maybe)unused is discouraged nowadays.
> > We have new PM macros (w/o SET_ prefix) along with pm_ptr() / pm_sleep_ptr()
> > macros. They are preferred. In complicated cases the PTR_IF() can be used
> > directly.
> 
> Yeah, it was a dilemma there.  There seems no standard macro to use
> pm_ptr() for runtime_suspend (there is only RUNTIME_PM_OPS()), so for
> avoiding __maybe_unused, I'd have to expand them manually instead.

I'm not sure I got the use case. If we have runtime PM, we use pm_ptr(),
otherwise pm_sleep_ptr().

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2024-05-10 14:30 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-06 16:13 [PATCH 00/12] ALSA: hda: Reduce CONFIG_PM dependencies Takashi Iwai
2024-05-06 16:13 ` [PATCH 01/12] ALSA: hda: intel: " Takashi Iwai
2024-05-08 17:45   ` Andy Shevchenko
2024-05-09  7:05     ` Takashi Iwai
2024-05-10 14:30       ` Andy Shevchenko
2024-05-06 16:13 ` [PATCH 02/12] ALSA: hda: codec: " Takashi Iwai
2024-05-06 16:13 ` [PATCH 03/12] ALSA: hda: generic: " Takashi Iwai
2024-05-06 16:13 ` [PATCH 04/12] ALSA: hda: analog: " Takashi Iwai
2024-05-06 16:13 ` [PATCH 05/12] ALSA: hda: ca0132: " Takashi Iwai
2024-05-06 16:13 ` [PATCH 06/12] ALSA: hda: cirrus: " Takashi Iwai
2024-05-06 16:13 ` [PATCH 07/12] ALSA: hda: conexant: " Takashi Iwai
2024-05-06 16:13 ` [PATCH 08/12] ALSA: hda: cs4809: " Takashi Iwai
2024-05-06 16:13 ` [PATCH 09/12] ALSA: hda: hdmi: " Takashi Iwai
2024-05-06 16:13 ` [PATCH 10/12] ALSA: hda: realtek: " Takashi Iwai
2024-05-06 16:13 ` [PATCH 11/12] ALSA: hda: sigmantel: " Takashi Iwai
2024-05-06 16:13 ` [PATCH 12/12] ALSA: hda: via: " Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox