blob: 5edfbbea3768eb0f45677d435090a47289b0c4b5 [file] [log] [blame]
Duy Truongf3ac7b32013-02-13 01:07:28 -08001/* Copyright (c) 2010-2011, 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
39#define FB_ADDR 0x43E00000
40
41#define MDP_GET_PACK_PATTERN(a,x,y,z,bit) (((a)<<(bit*3))|((x)<<(bit*2))|((y)<<bit)|(z))
42#define DMA_PACK_ALIGN_LSB 0
43#define DMA_PACK_PATTERN_RGB \
44 (MDP_GET_PACK_PATTERN(0,CLR_R,CLR_G,CLR_B,2)<<8)
45#define CLR_G 0x0
46#define CLR_B 0x1
47#define CLR_R 0x2
48#define DMA_DSTC0G_8BITS (BIT(1)|BIT(0))
49#define DMA_DSTC1B_8BITS (BIT(3)|BIT(2))
50#define DMA_DSTC2R_8BITS (BIT(5)|BIT(4))
51#define BM(m, l) (((((uint32_t)-1) << (31-m)) >> (31-m+l)) << l)
52#define BVAL(m, l, val) (((val) << l) & BM(m, l))
53#define CC(m, n) (BVAL((m+1), m, 0x2) * !!(n))
54#define NS_MM(n_msb, n_lsb, n, m, d_msb, d_lsb, d, s_msb, s_lsb, s) \
55 (BVAL(n_msb, n_lsb, ~(n-m)) | BVAL(d_msb, d_lsb, (d-1)) \
56 | BVAL(s_msb, s_lsb, s))
57
58extern int pm8901_mpp_enable();
59extern int pm8901_vs_enable();
60extern int pm8058_ldo_set_voltage();
61extern int pm8058_vreg_enable();
62void gpio_tlmm_config(uint32_t gpio, uint8_t func,
Ajay Dudanib01e5062011-12-03 23:23:42 -080063 uint8_t dir, uint8_t pull,
64 uint8_t drvstr, uint32_t enable);
Channagoud Kadabie4884122011-09-21 23:54:44 +053065
66void dtv_on();
67
68struct hdmi_disp_mode_timing_type {
Ajay Dudanib01e5062011-12-03 23:23:42 -080069 uint32_t height;
70 uint32_t hsync_porch_fp;
71 uint32_t hsync_width;
72 uint32_t hsync_porch_bp;
73 uint32_t width;
74 uint32_t vsync_porch_fp;
75 uint32_t vsync_width;
76 uint32_t vsync_porch_bp;
77 uint32_t refresh_rate;
Channagoud Kadabie4884122011-09-21 23:54:44 +053078};
79
80static struct fbcon_config fb_cfg = {
Ajay Dudanib01e5062011-12-03 23:23:42 -080081 .height = DTV_FB_HEIGHT,
82 .width = DTV_FB_WIDTH,
83 .stride = DTV_FB_WIDTH,
84 .format = DTV_FORMAT_RGB565,
85 .bpp = DTV_BPP,
86 .update_start = NULL,
87 .update_done = NULL,
Channagoud Kadabie4884122011-09-21 23:54:44 +053088};
89
Ajay Dudanib01e5062011-12-03 23:23:42 -080090#endif /* __PLATFORM_MSM_SHARED_HDMI_H */