kernel: make controls access read only
Rahool Paliwal [Thu, 24 Jul 2014 15:54:30 +0000 (20:54 +0530)]
This makes controls HDA Decode Capability, HDA Maximum PCM Channels
for HDA and AVP DMA channel id for Tegra Soc read only.

Bug 200023797

Change-Id: I3271470354b02f3d1b3aab8fa3963ad19d281f41
Signed-off-by: Rahool Paliwal <rpaliwal@nvidia.com>
Reviewed-on: http://git-master/r/441855
(cherry picked from commit a9cf57c92ca7044a9854f707220bf0cefc704d54)
Reviewed-on: http://git-master/r/453899
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>

sound/pci/hda/hda_codec.c
sound/soc/tegra/tegra_asoc_utils.c

index 8f212c6..7286a59 100644 (file)
@@ -3337,12 +3337,14 @@ static struct snd_kcontrol_new dig_mixes[] = {
                .put = snd_hda_spdif_out_switch_put,
        },
        {
+               .access = SNDRV_CTL_ELEM_ACCESS_READ,
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
                .name = "HDA Decode Capability",
                .info = snd_hda_hdmi_decode_info,
                .get = snd_hda_hdmi_decode_get,
        },
        {
+               .access = SNDRV_CTL_ELEM_ACCESS_READ,
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
                .name = "HDA Maximum PCM Channels",
                .info = snd_hda_max_pcm_ch_info,
index a517d25..2bc180e 100644 (file)
@@ -332,8 +332,15 @@ static int tegra_set_i2sloopback(struct snd_kcontrol *kcontrol,
 struct snd_kcontrol_new tegra_avp_controls[] = {
        SOC_SINGLE_EXT("AVP alsa device select", 0, 0, TEGRA_ALSA_MAX_DEVICES, \
                        0, tegra_get_avp_device, tegra_set_avp_device),
-       SOC_SINGLE_EXT("AVP DMA channel id", 0, 0, TEGRA_DMA_MAX_CHANNELS, \
-                       0, tegra_get_dma_ch_id, NULL),
+       {
+               .name = "AVP DMA channel id", \
+               .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
+               .info = snd_soc_info_volsw, \
+               .access = SNDRV_CTL_ELEM_ACCESS_READ, \
+               .get = tegra_get_dma_ch_id, \
+               .private_value = SOC_SINGLE_VALUE(0, 0, \
+                       TEGRA_DMA_MAX_CHANNELS, 0)
+       },
        SOC_SINGLE_EXT("AVP DMA address", 0, 0, 0xFFFFFFFF, \
                        0, tegra_get_dma_addr, tegra_set_dma_addr),
 };