Skip to content

Commit

Permalink
media: hantro: add PM runtime resume callback
Browse files Browse the repository at this point in the history
It seems that on i.MX8MQ the power domain controller does not propagate
resets to the VPU cores on resume. Add a callback to allow implementing
manual reset of the VPU cores after ungating the power domain.

Signed-off-by: Philipp Zabel <[email protected]>
Reviewed-by: Boris Brezillon <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
pH5 authored and mchehab committed Jun 12, 2019
1 parent 0b67596 commit 0fd7ada
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/staging/media/hantro/hantro.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ struct hantro_codec_ops;
* @codec: Supported codecs
* @codec_ops: Codec ops.
* @init: Initialize hardware.
* @runtime_resume: reenable hardware after power gating
* @vepu_irq: encoder interrupt handler
* @vdpu_irq: decoder interrupt handler
* @clk_names: array of clock names
Expand All @@ -71,6 +72,7 @@ struct hantro_variant {
unsigned int codec;
const struct hantro_codec_ops *codec_ops;
int (*init)(struct hantro_dev *vpu);
int (*runtime_resume)(struct hantro_dev *vpu);
irqreturn_t (*vepu_irq)(int irq, void *priv);
irqreturn_t (*vdpu_irq)(int irq, void *priv);
const char *clk_names[HANTRO_MAX_CLOCKS];
Expand Down
13 changes: 13 additions & 0 deletions drivers/staging/media/hantro/hantro_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -832,9 +832,22 @@ static int hantro_remove(struct platform_device *pdev)
return 0;
}

#ifdef CONFIG_PM
static int hantro_runtime_resume(struct device *dev)
{
struct hantro_dev *vpu = dev_get_drvdata(dev);

if (vpu->variant->runtime_resume)
return vpu->variant->runtime_resume(vpu);

return 0;
}
#endif

static const struct dev_pm_ops hantro_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
pm_runtime_force_resume)
SET_RUNTIME_PM_OPS(NULL, hantro_runtime_resume, NULL)
};

static struct platform_driver hantro_driver = {
Expand Down

0 comments on commit 0fd7ada

Please sign in to comment.