Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp4550454rwb; Mon, 8 Aug 2022 03:07:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR7jdNJC7EOPpD6R5mvb061n+tlKq94bZESgt4mDf4hg0Z5daSZ4evrA7yW38vRz2/vp5Fgq X-Received: by 2002:a17:907:3e81:b0:726:9615:d14d with SMTP id hs1-20020a1709073e8100b007269615d14dmr13191234ejc.517.1659953246084; Mon, 08 Aug 2022 03:07:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659953246; cv=none; d=google.com; s=arc-20160816; b=eKcMxqxLXX6OlEcIeVamWq+saONkKPnJIib09dHG5ePAk9oR2FbuCfTcSiY5v/TPQn Tg1gsgd3g3ql6kB0hcqsKcs72k5DT12rnm8nQBHi6syQ1731qRb51ATFHXGeNcYT+pJC rMTcJBF38P0TRudYY8ka5/OqJexhXQunfGDoyJXNzVHG4IW1OnPtyxnJvbHMaYbG/Zuk bZQ/9D6/PYyxm3oKVi7RNaynvqD7zccAZKC/ENNGoM+Y2kHPIxtCxc1C369QMRIy+Lop RcDyjIaMBaJ6VGif5plmWUJ/DpWgYlW0cIt2AWCSYERui3wV08mqFiDg6qULLQihaqdf QyJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :cc:to:subject:from:date:dkim-signature; bh=E3bObQeNWfAS5QLgPfg7sUMtK4GVNOyK0s/0eKslo1E=; b=SBHy2NcnhmI2aW8GB+54B3eoByW9d9tfrkPrjPV3kPuA2oMKORbVA2YB6jTqct4feN wInmN8/u/25KpQ+coF2HK1nr/ObCQnwCdnWuTQX/cXu95MRyT0kDhfipQm8ImHs/1xXk ZkZ1i9SFsnNKUOy2KgK3z6ufDvY3zxOpLubySwxFs3CfH9Q+RB3z4uYB20oGNqV8Ha1I VhiBEACj8o91mwdSIxWoC35K/jNQyb5eKlYzBjLJK/niAjIf3wNkrn4ZITz4uQkZfvFQ ryzPHtCCa2W8tjeUKppVPSnDo7QKVp6NWOPe/OlOESniIYaALowaBurn/DGcqWZ2guMC UbUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=n4xUNwYQ; 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 jg21-20020a170907971500b00722f48fa044si5961326ejc.192.2022.08.08.03.07.00; Mon, 08 Aug 2022 03:07:26 -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=n4xUNwYQ; 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 S242074AbiHHJkM (ORCPT + 99 others); Mon, 8 Aug 2022 05:40:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232190AbiHHJkL (ORCPT ); Mon, 8 Aug 2022 05:40:11 -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 4C1D513D5B; Mon, 8 Aug 2022 02:40:10 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id v5so4524073wmj.0; Mon, 08 Aug 2022 02:40:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:message-id:cc:to:subject:from :date:from:to:cc; bh=E3bObQeNWfAS5QLgPfg7sUMtK4GVNOyK0s/0eKslo1E=; b=n4xUNwYQrBnm7yU1iGLZpKf4avwTo8LzGpGAFml+IcMOCih7ZytxcIj9i12FoTpbfb WmSv0fBhNWf99Ds83zZpeHzXoq+lR7ADgY4GVgMQHrTdlIeueoc6V7uIjfnvWdNrhibY G6lqnpTzuOb7h7Yjs2jryiol0LrYnS99GndSFqzE8eTQrqFUbSq3ZdS5tLZ5+j9j+l/X FjZgcy/qWFxw1RzKasEYON1VI+W9MmW77utx3YtqVea75CKjEiUCU1XdkfPI5QRmojWh uB1GxDQLxnlB0PqsZebMAvLZiZ+E7PORCaJhDzYHzdCgMZVYITpi8qNRTXTL+MOf8R+c +6NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:references:in-reply-to:message-id:cc:to:subject:from :date:x-gm-message-state:from:to:cc; bh=E3bObQeNWfAS5QLgPfg7sUMtK4GVNOyK0s/0eKslo1E=; b=RtT/UdKGDwR1t4djcbAZ3Qwv+VLYIn/djrfsQ//JFv3T06sh9FdZMfBP6UedNJ2MZE Qbws6lal1lNpOpiJabLqf7P2+3L9bsM0oZloTJf+jHTPDUvB6gF1zByTxpoGpNP68sVm c0e7AclDzctUIZdJoYjAEkNYAy2zbYxs1ll0K1CArFFj8Ep8ym4q2aOGj/6EEUPXAzvv ctJb1DZyEfRZoujetT4vblL8NpKyH20W5UKNioRh/alITeasmAgDx6radVyU/BjVd5UW 5YCfhyGToMIcDwr4MUgMtPKzQEhSncPO+2928pbOEUwVfPlhH94hd8yzE422G80I1jCl l8uQ== X-Gm-Message-State: ACgBeo3fmOKYsg7zrxcRfOBZ79oZj9JehOxciOEJ3RE2tMgQkIKxn4fJ UfYjT3XsmDcbK73XGCIgVuWlZbPHrdE= X-Received: by 2002:a05:600c:509:b0:3a5:2c2:fb40 with SMTP id i9-20020a05600c050900b003a502c2fb40mr15355763wmc.163.1659951608773; Mon, 08 Aug 2022 02:40:08 -0700 (PDT) Received: from [192.168.187.232] ([105.235.133.28]) by smtp.gmail.com with ESMTPSA id o6-20020a05600c4fc600b003a32490c95dsm18724131wmq.35.2022.08.08.02.39.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Aug 2022 02:40:08 -0700 (PDT) Date: Mon, 08 Aug 2022 10:39:47 +0100 From: Yassine Oudjana Subject: Re: [PATCH 0/8] power: supply: Add driver for Qualcomm SMBCHG To: Krzysztof Kozlowski Cc: Sebastian Reichel , Rob Herring , Krzysztof Kozlowski , Andy Gross , Bjorn Andersson , Caleb Connolly , 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 Message-Id: In-Reply-To: References: <20220808073459.396278-1-y.oudjana@protonmail.com> X-Mailer: geary/40.0 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed 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 On Mon, Aug 8 2022 at 11:41:26 +03:00:00, Krzysztof Kozlowski wrote: > On 08/08/2022 10:34, Yassine Oudjana wrote: >> 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/ > > How is it different from PMI8998? I expect not that much, so this > should > be based on existing work: > https://lore.kernel.org/linux-arm-msm/20220706194125.1861256-1-caleb.connolly@linaro.org/ > > Unless they are different, but then please create common parts and > explain the differences. > > Best regards, > Krzysztof This driver has been in slow developement for a long time before that one existed, which was why no initial attempt at a common driver was made. With that said however, I've been watching its development even before it was sent for review, and It seems that the hardware is actually quite different. For example, the original charger entirely lacks the type-c functionality that exists on the second gen one. There are a couple of similar registers like CMD_APSD (same address and function) CHGR_CFG2 (same/similar function, different address), but other than that there don't seem to be any major similarities. While I guess it would technically be possible to force them into one driver with multiple register tables and separate functions for most tasks, I think it would just unnecessarily complicate things. One thing that is common however is the secure register unlock sequence, which I have separated in patch 6 to allow for its use in other drivers (the fuel gauge block has secure registers too so it will also be used in an upcoming fuel gauge driver).