From: Eunchul Kim <chulspro.kim@samsung.com>
To: Sylwester Nawrocki <s.nawrocki@samsung.com>
Cc: inki.dae@samsung.com, kyungmin.park@samsung.com,
linux-samsung-soc@vger.kernel.org,
devicetree-discuss@lists.ozlabs.org,
dri-devel@lists.freedesktop.org, jaejoon.seo@samsung.com,
jmock.shin@samsung.com, jy0.jeon@samsung.com,
th908.kim@samsung.com, lsmin.lee@samsung.com,
chulspro.kim@samsung.com
Subject: Re: [PATCH 3/3] drm/exynos: Add device tree support for fimc ipp driver
Date: Fri, 19 Apr 2013 20:38:13 +0900 [thread overview]
Message-ID: <51712CA5.4030206@samsung.com> (raw)
In-Reply-To: <1366133486-22973-4-git-send-email-s.nawrocki@samsung.com>
Dear Sylwester Nawrocki.
Sorry. I didn't check your third patch. I understand the "mux", "parent"
meaning. please ignore my comment of "mux", "parent"
and please check below comments.
Thank's
BR
Eunchul Kim.
On 04/17/2013 02:31 AM, Sylwester Nawrocki wrote:
> This patch adds OF initialization support for the FIMC driver.
> The binding documentation can be found at Documentation/devicetree/
> bindings/media/samsung-fimc.txt.
>
> The syscon regmap interface is used to serialize access to the
> shared CAMBLK registers from within the V4L2 FIMC-IS and the DRM
> FIMC drivers. The DRM driver uses this interface for setting up
> the FIFO data link between FIMD and FIMC IP blocks, while the V4L2
> one for setting up a data link between the camera ISP and FIMC for
> camera capture. The CAMBLK registers are not accessed any more
> through a statically mapped IO. Synchronized access to these
> registers is required for simultaneous operation of the camera
> ISP and the DRM IPP on Exynos4x12.
>
> Exynos4 is going to be a dt-only platform since 3.10, thus the
> driver data and driver_ids static data structures are removed.
>
> Camera input signal polarities are not currently parsed from the
> device tree.
>
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
> drivers/gpu/drm/exynos/Kconfig | 2 +-
> drivers/gpu/drm/exynos/exynos_drm_fimc.c | 101 +++++++++++++++---------------
> drivers/gpu/drm/exynos/regs-fimc.h | 7 +--
> 3 files changed, 53 insertions(+), 57 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig
> index 406f32a..5c4be2a 100644
> --- a/drivers/gpu/drm/exynos/Kconfig
> +++ b/drivers/gpu/drm/exynos/Kconfig
> @@ -56,7 +56,7 @@ config DRM_EXYNOS_IPP
>
> config DRM_EXYNOS_FIMC
> bool "Exynos DRM FIMC"
> - depends on DRM_EXYNOS_IPP
> + depends on DRM_EXYNOS_IPP && MFD_SYSCON && OF
> help
> Choose this option if you want to use Exynos FIMC for DRM.
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
> index 9bea585..f25801e 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
> @@ -12,11 +12,12 @@
> *
> */
> #include <linux/kernel.h>
> +#include <linux/mfd/syscon.h>
> #include <linux/module.h>
> #include <linux/platform_device.h>
> +#include <linux/regmap.h>
> #include <linux/clk.h>
> #include <linux/pm_runtime.h>
> -#include <plat/map-base.h>
>
> #include <drm/drmP.h>
> #include <drm/exynos_drm.h>
> @@ -140,15 +141,6 @@ struct fimc_capability {
> };
>
> /*
> - * A structure of fimc driver data.
> - *
> - * @parent_clk: name of parent clock.
> - */
> -struct fimc_driverdata {
> - char *parent_clk;
> -};
> -
> -/*
> * A structure of fimc context.
> *
> * @ippdrv: prepare initialization using ippdrv.
> @@ -158,6 +150,7 @@ struct fimc_driverdata {
> * @lock: locking of operations.
> * @clocks: fimc clocks.
> * @clk_frequency: LCLK clock frequency.
> + * @sysreg: handle to SYSREG block regmap.
> * @sc: scaler infomations.
> * @pol: porarity of writeback.
> * @id: fimc id.
> @@ -172,8 +165,8 @@ struct fimc_context {
> struct mutex lock;
> struct clk *clocks[FIMC_CLKS_MAX];
> u32 clk_frequency;
> + struct regmap *sysreg;
> struct fimc_scaler sc;
> - struct fimc_driverdata *ddata;
> struct exynos_drm_ipp_pol pol;
> int id;
> int irq;
> @@ -217,17 +210,13 @@ static void fimc_sw_reset(struct fimc_context *ctx)
> fimc_write(0x0, EXYNOS_CIFCNTSEQ);
> }
>
> -static void fimc_set_camblk_fimd0_wb(struct fimc_context *ctx)
> +static int fimc_set_camblk_fimd0_wb(struct fimc_context *ctx)
> {
> - u32 camblk_cfg;
> -
> DRM_DEBUG_KMS("%s\n", __func__);
>
> - camblk_cfg = readl(SYSREG_CAMERA_BLK);
> - camblk_cfg &= ~(SYSREG_FIMD0WB_DEST_MASK);
> - camblk_cfg |= ctx->id << (SYSREG_FIMD0WB_DEST_SHIFT);
> -
> - writel(camblk_cfg, SYSREG_CAMERA_BLK);
> + return regmap_update_bits(ctx->sysreg, SYSREG_CAMERA_BLK,
> + SYSREG_FIMD0WB_DEST_MASK,
> + ctx->id << SYSREG_FIMD0WB_DEST_SHIFT);
> }
>
> static void fimc_set_type_ctrl(struct fimc_context *ctx, enum fimc_wb wb)
> @@ -1628,7 +1617,9 @@ static int fimc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd)
> fimc_handle_lastend(ctx, true);
>
> /* setup FIMD */
> - fimc_set_camblk_fimd0_wb(ctx);
> + ret = fimc_set_camblk_fimd0_wb(ctx);
> + if (ret < 0)
- please adds error log information for indicating error.
> + return ret;
>
> set_wb.enable = 1;
> set_wb.refresh = property->refresh_rate;
> @@ -1784,26 +1775,50 @@ e_clk_free:
> return ret;
> }
>
> +static int fimc_parse_dt(struct fimc_context *ctx)
> +{
> + struct device_node *node = ctx->dev->of_node;
> +
> + if (!of_property_read_bool(node, "samsung,lcd-wb"))
- It also need error log ?
> + return -ENODEV;
> +
> + if (of_property_read_u32(node, "clock-frequency",
> + &ctx->clk_frequency))
> + ctx->clk_frequency = FIMC_DEFAULT_LCLK_FREQUENCY;
- We have many kind of H/W version of FIMC device. I think we need to
use pdata instead of static value.
> +
> + ctx->id = of_alias_get_id(node, "fimc");
> + if (ctx->id < 0)
> + return -EINVAL;
> +
> + return 0;
> +}
> +
> static int fimc_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct fimc_context *ctx;
> struct resource *res;
> struct exynos_drm_ippdrv *ippdrv;
> - struct exynos_drm_fimc_pdata *pdata;
> - struct fimc_driverdata *ddata;
> int ret;
>
> - pdata = pdev->dev.platform_data;
> - if (!pdata) {
> - dev_err(dev, "no platform data specified.\n");
> - return -EINVAL;
> - }
> + if (!dev->of_node)
- ditto.(error log)
> + return -ENODEV;
>
> ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
> if (!ctx)
> return -ENOMEM;
>
> + ctx->dev = dev;
> +
> + ret = fimc_parse_dt(ctx);
> + if (ret < 0)
> + return ret;
> +
> + ctx->sysreg = syscon_regmap_lookup_by_phandle(dev->of_node,
> + "samsung,sysreg");
> + if (IS_ERR(ctx->sysreg))
- ditto.(error log)
> + return PTR_ERR(ctx->sysreg);
> +
> /* resource memory */
> ctx->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> ctx->regs = devm_ioremap_resource(dev, ctx->regs_res);
> @@ -1828,10 +1843,6 @@ static int fimc_probe(struct platform_device *pdev)
> ret = fimc_setup_clocks(ctx);
> if (ret < 0)
> goto err_free_irq;
> - /* context initailization */
> - ctx->id = pdev->id;
> - ctx->pol = pdata->pol;
> - ctx->ddata = ddata;
>
> ippdrv = &ctx->ippdrv;
> ippdrv->dev = dev;
> @@ -1941,36 +1952,22 @@ static int fimc_runtime_resume(struct device *dev)
> }
> #endif
>
> -static struct fimc_driverdata exynos4210_fimc_data = {
> - .parent_clk = "mout_mpll",
> -};
> -
> -static struct fimc_driverdata exynos4410_fimc_data = {
> - .parent_clk = "mout_mpll_user",
> -};
> -
> -static struct platform_device_id fimc_driver_ids[] = {
> - {
> - .name = "exynos4210-fimc",
> - .driver_data = (unsigned long)&exynos4210_fimc_data,
> - }, {
> - .name = "exynos4412-fimc",
> - .driver_data = (unsigned long)&exynos4410_fimc_data,
> - },
> - {},
> -};
> -MODULE_DEVICE_TABLE(platform, fimc_driver_ids);
> -
> static const struct dev_pm_ops fimc_pm_ops = {
> SET_SYSTEM_SLEEP_PM_OPS(fimc_suspend, fimc_resume)
> SET_RUNTIME_PM_OPS(fimc_runtime_suspend, fimc_runtime_resume, NULL)
> };
>
> +static const struct of_device_id fimc_of_match[] = {
> + { .compatible = "samsung,exynos4210-fimc" },
> + { .compatible = "samsung,exynos4212-fimc" },
> + { },
> +};
> +
> struct platform_driver fimc_driver = {
> .probe = fimc_probe,
> .remove = fimc_remove,
> - .id_table = fimc_driver_ids,
> .driver = {
> + .of_match_table = fimc_of_match,
> .name = "exynos-drm-fimc",
> .owner = THIS_MODULE,
> .pm = &fimc_pm_ops,
> diff --git a/drivers/gpu/drm/exynos/regs-fimc.h b/drivers/gpu/drm/exynos/regs-fimc.h
> index b4f9ca1..3049613 100644
> --- a/drivers/gpu/drm/exynos/regs-fimc.h
> +++ b/drivers/gpu/drm/exynos/regs-fimc.h
> @@ -661,9 +661,8 @@
> #define EXYNOS_CLKSRC_SCLK (1 << 1)
>
> /* SYSREG for FIMC writeback */
> -#define SYSREG_CAMERA_BLK (S3C_VA_SYS + 0x0218)
> -#define SYSREG_ISP_BLK (S3C_VA_SYS + 0x020c)
> -#define SYSREG_FIMD0WB_DEST_MASK (0x3 << 23)
> -#define SYSREG_FIMD0WB_DEST_SHIFT 23
> +#define SYSREG_CAMERA_BLK (0x0218)
> +#define SYSREG_FIMD0WB_DEST_MASK (0x3 << 23)
> +#define SYSREG_FIMD0WB_DEST_SHIFT 23
>
> #endif /* EXYNOS_REGS_FIMC_H */
>
next prev parent reply other threads:[~2013-04-19 11:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-16 17:31 [PATCH 0/3] drm/exynos: Add device tree support for IPP driver Sylwester Nawrocki
2013-04-16 17:31 ` [PATCH 1/3] drm/exynos: Remove redundant devm_kfree() Sylwester Nawrocki
2013-04-16 17:31 ` [PATCH 2/3] drm/exynos: Rework fimc clocks handling Sylwester Nawrocki
2013-04-17 4:02 ` Sachin Kamat
2013-04-17 8:30 ` Sylwester Nawrocki
2013-04-16 17:31 ` [PATCH 3/3] drm/exynos: Add device tree support for fimc ipp driver Sylwester Nawrocki
2013-04-19 11:38 ` Eunchul Kim [this message]
2013-04-22 15:57 ` Sylwester Nawrocki
[not found] ` <1366133486-22973-4-git-send-email-s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-04-20 16:21 ` Inki Dae
2013-04-22 15:57 ` Sylwester Nawrocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51712CA5.4030206@samsung.com \
--to=chulspro.kim@samsung.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=inki.dae@samsung.com \
--cc=jaejoon.seo@samsung.com \
--cc=jmock.shin@samsung.com \
--cc=jy0.jeon@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=lsmin.lee@samsung.com \
--cc=s.nawrocki@samsung.com \
--cc=th908.kim@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.