drivers/media/i2c/adp1653.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/adp1653.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/adp1653.c- Extension
.c- Size
- 13906 bytes
- Lines
- 550
- Domain
- Driver Families
- Bucket
- drivers/media
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/delay.hlinux/module.hlinux/i2c.hlinux/slab.hlinux/of.hlinux/gpio/consumer.hmedia/i2c/adp1653.hmedia/v4l2-device.h
Detected Declarations
function Copyrightfunction adp1653_get_faultfunction adp1653_strobefunction adp1653_get_ctrlfunction adp1653_set_ctrlfunction adp1653_init_controlsfunction adp1653_init_devicefunction __adp1653_set_powerfunction adp1653_set_powerfunction adp1653_openfunction adp1653_closefunction adp1653_suspendfunction adp1653_resumefunction adp1653_of_initfunction adp1653_probefunction adp1653_remove
Annotated Snippet
if (!client->dev.platform_data) {
dev_err(&client->dev,
"Neither DT not platform data provided\n");
return -EINVAL;
}
flash->platform_data = client->dev.platform_data;
}
mutex_init(&flash->power_lock);
v4l2_i2c_subdev_init(&flash->subdev, client, &adp1653_ops);
flash->subdev.internal_ops = &adp1653_internal_ops;
flash->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
ret = adp1653_init_controls(flash);
if (ret)
goto free_and_quit;
ret = media_entity_pads_init(&flash->subdev.entity, 0, NULL);
if (ret < 0)
goto free_and_quit;
flash->subdev.entity.function = MEDIA_ENT_F_FLASH;
return 0;
free_and_quit:
dev_err(&client->dev, "adp1653: failed to register device\n");
v4l2_ctrl_handler_free(&flash->ctrls);
return ret;
}
static void adp1653_remove(struct i2c_client *client)
{
struct v4l2_subdev *subdev = i2c_get_clientdata(client);
struct adp1653_flash *flash = to_adp1653_flash(subdev);
v4l2_device_unregister_subdev(&flash->subdev);
v4l2_ctrl_handler_free(&flash->ctrls);
media_entity_cleanup(&flash->subdev.entity);
}
static const struct i2c_device_id adp1653_id_table[] = {
{ .name = ADP1653_NAME },
{ }
};
MODULE_DEVICE_TABLE(i2c, adp1653_id_table);
static const struct dev_pm_ops adp1653_pm_ops = {
.suspend = adp1653_suspend,
.resume = adp1653_resume,
};
static struct i2c_driver adp1653_i2c_driver = {
.driver = {
.name = ADP1653_NAME,
.pm = &adp1653_pm_ops,
},
.probe = adp1653_probe,
.remove = adp1653_remove,
.id_table = adp1653_id_table,
};
module_i2c_driver(adp1653_i2c_driver);
MODULE_AUTHOR("Sakari Ailus <sakari.ailus@nokia.com>");
MODULE_DESCRIPTION("Analog Devices ADP1653 LED flash driver");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `linux/delay.h`, `linux/module.h`, `linux/i2c.h`, `linux/slab.h`, `linux/of.h`, `linux/gpio/consumer.h`, `media/i2c/adp1653.h`, `media/v4l2-device.h`.
- Detected declarations: `function Copyright`, `function adp1653_get_fault`, `function adp1653_strobe`, `function adp1653_get_ctrl`, `function adp1653_set_ctrl`, `function adp1653_init_controls`, `function adp1653_init_device`, `function __adp1653_set_power`, `function adp1653_set_power`, `function adp1653_open`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.