1#!/bin/sh 2# 3# Copyright (c) 2013 The Chromium OS Authors. All rights reserved. 4# Use of this source code is governed by a BSD-style license that can be 5# found in the LICENSE file. 6# 7# Collect information about the audio system from top to bottom. 8 9dump_cards() { 10 for card in ${@} 11 do 12 echo '=== amixer -c' $card scontents '===' 13 amixer -c $card scontents 14 echo '=== amixer -c' $card contents '===' 15 amixer -c $card contents 16 done 17} 18 19echo '=== cras_test_client --dump_server_info ===' 20cras_test_client --dump_server_info 21 22echo '=== cras_test_client --dump_audio_thread ===' 23cras_test_client --dump_audio_thread 24 25echo '=== cras_test_client --dump_bt ===' 26cras_test_client --dump_bt 27 28echo '=== cras_test_client --dump_events ===' 29cras_test_client --dump_events 30 31echo '=== aplay -l ===' 32aplay -l 33echo '=== arecord -l ===' 34arecord -l 35 36output_cards=$(aplay -l | egrep ^card | sed 's/card \([0-9]\+\).*/\1/' | sort -u) 37dump_cards $output_cards 38 39input_cards=$(arecord -l | egrep ^card | sed 's/card \([0-9]\+\).*/\1/' | sort -u) 40dump_cards $input_cards 41 42# HDA codec for codecs on x86. 43codecs=$(find /proc/asound -mindepth 2 -maxdepth 2 -path '*card*/codec#*') 44for codec in $codecs 45do 46 echo '=== codec:' $codec '===' 47 cat $codec 48done 49 50# I2C dump for codecs on arm. 51# Find lines like "max98088.7-0010" and extract "7 0x0010" from it. 52if [ -e /sys/kernel/debug/asoc/codecs ]; then 53 sed_expr='s/^\([^.-]\+\)\.\([0-9]\+\)-\([0-9]\+\)$/\2 0x\3/p' 54 sed -n "$sed_expr" /sys/kernel/debug/asoc/codecs | 55 while read i2c_addr 56 do 57 echo '===' i2cdump -f -y $i2c_addr '===' 58 i2cdump -f -y $i2c_addr 59 done 60fi 61