[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a0722696-bc66-3841-0ab1-0108b4f33d9f@codeaurora.org>
Date: Wed, 29 Apr 2020 19:51:02 +0530
From: Rajendra Nayak <rnayak@...eaurora.org>
To: Matthias Kaehlcke <mka@...omium.org>
Cc: viresh.kumar@...aro.org, sboyd@...nel.org,
bjorn.andersson@...aro.org, agross@...nel.org,
linux-arm-msm@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, Mark Brown <broonie@...nel.org>,
Alok Chauhan <alokc@...eaurora.org>,
Akash Asthana <akashast@...eaurora.org>,
linux-spi@...r.kernel.org
Subject: Re: [PATCH v3 15/17] spi: spi-qcom-qspi: Use OPP API to set clk/perf
state
On 4/29/2020 6:19 AM, Matthias Kaehlcke wrote:
> Hi,
>
> On Tue, Apr 28, 2020 at 07:03:03PM +0530, Rajendra Nayak wrote:
>> QSPI needs to vote on a performance state of a power domain depending on
>> the clock rate. Add support for it by specifying the perf state/clock rate
>> as an OPP table in device tree.
>>
>> Signed-off-by: Rajendra Nayak <rnayak@...eaurora.org>
>> Cc: Mark Brown <broonie@...nel.org>
>> Cc: Alok Chauhan <alokc@...eaurora.org>
>> Cc: Akash Asthana <akashast@...eaurora.org>
>> Cc: linux-spi@...r.kernel.org
>> ---
>> drivers/spi/spi-qcom-qspi.c | 29 ++++++++++++++++++++++++++++-
>> 1 file changed, 28 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/spi/spi-qcom-qspi.c b/drivers/spi/spi-qcom-qspi.c
>> index 3c4f83b..724a658 100644
>> --- a/drivers/spi/spi-qcom-qspi.c
>> +++ b/drivers/spi/spi-qcom-qspi.c
>> @@ -8,6 +8,7 @@
>> #include <linux/of.h>
>> #include <linux/of_platform.h>
>> #include <linux/pm_runtime.h>
>> +#include <linux/pm_opp.h>
>> #include <linux/spi/spi.h>
>> #include <linux/spi/spi-mem.h>
>>
>> @@ -139,6 +140,8 @@ struct qcom_qspi {
>> struct device *dev;
>> struct clk_bulk_data *clks;
>> struct qspi_xfer xfer;
>> + struct opp_table *opp_table;
>> + bool has_opp_table;
>> /* Lock to protect xfer and IRQ accessed registers */
>> spinlock_t lock;
>> };
>> @@ -235,7 +238,7 @@ static int qcom_qspi_transfer_one(struct spi_master *master,
>> speed_hz = xfer->speed_hz;
>>
>> /* In regular operation (SBL_EN=1) core must be 4x transfer clock */
>> - ret = clk_set_rate(ctrl->clks[QSPI_CLK_CORE].clk, speed_hz * 4);
>> + ret = dev_pm_opp_set_rate(ctrl->dev, speed_hz * 4);
>> if (ret) {
>> dev_err(ctrl->dev, "Failed to set core clk %d\n", ret);
>> return ret;
>> @@ -481,6 +484,20 @@ static int qcom_qspi_probe(struct platform_device *pdev)
>> master->handle_err = qcom_qspi_handle_err;
>> master->auto_runtime_pm = true;
>>
>> + ctrl->opp_table = dev_pm_opp_set_clkname(&pdev->dev, "core");
>> + if (IS_ERR(ctrl->opp_table)) {
>> + ret = PTR_ERR(ctrl->opp_table);
>> + goto exit_probe_master_put;
>> + }
>> + /* OPP table is optional */
>> + ret = dev_pm_opp_of_add_table(&pdev->dev);
>> + if (!ret) {
>> + ctrl->has_opp_table = true;
>> + } else if (ret != -ENODEV) {
>> + dev_err(&pdev->dev, "Invalid OPP table in Device tree\n");
>> + return ret;
>
> goto exit_probe_master_put;
thanks for catching this. will fix and respin.
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
Powered by blists - more mailing lists