Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odroid 3.8 cec #23

Merged
merged 31 commits into from
Jul 12, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
1ac182d
copy-pasted some driver code from the internet.
ThijsWithaar Jun 29, 2013
28ade54
ahh!, it compiles.
ThijsWithaar Jun 29, 2013
884d231
low-level initialization functions
ThijsWithaar Jun 29, 2013
37fc68a
add intro to README
ThijsWithaar Jun 30, 2013
71c93c3
make it 'insmod' succesfully
ThijsWithaar Jun 30, 2013
2aabc89
define resources, maybe now it probes() ?
ThijsWithaar Jun 30, 2013
ddab47c
resources for exynos4
ThijsWithaar Jun 30, 2013
fa80111
fixup readme
ThijsWithaar Jun 30, 2013
d6aee2d
adapt file-organization to the rest of s5p
ThijsWithaar Jun 30, 2013
8c06a6e
some debug tracing
ThijsWithaar Jun 30, 2013
5fd9b96
not sure where regs-cec.h should go.
ThijsWithaar Jun 30, 2013
99b80bb
Hook up the cec-platform to the per-architecture registration.
ThijsWithaar Jun 30, 2013
6431be2
Fix one crash
ThijsWithaar Jun 30, 2013
89a97aa
Give probe() a chance of working.
ThijsWithaar Jun 30, 2013
5d0d3f5
Not sure what the clock is good for, disable it for now.
ThijsWithaar Jun 30, 2013
7b8d88b
more tracing
ThijsWithaar Jun 30, 2013
197a681
status update
ThijsWithaar Jun 30, 2013
e950e9a
found a clock in the android sources, let's use it
ThijsWithaar Jun 30, 2013
2e688b3
small fixes
ThijsWithaar Jun 30, 2013
a5cdef9
properly free the irq
ThijsWithaar Jun 30, 2013
8ed55e5
fix cleanup of mmio and irq's
ThijsWithaar Jun 30, 2013
e768be3
cleanup the diff w.r.t hardkernel's 3.8.y kernel
ThijsWithaar Jun 30, 2013
69c6fbd
update status
ThijsWithaar Jun 30, 2013
4aa36de
modify debug output
ThijsWithaar Jun 30, 2013
78e5f6a
add some debug prints
ThijsWithaar Jun 30, 2013
2012fa7
Fill in platform_data, so that the CEC GPIO-pins get properly set
ThijsWithaar Jun 30, 2013
02d365b
Set s5p-cec platform data on hkdk4412.
ThijsWithaar Jul 1, 2013
35ee5e8
Merge remote-tracking branch 'upstream/odroid-3.8.y' into odroid-3.8-cec
ThijsWithaar Jul 1, 2013
f0c0ea3
cleanup
ThijsWithaar Jul 1, 2013
785289f
status update
ThijsWithaar Jul 1, 2013
d58c60f
cleanup
ThijsWithaar Jul 1, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
Summary:
Get CEC (tv-remote control over HDMI) working on linux.
There are android-kernel sources, which have not made it
to the main linux kernel-tree, so also the hardkernel
linux-tree doesn't have CEC for exynos platforms.

Status:
Copied s5p-cec code from all over the internet, mostly from
http://dn.odroid.com/Android_Alpha_4.0.3/BSP/
Made it compile as module (s5p-cec.ko)
Fixed the insmod()/rmmod() stuff. Error handling and resource
free-ing were quite broken.

Using a modified cec-client, it's possible to observe the
tv changing it's inputs, see:
https://github.com/vamanea/libcec.git

TODO:
Cleanup this tree, so it becomes a nice diff upon hardkernel's 3.8 tree


================================================================================

Linux kernel release 3.x <http://kernel.org/>

These are the release notes for Linux version 3. Read them carefully,
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/mach-exynos/clock-exynos4.c
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,10 @@ static struct clk exynos4_init_clocks_off[] = {
.parent = &exynos4_clk_aclk_100.clk,
.enable = exynos4_clk_ip_perir_ctrl,
.ctrlbit = (1 << 14),
}, {
.name = "hdmicec",
.enable = exynos4_clk_ip_perir_ctrl,
.ctrlbit = (1 << 11),
}, {
.name = "usbhost",
.enable = exynos4_clk_ip_fsys_ctrl ,
Expand Down
3 changes: 3 additions & 0 deletions arch/arm/mach-exynos/include/mach/irqs.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
#define EXYNOS4_IRQ_GPS IRQ_SPI(111)
#define EXYNOS4_IRQ_INTFEEDCTRL_SSS IRQ_SPI(112)
#define EXYNOS4_IRQ_SLIMBUS IRQ_SPI(113)
#define EXYNOS4_IRQ_CEC IRQ_SPI(114)

#define EXYNOS4_IRQ_TSI IRQ_SPI(115)
#define EXYNOS4_IRQ_SATA IRQ_SPI(116)
Expand Down Expand Up @@ -235,6 +236,8 @@
#define IRQ_KEYPAD EXYNOS4_IRQ_KEYPAD
#define IRQ_PMU EXYNOS4_IRQ_PMU

#define IRQ_CEC EXYNOS4_IRQ_CEC

#define IRQ_FIMD0_FIFO EXYNOS4_IRQ_FIMD0_FIFO
#define IRQ_FIMD0_VSYNC EXYNOS4_IRQ_FIMD0_VSYNC
#define IRQ_FIMD0_SYSTEM EXYNOS4_IRQ_FIMD0_SYSTEM
Expand Down
5 changes: 5 additions & 0 deletions arch/arm/mach-exynos/include/mach/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@

#define EXYNOS4_PA_KEYPAD 0x100A0000

#define EXYNOS4_PA_CEC 0x100B0000

#define EXYNOS4_PA_DMC0 0x10400000
#define EXYNOS4_PA_DMC1 0x10410000

Expand Down Expand Up @@ -276,6 +278,9 @@
#define SAMSUNG_PA_ADC1 EXYNOS4_PA_ADC1
#define SAMSUNG_PA_KEYPAD EXYNOS4_PA_KEYPAD

#define S5P_PA_HDMI_CEC EXYNOS4_PA_CEC
#define S5P_SZ_HDMI_CEC SZ_4K

/* Compatibility UART */

#define EXYNOS4_PA_UART0 0x13800000
Expand Down
8 changes: 8 additions & 0 deletions arch/arm/mach-exynos/mach-hkdk4412.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ static struct platform_device *hkdk4412_devices[] __initdata = {
&mali_gpu_device,
#if defined(CONFIG_S5P_DEV_TV)
&s5p_device_hdmi,
&s5p_device_cec,
&s5p_device_i2c_hdmiphy,
&s5p_device_mixer,
&hdmi_fixed_voltage,
Expand All @@ -417,6 +418,12 @@ static struct platform_device *hkdk4412_devices[] __initdata = {
#endif
};

#if defined(CONFIG_S5P_DEV_TV)
static struct s5p_platform_cec hdmi_cec_data __initdata = {

};
#endif

static void __init hkdk4412_map_io(void)
{
clk_xusbxti.rate = 24000000;
Expand Down Expand Up @@ -525,6 +532,7 @@ static void __init hkdk4412_machine_init(void)
s5p_tv_setup();
s5p_i2c_hdmiphy_set_platdata(NULL);
s5p_hdmi_set_platdata(&hdmiphy_info, NULL, 0);
s5p_hdmi_cec_set_platdata(&hdmi_cec_data);
#endif

s5p_fimd0_set_platdata(&hkdk4412_fb_pdata);
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-exynos/mach-origen.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ static struct platform_device *origen_devices[] __initdata = {
&s5p_device_fimd0,
&s5p_device_g2d,
&s5p_device_hdmi,
&s5p_device_cec,
&s5p_device_i2c_hdmiphy,
&s5p_device_jpeg,
&s5p_device_mfc,
Expand Down
25 changes: 25 additions & 0 deletions arch/arm/mach-exynos/mach-smdk4x12.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,19 @@
#include <plat/mfc.h>
#include <plat/regs-serial.h>
#include <plat/sdhci.h>
#include <plat/hdmi.h>

#include <mach/map.h>

#include <drm/exynos_drm.h>
#include "common.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

/* Following are default values for UCON, ULCON and UFCON UART registers */
#define SMDK4X12_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
S3C2410_UCON_RXILEVEL | \
Expand Down Expand Up @@ -246,6 +253,12 @@ static struct samsung_keypad_platdata smdk4x12_keypad_data __initdata = {
.cols = 8,
};

#if defined(CONFIG_S5P_DEV_TV)
static struct s5p_platform_cec hdmi_cec_data __initdata = {

};
#endif

#ifdef CONFIG_DRM_EXYNOS_FIMD
static struct exynos_drm_fimd_pdata drm_fimd_pdata = {
.panel = {
Expand Down Expand Up @@ -332,6 +345,14 @@ static void __init smdk4x12_reserve(void)
s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
}

#if defined(CONFIG_S5P_DEV_TV)
void s5p_cec_cfg_gpio(struct platform_device *pdev)
{
s3c_gpio_cfgpin(HDMI_GPX(6), S3C_GPIO_SFN(0x3));
s3c_gpio_setpull(HDMI_GPX(6), S3C_GPIO_PULL_NONE);
}
#endif

static void __init smdk4x12_machine_init(void)
{
s3c_i2c0_set_platdata(NULL);
Expand Down Expand Up @@ -359,6 +380,10 @@ static void __init smdk4x12_machine_init(void)
s3c_sdhci3_set_platdata(&smdk4x12_hsmmc3_pdata);

s3c_hsotg_set_platdata(&smdk4x12_hsotg_pdata);

#if defined(CONFIG_S5P_DEV_TV)
s5p_hdmi_cec_set_platdata(&hdmi_cec_data);
#endif

#ifdef CONFIG_DRM_EXYNOS_FIMD
s5p_device_fimd0.dev.platform_data = &drm_fimd_pdata;
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-exynos/mach-smdkv310.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ static struct platform_device *smdkv310_devices[] __initdata = {
&smdkv310_smsc911x,
&exynos4_device_ahci,
&s5p_device_hdmi,
&s5p_device_cec,
&s5p_device_mixer,
};

Expand Down
4 changes: 4 additions & 0 deletions arch/arm/mach-s5pv210/include/mach/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
#define S5PV210_PA_PCM1 0xE1200000
#define S5PV210_PA_PCM2 0xE2B00000

#define S5PV210_PA_CEC 0xE1B00000

#define S5PV210_PA_TIMER 0xE2500000
#define S5PV210_PA_SYSTIMER 0xE2600000
#define S5PV210_PA_WATCHDOG 0xE2700000
Expand Down Expand Up @@ -126,6 +128,8 @@
#define S5P_PA_VP S5PV210_PA_VP
#define S5P_PA_MIXER S5PV210_PA_MIXER
#define S5P_PA_HDMI S5PV210_PA_HDMI
#define S5P_PA_CEC S5PV210_PA_CEC
#define S5P_SZ_CEC SZ_4K

#define S5P_PA_ONENAND S5PC110_PA_ONENAND
#define S5P_PA_ONENAND_DMA S5PC110_PA_ONENAND_DMA
Expand Down
31 changes: 31 additions & 0 deletions arch/arm/plat-samsung/devs.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
#include <plat/regs-serial.h>
#include <plat/regs-spi.h>
#include <linux/platform_data/spi-s3c64xx.h>
#include <plat/hdmi.h>


static u64 samsung_device_dma_mask = DMA_BIT_MASK(32);

Expand Down Expand Up @@ -806,6 +808,7 @@ void __init s5p_hdmi_set_platdata(struct i2c_board_info *hdmiphy_info,

#endif /* CONFIG_S5P_DEV_I2C_HDMIPHY */


/* I2S */

#ifdef CONFIG_PLAT_S3C24XX
Expand Down Expand Up @@ -1357,6 +1360,18 @@ struct platform_device s5p_device_hdmi = {
.resource = s5p_hdmi_resources,
};

static struct resource s5p_cec_resources[] = {
[0] = DEFINE_RES_MEM(S5P_PA_HDMI_CEC, S5P_SZ_HDMI_CEC),
[1] = DEFINE_RES_IRQ(IRQ_CEC),
};

struct platform_device s5p_device_cec = {
.name = "s5p-cec",
.id = -1,
.num_resources = ARRAY_SIZE(s5p_cec_resources),
.resource = s5p_cec_resources,
};

static struct resource s5p_sdo_resources[] = {
[0] = DEFINE_RES_MEM(S5P_PA_SDO, SZ_64K),
[1] = DEFINE_RES_IRQ(IRQ_SDO),
Expand Down Expand Up @@ -1385,6 +1400,22 @@ struct platform_device s5p_device_mixer = {
.coherent_dma_mask = DMA_BIT_MASK(32),
}
};

void __init s5p_hdmi_cec_set_platdata(struct s5p_platform_cec *pd)
{
struct s5p_platform_cec *npd;
printk(KERN_INFO "s5p_hdmi_cec_set_platdata()\n");

npd = kmemdup(pd, sizeof(struct s5p_platform_cec), GFP_KERNEL);
if (!npd)
printk(KERN_ERR "%s: no memory for platform data\n", __func__);
else {
if (!npd->cfg_gpio)
npd->cfg_gpio = s5p_cec_cfg_gpio;

s5p_device_cec.dev.platform_data = npd;
}
}
#endif /* CONFIG_S5P_DEV_TV */

/* USB */
Expand Down
1 change: 1 addition & 0 deletions arch/arm/plat-samsung/include/plat/devs.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ extern struct platform_device mali_gpu_device;

extern struct platform_device s5p_device_fimd0;
extern struct platform_device s5p_device_hdmi;
extern struct platform_device s5p_device_cec;
extern struct platform_device s5p_device_i2c_hdmiphy;
extern struct platform_device s5p_device_mfc;
extern struct platform_device s5p_device_mfc_l;
Expand Down
10 changes: 10 additions & 0 deletions arch/arm/plat-samsung/include/plat/hdmi.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@
#ifndef __PLAT_SAMSUNG_HDMI_H
#define __PLAT_SAMSUNG_HDMI_H __FILE__

struct s5p_platform_cec {

void (*cfg_gpio)(struct platform_device *pdev);
};

extern void s5p_hdmi_set_platdata(struct i2c_board_info *hdmiphy_info,
struct i2c_board_info *mhl_info, int mhl_bus);

extern void s5p_hdmi_cec_set_platdata(struct s5p_platform_cec *pd);

/* defined by architecture to configure gpio */
extern void s5p_cec_cfg_gpio(struct platform_device *pdev);

#endif /* __PLAT_SAMSUNG_HDMI_H */
7 changes: 7 additions & 0 deletions arch/arm/plat-samsung/include/plat/tv-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ static inline void s5p_hdmi_setname(char *name)
#endif
}

static inline void s5p_cec_setname(char *name)
{
#ifdef CONFIG_S5P_DEV_TV
s5p_device_cec.name = name;
#endif
}

static inline void s5p_mixer_setname(char *name)
{
#ifdef CONFIG_S5P_DEV_TV
Expand Down
7 changes: 7 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

export CROSS_COMPILE=arm-linux-gnueabihf-
export ARCH=arm

make M=drivers/media/platform/s5p-tv modules
scp drivers/media/platform/s5p-tv/s5p-cec.ko root@x2_wifi:/root
1 change: 1 addition & 0 deletions drivers/gpu/drm/drm_vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ void drm_vm_open_locked(struct drm_device *dev,
list_add(&vma_entry->head, &dev->vmalist);
}
}
EXPORT_SYMBOL_GPL(drm_vm_open_locked);

static void drm_vm_open(struct vm_area_struct *vma)
{
Expand Down
9 changes: 9 additions & 0 deletions drivers/media/platform/s5p-tv/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ config VIDEO_SAMSUNG_S5P_HDMI_DEBUG
help
Enables debugging for HDMI driver.

config VIDEO_SAMSUNG_S5P_HDMI_CEC
tristate "Enable CEC support for HDMI Driver"
depends on VIDEO_SAMSUNG_S5P_HDMI
default n
help
Enables CEC over the HDMI driver.
CEC enables tv-control, and reception of tv-remote
control commands over the HDMI interface

config VIDEO_SAMSUNG_S5P_HDMIPHY
tristate "Samsung HDMIPHY Driver"
depends on VIDEO_DEV && VIDEO_V4L2 && I2C
Expand Down
7 changes: 6 additions & 1 deletion drivers/media/platform/s5p-tv/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@

obj-$(CONFIG_VIDEO_SAMSUNG_S5P_HDMIPHY) += s5p-hdmiphy.o
s5p-hdmiphy-y += hdmiphy_drv.o

obj-$(CONFIG_VIDEO_SAMSUNG_S5P_SII9234) += s5p-sii9234.o
s5p-sii9234-y += sii9234_drv.o

obj-$(CONFIG_VIDEO_SAMSUNG_S5P_HDMI) += s5p-hdmi.o
s5p-hdmi-$(CONFIG_CPU_EXYNOS4210) += hdmi_drv.o
s5p-hdmi-$(CONFIG_SOC_EXYNOS4412) += hdmi_v14_drv.o

obj-$(CONFIG_VIDEO_SAMSUNG_S5P_HDMI_CEC) += s5p-cec.o
s5p-cec-y += cec_drv.o cec_hw.o

obj-$(CONFIG_VIDEO_SAMSUNG_S5P_SDO) += s5p-sdo.o
s5p-sdo-y += sdo_drv.o

obj-$(CONFIG_VIDEO_SAMSUNG_S5P_MIXER) += s5p-mixer.o
s5p-mixer-y += mixer_drv.o mixer_video.o mixer_reg.o mixer_grp_layer.o mixer_vp_layer.o

Loading