summaryrefslogtreecommitdiff
path: root/v4l
diff options
context:
space:
mode:
Diffstat (limited to 'v4l')
-rw-r--r--v4l/Makefile7
-rw-r--r--v4l/compat.h19
-rw-r--r--v4l/firmware/Makefile76
-rwxr-xr-xv4l/scripts/make_config_compat.pl68
4 files changed, 129 insertions, 41 deletions
diff --git a/v4l/Makefile b/v4l/Makefile
index a5201f31b..dc0cfcaa6 100644
--- a/v4l/Makefile
+++ b/v4l/Makefile
@@ -39,13 +39,14 @@ endif # TOPDIR
#################################################
# default compilation rule
-default:: config-compat.h Makefile.media links oss
+default:: config-compat.h Makefile.media links oss firmware
@echo Kernel build directory is $(OUTDIR)
$(MAKE) -C $(OUTDIR) SUBDIRS=$(PWD) $(MYCFLAGS) modules
./scripts/rmmod.pl check
# $(MAKE) checkpatch
firmware::
+ $(MAKE) -C firmware prep
$(MAKE) -C firmware
v4l2-spec::
@@ -212,7 +213,7 @@ all:: default
#################################################
# installation invocation rules
-install:: media-install
+install:: media-install firmware_install
remove rminstall:: media-rminstall
@@ -301,7 +302,7 @@ distclean:: clean
-rm -f .version .*.o.flags .*.o.d Makefile.media \
Kconfig Kconfig.kern .config .config.cmd .myconfig \
.kconfig.dep
- -rm -rf .tmp_versions
+ -rm -rf .tmp_versions .tmp*.ver .tmp*.o
-rm -f scripts/lxdialog scripts/kconfig oss
@find .. -name '*.orig' -exec rm '{}' \;
@find .. -name '*.rej' -exec rm '{}' \;
diff --git a/v4l/compat.h b/v4l/compat.h
index 8e778d7f5..d8bd6debe 100644
--- a/v4l/compat.h
+++ b/v4l/compat.h
@@ -36,6 +36,10 @@
#include <sound/driver.h>
#endif
+#ifdef NEED_SND_CARD_CREATE
+#include <sound/core.h>
+#endif
+
#ifdef NEED_ALGO_CONTROL
#include <linux/i2c.h>
#endif
@@ -423,7 +427,7 @@ static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
pci_resource_len(pdev, bar))
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
+#ifdef NEED_POLL_SCHEDULE
#define poll_schedule(pwq, task) \
do { \
set_current_state(task); \
@@ -432,4 +436,17 @@ static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
} while (0)
#endif
+#ifdef NEED_SND_CARD_CREATE
+static inline int snd_card_create(int idx, const char *id,
+ struct module *module, int extra_size,
+ struct snd_card **card)
+{
+ *card = snd_card_new(idx, id, module, extra_size);
+
+ if (*card == NULL)
+ return -ENOMEM;
+ return 0;
+}
#endif
+
+#endif /* _COMPAT_H */
diff --git a/v4l/firmware/Makefile b/v4l/firmware/Makefile
index 272b2e668..c8b0e0578 100644
--- a/v4l/firmware/Makefile
+++ b/v4l/firmware/Makefile
@@ -1,44 +1,66 @@
-DIRS = vicam dabusb ttusb-budget cpia2
-
-TARGETS = ihex2fw vicam/firmware.fw dabusb/firmware.fw dabusb/bitstream.bin ttusb-budget/dspbootcode.bin cpia2/stv0672_vp4.bin
+TARGETS = vicam/firmware.fw dabusb/firmware.fw dabusb/bitstream.bin ttusb-budget/dspbootcode.bin cpia2/stv0672_vp4.bin av7110/bootcode.bin
+FW_DIR = /lib/firmware
####
+DIRS = $(sort $(dir $(TARGETS)))
+
+.PHONY = default clean distclean install rminstall prep
+
default: $(TARGETS)
+$(TARGETS):: ihex2fw
+
clean:
+ -rm -f ihex2fw
-rm -f $(TARGETS)
distclean: clean
- -for i in $(DIRS); do if [ -d $$i ]; then rmdir $$i; fi; done
+ -for i in $(DIRS); do if [ -d $$i ]; then rm -rf $$i; fi; done
+
install: default
- -for i in $(DIRS); do if [ ! -d /lib/firmware/$$i ]; then mkdir -p /lib/firmware/$$i; fi; done
- -for i in $(TARGETS); do cp $$i /lib/firmware/$$i; done
+ @echo -n "Installing firmwares at $(FW_DIR): "
+ -@for i in $(DIRS); do if [ ! -d $(FW_DIR)/$$i ]; then mkdir -p $(FW_DIR)/$$i; fi; done
+ -@for i in $(TARGETS); do echo -n "$$i "; cp $$i $(FW_DIR)/$$i; done
+ @echo
+rminstall:
+ @echo "Removing firmwares at $(FW_DIR) "
+ -for i in $(DIRS); do if [ -d $(FW_DIR)/$$i ]; then rm -rf $(FW_DIR)/$$i; fi; done
######
-mkdir:
- -for i in $(DIRS); do if [ ! -d $$i ]; then mkdir -p $$i; fi; done
-
-
ihex2fw: ../../linux/firmware/ihex2fw.c
- gcc -Wall -o $@ $<
-
-vicam/firmware.fw: ../../linux/firmware/vicam/firmware.H16 mkdir
- ./ihex2fw -w $< $@
-
-dabusb/firmware.fw: ../../linux/firmware/dabusb/firmware.HEX mkdir
- ./ihex2fw $< $@
-
-ttusb-budget/dspbootcode.bin: ../../linux/firmware/ttusb-budget/dspbootcode.bin.ihex mkdir
- objcopy -Iihex -Obinary $< $@
-
-
-dabusb/bitstream.bin: ../../linux/firmware/dabusb/bitstream.bin.ihex mkdir
- objcopy -Iihex -Obinary $< $@
-
-cpia2/stv0672_vp4.bin: ../../linux/firmware/cpia2/stv0672_vp4.bin.ihex mkdir
- objcopy -Iihex -Obinary $< $@
+ @echo " CC $@"
+ @gcc -Wall -o $@ $<
+
+prep:
+ @for i in $(DIRS); do \
+ if [ ! -d $$i ]; then mkdir -p $$i; fi; \
+ for j in ../../linux/firmware/$$i/*; do \
+ n=`echo $$j | sed s,../../linux/firmware/,,`; \
+ if [ ! -e $$n ]; then \
+ ln -f $$j $$n; \
+ fi; \
+ done; done
+
+%.fw: %.H16
+ @echo Generating $@
+ @./ihex2fw -w $< $@
+
+%.fw: %.HEX
+ @echo Generating $@
+ @./ihex2fw $< $@
+
+%.bin: %.bin.ihex
+ @echo Generating $@
+ @objcopy -Iihex -Obinary $< $@
+
+# TODO: Use the Firmware Kconfig dependencies
+#fw-$(CONFIG_USB_VICAM) += vicam/firmware.fw
+#fw-$(CONFIG_USB_DABUSB) += dabusb/firmware.fw dabusb/bitstream.bin
+#fw-$(CONFIG_DVB_TTUSB_BUDGET) += ttusb-budget/dspbootcode.bin
+#fw-$(CONFIG_VIDEO_CPIA2) += cpia2/stv0672_vp4.bin
+#fw-$(CONFIG_DVB_AV7110) += av7110/bootcode.bin
diff --git a/v4l/scripts/make_config_compat.pl b/v4l/scripts/make_config_compat.pl
index 423dcff77..3c2b623ca 100755
--- a/v4l/scripts/make_config_compat.pl
+++ b/v4l/scripts/make_config_compat.pl
@@ -218,40 +218,86 @@ sub check_net_dev()
sub check_usb_endpoint_type()
{
- my $file = "$kdir/include/linux/usb.h";
+ my $nfiles = 0;
+ my @files = ( "$kdir/include/linux/usb.h", "$kdir/include/linux/usb/ch9.h" );
+
+ foreach my $file ( @files ) {
+ open IN, "<$file" or next;
+ $nfiles++;
+ while (<IN>) {
+ if (m/usb_endpoint_type/) {
+ close IN;
+ # definition found. No need for compat
+ return;
+ }
+ }
+ close IN;
+ }
+
+ die "Usb headers not found" if (!$nfiles);
+
+ # definition not found. This means that we need compat
+ $out.= "\n#define NEED_USB_ENDPOINT_TYPE 1\n";
+}
+
+sub check_pci_ioremap_bar()
+{
+ my $file = "$kdir/include/linux/pci.h";
my $need_compat = 1;
open INNET, "<$file" or die "File not found: $file";
while (<INNET>) {
- if (m/usb_endpoint_type/) {
+ if (m/pci_ioremap_bar/) {
$need_compat = 0;
last;
}
}
if ($need_compat) {
- $out.= "\n#define NEED_USB_ENDPOINT_TYPE 1\n";
+ $out.= "\n#define NEED_PCI_IOREMAP_BAR 1\n";
}
close INNET;
}
-sub check_pci_ioremap_bar()
+sub check_snd_card_create()
{
- my $file = "$kdir/include/linux/pci.h";
+ my $file = "$kdir/include/sound/core.h";
my $need_compat = 1;
- open INNET, "<$file" or die "File not found: $file";
- while (<INNET>) {
- if (m/pci_ioremap_bar/) {
+ open IN, "<$file" or die "File not found: $file";
+ while (<IN>) {
+ if (m/snd_card_create/) {
$need_compat = 0;
last;
}
}
if ($need_compat) {
- $out.= "\n#define NEED_PCI_IOREMAP_BAR 1\n";
+ $out.= "\n#define NEED_SND_CARD_CREATE\n";
}
- close INNET;
+ close IN;
+}
+
+sub check_poll_schedule()
+{
+
+
+ my @files = ( "$kdir//include/linux/poll.h" );
+
+ foreach my $file ( @files ) {
+ open IN, "<$file" or die "File not found: $file";
+ while (<IN>) {
+ if (m/poll_schedule/) {
+ close IN;
+ # definition found. No need for compat
+ return;
+ }
+ }
+ close IN;
+ }
+
+ # definition not found. This means that we need compat
+ $out.= "\n#define NEED_POLL_SCHEDULE 1\n";
}
sub check_other_dependencies()
@@ -269,6 +315,8 @@ sub check_other_dependencies()
check_net_dev();
check_usb_endpoint_type();
check_pci_ioremap_bar();
+ check_snd_card_create();
+ check_poll_schedule();
}
# Do the basic rules