Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp459139rdb; Thu, 21 Dec 2023 14:42:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IHW1DW/DB8lyZk3bask3T/ODS0XVQY1nvsMiSiRUgPamGu7yd5CLqPV6/n/TGVSpNzoWQYe X-Received: by 2002:a05:6512:32ba:b0:50e:6943:ad03 with SMTP id q26-20020a05651232ba00b0050e6943ad03mr50975lfe.79.1703198570580; Thu, 21 Dec 2023 14:42:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703198570; cv=none; d=google.com; s=arc-20160816; b=gNaR/eUkInsngCzKahuqx0lx2Fo6OjPhJ7eXbXqSlqiKlGj0mC+1DysJBp8E6OUqbq XxMprNFidXFt0O880UerMC8xrWKEykEL9Q4r5f/mDn5qRDxOCq4qd9zK+uSakI1VPt02 vYiP/3Drk7roRJPf+mctkLPJPoFpl74pP2BKbDXZw9yVZ79izct6hcqPxUUxbmVQ0sEn DrsTkFZgnGs3uTieiFtJ13f+KBH0TmoMYXQ4rHQg887aKlfZsGx0zHEGUI92RGJMLr2n I2X/UU7RPzjCxduzK9VkWqC40XJi5nElw5vzrzrqjruiedPfK/rL4PwUrUovCULoOMo/ 0Y9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=tTQxlQCO+Gf4xIjXRg1HmFnmLBOGQYr6tXPcOA6WFzY=; fh=7O7dUBCS6kCRSlJIc+vM5dHuJLI5wHOi1j1KzQPDJqM=; b=F0//0ePB66I7exkFPLw2Q+xpQDXw+MAW/tuXiJg5PUAA9sqtQx5IF7iQcAqAkyDUWw kuy1VhWlyuK9y4rdDpHLuTinRT9C34woaySvLUIDp4giPHKxynLeT4Jz+lXDix9Xe60o FuoXRG6/2B0SY74A963Ne9XiixHa4jT7hg6A1A6Cem8d+yMHD/nxszdVMsx0XZ4XPVX1 tc4ePTdRefwUlBA73WT+nk8oGhjRBK1zqKYS6DkfAvcruIu1BMpr7mOdk/8rISoKu7Ju jDpcJX9nMoiZGxodUcDIa/9JgqD5d33sDEdjwVGshlsKC/lYuX4r9DL1RbKklWmvlvdA 9Mmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20230601 header.b=V9OQJ3re; spf=pass (google.com: domain of linux-kernel+bounces-9137-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9137-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id m13-20020a056402510d00b00553b47279b0si1213271edd.220.2023.12.21.14.42.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 14:42:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9137-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@googlemail.com header.s=20230601 header.b=V9OQJ3re; spf=pass (google.com: domain of linux-kernel+bounces-9137-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9137-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4C4D91F22F90 for ; Thu, 21 Dec 2023 22:42:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5234A78E64; Thu, 21 Dec 2023 22:42:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b="V9OQJ3re" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) (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 42319171B3; Thu, 21 Dec 2023 22:42:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=googlemail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=googlemail.com Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-5cdbc4334edso752495a12.3; Thu, 21 Dec 2023 14:42:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20230601; t=1703198560; x=1703803360; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=tTQxlQCO+Gf4xIjXRg1HmFnmLBOGQYr6tXPcOA6WFzY=; b=V9OQJ3re3DqiIsjQ+5hLvKh4opDB4rUQlM6ZA29D5PswtsgDejZZ++B5tLHNYaFbVu xWG2kPntJ28gm7HgjL+5VHa7cCoDkWznuw5eA6kvrjsftKOLnIf71Hz2hlBYeGiC3VIz ncr9wRg/nU8MBosbPDZOiU/FnTiGJzgDXc0yEx7olsk567BtEPwt5hAU1sJcQPUk99G0 Fn358Cp0UbeMC+ROklJtW8JA15Si6+wLPUJVJxxWit2HbCGxCG/1lLMTVADYiUhZoF7f StYLBRq/6t1O3cIx8p8SpOynxQeWoJi6PQcizcAypUW6XEGhjrxMdEoWsRseRbcuISqN zleg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703198560; x=1703803360; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tTQxlQCO+Gf4xIjXRg1HmFnmLBOGQYr6tXPcOA6WFzY=; b=n6fD9cmMoQtkYkl2mf1TrpsEwjmjveb5je3F05oN2/4ceAiEJXhQeoTAzReB76z318 o5wmpu2Huog0CFOl73LqJlOtCprnaU5Jp/DXEzZj3LRN99M4ya16BjIiZWG6K/6k7hRK auV0GWD9nEgCMqp3QITVstNQyOpvN2igDiAvyLX3ytJuuacInntsmt/OmbT5vXaQIcO3 PN38Bh9tzFchWo2zbl6P51otxdkPQtjwXUrL4tUjJUf84XUbT3ePRV/b/g9rPoB80+N3 W4HhAWZb5CoWVoNoSbCxdbPGhPPPMfP1a8XgAWd6CP5GGeKxUeHIR3TVCq8vO/e5taCJ W/Gg== X-Gm-Message-State: AOJu0Yz0sKrsfUeajiqama168l0bjO3bP1HIcsYbk1rfg5cDMdGxjKun Z67bgYNSQPP9hnaSJKykqQPXKKQx7R59Qh5H/68= X-Received: by 2002:a05:6a20:8b04:b0:18f:97c:8261 with SMTP id l4-20020a056a208b0400b0018f097c8261mr338231pzh.107.1703198560349; Thu, 21 Dec 2023 14:42:40 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231221211222.1380658-1-martin.blumenstingl@googlemail.com> <0c99b575-5cf2-4bd6-8cfd-af19f5fd58da@sirena.org.uk> In-Reply-To: <0c99b575-5cf2-4bd6-8cfd-af19f5fd58da@sirena.org.uk> From: Martin Blumenstingl Date: Thu, 21 Dec 2023 23:42:29 +0100 Message-ID: Subject: Re: [RFC PATCH v1] regulator: pwm-regulator: Fix continuous get_voltage for disabled PWM To: Mark Brown Cc: lgirdwood@gmail.com, =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , linux-pwm@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, Thierry Reding , Heiner Kallweit , Dmitry Rokosov Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Mark, On Thu, Dec 21, 2023 at 10:45=E2=80=AFPM Mark Brown wr= ote: > > On Thu, Dec 21, 2023 at 10:12:22PM +0100, Martin Blumenstingl wrote: > > > It turns out that at least some bootloader versions are keeping the PWM > > output disabled. This is not a problem due to the specific design of th= e > > regulator: when the PWM output is disabled the output pin is pulled LOW= , > > effectively achieving a 0% duty cycle (which in return means that VDDEE > > voltage is at 1140mV). > > Hrm. Perhaps the regulator should figure out that it's on with a > minimum voltage of 1.14V in this case - AIUI that broadly corresponds to > your change except for the fact that it doesn't recognise that there's > actually an output in this case since it assumes that disabling the PWM > disables the output which isn't the case with this hardware. We'd need > to know more about the PWM in that case though I think. If you have any specific questions then feel free to ask. Generally it's a very simple PWM controller: - when disabled the output is LOW - when enabled the output matches the requested period and duty cycle as best as possible (depending on the available input clocks) > > The problem comes when the pwm-regulator driver tries to initialize the > > PWM output. To do so it reads the current state from the hardware, whic= h > > is: > > period: 3666ns > > duty cycle: 3333ns (=3D ~91%) > > enabled: false > > Then those values are translated using the continuous voltage range to > > 860mV. > > > Later, when the regulator is being enabled (either by the regulator cor= e > > due to the always-on flag or first consumer - in this case the lima > > driver for the Mali-450 GPU) the pwm-regulator driver tries to keep the > > voltage (at 860mV) and just enable the PWM output. This is when things > > start to go wrong as the typical voltage used for VDDEE is 1100mV. > > So, the constraints say that the 860mV voltage is within range. Where > does the requirement for 1.1V come from in this situation? Is it just > that lima hasn't started yet and requires the 1.1V for hardware init > (and presumably power on) even if it can use a lower voltage at runtime? The vendor BSP includes a custom u-boot with lots of relevant information for which there's seemingly no documentation. It seems that 1.1V is what should be used during normal operation. 0.86V is what can be used during system suspend (when power to the Cortex-A5 cores is turned off and an integrated ARC core is taking over for wakeup purposes). Hence the supported voltage range of 0.86..1.1V Best regards, Martin