Skip to contentSkip to conversation

IOCTLs in ddbridge

PATCH In review Daniel Scheller 3 participants 7 messages May 12, 2018 – Jul 4, 2018

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

v3 cover IOCTLs in ddbridge

From: Daniel Scheller <[email protected]>

Third iteration of the IOCTL patches for ddbridge, split into multiple patches:

Patch 1 just adds the reservation/information of the used IOCTLs into ioctl-numbers.txt in the Docs dir. Doc, s390 and LKML are Cc'ed on this patch.

Patch 2 adds the header which defines the IOCTLs in include/uapi/ so userspace applications can directly reuse the IOCTL definitions by including this file.

Patch 3 (re)implements the IOCTL handling into ddbridge. This is basically code that was there since literally forever, but had to be removed along with the initial ddbridge-0.9.x bump.

The whole functionality gets more important these days since ie. the new MaxSX8 cards may require updating from time to time since these cards implement the demod/tuner communication in their FPGA (which normally I2C drivers exist for). Also, the CineS2v7 and derivatives received some important updates and the possibility to receive higher bitrate transponders these days, so users should be able to update their cards.

Changes since the last versions:
- Docs, headers and code split apart and sent out separately to the subsystems.
- Only the two absolutely necessary IOCTLs (DDB_FLASHIO and DDB_ID) are implemented for now.

Daniel Scheller (3):
Documentation: ioctl-number: add ddbridge IOCTLs
[media] ddbridge: uAPI header for IOCTL definitions and related data
structs
[media] ddbridge: implement IOCTL handling

 Documentation/ioctl/ioctl-number.txt        |   1 +
 MAINTAINERS                                 |   1 +
 drivers/media/pci/ddbridge/Makefile         |   3 +-
 drivers/media/pci/ddbridge/ddbridge-core.c  | 111 +----------------
 drivers/media/pci/ddbridge/ddbridge-ioctl.c | 179 ++++++++++++++++++++++++++++
 drivers/media/pci/ddbridge/ddbridge-ioctl.h |  32 +++++
 include/uapi/linux/ddbridge-ioctl.h         |  61 ++++++++++
 7 files changed, 278 insertions(+), 110 deletions(-)
 create mode 100644 drivers/media/pci/ddbridge/ddbridge-ioctl.c
 create mode 100644 drivers/media/pci/ddbridge/ddbridge-ioctl.h
 create mode 100644 include/uapi/linux/ddbridge-ioctl.h
Signature · 1 line
2.16.1
#1 lore raw

PATCH v3 1/3 Documentation: ioctl-number: add ddbridge IOCTLs

From: Daniel Scheller <[email protected]>

drivers/media/pci/ddbridge exposes a few IOCTLs which are used by userspace utilities to ie. update PCIe card's FPGA firmware.

The IOCTLs chosen are in the range 0xDD/0xE0 up to 0xDD/0xFF, with 0xDD as sort of gimmick for "Digital Devices". To not conflict with the zfpc driver the upper range (0xE0-0xFF) is used. It is not clear if and which IOCTL numbers the zfpc driver really uses, from reading the sources at drivers/s390/scsi/ I couldn't really determine if IOCTLs are in use at all. Maybe the S390 maintainers can double-check or comment, thus Cc linux-s390.

The upstream dddvb driver currently exposes 12 IOCTLs from which we're going to handle two at the moment (DDB_FLASHIO and DDB_ID), which is all that's required to perform the FPGA update on this hardware. The "reservation" of 32 IDs may seem way too much in this regard, however, we'd like to be able to stay compatible with the upstream out-of-tree driver as much as possible, so should any of the remaining 10 IOCTLs be required at any time (or even more, should upstream add more in the future), we can just add them into this range without any hassles or without creating conflicts anywhere.

---
 Documentation/ioctl/ioctl-number.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/ioctl/ioctl-number.txt +1 -0
index 84bb74dcae12..feac1b56900b 100644
@@ -334,6 +334,7 @@ Code  Seq#(hex)	Include File		Comments
 0xDB	00-0F	drivers/char/mwave/mwavepub.h
 0xDD	00-3F	ZFCP device driver	see drivers/s390/scsi/
 					<mailto:[email protected]>
+0xDD	E0-FF	linux/ddbridge-ioctl.h
 0xE5	00-3F	linux/fuse.h
 0xEC	00-01	drivers/platform/chrome/cros_ec_dev.h	ChromeOS EC driver
 0xF3	00-3F	drivers/usb/misc/sisusbvga/sisusb.h	sisfb (in development)
Signature · 1 line
2.16.1
#2 lore raw

PATCH v3 2/3 ddbridge: uAPI header for IOCTL definitions and related data structs

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

Add a uAPI header to define the IOCTLs and the related data structs used by ddbridge, which currently are IOCTL_DDB_FLASHIO and IOCTL_DDB_IO. The header can be included by userspace applications directly to make use of the IOCTLs, and they even should use this header to keep things matching with the kernel driver.

---
 MAINTAINERS                         |  1 +
 include/uapi/linux/ddbridge-ioctl.h | 61 +++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+)
 create mode 100644 include/uapi/linux/ddbridge-ioctl.h
MAINTAINERS +1 -0
index 0a919a84d344..6b7da989fbed 100644
@@ -8710,6 +8710,7 @@ W:	https://linuxtv.org
 T:	git git://linuxtv.org/media_tree.git
 S:	Maintained
 F:	drivers/media/pci/ddbridge/*
+F:	include/uapi/linux/ddbridge-ioctl.h
 
 MEDIA DRIVERS FOR FREESCALE IMX
 M:	Steve Longerbeam <[email protected]>
include/uapi/linux/ddbridge-ioctl.h new file +61 -0

61 lines not on this page · raw message

Signature · 1 line
2.16.1
#3 lore raw

PATCH v3 3/3 ddbridge: implement IOCTL handling

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

This patch adds back the IOCTL API/functionality which is present in the upstream dddvb driver package. In comparison, the IOCTL handler has been factored to a separate object (and with that, some functionality from -core, such as reg_wait() and ddb_flashio() has been moved there aswell). The IOCTLs were defined in an include in include/uapi/linux/ previously and being reused here.

The main purpose at the moment is to enable the mainline driver to handle FPGA firmware updates of all cards supported by the ddbridge driver, which gets even more important since the introduction of the MaxSX8 support (this card basically implements the I2C demod/tuner drivers which are used normally in FPGA, so any fixes need to be flashed into the card), and the recent firmware releases for the CineS2v7 and Octopus CI S2 series that not only carry bugfixes, but also enables support for higher bandwidth transponders.

---
 drivers/media/pci/ddbridge/Makefile         |   3 +-
 drivers/media/pci/ddbridge/ddbridge-core.c  | 111 +----------------
 drivers/media/pci/ddbridge/ddbridge-ioctl.c | 179 ++++++++++++++++++++++++++++
 drivers/media/pci/ddbridge/ddbridge-ioctl.h |  32 +++++
 4 files changed, 215 insertions(+), 110 deletions(-)
 create mode 100644 drivers/media/pci/ddbridge/ddbridge-ioctl.c
 create mode 100644 drivers/media/pci/ddbridge/ddbridge-ioctl.h
drivers/media/pci/ddbridge/Makefile +2 -1
index 9b9e35f171b7..3563a3e3d7f9 100644
@@ -4,7 +4,8 @@
 #
 
 ddbridge-objs := ddbridge-main.o ddbridge-core.o ddbridge-ci.o \
-		ddbridge-hw.o ddbridge-i2c.o ddbridge-max.o ddbridge-mci.o
+		ddbridge-hw.o ddbridge-i2c.o ddbridge-ioctl.o ddbridge-max.o \
+		ddbridge-mci.o
 
 obj-$(CONFIG_DVB_DDBRIDGE) += ddbridge.o
 
drivers/media/pci/ddbridge/ddbridge-core.c +2 -109

136 lines not on this page · raw message

drivers/media/pci/ddbridge/ddbridge-ioctl.c new file +179 -0

179 lines not on this page · raw message

drivers/media/pci/ddbridge/ddbridge-ioctl.h new file +32 -0
new file mode 100644
index 000000000000..4865e98482ef
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * ddbridge-ioctl.h: Digital Devices bridge IOCTL handler
+ *
+ * Copyright (C) 2010-2017 Digital Devices GmbH
+ *                         Ralph Metzler <[email protected]>
+ *                         Marcus Metzler <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 only, as published by the Free Software Foundation.
+ *
+ * This program 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.
+ */
+
+#ifndef __DDBRIDGE_IOCTL_H__
+#define __DDBRIDGE_IOCTL_H__
+
+#include <linux/ddbridge-ioctl.h>
+
+#include "ddbridge.h"
+
+/******************************************************************************/
+
+int ddb_do_flashio(struct ddb *dev, u32 lnr, u8 *wbuf, u32 wlen, u8 *rbuf,
+		   u32 rlen);
+long ddb_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
+
+#endif /* __DDBRIDGE_IOCTL_H__ */
Signature · 1 line
2.16.1
#4 lore raw

Re: [PATCH v3 0/3] IOCTLs in ddbridge.

In reply to Daniel Scheller

Hi Daniel,

Em Sat, 12 May 2018 13:24:29 +0200
Daniel Scheller <[email protected]> escreveu:

Quoted 8 lines

From: Daniel Scheller <[email protected]>

Third iteration of the IOCTL patches for ddbridge, split into multiple patches:

Patch 1 just adds the reservation/information of the used IOCTLs into ioctl-numbers.txt in the Docs dir. Doc, s390 and LKML are Cc'ed on this patch.

Patch looks ok, although it would be great to get some acks there. I don't know who currently maintains Documentation/ioctl/ioctl-number.txt.

Just in case, I would explicitly c/c LKML, Andrew Morton and Jonathan Corbet. Please c/c them on a next respin.

Quoted 7 lines

Patch 2 adds the header which defines the IOCTLs in include/uapi/ so userspace applications can directly reuse the IOCTL definitions by including this file.

Patch 3 (re)implements the IOCTL handling into ddbridge. This is basically code that was there since literally forever, but had to be removed along with the initial ddbridge-0.9.x bump.

Also looked ok.

What I miss here is a forth patch to Documentation/media/dvb-drivers/, adding a documentation for ddbridge, in special explaining those new ioctls.

Quoted 20 lines

The whole functionality gets more important these days since ie. the new MaxSX8 cards may require updating from time to time since these cards implement the demod/tuner communication in their FPGA (which normally I2C drivers exist for). Also, the CineS2v7 and derivatives received some important updates and the possibility to receive higher bitrate transponders these days, so users should be able to update their cards.

Changes since the last versions:
- Docs, headers and code split apart and sent out separately to the subsystems.
- Only the two absolutely necessary IOCTLs (DDB_FLASHIO and DDB_ID) are implemented for now.

Daniel Scheller (3):
Documentation: ioctl-number: add ddbridge IOCTLs
[media] ddbridge: uAPI header for IOCTL definitions and related data
structs
[media] ddbridge: implement IOCTL handling

Quoted 11 lines
 Documentation/ioctl/ioctl-number.txt        |   1 +
 MAINTAINERS                                 |   1 +
 drivers/media/pci/ddbridge/Makefile         |   3 +-
 drivers/media/pci/ddbridge/ddbridge-core.c  | 111 +----------------
 drivers/media/pci/ddbridge/ddbridge-ioctl.c | 179 ++++++++++++++++++++++++++++
 drivers/media/pci/ddbridge/ddbridge-ioctl.h |  32 +++++
 include/uapi/linux/ddbridge-ioctl.h         |  61 ++++++++++
 7 files changed, 278 insertions(+), 110 deletions(-)
 create mode 100644 drivers/media/pci/ddbridge/ddbridge-ioctl.c
 create mode 100644 drivers/media/pci/ddbridge/ddbridge-ioctl.h
 create mode 100644 include/uapi/linux/ddbridge-ioctl.h

Thanks,
Mauro

#5 lore raw

Re: [PATCH v3 0/3] IOCTLs in ddbridge.

Am Wed, 4 Jul 2018 13:08:31 -0300
schrieb Mauro Carvalho Chehab <[email protected]>:

Quoted 12 lines

Em Sat, 12 May 2018 13:24:29 +0200
Daniel Scheller <[email protected]> escreveu:

Quoted 8 lines

From: Daniel Scheller <[email protected]>

Third iteration of the IOCTL patches for ddbridge, split into multiple patches:

Patch 1 just adds the reservation/information of the used IOCTLs into ioctl-numbers.txt in the Docs dir. Doc, s390 and LKML are Cc'ed on this patch.

Quoted 5 lines

Patch looks ok, although it would be great to get some acks there. I don't know who currently maintains Documentation/ioctl/ioctl-number.txt.

Just in case, I would explicitly c/c LKML, Andrew Morton and Jonathan Corbet. Please c/c them [...]

I did in patch 1 explicitly asking esp. the s390 guys since they're on 0xDD too but at a lower range, no response in two months, from anyone.

Quoted 3 lines

on a next respin. [...] What I miss here is a forth patch to Documentation/media/dvb-drivers/, adding a documentation for ddbridge, in special explaining those new
ioctls.

If you're fine with anything else in this series, please be so kind and pick this stuff up and I'll shove such doc up afterwards as a separate patch. This whole thing is being posted for over a year now, I waited another two months, and I'm not interested in waiting for another such long time (or even more) regarding this (remember I even asked for review for the 4.18 merge window).

Best regards,
Daniel Scheller

Signature · 1 line
https://github.com/herrnst
Acked-by
#6 lore raw

Re: [PATCH v3 0/3] IOCTLs in ddbridge.

Hello Mauro!

Quoted 1 line

Patch looks ok, although it would be great to get some acks there.

I have no time to test this, but I know Daniel does all this tests and in fact he is currently adapting changes done by DD in their repo, modifying them to work in the current media-tree version and submits them to the list. So this is more or less work to keep the kernel driver in sync with the DD repo.

Please remember this from Daniels patch submit message:
Patch 3 (re)implements the IOCTL handling into ddbridge. This is basically code that was there since literally forever, but had to be removed along with the initial ddbridge-0.9.x bump.
So he is adding back the original ioctl's, which are nowadays more used because of (also from the patch submit message):
The whole functionality gets more important these days since ie. the new MaxSX8 cards may require updating from time to time since these cards implement the demod/tuner communication in their FPGA

So if you need an ack:

Quoted 3 lines

If you're fine with anything else in this series, please be so kind and pick this stuff up and I'll shove such doc up afterwards as a separate patch. This whole thing is being posted for over a year now, ...

Please Mauro, merge this now and I am sure Daniel will add the missing documentation!
Keep also in mind, that we all do this in our spare time and we do this because DD was and is not willing to submit their own drivers!
Do your really believe that it is helpful when patches are rodding months for no reason? This is often demotivating and thus some maintainers may give up only because of that.
I am extremely happy, that Daniel took over and made it happen, that we get the DD drivers into the Kernel and thus, we can use DD HW and also other HW in parallel. This would be not possible with the drivers from DD.

BR,
Jasmin