Sound/ALSA on Ultranote II

hogfish

Bronze Level Poster
15.6" Ultranote II = Clevo W550SU / W54_55SU1,SUW

I was surprised that I had to do a fair bit of work to get sound
working properly: I had checked these forums before buying and didn't
see any significant problems reported. Perhaps I missed some.

Below I describe in some detail how to set up ALSA sound and what
the controls actually do.

ALSA is the underlying kernel system for sound on linux, so once that is
operating correctly, then higher level abstractions like pulseaudio and
jack should also work correctly.

Executive summary:

Out of the box, the snd_hda_intel driver finds two "cards"/
subsystems/codecs, but chooses HDMI as the default rather than the
on-board Intel PCH. Unless you are using an external HDMI monitor,
this is the wrong way around for a laptop. The solution is simple:
pass an option to the driver. Put a file containing the line
options snd_hda_intel id=PCH index=1​
under /etc/modprobe.d/

More detail

The hardware:

PCI soundcards:

00:03.0 Audio device: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller (rev 06)
00:1b.0 Audio device: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller (rev 05)

In greater detail (lspci -v -k extract):

00:03.0 Audio device: Intel Corporation Xeon E3-1200 v3/4th Gen Core ProcessorHD Audio Controller (rev 06)
[ INDENT] Subsystem: CLEVO/KAPOK Computer Device 5455
Flags: bus master, fast devsel, latency 0, IRQ 48
Memory at f7e14000 (64-bit, non-prefetchable) [size=16K]
Capabilities: [50] Power Management version 2
Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit-
Capabilities: [70] Express Root Complex Integrated Endpoint, MSI 00
Kernel driver in use: snd_hda_intel
{ This is supports the HDMI interface. }[/INDENT]

00:1b.0 Audio device: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller (rev 05)
Subsystem: CLEVO/KAPOK Computer Device 5455
Flags: bus master, fast devsel, latency 0, IRQ 43
Memory at f7e10000 (64-bit, non-prefetchable) [size=16K]
Capabilities: [50] Power Management version 2
Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit+
Capabilities: [70] Express Root Complex Integrated Endpoint, MSI 00
Capabilities: [100] Virtual Channel
Kernel driver in use: snd_hda_intel
{ Supports the on board microphone, speakers, and mic/phone sockets. }​

The software

Experiments done on kernel 3.14-2-amd64 (from debian testing).

Default:

With no options passed to the snd_hda_intel driver the soundcards
are indexed as follows:
0 [HDMI ]: HDA-Intel - HDA Intel HDMI
HDA Intel HDMI at 0xf7e14000 irq 48
1 [PCH ]: HDA-Intel - HDA Intel PCH
HDA Intel PCH at 0xf7e10000 irq 47

The ALSA default device is hw:0,0 and thus HDMI. None of my HDMI monitors
include sound so I cannot test to see how or whether this works, but the mixer controls seem minimal.

It is possible to play sounds to the onboard speakers by explicitly
specifying the device. For example
Code:
 aplay -D plughw:CARD=PCH,DEV=0 test.wav
However the mixer controls do not then behave as I expect. I found that
Code:
   aplay -D default:1  test.wav
means that the mixer pcm level control does then work.

If you want to use HDMI sound as your default, and so presumably have
an external monitor normally connected, then perhaps you do not need
to change anything. However that seems extraordinarily unlikely for a laptop.
Rather we want the "PCH" card connected to the laptop's
own sound devices to be the default.

Changing the default card.

The snd_hda_intel accepts many parameters as
modinfo snd_hda_intel
will reveal. However, you need to consult the kernel documentation for
proper detail. Here we just need to specify the index and id.
I placed a file which I called sdn-hda.conf under /etc/modprobe.d/:
# cat /etc/modprobe.d/snd-hda.conf
options snd_hda_intel id=PCH index=1
#See /usr/local/src/linux-stable/Documentation/sound/alsa/HD-Audio.txt​

The mixer controls.

ALSA is notorious for its poor documentation. There is actually a fair
amount, but it is not well structured and makes no concessions to
someone not already familiar which the overall structure and
terminology. Thus it is difficult to get started.

This shows up in somewhat mysterious mixer controls. In fact, this is
not entirely ALSA's fault: in the main (with one particular exception
discussed below) this is because ALSA simply retrieves the
strings associated with controls from the hardware/firmware. In
turn these are seldom properly documented by the manufacturers.

These strings, together with other useful information can be inspected
with the amixer command. However, alsamixer is a little more
user friendly, but abbreviates the mixer control names which can be
a little confusing. Most of the time, the gui version alsamixergui
is probably the best choice, but perhaps only after getting familiar
with the command line version.

Here I describe the controls in the order shown by alsamixer for the
PCH card when displaying all controls (F5).

1) "Master" This controls the level to the laptop speakers and headphones.
It seems to control both channels simultaneously which perhaps is why
it is described as "mono". Mute control.

2) "Headphones" This controls the output to the headphone socket on
the right of the laptop. It is stereo. I had to set it fairly
high for the headphones I used in testing. Mute.

3) "Speaker" Stereo volume to laptop speakers. Mute.

4) PCM. Stereo PCM volume.

5) "Mic". Controls amplification for the microphone connector. Appears
to be stereo, although I only tested with a mono microphone. Mute
supported.

6) "Mic Boost". Boosts the microphone socket amplication. Stereo.
Appears to be a duplicate (bug?) of 7) to which it seems locked.

7) Duplicate of above.

8) "Beep". Stereo. Volume of "system" sound. Mute supported.

9) "Capture". Gain and enable control for sound output to system
(typically for recording or transmission as in voip,etc).

10) "Auto-Mut". Auto-Mute Mode. This is a simple switch. It controls
whether plugging in headphones automatically turns the speakers
off, or leaves them connected.
11) "Digital". This is the exception mentioned above which does not
come from the hardware. You have to consult the kernal
../sound/alsa/HD-Audio.txt documentation to discover that
this is purely a software gain/attenuation control. It needs to
be set to 50% (0dB) to avoid it modifying the signal. I did not
find that I needed to use it so I would recommend that 50% setting.

12) "Internal". Internal Mic Boost. This is a stereo boost for the
laptop microphone near the webcam. The onboard microphone is
only mono, of course. I found that these are best set at zero.
I could not monitor the internal microphone from
alsamixer, but these controls worked when a webcam program
(I used cheese, guvcview did not work for reasons I have yet to
explore) was recording.

13) "Internal". Seems to be a duplicate, and locked to, above.

---------------------------------------------
It is best to test with aplay and a wav file to avoid complications.

After that, I recommend alsaplayer for playing other formats like ogg. It can
also play audio CDs and such.

I hope this rather lengthy report will save others time.
 

uzi9mm

Member
I had a couple of problems on my 13.3 optimus V with Ubuntu 14.04. One I couldn't get the microphone working in skype. By luck in ALSAMIXER I found if I set the internal mic boost to 0 in the input (can't remember name exactly) then the mic would work.
Secondly after a suspend the headphone socket doesn't work. After researching this seems to be a kernel bug and is still not fixed.
 

hogfish

Bronze Level Poster
guvcview and Acer/Bison camera

A small update. I mentioned above that guvcview was not working.

There is a new version which has not yet reached some (any?) distributions. Version 2.0.0.
On my system runnning debian testing that does not yet run correctly "out-of-the-box", but if it is compiled
with the --enable-builtin-mjpg flag, then it does correctly display the video from the onboard webcam.
It seems to write video capture files, but there are problems playing them back on mplayer, vlc and xine.
However, the sound component seems to be ok. And sound is the main focus of this thread.

I am talking to the author of guvcview and we are trying to track this bug down.
I will report back, probably in a separate thread, when things are clearer.
But it does seem that the on board camera is a little problematic for now.

Trucated details are (from lsusb):
Code:
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 ?
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x5986 Acer, Inc
  idProduct          0x0248 
  bcdDevice            6.06
  iManufacturer           6 (error)
  iProduct                2 BisonCam, NB Pro
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          735
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              200mA
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         0
      bInterfaceCount         2
      bFunctionClass         14 Video
      bFunctionSubClass       3 Video Interface Collection
      bFunctionProtocol       0 
      iFunction               4 BisonCam, NB Pro
    Interface Descriptor:
      ... [snip]...
        bDescriptorSubtype                  6 (FORMAT_MJPEG)
        bFormatIndex                        2
        bNumFrameDescriptors                8
        bFlags                              1
          Fixed-size samples: Yes
        bDefaultFrameIndex                  1
        bAspectRatioX                       0
        bAspectRatioY                       0
        bmInterlaceFlags                 0x00
          Interlaced stream or variable: No
          Fields per frame: 1 fields
          Field 1 first: No
          Field pattern: Field 1 only
          bCopyProtect                      0
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  7 (FRAME_MJPEG)
        bFrameIndex                         1
        bmCapabilities                   0x01
          Still image supported
        wWidth                            640
        wHeight                           480
        dwMinBitRate                221184000
        dwMaxBitRate                221184000
        dwMaxVideoFrameBufferSize      921600
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  7 (FRAME_MJPEG)
        bFrameIndex                         2
        bmCapabilities                   0x01
          Still image supported
        wWidth                            160
        wHeight                           120
        dwMinBitRate                 13824000
        dwMaxBitRate                 13824000
        dwMaxVideoFrameBufferSize       57600
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  7 (FRAME_MJPEG)
        bFrameIndex                         3
        bmCapabilities                   0x01
          Still image supported
        wWidth                            176
        wHeight                           144
        dwMinBitRate                 18247680
        dwMaxBitRate                 18247680
        dwMaxVideoFrameBufferSize       76032
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  7 (FRAME_MJPEG)
        bFrameIndex                         4
        bmCapabilities                   0x01
          Still image supported
        wWidth                            320
        wHeight                           240
        dwMinBitRate                 55296000
        dwMaxBitRate                 55296000
        dwMaxVideoFrameBufferSize      230400
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  7 (FRAME_MJPEG)
        bFrameIndex                         5
        bmCapabilities                   0x01
          Still image supported
        wWidth                            352
        wHeight                           288
        dwMinBitRate                 72990720
        dwMaxBitRate                 72990720
        dwMaxVideoFrameBufferSize      304128
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  7 (FRAME_MJPEG)
        bFrameIndex                         6
        bmCapabilities                   0x01
          Still image supported
        wWidth                           1280
        wHeight                           720
        dwMinBitRate                663552000
        dwMaxBitRate                663552000
        dwMaxVideoFrameBufferSize     2764800
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  7 (FRAME_MJPEG)
        bFrameIndex                         7
        bmCapabilities                   0x01
          Still image supported
        wWidth                            640
        wHeight                           360
        dwMinBitRate                165888000
        dwMaxBitRate                165888000
        dwMaxVideoFrameBufferSize      691200
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  7 (FRAME_MJPEG)
        bFrameIndex                         8
        bmCapabilities                   0x01
          Still image supported
        wWidth                            640
        wHeight                           480
        dwMinBitRate                221184000
        dwMaxBitRate                221184000
        dwMaxVideoFrameBufferSize      921600
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                             6
        bDescriptorType                    36
        bDescriptorSubtype                 13 (COLORFORMAT)
        bColorPrimaries                     1 (BT.709,sRGB)
        bTransferCharacteristics            1 (BT.709)
        bMatrixCoefficients                 4 (SMPTE 170M (BT.601))
    ... [snip]...
 

hogfish

Bronze Level Poster
Ultranote webcam and video display problems. [Solved]

A small update. I mentioned above that guvcview was not working.

Guvcview version 2.0.1 is now working. That is the git version. Thanks to Paulo Assis.
I don't think that that version will have made it to any distributions yet (early October 2014).
Also I think Paulo may make further improvements before the next release.

In the course of testing, I discovered problems with guvcview, cheese, vlc, xine and mplayer
when displaying video. That seems to have been problems with library versions. These have now been cured
with the latest library versions (in debian testing at least).

If you have similar problems, you may need to get hold of the latest library updates.

I should perhaps mention that this is all with the Haskell i7 "i7-4712MQ" CPU which has an
on chip GPU. The relevant intel data sheets are
  • xeon-e3-1200v3-vol-1-datasheet.pdf
  • xeon-e3-1200v3-vol-2-datasheet.pdf
  • xeon-e3-1200v3-spec-update.pdf
  • intel-gfx-prm-osrc-hsw-*
where the gfx- manuals detail the graphics architecture.

If you have another CPU, perhaps the gpu is different. All that said, I suspect that the problems were higher up the graphics stack.
 
Top