Revert "remove unused features"
[framework/multimedia/avsystem.git] / include / avsys-audio-path.h
1 /*
2  * avsystem
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Jonghyuk Choi <jhchoi.choi@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #ifndef __AVSYS_AUDIO_PATH_H__
23 #define __AVSYS_AUDIO_PATH_H__
24
25 #include "avsys-audio.h"
26 #include "avsys-audio-handle.h"
27
28 #include <sys/types.h>
29 #include <stdbool.h>
30
31 enum {
32     AVSYS_AUDIO_INSERTED_NONE = 0,
33     AVSYS_AUDIO_INSERTED_3,
34     AVSYS_AUDIO_INSERTED_4,
35     AVSYS_AUDIO_INSERTED_AV
36 };
37
38 enum avsys_audio_playback_gain{
39     AVSYS_AUDIO_PLAYBACK_GAIN_AP = 0,
40     AVSYS_AUDIO_PLAYBACK_GAIN_FMRADIO,
41     AVSYS_AUDIO_PLAYBACK_GAIN_VOICECALL,
42     AVSYS_AUDIO_PLAYBACK_GAIN_VIDEOCALL,
43     AVSYS_AUDIO_PLAYBACK_GAIN_CALLALERT,
44     AVSYS_AUDIO_PLAYBACK_GAIN_MAX
45 };
46
47 enum avsys_audio_capture_gain{
48     AVSYS_AUDIO_CAPTURE_GAIN_AP = 0,
49     AVSYS_AUDIO_CAPTURE_GAIN_FMRADIO,
50     AVSYS_AUDIO_CAPTURE_GAIN_VOICECALL,
51     AVSYS_AUDIO_CAPTURE_GAIN_VIDEOCALL,
52     AVSYS_AUDIO_CAPTURE_GAIN_MAX
53 };
54
55 enum avsys_audio_ear_ctrl {
56         AVSYS_AUDIO_EAR_SWITCH_AUTO_WITH_MUTE = 1,
57         AVSYS_AUDIO_EAR_SWITCH_AUTO_WITHOUT_MUTE,
58 };
59
60
61 #define TYPE_EVENT_SWITCH                       0x05
62 #define CODE_HEADPHONE_INSERT           0x02
63 #define CODE_MICROPHONE_INSERT          0x04
64 #define CODE_LINEOUT_INSERT                     0x06
65 #define CODE_JACK_PHYSICAL_INSERT       0x07
66
67 #define PATH_FIXED_NONE                     (0x00000000)
68 #define PATH_FIXED_WITH_CALL            (1 << PATH_FIXED_TYPE_CALL)         /* 0x00000002 */
69
70 enum avsys_audio_amp_t {
71     AVSYS_AUDIO_AMP_OFF = 0,    /**< AMP OFF in pda out */
72     AVSYS_AUDIO_AMP_ON,                 /**< AMP ON in pda out */
73     AVSYS_AUDIO_AMP_OFF_ALL,
74 };
75
76 enum path_fixed_type_t {
77     PATH_FIXED_TYPE_FMRADIO = 0,
78     PATH_FIXED_TYPE_CALL,
79     PATH_FIXED_TYPE_MAX,
80 };
81
82 struct audio_route_info_t {
83     int playback;
84     int capture;
85 };
86
87 typedef struct audio_route_info_t gain_info_t;
88 typedef struct audio_route_info_t path_info_t;
89 typedef struct audio_route_info_t option_info_t;
90 typedef struct audio_route_info_t gain_status_t;
91 typedef struct audio_route_info_t path_status_t;
92
93 typedef struct {
94         gain_info_t gain;
95         path_info_t path;
96
97         gain_info_t backup_gain;
98         path_info_t backup_path;
99
100         gain_info_t pregain;
101         gain_info_t reqgain;
102
103         option_info_t option;
104
105         /* path fixed information */
106         int     path_fixed;
107         pid_t path_fixed_pid[PATH_FIXED_TYPE_MAX];
108
109         /* hw mute */
110         int mute;
111
112         /* For earphone control */
113         int inserted;
114         int ear_auto;
115
116         int lvol_dev_type;
117         bool control_aif_before_path_set;
118         bool gain_debug_mode;
119
120         /* For Lock debugging */
121         pid_t pathlock_pid[AVSYS_AUDIO_LOCK_SLOT_MAX];
122 } avsys_audio_path_ex_info_t;
123
124 int avsys_audio_path_ex_init(void);
125 int avsys_audio_path_ex_fini(void);
126 int avsys_audio_path_ex_reset(int forced);
127 int avsys_audio_path_ex_dump(void);
128 int avsys_audio_path_ex_set_path(int gain, int out, int in, int option);
129 int avsys_audio_path_ex_get_path(int *gain, int *out, int *in, int *option);
130 int avsys_audio_path_manage_earjack(void);
131 int avsys_audio_path_ex_set_amp(const int onoff);
132 int avsys_audio_path_ex_set_mute(const int mute);
133 int avsys_audio_path_ex_get_mute(int  *mute);
134 int avsys_audio_path_set_volume(int handle);
135
136 int avsys_audio_path_earjack_init(int *init_type, int *outfd);
137 int avsys_audio_path_earjack_wait(int fd, int *current_type, int *new_type, int *is_auto_mute);
138 int avsys_audio_path_earjack_process(int new_type);
139 int avsys_audio_path_earjack_deinit(int fd);
140 int avsys_audio_path_earjack_unlock(void);
141
142 int avsys_audio_path_set_route_policy(avsys_audio_route_policy_t route);
143 int avsys_audio_path_get_route_policy(avsys_audio_route_policy_t *route);
144 int avsys_audio_path_check_cp_audio(bool *cpaudio, bool *btpath);
145 int avsys_audio_path_set_single_ascn(char *str);
146
147 #endif /* __AVSYS_AUDIO_PATH_H__ */