temp revert rk change
[firefly-linux-kernel-4.4.55.git] / drivers / video / tegra / dc / rgb.c
1 /*
2  * drivers/video/tegra/dc/rgb.c
3  *
4  * Copyright (C) 2010 Google, Inc.
5  * Author: Erik Gilling <konkers@android.com>
6  *
7  * This software is licensed under the terms of the GNU General Public
8  * License version 2, as published by the Free Software Foundation, and
9  * may be copied, distributed, and modified under those terms.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  */
17
18 #include <linux/kernel.h>
19
20 #include <mach/dc.h>
21
22 #include "dc_reg.h"
23 #include "dc_priv.h"
24
25
26 static const u32 tegra_dc_rgb_enable_pintable[] = {
27         DC_COM_PIN_OUTPUT_ENABLE0,      0x00000000,
28         DC_COM_PIN_OUTPUT_ENABLE1,      0x00000000,
29         DC_COM_PIN_OUTPUT_ENABLE2,      0x00000000,
30         DC_COM_PIN_OUTPUT_ENABLE3,      0x00000000,
31         DC_COM_PIN_OUTPUT_POLARITY0,    0x00000000,
32         DC_COM_PIN_OUTPUT_POLARITY1,    0x01000000,
33         DC_COM_PIN_OUTPUT_POLARITY2,    0x00000000,
34         DC_COM_PIN_OUTPUT_POLARITY3,    0x00000000,
35         DC_COM_PIN_OUTPUT_DATA0,        0x00000000,
36         DC_COM_PIN_OUTPUT_DATA1,        0x00000000,
37         DC_COM_PIN_OUTPUT_DATA2,        0x00000000,
38         DC_COM_PIN_OUTPUT_DATA3,        0x00000000,
39         DC_COM_PIN_OUTPUT_SELECT0,      0x00000000,
40         DC_COM_PIN_OUTPUT_SELECT1,      0x00000000,
41         DC_COM_PIN_OUTPUT_SELECT2,      0x00000000,
42         DC_COM_PIN_OUTPUT_SELECT3,      0x00000000,
43         DC_COM_PIN_OUTPUT_SELECT4,      0x00210222,
44         DC_COM_PIN_OUTPUT_SELECT5,      0x00002200,
45         DC_COM_PIN_OUTPUT_SELECT6,      0x00020000,
46 };
47
48 static const u32 tegra_dc_rgb_disable_pintable[] = {
49         DC_COM_PIN_OUTPUT_ENABLE0,      0x55555555,
50         DC_COM_PIN_OUTPUT_ENABLE1,      0x55150005,
51         DC_COM_PIN_OUTPUT_ENABLE2,      0x55555555,
52         DC_COM_PIN_OUTPUT_ENABLE3,      0x55555555,
53         DC_COM_PIN_OUTPUT_POLARITY0,    0x00000000,
54         DC_COM_PIN_OUTPUT_POLARITY1,    0x00000000,
55         DC_COM_PIN_OUTPUT_POLARITY2,    0x00000000,
56         DC_COM_PIN_OUTPUT_POLARITY3,    0x00000000,
57         DC_COM_PIN_OUTPUT_DATA0,        0xaaaaaaaa,
58         DC_COM_PIN_OUTPUT_DATA1,        0xaaaaaaaa,
59         DC_COM_PIN_OUTPUT_DATA2,        0xaaaaaaaa,
60         DC_COM_PIN_OUTPUT_DATA3,        0xaaaaaaaa,
61         DC_COM_PIN_OUTPUT_SELECT0,      0x00000000,
62         DC_COM_PIN_OUTPUT_SELECT1,      0x00000000,
63         DC_COM_PIN_OUTPUT_SELECT2,      0x00000000,
64         DC_COM_PIN_OUTPUT_SELECT3,      0x00000000,
65         DC_COM_PIN_OUTPUT_SELECT4,      0x00000000,
66         DC_COM_PIN_OUTPUT_SELECT5,      0x00000000,
67         DC_COM_PIN_OUTPUT_SELECT6,      0x00000000,
68 };
69
70 void tegra_dc_rgb_enable(struct tegra_dc *dc)
71 {
72         tegra_dc_writel(dc, PW0_ENABLE | PW1_ENABLE | PW2_ENABLE | PW3_ENABLE |
73                         PW4_ENABLE | PM0_ENABLE | PM1_ENABLE,
74                         DC_CMD_DISPLAY_POWER_CONTROL);
75
76         tegra_dc_writel(dc, DISP_CTRL_MODE_C_DISPLAY, DC_CMD_DISPLAY_COMMAND);
77
78         tegra_dc_write_table(dc, tegra_dc_rgb_enable_pintable);
79 }
80
81 void tegra_dc_rgb_disable(struct tegra_dc *dc)
82 {
83         tegra_dc_writel(dc, 0x00000000, DC_CMD_DISPLAY_POWER_CONTROL);
84
85         tegra_dc_write_table(dc, tegra_dc_rgb_disable_pintable);
86 }
87
88 struct tegra_dc_out_ops tegra_dc_rgb_ops = {
89         .enable = tegra_dc_rgb_enable,
90         .disable = tegra_dc_rgb_disable,
91 };
92