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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
/* linux/arch/arm/mach-exynos/setup-tvout.c
*
* Copyright (c) 2010 Samsung Electronics Co., Ltd.
* http://www.samsung.com/
*
* Base TVOUT gpio configuration
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/gpio.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/types.h>
#include <plat/clock.h>
#include <plat/gpio-cfg.h>
#include <mach/regs-clock.h>
#include <mach/regs-gpio.h>
#include <linux/io.h>
#include <mach/map.h>
#include <mach/gpio.h>
#include <plat/tvout.h>
#include <plat/cpu.h>
#if defined(CONFIG_ARCH_EXYNOS4)
#define HDMI_GPX(_nr) EXYNOS4_GPX3(_nr)
#elif defined(CONFIG_ARCH_EXYNOS5)
#define HDMI_GPX(_nr) EXYNOS5_GPX3(_nr)
#endif
struct platform_device; /* don't need the contents */
void s5p_int_src_hdmi_hpd(struct platform_device *pdev)
{
printk(KERN_INFO "%s()\n", __func__);
#ifdef CONFIG_MACH_U1_NA_USCC
s3c_gpio_cfgpin(GPIO_HDMI_HPD , S3C_GPIO_INPUT);
#else
s3c_gpio_cfgpin(GPIO_HDMI_HPD, S3C_GPIO_SFN(0x3));
#endif
s3c_gpio_setpull(GPIO_HDMI_HPD, S3C_GPIO_PULL_DOWN);
}
void s5p_int_src_ext_hpd(struct platform_device *pdev)
{
#ifdef CONFIG_MACH_U1_NA_USCC /* NC */
printk(KERN_INFO "%s()\n", __func__);
s3c_gpio_cfgpin(GPIO_HDMI_HPD, S3C_GPIO_INPUT);
s3c_gpio_setpull(GPIO_HDMI_HPD, S3C_GPIO_PULL_DOWN);
#else
printk(KERN_INFO "%s()\n", __func__);
s3c_gpio_cfgpin(GPIO_HDMI_HPD, S3C_GPIO_SFN(0xf));
/* To avoid floating state of the HPD pin *
* in the absence of external pull-up */
#if defined(CONFIG_CPU_EXYNOS4212) || defined(CONFIG_CPU_EXYNOS4412)
s3c_gpio_setpull(GPIO_HDMI_HPD, S3C_GPIO_PULL_DOWN);
#else
s3c_gpio_setpull(GPIO_HDMI_HPD, S3C_GPIO_PULL_NONE);
#endif
#endif
}
int s5p_hpd_read_gpio(struct platform_device *pdev)
{
int ret;
ret = gpio_get_value(GPIO_HDMI_HPD);
printk(KERN_INFO "%s(%d)\n", __func__, ret);
return ret;
}
int s5p_v4l2_hpd_read_gpio(void)
{
return gpio_get_value(HDMI_GPX(7));
}
void s5p_v4l2_int_src_hdmi_hpd(void)
{
s3c_gpio_cfgpin(HDMI_GPX(7), S3C_GPIO_SFN(0x3));
s3c_gpio_setpull(HDMI_GPX(7), S3C_GPIO_PULL_DOWN);
}
void s5p_v4l2_int_src_ext_hpd(void)
{
s3c_gpio_cfgpin(HDMI_GPX(7), S3C_GPIO_SFN(0xf));
s3c_gpio_setpull(HDMI_GPX(7), S3C_GPIO_PULL_DOWN);
}
void s5p_cec_cfg_gpio(struct platform_device *pdev)
{
#ifdef CONFIG_HDMI_CEC
s3c_gpio_cfgpin(GPIO_HDMI_CEC, S3C_GPIO_SFN(0x3));
s3c_gpio_setpull(GPIO_HDMI_CEC, S3C_GPIO_PULL_NONE);
#endif
}
#ifdef CONFIG_VIDEO_EXYNOS_TV
void s5p_tv_setup(void)
{
int ret;
/* direct HPD to HDMI chip */
if (soc_is_exynos4412()) {
gpio_request(GPIO_HDMI_HPD, "hpd-plug");
gpio_direction_input(GPIO_HDMI_HPD);
s3c_gpio_cfgpin(GPIO_HDMI_HPD, S3C_GPIO_SFN(0x3));
s3c_gpio_setpull(GPIO_HDMI_HPD, S3C_GPIO_PULL_NONE);
} else if (soc_is_exynos5250()) {
gpio_request(GPIO_HDMI_HPD, "hpd-plug");
gpio_direction_input(GPIO_HDMI_HPD);
s3c_gpio_cfgpin(GPIO_HDMI_HPD, S3C_GPIO_SFN(0x3));
s3c_gpio_setpull(GPIO_HDMI_HPD, S3C_GPIO_PULL_NONE);
/* HDMI CEC */
gpio_request(GPIO_HDMI_CEC, "hdmi-cec");
gpio_direction_input(GPIO_HDMI_CEC);
s3c_gpio_cfgpin(GPIO_HDMI_CEC, S3C_GPIO_SFN(0x3));
s3c_gpio_setpull(GPIO_HDMI_CEC, S3C_GPIO_PULL_NONE);
} else {
printk(KERN_ERR "HPD GPIOs are not defined!\n");
}
}
#endif
|