From patchwork Mon Oct 7 13:20:39 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: 11177453 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 F1C27112B for ; Mon, 7 Oct 2019 13:21:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D0CDF218AC for ; Mon, 7 Oct 2019 13:21:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570454465; bh=vdbVNKK2cjLjt0uI5e0Df8suBVPHqSbN68ZVOy8d0WA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ehn23iH7z/P+fNguLjcLQ0ldOK+ODszJHpePJ1+taAcnJvaCqiKSaxjY0brQ41w/E 6DJ/GUOR6HELstIGKfrcrpih3wTEBSEOeNGJa2Xbl870ARd1P0e5/3+ekBeNHOPhaA kIofaPiPvsyqnEm/O4W99RwvZdIpdQ1xNM5QQ2VI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727957AbfJGNVB (ORCPT ); Mon, 7 Oct 2019 09:21:01 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:42480 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727324AbfJGNVB (ORCPT ); Mon, 7 Oct 2019 09:21:01 -0400 Received: by mail-lj1-f196.google.com with SMTP id y23so13599129lje.9; Mon, 07 Oct 2019 06:20:59 -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=LU66QDFKpb3kbaZeRzxxpeLNRPF93nH5WIe/X90mwNtclauejuLg8z/ib63g+x+gvx GxhrfbvUEuTkO2a3a4Zk6vVkhfe3SSA4SRfcQRHWe9pEA+szzUHk5SuVqqhiP+leGkVH 0LSWVX/Ijuo86DtHepBlc2pW84aAFLh2PPLeg4mLSdGp+LGqACZ2VgtNL9ewGLtDvB52 0bh7Hj0MlZts6VZJHLSplp0oeitu9I+5woCOic/SZQFeVg48X/+lBwtZL+HedewUIJSi Pfj9E3s9QA+SsO+7H8FB47F/siv5SNB2H4UNBbVm6dqwhKpBdoZmhNpMxaSWgcYg1/AX duqw== X-Gm-Message-State: APjAAAUIZSgo98zZqaweNuVi8WkX9EkyVeemOvhMIawsgyrJnAJWqKhk ldfaAJeq69Ik6xPlYsEr1H4= X-Google-Smtp-Source: APXvYqyAgDiVoPygX9FC5R8yba0eh0Im6+tqrhDhqTUSjsix/NO8TsyVRSyRbNcPP2LxnR7RNH9fKg== X-Received: by 2002:a2e:9094:: with SMTP id l20mr18976621ljg.35.1570454458909; Mon, 07 Oct 2019 06:20:58 -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 z14sm2687360lfh.30.2019.10.07.06.20.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 06:20:57 -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 v7 1/6] ad5820: Define entity function Date: Mon, 7 Oct 2019 15:20:39 +0200 Message-Id: <20191007132050.27298-2-ribalda@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191007132050.27298-1-ribalda@kernel.org> References: <20191007132050.27298-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:20:42 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: 11177475 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 99339112B for ; Mon, 7 Oct 2019 13:21:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7836E21871 for ; Mon, 7 Oct 2019 13:21:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570454516; bh=A15UlAF/QwLEIxry1wzujIMx/0CxUPVtmvfkp0deoYM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=OuzDrWRn1ne91NCvmY2lDp5uhCuh0R6ouKS5sldz6BheLPP3WxvIPCyTZqcRmet4E Tsk5OSLpJHrhyhRM2yF4/jeI/aADEplZroQdoTZm/WnncJyFIQ2omziM6VPBP49Fs6 7MrVSCHWIBG8xEo43sgVR99zrfv0Eo1jp+x1/HMY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728207AbfJGNVK (ORCPT ); Mon, 7 Oct 2019 09:21:10 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:42996 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728146AbfJGNVK (ORCPT ); Mon, 7 Oct 2019 09:21:10 -0400 Received: by mail-lf1-f66.google.com with SMTP id c195so9252841lfg.9; Mon, 07 Oct 2019 06:21: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=pqYD4jTL26Lkbsq1KtcLnT62csNab9jmgl1QSZGOUz0=; b=N0L/q4RhwlTDYjQL3qyvAE/u8NXu9WXKRH75QjMnab8Vf39ZquOaIpz0K/YmdwopH8 f52ENi/wk/NASP0/D2FE34oCbp5wX5BqWFL23zbbbAy7+Rba4U5aTDrkcL2VKZAuzEPM IeAorZGmE/Tfe5IMsitVvTjm6lVRsDJvohoVmMG7MDbRQWlpkyRdjOXvYTtqDhjl9Cu7 jeJT06mdEFgHKR0McA3zXa+OH8tlKN/7Zl4pH/1gw4YU61EFFZ5wkZOo7S1JImPzR2oy l2wptcGmwq7K12Sbbpxtf/MEtctTi1OmoSic9H8NrULI0sldB83TpRuK5HVt+YIfuCf7 8SfA== X-Gm-Message-State: APjAAAWh4R/ZQ6KaCbnL91wxkEFvBc+GWRbmdM+Za8ttt7LupXxOQAPu 0Ni2upSMjS9cnXe03hSUy7Q= X-Google-Smtp-Source: APXvYqxIVbxcggiIaXX0a4HyTjY38j2zcYaCHKHhIx5HIBWlTeAvmyKaGK6vXDy0GRtbYosRkRKyWw== X-Received: by 2002:ac2:4a8f:: with SMTP id l15mr17100501lfp.21.1570454466311; Mon, 07 Oct 2019 06:21: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 z14sm2687360lfh.30.2019.10.07.06.21.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 06:21: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 , devicetree@vger.kernel.org, Laurent Pinchart , Rob Herring Subject: [PATCH v7 2/6] media: ad5820: DT new optional field enable-gpios Date: Mon, 7 Oct 2019 15:20:42 +0200 Message-Id: <20191007132050.27298-5-ribalda@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191007132050.27298-1-ribalda@kernel.org> References: <20191007132050.27298-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:20:44 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: 11177471 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 06819112B for ; Mon, 7 Oct 2019 13:21:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D96EE218AC for ; Mon, 7 Oct 2019 13:21:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570454511; bh=/ew1iTFSPFJl1GZ94sCBI0f4pcTvUs1Ne8ccMb1v1Pw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=QnUWlWF0VeUPhKXkvMHRs0Afd6frzpDci7vl1ayaAzrY0YXt4ReITJGn8733K+F7M lkKS2w0BAaCN4Cbaqk4K/vEy8WTKJbiXbojfXDPCR/MuvWrxTsJ1G73c+krUgpnL85 3c7hxJTE433eEvfRjH/PzeYRZ0i1O7c4woOyiyc4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728328AbfJGNVN (ORCPT ); Mon, 7 Oct 2019 09:21:13 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:37014 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728235AbfJGNVM (ORCPT ); Mon, 7 Oct 2019 09:21:12 -0400 Received: by mail-lf1-f68.google.com with SMTP id w67so9267555lff.4; Mon, 07 Oct 2019 06:21:11 -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=CHYrG2G8fWBGdJvgo67uDoIed/9CPtwZPTYTNmjRF9kZFAu2rdIFyrO9ixoD1IcKkQ kscz1pUoiQxOtb6Cf2hgDC4GEx1X1FENNT7kcdpQpua3+bWbhADJfBCkWizWtzqVko1l iMiC+jkj3j++4/Hp3GLOCe145LAefo9txz3HF8RO1iD0up8c1/2mgx+w6fVRxoPvQFeN feqCDHrrcSEycsRn0yMjNFqaIVivh8F2Jczw5PfS789CdElZYHk1kK5ekwn14jUvD95W DkcA1Vl9p0Bc9k0g5kAI6eKbvRkQkw2L06VIsySsg+5ubrLjXch2QjzzKOYhzN43iBJM 3wFg== X-Gm-Message-State: APjAAAV1OPAeKq7h/bhc6hlhHqEsXr4noHt+TorhWL11ZICvPnabg6F4 +bNxpfWdS0hllHK706GqYKI= X-Google-Smtp-Source: APXvYqwlE8mz5IqyFoGHNe1iuu0hWCBGRHHravGVWOyYThgV5dMLWivqXmj1Cc/4oxMSs0RrQq+SSg== X-Received: by 2002:ac2:48af:: with SMTP id u15mr17147302lfg.75.1570454470551; Mon, 07 Oct 2019 06:21:10 -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 z14sm2687360lfh.30.2019.10.07.06.21.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 06:21:09 -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 v7 3/6] media: ad5820: Add support for enable pin Date: Mon, 7 Oct 2019 15:20:44 +0200 Message-Id: <20191007132050.27298-7-ribalda@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191007132050.27298-1-ribalda@kernel.org> References: <20191007132050.27298-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:20:46 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: 11177457 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 08E8D1862 for ; Mon, 7 Oct 2019 13:21:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DB7FA2190F for ; Mon, 7 Oct 2019 13:21:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570454480; bh=PmCPnqhm+mqW3NHQMWFGyIY08DssuymUnMjh8Unf1tM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=oMxMPzIQyFWYXUB5HJjxzlVm6mRFUxMGIKT6hDtRKsQfkRWEALjVo0tW7AzZThNBD I9Fa5vXpSIp5hfkEz5D11rt9Nd5+ur1Yy/4XipvB8ll1BTH0XfUZ0ThbbF9r/IuVIu /DUAV6YNShEmn6T5dYPBoqW/+ujTsybnZ2OogU4g= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728445AbfJGNVT (ORCPT ); Mon, 7 Oct 2019 09:21:19 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:42537 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728436AbfJGNVS (ORCPT ); Mon, 7 Oct 2019 09:21:18 -0400 Received: by mail-lj1-f194.google.com with SMTP id y23so13600281lje.9; Mon, 07 Oct 2019 06:21:15 -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=GR8DpSO3pAgjZcO19fYqayemLsmwi5QDbtXQd++WVmFl6INXgZcbgVrfDKb2iHIlIe J6YnFuU5SKvg9nUUh59+tS1zyDFp6npYV0gaeC6dG8v0JvUXsqRzgDOcI0VdZdjiB4FS aPMsCLW447FEM1Ozvb/KXvP03V+uYGwGcatEDdmqduba3H07lnFgNE8T4yRIZZBI48bJ Q0OynM6G+lFacB+EFOFhn6CpKPXyTHhffPbz9IYzTK4L0XLwlaRHxD4Ql2dvYAnbZfHy sD2O/6MxhNarcE7VlYsPEsgrF2lTFc934y6Gd7qiSyDhz74tJQKNQRsCFBRS8PkVwLsa 57lQ== X-Gm-Message-State: APjAAAVi2dqSp09gYsP2XtykA3YOJpEjWQnyy24Fob8R2LoybdGFxYoz Ac2PSfsqneXd0hxPA82afNQ= X-Google-Smtp-Source: APXvYqxpMrTSq/EnONq9VLiOo61KjUjNJFNYe0/tQukLKTvegA+qNfllcW8LqNAFio6ewxOhS2nKhA== X-Received: by 2002:a2e:3004:: with SMTP id w4mr16203572ljw.242.1570454475235; Mon, 07 Oct 2019 06:21:15 -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 z14sm2687360lfh.30.2019.10.07.06.21.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 06:21:14 -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 v7 4/6] media: ad5820: Add support for of-autoload Date: Mon, 7 Oct 2019 15:20:46 +0200 Message-Id: <20191007132050.27298-9-ribalda@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191007132050.27298-1-ribalda@kernel.org> References: <20191007132050.27298-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:20:47 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: 11177459 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 55BE01599 for ; Mon, 7 Oct 2019 13:21:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2A5AD21924 for ; Mon, 7 Oct 2019 13:21:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570454482; bh=bVuSLpTvdW4BifGY1uYuDsq1DfGbsMyMvoeNSs5oiYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=HC6gffazp0GD/0PFKIOackHsPwqftu3B95vrUQeMJjjivDg81a1bTlJzBJ6N46QMj w4jqmdLX0kV0LJTKL5qkUJCQ6DoPWFCYW8JZ4aHhf8HfCwYN2tkOedAa7CX1XorGg6 wENa/WpHvQIy+J9TcNWYMmwDwzAIWBHo3FsqT9Zc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728470AbfJGNVV (ORCPT ); Mon, 7 Oct 2019 09:21:21 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:35130 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728177AbfJGNVU (ORCPT ); Mon, 7 Oct 2019 09:21:20 -0400 Received: by mail-lj1-f194.google.com with SMTP id m7so13637799lji.2; Mon, 07 Oct 2019 06:21:18 -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=Wcoeo6mzx3dncHyYoUB6QXVPbMPJgY0JzBpYJxcpjrhVGruroDOpyg7d6+UOAPAP4W LbMt47VIPh7Pt8918clafZPMYmprN1m0vySSdItMxwNM16nS4oAxhLvsXof3Zz+VL6iI Y0leTFn8pjESVNztS+Mr6fBBQ4hSaS6tH4TLtJQYHoOhsE2UD3Rkx8YxbF9sscr8KPca nBxaw6GSzWWtrW8++b7K/WzN/TtjsOJ/qcTO4qA1TXFCYqlgJzB7Dm2rmPV/jh5wtiIW VdRJ7IGCyCdXa++gO/VSuH94JEMbKNjJ3wD2XWlCffnQEYvWs0aPNXcdN6czgchz8S94 Qhag== X-Gm-Message-State: APjAAAXZ3LGKcEMwg56KdecFkk6Pea1uOSmaieF+3h3vbuA+UrVJwrbS bylRzLXGS9qfj/KqqGtICbU= X-Google-Smtp-Source: APXvYqwiLSTKdVOFIY8WgaeBunLsCGFVcf3kuoeei/5/yKb+L3k/LDhcTnI6Y1NHVwQ5NjvySirDVA== X-Received: by 2002:a2e:9652:: with SMTP id z18mr14259586ljh.249.1570454477573; Mon, 07 Oct 2019 06:21:17 -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 z14sm2687360lfh.30.2019.10.07.06.21.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 06:21:16 -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 v7 5/6] ad5820: DT new compatible devices Date: Mon, 7 Oct 2019 15:20:47 +0200 Message-Id: <20191007132050.27298-10-ribalda@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191007132050.27298-1-ribalda@kernel.org> References: <20191007132050.27298-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:20:50 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: 11177461 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 32F971599 for ; Mon, 7 Oct 2019 13:21:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 11C8F21D7D for ; Mon, 7 Oct 2019 13:21:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570454501; bh=lh3E0CIAISDQ/3lKJtaW1VDx9XXZjg2jlkVnofxlIYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=yu0N4cxMFASSwFOYwSvgzf34h/ucw2Sp9Y92OkqFTSp467P2Warrh9y11Fys5MUrs rFCWi06hFxkHP+pjY6yemgItdsoMJuaL7MWTzJmbNPFb1s34sW4flJWrCqgiIpHRIf yFvV5bvT1XgOWHJTaMV6P1/w+k5njmc9xrKzg2EY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727744AbfJGNV1 (ORCPT ); Mon, 7 Oct 2019 09:21:27 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:35075 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728037AbfJGNVZ (ORCPT ); Mon, 7 Oct 2019 09:21:25 -0400 Received: by mail-lf1-f65.google.com with SMTP id w6so9258482lfl.2; Mon, 07 Oct 2019 06:21:24 -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=hGURAdqxyvaZNgGenotBSl0qObvzE1uXbhhxmmqhqTgbQF1TiyXKdZGDqQpix8B7H9 dJnv/2RDwjC3vZ8bvw5HitV79P26yrZBX0KxoXOv3GdbmXtWjhCERSZt1S45fiTuYbtg hbe0OxoAT4RC9wTwLVnUNuyFncs+ztCR+zaogZLmyINTTbZFI499ca/8cV8JTTkWMRGf ysObdL+NWOij8D1YV4RLkq1O1L+f70tTSBNGKd652c45gnsCa+XwkRxuW0KbBK/59+GR RTnlQ4LEnJBaM12DdoyZF9LoNoiWQDTnTkLeSOWOeCevH2eWI8oFVE2DdycM1LJooxmc rrUQ== X-Gm-Message-State: APjAAAV2sykIl4jVuqgD+mHkx6+FzrEAXttp9Uzuz9EVoWHrVdZceg2I S+++l5DoRtJD0quTJ9JN/zs= X-Google-Smtp-Source: APXvYqwU+3IDd56V8REUm/VKUng0jSzZNgI5QaxrVJINxWIdURu92I/9j9THsKkBPUf7UUIop5ogwA== X-Received: by 2002:a19:8a0b:: with SMTP id m11mr16757470lfd.4.1570454483254; Mon, 07 Oct 2019 06:21:23 -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 z14sm2687360lfh.30.2019.10.07.06.21.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 06:21:22 -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 v7 6/6] media: ad5820: Add support for ad5821 and ad5823 Date: Mon, 7 Oct 2019 15:20:50 +0200 Message-Id: <20191007132050.27298-13-ribalda@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191007132050.27298-1-ribalda@kernel.org> References: <20191007132050.27298-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, },