mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Luke D. Jones" <luke@ljones.dev>
To: tiwai@suse.com
Cc: james.schulman@cirrus.com, david.rhodes@cirrus.com,
	rf@opensource.cirrus.com, linux-kernel@vger.kernel.org,
	sbinding@opensource.cirrus.com, "Luke D. Jones" <luke@ljones.dev>,
	Jonathan LoBue <jlobue10@gmail.com>
Subject: [PATCH] ALSA: hda: cs35l41: Support ASUS 2023 laptops with missing DSD
Date: Wed, 23 Aug 2023 13:10:08 +1200	[thread overview]
Message-ID: <20230823011008.13146-1-luke@ljones.dev> (raw)

Support adding the missing DSD properties required  for ASUS ROG 2023
laptops and other ASUS laptops to properly utilise the cs35l41.

This support includes both I2C and SPI connected amps.

The SPI connected amps may be required to use an external DSD patch
to fix or add the "cs-gpios" property.

Co-developed-by: Jonathan LoBue <jlobue10@gmail.com>
Signed-off-by: Jonathan LoBue <jlobue10@gmail.com>
Co-developed-by: Luke D. Jones <luke@ljones.dev>
Signed-off-by: Luke D. Jones <luke@ljones.dev>
---
 sound/pci/hda/cs35l41_hda_property.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/sound/pci/hda/cs35l41_hda_property.c b/sound/pci/hda/cs35l41_hda_property.c
index 673f23257a09..69879ab57918 100644
--- a/sound/pci/hda/cs35l41_hda_property.c
+++ b/sound/pci/hda/cs35l41_hda_property.c
@@ -43,6 +43,31 @@ static int lenovo_legion_no_acpi(struct cs35l41_hda *cs35l41, struct device *phy
 	return 0;
 }
 
+/*
+ * The CSC3551 is used in almost the entire ASUS ROG laptop range in 2023, this is likely to
+ * also include many non ROG labelled laptops. It is also used with either I2C connection or
+ * SPI connection. The SPI connected versions may be missing a chip select GPIO and require
+ * an DSD table patch.
+ */
+static int asus_rog_2023_no_acpi(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
+				const char *hid)
+{
+	struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg;
+
+	/* check SPI or I2C address to assign the index */
+	cs35l41->index = (id == 0 || id == 0x40) ? 0 : 1;
+	cs35l41->channel_index = 0;
+	cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH);
+	cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, 2);
+	hw_cfg->spk_pos = cs35l41->index;
+	hw_cfg->gpio2.func = CS35L41_INTERRUPT;
+	hw_cfg->gpio2.valid = true;
+	hw_cfg->bst_type = CS35L41_EXT_BOOST_NO_VSPK_SWITCH;
+	hw_cfg->valid = true;
+
+	return 0;
+}
+
 struct cs35l41_prop_model {
 	const char *hid;
 	const char *ssid;
@@ -53,6 +78,7 @@ struct cs35l41_prop_model {
 const struct cs35l41_prop_model cs35l41_prop_model_table[] = {
 	{ "CLSA0100", NULL, lenovo_legion_no_acpi },
 	{ "CLSA0101", NULL, lenovo_legion_no_acpi },
+	{ "CSC3551", NULL, asus_rog_2023_no_acpi },
 	{}
 };
 
-- 
2.41.0


             reply	other threads:[~2023-08-23  1:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-23  1:10 Luke D. Jones [this message]
2023-08-23  1:18 ` Luke Jones
2023-08-23  6:24 ` Takashi Iwai
2023-08-23  7:28   ` Luke Jones
2023-08-23  7:37     ` Takashi Iwai
2023-08-23  8:02       ` Luke Jones
2023-08-23  8:43         ` Takashi Iwai
2023-08-23 10:57           ` Stefan Binding
2023-08-23 20:31             ` Luke Jones
2023-08-25  4:48               ` Jonathan LoBue
2023-10-03 14:45               ` Luke Jones
2023-10-03 15:06                 ` Stefan Binding
2023-10-08 17:19                   ` Huayu Zhang
2023-10-23  7:38                     ` Jonathan LoBue
2023-10-23 16:35                       ` Jonathan LoBue
2023-10-25  4:25                         ` Jonathan LoBue

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=20230823011008.13146-1-luke@ljones.dev \
    --to=luke@ljones.dev \
    --cc=david.rhodes@cirrus.com \
    --cc=james.schulman@cirrus.com \
    --cc=jlobue10@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rf@opensource.cirrus.com \
    --cc=sbinding@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®