Commit 891667ce authored by Takashi Iwai's avatar Takashi Iwai
Browse files

Merge branch 'for-linus' into for-next



Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parents 0bdbce25 40b1c2f9
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -3190,6 +3190,9 @@ static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
	};
	struct alc_spec *spec = codec->spec;

	/* Support Audio mute LED and Mic mute LED on keyboard */
	hda_fixup_ideapad_acpi(codec, fix, action);

	switch (action) {
	case HDA_FIXUP_ACT_PRE_PROBE:
		snd_hda_apply_pincfgs(codec, pincfgs);
+82 −28
Original line number Diff line number Diff line
@@ -872,6 +872,52 @@ static int cs35l56_hda_system_resume(struct device *dev)
	return 0;
}

static int cs35l56_hda_fixup_yoga9(struct cs35l56_hda *cs35l56, int *bus_addr)
{
	/* The cirrus,dev-index property has the wrong values */
	switch (*bus_addr) {
	case 0x30:
		cs35l56->index = 1;
		return 0;
	case 0x31:
		cs35l56->index = 0;
		return 0;
	default:
		/* There is a pseudo-address for broadcast to both amps - ignore it */
		dev_dbg(cs35l56->base.dev, "Ignoring I2C address %#x\n", *bus_addr);
		return 0;
	}
}

static const struct {
	const char *sub;
	int (*fixup_fn)(struct cs35l56_hda *cs35l56, int *bus_addr);
} cs35l56_hda_fixups[] = {
	{
		.sub = "17AA390B", /* Lenovo Yoga Book 9i GenX */
		.fixup_fn = cs35l56_hda_fixup_yoga9,
	},
};

static int cs35l56_hda_apply_platform_fixups(struct cs35l56_hda *cs35l56, const char *sub,
					     int *bus_addr)
{
	int i;

	if (IS_ERR(sub))
		return 0;

	for (i = 0; i < ARRAY_SIZE(cs35l56_hda_fixups); i++) {
		if (strcasecmp(cs35l56_hda_fixups[i].sub, sub) == 0) {
			dev_dbg(cs35l56->base.dev, "Applying fixup for %s\n",
				cs35l56_hda_fixups[i].sub);
			return (cs35l56_hda_fixups[i].fixup_fn)(cs35l56, bus_addr);
		}
	}

	return 0;
}

static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int hid, int id)
{
	u32 values[HDA_MAX_COMPONENTS];
@@ -896,6 +942,15 @@ static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int hid, int id)
		ACPI_COMPANION_SET(cs35l56->base.dev, adev);
	}

	/* Initialize things that could be overwritten by a fixup */
	cs35l56->index = -1;

	sub = acpi_get_subsystem_id(ACPI_HANDLE(cs35l56->base.dev));
	ret = cs35l56_hda_apply_platform_fixups(cs35l56, sub, &id);
	if (ret)
		return ret;

	if (cs35l56->index == -1) {
		property = "cirrus,dev-index";
		ret = device_property_count_u32(cs35l56->base.dev, property);
		if (ret <= 0)
@@ -911,13 +966,13 @@ static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int hid, int id)
		if (ret)
			goto err;

	cs35l56->index = -1;
		for (i = 0; i < nval; i++) {
			if (values[i] == id) {
				cs35l56->index = i;
				break;
			}
		}

		/*
		 * It's not an error for the ID to be missing: for I2C there can be
		 * an alias address that is not a real device. So reject silently.
@@ -927,8 +982,7 @@ static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int hid, int id)
			ret = -ENODEV;
			goto err;
		}

	sub = acpi_get_subsystem_id(ACPI_HANDLE(cs35l56->base.dev));
	}

	if (IS_ERR(sub)) {
		dev_info(cs35l56->base.dev,