From patchwork Tue Mar 26 18:38:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 2343431 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 94AC33FC54 for ; Tue, 26 Mar 2013 18:38:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760103Ab3CZSiv (ORCPT ); Tue, 26 Mar 2013 14:38:51 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:51545 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760098Ab3CZSiu (ORCPT ); Tue, 26 Mar 2013 14:38:50 -0400 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MKA007FX6GPTH60@mailout3.samsung.com>; Wed, 27 Mar 2013 03:38:49 +0900 (KST) X-AuditID: cbfee61a-b7fa86d0000045ae-44-5151eb399233 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id AC.E4.17838.93BE1515; Wed, 27 Mar 2013 03:38:49 +0900 (KST) Received: from amdc1344.digital.local ([106.116.147.32]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MKA00K8O6G0S100@mmp2.samsung.com>; Wed, 27 Mar 2013 03:38:49 +0900 (KST) From: Sylwester Nawrocki To: linux-media@vger.kernel.org Cc: kyungmin.park@samsung.com, myungjoo.ham@samsung.com, dh09.lee@samsung.com, shaik.samsung@gmail.com, arun.kk@samsung.com, a.hajda@samsung.com, linux-samsung-soc@vger.kernel.org, Sylwester Nawrocki Subject: [PATCH v2 2/5] exynos4-is: Use common driver data for all FIMC-LITE IP instances Date: Tue, 26 Mar 2013 19:38:16 +0100 Message-id: <1364323101-22046-5-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1364323101-22046-1-git-send-email-s.nawrocki@samsung.com> References: <1364323101-22046-1-git-send-email-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprILMWRmVeSWpSXmKPExsVy+t9jQV3L14GBBlufcFncWneO1eLjqdus FtfP21mcbXrDbtGzYSurxYzz+5gsbjeuYLM4/Kad1WLdzknsDpweO2fdZffo27KK0ePzJrkA 5igum5TUnMyy1CJ9uwSujFf3TzIXLDSsmNTwhqWBcalGFyMnh4SAicSPCxsZIWwxiQv31rN1 MXJxCAlMZ5S4dboHLCEk0MEk8XSuE4jNJmAo0Xu0DywuIiAv8aT3BlgDs8ATRok/Jw4wgSSE BaIlVrxYAVTEwcEioCpx+oQOSJhXwE3i0ZMJrCBhCQEFiTmTbEDCnALuEv/6bkCtcpOY1fCb dQIj7wJGhlWMoqkFyQXFSem5hnrFibnFpXnpesn5uZsYwQH1TGoH48oGi0OMAhyMSjy8G4ID AoVYE8uKK3MPMUpwMCuJ8ApuDAwU4k1JrKxKLcqPLyrNSS0+xCjNwaIkznug1TpQSCA9sSQ1 OzW1ILUIJsvEwSnVwKg3ndFHtN/38UmZmw/ibCJn7Fq8dOnDdoWZ7TPOSme78aWY3Htf0PQl ddNq9v0T5HRkONyLKo0ZNpkbBm0pEWDYNe+/t8z2pAO7mFqbK+9qbrkwh3XiFcuzdUaPJ3Qb Z4gu3tN699RMleW3fJ5c276pbJs5X8iK9uClppw3NvUk5h2er50u6q7EUpyRaKjFXFScCAC6 qFNpJAIAAA== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org There is no need to use separate variant data structure for each FIMC-LITE IP instance. According to my knowledge there are no differences across them on Exynos4 as well as Exynos5 SoCs. Drop flite_variant data structure and use struct flite_drvdata instead. Signed-off-by: Sylwester Nawrocki Signed-off-by: Kyungmin Park --- drivers/media/platform/exynos4-is/fimc-lite.c | 35 ++++++++++--------------- drivers/media/platform/exynos4-is/fimc-lite.h | 10 +++---- 2 files changed, 17 insertions(+), 28 deletions(-) diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c index 70c0cc2..ba35328 100644 --- a/drivers/media/platform/exynos4-is/fimc-lite.c +++ b/drivers/media/platform/exynos4-is/fimc-lite.c @@ -528,7 +528,7 @@ static const struct fimc_fmt *fimc_lite_try_format(struct fimc_lite *fimc, u32 *width, u32 *height, u32 *code, u32 *fourcc, int pad) { - struct flite_variant *variant = fimc->variant; + struct flite_drvdata *dd = fimc->dd; const struct fimc_fmt *fmt; fmt = fimc_lite_find_format(fourcc, code, 0); @@ -541,12 +541,12 @@ static const struct fimc_fmt *fimc_lite_try_format(struct fimc_lite *fimc, *fourcc = fmt->fourcc; if (pad == FLITE_SD_PAD_SINK) { - v4l_bound_align_image(width, 8, variant->max_width, - ffs(variant->out_width_align) - 1, - height, 0, variant->max_height, 0, 0); + v4l_bound_align_image(width, 8, dd->max_width, + ffs(dd->out_width_align) - 1, + height, 0, dd->max_height, 0, 0); } else { v4l_bound_align_image(width, 8, fimc->inp_frame.rect.width, - ffs(variant->out_width_align) - 1, + ffs(dd->out_width_align) - 1, height, 0, fimc->inp_frame.rect.height, 0, 0); } @@ -566,7 +566,7 @@ static void fimc_lite_try_crop(struct fimc_lite *fimc, struct v4l2_rect *r) /* Adjust left/top if cropping rectangle got out of bounds */ r->left = clamp_t(u32, r->left, 0, frame->f_width - r->width); - r->left = round_down(r->left, fimc->variant->win_hor_offs_align); + r->left = round_down(r->left, fimc->dd->win_hor_offs_align); r->top = clamp_t(u32, r->top, 0, frame->f_height - r->height); v4l2_dbg(1, debug, &fimc->subdev, "(%d,%d)/%dx%d, sink fmt: %dx%d\n", @@ -586,7 +586,7 @@ static void fimc_lite_try_compose(struct fimc_lite *fimc, struct v4l2_rect *r) /* Adjust left/top if the composing rectangle got out of bounds */ r->left = clamp_t(u32, r->left, 0, frame->f_width - r->width); - r->left = round_down(r->left, fimc->variant->out_hor_offs_align); + r->left = round_down(r->left, fimc->dd->out_hor_offs_align); r->top = clamp_t(u32, r->top, 0, fimc->out_frame.f_height - r->height); v4l2_dbg(1, debug, &fimc->subdev, "(%d,%d)/%dx%d, source fmt: %dx%d\n", @@ -647,8 +647,8 @@ static int fimc_lite_try_fmt(struct fimc_lite *fimc, struct v4l2_pix_format_mplane *pixm, const struct fimc_fmt **ffmt) { - struct flite_variant *variant = fimc->variant; u32 bpl = pixm->plane_fmt[0].bytesperline; + struct flite_drvdata *dd = fimc->dd; const struct fimc_fmt *fmt; fmt = fimc_lite_find_format(&pixm->pixelformat, NULL, 0); @@ -656,9 +656,9 @@ static int fimc_lite_try_fmt(struct fimc_lite *fimc, return -EINVAL; if (ffmt) *ffmt = fmt; - v4l_bound_align_image(&pixm->width, 8, variant->max_width, - ffs(variant->out_width_align) - 1, - &pixm->height, 0, variant->max_height, 0, 0); + v4l_bound_align_image(&pixm->width, 8, dd->max_width, + ffs(dd->out_width_align) - 1, + &pixm->height, 0, dd->max_height, 0, 0); if ((bpl == 0 || ((bpl * 8) / fmt->depth[0]) < pixm->width)) pixm->plane_fmt[0].bytesperline = (pixm->width * @@ -1429,7 +1429,7 @@ static int fimc_lite_probe(struct platform_device *pdev) if (!drv_data || fimc->index < 0 || fimc->index >= FIMC_LITE_MAX_DEVS) return -EINVAL; - fimc->variant = drv_data->variant[fimc->index]; + fimc->dd = drv_data; fimc->pdev = pdev; init_waitqueue_head(&fimc->irq_queue); @@ -1577,7 +1577,8 @@ static const struct dev_pm_ops fimc_lite_pm_ops = { NULL) }; -static struct flite_variant fimc_lite0_variant_exynos4 = { +/* EXYNOS4212, EXYNOS4412 */ +static struct flite_drvdata fimc_lite_drvdata_exynos4 = { .max_width = 8192, .max_height = 8192, .out_width_align = 8, @@ -1585,14 +1586,6 @@ static struct flite_variant fimc_lite0_variant_exynos4 = { .out_hor_offs_align = 8, }; -/* EXYNOS4212, EXYNOS4412 */ -static struct flite_drvdata fimc_lite_drvdata_exynos4 = { - .variant = { - [0] = &fimc_lite0_variant_exynos4, - [1] = &fimc_lite0_variant_exynos4, - }, -}; - static struct platform_device_id fimc_lite_driver_ids[] = { { .name = "exynos-fimc-lite", diff --git a/drivers/media/platform/exynos4-is/fimc-lite.h b/drivers/media/platform/exynos4-is/fimc-lite.h index 4c234508..0b6380b 100644 --- a/drivers/media/platform/exynos4-is/fimc-lite.h +++ b/drivers/media/platform/exynos4-is/fimc-lite.h @@ -48,7 +48,7 @@ enum { #define FLITE_SD_PAD_SOURCE_ISP 2 #define FLITE_SD_PADS_NUM 3 -struct flite_variant { +struct flite_drvdata { unsigned short max_width; unsigned short max_height; unsigned short out_width_align; @@ -56,10 +56,6 @@ struct flite_variant { unsigned short out_hor_offs_align; }; -struct flite_drvdata { - struct flite_variant *variant[FIMC_LITE_MAX_DEVS]; -}; - #define fimc_lite_get_drvdata(_pdev) \ ((struct flite_drvdata *) platform_get_device_id(_pdev)->driver_data) @@ -96,7 +92,7 @@ struct flite_buffer { /** * struct fimc_lite - fimc lite structure * @pdev: pointer to FIMC-LITE platform device - * @variant: variant information for this IP + * @dd: SoC specific driver data structure * @v4l2_dev: pointer to top the level v4l2_device * @vfd: video device node * @fh: v4l2 file handle @@ -132,7 +128,7 @@ struct flite_buffer { */ struct fimc_lite { struct platform_device *pdev; - struct flite_variant *variant; + struct flite_drvdata *dd; struct v4l2_device *v4l2_dev; struct video_device vfd; struct v4l2_fh fh;