# How to hint snd_hda to get sound from CD



## Erratus (Apr 5, 2010)

This is without modified hints:

```
hdac0: Processing audio FG cad=0 nid=1...
hdac0: GPIO: 0x40000002 NumGPIO=2 NumGPO=0 NumGPI=0 GPIWake=0 GPIUnsol=1
hdac0:  nid 20 0x01014010 as  1 seq  0      Line-out  Jack jack  1 loc  1 color   Green misc 0
hdac0:  nid 21 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1
hdac0:  nid 22 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1
hdac0:  nid 24 0x01a19840 as  4 seq  0           Mic  Jack jack  1 loc  1 color    Pink misc 8
hdac0:  nid 25 0x02a19850 as  5 seq  0           Mic  Jack jack  1 loc  2 color    Pink misc 8
hdac0:  nid 26 0x0181304f as  4 seq 15       Line-in  Jack jack  1 loc  1 color    Blue misc 0
hdac0:  nid 27 0x02214020 as  2 seq  0    Headphones  Jack jack  1 loc  2 color   Green misc 0
hdac0:  nid 28 0x593301f0 as 15 seq  0            CD  None jack  3 loc 25 color Unknown misc 1
hdac0:  nid 29 0x4005c603 as  0 seq  3      Line-out  None jack  5 loc  0 color   Res.C misc 6
hdac0:  nid 30 0x99430130 as  3 seq  0     SPDIF-out Fixed jack  3 loc 25 color Unknown misc 1
hdac0: Patched pins configuration:
hdac0:  nid 20 0x01014010 as  1 seq  0      Line-out  Jack jack  1 loc  1 color   Green misc 0
hdac0:  nid 21 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1 [DISABLED]
hdac0:  nid 22 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1 [DISABLED]
hdac0:  nid 24 0x01a19840 as  4 seq  0           Mic  Jack jack  1 loc  1 color    Pink misc 8
hdac0:  nid 25 0x02a19850 as  5 seq  0           Mic  Jack jack  1 loc  2 color    Pink misc 8
hdac0:  nid 26 0x0181304f as  4 seq 15       Line-in  Jack jack  1 loc  1 color    Blue misc 0
hdac0:  nid 27 0x02214020 as  2 seq  0    Headphones  Jack jack  1 loc  2 color   Green misc 0
hdac0:  nid 28 0x593301f0 as 15 seq  0            CD  None jack  3 loc 25 color Unknown misc 1 [DISABLED]
hdac0:  nid 29 0x4005c603 as  0 seq  3      Line-out  None jack  5 loc  0 color   Res.C misc 6 [DISABLED]
hdac0:  nid 30 0x99430130 as  3 seq  0     SPDIF-out Fixed jack  3 loc 25 color Unknown misc 1
hdac0: 5 associations found:
hdac0: Association 0 (1) out:
hdac0:  Pin nid=20 seq=0
hdac0: Association 1 (2) out:
hdac0:  Pin nid=27 seq=0
hdac0: Association 2 (3) out:
hdac0:  Pin nid=30 seq=0
hdac0: Association 3 (4) in:
hdac0:  Pin nid=24 seq=0
hdac0:  Pin nid=26 seq=15
hdac0: Association 4 (5) in:
hdac0:  Pin nid=25 seq=0
hdac0: Tracing association 0 (1)
hdac0:  Pin 20 traced to DAC 2
hdac0: Association 0 (1) trace succeeded
hdac0: Tracing association 1 (2)
hdac0:  Pin 27 traced to DAC 4
hdac0: Association 1 (2) trace succeeded
hdac0: Tracing association 2 (3)
hdac0:  Pin 30 traced to DAC 6
hdac0: Association 2 (3) trace succeeded
hdac0: Tracing association 3 (4)
hdac0:  Pin 24 traced to ADC 8
hdac0:  Pin 26 traced to ADC 8
hdac0: Association 3 (4) trace succeeded
hdac0: Tracing association 4 (5)
hdac0:  Pin 25 traced to ADC 9
hdac0: Association 4 (5) trace succeeded
hdac0: Tracing input monitor
hdac0:  Tracing nid 11 to out
hdac0:  nid 11 is input monitor
hdac0:  Tracing nid 34 to out
hdac0:  Tracing nid 35 to out
hdac0: Tracing beeper
hdac0: FG config/quirks: forcestereo ivref50 ivref80 ivref100 ivref
hdac0:
```


```
hdac0:             nid: 26
hdac0:            Name: pin: Line-in (Blue Jack)
hdac0:      Widget cap: 0x0040018d
hdac0:                  UNSOL STEREO
hdac0:     Association: 3 (0x00008000)
hdac0:             OSS: line (line)
hdac0:         Pin cap: 0x00000034
hdac0:                  PDC OUT IN
hdac0:      Pin config: 0x0181304f
hdac0:     Pin control: 0x00000020 IN
hdac0:      Output amp: 0x80000000
hdac0:                  mute=1 step=0 size=0 offset=0
hdac0:     connections: 1
hdac0:           |
hdac0:           + [DISABLED] <- nid=13 [audio mixer] [DISABLED]
hdac0: 
hdac0:             nid: 27
hdac0:            Name: pin: Headphones (Green Jack)
hdac0:      Widget cap: 0x0040018f
hdac0:                  UNSOL STEREO
hdac0:     Association: 1 (0x00000001)
hdac0:         Pin cap: 0x0000173c
hdac0:                  PDC HP OUT IN VREF[ 50 80 GROUND HIZ ]
hdac0:      Pin config: 0x02214020
hdac0:     Pin control: 0x000000c0 HP OUT
hdac0:      Output amp: 0x80000000
hdac0:                  mute=1 step=0 size=0 offset=0
hdac0:       Input amp: 0x00270300
hdac0:                  mute=0 step=3 size=39 offset=0
hdac0:     connections: 2
hdac0:           |
hdac0:           + [DISABLED] <- nid=12 [audio mixer]
hdac0:           + <- nid=14 [audio mixer] (selected)
hdac0: 
hdac0:             nid: 28 [DISABLED]
hdac0:            Name: pin: CD (None)
hdac0:      Widget cap: 0x00400001
hdac0:                  STEREO
hdac0:         Pin cap: 0x00000020
hdac0:                  IN
hdac0:      Pin config: 0x593301f0
hdac0:     Pin control: 0x00000000
hdac0: 
hdac0:             nid: 29 [DISABLED]
hdac0:            Name: pin: Line-out (None)
hdac0:      Widget cap: 0x00400000
hdac0:         Pin cap: 0x00000020
hdac0:                  IN
hdac0:      Pin config: 0x4005c603
hdac0:     Pin control: 0x00000000
hdac0: 
hdac0:             nid: 30
hdac0:            Name: pin: SPDIF-out (Fixed)
hdac0:      Widget cap: 0x00400300
hdac0:                  DIGITAL
hdac0:     Association: 2 (0x00000001)
hdac0:         Pin cap: 0x00000010
hdac0:                  OUT
hdac0:      Pin config: 0x99430130
hdac0:     Pin control: 0x00000040 OUT
hdac0:     connections: 1
hdac0:           |
hdac0:           + <- nid=6 [audio output]
hdac0: 
hdac0:             nid: 31 [DISABLED]
hdac0:            Name: vendor widget
hdac0:      Widget cap: 0x00f00000
hdac0: 
hdac0:             nid: 32 [DISABLED]
hdac0:            Name: vendor widget
hdac0:      Widget cap: 0x00f00040
hdac0:                  PROC
hdac0: 
hdac0:             nid: 33 [DISABLED]
hdac0:            Name: vendor widget
hdac0:      Widget cap: 0x00f00000
hdac0: 
hdac0:             nid: 34
hdac0:            Name: audio mixer
hdac0:      Widget cap: 0x0020010b
hdac0:                  STEREO
hdac0:     Association: 4 (0x00000001)
hdac0:             OSS: mix, monitor
hdac0:       Input amp: 0x80000000
hdac0:                  mute=1 step=0 size=0 offset=0
hdac0:     connections: 10
hdac0:           |
hdac0:           + [DISABLED] <- nid=24 [pin: Mic (Pink Jack)]
hdac0:           + <- nid=25 [pin: Mic (Pink Jack)]
hdac0:           + [DISABLED] <- nid=26 [pin: Line-in (Blue Jack)]
hdac0:           + [DISABLED] <- nid=27 [pin: Headphones (Green Jack)]
hdac0:           + [DISABLED] <- nid=28 [pin: CD (None)] [DISABLED]
hdac0:           + [DISABLED] <- nid=29 [pin: Line-out (None)] [DISABLED]
hdac0:           + [DISABLED] <- nid=20 [pin: Line-out (Green Jack)]
hdac0:           + [DISABLED] <- nid=21 [pin: Speaker (None)] [DISABLED]
hdac0:           + [DISABLED] <- nid=22 [pin: Speaker (None)] [DISABLED]
hdac0:           + <- nid=11 [audio mixer]
hdac0: 
hdac0:             nid: 35
hdac0:            Name: audio mixer
hdac0:      Widget cap: 0x0020010b
hdac0:                  STEREO
hdac0:     Association: 3 (0x00008001)
hdac0:             OSS: line, mic, mix
hdac0:       Input amp: 0x80000000
hdac0:                  mute=1 step=0 size=0 offset=0
hdac0:     connections: 10
hdac0:           |
hdac0:           + <- nid=24 [pin: Mic (Pink Jack)]
hdac0:           + [DISABLED] <- nid=25 [pin: Mic (Pink Jack)]
hdac0:           + <- nid=26 [pin: Line-in (Blue Jack)]
hdac0:           + [DISABLED] <- nid=27 [pin: Headphones (Green Jack)]
hdac0:           + [DISABLED] <- nid=28 [pin: CD (None)] [DISABLED]
hdac0:           + [DISABLED] <- nid=29 [pin: Line-out (None)] [DISABLED]
hdac0:           + [DISABLED] <- nid=20 [pin: Line-out (Green Jack)]
hdac0:           + [DISABLED] <- nid=21 [pin: Speaker (None)] [DISABLED]
hdac0:           + [DISABLED] <- nid=22 [pin: Speaker (None)] [DISABLED]
hdac0:           + <- nid=11 [audio mixer]
hdac0: 
hdac0:             nid: 36 [DISABLED]
hdac0:            Name: vendor widget
hdac0:      Widget cap: 0x00f00000
hdac0: 
hdac0:             nid: 37 [DISABLED]
hdac0:            Name: vendor widget
hdac0:      Widget cap: 0x00f00000
hdac0: 
hdac0:             nid: 38 [DISABLED]
hdac0:            Name: vendor widget
hdac0:      Widget cap: 0x00f00000
```


```
pcm0: <HDA Realtek ALC662 PCM #0 Analog> at cad 0 nid 1 on hdac0
pcm1: <HDA Realtek ALC662 PCM #1 Analog> at cad 0 nid 1 on hdac0
pcm2: <HDA Realtek ALC662 PCM #2 Digital> at cad 0 nid 1 on hdac0
dev.hdac.0.%desc: NVidia MCP67 High Definition Audio Controller
dev.hdac.0.%driver: hdac
dev.hdac.0.%location: slot=7 function=0 handle=\_SB_.PCI0.HDAC
dev.hdac.0.%pnpinfo: vendor=0x10de device=0x055c subvendor=0x1043 subdevice=0x8290 class=0x040300
dev.hdac.0.%parent: pci0
dev.hdac.0.wake: 0
dev.hdac.0.polling: 0
dev.hdac.0.polling_interval: 250
dev.hdac.0.pindump: 0
dev.pcm.0.%parent: hdac0
dev.pcm.1.%parent: hdac0
dev.pcm.2.%parent: hdac0
```

Then tried to add to /boot/device.hints

```
hint.hdac.0.cad0.nid28.config="as=2 seq=1 device=CD conn=Fixed"
```

but no sound gets to speakers while cdcontrol is running.

```
> cdcontrol status
Audio status = 17<playing>, current track = 5, current position = 0:02.14
No media catalog info available
Left volume = 255, right volume = 255
```

Have tried many hints but had no success. I admit that concept of association numbers and sequence numbers is not really understood. Please help.

PS: CDROM drive is connected with cable to connector on mainboard.


----------



## mav@ (Apr 5, 2010)

as=2 is a playback association. You should put CD input into recording one, like as=4.


----------



## Erratus (Apr 5, 2010)

Thank you mav, now mixer has cd device!!!

```
> mixer
Mixer vol      is currently set to  84:84
Mixer pcm      is currently set to 100:100
Mixer line     is currently set to 100:100
Mixer mic      is currently set to   0:0
Mixer cd       is currently set to  76:76
Mixer mix      is currently set to   0:0
Mixer rec      is currently set to   0:0
Mixer ogain    is currently set to 100:100
Recording source: mic
```
This is a really big step after almost hundred reboots.

Unfortunately still no sound from cd can be heard. Cdcontrol status sends this to console:

```
acd0: FAILURE - READ_SUBCHANNEL ILLEGAL REQUEST asc=0x00 ascq=0x11
(cd0:ata0:0:0:0): READ SUB-CHANNEL. CDB: 42 2 40 2 0 0 0 0 18 0
(cd0:ata0:0:0:0): CAM Status: SCSI Status Error
(cd0:ata0:0:0:0): SCSI Status: Check Condition
(cd0:ata0:0:0:0): ILLEGAL REQUEST asc:0,11
(cd0:ata0:0:0:0): Audio play operation in progress
(cd0:ata0:0:0:0): (cd0:ata0:0:0:0): READ SUB-CHANNEL. CDB: 42 2 40 2 0 0 0 0 18 0
(cd0:ata0:0:0:0): ILLEGAL REQUEST asc:0,11
(cd0:ata0:0:0:0): Audio play operation in progress
Unretryable error
(cd0:ata0:0:0:0): error 16
(cd0:ata0:0:0:0): Unretryable Error
scsi_cd.c::ioctl cmd=c0106303 error=16
```
acd0 is a DVD-recorder with this in kernelconfig:

```
# ATA and ATAPI devices
device          ata    
device          atadisk         # ATA disk drives
device          ataraid         # ATA RAID drives
device          atapicd         # ATAPI CDROM drives
device          atapicam        # ATAPI DVD da0     
#device         atapifd         #-ATAPI floppy drives
#device         atapist         #-ATAPI tape drives  
options         ATA_STATIC_ID   # Static device numbering
```
Now question is if more hints are necessary or acd0 is misconfigured?


----------



## mav@ (Apr 6, 2010)

Have you tried to set 'mix' mixer control to nonzero value? It controls both input mixing volume and volume of input-to-output loopback. If you update your system to 8-STABLE, one more control 'igain' should appear. It controls especially input-to-output loopback volume.

In verbose output it is possible to see how the signal goes and where it is affected by different mixer controls.


----------



## Erratus (Apr 6, 2010)

Hi mav,
when I started the system values of mixer 'mix' were 75 and of 'cd' 75. Then started cdcontrol to play and got no sound. But now I realized, that I have to change the value first like

```
> mixer cd 60
```
and then sound from cd can be heared. So just starting cdcontrol is not sufficent, volume has to be changed too. I do not know, if this behaviour is wanted by design or not.

Let me ask again about these error like messages generated by 


```
> cdcontrol status
```
You can see the output on my previous post. I ask about this, because in KsCD (kdemultimedia-4.3.5) CD just runs 6 seconds then falls back to 0 second runs again 6 seconds and repeats this as a loop. Unfortunately without any sound there. Moving the mixer rules makes no difference in KDE4.

Now my intention is first to make sure, the sound system works fine in plain freebsd before looking after the problems with audiocd in KDE4.


----------



## mav@ (Apr 7, 2010)

Part about unmuting sound with changing mixer value is probably a bug, and I think it may be already fixed in 8-STABLE.

What's about that error - I have no idea.


----------



## Erratus (Apr 23, 2010)

> I ask about this, because in KsCD (kdemultimedia-4.3.5) CD just runs 6 seconds then falls back to 0 second runs again 6 seconds and repeats this as a loop. Unfortunately without any sound there.



In /etc/devfs.conf there were wrong links. Now changed links to


```
link    acd0    cdrom
link    acd0    dvd
```

and CD sound in KDE4 can be heared. Thread is solved.


----------

