Lines Matching refs:chip

44 azx_assign_device(struct azx *chip, struct snd_pcm_substream *substream)  in azx_assign_device()  argument
48 s = snd_hdac_stream_assign(azx_bus(chip), substream); in azx_assign_device()
95 struct azx *chip = apcm->chip; in azx_pcm_close() local
98 trace_azx_pcm_close(chip, azx_dev); in azx_pcm_close()
99 mutex_lock(&chip->open_mutex); in azx_pcm_close()
104 mutex_unlock(&chip->open_mutex); in azx_pcm_close()
113 struct azx *chip = apcm->chip; in azx_pcm_hw_params() local
117 trace_azx_pcm_hw_params(chip, azx_dev); in azx_pcm_hw_params()
127 ret = chip->ops->substream_alloc_pages(chip, substream, in azx_pcm_hw_params()
138 struct azx *chip = apcm->chip; in azx_pcm_hw_free() local
149 err = chip->ops->substream_free_pages(chip, substream); in azx_pcm_hw_free()
158 struct azx *chip = apcm->chip; in azx_pcm_prepare() local
168 trace_azx_pcm_prepare(chip, azx_dev); in azx_pcm_prepare()
182 dev_err(chip->card->dev, in azx_pcm_prepare()
197 if ((chip->driver_caps & AZX_DCAPS_CTX_WORKAROUND) && in azx_pcm_prepare()
198 stream_tag > chip->capture_streams) in azx_pcm_prepare()
199 stream_tag -= chip->capture_streams; in azx_pcm_prepare()
213 struct azx *chip = apcm->chip; in azx_pcm_trigger() local
214 struct hdac_bus *bus = azx_bus(chip); in azx_pcm_trigger()
223 trace_azx_pcm_trigger(chip, azx_dev, cmd); in azx_pcm_trigger()
226 if (chip->driver_caps & AZX_DCAPS_OLD_SSYNC) in azx_pcm_trigger()
286 unsigned int azx_get_pos_lpib(struct azx *chip, struct azx_dev *azx_dev) in azx_get_pos_lpib() argument
292 unsigned int azx_get_pos_posbuf(struct azx *chip, struct azx_dev *azx_dev) in azx_get_pos_posbuf() argument
298 unsigned int azx_get_position(struct azx *chip, in azx_get_position() argument
306 if (chip->get_position[stream]) in azx_get_position()
307 pos = chip->get_position[stream](chip, azx_dev); in azx_get_position()
309 pos = azx_get_pos_posbuf(chip, azx_dev); in azx_get_position()
318 if (chip->get_delay[stream]) in azx_get_position()
319 delay += chip->get_delay[stream](chip, azx_dev, pos); in azx_get_position()
326 trace_azx_get_position(chip, azx_dev, pos, delay); in azx_get_position()
334 struct azx *chip = apcm->chip; in azx_pcm_pointer() local
337 azx_get_position(chip, azx_dev)); in azx_pcm_pointer()
400 struct azx *chip = apcm->chip; in azx_pcm_open() local
407 mutex_lock(&chip->open_mutex); in azx_pcm_open()
408 azx_dev = azx_assign_device(chip, substream); in azx_pcm_open()
409 trace_azx_pcm_open(chip, azx_dev); in azx_pcm_open()
428 if (chip->align_buffer_size) in azx_pcm_open()
477 mutex_unlock(&chip->open_mutex); in azx_pcm_open()
483 mutex_unlock(&chip->open_mutex); in azx_pcm_open()
492 struct azx *chip = apcm->chip; in azx_pcm_mmap() local
493 if (chip->ops->pcm_mmap_prepare) in azx_pcm_mmap()
494 chip->ops->pcm_mmap_prepare(substream, area); in azx_pcm_mmap()
528 struct azx *chip = bus_to_azx(bus); in snd_hda_attach_pcm_stream() local
535 list_for_each_entry(apcm, &chip->pcm_list, list) { in snd_hda_attach_pcm_stream()
537 dev_err(chip->card->dev, "PCM %d already exists\n", in snd_hda_attach_pcm_stream()
542 err = snd_pcm_new(chip->card, cpcm->name, pcm_dev, in snd_hda_attach_pcm_stream()
552 apcm->chip = chip; in snd_hda_attach_pcm_stream()
560 list_add_tail(&apcm->list, &chip->pcm_list); in snd_hda_attach_pcm_stream()
571 chip->card->dev, in snd_hda_attach_pcm_stream()
592 struct azx *chip = bus_to_azx(bus); in azx_rirb_get_response() local
593 struct hda_bus *hbus = &chip->bus; in azx_rirb_get_response()
603 if (chip->polling_mode || do_poll) in azx_rirb_get_response()
607 chip->poll_count = 0; in azx_rirb_get_response()
627 if (!chip->polling_mode && chip->poll_count < 2) { in azx_rirb_get_response()
628 dev_dbg(chip->card->dev, in azx_rirb_get_response()
632 chip->poll_count++; in azx_rirb_get_response()
637 if (!chip->polling_mode) { in azx_rirb_get_response()
638 dev_warn(chip->card->dev, in azx_rirb_get_response()
641 chip->polling_mode = 1; in azx_rirb_get_response()
645 if (chip->msi) { in azx_rirb_get_response()
646 dev_warn(chip->card->dev, in azx_rirb_get_response()
649 if (chip->ops->disable_msi_reset_irq && in azx_rirb_get_response()
650 chip->ops->disable_msi_reset_irq(chip) < 0) in azx_rirb_get_response()
655 if (chip->probing) { in azx_rirb_get_response()
671 dev_err(chip->card->dev, in azx_rirb_get_response()
674 chip->single_cmd = 1; in azx_rirb_get_response()
691 static int azx_single_wait_for_response(struct azx *chip, unsigned int addr) in azx_single_wait_for_response() argument
697 if (azx_readw(chip, IRS) & AZX_IRS_VALID) { in azx_single_wait_for_response()
699 azx_bus(chip)->rirb.res[addr] = azx_readl(chip, IR); in azx_single_wait_for_response()
705 dev_dbg(chip->card->dev, "get_response timeout: IRS=0x%x\n", in azx_single_wait_for_response()
706 azx_readw(chip, IRS)); in azx_single_wait_for_response()
707 azx_bus(chip)->rirb.res[addr] = -1; in azx_single_wait_for_response()
714 struct azx *chip = bus_to_azx(bus); in azx_single_send_cmd() local
721 if (!((azx_readw(chip, IRS) & AZX_IRS_BUSY))) { in azx_single_send_cmd()
723 azx_writew(chip, IRS, azx_readw(chip, IRS) | in azx_single_send_cmd()
725 azx_writel(chip, IC, val); in azx_single_send_cmd()
726 azx_writew(chip, IRS, azx_readw(chip, IRS) | in azx_single_send_cmd()
728 return azx_single_wait_for_response(chip, addr); in azx_single_send_cmd()
733 dev_dbg(chip->card->dev, in azx_single_send_cmd()
735 azx_readw(chip, IRS), val); in azx_single_send_cmd()
758 struct azx *chip = bus_to_azx(bus); in azx_send_cmd() local
760 if (chip->disabled) in azx_send_cmd()
762 if (chip->single_cmd) in azx_send_cmd()
772 struct azx *chip = bus_to_azx(bus); in azx_get_response() local
774 if (chip->disabled) in azx_get_response()
776 if (chip->single_cmd) in azx_get_response()
784 struct azx *chip = bus_to_azx(bus); in azx_link_power() local
786 if (chip->ops->link_power) in azx_link_power()
787 return chip->ops->link_power(chip, enable); in azx_link_power()
805 azx_get_dsp_loader_dev(struct azx *chip) in azx_get_dsp_loader_dev() argument
807 struct hdac_bus *bus = azx_bus(chip); in azx_get_dsp_loader_dev()
811 if (s->index == chip->playback_index_offset) in azx_get_dsp_loader_dev()
822 struct azx *chip = bus_to_azx(bus); in snd_hda_codec_load_dsp_prepare() local
828 azx_dev = azx_get_dsp_loader_dev(chip); in snd_hda_codec_load_dsp_prepare()
832 chip->saved_azx_dev = *azx_dev; in snd_hda_codec_load_dsp_prepare()
841 *azx_dev = chip->saved_azx_dev; in snd_hda_codec_load_dsp_prepare()
854 struct azx *chip = bus_to_azx(bus); in snd_hda_codec_load_dsp_trigger() local
855 struct azx_dev *azx_dev = azx_get_dsp_loader_dev(chip); in snd_hda_codec_load_dsp_trigger()
865 struct azx *chip = bus_to_azx(bus); in snd_hda_codec_load_dsp_cleanup() local
866 struct azx_dev *azx_dev = azx_get_dsp_loader_dev(chip); in snd_hda_codec_load_dsp_cleanup()
875 *azx_dev = chip->saved_azx_dev; in snd_hda_codec_load_dsp_cleanup()
885 void azx_init_chip(struct azx *chip, bool full_reset) in azx_init_chip() argument
887 if (snd_hdac_bus_init_chip(azx_bus(chip), full_reset)) { in azx_init_chip()
889 if (chip->driver_caps & AZX_DCAPS_CTX_WORKAROUND) in azx_init_chip()
890 azx_writew(chip, RINTCNT, 0xc0); in azx_init_chip()
895 void azx_stop_all_streams(struct azx *chip) in azx_stop_all_streams() argument
897 struct hdac_bus *bus = azx_bus(chip); in azx_stop_all_streams()
905 void azx_stop_chip(struct azx *chip) in azx_stop_chip() argument
907 snd_hdac_bus_stop_chip(azx_bus(chip)); in azx_stop_chip()
916 struct azx *chip = bus_to_azx(bus); in stream_update() local
920 if (!chip->ops->position_check || in stream_update()
921 chip->ops->position_check(chip, azx_dev)) { in stream_update()
930 struct azx *chip = dev_id; in azx_interrupt() local
931 struct hdac_bus *bus = azx_bus(chip); in azx_interrupt()
935 if (azx_has_pm_runtime(chip)) in azx_interrupt()
936 if (!pm_runtime_active(chip->card->dev)) in azx_interrupt()
942 if (chip->disabled) { in azx_interrupt()
947 status = azx_readl(chip, INTSTS); in azx_interrupt()
956 status = azx_readb(chip, RIRBSTS); in azx_interrupt()
959 if (chip->driver_caps & AZX_DCAPS_RIRB_PRE_DELAY) in azx_interrupt()
963 azx_writeb(chip, RIRBSTS, RIRB_INT_MASK); in azx_interrupt()
979 static int probe_codec(struct azx *chip, int addr) in probe_codec() argument
983 struct hdac_bus *bus = azx_bus(chip); in probe_codec()
988 chip->probing = 1; in probe_codec()
991 chip->probing = 0; in probe_codec()
995 dev_dbg(chip->card->dev, "codec #%d probed OK\n", addr); in probe_codec()
1001 struct azx *chip = bus_to_azx(&bus->core); in snd_hda_bus_reset() local
1004 azx_stop_chip(chip); in snd_hda_bus_reset()
1005 azx_init_chip(chip, true); in snd_hda_bus_reset()
1011 static int get_jackpoll_interval(struct azx *chip) in get_jackpoll_interval() argument
1016 if (!chip->jackpoll_ms) in get_jackpoll_interval()
1019 i = chip->jackpoll_ms[chip->dev_index]; in get_jackpoll_interval()
1027 dev_warn(chip->card->dev, in get_jackpoll_interval()
1033 int azx_bus_init(struct azx *chip, const char *model, in azx_bus_init() argument
1036 struct hda_bus *bus = &chip->bus; in azx_bus_init()
1039 err = snd_hdac_bus_init(&bus->core, chip->card->dev, &bus_core_ops, in azx_bus_init()
1044 bus->card = chip->card; in azx_bus_init()
1046 bus->pci = chip->pci; in azx_bus_init()
1049 bus->core.snoop = azx_snoop(chip); in azx_bus_init()
1050 if (chip->get_position[0] != azx_get_pos_lpib || in azx_bus_init()
1051 chip->get_position[1] != azx_get_pos_lpib) in azx_bus_init()
1053 if (chip->bdl_pos_adj) in azx_bus_init()
1054 bus->core.bdl_pos_adj = chip->bdl_pos_adj[chip->dev_index]; in azx_bus_init()
1055 if (chip->driver_caps & AZX_DCAPS_CORBRP_SELF_CLEAR) in azx_bus_init()
1058 if (chip->driver_caps & AZX_DCAPS_RIRB_DELAY) { in azx_bus_init()
1059 dev_dbg(chip->card->dev, "Enable delay in RIRB handling\n"); in azx_bus_init()
1063 if (chip->driver_caps & AZX_DCAPS_4K_BDLE_BOUNDARY) in azx_bus_init()
1070 if (chip->driver_caps & AZX_DCAPS_SYNC_WRITE) { in azx_bus_init()
1071 dev_dbg(chip->card->dev, "Enable sync_write for stable communication\n"); in azx_bus_init()
1081 int azx_probe_codecs(struct azx *chip, unsigned int max_slots) in azx_probe_codecs() argument
1083 struct hdac_bus *bus = azx_bus(chip); in azx_probe_codecs()
1092 if ((bus->codec_mask & (1 << c)) & chip->codec_probe_mask) { in azx_probe_codecs()
1093 if (probe_codec(chip, c) < 0) { in azx_probe_codecs()
1097 dev_warn(chip->card->dev, in azx_probe_codecs()
1107 azx_stop_chip(chip); in azx_probe_codecs()
1108 azx_init_chip(chip, true); in azx_probe_codecs()
1115 if ((bus->codec_mask & (1 << c)) & chip->codec_probe_mask) { in azx_probe_codecs()
1117 err = snd_hda_codec_new(&chip->bus, chip->card, c, &codec); in azx_probe_codecs()
1120 codec->jackpoll_interval = get_jackpoll_interval(chip); in azx_probe_codecs()
1121 codec->beep_mode = chip->beep_mode; in azx_probe_codecs()
1126 dev_err(chip->card->dev, "no codecs initialized\n"); in azx_probe_codecs()
1134 int azx_codec_configure(struct azx *chip) in azx_codec_configure() argument
1137 list_for_each_codec(codec, &chip->bus) { in azx_codec_configure()
1144 static int stream_direction(struct azx *chip, unsigned char index) in stream_direction() argument
1146 if (index >= chip->capture_index_offset && in stream_direction()
1147 index < chip->capture_index_offset + chip->capture_streams) in stream_direction()
1153 int azx_init_streams(struct azx *chip) in azx_init_streams() argument
1162 for (i = 0; i < chip->num_streams; i++) { in azx_init_streams()
1169 dir = stream_direction(chip, i); in azx_init_streams()
1176 if (chip->driver_caps & AZX_DCAPS_SEPARATE_STREAM_TAG) in azx_init_streams()
1180 snd_hdac_stream_init(azx_bus(chip), azx_stream(azx_dev), in azx_init_streams()
1188 void azx_free_streams(struct azx *chip) in azx_free_streams() argument
1190 struct hdac_bus *bus = azx_bus(chip); in azx_free_streams()