@@ -728,7 +728,7 @@ static int msm_pcm_volume_ctl_get(struct snd_kcontrol *kcontrol,
728
728
return - ENODEV ;
729
729
}
730
730
731
- substream = vol -> pcm -> streams [SNDRV_PCM_STREAM_PLAYBACK ].substream ;
731
+ substream = vol -> pcm -> streams [vol -> stream ].substream ;
732
732
733
733
if (!substream ) {
734
734
pr_err ("%s substream not found\n" , __func__ );
@@ -777,7 +777,7 @@ static int msm_pcm_volume_ctl_put(struct snd_kcontrol *kcontrol,
777
777
return - ENODEV ;
778
778
}
779
779
780
- substream = vol -> pcm -> streams [SNDRV_PCM_STREAM_PLAYBACK ].substream ;
780
+ substream = vol -> pcm -> streams [vol -> stream ].substream ;
781
781
pr_debug ("%s: volume : 0x%x\n" , __func__ , volume );
782
782
if (!substream ) {
783
783
pr_err ("%s substream not found\n" , __func__ );
@@ -806,17 +806,16 @@ static int msm_pcm_volume_ctl_put(struct snd_kcontrol *kcontrol,
806
806
return rc ;
807
807
}
808
808
809
- static int msm_pcm_add_volume_control (struct snd_soc_pcm_runtime * rtd )
809
+ static int msm_pcm_add_volume_control (struct snd_soc_pcm_runtime * rtd , int stream )
810
810
{
811
811
int ret = 0 ;
812
812
struct snd_pcm * pcm = rtd -> pcm ;
813
813
struct snd_pcm_volume * volume_info ;
814
814
struct snd_kcontrol * kctl ;
815
815
816
- dev_dbg (rtd -> dev , "%s, Volume control add\n" , __func__ );
817
- ret = snd_pcm_add_volume_ctls (pcm , SNDRV_PCM_STREAM_PLAYBACK ,
818
- NULL , 1 , rtd -> dai_link -> id ,
819
- & volume_info );
816
+ dev_dbg (rtd -> dev , "%s, volume control add\n" , __func__ );
817
+ ret = snd_pcm_add_volume_ctls (pcm , stream ,
818
+ NULL , 1 , rtd -> dai_link -> id , & volume_info );
820
819
if (ret < 0 ) {
821
820
pr_err ("%s volume control failed ret %d\n" , __func__ , ret );
822
821
return ret ;
@@ -1307,12 +1306,16 @@ static int msm_asoc_pcm_new(struct snd_soc_pcm_runtime *rtd)
1307
1306
pr_err ("%s: Could not add pcm Channel Map Control\n" ,
1308
1307
__func__ );
1309
1308
1310
- ret = msm_pcm_add_volume_control (rtd );
1309
+ ret = msm_pcm_add_volume_control (rtd , SNDRV_PCM_STREAM_PLAYBACK );
1311
1310
if (ret ) {
1312
- pr_err ("%s: Could not add pcm Volume Control %d\n" ,
1311
+ pr_err ("%s: Could not add pcm playback volume Control %d\n" ,
1312
+ __func__ , ret );
1313
+ }
1314
+ ret = msm_pcm_add_volume_control (rtd , SNDRV_PCM_STREAM_CAPTURE );
1315
+ if (ret ) {
1316
+ pr_err ("%s: Could not add pcm capture volume Control %d\n" ,
1313
1317
__func__ , ret );
1314
1318
}
1315
-
1316
1319
ret = msm_pcm_add_fe_topology_control (rtd );
1317
1320
if (ret ) {
1318
1321
pr_err ("%s: Could not add pcm topology control %d\n" ,
0 commit comments