Print this page
10619 audiohd ignores digital output pins such as HDMI/DP


 115 #define AUDIOHD_RIRB_INTRCNT    0x0
 116 #define AUDIOHD_RIRB_WPMASK     0xff
 117 
 118 #define AUDIOHD_FORM_MASK       0x0080
 119 #define AUDIOHD_LEN_MASK        0x007f
 120 #define AUDIOHD_PIN_CAP_MASK    0x00000010
 121 #define AUDIOHD_PIN_CONF_MASK   0xc0000000
 122 #define AUDIOHD_PIN_CON_MASK    3
 123 #define AUDIOHD_PIN_CON_STEP    30
 124 #define AUDIOHD_PIN_IO_MASK     0X0018
 125 #define AUDIOHD_PIN_SEQ_MASK    0x0000000f
 126 #define AUDIOHD_PIN_ASO_MASK    0x000000f0
 127 #define AUDIOHD_PIN_ASO_OFF     0x4
 128 #define AUDIOHD_PIN_DEV_MASK    0x00f00000
 129 #define AUDIOHD_PIN_DEV_OFF     20
 130 #define AUDIOHD_PIN_NUMS        6
 131 #define AUDIOHD_PIN_NO_CONN     0x40000000
 132 #define AUDIOHD_PIN_IN_ENABLE   0x20
 133 #define AUDIOHD_PIN_OUT_ENABLE  0x40
 134 #define AUDIOHD_PIN_PRES_MASK   0x80000000

 135 #define AUDIOHD_PIN_CONTP_OFF   0x1e
 136 #define AUDIOHD_PIN_CON_JACK    0
 137 #define AUDIOHD_PIN_CON_FIXED   0x2
 138 #define AUDIOHD_PIN_CONTP_MASK  0x3
 139 #define AUDIOHD_PIN_VREF_L1     0x20
 140 #define AUDIOHD_PIN_VREF_L2     0x10
 141 #define AUDIOHD_PIN_VREF_L3     0x04
 142 #define AUDIOHD_PIN_VREF_L4     0x02
 143 #define AUDIOHD_PIN_VREF_OFF    8
 144 #define AUDIOHD_PIN_VREF_MASK   0xff
 145 #define AUDIOHD_PIN_CLR_MASK    0xf
 146 #define AUDIOHD_PIN_CLR_OFF     12
 147 
 148 #define AUDIOHD_VERB_ADDR_OFF   28
 149 #define AUDIOHD_VERB_NID_OFF    20
 150 #define AUDIOHD_VERB_CMD_OFF    8
 151 #define AUDIOHD_VERB_CMD16_OFF  16
 152 
 153 #define AUDIOHD_RING_MAX_SIZE   0x00ff
 154 #define AUDIOHD_REC_TAG_OFF     4


 325 #define AUDIOHDC_VERB_GET_CONN_SEL              0xf01
 326 #define AUDIOHDC_VERB_SET_CONN_SEL              0x701
 327 
 328 #define AUDIOHDC_VERB_GET_CONN_LIST_ENT         0xf02
 329 #define AUDIOHDC_VERB_GET_PROCESS_STATE         0xf03
 330 #define AUDIOHDC_VERB_GET_SDI_SEL               0xf04
 331 
 332 #define AUDIOHDC_VERB_GET_POWER_STATE           0xf05
 333 #define AUDIOHDC_VERB_SET_POWER_STATE           0x705
 334 
 335 #define AUDIOHDC_VERB_GET_STREAM_CHANN          0xf06
 336 #define AUDIOHDC_VERB_SET_STREAM_CHANN          0x706
 337 
 338 #define AUDIOHDC_VERB_GET_PIN_CTRL              0xf07
 339 #define AUDIOHDC_VERB_SET_PIN_CTRL              0x707
 340 
 341 #define AUDIOHDC_VERB_GET_UNS_ENABLE            0xf08
 342 #define AUDIOHDC_VERB_SET_UNS_ENABLE            0x708
 343 
 344 #define AUDIOHDC_VERB_GET_PIN_SENSE             0xf09
 345 #define AUDIOHDC_VERB_GET_PIN_SENSE             0xf09
 346 #define AUDIOHDC_VERB_EXEC_PIN_SENSE            0x709
 347 
 348 #define AUDIOHDC_VERB_GET_BEEP_GEN              0xf0a
 349 #define AUDIOHDC_VERB_SET_BEEP_GEN              0x70a
 350 
 351 #define AUDIOHDC_VERB_GET_EAPD                  0xf0c
 352 #define AUDIOHDC_VERB_SET_EAPD                  0x70c
 353 
 354 #define AUDIOHDC_VERB_GET_DEFAULT_CONF          0xf1c
 355 #define AUDIOHDC_VERB_GET_SPDIF_CTL             0xf0d
 356 #define AUDIOHDC_VERB_SET_SPDIF_LCL             0x70d
 357 
 358 #define AUDIOHDC_VERB_GET_GPIO_MASK             0xf16
 359 #define AUDIOHDC_VERB_SET_GPIO_MASK             0x716
 360 
 361 #define AUDIOHDC_VERB_GET_UNSOL_ENABLE_MASK     0xf19
 362 #define AUDIOHDC_VERB_SET_UNSOL_ENABLE_MASK     0x719
 363 
 364 #define AUDIOHDC_VERB_GET_GPIO_DIREC            0xf17
 365 #define AUDIOHDC_VERB_SET_GPIO_DIREC            0x717
 366 
 367 #define AUDIOHDC_VERB_GET_GPIO_DATA             0xf15
 368 #define AUDIOHDC_VERB_SET_GPIO_DATA             0x715
 369 
 370 #define AUDIOHDC_VERB_GET_GPIO_STCK             0xf1a
 371 #define AUDIOHDC_VERB_SET_GPIO_STCK             0x71a
 372 









 373 #define AUDIOHDC_GPIO_ENABLE                    0xff
 374 #define AUDIOHDC_GPIO_DIRECT                    0xf1
 375 
 376 #define AUDIOHDC_GPIO_DATA_CTRL                 0xff
 377 #define AUDIOHDC_GPIO_STCK_CTRL                 0xff
 378 /*
 379  * 4-bit verbs
 380  */
 381 #define AUDIOHDC_VERB_GET_CONV_FMT              0xa
 382 #define AUDIOHDC_VERB_SET_CONV_FMT              0x2
 383 
 384 #define AUDIOHDC_VERB_GET_AMP_MUTE              0xb
 385 #define AUDIOHDC_VERB_SET_AMP_MUTE              0x3
 386 #define AUDIOHDC_VERB_SET_BEEP_VOL              0x3A0
 387 
 388 /*
 389  * parameters of nodes
 390  */
 391 #define AUDIOHDC_PAR_VENDOR_ID                  0x00
 392 #define AUDIOHDC_PAR_SUBSYS_ID                  0x01


 466 #define AUDIOHD_WIDCAP_PROC_WID         0x00000040
 467 #define AUDIOHD_WIDCAP_UNSOL            0x00000080
 468 #define AUDIOHD_WIDCAP_CONNLIST         0x00000100
 469 #define AUDIOHD_WIDCAP_DIGIT            0x00000200
 470 #define AUDIOHD_WIDCAP_PWRCTRL          0x00000400
 471 #define AUDIOHD_WIDCAP_LRSWAP           0x00000800
 472 #define AUDIOHD_WIDCAP_TYPE             0x00f00000
 473 #define AUDIOHD_WIDCAP_TO_WIDTYPE(wcap)         \
 474         ((wcap & AUDIOHD_WIDCAP_TYPE) >> 20)
 475 
 476 #define AUDIOHD_CODEC_FAILURE   (uint32_t)(-1)
 477 
 478 /* Higher sample/bits support */
 479 #define AUDIOHD_BIT_DEPTH16     0x00020000
 480 #define AUDIOHD_BIT_DEPTH24     0x00080000
 481 #define AUDIOHD_SAMP_RATE48     0x00000040
 482 #define AUDIOHD_SAMP_RATE96     0x00000100
 483 #define AUDIOHD_SAMP_RATE192    0x00000400
 484 
 485 /*




































































































 486  * buffer descriptor list entry of stream descriptor
 487  */
 488 typedef struct {
 489         uint64_t        sbde_addr;
 490         uint32_t        sbde_len;
 491         uint32_t
 492                 sbde_ioc: 1,
 493                 reserved: 31;
 494 }sd_bdle_t;
 495 
 496 
 497 #define AUDIOHD_PLAY_STARTED            0x00000001
 498 #define AUDIOHD_PLAY_EMPTY              0x00000002
 499 #define AUDIOHD_PLAY_PAUSED             0x00000004
 500 #define AUDIOHD_RECORD_STARTED          0x00000008
 501 
 502 enum audiohda_widget_type {
 503         WTYPE_AUDIO_OUT = 0,
 504         WTYPE_AUDIO_IN,
 505         WTYPE_AUDIO_MIX,
 506         WTYPE_AUDIO_SEL,
 507         WTYPE_PIN,
 508         WTYPE_POWER,
 509         WTYPE_VOL_KNOB,
 510         WTYPE_BEEP,
 511         WTYPE_VENDOR = 0xf
 512 };
 513 
 514 enum audiohda_device_type {
 515         DTYPE_LINEOUT = 0,
 516         DTYPE_SPEAKER,
 517         DTYPE_HP_OUT,
 518         DTYPE_CD,
 519         DTYPE_SPDIF_OUT,
 520         DTYPE_DIGIT_OUT,
 521         DTYPE_MODEM_SIDE,
 522         DTYPE_MODEM_HNAD_SIDE,
 523         DTYPE_LINE_IN,
 524         DTYPE_AUX,
 525         DTYPE_MIC_IN,
 526         DTYPE_TEL,
 527         DTYPE_SPDIF_IN,
 528         DTYPE_DIGIT_IN,
 529         DTYPE_OTHER = 0x0f,
 530 };
 531 
 532 enum audiohd_pin_color {
 533         AUDIOHD_PIN_UNKNOWN = 0,
 534         AUDIOHD_PIN_BLACK,
 535         AUDIOHD_PIN_GREY,
 536         AUDIOHD_PIN_BLUE,
 537         AUDIOHD_PIN_GREEN,
 538         AUDIOHD_PIN_RED,
 539         AUDIOHD_PIN_ORANGE,
 540         AUDIOHD_PIN_YELLOW,
 541         AUDIOHD_PIN_PURPLE,
 542         AUDIOHD_PIN_PINK,


 742         uint32_t        config;
 743         uint32_t        ctrl;
 744         uint32_t        assoc;
 745         uint32_t        seq;
 746         wid_t           adc_wid;
 747         wid_t           dac_wid;
 748         wid_t           beep_wid;
 749         int             no_phys_conn;
 750         enum audiohda_device_type       device;
 751 
 752         /*
 753          * mg_dir, mg_gain, mg_wid are used to store the monitor gain control
 754          * widget wid.
 755          */
 756         int             mg_dir[AUDIOHD_MAX_CONN];
 757         int             mg_gain[AUDIOHD_MAX_CONN];
 758         int             mg_wid[AUDIOHD_MAX_CONN];
 759         int             num;
 760         int             finish;
 761 


 762 };
 763 
 764 typedef struct {
 765         ddi_dma_handle_t        ad_dmahdl;
 766         ddi_acc_handle_t        ad_acchdl;
 767         caddr_t                 ad_vaddr;       /* virtual addr */
 768         uint64_t                ad_paddr;       /* physical addr */
 769         size_t                  ad_req_sz;      /* required size of memory */
 770         size_t                  ad_real_sz;     /* real size of memory */
 771 } audiohd_dma_t;
 772 
 773 struct hda_codec {
 774         uint8_t         index;          /* codec address */
 775         uint32_t        vid;            /* vendor id and device id */
 776         uint32_t        revid;          /* revision id */
 777         wid_t           wid_afg;        /* id of AFG */
 778         wid_t           first_wid;      /* wid of 1st subnode of AFG */
 779         wid_t           last_wid;       /* wid of the last subnode of AFG */
 780         int             nnodes;         /* # of subnodes of AFG */
 781         uint8_t         nistream;




 115 #define AUDIOHD_RIRB_INTRCNT    0x0
 116 #define AUDIOHD_RIRB_WPMASK     0xff
 117 
 118 #define AUDIOHD_FORM_MASK       0x0080
 119 #define AUDIOHD_LEN_MASK        0x007f
 120 #define AUDIOHD_PIN_CAP_MASK    0x00000010
 121 #define AUDIOHD_PIN_CONF_MASK   0xc0000000
 122 #define AUDIOHD_PIN_CON_MASK    3
 123 #define AUDIOHD_PIN_CON_STEP    30
 124 #define AUDIOHD_PIN_IO_MASK     0X0018
 125 #define AUDIOHD_PIN_SEQ_MASK    0x0000000f
 126 #define AUDIOHD_PIN_ASO_MASK    0x000000f0
 127 #define AUDIOHD_PIN_ASO_OFF     0x4
 128 #define AUDIOHD_PIN_DEV_MASK    0x00f00000
 129 #define AUDIOHD_PIN_DEV_OFF     20
 130 #define AUDIOHD_PIN_NUMS        6
 131 #define AUDIOHD_PIN_NO_CONN     0x40000000
 132 #define AUDIOHD_PIN_IN_ENABLE   0x20
 133 #define AUDIOHD_PIN_OUT_ENABLE  0x40
 134 #define AUDIOHD_PIN_PRES_MASK   0x80000000
 135 #define AUDIOHD_PIN_ELDV_MASK   0x40000000
 136 #define AUDIOHD_PIN_CONTP_OFF   0x1e
 137 #define AUDIOHD_PIN_CON_JACK    0
 138 #define AUDIOHD_PIN_CON_FIXED   0x2
 139 #define AUDIOHD_PIN_CONTP_MASK  0x3
 140 #define AUDIOHD_PIN_VREF_L1     0x20
 141 #define AUDIOHD_PIN_VREF_L2     0x10
 142 #define AUDIOHD_PIN_VREF_L3     0x04
 143 #define AUDIOHD_PIN_VREF_L4     0x02
 144 #define AUDIOHD_PIN_VREF_OFF    8
 145 #define AUDIOHD_PIN_VREF_MASK   0xff
 146 #define AUDIOHD_PIN_CLR_MASK    0xf
 147 #define AUDIOHD_PIN_CLR_OFF     12
 148 
 149 #define AUDIOHD_VERB_ADDR_OFF   28
 150 #define AUDIOHD_VERB_NID_OFF    20
 151 #define AUDIOHD_VERB_CMD_OFF    8
 152 #define AUDIOHD_VERB_CMD16_OFF  16
 153 
 154 #define AUDIOHD_RING_MAX_SIZE   0x00ff
 155 #define AUDIOHD_REC_TAG_OFF     4


 326 #define AUDIOHDC_VERB_GET_CONN_SEL              0xf01
 327 #define AUDIOHDC_VERB_SET_CONN_SEL              0x701
 328 
 329 #define AUDIOHDC_VERB_GET_CONN_LIST_ENT         0xf02
 330 #define AUDIOHDC_VERB_GET_PROCESS_STATE         0xf03
 331 #define AUDIOHDC_VERB_GET_SDI_SEL               0xf04
 332 
 333 #define AUDIOHDC_VERB_GET_POWER_STATE           0xf05
 334 #define AUDIOHDC_VERB_SET_POWER_STATE           0x705
 335 
 336 #define AUDIOHDC_VERB_GET_STREAM_CHANN          0xf06
 337 #define AUDIOHDC_VERB_SET_STREAM_CHANN          0x706
 338 
 339 #define AUDIOHDC_VERB_GET_PIN_CTRL              0xf07
 340 #define AUDIOHDC_VERB_SET_PIN_CTRL              0x707
 341 
 342 #define AUDIOHDC_VERB_GET_UNS_ENABLE            0xf08
 343 #define AUDIOHDC_VERB_SET_UNS_ENABLE            0x708
 344 
 345 #define AUDIOHDC_VERB_GET_PIN_SENSE             0xf09

 346 #define AUDIOHDC_VERB_EXEC_PIN_SENSE            0x709
 347 
 348 #define AUDIOHDC_VERB_GET_BEEP_GEN              0xf0a
 349 #define AUDIOHDC_VERB_SET_BEEP_GEN              0x70a
 350 
 351 #define AUDIOHDC_VERB_GET_EAPD                  0xf0c
 352 #define AUDIOHDC_VERB_SET_EAPD                  0x70c
 353 
 354 #define AUDIOHDC_VERB_GET_DEFAULT_CONF          0xf1c
 355 #define AUDIOHDC_VERB_GET_SPDIF_CTL             0xf0d
 356 #define AUDIOHDC_VERB_SET_SPDIF_LCL             0x70d
 357 
 358 #define AUDIOHDC_VERB_GET_GPIO_MASK             0xf16
 359 #define AUDIOHDC_VERB_SET_GPIO_MASK             0x716
 360 
 361 #define AUDIOHDC_VERB_GET_UNSOL_ENABLE_MASK     0xf19
 362 #define AUDIOHDC_VERB_SET_UNSOL_ENABLE_MASK     0x719
 363 
 364 #define AUDIOHDC_VERB_GET_GPIO_DIREC            0xf17
 365 #define AUDIOHDC_VERB_SET_GPIO_DIREC            0x717
 366 
 367 #define AUDIOHDC_VERB_GET_GPIO_DATA             0xf15
 368 #define AUDIOHDC_VERB_SET_GPIO_DATA             0x715
 369 
 370 #define AUDIOHDC_VERB_GET_GPIO_STCK             0xf1a
 371 #define AUDIOHDC_VERB_SET_GPIO_STCK             0x71a
 372 
 373 #define AUDIOHDC_VERB_GET_DIP_SIZE              0xf2e
 374 #define AUDIOHDC_VERB_GET_ELD                   0xf2f
 375 
 376 #define AUDIOHDC_VERB_SET_DIP_INDEX             0x730
 377 #define AUDIOHDC_VERB_SET_DIP_DATA              0x731
 378 #define AUDIOHDC_VERB_SET_DIP_XMIT              0x732
 379 
 380 #define AUDIOHDC_VERB_SET_ASP_CHMAP             0x734
 381 
 382 #define AUDIOHDC_GPIO_ENABLE                    0xff
 383 #define AUDIOHDC_GPIO_DIRECT                    0xf1
 384 
 385 #define AUDIOHDC_GPIO_DATA_CTRL                 0xff
 386 #define AUDIOHDC_GPIO_STCK_CTRL                 0xff
 387 /*
 388  * 4-bit verbs
 389  */
 390 #define AUDIOHDC_VERB_GET_CONV_FMT              0xa
 391 #define AUDIOHDC_VERB_SET_CONV_FMT              0x2
 392 
 393 #define AUDIOHDC_VERB_GET_AMP_MUTE              0xb
 394 #define AUDIOHDC_VERB_SET_AMP_MUTE              0x3
 395 #define AUDIOHDC_VERB_SET_BEEP_VOL              0x3A0
 396 
 397 /*
 398  * parameters of nodes
 399  */
 400 #define AUDIOHDC_PAR_VENDOR_ID                  0x00
 401 #define AUDIOHDC_PAR_SUBSYS_ID                  0x01


 475 #define AUDIOHD_WIDCAP_PROC_WID         0x00000040
 476 #define AUDIOHD_WIDCAP_UNSOL            0x00000080
 477 #define AUDIOHD_WIDCAP_CONNLIST         0x00000100
 478 #define AUDIOHD_WIDCAP_DIGIT            0x00000200
 479 #define AUDIOHD_WIDCAP_PWRCTRL          0x00000400
 480 #define AUDIOHD_WIDCAP_LRSWAP           0x00000800
 481 #define AUDIOHD_WIDCAP_TYPE             0x00f00000
 482 #define AUDIOHD_WIDCAP_TO_WIDTYPE(wcap)         \
 483         ((wcap & AUDIOHD_WIDCAP_TYPE) >> 20)
 484 
 485 #define AUDIOHD_CODEC_FAILURE   (uint32_t)(-1)
 486 
 487 /* Higher sample/bits support */
 488 #define AUDIOHD_BIT_DEPTH16     0x00020000
 489 #define AUDIOHD_BIT_DEPTH24     0x00080000
 490 #define AUDIOHD_SAMP_RATE48     0x00000040
 491 #define AUDIOHD_SAMP_RATE96     0x00000100
 492 #define AUDIOHD_SAMP_RATE192    0x00000400
 493 
 494 /*
 495  * Data Island Packet - Size info
 496  */
 497 #define AUDIOHD_DIP_SIZE_AF             0x0
 498 #define AUDIOHD_DIP_SIZE_ELD            0x8
 499 #define AUDIOHD_DIP_SIZE_ELD_MASK       0xff
 500 
 501 /*
 502  * Data Island Packet - Data
 503  */
 504 #define AUDIOHD_DIP_DATA_LEN            32
 505 
 506 /*
 507  * Data Island Packet - Xmit
 508  */
 509 #define AUDIOHD_DIP_XMIT_STOP           0x00
 510 #define AUDIOHD_DIP_XMIT_ONCE           0x80
 511 #define AUDIOHD_DIP_XMIT_BEST_EFFORT    0xc0
 512 
 513 /*
 514  * EDID-like data (ELD)
 515  */
 516 typedef struct {
 517         uint8_t         sad_nchan:3;
 518         uint8_t         sad_format:4;
 519         uint8_t         sad_rsvd:1;
 520         uint8_t         sad_freq;
 521         uint8_t         sad_bitr;
 522 } audiohd_sad_t;
 523 
 524 #define AUDIOHD_SAD_FORMAT_LPCM         1
 525 #define AUDIOHD_SAD_FORMAT_AC3          2
 526 #define AUDIOHD_SAD_FORMAT_MPEG1        3
 527 #define AUDIOHD_SAD_FORMAT_MP3          4
 528 #define AUDIOHD_SAD_FORMAT_MPEG2        5
 529 #define AUDIOHD_SAD_FORMAT_AAC          6
 530 #define AUDIOHD_SAD_FORMAT_DTS          7
 531 #define AUDIOHD_SAD_FORMAT_ATRAC        8
 532 #define AUDIOHD_SAD_FORMAT_SACD         9
 533 #define AUDIOHD_SAD_FORMAT_DDPLUS       10
 534 #define AUDIOHD_SAD_FORMAT_DTSHD        11
 535 #define AUDIOHD_SAD_FORMAT_MLP          12
 536 #define AUDIOHD_SAD_FORMAT_DST          13
 537 #define AUDIOHD_SAD_FORMAT_WMA          14
 538 
 539 #define AUDIOHD_SAD_FREQ_32             0x1
 540 #define AUDIOHD_SAD_FREQ_44             0x2
 541 #define AUDIOHD_SAD_FREQ_48             0x4
 542 #define AUDIOHD_SAD_FREQ_88             0x8
 543 #define AUDIOHD_SAD_FREQ_96             0x10
 544 #define AUDIOHD_SAD_FREQ_176            0x20
 545 #define AUDIOHD_SAD_FREQ_192            0x40
 546 
 547 #define AUDIOHD_SAD_BITRATE_16          0x1
 548 #define AUDIOHD_SAD_BITRATE_20          0x2
 549 #define AUDIOHD_SAD_BITRATE_24          0x4
 550 
 551 typedef struct {
 552         uint8_t         eld_rsvd1:3;
 553         uint8_t         eld_ver:5;
 554         uint8_t         eld_rsvd2;
 555         uint8_t         eld_baseline_size;
 556         uint8_t         eld_rsvd3;
 557         uint8_t         eld_mnl:5;
 558         uint8_t         eld_cea_edid_ver:3;
 559         uint8_t         eld_hdcp:1;
 560         uint8_t         eld_s_ai:1;
 561         uint8_t         eld_conn_type:2;
 562         uint8_t         eld_sad_count:4;
 563         uint8_t         eld_aud_synch_delay;
 564         uint8_t         eld_channels;
 565         uint64_t        eld_port_id;
 566         char            eld_manufacturer_name[2];
 567         char            eld_product_code[2];
 568         char            eld_monitor_name[16];
 569         audiohd_sad_t   eld_cea_sad[15];
 570         size_t          eld_size;
 571 } audiohd_eld_t;
 572 
 573 #define AUDIOHD_ELD_HDR_LEN     4
 574 
 575 #define AUDIOHD_ELD_VER_2       0x02
 576 #define AUDIOHD_ELD_VER_NODRV   0x1f
 577 #define AUDIOHD_ELD_MAX_MNL     16
 578 #define AUDIOHD_ELD_CEA_861     1
 579 #define AUDIOHD_ELD_CEA_861_A   2
 580 #define AUDIOHD_ELD_CEA_861_BCD 3
 581 
 582 #define AUDIOHD_ELD_CONN_HDMI   0
 583 #define AUDIOHD_ELD_CONN_DP     1
 584 
 585 #define AUDIOHD_ELD_CHAN_FLR    0x01    /* front left/right */
 586 #define AUDIOHD_ELD_CHAN_LFE    0x02    /* low frequency effect */
 587 #define AUDIOHD_ELD_CHAN_FC     0x04    /* front center */
 588 #define AUDIOHD_ELD_CHAN_RLR    0x08    /* rear left/right */
 589 #define AUDIOHD_ELD_CHAN_RC     0x10    /* rear center */
 590 #define AUDIOHD_ELD_CHAN_FLRC   0x20    /* front left/right of center */
 591 #define AUDIOHD_ELD_CHAN_RLRC   0x40    /* rear left/right of center */
 592 
 593 
 594 /*
 595  * buffer descriptor list entry of stream descriptor
 596  */
 597 typedef struct {
 598         uint64_t        sbde_addr;
 599         uint32_t        sbde_len;
 600         uint32_t
 601                 sbde_ioc: 1,
 602                 reserved: 31;
 603 }sd_bdle_t;
 604 
 605 
 606 #define AUDIOHD_PLAY_STARTED            0x00000001
 607 #define AUDIOHD_PLAY_EMPTY              0x00000002
 608 #define AUDIOHD_PLAY_PAUSED             0x00000004
 609 #define AUDIOHD_RECORD_STARTED          0x00000008
 610 
 611 enum audiohda_widget_type {
 612         WTYPE_AUDIO_OUT = 0,
 613         WTYPE_AUDIO_IN,
 614         WTYPE_AUDIO_MIX,
 615         WTYPE_AUDIO_SEL,
 616         WTYPE_PIN,
 617         WTYPE_POWER,
 618         WTYPE_VOL_KNOB,
 619         WTYPE_BEEP,
 620         WTYPE_VENDOR = 0xf
 621 };
 622 
 623 enum audiohda_device_type {
 624         DTYPE_LINEOUT = 0,
 625         DTYPE_SPEAKER,
 626         DTYPE_HP_OUT,
 627         DTYPE_CD,
 628         DTYPE_SPDIF_OUT,
 629         DTYPE_DIGIT_OUT,
 630         DTYPE_MODEM_SIDE,
 631         DTYPE_MODEM_HAND_SIDE,
 632         DTYPE_LINE_IN,
 633         DTYPE_AUX,
 634         DTYPE_MIC_IN,
 635         DTYPE_TEL,
 636         DTYPE_SPDIF_IN,
 637         DTYPE_DIGIT_IN,
 638         DTYPE_OTHER = 0x0f,
 639 };
 640 
 641 enum audiohd_pin_color {
 642         AUDIOHD_PIN_UNKNOWN = 0,
 643         AUDIOHD_PIN_BLACK,
 644         AUDIOHD_PIN_GREY,
 645         AUDIOHD_PIN_BLUE,
 646         AUDIOHD_PIN_GREEN,
 647         AUDIOHD_PIN_RED,
 648         AUDIOHD_PIN_ORANGE,
 649         AUDIOHD_PIN_YELLOW,
 650         AUDIOHD_PIN_PURPLE,
 651         AUDIOHD_PIN_PINK,


 851         uint32_t        config;
 852         uint32_t        ctrl;
 853         uint32_t        assoc;
 854         uint32_t        seq;
 855         wid_t           adc_wid;
 856         wid_t           dac_wid;
 857         wid_t           beep_wid;
 858         int             no_phys_conn;
 859         enum audiohda_device_type       device;
 860 
 861         /*
 862          * mg_dir, mg_gain, mg_wid are used to store the monitor gain control
 863          * widget wid.
 864          */
 865         int             mg_dir[AUDIOHD_MAX_CONN];
 866         int             mg_gain[AUDIOHD_MAX_CONN];
 867         int             mg_wid[AUDIOHD_MAX_CONN];
 868         int             num;
 869         int             finish;
 870 
 871         /* EDID-like data for HDMI/DP */
 872         audiohd_eld_t   *eld;
 873 };
 874 
 875 typedef struct {
 876         ddi_dma_handle_t        ad_dmahdl;
 877         ddi_acc_handle_t        ad_acchdl;
 878         caddr_t                 ad_vaddr;       /* virtual addr */
 879         uint64_t                ad_paddr;       /* physical addr */
 880         size_t                  ad_req_sz;      /* required size of memory */
 881         size_t                  ad_real_sz;     /* real size of memory */
 882 } audiohd_dma_t;
 883 
 884 struct hda_codec {
 885         uint8_t         index;          /* codec address */
 886         uint32_t        vid;            /* vendor id and device id */
 887         uint32_t        revid;          /* revision id */
 888         wid_t           wid_afg;        /* id of AFG */
 889         wid_t           first_wid;      /* wid of 1st subnode of AFG */
 890         wid_t           last_wid;       /* wid of the last subnode of AFG */
 891         int             nnodes;         /* # of subnodes of AFG */
 892         uint8_t         nistream;