drivers/staging/nvec/nvec_paz00.c
Source file repositories/reference/linux-study-clean/drivers/staging/nvec/nvec_paz00.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/nvec/nvec_paz00.c- Extension
.c- Size
- 1849 bytes
- Lines
- 81
- Domain
- Driver Families
- Bucket
- drivers/staging
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/err.hlinux/slab.hlinux/leds.hlinux/platform_device.hnvec.h
Detected Declarations
struct nvec_ledfunction nvec_led_brightness_setfunction nvec_paz00_probe
Annotated Snippet
struct nvec_led {
struct led_classdev cdev;
struct nvec_chip *nvec;
};
static void nvec_led_brightness_set(struct led_classdev *led_cdev,
enum led_brightness value)
{
struct nvec_led *led = container_of(led_cdev, struct nvec_led, cdev);
unsigned char buf[] = NVEC_LED_REQ;
buf[4] = value;
nvec_write_async(led->nvec, buf, sizeof(buf));
led->cdev.brightness = value;
}
static int nvec_paz00_probe(struct platform_device *pdev)
{
struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent);
struct nvec_led *led;
int ret = 0;
led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL);
if (!led)
return -ENOMEM;
led->cdev.max_brightness = NVEC_LED_MAX;
led->cdev.brightness_set = nvec_led_brightness_set;
led->cdev.name = "paz00-led";
led->cdev.flags |= LED_CORE_SUSPENDRESUME;
led->nvec = nvec;
platform_set_drvdata(pdev, led);
ret = devm_led_classdev_register(&pdev->dev, &led->cdev);
if (ret < 0)
return ret;
/* to expose the default value to userspace */
led->cdev.brightness = 0;
return 0;
}
static struct platform_driver nvec_paz00_driver = {
.probe = nvec_paz00_probe,
.driver = {
.name = "nvec-paz00",
},
};
module_platform_driver(nvec_paz00_driver);
MODULE_AUTHOR("Ilya Petrov <ilya.muromec@gmail.com>");
MODULE_DESCRIPTION("Tegra NVEC PAZ00 driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:nvec-paz00");
Annotation
- Immediate include surface: `linux/module.h`, `linux/err.h`, `linux/slab.h`, `linux/leds.h`, `linux/platform_device.h`, `nvec.h`.
- Detected declarations: `struct nvec_led`, `function nvec_led_brightness_set`, `function nvec_paz00_probe`.
- Atlas domain: Driver Families / drivers/staging.
- 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.