Add fc0011 tuner driver
PATCH 1/1 Add fc0011 tuner driver
This adds support for the Fitipower fc0011 DVB-t tuner.
---
drivers/media/common/tuners/Kconfig +7 -0
@@ -204,6 +204,13 @@ help NXP TDA18218 silicon tuner driver. +config MEDIA_TUNER_FC0011 + tristate "Fitipower FC0011 silicon tuner" + depends on VIDEO_MEDIA && I2C + default m if MEDIA_TUNER_CUSTOMISE + help + Fitipower FC0011 silicon tuner driver. + config MEDIA_TUNER_TDA18212 tristate "NXP TDA18212 silicon tuner" depends on VIDEO_MEDIA && I2C
drivers/media/common/tuners/Makefile +1 -0
@@ -29,6 +29,7 @@ obj-$(CONFIG_MEDIA_TUNER_TDA18218) += tda18218.o obj-$(CONFIG_MEDIA_TUNER_TDA18212) += tda18212.o obj-$(CONFIG_MEDIA_TUNER_TUA9001) += tua9001.o +obj-$(CONFIG_MEDIA_TUNER_FC0011) += fc0011.o ccflags-y += -I$(srctree)/drivers/media/dvb/dvb-core ccflags-y += -I$(srctree)/drivers/media/dvb/frontends
drivers/media/common/tuners/fc0011.c new file +524 -0
524 lines not on this page · raw message
drivers/media/common/tuners/fc0011.h new file +41 -0
41 lines not on this page · raw message
MAINTAINERS +7 -0
@@ -2697,6 +2697,13 @@ F: Documentation/hwmon/f71805f F: drivers/hwmon/f71805f.c +FC0011 TUNER DRIVER +M: Michael Buesch <[email protected]> +L: [email protected] +S: Maintained +F: drivers/media/common/tuners/fc0011.h +F: drivers/media/common/tuners/fc0011.c + FANOTIFY M: Eric Paris <[email protected]> S: Maintained
Signature · 3 lines
Greetings, Michael. PGP encryption is encouraged / 908D8B0E
Antti Palosaari
AppliedQuoted 3 lines · Michael Büsch
This adds support for the Fitipower fc0011 DVB-t tuner.
Signed-off-by Michael Buesch<[email protected]>
Applied, thanks!
http://git.linuxtv.org/anttip/media_tree.git/shortlog/refs/heads/af9035_experimental
I looked it through quickly, no big issues. Anyhow, when I ran checkpatch.pl and it complains rather much. All Kernel developers must use checkpatch.pl before sent patches and fix findings if possible, errors must be fixed and warnings too if there is no good reason to leave as it is.
Send new patch that fixes those issues or sent same patches again but fixed.
And one note about tuner driver, my AF9035 + FC0011 device founds only 1 mux of 4. Looks like some performance issues still to resolve.
regards
Antti
Signature · 1 line
http://palosaari.fi/
Quoted 5 lines · On Mon, 02 Apr 2012 19:56:50 +0300 Antti Palosaari <[email protected]> wrote:
Quoted 3 lines · Michael Büsch
This adds support for the Fitipower fc0011 DVB-t tuner.
Signed-off-by Michael Buesch<[email protected]>
Quoted 8 lines
Applied, thanks!
http://git.linuxtv.org/anttip/media_tree.git/shortlog/refs/heads/af9035_experimentalI looked it through quickly, no big issues. Anyhow, when I ran checkpatch.pl and it complains rather much. All Kernel developers must use checkpatch.pl before sent patches and fix findings if possible, errors must be fixed and warnings too if there is no good reason to leave as it is.
Well, I _did_ run it on the patch.
There is no error. Only (IMO bogus) warnings. Most of them
are about the 80 char limit. Which isn't really a hard limit. And those lines only exceed the 80 char limit by a few chars (one, two or such). Splitting those line serves no readability purpose. In fact, it just worsens it.
Quoted 2 lines
And one note about tuner driver, my AF9035 + FC0011 device founds only 1 mux of 4. Looks like some performance issues still to resolve.
I have no idea what this means.
So I have no remote idea of what could possibly be wrong here. Is this a bug on af903x or the tuner driver?
Signature · 3 lines
Greetings, Michael. PGP encryption is encouraged / 908D8B0E
Quoted 17 lines · Michael Büsch
Quoted 5 lines · On Mon, 02 Apr 2012 19:56:50 +0300 Antti Palosaari<[email protected]> wrote:
Quoted 3 lines · Michael Büsch
This adds support for the Fitipower fc0011 DVB-t tuner.
Signed-off-by Michael Buesch<[email protected]>Quoted 8 lines
Applied, thanks!
http://git.linuxtv.org/anttip/media_tree.git/shortlog/refs/heads/af9035_experimentalI looked it through quickly, no big issues. Anyhow, when I ran checkpatch.pl and it complains rather much. All Kernel developers must use checkpatch.pl before sent patches and fix findings if possible, errors must be fixed and warnings too if there is no good reason to leave as it is.
Quoted 5 lines
Well, I _did_ run it on the patch.
There is no error. Only (IMO bogus) warnings. Most of them
are about the 80 char limit. Which isn't really a hard limit. And those lines only exceed the 80 char limit by a few chars (one, two or such). Splitting those line serves no readability purpose. In fact, it just worsens it.
git show --pretty=email b650f4d701859ccff76870208c9fd8093cc64209 | ./scripts/checkpatch.pl -
WARNING: please write a paragraph that describes the config symbol fully
#37: FILE: drivers/media/common/tuners/Kconfig:207:
+config MEDIA_TUNER_FC0011
WARNING: msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.txt
+ msleep(10);
WARNING: quoted string split across lines
#334: FILE: drivers/media/common/tuners/fc0011.c:270:
+ dev_warn(&priv->i2c->dev, "Unsupported bandwidth %u kHz. "
+ "Using 6000 kHz.\n",
WARNING: line over 80 characters
#397: FILE: drivers/media/common/tuners/fc0011.c:333:
+ err |= fc0011_writereg(priv, FC11_REG_RCCAL, regs[FC11_REG_RCCAL]);
WARNING: line over 80 characters
#420: FILE: drivers/media/common/tuners/fc0011.c:356:
+ regs[FC11_REG_VCOSEL] &= ~(FC11_VCOSEL_1 | FC11_VCOSEL_2);
WARNING: line over 80 characters
#430: FILE: drivers/media/common/tuners/fc0011.c:366:
+ regs[FC11_REG_VCOSEL] &= ~(FC11_VCOSEL_1 | FC11_VCOSEL_2);
WARNING: line over 80 characters
#439: FILE: drivers/media/common/tuners/fc0011.c:375:
+ regs[FC11_REG_VCOSEL] &= ~(FC11_VCOSEL_1 | FC11_VCOSEL_2);
WARNING: line over 80 characters
#449: FILE: drivers/media/common/tuners/fc0011.c:385:
+ regs[FC11_REG_VCOSEL] &= ~(FC11_VCOSEL_1 | FC11_VCOSEL_2);
WARNING: line over 80 characters
#456: FILE: drivers/media/common/tuners/fc0011.c:392:
+ regs[FC11_REG_VCOSEL] &= ~(FC11_VCOSEL_1 | FC11_VCOSEL_2);
WARNING: line over 80 characters
#468: FILE: drivers/media/common/tuners/fc0011.c:404:
+ regs[FC11_REG_VCOSEL] &= ~(FC11_VCOSEL_1 | FC11_VCOSEL_2);
WARNING: line over 80 characters
#478: FILE: drivers/media/common/tuners/fc0011.c:414:
+ regs[FC11_REG_VCOSEL] &= ~(FC11_VCOSEL_1 | FC11_VCOSEL_2);
WARNING: msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.txt
+ msleep(10);
WARNING: quoted string split across lines
#504: FILE: drivers/media/common/tuners/fc0011.c:440:
+ dev_dbg(&priv->i2c->dev, "Tuned to "
+ "fa=%02X fp=%02X xin=%02X%02X vco=%02X vcosel=%02X "
WARNING: please, no spaces at the start of a line #620: FILE: drivers/media/common/tuners/fc0011.h:26:
+ defined(CONFIG_MEDIA_TUNER_FC0011_MODULE)$
total: 0 errors, 14 warnings, 598 lines checked
Your patch has style problems, please review.
If any of these errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS.
hmmmm, I think Mauro will at least complain when I ask he to PULL that master. Personally I would like to see line len something more than 80 chars, but as checkpatch.pl complains it I have shortened lines despite very few cases.
@Mauro what do you think are that kind of WARNINGs, those are not errors, allowed?
Quoted 6 lines
Quoted 2 lines
And one note about tuner driver, my AF9035 + FC0011 device founds only 1 mux of 4. Looks like some performance issues still to resolve.
I have no idea what this means.
So I have no remote idea of what could possibly be wrong here. Is this a bug on af903x or the tuner driver?
Likely tuner driver, or demod driver. But as demod tuner initialization tables are likely correct I suspect it is tuner issue at first hand. And secondly my other hardware with TUA9001 performs very well, better than old AF9015 sticks.
regards
Antti
Signature · 1 line
http://palosaari.fi/
Quoted 4 lines · On Mon, 02 Apr 2012 20:40:45 +0300 Antti Palosaari <[email protected]> wrote:
hmmmm, I think Mauro will at least complain when I ask he to PULL that master. Personally I would like to see line len something more than 80 chars, but as checkpatch.pl complains it I have shortened lines despite very few cases.
I'm not a friend of long lines. In fact, I'm developing on a Netbook with split screen. So long lines will absolutely kill readability for me. But there is "long" as in 90 or 100 chars and there is "long" as in "uh let's stretch the 80 chars limit by a few chars, so that it's more readable".
I already worked on code from other kernel subsystems for quite some time and the 80 char limit never was a hard limit there. For good reasons.
That said, iff the 80 char limit _is_ a hard limit for the DVB subsystem, I'll honor it. I just think it would worsen the code.
Quoted 4 lines
Likely tuner driver, or demod driver. But as demod tuner initialization tables are likely correct I suspect it is tuner issue at first hand. And secondly my other hardware with TUA9001 performs very well, better than old AF9015 sticks.
Well the fc0011 tuner driver still works worse on this af9035 driver than on Hans' driver. I have absolutely no idea why this is the case. I'm almost certain that it is not a timing issue of some sort. I tried a zillion of delays and such.
Signature · 3 lines
Greetings, Michael. PGP encryption is encouraged / 908D8B0E
Quoted 9 lines · Michael Büsch
Quoted 4 lines
Likely tuner driver, or demod driver. But as demod tuner initialization tables are likely correct I suspect it is tuner issue at first hand. And secondly my other hardware with TUA9001 performs very well, better than old AF9015 sticks.
Well the fc0011 tuner driver still works worse on this af9035 driver than on Hans' driver. I have absolutely no idea why this is the case. I'm almost certain that it is not a timing issue of some sort. I tried a zillion of delays and such.
And after taking sniffs and comparing those I found the reason. It is I2C adapter code. It writes one byte too much => as a FC0011 is auto-increment (as almost every I2C client) registers it means it writes next register too. Fixing that gives normal tuner sensitivity. I will try to make patch for that soon.
regards
Antti
Signature · 1 line
http://palosaari.fi/
Quoted 10 lines · On Tue, 03 Apr 2012 00:52:08 +0300 Antti Palosaari <[email protected]> wrote:
Quoted 4 lines
Well the fc0011 tuner driver still works worse on this af9035 driver than on Hans' driver. I have absolutely no idea why this is the case. I'm almost certain that it is not a timing issue of some sort. I tried a zillion of delays and such.
And after taking sniffs and comparing those I found the reason. It is I2C adapter code. It writes one byte too much => as a FC0011 is auto-increment (as almost every I2C client) registers it means it writes next register too. Fixing that gives normal tuner sensitivity. I will try to make patch for that soon.
Awesome! Thanks a lot!
Signature · 3 lines
Greetings, Michael. PGP encryption is encouraged / 908D8B0E
Quoted 14 lines · Michael Büsch
This adds support for the Fitipower fc0011 DVB-t tuner.
Signed-off-by Michael Buesch<[email protected]>(quoted diff) +9
-0+ unsigned int i, vco_retries; + u32 freq = p->frequency / 1000; + u32 bandwidth = p->bandwidth_hz / 1000; + u32 fvco, xin, xdiv, xdivr; + u16 frac; + u8 fa, fp, vco_sel, vco_cal; + u8 regs[FC11_NR_REGS] = { }; + + dev_dbg(&priv->i2c->dev, "Tuned to "
Review
Quoted 10 lines
(quoted diff) +10
-0+ "fa=%02X fp=%02X xin=%02X%02X vco=%02X vcosel=%02X " + "vcocal=%02X(%u) bw=%u\n", + (unsigned int)regs[FC11_REG_FA], + (unsigned int)regs[FC11_REG_FP], + (unsigned int)regs[FC11_REG_XINHI], + (unsigned int)regs[FC11_REG_XINLO], + (unsigned int)regs[FC11_REG_VCO], + (unsigned int)regs[FC11_REG_VCOSEL], + (unsigned int)vco_cal, vco_retries, + (unsigned int)bandwidth);
Just for the interest, is there any reason you use so much casting or is that only your style?
I removed some similar castings from the AF9035 log writings you added as I did not see need for those. I even think casting should be avoided as it can hide possible meaningful compiler warnings on bad case.
regards
Antti
Signature · 1 line
http://palosaari.fi/
Quoted 13 lines · On Mon, 07 May 2012 22:02:18 +0300 Antti Palosaari <[email protected]> wrote:
Quoted 11 lines · Michael Büsch
This adds support for the Fitipower fc0011 DVB-t tuner.
Signed-off-by Michael Buesch<[email protected]>drivers/media/common/tuners/fc0011.c new file +7
-0+unsigned int i, vco_retries; +u32 freq = p->frequency /1000 ; +u32 bandwidth = p->bandwidth_hz /1000 ; +u32 fvco, xin, xdiv, xdivr; +u16 frac; +u8 fa, fp, vco_sel, vco_cal; +u8 regs[FC11_NR_REGS ] = { };
Quoted 15 lines
drivers/media/common/tuners/fc0011.c line 449
Quoted 12 lines
drivers/media/common/tuners/fc0011.c new file +12
-0+ +dev_dbg (&priv->i2c->dev,"Tuned to " +"fa=%02X fp=%02X xin=%02X%02X vco=%02X vcosel=%02X " +"vcocal=%02X(%u) bw=%u\n" , + (unsigned int )regs[FC11_REG_FA ], + (unsigned int )regs[FC11_REG_FP ], + (unsigned int )regs[FC11_REG_XINHI ], + (unsigned int )regs[FC11_REG_XINLO ], + (unsigned int )regs[FC11_REG_VCO ], + (unsigned int )regs[FC11_REG_VCOSEL ], + (unsigned int )vco_cal, vco_retries, + (unsigned int )bandwidth);Just for the interest, is there any reason you use so much casting or is that only your style?
Well it makes sure the types are what the format string and thus vararg code expects. it is true that most (probably all) of those explicit casts could be removed and instead rely on implicit casts and promotions. But I personally prefer explicit casts in this case (and only this case).
Signature · 3 lines
Greetings, Michael. PGP encryption is encouraged / 908D8B0E
Le mardi 8 mai 2012 00:00:31 Michael Büsch, vous avez écrit :
Quoted 15 lines
Quoted 6 lines
Quoted 6 lines
drivers/media/common/tuners/fc0011.c new file +6
-0+ dev_dbg(&priv->i2c->dev, "Tuned to " + "fa=%02X fp=%02X xin=%02X%02X vco=%02X vcosel=%02X " + "vcocal=%02X(%u) bw=%u\n", + (unsigned int)regs[FC11_REG_FA], + (unsigned int)regs[FC11_REG_FP], + (unsigned int)regs[FC11_REG_XINHI],Quoted 8 lines
drivers/media/common/tuners/fc0011.c line 449
Quoted 5 lines
drivers/media/common/tuners/fc0011.c new file +5
-0+ (unsigned int )regs[FC11_REG_XINLO ], + (unsigned int )regs[FC11_REG_VCO ], + (unsigned int )regs[FC11_REG_VCOSEL ], + (unsigned int )vco_cal, vco_retries, + (unsigned int)bandwidth);Just for the interest, is there any reason you use so much casting or is that only your style?
Quoted 4 lines
Well it makes sure the types are what the format string and thus vararg code expects. it is true that most (probably all) of those explicit casts could be removed and instead rely on implicit casts and promotions. But I personally prefer explicit casts in this case (and only this case).
Not sure Linux printk supports it, but C specifies the "hh" prefix for 'char', and the "h" prefix for 'short' for instance "%02hhX", and this would also work for u8 and u16.
The pedantic in me needs to add that the official prefixes for uint8_t and uint16_t are the PRIX8 and PRIX16 macros from <inttypes.h>, e.g.:
printf("%02"PRIX8"\n", regs[0]);...but that's definitely not valid in kernel.
Signature · 3 lines
Rémi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis