1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2014 Siemens AG
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <console/console.h>
#include <string.h>
#include "soc/gpio.h"
#include "lcd_panel.h"
#include "ptn3460.h"
/** \brief Reads GPIOs used for LCD panel encoding and returns the 4 bit value
* @param no parameters
* @return LCD panel type encoded in 4 bits
*/
u8 get_lcd_panel_type(void)
{
u8 lcd_type_gpio;
lcd_type_gpio = ((read_ssus_gpio(LCD_TYPE_GPIO_BIT3) << 3) |
(read_ssus_gpio(LCD_TYPE_GPIO_BIT2) << 2) |
(read_ssus_gpio(LCD_TYPE_GPIO_BIT1) << 1) |
(read_ssus_gpio(LCD_TYPE_GPIO_BIT0)));
/* There is an inverter in this signals so we need to invert them as well */
return ((~lcd_type_gpio) & 0x0f);
}
/** \brief Set up LCD panel
* @param no parameters
* @return 0 on success otherwise error value
*/
int setup_lcd_panel(void)
{
u8 lcd_type;
int status;
char blockname[33];
lcd_type = get_lcd_panel_type();
printk(BIOS_INFO, "LCD: Found panel type %d\n", lcd_type);
switch (lcd_type) {
case LCD_PANEL_TYPE_10_INCH:
strcpy(blockname, "hwinfo10.hex");
break;
case LCD_PANEL_TYPE_12_INCH:
strcpy(blockname, "hwinfo12.hex");
break;
case LCD_PANEL_TYPE_15_INCH:
strcpy(blockname, "hwinfo15.hex");
break;
case LCD_PANEL_TYPE_19_INCH:
strcpy(blockname, "hwinfo19.hex");
break;
case LCD_PANEL_TYPE_EDID:
strcpy(blockname, "hwinfo.hex");
break;
default:
printk(BIOS_ERR, "LCD: No supported panel found.\n");
return 1;
break;
}
/* Now that we have the panel type, set up the DP2LVDS converter */
status = ptn3460_init(blockname);
if (status)
printk(BIOS_ERR, "LCD: Setup PTN with status 0x%x\n", status);
else
printk(BIOS_INFO, "LCD: Setup PTN with status 0x%x\n", status);
return status;
}
|