[PATCH 4/4] cx23885: Hauppauge WinTV-HVR5525

2014-12-19 Thread Antti Palosaari
Add board profile for Hauppauge WinTV-HVR5525.

Device is build upon following main components:
Conexant CX23888
Montage M88RS6000
Allegro A8293
Silicon Labs Si2168-B40
Silicon Labs Si2157-A30

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/pci/cx23885/Kconfig |  1 +
 drivers/media/pci/cx23885/cx23885-cards.c | 43 ++
 drivers/media/pci/cx23885/cx23885-dvb.c   | 98 +++
 drivers/media/pci/cx23885/cx23885.h   |  1 +
 4 files changed, 143 insertions(+)

diff --git a/drivers/media/pci/cx23885/Kconfig 
b/drivers/media/pci/cx23885/Kconfig
index f613314..74d774e 100644
--- a/drivers/media/pci/cx23885/Kconfig
+++ b/drivers/media/pci/cx23885/Kconfig
@@ -41,6 +41,7 @@ config VIDEO_CX23885
select MEDIA_TUNER_XC5000 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_SI2157 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_M88TS2022 if MEDIA_SUBDRV_AUTOSELECT
+   select MEDIA_TUNER_M88RS6000T if MEDIA_SUBDRV_AUTOSELECT
select DVB_TUNER_DIB0070 if MEDIA_SUBDRV_AUTOSELECT
---help---
  This is a video4linux driver for Conexant 23885 based
diff --git a/drivers/media/pci/cx23885/cx23885-cards.c 
b/drivers/media/pci/cx23885/cx23885-cards.c
index db99ca2..2a92bcd 100644
--- a/drivers/media/pci/cx23885/cx23885-cards.c
+++ b/drivers/media/pci/cx23885/cx23885-cards.c
@@ -706,6 +706,11 @@ struct cx23885_board cx23885_boards[] = {
.portb  = CX23885_MPEG_DVB,
.portc  = CX23885_MPEG_DVB,
},
+   [CX23885_BOARD_HAUPPAUGE_HVR5525] = {
+   .name   = Hauppauge WinTV-HVR5525,
+   .portb  = CX23885_MPEG_DVB,
+   .portc  = CX23885_MPEG_DVB,
+   },
 };
 const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards);
 
@@ -989,6 +994,10 @@ struct cx23885_subid cx23885_subids[] = {
.subvendor = 0x4254,
.subdevice = 0x0982,
.card  = CX23885_BOARD_DVBSKY_T982,
+   }, {
+   .subvendor = 0x0070,
+   .subdevice = 0xf038,
+   .card  = CX23885_BOARD_HAUPPAUGE_HVR5525,
},
 };
 const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids);
@@ -1161,6 +1170,8 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 
*eeprom_data)
case 85721:
/* WinTV-HVR1290 (PCIe, OEM, RCA in, IR,
Dual channel ATSC and Basic analog */
+   case 150329:
+   /* WinTV-HVR5525 (PCIe, DVB-S/S2, DVB-T/T2/C) */
break;
default:
printk(KERN_WARNING %s: warning: 
@@ -1632,6 +1643,29 @@ void cx23885_gpio_setup(struct cx23885_dev *dev)
msleep(100);
cx23885_gpio_set(dev, GPIO_2);
break;
+   case CX23885_BOARD_HAUPPAUGE_HVR5525:
+   /*
+* GPIO-00 IR_WIDE
+* GPIO-02 wake#
+* GPIO-03 VAUX Pres.
+* GPIO-07 PROG#
+* GPIO-08 SAT_RESN
+* GPIO-09 TER_RESN
+* GPIO-10 B2_SENSE
+* GPIO-11 B1_SENSE
+* GPIO-15 IR_LED_STATUS
+* GPIO-19 IR_NARROW
+* GPIO-20 Blauster1
+* ALTGPIO VAUX_SWITCH
+* AUX_PLL_CLK : Blaster2
+*/
+   /* Put the parts into reset and back */
+   cx23885_gpio_enable(dev, GPIO_8 | GPIO_9, 1);
+   cx23885_gpio_clear(dev, GPIO_8 | GPIO_9);
+   msleep(100);
+   cx23885_gpio_set(dev, GPIO_8 | GPIO_9);
+   msleep(100);
+   break;
}
 }
 
@@ -1873,6 +1907,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
case CX23885_BOARD_HAUPPAUGE_HVR1290:
case CX23885_BOARD_HAUPPAUGE_HVR4400:
case CX23885_BOARD_HAUPPAUGE_IMPACTVCBE:
+   case CX23885_BOARD_HAUPPAUGE_HVR5525:
if (dev-i2c_bus[0].i2c_rc == 0)
hauppauge_eeprom(dev, eeprom+0xc0);
break;
@@ -1997,6 +2032,14 @@ void cx23885_card_setup(struct cx23885_dev *dev)
ts2-ts_clk_en_val = 0x1; /* Enable TS_CLK */
ts2-src_sel_val   = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
break;
+   case CX23885_BOARD_HAUPPAUGE_HVR5525:
+   ts1-gen_ctrl_val  = 0x5; /* Parallel */
+   ts1-ts_clk_en_val = 0x1; /* Enable TS_CLK */
+   ts1-src_sel_val   = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
+   ts2-gen_ctrl_val  = 0xc; /* Serial bus + punctured clock */
+   ts2-ts_clk_en_val = 0x1; /* Enable TS_CLK */
+   ts2-src_sel_val   = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
+   break;
case CX23885_BOARD_HAUPPAUGE_HVR1250:
case CX23885_BOARD_HAUPPAUGE_HVR1500:
case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
diff --git 

[PATCH 3/4] cx23885: fix I2C scan printout

2014-12-19 Thread Antti Palosaari
1) I2C slave addresses were printed so called 8-bit format. Use
standard 7-bit notation.

2) I2C slave address was printed with hex formatted without leading
zeros, which makes output one digit shorter in a case of address
fit to one hex digit. Use 4 char wide hex number with leading zeros
as usually used for I2C slave addresses.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/pci/cx23885/cx23885-i2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/cx23885/cx23885-i2c.c 
b/drivers/media/pci/cx23885/cx23885-i2c.c
index fd71306..1135ea3 100644
--- a/drivers/media/pci/cx23885/cx23885-i2c.c
+++ b/drivers/media/pci/cx23885/cx23885-i2c.c
@@ -300,8 +300,8 @@ static void do_i2c_scan(char *name, struct i2c_client *c)
rc = i2c_master_recv(c, buf, 0);
if (rc  0)
continue;
-   printk(KERN_INFO %s: i2c scan: found device @ 0x%x  [%s]\n,
-  name, i  1, i2c_devs[i] ? i2c_devs[i] : ???);
+   printk(KERN_INFO %s: i2c scan: found device @ 0x%04x  [%s]\n,
+  name, i, i2c_devs[i] ? i2c_devs[i] : ???);
}
 }
 
-- 
http://palosaari.fi/

--
To unsubscribe from this list: send the line unsubscribe linux-media 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] cx23885: do not unregister demod I2C client twice on error

2014-12-19 Thread Antti Palosaari
Demod I2C client should be NULL after demod is unregistered on error
path, otherwise it will be unregistered again when driver is unload.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/pci/cx23885/cx23885-dvb.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c 
b/drivers/media/pci/cx23885/cx23885-dvb.c
index c47d182..6bb7935 100644
--- a/drivers/media/pci/cx23885/cx23885-dvb.c
+++ b/drivers/media/pci/cx23885/cx23885-dvb.c
@@ -1793,12 +1793,14 @@ static int dvb_register(struct cx23885_tsport *port)
client_tuner-dev.driver == NULL) {
module_put(client_demod-dev.driver-owner);
i2c_unregister_device(client_demod);
+   port-i2c_client_demod = NULL;
goto frontend_detach;
}
if (!try_module_get(client_tuner-dev.driver-owner)) {
i2c_unregister_device(client_tuner);
module_put(client_demod-dev.driver-owner);
i2c_unregister_device(client_demod);
+   port-i2c_client_demod = NULL;
goto frontend_detach;
}
port-i2c_client_tuner = client_tuner;
@@ -1843,12 +1845,14 @@ static int dvb_register(struct cx23885_tsport *port)
client_tuner-dev.driver == NULL) {
module_put(client_demod-dev.driver-owner);
i2c_unregister_device(client_demod);
+   port-i2c_client_demod = NULL;
goto frontend_detach;
}
if (!try_module_get(client_tuner-dev.driver-owner)) {
i2c_unregister_device(client_tuner);
module_put(client_demod-dev.driver-owner);
i2c_unregister_device(client_demod);
+   port-i2c_client_demod = NULL;
goto frontend_detach;
}
port-i2c_client_tuner = client_tuner;
@@ -1989,6 +1993,7 @@ static int dvb_register(struct cx23885_tsport *port)
client_tuner-dev.driver == NULL) {
module_put(client_demod-dev.driver-owner);
i2c_unregister_device(client_demod);
+   port-i2c_client_demod = NULL;
goto frontend_detach;
}
if (!try_module_get(client_tuner-dev.driver-owner)) {
-- 
http://palosaari.fi/

--
To unsubscribe from this list: send the line unsubscribe linux-media 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] cx23885: correct some I2C client indentations

2014-12-19 Thread Antti Palosaari
These comparisons fit single line.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/pci/cx23885/cx23885-dvb.c | 21 +++--
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c 
b/drivers/media/pci/cx23885/cx23885-dvb.c
index 6bb7935..0f60bc4 100644
--- a/drivers/media/pci/cx23885/cx23885-dvb.c
+++ b/drivers/media/pci/cx23885/cx23885-dvb.c
@@ -1823,8 +1823,7 @@ static int dvb_register(struct cx23885_tsport *port)
info.platform_data = si2168_config;
request_module(info.type);
client_demod = i2c_new_device(i2c_bus-i2c_adap, info);
-   if (client_demod == NULL ||
-   client_demod-dev.driver == NULL)
+   if (client_demod == NULL || client_demod-dev.driver == NULL)
goto frontend_detach;
if (!try_module_get(client_demod-dev.driver-owner)) {
i2c_unregister_device(client_demod);
@@ -1841,8 +1840,7 @@ static int dvb_register(struct cx23885_tsport *port)
info.platform_data = si2157_config;
request_module(info.type);
client_tuner = i2c_new_device(adapter, info);
-   if (client_tuner == NULL ||
-   client_tuner-dev.driver == NULL) {
+   if (client_tuner == NULL || client_tuner-dev.driver == NULL) {
module_put(client_demod-dev.driver-owner);
i2c_unregister_device(client_demod);
port-i2c_client_demod = NULL;
@@ -1878,8 +1876,7 @@ static int dvb_register(struct cx23885_tsport *port)
info.platform_data = m88ts2022_config;
request_module(info.type);
client_tuner = i2c_new_device(adapter, info);
-   if (client_tuner == NULL ||
-   client_tuner-dev.driver == NULL)
+   if (client_tuner == NULL || client_tuner-dev.driver == NULL)
goto frontend_detach;
if (!try_module_get(client_tuner-dev.driver-owner)) {
i2c_unregister_device(client_tuner);
@@ -1925,8 +1922,7 @@ static int dvb_register(struct cx23885_tsport *port)
info.platform_data = m88ts2022_config;
request_module(info.type);
client_tuner = i2c_new_device(adapter, info);
-   if (client_tuner == NULL ||
-   client_tuner-dev.driver == NULL)
+   if (client_tuner == NULL || client_tuner-dev.driver == NULL)
goto frontend_detach;
if (!try_module_get(client_tuner-dev.driver-owner)) {
i2c_unregister_device(client_tuner);
@@ -1971,8 +1967,7 @@ static int dvb_register(struct cx23885_tsport *port)
info.platform_data = si2168_config;
request_module(info.type);
client_demod = i2c_new_device(i2c_bus-i2c_adap, info);
-   if (client_demod == NULL ||
-   client_demod-dev.driver == NULL)
+   if (client_demod == NULL || client_demod-dev.driver == NULL)
goto frontend_detach;
if (!try_module_get(client_demod-dev.driver-owner)) {
i2c_unregister_device(client_demod);
@@ -1989,8 +1984,7 @@ static int dvb_register(struct cx23885_tsport *port)
info.platform_data = si2157_config;
request_module(info.type);
client_tuner = i2c_new_device(adapter, info);
-   if (client_tuner == NULL ||
-   client_tuner-dev.driver == NULL) {
+   if (client_tuner == NULL || client_tuner-dev.driver == NULL) {
module_put(client_demod-dev.driver-owner);
i2c_unregister_device(client_demod);
port-i2c_client_demod = NULL;
@@ -2115,8 +2109,7 @@ static int dvb_register(struct cx23885_tsport *port)
info.platform_data = sp2_config;
request_module(info.type);
client_ci = i2c_new_device(i2c_bus2-i2c_adap, info);
-   if (client_ci == NULL ||
-   client_ci-dev.driver == NULL) {
+   if (client_ci == NULL || client_ci-dev.driver == NULL) {
if (client_tuner) {
module_put(client_tuner-dev.driver-owner);
i2c_unregister_device(client_tuner);
-- 
http://palosaari.fi/

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


cx23885 streaming lockdep error (VB2 related?)

2014-12-19 Thread Antti Palosaari

I see thank kind of error when I start streaming cx23885:

INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
CPU: 3 PID: 27959 Comm: dvbv5-scan Tainted: G C O   3.18.0-rc4+ #12
Hardware name: System manufacturer System Product Name/M5A78L-M/USB3, 
BIOS 200109/11/2014

  d70b2b44 880162013928 817a6f52
  88018d3cc1d0 880162013938 817a4802
 880162013a38 810e765a 8102001a 88018d3cc1d0
Call Trace:
 [817a6f52] dump_stack+0x4e/0x68
 [817a4802] register_lock_class.part.41+0x38/0x3c
 [810e765a] __lock_acquire+0x156a/0x1f50
 [8102001a] ? native_sched_clock+0x2a/0xa0
 [810e9069] lock_acquire+0xc9/0x170
 [a08f898f] ? cx23885_buf_queue+0x6f/0x150 [cx23885]
 [817b0197] _raw_spin_lock_irqsave+0x57/0xa0
 [a08f898f] ? cx23885_buf_queue+0x6f/0x150 [cx23885]
 [a08f7a79] ? cx23885_risc_databuffer+0xe9/0x160 [cx23885]
 [a08f898f] cx23885_buf_queue+0x6f/0x150 [cx23885]
 [a08f9f3c] buffer_queue+0x1c/0x20 [cx23885]
 [a08913d4] __enqueue_in_driver+0x84/0x90 [videobuf2_core]
 [a0891ee0] vb2_start_streaming+0x40/0x190 [videobuf2_core]
 [a0892269] ? __fill_v4l2_buffer+0x119/0x1a0 [videobuf2_core]
 [a0893c95] vb2_internal_streamon+0x115/0x150 [videobuf2_core]
 [a0895f91] __vb2_init_fileio+0x361/0x3e0 [videobuf2_core]
 [a08d7220] ? vb2_dvb_start_feed+0xc0/0xc0 [videobuf2_dvb]
 [a0896e6e] vb2_thread_start+0xae/0x240 [videobuf2_core]
 [a05e104f] ? dmx_section_feed_start_filtering+0x2f/0x190 
[dvb_core]

 [a08d71f0] vb2_dvb_start_feed+0x90/0xc0 [videobuf2_dvb]
 [a05e1102] dmx_section_feed_start_filtering+0xe2/0x190 
[dvb_core]

 [a05dee9e] dvb_dmxdev_filter_start+0x20e/0x3e0 [dvb_core]
 [a05dfa80] dvb_demux_do_ioctl+0x4f0/0x650 [dvb_core]
 [a05dd924] dvb_usercopy+0x124/0x1a0 [dvb_core]
 [81341a56] ? avc_has_perm+0x126/0x1f0
 [a05df590] ? dvb_dmxdev_add_pid+0xb0/0xb0 [dvb_core]
 [a05dde05] dvb_demux_ioctl+0x15/0x20 [dvb_core]
 [81245590] do_vfs_ioctl+0x2f0/0x520
 [817b12dc] ? retint_swapgs+0x13/0x1b
 [81245841] SyS_ioctl+0x81/0xa0
 [817b06a9] system_call_fastpath+0x12/0x17

any idea why?

regards
Antti

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


[PATCH] media: Kconfig: drop duplicate dependency of HAS_DMA

2014-12-19 Thread Lad, Prabhakar
this patch drops duplicate dependency of HAS_DMA from
VIDEO_SH_VEU.

Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 drivers/media/platform/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index dba29b8..dac316d 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -213,7 +213,6 @@ config VIDEO_SAMSUNG_EXYNOS_GSC
 config VIDEO_SH_VEU
tristate SuperH VEU mem2mem video processing driver
depends on VIDEO_DEV  VIDEO_V4L2  HAS_DMA
-   depends on HAS_DMA
select VIDEOBUF2_DMA_CONTIG
select V4L2_MEM2MEM_DEV
help
-- 
1.9.1

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


Re: coda: Unable to use encoder video_bitrate

2014-12-19 Thread Philipp Zabel
Hi Jean-Michel,

Am Donnerstag, den 18.12.2014, 18:10 +0100 schrieb Jean-Michel Hautbois:
  Sorry, forgot to put all of you on Cc: for the [media] coda: fix
  encoder rate control parameter masks patch. The coda driver is in
  drivers/media/platform/coda, register definitions in coda_regs.h.
  The CODA_RATECONTROL_BITRATE_MASK is 0x7f, but it should be 0x7fff.
 
 
 Well, I meant, the datasheet of the CODA960 because we don't know,
 just by reading the coda_regs.h which register is where and does what.

I wish. If you search for cnm-codadx6-datasheet-v2.9.pdf with a search
engine of your choice, on chipsnmedia.com you can get documentation for
the very oldest coda version supported by the driver. That's all I have
in addition to the old GPLed Freescale imx-vpu-lib for reference.

regards
Philipp

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


Re: coda: Unable to use encoder video_bitrate

2014-12-19 Thread Jean-Michel Hautbois
2014-12-19 11:28 GMT+01:00 Philipp Zabel p.za...@pengutronix.de:
 Hi Jean-Michel,

 Am Donnerstag, den 18.12.2014, 18:10 +0100 schrieb Jean-Michel Hautbois:
  Sorry, forgot to put all of you on Cc: for the [media] coda: fix
  encoder rate control parameter masks patch. The coda driver is in
  drivers/media/platform/coda, register definitions in coda_regs.h.
  The CODA_RATECONTROL_BITRATE_MASK is 0x7f, but it should be 0x7fff.
 

 Well, I meant, the datasheet of the CODA960 because we don't know,
 just by reading the coda_regs.h which register is where and does what.

 I wish. If you search for cnm-codadx6-datasheet-v2.9.pdf with a search
 engine of your choice, on chipsnmedia.com you can get documentation for
 the very oldest coda version supported by the driver. That's all I have
 in addition to the old GPLed Freescale imx-vpu-lib for reference.

Uh, ok, didn't think about this. Thx a lot !
JM
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] coda: use VB2_FILEIO_ALLOW_ZERO_BYTESUSED flag

2014-12-19 Thread Kamil Debski
The coda driver interprets a buffer with bytesused equal to 0 as a special
case indicating end-of-stream. After vb2: fix bytesused == 0 handling
(8a75ffb) patch videobuf2 modified the value of bytesused if it was 0.
The VB2_FILEIO_ALLOW_ZERO_BYTESUSED flag was added to videobuf2 to keep
backward compatibility.

Signed-off-by: Kamil Debski k.deb...@samsung.com
---
 drivers/media/platform/coda/coda-common.c |7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/media/platform/coda/coda-common.c 
b/drivers/media/platform/coda/coda-common.c
index 42b4630..6c67e6d 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -1491,6 +1491,13 @@ static int coda_queue_init(struct coda_ctx *ctx, struct 
vb2_queue *vq)
vq-buf_struct_size = sizeof(struct v4l2_m2m_buffer);
vq-timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
vq-lock = ctx-dev-dev_mutex;
+   /* One of means to indicate end-of-stream for coda is to set the
+* bytesused == 0. However by default videobuf2 handles videobuf
+* equal to 0 as a special case and changes its value to the size
+* of the buffer. Set the VB2_FILEIO_ALLOW_ZERO_BYTESUSED flag, so
+* that videobuf2 will keep the value of bytesused intact.
+*/
+   vq-io_flags = VB2_FILEIO_ALLOW_ZERO_BYTESUSED;
 
return vb2_queue_init(vq);
 }
-- 
1.7.9.5

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


[GIT PULL FOR v3.20] cx25821: convert to vb2

2014-12-19 Thread Hans Verkuil
This pull request converts this driver to the vb2 framework.

I have tested video capture with my cx25821 board. Audio capture
DMA works as well, but since my board doesn't have an audio line-in
I couldn't test it with actual audio.

This patch series also removes the last case of btcx-risc abuse, so
that module can now be merged again with bttv, which is where it
belongs.

Regards,

Hans

The following changes since commit 427ae153c65ad7a08288d86baf99000569627d03:

  [media] bq/c-qcam, w9966, pms: move to staging in preparation for removal 
(2014-12-16 23:21:44 -0200)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git for-v3.20d

for you to fetch changes up to 0b3b8440e1a9ce7a77c0dba6a3deb7980b0e1dc5:

  cx25821: remove video output support (2014-12-19 11:42:08 +0100)


Hans Verkuil (7):
  cx25821: remove bogus btcx_risc dependency
  cx231xx: remove btcx_riscmem reference
  btcx-risc: move to bt8xx
  cx28521: drop videobuf abuse in cx25821-alsa
  cx25821: convert to vb2
  cx25821: add create_bufs support
  cx25821: remove video output support

 drivers/media/common/Kconfig|   4 -
 drivers/media/common/Makefile   |   1 -
 drivers/media/pci/bt8xx/Kconfig |   1 -
 drivers/media/pci/bt8xx/Makefile|   2 +-
 drivers/media/{common = pci/bt8xx}/btcx-risc.c |  36 +---
 drivers/media/{common = pci/bt8xx}/btcx-risc.h |   8 -
 drivers/media/pci/cx25821/Kconfig   |   3 +-
 drivers/media/pci/cx25821/Makefile  |   3 +-
 drivers/media/pci/cx25821/cx25821-alsa.c| 113 --
 drivers/media/pci/cx25821/cx25821-core.c| 112 +-
 drivers/media/pci/cx25821/cx25821-video.c   | 685 
-
 drivers/media/pci/cx25821/cx25821.h |  48 +++--
 drivers/media/usb/cx231xx/cx231xx.h |  10 +-
 13 files changed, 368 insertions(+), 658 deletions(-)
 rename drivers/media/{common = pci/bt8xx}/btcx-risc.c (90%)
 rename drivers/media/{common = pci/bt8xx}/btcx-risc.h (92%)
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] regmap: pass map name to lockdep

2014-12-19 Thread Antti Palosaari

On 12/18/2014 11:34 PM, Lars-Peter Clausen wrote:

On 12/18/2014 10:05 PM, Antti Palosaari wrote:

lockdep complains recursive locking and deadlock when two different
regmap instances are called in a nested order. That happen easily
for example when both I2C client and muxed/repeater I2C adapter are
using regmap. As a solution, pass regmap name for lockdep in order
to force lockdep validate regmap mutex per driver - not as all regmap
instances grouped together.


That's not how it works. Locks are grouped by lock class, the name is
just for pretty printing. The only reason you do not get a warning
anymore is because you have now different lock classes one for configs
with a name and one for configs without a name.

You really need a way to specify a custom lock class per regmap instance
in order to solve this problem.


I looked example for that solution from v4l controls. So it is also wrong?

https://patchwork.linuxtv.org/patch/17262/


Do you think I should change to mutex_lock_nested() as documented in
Documentation/locking/lockdep-design.txt ?

Should these macros used at all:
include/linux/lockdep.h

There is not much documentation, especially how these recursive lock 
warnings should be silenced.



regards
Antti
--
http://palosaari.fi/
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] [media] videobuf-dma-contig: NULL check for vb2_plane_cookie

2014-12-19 Thread Hans Verkuil
Hi Nikhil,

On 12/11/2014 03:56 PM, Sakari Ailus wrote:
 Hi Nikhil,
 
 On Thu, Dec 11, 2014 at 06:37:22PM +0530, Nikhil Devshatwar wrote:
 vb2_plane_cookie can return NULL if the plane no is greater than
 total no of planes or when mem_ops are absent.

 Add NULL check to avoid NULL pointer crash in the kernel.

 Signed-off-by: Nikhil Devshatwar nikhil...@ti.com
 ---
  include/media/videobuf2-dma-contig.h |5 -
  1 file changed, 4 insertions(+), 1 deletion(-)

 diff --git a/include/media/videobuf2-dma-contig.h 
 b/include/media/videobuf2-dma-contig.h
 index 8197f87..5efc56e 100644
 --- a/include/media/videobuf2-dma-contig.h
 +++ b/include/media/videobuf2-dma-contig.h
 @@ -21,7 +21,10 @@ vb2_dma_contig_plane_dma_addr(struct vb2_buffer *vb, 
 unsigned int plane_no)
  {
  dma_addr_t *addr = vb2_plane_cookie(vb, plane_no);
  
 -return *addr;
 +if (addr == NULL)
 +return addr;
 +else
 +return *addr;

How about:

return addr ? *addr : NULL;

Much better.

  }
  
  void *vb2_dma_contig_init_ctx(struct device *dev);
 
 Should this happen? Wouldn't it be a bug somewhere, quite possibly the driver?
 

I agree with Sakari: could this ever happen in practice unless it is a driver 
bug?

If you can provide an example, then that would help.

Regards,

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


Re: [PATCH] media: ti-vpe: Use mem-to-mem ioctl helpers

2014-12-19 Thread Hans Verkuil
Hi Prabhakar,

I haven't seen any movement with Nikhil's patches, so it is probably better if
you just post a new version of this patch based on the latest media_tree.

This patch no longer applies cleanly.

Regards,

Hans

On 12/01/2014 12:23 PM, Hans Verkuil wrote:
 On 11/18/2014 02:00 PM, Lad, Prabhakar wrote:
 This patch does the following:

 1: Simplify the vpe mem-to-mem driver by using the m2m ioctl
and vb2 helpers.
 2: Minor code cleanup
 
 FYI: I want to postpone this patch until Nikhil's ti-vpe changes are in 
 (assuming
 that will happen soon). I think his series conflicts with this, and it is 
 likely
 to be easier for you to rebase once his code is in.
 
 Regards,
 
   Hans
 

 Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
 ---
  drivers/media/platform/ti-vpe/vpe.c | 152 
 +++-
  1 file changed, 47 insertions(+), 105 deletions(-)

 diff --git a/drivers/media/platform/ti-vpe/vpe.c 
 b/drivers/media/platform/ti-vpe/vpe.c
 index 74b858d..faf38d4 100644
 --- a/drivers/media/platform/ti-vpe/vpe.c
 +++ b/drivers/media/platform/ti-vpe/vpe.c
 @@ -21,6 +21,7 @@
  #include linux/dma-mapping.h
  #include linux/err.h
  #include linux/fs.h
 +#include linux/of.h
  #include linux/interrupt.h
  #include linux/io.h
  #include linux/ioctl.h
 @@ -377,7 +378,6 @@ struct vpe_dev {
  struct vpe_ctx {
  struct v4l2_fh  fh;
  struct vpe_dev  *dev;
 -struct v4l2_m2m_ctx *m2m_ctx;
  struct v4l2_ctrl_handler hdl;
  
  unsigned intfield;  /* current field */
 @@ -916,8 +916,8 @@ static int job_ready(void *priv)
   * When called by m2m framework, this will always satisy, but when
   * called from vpe_irq, this might fail. (src stream with zero buffers)
   */
 -if (v4l2_m2m_num_src_bufs_ready(ctx-m2m_ctx) = 0 ||
 -v4l2_m2m_num_dst_bufs_ready(ctx-m2m_ctx) = 0)
 +if (v4l2_m2m_num_src_bufs_ready(ctx-fh.m2m_ctx) = 0 ||
 +v4l2_m2m_num_dst_bufs_ready(ctx-fh.m2m_ctx) = 0)
  return 0;
  
  return 1;
 @@ -1155,14 +1155,14 @@ static void device_run(void *priv)
   * in the same buffer. (so that job_ready won't fail)
   * It will be removed when using bottom field
   */
 -ctx-src_vbs[0] = v4l2_m2m_next_src_buf(ctx-m2m_ctx);
 +ctx-src_vbs[0] = v4l2_m2m_next_src_buf(ctx-fh.m2m_ctx);
  WARN_ON(ctx-src_vbs[0] == NULL);
  } else {
 -ctx-src_vbs[0] = v4l2_m2m_src_buf_remove(ctx-m2m_ctx);
 +ctx-src_vbs[0] = v4l2_m2m_src_buf_remove(ctx-fh.m2m_ctx);
  WARN_ON(ctx-src_vbs[0] == NULL);
  }
  
 -ctx-dst_vb = v4l2_m2m_dst_buf_remove(ctx-m2m_ctx);
 +ctx-dst_vb = v4l2_m2m_dst_buf_remove(ctx-fh.m2m_ctx);
  WARN_ON(ctx-dst_vb == NULL);
  
  if (ctx-deinterlacing) {
 @@ -1422,7 +1422,7 @@ static irqreturn_t vpe_irq(int irq_vpe, void *data)
  finished:
  vpe_dbg(ctx-dev, finishing transaction\n);
  ctx-bufs_completed = 0;
 -v4l2_m2m_job_finish(dev-m2m_dev, ctx-m2m_ctx);
 +v4l2_m2m_job_finish(dev-m2m_dev, ctx-fh.m2m_ctx);
  handled:
  return IRQ_HANDLED;
  }
 @@ -1483,7 +1483,7 @@ static int vpe_g_fmt(struct file *file, void *priv, 
 struct v4l2_format *f)
  struct vpe_q_data *q_data;
  int i;
  
 -vq = v4l2_m2m_get_vq(ctx-m2m_ctx, f-type);
 +vq = v4l2_m2m_get_vq(ctx-fh.m2m_ctx, f-type);
  if (!vq)
  return -EINVAL;
  
 @@ -1624,7 +1624,7 @@ static int __vpe_s_fmt(struct vpe_ctx *ctx, struct 
 v4l2_format *f)
  struct vb2_queue *vq;
  int i;
  
 -vq = v4l2_m2m_get_vq(ctx-m2m_ctx, f-type);
 +vq = v4l2_m2m_get_vq(ctx-fh.m2m_ctx, f-type);
  if (!vq)
  return -EINVAL;
  
 @@ -1852,55 +1852,6 @@ static int vpe_s_selection(struct file *file, void 
 *fh,
  return set_srcdst_params(ctx);
  }
  
 -static int vpe_reqbufs(struct file *file, void *priv,
 -   struct v4l2_requestbuffers *reqbufs)
 -{
 -struct vpe_ctx *ctx = file2ctx(file);
 -
 -return v4l2_m2m_reqbufs(file, ctx-m2m_ctx, reqbufs);
 -}
 -
 -static int vpe_querybuf(struct file *file, void *priv, struct v4l2_buffer 
 *buf)
 -{
 -struct vpe_ctx *ctx = file2ctx(file);
 -
 -return v4l2_m2m_querybuf(file, ctx-m2m_ctx, buf);
 -}
 -
 -static int vpe_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
 -{
 -struct vpe_ctx *ctx = file2ctx(file);
 -
 -return v4l2_m2m_qbuf(file, ctx-m2m_ctx, buf);
 -}
 -
 -static int vpe_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
 -{
 -struct vpe_ctx *ctx = file2ctx(file);
 -
 -return v4l2_m2m_dqbuf(file, ctx-m2m_ctx, buf);
 -}
 -
 -static int vpe_streamon(struct file *file, void *priv, enum v4l2_buf_type 
 type)
 -{
 -struct vpe_ctx *ctx = file2ctx(file);
 -
 -if (ctx-deinterlacing)
 -config_edi_input_mode(ctx, 0x0);
 -
 -return v4l2_m2m_streamon(file, ctx-m2m_ctx, type);
 -}
 -
 

[GIT PULL FOR v3.20] Various fixes/improvements

2014-12-19 Thread Hans Verkuil
The following changes since commit 427ae153c65ad7a08288d86baf99000569627d03:

  [media] bq/c-qcam, w9966, pms: move to staging in preparation for removal 
(2014-12-16 23:21:44 -0200)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git for-v3.20c

for you to fetch changes up to db15c959f68f77b743a214a63a3c3d235feb5bd7:

  VIDEO_CAFE_CCIC should select VIDEOBUF2_DMA_SG (2014-12-19 12:09:26 +0100)


Andrey Utkin (1):
  solo6x10: just pass frame motion flag from hardware, drop additional 
handling as complicated and unstable

Geert Uytterhoeven (1):
  VIDEO_CAFE_CCIC should select VIDEOBUF2_DMA_SG

Hans Verkuil (12):
  media: drivers shouldn't touch debug field in video_device
  v4l2 core: improve debug flag handling
  v4l2-framework.txt: document debug attribute
  av7110: fix sparse warning
  budget-core: fix sparse warnings
  ivtv: fix sparse warning
  videobuf2-vmalloc: fix sparse warning
  hd29l2: fix sparse error and warnings
  m5mols: fix sparse warnings
  s5k4ecgx: fix sparse warnings
  s5k6aa: fix sparse warnings
  s5k5baf: fix sparse warnings

Shuah Khan (1):
  media: au0828 VBI support comment cleanup

 Documentation/video4linux/v4l2-framework.txt| 25 --
 drivers/media/dvb-frontends/hd29l2.c| 10 ---
 drivers/media/i2c/m5mols/m5mols_core.c  |  9 ++-
 drivers/media/i2c/s5k4ecgx.c| 11 
 drivers/media/i2c/s5k5baf.c | 13 -
 drivers/media/i2c/s5k6aa.c  |  2 +-
 drivers/media/pci/bt8xx/bttv-driver.c   |  1 -
 drivers/media/pci/cx88/cx88-blackbird.c |  3 ---
 drivers/media/pci/ivtv/ivtv-irq.c   | 22 +---
 drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c  | 30 +
 drivers/media/pci/solo6x10/solo6x10.h   |  2 --
 drivers/media/pci/ttpci/av7110.c|  5 +++-
 drivers/media/pci/ttpci/budget-core.c   | 89 
++
 drivers/media/platform/marvell-ccic/Kconfig |  1 +
 drivers/media/platform/marvell-ccic/mcam-core.c |  1 -
 drivers/media/usb/au0828/au0828-video.c |  1 -
 drivers/media/usb/cx231xx/cx231xx-video.c   |  1 -
 drivers/media/usb/em28xx/em28xx-video.c |  1 -
 drivers/media/usb/stk1160/stk1160-v4l.c |  5 
 drivers/media/usb/stkwebcam/stk-webcam.c|  1 -
 drivers/media/usb/tm6000/tm6000-video.c |  3 +--
 drivers/media/usb/zr364xx/zr364xx.c |  2 --
 drivers/media/v4l2-core/v4l2-dev.c  | 28 +++-
 drivers/media/v4l2-core/v4l2-ioctl.c| 10 ---
 drivers/media/v4l2-core/videobuf2-vmalloc.c |  4 +--
 drivers/staging/media/tlg2300/pd-common.h   |  1 -
 drivers/staging/media/tlg2300/pd-radio.c|  3 ---
 drivers/staging/media/tlg2300/pd-video.c| 10 ---
 include/media/v4l2-dev.h|  3 ++-
 include/media/v4l2-ioctl.h  | 15 ---
 30 files changed, 152 insertions(+), 160 deletions(-)
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] media: ti-vpe: Use mem-to-mem ioctl helpers

2014-12-19 Thread Prabhakar Lad
Hi Hans,

On Fri, Dec 19, 2014 at 4:42 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 Hi Prabhakar,

 I haven't seen any movement with Nikhil's patches, so it is probably better if
 you just post a new version of this patch based on the latest media_tree.

I was about to do that, as I was not able to utilize my holidays
in proper way :D

Thanks,
--Prabhakar Lad
--
To unsubscribe from this list: send the line unsubscribe linux-media 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 3/8] v4l2-subdev: drop unused op enum_mbus_fmt

2014-12-19 Thread Hans Verkuil


On 12/18/2014 11:08 PM, Guennadi Liakhovetski wrote:
 Hi Hans,
 
 On Thu, 4 Dec 2014, Hans Verkuil wrote:
 
 From: Hans Verkuil hans.verk...@cisco.com

 Weird, this op isn't used at all. Seems to be orphaned code.
 Remove it.

 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 ---
  include/media/v4l2-subdev.h | 2 --
  1 file changed, 2 deletions(-)

 diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
 index b052184..5beeb87 100644
 --- a/include/media/v4l2-subdev.h
 +++ b/include/media/v4l2-subdev.h
 @@ -342,8 +342,6 @@ struct v4l2_subdev_video_ops {
  struct v4l2_dv_timings *timings);
  int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index,
   u32 *code);
 -int (*enum_mbus_fsizes)(struct v4l2_subdev *sd,
 - struct v4l2_frmsizeenum *fsize);
 
 After so many cheerful acks I feel a bit bluffed, but... Your subject says 
 drop enum_mbus_fmt and your patch drops enum_mbus_fsizes... What am I 
 missing??

Oops. Obviously the function name in the subject is wrong.

Interesting that everyone (except you!) just read over that :-)

Regards,

Hans

 
 Thanks
 Guennadi
 
  int (*g_mbus_fmt)(struct v4l2_subdev *sd,
struct v4l2_mbus_framefmt *fmt);
  int (*try_mbus_fmt)(struct v4l2_subdev *sd,
 -- 
 2.1.3

 --
 To unsubscribe from this list: send the line unsubscribe linux-media in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 
--
To unsubscribe from this list: send the line unsubscribe linux-media 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 5/8] media/i2c/Kconfig: drop superfluous MEDIA_CONTROLLER

2014-12-19 Thread Hans Verkuil


On 12/08/2014 12:38 AM, Laurent Pinchart wrote:
 Hi Hans,
 
 Thank you for the patch.
 
 On Thursday 04 December 2014 10:54:56 Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com

 These drivers depend on VIDEO_V4L2_SUBDEV_API, which in turn
 depends on MEDIA_CONTROLLER. So it is sufficient to just depend
 on VIDEO_V4L2_SUBDEV_API.
 
 Shouldn't the VIDEO_V4L2_SUBDEV_API dependency be dropped from those (and 
 other) subdev drivers ? They don't require the userspace API, just the kernel 
 part.

They set V4L2_SUBDEV_FL_HAS_DEVNODE and use v4l2_subdev_get_try_format,
so they do need VIDEO_V4L2_SUBDEV_API. Or am I missing something?

Regards,

Hans

 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 ---
  drivers/media/i2c/Kconfig | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

 diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
 index f40b4cf..29276fd 100644
 --- a/drivers/media/i2c/Kconfig
 +++ b/drivers/media/i2c/Kconfig
 @@ -196,7 +196,7 @@ config VIDEO_ADV7183

  config VIDEO_ADV7604
  tristate Analog Devices ADV7604 decoder
 -depends on VIDEO_V4L2  I2C  VIDEO_V4L2_SUBDEV_API  
 MEDIA_CONTROLLER
 +depends on VIDEO_V4L2  I2C  VIDEO_V4L2_SUBDEV_API
  ---help---
Support for the Analog Devices ADV7604 video decoder.

 @@ -208,7 +208,7 @@ config VIDEO_ADV7604

  config VIDEO_ADV7842
  tristate Analog Devices ADV7842 decoder
 -depends on VIDEO_V4L2  I2C  VIDEO_V4L2_SUBDEV_API  
 MEDIA_CONTROLLER
 +depends on VIDEO_V4L2  I2C  VIDEO_V4L2_SUBDEV_API
  ---help---
Support for the Analog Devices ADV7842 video decoder.

 @@ -431,7 +431,7 @@ config VIDEO_ADV7393

  config VIDEO_ADV7511
  tristate Analog Devices ADV7511 encoder
 -depends on VIDEO_V4L2  I2C  VIDEO_V4L2_SUBDEV_API  
 MEDIA_CONTROLLER
 +depends on VIDEO_V4L2  I2C  VIDEO_V4L2_SUBDEV_API
  ---help---
Support for the Analog Devices ADV7511 video encoder.
 
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv2 2/3] hdmi: added unpack and logging functions for InfoFrames

2014-12-19 Thread Hans Verkuil
Hi Thierry,

On 12/18/2014 09:19 AM, Thierry Reding wrote:
 +static int hdmi_avi_infoframe_unpack(struct hdmi_avi_infoframe *frame,
 + void *buffer)
 +{
 +u8 *ptr = buffer;
 +int ret;
 +
 +if (ptr[0] != HDMI_INFOFRAME_TYPE_AVI ||
 +ptr[1] != 2 ||
 +ptr[2] != HDMI_AVI_INFOFRAME_SIZE)
 +return -EINVAL;
 +
 +if (hdmi_infoframe_checksum(buffer, HDMI_INFOFRAME_SIZE(AVI)) != 0)
 
 You use the parameterized HDMI_INFOFRAME_SIZE() here, but the plain
 macro above. Perhaps make those consistent?

I'm not sure what you mean here since HDMI_AVI_INFOFRAME_SIZE != 
HDMI_INFOFRAME_SIZE(AVI).
The latter includes the infoframe header size.

I'm assuming you missed that. If not, then please clarify.

Regards,

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


[PATCHv3 0/3] hdmi: add unpack and logging functions

2014-12-19 Thread Hans Verkuil
This patch series adds new HDMI 2.0/CEA-861-F defines to hdmi.h and
adds unpacking and logging functions to hdmi.c. It also uses those
in the V4L2 adv7842 driver (and they will be used in other HDMI drivers
once this functionality is merged).

Changes since v2:
- Applied most comments from Thierry's review
- Renamed HDMI_AUDIO_CODING_TYPE_EXT_STREAM as per Thierry's suggestion.

Thierry, if this OK, then please give your Ack and I'll post a pull
request for 3.20 for the media git tree.

Regards,

Hans

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


[PATCHv3 1/4] hdmi: add new HDMI 2.0 defines

2014-12-19 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Add new Video InfoFrame colorspace information introduced in HDMI 2.0
and new Audio Coding Extension Types, also from HDMI 2.0.

HDMI_CONTENT_TYPE_NONE was renamed to _GRAPHICS since that's what
it is called in CEA-861-F.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Reviewed-by: Thierry Reding tred...@nvidia.com
---
 include/linux/hdmi.h | 30 +-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
index 11c0182..a4aa0c2 100644
--- a/include/linux/hdmi.h
+++ b/include/linux/hdmi.h
@@ -37,12 +37,18 @@ enum hdmi_colorspace {
HDMI_COLORSPACE_RGB,
HDMI_COLORSPACE_YUV422,
HDMI_COLORSPACE_YUV444,
+   HDMI_COLORSPACE_YUV420,
+   HDMI_COLORSPACE_RESERVED4,
+   HDMI_COLORSPACE_RESERVED5,
+   HDMI_COLORSPACE_RESERVED6,
+   HDMI_COLORSPACE_IDO_DEFINED,
 };
 
 enum hdmi_scan_mode {
HDMI_SCAN_MODE_NONE,
HDMI_SCAN_MODE_OVERSCAN,
HDMI_SCAN_MODE_UNDERSCAN,
+   HDMI_SCAN_MODE_RESERVED,
 };
 
 enum hdmi_colorimetry {
@@ -56,6 +62,7 @@ enum hdmi_picture_aspect {
HDMI_PICTURE_ASPECT_NONE,
HDMI_PICTURE_ASPECT_4_3,
HDMI_PICTURE_ASPECT_16_9,
+   HDMI_PICTURE_ASPECT_RESERVED,
 };
 
 enum hdmi_active_aspect {
@@ -77,12 +84,18 @@ enum hdmi_extended_colorimetry {
HDMI_EXTENDED_COLORIMETRY_S_YCC_601,
HDMI_EXTENDED_COLORIMETRY_ADOBE_YCC_601,
HDMI_EXTENDED_COLORIMETRY_ADOBE_RGB,
+
+   /* The following EC values are only defined in CEA-861-F. */
+   HDMI_EXTENDED_COLORIMETRY_BT2020_CONST_LUM,
+   HDMI_EXTENDED_COLORIMETRY_BT2020,
+   HDMI_EXTENDED_COLORIMETRY_RESERVED,
 };
 
 enum hdmi_quantization_range {
HDMI_QUANTIZATION_RANGE_DEFAULT,
HDMI_QUANTIZATION_RANGE_LIMITED,
HDMI_QUANTIZATION_RANGE_FULL,
+   HDMI_QUANTIZATION_RANGE_RESERVED,
 };
 
 /* non-uniform picture scaling */
@@ -99,7 +112,7 @@ enum hdmi_ycc_quantization_range {
 };
 
 enum hdmi_content_type {
-   HDMI_CONTENT_TYPE_NONE,
+   HDMI_CONTENT_TYPE_GRAPHICS,
HDMI_CONTENT_TYPE_PHOTO,
HDMI_CONTENT_TYPE_CINEMA,
HDMI_CONTENT_TYPE_GAME,
@@ -179,6 +192,7 @@ enum hdmi_audio_coding_type {
HDMI_AUDIO_CODING_TYPE_MLP,
HDMI_AUDIO_CODING_TYPE_DST,
HDMI_AUDIO_CODING_TYPE_WMA_PRO,
+   HDMI_AUDIO_CODING_TYPE_CXT,
 };
 
 enum hdmi_audio_sample_size {
@@ -201,9 +215,23 @@ enum hdmi_audio_sample_frequency {
 
 enum hdmi_audio_coding_type_ext {
HDMI_AUDIO_CODING_TYPE_EXT_STREAM,
+
+   /*
+* The next three CXT values are defined in CEA-861-E only.
+* They do not exist in older versions, and in CEA-861-F they are
+* defined as 'Not in use'.
+*/
HDMI_AUDIO_CODING_TYPE_EXT_HE_AAC,
HDMI_AUDIO_CODING_TYPE_EXT_HE_AAC_V2,
HDMI_AUDIO_CODING_TYPE_EXT_MPEG_SURROUND,
+
+   /* The following CXT values are only defined in CEA-861-F. */
+   HDMI_AUDIO_CODING_TYPE_EXT_MPEG4_HE_AAC,
+   HDMI_AUDIO_CODING_TYPE_EXT_MPEG4_HE_AAC_V2,
+   HDMI_AUDIO_CODING_TYPE_EXT_MPEG4_AAC_LC,
+   HDMI_AUDIO_CODING_TYPE_EXT_DRA,
+   HDMI_AUDIO_CODING_TYPE_EXT_MPEG4_HE_AAC_SURROUND,
+   HDMI_AUDIO_CODING_TYPE_EXT_MPEG4_AAC_LC_SURROUND = 10,
 };
 
 struct hdmi_audio_infoframe {
-- 
2.1.3

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


[PATCHv3 2/4] hdmi: added unpack and logging functions for InfoFrames

2014-12-19 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

When receiving video it is very useful to be able to unpack the InfoFrames.
Logging is useful as well, both for transmitters and receivers.

Especially when implementing the VIDIOC_LOG_STATUS ioctl (supported by many
V4L2 drivers) for a receiver it is important to be able to easily log what
the InfoFrame contains. This greatly simplifies debugging.

Signed-off-by: Martin Bugge marbu...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/video/hdmi.c | 822 ++-
 include/linux/hdmi.h |   4 +
 2 files changed, 819 insertions(+), 7 deletions(-)

diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
index 9e758a8..a7c6ae4 100644
--- a/drivers/video/hdmi.c
+++ b/drivers/video/hdmi.c
@@ -27,10 +27,12 @@
 #include linux/export.h
 #include linux/hdmi.h
 #include linux/string.h
+#include linux/device.h
 
-static void hdmi_infoframe_checksum(void *buffer, size_t size)
+#define hdmi_log(fmt, ...) dev_printk(level, dev, fmt, ##__VA_ARGS__)
+
+static u8 hdmi_infoframe_checksum(u8 *ptr, size_t size)
 {
-   u8 *ptr = buffer;
u8 csum = 0;
size_t i;
 
@@ -38,7 +40,14 @@ static void hdmi_infoframe_checksum(void *buffer, size_t 
size)
for (i = 0; i  size; i++)
csum += ptr[i];
 
-   ptr[3] = 256 - csum;
+   return 256 - csum;
+}
+
+static void hdmi_infoframe_set_checksum(void *buffer, size_t size)
+{
+   u8 *ptr = buffer;
+
+   ptr[3] = hdmi_infoframe_checksum(buffer, size);
 }
 
 /**
@@ -136,7 +145,7 @@ ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe 
*frame, void *buffer,
ptr[11] = frame-right_bar  0xff;
ptr[12] = (frame-right_bar  8)  0xff;
 
-   hdmi_infoframe_checksum(buffer, length);
+   hdmi_infoframe_set_checksum(buffer, length);
 
return length;
 }
@@ -206,7 +215,7 @@ ssize_t hdmi_spd_infoframe_pack(struct hdmi_spd_infoframe 
*frame, void *buffer,
 
ptr[24] = frame-sdi;
 
-   hdmi_infoframe_checksum(buffer, length);
+   hdmi_infoframe_set_checksum(buffer, length);
 
return length;
 }
@@ -281,7 +290,7 @@ ssize_t hdmi_audio_infoframe_pack(struct 
hdmi_audio_infoframe *frame,
if (frame-downmix_inhibit)
ptr[4] |= BIT(7);
 
-   hdmi_infoframe_checksum(buffer, length);
+   hdmi_infoframe_set_checksum(buffer, length);
 
return length;
 }
@@ -373,7 +382,7 @@ ssize_t hdmi_vendor_infoframe_pack(struct 
hdmi_vendor_infoframe *frame,
ptr[9] = (frame-s3d_ext_data  0xf)  4;
}
 
-   hdmi_infoframe_checksum(buffer, length);
+   hdmi_infoframe_set_checksum(buffer, length);
 
return length;
 }
@@ -434,3 +443,802 @@ hdmi_infoframe_pack(union hdmi_infoframe *frame, void 
*buffer, size_t size)
return length;
 }
 EXPORT_SYMBOL(hdmi_infoframe_pack);
+
+static const char *hdmi_infoframe_type_get_name(enum hdmi_infoframe_type type)
+{
+   if (type  0x80 || type  0x9f)
+   return Invalid;
+   switch (type) {
+   case HDMI_INFOFRAME_TYPE_VENDOR:
+   return Vendor;
+   case HDMI_INFOFRAME_TYPE_AVI:
+   return Auxiliary Video Information (AVI);
+   case HDMI_INFOFRAME_TYPE_SPD:
+   return Source Product Description (SPD);
+   case HDMI_INFOFRAME_TYPE_AUDIO:
+   return Audio;
+   }
+   return Reserved;
+}
+
+static void hdmi_infoframe_log_header(const char *level,
+ struct device *dev,
+ struct hdmi_any_infoframe *frame)
+{
+   hdmi_log(HDMI infoframe: %s, version %u, length %u\n,
+   hdmi_infoframe_type_get_name(frame-type),
+   frame-version, frame-length);
+}
+
+static const char *hdmi_colorspace_get_name(enum hdmi_colorspace colorspace)
+{
+   switch (colorspace) {
+   case HDMI_COLORSPACE_RGB:
+   return RGB;
+   case HDMI_COLORSPACE_YUV422:
+   return YCbCr 4:2:2;
+   case HDMI_COLORSPACE_YUV444:
+   return YCbCr 4:4:4;
+   case HDMI_COLORSPACE_YUV420:
+   return YCbCr 4:2:0;
+   case HDMI_COLORSPACE_RESERVED4:
+   return Reserved (4);
+   case HDMI_COLORSPACE_RESERVED5:
+   return Reserved (5);
+   case HDMI_COLORSPACE_RESERVED6:
+   return Reserved (6);
+   case HDMI_COLORSPACE_IDO_DEFINED:
+   return IDO Defined;
+   }
+   return Invalid;
+}
+
+static const char *hdmi_scan_mode_get_name(enum hdmi_scan_mode scan_mode)
+{
+   switch (scan_mode) {
+   case HDMI_SCAN_MODE_NONE:
+   return No Data;
+   case HDMI_SCAN_MODE_OVERSCAN:
+   return Overscan;
+   case HDMI_SCAN_MODE_UNDERSCAN:
+   return Underscan;
+   case HDMI_SCAN_MODE_RESERVED:
+   return Reserved;
+   }
+   return Invalid;
+}
+
+static const char 

[PATCHv3 3/4] hdmi: rename HDMI_AUDIO_CODING_TYPE_EXT_STREAM to _EXT_CT

2014-12-19 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

As per the suggestion of Thierry Reding rename
HDMI_AUDIO_CODING_TYPE_EXT_STREAM to HDMI_AUDIO_CODING_TYPE_EXT_CT to
be consistent with the CEA-861 spec.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/video/hdmi.c | 2 +-
 include/linux/hdmi.h | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
index a7c6ae4..1626892 100644
--- a/drivers/video/hdmi.c
+++ b/drivers/video/hdmi.c
@@ -842,7 +842,7 @@ hdmi_audio_coding_type_ext_get_name(enum 
hdmi_audio_coding_type_ext ctx)
return Invalid;
 
switch (ctx) {
-   case HDMI_AUDIO_CODING_TYPE_EXT_STREAM:
+   case HDMI_AUDIO_CODING_TYPE_EXT_CT:
return Refer to CT;
case HDMI_AUDIO_CODING_TYPE_EXT_HE_AAC:
return HE AAC;
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
index d6dea20..d70a457 100644
--- a/include/linux/hdmi.h
+++ b/include/linux/hdmi.h
@@ -215,7 +215,8 @@ enum hdmi_audio_sample_frequency {
 };
 
 enum hdmi_audio_coding_type_ext {
-   HDMI_AUDIO_CODING_TYPE_EXT_STREAM,
+   /* Refer to Audio Coding Type (CT) field in Data Byte 1 */
+   HDMI_AUDIO_CODING_TYPE_EXT_CT,
 
/*
 * The next three CXT values are defined in CEA-861-E only.
-- 
2.1.3

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


[PATCHv3 4/4] adv7842: simplify InfoFrame logging

2014-12-19 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

Use the new logging functions from the hdmi module.

Signed-off-by: Martin Bugge marbu...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/Kconfig   |   1 +
 drivers/media/i2c/adv7842.c | 174 
 2 files changed, 47 insertions(+), 128 deletions(-)

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 205d713..8eebfa9 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -209,6 +209,7 @@ config VIDEO_ADV7604
 config VIDEO_ADV7842
tristate Analog Devices ADV7842 decoder
depends on VIDEO_V4L2  I2C  VIDEO_V4L2_SUBDEV_API  
MEDIA_CONTROLLER
+   select HDMI
---help---
  Support for the Analog Devices ADV7842 video decoder.
 
diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 75d26df..156d13d 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -38,6 +38,7 @@
 #include linux/videodev2.h
 #include linux/workqueue.h
 #include linux/v4l2-dv-timings.h
+#include linux/hdmi.h
 #include media/v4l2-device.h
 #include media/v4l2-ctrls.h
 #include media/v4l2-dv-timings.h
@@ -2108,149 +2109,65 @@ static int adv7842_set_edid(struct v4l2_subdev *sd, 
struct v4l2_edid *e)
return err;
 }
 
-/*** avi info frame CEA-861-E **/
-/* TODO move to common library */
-
-struct avi_info_frame {
-   uint8_t f17;
-   uint8_t y10;
-   uint8_t a0;
-   uint8_t b10;
-   uint8_t s10;
-   uint8_t c10;
-   uint8_t m10;
-   uint8_t r3210;
-   uint8_t itc;
-   uint8_t ec210;
-   uint8_t q10;
-   uint8_t sc10;
-   uint8_t f47;
-   uint8_t vic;
-   uint8_t yq10;
-   uint8_t cn10;
-   uint8_t pr3210;
-   uint16_t etb;
-   uint16_t sbb;
-   uint16_t elb;
-   uint16_t srb;
+struct adv7842_cfg_read_infoframe {
+   const char *desc;
+   u8 present_mask;
+   u8 head_addr;
+   u8 payload_addr;
 };
 
-static const char *y10_txt[4] = {
-   RGB,
-   YCbCr 4:2:2,
-   YCbCr 4:4:4,
-   Future,
-};
-
-static const char *c10_txt[4] = {
-   No Data,
-   SMPTE 170M,
-   ITU-R 709,
-   Extended Colorimetry information valied,
-};
-
-static const char *itc_txt[2] = {
-   No Data,
-   IT content,
-};
-
-static const char *ec210_txt[8] = {
-   xvYCC601,
-   xvYCC709,
-   sYCC601,
-   AdobeYCC601,
-   AdobeRGB,
-   5 reserved,
-   6 reserved,
-   7 reserved,
-};
-
-static const char *q10_txt[4] = {
-   Default,
-   Limited Range,
-   Full Range,
-   Reserved,
-};
-
-static void parse_avi_infoframe(struct v4l2_subdev *sd, uint8_t *buf,
-   struct avi_info_frame *avi)
-{
-   avi-f17 = (buf[1]  7)  0x1;
-   avi-y10 = (buf[1]  5)  0x3;
-   avi-a0 = (buf[1]  4)  0x1;
-   avi-b10 = (buf[1]  2)  0x3;
-   avi-s10 = buf[1]  0x3;
-   avi-c10 = (buf[2]  6)  0x3;
-   avi-m10 = (buf[2]  4)  0x3;
-   avi-r3210 = buf[2]  0xf;
-   avi-itc = (buf[3]  7)  0x1;
-   avi-ec210 = (buf[3]  4)  0x7;
-   avi-q10 = (buf[3]  2)  0x3;
-   avi-sc10 = buf[3]  0x3;
-   avi-f47 = (buf[4]  7)  0x1;
-   avi-vic = buf[4]  0x7f;
-   avi-yq10 = (buf[5]  6)  0x3;
-   avi-cn10 = (buf[5]  4)  0x3;
-   avi-pr3210 = buf[5]  0xf;
-   avi-etb = buf[6] + 256*buf[7];
-   avi-sbb = buf[8] + 256*buf[9];
-   avi-elb = buf[10] + 256*buf[11];
-   avi-srb = buf[12] + 256*buf[13];
-}
-
-static void print_avi_infoframe(struct v4l2_subdev *sd)
+static void log_infoframe(struct v4l2_subdev *sd, struct 
adv7842_cfg_read_infoframe *cri)
 {
int i;
-   uint8_t buf[14];
-   u8 avi_len;
-   u8 avi_ver;
-   struct avi_info_frame avi;
+   uint8_t buffer[32];
+   union hdmi_infoframe frame;
+   u8 len;
+   struct i2c_client *client = v4l2_get_subdevdata(sd);
+   struct device *dev = client-dev;
 
-   if (!(hdmi_read(sd, 0x05)  0x80)) {
-   v4l2_info(sd, receive DVI-D signal (AVI infoframe not 
supported)\n);
-   return;
-   }
-   if (!(io_read(sd, 0x60)  0x01)) {
-   v4l2_info(sd, AVI infoframe not received\n);
+   if (!(io_read(sd, 0x60)  cri-present_mask)) {
+   v4l2_info(sd, %s infoframe not received\n, cri-desc);
return;
}
 
-   if (io_read(sd, 0x88)  0x10) {
-   v4l2_info(sd, AVI infoframe checksum error has occurred 
earlier\n);
-   io_write(sd, 0x8a, 0x10); /* clear AVI_INF_CKS_ERR_RAW */
-   if (io_read(sd, 0x88)  0x10) {
-   v4l2_info(sd, AVI infoframe checksum error still 
present\n);
-   io_write(sd, 0x8a, 0x10); /* clear AVI_INF_CKS_ERR_RAW 
*/
-   }
-   }
+   for (i = 0; i  3; i++)
+   buffer[i] = infoframe_read(sd, 

Re: [RFC PATCH 5/8] media/i2c/Kconfig: drop superfluous MEDIA_CONTROLLER

2014-12-19 Thread Laurent Pinchart
Hi Hans,

On Friday 19 December 2014 12:44:46 Hans Verkuil wrote:
 On 12/08/2014 12:38 AM, Laurent Pinchart wrote:
  On Thursday 04 December 2014 10:54:56 Hans Verkuil wrote:
  From: Hans Verkuil hans.verk...@cisco.com
  
  These drivers depend on VIDEO_V4L2_SUBDEV_API, which in turn
  depends on MEDIA_CONTROLLER. So it is sufficient to just depend
  on VIDEO_V4L2_SUBDEV_API.
  
  Shouldn't the VIDEO_V4L2_SUBDEV_API dependency be dropped from those (and
  other) subdev drivers ? They don't require the userspace API, just the
  kernel part.
 
 They set V4L2_SUBDEV_FL_HAS_DEVNODE and use v4l2_subdev_get_try_format,
 so they do need VIDEO_V4L2_SUBDEV_API. Or am I missing something?

VIDEO_V4L2_SUBDEV_API was initially designed to cover both the subdev 
userspace API and the subdev in-kernel pad-level API. Now that the latter has 
been found useful without the former, I think we should revisit the idea.

Does it still make sense to have a single Kconfig option to cover both 
concepts ? Should it be kept a-is, split in two, or redefined to cover the 
userspace API only (with the v4l2_subdev_get_try_* functions being then always 
available) ? As the idea is to standardize on pad-level operations for in-
kernel communication between bridges and subdevs the v4l2_subdev_get_try_* 
functions will get increasingly used in most (if not all) subdev drivers.

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-media 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 5/8] media/i2c/Kconfig: drop superfluous MEDIA_CONTROLLER

2014-12-19 Thread Hans Verkuil
On 12/19/2014 01:18 PM, Laurent Pinchart wrote:
 Hi Hans,
 
 On Friday 19 December 2014 12:44:46 Hans Verkuil wrote:
 On 12/08/2014 12:38 AM, Laurent Pinchart wrote:
 On Thursday 04 December 2014 10:54:56 Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com

 These drivers depend on VIDEO_V4L2_SUBDEV_API, which in turn
 depends on MEDIA_CONTROLLER. So it is sufficient to just depend
 on VIDEO_V4L2_SUBDEV_API.

 Shouldn't the VIDEO_V4L2_SUBDEV_API dependency be dropped from those (and
 other) subdev drivers ? They don't require the userspace API, just the
 kernel part.

 They set V4L2_SUBDEV_FL_HAS_DEVNODE and use v4l2_subdev_get_try_format,
 so they do need VIDEO_V4L2_SUBDEV_API. Or am I missing something?
 
 VIDEO_V4L2_SUBDEV_API was initially designed to cover both the subdev 
 userspace API and the subdev in-kernel pad-level API. Now that the latter has 
 been found useful without the former, I think we should revisit the idea.
 
 Does it still make sense to have a single Kconfig option to cover both 
 concepts ? Should it be kept a-is, split in two, or redefined to cover the 
 userspace API only (with the v4l2_subdev_get_try_* functions being then 
 always 
 available) ? As the idea is to standardize on pad-level operations for in-
 kernel communication between bridges and subdevs the v4l2_subdev_get_try_* 
 functions will get increasingly used in most (if not all) subdev drivers.

OK, but if you don't mind I would make such changes in a separate patch.
This patch just removes an obviously superfluous dependency and brings these
drivers in line with the others.

Removing it altogether is a separate issue.

Regards,

Hans

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


[GIT PULL FOR v3.20] v4l2-subdev cleanups

2014-12-19 Thread Hans Verkuil
These patches are identical to patches 1, 2, 3 and 5 of this RFC patch series:

https://www.mail-archive.com/linux-media@vger.kernel.org/msg82712.html

Except for updating the obviously wrong subject line of patch 3.

Regards,

Hans

The following changes since commit 427ae153c65ad7a08288d86baf99000569627d03:

  [media] bq/c-qcam, w9966, pms: move to staging in preparation for removal 
(2014-12-16 23:21:44 -0200)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git for-v3.20e

for you to fetch changes up to c2db336edbcc29bb5eb991c47be6d1524d7857c8:

  media/i2c/Kconfig: drop superfluous MEDIA_CONTROLLER (2014-12-19 12:44:54 
+0100)


Hans Verkuil (4):
  v4l2 subdev: replace get/set_crop by get/set_selection
  v4l2-subdev: drop get/set_crop pad ops
  v4l2-subdev: drop unused op enum_mbus_fsizes
  media/i2c/Kconfig: drop superfluous MEDIA_CONTROLLER

 drivers/media/i2c/Kconfig   |  6 +++---
 drivers/media/i2c/mt9m032.c | 42 
++
 drivers/media/i2c/mt9p031.c | 41 
+
 drivers/media/i2c/mt9t001.c | 41 
+
 drivers/media/i2c/mt9v032.c | 43 
++-
 drivers/media/i2c/s5k6aa.c  | 44 
+++
 drivers/media/v4l2-core/v4l2-subdev.c   |  8 
 drivers/staging/media/davinci_vpfe/dm365_isif.c | 69 
--
 include/media/v4l2-subdev.h |  6 --
 9 files changed, 159 insertions(+), 141 deletions(-)
--
To unsubscribe from this list: send the line unsubscribe linux-media 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 6/8] v4l2-subdev: add v4l2_subdev_create_pad_configs

2014-12-19 Thread Hans Verkuil
Hi Laurent,

On 12/08/2014 12:50 AM, Laurent Pinchart wrote:
 Hi Hans,
 
 Thank you for the patch.
 
 On Thursday 04 December 2014 10:54:57 Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com

 When a new subdevice is registered this new function is called to allocate
 and initialize a pad_config array. This allows bridge drivers to use the
 pad ops that require such an array as argument.
 
 While I agree that a v4l2_subdev_create_pad_configs() function is needed, I 
 don't think the pad configs should be stored in the subdev structure. This 
 would defeat the whole point of having a try mechanism based on private 
 configs. Bridge drivers should instead create the configs on demand, use 
 them, 
 and delete them afterwards.

I really don't like that. None of the current non-MC bridge drivers need this,
so why force lots of allocations and frees of pad configs if there is no need?

It all comes back to the fact that enum_mbus_code, enum_frame_size and
enum_frame_interval do not have a which field. If they had one, then bridge
drivers could call them with V4L2_SUBDEV_FORMAT_ACTIVE and a NULL pad_config
pointer. Unless of course they really need to use FORMAT_TRY, but in that
case they can set up the pad_config array themselves.

This would allow me to drop this patch and still keep the bridge drivers that
need this simple.

It's a bit of work to update the existing drivers to support the new which
field, but from what I've seen that doesn't look too difficult.

Can we discuss this on irc?

Regards,

Hans

 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 ---
  drivers/media/v4l2-core/v4l2-device.c | 11 ++-
  drivers/media/v4l2-core/v4l2-subdev.c | 36 
  include/media/v4l2-subdev.h   |  4 
  3 files changed, 50 insertions(+), 1 deletion(-)

 diff --git a/drivers/media/v4l2-core/v4l2-device.c
 b/drivers/media/v4l2-core/v4l2-device.c index 015f92a..5c8d402 100644
 --- a/drivers/media/v4l2-core/v4l2-device.c
 +++ b/drivers/media/v4l2-core/v4l2-device.c
 @@ -183,12 +183,16 @@ int v4l2_device_register_subdev(struct v4l2_device
 *v4l2_dev, if (err)
  goto error_unregister;

 +err = v4l2_subdev_create_pad_configs(sd);
 +if (err)
 +goto error_unregister;
 +
 
 I don't thin
 
  #if defined(CONFIG_MEDIA_CONTROLLER)
  /* Register the entity. */
  if (v4l2_dev-mdev) {
  err = media_device_register_entity(v4l2_dev-mdev, entity);
  if (err  0)
 -goto error_unregister;
 +goto error_free_pad_configs;
  }
  #endif

 @@ -198,6 +202,9 @@ int v4l2_device_register_subdev(struct v4l2_device
 *v4l2_dev,

  return 0;

 +error_free_pad_configs:
 +kfree(sd-pad_configs);
 +sd-pad_configs = NULL;
  error_unregister:
  if (sd-internal_ops  sd-internal_ops-unregistered)
  sd-internal_ops-unregistered(sd);
 @@ -282,6 +289,8 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev
 *sd)

  if (sd-internal_ops  sd-internal_ops-unregistered)
  sd-internal_ops-unregistered(sd);
 +kfree(sd-pad_configs);
 +sd-pad_configs = NULL;
  sd-v4l2_dev = NULL;

  #if defined(CONFIG_MEDIA_CONTROLLER)
 diff --git a/drivers/media/v4l2-core/v4l2-subdev.c
 b/drivers/media/v4l2-core/v4l2-subdev.c index 3c8b198..a7b874e 100644
 --- a/drivers/media/v4l2-core/v4l2-subdev.c
 +++ b/drivers/media/v4l2-core/v4l2-subdev.c
 @@ -560,6 +560,41 @@ int v4l2_subdev_link_validate(struct media_link *link)
  EXPORT_SYMBOL_GPL(v4l2_subdev_link_validate);
  #endif /* CONFIG_MEDIA_CONTROLLER */

 +int v4l2_subdev_create_pad_configs(struct v4l2_subdev *sd)
 +{
 +#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
 +struct v4l2_subdev_format fmt = {
 +.which = V4L2_SUBDEV_FORMAT_ACTIVE,
 +};
 +unsigned pads = sd-entity.num_pads;
 +unsigned pad;
 +int err;
 +
 +if (pads == 0)
 +return 0;
 +sd-pad_configs = kcalloc(pads, sizeof(*sd-pad_configs), GFP_KERNEL);
 +if (sd-pad_configs == NULL)
 +return -ENOMEM;
 +for (pad = 0; pad  pads; pad++) {
 +fmt.pad = pad;
 +err = v4l2_subdev_call(sd, pad, get_fmt, NULL, fmt);
 +
 +if (err  err != -ENOIOCTLCMD) {
 +kfree(sd-pad_configs);
 +sd-pad_configs = NULL;
 +return err;
 +}
 +sd-pad_configs[pad].try_fmt = fmt.format;
 +sd-pad_configs[pad].try_crop.width = fmt.format.width;
 +sd-pad_configs[pad].try_crop.height = fmt.format.height;
 +sd-pad_configs[pad].try_compose.width = fmt.format.width;
 +sd-pad_configs[pad].try_compose.height = fmt.format.height;
 +}
 +#endif
 +return 0;
 +}
 +EXPORT_SYMBOL_GPL(v4l2_subdev_create_pad_configs);
 +
  void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops
 *ops) {
  INIT_LIST_HEAD(sd-list);
 @@ -571,6 +606,7 @@ void 

Re: [PATCH 1/2] regmap: pass map name to lockdep

2014-12-19 Thread Lars-Peter Clausen

On 12/19/2014 11:58 AM, Antti Palosaari wrote:

On 12/18/2014 11:34 PM, Lars-Peter Clausen wrote:

On 12/18/2014 10:05 PM, Antti Palosaari wrote:

lockdep complains recursive locking and deadlock when two different
regmap instances are called in a nested order. That happen easily
for example when both I2C client and muxed/repeater I2C adapter are
using regmap. As a solution, pass regmap name for lockdep in order
to force lockdep validate regmap mutex per driver - not as all regmap
instances grouped together.


That's not how it works. Locks are grouped by lock class, the name is
just for pretty printing. The only reason you do not get a warning
anymore is because you have now different lock classes one for configs
with a name and one for configs without a name.

You really need a way to specify a custom lock class per regmap instance
in order to solve this problem.


I looked example for that solution from v4l controls. So it is also wrong?

https://patchwork.linuxtv.org/patch/17262/


No, that's correct. It creates one lock class per v4l2_ctrl_handler_init() 
invocation site.





Do you think I should change to mutex_lock_nested() as documented in
Documentation/locking/lockdep-design.txt ?


No, mutex_lock_nested() only works if you can identify lock subclasses.



Should these macros used at all:
include/linux/lockdep.h

There is not much documentation, especially how these recursive lock
warnings should be silenced.


You have a couple of options, either do what v4l2_ctrl_handler_init() and 
create a lock class key per regmap_init_*() invocation site. Or just add a 
lock class key per regmap instance. Or add a helper function which allows to 
change the lock class of a regmap instance that can be used by drivers where 
we expect that there will be nested locking. E.g. like in a bus master.


- Lars

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


[PATCH v2] media: ti-vpe: Use mem-to-mem ioctl helpers

2014-12-19 Thread Lad, Prabhakar
1: Simplify the vpe mem-to-mem driver by using the m2m ioctl
   and vb2 helpers.
2: Align and arranged the v4l2_ioctl_ops.
3: Fixes a typo.
4: Use of_match_ptr() instead of explicitly defining the macro
   to NULL in case CONFIG_OF is not defined.

Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 Note:-
 1: This patch is on top of https://patchwork.linuxtv.org/patch/27161/
 2: Compile tested only.
 
 drivers/media/platform/ti-vpe/vpe.c | 157 
 1 file changed, 50 insertions(+), 107 deletions(-)

diff --git a/drivers/media/platform/ti-vpe/vpe.c 
b/drivers/media/platform/ti-vpe/vpe.c
index d5d745d..7d2564c 100644
--- a/drivers/media/platform/ti-vpe/vpe.c
+++ b/drivers/media/platform/ti-vpe/vpe.c
@@ -25,6 +25,7 @@
 #include linux/io.h
 #include linux/ioctl.h
 #include linux/module.h
+#include linux/of.h
 #include linux/platform_device.h
 #include linux/pm_runtime.h
 #include linux/sched.h
@@ -74,7 +75,7 @@
 #define VPE_DEF_BUFS_PER_JOB   1   /* default one buffer per batch job */
 
 /*
- * each VPE context can need up to 3 config desciptors, 7 input descriptors,
+ * each VPE context can need up to 3 config descriptors, 7 input descriptors,
  * 3 output descriptors, and 10 control descriptors
  */
 #define VPE_DESC_LIST_SIZE (10 * VPDMA_DTD_DESC_SIZE + \
@@ -373,7 +374,6 @@ struct vpe_dev {
 struct vpe_ctx {
struct v4l2_fh  fh;
struct vpe_dev  *dev;
-   struct v4l2_m2m_ctx *m2m_ctx;
struct v4l2_ctrl_handler hdl;
 
unsigned intfield;  /* current field */
@@ -887,10 +887,10 @@ static int job_ready(void *priv)
if (ctx-deinterlacing  ctx-src_vbs[2] == NULL)
needed += 2;/* need additional two most recent fields */
 
-   if (v4l2_m2m_num_src_bufs_ready(ctx-m2m_ctx)  needed)
+   if (v4l2_m2m_num_src_bufs_ready(ctx-fh.m2m_ctx)  needed)
return 0;
 
-   if (v4l2_m2m_num_dst_bufs_ready(ctx-m2m_ctx)  needed)
+   if (v4l2_m2m_num_dst_bufs_ready(ctx-fh.m2m_ctx)  needed)
return 0;
 
return 1;
@@ -1100,15 +1100,15 @@ static void device_run(void *priv)
struct vpe_q_data *d_q_data = ctx-q_data[Q_DATA_DST];
 
if (ctx-deinterlacing  ctx-src_vbs[2] == NULL) {
-   ctx-src_vbs[2] = v4l2_m2m_src_buf_remove(ctx-m2m_ctx);
+   ctx-src_vbs[2] = v4l2_m2m_src_buf_remove(ctx-fh.m2m_ctx);
WARN_ON(ctx-src_vbs[2] == NULL);
-   ctx-src_vbs[1] = v4l2_m2m_src_buf_remove(ctx-m2m_ctx);
+   ctx-src_vbs[1] = v4l2_m2m_src_buf_remove(ctx-fh.m2m_ctx);
WARN_ON(ctx-src_vbs[1] == NULL);
}
 
-   ctx-src_vbs[0] = v4l2_m2m_src_buf_remove(ctx-m2m_ctx);
+   ctx-src_vbs[0] = v4l2_m2m_src_buf_remove(ctx-fh.m2m_ctx);
WARN_ON(ctx-src_vbs[0] == NULL);
-   ctx-dst_vb = v4l2_m2m_dst_buf_remove(ctx-m2m_ctx);
+   ctx-dst_vb = v4l2_m2m_dst_buf_remove(ctx-fh.m2m_ctx);
WARN_ON(ctx-dst_vb == NULL);
 
/* config descriptors */
@@ -1334,7 +1334,7 @@ static irqreturn_t vpe_irq(int irq_vpe, void *data)
 finished:
vpe_dbg(ctx-dev, finishing transaction\n);
ctx-bufs_completed = 0;
-   v4l2_m2m_job_finish(dev-m2m_dev, ctx-m2m_ctx);
+   v4l2_m2m_job_finish(dev-m2m_dev, ctx-fh.m2m_ctx);
 handled:
return IRQ_HANDLED;
 }
@@ -1395,7 +1395,7 @@ static int vpe_g_fmt(struct file *file, void *priv, 
struct v4l2_format *f)
struct vpe_q_data *q_data;
int i;
 
-   vq = v4l2_m2m_get_vq(ctx-m2m_ctx, f-type);
+   vq = v4l2_m2m_get_vq(ctx-fh.m2m_ctx, f-type);
if (!vq)
return -EINVAL;
 
@@ -1527,7 +1527,7 @@ static int __vpe_s_fmt(struct vpe_ctx *ctx, struct 
v4l2_format *f)
struct vb2_queue *vq;
int i;
 
-   vq = v4l2_m2m_get_vq(ctx-m2m_ctx, f-type);
+   vq = v4l2_m2m_get_vq(ctx-fh.m2m_ctx, f-type);
if (!vq)
return -EINVAL;
 
@@ -1739,52 +1739,6 @@ static int vpe_s_selection(struct file *file, void *fh,
return set_srcdst_params(ctx);
 }
 
-static int vpe_reqbufs(struct file *file, void *priv,
-  struct v4l2_requestbuffers *reqbufs)
-{
-   struct vpe_ctx *ctx = file2ctx(file);
-
-   return v4l2_m2m_reqbufs(file, ctx-m2m_ctx, reqbufs);
-}
-
-static int vpe_querybuf(struct file *file, void *priv, struct v4l2_buffer *buf)
-{
-   struct vpe_ctx *ctx = file2ctx(file);
-
-   return v4l2_m2m_querybuf(file, ctx-m2m_ctx, buf);
-}
-
-static int vpe_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
-{
-   struct vpe_ctx *ctx = file2ctx(file);
-
-   return v4l2_m2m_qbuf(file, ctx-m2m_ctx, buf);
-}
-
-static int vpe_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
-{
-   struct vpe_ctx *ctx = file2ctx(file);
-
-   return v4l2_m2m_dqbuf(file, ctx-m2m_ctx, buf);
-}
-
-static int vpe_streamon(struct file *file, void *priv, enum 

Re: [PATCH 1/2] regmap: pass map name to lockdep

2014-12-19 Thread Antti Palosaari

On 12/19/2014 03:45 PM, Lars-Peter Clausen wrote:

On 12/19/2014 11:58 AM, Antti Palosaari wrote:

On 12/18/2014 11:34 PM, Lars-Peter Clausen wrote:

On 12/18/2014 10:05 PM, Antti Palosaari wrote:

lockdep complains recursive locking and deadlock when two different
regmap instances are called in a nested order. That happen easily
for example when both I2C client and muxed/repeater I2C adapter are
using regmap. As a solution, pass regmap name for lockdep in order
to force lockdep validate regmap mutex per driver - not as all regmap
instances grouped together.


That's not how it works. Locks are grouped by lock class, the name is
just for pretty printing. The only reason you do not get a warning
anymore is because you have now different lock classes one for configs
with a name and one for configs without a name.

You really need a way to specify a custom lock class per regmap instance
in order to solve this problem.


I looked example for that solution from v4l controls. So it is also
wrong?

https://patchwork.linuxtv.org/patch/17262/


No, that's correct. It creates one lock class per
v4l2_ctrl_handler_init() invocation site.


ah, yes, it it includes that piece of code, which declares key for each 
caller module.



Do you think I should change to mutex_lock_nested() as documented in
Documentation/locking/lockdep-design.txt ?


No, mutex_lock_nested() only works if you can identify lock subclasses.



Should these macros used at all:
include/linux/lockdep.h

There is not much documentation, especially how these recursive lock
warnings should be silenced.


You have a couple of options, either do what v4l2_ctrl_handler_init()
and create a lock class key per regmap_init_*() invocation site. Or just
add a lock class key per regmap instance. Or add a helper function which
allows to change the lock class of a regmap instance that can be used by
drivers where we expect that there will be nested locking. E.g. like in
a bus master.


I think I will add key to regmap config. Then driver which uses regmap, 
could declare key and pass it to regmap.


regards
Antti


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


Re: [PATCH 1/2] vb2: Add VB2_FILEIO_ALLOW_ZERO_BYTESUSED flag to vb2_fileio_flags

2014-12-19 Thread Jean-Michel Hautbois
Hi Kamil,

2014-12-16 12:36 GMT+01:00 Kamil Debski k.deb...@samsung.com:
 The vb2: fix bytesused == 0 handling (8a75ffb) patch changed the behavior
 of __fill_vb2_buffer function, so that if bytesused is 0 it is set to the
 size of the buffer. However, bytesused set to 0 is used by older codec
 drivers as as indication used to mark the end of stream.

 To keep backward compatibility, this patch adds a flag passed to the
 vb2_queue_init function - VB2_FILEIO_ALLOW_ZERO_BYTESUSED. If the flag is
 set upon initialization of the queue, the videobuf2 keeps the value of
 bytesused intact and passes it to the driver.

Nice, this is something we were planning to do :).
But I would split this patch and the second which is specific to
s5p-mfc as this is core specific and should be independant.


 Reported-by: Nicolas Dufresne nicolas.dufre...@collabora.com
 Signed-off-by: Kamil Debski k.deb...@samsung.com
 ---
  drivers/media/v4l2-core/videobuf2-core.c |   33 
 --
  include/media/videobuf2-core.h   |3 +++
  2 files changed, 30 insertions(+), 6 deletions(-)

 diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
 b/drivers/media/v4l2-core/videobuf2-core.c
 index d09a891..1068dbb 100644
 --- a/drivers/media/v4l2-core/videobuf2-core.c
 +++ b/drivers/media/v4l2-core/videobuf2-core.c
 @@ -1276,13 +1276,23 @@ static void __fill_vb2_buffer(struct vb2_buffer *vb, 
 const struct v4l2_buffer *b
  * userspace clearly never bothered to set it and
  * it's a safe assumption that they really meant to
  * use the full plane sizes.
 +*
 +* Some drivers, e.g. old codec drivers, use bytesused
 +* == 0 as a way to indicate that streaming is 
 finished.
 +* In that case, the driver should use the following
 +* io_flag VB2_FILEIO_ALLOW_ZERO_BYTESUSED to keep old
 +* userspace applications working.

Not sure if this comment is necessary, as this is already in the commit ?

  */
 for (plane = 0; plane  vb-num_planes; ++plane) {
 struct v4l2_plane *pdst = v4l2_planes[plane];
 struct v4l2_plane *psrc = b-m.planes[plane];

 -   pdst-bytesused = psrc-bytesused ?
 -   psrc-bytesused : pdst-length;
 +   if (vb-vb2_queue-io_flags 
 +   VB2_FILEIO_ALLOW_ZERO_BYTESUSED)
 +   pdst-bytesused = psrc-bytesused;
 +   else
 +   pdst-bytesused = psrc-bytesused ?
 +   psrc-bytesused : 
 pdst-length;
 pdst-data_offset = psrc-data_offset;
 }
 }
 @@ -1295,6 +1305,12 @@ static void __fill_vb2_buffer(struct vb2_buffer *vb, 
 const struct v4l2_buffer *b
  *
  * If bytesused == 0 for the output buffer, then fall back
  * to the full buffer size as that's a sensible default.
 +*
 +* Some drivers, e.g. old codec drivers, use bytesused == 0
 +* as a way to indicate that streaming is finished. In that
 +* case, the driver should use the following io_flag
 +* VB2_FILEIO_ALLOW_ZERO_BYTESUSED to keep old userspace
 +* applications working.

Again, not sure this is useful.

  */
 if (b-memory == V4L2_MEMORY_USERPTR) {
 v4l2_planes[0].m.userptr = b-m.userptr;
 @@ -1306,11 +1322,16 @@ static void __fill_vb2_buffer(struct vb2_buffer *vb, 
 const struct v4l2_buffer *b
 v4l2_planes[0].length = b-length;
 }

 -   if (V4L2_TYPE_IS_OUTPUT(b-type))
 -   v4l2_planes[0].bytesused = b-bytesused ?
 -   b-bytesused : v4l2_planes[0].length;
 -   else
 +   if (V4L2_TYPE_IS_OUTPUT(b-type)) {
 +   if (vb-vb2_queue-io_flags 
 +   VB2_FILEIO_ALLOW_ZERO_BYTESUSED)
 +   v4l2_planes[0].bytesused = b-bytesused;
 +   else
 +   v4l2_planes[0].bytesused = b-bytesused ?
 +   b-bytesused : v4l2_planes[0].length;
 +   } else {
 v4l2_planes[0].bytesused = 0;
 +   }

 }

 diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
 index bd2cec2..0540bc3 100644
 --- a/include/media/videobuf2-core.h
 +++ b/include/media/videobuf2-core.h
 @@ -138,10 +138,13 

Re: [RFC] [Patch] implement video driver for sur40

2014-12-19 Thread Hans Verkuil


On 12/19/2014 03:30 PM, Florian Echtler wrote:
 On 18.12.2014 15:11, Hans Verkuil wrote:
 Run as 'v4l2-compliance -s' (-s starts streaming tests as well and it
 assumes you have a valid input signal).
 Mail if you have any questions about the v4l2-compliance output. The failure
 messages expect you to look at the v4l2-compliance source code as well,
 but even than it is not always clear what is going on.
 Ran the most recent version from git master, got a total of 6 fails, 4
 of which are probably easy fixes:
 
 fail: v4l2-compliance.cpp(306): missing bus_info prefix ('USB:1')
 test VIDIOC_QUERYCAP: FAIL
 Changed the relevant code to:
   usb_make_path(sur40-usbdev, cap-bus_info, sizeof(cap-bus_info));
   
 fail: v4l2-test-input-output.cpp(455): could set input to invalid input 1
 test VIDIOC_G/S/ENUMINPUT: FAIL
 Now returning -EINVAL when S_INPUT called with input != 0.
 
 fail: v4l2-test-formats.cpp(322): !colorspace
 fail: v4l2-test-formats.cpp(429): testColorspace(pix.pixelformat,
 pix.colorspace, pix.ycbcr_enc, pix.quantization)
 test VIDIOC_G_FMT: FAIL
 Setting colorspace in v4l2_pix_format to V4L2_COLORSPACE_SRGB.
 
 fail: v4l2-compliance.cpp(365): doioctl(node, VIDIOC_G_PRIORITY, prio)
 test VIDIOC_G/S_PRIORITY: FAIL
 Don't know how to fix this - does this mean VIDIOC_G/S_PRIORITY _must_
 be implemented?
 
 fail: v4l2-test-buffers.cpp(500): q.has_expbuf(node)
 test VIDIOC_EXPBUF: FAIL
 Also not clear how to fix this one.
 
 Could you give some hints on the last two?

Can you post the driver code you used to run these tests? And which kernel 
version
and git tree did you base your patch on?

Regards,

Hans

 
 Thanks  best regards, Florian
 
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFCv2 PATCH 00/11] v4l2 subdev: Removing duplicate video/pad ops

2014-12-19 Thread Hans Verkuil
This patch series attempts to remove some of the duplicate video/pad ops.
The first four patches are here for completeness as a pull request has
been posted for them.

The fifth patch has been updated with Laurent's review comments.

The main change with RFCv1 is that instead of creating a
v4l2_subdev_create_pad_configs function I am adding a which field to the
enum pad ops. Bridge drivers that don't need to support pad_configs can
just pass NULL for the pad_configs and V4L2_SUBDEV_FORMAT_ACTIVE as the
'which' field value.

Patches 6-9 implement this.

Patches 10 and 11 are effectively identical to RFCv1, except for some
small changes in patch 10 to set the which field.

Missing in this patch series are:

- proper commit log messages for patches 6-11
- documentation updates for the new 'which' field.

Note that I have not tested these changes with soc-camera. I'm having
major problems getting the video input and output to work on my
Renesas board. I wonder if the current kernel board code is broken
for the SH7724 board.

Feedback for this approach is welcome.

Regards,

Hans

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


[RFCv2 PATCH 04/11] media/i2c/Kconfig: drop superfluous MEDIA_CONTROLLER

2014-12-19 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

These drivers depend on VIDEO_V4L2_SUBDEV_API, which in turn
depends on MEDIA_CONTROLLER. So it is sufficient to just depend
on VIDEO_V4L2_SUBDEV_API.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 205d713..ca84543 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -196,7 +196,7 @@ config VIDEO_ADV7183
 
 config VIDEO_ADV7604
tristate Analog Devices ADV7604 decoder
-   depends on VIDEO_V4L2  I2C  VIDEO_V4L2_SUBDEV_API  
MEDIA_CONTROLLER
+   depends on VIDEO_V4L2  I2C  VIDEO_V4L2_SUBDEV_API
---help---
  Support for the Analog Devices ADV7604 video decoder.
 
@@ -208,7 +208,7 @@ config VIDEO_ADV7604
 
 config VIDEO_ADV7842
tristate Analog Devices ADV7842 decoder
-   depends on VIDEO_V4L2  I2C  VIDEO_V4L2_SUBDEV_API  
MEDIA_CONTROLLER
+   depends on VIDEO_V4L2  I2C  VIDEO_V4L2_SUBDEV_API
---help---
  Support for the Analog Devices ADV7842 video decoder.
 
@@ -422,7 +422,7 @@ config VIDEO_ADV7393
 
 config VIDEO_ADV7511
tristate Analog Devices ADV7511 encoder
-   depends on VIDEO_V4L2  I2C  VIDEO_V4L2_SUBDEV_API  
MEDIA_CONTROLLER
+   depends on VIDEO_V4L2  I2C  VIDEO_V4L2_SUBDEV_API
---help---
  Support for the Analog Devices ADV7511 video encoder.
 
-- 
2.1.3

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


[RFCv2 PATCH 06/11] v4l2-subdev.h: add which field for the enum structs

2014-12-19 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 include/uapi/linux/v4l2-subdev.h | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/include/uapi/linux/v4l2-subdev.h b/include/uapi/linux/v4l2-subdev.h
index e0a7e3d..dbce2b5 100644
--- a/include/uapi/linux/v4l2-subdev.h
+++ b/include/uapi/linux/v4l2-subdev.h
@@ -69,12 +69,14 @@ struct v4l2_subdev_crop {
  * @pad: pad number, as reported by the media API
  * @index: format index during enumeration
  * @code: format code (MEDIA_BUS_FMT_ definitions)
+ * @which: format type (from enum v4l2_subdev_format_whence)
  */
 struct v4l2_subdev_mbus_code_enum {
__u32 pad;
__u32 index;
__u32 code;
-   __u32 reserved[9];
+   __u32 which;
+   __u32 reserved[8];
 };
 
 /**
@@ -82,6 +84,7 @@ struct v4l2_subdev_mbus_code_enum {
  * @pad: pad number, as reported by the media API
  * @index: format index during enumeration
  * @code: format code (MEDIA_BUS_FMT_ definitions)
+ * @which: format type (from enum v4l2_subdev_format_whence)
  */
 struct v4l2_subdev_frame_size_enum {
__u32 index;
@@ -91,7 +94,8 @@ struct v4l2_subdev_frame_size_enum {
__u32 max_width;
__u32 min_height;
__u32 max_height;
-   __u32 reserved[9];
+   __u32 which;
+   __u32 reserved[8];
 };
 
 /**
@@ -113,6 +117,7 @@ struct v4l2_subdev_frame_interval {
  * @width: frame width in pixels
  * @height: frame height in pixels
  * @interval: frame interval in seconds
+ * @which: format type (from enum v4l2_subdev_format_whence)
  */
 struct v4l2_subdev_frame_interval_enum {
__u32 index;
@@ -121,7 +126,8 @@ struct v4l2_subdev_frame_interval_enum {
__u32 width;
__u32 height;
struct v4l2_fract interval;
-   __u32 reserved[9];
+   __u32 which;
+   __u32 reserved[8];
 };
 
 /**
-- 
2.1.3

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


[RFCv2 PATCH 03/11] v4l2-subdev: drop unused op enum_mbus_fsizes

2014-12-19 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Weird, this op isn't used at all. Seems to be orphaned code.
Remove it.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Acked-by: Sakari Ailus sakari.ai...@linux.intel.com
Acked-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 include/media/v4l2-subdev.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index b052184..5beeb87 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -342,8 +342,6 @@ struct v4l2_subdev_video_ops {
struct v4l2_dv_timings *timings);
int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index,
 u32 *code);
-   int (*enum_mbus_fsizes)(struct v4l2_subdev *sd,
-struct v4l2_frmsizeenum *fsize);
int (*g_mbus_fmt)(struct v4l2_subdev *sd,
  struct v4l2_mbus_framefmt *fmt);
int (*try_mbus_fmt)(struct v4l2_subdev *sd,
-- 
2.1.3

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


[RFCv2 PATCH 01/11] v4l2 subdev: replace get/set_crop by get/set_selection

2014-12-19 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

The crop and selection pad ops are duplicates. Replace all uses of get/set_crop
by get/set_selection. This will make it possible to drop get/set_crop
altogether.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Acked-by: Sylwester Nawrocki s.nawro...@samsung.com
Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Acked-by: Sakari Ailus sakari.ai...@linux.intel.com
Acked-by: Lad, Prabhakar prabhakar.cse...@gmail.com
Cc: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/i2c/mt9m032.c | 42 ---
 drivers/media/i2c/mt9p031.c | 41 ---
 drivers/media/i2c/mt9t001.c | 41 ---
 drivers/media/i2c/mt9v032.c | 43 ---
 drivers/media/i2c/s5k6aa.c  | 44 +---
 drivers/staging/media/davinci_vpfe/dm365_isif.c | 69 +
 6 files changed, 156 insertions(+), 124 deletions(-)

diff --git a/drivers/media/i2c/mt9m032.c b/drivers/media/i2c/mt9m032.c
index 45b3fca..7643122 100644
--- a/drivers/media/i2c/mt9m032.c
+++ b/drivers/media/i2c/mt9m032.c
@@ -422,22 +422,25 @@ done:
return ret;
 }
 
-static int mt9m032_get_pad_crop(struct v4l2_subdev *subdev,
-   struct v4l2_subdev_fh *fh,
-   struct v4l2_subdev_crop *crop)
+static int mt9m032_get_pad_selection(struct v4l2_subdev *subdev,
+struct v4l2_subdev_fh *fh,
+struct v4l2_subdev_selection *sel)
 {
struct mt9m032 *sensor = to_mt9m032(subdev);
 
+   if (sel-target != V4L2_SEL_TGT_CROP)
+   return -EINVAL;
+
mutex_lock(sensor-lock);
-   crop-rect = *__mt9m032_get_pad_crop(sensor, fh, crop-which);
+   sel-r = *__mt9m032_get_pad_crop(sensor, fh, sel-which);
mutex_unlock(sensor-lock);
 
return 0;
 }
 
-static int mt9m032_set_pad_crop(struct v4l2_subdev *subdev,
-   struct v4l2_subdev_fh *fh,
-   struct v4l2_subdev_crop *crop)
+static int mt9m032_set_pad_selection(struct v4l2_subdev *subdev,
+struct v4l2_subdev_fh *fh,
+struct v4l2_subdev_selection *sel)
 {
struct mt9m032 *sensor = to_mt9m032(subdev);
struct v4l2_mbus_framefmt *format;
@@ -445,9 +448,12 @@ static int mt9m032_set_pad_crop(struct v4l2_subdev *subdev,
struct v4l2_rect rect;
int ret = 0;
 
+   if (sel-target != V4L2_SEL_TGT_CROP)
+   return -EINVAL;
+
mutex_lock(sensor-lock);
 
-   if (sensor-streaming  crop-which == V4L2_SUBDEV_FORMAT_ACTIVE) {
+   if (sensor-streaming  sel-which == V4L2_SUBDEV_FORMAT_ACTIVE) {
ret = -EBUSY;
goto done;
}
@@ -455,13 +461,13 @@ static int mt9m032_set_pad_crop(struct v4l2_subdev 
*subdev,
/* Clamp the crop rectangle boundaries and align them to a multiple of 2
 * pixels to ensure a GRBG Bayer pattern.
 */
-   rect.left = clamp(ALIGN(crop-rect.left, 2), MT9M032_COLUMN_START_MIN,
+   rect.left = clamp(ALIGN(sel-r.left, 2), MT9M032_COLUMN_START_MIN,
  MT9M032_COLUMN_START_MAX);
-   rect.top = clamp(ALIGN(crop-rect.top, 2), MT9M032_ROW_START_MIN,
+   rect.top = clamp(ALIGN(sel-r.top, 2), MT9M032_ROW_START_MIN,
 MT9M032_ROW_START_MAX);
-   rect.width = clamp_t(unsigned int, ALIGN(crop-rect.width, 2),
+   rect.width = clamp_t(unsigned int, ALIGN(sel-r.width, 2),
 MT9M032_COLUMN_SIZE_MIN, MT9M032_COLUMN_SIZE_MAX);
-   rect.height = clamp_t(unsigned int, ALIGN(crop-rect.height, 2),
+   rect.height = clamp_t(unsigned int, ALIGN(sel-r.height, 2),
  MT9M032_ROW_SIZE_MIN, MT9M032_ROW_SIZE_MAX);
 
rect.width = min_t(unsigned int, rect.width,
@@ -469,21 +475,21 @@ static int mt9m032_set_pad_crop(struct v4l2_subdev 
*subdev,
rect.height = min_t(unsigned int, rect.height,
MT9M032_PIXEL_ARRAY_HEIGHT - rect.top);
 
-   __crop = __mt9m032_get_pad_crop(sensor, fh, crop-which);
+   __crop = __mt9m032_get_pad_crop(sensor, fh, sel-which);
 
if (rect.width != __crop-width || rect.height != __crop-height) {
/* Reset the output image size if the crop rectangle size has
 * been modified.
 */
-   format = __mt9m032_get_pad_format(sensor, fh, crop-which);
+   format = __mt9m032_get_pad_format(sensor, fh, sel-which);
format-width = rect.width;
format-height = rect.height;
}
 
*__crop = rect;
-   crop-rect = rect;
+   sel-r = rect;
 
-   if (crop-which == V4L2_SUBDEV_FORMAT_ACTIVE)
+   if (sel-which == 

[RFCv2 PATCH 09/11] v4l2-subdev: add support for the new enum_frame_size which field.

2014-12-19 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/s5c73m3/s5c73m3-core.c   | 23 ++
 drivers/media/platform/omap3isp/ispccdc.c  |  4 ++--
 drivers/media/platform/omap3isp/ispccp2.c  |  4 ++--
 drivers/media/platform/omap3isp/ispcsi2.c  |  4 ++--
 drivers/media/platform/omap3isp/isppreview.c   |  4 ++--
 drivers/media/platform/omap3isp/ispresizer.c   |  4 ++--
 drivers/media/platform/vsp1/vsp1_hsit.c|  4 +++-
 drivers/media/platform/vsp1/vsp1_lif.c |  4 +++-
 drivers/media/platform/vsp1/vsp1_lut.c |  4 +++-
 drivers/media/platform/vsp1/vsp1_rwpf.c|  3 ++-
 drivers/media/platform/vsp1/vsp1_sru.c |  4 +++-
 drivers/media/platform/vsp1/vsp1_uds.c |  4 +++-
 drivers/staging/media/davinci_vpfe/dm365_ipipe.c   |  6 ++
 drivers/staging/media/davinci_vpfe/dm365_ipipeif.c |  6 ++
 drivers/staging/media/davinci_vpfe/dm365_isif.c|  4 ++--
 drivers/staging/media/davinci_vpfe/dm365_resizer.c |  6 ++
 drivers/staging/media/omap4iss/iss_csi2.c  |  4 ++--
 drivers/staging/media/omap4iss/iss_ipipe.c |  4 ++--
 drivers/staging/media/omap4iss/iss_ipipeif.c   |  6 ++
 drivers/staging/media/omap4iss/iss_resizer.c   |  6 ++
 20 files changed, 62 insertions(+), 46 deletions(-)

diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c 
b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
index 257a335..08b234b 100644
--- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c
+++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
@@ -1251,6 +1251,7 @@ static int s5c73m3_oif_enum_frame_size(struct v4l2_subdev 
*sd,
   struct v4l2_subdev_pad_config *cfg,
   struct v4l2_subdev_frame_size_enum *fse)
 {
+   struct s5c73m3 *state = oif_sd_to_s5c73m3(sd);
int idx;
 
if (fse-pad == OIF_SOURCE_PAD) {
@@ -1260,11 +1261,25 @@ static int s5c73m3_oif_enum_frame_size(struct 
v4l2_subdev *sd,
switch (fse-code) {
case S5C73M3_JPEG_FMT:
case S5C73M3_ISP_FMT: {
-   struct v4l2_mbus_framefmt *mf =
-   v4l2_subdev_get_try_format(sd, cfg, 
OIF_ISP_PAD);
+   unsigned w, h;
+
+   if (fse-which == V4L2_SUBDEV_FORMAT_TRY) {
+   struct v4l2_mbus_framefmt *mf;
+
+   mf = v4l2_subdev_get_try_format(sd, cfg,
+   OIF_ISP_PAD);
+
+   w = mf-width;
+   h = mf-height;
+   } else {
+   const struct s5c73m3_frame_size *fs;
 
-   fse-max_width = fse-min_width = mf-width;
-   fse-max_height = fse-min_height = mf-height;
+   fs = state-oif_pix_size[RES_ISP];
+   w = fs-width;
+   h = fs-height;
+   }
+   fse-max_width = fse-min_width = w;
+   fse-max_height = fse-min_height = h;
return 0;
}
default:
diff --git a/drivers/media/platform/omap3isp/ispccdc.c 
b/drivers/media/platform/omap3isp/ispccdc.c
index 818aa52..6e0291b 100644
--- a/drivers/media/platform/omap3isp/ispccdc.c
+++ b/drivers/media/platform/omap3isp/ispccdc.c
@@ -2195,7 +2195,7 @@ static int ccdc_enum_frame_size(struct v4l2_subdev *sd,
format.code = fse-code;
format.width = 1;
format.height = 1;
-   ccdc_try_format(ccdc, cfg, fse-pad, format, V4L2_SUBDEV_FORMAT_TRY);
+   ccdc_try_format(ccdc, cfg, fse-pad, format, fse-which);
fse-min_width = format.width;
fse-min_height = format.height;
 
@@ -2205,7 +2205,7 @@ static int ccdc_enum_frame_size(struct v4l2_subdev *sd,
format.code = fse-code;
format.width = -1;
format.height = -1;
-   ccdc_try_format(ccdc, cfg, fse-pad, format, V4L2_SUBDEV_FORMAT_TRY);
+   ccdc_try_format(ccdc, cfg, fse-pad, format, fse-which);
fse-max_width = format.width;
fse-max_height = format.height;
 
diff --git a/drivers/media/platform/omap3isp/ispccp2.c 
b/drivers/media/platform/omap3isp/ispccp2.c
index 1d79368..44c20fa 100644
--- a/drivers/media/platform/omap3isp/ispccp2.c
+++ b/drivers/media/platform/omap3isp/ispccp2.c
@@ -723,7 +723,7 @@ static int ccp2_enum_frame_size(struct v4l2_subdev *sd,
format.code = fse-code;
format.width = 1;
format.height = 1;
-   ccp2_try_format(ccp2, cfg, fse-pad, format, V4L2_SUBDEV_FORMAT_TRY);
+   ccp2_try_format(ccp2, cfg, fse-pad, format, fse-which);
fse-min_width = format.width;
fse-min_height = format.height;
 
@@ -733,7 +733,7 @@ 

[RFCv2 PATCH 02/11] v4l2-subdev: drop get/set_crop pad ops

2014-12-19 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Drop the duplicate get/set_crop pad ops and only use get/set_selection.
It makes no sense to have two duplicate ops in the internal subdev API.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Acked-by: Sakari Ailus sakari.ai...@linux.intel.com
Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Acked-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 drivers/media/v4l2-core/v4l2-subdev.c | 8 
 include/media/v4l2-subdev.h   | 4 
 2 files changed, 12 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-subdev.c 
b/drivers/media/v4l2-core/v4l2-subdev.c
index 543631c..19a034e 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -283,10 +283,6 @@ static long subdev_do_ioctl(struct file *file, unsigned 
int cmd, void *arg)
if (rval)
return rval;
 
-   rval = v4l2_subdev_call(sd, pad, get_crop, subdev_fh, crop);
-   if (rval != -ENOIOCTLCMD)
-   return rval;
-
memset(sel, 0, sizeof(sel));
sel.which = crop-which;
sel.pad = crop-pad;
@@ -308,10 +304,6 @@ static long subdev_do_ioctl(struct file *file, unsigned 
int cmd, void *arg)
if (rval)
return rval;
 
-   rval = v4l2_subdev_call(sd, pad, set_crop, subdev_fh, crop);
-   if (rval != -ENOIOCTLCMD)
-   return rval;
-
memset(sel, 0, sizeof(sel));
sel.which = crop-which;
sel.pad = crop-pad;
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 5860292..b052184 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -503,10 +503,6 @@ struct v4l2_subdev_pad_ops {
   struct v4l2_subdev_format *format);
int (*set_fmt)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
   struct v4l2_subdev_format *format);
-   int (*set_crop)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
-  struct v4l2_subdev_crop *crop);
-   int (*get_crop)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
-  struct v4l2_subdev_crop *crop);
int (*get_selection)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
 struct v4l2_subdev_selection *sel);
int (*set_selection)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
-- 
2.1.3

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


[RFCv2 PATCH 08/11] v4l2-subdev.c: add which checks for enum ops.

2014-12-19 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/v4l2-core/v4l2-subdev.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-subdev.c 
b/drivers/media/v4l2-core/v4l2-subdev.c
index 3c8b198..8bafb94 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -321,6 +321,10 @@ static long subdev_do_ioctl(struct file *file, unsigned 
int cmd, void *arg)
case VIDIOC_SUBDEV_ENUM_MBUS_CODE: {
struct v4l2_subdev_mbus_code_enum *code = arg;
 
+   if (code-which != V4L2_SUBDEV_FORMAT_TRY 
+   code-which != V4L2_SUBDEV_FORMAT_ACTIVE)
+   return -EINVAL;
+
if (code-pad = sd-entity.num_pads)
return -EINVAL;
 
@@ -331,6 +335,10 @@ static long subdev_do_ioctl(struct file *file, unsigned 
int cmd, void *arg)
case VIDIOC_SUBDEV_ENUM_FRAME_SIZE: {
struct v4l2_subdev_frame_size_enum *fse = arg;
 
+   if (fse-which != V4L2_SUBDEV_FORMAT_TRY 
+   fse-which != V4L2_SUBDEV_FORMAT_ACTIVE)
+   return -EINVAL;
+
if (fse-pad = sd-entity.num_pads)
return -EINVAL;
 
@@ -359,6 +367,10 @@ static long subdev_do_ioctl(struct file *file, unsigned 
int cmd, void *arg)
case VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL: {
struct v4l2_subdev_frame_interval_enum *fie = arg;
 
+   if (fie-which != V4L2_SUBDEV_FORMAT_TRY 
+   fie-which != V4L2_SUBDEV_FORMAT_ACTIVE)
+   return -EINVAL;
+
if (fie-pad = sd-entity.num_pads)
return -EINVAL;
 
-- 
2.1.3

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


[RFCv2 PATCH 07/11] v4l2-subdev: support new which field in enum_mbus_code

2014-12-19 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/platform/omap3isp/ispccdc.c| 4 ++--
 drivers/media/platform/omap3isp/ispccp2.c| 2 +-
 drivers/media/platform/omap3isp/ispcsi2.c| 2 +-
 drivers/media/platform/omap3isp/ispresizer.c | 2 +-
 drivers/media/platform/vsp1/vsp1_bru.c   | 4 +++-
 drivers/media/platform/vsp1/vsp1_lif.c   | 4 +++-
 drivers/media/platform/vsp1/vsp1_lut.c   | 4 +++-
 drivers/media/platform/vsp1/vsp1_sru.c   | 4 +++-
 drivers/media/platform/vsp1/vsp1_uds.c   | 4 +++-
 drivers/staging/media/omap4iss/iss_csi2.c| 2 +-
 drivers/staging/media/omap4iss/iss_ipipeif.c | 2 +-
 drivers/staging/media/omap4iss/iss_resizer.c | 2 +-
 12 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/drivers/media/platform/omap3isp/ispccdc.c 
b/drivers/media/platform/omap3isp/ispccdc.c
index b0431a9..818aa52 100644
--- a/drivers/media/platform/omap3isp/ispccdc.c
+++ b/drivers/media/platform/omap3isp/ispccdc.c
@@ -2133,7 +2133,7 @@ static int ccdc_enum_mbus_code(struct v4l2_subdev *sd,
 
case CCDC_PAD_SOURCE_OF:
format = __ccdc_get_format(ccdc, cfg, code-pad,
-  V4L2_SUBDEV_FORMAT_TRY);
+  code-which);
 
if (format-code == MEDIA_BUS_FMT_YUYV8_2X8 ||
format-code == MEDIA_BUS_FMT_UYVY8_2X8) {
@@ -2164,7 +2164,7 @@ static int ccdc_enum_mbus_code(struct v4l2_subdev *sd,
return -EINVAL;
 
format = __ccdc_get_format(ccdc, cfg, code-pad,
-  V4L2_SUBDEV_FORMAT_TRY);
+  code-which);
 
/* A pixel code equal to 0 means that the video port doesn't
 * support the input format. Don't enumerate any pixel code.
diff --git a/drivers/media/platform/omap3isp/ispccp2.c 
b/drivers/media/platform/omap3isp/ispccp2.c
index 3f10c3a..1d79368 100644
--- a/drivers/media/platform/omap3isp/ispccp2.c
+++ b/drivers/media/platform/omap3isp/ispccp2.c
@@ -703,7 +703,7 @@ static int ccp2_enum_mbus_code(struct v4l2_subdev *sd,
return -EINVAL;
 
format = __ccp2_get_format(ccp2, cfg, CCP2_PAD_SINK,
- V4L2_SUBDEV_FORMAT_TRY);
+ code-which);
code-code = format-code;
}
 
diff --git a/drivers/media/platform/omap3isp/ispcsi2.c 
b/drivers/media/platform/omap3isp/ispcsi2.c
index 12ca63f..bde734c 100644
--- a/drivers/media/platform/omap3isp/ispcsi2.c
+++ b/drivers/media/platform/omap3isp/ispcsi2.c
@@ -909,7 +909,7 @@ static int csi2_enum_mbus_code(struct v4l2_subdev *sd,
code-code = csi2_input_fmts[code-index];
} else {
format = __csi2_get_format(csi2, cfg, CSI2_PAD_SINK,
-  V4L2_SUBDEV_FORMAT_TRY);
+  code-which);
switch (code-index) {
case 0:
/* Passthrough sink pad code */
diff --git a/drivers/media/platform/omap3isp/ispresizer.c 
b/drivers/media/platform/omap3isp/ispresizer.c
index 3ede27b..02549fa8 100644
--- a/drivers/media/platform/omap3isp/ispresizer.c
+++ b/drivers/media/platform/omap3isp/ispresizer.c
@@ -1431,7 +1431,7 @@ static int resizer_enum_mbus_code(struct v4l2_subdev *sd,
return -EINVAL;
 
format = __resizer_get_format(res, cfg, RESZ_PAD_SINK,
- V4L2_SUBDEV_FORMAT_TRY);
+ code-which);
code-code = format-code;
}
 
diff --git a/drivers/media/platform/vsp1/vsp1_bru.c 
b/drivers/media/platform/vsp1/vsp1_bru.c
index 90724c3..5bf78d1 100644
--- a/drivers/media/platform/vsp1/vsp1_bru.c
+++ b/drivers/media/platform/vsp1/vsp1_bru.c
@@ -190,6 +190,7 @@ static int bru_enum_mbus_code(struct v4l2_subdev *subdev,
MEDIA_BUS_FMT_ARGB_1X32,
MEDIA_BUS_FMT_AYUV8_1X32,
};
+   struct vsp1_bru *bru = to_bru(subdev);
struct v4l2_mbus_framefmt *format;
 
if (code-pad == BRU_PAD_SINK(0)) {
@@ -201,7 +202,8 @@ static int bru_enum_mbus_code(struct v4l2_subdev *subdev,
if (code-index)
return -EINVAL;
 
-   format = v4l2_subdev_get_try_format(subdev, cfg, 
BRU_PAD_SINK(0));
+   format = vsp1_entity_get_pad_format(bru-entity, cfg,
+   BRU_PAD_SINK(0), 
code-which);
code-code = format-code;
}
 
diff --git a/drivers/media/platform/vsp1/vsp1_lif.c 
b/drivers/media/platform/vsp1/vsp1_lif.c
index b91c925..60f1bd8 100644
--- a/drivers/media/platform/vsp1/vsp1_lif.c
+++ b/drivers/media/platform/vsp1/vsp1_lif.c
@@ 

Re: [RFC] [Patch] implement video driver for sur40

2014-12-19 Thread Florian Echtler
On 19.12.2014 15:36, Hans Verkuil wrote:
 On 12/19/2014 03:30 PM, Florian Echtler wrote:
 Ran the most recent version from git master, got a total of 6 fails, 4
 of which are probably easy fixes:

 fail: v4l2-compliance.cpp(306): missing bus_info prefix ('USB:1')
 test VIDIOC_QUERYCAP: FAIL
 Changed the relevant code to:
   usb_make_path(sur40-usbdev, cap-bus_info, sizeof(cap-bus_info));
  
 fail: v4l2-test-input-output.cpp(455): could set input to invalid input 1
 test VIDIOC_G/S/ENUMINPUT: FAIL
 Now returning -EINVAL when S_INPUT called with input != 0.

 fail: v4l2-test-formats.cpp(322): !colorspace
 fail: v4l2-test-formats.cpp(429): testColorspace(pix.pixelformat,
 pix.colorspace, pix.ycbcr_enc, pix.quantization)
 test VIDIOC_G_FMT: FAIL
 Setting colorspace in v4l2_pix_format to V4L2_COLORSPACE_SRGB.   

 fail: v4l2-compliance.cpp(365): doioctl(node, VIDIOC_G_PRIORITY, prio)
 test VIDIOC_G/S_PRIORITY: FAIL
 Don't know how to fix this - does this mean VIDIOC_G/S_PRIORITY _must_
 be implemented?

 fail: v4l2-test-buffers.cpp(500): q.has_expbuf(node)
 test VIDIOC_EXPBUF: FAIL
 Also not clear how to fix this one.

 Could you give some hints on the last two?
 
 Can you post the driver code you used to run these tests? And which kernel 
 version
 and git tree did you base your patch on?
Driver code is attached (should be identical to the one from initial
mail). Kernel version used for the tests is 3.16.0-25 from Ubuntu
Utopic, git tree for patches is currently
https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git

I'm building the module standalone on the target machine, since it's not
powerful enough that you would want to do a full kernel build. However,
since the driver was merged into mainline, no other changes have been
made, so I think it shouldn't be a problem to patch against the original
git tree?

Best, Florian
-- 
SENT FROM MY DEC VT50 TERMINAL
/*
 * Surface2.0/SUR40/PixelSense input driver
 *
 * Copyright (c) 2013 by Florian 'floe' Echtler f...@butterbrot.org
 *
 * Derived from the USB Skeleton driver 1.1,
 * Copyright (c) 2003 Greg Kroah-Hartman (g...@kroah.com)
 *
 * and from the Apple USB BCM5974 multitouch driver,
 * Copyright (c) 2008 Henrik Rydberg (rydb...@euromail.se)
 *
 * and from the generic hid-multitouch driver,
 * Copyright (c) 2010-2012 Stephane Chatty cha...@enac.fr
 *
 * 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; either version 2 of
 * the License, or (at your option) any later version.
 */

#include linux/kernel.h
#include linux/errno.h
#include linux/delay.h
#include linux/init.h
#include linux/slab.h
#include linux/module.h
#include linux/completion.h
#include linux/uaccess.h
#include linux/usb.h
#include linux/printk.h
#include linux/input-polldev.h
#include linux/input/mt.h
#include linux/usb/input.h
#include linux/videodev2.h
#include media/v4l2-device.h
#include media/v4l2-dev.h
#include media/v4l2-ioctl.h
#include media/videobuf2-dma-contig.h

/* read 512 bytes from endpoint 0x86 - get header + blobs */
struct sur40_header {

	__le16 type;   /* always 0x0001 */
	__le16 count;  /* count of blobs (if 0: continue prev. packet) */

	__le32 packet_id;  /* unique ID for all packets in one frame */

	__le32 timestamp;  /* milliseconds (inc. by 16 or 17 each frame) */
	__le32 unknown;/* epoch? always 02/03 00 00 00 */

} __packed;

struct sur40_blob {

	__le16 blob_id;

	u8 action; /* 0x02 = enter/exit, 0x03 = update (?) */
	u8 unknown;/* always 0x01 or 0x02 (no idea what this is?) */

	__le16 bb_pos_x;   /* upper left corner of bounding box */
	__le16 bb_pos_y;

	__le16 bb_size_x;  /* size of bounding box */
	__le16 bb_size_y;

	__le16 pos_x;  /* finger tip position */
	__le16 pos_y;

	__le16 ctr_x;  /* centroid position */
	__le16 ctr_y;

	__le16 axis_x; /* somehow related to major/minor axis, mostly: */
	__le16 axis_y; /* axis_x == bb_size_y  axis_y == bb_size_x */

	__le32 angle;  /* orientation in radians relative to x axis -
	  actually an IEEE754 float, don't use in kernel */

	__le32 area;   /* size in pixels/pressure (?) */

	u8 padding[32];

} __packed;

/* combined header/blob data */
struct sur40_data {
	struct sur40_header header;
	struct sur40_blob   blobs[];
} __packed;

/* read 512 bytes from endpoint 0x82 - get header below
 * continue reading 16k blocks until header.size bytes read */
struct sur40_image_header {
	__le32 magic; /* SUBF */
	__le32 packet_id;
	__le32 size;  /* always 0x0007e900 = 960x540 */
	__le32 timestamp; /* milliseconds (increases by 16 or 17 each frame) */
	__le32 unknown;   /* epoch? always 02/03 00 00 00 */
} __packed;

/* version information */
#define DRIVER_SHORT   sur40
#define DRIVER_LONGSamsung SUR40
#define DRIVER_AUTHOR  Florian 'floe' Echtler f...@butterbrot.org
#define DRIVER_DESC

[RFCv2 PATCH 10/11] v4l2-subdev: remove enum_framesizes/intervals

2014-12-19 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Replace the video ops enum_framesizes and enum_frameintervals by the pad
ops enum_frame_size and enum_frame_interval.

The video and pad ops are duplicates, so get rid of the more limited video op.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/ov7670.c  | 37 +++
 drivers/media/platform/marvell-ccic/mcam-core.c | 48 ++---
 drivers/media/platform/soc_camera/soc_camera.c  | 30 +++-
 drivers/media/platform/via-camera.c | 15 ++--
 include/media/v4l2-subdev.h |  2 --
 5 files changed, 101 insertions(+), 31 deletions(-)

diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c
index 957927f..b984752 100644
--- a/drivers/media/i2c/ov7670.c
+++ b/drivers/media/i2c/ov7670.c
@@ -1069,29 +1069,35 @@ static int ov7670_s_parm(struct v4l2_subdev *sd, struct 
v4l2_streamparm *parms)
 
 static int ov7670_frame_rates[] = { 30, 15, 10, 5, 1 };
 
-static int ov7670_enum_frameintervals(struct v4l2_subdev *sd,
-   struct v4l2_frmivalenum *interval)
+static int ov7670_enum_frame_interval(struct v4l2_subdev *sd,
+ struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_frame_interval_enum 
*fie)
 {
-   if (interval-index = ARRAY_SIZE(ov7670_frame_rates))
+   if (fie-pad)
return -EINVAL;
-   interval-type = V4L2_FRMIVAL_TYPE_DISCRETE;
-   interval-discrete.numerator = 1;
-   interval-discrete.denominator = ov7670_frame_rates[interval-index];
+   if (fie-index = ARRAY_SIZE(ov7670_frame_rates))
+   return -EINVAL;
+   fie-interval.numerator = 1;
+   fie-interval.denominator = ov7670_frame_rates[fie-index];
return 0;
 }
 
 /*
  * Frame size enumeration
  */
-static int ov7670_enum_framesizes(struct v4l2_subdev *sd,
-   struct v4l2_frmsizeenum *fsize)
+static int ov7670_enum_frame_size(struct v4l2_subdev *sd,
+ struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_frame_size_enum *fse)
 {
struct ov7670_info *info = to_state(sd);
int i;
int num_valid = -1;
-   __u32 index = fsize-index;
+   __u32 index = fse-index;
unsigned int n_win_sizes = info-devtype-n_win_sizes;
 
+   if (fse-pad)
+   return -EINVAL;
+
/*
 * If a minimum width/height was requested, filter out the capture
 * windows that fall outside that.
@@ -1103,9 +1109,8 @@ static int ov7670_enum_framesizes(struct v4l2_subdev *sd,
if (info-min_height  win-height  info-min_height)
continue;
if (index == ++num_valid) {
-   fsize-type = V4L2_FRMSIZE_TYPE_DISCRETE;
-   fsize-discrete.width = win-width;
-   fsize-discrete.height = win-height;
+   fse-min_width = fse-max_width = win-width;
+   fse-min_height = fse-max_height = win-height;
return 0;
}
}
@@ -1485,13 +1490,17 @@ static const struct v4l2_subdev_video_ops 
ov7670_video_ops = {
.s_mbus_fmt = ov7670_s_mbus_fmt,
.s_parm = ov7670_s_parm,
.g_parm = ov7670_g_parm,
-   .enum_frameintervals = ov7670_enum_frameintervals,
-   .enum_framesizes = ov7670_enum_framesizes,
+};
+
+static const struct v4l2_subdev_pad_ops ov7670_pad_ops = {
+   .enum_frame_interval = ov7670_enum_frame_interval,
+   .enum_frame_size = ov7670_enum_frame_size,
 };
 
 static const struct v4l2_subdev_ops ov7670_ops = {
.core = ov7670_core_ops,
.video = ov7670_video_ops,
+   .pad = ov7670_pad_ops,
 };
 
 /* --- */
diff --git a/drivers/media/platform/marvell-ccic/mcam-core.c 
b/drivers/media/platform/marvell-ccic/mcam-core.c
index 193373f..2c9a4d4 100644
--- a/drivers/media/platform/marvell-ccic/mcam-core.c
+++ b/drivers/media/platform/marvell-ccic/mcam-core.c
@@ -1568,24 +1568,64 @@ static int mcam_vidioc_enum_framesizes(struct file 
*filp, void *priv,
struct v4l2_frmsizeenum *sizes)
 {
struct mcam_camera *cam = priv;
+   struct mcam_format_struct *f;
+   struct v4l2_subdev_frame_size_enum fse = {
+   .index = sizes-index,
+   .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+   };
int ret;
 
+   f = mcam_find_format(sizes-pixel_format);
+   if (f-pixelformat != sizes-pixel_format)
+   return -EINVAL;
+   fse.code = f-mbus_code;
mutex_lock(cam-s_mutex);
-   ret = sensor_call(cam, video, enum_framesizes, sizes);
+   ret = sensor_call(cam, pad, enum_frame_size, NULL, fse);
mutex_unlock(cam-s_mutex);
-   return ret;
+   if (ret)
+  

[RFCv2 PATCH 11/11] v4l2-subdev: remove g/s_crop and cropcap from video ops

2014-12-19 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/ak881x.c |  32 +++--
 drivers/media/i2c/soc_camera/imx074.c  |  46 
 drivers/media/i2c/soc_camera/mt9m001.c |  74 +++-
 drivers/media/i2c/soc_camera/mt9m111.c |  61 +-
 drivers/media/i2c/soc_camera/mt9t031.c |  56 +
 drivers/media/i2c/soc_camera/mt9t112.c |  64 +-
 drivers/media/i2c/soc_camera/mt9v022.c |  72 +++-
 drivers/media/i2c/soc_camera/ov2640.c  |  45 ---
 drivers/media/i2c/soc_camera/ov5642.c  |  57 +
 drivers/media/i2c/soc_camera/ov6650.c  |  78 +++--
 drivers/media/i2c/soc_camera/ov772x.c  |  48 
 drivers/media/i2c/soc_camera/ov9640.c  |  45 ---
 drivers/media/i2c/soc_camera/ov9740.c  |  49 
 drivers/media/i2c/soc_camera/rj54n1cb0c.c  |  56 +
 drivers/media/i2c/soc_camera/tw9910.c  |  51 +++-
 drivers/media/i2c/tvp5150.c|  85 +++---
 drivers/media/platform/omap3isp/ispvideo.c |  88 +-
 drivers/media/platform/sh_vou.c|  13 ++-
 drivers/media/platform/soc_camera/mx2_camera.c |  18 ++-
 drivers/media/platform/soc_camera/mx3_camera.c |  18 ++-
 drivers/media/platform/soc_camera/omap1_camera.c   |  23 ++--
 drivers/media/platform/soc_camera/pxa_camera.c |  17 ++-
 drivers/media/platform/soc_camera/rcar_vin.c   |  26 ++---
 .../platform/soc_camera/sh_mobile_ceu_camera.c |  32 +++--
 drivers/media/platform/soc_camera/soc_camera.c | 130 ++---
 .../platform/soc_camera/soc_camera_platform.c  |  49 
 drivers/media/platform/soc_camera/soc_scale_crop.c |  85 --
 drivers/media/platform/soc_camera/soc_scale_crop.h |   6 +-
 drivers/staging/media/omap4iss/iss_video.c |  88 +-
 include/media/soc_camera.h |   7 +-
 include/media/v4l2-subdev.h|   3 -
 31 files changed, 805 insertions(+), 717 deletions(-)

diff --git a/drivers/media/i2c/ak881x.c b/drivers/media/i2c/ak881x.c
index 69aeaf3..29d3b2a 100644
--- a/drivers/media/i2c/ak881x.c
+++ b/drivers/media/i2c/ak881x.c
@@ -128,21 +128,27 @@ static int ak881x_enum_mbus_fmt(struct v4l2_subdev *sd, 
unsigned int index,
return 0;
 }
 
-static int ak881x_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a)
+static int ak881x_get_selection(struct v4l2_subdev *sd,
+   struct v4l2_subdev_pad_config *cfg,
+   struct v4l2_subdev_selection *sel)
 {
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct ak881x *ak881x = to_ak881x(client);
 
-   a-bounds.left  = 0;
-   a-bounds.top   = 0;
-   a-bounds.width = 720;
-   a-bounds.height= ak881x-lines;
-   a-defrect  = a-bounds;
-   a-type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-   a-pixelaspect.numerator= 1;
-   a-pixelaspect.denominator  = 1;
+   if (sel-which != V4L2_SUBDEV_FORMAT_ACTIVE)
+   return -EINVAL;
 
-   return 0;
+   switch (sel-target) {
+   case V4L2_SEL_TGT_CROP_BOUNDS:
+   case V4L2_SEL_TGT_CROP_DEFAULT:
+   sel-r.left = 0;
+   sel-r.top = 0;
+   sel-r.width = 720;
+   sel-r.height = ak881x-lines;
+   return 0;
+   default:
+   return -EINVAL;
+   }
 }
 
 static int ak881x_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std)
@@ -214,15 +220,19 @@ static struct v4l2_subdev_video_ops 
ak881x_subdev_video_ops = {
.s_mbus_fmt = ak881x_s_mbus_fmt,
.g_mbus_fmt = ak881x_try_g_mbus_fmt,
.try_mbus_fmt   = ak881x_try_g_mbus_fmt,
-   .cropcap= ak881x_cropcap,
.enum_mbus_fmt  = ak881x_enum_mbus_fmt,
.s_std_output   = ak881x_s_std_output,
.s_stream   = ak881x_s_stream,
 };
 
+static struct v4l2_subdev_pad_ops ak881x_subdev_pad_ops = {
+   .get_selection  = ak881x_get_selection,
+};
+
 static struct v4l2_subdev_ops ak881x_subdev_ops = {
.core   = ak881x_subdev_core_ops,
.video  = ak881x_subdev_video_ops,
+   .pad= ak881x_subdev_pad_ops,
 };
 
 static int ak881x_probe(struct i2c_client *client,
diff --git a/drivers/media/i2c/soc_camera/imx074.c 
b/drivers/media/i2c/soc_camera/imx074.c
index ec89cfa..a5fc6d5 100644
--- a/drivers/media/i2c/soc_camera/imx074.c
+++ b/drivers/media/i2c/soc_camera/imx074.c
@@ -208,31 +208,26 @@ static int imx074_g_fmt(struct v4l2_subdev *sd,
return 0;
 }
 
-static int imx074_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
+static int 

Re: [RFC] [Patch] implement video driver for sur40

2014-12-19 Thread Hans Verkuil


On 12/19/2014 03:57 PM, Florian Echtler wrote:
 On 19.12.2014 15:36, Hans Verkuil wrote:
 On 12/19/2014 03:30 PM, Florian Echtler wrote:
 Ran the most recent version from git master, got a total of 6 fails, 4
 of which are probably easy fixes:

 fail: v4l2-compliance.cpp(306): missing bus_info prefix ('USB:1')
 test VIDIOC_QUERYCAP: FAIL
 Changed the relevant code to:
   usb_make_path(sur40-usbdev, cap-bus_info, sizeof(cap-bus_info));
 
 fail: v4l2-test-input-output.cpp(455): could set input to invalid input 1
 test VIDIOC_G/S/ENUMINPUT: FAIL
 Now returning -EINVAL when S_INPUT called with input != 0.

 fail: v4l2-test-formats.cpp(322): !colorspace
 fail: v4l2-test-formats.cpp(429): testColorspace(pix.pixelformat,
 pix.colorspace, pix.ycbcr_enc, pix.quantization)
 test VIDIOC_G_FMT: FAIL
 Setting colorspace in v4l2_pix_format to V4L2_COLORSPACE_SRGB.  

 fail: v4l2-compliance.cpp(365): doioctl(node, VIDIOC_G_PRIORITY, prio)
 test VIDIOC_G/S_PRIORITY: FAIL
 Don't know how to fix this - does this mean VIDIOC_G/S_PRIORITY _must_
 be implemented?

 fail: v4l2-test-buffers.cpp(500): q.has_expbuf(node)
 test VIDIOC_EXPBUF: FAIL
 Also not clear how to fix this one.

This is most likely fallout from the G_FMT failure above. If you fix that,
then this should be OK.


 Could you give some hints on the last two?

 Can you post the driver code you used to run these tests? And which kernel 
 version
 and git tree did you base your patch on?
 Driver code is attached (should be identical to the one from initial
 mail). Kernel version used for the tests is 3.16.0-25 from Ubuntu

OK, 3.16 explains the PRIO failure. For that kernel you need to set this
flag in struct video_device:

set_bit(V4L2_FL_USE_FH_PRIO, vdev-flags);

This flag went away in 3.17 or 3.18 since it has now become standard behavior.

 Utopic, git tree for patches is currently
 https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git
 
 I'm building the module standalone on the target machine, since it's not
 powerful enough that you would want to do a full kernel build. However,
 since the driver was merged into mainline, no other changes have been
 made, so I think it shouldn't be a problem to patch against the original
 git tree?

drivers/media remains under heavy development, so for video capture drivers
like yours you should always patch against either the mainline linux tree
or (preferred) the media_tree.git repo (git://linuxtv.org/media_tree.git,
master branch).

Regards,

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


RE: [PATCH 1/2] vb2: Add VB2_FILEIO_ALLOW_ZERO_BYTESUSED flag to vb2_fileio_flags

2014-12-19 Thread Kamil Debski
Hi Jean,

 From: Jean-Michel Hautbois [mailto:jhautb...@gmail.com]
 Sent: Friday, December 19, 2014 3:36 PM
 To: Kamil Debski
 Cc: Linux Media Mailing List; m.szyprow...@samsung.com; Hans Verkuil;
 Nicolas Dufresne
 Subject: Re: [PATCH 1/2] vb2: Add VB2_FILEIO_ALLOW_ZERO_BYTESUSED flag
 to vb2_fileio_flags
 
 Hi Kamil,
 
 2014-12-16 12:36 GMT+01:00 Kamil Debski k.deb...@samsung.com:
  The vb2: fix bytesused == 0 handling (8a75ffb) patch changed the
  behavior of __fill_vb2_buffer function, so that if bytesused is 0 it
  is set to the size of the buffer. However, bytesused set to 0 is used
  by older codec drivers as as indication used to mark the end of
 stream.
 
  To keep backward compatibility, this patch adds a flag passed to the
  vb2_queue_init function - VB2_FILEIO_ALLOW_ZERO_BYTESUSED. If the
 flag
  is set upon initialization of the queue, the videobuf2 keeps the
 value
  of bytesused intact and passes it to the driver.
 
 Nice, this is something we were planning to do :).
 But I would split this patch and the second which is specific to s5p-
 mfc as this is core specific and should be independant.

This patch contains only changes in the videobuf2-core.c file. The next
patch in the series contains changes in the s5p-mfc driver. There is 
another patch sent today that adds this flag to coda. 

These are all separate patches, two of them are in a single patchset.
Actually, I would send all of them in one patchset, but initially I missed
that the coda driver should also have this change applied. (Nicolas, thank
you for reminding me to do this on IRC).

 
 
  Reported-by: Nicolas Dufresne nicolas.dufre...@collabora.com
  Signed-off-by: Kamil Debski k.deb...@samsung.com
  ---
   drivers/media/v4l2-core/videobuf2-core.c |   33
 --
   include/media/videobuf2-core.h   |3 +++
   2 files changed, 30 insertions(+), 6 deletions(-)
 
  diff --git a/drivers/media/v4l2-core/videobuf2-core.c
  b/drivers/media/v4l2-core/videobuf2-core.c
  index d09a891..1068dbb 100644
  --- a/drivers/media/v4l2-core/videobuf2-core.c
  +++ b/drivers/media/v4l2-core/videobuf2-core.c
  @@ -1276,13 +1276,23 @@ static void __fill_vb2_buffer(struct
 vb2_buffer *vb, const struct v4l2_buffer *b
   * userspace clearly never bothered to set it
 and
   * it's a safe assumption that they really
 meant to
   * use the full plane sizes.
  +*
  +* Some drivers, e.g. old codec drivers, use
 bytesused
  +* == 0 as a way to indicate that streaming
 is finished.
  +* In that case, the driver should use the
 following
  +* io_flag VB2_FILEIO_ALLOW_ZERO_BYTESUSED to
 keep old
  +* userspace applications working.
 
 Not sure if this comment is necessary, as this is already in the
 commit ?

The comment were present in the file already, I expanded them to cover the
exception when the VB2_FILEIO_ALLOW_ZERO_BYTESUSED flag is set.
It is also explained in the commit, I agree, but in the end one usually
looks in the source code. 

 
   */
  for (plane = 0; plane  vb-num_planes;
 ++plane) {
  struct v4l2_plane *pdst =
 v4l2_planes[plane];
  struct v4l2_plane *psrc =
  b-m.planes[plane];
 
  -   pdst-bytesused = psrc-bytesused ?
  -   psrc-bytesused : pdst-
 length;
  +   if (vb-vb2_queue-io_flags 
  +
 VB2_FILEIO_ALLOW_ZERO_BYTESUSED)
  +   pdst-bytesused = psrc-
 bytesused;
  +   else
  +   pdst-bytesused = psrc-
 bytesused ?
  +   psrc-bytesused :
  + pdst-length;
  pdst-data_offset = psrc-data_offset;
  }
  }
  @@ -1295,6 +1305,12 @@ static void __fill_vb2_buffer(struct
 vb2_buffer *vb, const struct v4l2_buffer *b
   *
   * If bytesused == 0 for the output buffer, then fall
 back
   * to the full buffer size as that's a sensible
 default.
  +*
  +* Some drivers, e.g. old codec drivers, use
 bytesused == 0
  +* as a way to indicate that streaming is finished.
 In that
  +* case, the driver should use the following io_flag
  +* VB2_FILEIO_ALLOW_ZERO_BYTESUSED to keep old
 userspace
  +* applications working.
 
 Again, not sure this is useful.

Same applies here, I expanded the comment to cover a new case. 

 
   */
  if (b-memory == V4L2_MEMORY_USERPTR) {
  v4l2_planes[0].m.userptr = b-m.userptr; 

Re: [PATCH 1/2] vb2: Add VB2_FILEIO_ALLOW_ZERO_BYTESUSED flag to vb2_fileio_flags

2014-12-19 Thread Jean-Michel Hautbois
2014-12-19 17:03 GMT+01:00 Kamil Debski k.deb...@samsung.com:
 Hi Jean,

 From: Jean-Michel Hautbois [mailto:jhautb...@gmail.com]
 Sent: Friday, December 19, 2014 3:36 PM
 To: Kamil Debski
 Cc: Linux Media Mailing List; m.szyprow...@samsung.com; Hans Verkuil;
 Nicolas Dufresne
 Subject: Re: [PATCH 1/2] vb2: Add VB2_FILEIO_ALLOW_ZERO_BYTESUSED flag
 to vb2_fileio_flags

 Hi Kamil,

 2014-12-16 12:36 GMT+01:00 Kamil Debski k.deb...@samsung.com:
  The vb2: fix bytesused == 0 handling (8a75ffb) patch changed the
  behavior of __fill_vb2_buffer function, so that if bytesused is 0 it
  is set to the size of the buffer. However, bytesused set to 0 is used
  by older codec drivers as as indication used to mark the end of
 stream.
 
  To keep backward compatibility, this patch adds a flag passed to the
  vb2_queue_init function - VB2_FILEIO_ALLOW_ZERO_BYTESUSED. If the
 flag
  is set upon initialization of the queue, the videobuf2 keeps the
 value
  of bytesused intact and passes it to the driver.

 Nice, this is something we were planning to do :).
 But I would split this patch and the second which is specific to s5p-
 mfc as this is core specific and should be independant.

 This patch contains only changes in the videobuf2-core.c file. The next
 patch in the series contains changes in the s5p-mfc driver. There is
 another patch sent today that adds this flag to coda.

 These are all separate patches, two of them are in a single patchset.
 Actually, I would send all of them in one patchset, but initially I missed
 that the coda driver should also have this change applied. (Nicolas, thank
 you for reminding me to do this on IRC).

OK, This is why I have been confused. Well, I still think that core
modification should be a separate patch, and maybe s5f-mpc and coda be
in the same patchset. Not a problem.



  Reported-by: Nicolas Dufresne nicolas.dufre...@collabora.com
  Signed-off-by: Kamil Debski k.deb...@samsung.com
  ---
   drivers/media/v4l2-core/videobuf2-core.c |   33
 --
   include/media/videobuf2-core.h   |3 +++
   2 files changed, 30 insertions(+), 6 deletions(-)
 
  diff --git a/drivers/media/v4l2-core/videobuf2-core.c
  b/drivers/media/v4l2-core/videobuf2-core.c
  index d09a891..1068dbb 100644
  --- a/drivers/media/v4l2-core/videobuf2-core.c
  +++ b/drivers/media/v4l2-core/videobuf2-core.c
  @@ -1276,13 +1276,23 @@ static void __fill_vb2_buffer(struct
 vb2_buffer *vb, const struct v4l2_buffer *b
   * userspace clearly never bothered to set it
 and
   * it's a safe assumption that they really
 meant to
   * use the full plane sizes.
  +*
  +* Some drivers, e.g. old codec drivers, use
 bytesused
  +* == 0 as a way to indicate that streaming
 is finished.
  +* In that case, the driver should use the
 following
  +* io_flag VB2_FILEIO_ALLOW_ZERO_BYTESUSED to
 keep old
  +* userspace applications working.

 Not sure if this comment is necessary, as this is already in the
 commit ?

 The comment were present in the file already, I expanded them to cover the
 exception when the VB2_FILEIO_ALLOW_ZERO_BYTESUSED flag is set.
 It is also explained in the commit, I agree, but in the end one usually
 looks in the source code.

OK


   */
  for (plane = 0; plane  vb-num_planes;
 ++plane) {
  struct v4l2_plane *pdst =
 v4l2_planes[plane];
  struct v4l2_plane *psrc =
  b-m.planes[plane];
 
  -   pdst-bytesused = psrc-bytesused ?
  -   psrc-bytesused : pdst-
 length;
  +   if (vb-vb2_queue-io_flags 
  +
 VB2_FILEIO_ALLOW_ZERO_BYTESUSED)
  +   pdst-bytesused = psrc-
 bytesused;
  +   else
  +   pdst-bytesused = psrc-
 bytesused ?
  +   psrc-bytesused :
  + pdst-length;
  pdst-data_offset = psrc-data_offset;
  }
  }
  @@ -1295,6 +1305,12 @@ static void __fill_vb2_buffer(struct
 vb2_buffer *vb, const struct v4l2_buffer *b
   *
   * If bytesused == 0 for the output buffer, then fall
 back
   * to the full buffer size as that's a sensible
 default.
  +*
  +* Some drivers, e.g. old codec drivers, use
 bytesused == 0
  +* as a way to indicate that streaming is finished.
 In that
  +* case, the driver should use the following io_flag
  +* VB2_FILEIO_ALLOW_ZERO_BYTESUSED to keep old
 userspace
  +* applications working.

 

warning: (VIDEO_PVRUSB2 ..) selects VIDEO_TUNER which has unmet direct dependencies (MEDIA_SUPPORT ..)

2014-12-19 Thread kbuild test robot
tree:   git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   d790be3863b28fd22e0781c1a3ddefcbfd5f7086
commit: ea2e813e8cc3492c951b9895724fd47187e04a6f [media] tlg2300: move to 
staging in preparation for removal
date:   3 days ago
config: i386-randconfig-hxa6 (attached as .config)
reproduce:
  git checkout ea2e813e8cc3492c951b9895724fd47187e04a6f
  # save the attached .config to linux build tree
  make ARCH=i386 

All warnings:

warning: (VIDEO_PVRUSB2  VIDEO_USBVISION  VIDEO_GO7007  VIDEO_AU0828_V4L2 
 VIDEO_CX231XX  VIDEO_TM6000  VIDEO_EM28XX  VIDEO_IVTV  VIDEO_MXB  
VIDEO_CX18  VIDEO_CX23885  VIDEO_CX88  VIDEO_BT848  VIDEO_SAA7134  
VIDEO_SAA7164  VIDEO_TLG2300) selects VIDEO_TUNER which has unmet direct 
dependencies (MEDIA_SUPPORT  MEDIA_TUNER)

---
0-DAY kernel test infrastructureOpen Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
#
# Automatically generated file; DO NOT EDIT.
# Linux/i386 3.18.0-rc4 Kernel Configuration
#
# CONFIG_64BIT is not set
CONFIG_X86_32=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT=elf32-i386
CONFIG_ARCH_DEFCONFIG=arch/x86/configs/i386_defconfig
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_MMU=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_GENERIC_BUG=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_ARCH_HAS_CPU_RELAX=y
CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
CONFIG_HAVE_SETUP_PER_CPU_AREA=y
CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y
CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
# CONFIG_ZONE_DMA32 is not set
# CONFIG_AUDIT_ARCH is not set
CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
CONFIG_HAVE_INTEL_TXT=y
CONFIG_ARCH_HWEIGHT_CFLAGS=-fcall-saved-ecx -fcall-saved-edx
CONFIG_ARCH_SUPPORTS_UPROBES=y
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_DEFCONFIG_LIST=/lib/modules/$UNAME_RELEASE/.config
CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_EXTABLE_SORT=y

#
# General setup
#
CONFIG_BROKEN_ON_SMP=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_CROSS_COMPILE=
# CONFIG_COMPILE_TEST is not set
CONFIG_LOCALVERSION=
CONFIG_LOCALVERSION_AUTO=y
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_HAVE_KERNEL_LZ4=y
# CONFIG_KERNEL_GZIP is not set
# CONFIG_KERNEL_BZIP2 is not set
CONFIG_KERNEL_LZMA=y
# CONFIG_KERNEL_XZ is not set
# CONFIG_KERNEL_LZO is not set
# CONFIG_KERNEL_LZ4 is not set
CONFIG_DEFAULT_HOSTNAME=(none)
CONFIG_SWAP=y
# CONFIG_SYSVIPC is not set
CONFIG_POSIX_MQUEUE=y
# CONFIG_CROSS_MEMORY_ATTACH is not set
CONFIG_FHANDLE=y
CONFIG_USELIB=y
# CONFIG_AUDIT is not set
CONFIG_HAVE_ARCH_AUDITSYSCALL=y

#
# IRQ subsystem
#
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_IRQ_LEGACY_ALLOC_HWIRQ=y
CONFIG_GENERIC_IRQ_CHIP=y
CONFIG_IRQ_DOMAIN=y
CONFIG_IRQ_DOMAIN_DEBUG=y
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_SPARSE_IRQ=y
CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_ARCH_CLOCKSOURCE_DATA=y
CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=y
CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y
CONFIG_GENERIC_CMOS_UPDATE=y

#
# Timers subsystem
#
CONFIG_HZ_PERIODIC=y
# CONFIG_NO_HZ_IDLE is not set
CONFIG_NO_HZ=y
# CONFIG_HIGH_RES_TIMERS is not set

#
# CPU/Task time and stats accounting
#
CONFIG_TICK_CPU_ACCOUNTING=y
# CONFIG_IRQ_TIME_ACCOUNTING is not set
# CONFIG_BSD_PROCESS_ACCT is not set
CONFIG_TASKSTATS=y
# CONFIG_TASK_DELAY_ACCT is not set
CONFIG_TASK_XACCT=y
# CONFIG_TASK_IO_ACCOUNTING is not set

#
# RCU Subsystem
#
CONFIG_TINY_RCU=y
# CONFIG_PREEMPT_RCU is not set
# CONFIG_TASKS_RCU is not set
CONFIG_RCU_STALL_COMMON=y
# CONFIG_TREE_RCU_TRACE is not set
CONFIG_BUILD_BIN2C=y
CONFIG_IKCONFIG=y
CONFIG_LOG_BUF_SHIFT=17
CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
# CONFIG_CGROUPS is not set
CONFIG_CHECKPOINT_RESTORE=y
# CONFIG_NAMESPACES is not set
# CONFIG_SCHED_AUTOGROUP is not set
# CONFIG_SYSFS_DEPRECATED is not set
CONFIG_RELAY=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=
CONFIG_RD_GZIP=y
CONFIG_RD_BZIP2=y
CONFIG_RD_LZMA=y
CONFIG_RD_XZ=y
# CONFIG_RD_LZO is not set
# CONFIG_RD_LZ4 is not set
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
CONFIG_ANON_INODES=y
CONFIG_HAVE_UID16=y
CONFIG_SYSCTL_EXCEPTION_TRACE=y
CONFIG_HAVE_PCSPKR_PLATFORM=y
CONFIG_BPF=y
CONFIG_EXPERT=y
# CONFIG_UID16 is not set
# CONFIG_SGETMASK_SYSCALL is not set
# CONFIG_SYSFS_SYSCALL is not set
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y
CONFIG_PRINTK=y
CONFIG_BUG=y
# CONFIG_ELF_CORE is not set
CONFIG_PCSPKR_PLATFORM=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_EPOLL=y
CONFIG_SIGNALFD=y
# CONFIG_TIMERFD is not set
# 

Re: [PATCH 1/7] ARM: at91: dts: sama5d3: add isi clock

2014-12-19 Thread Alexandre Belloni
On 18/12/2014 at 16:51:01 +0800, Josh Wu wrote :
 Add ISI peripheral clock in sama5d3.dtsi.
 
 Signed-off-by: Josh Wu josh...@atmel.com
Acked-by: Alexandre Belloni alexandre.bell...@free-electrons.com

 ---
  arch/arm/boot/dts/sama5d3.dtsi | 2 ++
  1 file changed, 2 insertions(+)
 
 diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
 index 5f4144d..61746ef 100644
 --- a/arch/arm/boot/dts/sama5d3.dtsi
 +++ b/arch/arm/boot/dts/sama5d3.dtsi
 @@ -214,6 +214,8 @@
   compatible = atmel,at91sam9g45-isi;
   reg = 0xf0034000 0x4000;
   interrupts = 37 IRQ_TYPE_LEVEL_HIGH 5;
 + clocks = isi_clk;
 + clock-names = isi_clk;
   status = disabled;
   };
  
 -- 
 1.9.1
 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/7] ARM: at91: dts: sama5d3: change name of pinctrl_isi_{power,reset}

2014-12-19 Thread Alexandre Belloni
Hi Josh,

On 18/12/2014 at 16:51:05 +0800, Josh Wu wrote :
 For sama5d3xmb board, the pins: pinctrl_isi_{power,reset} is used to
 power-down or reset camera sensor.
 
 So we should let camera sensor instead of ISI to configure the pins.
 This patch will change pinctrl name from pinctrl_isi_{power,reset} to
 pinctrl_sensor_{power,reset}.
 
 Signed-off-by: Josh Wu josh...@atmel.com
 ---
  arch/arm/boot/dts/sama5d3.dtsi| 2 ++
  arch/arm/boot/dts/sama5d3xmb.dtsi | 6 ++
  2 files changed, 4 insertions(+), 4 deletions(-)
 
 diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
 index ed734e9..ff0fa3a 100644
 --- a/arch/arm/boot/dts/sama5d3.dtsi
 +++ b/arch/arm/boot/dts/sama5d3.dtsi
 @@ -214,6 +214,8 @@
   compatible = atmel,at91sam9g45-isi;
   reg = 0xf0034000 0x4000;
   interrupts = 37 IRQ_TYPE_LEVEL_HIGH 5;
 + pinctrl-names = default;
 + pinctrl-0 = pinctrl_isi_data_0_7;

This should probably not be is that patch.

   clocks = isi_clk;
   clock-names = isi_clk;
   status = disabled;
 diff --git a/arch/arm/boot/dts/sama5d3xmb.dtsi 
 b/arch/arm/boot/dts/sama5d3xmb.dtsi
 index 6af1cba..0aaebc6 100644
 --- a/arch/arm/boot/dts/sama5d3xmb.dtsi
 +++ b/arch/arm/boot/dts/sama5d3xmb.dtsi
 @@ -60,8 +60,6 @@
   };
  
   isi: isi@f0034000 {
 - pinctrl-names = default;
 - pinctrl-0 = pinctrl_isi_data_0_7 
 pinctrl_isi_pck_as_mck pinctrl_isi_power pinctrl_isi_reset;
   };
  
   mmc1: mmc@f800 {
 @@ -122,12 +120,12 @@
   AT91_PIOD 31 
 AT91_PERIPH_B AT91_PINCTRL_NONE; /* PD31 periph B ISI_MCK */
   };
  
 - pinctrl_isi_reset: isi_reset-0 {
 + pinctrl_sensor_reset: sensor_reset-0 {
   atmel,pins =
   AT91_PIOE 24 
 AT91_PERIPH_GPIO AT91_PINCTRL_NONE;   /* PE24 gpio */
   };
  
 - pinctrl_isi_power: isi_power-0 {
 + pinctrl_sensor_power: sensor_power-0 {
   atmel,pins =
   AT91_PIOE 29 
 AT91_PERIPH_GPIO AT91_PINCTRL_NONE; /* PE29 gpio */
   };
 -- 
 1.9.1
 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/7] ARM: at91: dts: sama5d3: split isi pinctrl

2014-12-19 Thread Alexandre Belloni
On 18/12/2014 at 16:51:02 +0800, Josh Wu wrote :
 From: Bo Shen voice.s...@atmel.com
 
 As the ISI has 12 data lines, however we only use 8 data lines with
 sensor module. So, split the data line into two groups which make
 it can be choosed depends on the hardware design.
 
 Signed-off-by: Bo Shen voice.s...@atmel.com
 Acked-by: Nicolas Ferre nicolas.fe...@atmel.com
Acked-by: Alexandre Belloni alexandre.bell...@free-electrons.com
 Signed-off-by: Josh Wu josh...@atmel.com
 ---
  arch/arm/boot/dts/sama5d3.dtsi| 11 ---
  arch/arm/boot/dts/sama5d3xmb.dtsi |  2 +-
  2 files changed, 9 insertions(+), 4 deletions(-)
 
 diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
 index 61746ef..595609f 100644
 --- a/arch/arm/boot/dts/sama5d3.dtsi
 +++ b/arch/arm/boot/dts/sama5d3.dtsi
 @@ -547,7 +547,7 @@
   };
  
   isi {
 - pinctrl_isi: isi-0 {
 + pinctrl_isi_data_0_7: isi-0-data-0-7 {
   atmel,pins =
   AT91_PIOA 16 
 AT91_PERIPH_C AT91_PINCTRL_NONE   /* PA16 periph C ISI_D0, conflicts with 
 LCDDAT16 */
AT91_PIOA 17 
 AT91_PERIPH_C AT91_PINCTRL_NONE   /* PA17 periph C ISI_D1, conflicts with 
 LCDDAT17 */
 @@ -559,10 +559,15 @@
AT91_PIOA 23 
 AT91_PERIPH_C AT91_PINCTRL_NONE   /* PA23 periph C ISI_D7, conflicts with 
 LCDDAT23, PWML1 */
AT91_PIOC 30 
 AT91_PERIPH_C AT91_PINCTRL_NONE   /* PC30 periph C ISI_PCK, conflicts with 
 UTXD0 */
AT91_PIOA 31 
 AT91_PERIPH_C AT91_PINCTRL_NONE   /* PA31 periph C ISI_HSYNC, conflicts with 
 TWCK0, UTXD1 */
 -  AT91_PIOA 30 
 AT91_PERIPH_C AT91_PINCTRL_NONE   /* PA30 periph C ISI_VSYNC, conflicts with 
 TWD0, URXD1 */
 -  AT91_PIOC 29 
 AT91_PERIPH_C AT91_PINCTRL_NONE   /* PC29 periph C ISI_PD8, conflicts with 
 URXD0, PWMFI2 */
 +  AT91_PIOA 30 
 AT91_PERIPH_C AT91_PINCTRL_NONE; /* PA30 periph C ISI_VSYNC, conflicts with 
 TWD0, URXD1 */
 + };
 +
 + pinctrl_isi_data_8_9: isi-0-data-8-9 {
 + atmel,pins =
 + AT91_PIOC 29 
 AT91_PERIPH_C AT91_PINCTRL_NONE   /* PC29 periph C ISI_PD8, conflicts with 
 URXD0, PWMFI2 */
AT91_PIOC 28 
 AT91_PERIPH_C AT91_PINCTRL_NONE; /* PC28 periph C ISI_PD9, conflicts with 
 SPI1_NPCS3, PWMFI0 */
   };
 +
   pinctrl_isi_pck_as_mck: 
 isi_pck_as_mck-0 {
   atmel,pins =
   AT91_PIOD 31 
 AT91_PERIPH_B AT91_PINCTRL_NONE; /* PD31 periph B ISI_MCK */
 diff --git a/arch/arm/boot/dts/sama5d3xmb.dtsi 
 b/arch/arm/boot/dts/sama5d3xmb.dtsi
 index 49c10d3..2530541 100644
 --- a/arch/arm/boot/dts/sama5d3xmb.dtsi
 +++ b/arch/arm/boot/dts/sama5d3xmb.dtsi
 @@ -61,7 +61,7 @@
  
   isi: isi@f0034000 {
   pinctrl-names = default;
 - pinctrl-0 = pinctrl_isi 
 pinctrl_isi_pck_as_mck pinctrl_isi_power pinctrl_isi_reset;
 + pinctrl-0 = pinctrl_isi_data_0_7 
 pinctrl_isi_pck_as_mck pinctrl_isi_power pinctrl_isi_reset;
   };
  
   mmc1: mmc@f800 {
 -- 
 1.9.1
 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/7] ARM: at91: dts: sama5d3: add missing pins of isi

2014-12-19 Thread Alexandre Belloni
On 18/12/2014 at 16:51:03 +0800, Josh Wu wrote :
 From: Bo Shen voice.s...@atmel.com
 
 The ISI has 12 data lines, add the missing two data lines.
 
 Signed-off-by: Bo Shen voice.s...@atmel.com
 Acked-by: Nicolas Ferre nicolas.fe...@atmel.com
Acked-by: Alexandre Belloni alexandre.bell...@free-electrons.com

 ---
  arch/arm/boot/dts/sama5d3.dtsi | 6 ++
  1 file changed, 6 insertions(+)
 
 diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
 index 595609f..b3ac156 100644
 --- a/arch/arm/boot/dts/sama5d3.dtsi
 +++ b/arch/arm/boot/dts/sama5d3.dtsi
 @@ -568,6 +568,12 @@
AT91_PIOC 28 
 AT91_PERIPH_C AT91_PINCTRL_NONE; /* PC28 periph C ISI_PD9, conflicts with 
 SPI1_NPCS3, PWMFI0 */
   };
  
 + pinctrl_isi_data_10_11: 
 isi-0-data-10-11 {
 + atmel,pins =
 + AT91_PIOC 27 
 AT91_PERIPH_C AT91_PINCTRL_NONE   /* PC27 periph C ISI_PD10, conflicts with 
 SPI1_NPCS2, TWCK1 */
 +  AT91_PIOC 26 
 AT91_PERIPH_C AT91_PINCTRL_NONE; /* PC26 periph C ISI_PD11, conflicts with 
 SPI1_NPCS1, TWD1 */
 + };
 +
   pinctrl_isi_pck_as_mck: 
 isi_pck_as_mck-0 {
   atmel,pins =
   AT91_PIOD 31 
 AT91_PERIPH_B AT91_PINCTRL_NONE; /* PD31 periph B ISI_MCK */
 -- 
 1.9.1
 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/7] ARM: at91: dts: sama5d3: move the isi mck pin to mb

2014-12-19 Thread Alexandre Belloni
On 18/12/2014 at 16:51:04 +0800, Josh Wu wrote :
 From: Bo Shen voice.s...@atmel.com
 
 The mck is decided by the board design, move it to mb related
 dtsi file.
 
 Signed-off-by: Bo Shen voice.s...@atmel.com
 Acked-by: Nicolas Ferre nicolas.fe...@atmel.com
Acked-by: Alexandre Belloni alexandre.bell...@free-electrons.com

 Signed-off-by: Josh Wu josh...@atmel.com
 ---
  arch/arm/boot/dts/sama5d3.dtsi| 5 -
  arch/arm/boot/dts/sama5d3xmb.dtsi | 5 +
  2 files changed, 5 insertions(+), 5 deletions(-)
 
 diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
 index b3ac156..ed734e9 100644
 --- a/arch/arm/boot/dts/sama5d3.dtsi
 +++ b/arch/arm/boot/dts/sama5d3.dtsi
 @@ -573,11 +573,6 @@
   AT91_PIOC 27 
 AT91_PERIPH_C AT91_PINCTRL_NONE   /* PC27 periph C ISI_PD10, conflicts with 
 SPI1_NPCS2, TWCK1 */
AT91_PIOC 26 
 AT91_PERIPH_C AT91_PINCTRL_NONE; /* PC26 periph C ISI_PD11, conflicts with 
 SPI1_NPCS1, TWD1 */
   };
 -
 - pinctrl_isi_pck_as_mck: 
 isi_pck_as_mck-0 {
 - atmel,pins =
 - AT91_PIOD 31 
 AT91_PERIPH_B AT91_PINCTRL_NONE; /* PD31 periph B ISI_MCK */
 - };
   };
  
   mmc0 {
 diff --git a/arch/arm/boot/dts/sama5d3xmb.dtsi 
 b/arch/arm/boot/dts/sama5d3xmb.dtsi
 index 2530541..6af1cba 100644
 --- a/arch/arm/boot/dts/sama5d3xmb.dtsi
 +++ b/arch/arm/boot/dts/sama5d3xmb.dtsi
 @@ -117,6 +117,11 @@
   AT91_PIOD 30 
 AT91_PERIPH_B AT91_PINCTRL_NONE; /* PD30 periph B */
   };
  
 + pinctrl_isi_pck_as_mck: 
 isi_pck_as_mck-0 {
 + atmel,pins =
 + AT91_PIOD 31 
 AT91_PERIPH_B AT91_PINCTRL_NONE; /* PD31 periph B ISI_MCK */
 + };
 +
   pinctrl_isi_reset: isi_reset-0 {
   atmel,pins =
   AT91_PIOE 24 
 AT91_PERIPH_GPIO AT91_PINCTRL_NONE;   /* PE24 gpio */
 -- 
 1.9.1
 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 6/7] ARM: at91: dts: sama5d3: add ov2640 camera sensor support

2014-12-19 Thread Alexandre Belloni
On 18/12/2014 at 16:51:06 +0800, Josh Wu wrote :
 According to v4l2 dt document, we add:
   a camera host: ISI port.
   a i2c camera sensor: ov2640 port.
 to sama5d3xmb.dtsi.
 
 In the ov2640 node, it defines the pinctrls, clocks and isi port.
 In the ISI node, it also reference to a ov2640 port.
 
 Signed-off-by: Josh Wu josh...@atmel.com
 ---
  arch/arm/boot/dts/sama5d3xmb.dtsi | 32 
  1 file changed, 32 insertions(+)
 
 diff --git a/arch/arm/boot/dts/sama5d3xmb.dtsi 
 b/arch/arm/boot/dts/sama5d3xmb.dtsi
 index 0aaebc6..958a528 100644
 --- a/arch/arm/boot/dts/sama5d3xmb.dtsi
 +++ b/arch/arm/boot/dts/sama5d3xmb.dtsi
 @@ -52,6 +52,29 @@
   };
   };
  
 + i2c1: i2c@f0018000 {
 + ov2640: camera@0x30 {
 + compatible = ovti,ov2640;
 + reg = 0x30;
 + pinctrl-names = default;
 + pinctrl-0 = pinctrl_isi_pck_as_mck 
 pinctrl_sensor_power pinctrl_sensor_reset;

I've acked your previous patch but maybe it should be named
pinctrl_isi_pck1_as_mck to be clearer (you used the handle to pck1
below).

 + resetb-gpios = pioE 24 
 GPIO_ACTIVE_LOW;
 + pwdn-gpios = pioE 29 
 GPIO_ACTIVE_HIGH;
 + /* use pck1 for the master clock of 
 ov2640 */
 + clocks = pck1;
 + clock-names = xvclk;
 + assigned-clocks = pck1;
 + assigned-clock-rates = 2500;
 +
 + port {
 + ov2640_0: endpoint {
 + remote-endpoint = 
 isi_0;
 + bus-width = 8;
 + };
 + };
 + };
 + };
 +
   usart1: serial@f002 {
   dmas = 0, 0;/*  Do not use DMA for 
 usart1 */
   pinctrl-names = default;
 @@ -60,6 +83,15 @@
   };
  
   isi: isi@f0034000 {
 + port {
 + #address-cells = 1;
 + #size-cells = 0;
 +
 + isi_0: endpoint {
 + remote-endpoint = ov2640_0;
 + bus-width = 8;
 + };
 + };
   };
  
   mmc1: mmc@f800 {
 -- 
 1.9.1
 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 7/7] ARM: at91: sama5: enable atmel-isi and ov2640 in defconfig

2014-12-19 Thread Alexandre Belloni
On 18/12/2014 at 16:51:07 +0800, Josh Wu wrote :
 Signed-off-by: Josh Wu josh...@atmel.com
Acked-by: Alexandre Belloni alexandre.bell...@free-electrons.com
 ---
  arch/arm/configs/sama5_defconfig | 6 ++
  1 file changed, 6 insertions(+)
 
 diff --git a/arch/arm/configs/sama5_defconfig 
 b/arch/arm/configs/sama5_defconfig
 index b58fb32..92f1d71 100644
 --- a/arch/arm/configs/sama5_defconfig
 +++ b/arch/arm/configs/sama5_defconfig
 @@ -139,6 +139,12 @@ CONFIG_POWER_RESET=y
  CONFIG_SSB=m
  CONFIG_REGULATOR=y
  CONFIG_REGULATOR_ACT8865=y
 +CONFIG_MEDIA_SUPPORT=y
 +CONFIG_MEDIA_CAMERA_SUPPORT=y
 +CONFIG_V4L_PLATFORM_DRIVERS=y
 +CONFIG_SOC_CAMERA=y
 +CONFIG_SOC_CAMERA_OV2640=y
 +CONFIG_VIDEO_ATMEL_ISI=y
  CONFIG_FB=y
  CONFIG_BACKLIGHT_LCD_SUPPORT=y
  # CONFIG_LCD_CLASS_DEVICE is not set
 -- 
 1.9.1
 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [linux-sunxi] [PATCH v2 04/13] rc: sunxi-cir: Add support for an optional reset controller

2014-12-19 Thread Maxime Ripard
Hi,

On Thu, Dec 18, 2014 at 09:50:26AM +0100, Hans de Goede wrote:
 Hi,
 
 On 18-12-14 03:48, Chen-Yu Tsai wrote:
 Hi,
 
 On Thu, Dec 18, 2014 at 1:18 AM, Hans de Goede hdego...@redhat.com wrote:
 On sun6i the cir block is attached to the reset controller, add support
 for de-asserting the reset if a reset controller is specified in dt.
 
 Signed-off-by: Hans de Goede hdego...@redhat.com
 Acked-by: Mauro Carvalho Chehab mche...@osg.samsung.com
 Acked-by: Maxime Ripard maxime.rip...@free-electrons.com
 ---
   .../devicetree/bindings/media/sunxi-ir.txt |  2 ++
   drivers/media/rc/sunxi-cir.c   | 25 
  --
   2 files changed, 25 insertions(+), 2 deletions(-)
 
 diff --git a/Documentation/devicetree/bindings/media/sunxi-ir.txt 
 b/Documentation/devicetree/bindings/media/sunxi-ir.txt
 index 23dd5ad..6b70b9b 100644
 --- a/Documentation/devicetree/bindings/media/sunxi-ir.txt
 +++ b/Documentation/devicetree/bindings/media/sunxi-ir.txt
 @@ -10,6 +10,7 @@ Required properties:
 
   Optional properties:
   - linux,rc-map-name : Remote control map name.
 +- resets : phandle + reset specifier pair
 
 Should it be optional? Or should we use a sun6i compatible with
 a mandatory reset phandle? I mean, the driver/hardware is not
 going to work with the reset missing on sun6i.
 
 Seems we are doing it one way for some of our drivers, and
 the other (optional) way for more generic ones, like USB.
 
 I do not believe that we should add a new compatible just because
 the reset line of a block is hooked up differently. It is the
 exact same ip-block. Only now the reset is not controlled
 through the apb-gate, but controlled separately.

He has a point though. Your driver might very well probe nicely and
everything, but still wouldn't be functional at all because the reset
line wouldn't have been specified in the DT.

The easiest way to deal with that would be in the bindings doc to
update it with a compatible for the A31, and mentionning that the
reset property is mandatory there.

Note that the code itself might not change at all though. I'd just
like to avoid any potential breaking of the DT bindings themselves. If
we further want to refine the code, we can do that however we want.

I have a slight preference for a clean error if reset is missing, but
I won't get in the way just for that.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature


Re: [PATCH v2 09/13] ARM: dts: sun6i: Add ir node

2014-12-19 Thread Maxime Ripard
On Wed, Dec 17, 2014 at 06:18:20PM +0100, Hans de Goede wrote:
 Add a node for the ir receiver found on the A31.
 
 Signed-off-by: Hans de Goede hdego...@redhat.com

Applied, thanks!

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature


Re: [PATCH v2 11/13] ARM: dts: sun6i: Enable ir receiver on the Mele M9

2014-12-19 Thread Maxime Ripard
On Wed, Dec 17, 2014 at 06:18:22PM +0100, Hans de Goede wrote:
 The Mele M9 has an ir receiver, enable it.
 
 Signed-off-by: Hans de Goede hdego...@redhat.com

Applied, thanks!

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature


Re: [PATCH v2 03/13] ARM: sunxi: Add allwinner,sun6i-a31s to mach-sunxi

2014-12-19 Thread Maxime Ripard
On Wed, Dec 17, 2014 at 06:18:14PM +0100, Hans de Goede wrote:
 So far the A31s is 100% compatible with the A31, still lets do the same
 as what we've done for the A13 / A10s and give it its own compatible string,
 in case we need to differentiate later.
 
 Signed-off-by: Hans de Goede hdego...@redhat.com

Applied, thanks!

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature


Re: [PATCH v2 06/13] clk: sunxi: Make the mod0 clk driver also a platform driver

2014-12-19 Thread Maxime Ripard
Hi,

On Wed, Dec 17, 2014 at 06:18:17PM +0100, Hans de Goede wrote:
 With the prcm in sun6i (and some later SoCs) some mod0 clocks are instantiated
 through the mfd framework, and as such do not work with of_clk_declare, since
 they do not have registers assigned to them yet at of_clk_declare init time.
 
 Silence the error on not finding registers in the of_clk_declare mod0 clk
 setup method, and also register mod0-clk support as a platform driver to work
 properly with mfd instantiated mod0 clocks.
 
 Signed-off-by: Hans de Goede hdego...@redhat.com
 ---
  drivers/clk/sunxi/clk-mod0.c | 41 -
  1 file changed, 36 insertions(+), 5 deletions(-)
 
 diff --git a/drivers/clk/sunxi/clk-mod0.c b/drivers/clk/sunxi/clk-mod0.c
 index 658d74f..7ddab6f 100644
 --- a/drivers/clk/sunxi/clk-mod0.c
 +++ b/drivers/clk/sunxi/clk-mod0.c
 @@ -17,6 +17,7 @@
  #include linux/clk-provider.h
  #include linux/clkdev.h
  #include linux/of_address.h
 +#include linux/platform_device.h
  
  #include clk-factors.h
  
 @@ -67,7 +68,7 @@ static struct clk_factors_config sun4i_a10_mod0_config = {
   .pwidth = 2,
  };
  
 -static const struct factors_data sun4i_a10_mod0_data __initconst = {
 +static const struct factors_data sun4i_a10_mod0_data = {
   .enable = 31,
   .mux = 24,
   .muxmask = BIT(1) | BIT(0),
 @@ -82,17 +83,47 @@ static void __init sun4i_a10_mod0_setup(struct 
 device_node *node)
   void __iomem *reg;
  
   reg = of_iomap(node, 0);
 - if (!reg) {
 - pr_err(Could not get registers for mod0-clk: %s\n,
 -node-name);
 + if (!reg)
   return;
 - }

A comment here would be nice to mention that this is intentional.

It looks good otherwise, thanks!

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature


Re: [PATCH v2 08/13] ARM: dts: sun6i: Add ir_clk node

2014-12-19 Thread Maxime Ripard
On Wed, Dec 17, 2014 at 06:18:19PM +0100, Hans de Goede wrote:
 Add an ir_clk sub-node to the prcm node.
 
 Signed-off-by: Hans de Goede hdego...@redhat.com

Applied, thanks!

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature


Re: [PATCH v2 12/13] ARM: dts: sun6i: Add sun6i-a31s.dtsi

2014-12-19 Thread Maxime Ripard
On Wed, Dec 17, 2014 at 06:18:23PM +0100, Hans de Goede wrote:
 Add a dtsi file for A31s based boards.
 
 Since the  A31s is the same die as the A31 in a different package, this dtsi
 simply includes sun6i-a31.dtsi and then overrides the pinctrl compatible to
 reflect the different package, everything else is identical.
 
 Signed-off-by: Hans de Goede hdego...@redhat.com
 ---
 Changes in v2:
 -include sun6i-a31.dtsi and override the pinctrl compatible, rather then
  copying everything
 ---
  arch/arm/boot/dts/sun6i-a31s.dtsi | 62 
 +++
  1 file changed, 62 insertions(+)
  create mode 100644 arch/arm/boot/dts/sun6i-a31s.dtsi
 
 diff --git a/arch/arm/boot/dts/sun6i-a31s.dtsi 
 b/arch/arm/boot/dts/sun6i-a31s.dtsi
 new file mode 100644
 index 000..d0bd2b9
 --- /dev/null
 +++ b/arch/arm/boot/dts/sun6i-a31s.dtsi
 @@ -0,0 +1,62 @@
 +/*
 + * Copyright 2014 Hans de Goede hdego...@redhat.com
 + *
 + * This file is dual-licensed: you can use it either under the terms
 + * of the GPL or the X11 license, at your option. Note that this dual
 + * licensing only applies to this file, and not this project as a
 + * whole.
 + *
 + *  a) This library 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; either version 2 of the
 + * License, or (at your option) any later version.
 + *
 + * This library is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public
 + * License along with this library; if not, write to the Free
 + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
 + * MA 02110-1301 USA
 + *
 + * Or, alternatively,
 + *
 + *  b) Permission is hereby granted, free of charge, to any person
 + * obtaining a copy of this software and associated documentation
 + * files (the Software), to deal in the Software without
 + * restriction, including without limitation the rights to use,
 + * copy, modify, merge, publish, distribute, sublicense, and/or
 + * sell copies of the Software, and to permit persons to whom the
 + * Software is furnished to do so, subject to the following
 + * conditions:
 + *
 + * The above copyright notice and this permission notice shall be
 + * included in all copies or substantial portions of the Software.
 + *
 + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 + * OTHER DEALINGS IN THE SOFTWARE.
 + */
 +
 +/*
 + * The A31s is the same die as the A31 in a different package, this is
 + * reflected by it having different pinctrl compatible everything else is
 + * identical.
 + */
 +
 +/include/ sun6i-a31.dtsi
 +
 +/ {
 + soc@01c0 {
 + pio: pinctrl@01c20800 {
 + compatible = allwinner,sun6i-a31s-pinctrl;
 + };
 + };
 +};

Given your previous changes, you should also update the enable-method.

Also, for this patch and the next one, Arnd just warned me that we
shouldn't duplicate the DT path, and that we should switch to the new
trend on using label references (like what TI or Amlogic does for
example).

I'll take care on converting the existing users, but could you repost
these patches with this ?

Thanks,
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature


Re: [PATCH v2 01/13] pinctrl: sun6i: Add some missing functions

2014-12-19 Thread Maxime Ripard
On Wed, Dec 17, 2014 at 06:18:12PM +0100, Hans de Goede wrote:
 While working on pinctrl for the A31s, I noticed that function 4 of
 PA15 - PA18 was missing, add these.
 
 Signed-off-by: Hans de Goede hdego...@redhat.com

Acked-by: Maxime Ripard maxime.rip...@free-electrons.com

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature


Re: [PATCH v2 02/13] pinctrl: sun6i: Add A31s pinctrl support

2014-12-19 Thread Maxime Ripard
On Wed, Dec 17, 2014 at 06:18:13PM +0100, Hans de Goede wrote:
 The A31s is a stripped down version of the A31, as such it is missing some
 pins and some functions on some pins.
 
 The new pinctrl-sun6i-a31s.c this commit adds is a copy of 
 pinctrl-sun6i-a31s.c

I guess you meant pinctrl-sun6i-a31.c for the second one, right?

 with the missing pins and functions removed.
 
 Note there is no a31s specific version of pinctrl-sun6i-a31-r.c, as the
 prcm pins are identical between the A31 and the A31s.
 
 Signed-off-by: Hans de Goede hdego...@redhat.com

Acked-by: Maxime Ripard maxime.rip...@free-electrons.com

We should probably refactor it at some point like mvebu does though to
deal with similar pin sets like this and the A31.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature


Re: [PATCH v4 2/5] media: ov2640: add async probe function

2014-12-19 Thread Guennadi Liakhovetski
On Fri, 19 Dec 2014, Josh Wu wrote:

 Hi, Guennadi
 
 Thanks for the review.
 
 On 12/19/2014 5:59 AM, Guennadi Liakhovetski wrote:
  Hi Josh,
  
  Thanks for your patches!
  
  On Thu, 18 Dec 2014, Josh Wu wrote:
  
   To support async probe for ov2640, we need remove the code to get 'mclk'
   in ov2640_probe() function. oterwise, if soc_camera host is not probed
   in the moment, then we will fail to get 'mclk' and quit the ov2640_probe()
   function.
   
   So in this patch, we move such 'mclk' getting code to ov2640_s_power()
   function. That make ov2640 survive, as we can pass a NULL (priv-clk) to
   soc_camera_set_power() function.
   
   And if soc_camera host is probed, the when ov2640_s_power() is called,
   then we can get the 'mclk' and that make us enable/disable soc_camera
   host's clock as well.
   
   Signed-off-by: Josh Wu josh...@atmel.com
   ---
   v3 - v4:
   v2 - v3:
   v1 - v2:
  no changes.
   
 drivers/media/i2c/soc_camera/ov2640.c | 31
   +--
 1 file changed, 21 insertions(+), 10 deletions(-)
   
   diff --git a/drivers/media/i2c/soc_camera/ov2640.c
   b/drivers/media/i2c/soc_camera/ov2640.c
   index 1fdce2f..9ee910d 100644
   --- a/drivers/media/i2c/soc_camera/ov2640.c
   +++ b/drivers/media/i2c/soc_camera/ov2640.c
   @@ -739,6 +739,15 @@ static int ov2640_s_power(struct v4l2_subdev *sd, int
   on)
 struct i2c_client *client = v4l2_get_subdevdata(sd);
 struct soc_camera_subdev_desc *ssdd = 
   soc_camera_i2c_to_desc(client);
 struct ov2640_priv *priv = to_ov2640(client);
   + struct v4l2_clk *clk;
   +
   + if (!priv-clk) {
   + clk = v4l2_clk_get(client-dev, mclk);
   + if (IS_ERR(clk))
   + dev_warn(client-dev, Cannot get the mclk. maybe
   soc-camera host is not probed yet.\n);
   + else
   + priv-clk = clk;
   + }
 return soc_camera_set_power(client-dev, ssdd, priv-clk,
   on);
 }

Ok, think about this: you check whether priv-clk is set on each 
.s_power() call, which is already a bit awkward. Such approach can be used 
when there's no other way to perform a one-time action, but here we have 
one. But never mind, that's not the main problem. If priv-clk isn't set, 
you try to acquire it. But during probing, when this function is called 
for the first time clock isn't available yet, but you still want to 
succeed probing. So, you just issue a warning and continue. But then later 
an application opens the camera, .s_power() is called again, but for some 
reason the clock might still be not available, and this time you should 
fail. But you don't, you succeed and then you'll fail somewhere later, 
presumably, with a timeout waiting for frames. Am I right?

   @@ -1078,21 +1087,21 @@ static int ov2640_probe(struct i2c_client *client,
 if (priv-hdl.error)
 return priv-hdl.error;
 -   priv-clk = v4l2_clk_get(client-dev, mclk);
   - if (IS_ERR(priv-clk)) {
   - ret = PTR_ERR(priv-clk);
   - goto eclkget;
   - }
   -
 ret = ov2640_video_probe(client);
  The first thing the above ov2640_video_probe() function will do is call
  ov2640_s_power(), which will request the clock. So, by moving requesting
  the clock from ov2640_probe() to ov2640_s_power() doesn't change how
  probing will be performed, am I right?
 yes, you are right. In this patch, the mclk will requested by
 ov2640_s_power().
 
 The reason why I put the getting mclk code from ov2640_probe() to
 ov2640_s_power() is : as the mclk here is camera host's peripheral clock.
 That means ov2640 still can be probed properly (read ov2640 id) even no
 mclk. So when I move this code to ov2640_s_power(), otherwise the
 ov2640_probe() will be failed or DEFER_PROBE.
 
 Is this true for all camera host? If it's not true, then I think use
 -EPROBE_DEFER would be a proper way.

Sorry, not sure what your question is. And I'm not sure ov2640's registers 
can be accessed with no running clock. I think some camera sensors can do 
this, but I have no idea about this one. How did you verify? Is it 
mentioned in a datasheet? Or did you really disconnected (grounded) the 
sensor clock input and tried to access its reqisters? If you just 
verified, that it's working without requesting the clock, are you sure 
your clock output isn't running permanently all the time anyway?

Thanks
Guennadi

 
 
  Or are there any other patched,
  that change that, that I'm overseeing?
  
  If I'm right, then I would propose an approach, already used in other
  drivers instead of this one: return -EPROBE_DEFER if the clock isn't
  available during probing. See ef6672ea35b5bb64ab42e18c1a1ffc717c31588a for
  an example. Or did I misunderstand anything?
 Actually months ago I already done a version of ov2640 patch which use
 -EPROBE_DEFER way.
 
 But now I think the ov2640 can be probed correctly without mclk, so it is no
 need to return -EPROBE_DEFER.
 And 

[PATCH] media: fix au0828_analog_register() to not free au0828_dev

2014-12-19 Thread Shuah Khan
From: Shuah Khan shua...@osg.samsung.com

au0828_analog_register() frees au0828_dev when it fails to
locate isoc endpoint. au0828_usb_probe() continues with dvb
and rc probe and registration assuming dev is still valid.
When au0828_analog_register() fails to locate isoc endpoint,
it should return without free'ing au0828_dev. Otherwise, the
probe will fail as dev is null when au0828_dvb_register() is
called.

Signed-off-by: Shuah Khan shua...@osg.samsung.com
---
 drivers/media/usb/au0828/au0828-video.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/usb/au0828/au0828-video.c 
b/drivers/media/usb/au0828/au0828-video.c
index 3bdf132..94b65b8 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -1713,7 +1713,6 @@ int au0828_analog_register(struct au0828_dev *dev,
}
if (!(dev-isoc_in_endpointaddr)) {
pr_info(Could not locate isoc endpoint\n);
-   kfree(dev);
return -ENODEV;
}
 
-- 
2.1.0

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


Re: [PATCH] media: fix au0828_analog_register() to not free au0828_dev

2014-12-19 Thread Shuah Khan
On 12/19/2014 04:42 PM, Shuah Khan wrote:
 From: Shuah Khan shua...@osg.samsung.com

Sorry. That doesn't look right. Looks like my gitconfig
is bad. I can resend the patch.

-- Shuah
 
 au0828_analog_register() frees au0828_dev when it fails to
 locate isoc endpoint. au0828_usb_probe() continues with dvb
 and rc probe and registration assuming dev is still valid.
 When au0828_analog_register() fails to locate isoc endpoint,
 it should return without free'ing au0828_dev. Otherwise, the
 probe will fail as dev is null when au0828_dvb_register() is
 called.
 
 Signed-off-by: Shuah Khan shua...@osg.samsung.com
 ---
  drivers/media/usb/au0828/au0828-video.c | 1 -
  1 file changed, 1 deletion(-)
 
 diff --git a/drivers/media/usb/au0828/au0828-video.c 
 b/drivers/media/usb/au0828/au0828-video.c
 index 3bdf132..94b65b8 100644
 --- a/drivers/media/usb/au0828/au0828-video.c
 +++ b/drivers/media/usb/au0828/au0828-video.c
 @@ -1713,7 +1713,6 @@ int au0828_analog_register(struct au0828_dev *dev,
   }
   if (!(dev-isoc_in_endpointaddr)) {
   pr_info(Could not locate isoc endpoint\n);
 - kfree(dev);
   return -ENODEV;
   }
  
 


-- 
Shuah Khan
Sr. Linux Kernel Developer
Samsung Open Source Group
Samsung Research America (Silicon Valley)
shua...@osg.samsung.com | (970) 217-8978
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


cron job: media_tree daily build: ERRORS

2014-12-19 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Sat Dec 20 04:00:22 CET 2014
git branch: test
git hash:   427ae153c65ad7a08288d86baf99000569627d03
gcc version:i686-linux-gcc (GCC) 4.9.1
sparse version: v0.5.0-41-g6c2d743
smatch version: 0.4.1-3153-g7d56ab3
host hardware:  x86_64
host os:3.17-3.slh.2-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.32.27-i686: OK
linux-2.6.33.7-i686: OK
linux-2.6.34.7-i686: OK
linux-2.6.35.9-i686: OK
linux-2.6.36.4-i686: OK
linux-2.6.37.6-i686: OK
linux-2.6.38.8-i686: OK
linux-2.6.39.4-i686: OK
linux-3.0.60-i686: OK
linux-3.1.10-i686: OK
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: OK
linux-3.7.4-i686: OK
linux-3.8-i686: OK
linux-3.9.2-i686: OK
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12.23-i686: OK
linux-3.13.11-i686: OK
linux-3.14.9-i686: OK
linux-3.15.2-i686: OK
linux-3.16-i686: OK
linux-3.17-i686: OK
linux-3.18-i686: OK
linux-2.6.32.27-x86_64: OK
linux-2.6.33.7-x86_64: OK
linux-2.6.34.7-x86_64: OK
linux-2.6.35.9-x86_64: OK
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
linux-3.0.60-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: OK
linux-3.9.2-x86_64: OK
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12.23-x86_64: OK
linux-3.13.11-x86_64: OK
linux-3.14.9-x86_64: OK
linux-3.15.2-x86_64: OK
linux-3.16-x86_64: OK
linux-3.17-x86_64: OK
linux-3.18-x86_64: OK
apps: OK
spec-git: OK
sparse: ERRORS
smatch: ERRORS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Saturday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Saturday.tar.bz2

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/media.html
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Vážený Webmail užívateľa,

2014-12-19 Thread webmail update



--
Vážený Webmail užívateľa,

Vaša poštová schránka prekročila pridelený limit úložiska, ako je 
stanovené správcom, nebudete môcť odosielať alebo prijímať nové pošty, 
kým upgradu pridelenú kvótu.


Ak chcete aktualizovať kvótu, Prosím, kliknite tu

http://updattw22111.jigsy.com/

Ďakujeme vám za vašu očakávaný spoluprácu.

správca systému
Pre Webmail tím podpory
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html