summarylogtreecommitdiffstats
path: root/0001-ALSA-hda-cs35l41-Improve-support-for-ASUS-ROG-Ally.patch
diff options
context:
space:
mode:
authorJeka2023-12-11 18:22:16 +0300
committerJeka2023-12-11 18:22:16 +0300
commit139ff035492c400023b1b7f0e6603c33cd9f04d2 (patch)
treed9f8b6e2ee29b9a91a862c4d87843c07e99f85fa /0001-ALSA-hda-cs35l41-Improve-support-for-ASUS-ROG-Ally.patch
parent41ebcbdba1e39e7fe2bc46e727e8a88ed9fb7be0 (diff)
downloadaur-139ff035492c400023b1b7f0e6603c33cd9f04d2.tar.gz
kernel release 6.6.6
Diffstat (limited to '0001-ALSA-hda-cs35l41-Improve-support-for-ASUS-ROG-Ally.patch')
-rw-r--r--0001-ALSA-hda-cs35l41-Improve-support-for-ASUS-ROG-Ally.patch64
1 files changed, 64 insertions, 0 deletions
diff --git a/0001-ALSA-hda-cs35l41-Improve-support-for-ASUS-ROG-Ally.patch b/0001-ALSA-hda-cs35l41-Improve-support-for-ASUS-ROG-Ally.patch
new file mode 100644
index 000000000000..d97fc7c444b9
--- /dev/null
+++ b/0001-ALSA-hda-cs35l41-Improve-support-for-ASUS-ROG-Ally.patch
@@ -0,0 +1,64 @@
+diff --git a/sound/pci/hda/cs35l41_hda_property.c b/sound/pci/hda/cs35l41_hda_property.c
+index b39f944..b67c636 100644
+--- a/sound/pci/hda/cs35l41_hda_property.c
++++ b/sound/pci/hda/cs35l41_hda_property.c
+@@ -6,7 +6,9 @@
+ //
+ // Author: Stefan Binding <sbinding@opensource.cirrus.com>
+
++#include <linux/dmi.h>
+ #include <linux/gpio/consumer.h>
++#include <linux/kernel.h>
+ #include <linux/string.h>
+ #include "cs35l41_hda_property.h"
+
+@@ -78,6 +80,40 @@ static int asus_rog_2023_spkr_id2(struct cs35l41_hda *cs35l41, struct device *ph
+ return 0;
+ }
+
++static int asus_rog_2023_ally_fix(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
++ const char *hid)
++{
++ const char *rog_ally_bios_ver = dmi_get_system_info(DMI_BIOS_VERSION);
++ const char *rog_ally_bios_num = rog_ally_bios_ver + 6; // Dropping the RC71L. part before the number
++ int rog_ally_bios_int;
++ kstrtoint(rog_ally_bios_num, 10, &rog_ally_bios_int);
++ if(rog_ally_bios_int >= 330){
++ printk(KERN_INFO "DSD properties exist in the %d BIOS\n", rog_ally_bios_int);
++ return -ENOENT; //Patch not applicable. Exiting...
++ }
++
++ struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg;
++
++ dev_info(cs35l41->dev, "Adding DSD properties for %s\n", cs35l41->acpi_subsystem_id);
++
++ cs35l41->index = 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->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; /* 1,000nH Inductance value */
++ hw_cfg->bst_ipk = 4500; /* 4,500mA peak current */
++ hw_cfg->bst_cap = 24; /* 24 microFarad cap value */
++ hw_cfg->valid = true;
++
++ return 0;
++}
++
+ struct cs35l41_prop_model {
+ const char *hid;
+ const char *ssid;
+@@ -94,7 +130,7 @@ const struct cs35l41_prop_model cs35l41_prop_model_table[] = {
+ { "CSC3551", "10431483", asus_rog_2023_spkr_id2 }, // ASUS GU603V - spi, reset gpio 1
+ { "CSC3551", "10431493", asus_rog_2023_spkr_id2 }, // ASUS GV601V - spi, reset gpio 1
+ { "CSC3551", "10431573", asus_rog_2023_spkr_id2 }, // ASUS GZ301V - spi, reset gpio 0
+- { "CSC3551", "104317F3", asus_rog_2023_spkr_id2 }, // ASUS ROG ALLY - i2c
++ { "CSC3551", "104317F3", asus_rog_2023_ally_fix }, // ASUS ROG ALLY - i2c
+ { "CSC3551", "10431B93", asus_rog_2023_spkr_id2 }, // ASUS G614J - spi, reset gpio 0
+ { "CSC3551", "10431CAF", asus_rog_2023_spkr_id2 }, // ASUS G634J - spi, reset gpio 0
+ { "CSC3551", "10431C9F", asus_rog_2023_spkr_id2 }, // ASUS G614JI -spi, reset gpio 0