Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / media / cec / platform / s5p / s5p_cec.h
blob34d033b20f964f94a12c0ef3332cd590496fe205
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* drivers/media/platform/s5p-cec/s5p_cec.h
4 * Samsung S5P HDMI CEC driver
6 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 */
9 #ifndef _S5P_CEC_H_
10 #define _S5P_CEC_H_ __FILE__
12 #include <linux/clk.h>
13 #include <linux/interrupt.h>
14 #include <linux/kernel.h>
15 #include <linux/mfd/syscon.h>
16 #include <linux/module.h>
17 #include <linux/of.h>
18 #include <linux/platform_device.h>
19 #include <linux/pm_runtime.h>
20 #include <linux/timer.h>
21 #include <linux/workqueue.h>
22 #include <media/cec.h>
24 #include "exynos_hdmi_cec.h"
25 #include "regs-cec.h"
26 #include "s5p_cec.h"
28 #define CEC_NAME "s5p-cec"
30 #define CEC_STATUS_TX_RUNNING (1 << 0)
31 #define CEC_STATUS_TX_TRANSFERRING (1 << 1)
32 #define CEC_STATUS_TX_DONE (1 << 2)
33 #define CEC_STATUS_TX_ERROR (1 << 3)
34 #define CEC_STATUS_TX_NACK (1 << 4)
35 #define CEC_STATUS_TX_BYTES (0xFF << 8)
36 #define CEC_STATUS_RX_RUNNING (1 << 16)
37 #define CEC_STATUS_RX_RECEIVING (1 << 17)
38 #define CEC_STATUS_RX_DONE (1 << 18)
39 #define CEC_STATUS_RX_ERROR (1 << 19)
40 #define CEC_STATUS_RX_BCAST (1 << 20)
41 #define CEC_STATUS_RX_BYTES (0xFF << 24)
43 #define CEC_WORKER_TX_DONE (1 << 0)
44 #define CEC_WORKER_RX_MSG (1 << 1)
46 /* CEC Rx buffer size */
47 #define CEC_RX_BUFF_SIZE 16
48 /* CEC Tx buffer size */
49 #define CEC_TX_BUFF_SIZE 16
51 enum cec_state {
52 STATE_IDLE,
53 STATE_BUSY,
54 STATE_DONE,
55 STATE_NACK,
56 STATE_ERROR
59 struct cec_notifier;
61 struct s5p_cec_dev {
62 struct cec_adapter *adap;
63 struct clk *clk;
64 struct device *dev;
65 struct mutex lock;
66 struct regmap *pmu;
67 struct cec_notifier *notifier;
68 int irq;
69 void __iomem *reg;
71 enum cec_state rx;
72 enum cec_state tx;
73 struct cec_msg msg;
76 #endif /* _S5P_CEC_H_ */