Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 1 | /* |
| 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 Kasam | 605b42f | 2017-08-01 22:02:15 +0530 | [diff] [blame] | 12 | * |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 13 | */ |
| 14 | |
| 15 | #ifndef __RTAC_H__ |
| 16 | #define __RTAC_H__ |
| 17 | |
Laxminath Kasam | 605b42f | 2017-08-01 22:02:15 +0530 | [diff] [blame] | 18 | #include <dsp/apr_audio-v2.h> |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 19 | |
| 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 | |
| 30 | enum { |
| 31 | ADM_RTAC_CAL, |
| 32 | ASM_RTAC_CAL, |
| 33 | VOICE_RTAC_CAL, |
| 34 | AFE_RTAC_CAL, |
| 35 | MAX_RTAC_BLOCKS |
| 36 | }; |
| 37 | |
| 38 | struct 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 | |
| 45 | struct rtac_cal_data { |
| 46 | size_t size; |
| 47 | void *kvaddr; |
| 48 | phys_addr_t paddr; |
| 49 | }; |
| 50 | |
| 51 | struct rtac_cal_block_data { |
| 52 | struct rtac_cal_mem_map_data map_data; |
| 53 | struct rtac_cal_data cal_data; |
| 54 | }; |
| 55 | |
| 56 | struct rtac_popp_data { |
| 57 | uint32_t popp; |
| 58 | uint32_t popp_topology; |
| 59 | uint32_t app_type; |
| 60 | }; |
| 61 | |
| 62 | struct 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 | |
| 73 | struct rtac_adm { |
| 74 | uint32_t num_of_dev; |
| 75 | struct rtac_adm_data device[RTAC_MAX_ACTIVE_DEVICES]; |
| 76 | }; |
| 77 | |
| 78 | void rtac_add_adm_device(u32 port_id, u32 copp_id, u32 path_id, u32 popp_id, |
| 79 | u32 app_type, u32 acdb_dev_id); |
| 80 | void rtac_remove_adm_device(u32 port_id, u32 copp_id); |
| 81 | void rtac_remove_popp_from_adm_devices(u32 popp_id); |
| 82 | void 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); |
| 84 | void rtac_remove_voice(u32 cvs_handle); |
| 85 | void rtac_set_adm_handle(void *handle); |
| 86 | bool rtac_make_adm_callback(uint32_t *payload, u32 payload_size); |
| 87 | void rtac_copy_adm_payload_to_user(void *payload, u32 payload_size); |
| 88 | void rtac_set_asm_handle(u32 session_id, void *handle); |
| 89 | bool rtac_make_asm_callback(u32 session_id, uint32_t *payload, |
| 90 | u32 payload_size); |
| 91 | void rtac_copy_asm_payload_to_user(void *payload, u32 payload_size); |
| 92 | void rtac_set_voice_handle(u32 mode, void *handle); |
| 93 | bool rtac_make_voice_callback(u32 mode, uint32_t *payload, u32 payload_size); |
| 94 | void rtac_copy_voice_payload_to_user(void *payload, u32 payload_size); |
| 95 | int rtac_clear_mapping(uint32_t cal_type); |
| 96 | bool rtac_make_afe_callback(uint32_t *payload, u32 payload_size); |
| 97 | void rtac_set_afe_handle(void *handle); |
| 98 | void get_rtac_adm_data(struct rtac_adm *adm_data); |
| 99 | void rtac_update_afe_topology(u32 port_id); |
| 100 | #endif |