From patchwork Mon Oct 7 13:28:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 11177513 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 864CB1599 for ; Mon, 7 Oct 2019 13:29:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5C06C21D56 for ; Mon, 7 Oct 2019 13:29:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570454972; bh=vdbVNKK2cjLjt0uI5e0Df8suBVPHqSbN68ZVOy8d0WA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=u9Cu5Ic6DV9Wi4Czqb5BWwFrnhVqXNyR3qMmhqgDfJadxNOlCNJcWm+CVhRJcPw2h GIWePev9g3PEZPM3+2cCKOBnmuuOrY9vbh6TmQlGY8eePJwNkFX0zLpaoRPyGIgCXr YOH0uez5jq8TW84eC6Sl6fzMhCdSJm4QIyOnn6ew= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728252AbfJGN3F (ORCPT ); Mon, 7 Oct 2019 09:29:05 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:37107 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728111AbfJGN3E (ORCPT ); Mon, 7 Oct 2019 09:29:04 -0400 Received: by mail-lj1-f193.google.com with SMTP id l21so13664584lje.4; Mon, 07 Oct 2019 06:29:03 -0700 (PDT) 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=B0ycQG3+LMWmEUo25NF7us/Cn/ZyGvcKYuOKAcoY2Nw=; b=ih8RvjSSN0e1gfuk9UFGxwtCPxmDxUUKXDR2j7kgAAXRMu4wgyGKseslzjlGxF0wnT WwiJnrNiatMEKK3fSmGpPg9jBY1snDSVhvdV42HvqvlypytByGBtbFSh2EO4P31k/tb2 K/urQXA3yGwM5/V9hcoFtwF1WfkhGL8LPPifu6/5Ez6EnhGiMUFO/rRpG3GFh1xY7sqJ rgWCfmjMEiPthf0g3GM/5GyjYiumyFzPYIIUOt8pt6TMon6DibQbPek6IWiSkCiqgpoF fiJ5eMkhGNtUH6FA9Vl3TcpgvrfMY+M9IEnRsR35ea8/OO7Nn3LXBDng52zcQV/c36h0 xQ/A== X-Gm-Message-State: APjAAAVLXZKCI2BC5D50FfJevqxIKCCBi4O8S0Xu6js28BxpbtUR8rP8 VByyp4U02VdzbIB/2y+oHAg= X-Google-Smtp-Source: APXvYqwYE/qHSZrjxd+iO9pBzFs9U39Vypyg0q0Zx4khhNEmjEkbb3i4WAdrYnHnIE40X3FEVKiN4w== X-Received: by 2002:a2e:5b9a:: with SMTP id m26mr15272472lje.90.1570454942468; Mon, 07 Oct 2019 06:29:02 -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 f22sm2702245lfk.56.2019.10.07.06.29.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 06:29:01 -0700 (PDT) From: Ricardo Ribalda Delgado To: Pavel Machek , Sakari Ailus , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ricardo Ribalda Delgado , Laurent Pinchart Subject: [PATCH v8 1/6] media: ad5820: Define entity function Date: Mon, 7 Oct 2019 15:28:51 +0200 Message-Id: <20191007132856.27948-2-ribalda@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191007132856.27948-1-ribalda@kernel.org> References: <20191007132856.27948-1-ribalda@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 925c171e7797..7a49651f4d1f 100644 --- a/drivers/media/i2c/ad5820.c +++ b/drivers/media/i2c/ad5820.c @@ -309,6 +309,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 Mon Oct 7 13:28:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 11177511 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 558081599 for ; Mon, 7 Oct 2019 13:29:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 354CD21D6C for ; Mon, 7 Oct 2019 13:29:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570454970; bh=A15UlAF/QwLEIxry1wzujIMx/0CxUPVtmvfkp0deoYM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=lva2/cXJHA1gvnU35aMUfBm+q+DD9wwsfOYLGphgom3ZKwxkJhse9A7xLvBaUbHWy QJlF5pmH9NgXhW7wujva7WZ5wHL//cy/fsoVuK7tTZdVJQiseguw+hhpJFP76WX3f6 2IJZr7pOAEMJxQYBIujieZkaXrLmHBKe6qfE+BZk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728416AbfJGN3H (ORCPT ); Mon, 7 Oct 2019 09:29:07 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:45942 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727324AbfJGN3G (ORCPT ); Mon, 7 Oct 2019 09:29:06 -0400 Received: by mail-lf1-f67.google.com with SMTP id r134so9243943lff.12; Mon, 07 Oct 2019 06:29:04 -0700 (PDT) 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=pqYD4jTL26Lkbsq1KtcLnT62csNab9jmgl1QSZGOUz0=; b=HwpPyQy5MQQ/Wi7GTUG/tRb/7MfSNtVgjW7FTxduVp5StaSEnX3kkChL4bCxkOFUOd 6v4UcsmKAbmgwMzEkkdhYcDqIN0fNG4jyKgIv/quGZtZrCGbL1fz+sQMdT0n+2wwwHTh 1T9QsweUSpn+SbSkxkhjn25hez4OfMQkZKtzn47Bk3TrEsmRcGEu8rY4q8QyqxN9PShY 3Il2P1f6jARXhN/gVLf9dOGRJOhAbrR+O50NUAd7rJ5ZcfNtdfbnHT5pYR8SYjCAfbxU QX7R2gouNpp7YGmO4JDHyTDsPB3jPRvgz9IFK0uxbs8ntIbIruHHeqIHE64wPzSIjSw6 XZGg== X-Gm-Message-State: APjAAAX9/uQgxe+za2aahXwcpQnKFQnROwYsmTJaTrBy6tSmTicw0y+E LrCEmh3XH3sQmTww7ccBWU3R+UsEVRsYag== X-Google-Smtp-Source: APXvYqyNQpxEHd5z1D3Qz5m5IShyRZbwN+ND3vrGJDazyPxUYYpX8ZIHxfsV/SZf1y1JaBb9QFF/bA== X-Received: by 2002:ac2:4a8f:: with SMTP id l15mr17121965lfp.21.1570454944104; Mon, 07 Oct 2019 06:29:04 -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 f22sm2702245lfk.56.2019.10.07.06.29.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 06:29:02 -0700 (PDT) From: Ricardo Ribalda Delgado To: Pavel Machek , Sakari Ailus , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ricardo Ribalda Delgado , devicetree@vger.kernel.org, Laurent Pinchart , Rob Herring Subject: [PATCH v8 2/6] media: ad5820: DT new optional field enable-gpios Date: Mon, 7 Oct 2019 15:28:52 +0200 Message-Id: <20191007132856.27948-3-ribalda@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191007132856.27948-1-ribalda@kernel.org> References: <20191007132856.27948-1-ribalda@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 Reviewed-by: Laurent Pinchart Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/media/i2c/ad5820.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/media/i2c/ad5820.txt b/Documentation/devicetree/bindings/media/i2c/ad5820.txt index 5940ca11c021..db596e8eb0ba 100644 --- a/Documentation/devicetree/bindings/media/i2c/ad5820.txt +++ b/Documentation/devicetree/bindings/media/i2c/ad5820.txt @@ -8,6 +8,11 @@ Required Properties: - VANA-supply: supply of voltage for VANA pin +Optional properties: + + - enable-gpios : GPIO spec for the XSHUTDOWN pin. The XSHUTDOWN signal is +active low, a high level on the pin enables the device. + Example: ad5820: coil@c { @@ -15,5 +20,6 @@ Example: reg = <0x0c>; VANA-supply = <&vaux4>; + enable-gpios = <&msmgpio 26 GPIO_ACTIVE_HIGH>; }; From patchwork Mon Oct 7 13:28:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 11177507 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6EE77112B for ; Mon, 7 Oct 2019 13:29:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4E17A21D6C for ; Mon, 7 Oct 2019 13:29:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570454967; bh=/ew1iTFSPFJl1GZ94sCBI0f4pcTvUs1Ne8ccMb1v1Pw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gIN/LCQUOzshfG6wRnKA5168KMpqH7UTMPZsYHsLJrg3OHdoxSrCdMnfSTI+diZ7n yK4JUsuJunNK7fuQhAQ/ERHlxFOOYdVFejyvQBrOLdqbY8BpnVtJFRrkR1CraHXr2T 34yJ5wQqORS960IP4/2BspwIbkXYCv3DgAvETGDw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728695AbfJGN3J (ORCPT ); Mon, 7 Oct 2019 09:29:09 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:41439 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728111AbfJGN3I (ORCPT ); Mon, 7 Oct 2019 09:29:08 -0400 Received: by mail-lj1-f194.google.com with SMTP id f5so13652672ljg.8; Mon, 07 Oct 2019 06:29:06 -0700 (PDT) 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=GX+ni17mNRYs8d+zDraCFt5XjyO8QrKC7e0GjBCgxpI=; b=GYD0iOccoMKwNvKs+vEGDYBXRrLp+SB1FXAc/ZYsuKjQ2i0ZwjaXuT8CoUYFznKI4D T54I0D3SzXKD6uDs+fjJAMNkrs6buEszxwtdTGFkfgTo0Z1OnKPieCcClOmqdgDTkl5w YCpTPh7GhUgaqG0SIFMTjHM8trLXLZC4Hms1hjr9Q/lIJ9O4Z3RdOXAJF/9jasFU9miV a9kXYixouTDUHk6JEpcnAFcYFmCJyhjk3zjMCKdQZNLJlqiVHps9FWx7LdkPzuENK4aO ZVOFC1LsJckAuJmNytBLWSrVbOb75IIhCS9abJ2/EHQMbiQzuKRQDc/tsBq7L87HSqkA 1rQA== X-Gm-Message-State: APjAAAXh8Di/GeHuHhKJIXr5aLDS3owF8O94FVo8Fk5/qGMUmcyys/g3 qCLzziAGvaAzipfS8+Otmn8= X-Google-Smtp-Source: APXvYqynuA5BGpbWsgvP1hes+JeGDkBXIl1Dy9tUzl9gPBMvAHVKebDueiFRLgJ0ybXNfKAMNKastg== X-Received: by 2002:a2e:9f4f:: with SMTP id v15mr18952799ljk.222.1570454945399; Mon, 07 Oct 2019 06:29:05 -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 f22sm2702245lfk.56.2019.10.07.06.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 06:29:04 -0700 (PDT) From: Ricardo Ribalda Delgado To: Pavel Machek , Sakari Ailus , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ricardo Ribalda Delgado Subject: [PATCH v8 3/6] media: ad5820: Add support for enable pin Date: Mon, 7 Oct 2019 15:28:53 +0200 Message-Id: <20191007132856.27948-4-ribalda@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191007132856.27948-1-ribalda@kernel.org> References: <20191007132856.27948-1-ribalda@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 78dc64d7b0e7..30d460844dff 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -975,7 +975,7 @@ if MEDIA_CAMERA_SUPPORT 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 7a49651f4d1f..76aab651f217 100644 --- a/drivers/media/i2c/ad5820.c +++ b/drivers/media/i2c/ad5820.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -47,6 +48,8 @@ struct ad5820_device { u32 focus_ramp_time; u32 focus_ramp_mode; + struct gpio_desc *enable_gpio; + struct mutex power_lock; int power_count; @@ -114,6 +117,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; @@ -128,6 +133,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; @@ -138,6 +145,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); @@ -304,6 +312,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 Mon Oct 7 13:28:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 11177509 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EBA97112B for ; Mon, 7 Oct 2019 13:29:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CB17E21BE5 for ; Mon, 7 Oct 2019 13:29:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570454968; bh=PmCPnqhm+mqW3NHQMWFGyIY08DssuymUnMjh8Unf1tM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=F+pNTHPERZxpW6MjSr1z5NkXQAKM66hmIQTr+ETCPTIx0tkTJpmQmm91Znat/cGgW ixYODrBku2Yk0qUVB3lA4dlIJVbikUX/d8QZCg8rbo9qVzFmeHor4FRVaCzRB0M02r 81t6iwim0lB80JBOlAzOHrAIU/N9O2FHQJ3E8Sws= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728685AbfJGN3J (ORCPT ); Mon, 7 Oct 2019 09:29:09 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:43675 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727769AbfJGN3I (ORCPT ); Mon, 7 Oct 2019 09:29:08 -0400 Received: by mail-lj1-f194.google.com with SMTP id n14so13622125ljj.10; Mon, 07 Oct 2019 06:29:07 -0700 (PDT) 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=RtunKeo/Z/Gny4X+yFZnXKaRyWAlxIelYmZYNvgXgHc=; b=kBfPkGuw4B8aHiaCh32bNFCUYURftznPeGgnHK62Y0UpOVqhiRCgvriJ7NBbOAuRFt tZ4zQxQ7bhVHl3A/FFoA6pnxEw4lz+sYFx4wqT2mh3L5/UNoZzJ+7RyHsk9gToTFHXxO AdmhaDZVGcfr4VDFMrc+Qe9zooBO/j1UccCzPzlBAkhp3T59vt+wI7i1LKDZCrSEGtRk CaZjWXx3Kx1Cx65xEe9STzyVzalKx8y9zJJhJ1M3bdy05xXJ0q4pyTl9aToJRBmC4VVE JPiM77HE93kIE83GU48yDtafwmRohPHNBOANmuiGZxnxtDuRGboH5AndDa+JUm+i+ZBs l22A== X-Gm-Message-State: APjAAAXV/S5jVYlCLdpKTUIhLBjFUMWk3SxM1dTa/PiIByhkQXzv9f3C x2gbYXG0WNUlaO+6ddWcCGtqFGnmhAFvoA== X-Google-Smtp-Source: APXvYqxalSmfg6q+qv8f/BniET3NASRNV7MHxeUy6OZB8VLsBDuCMnnu5niKocFxK5OGfqOeOkn+RQ== X-Received: by 2002:a2e:9e4e:: with SMTP id g14mr16223258ljk.253.1570454946791; Mon, 07 Oct 2019 06:29:06 -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 f22sm2702245lfk.56.2019.10.07.06.29.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 06:29:05 -0700 (PDT) From: Ricardo Ribalda Delgado To: Pavel Machek , Sakari Ailus , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ricardo Ribalda Delgado , Sakari Ailus Subject: [PATCH v8 4/6] media: ad5820: Add support for of-autoload Date: Mon, 7 Oct 2019 15:28:54 +0200 Message-Id: <20191007132856.27948-5-ribalda@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191007132856.27948-1-ribalda@kernel.org> References: <20191007132856.27948-1-ribalda@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 76aab651f217..5651609e5095 100644 --- a/drivers/media/i2c/ad5820.c +++ b/drivers/media/i2c/ad5820.c @@ -364,12 +364,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 Mon Oct 7 13:28:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 11177503 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 77C0B1599 for ; Mon, 7 Oct 2019 13:29:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5587F21835 for ; Mon, 7 Oct 2019 13:29:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570454953; bh=bVuSLpTvdW4BifGY1uYuDsq1DfGbsMyMvoeNSs5oiYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Bl6ppD0xYpgonPGJly8yO2mF5ueh94uf2bJ5u1Z1OSt5rhVyg+EF+0OUz9MeZ4mX2 bDMLty21OElUKZ6DTK8A3i7jejpUVBG+M0fv2KJTXiTA6hKjnslxFlw3u+iqb+rB4n G4tLjgXDDCFdArFd9vvaG1TMJQJMrMlUdfqC7tXM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728726AbfJGN3M (ORCPT ); Mon, 7 Oct 2019 09:29:12 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:40059 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728676AbfJGN3K (ORCPT ); Mon, 7 Oct 2019 09:29:10 -0400 Received: by mail-lj1-f196.google.com with SMTP id 7so13657579ljw.7; Mon, 07 Oct 2019 06:29:09 -0700 (PDT) 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=85dVJxc5Go/ZeDNecXfIZl1Or+Zhk6XQDSwO01sY1ps=; b=gzNNeeBszqp3/KV+na3cTXka/kkqVPVugqBXLgWKMFoCoXTBSHjHHko9SwborGKmro i3FOMrRfuAr6eNVgbbb+STpckXS9/1u07qLcHEDcUdktf28+PGsEg4k7i33rf6+KrclB MdhvzaV5dXo+P7ECoAeCtiSR45lJhpXOLUsCGLnrVz5n2RuKZcC6+9La7sxCqEKvoSBC PYxzMsBbyC4W7BmPArWDiN8CiA/WdhMV7FgYkij8D+7W+ysd9qWcAoygLZuT+T5dJ/ur ThoZ5lG9RtdKOWLdqy06dX0BtqdZ3w+gzsfARcx41q3qDKz9OqVF4H4QIaApr/feYFDV 9yHg== X-Gm-Message-State: APjAAAWXvLxNY05aRBsPf5PO4+Ohoojzd2CibXZ4zeGIRwnmj5UqHuHQ M+IbXCUzzDy7J8yWANfxUN8= X-Google-Smtp-Source: APXvYqwvWME0xvLnEG+UUjHxN+U6aEntTPN2I+EsnnNToVC4+03YuG+aEVvV70wTSxZ0eO6UvOobTw== X-Received: by 2002:a2e:84ce:: with SMTP id q14mr11639389ljh.250.1570454948315; Mon, 07 Oct 2019 06:29:08 -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 f22sm2702245lfk.56.2019.10.07.06.29.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 06:29:07 -0700 (PDT) From: Ricardo Ribalda Delgado To: Pavel Machek , Sakari Ailus , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ricardo Ribalda Delgado , devicetree@vger.kernel.org, Rob Herring Subject: [PATCH v8 5/6] media: ad5820: DT new compatible devices Date: Mon, 7 Oct 2019 15:28:55 +0200 Message-Id: <20191007132856.27948-6-ribalda@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191007132856.27948-1-ribalda@kernel.org> References: <20191007132856.27948-1-ribalda@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 db596e8eb0ba..5764cbedf9b7 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 Mon Oct 7 13:28:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 11177505 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F01D8112B for ; Mon, 7 Oct 2019 13:29:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CECD9206C2 for ; Mon, 7 Oct 2019 13:29:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570454960; bh=lh3E0CIAISDQ/3lKJtaW1VDx9XXZjg2jlkVnofxlIYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=yA/nm6GPq2y8QbddXe7qndC1bPj4h+esjB2a6tyojHCLydUPyH5qAaVP7a7lelU7L ZSE9U4QEuQtFgC/aRq9qRk85R/YywHG5km1LBeluxWm6shYf2VjVKlJJpKjubKH4ai HDCdLhGWfeiS5cDWAaXk6G9GaAqV2TJECvIYVkNA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728720AbfJGN3M (ORCPT ); Mon, 7 Oct 2019 09:29:12 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:45172 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728111AbfJGN3L (ORCPT ); Mon, 7 Oct 2019 09:29:11 -0400 Received: by mail-lj1-f194.google.com with SMTP id q64so13642604ljb.12; Mon, 07 Oct 2019 06:29:10 -0700 (PDT) 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=HJet7u3XjH5uyIC1W6N08PyBebZ0PR2V3K260AlKy+o=; b=BxkAgyWk61HnglB1x2ClXh89SsqovFauzNZXW5WxP3j2MksB+CfRB8tkBRRtQdj+cP /juGrFzMj6Z1OvxdtmmLZDeufGcAkuj8U1yEtOQO8r6M9mGOhhBVsrHhJy109UaqNIpV +nVKmQJYxDJJW6Zi83p+vv7rmsn95GZsTo/wZ1/9SuKhhdJYLYVoxm/Eten9tj6pTse3 R281fUQiOYCk1/f/HbIf6mKY0kUCEaDo94g/isZXmjn5a1YG53x4oNcFIvl5fnIUl3a6 iMiMNW8VrPvTv1BbUJSQCKxP2h3MpK3yeH+EZ94YS5AHkov3qEVSt+oLZrEY6I6y/xa6 UAWw== X-Gm-Message-State: APjAAAVEMk2sO3fapLbXOjJpmWlT8AvdTHXp6NiGYDvQ1VmS/Sux4PcV zKmovlnot11Y6Pz9YaaGlfbPRv3xH0OAbg== X-Google-Smtp-Source: APXvYqxdwg5MA2DqBA8x+1g7LAL/F6hUg47f+KLMirBf2IIgIM7uUDeO/r2dzlSBMJHa130Ydkc6dw== X-Received: by 2002:a2e:8ec6:: with SMTP id e6mr18199965ljl.231.1570454949599; Mon, 07 Oct 2019 06:29:09 -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 f22sm2702245lfk.56.2019.10.07.06.29.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 06:29:08 -0700 (PDT) From: Ricardo Ribalda Delgado To: Pavel Machek , Sakari Ailus , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ricardo Ribalda Delgado Subject: [PATCH v8 6/6] media: ad5820: Add support for ad5821 and ad5823 Date: Mon, 7 Oct 2019 15:28:56 +0200 Message-Id: <20191007132856.27948-7-ribalda@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191007132856.27948-1-ribalda@kernel.org> References: <20191007132856.27948-1-ribalda@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 5651609e5095..19c74db0649f 100644 --- a/drivers/media/i2c/ad5820.c +++ b/drivers/media/i2c/ad5820.c @@ -25,8 +25,6 @@ #include #include -#define AD5820_NAME "ad5820" - /* Register definitions */ #define AD5820_POWER_DOWN (1 << 15) #define AD5820_DAC_SHIFT 4 @@ -359,13 +357,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); @@ -374,7 +376,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, },