Skip to contentSkip to conversation

Power-well API implementation for Haswell

PATCH In review Wang Xingchao 7 participants 41 messages May 30, 2013 – Jul 25, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v7 cover Power-well API implementation for Haswell

Hi all,

This is V7 and here're some changes notes:
change from V6-->V7:
- rename variable
- use HAS_POWER_WELL instead of IS_HASWELL
- put structure inside drm_i915_private
- use WARN_ON for global pointer check

change from V5-->V6:
- Remove duplication code in new introduced probe work
- move duplication code in azx_probe_continue
- remove unused #ifdef
- replace request_module with symbol_request
- replace spin_lock_irq with spin_lock_irqsave in gfx side
- other typo fixes
(review by Takashi)

change from V4-->V5:
- fix reference count bug
- new patch on general runtime pm support for audio pci device
- new patch to avoid request_module() deadlock

change between V3-->V4:
- add new structure i915_power_well
- initialize drm_device pointer at module init time
- change function name

change between V2-->V3:
- make SND_HDA_I915 selectable
- use snd_printdd to output message
- add return error code check
- use symbol_request to replace symbol_get
- release power_well at azx_free
- some typo fixes

changes between V1-->V2:
- use reference count to track power-well usage
- remove external module, compiled into snd-hda-intel instead
- manage symbols and module loading properly
- remove IS_HSW macro, use flag instead
- remove audio callback for gfx driver to avoid dependency
- split whole patch into two pieces for easy review
- more typo fixes

Takashi Iwai (1):
ALSA: hda - Move azx_first_init() into azx_probe_continue()

Wang Xingchao (3):
ALSA: hda - Fix runtime PM check
ALSA: hda - Add power-welll support for haswell HDA i915/drm: Add private api for power well usage

 drivers/gpu/drm/i915/i915_dma.c  |    6 +++
 drivers/gpu/drm/i915/i915_drv.h  |   12 ++++++
 drivers/gpu/drm/i915/intel_drv.h |    4 ++
 drivers/gpu/drm/i915/intel_pm.c  |   81 ++++++++++++++++++++++++++++++++---
 include/drm/i915_powerwell.h     |   36 ++++++++++++++++
 sound/pci/hda/Kconfig            |   10 +++++
 sound/pci/hda/Makefile           |    2 +
 sound/pci/hda/hda_i915.c         |   75 ++++++++++++++++++++++++++++++++
 sound/pci/hda/hda_i915.h         |   35 +++++++++++++++
 sound/pci/hda/hda_intel.c        |   87 ++++++++++++++++++++++++++++++--------
 10 files changed, 324 insertions(+), 24 deletions(-)
 create mode 100644 include/drm/i915_powerwell.h
 create mode 100644 sound/pci/hda/hda_i915.c
 create mode 100644 sound/pci/hda/hda_i915.h
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v7 1/4 ALSA: hda - Fix runtime PM check

The device can support runtime PM no matter whether it support signal wakeup or not. For some chips like Haswell which doesnot support PME by default, this patch let haswell Display HD-A controller enter runtime suspend, and bring more power saving whith power-well feature enabled.

---
 sound/pci/hda/hda_intel.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
sound/pci/hda/hda_intel.c +8 -6
index 418bfc0..cf3d36c 100644
@@ -3091,8 +3091,13 @@ static int register_vga_switcheroo(struct azx *chip)
  */
 static int azx_free(struct azx *chip)
 {
+	struct pci_dev *pci = chip->pci;
 	int i;
 
+	if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME)
+			&& chip->running)
+		pm_runtime_get_noresume(&pci->dev);
+
 	azx_del_card_list(chip);
 
 	azx_notifier_unregister(chip);
@@ -3726,9 +3731,6 @@ static int azx_probe(struct pci_dev *pci,
 			goto out_free;
 	}
 
-	if (pci_dev_run_wake(pci))
-		pm_runtime_put_noidle(&pci->dev);
-
 	dev++;
 	complete_all(&chip->probe_wait);
 	return 0;
@@ -3741,6 +3743,7 @@ out_free:
 
 static int azx_probe_continue(struct azx *chip)
 {
+	struct pci_dev *pci = chip->pci;
 	int dev = chip->dev_index;
 	int err;
 
@@ -3788,6 +3791,8 @@ static int azx_probe_continue(struct azx *chip)
 	power_down_all_codecs(chip);
 	azx_notifier_register(chip);
 	azx_add_card_list(chip);
+	if (chip->driver_caps & AZX_DCAPS_PM_RUNTIME)
+		pm_runtime_put_noidle(&pci->dev);
 
 	return 0;
 
@@ -3800,9 +3805,6 @@ static void azx_remove(struct pci_dev *pci)
 {
 	struct snd_card *card = pci_get_drvdata(pci);
 
-	if (pci_dev_run_wake(pci))
-		pm_runtime_get_noresume(&pci->dev);
-
 	if (card)
 		snd_card_free(card);
 	pci_set_drvdata(pci, NULL);
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v7 2/4 ALSA: hda - Move azx_first_init() into azx_probe_continue()

In reply to Wang Xingchao

From: Takashi Iwai <[email protected]>

This is a preliminary work for the upcoming Haswell HDMI audio fixes.

azx_first_init() function can be safely called after the f/w loader, since the f/w loader doesn't require the sound hardware initialization beforehand. Moving it into azx_probe_continue() cleans up the code flow a bit.

---
 sound/pci/hda/hda_intel.c |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
sound/pci/hda/hda_intel.c +5 -8
index cf3d36c..49cc942 100644
@@ -2977,7 +2977,6 @@ static void azx_notifier_unregister(struct azx *chip)
 		unregister_reboot_notifier(&chip->reboot_notifier);
 }
 
-static int azx_first_init(struct azx *chip);
 static int azx_probe_continue(struct azx *chip);
 
 #ifdef SUPPORT_VGA_SWITCHEROO
@@ -3004,8 +3003,7 @@ static void azx_vs_set_state(struct pci_dev *pci,
 			snd_printk(KERN_INFO SFX
 				   "%s: Start delayed initialization\n",
 				   pci_name(chip->pci));
-			if (azx_first_init(chip) < 0 ||
-			    azx_probe_continue(chip) < 0) {
+			if (azx_probe_continue(chip) < 0) {
 				snd_printk(KERN_ERR SFX
 					   "%s: initialization error\n",
 					   pci_name(chip->pci));
@@ -3706,11 +3704,6 @@ static int azx_probe(struct pci_dev *pci,
 	}
 
 	probe_now = !chip->disabled;
-	if (probe_now) {
-		err = azx_first_init(chip);
-		if (err < 0)
-			goto out_free;
-	}
 
 #ifdef CONFIG_SND_HDA_PATCH_LOADER
 	if (patch[dev] && *patch[dev]) {
@@ -3747,6 +3740,10 @@ static int azx_probe_continue(struct azx *chip)
 	int dev = chip->dev_index;
 	int err;
 
+	err = azx_first_init(chip);
+	if (err < 0)
+		goto out_free;
+
 #ifdef CONFIG_SND_HDA_INPUT_BEEP
 	chip->beep_mode = beep_mode[dev];
 #endif
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH v7 3/4 ALSA: hda - Add power-welll support for haswell HDA

In reply to Wang Xingchao

For Intel Haswell chip, HDA controller and codec have power well dependency from GPU side. This patch added support to request/release power well in audio driver. Power save feature should be enabled to get runtime power saving.

There's deadlock when request_module(i915) in azx_probe.
It looks like:
device_lock(audio pci device) -> azx_probe -> module_request (or symbol_request) -> modprobe (userspace) -> i915 init -> drm_pci_init -> pci_register_driver -> bus_add_driver -> driver_attach -> which in turn tries all locks on pci bus, and when it tries the one on the audio device, it will deadlock.

This patch introduce a work to store remaining probe stuff, and let request_module run in safe work context.

---
 sound/pci/hda/Kconfig     |   10 ++++++
 sound/pci/hda/Makefile    |    2 ++
 sound/pci/hda/hda_i915.c  |   75 +++++++++++++++++++++++++++++++++++++++++++++
 sound/pci/hda/hda_i915.h  |   35 +++++++++++++++++++++
 sound/pci/hda/hda_intel.c |   60 ++++++++++++++++++++++++++++++++++--
 5 files changed, 179 insertions(+), 3 deletions(-)
 create mode 100644 sound/pci/hda/hda_i915.c
 create mode 100644 sound/pci/hda/hda_i915.h
sound/pci/hda/Kconfig +10 -0
index 80a7d44..c5a872c 100644
@@ -152,6 +152,16 @@ config SND_HDA_CODEC_HDMI
 	  snd-hda-codec-hdmi.
 	  This module is automatically loaded at probing.
 
+config SND_HDA_I915
+	bool "Build Display HD-audio controller/codec power well support for i915 cards"
+	depends on DRM_I915
+	help
+	  Say Y here to include full HDMI and DisplayPort HD-audio controller/codec
+	  power-well support for Intel Haswell graphics cards based on the i915 driver.
+
+	  Note that this option must be enabled for Intel Haswell C+ stepping machines, otherwise
+	  the GPU audio controller/codecs will not be initialized or damaged when exit from S3 mode.
+
 config SND_HDA_CODEC_CIRRUS
 	bool "Build Cirrus Logic codec support"
 	default y
sound/pci/hda/Makefile +2 -0
index 24a2514..c091438 100644
@@ -1,4 +1,6 @@
 snd-hda-intel-objs := hda_intel.o
+# for haswell power well
+snd-hda-intel-$(CONFIG_SND_HDA_I915) +=	hda_i915.o
 
 snd-hda-codec-y := hda_codec.o hda_jack.o hda_auto_parser.o
 snd-hda-codec-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o
sound/pci/hda/hda_i915.c new file +75 -0

75 lines not on this page · raw message

sound/pci/hda/hda_i915.h new file +35 -0
new file mode 100644
index 0000000..5a63da2
@@ -0,0 +1,35 @@
+/*
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License as published by the Free
+ *  Software Foundation; either version 2 of the License, or (at your option)
+ *  any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but WITHOUT
+ *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ *  more details.
+ *
+ *  You should have received a copy of the GNU General Public License along with
+ *  this program; if not, write to the Free Software Foundation, Inc., 59
+ *  Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+#ifndef __SOUND_HDA_I915_H
+#define __SOUND_HDA_I915_H
+
+#ifdef CONFIG_SND_HDA_I915
+void hda_display_power(bool enable);
+int hda_i915_init(void);
+int hda_i915_exit(void);
+#else
+static inline void hda_display_power(bool enable) {}
+static inline int hda_i915_init(void)
+{
+	return -ENODEV;
+}
+static inline int hda_i915_exit(void)
+{
+	return 0;
+}
+#endif
+
+#endif
sound/pci/hda/hda_intel.c +57 -3

141 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#4 lore raw

PATCH v7 4/4 i915/drm: Add private api for power well usage

In reply to Wang Xingchao

Haswell Display audio depends on power well in graphic side, it should request power well before use it and release power well after use. I915 will not shutdown power well if it detects audio is using. This patch protects display audio crash for Intel Haswell C3 stepping board.

---
 drivers/gpu/drm/i915/i915_dma.c  |    6 +++
 drivers/gpu/drm/i915/i915_drv.h  |   12 ++++++
 drivers/gpu/drm/i915/intel_drv.h |    4 ++
 drivers/gpu/drm/i915/intel_pm.c  |   81 ++++++++++++++++++++++++++++++++++----
 include/drm/i915_powerwell.h     |   36 +++++++++++++++++
 5 files changed, 132 insertions(+), 7 deletions(-)
 create mode 100644 include/drm/i915_powerwell.h
drivers/gpu/drm/i915/i915_dma.c +6 -0
index f5addac..d709776 100644
@@ -1652,6 +1652,9 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 	/* Start out suspended */
 	dev_priv->mm.suspended = 1;
 
+	if (HAS_POWER_WELL(dev))
+		i915_init_power_well(dev);
+
 	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
 		ret = i915_load_modeset_init(dev);
 		if (ret < 0) {
@@ -1708,6 +1711,9 @@ int i915_driver_unload(struct drm_device *dev)
 
 	intel_gpu_ips_teardown();
 
+	if (HAS_POWER_WELL(dev))
+		i915_remove_power_well(dev);
+
 	i915_teardown_sysfs(dev);
 
 	if (dev_priv->mm.inactive_shrinker.shrink)
drivers/gpu/drm/i915/i915_drv.h +12 -0
index 14817de..bd53a6a 100644
@@ -720,6 +720,15 @@ struct intel_ilk_power_mgmt {
 	struct drm_i915_gem_object *renderctx;
 };
 
+/* Power well structure for haswell */
+struct i915_power_well {
+	struct drm_device *device;
+	spinlock_t lock;
+	/* power well enable/disable usage count */
+	int count;
+	int i915_request;
+};
+
 struct i915_dri1_state {
 	unsigned allow_batchbuffer : 1;
 	u32 __iomem *gfx_hws_cpu_addr;
@@ -1073,6 +1082,9 @@ typedef struct drm_i915_private {
 	 * mchdev_lock in intel_pm.c */
 	struct intel_ilk_power_mgmt ips;
 
+	/* Haswell power well */
+	struct i915_power_well power_well;
+
 	enum no_fbc_reason no_fbc_reason;
 
 	struct drm_mm_node *compressed_fb;
drivers/gpu/drm/i915/intel_drv.h +4 -0
index 0f35545..8b5017d 100644
@@ -754,6 +754,10 @@ extern void intel_update_fbc(struct drm_device *dev);
 extern void intel_gpu_ips_init(struct drm_i915_private *dev_priv);
 extern void intel_gpu_ips_teardown(void);
 
+/* Power well */
+extern int i915_init_power_well(struct drm_device *dev);
+extern void i915_remove_power_well(struct drm_device *dev);
+
 extern bool intel_display_power_enabled(struct drm_device *dev,
 					enum intel_display_power_domain domain);
 extern void intel_init_power_well(struct drm_device *dev);
drivers/gpu/drm/i915/intel_pm.c +74 -7

98 lines not on this page · raw message

include/drm/i915_powerwell.h new file +36 -0
new file mode 100644
index 0000000..cfdc884
@@ -0,0 +1,36 @@
+/**************************************************************************
+ *
+ * Copyright 2013 Intel Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ **************************************************************************/
+
+#ifndef _I915_POWERWELL_H_
+#define _I915_POWERWELL_H_
+
+/* For use by hda_i915 driver */
+extern void i915_request_power_well(void);
+extern void i915_release_power_well(void);
+
+#endif				/* _I915_POWERWELL_H_ */
Signature · 1 line
1.7.9.5
#5 lore raw
In reply to Wang Xingchao
Quoted 46 lines · Wang Xingchao

Hi all,

This is V7 and here're some changes notes:
change from V6-->V7:
- rename variable
- use HAS_POWER_WELL instead of IS_HASWELL
- put structure inside drm_i915_private
- use WARN_ON for global pointer check

change from V5-->V6:
- Remove duplication code in new introduced probe work
- move duplication code in azx_probe_continue
- remove unused #ifdef
- replace request_module with symbol_request
- replace spin_lock_irq with spin_lock_irqsave in gfx side
- other typo fixes
(review by Takashi)

change from V4-->V5:
- fix reference count bug
- new patch on general runtime pm support for audio pci device
- new patch to avoid request_module() deadlock

change between V3-->V4:
- add new structure i915_power_well
- initialize drm_device pointer at module init time
- change function name

change between V2-->V3:
- make SND_HDA_I915 selectable
- use snd_printdd to output message
- add return error code check
- use symbol_request to replace symbol_get
- release power_well at azx_free
- some typo fixes

changes between V1-->V2:
- use reference count to track power-well usage
- remove external module, compiled into snd-hda-intel instead
- manage symbols and module loading properly
- remove IS_HSW macro, use flag instead
- remove audio callback for gfx driver to avoid dependency
- split whole patch into two pieces for easy review
- more typo fixes

Quoted 7 lines

Takashi Iwai (1):
ALSA: hda - Move azx_first_init() into azx_probe_continue()

Wang Xingchao (3):
ALSA: hda - Fix runtime PM check
ALSA: hda - Add power-welll support for haswell HDA i915/drm: Add private api for power well usage

After discussion with Dave and Takashi I've merged the entire series to drm-intel-next. I'll show up in the next linux-next and I'll forward it to Dave for mergin into drm-next in roughly 2 weeks.

Thanks, Daniel

Quoted 19 lines
 drivers/gpu/drm/i915/i915_dma.c  |    6 +++
 drivers/gpu/drm/i915/i915_drv.h  |   12 ++++++
 drivers/gpu/drm/i915/intel_drv.h |    4 ++
 drivers/gpu/drm/i915/intel_pm.c  |   81 ++++++++++++++++++++++++++++++++---
 include/drm/i915_powerwell.h     |   36 ++++++++++++++++
 sound/pci/hda/Kconfig            |   10 +++++
 sound/pci/hda/Makefile           |    2 +
 sound/pci/hda/hda_i915.c         |   75 ++++++++++++++++++++++++++++++++
 sound/pci/hda/hda_i915.h         |   35 +++++++++++++++
 sound/pci/hda/hda_intel.c        |   87 ++++++++++++++++++++++++++++++--------
 10 files changed, 324 insertions(+), 24 deletions(-)
 create mode 100644 include/drm/i915_powerwell.h
 create mode 100644 sound/pci/hda/hda_i915.c
 create mode 100644 sound/pci/hda/hda_i915.h
Signature · 1 line
1.7.9.5
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#6 lore raw

2013/6/6 Daniel Vetter <[email protected]>:

Quoted 50 lines · Wang Xingchao
Quoted 49 lines

Hi all,

This is V7 and here're some changes notes:
change from V6-->V7:
- rename variable
- use HAS_POWER_WELL instead of IS_HASWELL
- put structure inside drm_i915_private
- use WARN_ON for global pointer check

change from V5-->V6:
- Remove duplication code in new introduced probe work
- move duplication code in azx_probe_continue
- remove unused #ifdef
- replace request_module with symbol_request
- replace spin_lock_irq with spin_lock_irqsave in gfx side
- other typo fixes
(review by Takashi)

change from V4-->V5:
- fix reference count bug
- new patch on general runtime pm support for audio pci device
- new patch to avoid request_module() deadlock

change between V3-->V4:
- add new structure i915_power_well
- initialize drm_device pointer at module init time
- change function name

change between V2-->V3:
- make SND_HDA_I915 selectable
- use snd_printdd to output message
- add return error code check
- use symbol_request to replace symbol_get
- release power_well at azx_free
- some typo fixes

changes between V1-->V2:
- use reference count to track power-well usage
- remove external module, compiled into snd-hda-intel instead
- manage symbols and module loading properly
- remove IS_HSW macro, use flag instead
- remove audio callback for gfx driver to avoid dependency
- split whole patch into two pieces for easy review
- more typo fixes

Takashi Iwai (1):
ALSA: hda - Move azx_first_init() into azx_probe_continue()

Quoted 8 lines
Quoted 4 lines

Wang Xingchao (3):
ALSA: hda - Fix runtime PM check
ALSA: hda - Add power-welll support for haswell HDA i915/drm: Add private api for power well usage

After discussion with Dave and Takashi I've merged the entire series to drm-intel-next. I'll show up in the next linux-next and I'll forward it to Dave for mergin into drm-next in roughly 2 weeks.

So today I unblacklisted the audio modules on one of my Haswell machines and booted it with i915.disable_power_well=1. I only have an eDP output (it doesn't have audio) and I see the power well is enabled. This is wrong, the power well should be disabled since we only have an eDP panel, and we don't support audio on eDP. I checked on dmesg and the audio driver requests the power well but never releases it.

So I decided to do the same test on another Haswell machine, and on that specific machine the audio driver gets the power well and then releases it at azx_runtime_suspend. This machine is also eDP-only

I was expecting that on both cases the audio driver would release the power well as soon as it sees there's no connected output capable of HD audio.

How can I help debugging this?

Thanks,
Paulo

Quoted 31 lines

Thanks, Daniel

Quoted 16 lines
 drivers/gpu/drm/i915/i915_dma.c  |    6 +++
 drivers/gpu/drm/i915/i915_drv.h  |   12 ++++++
 drivers/gpu/drm/i915/intel_drv.h |    4 ++
 drivers/gpu/drm/i915/intel_pm.c  |   81 ++++++++++++++++++++++++++++++++---
 include/drm/i915_powerwell.h     |   36 ++++++++++++++++
 sound/pci/hda/Kconfig            |   10 +++++
 sound/pci/hda/Makefile           |    2 +
 sound/pci/hda/hda_i915.c         |   75 ++++++++++++++++++++++++++++++++
 sound/pci/hda/hda_i915.h         |   35 +++++++++++++++
 sound/pci/hda/hda_intel.c        |   87 ++++++++++++++++++++++++++++++--------
 10 files changed, 324 insertions(+), 24 deletions(-)
 create mode 100644 include/drm/i915_powerwell.h
 create mode 100644 sound/pci/hda/hda_i915.c
 create mode 100644 sound/pci/hda/hda_i915.h
Quoted 3 lines

--
1.7.9.5

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 1 line
Paulo Zanoni
#7 lore raw
Quoted 56 lines · Paulo Zanoni

2013/6/6 Daniel Vetter <[email protected]>:

Quoted 55 lines · Wang Xingchao
Quoted 53 lines

Hi all,

This is V7 and here're some changes notes:
change from V6-->V7:
- rename variable
- use HAS_POWER_WELL instead of IS_HASWELL
- put structure inside drm_i915_private
- use WARN_ON for global pointer check

change from V5-->V6:
- Remove duplication code in new introduced probe work
- move duplication code in azx_probe_continue
- remove unused #ifdef
- replace request_module with symbol_request
- replace spin_lock_irq with spin_lock_irqsave in gfx side
- other typo fixes
(review by Takashi)

change from V4-->V5:
- fix reference count bug
- new patch on general runtime pm support for audio pci device
- new patch to avoid request_module() deadlock

change between V3-->V4:
- add new structure i915_power_well
- initialize drm_device pointer at module init time
- change function name

change between V2-->V3:
- make SND_HDA_I915 selectable
- use snd_printdd to output message
- add return error code check
- use symbol_request to replace symbol_get
- release power_well at azx_free
- some typo fixes

changes between V1-->V2:
- use reference count to track power-well usage
- remove external module, compiled into snd-hda-intel instead
- manage symbols and module loading properly
- remove IS_HSW macro, use flag instead
- remove audio callback for gfx driver to avoid dependency
- split whole patch into two pieces for easy review
- more typo fixes

Takashi Iwai (1):
ALSA: hda - Move azx_first_init() into azx_probe_continue()

Wang Xingchao (3):
ALSA: hda - Fix runtime PM check
ALSA: hda - Add power-welll support for haswell HDA i915/drm: Add private api for power well usage

Quoted 8 lines
Quoted 3 lines

After discussion with Dave and Takashi I've merged the entire series to drm-intel-next. I'll show up in the next linux-next and I'll forward it to Dave for mergin into drm-next in roughly 2 weeks.

So today I unblacklisted the audio modules on one of my Haswell machines and booted it with i915.disable_power_well=1. I only have an eDP output (it doesn't have audio) and I see the power well is enabled. This is wrong, the power well should be disabled since we

right, if no application using audio it should be in runtime suspend mode. And maybe your system didnot enable runtime suspend by default, would you tell me the output below?
cat /sys/devices/pci0000:00/0000:00:03.0/power/control

thanks
--xingchao

Quoted 53 lines

only have an eDP panel, and we don't support audio on eDP. I checked on dmesg and the audio driver requests the power well but never releases it.

So I decided to do the same test on another Haswell machine, and on that specific machine the audio driver gets the power well and then releases it at azx_runtime_suspend. This machine is also eDP-only

I was expecting that on both cases the audio driver would release the power well as soon as it sees there's no connected output capable of HD audio.

How can I help debugging this?

Thanks,
Paulo

Quoted 31 lines

Thanks, Daniel

Quoted 16 lines
 drivers/gpu/drm/i915/i915_dma.c  |    6 +++
 drivers/gpu/drm/i915/i915_drv.h  |   12 ++++++
 drivers/gpu/drm/i915/intel_drv.h |    4 ++
 drivers/gpu/drm/i915/intel_pm.c  |   81 ++++++++++++++++++++++++++++++++---
 include/drm/i915_powerwell.h     |   36 ++++++++++++++++
 sound/pci/hda/Kconfig            |   10 +++++
 sound/pci/hda/Makefile           |    2 +
 sound/pci/hda/hda_i915.c         |   75 ++++++++++++++++++++++++++++++++
 sound/pci/hda/hda_i915.h         |   35 +++++++++++++++
 sound/pci/hda/hda_intel.c        |   87 ++++++++++++++++++++++++++++++--------
 10 files changed, 324 insertions(+), 24 deletions(-)
 create mode 100644 include/drm/i915_powerwell.h
 create mode 100644 sound/pci/hda/hda_i915.c
 create mode 100644 sound/pci/hda/hda_i915.h
Quoted 3 lines

--
1.7.9.5

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 1 line
Paulo Zanoni
#8 lore raw

2013/7/4 Wang xingchao <[email protected]>:

Quoted 66 lines · Paulo Zanoni
Quoted 56 lines

2013/6/6 Daniel Vetter <[email protected]>:

Quoted 55 lines · Wang Xingchao
Quoted 53 lines

Hi all,

This is V7 and here're some changes notes:
change from V6-->V7:
- rename variable
- use HAS_POWER_WELL instead of IS_HASWELL
- put structure inside drm_i915_private
- use WARN_ON for global pointer check

change from V5-->V6:
- Remove duplication code in new introduced probe work
- move duplication code in azx_probe_continue
- remove unused #ifdef
- replace request_module with symbol_request
- replace spin_lock_irq with spin_lock_irqsave in gfx side
- other typo fixes
(review by Takashi)

change from V4-->V5:
- fix reference count bug
- new patch on general runtime pm support for audio pci device
- new patch to avoid request_module() deadlock

change between V3-->V4:
- add new structure i915_power_well
- initialize drm_device pointer at module init time
- change function name

change between V2-->V3:
- make SND_HDA_I915 selectable
- use snd_printdd to output message
- add return error code check
- use symbol_request to replace symbol_get
- release power_well at azx_free
- some typo fixes

changes between V1-->V2:
- use reference count to track power-well usage
- remove external module, compiled into snd-hda-intel instead
- manage symbols and module loading properly
- remove IS_HSW macro, use flag instead
- remove audio callback for gfx driver to avoid dependency
- split whole patch into two pieces for easy review
- more typo fixes

Takashi Iwai (1):
ALSA: hda - Move azx_first_init() into azx_probe_continue()

Wang Xingchao (3):
ALSA: hda - Fix runtime PM check
ALSA: hda - Add power-welll support for haswell HDA i915/drm: Add private api for power well usage

Quoted 8 lines
Quoted 3 lines

After discussion with Dave and Takashi I've merged the entire series to drm-intel-next. I'll show up in the next linux-next and I'll forward it to Dave for mergin into drm-next in roughly 2 weeks.

So today I unblacklisted the audio modules on one of my Haswell machines and booted it with i915.disable_power_well=1. I only have an eDP output (it doesn't have audio) and I see the power well is enabled. This is wrong, the power well should be disabled since we

Quoted 4 lines

right, if no application using audio it should be in runtime suspend mode. And maybe your system didnot enable runtime suspend by default, would you tell me the output below?
cat /sys/devices/pci0000:00/0000:00:03.0/power/control

It says "on".

Quoted 56 lines

thanks
--xingchao

Quoted 53 lines

only have an eDP panel, and we don't support audio on eDP. I checked on dmesg and the audio driver requests the power well but never releases it.

So I decided to do the same test on another Haswell machine, and on that specific machine the audio driver gets the power well and then releases it at azx_runtime_suspend. This machine is also eDP-only

I was expecting that on both cases the audio driver would release the power well as soon as it sees there's no connected output capable of HD audio.

How can I help debugging this?

Thanks,
Paulo

Quoted 23 lines

Thanks, Daniel

Quoted 16 lines
 drivers/gpu/drm/i915/i915_dma.c  |    6 +++
 drivers/gpu/drm/i915/i915_drv.h  |   12 ++++++
 drivers/gpu/drm/i915/intel_drv.h |    4 ++
 drivers/gpu/drm/i915/intel_pm.c  |   81 ++++++++++++++++++++++++++++++++---
 include/drm/i915_powerwell.h     |   36 ++++++++++++++++
 sound/pci/hda/Kconfig            |   10 +++++
 sound/pci/hda/Makefile           |    2 +
 sound/pci/hda/hda_i915.c         |   75 ++++++++++++++++++++++++++++++++
 sound/pci/hda/hda_i915.h         |   35 +++++++++++++++
 sound/pci/hda/hda_intel.c        |   87 ++++++++++++++++++++++++++++++--------
 10 files changed, 324 insertions(+), 24 deletions(-)
 create mode 100644 include/drm/i915_powerwell.h
 create mode 100644 sound/pci/hda/hda_i915.c
 create mode 100644 sound/pci/hda/hda_i915.h
Quoted 3 lines

--
1.7.9.5

Quoted 8 lines

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Paulo Zanoni

Signature · 1 line
Paulo Zanoni
#9 lore raw
Quoted 67 lines · Paulo Zanoni

2013/7/4 Wang xingchao <[email protected]>:

Quoted 66 lines · Paulo Zanoni
Quoted 64 lines

2013/6/6 Daniel Vetter <[email protected]>:

Quoted 50 lines · Wang Xingchao
Quoted 49 lines

Hi all,

This is V7 and here're some changes notes:
change from V6-->V7:
- rename variable
- use HAS_POWER_WELL instead of IS_HASWELL
- put structure inside drm_i915_private
- use WARN_ON for global pointer check

change from V5-->V6:
- Remove duplication code in new introduced probe work
- move duplication code in azx_probe_continue
- remove unused #ifdef
- replace request_module with symbol_request
- replace spin_lock_irq with spin_lock_irqsave in gfx side
- other typo fixes
(review by Takashi)

change from V4-->V5:
- fix reference count bug
- new patch on general runtime pm support for audio pci device
- new patch to avoid request_module() deadlock

change between V3-->V4:
- add new structure i915_power_well
- initialize drm_device pointer at module init time
- change function name

change between V2-->V3:
- make SND_HDA_I915 selectable
- use snd_printdd to output message
- add return error code check
- use symbol_request to replace symbol_get
- release power_well at azx_free
- some typo fixes

changes between V1-->V2:
- use reference count to track power-well usage
- remove external module, compiled into snd-hda-intel instead
- manage symbols and module loading properly
- remove IS_HSW macro, use flag instead
- remove audio callback for gfx driver to avoid dependency
- split whole patch into two pieces for easy review
- more typo fixes

Takashi Iwai (1):
ALSA: hda - Move azx_first_init() into azx_probe_continue()

Quoted 8 lines
Quoted 4 lines

Wang Xingchao (3):
ALSA: hda - Fix runtime PM check
ALSA: hda - Add power-welll support for haswell HDA i915/drm: Add private api for power well usage

After discussion with Dave and Takashi I've merged the entire series to drm-intel-next. I'll show up in the next linux-next and I'll forward it to Dave for mergin into drm-next in roughly 2 weeks.

So today I unblacklisted the audio modules on one of my Haswell machines and booted it with i915.disable_power_well=1. I only have an eDP output (it doesn't have audio) and I see the power well is enabled. This is wrong, the power well should be disabled since we

Quoted 6 lines
Quoted 4 lines

right, if no application using audio it should be in runtime suspend mode. And maybe your system didnot enable runtime suspend by default, would you tell me the output below?
cat /sys/devices/pci0000:00/0000:00:03.0/power/control

It says "on".

would you change it to "auto" and test again.
Runtime power save should be enabled with "auto".

--xingchao

Quoted 63 lines
Quoted 58 lines

thanks
--xingchao

Quoted 53 lines

only have an eDP panel, and we don't support audio on eDP. I checked on dmesg and the audio driver requests the power well but never releases it.

So I decided to do the same test on another Haswell machine, and on that specific machine the audio driver gets the power well and then releases it at azx_runtime_suspend. This machine is also eDP-only

I was expecting that on both cases the audio driver would release the power well as soon as it sees there's no connected output capable of HD audio.

How can I help debugging this?

Thanks,
Paulo

Quoted 23 lines

Thanks, Daniel

Quoted 16 lines
 drivers/gpu/drm/i915/i915_dma.c  |    6 +++
 drivers/gpu/drm/i915/i915_drv.h  |   12 ++++++
 drivers/gpu/drm/i915/intel_drv.h |    4 ++
 drivers/gpu/drm/i915/intel_pm.c  |   81 ++++++++++++++++++++++++++++++++---
 include/drm/i915_powerwell.h     |   36 ++++++++++++++++
 sound/pci/hda/Kconfig            |   10 +++++
 sound/pci/hda/Makefile           |    2 +
 sound/pci/hda/hda_i915.c         |   75 ++++++++++++++++++++++++++++++++
 sound/pci/hda/hda_i915.h         |   35 +++++++++++++++
 sound/pci/hda/hda_intel.c        |   87 ++++++++++++++++++++++++++++++--------
 10 files changed, 324 insertions(+), 24 deletions(-)
 create mode 100644 include/drm/i915_powerwell.h
 create mode 100644 sound/pci/hda/hda_i915.c
 create mode 100644 sound/pci/hda/hda_i915.h
Quoted 3 lines

--
1.7.9.5

Quoted 8 lines

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Paulo Zanoni

Signature · 1 line
Paulo Zanoni
#10 lore raw

2013/7/4 Wang xingchao <[email protected]>:

Quoted 73 lines · Paulo Zanoni
Quoted 72 lines

2013/7/4 Wang xingchao <[email protected]>:

Quoted 70 lines · Paulo Zanoni
Quoted 56 lines

2013/6/6 Daniel Vetter <[email protected]>:

Quoted 55 lines · Wang Xingchao
Quoted 53 lines

Hi all,

This is V7 and here're some changes notes:
change from V6-->V7:
- rename variable
- use HAS_POWER_WELL instead of IS_HASWELL
- put structure inside drm_i915_private
- use WARN_ON for global pointer check

change from V5-->V6:
- Remove duplication code in new introduced probe work
- move duplication code in azx_probe_continue
- remove unused #ifdef
- replace request_module with symbol_request
- replace spin_lock_irq with spin_lock_irqsave in gfx side
- other typo fixes
(review by Takashi)

change from V4-->V5:
- fix reference count bug
- new patch on general runtime pm support for audio pci device
- new patch to avoid request_module() deadlock

change between V3-->V4:
- add new structure i915_power_well
- initialize drm_device pointer at module init time
- change function name

change between V2-->V3:
- make SND_HDA_I915 selectable
- use snd_printdd to output message
- add return error code check
- use symbol_request to replace symbol_get
- release power_well at azx_free
- some typo fixes

changes between V1-->V2:
- use reference count to track power-well usage
- remove external module, compiled into snd-hda-intel instead
- manage symbols and module loading properly
- remove IS_HSW macro, use flag instead
- remove audio callback for gfx driver to avoid dependency
- split whole patch into two pieces for easy review
- more typo fixes

Takashi Iwai (1):
ALSA: hda - Move azx_first_init() into azx_probe_continue()

Wang Xingchao (3):
ALSA: hda - Fix runtime PM check
ALSA: hda - Add power-welll support for haswell HDA i915/drm: Add private api for power well usage

Quoted 8 lines
Quoted 3 lines

After discussion with Dave and Takashi I've merged the entire series to drm-intel-next. I'll show up in the next linux-next and I'll forward it to Dave for mergin into drm-next in roughly 2 weeks.

So today I unblacklisted the audio modules on one of my Haswell machines and booted it with i915.disable_power_well=1. I only have an eDP output (it doesn't have audio) and I see the power well is enabled. This is wrong, the power well should be disabled since we

right, if no application using audio it should be in runtime suspend mode. And maybe your system didnot enable runtime suspend by default, would you tell me the output below?
cat /sys/devices/pci0000:00/0000:00:03.0/power/control

Quoted 4 lines
Quoted 1 line

It says "on".

would you change it to "auto" and test again.
Runtime power save should be enabled with "auto".

Doesn't solve the problem. Should I open a bug report somewhere? Having the power well enabled prevents some power saving features from the graphics driver.

Quoted 65 lines

--xingchao

Quoted 63 lines
Quoted 58 lines

thanks
--xingchao

Quoted 53 lines

only have an eDP panel, and we don't support audio on eDP. I checked on dmesg and the audio driver requests the power well but never releases it.

So I decided to do the same test on another Haswell machine, and on that specific machine the audio driver gets the power well and then releases it at azx_runtime_suspend. This machine is also eDP-only

I was expecting that on both cases the audio driver would release the power well as soon as it sees there's no connected output capable of HD audio.

How can I help debugging this?

Thanks,
Paulo

Quoted 23 lines

Thanks, Daniel

Quoted 16 lines
 drivers/gpu/drm/i915/i915_dma.c  |    6 +++
 drivers/gpu/drm/i915/i915_drv.h  |   12 ++++++
 drivers/gpu/drm/i915/intel_drv.h |    4 ++
 drivers/gpu/drm/i915/intel_pm.c  |   81 ++++++++++++++++++++++++++++++++---
 include/drm/i915_powerwell.h     |   36 ++++++++++++++++
 sound/pci/hda/Kconfig            |   10 +++++
 sound/pci/hda/Makefile           |    2 +
 sound/pci/hda/hda_i915.c         |   75 ++++++++++++++++++++++++++++++++
 sound/pci/hda/hda_i915.h         |   35 +++++++++++++++
 sound/pci/hda/hda_intel.c        |   87 ++++++++++++++++++++++++++++++--------
 10 files changed, 324 insertions(+), 24 deletions(-)
 create mode 100644 include/drm/i915_powerwell.h
 create mode 100644 sound/pci/hda/hda_i915.c
 create mode 100644 sound/pci/hda/hda_i915.h
Quoted 3 lines

--
1.7.9.5

Quoted 8 lines

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Paulo Zanoni

--
Paulo Zanoni

Signature · 1 line
Paulo Zanoni
#11 lore raw

At Fri, 5 Jul 2013 18:19:32 -0300,

Quoted 75 lines · Paulo Zanoni

2013/7/4 Wang xingchao <[email protected]>:

Quoted 73 lines · Paulo Zanoni
Quoted 72 lines

2013/7/4 Wang xingchao <[email protected]>:

Quoted 70 lines · Paulo Zanoni
Quoted 56 lines

2013/6/6 Daniel Vetter <[email protected]>:

Quoted 55 lines · Wang Xingchao
Quoted 53 lines

Hi all,

This is V7 and here're some changes notes:
change from V6-->V7:
- rename variable
- use HAS_POWER_WELL instead of IS_HASWELL
- put structure inside drm_i915_private
- use WARN_ON for global pointer check

change from V5-->V6:
- Remove duplication code in new introduced probe work
- move duplication code in azx_probe_continue
- remove unused #ifdef
- replace request_module with symbol_request
- replace spin_lock_irq with spin_lock_irqsave in gfx side
- other typo fixes
(review by Takashi)

change from V4-->V5:
- fix reference count bug
- new patch on general runtime pm support for audio pci device
- new patch to avoid request_module() deadlock

change between V3-->V4:
- add new structure i915_power_well
- initialize drm_device pointer at module init time
- change function name

change between V2-->V3:
- make SND_HDA_I915 selectable
- use snd_printdd to output message
- add return error code check
- use symbol_request to replace symbol_get
- release power_well at azx_free
- some typo fixes

changes between V1-->V2:
- use reference count to track power-well usage
- remove external module, compiled into snd-hda-intel instead
- manage symbols and module loading properly
- remove IS_HSW macro, use flag instead
- remove audio callback for gfx driver to avoid dependency
- split whole patch into two pieces for easy review
- more typo fixes

Takashi Iwai (1):
ALSA: hda - Move azx_first_init() into azx_probe_continue()

Wang Xingchao (3):
ALSA: hda - Fix runtime PM check
ALSA: hda - Add power-welll support for haswell HDA i915/drm: Add private api for power well usage

Quoted 8 lines
Quoted 3 lines

After discussion with Dave and Takashi I've merged the entire series to drm-intel-next. I'll show up in the next linux-next and I'll forward it to Dave for mergin into drm-next in roughly 2 weeks.

So today I unblacklisted the audio modules on one of my Haswell machines and booted it with i915.disable_power_well=1. I only have an eDP output (it doesn't have audio) and I see the power well is enabled. This is wrong, the power well should be disabled since we

right, if no application using audio it should be in runtime suspend mode. And maybe your system didnot enable runtime suspend by default, would you tell me the output below?
cat /sys/devices/pci0000:00/0000:00:03.0/power/control

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

It says "on".

would you change it to "auto" and test again.
Runtime power save should be enabled with "auto".

Doesn't solve the problem. Should I open a bug report somewhere? Having the power well enabled prevents some power saving features from the graphics driver.

Is the HD-audio power-saving itself working? You can check it via watching /sys/class/hwC*/power_{on|off}_acct files.

power_save option has to be adjusted appropriately. Note that many DEs change this value dynamically per AC-cable plug/unplug depending on the configuration, and often it's set to 0 (= no power save) when AC-cable is plugged.

Takashi

Quoted 73 lines
Quoted 67 lines

--xingchao

Quoted 63 lines
Quoted 58 lines

thanks
--xingchao

Quoted 53 lines

only have an eDP panel, and we don't support audio on eDP. I checked on dmesg and the audio driver requests the power well but never releases it.

So I decided to do the same test on another Haswell machine, and on that specific machine the audio driver gets the power well and then releases it at azx_runtime_suspend. This machine is also eDP-only

I was expecting that on both cases the audio driver would release the power well as soon as it sees there's no connected output capable of HD audio.

How can I help debugging this?

Thanks,
Paulo

Quoted 23 lines

Thanks, Daniel

Quoted 16 lines
 drivers/gpu/drm/i915/i915_dma.c  |    6 +++
 drivers/gpu/drm/i915/i915_drv.h  |   12 ++++++
 drivers/gpu/drm/i915/intel_drv.h |    4 ++
 drivers/gpu/drm/i915/intel_pm.c  |   81 ++++++++++++++++++++++++++++++++---
 include/drm/i915_powerwell.h     |   36 ++++++++++++++++
 sound/pci/hda/Kconfig            |   10 +++++
 sound/pci/hda/Makefile           |    2 +
 sound/pci/hda/hda_i915.c         |   75 ++++++++++++++++++++++++++++++++
 sound/pci/hda/hda_i915.h         |   35 +++++++++++++++
 sound/pci/hda/hda_intel.c        |   87 ++++++++++++++++++++++++++++++--------
 10 files changed, 324 insertions(+), 24 deletions(-)
 create mode 100644 include/drm/i915_powerwell.h
 create mode 100644 sound/pci/hda/hda_i915.c
 create mode 100644 sound/pci/hda/hda_i915.h
Quoted 3 lines

--
1.7.9.5

Quoted 8 lines

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Paulo Zanoni

--
Paulo Zanoni

Signature · 1 line
Paulo Zanoni
#12 lore raw
Quoted 18 lines · Takashi Iwai
Quoted 18 lines
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

drm-intel-next. I'll show up in the next linux-next and I'll forward it to Dave for mergin into drm-next in roughly 2 weeks.

So today I unblacklisted the audio modules on one of my Haswell machines and booted it with i915.disable_power_well=1. I only have an eDP output (it doesn't have audio) and I see the power well is enabled. This is wrong, the power well should be disabled since we

Quoted 6 lines
Quoted 4 lines

right, if no application using audio it should be in runtime suspend mode. And maybe your system didnot enable runtime suspend by default, would you tell me the output below?
cat /sys/devices/pci0000:00/0000:00:03.0/power/control

It says "on".

would you change it to "auto" and test again.
Runtime power save should be enabled with "auto".

Quoted 6 lines
Quoted 3 lines

Doesn't solve the problem. Should I open a bug report somewhere? Having the power well enabled prevents some power saving features from the graphics driver.

Is the HD-audio power-saving itself working? You can check it via watching /sys/class/hwC*/power_{on|off}_acct files.

I have two Haswell boards, one with "auto" power-save setting, the other one has setting "on". Here's the power_on/off_acct values:
1) with control setting "auto"
power_on_acct 14328
power_off_acct 3231848
2) with control setting "on"
power_on_acct 6330528
power_off_acct 0

So for the second one, power is always on.

Paulo, would you check with your BIOS version?
At least i found BIOS 131 has the default setting "on" while BIOS 128 has "auto" setting.

thanks
--xingchao

Quoted 7 lines

power_save option has to be adjusted appropriately. Note that many DEs change this value dynamically per AC-cable plug/unplug depending on the configuration, and often it's set to 0 (= no power save) when AC-cable is plugged.

#13 lore raw

At Sun, 7 Jul 2013 19:59:33 -0400,

Quoted 36 lines · Wang xingchao
Quoted 18 lines · Takashi Iwai
Quoted 18 lines
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

drm-intel-next. I'll show up in the next linux-next and I'll forward it to Dave for mergin into drm-next in roughly 2 weeks.

So today I unblacklisted the audio modules on one of my Haswell machines and booted it with i915.disable_power_well=1. I only have an eDP output (it doesn't have audio) and I see the power well is enabled. This is wrong, the power well should be disabled since we

Quoted 6 lines
Quoted 4 lines

right, if no application using audio it should be in runtime suspend mode. And maybe your system didnot enable runtime suspend by default, would you tell me the output below?
cat /sys/devices/pci0000:00/0000:00:03.0/power/control

It says "on".

would you change it to "auto" and test again.
Runtime power save should be enabled with "auto".

Quoted 6 lines
Quoted 3 lines

Doesn't solve the problem. Should I open a bug report somewhere? Having the power well enabled prevents some power saving features from the graphics driver.

Is the HD-audio power-saving itself working? You can check it via watching /sys/class/hwC*/power_{on|off}_acct files.

I have two Haswell boards, one with "auto" power-save setting, the other one has setting "on". Here's the power_on/off_acct values:
1) with control setting "auto"
power_on_acct 14328
power_off_acct 3231848
2) with control setting "on"
power_on_acct 6330528
power_off_acct 0

Quoted 1 line

So for the second one, power is always on.

Hm, this is the power account per codec, thus its behavior is basically independent from the controller's PM capability. If this doesn't change, it means that the codec power saving isn't activated by some reason. Check whether power_save parameter is set to a positive value.

Takashi

Quoted 15 lines

Paulo, would you check with your BIOS version?
At least i found BIOS 131 has the default setting "on" while BIOS 128 has "auto" setting.

thanks
--xingchao

Quoted 7 lines

power_save option has to be adjusted appropriately. Note that many DEs change this value dynamically per AC-cable plug/unplug depending on the configuration, and often it's set to 0 (= no power save) when AC-cable is plugged.

#14 lore raw
In reply to Takashi Iwai

Hi Takashi/Paulo,

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

would you change it to "auto" and test again.
Runtime power save should be enabled with "auto".

Doesn't solve the problem. Should I open a bug report somewhere? Having the power well enabled prevents some power saving features from the graphics driver.

Quoted 8 lines

Is the HD-audio power-saving itself working? You can check it via watching /sys/class/hwC*/power_{on|off}_acct files.

power_save option has to be adjusted appropriately. Note that many DEs change this value dynamically per AC-cable plug/unplug depending on the configuration, and often it's set to 0 (= no power save) when AC-cable is plugged.

[Wang, Xingchao] Paulo used a new Ultrabook board with charger connected, and see the default parameter "auto=on". In such scenario, power-well is always occupied by Display audio controller. Moreover, in this board, if no external monitors connected, It's using internal eDP and totally no audio support. Power-well usage in such case also blocks some eDP features as Paulo told me.

So I think it's not a good idea to break the rule of power policy when charger connected but it's necessary to add support in this particular case. Takashi, do you think it's acceptable to let Display audio controller/codec suspend in such case?

Thanks
--xingchao

Quoted 1 line
#15 lore raw

At Wed, 17 Jul 2013 02:52:41 +0000,

Quoted 18 lines · Xingchao

Hi Takashi/Paulo,

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

would you change it to "auto" and test again.
Runtime power save should be enabled with "auto".

Doesn't solve the problem. Should I open a bug report somewhere? Having the power well enabled prevents some power saving features from the graphics driver.

Quoted 8 lines

Is the HD-audio power-saving itself working? You can check it via watching /sys/class/hwC*/power_{on|off}_acct files.

power_save option has to be adjusted appropriately. Note that many DEs change this value dynamically per AC-cable plug/unplug depending on the configuration, and often it's set to 0 (= no power save) when AC-cable is plugged.

Quoted 6 lines

[Wang, Xingchao] Paulo used a new Ultrabook board with charger connected, and see the default parameter "auto=on". In such scenario, power-well is always occupied by Display audio controller. Moreover, in this board, if no external monitors connected, It's using internal eDP and totally no audio support. Power-well usage in such case also blocks some eDP features as Paulo told me.

So I think it's not a good idea to break the rule of power policy when charger connected but it's necessary to add support in this particular case. Takashi, do you think it's acceptable to let Display audio controller/codec suspend in such case?

Do you mean the driver enables the powersave forcibly? Then, no, not in general.

If the default parameter of autopm is the problem, this should be changed, instead of forcing the policy in the driver.

OTOH, the audio codec's powersave policy is governed by the power_save option and it's set up dynamically by the desktop system. We shouldn't override it in the driver.

If the power well *must* be off when only an eDP is used (e.g. otherwise the hardware doesn't work properly), then it's a
different story. Is it the case? And what exactly would be the
problem?

If it's the case, controlling the power well based on the runtime PM is likely a bad design, as it relies on the parameter user sets. (And remember that the power-saving of the audio can be disabled
completely via Kconfig, too.)

Takashi

#16 lore raw
Quoted 39 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 3:34 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Wed, 17 Jul 2013 02:52:41 +0000,

Quoted 13 lines · Xingchao

Hi Takashi/Paulo,

Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

would you change it to "auto" and test again.
Runtime power save should be enabled with "auto".

Doesn't solve the problem. Should I open a bug report somewhere? Having the power well enabled prevents some power saving features from the graphics driver.

Is the HD-audio power-saving itself working? You can check it via watching /sys/class/hwC*/power_{on|off}_acct files.

Quoted 6 lines
Quoted 5 lines

power_save option has to be adjusted appropriately. Note that many DEs change this value dynamically per AC-cable plug/unplug depending on the configuration, and often it's set to 0 (= no power save) when AC-cable is plugged.

[Wang, Xingchao] Paulo used a new Ultrabook board with charger connected,

and see the default parameter "auto=on".

Quoted 2 lines

In such scenario, power-well is always occupied by Display audio controller. Moreover, in this board, if no external monitors connected, It's

using internal eDP and totally no audio support. Power-well usage in such case also blocks some eDP features as Paulo told me.

Quoted 1 line
Quoted 6 lines
Quoted 1 line

So I think it's not a good idea to break the rule of power policy when charger

connected but it's necessary to add support in this particular case.

Quoted 1 line

Takashi, do you think it's acceptable to let Display audio controller/codec

suspend in such case?

Do you mean the driver enables the powersave forcibly?

Yes. I mean call pm_runtime_allow() for the power-well HD-A controller.

Quoted 5 lines

Then, no, not in general.

If the default parameter of autopm is the problem, this should be changed, instead of forcing the policy in the driver.

Quoted 8 lines

OTOH, the audio codec's powersave policy is governed by the power_save option and it's set up dynamically by the desktop system. We shouldn't override it in the driver.

If the power well *must* be off when only an eDP is used (e.g. otherwise the hardware doesn't work properly), then it's a
different story. Is it the case? And what exactly would be the
problem?

In the eDP only case, no audio is needed for the HD-A controller, so it's wasting power in current design. I think Paulo or Daniel could explain more details on the impact.

Quoted 6 lines

If it's the case, controlling the power well based on the runtime PM is likely a
bad design, as it relies on the parameter user sets.
(And remember that the power-saving of the audio can be disabled
completely via Kconfig, too.)
From audio controller's point of view, if it's asked be active, it needs power and should request power-well from gfx side.

In above case, audio controller should not be active but user set it be "active".

Thanks
--xingchao

Quoted 3 lines

Takashi

#17 lore raw

At Wed, 17 Jul 2013 08:03:38 +0000,

Quoted 58 lines · Xingchao
Quoted 40 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 3:34 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Wed, 17 Jul 2013 02:52:41 +0000,

Quoted 13 lines · Xingchao

Hi Takashi/Paulo,

Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

would you change it to "auto" and test again.
Runtime power save should be enabled with "auto".

Doesn't solve the problem. Should I open a bug report somewhere? Having the power well enabled prevents some power saving features from the graphics driver.

Is the HD-audio power-saving itself working? You can check it via watching /sys/class/hwC*/power_{on|off}_acct files.

Quoted 6 lines
Quoted 5 lines

power_save option has to be adjusted appropriately. Note that many DEs change this value dynamically per AC-cable plug/unplug depending on the configuration, and often it's set to 0 (= no power save) when AC-cable is plugged.

[Wang, Xingchao] Paulo used a new Ultrabook board with charger connected,

and see the default parameter "auto=on".

Quoted 2 lines

In such scenario, power-well is always occupied by Display audio controller. Moreover, in this board, if no external monitors connected, It's

using internal eDP and totally no audio support. Power-well usage in such case also blocks some eDP features as Paulo told me.

Quoted 1 line
Quoted 6 lines
Quoted 1 line

So I think it's not a good idea to break the rule of power policy when charger

connected but it's necessary to add support in this particular case.

Quoted 1 line

Takashi, do you think it's acceptable to let Display audio controller/codec

suspend in such case?

Do you mean the driver enables the powersave forcibly?

Yes. I mean call pm_runtime_allow() for the power-well HD-A controller.

Quoted 9 lines

Then, no, not in general.

If the default parameter of autopm is the problem, this should be changed, instead of forcing the policy in the driver.

OTOH, the audio codec's powersave policy is governed by the power_save option and it's set up dynamically by the desktop system. We shouldn't override it in the driver.

Quoted 6 lines
Quoted 4 lines

If the power well *must* be off when only an eDP is used (e.g. otherwise the hardware doesn't work properly), then it's a
different story. Is it the case? And what exactly would be the
problem?

In the eDP only case, no audio is needed for the HD-A controller, so it's wasting power in current design. I think Paulo or Daniel could explain more details on the impact.

Consuming more power is the expected behavior. What else?

Quoted 6 lines
Quoted 4 lines

If it's the case, controlling the power well based on the runtime PM is likely a bad design, as it relies on the parameter user sets.
(And remember that the power-saving of the audio can be disabled completely via Kconfig, too.)

From audio controller's point of view, if it's asked be active, it needs power and should request power-well from gfx side. In above case, audio controller should not be active but user set it be "active".

By setting the autopm "on", user expects that no runtime PM happens. In other words, the audio controller must be kept active as long as this parameter is set. And this is the parameter user controls, and not what the driver forcibly sets.

Takashi

#18 lore raw
Quoted 92 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 4:18 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Wed, 17 Jul 2013 08:03:38 +0000,

Quoted 62 lines · Xingchao
Quoted 42 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 3:34 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Wed, 17 Jul 2013 02:52:41 +0000,

Quoted 13 lines · Xingchao

Hi Takashi/Paulo,

Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

would you change it to "auto" and test again.
Runtime power save should be enabled with "auto".

Doesn't solve the problem. Should I open a bug report somewhere? Having the power well enabled prevents some power saving features from the graphics driver.

Is the HD-audio power-saving itself working? You can check it via watching /sys/class/hwC*/power_{on|off}_acct files.

Quoted 7 lines
Quoted 5 lines

power_save option has to be adjusted appropriately. Note that many DEs change this value dynamically per AC-cable plug/unplug depending on the configuration, and often it's set to 0 (= no power save) when AC-cable is plugged.

[Wang, Xingchao] Paulo used a new Ultrabook board with charger connected,

and see the default parameter "auto=on".

Quoted 3 lines

In such scenario, power-well is always occupied by Display audio controller. Moreover, in this board, if no external monitors connected, It's

using internal eDP and totally no audio support. Power-well usage in such case also blocks some eDP features as Paulo told me.

Quoted 1 line
Quoted 8 lines
Quoted 2 lines

So I think it's not a good idea to break the rule of power policy when charger

connected but it's necessary to add support in this particular case.

Quoted 2 lines

Takashi, do you think it's acceptable to let Display audio controller/codec

suspend in such case?

Do you mean the driver enables the powersave forcibly?

Yes. I mean call pm_runtime_allow() for the power-well HD-A controller.

Quoted 9 lines

Then, no, not in general.

If the default parameter of autopm is the problem, this should be changed, instead of forcing the policy in the driver.

OTOH, the audio codec's powersave policy is governed by the power_save option and it's set up dynamically by the desktop system. We shouldn't override it in the driver.

Quoted 5 lines
Quoted 4 lines

If the power well *must* be off when only an eDP is used (e.g. otherwise the hardware doesn't work properly), then it's a
different story. Is it the case? And what exactly would be the
problem?

In the eDP only case, no audio is needed for the HD-A controller, so it's

wasting power in current design.

Quoted 1 line

I think Paulo or Daniel could explain more details on the impact.

Consuming more power is the expected behavior. What else?

Quoted 5 lines
Quoted 4 lines

If it's the case, controlling the power well based on the runtime PM is likely a bad design, as it relies on the parameter user sets. (And remember that the power-saving of the audio can be disabled completely via Kconfig, too.)

From audio controller's point of view, if it's asked be active, it needs power

Quoted 8 lines

and should request power-well from gfx side.

Quoted 1 line

In above case, audio controller should not be active but user set it be

"active".

By setting the autopm "on", user expects that no runtime PM happens. In other words, the audio controller must be kept active as long as this parameter is set. And this is the parameter user controls, and not what the driver forcibly sets.

Okay, become clear now. :)
So I think the conflict for Paulo becomes, in eDP caes, if audio is active and requested power-well, some eDP feature was under impact? Paulo, would you clarify this in more details?

thanks
--xingchao

Quoted 3 lines

Takashi

#19 lore raw

2013/7/17 Wang, Xingchao <[email protected]>:

Quoted 96 lines
Quoted 96 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 4:18 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Wed, 17 Jul 2013 08:03:38 +0000,

Quoted 62 lines · Xingchao
Quoted 42 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 3:34 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Wed, 17 Jul 2013 02:52:41 +0000,

Quoted 13 lines · Xingchao

Hi Takashi/Paulo,

Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

would you change it to "auto" and test again.
Runtime power save should be enabled with "auto".

Doesn't solve the problem. Should I open a bug report somewhere? Having the power well enabled prevents some power saving features from the graphics driver.

Is the HD-audio power-saving itself working? You can check it via watching /sys/class/hwC*/power_{on|off}_acct files.

Quoted 7 lines
Quoted 5 lines

power_save option has to be adjusted appropriately. Note that many DEs change this value dynamically per AC-cable plug/unplug depending on the configuration, and often it's set to 0 (= no power save) when AC-cable is plugged.

[Wang, Xingchao] Paulo used a new Ultrabook board with charger connected,

and see the default parameter "auto=on".

Quoted 3 lines

In such scenario, power-well is always occupied by Display audio controller. Moreover, in this board, if no external monitors connected, It's

using internal eDP and totally no audio support. Power-well usage in such case also blocks some eDP features as Paulo told me.

Quoted 1 line
Quoted 8 lines
Quoted 2 lines

So I think it's not a good idea to break the rule of power policy when charger

connected but it's necessary to add support in this particular case.

Quoted 2 lines

Takashi, do you think it's acceptable to let Display audio controller/codec

suspend in such case?

Do you mean the driver enables the powersave forcibly?

Yes. I mean call pm_runtime_allow() for the power-well HD-A controller.

Quoted 9 lines

Then, no, not in general.

If the default parameter of autopm is the problem, this should be changed, instead of forcing the policy in the driver.

OTOH, the audio codec's powersave policy is governed by the power_save option and it's set up dynamically by the desktop system. We shouldn't override it in the driver.

Quoted 5 lines
Quoted 4 lines

If the power well *must* be off when only an eDP is used (e.g. otherwise the hardware doesn't work properly), then it's a
different story. Is it the case? And what exactly would be the
problem?

In the eDP only case, no audio is needed for the HD-A controller, so it's

wasting power in current design.

Quoted 1 line

I think Paulo or Daniel could explain more details on the impact.

Consuming more power is the expected behavior. What else?

Quoted 5 lines
Quoted 4 lines

If it's the case, controlling the power well based on the runtime PM is likely a bad design, as it relies on the parameter user sets. (And remember that the power-saving of the audio can be disabled completely via Kconfig, too.)

From audio controller's point of view, if it's asked be active, it needs power

and should request power-well from gfx side.

Quoted 1 line

In above case, audio controller should not be active but user set it be

"active".

Quoted 8 lines
Quoted 4 lines

By setting the autopm "on", user expects that no runtime PM happens. In other words, the audio controller must be kept active as long as this parameter is set. And this is the parameter user controls, and not what the driver forcibly sets.

Okay, become clear now. :)
So I think the conflict for Paulo becomes, in eDP caes, if audio is active and requested power-well, some eDP feature was under impact? Paulo, would you clarify this in more details?

On our driver we try to disable the power well whenever possible, as soon as possible. We don't change our behavior based on power AC or other user-space modifiable behavior (except the i915.disable_power_well Kernel option). If the power well is not disabled we can't enable some features, like PSR (panel self refresh, and eDP feature) or PC8, which is another power-saving feature. This will also make our QA procedures a lot more complex since when we want to test specific features (e.g., PSR, PC8) we'll have to disconnect the AC adapter or run scripts. So the behavior/predictability of our driver will be based on the Audio driver power management policies.

I am not so experienced with general Linux Power Management code, so maybe the way the Audio driver is behaving is just the usual way, but I have to admit I was expecting the audio driver would only require the power well when it is actually needed, and release it as soon as possible.

Quoted 6 lines

thanks
--xingchao

Quoted 3 lines

Takashi

Signature · 1 line
Paulo Zanoni
#20 lore raw

At Wed, 17 Jul 2013 10:31:26 -0300,

Quoted 107 lines · Paulo Zanoni

2013/7/17 Wang, Xingchao <[email protected]>:

Quoted 96 lines
Quoted 96 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 4:18 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Wed, 17 Jul 2013 08:03:38 +0000,

Quoted 62 lines · Xingchao
Quoted 42 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 3:34 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Wed, 17 Jul 2013 02:52:41 +0000,

Quoted 13 lines · Xingchao

Hi Takashi/Paulo,

Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

would you change it to "auto" and test again.
Runtime power save should be enabled with "auto".

Doesn't solve the problem. Should I open a bug report somewhere? Having the power well enabled prevents some power saving features from the graphics driver.

Is the HD-audio power-saving itself working? You can check it via watching /sys/class/hwC*/power_{on|off}_acct files.

Quoted 7 lines
Quoted 5 lines

power_save option has to be adjusted appropriately. Note that many DEs change this value dynamically per AC-cable plug/unplug depending on the configuration, and often it's set to 0 (= no power save) when AC-cable is plugged.

[Wang, Xingchao] Paulo used a new Ultrabook board with charger connected,

and see the default parameter "auto=on".

Quoted 3 lines

In such scenario, power-well is always occupied by Display audio controller. Moreover, in this board, if no external monitors connected, It's

using internal eDP and totally no audio support. Power-well usage in such case also blocks some eDP features as Paulo told me.

Quoted 1 line
Quoted 8 lines
Quoted 2 lines

So I think it's not a good idea to break the rule of power policy when charger

connected but it's necessary to add support in this particular case.

Quoted 2 lines

Takashi, do you think it's acceptable to let Display audio controller/codec

suspend in such case?

Do you mean the driver enables the powersave forcibly?

Yes. I mean call pm_runtime_allow() for the power-well HD-A controller.

Quoted 9 lines

Then, no, not in general.

If the default parameter of autopm is the problem, this should be changed, instead of forcing the policy in the driver.

OTOH, the audio codec's powersave policy is governed by the power_save option and it's set up dynamically by the desktop system. We shouldn't override it in the driver.

Quoted 5 lines
Quoted 4 lines

If the power well *must* be off when only an eDP is used (e.g. otherwise the hardware doesn't work properly), then it's a
different story. Is it the case? And what exactly would be the
problem?

In the eDP only case, no audio is needed for the HD-A controller, so it's

wasting power in current design.

Quoted 1 line

I think Paulo or Daniel could explain more details on the impact.

Consuming more power is the expected behavior. What else?

Quoted 5 lines
Quoted 4 lines

If it's the case, controlling the power well based on the runtime PM is likely a bad design, as it relies on the parameter user sets. (And remember that the power-saving of the audio can be disabled completely via Kconfig, too.)

From audio controller's point of view, if it's asked be active, it needs power

and should request power-well from gfx side.

Quoted 1 line

In above case, audio controller should not be active but user set it be

"active".

Quoted 8 lines
Quoted 4 lines

By setting the autopm "on", user expects that no runtime PM happens. In other words, the audio controller must be kept active as long as this parameter is set. And this is the parameter user controls, and not what the driver forcibly sets.

Okay, become clear now. :)
So I think the conflict for Paulo becomes, in eDP caes, if audio is active and requested power-well, some eDP feature was under impact? Paulo, would you clarify this in more details?

Quoted 10 lines

On our driver we try to disable the power well whenever possible, as soon as possible. We don't change our behavior based on power AC or other user-space modifiable behavior (except the i915.disable_power_well Kernel option). If the power well is not disabled we can't enable some features, like PSR (panel self refresh, and eDP feature) or PC8, which is another power-saving feature. This will also make our QA procedures a lot more complex since when we want to test specific features (e.g., PSR, PC8) we'll have to disconnect the AC adapter or run scripts. So the behavior/predictability of our driver will be based on the Audio driver power management policies.

So all missing feature are about the power saving?

Quoted 5 lines

I am not so experienced with general Linux Power Management code, so maybe the way the Audio driver is behaving is just the usual way, but I have to admit I was expecting the audio driver would only require the power well when it is actually needed, and release it as soon as possible.

It would behave so, if all setups are for power-saving.

But, in your case, the runtime PM control attribute shows "on"; it implies that the runtime PM is effectively disabled, thus disabling power well is also impossible (because it would require turning off the audio controller, too).

Takashi

#21 lore raw
Quoted 128 lines · Takashi Iwai

At Wed, 17 Jul 2013 10:31:26 -0300,

Quoted 107 lines · Paulo Zanoni

2013/7/17 Wang, Xingchao <[email protected]>:

Quoted 96 lines
Quoted 96 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 4:18 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Wed, 17 Jul 2013 08:03:38 +0000,

Quoted 62 lines · Xingchao
Quoted 42 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 3:34 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Wed, 17 Jul 2013 02:52:41 +0000,

Quoted 13 lines · Xingchao

Hi Takashi/Paulo,

Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

would you change it to "auto" and test again.
Runtime power save should be enabled with "auto".

Doesn't solve the problem. Should I open a bug report somewhere? Having the power well enabled prevents some power saving features from the graphics driver.

Is the HD-audio power-saving itself working? You can check it via watching /sys/class/hwC*/power_{on|off}_acct files.

Quoted 7 lines
Quoted 5 lines

power_save option has to be adjusted appropriately. Note that many DEs change this value dynamically per AC-cable plug/unplug depending on the configuration, and often it's set to 0 (= no power save) when AC-cable is plugged.

[Wang, Xingchao] Paulo used a new Ultrabook board with charger connected,

and see the default parameter "auto=on".

Quoted 3 lines

In such scenario, power-well is always occupied by Display audio controller. Moreover, in this board, if no external monitors connected, It's

using internal eDP and totally no audio support. Power-well usage in such case also blocks some eDP features as Paulo told me.

Quoted 1 line
Quoted 8 lines
Quoted 2 lines

So I think it's not a good idea to break the rule of power policy when charger

connected but it's necessary to add support in this particular case.

Quoted 2 lines

Takashi, do you think it's acceptable to let Display audio controller/codec

suspend in such case?

Do you mean the driver enables the powersave forcibly?

Yes. I mean call pm_runtime_allow() for the power-well HD-A controller.

Quoted 9 lines

Then, no, not in general.

If the default parameter of autopm is the problem, this should be changed, instead of forcing the policy in the driver.

OTOH, the audio codec's powersave policy is governed by the power_save option and it's set up dynamically by the desktop system. We shouldn't override it in the driver.

Quoted 5 lines
Quoted 4 lines

If the power well *must* be off when only an eDP is used (e.g. otherwise the hardware doesn't work properly), then it's a
different story. Is it the case? And what exactly would be the
problem?

In the eDP only case, no audio is needed for the HD-A controller, so it's

wasting power in current design.

Quoted 1 line

I think Paulo or Daniel could explain more details on the impact.

Consuming more power is the expected behavior. What else?

Quoted 5 lines
Quoted 4 lines

If it's the case, controlling the power well based on the runtime PM is likely a bad design, as it relies on the parameter user sets. (And remember that the power-saving of the audio can be disabled completely via Kconfig, too.)

From audio controller's point of view, if it's asked be active, it needs power

and should request power-well from gfx side.

Quoted 1 line

In above case, audio controller should not be active but user set it be

"active".

Quoted 8 lines
Quoted 4 lines

By setting the autopm "on", user expects that no runtime PM happens. In other words, the audio controller must be kept active as long as this parameter is set. And this is the parameter user controls, and not what the driver forcibly sets.

Okay, become clear now. :)
So I think the conflict for Paulo becomes, in eDP caes, if audio is active and requested power-well, some eDP feature was under impact? Paulo, would you clarify this in more details?

Quoted 10 lines

On our driver we try to disable the power well whenever possible, as soon as possible. We don't change our behavior based on power AC or other user-space modifiable behavior (except the i915.disable_power_well Kernel option). If the power well is not disabled we can't enable some features, like PSR (panel self refresh, and eDP feature) or PC8, which is another power-saving feature. This will also make our QA procedures a lot more complex since when we want to test specific features (e.g., PSR, PC8) we'll have to disconnect the AC adapter or run scripts. So the behavior/predictability of our driver will be based on the Audio driver power management policies.

So all missing feature are about the power saving?

Quoted 5 lines

I am not so experienced with general Linux Power Management code, so maybe the way the Audio driver is behaving is just the usual way, but I have to admit I was expecting the audio driver would only require the power well when it is actually needed, and release it as soon as possible.

Quoted 6 lines

It would behave so, if all setups are for power-saving.

But, in your case, the runtime PM control attribute shows "on"; it implies that the runtime PM is effectively disabled, thus disabling power well is also impossible (because it would require turning off the audio controller, too).

So, if the machine only has an eDP (which has no audio function in itself, right?) and never HDMI, DP output because there are no such physical ports, the audio controller has no function. Maybe we can, before doing anything else, ask the video driver first if this is the case, and if so, never create the sound card at all, and just leave things the way the video driver wants?

Signature · 2 lines
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
#22 lore raw

At Wed, 17 Jul 2013 16:05:43 +0200,

Quoted 137 lines · David Henningsson
Quoted 128 lines · Takashi Iwai

At Wed, 17 Jul 2013 10:31:26 -0300,

Quoted 107 lines · Paulo Zanoni

2013/7/17 Wang, Xingchao <[email protected]>:

Quoted 96 lines
Quoted 96 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 4:18 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Wed, 17 Jul 2013 08:03:38 +0000,

Quoted 62 lines · Xingchao
Quoted 42 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 3:34 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Wed, 17 Jul 2013 02:52:41 +0000,

Quoted 13 lines · Xingchao

Hi Takashi/Paulo,

Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

would you change it to "auto" and test again.
Runtime power save should be enabled with "auto".

Doesn't solve the problem. Should I open a bug report somewhere? Having the power well enabled prevents some power saving features from the graphics driver.

Is the HD-audio power-saving itself working? You can check it via watching /sys/class/hwC*/power_{on|off}_acct files.

Quoted 7 lines
Quoted 5 lines

power_save option has to be adjusted appropriately. Note that many DEs change this value dynamically per AC-cable plug/unplug depending on the configuration, and often it's set to 0 (= no power save) when AC-cable is plugged.

[Wang, Xingchao] Paulo used a new Ultrabook board with charger connected,

and see the default parameter "auto=on".

Quoted 3 lines

In such scenario, power-well is always occupied by Display audio controller. Moreover, in this board, if no external monitors connected, It's

using internal eDP and totally no audio support. Power-well usage in such case also blocks some eDP features as Paulo told me.

Quoted 1 line
Quoted 8 lines
Quoted 2 lines

So I think it's not a good idea to break the rule of power policy when charger

connected but it's necessary to add support in this particular case.

Quoted 2 lines

Takashi, do you think it's acceptable to let Display audio controller/codec

suspend in such case?

Do you mean the driver enables the powersave forcibly?

Yes. I mean call pm_runtime_allow() for the power-well HD-A controller.

Quoted 9 lines

Then, no, not in general.

If the default parameter of autopm is the problem, this should be changed, instead of forcing the policy in the driver.

OTOH, the audio codec's powersave policy is governed by the power_save option and it's set up dynamically by the desktop system. We shouldn't override it in the driver.

Quoted 5 lines
Quoted 4 lines

If the power well *must* be off when only an eDP is used (e.g. otherwise the hardware doesn't work properly), then it's a
different story. Is it the case? And what exactly would be the
problem?

In the eDP only case, no audio is needed for the HD-A controller, so it's

wasting power in current design.

Quoted 1 line

I think Paulo or Daniel could explain more details on the impact.

Consuming more power is the expected behavior. What else?

Quoted 5 lines
Quoted 4 lines

If it's the case, controlling the power well based on the runtime PM is likely a bad design, as it relies on the parameter user sets. (And remember that the power-saving of the audio can be disabled completely via Kconfig, too.)

From audio controller's point of view, if it's asked be active, it needs power

and should request power-well from gfx side.

Quoted 1 line

In above case, audio controller should not be active but user set it be

"active".

Quoted 8 lines
Quoted 4 lines

By setting the autopm "on", user expects that no runtime PM happens. In other words, the audio controller must be kept active as long as this parameter is set. And this is the parameter user controls, and not what the driver forcibly sets.

Okay, become clear now. :)
So I think the conflict for Paulo becomes, in eDP caes, if audio is active and requested power-well, some eDP feature was under impact? Paulo, would you clarify this in more details?

Quoted 10 lines

On our driver we try to disable the power well whenever possible, as soon as possible. We don't change our behavior based on power AC or other user-space modifiable behavior (except the i915.disable_power_well Kernel option). If the power well is not disabled we can't enable some features, like PSR (panel self refresh, and eDP feature) or PC8, which is another power-saving feature. This will also make our QA procedures a lot more complex since when we want to test specific features (e.g., PSR, PC8) we'll have to disconnect the AC adapter or run scripts. So the behavior/predictability of our driver will be based on the Audio driver power management policies.

So all missing feature are about the power saving?

Quoted 5 lines

I am not so experienced with general Linux Power Management code, so maybe the way the Audio driver is behaving is just the usual way, but I have to admit I was expecting the audio driver would only require the power well when it is actually needed, and release it as soon as possible.

Quoted 6 lines

It would behave so, if all setups are for power-saving.

But, in your case, the runtime PM control attribute shows "on"; it implies that the runtime PM is effectively disabled, thus disabling power well is also impossible (because it would require turning off the audio controller, too).

Quoted 6 lines

So, if the machine only has an eDP (which has no audio function in itself, right?) and never HDMI, DP output because there are no such physical ports, the audio controller has no function.
Maybe we can, before doing anything else, ask the video driver first if this is the case, and if so, never create the sound card at all, and just leave things the way the video driver wants?

Well, doesn't BIOS mark HDMI/DP audio pins as unused? Then the audio driver won't create any instances. Of course, we can optimize such a case, indeed.

Takashi

#23 lore raw
Quoted 164 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 10:22 PM
To: David Henningsson
Cc: Paulo Zanoni; Wang, Xingchao; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Wed, 17 Jul 2013 16:05:43 +0200,

Quoted 32 lines · David Henningsson
Quoted 30 lines · Takashi Iwai

At Wed, 17 Jul 2013 10:31:26 -0300,

Quoted 28 lines · Paulo Zanoni

2013/7/17 Wang, Xingchao <[email protected]>:

Quoted 26 lines
Quoted 26 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 4:18 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 13 lines · Xingchao
Quoted 13 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 3:34 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines · Xingchao

Hi Takashi/Paulo,

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

would you change it to "auto" and test again.
Runtime power save should be enabled with "auto".

Doesn't solve the problem. Should I open a bug report

somewhere?

Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

Having the power well enabled prevents some power saving features from the graphics driver.

Is the HD-audio power-saving itself working? You can check it via watching /sys/class/hwC*/power_{on|off}_acct files.

Quoted 7 lines
Quoted 5 lines

power_save option has to be adjusted appropriately. Note that many DEs change this value dynamically per AC-cable plug/unplug depending on the configuration, and often it's set to 0 (= no power save) when AC-cable is plugged.

[Wang, Xingchao] Paulo used a new Ultrabook board with charger connected,

and see the default parameter "auto=on".

Quoted 3 lines

In such scenario, power-well is always occupied by Display audio controller. Moreover, in this board, if no external monitors connected, It's

using internal eDP and totally no audio support. Power-well usage in such case also blocks some eDP features as Paulo told me.

Quoted 3 lines

So I think it's not a good idea to break the rule of power policy when charger

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

connected but it's necessary to add support in this particular case.

Quoted 2 lines

Takashi, do you think it's acceptable to let Display audio controller/codec

suspend in such case?

Do you mean the driver enables the powersave forcibly?

Yes. I mean call pm_runtime_allow() for the power-well HD-A

controller.

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 6 lines

Then, no, not in general.

If the default parameter of autopm is the problem, this should be changed, instead of forcing the policy in the driver.

Quoted 8 lines

OTOH, the audio codec's powersave policy is governed by the power_save option and it's set up dynamically by the desktop system. We shouldn't override it in the driver.

If the power well *must* be off when only an eDP is used (e.g. otherwise the hardware doesn't work properly), then it's a
different story. Is it the case? And what exactly would be the
problem?

In the eDP only case, no audio is needed for the HD-A controller, so it's

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

wasting power in current design.

Quoted 1 line

I think Paulo or Daniel could explain more details on the impact.

Consuming more power is the expected behavior. What else?

Quoted 2 lines
Quoted 2 lines

If it's the case, controlling the power well based on the runtime PM is likely a bad design, as it relies on the parameter user

sets.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

(And remember that the power-saving of the audio can be disabled completely via Kconfig, too.)

From audio controller's point of view, if it's asked be active,
it needs power

and should request power-well from gfx side.

Quoted 2 lines

In above case, audio controller should not be active but user set it be

"active".

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

By setting the autopm "on", user expects that no runtime PM happens. In other words, the audio controller must be kept active as long as this parameter is set. And this is the parameter user controls, and not what the driver forcibly sets.

Okay, become clear now. :)
So I think the conflict for Paulo becomes, in eDP caes, if audio is active

and requested power-well, some eDP feature was under impact?

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 1 line

Paulo, would you clarify this in more details?

On our driver we try to disable the power well whenever possible, as soon as possible. We don't change our behavior based on power AC or other user-space modifiable behavior (except the i915.disable_power_well Kernel option). If the power well is not disabled we can't enable some features, like PSR (panel self refresh, and eDP feature) or PC8, which is another power-saving feature. This will also make our QA procedures a lot more complex since when we want to test specific features (e.g., PSR, PC8) we'll have to disconnect the AC adapter or run scripts. So the behavior/predictability of our driver will be based on the Audio driver

power management policies.

Quoted 16 lines
Quoted 9 lines

So all missing feature are about the power saving?

Quoted 5 lines

I am not so experienced with general Linux Power Management code, so maybe the way the Audio driver is behaving is just the usual way, but I have to admit I was expecting the audio driver would only require the power well when it is actually needed, and release it as soon as possible.

Quoted 6 lines

It would behave so, if all setups are for power-saving.

But, in your case, the runtime PM control attribute shows "on"; it implies that the runtime PM is effectively disabled, thus disabling power well is also impossible (because it would require turning off the audio controller, too).

Quoted 6 lines

So, if the machine only has an eDP (which has no audio function in itself, right?) and never HDMI, DP output because there are no such physical ports, the audio controller has no function. Maybe we can, before doing anything else, ask the video driver first if this is the case, and if so, never create the sound card at all, and just leave things the way the video driver wants?

Quoted 3 lines

Well, doesn't BIOS mark HDMI/DP audio pins as unused? Then the audio driver won't create any instances. Of course, we can optimize such a case, indeed.

As I know, the eDP only case doesnot mean no HDMI/DP support. User would plug in HDMI/DP monitor at any time. So diable audio controller totoally is not a good idea. :(.
Paulo, is that correct for you case?

--xingchao

Quoted 3 lines

Takashi

#24 lore raw
In reply to Takashi Iwai

Hi Paulo/Daniel,

Do you agree to export an API in gfx side for eDP case?
Basically the api will let audio drver know which pipe in use. i.e. in the eDP only caes, audio driver Will know gfx is not using HDMI/DP and would like to let power-well off.
As there's the conflict when user expect display audio driver always active but gfx need audio driver off. Audio driver could make decision to release power-well if it knows the eDP only case through the API.

OTOH, I think audio driver could also export an API for gfx side, if gfx driver need audio driver release power-well but it's in usage, It will call this API and audio drvier will release power-well accordingly.

This change make HDMI/DP hotplug handling complicated in audio driver side, if audio driver release power-well, it would enter suspend mode. Meanwhile the user may expect it's in active mode, this may cause some confuse.

Thanks
--xingchao

Quoted 190 lines

-----Original Message-----
From: Wang, Xingchao
Sent: Thursday, July 18, 2013 7:18 AM
To: 'Takashi Iwai'; David Henningsson; Paulo Zanoni
Cc: [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon
Subject: RE: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 75 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 10:22 PM
To: David Henningsson
Cc: Paulo Zanoni; Wang, Xingchao; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Wed, 17 Jul 2013 16:05:43 +0200,

Quoted 31 lines · David Henningsson
Quoted 29 lines · Takashi Iwai
Quoted 28 lines · Paulo Zanoni

2013/7/17 Wang, Xingchao <[email protected]>:

Quoted 26 lines
Quoted 26 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 4:18 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 13 lines · Xingchao
Quoted 13 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 3:34 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines · Xingchao

Hi Takashi/Paulo,

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

would you change it to "auto" and test again.
Runtime power save should be enabled with "auto".

Doesn't solve the problem. Should I open a bug report

somewhere?

Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

Having the power well enabled prevents some power saving features from the graphics driver.

Is the HD-audio power-saving itself working? You can check it via watching /sys/class/hwC*/power_{on|off}_acct files.

Quoted 7 lines
Quoted 5 lines

power_save option has to be adjusted appropriately. Note that many DEs change this value dynamically per AC-cable plug/unplug depending on the configuration, and often it's set to 0 (= no power save) when AC-cable is plugged.

[Wang, Xingchao] Paulo used a new Ultrabook board with charger connected,

and see the default parameter "auto=on".

Quoted 3 lines

In such scenario, power-well is always occupied by Display audio controller. Moreover, in this board, if no external monitors connected, It's

using internal eDP and totally no audio support. Power-well usage in such case also blocks some eDP features as Paulo told me.

Quoted 3 lines

So I think it's not a good idea to break the rule of power policy when charger

connected but it's necessary to add support in this particular case.

Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Takashi, do you think it's acceptable to let Display audio controller/codec

suspend in such case?

Do you mean the driver enables the powersave forcibly?

Yes. I mean call pm_runtime_allow() for the power-well HD-A

controller.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Then, no, not in general.

If the default parameter of autopm is the problem, this should be changed, instead of forcing the policy in the driver.

OTOH, the audio codec's powersave policy is governed by the power_save option and it's set up dynamically by the desktop

system.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 8 lines
Quoted 6 lines

We shouldn't override it in the driver.

If the power well *must* be off when only an eDP is used (e.g. otherwise the hardware doesn't work properly), then it's a
different story. Is it the case? And what exactly would be the
problem?

In the eDP only case, no audio is needed for the HD-A controller, so it's

wasting power in current design.

Quoted 1 line

I think Paulo or Daniel could explain more details on the impact.

Quoted 17 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Consuming more power is the expected behavior. What else?

Quoted 3 lines
Quoted 3 lines

If it's the case, controlling the power well based on the runtime PM is likely a bad design, as it relies on the parameter user

sets.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 2 lines

(And remember that the power-saving of the audio can be disabled completely via Kconfig, too.)

From audio controller's point of view, if it's asked be
active, it needs power

and should request power-well from gfx side.

Quoted 2 lines

In above case, audio controller should not be active but user set it be

"active".

By setting the autopm "on", user expects that no runtime PM

happens.

Quoted 45 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

In other words, the audio controller must be kept active as long as this parameter is set. And this is the parameter user controls, and not what the driver forcibly sets.

Okay, become clear now. :)
So I think the conflict for Paulo becomes, in eDP caes, if audio is active

and requested power-well, some eDP feature was under impact?

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 1 line

Paulo, would you clarify this in more details?

On our driver we try to disable the power well whenever possible, as soon as possible. We don't change our behavior based on power AC or other user-space modifiable behavior (except the i915.disable_power_well Kernel option). If the power well is not disabled we can't enable some features, like PSR (panel self refresh, and eDP feature) or PC8, which is another power-saving feature. This will also make our QA procedures a lot more complex since when we want to test specific features (e.g., PSR, PC8) we'll have to disconnect the AC adapter or run scripts. So the behavior/predictability of our driver will be based on the Audio driver

power management policies.

Quoted 16 lines
Quoted 9 lines

So all missing feature are about the power saving?

Quoted 5 lines

I am not so experienced with general Linux Power Management code, so maybe the way the Audio driver is behaving is just the usual way, but I have to admit I was expecting the audio driver would only require the power well when it is actually needed, and release it as soon as possible.

Quoted 6 lines

It would behave so, if all setups are for power-saving.

But, in your case, the runtime PM control attribute shows "on"; it implies that the runtime PM is effectively disabled, thus disabling power well is also impossible (because it would require turning off the audio controller, too).

Quoted 6 lines

So, if the machine only has an eDP (which has no audio function in itself, right?) and never HDMI, DP output because there are no such physical ports, the audio controller has no function. Maybe we can, before doing anything else, ask the video driver first if this is the case, and if so, never create the sound card at all, and just leave things the way the video driver wants?

Quoted 3 lines

Well, doesn't BIOS mark HDMI/DP audio pins as unused? Then the audio driver won't create any instances. Of course, we can optimize such a case, indeed.

As I know, the eDP only case doesnot mean no HDMI/DP support. User would plug in HDMI/DP monitor at any time.
So diable audio controller totoally is not a good idea. :(. Paulo, is that correct for you case?

--xingchao

Quoted 3 lines

Takashi

#25 lore raw
Quoted 8 lines · Xingchao

Hi Paulo/Daniel,

Do you agree to export an API in gfx side for eDP case?
Basically the api will let audio drver know which pipe in use. i.e. in the eDP only caes, audio driver Will know gfx is not using HDMI/DP and would like to let power-well off.
As there's the conflict when user expect display audio driver always active but gfx need audio driver off. Audio driver could make decision to release power-well if it knows the eDP only case through the API.

Quoted 5 lines

OTOH, I think audio driver could also export an API for gfx side, if gfx driver need audio driver release power-well but it's in usage, It will call this API and audio drvier will release power-well accordingly.

This change make HDMI/DP hotplug handling complicated in audio driver side, if audio driver release power-well, it would enter suspend mode. Meanwhile the user may expect it's in active mode, this may cause some confuse.

Afaik (and I know very little about audio) the audio side already knows which pipes have audio enabled, since we set the respective bit only when it's needed. And audio will receive the unsolicited even interrupt (or whatever it's called) when this happens.

So I think we already have the means (albeit with that quirky hw interface, but it seems to have been good enough for a long time already) to do that. Or do I miss something?
-Daniel

Quoted 194 lines

Thanks
--xingchao

Quoted 190 lines

-----Original Message-----
From: Wang, Xingchao
Sent: Thursday, July 18, 2013 7:18 AM
To: 'Takashi Iwai'; David Henningsson; Paulo Zanoni
Cc: [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon
Subject: RE: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 75 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 10:22 PM
To: David Henningsson
Cc: Paulo Zanoni; Wang, Xingchao; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Wed, 17 Jul 2013 16:05:43 +0200,

Quoted 31 lines · David Henningsson
Quoted 29 lines · Takashi Iwai
Quoted 28 lines · Paulo Zanoni

2013/7/17 Wang, Xingchao <[email protected]>:

Quoted 26 lines
Quoted 26 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 4:18 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 13 lines · Xingchao
Quoted 13 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 3:34 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines · Xingchao

Hi Takashi/Paulo,

Quoted 4 lines
Quoted 4 lines

would you change it to "auto" and test again.
Runtime power save should be enabled with "auto".

Doesn't solve the problem. Should I open a bug report

somewhere?

Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

Having the power well enabled prevents some power saving
features from the graphics driver.

Is the HD-audio power-saving itself working? You can check it via watching /sys/class/hwC*/power_{on|off}_acct files.

Quoted 7 lines
Quoted 5 lines

power_save option has to be adjusted appropriately. Note that many DEs change this value dynamically per AC-cable plug/unplug depending on the configuration, and often it's set to 0 (= no power save) when AC-cable is plugged.

[Wang, Xingchao] Paulo used a new Ultrabook board with charger connected,

and see the default parameter "auto=on".

Quoted 3 lines

In such scenario, power-well is always occupied by Display audio controller. Moreover, in this board, if no external monitors connected, It's

using internal eDP and totally no audio support. Power-well usage in such case also blocks some eDP features as Paulo told me.

Quoted 3 lines

So I think it's not a good idea to break the rule of power policy when charger

connected but it's necessary to add support in this particular case.

Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Takashi, do you think it's acceptable to let Display audio controller/codec

suspend in such case?

Do you mean the driver enables the powersave forcibly?

Yes. I mean call pm_runtime_allow() for the power-well HD-A

controller.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Then, no, not in general.

If the default parameter of autopm is the problem, this should be changed, instead of forcing the policy in the driver.

OTOH, the audio codec's powersave policy is governed by the power_save option and it's set up dynamically by the desktop

system.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 8 lines
Quoted 6 lines

We shouldn't override it in the driver.

If the power well *must* be off when only an eDP is used (e.g. otherwise the hardware doesn't work properly), then it's a
different story. Is it the case? And what exactly would be the
problem?

In the eDP only case, no audio is needed for the HD-A controller, so it's

wasting power in current design.

Quoted 1 line

I think Paulo or Daniel could explain more details on the impact.

Quoted 17 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Consuming more power is the expected behavior. What else?

Quoted 3 lines
Quoted 3 lines

If it's the case, controlling the power well based on the runtime PM is likely a bad design, as it relies on the parameter user

sets.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 2 lines

(And remember that the power-saving of the audio can be disabled completely via Kconfig, too.)

From audio controller's point of view, if it's asked be
active, it needs power

and should request power-well from gfx side.

Quoted 2 lines

In above case, audio controller should not be active but user set it be

"active".

By setting the autopm "on", user expects that no runtime PM

happens.

Quoted 45 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

In other words, the audio controller must be kept active as long as this parameter is set. And this is the parameter user controls, and not what the driver forcibly sets.

Okay, become clear now. :)
So I think the conflict for Paulo becomes, in eDP caes, if audio is active

and requested power-well, some eDP feature was under impact?

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 1 line

Paulo, would you clarify this in more details?

On our driver we try to disable the power well whenever possible, as soon as possible. We don't change our behavior based on power AC or other user-space modifiable behavior (except the i915.disable_power_well Kernel option). If the power well is not disabled we can't enable some features, like PSR (panel self refresh, and eDP feature) or PC8, which is another power-saving feature. This will also make our QA procedures a lot more complex since when we want to test specific features (e.g., PSR, PC8) we'll have to disconnect the AC adapter or run scripts. So the behavior/predictability of our driver will be based on the Audio driver

power management policies.

Quoted 16 lines
Quoted 9 lines

So all missing feature are about the power saving?

Quoted 5 lines

I am not so experienced with general Linux Power Management code, so maybe the way the Audio driver is behaving is just the usual way, but I have to admit I was expecting the audio driver would only require the power well when it is actually needed, and release it as soon as possible.

Quoted 6 lines

It would behave so, if all setups are for power-saving.

But, in your case, the runtime PM control attribute shows "on"; it implies that the runtime PM is effectively disabled, thus disabling power well is also impossible (because it would require turning off the audio controller, too).

Quoted 6 lines

So, if the machine only has an eDP (which has no audio function in itself, right?) and never HDMI, DP output because there are no such physical ports, the audio controller has no function. Maybe we can, before doing anything else, ask the video driver first if this is the case, and if so, never create the sound card at all, and just leave things the way the video driver wants?

Quoted 3 lines

Well, doesn't BIOS mark HDMI/DP audio pins as unused? Then the audio driver won't create any instances. Of course, we can optimize such a case, indeed.

As I know, the eDP only case doesnot mean no HDMI/DP support. User would plug in HDMI/DP monitor at any time.
So diable audio controller totoally is not a good idea. :(. Paulo, is that correct for you case?

--xingchao

Quoted 3 lines

Takashi

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#26 lore raw
Quoted 29 lines

-----Original Message-----
From: Daniel Vetter [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Thursday, July 18, 2013 2:44 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; [email protected]; Daniel Vetter; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon; Takashi Iwai; David Henningsson
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 5 lines · Xingchao

Hi Paulo/Daniel,

Do you agree to export an API in gfx side for eDP case? Basically the api will let audio drver know which pipe in use. i.e. in the eDP only caes, audio driver Will know gfx is not using HDMI/DP and would

like to let power-well off.

Quoted 1 line

As there's the conflict when user expect display audio driver always active but

gfx need audio driver off.

Quoted 1 line

Audio driver could make decision to release power-well if it knows the eDP

only case through the API.

Quoted 3 lines

OTOH, I think audio driver could also export an API for gfx side, if gfx driver need audio driver release power-well but it's in usage, It will call

this API and audio drvier will release power-well accordingly.

Quoted 2 lines

This change make HDMI/DP hotplug handling complicated in audio driver side,

Quoted 9 lines

if audio driver release power-well, it would enter suspend mode.

Quoted 1 line

Meanwhile the user may expect it's in active mode, this may cause some

confuse.

Afaik (and I know very little about audio) the audio side already knows which pipes have audio enabled, since we set the respective bit only when it's needed. And audio will receive the unsolicited even interrupt (or whatever it's called) when this happens.

For haswell, Audio driver can get DDI port/Pin usage information according to the unsolicited event, not Pipe info.
However at this stage, seems only that is enough: if no pin has valid ELD, audio driver can think about that no monitor connected with DDI ports. In this case, Audio driver could release power-well and enter suspend mode automatically, this avoid blocking eDP feature enabling. And once gfx dirver Detect external monitor connected, it will also wake up audio driver.

Takashi, do you think this solution acceptable?

Thanks
--xingchao

Quoted 214 lines

So I think we already have the means (albeit with that quirky hw interface, but it seems to have been good enough for a long time already) to do that. Or do I miss something?
-Daniel

Quoted 75 lines

Thanks
--xingchao

Quoted 71 lines

-----Original Message-----
From: Wang, Xingchao
Sent: Thursday, July 18, 2013 7:18 AM
To: 'Takashi Iwai'; David Henningsson; Paulo Zanoni
Cc: [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon
Subject: RE: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 59 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 10:22 PM
To: David Henningsson
Cc: Paulo Zanoni; Wang, Xingchao; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 33 lines · David Henningsson
Quoted 31 lines · Takashi Iwai
Quoted 30 lines · Paulo Zanoni

2013/7/17 Wang, Xingchao <[email protected]>:

Quoted 28 lines
Quoted 28 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 4:18 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 14 lines · Xingchao
Quoted 14 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 3:34 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines · Xingchao

Hi Takashi/Paulo,

Quoted 4 lines

would you change it to "auto" and test again.
Runtime power save should be enabled with "auto".

Doesn't solve the problem. Should I open a bug report

somewhere?

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Having the power well enabled prevents some power
saving features from the graphics driver.

Is the HD-audio power-saving itself working? You can
check it via watching /sys/class/hwC*/power_{on|off}_acct

files.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

power_save option has to be adjusted appropriately.
Note that many DEs change this value dynamically per
AC-cable plug/unplug depending on the configuration,
and often it's set to 0 (= no power save) when AC-cable is

plugged.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
Quoted 1 line

[Wang, Xingchao] Paulo used a new Ultrabook board with charger connected,

and see the default parameter "auto=on".

Quoted 3 lines

In such scenario, power-well is always occupied by Display audio controller. Moreover, in this board, if no external monitors connected, It's

using internal eDP and totally no audio support. Power-well usage in such case also blocks some eDP features as

Paulo told me.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

So I think it's not a good idea to break the rule of power policy when charger

connected but it's necessary to add support in this particular

case.

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Takashi, do you think it's acceptable to let Display audio controller/codec

suspend in such case?

Do you mean the driver enables the powersave forcibly?

Yes. I mean call pm_runtime_allow() for the power-well HD-A

controller.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Then, no, not in general.

If the default parameter of autopm is the problem, this should be changed, instead of forcing the policy in the driver.

OTOH, the audio codec's powersave policy is governed by the power_save option and it's set up dynamically by the desktop

Quoted 6 lines
Quoted 6 lines

system.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

We shouldn't override it in the driver.

If the power well *must* be off when only an eDP is used (e.g. otherwise the hardware doesn't work properly), then it's a
different story. Is it the case? And what exactly would be

the

Quoted 78 lines
Quoted 78 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

problem?

In the eDP only case, no audio is needed for the HD-A controller, so it's

wasting power in current design.

Quoted 1 line

I think Paulo or Daniel could explain more details on the impact.

Quoted 17 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Consuming more power is the expected behavior. What else?

Quoted 3 lines
Quoted 3 lines

If it's the case, controlling the power well based on the runtime PM is likely a bad design, as it relies on the parameter user

sets.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 2 lines

(And remember that the power-saving of the audio can be disabled completely via Kconfig, too.)

From audio controller's point of view, if it's asked be
active, it needs power

and should request power-well from gfx side.

Quoted 2 lines

In above case, audio controller should not be active but user set it be

"active".

By setting the autopm "on", user expects that no runtime PM

happens.

Quoted 45 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

In other words, the audio controller must be kept active as long as this parameter is set. And this is the parameter user controls, and not what the driver forcibly sets.

Okay, become clear now. :)
So I think the conflict for Paulo becomes, in eDP caes, if audio is active

and requested power-well, some eDP feature was under impact?

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 1 line

Paulo, would you clarify this in more details?

On our driver we try to disable the power well whenever possible, as soon as possible. We don't change our behavior based on power AC or other user-space modifiable behavior (except the i915.disable_power_well Kernel option). If the power well is not disabled we can't enable some features, like PSR (panel self refresh, and eDP feature) or PC8, which is another power-saving feature. This will also make our QA procedures a lot more complex since when we want to test specific features (e.g., PSR, PC8) we'll have to disconnect the AC adapter or run scripts. So the behavior/predictability of our driver will be based on the Audio driver

power management policies.

Quoted 16 lines
Quoted 9 lines

So all missing feature are about the power saving?

Quoted 5 lines

I am not so experienced with general Linux Power Management code, so maybe the way the Audio driver is behaving is just the usual way, but I have to admit I was expecting the audio driver would only require the power well when it is actually needed, and release it as soon as possible.

Quoted 6 lines

It would behave so, if all setups are for power-saving.

But, in your case, the runtime PM control attribute shows "on"; it implies that the runtime PM is effectively disabled, thus disabling power well is also impossible (because it would require turning off the audio controller, too).

Quoted 6 lines

So, if the machine only has an eDP (which has no audio function in itself, right?) and never HDMI, DP output because there are no such physical ports, the audio controller has no function. Maybe we can, before doing anything else, ask the video driver first if this is the case, and if so, never create the sound card at all, and just leave things the way the video driver wants?

Quoted 3 lines

Well, doesn't BIOS mark HDMI/DP audio pins as unused? Then the audio driver won't create any instances. Of course, we can optimize such a case, indeed.

As I know, the eDP only case doesnot mean no HDMI/DP support. User would plug in HDMI/DP monitor at any time.
So diable audio controller totoally is not a good idea. :(. Paulo, is that correct for you case?

Quoted 4 lines
Quoted 4 lines

--xingchao

Quoted 3 lines

Takashi

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

#27 lore raw

At Thu, 18 Jul 2013 09:23:57 +0000,

Quoted 39 lines · Xingchao
Quoted 30 lines

-----Original Message-----
From: Daniel Vetter [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Thursday, July 18, 2013 2:44 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; [email protected]; Daniel Vetter; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon; Takashi Iwai; David Henningsson
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 5 lines · Xingchao

Hi Paulo/Daniel,

Do you agree to export an API in gfx side for eDP case? Basically the api will let audio drver know which pipe in use. i.e. in the eDP only caes, audio driver Will know gfx is not using HDMI/DP and would

like to let power-well off.

Quoted 1 line

As there's the conflict when user expect display audio driver always active but

gfx need audio driver off.

Quoted 1 line

Audio driver could make decision to release power-well if it knows the eDP

only case through the API.

Quoted 3 lines

OTOH, I think audio driver could also export an API for gfx side, if gfx driver need audio driver release power-well but it's in usage, It will call

this API and audio drvier will release power-well accordingly.

Quoted 2 lines

This change make HDMI/DP hotplug handling complicated in audio driver side,

Quoted 9 lines

if audio driver release power-well, it would enter suspend mode.

Quoted 1 line

Meanwhile the user may expect it's in active mode, this may cause some

confuse.

Afaik (and I know very little about audio) the audio side already knows which pipes have audio enabled, since we set the respective bit only when it's needed. And audio will receive the unsolicited even interrupt (or whatever it's called) when this happens.

Quoted 6 lines

For haswell, Audio driver can get DDI port/Pin usage information according to the unsolicited event, not Pipe info.
However at this stage, seems only that is enough: if no pin has valid ELD, audio driver can think about that no monitor connected with DDI ports. In this case, Audio driver could release power-well and enter suspend mode automatically, this avoid blocking eDP feature enabling. And once gfx dirver Detect external monitor connected, it will also wake up audio driver.

Takashi, do you think this solution acceptable?

It's the current situation, isn't it? So the question is only whether this works _as expected_.

Basically system/user needs to set up two parameters for the audio power-saving. If both are set well, but it still doesn't work, we need to debug.

Of course, we can improve things, for example, the default runtime PM setup. (Note that this is about the default value, not the value force to set.)

Takashi

Quoted 219 lines

Thanks
--xingchao

Quoted 214 lines

So I think we already have the means (albeit with that quirky hw interface, but it seems to have been good enough for a long time already) to do that. Or do I miss something?
-Daniel

Quoted 75 lines

Thanks
--xingchao

Quoted 71 lines

-----Original Message-----
From: Wang, Xingchao
Sent: Thursday, July 18, 2013 7:18 AM
To: 'Takashi Iwai'; David Henningsson; Paulo Zanoni
Cc: [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon
Subject: RE: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 59 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 10:22 PM
To: David Henningsson
Cc: Paulo Zanoni; Wang, Xingchao; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 33 lines · David Henningsson
Quoted 31 lines · Takashi Iwai
Quoted 30 lines · Paulo Zanoni

2013/7/17 Wang, Xingchao <[email protected]>:

Quoted 28 lines
Quoted 28 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 4:18 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 14 lines · Xingchao
Quoted 14 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 3:34 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines · Xingchao

Hi Takashi/Paulo,

would you change it to "auto" and test again.
Runtime power save should be enabled with "auto".

Doesn't solve the problem. Should I open a bug report

somewhere?

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Having the power well enabled prevents some power
saving features from the graphics driver.

Is the HD-audio power-saving itself working? You can
check it via watching /sys/class/hwC*/power_{on|off}_acct

files.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

power_save option has to be adjusted appropriately.
Note that many DEs change this value dynamically per
AC-cable plug/unplug depending on the configuration,
and often it's set to 0 (= no power save) when AC-cable is

plugged.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines

[Wang, Xingchao] Paulo used a new Ultrabook board with
charger connected,

and see the default parameter "auto=on".

Quoted 3 lines

In such scenario, power-well is always occupied by
Display audio controller. Moreover, in this board, if no
external monitors connected, It's

using internal eDP and totally no audio support. Power-well usage in such case also blocks some eDP features as

Paulo told me.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

So I think it's not a good idea to break the rule of
power policy when charger

connected but it's necessary to add support in this particular

case.

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Takashi, do you think it's acceptable to let Display
audio controller/codec

suspend in such case?

Do you mean the driver enables the powersave forcibly?

Yes. I mean call pm_runtime_allow() for the power-well HD-A

controller.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Then, no, not in general.

If the default parameter of autopm is the problem, this should be changed, instead of forcing the policy in the driver.

OTOH, the audio codec's powersave policy is governed by the power_save option and it's set up dynamically by the desktop

Quoted 6 lines
Quoted 6 lines

system.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

We shouldn't override it in the driver.

If the power well *must* be off when only an eDP is used (e.g. otherwise the hardware doesn't work properly), then it's a
different story. Is it the case? And what exactly would be

the

Quoted 78 lines
Quoted 78 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

problem?

In the eDP only case, no audio is needed for the HD-A controller, so it's

wasting power in current design.

Quoted 1 line

I think Paulo or Daniel could explain more details on the impact.

Quoted 17 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Consuming more power is the expected behavior. What else?

Quoted 3 lines
Quoted 3 lines

If it's the case, controlling the power well based on the runtime PM is likely a bad design, as it relies on the parameter user

sets.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 2 lines

(And remember that the power-saving of the audio can be disabled completely via Kconfig, too.)

From audio controller's point of view, if it's asked be
active, it needs power

and should request power-well from gfx side.

Quoted 2 lines

In above case, audio controller should not be active but user set it be

"active".

By setting the autopm "on", user expects that no runtime PM

happens.

Quoted 45 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

In other words, the audio controller must be kept active as long as this parameter is set. And this is the parameter user controls, and not what the driver forcibly sets.

Okay, become clear now. :)
So I think the conflict for Paulo becomes, in eDP caes, if audio is active

and requested power-well, some eDP feature was under impact?

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 1 line

Paulo, would you clarify this in more details?

On our driver we try to disable the power well whenever possible, as soon as possible. We don't change our behavior based on power AC or other user-space modifiable behavior (except the i915.disable_power_well Kernel option). If the power well is not disabled we can't enable some features, like PSR (panel self refresh, and eDP feature) or PC8, which is another power-saving feature. This will also make our QA procedures a lot more complex since when we want to test specific features (e.g., PSR, PC8) we'll have to disconnect the AC adapter or run scripts. So the behavior/predictability of our driver will be based on the Audio driver

power management policies.

Quoted 16 lines
Quoted 9 lines

So all missing feature are about the power saving?

Quoted 5 lines

I am not so experienced with general Linux Power Management code, so maybe the way the Audio driver is behaving is just the usual way, but I have to admit I was expecting the audio driver would only require the power well when it is actually needed, and release it as soon as possible.

Quoted 6 lines

It would behave so, if all setups are for power-saving.

But, in your case, the runtime PM control attribute shows "on"; it implies that the runtime PM is effectively disabled, thus disabling power well is also impossible (because it would require turning off the audio controller, too).

Quoted 6 lines

So, if the machine only has an eDP (which has no audio function in itself, right?) and never HDMI, DP output because there are no such physical ports, the audio controller has no function. Maybe we can, before doing anything else, ask the video driver first if this is the case, and if so, never create the sound card at all, and just leave things the way the video driver wants?

Quoted 3 lines

Well, doesn't BIOS mark HDMI/DP audio pins as unused? Then the audio driver won't create any instances. Of course, we can optimize such a case, indeed.

As I know, the eDP only case doesnot mean no HDMI/DP support. User would plug in HDMI/DP monitor at any time.
So diable audio controller totoally is not a good idea. :(. Paulo, is that correct for you case?

Quoted 4 lines
Quoted 4 lines

--xingchao

Quoted 3 lines

Takashi

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

#28 lore raw

Hi Paulo,

Would you help verify attached patch to fix this issue for you?

The patch is based on Takashi's tree, the last commit is:
commit 9b298cfe296c0f8e088b9ed9a670783a06005e6b I think it should be safe to merge into your tree. :)

I tested the patch on Harris Beach, it would let audio driver release power-well even with charger connected.

Please note maybe this is not the final solution for this issue as it breaks some rule from user's point of view.

Some background of this issue:
This patch intended to fix power-well regression on Haswell.

On Harris Beach(Ultrabook with battery), there's only eDP panel connected by default, no HDMI/DP. And gfx driver needs enable some HW feature for eDP, power-well *must* be disabled in this scenario.
- Witout charger connected, power-well feature is perfect
- with charger connected, audio never release power-well.

Basically, power-well should be release if audio driver doesnot use it, that's why we enabled runtime power-save feature.

In second case above, with charger connected, the parameter under "/sys/devices/../power/control" become "on" always.
In audio driver side, power_save was set to "0", which disable power_down the codecs and controller, thus never release power->usage_count.

And this blocks audio driver release power-well.

In the second case, if audio driver detect hdmi pins are free and no Apps opened device, it will eanble runtime power-save feature as an exception.

I test this patch on Harris beach with charger connected, the power-well could be released as expected.

Thanks
--xingchao

Quoted 286 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Thursday, July 18, 2013 5:35 PM
To: Wang, Xingchao
Cc: Daniel Vetter; Paulo Zanoni; [email protected]; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon; David Henningsson
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Thu, 18 Jul 2013 09:23:57 +0000,

Quoted 37 lines · Xingchao
Quoted 37 lines

-----Original Message-----
From: Daniel Vetter [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Thursday, July 18, 2013 2:44 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; [email protected]; Daniel Vetter; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon; Takashi Iwai; David Henningsson
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 6 lines · Xingchao

Hi Paulo/Daniel,

Do you agree to export an API in gfx side for eDP case? Basically the api will let audio drver know which pipe in use. i.e. in the eDP only caes, audio driver Will know gfx is not using HDMI/DP and would

like to let power-well off.

Quoted 2 lines

As there's the conflict when user expect display audio driver always active but

gfx need audio driver off.

Quoted 2 lines

Audio driver could make decision to release power-well if it knows the eDP

only case through the API.

Quoted 4 lines

OTOH, I think audio driver could also export an API for gfx side, if gfx driver need audio driver release power-well but it's in usage, It will call

this API and audio drvier will release power-well accordingly.

Quoted 3 lines

This change make HDMI/DP hotplug handling complicated in audio driver side,

Quoted 7 lines
Quoted 7 lines

if audio driver release power-well, it would enter suspend mode.

Quoted 2 lines

Meanwhile the user may expect it's in active mode, this may cause some

confuse.

Afaik (and I know very little about audio) the audio side already knows which pipes have audio enabled, since we set the respective bit only

when it's needed.

Quoted 4 lines
Quoted 3 lines

And audio will receive the unsolicited even interrupt (or whatever it's called) when this happens.

For haswell, Audio driver can get DDI port/Pin usage information according to

the unsolicited event, not Pipe info.

Quoted 1 line

However at this stage, seems only that is enough: if no pin has valid ELD,

audio driver can think about that no monitor connected with DDI ports.

Quoted 2 lines

In this case, Audio driver could release power-well and enter suspend mode automatically, this avoid blocking eDP feature enabling. And once gfx

dirver Detect external monitor connected, it will also wake up audio driver.

Quoted 2 lines

Takashi, do you think this solution acceptable?

It's the current situation, isn't it? So the question is only whether this works _as expected_.

Basically system/user needs to set up two parameters for the audio power-saving. If both are set well, but it still doesn't work, we need to debug.

Of course, we can improve things, for example, the default runtime PM setup. (Note that this is about the default value, not the value force to set.)

Takashi

Quoted 125 lines

Thanks
--xingchao

Quoted 121 lines

So I think we already have the means (albeit with that quirky hw interface, but it seems to have been good enough for a long time already) to do that. Or do I miss something?
-Daniel

Quoted 77 lines

Thanks
--xingchao

Quoted 73 lines

-----Original Message-----
From: Wang, Xingchao
Sent: Thursday, July 18, 2013 7:18 AM
To: 'Takashi Iwai'; David Henningsson; Paulo Zanoni
Cc: [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon
Subject: RE: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 61 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 10:22 PM
To: David Henningsson
Cc: Paulo Zanoni; Wang, Xingchao; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 35 lines · David Henningsson
Quoted 33 lines · Takashi Iwai
Quoted 32 lines · Paulo Zanoni

2013/7/17 Wang, Xingchao <[email protected]>:

Quoted 30 lines
Quoted 30 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 4:18 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 16 lines · Xingchao
Quoted 16 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 3:34 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel
Vetter; [email protected];
[email protected]; Wang xingchao;
Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7]
Power-well API implementation for Haswell

At Wed, 17 Jul 2013 02:52:41 +0000, Wang, Xingchao wrote:

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Hi Takashi/Paulo,

would you change it to "auto" and test again.
Runtime power save should be enabled with "auto".

Doesn't solve the problem. Should I open a bug
report

somewhere?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Having the power well enabled prevents some power
saving features from the graphics driver.

Is the HD-audio power-saving itself working? You
can check it via watching
/sys/class/hwC*/power_{on|off}_acct

files.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

power_save option has to be adjusted appropriately.
Note that many DEs change this value dynamically
per AC-cable plug/unplug depending on the
configuration, and often it's set to 0 (= no power
save) when AC-cable is

plugged.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

[Wang, Xingchao] Paulo used a new Ultrabook board
with charger connected,
and see the default parameter "auto=on".
In such scenario, power-well is always occupied by
Display audio controller. Moreover, in this board,
if no external monitors connected, It's
using internal eDP and totally no audio support.
Power-well usage in such case also blocks some eDP
features as

Paulo told me.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

So I think it's not a good idea to break the rule of
power policy when charger
connected but it's necessary to add support in this
particular

case.

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

Takashi, do you think it's acceptable to let Display
audio controller/codec
suspend in such case?

Do you mean the driver enables the powersave forcibly?

Yes. I mean call pm_runtime_allow() for the power-well HD-A

controller.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Then, no, not in general.

If the default parameter of autopm is the problem,
this should be changed, instead of forcing the policy in the

driver.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

OTOH, the audio codec's powersave policy is governed
by the power_save option and it's set up dynamically
by the desktop

system.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

We shouldn't override it in the driver.

If the power well *must* be off when only an eDP is used

(e.g.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

otherwise the hardware doesn't work properly), then it's a
different story. Is it the case? And what exactly would

be

Quoted 6 lines
Quoted 6 lines

the

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

problem?

In the eDP only case, no audio is needed for the HD-A controller, so it's

wasting power in current design.

Quoted 1 line

I think Paulo or Daniel could explain more details on the

impact.

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Consuming more power is the expected behavior. What else?

Quoted 3 lines
Quoted 3 lines

If it's the case, controlling the power well based on
the runtime PM is likely a bad design, as it relies
on the parameter user

sets.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

(And remember that the power-saving of the audio can
be disabled completely via Kconfig, too.)

From audio controller's point of view, if it's asked
be active, it needs power

and should request power-well from gfx side.

Quoted 2 lines

In above case, audio controller should not be active but user set it be

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

"active".

By setting the autopm "on", user expects that no runtime PM

happens.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

In other words, the audio controller must be kept active as long as this parameter is set. And this is the parameter user controls, and not what the driver forcibly

sets.

Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Okay, become clear now. :) So I think the conflict for Paulo becomes, in eDP caes, if audio is active

and requested power-well, some eDP feature was under impact?

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 1 line

Paulo, would you clarify this in more details?

On our driver we try to disable the power well whenever possible, as soon as possible. We don't change our behavior based on power AC or other user-space modifiable behavior (except the i915.disable_power_well Kernel option). If the power well is not disabled we can't enable some features, like PSR (panel self refresh, and eDP feature) or PC8, which is another power-saving feature. This will also make our QA procedures a lot more complex since when we want to test specific features (e.g., PSR, PC8) we'll have to disconnect the AC adapter or run scripts. So the behavior/predictability of our driver will be based on the Audio driver

power management policies.

Quoted 16 lines
Quoted 15 lines

So all missing feature are about the power saving?

Quoted 5 lines

I am not so experienced with general Linux Power Management code, so maybe the way the Audio driver is behaving is just the usual way, but I have to admit I was expecting the audio driver would only require the power well when it is actually needed, and release it as soon as possible.

It would behave so, if all setups are for power-saving.

But, in your case, the runtime PM control attribute shows "on"; it implies that the runtime PM is effectively disabled, thus disabling power well is also impossible (because it would require turning off the audio controller, too).

Quoted 28 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

So, if the machine only has an eDP (which has no audio function in itself, right?) and never HDMI, DP output because there are no such physical ports, the audio controller has no

function.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Maybe we can, before doing anything else, ask the video driver first if this is the case, and if so, never create the sound card at all, and just leave things the way the video driver

wants?

Quoted 20 lines
Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines

Well, doesn't BIOS mark HDMI/DP audio pins as unused? Then the audio driver won't create any instances. Of course, we can optimize such a case, indeed.

As I know, the eDP only case doesnot mean no HDMI/DP support. User would plug in HDMI/DP monitor at any time.
So diable audio controller totoally is not a good idea. :(. Paulo, is that correct for you case?

Quoted 4 lines
Quoted 4 lines

--xingchao

Quoted 3 lines

Takashi

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

From b83355ffd6babee0a71c5c892b1872a7601643e3 Mon Sep 17 00:00:00 2001
From: Wang Xingchao <[email protected]>
Date: Wed, 24 Jul 2013 17:38:33 +0800
Subject: [PATCH RFC] ALSA: hda - Change power-save policy for power-well
regression

This patch intended to fix power-well regression on Haswell.

On Harris Beach(Ultrabook with battery), there's only eDP panel connected by default, no HDMI/DP. And gfx driver needs enable some HW feature for eDP, power-well *must* be disabled in this scenario.
- Witout charger connected, power-well feature is perfect
- with charger connected, audio never release power-well.

Basically, power-well should be release if audio driver doesnot use it, that's why we enabled runtime power-save feature.

In second case above, with charger connected, the parameter under "/sys/devices/../power/control" become "on" always.
In audio driver side, power_save was set to "0", which disable power_down the codecs and controller, thus never release power->usage_count.

And this blocks audio driver release power-well.

In the second case, if audio driver detect hdmi pins are free and no Apps opened device, it will eanble runtime power-save feature as an exception.

I test this patch on Harris beach with charger connected, the power-well could be released as expected.

---
 sound/pci/hda/hda_codec.h  |    1 +
 sound/pci/hda/hda_intel.c  |   56 ++++++++++++++++++++++++++++++++++++++++++++
 sound/pci/hda/patch_hdmi.c |   31 ++++++++++++++++++++++++
 3 files changed, 88 insertions(+)
sound/pci/hda/hda_codec.h +1 -0
index 701c2e0..7a2030d 100644
@@ -726,6 +726,7 @@ struct hda_codec_ops {
 	int (*check_power_status)(struct hda_codec *codec, hda_nid_t nid);
 #endif
 	void (*reboot_notify)(struct hda_codec *codec);
+	bool (*codec_busy)(struct hda_codec *codec);
 };
 
 /* record for amp information cache */
sound/pci/hda/hda_intel.c +56 -0

101 lines not on this page · raw message

sound/pci/hda/patch_hdmi.c +31 -0
index 030ca86..a692078 100644
@@ -1882,6 +1882,22 @@ static int generic_hdmi_resume(struct hda_codec *codec)
 }
 #endif
 
+bool generic_hdmi_busy(struct hda_codec *codec)
+{
+	struct hdmi_spec *spec = codec->spec;
+	struct hdmi_eld *eld;
+	int pin_idx;
+
+	for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
+		eld = &get_pin(spec, pin_idx)->sink_eld;
+		if (eld->monitor_present ||
+				eld->eld_valid)
+			return true;
+	}
+	snd_printdd("HDMI pins free now\n");
+	return false;
+}
+
 static const struct hda_codec_ops generic_hdmi_patch_ops = {
 	.init			= generic_hdmi_init,
 	.free			= generic_hdmi_free,
@@ -1891,8 +1907,23 @@ static const struct hda_codec_ops generic_hdmi_patch_ops = {
 #ifdef CONFIG_PM
 	.resume			= generic_hdmi_resume,
 #endif
+	.codec_busy		= generic_hdmi_busy,
 };
 
+bool intel_haswell_pins_busy(struct hda_codec *codec)
+{
+	struct hdmi_spec *spec = codec->spec;
+	struct hdmi_eld *eld;
+	int pin_idx;
+
+	for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
+		eld = &get_pin(spec, pin_idx)->sink_eld;
+		if (eld->monitor_present ||
+				eld->eld_valid)
+			return true;
+	}
+	return false;
+}
 
 static void intel_haswell_fixup_connect_list(struct hda_codec *codec,
 					     hda_nid_t nid)
Signature · 1 line
1.7.9.5
#29 lore raw

At Wed, 24 Jul 2013 10:31:22 +0000,

Quoted 5 lines · Xingchao

Hi Paulo,

Would you help verify attached patch to fix this issue for you?

Quoted 7 lines

The patch is based on Takashi's tree, the last commit is:
commit 9b298cfe296c0f8e088b9ed9a670783a06005e6b I think it should be safe to merge into your tree. :)

I tested the patch on Harris Beach, it would let audio driver release power-well even with charger connected.

Please note maybe this is not the final solution for this issue as it breaks some rule from user's point of view.

Well, this patch is NACK from my side.
Sorry, but this is a wrong approach.

Quoted 9 lines

Some background of this issue:
This patch intended to fix power-well regression on Haswell.

On Harris Beach(Ultrabook with battery), there's only eDP panel connected by default, no HDMI/DP. And gfx driver needs enable some HW feature for eDP, power-well *must* be disabled in this scenario.
- Witout charger connected, power-well feature is perfect
- with charger connected, audio never release power-well.

Quoted 5 lines

Basically, power-well should be release if audio driver doesnot use it, that's why we enabled runtime power-save feature.

In second case above, with charger connected, the parameter under "/sys/devices/../power/control" become "on" always.

Why this is set to "on" *always*, even if the device can be actually controlled via runtime PM?

Quoted 2 lines

In audio driver side, power_save was set to "0", which disable power_down the codecs and controller, thus never release power->usage_count.

Why it is set to zero at all?

Quoted 7 lines

And this blocks audio driver release power-well.

In the second case, if audio driver detect hdmi pins are free and no Apps opened device, it will eanble runtime power-save feature as an exception.

I test this patch on Harris beach with charger connected, the power-well could be released as expected.

The primary problem is that these flags are set.

You're trying to implement an "ignore stop-signs on the street if no other cars are running around you" feature in a new auto-cruise system. It would work, but it's not what's accepted in general. (And it makes things complicated and fragile.)

The real question is why there are two useless STOP signs there.

thanks,

Takashi

Quoted 319 lines

Thanks
--xingchao

Quoted 286 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Thursday, July 18, 2013 5:35 PM
To: Wang, Xingchao
Cc: Daniel Vetter; Paulo Zanoni; [email protected]; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon; David Henningsson
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Thu, 18 Jul 2013 09:23:57 +0000,

Quoted 37 lines · Xingchao
Quoted 37 lines

-----Original Message-----
From: Daniel Vetter [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Thursday, July 18, 2013 2:44 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; [email protected]; Daniel Vetter; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon; Takashi Iwai; David Henningsson
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 6 lines · Xingchao

Hi Paulo/Daniel,

Do you agree to export an API in gfx side for eDP case? Basically the api will let audio drver know which pipe in use. i.e. in the eDP only caes, audio driver Will know gfx is not using HDMI/DP and would

like to let power-well off.

Quoted 2 lines

As there's the conflict when user expect display audio driver always active but

gfx need audio driver off.

Quoted 2 lines

Audio driver could make decision to release power-well if it knows the eDP

only case through the API.

Quoted 4 lines

OTOH, I think audio driver could also export an API for gfx side, if gfx driver need audio driver release power-well but it's in usage, It will call

this API and audio drvier will release power-well accordingly.

Quoted 3 lines

This change make HDMI/DP hotplug handling complicated in audio driver side,

Quoted 7 lines
Quoted 7 lines

if audio driver release power-well, it would enter suspend mode.

Quoted 2 lines

Meanwhile the user may expect it's in active mode, this may cause some

confuse.

Afaik (and I know very little about audio) the audio side already knows which pipes have audio enabled, since we set the respective bit only

when it's needed.

Quoted 4 lines
Quoted 3 lines

And audio will receive the unsolicited even interrupt (or whatever it's called) when this happens.

For haswell, Audio driver can get DDI port/Pin usage information according to

the unsolicited event, not Pipe info.

Quoted 1 line

However at this stage, seems only that is enough: if no pin has valid ELD,

audio driver can think about that no monitor connected with DDI ports.

Quoted 2 lines

In this case, Audio driver could release power-well and enter suspend mode automatically, this avoid blocking eDP feature enabling. And once gfx

dirver Detect external monitor connected, it will also wake up audio driver.

Quoted 2 lines

Takashi, do you think this solution acceptable?

It's the current situation, isn't it? So the question is only whether this works _as expected_.

Basically system/user needs to set up two parameters for the audio power-saving. If both are set well, but it still doesn't work, we need to debug.

Of course, we can improve things, for example, the default runtime PM setup. (Note that this is about the default value, not the value force to set.)

Takashi

Quoted 125 lines

Thanks
--xingchao

Quoted 121 lines

So I think we already have the means (albeit with that quirky hw interface, but it seems to have been good enough for a long time already) to do that. Or do I miss something?
-Daniel

Quoted 77 lines

Thanks
--xingchao

Quoted 73 lines

-----Original Message-----
From: Wang, Xingchao
Sent: Thursday, July 18, 2013 7:18 AM
To: 'Takashi Iwai'; David Henningsson; Paulo Zanoni
Cc: [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon
Subject: RE: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 61 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 10:22 PM
To: David Henningsson
Cc: Paulo Zanoni; Wang, Xingchao; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 35 lines · David Henningsson
Quoted 33 lines · Takashi Iwai
Quoted 32 lines · Paulo Zanoni

2013/7/17 Wang, Xingchao <[email protected]>:

Quoted 30 lines
Quoted 30 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 4:18 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 16 lines · Xingchao

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 3:34 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel
Vetter; [email protected];
[email protected]; Wang xingchao;
Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7]
Power-well API implementation for Haswell

At Wed, 17 Jul 2013 02:52:41 +0000, Wang, Xingchao wrote:

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Hi Takashi/Paulo,

would you change it to "auto" and test again.
Runtime power save should be enabled with "auto".

Doesn't solve the problem. Should I open a bug
report

somewhere?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Having the power well enabled prevents some power
saving features from the graphics driver.

Is the HD-audio power-saving itself working? You
can check it via watching
/sys/class/hwC*/power_{on|off}_acct

files.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

power_save option has to be adjusted appropriately.
Note that many DEs change this value dynamically
per AC-cable plug/unplug depending on the
configuration, and often it's set to 0 (= no power
save) when AC-cable is

plugged.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

[Wang, Xingchao] Paulo used a new Ultrabook board
with charger connected,
and see the default parameter "auto=on".
In such scenario, power-well is always occupied by
Display audio controller. Moreover, in this board,
if no external monitors connected, It's
using internal eDP and totally no audio support.
Power-well usage in such case also blocks some eDP
features as

Paulo told me.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

So I think it's not a good idea to break the rule of
power policy when charger
connected but it's necessary to add support in this
particular

case.

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Takashi, do you think it's acceptable to let Display
audio controller/codec
suspend in such case?

Do you mean the driver enables the powersave forcibly?

Yes. I mean call pm_runtime_allow() for the power-well
HD-A

controller.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Then, no, not in general.

If the default parameter of autopm is the problem,
this should be changed, instead of forcing the policy in the

driver.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

OTOH, the audio codec's powersave policy is governed
by the power_save option and it's set up dynamically
by the desktop

system.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

We shouldn't override it in the driver.

If the power well *must* be off when only an eDP is used

(e.g.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

otherwise the hardware doesn't work properly), then it's a
different story. Is it the case? And what exactly would

be

Quoted 6 lines
Quoted 6 lines

the

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

problem?
In the eDP only case, no audio is needed for the HD-A
controller, so it's

wasting power in current design.

Quoted 1 line

I think Paulo or Daniel could explain more details on the

impact.

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Consuming more power is the expected behavior. What else?

Quoted 3 lines

If it's the case, controlling the power well based on
the runtime PM is likely a bad design, as it relies
on the parameter user

sets.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

(And remember that the power-saving of the audio can
be disabled completely via Kconfig, too.)
From audio controller's point of view, if it's asked
be active, it needs power

and should request power-well from gfx side.

Quoted 2 lines

In above case, audio controller should not be active
but user set it be

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

"active".

By setting the autopm "on", user expects that no runtime PM

happens.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

In other words, the audio controller must be kept active as long as this parameter is set. And this is the parameter user controls, and not what the driver forcibly

sets.

Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Okay, become clear now. :) So I think the conflict for Paulo becomes, in eDP caes, if audio is active

and requested power-well, some eDP feature was under impact?

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 1 line

Paulo, would you clarify this in more details?

On our driver we try to disable the power well whenever possible, as soon as possible. We don't change our behavior based on power AC or other user-space modifiable behavior (except the i915.disable_power_well Kernel option). If the power well is not disabled we can't enable some features, like PSR (panel self refresh, and eDP feature) or PC8, which is another power-saving feature. This will also make our QA procedures a lot more complex since when we want to test specific features (e.g., PSR, PC8) we'll have to disconnect the AC adapter or run scripts. So the behavior/predictability of our driver will be based on the Audio driver

power management policies.

Quoted 16 lines
Quoted 15 lines

So all missing feature are about the power saving?

Quoted 5 lines

I am not so experienced with general Linux Power Management code, so maybe the way the Audio driver is behaving is just the usual way, but I have to admit I was expecting the audio driver would only require the power well when it is actually needed, and release it as soon as possible.

It would behave so, if all setups are for power-saving.

But, in your case, the runtime PM control attribute shows "on"; it implies that the runtime PM is effectively disabled, thus disabling power well is also impossible (because it would require turning off the audio controller, too).

Quoted 28 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

So, if the machine only has an eDP (which has no audio function in itself, right?) and never HDMI, DP output because there are no such physical ports, the audio controller has no

function.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Maybe we can, before doing anything else, ask the video driver first if this is the case, and if so, never create the sound card at all, and just leave things the way the video driver

wants?

Quoted 20 lines
Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines

Well, doesn't BIOS mark HDMI/DP audio pins as unused? Then the audio driver won't create any instances. Of course, we can optimize such a case, indeed.

As I know, the eDP only case doesnot mean no HDMI/DP support. User would plug in HDMI/DP monitor at any time.
So diable audio controller totoally is not a good idea. :(. Paulo, is that correct for you case?

Quoted 4 lines
Quoted 4 lines

--xingchao

Quoted 3 lines

Takashi

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

[2 0001-ALSA-hda-Change-power-save-policy-for-power-well-reg.patch <application/octet-stream (base64)>]

#30 lore raw

+Rafael.

Quoted 41 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 24, 2013 7:02 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; Daniel Vetter; [email protected]; [email protected]; [email protected]; Girdwood, Liam R; Jin, Gordon; David Henningsson
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Wed, 24 Jul 2013 10:31:22 +0000,

Quoted 10 lines · Xingchao

Hi Paulo,

Would you help verify attached patch to fix this issue for you?

The patch is based on Takashi's tree, the last commit is:
commit 9b298cfe296c0f8e088b9ed9a670783a06005e6b I think it should be safe to merge into your tree. :)

I tested the patch on Harris Beach, it would let audio driver release

power-well even with charger connected.

Quoted 2 lines

Please note maybe this is not the final solution for this issue as it breaks some

rule from user's point of view.

Well, this patch is NACK from my side.
Sorry, but this is a wrong approach.

Quoted 4 lines

Some background of this issue:
This patch intended to fix power-well regression on Haswell.

On Harris Beach(Ultrabook with battery), there's only eDP panel connected

by default, no HDMI/DP.

Quoted 5 lines

And gfx driver needs enable some HW feature for eDP, power-well *must* be disabled in this scenario.
- Witout charger connected, power-well feature is perfect
- with charger connected, audio never release power-well.

Quoted 8 lines
Quoted 5 lines

Basically, power-well should be release if audio driver doesnot use it, that's why we enabled runtime power-save feature.

In second case above, with charger connected, the parameter under "/sys/devices/../power/control" become "on" always.

Why this is set to "on" *always*, even if the device can be actually controlled via runtime PM?

Yes, seems it was changed by App through sysfs. I donot' know much about the user space power manager policy, could Rafael share some information?

Quoted 6 lines
Quoted 3 lines

In audio driver side, power_save was set to "0", which disable power_down the codecs and controller, thus never release

power->usage_count.

Why it is set to zero at all?

I will continue looking into this change.

Quoted 11 lines
Quoted 5 lines

And this blocks audio driver release power-well.

In the second case, if audio driver detect hdmi pins are free and no Apps opened device, it will eanble runtime power-save feature as an

exception.

Quoted 3 lines

I test this patch on Harris beach with charger connected, the power-well could be released as expected.

The primary problem is that these flags are set.

Yes, I agree. I'm debugging this issue on Ubuntu, not sure it happens on other distribution too. If it's related to Ubuntu, maybe need check Ubuntu power policy. Does anyone know the Ubuntu power-policy on laptop? i.e. when charger connected, will Ubuntu make decision to disable power-save feature for audio subsystem?

Quoted 7 lines

You're trying to implement an "ignore stop-signs on the street if no other cars are running around you" feature in a new auto-cruise system. It would work, but it's not what's accepted in general.
(And it makes things complicated and fragile.)

The real question is why there are two useless STOP signs there.

Thanks for clarify this. I also think it's not a good solution to make changes inside audio dirver. :( Donot worry, I will continue to investigate this.

Thanks
--xingchao

Quoted 349 lines

thanks,

Takashi

Quoted 82 lines

Thanks
--xingchao

Quoted 79 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Thursday, July 18, 2013 5:35 PM
To: Wang, Xingchao
Cc: Daniel Vetter; Paulo Zanoni; [email protected]; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon; David Henningsson
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Thu, 18 Jul 2013 09:23:57 +0000,

Quoted 37 lines · Xingchao
Quoted 37 lines

-----Original Message-----
From: Daniel Vetter [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Thursday, July 18, 2013 2:44 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; [email protected]; Daniel Vetter; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon; Takashi Iwai; David Henningsson
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 6 lines · Xingchao

Hi Paulo/Daniel,

Do you agree to export an API in gfx side for eDP case? Basically the api will let audio drver know which pipe in use. i.e. in the eDP only caes, audio driver Will know gfx is not using HDMI/DP and would

like to let power-well off.

Quoted 2 lines

As there's the conflict when user expect display audio driver always active but

gfx need audio driver off.

Quoted 2 lines

Audio driver could make decision to release power-well if it knows the eDP

only case through the API.

Quoted 4 lines

OTOH, I think audio driver could also export an API for gfx side, if gfx driver need audio driver release power-well but it's in usage, It will call

this API and audio drvier will release power-well accordingly.

Quoted 3 lines

This change make HDMI/DP hotplug handling complicated in audio driver side,

Quoted 8 lines
Quoted 8 lines

if audio driver release power-well, it would enter suspend mode.

Quoted 2 lines

Meanwhile the user may expect it's in active mode, this may cause some

confuse.

Afaik (and I know very little about audio) the audio side already knows which pipes have audio enabled, since we set the respective bit only

when it's needed.

Quoted 5 lines
Quoted 3 lines

And audio will receive the unsolicited even interrupt (or whatever it's called) when this happens.

For haswell, Audio driver can get DDI port/Pin usage information according to

the unsolicited event, not Pipe info.

Quoted 2 lines

However at this stage, seems only that is enough: if no pin has valid ELD,

audio driver can think about that no monitor connected with DDI ports.

Quoted 3 lines

In this case, Audio driver could release power-well and enter suspend mode automatically, this avoid blocking eDP feature enabling. And once gfx

dirver Detect external monitor connected, it will also wake up audio driver.

Quoted 2 lines

Takashi, do you think this solution acceptable?

It's the current situation, isn't it? So the question is only whether this works _as expected_.

Basically system/user needs to set up two parameters for the audio power-saving. If both are set well, but it still doesn't work, we need to

debug.

Quoted 2 lines
Quoted 2 lines

Of course, we can improve things, for example, the default runtime PM

setup.

Quoted 62 lines
Quoted 62 lines

(Note that this is about the default value, not the value force to set.)

Takashi

Quoted 56 lines

Thanks
--xingchao

Quoted 52 lines

So I think we already have the means (albeit with that quirky hw interface, but it seems to have been good enough for a long time already) to do that. Or do I miss something?
-Daniel

Quoted 47 lines

Thanks
--xingchao

Quoted 43 lines

-----Original Message-----
From: Wang, Xingchao
Sent: Thursday, July 18, 2013 7:18 AM
To: 'Takashi Iwai'; David Henningsson; Paulo Zanoni
Cc: [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon
Subject: RE: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 31 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 10:22 PM
To: David Henningsson
Cc: Paulo Zanoni; Wang, Xingchao; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 19 lines · David Henningsson
Quoted 17 lines · Takashi Iwai
Quoted 16 lines · Paulo Zanoni

2013/7/17 Wang, Xingchao <[email protected]>:

Quoted 14 lines
Quoted 14 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 4:18 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected];
Daniel Vetter; [email protected];
[email protected]; Wang xingchao;
Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4
V7] Power-well API implementation for Haswell

At Wed, 17 Jul 2013 08:03:38 +0000, Wang, Xingchao

Quoted 15 lines · wrote:
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 3:34 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected];
Daniel Vetter; [email protected];
[email protected]; Wang xingchao;
Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4
V7] Power-well API implementation for Haswell

At Wed, 17 Jul 2013 02:52:41 +0000, Wang, Xingchao

Quoted 61 lines · wrote:
Quoted 61 lines
Quoted 49 lines
Quoted 49 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Hi Takashi/Paulo,

would you change it to "auto" and test again.
Runtime power save should be enabled with "auto".

Doesn't solve the problem. Should I open a bug
report

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

somewhere?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Having the power well enabled prevents some
power saving features from the graphics driver.

Is the HD-audio power-saving itself working?
You can check it via watching
/sys/class/hwC*/power_{on|off}_acct

files.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

power_save option has to be adjusted appropriately.
Note that many DEs change this value
dynamically per AC-cable plug/unplug depending
on the configuration, and often it's set to 0
(= no power
save) when AC-cable is

plugged.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

[Wang, Xingchao] Paulo used a new Ultrabook
board with charger connected,
and see the default parameter "auto=on".
In such scenario, power-well is always occupied
by Display audio controller. Moreover, in this
board, if no external monitors connected, It's
using internal eDP and totally no audio support.
Power-well usage in such case also blocks some
eDP features as

Paulo told me.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

So I think it's not a good idea to break the
rule of power policy when charger
connected but it's necessary to add support in
this particular

case.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Takashi, do you think it's acceptable to let
Display audio controller/codec
suspend in such case?

Do you mean the driver enables the powersave forcibly?

Yes. I mean call pm_runtime_allow() for the
power-well HD-A

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

controller.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Then, no, not in general.

If the default parameter of autopm is the
problem, this should be changed, instead of
forcing the policy in the

driver.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

OTOH, the audio codec's powersave policy is
governed by the power_save option and it's set up
dynamically by the desktop

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

system.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

We shouldn't override it in the driver.

If the power well *must* be off when only an eDP
is used

(e.g.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

otherwise the hardware doesn't work properly), then it's

a

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

different story. Is it the case? And what exactly

would

Quoted 11 lines
Quoted 11 lines

be

Quoted 7 lines
Quoted 7 lines

the

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

problem?
In the eDP only case, no audio is needed for the
HD-A controller, so it's
wasting power in current design.
I think Paulo or Daniel could explain more details
on the

impact.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Consuming more power is the expected behavior. What

else?

Quoted 44 lines
Quoted 44 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

If it's the case, controlling the power well
based on the runtime PM is likely a bad design,
as it relies on the parameter user

sets.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

(And remember that the power-saving of the audio
can be disabled completely via Kconfig, too.)
From audio controller's point of view, if it's
asked be active, it needs power
and should request power-well from gfx side.
In above case, audio controller should not be
active but user set it be
"active".

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

By setting the autopm "on", user expects that no
runtime PM

happens.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

In other words, the audio controller must be kept
active as long as this parameter is set. And this
is the parameter user controls, and not what the
driver forcibly

sets.

Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Okay, become clear now. :) So I think the conflict for Paulo becomes, in eDP caes, if audio is active

and requested power-well, some eDP feature was under impact?

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 1 line

Paulo, would you clarify this in more details?

On our driver we try to disable the power well whenever possible, as soon as possible. We don't change our behavior based on power AC or other user-space modifiable behavior (except the i915.disable_power_well Kernel option). If the power well is not disabled we can't enable some features, like PSR (panel self refresh, and eDP feature) or PC8, which is another power-saving feature. This will also make our QA procedures a lot more complex since when we want to test specific features (e.g., PSR, PC8) we'll have to disconnect the AC adapter or run scripts. So the behavior/predictability of our driver will be based on the Audio driver

power management policies.

Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

So all missing feature are about the power saving?

Quoted 5 lines

I am not so experienced with general Linux Power Management code, so maybe the way the Audio driver is behaving is just the usual way, but I have to admit I was expecting the audio driver would only require the power well when it is actually needed, and release it as soon

as possible.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

It would behave so, if all setups are for power-saving.

But, in your case, the runtime PM control attribute shows "on"; it implies that the runtime PM is effectively disabled, thus disabling power well is also impossible (because it would require turning off the audio

controller, too).

Quoted 34 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

So, if the machine only has an eDP (which has no audio function in itself, right?) and never HDMI, DP output because there are no such physical ports, the audio controller has no

Quoted 26 lines

function.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Maybe we can, before doing anything else, ask the video driver first if this is the case, and if so, never create the sound card at all, and just leave things the way the video driver

wants?

Quoted 20 lines
Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines

Well, doesn't BIOS mark HDMI/DP audio pins as unused? Then the audio driver won't create any instances. Of course, we can optimize such a case, indeed.

As I know, the eDP only case doesnot mean no HDMI/DP support. User would plug in HDMI/DP monitor at any time.
So diable audio controller totoally is not a good idea. :(. Paulo, is that correct for you case?

Quoted 4 lines
Quoted 4 lines

--xingchao

Quoted 3 lines

Takashi

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

[2 0001-ALSA-hda-Change-power-save-policy-for-power-well-reg.patch <application/octet-stream (base64)>]

#31 lore raw
Quoted 3 lines · Xingchao

Yes, I agree. I'm debugging this issue on Ubuntu, not sure it happens on other distribution too. If it's related to Ubuntu, maybe need check Ubuntu power policy. Does anyone know the Ubuntu power-policy on laptop? i.e. when charger connected, will Ubuntu make decision to disable power-save feature for audio subsystem?

I'm not a power management expert, but I got a pointer from my team mate to pm-utils:

http://cgit.freedesktop.org/pm-utils/tree/pm/power.d/intel-audio-powersave

If I understand correctly, The scripts in power.d are executed when battery / AC-power is changed.

Takashi, does SUSE also use pm-utils?

Signature · 2 lines
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
#32 lore raw

At Wed, 24 Jul 2013 13:57:55 +0200,

Quoted 9 lines · David Henningsson
Quoted 3 lines · Xingchao

Yes, I agree. I'm debugging this issue on Ubuntu, not sure it happens on other distribution too. If it's related to Ubuntu, maybe need check Ubuntu power policy. Does anyone know the Ubuntu power-policy on laptop? i.e. when charger connected, will Ubuntu make decision to disable power-save feature for audio subsystem?

I'm not a power management expert, but I got a pointer from my team mate to pm-utils:

Quoted 6 lines

http://cgit.freedesktop.org/pm-utils/tree/pm/power.d/intel-audio-powersave

If I understand correctly, The scripts in power.d are executed when battery / AC-power is changed.

Takashi, does SUSE also use pm-utils?

Yes, until 12.3, at least. Since 12.3 and later, some portions have been ported to systemd.

Takashi

#33 lore raw
In reply to David Henningsson
Quoted 5 lines · David Henningsson
Quoted 3 lines · Xingchao

Yes, I agree. I'm debugging this issue on Ubuntu, not sure it happens on other distribution too. If it's related to Ubuntu, maybe need check Ubuntu power policy. Does anyone know the Ubuntu power-policy on laptop? i.e. when charger connected, will Ubuntu make decision to disable power-save feature for audio subsystem?

Quoted 7 lines

I'm not a power management expert, but I got a pointer from my team mate to pm-utils:

http://cgit.freedesktop.org/pm-utils/tree/pm/power.d/intel-audio-powersave

If I understand correctly, The scripts in power.d are executed when battery / AC-power is changed.

To me, this sounds like a user space issue. It requested power on and the kernel delivered.

Trying to modify the kernel to work around that would be insane.

Thanks,
Rafael

---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
z siedziba w Gdansku
ul. Slowackiego 173
80-298 Gdansk

Sad Rejonowy Gdansk Polnoc w Gdansku, VII Wydzial Gospodarczy Krajowego Rejestru Sadowego, numer KRS 101882

NIP 957-07-52-316
Kapital zakladowy 200.000 zl

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

#34 lore raw
Quoted 28 lines

-----Original Message-----
From: Wysocki, Rafael J
Sent: Wednesday, July 24, 2013 9:15 PM
To: David Henningsson
Cc: Wang, Xingchao; Takashi Iwai; Paulo Zanoni; Daniel Vetter; [email protected]; [email protected]; [email protected]; Girdwood, Liam R; Jin, Gordon
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 15 lines · David Henningsson
Quoted 6 lines · Xingchao

Yes, I agree. I'm debugging this issue on Ubuntu, not sure it happens on other distribution too.
If it's related to Ubuntu, maybe need check Ubuntu power policy. Does anyone know the Ubuntu power-policy on laptop?
i.e. when charger connected, will Ubuntu make decision to disable power-save feature for audio subsystem?

I'm not a power management expert, but I got a pointer from my team mate to pm-utils:

http://cgit.freedesktop.org/pm-utils/tree/pm/power.d/intel-audio-power
save

Quoted 6 lines
Quoted 3 lines

If I understand correctly, The scripts in power.d are executed when battery / AC-power is changed.

To me, this sounds like a user space issue. It requested power on and the kernel delivered.

Do you know which user-space application will touch below two flags?
- /sys/devices/pci0000\:00/0000\:00\:03.0/power/control
- /sys/module/snd_hda_intel/parameters/power_save

Thanks
--xingchao

Quoted 5 lines

Trying to modify the kernel to work around that would be insane.

Thanks,
Rafael

#35 lore raw

At Wed, 24 Jul 2013 13:30:16 +0000,

Quoted 33 lines · Xingchao
Quoted 33 lines

-----Original Message-----
From: Wysocki, Rafael J
Sent: Wednesday, July 24, 2013 9:15 PM
To: David Henningsson
Cc: Wang, Xingchao; Takashi Iwai; Paulo Zanoni; Daniel Vetter; [email protected]; [email protected]; [email protected]; Girdwood, Liam R; Jin, Gordon
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 18 lines · David Henningsson
Quoted 6 lines · Xingchao

Yes, I agree. I'm debugging this issue on Ubuntu, not sure it happens on other distribution too.
If it's related to Ubuntu, maybe need check Ubuntu power policy. Does anyone know the Ubuntu power-policy on laptop?
i.e. when charger connected, will Ubuntu make decision to disable power-save feature for audio subsystem?

I'm not a power management expert, but I got a pointer from my team mate to pm-utils:

http://cgit.freedesktop.org/pm-utils/tree/pm/power.d/intel-audio-power
save

If I understand correctly, The scripts in power.d are executed when battery / AC-power is changed.

Quoted 6 lines
Quoted 2 lines

To me, this sounds like a user space issue. It requested power on and the kernel delivered.

Do you know which user-space application will touch below two flags?
- /sys/devices/pci0000\:00/0000\:00\:03.0/power/control
- /sys/module/snd_hda_intel/parameters/power_save

The latter is touched most likely by pm-utils, one of the hooks, as David pointed. The former is unknown, but better to check pm-utils hooks and udev rules.

Takashi

#36 lore raw
Quoted 51 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 24, 2013 9:43 PM
To: Wang, Xingchao
Cc: Wysocki, Rafael J; David Henningsson; Paulo Zanoni; Daniel Vetter; [email protected]; [email protected]; [email protected]; Girdwood, Liam R; Jin, Gordon
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Wed, 24 Jul 2013 13:30:16 +0000,

Quoted 37 lines · Xingchao
Quoted 36 lines

-----Original Message-----
From: Wysocki, Rafael J
Sent: Wednesday, July 24, 2013 9:15 PM
To: David Henningsson
Cc: Wang, Xingchao; Takashi Iwai; Paulo Zanoni; Daniel Vetter; [email protected]; [email protected]; [email protected]; Girdwood, Liam R; Jin, Gordon
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 11 lines · David Henningsson
Quoted 6 lines · Xingchao

Yes, I agree. I'm debugging this issue on Ubuntu, not sure it happens on other distribution too.
If it's related to Ubuntu, maybe need check Ubuntu power policy. Does anyone know the Ubuntu power-policy on laptop? i.e. when charger connected, will Ubuntu make decision to disable power-save feature for audio subsystem?

I'm not a power management expert, but I got a pointer from my team mate to pm-utils:

Quoted 8 lines

http://cgit.freedesktop.org/pm-utils/tree/pm/power.d/intel-audio-p
ower
save

If I understand correctly, The scripts in power.d are executed when battery / AC-power is changed.

To me, this sounds like a user space issue. It requested power on and the kernel delivered.

Quoted 7 lines
Quoted 3 lines

Do you know which user-space application will touch below two flags?
- /sys/devices/pci0000\:00/0000\:00\:03.0/power/control
- /sys/module/snd_hda_intel/parameters/power_save

The latter is touched most likely by pm-utils, one of the hooks, as David pointed. The former is unknown, but better to check pm-utils hooks and udev rules.

Okay, thank you all for pointing out to the right direction. I'm checking the pm-utils mentioned from David. :)

Thanks
--xingchao

Quoted 2 lines

Takashi

#37 lore raw
In reply to Takashi Iwai
Quoted 48 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 24, 2013 9:43 PM
To: Wang, Xingchao
Cc: Wysocki, Rafael J; David Henningsson; Paulo Zanoni; Daniel Vetter; [email protected]; [email protected]; [email protected]; Girdwood, Liam R; Jin, Gordon
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Wed, 24 Jul 2013 13:30:16 +0000,

Quoted 34 lines · Xingchao
Quoted 34 lines

-----Original Message-----
From: Wysocki, Rafael J
Sent: Wednesday, July 24, 2013 9:15 PM
To: David Henningsson
Cc: Wang, Xingchao; Takashi Iwai; Paulo Zanoni; Daniel Vetter; [email protected]; [email protected]; [email protected]; Girdwood, Liam R; Jin, Gordon
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 19 lines · David Henningsson
Quoted 6 lines · Xingchao

Yes, I agree. I'm debugging this issue on Ubuntu, not sure it happens on other distribution too.
If it's related to Ubuntu, maybe need check Ubuntu power policy. Does anyone know the Ubuntu power-policy on laptop? i.e. when charger connected, will Ubuntu make decision to disable power-save feature for audio subsystem?

I'm not a power management expert, but I got a pointer from my team mate to pm-utils:

http://cgit.freedesktop.org/pm-utils/tree/pm/power.d/intel-audio-p
ower
save

If I understand correctly, The scripts in power.d are executed when battery / AC-power is changed.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

To me, this sounds like a user space issue. It requested power on and the kernel delivered.

Do you know which user-space application will touch below two flags?
- /sys/devices/pci0000\:00/0000\:00\:03.0/power/control
- /sys/module/snd_hda_intel/parameters/power_save

The latter is touched most likely by pm-utils, one of the hooks, as David pointed.

Oh yes I found the hook:
./pm/power.d/intel-audio-powersave

--xingchao

Quoted 4 lines

The former is unknown, but better to check pm-utils hooks and udev rules.

Takashi

#38 lore raw

Hi Takashi,

In order to let audio power-save work even with charger connected, two parameters need be modified in userspace pm-utils scripts. I tested the changes under Ubuntu 13.10 on Harris Beach, no matter charger connected or not, runtime power-saving works and power-well will Be released as expected.

Here's my test under Ubuntu 13.04, the changes are:
1) /usr/lib/pm-utils/power.d/intel-audio-powersave case $1 in

    true) audio_powersave 1 ;;
+    false) audio_powersave 10 ;;
-    false) audio_powersave 0 ;;
    help) help;;
    *) exit $NA

esac

Audio will enter power-save mode after 10s inactive period.
2) /usr/lib/pm-utils/power.d/pci_devices

0x040300) # audio
echo "Setting Audio device $id to $1"
+ echo "auto" > $dev/power/control
- echo $1 > $dev/power/control

This keep audio subsystem always on.

This way the user may not let audio subsystem always active, may bring some delay from codec/controllers, or harm some chips. Do you think we should add an exception for Haswell only or just make it as a common solution for audio subsystem?

Thanks
--xingchao

Quoted 77 lines

-----Original Message-----
From: Wang, Xingchao
Sent: Wednesday, July 24, 2013 10:00 PM
To: Takashi Iwai
Cc: Wysocki, Rafael J; David Henningsson; Paulo Zanoni; Daniel Vetter; [email protected]; [email protected]; [email protected]; Girdwood, Liam R; Jin, Gordon
Subject: RE: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 47 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 24, 2013 9:43 PM
To: Wang, Xingchao
Cc: Wysocki, Rafael J; David Henningsson; Paulo Zanoni; Daniel Vetter; [email protected]; [email protected]; [email protected]; Girdwood, Liam R; Jin, Gordon
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Wed, 24 Jul 2013 13:30:16 +0000,

Quoted 35 lines · Xingchao
Quoted 35 lines

-----Original Message-----
From: Wysocki, Rafael J
Sent: Wednesday, July 24, 2013 9:15 PM
To: David Henningsson
Cc: Wang, Xingchao; Takashi Iwai; Paulo Zanoni; Daniel Vetter; [email protected]; [email protected]; [email protected]; Girdwood, Liam R; Jin, Gordon
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 20 lines · David Henningsson
Quoted 6 lines · Xingchao

Yes, I agree. I'm debugging this issue on Ubuntu, not sure it happens on other distribution too.
If it's related to Ubuntu, maybe need check Ubuntu power policy. Does anyone know the Ubuntu power-policy on laptop? i.e. when charger connected, will Ubuntu make decision to disable power-save feature for audio subsystem?

I'm not a power management expert, but I got a pointer from my team mate to pm-utils:

http://cgit.freedesktop.org/pm-utils/tree/pm/power.d/intel-audio
-p
ower
save

If I understand correctly, The scripts in power.d are executed when battery / AC-power is changed.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

To me, this sounds like a user space issue. It requested power on and the kernel delivered.

Do you know which user-space application will touch below two flags?
- /sys/devices/pci0000\:00/0000\:00\:03.0/power/control
- /sys/module/snd_hda_intel/parameters/power_save

The latter is touched most likely by pm-utils, one of the hooks, as David

pointed.

Oh yes I found the hook:
./pm/power.d/intel-audio-powersave

--xingchao

Quoted 4 lines

The former is unknown, but better to check pm-utils hooks and udev rules.

Takashi

#39 lore raw
In reply to Takashi Iwai
Quoted 68 lines

-----Original Message-----
From: Wang, Xingchao
Sent: Wednesday, July 24, 2013 10:00 PM
To: 'Takashi Iwai'
Cc: Wysocki, Rafael J; David Henningsson; Paulo Zanoni; Daniel Vetter; [email protected]; [email protected]; [email protected]; Girdwood, Liam R; Jin, Gordon
Subject: RE: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 54 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 24, 2013 9:43 PM
To: Wang, Xingchao
Cc: Wysocki, Rafael J; David Henningsson; Paulo Zanoni; Daniel Vetter; [email protected]; [email protected]; [email protected]; Girdwood, Liam R; Jin, Gordon
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Wed, 24 Jul 2013 13:30:16 +0000,

Quoted 41 lines · Xingchao
Quoted 31 lines

-----Original Message-----
From: Wysocki, Rafael J
Sent: Wednesday, July 24, 2013 9:15 PM
To: David Henningsson
Cc: Wang, Xingchao; Takashi Iwai; Paulo Zanoni; Daniel Vetter; [email protected]; [email protected]; [email protected]; Girdwood, Liam R; Jin, Gordon
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 17 lines · David Henningsson
Quoted 6 lines · Xingchao

Yes, I agree. I'm debugging this issue on Ubuntu, not sure it happens on other distribution too.
If it's related to Ubuntu, maybe need check Ubuntu power policy. Does anyone know the Ubuntu power-policy on laptop? i.e. when charger connected, will Ubuntu make decision to disable power-save feature for audio subsystem?

I'm not a power management expert, but I got a pointer from my team mate to pm-utils:

http://cgit.freedesktop.org/pm-utils/tree/pm/power.d/intel-audio
-p
ower
save

Quoted 6 lines
Quoted 3 lines

If I understand correctly, The scripts in power.d are executed when battery / AC-power is changed.

To me, this sounds like a user space issue. It requested power on and the kernel delivered.

Do you know which user-space application will touch below two flags?
- /sys/devices/pci0000\:00/0000\:00\:03.0/power/control
- /sys/module/snd_hda_intel/parameters/power_save

Quoted 8 lines
Quoted 1 line

The latter is touched most likely by pm-utils, one of the hooks, as David

pointed.

Oh yes I found the hook:
./pm/power.d/intel-audio-powersave

--xingchao

Quoted 1 line

The former is unknown, but better to check pm-utils hooks and udev rules.

Sound like it's from below hook under Ubuntu:
/usr/lib/pm-utils/power.d/ pci_devices

Here's the output of power control from all pci devices :

xingchao@xingchao-harris-beach:~$ cat /sys/devices/pci0000\:00/0000\:00\:*/power/control
on
on
auto
...
On

The only "auto" is for audio pci device as applied my patch.

And I donot know how Ubuntu change the ac/battery policy yet.

Thanks
--xingchao

Quoted 3 lines
Quoted 3 lines

Takashi

#40 lore raw
In reply to Wang, Xingchao

At Thu, 18 Jul 2013 01:00:07 +0000,

Quoted 8 lines · Xingchao

Hi Paulo/Daniel,

Do you agree to export an API in gfx side for eDP case?
Basically the api will let audio drver know which pipe in use. i.e. in the eDP only caes, audio driver Will know gfx is not using HDMI/DP and would like to let power-well off.
As there's the conflict when user expect display audio driver always active but gfx need audio driver off. Audio driver could make decision to release power-well if it knows the eDP only case through the API.

I don't understand this requirement. We know that no HDMI/DP is plugged in. The problem Paulo has seen is that the power-saving isn't kicked off just because it's turned off explicitly. In other words, this is a system setup issue, after all.

OTOH, if HDMI/DP can be never plugged in, creating a sound device itself doesn't make sense at all. If this is the case, we may improve the audio driver code just to skip the devices with such configurations.

Quoted 5 lines

OTOH, I think audio driver could also export an API for gfx side, if gfx driver need audio driver release power-well but it's in usage, It will call this API and audio drvier will release power-well accordingly.

This change make HDMI/DP hotplug handling complicated in audio driver side, if audio driver release power-well, it would enter suspend mode. Meanwhile the user may expect it's in active mode, this may cause some confuse.

Yes. In general, such a force-to-suspend-the-active-stream event should happen only when the device is really unavailable, but never be done just for saving power.

Takashi

Quoted 194 lines

Thanks
--xingchao

Quoted 190 lines

-----Original Message-----
From: Wang, Xingchao
Sent: Thursday, July 18, 2013 7:18 AM
To: 'Takashi Iwai'; David Henningsson; Paulo Zanoni
Cc: [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon
Subject: RE: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 75 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 10:22 PM
To: David Henningsson
Cc: Paulo Zanoni; Wang, Xingchao; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; Jin, Gordon
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

At Wed, 17 Jul 2013 16:05:43 +0200,

Quoted 31 lines · David Henningsson
Quoted 29 lines · Takashi Iwai
Quoted 28 lines · Paulo Zanoni

2013/7/17 Wang, Xingchao <[email protected]>:

Quoted 26 lines
Quoted 26 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 4:18 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 13 lines · Xingchao
Quoted 13 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 3:34 PM
To: Wang, Xingchao
Cc: Paulo Zanoni; [email protected]; Daniel Vetter; [email protected]; [email protected]; Wang xingchao; Girdwood, Liam R; [email protected]
Subject: Re: [alsa-devel] [Intel-gfx] [PATCH 0/4 V7] Power-well API implementation for Haswell

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines · Xingchao

Hi Takashi/Paulo,

Quoted 4 lines
Quoted 4 lines

would you change it to "auto" and test again.
Runtime power save should be enabled with "auto".

Doesn't solve the problem. Should I open a bug report

somewhere?

Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

Having the power well enabled prevents some power saving
features from the graphics driver.

Is the HD-audio power-saving itself working? You can check it via watching /sys/class/hwC*/power_{on|off}_acct files.

Quoted 7 lines
Quoted 5 lines

power_save option has to be adjusted appropriately. Note that many DEs change this value dynamically per AC-cable plug/unplug depending on the configuration, and often it's set to 0 (= no power save) when AC-cable is plugged.

[Wang, Xingchao] Paulo used a new Ultrabook board with charger connected,

and see the default parameter "auto=on".

Quoted 3 lines

In such scenario, power-well is always occupied by Display audio controller. Moreover, in this board, if no external monitors connected, It's

using internal eDP and totally no audio support. Power-well usage in such case also blocks some eDP features as Paulo told me.

Quoted 3 lines

So I think it's not a good idea to break the rule of power policy when charger

connected but it's necessary to add support in this particular case.

Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Takashi, do you think it's acceptable to let Display audio controller/codec

suspend in such case?

Do you mean the driver enables the powersave forcibly?

Yes. I mean call pm_runtime_allow() for the power-well HD-A

controller.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Then, no, not in general.

If the default parameter of autopm is the problem, this should be changed, instead of forcing the policy in the driver.

OTOH, the audio codec's powersave policy is governed by the power_save option and it's set up dynamically by the desktop

system.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 8 lines
Quoted 6 lines

We shouldn't override it in the driver.

If the power well *must* be off when only an eDP is used (e.g. otherwise the hardware doesn't work properly), then it's a
different story. Is it the case? And what exactly would be the
problem?

In the eDP only case, no audio is needed for the HD-A controller, so it's

wasting power in current design.

Quoted 1 line

I think Paulo or Daniel could explain more details on the impact.

Quoted 17 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Consuming more power is the expected behavior. What else?

Quoted 3 lines
Quoted 3 lines

If it's the case, controlling the power well based on the runtime PM is likely a bad design, as it relies on the parameter user

sets.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 2 lines

(And remember that the power-saving of the audio can be disabled completely via Kconfig, too.)

From audio controller's point of view, if it's asked be
active, it needs power

and should request power-well from gfx side.

Quoted 2 lines

In above case, audio controller should not be active but user set it be

"active".

By setting the autopm "on", user expects that no runtime PM

happens.

Quoted 45 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

In other words, the audio controller must be kept active as long as this parameter is set. And this is the parameter user controls, and not what the driver forcibly sets.

Okay, become clear now. :)
So I think the conflict for Paulo becomes, in eDP caes, if audio is active

and requested power-well, some eDP feature was under impact?

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 1 line

Paulo, would you clarify this in more details?

On our driver we try to disable the power well whenever possible, as soon as possible. We don't change our behavior based on power AC or other user-space modifiable behavior (except the i915.disable_power_well Kernel option). If the power well is not disabled we can't enable some features, like PSR (panel self refresh, and eDP feature) or PC8, which is another power-saving feature. This will also make our QA procedures a lot more complex since when we want to test specific features (e.g., PSR, PC8) we'll have to disconnect the AC adapter or run scripts. So the behavior/predictability of our driver will be based on the Audio driver

power management policies.

Quoted 16 lines
Quoted 9 lines

So all missing feature are about the power saving?

Quoted 5 lines

I am not so experienced with general Linux Power Management code, so maybe the way the Audio driver is behaving is just the usual way, but I have to admit I was expecting the audio driver would only require the power well when it is actually needed, and release it as soon as possible.

Quoted 6 lines

It would behave so, if all setups are for power-saving.

But, in your case, the runtime PM control attribute shows "on"; it implies that the runtime PM is effectively disabled, thus disabling power well is also impossible (because it would require turning off the audio controller, too).

Quoted 6 lines

So, if the machine only has an eDP (which has no audio function in itself, right?) and never HDMI, DP output because there are no such physical ports, the audio controller has no function. Maybe we can, before doing anything else, ask the video driver first if this is the case, and if so, never create the sound card at all, and just leave things the way the video driver wants?

Quoted 3 lines

Well, doesn't BIOS mark HDMI/DP audio pins as unused? Then the audio driver won't create any instances. Of course, we can optimize such a case, indeed.

As I know, the eDP only case doesnot mean no HDMI/DP support. User would plug in HDMI/DP monitor at any time.
So diable audio controller totoally is not a good idea. :(. Paulo, is that correct for you case?

--xingchao

Quoted 3 lines

Takashi