From patchwork Tue Jun 11 08:23:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2701071 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 5BE6B40077 for ; Tue, 11 Jun 2013 10:00:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753649Ab3FKKAn (ORCPT ); Tue, 11 Jun 2013 06:00:43 -0400 Received: from moutng.kundenserver.de ([212.227.126.186]:62872 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753341Ab3FKKAn (ORCPT ); Tue, 11 Jun 2013 06:00:43 -0400 Received: from axis700.grange (dslb-178-001-148-081.pools.arcor-ip.net [178.1.148.81]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0LcFAj-1U3KvB2ozd-00jN47; Tue, 11 Jun 2013 11:30:37 +0200 Received: from 6a.grange (unknown [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id E52C640BC3; Tue, 11 Jun 2013 10:24:04 +0200 (CEST) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1UmJs4-0002BR-Fa; 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 06/21] mx3-camera: move interface activation and deactivation to clock callbacks Date: Tue, 11 Jun 2013 10:23:33 +0200 Message-Id: <1370939028-8352-7-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:/yRjYJKWF6ZduYM6jkJ95XYA5e/NvRV7vyGsjgWqhRw 1GxfQAA3eS3iE5nLDUh95MF7RL8pCtaxc3JskuOS+PNoAVslSU Z+nJYuaNJ05QWZe11IAmrHwp8uHrgj4VrZAysUH+kx9WipP3g5 z8mIeol253B9dm2QIloivUmlN60g+RWzLgRrEWBFYuOXvWv83I o3u71GlLLcCkwkq6EyRky8WIxTY1cSps9CejCqxobpo2eZTyq3 adhmM9Q4Mu/AgDYlxV2XpwOUDgAfo7vxtTenIJALnf8fvb2FJc jPirOiXXk2ykQPFID+IIegOYxRDt7YiOwnM8lYZ0ufsZiBG8T4 nvcDDlROV5dWr1M8dPl1O4WAht+K1H1J1pFUK9jNphsQIs6uCU xVeruoYxlCsog== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org When adding and removing a client, the mx3-camera driver only activates and deactivates its camera interface respectively, which doesn't include any client-specific actions. Move this functionality into .clock_start() and .clock_stop() callbacks. Signed-off-by: Guennadi Liakhovetski --- drivers/media/platform/soc_camera/mx3_camera.c | 35 ++++++++++++++--------- 1 files changed, 21 insertions(+), 14 deletions(-) diff --git a/drivers/media/platform/soc_camera/mx3_camera.c b/drivers/media/platform/soc_camera/mx3_camera.c index 71b9b19..1047e3e 100644 --- a/drivers/media/platform/soc_camera/mx3_camera.c +++ b/drivers/media/platform/soc_camera/mx3_camera.c @@ -460,8 +460,7 @@ static int mx3_camera_init_videobuf(struct vb2_queue *q, } /* First part of ipu_csi_init_interface() */ -static void mx3_camera_activate(struct mx3_camera_dev *mx3_cam, - struct soc_camera_device *icd) +static void mx3_camera_activate(struct mx3_camera_dev *mx3_cam) { u32 conf; long rate; @@ -505,31 +504,40 @@ static void mx3_camera_activate(struct mx3_camera_dev *mx3_cam, clk_prepare_enable(mx3_cam->clk); rate = clk_round_rate(mx3_cam->clk, mx3_cam->mclk); - dev_dbg(icd->parent, "Set SENS_CONF to %x, rate %ld\n", conf, rate); + dev_dbg(mx3_cam->soc_host.v4l2_dev.dev, "Set SENS_CONF to %x, rate %ld\n", conf, rate); if (rate) clk_set_rate(mx3_cam->clk, rate); } -/* Called with .host_lock held */ static int mx3_camera_add_device(struct soc_camera_device *icd) { - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); + dev_info(icd->parent, "MX3 Camera driver attached to camera %d\n", + icd->devnum); + + return 0; +} + +static void mx3_camera_remove_device(struct soc_camera_device *icd) +{ + dev_info(icd->parent, "MX3 Camera driver detached from camera %d\n", + icd->devnum); +} + +/* Called with .host_lock held */ +static int mx3_camera_clock_start(struct soc_camera_host *ici) +{ struct mx3_camera_dev *mx3_cam = ici->priv; - mx3_camera_activate(mx3_cam, icd); + mx3_camera_activate(mx3_cam); mx3_cam->buf_total = 0; - dev_info(icd->parent, "MX3 Camera driver attached to camera %d\n", - icd->devnum); - return 0; } /* Called with .host_lock held */ -static void mx3_camera_remove_device(struct soc_camera_device *icd) +static void mx3_camera_clock_stop(struct soc_camera_host *ici) { - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); struct mx3_camera_dev *mx3_cam = ici->priv; struct idmac_channel **ichan = &mx3_cam->idmac_channel[0]; @@ -539,9 +547,6 @@ static void mx3_camera_remove_device(struct soc_camera_device *icd) } clk_disable_unprepare(mx3_cam->clk); - - dev_info(icd->parent, "MX3 Camera driver detached from camera %d\n", - icd->devnum); } static int test_platform_param(struct mx3_camera_dev *mx3_cam, @@ -1124,6 +1129,8 @@ static struct soc_camera_host_ops mx3_soc_camera_host_ops = { .owner = THIS_MODULE, .add = mx3_camera_add_device, .remove = mx3_camera_remove_device, + .clock_start = mx3_camera_clock_start, + .clock_stop = mx3_camera_clock_stop, .set_crop = mx3_camera_set_crop, .set_fmt = mx3_camera_set_fmt, .try_fmt = mx3_camera_try_fmt,