Commit 9a19c902 authored by Takashi Iwai's avatar Takashi Iwai

Merge branch 'topic/hda-pm-state' into for-next

Pull HD-audio PM fixes.  They are applied on top of the latest 5.0
development branch.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parents 202e69e6 f6ef4e0e
...@@ -2917,6 +2917,7 @@ static void hda_call_codec_resume(struct hda_codec *codec) ...@@ -2917,6 +2917,7 @@ static void hda_call_codec_resume(struct hda_codec *codec)
hda_jackpoll_work(&codec->jackpoll_work.work); hda_jackpoll_work(&codec->jackpoll_work.work);
else else
snd_hda_jack_report_sync(codec); snd_hda_jack_report_sync(codec);
codec->core.dev.power.power_state = PMSG_ON;
snd_hdac_leave_pm(&codec->core); snd_hdac_leave_pm(&codec->core);
} }
...@@ -2947,10 +2948,48 @@ static int hda_codec_runtime_resume(struct device *dev) ...@@ -2947,10 +2948,48 @@ static int hda_codec_runtime_resume(struct device *dev)
} }
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
#ifdef CONFIG_PM_SLEEP
static int hda_codec_pm_suspend(struct device *dev)
{
dev->power.power_state = PMSG_SUSPEND;
return pm_runtime_force_suspend(dev);
}
static int hda_codec_pm_resume(struct device *dev)
{
dev->power.power_state = PMSG_RESUME;
return pm_runtime_force_resume(dev);
}
static int hda_codec_pm_freeze(struct device *dev)
{
dev->power.power_state = PMSG_FREEZE;
return pm_runtime_force_suspend(dev);
}
static int hda_codec_pm_thaw(struct device *dev)
{
dev->power.power_state = PMSG_THAW;
return pm_runtime_force_resume(dev);
}
static int hda_codec_pm_restore(struct device *dev)
{
dev->power.power_state = PMSG_RESTORE;
return pm_runtime_force_resume(dev);
}
#endif /* CONFIG_PM_SLEEP */
/* referred in hda_bind.c */ /* referred in hda_bind.c */
const struct dev_pm_ops hda_codec_driver_pm = { const struct dev_pm_ops hda_codec_driver_pm = {
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, #ifdef CONFIG_PM_SLEEP
pm_runtime_force_resume) .suspend = hda_codec_pm_suspend,
.resume = hda_codec_pm_resume,
.freeze = hda_codec_pm_freeze,
.thaw = hda_codec_pm_thaw,
.poweroff = hda_codec_pm_suspend,
.restore = hda_codec_pm_restore,
#endif /* CONFIG_PM_SLEEP */
SET_RUNTIME_PM_OPS(hda_codec_runtime_suspend, hda_codec_runtime_resume, SET_RUNTIME_PM_OPS(hda_codec_runtime_suspend, hda_codec_runtime_resume,
NULL) NULL)
}; };
......
...@@ -117,6 +117,7 @@ struct alc_spec { ...@@ -117,6 +117,7 @@ struct alc_spec {
int codec_variant; /* flag for other variants */ int codec_variant; /* flag for other variants */
unsigned int has_alc5505_dsp:1; unsigned int has_alc5505_dsp:1;
unsigned int no_depop_delay:1; unsigned int no_depop_delay:1;
unsigned int done_hp_init:1;
/* for PLL fix */ /* for PLL fix */
hda_nid_t pll_nid; hda_nid_t pll_nid;
...@@ -3372,6 +3373,50 @@ static void alc_default_shutup(struct hda_codec *codec) ...@@ -3372,6 +3373,50 @@ static void alc_default_shutup(struct hda_codec *codec)
snd_hda_shutup_pins(codec); snd_hda_shutup_pins(codec);
} }
static void alc294_hp_init(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
int i, val;
if (!hp_pin)
return;
snd_hda_codec_write(codec, hp_pin, 0,
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
msleep(100);
snd_hda_codec_write(codec, hp_pin, 0,
AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
/* Wait for depop procedure finish */
val = alc_read_coefex_idx(codec, 0x58, 0x01);
for (i = 0; i < 20 && val & 0x0080; i++) {
msleep(50);
val = alc_read_coefex_idx(codec, 0x58, 0x01);
}
/* Set HP depop to auto mode */
alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
msleep(50);
}
static void alc294_init(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
/* required only at boot or S4 resume time */
if (!spec->done_hp_init ||
codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
alc294_hp_init(codec);
spec->done_hp_init = true;
}
alc_default_init(codec);
}
static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg, static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
unsigned int val) unsigned int val)
{ {
...@@ -7373,37 +7418,6 @@ static void alc269_fill_coef(struct hda_codec *codec) ...@@ -7373,37 +7418,6 @@ static void alc269_fill_coef(struct hda_codec *codec)
alc_update_coef_idx(codec, 0x4, 0, 1<<11); alc_update_coef_idx(codec, 0x4, 0, 1<<11);
} }
static void alc294_hp_init(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
int i, val;
if (!hp_pin)
return;
snd_hda_codec_write(codec, hp_pin, 0,
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
msleep(100);
snd_hda_codec_write(codec, hp_pin, 0,
AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
/* Wait for depop procedure finish */
val = alc_read_coefex_idx(codec, 0x58, 0x01);
for (i = 0; i < 20 && val & 0x0080; i++) {
msleep(50);
val = alc_read_coefex_idx(codec, 0x58, 0x01);
}
/* Set HP depop to auto mode */
alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
msleep(50);
}
/* /*
*/ */
static int patch_alc269(struct hda_codec *codec) static int patch_alc269(struct hda_codec *codec)
...@@ -7529,7 +7543,7 @@ static int patch_alc269(struct hda_codec *codec) ...@@ -7529,7 +7543,7 @@ static int patch_alc269(struct hda_codec *codec)
spec->codec_variant = ALC269_TYPE_ALC294; spec->codec_variant = ALC269_TYPE_ALC294;
spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */ spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */ alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
alc294_hp_init(codec); spec->init_hook = alc294_init;
break; break;
case 0x10ec0300: case 0x10ec0300:
spec->codec_variant = ALC269_TYPE_ALC300; spec->codec_variant = ALC269_TYPE_ALC300;
...@@ -7541,7 +7555,7 @@ static int patch_alc269(struct hda_codec *codec) ...@@ -7541,7 +7555,7 @@ static int patch_alc269(struct hda_codec *codec)
spec->codec_variant = ALC269_TYPE_ALC700; spec->codec_variant = ALC269_TYPE_ALC700;
spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */ spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */ alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
alc294_hp_init(codec); spec->init_hook = alc294_init;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment