From b3d8b559b1ce3b2d85ac57bbccbd38f25e3cc5db Mon Sep 17 00:00:00 2001 From: Sylwester Nawrocki Date: Sun, 31 Mar 2013 20:31:02 -0300 Subject: [PATCH] [media] exynos4-is: Remove dependency on SYSCON for non-dt platforms Currently the whole driver depends on MFD_SYSCON, which in turn depends on OF. To allow to use the driver on non-dt platforms (S5PV210) the SYSREG support is made conditional (it is needed only for dt enabled platforms) and MFD_SYSCON is selected if OF is enabled, instead of depending on OF. Signed-off-by: Sylwester Nawrocki Signed-off-by: Kyungmin Park Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/exynos4-is/Kconfig | 2 +- drivers/media/platform/exynos4-is/fimc-core.c | 3 +-- drivers/media/platform/exynos4-is/fimc-core.h | 10 ++++++++++ drivers/media/platform/exynos4-is/fimc-reg.c | 3 +++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/exynos4-is/Kconfig b/drivers/media/platform/exynos4-is/Kconfig index 91dbd4b22362..ae579208565b 100644 --- a/drivers/media/platform/exynos4-is/Kconfig +++ b/drivers/media/platform/exynos4-is/Kconfig @@ -2,7 +2,6 @@ config VIDEO_SAMSUNG_EXYNOS4_IS bool "Samsung S5P/EXYNOS4 SoC series Camera Subsystem driver" depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && PLAT_S5P && PM_RUNTIME - depends on MFD_SYSCON help Say Y here to enable camera host interface devices for Samsung S5P and EXYNOS SoC series. @@ -14,6 +13,7 @@ config VIDEO_S5P_FIMC depends on I2C select VIDEOBUF2_DMA_CONTIG select V4L2_MEM2MEM_DEV + select MFD_SYSCON if OF help This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC camera host interface and video postprocessor (FIMC) devices. diff --git a/drivers/media/platform/exynos4-is/fimc-core.c b/drivers/media/platform/exynos4-is/fimc-core.c index 44239e5b3a47..6b4a244132fb 100644 --- a/drivers/media/platform/exynos4-is/fimc-core.c +++ b/drivers/media/platform/exynos4-is/fimc-core.c @@ -966,8 +966,7 @@ static int fimc_probe(struct platform_device *pdev) spin_lock_init(&fimc->slock); mutex_init(&fimc->lock); - fimc->sysreg = syscon_regmap_lookup_by_phandle(dev->of_node, - "samsung,sysreg"); + fimc->sysreg = fimc_get_sysreg_regmap(dev->of_node); if (IS_ERR(fimc->sysreg)) return PTR_ERR(fimc->sysreg); diff --git a/drivers/media/platform/exynos4-is/fimc-core.h b/drivers/media/platform/exynos4-is/fimc-core.h index 793333a33b24..7d361b24dfd7 100644 --- a/drivers/media/platform/exynos4-is/fimc-core.h +++ b/drivers/media/platform/exynos4-is/fimc-core.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -645,6 +646,15 @@ void fimc_unregister_m2m_device(struct fimc_dev *fimc); int fimc_register_driver(void); void fimc_unregister_driver(void); +#ifdef CONFIG_MFD_SYSCON +static inline struct regmap * fimc_get_sysreg_regmap(struct device_node *node) +{ + return syscon_regmap_lookup_by_phandle(node, "samsung,sysreg"); +} +#else +#define fimc_get_sysreg_regmap(node) (NULL) +#endif + /* -----------------------------------------------------*/ /* fimc-m2m.c */ void fimc_m2m_job_finish(struct fimc_ctx *ctx, int vb_state); diff --git a/drivers/media/platform/exynos4-is/fimc-reg.c b/drivers/media/platform/exynos4-is/fimc-reg.c index c276eb8e9711..c82e9bdaae94 100644 --- a/drivers/media/platform/exynos4-is/fimc-reg.c +++ b/drivers/media/platform/exynos4-is/fimc-reg.c @@ -805,6 +805,9 @@ int fimc_hw_camblk_cfg_writeback(struct fimc_dev *fimc) unsigned int mask, val, camblk_cfg; int ret; + if (map == NULL) + return 0; + ret = regmap_read(map, SYSREG_CAMBLK, &camblk_cfg); if (ret < 0 || ((camblk_cfg & 0x00700000) >> 20 != 0x3)) return ret; -- GitLab