Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp4477418rwb; Mon, 8 Aug 2022 01:22:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR45jXnFZ7UDpV3kfhxQqWgi3mzqeId0A6Jq7trAu6tAYkCkwRxuWoivONMFCDq6j2w4sC+t X-Received: by 2002:a17:907:2c6b:b0:730:e952:4140 with SMTP id ib11-20020a1709072c6b00b00730e9524140mr11592149ejc.702.1659946960233; Mon, 08 Aug 2022 01:22:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659946960; cv=none; d=google.com; s=arc-20160816; b=kXFvl/Ty3WnLWBwg6WAeW8sJLDd8bkbVeYwpy6DHLCVEtk2Kw2QSAFME+KkJDjSKwV 4HMECZT0opsfrHqd84LgqbHCxapBlKo6CPE12NXBQVLpUyZVrgcmuaDnZ8Eo/8WqyMHc VS4hN3r+nibxfH41xSmBfxMMPxO1wca78cM7gRGuinwo4dLdVbnhS70NCxf/AjAH/mBF vXg4ZnCP2qh4L/NDtCTshiq+PdtLF0Pb6RXPgveD1ZoEAUHZ0f7JiL/YoyoJJjsz4Q9W KNDGd45sHE3we1lsomXaX1tdTvcYEJqh579lmtQYVsHPj3f3vUIj7aUbcnbt2K9LCLiw Aw5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=pLEgpHosko6zu68c6+83D0WlNXTrwkqBiWooJQ+HKoQ=; b=0z8FjuDQGH1MR6Pq8EioohQfBkAEZ8vOWzOUwynLVH39SXqKO6d0lgU55MVFJSDPdX sdDspgtRnPD/Ukd1vbaRslgHvoK5ZIdTEVZ3wyi0mSLqejTSPKUthTDFd35vte6GL9k8 zoTzA2D+P9myqm/1t3ei7fWR165C2+9z4EN8IvrvRnQTmFAoKFhImeUPxY4pA88rphws tDnqxpd+n9NDHL7fOt1lZmpiTuAKgRDG/4nARiRD/8KzbHXugPkJx4XzUXIg+0ggxCTr PYrwq28l4MP0Cf62t2ktV2y/4gEtDYawUi/1Sqhl/oDEEzvM+Cbv6c5mZADZW5Tu0zlw qPvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cq8Fvz9C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x4-20020a05640226c400b0043a944f4458si6468498edd.573.2022.08.08.01.22.15; Mon, 08 Aug 2022 01:22:40 -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=@gmail.com header.s=20210112 header.b=cq8Fvz9C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236836AbiHHHfq (ORCPT + 99 others); Mon, 8 Aug 2022 03:35:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236299AbiHHHfb (ORCPT ); Mon, 8 Aug 2022 03:35:31 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D57762F2; Mon, 8 Aug 2022 00:35:30 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id ay36-20020a05600c1e2400b003a4e30d7995so6976808wmb.5; Mon, 08 Aug 2022 00:35:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=pLEgpHosko6zu68c6+83D0WlNXTrwkqBiWooJQ+HKoQ=; b=cq8Fvz9C8dLGc6CoNBTF+yrNT1H8Tn+yQYmIQGBUgXdaXAMTBGLYBCUnfWAp1CI1b6 dLqkHUFfhLQgykuG906XpztRXRLu/6N66uLz+eoFCnAOM08YCx9K+dwLQSyGjfa3/MPS Daip3brjzwOqDj7u8MMDuhwarPFkz7yUzCAQV1GN9ZY1mO4d4jo4+s4MsJEs5GfnnxqD D3gAMyln9hmlpQA1TRZAahCZK29B5Zzynho9AgHS8UwZSJH8tWd48gHCuBRKyfDSiKB6 XzvjgpzIpH67I5ldfoDgY7ieQi7wfgy4f3uBQSL5wqc3zhsJImUkIQuh2j/A9hmGgBkO DKZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=pLEgpHosko6zu68c6+83D0WlNXTrwkqBiWooJQ+HKoQ=; b=SE/MeDxaUdrm9ReBzoDqQfPlJ/H0j+mqIGk4I8u0GdQAS59AVSH5WFO+65oDZpJaq7 6lDUOn5KS371VYE7Y+3Cr6MZZWlCNL7xqOnh8Ymgt40cM5uPitZB1n9p7n0VboShLJZY oOpnjsLB/tsQMvX32fr6YWZlBT4OX6OmmPIVwttOUngiEI1ImsqH4dus6kRwq+dYV4LS IawjXGeFFjPxWbdk4AKPfWimRpCz1hnuweljnDvfAEkGJi7GVzhUQQtH79wA/sBaEu8e Gcm5Hzp6dKjqO/Ah9dLbnZwfNYwWSFlTcxo7tJEDXCSRfbFuA6oABo84mEt8ZJ0uvJVZ ktFQ== X-Gm-Message-State: ACgBeo30Dp/r3QRXeWfkDbBvO7MoFXeUJ3GfA2luetT/V8R+pidjtOZ+ R47GR9OTEYryZTaREWP5C1w= X-Received: by 2002:a05:600c:4e92:b0:3a3:2a1c:d005 with SMTP id f18-20020a05600c4e9200b003a32a1cd005mr16859487wmq.170.1659944128671; Mon, 08 Aug 2022 00:35:28 -0700 (PDT) Received: from localhost.localdomain ([105.235.133.111]) by smtp.gmail.com with ESMTPSA id cc11-20020a5d5c0b000000b002205ffe88edsm8333364wrb.31.2022.08.08.00.35.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Aug 2022 00:35:28 -0700 (PDT) From: Yassine Oudjana X-Google-Original-From: Yassine Oudjana To: Sebastian Reichel , Rob Herring , Krzysztof Kozlowski , Andy Gross , Bjorn Andersson Cc: Yassine Oudjana , Yassine Oudjana , Alejandro Tafalla , Konrad Dybcio , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, phone-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/8] power: supply: Add driver for Qualcomm SMBCHG Date: Mon, 8 Aug 2022 08:34:51 +0100 Message-Id: <20220808073459.396278-1-y.oudjana@protonmail.com> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 From: Yassine Oudjana This series adds a driver for the switch-mode battery charger found on PMICs such as PMI8994, and referred to in the vendor kernel[1] as smbcharger or SMBCHG. More details on this block can be found in the last patch message. This driver currently supports the charger blocks of PMI8994 and PMI8996. PMI8950 was also to be supported, but it was dropped due to some last minute issues, to be brought back at a later time once ready. The OTG regulator remains unused on devices where the charger is enabled in this series due to lack of a consumer. Applying a patch[2] adding vbus-supply to DWC3 allows it to enable the OTG regulator making USB host without external power possible. [1] https://github.com/android-linux-stable/msm-3.18/blob/kernel.lnx.3.18.r34-rel/drivers/power/qpnp-smbcharger.c [2] https://lore.kernel.org/linux-usb/20200805061744.20404-1-mike.looijmans@topic.nl/ Yassine Oudjana (8): dt-bindings: power: supply: Add DT schema for Qualcomm SMBCHG arm64: dts: qcom: pmi8994: Add SMBCHG arm64: dts: qcom: pmi8996: Add SMBCHG arm64: dts: qcom: msm8996-xiaomi-*: Add battery data arm64: dts: qcom: msm8996-xiaomi-*: Enable SMBCHG soc: qcom: Add PMIC secure register write helpers util_macros.h: Add macro to find closest smaller value in array power: supply: Add driver for Qualcomm SMBCHG .../bindings/power/supply/qcom,smbchg.yaml | 205 ++ MAINTAINERS | 16 + .../boot/dts/qcom/msm8996-xiaomi-common.dtsi | 15 + .../boot/dts/qcom/msm8996-xiaomi-gemini.dts | 5 + .../boot/dts/qcom/msm8996-xiaomi-natrium.dts | 5 + .../boot/dts/qcom/msm8996-xiaomi-scorpio.dts | 5 + arch/arm64/boot/dts/qcom/pmi8994.dtsi | 72 + arch/arm64/boot/dts/qcom/pmi8996.dtsi | 4 + drivers/power/supply/Kconfig | 11 + drivers/power/supply/Makefile | 1 + drivers/power/supply/qcom-smbchg.c | 1664 +++++++++++++++++ drivers/power/supply/qcom-smbchg.h | 428 +++++ drivers/soc/qcom/Kconfig | 4 + drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/pmic-sec-write.c | 82 + include/linux/util_macros.h | 22 + include/soc/qcom/pmic-sec-write.h | 9 + 17 files changed, 2549 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/qcom,smbchg.yaml create mode 100644 drivers/power/supply/qcom-smbchg.c create mode 100644 drivers/power/supply/qcom-smbchg.h create mode 100644 drivers/soc/qcom/pmic-sec-write.c create mode 100644 include/soc/qcom/pmic-sec-write.h -- 2.37.1