Skip to content

Commit 2d68148

Browse files
Srinivasa Rao Mandadapubroonie
authored andcommitted
ASoC: qcom: lpass-sc7180: Add system suspend/resume PM ops
Update lpass sc7180 platform driver with PM ops, such as system supend and resume callbacks. This update is required to disable clocks during supend and avoid XO shutdown issue. Signed-off-by: Srinivasa Rao Mandadapu <[email protected]> Tested-by: Rahul Ajmeriya <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 5fabcc9 commit 2d68148

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

sound/soc/qcom/lpass-sc7180.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/module.h>
1313
#include <linux/of.h>
1414
#include <linux/platform_device.h>
15+
#include <linux/pm_runtime.h>
1516
#include <dt-bindings/sound/sc7180-lpass.h>
1617
#include <sound/pcm.h>
1718
#include <sound/soc.h>
@@ -159,10 +160,34 @@ static int sc7180_lpass_exit(struct platform_device *pdev)
159160
struct lpass_data *drvdata = platform_get_drvdata(pdev);
160161

161162
clk_bulk_disable_unprepare(drvdata->num_clks, drvdata->clks);
163+
return 0;
164+
}
165+
166+
static int sc7180_lpass_dev_resume(struct device *dev)
167+
{
168+
int ret = 0;
169+
struct lpass_data *drvdata = dev_get_drvdata(dev);
162170

171+
ret = clk_bulk_prepare_enable(drvdata->num_clks, drvdata->clks);
172+
if (ret) {
173+
dev_err(dev, "sc7180 clk prepare and enable failed\n");
174+
return ret;
175+
}
176+
return ret;
177+
}
178+
179+
static int sc7180_lpass_dev_suspend(struct device *dev)
180+
{
181+
struct lpass_data *drvdata = dev_get_drvdata(dev);
182+
183+
clk_bulk_disable_unprepare(drvdata->num_clks, drvdata->clks);
163184
return 0;
164185
}
165186

187+
static const struct dev_pm_ops sc7180_lpass_pm_ops = {
188+
SET_SYSTEM_SLEEP_PM_OPS(sc7180_lpass_dev_suspend, sc7180_lpass_dev_resume)
189+
};
190+
166191
static struct lpass_variant sc7180_data = {
167192
.i2sctrl_reg_base = 0x1000,
168193
.i2sctrl_reg_stride = 0x1000,
@@ -296,6 +321,7 @@ static struct platform_driver sc7180_lpass_cpu_platform_driver = {
296321
.driver = {
297322
.name = "sc7180-lpass-cpu",
298323
.of_match_table = of_match_ptr(sc7180_lpass_cpu_device_id),
324+
.pm = &sc7180_lpass_pm_ops,
299325
},
300326
.probe = asoc_qcom_lpass_cpu_platform_probe,
301327
.remove = asoc_qcom_lpass_cpu_platform_remove,

0 commit comments

Comments
 (0)