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: 450358 Delivered-To: patch@linaro.org Received: by 2002:a02:c735:0:0:0:0:0 with SMTP id h21csp259802jao; Sun, 30 May 2021 12:44:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdKWww4p1X+dRlgTHpvl+FCFGTro9ZoBvWscMyzU72C9a9WT+3HLqFQ3xu97/KaQVtuqZR X-Received: by 2002:a17:90a:5788:: with SMTP id g8mr15297193pji.79.1622403898323; Sun, 30 May 2021 12:44:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622403898; cv=none; d=google.com; s=arc-20160816; b=ZLJt3FdP+Cehvo9A+aMmwd6cuLNPXPGdG6fbBsocOokr63k62iPWsh/v6zsY2WZOb7 iHBvxx7C5na/s6cVuZwUNVw9VG9akzKs06LvcLMYxPXOf7TIRosggkhVHRHyG7OQRg+5 lsG7l10AklAWnfyEy9uTJaEg1QCYYtPkBI/xdgt3l6GGrs4HkBkCQpuWPqJWXB3abyk6 K3h3RZO5yU8OuItf8qvr55bfgy4Dzk2sqSWgHCChnfCv8wgIBONmtNHLh1PGHP+kIXU6 z+NPijJydZPNLAFuTJAq1tSorRX0xiGrlqNtD6PK2H7WiDP29qINuqSR2LJvgPk6PoYf 7U6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature :delivered-to; bh=qmoaNHWnrWPMeHd+/Ye+WmhjTNOaVcqlU6T2JKzPK9k=; b=lDjhdW3s2ZvCghh68yt6ILR3jzFGP9vQ5uzhjG3V2xb/H5RhvGb4j0V+JNQsMtt0dq ba3nNDacE7/VOcOctUK3QVVRTB+uL2EcUsT61MExJuFJYgy4dm3YxSz9AK+RAuuopD63 F621IR3W2/nnxU9ptfUpYvoCa8Am4xDbq9Ed0RP76i9tZcnsfp1IWxYU0JYICyz6p3uU DwFEQhacd+1+SglHLEHPAnYYENhenJ/aeIt0UJ1atgtcvn2aqqyvhZhAaaDg00TrT+T5 27B5wdZGUOmHn2vMqXpldTAf4WXIgV/GOMMecfw6uiPWEZO+Y1Q+HbuAOEJr/+aw3ruq cd/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Jt2MO9vy; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id t17si16388350pgk.35.2021.05.30.12.44.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 May 2021 12:44:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Jt2MO9vy; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.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) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org 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-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 --- drivers/video/backlight/ktd253-backlight.c | 6 ------ 1 file changed, 6 deletions(-) -- 2.31.1 Tested-by: newbyte@disroot.org 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);