2 * Copyright (C) 2013 Red Hat
3 * Author: Rob Clark <robdclark@gmail.com>
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.
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
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/>.
20 struct hdmi_phy_8x74
{
24 #define to_hdmi_phy_8x74(x) container_of(x, struct hdmi_phy_8x74, base)
27 static void phy_write(struct hdmi_phy_8x74
*phy
, u32 reg
, u32 data
)
29 msm_writel(data
, phy
->mmio
+ reg
);
32 //static u32 phy_read(struct hdmi_phy_8x74 *phy, u32 reg)
34 // return msm_readl(phy->mmio + reg);
37 static void hdmi_phy_8x74_destroy(struct hdmi_phy
*phy
)
39 struct hdmi_phy_8x74
*phy_8x74
= to_hdmi_phy_8x74(phy
);
43 static void hdmi_phy_8x74_powerup(struct hdmi_phy
*phy
,
44 unsigned long int pixclock
)
46 struct hdmi_phy_8x74
*phy_8x74
= to_hdmi_phy_8x74(phy
);
48 phy_write(phy_8x74
, REG_HDMI_8x74_ANA_CFG0
, 0x1b);
49 phy_write(phy_8x74
, REG_HDMI_8x74_ANA_CFG1
, 0xf2);
50 phy_write(phy_8x74
, REG_HDMI_8x74_BIST_CFG0
, 0x0);
51 phy_write(phy_8x74
, REG_HDMI_8x74_BIST_PATN0
, 0x0);
52 phy_write(phy_8x74
, REG_HDMI_8x74_BIST_PATN1
, 0x0);
53 phy_write(phy_8x74
, REG_HDMI_8x74_BIST_PATN2
, 0x0);
54 phy_write(phy_8x74
, REG_HDMI_8x74_BIST_PATN3
, 0x0);
55 phy_write(phy_8x74
, REG_HDMI_8x74_PD_CTRL1
, 0x20);
58 static void hdmi_phy_8x74_powerdown(struct hdmi_phy
*phy
)
60 struct hdmi_phy_8x74
*phy_8x74
= to_hdmi_phy_8x74(phy
);
61 phy_write(phy_8x74
, REG_HDMI_8x74_PD_CTRL0
, 0x7f);
64 static const struct hdmi_phy_funcs hdmi_phy_8x74_funcs
= {
65 .destroy
= hdmi_phy_8x74_destroy
,
66 .powerup
= hdmi_phy_8x74_powerup
,
67 .powerdown
= hdmi_phy_8x74_powerdown
,
70 struct hdmi_phy
*hdmi_phy_8x74_init(struct hdmi
*hdmi
)
72 struct hdmi_phy_8x74
*phy_8x74
;
73 struct hdmi_phy
*phy
= NULL
;
76 phy_8x74
= kzalloc(sizeof(*phy_8x74
), GFP_KERNEL
);
82 phy
= &phy_8x74
->base
;
84 phy
->funcs
= &hdmi_phy_8x74_funcs
;
86 /* for 8x74, the phy mmio is mapped separately: */
87 phy_8x74
->mmio
= msm_ioremap(hdmi
->pdev
,
88 "phy_physical", "HDMI_8x74");
89 if (IS_ERR(phy_8x74
->mmio
)) {
90 ret
= PTR_ERR(phy_8x74
->mmio
);
98 hdmi_phy_8x74_destroy(phy
);