From patchwork Tue Oct 2 07:32:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 10623135 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 3785015A7 for ; Tue, 2 Oct 2018 07:32:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FA8428756 for ; Tue, 2 Oct 2018 07:32:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 202E928758; Tue, 2 Oct 2018 07:32:29 +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 B2FF128756 for ; Tue, 2 Oct 2018 07:32:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726836AbeJBOOS (ORCPT ); Tue, 2 Oct 2018 10:14:18 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:46467 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726814AbeJBOOS (ORCPT ); Tue, 2 Oct 2018 10:14:18 -0400 Received: by mail-lj1-f195.google.com with SMTP id 203-v6so801703ljj.13; Tue, 02 Oct 2018 00:32:26 -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:mime-version :content-transfer-encoding; bh=0xt3dmmL2vF+yL6QeZS4w6KrzNFaw1J26hKwwcqzdAE=; b=bO1Y8vQ0jkvvKkL6+18x87QcPCcEFJSE7UcfS0XeZFHFmR9NJOA7GHNhrMe07SRXDf wHF+ACcDLEbVnS/bWrer8LRNCVjmxh5scSCK6/ATtb/5gPF84lHlrLBOvXbnevSimMuD YKp0JU1PPFdGFNLfjdNpYz2NCmicj61TwgP0kGSbJ6rrVZiXwuQGIrhAfKpt5dVEN5wY ty8psr0LaFcjCO1rxgBBL/OHB3m/kqG0yjAMD8cCNZNaUp435m+loU87IBbNQbaRNMLO gRox7nxdjoXIfoGqagoRcdun6jm5VzWu9fuSRx96xo2OeUrhUpRZG+K56aD6fhfTFSTn OJ8g== 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:mime-version :content-transfer-encoding; bh=0xt3dmmL2vF+yL6QeZS4w6KrzNFaw1J26hKwwcqzdAE=; b=TGJvT39FKemMKXoUc3l53hpE/EmF5poPlFEJmKDojDaei/BrW9PHGLLwyVmy0rhh1y YbGrbT/Yq852zzUIusRixUa4D/2cwAZyXoDGODI1GO7w+kHdLriLS7LX6ZltpQpajOw+ xte3ngBQ1Sf83LgfCCtpgQMuPq/WQSXR9T/hkBm9n+gyTAiqh7q3abBCTwwdCktnp+vl BunY+PD+PS/T5Cxhz0JCE73Bd4jLZpo6YRP4Mwpu6OM2VOD+QzirzMf7/u5OBMhMFhDG ZH/0O/jyR7RXPDiGPRZE31xVvItdwwZnxm4GpndzThzZtVIZllKYQN8JkuO7+d6TgdHY No7w== X-Gm-Message-State: ABuFfog9rrTauI4E/p4T8pkuBSxB4h4VMg6CdH7zoBHl5wRxzpKqOml0 ixKVjbDAgMX605y7+b1fU48= X-Google-Smtp-Source: ACcGV612V8MilinU2/QxQnLMBupIEvG4x9ytesgYW4TR4jb5IHE1zHojgFddBhj76Ow0Z7a1ay6LSw== X-Received: by 2002:a2e:44d0:: with SMTP id b77-v6mr8413384ljf.47.1538465545093; Tue, 02 Oct 2018 00:32:25 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id d17-v6sm1242246lfj.9.2018.10.02.00.32.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Oct 2018 00:32:24 -0700 (PDT) From: Ricardo Ribalda Delgado To: Pavel Machek , Sakari Ailus , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Verkuil , Laurent Pinchart Cc: Ricardo Ribalda Delgado Subject: [PATCH v5 1/6] [media] ad5820: Define entity function Date: Tue, 2 Oct 2018 09:32:17 +0200 Message-Id: <20181002073222.11368-1-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 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 Without this patch, media_device_register_entity throws a warning: dev_warn(mdev->dev, "Entity type for entity %s was not initialized!\n", entity->name); Signed-off-by: Ricardo Ribalda Delgado Acked-by: Pavel Machek Reviewed-by: Laurent Pinchart --- drivers/media/i2c/ad5820.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/i2c/ad5820.c b/drivers/media/i2c/ad5820.c index 907323f0ca3b..22759aaa2dba 100644 --- a/drivers/media/i2c/ad5820.c +++ b/drivers/media/i2c/ad5820.c @@ -317,6 +317,7 @@ static int ad5820_probe(struct i2c_client *client, v4l2_i2c_subdev_init(&coil->subdev, client, &ad5820_ops); coil->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; coil->subdev.internal_ops = &ad5820_internal_ops; + coil->subdev.entity.function = MEDIA_ENT_F_LENS; strscpy(coil->subdev.name, "ad5820 focus", sizeof(coil->subdev.name)); ret = media_entity_pads_init(&coil->subdev.entity, 0, NULL); From patchwork Tue Oct 2 07:32:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 10623145 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 247CD15A7 for ; Tue, 2 Oct 2018 07:33:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2725E20950 for ; Tue, 2 Oct 2018 07:33:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B5BA209CC; Tue, 2 Oct 2018 07:33:14 +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 BEC4020950 for ; Tue, 2 Oct 2018 07:33:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727183AbeJBOOV (ORCPT ); Tue, 2 Oct 2018 10:14:21 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:37875 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726814AbeJBOOU (ORCPT ); Tue, 2 Oct 2018 10:14:20 -0400 Received: by mail-lf1-f66.google.com with SMTP id a82-v6so672441lfa.4; Tue, 02 Oct 2018 00:32:27 -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 :mime-version:content-transfer-encoding; bh=1KVNU/m5av04sKKnX9txI783M6jxzvuy+56bxkZ9iJY=; b=nw05BhBwAvIB9lcsnufHpO4W3tpitx0zta6GVyrhDsVRV/UDC036iWhxHRwyFL/t5V TwdTixR0hjG/bZsva42Ct1yvmW1hqQTBSZPaSEki4tLHYSf2BjU3SdyX6JlOq42/iAzC cE2nwighP335jOyEKc/YlRi9lhiAphhcY2oOnjG7lmZ023zhR4uJtkSiGvoGV8od5mWb vM4FAbfD9RfMr78T64/dnYkQIw0H08ytQ15YPVOfaN0ORyGL5f4wdukS+OLsXvDQXAQx dyWhxLrJ/idg8eU03s9DsshdJSNPNfqhHOJ2k5T3HT7QWhgj9q/NQef/putFPhoHDgRA EwEQ== 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:mime-version:content-transfer-encoding; bh=1KVNU/m5av04sKKnX9txI783M6jxzvuy+56bxkZ9iJY=; b=JI2UBgtlBztzZcP+i+knOftk+KCA+BN0WsZaYthSDVvpeloroqKp5mmnMNjplLJAXY JbGK/D/+F2OVY6whQUuXnQAYX47y6rkvbivftgXSo5FiCWtiRkat0jTGqr2H3MIEZ1jZ Y9zvfVCNmsCw2AnB112O39ryKkjACyYDpZXEGb2nfm809wuPmH/ZahxFvHZPe8TR4Y4C Nriiy3r12R8utA3fGCA8xhrJylnGCfuQ5z07+ak1Mydu5a4rVXwOxDZz2yJM6BKaWMX3 YgF8E8JFiBWKF4R4pYxGUEcUcvEGvCtCwNK8/cQX6edHYngReDr4rptCOllh2efBIn5p zDOw== X-Gm-Message-State: ABuFfojhi9/sIdyZXWyJlDMpGP5ug2vg/acJhBSex33jlc14cLnjqLWx qZaXYCg1zy5QsZkYBrncvfI= X-Google-Smtp-Source: ACcGV61L+2Pwuwj+h3gnyUfQ+dSznS52WxJuUcUKxirkyyqvi7KZ0aDWj+h0IyKxQrrEc/AH0zwGlw== X-Received: by 2002:a19:5311:: with SMTP id h17-v6mr7365392lfb.24.1538465546756; Tue, 02 Oct 2018 00:32:26 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id d17-v6sm1242246lfj.9.2018.10.02.00.32.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Oct 2018 00:32:25 -0700 (PDT) From: Ricardo Ribalda Delgado To: Pavel Machek , Sakari Ailus , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Verkuil , Laurent Pinchart Cc: Ricardo Ribalda Delgado , devicetree@vger.kernel.org Subject: [PATCH v5 2/6] [media] ad5820: DT new optional field enable-gpios Date: Tue, 2 Oct 2018 09:32:18 +0200 Message-Id: <20181002073222.11368-2-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181002073222.11368-1-ricardo.ribalda@gmail.com> References: <20181002073222.11368-1-ricardo.ribalda@gmail.com> MIME-Version: 1.0 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 Document new enable-gpio field. It can be used to disable the part without turning down its regulator. Cc: devicetree@vger.kernel.org Signed-off-by: Ricardo Ribalda Delgado Acked-by: Pavel Machek --- Documentation/devicetree/bindings/media/i2c/ad5820.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/media/i2c/ad5820.txt b/Documentation/devicetree/bindings/media/i2c/ad5820.txt index 5940ca11c021..9ccd96d3d5f0 100644 --- a/Documentation/devicetree/bindings/media/i2c/ad5820.txt +++ b/Documentation/devicetree/bindings/media/i2c/ad5820.txt @@ -8,6 +8,12 @@ Required Properties: - VANA-supply: supply of voltage for VANA pin +Optional properties: + + - enable-gpios : GPIO spec for the XSHUTDOWN pin. Note that the polarity of +the enable GPIO is the opposite of the XSHUTDOWN pin (asserting the enable +GPIO deasserts the XSHUTDOWN signal and vice versa). + Example: ad5820: coil@c { @@ -15,5 +21,6 @@ Example: reg = <0x0c>; VANA-supply = <&vaux4>; + enable-gpios = <&msmgpio 26 GPIO_ACTIVE_HIGH>; }; From patchwork Tue Oct 2 07:32:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 10623143 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 BA49815E8 for ; Tue, 2 Oct 2018 07:33:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD0162074F for ; Tue, 2 Oct 2018 07:33:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B15A520952; Tue, 2 Oct 2018 07:33: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 469BB20950 for ; Tue, 2 Oct 2018 07:33:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727273AbeJBOOW (ORCPT ); Tue, 2 Oct 2018 10:14:22 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:40346 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726993AbeJBOOV (ORCPT ); Tue, 2 Oct 2018 10:14:21 -0400 Received: by mail-lj1-f194.google.com with SMTP id r83-v6so818827ljr.7; Tue, 02 Oct 2018 00:32:29 -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 :mime-version:content-transfer-encoding; bh=RmTshnoq0D1caFdQ57INpjfkRgxEBWXE7yXtkeuvd6Q=; b=ku5lTBjOKYHLkBfY1EZkm9e/e+mmu4cgzTK0QJyh5AVLnHtS+UkJPBjtLoBTVCAES4 cJ0+lyf0qXBiD7cQOxX0jly35YpcA84KAGw5Amp7x91bD1lIcs9DlivS9XkeM6xlbOnt oU82tJ86eL86qQy18qU/cdgrwATdLv+gRMWek6UNNcUFCXtHsuzi1Pjybb7yGxZlovq0 dSHBnjZ0v6ldXVyodqhZe7vOhd8PFUdnYuuEnmfnxuYp4zsujbJhfOzqM8JGSSKP11TB z4Mpn3n2a0X054elWnB+atnfOLT+EY4DlNWpT2aYO+U10DyCxjt4orXpZOiMbYlpfkyi e8uQ== 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:mime-version:content-transfer-encoding; bh=RmTshnoq0D1caFdQ57INpjfkRgxEBWXE7yXtkeuvd6Q=; b=NVl9+c4GAKXc9j97nVp0sWNL8ffWSjtITnriu/zG0gj7CxlcRR8ZGNg1QOgUDDN7pL BmIS7LSirB29dtnStmANpyCSLXXKEMLcC3aDsiHGu7gXfMmCRYmMBt5J0k5YEZ3qorZ0 O4AWP8P0S0uGhjrLQT3F8rEq6HhlfMu59gfU+ZfsPwfMiZsudZlo7tmejAcjbP0l0cHk n6Nw4YgssSvxk7Lbpa37UAHFFffjAVvdFFQynaxhan+1scBUovtw9EhyeAw2oXyJHAIH iCMwb6gxQZnJFLHEolIgB+vUfEJ5nq58EBeYg2TupfMHaRoulOrHLJeOBIxxGF6s2LKc ndfw== X-Gm-Message-State: ABuFfojKbqqi7VLVulkyxW7kXjY8mTU4O6Sypr9zoxopzy7H5m7P6rtp pddb7ADyHur9QulwM+KVwqY= X-Google-Smtp-Source: ACcGV63rWqiv6FHr3B4rC+JDPLhhb2tPx/siHb2bIX0k4a1X4rNaDf3A5oXijiNzVYdhHg5qlWvpqg== X-Received: by 2002:a2e:5686:: with SMTP id k6-v6mr874451lje.105.1538465548259; Tue, 02 Oct 2018 00:32:28 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id d17-v6sm1242246lfj.9.2018.10.02.00.32.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Oct 2018 00:32:27 -0700 (PDT) From: Ricardo Ribalda Delgado To: Pavel Machek , Sakari Ailus , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Verkuil , Laurent Pinchart Cc: Ricardo Ribalda Delgado Subject: [PATCH v5 3/6] [media] ad5820: Add support for enable pin Date: Tue, 2 Oct 2018 09:32:19 +0200 Message-Id: <20181002073222.11368-3-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181002073222.11368-1-ricardo.ribalda@gmail.com> References: <20181002073222.11368-1-ricardo.ribalda@gmail.com> MIME-Version: 1.0 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 This patch adds support for a programmable enable pin. It can be used in situations where the ANA-vcc is not configurable (dummy-regulator), or just to have a more fine control of the power saving. The use of the enable pin is optional. Signed-off-by: Ricardo Ribalda Delgado Acked-by: Pavel Machek --- drivers/media/i2c/Kconfig | 2 +- drivers/media/i2c/ad5820.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index bfdb494686bf..1ba6eaaf58fb 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -321,7 +321,7 @@ config VIDEO_ML86V7667 config VIDEO_AD5820 tristate "AD5820 lens voice coil support" - depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER + depends on GPIOLIB && I2C && VIDEO_V4L2 && MEDIA_CONTROLLER ---help--- This is a driver for the AD5820 camera lens voice coil. It is used for example in Nokia N900 (RX-51). diff --git a/drivers/media/i2c/ad5820.c b/drivers/media/i2c/ad5820.c index 22759aaa2dba..97eb05e65833 100644 --- a/drivers/media/i2c/ad5820.c +++ b/drivers/media/i2c/ad5820.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -55,6 +56,8 @@ struct ad5820_device { u32 focus_ramp_time; u32 focus_ramp_mode; + struct gpio_desc *enable_gpio; + struct mutex power_lock; int power_count; @@ -122,6 +125,8 @@ static int ad5820_power_off(struct ad5820_device *coil, bool standby) ret = ad5820_update_hw(coil); } + gpiod_set_value_cansleep(coil->enable_gpio, 0); + ret2 = regulator_disable(coil->vana); if (ret) return ret; @@ -136,6 +141,8 @@ static int ad5820_power_on(struct ad5820_device *coil, bool restore) if (ret < 0) return ret; + gpiod_set_value_cansleep(coil->enable_gpio, 1); + if (restore) { /* Restore the hardware settings. */ coil->standby = false; @@ -146,6 +153,7 @@ static int ad5820_power_on(struct ad5820_device *coil, bool restore) return 0; fail: + gpiod_set_value_cansleep(coil->enable_gpio, 0); coil->standby = true; regulator_disable(coil->vana); @@ -312,6 +320,15 @@ static int ad5820_probe(struct i2c_client *client, return ret; } + coil->enable_gpio = devm_gpiod_get_optional(&client->dev, "enable", + GPIOD_OUT_LOW); + if (IS_ERR(coil->enable_gpio)) { + ret = PTR_ERR(coil->enable_gpio); + if (ret != -EPROBE_DEFER) + dev_err(&client->dev, "could not get enable gpio\n"); + return ret; + } + mutex_init(&coil->power_lock); v4l2_i2c_subdev_init(&coil->subdev, client, &ad5820_ops); From patchwork Tue Oct 2 07:32:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 10623141 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 23AC415A7 for ; Tue, 2 Oct 2018 07:33:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19735205FD for ; Tue, 2 Oct 2018 07:33:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A92D20950; Tue, 2 Oct 2018 07:33:04 +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 9910C205FD for ; Tue, 2 Oct 2018 07:33:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727347AbeJBOOY (ORCPT ); Tue, 2 Oct 2018 10:14:24 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:37011 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727261AbeJBOOX (ORCPT ); Tue, 2 Oct 2018 10:14:23 -0400 Received: by mail-lj1-f193.google.com with SMTP id 63-v6so830691ljs.4; Tue, 02 Oct 2018 00:32:31 -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 :mime-version:content-transfer-encoding; bh=kLCREbleYStu1XkmLup2nB4ZT0oPHzqGd5NP0nf22A8=; b=iFXlWKSuoLOy3dc/baIRkMk/768TAlHmLhlm8TgnJgBkORhu20VvZ/mGB56VGBKreP 1aSIM0QuO3gTA2wQFrcr3XaLyIHrXvjgk3ouevcneGyDlw0HuuR5TTPx2GN9vbt2Qnxl pPlItqEuKfoH1EZE08FerEjc4t4l1CBXcHfgASMJmML3GrcAR98LBOziMRUS1QzOyjuJ EvrzShOR6N6EOiXug+N511i8Ypr95NMDKCyBCsyoXu/2/qKo24XULYp+bQ7IVbP2aTJ/ aTdlnDGTLWEjLGph0FoIU4UP7r4YK/qjEQLQmKEy9F1KQ4mm0G4yxDZk3q9amgrNN4he PAqA== 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:mime-version:content-transfer-encoding; bh=kLCREbleYStu1XkmLup2nB4ZT0oPHzqGd5NP0nf22A8=; b=EanWG17+DWq+jZqYa2hmK7UV6/Cy8mHAEXPXx9K9New/iVRi6koH5KJZ8JY9sDtAFV cdudaen8Ye5WttsIuxqpUHPWwZR/eQjVzQZ+GdWB2sEqxba5TTBrdFJ9HLcKMJZ2YUYL 9mqrkkEKUlnfdWA+YX5OlTOVatXJTL/1WhV0QgvQMzabyUtwsJEccnWEuhK5RGf1K667 nJJ/8qoFicGO5bHx5Z6I4uYSh7OD/IxOALvEQXK3fxTTEtn63Fn4mQChw5Phq81kJoWe o6HHiqllFrVfdH48c9Wc8mi2AP+mbZDnivCWFr+6x+7LPPLd9qzcggoWKOcMQIDt9I2f ZrdA== X-Gm-Message-State: ABuFfoiZlInTd/nrasfHbwSyeJs7xJMLcd0ZlGPkYlnj6x+AE/hng1D8 zW5e2cWNfvhyKdU7nQWc2vM= X-Google-Smtp-Source: ACcGV616E8x/SfKAEKURiBmDmj91BRDbHJffJv+axTqlGK1MXtYVBq7rTXfb2/mTRRKSkDiOEA+G5Q== X-Received: by 2002:a2e:2b08:: with SMTP id q8-v6mr8724236lje.128.1538465550138; Tue, 02 Oct 2018 00:32:30 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id d17-v6sm1242246lfj.9.2018.10.02.00.32.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Oct 2018 00:32:28 -0700 (PDT) From: Ricardo Ribalda Delgado To: Pavel Machek , Sakari Ailus , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Verkuil , Laurent Pinchart Cc: Ricardo Ribalda Delgado , Sakari Ailus Subject: [PATCH v5 4/6] [media] ad5820: Add support for of-autoload Date: Tue, 2 Oct 2018 09:32:20 +0200 Message-Id: <20181002073222.11368-4-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181002073222.11368-1-ricardo.ribalda@gmail.com> References: <20181002073222.11368-1-ricardo.ribalda@gmail.com> MIME-Version: 1.0 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 Since kernel 4.16, i2c devices with DT compatible tag are modprobed using their DT modalias. Without this patch, if this driver is build as module it would never be autoprobed. There is no need to mask it with CONFIG_OF to allow ACPI loading, this also builds find with CONFIG_OF=n. Signed-off-by: Ricardo Ribalda Delgado Acked-by: Pavel Machek Cc: Sakari Ailus --- drivers/media/i2c/ad5820.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/media/i2c/ad5820.c b/drivers/media/i2c/ad5820.c index 97eb05e65833..4ae4e6a776fd 100644 --- a/drivers/media/i2c/ad5820.c +++ b/drivers/media/i2c/ad5820.c @@ -372,12 +372,19 @@ static const struct i2c_device_id ad5820_id_table[] = { }; MODULE_DEVICE_TABLE(i2c, ad5820_id_table); +static const struct of_device_id ad5820_of_table[] = { + { .compatible = "adi,ad5820" }, + { } +}; +MODULE_DEVICE_TABLE(of, ad5820_of_table); + static SIMPLE_DEV_PM_OPS(ad5820_pm, ad5820_suspend, ad5820_resume); static struct i2c_driver ad5820_i2c_driver = { .driver = { .name = AD5820_NAME, .pm = &ad5820_pm, + .of_match_table = ad5820_of_table, }, .probe = ad5820_probe, .remove = ad5820_remove, From patchwork Tue Oct 2 07:32:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 10623139 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 4678415A7 for ; Tue, 2 Oct 2018 07:32:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 47A7828756 for ; Tue, 2 Oct 2018 07:32:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BD1E28758; Tue, 2 Oct 2018 07:32:58 +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 E4EBA28756 for ; Tue, 2 Oct 2018 07:32:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727421AbeJBOOn (ORCPT ); Tue, 2 Oct 2018 10:14:43 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:41846 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726814AbeJBOOZ (ORCPT ); Tue, 2 Oct 2018 10:14:25 -0400 Received: by mail-lf1-f65.google.com with SMTP id q39-v6so659059lfi.8; Tue, 02 Oct 2018 00:32:32 -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 :mime-version:content-transfer-encoding; bh=y6P9OV16u273ERMZhfXC/W1SWJA4ZlFPo/FqG3IUDd0=; b=LqzenBJsz/apfQwMh7oswDXJ8Df/89aOitLdhaQW2rg9RxVx05zoDMXyK+RNLUEXG2 Yb7SBE0tPwCBUZ3+A8BOKDYU6FvlPH66k/GxT4XbX5w6kvbmvbMxsss185y+R6sr21pV ONebSgnw5xM9oD3gkKYsX0qMGPe+O/tiZQRfb5sQvIkjvaLojtzWGiwBc1jV3RK7je5i lVaDNQp4KYAYuU8sHwNuXlUZ3iO6rdyRqxayR/9lxLGc9Iw7beFvCqa9cmGV3nvLlUHl lySJo6eremN1BKhI7FgIIrm9w7bysWqmqJVAhdd38zgpHXPTiiVJqoVsSu1et/KuIhZK 9Ilg== 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:mime-version:content-transfer-encoding; bh=y6P9OV16u273ERMZhfXC/W1SWJA4ZlFPo/FqG3IUDd0=; b=lEOmEVUZn4jy+NW96b72aYnegAv6dM2ffq6nj39dr0WTl2s1liaHUjHfmMTqCHzum/ dxxTX06/mthyTsI42LvwEDsaK8pcdBQm567qEHqz9vOeURUhNY7k9OnfhxeMMbtub0XJ DeFYGiWEJNy1ZuwTxzkY18A319Dh7YWH6BbsBoUYY+OuS1KwbrJbmkcB9hrvaFpvBpKj 4tXNPgx2bTeQK74zYU5zucfxuWDOpdr3Xs/QExewANVG7JqgBh2EKEvuQAW818np+l8v r273bTmR3M+toCL0fYwvMAvF5bEhl5rnTf3czMPNYrB64b72hAReQ0mwZTc7rG69h9L5 v9mw== X-Gm-Message-State: ABuFfojlXw8KQm09yfK+7wkZSCYwJ4XQqKIk0hpfKT4zaBWU1RoPj3GX jGSCklMjPNsgbyyR5sV4Nx4= X-Google-Smtp-Source: ACcGV62BM2cUdAevimPMiig87M3Py4xwiNUEHjkolGnhz65FILKO0FYL9r8mYbtUOG+FQLNO5nGP7A== X-Received: by 2002:a19:6381:: with SMTP id v1-v6mr7401300lfi.136.1538465551979; Tue, 02 Oct 2018 00:32:31 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id d17-v6sm1242246lfj.9.2018.10.02.00.32.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Oct 2018 00:32:30 -0700 (PDT) From: Ricardo Ribalda Delgado To: Pavel Machek , Sakari Ailus , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Verkuil , Laurent Pinchart Cc: Ricardo Ribalda Delgado , devicetree@vger.kernel.org Subject: [PATCH v5 5/6] [media] ad5820: DT new compatible devices Date: Tue, 2 Oct 2018 09:32:21 +0200 Message-Id: <20181002073222.11368-5-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181002073222.11368-1-ricardo.ribalda@gmail.com> References: <20181002073222.11368-1-ricardo.ribalda@gmail.com> MIME-Version: 1.0 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 Document new compatible devices. Cc: devicetree@vger.kernel.org Signed-off-by: Ricardo Ribalda Delgado Reviewed-by: Rob Herring Acked-by: Pavel Machek --- Documentation/devicetree/bindings/media/i2c/ad5820.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/media/i2c/ad5820.txt b/Documentation/devicetree/bindings/media/i2c/ad5820.txt index 9ccd96d3d5f0..cc7b10fe0368 100644 --- a/Documentation/devicetree/bindings/media/i2c/ad5820.txt +++ b/Documentation/devicetree/bindings/media/i2c/ad5820.txt @@ -2,7 +2,10 @@ Required Properties: - - compatible: Must contain "adi,ad5820" + - compatible: Must contain one of: + - "adi,ad5820" + - "adi,ad5821" + - "adi,ad5823" - reg: I2C slave address From patchwork Tue Oct 2 07:32:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 10623137 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 C487A15A7 for ; Tue, 2 Oct 2018 07:32:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C615228756 for ; Tue, 2 Oct 2018 07:32:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA7E828758; Tue, 2 Oct 2018 07:32:43 +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 0F08928756 for ; Tue, 2 Oct 2018 07:32:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727206AbeJBOO2 (ORCPT ); Tue, 2 Oct 2018 10:14:28 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:45977 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726890AbeJBOO0 (ORCPT ); Tue, 2 Oct 2018 10:14:26 -0400 Received: by mail-lj1-f193.google.com with SMTP id x16-v6so802921ljd.12; Tue, 02 Oct 2018 00:32:34 -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 :mime-version:content-transfer-encoding; bh=Wmog6lAgqKOhpPrEYXjVkbDL7dvr+abZ89S+iJGxfPU=; b=fxjwbUaLGwRZ6dZJknYfqV2FfhvYr6xgQyif+yYApN6icSgkBIBfBB370kHk76VVkV Q6p2RDhWNF0dpBcVo6tuZh9SYzMIq6nrMTCRqiqqR185ilIUd+j3hT69rGTHBCYVMjBr W7t7eHVrnXHSJ2MdE3UlgtXOReMxFqwK4Z9kqDyVDOxUoUJKmkZEuvrwdJ7Ze4qGaD8q 3lo5nYx6rf5CKaH974u9LVZLssf/u59zs43ln9Qb8b08kFDDNo6Qmot57SCtALv2UZpB r36ajRmpYAGN2VjS8OoQVTRe5PdjCLBKqV+cZr3NH34AGIkCIsMXRzUpqyfzmO+74q+v zvow== 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:mime-version:content-transfer-encoding; bh=Wmog6lAgqKOhpPrEYXjVkbDL7dvr+abZ89S+iJGxfPU=; b=Nf21oLlJcGzMyTifiQcrI593HGo7QwYUxQnl80NRKyzWjuHOLOqKgWX7S/4BJuZ2oa X6bJmm/6yCnbSPfxMCgSkWF8ZLeWC4EqV5SjPEdyILixQekSZgx4s724mRaAskEMTmaY kUTBlBTkmfCS1yj7CH34vQcwh5Bw4YBVzEw3+wuEsXYSzQFjX/yef/Gmo1gTXlcu7+k6 67LyYkzhmhX+ebZRHmlN3L7VS9vKc2h3pcobFPldccOs1EGb0dn8bsxMAw+xZyAn65I2 ZGTXzakWq4z4s0/5NKQBAxeXC9hITyU/lITumc9DFHPmEpo7emLIwec3F89FYHM+lhec UFMg== X-Gm-Message-State: ABuFfohoFrLJW/BBo0uAJbSkMfJRhWLehzdvgeGcNOzSjp2YFfXadwLd x+2RjlDAC/VZsjUOyp5B5+QIJKZV X-Google-Smtp-Source: ACcGV63qYPFA1s8otWAUMxBFgdoDgVdLJaR3Jvjp7hGmbWZoEC4JFf7+dxbMRhE+pEhikRmhQSYrzA== X-Received: by 2002:a2e:50e:: with SMTP id 14-v6mr7824895ljf.152.1538465553647; Tue, 02 Oct 2018 00:32:33 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id d17-v6sm1242246lfj.9.2018.10.02.00.32.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Oct 2018 00:32:32 -0700 (PDT) From: Ricardo Ribalda Delgado To: Pavel Machek , Sakari Ailus , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Verkuil , Laurent Pinchart Cc: Ricardo Ribalda Delgado Subject: [PATCH v5 6/6] [media] ad5820: Add support for ad5821 and ad5823 Date: Tue, 2 Oct 2018 09:32:22 +0200 Message-Id: <20181002073222.11368-6-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181002073222.11368-1-ricardo.ribalda@gmail.com> References: <20181002073222.11368-1-ricardo.ribalda@gmail.com> MIME-Version: 1.0 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 datasheet, both AD5821 and AD5820 share a compatible register-set: http://www.analog.com/media/en/technical-documentation/data-sheets/AD5821.pdf Some camera modules also refer that AD5823 is a replacement of AD5820: https://download.kamami.com/p564094-OV8865_DS.pdf Suggested-by: Pavel Machek Signed-off-by: Ricardo Ribalda Delgado Acked-by: Pavel Machek --- drivers/media/i2c/ad5820.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ad5820.c b/drivers/media/i2c/ad5820.c index 4ae4e6a776fd..2c0dd9960268 100644 --- a/drivers/media/i2c/ad5820.c +++ b/drivers/media/i2c/ad5820.c @@ -33,8 +33,6 @@ #include #include -#define AD5820_NAME "ad5820" - /* Register definitions */ #define AD5820_POWER_DOWN (1 << 15) #define AD5820_DAC_SHIFT 4 @@ -367,13 +365,17 @@ static int ad5820_remove(struct i2c_client *client) } static const struct i2c_device_id ad5820_id_table[] = { - { AD5820_NAME, 0 }, + { "ad5820", 0 }, + { "ad5821", 0 }, + { "ad5823", 0 }, { } }; MODULE_DEVICE_TABLE(i2c, ad5820_id_table); static const struct of_device_id ad5820_of_table[] = { { .compatible = "adi,ad5820" }, + { .compatible = "adi,ad5821" }, + { .compatible = "adi,ad5823" }, { } }; MODULE_DEVICE_TABLE(of, ad5820_of_table); @@ -382,7 +384,7 @@ static SIMPLE_DEV_PM_OPS(ad5820_pm, ad5820_suspend, ad5820_resume); static struct i2c_driver ad5820_i2c_driver = { .driver = { - .name = AD5820_NAME, + .name = "ad5820", .pm = &ad5820_pm, .of_match_table = ad5820_of_table, },