drivers/media/platform/samsung/exynos4-is/fimc-is-i2c.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/samsung/exynos4-is/fimc-is-i2c.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/samsung/exynos4-is/fimc-is-i2c.c- Extension
.c- Size
- 3856 bytes
- Lines
- 157
- 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.
- 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/clk.hlinux/module.hlinux/i2c.hlinux/platform_device.hlinux/pm_runtime.hlinux/slab.hfimc-is-i2c.h
Detected Declarations
struct fimc_is_i2cfunction is_i2c_funcfunction fimc_is_i2c_probefunction fimc_is_i2c_removefunction fimc_is_i2c_runtime_suspendfunction fimc_is_i2c_runtime_resumefunction fimc_is_i2c_suspendfunction fimc_is_i2c_resumefunction fimc_is_register_i2c_driverfunction fimc_is_unregister_i2c_driver
Annotated Snippet
struct fimc_is_i2c {
struct i2c_adapter adapter;
struct clk *clock;
};
/*
* An empty algorithm is used as the actual I2C bus controller driver
* is implemented in the FIMC-IS subsystem firmware and the host CPU
* doesn't access the I2C bus controller.
*/
static u32 is_i2c_func(struct i2c_adapter *adap)
{
return I2C_FUNC_I2C;
}
static const struct i2c_algorithm fimc_is_i2c_algorithm = {
.functionality = is_i2c_func,
};
static int fimc_is_i2c_probe(struct platform_device *pdev)
{
struct device_node *node = pdev->dev.of_node;
struct fimc_is_i2c *isp_i2c;
struct i2c_adapter *i2c_adap;
int ret;
isp_i2c = devm_kzalloc(&pdev->dev, sizeof(*isp_i2c), GFP_KERNEL);
if (!isp_i2c)
return -ENOMEM;
isp_i2c->clock = devm_clk_get(&pdev->dev, "i2c_isp");
if (IS_ERR(isp_i2c->clock)) {
dev_err(&pdev->dev, "failed to get the clock\n");
return PTR_ERR(isp_i2c->clock);
}
i2c_adap = &isp_i2c->adapter;
i2c_adap->dev.of_node = node;
i2c_adap->dev.parent = &pdev->dev;
strscpy(i2c_adap->name, "exynos4x12-isp-i2c", sizeof(i2c_adap->name));
i2c_adap->owner = THIS_MODULE;
i2c_adap->algo = &fimc_is_i2c_algorithm;
platform_set_drvdata(pdev, isp_i2c);
pm_runtime_enable(&pdev->dev);
ret = i2c_add_adapter(i2c_adap);
if (ret < 0)
goto err_pm_dis;
/*
* Client drivers of this adapter don't do any I2C transfers as that
* is handled by the ISP firmware. But we rely on the runtime PM
* state propagation from the clients up to the adapter driver so
* clear the ignore_children flags here. PM rutnime calls are not
* used in probe() handler of clients of this adapter so there is
* no issues with clearing the flag right after registering the I2C
* adapter.
*/
pm_suspend_ignore_children(&i2c_adap->dev, false);
return 0;
err_pm_dis:
pm_runtime_disable(&pdev->dev);
return ret;
}
static void fimc_is_i2c_remove(struct platform_device *pdev)
{
struct fimc_is_i2c *isp_i2c = platform_get_drvdata(pdev);
pm_runtime_disable(&pdev->dev);
i2c_del_adapter(&isp_i2c->adapter);
}
#ifdef CONFIG_PM
static int fimc_is_i2c_runtime_suspend(struct device *dev)
{
struct fimc_is_i2c *isp_i2c = dev_get_drvdata(dev);
clk_disable_unprepare(isp_i2c->clock);
return 0;
}
static int fimc_is_i2c_runtime_resume(struct device *dev)
{
struct fimc_is_i2c *isp_i2c = dev_get_drvdata(dev);
return clk_prepare_enable(isp_i2c->clock);
}
#endif
Annotation
- Immediate include surface: `linux/clk.h`, `linux/module.h`, `linux/i2c.h`, `linux/platform_device.h`, `linux/pm_runtime.h`, `linux/slab.h`, `fimc-is-i2c.h`.
- Detected declarations: `struct fimc_is_i2c`, `function is_i2c_func`, `function fimc_is_i2c_probe`, `function fimc_is_i2c_remove`, `function fimc_is_i2c_runtime_suspend`, `function fimc_is_i2c_runtime_resume`, `function fimc_is_i2c_suspend`, `function fimc_is_i2c_resume`, `function fimc_is_register_i2c_driver`, `function fimc_is_unregister_i2c_driver`.
- Atlas domain: Driver Families / drivers/media.
- 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.