Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2665287rwb; Sat, 8 Oct 2022 11:53:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5jPl2XZLlpWKKemLf46YJF3pihmPvl+uEwS3lzf0x7ZO5IC+ac/nZ5cGxP+oG//DwnJHtv X-Received: by 2002:a17:907:9626:b0:78d:3ff7:a0cb with SMTP id gb38-20020a170907962600b0078d3ff7a0cbmr8721593ejc.472.1665255227548; Sat, 08 Oct 2022 11:53:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665255227; cv=none; d=google.com; s=arc-20160816; b=xZx2Fsej8ZGNcGxzeuzvCrXp7CmQtygto9GklgAn6eA0JY3VAo7LFYERRMSs47/8KD Tu2coH0a03KKCENuGkGBWnf7durFP/3aVfWU6YWH/hkvxWcIowz3dqjW1llpxkEAAwyY maRt+7vCmDPeG3C5W4m8Ubsixti87gw8qzb5ph0fyKTstB23wJD7fqOfGJ/qYA6oYaP1 FN6GmnYSA0dFqCQppQwi5xUFYDRl5YQidL9b9uYqWG27K+fPeLcTwQZEG/ZPM3QFcsKP eao1GNfWJIJbrtPqTcUXAV9wpDILSn6iPjEk73GE5fsO+7vvr4wZ96AZhDkqW4+ox7W1 2prQ== 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=5qH5NNc/K0QTO3Py3yp57L7/2aPQOFrGVLYf3wX60PU=; b=DDfhgBrCRGSanTSTa/HCx8sZ1LinsBT897WjIJJzxQ8RLTU4OnSSTUaBcmsplyK3Im wR2kS9egMgce9bHuG0QiB0gI7rorKQW2xWQ0tRWbEBbFfTc7UfJgNusgtUCMVsO/NA+x 4YHYFZ8IKMCWKcaRRaawuW9vgGv7RtOeUFF4q9pp1WoPkOl/6DR+5Flcabv4QbnLBFQa OC0tc0Gqsi1uIORpb/nKQvFQFHJwRGCrGH/HmIpP/g5pmuDk5J8kOIulyO0mvKUTT1Sg OogsroSIzmNHn8vcnRFFAGZBhawyM9PwP6KOwyDX7NjdPYGh+hH+XmO9RSgBqEM/VvcW 0A2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=x9OnQu1Y; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u10-20020a170906654a00b007707c67f523si5620694ejn.335.2022.10.08.11.53.22; Sat, 08 Oct 2022 11:53:47 -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=x9OnQu1Y; 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 S229606AbiJHSkG (ORCPT + 99 others); Sat, 8 Oct 2022 14:40:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229506AbiJHSkE (ORCPT ); Sat, 8 Oct 2022 14:40:04 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 060B31C905 for ; Sat, 8 Oct 2022 11:40:00 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id l8so4624801wmi.2 for ; Sat, 08 Oct 2022 11:39:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=5qH5NNc/K0QTO3Py3yp57L7/2aPQOFrGVLYf3wX60PU=; b=x9OnQu1YUs++g+yzHHJu1hlyaupBkGIAtoSLehwpZd5W2/4411EMAdxXi7V/ikIo38 KMeNQgHIUMEjJkIcK0AUzi2s5JqiI4Ag/bY5bIrnDHUfu/nXhas6pCw5aStJIqk+meP6 6ZWfVib8m6KLVs0jc2zkVNR1zu8SDCCF9BqdwxD6XfUnPZGeMp4i8Kd6bsO6t1U4ADZN XRtFd0w5tPJp/Uhen7MA3IISygVwRNaKjqJQp0gYd+XGjmLUNO1as7/nfbeDLB1MHBsr YKtCWRsiL0JuI7qpqyUcaxWTcWVFwggA35qUqA3ZhEwbKVSbKsgEFprtEnR9Y/zEB94/ NTHA== 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:subject:date:message-id :reply-to; bh=5qH5NNc/K0QTO3Py3yp57L7/2aPQOFrGVLYf3wX60PU=; b=H8Lor3Qj4U+4mI7FMVjrO3pvy13iXWHtsGjEBwNzyyuJAIwTGCVNOHm0Wt/x9Ro0Pw 08tGeuG26R/FmZ826fE866mhUxNmqJI8AVuaFG+DJZTuke/zrxAnVFWCbQhl2vd1oWxt /zaVUJbr1BuBUTJUEQGMNr0gjgq3t7XdjEeXagBcDRm0ybmcRVWUO2t+AayzsbDN9eNp xxNm1U6HSnstWdl48LViInAHMditZEmW6PZE/bJyWw7JLPFq6lf6+TVfGQIZXgd7wdh1 2gxio7WC1qjXXcC2Om1soS3u6O7vg8/U8X51zDb2+DJmVDR2MyxWbf/RgraOwgHZxa4G Q/Vw== X-Gm-Message-State: ACrzQf1/MHvxDJU8Kkw+GwHMd2ApUXU/HWUdKQep/HmMyOFf15LoQydE iSXL5teBAhNSjk94a7zQlo5K7g== X-Received: by 2002:a05:600c:3515:b0:3b4:a0fa:c4e1 with SMTP id h21-20020a05600c351500b003b4a0fac4e1mr7275771wmq.191.1665254398468; Sat, 08 Oct 2022 11:39:58 -0700 (PDT) Received: from localhost.localdomain (cpc76482-cwma10-2-0-cust629.7-3.cable.virginm.net. [86.14.22.118]) by smtp.gmail.com with ESMTPSA id m38-20020a05600c3b2600b003b4ff30e566sm28325194wms.3.2022.10.08.11.39.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Oct 2022 11:39:57 -0700 (PDT) From: Caleb Connolly To: linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, Sebastian Reichel Cc: Bjorn Andersson , phone-devel@vger.kernel.org, Joel Selvaraj , Caleb Connolly , devicetree@vger.kernel.org, Konrad Dybcio , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Tom Rix Subject: [PATCH v6 0/2] power: supply: introduce support for the Qualcomm smb2 charger Date: Sat, 8 Oct 2022 19:37:50 +0100 Message-Id: <20221008183753.249514-1-caleb.connolly@linaro.org> X-Mailer: git-send-email 2.38.0 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,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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 Add a driver for the Qualcomm PMI8998/PM660 Switch-Mode Battery Charger. This is the second generation SMB charger, and replaces the previous SMBB hardware found in older PMICs. This driver provides basic support for initialising the hardware, configuring the USB input current limit and reporting information about the state of the charger. Features like type-c dual role support and OTG switching will be added in future patches. This patch series depends on my previous series adding support for the Round Robin ADC which is used for reading the USB voltage and current, it is currently queued in linux-next, and can be found here: https://lore.kernel.org/linux-arm-msm/20220429220904.137297-1-caleb.connolly@linaro.org/ This has now been merged Changes since v5: * Rework IRQ initialisation to support per-IRQ configuration * Add support waking up the device on cable plug/unplug * This fixes a bug where when attaching/detaching a cable while in suspend, userspace wouldn't reflect the new state. Thanks Joel for catching this. Changes since v4: * Fix typo when setting FAST_CHARGE_CURRENT_CFG - the OnePlus 6 now charges properly! * Limited charge current to 1A until we better understand the thermal protection features and how to use them. * Address Sebastian's comments (thanks for your patience with this) * re-run clang-format Changes since v3: * Drop DTS patches, to be sent in a future series * Add POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT so that the charger will be exposed as a cooling device, see https://lore.kernel.org/linux-pm/164f2458-fb66-f238-7143-bdbe1e200870@linaro.org * Run clang-format and prevent it from breaking the formatting of the defines * Apply Sebastian's suggested fixes Changes since v2: * Use devm_delayed_work_autocancel * Minor driver fixes * Pick up Krzysztof's R-b on the DT patch Changes since v1: * Rename the driver to pmi8998_charger * Drop unnecessary (and very broken) mutex * Rework the driver based on feedback to v1 * Fix some minor bugs and improve Automatic Input Current Limit support Caleb Connolly (2): power: supply: add Qualcomm PMI8998 SMB2 Charger driver dt-bindings: power: supply: qcom,pmi8998-charger: add bindings for smb2 driver .../power/supply/qcom,pmi8998-charger.yaml | 82 ++ drivers/power/supply/Kconfig | 16 + drivers/power/supply/Makefile | 1 + drivers/power/supply/qcom_pmi8998_charger.c | 1090 +++++++++++++++++ 4 files changed, 1189 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/qcom,pmi8998-charger.yaml create mode 100644 drivers/power/supply/qcom_pmi8998_charger.c -- 2.38.0