Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8D1EC433EF for ; Wed, 3 Nov 2021 19:21:47 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A056960EB4 for ; Wed, 3 Nov 2021 19:21:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A056960EB4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D32B583434; Wed, 3 Nov 2021 20:21:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="kK0kKCoJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 25AB88356D; Wed, 3 Nov 2021 20:21:41 +0100 (CET) Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D39388342C for ; Wed, 3 Nov 2021 20:21:37 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ot1-x32f.google.com with SMTP id s7-20020a056830148700b0055ad72acb7eso3948595otq.1 for ; Wed, 03 Nov 2021 12:21:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=sx8zRmaQTiwixmAsl6BZnNSsgrIaPlNFBPd5IannYMo=; b=kK0kKCoJVcIo2gg+0wGzTvjVDkQwatu9X5KJh2gQa3cS/2hay4ulvfjwDThc0BWqn5 YYnRHtLJscjg3R+aJyqF0JraakbaiF5oT5MM3zv8zVxojYABlrh7CGR6kqfdnNXFUTV7 mesVwuE/XczMXU9cEpjWSNkGVyVfK8a/RvA7g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=sx8zRmaQTiwixmAsl6BZnNSsgrIaPlNFBPd5IannYMo=; b=Kj2BmR2iVzg+/xv49bafX5y9H8aLxsxhnL2NqE8Kt91oocdTC1I9AHSf7A2vMUcZjk VJyzGEyie2ar/t+6mcfhkLJkEvPHNnOuW4fXE3UeE0k0WgvKhcdyeRYT6F+JO+2wru1/ ovpU4joSL8zb1sE2p/tH9ZGUpirO985SOwsFbkfOolz3O/XrlHPA9HNXwoB5kxskt2pD Rv+5PI3rus+aEf+jGorI3TFXeb7JZ3cynVlQJfreWv8OnDcuq5je4t8ZdRofImWpJWb5 stVmvHfCoiiTUze/A5tFR8gfzjwcWp6nNEzUposz+m/DL918fXwlGsSMMt8+90JePzI6 WMCQ== X-Gm-Message-State: AOAM5327uTfvxdEIjcYZnMXuE+kBzuDBEBvY67vJzwh2qFCn3YxFLbw9 gMqBhktGXFDcCpm2mvdtaGU3v/PLaf1mlw== X-Google-Smtp-Source: ABdhPJzQqW+SK2L4YfMK3SYARAv9CE/Ygou4FU+a7erD3I4Gwzuvc0OQgE1Tj9EQh2BdFUfD0cxsyw== X-Received: by 2002:a9d:5881:: with SMTP id x1mr32957220otg.332.1635967296063; Wed, 03 Nov 2021 12:21:36 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id k4sm789591oic.48.2021.11.03.12.21.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Nov 2021 12:21:35 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Guillaume GARDET , Dario Binacchi , Matthias Brugger , Akshay Saraswat , Simon Glass , Minkyu Kang Subject: [PATCH] exynos: pwm: Deal with a PWM at 100% Date: Wed, 3 Nov 2021 13:21:33 -0600 Message-Id: <20211103192133.2297337-1-sjg@chromium.org> X-Mailer: git-send-email 2.34.0.rc0.344.g81b53c2807-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean At present the counter never hits the comparitor in this case. Add a special case. This ensures that the snow backlight works when at full brightness. Fixes: 76c2ff3e5fd video: backlight: fix pwm's duty cycle calculation Signed-off-by: Simon Glass --- drivers/pwm/exynos_pwm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/pwm/exynos_pwm.c b/drivers/pwm/exynos_pwm.c index 1afaf784dab..609025d680d 100644 --- a/drivers/pwm/exynos_pwm.c +++ b/drivers/pwm/exynos_pwm.c @@ -43,6 +43,10 @@ static int exynos_pwm_set_config(struct udevice *dev, uint channel, tcnt = period_ns / rate_ns; tcmp = duty_ns / rate_ns; debug("%s: tcnt %u, tcmp %u\n", __func__, tcnt, tcmp); + + /* Ensure that the comparitor will actually hit the target */ + if (tcmp == tcnt) + tcmp = tcnt - 1; offset = channel * 3; writel(tcnt, ®s->tcntb0 + offset); writel(tcmp, ®s->tcmpb0 + offset); -- 2.34.0.rc0.344.g81b53c2807-goog