Changeset 0d59ea7e in mainline
- Timestamp:
- 2022-07-02T14:34:36Z (3 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6ab7aad4, a247c32, baa2a33, d9dda26
- Parents:
- 9e9d9bc6
- Location:
- uspace/drv/audio/hdaudio
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/hdaudio/codec.c
r9e9d9bc6 r0d59ea7e 1 1 /* 2 * Copyright (c) 20 14Jiri Svoboda2 * Copyright (c) 2022 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 512 512 codec->address = address; 513 513 codec->in_aw = -1; 514 codec->out_aw = -1; 514 515 515 516 rc = hda_get_subnc(codec, 0, &sfg, &nfg); … … 584 585 goto error; 585 586 } else if (awtype == awt_audio_output) { 586 codec->out_aw_list[codec->out_aw_num++] = aw;587 588 587 rc = hda_get_supp_rates(codec, aw, &rates); 589 588 if (rc != EOK) … … 594 593 goto error; 595 594 596 ddf_msg(LVL_DEBUG, "Output widget %d: rates=0x%x formats=0x%x", 595 if (rates != 0 && formats != 0 && 596 codec->out_aw < 0) { 597 ddf_msg(LVL_DEBUG, "Selected output " 598 "widget %d\n", aw); 599 codec->out_aw = aw; 600 } else { 601 ddf_msg(LVL_DEBUG, "Ignoring output " 602 "widget %d\n", aw); 603 } 604 605 ddf_msg(LVL_NOTE, "Output widget %d: rates=0x%x formats=0x%x", 597 606 aw, rates, formats); 607 codec->out_aw_rates = rates; 608 codec->out_aw_formats = formats; 598 609 } else if (awtype == awt_audio_input) { 599 610 if (codec->in_aw < 0) { … … 616 627 ddf_msg(LVL_DEBUG, "Input widget %d: rates=0x%x formats=0x%x", 617 628 aw, rates, formats); 629 codec->in_aw_rates = rates; 630 codec->in_aw_formats = formats; 618 631 } 619 632 … … 644 657 { 645 658 errno_t rc; 646 int out_aw; 647 int i; 648 649 for (i = 0; i < codec->out_aw_num; i++) { 650 out_aw = codec->out_aw_list[i]; 651 652 /* Configure converter */ 653 654 ddf_msg(LVL_DEBUG, "Configure output converter format"); 655 rc = hda_set_converter_fmt(codec, out_aw, stream->fmt); 656 if (rc != EOK) 657 goto error; 658 659 ddf_msg(LVL_DEBUG, "Configure output converter stream, channel"); 660 rc = hda_set_converter_ctl(codec, out_aw, stream->sid, 0); 661 if (rc != EOK) 662 goto error; 663 } 659 660 /* Configure converter */ 661 ddf_msg(LVL_DEBUG, "Configure output converter format / %d", 662 codec->out_aw); 663 rc = hda_set_converter_fmt(codec, codec->out_aw, stream->fmt); 664 if (rc != EOK) 665 goto error; 666 667 ddf_msg(LVL_DEBUG, "Configure output converter stream, channel"); 668 rc = hda_set_converter_ctl(codec, codec->out_aw, stream->sid, 0); 669 if (rc != EOK) 670 goto error; 664 671 665 672 return EOK; -
uspace/drv/audio/hdaudio/codec.h
r9e9d9bc6 r0d59ea7e 1 1 /* 2 * Copyright (c) 20 14Jiri Svoboda2 * Copyright (c) 2022 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 39 39 #include "stream.h" 40 40 41 #define MAX_OUT_AW 25642 43 41 typedef struct hda_codec { 44 42 hda_t *hda; 45 43 uint8_t address; 46 uint8_t out_aw_list[MAX_OUT_AW]; 44 int out_aw; 45 uint32_t out_aw_rates; 46 uint32_t out_aw_formats; 47 47 int out_aw_num; 48 48 int out_aw_sel; 49 49 int in_aw; 50 uint32_t in_aw_rates; 51 uint32_t in_aw_formats; 50 52 } hda_codec_t; 51 53 -
uspace/drv/audio/hdaudio/hdactl.c
r9e9d9bc6 r0d59ea7e 1 1 /* 2 * Copyright (c) 20 14Jiri Svoboda2 * Copyright (c) 2022 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 670 670 } 671 671 672 static void hda_ctl_check_fifo_error(hda_ctl_t *ctl) 673 { 674 int i; 675 uint8_t sts; 676 677 /* 678 * XXX Ideally the interrupt handler would tell us which stream 679 * has the error. 680 */ 681 682 for (i = 0; i < 30; i++) { 683 sts = hda_reg8_read(&ctl->hda->regs->sdesc[i].sts); 684 if ((sts & BIT_V(uint8_t, sdsts_fifoe)) != 0 && (sts & 0x80) == 0) { 685 ddf_msg(LVL_WARN, "sts[%d] = 0x%hhx\n", i, sts); 686 hda_reg8_write(&ctl->hda->regs->sdesc[i].sts, 687 BIT_V(uint8_t, sdsts_fifoe)); 688 } 689 } 690 } 691 672 692 void hda_ctl_interrupt(hda_ctl_t *ctl) 673 693 { 694 ddf_msg(LVL_DEBUG, "hda_ctl_interrupt"); 695 hda_ctl_check_fifo_error(ctl); 674 696 hda_ctl_process_rirb(ctl); 675 697 } -
uspace/drv/audio/hdaudio/hdaudio.c
r9e9d9bc6 r0d59ea7e 1 1 /* 2 * Copyright (c) 20 14Jiri Svoboda2 * Copyright (c) 2022 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 140 140 .cmd = CMD_PIO_WRITE_8, 141 141 .addr = NULL, /* sdesc[x].sts */ 142 .value = 0x4 /* XXX sdesc.sts.BCIS */142 .value = BIT_V(uint8_t, sdsts_bcis) 143 143 }, 144 144 /* 4 */ -
uspace/drv/audio/hdaudio/pcm_iface.c
r9e9d9bc6 r0d59ea7e 1 1 /* 2 * Copyright (c) 20 14Jiri Svoboda2 * Copyright (c) 2022 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 132 132 *channels, *rate, *format); 133 133 134 if (*channels != 1) {134 if (*channels != 2) { 135 135 *channels = 2; 136 136 rc = ELIMIT; -
uspace/drv/audio/hdaudio/spec/regs.h
r9e9d9bc6 r0d59ea7e 1 1 /* 2 * Copyright (c) 20 14Jiri Svoboda2 * Copyright (c) 2022 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 165 165 } hda_regs_t; 166 166 167 /** Stream Descriptor Control bits */ 167 168 typedef enum { 168 169 /** Descriptor Error Interrupt Enable */ … … 177 178 sdctl1_srst = 0 178 179 } hda_sdesc_ctl1_bits; 180 181 /** Stream Descriptor Status bits */ 182 typedef enum { 183 /** FIFO Ready */ 184 sdctl1_fifordy = 3, 185 /** Descriptor Error */ 186 sdsts_dese = 2, 187 /** FIFO Error */ 188 sdsts_fifoe = 1, 189 /** Buffer Completion Interrupt Status */ 190 sdsts_bcis = 2 191 } hda_sdesc_sts_bits; 179 192 180 193 typedef enum { -
uspace/drv/audio/hdaudio/stream.c
r9e9d9bc6 r0d59ea7e 1 1 /* 2 * Copyright (c) 20 14Jiri Svoboda2 * Copyright (c) 2022 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 166 166 uint8_t ctl3; 167 167 168 /* Stream ID */ 168 169 ctl3 = (stream->sid << 4); 169 ctl1 = 0x4; 170 171 /* Interrupt on buffer completion */ 172 ctl1 = BIT_V(uint8_t, sdctl1_ioce); 170 173 171 174 sdregs = &stream->hda->regs->sdesc[stream->sdid];
Note:
See TracChangeset
for help on using the changeset viewer.