Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: MIT */
2#ifndef _XE_I2C_H_
3#define _XE_I2C_H_
4
5#include <linux/bits.h>
6#include <linux/notifier.h>
7#include <linux/types.h>
8#include <linux/workqueue.h>
9
10struct device;
11struct fwnode_handle;
12struct i2c_adapter;
13struct i2c_client;
14struct irq_domain;
15struct platform_device;
16struct xe_device;
17struct xe_mmio;
18
19#define XE_I2C_MAX_CLIENTS 3
20
21#define XE_I2C_EP_COOKIE_DEVICE 0xde
22
23/* Endpoint Capabilities */
24#define XE_I2C_EP_CAP_IRQ BIT(0)
25
26struct xe_i2c_endpoint {
27 u8 cookie;
28 u8 capabilities;
29 u16 addr[XE_I2C_MAX_CLIENTS];
30};
31
32struct xe_i2c {
33 struct fwnode_handle *adapter_node;
34 struct platform_device *pdev;
35 struct i2c_adapter *adapter;
36 struct i2c_client *client[XE_I2C_MAX_CLIENTS];
37
38 struct notifier_block bus_notifier;
39 struct work_struct work;
40
41 struct irq_domain *irqdomain;
42 int adapter_irq;
43
44 struct xe_i2c_endpoint ep;
45 struct device *drm_dev;
46
47 struct xe_mmio *mmio;
48};
49
50#if IS_ENABLED(CONFIG_I2C)
51int xe_i2c_probe(struct xe_device *xe);
52bool xe_i2c_present(struct xe_device *xe);
53void xe_i2c_irq_handler(struct xe_device *xe, u32 master_ctl);
54void xe_i2c_irq_postinstall(struct xe_device *xe);
55void xe_i2c_irq_reset(struct xe_device *xe);
56void xe_i2c_pm_suspend(struct xe_device *xe);
57void xe_i2c_pm_resume(struct xe_device *xe, bool d3cold);
58#else
59static inline int xe_i2c_probe(struct xe_device *xe) { return 0; }
60static inline bool xe_i2c_present(struct xe_device *xe) { return false; }
61static inline void xe_i2c_irq_handler(struct xe_device *xe, u32 master_ctl) { }
62static inline void xe_i2c_irq_postinstall(struct xe_device *xe) { }
63static inline void xe_i2c_irq_reset(struct xe_device *xe) { }
64static inline void xe_i2c_pm_suspend(struct xe_device *xe) { }
65static inline void xe_i2c_pm_resume(struct xe_device *xe, bool d3cold) { }
66#endif
67
68#endif