<!DOCTYPE html>
<html lang="en" data-content_root="../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Backlight support — The Linux Kernel documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../_static/alabaster.css?v=3918102e" />
<script src="../_static/documentation_options.js?v=5929fcd5"></script>
<script src="../_static/doctools.js?v=9bcbadda"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="VGA Switcheroo" href="vga-switcheroo.html" />
<link rel="prev" title="Falcon (FAst Logic Controller)" href="nova/core/falcon.html" />
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
</head><body>
<div class="document">
<div class="sphinxsidebar" role="navigation" aria-label="Main">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo" src="../_static/logo.svg" alt="Logo of The Linux Kernel"/>
</a></p>
<h1 class="logo"><a href="../index.html">The Linux Kernel</a></h1>
<p class="blurb">6.18.50</p>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
<p>
<h3 class="kernel-toc-contents">Contents</h3>
<input type="checkbox" class="kernel-toc-toggle" id = "kernel-toc-toggle" checked>
<label class="kernel-toc-title" for="kernel-toc-toggle"></label>
<div class="kerneltoc" id="kerneltoc">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../process/development-process.html">Development process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../process/submitting-patches.html">Submitting patches</a></li>
<li class="toctree-l1"><a class="reference internal" href="../process/code-of-conduct.html">Code of conduct</a></li>
<li class="toctree-l1"><a class="reference internal" href="../maintainer/index.html">Maintainer handbook</a></li>
<li class="toctree-l1"><a class="reference internal" href="../process/index.html">All development-process docs</a></li>
</ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../core-api/index.html">Core API</a></li>
<li class="toctree-l1"><a class="reference internal" href="../driver-api/index.html">Driver APIs</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../subsystem-apis.html">Subsystems</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#core-subsystems">Core subsystems</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../subsystem-apis.html#human-interfaces">Human interfaces</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../input/index.html">Input Documentation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../hid/index.html">Human Interface Devices (HID)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../sound/index.html">Sound Subsystem Documentation</a></li>
<li class="toctree-l3 current"><a class="reference internal" href="index.html">GPU Driver Developer’s Guide</a></li>
<li class="toctree-l3"><a class="reference internal" href="../fb/index.html">Frame Buffer</a></li>
<li class="toctree-l3"><a class="reference internal" href="../leds/index.html">LEDs</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#networking-interfaces">Networking interfaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#storage-interfaces">Storage interfaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#other-subsystems">Other subsystems</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../locking/index.html">Locking</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../process/license-rules.html">Licensing rules</a></li>
<li class="toctree-l1"><a class="reference internal" href="../doc-guide/index.html">Writing documentation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../dev-tools/index.html">Development tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../dev-tools/testing-overview.html">Testing guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../kernel-hacking/index.html">Hacking guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../trace/index.html">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../fault-injection/index.html">Fault injection</a></li>
<li class="toctree-l1"><a class="reference internal" href="../livepatch/index.html">Livepatching</a></li>
<li class="toctree-l1"><a class="reference internal" href="../rust/index.html">Rust</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../admin-guide/index.html">Administration</a></li>
<li class="toctree-l1"><a class="reference internal" href="../kbuild/index.html">Build system</a></li>
<li class="toctree-l1"><a class="reference internal" href="../admin-guide/reporting-issues.html">Reporting issues</a></li>
<li class="toctree-l1"><a class="reference internal" href="../tools/index.html">Userspace tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../userspace-api/index.html">Userspace API</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../firmware-guide/index.html">Firmware</a></li>
<li class="toctree-l1"><a class="reference internal" href="../devicetree/index.html">Firmware and Devicetree</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../arch/index.html">CPU architectures</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../staging/index.html">Unsorted documentation</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../translations/index.html">Translations</a></li>
</ul>
</div>
<script type="text/javascript"> <!--
var sbar = document.getElementsByClassName("sphinxsidebar")[0];
let currents = document.getElementsByClassName("current")
if (currents.length) {
sbar.scrollTop = currents[currents.length - 1].offsetTop;
}
--> </script>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/gpu/backlight.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
</div>
</div>
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="backlight-support">
<h1>Backlight support<a class="headerlink" href="#backlight-support" title="Link to this heading">¶</a></h1>
<p>The backlight core supports implementing backlight drivers.</p>
<p>A backlight driver registers a driver using
<a class="reference internal" href="#c.devm_backlight_device_register" title="devm_backlight_device_register"><code class="xref c c-func docutils literal notranslate"><span class="pre">devm_backlight_device_register()</span></code></a>. The properties of the backlight
driver such as type and max_brightness must be specified.
When the core detect changes in for example brightness or power state
the <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">update_status()</span></code> operation is called. The backlight driver shall
implement this operation and use it to adjust backlight.</p>
<p>Several sysfs attributes are provided by the backlight core:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>- brightness R/W, set the requested brightness level
- actual_brightness RO, the brightness level used by the HW
- max_brightness RO, the maximum brightness level supported
</pre></div>
</div>
<p>See <a class="reference internal" href="../admin-guide/abi-stable-files.html#abi-file-stable-sysfs-class-backlight"><span class="std std-ref">ABI file stable/sysfs-class-backlight</span></a> for the full list.</p>
<p>The backlight can be adjusted using the sysfs interface, and
the backlight driver may also support adjusting backlight using
a hot-key or some other platform or firmware specific way.</p>
<p>The driver must implement the <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">get_brightness()</span></code> operation if
the HW do not support all the levels that can be specified in
brightness, thus providing user-space access to the actual level
via the actual_brightness attribute.</p>
<p>When the backlight changes this is reported to user-space using
an uevent connected to the actual_brightness attribute.
When brightness is set by platform specific means, for example
a hot-key to adjust backlight, the driver must notify the backlight
core that brightness has changed using <a class="reference internal" href="#c.backlight_force_update" title="backlight_force_update"><code class="xref c c-func docutils literal notranslate"><span class="pre">backlight_force_update()</span></code></a>.</p>
<p>Display drives can control the backlight device’s status using
<code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">backlight_notify_blank()</span></code> and <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">backlight_notify_blank_all()</span></code>. If this
results in a change in the backlight state the functions call the
<code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">update_status()</span></code> operation.</p>
<dl class="c enum">
<dt class="sig sig-object c" id="c.backlight_update_reason">
<span class="k"><span class="pre">enum</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">backlight_update_reason</span></span></span><a class="headerlink" href="#c.backlight_update_reason" title="Link to this definition">¶</a><br /></dt>
<dd><p>what method was used to update backlight</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Constants</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">BACKLIGHT_UPDATE_HOTKEY</span></code></dt><dd><p>The backlight was updated using a hot-key.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">BACKLIGHT_UPDATE_SYSFS</span></code></dt><dd><p>The backlight was updated using sysfs.</p>
</dd>
</dl>
</div>
<p><strong>Description</strong></p>
<p>A driver indicates the method (reason) used for updating the backlight
when calling <a class="reference internal" href="#c.backlight_force_update" title="backlight_force_update"><code class="xref c c-func docutils literal notranslate"><span class="pre">backlight_force_update()</span></code></a>.</p>
<dl class="c enum">
<dt class="sig sig-object c" id="c.backlight_type">
<span class="k"><span class="pre">enum</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">backlight_type</span></span></span><a class="headerlink" href="#c.backlight_type" title="Link to this definition">¶</a><br /></dt>
<dd><p>the type of backlight control</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Constants</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">BACKLIGHT_RAW</span></code></dt><dd><p>The backlight is controlled using hardware registers.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">BACKLIGHT_PLATFORM</span></code></dt><dd><p>The backlight is controlled using a platform-specific interface.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">BACKLIGHT_FIRMWARE</span></code></dt><dd><p>The backlight is controlled using a standard firmware interface.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">BACKLIGHT_TYPE_MAX</span></code></dt><dd><p>Number of entries.</p>
</dd>
</dl>
</div>
<p><strong>Description</strong></p>
<p>The type of interface used to control the backlight.</p>
<dl class="c struct">
<dt class="sig sig-object c" id="c.backlight_ops">
<span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">backlight_ops</span></span></span><a class="headerlink" href="#c.backlight_ops" title="Link to this definition">¶</a><br /></dt>
<dd><p>backlight operations</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Definition</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>struct backlight_ops {
unsigned int options;
#define BL_CORE_SUSPENDRESUME (1 << 0);
int (*update_status)(struct backlight_device *);
int (*get_brightness)(struct backlight_device *);
bool (*controls_device)(struct backlight_device *bd, struct device *display_dev);
};
</pre></div>
</div>
<p><strong>Members</strong></p>
<dl>
<dt><code class="docutils literal notranslate"><span class="pre">options</span></code></dt><dd><p>Configure how operations are called from the core.</p>
<p>The options parameter is used to adjust the behaviour of the core.
Set BL_CORE_SUSPENDRESUME to get the <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">update_status()</span></code> operation called
upon suspend and resume.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">update_status</span></code></dt><dd><p>Operation called when properties have changed.</p>
<p>Notify the backlight driver some property has changed.
The update_status operation is protected by the update_lock.</p>
<p>The backlight driver is expected to use <a class="reference internal" href="#c.backlight_is_blank" title="backlight_is_blank"><code class="xref c c-func docutils literal notranslate"><span class="pre">backlight_is_blank()</span></code></a>
to check if the display is blanked and set brightness accordingly.
<code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">update_status()</span></code> is called when any of the properties has changed.</p>
<p>RETURNS:</p>
<p>0 on success, negative error code if any failure occurred.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">get_brightness</span></code></dt><dd><p>Return the current backlight brightness.</p>
<p>The driver may implement this as a readback from the HW.
This operation is optional and if not present then the current
brightness property value is used.</p>
<p>RETURNS:</p>
<p>A brightness value which is 0 or a positive number.
On failure a negative error code is returned.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">controls_device</span></code></dt><dd><p>Check against the display device</p>
<p>Check if the backlight controls the given display device. This
operation is optional and if not implemented it is assumed that
the display is always the one controlled by the backlight.</p>
<p>RETURNS:</p>
<p>If display_dev is NULL or display_dev matches the device controlled by
the backlight, return true. Otherwise return false.</p>
</dd>
</dl>
</div>
<p><strong>Description</strong></p>
<p>The backlight operations are specified when the backlight device is registered.</p>
<dl class="c struct">
<dt class="sig sig-object c" id="c.backlight_properties">
<span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">backlight_properties</span></span></span><a class="headerlink" href="#c.backlight_properties" title="Link to this definition">¶</a><br /></dt>
<dd><p>backlight properties</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Definition</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>struct backlight_properties {
int brightness;
int max_brightness;
int power;
#define BACKLIGHT_POWER_ON (0);
#define BACKLIGHT_POWER_OFF (4);
#define BACKLIGHT_POWER_REDUCED (1);
enum backlight_type type;
unsigned int state;
#define BL_CORE_SUSPENDED (1 << 0);
#define BL_CORE_FBBLANK (1 << 1);
enum backlight_scale scale;
#define BL_DISPLAY_NAME_LEN 32;
char display_name[BL_DISPLAY_NAME_LEN];
};
</pre></div>
</div>
<p><strong>Members</strong></p>
<dl>
<dt><code class="docutils literal notranslate"><span class="pre">brightness</span></code></dt><dd><p>The current brightness requested by the user.</p>
<p>The backlight core makes sure the range is (0 to max_brightness)
when the brightness is set via the sysfs attribute:
/sys/class/backlight/<backlight>/brightness.</p>
<p>This value can be set in the backlight_properties passed
to <a class="reference internal" href="#c.devm_backlight_device_register" title="devm_backlight_device_register"><code class="xref c c-func docutils literal notranslate"><span class="pre">devm_backlight_device_register()</span></code></a> to set a default brightness
value.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">max_brightness</span></code></dt><dd><p>The maximum brightness value.</p>
<p>This value must be set in the backlight_properties passed to
<a class="reference internal" href="#c.devm_backlight_device_register" title="devm_backlight_device_register"><code class="xref c c-func docutils literal notranslate"><span class="pre">devm_backlight_device_register()</span></code></a> and shall not be modified by the
driver after registration.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">power</span></code></dt><dd><p>The current power mode.</p>
<p>User space can configure the power mode using the sysfs
attribute: /sys/class/backlight/<backlight>/bl_power
When the power property is updated <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">update_status()</span></code> is called.</p>
<p>The possible values are: (0: full on, 4: full off), see
BACKLIGHT_POWER constants.</p>
<p>When the backlight device is enabled, <strong>power</strong> is set to
BACKLIGHT_POWER_ON. When the backlight device is disabled,
<strong>power</strong> is set to BACKLIGHT_POWER_OFF.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">type</span></code></dt><dd><p>The type of backlight supported.</p>
<p>The backlight type allows userspace to make appropriate
policy decisions based on the backlight type.</p>
<p>This value must be set in the backlight_properties
passed to <a class="reference internal" href="#c.devm_backlight_device_register" title="devm_backlight_device_register"><code class="xref c c-func docutils literal notranslate"><span class="pre">devm_backlight_device_register()</span></code></a>.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">state</span></code></dt><dd><p>The state of the backlight core.</p>
<p>The state is a bitmask. BL_CORE_FBBLANK is set when the display
is expected to be blank. BL_CORE_SUSPENDED is set when the
driver is suspended.</p>
<p>backlight drivers are expected to use <a class="reference internal" href="#c.backlight_is_blank" title="backlight_is_blank"><code class="xref c c-func docutils literal notranslate"><span class="pre">backlight_is_blank()</span></code></a>
in their <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">update_status()</span></code> operation rather than reading the
state property.</p>
<p>The state is maintained by the core and drivers may not modify it.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">scale</span></code></dt><dd><p>The type of the brightness scale.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">display_name</span></code></dt><dd><p>Optional name that can be registered to associate a
backlight device with a display device.</p>
</dd>
</dl>
</div>
<p><strong>Description</strong></p>
<p>This structure defines all the properties of a backlight.</p>
<dl class="c struct">
<dt class="sig sig-object c" id="c.backlight_device">
<span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">backlight_device</span></span></span><a class="headerlink" href="#c.backlight_device" title="Link to this definition">¶</a><br /></dt>
<dd><p>backlight device data</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Definition</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>struct backlight_device {
struct backlight_properties props;
struct mutex update_lock;
struct mutex ops_lock;
const struct backlight_ops *ops;
struct list_head entry;
struct device dev;
int use_count;
};
</pre></div>
</div>
<p><strong>Members</strong></p>
<dl>
<dt><code class="docutils literal notranslate"><span class="pre">props</span></code></dt><dd><p>Backlight properties</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">update_lock</span></code></dt><dd><p>The lock used when calling the <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">update_status()</span></code> operation.</p>
<p>update_lock is an internal backlight lock that serialise access
to the <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">update_status()</span></code> operation. The backlight core holds the update_lock
when calling the <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">update_status()</span></code> operation. The update_lock shall not
be used by backlight drivers.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">ops_lock</span></code></dt><dd><p>The lock used around everything related to backlight_ops.</p>
<p>ops_lock is an internal backlight lock that protects the ops pointer
and is used around all accesses to ops and when the operations are
invoked. The ops_lock shall not be used by backlight drivers.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">ops</span></code></dt><dd><p>Pointer to the backlight operations.</p>
<p>If ops is NULL, the driver that registered this device has been unloaded,
and if <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">class_get_devdata()</span></code> points to something in the body of that driver,
it is also invalid.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">entry</span></code></dt><dd><p>List entry of all registered backlight devices</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">dev</span></code></dt><dd><p>Parent device.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">use_count</span></code></dt><dd><p>The number of unblanked displays.</p>
</dd>
</dl>
</div>
<p><strong>Description</strong></p>
<p>This structure holds all data required by a backlight device.</p>
<dl class="c function">
<dt class="sig sig-object c" id="c.backlight_update_status">
<span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">backlight_update_status</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.backlight_device" title="backlight_device"><span class="n"><span class="pre">backlight_device</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">bd</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.backlight_update_status" title="Link to this definition">¶</a><br /></dt>
<dd><p>force an update of the backlight device status</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">backlight_device</span> <span class="pre">*bd</span></code></dt><dd><p>the backlight device</p>
</dd>
</dl>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.backlight_enable">
<span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">backlight_enable</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.backlight_device" title="backlight_device"><span class="n"><span class="pre">backlight_device</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">bd</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.backlight_enable" title="Link to this definition">¶</a><br /></dt>
<dd><p>Enable backlight</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">backlight_device</span> <span class="pre">*bd</span></code></dt><dd><p>the backlight device to enable</p>
</dd>
</dl>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.backlight_disable">
<span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">backlight_disable</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.backlight_device" title="backlight_device"><span class="n"><span class="pre">backlight_device</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">bd</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.backlight_disable" title="Link to this definition">¶</a><br /></dt>
<dd><p>Disable backlight</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">backlight_device</span> <span class="pre">*bd</span></code></dt><dd><p>the backlight device to disable</p>
</dd>
</dl>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.backlight_is_blank">
<span class="kt"><span class="pre">bool</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">backlight_is_blank</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.backlight_device" title="backlight_device"><span class="n"><span class="pre">backlight_device</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">bd</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.backlight_is_blank" title="Link to this definition">¶</a><br /></dt>
<dd><p>Return true if display is expected to be blank</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">struct</span> <span class="pre">backlight_device</span> <span class="pre">*bd</span></code></dt><dd><p>the backlight device</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Display is expected to be blank if any of these is true:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>1) if power in not UNBLANK
2) if state indicate BLANK or SUSPENDED
</pre></div>
</div>
<p>Returns true if display is expected to be blank, false otherwise.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.backlight_get_brightness">
<span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">backlight_get_brightness</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.backlight_device" title="backlight_device"><span class="n"><span class="pre">backlight_device</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">bd</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.backlight_get_brightness" title="Link to this definition">¶</a><br /></dt>
<dd><p>Returns the current brightness value</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">struct</span> <span class="pre">backlight_device</span> <span class="pre">*bd</span></code></dt><dd><p>the backlight device</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Returns the current brightness value, taking in consideration the current
state. If <a class="reference internal" href="#c.backlight_is_blank" title="backlight_is_blank"><code class="xref c c-func docutils literal notranslate"><span class="pre">backlight_is_blank()</span></code></a> returns true then return 0 as brightness
otherwise return the current brightness property value.</p>
<p>Backlight drivers are expected to use this function in their <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">update_status()</span></code>
operation to get the brightness value.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.bl_get_data">
<span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">bl_get_data</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.backlight_device" title="backlight_device"><span class="n"><span class="pre">backlight_device</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">bl_dev</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.bl_get_data" title="Link to this definition">¶</a><br /></dt>
<dd><p>access devdata</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">backlight_device</span> <span class="pre">*bl_dev</span></code></dt><dd><p>pointer to backlight device</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>When a backlight device is registered the driver has the possibility
to supply a void * devdata. <a class="reference internal" href="#c.bl_get_data" title="bl_get_data"><code class="xref c c-func docutils literal notranslate"><span class="pre">bl_get_data()</span></code></a> return a pointer to the
devdata.</p>
<p>pointer to devdata stored while registering the backlight device.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.backlight_force_update">
<span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">backlight_force_update</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.backlight_device" title="backlight_device"><span class="n"><span class="pre">backlight_device</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">bd</span></span>, <span class="k"><span class="pre">enum</span></span><span class="w"> </span><a class="reference internal" href="#c.backlight_update_reason" title="backlight_update_reason"><span class="n"><span class="pre">backlight_update_reason</span></span></a><span class="w"> </span><span class="n"><span class="pre">reason</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.backlight_force_update" title="Link to this definition">¶</a><br /></dt>
<dd><p>tell the backlight subsystem that hardware state has changed</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">backlight_device</span> <span class="pre">*bd</span></code></dt><dd><p>the backlight device to update</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">enum</span> <span class="pre">backlight_update_reason</span> <span class="pre">reason</span></code></dt><dd><p>reason for update</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Updates the internal state of the backlight in response to a hardware event,
and generates an uevent to notify userspace. A backlight driver shall call
<a class="reference internal" href="#c.backlight_force_update" title="backlight_force_update"><code class="xref c c-func docutils literal notranslate"><span class="pre">backlight_force_update()</span></code></a> when the backlight is changed using, for example,
a hot-key. The updated brightness is read using <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">get_brightness()</span></code> and the
brightness value is reported using an uevent.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.backlight_device_get_by_name">
<span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.backlight_device" title="backlight_device"><span class="n"><span class="pre">backlight_device</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">backlight_device_get_by_name</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">name</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.backlight_device_get_by_name" title="Link to this definition">¶</a><br /></dt>
<dd><p>Get backlight device by name</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*name</span></code></dt><dd><p>Device name</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>This function looks up a backlight device by its name. It obtains a reference
on the backlight device and it is the caller’s responsibility to drop the
reference by calling <a class="reference internal" href="../driver-api/infrastructure.html#c.put_device" title="put_device"><code class="xref c c-func docutils literal notranslate"><span class="pre">put_device()</span></code></a>.</p>
<p><strong>Return</strong></p>
<p>A pointer to the backlight device if found, otherwise NULL.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.devm_backlight_device_register">
<span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.backlight_device" title="backlight_device"><span class="n"><span class="pre">backlight_device</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">devm_backlight_device_register</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="../driver-api/infrastructure.html#c.device" title="device"><span class="n"><span class="pre">device</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">dev</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">name</span></span>, <span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="../driver-api/infrastructure.html#c.device" title="device"><span class="n"><span class="pre">device</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">parent</span></span>, <span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">devdata</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.backlight_ops" title="backlight_ops"><span class="n"><span class="pre">backlight_ops</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">ops</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.backlight_properties" title="backlight_properties"><span class="n"><span class="pre">backlight_properties</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">props</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.devm_backlight_device_register" title="Link to this definition">¶</a><br /></dt>
<dd><p>register a new backlight device</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">device</span> <span class="pre">*dev</span></code></dt><dd><p>the device to register</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*name</span></code></dt><dd><p>the name of the device</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">device</span> <span class="pre">*parent</span></code></dt><dd><p>a pointer to the parent device (often the same as <strong>dev</strong>)</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">void</span> <span class="pre">*devdata</span></code></dt><dd><p>an optional pointer to be stored for private driver use</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">struct</span> <span class="pre">backlight_ops</span> <span class="pre">*ops</span></code></dt><dd><p>the backlight operations structure</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">struct</span> <span class="pre">backlight_properties</span> <span class="pre">*props</span></code></dt><dd><p>the backlight properties</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Creates and registers new backlight device. When a backlight device
is registered the configuration must be specified in the <strong>props</strong>
parameter. See description of <a class="reference internal" href="#c.backlight_properties" title="backlight_properties"><code class="xref c c-type docutils literal notranslate"><span class="pre">backlight_properties</span></code></a>.</p>
<p><code class="xref c c-struct broken_xref docutils literal notranslate"><span class="pre">struct</span> <span class="pre">backlight</span></code> on success, or an ERR_PTR on error</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.devm_backlight_device_unregister">
<span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">devm_backlight_device_unregister</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="../driver-api/infrastructure.html#c.device" title="device"><span class="n"><span class="pre">device</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">dev</span></span>, <span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.backlight_device" title="backlight_device"><span class="n"><span class="pre">backlight_device</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">bd</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.devm_backlight_device_unregister" title="Link to this definition">¶</a><br /></dt>
<dd><p>unregister backlight device</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">device</span> <span class="pre">*dev</span></code></dt><dd><p>the device to unregister</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">backlight_device</span> <span class="pre">*bd</span></code></dt><dd><p>the backlight device to unregister</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Deallocates a backlight allocated with <a class="reference internal" href="#c.devm_backlight_device_register" title="devm_backlight_device_register"><code class="xref c c-func docutils literal notranslate"><span class="pre">devm_backlight_device_register()</span></code></a>.
Normally this function will not need to be called and the resource management
code will ensure that the resources are freed.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.of_find_backlight_by_node">
<span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.backlight_device" title="backlight_device"><span class="n"><span class="pre">backlight_device</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">of_find_backlight_by_node</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">device_node</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">node</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.of_find_backlight_by_node" title="Link to this definition">¶</a><br /></dt>
<dd><p>find backlight device by device-tree node</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">device_node</span> <span class="pre">*node</span></code></dt><dd><p>device-tree node of the backlight device</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Returns a pointer to the backlight device corresponding to the given DT
node or NULL if no such backlight device exists or if the device hasn’t
been probed yet.</p>
<p>This function obtains a reference on the backlight device and it is the
caller’s responsibility to drop the reference by calling <a class="reference internal" href="../driver-api/infrastructure.html#c.put_device" title="put_device"><code class="xref c c-func docutils literal notranslate"><span class="pre">put_device()</span></code></a> on
the backlight device’s .dev field.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.devm_of_find_backlight">
<span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.backlight_device" title="backlight_device"><span class="n"><span class="pre">backlight_device</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">devm_of_find_backlight</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="../driver-api/infrastructure.html#c.device" title="device"><span class="n"><span class="pre">device</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">dev</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.devm_of_find_backlight" title="Link to this definition">¶</a><br /></dt>
<dd><p>find backlight for a device</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">device</span> <span class="pre">*dev</span></code></dt><dd><p>the device</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>This function looks for a property named ‘backlight’ on the DT node
connected to <strong>dev</strong> and looks up the backlight device. The lookup is
device managed so the reference to the backlight device is automatically
dropped on driver detach.</p>
<p>A pointer to the backlight device if found.
Error pointer -EPROBE_DEFER if the DT property is set, but no backlight
device is found. NULL if there’s no backlight property.</p>
</div>
</section>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
©The kernel development community.
|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.1.3</a>
& <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
|
<a href="../_sources/gpu/backlight.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>