Skip to content

Commit 74b0c2d

Browse files
committed
drm/i915, HD-audio: Don't continue probing when nomodeset is given
When a machine is booted with nomodeset option, i915 driver skips the whole initialization. Meanwhile, HD-audio tries to bind wth i915 just by request_symbol() without knowing that the initialization was skipped, and eventually it hits WARN_ON() in i915_request_power_well() and i915_release_power_well() wrongly but still continues probing, even though it doesn't work at all. In this patch, both functions are changed to return an error in case of uninitialized state instead of WARN_ON(), so that HD-audio driver can give up HDMI controller initialization at the right time. Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: <stable@vger.kernel.org> [3.15] Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 7171511 commit 74b0c2d

5 files changed

Lines changed: 24 additions & 17 deletions

File tree

‎drivers/gpu/drm/i915/intel_pm.c‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6024,30 +6024,32 @@ void intel_display_power_put(struct drm_i915_private *dev_priv,
60246024
static struct i915_power_domains *hsw_pwr;
60256025

60266026
/* Display audio driver power well request */
6027-
void i915_request_power_well(void)
6027+
int i915_request_power_well(void)
60286028
{
60296029
struct drm_i915_private *dev_priv;
60306030

6031-
if (WARN_ON(!hsw_pwr))
6032-
return;
6031+
if (!hsw_pwr)
6032+
return -ENODEV;
60336033

60346034
dev_priv = container_of(hsw_pwr, struct drm_i915_private,
60356035
power_domains);
60366036
intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
6037+
return 0;
60376038
}
60386039
EXPORT_SYMBOL_GPL(i915_request_power_well);
60396040

60406041
/* Display audio driver power well release */
6041-
void i915_release_power_well(void)
6042+
int i915_release_power_well(void)
60426043
{
60436044
struct drm_i915_private *dev_priv;
60446045

6045-
if (WARN_ON(!hsw_pwr))
6046-
return;
6046+
if (!hsw_pwr)
6047+
return -ENODEV;
60476048

60486049
dev_priv = container_of(hsw_pwr, struct drm_i915_private,
60496050
power_domains);
60506051
intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO);
6052+
return 0;
60516053
}
60526054
EXPORT_SYMBOL_GPL(i915_release_power_well);
60536055

‎include/drm/i915_powerwell.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#define _I915_POWERWELL_H_
3131

3232
/* For use by hda_i915 driver */
33-
extern void i915_request_power_well(void);
34-
extern void i915_release_power_well(void);
33+
extern int i915_request_power_well(void);
34+
extern int i915_release_power_well(void);
3535

3636
#endif /* _I915_POWERWELL_H_ */

‎sound/pci/hda/hda_i915.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,20 @@
2222
#include <drm/i915_powerwell.h>
2323
#include "hda_i915.h"
2424

25-
static void (*get_power)(void);
26-
static void (*put_power)(void);
25+
static int (*get_power)(void);
26+
static int (*put_power)(void);
2727

28-
void hda_display_power(bool enable)
28+
int hda_display_power(bool enable)
2929
{
3030
if (!get_power || !put_power)
31-
return;
31+
return -ENODEV;
3232

3333
pr_debug("HDA display power %s \n",
3434
enable ? "Enable" : "Disable");
3535
if (enable)
36-
get_power();
36+
return get_power();
3737
else
38-
put_power();
38+
return put_power();
3939
}
4040

4141
int hda_i915_init(void)

‎sound/pci/hda/hda_i915.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
#define __SOUND_HDA_I915_H
1818

1919
#ifdef CONFIG_SND_HDA_I915
20-
void hda_display_power(bool enable);
20+
int hda_display_power(bool enable);
2121
int hda_i915_init(void);
2222
int hda_i915_exit(void);
2323
#else
24-
static inline void hda_display_power(bool enable) {}
24+
static inline int hda_display_power(bool enable) { return 0; }
2525
static inline int hda_i915_init(void)
2626
{
2727
return -ENODEV;

‎sound/pci/hda/hda_intel.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1656,8 +1656,13 @@ static int azx_probe_continue(struct azx *chip)
16561656
"Error request power-well from i915\n");
16571657
goto out_free;
16581658
}
1659+
err = hda_display_power(true);
1660+
if (err < 0) {
1661+
dev_err(chip->card->dev,
1662+
"Cannot turn on display power on i915\n");
1663+
goto out_free;
1664+
}
16591665
#endif
1660-
hda_display_power(true);
16611666
}
16621667

16631668
err = azx_first_init(chip);

0 commit comments

Comments
 (0)