ALSA: hda/tas2781: add configurable global i2c address
authorGergo Koteles <soyer@irl.hu>
Sat, 30 Dec 2023 00:09:43 +0000 (01:09 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 2 Jan 2024 15:15:09 +0000 (16:15 +0100)
Make the global i2c address configurable to support compatible amplifiers
with different global i2c address.

Signed-off-by: Gergo Koteles <soyer@irl.hu>
Link: https://lore.kernel.org/r/a252f1efeed5049f027f01e699c9e10e1e05bf9e.1703891777.git.soyer@irl.hu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/sound/tas2781.h
sound/pci/hda/tas2781_hda_i2c.c

index e17ceab4fead1092498b914040fa0ef195eadfb3..dde9f8120d4c4fdbc4031a5f031727bc6118bcd0 100644 (file)
@@ -121,6 +121,8 @@ struct tasdevice_priv {
        bool force_fwload_status;
        bool playback_started;
        bool isacpi;
+       unsigned int global_addr;
+
        int (*fw_parse_variable_header)(struct tasdevice_priv *tas_priv,
                const struct firmware *fmw, int offset);
        int (*fw_parse_program_data)(struct tasdevice_priv *tas_priv,
index 4b639120c9813eb8b40ba0053f3d7188cc7e8c3a..503be3fbce56473403a672c30a599b4db7c40b30 100644 (file)
@@ -81,7 +81,7 @@ static int tas2781_get_i2c_res(struct acpi_resource *ares, void *data)
 
        if (i2c_acpi_get_i2c_resource(ares, &sb)) {
                if (tas_priv->ndev < TASDEVICE_MAX_CHANNELS &&
-                       sb->slave_address != TAS2781_GLOBAL_ADDR) {
+                       sb->slave_address != tas_priv->global_addr) {
                        tas_priv->tasdevice[tas_priv->ndev].dev_addr =
                                (unsigned int)sb->slave_address;
                        tas_priv->ndev++;
@@ -701,6 +701,7 @@ static int tas2781_hda_i2c_probe(struct i2c_client *clt)
                device_name = "TIAS2781";
                tas_hda->priv->save_calibration = tas2781_save_calibration;
                tas_hda->priv->apply_calibration = tas2781_apply_calib;
+               tas_hda->priv->global_addr = TAS2781_GLOBAL_ADDR;
        } else
                return -ENODEV;