mfd: qcom-spmi-pmic: add support for slow SPMI busses

Add device tree support for configuring if mutexes or spinlocks
should be used in the regmap configuration (i.e. the fast_io
element value).  This ensures that qcom-spmi-pmic slave devices
can be used with SPMI busses that must operate in process
context.

Change-Id: I3abdee36935457db497ce6ff2a242755fc3aff90
Signed-off-by: David Collins <collinsd@codeaurora.org>
This commit is contained in:
David Collins
2017-06-08 17:09:12 -07:00
parent 9a33914e3b
commit af9978ff9f
2 changed files with 15 additions and 2 deletions

View File

@@ -42,6 +42,8 @@ Optional properties for peripheral child nodes:
see:
Documentation/devicetree/bindings/spmi/qcom,spmi-pmic-arb.txt
- interrupt-names: Corresponding interrupt name to the interrupts property
- qcom,can-sleep: Boolean flag indicating that processes waiting on SPMI
transactions may sleep
Each child node of SPMI slave id represents a function of the PMIC. In the
example below the rtc device node represents a peripheral of pm8941

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
* Copyright (c) 2014-2015, 2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -118,12 +118,23 @@ static const struct regmap_config spmi_regmap_config = {
.fast_io = true,
};
static const struct regmap_config spmi_regmap_can_sleep_config = {
.reg_bits = 16,
.val_bits = 8,
.max_register = 0xffff,
.fast_io = false,
};
static int pmic_spmi_probe(struct spmi_device *sdev)
{
struct device_node *root = sdev->dev.of_node;
struct regmap *regmap;
regmap = devm_regmap_init_spmi_ext(sdev, &spmi_regmap_config);
if (of_property_read_bool(root, "qcom,can-sleep"))
regmap = devm_regmap_init_spmi_ext(sdev,
&spmi_regmap_can_sleep_config);
else
regmap = devm_regmap_init_spmi_ext(sdev, &spmi_regmap_config);
if (IS_ERR(regmap))
return PTR_ERR(regmap);