Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/include/drm/bridge/samsung-dsim.h
26288 views
1
/* SPDX-License-Identifier: GPL-2.0+ */
2
/*
3
* Copyright (C) 2022 Amarula Solutions(India)
4
* Author: Jagan Teki <[email protected]>
5
*/
6
7
#ifndef __SAMSUNG_DSIM__
8
#define __SAMSUNG_DSIM__
9
10
#include <linux/gpio/consumer.h>
11
#include <linux/regulator/consumer.h>
12
13
#include <drm/drm_atomic_helper.h>
14
#include <drm/drm_bridge.h>
15
#include <drm/drm_mipi_dsi.h>
16
#include <drm/drm_of.h>
17
18
struct platform_device;
19
struct samsung_dsim;
20
21
#define DSIM_STATE_ENABLED BIT(0)
22
#define DSIM_STATE_INITIALIZED BIT(1)
23
#define DSIM_STATE_CMD_LPM BIT(2)
24
#define DSIM_STATE_VIDOUT_AVAILABLE BIT(3)
25
26
enum samsung_dsim_type {
27
DSIM_TYPE_EXYNOS3250,
28
DSIM_TYPE_EXYNOS4210,
29
DSIM_TYPE_EXYNOS5410,
30
DSIM_TYPE_EXYNOS5422,
31
DSIM_TYPE_EXYNOS5433,
32
DSIM_TYPE_IMX8MM,
33
DSIM_TYPE_IMX8MP,
34
DSIM_TYPE_COUNT,
35
};
36
37
#define samsung_dsim_hw_is_exynos(hw) \
38
((hw) >= DSIM_TYPE_EXYNOS3250 && (hw) <= DSIM_TYPE_EXYNOS5433)
39
40
struct samsung_dsim_transfer {
41
struct list_head list;
42
struct completion completed;
43
int result;
44
struct mipi_dsi_packet packet;
45
u16 flags;
46
u16 tx_done;
47
48
u8 *rx_payload;
49
u16 rx_len;
50
u16 rx_done;
51
};
52
53
struct samsung_dsim_driver_data {
54
const unsigned int *reg_ofs;
55
unsigned int plltmr_reg;
56
unsigned int has_freqband:1;
57
unsigned int has_clklane_stop:1;
58
unsigned int has_broken_fifoctrl_emptyhdr:1;
59
unsigned int num_clks;
60
unsigned int min_freq;
61
unsigned int max_freq;
62
unsigned int wait_for_reset;
63
unsigned int num_bits_resol;
64
unsigned int pll_p_offset;
65
const unsigned int *reg_values;
66
unsigned int pll_fin_min;
67
unsigned int pll_fin_max;
68
u16 m_min;
69
u16 m_max;
70
};
71
72
struct samsung_dsim_host_ops {
73
int (*register_host)(struct samsung_dsim *dsim);
74
void (*unregister_host)(struct samsung_dsim *dsim);
75
int (*attach)(struct samsung_dsim *dsim, struct mipi_dsi_device *device);
76
void (*detach)(struct samsung_dsim *dsim, struct mipi_dsi_device *device);
77
irqreturn_t (*te_irq_handler)(struct samsung_dsim *dsim);
78
};
79
80
struct samsung_dsim_plat_data {
81
enum samsung_dsim_type hw_type;
82
const struct samsung_dsim_host_ops *host_ops;
83
};
84
85
struct samsung_dsim {
86
struct mipi_dsi_host dsi_host;
87
struct drm_bridge bridge;
88
struct drm_bridge *out_bridge;
89
struct device *dev;
90
struct drm_display_mode mode;
91
92
void __iomem *reg_base;
93
struct phy *phy;
94
struct clk **clks;
95
struct clk *pll_clk;
96
struct regulator_bulk_data supplies[2];
97
int irq;
98
struct gpio_desc *te_gpio;
99
100
u32 pll_clk_rate;
101
u32 burst_clk_rate;
102
u32 hs_clock;
103
u32 esc_clk_rate;
104
u32 lanes;
105
u32 mode_flags;
106
u32 format;
107
108
bool swap_dn_dp_clk;
109
bool swap_dn_dp_data;
110
int state;
111
struct drm_property *brightness;
112
struct completion completed;
113
114
spinlock_t transfer_lock; /* protects transfer_list */
115
struct list_head transfer_list;
116
117
const struct samsung_dsim_driver_data *driver_data;
118
const struct samsung_dsim_plat_data *plat_data;
119
120
void *priv;
121
};
122
123
extern int samsung_dsim_probe(struct platform_device *pdev);
124
extern void samsung_dsim_remove(struct platform_device *pdev);
125
extern const struct dev_pm_ops samsung_dsim_pm_ops;
126
127
#endif /* __SAMSUNG_DSIM__ */
128
129