Skip to content

Commit

Permalink
extcon: usbc-tusb320: Set interrupt polarity based on device-tree
Browse files Browse the repository at this point in the history
Remove 'IRQF_TRIGGER_FALLING' request which is not allowed on
every interrupt controller (i.e. arm64 GIC). Replace flag by a
request that depends on the actual device-tree setting.

Link: https://lore.kernel.org/all/[email protected]/
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Signed-off-by: Lukas Funke <[email protected]>
Signed-off-by: Chanwoo Choi <[email protected]>
  • Loading branch information
luckyfunky authored and chanwoochoi committed Dec 5, 2023
1 parent e66523c commit d03a700
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/extcon/extcon-usbc-tusb320.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <linux/usb/typec.h>
#include <linux/usb/typec_altmode.h>
#include <linux/usb/role.h>
#include <linux/irq.h>

#define TUSB320_REG8 0x8
#define TUSB320_REG8_CURRENT_MODE_ADVERTISE GENMASK(7, 6)
Expand Down Expand Up @@ -515,6 +516,8 @@ static int tusb320_probe(struct i2c_client *client)
const void *match_data;
unsigned int revision;
int ret;
u32 irq_trigger_type = IRQF_TRIGGER_FALLING;
struct irq_data *irq_d;

priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
Expand Down Expand Up @@ -568,9 +571,13 @@ static int tusb320_probe(struct i2c_client *client)
*/
tusb320_state_update_handler(priv, true);

irq_d = irq_get_irq_data(client->irq);
if (irq_d)
irq_trigger_type = irqd_get_trigger_type(irq_d);

ret = devm_request_threaded_irq(priv->dev, client->irq, NULL,
tusb320_irq_handler,
IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
IRQF_ONESHOT | irq_trigger_type,
client->name, priv);
if (ret)
tusb320_typec_remove(priv);
Expand Down

0 comments on commit d03a700

Please sign in to comment.