From patchwork Mon Jun 26 10:32:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 112841 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7386701vqr; Mon, 26 Jun 2023 03:49:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ70qrm4H3urYUd5uDNmB90mDR6JTRm17uz/ylva0SnmdDN4SThlAUmKJEAJtDI9clX9SyRE X-Received: by 2002:a05:620a:bd4:b0:75b:23a1:8336 with SMTP id s20-20020a05620a0bd400b0075b23a18336mr30664341qki.49.1687776542464; Mon, 26 Jun 2023 03:49:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687776542; cv=none; d=google.com; s=arc-20160816; b=eDJIFS9R6k4+Up3uYK7pz8B+i2mLPsToCo6weEl8PWrTLd2NWDm5jdLHpPO4rJ+i52 /fGnD7SG1LFwZ2UDzlAUqYtwP0XUpugePXZENJF+0eE4rdHfrQWl2e41UTjitJ8Ec6yn 5Ah5Snwa4YGgzdDaxTHMwMKLDpPXEqhyRg/JUA2arozUYhvSuRihTx0Wk+dX6NyAQHlh eX98QL3f9Wxwt4JybgClciECy4kRDJ3+9SmBlJV9hs6N81zC5H5hmkCPOM+WZZigX+zM 3PYI99rEj4jskO3lmunIbJo8cAgxcqiZhFaNptYwpClifLwd6uU9ynmZnnvTA7eY0HHe p2Yw== 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=tUgR1dLnPuxY4uDBYSPviY8Dvlm6F0UAHROxIQjI3RI=; fh=x6TiC0nyTqDTJO7GKaDM3x+hS3WCOs2j4IcSK/NpSFk=; b=eNWGTvW3o59od1Eole1K7/5+Rky5k6Wt5me27Jesh4dheoSRXV4yQ+On5lU7x0qff0 qz9FbGxXZhTtrQFfKN9v7eegrIxzPJWY3SxWCv1Y+wWsIEfi/RIp1JM0ZfE6EOpSwe/W ykomniiaDiAXXWXWIRm5pZKkv7qkTNSReAZc6zw1pjJfydNIbPcV12lk8cpieRNHaGwj Kv8QTRq7G9Rn5tLR7e1LRjdqlPxlNjpwDjivXRRvFC8QtNEIWPLqV1sQOyLNLS7YwlDa AqMAUnGgr1fIlteW6hGmzqkfYwc0E9YY3O63j//d88ocAw8LxhbD7dVnZTrLlbRN9UkF FS8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S0rxiJEI; 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 bs67-20020a632846000000b00553921dbc23si4509912pgb.675.2023.06.26.03.48.47; Mon, 26 Jun 2023 03:49:02 -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=S0rxiJEI; 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 S229571AbjFZKcQ (ORCPT + 99 others); Mon, 26 Jun 2023 06:32:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229976AbjFZKcO (ORCPT ); Mon, 26 Jun 2023 06:32:14 -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 0EF1EE58 for ; Mon, 26 Jun 2023 03:32:12 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-4fb7373dd35so1317210e87.1 for ; Mon, 26 Jun 2023 03:32:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687775530; x=1690367530; 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=tUgR1dLnPuxY4uDBYSPviY8Dvlm6F0UAHROxIQjI3RI=; b=S0rxiJEIck2B0qiJwwnlBYplTMkTowmDofeL+hW9pOjaFLazRvV3dYtA/lbkVWrsej U3qhcNmRVqC4xYDGgKJtoJe4RoGGqAn/BjXNCGvqdwu7O+X8Np/12n3euCUNJs+Q7liO ZQ3zkr4YBv6sTRBZUw1UrmqovWFuiib7OGR4TBpI/eWHdiy+YOqzgto9jba6GxESwdKu x+6iR68nFE8FyPLNNS17eg/45holEeJPgTNrldlgek17mHIycP594a5eLWhqGTDAJ8Eq vT9aFwAaAYIfRN0KqUTNbOzjfXWRZ/+gwLe7LglAc/LwKoGl4SX/RRTUS1poMw7AsfRa bUBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687775530; x=1690367530; 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=tUgR1dLnPuxY4uDBYSPviY8Dvlm6F0UAHROxIQjI3RI=; b=IOuPGY0Fz60vwPSnTo4SmzqvGIeSB9Kzot6I+woAk4ZSfnXEsRE9XX6y742jBqUqmc BCA86PshE7jQNxtWJwzAtxkNXokg8OPaa30oVYyv1m/pgaotzGjHpU7eS36XTOpVjGlO WtaXTvY9JhZs+9GM11d2Ewakac54SOdsgmMbw6hMZhvmgnmR1GjKy8gS90hVD2/exgug +YjlwZIwX+d0DiAcrmo6cFptupapoXidw5EjB6/etf/4nWIvckzfz/jgDUa3SQm/9KN1 H3hQjM5JUGdXt0iu5jM30bYRjbUVdZvc9Un7jScQ5ZGVx6HSh81XeLbqJMqMgO/kcz3P R/2w== X-Gm-Message-State: AC+VfDzg080vvYp3cJz4WcMKjLRbczt6KOGt5WgZ7VTHTFocy0qkGtFZ KFsjY6kjhkllYBXr6y7fdT5ewg== X-Received: by 2002:a05:6512:3a95:b0:4f9:6adf:3981 with SMTP id q21-20020a0565123a9500b004f96adf3981mr3350599lfu.33.1687775530289; Mon, 26 Jun 2023 03:32:10 -0700 (PDT) Received: from [192.168.1.101] (abyk179.neoplus.adsl.tpnet.pl. [83.9.30.179]) by smtp.gmail.com with ESMTPSA id c26-20020ac2531a000000b004f13ca69dc8sm1041655lfh.72.2023.06.26.03.32.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 03:32:10 -0700 (PDT) From: Konrad Dybcio Date: Mon, 26 Jun 2023 12:32:06 +0200 Subject: [PATCH v2 1/3] dt-bindings: vendor-prefixes: Add Mitsumi Electric Co., Ltd. MIME-Version: 1.0 Message-Id: <20230621-topic-mm8013-v2-1-4be6223587ad@linaro.org> References: <20230621-topic-mm8013-v2-0-4be6223587ad@linaro.org> In-Reply-To: <20230621-topic-mm8013-v2-0-4be6223587ad@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 , Krzysztof Kozlowski X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1687775527; l=1125; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=TuRO5xCEXwws0sr0Ai5UAAA9eIk2XyYn2SGhIajpq0E=; b=YUjTXuuD7JlDrbZ3dgnAc3HoM7SActksn/k/2eFBg71QNM2I7rOd9bWH+tXW5vF0MvYd0QO7j 7xN9o6r9MBXDKjPJiSucfXZfoxt1UJlqZTIlMNI8EVqw1PyPwQP9710 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 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?1769761975627851583?= X-GMAIL-MSGID: =?utf-8?q?1769761975627851583?= 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/ Acked-by: Krzysztof Kozlowski Signed-off-by: Konrad Dybcio --- 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 Mon Jun 26 10:32:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 112847 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7392097vqr; Mon, 26 Jun 2023 04:01:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4QBhFlyHeIodpi4J2nuJQ59/Lkgf/q3CpklwDvRZLBxT2keBWBGiy98rnjcQ4TdnFkZg6T X-Received: by 2002:a17:907:707:b0:966:634d:9d84 with SMTP id xb7-20020a170907070700b00966634d9d84mr24645273ejb.20.1687777261607; Mon, 26 Jun 2023 04:01:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687777261; cv=none; d=google.com; s=arc-20160816; b=KEpJ9gCqXCUfx1LsdUq72OdPVgkg7uVf2bGtjWxa0eAzAysMNAqU5HGplsfkd7Qf/8 6rThSJ+ISLUoWDAQfxzqvuHSsyyH9oER/ziDywsgSVcU2S+4pegf0DH/ZHGe3yCXdzxc WkyTb6p/C7Ftmt1TIV8Ny6bqP6ACqL/Hy30Eh3ySmlOnUbkckVuaLp/RfzZJKKhQSzbQ f1feCgh7LDf6IRnx+uNVU4X5ig3eJ4cnmWh/Ia9YhAWl2PtzVbdxniqdUBqEX54OexvQ yJpu9NCKAW+MeLrJMH6+ezS3qu5ZhHbAsGpqm5G27rqfVIeWdL4nBjJMvfQEE7FB3uUo i3+g== 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=d6JtgnVPfaRDduEP2cAzMm1DanPSCZPJshpIYUQYupg=; fh=x6TiC0nyTqDTJO7GKaDM3x+hS3WCOs2j4IcSK/NpSFk=; b=KJ+zjs/Rn3uKzTQN6crw+DGCqlS6UfdlEr0Lz0TDvuK4F/3v08gtV5WxnH66SuqBHL u3cE+PXSoBJaT1ExAh+KtHBwDnZuQ0OH7IMSTE4nGgPE4Dk7WhcvYyeTAh1Pfa3hx2gE myqODniY/GmmExyMSHL3hfJGg0Got2MzDYh+yom0Cm0NA97m6OePgdslUm7IRTlHzPsO 10KPXGumYsQ2fBDNPckXs08sxIwk6RHM6uKuLQcFJbcHWQ7DjIUkZOM1EJiRz4OU1p9G O7GpX8+JfT7x8deRCQG3wafVulsTm6pKXoqYvTeUQyCMxViAfrxcaeNFU39AoT23vNcp fwTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y1+pvc7t; 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 lw11-20020a170906bccb00b00982b13e065dsi2454885ejb.208.2023.06.26.04.00.36; Mon, 26 Jun 2023 04:01:01 -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=Y1+pvc7t; 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 S230266AbjFZKcU (ORCPT + 99 others); Mon, 26 Jun 2023 06:32:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230149AbjFZKcP (ORCPT ); Mon, 26 Jun 2023 06:32:15 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48A5BE56 for ; Mon, 26 Jun 2023 03:32:13 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-4f4b2bc1565so4043185e87.2 for ; Mon, 26 Jun 2023 03:32:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687775531; x=1690367531; 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=d6JtgnVPfaRDduEP2cAzMm1DanPSCZPJshpIYUQYupg=; b=Y1+pvc7t8Q9UC0vxWjn35nn9N6orZjatS1wn93XmWtMoDik49aMMex3Fw3xaeDQMK8 xeaNaMNmtn7134qe5nchTNkSm3V1IS+C3Hi1yJARGHWyYqledAG6v9wsNDnSVWgBfJQM clx13egRjQKHYmEtWFOCzM3P88GMKM3Fa5R4ZyigTXpq++YGRCfj/6hN32tgyfXCZSNU X7fb65RWZx98tYOLNJ4adUxv+EL5HO3RIj/JsZXIbIQpc7NT/GdC8DAmJd1tkoOkHw0O Q8mMjIEZ+kcXlXzm8xV+vTaa7GOhmmKjYyl+m18fevfHlujhYDmVJX5DmJXbqlmv5FcU Uegw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687775531; x=1690367531; 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=d6JtgnVPfaRDduEP2cAzMm1DanPSCZPJshpIYUQYupg=; b=E9WKiWCyuJdJokFDoJCGrYAT9qXkfKJxlOtrR/mSIkDHJSCB3gh1PlwfhYBS3iuF0c X02k14RgAn3ZxLJJClfE3RmlP47YAzo8tTjtqhkryVMMaofGDLCSqXAOBO6Kj9AB6SOs i40911v5tNSpie7zZOWXs1u814feQh8tXJ2QZwA65hhHoZabszYMJNg9+68uz1i1OgVI XlLgitqY0t/BRladHnY8NDtKEqrQgTuXYLJkSLIxde36SAeXXiH2DKRaxC0v7I328VK1 HY7E4N1iU7X9QXwlbNRBg7eebgFGfBjYIgNPYOb1bra3YQd7kWb+9effD/78ht92OV17 0m5A== X-Gm-Message-State: AC+VfDxWvLO5zxbteaq8tD8CwVYl3YG8GlvTsUp7qLhNcNvjK30wL/4I wDINtzOoQ2YADxtVZMxji+WpEg== X-Received: by 2002:a19:5f1c:0:b0:4f4:d83e:4141 with SMTP id t28-20020a195f1c000000b004f4d83e4141mr15523490lfb.50.1687775531502; Mon, 26 Jun 2023 03:32:11 -0700 (PDT) Received: from [192.168.1.101] (abyk179.neoplus.adsl.tpnet.pl. [83.9.30.179]) by smtp.gmail.com with ESMTPSA id c26-20020ac2531a000000b004f13ca69dc8sm1041655lfh.72.2023.06.26.03.32.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 03:32:11 -0700 (PDT) From: Konrad Dybcio Date: Mon, 26 Jun 2023 12:32:07 +0200 Subject: [PATCH v2 2/3] dt-bindings: power: supply: Document Mitsumi MM8013 fuel gauge MIME-Version: 1.0 Message-Id: <20230621-topic-mm8013-v2-2-4be6223587ad@linaro.org> References: <20230621-topic-mm8013-v2-0-4be6223587ad@linaro.org> In-Reply-To: <20230621-topic-mm8013-v2-0-4be6223587ad@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 , Krzysztof Kozlowski X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1687775527; l=1459; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=6NgCrA8TzKC0b1xLfjDslYNGxlWGJLejhI+Bt3kSWN8=; b=KSFiBW+Q3z06d4lYzhcpKuWsUva9LjcS7caRBGzhENfqL8BfsZ7xqpP36pCbILGYlt5YBAiAE Hf6S4p6aLsLDF81JYmjFtdpqsB8QKedo+SMgV+bDVl5RnpQEibA2KH+ 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 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?1769762730095938135?= X-GMAIL-MSGID: =?utf-8?q?1769762730095938135?= The Mitsumi 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 Reviewed-by: Krzysztof Kozlowski Signed-off-by: Konrad Dybcio --- .../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 Mon Jun 26 10:32:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 112843 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7388074vqr; Mon, 26 Jun 2023 03:52:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7PeXtYLjR/4TUqDOLf/gKr1+2xvm6G0FV0Troy16khWVlrg/eGJ2OD+QJnAXrqOKllo1qI X-Received: by 2002:a05:6a21:6d9e:b0:121:f3a2:3a8 with SMTP id wl30-20020a056a216d9e00b00121f3a203a8mr15846895pzb.0.1687776740780; Mon, 26 Jun 2023 03:52:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687776740; cv=none; d=google.com; s=arc-20160816; b=y4o2+r/1YKGRru3bw5g75foMrZi1qU/AYYeNMkJHPdcdgsrOMmhWWwQBMgxxhS6jDk EF25FHAQYJlgwpshAPQP28aEmdsdHC00uspxghO8vXBWco3uRHFT9K9V7Gbx0r1cyS/j /2U+488Gs7G1UsGwWNFawNzYJPTXhJHJGtaI/3LmWiPadyhOnUFLlDQLWyBCLypLJv5A S8vFDkZWgY16cBWel88QairttTho/TZHQ64RexDm9tg+pEmz3JhSd0rkqvVezc1ZqJ+8 EfdsxnXk75rMYCiZQL5RWOxxOwVztrAoRYAB2p8MTknGBVbybmz6ri0YZM+RnKq8wx2Y UX5A== 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=lNqCqk1p3DEAINdEzhEM0YGD2kICxrffp8EeTtdvows=; fh=TF7eZ0UROHTRCLAQqbMtEpflqhtS0fZLPJl8hPrR4uY=; b=kZlTRpWhbPHSXNRicfEcTr+2ORhkAD7ymWkKEyJ/6rO/cLi5/W8Npdr25VxqtCHVTj D3sok2CaHmsaQV7Zs77IiFfGSje9i/qY3SGgURHXzwteKKt94vzyT+sE6gZlv4u8PCED eNNwTiodbDOtde+QWQS7M/sA9wL9rTYdX3QnbbkgFkoOuqwnj2WteeAkIKn4LhOtfLQH sxpu67CWU0PGYlXelBfjmLa4y1RwTSqf10ssbo6fu3g+wveWXd/0/i6dCBz/cn6wWuR5 GyNnwQRP3qLByxlzoblsOCn2lj1TPtg3tJr+P/oHU9ORQ50QCFw+P1vtuA7j9igSQ803 L62g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lebYaEpJ; 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 z9-20020a656649000000b00553365f5bf0si4769248pgv.321.2023.06.26.03.52.08; Mon, 26 Jun 2023 03:52:20 -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=lebYaEpJ; 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 S230284AbjFZKcX (ORCPT + 99 others); Mon, 26 Jun 2023 06:32:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229976AbjFZKcR (ORCPT ); Mon, 26 Jun 2023 06:32:17 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E16AE5F for ; Mon, 26 Jun 2023 03:32:15 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-4fb7b2e3dacso408228e87.0 for ; Mon, 26 Jun 2023 03:32:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687775533; x=1690367533; 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=lNqCqk1p3DEAINdEzhEM0YGD2kICxrffp8EeTtdvows=; b=lebYaEpJJsjMdw+fYTpvibU4apgZjTpqT73VB5kWTAlwSkNmL5pQhaK7OoXfjpqKp1 3TGRxMu8VVwmOErGfpGMLkNJ0uigSLvDt8fiQ34/6BPzo4l8ypBnse43eBnA3L2nQ3IG z3af6ILONaZROVtX/EZ3mGOUBtYaJnIsqM2vjPawmAwX+l5fBv1iwqvcRIyx7hbU1lwK QYbKnYp3AolNGtmYnLjIUA4PnhZ8pmz4b9cEuM0dIjwgQUqe8PdHmwjT84nhyLC0tZDR AkfN1EJkua+HNegYY2IawTaMZoo3i9o6I3IO0zJI2vxjfHjKP9PAvS2skY1g9B7ALktN Ayaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687775533; x=1690367533; 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=lNqCqk1p3DEAINdEzhEM0YGD2kICxrffp8EeTtdvows=; b=C1081OpNTPwbMoimVBGzayIHWlxzNTAq9mqBjV5GHt2tfuXaxr7j7CBxelmDt0a06e swo/z10sPXNoiAjeScRrOGhBcRLPsVwH58u5AK9X7fViYmXZOE+VrEnw7rLjP7CU/Ib8 tWri633hC4Gr5WTCIiA/Bhpbs39GWN9rYQSY+9H8uMmirCpH91lIUq198CUE6QohYdO9 Nf26GslfXMcgIqyWPJa2VSUGLLruOxg+m1PDwAHwJUOt0RrVLCxA93JgaRHnO4Rf163P tWyTs9U+Wsul7Vqr+8EpU+h3WckNPoQDoPrbaFPw18bCaATzX/YQcA2bQbejqP/9RRf7 r0ZQ== X-Gm-Message-State: AC+VfDxJhBSIbdEJwYydL+rjIb8GQeO+NuiHgNZIUDbixz8xnu9S73EA /kFPf32IW9LBRpg1xD3p+HDG2g== X-Received: by 2002:a05:6512:b0e:b0:4f8:75cf:fdd7 with SMTP id w14-20020a0565120b0e00b004f875cffdd7mr12224933lfu.22.1687775532708; Mon, 26 Jun 2023 03:32:12 -0700 (PDT) Received: from [192.168.1.101] (abyk179.neoplus.adsl.tpnet.pl. [83.9.30.179]) by smtp.gmail.com with ESMTPSA id c26-20020ac2531a000000b004f13ca69dc8sm1041655lfh.72.2023.06.26.03.32.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 03:32:12 -0700 (PDT) From: Konrad Dybcio Date: Mon, 26 Jun 2023 12:32:08 +0200 Subject: [PATCH v2 3/3] power: supply: Introduce MM8013 fuel gauge driver MIME-Version: 1.0 Message-Id: <20230621-topic-mm8013-v2-3-4be6223587ad@linaro.org> References: <20230621-topic-mm8013-v2-0-4be6223587ad@linaro.org> In-Reply-To: <20230621-topic-mm8013-v2-0-4be6223587ad@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=1687775527; l=10078; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=FXajsw1B4OtWBdv0fbmYQgvV8Jhhw7n80XW8hUwq/0k=; b=g02M65fU+Ao2eFLMCgUmeZTQv9AlE3wEveJxffqgctITZOoN8/G9arUyZVH4m5cwshe6A6xPM gM14x3b9aFDDJle5O//cZexLBAqW6yJr5i9lnKir7T8yPQqapM52ytW 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 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?1769762183637718934?= X-GMAIL-MSGID: =?utf-8?q?1769762183637718934?= 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 | 283 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 298 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 5ce188b58eaa..ba5f075a2ca8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14296,6 +14296,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..ce20c6078116 --- /dev/null +++ b/drivers/power/supply/mm8013.c @@ -0,0 +1,283 @@ +// 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_PRESENT, + 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_PRESENT: + val->intval = mm8013_read_reg(client, REG_TEMPERATURE) > 0; + 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", + .of_match_table = mm8013_match_table, + }, +}; +module_i2c_driver(mm8013_i2c_driver); + +MODULE_DESCRIPTION("MM8013 fuel gauge driver"); +MODULE_LICENSE("GPL");