mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan Binding <sbinding@opensource.cirrus.com>
To: Lorenz Brun <lorenz@brun.one>,
	James Schulman <james.schulman@cirrus.com>,
	David Rhodes <david.rhodes@cirrus.com>,
	Richard Fitzgerald <rf@opensource.cirrus.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>
Cc: <alsa-devel@alsa-project.org>, <patches@opensource.cirrus.com>,
	<linux-sound@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ALSA: hda: cs35l41: Add HP override
Date: Wed, 20 Dec 2023 13:58:18 +0000	[thread overview]
Message-ID: <97da898a-b747-44f3-87a7-021aea8ca4ac@opensource.cirrus.com> (raw)
In-Reply-To: <20231219201513.2172580-1-lorenz@brun.one>

Hi,

I recently pushed up some changes that allow you to add laptops into a 
configuration table, these laptops should be added into that instead of 
creating a new function.

I don't have the configuration of some of these laptops right now to be 
able to review it, but hopefully I should be able to obtain them.

Thanks,

Stefan

On 19/12/2023 20:15, Lorenz Brun wrote:
> This adds an override for a series of notebooks using a common config
> taken from HP's proprietary Windows driver (csaudioext).
>
> This has been tested on a HP 15-ey0xxxx device (subsystem 103C8A31)
> together with another Realtek quirk and the calibration files from the
> proprietary driver.
>
> Signed-off-by: Lorenz Brun <lorenz@brun.one>
> ---
>   sound/pci/hda/cs35l41_hda_property.c | 59 ++++++++++++++++++++++++++++
>   1 file changed, 59 insertions(+)
>
> diff --git a/sound/pci/hda/cs35l41_hda_property.c b/sound/pci/hda/cs35l41_hda_property.c
> index c83328971728..8135ea532a94 100644
> --- a/sound/pci/hda/cs35l41_hda_property.c
> +++ b/sound/pci/hda/cs35l41_hda_property.c
> @@ -6,6 +6,7 @@
>   //
>   // Author: Stefan Binding <sbinding@opensource.cirrus.com>
>   
> +#include <linux/acpi.h>
>   #include <linux/gpio/consumer.h>
>   #include <linux/string.h>
>   #include "cs35l41_hda_property.h"
> @@ -81,6 +82,42 @@ static int hp_vision_acpi_fix(struct cs35l41_hda *cs35l41, struct device *physde
>   	return 0;
>   }
>   
> +/*
> + * HP 2-channel I2C configuration with internal boost (4.1A inductor current) with no _DSD,
> + * reset GPIO can still be extracted from ACPI by index. Covers HP configurations 251, 252,
> + * 253, 254, 351, 352 and 353 in the proprietary driver (csaudioext).
> + */
> +static int hp_i2c_2ch_vbst_ipk41(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
> +			      const char *hid)
> +{
> +	// In case a valid _DSD exists, use that instead of the override. This stops applying
> +	// the override in case HP ever fixes their firmware.
> +	if (device_property_count_u32(physdev, "cirrus,dev-index") > 0)
> +		return -ENOENT;
> +
> +	struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg;
> +
> +	cs35l41->index = id == 0x40 ? 0 : 1;
> +	cs35l41->channel_index = 0;
> +	// Get reset GPIO (shared for both instances) from ACPI GpioIo at index 0.
> +	cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH);
> +	// Speaker ID GPIO is ACPI GpioIo index 1.
> +	cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, 1);
> +
> +	hw_cfg->spk_pos = cs35l41->index ? 1 : 0; // left:right
> +	hw_cfg->gpio1.func = CS35L41_NOT_USED;
> +	hw_cfg->gpio1.valid = true;
> +	hw_cfg->gpio2.func = CS35L41_INTERRUPT;
> +	hw_cfg->gpio2.valid = true;
> +	hw_cfg->bst_type = CS35L41_INT_BOOST;
> +	hw_cfg->bst_ind = 1000;
> +	hw_cfg->bst_ipk = 4100;
> +	hw_cfg->bst_cap = 10; // Exact value unknown, maps into correct range
> +	hw_cfg->valid = true;
> +
> +	return 0;
> +}
> +
>   struct cs35l41_prop_model {
>   	const char *hid;
>   	const char *ssid;
> @@ -92,6 +129,28 @@ 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", "103C8A28", hp_i2c_2ch_vbst_ipk41 },
> +	{ "CSC3551", "103C8A29", hp_i2c_2ch_vbst_ipk41 },
> +	{ "CSC3551", "103C8A2A", hp_i2c_2ch_vbst_ipk41 },
> +	{ "CSC3551", "103C8A2B", hp_i2c_2ch_vbst_ipk41 },
> +	{ "CSC3551", "103C8A2C", hp_i2c_2ch_vbst_ipk41 },
> +	{ "CSC3551", "103C8A2D", hp_i2c_2ch_vbst_ipk41 },
> +	{ "CSC3551", "103C8A2E", hp_i2c_2ch_vbst_ipk41 },
> +	{ "CSC3551", "103C8A30", hp_i2c_2ch_vbst_ipk41 },
> +	{ "CSC3551", "103C8A31", hp_i2c_2ch_vbst_ipk41 },
> +	{ "CSC3551", "103C8BB3", hp_i2c_2ch_vbst_ipk41 },
> +	{ "CSC3551", "103C8BB4", hp_i2c_2ch_vbst_ipk41 },
> +	{ "CSC3551", "103C8BDF", hp_i2c_2ch_vbst_ipk41 },
> +	{ "CSC3551", "103C8BE0", hp_i2c_2ch_vbst_ipk41 },
> +	{ "CSC3551", "103C8BE1", hp_i2c_2ch_vbst_ipk41 },
> +	{ "CSC3551", "103C8BE2", hp_i2c_2ch_vbst_ipk41 },
> +	{ "CSC3551", "103C8BE9", hp_i2c_2ch_vbst_ipk41 },
> +	{ "CSC3551", "103C8BDD", hp_i2c_2ch_vbst_ipk41 },
> +	{ "CSC3551", "103C8BDE", hp_i2c_2ch_vbst_ipk41 },
> +	{ "CSC3551", "103C8BE3", hp_i2c_2ch_vbst_ipk41 },
> +	{ "CSC3551", "103C8BE5", hp_i2c_2ch_vbst_ipk41 },
> +	{ "CSC3551", "103C8BE6", hp_i2c_2ch_vbst_ipk41 },
> +	{ "CSC3551", "103C8B3A", hp_i2c_2ch_vbst_ipk41 },
>   	{}
>   };
>   

  reply	other threads:[~2023-12-20 13:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-19 20:15 Lorenz Brun
2023-12-20 13:58 ` Stefan Binding [this message]
2023-12-22  1:50 Lorenz Brun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=97da898a-b747-44f3-87a7-021aea8ca4ac@opensource.cirrus.com \
    --to=sbinding@opensource.cirrus.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=david.rhodes@cirrus.com \
    --cc=james.schulman@cirrus.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=lorenz@brun.one \
    --cc=patches@opensource.cirrus.com \
    --cc=perex@perex.cz \
    --cc=rf@opensource.cirrus.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®