diff options
Diffstat (limited to 'audio_hw.c')
-rw-r--r-- | audio_hw.c | 34 |
1 files changed, 33 insertions, 1 deletions
@@ -27,6 +27,10 @@ #include <cutils/log.h> +#ifdef YAMAHA_MC1N2_AUDIO +#include <yamaha-mc1n2-audio.h> +#endif + #include "audio_hw.h" #include "mixer.h" @@ -214,11 +218,18 @@ int audio_hw_close(hw_device_t *device) if(device != NULL) { tinyalsa_audio_device = (struct tinyalsa_audio_device *) device; - if(tinyalsa_audio_device != NULL && tinyalsa_audio_device->mixer != NULL) { + if(tinyalsa_audio_device->mixer != NULL) { tinyalsa_mixer_close(tinyalsa_audio_device->mixer); tinyalsa_audio_device->mixer = NULL; } +#ifdef YAMAHA_MC1N2_AUDIO + if(tinyalsa_audio_device->mc1n2_pdata != NULL) { + yamaha_mc1n2_audio_stop(tinyalsa_audio_device->mc1n2_pdata); + tinyalsa_audio_device->mc1n2_pdata = NULL; + } +#endif + free(device); } @@ -268,6 +279,20 @@ int audio_hw_open(const hw_module_t *module, const char *name, dev->dump = audio_hw_dump; +#ifdef YAMAHA_MC1N2_AUDIO + rc = yamaha_mc1n2_audio_start(&tinyalsa_audio_device->mc1n2_pdata, + YAMAHA_MC1N2_AUDIO_DEVICE); + if(rc < 0) { + LOGE("Failed to open Yamaha-MC1N2-Audio"); + goto error_device; + } + + rc = yamaha_mc1n2_audio_routine_init(tinyalsa_audio_device->mc1n2_pdata); + if(rc < 0) { + LOGE("Failed to init Yamaha-MC1N2-Audio"); + } +#endif + rc = tinyalsa_mixer_open(&tinyalsa_mixer, TINYALSA_MIXER_CONFIG_FILE); if(rc < 0 || tinyalsa_mixer == NULL) { LOGE("Failed to open mixer!"); @@ -279,6 +304,13 @@ int audio_hw_open(const hw_module_t *module, const char *name, LOGE("Failed to set default mixer route"); } +#ifdef YAMAHA_MC1N2_AUDIO + rc = yamaha_mc1n2_audio_routine_route_init(tinyalsa_audio_device->mc1n2_pdata); + if(rc < 0) { + LOGE("Failed to init Yamaha-MC1N2-Audio route"); + } +#endif + tinyalsa_audio_device->mixer = tinyalsa_mixer; *device = &(dev->common); |