From patchwork Fri May 31 14:37:24 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: 2644341 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 0481CDFE82 for ; Fri, 31 May 2013 14:41:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755633Ab3EaOlS (ORCPT ); Fri, 31 May 2013 10:41:18 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:63489 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755335Ab3EaOlN (ORCPT ); Fri, 31 May 2013 10:41:13 -0400 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MNO0013V3GOA000@mailout4.samsung.com> for linux-media@vger.kernel.org; Fri, 31 May 2013 23:41:12 +0900 (KST) X-AuditID: cbfee61a-b7f3b6d000006edd-2a-51a8b6888668 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id F7.D0.28381.886B8A15; Fri, 31 May 2013 23:41:12 +0900 (KST) Received: from amdc1344.digital.local ([106.116.147.32]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MNO00BWU3ALE760@mmp1.samsung.com>; Fri, 31 May 2013 23:41:12 +0900 (KST) From: Sylwester Nawrocki To: linux-media@vger.kernel.org Cc: laurent.pinchart@ideasonboard.com, hj210.choi@samsung.com, arun.kk@samsung.com, shaik.ameer@samsung.com, kyungmin.park@samsung.com, Sylwester Nawrocki Subject: [REVIEW PATCH v2 08/11] exynos4-is: Fix sensor subdev -> FIMC notification setup Date: Fri, 31 May 2013 16:37:24 +0200 Message-id: <1370011047-11488-9-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1370011047-11488-1-git-send-email-s.nawrocki@samsung.com> References: <1370011047-11488-1-git-send-email-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupkluLIzCtJLcpLzFFi42I5/e+xgG7HthWBBnu+y1l8PHWb1eLxxmvM Fmeb3rBbdE5cwm7Rs2Erq8XhN+2sFkce7mZ3YPeY3TGT1aNvyypGj8+b5AKYo7hsUlJzMstS i/TtErgyZj35wl5wQbZi79/bTA2MLRJdjJwcEgImEq8ubmWEsMUkLtxbz9bFyMUhJLCIUWL6 5QmsIAkhgQ4miQuHmUFsNgFDid6jfWANIgLyEk96b4A1MAtsZ5Q4s2wVWJGwQLTEk4m72UFs FgFVib4X21lAbF4BN4mv62YBNXAAbVOQmDPJBiTMKeAucfjjUjaIXW4SR9v/sE9g5F3AyLCK UTS1ILmgOCk911CvODG3uDQvXS85P3cTIziAnkntYFzZYHGIUYCDUYmH12DFikAh1sSy4src Q4wSHMxKIrz5c4BCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeQ+0WgcKCaQnlqRmp6YWpBbBZJk4 OKUaGG1n1c78OkXbRPXEmtTZ/K/Djl5SOHb4qmjWuW/2XFU8nxhiJ03SXL12N4/w1NqTOR76 sSLpYeyMG8OzpjAaZ7zfvlC6PXI7z1v+nxfLeoXDU9pY909axi9q9F8j2f2pXaTr4hLZbxMN e85IRlus2nrsZvs6pymtVevsfFmvef4U+vv08oq8P0osxRmJhlrMRcWJAIssVM8cAgAA Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Ensure the v4l2_device notifications from sensor subdev works also after the media links reconfiguration. Signed-off-by: Sylwester Nawrocki Signed-off-by: Kyungmin Park --- drivers/media/platform/exynos4-is/media-dev.c | 47 ++++++++++++++++--------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c index 973f8a9..d7f7342 100644 --- a/drivers/media/platform/exynos4-is/media-dev.c +++ b/drivers/media/platform/exynos4-is/media-dev.c @@ -1,8 +1,8 @@ /* * S5P/EXYNOS4 SoC series camera host interface media device driver * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. - * Sylwester Nawrocki + * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. + * Author: Sylwester Nawrocki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published @@ -39,6 +39,26 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd, struct fimc_source_info *si, bool on); + +/* Set up image sensor subdev -> FIMC capture node notifications. */ +static void __setup_sensor_notification(struct fimc_md *fmd, + struct v4l2_subdev *sensor, + struct v4l2_subdev *fimc_sd) +{ + struct fimc_source_info *src_inf; + struct fimc_sensor_info *md_si; + unsigned long flags; + + src_inf = v4l2_get_subdev_hostdata(sensor); + if (!src_inf || WARN_ON(fmd == NULL)) + return; + + md_si = source_to_sensor_info(src_inf); + spin_lock_irqsave(&fmd->slock, flags); + md_si->host = v4l2_get_subdevdata(fimc_sd); + spin_unlock_irqrestore(&fmd->slock, flags); +} + /** * fimc_pipeline_prepare - update pipeline information with subdevice pointers * @me: media entity terminating the pipeline @@ -48,7 +68,9 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd, static void fimc_pipeline_prepare(struct fimc_pipeline *p, struct media_entity *me) { + struct fimc_md *fmd = entity_to_fimc_mdev(me); struct v4l2_subdev *sd; + struct v4l2_subdev *sensor = NULL; int i; for (i = 0; i < IDX_MAX; i++) @@ -73,8 +95,10 @@ static void fimc_pipeline_prepare(struct fimc_pipeline *p, sd = media_entity_to_v4l2_subdev(pad->entity); switch (sd->grp_id) { - case GRP_ID_FIMC_IS_SENSOR: case GRP_ID_SENSOR: + sensor = sd; + /* fall through */ + case GRP_ID_FIMC_IS_SENSOR: p->subdevs[IDX_SENSOR] = sd; break; case GRP_ID_CSIS: @@ -84,7 +108,7 @@ static void fimc_pipeline_prepare(struct fimc_pipeline *p, p->subdevs[IDX_FLITE] = sd; break; case GRP_ID_FIMC: - /* No need to control FIMC subdev through subdev ops */ + p->subdevs[IDX_FIMC] = sd; break; case GRP_ID_FIMC_IS: p->subdevs[IDX_IS_ISP] = sd; @@ -96,6 +120,9 @@ static void fimc_pipeline_prepare(struct fimc_pipeline *p, if (me->num_pads == 1) break; } + + if (sensor && p->subdevs[IDX_FIMC]) + __setup_sensor_notification(fmd, sensor, p->subdevs[IDX_FIMC]); } /** @@ -923,18 +950,6 @@ static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd, v4l2_info(&fmd->v4l2_dev, "created link [%s] %c> [%s]\n", source->name, flags ? '=' : '-', sink->name); - - if (flags == 0 || sensor == NULL) - continue; - - if (!WARN_ON(si == NULL)) { - unsigned long irq_flags; - struct fimc_sensor_info *inf = source_to_sensor_info(si); - - spin_lock_irqsave(&fmd->slock, irq_flags); - inf->host = fmd->fimc[i]; - spin_unlock_irqrestore(&fmd->slock, irq_flags); - } } for (i = 0; i < FIMC_LITE_MAX_DEVS; i++) {