Skip to content

Commit

Permalink
Added another iMac model the 18,1 which has the subsystem id 0x106b0e00.
Browse files Browse the repository at this point in the history
  • Loading branch information
Src User committed May 18, 2022
1 parent 64448ab commit 18f0201
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 28 deletions.
18 changes: 9 additions & 9 deletions patch_cirrus/patch_cirrus_apple.h
Original file line number Diff line number Diff line change
Expand Up @@ -2543,8 +2543,8 @@ static int patch_cs8409_apple(struct hda_codec *codec)
// macbook pro 14,1?13,1, 14,2
fixup_found = 1;
}
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00) {
// imac 18,3, 19,1, 18,2
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00) {
// imac 18,3, 19,1, 18,2, 18,1
fixup_found = 1;
}

Expand All @@ -2570,7 +2570,7 @@ static int patch_cs8409_apple(struct hda_codec *codec)
spec->exec_verb = codec->core.exec_verb;
codec->core.exec_verb = cs8409_cs42l83_exec_verb;
/*
if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00)
if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00)
{
codec->core.exec_verb = cs8409_cs42l83_imac_exec_verb;
}
Expand Down Expand Up @@ -2617,7 +2617,7 @@ static int patch_cs8409_apple(struct hda_codec *codec)
else if (codec->core.subsystem_id == 0x106b3300 || codec->core.subsystem_id == 0x106b3600) {
spec->gpio_mask = 0x0f;
}
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00) {
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00) {
spec->gpio_mask = 0x0f;
}
else {
Expand Down Expand Up @@ -2680,7 +2680,7 @@ static int patch_cs8409_apple(struct hda_codec *codec)
// we also need to setup the linein nid (why is there no lineout??)
// (note that the internal mike is permanent - on the other hand we do need to turn it off if headset with mike
// is plugged in???)
if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00) {
if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00) {
cs8409_fix_caps(codec, CS8409_CS42L83_IMAC_LINEIN_PIN_NID);
} else {
cs8409_fix_caps(codec, CS8409_CS42L83_MACBOOK_LINEIN_PIN_NID);
Expand All @@ -2691,7 +2691,7 @@ static int patch_cs8409_apple(struct hda_codec *codec)
// myprintk("snd_hda_intel: print wcaps post 0x%02x 0x%08x\n", i, codec->wcaps[i]);


//if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00) {
//if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00) {
// snd_hda_apply_pincfgs(codec, imac_pincfgs);
//else
// snd_hda_apply_pincfgs(codec, macbook_pro_pincfgs);
Expand Down Expand Up @@ -2788,7 +2788,7 @@ static int patch_cs8409_apple(struct hda_codec *codec)

// setup the intmike and linein nids
// these are swapped between macbook pros and imacs
if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00)
if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00)
{
spec->intmike_nid = 0x45;
spec->intmike_adc_nid = 0x23;
Expand Down Expand Up @@ -2845,7 +2845,7 @@ static int patch_cs8409_apple(struct hda_codec *codec)
// OSX function setConnectionSelect
// macbook pro init 0x0013 -> 0x0033 ie 0x0020 bit set
// imac init 0x0013 -> 0x0093 ie 0x0080 bit set
if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00)
if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00)
{
spec->reg9_intmike_dmic_mo = 0x0080; // DMIC2_MO=10b
}
Expand All @@ -2867,7 +2867,7 @@ static int patch_cs8409_apple(struct hda_codec *codec)
// - 0x5400 : ASP1_xxx_EN = 1, ASP1/2_MCLK_EN = 0

// vendor reg 0x0082 - we need to update the DMIC bit fields but not the ASP bit fields for macbook/imac switch
if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00)
if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00)
{
spec->reg82_intmike_dmic_scl = 0x0002; // DMIC2_SCL_EN
spec->reg82_linein_dmic_scl = 0x0001; // DMIC1_SCL_EN
Expand Down
2 changes: 1 addition & 1 deletion patch_cirrus/patch_cirrus_boot84.h
Original file line number Diff line number Diff line change
Expand Up @@ -1753,7 +1753,7 @@ static void determine_speaker_id(struct hda_codec *codec)

// this is call AppleHDAFunctionGroup::setGPIOEnable in determineSpeakerID

if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00)
if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00)
{
//snd_hda_codec_write(codec, codec->core.afg, 0, AC_VERB_SET_GPIO_MASK, 0x00000008); // 0x00171608
// snd_hda: gpio enable 1 0x08
Expand Down
19 changes: 10 additions & 9 deletions patch_cirrus/patch_cirrus_new84.h
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,7 @@ static void cs_8409_play_data_ssm3(struct hda_codec *codec)
// 14,3 0x106b3900

// imac subsystem ids
// 18,1 0x106b0e00
// 18,2 0x106b0f00
// 18,3 0x106b1000
// 19,1 0x106b1000
Expand Down Expand Up @@ -1099,7 +1100,7 @@ static int cs_8409_boot_setup(struct hda_codec *codec)
err = cs_8409_real_config(codec);
}
}
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00) {
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00) {
if (spec->use_data) {
printk("snd_hda_intel: cs_8409_boot_setup pre data not implemented for subsystem id 0x%08x",codec->core.subsystem_id);
} else {
Expand Down Expand Up @@ -1135,7 +1136,7 @@ void cs_8409_play_setup(struct hda_codec *codec)
cs_8409_play_real(codec);
}
}
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00) {
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00) {
if (spec->use_data) {
printk("snd_hda_intel: cs_8409_play_setup data not implemented for subsystem id 0x%08x",codec->core.subsystem_id);
} else {
Expand Down Expand Up @@ -1169,7 +1170,7 @@ void cs_8409_play_cleanup(struct hda_codec *codec)
cs_8409_playstop_real(codec);
}
}
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00) {
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00) {
if (spec->use_data) {
printk("snd_hda_intel: cs_8409_play_cleanup data not implemented for subsystem id 0x%08x",codec->core.subsystem_id);
} else {
Expand All @@ -1190,7 +1191,7 @@ void cs_8409_capture_setup(struct hda_codec *codec)
{
struct cs8409_apple_spec *spec = codec->spec;
if (codec->core.subsystem_id == 0x106b3300 || codec->core.subsystem_id == 0x106b3600 || codec->core.subsystem_id == 0x106b3900
|| codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00) {
|| codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00) {
if (spec->use_data) {
//cs_8409_capture_data(codec);
} else {
Expand All @@ -1208,7 +1209,7 @@ void cs_8409_capture_cleanup(struct hda_codec *codec)
{
struct cs8409_apple_spec *spec = codec->spec;
if (codec->core.subsystem_id == 0x106b3300 || codec->core.subsystem_id == 0x106b3600 || codec->core.subsystem_id == 0x106b3900
|| codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00) {
|| codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00) {
if (spec->use_data) {
//cs_8409_capturestop_data(codec);
} else {
Expand Down Expand Up @@ -1352,7 +1353,7 @@ void cs_8409_headplay_setup(struct hda_codec *codec)
cs_8409_headplay_real(codec);
}
}
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00) {
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00) {
if (spec->use_data) {
printk("snd_hda_intel: cs_8409_headplay_setup data not implemented for subsystem id 0x%08x",codec->core.subsystem_id);
} else {
Expand Down Expand Up @@ -1393,7 +1394,7 @@ void cs_8409_headplay_cleanup(struct hda_codec *codec)
cs_8409_headplaystop_real(codec);
}
}
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00) {
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00) {
if (spec->use_data) {
printk("snd_hda_intel: cs_8409_headplay_cleanup data not implemented for subsystem id 0x%08x",codec->core.subsystem_id);
} else {
Expand Down Expand Up @@ -1422,7 +1423,7 @@ void cs_8409_headcapture_setup(struct hda_codec *codec)
{
struct cs8409_apple_spec *spec = codec->spec;
if (codec->core.subsystem_id == 0x106b3300 || codec->core.subsystem_id == 0x106b3600 || codec->core.subsystem_id == 0x106b3900
|| codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00) {
|| codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00) {
if (spec->use_data) {
//cs_8409_headcapture_data(codec);
} else {
Expand All @@ -1448,7 +1449,7 @@ void cs_8409_headcapture_cleanup(struct hda_codec *codec)
{
struct cs8409_apple_spec *spec = codec->spec;
if (codec->core.subsystem_id == 0x106b3300 || codec->core.subsystem_id == 0x106b3600 || codec->core.subsystem_id == 0x106b3900
|| codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00) {
|| codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00) {
if (spec->use_data) {
//cs_8409_capturestop_data(codec);
} else {
Expand Down
18 changes: 9 additions & 9 deletions patch_cirrus/patch_cirrus_real84.h
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@ static void cs_8409_setup_amps12(struct hda_codec *codec, int amps_enable)
//cs_8409_setup_amp_ssm3(codec, 0x28, 0x48, 0x00);
//cs_8409_setup_amp_ssm3(codec, 0x2a, 0x48, 0x01);
}
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00) {
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00) {
// NOTE that the TAS57642 amps setup during boot seems to skip the actual speaker power on
// hence the addition of the amps_enable parameter
// use reduced volume - from 0xcf to 0x9f - same reduction as for MAXs -24dB (0.5dB steps)
Expand Down Expand Up @@ -1199,7 +1199,7 @@ static void cs_8409_setup_amps34(struct hda_codec *codec, int amps_enable)
//cs_8409_setup_amp_ssm3(codec, 0x2c, 0x48, 0x02);
//cs_8409_setup_amp_ssm3(codec, 0x2e, 0x48, 0x03);
}
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00) {
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00) {
// NOTE that the TAS57642 amps setup during boot seems to skip the actual speaker power on
// hence the addition of the amps_enable parameter
// use reduced volume - from 0x48 to 0x80 - same reduction as for MAXs -24dB
Expand Down Expand Up @@ -1718,7 +1718,7 @@ static void cs_8409_disable_amps12(struct hda_codec *codec)
cs_8409_disable_amp_ssm3(codec, 0x28);
cs_8409_disable_amp_ssm3(codec, 0x2a);
}
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00) {
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00) {
//cs_8409_disable_amp_tas576(codec, 0xd8);
//cs_8409_disable_amp_tas576(codec, 0xda);
cs_8409_disable_amp_tas576_amp0(codec);
Expand Down Expand Up @@ -1813,7 +1813,7 @@ static void cs_8409_disable_amps34(struct hda_codec *codec)
cs_8409_disable_amp_ssm3(codec, 0x2c);
cs_8409_disable_amp_ssm3(codec, 0x2e);
}
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00) {
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00) {
//cs_8409_disable_amp_tas576(codec, 0xdc);
//cs_8409_disable_amp_tas576(codec, 0xde);
cs_8409_disable_amp_tas576_amp2(codec);
Expand Down Expand Up @@ -2114,7 +2114,7 @@ static int cs_8409_boot_setup_real(struct hda_codec *codec)
else if (codec->core.subsystem_id == 0x106b3300 || codec->core.subsystem_id == 0x106b3600) {
enable_GPIforUR(codec, 0xd);
}
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00) {
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00) {
enable_GPIforUR(codec, 0xd);
}
else {
Expand All @@ -2132,7 +2132,7 @@ static int cs_8409_boot_setup_real(struct hda_codec *codec)
else if (codec->core.subsystem_id == 0x106b3300 || codec->core.subsystem_id == 0x106b3600) {
cs42l83_external_control_GPIO(codec, 0xf);
}
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00) {
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00) {
cs42l83_external_control_GPIO(codec, 0xf);
}
else {
Expand All @@ -2152,7 +2152,7 @@ static int cs_8409_boot_setup_real(struct hda_codec *codec)
else if (codec->core.subsystem_id == 0x106b3300 || codec->core.subsystem_id == 0x106b3600) {
cs42l83_external_control_GPIO(codec, 0xf);
}
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00) {
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00) {
cs42l83_external_control_GPIO(codec, 0xf);
}
else {
Expand All @@ -2172,7 +2172,7 @@ static int cs_8409_boot_setup_real(struct hda_codec *codec)
//setup_amps_reset_i2c_ssm3
setup_amps_reset_i2c_ssm3(codec);
}
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00) {
else if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00) {
//setup_amps_reset(codec);
setup_amps_reset_i2c_tas576(codec);
}
Expand All @@ -2189,7 +2189,7 @@ static int cs_8409_boot_setup_real(struct hda_codec *codec)
cs42l83_mic_detect(codec);

// apparently the imacs use an inverted circuit for physical sensing of jack being plugged in
if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00)
if (codec->core.subsystem_id == 0x106b1000 || codec->core.subsystem_id == 0x106b0f00 || codec->core.subsystem_id == 0x106b0e00)
cs42l83_tip_sense(codec, 1);
else
cs42l83_tip_sense(codec, 0);
Expand Down

0 comments on commit 18f0201

Please sign in to comment.