summaryrefslogtreecommitdiffstats
path: root/firmware/drivers/audio/rocker_codec.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/audio/rocker_codec.c')
-rw-r--r--firmware/drivers/audio/rocker_codec.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/firmware/drivers/audio/rocker_codec.c b/firmware/drivers/audio/rocker_codec.c
index 23541a4ddb..5404ff9561 100644
--- a/firmware/drivers/audio/rocker_codec.c
+++ b/firmware/drivers/audio/rocker_codec.c
@@ -29,6 +29,9 @@
static int fd_hw;
+static long int vol_l_hw = 255;
+static long int vol_r_hw = 255;
+
static void hw_open(void)
{
fd_hw = open("/dev/snd/controlC0", O_RDWR);
@@ -41,19 +44,32 @@ static void hw_close(void)
close(fd_hw);
}
-void audiohw_preinit(void)
+void audiohw_mute(int mute)
{
- long int hp = 2;
+ if(mute)
+ {
+ long int ps0 = 0;
+ alsa_controls_set_ints("Output Port Switch", 1, &ps0);
+ }
+ else
+ {
+ long int ps2 = 2;
+ alsa_controls_set_ints("Output Port Switch", 1, &ps2);
+ }
+}
+void audiohw_preinit(void)
+{
alsa_controls_init();
hw_open();
-
- /* Output port switch set to Headphones */
- alsa_controls_set_ints("Output Port Switch", 1, &hp);
}
void audiohw_postinit(void)
{
+ long int hp = 2;
+
+ /* Output port switch set to Headphones */
+ alsa_controls_set_ints("Output Port Switch", 1, &hp);
}
void audiohw_close(void)
@@ -69,8 +85,8 @@ void audiohw_set_frequency(int fsel)
void audiohw_set_volume(int vol_l, int vol_r)
{
- long int vol_l_hw = -vol_l/5;
- long int vol_r_hw = -vol_r/5;
+ vol_l_hw = -vol_l/5;
+ vol_r_hw = -vol_r/5;
alsa_controls_set_ints("Left Playback Volume", 1, &vol_l_hw);
alsa_controls_set_ints("Right Playback Volume", 1, &vol_r_hw);