From patchwork Wed Jun 21 15:39:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 111154 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4477910vqr; Wed, 21 Jun 2023 09:10:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7hJYFOg44b2VemzGBxnciQsTvEMYlGstleY7wUoz9TkK5JnIaaOipCMmnhyg9b62pW7SgX X-Received: by 2002:a05:6a00:2d1f:b0:666:b0e7:10ea with SMTP id fa31-20020a056a002d1f00b00666b0e710eamr11209264pfb.31.1687363839068; Wed, 21 Jun 2023 09:10:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687363839; cv=none; d=google.com; s=arc-20160816; b=YtEI4PWKxTmqfzLQnXOFJtPY1whidWslsZ+Zwi61qEEBWj2CAteHHNs0LIMQEbTfdm Zy5+xiYaYWAljwtHwEmtOyUAFs5jY+ZLvgFTEc1SvcmNJW002aiJLS/TempBx68BwXzo ISGRP0f1sFd8/1tpDyOufwICKh7sQqw2SeMF9URLbVBg1VA/lM36Hd6IGY08wNbzcWgZ +NKtlczeVRSRz4lZNEbvIXCA99lAQqKw2p3eeYIOgPK4V/dh7C8dnjBSi8/T5bP6TjbK bJ5I20guvh4NULAnGz8KVGIL1LM4T+oDl6jF0eR0wbcBKIvg6/U9e4ITTqP/3Zk/ou9D ZV2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=BghQG/dm7/BMhBzVnoR8Ldw/7EWxlY1Xs4R63bOlCig=; b=hi4oyDTwP9h31GHt71RnDdpBkbqr56Q+NjJKQiooB3xSZXvw85yevixee4Ol8A8owX NKT/tZF1QS8Bwj9gfvrxX35cCmMkBkNTDhzbfwEqPN1UR16xem++TbLc0XWqsVrWwc7f e+gwUIyV5NYs44RmonkNaqCAJHs7UXlhPShLhdX7E8XbsDVk1jkPQTqu4wZ8ygcIiGOI znvtG8jhRPYmP2pqO212VsSN670p8cehqExfrayPKmatjDfXIBOwW+Fwc8APgQiFStQV lKMdoYtIhEiQqMsZBjERmN7K2GS+lrQUC62ERm+MKvJViOURL33TYGA/jjTgR24OKmiw 7dsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Qr5r/G6s"; 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=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h19-20020aa796d3000000b006665df4f1f0si4325787pfq.136.2023.06.21.09.10.25; Wed, 21 Jun 2023 09:10:39 -0700 (PDT) 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=@linaro.org header.s=google header.b="Qr5r/G6s"; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233633AbjFUPkp (ORCPT + 99 others); Wed, 21 Jun 2023 11:40:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233583AbjFUPk2 (ORCPT ); Wed, 21 Jun 2023 11:40:28 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA280199C for ; Wed, 21 Jun 2023 08:40:03 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-4f955850e30so2095546e87.1 for ; Wed, 21 Jun 2023 08:40:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687361955; x=1689953955; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=BghQG/dm7/BMhBzVnoR8Ldw/7EWxlY1Xs4R63bOlCig=; b=Qr5r/G6sUrShsL1kKCwZWhXdsO1CA7qrG/oVm5PalRAnDMv/eKBShslHhHHm+lQxBA VW5cqs+Q0lxCp9IezWmr9A9x32gq64yT9CraSwAtZ6y8Kf0FU9Ab85oRn5kgEwATHn4h 0bXhC6iC0bxGvfN+rE9/sGWz0Gyx+XmON52t17ZIKV+NHi/EkCGJYAotkwzTSFXnZb4O EninryVQ+GU4FWxQSq5swJLmQGtNXoz6T+0nC04TzkzEKrjx2xcprzWPkrFImN+xkHmi 0rnM9XbnHIF8JuP0uVkwcNxUVHmJJUMSfWyv60XEAZQ1laRcci0u1Sjyhwa59GwzkVEd j/ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687361955; x=1689953955; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BghQG/dm7/BMhBzVnoR8Ldw/7EWxlY1Xs4R63bOlCig=; b=EaG6qcK6KaAwce4KrfzCbDfBkHHgcge72U9JiKaG0LrphrQUgDLdX0KOXcBHLFsHR2 QquQNySUeE7nFzIfo7SlDEWRsvJhvn9ckyW3+hnlLMIiKDXgg+I9JfZrnSRbECtgQOd5 AJgyN9fHA4SwcMroAMAM8h+3IFzgzj1IsC2nZNnVdEZ4CU5wG5b/ROQEkADD+HVK2dg0 Zah4Lr/OJdsXqa/2dV+jQGIUm+OF8gOvkp70pXHoyzqasB9+VxDu2f0cKSzWiYv10vLT Cj41tiTPC/btFRUpRpjsm8Vov5DOs7eRpielq4K3dsIXM/LrbMXRPqspYqeH+2erWamk VIwQ== X-Gm-Message-State: AC+VfDy5UcxwDVNiVXGZv29Xw4QX0dd10oaVITBclnGrSFg6R/8KtIKT v2qMgPs7yiWeQJ0UZcngOLW4dw== X-Received: by 2002:a19:650c:0:b0:4f8:6ac4:1aa9 with SMTP id z12-20020a19650c000000b004f86ac41aa9mr3829046lfb.21.1687361955307; Wed, 21 Jun 2023 08:39:15 -0700 (PDT) Received: from [192.168.1.101] (abxj193.neoplus.adsl.tpnet.pl. [83.9.3.193]) by smtp.gmail.com with ESMTPSA id l15-20020a19c20f000000b004f73eac0308sm821078lfc.183.2023.06.21.08.39.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 08:39:15 -0700 (PDT) From: Konrad Dybcio Date: Wed, 21 Jun 2023 17:39:10 +0200 Subject: [PATCH 1/3] dt-bindings: vendor-prefixes: Add Mitsumi Electric Co., Ltd. MIME-Version: 1.0 Message-Id: <20230621-topic-mm8013-v1-1-4407c6260053@linaro.org> References: <20230621-topic-mm8013-v1-0-4407c6260053@linaro.org> In-Reply-To: <20230621-topic-mm8013-v1-0-4407c6260053@linaro.org> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sebastian Reichel , Konrad Dybcio Cc: Marijn Suijten , Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1687361953; l=1059; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=1SFTi5kMC47UI2etI3CVctdHR0kSEqrXW6o1drxOzw8=; b=nffvquqf7dMVT3ELuTqaPfrF7sjNKg1738r4zR2ESSEDTPuDgCr9CxsDwvf2YDgGp4+lr0zO5 QdM/n6pUKqPCzboEfBVbjasfCPRtJlgiYX8H2D4fBaom0cwCAklb+5p X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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?1769329224924109945?= X-GMAIL-MSGID: =?utf-8?q?1769329224924109945?= Mitsumi was [1] a Japanese company making various electronics devices and components. They've merged into a new entity, MinebeaMitsumi in 2017. Their current main page is available at [2] [1] https://en.wikipedia.org/wiki/Mitsumi_Electric [2] https://product.minebeamitsumi.com/en/ Signed-off-by: Konrad Dybcio Acked-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml index af60bf1a6664..6142c40cf06e 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml @@ -865,6 +865,8 @@ patternProperties: description: MiraMEMS Sensing Technology Co., Ltd. "^mitsubishi,.*": description: Mitsubishi Electric Corporation + "^mitsumi,.*": + description: Mitsumi Electric Co., Ltd. "^mixel,.*": description: Mixel, Inc. "^miyoo,.*": From patchwork Wed Jun 21 15:39:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 111176 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4492820vqr; Wed, 21 Jun 2023 09:32:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5fuXLjjlcKjnX547gbqJ1nQt1huUw6hjHhy07KOS/Uo7lKJMnpf0sJ6dbrZ4jdgBheZUk+ X-Received: by 2002:a17:902:aa05:b0:1b6:82a5:13d5 with SMTP id be5-20020a170902aa0500b001b682a513d5mr4451935plb.9.1687365158048; Wed, 21 Jun 2023 09:32:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687365158; cv=none; d=google.com; s=arc-20160816; b=czUg2u5rh8movDCpW4t4ANQISReuzOTO9uJd3sahesEc6K0XKfhyAuCJf3Lh7c+Ola NDpYmskk9a2h5tXOfIqPEYNR9yyxgazhrR9mLYte1owCvAOx1q5MTw8bejEJYm+Z1wIE b+X0lCTiJ7o4JAhPnn7xVHkzeyGiWVYKz6Aeid32GQtzpyA9w15WuIHqIurtFcSVnzr5 E54QG7IJqcfT8X5EDs+YEKoRsbqTp2Z49RTvlP18M9przxMFZYJSDoJCm4P5xXoV9X/S qayD1a22Z6Ash1EkpYP82C7kiO5Eq48iYB1smz3iV1I88SUa1FE1wNsFp0kNhOsLgjK6 9c/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=OxhYDMzYM3sPoTVA7uKX6gjc+krbn/LNyC5c2Sai7r8=; b=bgP68poBiMRJ2GtnL3ZKD8g/fkTa6n0ioDg68XAs9WD/K8Hk9IyV4bWs57MabXY6qb wBm/hV0HxQDvB8Z0XtZtuH1NnNV5CXRH/1BbW3zrTNriY+3ho+j3fEoBp2Gpn5BI1Nfa nA7KhbmS6Udxf0+ODnD/higOjPQlwIPPmGmyFmd2/SCy70QVC6drMzA2B/7bsc0MDaFk EYfRsIkmfExauY6XcZLN9Nx97ZZaJF7OPRPv/KcK5JvkFiBNltrY8bNUP39VB28VHwW8 gHAxGfFRLX7xCqXM3PUrDpJRf6spzacZISPUyFz5DkHIX98DR0fw72MtYUyXpjSE6MWc JKkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pH0YCAKr; 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=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q14-20020a170902eb8e00b001b55160783dsi4565021plg.545.2023.06.21.09.32.24; Wed, 21 Jun 2023 09:32:38 -0700 (PDT) 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=@linaro.org header.s=google header.b=pH0YCAKr; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233648AbjFUPkv (ORCPT + 99 others); Wed, 21 Jun 2023 11:40:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233644AbjFUPka (ORCPT ); Wed, 21 Jun 2023 11:40:30 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDB112107 for ; Wed, 21 Jun 2023 08:40:04 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-4f86bc35f13so5904686e87.1 for ; Wed, 21 Jun 2023 08:40:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687361957; x=1689953957; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=OxhYDMzYM3sPoTVA7uKX6gjc+krbn/LNyC5c2Sai7r8=; b=pH0YCAKrr2Ilk8uZMoViPdbMe2hTeu1cOp/RxPqCdL3N8y7hlCJ8eJb7IKZNyCVMr4 UrxXlFwlyn9a5Knc97r0MVz/NSU+KL5Ot12YmuHwW/uqIy9BJFNfmGJ/+iXyy+yFN6z1 g2MqV3FGdVe1aA1syKiBIclRl5U0XUbg5IqnWJCpYrjkiDuag7CNYlxRuGSAdXNniuvQ MK8JifNPe9RYWhh0uhtEMLGySqUWM5osVXTe/2YYtt+yRTqBqUTpaBm+Qo8JM0P18zKz MS17MIvCTIllBv9tNeXNI+s4O/hlruv9X2UqXQwsim0rwYvSIqOpw3EUH79sfN9CdwVi wiaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687361957; x=1689953957; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OxhYDMzYM3sPoTVA7uKX6gjc+krbn/LNyC5c2Sai7r8=; b=L5FgO0GGxeGab1atc5sEmsdg6teCM1YvI9Dw1cmmqpszS3zLHYoHV4RsZ4b9fh88Ft 6ajCfbruYF2ONLupHlqXhOoiFjVnuIYqRosAM0tLGWCOq3tiLmCbazG8noUr8wnEUcfO 2lNp9DJ6DxS2iKS2N8e5ivJyZ3hX6UzpNM7hoxrsXOwK2VwmTLHDTdcOc3dcLwRZFs5t MkcQNzraWVQeyXFhMGhnCG2mTlXMRLi8ewNdJLLkBGjH0ixn2FULZ3V4xw7pIysupWbm UTd4nevzGDAyp3R5HQ9/a2tIZugFhaYPlFXkCmuSwBRB3mQfKz4CFHjihx14CMQzOul6 ufsA== X-Gm-Message-State: AC+VfDwIyD0raPM+0XjsvOR15xpkU6JAa+RUfLXhJbbeWr5DbwZQrTyZ cA8xaI5XE8pEf3rqoytO/pGwWw== X-Received: by 2002:a19:4f0a:0:b0:4f4:aea9:2a2f with SMTP id d10-20020a194f0a000000b004f4aea92a2fmr9476076lfb.57.1687361956801; Wed, 21 Jun 2023 08:39:16 -0700 (PDT) Received: from [192.168.1.101] (abxj193.neoplus.adsl.tpnet.pl. [83.9.3.193]) by smtp.gmail.com with ESMTPSA id l15-20020a19c20f000000b004f73eac0308sm821078lfc.183.2023.06.21.08.39.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 08:39:16 -0700 (PDT) From: Konrad Dybcio Date: Wed, 21 Jun 2023 17:39:11 +0200 Subject: [PATCH 2/3] dt-bindings: power: supply: Document Mitsumi MM8013 fuel gauge MIME-Version: 1.0 Message-Id: <20230621-topic-mm8013-v1-2-4407c6260053@linaro.org> References: <20230621-topic-mm8013-v1-0-4407c6260053@linaro.org> In-Reply-To: <20230621-topic-mm8013-v1-0-4407c6260053@linaro.org> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sebastian Reichel , Konrad Dybcio Cc: Marijn Suijten , Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1687361953; l=1391; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=swzJmejAdfZgsQElhxxdYG2Ii9/w0S0UDH09ZiwSv+o=; b=ciCb46lVCab3XUdD/PhBmPJGPR46nh4nvwoQSmQZGnJtrhdJOVezWE3UGwGPjFuSBeJ2F6Ift VkavK/7dyNQAn3RdbZk7uDckOtCpJPzTwAtnGzt/Y8bOpncF72Tu4bf X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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?1769330608233564780?= X-GMAIL-MSGID: =?utf-8?q?1769330608233564780?= The Mitsumie MM8013 is an I2C fuel gauge for Li-Ion cells. The partial datasheet is available at [1]. Add bindings for this chip. [1] https://www.mitsumi.co.jp/latest-M/Catalog/pdf/battery_mm_8013_e.pdf Signed-off-by: Konrad Dybcio Reviewed-by: Krzysztof Kozlowski --- .../bindings/power/supply/mitsumi,mm8013.yaml | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Documentation/devicetree/bindings/power/supply/mitsumi,mm8013.yaml b/Documentation/devicetree/bindings/power/supply/mitsumi,mm8013.yaml new file mode 100644 index 000000000000..080fd44083ac --- /dev/null +++ b/Documentation/devicetree/bindings/power/supply/mitsumi,mm8013.yaml @@ -0,0 +1,35 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/power/supply/mitsumi,mm8013.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Mitsumi MM8013 fuel gauge + +maintainers: + - Konrad Dybcio + +properties: + compatible: + const: mitsumi,mm8013 + + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + fuel-gauge@55 { + compatible = "mitsumi,mm8013"; + reg = <0x55>; + }; + }; From patchwork Wed Jun 21 15:39:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 111152 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4477709vqr; Wed, 21 Jun 2023 09:10:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7NbsrQZc9rTyutyXhy/ag8w2Hqj/pjlMlU1b9KB+UYpS7K+w6BcVmjFUC8bWU6urnURD0G X-Received: by 2002:a17:90a:670a:b0:25b:f9e3:7eb9 with SMTP id n10-20020a17090a670a00b0025bf9e37eb9mr5910073pjj.37.1687363822985; Wed, 21 Jun 2023 09:10:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687363822; cv=none; d=google.com; s=arc-20160816; b=BAKKt2/N/QG7gwy2n4oIInyY5txgolTUrOLl/AvChycgZhPb2dFgAF7DVlAEJXjU96 LdNozy3uHEl4u424NDmmgVFwmxS6XOs0wo/2cQ6Ceg7bA92owoYM1CPbtaaX7F6Pl0pO rSL1GneScj/PAE6MrToXwzZ0lTkeL7FMJmUgVlnfKOhczZjHOn1oMMH55yetuHi9p7VI 8tge+67x9JTVqHksCab8aLlGe/8xfjRG8gwmFUtDU5h3JrtE9uXnVEhgy3UMcDtEErCY EaxBKq03R7H/Cqr7GK74y2Wm1qOBxcmeucTucqO8SW5Q0pIhbkxsMyBc1fDXrNtnujhI KIDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=fb9J9GvWBYe5VRYUcNYFbGxYkIOx3Dvj9V9F/TGODfo=; b=cWmNo5oi8oF7ZYwpP2oaMR7lSkby3lSe62LMkUJtBk38DNAYPPU2x0G3djNGZ5+20R uJr4BK4w4ojF0QShacF4g5YqdW4wfbc7YA748HtPH5+VrJDaSXGbtuaaScuAfhrdrXH2 5D8QN7X99nvS0B14DPBCiYeo3DZKQkC/LCfKgi3i/2mfJOH5NDMdpFvnWLY52w072Yjr hyu7v6whbBvIXbfO/m62RywGTB7GfXFZeLmeFzVwzF6s+bsOwvcv+LUjdHRu/027t1Ul p6+xl4w4QwRqvVFBrvRDKgLynz/SY4dC5V1RV8Uedq2NM8Sby8CFcZ6bhwxBNBaw7aQ6 WqAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="n4SOthY/"; 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=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u11-20020a6540cb000000b005573b42d9e3si710350pgp.593.2023.06.21.09.10.10; Wed, 21 Jun 2023 09:10:22 -0700 (PDT) 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=@linaro.org header.s=google header.b="n4SOthY/"; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233689AbjFUPky (ORCPT + 99 others); Wed, 21 Jun 2023 11:40:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233668AbjFUPkb (ORCPT ); Wed, 21 Jun 2023 11:40:31 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D3DE2114 for ; Wed, 21 Jun 2023 08:40:06 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-4f7677a94d1so8372054e87.0 for ; Wed, 21 Jun 2023 08:40:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687361958; x=1689953958; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=fb9J9GvWBYe5VRYUcNYFbGxYkIOx3Dvj9V9F/TGODfo=; b=n4SOthY/ihHplEiJUth7V8qjZkEA1aQD7zGgq4QikrGv45pqBzufOiXNIRtvjnVU0n Jwku86pkC/4f/m7LXto4uquICt0d87Q9ILogfO54iR6AA5H2bhS7rRMZrjltzVxCIU0s bZmu3HslsV3EUpqYvmm2ZcWQjxn1B9jjQEUOqIXrnbZIEaUef6YZXe0Kgw4IBY66nCHF 92qjIHuUcNSGwfMR54bhm9iXdNiTX2SyyvG3U+qnrzGuOW1/7eXvGX1qX9ARyaV1MMu1 CL/Whwg4uq8IFfLVIAd0N1Ow9Q/2qdKZub3gU2j+VROcQ9/uPglU5Yhq5A0VMzGd4M6Z vK5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687361958; x=1689953958; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fb9J9GvWBYe5VRYUcNYFbGxYkIOx3Dvj9V9F/TGODfo=; b=PZIQaP2aKi1v4n5NRsKpQ0v0pCFFOVKLz+EgMTaRTKO7PPUqO0/oD2T5T1ZaI/zsPJ iC5jN+ufB4pMzFbs7l0al56XT7qP5Go6LxrejAm1o0+a+/5rTzhPTKWDHRLWYBHrtdHn D4Ddh5sUM+eBtv9tEpBowx3u5VDDWcl0VnZ6QQ9glQWWL9EXWU9o7gVa3/Kwnt7XWBxh 4LwkvOCB31LOZNZ52+n6ZS+DjdY9XdtRECCItSnagr3uY4xixbAVSWeLU+2Cx3OUaW33 6bbEP55vtwrX96Sa9BnMBQVb5lW3W+odZ2IREJohD3P3whRDDWpIL4CS9axvS7XsOqm0 h40w== X-Gm-Message-State: AC+VfDzh0hlRgXeMMtt3MBOqLUiHnwKfFNcDAaTZ8IMo3SQv/fUdg+nS TypVWpt0VF/6jJvjxIXaLmfLGQ== X-Received: by 2002:a19:7914:0:b0:4e8:c5d:42a5 with SMTP id u20-20020a197914000000b004e80c5d42a5mr9671940lfc.24.1687361958073; Wed, 21 Jun 2023 08:39:18 -0700 (PDT) Received: from [192.168.1.101] (abxj193.neoplus.adsl.tpnet.pl. [83.9.3.193]) by smtp.gmail.com with ESMTPSA id l15-20020a19c20f000000b004f73eac0308sm821078lfc.183.2023.06.21.08.39.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 08:39:17 -0700 (PDT) From: Konrad Dybcio Date: Wed, 21 Jun 2023 17:39:12 +0200 Subject: [PATCH 3/3] power: supply: Introduce MM8013 fuel gauge driver MIME-Version: 1.0 Message-Id: <20230621-topic-mm8013-v1-3-4407c6260053@linaro.org> References: <20230621-topic-mm8013-v1-0-4407c6260053@linaro.org> In-Reply-To: <20230621-topic-mm8013-v1-0-4407c6260053@linaro.org> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sebastian Reichel , Konrad Dybcio Cc: Marijn Suijten , Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1687361953; l=9964; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=ZEuJ8+X/qdfI2sOGh4SbbX/ldR75MGx5vuNAtp88VUg=; b=NpktR2cC8ZCUBVmPP0K5jmkVUApup/30ys4XfcV1lwiuqekJeZWNnDNsuESfIpKNZnIhEC2r3 J+YvQS3GtvaASvoZmwyMnkhDCsP5bfpPawL2EPIADsNfg4qCIvQk5JZ X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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?1769329208095747216?= X-GMAIL-MSGID: =?utf-8?q?1769329208095747216?= Add a driver for the Mitsumi MM8013 fuel gauge. The driver is a vastly cleaned up and improved version of the one that shipped in some obscure Lenovo downstream kernel [1], with some register definitions borrowed from ChromeOS EC platform code [2]. [1] https://github.com/adazem009/kernel_lenovo_bengal/commit/b6b346427a871715709bd22aae449b9383f3b66b [2] https://chromium.googlesource.com/chromiumos/platform/ec/+/master/driver/battery/mm8013.h Signed-off-by: Konrad Dybcio --- MAINTAINERS | 5 + drivers/power/supply/Kconfig | 9 ++ drivers/power/supply/Makefile | 1 + drivers/power/supply/mm8013.c | 280 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 295 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 210285042dcd..17aff9762091 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14300,6 +14300,11 @@ W: https://linuxtv.org T: git git://linuxtv.org/media_tree.git F: drivers/media/radio/radio-miropcm20* +MITSUMI MM8013 FG DRIVER +M: Konrad Dybcio +F: Documentation/devicetree/bindings/power/supply/mitsumi,mm8013.yaml +F: drivers/power/supply/mm8013.c + MMP SUPPORT R: Lubomir Rintel L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig index 663a1c423806..c19e8287d80f 100644 --- a/drivers/power/supply/Kconfig +++ b/drivers/power/supply/Kconfig @@ -951,4 +951,13 @@ config CHARGER_QCOM_SMB2 adds support for the SMB2 switch mode battery charger found in PMI8998 and related PMICs. +config FUEL_GAUGE_MM8013 + tristate "Mitsumi MM8013 fuel gauge driver" + depends on I2C + help + Say Y here to enable the Mitsumi MM8013 fuel gauge driver. + It enables the monitoring of many battery parameters, including + the state of charge, temperature, cycle count, actual and design + capacity, etc. + endif # POWER_SUPPLY diff --git a/drivers/power/supply/Makefile b/drivers/power/supply/Makefile index a8a9fa6de1e9..ba2c41f060be 100644 --- a/drivers/power/supply/Makefile +++ b/drivers/power/supply/Makefile @@ -111,3 +111,4 @@ obj-$(CONFIG_BATTERY_SURFACE) += surface_battery.o obj-$(CONFIG_CHARGER_SURFACE) += surface_charger.o obj-$(CONFIG_BATTERY_UG3105) += ug3105_battery.o obj-$(CONFIG_CHARGER_QCOM_SMB2) += qcom_pmi8998_charger.o +obj-$(CONFIG_FUEL_GAUGE_MM8013) += mm8013.o diff --git a/drivers/power/supply/mm8013.c b/drivers/power/supply/mm8013.c new file mode 100644 index 000000000000..1aea06456d03 --- /dev/null +++ b/drivers/power/supply/mm8013.c @@ -0,0 +1,280 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2023, Linaro Limited + */ +#include +#include +#include + +#define REG_BATID 0x00 /* This one is very unclear */ + #define BATID_101 0x0101 /* 107kOhm */ + #define BATID_102 0x0102 /* 10kOhm */ +#define REG_TEMPERATURE 0x06 +#define REG_VOLTAGE 0x08 +#define REG_FLAGS 0x0a + #define MM8013_FLAG_OTC BIT(15) + #define MM8013_FLAG_OTD BIT(14) + #define MM8013_FLAG_BATHI BIT(13) + #define MM8013_FLAG_FC BIT(9) + #define MM8013_FLAG_CHG BIT(8) + #define MM8013_FLAG_DSG BIT(0) +#define REG_FULL_CHARGE_CAPACITY 0x0e +#define REG_AVERAGE_CURRENT 0x14 +#define REG_AVERAGE_TIME_TO_EMPTY 0x16 +#define REG_AVERAGE_TIME_TO_FULL 0x18 +#define REG_CYCLE_COUNT 0x2a +#define REG_STATE_OF_CHARGE 0x2c +#define REG_DESIGN_CAPACITY 0x3c +/* TODO: 0x62-0x68 seem to contain 'MM8013C' in a length-prefixed, non-terminated string */ + +#define DECIKELVIN_TO_DECIDEGC(t) (t - 2731) + +struct mm8013_chip { + struct i2c_client *client; +}; + +static int mm8013_write_reg(struct i2c_client *client, u8 reg, u16 value) +{ + int ret; + + ret = i2c_smbus_write_word_data(client, reg, value); + if (ret < 0) + dev_err(&client->dev, "%s: err %d\n", __func__, ret); + + usleep_range(4000, 5000); + return ret; +} + +static int mm8013_read_reg(struct i2c_client *client, u8 reg) +{ + int ret; + + ret = i2c_smbus_read_word_data(client, reg); + if (ret < 0) + dev_err(&client->dev, "%s: err %d\n", __func__, ret); + + usleep_range(4000, 5000); + return ret; +} + +static int mm8013_checkdevice(struct mm8013_chip *chip) +{ + int battery_id, ret; + + ret = mm8013_write_reg(chip->client, REG_BATID, 0x0008); + if (ret < 0) + return ret; + + ret = mm8013_read_reg(chip->client, REG_BATID); + if (ret < 0) + return ret; + + if (ret == BATID_102) + battery_id = 2; + else if (ret == BATID_101) + battery_id = 1; + else + return -EINVAL; + + dev_dbg(&chip->client->dev, "battery_id: %d\n", battery_id); + + return 0; +} + +static enum power_supply_property mm8013_battery_props[] = { + POWER_SUPPLY_PROP_CAPACITY, + POWER_SUPPLY_PROP_CHARGE_FULL, + POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, + POWER_SUPPLY_PROP_CURRENT_NOW, + POWER_SUPPLY_PROP_CYCLE_COUNT, + POWER_SUPPLY_PROP_HEALTH, + POWER_SUPPLY_PROP_STATUS, + POWER_SUPPLY_PROP_TEMP, + POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG, + POWER_SUPPLY_PROP_TIME_TO_FULL_AVG, + POWER_SUPPLY_PROP_VOLTAGE_NOW, +}; + +static int mm8013_get_property(struct power_supply *psy, + enum power_supply_property psp, + union power_supply_propval *val) +{ + struct mm8013_chip *chip = psy->drv_data; + struct i2c_client *client = chip->client; + int ret = 0; + + switch (psp) { + case POWER_SUPPLY_PROP_CAPACITY: + ret = mm8013_read_reg(client, REG_STATE_OF_CHARGE); + if (ret < 0) + return ret; + + val->intval = ret; + break; + case POWER_SUPPLY_PROP_CHARGE_FULL: + ret = mm8013_read_reg(client, REG_FULL_CHARGE_CAPACITY); + if (ret < 0) + return ret; + + val->intval = ret; + break; + case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: + ret = mm8013_read_reg(client, REG_DESIGN_CAPACITY); + if (ret < 0) + return ret; + + val->intval = ret; + break; + case POWER_SUPPLY_PROP_CURRENT_NOW: + ret = mm8013_read_reg(client, REG_AVERAGE_CURRENT); + if (ret < 0) + return ret; + + if (ret > S16_MAX) + val->intval -= (1 << 16); + else + val->intval = ret; + + val->intval *= -1000; + break; + case POWER_SUPPLY_PROP_CYCLE_COUNT: + ret = mm8013_read_reg(client, REG_CYCLE_COUNT); + if (ret < 0) + return ret; + + val->intval = ret; + break; + case POWER_SUPPLY_PROP_HEALTH: + ret = mm8013_read_reg(client, REG_FLAGS); + if (ret < 0) + return ret; + + if (ret & MM8013_FLAG_BATHI) + val->intval = POWER_SUPPLY_HEALTH_OVERVOLTAGE; + else if (ret & (MM8013_FLAG_OTD | MM8013_FLAG_OTC)) + val->intval = POWER_SUPPLY_HEALTH_OVERHEAT; + else + val->intval = POWER_SUPPLY_HEALTH_GOOD; + break; + case POWER_SUPPLY_PROP_STATUS: + ret = mm8013_read_reg(client, REG_FLAGS); + if (ret < 0) + return ret; + + if (ret & MM8013_FLAG_DSG) + val->intval = POWER_SUPPLY_STATUS_DISCHARGING; + else if (ret & MM8013_FLAG_CHG) + val->intval = POWER_SUPPLY_STATUS_CHARGING; + else if (ret & MM8013_FLAG_FC) + val->intval = POWER_SUPPLY_STATUS_FULL; + else + val->intval = POWER_SUPPLY_STATUS_UNKNOWN; + break; + case POWER_SUPPLY_PROP_TEMP: + ret = mm8013_read_reg(client, REG_TEMPERATURE); + if (ret < 0) + return ret; + + val->intval = DECIKELVIN_TO_DECIDEGC(ret); + break; + case POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG: + ret = mm8013_read_reg(client, REG_AVERAGE_TIME_TO_EMPTY); + if (ret < 0) + return ret; + + /* The estimation is not yet ready */ + if (ret == U16_MAX) + return -ENODATA; + + val->intval = ret; + break; + case POWER_SUPPLY_PROP_TIME_TO_FULL_AVG: + ret = mm8013_read_reg(client, REG_AVERAGE_TIME_TO_FULL); + if (ret < 0) + return ret; + + /* The estimation is not yet ready */ + if (ret == U16_MAX) + return -ENODATA; + + val->intval = ret; + break; + case POWER_SUPPLY_PROP_VOLTAGE_NOW: + ret = mm8013_read_reg(client, REG_VOLTAGE); + if (ret < 0) + return ret; + + val->intval = ret; + break; + default: + return -EINVAL; + } + + return 0; +} + +static const struct power_supply_desc mm8013_desc = { + .name = "mm8013", + .type = POWER_SUPPLY_TYPE_BATTERY, + .properties = mm8013_battery_props, + .num_properties = ARRAY_SIZE(mm8013_battery_props), + .get_property = mm8013_get_property, +}; + +static int mm8013_probe(struct i2c_client *client) +{ + struct power_supply_config psy_cfg = {}; + struct device *dev = &client->dev; + struct power_supply *psy; + struct mm8013_chip *chip; + int ret = 0; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA)) + return dev_err_probe(dev, -EIO, + "I2C_FUNC_SMBUS_WORD_DATA not supported\n"); + + chip = devm_kzalloc(dev, sizeof(struct mm8013_chip), GFP_KERNEL); + if (!chip) + return -ENOMEM; + + chip->client = client; + + ret = mm8013_checkdevice(chip); + if (ret) + return dev_err_probe(dev, -ENODEV, "MM8013 not found\n"); + + psy_cfg.drv_data = chip; + psy_cfg.of_node = dev->of_node; + + psy = devm_power_supply_register(dev, &mm8013_desc, &psy_cfg); + if (IS_ERR(psy)) + return PTR_ERR(psy); + + return 0; +} + +static const struct i2c_device_id mm8013_id_table[] = { + { "mm8013", 0 }, + {}, +}; +MODULE_DEVICE_TABLE(i2c, mm8013_id_table); + +static const struct of_device_id mm8013_match_table[] = { + { .compatible = "mitsumi,mm8013" }, + { }, +}; + +static struct i2c_driver mm8013_i2c_driver = { + .probe = mm8013_probe, + .id_table = mm8013_id_table, + .driver = { + .name = "mm8013", + .owner = THIS_MODULE, + .of_match_table = mm8013_match_table, + }, +}; +module_i2c_driver(mm8013_i2c_driver); + +MODULE_DESCRIPTION("MM8013 fuel gauge driver"); +MODULE_LICENSE("GPL");