Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af287a04 authored by Taniya Das's avatar Taniya Das
Browse files

cpufreq: qcom: Add code to support module removal



Support module remove and cleanup of the OPP table entries. In the case
where the driver registers for IRQ, free the IRQ and also remove the
sysfs.

Change-Id: I090a6e6fbcce4578e186fb8bc33cd68de42b34d8
Signed-off-by: default avatarTaniya Das <tdas@codeaurora.org>
parent aea646dc
Loading
Loading
Loading
Loading
+21 −2
Original line number Diff line number Diff line
@@ -528,14 +528,14 @@ static int qcom_resources_init(struct platform_device *pdev)
	unsigned int cpu;
	int ret;

	clk = devm_clk_get(&pdev->dev, "xo");
	clk = clk_get(&pdev->dev, "xo");
	if (IS_ERR(clk))
		return PTR_ERR(clk);

	xo_rate = clk_get_rate(clk);
	clk_put(clk);

	clk = devm_clk_get(&pdev->dev, "alternate");
	clk = clk_get(&pdev->dev, "alternate");
	if (IS_ERR(clk))
		return PTR_ERR(clk);

@@ -612,6 +612,25 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)

static int qcom_cpufreq_hw_driver_remove(struct platform_device *pdev)
{
	struct cpufreq_qcom *c;
	struct device *cpu_dev;
	int cpu;

	for_each_possible_cpu(cpu) {
		cpu_dev = get_cpu_device(cpu);
		if (!cpu_dev)
			continue;

		dev_pm_opp_remove_all_dynamic(cpu_dev);

		c = qcom_freq_domain_map[cpu];
		if (c->dcvsh_irq > 0 && c->is_irq_requested) {
			devm_free_irq(cpu_dev, c->dcvsh_irq, c);
			device_remove_file(cpu_dev, &c->freq_limit_attr);
			c->is_irq_requested = false;
		}
	}

	return cpufreq_unregister_driver(&cpufreq_qcom_hw_driver);
}