blob: cbafd1990fdedd5c9d167d9a34c59c86202511f5 [file] [log] [blame]
developer369b0392022-09-20 14:50:36 +08001/*
2 * Copyright (c) 2022, Mediatek Inc. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <errno.h>
8#include <common/debug.h>
9
10#include <audio.h>
11#include <mt_audio_private.h>
12#include <mtk_mmap_pool.h>
13#include <platform_def.h>
14#include <spm_reg.h>
15
16#define MODULE_TAG "[AUDIO_DOMAIN]"
17
18int32_t set_audio_domain_sidebands(void)
19{
20 uint32_t val = mmio_read_32(PWR_STATUS);
21
22 if ((val & BIT(SPM_PWR_STATUS_AUDIO_BIT)) == 0) {
23 ERROR("%s: %s, pwr_status=0x%x, w/o [%d]AUDIO!\n",
24 MODULE_TAG, __func__, val, SPM_PWR_STATUS_AUDIO_BIT);
25 return -EIO;
26 }
27
28 mmio_write_32(AFE_SE_SECURE_CON, 0x0);
29
30 mmio_write_32(AFE_SECURE_SIDEBAND0, 0x0);
31 mmio_write_32(AFE_SECURE_SIDEBAND1, 0x0);
32 mmio_write_32(AFE_SECURE_SIDEBAND2, 0x0);
33 mmio_write_32(AFE_SECURE_SIDEBAND3, 0x0);
34
35 VERBOSE("%s: %s, SE_SECURE_CON=0x%x, SIDEBAND0/1/2/3=0x%x/0x%x/0x%x/0x%x\n",
36 MODULE_TAG, __func__,
37 mmio_read_32(AFE_SE_SECURE_CON),
38 mmio_read_32(AFE_SECURE_SIDEBAND0),
39 mmio_read_32(AFE_SECURE_SIDEBAND1),
40 mmio_read_32(AFE_SECURE_SIDEBAND2),
41 mmio_read_32(AFE_SECURE_SIDEBAND3));
42
43 return 0;
44}