xref: /rk3399_ARM-atf/plat/mediatek/drivers/audio/audio.c (revision 6866675ae17a94e85a913c71b75f01c3de9290c3)
1 /*
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 <stdbool.h>
9 
10 #include <common/debug.h>
11 
12 #include <audio.h>
13 
14 #include <mtk_sip_svc.h>
15 
16 static u_register_t audio_smc_handler(u_register_t x1, u_register_t x2,
17 				      u_register_t x3, u_register_t x4,
18 				      void *handle, struct smccc_res *smccc_ret)
19 {
20 	uint32_t request_ops;
21 	int ret;
22 
23 	request_ops = (uint32_t)x1;
24 
25 	switch (request_ops) {
26 	case MTK_AUDIO_SMC_OP_DOMAIN_SIDEBANDS:
27 		ret = set_audio_domain_sidebands();
28 		break;
29 	default:
30 		ERROR("%s: %s: Unsupported request_ops %x\n",
31 		      MODULE_TAG, __func__, request_ops);
32 		ret = -EIO;
33 		break;
34 	}
35 
36 	VERBOSE("%s: %s, request_ops = %x, ret = %d\n",
37 		MODULE_TAG, __func__, request_ops, ret);
38 	return ret;
39 }
40 /* Register SiP SMC service */
41 DECLARE_SMC_HANDLER(MTK_SIP_AUDIO_CONTROL, audio_smc_handler);
42