Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2213706imm; Thu, 20 Sep 2018 09:25:50 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZBmyhQkyyhsNeCOo9i0za2QkT823RRKBKn4/l8uqHJMSaDrTswOuQWK5w/B/RfvyK/k+Le X-Received: by 2002:a63:df4e:: with SMTP id h14-v6mr37467485pgj.300.1537460750289; Thu, 20 Sep 2018 09:25:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537460750; cv=none; d=google.com; s=arc-20160816; b=q8HnN0/xrlFsHDjCQQfzUzfIIsdTFXnYbcCvH+VGb2bDMDZf8JPHwtG5m/tMA4CF/D JRmcgbPrqO0bXUEpUV0hTIfukCNmkL5UPHddgTribxVKDhBsqrcdT/mJW9tC+2Uhrf48 ED+wk9UHHQpJ16Nmo5pQiWFSfPBJU8Xf2UE4fbHPQtuxhlEdbXoMu34CY52P3p///OFK uqbnFArIB4od+pTaDtc5N1oC3xXZHFvOA1Q3pXSIcu0EfmClkDEIZaaBlYPME+dk402/ aTeypEgSS+wZ2OuYrMyFzg1oGkv7ZDHG5j9FZXXERj6R86pkPvG0/b/YvL03jgF80Xe6 u8dQ== 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:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=WiSoTJwbUQ3MW9ewSd/IrcUV6TbXa5NwKq9fnIcg46o=; b=Uuxu2RV2MYfTkxOIa5oyqotjBzOLz9T3bKmUyVIlULNbZTUTnhI5X2/OYVYxtbeNRb 1mCZn3cYVj45Dpn33GB6WyQhDRE3utN6T9JXs2wziEbVaYpiGUclkv/1ZqeBrLlD2v8+ 3szbAKtKvbG+P3RKnC5R2jGBleYbLTDfGlu7bdXw+uVVsL2/r1Jri0drL86M/mn+QYXY YTbiiWYfSt4haFo0U1bNS2K/TEE3fU9aS2OB41D/xySbfGfrCehcUDxSOVEvXI45lvYg 0fD4RtaKf+vlD3d3pIRT3zUM9SxMElafSbvXEgWN5nADfKa0Cy1pwxoKpDkWxlmYq2wB n53g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VmLwyXxA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y9-v6si24492580plk.427.2018.09.20.09.25.32; Thu, 20 Sep 2018 09:25:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VmLwyXxA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387830AbeITWIH (ORCPT + 99 others); Thu, 20 Sep 2018 18:08:07 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:42952 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387690AbeITWIG (ORCPT ); Thu, 20 Sep 2018 18:08:06 -0400 Received: by mail-pf1-f196.google.com with SMTP id l9-v6so4607471pff.9 for ; Thu, 20 Sep 2018 09:23:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=WiSoTJwbUQ3MW9ewSd/IrcUV6TbXa5NwKq9fnIcg46o=; b=VmLwyXxAhcLQH9BmHmQxAsH0hrQCMIM7NTrmP6uQMJLGKwkhf2uLPGjcnqW2Ade72E 2eOm9S3cbDmQi1uC4CvkxrFe2ZjWEwoh0A0JBvni8G/UOrV8pr2LIYZFByUDQooZuNVu HUHB6qPL35eNbsAKM9OIrEKmMEerukEmZ/x20= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=WiSoTJwbUQ3MW9ewSd/IrcUV6TbXa5NwKq9fnIcg46o=; b=ExFhoImRV4Uvi9M3BM72P+QiBf1foLXhB+52o1vvU9Qf5pYiO0UrD485gxsTUuv3nT DWAEUc4psNqVDUcGh4qJ4M+ZNWsuJkak50QqJcUut5R5xQqo5rhJtqFdoXCmxD42rhfg ETt3H6j/NHiDU7prINbi/YIoxCKeZfbb7g0LaYtFDswJl6Z/NDxVGIMliDYNvriFHlHQ HHV2RBPWw4slQverbOwE9MDxQ/WXS7tIbl3xlvE82QEKKSVLGo6TCejMzmvjykq1GUTx abWiHOS47CcOnjrKFc2NL9La+CF1fnjHFo80tWjBWizI30ghtI17pjasNFmx2IypDYAu jDlg== X-Gm-Message-State: APzg51Dr2NCMqnoruWUSA8fnyarUvs1XaAODKa1hlKOl91i9/zRIwzsq 0pW3qIbGAljp6xLY/Rkx1yFuww== X-Received: by 2002:a62:23c2:: with SMTP id q63-v6mr42113386pfj.116.1537460630770; Thu, 20 Sep 2018 09:23:50 -0700 (PDT) Received: from holly.lan ([209.121.128.187]) by smtp.googlemail.com with ESMTPSA id w5-v6sm29290975pfn.44.2018.09.20.09.23.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Sep 2018 09:23:49 -0700 (PDT) Subject: Re: Re: [PATCH] backlight: pwm_bl: Fix brightness levels for non-DT case. To: Robert Jarzmik , Enric Balletbo i Serra Cc: linux-kernel@vger.kernel.org, lee.jones@linaro.org, kernel@collabora.com, heiko@sntech.de, linux-pwm@vger.kernel.org, linux-fbdev@vger.kernel.org, Thierry Reding , Bartlomiej Zolnierkiewicz , dri-devel@lists.freedesktop.org, Jingoo Han References: <20180824155402.2822-1-enric.balletbo@collabora.com> <87h8ji98jp.fsf@belgarion.home> From: Daniel Thompson Message-ID: <9cc21df6-67f2-e210-33b8-e0e14f052e7e@linaro.org> Date: Thu, 20 Sep 2018 09:23:49 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <87h8ji98jp.fsf@belgarion.home> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/08/18 01:04, Robert Jarzmik wrote: > Enric Balletbo i Serra writes: > >> Commit '88ba95bedb79 ("backlight: pwm_bl: Compute brightness of LED >> linearly to human eye")' allows the possibility to compute a default >> brightness table when there isn't the brightness-levels property in the >> DT. Unfortunately the changes made broke the pwm backlight for the >> non-DT boards. >> >> Usually, the non-DT boards don't pass the brightness levels via platform >> data, instead, they set the max_brightness in their platform data and the >> driver calculates the level without a table. The ofending patch assumed >> that when there is no brightness levels table we should create one, but this >> is clearly wrong for the non-DT case. >> >> After this patch the code handles the DT and the non-DT case taking in >> consideration also if max_brightness is set or not. The default table is >> only created when neither, brightness-levels and max_brightness, are >> set. >> >> The patch also fixes another issue found by Robert. Before this patch >> looks like a division by 0 was possible when state.period returned 0 by >> pwm_get_state(). This is because pwm_get_state() was called before >> pwm_apply_args() so state.period was not initialized. The patch moves >> the pwm_apply_args() call before any call to pwm_get_state(). >> >> Fixes: '88ba95bedb79 ("backlight: pwm_bl: Compute brightness of LED linearly to human eye")' >> Reported-by: Robert Jarzmik >> Signed-off-by: Enric Balletbo i Serra > Tested-by: Robert Jarzmik Acked-by: Daniel Thompson (and sorry for the delay) Daniel.