Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2910018ybt; Mon, 22 Jun 2020 10:00:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6yqS5H45Xjsh9xtZZjDYvoGiUta6D11SeCwovNG5oPKIYAiF3UF/v/JnJRj1ECGSTIpFw X-Received: by 2002:a17:907:11c2:: with SMTP id va2mr16894634ejb.98.1592845213336; Mon, 22 Jun 2020 10:00:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592845213; cv=none; d=google.com; s=arc-20160816; b=g58V/LdwVt44UVzklki0lnLRz9dNK4TTXB5ZCR2uVO4gn15t/i4bXviDBmiOb7jemm aOD6mWKzl2nQjzEoJ58cadbpP3wGapT7zMLKSNUFveHWL61S852NywIW8+L1lY6+yU7s BTx70Dp6AN+ZlMn5LcSAAAdyWHyI8h3uagsyjpbHyM6bSARrvi/KGni8qQv1VPQj3Me9 z301EHrxJnIbRumHVs9/mJWO1Irb8LXAWBEbAMrvhrxSF6PucOfiQqQFB7JlHLuVDAZj kO9aEmGhGZBkMXsePaIp88k29wGXwYE+xdPR0qQCzPLyf1qpHHTVfIHRaT8z9iedc/sF jURg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=F+nlUAhHEbsgDoArBUNdvvaIbV4AUsHI2HbfVWN8ih0=; b=cWf0HCh7yhwlvGJZy/8B4X/Ngynkl5K45sA1W0ICdprhhzIegQlenNAX2wAYWpF6/v 7b22aC7fLRotdQW4RmEnPf42vQm8XR5V8VkIsOeDMJSx7s1gar+TlHZff3mZ+yAvR5vQ mhWA+APFuBDMxGySY7UC73Ybgm1+Gb002DqKivm4Iw515r1CwePUZy63+Qf8cQXgGXHX uS8nuL281xV9o6pmpqyLcJacwCGXzWoMjmoh60TRr/knOcmEetTgu/FM5rJYf62wOpsb 1Bt4jysW7HzU7OxDkqri6rWvk9Tb64XWoIUKiKffmOiakjY8izWFTintCc4lyPqQ8jOP vLMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZiXCU+2A; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id by19si1466915ejc.417.2020.06.22.09.59.50; Mon, 22 Jun 2020 10:00:13 -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=@linaro.org header.s=google header.b=ZiXCU+2A; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730021AbgFVQ5g (ORCPT + 99 others); Mon, 22 Jun 2020 12:57:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729807AbgFVQ5e (ORCPT ); Mon, 22 Jun 2020 12:57:34 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55731C061573 for ; Mon, 22 Jun 2020 09:57:34 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id y20so268587wmi.2 for ; Mon, 22 Jun 2020 09:57:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=F+nlUAhHEbsgDoArBUNdvvaIbV4AUsHI2HbfVWN8ih0=; b=ZiXCU+2An8ajIuIk/jVXiqjUZ6QhL/GTYo7OKI7BEariTuLskGO4iJ4u2Mmj+YpjRy heQ7oBLCcTWv5Liiyva55Ni+yPP9jZap/wVaIVx5TWCfhs7vwsUxsmTbfcz/NTwpoKB5 vuYu14wLQK8OCg4x7FMkcDE7moG5zK7cLYIFEycAFEqA9Kuh1cp5kN5SLErAZ/oUe3IE JGNy6459N+IPwcGTWR8hYWGhey1TQGH+EIoI4CJzOr0BFqG8RcQ9/ocy3ehQut/sWPU8 UcGk6Ygvgo+B9gq5S5MFjZ+LAJEFOLvykrKDyR/9LtZCmIjL+4AZGY+ZSAcsWmCJHmi0 D6Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=F+nlUAhHEbsgDoArBUNdvvaIbV4AUsHI2HbfVWN8ih0=; b=OSKlw74vJ6nXoRizpfbpGiIFjy9eZn6xVaWKXbFIe4IJPNhqzvblurWzyGLFCb+5Sb QJA7+GaP7PZxuIiCeYPo9eG4zgCkmoE9phDPgZx4+vnYvs+RhwfZUJGjl3qHIuSguXER s6EwaTf2D+4iOteZxE/gfSVFPun+0lSiUR10p+B5x6fJkhhwNsat7GfDAFftsT1vFfea HgKy/ERxub+zG/kgAy36GHgb+EvmmreP3QGsWerqwrhiACm76xyxY/NFIWYWLH68B+kj /L4PMKWSDoRxwM9pS3hVKxH4RhKHQ2oVhoxnNXAZsEEj4ln3UgWRrBHo7PJcBGJQOWpd iMtw== X-Gm-Message-State: AOAM530yUMVxODgziGAVQNq9pj2hh61cqKBAOxEw4y1VVEONSvba7nFU 59IZ4wl10qCJpC26NUgZ3kKyCw== X-Received: by 2002:a1c:6a01:: with SMTP id f1mr18924478wmc.52.1592845053002; Mon, 22 Jun 2020 09:57:33 -0700 (PDT) Received: from holly.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id s18sm20653700wra.85.2020.06.22.09.57.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 09:57:32 -0700 (PDT) Date: Mon, 22 Jun 2020 17:57:30 +0100 From: Daniel Thompson To: Sam Ravnborg Cc: Rob Herring , devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , linux-kernel@vger.kernel.org Subject: Re: [PATCH] dt-bindings: backlight: Convert common backlight bindings to DT schema Message-ID: <20200622165730.pnx7fzbq5e6q5h4l@holly.lan> References: <20200618224413.1115849-1-robh@kernel.org> <20200619215341.GA6857@ravnborg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200619215341.GA6857@ravnborg.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 19, 2020 at 11:53:41PM +0200, Sam Ravnborg wrote: > > diff --git a/Documentation/devicetree/bindings/leds/backlight/pwm-backlight.yaml b/Documentation/devicetree/bindings/leds/backlight/pwm-backlight.yaml > > new file mode 100644 > > index 000000000000..7e1f109a38a4 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/leds/backlight/pwm-backlight.yaml > > @@ -0,0 +1,98 @@ > > +# SPDX-License-Identifier: GPL-2.0-only > > +%YAML 1.2 > > +--- > > +$id: http://devicetree.org/schemas/leds/backlight/pwm-backlight.yaml# > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > + > > +title: pwm-backlight bindings > > + > > +maintainers: > > + - Lee Jones > > + - Daniel Thompson > > + - Jingoo Han > > + > > +properties: > > + compatible: > > + const: pwm-backlight > > + > > + pwms: > > + maxItems: 1 > > + > > + pwm-names: true > > + > > + power-supply: > > + description: regulator for supply voltage > > + > > + enable-gpios: > > + description: Contains a single GPIO specifier for the GPIO which enables > > + and disables the backlight > > + maxItems: 1 > > + > > + post-pwm-on-delay-ms: > > + description: Delay in ms between setting an initial (non-zero) PWM and > > + enabling the backlight using GPIO. > > + > > + pwm-off-delay-ms: > > + description: Delay in ms between disabling the backlight using GPIO > > + and setting PWM value to 0. > > + > > + brightness-levels: > > + description: Array of distinct brightness levels. Typically these are > > + in the range from 0 to 255, but any range starting at 0 will do. The > > + actual brightness level (PWM duty cycle) will be interpolated from > > + these values. 0 means a 0% duty cycle (darkest/off), while the last > > + value in the array represents a 100% duty cycle (brightest). > > + $ref: /schemas/types.yaml#/definitions/uint32-array > > + > > + default-brightness-level: > > + description: The default brightness level (index into the array defined > > + by the "brightness-levels" property). > > + $ref: /schemas/types.yaml#/definitions/uint32 > Same comment as before... Sorry the "ditto" meant I didn't thing about PWM as much as I should have. The situation for PWM is a little different to LED. That's mostly because we decided not to clutter the LED code with "num-interpolated-steps". The PWM code implements the default-brightness-level as an index into the brightness array *after* it has been expanded using interpolation. In other words today Linux treats the default-brightness-level more like[1]. description: The default brightness level. When num-interpolated-steps is not set this is simply an index into the array defined by the "brightness-levels" property. If num-interpolated-steps is set the brightness array will be expanded by interpolation before we index to get a default level. This is the best I have come up with so far... but I concede it still lacks elegance. Daniel. [1] I don't know my way round the BSD code bases to be sure what they do... I did a couple of web searches but didn't pull up anything definitive. > > > + > > + num-interpolated-steps: > > + description: Number of interpolated steps between each value of brightness-levels > > + table. This way a high resolution pwm duty cycle can be used without > > + having to list out every possible value in the brightness-level array. > > + $ref: /schemas/types.yaml#/definitions/uint32 > > + > > +dependencies: > > + default-brightness-level: [brightness-levels] > > + num-interpolated-steps: [brightness-levels] > > + > > +required: > > + - compatible > > + - pwms > > + - power-supply > > + > > +additionalProperties: false > > + > > +examples: > > + - | > > + backlight { > > + compatible = "pwm-backlight"; > > + pwms = <&pwm 0 5000000>; > > + > > + brightness-levels = <0 4 8 16 32 64 128 255>; > > + default-brightness-level = <6>; > > + > > + power-supply = <&vdd_bl_reg>; > > + enable-gpios = <&gpio 58 0>; > > + post-pwm-on-delay-ms = <10>; > > + pwm-off-delay-ms = <10>; > > + }; > > + > > + - | > > + // Example using num-interpolation-steps: > > + backlight { > > + compatible = "pwm-backlight"; > > + pwms = <&pwm 0 5000000>; > > + > > + brightness-levels = <0 2048 4096 8192 16384 65535>; > > + num-interpolated-steps = <2048>; > > + default-brightness-level = <4096>; > > + > > + power-supply = <&vdd_bl_reg>; > > + enable-gpios = <&gpio 58 0>; > > + }; > > + > > +... > > -- > > 2.25.1 > > > > _______________________________________________ > > dri-devel mailing list > > dri-devel@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/dri-devel