From patchwork Fri Sep 23 20:30:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Jarzmik X-Patchwork-Id: 9348817 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2907B607D0 for ; Fri, 23 Sep 2016 20:33:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 190C42ADD2 for ; Fri, 23 Sep 2016 20:33:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0DA472ADD7; Fri, 23 Sep 2016 20:33:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BB4812ADD2 for ; Fri, 23 Sep 2016 20:33:35 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bnX8q-0001Q6-G5; Fri, 23 Sep 2016 20:32:16 +0000 Received: from smtp12.smtpout.orange.fr ([80.12.242.134] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bnX8R-00011v-9s for linux-arm-kernel@lists.infradead.org; Fri, 23 Sep 2016 20:31:52 +0000 Received: from belgarion.home ([109.220.51.14]) by mwinf5d47 with ME id n8XL1t0050JP8pp038XTLj; Fri, 23 Sep 2016 22:31:27 +0200 X-ME-Helo: belgarion.home X-ME-Date: Fri, 23 Sep 2016 22:31:27 +0200 X-ME-IP: 109.220.51.14 From: Robert Jarzmik To: Mike Rapoport , Daniel Mack , Haojian Zhuang , Robert Jarzmik , Daniel Ribeiro , Stefan Schmidt , Harald Welte Subject: [PATCH 3/3] ARM: pxa: em-x270: use the new pxa_camera platform_data Date: Fri, 23 Sep 2016 22:30:54 +0200 Message-Id: <1474662654-23263-3-git-send-email-robert.jarzmik@free.fr> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1474662654-23263-1-git-send-email-robert.jarzmik@free.fr> References: <1474662654-23263-1-git-send-email-robert.jarzmik@free.fr> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160923_133151_913355_6015FABF X-CRM114-Status: GOOD ( 14.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: openezx-devel@lists.openezx.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP pxa_camera has transitioned from a soc_camera driver to a standalone v4l2 driver. Amend the device declaration accordingly. Signed-off-by: Robert Jarzmik --- arch/arm/mach-pxa/em-x270.c | 85 ++++++++++++++------------------------------- 1 file changed, 27 insertions(+), 58 deletions(-) diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c index 03354c21e1f2..2d7762ab1d70 100644 --- a/arch/arm/mach-pxa/em-x270.c +++ b/arch/arm/mach-pxa/em-x270.c @@ -34,8 +34,6 @@ #include #include -#include - #include #include @@ -969,81 +967,52 @@ static int em_x270_sensor_init(void) return ret; gpio_direction_output(cam_reset, 0); - - em_x270_camera_ldo = regulator_get(NULL, "vcc cam"); - if (em_x270_camera_ldo == NULL) { - gpio_free(cam_reset); - return -ENODEV; - } - - ret = regulator_enable(em_x270_camera_ldo); - if (ret) { - regulator_put(em_x270_camera_ldo); - gpio_free(cam_reset); - return ret; - } - gpio_set_value(cam_reset, 1); return 0; } -struct pxacamera_platform_data em_x270_camera_platform_data = { - .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 | - PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN, - .mclk_10khz = 2600, +static struct regulator_consumer_supply camera_dummy_supplies[] = { + REGULATOR_SUPPLY("vdd", "0-005d"), }; -static int em_x270_sensor_power(struct device *dev, int on) -{ - int ret; - int is_on = regulator_is_enabled(em_x270_camera_ldo); - - if (on == is_on) - return 0; - - gpio_set_value(cam_reset, !on); - - if (on) - ret = regulator_enable(em_x270_camera_ldo); - else - ret = regulator_disable(em_x270_camera_ldo); - - if (ret) - return ret; - - gpio_set_value(cam_reset, on); - - return 0; -} - -static struct i2c_board_info em_x270_i2c_cam_info[] = { - { - I2C_BOARD_INFO("mt9m111", 0x48), +static struct regulator_init_data camera_dummy_initdata = { + .consumer_supplies = camera_dummy_supplies, + .num_consumer_supplies = ARRAY_SIZE(camera_dummy_supplies), + .constraints = { + .valid_ops_mask = REGULATOR_CHANGE_STATUS, }, }; -static struct soc_camera_link iclink = { - .bus_id = 0, - .power = em_x270_sensor_power, - .board_info = &em_x270_i2c_cam_info[0], - .i2c_adapter_id = 0, +static struct fixed_voltage_config camera_dummy_config = { + .supply_name = "camera_vdd", + .input_supply = "vcc cam", + .microvolts = 2800000, + .gpio = GPIO56_MT9M111_nOE, + .enable_high = 0, + .init_data = &camera_dummy_initdata, }; -static struct platform_device em_x270_camera = { - .name = "soc-camera-pdrv", - .id = -1, +static struct platform_device camera_supply_dummy_device = { + .name = "reg-fixed-voltage", + .id = 1, .dev = { - .platform_data = &iclink, + .platform_data = &camera_dummy_config, }, }; +struct pxacamera_platform_data em_x270_camera_platform_data = { + .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 | + PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN, + .mclk_10khz = 2600, + .sensor_i2c_adapter_id = 0, + .sensor_i2c_address = 0x5d, +}; + static void __init em_x270_init_camera(void) { - if (em_x270_sensor_init() == 0) { + if (em_x270_sensor_init() == 0) pxa_set_camera_info(&em_x270_camera_platform_data); - platform_device_register(&em_x270_camera); - } } #else static inline void em_x270_init_camera(void) {}