From 195a360c69962832e547fed5fd88bc25c8f79d84 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 8 Mar 2009 11:48:28 -0300 Subject: Add a tool to identify if the frontend selects are fine From: Mauro Carvalho Chehab Priority: normal Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/fix_dvb_customise.pl | 257 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 257 insertions(+) create mode 100755 v4l/scripts/fix_dvb_customise.pl (limited to 'v4l') diff --git a/v4l/scripts/fix_dvb_customise.pl b/v4l/scripts/fix_dvb_customise.pl new file mode 100755 index 000000000..c4c9c14bd --- /dev/null +++ b/v4l/scripts/fix_dvb_customise.pl @@ -0,0 +1,257 @@ +#!/usr/bin/perl +use strict; +use warnings; +use File::Find; +use Fcntl ':mode'; + +my $debug = 0; + +my $SRC = "../linux"; +my $fname = "$SRC/drivers/media/dvb/frontends/Makefile"; + +#################### +# Get Makefile rules +# +sub get_makefile($) +{ + my $file = shift; + my %rules; + my %composite; + + open IN, $file or die "Can't find $file\n"; + while () { + # Handle line continuations + if (/\\\n$/) { + $_ .= ; + redo; + } + # Eat line continuations in string we will parse + s/\s*\\\n\s*/ /g; + + if (m/(^\s*[[\da-zA-Z-_]+)-objs\s*[\:\+]*\=\s*(.*)\n/) { + my $dep=$1; + my $file = $2; + $file =~ s/\.o / /g; + $file =~ s/\.o$//; + + if ($file eq "") { + die "broken dep on file $file for $dep\n"; + } + + $composite{$dep} = $file; + printf "MULTI: $dep = $file\n" if ($debug > 1); + } + + if (m/^\s*obj\-\$\(CONFIG_([^\)]+)\)\s*[\:\+]*\=\s*(.*)\n/) { + my $rule = $1; + my $file = $2; + + $file =~ s/\.o / /g; + $file =~ s/\.o$//; + + $rules{$rule} = $file; + printf "RULE: $rule = $file\n" if ($debug > 1); + } + } + close IN; + + return (\%rules, \%composite); +} + +########################### +# Seeks header dependencies +# +my %header_deps; + +# For a more complete check, use: +# my $hfiles = "*.c"; +my $hfiles = "av7110_av.c av7110.c av7110_ca.c av7110_hw.c av7110_ipack.c av7110_ir.c av7110_v4l.c budget-patch.c dvb_ringbuffer.c nova-t-usb2.c umt-010.c"; + +sub get_header_deps() +{ + my $file = shift; + my %rules; + my %composite; + + open IN, "gcc -I ../linux/include -I . -DCONFIG_PCI -D__LITTLE_ENDIAN -D_COMPAT_H -DKERNEL_VERSION\\(a,b,c\\) -MM $hfiles|"; + while () { + # Handle line continuations + if (/\\\n$/) { + $_ .= ; + redo; + } + # Eat line continuations in string we will parse + s/\s*\\\n\s*/ /g; + + if (m/^([^\:]+)\s*\:\s*(.*)/) { + my $dep = $1; + my $file = $2; + + $dep =~ s|.*/||; + $dep =~ s/\.o$//; + + my @files = split(/\s/, $file); + foreach my $f (@files) { + $f =~ s|.*/||; + + if (!defined($header_deps{$f})) { + $header_deps{$f} = $dep; + } else { + $header_deps{$f} .= " " . $dep; + } + + } + } + } + close IN; + + if ($debug > 1) { + print "Header deps for: "; + print "$_ " foreach %header_deps; + print "\n"; + } + +print "Header deps for av7110.h: "; +print "$_ " foreach $header_deps{"av7110.h"}; +print "\n"; +} + + +########################### +# Seeks files for Makefiles +# + +my %driver_config; + +sub parse_makefiles() +{ + my $fname = $File::Find::name; + + return if !($fname =~ m|/Makefile$|); + return if ($fname =~ m|drivers/media/dvb/frontends/|); + + + my ($refs, $mult) = get_makefile($fname); + + foreach my $ref (keys %$refs) { + my $file=$$refs{$ref}; + + my @files = split(/\s/, $file); + foreach my $f (@files) { + if (defined($$mult{$f})) { + $file .= " " . $$mult{$f}; + } + } + + $file =~ s|/||g; + + @files = split(/\s/, $file); + foreach my $f (@files) { + $driver_config{$f} = $ref; + } + if ($debug > 1) { + print "$ref = "; + print "$_ " foreach @files; + print "\n"; + } + } +} + + +######################## +# Seeks files for header +# +sub found_ref($$) +{ + my $file = shift; + my $header = shift; + my $found = 0; + my $name = $file; + $name =~ s|.*/||; + + $name =~ s/flexcop-fe-tuner.c/b2c2-flexcop/; + $name =~ s/av7110.c/av7110/; + + if (defined ($header_deps{$name})) { + $name = $header_deps{$name}; + } else { + $name =~ s/\.[ch]$//; + } + + my @files = split(/\s/, $name); + foreach my $n (@files) { + if (defined($driver_config{$n})) { + my $ref = $driver_config{$n}; + printf "$ref needs %s\n", $header; + $found = 1; + } + } + + if (!$found) { + printf "$file needs %s\n", $header; + } +} + +######################## +# Seeks files for header +# + +my %header; + +sub parse_headers() +{ + my $file = $File::Find::name; + + return if !($file =~ m/\.[ch]$/); + return if ($file =~ m|drivers/media/dvb/frontends/|); + + open IN, $file or die "Can't open $file\n"; + while () { + if (m/^\s*\#include\s+\"([^\"]+)\"/) { + if (defined($header{$1})) { + my $head = $header{$1}; + found_ref ($file, $head); + } + } + } + close IN; +} + +##### +#main + +get_header_deps(); + +my ($FEs, $mult) = get_makefile($fname); + +foreach my $fe (keys %$FEs) { + my $file=$$FEs{$fe}; + my $found = 0; + + # Special cases + $file =~ s/tda10021/tda1002x/; + $file =~ s/tda10023/tda1002x/; + $file =~ s/dib3000mb/dib3000/; + + if (defined($$mult{$file})) { + $file .= " ".$$mult{$file}; + } + + my @files = split(/\s/, $file); + foreach my $f (@files) { + if (stat("$f.h")) { + printf "$fe = $f.h\n" if ($debug); + $found = 1; + $header {"$f.h"} = $fe; + last; + } + } + + if (!$found) { + printf "$file.h ($fe) not found in $file\n"; + exit -1; + } +} + +find({wanted => \&parse_makefiles, no_chdir => 1}, $SRC); +find({wanted => \&parse_headers, no_chdir => 1}, $SRC); -- cgit v1.2.3 From fc6175ddf0ccad7f5281c08b4981e8a5f26b11f7 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 8 Mar 2009 13:10:43 -0300 Subject: Improve script to automatically adjust the Kconfig files From: Mauro Carvalho Chehab There are still some more hacking to do, in order to use this automatically, since more logic is needed for dibcom and av7110 stuff. Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/fix_dvb_customise.pl | 89 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 83 insertions(+), 6 deletions(-) (limited to 'v4l') diff --git a/v4l/scripts/fix_dvb_customise.pl b/v4l/scripts/fix_dvb_customise.pl index c4c9c14bd..86a6bcf8c 100755 --- a/v4l/scripts/fix_dvb_customise.pl +++ b/v4l/scripts/fix_dvb_customise.pl @@ -110,10 +110,6 @@ sub get_header_deps() print "$_ " foreach %header_deps; print "\n"; } - -print "Header deps for av7110.h: "; -print "$_ " foreach $header_deps{"av7110.h"}; -print "\n"; } @@ -161,6 +157,8 @@ sub parse_makefiles() ######################## # Seeks files for header # +my %select; + sub found_ref($$) { my $file = shift; @@ -170,7 +168,7 @@ sub found_ref($$) $name =~ s|.*/||; $name =~ s/flexcop-fe-tuner.c/b2c2-flexcop/; - $name =~ s/av7110.c/av7110/; + $name =~ s/av7110.c/av7110.h/; if (defined ($header_deps{$name})) { $name = $header_deps{$name}; @@ -182,7 +180,17 @@ sub found_ref($$) foreach my $n (@files) { if (defined($driver_config{$n})) { my $ref = $driver_config{$n}; - printf "$ref needs %s\n", $header; + printf "$ref needs %s\n", $header if ($debug); + + if ($ref =~ m/(PVRUSB2|CX23885|CX88|EM28XX|SAA3134)/) { + $ref .="_DVB"; + } + + if (!defined($select{$ref})) { + $select{$ref} = $header; + } else { + $select{$ref} .= " " . $header; + } $found = 1; } } @@ -217,6 +225,74 @@ sub parse_headers() close IN; } +######################## +# Rewrite Kconfig's +# + +sub parse_kconfigs() +{ + my $file = $File::Find::name; + my $conf; + my $out = ""; + my $tmp = ""; + my $all_sels; + + return if !($file =~ m/Kconfig$/); + return if ($file =~ m|drivers/media/dvb/frontends/|); + + open IN, $file or die "Can't open $file\n"; + while () { + if (m/^config\s([A-Za-z_\-\d]+)/) { + $out .= $tmp; + if (defined($select{$1})) { + $conf = $select{$1}; + $all_sels = " ". $conf. " "; + $tmp = $_; + + printf "$file: rewriting headers for $1. It should select: %s\n", $all_sels if ($debug); + } else { + $conf = ""; + $out .= $_; + $tmp = ""; + } + next; + } + if (!$conf) { + $out .= $_; + next; + } + + if (m/^\s*select\s+([A-Za-z_\-\d]+)/) { + my $op = $1; + + if (!$all_sels =~ m/\s($op)\s/) { + # Drops line + printf "$file: droppingg line $_\n"; + + next; + } else { + $all_sels =~ s/\s($op)\s/ /; + } + } + if (m/^[\s\-]*help/) { + my @sel = split(/\s/, $all_sels); + foreach my $s (@sel) { + if ($s ne "") { + printf "$file: Adding select for $s\n"; + $tmp .= "\tselect $s if !DVB_FE_CUSTOMISE\n"; + } + } + } + $tmp .= $_; + } + close IN; + + $out .=$tmp; + open OUT, ">$file" or die "Can't open $file\n"; + print OUT $out; + close OUT; +} + ##### #main @@ -255,3 +331,4 @@ foreach my $fe (keys %$FEs) { find({wanted => \&parse_makefiles, no_chdir => 1}, $SRC); find({wanted => \&parse_headers, no_chdir => 1}, $SRC); +find({wanted => \&parse_kconfigs, no_chdir => 1}, $SRC); -- cgit v1.2.3 From a6d47ce7fbcc080d77c8f2032febc2a39aca13fa Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Thu, 5 Mar 2009 02:52:00 -0800 Subject: compat: Add INIT_DELAYED_WORK From: Trent Piepho Turn it into INIT_WORK for pre 2.6.20. Priority: normal Signed-off-by: Trent Piepho --- v4l/compat.h | 1 + 1 file changed, 1 insertion(+) (limited to 'v4l') diff --git a/v4l/compat.h b/v4l/compat.h index 3df844c87..44878ce73 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -11,6 +11,7 @@ * delayed_work in the same context as something named work_struct. */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) #define delayed_work work_struct +#define INIT_DELAYED_WORK(a,b,c) INIT_WORK(a,b,c) #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) -- cgit v1.2.3 From 2b325438911b426807991cb0cbe94fa3c30d087c Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Fri, 6 Mar 2009 13:29:09 +0100 Subject: tvmixer: remove last remaining references to this deleted module. From: Hans Verkuil Priority: normal Signed-off-by: Hans Verkuil --- v4l/scripts/release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'v4l') diff --git a/v4l/scripts/release.sh b/v4l/scripts/release.sh index 5055675d6..19916545c 100755 --- a/v4l/scripts/release.sh +++ b/v4l/scripts/release.sh @@ -14,7 +14,7 @@ files_common="$files_v4l $files_tuner $files_i2c doc" # other files files_ir="ir-common.[ch]" -files_audio="msp3400.[ch] tvaudio.[ch] tvmixer.[ch]" +files_audio="msp3400.[ch] tvaudio.[ch]" files_bttv="bt848.h btcx*.[ch] bttv*.[ch] ir-kbd*.c" files_saa="saa7134*.[ch] saa6752hs.[ch] ir-kbd-i2c.c" -- cgit v1.2.3 From eb8b7bf49ccc32d335f2b934431aeb5fc24220c2 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Fri, 6 Mar 2009 17:43:12 +0100 Subject: v4l/compat.h: add clamp_val From: Hans Verkuil Priority: normal Signed-off-by: Hans Verkuil --- v4l/compat.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'v4l') diff --git a/v4l/compat.h b/v4l/compat.h index 3df844c87..16ff90bc4 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -238,6 +238,12 @@ static inline int list_is_singular(const struct list_head *head) min_t( __typeof__( x ), \ ( h ), \ ( x ) ) ) +#define clamp_val(val, min, max) ({ \ + typeof(val) __val = (val); \ + typeof(val) __min = (min); \ + typeof(val) __max = (max); \ + __val = __val < __min ? __min : __val; \ + __val > __max ? __max : __val; }) #endif #ifdef NEED_ALGO_CONTROL -- cgit v1.2.3 From 40cc0407e9304bb9c4c9ea77dc05093a34e9bb55 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 8 Mar 2009 14:30:54 -0300 Subject: Kconfig workaround: enable FE_CUSTOMISE by default From: Mauro Carvalho Chehab Priority: normal Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/make_kconfig.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'v4l') diff --git a/v4l/scripts/make_kconfig.pl b/v4l/scripts/make_kconfig.pl index 144325c34..a09c72fb3 100755 --- a/v4l/scripts/make_kconfig.pl +++ b/v4l/scripts/make_kconfig.pl @@ -585,7 +585,7 @@ close OUT; # These options should default to off disable_config('DVB_AV7110_FIRMWARE'); disable_config('DVB_CINERGYT2_TUNING'); -disable_config('DVB_FE_CUSTOMISE'); +#disable_config('DVB_FE_CUSTOMISE'); disable_config('VIDEO_HELPER_CHIPS_AUTO'); disable_config('VIDEO_FIXED_MINOR_RANGES'); -- cgit v1.2.3 From 1bd1aedc7af71728404f5d7b059dd8ca52d01f9f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 8 Mar 2009 14:39:42 -0300 Subject: get rid of disabling DVB_FE_CUSTOMISE on kconfig From: Mauro Carvalho Chehab Since make allmodconfig enables all DVB options, DVB_FE_CUSTOMISE is needed, otherwise the building system gots confused. Priority: normal Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/make_kconfig.pl | 1 - 1 file changed, 1 deletion(-) (limited to 'v4l') diff --git a/v4l/scripts/make_kconfig.pl b/v4l/scripts/make_kconfig.pl index a09c72fb3..57c663c00 100755 --- a/v4l/scripts/make_kconfig.pl +++ b/v4l/scripts/make_kconfig.pl @@ -585,7 +585,6 @@ close OUT; # These options should default to off disable_config('DVB_AV7110_FIRMWARE'); disable_config('DVB_CINERGYT2_TUNING'); -#disable_config('DVB_FE_CUSTOMISE'); disable_config('VIDEO_HELPER_CHIPS_AUTO'); disable_config('VIDEO_FIXED_MINOR_RANGES'); -- cgit v1.2.3 From 9cdf820ab3b93d84c0cce39e8748aaeee12a7327 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Tue, 10 Mar 2009 19:28:15 -0700 Subject: build: Clean up FM801-TEA575x Kconfig From: Trent Piepho Some extra config symbols for the tea575x module keep it from working correctly with menuconfig. Priority: normal Signed-off-by: Trent Piepho --- v4l/Kconfig.sound | 9 --------- 1 file changed, 9 deletions(-) (limited to 'v4l') diff --git a/v4l/Kconfig.sound b/v4l/Kconfig.sound index 55be75cce..67430b792 100644 --- a/v4l/Kconfig.sound +++ b/v4l/Kconfig.sound @@ -25,18 +25,9 @@ config SND_BT87X_OVERCLOCK Higher sample rates won't hurt your hardware, but audio quality may suffer. -config SND_FM801 - tristate - depends on SND && SND_OPL3_LIB && SND_MPU401_UART && SND_AC97_CODEC - -config SND_FM801_TEA575X_BOOL - bool - depends on SND_FM801 - config SND_FM801_TEA575X tristate "ForteMedia FM801 TEA5757 tuner" depends on VIDEO_V4L1 && SND_FM801 - select SND_FM801_TEA575X_BOOL help Say Y here to include support for soundcards based on the ForteMedia -- cgit v1.2.3 From 883dc7792c9ded24211969d851819da1b01aaca3 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 12 Mar 2009 07:04:17 -0300 Subject: Don't print errors for version checks, since we allow such checks at the out-of-tree buildings From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/check.pl | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'v4l') diff --git a/v4l/scripts/check.pl b/v4l/scripts/check.pl index 4958e281b..975041c4a 100755 --- a/v4l/scripts/check.pl +++ b/v4l/scripts/check.pl @@ -87,6 +87,10 @@ $pwd =~ s|/[^/]+\n$||; sub print_err() { + if ($err =~ m/LINUX_VERSION_CODE/) { + return; + } + if ($err) { printf STDERR "%s/%s: In '%s':\n", $pwd, $file, $errline; printf STDERR "%s/%s:%d: %s\n", $pwd, $file, $ln_numb, $err; -- cgit v1.2.3 From 2c99696068282097371bbe8e41ab91f9ca04ecd6 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 12 Mar 2009 22:37:15 +0100 Subject: cx231xx: prevent building it on kernels < 2.6.23. From: Hans Verkuil Priority: normal Signed-off-by: Hans Verkuil --- v4l/versions.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'v4l') diff --git a/v4l/versions.txt b/v4l/versions.txt index 369cbb15d..b4869a157 100644 --- a/v4l/versions.txt +++ b/v4l/versions.txt @@ -20,6 +20,10 @@ SOC_CAMERA SOC_CAMERA_MT9V022 SOC_CAMERA_MT9M001 +[2.6.23] +# Needs field intf_assoc in struct usb_host_config +VIDEO_CX231XX + [2.6.22] #This driver requires I2C probe/remove fields VIDEO_TCM825X -- cgit v1.2.3 From 043985e41c1b3527cb1574753b3fd71c707a3d39 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Fri, 13 Mar 2009 03:59:20 -0700 Subject: build: have make_kconfig.pl ignore comments From: Trent Piepho It was already ignoring lines that had only comments. But lines with some non-comment code and then a comment at the end didn't have the comment stripped. Some modules had incorrect dependencies added because comments at the end of a "depends on" line were treated as modules names. I strip the comments from the string that is parsed by the script, but preserve the original line so it can be printed out with the comment still in it when making v4l/Kconfig. Priority: normal Signed-off-by: Trent Piepho --- v4l/scripts/make_kconfig.pl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'v4l') diff --git a/v4l/scripts/make_kconfig.pl b/v4l/scripts/make_kconfig.pl index 57c663c00..8683ee4d8 100755 --- a/v4l/scripts/make_kconfig.pl +++ b/v4l/scripts/make_kconfig.pl @@ -277,11 +277,13 @@ sub open_kconfig($$) { my $in_help = 0; my $default_seen = 0; my $if; + my $line; print "Opening $file\n" if $debug; open $in, '<', $file or die "File not found: $file"; push @kconfigfiles, $file; while (<$in>) { + $line = $_; # In our Kconfig files, the first non-help line after the # help text always has no indention. Technically, the # help text is ended by just by the indention decreasing, @@ -303,7 +305,7 @@ sub open_kconfig($$) { print OUT "\tdefault n\n"; } print OUT "\tdepends on VIDEO_KERNEL_VERSION\n"; - $_ = sprintf($disabled_msg, $minver{$key}); + $line = sprintf($disabled_msg, $minver{$key}); } next; } @@ -319,10 +321,13 @@ sub open_kconfig($$) { } next if (/^\s*#/ || /^\s*$/); # skip comments and blank lines + # Erase any comments on this line + s/(?