-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated to use patch command for modifying existing kernel source files.
This seems to solve the build error for Ubuntu kernel version 5.15.0-37 - and may also solve the very similar build error for mainline version 5.18.
- Loading branch information
Src User
committed
Jun 14, 2022
1 parent
18f0201
commit bcc755a
Showing
5 changed files
with
837 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
diff --git a/kernel_sources/patch_cirrus.c b/patch_cirrus/patch_cirrus.c | ||
index f46204a..678fbca 100644 | ||
--- a/kernel_sources/patch_cirrus.c | ||
+++ b/patch_cirrus/patch_cirrus.c | ||
@@ -9,6 +9,7 @@ | ||
#include <linux/slab.h> | ||
#include <linux/module.h> | ||
#include <sound/core.h> | ||
+#include <linux/pci.h> | ||
#include <sound/tlv.h> | ||
#include <sound/hda_codec.h> | ||
#include "hda_local.h" | ||
@@ -110,7 +111,7 @@ enum { | ||
* 1 DAC => HP(sense) / Speakers, | ||
* 1 ADC <= LineIn(sense) / MicIn / DMicIn, | ||
* 1 SPDIF OUT => SPDIF Trasmitter(sense) | ||
-*/ | ||
+ */ | ||
#define CS4210_DAC_NID 0x02 | ||
#define CS4210_ADC_NID 0x03 | ||
#define CS4210_VENDOR_NID 0x0B | ||
@@ -129,6 +130,7 @@ enum { | ||
static inline int cs_vendor_coef_get(struct hda_codec *codec, unsigned int idx) | ||
{ | ||
struct cs_spec *spec = codec->spec; | ||
+ | ||
snd_hda_codec_write(codec, spec->vendor_nid, 0, | ||
AC_VERB_SET_COEF_INDEX, idx); | ||
return snd_hda_codec_read(codec, spec->vendor_nid, 0, | ||
@@ -139,6 +141,7 @@ static inline void cs_vendor_coef_set(struct hda_codec *codec, unsigned int idx, | ||
unsigned int coef) | ||
{ | ||
struct cs_spec *spec = codec->spec; | ||
+ | ||
snd_hda_codec_write(codec, spec->vendor_nid, 0, | ||
AC_VERB_SET_COEF_INDEX, idx); | ||
snd_hda_codec_write(codec, spec->vendor_nid, 0, | ||
@@ -175,6 +178,7 @@ static void cs_automute(struct hda_codec *codec) | ||
static bool is_active_pin(struct hda_codec *codec, hda_nid_t nid) | ||
{ | ||
unsigned int val; | ||
+ | ||
val = snd_hda_codec_get_pincfg(codec, nid); | ||
return (get_defcfg_connect(val) != AC_JACK_PORT_NONE); | ||
} | ||
@@ -193,7 +197,7 @@ static void init_input_coef(struct hda_codec *codec) | ||
coef |= 1 << 3; /* DMIC1 2 chan on, GPIO0 off | ||
* No effect if SPDIF_OUT2 is | ||
* selected in IDX_SPDIF_CTL. | ||
- */ | ||
+ */ | ||
|
||
cs_vendor_coef_set(codec, IDX_BEEP_CFG, coef); | ||
} | ||
@@ -267,13 +271,6 @@ static const struct hda_verb cs_errata_init_verbs[] = { | ||
{0x11, AC_VERB_SET_COEF_INDEX, 0x0001}, | ||
{0x11, AC_VERB_SET_PROC_COEF, 0x0008}, | ||
{0x11, AC_VERB_SET_PROC_STATE, 0x00}, | ||
- | ||
-#if 0 /* Don't to set to D3 as we are in power-up sequence */ | ||
- {0x07, AC_VERB_SET_POWER_STATE, 0x03}, /* S/PDIF Rx: D3 */ | ||
- {0x08, AC_VERB_SET_POWER_STATE, 0x03}, /* S/PDIF Tx: D3 */ | ||
- /*{0x01, AC_VERB_SET_POWER_STATE, 0x03},*/ /* AFG: D3 This is already handled */ | ||
-#endif | ||
- | ||
{} /* terminator */ | ||
}; | ||
|
||
@@ -361,8 +358,10 @@ static int cs_parse_auto_config(struct hda_codec *codec) | ||
/* keep the ADCs powered up when it's dynamically switchable */ | ||
if (spec->gen.dyn_adc_switch) { | ||
unsigned int done = 0; | ||
+ | ||
for (i = 0; i < spec->gen.input_mux.num_items; i++) { | ||
int idx = spec->gen.dyn_adc_idx[i]; | ||
+ | ||
if (done & (1 << idx)) | ||
continue; | ||
snd_hda_gen_fix_pin_power(codec, | ||
@@ -496,6 +495,7 @@ static void cs420x_fixup_gpio_13(struct hda_codec *codec, | ||
{ | ||
if (action == HDA_FIXUP_ACT_PRE_PROBE) { | ||
struct cs_spec *spec = codec->spec; | ||
+ | ||
spec->gpio_eapd_hp = 2; /* GPIO1 = headphones */ | ||
spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ | ||
spec->gpio_mask = spec->gpio_dir = | ||
@@ -508,6 +508,7 @@ static void cs420x_fixup_gpio_23(struct hda_codec *codec, | ||
{ | ||
if (action == HDA_FIXUP_ACT_PRE_PROBE) { | ||
struct cs_spec *spec = codec->spec; | ||
+ | ||
spec->gpio_eapd_hp = 4; /* GPIO2 = headphones */ | ||
spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ | ||
spec->gpio_mask = spec->gpio_dir = | ||
@@ -652,6 +653,7 @@ static void cs4208_fixup_gpio0(struct hda_codec *codec, | ||
{ | ||
if (action == HDA_FIXUP_ACT_PRE_PROBE) { | ||
struct cs_spec *spec = codec->spec; | ||
+ | ||
spec->gpio_eapd_hp = 0; | ||
spec->gpio_eapd_speaker = 1; | ||
spec->gpio_mask = spec->gpio_dir = | ||
@@ -806,7 +808,7 @@ static int patch_cs4208(struct hda_codec *codec) | ||
* 1 DAC => HP(sense) / Speakers, | ||
* 1 ADC <= LineIn(sense) / MicIn / DMicIn, | ||
* 1 SPDIF OUT => SPDIF Trasmitter(sense) | ||
-*/ | ||
+ */ | ||
|
||
/* CS4210 board names */ | ||
static const struct hda_model_fixup cs421x_models[] = { | ||
@@ -849,6 +851,7 @@ static void cs421x_fixup_sense_b(struct hda_codec *codec, | ||
const struct hda_fixup *fix, int action) | ||
{ | ||
struct cs_spec *spec = codec->spec; | ||
+ | ||
if (action == HDA_FIXUP_ACT_PRE_PROBE) | ||
spec->sense_b = 1; | ||
} | ||
@@ -874,9 +877,9 @@ static const struct hda_verb cs421x_coef_init_verbs[] = { | ||
{0x0B, AC_VERB_SET_PROC_STATE, 1}, | ||
{0x0B, AC_VERB_SET_COEF_INDEX, CS421X_IDX_DEV_CFG}, | ||
/* | ||
- Disable Coefficient Index Auto-Increment(DAI)=1, | ||
- PDREF=0 | ||
- */ | ||
+ * Disable Coefficient Index Auto-Increment(DAI)=1, | ||
+ * PDREF=0 | ||
+ */ | ||
{0x0B, AC_VERB_SET_PROC_COEF, 0x0001 }, | ||
|
||
{0x0B, AC_VERB_SET_COEF_INDEX, CS421X_IDX_ADC_CFG}, | ||
@@ -963,12 +966,12 @@ static int cs421x_boost_vol_put(struct snd_kcontrol *kcontrol, | ||
|
||
coef &= ~0x0003; | ||
coef |= (vol & 0x0003); | ||
- if (original_coef == coef) | ||
- return 0; | ||
- else { | ||
+ if (original_coef != coef) { | ||
cs_vendor_coef_set(codec, CS421X_IDX_SPK_CTL, coef); | ||
return 1; | ||
} | ||
+ | ||
+ return 0; | ||
} | ||
|
||
static const struct snd_kcontrol_new cs421x_speaker_boost_ctl = { | ||
@@ -1007,8 +1010,8 @@ static void cs4210_pinmux_init(struct hda_codec *codec) | ||
is_active_pin(codec, CS421X_DMIC_PIN_NID)) { | ||
|
||
/* | ||
- GPIO or SENSE_B forced - disconnect the DMIC pin. | ||
- */ | ||
+ * GPIO or SENSE_B forced - disconnect the DMIC pin. | ||
+ */ | ||
def_conf = snd_hda_codec_get_pincfg(codec, CS421X_DMIC_PIN_NID); | ||
def_conf &= ~AC_DEFCFG_PORT_CONN; | ||
def_conf |= (AC_JACK_PORT_NONE << AC_DEFCFG_PORT_CONN_SHIFT); | ||
@@ -1047,6 +1050,7 @@ static void parse_cs421x_digital(struct hda_codec *codec) | ||
|
||
for (i = 0; i < cfg->dig_outs; i++) { | ||
hda_nid_t nid = cfg->dig_out_pins[i]; | ||
+ | ||
if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) { | ||
spec->spdif_detect = 1; | ||
snd_hda_jack_detect_enable_callback(codec, nid, | ||
@@ -1125,9 +1129,9 @@ static int cs421x_parse_auto_config(struct hda_codec *codec) | ||
|
||
#ifdef CONFIG_PM | ||
/* | ||
- Manage PDREF, when transitioning to D3hot | ||
- (DAC,ADC) -> D3, PDREF=1, AFG->D3 | ||
-*/ | ||
+ * Manage PDREF, when transitioning to D3hot | ||
+ * (DAC,ADC) -> D3, PDREF=1, AFG->D3 | ||
+ */ | ||
static int cs421x_suspend(struct hda_codec *codec) | ||
{ | ||
struct cs_spec *spec = codec->spec; | ||
@@ -1178,10 +1182,10 @@ static int patch_cs4210(struct hda_codec *codec) | ||
snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); | ||
|
||
/* | ||
- Update the GPIO/DMIC/SENSE_B pinmux before the configuration | ||
- is auto-parsed. If GPIO or SENSE_B is forced, DMIC input | ||
- is disabled. | ||
- */ | ||
+ * Update the GPIO/DMIC/SENSE_B pinmux before the configuration | ||
+ * is auto-parsed. If GPIO or SENSE_B is forced, DMIC input | ||
+ * is disabled. | ||
+ */ | ||
cs4210_pinmux_init(codec); | ||
|
||
err = cs421x_parse_auto_config(codec); | ||
@@ -1219,7 +1223,6 @@ static int patch_cs4213(struct hda_codec *codec) | ||
return err; | ||
} | ||
|
||
- | ||
/* | ||
* patch entries | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
diff --git a/kernel_sources/patch_cs8409.c b/patch_cirrus/patch_cs8409.c | ||
index aff2b5a..7e9c07c 100644 | ||
--- a/kernel_sources/patch_cs8409.c | ||
+++ b/patch_cirrus/patch_cs8409.c | ||
@@ -1270,6 +1270,8 @@ void dolphin_fixups(struct hda_codec *codec, const struct hda_fixup *fix, int ac | ||
} | ||
} | ||
|
||
+static int patch_cs8409_apple(struct hda_codec *codec); | ||
+ | ||
static int patch_cs8409(struct hda_codec *codec) | ||
{ | ||
int err; | ||
@@ -1277,8 +1279,19 @@ static int patch_cs8409(struct hda_codec *codec) | ||
if (!cs8409_alloc_spec(codec)) | ||
return -ENOMEM; | ||
|
||
+ printk("snd_hda_intel: Primary patch_cs8409\n"); | ||
+ | ||
snd_hda_pick_fixup(codec, cs8409_models, cs8409_fixup_tbl, cs8409_fixups); | ||
|
||
+ // this seems the easiest way to separate and jump into the code for handling Apple machines using the 8409 | ||
+ // note now freeing the just allocated spec - this undos the delayed work as not using mutex yet | ||
+ if (codec->fixup_id == HDA_FIXUP_ID_NOT_SET) { | ||
+ printk("snd_hda_intel: Primary patch_cs8409 NOT FOUND trying APPLE\n"); | ||
+ cs8409_free(codec); | ||
+ err = patch_cs8409_apple(codec); | ||
+ return err; | ||
+ } | ||
+ | ||
codec_dbg(codec, "Picked ID=%d, VID=%08x, DEV=%08x\n", codec->fixup_id, | ||
codec->bus->pci->subsystem_vendor, | ||
codec->bus->pci->subsystem_device); | ||
@@ -1295,6 +1308,12 @@ static int patch_cs8409(struct hda_codec *codec) | ||
return 0; | ||
} | ||
|
||
+ | ||
+// for the moment split the new code into an include file | ||
+ | ||
+#include "patch_cirrus_apple.h" | ||
+ | ||
+ | ||
static const struct hda_device_id snd_hda_id_cs8409[] = { | ||
HDA_CODEC_ENTRY(0x10138409, "CS8409", patch_cs8409), | ||
{} /* terminator */ |
Oops, something went wrong.