diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-11-06 10:50:40 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-11-06 10:50:40 -0500 |
commit | 33fa35ed0d7e8996cc68cc2ffc21f12b38fa03c1 (patch) | |
tree | 06edbce704c6d99034f51ce591f1fbaf93fcc1b3 /sound/pci/hda/hda_intel.c | |
parent | c238b4f4038e0e49bb241640610584a088b268b1 (diff) |
ALSA: hda - simplify hda_bus ops callbacks
The hda_bus ops callback take struct hda_bus pointer.
Also, the command callback takes the composed command word, instead of
each small bits in arguments.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_intel.c')
-rw-r--r-- | sound/pci/hda/hda_intel.c | 61 |
1 files changed, 27 insertions, 34 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 614be2ec806f..bf8e6f94aebc 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -527,9 +527,9 @@ static void azx_free_cmd_io(struct azx *chip) | |||
527 | } | 527 | } |
528 | 528 | ||
529 | /* send a command */ | 529 | /* send a command */ |
530 | static int azx_corb_send_cmd(struct hda_codec *codec, u32 val) | 530 | static int azx_corb_send_cmd(struct hda_bus *bus, u32 val) |
531 | { | 531 | { |
532 | struct azx *chip = codec->bus->private_data; | 532 | struct azx *chip = bus->private_data; |
533 | unsigned int wp; | 533 | unsigned int wp; |
534 | 534 | ||
535 | /* add command to corb */ | 535 | /* add command to corb */ |
@@ -577,9 +577,9 @@ static void azx_update_rirb(struct azx *chip) | |||
577 | } | 577 | } |
578 | 578 | ||
579 | /* receive a response */ | 579 | /* receive a response */ |
580 | static unsigned int azx_rirb_get_response(struct hda_codec *codec) | 580 | static unsigned int azx_rirb_get_response(struct hda_bus *bus) |
581 | { | 581 | { |
582 | struct azx *chip = codec->bus->private_data; | 582 | struct azx *chip = bus->private_data; |
583 | unsigned long timeout; | 583 | unsigned long timeout; |
584 | 584 | ||
585 | again: | 585 | again: |
@@ -596,7 +596,7 @@ static unsigned int azx_rirb_get_response(struct hda_codec *codec) | |||
596 | } | 596 | } |
597 | if (time_after(jiffies, timeout)) | 597 | if (time_after(jiffies, timeout)) |
598 | break; | 598 | break; |
599 | if (codec->bus->needs_damn_long_delay) | 599 | if (bus->needs_damn_long_delay) |
600 | msleep(2); /* temporary workaround */ | 600 | msleep(2); /* temporary workaround */ |
601 | else { | 601 | else { |
602 | udelay(10); | 602 | udelay(10); |
@@ -646,9 +646,9 @@ static unsigned int azx_rirb_get_response(struct hda_codec *codec) | |||
646 | */ | 646 | */ |
647 | 647 | ||
648 | /* send a command */ | 648 | /* send a command */ |
649 | static int azx_single_send_cmd(struct hda_codec *codec, u32 val) | 649 | static int azx_single_send_cmd(struct hda_bus *bus, u32 val) |
650 | { | 650 | { |
651 | struct azx *chip = codec->bus->private_data; | 651 | struct azx *chip = bus->private_data; |
652 | int timeout = 50; | 652 | int timeout = 50; |
653 | 653 | ||
654 | while (timeout--) { | 654 | while (timeout--) { |
@@ -671,9 +671,9 @@ static int azx_single_send_cmd(struct hda_codec *codec, u32 val) | |||
671 | } | 671 | } |
672 | 672 | ||
673 | /* receive a response */ | 673 | /* receive a response */ |
674 | static unsigned int azx_single_get_response(struct hda_codec *codec) | 674 | static unsigned int azx_single_get_response(struct hda_bus *bus) |
675 | { | 675 | { |
676 | struct azx *chip = codec->bus->private_data; | 676 | struct azx *chip = bus->private_data; |
677 | int timeout = 50; | 677 | int timeout = 50; |
678 | 678 | ||
679 | while (timeout--) { | 679 | while (timeout--) { |
@@ -696,38 +696,29 @@ static unsigned int azx_single_get_response(struct hda_codec *codec) | |||
696 | */ | 696 | */ |
697 | 697 | ||
698 | /* send a command */ | 698 | /* send a command */ |
699 | static int azx_send_cmd(struct hda_codec *codec, hda_nid_t nid, | 699 | static int azx_send_cmd(struct hda_bus *bus, unsigned int val) |
700 | int direct, unsigned int verb, | ||
701 | unsigned int para) | ||
702 | { | 700 | { |
703 | struct azx *chip = codec->bus->private_data; | 701 | struct azx *chip = bus->private_data; |
704 | u32 val; | ||
705 | |||
706 | val = (u32)(codec->addr & 0x0f) << 28; | ||
707 | val |= (u32)direct << 27; | ||
708 | val |= (u32)nid << 20; | ||
709 | val |= verb << 8; | ||
710 | val |= para; | ||
711 | chip->last_cmd = val; | ||
712 | 702 | ||
703 | chip->last_cmd = val; | ||
713 | if (chip->single_cmd) | 704 | if (chip->single_cmd) |
714 | return azx_single_send_cmd(codec, val); | 705 | return azx_single_send_cmd(bus, val); |
715 | else | 706 | else |
716 | return azx_corb_send_cmd(codec, val); | 707 | return azx_corb_send_cmd(bus, val); |
717 | } | 708 | } |
718 | 709 | ||
719 | /* get a response */ | 710 | /* get a response */ |
720 | static unsigned int azx_get_response(struct hda_codec *codec) | 711 | static unsigned int azx_get_response(struct hda_bus *bus) |
721 | { | 712 | { |
722 | struct azx *chip = codec->bus->private_data; | 713 | struct azx *chip = bus->private_data; |
723 | if (chip->single_cmd) | 714 | if (chip->single_cmd) |
724 | return azx_single_get_response(codec); | 715 | return azx_single_get_response(bus); |
725 | else | 716 | else |
726 | return azx_rirb_get_response(codec); | 717 | return azx_rirb_get_response(bus); |
727 | } | 718 | } |
728 | 719 | ||
729 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 720 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
730 | static void azx_power_notify(struct hda_codec *codec); | 721 | static void azx_power_notify(struct hda_bus *bus); |
731 | #endif | 722 | #endif |
732 | 723 | ||
733 | /* reset codec link */ | 724 | /* reset codec link */ |
@@ -1184,7 +1175,8 @@ static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev) | |||
1184 | return 0; | 1175 | return 0; |
1185 | } | 1176 | } |
1186 | 1177 | ||
1187 | static int azx_attach_pcm_stream(struct hda_codec *codec, struct hda_pcm *cpcm); | 1178 | static int azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec, |
1179 | struct hda_pcm *cpcm); | ||
1188 | 1180 | ||
1189 | /* | 1181 | /* |
1190 | * Codec initialization | 1182 | * Codec initialization |
@@ -1707,9 +1699,10 @@ static void azx_pcm_free(struct snd_pcm *pcm) | |||
1707 | } | 1699 | } |
1708 | 1700 | ||
1709 | static int | 1701 | static int |
1710 | azx_attach_pcm_stream(struct hda_codec *codec, struct hda_pcm *cpcm) | 1702 | azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec, |
1703 | struct hda_pcm *cpcm) | ||
1711 | { | 1704 | { |
1712 | struct azx *chip = codec->bus->private_data; | 1705 | struct azx *chip = bus->private_data; |
1713 | struct snd_pcm *pcm; | 1706 | struct snd_pcm *pcm; |
1714 | struct azx_pcm *apcm; | 1707 | struct azx_pcm *apcm; |
1715 | int pcm_dev = cpcm->device; | 1708 | int pcm_dev = cpcm->device; |
@@ -1827,13 +1820,13 @@ static void azx_stop_chip(struct azx *chip) | |||
1827 | 1820 | ||
1828 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 1821 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
1829 | /* power-up/down the controller */ | 1822 | /* power-up/down the controller */ |
1830 | static void azx_power_notify(struct hda_codec *codec) | 1823 | static void azx_power_notify(struct hda_bus *bus) |
1831 | { | 1824 | { |
1832 | struct azx *chip = codec->bus->private_data; | 1825 | struct azx *chip = bus->private_data; |
1833 | struct hda_codec *c; | 1826 | struct hda_codec *c; |
1834 | int power_on = 0; | 1827 | int power_on = 0; |
1835 | 1828 | ||
1836 | list_for_each_entry(c, &codec->bus->codec_list, list) { | 1829 | list_for_each_entry(c, &bus->codec_list, list) { |
1837 | if (c->power_on) { | 1830 | if (c->power_on) { |
1838 | power_on = 1; | 1831 | power_on = 1; |
1839 | break; | 1832 | break; |