From patchwork Fri Jun 28 11:00:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 11021971 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BFA87924 for ; Fri, 28 Jun 2019 11:01:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B04CA286EE for ; Fri, 28 Jun 2019 11:01:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4CD7287DE; Fri, 28 Jun 2019 11:01:09 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 843C8286EE for ; Fri, 28 Jun 2019 11:01:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726798AbfF1LBH (ORCPT ); Fri, 28 Jun 2019 07:01:07 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:36255 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726476AbfF1LBH (ORCPT ); Fri, 28 Jun 2019 07:01:07 -0400 Received: by mail-qt1-f195.google.com with SMTP id p15so5768887qtl.3 for ; Fri, 28 Jun 2019 04:01:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=IRBAmCCmBhwyXOJ1DcCXZIxfWYSluForxnz0fKJkRsI=; b=TxOwpL81cSRNEH+c9HvJse3ohnn5m4LFuWHavY7CsalrrgX2rO0hztXb0EKQbnXOJH GQcoRG4fwVLmGLPP6Qqt00qX45eKky2Ur/RiNxbRBhRNdwCBPiN9GNVeGv+8Z3SHnxzU m9WaaxeqhnDizLnx8nx2097BbtYACO213/EYSKsPIW1TtQWEEo1ndrdZo1iY+oODTn14 JWFltI1srROXP+uxlrvXILSRexvIdNZOii9A/9WURENjQX1UHe7w1lHemEaPoUiNpUhN 3YiWS/k9hsrcdMK4poUZKp5guhxkhw3fyI8Jo9rlvL/gKhyn3lu5NHGGs9J0Sc/ZalmI ugjw== 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; bh=IRBAmCCmBhwyXOJ1DcCXZIxfWYSluForxnz0fKJkRsI=; b=dCv6pdd9liiy2+bc8oNVCmcvEiUmn2nnOGMIRA0YE0rvskVBDBMVyKTUYFrRtJNcuk avKJMiBME/0t6YQvILRe5+Fd3W2KUyi8uMVhCXAOWD/TZSZwKwRFHknCzO62/did+yF7 EbJccUle94crDbQb4sx/mDmgRQT7f/kLiutOZ6b1Fu/mHzogOdErennFea9Yss8r9sIA wPjKGMw6xzL1HI5QA+eOC01hgiCh0CdJyVnZ+eQczIF99bmwulSBcMEXuwHyBcpQEsMf VRs08epmUvA6Qs6xyPLMYSYzLX51TLmK7R5EuiiHfBfPkxUJzFPothPv9D+Lbr0N2+b/ NlGQ== X-Gm-Message-State: APjAAAW3PUjwxczqM5vEHzxyYFmrq5JOJFMlYYy5xvi9ua0YB88G2J7O pfb1ktSdKnhZg2urOiKhSkc= X-Google-Smtp-Source: APXvYqw/FSTLeYBIjdPyM/dxdGzQ/do+L0qmbuLYrraAPhs5TC3bN1ZpOoYhXD7PQYFW9as2g3epzQ== X-Received: by 2002:a0c:ae35:: with SMTP id y50mr7545207qvc.204.1561719666515; Fri, 28 Jun 2019 04:01:06 -0700 (PDT) Received: from fabio-Latitude-E5450.am.freescale.net ([2804:14c:482:3c8:56cb:1049:60d2:137b]) by smtp.gmail.com with ESMTPSA id x205sm825971qka.56.2019.06.28.04.01.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Jun 2019 04:01:05 -0700 (PDT) From: Fabio Estevam To: sakari.ailus@iki.fi Cc: slongerbeam@gmail.com, jacopo@jmondi.org, linux-media@vger.kernel.org, mchehab@kernel.org, Fabio Estevam Subject: [PATCH 1/2] media: i2c: ov5640: Check for devm_gpiod_get_optional() error Date: Fri, 28 Jun 2019 08:00:34 -0300 Message-Id: <20190628110035.23930-1-festevam@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The power down and reset GPIO are optional, but the return value from devm_gpiod_get_optional() needs to be checked and propagated in the case of error, so that probe deferral can work. Signed-off-by: Fabio Estevam --- drivers/media/i2c/ov5640.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c index 759d60c6d630..afe7920557a8 100644 --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -3022,9 +3022,14 @@ static int ov5640_probe(struct i2c_client *client, /* request optional power down pin */ sensor->pwdn_gpio = devm_gpiod_get_optional(dev, "powerdown", GPIOD_OUT_HIGH); + if (IS_ERR(sensor->pwdn_gpio)) + return PTR_ERR(sensor->pwdn_gpio); + /* request optional reset pin */ sensor->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(sensor->reset_gpio)) + return PTR_ERR(sensor->reset_gpio); v4l2_i2c_subdev_init(&sensor->sd, client, &ov5640_subdev_ops); From patchwork Fri Jun 28 11:00:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 11021973 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7058E924 for ; Fri, 28 Jun 2019 11:01:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6227C286EE for ; Fri, 28 Jun 2019 11:01:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56BB2287DE; Fri, 28 Jun 2019 11:01:11 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2153286EE for ; Fri, 28 Jun 2019 11:01:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726801AbfF1LBK (ORCPT ); Fri, 28 Jun 2019 07:01:10 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:39486 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726476AbfF1LBK (ORCPT ); Fri, 28 Jun 2019 07:01:10 -0400 Received: by mail-qt1-f196.google.com with SMTP id i34so5741800qta.6 for ; Fri, 28 Jun 2019 04:01:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IXdo8o25DUwbkBOacyMkHs8NXaNzyi8ZQ44w0wRRY+k=; b=oHgWFQqjFKlaKSTvkFPGNEOIIooE1+k51krQBpezd1aCYd5+uu/K1IbRuWGFNeRPp0 2wYV5lCq8slOC9ODsdug14Yi9RgWm1CVZPtCazI/5nRvr2SSniwvpSxEw7Nhy8OLo/r1 mlltnErzun3xetjAemWULwFddbumtzS5I4a1P7RYw0ypQNXej9YVtA3ODpI9psnE2VMw sIPkPqjhyDag57JBv16C4b+ppyKAY7J4+OfFxR/bvz5bm6kv4QhrCDFclRxA3LO/PW9i 7e54rtciFgOlLyqSgYLEJD0bXQtHITO7D9p7JThvdrPK5HwCe/8w913DAGDCk10ctLIL tXZg== 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=IXdo8o25DUwbkBOacyMkHs8NXaNzyi8ZQ44w0wRRY+k=; b=T52i7Y38llDIO/+UErUXBPXJMbBMJX8WY4UzSvdX3dzpvM7mAEr94GTXG81hlApopT 3EtW1Wfbi7p2QJ+YqTaFFOZG5yQI3zvNnOQlP6lelncVQaQwkh5GnUM50nP0riYCr2Sy DqRBfeFoUAjz/qwlSWbTXN+lS555/KaX3Qk3HaLEf9kH0b6rYMYK2QHh1DNwVad8v8b3 3VJkvpCwRsG77QlSY9azjazSR8mjPmx53btE/jAbylLhiE86eQjPIZJLzQHYdMSeQScY mWg2NANH/GOfuc7YVcB9vOgXnktCMF2SNBSLlTCPeMkKKpJRF7mBcyR+M12sOe+oZTXb eH4g== X-Gm-Message-State: APjAAAUAoh7cPnv/hB5vA3FW8RdZcMf1QQvtchKmQaPc1S7eMU/mxVzI EqGltpbGUc0uKDOZzunPw44= X-Google-Smtp-Source: APXvYqylk4MCnQYQArPkurO8zXexZPG2CA3+1OeEbDivIqMDER7dbtBBmUf8C/q/pg1nyMB3REu+pA== X-Received: by 2002:a0c:bd86:: with SMTP id n6mr7454973qvg.183.1561719669403; Fri, 28 Jun 2019 04:01:09 -0700 (PDT) Received: from fabio-Latitude-E5450.am.freescale.net ([2804:14c:482:3c8:56cb:1049:60d2:137b]) by smtp.gmail.com with ESMTPSA id x205sm825971qka.56.2019.06.28.04.01.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Jun 2019 04:01:08 -0700 (PDT) From: Fabio Estevam To: sakari.ailus@iki.fi Cc: slongerbeam@gmail.com, jacopo@jmondi.org, linux-media@vger.kernel.org, mchehab@kernel.org, Fabio Estevam Subject: [PATCH 2/2] media: i2c: ov5640: Fix the order for enabling regulators Date: Fri, 28 Jun 2019 08:00:35 -0300 Message-Id: <20190628110035.23930-2-festevam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190628110035.23930-1-festevam@gmail.com> References: <20190628110035.23930-1-festevam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP According to the OV5640 datasheet the following sequence needs to be followed when powering the OV5640 supplies: - DOVDD - AVDD - DVDD So follow this order inside the ov5640_supply_name[] array, so that the regulator_bulk() functions can enable the regulator in the correct sequence. Signed-off-by: Fabio Estevam --- drivers/media/i2c/ov5640.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c index afe7920557a8..4cd246812ae2 100644 --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -158,8 +158,8 @@ static const int ov5640_framerates[] = { /* regulator supplies */ static const char * const ov5640_supply_name[] = { "DOVDD", /* Digital I/O (1.8V) supply */ - "DVDD", /* Digital Core (1.5V) supply */ "AVDD", /* Analog (2.8V) supply */ + "DVDD", /* Digital Core (1.5V) supply */ }; #define OV5640_NUM_SUPPLIES ARRAY_SIZE(ov5640_supply_name)