drivers/video/backlight/rave-sp-backlight.c
Source file repositories/reference/linux-study-clean/drivers/video/backlight/rave-sp-backlight.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/backlight/rave-sp-backlight.c- Extension
.c- Size
- 2427 bytes
- Lines
- 91
- Domain
- Driver Families
- Bucket
- drivers/video
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/backlight.hlinux/kernel.hlinux/mod_devicetable.hlinux/module.hlinux/mfd/rave-sp.hlinux/of.hlinux/platform_device.h
Detected Declarations
function Copyrightfunction rave_sp_backlight_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* LCD Backlight driver for RAVE SP
*
* Copyright (C) 2018 Zodiac Inflight Innovations
*
*/
#include <linux/backlight.h>
#include <linux/kernel.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/mfd/rave-sp.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#define RAVE_SP_BACKLIGHT_LCD_EN BIT(7)
static int rave_sp_backlight_update_status(struct backlight_device *bd)
{
const struct backlight_properties *p = &bd->props;
const u8 intensity =
(p->power == BACKLIGHT_POWER_ON) ? p->brightness : 0;
struct rave_sp *sp = dev_get_drvdata(&bd->dev);
u8 cmd[] = {
[0] = RAVE_SP_CMD_SET_BACKLIGHT,
[1] = 0,
[2] = intensity ? RAVE_SP_BACKLIGHT_LCD_EN | intensity : 0,
[3] = 0,
[4] = 0,
};
return rave_sp_exec(sp, cmd, sizeof(cmd), NULL, 0);
}
static const struct backlight_ops rave_sp_backlight_ops = {
.options = BL_CORE_SUSPENDRESUME,
.update_status = rave_sp_backlight_update_status,
};
static struct backlight_properties rave_sp_backlight_props = {
.type = BACKLIGHT_PLATFORM,
.max_brightness = 100,
.brightness = 50,
};
static int rave_sp_backlight_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct backlight_device *bd;
bd = devm_backlight_device_register(dev, pdev->name, dev,
dev_get_drvdata(dev->parent),
&rave_sp_backlight_ops,
&rave_sp_backlight_props);
if (IS_ERR(bd))
return PTR_ERR(bd);
/*
* If there is a phandle pointing to the device node we can
* assume that another device will manage the status changes.
* If not we make sure the backlight is in a consistent state.
*/
if (!dev->of_node->phandle)
backlight_update_status(bd);
return 0;
}
static const struct of_device_id rave_sp_backlight_of_match[] = {
{ .compatible = "zii,rave-sp-backlight" },
{}
};
static struct platform_driver rave_sp_backlight_driver = {
.probe = rave_sp_backlight_probe,
.driver = {
.name = KBUILD_MODNAME,
.of_match_table = rave_sp_backlight_of_match,
},
};
module_platform_driver(rave_sp_backlight_driver);
MODULE_DEVICE_TABLE(of, rave_sp_backlight_of_match);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Andrey Vostrikov <andrey.vostrikov@cogentembedded.com>");
MODULE_AUTHOR("Nikita Yushchenko <nikita.yoush@cogentembedded.com>");
MODULE_AUTHOR("Andrey Smirnov <andrew.smirnov@gmail.com>");
MODULE_DESCRIPTION("RAVE SP Backlight driver");
Annotation
- Immediate include surface: `linux/backlight.h`, `linux/kernel.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/mfd/rave-sp.h`, `linux/of.h`, `linux/platform_device.h`.
- Detected declarations: `function Copyright`, `function rave_sp_backlight_probe`.
- Atlas domain: Driver Families / drivers/video.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.