* changed pararmeter of audiohw_mute from int to bool
* unification of init and close
NOTE: audiohw_init is a void function now, because it never (can) fail
okay from JdGordon@irc
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13622 a1c6a512-1295-4272-9138-f99709370657
diff --git a/firmware/drivers/audio/as3514.c b/firmware/drivers/audio/as3514.c
index a0a84e5..4e69462 100644
--- a/firmware/drivers/audio/as3514.c
+++ b/firmware/drivers/audio/as3514.c
@@ -130,7 +130,7 @@
/*
* Initialise the PP I2C and I2S.
*/
-int audiohw_init(void)
+void audiohw_init(void)
{
unsigned int i;
@@ -188,8 +188,6 @@
{
as3514.regs[i] = i2c_readbyte(AS3514_I2C_ADDR, i);
}
-
- return 0;
}
void audiohw_postinit(void)
@@ -267,7 +265,7 @@
return 0;
}
-void audiohw_mute(int mute)
+void audiohw_mute(bool mute)
{
if (mute) {
as3514_write_or(HPH_OUT_L, (1 << 7));
diff --git a/firmware/drivers/audio/tlv320.c b/firmware/drivers/audio/tlv320.c
index 2e43baa..7da2650 100644
--- a/firmware/drivers/audio/tlv320.c
+++ b/firmware/drivers/audio/tlv320.c
@@ -218,11 +218,7 @@
}
}
-/**
- * Mute (mute=1) or enable sound (mute=0)
- *
- */
-void audiohw_mute(int mute)
+void audiohw_mute(bool mute)
{
unsigned value_dap = tlv320_regs[REG_DAP];
unsigned value_l, value_r;
diff --git a/firmware/drivers/audio/uda1380.c b/firmware/drivers/audio/uda1380.c
index ab0ff81..1b3d5a0 100644
--- a/firmware/drivers/audio/uda1380.c
+++ b/firmware/drivers/audio/uda1380.c
@@ -159,11 +159,7 @@
| TREBLEL(value) | TREBLER(value));
}
-/**
- * Mute (mute=1) or enable sound (mute=0)
- *
- */
-void audiohw_mute(int mute)
+void audiohw_mute(bool mute)
{
unsigned int value = uda1380_regs[REG_MUTE];
@@ -260,17 +256,18 @@
}
/* Initialize UDA1380 codec with default register values (uda1380_defaults) */
-int audiohw_init(void)
+void audiohw_init(void)
{
recgain_mic = 0;
recgain_line = 0;
audiohw_reset();
-
- if (audiohw_set_regs() == -1)
- return -1;
- return 0;
+ if (audiohw_set_regs() == -1)
+ {
+ /* this shoud never (!) happen. */
+ logf("uda1380: audiohw_init failed")
+ }
}
void audiohw_postinit(void)
diff --git a/firmware/drivers/audio/wm8731l.c b/firmware/drivers/audio/wm8731l.c
index c87c7d0..94efc53 100644
--- a/firmware/drivers/audio/wm8731l.c
+++ b/firmware/drivers/audio/wm8731l.c
@@ -82,7 +82,7 @@
return -db * 2 / 5;
}
-void audiohw_mute(int mute)
+void audiohw_mute(bool mute)
{
if (mute)
{
diff --git a/firmware/drivers/audio/wm8751.c b/firmware/drivers/audio/wm8751.c
index 346b423..056b5d6 100644
--- a/firmware/drivers/audio/wm8751.c
+++ b/firmware/drivers/audio/wm8751.c
@@ -168,7 +168,7 @@
TREBCTRL_TREB(tone_tenthdb2hw(value)));
}
-void audiohw_mute(int mute)
+void audiohw_mute(bool mute)
{
/* Mute: Set DACMU = 1 to soft-mute the audio DACs. */
/* Unmute: Set DACMU = 0 to soft-un-mute the audio DACs. */
diff --git a/firmware/drivers/audio/wm8758.c b/firmware/drivers/audio/wm8758.c
index bf3ec4c..0c16118 100644
--- a/firmware/drivers/audio/wm8758.c
+++ b/firmware/drivers/audio/wm8758.c
@@ -151,7 +151,7 @@
(void)value;
}
-void audiohw_mute(int mute)
+void audiohw_mute(bool mute)
{
if (mute)
{
diff --git a/firmware/drivers/audio/wm8975.c b/firmware/drivers/audio/wm8975.c
index 5f90ff0..d1d4633 100644
--- a/firmware/drivers/audio/wm8975.c
+++ b/firmware/drivers/audio/wm8975.c
@@ -190,7 +190,7 @@
}
}
-void audiohw_mute(int mute)
+void audiohw_mute(bool mute)
{
if (mute)
{
diff --git a/firmware/export/as3514.h b/firmware/export/as3514.h
index 98656c7..c01790f 100644
--- a/firmware/export/as3514.h
+++ b/firmware/export/as3514.h
@@ -25,11 +25,9 @@
extern int tenthdb2master(int db);
extern void audiohw_reset(void);
-extern int audiohw_init(void);
extern void audiohw_enable_output(bool enable);
extern int audiohw_set_master_vol(int vol_l, int vol_r);
extern int audiohw_set_lineout_vol(int vol_l, int vol_r);
-extern void audiohw_close(void);
extern void audiohw_set_sample_rate(int sampling_control);
extern void audiohw_enable_recording(bool source_mic);
diff --git a/firmware/export/audiohw.h b/firmware/export/audiohw.h
index b266868..df155e2 100644
--- a/firmware/export/audiohw.h
+++ b/firmware/export/audiohw.h
@@ -21,6 +21,7 @@
#define _AUDIOHW_H_
#include "config.h"
+#include <stdbool.h>
#ifdef HAVE_UDA1380
#include "uda1380.h"
@@ -94,6 +95,20 @@
* .h file suitable defines are added.
*/
-void audiohw_mute(int mute);
+/**
+ * Initialize audio codec to a well defined state.
+ */
+void audiohw_init(void);
+
+/**
+ * Close audio codec.
+ */
+void audiohw_close(void);
+
+/**
+ * Mute or enable sound.
+ * @param mute true or false
+ */
+void audiohw_mute(bool mute);
#endif /* _AUDIOHW_H_ */
diff --git a/firmware/export/tlv320.h b/firmware/export/tlv320.h
index 15ac794..af9b362 100644
--- a/firmware/export/tlv320.h
+++ b/firmware/export/tlv320.h
@@ -27,7 +27,6 @@
/*** definitions ***/
-extern void audiohw_init(void);
extern void audiohw_reset(void);
/**
* Sets internal sample rate for DAC and ADC relative to MCLK
@@ -42,7 +41,6 @@
extern void audiohw_enable_output(bool enable);
extern void audiohw_set_headphone_vol(int vol_l, int vol_r);
extern void audiohw_set_recvol(int left, int right, int type);
-extern void audiohw_close(void);
extern void audiohw_enable_recording(bool source_mic);
extern void audiohw_disable_recording(void);
extern void audiohw_set_monitor(bool enable);
diff --git a/firmware/export/uda1380.h b/firmware/export/uda1380.h
index fd1b838..b4b83d1 100644
--- a/firmware/export/uda1380.h
+++ b/firmware/export/uda1380.h
@@ -28,13 +28,12 @@
extern int tenthdb2mixer(int db);
extern void audiohw_reset(void);
-extern int audiohw_init(void);
extern void audiohw_enable_output(bool enable);
extern int audiohw_set_master_vol(int vol_l, int vol_r);
extern int audiohw_set_mixer_vol(int channel1, int channel2);
extern void audiohw_set_bass(int value);
extern void audiohw_set_treble(int value);
-extern void audiohw_close(void);
+
/**
* Sets frequency settings for DAC and ADC relative to MCLK
*
diff --git a/firmware/export/wm8731l.h b/firmware/export/wm8731l.h
index 74e41a7..f0f63c9 100644
--- a/firmware/export/wm8731l.h
+++ b/firmware/export/wm8731l.h
@@ -28,13 +28,11 @@
extern int tenthdb2mixer(int db);
extern void audiohw_reset(void);
-extern int audiohw_init(void);
extern void audiohw_enable_output(bool enable);
extern int audiohw_set_master_vol(int vol_l, int vol_r);
extern int audiohw_set_mixer_vol(int channel1, int channel2);
extern void audiohw_set_bass(int value);
extern void audiohw_set_treble(int value);
-extern void audiohw_close(void);
extern void audiohw_set_nsorder(int order);
extern void audiohw_set_sample_rate(int sampling_control);
diff --git a/firmware/export/wm8751.h b/firmware/export/wm8751.h
index 89d2c6b..7820274 100644
--- a/firmware/export/wm8751.h
+++ b/firmware/export/wm8751.h
@@ -27,7 +27,6 @@
extern int tenthdb2mixer(int db);
extern void audiohw_reset(void);
-extern int audiohw_init(void);
extern void audiohw_preinit(void);
extern void audiohw_enable_output(bool enable);
extern int audiohw_set_master_vol(int vol_l, int vol_r);
@@ -35,7 +34,6 @@
extern int audiohw_set_mixer_vol(int channel1, int channel2);
extern void audiohw_set_bass(int value);
extern void audiohw_set_treble(int value);
-extern void audiohw_close(void);
extern void audiohw_set_frequency(int fsel);
/* Register addresses and bits */
diff --git a/firmware/export/wm8758.h b/firmware/export/wm8758.h
index e86af87..8a3c619 100644
--- a/firmware/export/wm8758.h
+++ b/firmware/export/wm8758.h
@@ -28,14 +28,12 @@
extern int tenthdb2mixer(int db);
extern void audiohw_reset(void);
-extern int audiohw_init(void);
extern void audiohw_enable_output(bool enable);
extern int audiohw_set_master_vol(int vol_l, int vol_r);
extern int audiohw_set_lineout_vol(int vol_l, int vol_r);
extern int audiohw_set_mixer_vol(int channel1, int channel2);
extern void audiohw_set_bass(int value);
extern void audiohw_set_treble(int value);
-extern void audiohw_close(void);
extern void audiohw_set_nsorder(int order);
extern void audiohw_set_sample_rate(int sampling_control);
diff --git a/firmware/export/wm8975.h b/firmware/export/wm8975.h
index 609e05c..e97497e 100644
--- a/firmware/export/wm8975.h
+++ b/firmware/export/wm8975.h
@@ -28,14 +28,12 @@
extern int tenthdb2mixer(int db);
extern void audiohw_reset(void);
-extern int audiohw_init(void);
extern void audiohw_enable_output(bool enable);
extern int audiohw_set_master_vol(int vol_l, int vol_r);
extern int audiohw_set_lineout_vol(int vol_l, int vol_r);
extern int audiohw_set_mixer_vol(int channel1, int channel2);
extern void audiohw_set_bass(int value);
extern void audiohw_set_treble(int value);
-extern void audiohw_close(void);
extern void audiohw_set_nsorder(int order);
extern void audiohw_set_sample_rate(int sampling_control);