Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f049b524 authored by David Collins's avatar David Collins
Browse files

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: default avatarDavid Collins <collinsd@codeaurora.org>
parent f1ad0348
Loading
Loading
Loading
Loading
+28 −17
Original line number Diff line number Diff line
@@ -1392,11 +1392,13 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
		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);
	if (err) {
@@ -1455,6 +1457,7 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
		}
	}

	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);
@@ -1464,8 +1467,12 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
			goto err_put_ctrl;
		}

	irq_set_chained_handler_and_data(pmic_arb->irq, pmic_arb_chained_irq,
					pmic_arb);
		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");
	}

	err = spmi_controller_add(ctrl);
	if (err)
		goto err_domain_remove;
@@ -1473,8 +1480,10 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
	return 0;

err_domain_remove:
	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;
@@ -1485,8 +1494,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);
	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;
}