From patchwork Fri Dec 9 14:37:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yassine Oudjana X-Patchwork-Id: 31785 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp814077wrr; Fri, 9 Dec 2022 06:39:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf4yBMNZbzl79H2jfvxzw9brOLIJ+EaOlBD1DE3eL44FwcIibDmg6fARx4ffn8nVk9WCnuXG X-Received: by 2002:a05:6a21:9007:b0:9d:efbf:48be with SMTP id tq7-20020a056a21900700b0009defbf48bemr6252164pzb.2.1670596791100; Fri, 09 Dec 2022 06:39:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670596791; cv=none; d=google.com; s=arc-20160816; b=hLr/nwtDpX1HfWx+T63Wz5IMoRl8JcRxrLPfoQkgCkM2JMcALRgrMZhMeqZgV9hHIX 5kSzFYZ8XI8OrtwNSaUaqPXQNGFldnySHxQrIN5kbZpLvVjqkGBLTeyNWy2eORGegrTW KDFiiqkLuHqO9qD+rct2XprdxTQkuRY/Z1CmQakKg+HP8piH2wA2AVU7pH3L9GAWUSTT 2dikwes+sYN1r4I+5FFsn/gfDvJlg0inp4Qpf7qz7Mho+VzGWt9x+5nHzhw3f2xAzVFh mAG3TQtsce9JxdC0kCea8fgprbfn/O7tGEtusRueBDnd1k2BJVXsW6xEy9qwnMfLyn0a ENvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KCCqc2mN6PDwZNJTpNkZ/sMpb25Tt4lXb3t6nfn4XxQ=; b=K1xevIAN2BH10M4GCtvzlp9PEykIm6zSkcdmCrFKKaQTOAP+9hSCzEklzF+kPB+UQs phfoi3N9uIbHp2DYXb41YP2QWpKUK4q/yz1kG3gWytGurB+VSXWYcECKoHolKzOfU7di Mb8GTn03RdDuL//nw24mJgvmlPkxnbQarF+k7ZkJwpe+Z33vQKK/UjVLz4H6InWluDTf 66x27mIL0/Tc/XrYTjDMMJuAcsKRkJKxzsaltFN+rsxjwKrtAMdtQW9qW2einUf4y8Wb LLjO8/dmDqvEDTtXKnP2RXmzvcR630bS4FEU2O683JU7x2LFvmTPJisnkuQ9Pkg3pm3Y dLYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TjvKSMpv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 20-20020a630314000000b0047882ff26basi1626189pgd.475.2022.12.09.06.39.36; Fri, 09 Dec 2022 06:39:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TjvKSMpv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229909AbiLIOiE (ORCPT + 99 others); Fri, 9 Dec 2022 09:38:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229875AbiLIOiC (ORCPT ); Fri, 9 Dec 2022 09:38:02 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79F2922536; Fri, 9 Dec 2022 06:38:00 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id v7so6593wmn.0; Fri, 09 Dec 2022 06:38:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KCCqc2mN6PDwZNJTpNkZ/sMpb25Tt4lXb3t6nfn4XxQ=; b=TjvKSMpvEouDWWWllhaB6LIzYAWG8PCYo5x2O6lPpvyx7Fd9I3iu3L994KkNwFIesN 63CLF2zm/7O87FcDOadkUnllJvmPSj+2B7Jy7QmRj3wuzb58xg0zK7tWknmRsuD3qecf f/czNK4hZsGj+4NxsjtnwuuqWuT8tCKaSKA8BdRqGNfD6C98tzNVKSTacZiJThp8pdhR uLJcj2PMWtjaHczK6QswhXzX/tzws7UcwlA5toymcvDeuvYQcuah38xckAbLTcmX8GvP cyOIrTTbfdK7gKj2sIvjO1zWA3e5Vn6hvwe/ScC5wjPBrE46i8+e2qcpI+jIJsWRG+K3 OOgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KCCqc2mN6PDwZNJTpNkZ/sMpb25Tt4lXb3t6nfn4XxQ=; b=39T0s2ts6LiO+uiHpgq7R7N6wL2Y2G6I+A0ZhBUJKhvKeRA7BKTRMm4Ric12AGPZdt EAEluQgaG/EvSYqEXP+f+vEv3zE1AJ08Nib00rd8DmR/dLNVgXELQL6GyLE3Qnbsn7IM P/BXNEBYGNay19jSRqFv+MN3GaW/tdI0Fo8QBcJk4zjZV626s61K3veaTgzUMJOOJBF5 rzJYfb/ZSmvE3HEAc/zNyBdMqail9ryYD9rrDfXvOH4Al08q14xZ88MCtcRlqjPJjTAY u5laGolB5/Gejlid8X0zATRdUcpdjh79TTpUvkV7ThTSEzLowqy57jEWM25gGLUgaBTz q0Ug== X-Gm-Message-State: ANoB5pmqZPEJRork/sHgoLW9uvzWeic970H+r7J9BtfDvnV5x0K/kEJ6 ldtYO6jeh8sr208/KD5QjoQ= X-Received: by 2002:a05:600c:4fd0:b0:3cf:d367:274d with SMTP id o16-20020a05600c4fd000b003cfd367274dmr5055660wmq.31.1670596678826; Fri, 09 Dec 2022 06:37:58 -0800 (PST) Received: from localhost.localdomain ([95.183.227.98]) by smtp.gmail.com with ESMTPSA id m31-20020a05600c3b1f00b003d1e3b1624dsm9645517wms.2.2022.12.09.06.37.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Dec 2022 06:37:58 -0800 (PST) From: Yassine Oudjana X-Google-Original-From: Yassine Oudjana To: Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Tianshu Qiu , Bingbu Cao Cc: Yassine Oudjana , Yassine Oudjana , Jacopo Mondi , Lee Jackson , Christophe JAILLET , Umang Jain , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski Subject: [PATCH v3 1/3] media: dt-bindings: ak7375: Convert to DT schema Date: Fri, 9 Dec 2022 17:37:39 +0300 Message-Id: <20221209143741.214242-2-y.oudjana@protonmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221209143741.214242-1-y.oudjana@protonmail.com> References: <20221209143741.214242-1-y.oudjana@protonmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751747700671829818?= X-GMAIL-MSGID: =?utf-8?q?1751747700671829818?= From: Yassine Oudjana Convert DT bindings document for AKM AK7375 VCM to DT schema format and add an example. Signed-off-by: Yassine Oudjana Reviewed-by: Krzysztof Kozlowski Tested-by: Umang Jain --- .../devicetree/bindings/media/i2c/ak7375.txt | 8 ---- .../media/i2c/asahi-kasei,ak7375.yaml | 41 +++++++++++++++++++ MAINTAINERS | 2 +- 3 files changed, 42 insertions(+), 9 deletions(-) delete mode 100644 Documentation/devicetree/bindings/media/i2c/ak7375.txt create mode 100644 Documentation/devicetree/bindings/media/i2c/asahi-kasei,ak7375.yaml diff --git a/Documentation/devicetree/bindings/media/i2c/ak7375.txt b/Documentation/devicetree/bindings/media/i2c/ak7375.txt deleted file mode 100644 index aa3e24b41241..000000000000 --- a/Documentation/devicetree/bindings/media/i2c/ak7375.txt +++ /dev/null @@ -1,8 +0,0 @@ -Asahi Kasei Microdevices AK7375 voice coil lens driver - -AK7375 is a camera voice coil lens. - -Mandatory properties: - -- compatible: "asahi-kasei,ak7375" -- reg: I2C slave address diff --git a/Documentation/devicetree/bindings/media/i2c/asahi-kasei,ak7375.yaml b/Documentation/devicetree/bindings/media/i2c/asahi-kasei,ak7375.yaml new file mode 100644 index 000000000000..22b1251b16ee --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/asahi-kasei,ak7375.yaml @@ -0,0 +1,41 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/i2c/asahi-kasei,ak7375.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Asahi Kasei Microdevices AK7375 voice coil lens actuator + +maintainers: + - Tianshu Qiu + +description: + AK7375 is a voice coil motor (VCM) camera lens actuator that + is controlled over I2C. + +properties: + compatible: + const: asahi-kasei,ak7375 + + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + ak7375: camera-lens@c { + compatible = "asahi-kasei,ak7375"; + reg = <0x0c>; + }; + }; + +... diff --git a/MAINTAINERS b/MAINTAINERS index 997e75dbca5c..08d93513e792 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3224,7 +3224,7 @@ M: Tianshu Qiu L: linux-media@vger.kernel.org S: Maintained T: git git://linuxtv.org/media_tree.git -F: Documentation/devicetree/bindings/media/i2c/ak7375.txt +F: Documentation/devicetree/bindings/media/i2c/asahi-kasei,ak7375.yaml F: drivers/media/i2c/ak7375.c ASAHI KASEI AK8974 DRIVER From patchwork Fri Dec 9 14:37:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yassine Oudjana X-Patchwork-Id: 31786 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp814764wrr; Fri, 9 Dec 2022 06:41:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf62CAgdil9LnB0gqX7Y6SW3aDxaVm0HHVTH7jtkMUKfCoZWjp/PA6h1VWWCePMpD7eC73j+ X-Received: by 2002:a17:902:e011:b0:189:8062:d8e with SMTP id o17-20020a170902e01100b0018980620d8emr5686447plo.7.1670596870675; Fri, 09 Dec 2022 06:41:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670596870; cv=none; d=google.com; s=arc-20160816; b=HI7p/6wvVaqKT/XweCaIls+afXAM1XLIy5U7zCwEE9WMD/Z/PphdHynJtdBkHrcLuO N+paFrSWtd6j9eef2rR9FoV4dD/IoQdiWpz0OcOSKQ0U1tqfQphxXovySqGO76P0+5sz gyI6Azl2+PFDdkFD1gW+jFBHKUxIykyhMXaNXWfDF08VZ2Iai8/lGaQDtd3PXqu3SZ9j d1uJEfBd4e+wztBoM323dKLS3xbS6SnVgaBAlUS2MXrmVNUNG1j2ZTvEaZM1hpz1pvho sDbA2dTnVHd/wWqNEF0L9blexVhAWlxkOZ0pzstpchwy0RflSPdqPGBChDvCu1oBjQZ6 LGgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cvV3cPG3K4cvqvxBtqhjbOYVyBlWZ69Pt9FKlRh4MCo=; b=fgOWr0QEWXPcukt0aQdF9+XZCXF6bKHQNgrE8P+oKDB6Nq7LOaINfejsYSoGJvglsT Wlxj/XHGST6sw/YVdhWD06SVHPrgzF+1q8Ym9O2r4OETyBeX64EHhlArDOt2QAkZfm6z zifD4edov7AY2RVp7eLJoKGgbFT6nfo8dRaDzabPSH6lkkGaKpZ2tgk8FjWquP0Fa4oO 2IPypqcelKvkD06mnItMWCpZDbTicwrRh2GmZoRPmaJ7lRn4q01cQ8L55684H2ycIuul qQeQfZiheZmwjri+dZD639utC7IIn5Un3Jzs88ewSR6xsMI+X4OyTewvzUzbca4/3oPm L3Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kywWHMjs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p7-20020a170902ebc700b001755d722578si1626383plg.524.2022.12.09.06.40.57; Fri, 09 Dec 2022 06:41:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kywWHMjs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229807AbiLIOiI (ORCPT + 99 others); Fri, 9 Dec 2022 09:38:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229899AbiLIOiE (ORCPT ); Fri, 9 Dec 2022 09:38:04 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42D8B23E96; Fri, 9 Dec 2022 06:38:02 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id h8-20020a1c2108000000b003d1efd60b65so4886wmh.0; Fri, 09 Dec 2022 06:38:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cvV3cPG3K4cvqvxBtqhjbOYVyBlWZ69Pt9FKlRh4MCo=; b=kywWHMjsf352aulDMz8ameENfk8HAdU0LBgrbSYTRbEy9OePwULQYuig1MGCQUdQoY kM4F//k/FLWqG7h1CPgbVcsLIzPPq5OyTfj1QfIJ8vSJ6rFQrFgIPMh7SQsBmKYQQP54 vIVxpIQNZvMEIlifFb5GKvEG+f4rLH4GO04ta6hj16oudphHh/RhAFzl7xrybBEelQih KAOd6DpzckpBQYS7D1+EtUF9L23eqZmxMGTZSlL+k2qGuhXSVa/8/OKTEh5X9m/qUNmh N+3tgTN8sP7v7JCWc6bqzstGrU/HaHUXvOfSh9qaCVyl7bQHes95qTE1kKUBhOIAkXB0 Qz3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cvV3cPG3K4cvqvxBtqhjbOYVyBlWZ69Pt9FKlRh4MCo=; b=W3dEujUxUZm4Ar0km9po9+mMUZXwwZZTEIBxUFzNDXvwYMI4QM4Nkz8+/00q0oAQU3 ITjs2V8deBaUzHqmIufwzw/pfLIdRIHhifzqw08hpRWnkZ6OBvIRClpardb50lKOCEU9 XS1Naax0445dgDdYzkrPlj3q0jMk3v9u/aUXftbu+6zi7DEW/xM99HZNlVPkpqyKDVC0 2qmQPhTrKG43h2qFrjodXoAyRSEXH0i5a6iSx6RqSqnISDzxlMwhHW4LkQsSCPc+TDUP VhUBZONCbztJ9yNhFd2bjVa+Xm6C5TlTRdCJBbjRXh0h8Ne/ELA1cWlNl6iAmAmBxZfP Pwpg== X-Gm-Message-State: ANoB5pnfH5caLSqOE4J0X4ItPR6jKgm6vX3U2li1Ky1Z6OPdV92upGl/ CbvuMJz3gZ0Llcxrb5BLB7Y= X-Received: by 2002:a05:600c:654e:b0:3d0:6a57:66a5 with SMTP id dn14-20020a05600c654e00b003d06a5766a5mr5345486wmb.0.1670596680751; Fri, 09 Dec 2022 06:38:00 -0800 (PST) Received: from localhost.localdomain ([95.183.227.98]) by smtp.gmail.com with ESMTPSA id m31-20020a05600c3b1f00b003d1e3b1624dsm9645517wms.2.2022.12.09.06.37.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Dec 2022 06:38:00 -0800 (PST) From: Yassine Oudjana X-Google-Original-From: Yassine Oudjana To: Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Tianshu Qiu , Bingbu Cao Cc: Yassine Oudjana , Yassine Oudjana , Jacopo Mondi , Lee Jackson , Christophe JAILLET , Umang Jain , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski Subject: [PATCH v3 2/3] media: dt-bindings: ak7375: Add supplies Date: Fri, 9 Dec 2022 17:37:40 +0300 Message-Id: <20221209143741.214242-3-y.oudjana@protonmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221209143741.214242-1-y.oudjana@protonmail.com> References: <20221209143741.214242-1-y.oudjana@protonmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751747784022362649?= X-GMAIL-MSGID: =?utf-8?q?1751747784022362649?= From: Yassine Oudjana Add supply properties to describe regulators needed to power the AK7375 VCM. Signed-off-by: Yassine Oudjana Acked-by: Krzysztof Kozlowski Tested-by: Umang Jain --- .../bindings/media/i2c/asahi-kasei,ak7375.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/media/i2c/asahi-kasei,ak7375.yaml b/Documentation/devicetree/bindings/media/i2c/asahi-kasei,ak7375.yaml index 22b1251b16ee..22a810fc7222 100644 --- a/Documentation/devicetree/bindings/media/i2c/asahi-kasei,ak7375.yaml +++ b/Documentation/devicetree/bindings/media/i2c/asahi-kasei,ak7375.yaml @@ -20,9 +20,17 @@ properties: reg: maxItems: 1 + vdd-supply: + description: VDD supply + + vio-supply: + description: I/O pull-up supply + required: - compatible - reg + - vdd-supply + - vio-supply additionalProperties: false @@ -35,6 +43,9 @@ examples: ak7375: camera-lens@c { compatible = "asahi-kasei,ak7375"; reg = <0x0c>; + + vdd-supply = <&vreg_l23a_2p8>; + vio-supply = <&vreg_lvs1a_1p8>; }; }; From patchwork Fri Dec 9 14:37:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yassine Oudjana X-Patchwork-Id: 31787 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp814978wrr; Fri, 9 Dec 2022 06:41:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf5lp2LsCHvaeVNqpmQHhdiy5mEKceh7VKnCmjvINYW1HdpgigOP8IHIEQUvkq8eMKou0947 X-Received: by 2002:a17:90a:ba0e:b0:210:ccdf:2952 with SMTP id s14-20020a17090aba0e00b00210ccdf2952mr6099921pjr.28.1670596897035; Fri, 09 Dec 2022 06:41:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670596897; cv=none; d=google.com; s=arc-20160816; b=E94E9JsZcOwKqIhLBmxtU9DH08F7ytLdxs0PqEMH6uGOy2BsreuBDxB7pOJGRAZDFQ Gd/KgUKaxHrrmUm1bBfpX4eYyK5/DLN2at7nSx/dQtfFB9pN0C4ZQhH2Fp9mOXaPrjfR i9rqMn8+Wxn4wVNur9OXWmbnVW79rhH/+mj+vsa6lMKQLh+FEBpc3LxOZPcr3Twkc/pa SWXcf2SHGWxMdJAh7mplCYYmT3Ckhb2XQjVwQecs9+gUTKaOqLIgTx95xzUixwDCeWS8 Q7YaadLr18i/GyjBKuzMJ9XGWDXXu2iYKPfmPjpLkVgn4IwzLcz6Ohs483xhwIuavmwM rcjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=A09qABb0ead7LLA+4pGxEwf93dXTPbgLlbgE44UEqoI=; b=Z2yOfKH1kyYEXmjJMLEWCZ367MEM6x4T+dJWg2itUYx8Rce/nF4pGQvnEmT6vNYcxj fnntzJT3cJfcr69jB/ZYwLxpxRd97LZi4bJR4HcXwVRgqce97LVTSw3Sku6E+NKAN1Jc GxuW6V2SVkb/uNSAnqDz23uxOgHhD8my5E0jWQdn+rBEVtSODIYSFu2llm151mZFpoLt W8dnN2KjmHNqp3zW7aBjJyaGVfU//PUWB7k9jzSWwTMS5CwXdpVrg/M8ytd/GojcAFnV JFYN5VHwW2BFa+hx4YpG8myHWmj0Z3nNP3L0PkOqHJ5rU6vWACbwFC0vHJJqDpSXCfiv DhdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hcoeDm5B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i7-20020a6561a7000000b00470096ba718si1641441pgv.200.2022.12.09.06.41.23; Fri, 09 Dec 2022 06:41:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hcoeDm5B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229956AbiLIOiL (ORCPT + 99 others); Fri, 9 Dec 2022 09:38:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229910AbiLIOiF (ORCPT ); Fri, 9 Dec 2022 09:38:05 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2910522536; Fri, 9 Dec 2022 06:38:04 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id m4-20020a05600c3b0400b003d1cb516ce0so5900476wms.4; Fri, 09 Dec 2022 06:38:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=A09qABb0ead7LLA+4pGxEwf93dXTPbgLlbgE44UEqoI=; b=hcoeDm5BMAsucMZXIIyUFZqQpMkQdA6hKitiSo57m/EPBWs/+EItLpiWeMyx9PkNuc 4nadDV9bSHfJEhfg50MKuBCg5Q7eshOB8+/esaH3uMZlhU6/ZVjidsYdSd0k1UnDGMwH hM5jZ7AxG6HcFZZsCmiMLqocLhV5kjvMyzc9EvvU9dv//i6XUZnBR5OfbWyzjHYMuI9T W2qYS7vRsA4VXM2MfoFpeKbUoWuEjBcZVZuKYrUyQsK762Z9HX1UU1VFRfil5H2JilFL ef8A/0vdVUEXMbXoPh+I3KCTXl5/XVSFt7+qNgNyLh8Wm3N0P1ZqaXzLnA0Tv98Nx1m+ OLVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A09qABb0ead7LLA+4pGxEwf93dXTPbgLlbgE44UEqoI=; b=eSaahT4iYawMIYSdN+wxRMF5z2w2e2opq9NRCSsnv78W6+0rMI+8axdPxydj4XLADg V72DsctftnEfe7u4EUMvyKlmHi7IqEnshDQijE7gmMK4TLU9RUdExqtHmrV5cfts6ysw NBdZxrAcdH5aIUsYE1wT9TUBwMJjvq8RLE9brsz+RdBJkBnKr+a/7aA1HTGFtARHtgzR til3r/rBvistoZmAmwQ0ne5Ki048rq8ADKhXJagOj4wHEUhpPt6zgwgyUYoJV/bFRItt tWu3wU0eLgBDV7McX5qjTtDdtwn6XbWFXZX09qIksAbzMjTHw78pa/F/Wtgfx6SNVjyy imKA== X-Gm-Message-State: ANoB5pnh6rXFIDeGqpnlP861qmNGsyTu5DVVTBmDSIlw0UeJQjirmVfp atV04ZkcT5g1rGLbbUv84v8= X-Received: by 2002:a7b:c417:0:b0:3c6:e63e:8155 with SMTP id k23-20020a7bc417000000b003c6e63e8155mr5100647wmi.12.1670596682659; Fri, 09 Dec 2022 06:38:02 -0800 (PST) Received: from localhost.localdomain ([95.183.227.98]) by smtp.gmail.com with ESMTPSA id m31-20020a05600c3b1f00b003d1e3b1624dsm9645517wms.2.2022.12.09.06.38.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Dec 2022 06:38:02 -0800 (PST) From: Yassine Oudjana X-Google-Original-From: Yassine Oudjana To: Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Tianshu Qiu , Bingbu Cao Cc: Yassine Oudjana , Yassine Oudjana , Jacopo Mondi , Lee Jackson , Christophe JAILLET , Umang Jain , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/3] media: i2c: ak7375: Add regulator management Date: Fri, 9 Dec 2022 17:37:41 +0300 Message-Id: <20221209143741.214242-4-y.oudjana@protonmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221209143741.214242-1-y.oudjana@protonmail.com> References: <20221209143741.214242-1-y.oudjana@protonmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751747754227564734?= X-GMAIL-MSGID: =?utf-8?q?1751747811637820737?= From: Yassine Oudjana Make the driver get needed regulators on probe and enable/disable them on runtime PM callbacks. Signed-off-by: Yassine Oudjana Tested-by: Umang Jain --- drivers/media/i2c/ak7375.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/media/i2c/ak7375.c b/drivers/media/i2c/ak7375.c index 1af9f698eecf..e7cec45bc271 100644 --- a/drivers/media/i2c/ak7375.c +++ b/drivers/media/i2c/ak7375.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -23,17 +24,29 @@ */ #define AK7375_CTRL_STEPS 64 #define AK7375_CTRL_DELAY_US 1000 +/* + * The vcm may take up 10 ms (tDELAY) to power on and start taking + * I2C messages. Based on AK7371 datasheet. + */ +#define AK7375_POWER_DELAY_US 10000 #define AK7375_REG_POSITION 0x0 #define AK7375_REG_CONT 0x2 #define AK7375_MODE_ACTIVE 0x0 #define AK7375_MODE_STANDBY 0x40 +static const char * const ak7375_supply_names[] = { + "vdd", + "vio", +}; + /* ak7375 device structure */ struct ak7375_device { struct v4l2_ctrl_handler ctrls_vcm; struct v4l2_subdev sd; struct v4l2_ctrl *focus; + struct regulator_bulk_data supplies[ARRAY_SIZE(ak7375_supply_names)]; + /* active or standby mode */ bool active; }; @@ -133,12 +146,24 @@ static int ak7375_probe(struct i2c_client *client) { struct ak7375_device *ak7375_dev; int ret; + unsigned int i; ak7375_dev = devm_kzalloc(&client->dev, sizeof(*ak7375_dev), GFP_KERNEL); if (!ak7375_dev) return -ENOMEM; + for (i = 0; i < ARRAY_SIZE(ak7375_supply_names); i++) + ak7375_dev->supplies[i].supply = ak7375_supply_names[i]; + + ret = devm_regulator_bulk_get(&client->dev, + ARRAY_SIZE(ak7375_supply_names), + ak7375_dev->supplies); + if (ret) { + dev_err_probe(&client->dev, ret, "Failed to get regulators\n"); + return ret; + } + v4l2_i2c_subdev_init(&ak7375_dev->sd, client, &ak7375_ops); ak7375_dev->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; ak7375_dev->sd.internal_ops = &ak7375_int_ops; @@ -208,6 +233,11 @@ static int __maybe_unused ak7375_vcm_suspend(struct device *dev) if (ret) dev_err(dev, "%s I2C failure: %d\n", __func__, ret); + ret = regulator_bulk_disable(ARRAY_SIZE(ak7375_supply_names), + ak7375_dev->supplies); + if (ret) + return ret; + ak7375_dev->active = false; return 0; @@ -228,6 +258,14 @@ static int __maybe_unused ak7375_vcm_resume(struct device *dev) if (ak7375_dev->active) return 0; + ret = regulator_bulk_enable(ARRAY_SIZE(ak7375_supply_names), + ak7375_dev->supplies); + if (ret) + return ret; + + /* Wait for vcm to become ready */ + usleep_range(AK7375_POWER_DELAY_US, AK7375_POWER_DELAY_US + 500); + ret = ak7375_i2c_write(ak7375_dev, AK7375_REG_CONT, AK7375_MODE_ACTIVE, 1); if (ret) {