Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit 92b53ec

Browse files
linuswgregkh
authored andcommitted
ASoC: tas2781-i2c: Drop weird GPIO code
[ Upstream commit c2c0b67 ] The tas2781-i2c driver gets an IRQ from either ACPI or device tree, then proceeds to check if the IRQ has a corresponding GPIO and in case it does enforce the GPIO as input and set a label on it. This is abuse of the API: - First we cannot guarantee that the numberspaces of the GPIOs and the IRQs are the same, i.e that an IRQ number corresponds to a GPIO number like that. - Second, GPIO chips and IRQ chips should be treated as orthogonal APIs, the irqchip needs to ascertain that the backing GPIO line is set to input etc just using the irqchip. - Third it is using the legacy <linux/gpio.h> API which should not be used in new code yet this was added just a year ago. Delete the offending code. If this creates problems the GPIO and irqchip maintainers can help to fix the issues. It *should* not create any problems, because the irq isn't used anywhere in the driver, it's just obtained and then left unused. Fixes: ef3bcde ("ASoC: tas2781: Add tas2781 driver") Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://patch.msgid.link/20240807-asoc-tas-gpios-v2-1-bd0f2705d58b@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent ac7976b commit 92b53ec

File tree

5 files changed

+5
-32
lines changed

5 files changed

+5
-32
lines changed

include/sound/tas2781.h

+1-6
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,13 @@ struct tasdevice {
7878
bool is_loaderr;
7979
};
8080

81-
struct tasdevice_irqinfo {
82-
int irq_gpio;
83-
int irq;
84-
};
85-
8681
struct calidata {
8782
unsigned char *data;
8883
unsigned long total_sz;
8984
};
9085

9186
struct tasdevice_priv {
9287
struct tasdevice tasdevice[TASDEVICE_MAX_CHANNELS];
93-
struct tasdevice_irqinfo irq_info;
9488
struct tasdevice_rca rcabin;
9589
struct calidata cali_data;
9690
struct tasdevice_fw *fmw;
@@ -111,6 +105,7 @@ struct tasdevice_priv {
111105
unsigned int chip_id;
112106
unsigned int sysclk;
113107

108+
int irq;
114109
int cur_prog;
115110
int cur_conf;
116111
int fw_state;

sound/pci/hda/tas2781_hda_i2c.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ static int tas2781_hda_i2c_probe(struct i2c_client *clt)
710710
} else
711711
return -ENODEV;
712712

713-
tas_hda->priv->irq_info.irq = clt->irq;
713+
tas_hda->priv->irq = clt->irq;
714714
ret = tas2781_read_acpi(tas_hda->priv, device_name);
715715
if (ret)
716716
return dev_err_probe(tas_hda->dev, ret,

sound/soc/codecs/tas2781-comlib.c

-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <linux/interrupt.h>
1515
#include <linux/module.h>
1616
#include <linux/of.h>
17-
#include <linux/of_gpio.h>
1817
#include <linux/of_irq.h>
1918
#include <linux/regmap.h>
2019
#include <linux/slab.h>
@@ -406,8 +405,6 @@ EXPORT_SYMBOL_GPL(tasdevice_dsp_remove);
406405

407406
void tasdevice_remove(struct tasdevice_priv *tas_priv)
408407
{
409-
if (gpio_is_valid(tas_priv->irq_info.irq_gpio))
410-
gpio_free(tas_priv->irq_info.irq_gpio);
411408
mutex_destroy(&tas_priv->codec_lock);
412409
}
413410
EXPORT_SYMBOL_GPL(tasdevice_remove);

sound/soc/codecs/tas2781-fmwlib.c

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <linux/interrupt.h>
1414
#include <linux/module.h>
1515
#include <linux/of.h>
16-
#include <linux/of_gpio.h>
1716
#include <linux/of_irq.h>
1817
#include <linux/regmap.h>
1918
#include <linux/slab.h>

sound/soc/codecs/tas2781-i2c.c

+3-21
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include <linux/module.h>
2323
#include <linux/of.h>
2424
#include <linux/of_address.h>
25-
#include <linux/of_gpio.h>
2625
#include <linux/of_irq.h>
2726
#include <linux/regmap.h>
2827
#include <linux/slab.h>
@@ -617,7 +616,7 @@ static void tasdevice_parse_dt(struct tasdevice_priv *tas_priv)
617616
{
618617
struct i2c_client *client = (struct i2c_client *)tas_priv->client;
619618
unsigned int dev_addrs[TASDEVICE_MAX_CHANNELS];
620-
int rc, i, ndev = 0;
619+
int i, ndev = 0;
621620

622621
if (tas_priv->isacpi) {
623622
ndev = device_property_read_u32_array(&client->dev,
@@ -632,7 +631,7 @@ static void tasdevice_parse_dt(struct tasdevice_priv *tas_priv)
632631
"ti,audio-slots", dev_addrs, ndev);
633632
}
634633

635-
tas_priv->irq_info.irq_gpio =
634+
tas_priv->irq =
636635
acpi_dev_gpio_irq_get(ACPI_COMPANION(&client->dev), 0);
637636
} else if (IS_ENABLED(CONFIG_OF)) {
638637
struct device_node *np = tas_priv->dev->of_node;
@@ -644,7 +643,7 @@ static void tasdevice_parse_dt(struct tasdevice_priv *tas_priv)
644643
dev_addrs[ndev++] = addr;
645644
}
646645

647-
tas_priv->irq_info.irq_gpio = of_irq_get(np, 0);
646+
tas_priv->irq = of_irq_get(np, 0);
648647
} else {
649648
ndev = 1;
650649
dev_addrs[0] = client->addr;
@@ -660,23 +659,6 @@ static void tasdevice_parse_dt(struct tasdevice_priv *tas_priv)
660659
__func__);
661660

662661
strcpy(tas_priv->dev_name, tasdevice_id[tas_priv->chip_id].name);
663-
664-
if (gpio_is_valid(tas_priv->irq_info.irq_gpio)) {
665-
rc = gpio_request(tas_priv->irq_info.irq_gpio,
666-
"AUDEV-IRQ");
667-
if (!rc) {
668-
gpio_direction_input(
669-
tas_priv->irq_info.irq_gpio);
670-
671-
tas_priv->irq_info.irq =
672-
gpio_to_irq(tas_priv->irq_info.irq_gpio);
673-
} else
674-
dev_err(tas_priv->dev, "%s: GPIO %d request error\n",
675-
__func__, tas_priv->irq_info.irq_gpio);
676-
} else
677-
dev_err(tas_priv->dev,
678-
"Looking up irq-gpio property failed %d\n",
679-
tas_priv->irq_info.irq_gpio);
680662
}
681663

682664
static int tasdevice_i2c_probe(struct i2c_client *i2c)

0 commit comments

Comments
 (0)