From: "Luca Weiss" <luca.weiss@fairphone.com>
To: "Casey Connolly" <casey.connolly@linaro.org>,
"Sebastian Reichel" <sre@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Bjorn Andersson" <andersson@kernel.org>,
"Konrad Dybcio" <konradybcio@kernel.org>,
"Kees Cook" <kees@kernel.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
"Bryan O'Donoghue" <bryan.odonoghue@linaro.org>
Cc: <linux-arm-msm@vger.kernel.org>, <linux-pm@vger.kernel.org>,
<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
"Sebastian Reichel" <sebastian.reichel@collabora.com>,
<linux-hardening@vger.kernel.org>
Subject: Re: [PATCH 09/11] power: supply: qcom_smbx: add smb5 support
Date: Fri, 20 Jun 2025 10:39:10 +0200 [thread overview]
Message-ID: <DAR846ZKJENY.KINMYGVYAY97@fairphone.com> (raw)
In-Reply-To: <20250619-smb2-smb5-support-v1-9-ac5dec51b6e1@linaro.org>
Hi Casey!
Adding a note here, I also plan to look into what (if any) changes are
necessary for this to work on PMI632 (which is the PMIC for
sdm632/msm8953 Fairphone 3) since that's also SMB5.
On Thu Jun 19, 2025 at 4:55 PM CEST, Casey Connolly wrote:
> Introduce support for the SMB5 charger found on pm8150b and other more
> modern Qualcomm SoCs.
>
> SMB5 is largely similar to SMB2, with a few register differences. The
> main difference is the new Type-C hardware block which some registers
> are moved to.
>
> Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
> ---
> drivers/power/supply/qcom_smbx.c | 367 +++++++++++++++++++++++++++++++++------
> 1 file changed, 314 insertions(+), 53 deletions(-)
<snip>
> +/* Bits 2:0 match PMI8998 TYPE_C_INTRPT_ENB_SOFTWARE_CTRL */
> +#define SMB5_TYPE_C_MODE_CFG 0x544
> +#define SMB5_EN_TRY_SNK_BIT BIT(4)
> +#define SMB5_EN_SNK_ONLY_BIT BIT(1)
> +
> +#define SMB5_TYPEC_TYPE_C_VCONN_CONTROL 0x546
> +#define SMB5_VCONN_EN_ORIENTATION_BIT BIT(2)
> +#define SMB5_VCONN_EN_VALUE_BIT BIT(1)
> +#define SMB5_VCONN_EN_SRC_BIT BIT(0)
> +
> +
> +#define SMB5_TYPE_C_DEBUG_ACCESS_SINK 0x54a
> +#define SMB5_TYPEC_DEBUG_ACCESS_SINK_MASK GENMASK(4, 0)
> +
> +#define SMB5_DEBUG_ACCESS_SRC_CFG 0x54C
> +#define SMB5_EN_UNORIENTED_DEBUG_ACCESS_SRC_BIT BIT(0)
> +
> +#define SMB5_TYPE_C_EXIT_STATE_CFG 0x550
> +#define SMB5_BYPASS_VSAFE0V_DURING_ROLE_SWAP_BIT BIT(3)
> +#define SMB5_SEL_SRC_UPPER_REF_BIT BIT(2)
> +#define SMB5_EXIT_SNK_BASED_ON_CC_BIT BIT(0)
<snip>
> /* Init sequence derived from vendor downstream driver */
> -static const struct smb_init_register smb_init_seq[] = {
> - { .addr = AICL_RERUN_TIME_CFG, .mask = AICL_RERUN_TIME_MASK, .val = 0 },
> +static const struct smb_init_register smb5_init_seq[] = {
> + { .addr = USBIN_CMD_IL, .mask = USBIN_SUSPEND_BIT, .val = 0 },
> + /*
> + * By default configure us as an upstream facing port
> + * FIXME: This will be handled by the type-c driver
> + */
> + { .addr = SMB5_TYPE_C_MODE_CFG,
> + .mask = SMB5_EN_TRY_SNK_BIT | SMB5_EN_SNK_ONLY_BIT,
> + .val = SMB5_EN_TRY_SNK_BIT },
Since there's already a driver for the Type-C in pm8150b and pm7250b,
can we remove this? Or is additional plumbing between the two drivers
necessary to make this work? Maybe Bryan can also jump in here.
Regards
Luca
> + { .addr = SMB5_TYPEC_TYPE_C_VCONN_CONTROL,
> + .mask = SMB5_VCONN_EN_ORIENTATION_BIT | SMB5_VCONN_EN_SRC_BIT |
> + SMB5_VCONN_EN_VALUE_BIT,
> + .val = SMB2_VCONN_EN_SRC_BIT },
> + { .addr = SMB5_DEBUG_ACCESS_SRC_CFG,
> + .mask = SMB5_EN_UNORIENTED_DEBUG_ACCESS_SRC_BIT,
> + .val = SMB5_EN_UNORIENTED_DEBUG_ACCESS_SRC_BIT },
> + { .addr = SMB5_TYPE_C_EXIT_STATE_CFG,
> + .mask = SMB5_SEL_SRC_UPPER_REF_BIT,
> + .val = SMB5_SEL_SRC_UPPER_REF_BIT },
> + /*
> + * Disable Type-C factory mode and stay in Attached.SRC state when VCONN
> + * over-current happens
> + */
> + { .addr = TYPE_C_CFG,
> + .mask = APSD_START_ON_CC_BIT,
> + .val = 0 },
> + { .addr = SMB5_TYPE_C_DEBUG_ACCESS_SINK,
> + .mask = SMB5_TYPEC_DEBUG_ACCESS_SINK_MASK,
> + .val = 0x17 },
next prev parent reply other threads:[~2025-06-20 8:39 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-19 14:55 [PATCH 00/11] power: supply: pmi8998 charger improvements and " Casey Connolly
2025-06-19 14:55 ` [PATCH 01/11] dt-bindings: power: supply: qcom,pmi89980-charger: add pm8150b and 7250b Casey Connolly
2025-06-27 19:40 ` Rob Herring (Arm)
2025-06-19 14:55 ` [PATCH 02/11] arm64: dts: qcom: sdm845-oneplus-*: set constant-charge-current-max-microamp Casey Connolly
2025-06-19 14:55 ` [PATCH 03/11] power: supply: qcom_pmi8998_charger: fix wakeirq Casey Connolly
2025-06-20 21:44 ` Dmitry Baryshkov
2025-06-19 14:55 ` [PATCH 04/11] power: supply: pmi8998_charger: rename to qcom_smbx Casey Connolly
2025-06-20 8:51 ` Luca Weiss
2025-06-19 14:55 ` [PATCH 05/11] power: supply: qcom_smbx: allow disabling charging Casey Connolly
2025-06-20 16:54 ` Konrad Dybcio
2025-06-22 19:13 ` Sebastian Reichel
2025-06-19 14:55 ` [PATCH 06/11] power: supply: qcom_smbx: respect battery charge-term-current-microamp Casey Connolly
2025-06-20 16:57 ` Konrad Dybcio
2025-06-22 18:28 ` Sebastian Reichel
2025-06-19 14:55 ` [PATCH 07/11] power: supply: qcom_smbx: bump up the max current Casey Connolly
2025-06-20 17:07 ` Konrad Dybcio
2025-06-19 14:55 ` [PATCH 08/11] power: supply: qcom_smbx: remove unused registers Casey Connolly
2025-06-19 14:55 ` [PATCH 09/11] power: supply: qcom_smbx: add smb5 support Casey Connolly
2025-06-20 3:32 ` kernel test robot
2025-06-20 8:39 ` Luca Weiss [this message]
2025-06-20 9:01 ` Luca Weiss
2025-06-24 1:06 ` Dmitry Baryshkov
2025-06-29 23:06 ` Caleb Connolly
2025-06-29 23:14 ` Dmitry Baryshkov
2025-06-19 14:55 ` [PATCH 10/11] MAINTAINERS: add myself as smbx charger driver maintainer Casey Connolly
2025-06-20 8:40 ` Luca Weiss
2025-06-19 14:55 ` [PATCH 11/11] power: supply: qcom_smbx: program aicl rerun time Casey Connolly
2025-06-20 17:00 ` Konrad Dybcio
2025-06-23 16:33 ` Casey Connolly
2025-06-23 16:40 ` Konrad Dybcio
2025-06-22 19:13 ` (subset) [PATCH 00/11] power: supply: pmi8998 charger improvements and smb5 support Sebastian Reichel
2025-08-24 2:55 ` Bjorn Andersson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DAR846ZKJENY.KINMYGVYAY97@fairphone.com \
--to=luca.weiss@fairphone.com \
--cc=andersson@kernel.org \
--cc=bryan.odonoghue@linaro.org \
--cc=casey.connolly@linaro.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gustavoars@kernel.org \
--cc=kees@kernel.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sebastian.reichel@collabora.com \
--cc=sre@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®