Re: [PATCH v7 1/3] media: adv748x: Add adv7481, adv7482 bindings
On Thu, Jul 06, 2017 at 12:01:15PM +0100, Kieran Bingham wrote: > From: Kieran Bingham> > Create device tree bindings documentation for the ADV748x. > The ADV748x supports both the ADV7481 and ADV7482 chips which > provide analogue decoding and HDMI receiving capabilities > > Signed-off-by: Kieran Bingham > Reviewed-by: Laurent Pinchart > > --- > v6: > - Clean up description and remove redundant text regarding optional >nodes > > v6.1: > - Fix commit title > > Documentation/devicetree/bindings/media/i2c/adv748x.txt | 95 ++- > 1 file changed, 95 insertions(+) > create mode 100644 Documentation/devicetree/bindings/media/i2c/adv748x.txt Acked-by: Rob Herring
Re: [PATCH 2/2] dt-bindings: media: Add Amlogic Meson AO-CEC bindings
On Thu, Jul 06, 2017 at 12:27:50PM +0200, Neil Armstrong wrote: > The Amlogic SoCs embeds a standalone CEC Controller, this patch adds this > device bindings. > > Signed-off-by: Neil Armstrong> --- > .../devicetree/bindings/media/meson-ao-cec.txt | 28 > ++ > 1 file changed, 28 insertions(+) > create mode 100644 Documentation/devicetree/bindings/media/meson-ao-cec.txt Acked-by: Rob Herring
cron job: media_tree daily build: ERRORS
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: Mon Jul 10 05:00:20 CEST 2017 media-tree git hash:2748e76ddb2967c4030171342ebdd3faa6a5e8e8 media_build git hash: bc1db0a204a87da86349ea5e64ae0d65e945609d v4l-utils git hash: 8e68406dae2233e811032dc8e7714c09c818e893 gcc version:i686-linux-gcc (GCC) 7.1.0 sparse version: v0.5.0-3553-g78b2ea6 smatch version: v0.5.0-3553-g78b2ea6 host hardware: x86_64 host os:4.9.0-164 linux-git-arm-at91: WARNINGS linux-git-arm-davinci: WARNINGS linux-git-arm-multi: WARNINGS linux-git-arm-pxa: OK linux-git-arm-stm32: OK linux-git-blackfin-bf561: 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: WARNINGS linux-2.6.36.4-i686: WARNINGS linux-2.6.37.6-i686: WARNINGS linux-2.6.38.8-i686: WARNINGS 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: ERRORS 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: WARNINGS linux-3.11.1-i686: OK linux-3.12.67-i686: OK linux-3.13.11-i686: WARNINGS linux-3.14.9-i686: ERRORS linux-3.15.2-i686: ERRORS linux-3.16.7-i686: ERRORS linux-3.17.8-i686: ERRORS linux-3.18.7-i686: ERRORS linux-3.19-i686: WARNINGS linux-4.0.9-i686: WARNINGS linux-4.1.33-i686: WARNINGS linux-4.2.8-i686: WARNINGS linux-4.3.6-i686: WARNINGS linux-4.4.22-i686: WARNINGS linux-4.5.7-i686: WARNINGS linux-4.6.7-i686: WARNINGS linux-4.7.5-i686: WARNINGS linux-4.8-i686: OK linux-4.9.26-i686: OK linux-4.10.14-i686: OK linux-4.11-i686: OK linux-4.12-rc1-i686: OK linux-2.6.36.4-x86_64: WARNINGS linux-2.6.37.6-x86_64: WARNINGS linux-2.6.38.8-x86_64: WARNINGS linux-2.6.39.4-x86_64: WARNINGS linux-3.0.60-x86_64: WARNINGS linux-3.1.10-x86_64: WARNINGS linux-3.2.37-x86_64: WARNINGS linux-3.3.8-x86_64: WARNINGS linux-3.4.27-x86_64: ERRORS linux-3.5.7-x86_64: WARNINGS linux-3.6.11-x86_64: WARNINGS linux-3.7.4-x86_64: WARNINGS linux-3.8-x86_64: WARNINGS linux-3.9.2-x86_64: WARNINGS linux-3.10.1-x86_64: WARNINGS linux-3.11.1-x86_64: WARNINGS linux-3.12.67-x86_64: WARNINGS linux-3.13.11-x86_64: WARNINGS linux-3.14.9-x86_64: ERRORS linux-3.15.2-x86_64: ERRORS linux-3.16.7-x86_64: ERRORS linux-3.17.8-x86_64: WARNINGS linux-3.18.7-x86_64: WARNINGS linux-3.19-x86_64: WARNINGS linux-4.0.9-x86_64: WARNINGS linux-4.1.33-x86_64: WARNINGS linux-4.2.8-x86_64: WARNINGS linux-4.3.6-x86_64: WARNINGS linux-4.4.22-x86_64: WARNINGS linux-4.5.7-x86_64: WARNINGS linux-4.6.7-x86_64: WARNINGS linux-4.7.5-x86_64: WARNINGS linux-4.8-x86_64: WARNINGS linux-4.9.26-x86_64: WARNINGS linux-4.10.14-x86_64: WARNINGS linux-4.11-x86_64: WARNINGS linux-4.12-rc1-x86_64: WARNINGS apps: WARNINGS spec-git: OK sparse: WARNINGS Detailed results are available here: http://www.xs4all.nl/~hverkuil/logs/Monday.log Full logs are available here: http://www.xs4all.nl/~hverkuil/logs/Monday.tar.bz2 The Media Infrastructure API from this daily build is here: http://www.xs4all.nl/~hverkuil/spec/index.html
[PATCH] ngene: constify i2c_algorithm structure
Check for i2c_algorithm structures that are only stored in the algo field of an i2c_adapter structure. This field is declared const, so i2c_algorithm structures that have this property can be declared as const also. This issue was identified using Coccinelle and the following semantic patch: @r disable optional_qualifier@ identifier i; position p; @@ static struct i2c_algorithm i@p = { ... }; @ok@ identifier r.i; struct i2c_adapter e; position p; @@ e.algo = @p; @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct i2c_algorithm i = { ... }; Signed-off-by: Gustavo A. R. Silva--- drivers/media/pci/ngene/ngene-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/ngene/ngene-i2c.c b/drivers/media/pci/ngene/ngene-i2c.c index fbf3635..3004947 100644 --- a/drivers/media/pci/ngene/ngene-i2c.c +++ b/drivers/media/pci/ngene/ngene-i2c.c @@ -150,7 +150,7 @@ static u32 ngene_i2c_functionality(struct i2c_adapter *adap) return I2C_FUNC_SMBUS_EMUL; } -static struct i2c_algorithm ngene_i2c_algo = { +static const struct i2c_algorithm ngene_i2c_algo = { .master_xfer = ngene_i2c_master_xfer, .functionality = ngene_i2c_functionality, }; -- 2.5.0
[PATCH] mantis: constify i2c_algorithm structure
Check for i2c_algorithm structures that are only stored in the algo field of an i2c_adapter structure. This field is declared const, so i2c_algorithm structures that have this property can be declared as const also. This issue was identified using Coccinelle and the following semantic patch: @r disable optional_qualifier@ identifier i; position p; @@ static struct i2c_algorithm i@p = { ... }; @ok@ identifier r.i; struct i2c_adapter e; position p; @@ e.algo = @p; @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct i2c_algorithm i = { ... }; Signed-off-by: Gustavo A. R. Silva--- drivers/media/pci/mantis/mantis_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/mantis/mantis_i2c.c b/drivers/media/pci/mantis/mantis_i2c.c index d72ee47..496c10d 100644 --- a/drivers/media/pci/mantis/mantis_i2c.c +++ b/drivers/media/pci/mantis/mantis_i2c.c @@ -212,7 +212,7 @@ static u32 mantis_i2c_func(struct i2c_adapter *adapter) return I2C_FUNC_SMBUS_EMUL; } -static struct i2c_algorithm mantis_algo = { +static const struct i2c_algorithm mantis_algo = { .master_xfer= mantis_i2c_xfer, .functionality = mantis_i2c_func, }; -- 2.5.0
[PATCH] dm1105: constify i2c_algorithm structure
Check for i2c_algorithm structures that are only stored in the algo field of an i2c_adapter structure. This field is declared const, so i2c_algorithm structures that have this property can be declared as const also. This issue was identified using Coccinelle and the following semantic patch: @r disable optional_qualifier@ identifier i; position p; @@ static struct i2c_algorithm i@p = { ... }; @ok@ identifier r.i; struct i2c_adapter e; position p; @@ e.algo = @p; @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct i2c_algorithm i = { ... }; Signed-off-by: Gustavo A. R. Silva--- drivers/media/pci/dm1105/dm1105.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/dm1105/dm1105.c b/drivers/media/pci/dm1105/dm1105.c index 1d41934..36e94f8 100644 --- a/drivers/media/pci/dm1105/dm1105.c +++ b/drivers/media/pci/dm1105/dm1105.c @@ -571,7 +571,7 @@ static u32 functionality(struct i2c_adapter *adap) return I2C_FUNC_I2C; } -static struct i2c_algorithm dm1105_algo = { +static const struct i2c_algorithm dm1105_algo = { .master_xfer = dm1105_i2c_xfer, .functionality = functionality, }; -- 2.5.0
[PATCH] ddbridge: constify i2c_algorithm structure
Check for i2c_algorithm structures that are only stored in the algo field of an i2c_adapter structure. This field is declared const, so i2c_algorithm structures that have this property can be declared as const also. This issue was identified using Coccinelle and the following semantic patch: @r disable optional_qualifier@ identifier i; position p; @@ static struct i2c_algorithm i@p = { ... }; @ok@ identifier r.i; struct i2c_adapter e; position p; @@ e.algo = @p; @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct i2c_algorithm i = { ... }; Signed-off-by: Gustavo A. R. Silva--- drivers/media/pci/ddbridge/ddbridge-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index cd1723e..9663a4c 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -200,7 +200,7 @@ static u32 ddb_i2c_functionality(struct i2c_adapter *adap) return I2C_FUNC_SMBUS_EMUL; } -static struct i2c_algorithm ddb_i2c_algo = { +static const struct i2c_algorithm ddb_i2c_algo = { .master_xfer = ddb_i2c_master_xfer, .functionality = ddb_i2c_functionality, }; -- 2.5.0
[PATCH] cx24123: constify i2c_algorithm structure
Check for i2c_algorithm structures that are only stored in the algo field of an i2c_adapter structure. This field is declared const, so i2c_algorithm structures that have this property can be declared as const also. This issue was identified using Coccinelle and the following semantic patch: @r disable optional_qualifier@ identifier i; position p; @@ static struct i2c_algorithm i@p = { ... }; @ok@ identifier r.i; struct i2c_adapter e; position p; @@ e.algo = @p; @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct i2c_algorithm i = { ... }; Signed-off-by: Gustavo A. R. Silva--- drivers/media/dvb-frontends/cx24123.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/cx24123.c b/drivers/media/dvb-frontends/cx24123.c index 4ae3d92..1d59d1d 100644 --- a/drivers/media/dvb-frontends/cx24123.c +++ b/drivers/media/dvb-frontends/cx24123.c @@ -1032,7 +1032,7 @@ static u32 cx24123_tuner_i2c_func(struct i2c_adapter *adapter) return I2C_FUNC_I2C; } -static struct i2c_algorithm cx24123_tuner_i2c_algo = { +static const struct i2c_algorithm cx24123_tuner_i2c_algo = { .master_xfer = cx24123_tuner_i2c_tuner_xfer, .functionality = cx24123_tuner_i2c_func, }; -- 2.5.0
[PATCH] zd1301_demod: constify i2c_algorithm structure
Check for i2c_algorithm structures that are only stored in the algo field of an i2c_adapter structure. This field is declared const, so i2c_algorithm structures that have this property can be declared as const also. This issue was identified using Coccinelle and the following semantic patch: @r disable optional_qualifier@ identifier i; position p; @@ static struct i2c_algorithm i@p = { ... }; @ok@ identifier r.i; struct i2c_adapter e; position p; @@ e.algo = @p; @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct i2c_algorithm i = { ... }; Signed-off-by: Gustavo A. R. Silva--- drivers/media/dvb-frontends/zd1301_demod.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/zd1301_demod.c b/drivers/media/dvb-frontends/zd1301_demod.c index fcf5f69..84a2b25 100644 --- a/drivers/media/dvb-frontends/zd1301_demod.c +++ b/drivers/media/dvb-frontends/zd1301_demod.c @@ -445,7 +445,7 @@ static u32 zd1301_demod_i2c_functionality(struct i2c_adapter *adapter) return I2C_FUNC_I2C; } -static struct i2c_algorithm zd1301_demod_i2c_algorithm = { +static const struct i2c_algorithm zd1301_demod_i2c_algorithm = { .master_xfer = zd1301_demod_i2c_master_xfer, .functionality = zd1301_demod_i2c_functionality, }; -- 2.5.0
[PATCH] dib8000: constify i2c_algorithm structure
Check for i2c_algorithm structures that are only stored in the algo field of an i2c_adapter structure. This field is declared const, so i2c_algorithm structures that have this property can be declared as const also. This issue was identified using Coccinelle and the following semantic patch: @r disable optional_qualifier@ identifier i; position p; @@ static struct i2c_algorithm i@p = { ... }; @ok@ identifier r.i; struct i2c_adapter e; position p; @@ e.algo = @p; @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct i2c_algorithm i = { ... }; Signed-off-by: Gustavo A. R. Silva--- drivers/media/dvb-frontends/dib8000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/dib8000.c b/drivers/media/dvb-frontends/dib8000.c index e501ec9..a179a3f 100644 --- a/drivers/media/dvb-frontends/dib8000.c +++ b/drivers/media/dvb-frontends/dib8000.c @@ -1880,7 +1880,7 @@ static u32 dib8096p_i2c_func(struct i2c_adapter *adapter) return I2C_FUNC_I2C; } -static struct i2c_algorithm dib8096p_tuner_xfer_algo = { +static const struct i2c_algorithm dib8096p_tuner_xfer_algo = { .master_xfer = dib8096p_tuner_xfer, .functionality = dib8096p_i2c_func, }; -- 2.5.0
[PATCH] s5h1420: constify i2c_algorithm structure
Check for i2c_algorithm structures that are only stored in the algo field of an i2c_adapter structure. This field is declared const, so i2c_algorithm structures that have this property can be declared as const also. This issue was identified using Coccinelle and the following semantic patch: @r disable optional_qualifier@ identifier i; position p; @@ static struct i2c_algorithm i@p = { ... }; @ok@ identifier r.i; struct i2c_adapter e; position p; @@ e.algo = @p; @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct i2c_algorithm i = { ... }; Signed-off-by: Gustavo A. R. Silva--- drivers/media/dvb-frontends/s5h1420.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/s5h1420.c b/drivers/media/dvb-frontends/s5h1420.c index cba9bff..fd427a29 100644 --- a/drivers/media/dvb-frontends/s5h1420.c +++ b/drivers/media/dvb-frontends/s5h1420.c @@ -864,7 +864,7 @@ static int s5h1420_tuner_i2c_tuner_xfer(struct i2c_adapter *i2c_adap, struct i2c return i2c_transfer(state->i2c, m, 1 + num) == 1 + num ? num : -EIO; } -static struct i2c_algorithm s5h1420_tuner_i2c_algo = { +static const struct i2c_algorithm s5h1420_tuner_i2c_algo = { .master_xfer = s5h1420_tuner_i2c_tuner_xfer, .functionality = s5h1420_tuner_i2c_func, }; -- 2.5.0
[no subject]
Schönen Tag, Ich bin Thomas Walter, der Finanzagent dieser Firma, bekannt als Corporate Lenders. Wir leihen Geld für Einzelpersonen und Unternehmen, die finanzielle Hilfe benötigen. Hast du einen schlechten Kredit oder du brauchst Geld, um deine Rechnungen zu bezahlen? Wir verwenden dieses Medium, um Ihnen mitzuteilen, dass wir Ihnen bei jeder Form von Darlehen helfen können, wie Sie Refinanzierung, Schuldenkonsolidierung Darlehen, persönliche Darlehen, internationale Darlehen und Business-Darlehen. Wir freuen uns, Ihnen ein Darlehen so niedrig wie der Zinssatz von 3% anzubieten. Unsere Mission ist es, unseren Kunden einen Service zu bieten, der schnell, freundlich und stressfrei ist. Normalerweise, wenn wir alle Ihre Informationen haben, dauert es nur eine Stunde, um die Genehmigung zu finanzieren. Wenn Sie interessiert sind, füllen Sie bitte das Darlehensantragsformular aus. Vollständiger Name: Geschlecht: Benötigte Menge: Dauer: Tel: Sprich Englisch? Wir warten auf Ihre Antwort. Sie erreichen uns per E-Mail: i...@corporatelendersonline.com Mit freundlichen Grüßen, Thomas Walter
[PATCH] dib7000p: constify i2c_algorithm structure
Check for i2c_algorithm structures that are only stored in the algo field of an i2c_adapter structure. This field is declared const, so i2c_algorithm structures that have this property can be declared as const also. This issue was identified using Coccinelle and the following semantic patch: @r disable optional_qualifier@ identifier i; position p; @@ static struct i2c_algorithm i@p = { ... }; @ok@ identifier r.i; struct i2c_adapter e; position p; @@ e.algo = @p; @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct i2c_algorithm i = { ... }; Signed-off-by: Gustavo A. R. Silva--- drivers/media/dvb-frontends/dib7000p.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/dib7000p.c b/drivers/media/dvb-frontends/dib7000p.c index 1caa04d..0fbaabe 100644 --- a/drivers/media/dvb-frontends/dib7000p.c +++ b/drivers/media/dvb-frontends/dib7000p.c @@ -2388,7 +2388,7 @@ static u32 dib7000p_i2c_func(struct i2c_adapter *adapter) return I2C_FUNC_I2C; } -static struct i2c_algorithm dib7090_tuner_xfer_algo = { +static const struct i2c_algorithm dib7090_tuner_xfer_algo = { .master_xfer = dib7090_tuner_xfer, .functionality = dib7000p_i2c_func, }; -- 2.5.0
[PATCH] marvell-ccic: constify i2c_algorithm structure
Check for i2c_algorithm structures that are only stored in the algo field of an i2c_adapter structure. This field is declared const, so i2c_algorithm structures that have this property can be declared as const also. This issue was identified using Coccinelle and the following semantic patch: @r disable optional_qualifier@ identifier i; position p; @@ static struct i2c_algorithm i@p = { ... }; @ok@ identifier r.i; struct i2c_adapter e; position p; @@ e.algo = @p; @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct i2c_algorithm i = { ... }; Signed-off-by: Gustavo A. R. Silva--- drivers/media/platform/marvell-ccic/cafe-driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/marvell-ccic/cafe-driver.c b/drivers/media/platform/marvell-ccic/cafe-driver.c index 77890bd..063fd43 100644 --- a/drivers/media/platform/marvell-ccic/cafe-driver.c +++ b/drivers/media/platform/marvell-ccic/cafe-driver.c @@ -326,7 +326,7 @@ static u32 cafe_smbus_func(struct i2c_adapter *adapter) I2C_FUNC_SMBUS_WRITE_BYTE_DATA; } -static struct i2c_algorithm cafe_smbus_algo = { +static const struct i2c_algorithm cafe_smbus_algo = { .smbus_xfer = cafe_smbus_xfer, .functionality = cafe_smbus_func }; -- 2.5.0
[PATCH] saa7146: constify i2c_algorithm structure
Check for i2c_algorithm structures that are only stored in the algo field of an i2c_adapter structure. This field is declared const, so i2c_algorithm structures that have this property can be declared as const also. This issue was identified using Coccinelle and the following semantic patch: @r disable optional_qualifier@ identifier i; position p; @@ static struct i2c_algorithm i@p = { ... }; @ok@ identifier r.i; struct i2c_adapter e; position p; @@ e.algo = @p; @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct i2c_algorithm i = { ... }; Signed-off-by: Gustavo A. R. Silva--- drivers/media/common/saa7146/saa7146_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/common/saa7146/saa7146_i2c.c b/drivers/media/common/saa7146/saa7146_i2c.c index 239a2db..75897f9 100644 --- a/drivers/media/common/saa7146/saa7146_i2c.c +++ b/drivers/media/common/saa7146/saa7146_i2c.c @@ -395,7 +395,7 @@ static int saa7146_i2c_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, in /* i2c-adapter helper functions */ /* exported algorithm data */ -static struct i2c_algorithm saa7146_algo = { +static const struct i2c_algorithm saa7146_algo = { .master_xfer= saa7146_i2c_xfer, .functionality = saa7146_i2c_func, }; -- 2.5.0
[PATCH] dib9000: constify i2c_algorithm structure
Check for i2c_algorithm structures that are only stored in the algo field of an i2c_adapter structure. This field is declared const, so i2c_algorithm structures that have this property can be declared as const also. This issue was identified using Coccinelle and the following semantic patch: @r disable optional_qualifier@ identifier i; position p; @@ static struct i2c_algorithm i@p = { ... }; @ok@ identifier r.i; struct i2c_adapter e; position p; @@ e.algo = @p; @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct i2c_algorithm i = { ... }; Signed-off-by: Gustavo A. R. Silva--- drivers/media/dvb-frontends/dib9000.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb-frontends/dib9000.c b/drivers/media/dvb-frontends/dib9000.c index c95fff4..17c6f15 100644 --- a/drivers/media/dvb-frontends/dib9000.c +++ b/drivers/media/dvb-frontends/dib9000.c @@ -1714,12 +1714,12 @@ static u32 dib9000_i2c_func(struct i2c_adapter *adapter) return I2C_FUNC_I2C; } -static struct i2c_algorithm dib9000_tuner_algo = { +static const struct i2c_algorithm dib9000_tuner_algo = { .master_xfer = dib9000_tuner_xfer, .functionality = dib9000_i2c_func, }; -static struct i2c_algorithm dib9000_component_bus_algo = { +static const struct i2c_algorithm dib9000_component_bus_algo = { .master_xfer = dib9000_fw_component_bus_xfer, .functionality = dib9000_i2c_func, }; -- 2.5.0
[PATCH] usbvision: constify i2c_algorithm structure
Check for i2c_algorithm structures that are only stored in the algo field of an i2c_adapter structure. This field is declared const, so i2c_algorithm structures that have this property can be declared as const also. This issue was identified using Coccinelle and the following semantic patch: @r disable optional_qualifier@ identifier i; position p; @@ static struct i2c_algorithm i@p = { ... }; @ok@ identifier r.i; struct i2c_adapter e; position p; @@ e.algo = @p; @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct i2c_algorithm i = { ... }; Signed-off-by: Gustavo A. R. Silva--- drivers/media/usb/usbvision/usbvision-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/usbvision/usbvision-i2c.c b/drivers/media/usb/usbvision/usbvision-i2c.c index fdf6b6e..f86a0e0 100644 --- a/drivers/media/usb/usbvision/usbvision-i2c.c +++ b/drivers/media/usb/usbvision/usbvision-i2c.c @@ -163,7 +163,7 @@ static u32 functionality(struct i2c_adapter *adap) /* -exported algorithm data: - */ -static struct i2c_algorithm usbvision_algo = { +static const struct i2c_algorithm usbvision_algo = { .master_xfer = usbvision_i2c_xfer, .smbus_xfer= NULL, .functionality = functionality, -- 2.5.0
[PATCH] dvb-ttusb-budget: constify i2c_algorithm structure
Check for i2c_algorithm structures that are only stored in the algo field of an i2c_adapter structure. This field is declared const, so i2c_algorithm structures that have this property can be declared as const also. This issue was identified using Coccinelle and the following semantic patch: @r disable optional_qualifier@ identifier i; position p; @@ static struct i2c_algorithm i@p = { ... }; @ok@ identifier r.i; struct i2c_adapter e; position p; @@ e.algo = @p; @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct i2c_algorithm i = { ... }; Signed-off-by: Gustavo A. R. Silva--- drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c index 361e40b..22a488d 100644 --- a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c @@ -1640,7 +1640,7 @@ static void frontend_init(struct ttusb* ttusb) -static struct i2c_algorithm ttusb_dec_algo = { +static const struct i2c_algorithm ttusb_dec_algo = { .master_xfer= master_xfer, .functionality = functionality, }; -- 2.5.0
[PATCH]
From 043428d63637a6dd8e52449b73dbb8341885d7e4 Mon Sep 17 00:00:00 2001 From: Armin SchoenliebDate: Mon, 10 Jul 2017 01:12:52 +0200 Subject: [PATCH] Staging: media: atomisp2: fixed trailing whitespace error in atomisp_v4l2.c This is a patch to the atomisp_v4l2.c file that fixes up a trailing whitespace error found by the checkpatch.pl tool Signed-off-by: Armin Schoenlieb --- drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c index a543def739fc..05d02ebb6d25 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c @@ -1277,13 +1277,13 @@ static int atomisp_pci_probe(struct pci_dev *dev, (ATOMISP_HW_REVISION_ISP2400 << ATOMISP_HW_REVISION_SHIFT) | ATOMISP_HW_STEPPING_B0; -#ifdef FIXME +#ifdef FIXME if (INTEL_MID_BOARD(3, TABLET, BYT, BLK, PRO, CRV2) || INTEL_MID_BOARD(3, TABLET, BYT, BLK, ENG, CRV2)) { isp->dfs = _config_byt_cr; isp->hpll_freq = HPLL_FREQ_2000MHZ; } else -#endif +#endif { isp->dfs = _config_byt; isp->hpll_freq = HPLL_FREQ_1600MHZ; -- 2.11.0
Re: [PATCH] media: venus: hfi: fix error handling in hfi_sys_init_done()
On Sun, Jul 9, 2017 at 3:49 PM, Stanimir Varbanovwrote: > Hi Rob, > > On 07/09/2017 04:19 PM, Rob Clark wrote: >> Not entirely sure what triggers it, but with venus build as kernel >> module and in initrd, we hit this crash: > > Is it happens occasionally or everytime in the initrd? And also with > your patch it will bail out on venus_probe, does it crash again on next > venus_probe? seems to happen every time.. (module is ending up in initrd, but not sure if fw is.. which might be triggering this?) I could not boot successfully without this patch, but otoh I haven't yet tried if venus actually works after boot. BR, -R >> >> Unable to handle kernel paging request at virtual address 80003c039000 >> pgd = 0a14f000 >> [80003c039000] *pgd=bd9f7003, *pud=bd9f6003, >> *pmd=bd9f0003, *pte= >> Internal error: Oops: 9607 [#1] SMP >> Modules linked in: qcom_wcnss_pil(E+) crc32_ce(E) qcom_common(E) >> venus_core(E+) remoteproc(E) snd_soc_msm8916_digital(E) virtio_ring(E) >> cdc_ether(E) snd_soc_lpass_apq8016(E) snd_soc_lpass_cpu(E) >> snd_soc_apq8016_sbc(E) snd_soc_lpass_platform(E) v4l2_mem2mem(E) virtio(E) >> snd_soc_core(E) ac97_bus(E) snd_pcm_dmaengine(E) snd_seq(E) leds_gpio(E) >> videobuf2_v4l2(E) videobuf2_core(E) snd_seq_device(E) sndi_pcm(E) >> videodev(E) media(E) nvmem_qfprom(E) msm(E) snd_timer(E) snd(E) soundcore(E) >> spi_qup(E) mdt_loader(E) qcom_tsens(E) qcom_spmi_temp_alarm(E) nvmem_core(E) >> msm_rng(E) uas(E) usb_storage(E) dm9601(E) usbnet(E) mii(E) mmc_block(E) >> adv7511(E) drm_kms_helper(E) syscopyarea(E) sysfillrect(E) sysimgblt(E) >> fb_sys_fops(E) qcom_spmi_vadc(E) qcom_vadc_common(PE) industrialio(E) >> pinctrl_spmi_mpp(E) >>pinctrl_spmi_gpio(E) rtc_pm8xxx(E) clk_smd_rpm(E) sdhci_msm(E) >> sdhci_pltfm(E) qcom_smd_regulator(E) drm(E) smd_rpm(E) qcom_spmi_pmic(E) >> regmap_spmi(E) ci_hdrc_msm(E) ci_hdrc(E) usb3503(E) extcon_usb_gpio(E) >> phy_msm_usb(E) udc_core(E) qcom_hwspinlock(E) extcon_core(E) ehci_msm(E) >> i2c_qup(E) sdhci(E) mmc_core(E) spmi_pmic_arb(E) spmi(E) qcom_smd(E) smsm(E) >> rpmsg_core(E) smp2p(E) smem(E) hwspinlock_core(E) gpio_keys(E) >> CPU: 2 PID: 551 Comm: irq/150-venus Tainted: PE 4.12.0+ #1625 >> Hardware name: qualcomm dragonboard410c/dragonboard410c, BIOS >> 2017.07-rc2-00144-ga97bdbdf72-dirty 07/08/2017 >> task: 800037338000 task.stack: 800038e0 >> PC is at hfi_sys_init_done+0x64/0x140 [venus_core] >> LR is at hfi_process_msg_packet+0xcc/0x1e8 [venus_core] >> pc : [] lr : [] pstate: 20400145 >> sp : 800038e03c60 >> x29: 800038e03c60 x28: >> x27: 000df018 x26: 0118f4d0 >> x25: 00020003 x24: 80003a8d3010 >> x23: 0118f760 x22: 800037b40028 >> x21: 8000382981f0 x20: 800037b40028 >> x19: 80003c039000 x18: 0020 >> x17: x16: 800037338000 >> x15: x14: 00100014 >> x13: 00011007 x12: 00010020 >> x11: 100e x10: 0001 >> x9 : 0002 x8 : 00140001 >> x7 : 1010 x6 : 0148 >> x5 : 1009 x4 : 80003c039000 >> x3 : cd770abb x2 : 0042 >> x1 : 0788 x0 : 0002 >> Process irq/150-venus (pid: 551, stack limit = 0x800038e0) >> Call trace: >> [] hfi_sys_init_done+0x64/0x140 [venus_core] >> [] hfi_process_msg_packet+0xcc/0x1e8 [venus_core] >> [] venus_isr_thread+0x1b4/0x208 [venus_core] >> [] hfi_isr_thread+0x28/0x38 [venus_core] >> [] irq_thread_fn+0x30/0x70 >> [] irq_thread+0x14c/0x1c8 >> [] kthread+0x138/0x140 >> [] ret_from_fork+0x10/0x40 >> Code: 52820125 52820207 7a431820 54000249 (b9400263) >> ---[ end trace c963460f20a984b6 ]--- >> >> The problem is that in the error case, we've incremented the data ptr >> but not decremented rem_bytes, and keep reading (presumably garbage) >> until eventually we go beyond the end of the buffer. >> >> Instead, on first error, we should probably just bail out. Other >> option is to increment read_bytes by sizeof(u32) before the switch, >> rather than only accounting for the ptype header in the non-error >> case. Note that in this case it is HFI_ERR_SYS_INVALID_PARAMETER, >> ie. an unrecognized/unsupported parameter, so interpreting the next >> word as a property type would be bogus. The other error cases are >> due to truncated buffer, so there isn't likely to be anything valid >> to interpret in the remainder of the buffer. So just bailing seems >> like a reasonable solution. > > I have a WIP patch which rewrite the message parsing, it would be nice > if I can reproduce this crash. > >> >> Signed-off-by: Rob Clark >> --- >> drivers/media/platform/qcom/venus/hfi_msgs.c | 11 ++- >> 1 file changed, 6 insertions(+), 5
Re: [PATCH v2] staging: atomisp: use kstrdup to replace kmalloc and memcpy
On Sun, Jul 09, 2017 at 05:56:15PM +0530, hari prasath wrote: > On 8 July 2017 at 16:31, Sakari Ailuswrote: > > Hi Hari, > > > > On Fri, Jul 07, 2017 at 08:15:21PM +0530, Hari Prasath wrote: > >> kstrdup kernel primitive can be used to replace kmalloc followed by > >> string copy. This was reported by coccinelle tool > >> > >> Signed-off-by: Hari Prasath > >> --- > >> .../media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c | 10 > >> +++--- > >> 1 file changed, 3 insertions(+), 7 deletions(-) > >> > >> diff --git > >> a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c > >> b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c > >> index 34cc56f..68db87b 100644 > >> --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c > >> +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c > >> @@ -144,14 +144,10 @@ sh_css_load_blob_info(const char *fw, const struct > >> ia_css_fw_info *bi, struct ia > >> ) > >> { > >> char *namebuffer; > >> - int namelength = (int)strlen(name); > >> - > >> - namebuffer = (char *) kmalloc(namelength + 1, GFP_KERNEL); > >> - if (namebuffer == NULL) > >> - return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; > >> - > >> - memcpy(namebuffer, name, namelength + 1); > >> > >> + namebuffer = kstrdup(name, GFP_KERNEL); > >> + if (!namebuffer) > >> + return -ENOMEM; > > > > The patch also changes the return value in error cases. I believe the > > caller(s) expect to get errors in the IA_CCS_ERR_* range. > > Hi, > > In this particular case, the calling function just checks if it's not > success defined by a enum. I think returning -ENOMEM would not effect, > at least in this case. It might not, but the function now returns both negative Posix and positive CSS error codes. The CSS error codes could well be converted to Posix but it should be done consistently and preferrably in a separate patch. -- Sakari Ailus e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
Re: [PATCH] media: venus: hfi: fix error handling in hfi_sys_init_done()
Hi Rob, On 07/09/2017 04:19 PM, Rob Clark wrote: > Not entirely sure what triggers it, but with venus build as kernel > module and in initrd, we hit this crash: Is it happens occasionally or everytime in the initrd? And also with your patch it will bail out on venus_probe, does it crash again on next venus_probe? > > Unable to handle kernel paging request at virtual address 80003c039000 > pgd = 0a14f000 > [80003c039000] *pgd=bd9f7003, *pud=bd9f6003, > *pmd=bd9f0003, *pte= > Internal error: Oops: 9607 [#1] SMP > Modules linked in: qcom_wcnss_pil(E+) crc32_ce(E) qcom_common(E) > venus_core(E+) remoteproc(E) snd_soc_msm8916_digital(E) virtio_ring(E) > cdc_ether(E) snd_soc_lpass_apq8016(E) snd_soc_lpass_cpu(E) > snd_soc_apq8016_sbc(E) snd_soc_lpass_platform(E) v4l2_mem2mem(E) virtio(E) > snd_soc_core(E) ac97_bus(E) snd_pcm_dmaengine(E) snd_seq(E) leds_gpio(E) > videobuf2_v4l2(E) videobuf2_core(E) snd_seq_device(E) sndi_pcm(E) videodev(E) > media(E) nvmem_qfprom(E) msm(E) snd_timer(E) snd(E) soundcore(E) spi_qup(E) > mdt_loader(E) qcom_tsens(E) qcom_spmi_temp_alarm(E) nvmem_core(E) msm_rng(E) > uas(E) usb_storage(E) dm9601(E) usbnet(E) mii(E) mmc_block(E) adv7511(E) > drm_kms_helper(E) syscopyarea(E) sysfillrect(E) sysimgblt(E) fb_sys_fops(E) > qcom_spmi_vadc(E) qcom_vadc_common(PE) industrialio(E) pinctrl_spmi_mpp(E) >pinctrl_spmi_gpio(E) rtc_pm8xxx(E) clk_smd_rpm(E) sdhci_msm(E) > sdhci_pltfm(E) qcom_smd_regulator(E) drm(E) smd_rpm(E) qcom_spmi_pmic(E) > regmap_spmi(E) ci_hdrc_msm(E) ci_hdrc(E) usb3503(E) extcon_usb_gpio(E) > phy_msm_usb(E) udc_core(E) qcom_hwspinlock(E) extcon_core(E) ehci_msm(E) > i2c_qup(E) sdhci(E) mmc_core(E) spmi_pmic_arb(E) spmi(E) qcom_smd(E) smsm(E) > rpmsg_core(E) smp2p(E) smem(E) hwspinlock_core(E) gpio_keys(E) > CPU: 2 PID: 551 Comm: irq/150-venus Tainted: PE 4.12.0+ #1625 > Hardware name: qualcomm dragonboard410c/dragonboard410c, BIOS > 2017.07-rc2-00144-ga97bdbdf72-dirty 07/08/2017 > task: 800037338000 task.stack: 800038e0 > PC is at hfi_sys_init_done+0x64/0x140 [venus_core] > LR is at hfi_process_msg_packet+0xcc/0x1e8 [venus_core] > pc : [] lr : [] pstate: 20400145 > sp : 800038e03c60 > x29: 800038e03c60 x28: > x27: 000df018 x26: 0118f4d0 > x25: 00020003 x24: 80003a8d3010 > x23: 0118f760 x22: 800037b40028 > x21: 8000382981f0 x20: 800037b40028 > x19: 80003c039000 x18: 0020 > x17: x16: 800037338000 > x15: x14: 00100014 > x13: 00011007 x12: 00010020 > x11: 100e x10: 0001 > x9 : 0002 x8 : 00140001 > x7 : 1010 x6 : 0148 > x5 : 1009 x4 : 80003c039000 > x3 : cd770abb x2 : 0042 > x1 : 0788 x0 : 0002 > Process irq/150-venus (pid: 551, stack limit = 0x800038e0) > Call trace: > [] hfi_sys_init_done+0x64/0x140 [venus_core] > [] hfi_process_msg_packet+0xcc/0x1e8 [venus_core] > [] venus_isr_thread+0x1b4/0x208 [venus_core] > [] hfi_isr_thread+0x28/0x38 [venus_core] > [] irq_thread_fn+0x30/0x70 > [] irq_thread+0x14c/0x1c8 > [] kthread+0x138/0x140 > [] ret_from_fork+0x10/0x40 > Code: 52820125 52820207 7a431820 54000249 (b9400263) > ---[ end trace c963460f20a984b6 ]--- > > The problem is that in the error case, we've incremented the data ptr > but not decremented rem_bytes, and keep reading (presumably garbage) > until eventually we go beyond the end of the buffer. > > Instead, on first error, we should probably just bail out. Other > option is to increment read_bytes by sizeof(u32) before the switch, > rather than only accounting for the ptype header in the non-error > case. Note that in this case it is HFI_ERR_SYS_INVALID_PARAMETER, > ie. an unrecognized/unsupported parameter, so interpreting the next > word as a property type would be bogus. The other error cases are > due to truncated buffer, so there isn't likely to be anything valid > to interpret in the remainder of the buffer. So just bailing seems > like a reasonable solution. I have a WIP patch which rewrite the message parsing, it would be nice if I can reproduce this crash. > > Signed-off-by: Rob Clark> --- > drivers/media/platform/qcom/venus/hfi_msgs.c | 11 ++- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/drivers/media/platform/qcom/venus/hfi_msgs.c > b/drivers/media/platform/qcom/venus/hfi_msgs.c > index debf80a92797..4190825b20a1 100644 > --- a/drivers/media/platform/qcom/venus/hfi_msgs.c > +++ b/drivers/media/platform/qcom/venus/hfi_msgs.c > @@ -239,11 +239,12 @@ static void hfi_sys_init_done(struct venus_core *core, > struct venus_inst *inst, > break; > } >
[PATCH 10/14] [media] ddbridge: remove unreachable code
From: Daniel Scheller>From smatch: drivers/media/pci/ddbridge/ddbridge-core.c:3490 snr_store() info: ignoring unreachable code. In fact, the function immediately returns zero, so remove it and update ddb_attrs_snr[] to not reference it anymore. Cc: Ralph Metzler Signed-off-by: Daniel Scheller --- drivers/media/pci/ddbridge/ddbridge-core.c | 27 --- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index 8981795b0819..3756b9961fcd 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -3236,25 +3236,6 @@ static ssize_t snr_show(struct device *device, return sprintf(buf, "%s\n", snr); } - -static ssize_t snr_store(struct device *device, struct device_attribute *attr, -const char *buf, size_t count) -{ - struct ddb *dev = dev_get_drvdata(device); - int num = attr->attr.name[3] - 0x30; - u8 snr[34] = { 0x01, 0x00 }; - - return 0; /* NOE: remove completely? */ - if (count > 31) - return -EINVAL; - if (dev->port[num].type >= DDB_TUNER_XO2) - return -EINVAL; - memcpy(snr + 2, buf, count); - i2c_write(>i2c[num].adap, 0x57, snr, 34); - i2c_write(>i2c[num].adap, 0x50, snr, 34); - return count; -} - static ssize_t bsnr_show(struct device *device, struct device_attribute *attr, char *buf) { @@ -3394,10 +3375,10 @@ static struct device_attribute ddb_attrs_fan[] = { }; static struct device_attribute ddb_attrs_snr[] = { - __ATTR(snr0, 0664, snr_show, snr_store), - __ATTR(snr1, 0664, snr_show, snr_store), - __ATTR(snr2, 0664, snr_show, snr_store), - __ATTR(snr3, 0664, snr_show, snr_store), + __ATTR_MRO(snr0, snr_show), + __ATTR_MRO(snr1, snr_show), + __ATTR_MRO(snr2, snr_show), + __ATTR_MRO(snr3, snr_show), }; static struct device_attribute ddb_attrs_ctemp[] = { -- 2.13.0
[PATCH 05/14] [media] ddbridge: split off IRQ handling
From: Daniel SchellerThis not only helps keep the ddbridge-core tidy, but also gets rid of defined-but-unused-function warnings which might be triggered depending of CONFIG_PCI_MSI, without having to clutter the code with #ifdef'ery. Signed-off-by: Daniel Scheller --- drivers/media/pci/ddbridge/Makefile| 3 +- drivers/media/pci/ddbridge/ddbridge-core.c | 130 --- drivers/media/pci/ddbridge/ddbridge-irq.c | 161 + drivers/media/pci/ddbridge/ddbridge.h | 12 +-- 4 files changed, 168 insertions(+), 138 deletions(-) create mode 100644 drivers/media/pci/ddbridge/ddbridge-irq.c diff --git a/drivers/media/pci/ddbridge/Makefile b/drivers/media/pci/ddbridge/Makefile index fe8ff0c681ad..0a7caa95a3b6 100644 --- a/drivers/media/pci/ddbridge/Makefile +++ b/drivers/media/pci/ddbridge/Makefile @@ -2,7 +2,8 @@ # Makefile for the ddbridge device driver # -ddbridge-objs := ddbridge-main.o ddbridge-core.o ddbridge-i2c.o +ddbridge-objs := ddbridge-main.o ddbridge-core.o ddbridge-i2c.o \ + ddbridge-irq.o obj-$(CONFIG_DVB_DDBRIDGE) += ddbridge.o diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index f3bd371634f1..e488a3f82ca2 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -2691,136 +2691,6 @@ void ddb_ports_release(struct ddb *dev) // // -#define IRQ_HANDLE(_nr) \ - do { if ((s & (1UL << ((_nr) & 0x1f))) && dev->handler[0][_nr]) \ - dev->handler[0][_nr](dev->handler_data[0][_nr]); } \ - while (0) - -#define IRQ_HANDLE_BYTE(_n) { \ - if (s & (0x00ff << ((_n) & 0x1f))) { \ - IRQ_HANDLE(0 + (_n)); \ - IRQ_HANDLE(1 + (_n)); \ - IRQ_HANDLE(2 + (_n)); \ - IRQ_HANDLE(3 + (_n)); \ - IRQ_HANDLE(4 + (_n)); \ - IRQ_HANDLE(5 + (_n)); \ - IRQ_HANDLE(6 + (_n)); \ - IRQ_HANDLE(7 + (_n)); \ - } \ - } - -static void irq_handle_msg(struct ddb *dev, u32 s) -{ - dev->i2c_irq++; - IRQ_HANDLE(0); - IRQ_HANDLE(1); - IRQ_HANDLE(2); - IRQ_HANDLE(3); -} - -static void irq_handle_io(struct ddb *dev, u32 s) -{ - dev->ts_irq++; - if ((s & 0x00f0)) { - IRQ_HANDLE(4); - IRQ_HANDLE(5); - IRQ_HANDLE(6); - IRQ_HANDLE(7); - } - if ((s & 0xff00)) { - IRQ_HANDLE(8); - IRQ_HANDLE(9); - IRQ_HANDLE(10); - IRQ_HANDLE(11); - IRQ_HANDLE(12); - IRQ_HANDLE(13); - IRQ_HANDLE(14); - IRQ_HANDLE(15); - } - if ((s & 0x00ff)) { - IRQ_HANDLE(16); - IRQ_HANDLE(17); - IRQ_HANDLE(18); - IRQ_HANDLE(19); - IRQ_HANDLE(20); - IRQ_HANDLE(21); - IRQ_HANDLE(22); - IRQ_HANDLE(23); - } - if ((s & 0xff00)) { - IRQ_HANDLE(24); - IRQ_HANDLE(25); - IRQ_HANDLE(26); - IRQ_HANDLE(27); - IRQ_HANDLE(28); - IRQ_HANDLE(29); - IRQ_HANDLE(30); - IRQ_HANDLE(31); - } -} - -#ifdef DDB_USE_MSI_IRQHANDLERS -irqreturn_t irq_handler0(int irq, void *dev_id) -{ - struct ddb *dev = (struct ddb *) dev_id; - u32 s = ddbreadl(dev, INTERRUPT_STATUS); - - do { - if (s & 0x8000) - return IRQ_NONE; - if (!(s & 0xf00)) - return IRQ_NONE; - ddbwritel(dev, s & 0xf00, INTERRUPT_ACK); - irq_handle_io(dev, s); - } while ((s = ddbreadl(dev, INTERRUPT_STATUS))); - - return IRQ_HANDLED; -} - -irqreturn_t irq_handler1(int irq, void *dev_id) -{ - struct ddb *dev = (struct ddb *) dev_id; - u32 s = ddbreadl(dev, INTERRUPT_STATUS); - - do { - if (s & 0x8000) - return IRQ_NONE; - if (!(s & 0xf)) - return IRQ_NONE; - ddbwritel(dev, s & 0xf, INTERRUPT_ACK); - irq_handle_msg(dev, s); - } while ((s = ddbreadl(dev, INTERRUPT_STATUS))); - - return IRQ_HANDLED; -} -#endif - -irqreturn_t irq_handler(int irq, void *dev_id) -{ - struct ddb *dev = (struct ddb *) dev_id; - u32 s = ddbreadl(dev, INTERRUPT_STATUS); - int ret = IRQ_HANDLED; - - if (!s) - return IRQ_NONE; - do { - if (s & 0x8000) - return IRQ_NONE; - ddbwritel(dev, s,
[PATCH 09/14] [media] ddbridge: fix possible buffer overflow in ddb_ports_init()
From: Daniel SchellerReport from smatch: drivers/media/pci/ddbridge/ddbridge-core.c:2659 ddb_ports_init() error: buffer overflow 'dev->port' 32 <= u32max Fix by making sure "p" is greater than zero before checking for "dev->port[].type == DDB_CI_EXTERNAL_XO2". Cc: Ralph Metzler Signed-off-by: Daniel Scheller --- drivers/media/pci/ddbridge/ddbridge-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index aba53fd27f3e..8981795b0819 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -2551,7 +2551,7 @@ void ddb_ports_init(struct ddb *dev) port->dvb[0].adap = >adap[2 * p]; port->dvb[1].adap = >adap[2 * p + 1]; - if ((port->class == DDB_PORT_NONE) && i && + if ((port->class == DDB_PORT_NONE) && i && p > 0 && dev->port[p - 1].type == DDB_CI_EXTERNAL_XO2) { port->class = DDB_PORT_CI; port->type = DDB_CI_EXTERNAL_XO2_B; -- 2.13.0
[PATCH 3/4] [media] ddbridge: fix buffer overflow in max_set_input_unlocked()
From: Daniel SchellerPicked up code parts introduced one smatch error: drivers/media/pci/ddbridge/ddbridge-maxs8.c:163 max_set_input_unlocked() error: buffer overflow 'dev->link[port->lnr].lnb.voltage' 4 <= 255 Fix this by clamping the .lnb.voltage array access to 0-3 by "& 3"'ing dvb->input. Cc: Ralph Metzler Signed-off-by: Daniel Scheller --- drivers/media/pci/ddbridge/ddbridge-maxs8.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-maxs8.c b/drivers/media/pci/ddbridge/ddbridge-maxs8.c index a9dc5f9754da..10716ee8cf59 100644 --- a/drivers/media/pci/ddbridge/ddbridge-maxs8.c +++ b/drivers/media/pci/ddbridge/ddbridge-maxs8.c @@ -187,11 +187,12 @@ static int max_set_input_unlocked(struct dvb_frontend *fe, int in) return -EINVAL; if (dvb->input != in) { u32 bit = (1ULL << input->nr); - u32 obit = dev->link[port->lnr].lnb.voltage[dvb->input] & bit; + u32 obit = + dev->link[port->lnr].lnb.voltage[dvb->input & 3] & bit; - dev->link[port->lnr].lnb.voltage[dvb->input] &= ~bit; + dev->link[port->lnr].lnb.voltage[dvb->input & 3] &= ~bit; dvb->input = in; - dev->link[port->lnr].lnb.voltage[dvb->input] |= obit; + dev->link[port->lnr].lnb.voltage[dvb->input & 3] |= obit; } res = dvb->set_input(fe, in); return res; -- 2.13.0
[PATCH 1/4] [media] dvb-frontends: MaxLinear MxL5xx DVB-S/S2 tuner-demodulator driver
From: Daniel SchellerThis adds the frontend driver for the MaxLinear MxL5xx family of tuner- demodulators, as used on Digital Devices MaxS4/8 four/eight-tuner cards. The driver was picked from the dddvb vendor driver package and - judging solely from the diff - has undergone a 100% rework: - Silly #define's used to pass multiple values to functions were expanded. This resulted in macro/register names not being usable anymore for such occurences, but makes the code WAY more read-, understand- and maintainable. - CamelCase was changed to kernel_case - All typedef were removed - Overall code style was fixed, besides >80char lines in _defs.h and _regs.h, checkpatch is happy. - Also, signal stat acquisition was made to comply with the DVB API ways to do these things. Permission to reuse and mainline the driver code was formally granted by Ralph Metzler . Signed-off-by: Daniel Scheller --- drivers/media/dvb-frontends/Kconfig |9 + drivers/media/dvb-frontends/Makefile |1 + drivers/media/dvb-frontends/mxl5xx.c | 1873 + drivers/media/dvb-frontends/mxl5xx.h | 41 + drivers/media/dvb-frontends/mxl5xx_defs.h | 731 +++ drivers/media/dvb-frontends/mxl5xx_regs.h | 367 ++ 6 files changed, 3022 insertions(+) create mode 100644 drivers/media/dvb-frontends/mxl5xx.c create mode 100644 drivers/media/dvb-frontends/mxl5xx.h create mode 100644 drivers/media/dvb-frontends/mxl5xx_defs.h create mode 100644 drivers/media/dvb-frontends/mxl5xx_regs.h diff --git a/drivers/media/dvb-frontends/Kconfig b/drivers/media/dvb-frontends/Kconfig index d2d3160abdf7..2631d0e0a024 100644 --- a/drivers/media/dvb-frontends/Kconfig +++ b/drivers/media/dvb-frontends/Kconfig @@ -53,6 +53,15 @@ config DVB_STV6111 Say Y when you want to support these frontends. +config DVB_MXL5XX + tristate "MaxLinear MxL5xx based tuner-demodulators" + depends on DVB_CORE && I2C + default m if !MEDIA_SUBDRV_AUTOSELECT + help + MaxLinear MxL5xx family of DVB-S/S2 tuners/demodulators. + + Say Y when you want to support these frontends. + config DVB_M88DS3103 tristate "Montage Technology M88DS3103" depends on DVB_CORE && I2C && I2C_MUX diff --git a/drivers/media/dvb-frontends/Makefile b/drivers/media/dvb-frontends/Makefile index e8bf1d873485..f45f6a4a4371 100644 --- a/drivers/media/dvb-frontends/Makefile +++ b/drivers/media/dvb-frontends/Makefile @@ -112,6 +112,7 @@ obj-$(CONFIG_DVB_DRXK) += drxk.o obj-$(CONFIG_DVB_TDA18271C2DD) += tda18271c2dd.o obj-$(CONFIG_DVB_STV0910) += stv0910.o obj-$(CONFIG_DVB_STV6111) += stv6111.o +obj-$(CONFIG_DVB_MXL5XX) += mxl5xx.o obj-$(CONFIG_DVB_SI2165) += si2165.o obj-$(CONFIG_DVB_A8293) += a8293.o obj-$(CONFIG_DVB_SP2) += sp2.o diff --git a/drivers/media/dvb-frontends/mxl5xx.c b/drivers/media/dvb-frontends/mxl5xx.c new file mode 100644 index ..676c96c216c3 --- /dev/null +++ b/drivers/media/dvb-frontends/mxl5xx.c @@ -0,0 +1,1873 @@ +/* + * Driver for the MaxLinear MxL5xx family of tuners/demods + * + * Copyright (C) 2014-2015 Ralph Metzler + * Marcus Metzler + * developed for Digital Devices GmbH + * + * based on code: + * Copyright (c) 2011-2013 MaxLinear, Inc. All rights reserved + * which was released under GPL V2 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2, as published by the Free Software Foundation. + * + * 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. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "dvb_frontend.h" +#include "mxl5xx.h" +#include "mxl5xx_regs.h" +#include "mxl5xx_defs.h" + +#define BYTE0(v) ((v >> 0) & 0xff) +#define BYTE1(v) ((v >> 8) & 0xff) +#define BYTE2(v) ((v >> 16) & 0xff) +#define BYTE3(v) ((v >> 24) & 0xff) + +LIST_HEAD(mxllist); + +struct mxl_base { + struct list_head mxllist; + struct list_head mxls; + + u8 adr; + struct i2c_adapter *i2c; + + u32 count; + u32 type; + u32 sku_type; + u32 chipversion; + u32 clock; + u32 fwversion; + + u8 *ts_map; + u8 can_clkout; + u8 chan_bond; + u8 demod_num; + u8 tuner_num; + + unsigned longnext_tune; +
[PATCH 12/14] [media] ddbridge: fix dereference before check
From: Daniel SchellerBoth ts_release() and ts_open() can use "output" before check (smatch): drivers/media/pci/ddbridge/ddbridge-core.c:816 ts_release() warn: variable dereferenced before check 'output' (see line 809) drivers/media/pci/ddbridge/ddbridge-core.c:836 ts_open() warn: variable dereferenced before check 'output' (see line 828) Fix by performing checks on those pointers. Cc: Ralph Metzler Signed-off-by: Daniel Scheller --- drivers/media/pci/ddbridge/ddbridge-core.c | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index 6896cd1f3a96..ff87e0462c7e 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -738,8 +738,13 @@ static unsigned int ts_poll(struct file *file, poll_table *wait) static int ts_release(struct inode *inode, struct file *file) { struct dvb_device *dvbdev = file->private_data; - struct ddb_output *output = dvbdev->priv; - struct ddb_input *input = output->port->input[0]; + struct ddb_output *output = NULL; + struct ddb_input *input = NULL; + + if (dvbdev) { + output = dvbdev->priv; + input = output->port->input[0]; + } if ((file->f_flags & O_ACCMODE) == O_RDONLY) { if (!input) @@ -757,8 +762,13 @@ static int ts_open(struct inode *inode, struct file *file) { int err; struct dvb_device *dvbdev = file->private_data; - struct ddb_output *output = dvbdev->priv; - struct ddb_input *input = output->port->input[0]; + struct ddb_output *output = NULL; + struct ddb_input *input = NULL; + + if (dvbdev) { + output = dvbdev->priv; + input = output->port->input[0]; + } if ((file->f_flags & O_ACCMODE) == O_RDONLY) { if (!input) -- 2.13.0
[PATCH 0/4] MxL5xx demodulator-tuner driver, DD MaxS8 support
From: Daniel SchellerTarget: 4.14 seems unrealistic, so: 4.14+ Hard-dependency on the STV0910/STV6111 driver+DD support series and the DD driver bump. This adds a driver for the MaxLinear MxL5xx tuner-demodulator series (a DVB-S/S2/DSS demodulator-tuner combo frontend) as being found on Digital Devices MaxS8 4/8 tunerport cards. These patches conclude the tuner hardware support for all Digital Devices hardware as of dddvb-0.9.29 and gets mainline on par with the vendor driver. Cleanup notes: The driver was in no way submittable in it's original form: It had some very scary construct in that #define's carried multiple function para- meters (comma-separated things), which were passed to another #define, which then in turn referenced a function, like this pseudocode: #define REGDEF1 0x1234,2,3 #define FNCALL real_fn(othervar,regdef) function real_fn(var,reg,var1,var2,val) real_fn(state,REGDEF1,1); Not only checkpatch didn't like this, but it looked heavily confusing. During cleanup, all of this obfuscation was expanded. Also, _defs.h carried all of the enums and structs as typedef's. All of this has been cleaned, together with the usual CamelCase things, whitespace and so on, results: 55 "line len > 80 chars" in _defs.h and _regs.h (which I'd like to keep to retain readability), everything else clean. Everything else (e.g. overall code design) should be ok, but this should be judged by reviewers. The resulting driver has been tested and works fine. The glue code in ddbridge was added into a new object ddbridge-maxs8 to keep -core clean. It was added mostly as-is, and a little fixup commit is put ontop. LNB control is done by the bridge card in case of these cards, so that lives in the bridge driver (and is the majority of the additional object). Thanks in advance for reviewing this. Daniel Scheller (4): [media] dvb-frontends: MaxLinear MxL5xx DVB-S/S2 tuner-demodulator driver [media] ddbridge: support MaxLinear MXL5xx based cards (MaxS4/8) [media] ddbridge: fix buffer overflow in max_set_input_unlocked() [media] MAINTAINERS: add entry for mxl5xx MAINTAINERS |8 + drivers/media/dvb-frontends/Kconfig |9 + drivers/media/dvb-frontends/Makefile|1 + drivers/media/dvb-frontends/mxl5xx.c| 1873 +++ drivers/media/dvb-frontends/mxl5xx.h| 41 + drivers/media/dvb-frontends/mxl5xx_defs.h | 731 +++ drivers/media/dvb-frontends/mxl5xx_regs.h | 367 ++ drivers/media/pci/ddbridge/Kconfig |2 + drivers/media/pci/ddbridge/Makefile |2 +- drivers/media/pci/ddbridge/ddbridge-core.c | 67 +- drivers/media/pci/ddbridge/ddbridge-hw.c| 12 + drivers/media/pci/ddbridge/ddbridge-hw.h|4 + drivers/media/pci/ddbridge/ddbridge-main.c |1 + drivers/media/pci/ddbridge/ddbridge-maxs8.c | 444 +++ drivers/media/pci/ddbridge/ddbridge-maxs8.h | 29 + drivers/media/pci/ddbridge/ddbridge-regs.h | 21 + drivers/media/pci/ddbridge/ddbridge.h | 11 + 17 files changed, 3619 insertions(+), 4 deletions(-) create mode 100644 drivers/media/dvb-frontends/mxl5xx.c create mode 100644 drivers/media/dvb-frontends/mxl5xx.h create mode 100644 drivers/media/dvb-frontends/mxl5xx_defs.h create mode 100644 drivers/media/dvb-frontends/mxl5xx_regs.h create mode 100644 drivers/media/pci/ddbridge/ddbridge-maxs8.c create mode 100644 drivers/media/pci/ddbridge/ddbridge-maxs8.h -- 2.13.0
[PATCH 4/4] [media] MAINTAINERS: add entry for mxl5xx
From: Daniel SchellerSigned-off-by: Daniel Scheller --- MAINTAINERS | 8 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 6abb534c69c7..685886472d8a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8236,6 +8236,14 @@ T: git git://linuxtv.org/media_tree.git S: Supported F: drivers/media/dvb-frontends/lnbh25* +MEDIA DRIVERS FOR MXL5XX TUNER DEMODULATORS +M: Daniel Scheller +L: linux-media@vger.kernel.org +W: https://linuxtv.org +T: git git://linuxtv.org/media_tree.git +S: Maintained +F: drivers/media/dvb-frontends/mxl5xx* + MEDIA DRIVERS FOR NETUP PCI UNIVERSAL DVB devices M: Sergey Kozlov M: Abylay Ospan -- 2.13.0
[PATCH 07/14] [media] ddbridge: check pointers before dereferencing
From: Daniel SchellerFixes two warnings reported by smatch: drivers/media/pci/ddbridge/ddbridge-core.c:240 ddb_redirect() warn: variable dereferenced before check 'idev' (see line 238) drivers/media/pci/ddbridge/ddbridge-core.c:240 ddb_redirect() warn: variable dereferenced before check 'pdev' (see line 238) Fixed by moving the existing checks up before accessing members. Cc: Ralph Metzler Signed-off-by: Daniel Scheller --- drivers/media/pci/ddbridge/ddbridge-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index cf45a5ad9853..175f173d3e86 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -169,10 +169,10 @@ static int ddb_redirect(u32 i, u32 p) struct ddb *pdev = ddbs[(p >> 4) & 0x3f]; struct ddb_port *port; - if (!idev->has_dma || !pdev->has_dma) - return -EINVAL; if (!idev || !pdev) return -EINVAL; + if (!idev->has_dma || !pdev->has_dma) + return -EINVAL; port = >port[p & 0x0f]; if (!port->output) -- 2.13.0
[PATCH 06/14] [media] ddbridge: split off hardware definitions and mappings
From: Daniel SchellerFurther cleanup of ddbridge-core and ddbridge-main, and moves all such hw definitions into one single place, making things easier to maintain. Signed-off-by: Daniel Scheller --- drivers/media/pci/ddbridge/Makefile| 4 +- drivers/media/pci/ddbridge/ddbridge-core.c | 68 --- drivers/media/pci/ddbridge/ddbridge-hw.c | 299 + drivers/media/pci/ddbridge/ddbridge-hw.h | 52 + drivers/media/pci/ddbridge/ddbridge-main.c | 217 + drivers/media/pci/ddbridge/ddbridge.h | 1 - 6 files changed, 354 insertions(+), 287 deletions(-) create mode 100644 drivers/media/pci/ddbridge/ddbridge-hw.c create mode 100644 drivers/media/pci/ddbridge/ddbridge-hw.h diff --git a/drivers/media/pci/ddbridge/Makefile b/drivers/media/pci/ddbridge/Makefile index 0a7caa95a3b6..c4d8d6261243 100644 --- a/drivers/media/pci/ddbridge/Makefile +++ b/drivers/media/pci/ddbridge/Makefile @@ -2,8 +2,8 @@ # Makefile for the ddbridge device driver # -ddbridge-objs := ddbridge-main.o ddbridge-core.o ddbridge-i2c.o \ - ddbridge-irq.o +ddbridge-objs := ddbridge-main.o ddbridge-core.o ddbridge-hw.o \ + ddbridge-i2c.o ddbridge-irq.o obj-$(CONFIG_DVB_DDBRIDGE) += ddbridge.o diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index e488a3f82ca2..cf45a5ad9853 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -66,74 +66,6 @@ static struct ddb *ddbs[DDB_MAX_ADAPTER]; // // -static struct ddb_regset octopus_input = { - .base = 0x200, - .num = 0x08, - .size = 0x10, -}; - -static struct ddb_regset octopus_output = { - .base = 0x280, - .num = 0x08, - .size = 0x10, -}; - -static struct ddb_regset octopus_idma = { - .base = 0x300, - .num = 0x08, - .size = 0x10, -}; - -static struct ddb_regset octopus_idma_buf = { - .base = 0x2000, - .num = 0x08, - .size = 0x100, -}; - -static struct ddb_regset octopus_odma = { - .base = 0x380, - .num = 0x04, - .size = 0x10, -}; - -static struct ddb_regset octopus_odma_buf = { - .base = 0x2800, - .num = 0x04, - .size = 0x100, -}; - -static struct ddb_regset octopus_i2c = { - .base = 0x80, - .num = 0x04, - .size = 0x20, -}; - -static struct ddb_regset octopus_i2c_buf = { - .base = 0x1000, - .num = 0x04, - .size = 0x200, -}; - -// - -struct ddb_regmap octopus_map = { - .irq_base_i2c = 0, - .irq_base_idma = 8, - .irq_base_odma = 16, - .i2c = _i2c, - .i2c_buf = _i2c_buf, - .idma = _idma, - .idma_buf = _idma_buf, - .odma = _odma, - .odma_buf = _odma_buf, - .input = _input, - .output = _output, -}; - -// -// -// - static void ddb_set_dma_table(struct ddb_io *io) { struct ddb *dev = io->port->dev; diff --git a/drivers/media/pci/ddbridge/ddbridge-hw.c b/drivers/media/pci/ddbridge/ddbridge-hw.c new file mode 100644 index ..e35b41e8d860 --- /dev/null +++ b/drivers/media/pci/ddbridge/ddbridge-hw.c @@ -0,0 +1,299 @@ +/* + * ddbridge-hw.c: Digital Devices bridge hardware maps + * + * Copyright (C) 2010-2017 Digital Devices GmbH + * Ralph Metzler + * Marcus Metzler + * + * 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. + * + */ + +#include "ddbridge.h" + +/**/ + +static struct ddb_regset octopus_input = { + .base = 0x200, + .num = 0x08, + .size = 0x10, +}; + +static struct ddb_regset octopus_output = { + .base = 0x280, + .num = 0x08, + .size = 0x10, +}; + +static struct ddb_regset octopus_idma = { + .base = 0x300, + .num = 0x08, + .size = 0x10, +}; + +static struct ddb_regset octopus_idma_buf = { + .base = 0x2000, + .num = 0x08, + .size =
[PATCH 2/4] [media] ddbridge: support MaxLinear MXL5xx based cards (MaxS4/8)
From: Daniel SchellerThis enables MaxS4/S8 and Octopus Max card support in ddbridge by adding glue code into ddbridge-core, having another PCI ID, and have the LNB IC control code (and all other MaxS4/8 related code) in ddbridge-maxs8.c (rather than another ~400 LoC in ddbridge-core.c like it's done in the original vendor driver package). Signed-off-by: Daniel Scheller --- drivers/media/pci/ddbridge/Kconfig | 2 + drivers/media/pci/ddbridge/Makefile | 2 +- drivers/media/pci/ddbridge/ddbridge-core.c | 67 - drivers/media/pci/ddbridge/ddbridge-hw.c| 12 + drivers/media/pci/ddbridge/ddbridge-hw.h| 4 + drivers/media/pci/ddbridge/ddbridge-main.c | 1 + drivers/media/pci/ddbridge/ddbridge-maxs8.c | 443 drivers/media/pci/ddbridge/ddbridge-maxs8.h | 29 ++ drivers/media/pci/ddbridge/ddbridge-regs.h | 21 ++ drivers/media/pci/ddbridge/ddbridge.h | 11 + 10 files changed, 588 insertions(+), 4 deletions(-) create mode 100644 drivers/media/pci/ddbridge/ddbridge-maxs8.c create mode 100644 drivers/media/pci/ddbridge/ddbridge-maxs8.h diff --git a/drivers/media/pci/ddbridge/Kconfig b/drivers/media/pci/ddbridge/Kconfig index 1330b2ecc72a..f43d0b83fc0c 100644 --- a/drivers/media/pci/ddbridge/Kconfig +++ b/drivers/media/pci/ddbridge/Kconfig @@ -12,6 +12,7 @@ config DVB_DDBRIDGE select DVB_STV6111 if MEDIA_SUBDRV_AUTOSELECT select DVB_LNBH25 if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_TDA18212 if MEDIA_SUBDRV_AUTOSELECT + select DVB_MXL5XX if MEDIA_SUBDRV_AUTOSELECT ---help--- Support for cards with the Digital Devices PCI express bridge: - Octopus PCIe Bridge @@ -24,6 +25,7 @@ config DVB_DDBRIDGE - CineCTv7 and DuoFlex CT2/C2T2/C2T2I (Sony CXD28xx-based) - MaxA8 series - CineS2 V7/V7A and DuoFlex S2 V4 (ST STV0910-based) + - Max S4/8 Say Y if you own such a card and want to use it. diff --git a/drivers/media/pci/ddbridge/Makefile b/drivers/media/pci/ddbridge/Makefile index c4d8d6261243..caf03a82f6b1 100644 --- a/drivers/media/pci/ddbridge/Makefile +++ b/drivers/media/pci/ddbridge/Makefile @@ -3,7 +3,7 @@ # ddbridge-objs := ddbridge-main.o ddbridge-core.o ddbridge-hw.o \ - ddbridge-i2c.o ddbridge-irq.o + ddbridge-i2c.o ddbridge-irq.o ddbridge-maxs8.o obj-$(CONFIG_DVB_DDBRIDGE) += ddbridge.o diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index ff87e0462c7e..81f07dc5eeea 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -36,6 +36,7 @@ #include "ddbridge.h" #include "ddbridge-regs.h" +#include "ddbridge-maxs8.h" #include "ddbridge-io.h" #include "tda18271c2dd.h" @@ -1424,8 +1425,9 @@ static int dvb_input_attach(struct ddb_input *input) dvb->fe = dvb->fe2 = NULL; switch (port->type) { case DDB_TUNER_MXL5XX: - dev_notice(port->dev->dev, "MaxLinear MxL5xx not supported\n"); - return -ENODEV; + if (fe_attach_mxl5xx(input) < 0) + return -ENODEV; + break; case DDB_TUNER_DVBS_ST: if (demod_attach_stv0900(input, 0) < 0) return -ENODEV; @@ -1770,6 +1772,17 @@ static void ddb_port_probe(struct ddb_port *port) return; } + if (dev->link[l].info->type == DDB_OCTOPUS_MAX) { + port->name = "DUAL DVB-S2 MAX"; + port->type_name = "MXL5XX"; + port->class = DDB_PORT_TUNER; + port->type = DDB_TUNER_MXL5XX; + if (port->i2c) + ddbwritel(dev, I2C_SPEED_400, + port->i2c->regs + I2C_TIMING); + return; + } + if (port->nr > 1 && dev->link[l].info->type == DDB_OCTOPUS_CI) { port->name = "CI internal"; port->type_name = "INTERNAL"; @@ -2531,6 +2544,20 @@ static int ddb_port_match_i2c(struct ddb_port *port) return 0; } +static int ddb_port_match_link_i2c(struct ddb_port *port) +{ + struct ddb *dev = port->dev; + u32 i; + + for (i = 0; i < dev->i2c_num; i++) { + if (dev->i2c[i].link == port->lnr) { + port->i2c = >i2c[i]; + return 1; + } + } + return 0; +} + void ddb_ports_init(struct ddb *dev) { u32 i, l, p; @@ -2555,7 +2582,11 @@ void ddb_ports_init(struct ddb *dev) port->obr = ci_bitrate; mutex_init(>i2c_gate_lock); - ddb_port_match_i2c(port); + if (!ddb_port_match_i2c(port)) { + if (info->type == DDB_OCTOPUS_MAX) +
[PATCH 13/14] [media] ddbridge: Kconfig option to control the MSI modparam default
From: Daniel SchellerIt is known that MSI interrupts - while working quite well so far - can still cause issues on some hardware platforms (causing I2C timeouts due to unhandled interrupts). The msi variable/option is set to 1 by default. So, add a Kconfig option prefixed with "EXPERIMENTAL" that will control the default value of that modparam, defaulting to off for a better user experience and (guaranteed) stable operation "per default". Cc: Ralph Metzler Signed-off-by: Daniel Scheller --- drivers/media/pci/ddbridge/Kconfig | 15 +++ drivers/media/pci/ddbridge/ddbridge-main.c | 11 +-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/ddbridge/Kconfig b/drivers/media/pci/ddbridge/Kconfig index c79a58fa5fc3..1330b2ecc72a 100644 --- a/drivers/media/pci/ddbridge/Kconfig +++ b/drivers/media/pci/ddbridge/Kconfig @@ -26,3 +26,18 @@ config DVB_DDBRIDGE - CineS2 V7/V7A and DuoFlex S2 V4 (ST STV0910-based) Say Y if you own such a card and want to use it. + +config DVB_DDBRIDGE_MSIENABLE + bool "Enable Message Signaled Interrupts (MSI) per default (EXPERIMENTAL)" + depends on DVB_DDBRIDGE + depends on PCI_MSI + default n + ---help--- + Use PCI MSI (Message Signaled Interrupts) per default. Enabling this + might lead to I2C errors originating from the bridge in conjunction + with certain SATA controllers, requiring a reload of the ddbridge + module. MSI can still be disabled by passing msi=0 as option, as + this will just change the msi option default value. + + If you're unsure, concerned about stability and don't want to pass + module options in case of troubles, say N. diff --git a/drivers/media/pci/ddbridge/ddbridge-main.c b/drivers/media/pci/ddbridge/ddbridge-main.c index fa4f663c5acb..83643bc21d09 100644 --- a/drivers/media/pci/ddbridge/ddbridge-main.c +++ b/drivers/media/pci/ddbridge/ddbridge-main.c @@ -46,10 +46,17 @@ MODULE_PARM_DESC(adapter_alloc, "0-one adapter per io, 1-one per tab with io, 2-one per tab, 3-one for all"); #ifdef CONFIG_PCI_MSI +#ifdef CONFIG_DVB_DDBRIDGE_MSIENABLE int msi = 1; +#else +int msi; +#endif module_param(msi, int, 0444); -MODULE_PARM_DESC(msi, -" Control MSI interrupts: 0-disable, 1-enable (default)"); +#ifdef CONFIG_DVB_DDBRIDGE_MSIENABLE +MODULE_PARM_DESC(msi, "Control MSI interrupts: 0-disable, 1-enable (default)"); +#else +MODULE_PARM_DESC(msi, "Control MSI interrupts: 0-disable (default), 1-enable"); +#endif #endif int ci_bitrate = 7; -- 2.13.0
[PATCH 08/14] [media] ddbridge: only register frontends in fe2 if fe is not NULL
From: Daniel SchellerSmatch reported: drivers/media/pci/ddbridge/ddbridge-core.c:1602 dvb_input_attach() error: we previously assumed 'dvb->fe' could be null (see line 1595) dvb->fe2 will ever only be populated when dvb->fe is set. So only handle registration of dvb->fe2 when dvb->fe got set beforehand by moving the registration into the "if (dvb->fe)" conditional. Cc: Ralph Metzler Signed-off-by: Daniel Scheller --- drivers/media/pci/ddbridge/ddbridge-core.c | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index 175f173d3e86..aba53fd27f3e 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -1506,23 +1506,25 @@ static int dvb_input_attach(struct ddb_input *input) return 0; } dvb->attached = 0x30; + if (dvb->fe) { if (dvb_register_frontend(adap, dvb->fe) < 0) return -ENODEV; + + if (dvb->fe2) { + if (dvb_register_frontend(adap, dvb->fe2) < 0) + return -ENODEV; + dvb->fe2->tuner_priv = dvb->fe->tuner_priv; + memcpy(>fe2->ops.tuner_ops, + >fe->ops.tuner_ops, + sizeof(struct dvb_tuner_ops)); + } } - if (dvb->fe2) { - if (dvb_register_frontend(adap, dvb->fe2) < 0) - return -ENODEV; - dvb->fe2->tuner_priv = dvb->fe->tuner_priv; - memcpy(>fe2->ops.tuner_ops, - >fe->ops.tuner_ops, - sizeof(struct dvb_tuner_ops)); - } + dvb->attached = 0x31; return 0; } - static int port_has_encti(struct ddb_port *port) { struct device *dev = port->dev->dev; -- 2.13.0
[PATCH 11/14] [media] ddbridge: fix impossible condition warning
From: Daniel SchellerSmatch and gcc complained: drivers/media/pci/ddbridge/ddbridge-core.c:3491 bpsnr_show() warn: impossible condition '(snr[0] == 255) => ((-128)-127 == 255)' drivers/media/pci/ddbridge/ddbridge-core.c: In function ‘bpsnr_show’: drivers/media/pci/ddbridge/ddbridge-core.c:3491:13: warning: comparison is always false due to limited range of data type [-Wtype-limits] Fix this by changing the type of snr to unsigned char. Cc: Ralph Metzler Signed-off-by: Daniel Scheller --- drivers/media/pci/ddbridge/ddbridge-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index 3756b9961fcd..6896cd1f3a96 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -3251,7 +3251,7 @@ static ssize_t bpsnr_show(struct device *device, struct device_attribute *attr, char *buf) { struct ddb *dev = dev_get_drvdata(device); - char snr[32]; + unsigned char snr[32]; if (!dev->i2c_num) return 0; -- 2.13.0
[PATCH 14/14] [media] MAINTAINERS: add entry for ddbridge
From: Daniel SchellerSigned-off-by: Daniel Scheller --- MAINTAINERS | 8 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 7b85e578d238..6abb534c69c7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8262,6 +8262,14 @@ T: git git://linuxtv.org/media_tree.git S: Maintained F: drivers/media/dvb-frontends/stv6111* +MEDIA DRIVERS FOR DIGITAL DEVICES PCIE DEVICES +M: Daniel Scheller +L: linux-media@vger.kernel.org +W: https://linuxtv.org +T: git git://linuxtv.org/media_tree.git +S: Maintained +F: drivers/media/pci/ddbridge/* + MEDIA INPUT INFRASTRUCTURE (V4L/DVB) M: Mauro Carvalho Chehab M: Mauro Carvalho Chehab -- 2.13.0
[PATCH 04/14] [media] ddbridge: split I/O related functions off from ddbridge.h
From: Daniel SchellerWhile it seems valid that headers can carry simple oneline static inline annotated functions, move them into their own header file to have the overall code more readable. Also, keep them as header (and don't put in a separate object) and static inline to help the compiler avoid generating function calls. (Thanks to Jasmin J. for valuable input on this!) Cc: Jasmin J. Signed-off-by: Daniel Scheller ddbridge: put io stuff into a header and use static inline --- drivers/media/pci/ddbridge/ddbridge-core.c | 1 + drivers/media/pci/ddbridge/ddbridge-i2c.c | 1 + drivers/media/pci/ddbridge/ddbridge-io.h | 71 ++ drivers/media/pci/ddbridge/ddbridge-main.c | 1 + drivers/media/pci/ddbridge/ddbridge.h | 43 -- 5 files changed, 74 insertions(+), 43 deletions(-) create mode 100644 drivers/media/pci/ddbridge/ddbridge-io.h diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index 37c6eadba02b..f3bd371634f1 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -36,6 +36,7 @@ #include "ddbridge.h" #include "ddbridge-regs.h" +#include "ddbridge-io.h" #include "tda18271c2dd.h" #include "stv6110x.h" diff --git a/drivers/media/pci/ddbridge/ddbridge-i2c.c b/drivers/media/pci/ddbridge/ddbridge-i2c.c index e83c7af77087..22b2543da4ca 100644 --- a/drivers/media/pci/ddbridge/ddbridge-i2c.c +++ b/drivers/media/pci/ddbridge/ddbridge-i2c.c @@ -32,6 +32,7 @@ #include "ddbridge.h" #include "ddbridge-regs.h" +#include "ddbridge-io.h" /**/ diff --git a/drivers/media/pci/ddbridge/ddbridge-io.h b/drivers/media/pci/ddbridge/ddbridge-io.h new file mode 100644 index ..ce92e9484075 --- /dev/null +++ b/drivers/media/pci/ddbridge/ddbridge-io.h @@ -0,0 +1,71 @@ +/* + * ddbridge-io.h: Digital Devices bridge I/O inline functions + * + * Copyright (C) 2010-2017 Digital Devices GmbH + * Ralph Metzler + * Marcus Metzler + * + * 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_IO_H__ +#define __DDBRIDGE_IO_H__ + +#include + +#include "ddbridge.h" + +/**/ + +static inline u32 ddblreadl(struct ddb_link *link, u32 adr) +{ + return readl((char *) (link->dev->regs + (adr))); +} + +static inline void ddblwritel(struct ddb_link *link, u32 val, u32 adr) +{ + writel(val, (char *) (link->dev->regs + (adr))); +} + +static inline u32 ddbreadl(struct ddb *dev, u32 adr) +{ + return readl((char *) (dev->regs + (adr))); +} + +static inline void ddbwritel(struct ddb *dev, u32 val, u32 adr) +{ + writel(val, (char *) (dev->regs + (adr))); +} + +static inline void ddbcpyto(struct ddb *dev, u32 adr, void *src, long count) +{ + return memcpy_toio((char *) (dev->regs + adr), src, count); +} + +static inline void ddbcpyfrom(struct ddb *dev, void *dst, u32 adr, long count) +{ + return memcpy_fromio(dst, (char *) (dev->regs + adr), count); +} + +static inline u32 safe_ddbreadl(struct ddb *dev, u32 adr) +{ + u32 val = ddbreadl(dev, adr); + + /* (ddb)readl returns (uint)-1 (all bits set) on failure, catch that */ + if (val == ~0) { + dev_err(>pdev->dev, "ddbreadl failure, adr=%08x\n", adr); + return 0; + } + + return val; +} + +#endif /* __DDBRIDGE_IO_H__ */ diff --git a/drivers/media/pci/ddbridge/ddbridge-main.c b/drivers/media/pci/ddbridge/ddbridge-main.c index 8262979b6257..de9da6077ec6 100644 --- a/drivers/media/pci/ddbridge/ddbridge-main.c +++ b/drivers/media/pci/ddbridge/ddbridge-main.c @@ -34,6 +34,7 @@ #include "ddbridge.h" #include "ddbridge-regs.h" +#include "ddbridge-io.h" // /* module parameters */ diff --git a/drivers/media/pci/ddbridge/ddbridge.h b/drivers/media/pci/ddbridge/ddbridge.h index 7fe5820a78ff..fa471481a572 100644 --- a/drivers/media/pci/ddbridge/ddbridge.h +++ b/drivers/media/pci/ddbridge/ddbridge.h @@ -353,49 +353,6 @@ struct ddb { u8 tsbuf[TS_CAPTURE_LEN]; }; -static inline u32 ddblreadl(struct ddb_link *link, u32 adr) -{ - return readl((char *) (link->dev->regs + (adr))); -} - -static
[PATCH 02/14] [media] ddbridge: split code into multiple files
From: Daniel SchellerAs of 0.9.9b, the ddbridge code has been split from one single file (ddbridge-core.c) into multiple files, with the purpose of taking care of different topics, and to be able to reuse code in different kernel modules (ddbridge.ko and octonet.ko). This applies the same code split, with a notable difference: In the vendor package, the split was done by moving all code parts into separate files, and in the "main" code files (ddbridge.c and octonet.c), a simple "#include ddbridge-core.c" was done. In this patch, the same split (codewise) is done, but all resulting .c/.o files will be handled by the makefile, with proper prototyping of all shared functions done in ddbridge.h. Signed-off-by: Daniel Scheller --- drivers/media/pci/ddbridge/Makefile| 2 +- drivers/media/pci/ddbridge/ddbridge-core.c | 588 + drivers/media/pci/ddbridge/ddbridge-i2c.c | 231 drivers/media/pci/ddbridge/ddbridge-main.c | 388 +++ drivers/media/pci/ddbridge/ddbridge.h | 49 +++ 5 files changed, 681 insertions(+), 577 deletions(-) create mode 100644 drivers/media/pci/ddbridge/ddbridge-i2c.c create mode 100644 drivers/media/pci/ddbridge/ddbridge-main.c diff --git a/drivers/media/pci/ddbridge/Makefile b/drivers/media/pci/ddbridge/Makefile index 7446c8b677b5..fe8ff0c681ad 100644 --- a/drivers/media/pci/ddbridge/Makefile +++ b/drivers/media/pci/ddbridge/Makefile @@ -2,7 +2,7 @@ # Makefile for the ddbridge device driver # -ddbridge-objs := ddbridge-core.o +ddbridge-objs := ddbridge-main.o ddbridge-core.o ddbridge-i2c.o obj-$(CONFIG_DVB_DDBRIDGE) += ddbridge.o diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index 4d6ab46cb635..ccbc9f41b10e 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -32,8 +32,8 @@ #include #include #include -#include "ddbridge.h" +#include "ddbridge.h" #include "ddbridge-regs.h" #include "tda18271c2dd.h" @@ -49,227 +49,8 @@ #include "stv6111.h" #include "lnbh25.h" -static int xo2_speed = 2; -module_param(xo2_speed, int, 0444); -MODULE_PARM_DESC(xo2_speed, "default transfer speed for xo2 based duoflex, 0=55,1=75,2=90,3=104 MBit/s, default=2, use attribute to change for individual cards"); - -static int stv0910_single; -module_param(stv0910_single, int, 0444); -MODULE_PARM_DESC(stv0910_single, "use stv0910 cards as single demods"); - DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); -/* MSI had problems with lost interrupts, fixed but needs testing */ -#undef CONFIG_PCI_MSI - -/**/ - -static int i2c_io(struct i2c_adapter *adapter, u8 adr, - u8 *wbuf, u32 wlen, u8 *rbuf, u32 rlen) -{ - struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0, - .buf = wbuf, .len = wlen }, - {.addr = adr, .flags = I2C_M_RD, - .buf = rbuf, .len = rlen } }; - return (i2c_transfer(adapter, msgs, 2) == 2) ? 0 : -1; -} - -static int i2c_write(struct i2c_adapter *adap, u8 adr, u8 *data, int len) -{ - struct i2c_msg msg = {.addr = adr, .flags = 0, - .buf = data, .len = len}; - - return (i2c_transfer(adap, , 1) == 1) ? 0 : -1; -} - -static int i2c_read(struct i2c_adapter *adapter, u8 adr, u8 *val) -{ - struct i2c_msg msgs[1] = {{.addr = adr, .flags = I2C_M_RD, - .buf = val, .len = 1 } }; - return (i2c_transfer(adapter, msgs, 1) == 1) ? 0 : -1; -} - -static int i2c_read_regs(struct i2c_adapter *adapter, -u8 adr, u8 reg, u8 *val, u8 len) -{ - struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0, - .buf = , .len = 1 }, - {.addr = adr, .flags = I2C_M_RD, - .buf = val, .len = len } }; - return (i2c_transfer(adapter, msgs, 2) == 2) ? 0 : -1; -} - -static int i2c_read_reg(struct i2c_adapter *adapter, u8 adr, u8 reg, u8 *val) -{ - return i2c_read_regs(adapter, adr, reg, val, 1); -} - -static int i2c_read_reg16(struct i2c_adapter *adapter, u8 adr, - u16 reg, u8 *val) -{ - u8 msg[2] = {reg>>8, reg&0xff}; - struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0, - .buf = msg, .len = 2}, - {.addr = adr, .flags = I2C_M_RD, - .buf = val, .len = 1} }; - return (i2c_transfer(adapter, msgs, 2) == 2) ? 0 : -1; -} - -static int i2c_write_reg(struct i2c_adapter *adap, u8 adr, -u8 reg, u8 val) -{ - u8 msg[2] = {reg, val}; - - return i2c_write(adap, adr, msg, 2); -} - -static inline u32
[PATCH 01/14] [media] ddbridge: move/reorder functions
From: Daniel SchellerThe functions in ddbridge-core.c have been moved to different positions in newer versions of the dddvb vendor driver package (most notably in version 0.9.9b). Perform the same code move to keep the diff of the upcoming code bump simpler. Signed-off-by: Daniel Scheller --- drivers/media/pci/ddbridge/ddbridge-core.c | 660 ++--- 1 file changed, 327 insertions(+), 333 deletions(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index e762396730db..4d6ab46cb635 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -404,43 +404,6 @@ static void ddb_buffers_free(struct ddb *dev) } } -static void ddb_input_start(struct ddb_input *input) -{ - struct ddb *dev = input->port->dev; - - spin_lock_irq(>lock); - input->cbuf = 0; - input->coff = 0; - - /* reset */ - ddbwritel(0, TS_INPUT_CONTROL(input->nr)); - ddbwritel(2, TS_INPUT_CONTROL(input->nr)); - ddbwritel(0, TS_INPUT_CONTROL(input->nr)); - - ddbwritel((1 << 16) | - (input->dma_buf_num << 11) | - (input->dma_buf_size >> 7), - DMA_BUFFER_SIZE(input->nr)); - ddbwritel(0, DMA_BUFFER_ACK(input->nr)); - - ddbwritel(1, DMA_BASE_WRITE); - ddbwritel(3, DMA_BUFFER_CONTROL(input->nr)); - ddbwritel(9, TS_INPUT_CONTROL(input->nr)); - input->running = 1; - spin_unlock_irq(>lock); -} - -static void ddb_input_stop(struct ddb_input *input) -{ - struct ddb *dev = input->port->dev; - - spin_lock_irq(>lock); - ddbwritel(0, TS_INPUT_CONTROL(input->nr)); - ddbwritel(0, DMA_BUFFER_CONTROL(input->nr)); - input->running = 0; - spin_unlock_irq(>lock); -} - static void ddb_output_start(struct ddb_output *output) { struct ddb *dev = output->port->dev; @@ -477,6 +440,43 @@ static void ddb_output_stop(struct ddb_output *output) spin_unlock_irq(>lock); } +static void ddb_input_stop(struct ddb_input *input) +{ + struct ddb *dev = input->port->dev; + + spin_lock_irq(>lock); + ddbwritel(0, TS_INPUT_CONTROL(input->nr)); + ddbwritel(0, DMA_BUFFER_CONTROL(input->nr)); + input->running = 0; + spin_unlock_irq(>lock); +} + +static void ddb_input_start(struct ddb_input *input) +{ + struct ddb *dev = input->port->dev; + + spin_lock_irq(>lock); + input->cbuf = 0; + input->coff = 0; + + /* reset */ + ddbwritel(0, TS_INPUT_CONTROL(input->nr)); + ddbwritel(2, TS_INPUT_CONTROL(input->nr)); + ddbwritel(0, TS_INPUT_CONTROL(input->nr)); + + ddbwritel((1 << 16) | + (input->dma_buf_num << 11) | + (input->dma_buf_size >> 7), + DMA_BUFFER_SIZE(input->nr)); + ddbwritel(0, DMA_BUFFER_ACK(input->nr)); + + ddbwritel(1, DMA_BASE_WRITE); + ddbwritel(3, DMA_BUFFER_CONTROL(input->nr)); + ddbwritel(9, TS_INPUT_CONTROL(input->nr)); + input->running = 1; + spin_unlock_irq(>lock); +} + static u32 ddb_output_free(struct ddb_output *output) { u32 idx, off, stat = output->stat; @@ -595,7 +595,98 @@ static ssize_t ddb_input_read(struct ddb_input *input, __user u8 *buf, size_t co return count; } -/**/ +// +// + +static ssize_t ts_write(struct file *file, const __user char *buf, + size_t count, loff_t *ppos) +{ + struct dvb_device *dvbdev = file->private_data; + struct ddb_output *output = dvbdev->priv; + size_t left = count; + int stat; + + while (left) { + if (ddb_output_free(output) < 188) { + if (file->f_flags & O_NONBLOCK) + break; + if (wait_event_interruptible( + output->wq, ddb_output_free(output) >= 188) < 0) + break; + } + stat = ddb_output_write(output, buf, left); + if (stat < 0) + break; + buf += stat; + left -= stat; + } + return (left == count) ? -EAGAIN : (count - left); +} + +static ssize_t ts_read(struct file *file, __user char *buf, + size_t count, loff_t *ppos) +{ + struct dvb_device *dvbdev = file->private_data; + struct ddb_output *output = dvbdev->priv; + struct ddb_input *input = output->port->input[0]; + int left, read; + + count -= count % 188; + left = count; + while (left) { + if (ddb_input_avail(input) < 188) {
[PATCH 00/14] ddbridge: bump to ddbridge-0.9.29
From: Daniel SchellerPreferrably for Linux 4.14 (to get things done). Hard-depends on the STV0910/STV6111 driver patchset as the diff and the updated code depends on the driver and the changes involved with the glue code of the STV/DDCineS2V7 series [1]. Mauro/Media maintainers, this updates drivers/media/pci/ddbridge to the very latest code that DD carry in their vendor driver package as of version 0.9.29, in the "once, the big-bang-way is ok" way as discussed at [2] (compared to the incremental, awkward to do variant since that involves dissecting all available release archives and having to - try to - build proper commits out of this, which will always be inaccurate; a start was done at [3], however - and please understand - I definitely don't want to continue doing that...) In patch 14, I add myself to MAINTAINERS. This means I will care about getting driver updates as they're released by DD into mainline, starting from this (0.9.29) version, which is definitely doable in an incremental way. So, I'll make sure the in-kernel driver won't bit-rot again, and it will receive new hardware support as it becomes available in a timely manner. While the driver code bump looks massive, judging from the diff, there's mostly a whole lot of refactoring and restructuring of variables, port/ link management and all such stuff in it. Feature-wise, this is most notable: - Support for all (PCIe) CI (single/duo) cards and Flex addons - Support for MSI (Message Signaled Interrupts), though disabled by default since there were still reports of problems with this - TS Loopback support (set up ports to behave as if a CI is connected, without decryption of course) - As mentioned: Heavy code reordering, and split up into multiple files Stripped functionality compared to dddvb: - DVB-C modulator card support removed (requires DVB core API) - OctoNET SAT>IP server/box support removed (requires API aswell) - with this, GT link support was removed (only on OctoNET hardware) - MaxS8 4/8 DVB-S/S2 card support (temporarily) removed (requires an additional Demod driver; subject for another series) A note on the patches: The bump starts by aligning the code "order-wise" to the updated driver, to keep the diff a bit cleaner. Next, the code split is applied, without actually changing any functionality. Compared to upstream, this isn't done by moving functions into different C files and then do an include on them, but we're handling them with the Makefile, building separate objects, and having proper prototypes in ddbridge.h. After the code bump, further split up is applied to increase readability and maintainability (also, for the MaxS8 support, there will be another object with another ~400 LoC, which originally lives in ddbridge-core aswell). Then, all issues found by W=1 and smatch are resolved, one by one. This is kept separate since those fixes will be proposed for upstream inclusion. The last thing is the addition of the MSI default Kconfig options which will mainly inform users that there's something that might(!) cause issues but is still being worked on - the default is "off" to provide a proper OotB experience. To distinguish from the original unchanged vendor driver, "-integrated" is suffixed to the version code. Note on checkpatch: First two patches are solely code-moving, so checkpatch will complain on them. With the ddbridge code bump, all style issues are resolved. Yes, you will hate me for this large code drop, but at least we sort-of discussed this beforehand, and we have to start *somewhere*. Thanks in advance for reviewing and (optimally) getting this merged and getting the DD driver dilemma solved hopefully once and for all. [1] http://www.spinics.net/lists/linux-media/msg117946.html [2] http://www.spinics.net/lists/linux-media/msg117358.html [3] https://github.com/herrnst/dddvb-linux-kernel/compare/4226861...mediatree/master-ddbupdate Daniel Scheller (14): [media] ddbridge: move/reorder functions [media] ddbridge: split code into multiple files [media] ddbridge: bump ddbridge code to version 0.9.29 [media] ddbridge: split I/O related functions off from ddbridge.h [media] ddbridge: split off IRQ handling [media] ddbridge: split off hardware definitions and mappings [media] ddbridge: check pointers before dereferencing [media] ddbridge: only register frontends in fe2 if fe is not NULL [media] ddbridge: fix possible buffer overflow in ddb_ports_init() [media] ddbridge: remove unreachable code [media] ddbridge: fix impossible condition warning [media] ddbridge: fix dereference before check [media] ddbridge: Kconfig option to control the MSI modparam default [media] MAINTAINERS: add entry for ddbridge MAINTAINERS|8 + drivers/media/pci/ddbridge/Kconfig | 15 + drivers/media/pci/ddbridge/Makefile|3 +- drivers/media/pci/ddbridge/ddbridge-core.c | 4242
Re: [PATCH] checkpatch: fixed alignment and comment style
On Sun, 2017-07-09 at 19:39 +0200, Philipp Guendisch wrote: > This patch fixed alignment, comment style and one appearance of > misordered constant in an if comparison. > Semantic should not be affected by this patch. Your email subject is wrong. This is not a checkpatch patch. Your subject line should be something like: [PATCH] staging: atomisp2: hmm: Alignment code to open parenthesis And it's probably more likely to be applied if you separate out the two different types of changes you are making into 2 patches.
[PATCH] checkpatch: fixed alignment and comment style
This patch fixed alignment, comment style and one appearance of misordered constant in an if comparison. Semantic should not be affected by this patch. There are still a few warnings and even errors left which require a semantic change of the code to fix. e.g. use of in_atomic in drivers There are also two warnings left about too long lines, which reduce readability if changed. Signed-off-by: Philipp GuendischSigned-off-by: Chris Baller --- .../staging/media/atomisp/pci/atomisp2/hmm/hmm.c | 134 +++-- 1 file changed, 68 insertions(+), 66 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c index 5729539..41d3534 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c @@ -45,14 +45,16 @@ struct hmm_pool reserved_pool; static ia_css_ptr dummy_ptr; struct _hmm_mem_stat hmm_mem_stat; -/* p: private - s: shared - u: user - i: ion */ +/* + * p: private + * s: shared + * u: user + * i: ion + */ static const char hmm_bo_type_string[] = "psui"; static ssize_t bo_show(struct device *dev, struct device_attribute *attr, - char *buf, struct list_head *bo_list, bool active) + char *buf, struct list_head *bo_list, bool active) { ssize_t ret = 0; struct hmm_buffer_object *bo; @@ -72,10 +74,10 @@ static ssize_t bo_show(struct device *dev, struct device_attribute *attr, spin_lock_irqsave(_device.list_lock, flags); list_for_each_entry(bo, bo_list, list) { if ((active && (bo->status & HMM_BO_ALLOCED)) || - (!active && !(bo->status & HMM_BO_ALLOCED))) { + (!active && !(bo->status & HMM_BO_ALLOCED))) { ret = scnprintf(buf + index1, PAGE_SIZE - index1, - "%c %d\n", - hmm_bo_type_string[bo->type], bo->pgnr); + "%c %d\n", + hmm_bo_type_string[bo->type], bo->pgnr); total[bo->type] += bo->pgnr; count[bo->type]++; @@ -88,9 +90,10 @@ static ssize_t bo_show(struct device *dev, struct device_attribute *attr, for (i = 0; i < HMM_BO_LAST; i++) { if (count[i]) { ret = scnprintf(buf + index1 + index2, - PAGE_SIZE - index1 - index2, - "%ld %c buffer objects: %ld KB\n", - count[i], hmm_bo_type_string[i], total[i] * 4); + PAGE_SIZE - index1 - index2, + "%ld %c buffer objects: %ld KB\n", + count[i], hmm_bo_type_string[i], + total[i] * 4); if (ret > 0) index2 += ret; } @@ -101,22 +104,22 @@ static ssize_t bo_show(struct device *dev, struct device_attribute *attr, } static ssize_t active_bo_show(struct device *dev, - struct device_attribute *attr, - char *buf) + struct device_attribute *attr, + char *buf) { return bo_show(dev, attr, buf, _device.entire_bo_list, true); } static ssize_t free_bo_show(struct device *dev, - struct device_attribute *attr, - char *buf) + struct device_attribute *attr, + char *buf) { return bo_show(dev, attr, buf, _device.entire_bo_list, false); } static ssize_t reserved_pool_show(struct device *dev, - struct device_attribute *attr, - char *buf) + struct device_attribute *attr, + char *buf) { ssize_t ret = 0; @@ -128,7 +131,7 @@ static ssize_t reserved_pool_show(struct device *dev, spin_lock_irqsave(>list_lock, flags); ret = scnprintf(buf, PAGE_SIZE, "%d out of %d pages available\n", - pinfo->index, pinfo->pgnr); + pinfo->index, pinfo->pgnr); spin_unlock_irqrestore(>list_lock, flags); if (ret > 0) @@ -138,8 +141,8 @@ static ssize_t reserved_pool_show(struct device *dev, }; static ssize_t dynamic_pool_show(struct device *dev, - struct device_attribute *attr, - char *buf) +struct device_attribute *attr, +char *buf) { ssize_t ret = 0; @@ -151,7 +154,7 @@ static ssize_t dynamic_pool_show(struct device *dev, spin_lock_irqsave(>list_lock, flags); ret = scnprintf(buf, PAGE_SIZE, "%d (max
[PATCH] [media] dvb-frontends/stv0367: DDB frontend status inquiry fixup
From: Daniel SchellerReturn 0 instead of -EINVAL in get_frontend if no demod mode is active. This fixes ie. dvb-fe-tool getting confused and assuming a DVBv3 FE on idle frontends when the FE has been put to sleep using sleep(). Also, in read_status(), don't immediately return when no demod is active, so the remaining code has a chance to clear the signal statistics. Signed-off-by: Daniel Scheller --- drivers/media/dvb-frontends/stv0367.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/dvb-frontends/stv0367.c b/drivers/media/dvb-frontends/stv0367.c index 8ac0f598978d..59c1aad256c2 100644 --- a/drivers/media/dvb-frontends/stv0367.c +++ b/drivers/media/dvb-frontends/stv0367.c @@ -3090,7 +3090,7 @@ static int stv0367ddb_read_status(struct dvb_frontend *fe, { struct stv0367_state *state = fe->demodulator_priv; struct dtv_frontend_properties *p = >dtv_property_cache; - int ret; + int ret = 0; switch (state->activedemod) { case demod_ter: @@ -3100,7 +3100,7 @@ static int stv0367ddb_read_status(struct dvb_frontend *fe, ret = stv0367cab_read_status(fe, status); break; default: - return 0; + break; } /* stop and report on *_read_status failure */ @@ -3138,7 +3138,7 @@ static int stv0367ddb_get_frontend(struct dvb_frontend *fe, break; } - return -EINVAL; + return 0; } static int stv0367ddb_sleep(struct dvb_frontend *fe) -- 2.13.0
Re: [PATCH v2 0/7] [PATCH v2 0/7] Add support of OV9655 camera
Hi Hugues, On 07/06/2017 09:51 AM, Hugues FRUCHET wrote: Hi Sylwester, Do you have the possibility to check for non-regression of this patchset on 9650/52 camera ? I will try to test your patch set once I find the camera module for my Micro2440SDK board. I've spent already a day on setting up everything and fixing multiple regressions in the kernel. I will likely try your patch series in coming week. -- Thanks, Sylwester
Dein Geld
Liebe Begünstigte, Du hast gewonnen (€950.000,00 EURO) als Charity-Spenden / Hilfe der Qatar Foundation erhalten. Kontaktieren Sie uns über E-Mail für weitere Informationen; Mit freundlichen Grüßen, Ingenieur Saad Al Muhannadi. Kontakt e-mail: qcharit...@gmail.com Präsident der Qatar Foundation.
[PATCH] media: venus: hfi: fix error handling in hfi_sys_init_done()
Not entirely sure what triggers it, but with venus build as kernel module and in initrd, we hit this crash: Unable to handle kernel paging request at virtual address 80003c039000 pgd = 0a14f000 [80003c039000] *pgd=bd9f7003, *pud=bd9f6003, *pmd=bd9f0003, *pte= Internal error: Oops: 9607 [#1] SMP Modules linked in: qcom_wcnss_pil(E+) crc32_ce(E) qcom_common(E) venus_core(E+) remoteproc(E) snd_soc_msm8916_digital(E) virtio_ring(E) cdc_ether(E) snd_soc_lpass_apq8016(E) snd_soc_lpass_cpu(E) snd_soc_apq8016_sbc(E) snd_soc_lpass_platform(E) v4l2_mem2mem(E) virtio(E) snd_soc_core(E) ac97_bus(E) snd_pcm_dmaengine(E) snd_seq(E) leds_gpio(E) videobuf2_v4l2(E) videobuf2_core(E) snd_seq_device(E) snd_pcm(E) videodev(E) media(E) nvmem_qfprom(E) msm(E) snd_timer(E) snd(E) soundcore(E) spi_qup(E) mdt_loader(E) qcom_tsens(E) qcom_spmi_temp_alarm(E) nvmem_core(E) msm_rng(E) uas(E) usb_storage(E) dm9601(E) usbnet(E) mii(E) mmc_block(E) adv7511(E) drm_kms_helper(E) syscopyarea(E) sysfillrect(E) sysimgblt(E) fb_sys_fops(E) qcom_spmi_vadc(E) qcom_vadc_common(PE) industrialio(E) pinctrl_spmi_mpp(E) pinctrl_spmi_gpio(E) rtc_pm8xxx(E) clk_smd_rpm(E) sdhci_msm(E) sdhci_pltfm(E) qcom_smd_regulator(E) drm(E) smd_rpm(E) qcom_spmi_pmic(E) regmap_spmi(E) ci_hdrc_msm(E) ci_hdrc(E) usb3503(E) extcon_usb_gpio(E) phy_msm_usb(E) udc_core(E) qcom_hwspinlock(E) extcon_core(E) ehci_msm(E) i2c_qup(E) sdhci(E) mmc_core(E) spmi_pmic_arb(E) spmi(E) qcom_smd(E) smsm(E) rpmsg_core(E) smp2p(E) smem(E) hwspinlock_core(E) gpio_keys(E) CPU: 2 PID: 551 Comm: irq/150-venus Tainted: PE 4.12.0+ #1625 Hardware name: qualcomm dragonboard410c/dragonboard410c, BIOS 2017.07-rc2-00144-ga97bdbdf72-dirty 07/08/2017 task: 800037338000 task.stack: 800038e0 PC is at hfi_sys_init_done+0x64/0x140 [venus_core] LR is at hfi_process_msg_packet+0xcc/0x1e8 [venus_core] pc : [] lr : [] pstate: 20400145 sp : 800038e03c60 x29: 800038e03c60 x28: x27: 000df018 x26: 0118f4d0 x25: 00020003 x24: 80003a8d3010 x23: 0118f760 x22: 800037b40028 x21: 8000382981f0 x20: 800037b40028 x19: 80003c039000 x18: 0020 x17: x16: 800037338000 x15: x14: 00100014 x13: 00011007 x12: 00010020 x11: 100e x10: 0001 x9 : 0002 x8 : 00140001 x7 : 1010 x6 : 0148 x5 : 1009 x4 : 80003c039000 x3 : cd770abb x2 : 0042 x1 : 0788 x0 : 0002 Process irq/150-venus (pid: 551, stack limit = 0x800038e0) Call trace: [] hfi_sys_init_done+0x64/0x140 [venus_core] [] hfi_process_msg_packet+0xcc/0x1e8 [venus_core] [] venus_isr_thread+0x1b4/0x208 [venus_core] [] hfi_isr_thread+0x28/0x38 [venus_core] [] irq_thread_fn+0x30/0x70 [] irq_thread+0x14c/0x1c8 [] kthread+0x138/0x140 [] ret_from_fork+0x10/0x40 Code: 52820125 52820207 7a431820 54000249 (b9400263) ---[ end trace c963460f20a984b6 ]--- The problem is that in the error case, we've incremented the data ptr but not decremented rem_bytes, and keep reading (presumably garbage) until eventually we go beyond the end of the buffer. Instead, on first error, we should probably just bail out. Other option is to increment read_bytes by sizeof(u32) before the switch, rather than only accounting for the ptype header in the non-error case. Note that in this case it is HFI_ERR_SYS_INVALID_PARAMETER, ie. an unrecognized/unsupported parameter, so interpreting the next word as a property type would be bogus. The other error cases are due to truncated buffer, so there isn't likely to be anything valid to interpret in the remainder of the buffer. So just bailing seems like a reasonable solution. Signed-off-by: Rob Clark--- drivers/media/platform/qcom/venus/hfi_msgs.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/qcom/venus/hfi_msgs.c b/drivers/media/platform/qcom/venus/hfi_msgs.c index debf80a92797..4190825b20a1 100644 --- a/drivers/media/platform/qcom/venus/hfi_msgs.c +++ b/drivers/media/platform/qcom/venus/hfi_msgs.c @@ -239,11 +239,12 @@ static void hfi_sys_init_done(struct venus_core *core, struct venus_inst *inst, break; } - if (!error) { - rem_bytes -= read_bytes; - data += read_bytes; - num_properties--; - } + if (error) + break; + + rem_bytes -= read_bytes; + data += read_bytes; + num_properties--; } err_no_prop: -- 2.13.0
Re: [PATCH v2] staging: atomisp: use kstrdup to replace kmalloc and memcpy
On 8 July 2017 at 16:31, Sakari Ailuswrote: > Hi Hari, > > On Fri, Jul 07, 2017 at 08:15:21PM +0530, Hari Prasath wrote: >> kstrdup kernel primitive can be used to replace kmalloc followed by >> string copy. This was reported by coccinelle tool >> >> Signed-off-by: Hari Prasath >> --- >> .../media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c | 10 >> +++--- >> 1 file changed, 3 insertions(+), 7 deletions(-) >> >> diff --git >> a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c >> b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c >> index 34cc56f..68db87b 100644 >> --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c >> +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c >> @@ -144,14 +144,10 @@ sh_css_load_blob_info(const char *fw, const struct >> ia_css_fw_info *bi, struct ia >> ) >> { >> char *namebuffer; >> - int namelength = (int)strlen(name); >> - >> - namebuffer = (char *) kmalloc(namelength + 1, GFP_KERNEL); >> - if (namebuffer == NULL) >> - return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; >> - >> - memcpy(namebuffer, name, namelength + 1); >> >> + namebuffer = kstrdup(name, GFP_KERNEL); >> + if (!namebuffer) >> + return -ENOMEM; > > The patch also changes the return value in error cases. I believe the > caller(s) expect to get errors in the IA_CCS_ERR_* range. Hi, In this particular case, the calling function just checks if it's not success defined by a enum. I think returning -ENOMEM would not effect, at least in this case. - Hari Prasath > >> bd->name = fw_minibuffer[index].name = namebuffer; >> } else { >> bd->name = name; > > -- > Regards, > > Sakari Ailus > e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk -- Regards, G.E.Hari Prasath
Re: [PATCH RFC 1/2] app: kaffeine: Fix missing PCR on live streams.
On 09/07/17 12:14, Mauro Carvalho Chehab wrote: Hi Malcolm, Em Sun, 9 Jul 2017 10:43:50 +0100 Malcolm Priestleyescreveu: The ISO/IEC standard 13818-1 or ITU-T Rec. H.222.0 standard allow transport vendors to place PCR (Program Clock Reference) on a different PID. If the PCR is unset the value is 0x1fff, most vendors appear to set it the same as video pid in which case it need not be set. The PCR PID is at an offset of 8 in pmtSection structure. Thanks for the patches! Patches look good, except for two things: - we use camelCase at Kaffeine. So, the new field should be pcrPid ;) Ok, Wasn't sure - you didn't use dvbsi.xml. The way we usually update dvbsi.h and part of dvbsi.cpp is to add a field at dvbsi.xml and then run: $ tools/update_dvbsi.sh Oh I see. Kaffeine should be built with the optional BUILD_TOOLS feature, in order for it to build the tool that parses dvbsi.xml. Anyway, I applied your patchset and added a few pathes afterwards adjusting it. Thanks How do you turn off debug the spam from epg is horrendous. Regards Malcolm
Re: [PATCH RFC 1/2] app: kaffeine: Fix missing PCR on live streams.
Hi Malcolm, Em Sun, 9 Jul 2017 10:43:50 +0100 Malcolm Priestleyescreveu: > The ISO/IEC standard 13818-1 or ITU-T Rec. H.222.0 standard allow transport > vendors to place PCR (Program Clock Reference) on a different PID. > > If the PCR is unset the value is 0x1fff, most vendors appear to set it the > same as video pid in which case it need not be set. > > The PCR PID is at an offset of 8 in pmtSection structure. Thanks for the patches! Patches look good, except for two things: - we use camelCase at Kaffeine. So, the new field should be pcrPid ;) - you didn't use dvbsi.xml. The way we usually update dvbsi.h and part of dvbsi.cpp is to add a field at dvbsi.xml and then run: $ tools/update_dvbsi.sh Kaffeine should be built with the optional BUILD_TOOLS feature, in order for it to build the tool that parses dvbsi.xml. Anyway, I applied your patchset and added a few pathes afterwards adjusting it. Regards, Mauro > > Signed-off-by: Malcolm Priestley > --- > src/dvb/dvbliveview.cpp | 8 > src/dvb/dvbsi.h | 5 + > 2 files changed, 13 insertions(+) > > diff --git a/src/dvb/dvbliveview.cpp b/src/dvb/dvbliveview.cpp > index cfad892..3e92fa6 100644 > --- a/src/dvb/dvbliveview.cpp > +++ b/src/dvb/dvbliveview.cpp > @@ -518,6 +518,7 @@ void DvbLiveView::updatePids(bool forcePatPmtUpdate) > DvbPmtSection pmtSection(internal->pmtSectionData); > DvbPmtParser pmtParser(pmtSection); > QSet newPids; > + int pcr_pid = pmtSection.pcr_pid(); > bool updatePatPmt = forcePatPmtUpdate; > bool isTimeShifting = internal->timeShiftFile.isOpen(); > > @@ -543,6 +544,13 @@ void DvbLiveView::updatePids(bool forcePatPmtUpdate) > newPids.insert(pmtParser.teletextPid); > } > > + /* check PCR PID is set */ > + if (pcr_pid != 0x1fff) { > + /* Check not already in list */ > + if (!newPids.contains(pcr_pid)) > + newPids.insert(pcr_pid); > + } > + > for (int i = 0; i < pids.size(); ++i) { > int pid = pids.at(i); > > diff --git a/src/dvb/dvbsi.h b/src/dvb/dvbsi.h > index 4d27252..9b4bbe0 100644 > --- a/src/dvb/dvbsi.h > +++ b/src/dvb/dvbsi.h > @@ -1098,6 +1098,11 @@ public: > return (at(3) << 8) | at(4); > } > > + int pcr_pid() const > + { > + return ((at(8) & 0x1f) << 8) | at(9); > + } > + > DvbDescriptor descriptors() const > { > return DvbDescriptor(getData() + 12, descriptorsLength); Thanks, Mauro
[PATCH RFC 1/2] app: kaffeine: Fix missing PCR on live streams.
The ISO/IEC standard 13818-1 or ITU-T Rec. H.222.0 standard allow transport vendors to place PCR (Program Clock Reference) on a different PID. If the PCR is unset the value is 0x1fff, most vendors appear to set it the same as video pid in which case it need not be set. The PCR PID is at an offset of 8 in pmtSection structure. Signed-off-by: Malcolm Priestley--- src/dvb/dvbliveview.cpp | 8 src/dvb/dvbsi.h | 5 + 2 files changed, 13 insertions(+) diff --git a/src/dvb/dvbliveview.cpp b/src/dvb/dvbliveview.cpp index cfad892..3e92fa6 100644 --- a/src/dvb/dvbliveview.cpp +++ b/src/dvb/dvbliveview.cpp @@ -518,6 +518,7 @@ void DvbLiveView::updatePids(bool forcePatPmtUpdate) DvbPmtSection pmtSection(internal->pmtSectionData); DvbPmtParser pmtParser(pmtSection); QSet newPids; + int pcr_pid = pmtSection.pcr_pid(); bool updatePatPmt = forcePatPmtUpdate; bool isTimeShifting = internal->timeShiftFile.isOpen(); @@ -543,6 +544,13 @@ void DvbLiveView::updatePids(bool forcePatPmtUpdate) newPids.insert(pmtParser.teletextPid); } + /* check PCR PID is set */ + if (pcr_pid != 0x1fff) { + /* Check not already in list */ + if (!newPids.contains(pcr_pid)) + newPids.insert(pcr_pid); + } + for (int i = 0; i < pids.size(); ++i) { int pid = pids.at(i); diff --git a/src/dvb/dvbsi.h b/src/dvb/dvbsi.h index 4d27252..9b4bbe0 100644 --- a/src/dvb/dvbsi.h +++ b/src/dvb/dvbsi.h @@ -1098,6 +1098,11 @@ public: return (at(3) << 8) | at(4); } + int pcr_pid() const + { + return ((at(8) & 0x1f) << 8) | at(9); + } + DvbDescriptor descriptors() const { return DvbDescriptor(getData() + 12, descriptorsLength); -- 2.13.2
[PATCH RFC 2/2] app: kaffeine: Fix missing PCR on stream recordings.
The ISO/IEC standard 13818-1 or ITU-T Rec. H.222.0 standard allow transport vendors to place PCR (Program Clock Reference) on a different PID. This patch adds it recording to file. Signed-off-by: Malcolm Priestley--- src/dvb/dvbrecording.cpp | 8 1 file changed, 8 insertions(+) diff --git a/src/dvb/dvbrecording.cpp b/src/dvb/dvbrecording.cpp index ecb4777..12a57dc 100644 --- a/src/dvb/dvbrecording.cpp +++ b/src/dvb/dvbrecording.cpp @@ -961,6 +961,7 @@ void DvbRecordingFile::pmtSectionChanged(const QByteArray _) pmtSectionData = pmtSectionData_; DvbPmtSection pmtSection(pmtSectionData); DvbPmtParser pmtParser(pmtSection); + int pcr_pid = pmtSection.pcr_pid(); QSet newPids; if (pmtParser.videoPid != -1) { @@ -979,6 +980,13 @@ void DvbRecordingFile::pmtSectionChanged(const QByteArray _) newPids.insert(pmtParser.teletextPid); } + /* check PCR PID is set */ + if (pcr_pid != 0x1fff) { + /* Check not already in list */ + if (!newPids.contains(pcr_pid)) + newPids.insert(pcr_pid); + } + for (int i = 0; i < pids.size(); ++i) { int pid = pids.at(i); -- 2.13.2