From patchwork Tue Jun 11 08:23:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2700881 Return-Path: X-Original-To: patchwork-linux-sh@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 DC6B9DF23A for ; Tue, 11 Jun 2013 09:27:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753725Ab3FKJ1s (ORCPT ); Tue, 11 Jun 2013 05:27:48 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:50157 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753855Ab3FKJ1r (ORCPT ); Tue, 11 Jun 2013 05:27:47 -0400 Received: from axis700.grange (dslb-178-001-148-081.pools.arcor-ip.net [178.1.148.81]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0MW7OX-1Ut77q1J0r-00XsgT; Tue, 11 Jun 2013 11:27:16 +0200 Received: from 6a.grange (unknown [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id 8A12640BB3; Tue, 11 Jun 2013 10:24:04 +0200 (CEST) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1UmJs4-0002BF-7a; Tue, 11 Jun 2013 10:24:04 +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 v10 02/21] soc-camera: add host clock callbacks to start and stop the master clock Date: Tue, 11 Jun 2013 10:23:29 +0200 Message-Id: <1370939028-8352-3-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1370939028-8352-1-git-send-email-g.liakhovetski@gmx.de> References: <1370939028-8352-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:rbG/hB18i0fh4YTepnUKIOBq4R62hYfZ+7RGYTyMvVs 5WohnHSitmrCfiYrmZ1c49GikxissjP3zyMQD6a01Z9CadIEKY sfmvzmxxypTqQHMFrZzs4c68oh3mrLJQ+mNAz54+LjZM+6TUg5 7VYt4DqUgM3Xoohzgqq+AWC7dzT75Gdt3ZkPHjqDSUTdU1q2CJ J47vmUzi19L8IqqA283RIN7LDWaAtbiGfm2BhuM2pmRKFDLCRh msj/XXCcirRqWE+gOQEoWDolP9s4uSRF8i400+7r1ocb/QGBul 9+Ub7xSmT9PgvebXt0jZpb3BzO+mjbAdOnea6go4f34ITSg6hA blJ0wZ1qbLpKXSA9y3gItta/YZphMFv4v6P54xKFT7036Z2dFl f73HFcBDMZJ0w== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org 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