GNU Linux-libre 4.9.284-gnu1
[releases.git] / drivers / gpu / drm / msm / hdmi / hdmi_phy_8x74.c
1 /*
2  * Copyright (C) 2013 Red Hat
3  * Author: Rob Clark <robdclark@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 as published by
7  * the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17
18 #include "hdmi.h"
19
20 static void hdmi_phy_8x74_powerup(struct hdmi_phy *phy,
21                 unsigned long int pixclock)
22 {
23         hdmi_phy_write(phy, REG_HDMI_8x74_ANA_CFG0,   0x1b);
24         hdmi_phy_write(phy, REG_HDMI_8x74_ANA_CFG1,   0xf2);
25         hdmi_phy_write(phy, REG_HDMI_8x74_BIST_CFG0,  0x0);
26         hdmi_phy_write(phy, REG_HDMI_8x74_BIST_PATN0, 0x0);
27         hdmi_phy_write(phy, REG_HDMI_8x74_BIST_PATN1, 0x0);
28         hdmi_phy_write(phy, REG_HDMI_8x74_BIST_PATN2, 0x0);
29         hdmi_phy_write(phy, REG_HDMI_8x74_BIST_PATN3, 0x0);
30         hdmi_phy_write(phy, REG_HDMI_8x74_PD_CTRL1,   0x20);
31 }
32
33 static void hdmi_phy_8x74_powerdown(struct hdmi_phy *phy)
34 {
35         hdmi_phy_write(phy, REG_HDMI_8x74_PD_CTRL0, 0x7f);
36 }
37
38 static const char * const hdmi_phy_8x74_reg_names[] = {
39         "core-vdda",
40         "vddio",
41 };
42
43 static const char * const hdmi_phy_8x74_clk_names[] = {
44         "iface_clk",
45         "alt_iface_clk"
46 };
47
48 const struct hdmi_phy_cfg msm_hdmi_phy_8x74_cfg = {
49         .type = MSM_HDMI_PHY_8x74,
50         .powerup = hdmi_phy_8x74_powerup,
51         .powerdown = hdmi_phy_8x74_powerdown,
52         .reg_names = hdmi_phy_8x74_reg_names,
53         .num_regs = ARRAY_SIZE(hdmi_phy_8x74_reg_names),
54         .clk_names = hdmi_phy_8x74_clk_names,
55         .num_clks = ARRAY_SIZE(hdmi_phy_8x74_clk_names),
56 };