4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jonghyuk Choi <jhchoi.choi@samsung.com>
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #ifndef __AVSYS_AUDIO_PATH_H__
23 #define __AVSYS_AUDIO_PATH_H__
25 #include "avsys-audio.h"
26 #include "avsys-audio-handle.h"
28 #include <sys/types.h>
32 AVSYS_AUDIO_INSERTED_NONE = 0,
33 AVSYS_AUDIO_INSERTED_3,
34 AVSYS_AUDIO_INSERTED_4,
35 AVSYS_AUDIO_INSERTED_AV
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
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
55 enum avsys_audio_ear_ctrl {
56 AVSYS_AUDIO_EAR_SWITCH_AUTO_WITH_MUTE = 1,
57 AVSYS_AUDIO_EAR_SWITCH_AUTO_WITHOUT_MUTE,
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
67 #define PATH_FIXED_NONE (0x00000000)
68 #define PATH_FIXED_WITH_CALL (1 << PATH_FIXED_TYPE_CALL) /* 0x00000002 */
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,
76 enum path_fixed_type_t {
77 PATH_FIXED_TYPE_FMRADIO = 0,
82 struct audio_route_info_t {
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;
97 gain_info_t backup_gain;
98 path_info_t backup_path;
103 option_info_t option;
105 /* path fixed information */
107 pid_t path_fixed_pid[PATH_FIXED_TYPE_MAX];
112 /* For earphone control */
117 bool control_aif_before_path_set;
118 bool gain_debug_mode;
120 /* For Lock debugging */
121 pid_t pathlock_pid[AVSYS_AUDIO_LOCK_SLOT_MAX];
122 } avsys_audio_path_ex_info_t;
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);
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);
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);
147 #endif /* __AVSYS_AUDIO_PATH_H__ */