Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/exynos: gsc: add device tree support and remove usage of static mappings

This patch adds device tree support for exynos_drm_gsc. This patch
also fixed build issue on non-Exynos platforms, thus dependency on
!ARCH_MULTIPLATFORM can be now removed. The driver cannot be used
simultaneously with V4L2 Mem2Mem GScaller driver thought.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>

authored by

Seung-Woo Kim and committed by
Inki Dae
aeefb368 c155fb56

+33 -7
+4
Documentation/devicetree/bindings/media/exynos5-gsc.txt
··· 7 7 - reg: should contain G-Scaler physical address location and length. 8 8 - interrupts: should contain G-Scaler interrupt number 9 9 10 + Optional properties: 11 + - samsung,sysreg: handle to syscon used to control the system registers to 12 + set writeback input and destination 13 + 10 14 Example: 11 15 12 16 gsc_0: gsc@0x13e00000 {
+1 -1
drivers/gpu/drm/exynos/Kconfig
··· 118 118 119 119 config DRM_EXYNOS_GSC 120 120 bool "GScaler" 121 - depends on DRM_EXYNOS_IPP && ARCH_EXYNOS5 && !ARCH_MULTIPLATFORM 121 + depends on DRM_EXYNOS_IPP && ARCH_EXYNOS5 && !VIDEO_SAMSUNG_EXYNOS_GSC 122 122 help 123 123 Choose this option if you want to use Exynos GSC for DRM. 124 124
+26 -4
drivers/gpu/drm/exynos/exynos_drm_gsc.c
··· 15 15 #include <linux/platform_device.h> 16 16 #include <linux/clk.h> 17 17 #include <linux/pm_runtime.h> 18 - #include <plat/map-base.h> 18 + #include <linux/mfd/syscon.h> 19 + #include <linux/regmap.h> 19 20 20 21 #include <drm/drmP.h> 21 22 #include <drm/exynos_drm.h> ··· 127 126 * @ippdrv: prepare initialization using ippdrv. 128 127 * @regs_res: register resources. 129 128 * @regs: memory mapped io registers. 129 + * @sysreg: handle to SYSREG block regmap. 130 130 * @lock: locking of operations. 131 131 * @gsc_clk: gsc gate clock. 132 132 * @sc: scaler infomations. ··· 140 138 struct exynos_drm_ippdrv ippdrv; 141 139 struct resource *regs_res; 142 140 void __iomem *regs; 141 + struct regmap *sysreg; 143 142 struct mutex lock; 144 143 struct clk *gsc_clk; 145 144 struct gsc_scaler sc; ··· 440 437 441 438 static void gsc_set_gscblk_fimd_wb(struct gsc_context *ctx, bool enable) 442 439 { 443 - u32 gscblk_cfg; 440 + unsigned int gscblk_cfg; 444 441 445 - gscblk_cfg = readl(SYSREG_GSCBLK_CFG1); 442 + if (!ctx->sysreg) 443 + return; 444 + 445 + regmap_read(ctx->sysreg, SYSREG_GSCBLK_CFG1, &gscblk_cfg); 446 446 447 447 if (enable) 448 448 gscblk_cfg |= GSC_BLK_DISP1WB_DEST(ctx->id) | ··· 454 448 else 455 449 gscblk_cfg |= GSC_BLK_PXLASYNC_LO_MASK_WB(ctx->id); 456 450 457 - writel(gscblk_cfg, SYSREG_GSCBLK_CFG1); 451 + regmap_write(ctx->sysreg, SYSREG_GSCBLK_CFG1, gscblk_cfg); 458 452 } 459 453 460 454 static void gsc_handle_irq(struct gsc_context *ctx, bool enable, ··· 1669 1663 if (!ctx) 1670 1664 return -ENOMEM; 1671 1665 1666 + if (dev->of_node) { 1667 + ctx->sysreg = syscon_regmap_lookup_by_phandle(dev->of_node, 1668 + "samsung,sysreg"); 1669 + if (IS_ERR(ctx->sysreg)) { 1670 + dev_warn(dev, "failed to get system register.\n"); 1671 + ctx->sysreg = NULL; 1672 + } 1673 + } 1674 + 1672 1675 /* clock control */ 1673 1676 ctx->gsc_clk = devm_clk_get(dev, "gscl"); 1674 1677 if (IS_ERR(ctx->gsc_clk)) { ··· 1811 1796 SET_RUNTIME_PM_OPS(gsc_runtime_suspend, gsc_runtime_resume, NULL) 1812 1797 }; 1813 1798 1799 + static const struct of_device_id exynos_drm_gsc_of_match[] = { 1800 + { .compatible = "samsung,exynos5-gsc" }, 1801 + { }, 1802 + }; 1803 + MODULE_DEVICE_TABLE(of, exynos_drm_gsc_of_match); 1804 + 1814 1805 struct platform_driver gsc_driver = { 1815 1806 .probe = gsc_probe, 1816 1807 .remove = gsc_remove, ··· 1824 1803 .name = "exynos-drm-gsc", 1825 1804 .owner = THIS_MODULE, 1826 1805 .pm = &gsc_pm_ops, 1806 + .of_match_table = of_match_ptr(exynos_drm_gsc_of_match), 1827 1807 }, 1828 1808 }; 1829 1809
+2 -2
drivers/gpu/drm/exynos/regs-gsc.h
··· 273 273 #define GSC_CLK_GATE_MODE_SNOOP_CNT(x) ((x) << 0) 274 274 275 275 /* SYSCON. GSCBLK_CFG */ 276 - #define SYSREG_GSCBLK_CFG1 (S3C_VA_SYS + 0x0224) 276 + #define SYSREG_GSCBLK_CFG1 0x0224 277 277 #define GSC_BLK_DISP1WB_DEST(x) (x << 10) 278 278 #define GSC_BLK_SW_RESET_WB_DEST(x) (1 << (18 + x)) 279 279 #define GSC_BLK_PXLASYNC_LO_MASK_WB(x) (0 << (14 + x)) 280 280 #define GSC_BLK_GSCL_WB_IN_SRC_SEL(x) (1 << (2 * x)) 281 - #define SYSREG_GSCBLK_CFG2 (S3C_VA_SYS + 0x2000) 281 + #define SYSREG_GSCBLK_CFG2 0x2000 282 282 #define PXLASYNC_LO_MASK_CAMIF_GSCL(x) (1 << (x)) 283 283 284 284 #endif /* EXYNOS_REGS_GSC_H_ */