From patchwork Thu Apr 18 21:35: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: 2462681 Return-Path: X-Original-To: patchwork-linux-media@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 17B86DF2E5 for ; Thu, 18 Apr 2013 21:36:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936500Ab3DRVgr (ORCPT ); Thu, 18 Apr 2013 17:36:47 -0400 Received: from moutng.kundenserver.de ([212.227.17.9]:58811 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936435Ab3DRVf5 (ORCPT ); Thu, 18 Apr 2013 17:35:57 -0400 Received: from axis700.grange (dslb-088-077-162-170.pools.arcor-ip.net [88.77.162.170]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0LvzLR-1UayLR0Y1t-017p4b; Thu, 18 Apr 2013 23:35:56 +0200 Received: from 6a.grange (6a.grange [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id 196F840BC4; Thu, 18 Apr 2013 23:35:55 +0200 (CEST) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1USwUk-0005dR-LK; Thu, 18 Apr 2013 23:35:54 +0200 From: Guennadi Liakhovetski To: linux-media@vger.kernel.org Cc: Laurent Pinchart , Guennadi Liakhovetski Subject: [PATCH 07/24] soc-camera: switch to using the new struct v4l2_subdev_platform_data Date: Thu, 18 Apr 2013 23:35:28 +0200 Message-Id: <1366320945-21591-8-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1366320945-21591-1-git-send-email-g.liakhovetski@gmx.de> References: <1366320945-21591-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:gSgl+BsPVYW66M8WTdqUe8bQG/ZlxK3DKLQ4UvoS5ie F0EQoUsMA/MHzZmz/PdlxivuyavXmOin9Sh8BgPV8NOSiDYodA 0cV2i+2tsDMV+a495u+xIAvbdVU+/CbMA2orKcQO+qqycei0Gl uCKIWrhR7RNj8EljF2l+Va5o3XXrUBGAkPx+4DR+vINQEu0qXc 8se4I43LEpT3QuEkebNRrILqvuFPecntnCqEKGrCLYoacvAMLI YEq42xZ45nddssGSGeeeRNP5oAttGowmK4CPcVxdyf4SQSynKo RyWs7vcruZkxUseu/M1q6Z3XJiw+KG7zhw0YtM7zvfRDhKNz/k P6n3A1wU0U2HN3CS2WEyaYF5uKlyR26HKkjjMEHJkMnUGRFwWF Mm7qGbRLV5qpg== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This prepares soc-camera to use struct v4l2_subdev_platform_data for its subdevice-facing API, which would allow subdevice driver re-use. Signed-off-by: Guennadi Liakhovetski --- drivers/media/platform/soc_camera/soc_camera.c | 20 ++++++++++---------- include/media/soc_camera.h | 17 +++++++++-------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index a790f81..c06e660 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -76,8 +76,8 @@ int soc_camera_power_on(struct device *dev, struct soc_camera_subdev_desc *ssdd, dev_err(dev, "Cannot enable clock: %d\n", ret); return ret; } - ret = regulator_bulk_enable(ssdd->num_regulators, - ssdd->regulators); + ret = regulator_bulk_enable(ssdd->sd_pdata.num_regulators, + ssdd->sd_pdata.regulators); if (ret < 0) { dev_err(dev, "Cannot enable regulators\n"); goto eregenable; @@ -95,8 +95,8 @@ int soc_camera_power_on(struct device *dev, struct soc_camera_subdev_desc *ssdd, return 0; epwron: - regulator_bulk_disable(ssdd->num_regulators, - ssdd->regulators); + regulator_bulk_disable(ssdd->sd_pdata.num_regulators, + ssdd->sd_pdata.regulators); eregenable: if (clk) v4l2_clk_disable(clk); @@ -120,8 +120,8 @@ int soc_camera_power_off(struct device *dev, struct soc_camera_subdev_desc *ssdd } } - err = regulator_bulk_disable(ssdd->num_regulators, - ssdd->regulators); + err = regulator_bulk_disable(ssdd->sd_pdata.num_regulators, + ssdd->sd_pdata.regulators); if (err < 0) { dev_err(dev, "Cannot disable regulators\n"); ret = ret ? : err; @@ -137,8 +137,8 @@ EXPORT_SYMBOL(soc_camera_power_off); int soc_camera_power_init(struct device *dev, struct soc_camera_subdev_desc *ssdd) { - return devm_regulator_bulk_get(dev, ssdd->num_regulators, - ssdd->regulators); + return devm_regulator_bulk_get(dev, ssdd->sd_pdata.num_regulators, + ssdd->sd_pdata.regulators); } EXPORT_SYMBOL(soc_camera_power_init); @@ -2033,8 +2033,8 @@ static int soc_camera_pdrv_probe(struct platform_device *pdev) * in soc_camera_async_bind(). Also note, that in that case regulators * are attached to the I2C device and not to the camera platform device. */ - ret = devm_regulator_bulk_get(&pdev->dev, ssdd->num_regulators, - ssdd->regulators); + ret = devm_regulator_bulk_get(&pdev->dev, ssdd->sd_pdata.num_regulators, + ssdd->sd_pdata.regulators); if (ret < 0) return ret; diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index 2d3c939..1331278 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h @@ -146,10 +146,6 @@ struct soc_camera_subdev_desc { /* sensor driver private platform data */ void *drv_priv; - /* Optional regulators that have to be managed on power on/off events */ - struct regulator_bulk_data *regulators; - int num_regulators; - /* Optional callbacks to power on or off and reset the sensor */ int (*power)(struct device *, int); int (*reset)(struct device *); @@ -162,6 +158,9 @@ struct soc_camera_subdev_desc { int (*set_bus_param)(struct soc_camera_subdev_desc *, unsigned long flags); unsigned long (*query_bus_param)(struct soc_camera_subdev_desc *); void (*free_bus)(struct soc_camera_subdev_desc *); + + /* Optional regulators that have to be managed on power on/off events */ + struct v4l2_subdev_platform_data sd_pdata; }; struct soc_camera_host_desc { @@ -202,10 +201,6 @@ struct soc_camera_link { void *priv; - /* Optional regulators that have to be managed on power on/off events */ - struct regulator_bulk_data *regulators; - int num_regulators; - /* Optional callbacks to power on or off and reset the sensor */ int (*power)(struct device *, int); int (*reset)(struct device *); @@ -218,6 +213,12 @@ struct soc_camera_link { unsigned long (*query_bus_param)(struct soc_camera_link *); void (*free_bus)(struct soc_camera_link *); + /* Optional regulators that have to be managed on power on/off events */ + struct regulator_bulk_data *regulators; + int num_regulators; + + void *host_priv; + /* * Host part - keep at bottom and compatible to * struct soc_camera_host_desc