Commit 90078e63 authored by Alex Elder's avatar Alex Elder Committed by Jakub Kicinski

net: ipa: use interconnect bulk enable/disable operations

The power interconnect array is now an array of icc_bulk_data
structures, which is what the interconnect bulk enable and disable
functions require.

Get rid of ipa_interconnect_enable() and ipa_interconnect_disable(),
and just call icc_bulk_enable() and icc_bulk_disable() instead.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 9dd50068
......@@ -156,86 +156,34 @@ static void ipa_interconnect_exit(struct ipa_power *power)
power->interconnect = NULL;
}
/* Currently we only use one bandwidth level, so just "enable" interconnects */
static int ipa_interconnect_enable(struct ipa *ipa)
{
struct icc_bulk_data *interconnect;
struct ipa_power *power = ipa->power;
int ret;
u32 i;
interconnect = power->interconnect;
for (i = 0; i < power->interconnect_count; i++) {
ret = icc_enable(interconnect->path);
if (ret) {
dev_err(&ipa->pdev->dev,
"error %d enabling %s interconnect\n",
ret, interconnect->name);
goto out_unwind;
}
interconnect++;
}
return 0;
out_unwind:
while (interconnect-- > power->interconnect)
(void)icc_disable(interconnect->path);
return ret;
}
/* To disable an interconnect, we just its bandwidth to 0 */
static int ipa_interconnect_disable(struct ipa *ipa)
{
struct ipa_power *power = ipa->power;
struct device *dev = &ipa->pdev->dev;
struct icc_bulk_data *interconnect;
int result = 0;
u32 count;
int ret;
count = power->interconnect_count;
interconnect = power->interconnect + count;
while (count--) {
interconnect--;
ret = icc_disable(interconnect->path);
if (ret) {
dev_err(dev, "error %d disabling %s interconnect\n",
ret, interconnect->name);
/* Try to disable all; record only the first error */
if (!result)
result = ret;
}
}
return result;
}
/* Enable IPA power, enabling interconnects and the core clock */
static int ipa_power_enable(struct ipa *ipa)
{
struct ipa_power *power = ipa->power;
int ret;
ret = ipa_interconnect_enable(ipa);
ret = icc_bulk_enable(power->interconnect_count, power->interconnect);
if (ret)
return ret;
ret = clk_prepare_enable(ipa->power->core);
ret = clk_prepare_enable(power->core);
if (ret) {
dev_err(&ipa->pdev->dev, "error %d enabling core clock\n", ret);
(void)ipa_interconnect_disable(ipa);
icc_bulk_disable(power->interconnect_count,
power->interconnect);
}
return ret;
}
/* Inverse of ipa_power_enable() */
static int ipa_power_disable(struct ipa *ipa)
static void ipa_power_disable(struct ipa *ipa)
{
clk_disable_unprepare(ipa->power->core);
struct ipa_power *power = ipa->power;
clk_disable_unprepare(power->core);
return ipa_interconnect_disable(ipa);
icc_bulk_disable(power->interconnect_count, power->interconnect);
}
static int ipa_runtime_suspend(struct device *dev)
......@@ -249,7 +197,9 @@ static int ipa_runtime_suspend(struct device *dev)
gsi_suspend(&ipa->gsi);
}
return ipa_power_disable(ipa);
ipa_power_disable(ipa);
return 0;
}
static int ipa_runtime_resume(struct device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment