1
0
Fork 0

android: tinyalsa_hal: Add support for rt5616 codec

Signed-off-by: hmz007 <hmz007@gmail.com>
Change-Id: I8ea3b10413ff1eb7ad1a2d9ef12b19bb892c1c5a
master
hmz007 2 years ago
parent 3d30a812ec
commit fa99dbcbe0

@ -14,6 +14,7 @@
#include "config.h"
#include "default_config.h"
#include "nanopi6_config.h"
#include "rk616_config.h"
#include "rt3261_config.h"
#include "rt5616_config.h"
@ -40,6 +41,10 @@ struct alsa_sound_card_config
* according to the name of sound card 0 and sound_card_name.
*/
struct alsa_sound_card_config sound_card_config_list[] = {
{
.sound_card_name = "realtekrt5616co",
.route_table = &nanopi6_config_table,
},
{
.sound_card_name = "RKRK616",
.route_table = &rk616_config_table,

@ -0,0 +1,524 @@
/*
* Copyright (c) 2023 FriendlyElec Computer Tech. Co., Ltd.
* (http://www.friendlyelec.com)
*
* Copyright (C) 2015 Rockchip Electronics Co., Ltd.
*/
#ifndef _NANOPI6_CONFIG_H_
#define _NANOPI6_CONFIG_H_
#include "config.h"
const struct config_control rt5616c_speaker_normal_controls[] = {
{
.ctl_name = "DAC MIXL INF1 Switch",
.int_val = {on},
},
{
.ctl_name = "DAC MIXR INF1 Switch",
.int_val = {on},
},
{
.ctl_name = "Stereo DAC MIXL DAC L1 Switch",
.int_val = {on},
},
{
.ctl_name = "Stereo DAC MIXR DAC R1 Switch",
.int_val = {on},
},
{
.ctl_name = "DAC1 Playback Volume",
.int_val = {159, 159},
// ==> 0 dB - (175 - 159) * 0.375 = 0 - 16 * 0.375 = -6 dB
},
{
.ctl_name = "HP Playback Volume",
.int_val = {31, 31},
// ==> -46.5 dB + 31 * 1.5 = 0 dB
},
{
.ctl_name = "OUT MIXL DAC L1 Switch",
.int_val = {on},
},
{
.ctl_name = "OUT MIXR DAC R1 Switch",
.int_val = {on},
},
{
.ctl_name = "HPO MIX DAC1 Switch",
.int_val = {on},
},
{
.ctl_name = "HPO MIX HPVOL Switch",
.int_val = {on},
},
{
.ctl_name = "HPVOL Playback Switch",
.int_val = {on, on},
},
};
const struct config_control rt5616c_speaker_incall_controls[] = {
};
const struct config_control rt5616c_speaker_ringtone_controls[] = {
};
const struct config_control rt5616c_speaker_voip_controls[] = {
};
const struct config_control rt5616c_earpiece_normal_controls[] = {
};
const struct config_control rt5616c_earpiece_incall_controls[] = {
};
const struct config_control rt5616c_earpiece_ringtone_controls[] = {
};
const struct config_control rt5616c_earpiece_voip_controls[] = {
};
const struct config_control rt5616c_headphone_normal_controls[] = {
{
.ctl_name = "DAC MIXL INF1 Switch",
.int_val = {on},
},
{
.ctl_name = "DAC MIXR INF1 Switch",
.int_val = {on},
},
{
.ctl_name = "Stereo DAC MIXL DAC L1 Switch",
.int_val = {on},
},
{
.ctl_name = "Stereo DAC MIXR DAC R1 Switch",
.int_val = {on},
},
{
.ctl_name = "DAC1 Playback Volume",
.int_val = {159, 159},
},
{
.ctl_name = "HP Playback Volume",
.int_val = {31, 31},
},
{
.ctl_name = "OUT MIXL DAC L1 Switch",
.int_val = {on},
},
{
.ctl_name = "OUT MIXR DAC R1 Switch",
.int_val = {on},
},
{
.ctl_name = "HPO MIX DAC1 Switch",
.int_val = {on},
},
{
.ctl_name = "HPO MIX HPVOL Switch",
.int_val = {on},
},
{
.ctl_name = "HPVOL Playback Switch",
.int_val = {on, on},
},
};
const struct config_control rt5616c_headphone_incall_controls[] = {
};
const struct config_control rt5616c_headphone_ringtone_controls[] = {
};
const struct config_control rt5616c_speaker_headphone_normal_controls[] = {
};
const struct config_control rt5616c_speaker_headphone_ringtone_controls[] = {
};
const struct config_control rt5616c_headphone_voip_controls[] = {
};
const struct config_control rt5616c_headset_normal_controls[] = {
{
.ctl_name = "DAC MIXL INF1 Switch",
.int_val = {on},
},
{
.ctl_name = "DAC MIXR INF1 Switch",
.int_val = {on},
},
{
.ctl_name = "Stereo DAC MIXL DAC L1 Switch",
.int_val = {on},
},
{
.ctl_name = "Stereo DAC MIXR DAC R1 Switch",
.int_val = {on},
},
{
.ctl_name = "DAC1 Playback Volume",
.int_val = {159, 159},
},
{
.ctl_name = "HP Playback Volume",
.int_val = {31, 31},
},
{
.ctl_name = "OUT MIXL DAC L1 Switch",
.int_val = {on},
},
{
.ctl_name = "OUT MIXR DAC R1 Switch",
.int_val = {on},
},
{
.ctl_name = "HPO MIX DAC1 Switch",
.int_val = {on},
},
{
.ctl_name = "HPO MIX HPVOL Switch",
.int_val = {on},
},
{
.ctl_name = "HPVOL Playback Switch",
.int_val = {on, on},
},
};
const struct config_control rt5616c_headset_incall_controls[] = {
};
const struct config_control rt5616c_headset_ringtone_controls[] = {
};
const struct config_control rt5616c_headset_voip_controls[] = {
};
const struct config_control rt5616c_bluetooth_normal_controls[] = {
};
const struct config_control rt5616c_bluetooth_incall_controls[] = {
};
const struct config_control rt5616c_bluetooth_voip_controls[] = {
};
const struct config_control rt5616c_hands_free_mic_capture_controls[] = {
#if 0
{
.ctl_name = "ADC Capture Switch",
.int_val = {on, on},
},
#endif
{
.ctl_name = "Stereo1 ADC MIXL ADC1 Switch",
.int_val = {on},
},
{
.ctl_name = "Stereo1 ADC MIXR ADC1 Switch",
.int_val = {on},
},
{
.ctl_name = "IN1 Boost Volume",
.int_val = {1},
// ==> 20 dB
},
{
.ctl_name = "ADC Boost Volume",
.int_val = {0, 0},
// ==> 0 dB
},
{
.ctl_name = "ADC Capture Volume",
.int_val = {71, 71},
// ==> 71 * 0.375 - 17.625 = 9 dB
},
{
.ctl_name = "RECMIXL BST1 Switch",
.int_val = {on},
},
{
.ctl_name = "RECMIXR BST1 Switch",
.int_val = {on},
},
};
const struct config_control rt5616c_main_mic_capture_controls[] = {
{
.ctl_name = "RECMIXL BST1 Switch",
.int_val = {on},
},
{
.ctl_name = "RECMIXR BST1 Switch",
.int_val = {on},
},
{
.ctl_name = "Stereo1 ADC MIXL ADC1 Switch",
.int_val = {on},
},
{
.ctl_name = "Stereo1 ADC MIXR ADC1 Switch",
.int_val = {on},
},
{
.ctl_name = "IN1 Boost Volume",
.int_val = {1},
},
{
.ctl_name = "ADC Boost Volume",
.int_val = {0, 0},
},
{
.ctl_name = "ADC Capture Volume",
.int_val = {71, 71},
},
};
const struct config_control rt5616c_bluetooth_sco_mic_capture_controls[] = {
};
const struct config_control rt5616c_playback_off_controls[] = {
};
const struct config_control rt5616c_capture_off_controls[] = {
};
const struct config_control rt5616c_incall_off_controls[] = {
};
const struct config_control rt5616c_voip_off_controls[] = {
};
const struct config_route_table nanopi6_config_table = {
//speaker
.speaker_normal = {
.sound_card = 0,
.devices = DEVICES_0,
.controls = rt5616c_speaker_normal_controls,
.controls_count = sizeof(rt5616c_speaker_normal_controls) / sizeof(struct config_control),
},
.speaker_incall = {
.sound_card = 0,
.devices = DEVICES_0,
.controls = rt5616c_speaker_incall_controls,
.controls_count = sizeof(rt5616c_speaker_incall_controls) / sizeof(struct config_control),
},
.speaker_ringtone = {
.sound_card = 0,
.devices = DEVICES_0,
.controls = rt5616c_speaker_ringtone_controls,
.controls_count = sizeof(rt5616c_speaker_ringtone_controls) / sizeof(struct config_control),
},
.speaker_voip = {
.sound_card = 0,
.devices = DEVICES_0,
.controls = rt5616c_speaker_voip_controls,
.controls_count = sizeof(rt5616c_speaker_voip_controls) / sizeof(struct config_control),
},
//earpiece
.earpiece_normal = {
.sound_card = 0,
.devices = DEVICES_0,
.controls = rt5616c_earpiece_normal_controls,
.controls_count = sizeof(rt5616c_earpiece_normal_controls) / sizeof(struct config_control),
},
.earpiece_incall = {
.sound_card = 0,
.devices = DEVICES_0,
.controls = rt5616c_earpiece_incall_controls,
.controls_count = sizeof(rt5616c_earpiece_incall_controls) / sizeof(struct config_control),
},
.earpiece_ringtone = {
.sound_card = 0,
.devices = DEVICES_0,
.controls = rt5616c_earpiece_ringtone_controls,
.controls_count = sizeof(rt5616c_earpiece_ringtone_controls) / sizeof(struct config_control),
},
.earpiece_voip = {
.sound_card = 0,
.devices = DEVICES_0,
.controls = rt5616c_earpiece_voip_controls,
.controls_count = sizeof(rt5616c_earpiece_voip_controls) / sizeof(struct config_control),
},
//headphone
.headphone_normal = {
.sound_card = 0,
.devices = DEVICES_0,
.controls = rt5616c_headphone_normal_controls,
.controls_count = sizeof(rt5616c_headphone_normal_controls) / sizeof(struct config_control),
},
.headphone_incall = {
.sound_card = 0,
.devices = DEVICES_0,
.controls = rt5616c_headphone_incall_controls,
.controls_count = sizeof(rt5616c_headphone_incall_controls) / sizeof(struct config_control),
},
.headphone_ringtone = {
.sound_card = 0,
.devices = DEVICES_0,
.controls = rt5616c_headphone_ringtone_controls,
.controls_count = sizeof(rt5616c_headphone_ringtone_controls) / sizeof(struct config_control),
},
.speaker_headphone_normal = {
.sound_card = 0,
.devices = DEVICES_0,
.controls = rt5616c_speaker_headphone_normal_controls,
.controls_count = sizeof(rt5616c_speaker_headphone_normal_controls) / sizeof(struct config_control),
},
.speaker_headphone_ringtone = {
.sound_card = 0,
.devices = DEVICES_0,
.controls = rt5616c_speaker_headphone_ringtone_controls,
.controls_count = sizeof(rt5616c_speaker_headphone_ringtone_controls) / sizeof(struct config_control),
},
.headphone_voip = {
.sound_card = 0,
.devices = DEVICES_0,
.controls = rt5616c_headphone_voip_controls,
.controls_count = sizeof(rt5616c_headphone_voip_controls) / sizeof(struct config_control),
},
//headset
.headset_normal = {
.sound_card = 0,
.devices = DEVICES_0,
.controls = rt5616c_headset_normal_controls,
.controls_count = sizeof(rt5616c_headset_normal_controls) / sizeof(struct config_control),
},
.headset_incall = {
.sound_card = 0,
.devices = DEVICES_0,
.controls = rt5616c_headset_incall_controls,
.controls_count = sizeof(rt5616c_headset_incall_controls) / sizeof(struct config_control),
},
.headset_ringtone = {
.sound_card = 0,
.devices = DEVICES_0,
.controls = rt5616c_headset_ringtone_controls,
.controls_count = sizeof(rt5616c_headset_ringtone_controls) / sizeof(struct config_control),
},
.headset_voip = {
.sound_card = 0,
.devices = DEVICES_0,
.controls = rt5616c_headset_voip_controls,
.controls_count = sizeof(rt5616c_headset_voip_controls) / sizeof(struct config_control),
},
//bluetooth
.bluetooth_normal = {
.sound_card = 0,
.devices = DEVICES_0,
.controls = rt5616c_bluetooth_normal_controls,
.controls_count = sizeof(rt5616c_bluetooth_normal_controls) / sizeof(struct config_control),
},
.bluetooth_incall = {
.sound_card = 0,
.devices = DEVICES_0_1,
.controls = rt5616c_bluetooth_incall_controls,
.controls_count = sizeof(rt5616c_bluetooth_incall_controls) / sizeof(struct config_control),
},
.bluetooth_voip = {
.sound_card = 0,
.devices = DEVICES_0_1,
.controls = rt5616c_bluetooth_voip_controls,
.controls_count = sizeof(rt5616c_bluetooth_voip_controls) / sizeof(struct config_control),
},
//capture
.main_mic_capture = {
.sound_card = 0,
.devices = DEVICES_0,
.controls = rt5616c_main_mic_capture_controls,
.controls_count = sizeof(rt5616c_main_mic_capture_controls) / sizeof(struct config_control),
},
.hands_free_mic_capture = {
.sound_card = 0,
.devices = DEVICES_0,
.controls = rt5616c_hands_free_mic_capture_controls,
.controls_count = sizeof(rt5616c_hands_free_mic_capture_controls) / sizeof(struct config_control),
},
.bluetooth_sco_mic_capture = {
.sound_card = 0,
.devices = DEVICES_0_1,
.controls = rt5616c_bluetooth_sco_mic_capture_controls,
.controls_count = sizeof(rt5616c_bluetooth_sco_mic_capture_controls) / sizeof(struct config_control),
},
//off
.playback_off = {
.controls = rt5616c_playback_off_controls,
.controls_count = sizeof(rt5616c_playback_off_controls) / sizeof(struct config_control),
},
.capture_off = {
.controls = rt5616c_capture_off_controls,
.controls_count = sizeof(rt5616c_capture_off_controls) / sizeof(struct config_control),
},
.incall_off = {
.controls = rt5616c_incall_off_controls,
.controls_count = sizeof(rt5616c_incall_off_controls) / sizeof(struct config_control),
},
.voip_off = {
.controls = rt5616c_voip_off_controls,
.controls_count = sizeof(rt5616c_voip_off_controls) / sizeof(struct config_control),
},
//hdmi
.hdmi_normal = {
.sound_card = 1,
.devices = DEVICES_0,
.controls_count = 0,
},
//usb audio
.usb_normal = {
.sound_card = 2,
.devices = DEVICES_0,
.controls_count = 0,
},
.usb_capture = {
.sound_card = 2,
.devices = DEVICES_0,
.controls_count = 0,
},
};
#endif //_NANOPI6_CONFIG_H_
Loading…
Cancel
Save