Skip to content

Commit ab2a211

Browse files
tiwaigregkh
authored andcommitted
drm/i915, HD-audio: Don't continue probing when nomodeset is given
commit 74b0c2d upstream. 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> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b6dec41 commit ab2a211

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
@@ -5705,30 +5705,32 @@ void intel_display_power_put(struct drm_i915_private *dev_priv,
57055705
static struct i915_power_domains *hsw_pwr;
57065706

57075707
/* Display audio driver power well request */
5708-
void i915_request_power_well(void)
5708+
int i915_request_power_well(void)
57095709
{
57105710
struct drm_i915_private *dev_priv;
57115711

5712-
if (WARN_ON(!hsw_pwr))
5713-
return;
5712+
if (!hsw_pwr)
5713+
return -ENODEV;
57145714

57155715
dev_priv = container_of(hsw_pwr, struct drm_i915_private,
57165716
power_domains);
57175717
intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
5718+
return 0;
57185719
}
57195720
EXPORT_SYMBOL_GPL(i915_request_power_well);
57205721

57215722
/* Display audio driver power well release */
5722-
void i915_release_power_well(void)
5723+
int i915_release_power_well(void)
57235724
{
57245725
struct drm_i915_private *dev_priv;
57255726

5726-
if (WARN_ON(!hsw_pwr))
5727-
return;
5727+
if (!hsw_pwr)
5728+
return -ENODEV;
57285729

57295730
dev_priv = container_of(hsw_pwr, struct drm_i915_private,
57305731
power_domains);
57315732
intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO);
5733+
return 0;
57325734
}
57335735
EXPORT_SYMBOL_GPL(i915_release_power_well);
57345736

‎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
@@ -1707,8 +1707,13 @@ static int azx_probe_continue(struct azx *chip)
17071707
"Error request power-well from i915\n");
17081708
goto out_free;
17091709
}
1710+
err = hda_display_power(true);
1711+
if (err < 0) {
1712+
dev_err(chip->card->dev,
1713+
"Cannot turn on display power on i915\n");
1714+
goto out_free;
1715+
}
17101716
#endif
1711-
hda_display_power(true);
17121717
}
17131718

17141719
err = azx_first_init(chip);

0 commit comments

Comments
 (0)