Home | History | Annotate | Download | only in audio_extn
      1 /*
      2  * Copyright (C) 2014 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #ifndef AUDIO_EXTN_H
     18 #define AUDIO_EXTN_H
     19 
     20 #include <cutils/str_parms.h>
     21 
     22 void *audio_extn_extspk_init(struct audio_device *adev);
     23 void audio_extn_extspk_deinit(void *extn);
     24 void audio_extn_extspk_update(void* extn);
     25 void audio_extn_extspk_set_mode(void* extn, audio_mode_t mode);
     26 void audio_extn_extspk_set_voice_vol(void* extn, float vol);
     27 
     28 #ifndef SPKR_PROT_ENABLED
     29 #define audio_extn_spkr_prot_init(adev)       (0)
     30 #define audio_extn_spkr_prot_start_processing(snd_device)    (-EINVAL)
     31 #define audio_extn_spkr_prot_calib_cancel(adev) (0)
     32 #define audio_extn_spkr_prot_stop_processing(snd_device)     (0)
     33 #define audio_extn_spkr_prot_is_enabled() (false)
     34 #define audio_extn_spkr_prot_get_acdb_id(snd_device)         (-EINVAL)
     35 #define audio_extn_get_spkr_prot_snd_device(snd_device) (snd_device)
     36 #else
     37 void audio_extn_spkr_prot_init(void *adev);
     38 int audio_extn_spkr_prot_start_processing(snd_device_t snd_device);
     39 void audio_extn_spkr_prot_stop_processing(snd_device_t snd_device);
     40 bool audio_extn_spkr_prot_is_enabled();
     41 int audio_extn_spkr_prot_get_acdb_id(snd_device_t snd_device);
     42 int audio_extn_get_spkr_prot_snd_device(snd_device_t snd_device);
     43 void audio_extn_spkr_prot_calib_cancel(void *adev);
     44 #endif
     45 
     46 #ifndef HFP_ENABLED
     47 #define audio_extn_hfp_is_active(adev)                  (0)
     48 #define audio_extn_hfp_get_usecase()                    (-1)
     49 #define audio_extn_hfp_set_parameters(adev, params)     (0)
     50 #else
     51 bool audio_extn_hfp_is_active(struct audio_device *adev);
     52 
     53 audio_usecase_t audio_extn_hfp_get_usecase();
     54 
     55 void audio_extn_hfp_set_parameters(struct audio_device *adev,
     56                                     struct str_parms *parms);
     57 #endif
     58 
     59 #ifndef SOUND_TRIGGER_ENABLED
     60 #define audio_extn_sound_trigger_init(adev)                            (0)
     61 #define audio_extn_sound_trigger_deinit(adev)                          (0)
     62 #define audio_extn_sound_trigger_update_device_status(snd_dev, event)  (0)
     63 #define audio_extn_sound_trigger_set_parameters(adev, parms)           (0)
     64 #define audio_extn_sound_trigger_check_and_get_session(in)             (0)
     65 #define audio_extn_sound_trigger_stop_lab(in)                          (0)
     66 #define audio_extn_sound_trigger_read(in, buffer, bytes)               (0)
     67 
     68 #else
     69 
     70 enum st_event_type {
     71     ST_EVENT_SND_DEVICE_FREE,
     72     ST_EVENT_SND_DEVICE_BUSY,
     73     ST_EVENT_STREAM_FREE,
     74     ST_EVENT_STREAM_BUSY
     75 };
     76 typedef enum st_event_type st_event_type_t;
     77 
     78 int audio_extn_sound_trigger_init(struct audio_device *adev);
     79 void audio_extn_sound_trigger_deinit(struct audio_device *adev);
     80 void audio_extn_sound_trigger_update_device_status(snd_device_t snd_device,
     81                                      st_event_type_t event);
     82 void audio_extn_sound_trigger_set_parameters(struct audio_device *adev,
     83                                              struct str_parms *parms);
     84 void audio_extn_sound_trigger_check_and_get_session(struct stream_in *in);
     85 void audio_extn_sound_trigger_stop_lab(struct stream_in *in);
     86 int audio_extn_sound_trigger_read(struct stream_in *in, void *buffer,
     87                                   size_t bytes);
     88 #endif
     89 
     90 #ifndef DSM_FEEDBACK_ENABLED
     91 #define audio_extn_dsm_feedback_enable(adev, snd_device, benable)                (0)
     92 #else
     93 void audio_extn_dsm_feedback_enable(struct audio_device *adev,
     94                          snd_device_t snd_device,
     95                          bool benable);
     96 #endif
     97 
     98 #ifndef HWDEP_CAL_ENABLED
     99 #define  audio_extn_hwdep_cal_send(snd_card, acdb_handle) (0)
    100 #else
    101 void audio_extn_hwdep_cal_send(int snd_card, void *acdb_handle);
    102 #endif
    103 
    104 #endif /* AUDIO_EXTN_H */
    105