From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 E544E3A3803 for ; Wed, 29 Apr 2026 08:05:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777449937; cv=none; b=rAFhAkR3au0GzkYsUE7eAM7XsRwY5fRFsgwdJ+i2uYr/2scnVbVJ2YtoHoQpoP9cNaauJd8dyd5DZpa5D/7oCFMC9fGzhTeijlrwkg/3uUgRkARa5EVqjn9elkVz+gdBDhLn/om5+Lx6AbL6J/SVY3SgZh42wYj471uF4D6gGUY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777449937; c=relaxed/simple; bh=9XhvGoYNbmK0EgkkbPli+CfIauASFOZG3mAHX+GE4U0=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=D+h3/lw/6nJ5WZNEuGKwa3FKafo5yCWubq7OVFDwdtw+k8qbCARVmNLGx9A9paP5f0rfcuiiQ9/qPgtGmHH5BN/2HzyEDBQxQKV4w8oIPb05Ay29CHV7TVEDDWvkOA0NaVorOF2vAYYMoF3hWiBx65gEBpydoVToebG/Nyeh6fU= 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=YC5IeAIn; arc=none smtp.client-ip=209.85.128.48 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="YC5IeAIn" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4852b81c73aso101384735e9.3 for ; Wed, 29 Apr 2026 01:05:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777449934; x=1778054734; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:references:cc:to:subject:reply-to:from:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=f2WkYe4QLm9iINjlo8ZfDPBqpnaOA/qNSmZLtkgGRZA=; b=YC5IeAIn/RS1+GtZ+ETIapFxRa7Gj7FJbGNp0rSJhdRxlRh//JZnEJ7rcL52nBLqcJ GdPQBa5WN5udMQdwJ6+xPFGiAiMfaTRB0TpBLAqrgucN3/gsKwnre0X9JtisqewUfqrq 7xKWUQZr2pZQ9AcEm35U+b9vR55kfTr7rbZK8cgFmAjMG940Qa3HYa3aBV8iWq9V/vQa y6vE0jfHQHKe+voVG9d9AiKI0U1F6xvPLRc6kT2dXalPR8ejigKqCfIELASz9I0Lj0F9 k33+Z+MHMuLuI/xvzFVCVI+Q1teVUf9ngjGi3P3v+H1vD6LrRiFKGvSLZHOuFokmh6Q+ VMqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777449934; x=1778054734; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:references:cc:to:subject:reply-to:from:user-agent :mime-version:date:message-id:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=f2WkYe4QLm9iINjlo8ZfDPBqpnaOA/qNSmZLtkgGRZA=; b=NDfVL2hltfnrDU86je+GYF+59L4HMwCXDsq2i7UCyTrOF8sdVl2bkjQkswstlMy+Qr RQ6ttCmOWkj1aGD+9kySlD0gXft0uKEuXVKJqOkF1tkQrtvNaEtxfMFRoejtkAzFDubO HdAdALnwnCxrCo0TyZsqWnx/yX6oOLImjldjYUuex5uCBRPiV6P5moAjH+JaDGGRrXX7 rMGK2glSLaDwl7351mH649eUOb72yAyPEv1ELD1KxsfhA5YlCYFyi697iG8LrubnCHJe TqG4BE0r3I6c6Z0uBrYlDQcUJyikkV1uMk6zlWeQVqNmJrrheS2GZH1b58NIKu0c3UFY NOHg== X-Forwarded-Encrypted: i=1; AFNElJ9IBhGDBrwLYW7tFpcg7FAxaSgNgHfTWRQuUz6wnz2y4iUI0isU+acCncpTypDHSVnPr9fnqKTGT8dd+nE=@vger.kernel.org X-Gm-Message-State: AOJu0YyFTMicCXoG0c/6m2EeVryu/gwb2v5legxu+LJPBRIPniHDV8yP BOMW4g7WEw6i5JwjpqUnbIgsMw+qBnTg0hRTlxLXTwNWiX4PaQFgqWCvEWqVz248+eo= X-Gm-Gg: AeBDies6jRA5Y86h7yxIgS8GtO7QAy+atFQEwsBEvQR4id9AYs9vrn2DVd89n3/1puu 5ZzfMIN3ff2pLp8kXYx/4DWpkx9uaGUY+Q7/P/vmLhbBBlPfW+wzuIZ3QoOX1ZVdXJsL4pPoiTp MtGx8/i8gINsFSS9SlzEw+/yu6bwD+LHvjjmjvsHnYf976P2UV8HE/WSSM+exWZN+x2+RD0kZi4 ORueGlN6Y8omO4zrzT2H94zY192VW6voFHJTNIz43fiV8PGTgqjn0rdjxvVwzIwLCdYfid892h/ hEN7/7+9ziBe6zmrSn2WQd0RcihGfKTwTR99GB/tkf7sDd5gi3ge+bkEaALhwTiMDTxZrcDqiMn +8YHDT/uCf3bv6rd6l3MNgcqLFC6P2r6rhhIPCm2hFv5pLae9wYGrqdNnxuog/uDdE29/NZGP2G tlR8covROIvfRPhnpPVywLE8XbhRkss3TpMezafMV+7l7XMX9zRrEhZTQ2+MIJAQtrm3Q5+Dchu 3WxoKA2A+MyoQlbvIRAbQaO8nJ9 X-Received: by 2002:a05:600c:8582:b0:485:3abe:ab86 with SMTP id 5b1f17b1804b1-48a77af3ddamr71269855e9.4.1777449934157; Wed, 29 Apr 2026 01:05:34 -0700 (PDT) Received: from ?IPV6:2a01:e0a:106d:1080:b679:2e1c:a552:545b? ([2a01:e0a:106d:1080:b679:2e1c:a552:545b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b7217b20sm3884982f8f.22.2026.04.29.01.05.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Apr 2026 01:05:33 -0700 (PDT) Message-ID: <7d2fd0d7-2ac2-43d8-be5c-4f9fcd7908bb@linaro.org> Date: Wed, 29 Apr 2026 10:05:33 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Neil Armstrong Reply-To: Neil Armstrong Subject: Re: [PATCH 2/2] regulator: add SGM3804 Dual Output driver To: Mark Brown Cc: Liam Girdwood , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, KancyJoe References: <20260428-topic-sm8650-ayaneo-pocket-s2-sgm3804-v1-0-1d8dc7620256@linaro.org> <20260428-topic-sm8650-ayaneo-pocket-s2-sgm3804-v1-2-1d8dc7620256@linaro.org> Content-Language: en-US, fr Autocrypt: addr=neil.armstrong@linaro.org; keydata= xsBNBE1ZBs8BCAD78xVLsXPwV/2qQx2FaO/7mhWL0Qodw8UcQJnkrWmgTFRobtTWxuRx8WWP GTjuhvbleoQ5Cxjr+v+1ARGCH46MxFP5DwauzPekwJUD5QKZlaw/bURTLmS2id5wWi3lqVH4 BVF2WzvGyyeV1o4RTCYDnZ9VLLylJ9bneEaIs/7cjCEbipGGFlfIML3sfqnIvMAxIMZrvcl9 qPV2k+KQ7q+aXavU5W+yLNn7QtXUB530Zlk/d2ETgzQ5FLYYnUDAaRl+8JUTjc0CNOTpCeik 80TZcE6f8M76Xa6yU8VcNko94Ck7iB4vj70q76P/J7kt98hklrr85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b6a12opuRP7yo3E3gTCS KmbUuLv1CtxKQF+fUV1cVaTPMyT25Od+RC1K+iOR0F54oUJvJeq7fUzbn/KdlhA8XPGzwGRy 4zcsPWvwnXgfe5tk680fEKZVwOZKIEuJC3v+/yZpQzDvGYJvbyix0lHnrCzq43WefRHI5XTT QbM0WUIBIcGmq38+OgUsMYu4NzLu7uZFAcmp6h8g Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/29/26 02:37, Mark Brown wrote: > On Tue, Apr 28, 2026 at 03:52:06PM +0200, Neil Armstrong wrote: >> From: KancyJoe >> >> >> Signed-off-by: Neil Armstrong >> Signed-off-by: KancyJoe > > Your signoff should appear at the bottom of the list here. Right > >> @@ -0,0 +1,280 @@ >> +// SPDX-License-Identifier: GPL-2.0-only >> +/* >> + * SGMicro SGM3804 regulator Driver >> + * >> + * Copyright (C) 2025 Kancy Joe >> + * Copyright (C) 2026 Linaro Limited >> + * Author: Neil Armstrong >> + */ > > Please make the entire comment a C++ one so things look more > intentional. The authorship overall appears a bit confused? Sorry, what's confusing here ? > >> +/* >> + * The registers are only writable when the gpio is enabled, so we >> + * can't use the regulator regmap helpers & internal gpio handling >> + * so we need to track the state and apply the state at enable time. >> + */ >> +struct sgm3804_data { >> + struct regmap *regmap; >> + bool active_discharge[SGM3804_RAIL_COUNT]; >> + unsigned int sel[SGM3804_RAIL_COUNT]; >> + struct gpio_desc *gpios[SGM3804_RAIL_COUNT]; >> +}; > >> +static int sgm3804_enable(struct regulator_dev *rdev) >> +{ > >> + ret = regmap_write(ctx->regmap, rdev->desc->vsel_reg, >> + ctx->sel[rdev_get_id(rdev)]); >> + if (ret) >> + goto err; >> + >> + ret = regulator_set_active_discharge_regmap(rdev, >> + ctx->active_discharge[rdev_get_id(rdev)]); > > It seems like this should be a regcache sync then only the enable and > disable operations need to be custom? There is a register cache and it > covers these registers, without it the _active_discharge wouldn't work > since it does a regmap_update_bits() and all the registers are marked > unreadable. I added regcache defaults with the default hardware values so it uses the cache default to do regmap_update_bits(), and yes none registers can be read so it uses the cache. > >> +MODULE_DESCRIPTION("SGMicro SGM3804 regulator Driver"); >> +MODULE_AUTHOR("Kancy Joe "); >> +MODULE_LICENSE("GPL"); > > More author information here not looking joined up. I'll add my entry. Neil