Skip to content

Commit 59c5d99

Browse files
marcanjannau
authored andcommitted
macaudio: Add a getter for the interlock
alsamixer/etc really don't like write-only controls... Signed-off-by: Hector Martin <marcan@marcan.st>
1 parent 629da7b commit 59c5d99

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

sound/soc/apple/macaudio.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ static void macaudio_vlimit_update(struct macaudio_snd_data *ma)
276276

277277
macaudio_vlimit_unlock(ma, unlock);
278278
ma->speaker_volume_unlocked = unlock;
279+
snd_ctl_notify(ma->card.snd_card, SNDRV_CTL_EVENT_MASK_VALUE,
280+
&ma->speaker_lock_kctl->id);
279281
}
280282
}
281283

@@ -1381,7 +1383,17 @@ static int macaudio_slk_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v
13811383
return 0;
13821384
}
13831385

1384-
int macaudio_slk_lock(struct snd_kcontrol *kcontrol, struct snd_ctl_file *owner)
1386+
static int macaudio_slk_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *uvalue)
1387+
{
1388+
struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
1389+
struct macaudio_snd_data *ma = snd_soc_card_get_drvdata(card);
1390+
1391+
uvalue->value.integer.value[0] = ma->speaker_volume_unlocked ? 1 : 0;
1392+
1393+
return 0;
1394+
}
1395+
1396+
static int macaudio_slk_lock(struct snd_kcontrol *kcontrol, struct snd_ctl_file *owner)
13851397
{
13861398
struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
13871399
struct macaudio_snd_data *ma = snd_soc_card_get_drvdata(card);
@@ -1419,9 +1431,12 @@ static const struct snd_kcontrol_new macaudio_controls[] = {
14191431
SOC_DAPM_PIN_SWITCH("Headset Mic"),
14201432
{
14211433
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1422-
.access = SNDRV_CTL_ELEM_ACCESS_WRITE,
1434+
.access = SNDRV_CTL_ELEM_ACCESS_READ |
1435+
SNDRV_CTL_ELEM_ACCESS_WRITE |
1436+
SNDRV_CTL_ELEM_ACCESS_VOLATILE,
14231437
.name = "Speaker Volume Unlock",
1424-
.info = macaudio_slk_info, .put = macaudio_slk_put,
1438+
.info = macaudio_slk_info,
1439+
.put = macaudio_slk_put, .get = macaudio_slk_get,
14251440
.lock = macaudio_slk_lock, .unlock = macaudio_slk_unlock,
14261441
},
14271442
{

0 commit comments

Comments
 (0)