[PATCH 4/4] ARM: EXYNOS4: Add keypad device to the SMDKV310

2011-03-04 Thread Naveen Krishna Ch
This patch is to support keypad device to the SMDKV310 board.

Signed-off-by: Naveen Krishna Ch 
---
 arch/arm/mach-exynos4/Kconfig |2 ++
 arch/arm/mach-exynos4/mach-smdkv310.c |   24 
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos4/Kconfig b/arch/arm/mach-exynos4/Kconfig
index 14930a7..9a27b93 100644
--- a/arch/arm/mach-exynos4/Kconfig
+++ b/arch/arm/mach-exynos4/Kconfig
@@ -107,9 +107,11 @@ config MACH_SMDKV310
select S3C_DEV_HSMMC1
select S3C_DEV_HSMMC2
select S3C_DEV_HSMMC3
+   select SAMSUNG_DEV_KEYPAD
select EXYNOS4_DEV_PD
select EXYNOS4_DEV_SYSMMU
select EXYNOS4_SETUP_I2C1
+   select EXYNOS4_SETUP_KEYPAD
select EXYNOS4_SETUP_SDHCI
help
  Machine support for Samsung SMDKV310
diff --git a/arch/arm/mach-exynos4/mach-smdkv310.c 
b/arch/arm/mach-exynos4/mach-smdkv310.c
index 07860a5..88e0275 100644
--- a/arch/arm/mach-exynos4/mach-smdkv310.c
+++ b/arch/arm/mach-exynos4/mach-smdkv310.c
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -24,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -142,6 +144,25 @@ static struct platform_device smdkv310_smsc911x = {
},
 };
 
+static uint32_t smdkv310_keymap[] __initdata = {
+   /* KEY(row, col, keycode) */
+   KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
+   KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
+   KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
+   KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
+};
+
+static struct matrix_keymap_data smdkv310_keymap_data __initdata = {
+   .keymap = smdkv310_keymap,
+   .keymap_size= ARRAY_SIZE(smdkv310_keymap),
+};
+
+static struct samsung_keypad_platdata smdkv310_keypad_data __initdata = {
+   .keymap_data= &smdkv310_keymap_data,
+   .rows   = 2,
+   .cols   = 8,
+};
+
 static struct i2c_board_info i2c_devs1[] __initdata = {
{I2C_BOARD_INFO("wm8994", 0x1a),},
 };
@@ -156,6 +177,7 @@ static struct platform_device *smdkv310_devices[] 
__initdata = {
&s3c_device_wdt,
&exynos4_device_ac97,
&exynos4_device_i2s0,
+   &samsung_device_keypad,
&exynos4_device_pd[PD_MFC],
&exynos4_device_pd[PD_G3D],
&exynos4_device_pd[PD_LCD0],
@@ -210,6 +232,8 @@ static void __init smdkv310_machine_init(void)
s3c_sdhci2_set_platdata(&smdkv310_hsmmc2_pdata);
s3c_sdhci3_set_platdata(&smdkv310_hsmmc3_pdata);
 
+   samsung_keypad_set_platdata(&smdkv310_keypad_data);
+
platform_add_devices(smdkv310_devices, ARRAY_SIZE(smdkv310_devices));
 }
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] ARM: EXYNOS4: Update keypad base address

2011-03-04 Thread Naveen Krishna Ch
This patch updates the keypad IF base address in the memory map
for EXYNOS4.

Signed-off-by: Naveen Krishna Ch 
---
 arch/arm/mach-exynos4/include/mach/map.h |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos4/include/mach/map.h 
b/arch/arm/mach-exynos4/include/mach/map.h
index 80a41e0..d7e331a 100644
--- a/arch/arm/mach-exynos4/include/mach/map.h
+++ b/arch/arm/mach-exynos4/include/mach/map.h
@@ -47,6 +47,8 @@
 #define EXYNOS4_PA_WATCHDOG0x1006
 #define EXYNOS4_PA_RTC 0x1007
 
+#define EXYNOS4_PA_KEYPAD  0x100A
+
 #define EXYNOS4_PA_DMC00x1040
 
 #define EXYNOS4_PA_COMBINER0x10448000
@@ -128,6 +130,8 @@
 #define S5P_PA_SYSCON  EXYNOS4_PA_SYSCON
 #define S5P_PA_TIMER   EXYNOS4_PA_TIMER
 
+#define SAMSUNG_PA_KEYPAD  EXYNOS4_PA_KEYPAD
+
 /* UART */
 
 #define S3C_PA_UARTEXYNOS4_PA_UART
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] ARM: EXYNOS4: Update clocks for keypad

2011-03-04 Thread Naveen Krishna Ch
The keypad IF on EXYNOS4 uses 100MHz from PERIR functional
block for clocks, this patch updates the same.

Signed-off-by: Naveen Krishna Ch 
---
 arch/arm/mach-exynos4/clock.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos4/clock.c b/arch/arm/mach-exynos4/clock.c
index 72d53d5..fa844fc 100644
--- a/arch/arm/mach-exynos4/clock.c
+++ b/arch/arm/mach-exynos4/clock.c
@@ -482,6 +482,11 @@ static struct clk init_clocks_off[] = {
.enable = exynos4_clk_ip_peril_ctrl,
.ctrlbit= (1 << 15),
}, {
+   .name   = "keypad",
+   .id = -1,
+   .enable = exynos4_clk_ip_perir_ctrl,
+   .ctrlbit= (1 << 16),
+   }, {
.name   = "rtc",
.id = -1,
.enable = exynos4_clk_ip_perir_ctrl,
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] ARM: EXYNOS4: Add keypad device helpers

2011-03-04 Thread Naveen Krishna Ch
This patch adds the samsung_keypad_cfg_gpio() for EXYNOS4.
Now, this helpers are only for keypad operating in PORT-0.

Signed-off-by: Naveen Krishna Ch 
---
 arch/arm/mach-exynos4/Kconfig|5 
 arch/arm/mach-exynos4/Makefile   |1 +
 arch/arm/mach-exynos4/setup-keypad.c |   35 ++
 3 files changed, 41 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-exynos4/setup-keypad.c

diff --git a/arch/arm/mach-exynos4/Kconfig b/arch/arm/mach-exynos4/Kconfig
index d3893f6..14930a7 100644
--- a/arch/arm/mach-exynos4/Kconfig
+++ b/arch/arm/mach-exynos4/Kconfig
@@ -60,6 +60,11 @@ config EXYNOS4_SETUP_I2C7
help
  Common setup code for i2c bus 7.
 
+config EXYNOS4_SETUP_KEYPAD
+   bool
+   help
+ Common setup code for keypad.
+
 config EXYNOS4_SETUP_SDHCI
bool
select EXYNOS4_SETUP_SDHCI_GPIO
diff --git a/arch/arm/mach-exynos4/Makefile b/arch/arm/mach-exynos4/Makefile
index 45422cb..c13fd36 100644
--- a/arch/arm/mach-exynos4/Makefile
+++ b/arch/arm/mach-exynos4/Makefile
@@ -41,5 +41,6 @@ obj-$(CONFIG_EXYNOS4_SETUP_I2C4)  += setup-i2c4.o
 obj-$(CONFIG_EXYNOS4_SETUP_I2C5)   += setup-i2c5.o
 obj-$(CONFIG_EXYNOS4_SETUP_I2C6)   += setup-i2c6.o
 obj-$(CONFIG_EXYNOS4_SETUP_I2C7)   += setup-i2c7.o
+obj-$(CONFIG_EXYNOS4_SETUP_KEYPAD) += setup-keypad.o
 obj-$(CONFIG_EXYNOS4_SETUP_SDHCI)  += setup-sdhci.o
 obj-$(CONFIG_EXYNOS4_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
diff --git a/arch/arm/mach-exynos4/setup-keypad.c 
b/arch/arm/mach-exynos4/setup-keypad.c
new file mode 100644
index 000..1ee0ebf
--- /dev/null
+++ b/arch/arm/mach-exynos4/setup-keypad.c
@@ -0,0 +1,35 @@
+/* linux/arch/arm/mach-exynos4/setup-keypad.c
+ *
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * GPIO configuration for Exynos4 KeyPad device
+ *
+ * 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 
+#include 
+
+void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols)
+{
+   /* Keypads can be of various combinations, Just making sure */
+
+   if (rows > 8) {
+   /* Set all the necessary GPX2 pins: KP_ROW[0~7] */
+   s3c_gpio_cfgrange_nopull(EXYNOS4_GPX2(0), 8, S3C_GPIO_SFN(3));
+
+   /* Set all the necessary GPX3 pins: KP_ROW[8~] */
+   s3c_gpio_cfgrange_nopull(EXYNOS4_GPX3(0), (rows - 8),
+S3C_GPIO_SFN(3));
+   } else {
+   /* Set all the necessary GPX2 pins: KP_ROW[x] */
+   s3c_gpio_cfgrange_nopull(EXYNOS4_GPX2(0), rows,
+S3C_GPIO_SFN(3));
+   }
+
+   /* Set all the necessary GPX1 pins to special-function 3: KP_COL[x] */
+   s3c_gpio_cfgrange_nopull(EXYNOS4_GPX1(0), cols, S3C_GPIO_SFN(3));
+}
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RE-SEND 0/4] ARM: EXYNOS4: Add keypad device to the SMDKV310

2011-03-04 Thread Naveen Krishna Ch
NOTE: Please kindly ignore previous my keypad patches.
This is right version, sorry for bothering :(

This patch adds support KEYPAD on Samsung SMDKV310 board.

[PATCH 1/4] ARM: EXYNOS4: Add keypad device helpers
[PATCH 2/4] ARM: EXYNOS4: Update keypad base address
[PATCH 3/4] ARM: EXYNOS4: Update clocks for keypad
[PATCH 4/4] ARM: EXYNOS4: Add keypad device to the SMDKV310
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] ARM: EXYNOS4: Update keypad base address

2011-03-04 Thread Naveen Krishna Ch
This patch updates the keypad IF base address in the memory map
for EXYNOS4.

Signed-off-by: Naveen Krishna Ch 
Signed-off-by: Kukjin Kim 
---
 arch/arm/mach-exynos4/include/mach/map.h |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos4/include/mach/map.h 
b/arch/arm/mach-exynos4/include/mach/map.h
index 80a41e0..d7e331a 100644
--- a/arch/arm/mach-exynos4/include/mach/map.h
+++ b/arch/arm/mach-exynos4/include/mach/map.h
@@ -47,6 +47,8 @@
 #define EXYNOS4_PA_WATCHDOG0x1006
 #define EXYNOS4_PA_RTC 0x1007
 
+#define EXYNOS4_PA_KEYPAD  0x100A
+
 #define EXYNOS4_PA_DMC00x1040
 
 #define EXYNOS4_PA_COMBINER0x10448000
@@ -128,6 +130,8 @@
 #define S5P_PA_SYSCON  EXYNOS4_PA_SYSCON
 #define S5P_PA_TIMER   EXYNOS4_PA_TIMER
 
+#define SAMSUNG_PA_KEYPAD  EXYNOS4_PA_KEYPAD
+
 /* UART */
 
 #define S3C_PA_UARTEXYNOS4_PA_UART
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] ARM: EXYNOS4: Add keypad device to the SMDKV310

2011-03-04 Thread Naveen Krishna Ch
This patch is to support keypad device to the SMDKV310 board.

Signed-off-by: Naveen Krishna Ch 
Signed-off-by: Kukjin Kim 
---
 arch/arm/mach-exynos4/Kconfig |2 ++
 arch/arm/mach-exynos4/mach-smdkv310.c |   24 
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos4/Kconfig b/arch/arm/mach-exynos4/Kconfig
index 14930a7..9a27b93 100644
--- a/arch/arm/mach-exynos4/Kconfig
+++ b/arch/arm/mach-exynos4/Kconfig
@@ -107,9 +107,11 @@ config MACH_SMDKV310
select S3C_DEV_HSMMC1
select S3C_DEV_HSMMC2
select S3C_DEV_HSMMC3
+   select SAMSUNG_DEV_KEYPAD
select EXYNOS4_DEV_PD
select EXYNOS4_DEV_SYSMMU
select EXYNOS4_SETUP_I2C1
+   select EXYNOS4_SETUP_KEYPAD
select EXYNOS4_SETUP_SDHCI
help
  Machine support for Samsung SMDKV310
diff --git a/arch/arm/mach-exynos4/mach-smdkv310.c 
b/arch/arm/mach-exynos4/mach-smdkv310.c
index 07860a5..88e0275 100644
--- a/arch/arm/mach-exynos4/mach-smdkv310.c
+++ b/arch/arm/mach-exynos4/mach-smdkv310.c
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -24,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -142,6 +144,25 @@ static struct platform_device smdkv310_smsc911x = {
},
 };
 
+static uint32_t smdkv310_keymap[] __initdata = {
+   /* KEY(row, col, keycode) */
+   KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
+   KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
+   KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
+   KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
+};
+
+static struct matrix_keymap_data smdkv310_keymap_data __initdata = {
+   .keymap = smdkv310_keymap,
+   .keymap_size= ARRAY_SIZE(smdkv310_keymap),
+};
+
+static struct samsung_keypad_platdata smdkv310_keypad_data __initdata = {
+   .keymap_data= &smdkv310_keymap_data,
+   .rows   = 2,
+   .cols   = 8,
+};
+
 static struct i2c_board_info i2c_devs1[] __initdata = {
{I2C_BOARD_INFO("wm8994", 0x1a),},
 };
@@ -156,6 +177,7 @@ static struct platform_device *smdkv310_devices[] 
__initdata = {
&s3c_device_wdt,
&exynos4_device_ac97,
&exynos4_device_i2s0,
+   &samsung_device_keypad,
&exynos4_device_pd[PD_MFC],
&exynos4_device_pd[PD_G3D],
&exynos4_device_pd[PD_LCD0],
@@ -210,6 +232,8 @@ static void __init smdkv310_machine_init(void)
s3c_sdhci2_set_platdata(&smdkv310_hsmmc2_pdata);
s3c_sdhci3_set_platdata(&smdkv310_hsmmc3_pdata);
 
+   samsung_keypad_set_platdata(&smdkv310_keypad_data);
+
platform_add_devices(smdkv310_devices, ARRAY_SIZE(smdkv310_devices));
 }
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] ARM: EXYNOS4: Update clocks for keypad

2011-03-04 Thread Naveen Krishna Ch
The keypad IF on EXYNOS4 uses 100MHz from PERIR functional
block for clocks, this patch updates the same.

Signed-off-by: Naveen Krishna Ch 
Signed-off-by: Kukjin Kim 
---
 arch/arm/mach-exynos4/clock.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos4/clock.c b/arch/arm/mach-exynos4/clock.c
index 72d53d5..fa844fc 100644
--- a/arch/arm/mach-exynos4/clock.c
+++ b/arch/arm/mach-exynos4/clock.c
@@ -482,6 +482,11 @@ static struct clk init_clocks_off[] = {
.enable = exynos4_clk_ip_peril_ctrl,
.ctrlbit= (1 << 15),
}, {
+   .name   = "keypad",
+   .id = -1,
+   .enable = exynos4_clk_ip_perir_ctrl,
+   .ctrlbit= (1 << 16),
+   }, {
.name   = "rtc",
.id = -1,
.enable = exynos4_clk_ip_perir_ctrl,
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] ARM: EXYNOS4: Add keypad device helpers

2011-03-04 Thread Naveen Krishna Ch
This patch adds the samsung_keypad_cfg_gpio() for EXYNOS4.
Now, this helpers are only for keypad operating in PORT-0.

Signed-off-by: Naveen Krishna Ch 
Signed-off-by: Kukjin Kim 
---
 arch/arm/mach-exynos4/Kconfig|5 
 arch/arm/mach-exynos4/Makefile   |1 +
 arch/arm/mach-exynos4/setup-keypad.c |   35 ++
 3 files changed, 41 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-exynos4/setup-keypad.c

diff --git a/arch/arm/mach-exynos4/Kconfig b/arch/arm/mach-exynos4/Kconfig
index d3893f6..14930a7 100644
--- a/arch/arm/mach-exynos4/Kconfig
+++ b/arch/arm/mach-exynos4/Kconfig
@@ -60,6 +60,11 @@ config EXYNOS4_SETUP_I2C7
help
  Common setup code for i2c bus 7.
 
+config EXYNOS4_SETUP_KEYPAD
+   bool
+   help
+ Common setup code for keypad.
+
 config EXYNOS4_SETUP_SDHCI
bool
select EXYNOS4_SETUP_SDHCI_GPIO
diff --git a/arch/arm/mach-exynos4/Makefile b/arch/arm/mach-exynos4/Makefile
index 45422cb..c13fd36 100644
--- a/arch/arm/mach-exynos4/Makefile
+++ b/arch/arm/mach-exynos4/Makefile
@@ -41,5 +41,6 @@ obj-$(CONFIG_EXYNOS4_SETUP_I2C4)  += setup-i2c4.o
 obj-$(CONFIG_EXYNOS4_SETUP_I2C5)   += setup-i2c5.o
 obj-$(CONFIG_EXYNOS4_SETUP_I2C6)   += setup-i2c6.o
 obj-$(CONFIG_EXYNOS4_SETUP_I2C7)   += setup-i2c7.o
+obj-$(CONFIG_EXYNOS4_SETUP_KEYPAD) += setup-keypad.o
 obj-$(CONFIG_EXYNOS4_SETUP_SDHCI)  += setup-sdhci.o
 obj-$(CONFIG_EXYNOS4_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
diff --git a/arch/arm/mach-exynos4/setup-keypad.c 
b/arch/arm/mach-exynos4/setup-keypad.c
new file mode 100644
index 000..1ee0ebf
--- /dev/null
+++ b/arch/arm/mach-exynos4/setup-keypad.c
@@ -0,0 +1,35 @@
+/* linux/arch/arm/mach-exynos4/setup-keypad.c
+ *
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * GPIO configuration for Exynos4 KeyPad device
+ *
+ * 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 
+#include 
+
+void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols)
+{
+   /* Keypads can be of various combinations, Just making sure */
+
+   if (rows > 8) {
+   /* Set all the necessary GPX2 pins: KP_ROW[0~7] */
+   s3c_gpio_cfgrange_nopull(EXYNOS4_GPX2(0), 8, S3C_GPIO_SFN(3));
+
+   /* Set all the necessary GPX3 pins: KP_ROW[8~] */
+   s3c_gpio_cfgrange_nopull(EXYNOS4_GPX3(0), (rows - 8),
+S3C_GPIO_SFN(3));
+   } else {
+   /* Set all the necessary GPX2 pins: KP_ROW[x] */
+   s3c_gpio_cfgrange_nopull(EXYNOS4_GPX2(0), rows,
+S3C_GPIO_SFN(3));
+   }
+
+   /* Set all the necessary GPX1 pins to special-function 3: KP_COL[x] */
+   s3c_gpio_cfgrange_nopull(EXYNOS4_GPX1(0), cols, S3C_GPIO_SFN(3));
+}
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/4] ARM: EXYNOS4: Add keypad device to the SMDKV310

2011-03-04 Thread Naveen Krishna Ch
This patch adds support KEYPAD on Samsung SMDKV310 board.

[PATCH 1/4] ARM: EXYNOS4: Add keypad device helpers
[PATCH 2/4] ARM: EXYNOS4: Update keypad base address
[PATCH 3/4] ARM: EXYNOS4: Update clocks for keypad
[PATCH 4/4] ARM: EXYNOS4: Add keypad device to the SMDKV310
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [RFC/PATCH v7 1/5] Changes in include/linux/videodev2.h for MFC 5.1

2011-03-04 Thread Kamil Debski
Hi,

> -Original Message-
> From: Laurent Pinchart [mailto:laurent.pinch...@ideasonboard.com]
> Sent: 04 March 2011 17:39
> To: Kamil Debski
> Cc: linux-me...@vger.kernel.org; linux-samsung-soc@vger.kernel.org;
> m.szyprow...@samsung.com; kyungmin.p...@samsung.com;
> jaeryul...@samsung.com; kgene@samsung.com
> Subject: Re: [RFC/PATCH v7 1/5] Changes in include/linux/videodev2.h
> for MFC 5.1
> 
> On Friday 04 March 2011 12:26:18 Kamil Debski wrote:
> > This patch adds fourcc values for compressed video stream formats and
> > V4L2_CTRL_CLASS_CODEC. Also adds controls used by MFC 5.1 driver.
> >
> > Signed-off-by: Kamil Debski 
> > Signed-off-by: Kyungmin Park 
> > ---
> >  include/linux/videodev2.h |   39
> +++
> >  1 files changed, 39 insertions(+), 0 deletions(-)
> >
> > diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
> > index a94c4d5..a48a42e 100644
> > --- a/include/linux/videodev2.h
> > +++ b/include/linux/videodev2.h
> > @@ -369,6 +369,19 @@ struct v4l2_pix_format {
> >  #define V4L2_PIX_FMT_DV   v4l2_fourcc('d', 'v', 's', 'd') /*
> 1394 */
> >  #define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /*
> MPEG-1/2/4 */
> >
> > +#define V4L2_PIX_FMT_H264 v4l2_fourcc('H', '2', '6', '4') /*
> H264 */
> > +#define V4L2_PIX_FMT_H263 v4l2_fourcc('H', '2', '6', '3') /*
> H263 */
> > +#define V4L2_PIX_FMT_MPEG12   v4l2_fourcc('M', 'P', '1', '2') /*
> MPEG-1/2  */
> > +#define V4L2_PIX_FMT_MPEG4v4l2_fourcc('M', 'P', 'G', '4') /*
> MPEG-4  */
> > +#define V4L2_PIX_FMT_DIVX v4l2_fourcc('D', 'I', 'V', 'X') /*
> DivX  */
> > +#define V4L2_PIX_FMT_DIVX3v4l2_fourcc('D', 'I', 'V', '3') /*
> DivX 3.11 */
> > +#define V4L2_PIX_FMT_DIVX4v4l2_fourcc('D', 'I', 'V', '4') /*
> DivX 4.12 */
> > +#define V4L2_PIX_FMT_DIVX500  v4l2_fourcc('D', 'X', '5', '2') /*
> DivX 5.00 - 5.02 */
> > +#define V4L2_PIX_FMT_DIVX503  v4l2_fourcc('D', 'X', '5', '3') /*
> DivX 5.03 - x */
> > +#define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D') /*
> Xvid */
> > +#define V4L2_PIX_FMT_VC1  v4l2_fourcc('V', 'C', '1', 'A') /* VC-
> 1 */
> > +#define V4L2_PIX_FMT_VC1_RCV  v4l2_fourcc('V', 'C', '1', 'R') /* VC-
> 1 RCV */
> > +
> 
> Hans, you mentioned some time ago that you were against ading H.264 or
> MPEG4
> fourccs, and that drivers should use the MPEG controls instead. Could
> you
> clarify your current position on this ?

If I remember correct there was no clear conclusion on this. I hope we can
discuss this
during the upcoming meeting. 

Have you got an alternative suggestion to using fourccs?

The existing MPEG controls won't cover all the functions and parameters that
are
used by video codecs. The controls that are in this patch are the ones
related to
decoding, there is even more for encoding.

Yesterday I have been talking with Hans on the IRC channel about the control
for
quantization parameters and he has suggested to use different for MPEG4,
H263 and H264.
Personally I'd like to have a common one, as the QP meaning is the same in
those 3
cases, the difference is the range of the value.
So I think that this still is a subject that could use more discussion as
there are
a few ideas.

Best regards,

-- 
Kamil Debski
Linux Platform Group
Samsung Poland R&D Center

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC/PATCH v7 1/5] Changes in include/linux/videodev2.h for MFC 5.1

2011-03-04 Thread Laurent Pinchart
On Friday 04 March 2011 12:26:18 Kamil Debski wrote:
> This patch adds fourcc values for compressed video stream formats and
> V4L2_CTRL_CLASS_CODEC. Also adds controls used by MFC 5.1 driver.
> 
> Signed-off-by: Kamil Debski 
> Signed-off-by: Kyungmin Park 
> ---
>  include/linux/videodev2.h |   39 +++
>  1 files changed, 39 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
> index a94c4d5..a48a42e 100644
> --- a/include/linux/videodev2.h
> +++ b/include/linux/videodev2.h
> @@ -369,6 +369,19 @@ struct v4l2_pix_format {
>  #define V4L2_PIX_FMT_DV   v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */
>  #define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 
> */
> 
> +#define V4L2_PIX_FMT_H264 v4l2_fourcc('H', '2', '6', '4') /* H264 */
> +#define V4L2_PIX_FMT_H263 v4l2_fourcc('H', '2', '6', '3') /* H263 */
> +#define V4L2_PIX_FMT_MPEG12   v4l2_fourcc('M', 'P', '1', '2') /* MPEG-1/2  */
> +#define V4L2_PIX_FMT_MPEG4v4l2_fourcc('M', 'P', 'G', '4') /* MPEG-4  */
> +#define V4L2_PIX_FMT_DIVX v4l2_fourcc('D', 'I', 'V', 'X') /* DivX  */
> +#define V4L2_PIX_FMT_DIVX3v4l2_fourcc('D', 'I', 'V', '3') /* DivX 3.11 */
> +#define V4L2_PIX_FMT_DIVX4v4l2_fourcc('D', 'I', 'V', '4') /* DivX 4.12 */
> +#define V4L2_PIX_FMT_DIVX500  v4l2_fourcc('D', 'X', '5', '2') /* DivX 5.00 - 
> 5.02 */
> +#define V4L2_PIX_FMT_DIVX503  v4l2_fourcc('D', 'X', '5', '3') /* DivX 5.03 - 
> x */
> +#define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D') /* Xvid */
> +#define V4L2_PIX_FMT_VC1  v4l2_fourcc('V', 'C', '1', 'A') /* VC-1 */
> +#define V4L2_PIX_FMT_VC1_RCV  v4l2_fourcc('V', 'C', '1', 'R') /* VC-1 RCV */
> +

Hans, you mentioned some time ago that you were against ading H.264 or MPEG4
fourccs, and that drivers should use the MPEG controls instead. Could you
clarify your current position on this ?

-- 
Regards,

Laurent Pinchart
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/7] ARM: Samsung: update/rewrite Samsung SYSMMU (IOMMU) driver

2011-03-04 Thread Marek Szyprowski
From: Andrzej Pietrasiewicz 

This patch performs a complete rewrite of sysmmu driver for Samsung platform:
- the new version introduces an api to construct device private page
  tables and enables to use device private address space mode
- simplified the resource management: no more single platform
  device with 32 resources is needed, better fits into linux driver model,
  each sysmmu instance has it's own resource definition
- added support for sysmmu clocks
- some other minor API chages required by upcoming videobuf2 allocator

Signed-off-by: Andrzej Pietrasiewicz 
Signed-off-by: Kyungmin Park 
Signed-off-by: Marek Szyprowski 
---

Hello,

I'm really sorry for breaking this patch in the previous mail. The
semi-colon is missing in the "EXPORT_SYMBOL_GPL(s5p_sysmmu_unmap_area)"
line. This is the fixed version.

Best regards
--
Marek Szyprowski
Samsung Poland R&D Center

---
 arch/arm/mach-s5pv310/clock.c|   91 ++
 arch/arm/mach-s5pv310/dev-sysmmu.c   |  582 +
 arch/arm/mach-s5pv310/include/mach/irqs.h|   36 +-
 arch/arm/mach-s5pv310/include/mach/regs-clock.h  |3 +
 arch/arm/mach-s5pv310/include/mach/regs-sysmmu.h |   23 +-
 arch/arm/mach-s5pv310/include/mach/sysmmu.h  |  122 ---
 arch/arm/plat-s5p/Kconfig|   17 +-
 arch/arm/plat-s5p/include/plat/sysmmu.h  |  127 +++
 arch/arm/plat-s5p/sysmmu.c   |  988 +++---
 arch/arm/plat-samsung/include/plat/devs.h|2 +-
 10 files changed, 1323 insertions(+), 668 deletions(-)
 rewrite arch/arm/mach-s5pv310/dev-sysmmu.c (86%)
 delete mode 100644 arch/arm/mach-s5pv310/include/mach/sysmmu.h
 create mode 100644 arch/arm/plat-s5p/include/plat/sysmmu.h
 rewrite arch/arm/plat-s5p/sysmmu.c (85%)

diff --git a/arch/arm/mach-s5pv310/clock.c b/arch/arm/mach-s5pv310/clock.c
index fc7c2f8..f142b8c 100644
--- a/arch/arm/mach-s5pv310/clock.c
+++ b/arch/arm/mach-s5pv310/clock.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -116,6 +117,21 @@ static int s5pv310_clk_ip_perir_ctrl(struct clk *clk, int 
enable)
return s5p_gatectrl(S5P_CLKGATE_IP_PERIR, clk, enable);
 }
 
+static int s5pv310_clk_ip_dmc_ctrl(struct clk *clk, int enable)
+{
+   return s5p_gatectrl(S5P_CLKGATE_IP_DMC, clk, enable);
+}
+
+static int s5pv310_clk_ip_mfc_ctrl(struct clk *clk, int enable)
+{
+   return s5p_gatectrl(S5P_CLKGATE_IP_MFC, clk, enable);
+}
+
+static int s5pv310_clk_ip_tv_ctrl(struct clk *clk, int enable)
+{
+   return s5p_gatectrl(S5P_CLKGATE_IP_TV, clk, enable);
+}
+
 /* Core list of CMU_CPU side */
 
 static struct clksrc_clk clk_mout_apll = {
@@ -422,6 +438,81 @@ static struct clk init_clocks_off[] = {
.enable = s5pv310_clk_ip_cam_ctrl,
.ctrlbit= (1 << 3),
}, {
+   .name   = "sysmmu",
+   .id = S5P_SYSMMU_MFC_L,
+   .enable = s5pv310_clk_ip_mfc_ctrl,
+   .ctrlbit= ((15 << 1) | 1),
+   }, {
+   .name   = "sysmmu",
+   .id = S5P_SYSMMU_MFC_R,
+   .enable = s5pv310_clk_ip_mfc_ctrl,
+   .ctrlbit= ((15 << 1) | 1),
+   }, {
+   .name   = "sysmmu",
+   .id = S5P_SYSMMU_FIMC0,
+   .enable = s5pv310_clk_ip_cam_ctrl,
+   .ctrlbit= (1 << 7),
+   }, {
+   .name   = "sysmmu",
+   .id = S5P_SYSMMU_FIMC1,
+   .enable = s5pv310_clk_ip_cam_ctrl,
+   .ctrlbit= (1 << 8),
+   } , {
+   .name   = "sysmmu",
+   .id = S5P_SYSMMU_FIMC2,
+   .enable = s5pv310_clk_ip_cam_ctrl,
+   .ctrlbit= (1 << 9),
+   } , {
+   .name   = "sysmmu",
+   .id = S5P_SYSMMU_FIMC3,
+   .enable = s5pv310_clk_ip_cam_ctrl,
+   .ctrlbit= (1 << 10),
+   } , {
+   .name   = "sysmmu",
+   .id = S5P_SYSMMU_JPEG,
+   .enable = s5pv310_clk_ip_cam_ctrl,
+   .ctrlbit= (1 << 11),
+   } , {
+   .name   = "sysmmu",
+   .id = S5P_SYSMMU_TV,
+   .enable = s5pv310_clk_ip_tv_ctrl,
+   .ctrlbit= (1 << 4),
+   } , {
+   .name   = "sysmmu",
+   .id = S5P_SYSMMU_G2D,
+   .enable = s5pv310_clk_ip_image_ctrl,
+   .ctrlbit= (1 << 3),
+   } , {
+   .name   = "sysmmu",
+   .id = S5P_SYSMMU_ROTATOR,
+   .enable = s5pv310_clk_ip_image_ctrl,
+   .ctrlbit= (1 << 4)

[PATCH 3/6] v4l: add macro for 1080p59_54 preset

2011-03-04 Thread Tomasz Stanislawski
The 1080p59_94 is supported in latest Samusng SoC.

Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
---
 drivers/media/video/v4l2-common.c |1 +
 include/linux/videodev2.h |1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/v4l2-common.c 
b/drivers/media/video/v4l2-common.c
index 940b5db..ef684f6 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -645,6 +645,7 @@ int v4l_fill_dv_preset_info(u32 preset, struct 
v4l2_dv_enum_preset *info)
{ 1920, 1080, "1080p@30" }, /* V4L2_DV_1080P30 */
{ 1920, 1080, "1080p@50" }, /* V4L2_DV_1080P50 */
{ 1920, 1080, "1080p@60" }, /* V4L2_DV_1080P60 */
+   { 1920, 1080, "1080p@59.94" },  /* V4L2_DV_1080P59_94 */
};
 
if (info == NULL || preset >= ARRAY_SIZE(dv_presets))
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index a48a42e..4a44b45 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -875,6 +875,7 @@ struct v4l2_dv_enum_preset {
 #defineV4L2_DV_1080P30 16 /* SMPTE 296M */
 #defineV4L2_DV_1080P50 17 /* BT.1120 */
 #defineV4L2_DV_1080P60 18 /* BT.1120 */
+#defineV4L2_DV_1080P59_94  19
 
 /*
  * D V B T T I M I N G S
-- 
1.7.1.569.g6f426
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/6] s5pv310: add s5p-tv to platform devices

2011-03-04 Thread Tomasz Stanislawski
Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
Reviewed-by: Marek Szyprowski 

s5pv310: fix and clean code for TV power
s5pv310: tv: fix clock setup
s5pv310: tv: integrate with Power Domain driver
s5pv310: tv: register fix
s5pv310: tv: add port HDMI_EN1 gpio to regulator api
s5pv310: tv: use hdmiphy as clock
s5pv310: tv: moved TV setup to separete function
s5pv310: hdmi: removed control for clocks and regulators
s5pv310: mixer: removed control for clocks and regulators
---
 arch/arm/mach-s5pv310/Kconfig   |5 +
 arch/arm/mach-s5pv310/Makefile  |1 +
 arch/arm/mach-s5pv310/clock.c   |  132 ++-
 arch/arm/mach-s5pv310/dev-tv.c  |  103 ++
 arch/arm/mach-s5pv310/include/mach/irqs.h   |4 +
 arch/arm/mach-s5pv310/include/mach/map.h|   26 +
 arch/arm/mach-s5pv310/include/mach/regs-clock.h |3 +
 arch/arm/mach-s5pv310/include/mach/regs-pmu.h   |2 +
 arch/arm/plat-samsung/include/plat/devs.h   |2 +
 9 files changed, 277 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-s5pv310/dev-tv.c

diff --git a/arch/arm/mach-s5pv310/Kconfig b/arch/arm/mach-s5pv310/Kconfig
index 6f83817..4c863850 100644
--- a/arch/arm/mach-s5pv310/Kconfig
+++ b/arch/arm/mach-s5pv310/Kconfig
@@ -20,6 +20,11 @@ config S5PV310_DEV_PD
help
  Compile in platform device definitions for Power Domain
 
+config S5PV310_DEV_TV
+   bool
+   help
+ Compile in platform device definition for TV interface
+
 config S5PV310_SETUP_I2C1
bool
help
diff --git a/arch/arm/mach-s5pv310/Makefile b/arch/arm/mach-s5pv310/Makefile
index 036fb38..a234b80 100644
--- a/arch/arm/mach-s5pv310/Makefile
+++ b/arch/arm/mach-s5pv310/Makefile
@@ -32,6 +32,7 @@ obj-y += dev-audio.o
 obj-$(CONFIG_S5PV310_DEV_PD)   += dev-pd.o
 obj-$(CONFIG_S5PV310_DEV_SYSMMU)   += dev-sysmmu.o
 
+obj-$(CONFIG_S5PV310_DEV_TV)   += dev-tv.o
 obj-$(CONFIG_S5PV310_SETUP_I2C1)   += setup-i2c1.o
 obj-$(CONFIG_S5PV310_SETUP_I2C2)   += setup-i2c2.o
 obj-$(CONFIG_S5PV310_SETUP_I2C3)   += setup-i2c3.o
diff --git a/arch/arm/mach-s5pv310/clock.c b/arch/arm/mach-s5pv310/clock.c
index 465beb9..f037be6 100644
--- a/arch/arm/mach-s5pv310/clock.c
+++ b/arch/arm/mach-s5pv310/clock.c
@@ -24,6 +24,7 @@
 
 #include 
 #include 
+#include 
 
 static struct clk clk_sclk_hdmi27m = {
.name   = "sclk_hdmi27m",
@@ -82,6 +83,11 @@ static int s5pv310_clksrc_mask_peril1_ctrl(struct clk *clk, 
int enable)
return s5p_gatectrl(S5P_CLKSRC_MASK_PERIL1, clk, enable);
 }
 
+static int s5pv310_clksrc_mask_tv_ctrl(struct clk *clk, int enable)
+{
+   return s5p_gatectrl(S5P_CLKSRC_MASK_TV, clk, enable);
+}
+
 static int s5pv310_clk_ip_cam_ctrl(struct clk *clk, int enable)
 {
return s5p_gatectrl(S5P_CLKGATE_IP_CAM, clk, enable);
@@ -132,6 +138,11 @@ static int s5pv310_clk_ip_tv_ctrl(struct clk *clk, int 
enable)
return s5p_gatectrl(S5P_CLKGATE_IP_TV, clk, enable);
 }
 
+static int s5pv310_clk_hdmiphy_ctrl(struct clk *clk, int enable)
+{
+   return s5p_gatectrl(S5P_HDMI_PHY_CONTROL, clk, enable);
+}
+
 /* Core list of CMU_CPU side */
 
 static struct clksrc_clk clk_mout_apll = {
@@ -528,6 +539,31 @@ static struct clk init_clocks_off[] = {
.enable = s5pv310_clk_ip_mfc_ctrl,
.ctrlbit= (1 << 0),
}, {
+   .name   = "dac",
+   .id = -1,
+   .enable = s5pv310_clk_ip_tv_ctrl,
+   .ctrlbit= (1 << 2),
+   }, {
+   .name   = "mixer",
+   .id = -1,
+   .enable = s5pv310_clk_ip_tv_ctrl,
+   .ctrlbit= (1 << 1),
+   }, {
+   .name   = "vp",
+   .id = -1,
+   .enable = s5pv310_clk_ip_tv_ctrl,
+   .ctrlbit= (1 << 0),
+   }, {
+   .name   = "hdmi",
+   .id = -1,
+   .enable = s5pv310_clk_ip_tv_ctrl,
+   .ctrlbit= (1 << 3),
+   }, {
+   .name   = "hdmiphy",
+   .id = -1,
+   .enable = s5pv310_clk_hdmiphy_ctrl,
+   .ctrlbit= (1 << 0),
+   }, {
.name   = "hsmmc",
.id = 0,
.parent = &clk_aclk_133.clk,
@@ -805,6 +841,93 @@ static struct clksrc_sources clkset_mout_g2d = {
.nr_sources = ARRAY_SIZE(clkset_mout_g2d_list),
 };
 
+/* --
+ * TV subsystem CLOCKS
+ * --
+ */
+
+static struct clk *clkset_sclk_dac_list[] = {
+   [0] = &clk_sclk_vpll.clk,
+   [1] = &clk_sclk_hdmiphy,
+};
+

[PATCH 6/6] s5pv310: add s5p-tv to Universal C210 board

2011-03-04 Thread Tomasz Stanislawski
Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
---
 arch/arm/mach-s5pv310/Kconfig   |2 +
 arch/arm/mach-s5pv310/mach-universal_c210.c |   54 +++
 2 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s5pv310/Kconfig b/arch/arm/mach-s5pv310/Kconfig
index 4c863850..9acf9c0 100644
--- a/arch/arm/mach-s5pv310/Kconfig
+++ b/arch/arm/mach-s5pv310/Kconfig
@@ -112,10 +112,12 @@ config MACH_UNIVERSAL_C210
select S5PV310_SETUP_SDHCI
select S3C_DEV_I2C1
select S3C_DEV_I2C5
+   select S3C_DEV_I2C8
select S5P_DEV_MFC
select S5PV310_DEV_PD
select S5PV310_DEV_SYSMMU
select S5PV310_SETUP_I2C1
+   select S5PV310_DEV_TV
select S5PV310_SETUP_I2C5
help
  Machine support for Samsung Mobile Universal S5PC210 Reference
diff --git a/arch/arm/mach-s5pv310/mach-universal_c210.c 
b/arch/arm/mach-s5pv310/mach-universal_c210.c
index ce88262..206c539 100644
--- a/arch/arm/mach-s5pv310/mach-universal_c210.c
+++ b/arch/arm/mach-s5pv310/mach-universal_c210.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -812,6 +813,35 @@ static struct i2c_board_info i2c1_devs[] __initdata = {
/* Gyro, To be updated */
 };
 
+static struct regulator_consumer_supply hdmi_supplies[] = {
+   REGULATOR_SUPPLY("hdmi-en", "s5p-hdmi"),
+};
+
+static struct regulator_init_data hdmi_fixed_voltage_init_data = {
+   .constraints= {
+   .name   = "HDMI_5V",
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .num_consumer_supplies  = ARRAY_SIZE(mmc0_supplies),
+   .consumer_supplies  = hdmi_supplies,
+};
+
+static struct fixed_voltage_config hdmi_fixed_voltage_config = {
+   .supply_name= "HDMI_EN1",
+   .microvolts = 500,
+   .gpio   = S5PV310_GPE0(1),
+   .enable_high= true,
+   .init_data  = &hdmi_fixed_voltage_init_data,
+};
+
+static struct platform_device hdmi_fixed_voltage = {
+   .name   = "reg-fixed-voltage",
+   .id = 6,
+   .dev= {
+   .platform_data  = &hdmi_fixed_voltage_config,
+   },
+};
+
 static struct platform_device *universal_devices[] __initdata = {
/* Samsung Platform Devices */
&mmc0_fixed_voltage,
@@ -831,8 +861,14 @@ static struct platform_device *universal_devices[] 
__initdata = {
&s5pv310_device_pd[PD_MFC],
&s5pv310_device_sysmmu[S5P_SYSMMU_MFC_L],
&s5pv310_device_sysmmu[S5P_SYSMMU_MFC_R],
+   &s3c_device_i2c8,
+   &s5p_device_hdmi,
+   &s5p_device_mixer,
+   &s5pv310_device_pd[PD_TV],
+   &s5pv310_device_sysmmu[S5P_SYSMMU_TV],
 
/* Universal Devices */
+   &hdmi_fixed_voltage,
&universal_gpio_keys,
&s3c_device_i2c5,
&s5p_device_onenand,
@@ -845,6 +881,21 @@ static void __init universal_map_io(void)
s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
 }
 
+void s5p_tv_setup(void)
+{
+   /* direct HPD to HDMI chip */
+   gpio_request(S5PV310_GPX3(7), "hpd-plug");
+
+   gpio_direction_input(S5PV310_GPX3(7));
+   s3c_gpio_cfgpin(S5PV310_GPX3(7), S3C_GPIO_SFN(0x3));
+   s3c_gpio_setpull(S5PV310_GPX3(7), S3C_GPIO_PULL_NONE);
+
+   /* setup dependencies between TV devices */
+   s5p_device_hdmi.dev.parent = &s5pv310_device_pd[PD_TV].dev;
+   s5p_device_mixer.dev.parent = &s5pv310_device_pd[PD_TV].dev;
+   s5pv310_device_sysmmu[S5P_SYSMMU_TV].dev.parent = 
&s5pv310_device_pd[PD_TV].dev;
+}
+
 static void __init universal_machine_init(void)
 {
universal_sdhci_init();
@@ -853,6 +904,7 @@ static void __init universal_machine_init(void)
i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
 
s3c_i2c5_set_platdata(NULL);
+   s3c_i2c8_set_platdata(NULL);
i2c_register_board_info(5, i2c_devs5, ARRAY_SIZE(i2c_devs5));
 
/* Last */
@@ -870,6 +922,8 @@ static void __init universal_machine_init(void)
s5p_device_mfc.dev.parent = &s5pv310_device_pd[PD_MFC].dev;
s5pv310_device_sysmmu[S5P_SYSMMU_MFC_L].dev.parent = 
&s5pv310_device_pd[PD_MFC].dev;
s5pv310_device_sysmmu[S5P_SYSMMU_MFC_R].dev.parent = 
&s5pv310_device_pd[PD_MFC].dev;
+
+   s5p_tv_setup();
 }
 
 MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
-- 
1.7.1.569.g6f426
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/6] universal: i2c: add I2C controller 8 (HDMIPHY)

2011-03-04 Thread Tomasz Stanislawski
Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
---
 arch/arm/mach-s5pv310/clock.c |6 +++
 arch/arm/mach-s5pv310/include/mach/irqs.h |4 ++
 arch/arm/mach-s5pv310/include/mach/map.h  |1 +
 arch/arm/plat-samsung/Kconfig |5 ++
 arch/arm/plat-samsung/Makefile|1 +
 arch/arm/plat-samsung/dev-i2c8.c  |   68 +
 arch/arm/plat-samsung/include/plat/devs.h |1 +
 arch/arm/plat-samsung/include/plat/iic.h  |1 +
 8 files changed, 87 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-samsung/dev-i2c8.c

diff --git a/arch/arm/mach-s5pv310/clock.c b/arch/arm/mach-s5pv310/clock.c
index d28fa6f..465beb9 100644
--- a/arch/arm/mach-s5pv310/clock.c
+++ b/arch/arm/mach-s5pv310/clock.c
@@ -685,6 +685,12 @@ static struct clk init_clocks_off[] = {
.parent = &clk_aclk_100.clk,
.enable = s5pv310_clk_ip_peril_ctrl,
.ctrlbit= (1 << 13),
+   }, {
+   .name   = "i2c",
+   .id = 8,
+   .parent = &clk_aclk_100.clk,
+   .enable = s5pv310_clk_ip_peril_ctrl,
+   .ctrlbit= (1 << 14),
},
 };
 
diff --git a/arch/arm/mach-s5pv310/include/mach/irqs.h 
b/arch/arm/mach-s5pv310/include/mach/irqs.h
index f6b99c6..f7ddc98 100644
--- a/arch/arm/mach-s5pv310/include/mach/irqs.h
+++ b/arch/arm/mach-s5pv310/include/mach/irqs.h
@@ -77,6 +77,9 @@
 #define IRQ_PDMA0  COMBINER_IRQ(21, 0)
 #define IRQ_PDMA1  COMBINER_IRQ(21, 1)
 
+#define IRQ_HDMI   COMBINER_IRQ(16, 0)
+#define IRQ_HDMI_I2C   COMBINER_IRQ(16, 1)
+
 #define IRQ_TIMER0_VIC COMBINER_IRQ(22, 0)
 #define IRQ_TIMER1_VIC COMBINER_IRQ(22, 1)
 #define IRQ_TIMER2_VIC COMBINER_IRQ(22, 2)
@@ -100,6 +103,7 @@
 #define IRQ_IIC5   COMBINER_IRQ(27, 5)
 #define IRQ_IIC6   COMBINER_IRQ(27, 6)
 #define IRQ_IIC7   COMBINER_IRQ(27, 7)
+#define IRQ_IIC8   IRQ_HDMI_I2C
 
 #define IRQ_HSMMC0 COMBINER_IRQ(29, 0)
 #define IRQ_HSMMC1 COMBINER_IRQ(29, 1)
diff --git a/arch/arm/mach-s5pv310/include/mach/map.h 
b/arch/arm/mach-s5pv310/include/mach/map.h
index 576ba55..0aa0171 100644
--- a/arch/arm/mach-s5pv310/include/mach/map.h
+++ b/arch/arm/mach-s5pv310/include/mach/map.h
@@ -120,6 +120,7 @@
 #define S3C_PA_IIC5S5PV310_PA_IIC(5)
 #define S3C_PA_IIC6S5PV310_PA_IIC(6)
 #define S3C_PA_IIC7S5PV310_PA_IIC(7)
+#define S3C_PA_IIC8S5PV310_PA_IIC(8)
 #define S3C_PA_RTC S5PV310_PA_RTC
 #define S3C_PA_WDT S5PV310_PA_WATCHDOG
 
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 32be05c..dd1fd15 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -211,6 +211,11 @@ config S3C_DEV_I2C7
help
  Compile in platform device definition for I2C controller 7
 
+config S3C_DEV_I2C8
+   bool
+   help
+ Compile in platform device definitions for I2C channel 8 (HDMIPHY)
+
 config S3C_DEV_FB
bool
help
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 7e92457..826ae4f 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -46,6 +46,7 @@ obj-$(CONFIG_S3C_DEV_I2C4)+= dev-i2c4.o
 obj-$(CONFIG_S3C_DEV_I2C5) += dev-i2c5.o
 obj-$(CONFIG_S3C_DEV_I2C6) += dev-i2c6.o
 obj-$(CONFIG_S3C_DEV_I2C7) += dev-i2c7.o
+obj-$(CONFIG_S3C_DEV_I2C8) += dev-i2c8.o
 obj-$(CONFIG_S3C_DEV_FB)   += dev-fb.o
 obj-y  += dev-uart.o
 obj-$(CONFIG_S3C_DEV_USB_HOST) += dev-usb.o
diff --git a/arch/arm/plat-samsung/dev-i2c8.c b/arch/arm/plat-samsung/dev-i2c8.c
new file mode 100644
index 000..8edba7f
--- /dev/null
+++ b/arch/arm/plat-samsung/dev-i2c8.c
@@ -0,0 +1,68 @@
+/* linux/arch/arm/plat-samsung/dev-i2c7.c
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * S3C series device definition for i2c device 8
+ *
+ * Based on plat-samsung/dev-i2c8.c
+ *
+ * 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 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+static struct resource s3c_i2c_resource[] = {
+   [0] = {
+   .start = S3C_PA_IIC8,
+   .end   = S3C_PA_IIC8 + SZ_4K - 1,
+   .flags = IORESOURCE_MEM,
+   },
+   [1] = {
+   .start = IRQ_IIC8,
+   .end   = IRQ_IIC8,
+   .flags = IORESOURCE_IRQ,
+   },
+};
+
+struct platform_device s3c_device_i2c8 = {
+   .n

[PATCH 1/6] i2c-s3c2410: fix I2C dedicated for hdmiphy

2011-03-04 Thread Tomasz Stanislawski
The I2C HDMIPHY dedicated controller has different timeout
handling and reset conditions.

Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
CC: ben-li...@fluff.org
---
 drivers/i2c/busses/i2c-s3c2410.c |   36 +++-
 1 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 6c00c10..99cfe2f 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -54,6 +54,7 @@ enum s3c24xx_i2c_state {
 enum s3c24xx_i2c_type {
TYPE_S3C2410,
TYPE_S3C2440,
+   TYPE_S3C2440_HDMIPHY,
 };
 
 struct s3c24xx_i2c {
@@ -96,7 +97,21 @@ static inline int s3c24xx_i2c_is2440(struct s3c24xx_i2c *i2c)
enum s3c24xx_i2c_type type;
 
type = platform_get_device_id(pdev)->driver_data;
-   return type == TYPE_S3C2440;
+   return type == TYPE_S3C2440 || type == TYPE_S3C2440_HDMIPHY;
+}
+
+/* s3c24xx_i2c_is2440_hdmiphy()
+ *
+ * return true is this is an s3c2440 dedicated for HDMIPHY interface
+*/
+
+static inline int s3c24xx_i2c_is2440_hdmiphy(struct s3c24xx_i2c *i2c)
+{
+   struct platform_device *pdev = to_platform_device(i2c->dev);
+   enum s3c24xx_i2c_type type;
+
+   type = platform_get_device_id(pdev)->driver_data;
+   return type == TYPE_S3C2440_HDMIPHY;
 }
 
 /* s3c24xx_i2c_master_complete
@@ -461,6 +476,13 @@ static int s3c24xx_i2c_set_master(struct s3c24xx_i2c *i2c)
unsigned long iicstat;
int timeout = 400;
 
+   /* if hang-up of HDMIPHY occured reduce timeout
+* The controller will work after reset, so waiting
+* 400 ms will cause unneccessary system hangup
+*/
+   if (s3c24xx_i2c_is2440_hdmiphy(i2c))
+   timeout = 10;
+
while (timeout-- > 0) {
iicstat = readl(i2c->regs + S3C2410_IICSTAT);
 
@@ -470,6 +492,15 @@ static int s3c24xx_i2c_set_master(struct s3c24xx_i2c *i2c)
msleep(1);
}
 
+   /* hang-up of bus dedicated for HDMIPHY occured, resetting */
+   if (s3c24xx_i2c_is2440_hdmiphy(i2c)) {
+   writel(0, i2c->regs + S3C2410_IICCON);
+   writel(0, i2c->regs + S3C2410_IICSTAT);
+   writel(0, i2c->regs + S3C2410_IICDS);
+
+   return 0;
+   }
+
return -ETIMEDOUT;
 }
 
@@ -1009,6 +1040,9 @@ static struct platform_device_id s3c24xx_driver_ids[] = {
}, {
.name   = "s3c2440-i2c",
.driver_data= TYPE_S3C2440,
+   }, {
+   .name   = "s3c2440-hdmiphy-i2c",
+   .driver_data= TYPE_S3C2440_HDMIPHY,
}, { },
 };
 MODULE_DEVICE_TABLE(platform, s3c24xx_driver_ids);
-- 
1.7.1.569.g6f426
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 0/6] HDMI driver for Samsung S5PV310 platform

2011-03-04 Thread Tomasz Stanislawski
From: Marek Szyprowski 

Hello,

I would like to present the second version of HDMI driver for S5PC210 platform.
The driver is under a heavy development. The most recent changes are:

1. Minor bugs and fixes:
- pink line on left side of display
- premature start of VP's streaming
- usage of free memory
- usage of non-initialized variables
- fixed sequence of power setup
- dependencies in Kconfig

2. Integration with Runtime Power Managment and Power Domain driver.

3. The CMA was substituted by the SYSMMU driver.

4. Applying existing frameworks:
- activation of HDMIPHY using clock API
- control of power on HDMI-5V pin using regulator API

5. Moving all clocks and regulator management from platform to the drivers' 
code.

6. Redesigned the control of mixer's debugging.

7. Added a watchdog to deal with HW failures.

Original HDMI driver RFC:

==
 Introduction
==

The purpose of this RFC is to discuss the driver for a TV output interface
available in upcoming Samsung SoC. The HW is able to generate digital and
analog signals. Current version of the driver supports only digital output.

Internally the driver uses videobuf2 framework, and CMA memory allocator.  Not
all of them are merged by now, but I decided to post the sources to start
discussion driver's design.

==
 Hardware description
==

The SoC contains a few HW sub-blocks:

1. Video Processor (VP). It is used for processing of NV12 data.  An image
stored in RAM is accessed by DMA. Pixels are cropped, scaled. Additionally,
post processing operations like brightness, sharpness and contrast adjustments
could be performed. The output in YCbCr444 format is send to Mixer.

2. Mixer (MXR). The piece of hardware responsible for mixing and blending
multiple data inputs before passing it to an output device.  The MXR is capable
of handling up to three image layers. One is the output of VP.  Other two are
images in RGB format (multiple variants are supported).  The layers are scaled,
cropped and blended with background color.  The blending factor, and layers'
priority are controlled by MXR's registers. The output is passed either to HDMI
or TVOUT.

3. HDMI. The piece of HW responsible for generation of HDMI packets. It takes
pixel data from mixer and transforms it into data frames. The output is send
to HDMIPHY interface.

4. HDMIPHY. Physical interface for HDMI. Its duties are sending HDMI packets to
HDMI connector. Basically, it contains a PLL that produces source clock for
Mixer, VP and HDMI during streaming.

5. TVOUT. Generation of TV analog signal. (driver not implemented)

6. VideoDAC. Modulator for TVOUT signal. (driver not implemented)


The diagram below depicts connection between all HW pieces.
+---+
NV12 data ---dma--->|   Video   |
| Processor |
+---+
  |
  V
+---+
RGB data  ---dma--->|   |
|   Mixer   |
RGB data  ---dma--->|   |
+---+
  |
  * dmux
 /
  +-*   *--+
  ||
  VV
+---++---+
|HDMI   ||   TVOUT   |
+---++---+
  ||
  VV
+---++---+
|  HDMIPHY  ||  VideoDAC |
+---++---+
  ||
  VV
HDMI   Composite
 connector connector


==
 Driver interface
==

The posted driver implements three V4L2 nodes. Every video node implements V4L2
output buffer. One of nodes corresponds to input of Video Processor. The other
two nodes correspond to RGB inputs of Mixer. All nodes share the same output.
It is one of the Mixer's outputs: TVOUT or HDMI. Changing output in one layer
using S_OUTPUT would change outputs of all other video nodes. The same thing
happens if one try to reconfigure output i.e. by calling S_DV_PRESET. However
it not possible to change or reconfigure the output while streaming. To sum up,
all features in posted version of driver goes as follows:

1. QUERYCAP
2. S_FMT, G_FMT - single and multiplanar API
  a) node named video0 supports formats NV12, NV12, NV12T (tiled version of
NV12), NV12MT (multiplane version of NV12T).
  b) nodes named graph0 and graph1 support formats RGB565, ARGB1555, ARGB,
ARGB.
3. Buffer with USERPTR and MMAP memory.
4. Streaming and buffer control. (STREAMON, STREAMOFF, REQBUF, QBUF, DQBUF)
5. OUTPUT enumeration.
6. DV preset control (SET, GET, ENUM). Currently modes 480P59_94, 720P59_94,
1080P30, 1080P59_94 and 1080P60 work

[RFC/PATCH v7 1/5] Changes in include/linux/videodev2.h for MFC 5.1

2011-03-04 Thread Kamil Debski
This patch adds fourcc values for compressed video stream formats and
V4L2_CTRL_CLASS_CODEC. Also adds controls used by MFC 5.1 driver.

Signed-off-by: Kamil Debski 
Signed-off-by: Kyungmin Park 
---
 include/linux/videodev2.h |   39 +++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index a94c4d5..a48a42e 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -369,6 +369,19 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_DV   v4l2_fourcc('d', 'v', 's', 'd') /* 1394  
*/
 #define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4
*/
 
+#define V4L2_PIX_FMT_H264 v4l2_fourcc('H', '2', '6', '4') /* H264*/
+#define V4L2_PIX_FMT_H263 v4l2_fourcc('H', '2', '6', '3') /* H263*/
+#define V4L2_PIX_FMT_MPEG12   v4l2_fourcc('M', 'P', '1', '2') /* MPEG-1/2  */
+#define V4L2_PIX_FMT_MPEG4v4l2_fourcc('M', 'P', 'G', '4') /* MPEG-4  */
+#define V4L2_PIX_FMT_DIVX v4l2_fourcc('D', 'I', 'V', 'X') /* DivX  */
+#define V4L2_PIX_FMT_DIVX3v4l2_fourcc('D', 'I', 'V', '3') /* DivX 3.11  */
+#define V4L2_PIX_FMT_DIVX4v4l2_fourcc('D', 'I', 'V', '4') /* DivX 4.12  */
+#define V4L2_PIX_FMT_DIVX500v4l2_fourcc('D', 'X', '5', '2') /* DivX 5.00 - 
5.02  */
+#define V4L2_PIX_FMT_DIVX503v4l2_fourcc('D', 'X', '5', '3') /* DivX 5.03 - 
x  */
+#define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D') /* Xvid */
+#define V4L2_PIX_FMT_VC1  v4l2_fourcc('V', 'C', '1', 'A') /* VC-1 */
+#define V4L2_PIX_FMT_VC1_RCV  v4l2_fourcc('V', 'C', '1', 'R') /* VC-1 RCV 
*/
+
 /*  Vendor-specific formats   */
 #define V4L2_PIX_FMT_CPIA1v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
 #define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw 
compress */
@@ -1016,6 +1029,7 @@ struct v4l2_ext_controls {
 #define V4L2_CTRL_CLASS_MPEG 0x0099/* MPEG-compression controls */
 #define V4L2_CTRL_CLASS_CAMERA 0x009a  /* Camera class controls */
 #define V4L2_CTRL_CLASS_FM_TX 0x009b   /* FM Modulator control class */
+#define V4L2_CTRL_CLASS_CODEC 0x009c   /* Codec control class */
 
 #define V4L2_CTRL_ID_MASK(0x0fff)
 #define V4L2_CTRL_ID2CLASS(id)((id) & 0x0fffUL)
@@ -1349,6 +1363,31 @@ enum v4l2_mpeg_cx2341x_video_median_filter_type {
 #define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP   
(V4L2_CID_MPEG_CX2341X_BASE+10)
 #define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS
(V4L2_CID_MPEG_CX2341X_BASE+11)
 
+/* For codecs */
+
+#define V4L2_CID_CODEC_BASE(V4L2_CTRL_CLASS_CODEC | 0x900)
+#define V4L2_CID_CODEC_CLASS   (V4L2_CTRL_CLASS_CODEC | 1)
+
+/* For both decoding and encoding */
+
+/* For encoding */
+#define V4L2_CID_CODEC_LOOP_FILTER_H264(V4L2_CID_CODEC_BASE + 
1)
+enum v4l2_cid_codec_loop_filter_h264 {
+   V4L2_CID_CODEC_LOOP_FILTER_H264_ENABLE = 0,
+   V4L2_CID_CODEC_LOOP_FILTER_H264_DISABLE = 1,
+   V4L2_CID_CODEC_LOOP_FILTER_H264_DISABLE_AT_BOUNDARY = 2,
+};
+
+/* For decoding */
+
+#define V4L2_CID_CODEC_LOOP_FILTER_MPEG4_ENABLE(V4L2_CID_CODEC_BASE + 
2)
+#define V4L2_CID_CODEC_DISPLAY_DELAY   (V4L2_CID_CODEC_BASE + 3)
+#define V4L2_CID_CODEC_DISPLAY_DELAY_ENABLE(V4L2_CID_CODEC_BASE + 4)
+#define V4L2_CID_CODEC_MIN_REQ_BUFS_OUT(V4L2_CID_CODEC_BASE + 
5)
+#define V4L2_CID_CODEC_MIN_REQ_BUFS_CAP(V4L2_CID_CODEC_BASE + 
6)
+#define V4L2_CID_CODEC_SLICE_INTERFACE (V4L2_CID_CODEC_BASE + 7)
+#define V4L2_CID_CODEC_PACKED_PB   (V4L2_CID_CODEC_BASE + 8)
+
 /*  Camera class control IDs */
 #define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900)
 #define V4L2_CID_CAMERA_CLASS  (V4L2_CTRL_CLASS_CAMERA | 1)
-- 
1.6.3.3
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH/RFC v7 5/5] v4l: Documentation for the codec interface

2011-03-04 Thread Kamil Debski
This patch adds documentation for the codec interface of V4L2.

Signed-off-by: Kamil Debski 
Signed-off-by: Kyungmin Park 
---
 Documentation/DocBook/v4l/dev-codec.xml |  169 ---
 1 files changed, 155 insertions(+), 14 deletions(-)

diff --git a/Documentation/DocBook/v4l/dev-codec.xml 
b/Documentation/DocBook/v4l/dev-codec.xml
index 6e156dc..73ecee8 100644
--- a/Documentation/DocBook/v4l/dev-codec.xml
+++ b/Documentation/DocBook/v4l/dev-codec.xml
@@ -1,21 +1,162 @@
-  Codec Interface
+   Codec Interface
 
-  
-Suspended
+   
+A V4L2 codec can compress, decompress, transform, or otherwise convert
+video data from one format into another format, in memory. Applications
+can send and receive the data in two ways. First method utilizes
+&func-write; and &func-read; calls to exchange the data. The second
+uses streaming I/O to interact with the driver.
+   
 
-This interface has been be suspended from the V4L2 API
-implemented in Linux 2.6 until we have more experience with codec
-device interfaces.
-  
+   
+Codec devices belong to the group of memory-to-memory devices – memory
+buffer containing a frame in one format is converted and stored in another
+buffer in the memory. The format of capture and output buffers is
+determined by the pixel formats passed in the &VIDIOC-S-FMT; call.
+   
 
-  A V4L2 codec can compress, decompress, transform, or otherwise
-convert video data from one format into another format, in memory.
-Applications send data to be converted to the driver through a
-&func-write; call, and receive the converted data through a
-&func-read; call. For efficiency a driver may also support streaming
-I/O.
+   
+Many advanced video codecs – such as H264 and MPEG4 require that decoded 
buffers
+are kept as reference for other frames. This requirement may result in a use
+case where a few output buffers have to be processed before the first capture
+buffer is returned. In addition the buffers may be dequeued in an arbitrary
+order.
+   
 
-  [to do]
+   
+The codec hardware may enable to tweak decoding parameters and will require the
+application to set encoding parameters. Hence the 
+V4L2_CTRL_CLASS_CODEC control class has been introduced.
+   
+
+   
+The standard V4L2 naming of buffers is kept – output means input of the device,
+capture on the other hand means the device’s output.
+   
+
+
+   Querying Capabilities
+
+   
+Devices that support the codec interface set the
+V4L2_CAP_VIDEO_M2M flag of the capabilities field of the
+v4l2_capability struct returned by the &VIDIOC-QUERYCAP; ioctl. At least one of
+the read/write or streaming I/O methods must be supported.
+   
+
+
+
+   Multiple Instance Capabilities
+
+   
+Codecs as memory to memory devices can support multiple instances.
+Drivers for devices with such capabilities should store configuration context
+for every open file descriptor. This means that configuration is kept only 
until
+the descriptor is closed and it is not possible to configure the device with 
one
+application and perform streaming with another. If the device is capable of
+handling only one stream at a time it can use a single context.
+   
+
+
+
+   Image Format Negotiation
+
+   
+In case of decoding a video stream, the header may need to be parsed before the
+stream decoding can take place. Usually only after the header is processed the
+dimensions of the decoded image and the minimum number of buffers is known. 
This
+requires that the output part of the interface has to be able to process the
+header before allocating the buffers for capture. &VIDIOC-G-FMT; can be used by
+the application to get the parameters of the capture buffers. If necessary the
+&VIDIOC-S-FMT; call can be used to change those parameters, but it is up to the
+driver to validate and correct those values. In addition it is necessary to
+negotiate the number of capture buffers. In many cases the application may need
+to allocate N more buffers than the minimum required by the codec. It can be
+useful in case the device has a minimum number of buffers that have to be 
queued
+in hardware to operate and if the application needs to keep N buffers dequeued
+for processing. This cannot be easily done with &VIDIOC-REQBUFS; alone. To
+address this issue the V4L2_CID_CODEC_MIN_REQ_ BUFS_CAP control has been
+introduced and can be read to determine the minimum buffer count for the
+capture queue. The application can use this number to calculate the number of
+buffers passed to the REQBUFS call. The V4L2_CID_CODEC_MIN_REQ_ BUFS_OUT
+control can also be used if the minimum number of buffers is determined for the
+output queue, for example in case of encoding.
+   
+
+   
+When encoding &VIDIOC-S-FMT; has to be done on both capture and output.
+&VIDIOC-S-FMT; on capture will determine the video codec to be used and 
encoding
+parameters should be configured by setting appropriate contr

[RFC/PATCH v7 4/5] s5pv310: Enable MFC on universal_c210 board

2011-03-04 Thread Kamil Debski
This patch enables MFC 5.1 on the universal_c210 board. Multi Format
Codec 5.1 is capable of handling a range of video codecs.

Signed-off-by: Kamil Debski 
Signed-off-by: Kyungmin Park 
---
 arch/arm/mach-s5pv310/Kconfig   |1 +
 arch/arm/mach-s5pv310/mach-universal_c210.c |8 
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s5pv310/Kconfig b/arch/arm/mach-s5pv310/Kconfig
index c850086..6f83817 100644
--- a/arch/arm/mach-s5pv310/Kconfig
+++ b/arch/arm/mach-s5pv310/Kconfig
@@ -107,6 +107,7 @@ config MACH_UNIVERSAL_C210
select S5PV310_SETUP_SDHCI
select S3C_DEV_I2C1
select S3C_DEV_I2C5
+   select S5P_DEV_MFC
select S5PV310_DEV_PD
select S5PV310_DEV_SYSMMU
select S5PV310_SETUP_I2C1
diff --git a/arch/arm/mach-s5pv310/mach-universal_c210.c 
b/arch/arm/mach-s5pv310/mach-universal_c210.c
index f153895..ce88262 100644
--- a/arch/arm/mach-s5pv310/mach-universal_c210.c
+++ b/arch/arm/mach-s5pv310/mach-universal_c210.c
@@ -827,6 +827,10 @@ static struct platform_device *universal_devices[] 
__initdata = {
&s5pv310_device_sysmmu[S5P_SYSMMU_FIMC1],
&s5pv310_device_sysmmu[S5P_SYSMMU_FIMC2],
&s5pv310_device_sysmmu[S5P_SYSMMU_FIMC3],
+   &s5p_device_mfc,
+   &s5pv310_device_pd[PD_MFC],
+   &s5pv310_device_sysmmu[S5P_SYSMMU_MFC_L],
+   &s5pv310_device_sysmmu[S5P_SYSMMU_MFC_R],
 
/* Universal Devices */
&universal_gpio_keys,
@@ -862,6 +866,10 @@ static void __init universal_machine_init(void)
s5pv310_device_sysmmu[S5P_SYSMMU_FIMC1].dev.parent = 
&s5pv310_device_pd[PD_CAM].dev;
s5pv310_device_sysmmu[S5P_SYSMMU_FIMC2].dev.parent = 
&s5pv310_device_pd[PD_CAM].dev;
s5pv310_device_sysmmu[S5P_SYSMMU_FIMC3].dev.parent = 
&s5pv310_device_pd[PD_CAM].dev;
+   
+   s5p_device_mfc.dev.parent = &s5pv310_device_pd[PD_MFC].dev;
+   s5pv310_device_sysmmu[S5P_SYSMMU_MFC_L].dev.parent = 
&s5pv310_device_pd[PD_MFC].dev;
+   s5pv310_device_sysmmu[S5P_SYSMMU_MFC_R].dev.parent = 
&s5pv310_device_pd[PD_MFC].dev;
 }
 
 MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
-- 
1.6.3.3
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC/PATCH v7 2/5] MFC: Add MFC 5.1 driver to plat-s5p

2011-03-04 Thread Kamil Debski
This patch adds platform support for Multi Format Codec 5.1.
MFC 5.1 is capable of handling a range of video codecs and this driver
provides V4L2 interface for video decoding.

Signed-off-by: Kamil Debski 
Signed-off-by: Kyungmin Park 
---
 arch/arm/mach-s5pv310/clock.c   |   28 -
 arch/arm/mach-s5pv310/include/mach/map.h|2 +
 arch/arm/mach-s5pv310/include/mach/regs-clock.h |3 +
 arch/arm/plat-s5p/Kconfig   |5 ++
 arch/arm/plat-s5p/Makefile  |2 +-
 arch/arm/plat-s5p/dev-mfc.c |   49 +++
 arch/arm/plat-samsung/include/plat/devs.h   |1 +
 7 files changed, 88 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/plat-s5p/dev-mfc.c

diff --git a/arch/arm/mach-s5pv310/clock.c b/arch/arm/mach-s5pv310/clock.c
index f142b8c..d28fa6f 100644
--- a/arch/arm/mach-s5pv310/clock.c
+++ b/arch/arm/mach-s5pv310/clock.c
@@ -523,6 +523,11 @@ static struct clk init_clocks_off[] = {
.enable = s5pv310_clk_ip_lcd1_ctrl,
.ctrlbit= (1 << 0),
}, {
+   .name   = "mfc",
+   .id = -1,
+   .enable = s5pv310_clk_ip_mfc_ctrl,
+   .ctrlbit= (1 << 0),
+   }, {
.name   = "hsmmc",
.id = 0,
.parent = &clk_aclk_133.clk,
@@ -734,6 +739,18 @@ static struct clksrc_sources clkset_group = {
.nr_sources = ARRAY_SIZE(clkset_group_list),
 };
 
+static struct clk *clkset_group1_list[] = {
+   [0] = &clk_mout_mpll.clk,
+   [1] = &clk_sclk_apll.clk,
+   [2] = &clk_mout_epll.clk,
+   [3] = &clk_sclk_vpll.clk,
+};
+
+static struct clksrc_sources clkset_group1 = {
+   .sources= clkset_group1_list,
+   .nr_sources = ARRAY_SIZE(clkset_group1_list),
+};
+
 static struct clk *clkset_mout_g2d0_list[] = {
[0] = &clk_mout_mpll.clk,
[1] = &clk_sclk_apll.clk,
@@ -1076,7 +1093,16 @@ static struct clksrc_clk clksrcs[] = {
.ctrlbit= (1 << 16),
},
.reg_div = { .reg = S5P_CLKDIV_FSYS3, .shift = 8, .size = 8 },
-   }
+   }, {
+   .clk= {
+   .name   = "sclk_mfc",
+   .id = -1,
+   },
+   .sources = &clkset_group1,
+   .reg_src = { .reg = S5P_CLKSRC_MFC, .shift = 8, .size = 1 },
+   .reg_div = { .reg = S5P_CLKDIV_MFC, .shift = 0, .size = 4 },
+   },
+
 };
 
 /* Clock initialization code */
diff --git a/arch/arm/mach-s5pv310/include/mach/map.h 
b/arch/arm/mach-s5pv310/include/mach/map.h
index 0db3a47..576ba55 100644
--- a/arch/arm/mach-s5pv310/include/mach/map.h
+++ b/arch/arm/mach-s5pv310/include/mach/map.h
@@ -29,6 +29,7 @@
 #define S5PV310_PA_FIMC1   0x1181
 #define S5PV310_PA_FIMC2   0x1182
 #define S5PV310_PA_FIMC3   0x1183
+#define S5PV310_PA_MFC 0x1340
 #define S5PV310_PA_I2S00x0383
 #define S5PV310_PA_I2S10xE310
 #define S5PV310_PA_I2S20xE2A0
@@ -129,6 +130,7 @@
 #define S5P_PA_FIMC1   S5PV310_PA_FIMC1
 #define S5P_PA_FIMC2   S5PV310_PA_FIMC2
 #define S5P_PA_FIMC3   S5PV310_PA_FIMC3
+#define S5P_PA_MFC S5PV310_PA_MFC
 #define S5P_PA_ONENAND S5PC210_PA_ONENAND
 #define S5P_PA_ONENAND_DMA S5PC210_PA_ONENAND_DMA
 #define S5P_PA_SDRAM   S5PV310_PA_SDRAM
diff --git a/arch/arm/mach-s5pv310/include/mach/regs-clock.h 
b/arch/arm/mach-s5pv310/include/mach/regs-clock.h
index 9ef5f0c..f6b8181 100644
--- a/arch/arm/mach-s5pv310/include/mach/regs-clock.h
+++ b/arch/arm/mach-s5pv310/include/mach/regs-clock.h
@@ -176,4 +176,7 @@
 
 #define S5P_EPLL_CON   S5P_EPLL_CON0
 
+/* MFC related */
+#define S5P_CLKSRC_MFC S5P_CLKREG(0x0C228)
+#define S5P_CLKDIV_MFC S5P_CLKREG(0x0C528)
 #endif /* __ASM_ARCH_REGS_CLOCK_H */
diff --git a/arch/arm/plat-s5p/Kconfig b/arch/arm/plat-s5p/Kconfig
index 4166964..ea9032e 100644
--- a/arch/arm/plat-s5p/Kconfig
+++ b/arch/arm/plat-s5p/Kconfig
@@ -5,6 +5,11 @@
 #
 # Licensed under GPLv2
 
+config S5P_DEV_MFC
+   bool
+   help
+ Compile in platform device definitions for MFC 
+ 
 config PLAT_S5P
bool
depends on (ARCH_S5P64X0 || ARCH_S5P6442 || ARCH_S5PC100 || 
ARCH_S5PV210 || ARCH_S5PV310)
diff --git a/arch/arm/plat-s5p/Makefile b/arch/arm/plat-s5p/Makefile
index cfcd1db..54e330d 100644
--- a/arch/arm/plat-s5p/Makefile
+++ b/arch/arm/plat-s5p/Makefile
@@ -24,7 +24,7 @@ obj-$(CONFIG_SUSPEND) += pm.o
 obj-$(CONFIG_SUSPEND)  += irq-pm.o
 
 # devices
-
+obj-$(CONFIG_S5P_DEV

[RFC/PATCH v7 0/5] Multi Format Codec 5.1 driver for s5pv310 SoC

2011-03-04 Thread Kamil Debski
Hi,

This is the seventh version of the MFC 5.1 driver. It is still a work in 
progress.
This version currently supports decoding only, but encoding is heavily 
developed.
For nearly two months new features were added and fixes and suggestions were
implemented.

The main purpose for posting this patch is to show an example driver that
uses the new IOMMU vb2 allocator. In addition this is the first try to
create a V4L2 codec driver that I know of. I hope to discuss issues related
to this type of hardware on the upcoming brainstorming session in Warsaw.

Major new features include:
- proper handling for stream seeking (stream off + stream on and resume from
  another point of the stream).
- support for resolution change in the stream
- power domain handling
- clock gating
- support for IOMMU allocator
- setting buffer flags according to decoded frame type:
  V4L2_BUF_FLAG_(KEY|P|B)FRAME
- proper display delay handling for H264

Things that still need to be done:
- move to the control framework
- rebase onto Exynos4 platform name change

* Stream seeking scenario is as follows:

1. Stream off on OUTPUT
2. Stream off on CAPTURE
3. Queue at least one new src buffer on OUTPUT (after stream off they all have
   been dequeued and at least one buffer has to be queued to successfully do a
   stream on)
4. Queue dst buffers on CAPTURE (after stream off they all have been dequeued)
5. Stream on on CAPTURE queue
6. Stream on on OUTPUT queue

* Resolution change scenario:

1. Stream off on CAPTURE
2. Unmap the destination buffers
Note: To successfully unmap the buffer they cannot be used
by any other hardware, such as FIMC. Thus it necessary to
shutdown FIMC - either close, or streamoff and reqbufs(0).
3. Call Reqbufs (0) on CAPTURE
4. Same as after parsing header
a) Run G_FMT on CAPTURE
b) Run G_CROP on CAPTURE
c) Get the minimum number of buffers (by reading the
   V4L2_CID_CODEC_REQ_NUM_BUFS control)
5. Init CAPTURE stream
a) Run Reqbufs with appropriate number of buffers (minimum + extra)
b) Run Querybuf and Mmap on each buffer
c) Run Q_BUF on the new buffers
6. Stream on on CAPTURE
7. Initialize FIMC

Note: application is notified about resolution change in the same way as the
notification that all decoded buffers have been read. The value of bytesused
in the capture buffer is set to 0. If the application has sent last encoded
stream frame then it is waiting for last decoded frame. If the application
receives a frame with bytesused set to 0 with no error set in the middle of a
stream then it should treat is as the notification of resolution change.

Best regards,
Kamil

* Changelog:

==
 Changes since v6
==

1) Stream seeking handling
   - done by running stream off and then stream on from another point of the
 stream
2) Support for streams during which the resolution is changed
   - done by calling stream off, reallocating the buffers and stream on again to
 resume
3) Power domain handling
4) Clock gating hw related operations
   - This has introduced a large reduction in power use
5) Support for IOMMU allocator
   - Using IOMMU as the memory allocator removes the cache problem
 and the need for reserving continuous memory at system boot
6) Flags of v4l2_buffer are set accrodingly to the returned buffer frame type
   V4L2_BUF_FLAG_(KEY|P|B)FRAME
7) Fixed display delay handling of H264. Now dealy of 0 frames is possible,
   although it may cause that the frames are returned out of order.
8) Minor changes
   - global s5p_mfc_dev variable has been removed
   - improved Packed PB handling
   - fixed error handling - separate for decoding and display frames
   - some cosmetic changes to simplify the code and make it more readable

==
 Changes since v5
==

1) Changes suggested by Hans Verkuil:
- small change in videodev2.h - corrected control offsets
- made the code more readable by simplifying if statements and using temporary
  pointers
- mfc_mutex is now included in s5p_mfc_dev structure
- after discussion with Peter Oh modification of fourcc defintions
 (replaced DX52 and DX53 with DX50)

2) Changes suggested by JongHun Han:
- comsmetic changed of defines in regs-mfc5.h
- in buffers that have no width adn height, such as the buffer for compressed
  stream, those values are set to 0 instead of 1
- remove redundant pointer to MFC registers
- change name of the union in s5p_mfc_buf from paddr to cookie
- removed global variable (struct s5p_mfc_dev *dev) and moved to use 
video_drvdata

3) Other changes:
- added check for values returned after parsing header - in rare circumstances 
MFC
  hw returned 0x0 as image size and this could cause problems

==
 Changes since v4
==

1) Changes suggested by Kukjin Kim from:
- removed comment arch/arm/mach-s5pv210/include/mach/map.h
- changed device name to s5p-mfc (removed "5", MFC version number

[GIT PULL FOR 2.6.39] s5p-fimc driver and videobuf2 fixes

2011-03-04 Thread Sylwester Nawrocki
Hi Mauro,

please pull the following change set, it's a couple of s5p-fimc driver
fixes and updates after conversion to videobuf2. There are also two small
corrections for the videobuf2 and documentation for NV12MT format.


The following changes since commit 548b491f5a3221e26c0b08dece18fdc62930fe5e:

  [media] media/radio/wl1273: fix build errors (2011-02-27 21:36:52 -0300)

are available in the git repository at:
  git://git.infradead.org/users/kmpark/linux-2.6-samsung s5p_fimc_for_mauro

Andrzej Pietrasiewicz (1):
  v4l2: vb2-dma-sg: fix memory leak

Kamil Debski (1):
  v4l: Documentation for the NV12MT format

Marek Szyprowski (1):
  v4l2: vb2: fix queue reallocation and REQBUFS(0) case

Sungchun Kang (1):
  s5p-fimc: fix ISR and buffer handling for fimc-capture

Sylwester Nawrocki (6):
  s5p-fimc: Prevent oops when i2c adapter is not available
  s5p-fimc: Prevent hanging on device close and fix the locking
  s5p-fimc: Allow defining number of sensors at runtime
  s5p-fimc: Add a platform data entry for MIPI-CSI data alignment
  s5p-fimc: Use dynamic debug
  s5p-fimc: Fix G_FMT ioctl handler

 Documentation/DocBook/media-entities.tmpl|1 +
 Documentation/DocBook/v4l/nv12mt.gif |  Bin 0 -> 2108 bytes
 Documentation/DocBook/v4l/nv12mt_example.gif |  Bin 0 -> 6858 bytes
 Documentation/DocBook/v4l/pixfmt-nv12mt.xml  |   74 +++
 Documentation/DocBook/v4l/pixfmt.xml |1 +
 drivers/media/video/s5p-fimc/fimc-capture.c  |   99 --
 drivers/media/video/s5p-fimc/fimc-core.c |  266 ++
 drivers/media/video/s5p-fimc/fimc-core.h |   50 --
 drivers/media/video/s5p-fimc/fimc-reg.c  |6 +-
 drivers/media/video/videobuf2-core.c |9 +-
 drivers/media/video/videobuf2-dma-sg.c   |2 +
 include/media/s5p_fimc.h |9 +-
 12 files changed, 307 insertions(+), 210 deletions(-)
 create mode 100644 Documentation/DocBook/v4l/nv12mt.gif
 create mode 100644 Documentation/DocBook/v4l/nv12mt_example.gif
 create mode 100644 Documentation/DocBook/v4l/pixfmt-nv12mt.xml

Regards,
Sylwester

-- 
Sylwester Nawrocki
Samsung Poland R&D Center
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/7] ARM: Samsung: update/rewrite Samsung SYSMMU (IOMMU) driver

2011-03-04 Thread Marek Szyprowski
From: Andrzej Pietrasiewicz 

This patch performs a complete rewrite of sysmmu driver for Samsung platform:
- the new version introduces an api to construct device private page
  tables and enables to use device private address space mode
- simplified the resource management: no more single platform
  device with 32 resources is needed, better fits into linux driver model,
  each sysmmu instance has it's own resource definition
- added support for sysmmu clocks
- some other minor API chages required by upcoming videobuf2 allocator

Signed-off-by: Andrzej Pietrasiewicz 
Signed-off-by: Kyungmin Park 
Signed-off-by: Marek Szyprowski 
---
 arch/arm/mach-s5pv310/clock.c|   91 ++
 arch/arm/mach-s5pv310/dev-sysmmu.c   |  582 +
 arch/arm/mach-s5pv310/include/mach/irqs.h|   36 +-
 arch/arm/mach-s5pv310/include/mach/regs-clock.h  |3 +
 arch/arm/mach-s5pv310/include/mach/regs-sysmmu.h |   23 +-
 arch/arm/mach-s5pv310/include/mach/sysmmu.h  |  122 ---
 arch/arm/plat-s5p/Kconfig|   17 +-
 arch/arm/plat-s5p/include/plat/sysmmu.h  |  127 +++
 arch/arm/plat-s5p/sysmmu.c   |  988 +++---
 arch/arm/plat-samsung/include/plat/devs.h|2 +-
 10 files changed, 1323 insertions(+), 668 deletions(-)
 rewrite arch/arm/mach-s5pv310/dev-sysmmu.c (86%)
 delete mode 100644 arch/arm/mach-s5pv310/include/mach/sysmmu.h
 create mode 100644 arch/arm/plat-s5p/include/plat/sysmmu.h
 rewrite arch/arm/plat-s5p/sysmmu.c (85%)

diff --git a/arch/arm/mach-s5pv310/clock.c b/arch/arm/mach-s5pv310/clock.c
index fc7c2f8..f142b8c 100644
--- a/arch/arm/mach-s5pv310/clock.c
+++ b/arch/arm/mach-s5pv310/clock.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -116,6 +117,21 @@ static int s5pv310_clk_ip_perir_ctrl(struct clk *clk, int 
enable)
return s5p_gatectrl(S5P_CLKGATE_IP_PERIR, clk, enable);
 }
 
+static int s5pv310_clk_ip_dmc_ctrl(struct clk *clk, int enable)
+{
+   return s5p_gatectrl(S5P_CLKGATE_IP_DMC, clk, enable);
+}
+
+static int s5pv310_clk_ip_mfc_ctrl(struct clk *clk, int enable)
+{
+   return s5p_gatectrl(S5P_CLKGATE_IP_MFC, clk, enable);
+}
+
+static int s5pv310_clk_ip_tv_ctrl(struct clk *clk, int enable)
+{
+   return s5p_gatectrl(S5P_CLKGATE_IP_TV, clk, enable);
+}
+
 /* Core list of CMU_CPU side */
 
 static struct clksrc_clk clk_mout_apll = {
@@ -422,6 +438,81 @@ static struct clk init_clocks_off[] = {
.enable = s5pv310_clk_ip_cam_ctrl,
.ctrlbit= (1 << 3),
}, {
+   .name   = "sysmmu",
+   .id = S5P_SYSMMU_MFC_L,
+   .enable = s5pv310_clk_ip_mfc_ctrl,
+   .ctrlbit= ((15 << 1) | 1),
+   }, {
+   .name   = "sysmmu",
+   .id = S5P_SYSMMU_MFC_R,
+   .enable = s5pv310_clk_ip_mfc_ctrl,
+   .ctrlbit= ((15 << 1) | 1),
+   }, {
+   .name   = "sysmmu",
+   .id = S5P_SYSMMU_FIMC0,
+   .enable = s5pv310_clk_ip_cam_ctrl,
+   .ctrlbit= (1 << 7),
+   }, {
+   .name   = "sysmmu",
+   .id = S5P_SYSMMU_FIMC1,
+   .enable = s5pv310_clk_ip_cam_ctrl,
+   .ctrlbit= (1 << 8),
+   } , {
+   .name   = "sysmmu",
+   .id = S5P_SYSMMU_FIMC2,
+   .enable = s5pv310_clk_ip_cam_ctrl,
+   .ctrlbit= (1 << 9),
+   } , {
+   .name   = "sysmmu",
+   .id = S5P_SYSMMU_FIMC3,
+   .enable = s5pv310_clk_ip_cam_ctrl,
+   .ctrlbit= (1 << 10),
+   } , {
+   .name   = "sysmmu",
+   .id = S5P_SYSMMU_JPEG,
+   .enable = s5pv310_clk_ip_cam_ctrl,
+   .ctrlbit= (1 << 11),
+   } , {
+   .name   = "sysmmu",
+   .id = S5P_SYSMMU_TV,
+   .enable = s5pv310_clk_ip_tv_ctrl,
+   .ctrlbit= (1 << 4),
+   } , {
+   .name   = "sysmmu",
+   .id = S5P_SYSMMU_G2D,
+   .enable = s5pv310_clk_ip_image_ctrl,
+   .ctrlbit= (1 << 3),
+   } , {
+   .name   = "sysmmu",
+   .id = S5P_SYSMMU_ROTATOR,
+   .enable = s5pv310_clk_ip_image_ctrl,
+   .ctrlbit= (1 << 4),
+   } , {
+   .name   = "sysmmu",
+   .id = S5P_SYSMMU_MDMA,
+   .enable = s5pv310_clk_ip_image_ctrl,
+   .ctrlbit= (1 << 5),
+   } , {
+   

[PATCH 4/7] v4l: videobuf2: add Samsung SYSMMU (IOMMU) based allocator

2011-03-04 Thread Marek Szyprowski
From: Andrzej Pietrasiewicz 

This patch adds new videobuf2 memory allocator dedicated to Samsung SoC
series with IOMMU module. It requires s5p-sysmmu low level driver for
controlling iommu. This allocator aquires memory with standard
alloc_page() call and doesn't suffer from memory fragmentation issues.
Curretnly it supports only iommu module on Sasmung S5PV310 SoC series.

Signed-off-by: Andrzej Pietrasiewicz 
Signed-off-by: Kyungmin Park 
Signed-off-by: Marek Szyprowski 
---
 drivers/media/video/Kconfig   |8 +-
 drivers/media/video/Makefile  |1 +
 drivers/media/video/videobuf2-s5p-iommu.c |  444 +
 include/media/videobuf2-s5p-iommu.h   |   50 
 4 files changed, 502 insertions(+), 1 deletions(-)
 create mode 100644 drivers/media/video/videobuf2-s5p-iommu.c
 create mode 100644 include/media/videobuf2-s5p-iommu.h

diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index e2f5a69..9806505 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -60,12 +60,18 @@ config VIDEOBUF2_VMALLOC
select VIDEOBUF2_MEMOPS
tristate
 
-
 config VIDEOBUF2_DMA_SG
#depends on HAS_DMA
select VIDEOBUF2_CORE
select VIDEOBUF2_MEMOPS
tristate
+
+config VIDEOBUF2_S5P_IOMMU
+   select GENERIC_ALLOCATOR
+   select VIDEOBUF2_CORE
+   select VIDEOBUF2_MEMOPS
+   tristate
+
 #
 # Multimedia Video device configuration
 #
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index ac54652..fd9488d 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -118,6 +118,7 @@ obj-$(CONFIG_VIDEOBUF2_MEMOPS)  += 
videobuf2-memops.o
 obj-$(CONFIG_VIDEOBUF2_VMALLOC)+= videobuf2-vmalloc.o
 obj-$(CONFIG_VIDEOBUF2_DMA_CONTIG) += videobuf2-dma-contig.o
 obj-$(CONFIG_VIDEOBUF2_DMA_SG) += videobuf2-dma-sg.o
+obj-$(CONFIG_VIDEOBUF2_S5P_IOMMU)  += videobuf2-s5p-iommu.o
 
 obj-$(CONFIG_V4L2_MEM2MEM_DEV) += v4l2-mem2mem.o
 
diff --git a/drivers/media/video/videobuf2-s5p-iommu.c 
b/drivers/media/video/videobuf2-s5p-iommu.c
new file mode 100644
index 000..5826fe0
--- /dev/null
+++ b/drivers/media/video/videobuf2-s5p-iommu.c
@@ -0,0 +1,444 @@
+/*
+ * videobuf2-s5p-iommu.c - SYSMMU (IOMMU) based memory allocator for videobuf2
+ *
+ * Copyright (C) 2011 Samsung Electronics
+ *
+ * Author: Andrzej Pietrasiewicz 
+ *
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+/*
+ * 17: single piece of memory (one bitmap entry) equals 128k,
+ * so by default the genalloc's bitmap occupies 4kB (one page
+ * for a number of architectures)
+ */
+#define VB2_S5P_IOMMU_PIECE_ORDER  17
+
+/* -1: use default node id to allocate gen_pool/gen_pool_chunk structure from 
*/
+#define VB2_S5P_IOMMU_NODE_ID  -1
+
+/*
+ * starting address of the virtual address space of the client device
+ * must not be zero
+ */
+#define VB2_S5P_IOMMU_MEM_BASE 0x3000
+
+/* size of the virtual address space of the client device */
+#define VB2_S5P_IOMMU_MEM_SIZE 0x4000
+
+struct vb2_s5p_iommu_alloc_ctx {
+   /* not interpreted here; only passed to the sysmmu driver */
+   void *sysmmu;
+
+   struct gen_pool *pool;
+};
+
+struct vb2_s5p_iommu_desc {
+   unsigned long   size;
+   unsigned intnum_pages;
+   struct page **pages;
+};
+
+struct vb2_s5p_iommu_buf {
+   unsigned long   drv_addr;
+   unsigned long   vaddr;
+
+   struct vb2_s5p_iommu_desc   info;
+   int offset;
+   atomic_trefcount;
+   int write;
+   struct vm_area_struct   *vma;
+
+   struct vb2_vmarea_handler   handler;
+
+   struct vb2_s5p_iommu_alloc_ctx  *ctx;
+};
+
+static void vb2_s5p_iommu_put(void *buf_priv);
+
+static void *vb2_s5p_iommu_alloc(void *alloc_ctx, unsigned long size)
+{
+   struct vb2_s5p_iommu_alloc_ctx *ctx = alloc_ctx;
+   struct vb2_s5p_iommu_buf *buf;
+   int i, ret;
+
+   BUG_ON(NULL == alloc_ctx);
+
+   buf = kzalloc(sizeof *buf, GFP_KERNEL);
+   if (!buf)
+   return NULL;
+
+   buf->drv_addr = gen_pool_alloc(ctx->pool, size);
+   if (0 == buf->drv_addr)
+   goto gen_pool_alloc_fail;
+
+   buf->info.size = size;
+   buf->info.num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
+   buf->ctx = ctx;
+   buf->info.pages = kzalloc(
+   buf->info.num_pages * sizeof(struct page *), GFP_KERNEL);
+   if (!buf->info.pages)
+   goto fail_pages_

[PATCH 2/7] ARM: S5PV310: power domains: fixes and code cleanup

2011-03-04 Thread Marek Szyprowski
From: Tomasz Stanislawski 

This patch extends power domain driver with support for enabling and
disabling modules in S5P_CLKGATE_BLOCK register. It also performs a
little code cleanup to avoid confusion between s5pv310_device_pd array
index and power domain id.

Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
Signed-off-by: Marek Szyprowski 
---
 arch/arm/mach-s5pv310/dev-pd.c  |   93 +--
 arch/arm/mach-s5pv310/include/mach/regs-clock.h |9 ++
 arch/arm/plat-samsung/include/plat/pd.h |1 +
 3 files changed, 81 insertions(+), 22 deletions(-)

diff --git a/arch/arm/mach-s5pv310/dev-pd.c b/arch/arm/mach-s5pv310/dev-pd.c
index 58a50c2..e051998 100644
--- a/arch/arm/mach-s5pv310/dev-pd.c
+++ b/arch/arm/mach-s5pv310/dev-pd.c
@@ -16,13 +16,17 @@
 #include 
 
 #include 
+#include 
 
 #include 
 
+static spinlock_t gate_block_slock = SPIN_LOCK_UNLOCKED;
+
 static int s5pv310_pd_enable(struct device *dev)
 {
struct samsung_pd_info *pdata =  dev->platform_data;
u32 timeout;
+   int ret = 0;
 
__raw_writel(S5P_INT_LOCAL_PWR_EN, pdata->base);
 
@@ -31,21 +35,39 @@ static int s5pv310_pd_enable(struct device *dev)
while ((__raw_readl(pdata->base + 0x4) & S5P_INT_LOCAL_PWR_EN)
!= S5P_INT_LOCAL_PWR_EN) {
if (timeout == 0) {
-   printk(KERN_ERR "Power domain %s enable failed.\n",
-   dev_name(dev));
-   return -ETIMEDOUT;
+   dev_err(dev, "enable failed\n");
+   ret = -ETIMEDOUT;
+   goto done;
}
timeout--;
udelay(100);
}
 
-   return 0;
+   /* configure clk gate mask if it is present */
+   if (pdata->gate_mask) {
+   unsigned long flags;
+   unsigned long value;
+
+   spin_lock_irqsave(&gate_block_slock, flags);
+
+   value  = __raw_readl(S5P_CLKGATE_BLOCK);
+   value |= pdata->gate_mask;
+   __raw_writel(value, S5P_CLKGATE_BLOCK);
+
+   spin_unlock_irqrestore(&gate_block_slock, flags);
+   }
+
+done:
+   dev_info(dev, "enable finished\n");
+
+   return ret;
 }
 
 static int s5pv310_pd_disable(struct device *dev)
 {
struct samsung_pd_info *pdata =  dev->platform_data;
u32 timeout;
+   int ret = 0;
 
__raw_writel(0, pdata->base);
 
@@ -53,81 +75,108 @@ static int s5pv310_pd_disable(struct device *dev)
timeout = 10;
while (__raw_readl(pdata->base + 0x4) & S5P_INT_LOCAL_PWR_EN) {
if (timeout == 0) {
-   printk(KERN_ERR "Power domain %s disable failed.\n",
-   dev_name(dev));
-   return -ETIMEDOUT;
+   dev_err(dev, "disable failed\n");
+   ret = -ETIMEDOUT;
+   goto done;
}
timeout--;
udelay(100);
}
 
-   return 0;
+   if (pdata->gate_mask) {
+   unsigned long flags;
+   unsigned long value;
+
+   spin_lock_irqsave(&gate_block_slock, flags);
+
+   value  = __raw_readl(S5P_CLKGATE_BLOCK);
+   value &= ~pdata->gate_mask;
+   __raw_writel(value, S5P_CLKGATE_BLOCK);
+
+   spin_unlock_irqrestore(&gate_block_slock, flags);
+   }
+done:
+   dev_info(dev, "disable finished\n");
+
+   return ret;
 }
 
 struct platform_device s5pv310_device_pd[] = {
-   {
+   [PD_MFC] = {
.name   = "samsung-pd",
-   .id = 0,
+   .id = PD_MFC,
.dev = {
.platform_data = &(struct samsung_pd_info) {
.enable = s5pv310_pd_enable,
.disable= s5pv310_pd_disable,
.base   = S5P_PMU_MFC_CONF,
+   .gate_mask  = S5P_CLKGATE_BLOCK_MFC,
},
},
-   }, {
+   },
+   [PD_G3D] = {
.name   = "samsung-pd",
-   .id = 1,
+   .id = PD_G3D,
.dev = {
.platform_data = &(struct samsung_pd_info) {
.enable = s5pv310_pd_enable,
.disable= s5pv310_pd_disable,
.base   = S5P_PMU_G3D_CONF,
+   .gate_mask  = S5P_CLKGATE_BLOCK_G3D,
},
},
-   }, {
+   },
+   [PD_LCD0] = {
.name   = "samsung-pd",
-   .id = 2,
+   .id = PD_LCD0,
  

[PATCH 7/7] ARM: S5PC210: enable FIMC on Universal_C210

2011-03-04 Thread Marek Szyprowski
This patch adds definitions to enable support for s5p-fimc driver
together with required power domains and sysmmu controller on Universal
C210 board.

Signed-off-by: Marek Szyprowski 
Signed-off-by: Kyungmin Park 
---
 arch/arm/mach-s5pv310/Kconfig   |6 ++
 arch/arm/mach-s5pv310/mach-universal_c210.c |   20 
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s5pv310/Kconfig b/arch/arm/mach-s5pv310/Kconfig
index a8b0425..c850086 100644
--- a/arch/arm/mach-s5pv310/Kconfig
+++ b/arch/arm/mach-s5pv310/Kconfig
@@ -97,12 +97,18 @@ config MACH_UNIVERSAL_C210
bool "Mobile UNIVERSAL_C210 Board"
select CPU_S5PV310
select S5P_DEV_ONENAND
+   select S5P_DEV_FIMC0
+   select S5P_DEV_FIMC1
+   select S5P_DEV_FIMC2
+   select S5P_DEV_FIMC3
select S3C_DEV_HSMMC
select S3C_DEV_HSMMC2
select S3C_DEV_HSMMC3
select S5PV310_SETUP_SDHCI
select S3C_DEV_I2C1
select S3C_DEV_I2C5
+   select S5PV310_DEV_PD
+   select S5PV310_DEV_SYSMMU
select S5PV310_SETUP_I2C1
select S5PV310_SETUP_I2C5
help
diff --git a/arch/arm/mach-s5pv310/mach-universal_c210.c 
b/arch/arm/mach-s5pv310/mach-universal_c210.c
index eece381..f153895 100644
--- a/arch/arm/mach-s5pv310/mach-universal_c210.c
+++ b/arch/arm/mach-s5pv310/mach-universal_c210.c
@@ -24,7 +24,9 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
 #include 
 #include 
@@ -816,6 +818,15 @@ static struct platform_device *universal_devices[] 
__initdata = {
&s3c_device_hsmmc0,
&s3c_device_hsmmc2,
&s3c_device_hsmmc3,
+   &s5p_device_fimc0,
+   &s5p_device_fimc1,
+   &s5p_device_fimc2,
+   &s5p_device_fimc3,
+   &s5pv310_device_pd[PD_CAM],
+   &s5pv310_device_sysmmu[S5P_SYSMMU_FIMC0],
+   &s5pv310_device_sysmmu[S5P_SYSMMU_FIMC1],
+   &s5pv310_device_sysmmu[S5P_SYSMMU_FIMC2],
+   &s5pv310_device_sysmmu[S5P_SYSMMU_FIMC3],
 
/* Universal Devices */
&universal_gpio_keys,
@@ -842,6 +853,15 @@ static void __init universal_machine_init(void)
 
/* Last */
platform_add_devices(universal_devices, ARRAY_SIZE(universal_devices));
+
+   s5p_device_fimc0.dev.parent = &s5pv310_device_pd[PD_CAM].dev;
+   s5p_device_fimc1.dev.parent = &s5pv310_device_pd[PD_CAM].dev;
+   s5p_device_fimc2.dev.parent = &s5pv310_device_pd[PD_CAM].dev;
+   s5p_device_fimc3.dev.parent = &s5pv310_device_pd[PD_CAM].dev;
+   s5pv310_device_sysmmu[S5P_SYSMMU_FIMC0].dev.parent = 
&s5pv310_device_pd[PD_CAM].dev;
+   s5pv310_device_sysmmu[S5P_SYSMMU_FIMC1].dev.parent = 
&s5pv310_device_pd[PD_CAM].dev;
+   s5pv310_device_sysmmu[S5P_SYSMMU_FIMC2].dev.parent = 
&s5pv310_device_pd[PD_CAM].dev;
+   s5pv310_device_sysmmu[S5P_SYSMMU_FIMC3].dev.parent = 
&s5pv310_device_pd[PD_CAM].dev;
 }
 
 MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
-- 
1.7.1.569.g6f426
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/7] s5p-fimc: Add support for vb2-s5p-iommu allocator

2011-03-04 Thread Marek Szyprowski
This patch adds support for videobuf2-s5p-iommu allocator to s5p-fimc
driver. This allocator is selected only on systems that contains support
for S5P SYSMMU module. Otherwise the standard videobuf2-dma-contig is
used.

Signed-off-by: Marek Szyprowski 
Signed-off-by: Kyungmin Park 
---
 drivers/media/video/Kconfig |3 +-
 drivers/media/video/s5p-fimc/fimc-capture.c |4 +-
 drivers/media/video/s5p-fimc/fimc-core.c|   22 ---
 drivers/media/video/s5p-fimc/fimc-mem.h |   87 +++
 4 files changed, 104 insertions(+), 12 deletions(-)
 create mode 100644 drivers/media/video/s5p-fimc/fimc-mem.h

diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 9806505..12fb325 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -1018,7 +1018,8 @@ config VIDEO_MEM2MEM_TESTDEV
 config  VIDEO_SAMSUNG_S5P_FIMC
tristate "Samsung S5P FIMC (video postprocessor) driver"
depends on VIDEO_DEV && VIDEO_V4L2 && PLAT_S5P
-   select VIDEOBUF2_DMA_CONTIG
+   select VIDEOBUF2_S5P_IOMMU if S5P_SYSTEM_MMU
+   select VIDEOBUF2_DMA_CONTIG if !S5P_SYSTEM_MMU
select V4L2_MEM2MEM_DEV
help
  This is a v4l2 driver for the S5P camera interface
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c 
b/drivers/media/video/s5p-fimc/fimc-capture.c
index f8d7de5..6819908 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -29,8 +29,8 @@
 #include 
 #include 
 #include 
-#include 
 
+#include "fimc-mem.h"
 #include "fimc-core.h"
 
 static struct v4l2_subdev *fimc_subdev_register(struct fimc_dev *fimc,
@@ -881,7 +881,7 @@ int fimc_register_capture_device(struct fimc_dev *fimc)
q->io_modes = VB2_MMAP | VB2_USERPTR;
q->drv_priv = fimc->vid_cap.ctx;
q->ops = &fimc_capture_qops;
-   q->mem_ops = &vb2_dma_contig_memops;
+   q->mem_ops = &fimc_vb2_allocator_memops;
q->buf_struct_size = sizeof(struct fimc_vid_buffer);
 
vb2_queue_init(q);
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c 
b/drivers/media/video/s5p-fimc/fimc-core.c
index c92dbdb..f06aaea 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.c
+++ b/drivers/media/video/s5p-fimc/fimc-core.c
@@ -27,8 +27,8 @@
 #include 
 #include 
 #include 
-#include 
 
+#include "fimc-mem.h"
 #include "fimc-core.h"
 
 static char *fimc_clocks[MAX_FIMC_CLOCKS] = {
@@ -458,7 +458,7 @@ int fimc_prepare_addr(struct fimc_ctx *ctx, struct 
vb2_buffer *vb,
dbg("memplanes= %d, colplanes= %d, pix_size= %d",
frame->fmt->memplanes, frame->fmt->colplanes, pix_size);
 
-   paddr->y = vb2_dma_contig_plane_paddr(vb, 0);
+   paddr->y = fimc_vb2_plane_addr(vb, 0);
 
if (frame->fmt->memplanes == 1) {
switch (frame->fmt->colplanes) {
@@ -486,10 +486,10 @@ int fimc_prepare_addr(struct fimc_ctx *ctx, struct 
vb2_buffer *vb,
}
} else {
if (frame->fmt->memplanes >= 2)
-   paddr->cb = vb2_dma_contig_plane_paddr(vb, 1);
+   paddr->cb = fimc_vb2_plane_addr(vb, 1);
 
if (frame->fmt->memplanes == 3)
-   paddr->cr = vb2_dma_contig_plane_paddr(vb, 2);
+   paddr->cr = fimc_vb2_plane_addr(vb, 2);
}
 
dbg("PHYS_ADDR: y= 0x%X  cb= 0x%X cr= 0x%X ret= %d",
@@ -1375,7 +1375,7 @@ static int queue_init(void *priv, struct vb2_queue 
*src_vq,
src_vq->io_modes = VB2_MMAP | VB2_USERPTR;
src_vq->drv_priv = ctx;
src_vq->ops = &fimc_qops;
-   src_vq->mem_ops = &vb2_dma_contig_memops;
+   src_vq->mem_ops = &fimc_vb2_allocator_memops;
src_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer);
 
ret = vb2_queue_init(src_vq);
@@ -1387,7 +1387,7 @@ static int queue_init(void *priv, struct vb2_queue 
*src_vq,
dst_vq->io_modes = VB2_MMAP | VB2_USERPTR;
dst_vq->drv_priv = ctx;
dst_vq->ops = &fimc_qops;
-   dst_vq->mem_ops = &vb2_dma_contig_memops;
+   dst_vq->mem_ops = &fimc_vb2_allocator_memops;
dst_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer);
 
return vb2_queue_init(dst_vq);
@@ -1685,12 +1685,15 @@ static int fimc_probe(struct platform_device *pdev)
goto err_clk;
}
 
-   /* Initialize contiguous memory allocator */
-   fimc->alloc_ctx = vb2_dma_contig_init_ctx(&fimc->pdev->dev);
+   /* Initialize memory allocator */
+   fimc->alloc_ctx = fimc_vb2_allocator_init(pdev);
if (IS_ERR(fimc->alloc_ctx)) {
ret = PTR_ERR(fimc->alloc_ctx);
goto err_irq;
}
+   ret = fimc_vb2_allocator_enable(fimc->alloc_ctx);
+   if (ret)
+   goto err_irq;
 
ret = fimc_register_m2m_device(fimc);
if (ret)
@@ -1747,7 +1750,8 @@ static int __devexit fimc_remove(struct platform_device 
*pdev)
 
fimc_cl

[PATCH/RFC 0/7] Samsung IOMMU videobuf2 allocator and s5p-fimc update

2011-03-04 Thread Marek Szyprowski
Hello,

This patch series introduces new type of videbuf2 memory allocator -
vb2-s5p-iommu. This allocator can be used only on Samsung SoCs that have
IOMMU module. Currently only Samsung EXYNOS4 (former S5PV310) platform
has SYSMMU modules. The allocator is then used by s5p-fimc driver. To
make it possible some additional changes are required. Mainly platform
support for s5p-fimc for EXYNOS4 machines need to be defined. The
proposed solution has been tested on Universal C210 board (Samsung
S5PC210/EXYNOS4 based).

We decided to use driver private address space mode of the iommu driver.
This way each vb2-s5p-iommu client gets it's own address space for
memory buffers. This reduces kernel virtual memory fragmentation as well
as solves some non-trivial page table updates issues. The drawback is
the fact that the interface for s5p-sysmmu has been changed.

This IOMMU allocator has no dependences on other subsystems besides
Samsung platfrom core. We also ported s5p-mfc and s5p-tv drivers to this
allocator, they will be posted in separate patch series. This will
enable to get them working on EXYNOS4 (S5PV310) platform. Support for
S5PV210/S5PC110 platform still depends on CMA allocator that needs more
discussion on memory management mailing list and development. The
patches with updated s5p-mfc and s5p-tv drivers will follow.

To get FIMC module working on EXYNOS4/UniversalC210 board we also added
support for power domains and power gating.

This patch series contains a collection of patches for various platform
subsystems. Here is a detailed list:

[PATCH 1/7] ARM: S5PV310: Add platform definitions for FIMC
- adds basic platform resources for FIMC modules (for s5p-fimc driver)

[PATCH 2/7] ARM: S5PV310: power domains: fixes and code cleanup
- adds support for block gating in Samsung power domain driver and
  performs some cleanup

[PATCH 3/7] ARM: Samsung: update/rewrite Samsung SYSMMU (IOMMU) driver
- a complete rewrite of sysmmu driver for Samsung platform:
- the new version introduces device private page tables (address space)
  mode
- simplified the resource management (no more horrible single platform
  device with 32 resources is needed)
- some other API chages required by upcoming videobuf2 allocator

[PATCH 4/7] v4l: videobuf2: add Samsung SYSMMU (IOMMU) based allocator
- introduces new memory allocator for videobuf2, it uses s5p-sysmmu
  iommu driver, memory for video buffers is acuired by alloc_page() kernel
  function

[PATCH 5/7] s5p-fimc: add pm_runtime support
- adds support for pm_runtime in s5p-fimc driver

[PATCH 6/7] s5p-fimc: Add support for vb2-s5p-iommu allocator
- adds support for the newly introduces videbuf2-s5p-iommu allocator
  on EXYNOS4 platform

[PATCH 7/7] ARM: S5PC210: enable FIMC on Universal_C210
- adds all required machine definitions to get FIMC modules working
  on Universal C210 boards


The patch series is based on git://linuxtv.org/media_tree.git tree,
staging/for_v2.6.39 branch with the following Samsung platform patches:
1. [PATCH] ARM: Samsung: change suspend/resume code to depend on CONFIG_SUSPEND
http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg04025.html
2. [PATCH v2] ARM: S5PC210: add support for i2c PMICs on Universal_C210 board
http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg04029.html

This series has not been rebased onto the latest changes (S5PV310
renamed to EXYNOS4) in
git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git,
for-next branch. We will rebase them soon, but first we want to get
feedback and comments on the s5p-iommu videobuf2 allocator idea.

Best regards
-- 
Marek Szyprowski
Samsung Poland R&D Center


Complete patch summary:

Andrzej Pietrasiewicz (2):
  ARM: Samsung: update/rewrite Samsung SYSMMU (IOMMU) driver
  v4l: videobuf2: add Samsung SYSMMU (IOMMU) based allocator

Marek Szyprowski (3):
  s5p-fimc: add pm_runtime support
  s5p-fimc: Add support for vb2-s5p-iommu allocator
  ARM: S5PC210: enable FIMC on Universal_C210

Sylwester Nawrocki (1):
  ARM: S5PV310: Add platform definitions for FIMC

Tomasz Stanislawski (1):
  ARM: S5PV310: power domains: fixes and code cleanup

 arch/arm/mach-s5pv310/Kconfig|6 +
 arch/arm/mach-s5pv310/clock.c|   91 ++
 arch/arm/mach-s5pv310/cpu.c  |7 +
 arch/arm/mach-s5pv310/dev-pd.c   |   93 ++-
 arch/arm/mach-s5pv310/dev-sysmmu.c   |  582 +
 arch/arm/mach-s5pv310/include/mach/irqs.h|   40 +-
 arch/arm/mach-s5pv310/include/mach/map.h |8 +
 arch/arm/mach-s5pv310/include/mach/regs-clock.h  |   12 +
 arch/arm/mach-s5pv310/include/mach/regs-sysmmu.h |   23 +-
 arch/arm/mach-s5pv310/include/mach/sysmmu.h  |  122 ---
 arch/arm/mach-s5pv310/mach-universal_c210.c  |   20 +
 arch/arm/plat-s5p/Kconfig|   22 +-
 arch/arm/plat-s5p/Makefile   |1 +
 arch/arm/plat-s5p/dev-fimc3.c  

[PATCH 1/7] ARM: S5PV310: Add platform definitions for FIMC

2011-03-04 Thread Marek Szyprowski
From: Sylwester Nawrocki 

Add support for fourth FIMC platform device definition and define
resources for FIMC modules on S5PV310 machines.

Signed-off-by: Sylwester Nawrocki 
Signed-off-by: Kyungmin Park 
Signed-off-by: Marek Szyprowski 
---
 arch/arm/mach-s5pv310/cpu.c|7 
 arch/arm/mach-s5pv310/include/mach/irqs.h  |4 ++
 arch/arm/mach-s5pv310/include/mach/map.h   |8 
 arch/arm/plat-s5p/Kconfig  |5 +++
 arch/arm/plat-s5p/Makefile |1 +
 arch/arm/plat-s5p/dev-fimc3.c  |   43 
 arch/arm/plat-samsung/include/plat/devs.h  |1 +
 arch/arm/plat-samsung/include/plat/fimc-core.h |5 +++
 8 files changed, 74 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-s5p/dev-fimc3.c

diff --git a/arch/arm/mach-s5pv310/cpu.c b/arch/arm/mach-s5pv310/cpu.c
index 0db0fb6..0bdb0b0 100644
--- a/arch/arm/mach-s5pv310/cpu.c
+++ b/arch/arm/mach-s5pv310/cpu.c
@@ -21,6 +21,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 
@@ -114,6 +116,11 @@ void __init s5pv310_map_io(void)
s5pv310_default_sdhci1();
s5pv310_default_sdhci2();
s5pv310_default_sdhci3();
+
+   s3c_fimc_setname(0, "s5pv310-fimc");
+   s3c_fimc_setname(1, "s5pv310-fimc");
+   s3c_fimc_setname(2, "s5pv310-fimc");
+   s3c_fimc_setname(3, "s5pv310-fimc");
 }
 
 void __init s5pv310_init_clocks(int xtal)
diff --git a/arch/arm/mach-s5pv310/include/mach/irqs.h 
b/arch/arm/mach-s5pv310/include/mach/irqs.h
index 536b0b5..0e99968 100644
--- a/arch/arm/mach-s5pv310/include/mach/irqs.h
+++ b/arch/arm/mach-s5pv310/include/mach/irqs.h
@@ -107,6 +107,10 @@
 
 #define IRQ_MIPI_CSIS0 COMBINER_IRQ(30, 0)
 #define IRQ_MIPI_CSIS1 COMBINER_IRQ(30, 1)
+#define IRQ_FIMC0  COMBINER_IRQ(32, 0)
+#define IRQ_FIMC1  COMBINER_IRQ(32, 1)
+#define IRQ_FIMC2  COMBINER_IRQ(33, 0)
+#define IRQ_FIMC3  COMBINER_IRQ(33, 1)
 
 #define IRQ_ONENAND_AUDI   COMBINER_IRQ(34, 0)
 
diff --git a/arch/arm/mach-s5pv310/include/mach/map.h 
b/arch/arm/mach-s5pv310/include/mach/map.h
index 901657f..0db3a47 100644
--- a/arch/arm/mach-s5pv310/include/mach/map.h
+++ b/arch/arm/mach-s5pv310/include/mach/map.h
@@ -25,6 +25,10 @@
 
 #define S5PV310_PA_SYSRAM  0x02025000
 
+#define S5PV310_PA_FIMC0   0x1180
+#define S5PV310_PA_FIMC1   0x1181
+#define S5PV310_PA_FIMC2   0x1182
+#define S5PV310_PA_FIMC3   0x1183
 #define S5PV310_PA_I2S00x0383
 #define S5PV310_PA_I2S10xE310
 #define S5PV310_PA_I2S20xE2A0
@@ -121,6 +125,10 @@
 #define S5P_PA_CHIPID  S5PV310_PA_CHIPID
 #define S5P_PA_MIPI_CSIS0  S5PV310_PA_MIPI_CSIS0
 #define S5P_PA_MIPI_CSIS1  S5PV310_PA_MIPI_CSIS1
+#define S5P_PA_FIMC0   S5PV310_PA_FIMC0
+#define S5P_PA_FIMC1   S5PV310_PA_FIMC1
+#define S5P_PA_FIMC2   S5PV310_PA_FIMC2
+#define S5P_PA_FIMC3   S5PV310_PA_FIMC3
 #define S5P_PA_ONENAND S5PC210_PA_ONENAND
 #define S5P_PA_ONENAND_DMA S5PC210_PA_ONENAND_DMA
 #define S5P_PA_SDRAM   S5PV310_PA_SDRAM
diff --git a/arch/arm/plat-s5p/Kconfig b/arch/arm/plat-s5p/Kconfig
index 557f8c5..0db2a7a 100644
--- a/arch/arm/plat-s5p/Kconfig
+++ b/arch/arm/plat-s5p/Kconfig
@@ -60,6 +60,11 @@ config S5P_DEV_FIMC2
help
  Compile in platform device definitions for FIMC controller 2
 
+config S5P_DEV_FIMC3
+   bool
+   help
+ Compile in platform device definitions for FIMC controller 3
+ 
 config S5P_DEV_ONENAND
bool
help
diff --git a/arch/arm/plat-s5p/Makefile b/arch/arm/plat-s5p/Makefile
index ce5a0a7..cfcd1db 100644
--- a/arch/arm/plat-s5p/Makefile
+++ b/arch/arm/plat-s5p/Makefile
@@ -28,6 +28,7 @@ obj-$(CONFIG_SUSPEND) += irq-pm.o
 obj-$(CONFIG_S5P_DEV_FIMC0)+= dev-fimc0.o
 obj-$(CONFIG_S5P_DEV_FIMC1)+= dev-fimc1.o
 obj-$(CONFIG_S5P_DEV_FIMC2)+= dev-fimc2.o
+obj-$(CONFIG_S5P_DEV_FIMC3)+= dev-fimc3.o
 obj-$(CONFIG_S5P_DEV_ONENAND)  += dev-onenand.o
 obj-$(CONFIG_S5P_DEV_CSIS0)+= dev-csis0.o
 obj-$(CONFIG_S5P_DEV_CSIS1)+= dev-csis1.o
diff --git a/arch/arm/plat-s5p/dev-fimc3.c b/arch/arm/plat-s5p/dev-fimc3.c
new file mode 100644
index 000..ef31bec
--- /dev/null
+++ b/arch/arm/plat-s5p/dev-fimc3.c
@@ -0,0 +1,43 @@
+/* linux/arch/arm/plat-s5p/dev-fimc3.c
+ *
+ * Copyright (c) 2010 Samsung Electronics
+ *
+ * Base S5P FIMC3 resource and device definitions
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include

[PATCH 5/7] s5p-fimc: add pm_runtime support

2011-03-04 Thread Marek Szyprowski
This patch adds basic support for pm_runtime to s5p-fimc driver. PM
runtime support is required to enable the driver on S5PV310 series with
power domain driver enabled.

Signed-off-by: Marek Szyprowski 
Signed-off-by: Kyungmin Park 
---
 drivers/media/video/s5p-fimc/fimc-capture.c |5 +
 drivers/media/video/s5p-fimc/fimc-core.c|   14 ++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c 
b/drivers/media/video/s5p-fimc/fimc-capture.c
index 59123a6..f8d7de5 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -395,6 +396,8 @@ static int fimc_capture_open(struct file *file)
if (fimc_m2m_active(fimc))
return -EBUSY;
 
+   pm_runtime_get_sync(&fimc->pdev->dev);
+
if (++fimc->vid_cap.refcnt == 1) {
ret = fimc_isp_subdev_init(fimc, 0);
if (ret) {
@@ -425,6 +428,8 @@ static int fimc_capture_close(struct file *file)
fimc_subdev_unregister(fimc);
}
 
+   pm_runtime_put_sync(&fimc->pdev->dev);
+
return 0;
 }
 
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c 
b/drivers/media/video/s5p-fimc/fimc-core.c
index db3e730..c92dbdb 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.c
+++ b/drivers/media/video/s5p-fimc/fimc-core.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1407,6 +1408,8 @@ static int fimc_m2m_open(struct file *file)
if (fimc->vid_cap.refcnt > 0)
return -EBUSY;
 
+   pm_runtime_get_sync(&fimc->pdev->dev);
+
fimc->m2m.refcnt++;
set_bit(ST_OUTDMA_RUN, &fimc->state);
 
@@ -1449,6 +1452,8 @@ static int fimc_m2m_release(struct file *file)
if (--fimc->m2m.refcnt <= 0)
clear_bit(ST_OUTDMA_RUN, &fimc->state);
 
+   pm_runtime_put_sync(&fimc->pdev->dev);
+
return 0;
 }
 
@@ -1646,6 +1651,11 @@ static int fimc_probe(struct platform_device *pdev)
goto err_req_region;
}
 
+   pm_runtime_set_active(&pdev->dev);
+   pm_runtime_enable(&pdev->dev);
+
+   pm_runtime_get_sync(&pdev->dev);
+
fimc->num_clocks = MAX_FIMC_CLOCKS - 1;
 
/* Check if a video capture node needs to be registered. */
@@ -1703,6 +1713,8 @@ static int fimc_probe(struct platform_device *pdev)
dev_dbg(&pdev->dev, "%s(): fimc-%d registered successfully\n",
__func__, fimc->id);
 
+   pm_runtime_put_sync(&pdev->dev);
+
return 0;
 
 err_m2m:
@@ -1737,6 +1749,8 @@ static int __devexit fimc_remove(struct platform_device 
*pdev)
 
vb2_dma_contig_cleanup_ctx(fimc->alloc_ctx);
 
+   pm_runtime_disable(&pdev->dev);
+
iounmap(fimc->regs);
release_resource(fimc->regs_res);
kfree(fimc->regs_res);
-- 
1.7.1.569.g6f426
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] ARM: EXYNOS4: enabled lcd and backlight in NURI board

2011-03-04 Thread Kukjin Kim
Donghwa Lee wrote:
> 
>  On 2011-03-03, Kukjin Kim wrote:
> >
> >>  #
> >>  # Display device support
> >> diff --git a/arch/arm/mach-exynos4/Kconfig
b/arch/arm/mach-exynos4/Kconfig
> >> index 5bf00b9..1d0d222 100644
> >> --- a/arch/arm/mach-exynos4/Kconfig
> >> +++ b/arch/arm/mach-exynos4/Kconfig
> >> @@ -135,6 +135,7 @@ config MACH_NURI
> >>select EXYNOS4_SETUP_I2C1
> >>select EXYNOS4_SETUP_I2C5
> >>select EXYNOS4_SETUP_SDHCI
> >> +  select HAVE_PWM
> > Since Banajit's PWM backlight patches will be merged, should be
following
> > your next patch.
> >
> > +   select SAMSUNG_DEV_PWM
> >
> >
> 
> Dear Kukjin,
> Thanks for your review.
> I'm preparing next patch for your review including other modifications.
> But, I cannot find committed patches of PWM backlight of Banajit.
> Was it merged? If so, please tell me committed tree.
> 
I merged it just now :)
You can see it in my for-next.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim , Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH V2 2/6] ARM: SAMSUNG: Add PWM backlight support on Samsung S3C6410

2011-03-04 Thread Kukjin Kim
Banajit Goswami wrote:
> 
> This patch adds support for LCD backlight using PWM timer for
> Samsung SMDK6410 board.
> 
> Signed-off-by: Banajit Goswami 
> ---
> Changes since v1:
> - Used common GPIO macro
> - Removed redundant timers
> 
>  arch/arm/mach-s3c64xx/Kconfig |1 +
>  arch/arm/mach-s3c64xx/mach-smdk6410.c |   45
++-
> -
>  2 files changed, 44 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
> index f3a953f..e4177e2 100644
> --- a/arch/arm/mach-s3c64xx/Kconfig
> +++ b/arch/arm/mach-s3c64xx/Kconfig
> @@ -143,6 +143,7 @@ config MACH_SMDK6410
>   select S3C_DEV_USB_HSOTG
>   select S3C_DEV_WDT
>   select SAMSUNG_DEV_KEYPAD
> + select SAMSUNG_DEV_PWM
>   select HAVE_S3C2410_WATCHDOG if WATCHDOG
>   select S3C64XX_SETUP_SDHCI
>   select S3C64XX_SETUP_I2C1
> diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-
> s3c64xx/mach-smdk6410.c
> index e85192a..4a3fe0c 100644
> --- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
> +++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
> @@ -28,6 +28,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
> 
>  #ifdef CONFIG_SMDK6410_WM1190_EV1
>  #include 
> @@ -48,6 +49,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
> 
>  #include 
>  #include 
> @@ -118,7 +120,6 @@ static void smdk6410_lcd_power_set(struct
plat_lcd_data
> *pd,
>  {
>   if (power) {
>   gpio_direction_output(S3C64XX_GPF(13), 1);
> - gpio_direction_output(S3C64XX_GPF(15), 1);
> 
>   /* fire nRESET on power up */
>   gpio_direction_output(S3C64XX_GPN(5), 0);
> @@ -126,7 +127,6 @@ static void smdk6410_lcd_power_set(struct
plat_lcd_data
> *pd,
>   gpio_direction_output(S3C64XX_GPN(5), 1);
>   msleep(1);
>   } else {
> - gpio_direction_output(S3C64XX_GPF(15), 0);
>   gpio_direction_output(S3C64XX_GPF(13), 0);
>   }
>  }
> @@ -269,6 +269,45 @@ static struct samsung_keypad_platdata
> smdk6410_keypad_data __initdata = {
>   .cols   = 8,
>  };
> 
> +static int smdk6410_backlight_init(struct device *dev)
> +{
> + int ret;
> +
> + ret = gpio_request(S3C64XX_GPF(15), "Backlight");
> + if (ret) {
> + printk(KERN_ERR "failed to request GPF for PWM-OUT1\n");
> + return ret;
> + }
> +
> + /* Configure GPIO pin with S3C64XX_GPF15_PWM_TOUT1 */
> + s3c_gpio_cfgpin(S3C64XX_GPF(15), S3C_GPIO_SFN(2));
> +
> + return 0;
> +}
> +
> +static void smdk6410_backlight_exit(struct device *dev)
> +{
> + s3c_gpio_cfgpin(S3C64XX_GPF(15), S3C_GPIO_OUTPUT);
> + gpio_free(S3C64XX_GPF(15));
> +}
> +
> +static struct platform_pwm_backlight_data smdk6410_backlight_data = {
> + .pwm_id = 1,
> + .max_brightness = 255,
> + .dft_brightness = 255,
> + .pwm_period_ns  = 78770,
> + .init   = smdk6410_backlight_init,
> + .exit   = smdk6410_backlight_exit,
> +};
> +
> +static struct platform_device smdk6410_backlight_device = {
> + .name   = "pwm-backlight",
> + .dev= {
> + .parent = &s3c_device_timer[1].dev,
> + .platform_data  = &smdk6410_backlight_data,
> + },
> +};
> +
>  static struct map_desc smdk6410_iodesc[] = {};
> 
>  static struct platform_device *smdk6410_devices[] __initdata = {
> @@ -298,6 +337,8 @@ static struct platform_device *smdk6410_devices[]
> __initdata = {
>   &s3c_device_rtc,
>   &s3c_device_ts,
>   &s3c_device_wdt,
> + &s3c_device_timer[1],
> + &smdk6410_backlight_device,
>  };
> 
>  #ifdef CONFIG_REGULATOR
> @@ -693,7 +735,6 @@ static void __init smdk6410_machine_init(void)
> 
>   gpio_request(S3C64XX_GPN(5), "LCD power");
>   gpio_request(S3C64XX_GPF(13), "LCD power");
> - gpio_request(S3C64XX_GPF(15), "LCD power");
> 
>   i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
>   i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
> --
> 1.6.5.2

Ok, applied with others. (your PWM backlight patch-set (#1 to #6))
Thanks.

Best regards,
Kgene.
--
Kukjin Kim , Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] ARM: EXYNOS4: Adds Samsung NURI board support

2011-03-04 Thread Kukjin Kim
Kukjin Kim wrote:
> 
> Oops, NURI board is not registered yet :(
> So can't merge this before updating it now.
> Or should drop update defconfig from this...
> 
So applied without defconfig changes.
As you know, if required, can do it later :)

If any problems, please let me know.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim , Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html