Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp686543pxa; Thu, 27 Aug 2020 12:58:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxC/vwmhgDzALz4gOO8a0o9CGphL8ml8N2TRnslKcqzKo47skLCZMSJZANCQyci3+7GibYC X-Received: by 2002:a17:906:eb49:: with SMTP id mc9mr22296208ejb.36.1598558318411; Thu, 27 Aug 2020 12:58:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598558318; cv=none; d=google.com; s=arc-20160816; b=X+Gi0bP9iuSkrWUVNxVNjhl9kMARu8dll5lIp02BOKKIzoHOHNDjzYEf6f1TatT1Lb LHL8erYWpJGVaN3rYAVaq0DZw7nKa8VopauN0s0fhmtew7FQNyRhR1os+oTZWO07/0RJ g+6NVjpCyp50b3z/EyM1bcoufiPd7WRCES6ydx5Sx431RtuGMPT1nT10f/bgz5Z65fOF 9i6/eYR3X3681+UJ5EDitk+2C/HQsu5j4uVMC1nYVsuZDFUZka4N6CFE6QDB0E0uo2dm 1YSrEP5DU49OJPbgCjYgEeof4QnQGVNpfyJNnjkxhXfbmNm6gorwP0f/Zg8xKonBbb+Z rAwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:mime-version:user-agent:date:message-id:subject:to :autocrypt:from:dkim-signature; bh=C/HvJGUgaEvDTWfSUh0PFFcl8NQJMw4IIUkLqtTJ2Cg=; b=wUJ3X3eCI6ne9GCpG60qBjDbxzeoU7J20ToRp5Pz8sEWGUq7NsTvN5hEOBlZKAVDcU 4o9MgG/KrvDCbb9YemGehrsWFkjBWyA2+AwOOJBvGfjwOkxYF2XzTL3LuJcKrZ+GHozD 6/OSAWKjQWGbc+HPiqc36q5owFsqH11BEdjldU41l1IYx1GVFRffAq/WhrnFNVcLo7XJ /g2lZ4u3Gj0SxDgUNAFsC+TDMNZqi6ktmyyaMPmNI5b5ME29se/+urRGdRM9vwxONqa7 2GfCq4PF1/o2M3N/zy12CE3L3JKPLql4u/lAt2rwnn3NVaaNO0dHDhXOZEZq2oGDAxUn kT9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lebedev-lt.20150623.gappssmtp.com header.s=20150623 header.b=WKvCNMog; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r26si2171252ejb.209.2020.08.27.12.58.15; Thu, 27 Aug 2020 12:58:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@lebedev-lt.20150623.gappssmtp.com header.s=20150623 header.b=WKvCNMog; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726120AbgH0Tzf (ORCPT + 99 others); Thu, 27 Aug 2020 15:55:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727863AbgH0Tzc (ORCPT ); Thu, 27 Aug 2020 15:55:32 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B671C061232 for ; Thu, 27 Aug 2020 12:55:31 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id m22so7815497ljj.5 for ; Thu, 27 Aug 2020 12:55:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lebedev-lt.20150623.gappssmtp.com; s=20150623; h=from:autocrypt:to:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=C/HvJGUgaEvDTWfSUh0PFFcl8NQJMw4IIUkLqtTJ2Cg=; b=WKvCNMogThRVXjIRkPHDi7hpXPbznRlDqXiXr4mvZScyrGKwrlnCL7PgYJx+uRq0hc lLo9RL781uKM6bka18GSpnoVvJAK59n+RH4DOQj4X653kbaRDWJCY+U0JJSRs4TXXg2N raUjsBKQFmZZJBrym8nsj6wODVnmMTWpY+tP5gy4+OGYGSit10r/h/XpPY6qEBg2Q/xP +AKdL/j8y618gm/02uigbGlAeVx4XVx5NUmmN58C2GZDpAgLwNoIH+R6Rl3E9iHQ2Ue+ S2D5iUXQYUriNRAa5kI7M7c9XnUHYO6lA6ZlUqIMbd6lztcDaP1T7T+bcmAtF75bCSiV VHSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:autocrypt:to:subject:message-id:date :user-agent:mime-version:content-language:content-transfer-encoding; bh=C/HvJGUgaEvDTWfSUh0PFFcl8NQJMw4IIUkLqtTJ2Cg=; b=oCTGAe3RU34dhxDDpPuMMio2WOrCAvafZz+pFUegeBBHaGOStDQAGGEBZaDiU3dMz3 0B28ia8bqkrL0oDZZ7iYeGuPCgi5iMR4NJZMXjcvQRdB9ruO5f4ixNzpWxAYDhNRxJcl NDEd8Gwiqg3vixI6esbCOoYjvzHxp9WBSAF2WpBCT9HNrAPE7kvtglB6up0/FuA7pApA su84kB4zQu1/4SSbV8TUcabSaDKlIjYDuW6/vrt/hu4dTmTejiggz826UQEtQtM//xZj ZeMuoZc8pnWku7e5QKTQ/mDDcIVXkX81M+POAIXoVg2RG1trwn6PgeaFtmbtQZFYQgzw BOZg== X-Gm-Message-State: AOAM532Hn8TSKre9ZaIqSt2wEPEz4pP9Dw5VCo1569biTg/Op/5N6reA FaYzI8xSvJVMLTfaNkSmchccF7NwsyYIeHD4 X-Received: by 2002:a2e:7504:: with SMTP id q4mr10588200ljc.41.1598558129747; Thu, 27 Aug 2020 12:55:29 -0700 (PDT) Received: from [192.168.1.108] ([5.20.204.163]) by smtp.gmail.com with ESMTPSA id f12sm432626lfj.50.2020.08.27.12.55.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Aug 2020 12:55:29 -0700 (PDT) From: Andrey Lebedev Autocrypt: addr=andrey@lebedev.lt; keydata= mQINBFNhFoYBEADieS1U4VUTLCgqijeQ3bXGArq7PCasU2OBJ7Bo9vrENOudkIxy3Xhiip5r Rh/agkYp4jQ0ZYnBb6KARVh6DwujVpV4IDbG+QwpoOy/mC9g7CZO0akLW6LtQXrd/kjqQIfq Enf0qT1rcf2XJJ8EKbErB7mHqWsqqWocrk2Bc5PS2+a/43G2jCchy4TnvPvihQ40CpF1XWrP qVzm7brtQ3IyjqD2RLNKVC8/+hn51RJjYggcclyVryS5mb4+8l+LBxsZkqzN9d6r2AW7VEqi Q5EARjLgbzRO1x6rkAL69/eXLJ9SXQFHtBpLny9nE72ThFA9PchT7bhVgTgMrl9tYgmp62io wKfRr8FBdQKSTFa67foL1d2S10IpHbM1z+4+g2KGAzYeYedSnyryptyQUWcYF4kcyk9W9U4f sR/kFAYJ2jj7esSJn7QlqyMB9fr9N9HqewU53gAhlCyagveN8UOEzkBZkCFGd1ECAgoN5jri dNIPJ0sprnLxGPwzU8iAQQY16WIDiJ7fobPU9wlZ6+aGdxC8aP+cT7cpLhkiE5tFDrtE7OqP UI9dXFTKirpKe2SazAdLV75OmNkwJATsLIFWwSRoLZ1qGFS/RQQdZsPd1mFeW1B/GYQQfKno qz1bIWWOAbrK7CRtuij6R4K0d14EpRQqDl/XXhFbFHr8E4azEQARAQABtCJBbmRyZXkgTGVi ZWRldiA8YW5kcmV5QGxlYmVkZXYubHQ+iQJYBBMBAgBCAhsDBgsJCAcDAgYVCAIJCgsEFgID AQIeAQIXgAIZARYhBLFzHdro7fvIkNnoMdnsMXAj1biABQJcNvmyBQk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Dza5c2KhK0aiGsoV0yhIhSC66/v/LxLG85QdzM3M0WKQ/z7CYP6/cxJJfDHhknGs c1I= To: Thierry Reding , =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , Lee Jones , Maxime Ripard , Chen-Yu Tsai , Philipp Zabel , "open list:PWM SUBSYSTEM" , "moderated list:ARM/Allwinner sunXi SoC support" , open list Subject: pwm-sun4i: PWM backlight is not turned off on shutdown Message-ID: Date: Thu, 27 Aug 2020 22:55:28 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, I think I'm experiencing problem with pwm-sun4i module. I'll describe the symptoms first. I have a device, based on Allwinner A20 (Cubieboard 2) with LVDS display that has a PWM-based backlight. The problem is: when linux shuts down, the backlight stays on. I expect it to be turned off. This used to work as expected on kernel 5.2-rc2, but after upgrade to 5.8 the backlight does not turn off anymore (most of the times, see below). The backlight is configured in the device tree [1]. The brightness can be changed by writing to "brightness" file on sysfs. So, linux can control the PWM line. Backlight sysfs directory also has a "bl_power" file, which can accept "0" to power on or "4" to power off the backlight (according to [2]). Now, writing "4" to bl_power sometimes turns the backlight off and sometimes not. I've found that the probability of backlight turning off pretty much correlates with the current screen brightness: on 100% brightness it will never turn off, on 50% brightness it will turn off on about half of the times. When backlight does not turn off, it goes on full brightness. It feels like the line, controlled by pwm stays in whatever state it was the moment backlight was powered down - either full 1 or 0. The pwm backlight device driver (pwm_bl) requests to set the duty cycle to 0 and disable the pwm with the same request [3], but I suspect the implementation driver (pwm-sun4i) does not actually set the duty cycle to 0 before disabling the pulse width modulation. Is there anything that can be done to fix this? [1] https://github.com/Openvario/meta-openvario/blob/warrior/recipes-kernel/linux/linux-mainline/openvario-common.dts#L21-L27 [2] https://www.kernel.org/doc/Documentation/ABI/stable/sysfs-class-backlight [3] https://github.com/torvalds/linux/blob/master/drivers/video/backlight/pwm_bl.c#L81-L83 -- Andrey Lebedev aka -.- . -.. -.. . .-. Software engineer Homepage: http://lebedev.lt/