From patchwork Sun May 30 19:42:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12288433 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3D38C47091 for ; Sun, 30 May 2021 19:44:56 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8E7C861002 for ; Sun, 30 May 2021 19:44:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8E7C861002 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E874A6E3A0; Sun, 30 May 2021 19:44:55 +0000 (UTC) Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5E2276E3A0 for ; Sun, 30 May 2021 19:44:54 +0000 (UTC) Received: by mail-lj1-x22d.google.com with SMTP id t17so2511560ljk.7 for ; Sun, 30 May 2021 12:44:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qmoaNHWnrWPMeHd+/Ye+WmhjTNOaVcqlU6T2JKzPK9k=; b=Jt2MO9vy9ThiMePCacd0b2w7EZnQG+rLCwpnUY/7IoDiAStDMtZUTJ99tHyKcCGUuD ZF7FZpChJaNeuadyeicoIPtd4KgeHU/s67ImKcwoHOer+f9xVGsGUQSCwmVUUcK42tNb ysk+y50vtKyr1E3YyVV8JDB/gDyckDPPxzu60QgGngHcw71dK/MD2kQKYLzw0UrbRS4B zhd39nxXkiLFFpoWG/gXpuZ9nxqxTYVTEVd0Cr/+Fmo1/dfFqLc9yTPgfeZz4Buxi3NI MPTuuops7kl7HPzO6w65NQEVGdeaKb8Pv1/wcH5ddM3oGyVwbukgblujdV/mtwIIKiop Tzyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qmoaNHWnrWPMeHd+/Ye+WmhjTNOaVcqlU6T2JKzPK9k=; b=j+pSMtI1naO3/pJGjgq6NjxKtjwQaoc7Bz/Rt8dJqjNntSTJtBgIX8s4Jh3Xaz1Xvu c6QiL4z7CIUBaJ/8xpm/zgvD9+6Qz1IuEYKk/HN/w6mYUHX1L4mh7/OKfOWYjNTqF0QC na1nK6v9Y7PoIW8WaOa+Yz4N0q0cLGq92r3Ke7cfOgtxNfQblorGn5B2XNRwQjqCN8ON bowRUKTh7i+AnQ9pTRGJ/6eplrykR0A9cvdPYT2vMpOiK7ETX5ghxuwt24y/JeeJDctV aGUtrIacdYBuXQ6KKw1fJiBPk1BjIt0OWr+Xo5TdnR+TMacf7Sl60uBe1iQoqnHS6fAE 0r2g== X-Gm-Message-State: AOAM531J84mPxskhSqBb72L2aKyBMAUo1goxLjloQvtoJJBfLxFN/om7 89jdTV1HtuBCyDnLsCIViKEVqg== X-Google-Smtp-Source: ABdhPJyyFu6Ar9RXpa1uzdQc6ZOARtHKvY4EZYWVfdUi86tJ7nk9A5NFSXEVffvIZh64K3qEh/+SEw== X-Received: by 2002:a2e:8753:: with SMTP id q19mr13958022ljj.334.1622403892615; Sun, 30 May 2021 12:44:52 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id u11sm1095394lff.33.2021.05.30.12.44.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 May 2021 12:44:52 -0700 (PDT) From: Linus Walleij To: Lee Jones , Daniel Thompson , Jingoo Han , dri-devel@lists.freedesktop.org Subject: [PATCH] backlight: ktd253: Stabilize backlight Date: Sun, 30 May 2021 21:42:38 +0200 Message-Id: <20210530194238.2172318-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: newbyte@disroot.org, Stephan Gerhold Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Remove interrupt disablement during backlight setting. It is way to dangerous and makes platforms instable by having it miss vblank IRQs leading to the graphics derailing. The code is using ndelay() which is not available on platforms such as ARM and will result in 32 * udelay(1) which is substantial. Fixes: 5317f37e48b9 ("backlight: Add Kinetic KTD253 backlight driver") Cc: Stephan Gerhold Reported-by: newbyte@disroot.org Signed-off-by: Linus Walleij Tested-by: newbyte@disroot.org --- drivers/video/backlight/ktd253-backlight.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/video/backlight/ktd253-backlight.c b/drivers/video/backlight/ktd253-backlight.c index a7df5bcca9da..b79a47c2801f 100644 --- a/drivers/video/backlight/ktd253-backlight.c +++ b/drivers/video/backlight/ktd253-backlight.c @@ -40,7 +40,6 @@ static int ktd253_backlight_update_status(struct backlight_device *bl) int brightness = backlight_get_brightness(bl); u16 target_ratio; u16 current_ratio = ktd253->ratio; - unsigned long flags; dev_dbg(ktd253->dev, "new brightness/ratio: %d/32\n", brightness); @@ -69,13 +68,9 @@ static int ktd253_backlight_update_status(struct backlight_device *bl) } /* - * WARNING: - * The loop to set the correct current level is performed - * with interrupts disabled as it is timing critical. * The maximum number of cycles of the loop is 32 * so the time taken will be (T_LOW_NS + T_HIGH_NS + loop_time) * 32, */ - local_irq_save(flags); while (current_ratio != target_ratio) { /* * These GPIO operations absolutely can NOT sleep so no @@ -92,7 +87,6 @@ static int ktd253_backlight_update_status(struct backlight_device *bl) else current_ratio--; } - local_irq_restore(flags); ktd253->ratio = current_ratio; dev_dbg(ktd253->dev, "new ratio set to %d/32\n", target_ratio);