From patchwork Thu Jun 19 14:55:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Casey Connolly X-Patchwork-Id: 898038 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC91628C869 for ; Thu, 19 Jun 2025 14:55:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750344931; cv=none; b=UU6TXSiupl5eFVBO19Al7z5YUhBcikgxDCSl45PLdYIDJmJbz3JJhboC10RgqaoP5gSmw1ZjwC16U2xxBaQIfUxxlUHpBadIOaNphutL7Khcq2R1X6AAy+T5nkwWUCY9Lky2E2ERwH4mFFNurqQ6fd3q5sD7zpMoATsUOvELMyk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750344931; c=relaxed/simple; bh=4C4/BzYVvqykLCWqBbtexksZlDrp0KmcIoZ0MxhlLow=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aC/btg0ncIRa+PG1QsJHNOVszY9nLwM1L3gndG11UdGESlPBpQfm5rGutZOSHevr28r1XsvESaNdTRxdbh7Ro1K6Ylci0/PNnUl3dBb2wQEyztgYz/D7GwDZqdZCJxI8ziBRRJSxtc5C/bEp01gX/s8/wGrNkpmRfbksffVa3Y4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=n5NbvsIW; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="n5NbvsIW" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-3a54690d369so882793f8f.3 for ; Thu, 19 Jun 2025 07:55:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1750344927; x=1750949727; darn=vger.kernel.org; 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=uiY+DVkF0Tx7wXnhclKSYzhcL2ot81tRcGxMxTU/GtI=; b=n5NbvsIWZM5mNmIcMxSGObHD4oh/+gSoVWheGopgdWuJXJM8a8YG9YCISaLYypmqYo NmBMjnWFzU6LfSv2R5f65UljTyLoqEHddG2CFmaj+iXt9oSQW4Cdi54l599H8GIP9Pe0 b0gJNvI5ANTlTZvClbXjzKfpcnGUNEq/zepfHDSWKkajV9v9UXouc3yfHTUL4A66aT7w Gs7DY5c+JNtqSVVgTsJlhFmk0RblKTFAQC1R6jMEL76tIZ6d0UAxslSj2U44xqd3j3BT /ycPkxWGFN3Fd9MjsodMRG9L/Bb4lxOQ7rXk/mYGIB8TLSwr7QMKrkawqImOo3oId/ib hQbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750344927; x=1750949727; 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=uiY+DVkF0Tx7wXnhclKSYzhcL2ot81tRcGxMxTU/GtI=; b=DVrSHDa6Wiy0XwZNOJFNRAFyywdhdJaj6XkClFPLRAHnf03EARKqWDCk29Jse2QQGF t9cYkvp78E/l6WwZemPN9aFRO+OCiWzFmWN1MyqI6vDhYjwxBZIvN6bW0UjW9nN1Kz71 NfKxzx97kxl2G3NDKF5K99JjcKnqc1BxubpK+EJKbn5wewkw6TX4XNtJgk9ijJmd+Bg+ 4dc0WGrW8KSJOewkWQKBHNX0R+ukUVsKZsKj+VyB16oF+/cJAxhHqNoP6K6xznocoSqa 9q9Uf3SefBPzM5e/p0afhgrgwBevVLEN1No4QybVQujI0mOwlW40sTr6PJ41YH9eNIKG Apsw== X-Gm-Message-State: AOJu0YxWxGz04EheoqBXviTBTV2IXk4K1V+wHoO1lJB4oOfoZNeV/3pD P0CRwVLGLZ6frhOc9dLeOrUN0F/7dfUbCIhokkWO+w4TSktnoCbxOKNqZOk81lehEuQ= X-Gm-Gg: ASbGnct2ZxbQPPHoXr63MUjZE0aGMiuoKxkaZ8mq+bZcG53rtBQgx4z/mAWyoN4jhwG T9pfnARCEnCN/odH2D+ds2iZKRe5zKlBcopcM+9q0/H68TrXAj8C0Y6GKrNKKeHt9OzpLdnUWB2 o6UV7edCbh1NpXk09q8AWQKgG8PEoWwFJHzPydPmk5S7QDQLSKhfpgyYJ1fwIUTWvYtIEKGrULd K6L/e5qXvAEn4mtgWCsj0eErfbWIv4dx2CG4tl2xC5nduYNzZKTvAAgARxIhA2pvlo976BrJdWV F/7+4GlRA5GKcCLy/StLIPJtUMQtuQwIGcJ32BAw7BZv8RfE8H0+zTjQRgz1fuWegalVkiv4pav dn4EKHrNq+oE= X-Google-Smtp-Source: AGHT+IGgc5GkhPO/vj3LU4YDmcm6Dit5qWlLwjFG7XrsUFfqD8cTmVzqG/+/ie6nUOAJEDHqELYGwQ== X-Received: by 2002:a05:6000:2c13:b0:3a4:ef36:1f4d with SMTP id ffacd0b85a97d-3a5723a4c09mr18760617f8f.38.1750344926745; Thu, 19 Jun 2025 07:55:26 -0700 (PDT) Received: from toyger.tail248178.ts.net ([2a0e:c5c1:0:100:b058:b8f5:b561:423c]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4535ebced8asm31343715e9.40.2025.06.19.07.55.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Jun 2025 07:55:26 -0700 (PDT) From: Casey Connolly Date: Thu, 19 Jun 2025 16:55:15 +0200 Subject: [PATCH 07/11] power: supply: qcom_smbx: bump up the max current Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250619-smb2-smb5-support-v1-7-ac5dec51b6e1@linaro.org> References: <20250619-smb2-smb5-support-v1-0-ac5dec51b6e1@linaro.org> In-Reply-To: <20250619-smb2-smb5-support-v1-0-ac5dec51b6e1@linaro.org> To: Sebastian Reichel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio , Kees Cook , "Gustavo A. R. Silva" Cc: linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Sebastian Reichel , linux-hardening@vger.kernel.org, Casey Connolly X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2386; i=casey.connolly@linaro.org; h=from:subject:message-id; bh=4C4/BzYVvqykLCWqBbtexksZlDrp0KmcIoZ0MxhlLow=; b=owEBbQKS/ZANAwAKAQWDMSsZX2S2AcsmYgBoVCTR74CQMAmQ7VTKPiBk6x+W6w8QNhr/qM/SB 9TbzQLsqpeJAjMEAAEKAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCaFQk0QAKCRAFgzErGV9k tjg4D/49MaTCqWbRpdaxNKlfjLtTNMq6C9Bn1so6q9lsEIryZcn2Ooc0TMkBNln+4horde0iNNJ X2/ofIrJou53ToJo3p8nVgcm3F1V7K1kiEJhuaoAWV0huFC0R4EOn5MGZq4Ezs9o9uz5XiP6kQx 30i6f1fp0lsK1b9qFAP1JZGD3T2NYJOxNc8XhC5EOk03Rc/dHZZSgP+R8MLtTMo6kMCH4HevBg0 QJZICJVFDAZcDJ+bDGgRLEf9ra7byCHf0xJpavDa0tGQzbCJ41HvLZBRe75gm23DF3vNEtrRcXh 1RGcDK4tSecPLWogN9JP5uhg+791eX4EO3JatzB3IMRdqoBRqvuaTH0PHhUfDcdhxF32Jo7hBvU O59D+1xqoZZXiuu0HNJvYeAj7uqXIMzrvyRcTLBsw+49l63f6CAoj9tQ6l7TE+poi3X54VfrrVo 50EIra7sk997D/cIaGfbrwA6DFvQfCCqDiufIl9ZIN43wPHH9I6Zbc9RhoWaiUaOZ4yZsFkrWoJ fs5cytgISNmqKCoPkcbYPTr5vNxwNc3YbNmO3dm9bWtiBVWof9hhTZWSwuPYIde2Gnhd3C9Fp3c 8miD0OTi7H6GIaYNv6++MWsbUn3bHavXZ2wKR7kw8Es65a6jPDAgFo2eKcfWYeLDPiP9LF0SPT3 U0dZAP3PMslLCNQ== X-Developer-Key: i=casey.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 I set a super conservative current limit since we lack many of the safety features (thermal monitoring, etc) that these drivers really need. However now we have a better understanding of the hardware, it's fine to bump this limit up a bit, devices can additionally set the max current via devicetree instead. Since this is common to smb2 and smb5, move this write out of the init sequence and into probe proper. Signed-off-by: Casey Connolly --- drivers/power/supply/qcom_smbx.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/power/supply/qcom_smbx.c b/drivers/power/supply/qcom_smbx.c index 7fc232fa7260a7422ac12a48686cd7d396edd9a4..d1607674d291d6ef5762d35acd3330e2116f41a3 100644 --- a/drivers/power/supply/qcom_smbx.c +++ b/drivers/power/supply/qcom_smbx.c @@ -875,16 +875,8 @@ static const struct smb_init_register smb_init_seq[] = { */ { .addr = PRE_CHARGE_CURRENT_CFG, .mask = PRE_CHARGE_CURRENT_SETTING_MASK, .val = 500000 / CURRENT_SCALE_FACTOR }, - /* - * This overrides all of the current limit options exposed to userspace - * and prevents the device from pulling more than ~1A. This is done - * to minimise potential fire hazard risks. - */ - { .addr = FAST_CHARGE_CURRENT_CFG, - .mask = FAST_CHARGE_CURRENT_SETTING_MASK, - .val = 1000000 / CURRENT_SCALE_FACTOR }, }; static int smb_init_hw(struct smb_chip *chip) { @@ -1029,8 +1021,22 @@ static int smb_probe(struct platform_device *pdev) return dev_err_probe(chip->dev, rc, "Couldn't set wake irq\n"); platform_set_drvdata(pdev, chip); + /* + * This overrides all of the other current limits and is expected + * to be used for setting limits based on temperature. We set some + * relatively safe default value while still allowing a comfortably + * fast charging rate. Once temperature monitoring is hooked up we + * would expect this to be changed dynamically based on temperature + * reporting. + */ + rc = regmap_write(chip->regmap, chip->base + FAST_CHARGE_CURRENT_CFG, + 1950000 / CURRENT_SCALE_FACTOR); + if (rc < 0) + return dev_err_probe(chip->dev, rc, + "Couldn't write fast charge current cfg"); + /* Initialise charger state */ schedule_delayed_work(&chip->status_change_work, 0); return 0;