1# Copyright 2016 The Chromium Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5"""This module provides cras audio configs.""" 6 7INTERNAL_MIC_GAIN_100DB = { 8 'chell': 500, 9 'auron_yuna': -1000, 10 'kevin': 0, 11} 12 13def get_proper_internal_mic_gain(board): 14 """Return a proper internal mic gain. 15 16 @param board: Board name. 17 18 @returns: A number in 100 dB. E.g., 1000 is 10dB. This is in the same unit 19 as cras_utils set_capture_gain. Returns None if there is no such 20 entry. 21 """ 22 return INTERNAL_MIC_GAIN_100DB.get(board, None) 23 24INTERNAL_MIC_NODE = { 25 ('coral', 'nasher360'): 'FRONT_MIC', 26 ('nami', 'vayne'): 'FRONT_MIC', 27} 28 29def get_internal_mic_node(board, model): 30 """Return the expected internal microphone node for given board name and 31 model name. 32 33 @param board: board name of the DUT. 34 @param model: model name of the DUT. 35 36 @returns: The name of the expected internal microphone nodes. 37 """ 38 return INTERNAL_MIC_NODE.get((board, model), 'INTERNAL_MIC') 39 40INTERNAL_MIC_NODES = { 41 ('coral', 'nasher360'): ['FRONT_MIC', 'REAR_MIC'], 42 ('nami', 'vayne'): ['FRONT_MIC'], 43} 44 45def get_plugged_internal_mics(board, model): 46 """Return a list of all the plugged internal microphone nodes for given 47 board name and model name. 48 49 @param board: board name of the DUT. 50 @param model: model name of the DUT. 51 52 @returns: A list of all the plugged internal microphone nodes. 53 """ 54 return INTERNAL_MIC_NODES.get((board, model), ['INTERNAL_MIC']) 55