|
Lines 4955-4960
void snd_hda_gen_stream_pm(struct hda_codec *codec, hda_nid_t nid, bool on)
Link Here
|
| 4955 |
} |
4955 |
} |
| 4956 |
EXPORT_SYMBOL_GPL(snd_hda_gen_stream_pm); |
4956 |
EXPORT_SYMBOL_GPL(snd_hda_gen_stream_pm); |
| 4957 |
|
4957 |
|
|
|
4958 |
/** |
| 4959 |
* snd_hda_gen_shutup_speakers - Forcibly mute the speaker outputs |
| 4960 |
* @codec: the HDA codec |
| 4961 |
* |
| 4962 |
* Forcibly mute the speaker outputs, to be called at suspend or shutdown. |
| 4963 |
* |
| 4964 |
* The mute state done by this function isn't cached, hence the original state |
| 4965 |
* will be restored at resume. |
| 4966 |
*/ |
| 4967 |
void snd_hda_gen_shutup_speakers(struct hda_codec *codec) |
| 4968 |
{ |
| 4969 |
struct hda_gen_spec *spec = codec->spec; |
| 4970 |
const int *paths; |
| 4971 |
const struct nid_path *path; |
| 4972 |
int i, p, num_paths; |
| 4973 |
hda_nid_t nid; |
| 4974 |
|
| 4975 |
/* if already powered off, do nothing */ |
| 4976 |
if (!snd_hdac_is_power_on(&codec->core)) |
| 4977 |
return; |
| 4978 |
|
| 4979 |
if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 4980 |
paths = spec->out_paths; |
| 4981 |
num_paths = spec->autocfg.line_outs; |
| 4982 |
} else { |
| 4983 |
paths = spec->speaker_paths; |
| 4984 |
num_paths = spec->autocfg.speaker_outs; |
| 4985 |
} |
| 4986 |
|
| 4987 |
for (i = 0; i < num_paths; i++) { |
| 4988 |
path = snd_hda_get_path_from_idx(codec, paths[i]); |
| 4989 |
if (!path) |
| 4990 |
continue; |
| 4991 |
for (p = 0; p < path->depth; p++) { |
| 4992 |
nid = path->path[p]; |
| 4993 |
if (!nid) |
| 4994 |
break; |
| 4995 |
if (!nid_has_mute(codec, nid, HDA_OUTPUT)) |
| 4996 |
continue; /* no mute, skip */ |
| 4997 |
if (snd_hda_codec_amp_read(codec, nid, 0, HDA_OUTPUT, 0) & |
| 4998 |
snd_hda_codec_amp_read(codec, nid, 1, HDA_OUTPUT, 0) & |
| 4999 |
HDA_AMP_MUTE) |
| 5000 |
continue; /* both channels already muted, skip */ |
| 5001 |
/* direct amp update without caching */ |
| 5002 |
snd_hda_codec_write(codec, nid, 0, |
| 5003 |
AC_VERB_SET_AMP_GAIN_MUTE, |
| 5004 |
AC_AMP_SET_OUTPUT | |
| 5005 |
AC_AMP_SET_LEFT | AC_AMP_SET_RIGHT | |
| 5006 |
HDA_AMP_MUTE); |
| 5007 |
} |
| 5008 |
} |
| 5009 |
} |
| 5010 |
EXPORT_SYMBOL_GPL(snd_hda_gen_shutup_speakers); |
| 5011 |
|
| 4958 |
/** |
5012 |
/** |
| 4959 |
* snd_hda_gen_parse_auto_config - Parse the given BIOS configuration and |
5013 |
* snd_hda_gen_parse_auto_config - Parse the given BIOS configuration and |
| 4960 |
* set up the hda_gen_spec |
5014 |
* set up the hda_gen_spec |