Project

General

Profile

新建 #269 » 0001-fix-rd-rk3588-an-issue-where-hdmi1-cannot-output-aud.patch

刘 志飞, 09/27/2024 09:00 AM

View differences:

hardware/rockchip/audio/tinyalsa_hal/audio_hw.c
{"rockchiphdmi", NULL,},
{"rockchiphdmi0", NULL,},
{"rockchiprt5640c", "i2s-hifi",},
{"rockchipes8311", "i2s-hifi",},
//{"rockchipes8311", "i2s-hifi",},
{NULL, NULL}, /* Note! Must end with NULL, else will cause crash */
};
......
{"rockchiprk809co", NULL,},
{"rockchiprk817co", NULL,},
{"rockchiprt5640c", NULL,},
{"rockchipes8311", NULL},
{"rockchippdmmica", NULL},
{"rockchipes8311", NULL,},
{"rockchippdmmica", NULL,},
{"rockchiprt5670c", NULL,},
{"rockchiprt5672c", NULL,},
{NULL, NULL}, /* Note! Must end with NULL, else will cause crash */
......
#ifndef SUPPORT_MULTIAUDIO
#ifdef BOX_HAL
if (!(out->device & (AUDIO_DEVICE_OUT_WIRED_HEADSET |
AUDIO_DEVICE_OUT_WIRED_HEADPHONE))) {
// if (!(out->device & (AUDIO_DEVICE_OUT_WIRED_HEADSET |
// AUDIO_DEVICE_OUT_WIRED_HEADPHONE))) {
// ALOGI("rpdzkj__, %s, enter hdmi audio policy", __func__);
open_sound_card_policy(out);
}
//}
#endif
#endif
......
for (int i = 0; i < out->num_configs; ++i) {
ALOGD("%s: i = %d, device = 0x%x", __FUNCTION__, i, out->devices[i]);
//if (out->devices[i] == AUDIO_DEVICE_OUT_AUX_DIGITAL) {
if (1) {
audio_devices_t route_device = out->devices[i];
//if (1) {
// audio_devices_t route_device = out->devices[i];
if (!(out->devices[i] & (AUDIO_DEVICE_OUT_WIRED_HEADSET |
AUDIO_DEVICE_OUT_WIRED_HEADPHONE))) {
if(adev->dev_out[SND_OUT_SOUND_CARD_HDMI].card != SND_OUT_SOUND_CARD_UNKNOWN){
out->device |= AUDIO_DEVICE_OUT_AUX_DIGITAL;
audio_devices_t route_device = AUDIO_DEVICE_OUT_AUX_DIGITAL;
route_pcm_card_open(adev->dev_out[SND_OUT_SOUND_CARD_HDMI].card, getRouteFromDevice(route_device));
if (adev->owner[SOUND_CARD_HDMI] == NULL) {
card = adev->dev_out[SND_OUT_SOUND_CARD_HDMI].card;
......
adev->owner[SOUND_CARD_HDMI] = (int*)out;
}
}
} else {
ALOGD("The current HDMI is DVI mode");
out->device |= AUDIO_DEVICE_OUT_SPEAKER;
}
// if (out->device & (AUDIO_DEVICE_OUT_SPEAKER |
// AUDIO_DEVICE_OUT_WIRED_HEADSET |
// AUDIO_DEVICE_OUT_WIRED_HEADPHONE |
// AUDIO_DEVICE_OUT_ALL_SCO)) {
if (1) { //rpdzkj
audio_devices_t route_device = out->device & (AUDIO_DEVICE_OUT_SPEAKER |
AUDIO_DEVICE_OUT_WIRED_HEADSET |
AUDIO_DEVICE_OUT_WIRED_HEADPHONE |
AUDIO_DEVICE_OUT_ALL_SCO);
route_pcm_card_open(adev->dev_out[SND_OUT_SOUND_CARD_SPEAKER].card, getRouteFromDevice(route_device));
card = adev->dev_out[SND_OUT_SOUND_CARD_SPEAKER].card;
device = adev->dev_out[SND_OUT_SOUND_CARD_SPEAKER].device;
if(card != (int)SND_OUT_SOUND_CARD_UNKNOWN) {
out->pcm[SND_OUT_SOUND_CARD_SPEAKER] = pcm_open(card, device,
PCM_OUT | PCM_MONOTONIC, &out->config);
if (out->pcm[SND_OUT_SOUND_CARD_SPEAKER] && !pcm_is_ready(out->pcm[SND_OUT_SOUND_CARD_SPEAKER])) {
ALOGE("pcm_open(PCM_CARD) failed: %s,card number = %d",
pcm_get_error(out->pcm[SND_OUT_SOUND_CARD_SPEAKER]),card);
pcm_close(out->pcm[SND_OUT_SOUND_CARD_SPEAKER]);
return -ENOMEM;
// if (1) { //rpdzkj
// audio_devices_t route_device = out->device & (AUDIO_DEVICE_OUT_SPEAKER |
// AUDIO_DEVICE_OUT_WIRED_HEADSET |
// AUDIO_DEVICE_OUT_WIRED_HEADPHONE |
// AUDIO_DEVICE_OUT_ALL_SCO);
// route_pcm_card_open(adev->dev_out[SND_OUT_SOUND_CARD_SPEAKER].card, getRouteFromDevice(route_device));
// card = adev->dev_out[SND_OUT_SOUND_CARD_SPEAKER].card;
// device = adev->dev_out[SND_OUT_SOUND_CARD_SPEAKER].device;
// if(card != (int)SND_OUT_SOUND_CARD_UNKNOWN) {
// out->pcm[SND_OUT_SOUND_CARD_SPEAKER] = pcm_open(card, device,
// PCM_OUT | PCM_MONOTONIC, &out->config);
// if (out->pcm[SND_OUT_SOUND_CARD_SPEAKER] && !pcm_is_ready(out->pcm[SND_OUT_SOUND_CARD_SPEAKER])) {
// ALOGE("pcm_open(PCM_CARD) failed: %s,card number = %d",
// pcm_get_error(out->pcm[SND_OUT_SOUND_CARD_SPEAKER]),card);
// pcm_close(out->pcm[SND_OUT_SOUND_CARD_SPEAKER]);
// return -ENOMEM;
}
}
......
if (ret < 0) return ret;
}
if (out->devices[i] == AUDIO_DEVICE_OUT_SPDIF) {
//if (out->devices[i] == AUDIO_DEVICE_OUT_SPDIF) {
if (!(out->devices[i] & (AUDIO_DEVICE_OUT_WIRED_HEADSET |
AUDIO_DEVICE_OUT_WIRED_HEADPHONE))) {
if(adev->dev_out[SND_OUT_SOUND_CARD_SPDIF].card != SND_OUT_SOUND_CARD_UNKNOWN){
out->device |= AUDIO_DEVICE_OUT_SPDIF;
if (adev->owner[SOUND_CARD_SPDIF] == NULL) {
card = adev->dev_out[SND_OUT_SOUND_CARD_SPDIF].card;
device = adev->dev_out[SND_OUT_SOUND_CARD_SPDIF].device;
......
if (is_multi_pcm(out) || is_bitstream(out)) {
adev->owner[SOUND_CARD_SPDIF] = (int*)out;
}
}
}
}
}
#ifdef SUPPORT_VX_ROCKCHIP
if (out->devices[i] == VX_ROCKCHIP_OUT_SPDIF0) {
card = adev->dev_out[SND_OUT_SOUND_CARD_SPDIF_1].card;
......
if (ret < 0) return ret;
}
if (out->devices[i] == VX_ROCKCHIP_OUT_HDMI0) {
//if (out->devices[i] == VX_ROCKCHIP_OUT_HDMI0) {
if (!(out->devices[i] & (AUDIO_DEVICE_OUT_WIRED_HEADSET |
AUDIO_DEVICE_OUT_WIRED_HEADPHONE))) {
if(adev->dev_out[SND_OUT_SOUND_CARD_HDMI_1].card != SND_OUT_SOUND_CARD_UNKNOWN){
out->device |= VX_ROCKCHIP_OUT_HDMI0;
card = adev->dev_out[SND_OUT_SOUND_CARD_HDMI_1].card;
device = adev->dev_out[SND_OUT_SOUND_CARD_HDMI_1].device;
ret = open_pcm(card, device, (int)SND_OUT_SOUND_CARD_HDMI_1, out);
if (ret < 0) return ret;
}
}
#endif
if (audio_is_bluetooth_out_sco_device(out->devices[i])) {
......
&out->resampler);
if (ret != 0) ret = -EINVAL;
}
}
}
}
#endif
(2-2/2)