summaryrefslogtreecommitdiff
path: root/hal-backend-audio.c
blob: 351d5bb199971132f6b4b52acb685263933c142f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
 * audio-hal
 *
 * Copyright (c) 2021 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <errno.h>
#include <tizen-audio.h>
#include <hal/hal-common-interface.h>

static int audio_sc7727_init(void **data)
{
    hal_backend_audio_funcs *funcs;

    funcs = calloc(1, sizeof(hal_backend_audio_funcs));
    if (!funcs)
        return -ENOMEM;

    funcs->init = audio_init;
    funcs->deinit = audio_deinit;

    funcs->get_volume_level_max = audio_get_volume_level_max;
    funcs->get_volume_level = audio_get_volume_level;
    funcs->set_volume_level = audio_set_volume_level;
    funcs->get_volume_value = audio_get_volume_value;
    funcs->get_volume_mute = audio_get_volume_mute;
    funcs->set_volume_mute = audio_set_volume_mute;
    funcs->set_volume_ratio = audio_set_volume_ratio;
    funcs->notify_ducking_activation_changed = audio_notify_ducking_activation_changed;

    funcs->update_route = audio_update_route;
    funcs->update_route_option = audio_update_route_option;

    funcs->notify_stream_connection_changed = audio_notify_stream_connection_changed;

    funcs->pcm_open = audio_pcm_open;
    funcs->pcm_start = audio_pcm_start;
    funcs->pcm_stop = audio_pcm_stop;
    funcs->pcm_close = audio_pcm_close;
    funcs->pcm_avail = audio_pcm_avail;
    funcs->pcm_write = audio_pcm_write;
    funcs->pcm_read = audio_pcm_read;
    funcs->pcm_get_fd = audio_pcm_get_fd;
    funcs->pcm_recover = audio_pcm_recover;
    funcs->pcm_get_params = audio_pcm_get_params;
    funcs->pcm_set_params = audio_pcm_set_params;

    funcs->add_message_cb = audio_add_message_cb;
    funcs->remove_message_cb = audio_remove_message_cb;

    *data = (void *)funcs;

    return 0;
}

static int audio_sc7727_exit(void *data)
{
    if (!data)
        return -EINVAL;

    free(data);

    return 0;
}

hal_backend hal_backend_audio_data = {
    .name = "audio-sc7727",
    .vendor = "sprd",
    .abi_version = HAL_ABI_VERSION_TIZEN_6_5,
    .init = audio_sc7727_init,
    .exit = audio_sc7727_exit,
};