Skip to content

Commit cfd1c94

Browse files
povikmarcan
authored andcommitted
ASoC: macaudio: Add initial j313 fixup_controls
Signed-off-by: Martin Povišer <[email protected]>
1 parent 55c4c74 commit cfd1c94

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

sound/soc/apple/macaudio.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,36 @@ static int macaudio_j274_fixup_controls(struct snd_soc_card *card)
745745
return 0;
746746
}
747747

748+
static int macaudio_j313_fixup_controls(struct snd_soc_card *card) {
749+
struct macaudio_snd_data *ma = snd_soc_card_get_drvdata(card);
750+
751+
if (ma->has_speakers) {
752+
if (!please_blow_up_my_speakers) {
753+
dev_err(card->dev, "driver can't assure safety on this model, refusing probe\n");
754+
return -EINVAL;
755+
}
756+
757+
CHECK(snd_soc_set_enum_kctl, "* ASI1 Sel", "Left");
758+
CHECK(snd_soc_deactivate_kctl, "* ASI1 Sel", 0);
759+
760+
/* !!! This is copied from j274, not obtained by looking at
761+
* what macOS sets.
762+
*/
763+
CHECK(snd_soc_limit_volume, "* Amp Gain Volume", 14);
764+
765+
/*
766+
* Since we don't set the right slots yet to avoid
767+
* driver conflict on the I2S bus sending ISENSE/VSENSE
768+
* samples from the codecs back to us, disable the
769+
* controls.
770+
*/
771+
CHECK(snd_soc_deactivate_kctl, "* VSENSE Switch", 0);
772+
CHECK(snd_soc_deactivate_kctl, "* ISENSE Switch", 0);
773+
}
774+
775+
return 0;
776+
}
777+
748778
static int macaudio_j314_fixup_controls(struct snd_soc_card *card)
749779
{
750780
struct macaudio_snd_data *ma = snd_soc_card_get_drvdata(card);
@@ -887,6 +917,7 @@ static const struct snd_soc_dapm_route macaudio_dapm_routes[] = {
887917

888918
static const struct of_device_id macaudio_snd_device_id[] = {
889919
{ .compatible = "apple,j274-macaudio", .data = macaudio_j274_fixup_controls },
920+
{ .compatible = "apple,j313-macaudio", .data = macaudio_j313_fixup_controls },
890921
{ .compatible = "apple,j314-macaudio", .data = macaudio_j314_fixup_controls },
891922
{ .compatible = "apple,j375-macaudio", .data = macaudio_j375_fixup_controls },
892923
{ .compatible = "apple,j413-macaudio", .data = macaudio_j314_fixup_controls },

0 commit comments

Comments
 (0)