From patchwork Mon May 7 15:56:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Miguel Silva X-Patchwork-Id: 135100 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp3327130lji; Mon, 7 May 2018 08:57:40 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoSNSXiThlp1NmXV/lCC1cfKyAKLA2fA87dKJLvHkM2dG67hWOsCS3oiBfDSyxIBttQ2zC9 X-Received: by 2002:a24:fe44:: with SMTP id w65-v6mr1844001ith.87.1525708660664; Mon, 07 May 2018 08:57:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525708660; cv=none; d=google.com; s=arc-20160816; b=MZB5vmFHv6eqs4UrzIWkuntFg4LZJcSi47q/PE0rMgrXstO3l3AaQjjfgCdB3PBRJX 427NICR1hSspcIBRgIib3Gj74wmR/kMstpru7bdLiQkue2B33ChLVbRpK+zViT43I7i8 uXDG1OhjInWHBJMU4E5XzxfC9217dYsEdo9wxU+ysczVXPbOnciSnimLuCwqG1mPiqiQ Sk8qaRjM/9o13KD/aniUhnJA1qsjYAfMCl0i/La7rdUfNLQB/Q1EjfnaBGbAYOYKpe30 on2VVk9OvHOwVngRBdTNPby7scshOmV+qGK4vT8TGNXbb6Y9IR+jF8Jd/R5tbjefb9N9 gClA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=L0KrQJUX/USzCnLuAgRDSfPJN85+IlJ77B8258UE/cY=; b=OhhprxlyHyDFbFWn4g7zwzGs9/mP0s9QOW6AbDYfwv2unFTOmAZA8SBiYcjIeHN7Fh 38Ps6RsgT3EeOHUr/ivoc3gVHW6qN+477kiEcIFxdMVJHBijbBeJe933+EXFf2IT+Dk0 G5TNLIOvm0OTElBUbGw0h87lYAsITZxgSLW3GLsRizG6FqpUchy3yMAXGFBewOscmLmh dQn60Mrfyg8iHNoxHjFwaUuI6E3NJrR1+K6c2pq12JXC5J+IkiBBg5C7S3ohuTaeai3s LP+UR3MmrN2ePllkQYhhJdZnoJ3C6grj0eL9xvQ/0mFP+c+uAHk+xBepx3/p1x31ZfhV IsAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PUk5E4Ic; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f21-v6si19619791iob.61.2018.05.07.08.57.40; Mon, 07 May 2018 08:57:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PUk5E4Ic; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752784AbeEGP5h (ORCPT + 6 others); Mon, 7 May 2018 11:57:37 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33785 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752624AbeEGP5e (ORCPT ); Mon, 7 May 2018 11:57:34 -0400 Received: by mail-wm0-f66.google.com with SMTP id x12-v6so15692932wmc.0 for ; Mon, 07 May 2018 08:57:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+x0bAEsmv7inIq+1mNI95oLPU8nfMQ0rHpCgtJvHgl0=; b=PUk5E4IcptpDtya76SaTXhvcpnI2k0kPMFp6gWbpxzxmKr0ZsiGzLRiyss+0YQ62ui KhiAUiHt2+LGp+zK8STPogcJktyHBmJdqusIBKc4z6D4R+PCEkjFh1dUfRo0arD43ji1 vlP5lD6WhogOWLUuDHXxUOnO37akq+LmlmuKo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+x0bAEsmv7inIq+1mNI95oLPU8nfMQ0rHpCgtJvHgl0=; b=BDXrlduNPlBBMwnewAQrwWzmJTFuLkZTi4dqmnHwJRIjAp/lPowroSLRpEcelaV5Ar m5hM3ThYYJ1iaDuLmDHQHFbgwLSkrDIwQWssoe5yOX/iD4Ucvaad8SWQHa1dO0pbJiI/ eeqBNBCIZtN9Sjf3v1/dusswYd3SMzbHHeZ/4TDmXPM6KfKHuVO5UomlC7Y4uPBZoftK K+HrhjSDxVRIfkxov2yeW+fRk4F1tKUbpmTrYS6LdyLVJtdPNWeeTXafg+pQdFjSvHl8 D/MKK2p/6KdB9G8BhwJg0oG5pQFwAxgDFYRwZ3CO2FC9z+nrzDDJPW6f6B4OS2uiX+8c rcSg== X-Gm-Message-State: ALKqPwc/+TR8d2Ie0fmj+H+CViqctraHkgXR9fGPU8xfKsSNRDUra7Qo xmhG1srfUJwcRlkvB4JmqbR7/A== X-Received: by 2002:a1c:6d97:: with SMTP id b23-v6mr1176075wmi.86.1525708653000; Mon, 07 May 2018 08:57:33 -0700 (PDT) Received: from arch-late.local (a109-49-46-234.cpe.netcabo.pt. [109.49.46.234]) by smtp.gmail.com with ESMTPSA id y42-v6sm32294807wry.21.2018.05.07.08.57.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 May 2018 08:57:32 -0700 (PDT) From: Rui Miguel Silva To: mchehab@kernel.org, sakari.ailus@linux.intel.com, hverkuil@xs4all.nl, Rob Herring Cc: linux-media@vger.kernel.org, Fabio Estevam , devicetree@vger.kernel.org, Ryan Harkin , Rui Miguel Silva Subject: [PATCH 1/4] media: ov2680: dt: add voltage supplies as required Date: Mon, 7 May 2018 16:56:52 +0100 Message-Id: <20180507155655.1555-2-rui.silva@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180507155655.1555-1-rui.silva@linaro.org> References: <20180507155655.1555-1-rui.silva@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The ov2680 needs to control 3 regulators for the voltage supplies and that was missing by the first description, added their description and example here. Signed-off-by: Rui Miguel Silva --- Documentation/devicetree/bindings/media/i2c/ov2680.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -- 2.17.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Documentation/devicetree/bindings/media/i2c/ov2680.txt b/Documentation/devicetree/bindings/media/i2c/ov2680.txt index 0e29f1a113c0..e5d8f130309d 100644 --- a/Documentation/devicetree/bindings/media/i2c/ov2680.txt +++ b/Documentation/devicetree/bindings/media/i2c/ov2680.txt @@ -4,6 +4,9 @@ Required Properties: - compatible: should be "ovti,ov2680". - clocks: reference to the xvclk input clock. - clock-names: should be "xvclk". +- DOVDD-supply: Digital I/O voltage supply. +- DVDD-supply: Digital core voltage supply. +- AVDD-supply: Analog voltage supply. Optional Properties: - powerdown-gpios: reference to the GPIO connected to the powerdown pin, @@ -18,7 +21,7 @@ Endpoint node required properties for CSI-2 connection are: - remote-endpoint: a phandle to the bus receiver's endpoint node. - clock-lanes: should be set to <0> (clock lane on hardware lane 0). - data-lanes: should be set to <1> (one CSI-2 lane supported). - + Example: &i2c2 { @@ -28,6 +31,9 @@ Example: clocks = <&osc>; clock-names = "xvclk"; powerdown-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; + DOVDD-supply = <&sw2_reg>; + DVDD-supply = <&sw2_reg>; + AVDD-supply = <®_peri_3p15v>; port { ov2680_mipi_ep: endpoint { From patchwork Mon May 7 15:56:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Miguel Silva X-Patchwork-Id: 135102 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp3327263lji; Mon, 7 May 2018 08:57:47 -0700 (PDT) X-Google-Smtp-Source: AB8JxZokFYfqOmNQTrHnQ9Lv1iG+LfUikUYAjvCtJh+9fT/8QjB+LOquEwGA7Rua1hG8JcF4aF9o X-Received: by 2002:a24:db57:: with SMTP id c84-v6mr1843067itg.60.1525708667409; Mon, 07 May 2018 08:57:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525708667; cv=none; d=google.com; s=arc-20160816; b=O5KP51CxhJBzcYS6CqrWq3GVArqdtE0R8EK+Mxw9xjFe6rZjlmcJ+CAaHW8rGBv6Bf WhDisEYslEI4ViRoLtqs7BSB9Z3MuoYWqGHxoSTF1y2VAcf8mOEuSN1xK/M6ivxwT2NX 7w8p99EIV12rhfDN0nDAo/nUsuYUah3anfYRMWsmW45X5KTHZLsxxXgPb6YaPfIic9ef vcufl0JVWDmMzTGgN/gkA9hZDDjYO5W5w3ixbQaU0YOy4Vrgz0opZmltQL3UztZgM7af 8o+9cPpINSubMQ+INW2j9mQJabuiwh4rQvFosafZTrWs/RN4VIhaP9FWnx9K+FyUhIYZ 92Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=SmL56eN7cuqIi3nG6ukWJdaxQH/xfcHG0+/TaiIZgx4=; b=fAD5X97sNf9aUF4FIYxR0vUeDj5Lmy86g3vvcjzE1bMrGz5CTLb3R/aF3DMIsd5C1C jNkAGUldxBJlYjCt7jWdVRloIV0DuMvI0/ew1BB39NO1aG2RFocf9zoJtHGH3mVSUREs yt7m4pXoCBqcdlJMt86v13S48J68KEUztjKpSXnWbJz4FDGBjkvHECkLxVztCIZSMgRt x6BfTGiT2ZOVrPLurRK53nxR1iY1uCbG8JzeYxOxo1zQPBYBYQgD/o/nfOToxMaFeBb5 Spwz0NYV2OThO5oCETZgI3sqeJ6LaWIFYOSNCl53sCBi+s1fV1f364tG4kWNLRiwAgVP XsSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DY5jkJ2i; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k124-v6si19537387iok.34.2018.05.07.08.57.47; Mon, 07 May 2018 08:57:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DY5jkJ2i; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752761AbeEGP5o (ORCPT + 6 others); Mon, 7 May 2018 11:57:44 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:39918 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752781AbeEGP5m (ORCPT ); Mon, 7 May 2018 11:57:42 -0400 Received: by mail-wr0-f194.google.com with SMTP id q3-v6so29287607wrj.6 for ; Mon, 07 May 2018 08:57:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3OeSCMQTnB5Zbn37nOARIKXFybH8gj/fV34v2WcaUfM=; b=DY5jkJ2igWQmcrSnfRHT3jen+Z6Y7tlZwISSvfKuUkoz+XgyGIXcX1IjwJZZWsYpD3 yCNCYbRjW4Cq9FqLIvWN10wYD9EkQ8S8ANiNgWGzRizwNy20o+i3XF6Np/I7qSvmmyUi CBClJpLzSeuY300+ymTXCJJ2sOlv46V/FBUow= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3OeSCMQTnB5Zbn37nOARIKXFybH8gj/fV34v2WcaUfM=; b=rKXwbdqCey7HFxiFF7ApUxZbkOfof+nNm5lnSwVE/ZFYcTSyu/zvEpdmutYBd3ZyWA OwnAEaGtrs9kXi2Eq49OhB8CHI+VGsQILA6l/OFagE1FFqGNCre93/c4K+ISJbi25G0Y kX9Z7hqKvO68EF/odb6zmsLJwZEEJvheXi31XBsah6M215A8Lr5jy6vCm9zpKFloHWdT zD6LrWRTsL+b6kMBp43lD3Vga8sKKWlYawxToIN4E4p36fwiWgeBSyiHrsQ4xrRk7bqT KQ1WJv2yzEXKTEu5zhkrJOjX37qEPGN9b475VVclqWaphvtHwPaE8nwTDUCXekdrGV5d jBCA== X-Gm-Message-State: ALQs6tD7kgOqNZZIUAC5bMYugf2kybs13HSAlsGy+RxsVo7A/I4OOpxA SXv74eQvpubURF8djtx6RnenwA== X-Received: by 2002:adf:86ac:: with SMTP id 41-v6mr28757047wrx.260.1525708660884; Mon, 07 May 2018 08:57:40 -0700 (PDT) Received: from arch-late.local (a109-49-46-234.cpe.netcabo.pt. [109.49.46.234]) by smtp.gmail.com with ESMTPSA id y42-v6sm32294807wry.21.2018.05.07.08.57.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 May 2018 08:57:40 -0700 (PDT) From: Rui Miguel Silva To: mchehab@kernel.org, sakari.ailus@linux.intel.com, hverkuil@xs4all.nl, Rob Herring Cc: linux-media@vger.kernel.org, Fabio Estevam , devicetree@vger.kernel.org, Ryan Harkin , Rui Miguel Silva Subject: [PATCH 3/4] media: ov2680: rename powerdown gpio and fix polarity Date: Mon, 7 May 2018 16:56:54 +0100 Message-Id: <20180507155655.1555-4-rui.silva@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180507155655.1555-1-rui.silva@linaro.org> References: <20180507155655.1555-1-rui.silva@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Rename the power control gpio to reset, since it is the same, and fix the polarity code since this gpio is active at low and not at high as controlled before. Signed-off-by: Rui Miguel Silva --- drivers/media/i2c/ov2680.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) -- 2.17.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index cc3d06096d51..8962b397211a 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -98,7 +98,7 @@ struct ov2680_dev { struct clk *xvclk; u32 xvclk_freq; - struct gpio_desc *pwdn_gpio; + struct gpio_desc *reset_gpio; struct mutex lock; /* protect members */ bool mode_pending_changes; @@ -295,19 +295,19 @@ static int ov2680_load_regs(struct ov2680_dev *sensor, static void ov2680_power_up(struct ov2680_dev *sensor) { - if (!sensor->pwdn_gpio) + if (!sensor->reset_gpio) return; - gpiod_set_value(sensor->pwdn_gpio, 1); + gpiod_set_value(sensor->reset_gpio, 0); usleep_range(5000, 10000); } static void ov2680_power_down(struct ov2680_dev *sensor) { - if (!sensor->pwdn_gpio) + if (!sensor->reset_gpio) return; - gpiod_set_value(sensor->pwdn_gpio, 0); + gpiod_set_value(sensor->reset_gpio, 1); usleep_range(5000, 10000); } @@ -535,7 +535,7 @@ static int ov2680_power_on(struct ov2680_dev *sensor) if (sensor->is_enabled) return 0; - if (!sensor->pwdn_gpio) { + if (!sensor->reset_gpio) { ret = ov2680_write_reg(sensor, OV2680_REG_SOFT_RESET, 0x01); if (ret != 0) { dev_err(dev, "sensor soft reset failed\n"); @@ -990,11 +990,11 @@ static int ov2860_parse_dt(struct ov2680_dev *sensor) struct device *dev = ov2680_to_dev(sensor); int ret; - sensor->pwdn_gpio = devm_gpiod_get_optional(dev, "powerdown", - GPIOD_OUT_HIGH); - ret = PTR_ERR_OR_ZERO(sensor->pwdn_gpio); + sensor->reset_gpio = devm_gpiod_get_optional(dev, "reset", + GPIOD_OUT_HIGH); + ret = PTR_ERR_OR_ZERO(sensor->reset_gpio); if (ret < 0) { - dev_dbg(dev, "error while getting powerdown gpio: %d\n", ret); + dev_dbg(dev, "error while getting reset gpio: %d\n", ret); return ret; } From patchwork Mon May 7 15:56:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Miguel Silva X-Patchwork-Id: 135103 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp3327290lji; Mon, 7 May 2018 08:57:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrE/JoPayAUtdq87HIk/wvfs+z3ZOdp6RVWnMn3s3wDgeootzlASFPV2OM+FZ8Ft0La4BBA X-Received: by 2002:a24:db57:: with SMTP id c84-v6mr1843143itg.60.1525708668417; Mon, 07 May 2018 08:57:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525708668; cv=none; d=google.com; s=arc-20160816; b=HGDyMXBsPf0MCeFEhMbvHC9osDnbXY2P5a4JzmR1S8CPRMyKkIxK+++I+nGrH4JV2X YUJWJNDp6L9vmzDcpmSC0HjOJ4g14B8hPOVs17U4wITKZqy2eMq0g+qU8x8sQ0dHU8dz zCSpmkDrokGXTtqmzCnOm0uantgMnpsr+7SIFLMD9v6C/nFCjDufBRrFZtJbsY0kIkRj 2jbL+tCcFxuPS5myE3b4bL/jBsGCyld+a9Jn7w6fk2d4MtXUy1oriai6z5LLzn+mErRc 8kyeNgAqEoB/FrQNVvyecbCBf29gq3ConA4kUilSFXKiMNzOXf5hV1ARZYEqS5v4/Bx8 OmXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=dNIoprba70vAkU9SoCdchjOHDV4vtn8OxwqTXy5bNts=; b=jm4S0EKh3DqJE6uJuDlqeuMsS4HZpfMYgm67gJOBBKO627rzuTzB4rH6FZ42snSF+F h5Ur2qLy6iIytJOG/K6HJKGte+aQ2ITE1UMJ1wOhwlfuzx16dtEGdieCg8RkYYsiT8c9 Pm3oCHpx1hn9zO5tJTNGmz9ghRcLRvvyDzK9WS3IVIjr6FRvcJT1q2Yk/4+MVKmtVMIZ DSBpYvA+T+E7ehR6UrBgIAmOe9n6rYbnv8OaV9sOgRnacwS7BChD3zXNik5uXN/ZVs3o y0CAWP/aUc2ZAnyFakOzcckfLzSQIARlv1W/G7NVY6a+t3k2Hal17OkaPaQwtR1VLCcx v87g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=NGnG/Dmj; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k124-v6si19537387iok.34.2018.05.07.08.57.48; Mon, 07 May 2018 08:57:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=NGnG/Dmj; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752789AbeEGP5r (ORCPT + 6 others); Mon, 7 May 2018 11:57:47 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:38869 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752790AbeEGP5p (ORCPT ); Mon, 7 May 2018 11:57:45 -0400 Received: by mail-wm0-f66.google.com with SMTP id m198-v6so15518462wmg.3 for ; Mon, 07 May 2018 08:57:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=F+Mo6MdzVhD2+FTd/F2XxiErD8j/HTKIL2mSUsIIyqw=; b=NGnG/DmjbMiT/PFIiDDIrOjIilzTqm99Ww0mN6LO7kE8b86CYTyQ5MWaTYdtjW2v2o 3m4gIlhkW+Ye0OsIU7m1wuZBmNJUVxc0+Go1Q3p3t2KZjFjzKuTQ8HGb4vQrSCVSVqFB 0frnomMb95zyjhVMpsYrSCscj1igDZ9yzmDHk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=F+Mo6MdzVhD2+FTd/F2XxiErD8j/HTKIL2mSUsIIyqw=; b=l9xipmaSefBuZH7m44O836dT05mEwBIBnt7i+PWEL67S96nOa0KjgGul4YLSoHcdUR n+JG6iJCt1Q6c14qQN0lt1pG8g6MQNoUB+dTVgxReJQfJHY58V/LKqoATancAaGLcjDW 1iUPrQOgXeExVsc1DQ5TYYyNvN8vOKvneECK0W3ASMpZJ3QsouHEhTwMckzwN+5QjaJ/ SXtDGnRGjkWOtbhqhgrNAq6PNBeBlytS0Mag+q0/3D4jF8rbavvJY/1eyAuMy9nDzGDm lVki0OdjWImE/M18rqQqwC0M3pQa5LA3b9Er5o6cJocMCn4TJ6fWX+LC1gWBCIXfo+wh oOvQ== X-Gm-Message-State: ALKqPwdPZZcE0Z+NwmFGb9rriQWLPtdhCn6M7RwNbGxPtQnp2mOt/f4x uuKqJ3kYk8kjzTG/A8g1rVzRgA== X-Received: by 2002:a1c:2084:: with SMTP id g126-v6mr1298917wmg.52.1525708663951; Mon, 07 May 2018 08:57:43 -0700 (PDT) Received: from arch-late.local (a109-49-46-234.cpe.netcabo.pt. [109.49.46.234]) by smtp.gmail.com with ESMTPSA id y42-v6sm32294807wry.21.2018.05.07.08.57.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 May 2018 08:57:43 -0700 (PDT) From: Rui Miguel Silva To: mchehab@kernel.org, sakari.ailus@linux.intel.com, hverkuil@xs4all.nl, Rob Herring Cc: linux-media@vger.kernel.org, Fabio Estevam , devicetree@vger.kernel.org, Ryan Harkin , Rui Miguel Silva Subject: [PATCH 4/4] media: ov2680: add regulators to supply control Date: Mon, 7 May 2018 16:56:55 +0100 Message-Id: <20180507155655.1555-5-rui.silva@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180507155655.1555-1-rui.silva@linaro.org> References: <20180507155655.1555-1-rui.silva@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add the code to control the regulators for the analogue and digital power supplies. Signed-off-by: Rui Miguel Silva --- drivers/media/i2c/ov2680.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) -- 2.17.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index 8962b397211a..07bb475c970c 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -65,6 +66,14 @@ struct reg_value { u8 val; }; +static const char * const ov2680_supply_name[] = { + "DOVDD", + "DVDD", + "AVDD", +}; + +#define OV2680_NUM_SUPPLIES ARRAY_SIZE(ov2680_supply_name) + struct ov2680_mode_info { const char *name; enum ov2680_mode_id id; @@ -97,6 +106,7 @@ struct ov2680_dev { struct media_pad pad; struct clk *xvclk; u32 xvclk_freq; + struct regulator_bulk_data supplies[OV2680_NUM_SUPPLIES]; struct gpio_desc *reset_gpio; struct mutex lock; /* protect members */ @@ -522,6 +532,7 @@ static int ov2680_power_off(struct ov2680_dev *sensor) clk_disable_unprepare(sensor->xvclk); ov2680_power_down(sensor); + regulator_bulk_disable(OV2680_NUM_SUPPLIES, sensor->supplies); sensor->is_enabled = false; return 0; @@ -535,6 +546,12 @@ static int ov2680_power_on(struct ov2680_dev *sensor) if (sensor->is_enabled) return 0; + ret = regulator_bulk_enable(OV2680_NUM_SUPPLIES, sensor->supplies); + if (ret < 0) { + dev_err(dev, "failed to enable regulators: %d\n", ret); + return ret; + } + if (!sensor->reset_gpio) { ret = ov2680_write_reg(sensor, OV2680_REG_SOFT_RESET, 0x01); if (ret != 0) { @@ -962,6 +979,18 @@ static int ov2680_v4l2_init(struct ov2680_dev *sensor) return ret; } +static int ov2680_get_regulators(struct ov2680_dev *sensor) +{ + int i; + + for (i = 0; i < OV2680_NUM_SUPPLIES; i++) + sensor->supplies[i].supply = ov2680_supply_name[i]; + + return devm_regulator_bulk_get(&sensor->i2c_client->dev, + OV2680_NUM_SUPPLIES, + sensor->supplies); +} + static int ov2680_check_id(struct ov2680_dev *sensor) { struct device *dev = ov2680_to_dev(sensor); @@ -1034,6 +1063,12 @@ static int ov2680_probe(struct i2c_client *client) if (ret < 0) return ret; + ret = ov2680_get_regulators(sensor); + if (ret < 0) { + dev_err(dev, "failed to get regulators\n"); + return ret; + } + mutex_init(&sensor->lock); ret = ov2680_v4l2_init(sensor);