blob: f8c5556c54554f43d033f4582c1b74c3a9975acf [file] [log] [blame]
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05301/*
2 * Copyright (c) 2011, 2013-2015, 2017, The Linux Foundation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
Laxminath Kasam605b42f2017-08-01 22:02:15 +053012 *
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053013 */
14
15#ifndef __RTAC_H__
16#define __RTAC_H__
17
Laxminath Kasam605b42f2017-08-01 22:02:15 +053018#include <dsp/apr_audio-v2.h>
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053019
20/* Voice Modes */
21#define RTAC_CVP 0
22#define RTAC_CVS 1
23#define RTAC_VOICE_MODES 2
24
25#define RTAC_MAX_ACTIVE_DEVICES 4
26#define RTAC_MAX_ACTIVE_POPP 8
27
28#define DEFAULT_APP_TYPE 0x00011130
29
30enum {
31 ADM_RTAC_CAL,
32 ASM_RTAC_CAL,
33 VOICE_RTAC_CAL,
34 AFE_RTAC_CAL,
35 MAX_RTAC_BLOCKS
36};
37
38struct rtac_cal_mem_map_data {
39 uint32_t map_size;
40 uint32_t map_handle;
41 struct ion_client *ion_client;
42 struct ion_handle *ion_handle;
43};
44
45struct rtac_cal_data {
46 size_t size;
47 void *kvaddr;
48 phys_addr_t paddr;
49};
50
51struct rtac_cal_block_data {
52 struct rtac_cal_mem_map_data map_data;
53 struct rtac_cal_data cal_data;
54};
55
56struct rtac_popp_data {
57 uint32_t popp;
58 uint32_t popp_topology;
59 uint32_t app_type;
60};
61
62struct rtac_adm_data {
63 uint32_t topology_id;
64 uint32_t afe_topology;
65 uint32_t afe_port;
66 uint32_t copp;
67 uint32_t num_of_popp;
68 uint32_t app_type;
69 uint32_t acdb_dev_id;
70 struct rtac_popp_data popp[RTAC_MAX_ACTIVE_POPP];
71};
72
73struct rtac_adm {
74 uint32_t num_of_dev;
75 struct rtac_adm_data device[RTAC_MAX_ACTIVE_DEVICES];
76};
77
78void rtac_add_adm_device(u32 port_id, u32 copp_id, u32 path_id, u32 popp_id,
79 u32 app_type, u32 acdb_dev_id);
80void rtac_remove_adm_device(u32 port_id, u32 copp_id);
81void rtac_remove_popp_from_adm_devices(u32 popp_id);
82void rtac_add_voice(u32 cvs_handle, u32 cvp_handle, u32 rx_afe_port,
83 u32 tx_afe_port, u32 rx_acdb_id, u32 tx_acdb_id, u32 session_id);
84void rtac_remove_voice(u32 cvs_handle);
85void rtac_set_adm_handle(void *handle);
86bool rtac_make_adm_callback(uint32_t *payload, u32 payload_size);
87void rtac_copy_adm_payload_to_user(void *payload, u32 payload_size);
88void rtac_set_asm_handle(u32 session_id, void *handle);
89bool rtac_make_asm_callback(u32 session_id, uint32_t *payload,
90 u32 payload_size);
91void rtac_copy_asm_payload_to_user(void *payload, u32 payload_size);
92void rtac_set_voice_handle(u32 mode, void *handle);
93bool rtac_make_voice_callback(u32 mode, uint32_t *payload, u32 payload_size);
94void rtac_copy_voice_payload_to_user(void *payload, u32 payload_size);
95int rtac_clear_mapping(uint32_t cal_type);
96bool rtac_make_afe_callback(uint32_t *payload, u32 payload_size);
97void rtac_set_afe_handle(void *handle);
98void get_rtac_adm_data(struct rtac_adm *adm_data);
99void rtac_update_afe_topology(u32 port_id);
100#endif