From 47335704fb8354816586c72c192a19cda214d829 Mon Sep 17 00:00:00 2001 From: David Dai Date: Wed, 25 May 2016 14:37:00 -0700 Subject: [PATCH] dev_freq: devfreq_spdm: make cci_clk optional indicator Enable dev_freq SPDM support in order to increase BIMC vote based on bus rejection rate. Make cci_clk an optional property as it's not always a relevant indicator of cpu performance. CRs-Fixed: 1025515 Change-Id: I713cc396c8d563735981547e0dc18a63f6f15180 Signed-off-by: David Dai --- Documentation/devicetree/bindings/devfreq/devfreq-spdm.txt | 8 +++++--- drivers/devfreq/devfreq_spdm.c | 11 +++++++---- drivers/devfreq/governor_spdm_bw_hyp.c | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Documentation/devicetree/bindings/devfreq/devfreq-spdm.txt b/Documentation/devicetree/bindings/devfreq/devfreq-spdm.txt index 16303f769d42..1f0d0a0db20e 100644 --- a/Documentation/devicetree/bindings/devfreq/devfreq-spdm.txt +++ b/Documentation/devicetree/bindings/devfreq/devfreq-spdm.txt @@ -6,9 +6,6 @@ hardware to measure the traffic status of configured master ports on the bus. Required properties: -compatible: Must be "qcom,devfreq_spdm" --clock-names: Clocks used to measure current bus frequency. - Expected names are "cci_clk" --clocks: References to named clocks -qcom,spdm-client: Client id of the port being monitored -qcom,bw-upstep: Initial up vote size in MB/s -qcom,bw-dwnstep: Initial down vote size in MB/s @@ -31,6 +28,11 @@ Required properties: -qcom,up-step-multp: used to increase rate of growth on up votes -qcom,spdm-interval: down-vote polling interval +Optional properties: +-clock-names: Clocks used to measure current bus frequency. + Expected names are "cci_clk" +-clocks: References to named clocks + Example: devfreq_spdm_cpu { compatible = "qcom,devfreq_spdm"; diff --git a/drivers/devfreq/devfreq_spdm.c b/drivers/devfreq/devfreq_spdm.c index f8ef5eda08ea..8e35570e0443 100644 --- a/drivers/devfreq/devfreq_spdm.c +++ b/drivers/devfreq/devfreq_spdm.c @@ -70,7 +70,12 @@ static int change_bw(struct device *dev, unsigned long *freq, u32 flags) update_thresholds: desc.arg[0] = SPDM_CMD_ENABLE; desc.arg[1] = data->spdm_client; - desc.arg[2] = (clk_get_rate(data->cci_clk)) / 1000; + + if (data->cci_clk) + desc.arg[2] = (clk_get_rate(data->cci_clk)) / 1000; + else + desc.arg[2] = 0; + ext_status = spdm_ext_call(&desc, 3); if (ext_status) pr_err("External command %u failed with error %u", @@ -339,8 +344,7 @@ static int probe(struct platform_device *pdev) data->cci_clk = clk_get(&pdev->dev, "cci_clk"); if (IS_ERR(data->cci_clk)) { - ret = PTR_ERR(data->cci_clk); - goto no_clock; + data->cci_clk = NULL; } data->profile = @@ -376,7 +380,6 @@ static int probe(struct platform_device *pdev) no_spdm_device: devm_kfree(&pdev->dev, data->profile); no_profile: -no_clock: msm_bus_scale_unregister_client(data->bus_scale_client_id); no_bus_scaling: devm_kfree(&pdev->dev, data->config_data.ports); diff --git a/drivers/devfreq/governor_spdm_bw_hyp.c b/drivers/devfreq/governor_spdm_bw_hyp.c index e5e179931811..cd068a3097ce 100644 --- a/drivers/devfreq/governor_spdm_bw_hyp.c +++ b/drivers/devfreq/governor_spdm_bw_hyp.c @@ -361,7 +361,7 @@ static int probe(struct platform_device *pdev) *irq = platform_get_irq_byname(pdev, "spdm-irq"); ret = request_threaded_irq(*irq, isr, threaded_isr, - IRQF_TRIGGER_HIGH | IRQF_ONESHOT, + IRQF_ONESHOT, spdm_hyp_gov.name, pdev); if (ret) goto no_irq; -- 2.11.0