blob: 0b4fd5be45ec1516456bd2fd90f511864f39c8a3 [file] [log] [blame]
Ajay Singh Parmar7c1cd522013-02-13 20:33:49 +05301/* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
Channagoud Kadabie4884122011-09-21 23:54:44 +05302 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are
5 * met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above
9 * copyright notice, this list of conditions and the following
10 * disclaimer in the documentation and/or other materials provided
11 * with the distribution.
Duy Truongf3ac7b32013-02-13 01:07:28 -080012 * * Neither the name of The Linux Foundation nor the names of its
Channagoud Kadabie4884122011-09-21 23:54:44 +053013 * contributors may be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 */
29
30#ifndef __PLATFORM_MSM_SHARED_HDMI_H
31#define __PLATFORM_MSM_SHARED_HDMI_H
32
33#include <reg.h>
34#include <debug.h>
35#include <bits.h>
36#include <dev/fbcon.h>
37#include <target/display.h>
38
Channagoud Kadabie4884122011-09-21 23:54:44 +053039#define MDP_GET_PACK_PATTERN(a,x,y,z,bit) (((a)<<(bit*3))|((x)<<(bit*2))|((y)<<bit)|(z))
40#define DMA_PACK_ALIGN_LSB 0
41#define DMA_PACK_PATTERN_RGB \
42 (MDP_GET_PACK_PATTERN(0,CLR_R,CLR_G,CLR_B,2)<<8)
43#define CLR_G 0x0
44#define CLR_B 0x1
45#define CLR_R 0x2
46#define DMA_DSTC0G_8BITS (BIT(1)|BIT(0))
47#define DMA_DSTC1B_8BITS (BIT(3)|BIT(2))
48#define DMA_DSTC2R_8BITS (BIT(5)|BIT(4))
49#define BM(m, l) (((((uint32_t)-1) << (31-m)) >> (31-m+l)) << l)
50#define BVAL(m, l, val) (((val) << l) & BM(m, l))
51#define CC(m, n) (BVAL((m+1), m, 0x2) * !!(n))
52#define NS_MM(n_msb, n_lsb, n, m, d_msb, d_lsb, d, s_msb, s_lsb, s) \
53 (BVAL(n_msb, n_lsb, ~(n-m)) | BVAL(d_msb, d_lsb, (d-1)) \
54 | BVAL(s_msb, s_lsb, s))
55
56extern int pm8901_mpp_enable();
57extern int pm8901_vs_enable();
58extern int pm8058_ldo_set_voltage();
59extern int pm8058_vreg_enable();
60void gpio_tlmm_config(uint32_t gpio, uint8_t func,
Ajay Dudanib01e5062011-12-03 23:23:42 -080061 uint8_t dir, uint8_t pull,
62 uint8_t drvstr, uint32_t enable);
Channagoud Kadabie4884122011-09-21 23:54:44 +053063
Ajay Singh Parmar7c1cd522013-02-13 20:33:49 +053064int hdmi_dtv_on(void);
65void hdmi_msm_set_mode(int on);
66void hdmi_msm_init_phy(void);
67void hdmi_display_shutdown(void);
68void hdmi_msm_reset_core(void);
69void hdmi_set_fb_addr(void *addr);
Channagoud Kadabie4884122011-09-21 23:54:44 +053070
71struct hdmi_disp_mode_timing_type {
Ajay Dudanib01e5062011-12-03 23:23:42 -080072 uint32_t height;
73 uint32_t hsync_porch_fp;
74 uint32_t hsync_width;
75 uint32_t hsync_porch_bp;
76 uint32_t width;
77 uint32_t vsync_porch_fp;
78 uint32_t vsync_width;
79 uint32_t vsync_porch_bp;
80 uint32_t refresh_rate;
Ajay Singh Parmar7c1cd522013-02-13 20:33:49 +053081 uint32_t bpp;
82 void *base;
Channagoud Kadabie4884122011-09-21 23:54:44 +053083};
Ajay Dudanib01e5062011-12-03 23:23:42 -080084#endif /* __PLATFORM_MSM_SHARED_HDMI_H */