From patchwork Fri Apr 12 15:40:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2436531 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 5A910DF2A1 for ; Fri, 12 Apr 2013 15:41:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754294Ab3DLPkq (ORCPT ); Fri, 12 Apr 2013 11:40:46 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:52594 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753096Ab3DLPko (ORCPT ); Fri, 12 Apr 2013 11:40:44 -0400 Received: from axis700.grange (dslb-088-076-023-104.pools.arcor-ip.net [88.76.23.104]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0LZlXA-1Uq4fu47NU-00lUff; Fri, 12 Apr 2013 17:40:43 +0200 Received: from 6a.grange (6a.grange [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id B9A8E40BC3; Fri, 12 Apr 2013 17:40:41 +0200 (CEST) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1UQg5h-0004DZ-Bl; Fri, 12 Apr 2013 17:40:41 +0200 From: Guennadi Liakhovetski To: linux-media@vger.kernel.org Cc: Sylwester Nawrocki , Laurent Pinchart , Hans Verkuil , linux-sh@vger.kernel.org, Magnus Damm , Sakari Ailus , Prabhakar Lad Subject: [PATCH v9 08/20] mx3-camera: move interface activation and deactivation to clock callbacks Date: Fri, 12 Apr 2013 17:40:28 +0200 Message-Id: <1365781240-16149-9-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1365781240-16149-1-git-send-email-g.liakhovetski@gmx.de> References: <1365781240-16149-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:mTTkGdL8PWXFXAhrZoVz0s9Wn9ZzdUcgvyb4tsSZFzQ 1eUUG/HOUikJxaWjh6bvrq6eMWnEIVg/cfW9zJf2noSOhLAfZb yuw/K/Q9BwoaSanMD/P6ZFgIJAoabB2fHj3ROn7Mrsd6vSFXu/ RmnnP6IQwpAqHi+8LG8e+v+/4Wtp/VnURJsMlGSr1zktui8UMN lC/xsfhsq4KD+SskpkBJlMypuwfI6AfS6dtlUhHLOyltQhHb/W w63PrgCBrxntmslcS08Mlj1l7STbG5BLFIkd5ILLwH+WGn2fEF mDY+vVrWh8REv7lYb4ImLQT9O6teQ/F5Dg4TDfW9P4b5RGrsXa 8IOqF2FOos59jj5XB8nMfq0tS9nvj/Zi6iApFpOrMFq9hBxc+a qOoS4a3GoL+Ig== 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,