2022-02-05 18:57:22

by Alex Elder

[permalink] [raw]
Subject: [PATCH net-next 3/7] 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: Alex Elder <[email protected]>
---
drivers/net/ipa/ipa_power.c | 76 +++++++------------------------------
1 file changed, 13 insertions(+), 63 deletions(-)

diff --git a/drivers/net/ipa/ipa_power.c b/drivers/net/ipa/ipa_power.c
index ec2ebc74edb8b..67f76e6a6ae59 100644
--- a/drivers/net/ipa/ipa_power.c
+++ b/drivers/net/ipa/ipa_power.c
@@ -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;

- return ipa_interconnect_disable(ipa);
+ clk_disable_unprepare(power->core);
+
+ 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)
--
2.32.0



2022-02-07 14:46:26

by Alex Elder

[permalink] [raw]
Subject: Re: [PATCH net-next 3/7] net: ipa: use interconnect bulk enable/disable operations

On 2/4/22 10:23 PM, Jakub Kicinski wrote:
> On Fri, 4 Feb 2022 13:50:40 -0600 Alex Elder wrote:
>> 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: Alex Elder <[email protected]>
>
> We got a kbuild bot complaint here, for some reason off-list.
> Let me drop it from PW for now.

OK. I guess the interconnect code isn't ready for COMPILE_TEST.
I'll investigate that a little more and if we can get past that
I'll send out a new version. Not sure how long that will take
though...

Thanks, I retract this series for now.

-Alex

2022-02-08 03:19:50

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH net-next 3/7] net: ipa: use interconnect bulk enable/disable operations

On Fri, 4 Feb 2022 13:50:40 -0600 Alex Elder wrote:
> 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: Alex Elder <[email protected]>

We got a kbuild bot complaint here, for some reason off-list.
Let me drop it from PW for now.