Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp1580781lqs; Sat, 15 Jun 2024 16:10:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVVy5NMQBGk6PNs9bxE/qI0IKEXFFHq6noQtFIx0piG8V2OZ7mDC9LJMdX6cSMNCw3UsvibAiyXPJOVZXeDn32sbFUWeC/cVkEINpVWdg== X-Google-Smtp-Source: AGHT+IFK9qmGhMwlcbuuxVFsCEZlASZZJnippZq0ZYC8fB14aMKqoOCLC2MMSZ9Qalw4vyydHMZt X-Received: by 2002:aa7:8edc:0:b0:705:9748:7b9d with SMTP id d2e1a72fcca58-705d71b17e2mr5603856b3a.23.1718493058142; Sat, 15 Jun 2024 16:10:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718493058; cv=pass; d=google.com; s=arc-20160816; b=Xm8KW/SwKIixuuHde39F1x+1G8RTZUJWYmpd1heR0Dfd1AQ9ujQDEdIA5ooGSAmBAa /CN//nRJg0XjSL+2Kktg2lhuQEJd2p5Mujcm3gjbitXRocFMnEFoURDvbkAxYZ8VUnKu NSJzEfCmIiEYL+U+GQLNaEzygSjhF9+uThj9+0GOiP0QNC/Fi/4rThl/D7mHg+YOULoB 6nJh4D1vPzuJGJUDM/0mVlO5VESNAkr/7aOnsEvz6xCAAeqIVRMhJ9ESpn5WhENNn8fU 0AvwHESdEX6tCi+Wh6ktshKkkRQap9c9XXCsWJYjNnMjVQQ29Nj+6oL7EkIIFuEKGhdf 0qDA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=7R40NGjhA4iIhadDR9M6U6xqU98YvFHgUqsKkQpjspQ=; fh=D2Fiy69DvwjPPFkbB9FWE00UyXBHB7tskF9a4IMOy8Q=; b=Y656FnK7BEK6YCU6tH9BZ0Y43Epl1zFCGNvMA3dvStwoLfNC/PyMOO3fl+uxPiNCso n8PYKAuC6DJXr5ycAgH6quFZL3x3+Q3C3AYk68GdURWk2ovevVmGD4ZwT2t3LT6P4yJC 9krm8NRI5RdsiOE/ZD5JqabQQ/28RNLlpfCKsNIomc9OethDkz3ckO/EG1va/LWaTNbh WgSCC0x5gUtykPCQNIqvp68pEcnSWplf6GsP1Vo4Cydv1EB5fssQriLKpfEGs3fQpmOE JZGJLVXz3PFXNoYeSm6mz/LpIhaLyuN/p30NKuFb4dpiK9OkSsygmUpjXVzEPw15cNrM TlRA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20230601 header.b=aAMpz1ZU; arc=pass (i=1 spf=pass spfdomain=googlemail.com dkim=pass dkdomain=googlemail.com dmarc=pass fromdomain=googlemail.com); spf=pass (google.com: domain of linux-kernel+bounces-216038-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-216038-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-705dc6af493si3987550b3a.71.2024.06.15.16.10.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jun 2024 16:10:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-216038-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@googlemail.com header.s=20230601 header.b=aAMpz1ZU; arc=pass (i=1 spf=pass spfdomain=googlemail.com dkim=pass dkdomain=googlemail.com dmarc=pass fromdomain=googlemail.com); spf=pass (google.com: domain of linux-kernel+bounces-216038-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-216038-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id A6810B21A4D for ; Sat, 15 Jun 2024 23:10:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5A9F461FE3; Sat, 15 Jun 2024 23:10:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b="aAMpz1ZU" Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (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 7F4D5171B0; Sat, 15 Jun 2024 23:10:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718493046; cv=none; b=U9JAAXeaRINtrDU2q/f6Mm+/68bYArO58p4x+9C6JvRSAYMvVfKMG4ZVLs0VnDkrsb5ApV0o3F2Gj3CK5agQ4JzjHxfyRYEZs78mKLOdEXMnVBgDJ64/+nIHEccT6f4iyXbRN8JaHq0JgIwDirEOsFi6mxpvdiz2SHEGK2UJOV4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718493046; c=relaxed/simple; bh=9UCyQZoOJ9zDQjCc2wL1CUbLLfqA0rfziWeE2+5Ta4M=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=ASXWkYTx9gyDZBlcEA8fsAFOf9SQrWlns8X69Y2DNyxVzySPkCorg3QAfMcH7WiQhC5POmuYkasLSu4u4uB9UK/6qLMcdKSZ74NwghvrMl5q6lKpDuWEUcIqWzofaEPzlLi3mS42+IlMgNCL+JvyQlcetX2pIL2tnRTnXwc6jOU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=googlemail.com; spf=pass smtp.mailfrom=googlemail.com; dkim=pass (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b=aAMpz1ZU; arc=none smtp.client-ip=209.85.214.172 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-pl1-f172.google.com with SMTP id d9443c01a7336-1f6da06ba24so29074725ad.2; Sat, 15 Jun 2024 16:10:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20230601; t=1718493044; x=1719097844; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=7R40NGjhA4iIhadDR9M6U6xqU98YvFHgUqsKkQpjspQ=; b=aAMpz1ZUdtmvpXlxAwMyEnylrbCARJtuSeVGvXL73z/FPiGrQFeaSxj1WGnQqWv1RT LItWnYtdQp3siPAR1UGcIyBArrjVZZTh+n1l3KZS1QPHTJfr0IDirb4uj38i2kc++I2I kZBGwFbci9YxS9bmOE3YYo+ob0utvcK4Y1S8Dt7pyAljTIr3BzITPVVO4Tg5jL6Ier4/ noIH1W1ncV+P9Uvi1c/SCaCuChwT6jbzxB1lOX+kZn1cIVIVwI9mWtXtQLag9zfkyPxo IjJ2893e7kVPl8AZWS99o18TczfKNLHNT3ojetcQZLlNc5l2WbuJ7PX1XCNXUuGaGfEG rnwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718493044; x=1719097844; h=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=7R40NGjhA4iIhadDR9M6U6xqU98YvFHgUqsKkQpjspQ=; b=QiSVUOuha/b8lFyECywnokDuRU0N1BQcHwwkga9CoFSW3PLDoLHI087yslJ0H4qynl JZUJ+Cy8zqAgAfqlkariU5ZjTjaKFu1CSK3C/BfOIk1DHpNkI0Do7RJ2wgSslzmbgsgt f6nnwQeivXwMZrF+xoGYREpjt1ckXRpfdo3wBxgqFgVbLMp1BHr4myu70w9xAhadK0Gw SeqyE5lITiHycg6L2qfQ27cLkzzjwKXJXc/CH6RLkYxYvxPm+Ik77/lhfqo3uatSLn/T pvA81evgITyFC+iBn70gJm3s8nKIkGayNSacTzry4QSCnBYucP7Cn0zi8FLbrXXK7BP9 NX0g== X-Forwarded-Encrypted: i=1; AJvYcCX7oLZz3TX1R3VSFP8Gt+LLB4x90BIMu3LP1bp5/wRHMxxjSQp6h3bM+bX5+4pPAtHxlzCLDGEjkTUI5/72lzsejnFkA31XmUvs6+GFXrc6nCQnx28QvNXIRWfNkSYPCEjtODJpS4Fz X-Gm-Message-State: AOJu0YyWrBOfXe86Z/5NKOVcfApfFJVbZdTFUAwTlz+p8Sc9CK5/6xKr lB9SaZG2bMDeIno6Vrp1GZDaUx/wmaxPy7+/f5iARKds5moX7LNxr1Oq+4rIh95IcYP5CcQd6N0 6/jbo9A0VT3aSxkNcMg8UjBmeXpZKx9r+ X-Received: by 2002:a17:903:1c7:b0:1f7:364f:1162 with SMTP id d9443c01a7336-1f8627cb650mr69288645ad.31.1718493043566; Sat, 15 Jun 2024 16:10:43 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240610104600.458308-2-u.kleine-koenig@baylibre.com> In-Reply-To: <20240610104600.458308-2-u.kleine-koenig@baylibre.com> From: Martin Blumenstingl Date: Sun, 16 Jun 2024 01:10:32 +0200 Message-ID: Subject: Re: [RFC PATCH] regulator: pwm-regulator: Make assumptions about disabled PWM consistent To: =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= Cc: Liam Girdwood , Mark Brown , linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org Content-Type: multipart/mixed; boundary="000000000000694344061af5d7be" --000000000000694344061af5d7be Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello Uwe, On Mon, Jun 10, 2024 at 12:46=E2=80=AFPM Uwe Kleine-K=C3=B6nig wrote: [...] > this is my suggestion to fix the concerns I expressed in > https://lore.kernel.org/all/hf24mrplr76xtziztkqiscowkh2f3vmceuarecqcwnr6u= dggs6@uiof2rvvqq5v/ > . > > It's only compile tested as I don't have a machine with a pwm-regulator. > So getting test feedback before applying it would be great. Unfortunately this approach breaks my Odroid-C1 board again with the same symptoms as before the mentioned commits: random memory corruption, preventing the board from booting to userspace. The cause also seems to be the same as before my commits: - period (3666ns) and duty cycle (3333ns) in the hardware registers the PWM controller when Linux boots, but the PWM output is disabled - with a duty cycle of 0 or PWM output being disabled the output of the voltage regulator is 1140mV, which is the only allowed voltage for that rail (even though the regulator can achieve other voltages) - pwm_regulator_enable() calls pwm_enable() which simply takes the period and and duty cycle that was read back from the hardware and enables the output, resulting in undervolting of a main voltage rail of the SoC I hope that this (especially the last item) also clarifies the question you had in the linked mail on whether updating pwm_regulator_init_state() would help/work. Regarding your alternative and preferred approach from the other mail: > Alternatively (and IMHO nicer) just keep the pwm_state around and don't > use the (mis) feature of the PWM core that pwm_get_state only returns > the last set state. I tried this to see if it would work also for my Odroid-C1 board and I'm happy to report it does - see the attached diff. In case you are happy with this approach I can submit it as a proper patch. Best regards, Martin --000000000000694344061af5d7be Content-Type: text/x-patch; charset="US-ASCII"; name="pwm-regulator-keep-pwm-state-around.diff" Content-Disposition: attachment; filename="pwm-regulator-keep-pwm-state-around.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lxgqakbn0 ZGlmZiAtLWdpdCBhL2RyaXZlcnMvcmVndWxhdG9yL3B3bS1yZWd1bGF0b3IuYyBiL2RyaXZlcnMv cmVndWxhdG9yL3B3bS1yZWd1bGF0b3IuYwppbmRleCA3NDM0YjZiMjJkMzIuLmFiNmZjOTkwNWJi MiAxMDA2NDQKLS0tIGEvZHJpdmVycy9yZWd1bGF0b3IvcHdtLXJlZ3VsYXRvci5jCisrKyBiL2Ry aXZlcnMvcmVndWxhdG9yL3B3bS1yZWd1bGF0b3IuYwpAQCAtNDEsNiArNDEsOCBAQCBzdHJ1Y3Qg cHdtX3JlZ3VsYXRvcl9kYXRhIHsKIAogCS8qIEVuYWJsZSBHUElPICovCiAJc3RydWN0IGdwaW9f ZGVzYyAqZW5iX2dwaW87CisKKwlzdHJ1Y3QgcHdtX3N0YXRlIHB3bV9zdGF0ZTsKIH07CiAKIHN0 cnVjdCBwd21fdm9sdGFnZXMgewpAQCAtNDgsMTggKzUwLDMzIEBAIHN0cnVjdCBwd21fdm9sdGFn ZXMgewogCXVuc2lnbmVkIGludCBkdXR5Y3ljbGU7CiB9OwogCitzdGF0aWMgaW50IHB3bV9yZWd1 bGF0b3JfYXBwbHlfc3RhdGUoc3RydWN0IHJlZ3VsYXRvcl9kZXYgKnJkZXYsCisJCQkJICAgICBz dHJ1Y3QgcHdtX3N0YXRlICpuZXdfc3RhdGUpCit7CisJc3RydWN0IHB3bV9yZWd1bGF0b3JfZGF0 YSAqZHJ2ZGF0YSA9IHJkZXZfZ2V0X2RydmRhdGEocmRldik7CisJaW50IHJldDsKKworCXJldCA9 IHB3bV9hcHBseV9taWdodF9zbGVlcChkcnZkYXRhLT5wd20sIG5ld19zdGF0ZSk7CisJaWYgKHJl dCkgeworCQlkZXZfZXJyKCZyZGV2LT5kZXYsICJGYWlsZWQgdG8gY29uZmlnd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