From patchwork Fri Mar 29 16:18:09 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: 2366081 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 2B94B3FD40 for ; Fri, 29 Mar 2013 16:24:34 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ULc3p-0002PY-5F; Fri, 29 Mar 2013 16:21:49 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ULc1X-0001Yi-AG for linux-arm-kernel@lists.infradead.org; Fri, 29 Mar 2013 16:19:31 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MKF00EFRK0BHZ00@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Sat, 30 Mar 2013 01:19:25 +0900 (KST) X-AuditID: cbfee61b-b7f076d0000034b6-1a-5155bf0c20d9 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 53.F4.13494.C0FB5515; Sat, 30 Mar 2013 01:19:24 +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 <0MKF0003UJYE5E20@mmp2.samsung.com>; Sat, 30 Mar 2013 01:19:24 +0900 (KST) From: Sylwester Nawrocki To: linux-media@vger.kernel.org Subject: [PATCH v3 6/7] exynos4-is: Add FIMC-IS subdevs registration Date: Fri, 29 Mar 2013 17:18:09 +0100 Message-id: <1364573890-31536-7-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1364573890-31536-1-git-send-email-s.nawrocki@samsung.com> References: <1364573890-31536-1-git-send-email-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrHLMWRmVeSWpSXmKPExsVy+t9jQV2e/aGBBpf2mlvcWneO1eLA7Ies FtfP21n0LrjKZnG26Q27xabH11gtejZsZbWYcX4fk8XTCRfZLG43rmCzOPymndVi/YzXLBbH ZixhdOD1uHNtD5vH5iX1HudnLGT06NuyitHj8ya5ANYoLpuU1JzMstQifbsEroy977tZC95r Vaxesp69gXG3chcjJ4eEgInEzOZDjBC2mMSFe+vZuhi5OIQEpjNK/DgxnxHC6WCSWN62mB2k ik3AUKL3aB9Yh4iAvMST3htgHcwC35gkJv/YDJYQFnCR+NgNUcQioCoxYf0cMJtXwE3iY0cz cxcjB9A6BYk5k2xATE4Bd4njW+RBTCGgigPbsyYw8i5gZFjFKJpakFxQnJSea6RXnJhbXJqX rpecn7uJERyKz6R3MK5qsDjEKMDBqMTDe2B5aKAQa2JZcWXuIUYJDmYlEV75FUAh3pTEyqrU ovz4otKc1OJDjNIcLErivAdbrQOFBNITS1KzU1MLUotgskwcnFINjF2OyXOfap4rLHplGhNs ybb0ym1NL7Xwh6lb7GPM4ub+7PjMY/219tDzKSHC/2NWhp5Vm5Q+d2tb7GTLEoFftVut5gT/ tn96X/G8xgmZ50/uLpaMN7wvcFVNcb9mod3U57Nr02pXMwUsZ3UV3XEw6nH4HWeFZydtI1k3 fLSvjJbaIH4z8u27Q0osxRmJhlrMRcWJAClVRJpBAgAA X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130329_121928_037681_19BA0943 X-CRM114-Status: GOOD ( 15.04 ) X-Spam-Score: -8.2 (--------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-8.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.24 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.3 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: kgene.kim@samsung.com, mturquette@linaro.org, Andrzej Hajda , t.figa@samsung.com, dh09.lee@samsung.com, linux-samsung-soc@vger.kernel.org, kyungmin.park@samsung.com, myungjoo.ham@samsung.com, thomas.abraham@linaro.org, Sylwester Nawrocki , devicetree-discuss@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This patch allows to register FIMC-IS device represented by FIMC-IS-ISP subdev to the top level media device driver. The use_isp platform data structure field allows to select whether the fimc-is ISP subdev should be tried to be registered or not. Signed-off-by: Sylwester Nawrocki Signed-off-by: Andrzej Hajda Signed-off-by: Kyungmin Park --- Changes since v2: - none. --- drivers/media/platform/s5p-fimc/fimc-mdevice.c | 37 ++++++++++++++++++++++-- drivers/media/platform/s5p-fimc/fimc-mdevice.h | 13 +++++++++ 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/s5p-fimc/fimc-mdevice.c b/drivers/media/platform/s5p-fimc/fimc-mdevice.c index 06d1eb4..b00144e 100644 --- a/drivers/media/platform/s5p-fimc/fimc-mdevice.c +++ b/drivers/media/platform/s5p-fimc/fimc-mdevice.c @@ -31,6 +31,7 @@ #include #include "fimc-core.h" +#include "fimc-is.h" #include "fimc-lite.h" #include "fimc-mdevice.h" #include "mipi-csis.h" @@ -85,9 +86,11 @@ static void fimc_pipeline_prepare(struct fimc_pipeline *p, case GRP_ID_FIMC: /* No need to control FIMC subdev through subdev ops */ break; + case GRP_ID_FIMC_IS: + p->subdevs[IDX_IS_ISP] = sd; + break; default: - pr_warn("%s: Unknown subdev grp_id: %#x\n", - __func__, sd->grp_id); + break; } me = &sd->entity; if (me->num_pads == 1) @@ -322,6 +325,7 @@ static void fimc_md_unregister_sensor(struct v4l2_subdev *sd) if (!client) return; + v4l2_device_unregister_subdev(sd); if (!client->dev.of_node) { @@ -372,7 +376,11 @@ static int fimc_md_of_add_sensor(struct fimc_md *fmd, goto mod_put; v4l2_set_subdev_hostdata(sd, si); - sd->grp_id = GRP_ID_SENSOR; + if (si->pdata.fimc_bus_type == FIMC_BUS_TYPE_ISP_WRITEBACK) + sd->grp_id = GRP_ID_FIMC_IS_SENSOR; + else + sd->grp_id = GRP_ID_SENSOR; + si->subdev = sd; v4l2_info(&fmd->v4l2_dev, "Registered sensor subdevice: %s (%d)\n", sd->name, fmd->num_sensors); @@ -650,6 +658,22 @@ static int register_csis_entity(struct fimc_md *fmd, return ret; } +static int register_fimc_is_entity(struct fimc_md *fmd, struct fimc_is *is) +{ + struct v4l2_subdev *sd = &is->isp.subdev; + int ret; + + ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); + if (ret) { + v4l2_err(&fmd->v4l2_dev, + "Failed to register FIMC-ISP (%d)\n", ret); + return ret; + } + + fmd->fimc_is = is; + return 0; +} + static int fimc_md_register_platform_entity(struct fimc_md *fmd, struct platform_device *pdev, int plat_entity) @@ -677,6 +701,9 @@ static int fimc_md_register_platform_entity(struct fimc_md *fmd, case IDX_CSIS: ret = register_csis_entity(fmd, pdev, drvdata); break; + case IDX_IS_ISP: + ret = register_fimc_is_entity(fmd, drvdata); + break; default: ret = -ENODEV; } @@ -740,6 +767,8 @@ static int fimc_md_register_of_platform_entities(struct fimc_md *fmd, /* If driver of any entity isn't ready try all again later. */ if (!strcmp(node->name, CSIS_OF_NODE_NAME)) plat_entity = IDX_CSIS; + else if (!strcmp(node->name, FIMC_IS_OF_NODE_NAME)) + plat_entity = IDX_IS_ISP; else if (!strcmp(node->name, FIMC_LITE_OF_NODE_NAME)) plat_entity = IDX_FLITE; else if (!strcmp(node->name, FIMC_OF_NODE_NAME) && @@ -1306,6 +1335,8 @@ static int fimc_md_probe(struct platform_device *pdev) v4l2_dev->notify = fimc_sensor_notify; strlcpy(v4l2_dev->name, "s5p-fimc-md", sizeof(v4l2_dev->name)); + fmd->use_isp = fimc_md_is_isp_available(dev->of_node); + ret = v4l2_device_register(dev, &fmd->v4l2_dev); if (ret < 0) { v4l2_err(v4l2_dev, "Failed to register v4l2_device: %d\n", ret); diff --git a/drivers/media/platform/s5p-fimc/fimc-mdevice.h b/drivers/media/platform/s5p-fimc/fimc-mdevice.h index 1d5cea5..0b14cd5 100644 --- a/drivers/media/platform/s5p-fimc/fimc-mdevice.h +++ b/drivers/media/platform/s5p-fimc/fimc-mdevice.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -80,6 +81,7 @@ struct fimc_sensor_info { * @num_sensors: actual number of registered sensors * @camclk: external sensor clock information * @fimc: array of registered fimc devices + * @fimc_is: fimc-is data structure * @use_isp: set to true when FIMC-IS subsystem is used * @pmf: handle to the CAMCLK clock control FIMC helper device * @media_dev: top level media device @@ -99,6 +101,7 @@ struct fimc_md { struct clk *wbclk[FIMC_MAX_WBCLKS]; struct fimc_lite *fimc_lite[FIMC_LITE_MAX_DEVS]; struct fimc_dev *fimc[FIMC_MAX_DEVS]; + struct fimc_is *fimc_is; bool use_isp; struct device *pmf; struct media_device media_dev; @@ -139,4 +142,14 @@ static inline void fimc_md_graph_unlock(struct fimc_dev *fimc) int fimc_md_set_camclk(struct v4l2_subdev *sd, bool on); +#ifdef CONFIG_OF +static inline bool fimc_md_is_isp_available(struct device_node *node) +{ + node = of_get_child_by_name(node, FIMC_IS_OF_NODE_NAME); + return node ? of_device_is_available(node) : false; +} +#else +#define fimc_md_is_isp_available(node) (false) +#endif /* CONFIG_OF */ + #endif