Skip to contentSkip to conversation

Add support for DELTA video decoder of STMicroelectronics STiH4xx SoC series

PATCH In review Hugues Fruchet 2 participants 13 messages Feb 2, 2017 – Feb 8, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v7 cover Add support for DELTA video decoder of STMicroelectronics STiH4xx SoC series

This patchset introduces a basic support for DELTA multi-format video decoder of STMicroelectronics STiH4xx SoC series.

DELTA hardware IP is controlled by a remote firmware loaded in a ST231 coprocessor. Communication with firmware is done within an IPC layer using rpmsg kernel framework and a shared memory for messages handling. This driver is compatible with firmware version 21.1-3. While a single firmware is loaded in ST231 coprocessor, it is composed of several firmwares, one per video format family.

This DELTA V4L2 driver is designed around files:
- delta-v4l2.c : handles V4L2 APIs using M2M framework and calls decoder ops
- delta-<codec>* : implements <codec> decoder calling its associated video firmware (for ex. MJPEG) using IPC layer
- delta-ipc.c : IPC layer which handles communication with firmware using rpmsg

This first basic support implements only MJPEG hardware acceleration but the driver structure is in place to support all the features of the DELTA video decoder hardware IP.

This driver depends on:
- ST remoteproc/rpmsg:
- https://lkml.org/lkml/2017/1/31/389: remoteproc: st: add virtio_rpmsg support
- https://lkml.org/lkml/2017/1/31/415: virtio_rpmsg: make rpmsg channel configurable
- ST DELTA firmware: its license is under review. When available,
pull request will be done on linux-firmware.

===========
= history =
===========
version 7
- update after v6 review:
- devicetree: move delta section from stih410.dtsi to stih407-family.dtsi.
- missing "[media]" prefix in last commit
- Acked-by: Peter Griffin <[email protected]>

version 6
- update after v5 review:
- rework configuration in order to build driver only if at least one decoder is selected.

version 5
- update after v4 review:
- fixed warning in case of no decoder selected in config
- fixed multiple lines comments
- dev_info changed to dev_dbg for summary trace (from HVA driver review)

version 4
- update after v3 review:
- "select" RPMSG instead "depends on"
- v4l2-compliance S_SELECTION is no more failed till sync on latest v4l2-compliance codebase
- sparse warnings fixes

version 3
- update after v2 review:
- fixed m2m_buf_done missing on start_streaming error case
- fixed q->dev missing in queue_init()
- removed unsupported s_selection
- refactored string namings in delta-debug.c
- fixed space before comment
- all commits have commit messages
- reword memory allocator helper commit

version 2
- update after v1 review:
- simplified tracing
- G_/S_SELECTION reworked to fit COMPOSE(CAPTURE)
- fixed m2m_buf_done missing on start_streaming error case
- fixed q->dev missing in queue_init()
- switch to kernel-4.9 rpmsg API
- DELTA support added in multi_v7_defconfig
- minor typo fixes & code cleanup

version 1:
- Initial submission

===================
= v4l2-compliance =
===================
Below is the v4l2-compliance report for the version 4 of the DELTA video decoder driver. v4l2-compliance has been build from SHA1:
003f31e59f353b4aecc82e8fb1c7555964da7efa (v4l2-compliance: allow S_SELECTION to return ENOTTY)

root@sti-4:~# v4l2-compliance -d /dev/video0
v4l2-compliance SHA   : 003f31e59f353b4aecc82e8fb1c7555964da7efa

Driver Info:

	Driver name   : st-delta
	Card type     : st-delta-21.1-3
	Bus info      : platform:soc:delta0
	Driver version: 4.9.0
	Capabilities  : 0x84208000
		Video Memory-to-Memory
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps   : 0x04208000
		Video Memory-to-Memory
		Streaming
		Extended Pix Format

Compliance test for device /dev/video0 (not using libv4l2):

Required ioctls:
test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
test second video open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK

Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (Not Supported)

Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0

Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)

Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported) test VIDIOC_QUERYCTRL: OK (Not Supported)
test VIDIOC_G/S_CTRL: OK (Not Supported)
test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported) test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported) test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 0 Private Controls: 0

Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
test VIDIOC_G/S_PARM: OK (Not Supported)
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK
warn: sources/v4l-utils/utils/v4l2-compliance/v4l2-test-formats.cpp(717): TRY_FMT cannot handle an invalid pixelformat.
warn: sources/v4l-utils/utils/v4l2-compliance/v4l2-test-formats.cpp(718): This may or may not be a problem. For more information see:
warn: sources/v4l-utils/utils/v4l2-compliance/v4l2-test-formats.cpp(719): http://www.mail-archive.com/[email protected]/msg56550.html
test VIDIOC_TRY_FMT: OK
warn: sources/v4l-utils/utils/v4l2-compliance/v4l2-test-formats.cpp(977): S_FMT cannot handle an invalid pixelformat.
warn: sources/v4l-utils/utils/v4l2-compliance/v4l2-test-formats.cpp(978): This may or may not be a problem. For more information see:
warn: sources/v4l-utils/utils/v4l2-compliance/v4l2-test-formats.cpp(979): http://www.mail-archive.com/[email protected]/msg56550.html
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK
test Scaling: OK

Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK

Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test VIDIOC_EXPBUF: OK

Test input 0:

Total: 43, Succeeded: 43, Failed: 0, Warnings: 6

Hugues Fruchet (10):
Documentation: DT: add bindings for ST DELTA
ARM: dts: STiH407-family: add DELTA dt node
ARM: multi_v7_defconfig: enable STMicroelectronics DELTA Support [media] MAINTAINERS: add st-delta driver
[media] st-delta: STiH4xx multi-format video decoder v4l2 driver [media] st-delta: add memory allocator helper functions [media] st-delta: rpmsg ipc support
[media] st-delta: EOS (End Of Stream) support
[media] st-delta: add mjpeg support
[media] st-delta: debug: trace stream/frame information & summary

 .../devicetree/bindings/media/st,st-delta.txt      |   17 +
 MAINTAINERS                                        |    8 +
 arch/arm/boot/dts/stih407-family.dtsi              |   10 +
 arch/arm/configs/multi_v7_defconfig                |    1 +
 drivers/media/platform/Kconfig                     |   39 +
 drivers/media/platform/Makefile                    |    2 +
 drivers/media/platform/sti/delta/Makefile          |    6 +
 drivers/media/platform/sti/delta/delta-cfg.h       |   64 +
 drivers/media/platform/sti/delta/delta-debug.c     |   72 +
 drivers/media/platform/sti/delta/delta-debug.h     |   18 +
 drivers/media/platform/sti/delta/delta-ipc.c       |  594 ++++++
 drivers/media/platform/sti/delta/delta-ipc.h       |   76 +
 drivers/media/platform/sti/delta/delta-mem.c       |   51 +
 drivers/media/platform/sti/delta/delta-mem.h       |   14 +
 drivers/media/platform/sti/delta/delta-mjpeg-dec.c |  455 +++++
 drivers/media/platform/sti/delta/delta-mjpeg-fw.h  |  225 +++
 drivers/media/platform/sti/delta/delta-mjpeg-hdr.c |  149 ++
 drivers/media/platform/sti/delta/delta-mjpeg.h     |   35 +
 drivers/media/platform/sti/delta/delta-v4l2.c      | 1993 ++++++++++++++++++++
 drivers/media/platform/sti/delta/delta.h           |  566 ++++++
 20 files changed, 4395 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/st,st-delta.txt
 create mode 100644 drivers/media/platform/sti/delta/Makefile
 create mode 100644 drivers/media/platform/sti/delta/delta-cfg.h
 create mode 100644 drivers/media/platform/sti/delta/delta-debug.c
 create mode 100644 drivers/media/platform/sti/delta/delta-debug.h
 create mode 100644 drivers/media/platform/sti/delta/delta-ipc.c
 create mode 100644 drivers/media/platform/sti/delta/delta-ipc.h
 create mode 100644 drivers/media/platform/sti/delta/delta-mem.c
 create mode 100644 drivers/media/platform/sti/delta/delta-mem.h
 create mode 100644 drivers/media/platform/sti/delta/delta-mjpeg-dec.c
 create mode 100644 drivers/media/platform/sti/delta/delta-mjpeg-fw.h
 create mode 100644 drivers/media/platform/sti/delta/delta-mjpeg-hdr.c
 create mode 100644 drivers/media/platform/sti/delta/delta-mjpeg.h
 create mode 100644 drivers/media/platform/sti/delta/delta-v4l2.c
 create mode 100644 drivers/media/platform/sti/delta/delta.h
Signature · 1 line
1.9.1
#1 lore raw

PATCH v7 1/10 Documentation: DT: add bindings for ST DELTA

This patch adds DT binding documentation for STMicroelectronics DELTA V4L2 video decoder.

---
 Documentation/devicetree/bindings/media/st,st-delta.txt | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/st,st-delta.txt
Documentation/devicetree/bindings/media/st,st-delta.txt new file +17 -0
new file mode 100644
index 0000000..a538ab3
@@ -0,0 +1,17 @@
+* STMicroelectronics DELTA multi-format video decoder
+
+Required properties:
+- compatible: should be "st,st-delta".
+- clocks: from common clock binding: handle hardware IP needed clocks, the
+  number of clocks may depend on the SoC type.
+  See ../clock/clock-bindings.txt for details.
+- clock-names: names of the clocks listed in clocks property in the same order.
+
+Example:
+	delta0 {
+		compatible = "st,st-delta";
+		clock-names = "delta", "delta-st231", "delta-flash-promip";
+		clocks = <&clk_s_c0_flexgen CLK_VID_DMU>,
+			 <&clk_s_c0_flexgen CLK_ST231_DMU>,
+			 <&clk_s_c0_flexgen CLK_FLASH_PROMIP>;
+	};
Signature · 1 line
1.9.1
#2 lore raw

PATCH v7 2/10 ARM: dts: STiH407-family: add DELTA dt node

In reply to Hugues Fruchet

This patch adds DT node for STMicroelectronics
DELTA V4L2 video decoder

---
 arch/arm/boot/dts/stih407-family.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/boot/dts/stih407-family.dtsi +10 -0
index c8b2944..c32933a 100644
@@ -1002,5 +1002,15 @@
 
 			status = "disabled";
 		};
+
+		delta0 {
+			compatible = "st,st-delta";
+			clock-names = "delta",
+				      "delta-st231",
+				      "delta-flash-promip";
+			clocks = <&clk_s_c0_flexgen CLK_VID_DMU>,
+				 <&clk_s_c0_flexgen CLK_ST231_DMU>,
+				 <&clk_s_c0_flexgen CLK_FLASH_PROMIP>;
+		};
 	};
 };
Signature · 1 line
1.9.1
#3 lore raw

PATCH v7 3/10 ARM: multi_v7_defconfig: enable STMicroelectronics DELTA Support

In reply to Hugues Fruchet

Enables support of STMicroelectronics STiH4xx SoC series DELTA multi-format video decoder V4L2 driver.

---
 arch/arm/configs/multi_v7_defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/configs/multi_v7_defconfig +1 -0
index b01a438..5dff8fe 100644
@@ -569,6 +569,7 @@ CONFIG_VIDEO_SAMSUNG_S5P_MFC=m
 CONFIG_VIDEO_SAMSUNG_EXYNOS_GSC=m
 CONFIG_VIDEO_STI_BDISP=m
 CONFIG_VIDEO_STI_HVA=m
+CONFIG_VIDEO_STI_DELTA=m
 CONFIG_VIDEO_RENESAS_JPU=m
 CONFIG_VIDEO_RENESAS_VSP1=m
 CONFIG_V4L_TEST_DRIVERS=y
Signature · 1 line
1.9.1
#4 lore raw

PATCH v7 4/10 MAINTAINERS: add st-delta driver

In reply to Hugues Fruchet

Add entry for the STMicroelectronics DELTA driver.

---
 MAINTAINERS | 8 ++++++++
 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
index cfff2c9..38cc652 100644
@@ -2429,6 +2429,14 @@ W:	https://linuxtv.org
 S:	Supported
 F:	drivers/media/platform/sti/bdisp
 
+DELTA ST MEDIA DRIVER
+M:	Hugues Fruchet <[email protected]>
+L:	[email protected]
+T:	git git://linuxtv.org/media_tree.git
+W:	https://linuxtv.org
+S:	Supported
+F:	drivers/media/platform/sti/delta
+
 BEFS FILE SYSTEM
 M:	Luis de Bethencourt <[email protected]>
 M:	Salah Triki <[email protected]>
Signature · 1 line
1.9.1
#5 lore raw

PATCH v7 5/10 st-delta: STiH4xx multi-format video decoder v4l2 driver

In reply to Hugues Fruchet

This V4L2 driver enables DELTA multi-format video decoder of STMicroelectronics STiH4xx SoC series.

---
 drivers/media/platform/Kconfig                |   28 +
 drivers/media/platform/Makefile               |    2 +
 drivers/media/platform/sti/delta/Makefile     |    2 +
 drivers/media/platform/sti/delta/delta-cfg.h  |   61 +
 drivers/media/platform/sti/delta/delta-v4l2.c | 1813 +++++++++++++++++++++++++
 drivers/media/platform/sti/delta/delta.h      |  514 +++++++
 6 files changed, 2420 insertions(+)
 create mode 100644 drivers/media/platform/sti/delta/Makefile
 create mode 100644 drivers/media/platform/sti/delta/delta-cfg.h
 create mode 100644 drivers/media/platform/sti/delta/delta-v4l2.c
 create mode 100644 drivers/media/platform/sti/delta/delta.h
drivers/media/platform/Kconfig +28 -0
index d944421..2247d9d 100644
@@ -298,6 +298,34 @@ config VIDEO_STI_HVA
 	  To compile this driver as a module, choose M here:
 	  the module will be called st-hva.
 
+config VIDEO_STI_DELTA
+	tristate "STMicroelectronics DELTA multi-format video decoder V4L2 driver"
+	depends on VIDEO_DEV && VIDEO_V4L2
+	depends on ARCH_STI || COMPILE_TEST
+	depends on HAS_DMA
+	help
+		This V4L2 driver enables DELTA multi-format video decoder
+		of STMicroelectronics STiH4xx SoC series allowing hardware
+		decoding of various compressed video bitstream format in
+		raw uncompressed format.
+
+		Use this option to see the decoders available for such
+		hardware.
+
+		Please notice that the driver will only be built if
+		at least one of the DELTA decoder below is selected.
+
+if VIDEO_STI_DELTA
+
+config VIDEO_STI_DELTA_DRIVER
+	tristate
+	depends on VIDEO_STI_DELTA
+	default n
+	select VIDEOBUF2_DMA_CONTIG
+	select V4L2_MEM2MEM_DEV
+
+endif # VIDEO_STI_DELTA
+
 config VIDEO_SH_VEU
 	tristate "SuperH VEU mem2mem video processing driver"
 	depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA
drivers/media/platform/Makefile +2 -0
index 5b3cb27..349ddf6 100644
@@ -39,6 +39,8 @@ obj-$(CONFIG_VIDEO_STI_BDISP)		+= sti/bdisp/
 obj-$(CONFIG_VIDEO_STI_HVA)		+= sti/hva/
 obj-$(CONFIG_DVB_C8SECTPFE)		+= sti/c8sectpfe/
 
+obj-$(CONFIG_VIDEO_STI_DELTA)		+= sti/delta/
+
 obj-$(CONFIG_BLACKFIN)                  += blackfin/
 
 obj-$(CONFIG_ARCH_DAVINCI)		+= davinci/
drivers/media/platform/sti/delta/Makefile new file +2 -0
new file mode 100644
index 0000000..467519e
@@ -0,0 +1,2 @@
+obj-$(CONFIG_VIDEO_STI_DELTA_DRIVER) := st-delta.o
+st-delta-y := delta-v4l2.o
drivers/media/platform/sti/delta/delta-cfg.h new file +61 -0

61 lines not on this page · raw message

drivers/media/platform/sti/delta/delta-v4l2.c new file +1813 -0

1,813 lines not on this page · raw message

drivers/media/platform/sti/delta/delta.h new file +514 -0

514 lines not on this page · raw message

Signature · 1 line
1.9.1
#7 lore raw

PATCH v7 7/10 st-delta: rpmsg ipc support

In reply to Hugues Fruchet

IPC (Inter Process Communication) support for communication with DELTA coprocessor firmware using rpmsg kernel framework.
Based on 4 services open/set_stream/decode/close and their associated rpmsg messages.
The messages structures are duplicated on both host and firmware side and are packed (use only of 32 bits size fields in messages structures to ensure packing).
Each service is synchronous; service returns only when firmware acknowledges the associated command message.
Due to significant parameters size exchanged from host to copro, parameters are not inserted in rpmsg messages. Instead, parameters are stored in physical memory shared between host and coprocessor. Memory is non-cacheable, so no special operation is required to ensure memory coherency on host and on coprocessor side. Multi-instance support and re-entrance are ensured using host_hdl and copro_hdl in message header exchanged between both host and coprocessor. This avoids to manage tables on both sides to get back the running context of each instance.

---
 drivers/media/platform/Kconfig                |   1 +
 drivers/media/platform/sti/delta/Makefile     |   2 +-
 drivers/media/platform/sti/delta/delta-ipc.c  | 594 ++++++++++++++++++++++++++
 drivers/media/platform/sti/delta/delta-ipc.h  |  76 ++++
 drivers/media/platform/sti/delta/delta-v4l2.c |  11 +
 drivers/media/platform/sti/delta/delta.h      |  21 +
 6 files changed, 704 insertions(+), 1 deletion(-)
 create mode 100644 drivers/media/platform/sti/delta/delta-ipc.c
 create mode 100644 drivers/media/platform/sti/delta/delta-ipc.h
drivers/media/platform/Kconfig +1 -0
index 2247d9d..2e82ec6 100644
@@ -323,6 +323,7 @@ config VIDEO_STI_DELTA_DRIVER
 	default n
 	select VIDEOBUF2_DMA_CONTIG
 	select V4L2_MEM2MEM_DEV
+	select RPMSG
 
 endif # VIDEO_STI_DELTA
 
drivers/media/platform/sti/delta/Makefile +1 -1
index 93a3037..b791ba0 100644
@@ -1,2 +1,2 @@
 obj-$(CONFIG_VIDEO_STI_DELTA_DRIVER) := st-delta.o
-st-delta-y := delta-v4l2.o delta-mem.o
+st-delta-y := delta-v4l2.o delta-mem.o delta-ipc.o
drivers/media/platform/sti/delta/delta-ipc.c new file +594 -0

594 lines not on this page · raw message

drivers/media/platform/sti/delta/delta-ipc.h new file +76 -0

76 lines not on this page · raw message

drivers/media/platform/sti/delta/delta-v4l2.c +11 -0
index e65a3a3..237a938 100644
@@ -17,6 +17,7 @@
 #include <media/videobuf2-dma-contig.h>
 
 #include "delta.h"
+#include "delta-ipc.h"
 
 #define DELTA_NAME	"st-delta"
 
@@ -1703,6 +1704,14 @@ static int delta_probe(struct platform_device *pdev)
 	pm_runtime_set_suspended(dev);
 	pm_runtime_enable(dev);
 
+	/* init firmware ipc channel */
+	ret = delta_ipc_init(delta);
+	if (ret) {
+		dev_err(delta->dev, "%s failed to initialize firmware ipc channel\n",
+			DELTA_PREFIX);
+		goto err;
+	}
+
 	/* register all available decoders */
 	register_decoders(delta);
 
@@ -1747,6 +1756,8 @@ static int delta_remove(struct platform_device *pdev)
 {
 	struct delta_dev *delta = platform_get_drvdata(pdev);
 
+	delta_ipc_exit(delta);
+
 	delta_unregister_device(delta);
 
 	destroy_workqueue(delta->work_queue);
drivers/media/platform/sti/delta/delta.h +21 -0
index 9e26525..d4a401b 100644
@@ -7,6 +7,7 @@
 #ifndef DELTA_H
 #define DELTA_H
 
+#include <linux/rpmsg.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-mem2mem.h>
 
@@ -199,6 +200,19 @@ struct delta_buf {
 	unsigned long attrs;
 };
 
+struct delta_ipc_ctx {
+	int cb_err;
+	u32 copro_hdl;
+	struct completion done;
+	struct delta_buf ipc_buf_struct;
+	struct delta_buf *ipc_buf;
+};
+
+struct delta_ipc_param {
+	u32 size;
+	void *data;
+};
+
 struct delta_ctx;
 
 /*
@@ -368,6 +382,7 @@ struct delta_dec {
  * @fh:			V4L2 file handle
  * @dev:		device context
  * @dec:		selected decoder context for this instance
+ * @ipc_ctx:		context of IPC communication with firmware
  * @state:		instance state
  * @frame_num:		frame number
  * @au_num:		access unit number
@@ -399,6 +414,8 @@ struct delta_ctx {
 	struct v4l2_fh fh;
 	struct delta_dev *dev;
 	const struct delta_dec *dec;
+	struct delta_ipc_ctx ipc_ctx;
+
 	enum delta_state state;
 	u32 frame_num;
 	u32 au_num;
@@ -447,6 +464,8 @@ struct delta_ctx {
  * @nb_of_streamformats:number of supported compressed video formats
  * @instance_id:	rolling counter identifying an instance (debug purpose)
  * @work_queue:		decoding job work queue
+ * @rpmsg_driver:	rpmsg IPC driver
+ * @rpmsg_device:	rpmsg IPC device
  */
 struct delta_dev {
 	struct v4l2_device v4l2_dev;
@@ -466,6 +485,8 @@ struct delta_dev {
 	u32 nb_of_streamformats;
 	u8 instance_id;
 	struct workqueue_struct *work_queue;
+	struct rpmsg_driver rpmsg_driver;
+	struct rpmsg_device *rpmsg_device;
 };
 
 static inline char *frame_type_str(u32 flags)
Signature · 1 line
1.9.1
#8 lore raw

PATCH v7 8/10 st-delta: EOS (End Of Stream) support

In reply to Hugues Fruchet

EOS (End Of Stream) support allows user to get all the potential decoded frames remaining in decoder pipeline after having reached the end of video bitstream. To do so, user calls VIDIOC_DECODER_CMD(V4L2_DEC_CMD_STOP) which will drain the decoder and get the drained frames that are then returned to user.
User is informed of EOS completion in two ways:
- dequeue of an empty frame flagged to V4L2_BUF_FLAG_LAST
- reception of a V4L2_EVENT_EOS event.
If, unfortunately, no buffer is available on CAPTURE queue to return the empty frame, EOS is delayed till user queue one CAPTURE buffer.

---
 drivers/media/platform/sti/delta/delta-v4l2.c | 146 +++++++++++++++++++++++++-
 drivers/media/platform/sti/delta/delta.h      |  23 ++++
 2 files changed, 168 insertions(+), 1 deletion(-)
drivers/media/platform/sti/delta/delta-v4l2.c +145 -1
index 237a938..c959614 100644
@@ -106,7 +106,8 @@ static void delta_frame_done(struct delta_ctx *ctx, struct delta_frame *frame,
 	vbuf->sequence = ctx->frame_num++;
 	v4l2_m2m_buf_done(vbuf, err ? VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE);
 
-	ctx->output_frames++;
+	if (frame->info.size) /* ignore EOS */
+		ctx->output_frames++;
 }
 
 static void requeue_free_frames(struct delta_ctx *ctx)
@@ -762,6 +763,135 @@ static int delta_g_selection(struct file *file, void *fh,
 	return 0;
 }
 
+static void delta_complete_eos(struct delta_ctx *ctx,
+			       struct delta_frame *frame)
+{
+	struct delta_dev *delta = ctx->dev;
+	const struct v4l2_event ev = {.type = V4L2_EVENT_EOS};
+
+	/*
+	 * Send EOS to user:
+	 * - by returning an empty frame flagged to V4L2_BUF_FLAG_LAST
+	 * - and then send EOS event
+	 */
+
+	/* empty frame */
+	frame->info.size = 0;
+
+	/* set the last buffer flag */
+	frame->flags |= V4L2_BUF_FLAG_LAST;
+
+	/* release frame to user */
+	delta_frame_done(ctx, frame, 0);
+
+	/* send EOS event */
+	v4l2_event_queue_fh(&ctx->fh, &ev);
+
+	dev_dbg(delta->dev, "%s EOS completed\n", ctx->name);
+}
+
+static int delta_try_decoder_cmd(struct file *file, void *fh,
+				 struct v4l2_decoder_cmd *cmd)
+{
+	if (cmd->cmd != V4L2_DEC_CMD_STOP)
+		return -EINVAL;
+
+	if (cmd->flags & V4L2_DEC_CMD_STOP_TO_BLACK)
+		return -EINVAL;
+
+	if (!(cmd->flags & V4L2_DEC_CMD_STOP_IMMEDIATELY) &&
+	    (cmd->stop.pts != 0))
+		return -EINVAL;
+
+	return 0;
+}
+
+static int delta_decoder_stop_cmd(struct delta_ctx *ctx, void *fh)
+{
+	const struct delta_dec *dec = ctx->dec;
+	struct delta_dev *delta = ctx->dev;
+	struct delta_frame *frame = NULL;
+	int ret = 0;
+
+	dev_dbg(delta->dev, "%s EOS received\n", ctx->name);
+
+	if (ctx->state != DELTA_STATE_READY)
+		return 0;
+
+	/* drain the decoder */
+	call_dec_op(dec, drain, ctx);
+
+	/* release to user drained frames */
+	while (1) {
+		frame = NULL;
+		ret = call_dec_op(dec, get_frame, ctx, &frame);
+		if (ret == -ENODATA) {
+			/* no more decoded frames */
+			break;
+		}
+		if (frame) {
+			dev_dbg(delta->dev, "%s drain frame[%d]\n",
+				ctx->name, frame->index);
+
+			/* pop timestamp and mark frame with it */
+			delta_pop_dts(ctx, &frame->dts);
+
+			/* release decoded frame to user */
+			delta_frame_done(ctx, frame, 0);
+		}
+	}
+
+	/* try to complete EOS */
+	ret = delta_get_free_frame(ctx, &frame);
+	if (ret)
+		goto delay_eos;
+
+	/* new frame available, EOS can now be completed */
+	delta_complete_eos(ctx, frame);
+
+	ctx->state = DELTA_STATE_EOS;
+
+	return 0;
+
+delay_eos:
+	/*
+	 * EOS completion from driver is delayed because
+	 * we don't have a free empty frame available.
+	 * EOS completion is so delayed till next frame_queue() call
+	 * to be sure to have a free empty frame available.
+	 */
+	ctx->state = DELTA_STATE_WF_EOS;
+	dev_dbg(delta->dev, "%s EOS delayed\n", ctx->name);
+
+	return 0;
+}
+
+static int delta_decoder_cmd(struct file *file, void *fh,
+			     struct v4l2_decoder_cmd *cmd)
+{
+	struct delta_ctx *ctx = to_ctx(fh);
+	int ret = 0;
+
+	ret = delta_try_decoder_cmd(file, fh, cmd);
+	if (ret)
+		return ret;
+
+	return delta_decoder_stop_cmd(ctx, fh);
+}
+
+static int delta_subscribe_event(struct v4l2_fh *fh,
+				 const struct v4l2_event_subscription *sub)
+{
+	switch (sub->type) {
+	case V4L2_EVENT_EOS:
+		return v4l2_event_subscribe(fh, sub, 2, NULL);
+	default:
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
 /* v4l2 ioctl ops */
 static const struct v4l2_ioctl_ops delta_ioctl_ops = {
 	.vidioc_querycap = delta_querycap,
@@ -782,6 +912,10 @@ static int delta_g_selection(struct file *file, void *fh,
 	.vidioc_streamon = v4l2_m2m_ioctl_streamon,
 	.vidioc_streamoff = v4l2_m2m_ioctl_streamoff,
 	.vidioc_g_selection = delta_g_selection,
+	.vidioc_try_decoder_cmd = delta_try_decoder_cmd,
+	.vidioc_decoder_cmd = delta_decoder_cmd,
+	.vidioc_subscribe_event = delta_subscribe_event,
+	.vidioc_unsubscribe_event = v4l2_event_unsubscribe,
 };
 
 /*
@@ -1376,6 +1510,16 @@ static void delta_vb2_frame_queue(struct vb2_buffer *vb)
 	struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
 	struct delta_frame *frame = to_frame(vbuf);
 
+	if (ctx->state == DELTA_STATE_WF_EOS) {
+		/* new frame available, EOS can now be completed */
+		delta_complete_eos(ctx, frame);
+
+		ctx->state = DELTA_STATE_EOS;
+
+		/* return, no need to recycle this buffer to decoder */
+		return;
+	}
+
 	/* recycle this frame */
 	delta_recycle(ctx, frame);
 }
drivers/media/platform/sti/delta/delta.h +23 -0
index d4a401b..60c07324 100644
@@ -27,11 +27,19 @@
  *@DELTA_STATE_READY:
  *	Decoding instance is ready to decode compressed access unit.
  *
+ *@DELTA_STATE_WF_EOS:
+ *	Decoding instance is waiting for EOS (End Of Stream) completion.
+ *
+ *@DELTA_STATE_EOS:
+ *	EOS (End Of Stream) is completed (signaled to user). Decoding instance
+ *	should then be closed.
  */
 enum delta_state {
 	DELTA_STATE_WF_FORMAT,
 	DELTA_STATE_WF_STREAMINFO,
 	DELTA_STATE_READY,
+	DELTA_STATE_WF_EOS,
+	DELTA_STATE_EOS
 };
 
 /*
@@ -237,6 +245,7 @@ struct delta_ipc_param {
  * @get_frame:		get the next decoded frame available, see below
  * @recycle:		recycle the given frame, see below
  * @flush:		(optional) flush decoder, see below
+ * @drain:		(optional) drain decoder, see below
  */
 struct delta_dec {
 	const char *name;
@@ -371,6 +380,18 @@ struct delta_dec {
 	 * decoding logic.
 	 */
 	int (*flush)(struct delta_ctx *ctx);
+
+	/*
+	 * drain() - drain decoder
+	 * @ctx:	(in) instance
+	 *
+	 * Optional.
+	 * Mark decoder pending frames (decoded but not yet output) as ready
+	 * so that they can be output to client at EOS (End Of Stream).
+	 * get_frame() is to be called in a loop right after drain() to
+	 * get all those pending frames.
+	 */
+	int (*drain)(struct delta_ctx *ctx);
 };
 
 struct delta_dev;
@@ -497,6 +518,8 @@ static inline char *frame_type_str(u32 flags)
 		return "P";
 	if (flags & V4L2_BUF_FLAG_BFRAME)
 		return "B";
+	if (flags & V4L2_BUF_FLAG_LAST)
+		return "EOS";
 	return "?";
 }
 
Signature · 1 line
1.9.1
#9 lore raw

PATCH v7 9/10 st-delta: add mjpeg support

In reply to Hugues Fruchet

Adds support of DELTA MJPEG video decoder back-end, implemented by calling JPEG_DECODER_HW0 firmware using RPMSG IPC communication layer.

---
 drivers/media/platform/Kconfig                     |  12 +-
 drivers/media/platform/sti/delta/Makefile          |   4 +
 drivers/media/platform/sti/delta/delta-cfg.h       |   3 +
 drivers/media/platform/sti/delta/delta-mjpeg-dec.c | 455 +++++++++++++++++++++
 drivers/media/platform/sti/delta/delta-mjpeg-fw.h  | 225 ++++++++++
 drivers/media/platform/sti/delta/delta-mjpeg-hdr.c | 149 +++++++
 drivers/media/platform/sti/delta/delta-mjpeg.h     |  35 ++
 drivers/media/platform/sti/delta/delta-v4l2.c      |   3 +
 8 files changed, 885 insertions(+), 1 deletion(-)
 create mode 100644 drivers/media/platform/sti/delta/delta-mjpeg-dec.c
 create mode 100644 drivers/media/platform/sti/delta/delta-mjpeg-fw.h
 create mode 100644 drivers/media/platform/sti/delta/delta-mjpeg-hdr.c
 create mode 100644 drivers/media/platform/sti/delta/delta-mjpeg.h
drivers/media/platform/Kconfig +11 -1
index 2e82ec6..20b26ea 100644
@@ -317,10 +317,20 @@ config VIDEO_STI_DELTA
 
 if VIDEO_STI_DELTA
 
+config VIDEO_STI_DELTA_MJPEG
+	bool "STMicroelectronics DELTA MJPEG support"
+	default y
+	help
+		Enables DELTA MJPEG hardware support.
+
+		To compile this driver as a module, choose M here:
+		the module will be called st-delta.
+
 config VIDEO_STI_DELTA_DRIVER
 	tristate
 	depends on VIDEO_STI_DELTA
-	default n
+	depends on VIDEO_STI_DELTA_MJPEG
+	default VIDEO_STI_DELTA_MJPEG
 	select VIDEOBUF2_DMA_CONTIG
 	select V4L2_MEM2MEM_DEV
 	select RPMSG
drivers/media/platform/sti/delta/Makefile +4 -0
index b791ba0..b268df6 100644
@@ -1,2 +1,6 @@
 obj-$(CONFIG_VIDEO_STI_DELTA_DRIVER) := st-delta.o
 st-delta-y := delta-v4l2.o delta-mem.o delta-ipc.o
+
+# MJPEG support
+st-delta-$(CONFIG_VIDEO_STI_DELTA_MJPEG) += delta-mjpeg-hdr.o
+st-delta-$(CONFIG_VIDEO_STI_DELTA_MJPEG) += delta-mjpeg-dec.o
drivers/media/platform/sti/delta/delta-cfg.h +3 -0
index f6674f6..c6388f5 100644
@@ -57,5 +57,8 @@
 #define DELTA_HW_AUTOSUSPEND_DELAY_MS 5
 
 #define DELTA_MAX_DECODERS 10
+#ifdef CONFIG_VIDEO_STI_DELTA_MJPEG
+extern const struct delta_dec mjpegdec;
+#endif
 
 #endif /* DELTA_CFG_H */
drivers/media/platform/sti/delta/delta-mjpeg-dec.c new file +455 -0

455 lines not on this page · raw message

drivers/media/platform/sti/delta/delta-mjpeg-fw.h new file +225 -0

225 lines not on this page · raw message

drivers/media/platform/sti/delta/delta-mjpeg-hdr.c new file +149 -0

149 lines not on this page · raw message

drivers/media/platform/sti/delta/delta-mjpeg.h new file +35 -0
new file mode 100644
index 0000000..18e6b37
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2013
+ * Author: Hugues Fruchet <[email protected]> for STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#ifndef DELTA_MJPEG_H
+#define DELTA_MJPEG_H
+
+#include "delta.h"
+
+struct mjpeg_component {
+	unsigned int id;/* 1=Y, 2=Cb, 3=Cr, 4=L, 5=Q */
+	unsigned int h_sampling_factor;
+	unsigned int v_sampling_factor;
+	unsigned int quant_table_index;
+};
+
+#define MJPEG_MAX_COMPONENTS 5
+
+struct mjpeg_header {
+	unsigned int length;
+	unsigned int sample_precision;
+	unsigned int frame_width;
+	unsigned int frame_height;
+	unsigned int nb_of_components;
+	struct mjpeg_component components[MJPEG_MAX_COMPONENTS];
+};
+
+int delta_mjpeg_read_header(struct delta_ctx *pctx,
+			    unsigned char *data, unsigned int size,
+			    struct mjpeg_header *header,
+			    unsigned int *data_offset);
+
+#endif /* DELTA_MJPEG_H */
drivers/media/platform/sti/delta/delta-v4l2.c +3 -0
index c959614..6b29497 100644
@@ -32,6 +32,9 @@
 
 /* registry of available decoders */
 static const struct delta_dec *delta_decoders[] = {
+#ifdef CONFIG_VIDEO_STI_DELTA_MJPEG
+	&mjpegdec,
+#endif
 };
 
 static inline int frame_size(u32 w, u32 h, u32 fmt)
Signature · 1 line
1.9.1
#6 lore raw

PATCH v7 6/10 st-delta: add memory allocator helper functions

In reply to Hugues Fruchet

Helper functions used by decoder back-ends to allocate physically contiguous memory required by hardware video decoder.

---
 drivers/media/platform/sti/delta/Makefile    |  2 +-
 drivers/media/platform/sti/delta/delta-mem.c | 51 ++++++++++++++++++++++++++++
 drivers/media/platform/sti/delta/delta-mem.h | 14 ++++++++
 drivers/media/platform/sti/delta/delta.h     |  8 +++++
 4 files changed, 74 insertions(+), 1 deletion(-)
 create mode 100644 drivers/media/platform/sti/delta/delta-mem.c
 create mode 100644 drivers/media/platform/sti/delta/delta-mem.h
drivers/media/platform/sti/delta/Makefile +1 -1
index 467519e..93a3037 100644
@@ -1,2 +1,2 @@
 obj-$(CONFIG_VIDEO_STI_DELTA_DRIVER) := st-delta.o
-st-delta-y := delta-v4l2.o
+st-delta-y := delta-v4l2.o delta-mem.o
drivers/media/platform/sti/delta/delta-mem.c new file +51 -0

51 lines not on this page · raw message

drivers/media/platform/sti/delta/delta-mem.h new file +14 -0
new file mode 100644
index 0000000..f8ca109
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2015
+ * Author: Hugues Fruchet <[email protected]> for STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#ifndef DELTA_MEM_H
+#define DELTA_MEM_H
+
+int hw_alloc(struct delta_ctx *ctx, u32 size, const char *name,
+	     struct delta_buf *buf);
+void hw_free(struct delta_ctx *ctx, struct delta_buf *buf);
+
+#endif /* DELTA_MEM_H */
drivers/media/platform/sti/delta/delta.h +8 -0
index 74a4240..9e26525 100644
@@ -191,6 +191,14 @@ struct delta_dts {
 	u64 val;
 };
 
+struct delta_buf {
+	u32 size;
+	void *vaddr;
+	dma_addr_t paddr;
+	const char *name;
+	unsigned long attrs;
+};
+
 struct delta_ctx;
 
 /*
Signature · 1 line
1.9.1
#12 lore raw

PATCH v7 10/10 st-delta: debug: trace stream/frame information & summary

In reply to Hugues Fruchet

Adds some trace points showing input compressed stream or output decoded frame information.
Adds an unconditional trace point when streaming starts showing the compressed stream and the decoded frame information. Adds an unconditional trace point at instance closure summarizing into a single line the decoding process (stream information, decoded and output frames number, potential errors observed).

---
 drivers/media/platform/sti/delta/Makefile      |  2 +-
 drivers/media/platform/sti/delta/delta-debug.c | 72 ++++++++++++++++++++++++++
 drivers/media/platform/sti/delta/delta-debug.h | 18 +++++++
 drivers/media/platform/sti/delta/delta-v4l2.c  | 30 +++++++++--
 4 files changed, 117 insertions(+), 5 deletions(-)
 create mode 100644 drivers/media/platform/sti/delta/delta-debug.c
 create mode 100644 drivers/media/platform/sti/delta/delta-debug.h
drivers/media/platform/sti/delta/Makefile +1 -1
index b268df6..8d032508 100644
@@ -1,5 +1,5 @@
 obj-$(CONFIG_VIDEO_STI_DELTA_DRIVER) := st-delta.o
-st-delta-y := delta-v4l2.o delta-mem.o delta-ipc.o
+st-delta-y := delta-v4l2.o delta-mem.o delta-ipc.o delta-debug.o
 
 # MJPEG support
 st-delta-$(CONFIG_VIDEO_STI_DELTA_MJPEG) += delta-mjpeg-hdr.o
drivers/media/platform/sti/delta/delta-debug.c new file +72 -0

72 lines not on this page · raw message

drivers/media/platform/sti/delta/delta-debug.h new file +18 -0
new file mode 100644
index 0000000..955c158
@@ -0,0 +1,18 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2015
+ * Authors: Hugues Fruchet <[email protected]>
+ *          Fabrice Lecoultre <[email protected]>
+ *          for STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#ifndef DELTA_DEBUG_H
+#define DELTA_DEBUG_H
+
+char *delta_streaminfo_str(struct delta_streaminfo *s, char *str,
+			   unsigned int len);
+char *delta_frameinfo_str(struct delta_frameinfo *f, char *str,
+			  unsigned int len);
+void delta_trace_summary(struct delta_ctx *ctx);
+
+#endif /* DELTA_DEBUG_H */
drivers/media/platform/sti/delta/delta-v4l2.c +26 -4
index 6b29497..c6f2e24 100644
@@ -17,6 +17,7 @@
 #include <media/videobuf2-dma-contig.h>
 
 #include "delta.h"
+#include "delta-debug.h"
 #include "delta-ipc.h"
 
 #define DELTA_NAME	"st-delta"
@@ -443,11 +444,13 @@ static int delta_g_fmt_stream(struct file *file, void *fh,
 	struct delta_dev *delta = ctx->dev;
 	struct v4l2_pix_format *pix = &f->fmt.pix;
 	struct delta_streaminfo *streaminfo = &ctx->streaminfo;
+	unsigned char str[100] = "";
 
 	if (!(ctx->flags & DELTA_FLAG_STREAMINFO))
 		dev_dbg(delta->dev,
-			"%s V4L2 GET_FMT (OUTPUT): no stream information available, using default\n",
-			ctx->name);
+			"%s V4L2 GET_FMT (OUTPUT): no stream information available, default to %s\n",
+			ctx->name,
+			delta_streaminfo_str(streaminfo, str, sizeof(str)));
 
 	pix->pixelformat = streaminfo->streamformat;
 	pix->width = streaminfo->width;
@@ -470,11 +473,13 @@ static int delta_g_fmt_frame(struct file *file, void *fh, struct v4l2_format *f)
 	struct v4l2_pix_format *pix = &f->fmt.pix;
 	struct delta_frameinfo *frameinfo = &ctx->frameinfo;
 	struct delta_streaminfo *streaminfo = &ctx->streaminfo;
+	unsigned char str[100] = "";
 
 	if (!(ctx->flags & DELTA_FLAG_FRAMEINFO))
 		dev_dbg(delta->dev,
-			"%s V4L2 GET_FMT (CAPTURE): no frame information available, using default\n",
-			ctx->name);
+			"%s V4L2 GET_FMT (CAPTURE): no frame information available, default to %s\n",
+			ctx->name,
+			delta_frameinfo_str(frameinfo, str, sizeof(str)));
 
 	pix->pixelformat = frameinfo->pixelformat;
 	pix->width = frameinfo->aligned_width;
@@ -657,6 +662,7 @@ static int delta_s_fmt_frame(struct file *file, void *fh, struct v4l2_format *f)
 	const struct delta_dec *dec = ctx->dec;
 	struct v4l2_pix_format *pix = &f->fmt.pix;
 	struct delta_frameinfo frameinfo;
+	unsigned char str[100] = "";
 	struct vb2_queue *vq;
 	int ret;
 
@@ -709,6 +715,10 @@ static int delta_s_fmt_frame(struct file *file, void *fh, struct v4l2_format *f)
 
 	ctx->flags |= DELTA_FLAG_FRAMEINFO;
 	ctx->frameinfo = frameinfo;
+	dev_dbg(delta->dev,
+		"%s V4L2 SET_FMT (CAPTURE): frameinfo updated to %s\n",
+		ctx->name,
+		delta_frameinfo_str(&frameinfo, str, sizeof(str)));
 
 	pix->pixelformat = frameinfo.pixelformat;
 	pix->width = frameinfo.aligned_width;
@@ -1320,6 +1330,8 @@ static int delta_vb2_au_start_streaming(struct vb2_queue *q,
 	struct vb2_v4l2_buffer *vbuf = NULL;
 	struct delta_streaminfo *streaminfo = &ctx->streaminfo;
 	struct delta_frameinfo *frameinfo = &ctx->frameinfo;
+	unsigned char str1[100] = "";
+	unsigned char str2[100] = "";
 
 	if ((ctx->state != DELTA_STATE_WF_FORMAT) &&
 	    (ctx->state != DELTA_STATE_WF_STREAMINFO))
@@ -1381,6 +1393,10 @@ static int delta_vb2_au_start_streaming(struct vb2_queue *q,
 
 	ctx->state = DELTA_STATE_READY;
 
+	dev_dbg(delta->dev, "%s %s => %s\n", ctx->name,
+		delta_streaminfo_str(streaminfo, str1, sizeof(str1)),
+		delta_frameinfo_str(frameinfo, str2, sizeof(str2)));
+
 	delta_au_done(ctx, au, ret);
 	return 0;
 
@@ -1708,6 +1724,12 @@ static int delta_release(struct file *file)
 	/* close decoder */
 	call_dec_op(dec, close, ctx);
 
+	/*
+	 * trace a summary of instance
+	 * before closing (debug purpose)
+	 */
+	delta_trace_summary(ctx);
+
 	v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
 
 	v4l2_fh_del(&ctx->fh);
Signature · 1 line
1.9.1
#10 lore raw

Re: [PATCH v7 09/10] [media] st-delta: add mjpeg support

In reply to Hugues Fruchet

Em Thu, 2 Feb 2017 15:59:52 +0100
Hugues Fruchet <[email protected]> escreveu:

I applied today this series. There's just a nitpick, that you can change when you submit a version 2 of the MPEG2 driver. See below:

Quoted 13 lines
drivers/media/platform/Kconfig +5 -0
index 2e82ec6..20b26ea 100644
@@ -317,10 +317,20 @@ config VIDEO_STI_DELTA
 
 if VIDEO_STI_DELTA
 
+config VIDEO_STI_DELTA_MJPEG
+	bool "STMicroelectronics DELTA MJPEG support"
+	default y
+	help
+		Enables DELTA MJPEG hardware support.

drivers/media/platform/Kconfig config VIDEO_STI_DELTA · line 333

Quoted 10 lines
drivers/media/platform/Kconfig +6 -1
+
+		To compile this driver as a module, choose M here:
+		the module will be called st-delta.
+
 config VIDEO_STI_DELTA_DRIVER
 	tristate
 	depends on VIDEO_STI_DELTA
-	default n
+	depends on VIDEO_STI_DELTA_MJPEG
+	default VIDEO_STI_DELTA_MJPEG

Just do:
default y

The build system will do the right thing, as it will evaluate the dependencies, disabling it if no decoder is selected. That will avoid needing to change the default line for every new decoder you add.

drivers/media/platform/Kconfig config VIDEO_STI_DELTA · line 336

Quoted 3 lines
drivers/media/platform/Kconfig +0 -0
 	select VIDEOBUF2_DMA_CONTIG
 	select V4L2_MEM2MEM_DEV
 	select RPMSG

Thanks,
Mauro

#11 lore raw

Re: [PATCH v7 09/10] [media] st-delta: add mjpeg support

Quoted 33 lines · Mauro Carvalho Chehab

Em Thu, 2 Feb 2017 15:59:52 +0100
Hugues Fruchet <[email protected]> escreveu:

I applied today this series. There's just a nitpick, that you can change when you submit a version 2 of the MPEG2 driver. See below:

Quoted 13 lines
drivers/media/platform/Kconfig +5 -0
index 2e82ec6..20b26ea 100644
@@ -317,10 +317,20 @@ config VIDEO_STI_DELTA
 
 if VIDEO_STI_DELTA
 
+config VIDEO_STI_DELTA_MJPEG
+	bool "STMicroelectronics DELTA MJPEG support"
+	default y
+	help
+		Enables DELTA MJPEG hardware support.

drivers/media/platform/Kconfig config VIDEO_STI_DELTA · line 333

Quoted 10 lines
drivers/media/platform/Kconfig +6 -1
+
+		To compile this driver as a module, choose M here:
+		the module will be called st-delta.
+
 config VIDEO_STI_DELTA_DRIVER
 	tristate
 	depends on VIDEO_STI_DELTA
-	default n
+	depends on VIDEO_STI_DELTA_MJPEG
+	default VIDEO_STI_DELTA_MJPEG

Just do:
default y

Quoted 5 lines

The build system will do the right thing, as it will evaluate the dependencies, disabling it if no decoder is selected. That will avoid needing to change the default line for every new decoder you add.

Thanks Mauro,

this is done in v2 of MPEG-2 patchset.

Best regards,
Hugues.

Quoted 8 lines

drivers/media/platform/Kconfig config VIDEO_STI_DELTA · line 336

Quoted 3 lines
drivers/media/platform/Kconfig +0 -0
 	select VIDEOBUF2_DMA_CONTIG
 	select V4L2_MEM2MEM_DEV
 	select RPMSG

Thanks,
Mauro