From patchwork Wed Oct 8 08:46:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacek Anaszewski X-Patchwork-Id: 5052231 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BE369C11AB for ; Wed, 8 Oct 2014 08:47:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DEF9E201F2 for ; Wed, 8 Oct 2014 08:47:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ED0EC2018E for ; Wed, 8 Oct 2014 08:47:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755065AbaJHIrU (ORCPT ); Wed, 8 Oct 2014 04:47:20 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:44463 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754957AbaJHIrQ (ORCPT ); Wed, 8 Oct 2014 04:47:16 -0400 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0ND400KKPB2JQU80@mailout1.samsung.com> for linux-media@vger.kernel.org; Wed, 08 Oct 2014 17:47:07 +0900 (KST) X-AuditID: cbfee61a-f79c06d000004e71-53-5434fa0ae20b Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 71.42.20081.A0AF4345; Wed, 08 Oct 2014 17:47:06 +0900 (KST) Received: from AMDC2362.DIGITAL.local ([106.120.53.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0ND400IRIB275M60@mmp1.samsung.com>; Wed, 08 Oct 2014 17:47:06 +0900 (KST) From: Jacek Anaszewski To: linux-media@vger.kernel.org, kyungmin.park@samsung.com Cc: s.nawrocki@samsung.com Subject: [PATCH 2/3] exynos4-is: Add support for asynchronous sub-devices power on Date: Wed, 08 Oct 2014 10:46:52 +0200 Message-id: <1412758013-23608-2-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1412758013-23608-1-git-send-email-j.anaszewski@samsung.com> References: <1412758013-23608-1-git-send-email-j.anaszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrAJMWRmVeSWpSXmKPExsVy+t9jAV2uXyYhBvPW2FicbXrDbtGzYSur xeE37awOzB59W1YxenzeJBfAFMVlk5Kak1mWWqRvl8CVcefYXsaCdxIVs6c/YW9g3CnSxcjJ ISFgItHU+JcNwhaTuHBvPZDNxSEksIhR4tSrfiinnUmiZeE1sCo2AUOJny9eM4HYIgJWEhu2 v2IFsZkFpCSub1zNDmILC4RIfJtzhhnEZhFQldjfdhOsnlfAQ+LB+k1AcziAtilIzJlkAxLm FPCUOL7wAVirEFDJ/y/X2SYw8i5gZFjFKJpakFxQnJSea6hXnJhbXJqXrpecn7uJERwOz6R2 MK5ssDjEKMDBqMTDa9BsEiLEmlhWXJl7iFGCg1lJhFfyBFCINyWxsiq1KD++qDQntfgQozQH i5I474FW60AhgfTEktTs1NSC1CKYLBMHp1QDY1ubFdPFW7H+QoGGAm0+N5eJXop+dDbAYdv7 M1kGLcHuG674rHj78wOfUaHbFWbjFeGzfnf/su/xzSvqrX4qV7hQUPGdQbvy3pvf6owDTb2n vf+94+RkpuXnC7r2eu4+t2xxt8eilurZ33Y2pj1Kcl4i/DOcLzew1KB0Z/p2q2qRi+r3V9mm K7EUZyQaajEXFScCADRSJdEDAgAA Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sylwester Nawrocki Schedule sub-devices power up in separate thread to speed up video device open and to allow some ioctls, like VIDIOC_REQBUFS to be run in parallel. We synchronize with completion of the power up sequence before starting streaming on subdevices, as they require to be powered up before being starting streaming. Signed-off-by: Sylwester Nawrocki Acked-by: Kyungmin Park --- drivers/media/platform/exynos4-is/media-dev.c | 19 +++++++++++++++---- include/media/exynos-fimc.h | 2 ++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c index 344718d..c867c46 100644 --- a/drivers/media/platform/exynos4-is/media-dev.c +++ b/drivers/media/platform/exynos4-is/media-dev.c @@ -10,6 +10,7 @@ * or (at your option) any later version. */ +#include #include #include #include @@ -186,6 +187,13 @@ error: return ret; } +static void __fimc_pipeline_power_async(void *data, async_cookie_t cookie) +{ + struct fimc_pipeline *p = data; + + WARN_ON(fimc_pipeline_s_power(p, true) < 0); +} + /** * __fimc_pipeline_open - update the pipeline information, enable power * of all pipeline subdevs and the sensor clock @@ -219,14 +227,13 @@ static int __fimc_pipeline_open(struct exynos_media_pipeline *ep, return ret; } - ret = fimc_pipeline_s_power(p, 1); - if (!ret) - return 0; + async_schedule_domain(__fimc_pipeline_power_async, p, + &ep->async_domain); if (!IS_ERR(fmd->wbclk[CLK_IDX_WB_B]) && p->subdevs[IDX_IS_ISP]) clk_disable_unprepare(fmd->wbclk[CLK_IDX_WB_B]); - return ret; + return 0; } /** @@ -275,6 +282,9 @@ static int __fimc_pipeline_s_stream(struct exynos_media_pipeline *ep, bool on) if (p->subdevs[IDX_SENSOR] == NULL) return -ENODEV; + /* Wait until all devices in the chain are powered up */ + async_synchronize_full_domain(&ep->async_domain); + for (i = 0; i < IDX_MAX; i++) { unsigned int idx = seq[on][i]; @@ -309,6 +319,7 @@ static struct exynos_media_pipeline *fimc_md_pipeline_create( return NULL; list_add_tail(&p->list, &fmd->pipelines); + async_domain_init_exclusive(&p->ep.async_domain); p->ep.ops = &fimc_pipeline_ops; return &p->ep; diff --git a/include/media/exynos-fimc.h b/include/media/exynos-fimc.h index aa44660..ed779de 100644 --- a/include/media/exynos-fimc.h +++ b/include/media/exynos-fimc.h @@ -12,6 +12,7 @@ #ifndef S5P_FIMC_H_ #define S5P_FIMC_H_ +#include #include #include #include @@ -146,6 +147,7 @@ struct exynos_video_entity { struct exynos_media_pipeline { struct media_pipeline mp; const struct exynos_media_pipeline_ops *ops; + struct async_domain async_domain; }; static inline struct exynos_video_entity *vdev_to_exynos_video_entity(