ASoC: msm: Add support to fix up the channels for HDMI
For the use case of Playback over HDMI device, the number of
channels supported varies with the sink capabilities.
Add support to fix the channels based on the sink capabilites
configured by userspace for msm8960
Change-Id: Iba4f1fead17832d7832fabdcba02da671e5fd005
Signed-off-by: Subhash Chandra Bose Naripeddy <snariped@codeaurora.org>
diff --git a/sound/soc/msm/msm8930.c b/sound/soc/msm/msm8930.c
index a0295ea..18b8716 100644
--- a/sound/soc/msm/msm8930.c
+++ b/sound/soc/msm/msm8930.c
@@ -59,6 +59,7 @@
static int msm8930_btsco_rate = BTSCO_RATE_8KHZ;
static int msm8930_btsco_ch = 1;
static int hdmi_rate_variable;
+static int msm_hdmi_rx_ch = 2;
static struct clk *codec_clk;
static int clk_users;
@@ -394,7 +395,8 @@
static const char *spk_function[] = {"Off", "On"};
static const char *slim0_rx_ch_text[] = {"One", "Two"};
static const char *slim0_tx_ch_text[] = {"One", "Two", "Three", "Four"};
-
+static char const *hdmi_rx_ch_text[] = {"Two", "Three", "Four", "Five",
+ "Six", "Seven", "Eight"};
static const char * const hdmi_rate[] = {"Default", "Variable"};
static const struct soc_enum msm8930_enum[] = {
@@ -402,6 +404,7 @@
SOC_ENUM_SINGLE_EXT(2, slim0_rx_ch_text),
SOC_ENUM_SINGLE_EXT(4, slim0_tx_ch_text),
SOC_ENUM_SINGLE_EXT(2, hdmi_rate),
+ SOC_ENUM_SINGLE_EXT(7, hdmi_rx_ch_text),
};
static const char *btsco_rate_text[] = {"8000", "16000"};
@@ -508,6 +511,25 @@
return ret;
}
+static int msm_hdmi_rx_ch_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ pr_debug("%s: msm_hdmi_rx_ch = %d\n", __func__,
+ msm_hdmi_rx_ch);
+ ucontrol->value.integer.value[0] = msm_hdmi_rx_ch - 2;
+ return 0;
+}
+
+static int msm_hdmi_rx_ch_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ msm_hdmi_rx_ch = ucontrol->value.integer.value[0] + 2;
+
+ pr_debug("%s: msm_hdmi_rx_ch = %d\n", __func__,
+ msm_hdmi_rx_ch);
+ return 1;
+}
+
static int msm8930_hdmi_rate_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
@@ -537,6 +559,8 @@
SOC_ENUM_EXT("HDMI RX Rate", msm8930_enum[3],
msm8930_hdmi_rate_get,
msm8930_hdmi_rate_put),
+ SOC_ENUM_EXT("HDMI_RX Channels", msm8930_enum[4],
+ msm_hdmi_rx_ch_get, msm_hdmi_rx_ch_put),
};
static void *def_sitar_mbhc_cal(void)
@@ -778,7 +802,9 @@
if (!hdmi_rate_variable)
rate->min = rate->max = 48000;
- channels->min = channels->max = 2;
+ channels->min = channels->max = msm_hdmi_rx_ch;
+ if (channels->max < 2)
+ channels->min = channels->max = 2;
return 0;
}