From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 DFD2937F8B2 for ; Wed, 29 Apr 2026 08:05:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777449938; cv=none; b=NAS/59d2QFPipcRWyuHRtqJtosmn3RllXEKcZx61LUJPm4BUwNCCqi+KIfLjQfQLWXd5477AEMOAgoGWzODmAPbTj2h70X4ZdDIF+RoIRbhv+I9SoMSv7fEACzdoyxcXmwmuz7t/JYuo2jz6G7ocGQAa8/wQBGVL47MUTiIx7qs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777449938; c=relaxed/simple; bh=9XhvGoYNbmK0EgkkbPli+CfIauASFOZG3mAHX+GE4U0=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=e5BghqMCh+yZ4eY8N0tg8P8aSy6D/QxQjDoq0SAy0FDG9lExBDFFw2L/FgbwjHPjEONePWLBQYhqv4XJQS3gX98Szb0oxALvG7CwawSfNb/euddGVlAF5FcyDeyIbDtFSM1Vlu249i1viQ4wuBfaoYOf+v+Kco+DoPd4DaLAuY0= 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.42 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-f42.google.com with SMTP id 5b1f17b1804b1-4852a9c6309so111134985e9.0 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=JkAxdH1PBbqCkXhj9YA6dcYxQ/vzZSwbm5Z3ys3+702rKxSW3ZyhE/wB6RBJL1QMBx 6mF+EnykOmm9Vn6HSjl3xS4rwBVdKM2tyCeLUBeDkuhq8f8qPOxKJ/G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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: devicetree@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 80TZcE6f8M76Xa6yU8VcN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O9umRef8V82o2oaCLvf4WeIssFjwB0b6a12opuRP7yo3E3gTCS 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