1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
*/
#include <linux/delay.h>
#include <linux/slab.h>
#include "dsi_display_test.h"
static void dsi_display_test_dump_modes(struct dsi_display_mode *mode, u32
count)
{
}
static void dsi_display_test_work(struct work_struct *work)
{
struct dsi_display_test *test;
struct dsi_display *display;
struct dsi_display_mode *modes;
u32 count = 0;
int rc = 0;
test = container_of(work, struct dsi_display_test, test_work);
display = test->display;
rc = dsi_display_get_mode_count(display, &count);
if (rc) {
DSI_ERR("failed to get modes count, rc=%d\n", rc);
goto test_fail;
}
rc = dsi_display_get_modes(display, &modes);
if (rc) {
DSI_ERR("failed to get modes, rc=%d\n", rc);
goto test_fail_free_modes;
}
dsi_display_test_dump_modes(modes, count);
rc = dsi_display_set_mode(display, &modes[0], 0x0);
if (rc) {
DSI_ERR("failed to set mode, rc=%d\n", rc);
goto test_fail_free_modes;
}
rc = dsi_display_prepare(display);
if (rc) {
DSI_ERR("failed to prepare display, rc=%d\n", rc);
goto test_fail_free_modes;
}
rc = dsi_display_enable(display);
if (rc) {
DSI_ERR("failed to enable display, rc=%d\n", rc);
goto test_fail_unprep_disp;
}
return;
test_fail_unprep_disp:
if (rc) {
DSI_ERR("failed to unprep display, rc=%d\n", rc);
goto test_fail_free_modes;
}
test_fail_free_modes:
kfree(modes);
test_fail:
return;
}
int dsi_display_test_init(struct dsi_display *display)
{
static int done;
int rc = 0;
struct dsi_display_test *test;
if (done)
return rc;
done = 1;
if (!display) {
DSI_ERR("Invalid params\n");
return -EINVAL;
}
test = kzalloc(sizeof(*test), GFP_KERNEL);
if (!test)
return -ENOMEM;
test->display = display;
INIT_WORK(&test->test_work, dsi_display_test_work);
dsi_display_test_work(&test->test_work);
return rc;
}
|