Skip to content

Commit 44d8ca1

Browse files
pinchartltomba
authored andcommitted
drm: omapdrm: Move FEAT_DSI_* features to dsi driver
The FEAT_DSI_* features are specific to the DSI, move them from the omap_dss_features structure to the dsi driver. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
1 parent 34dfb85 commit 44d8ca1

3 files changed

Lines changed: 88 additions & 72 deletions

File tree

‎drivers/gpu/drm/omapdrm/dss/dsi.c‎

Lines changed: 88 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include <linux/of_graph.h>
4545
#include <linux/of_platform.h>
4646
#include <linux/component.h>
47+
#include <linux/sys_soc.h>
4748

4849
#include <video/mipi_display.h>
4950

@@ -312,10 +313,20 @@ struct dsi_module_id_data {
312313
int id;
313314
};
314315

316+
enum dsi_quirks {
317+
DSI_QUIRK_PLL_PWR_BUG = (1 << 0), /* DSI-PLL power command 0x3 is not working */
318+
DSI_QUIRK_DCS_CMD_CONFIG_VC = (1 << 1),
319+
DSI_QUIRK_VC_OCP_WIDTH = (1 << 2),
320+
DSI_QUIRK_REVERSE_TXCLKESC = (1 << 3),
321+
DSI_QUIRK_GNQ = (1 << 4),
322+
DSI_QUIRK_PHY_DCC = (1 << 5),
323+
};
324+
315325
struct dsi_of_data {
316326
enum dsi_model model;
317327
const struct dss_pll_hw *pll_hw;
318328
const struct dsi_module_id_data *modules;
329+
enum dsi_quirks quirks;
319330
};
320331

321332
struct dsi_data {
@@ -418,8 +429,6 @@ struct dsi_packet_sent_handler_data {
418429
struct completion *completion;
419430
};
420431

421-
static const struct of_device_id dsi_of_match[];
422-
423432
#ifdef DSI_PERF_MEASURE
424433
static bool dsi_perf;
425434
module_param(dsi_perf, bool, 0644);
@@ -1202,6 +1211,7 @@ static int dsi_regulator_init(struct platform_device *dsidev)
12021211

12031212
static void _dsi_print_reset_status(struct platform_device *dsidev)
12041213
{
1214+
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
12051215
u32 l;
12061216
int b0, b1, b2;
12071217

@@ -1210,7 +1220,7 @@ static void _dsi_print_reset_status(struct platform_device *dsidev)
12101220
* I/O. */
12111221
l = dsi_read_reg(dsidev, DSI_DSIPHY_CFG5);
12121222

1213-
if (dss_has_feature(FEAT_DSI_REVERSE_TXCLKESC)) {
1223+
if (dsi->data->quirks & DSI_QUIRK_REVERSE_TXCLKESC) {
12141224
b0 = 28;
12151225
b1 = 27;
12161226
b2 = 26;
@@ -1365,11 +1375,12 @@ enum dsi_pll_power_state {
13651375
static int dsi_pll_power(struct platform_device *dsidev,
13661376
enum dsi_pll_power_state state)
13671377
{
1378+
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
13681379
int t = 0;
13691380

13701381
/* DSI-PLL power command 0x3 is not working */
1371-
if (dss_has_feature(FEAT_DSI_PLL_PWR_BUG) &&
1372-
state == DSI_PLL_POWER_ON_DIV)
1382+
if ((dsi->data->quirks & DSI_QUIRK_PLL_PWR_BUG) &&
1383+
state == DSI_PLL_POWER_ON_DIV)
13731384
state = DSI_PLL_POWER_ON_ALL;
13741385

13751386
/* PLL_PWR_CMD */
@@ -1789,13 +1800,14 @@ static int dsi_cio_power(struct platform_device *dsidev,
17891800

17901801
static unsigned dsi_get_line_buf_size(struct platform_device *dsidev)
17911802
{
1803+
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
17921804
int val;
17931805

17941806
/* line buffer on OMAP3 is 1024 x 24bits */
17951807
/* XXX: for some reason using full buffer size causes
17961808
* considerable TX slowdown with update sizes that fill the
17971809
* whole buffer */
1798-
if (!dss_has_feature(FEAT_DSI_GNQ))
1810+
if (!(dsi->data->quirks & DSI_QUIRK_GNQ))
17991811
return 1023 * 3;
18001812

18011813
val = REG_GET(dsidev, DSI_GNQ, 14, 12); /* VP1_LINE_BUFFER_SIZE */
@@ -1888,6 +1900,7 @@ static inline unsigned ddr2ns(struct platform_device *dsidev, unsigned ddr)
18881900

18891901
static void dsi_cio_timings(struct platform_device *dsidev)
18901902
{
1903+
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
18911904
u32 r;
18921905
u32 ths_prepare, ths_prepare_ths_zero, ths_trail, ths_exit;
18931906
u32 tlpx_half, tclk_trail, tclk_zero;
@@ -1950,7 +1963,7 @@ static void dsi_cio_timings(struct platform_device *dsidev)
19501963
r = FLD_MOD(r, tclk_trail, 15, 8);
19511964
r = FLD_MOD(r, tclk_zero, 7, 0);
19521965

1953-
if (dss_has_feature(FEAT_DSI_PHY_DCC)) {
1966+
if (dsi->data->quirks & DSI_QUIRK_PHY_DCC) {
19541967
r = FLD_MOD(r, 0, 21, 21); /* DCCEN = disable */
19551968
r = FLD_MOD(r, 1, 22, 22); /* CLKINP_DIVBY2EN = enable */
19561969
r = FLD_MOD(r, 1, 23, 23); /* CLKINP_SEL = enable */
@@ -2022,7 +2035,7 @@ static int dsi_cio_wait_tx_clk_esc_reset(struct platform_device *dsidev)
20222035
static const u8 offsets_new[] = { 24, 25, 26, 27, 28 };
20232036
const u8 *offsets;
20242037

2025-
if (dss_has_feature(FEAT_DSI_REVERSE_TXCLKESC))
2038+
if (dsi->data->quirks & DSI_QUIRK_REVERSE_TXCLKESC)
20262039
offsets = offsets_old;
20272040
else
20282041
offsets = offsets_new;
@@ -2513,7 +2526,7 @@ static void dsi_vc_initial_config(struct platform_device *dsidev, int channel)
25132526
r = FLD_MOD(r, 1, 7, 7); /* CS_TX_EN */
25142527
r = FLD_MOD(r, 1, 8, 8); /* ECC_TX_EN */
25152528
r = FLD_MOD(r, 0, 9, 9); /* MODE_SPEED, high speed on/off */
2516-
if (dss_has_feature(FEAT_DSI_VC_OCP_WIDTH))
2529+
if (dsi->data->quirks & DSI_QUIRK_VC_OCP_WIDTH)
25172530
r = FLD_MOD(r, 3, 11, 10); /* OCP_WIDTH = 32 bit */
25182531

25192532
r = FLD_MOD(r, 4, 29, 27); /* DMA_RX_REQ_NB = no dma */
@@ -2548,7 +2561,7 @@ static int dsi_vc_config_source(struct platform_device *dsidev, int channel,
25482561
REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), source, 1, 1);
25492562

25502563
/* DCS_CMD_ENABLE */
2551-
if (dss_has_feature(FEAT_DSI_DCS_CMD_CONFIG_VC)) {
2564+
if (dsi->data->quirks & DSI_QUIRK_DCS_CMD_CONFIG_VC) {
25522565
bool enable = source == DSI_VC_SOURCE_VP;
25532566
REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), enable, 30, 30);
25542567
}
@@ -3681,7 +3694,7 @@ static int dsi_proto_config(struct platform_device *dsidev)
36813694
r = FLD_MOD(r, 0, 8, 8); /* VP_CLK_POL */
36823695
r = FLD_MOD(r, 1, 14, 14); /* TRIGGER_RESET_MODE */
36833696
r = FLD_MOD(r, 1, 19, 19); /* EOT_ENABLE */
3684-
if (!dss_has_feature(FEAT_DSI_DCS_CMD_CONFIG_VC)) {
3697+
if (!(dsi->data->quirks & DSI_QUIRK_DCS_CMD_CONFIG_VC)) {
36853698
r = FLD_MOD(r, 1, 24, 24); /* DCS_CMD_ENABLE */
36863699
/* DCS_CMD_CODE, 1=start, 0=continue */
36873700
r = FLD_MOD(r, 0, 25, 25);
@@ -5315,9 +5328,66 @@ static int dsi_init_pll_data(struct platform_device *dsidev)
53155328
}
53165329

53175330
/* DSI1 HW IP initialisation */
5331+
static const struct dsi_of_data dsi_of_data_omap34xx = {
5332+
.model = DSI_MODEL_OMAP3,
5333+
.pll_hw = &dss_omap3_dsi_pll_hw,
5334+
.modules = (const struct dsi_module_id_data[]) {
5335+
{ .address = 0x4804fc00, .id = 0, },
5336+
{ },
5337+
},
5338+
.quirks = DSI_QUIRK_REVERSE_TXCLKESC,
5339+
};
5340+
5341+
static const struct dsi_of_data dsi_of_data_omap36xx = {
5342+
.model = DSI_MODEL_OMAP3,
5343+
.pll_hw = &dss_omap3_dsi_pll_hw,
5344+
.modules = (const struct dsi_module_id_data[]) {
5345+
{ .address = 0x4804fc00, .id = 0, },
5346+
{ },
5347+
},
5348+
.quirks = DSI_QUIRK_PLL_PWR_BUG,
5349+
};
5350+
5351+
static const struct dsi_of_data dsi_of_data_omap4 = {
5352+
.model = DSI_MODEL_OMAP4,
5353+
.pll_hw = &dss_omap4_dsi_pll_hw,
5354+
.modules = (const struct dsi_module_id_data[]) {
5355+
{ .address = 0x58004000, .id = 0, },
5356+
{ .address = 0x58005000, .id = 1, },
5357+
{ },
5358+
},
5359+
.quirks = DSI_QUIRK_DCS_CMD_CONFIG_VC | DSI_QUIRK_VC_OCP_WIDTH
5360+
| DSI_QUIRK_GNQ,
5361+
};
5362+
5363+
static const struct dsi_of_data dsi_of_data_omap5 = {
5364+
.model = DSI_MODEL_OMAP5,
5365+
.pll_hw = &dss_omap5_dsi_pll_hw,
5366+
.modules = (const struct dsi_module_id_data[]) {
5367+
{ .address = 0x58004000, .id = 0, },
5368+
{ .address = 0x58009000, .id = 1, },
5369+
{ },
5370+
},
5371+
.quirks = DSI_QUIRK_DCS_CMD_CONFIG_VC | DSI_QUIRK_VC_OCP_WIDTH
5372+
| DSI_QUIRK_GNQ | DSI_QUIRK_PHY_DCC,
5373+
};
5374+
5375+
static const struct of_device_id dsi_of_match[] = {
5376+
{ .compatible = "ti,omap3-dsi", .data = &dsi_of_data_omap36xx, },
5377+
{ .compatible = "ti,omap4-dsi", .data = &dsi_of_data_omap4, },
5378+
{ .compatible = "ti,omap5-dsi", .data = &dsi_of_data_omap5, },
5379+
{},
5380+
};
5381+
5382+
static const struct soc_device_attribute dsi_soc_devices[] = {
5383+
{ .machine = "OMAP3[45]*", .data = &dsi_of_data_omap34xx },
5384+
{ .machine = "AM35*", .data = &dsi_of_data_omap34xx },
5385+
{ /* sentinel */ }
5386+
};
53185387
static int dsi_bind(struct device *dev, struct device *master, void *data)
53195388
{
53205389
struct platform_device *dsidev = to_platform_device(dev);
5390+
const struct soc_device_attribute *soc;
53215391
const struct dsi_module_id_data *d;
53225392
u32 rev;
53235393
int r, i;
@@ -5381,7 +5451,12 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)
53815451
return r;
53825452
}
53835453

5384-
dsi->data = of_match_node(dsi_of_match, dsidev->dev.of_node)->data;
5454+
soc = soc_device_match(dsi_soc_devices);
5455+
if (soc)
5456+
dsi->data = soc->data;
5457+
else
5458+
dsi->data = of_match_node(dsi_of_match, dev->of_node)->data;
5459+
53855460
d = dsi->data->modules;
53865461
while (d->address != 0 && d->address != dsi_mem->start)
53875462
d++;
@@ -5433,7 +5508,7 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)
54335508

54345509
/* DSI on OMAP3 doesn't have register DSI_GNQ, set number
54355510
* of data to 3 by default */
5436-
if (dss_has_feature(FEAT_DSI_GNQ))
5511+
if (dsi->data->quirks & DSI_QUIRK_GNQ)
54375512
/* NB_DATA_LANES */
54385513
dsi->num_lanes_supported = 1 + REG_GET(dsidev, DSI_GNQ, 11, 9);
54395514
else
@@ -5553,42 +5628,6 @@ static const struct dev_pm_ops dsi_pm_ops = {
55535628
.runtime_resume = dsi_runtime_resume,
55545629
};
55555630

5556-
static const struct dsi_of_data dsi_of_data_omap3 = {
5557-
.model = DSI_MODEL_OMAP3,
5558-
.pll_hw = &dss_omap3_dsi_pll_hw,
5559-
.modules = (const struct dsi_module_id_data[]) {
5560-
{ .address = 0x4804fc00, .id = 0, },
5561-
{ },
5562-
},
5563-
};
5564-
5565-
static const struct dsi_of_data dsi_of_data_omap4 = {
5566-
.model = DSI_MODEL_OMAP4,
5567-
.pll_hw = &dss_omap4_dsi_pll_hw,
5568-
.modules = (const struct dsi_module_id_data[]) {
5569-
{ .address = 0x58004000, .id = 0, },
5570-
{ .address = 0x58005000, .id = 1, },
5571-
{ },
5572-
},
5573-
};
5574-
5575-
static const struct dsi_of_data dsi_of_data_omap5 = {
5576-
.model = DSI_MODEL_OMAP5,
5577-
.pll_hw = &dss_omap5_dsi_pll_hw,
5578-
.modules = (const struct dsi_module_id_data[]) {
5579-
{ .address = 0x58004000, .id = 0, },
5580-
{ .address = 0x58009000, .id = 1, },
5581-
{ },
5582-
},
5583-
};
5584-
5585-
static const struct of_device_id dsi_of_match[] = {
5586-
{ .compatible = "ti,omap3-dsi", .data = &dsi_of_data_omap3, },
5587-
{ .compatible = "ti,omap4-dsi", .data = &dsi_of_data_omap4, },
5588-
{ .compatible = "ti,omap5-dsi", .data = &dsi_of_data_omap5, },
5589-
{},
5590-
};
5591-
55925631
static struct platform_driver omap_dsihw_driver = {
55935632
.probe = dsi_probe,
55945633
.remove = dsi_remove,

‎drivers/gpu/drm/omapdrm/dss/dss_features.c‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ static const enum dss_feat_id omap3430_dss_feat_list[] = {
165165
FEAT_LINEBUFFERSPLIT,
166166
FEAT_ROWREPEATENABLE,
167167
FEAT_RESIZECONF,
168-
FEAT_DSI_REVERSE_TXCLKESC,
169168
FEAT_CPR,
170169
FEAT_PRELOAD,
171170
FEAT_FIR_COEF_V,
@@ -183,7 +182,6 @@ static const enum dss_feat_id am35xx_dss_feat_list[] = {
183182
FEAT_LINEBUFFERSPLIT,
184183
FEAT_ROWREPEATENABLE,
185184
FEAT_RESIZECONF,
186-
FEAT_DSI_REVERSE_TXCLKESC,
187185
FEAT_CPR,
188186
FEAT_PRELOAD,
189187
FEAT_FIR_COEF_V,
@@ -215,7 +213,6 @@ static const enum dss_feat_id omap3630_dss_feat_list[] = {
215213
FEAT_LINEBUFFERSPLIT,
216214
FEAT_ROWREPEATENABLE,
217215
FEAT_RESIZECONF,
218-
FEAT_DSI_PLL_PWR_BUG,
219216
FEAT_CPR,
220217
FEAT_PRELOAD,
221218
FEAT_FIR_COEF_V,
@@ -229,9 +226,6 @@ static const enum dss_feat_id omap4430_es1_0_dss_feat_list[] = {
229226
FEAT_MGR_LCD2,
230227
FEAT_CORE_CLK_DIV,
231228
FEAT_LCD_CLK_SRC,
232-
FEAT_DSI_DCS_CMD_CONFIG_VC,
233-
FEAT_DSI_VC_OCP_WIDTH,
234-
FEAT_DSI_GNQ,
235229
FEAT_HANDLE_UV_SEPARATE,
236230
FEAT_ATTR2,
237231
FEAT_CPR,
@@ -246,9 +240,6 @@ static const enum dss_feat_id omap4430_es2_0_1_2_dss_feat_list[] = {
246240
FEAT_MGR_LCD2,
247241
FEAT_CORE_CLK_DIV,
248242
FEAT_LCD_CLK_SRC,
249-
FEAT_DSI_DCS_CMD_CONFIG_VC,
250-
FEAT_DSI_VC_OCP_WIDTH,
251-
FEAT_DSI_GNQ,
252243
FEAT_HDMI_CTS_SWMODE,
253244
FEAT_HANDLE_UV_SEPARATE,
254245
FEAT_ATTR2,
@@ -264,9 +255,6 @@ static const enum dss_feat_id omap4_dss_feat_list[] = {
264255
FEAT_MGR_LCD2,
265256
FEAT_CORE_CLK_DIV,
266257
FEAT_LCD_CLK_SRC,
267-
FEAT_DSI_DCS_CMD_CONFIG_VC,
268-
FEAT_DSI_VC_OCP_WIDTH,
269-
FEAT_DSI_GNQ,
270258
FEAT_HDMI_CTS_SWMODE,
271259
FEAT_HDMI_AUDIO_USE_MCLK,
272260
FEAT_HANDLE_UV_SEPARATE,
@@ -284,9 +272,6 @@ static const enum dss_feat_id omap5_dss_feat_list[] = {
284272
FEAT_MGR_LCD3,
285273
FEAT_CORE_CLK_DIV,
286274
FEAT_LCD_CLK_SRC,
287-
FEAT_DSI_DCS_CMD_CONFIG_VC,
288-
FEAT_DSI_VC_OCP_WIDTH,
289-
FEAT_DSI_GNQ,
290275
FEAT_HDMI_CTS_SWMODE,
291276
FEAT_HDMI_AUDIO_USE_MCLK,
292277
FEAT_HANDLE_UV_SEPARATE,
@@ -297,7 +282,6 @@ static const enum dss_feat_id omap5_dss_feat_list[] = {
297282
FEAT_ALPHA_FREE_ZORDER,
298283
FEAT_FIFO_MERGE,
299284
FEAT_BURST_2D,
300-
FEAT_DSI_PHY_DCC,
301285
FEAT_MFLAG,
302286
};
303287

‎drivers/gpu/drm/omapdrm/dss/dss_features.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,6 @@ enum dss_feat_id {
3939
/* Independent core clk divider */
4040
FEAT_CORE_CLK_DIV,
4141
FEAT_LCD_CLK_SRC,
42-
/* DSI-PLL power command 0x3 is not working */
43-
FEAT_DSI_PLL_PWR_BUG,
44-
FEAT_DSI_DCS_CMD_CONFIG_VC,
45-
FEAT_DSI_VC_OCP_WIDTH,
46-
FEAT_DSI_REVERSE_TXCLKESC,
47-
FEAT_DSI_GNQ,
4842
FEAT_DPI_USES_VDDS_DSI,
4943
FEAT_HDMI_CTS_SWMODE,
5044
FEAT_HDMI_AUDIO_USE_MCLK,
@@ -59,7 +53,6 @@ enum dss_feat_id {
5953
/* An unknown HW bug causing the normal FIFO thresholds not to work */
6054
FEAT_OMAP3_DSI_FIFO_BUG,
6155
FEAT_BURST_2D,
62-
FEAT_DSI_PHY_DCC,
6356
FEAT_MFLAG,
6457
};
6558

0 commit comments

Comments
 (0)