mirror of
https://github.com/torvalds/linux.git
synced 2026-07-31 11:37:06 +02:00
spmi: spmi-pmic-arb: make interrupt support optional
Make the support of PMIC peripheral interrupts optional for spmi-pmic-arb devices. This is useful in situations where SPMI address mapping is required without the need for IRQ support. Change-Id: Ifdacf9b992d80c8ab561917fc4eb4816b8b9c8ff Signed-off-by: David Collins <collinsd@codeaurora.org>
This commit is contained in:
parent
f7e43675d4
commit
7f31491db4
|
|
@ -1494,10 +1494,12 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
|
|||
goto err_put_ctrl;
|
||||
}
|
||||
|
||||
pmic_arb->irq = platform_get_irq_byname(pdev, "periph_irq");
|
||||
if (pmic_arb->irq < 0) {
|
||||
err = pmic_arb->irq;
|
||||
goto err_put_ctrl;
|
||||
if (of_find_property(pdev->dev.of_node, "interrupt-names", NULL)) {
|
||||
pmic_arb->irq = platform_get_irq_byname(pdev, "periph_irq");
|
||||
if (pmic_arb->irq < 0) {
|
||||
err = pmic_arb->irq;
|
||||
goto err_put_ctrl;
|
||||
}
|
||||
}
|
||||
|
||||
err = of_property_read_u32(pdev->dev.of_node, "qcom,channel", &channel);
|
||||
|
|
@ -1557,17 +1559,22 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
|
|||
}
|
||||
}
|
||||
|
||||
dev_dbg(&pdev->dev, "adding irq domain\n");
|
||||
pmic_arb->domain = irq_domain_add_tree(pdev->dev.of_node,
|
||||
&pmic_arb_irq_domain_ops, pmic_arb);
|
||||
if (!pmic_arb->domain) {
|
||||
dev_err(&pdev->dev, "unable to create irq_domain\n");
|
||||
err = -ENOMEM;
|
||||
goto err_put_ctrl;
|
||||
if (pmic_arb->irq > 0) {
|
||||
dev_dbg(&pdev->dev, "adding irq domain\n");
|
||||
pmic_arb->domain = irq_domain_add_tree(pdev->dev.of_node,
|
||||
&pmic_arb_irq_domain_ops, pmic_arb);
|
||||
if (!pmic_arb->domain) {
|
||||
dev_err(&pdev->dev, "unable to create irq_domain\n");
|
||||
err = -ENOMEM;
|
||||
goto err_put_ctrl;
|
||||
}
|
||||
|
||||
irq_set_chained_handler_and_data(pmic_arb->irq,
|
||||
pmic_arb_chained_irq, pmic_arb);
|
||||
} else {
|
||||
dev_dbg(&pdev->dev, "not supporting PMIC interrupts\n");
|
||||
}
|
||||
|
||||
irq_set_chained_handler_and_data(pmic_arb->irq, pmic_arb_chained_irq,
|
||||
pmic_arb);
|
||||
err = spmi_controller_add(ctrl);
|
||||
if (err)
|
||||
goto err_domain_remove;
|
||||
|
|
@ -1575,8 +1582,10 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
|
|||
return 0;
|
||||
|
||||
err_domain_remove:
|
||||
irq_set_chained_handler_and_data(pmic_arb->irq, NULL, NULL);
|
||||
irq_domain_remove(pmic_arb->domain);
|
||||
if (pmic_arb->irq > 0) {
|
||||
irq_set_chained_handler_and_data(pmic_arb->irq, NULL, NULL);
|
||||
irq_domain_remove(pmic_arb->domain);
|
||||
}
|
||||
err_put_ctrl:
|
||||
spmi_controller_put(ctrl);
|
||||
return err;
|
||||
|
|
@ -1587,8 +1596,10 @@ static int spmi_pmic_arb_remove(struct platform_device *pdev)
|
|||
struct spmi_controller *ctrl = platform_get_drvdata(pdev);
|
||||
struct spmi_pmic_arb *pmic_arb = spmi_controller_get_drvdata(ctrl);
|
||||
spmi_controller_remove(ctrl);
|
||||
irq_set_chained_handler_and_data(pmic_arb->irq, NULL, NULL);
|
||||
irq_domain_remove(pmic_arb->domain);
|
||||
if (pmic_arb->irq > 0) {
|
||||
irq_set_chained_handler_and_data(pmic_arb->irq, NULL, NULL);
|
||||
irq_domain_remove(pmic_arb->domain);
|
||||
}
|
||||
spmi_controller_put(ctrl);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user