Commit e1e4f7fe authored by CK Hu's avatar CK Hu Committed by Chun-Kuang Hu

soc / drm: mediatek: Move mtk mutex driver to soc folder

mtk mutex is used by DRM and MDP driver, and its function is SoC-specific,
so move it to soc folder.
Signed-off-by: default avatarCK Hu <ck.hu@mediatek.com>
Signed-off-by: default avatarChun-Kuang Hu <chunkuang.hu@kernel.org>
Acked-by: default avatarMatthias Brugger <matthias.bgg@gmail.com>
parent 42a090b8
...@@ -9,8 +9,7 @@ mediatek-drm-y := mtk_disp_color.o \ ...@@ -9,8 +9,7 @@ mediatek-drm-y := mtk_disp_color.o \
mtk_drm_gem.o \ mtk_drm_gem.o \
mtk_drm_plane.o \ mtk_drm_plane.o \
mtk_dsi.o \ mtk_dsi.o \
mtk_dpi.o \ mtk_dpi.o
mtk_mutex.o
obj-$(CONFIG_DRM_MEDIATEK) += mediatek-drm.o obj-$(CONFIG_DRM_MEDIATEK) += mediatek-drm.o
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/soc/mediatek/mtk-cmdq.h> #include <linux/soc/mediatek/mtk-cmdq.h>
#include <linux/soc/mediatek/mtk-mmsys.h> #include <linux/soc/mediatek/mtk-mmsys.h>
#include <linux/soc/mediatek/mtk-mutex.h>
#include <asm/barrier.h> #include <asm/barrier.h>
#include <soc/mediatek/smi.h> #include <soc/mediatek/smi.h>
...@@ -22,7 +23,6 @@ ...@@ -22,7 +23,6 @@
#include "mtk_drm_ddp_comp.h" #include "mtk_drm_ddp_comp.h"
#include "mtk_drm_gem.h" #include "mtk_drm_gem.h"
#include "mtk_drm_plane.h" #include "mtk_drm_plane.h"
#include "mtk_mutex.h"
/* /*
* struct mtk_drm_crtc - MediaTek specific crtc structure. * struct mtk_drm_crtc - MediaTek specific crtc structure.
......
...@@ -588,7 +588,6 @@ static struct platform_driver mtk_drm_platform_driver = { ...@@ -588,7 +588,6 @@ static struct platform_driver mtk_drm_platform_driver = {
}; };
static struct platform_driver * const mtk_drm_drivers[] = { static struct platform_driver * const mtk_drm_drivers[] = {
&mtk_mutex_driver,
&mtk_disp_color_driver, &mtk_disp_color_driver,
&mtk_disp_ovl_driver, &mtk_disp_ovl_driver,
&mtk_disp_rdma_driver, &mtk_disp_rdma_driver,
......
...@@ -46,7 +46,6 @@ struct mtk_drm_private { ...@@ -46,7 +46,6 @@ struct mtk_drm_private {
struct drm_atomic_state *suspend_state; struct drm_atomic_state *suspend_state;
}; };
extern struct platform_driver mtk_mutex_driver;
extern struct platform_driver mtk_disp_color_driver; extern struct platform_driver mtk_disp_color_driver;
extern struct platform_driver mtk_disp_ovl_driver; extern struct platform_driver mtk_disp_ovl_driver;
extern struct platform_driver mtk_disp_rdma_driver; extern struct platform_driver mtk_disp_rdma_driver;
......
...@@ -6,3 +6,4 @@ obj-$(CONFIG_MTK_PMIC_WRAP) += mtk-pmic-wrap.o ...@@ -6,3 +6,4 @@ obj-$(CONFIG_MTK_PMIC_WRAP) += mtk-pmic-wrap.o
obj-$(CONFIG_MTK_SCPSYS) += mtk-scpsys.o obj-$(CONFIG_MTK_SCPSYS) += mtk-scpsys.o
obj-$(CONFIG_MTK_SCPSYS_PM_DOMAINS) += mtk-pm-domains.o obj-$(CONFIG_MTK_SCPSYS_PM_DOMAINS) += mtk-pm-domains.o
obj-$(CONFIG_MTK_MMSYS) += mtk-mmsys.o obj-$(CONFIG_MTK_MMSYS) += mtk-mmsys.o
obj-$(CONFIG_MTK_MMSYS) += mtk-mutex.o
...@@ -10,8 +10,7 @@ ...@@ -10,8 +10,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/soc/mediatek/mtk-mmsys.h> #include <linux/soc/mediatek/mtk-mmsys.h>
#include <linux/soc/mediatek/mtk-mutex.h>
#include "mtk_mutex.h"
#define MT2701_MUTEX0_MOD0 0x2c #define MT2701_MUTEX0_MOD0 0x2c
#define MT2701_MUTEX0_SOF0 0x30 #define MT2701_MUTEX0_SOF0 0x30
...@@ -241,6 +240,7 @@ struct mtk_mutex *mtk_mutex_get(struct device *dev) ...@@ -241,6 +240,7 @@ struct mtk_mutex *mtk_mutex_get(struct device *dev)
return ERR_PTR(-EBUSY); return ERR_PTR(-EBUSY);
} }
EXPORT_SYMBOL_GPL(mtk_mutex_get);
void mtk_mutex_put(struct mtk_mutex *mutex) void mtk_mutex_put(struct mtk_mutex *mutex)
{ {
...@@ -251,6 +251,7 @@ void mtk_mutex_put(struct mtk_mutex *mutex) ...@@ -251,6 +251,7 @@ void mtk_mutex_put(struct mtk_mutex *mutex)
mutex->claimed = false; mutex->claimed = false;
} }
EXPORT_SYMBOL_GPL(mtk_mutex_put);
int mtk_mutex_prepare(struct mtk_mutex *mutex) int mtk_mutex_prepare(struct mtk_mutex *mutex)
{ {
...@@ -258,6 +259,7 @@ int mtk_mutex_prepare(struct mtk_mutex *mutex) ...@@ -258,6 +259,7 @@ int mtk_mutex_prepare(struct mtk_mutex *mutex)
mutex[mutex->id]); mutex[mutex->id]);
return clk_prepare_enable(mtx->clk); return clk_prepare_enable(mtx->clk);
} }
EXPORT_SYMBOL_GPL(mtk_mutex_prepare);
void mtk_mutex_unprepare(struct mtk_mutex *mutex) void mtk_mutex_unprepare(struct mtk_mutex *mutex)
{ {
...@@ -265,6 +267,7 @@ void mtk_mutex_unprepare(struct mtk_mutex *mutex) ...@@ -265,6 +267,7 @@ void mtk_mutex_unprepare(struct mtk_mutex *mutex)
mutex[mutex->id]); mutex[mutex->id]);
clk_disable_unprepare(mtx->clk); clk_disable_unprepare(mtx->clk);
} }
EXPORT_SYMBOL_GPL(mtk_mutex_unprepare);
void mtk_mutex_add_comp(struct mtk_mutex *mutex, void mtk_mutex_add_comp(struct mtk_mutex *mutex,
enum mtk_ddp_comp_id id) enum mtk_ddp_comp_id id)
...@@ -316,6 +319,7 @@ void mtk_mutex_add_comp(struct mtk_mutex *mutex, ...@@ -316,6 +319,7 @@ void mtk_mutex_add_comp(struct mtk_mutex *mutex,
mtx->regs + mtx->regs +
DISP_REG_MUTEX_SOF(mtx->data->mutex_sof_reg, mutex->id)); DISP_REG_MUTEX_SOF(mtx->data->mutex_sof_reg, mutex->id));
} }
EXPORT_SYMBOL_GPL(mtk_mutex_add_comp);
void mtk_mutex_remove_comp(struct mtk_mutex *mutex, void mtk_mutex_remove_comp(struct mtk_mutex *mutex,
enum mtk_ddp_comp_id id) enum mtk_ddp_comp_id id)
...@@ -355,6 +359,7 @@ void mtk_mutex_remove_comp(struct mtk_mutex *mutex, ...@@ -355,6 +359,7 @@ void mtk_mutex_remove_comp(struct mtk_mutex *mutex,
break; break;
} }
} }
EXPORT_SYMBOL_GPL(mtk_mutex_remove_comp);
void mtk_mutex_enable(struct mtk_mutex *mutex) void mtk_mutex_enable(struct mtk_mutex *mutex)
{ {
...@@ -365,6 +370,7 @@ void mtk_mutex_enable(struct mtk_mutex *mutex) ...@@ -365,6 +370,7 @@ void mtk_mutex_enable(struct mtk_mutex *mutex)
writel(1, mtx->regs + DISP_REG_MUTEX_EN(mutex->id)); writel(1, mtx->regs + DISP_REG_MUTEX_EN(mutex->id));
} }
EXPORT_SYMBOL_GPL(mtk_mutex_enable);
void mtk_mutex_disable(struct mtk_mutex *mutex) void mtk_mutex_disable(struct mtk_mutex *mutex)
{ {
...@@ -375,6 +381,7 @@ void mtk_mutex_disable(struct mtk_mutex *mutex) ...@@ -375,6 +381,7 @@ void mtk_mutex_disable(struct mtk_mutex *mutex)
writel(0, mtx->regs + DISP_REG_MUTEX_EN(mutex->id)); writel(0, mtx->regs + DISP_REG_MUTEX_EN(mutex->id));
} }
EXPORT_SYMBOL_GPL(mtk_mutex_disable);
void mtk_mutex_acquire(struct mtk_mutex *mutex) void mtk_mutex_acquire(struct mtk_mutex *mutex)
{ {
...@@ -388,6 +395,7 @@ void mtk_mutex_acquire(struct mtk_mutex *mutex) ...@@ -388,6 +395,7 @@ void mtk_mutex_acquire(struct mtk_mutex *mutex)
tmp, tmp & INT_MUTEX, 1, 10000)) tmp, tmp & INT_MUTEX, 1, 10000))
pr_err("could not acquire mutex %d\n", mutex->id); pr_err("could not acquire mutex %d\n", mutex->id);
} }
EXPORT_SYMBOL_GPL(mtk_mutex_acquire);
void mtk_mutex_release(struct mtk_mutex *mutex) void mtk_mutex_release(struct mtk_mutex *mutex)
{ {
...@@ -396,6 +404,7 @@ void mtk_mutex_release(struct mtk_mutex *mutex) ...@@ -396,6 +404,7 @@ void mtk_mutex_release(struct mtk_mutex *mutex)
writel(0, mtx->regs + DISP_REG_MUTEX(mutex->id)); writel(0, mtx->regs + DISP_REG_MUTEX(mutex->id));
} }
EXPORT_SYMBOL_GPL(mtk_mutex_release);
static int mtk_mutex_probe(struct platform_device *pdev) static int mtk_mutex_probe(struct platform_device *pdev)
{ {
...@@ -461,3 +470,5 @@ struct platform_driver mtk_mutex_driver = { ...@@ -461,3 +470,5 @@ struct platform_driver mtk_mutex_driver = {
.of_match_table = mutex_driver_dt_match, .of_match_table = mutex_driver_dt_match,
}, },
}; };
builtin_platform_driver(mtk_mutex_driver);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment