linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Support Physical Layer Scrambling
@ 2017-12-16 12:23 Athanasios Oikonomou
  2017-12-16 12:23 ` [PATCH 1/2] media: dvb_frontend: add physical layer scrambling support Athanasios Oikonomou
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Athanasios Oikonomou @ 2017-12-16 12:23 UTC (permalink / raw)
  To: linux-media
  Cc: Athanasios Oikonomou, Mauro Carvalho Chehab, Ralph Metzler,
	Manu Abraham

A new property DTV_SCRAMBLING_SEQUENCE_INDEX introduced to control
the gold sequence that several demods support.

Also the DVB API was increased in order userspace to be aware of the
changes.

The stv090x driver was changed to make use of the new property.

Those commits based on discussion previously made on the mailling list.
https://www.mail-archive.com/linux-media@vger.kernel.org/msg122600.html

I would like to thanks Ralph Metzler (rjkm@metzlerbros.de) for the
great help and ideas he provide me in order create those patches.

Athanasios Oikonomou (2):
  media: dvb_frontend: add physical layer scrambling support
  media: stv090x: add physical layer scrambling support

 .../media/uapi/dvb/fe_property_parameters.rst          | 18 ++++++++++++++++++
 .../uapi/dvb/frontend-property-satellite-systems.rst   |  2 ++
 drivers/media/dvb-core/dvb_frontend.c                  | 12 ++++++++++++
 drivers/media/dvb-core/dvb_frontend.h                  |  5 +++++
 drivers/media/dvb-frontends/stv090x.c                  | 16 ++++++++++++++++
 include/uapi/linux/dvb/frontend.h                      |  5 ++++-
 include/uapi/linux/dvb/version.h                       |  2 +-
 7 files changed, 58 insertions(+), 2 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] media: dvb_frontend: add physical layer scrambling support
  2017-12-16 12:23 [PATCH 0/2] Support Physical Layer Scrambling Athanasios Oikonomou
@ 2017-12-16 12:23 ` Athanasios Oikonomou
  2017-12-16 12:23 ` [PATCH 2/2] media: stv090x: " Athanasios Oikonomou
  2017-12-17 13:50 ` [PATCH 0/2] Support Physical Layer Scrambling Ralph Metzler
  2 siblings, 0 replies; 5+ messages in thread
From: Athanasios Oikonomou @ 2017-12-16 12:23 UTC (permalink / raw)
  To: linux-media
  Cc: Athanasios Oikonomou, Mauro Carvalho Chehab, Ralph Metzler,
	Manu Abraham

This commit adds a new property DTV_SCRAMBLING_SEQUENCE_INDEX.

This 18 bit field, when present, carries the index of the DVB-S2 physical
layer scrambling sequence as defined in clause 5.5.4 of EN 302 307.
There is no explicit signalling method to convey scrambling sequence index
to the receiver. If S2 satellite delivery system descriptor is available
it can be used to read the scrambling sequence index (EN 300 468 table 41).

By default, gold scrambling sequence index 0 is used. The valid scrambling
sequence index range is from 0 to 262142.

Increase the DVB API version in order userspace to be aware of the changes.

Signed-off-by: Athanasios Oikonomou <athoik@gmail.com>
---
 .../media/uapi/dvb/fe_property_parameters.rst          | 18 ++++++++++++++++++
 .../uapi/dvb/frontend-property-satellite-systems.rst   |  2 ++
 drivers/media/dvb-core/dvb_frontend.c                  | 12 ++++++++++++
 drivers/media/dvb-core/dvb_frontend.h                  |  5 +++++
 include/uapi/linux/dvb/frontend.h                      |  5 ++++-
 include/uapi/linux/dvb/version.h                       |  2 +-
 6 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/Documentation/media/uapi/dvb/fe_property_parameters.rst b/Documentation/media/uapi/dvb/fe_property_parameters.rst
index 6eef507..3524dca 100644
--- a/Documentation/media/uapi/dvb/fe_property_parameters.rst
+++ b/Documentation/media/uapi/dvb/fe_property_parameters.rst
@@ -987,3 +987,21 @@ Possible values: 0, 1, LNA_AUTO
 1, LNA on
 
 use the special macro LNA_AUTO to set LNA auto
+
+
+.. _DTV-SCRAMBLING-SEQUENCE-INDEX:
+
+DTV_SCRAMBLING_SEQUENCE_INDEX
+=============================
+
+Used on DVB-S2.
+
+This 18 bit field, when present, carries the index of the DVB-S2 physical
+layer scrambling sequence as defined in clause 5.5.4 of EN 302 307.
+There is no explicit signalling method to convey scrambling sequence index
+to the receiver. If S2 satellite delivery system descriptor is available
+it can be used to read the scrambling sequence index (EN 300 468 table 41).
+
+By default, gold scrambling sequence index 0 is used.
+
+The valid scrambling sequence index range is from 0 to 262142.
diff --git a/Documentation/media/uapi/dvb/frontend-property-satellite-systems.rst b/Documentation/media/uapi/dvb/frontend-property-satellite-systems.rst
index 1f40399..2929e69 100644
--- a/Documentation/media/uapi/dvb/frontend-property-satellite-systems.rst
+++ b/Documentation/media/uapi/dvb/frontend-property-satellite-systems.rst
@@ -60,6 +60,8 @@ following parameters:
 
 -  :ref:`DTV_STREAM_ID <DTV-STREAM-ID>`
 
+-  :ref:`DTV_SCRAMBLING_SEQUENCE_INDEX <DTV-SCRAMBLING-SEQUENCE-INDEX>`
+
 In addition, the :ref:`DTV QoS statistics <frontend-stat-properties>`
 are also valid.
 
diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c
index 2afaa82..e192876 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -982,6 +982,7 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe)
 	}
 
 	c->stream_id = NO_STREAM_ID_FILTER;
+	c->scrambling_sequence_index = 0;/* default sequence */
 
 	switch (c->delivery_system) {
 	case SYS_DVBS:
@@ -1072,6 +1073,7 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {
 
 	_DTV_CMD(DTV_STREAM_ID, 1, 0),
 	_DTV_CMD(DTV_DVBT2_PLP_ID_LEGACY, 1, 0),
+	_DTV_CMD(DTV_SCRAMBLING_SEQUENCE_INDEX, 1, 0),
 	_DTV_CMD(DTV_LNA, 1, 0),
 
 	/* Get */
@@ -1417,6 +1419,11 @@ static int dtv_property_process_get(struct dvb_frontend *fe,
 		tvp->u.data = c->stream_id;
 		break;
 
+	/* Physical layer scrambling support */
+	case DTV_SCRAMBLING_SEQUENCE_INDEX:
+		tvp->u.data = c->scrambling_sequence_index;
+		break;
+
 	/* ATSC-MH */
 	case DTV_ATSCMH_FIC_VER:
 		tvp->u.data = fe->dtv_property_cache.atscmh_fic_ver;
@@ -1900,6 +1907,11 @@ static int dtv_property_process_set(struct dvb_frontend *fe,
 		c->stream_id = data;
 		break;
 
+	/* Physical layer scrambling support */
+	case DTV_SCRAMBLING_SEQUENCE_INDEX:
+		c->scrambling_sequence_index = data;
+		break;
+
 	/* ATSC-MH */
 	case DTV_ATSCMH_PARADE_ID:
 		fe->dtv_property_cache.atscmh_parade_id = data;
diff --git a/drivers/media/dvb-core/dvb_frontend.h b/drivers/media/dvb-core/dvb_frontend.h
index ace0c2f..2bc25f1 100644
--- a/drivers/media/dvb-core/dvb_frontend.h
+++ b/drivers/media/dvb-core/dvb_frontend.h
@@ -513,6 +513,8 @@ struct dvb_fe_events {
  * @layer.interleaving:	 per layer interleaving.
  * @stream_id:		If different than zero, enable substream filtering, if
  *			hardware supports (DVB-S2 and DVB-T2).
+ * @scrambling_sequence_index:	Carries the index of the DVB-S2 physical layer
+ *				scrambling sequence.
  * @atscmh_fic_ver:	Version number of the FIC (Fast Information Channel)
  *			signaling data (only ATSC-M/H)
  * @atscmh_parade_id:	Parade identification number (only ATSC-M/H)
@@ -591,6 +593,9 @@ struct dtv_frontend_properties {
 	/* Multistream specifics */
 	u32			stream_id;
 
+	/* Physical Layer Scrambling specifics */
+	u32			scrambling_sequence_index;
+
 	/* ATSC-MH specifics */
 	u8			atscmh_fic_ver;
 	u8			atscmh_parade_id;
diff --git a/include/uapi/linux/dvb/frontend.h b/include/uapi/linux/dvb/frontend.h
index b297b65..9218cd6 100644
--- a/include/uapi/linux/dvb/frontend.h
+++ b/include/uapi/linux/dvb/frontend.h
@@ -547,7 +547,10 @@ enum fe_interleaving {
 #define DTV_STAT_ERROR_BLOCK_COUNT	68
 #define DTV_STAT_TOTAL_BLOCK_COUNT	69
 
-#define DTV_MAX_COMMAND		DTV_STAT_TOTAL_BLOCK_COUNT
+/* Physical layer scrambling */
+#define DTV_SCRAMBLING_SEQUENCE_INDEX	70
+
+#define DTV_MAX_COMMAND		DTV_SCRAMBLING_SEQUENCE_INDEX
 
 /**
  * enum fe_pilot - Type of pilot tone
diff --git a/include/uapi/linux/dvb/version.h b/include/uapi/linux/dvb/version.h
index 02e32ea..2c5cffe 100644
--- a/include/uapi/linux/dvb/version.h
+++ b/include/uapi/linux/dvb/version.h
@@ -25,6 +25,6 @@
 #define _DVBVERSION_H_
 
 #define DVB_API_VERSION 5
-#define DVB_API_VERSION_MINOR 10
+#define DVB_API_VERSION_MINOR 11
 
 #endif /*_DVBVERSION_H_*/
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] media: stv090x: add physical layer scrambling support
  2017-12-16 12:23 [PATCH 0/2] Support Physical Layer Scrambling Athanasios Oikonomou
  2017-12-16 12:23 ` [PATCH 1/2] media: dvb_frontend: add physical layer scrambling support Athanasios Oikonomou
@ 2017-12-16 12:23 ` Athanasios Oikonomou
  2017-12-17 13:50 ` [PATCH 0/2] Support Physical Layer Scrambling Ralph Metzler
  2 siblings, 0 replies; 5+ messages in thread
From: Athanasios Oikonomou @ 2017-12-16 12:23 UTC (permalink / raw)
  To: linux-media
  Cc: Athanasios Oikonomou, Mauro Carvalho Chehab, Ralph Metzler,
	Manu Abraham

This commit uses the new property scrambling_sequence_index
to control PLS.
By default we are using the gold sequence 0 and only gold sequences
expected on the new property.

Please note that all services use PLS, just most with the default
sequence 0 and many demods only support gold 0.

Signed-off-by: Athanasios Oikonomou <athoik@gmail.com>
---
 drivers/media/dvb-frontends/stv090x.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/media/dvb-frontends/stv090x.c b/drivers/media/dvb-frontends/stv090x.c
index 7ef469c..9369a11 100644
--- a/drivers/media/dvb-frontends/stv090x.c
+++ b/drivers/media/dvb-frontends/stv090x.c
@@ -3429,6 +3429,21 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)
 	return -1;
 }
 
+static int stv090x_set_pls(struct stv090x_state *state, u32 pls_code)
+{
+	dprintk(FE_DEBUG, 1, "Set Gold PLS code %d", pls_code);
+	if (STV090x_WRITE_DEMOD(state, PLROOT0, pls_code & 0xff) < 0)
+		goto err;
+	if (STV090x_WRITE_DEMOD(state, PLROOT1, (pls_code >> 8) & 0xff) < 0)
+		goto err;
+	if (STV090x_WRITE_DEMOD(state, PLROOT2, 0x04 | (pls_code >> 16)) < 0)
+		goto err;
+	return 0;
+err:
+	dprintk(FE_ERROR, 1, "I/O error");
+	return -1;
+}
+
 static int stv090x_set_mis(struct stv090x_state *state, int mis)
 {
 	u32 reg;
@@ -3491,6 +3506,7 @@ static enum dvbfe_search stv090x_search(struct dvb_frontend *fe)
 		state->search_range = 5000000;
 	}
 
+	stv090x_set_pls(state, props->scrambling_sequence_index);
 	stv090x_set_mis(state, props->stream_id);
 
 	if (stv090x_algo(state) == STV090x_RANGEOK) {
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 0/2] Support Physical Layer Scrambling
  2017-12-16 12:23 [PATCH 0/2] Support Physical Layer Scrambling Athanasios Oikonomou
  2017-12-16 12:23 ` [PATCH 1/2] media: dvb_frontend: add physical layer scrambling support Athanasios Oikonomou
  2017-12-16 12:23 ` [PATCH 2/2] media: stv090x: " Athanasios Oikonomou
@ 2017-12-17 13:50 ` Ralph Metzler
  2017-12-19 12:10   ` Mauro Carvalho Chehab
  2 siblings, 1 reply; 5+ messages in thread
From: Ralph Metzler @ 2017-12-17 13:50 UTC (permalink / raw)
  To: linux-media
  Cc: Athanasios Oikonomou, Mauro Carvalho Chehab, Ralph Metzler,
	Manu Abraham


Athanasios Oikonomou writes:
 > A new property DTV_SCRAMBLING_SEQUENCE_INDEX introduced to control
 > the gold sequence that several demods support.
 > 
 > Also the DVB API was increased in order userspace to be aware of the
 > changes.
 > 
 > The stv090x driver was changed to make use of the new property.
 > 
 > Those commits based on discussion previously made on the mailling list.
 > https://www.mail-archive.com/linux-media@vger.kernel.org/msg122600.html
 > 
 > I would like to thanks Ralph Metzler (rjkm@metzlerbros.de) for the
 > great help and ideas he provide me in order create those patches.
 > 
 > Athanasios Oikonomou (2):
 >   media: dvb_frontend: add physical layer scrambling support
 >   media: stv090x: add physical layer scrambling support
 > 
 >  .../media/uapi/dvb/fe_property_parameters.rst          | 18 ++++++++++++++++++
 >  .../uapi/dvb/frontend-property-satellite-systems.rst   |  2 ++
 >  drivers/media/dvb-core/dvb_frontend.c                  | 12 ++++++++++++
 >  drivers/media/dvb-core/dvb_frontend.h                  |  5 +++++
 >  drivers/media/dvb-frontends/stv090x.c                  | 16 ++++++++++++++++
 >  include/uapi/linux/dvb/frontend.h                      |  5 ++++-
 >  include/uapi/linux/dvb/version.h                       |  2 +-
 >  7 files changed, 58 insertions(+), 2 deletions(-)
 > 
 > -- 
 > 2.1.4

Acked-by: Ralph Metzler <rjkm@metzlerbros.de>


We had some thoughts about having a:

#define NO_SCRAMBLING_CODE     (~0U)

But DVB-S2 is always scrambling (with default index 0) and other delivery systems can ignore this
property. Or do you think it is needed?


One could add a define for AUTO or AUTO_S2X for the standard 7 indices to be tested
in DVB-S2X. But either dvb_frontend.c or the demod driver would have to support this in software.
I don't think there is a demod which supports this in hardware yet?


Regards,
Ralph

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] Support Physical Layer Scrambling
  2017-12-17 13:50 ` [PATCH 0/2] Support Physical Layer Scrambling Ralph Metzler
@ 2017-12-19 12:10   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2017-12-19 12:10 UTC (permalink / raw)
  To: Ralph Metzler; +Cc: linux-media, Athanasios Oikonomou, Manu Abraham

Em Sun, 17 Dec 2017 14:50:37 +0100
Ralph Metzler <rjkm@metzlerbros.de> escreveu:

> Athanasios Oikonomou writes:
>  > A new property DTV_SCRAMBLING_SEQUENCE_INDEX introduced to control
>  > the gold sequence that several demods support.
>  > 
>  > Also the DVB API was increased in order userspace to be aware of the
>  > changes.
>  > 
>  > The stv090x driver was changed to make use of the new property.
>  > 
>  > Those commits based on discussion previously made on the mailling list.
>  > https://www.mail-archive.com/linux-media@vger.kernel.org/msg122600.html
>  > 
>  > I would like to thanks Ralph Metzler (rjkm@metzlerbros.de) for the
>  > great help and ideas he provide me in order create those patches.
>  > 
>  > Athanasios Oikonomou (2):
>  >   media: dvb_frontend: add physical layer scrambling support
>  >   media: stv090x: add physical layer scrambling support
>  > 
>  >  .../media/uapi/dvb/fe_property_parameters.rst          | 18 ++++++++++++++++++
>  >  .../uapi/dvb/frontend-property-satellite-systems.rst   |  2 ++
>  >  drivers/media/dvb-core/dvb_frontend.c                  | 12 ++++++++++++
>  >  drivers/media/dvb-core/dvb_frontend.h                  |  5 +++++
>  >  drivers/media/dvb-frontends/stv090x.c                  | 16 ++++++++++++++++
>  >  include/uapi/linux/dvb/frontend.h                      |  5 ++++-
>  >  include/uapi/linux/dvb/version.h                       |  2 +-
>  >  7 files changed, 58 insertions(+), 2 deletions(-)
>  > 
>  > -- 
>  > 2.1.4  
> 
> Acked-by: Ralph Metzler <rjkm@metzlerbros.de>

I'm applying both patches.

> We had some thoughts about having a:
> 
> #define NO_SCRAMBLING_CODE     (~0U)
> 
> But DVB-S2 is always scrambling (with default index 0) and other delivery systems can ignore this
> property. Or do you think it is needed?
> 
> 
> One could add a define for AUTO or AUTO_S2X for the standard 7 indices to be tested
> in DVB-S2X. But either dvb_frontend.c or the demod driver would have to support this in software.
> I don't think there is a demod which supports this in hardware yet?

I think that, once we have a hardware capable of auto-detecting the gold
sequence, then a NO_SCRAMBLING_CODE (or AUTO_GOLD_SEQUENCE) could make
sense.

For now, I don't think any demod currently supports it.

Thanks,
Mauro

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-12-19 12:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-16 12:23 [PATCH 0/2] Support Physical Layer Scrambling Athanasios Oikonomou
2017-12-16 12:23 ` [PATCH 1/2] media: dvb_frontend: add physical layer scrambling support Athanasios Oikonomou
2017-12-16 12:23 ` [PATCH 2/2] media: stv090x: " Athanasios Oikonomou
2017-12-17 13:50 ` [PATCH 0/2] Support Physical Layer Scrambling Ralph Metzler
2017-12-19 12:10   ` Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).