diff options
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 50 |
1 files changed, 41 insertions, 9 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 41ca803a1fff..51cb2a2e4fce 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -1184,6 +1184,7 @@ static void snd_hda_codec_free(struct hda_codec *codec) | |||
1184 | { | 1184 | { |
1185 | if (!codec) | 1185 | if (!codec) |
1186 | return; | 1186 | return; |
1187 | snd_hda_jack_tbl_clear(codec); | ||
1187 | restore_init_pincfgs(codec); | 1188 | restore_init_pincfgs(codec); |
1188 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 1189 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
1189 | cancel_delayed_work(&codec->power_work); | 1190 | cancel_delayed_work(&codec->power_work); |
@@ -1192,6 +1193,7 @@ static void snd_hda_codec_free(struct hda_codec *codec) | |||
1192 | list_del(&codec->list); | 1193 | list_del(&codec->list); |
1193 | snd_array_free(&codec->mixers); | 1194 | snd_array_free(&codec->mixers); |
1194 | snd_array_free(&codec->nids); | 1195 | snd_array_free(&codec->nids); |
1196 | snd_array_free(&codec->cvt_setups); | ||
1195 | snd_array_free(&codec->conn_lists); | 1197 | snd_array_free(&codec->conn_lists); |
1196 | snd_array_free(&codec->spdif_out); | 1198 | snd_array_free(&codec->spdif_out); |
1197 | codec->bus->caddr_tbl[codec->addr] = NULL; | 1199 | codec->bus->caddr_tbl[codec->addr] = NULL; |
@@ -2333,6 +2335,8 @@ int snd_hda_codec_reset(struct hda_codec *codec) | |||
2333 | /* free only driver_pins so that init_pins + user_pins are restored */ | 2335 | /* free only driver_pins so that init_pins + user_pins are restored */ |
2334 | snd_array_free(&codec->driver_pins); | 2336 | snd_array_free(&codec->driver_pins); |
2335 | restore_pincfgs(codec); | 2337 | restore_pincfgs(codec); |
2338 | snd_array_free(&codec->cvt_setups); | ||
2339 | snd_array_free(&codec->spdif_out); | ||
2336 | codec->num_pcms = 0; | 2340 | codec->num_pcms = 0; |
2337 | codec->pcm_info = NULL; | 2341 | codec->pcm_info = NULL; |
2338 | codec->preset = NULL; | 2342 | codec->preset = NULL; |
@@ -4393,20 +4397,19 @@ void snd_hda_update_power_acct(struct hda_codec *codec) | |||
4393 | codec->power_jiffies += delta; | 4397 | codec->power_jiffies += delta; |
4394 | } | 4398 | } |
4395 | 4399 | ||
4396 | /** | 4400 | /* Transition to powered up, if wait_power_down then wait for a pending |
4397 | * snd_hda_power_up - Power-up the codec | 4401 | * transition to D3 to complete. A pending D3 transition is indicated |
4398 | * @codec: HD-audio codec | 4402 | * with power_transition == -1. */ |
4399 | * | 4403 | static void __snd_hda_power_up(struct hda_codec *codec, bool wait_power_down) |
4400 | * Increment the power-up counter and power up the hardware really when | ||
4401 | * not turned on yet. | ||
4402 | */ | ||
4403 | void snd_hda_power_up(struct hda_codec *codec) | ||
4404 | { | 4404 | { |
4405 | struct hda_bus *bus = codec->bus; | 4405 | struct hda_bus *bus = codec->bus; |
4406 | 4406 | ||
4407 | spin_lock(&codec->power_lock); | 4407 | spin_lock(&codec->power_lock); |
4408 | codec->power_count++; | 4408 | codec->power_count++; |
4409 | if (codec->power_on || codec->power_transition > 0) { | 4409 | /* Return if power_on or transitioning to power_on, unless currently |
4410 | * powering down. */ | ||
4411 | if ((codec->power_on || codec->power_transition > 0) && | ||
4412 | !(wait_power_down && codec->power_transition < 0)) { | ||
4410 | spin_unlock(&codec->power_lock); | 4413 | spin_unlock(&codec->power_lock); |
4411 | return; | 4414 | return; |
4412 | } | 4415 | } |
@@ -4430,8 +4433,37 @@ void snd_hda_power_up(struct hda_codec *codec) | |||
4430 | codec->power_transition = 0; | 4433 | codec->power_transition = 0; |
4431 | spin_unlock(&codec->power_lock); | 4434 | spin_unlock(&codec->power_lock); |
4432 | } | 4435 | } |
4436 | |||
4437 | /** | ||
4438 | * snd_hda_power_up - Power-up the codec | ||
4439 | * @codec: HD-audio codec | ||
4440 | * | ||
4441 | * Increment the power-up counter and power up the hardware really when | ||
4442 | * not turned on yet. | ||
4443 | */ | ||
4444 | void snd_hda_power_up(struct hda_codec *codec) | ||
4445 | { | ||
4446 | __snd_hda_power_up(codec, false); | ||
4447 | } | ||
4433 | EXPORT_SYMBOL_HDA(snd_hda_power_up); | 4448 | EXPORT_SYMBOL_HDA(snd_hda_power_up); |
4434 | 4449 | ||
4450 | /** | ||
4451 | * snd_hda_power_up_d3wait - Power-up the codec after waiting for any pending | ||
4452 | * D3 transition to complete. This differs from snd_hda_power_up() when | ||
4453 | * power_transition == -1. snd_hda_power_up sees this case as a nop, | ||
4454 | * snd_hda_power_up_d3wait waits for the D3 transition to complete then powers | ||
4455 | * back up. | ||
4456 | * @codec: HD-audio codec | ||
4457 | * | ||
4458 | * Cancel any power down operation hapenning on the work queue, then power up. | ||
4459 | */ | ||
4460 | void snd_hda_power_up_d3wait(struct hda_codec *codec) | ||
4461 | { | ||
4462 | /* This will cancel and wait for pending power_work to complete. */ | ||
4463 | __snd_hda_power_up(codec, true); | ||
4464 | } | ||
4465 | EXPORT_SYMBOL_HDA(snd_hda_power_up_d3wait); | ||
4466 | |||
4435 | #define power_save(codec) \ | 4467 | #define power_save(codec) \ |
4436 | ((codec)->bus->power_save ? *(codec)->bus->power_save : 0) | 4468 | ((codec)->bus->power_save ? *(codec)->bus->power_save : 0) |
4437 | 4469 | ||