aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWu Fengguang <wfg@linux.intel.com>2008-11-18 19:56:15 -0500
committerTakashi Iwai <tiwai@suse.de>2008-11-19 01:35:21 -0500
commit5457a98039cebf20b564b5c3d73a50615e2b2696 (patch)
tree86f54293f5939e9adf8803e95d68ddb3026d2a37
parentcd896c331dd442c43cd9e23de3f1a4f3c111c292 (diff)
ALSA: hda: make standalone hdmi_fill_audio_infoframe()
code refactor: make a standalone function hdmi_fill_audio_infoframe(). Signed-off-by: Wu Fengguang <wfg@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/patch_intelhdmi.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/sound/pci/hda/patch_intelhdmi.c b/sound/pci/hda/patch_intelhdmi.c
index c95abc47614f..028fce996aa2 100644
--- a/sound/pci/hda/patch_intelhdmi.c
+++ b/sound/pci/hda/patch_intelhdmi.c
@@ -246,24 +246,31 @@ static void hdmi_clear_dip_buffers(struct hda_codec *codec)
246#endif 246#endif
247} 247}
248 248
249static void hdmi_fill_audio_infoframe(struct hda_codec *codec,
250 struct hdmi_audio_infoframe *ai)
251{
252 u8 *params = (u8 *)ai;
253 int i;
254
255 hdmi_debug_dip_size(codec);
256 hdmi_clear_dip_buffers(codec); /* be paranoid */
257
258 hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0);
259 for (i = 0; i < sizeof(ai); i++)
260 hdmi_write_dip_byte(codec, PIN_NID, params[i]);
261}
262
249static void hdmi_setup_audio_infoframe(struct hda_codec *codec, 263static void hdmi_setup_audio_infoframe(struct hda_codec *codec,
250 struct snd_pcm_substream *substream) 264 struct snd_pcm_substream *substream)
251{ 265{
252 struct hdmi_audio_infoframe audio_infoframe = { 266 struct hdmi_audio_infoframe ai = {
253 .type = 0x84, 267 .type = 0x84,
254 .ver = 0x01, 268 .ver = 0x01,
255 .len = 0x0a, 269 .len = 0x0a,
256 .CC02_CT47 = substream->runtime->channels - 1, 270 .CC02_CT47 = substream->runtime->channels - 1,
257 }; 271 };
258 u8 *params = (u8 *)&audio_infoframe;
259 int i;
260
261 hdmi_debug_dip_size(codec);
262 hdmi_clear_dip_buffers(codec); /* be paranoid */
263 272
264 hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0); 273 hdmi_fill_audio_infoframe(codec, &ai);
265 for (i = 0; i < sizeof(audio_infoframe); i++)
266 hdmi_write_dip_byte(codec, PIN_NID, params[i]);
267} 274}
268 275
269 276