From patchwork Thu Apr 19 15:41:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Kocialkowski X-Patchwork-Id: 10351077 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DBC0E60550 for ; Thu, 19 Apr 2018 15:47:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDF6728718 for ; Thu, 19 Apr 2018 15:47:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC0AD28AD0; Thu, 19 Apr 2018 15:47:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C34A28AB2 for ; Thu, 19 Apr 2018 15:44:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753347AbeDSPnz (ORCPT ); Thu, 19 Apr 2018 11:43:55 -0400 Received: from mail.bootlin.com ([62.4.15.54]:42498 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753002AbeDSPnw (ORCPT ); Thu, 19 Apr 2018 11:43:52 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 06EDC20867; Thu, 19 Apr 2018 17:43:50 +0200 (CEST) Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.bootlin.com (Postfix) with ESMTPSA id 8DF9E20824; Thu, 19 Apr 2018 17:43:49 +0200 (CEST) From: Paul Kocialkowski To: linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Cc: Mauro Carvalho Chehab , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Pawel Osciak , Marek Szyprowski , Kyungmin Park , Hans Verkuil , Sakari Ailus , Philipp Zabel , Arnd Bergmann , Alexandre Courbot , Tomasz Figa , Paul Kocialkowski Subject: [PATCH v2 02/10] media-request: Add a request complete operation to allow m2m scheduling Date: Thu, 19 Apr 2018 17:41:16 +0200 Message-Id: <20180419154124.17512-3-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180419154124.17512-1-paul.kocialkowski@bootlin.com> References: <20180419154124.17512-1-paul.kocialkowski@bootlin.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When using the request API in the context of a m2m driver, the operations that come with a m2m run scheduling call in their (m2m-specific) ioctl handler are delayed until the request is queued (for instance, this includes queuing buffers and streamon). Thus, the m2m run scheduling calls are not called in due time since the request AP's internal plumbing will (rightfully) use the relevant core functions directly instead of the ioctl handler. This ends up in a situation where nothing happens if there is no run-scheduling ioctl called after queuing the request. In order to circumvent the issue, a new media operation is introduced, called at the time of handling the media request queue ioctl. It gives m2m drivers a chance to schedule a m2m device run at that time. The existing req_queue operation cannot be used for this purpose, since it is called with the request queue mutex held, that is eventually needed in the device_run call to apply relevant controls. Signed-off-by: Paul Kocialkowski --- drivers/media/media-request.c | 3 +++ include/media/media-device.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/drivers/media/media-request.c b/drivers/media/media-request.c index 415f7e31019d..28ac5ccfe6a2 100644 --- a/drivers/media/media-request.c +++ b/drivers/media/media-request.c @@ -157,6 +157,9 @@ static long media_request_ioctl_queue(struct media_request *req) media_request_get(req); } + if (mdev->ops->req_complete) + mdev->ops->req_complete(req); + return ret; } diff --git a/include/media/media-device.h b/include/media/media-device.h index 07e323c57202..c7dcf2079cc9 100644 --- a/include/media/media-device.h +++ b/include/media/media-device.h @@ -55,6 +55,7 @@ struct media_entity_notify { * @req_alloc: Allocate a request * @req_free: Free a request * @req_queue: Queue a request + * @req_complete: Complete a request */ struct media_device_ops { int (*link_notify)(struct media_link *link, u32 flags, @@ -62,6 +63,7 @@ struct media_device_ops { struct media_request *(*req_alloc)(struct media_device *mdev); void (*req_free)(struct media_request *req); int (*req_queue)(struct media_request *req); + void (*req_complete)(struct media_request *req); }; /**