Commit 1cce63fa authored by jan.koester's avatar jan.koester
Browse files

sound patch

parent 4de8f31e
Loading
Loading
Loading
Loading
+39 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@

#include <linux/gpio/consumer.h>
#include <linux/string.h>
#include <linux/spi/spi.h>
#include "cs35l41_hda_property.h"

/*
@@ -43,6 +44,43 @@ static int lenovo_legion_no_acpi(struct cs35l41_hda *cs35l41, struct device *phy
	return 0;
}

/*
 * Device 10280BEB (Dell XPS 9530) doesn't have _DSD at all. Moreover, pin that is typically
 * used for `speaker_id` is missing.
 * The CSC3551 is SPI connected. Since chip select GPIOs are not present either, at the
 * moment 10280BEB requires an ACPI table patch in addition to this patch.
 */
static int dell_fiorano_no_acpi(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
				const char *hid)
{
	struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg;

	dev_info(cs35l41->dev, "Adding DSD properties for %s\n", cs35l41->acpi_subsystem_id);

	/* check SPI address to assign the index */
	cs35l41->index = id;
	cs35l41->channel_index = 0;
	/* 10280BEB is missing pin which is typically assigned to `spk-id-gpios` */
	cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, cs35l41->index, 2, -1);
	cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 1, GPIOD_OUT_LOW);

	hw_cfg->spk_pos = cs35l41->index  ? 1 : 0;	// 0th L, 1st R
	hw_cfg->bst_type = CS35L41_EXT_BOOST;
	hw_cfg->gpio1.func = CS35l41_VSPK_SWITCH;
	hw_cfg->gpio1.valid = true;
	hw_cfg->gpio2.func = CS35L41_INTERRUPT;
	hw_cfg->gpio2.valid = true;
	hw_cfg->valid = true;

	/* Add second cs-gpio here */
	if (cs35l41->index) {
	struct spi_device *spi = to_spi_device(cs35l41->dev);
		spi->cs_gpiod = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH);
	}

	return 0;
}

/*
 * Device 103C89C6 does have _DSD, however it is setup to use the wrong boost type.
 * We can override the _DSD to correct the boost type here.
@@ -85,6 +123,7 @@ static const struct cs35l41_prop_model cs35l41_prop_model_table[] = {
	{ "CLSA0100", NULL, lenovo_legion_no_acpi },
	{ "CLSA0101", NULL, lenovo_legion_no_acpi },
	{ "CSC3551", "103C89C6", hp_vision_acpi_fix },
	{ "CSC3551", "10280BEB", dell_fiorano_no_acpi },
	{}
};