1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/media/platform/mediatek/mdp/mtk_mdp_comp.c
Rob Herring 7c7e33b799 media: Explicitly include correct DT includes
The DT of_device.h and of_platform.h date back to the separate
of_platform_bus_type before it as merged into the regular platform bus.
As part of that merge prepping Arm DT support 13 years ago, they
"temporarily" include each other. They also include platform_device.h
and of.h. As a result, there's a pretty much random mix of those include
files used throughout the tree. In order to detangle these headers and
replace the implicit includes with struct declarations, users need to
explicitly include the correct includes.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-07-19 12:57:51 +02:00

74 lines
1.5 KiB
C

// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016 MediaTek Inc.
* Author: Ming Hsiu Tsai <minghsiu.tsai@mediatek.com>
*/
#include <linux/clk.h>
#include <linux/device.h>
#include <linux/of.h>
#include "mtk_mdp_comp.h"
void mtk_mdp_comp_clock_on(struct device *dev, struct mtk_mdp_comp *comp)
{
int i, err;
for (i = 0; i < ARRAY_SIZE(comp->clk); i++) {
if (IS_ERR(comp->clk[i]))
continue;
err = clk_prepare_enable(comp->clk[i]);
if (err)
dev_err(dev,
"failed to enable clock, err %d. type:%d i:%d\n",
err, comp->type, i);
}
}
void mtk_mdp_comp_clock_off(struct device *dev, struct mtk_mdp_comp *comp)
{
int i;
for (i = 0; i < ARRAY_SIZE(comp->clk); i++) {
if (IS_ERR(comp->clk[i]))
continue;
clk_disable_unprepare(comp->clk[i]);
}
}
int mtk_mdp_comp_init(struct device *dev, struct device_node *node,
struct mtk_mdp_comp *comp,
enum mtk_mdp_comp_type comp_type)
{
int ret;
int i;
comp->dev_node = of_node_get(node);
comp->type = comp_type;
for (i = 0; i < ARRAY_SIZE(comp->clk); i++) {
comp->clk[i] = of_clk_get(node, i);
if (IS_ERR(comp->clk[i])) {
ret = dev_err_probe(dev, PTR_ERR(comp->clk[i]),
"Failed to get clock\n");
goto put_dev;
}
/* Only RDMA needs two clocks */
if (comp->type != MTK_MDP_RDMA)
break;
}
return 0;
put_dev:
of_node_put(comp->dev_node);
return ret;
}
void mtk_mdp_comp_deinit(struct device *dev, struct mtk_mdp_comp *comp)
{
of_node_put(comp->dev_node);
}