From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (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 5A2B72BEFEB for ; Thu, 11 Jun 2026 15:46:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781192800; cv=none; b=qVh4im6wrRvIEvwIGE5Agfs+5tHhZdWGtxpJeDuYmx3RgJrOY9hD2hoOPS08xoNtGzdiBl7V2kCHUnB3yH9ALvDdYMDQVj/wrQ4vkN2ekQSPVDnmhnHpdYHq/YbtPSdPRtCtIPbgv2waoQRS7kR4hvYA5Z0POzIa3S2O1DX79zg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781192800; c=relaxed/simple; bh=WNipn5B6YZaoTfJh3bnTSdI17jibbVqCUiKqjCpqgJA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=IJp9FTefcwdGCpy/wfpCTtRBsBCqoIAmNdR5JTL8Oq0Ok5/Y5YJlb+RgpNrzFajs0EGfEgq4zrISOGsvsEauuFr33wFBls+f2N7NK0DSTkIfiTh4jSQQ53hMC2J1xRPVrDfKv2xZvVV/9hQc2VkTWngif4Gojo+ybIxqF6AytzQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JINTmKY4; arc=none smtp.client-ip=209.85.208.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JINTmKY4" Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-396779b9a7fso30711fa.3 for ; Thu, 11 Jun 2026 08:46:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781192793; x=1781797593; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=BACib9xzyd8hNcjbUOLr6ul0t7pWy7f3Eby0dPET1dY=; b=JINTmKY4vf2dVYwyH+GxfAm6XeqZrG+g85Oih5WhTKxz+1C6Iqf0PFcdgI+hYRbXsF ZEQ2lZEHb9SB9UKXy30+1Lg7TElyPiE8qbv21VbH+oP0gZAmOU7QyPienEnRegLtFXEd d4uQWnoPVgGvYQQ6cPEdWvV3mwooXUG6AcgUQHmUO//qyHqxl5q6jV3alzauKDpslJMX Fl2jcPdbSSIdW2Ev98iXb8MUwAawtRvyAXuXRQ6mfKARZVJs9SwBUATO+V2A1cnipGE6 t8wN5Fh8BVhmRyiPGDCHs/jXxLrsWyYrowVRDwUelcDSsIzFmosTSK0gCMfXo64ueh3D uAvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781192793; x=1781797593; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=BACib9xzyd8hNcjbUOLr6ul0t7pWy7f3Eby0dPET1dY=; b=C8fmSIjTlcwuJGzV7tbyy+zFZbubgpw023ZDYXIZrJOygUXYV9Ar9uZUENbB+BP5U7 qkAWovvHwr5TZLGjZauBFDJ3b3I0jHKNg5LB3Rj7ADk9rB14G1D/vQIqLpyA6ZqIjhDK UePEwKS2krvFYwkWPmHeXjHMdv8ppOV4f6Drr5G9Mkxl0lo5tX2WQoPrENYN85lHKTHa yZ5/aQcNs20YP9pHCcCFUDJ7wxlseVf8V3jqaCn8Is+vsyioiJ6uhjbG0U5Q+Nsnrfi6 N5gxojL4k9gajYGT3UiOsONf5GQuX+vnY0MGeCA+YkSebYllNyfsEe15Okww7pdLFXA/ hQZw== X-Gm-Message-State: AOJu0Yz1rLz/U+RAnOvad9JacRGnPVIThHKKKM+rYFov8B9mmfniaDAl WSLmH0JWptwtFlPMNAbs1pzRMHo2XBRlc0jEtoKTqdUVqYDF9HnUoI6DbGljPsViO2i+ZJFO X-Gm-Gg: Acq92OEDL0+Z5buDZ8cuMnrtpYN3Q4cTI4kfO8+MnhPJG+V6xgkiJSNUfb36fYM429V frwtURx67w+rcHE/VWSxc/7VbFEkAg3axune7/C6mhF1hoOlLW8j/ldnwf3PYyP7YkaOizLFfJQ U+DqdBsJsPeIW3YjkrV7I0aZO61IeeHMUMFtX/etHvnCs+yPcPugvuNwKXllTTB6T8+vsb9WjUg aGVroc9eNWZOiDVuMymd01JcQ+MRggud5pFnUrsPWA1wmgi96fBwmAY43JKaTmO6Biq5ufEskTM yCr/7hjpQpgog/OGmU3P/4BdmJE1ZKXtRmHgfbXlXWhB00Bv57E/3ebxMQJNVE+9btzkrjxBtXM 2yTtwpkVWisaZ59JE3unJXehniaYkCyE5u2O3Pui6+MHXsAScpSRIeKzz9k71aLZ5UBnGDpmLBx Ilh5/ItshtNpoeWN/kYBUqTN4kJjD8orFb/qKhYkH7pMZ3/xXxwMhTwNhB/VDLH0jmESDdRpzyK a/cJETYRquC7UBwzOMoR2WMVzIhxTLeoKo= X-Received: by 2002:a05:6512:1301:b0:5aa:8822:c944 with SMTP id 2adb3069b0e04-5ad27fc4d59mr1028960e87.46.1781192792930; Thu, 11 Jun 2026 08:46:32 -0700 (PDT) Received: from localhost.localdomain ([132.243.226.16]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5aa7b8ed901sm6491078e87.10.2026.06.11.08.46.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 11 Jun 2026 08:46:32 -0700 (PDT) From: Oleg Proshkin To: Chen-Yu Tsai , Lee Jones Cc: linux-kernel@vger.kernel.org, Oleg Proshkin Subject: [PATCH] mfd: axp20x: preserve other control bits when powering off Date: Thu, 11 Jun 2026 18:46:29 +0300 Message-ID: <20260611154629.76607-1-oleg.pro171@gmail.com> X-Mailer: git-send-email 2.50.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit axp20x_power_off() triggers shutdown by writing AXP20X_OFF (BIT(7)) to the power-off control register with regmap_write(), which rewrites the whole register and clears other control bits in it. On the AXP221/AXP223 (and the register-compatible AXP228) - that register also holds the CHGLED auto-control bit. Clearing it during an orderly shutdown disables the hardware charge indicator, so the charge LED stays dark while the board is powered off and charging. Other variants keep unrelated configuration in the same register too. Set only the power-off bit with regmap_set_bits() and leave the rest of the register untouched. The shutdown register is readable on every variant, so the read-modify-write should be safe. Tested on a ClockworkPi uConsole (Raspberry Pi Compute Module 4, AXP228, which enumerates as AXP221): register AXP20X_OFF_CTRL reads 0x08 at runtime, so the old code left it 0x80 whereas setting only BIT(7) leaves 0x88. Writing 0x88 at power-off enables the charge LED while still powering off the PMIC. Signed-off-by: Oleg Proshkin --- drivers/mfd/axp20x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c index 679364189..50df66de2 100644 --- a/drivers/mfd/axp20x.c +++ b/drivers/mfd/axp20x.c @@ -1253,7 +1253,7 @@ static int axp20x_power_off(struct sys_off_data *data) break; } - regmap_write(axp20x->regmap, shutdown_reg, AXP20X_OFF); + regmap_set_bits(axp20x->regmap, shutdown_reg, AXP20X_OFF); /* Give capacitors etc. time to drain to avoid kernel panic msg. */ mdelay(500); -- 2.50.1 (Apple Git-155)