ASoC: omap-mcbsp: Use macro to create the McBSP2/3 ST controls
authorPeter Ujfalusi <peter.ujfalusi@ti.com>
Wed, 22 Aug 2012 10:11:42 +0000 (13:11 +0300)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sat, 25 Aug 2012 20:30:23 +0000 (13:30 -0700)
To remove duplicated code from the driver.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/omap/omap-mcbsp.c

index c1f466e1b8b6516359beeef96343bf5d018fe1bf..1b9f5ebba44fd7eccbc2a292f767c2b302864341 100644 (file)
@@ -688,31 +688,22 @@ static int omap_mcbsp_st_get_mode(struct snd_kcontrol *kcontrol,
        return 0;
 }
 
-static const struct snd_kcontrol_new omap_mcbsp2_st_controls[] = {
-       SOC_SINGLE_EXT("McBSP2 Sidetone Switch", 1, 0, 1, 0,
-                       omap_mcbsp_st_get_mode, omap_mcbsp_st_put_mode),
-       OMAP_MCBSP_SOC_SINGLE_S16_EXT("McBSP2 Sidetone Channel 0 Volume",
-                                     -32768, 32767,
-                                     omap_mcbsp_get_st_ch0_volume,
-                                     omap_mcbsp_set_st_ch0_volume),
-       OMAP_MCBSP_SOC_SINGLE_S16_EXT("McBSP2 Sidetone Channel 1 Volume",
-                                     -32768, 32767,
-                                     omap_mcbsp_get_st_ch1_volume,
-                                     omap_mcbsp_set_st_ch1_volume),
-};
+#define OMAP_MCBSP_ST_CONTROLS(port)                                     \
+static const struct snd_kcontrol_new omap_mcbsp##port##_st_controls[] = { \
+SOC_SINGLE_EXT("McBSP" #port " Sidetone Switch", 1, 0, 1, 0,             \
+              omap_mcbsp_st_get_mode, omap_mcbsp_st_put_mode),           \
+OMAP_MCBSP_SOC_SINGLE_S16_EXT("McBSP" #port " Sidetone Channel 0 Volume", \
+                             -32768, 32767,                              \
+                             omap_mcbsp_get_st_ch0_volume,               \
+                             omap_mcbsp_set_st_ch0_volume),              \
+OMAP_MCBSP_SOC_SINGLE_S16_EXT("McBSP" #port " Sidetone Channel 1 Volume", \
+                             -32768, 32767,                              \
+                             omap_mcbsp_get_st_ch1_volume,               \
+                             omap_mcbsp_set_st_ch1_volume),              \
+}
 
-static const struct snd_kcontrol_new omap_mcbsp3_st_controls[] = {
-       SOC_SINGLE_EXT("McBSP3 Sidetone Switch", 2, 0, 1, 0,
-                       omap_mcbsp_st_get_mode, omap_mcbsp_st_put_mode),
-       OMAP_MCBSP_SOC_SINGLE_S16_EXT("McBSP3 Sidetone Channel 0 Volume",
-                                     -32768, 32767,
-                                     omap_mcbsp_get_st_ch0_volume,
-                                     omap_mcbsp_set_st_ch0_volume),
-       OMAP_MCBSP_SOC_SINGLE_S16_EXT("McBSP3 Sidetone Channel 1 Volume",
-                                     -32768, 32767,
-                                     omap_mcbsp_get_st_ch1_volume,
-                                     omap_mcbsp_set_st_ch1_volume),
-};
+OMAP_MCBSP_ST_CONTROLS(2);
+OMAP_MCBSP_ST_CONTROLS(3);
 
 int omap_mcbsp_st_add_controls(struct snd_soc_pcm_runtime *rtd)
 {