mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 17:30:02 +00:00
media: imx-jpeg: Apply clk_bulk api instead of operating specific clk
using the api of clk_bulk can simplify the code.
and the clock of the jpeg codec may be changed,
the clk_bulk api can be compatible with the future change.
Fixes: 4c2e5156d9
("media: imx-jpeg: Add pm-runtime support for imx-jpeg")
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
c07e734b7a
commit
61fe43dc9f
2 changed files with 10 additions and 29 deletions
|
@ -2472,19 +2472,12 @@ static int mxc_jpeg_probe(struct platform_device *pdev)
|
|||
jpeg->mode = mode;
|
||||
|
||||
/* Get clocks */
|
||||
jpeg->clk_ipg = devm_clk_get(dev, "ipg");
|
||||
if (IS_ERR(jpeg->clk_ipg)) {
|
||||
dev_err(dev, "failed to get clock: ipg\n");
|
||||
ret = PTR_ERR(jpeg->clk_ipg);
|
||||
goto err_clk;
|
||||
}
|
||||
|
||||
jpeg->clk_per = devm_clk_get(dev, "per");
|
||||
if (IS_ERR(jpeg->clk_per)) {
|
||||
dev_err(dev, "failed to get clock: per\n");
|
||||
ret = PTR_ERR(jpeg->clk_per);
|
||||
ret = devm_clk_bulk_get_all(&pdev->dev, &jpeg->clks);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "failed to get clock\n");
|
||||
goto err_clk;
|
||||
}
|
||||
jpeg->num_clks = ret;
|
||||
|
||||
ret = mxc_jpeg_attach_pm_domains(jpeg);
|
||||
if (ret < 0) {
|
||||
|
@ -2581,32 +2574,20 @@ static int mxc_jpeg_runtime_resume(struct device *dev)
|
|||
struct mxc_jpeg_dev *jpeg = dev_get_drvdata(dev);
|
||||
int ret;
|
||||
|
||||
ret = clk_prepare_enable(jpeg->clk_ipg);
|
||||
ret = clk_bulk_prepare_enable(jpeg->num_clks, jpeg->clks);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "failed to enable clock: ipg\n");
|
||||
goto err_ipg;
|
||||
}
|
||||
|
||||
ret = clk_prepare_enable(jpeg->clk_per);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "failed to enable clock: per\n");
|
||||
goto err_per;
|
||||
dev_err(dev, "failed to enable clock\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_per:
|
||||
clk_disable_unprepare(jpeg->clk_ipg);
|
||||
err_ipg:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int mxc_jpeg_runtime_suspend(struct device *dev)
|
||||
{
|
||||
struct mxc_jpeg_dev *jpeg = dev_get_drvdata(dev);
|
||||
|
||||
clk_disable_unprepare(jpeg->clk_ipg);
|
||||
clk_disable_unprepare(jpeg->clk_per);
|
||||
clk_bulk_disable_unprepare(jpeg->num_clks, jpeg->clks);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -120,8 +120,8 @@ struct mxc_jpeg_dev {
|
|||
spinlock_t hw_lock; /* hardware access lock */
|
||||
unsigned int mode;
|
||||
struct mutex lock; /* v4l2 ioctls serialization */
|
||||
struct clk *clk_ipg;
|
||||
struct clk *clk_per;
|
||||
struct clk_bulk_data *clks;
|
||||
int num_clks;
|
||||
struct platform_device *pdev;
|
||||
struct device *dev;
|
||||
void __iomem *base_reg;
|
||||
|
|
Loading…
Reference in a new issue