[PATCH V2] drm/exynos: Add DECON driver
con_context *ctx; > + struct resource *res; > + int ret = -EINVAL; > + > + if (!dev->of_node) > + return -ENODEV; > + > + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); > + if (!ctx) > + return -ENOMEM; > + > + ctx->manager.type = EXYNOS_DISPLAY_TYPE_LCD; > + ctx->manager.ops = _manager_ops; > + > + ret = exynos_drm_component_add(dev, EXYNOS_DEVICE_TYPE_CRTC, > + ctx->manager.type); > + if (ret) > + return ret; > + > + ctx->dev = dev; > + ctx->suspended = true; > + > + ctx->pclk = devm_clk_get(dev, "pclk_decon0"); > + if (IS_ERR(ctx->pclk)) { > + dev_err(dev, "failed to get bus clock pclk\n"); > + ret = PTR_ERR(ctx->pclk); > + goto err_del_component; > + } > + > + ctx->aclk = devm_clk_get(dev, "aclk_decon0"); > + if (IS_ERR(ctx->aclk)) { > + dev_err(dev, "failed to get bus clock aclk\n"); > + ret = PTR_ERR(ctx->aclk); > + goto err_del_component; > + } > + > + ctx->eclk = devm_clk_get(dev, "decon0_eclk"); > + if (IS_ERR(ctx->eclk)) { > + dev_err(dev, "failed to get eclock\n"); > + ret = PTR_ERR(ctx->eclk); > + goto err_del_component; > + } > + > + ctx->vclk = devm_clk_get(dev, "decon0_vclk"); > + if (IS_ERR(ctx->vclk)) { > + dev_err(dev, "failed to get vclock\n"); > + ret = PTR_ERR(ctx->vclk); > + goto err_del_component; > + } > + > + ctx->regs = of_iomap(dev->of_node, 0); This is OK, but we should handle unmapping of ctx->regs in error conditions below. > + if (IS_ERR(ctx->regs)) { > + ret = PTR_ERR(ctx->regs); > + goto err_del_component; > + } > + > + res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "vsync"); > + if (!res) { > + dev_err(dev, "irq request failed.\n"); > + ret = -ENXIO; > + goto err_del_component; > + } > + > + ret = devm_request_irq(dev, res->start, decon_irq_handler, > + 0, "drm_decon", ctx); > + if (ret) { > + dev_err(dev, "irq request failed.\n"); > + goto err_del_component; > + } > + > + init_waitqueue_head(>wait_vsync_queue); > + atomic_set(>wait_vsync_event, 0); > + > + platform_set_drvdata(pdev, ctx); > + > + ctx->display = exynos_dpi_probe(dev); > + if (IS_ERR(ctx->display)) { > + ret = PTR_ERR(ctx->display); > + goto err_del_component; > + } > + > + pm_runtime_enable(dev); > + > + ret = component_add(dev, _component_ops); > + if (ret) > + goto err_disable_pm_runtime; > + > + return ret; > + > +err_disable_pm_runtime: > + pm_runtime_disable(dev); > + > +err_del_component: > + exynos_drm_component_del(dev, EXYNOS_DEVICE_TYPE_CRTC); > + return ret; > +} > + > +static int decon_remove(struct platform_device *pdev) > +{ > + pm_runtime_disable(>dev); > + > + component_del(>dev, _component_ops); > + exynos_drm_component_del(>dev, EXYNOS_DEVICE_TYPE_CRTC); > + > + return 0; > +} > + > +struct platform_driver decon_driver = { > + .probe = decon_probe, > + .remove = decon_remove, > + .driver = { > + .name = "exynos-decon", > + .owner = THIS_MODULE, This is no more required. > + .of_match_table = decon_driver_dt_match, > + }, > +}; > -- Thanks, Pankaj Dubey > 1.7.9.5 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" > in > the body of a message to majordomo at vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] drm/exynos: Add DECON driver
decon_mode_set, > + .commit = decon_commit, > + .enable_vblank = decon_enable_vblank, > + .disable_vblank = decon_disable_vblank, > + .wait_for_vblank = decon_wait_for_vblank, > + .win_mode_set = decon_win_mode_set, > + .win_commit = decon_win_commit, > + .win_disable = decon_win_disable, > +}; > + > + > +static irqreturn_t decon_irq_handler(int irq, void *dev_id) > +{ > + struct decon_context *ctx = (struct decon_context *)dev_id; > + u32 val; > + > + val = readl(ctx->regs + VIDINTCON1); > + > + if (val & VIDINTCON1_INT_FRAME) > + /* VSYNC interrupt */ > + writel(VIDINTCON1_INT_FRAME, ctx->regs + VIDINTCON1); > + > + /* check the crtc is detached already from encoder */ > + if (ctx->pipe < 0 || !ctx->drm_dev) > + goto out; > + > + drm_handle_vblank(ctx->drm_dev, ctx->pipe); > + exynos_drm_crtc_finish_pageflip(ctx->drm_dev, ctx->pipe); > + > + /* set wait vsync event to zero and wake up queue. */ > + if (atomic_read(>wait_vsync_event)) { > + atomic_set(>wait_vsync_event, 0); > + wake_up(>wait_vsync_queue); > + } > +out: > + return IRQ_HANDLED; > +} > + > +static int decon_bind(struct device *dev, struct device *master, void *data) > +{ > + struct decon_context *ctx = dev_get_drvdata(dev); > + struct drm_device *drm_dev = data; > + > + decon_mgr_initialize(>manager, drm_dev); decon_mgr_initialize return value should be checked and if error it should be propagated to the caller. > + exynos_drm_crtc_create(>manager); > + if (ctx->display) > + exynos_drm_create_enc_conn(drm_dev, ctx->display); > + > + return 0; > + > +} > + > +static void decon_unbind(struct device *dev, struct device *master, > + void *data) > +{ > + struct decon_context *ctx = dev_get_drvdata(dev); > + > + decon_dpms(>manager, DRM_MODE_DPMS_OFF); > + > + if (ctx->display) > + exynos_dpi_remove(ctx->display); > + > + decon_mgr_remove(>manager); > +} > + > +static const struct component_ops decon_component_ops = { > + .bind = decon_bind, > + .unbind = decon_unbind, > +}; > + > +static int decon_probe(struct platform_device *pdev) > +{ > + struct device *dev = >dev; > + struct decon_context *ctx; > + struct resource *res; > + int ret = -EINVAL; > + > + if (!dev->of_node) > + return -ENODEV; > + > + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); > + if (!ctx) > + return -ENOMEM; > + > + ctx->manager.type = EXYNOS_DISPLAY_TYPE_LCD; > + ctx->manager.ops = _manager_ops; > + > + ret = exynos_drm_component_add(dev, EXYNOS_DEVICE_TYPE_CRTC, > + ctx->manager.type); > + if (ret) > + return ret; > + > + ctx->dev = dev; > + ctx->suspended = true; > + > + ctx->pclk = devm_clk_get(dev, "pclk_decon0"); > + if (IS_ERR(ctx->pclk)) { > + dev_err(dev, "failed to get bus clock pclk\n"); > + ret = PTR_ERR(ctx->pclk); > + goto err_del_component; > + } > + > + ctx->aclk = devm_clk_get(dev, "aclk_decon0"); > + if (IS_ERR(ctx->aclk)) { > + dev_err(dev, "failed to get bus clock aclk\n"); > + ret = PTR_ERR(ctx->aclk); > + goto err_del_component; > + } > + > + ctx->eclk = devm_clk_get(dev, "decon0_eclk"); > + if (IS_ERR(ctx->eclk)) { > + dev_err(dev, "failed to get eclock\n"); > + ret = PTR_ERR(ctx->eclk); > + goto err_del_component; > + } > + > + ctx->vclk = devm_clk_get(dev, "decon0_vclk"); > + if (IS_ERR(ctx->vclk)) { > + dev_err(dev, "failed to get vclock\n"); > + ret = PTR_ERR(ctx->vclk); > + goto err_del_component; > + } > + > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + How about using of_iomap here? > + ctx->regs = devm_ioremap_resource(dev, res); > + if (IS_ERR(ctx->regs)) { > + ret = PTR_ERR(ctx->regs); > + goto err_del_component; > + } > + > + res = platform_get_resource_byname(pdev, IORE
[RFC PATCH 1/1] drm/exynos: Move platform drivers registration to module init
On 20 November 2014 15:22, Vivek Gautam wrote: > Hi Javier, > > > On Thu, Nov 20, 2014 at 2:15 PM, Javier Martinez Canillas > wrote: >> Hello Vivek, >> >> On 11/20/2014 08:51 AM, Vivek Gautam wrote: >>>> >>>> I tested linux-next on Exynos5800 peach-pi board with linux-next and and >>>> the two >>>> patches $Subject and [0]. >>>> >>>> Below is my git hash: >>>> 4d9e6ee drm/exynos: Move platform drivers registration to module init >>>> 4545ed4 POSTED: arm: dts: Exynos5: Use pmu_system_controller phandle for >>>> dp phy >>>> 36391a5 Add linux-next specific files for 20141119 >>>> 9b1ced1 Merge branch 'akpm/master' >>>> 282497e mm: add strictlimit knob >>> >>> used exynos_defconfig >>> >> >> Same here. >> >>>> >>>> With this display works for me. >>>> Without $Subject patch i get lookup in drm. >>>> >> >> I tested with today linux-next (next-20141120) and display is indeed >> working for me. So it seems that whatever caused the error in the >> phy-exynos-mipi-video driver reported by Paolo, got fixed recently. >> >> My working git hash is: >> >> 65a8d01 arm: dts: Exynos5: Use pmu_system_controller phandle for dp phy >> a9b43cb drm/exynos: Move platform drivers registration to module init >> 5b83d7a Add linux-next specific files for 20141120 >> 1172916 mm: add strictlimit knob >> >> I did have to disable CONFIG_SND_SOC_SNOW though, otherwise the kernel >> did not boot due the issue reported previously by Kevin. >> >>>> Javier can you tell me your git hash. Was it on yesterday's linux-next ? >>> >> >> In fact, my branch where I could reproduce the phy-exynos-mipi-video issue >> was not based on yesterday's next but next-20141117. The git hash is: >> >> 9fb5d7c arm: dts: Exynos5: Use pmu_system_controller phandle for dp phy >> f740096 drm/exynos: Move platform drivers registration to module init >> efefb5c Add linux-next specific files for 20141117 >> 8c944d7 mm: add strictlimit knob >> >>> With 3.18-rc5 i could see display on Exynos5800 peach-pi with >>> following git hash: >>> >>> b6dca11 drm/exynos: dp: Remove support for unused dptx-phy >>> 7cc5c2d ARM: exynos_defconfig: Enable options for display panel support >>> d0aca5e arm: dts: Exynos5: Use pmu_system_controller phandle for dp phy >>> fc14f9c Linux 3.18-rc5 >>> e35c5a2 Merge tag 'armsoc-for-rc5' of >>> git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc >>> >>> I don't need this drm lockup patch with 3.18-rc5 (with exynos_defconfig). >>> >> >> Yes, that works because the commit that caused the Exynos DRM lockup was: >> >> 43c0767 ("of/platform: Move platform devices under /sys/devices/platform") >> >> which landed in next-20141105. >> >> Reverting 43c0767 and only applying [0] should have the same effect. >> >>> I am checking further with linux-samsung, coz i could see weird >>> behavior as mentioned >>> in [1] with linux-samsun/for-next merged with above git hash. >>> >> >> Great, it should be good to know what caused: > > On linux-samsung tree the only patch that's missing apart from dptx-phy > patches > is the syscon patch from Pankaj Dubey: > b784b98 mfd: syscon: Decouple syscon interface from platform devices > This patch has landed in mfd/for-next and linux-next. Without this on kgene/for-next, any driver seeking PMU register via syscon API will fail to get regmap handles. Thanks, Pankaj Dubey > So with below git hash, linux-samsung/for-next display works fine along with > other devices that request PMU system controller : > > 7bd219e drm/exynos: dp: Remove support for unused dptx-phy > e8f21fd arm: dts: Exynos5: Use pmu_system_controller phandle for dp phy > 7099bde Revert "Revert "ARM: exynos_defconfig: Enable options for > display panel support"" > 713a994 mfd: syscon: Decouple syscon interface from platform devices > 7552917 Revert "ARM: exynos_defconfig: Enable options for display > panel support" /* This is Kukjin's for-next today */ > ff0391a Merge branch 'v3.19-samsung-defconfig' into for-next > 26c6283 Merge branch 'v3.18-samsung-fixes' into for-next > cf864fd Merge branch 'v3.18-samsung-defconfig' into for-next > 98b6380 ARM: exynos_defconfig: Enable max77802 rtc and clock drivers > 839275c ARM: exynos_defconfig: Use 16 minors per MMC block device > 0526f27 ARM