From patchwork Mon Sep 21 11:24:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gene Chen X-Patchwork-Id: 11789393 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 8CD136CA for ; Mon, 21 Sep 2020 11:24:30 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 58E6A207BC for ; Mon, 21 Sep 2020 11:24:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="BHbPFvK4"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="J5w/Heos" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 58E6A207BC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=o1ePOpEtoYalVjmtxcA93AEdju+W5MR1asQP6Um3RDQ=; b=BHbPFvK4GgRifUvVYd54OQzZVe 1zVsEDC1ywDLXoKKo9Htec9SfiDdwK+obgI4Fw9wTQJzfSCFMh8F7DyhicjBIO8w35ETJaFlcgSqo MUkdwBGfC2VndOzMkhQhFujdKbgm8wWwYOCWzz07J6aqdZKn19r4XJk1aecgm5Kdzv5o6xajQmdHI L43gY6bJRHtD50BB0tqrr3A0DHRY1BCQhkVRl9ns29R5tNtzoRNrs+1WLjT6SZoyU1/VHKMs3K89l RCvZX7+1e+ZnxQnn4qzWKC+RN19bnhXesXt+lwCeqn8Z2X3gejDdpzP1jl3Qq9OB5Xa3E8BdWPbV8 RpOuVbcw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKJvn-00038G-Tj; Mon, 21 Sep 2020 11:24:27 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKJvh-00034M-3u; Mon, 21 Sep 2020 11:24:22 +0000 Received: by mail-pg1-x543.google.com with SMTP id k14so8745642pgi.9; Mon, 21 Sep 2020 04:24:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=R47c8IJlDfJaqH2Rm6EUjlvpHInRK3+ab54pNsvjd9M=; b=J5w/HeosvzO7XIIFoWtyNmMMiub0Db+IHevN5Sj4ysEnqIaYa+x9wfXgLFW+AWLG6j eRCgWNuCsyHd4no7pGNCAcUxezBHzGY2CKIBkrcSm0vjK3bDGg8K9UCnn0sAzbFGtR77 cgPDOnEX7FjUUO+J4ZbRnYO1uHrb+edNh3XGRlbpRoj9Z+g9oigdbeJ8MrpQJDRCd0Vj lJgkuaHXeLGh9/bCA65XTPj1+NCHa8LXhbJC+bemsWUvo2cFWlGAiEipNR/BXhC2HeiX 0lWNs8DxMfyJ0hqxdr3Ip6d/0AhKcKF+4OgzbHJ0RiCNyzfM7alpYuUuK2fHbJ+mpduF Vpew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=R47c8IJlDfJaqH2Rm6EUjlvpHInRK3+ab54pNsvjd9M=; b=GJANNN0miwRVplxRKEyQ66dYQd6ff47iSKbyuBIMz7So99wdWiBtdU+iXhZ8ceqa8p YVNbuVfhnJ9+PwbQ4UhGcsnua0i9OmpsCNrkZVgsqjwkrh4HBcaz252KBlqWf8W95o+O GmZc7SeNG+kBAwfXxRC+3XX6eGpplhbRVb3bruLHLfEUj7hSxgYgXFFJ5JYn9YAmF4iM xj6XJwfmwAzQS1xstQADgbiMPpqRdimS74TrNSOoSKIHR9UJqvmqpu/vAPqUablYQRXI tIYJCvNSUiJYapvMcPCML+ktQZ7Us6wy5YSJEhCUQ2m23C1FY26CQ8dXHmvSTY3naSSQ j5RA== X-Gm-Message-State: AOAM531UPCNEKL+vxZe1AnvF6Fyqyt6oSXDTHQ5E94FJvqhAxEgImb2S Ij9y0jNM05yn5SpHwdsvCak= X-Google-Smtp-Source: ABdhPJx97v7qwdIXIkbCSicpl9/UNMxMCPfFKlRoFY5LsNRsmm8+tQukuQcEw6iDvEUBxNXjPV8X7A== X-Received: by 2002:a17:902:c1d5:b029:d1:f2ab:cf6e with SMTP id c21-20020a170902c1d5b02900d1f2abcf6emr21808980plc.67.1600687457048; Mon, 21 Sep 2020 04:24:17 -0700 (PDT) Received: from localhost.localdomain ([2402:7500:56a:8024:8a0d:5d5f:6f8a:a2bd]) by smtp.gmail.com with ESMTPSA id x7sm9978663pjv.16.2020.09.21.04.24.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 04:24:16 -0700 (PDT) From: Gene Chen To: jic23@kernel.org, robh+dt@kernel.org, matthias.bgg@gmail.com Subject: [PATCH v5 1/3] dt-bindings: iio: adc: add bindings doc for MT6360 ADC Date: Mon, 21 Sep 2020 19:24:00 +0800 Message-Id: <1600687442-23658-2-git-send-email-gene.chen.richtek@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600687442-23658-1-git-send-email-gene.chen.richtek@gmail.com> References: <1600687442-23658-1-git-send-email-gene.chen.richtek@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200921_072421_250952_A86D8328 X-CRM114-Status: GOOD ( 14.93 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:543 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [gene.chen.richtek[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gene_chen@richtek.com, devicetree@vger.kernel.org, lars@metafoo.de, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, cy_huang@richtek.com, benjamin.chao@mediatek.com, linux-mediatek@lists.infradead.org, pmeerw@pmeerw.net, knaack.h@gmx.de, Wilma.Wu@mediatek.com, linux-arm-kernel@lists.infradead.org, shufan_lee@richtek.com MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org From: Gene Chen This change adds the binding doc for the MT6360 ADC. Signed-off-by: Gene Chen Reviewed-by: Rob Herring --- .../bindings/iio/adc/mediatek,mt6360-adc.yaml | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/mediatek,mt6360-adc.yaml diff --git a/Documentation/devicetree/bindings/iio/adc/mediatek,mt6360-adc.yaml b/Documentation/devicetree/bindings/iio/adc/mediatek,mt6360-adc.yaml new file mode 100644 index 0000000..a7350ec --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/mediatek,mt6360-adc.yaml @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/adc/mediatek,mt6360-adc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Mediatek MT6360 and similar ADCs + +maintainers: + - Gene Chen + +description: | + Family of simple ADCs with i2c interface and internal references. + +properties: + compatible: + const: mediatek,mt6360-adc + + "#io-channel-cells": + const: 1 + +required: + - compatible + - "#io-channel-cells" + +additionalProperties: false + +examples: + - | + adc { + compatible = "mediatek,mt6360-adc"; + #io-channel-cells = <1>; + }; +... From patchwork Mon Sep 21 11:24:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gene Chen X-Patchwork-Id: 11789397 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 B0318112C for ; Mon, 21 Sep 2020 11:24:45 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7DD50207BC for ; Mon, 21 Sep 2020 11:24:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="L0nAjndE"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZXV0r5uj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7DD50207BC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=215Cj1Kt/CdBxT55Xc8DDFahfev8DjiBLTylAWxOmlU=; b=L0nAjndENZcBHx0KNfoAaCdBhy au2UW/He5+R5uyffJhRLSaYuksnkYnLOXHIJHGfIHbr2ytRmZxlZR+ij5aSHHez7q4FpocslF0ueE swlak6pXN3zYzLDRNn9mni6h7qAJ3za2PbqlXdBQXgsGskk9+Ieh84d5BO/p2rILLr487Q6FeVx2F 4HsJLU5bXdsCQ4kae1/wtLbp5Z4h/pYuSuKf6Dqv1i4OvDy72uvA1YZJq2tzsMtDn+bF3IAToPEAF LGn0xTpQQia4cFDKj+22cHVPT/Xp24vC2+j0SZT8rlRHwCUX2tg4u5p3bkt8Rf2SceRzdn1/C8EX1 rVX51aEg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKJw2-0003DK-4P; Mon, 21 Sep 2020 11:24:42 +0000 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKJvk-00036J-DO; Mon, 21 Sep 2020 11:24:26 +0000 Received: by mail-pg1-x529.google.com with SMTP id o25so3809378pgm.0; Mon, 21 Sep 2020 04:24:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QIq5NQbiNyJNm/We4OObc4q4pfsVdMirm2rHEjG4Osk=; b=ZXV0r5ujsfBgEEI1mQPi1uDFmiQWGZ2y6nflnAtdUj7oUDwMc01cIhgexwTptTXIb1 DxnAnqtQa4C6Yx9AzxCUivwKU5bXaVy8YZ5U8ZJAipY6i8u2zTquar7Uyd+oqJkAWjdF oQm1+7bMKc4WZttqjl7tBUG/v98uYM/PmdCEvFvtM3jKUlyeE6YoiueH/YqE+KXyYthP hRS4wx8uNQxOH8N3AfJtumkQ7BlpOEY6SCJbTAUGq79LOKoDCF3pAyV/lFWKeyADZUPJ DvWlz2NAwvL8KfNFsREwIJpFcegfyhGClE9ShMZY+lZeFWh4aq8lltDck3XWCbTbpieh 8g6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QIq5NQbiNyJNm/We4OObc4q4pfsVdMirm2rHEjG4Osk=; b=cKxdkUowzaorIyq8w7l/v/BeokVYphGJwCVfbjJBiZTRS/7JcFnmJZm0Lrco9T6sXJ mxOOkphDz/gZcDBI789+aeN2AuJ2xbNKUvNlYeYNSS7MNKujCqwUMDywKtVTrEWa3win S6EDj/urmAy+wAg3NBDSV4thqf58i1OysHqq3bc2MVY2qDY5RUPmE16smCajyPO+B/vw CsWDcexg+ift0alTUuMjhx7GQhxg0PjxWDxqHwDqDYWbOT6WOiyLKWJFX0SY+QI06GT7 XeF78yGkURynD45kEQ9J6khVvZoe7T8cYwJwudYarxV0hnUm7ZvBAatocSvyIY7uhmAn 6oxw== X-Gm-Message-State: AOAM532DbD2VLdySHILdH2ZQl1Hz0nv108SeZ7n4jK/ZhZ3tkn+6ADAN VDOtODKoIBG1Fhoi0wzGqiM= X-Google-Smtp-Source: ABdhPJzpHl2i+Bs2FiYnb9x/88LedxgGsP9M0zGpxqxEF1D9DblywxDN8SqmtHED+a7Mw/T4Bm7zYw== X-Received: by 2002:a17:902:9797:b029:d2:2a05:ceec with SMTP id q23-20020a1709029797b02900d22a05ceecmr2612801plp.4.1600687462135; Mon, 21 Sep 2020 04:24:22 -0700 (PDT) Received: from localhost.localdomain ([2402:7500:56a:8024:8a0d:5d5f:6f8a:a2bd]) by smtp.gmail.com with ESMTPSA id x7sm9978663pjv.16.2020.09.21.04.24.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 04:24:21 -0700 (PDT) From: Gene Chen To: jic23@kernel.org, robh+dt@kernel.org, matthias.bgg@gmail.com Subject: [PATCH v5 2/3] Documentation: ABI: testing: mt6360: Add ADC sysfs guideline Date: Mon, 21 Sep 2020 19:24:01 +0800 Message-Id: <1600687442-23658-3-git-send-email-gene.chen.richtek@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600687442-23658-1-git-send-email-gene.chen.richtek@gmail.com> References: <1600687442-23658-1-git-send-email-gene.chen.richtek@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200921_072424_501334_6A884B40 X-CRM114-Status: GOOD ( 14.14 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:529 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [gene.chen.richtek[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gene_chen@richtek.com, devicetree@vger.kernel.org, lars@metafoo.de, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, cy_huang@richtek.com, benjamin.chao@mediatek.com, linux-mediatek@lists.infradead.org, pmeerw@pmeerw.net, knaack.h@gmx.de, Wilma.Wu@mediatek.com, linux-arm-kernel@lists.infradead.org, shufan_lee@richtek.com MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org From: Gene Chen Add ABI documentation for mt6360 ADC sysfs interfaces. Signed-off-by: Gene Chen --- Documentation/ABI/testing/sysfs-bus-iio-adc-mt6360 | 78 ++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-adc-mt6360 diff --git a/Documentation/ABI/testing/sysfs-bus-iio-adc-mt6360 b/Documentation/ABI/testing/sysfs-bus-iio-adc-mt6360 new file mode 100644 index 0000000..e5a7b1c --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-iio-adc-mt6360 @@ -0,0 +1,78 @@ +What: /sys/bus/iio/devices/iio:deviceX/in_voltage0_raw +KernelVersion: 5.8.0 +Contact: gene_chen@richtek.com +Description: + Indicated MT6360 USBID ADC which connected to connector ID pin. + Calculating with scale and offset returns voltage in uV + +What: /sys/bus/iio/devices/iio:deviceX/in_voltage1_raw +KernelVersion: 5.8.0 +Contact: gene_chen@richtek.com +Description: + Indicated MT6360 VBUS ADC with lower accuracy(+-75mA) + higher measure range(1~22mV) + Calculating with scale and offset returns voltage in uV + +What: /sys/bus/iio/devices/iio:deviceX/in_voltage2_raw +KernelVersion: 5.8.0 +Contact: gene_chen@richtek.com +Description: + Indicated MT6360 VBUS ADC with higher accuracy(+-30mA) + lower measure range(1~9.76V) + Calculating with scale and offset returns voltage in uV + +What: /sys/bus/iio/devices/iio:deviceX/in_voltage3_raw +KernelVersion: 5.8.0 +Contact: gene_chen@richtek.com +Description: + Indicated MT6360 VSYS ADC + Calculating with scale and offset returns voltage in uV + +What: /sys/bus/iio/devices/iio:deviceX/in_voltage4_raw +KernelVersion: 5.8.0 +Contact: gene_chen@richtek.com +Description: + Indicated MT6360 VBAT ADC + Calculating with scale and offset returns voltage in uV + +What: /sys/bus/iio/devices/iio:deviceX/in_current5_raw +KernelVersion: 5.8.0 +Contact: gene_chen@richtek.com +Description: + Indicated MT6360 IBUS ADC + Calculating with scale and offset returns voltage in uA + +What: /sys/bus/iio/devices/iio:deviceX/in_current6_raw +KernelVersion: 5.8.0 +Contact: gene_chen@richtek.com +Description: + Indicated MT6360 IBAT ADC + Calculating with scale and offset returns voltage in uA + +What: /sys/bus/iio/devices/iio:deviceX/in_current7_raw +KernelVersion: 5.8.0 +Contact: gene_chen@richtek.com +Description: + Indicated MT6360 CHG_VDDP ADC + Calculating with scale and offset returns voltage in uV + +What: /sys/bus/iio/devices/iio:deviceX/in_temp8_raw +KernelVersion: 5.8.0 +Contact: gene_chen@richtek.com +Description: + Indicated MT6360 IC junction temperature + Calculating with scale and offset returns temperature in degree + +What: /sys/bus/iio/devices/iio:deviceX/in_voltage9_raw +KernelVersion: 5.8.0 +Contact: gene_chen@richtek.com +Description: + Indicated MT6360 VREF_TS ADC + Calculating with scale and offset returns voltage in uV + +What: /sys/bus/iio/devices/iio:deviceX/in_voltage10_raw +KernelVersion: 5.8.0 +Contact: gene_chen@richtek.com +Description: + Indicated MT6360 TS ADC + Calculating with scale and offset returns voltage in uV From patchwork Mon Sep 21 11:24:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gene Chen X-Patchwork-Id: 11789399 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 55E636CA for ; Mon, 21 Sep 2020 11:25:00 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 18DDC20874 for ; Mon, 21 Sep 2020 11:25:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="1YazhRpm"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="J+6ZrVVD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 18DDC20874 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=32ribHtveK+ehkigTKtBhb0d4Db8YoWZEK214MeDZiE=; b=1YazhRpmzDmIYwyF3vAYtHxjOw ltPbpyLKa7CexCkpgYwM1YEiiEcNu8aHmLWiWn9ZHYNQ/rCmnXd2R/Eyb17Usaj8PYwY9tw+33muJ KiouA/TEl8ZMreABwjbyzfWUYRjZZlWHbwHq7hCsluyvypusfFSK6FxoaI8nrS9na9WM0UssOj4Cl UmsAFcxBinFlO35VGSPB0EoTcewVFZ9n5VHP1ux9cZ2Lx7P7Ct1ThSbtaarDJKdYI1w7RkxMGkN3R OepMq5rSrZaGn3y/Jpbwixm3xIl8pEsAOxwtwgf/yC5FHX7m0jfqhpzIK4ty/yBEq4FOAiBsecaLt eAWASusg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKJwH-0003JX-0k; Mon, 21 Sep 2020 11:24:57 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKJvp-00038P-Dq; Mon, 21 Sep 2020 11:24:31 +0000 Received: by mail-pg1-x543.google.com with SMTP id k14so8745979pgi.9; Mon, 21 Sep 2020 04:24: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; bh=e2+DLjNVXmsMiWuvMKFdrMLJ75p+wiHIYi1HR/6n940=; b=J+6ZrVVDyvZveSirZ9Jt172QtobrjzzDllSmZhqMUnLouiuSANB8npUcPN/Qc4+UUD VTab6X9nOJZ0H5sF3vZOCod5LC65sQq0j9DRnzGMnErKfLOK+kO24B34jp4yIzLZqoQ+ D07SnHVEiWdKFpOkzfeEuLqVHpKF3dnXtbEixl7UfXxuEfuDkBkJppyXmuv2LKHYXzhO DvQUuY7CQ+AWaEdGIaD+HS+pwpyklCZbA5ACduCnsd015yyJ1XW5XfiHATrsFXkav2rn Nrec0TWFpTm+E8kq/xKmos3BdPmFjVA0vga6aFe4TpH3/DG+Lt80gN1opF4ujEdOVSCa NITA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=e2+DLjNVXmsMiWuvMKFdrMLJ75p+wiHIYi1HR/6n940=; b=HNThy7yIwYkZcId9g8HwF2sCA4EcqC6SW6ASKEIqdJw5aYFPyU5wD3YqQho0kywkJ0 qTCXm7QluDnTX2n++YBJQ9HWHF54PRtALdlRVYVOQoXe1BQDRohaw/C9ZFKFgv5Y5yZT 8VCZQodxZV08ex+d/IlqeTpOZbL/GmyQ7L9FmiJj5anzt8i2KaX+iSb9+1STNEr0WygE SaVCeGi7w7FWu1eRvoEvQapEBZ7Gs/NPsBPcg0gJZ0+f9bKPwDPoSCRrQWQK9XZHlSiz ik2HWHSI68fD14IyuBocODoAX6+GWwd7t/Hb8Hi9VfagW0Hjdqe3QRr0CTW2Gy0ooPkJ dmMQ== X-Gm-Message-State: AOAM533/UVT0XkpdSTWTtug59cav6G1veiJ9/ytIKxwUiM6vwHjLRyvN Yax6S4QrG3nNpzoQtYNtxxw= X-Google-Smtp-Source: ABdhPJz/kv+T9BUiZF1ZXaRzUDY1Hd54NGJMHmaRtngehXPt5/9MiWHBue1fdj28DqCnX0cuhsSlnQ== X-Received: by 2002:aa7:8084:0:b029:13f:b82a:1725 with SMTP id v4-20020aa780840000b029013fb82a1725mr40802248pff.9.1600687467491; Mon, 21 Sep 2020 04:24:27 -0700 (PDT) Received: from localhost.localdomain ([2402:7500:56a:8024:8a0d:5d5f:6f8a:a2bd]) by smtp.gmail.com with ESMTPSA id x7sm9978663pjv.16.2020.09.21.04.24.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 04:24:27 -0700 (PDT) From: Gene Chen To: jic23@kernel.org, robh+dt@kernel.org, matthias.bgg@gmail.com Subject: [PATCH v5 3/3] iio: adc: mt6360: Add ADC driver for MT6360 Date: Mon, 21 Sep 2020 19:24:02 +0800 Message-Id: <1600687442-23658-4-git-send-email-gene.chen.richtek@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600687442-23658-1-git-send-email-gene.chen.richtek@gmail.com> References: <1600687442-23658-1-git-send-email-gene.chen.richtek@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200921_072429_558079_63136863 X-CRM114-Status: GOOD ( 32.82 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:543 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [gene.chen.richtek[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gene_chen@richtek.com, devicetree@vger.kernel.org, lars@metafoo.de, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, cy_huang@richtek.com, benjamin.chao@mediatek.com, linux-mediatek@lists.infradead.org, pmeerw@pmeerw.net, knaack.h@gmx.de, Wilma.Wu@mediatek.com, linux-arm-kernel@lists.infradead.org, shufan_lee@richtek.com MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org From: Gene Chen Add MT6360 ADC driver include Charger Current, Voltage, and Temperature. Signed-off-by: Gene Chen Reported-by: kernel test robot --- drivers/iio/adc/Kconfig | 11 ++ drivers/iio/adc/Makefile | 1 + drivers/iio/adc/mt6360-adc.c | 363 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 375 insertions(+) create mode 100644 drivers/iio/adc/mt6360-adc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index d94dc80..a135ada 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -703,6 +703,17 @@ config MCP3911 This driver can also be built as a module. If so, the module will be called mcp3911. +config MEDIATEK_MT6360_ADC + tristate "Mediatek MT6360 ADC driver" + depends on MFD_MT6360 + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say Y here to enable MT6360 ADC support. + Integrated for System Monitoring includes + is used in smartphones and tablets and supports a 11 channel + general purpose ADC. + config MEDIATEK_MT6577_AUXADC tristate "MediaTek AUXADC driver" depends on ARCH_MEDIATEK || COMPILE_TEST diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 90f94ad..5fca90a 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -65,6 +65,7 @@ obj-$(CONFIG_MAX9611) += max9611.o obj-$(CONFIG_MCP320X) += mcp320x.o obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MCP3911) += mcp3911.o +obj-$(CONFIG_MEDIATEK_MT6360_ADC) += mt6360-adc.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MESON_SARADC) += meson_saradc.o diff --git a/drivers/iio/adc/mt6360-adc.c b/drivers/iio/adc/mt6360-adc.c new file mode 100644 index 0000000..a1a01e5 --- /dev/null +++ b/drivers/iio/adc/mt6360-adc.c @@ -0,0 +1,363 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define MT6360_REG_PMUCHGCTRL3 0x313 +#define MT6360_REG_PMUADCCFG 0x356 +#define MT6360_REG_PMUADCIDLET 0x358 +#define MT6360_REG_PMUADCRPT1 0x35A + +/* PMUCHGCTRL3 0x313 */ +#define MT6360_AICR_MASK GENMASK(7, 2) +#define MT6360_AICR_SHFT 2 +#define MT6360_AICR_400MA 0x6 +/* PMUADCCFG 0x356 */ +#define MT6360_ADCEN_MASK 0x8000 +/* PMUADCRPT1 0x35A */ +#define MT6360_PREFERCH_MASK GENMASK(7, 4) +#define MT6360_PREFERCH_SHFT 4 +#define MT6360_RPTCH_MASK GENMASK(3, 0) +#define MT6360_NO_PREFER 15 + +/* Time in ms */ +#define ADC_WAIT_TIME_MS 25 + +enum { + MT6360_CHAN_USBID = 0, + MT6360_CHAN_VBUSDIV5, + MT6360_CHAN_VBUSDIV2, + MT6360_CHAN_VSYS, + MT6360_CHAN_VBAT, + MT6360_CHAN_IBUS, + MT6360_CHAN_IBAT, + MT6360_CHAN_CHG_VDDP, + MT6360_CHAN_TEMP_JC, + MT6360_CHAN_VREF_TS, + MT6360_CHAN_TS, + MT6360_CHAN_MAX +}; + +struct mt6360_adc_data { + struct device *dev; + struct regmap *regmap; + /* Due to only one set of ADC control, this lock is used to prevent the race condition */ + struct mutex adc_lock; + ktime_t last_off_timestamps[MT6360_CHAN_MAX]; +}; + +static int mt6360_adc_read_channel(struct mt6360_adc_data *mad, int channel, int *val) +{ + __be16 adc_enable; + u8 rpt[3]; + ktime_t start_t, predict_end_t; + unsigned int pre_wait_time; + int ret; + + mutex_lock(&mad->adc_lock); + + /* Select the preferred ADC channel */ + ret = regmap_update_bits(mad->regmap, MT6360_REG_PMUADCRPT1, MT6360_PREFERCH_MASK, + channel << MT6360_PREFERCH_SHFT); + if (ret) + goto out_adc_lock; + + adc_enable = cpu_to_be16(MT6360_ADCEN_MASK | BIT(channel)); + ret = regmap_raw_write(mad->regmap, MT6360_REG_PMUADCCFG, &adc_enable, sizeof(adc_enable)); + if (ret) + goto out_adc_lock; + + start_t = ktime_get(); + predict_end_t = ktime_add_ms(mad->last_off_timestamps[channel], 2 * ADC_WAIT_TIME_MS); + + if (ktime_after(start_t, predict_end_t)) + pre_wait_time = ADC_WAIT_TIME_MS; + else + pre_wait_time = 3 * ADC_WAIT_TIME_MS; + + msleep(pre_wait_time); + + while (true) { + ret = regmap_raw_read(mad->regmap, MT6360_REG_PMUADCRPT1, rpt, sizeof(rpt)); + if (ret) + goto out_adc_conv; + + /* + * There are two functions, ZCV and TypeC OTP, running ADC VBAT and TS in + * background, and ADC samples are taken on a fixed frequency no matter read the + * previous one or not. + * To avoid conflict, We set minimum time threshold after enable ADC and + * check report channel is the same. + * The worst case is run the same ADC twice and background function is also running, + * ADC conversion sequence is desire channel before start ADC, background ADC, + * desire channel after start ADC. + * So the minimum correct data is three times of typical conversion time. + */ + if ((rpt[0] & MT6360_RPTCH_MASK) == channel) + break; + + msleep(ADC_WAIT_TIME_MS); + } + + /* rpt[1]: ADC_HI_BYTE, rpt[2]: ADC_LOW_BYTE */ + *val = rpt[1] << 8 | rpt[2]; + ret = IIO_VAL_INT; + +out_adc_conv: + /* Only keep ADC enable */ + adc_enable = cpu_to_be16(MT6360_ADCEN_MASK); + regmap_raw_write(mad->regmap, MT6360_REG_PMUADCCFG, &adc_enable, sizeof(adc_enable)); + mad->last_off_timestamps[channel] = ktime_get(); + /* Config prefer channel to NO_PREFER */ + regmap_update_bits(mad->regmap, MT6360_REG_PMUADCRPT1, MT6360_PREFERCH_MASK, + MT6360_NO_PREFER << MT6360_PREFERCH_SHFT); +out_adc_lock: + mutex_unlock(&mad->adc_lock); + + return ret; +} + +static int mt6360_adc_read_scale(struct mt6360_adc_data *mad, int channel, int *val, int *val2) +{ + unsigned int regval; + int ret; + + switch (channel) { + case MT6360_CHAN_USBID: + case MT6360_CHAN_VSYS: + case MT6360_CHAN_VBAT: + case MT6360_CHAN_CHG_VDDP: + case MT6360_CHAN_VREF_TS: + case MT6360_CHAN_TS: + *val = 1250; + return IIO_VAL_INT; + case MT6360_CHAN_VBUSDIV5: + *val = 6250; + return IIO_VAL_INT; + case MT6360_CHAN_VBUSDIV2: + case MT6360_CHAN_IBUS: + case MT6360_CHAN_IBAT: + *val = 2500; + + if (channel == MT6360_CHAN_IBUS) { + /* IBUS will be affected by input current limit for the different Ron */ + /* Check whether the config is <400mA or not */ + ret = regmap_read(mad->regmap, MT6360_REG_PMUCHGCTRL3, ®val); + if (ret) + return ret; + + regval = (regval & MT6360_AICR_MASK) >> MT6360_AICR_SHFT; + if (regval < MT6360_AICR_400MA) + *val = 1900; + } + + return IIO_VAL_INT; + case MT6360_CHAN_TEMP_JC: + *val = 105; + *val2 = 100; + return IIO_VAL_FRACTIONAL; + } + + return -EINVAL; +} + +static int mt6360_adc_read_offset(struct mt6360_adc_data *mad, int channel, int *val) +{ + *val = (channel == MT6360_CHAN_TEMP_JC) ? -80 : 0; + return IIO_VAL_INT; + +} + +static int mt6360_adc_read_raw(struct iio_dev *iio_dev, const struct iio_chan_spec *chan, + int *val, int *val2, long mask) +{ + struct mt6360_adc_data *mad = iio_priv(iio_dev); + + switch (mask) { + case IIO_CHAN_INFO_RAW: + return mt6360_adc_read_channel(mad, chan->channel, val); + case IIO_CHAN_INFO_SCALE: + return mt6360_adc_read_scale(mad, chan->channel, val, val2); + case IIO_CHAN_INFO_OFFSET: + return mt6360_adc_read_offset(mad, chan->channel, val); + } + + return -EINVAL; +} + +static const char *mt6360_channel_labels[MT6360_CHAN_MAX] = { + "usbid", "vbusdiv5", "vbusdiv2", "vsys", "vbat", "ibus", "ibat", "chg_vddp", "temp_jc", + "vref_ts", "ts" +}; + +static int mt6360_adc_read_label(struct iio_dev *iio_dev, const struct iio_chan_spec *chan, + char *label) +{ + return snprintf(label, PAGE_SIZE, "%s\n", mt6360_channel_labels[chan->channel]); +} + +static const struct iio_info mt6360_adc_iio_info = { + .read_raw = mt6360_adc_read_raw, + .read_label = mt6360_adc_read_label, +}; + +#define MT6360_ADC_CHAN(_idx, _type) { \ + .type = _type, \ + .channel = MT6360_CHAN_##_idx, \ + .scan_index = MT6360_CHAN_##_idx, \ + .datasheet_name = #_idx, \ + .scan_type = { \ + .sign = 'u', \ + .realbits = 16, \ + .storagebits = 16, \ + .endianness = IIO_CPU, \ + }, \ + .indexed = 1, \ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ + BIT(IIO_CHAN_INFO_SCALE) | \ + BIT(IIO_CHAN_INFO_OFFSET), \ +} + +static const struct iio_chan_spec mt6360_adc_channels[] = { + MT6360_ADC_CHAN(USBID, IIO_VOLTAGE), + MT6360_ADC_CHAN(VBUSDIV5, IIO_VOLTAGE), + MT6360_ADC_CHAN(VBUSDIV2, IIO_VOLTAGE), + MT6360_ADC_CHAN(VSYS, IIO_VOLTAGE), + MT6360_ADC_CHAN(VBAT, IIO_VOLTAGE), + MT6360_ADC_CHAN(IBUS, IIO_CURRENT), + MT6360_ADC_CHAN(IBAT, IIO_CURRENT), + MT6360_ADC_CHAN(CHG_VDDP, IIO_VOLTAGE), + MT6360_ADC_CHAN(TEMP_JC, IIO_TEMP), + MT6360_ADC_CHAN(VREF_TS, IIO_VOLTAGE), + MT6360_ADC_CHAN(TS, IIO_VOLTAGE), + IIO_CHAN_SOFT_TIMESTAMP(MT6360_CHAN_MAX), +}; + +static irqreturn_t mt6360_adc_trigger_handler(int irq, void *p) +{ + struct iio_poll_func *pf = p; + struct iio_dev *indio_dev = pf->indio_dev; + struct mt6360_adc_data *mad = iio_priv(indio_dev); + struct { + u16 values[MT6360_CHAN_MAX]; + int64_t timestamp; + } data __aligned(8) = {0}; + int i = 0, bit, val, ret; + + + for_each_set_bit(bit, indio_dev->active_scan_mask, indio_dev->masklength) { + ret = mt6360_adc_read_channel(mad, bit, &val); + if (ret < 0) { + dev_warn(&indio_dev->dev, "Failed to get channel %d conversion val\n", bit); + goto out; + } + + data.values[i++] = val; + } + iio_push_to_buffers_with_timestamp(indio_dev, &data, iio_get_time_ns(indio_dev)); +out: + iio_trigger_notify_done(indio_dev->trig); + + return IRQ_HANDLED; +} + +static inline int mt6360_adc_reset(struct mt6360_adc_data *info) +{ + __be16 adc_enable; + ktime_t all_off_time; + int i, ret; + + /* Clear ADC idle wait time to 0 */ + ret = regmap_write(info->regmap, MT6360_REG_PMUADCIDLET, 0); + if (ret) + return ret; + + /* Only keep ADC enable, but keep all channels off */ + adc_enable = cpu_to_be16(MT6360_ADCEN_MASK); + ret = regmap_raw_write(info->regmap, MT6360_REG_PMUADCCFG, (void *)&adc_enable, + sizeof(__be16)); + if (ret) + return ret; + + /* Reset all channel off time to the current one */ + all_off_time = ktime_get(); + for (i = 0; i < MT6360_CHAN_MAX; i++) + info->last_off_timestamps[i] = all_off_time; + + return 0; +} + +static int mt6360_adc_probe(struct platform_device *pdev) +{ + struct mt6360_adc_data *mad; + struct regmap *regmap; + struct iio_dev *indio_dev; + int ret; + + regmap = dev_get_regmap(pdev->dev.parent, NULL); + if (!regmap) { + dev_err(&pdev->dev, "Failed to get parent regmap\n"); + return -ENODEV; + } + + indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*mad)); + if (!indio_dev) + return -ENOMEM; + + mad = iio_priv(indio_dev); + mad->dev = &pdev->dev; + mad->regmap = regmap; + mutex_init(&mad->adc_lock); + + ret = mt6360_adc_reset(mad); + if (ret < 0) { + dev_err(&pdev->dev, "Failed to reset adc\n"); + return ret; + } + + indio_dev->name = dev_name(&pdev->dev); + indio_dev->dev.parent = &pdev->dev; + indio_dev->info = &mt6360_adc_iio_info; + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->channels = mt6360_adc_channels; + indio_dev->num_channels = ARRAY_SIZE(mt6360_adc_channels); + + ret = devm_iio_triggered_buffer_setup(&pdev->dev, indio_dev, NULL, + mt6360_adc_trigger_handler, NULL); + if (ret) { + dev_err(&pdev->dev, "Failed to allocate iio trigger buffer\n"); + return ret; + } + + return devm_iio_device_register(&pdev->dev, indio_dev); +} + +static const struct of_device_id __maybe_unused mt6360_adc_of_id[] = { + { .compatible = "mediatek,mt6360-adc", }, + {} +}; +MODULE_DEVICE_TABLE(of, mt6360_adc_of_id); + +static struct platform_driver mt6360_adc_driver = { + .driver = { + .name = "mt6360-adc", + .of_match_table = mt6360_adc_of_id, + }, + .probe = mt6360_adc_probe, +}; +module_platform_driver(mt6360_adc_driver); + +MODULE_AUTHOR("Gene Chen "); +MODULE_DESCRIPTION("MT6360 ADC Driver"); +MODULE_LICENSE("GPL v2");