mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
ASoC: tas2781-i2c: Drop weird GPIO code
[ Upstream commit c2c0b67dca3cb3b3cea0dd60075a1c5ba77e2fcd ]
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: ef3bcde75d
("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>
This commit is contained in:
parent
ac7976b672
commit
92b53ece5d
5 changed files with 5 additions and 32 deletions
|
@ -78,11 +78,6 @@ struct tasdevice {
|
||||||
bool is_loaderr;
|
bool is_loaderr;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tasdevice_irqinfo {
|
|
||||||
int irq_gpio;
|
|
||||||
int irq;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct calidata {
|
struct calidata {
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
unsigned long total_sz;
|
unsigned long total_sz;
|
||||||
|
@ -90,7 +85,6 @@ struct calidata {
|
||||||
|
|
||||||
struct tasdevice_priv {
|
struct tasdevice_priv {
|
||||||
struct tasdevice tasdevice[TASDEVICE_MAX_CHANNELS];
|
struct tasdevice tasdevice[TASDEVICE_MAX_CHANNELS];
|
||||||
struct tasdevice_irqinfo irq_info;
|
|
||||||
struct tasdevice_rca rcabin;
|
struct tasdevice_rca rcabin;
|
||||||
struct calidata cali_data;
|
struct calidata cali_data;
|
||||||
struct tasdevice_fw *fmw;
|
struct tasdevice_fw *fmw;
|
||||||
|
@ -111,6 +105,7 @@ struct tasdevice_priv {
|
||||||
unsigned int chip_id;
|
unsigned int chip_id;
|
||||||
unsigned int sysclk;
|
unsigned int sysclk;
|
||||||
|
|
||||||
|
int irq;
|
||||||
int cur_prog;
|
int cur_prog;
|
||||||
int cur_conf;
|
int cur_conf;
|
||||||
int fw_state;
|
int fw_state;
|
||||||
|
|
|
@ -710,7 +710,7 @@ static int tas2781_hda_i2c_probe(struct i2c_client *clt)
|
||||||
} else
|
} else
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
tas_hda->priv->irq_info.irq = clt->irq;
|
tas_hda->priv->irq = clt->irq;
|
||||||
ret = tas2781_read_acpi(tas_hda->priv, device_name);
|
ret = tas2781_read_acpi(tas_hda->priv, device_name);
|
||||||
if (ret)
|
if (ret)
|
||||||
return dev_err_probe(tas_hda->dev, ret,
|
return dev_err_probe(tas_hda->dev, ret,
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <linux/of_gpio.h>
|
|
||||||
#include <linux/of_irq.h>
|
#include <linux/of_irq.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
@ -406,8 +405,6 @@ EXPORT_SYMBOL_GPL(tasdevice_dsp_remove);
|
||||||
|
|
||||||
void tasdevice_remove(struct tasdevice_priv *tas_priv)
|
void tasdevice_remove(struct tasdevice_priv *tas_priv)
|
||||||
{
|
{
|
||||||
if (gpio_is_valid(tas_priv->irq_info.irq_gpio))
|
|
||||||
gpio_free(tas_priv->irq_info.irq_gpio);
|
|
||||||
mutex_destroy(&tas_priv->codec_lock);
|
mutex_destroy(&tas_priv->codec_lock);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(tasdevice_remove);
|
EXPORT_SYMBOL_GPL(tasdevice_remove);
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <linux/of_gpio.h>
|
|
||||||
#include <linux/of_irq.h>
|
#include <linux/of_irq.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <linux/of_address.h>
|
#include <linux/of_address.h>
|
||||||
#include <linux/of_gpio.h>
|
|
||||||
#include <linux/of_irq.h>
|
#include <linux/of_irq.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
@ -617,7 +616,7 @@ static void tasdevice_parse_dt(struct tasdevice_priv *tas_priv)
|
||||||
{
|
{
|
||||||
struct i2c_client *client = (struct i2c_client *)tas_priv->client;
|
struct i2c_client *client = (struct i2c_client *)tas_priv->client;
|
||||||
unsigned int dev_addrs[TASDEVICE_MAX_CHANNELS];
|
unsigned int dev_addrs[TASDEVICE_MAX_CHANNELS];
|
||||||
int rc, i, ndev = 0;
|
int i, ndev = 0;
|
||||||
|
|
||||||
if (tas_priv->isacpi) {
|
if (tas_priv->isacpi) {
|
||||||
ndev = device_property_read_u32_array(&client->dev,
|
ndev = device_property_read_u32_array(&client->dev,
|
||||||
|
@ -632,7 +631,7 @@ static void tasdevice_parse_dt(struct tasdevice_priv *tas_priv)
|
||||||
"ti,audio-slots", dev_addrs, ndev);
|
"ti,audio-slots", dev_addrs, ndev);
|
||||||
}
|
}
|
||||||
|
|
||||||
tas_priv->irq_info.irq_gpio =
|
tas_priv->irq =
|
||||||
acpi_dev_gpio_irq_get(ACPI_COMPANION(&client->dev), 0);
|
acpi_dev_gpio_irq_get(ACPI_COMPANION(&client->dev), 0);
|
||||||
} else if (IS_ENABLED(CONFIG_OF)) {
|
} else if (IS_ENABLED(CONFIG_OF)) {
|
||||||
struct device_node *np = tas_priv->dev->of_node;
|
struct device_node *np = tas_priv->dev->of_node;
|
||||||
|
@ -644,7 +643,7 @@ static void tasdevice_parse_dt(struct tasdevice_priv *tas_priv)
|
||||||
dev_addrs[ndev++] = addr;
|
dev_addrs[ndev++] = addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
tas_priv->irq_info.irq_gpio = of_irq_get(np, 0);
|
tas_priv->irq = of_irq_get(np, 0);
|
||||||
} else {
|
} else {
|
||||||
ndev = 1;
|
ndev = 1;
|
||||||
dev_addrs[0] = client->addr;
|
dev_addrs[0] = client->addr;
|
||||||
|
@ -660,23 +659,6 @@ static void tasdevice_parse_dt(struct tasdevice_priv *tas_priv)
|
||||||
__func__);
|
__func__);
|
||||||
|
|
||||||
strcpy(tas_priv->dev_name, tasdevice_id[tas_priv->chip_id].name);
|
strcpy(tas_priv->dev_name, tasdevice_id[tas_priv->chip_id].name);
|
||||||
|
|
||||||
if (gpio_is_valid(tas_priv->irq_info.irq_gpio)) {
|
|
||||||
rc = gpio_request(tas_priv->irq_info.irq_gpio,
|
|
||||||
"AUDEV-IRQ");
|
|
||||||
if (!rc) {
|
|
||||||
gpio_direction_input(
|
|
||||||
tas_priv->irq_info.irq_gpio);
|
|
||||||
|
|
||||||
tas_priv->irq_info.irq =
|
|
||||||
gpio_to_irq(tas_priv->irq_info.irq_gpio);
|
|
||||||
} else
|
|
||||||
dev_err(tas_priv->dev, "%s: GPIO %d request error\n",
|
|
||||||
__func__, tas_priv->irq_info.irq_gpio);
|
|
||||||
} else
|
|
||||||
dev_err(tas_priv->dev,
|
|
||||||
"Looking up irq-gpio property failed %d\n",
|
|
||||||
tas_priv->irq_info.irq_gpio);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tasdevice_i2c_probe(struct i2c_client *i2c)
|
static int tasdevice_i2c_probe(struct i2c_client *i2c)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue