int irq, ret;
unsigned long irqflags;
// 配置中断
drvdata->gpio = devm_gpiod_get(&pdev->dev, NULL, GPIOD_IN);
if (IS_ERR(drvdata->gpio)) {
dev_err(&pdev->dev, "failed to request GPIO\n");
return PTR_ERR(drvdata->gpio);
}
irq = gpiod_to_irq(drvdata->gpio);
irqflags = gpiod_is_active_low(drvdata->gpio) ? IRQF_TRIGGER_FALLING : IRQF_TRIGGER_RISING;
ret = devm_request_irq(&pdev->dev, irq, system_power_irq_handler, irqflags, "system_power", drvdata);
if (ret != 0) {
dev_err(&pdev->dev, "failed to request irq\n");
return ret;
}