Change get_params prototype
[platform/adaptation/nexell/audio-hal-alc5658.git] / hal-backend-audio.c
1 /*
2  * audio-hal
3  *
4  * Copyright (c) 2021 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <stdint.h>
23 #include <errno.h>
24 #include <tizen-audio.h>
25 #include <hal/hal-common-interface.h>
26
27 static int audio_alc5658_init(void **data)
28 {
29     hal_backend_audio_funcs *funcs;
30
31     funcs = calloc(1, sizeof(hal_backend_audio_funcs));
32     if (!funcs)
33         return -ENOMEM;
34
35     funcs->init = audio_init;
36     funcs->deinit = audio_deinit;
37
38     funcs->get_volume_level_max = audio_get_volume_level_max;
39     funcs->get_volume_level = audio_get_volume_level;
40     funcs->set_volume_level = audio_set_volume_level;
41     funcs->get_volume_value = audio_get_volume_value;
42     funcs->get_volume_mute = audio_get_volume_mute;
43     funcs->set_volume_mute = audio_set_volume_mute;
44     funcs->set_volume_ratio = audio_set_volume_ratio;
45     funcs->notify_ducking_activation_changed = audio_notify_ducking_activation_changed;
46
47     funcs->update_route = audio_update_route;
48     funcs->update_route_option = audio_update_route_option;
49
50     funcs->notify_stream_connection_changed = audio_notify_stream_connection_changed;
51
52     funcs->pcm_open = audio_pcm_open;
53     funcs->pcm_start = audio_pcm_start;
54     funcs->pcm_stop = audio_pcm_stop;
55     funcs->pcm_close = audio_pcm_close;
56     funcs->pcm_avail = audio_pcm_avail;
57     funcs->pcm_write = audio_pcm_write;
58     funcs->pcm_read = audio_pcm_read;
59     funcs->pcm_get_fd = audio_pcm_get_fd;
60     funcs->pcm_recover = audio_pcm_recover;
61     funcs->pcm_get_params = audio_pcm_get_params;
62     funcs->pcm_set_params = audio_pcm_set_params;
63
64     funcs->add_message_cb = audio_add_message_cb;
65     funcs->remove_message_cb = audio_remove_message_cb;
66
67     *data = (void *)funcs;
68
69     return 0;
70 }
71
72 static int audio_alc5658_exit(void *data)
73 {
74     if (!data)
75         return -EINVAL;
76
77     free(data);
78
79     return 0;
80 }
81
82 hal_backend hal_backend_audio_data = {
83     .name = "audio-alc5658",
84     .vendor = "Realtek",
85     .abi_version = HAL_ABI_VERSION_TIZEN_6_5,
86     .init = audio_alc5658_init,
87     .exit = audio_alc5658_exit,
88 };