From patchwork Fri Jun 14 19:08:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2723171 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 53958C0AB1 for ; Fri, 14 Jun 2013 19:09:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5090B20377 for ; Fri, 14 Jun 2013 19:09:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3212720369 for ; Fri, 14 Jun 2013 19:09:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753565Ab3FNTJR (ORCPT ); Fri, 14 Jun 2013 15:09:17 -0400 Received: from moutng.kundenserver.de ([212.227.126.171]:59909 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752931Ab3FNTJQ (ORCPT ); Fri, 14 Jun 2013 15:09:16 -0400 Received: from axis700.grange (dslb-188-109-039-013.pools.arcor-ip.net [188.109.39.13]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0Lxdhj-1UFmyr01rX-016e75; Fri, 14 Jun 2013 21:08:46 +0200 Received: from 6a.grange (6a.grange [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id 6C3C640BB5; Fri, 14 Jun 2013 21:08:45 +0200 (CEST) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1UnZMb-0003wa-6k; Fri, 14 Jun 2013 21:08:45 +0200 From: Guennadi Liakhovetski To: linux-media@vger.kernel.org Cc: Laurent Pinchart , Sylwester Nawrocki , Hans Verkuil , linux-sh@vger.kernel.org, Magnus Damm , Sakari Ailus , Prabhakar Lad , Sascha Hauer , Guennadi Liakhovetski Subject: [PATCH v11 02/21] soc-camera: add host clock callbacks to start and stop the master clock Date: Fri, 14 Jun 2013 21:08:12 +0200 Message-Id: <1371236911-15131-3-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1371236911-15131-1-git-send-email-g.liakhovetski@gmx.de> References: <1371236911-15131-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:M9WlhEIlq7Ol/RayuSkokHn4RJg5q7tV+PfsQHuo3rS AEDz2MMLq2ZCoQhhoM8J54Kr4Xs9BzWqBhDBc9XdqKzqg1Ygl2 OuDFoGpq2bELSqogMaJSs4oWASHwx0OO66mVIdIP2PF+E7gKcl z4D3jwCavyq3+gYgtbBolgl7TnmOAPyr5YTEekW8CgA5id2K0Q Y/0yBANzEbqx/5ejOJywb+lUTWG4kNLdWhX7XNErKEOOtTDOjy ILSOmaGJKR2zrw0OTcKns+cWVOa0gPu3qWPAtDpN3SFsKCxUK9 si3O4tJ4XJXIMuI1qo03Hh9jZjBpgO55n9/VQNZvNqji76zKbi p/gjwuLQyQRR3XGhcApBVwXrH4aAnabuUhOjGINVG4YSCQapU9 iXuVoRdd0n/bg== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 Currently soc-camera uses a single camera host callback to activate the interface master clock and to configure the interface for a specific client. However, during probing we might not have the information about a client, we just need to activate the clock. Add new camera host driver callbacks to only start and stop the clock without and client-specific configuration. Signed-off-by: Guennadi Liakhovetski --- drivers/media/platform/soc_camera/soc_camera.c | 19 +++++++++++++++++-- include/media/soc_camera.h | 2 ++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index 832f059..df90565 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -513,10 +513,23 @@ static int soc_camera_add_device(struct soc_camera_device *icd) if (ici->icd) return -EBUSY; + if (ici->ops->clock_start) { + ret = ici->ops->clock_start(ici); + if (ret < 0) + return ret; + } + ret = ici->ops->add(icd); - if (!ret) - ici->icd = icd; + if (ret < 0) + goto eadd; + + ici->icd = icd; + return 0; + +eadd: + if (ici->ops->clock_stop) + ici->ops->clock_stop(ici); return ret; } @@ -528,6 +541,8 @@ static void soc_camera_remove_device(struct soc_camera_device *icd) return; ici->ops->remove(icd); + if (ici->ops->clock_stop) + ici->ops->clock_stop(ici); ici->icd = NULL; } diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index 5a46ce2..64415ee 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h @@ -74,6 +74,8 @@ struct soc_camera_host_ops { struct module *owner; int (*add)(struct soc_camera_device *); void (*remove)(struct soc_camera_device *); + int (*clock_start)(struct soc_camera_host *); + void (*clock_stop)(struct soc_camera_host *); /* * .get_formats() is called for each client device format, but * .put_formats() is only called once. Further, if any of the calls to