Initial version of the new building system

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Mauro Carvalho Chehab
2010-10-17 12:00:40 -02:00
commit 5012d58a62
65 changed files with 17871 additions and 0 deletions

142
INSTALL Normal file
View File

@@ -0,0 +1,142 @@
Mauro Carvalho Chehab 2006 Apr 26
V4L/DVB building procedures are based at the use of Makefile rules.
Those rules are close to the ones at Linux Kernel, to allow an easier
usage.
=======================================================================
Quick building procedure is:
make all
======================================================================
For those who may want more than just build all stuff there are some
other interesting parameters to make:
======================
Normal building rules:
all - build all modules
clean - Cleans compiled files from the tree,
but keeping the latest
used configuration and kernel version
distclean - Cleans compiled files from the tree,
latest used configuration and kernel
version.
default - Continues building the latest module selection
This is the behavior when just typed:
make
install - Installs all modules at kernel's default dir
for V4L/DVB. Requires root access.
man_install - Install V4L2 API man pages.
rminstall - cleans previous installations of V4L/DVB modules
sound-install - installs the sound modules related to V4L/DVB
tree.
======================
Firmware rules:
firmware - Create the firmware files that are enclosed at the
tree.
Notice: Only a very few firmwares are currently here
firmware_install- Install firmware files under /lib/firmware
======================
Documentation rules:
spec - Creates both V4L and DVB API specification
man - Creates V4L2 API man pages
=======================
Module selection rules:
(Those may require write access to kernel tree)
allmodconfig - Called by make all. Selects all modules that are known
to compile against the kernel version used.
xconfig - Generate a xconfig menu. Requires full
kernel source, since it depends on kernel's
qconf stript;
gconfig - Generate a qt menu. Requires full
kernel source, since it depends on kernel's
gconf stript;
config - Generate a text-mode menu. Requires full
kernel source, since it depends on kernel's
conf stript;
menuconfig - Generate a ncurses menu. Requires full
kernel source, since it depends on kernel's
mconf and lxconfig stripts;
release - Allows changing kernel version.
Typical usage is:
make release VER=2.6.12-18mdk
(to force compiling to 2.6.12-18mdk)
(This will work only if
/lib/modules/2.6.12-18mdk/build/
points to that kernel version)
Or
make release DIR=~/linux-git
(to force using kernel at a specific dir)
To use current kernel version instead:
make release
======================
Module handling rules:
(require root access)
insmod - inserts all modules from V4L/DVB tree
rmmod - removes all modules from V4L/DVB tree
reload - removes then reinserts all modules
===================
Tree merging rules:
ivtv - enable merged ivtv build, using the latest ivtv sources
from ivtvdriver.org (requires subversion)
cx88-ivtv - enable cx88-blackbird ivtv API emulation
ivtv-update - update ivtv sources from ivtvdriver.org
==========================================
Patch preparation and tree handling rules:
(used by developers)
kernel-links - Generate links to V4L/DVB at kernel tree.
Requires write access to kernel tree.
cardlist - Updates Documentation/video4linux/CARDLIST.*
update - updates the tree from master repository
commit - commits the change, asking for a commit msg
push - sends outgoing stuff to master repository
checkemacs - checks codingstyle and reports to emacs
using "make checkemacs" at emacs compile menu,
will report the lines with errors inside emacs.
checkpatch - checks codingstyle and reports using the same
format as c. This way, c error parsers will
handle it.
checkterse - checks codingstyle and reports using terse
syntax, used on several compilaton tools.
mismatch - checks for linker section mismatch. In other words,
check if some driver has functions not properly
declared with __init/__exit, and similar tags.
It will also be more pedantic by dealing with
compilation warnings as if they are errors.

51
Makefile Normal file
View File

@@ -0,0 +1,51 @@
BUILD_DIR := $(shell pwd)/v4l
TMP ?= /tmp
REPO_PULL := http://linuxtv.org/hg/v4l-dvb
ifeq ($(EDITOR),)
ifeq ($(VISUAL),)
EDITOR := vi
else
EDITOR := $(VISUAL) -w
endif
endif
all:
install:
$(MAKE) -C $(BUILD_DIR) install
# Hmm, .PHONY does not work with wildcard rules :-(
SPECS = media-specs
.PHONY: $(SPECS)
$(SPECS):
$(MAKE) -C $(BUILD_DIR) $(MAKECMDGOALS)
%::
$(MAKE) -C $(BUILD_DIR) $(MAKECMDGOALS)
commit cvscommit hgcommit change changes changelog:: whitespace
@cd $(BUILD_DIR); scripts/cardlist; scripts/do_commit.sh $(EDITOR) $(TMP)/v4l_hg_whitespace; cd ..
qrefresh: Q=q
qrefresh:: whitespace
cd $(BUILD_DIR); scripts/cardlist; cd ..
v4l/scripts/prep_commit_msg.pl -q $(TMP)/v4l_hg_whitespace > \
$(TMP)/v4l_hg_commit.msg
$(EDITOR) $(TMP)/v4l_hg_commit.msg
grep -v '^#' $(TMP)/v4l_hg_commit.msg | hg qrefresh -g -l -
pull update v4l-update::
@echo "Pulling changes from master repository $(REPO_PULL)"
-hg pull -u $(REPO_PULL)
push::
@echo "Pushing changes to master repository"
-hg push
whitespace whitespaces:
@echo "Cleaning bad whitespaces"
@v4l/scripts/strip-trailing-whitespaces.sh $(Q)fast | \
tee $(TMP)/v4l_hg_whitespace | patch -p0

1273
README Normal file

File diff suppressed because it is too large Load Diff

82
linux/Makefile Normal file
View File

@@ -0,0 +1,82 @@
#
# Files that need to be bundled with the building system
#
# Media drivers
TARFILES += "drivers/media/"
TARFILES += "drivers/staging/cx25821/"
TARFILES += "drivers/staging/go7007/"
TARFILES += "drivers/staging/tm6000/"
TARFILES += "sound/pci/bt87x.c"
TARFILES += "sound/i2c/other/tea575x-tuner.c"
# Includes
TARFILES += "include/media/"
TARFILES += "include/linux/dvb/"
TARFILES += "include/linux/usb/video.h"
TARFILES += "include/linux/i2c-id.h"
TARFILES += "include/linux/videodev.h"
TARFILES += "include/linux/videotext.h"
TARFILES += "include/linux/video_decoder.h"
TARFILES += "include/linux/ivtv.h"
TARFILES += "include/linux/mmc/sdio_ids.h"
TARFILES += "include/linux/ivtvfb.h"
TARFILES += "include/linux/videodev2.h"
TARFILES += "include/linux/meye.h"
TARFILES += "include/sound/tea575x-tuner.h"
TARFILES += "include/sound/aci.h"
TARFILES += "include/asm-arm/arch-pxa/camera.h"
TARFILES += "include/asm-arm/arch-pxa/pxa-regs.h"
TARFILES += "arch/arm/plat-mxc/include/mach/mx1_camera.h"
TARFILES += "arch/arm/plat-mxc/include/mach/mx3_camera.h"
TARFILES += "arch/arm/plat-mxc/include/mach/memory.h"
# Documentation
TARFILES += "Documentation/dvb/"
TARFILES += "Documentation/video4linux/"
TARFILES += "Documentation/DocBook/dvb/"
TARFILES += "Documentation/DocBook/v4l/"
TARFILES += "Documentation/DocBook/media.tmpl"
TARFILES += "Documentation/DocBook/media-entities.tmpl"
TARFILES += "Documentation/DocBook/media-indices.tmpl"
TARFILES += "Documentation/DocBook/Makefile"
# Firmware
TARFILES += "firmware/av7110/bootcode.bin.ihex"
TARFILES += "firmware/av7110/Boot.S"
TARFILES += "firmware/cpia2/stv0672_vp4.bin.ihex"
TARFILES += "firmware/ihex2fw.c"
TARFILES += "firmware/vicam/firmware.H16"
TARFILES += "firmware/dabusb/bitstream.bin.ihex"
TARFILES += "firmware/dabusb/firmware.HEX"
TARFILES += "firmware/ttusb-budget/dspbootcode.bin.ihex"
## Miscelaneous arch-dependent drivers required for compilation
## Probably, we can just get rid of them
#TARFILES += "arch/arm/mach-mx3/clock.c"
#TARFILES += "arch/arm/mach-pxa/pcm990-baseboard.c"
#TARFILES += "arch/arm/mach-pxa/devices.c"
#TARFILES += "arch/arm/mach-mx1/devices.c"
#TARFILES += "arch/arm/mach-mx1/mx1_camera_fiq.S"
#TARFILES += "arch/arm/mach-mx1/ksym_mx1.c"
#TARFILES += "arch/arm/mach-mx1/Makefile"
#TARFILES += "arch/sh/boards/mach-kfr2r09/setup.c"
#TARFILES += "arch/sh/boards/mach-migor/setup.c"
#TARFILES += "arch/sh/boards/mach-ap325rxa/setup.c"
default: help
help:
@echo " Use: make DIR=<directory>"
ifeq ($(DIR),)
tar:
@echo " Use: make DIR=<directory>"
@exit -1
else
tar:
tar cvfj $(PWD)/linux-media.tar.bz2 -C $(DIR) $(TARFILES)
endif
untar:
tar xvfj $(PWD)/linux-media.tar.bz2

4929
v4l/Kconfig Normal file

File diff suppressed because it is too large Load Diff

315
v4l/Kconfig.kern Normal file
View File

@@ -0,0 +1,315 @@
# Needed by RADIO_MIROPCM20
config SND_MIRO
tristate
default n
# Needed by VIDEO_GO7007, SMS_SIANO_MDTV, USB_PWC_INPUT_EVDEV, DVB_USB, VIDEO_CX18, VIDEO_CX88, VIDEO_CX25821, VIDEO_CX231XX, IR_CORE, VIDEO_CX23885, VIDEO_EM28XX, DVB_DM1105, VIDEO_BT848, VIDEO_TLG2300, VIDEO_SAA7134, DVB_BUDGET_CI, MANTIS_CORE, VIDEO_IVTV, VIDEO_AU0828, DVB_TTUSB_DEC, VIDEO_TM6000, USB_VIDEO_CLASS_INPUT_EVDEV
config INPUT
tristate
default y
# Needed by IR_MCEUSB, USB_DSBR, USB_ZR364XX, DVB_USB, VIDEO_PVRUSB2_DVB, VIDEO_CPIA_USB, USB_GSPCA_OV534, USB_STKWEBCAM, USB_PWC, USB_DABUSB, VIDEO_EM28XX, USB_GSPCA_SN9C2028, USB_VICAM, USB_GL860, VIDEO_USBVISION, VIDEO_CX231XX_ALSA, USB_GSPCA_T613, VIDEO_GO7007_USB, USB_GSPCA_STK014, USB_GSPCA_SPCA506, USB_SI470X, USB_GSPCA_PAC207, DVB_TTUSB_DEC, USB_GSPCA_OV534_9, USB_GSPCA_SN9C20X, SMS_USB_DRV, USB_GSPCA_SPCA561, USB_STV06XX, USB_GSPCA_SPCA501, USB_GSPCA_SQ930X, USB_GSPCA_SPCA508, USB_GSPCA_ETOMS, USB_GSPCA_SPCA505, USB_GSPCA_STV0680, VIDEO_CX231XX, USB_GSPCA_PAC7311, USB_GSPCA_FINEPIX, USB_GSPCA_CPIA1, USB_GSPCA_SQ905C, VIDEO_CX231XX_DVB, IR_IMON, USB_GSPCA, USB_MR800, USB_GSPCA_SPCA1528, USB_GSPCA_VC032X, VIDEO_EM28XX_ALSA, USB_M5602, VIDEO_USBVIDEO, VIDEO_PVRUSB2_DEBUGIFC, USB_VIDEO_CLASS, USB_GSPCA_SONIXJ, USB_GSPCA_MR97310A, VIDEO_TLG2300, USB_GSPCA_TV8532, DVB_B2C2_FLEXCOP_USB, USB_GSPCA_SQ905, USB_IBMCAM, VIDEO_PVRUSB2_SYSFS, USB_GSPCA_SUNPLUS, DVB_TTUSB_BUDGET, USB_PWC_INPUT_EVDEV, USB_SN9C102, VIDEO_EM28XX_DVB, USB_GSPCA_MARS, USB_GSPCA_CONEX, USB_GSPCA_BENQ, USB_ET61X251, VIDEO_TM6000_DVB, VIDEO_CPIA2, VIDEO_HDPVR, USB_S2255, USB_KONICAWC, USB_SE401, USB_GSPCA_PAC7302, USB_GSPCA_OV519, VIDEO_PVRUSB2, USB_GSPCA_JEILINJ, USB_PWC_DEBUG, USB_GSPCA_SPCA500, VIDEO_AU0828, VIDEO_TM6000, USB_GSPCA_SONIXB, USB_VIDEO_CLASS_INPUT_EVDEV, V4L_USB_DRIVERS, USB_GSPCA_ZC3XX
config USB
tristate
default y
# Needed by VIDEO_ISIF
config ARCH_DAVINCI_DM365
tristate
default n
# Needed by VIDEO_SAA7164
config FW_LOADER
tristate
default y
# Needed by VIDEO_VIVI
config SPARC64
tristate
default n
# Needed by VIDEO_M32R_AR_M64278
config PLAT_M32700UT
tristate
default n
# Needed by SND_FM801_TEA575X
config SND_FM801
tristate
default n
# Needed by VIDEO_FB_IVTV
config FB_CFB_IMAGEBLIT
tristate
default y
# Needed by SOC_CAMERA_MT9M001, SOC_CAMERA_MT9V022
config GPIO_PCA953X
tristate
default n
# Needed by VIDEO_SH_MOBILE_CEU
config HAVE_CLK
tristate
default n
# Needed by VIDEO_MX1
config FIQ
tristate
default n
# Needed by VIDEO_OMAP2_VOUT
config OMAP2_DSS
tristate
default n
# Needed by VIDEO_GO7007, VIDEO_CX231XX_ALSA, VIDEO_SAA7134_ALSA, VIDEO_TM6000_ALSA, VIDEO_TLG2300, VIDEO_CX88_ALSA, RADIO_MIROPCM20, VIDEO_EM28XX_ALSA, SND_BT87X, VIDEO_CX18_ALSA, VIDEO_CX25821_ALSA
config SND
tristate
default m
# Needed by SOC_CAMERA_MT9M001
config MT9M001_PCA9536_SWITCH
tristate
default n
# Needed by VIDEO_OMAP2
config ARCH_OMAP2
tristate
default n
# Needed by VIDEO_VIVI
config FONT_8x16
tristate
default y
# Needed by VIDEO_VIVI
config SPARC32
tristate
default n
# Needed by VIDEO_BT848, DVB_PLUTO2, VIDEO_ZORAN, VIDEO_CX18, VIDEO_CX88, VIDEO_IVTV, VIDEO_AU0828, VIDEO_CX25821, VIDEO_CX23885, VIDEO_SAA7164
config I2C_ALGOBIT
tristate
default m
# Needed by RADIO_MIROPCM20
config SND_ISA
tristate
default n
# Needed by DVB_CORE
config INET
tristate
default y
# Needed by VIDEO_VPFE_CAPTURE
config ARCH_OMAP3
tristate
default n
# Needed by VIDEO_GO7007, DVB_CORE, DVB_TTUSB_DEC, VIDEO_SAA7134
config CRC32
tristate
default y
# Needed by VIDEO_PVRUSB2_SYSFS
config SYSFS
tristate
default y
# Needed by SMS_SDIO_DRV
config MMC
tristate
default m
# Needed by RADIO_RTRACK2, RADIO_AZTECH, RADIO_TERRATEC, RADIO_SF16FMR2, RADIO_RTRACK, RADIO_MIROPCM20, RADIO_CADET, VIDEO_PMS, RADIO_TRUST, RADIO_SF16FMI, RADIO_ZOLTRIX, RADIO_GEMTEK, RADIO_TYPHOON
config ISA
tristate
default n
# Needed by VIDEO_GO7007, SND_BT87X, VIDEO_CX25821, DVB_PT1, VIDEO_CX23885, DVB_DM1105, VIDEO_HEXIUM_ORION, VIDEO_MEYE, DVB_NGENE, DVB_MANTIS, DVB_BUDGET_CORE, DVB_PLUTO2, VIDEO_HEXIUM_GEMINI, VIDEO_STRADIS, MANTIS_CORE, RADIO_GEMTEK_PCI, VIDEO_IVTV, DVB_HOPPER, DVB_TTUSB_DEC, RADIO_MAXIRADIO, DVB_TTUSB_BUDGET, DVB_AV7110, DVB_BT8XX, VIDEO_CX18, VIDEO_MXB, VIDEO_CX88, VIDEO_SAA7146, RADIO_MAESTRO, VIDEO_BTCX, VIDEO_SAA7164, DVB_B2C2_FLEXCOP_PCI, VIDEO_BT848, VIDEO_SAA7134, VIDEO_CAFE_CCIC, VIDEO_ZORAN
config PCI
tristate
default y
# Needed by VIDEO_OMAP2_VOUT
config OMAP2_VRFB
tristate
default n
# Needed by VIDEO_OMAP2_VOUT
config OMAP2_VRAM
tristate
default n
# Needed by VIDEO_W9966, VIDEO_CPIA_PP
config PARPORT_1284
tristate
default y
# Needed by VIDEO_FB_IVTV
config FB_CFB_FILLRECT
tristate
default y
# Needed by SOC_CAMERA_MT9V022
config MT9V022_PCA9536_SWITCH
tristate
default n
# Needed by VIDEO_ZORAN, VIDEO_STRADIS
config VIRT_TO_BUS
tristate
default y
# Needed by VIDEO_W9966, VIDEO_BWQCAM, VIDEO_CPIA_PP, VIDEO_CQCAM
config PARPORT
tristate
default m
# Needed by DVB_FIREDTV
config FIREWIRE
tristate
default m
# Needed by VIDEO_VIVI
config FRAMEBUFFER_CONSOLE
tristate
default y
# Needed by DVB_CORE
config NET
tristate
default y
# Needed by VIDEO_VPFE_CAPTURE, VIDEO_VPSS_SYSTEM
config ARCH_DAVINCI
tristate
default n
# Needed by VIDEO_FB_IVTV
config FB_CFB_COPYAREA
tristate
default y
# Needed by VIDEO_PXA27x
config PXA27x
tristate
default n
# Needed by VIDEO_VINO
config SGI_IP22
tristate
default n
# Needed by VIDEO_OMAP2_VOUT
config ARCH_OMAP34XX
tristate
default n
# Needed by VIDEO_GO7007, DVB_AF9013, VIDEO_SAA711X, MEDIA_TUNER_TDA18271, DVB_MT312, DVB_CX24116, DVB_USB, VIDEO_EM28XX, DVB_S5H1420, DVB_CX22700, SOC_CAMERA, VIDEO_USBVISION, VIDEO_BT866, VIDEO_V4L2_COMMON, DVB_NGENE, DVB_SP8870, DVB_BUDGET_AV, MEDIA_TUNER, DVB_TUNER_DIB0070, VIDEO_VPX3220, MEDIA_TUNER_TDA827X, DVB_OR51132, VIDEO_TDA9875, SOC_CAMERA_RJ54N1, VIDEO_SAA7110, DVB_LGDT3305, DVB_STV6110x, DVB_BT8XX, VIDEO_SAA7127, MEDIA_TUNER_MT2060, VIDEO_CX231XX, VIDEO_UPD64083, VIDEO_WM8739, VIDEO_SAA7164, DVB_AU8522, DVB_CX22702, DVB_ISL6423, DVB_B2C2_FLEXCOP_PCI, VIDEO_BT848, I2C_SI4713, DVB_BUDGET_PATCH, VIDEO_CS53L32A, SOC_CAMERA_MT9V022, SOC_CAMERA_MT9T031, DVB_ISL6405, VIDEO_ADV7343, DVB_ZL10353, DVB_CX24110, MEDIA_TUNER_XC2028, DVB_DIB7000M, VIDEO_BT856, VIDEO_ADV7175, DVB_DIB3000MC, DVB_PT1, MEDIA_TUNER_MC44S803, DVB_DRX397XD, DVB_TDA8261, DVB_MANTIS, DVB_BUDGET_CORE, DVB_TDA8083, VIDEO_VP27SMPX, VIDEO_CX25840, DVB_B2C2_FLEXCOP_USB, VIDEO_IVTV, DVB_HOPPER, VIDEO_TVP5150, VIDEO_SAA5246A, MEDIA_TUNER_SIMPLE, RADIO_SI4713, VIDEO_TEA6415C, DVB_TUNER_CX24113, DVB_OR51211, DVB_STB6100, DVB_AV7110, SOC_CAMERA_MT9M111, VIDEO_OV7670, DVB_STV0299, SOC_CAMERA_OV772X, VIDEO_CX88, MEDIA_TUNER_QT1010, DVB_S5H1411, VIDEO_TCM825X, DVB_PLL, DVB_LGDT330X, VIDEO_PVRUSB2, DVB_MB86A16, VIDEO_SAA7134, DVB_STB0899, VIDEO_TVP514X, DVB_TUA6100, VIDEO_CAFE_CCIC, VIDEO_MT9V011, DVB_LNBP21, DVB_B2C2_FLEXCOP, TTPCI_EEPROM, VIDEO_TM6000, VIDEO_THS7303, DVB_NXT200X, MEDIA_TUNER_TDA8290, VIDEO_SAA7185, VIDEO_TEA6420, DVB_STV0297, VIDEO_KS0127, VIDEO_TVP7002, DVB_VES1820, VIDEO_SAA717X, RADIO_TEA5764, MEDIA_TUNER_MT20XX, VIDEO_CX23885, DVB_BUDGET, DVB_VES1X93, DVB_DM1105, VIDEO_CS5345, VIDEO_TVEEPROM, DVB_ATBM8830, VIDEO_HEXIUM_GEMINI, DVB_ISL6421, I2C_SI470X, DVB_TDA10021, MEDIA_TUNER_TDA9887, DVB_NXT6000, VIDEO_SAA7191, RADIO_TIMBERDALE, MEDIA_TUNER_XC5000, SOC_CAMERA_MT9T112, DVB_TDA10048, MEDIA_TUNER_MXL5005S, MEDIA_TUNER_TEA5761, VIDEO_TDA7432, VIDEO_BT819, DVB_EC100, MEDIA_TUNER_MT2266, VIDEO_ADV7180, VIDEO_CX18, DVB_TDA1004X, VIDEO_MXB, VIDEO_SAA7146, DVB_TUNER_ITD1000, DVB_STV6110, VIDEO_ADV7170, DVB_S921, VIDEO_TDA9840, DVB_CX24123, DVB_TDA10023, DVB_S5H1409, DVB_TUNER_DIB0090, VIDEO_IR_I2C, MEDIA_TUNER_MAX2165, MEDIA_TUNER_MT2131, VIDEO_CX25821, DVB_STV0288, VIDEO_HEXIUM_ORION, VIDEO_SAA6588, VIDEO_M52790, SOC_CAMERA_OV9640, DVB_DS3000, VIDEO_UPD64031A, VIDEO_TVAUDIO, MEDIA_TUNER_TEA5767, VIDEO_TLG2300, DVB_L64781, DVB_PLUTO2, DVB_LGDT3304, DVB_STB6000, DVB_TDA665x, RADIO_SAA7706H, DVB_BUDGET_CI, DVB_MT352, MANTIS_CORE, VIDEO_MSP3400, DVB_DIB8000, DVB_TDA826X, SOC_CAMERA_TW9910, DVB_TDA10086, DVB_TTUSB_BUDGET, VIDEO_WM8775, VIDEO_TLV320AIC23B, MEDIA_TUNER_MXL5007T, VIDEO_VINO, DVB_SP887X, DVB_DIB7000P, SOC_CAMERA_MT9M001, VIDEO_AK881X, DVB_DIB3000MB, DVB_LGS8GXX, DVB_LGS8GL5, DVB_SI21XX, DVB_ZL10036, DVB_BCM3510, DVB_STV0900, VIDEO_SAA5249, DVB_ZL10039, RADIO_TEF6862, VIDEO_AU0828, DVB_STV090x
config I2C
tristate
default m
# Needed by VIDEO_DM355_CCDC
config ARCH_DAVINCI_DM355
tristate
default n
# Needed by MEDIA_ATTACH, always
config MODULES
tristate
default y
# Needed by MEDIA_SUPPORT
config HAS_IOMEM
tristate
default y
# Needed by DISPLAY_DAVINCI_DM646X_EVM, CAPTURE_DAVINCI_DM646X_EVM
config MACH_DAVINCI_DM6467_EVM
tristate
default n
# Needed by RADIO_TIMBERDALE
config MFD_TIMBERDALE
tristate
default n
# Needed by VIDEO_OMAP2_VOUT
config ARCH_OMAP24XX
tristate
default n
# Needed by VIDEO_SH_MOBILE_CEU, VIDEOBUF_DMA_SG, SMS_SIANO_MDTV, SOC_CAMERA, VIDEOBUF_DMA_CONTIG
config HAS_DMA
tristate
default y
# Needed by VIDEO_FB_IVTV
config FB
tristate
default y
# Needed by VIDEO_VIVI
config STI_CONSOLE
tristate
default n
# Needed by VIDEO_MX1
config ARCH_MX1
tristate
default n
# Needed by VIDEO_MEYE
config SONY_LAPTOP
tristate
default m
# Needed by IR_MCEUSB, IR_IMON
config USB_ARCH_HAS_HCD
tristate
default y
# Needed by VIDEO_MX3
config MX3_IPU
tristate
default n
# Needed by VIDEO_GO7007, VIDEO_CX231XX_ALSA, VIDEO_SAA7134_ALSA, VIDEO_TM6000_ALSA, VIDEO_TLG2300, VIDEO_CX88_ALSA, VIDEO_EM28XX_ALSA, SND_BT87X, VIDEO_CX18_ALSA, VIDEO_CX25821_ALSA
config SND_PCM
tristate
default m
# Needed by VIDEO_VIVI
config FONTS
tristate
default n
# Needed by VIDEO_SH_VOU
config ARCH_SHMOBILE
tristate
default n
# Needed by VIDEO_TM6000_ALSA, DVB_USB_EC168, VIDEO_TLV320AIC23B, VIDEO_CX88_ALSA, VIDEO_VINO, MEDIA_TUNER_TEA5761, VIDEO_PVRUSB2_DVB, VIDEO_CX18, DVB_USB_AF9005, VIDEO_TM6000_DVB, USB_STKWEBCAM, USB_VICAM, VIDEO_CQCAM, DVB_USB_CE6230, VIDEO_STRADIS, VIDEO_ZORAN_AVS6EYES, VIDEO_PVRUSB2_SYSFS, VIDEO_CX18_ALSA, VIDEO_TM6000, VIDEO_CX25821_ALSA
config EXPERIMENTAL
tristate
default y
# Needed by VIDEO_M32R_AR
config M32R
tristate
default n
# Needed by DVB_FIREDTV
config IEEE1394
tristate
default n
# Needed by IR_NEC_DECODER, IR_RC5_DECODER
config BITREVERSE
tristate
default y

39
v4l/Kconfig.sound Normal file
View File

@@ -0,0 +1,39 @@
menu "Audio devices for multimedia"
# This is part of sound/pci/Kconfig
comment "ALSA sound"
config SND_BT87X
tristate "Bt87x Audio Capture"
depends on SND && PCI
select SND_PCM
help
If you want to record audio from TV cards based on
Brooktree Bt878/Bt879 chips, say Y here and read
<Documentation/sound/alsa/Bt87x.txt>.
To compile this driver as a module, choose M here: the module
will be called snd-bt87x.
config SND_BT87X_OVERCLOCK
bool "Bt87x Audio overclocking"
depends on SND_BT87X
help
Say Y here if 448000 Hz isn't enough for you and you want to
record from the analog input with up to 1792000 Hz.
Higher sample rates won't hurt your hardware, but audio
quality may suffer.
config SND_FM801_TEA575X
tristate "ForteMedia FM801 TEA5757 tuner"
depends on VIDEO_V4L1 && SND_FM801
help
Say Y here to include support for soundcards based on the ForteMedia
FM801 chip with a TEA5757 tuner connected to GPIO1-3 pins (Media
Forte SF256-PCS-02) into the snd-fm801 driver.
This will enable support for the old V4L1 API.
endmenu

44
v4l/Kconfig.staging Normal file
View File

@@ -0,0 +1,44 @@
menuconfig STAGING
bool "Staging drivers"
default n
---help---
This option allows you to select a number of drivers that are
not of the "normal" Linux kernel quality level. These drivers
are placed here in order to get a wider audience for use of
them. Please note that these drivers are under heavy
development, may or may not work, and may contain userspace
interfaces that most likely will be changed in the near
future.
Using any of these drivers will taint your kernel which might
affect support options from both the community, and various
commercial support orginizations.
If you wish to work on these drivers, to help improve them, or
to report problems you have with them, please see the
driver_name.README file in the drivers/staging/ directory to
see what needs to be worked on, and who to contact.
If in doubt, say N here.
if STAGING
menu "Media devices in staging"
config STAGING_BROKEN
bool "Enable drivers that are known to not compile"
default n
--- help ---
Say N here, except if you will be fixing the drivers
compilation.
source "../linux/drivers/staging/go7007/Kconfig"
source "../linux/drivers/staging/cx25821/Kconfig"
source "../linux/drivers/staging/tm6000/Kconfig"
# Currently, there are no broken staging drivers with Kernel 2.6.31
# if STAGING_BROKEN
# endif
endmenu
endif # STAGING

465
v4l/Makefile Normal file
View File

@@ -0,0 +1,465 @@
ifeq ($(obj),)
obj = .
endif
#################################################
# This Makefile is used from two contexts. It is used directly when one runs
# 'make' from the v4l-dvb tree. It used used again when the kernel build
# process includes this file into the kernel Makefile.
ifneq ($(TOPDIR),)
# We are being include from the Kernel
-include $(TOPDIR)/Rules.make
else
# We are running directly, not from the Kernel
# take version info from last module build if available
# if .version doesn't exist, make will create it for us and restart
-include $(obj)/.version
ifneq ($(SRCDIR),)
OUTDIR ?= $(SRCDIR)
endif
OUTDIR ?= /lib/modules/$(KERNELRELEASE)/build
SRCDIR ?= /lib/modules/$(KERNELRELEASE)/source
ifeq ($(wildcard $(SRCDIR)/Makefile),)
# No kernel source, but headers should be in OUTDIR
SRCDIR := $(OUTDIR)
endif
ifneq ($(origin KDIR), undefined)
ifneq ($(KDIR),$(SRCDIR))
KERNELRELEASE :=
override DIR := $(KDIR)
.PHONY: $(obj)/.version
endif
endif
endif # TOPDIR
#################################################
# default compilation rule
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
mismatch:: config-compat.h Makefile.media links oss firmware
@echo Kernel build directory is $(OUTDIR)
$(MAKE) -Wfatal-errors -C $(OUTDIR) SUBDIRS=$(PWD) $(MYCFLAGS) CONFIG_DEBUG_SECTION_MISMATCH=y modules
./scripts/rmmod.pl check
firmware::
$(MAKE) -C firmware prep
$(MAKE) -C firmware
man::
$(MAKE) -C ../media-specs man
spec::
$(MAKE) -C ../media-specs
#################################################
# Object specific rules
# Targets which don't need Makefile.media's rules
no-makefile-media-targets := %config clean distclean snapshot snap \
tarball release %links start insmod load stop rmmod unload reload \
card% update push %commit help debug cx88-ivtv lxdialog
# Targets which don't need .myconfig to exist, to keep us from including it
no-dot-config-targets := $(no-makefile-media-targets) %install remove
dot-config := 1
ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
dot-config := 0
endif
endif
makefile-media := 1
ifneq ($(filter $(no-makefile-media-targets), $(MAKECMDGOALS)),)
ifeq ($(filter-out $(no-makefile-media-targets), $(MAKECMDGOALS)),)
makefile-media := 0
endif
endif
# If version not yet detected, we can't create/have these files yet
ifeq ($(KERNELRELEASE),)
makefile-media := 0
dot-config := 0
endif
ifeq ($(dot-config),1)
-include $(obj)/.myconfig
endif
ifeq ($(makefile-media),1)
-include $(obj)/Makefile.media
-include $(obj)/Makefile.sound
endif
-include $(obj)/.kconfig.dep
# make will try to automatically rebuild the Makefile and all includes,
# and if any of them change, make will start over with the updated files
$(obj)/.myconfig: $(obj)/.config $(obj)/Kconfig
./scripts/make_myconfig.pl
# If it doesn't exist, this rule will build Makefile.media. If it does
# exist, it will have dependency information in it, and only be rebuilt
# when necessary.
Makefile.media:
scripts/make_makefile.pl
#################################################
# CFLAGS configuration
ifeq ($(CONFIG_DVB_FIRESAT),m)
EXTRA_CFLAGS += -I$(srctree)/drivers/ieee1394/
endif
EXTRA_CFLAGS += -g
EXTRA_CFLAGS += $(if $(wildcard $(srctree)/.mm), -DMM_KERNEL)
# Make sure kernel's options are overridden by v4l-dvb options
EXTRA_CFLAGS += -include $(obj)/config-compat.h
# Allow kernel version compat tests without adding #include's
EXTRA_CFLAGS += -include include/linux/version.h
#################################################
# Kernel 2.4/2.6 specific rules
ifneq ($(KERNELRELEASE),)
ifeq ($(VERSION).$(PATCHLEVEL),2.6)
export-objs :=
list-multi :=
else
include $(obj)/Makefile.kern24
multi-m := $(filter $(list-multi), $(obj-m))
int-m := $(sort $(foreach m, $(multi-m), $($(basename $(m))-objs)))
export-objs := $(filter $(int-m) $(obj-m),$(export-objs))
endif
endif
#################################################
# Directories to be used
snapshot := $(wildcard $(obj)/.snapshot)
ifneq ($(snapshot),)
SNAPSHOT_CFLAGS := -DSNAPSHOT='$(shell cat $(snapshot))'
EXTRA_CFLAGS += $(SNAPSHOT_CFLAGS)
endif
PWD := $(shell pwd)
DEST := /lib/modules/$(KERNELRELEASE)/v4l2
KDIR26 := /lib/modules/$(KERNELRELEASE)/kernel/drivers/media
#################################################
# Compiler fixup rules
HOSTCC:=$(CC)
CC += -I$(obj)
ifeq ($(VERSION).$(PATCHLEVEL),2.6)
CPPFLAGS := -I$(SUBDIRS)/../linux/include $(CPPFLAGS) -I$(SUBDIRS)/
# Needed for kernel 2.6.24 or up
KBUILD_CPPFLAGS := -I$(SUBDIRS)/../linux/include $(KBUILD_CPPFLAGS) -I$(SUBDIRS)/
# Needed for kernel 2.6.29 or up
LINUXINCLUDE := -I$(SUBDIRS)/../linux/include $(LINUXINCLUDE) -I$(SUBDIRS)/
MYCFLAGS :=
else
MYCFLAGS := CFLAGS="-I../linux/include -D__KERNEL__ -I$(KDIR)/include -DEXPORT_SYMTAB"
endif
#################################################
# which files to install?
inst-m := $(wildcard *.ko)
ifeq ($(inst-m),)
inst-m := $(obj-m)
endif
v4l_modules := $(shell /sbin/lsmod|cut -d' ' -f1 ) $(patsubst %.ko,%,$(inst-m))
#################################################
# locales seem to cause trouble sometimes.
LC_ALL = POSIX
export LC_ALL
#################################################
# Generic wildcard rules
%.asm: %.o
objdump -S $< > $@
#################################################
# all file compilation rule
all:: default
#################################################
# installation invocation rules
install:: media-install firmware_install
remove rminstall:: media-rminstall
firmware_install::
make -C firmware install
man_install::
$(MAKE) -C ../media-specs man_install
#################################################
# Compiling preparation rules
.PHONY: release
ifneq ($(filter release,$(MAKECMDGOALS)),)
.PHONY: $(obj)/.version
endif
release:
@true
$(obj)/.version:
ifneq ($(DIR),)
@echo "Searching in $(DIR)/Makefile for kernel version."
@perl \
-e '$$d="$(DIR)"; ' \
-e 'S: open IN,"$$d/Makefile"; ' \
-e 'while (<IN>) {' \
-e ' if (/^VERSION\s*=\s*(\d+)/){ $$version=$$1; }' \
-e ' elsif (/^PATCHLEVEL\s*=\s*(\d+)/){ $$level=$$1; }' \
-e ' elsif (/^SUBLEVEL\s*=\s*(\d+)/){ $$sublevel=$$1; }' \
-e ' elsif (/^EXTRAVERSION\s*=\s*(\S+)\n/){ $$extra=$$1; }' \
-e ' elsif (/^KERNELSRC\s*:=\s*(\S.*)\n/ || /^MAKEARGS\s*:=\s*-C\s*(\S.*)\n/)' \
-e ' { $$o=$$d; $$d=$$1; goto S; }' \
-e '};' \
-e 'printf ("VERSION=%s\nPATCHLEVEL:=%s\nSUBLEVEL:=%s\nKERNELRELEASE:=%s.%s.%s%s\n",' \
-e ' $$version,$$level,$$sublevel,$$version,$$level,$$sublevel,$$extra);' \
-e 'print "OUTDIR:=$$o\n" if($$o);' \
-e 'print "SRCDIR:=$$d\n";' > $(obj)/.version
@cat .version|grep KERNELRELEASE:|sed s,'KERNELRELEASE:=','Forcing compiling to version ',
@if [ ! -f $(DIR)/scripts/kallsyms ]; then \
echo "*** Warning: You should configure and build kernel before compiling V4L"; \
fi
else
ifneq ($(VER),)
@echo "Forcing kernel version to $(VER)."
@echo $(VER)|perl -ne 'if (/^([0-9]*)\.([0-9])*\.([0-9]*)(.*)$$/) { printf ("VERSION=%s\nPATCHLEVEL:=%s\nSUBLEVEL:=%s\nKERNELRELEASE:=%s.%s.%s%s\n",$$1,$$2,$$3,$$1,$$2,$$3,$$4); };' > $(obj)/.version
else
@echo No version yet, using `uname -r`
@uname -r|perl -ne 'if (/^([0-9]*)\.([0-9])*\.([0-9]*)(.*)$$/) { printf ("VERSION=%s\nPATCHLEVEL:=%s\nSUBLEVEL:=%s\nKERNELRELEASE:=%s.%s.%s%s\n",$$1,$$2,$$3,$$1,$$2,$$3,$$4); };' > $(obj)/.version
endif
endif
links::
@echo creating symbolic links...
@find ../linux/drivers/media -name '*.[ch]' -type f -print0 | xargs -0n 255 ln -sf --target-directory=.
@find ../linux/sound -name '*.[ch]' -type f -print0 | xargs -0n 255 ln -sf --target-directory=.
@find ../linux/drivers/staging -name '*.[ch]' -type f -print0 | xargs -0n 255 ln -sf --target-directory=.
# This link is so code with #include "oss/*.h" will find its header files
oss:
ln -sf . oss
config-compat.h:: $(obj)/.version .myconfig scripts/make_config_compat.pl
perl scripts/make_config_compat.pl $(SRCDIR) $(obj)/.myconfig $(obj)/config-compat.h
kernel-links makelinks::
cd ..; v4l/scripts/makelinks.sh $(SRCDIR)
#################################################
# Cardlist updating rule
card cardlist cardlists::
scripts/cardlist
#################################################
# Cleaning rules
clean::
@find . -name '*.c' -type l -exec rm '{}' \;
@find . -name '*.h' -type l -exec rm '{}' \;
-rm -f *~ *.o *.ko .*.o.cmd .*.ko.cmd *.mod.c av7110_firm.h fdump \
config-compat.h Module.symvers Module.markers modules.order
$(MAKE) -C firmware $@
$(MAKE) -C ../media-specs $@
distclean:: clean
-rm -f .version .*.o.flags .*.o.d Makefile.media \
Kconfig Kconfig.kern .config .config.cmd .myconfig \
.kconfig.dep
-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 '{}' \;
$(MAKE) -C firmware $@
$(MAKE) -C ../media-specs $@
#################################################
# Kernel module insert/removal rules
start insmod load::
scripts/rmmod.pl load
stop rmmod unload::
scripts/rmmod.pl unload
reload::
scripts/rmmod.pl reload
debug::
scripts/rmmod.pl debug
#################################################
# Configuration rules
# Kernel config programs
QCONF := $(OUTDIR)/scripts/kconfig/qconf
GCONF := $(OUTDIR)/scripts/kconfig/gconf
MCONF := $(OUTDIR)/scripts/kconfig/mconf
CONF := $(OUTDIR)/scripts/kconfig/conf
# lxdialog can be in either scripts/lxdialog or scripts/kconfig/lxdialog
LXDIALOG_DIR := $(shell if [ -d $(OUTDIR)/scripts/kconfig/lxdialog ]; then echo kconfig/ ; fi)
# lxdialog might not be a separate program that needs to be built, check
# for lxdialog/Makefile to find out.
ifneq ($(wildcard $(SRCDIR)/scripts/$(LXDIALOG_DIR)lxdialog/Makefile),)
# lxdialog must be built
LXDIALOG_LNK := $(if $(LXDIALOG_DIR),scripts/kconfig,scripts/lxdialog)
LXDIALOG := $(OUTDIR)/scripts/$(LXDIALOG_DIR)lxdialog/lxdialog
endif
# Ideally, some kind of oldconfig process would be used to update .config
# without destroying the user's configuration. Lacking that, we will
# just touch .config if it already exists, and run make_kconfig if it
# doesn't.
$(obj)/.config: $(obj)/.version
@echo Updating/Creating .config
@if [ -e $(obj)/.config ]; then touch $(obj)/.config ; else \
./scripts/make_kconfig.pl $(OUTDIR) $(SRCDIR); fi
$(obj)/Kconfig: $(obj)/.version
./scripts/make_kconfig.pl $(OUTDIR) $(SRCDIR)
# With make -j, it's possible that both the .config and Kconfig rules
# will run at the same time, running make_kconfig.pl twice. There
# doesn't appear to be any way around this, but it doesn't cause a
# failure. One make_kconfig.pl will just overwrite the other's output.
xconfig:: $(QCONF) $(obj)/Kconfig
$(QCONF) $(obj)/Kconfig
./scripts/fix_kconfig.pl
gconfig:: $(GCONF) $(obj)/Kconfig
$(GCONF) $(obj)/Kconfig
./scripts/fix_kconfig.pl
config:: $(CONF) $(obj)/Kconfig
$(CONF) $(obj)/Kconfig
./scripts/fix_kconfig.pl
menuconfig:: $(MCONF) lxdialog $(obj)/Kconfig
$(MCONF) $(obj)/Kconfig
./scripts/fix_kconfig.pl
allyesconfig allmodconfig:: $(obj)/.version
./scripts/make_kconfig.pl $(OUTDIR) $(SRCDIR) 1
./scripts/fix_kconfig.pl
# rule to build kernel conf programs
KMAKEVARS := config-targets=1 mixed-targets=0 dot-config=0 SRCDIR=$(SRCDIR)
$(QCONF) $(GCONF) $(MCONF) $(CONF):
$(MAKE) -C $(OUTDIR) -f $(PWD)/Makefile.kernel $(KMAKEVARS) v4l-$(notdir $@)
# lxdialog has two parts, a symlink and the actual binary
.PHONY: lxdialog
lxdialog: $(LXDIALOG) $(LXDIALOG_LNK)
ifdef LXDIALOG
$(LXDIALOG_LNK):
ln -snf $(OUTDIR)/$(LXDIALOG_LNK) $(LXDIALOG_LNK)
$(LXDIALOG):
$(MAKE) -C $(SRCDIR) -f $(PWD)/Makefile.kernel $(KMAKEVARS) v4l-$(LXDIALOG)
endif
cx88-ivtv::
@echo creating cx88-ivtv symbolic links...
@ln -sf ../v4l_experimental/cx88-ivtv.c .
#################################################
# Old instalation rule
old-install:: rminstall
@echo -e "\nInstalling new V4L modules at $(DEST)..."
@strip --strip-debug $(inst-m)
-install -d $(DEST)
-install -m 644 -c $(inst-m) $(DEST)
/sbin/depmod -a ${KERNELRELEASE}
#################################################
# Tree management rules
update::
make -C .. update
commit cvscommit hgcommit::
make -C .. commit
push::
make -C .. push
#################################################
# Consistency checks
checkemacs::
scripts/check.pl
checketerse::
scripts/check.pl -t
checkpatch::
scripts/check.pl -c
#################################################
# Help
help::
@cat ../INSTALL
#################################################
# build tarballs rules
RPWD := $(shell cd .. && pwd)
thisdir := $(notdir $(RPWD))
name := v4l-dvb
date := $(shell date +%Y%m%d)
tardest ?= .
snapdir := $(HOME)/snapshot
snap := $(name)
snapshot snap tarball:: update distclean
echo $(thisdir)
echo $(name)
echo $(date) > .snapshot
(cd ..; tar czf $(snapdir)/$(snap)-$(date).tar.gz .)
hg history --style scripts/map-changelog > /$(snapdir)/$(snap)-ChangeLog-$(date)
$(MAKE) -C $(snapdir)

28
v4l/Makefile.kern24 Normal file
View File

@@ -0,0 +1,28 @@
#
# Need to compile with kernel 2.4
#
bttv.o: $(bttv-objs)
$(LD) -r -o $@ $(bttv-objs)
cx25840.o: $(cx25840-objs)
$(LD) -g -r -o $@ $(cx25840-objs)
cx8800.o: $(cx8800-objs)
$(LD) -g -r -o $@ $(cx8800-objs)
cx8802.o: $(cx8802-objs)
$(LD) -g -r -o $@ $(cx8802-objs)
cx88xx.o: $(cx88xx-objs)
$(LD) -g -r -o $@ $(cx88xx-objs)
em28xx.o: $(em28xx-objs)
$(LD) -g -r -o $@ $(em28xx-objs)
saa7134.o: $(saa7134-objs)
$(LD) -g -r -o $@ $(saa7134-objs)
tuner.o: $(tuner-objs)
$(LD) -g -r -o $@ $(tuner-objs)

47
v4l/Makefile.kernel Normal file
View File

@@ -0,0 +1,47 @@
# This Makefile is used to build sources that are part of the kernel tree.
# What we want are the various programs used by the kconfig system. We can't
# just directly call the top-level kernel Makefile, as it doesn't provide
# targets to only build the kconfig system. It provides targets to build
# the kconfig system *and then configure the kernel*.
# What we do is include the top-level kernel Makefile here, to get all the
# variables and rules it defines, and then add our own targets to just build
# the kconfig system. You can think of this file as a modified version of the
# top-level kernel Makefile that has "kconfig build only" targets added to it.
# Each of these new targets has the prefix v4l- so it doesn't conflict with
# any targets in the kernel Makefile.
# Like the kernel Makefile, this Makefile should have the cwd be the root
# of the kernel source.
# These should be defined on the command line, to override the kernel Makefile
# config-targets := 1
# mixed-targets := 0
# dot-config := 0
KBUILD_SRC := $(SRCDIR)
include $(SRCDIR)/Makefile
# Used by the config target
v4l-conf: scripts_basic
$(MAKE) $(build)=scripts/kconfig scripts/kconfig/conf
# Used by the xconfig target
v4l-qconf: scripts_basic
$(MAKE) $(build)=scripts/kconfig qconf-target=1 scripts/kconfig/qconf
# Used by the qconfig target
v4l-gconf: scripts_basic
$(MAKE) $(build)=scripts/kconfig gconf-target=1 scripts/kconfig/gconf
# Used by the menuconfig target, also needs lxdialog
v4l-mconf: scripts_basic
$(MAKE) $(build)=scripts/kconfig hostprogs-y=mconf scripts/kconfig/mconf
# Rule used for kernel where lxdialog is in directory scripts/lxdialog
v4l-%/scripts/lxdialog/lxdialog: scripts_basic
$(MAKE) $(build)=scripts/lxdialog
# Rule used for kernel where lxdialog is in directory scripts/kconfig/lxdialog
v4l-%/scripts/kconfig/lxdialog/lxdialog: scripts_basic
$(MAKE) $(build)=scripts/kconfig/lxdialog

1358
v4l/Makefile.media Normal file

File diff suppressed because one or more lines are too long

26
v4l/Makefile.sound Normal file
View File

@@ -0,0 +1,26 @@
# From sound/pci/Makefile
snd-bt87x-objs := bt87x.o
obj-$(CONFIG_SND_BT87X) += snd-bt87x.o
# From sound/i2c/other/Makefile
snd-tea575x-tuner-objs := tea575x-tuner.o
obj-$(CONFIG_SND_FM801_TEA575X) += snd-tea575x-tuner.o
KDIRA := /lib/modules/$(KERNELRELEASE)/kernel
sound-install install-sound::
@dir="sound/pci"; \
files='snd-bt87x.ko'; \
echo -e "\nInstalling $(KDIRA)/$$dir files:"; \
install -d $(KDIRA)/$$dir; \
for i in $$files;do if [ -e $$i ]; then echo -n "$$i "; \
install -m 644 -c $$i $(KDIRA)/$$dir; fi; done; echo;
@dir="sound/i2c/other"; \
files='snd-tea575x-tuner.ko'; \
echo -e "\nInstalling $(KDIRA)/$$dir files:"; \
install -d $(KDIRA)/$$dir; \
for i in $$files;do if [ -e $$i ]; then echo -n "$$i "; \
install -m 644 -c $$i $(KDIRA)/$$dir; fi; done; echo;

656
v4l/compat.h Normal file
View File

@@ -0,0 +1,656 @@
/*
* $Id: compat.h,v 1.44 2006/01/15 09:35:16 mchehab Exp $
*/
#ifndef _COMPAT_H
#define _COMPAT_H
/* In v2.6.19-rc6-118-g52bad64 struct work_struct was was changed to be only for
* non-delayed work and struct delayed_work was created for delayed work. This
* will rename the structures. Hopefully no one will decide to name something
* delayed_work in the same context as something named work_struct. */
#ifdef NEED_DELAYED_WORK
#define delayed_work work_struct
#define INIT_DELAYED_WORK(a,b,c) INIT_WORK(a,b,c)
#endif
#define EXPERIMENTAL_TREE
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
#define usb_buffer_alloc(dev, size, mem_flags, dma) usb_alloc_coherent(dev, size, mem_flags, dma)
#define usb_buffer_free(dev, size, addr, dma) usb_free_coherent(dev, size, addr, dma)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
#define KERN_CONT ""
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 32)
#define ir_register_class(a) input_register_device(a)
#define ir_unregister_class(a) input_unregister_device(a)
#endif
/* To allow I2C compatibility code to work */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
#include <linux/i2c-dev.h>
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
#include <linux/mm.h>
#include <asm/uaccess.h>
#include <linux/err.h>
static inline void *memdup_user(const void __user *src, size_t len)
{
void *p;
/*
* Always use GFP_KERNEL, since copy_from_user() can sleep and
* cause pagefault, which makes it pointless to use GFP_NOFS
* or GFP_ATOMIC.
*/
p = kmalloc_track_caller(len, GFP_KERNEL);
if (!p)
return ERR_PTR(-ENOMEM);
if (copy_from_user(p, src, len)) {
kfree(p);
return ERR_PTR(-EFAULT);
}
return p;
}
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
static inline int pci_msi_enabled(void)
{
#ifndef CONFIG_PCI_MSI
return 0;
#else
return 1;
#endif
}
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
#ifdef CONFIG_PROC_FS
#include <linux/module.h>
#include <linux/proc_fs.h>
#include <linux/device.h>
#endif
#endif
#ifndef KEY_NUMERIC_0
#define KEY_NUMERIC_0 0x200 /* used by phones, remote controls, */
#define KEY_NUMERIC_1 0x201 /* and other keypads */
#define KEY_NUMERIC_2 0x202
#define KEY_NUMERIC_3 0x203
#define KEY_NUMERIC_4 0x204
#define KEY_NUMERIC_5 0x205
#define KEY_NUMERIC_6 0x206
#define KEY_NUMERIC_7 0x207
#define KEY_NUMERIC_8 0x208
#define KEY_NUMERIC_9 0x209
#define KEY_NUMERIC_STAR 0x20a
#define KEY_NUMERIC_POUND 0x20b
#endif
#ifndef DEFINE_PCI_DEVICE_TABLE
#define DEFINE_PCI_DEVICE_TABLE(_table) \
const struct pci_device_id _table[] __devinitconst
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34)
#define netdev_mc_count(dev) ((dev)->mc_count)
#define netdev_mc_empty(dev) (netdev_mc_count(dev) == 0)
#define netdev_for_each_mc_addr(mclist, dev) \
for (mclist = dev->mc_list; mclist; mclist = mclist->next)
#endif
#ifndef KEY_CONTEXT_MENU
#define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */
#endif
#ifndef BIT_MASK
#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
#endif
#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,32) && 0
#include <linux/ctype.h>
#undef _P
static inline char *skip_spaces(const char *str)
{
while (isspace(*str))
++str;
return (char *)str;
}
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
#define valtype unsigned long
static inline int strict_strtoul(const char *cp, unsigned int base, valtype *res)
{
char *tail;
valtype val;
size_t len;
*res = 0;
len = strlen(cp);
if (len == 0)
return -EINVAL;
val = simple_strtoul(cp, &tail, base);
if ((*tail == '\0') ||
((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) {
*res = val;
return 0;
}
return -EINVAL;
}
#endif
#ifndef KEY_DASHBOARD
#define KEY_DASHBOARD 204 /* AL Dashboard */
#endif
/* To allow alsa code to work */
#ifdef NEED_SOUND_DRIVER_H
#include <sound/driver.h>
#endif
#ifdef NEED_SND_CARD_CREATE
#include <sound/core.h>
#endif
#ifdef NEED_ALGO_CONTROL
#include <linux/i2c.h>
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
#define time_is_after_eq_jiffies(a) (time_before_eq(jiffies, a))
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
#define set_freezable()
#define cancel_delayed_work_sync cancel_rearming_delayed_work
#define DEFAULT_POLLMASK (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)
#endif
#ifndef __pure
# define __pure __attribute__((pure))
#endif
/* device_create/destroy added in 2.6.18 */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
/* on older kernels, class_device_create will in turn be a compat macro */
# define device_create(a, b, c, d, e, f, g) class_device_create(a, NULL, c, b, d, e, f, g)
# define device_destroy(a, b) class_device_destroy(a, b)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
#define IRQF_SHARED SA_SHIRQ
#define IRQF_DISABLED SA_INTERRUPT
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
#define PCIAGP_FAIL 0
#define vmalloc_32_user(a) vmalloc_32(a)
#endif
#ifndef DIV_ROUND_CLOSEST
#define DIV_ROUND_CLOSEST(x, divisor)( \
{ \
typeof(divisor) __divisor = divisor; \
(((x) + ((__divisor) / 2)) / (__divisor)); \
} \
)
#endif
#ifdef NEED_BOOL_TYPE
/* bool type and enum-based definition of true and false was added in 2.6.19 */
typedef int bool;
enum {
false = 0,
true = 1
};
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
#define sony_pic_camera_command(a,b) sonypi_camera_command(a,b)
#define SONY_PIC_COMMAND_SETCAMERAAGC SONYPI_COMMAND_SETCAMERAAGC
#define SONY_PIC_COMMAND_SETCAMERABRIGHTNESS SONYPI_COMMAND_SETCAMERABRIGHTNESS
#define SONY_PIC_COMMAND_SETCAMERACOLOR SONYPI_COMMAND_SETCAMERACOLOR
#define SONY_PIC_COMMAND_SETCAMERACONTRAST SONYPI_COMMAND_SETCAMERACONTRAST
#define SONY_PIC_COMMAND_SETCAMERAHUE SONYPI_COMMAND_SETCAMERAHUE
#define SONY_PIC_COMMAND_SETCAMERAPICTURE SONYPI_COMMAND_SETCAMERAPICTURE
#define SONY_PIC_COMMAND_SETCAMERASHARPNESS SONYPI_COMMAND_SETCAMERASHARPNESS
#define SONY_PIC_COMMAND_SETCAMERA SONYPI_COMMAND_SETCAMERA
#endif
/* pci_dev got a new revision field in 2.6.23-rc1 */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) && defined(LINUX_PCI_H)
/* Just make it easier to subsitute pci_dev->revision with
* v4l_compat_pci_rev(pci_dev). It's too bad there isn't some kind of context
* sensitive macro in C that could do this for us. */
static inline u8 v4l_compat_pci_rev(struct pci_dev *pci)
{ u8 rev; pci_read_config_byte(pci, PCI_REVISION_ID, &rev); return rev; }
#endif
#if defined(COMPAT_PCM_TO_RATE_BIT) && defined(__SOUND_PCM_H)
/* New alsa core utility function */
static inline unsigned int snd_pcm_rate_to_rate_bit(unsigned int rate)
{
static const unsigned int rates[] = { 5512, 8000, 11025, 16000, 22050,
32000, 44100, 48000, 64000, 88200, 96000, 176400, 192000 };
unsigned int i;
for (i = 0; i < ARRAY_SIZE(rates); i++)
if (rates[i] == rate)
return 1u << i;
return SNDRV_PCM_RATE_KNOT;
}
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
# define task_pid_nr(current) ((current)->pid)
# define sg_init_table(a,b)
# define sg_page(p) (sg->page)
# define sg_set_page(sglist,pg,sz,off) \
do { \
struct scatterlist *p=sglist; \
p->page = pg; \
p->length = sz; \
p->offset = off; \
} while (0)
#define pr_err(fmt, arg...) \
printk(KERN_ERR fmt, ##arg)
#endif
#ifndef BIT_MASK
# define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
# define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
#define i2c_verify_client(dev) \
((dev->bus == &i2c_bus_type) ? to_i2c_client(dev) : NULL)
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
#define i2c_verify_client(dev) \
((dev->bus && 0 == strcmp(dev->bus->name, "i2c")) ? to_i2c_client(dev) : NULL)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
/* Construct an I2C_CLIENT_END-terminated array of i2c addresses */
#define I2C_ADDRS(addr, addrs...) \
((const unsigned short []){ addr, ## addrs, I2C_CLIENT_END })
#endif
#ifndef USB_DEVICE_AND_INTERFACE_INFO
# define USB_DEVICE_AND_INTERFACE_INFO(vend,prod,cl,sc,pr) \
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO \
| USB_DEVICE_ID_MATCH_DEVICE, \
.idVendor = (vend), .idProduct = (prod), \
.bInterfaceClass = (cl), \
.bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
#define get_unaligned_be16(a) \
be16_to_cpu(get_unaligned((unsigned short *)(a)))
#define put_unaligned_be16(r, a) \
put_unaligned(cpu_to_be16(r), ((unsigned short *)(a)))
#define get_unaligned_le16(a) \
le16_to_cpu(get_unaligned((unsigned short *)(a)))
#define put_unaligned_le16(r, a) \
put_unaligned(cpu_to_le16(r), ((unsigned short *)(a)))
#define get_unaligned_be32(a) \
be32_to_cpu(get_unaligned((u32 *)(a)))
#define put_unaligned_be32(r, a) \
put_unaligned(cpu_to_be32(r), ((u32 *)(a)))
#define get_unaligned_le32(a) \
le32_to_cpu(get_unaligned((u32 *)(a)))
#define put_unaligned_le32(r, a) \
put_unaligned(cpu_to_le32(r), ((u32 *)(a)))
#define get_unaligned_le64(a) \
le64_to_cpu(get_unaligned((u64 *)(a)))
#define put_unaligned_le64(r, a) \
put_unaligned(cpu_to_le64(r), ((u64 *)(a)))
#endif
#ifdef NEED_PROC_CREATE
#ifdef CONFIG_PROC_FS
static inline struct proc_dir_entry *proc_create(const char *a,
mode_t b, struct proc_dir_entry *c, const struct file_operations *d)
{
struct proc_dir_entry *e;
e = create_proc_entry(a, b, c);
if (e) {
e->owner = THIS_MODULE;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17)
e->proc_fops = d;
#else
e->proc_fops = (struct file_operations *)d;
#endif
}
return e;
}
#endif
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
#ifdef CONFIG_PROC_FS
static inline struct proc_dir_entry *proc_create_data(const char *a,
mode_t b, struct proc_dir_entry *c, const struct file_operations *d,
void *f)
{
struct proc_dir_entry *e;
e = create_proc_entry(a, b, c);
if (e) {
e->owner = THIS_MODULE;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17)
e->proc_fops = d;
#else
e->proc_fops = (struct file_operations *)d;
#endif
e->data = f;
}
return e;
}
#endif
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
#define hweight64(x) generic_hweight64(x)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
typedef unsigned long uintptr_t;
#endif
#ifdef NEED_IS_SINGULAR
static inline int list_is_singular(const struct list_head *head)
{
return !list_empty(head) && (head->next == head->prev);
}
#endif
#ifdef NEED_CLAMP
#define clamp( x, l, h ) max_t( __typeof__( x ), \
( l ), \
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
static inline int dummy_algo_control(struct i2c_adapter *adapter,
unsigned int cmd, unsigned long arg)
{
return 0;
}
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
#define div64_u64(a,b) div64_64(a,b)
#define dev_name(dev) ((dev)->bus_id)
#define dev_set_name(dev, fmt, arg...) ({ \
snprintf((dev)->bus_id, sizeof((dev)->bus_id), fmt , ## arg); \
0; \
})
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
#define current_uid() (current->uid)
#endif
#ifndef WARN
#define WARN(condition, format...) ({ \
int __ret_warn_on = !!(condition); \
if (unlikely(__ret_warn_on)) \
printk(KERN_WARNING format); \
unlikely(__ret_warn_on); \
})
#endif
#ifdef NEED_SND_BUG_ON
#define snd_BUG_ON(cond) WARN((cond), "BUG? (%s)\n", __stringify(cond))
#endif
#ifdef NEED_BITOPS
#define BIT(x) (1UL<<((x)%BITS_PER_LONG))
#endif
#ifndef PCI_DEVICE_ID_MARVELL_88ALP01_CCIC
#define PCI_DEVICE_ID_MARVELL_88ALP01_CCIC 0x4102
#endif
#ifdef __LINUX_USB_H
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
/*
* usb_endpoint_* functions
*
* Included in Linux 2.6.19
* Backported to 2.6.18 in Red Hat Enterprise Linux 5.2
*/
#ifdef RHEL_RELEASE_CODE
#if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(5, 2)
#define RHEL_HAS_USB_ENDPOINT
#endif
#endif
#ifndef RHEL_HAS_USB_ENDPOINT
static inline int
usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
{
return (epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN;
}
static inline int
usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd)
{
return (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_INT;
}
static inline int
usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd)
{
return (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_ISOC;
}
static inline int
usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd)
{
return (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_BULK;
}
static inline int
usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd)
{
return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd);
}
static inline int usb_endpoint_dir_out(
const struct usb_endpoint_descriptor *epd)
{
return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
}
static inline int usb_endpoint_is_bulk_in(
const struct usb_endpoint_descriptor *epd)
{
return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd));
}
static inline int usb_endpoint_is_bulk_out(
const struct usb_endpoint_descriptor *epd)
{
return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd));
}
static inline int usb_endpoint_is_int_out(
const struct usb_endpoint_descriptor *epd)
{
return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd));
}
static inline int usb_endpoint_is_isoc_in(
const struct usb_endpoint_descriptor *epd)
{
return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd));
}
static inline int usb_endpoint_is_isoc_out(
const struct usb_endpoint_descriptor *epd)
{
return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd));
}
#endif /* RHEL_HAS_USB_ENDPOINT */
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 21)
#ifndef RHEL_HAS_USB_ENDPOINT
static inline int usb_endpoint_xfer_control(
const struct usb_endpoint_descriptor *epd)
{
return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_CONTROL);
}
#endif /* RHEL_HAS_USB_ENDPOINT */
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
{
return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
}
#endif
#ifdef NEED_USB_ENDPOINT_TYPE
static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
{
return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
}
#endif
#endif /* __LINUX_USB_H */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
/*
* Linked list API
*/
#define list_first_entry(ptr, type, member) \
list_entry((ptr)->next, type, member)
/*
* uninitialized_var() macro
*/
#define uninitialized_var(x) x = x
#endif
#ifdef NEED_NETDEV_PRIV
#define netdev_priv(dev) ((dev)->priv)
#endif
#ifdef NEED_PCI_IOREMAP_BAR
#define pci_ioremap_bar(pdev, bar) \
ioremap_nocache(pci_resource_start(pdev, bar), \
pci_resource_len(pdev, bar))
#endif
#ifdef NEED_POLL_SCHEDULE
#define poll_schedule(pwq, task) \
do { \
set_current_state(task); \
schedule(); \
set_current_state(TASK_RUNNING); \
} 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
/* This macro was added in commit v2.6.23-5792-g34c6538 */
#ifndef DMA_BIT_MASK
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
#endif
/* __fls() was added for generic code in 2.6.29, existed for just 64-bit arches
* since 2.6.26 (v2.6.25-5228-g56a6b1e), and was x86-64 only before then. We
* only want this compat code when __fls doesn't exist, which 2.6.29 or later,
* non x86-64, and non 64-bit that's 2.6.26 or later. */
#if !(LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29) || \
defined(__x86_64__) || \
(BITS_PER_LONG == 64 && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)))
/* This define will prevent breakage if __fls was already defined. */
#undef __fls
#define __fls v4l_compat_fls
static inline unsigned long v4l_compat_fls(unsigned long x)
{
return fls(x) - 1;
}
#endif
/*
* Compatibility code for hrtimer API
* This will make hrtimer usable for kernels 2.6.22 and later.
* For earlier kernels, not all required functions are exported
* so there's nothing we can do.
*/
#ifdef _LINUX_HRTIMER_H
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) && \
LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
/* Forward a hrtimer so it expires after the hrtimer's current now */
static inline unsigned long hrtimer_forward_now(struct hrtimer *timer,
ktime_t interval)
{
return hrtimer_forward(timer, timer->base->get_time(), interval);
}
#endif
#endif /* _LINUX_HRTIMER_H */
#ifndef PCI_VDEVICE
#define PCI_VDEVICE(vendor, device) \
PCI_VENDOR_ID_##vendor, (device), \
PCI_ANY_ID, PCI_ANY_ID, 0, 0
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
#define __devinitconst
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
#define strncasecmp(a, b, c) strnicmp(a, b, c)
#define strcasecmp(a, b) strnicmp(a, b, sizeof(a))
#endif
#endif /* _COMPAT_H */

66
v4l/firmware/Makefile Normal file
View File

@@ -0,0 +1,66 @@
TARGETS = vicam/firmware.fw dabusb/firmware.fw dabusb/bitstream.bin ttusb-budget/dspbootcode.bin cpia2/stv0672_vp4.bin av7110/bootcode.bin
FW_DIR = $(DESTDIR)/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 rm -rf $$i; fi; done
install: default
@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
######
ihex2fw: ../../linux/firmware/ihex2fw.c
@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

31
v4l/obsolete.txt Normal file
View File

@@ -0,0 +1,31 @@
# This file was renamed to v4l2_compat_ioctl32
video/compat-ioctl32
# This file were replaced by videobuf-dma-sg and videobuf-core
video/video-buf
# This file were replaced by videobuf-dvb
video/video-buf-dvb
#This driver has been reworked and moved to dvb-usb
dvb/cinergyT2/cinergyT2
# Those drivers were moved to common/tuners
dvb/frontends/mt2060
dvb/frontends/mt2131
dvb/frontends/mt2266
dvb/frontends/qt1010
dvb/frontends/tda18271
dvb/frontends/tda827x
dvb/frontends/xc5000
video/mt20xx
video/tda8290
video/tda9887
video/tea5761
video/tea5767
video/tuner-simple
video/tuner-types
video/tuner-xc2028
# This were moved to IR/
common/ir-common

1
v4l/oss Symbolic link
View File

@@ -0,0 +1 @@
.

185
v4l/scripts/analyze_build.pl Executable file
View File

@@ -0,0 +1,185 @@
#!/usr/bin/perl
# Copyright (C) 2006 Trent Piepho <xyzzy@speakeasy.org>
# Scans a tree of Linux Kernel style Makefiles, and builds lists of what
# builds what.
# Outputs three lists:
# 1. Kconfig variables associated with the kernel module(s) they turn on
# 2. Kernel modules associated with their source file(s)
# 3. Kconfig variables associated with all the source file(s) they turn on
#
# Optional options:
# Prefix relative to source tree root to start scanning in. This
# will be stripped from the beginnings of all filenames printed out.
# Default is 'linux/drivers/media'
# Root of source tree
# Default is to use 'hg root' command and if that fails the cwd
#
# Most usefull with grep, for example
# List of modules and source files used by DVB_BUDGET_AV
# deps.pl | grep DVB_BUDGET_AV
#
# Kconfig variable and kernel module that use dvb-usb-init.c
# deps.pl | grep dvb-usb-init.c
#
# Kconfig variable and source files that make dvb-core.ko
# deps.pl | grep dvb-core.ko
#
# Also has some ability to check Makefiles for errors
use strict;
use FileHandle;
# Print out some extra checks of Makefile correctness
my $check = 0;
# Directory to start in. Will be stripped from all filenames printed out.
my $prefix = 'linux/drivers/media/';
# Root of source tree
my $root;
# List of Makefile's opened
my %makefiles = ();
# For each Kconfig variable, a list of modules it builds
my %config = ();
# For each module that is made up of multiple source files, list of sources
my %multi = ();
sub open_makefile($) {
my $file = shift;
# only open a given Makefile once
return if exists $makefiles{$file};
$makefiles{$file} = 1;
$file =~ m|^(.*)/[^/]*$|;
my $dir = $1;
# print STDERR "opening $root$file (dir=$dir)\n";
my $in = new FileHandle;
open $in, '<', "$root$file" or die "Unable to open Makefile '$root$file': $!";
while (<$in>) {
# print STDERR "Line: $_";
# Skip comment and blank lines
next if (/^\s*(#.*)?$/);
m/^\s*\-?include/ and die "Can't handle includes! In $file";
# Handle line continuations
if (/\\\n$/) {
$_ .= <$in>;
redo;
}
# Eat line continuations in string we will parse
s/\s*\\\n\s*/ /g;
# Eat comments
s/#.*$//;
if (/^\s*obj-(\S+)\s*([:+]?)=\s*(\S.*?)\s*$/) {
print STDERR "Should use '+=' in $file:$.\n$_\n" if ($check && $2 ne '+');
my ($var,$targets) = ($1, $3);
if ($var =~ /\$\(CONFIG_(\S+)\)$/) {
$var = $1;
} elsif ($var !~ /^[ym]$/) {
print STDERR "Confused by obj assignment '$var' in $file:$.\n$_";
}
foreach(split(/\s+/, $targets)) {
if (m|/$|) { # Ends in /, means it's a directory
open_makefile("$dir/$_".'Makefile');
} elsif (/^(\S+)\.o$/) {
push @{$config{$var}}, "$dir/$1";
} else {
print STDERR "Confused by target '$_' in $file:$.\n";
}
}
next;
}
if (/(\S+)-objs\s*([:+]?)=\s*(\S.*?)\s*$/) {
my @files = split(/\s+/, $3);
map { s|^(.*)\.o$|$dir/\1| } @files;
if ($2 eq '+') {
# Adding to files
print STDERR "Should use ':=' in $file:$.\n$_\n" if ($check && !exists $multi{"$dir/$1"});
push @files, @{$multi{"$dir/$1"}};
} else {
print STDERR "Setting objects twice in $file:$.\n$_\n" if ($check && exists $multi{"$dir/$1"});
}
$multi{"$dir/$1"} = \@files;
next;
}
if (/^\s*EXTRA_CFLAGS\s*([:+]?)=\s*(\S.*?)\s*$/) {
if ($check) {
sub allI { /^-I/ or return 0 foreach split(/\s+/, $_[0]);return 1; }
my $use = allI($2) ? ':' : '+';
print STDERR "Should use '$use=' with EXTRA_CFLAGS in $file:$.\n$_\n"
if ($1 ne $use);
}
next;
}
print STDERR "Odd line $file:$.\n$_\n" if ($check);
}
}
if ($#ARGV >= 0) {
$prefix = $ARGV[0];
$prefix .= '/' unless ($prefix =~ m|/$|);
}
# Find root of source tree: command line, then Hg command, lastly cwd
if ($#ARGV >= 1) {
$root = $ARGV[1];
$root .= '/' unless ($root =~ m|/$|);
} else {
$root = `hg root 2>/dev/null`;
if($? == 0) {
chomp $root;
$root .= '/';
} else {
$root = '';
}
}
print "# Using source tree root '$root'\n" if ($root ne '');
open_makefile($prefix."Makefile");
print "# Kconfig variable = kernel modules built\n";
foreach my $var (keys %config) {
my @list = @{$config{$var}};
map { s/^$prefix(.*)$/\1.ko/ } @list;
printf "%-22s= %s\n", $var, join(' ', @list);
}
print "\n# kernel module = source files\n";
my %modules = ();
foreach my $mods (values %config) {
$modules{$_} = 1 foreach @$mods;
}
foreach (keys %modules) {
/$prefix(.*)$/;
printf "%-30s = ", "$1.ko";
if (exists $multi{$_}) {
my @list = @{$multi{$_}};
map { s/^$prefix(.*)$/\1.c/ } @list;
print join(' ', @list), "\n";
} else {
print "$1.c\n";
}
}
print "\n# Kconfig varible = source files\n";
while (my ($var, $list) = each %config) {
my @outlist = ();
foreach (@$list) {
if (exists $multi{$_}) {
push @outlist, @{$multi{$_}};
} else {
push @outlist, $_;
}
}
map { s/^$prefix(.*)$/\1.c/ } @outlist;
printf "%-22s= %s\n", $var, join(' ', @outlist);
}
exit;

48
v4l/scripts/au0828.pl Executable file
View File

@@ -0,0 +1,48 @@
#!/usr/bin/perl -w
use strict;
my $new_entry = -1;
my $nr = 0;
my ($id,$subvendor,$subdevice);
my %data;
while (<>) {
# defines in header file
if (/#define\s+(AU08[\d]._BOARD_\w+)\s+(\d+)/) {
$data{$1}->{nr} = $2;
next;
}
# au0828_boards
if (/\[(AU0828_BOARD_\w+)\]/) {
$id = $1;
$data{$id}->{id} = $id;
$data{$id}->{type} = "(au0828)";
# $data{$id}->{nr} = $nr++;
};
next unless defined($id);
if (/USB_DEVICE.*0x([0-9a-fA-F]*).*0x([0-9a-fA-F]*)/ ) {
$subvendor=$1;
$subdevice=$2;
}
if (/.*driver_info.*(AU08[\d]._BOARD_\w+)/ ) {
push @{$data{$1}->{subid}}, "$subvendor:$subdevice";
}
if (!defined($data{$id}) || !defined($data{$id}->{name})) {
$data{$id}->{name} = $1 if (/\.name\s*=\s*\"([^\"]+)\"/);
}
# au0828_USB_tbl
}
foreach my $item (sort { $data{$a}->{nr} <=> $data{$b}->{nr} } keys %data) {
printf("%3d -> %-40s %-15s", $data{$item}->{nr}, $data{$item}->{name},$data{$item}->{type});
printf(" [%s]",join(",",@{$data{$item}->{subid}}))
if defined($data{$item}->{subid});
print "\n";
}

51
v4l/scripts/bttv.pl Executable file
View File

@@ -0,0 +1,51 @@
#!/usr/bin/perl -w
use strict;
my $new_entry = -1;
my $nr = 0;
my ($id,$subvendor,$subdevice);
my %data;
my $pciid=0;
while (<>) {
# defines in header file
if (/#define\s+(BTTV_BOARD_\w+)\s+0x([0-9a-fA-F]*).*/) {
$data{$1}->{nr} = hex $2;
next;
}
# cx88_boards
if (/\[(BTTV_BOARD_\w+)\]/) {
$id = $1;
$data{$id}->{id} = $id;
# $data{$id}->{nr} = $nr++;
};
if (/0x([0-9a-fA-F]...)([0-9a-fA-F]...)/) {
$subvendor = $2;
$subdevice = $1;
if (/(BTTV_BOARD_\w+)/) {
push @{$data{$1}->{subid}}, "$subvendor:$subdevice";
undef $subvendor;
undef $subdevice;
}
}
next unless defined($id);
if (!defined($data{$id}) || !defined($data{$id}->{name})) {
$data{$id}->{name} = $1 if (/\.name\s*=\s*\"([^\"]+)\"/);
}
if (/0x([0-9]...)([0-9]...)/) {
$subvendor = $1;
$subdevice = $2;
}
}
foreach my $item (sort { $data{$a}->{nr} <=> $data{$b}->{nr} } keys %data) {
printf("%3d -> %-51s", $data{$item}->{nr}, $data{$item}->{name});
printf(" [%s]",join(",",@{$data{$item}->{subid}}))
if defined($data{$item}->{subid});
print "\n";
}

28
v4l/scripts/cardlist Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/sh
scripts/bttv.pl ../linux/drivers/media/video/bt8xx/bttv.h ../linux/drivers/media/video/bt8xx/bttv-cards.c \
| perl -ne 's/[ \t]+$//; print' > ../linux/Documentation/video4linux/CARDLIST.bttv
scripts/cx88.pl ../linux/drivers/media/video/cx88/cx88.h ../linux/drivers/media/video/cx88/cx88-cards.c \
| perl -ne 's/[ \t]+$//; print' > ../linux/Documentation/video4linux/CARDLIST.cx88
scripts/em28xx.pl ../linux/drivers/media/video/em28xx/em28xx-cards.c ../linux/drivers/media/video/em28xx/em28xx.h \
| perl -ne 's/[ \t]+$//; print' > ../linux/Documentation/video4linux/CARDLIST.em28xx
scripts/tuner.pl ../linux/include/media/tuner.h ../linux/drivers/media/common/tuners/tuner-types.c \
| perl -ne 's/[ \t]+$//; print' > ../linux/Documentation/video4linux/CARDLIST.tuner
scripts/saa7134.pl ../linux/drivers/media/video/saa7134/saa7134.h ../linux/drivers/media/video/saa7134/saa7134-cards.c \
| perl -ne 's/[ \t]+$//; print' > ../linux/Documentation/video4linux/CARDLIST.saa7134
scripts/usbvision.pl ../linux/drivers/media/video/usbvision/usbvision-cards.h ../linux/drivers/media/video/usbvision/usbvision-cards.c \
| perl -ne 's/[ \t]+$//; print' > ../linux/Documentation/video4linux/CARDLIST.usbvision
scripts/cx23885.pl ../linux/drivers/media/video/cx23885/cx23885.h ../linux/drivers/media/video/cx23885/cx23885-cards.c \
| perl -ne 's/[ \t]+$//; print' > ../linux/Documentation/video4linux/CARDLIST.cx23885
scripts/au0828.pl ../linux/drivers/media/video/au0828/au0828-cards.h ../linux/drivers/media/video/au0828/au0828-cards.c \
| perl -ne 's/[ \t]+$//; print' > ../linux/Documentation/video4linux/CARDLIST.au0828
scripts/saa7164.pl ../linux/drivers/media/video/saa7164/saa7164.h ../linux/drivers/media/video/saa7164/saa7164-cards.c \
| perl -ne 's/[ \t]+$//; print' > ../linux/Documentation/video4linux/CARDLIST.saa7164

View File

@@ -0,0 +1,5 @@
User #author#
Date #date|date#
#desc#
---

124
v4l/scripts/check.pl Executable file
View File

@@ -0,0 +1,124 @@
#!/usr/bin/perl
use Getopt::Std;
use strict;
my $c_syntax=0;
my $fmt="--emacs";
my %opt;
sub usage ($)
{
my $name = shift;
printf "Usage: %s [<args>] [<file>]\n".
"\t-c\tc style\n".
"\t-e\emacs style (default)\n".
"\t-t\terse style (default)\n".
"\t<file>\tfile name to open. If file not specified, uses hg diff\n\n", $name;
exit -1;
}
if (not getopts('cet',\%opt) or defined $opt{'h'}) {
usage($0);
}
my $cmd=shift;
if ($opt{'c'}) {
$c_syntax=1;
}
if ($opt{'t'}) {
$fmt="--terse";
$c_syntax=0;
}
if ($cmd) {
$cmd="diff -upr /dev/null $cmd";
} else {
$cmd="hg diff";
}
my $checkpatch=$ENV{CHECKPATCH};
if (!$checkpatch) {
$checkpatch="/lib/modules/`uname -r`/build/scripts/checkpatch.pl";
}
my $cp_version;
open IN,"$checkpatch|";
while (<IN>) {
tr/A-Z/a-z/;
if (m/version\s*:\s*([\d\.]+)/) {
$cp_version = $1;
}
}
close IN;
my $intree_checkpatch = "scripts/checkpatch.pl --version ";
if (!open IN,"$intree_checkpatch|") {
$intree_checkpatch = "v4l/".$intree_checkpatch;
open IN,"$intree_checkpatch|";
}
$intree_checkpatch =~ s/--version/--no-tree --strict/;
while (<IN>) {
tr/A-Z/a-z/;
if (m/version\s*:\s*([\d\.]+)/) {
if ($1 > $cp_version) {
print "# WARNING: $checkpatch version $cp_version is\n"
."# older than $intree_checkpatch version"
." $1.\n# Using in-tree one.\n#\n";
$cp_version = $1;
$checkpatch = $intree_checkpatch;
}
}
}
close IN;
open IN,"$cmd | $checkpatch -q --nosignoff $fmt -|";
my $err="";
my $errline="";
my $file="";
my $ln_numb;
my $pwd=`pwd`;
$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;
$err="";
}
}
if ($c_syntax == 0) {
while (<IN>) {
s|^#[\d]+:\s*FILE:\s*|../|;
print "$_";
}
} else {
while (<IN>) {
if (m/^\+(.*)\n/) {
$errline=$1;
} elsif (m/^\#\s*[\d]+\s*:\s*FILE:\s*([^\:]+)\:([\d]+)/) {
$file=$1;
$ln_numb=$2;
} elsif (m/^\-\s*\:\d+\:\s*(.*)\n/) {
print_err();
$err = $1;
$err =~ s/WARNING/warning/;
}
# print "# $_";
}
}
close IN;
print_err();

View File

@@ -0,0 +1,70 @@
#!/usr/bin/perl
# Copyright (C) 2006 Trent Piepho <xyzzy@speakeasy.org>
#
# Look for lines in C files like "#ifdef CONFIG_SOME_KCONF_VAR" and make
# sure CONFIG_SOME_KCONF_VAR is something that exists.
use strict;
if($#ARGV < 0) {
print "Usage: $0 kernel_dir [files to check ...]\n\n";
print "If no files are listed, checks all files from hg manifest\n";
exit;
}
my $kdir = shift;
if($#ARGV < 0) {
@ARGV = `hg manifest | cut "-d " -f3 | grep \\.[ch]\$`;
$? != 0 and die "Error getting manifest: $!";
chomp @ARGV;
}
my %kconfigs; # List of Kconfig files read in already
my %vars; # List of defined variables
sub readkconfig($$)
{
my $fn = "$_[0]/$_[1]";
# Don't read the same kconfig file more than once. This also means
# the drivers/media/Kconfig file from kernel won't be read in addition
# to the one from v4l-dvb.
return if exists $kconfigs{$_[1]};
$kconfigs{$_[1]} = 1;
# print "Reading $fn\n";
my $fh;
open $fh, '<', "$fn" or die "Can't read Kconfig file $fn: $!";
while(<$fh>) {
if (/^\s*source\s+"([^"]+)"\s*$/ || /^\s*source\s+(\S+)\s*$/) {
readkconfig($_[0], $1);
} elsif(/^(?:menu)?config\s+(\w+)$/) {
$vars{"CONFIG_$1"}=1;
}
}
close $fh;
}
readkconfig('linux', 'drivers/media/Kconfig');
foreach(glob "$kdir/arch/*/Kconfig") {
s|^\Q$kdir/\E||;
next if(m|arch/um/Kconfig|);
readkconfig($kdir, $_);
}
while(<>) {
if(/^\s*#ifn?def\s+(CONFIG_\w+?)(:?_MODULE)?\W*$/) {
# print "Found $1\n";
print "Unknown config $1 in $ARGV:$.\n" unless(exists $vars{$1});
next;
}
if(/^\s*#if/) {
$_ .= <> while(/\\$/); # Handle line continuations
my $last;
while(/defined\(\s*(CONFIG_\w+?)(_MODULE)?\s*\)/) {
$_ = $';
next if($last eq $1);
$last = $1;
print "Unknown config $1 in $ARGV:$.\n" unless(exists $vars{$1});
}
}
} continue {
close ARGV if eof;
}

228
v4l/scripts/check_deps.pl Executable file
View File

@@ -0,0 +1,228 @@
#!/usr/bin/perl
# Copyright (C) 2008 Mauro Carvalho Chehab <mchehab@infradead.org>
use strict;
use File::Find;
use Fcntl ':mode';
use FileHandle;
my $debug=0;
my $SRC = 'linux';
my %export;
#############
# open_makefile were adapted from analyze_build.pl
# by Copyright (C) 2006 Trent Piepho <xyzzy@speakeasy.org>
# Print out some extra checks of Makefile correctness
my $check = 0;
# Root of source tree
my $root;
# List of Makefile's opened
my %makefiles = ();
# For each module that is made up of multiple source files, list of sources
my %multi = ();
my $multi_count = 0;
my %config;
my %associate;
sub open_makefile($) {
my $file = shift;
# only open a given Makefile once
return if exists $makefiles{$file};
$makefiles{$file} = 1;
$file =~ m|^(.*)/[^/]*$|;
my $dir = $1;
print "opening $root$file (dir=$dir)\n" if ($debug > 2);
my $in = new FileHandle;
open $in, '<', "$root$file" or die "Unable to open Makefile '$root$file': $!";
while (<$in>) {
# print STDERR "Line: $_";
# Skip comment and blank lines
next if (/^\s*(#.*)?$/);
m/^\s*\-?include/ and die "Can't handle includes! In $file";
# Handle line continuations
if (/\\\n$/) {
$_ .= <$in>;
redo;
}
# Eat line continuations in string we will parse
s/\s*\\\n\s*/ /g;
# Eat comments
s/#.*$//;
if (/^\s*obj-(\S+)\s*([:+]?)=\s*(\S.*?)\s*$/) {
print STDERR "Should use '+=' in $file:$.\n$_\n" if ($check && $2 ne '+');
my ($var,$targets) = ($1, $3);
if ($var =~ /\$\(CONFIG_(\S+)\)$/) {
$var = $1;
} elsif ($var !~ /^[ym]$/) {
print STDERR "Confused by obj assignment '$var' in $file:$.\n$_";
}
foreach(split(/\s+/, $targets)) {
if (m|/$|) { # Ends in /, means it's a directory
open_makefile("$dir/$_".'Makefile');
} elsif (/^(\S+)\.o$/) {
$config{"$dir/$1"} = $var;
# printf "%s -> %s\n", $var, $1 if $debug > 1;
} else {
print STDERR "Confused by target '$_' in $file:$.\n";
}
}
next;
}
if (/(\S+)-objs\s*([:+]?)=\s*(\S.*?)\s*$/) {
my @files = split(/\s+/, $3);
map { s|^(.*)\.o$|$dir/\1| } @files;
if ($2 eq '+') {
# Adding to files
print STDERR "Should use ':=' in $file:$.\n$_\n" if ($check && !exists $multi{"$dir/$1"});
push @files, @{$multi{"$dir/$1"}};
} else {
print STDERR "Setting objects twice in $file:$.\n$_\n" if ($check && exists $multi{"$dir/$1"});
}
$multi{"$dir/$1"} = \@files;
next;
}
if (/^\s*EXTRA_CFLAGS\s*([:+]?)=\s*(\S.*?)\s*$/) {
if ($check) {
sub allI { /^-I/ or return 0 foreach split(/\s+/, $_[0]);return 1; }
my $use = allI($2) ? ':' : '+';
print STDERR "Should use '$use=' with EXTRA_CFLAGS in $file:$.\n$_\n"
if ($1 ne $use);
}
next;
}
print STDERR "Odd line $file:$.\n$_\n" if ($check);
}
close IN;
}
#
#############
sub associate_multi()
{
foreach (keys %multi) {
my $name = $_;
my @files = @{$multi{$_}};
map { s/^(.*)$/\1.c/ } @files;
foreach (@files) {
my $file = $_;
my $var = $config{$name};
$associate{$file} = $var;
printf "$var -> $file\n" if $debug > 1;
}
delete $config{$name};
}
foreach my $file (keys %config) {
my $var = $config{$file};
$file .= ".c";
$associate{$file} = $var;
printf "$var -> $file\n" if $debug > 1;
}
}
sub build_exported_symbol_list {
my $file = $File::Find::name;
return if (!($file =~ /\.c$/));
open IN, $file;
while (<IN>) {
if (m/EXPORT_SYMBOL.*\(\s*([^\s\)]+)/) {
$export{$1} = $file;
printf "%s -> %s\n", $file , $1 if $debug > 1;
}
}
close IN;
}
sub find_usage_list {
my %depend;
my $file = $File::Find::name;
my $s;
return if (!($file =~ /\.c$/));
open IN, $file;
printf "Checking symbols at $file\n" if $debug;
while (<IN>) {
foreach my $symbol (keys %export) {
my $symb_file = $export{$symbol};
# Doesn't search the symbol at the file that defines it
next if ($symb_file eq $file);
if (m/($symbol)/) {
my $var = $associate{$symb_file};
if (!$depend{$var}) {
printf "$symbol found at $file. It depends on %s\n", $associate{$symb_file} if $debug;
$depend{$var} = 1;
}
}
}
}
close IN;
foreach (%depend) { $s .= "$_ && "; };
$s =~ s/\&\&\ $//;
if ($s ne "") {
print $associate{$file}." depends on $s\n";
}
}
print <<EOL;
Dependency check tool for Kernel Symbols.
Copyright(c) 2008 by Mauro Carvalho Chehab <mchehab\@infradead.org>
This code is licenced under the terms of GPLv2.
This script seeks all .c files under linux/ for their exported symbols. For
each exported symbol, it will check what Kconfig symbol is associated. Then, it
will cross-check that symbol usage and output a Kconfig depencency table.
WARNING: The result of this tool should be used just as a hint, since, due to
performance issues, and to simplify the tool, the checks will use a simple grep
for the symbol string at the .c files, instead of a real symbol cross-check.
Also, the same symbol may appear twice with different dependencies. This is due
to the way it checks for symbols. The final dependency is the union (AND) of
all showed ones for that symbol.
Further patches improving this tool are welcome.
EOL
print "Checking makefile rules..." if $debug;
open_makefile("$SRC/drivers/media/Makefile");
print " ok\n" if $debug;
print "Associating symbols with c files..." if $debug;
associate_multi();
print " ok\n" if $debug;
print "finding exported symbols at $SRC..." if $debug;
find({wanted => \&build_exported_symbol_list, no_chdir => 1}, $SRC);
print " ok\n" if $debug;
print "finding usage of symbols at $SRC\n" if $debug;
find({wanted => \&find_usage_list, no_chdir => 1}, $SRC);
print "finished\n" if $debug;

2721
v4l/scripts/checkpatch.pl Executable file

File diff suppressed because it is too large Load Diff

9
v4l/scripts/config.bttv Normal file
View File

@@ -0,0 +1,9 @@
MDIR := v4l2
snap := video4linux
CONFIG_VIDEO_BTTV := m
CONFIG_VIDEO_CX88 := n
CONFIG_VIDEO_SAA7134 := n
CONFIG_VIDEO_IR := m
CONFIG_VIDEO_TUNER := m
CONFIG_VIDEO_TVAUDIO := m

9
v4l/scripts/config.cx88 Normal file
View File

@@ -0,0 +1,9 @@
MDIR := v4l2
snap := video4linux
CONFIG_VIDEO_BTTV := n
CONFIG_VIDEO_CX88 := m
CONFIG_VIDEO_SAA7134 := n
CONFIG_VIDEO_IR := n
CONFIG_VIDEO_TUNER := m
CONFIG_VIDEO_TVAUDIO := n

View File

@@ -0,0 +1,9 @@
MDIR := v4l2
snap := video4linux
CONFIG_VIDEO_BTTV := n
CONFIG_VIDEO_CX88 := n
CONFIG_VIDEO_SAA7134 := m
CONFIG_VIDEO_IR := m
CONFIG_VIDEO_TUNER := m
CONFIG_VIDEO_TVAUDIO := m

57
v4l/scripts/cx23885.pl Executable file
View File

@@ -0,0 +1,57 @@
#!/usr/bin/perl -w
use strict;
my %map = (
"PCI_ANY_ID" => "0",
);
sub fix_id($) {
my $id = shift;
$id = $map{$id} if defined($map{$id});
$id =~ s/^0x//;
return $id;
}
my $new_entry = -1;
my $nr = 0;
my ($id,$subvendor,$subdevice);
my %data;
while (<>) {
# defines in header file
if (/#define\s+(CX23885_BOARD_\w+)\s+(\d+)/) {
$data{$1}->{nr} = $2;
next;
}
# cx88_boards
if (/\[(CX23885_BOARD_\w+)\]/) {
$id = $1;
$data{$id}->{id} = $id;
# $data{$id}->{nr} = $nr++;
};
next unless defined($id);
if (!defined($data{$id}) || !defined($data{$id}->{name})) {
$data{$id}->{name} = $1 if (/\.name\s*=\s*\"([^\"]+)\"/);
}
# cx88_pci_tbl
$subvendor = fix_id($1) if (/\.subvendor\s*=\s*(\w+),/);
$subdevice = fix_id($1) if (/\.subdevice\s*=\s*(\w+),/);
if (/.card\s*=\s*(\w+),/) {
if (defined($data{$1}) &&
defined($subvendor) && $subvendor ne "0" &&
defined($subdevice) && $subdevice ne "0") {
push @{$data{$1}->{subid}}, "$subvendor:$subdevice";
undef $subvendor;
undef $subdevice;
}
}
}
foreach my $item (sort { $data{$a}->{nr} <=> $data{$b}->{nr} } keys %data) {
printf("%3d -> %-51s", $data{$item}->{nr}, $data{$item}->{name});
printf(" [%s]",join(",",@{$data{$item}->{subid}}))
if defined($data{$item}->{subid});
print "\n";
}

61
v4l/scripts/cx88.pl Executable file
View File

@@ -0,0 +1,61 @@
#!/usr/bin/perl -w
use strict;
my %map = (
"PCI_ANY_ID" => "0",
"PCI_VENDOR_ID_PHILIPS" => "1131",
"PCI_VENDOR_ID_ASUSTEK" => "1043",
"PCI_VENDOR_ID_MATROX" => "102B",
"PCI_VENDOR_ID_ATI" => "1002",
);
sub fix_id($) {
my $id = shift;
$id = $map{$id} if defined($map{$id});
$id =~ s/^0x//;
return $id;
}
my $new_entry = -1;
my $nr = 0;
my ($id,$subvendor,$subdevice);
my %data;
while (<>) {
# defines in header file
if (/#define\s+(CX88_BOARD_\w+)\s+(\d+)/) {
$data{$1}->{nr} = $2;
next;
}
# cx88_boards
if (/\[(CX88_BOARD_\w+)\]/) {
$id = $1;
$data{$id}->{id} = $id;
# $data{$id}->{nr} = $nr++;
};
next unless defined($id);
if (!defined($data{$id}) || !defined($data{$id}->{name})) {
$data{$id}->{name} = $1 if (/\.name\s*=\s*\"([^\"]+)\"/);
}
# cx88_pci_tbl
$subvendor = fix_id($1) if (/\.subvendor\s*=\s*(\w+),/);
$subdevice = fix_id($1) if (/\.subdevice\s*=\s*(\w+),/);
if (/.card\s*=\s*(\w+),/) {
if (defined($data{$1}) &&
defined($subvendor) && $subvendor ne "0" &&
defined($subdevice) && $subdevice ne "0") {
push @{$data{$1}->{subid}}, "$subvendor:$subdevice";
undef $subvendor;
undef $subdevice;
}
}
}
foreach my $item (sort { $data{$a}->{nr} <=> $data{$b}->{nr} } keys %data) {
printf("%3d -> %-51s", $data{$item}->{nr}, $data{$item}->{name});
printf(" [%s]",join(",",@{$data{$item}->{subid}}))
if defined($data{$item}->{subid});
print "\n";
}

121
v4l/scripts/diffrev.sh Normal file
View File

@@ -0,0 +1,121 @@
#/bin/bash
# Set default tree locations, if you want, at the shell ENV
#GIT_TREE=$HOME/v4l-dvb
#HG_TREE=$HOME/v4l-dvb-hg
# Should be adjusted to the environment
TMP_TREE=/tmp/oldtree
KERNVER_FILE=./v4l/scripts/etc/kern_version
FIXPATCHES=./v4l/scripts/etc/fixdiffs/*
BLACKLIST=./v4l/scripts/etc/blacklist.txt
GENTREE=./v4l/scripts/gentree.pl
if [ "$1" == "--strip-dead-code" ]; then
GENTREE_ARGS="$1"
shift
fi
if [ "$2" != "" ]; then
#
# Two arguments were given. One tree should be hg and the other git
#
if [ -e $1/.hg/hgrc ]; then
HG_TREE=$1
GIT_TREE=$2
else
HG_TREE=$2
GIT_TREE=$1
fi
else
#
# If just one argument is selected, and it is called from one tree
# use the other argument for the other tree type
# otherwise, use default plus the given tree name
#
if [ "$1" != "" ]; then
if [ -e $1/.hg/hgrc ]; then
HG_TREE=$1
if [ -e .git/config ]; then
GIT_TREE=.
fi
elif [ -e $1/.git/config ]; then
GIT_TREE=$1
if [ -e .hg/hgrc ]; then
HG_TREE=.
fi
fi
fi
fi
if [ "$GIT_TREE" == "" ]; then
echo "No git tree were provided."
ERROR=1
fi
if [ "$HG_TREE" == "" ]; then
echo "No mercurial tree were provided."
ERROR=1
fi
if [ "$ERROR" != "" ]; then
echo "Usage: $0 [--strip-dead-code] <tree1> [<tree2>]"
exit -1
fi
if [ ! -e "$GIT_TREE/.git/config" ]; then
echo "$GIT_TREE is not a git tree. Should specify a git tree to compare with the $HG_TREE mercurial tree"
exit -1
fi
if [ ! -e "$HG_TREE/.hg/hgrc" ]; then
echo "$HG_TREE is not a mercurial tree. Should specify -hg tree to compare with the $GIT_TREE git tree"
exit -1
fi
echo "comparing $HG_TREE -hg tree with $GIT_TREE -git tree."
run() {
echo $@
$@
}
echo removing oldtree..
run rm -rf $TMP_TREE
echo creating an oldtree..
run $GENTREE $GENTREE_ARGS `cat $KERNVER_FILE` $HG_TREE/linux $TMP_TREE >/dev/null
echo applying the fix patches
for i in $FIXPATCHES; do
echo $i
run patch --no-backup-if-mismatch -R -d $TMP_TREE -p2 -i $i -s
diffstat -p1 $i
done
echo removing rej/orig from $GIT_TREE
run find $GIT_TREE -name '*.rej' -exec rm '{}' \;
run find $GIT_TREE -name '*.orig' -exec rm '{}' \;
echo removing rej/orig from oldtree
run find $TMP_TREE -name '*.rej' -exec rm '{}' \;
run find $TMP_TREE -name '*.orig' -exec rm '{}' \;
echo generating "/tmp/diff"
diff -upr $TMP_TREE $GIT_TREE|grep -v ^Somente |grep -v ^Only>/tmp/diff
echo "generating /tmp/diff2 (loose diff0)"
diff -uprBw $TMP_TREE $GIT_TREE|grep -v Somente |grep -v ^Only>/tmp/diff2
echo generating /tmp/somente2 for a complete oldtree-only files
diff -upr $TMP_TREE $GIT_TREE|grep ^Somente|grep "drivers/media" |grep -vr ".o$" |grep -v ".mod.c"|grep -v ".o.cmd" |grep -v modules.order >/tmp/somente2
diff -upr $TMP_TREE $GIT_TREE|grep ^Only|grep "drivers/media" |grep -vr ".o$" |grep -v ".mod.c"|grep -v ".o.cmd" |grep -v modules.order >>/tmp/somente2
echo generating /tmp/somente for oldtree-only files
cp /tmp/somente2 /tmp/s$$
for i in `cat $BLACKLIST`; do
cat /tmp/s$$ | grep -v "Somente.* $i" >/tmp/s2$$
mv /tmp/s2$$ /tmp/s$$
done
mv /tmp/s$$ /tmp/somente
echo
echo diffstat -p1 /tmp/diff
diffstat -p1 /tmp/diff

36
v4l/scripts/do_commit.sh Executable file
View File

@@ -0,0 +1,36 @@
#!/bin/bash
EDITOR=$1
WHITESPCE=$2
if [ "$WHITESPCE" == "" ]; then
exit 13
fi
TMPMSG=$1
scripts/cardlist
scripts/prep_commit_msg.pl $WHITESPCE > $TMPMSG
#trap 'rm -rf $TMPMSG' EXIT
CHECKSUM=`md5sum "$TMPMSG"`
$EDITOR $TMPMSG || exit $?
echo "$CHECKSUM" | md5sum -c --status && echo "*** commit message not changed. Aborting. ***" && exit 13
DATE="`scripts/hghead.pl $TMPMSG|perl -ne 'if (m/\#[dD]ate:\s+(.*)/) { print $1; }'`"
if [ "$DATE" != "" ]; then
echo Patch date is $DATE
scripts/hghead.pl $TMPMSG| grep -v '^#' | hg commit -d "$DATE" -l -
else
scripts/hghead.pl $TMPMSG| grep -v '^#' | hg commit -l -
fi
if [ "$?" != "0" ]; then
echo "Couldn't apply the patch"
exit 13
fi
echo "*** PLEASE CHECK IF LOG IS OK:"
hg log -v -r -1
echo "*** If not ok, do \"hg rollback\" and \"make commit\" again"

178
v4l/scripts/do_merge.pl Executable file
View File

@@ -0,0 +1,178 @@
#!/usr/bin/perl
my $merge_tree=shift or die "Should specify the pulled tree";
sub hgrcuser($)
{
my $file = shift;
my $ui = 0;
open IN, '<', $file;
while (<IN>) {
$ui = 1 if (/^\s*\[ui\]/);
if ($ui && /^\s*username\s*=\s*(\S.*?)\s*$/) {
close IN;
return($1);
}
}
close IN;
return("");
}
sub check_heads()
{
my $count=0;
open IN, 'hg heads|';
while (<IN>) {
if (m/^[Cc]hangeset:/) {
$count++;
}
}
close IN;
return $count;
}
sub curr_changeset()
{
my $changeset = -1;
open IN, 'hg heads|';
while (<IN>) {
if (m/^[Cc]hangeset:\s*(\d+)/) {
if ($changeset < 0) {
$changeset = $1;
} else {
if ($1 < $changeset) {
$changeset = $1;
}
}
}
}
close IN;
return $changeset;
}
sub check_status()
{
my $count=0;
open IN, 'hg status -m -a -d -r|';
while (<IN>) {
$count++;
}
close IN;
return $count;
}
sub rollback()
{
print "*** ERROR *** Rolling back hg pull $merge_tree\n";
system("hg rollback");
system("hg update -C");
exit -1;
}
####################
# Determine username
# Get Hg username from environment
my $user = $ENV{HGUSER};
# Didn't work? Try the repo's .hgrc file
if ($user eq "") {
my $hgroot = `hg root`;
chomp($hgroot);
$user = hgrcuser("$hgroot/.hg/hgrc");
}
# Ok, try ~/.hgrc next
if ($user eq "") {
$user = hgrcuser("$ENV{HOME}/.hgrc");
}
# Still no luck? Try some other environment variables
if ($user eq "") {
my $name = $ENV{CHANGE_LOG_NAME};
my $email = $ENV{CHANGE_LOG_EMAIL_ADDRESS};
$user = "$name <$email>" if ($name ne "" || $email ne "");
}
# Last try to come up with something
if ($user eq "") {
print "*** ERROR *** User not known. Can't procceed\n";
exit -1;
}
######################
# Do some sanity tests
print "Checking if everything is ok, before applying the new tree.\n";
my $n_heads = check_heads();
die "Your tree currently have more than one head (it has $n_heads heads). Can't procceed\n" if ($n_heads > 1);
my $dirty = check_status();
die "Your tree currently has changes. Can't procceed\n" if ($dirty);
my $curr_cs = curr_changeset();
###########
# Pull tree
print "hg pull -u $merge_tree\n";
my $ret = system("hg pull $merge_tree");
die "Couldn't pull from $merge_tree\n" if ($ret);
#############################
# Merge and commit, if needed
$n_heads = check_heads();
if ($n_heads > 2) {
print "The merged tree have more than one head (it has $n_heads heads). Can't procceed.\n";
rollback();
}
if ($n_heads == 2) {
print "Merging the new changesets\n";
$ret = system("hg merge");
if ($ret) {
print "hg merge failed. Can't procceed.\n";
rollback();
}
print "Committing the new tree\n";
# Write the commit message
$msg= "merge: $merge_tree\n\nFrom: $user\n\nSigned-off-by: $user\n";
$ret=system("hg commit -m '$msg'");
if ($ret) {
print "hg commit failed. Can't procceed.\n";
rollback();
}
}
#####################
# Test resulting tree
print "Testing if the build didn't break compilation. Only errors and warnings will be displayed. Please wait.\n";
$ret = system ('make allmodconfig');
if (!ret) {
$ret = system ('make mismatch|egrep -v "^\s*CC"|egrep -v "^\s*LD"');
}
if ($ret) {
print "*** ERROR *** Build failed. Can't procceed.\n";
# To avoid the risk of doing something really bad, let's ask the user to run hg strip
print "Your tree is dirty. Since hg has only one rollback level, you'll need to use, instead:";
print "\thg strip $curr_cs; hg update -C";
print "You'll need to have hg mq extension enabled for hg strip to work.\n";
exit -1;
}
##############################
# Everything is ok, let's push
print "Pushing the new tree at the remote repository specified at .hg/hgrc\n";
$ret=system ("hg push");
if ($ret) {
print "hg push failed. Don't forget to do the push later.\n";
}

61
v4l/scripts/em28xx.pl Executable file
View File

@@ -0,0 +1,61 @@
#!/usr/bin/perl -w
use strict;
my $new_entry = -1;
my $nr = 0;
my ($id,$subvendor,$subdevice);
my %data;
my $debug = 0;
while (<>) {
# defines in header file
if (/#define\s+(EM2[\d][\d][\d]_BOARD_[\w\d_]+)\s+(\d+)/) {
printf("$1 = $2\n") if ($debug);
$data{$1}->{nr} = $2;
next;
}
# em2820_boards
if (/\[(EM2820_BOARD_[\w\d_]+)\]/) {
$id = $1;
printf("ID = $id\n") if $debug;
$data{$id}->{id} = $id;
$data{$id}->{type} = "(em2820/em2840)";
# $data{$id}->{nr} = $nr++;
} elsif (/\[(EM)(2[\d]..)(_BOARD_[\w\d_]+)\]/) {
$id = "$1$2$3";
printf("ID = $id\n") if $debug;
$data{$id}->{id} = $id;
$data{$id}->{type} = "(em$2)";
# $data{$id}->{nr} = $nr++;
};
next unless defined($id);
if (/USB_DEVICE.*0x([0-9a-fA-F]*).*0x([0-9a-fA-F]*)/ ) {
$subvendor=$1;
$subdevice=$2;
}
if (/.*driver_info.*(EM2[\d].._BOARD_[\w\d_]+)/ ) {
push @{$data{$1}->{subid}}, "$subvendor:$subdevice";
}
if (!defined($data{$id}) || !defined($data{$id}->{name})) {
$data{$id}->{name} = $1 if (/\.name\s*=\s*\"([^\"]+)\"/);
if (defined $data{$id}->{name} && $debug) {
printf("name[$id] = %s\n", $data{$id}->{name});
}
}
# em2820_USB_tbl
}
foreach my $item (sort { $data{$a}->{nr} <=> $data{$b}->{nr} } keys %data) {
printf("%3d -> %-40s %-15s", $data{$item}->{nr}, $data{$item}->{name}, $data{$item}->{type});
printf(" [%s]",join(",",@{$data{$item}->{subid}}))
if defined($data{$item}->{subid});
print "\n";
}

View File

@@ -0,0 +1,14 @@
\.orig
\.rej
\.cvsignore
bt87x.c
i2c-compat.h
at76c651[.][ch]
tda80xx[.][ch]
tvmixer.c
aci.[ch]
btaudio.c
dvb-ttusb-dspbootcode.h
cpia2patch.h
dabfirmware.h
^firmware/

View File

@@ -0,0 +1,18 @@
diff -upr oldtree/drivers/media/dvb/dvb-core/dvb_net.c /home/v4l/tokernel/wrk/linux-next/drivers/media/dvb/dvb-core/dvb_net.c
--- next/drivers/media/dvb/dvb-core/dvb_net.c 2010-01-15 19:05:35.000000000 -0200
+++ ../oldtree/drivers/media/dvb/dvb-core/dvb_net.c 2010-01-15 19:11:43.000000000 -0200
@@ -949,11 +949,8 @@ static int dvb_net_filter_sec_set(struct
(*secfilter)->filter_mask[10] = mac_mask[1];
(*secfilter)->filter_mask[11]=mac_mask[0];
+ dprintk("%s: filter mac=%pM\n", dev->name, mac);
+ dprintk("%s: filter mask=%pM\n", dev->name, mac_mask);
- dprintk("%s: filter mac=%02x %02x %02x %02x %02x %02x\n",
- dev->name, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
- dprintk("%s: filter mask=%02x %02x %02x %02x %02x %02x\n",
- dev->name, mac_mask[0], mac_mask[1], mac_mask[2],
- mac_mask[3], mac_mask[4], mac_mask[5]);
return 0;
}

View File

@@ -0,0 +1,24 @@
Whitespace cleanup
--- git/sound/pci/bt87x.c 2007-10-16 23:42:25.000000000 -0200
+++ ../oldtree/sound/pci/bt87x.c 2007-10-17 12:46:18.000000000 -0200
@@ -122,8 +122,8 @@ MODULE_PARM_DESC(load_all, "Allow to loa
/* RISC instruction bits */
#define RISC_BYTES_ENABLE (0xf << 12) /* byte enable bits */
#define RISC_RESYNC ( 1 << 15) /* disable FDSR errors */
-#define RISC_SET_STATUS_SHIFT 16 /* set status bits */
-#define RISC_RESET_STATUS_SHIFT 20 /* clear status bits */
+#define RISC_SET_STATUS_SHIFT 16 /* set status bits */
+#define RISC_RESET_STATUS_SHIFT 20 /* clear status bits */
#define RISC_IRQ ( 1 << 24) /* interrupt */
#define RISC_EOL ( 1 << 26) /* end of line */
#define RISC_SOL ( 1 << 27) /* start of line */
@@ -226,7 +226,7 @@ static inline void snd_bt87x_writel(stru
}
static int snd_bt87x_create_risc(struct snd_bt87x *chip, struct snd_pcm_substream *substream,
- unsigned int periods, unsigned int period_bytes)
+ unsigned int periods, unsigned int period_bytes)
{
struct snd_sg_buf *sgbuf = snd_pcm_substream_sgbuf(substream);
unsigned int i, offset;

View File

@@ -0,0 +1 @@
2.6.33

335
v4l/scripts/fix_dvb_customise.pl Executable file
View File

@@ -0,0 +1,335 @@
#!/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 (<IN>) {
# Handle line continuations
if (/\\\n$/) {
$_ .= <IN>;
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 (<IN>) {
# Handle line continuations
if (/\\\n$/) {
$_ .= <IN>;
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";
}
}
###########################
# 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
#
my %select;
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.h/;
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 if ($debug);
if ($ref =~ m/(PVRUSB2|CX23885|CX88|EM28XX|SAA3134
|SAA7164)/) {
$ref .="_DVB";
}
if (!defined($select{$ref})) {
$select{$ref} = $header;
} else {
$select{$ref} .= " " . $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 (<IN>) {
if (m/^\s*\#include\s+\"([^\"]+)\"/) {
if (defined($header{$1})) {
my $head = $header{$1};
found_ref ($file, $head);
}
}
}
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 (<IN>) {
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
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);
find({wanted => \&parse_kconfigs, no_chdir => 1}, $SRC);

19
v4l/scripts/fix_kconfig.pl Executable file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/perl
use strict;
my $need_changes = 0;
my $out;
open IN, '<.config';
while (<IN>) {
s/CONFIG_VIDEO_CX88_MPEG=y/CONFIG_VIDEO_CX88_MPEG=m/ and $need_changes=1;
$out .= $_;
}
close IN;
if ($need_changes) {
printf("There's a known bug with the building system with this kernel. Working around.\n");
open OUT, '>.config';
print OUT $out;
close OUT;
}

264
v4l/scripts/gentree.pl Normal file
View File

@@ -0,0 +1,264 @@
#!/usr/bin/perl
#
# Original version were part of Gerd Knorr's v4l scripts.
#
# Several improvements by (c) 2005-2007 Mauro Carvalho Chehab
#
# Largely re-written (C) 2007 Trent Piepho <xyzzy@speakeasy.org>
#
# Theory of Operation
#
# This acts as a sort of mini version of cpp, which will process
# #if/#elif/#ifdef/etc directives to strip out code used to support
# multiple kernel versions or otherwise not wanted to be sent upstream to
# git.
#
# Conditional compilation directives fall into two catagories,
# "processed" and "other". The "other" directives are ignored and simply
# output as they come in without changes (see 'keep' exception). The
# "processed" variaty are evaluated and only the lines in the 'true' part
# are kept, like cpp would do.
#
# If gentree knows the result of an expression, that directive will be
# "processed", otherwise it will be an "other". gentree knows the value
# of LINUX_VERSION_CODE, BTTV_VERSION_CODE, the KERNEL_VERSION(x,y,z)
# macro, numeric constants like 0 and 1, and a few defines like
# I2C_CLASS_TV_DIGITAL
#
# An exception is if the comment "/*KEEP*/" appears after the expression,
# in which case that directive will be considered an "other" and not
# processed, other than to remove the keep comment.
#
# Known bugs:
# don't specify the root directory e.g. '/' or even '////'
# directives continued with a back-slash will always be ignored
# you can't modify a source tree in-place, i.e. source dir == dest dir
use strict;
use File::Find;
use Fcntl ':mode';
use Getopt::Long;
my $DEBUG = 0;
my $dead_code = 0;
GetOptions( "--debug" => \$DEBUG,
"--strip-dead-code" => \$dead_code );
my $VERSION = shift;
my $SRC = shift;
my $DESTDIR = shift;
my $BTTVCODE = KERNEL_VERSION(0,9,17);
my ($LINUXCODE, $extra) = kernel_version($VERSION);
if (!defined($DESTDIR)) {
print "Usage:\ngentree.pl\t[--debug] <version> <source dir> <dest dir>\n\n";
exit;
}
my %defs = (
'LINUX_VERSION_CODE' => $LINUXCODE,
'BTTV_VERSION_CODE' => $BTTVCODE,
'_COMPAT_H' => 0,
'I2C_CLASS_TV_ANALOG' => 1,
'I2C_CLASS_TV_DIGITAL' => 1,
'OLD_XMIT_LOCK' => 0,
'COMPAT_SND_CTL_BOOLEAN_MONO' => 0,
'NEED_SOUND_DRIVER_H' => 0,
'TTUSB_KERNEL' => 1,
'NO_PCM_LOCK' => 0,
'NEED_ALGO_CONTROL' => 0,
);
#################################################################
# helpers
sub kernel_version($) {
$_[0] =~ m/(\d+)\.(\d+)\.(\d+)(.*)/;
return ($1*65536 + $2*256 + $3, $4);
}
# used in eval()
sub KERNEL_VERSION($$$) { return $_[0]*65536 + $_[1]*256 + $_[2]; }
sub evalexp($) {
local $_ = shift;
s|/\*.*?\*/||go; # delete /* */ comments
s|//.*$||o; # delete // comments
s/\bdefined\s*\(/(/go; # defined(foo) to (foo)
while (/\b([_A-Za-z]\w*)\b/go) {
if (exists $defs{$1}) {
my $id = $1; my $pos = $-[0];
s/$id/$defs{$id}/;
pos = $-[0];
} elsif ($1 ne 'KERNEL_VERSION') {
return(undef);
}
}
return(eval($_) ? 1 : 0);
}
#################################################################
# filter out version-specific code
sub filter_source ($$) {
my ($in,$out) = @_;
my $line;
my $level=0;
my %if = ();
my %state = ();
my @dbgargs = \($level, %state, %if, $line);
sub dbgline($\@) {
my $level = ${$_[1][0]};
printf STDERR ("/* BP %4d $_[0] state=$_[1][1]->{$level} if=$_[1][2]->{$level} level=$level (${$_[1][3]}) */\n", $.) if $DEBUG;
}
open IN, '<', $in or die "Error opening $in: $!\n";
open OUT, '>', $out or die "Error opening $out: $!\n";
print STDERR "File: $in, for kernel $VERSION($LINUXCODE)/\n" if $DEBUG;
while ($line = <IN>) {
chomp $line;
next if ($line =~ m/^#include \"compat.h\"/o);
# next if ($line =~ m/[\$]Id:/);
# For "#if 0 /*KEEP*/;" the ; should be dropped too
if ($line =~ m@^\s*#\s*if(n?def)?\s.*?(\s*/\*\s*(?i)keep\s*\*/;?)@) {
$state{$level} = "ifother";
$if{$level} = 1;
dbgline "#if$1 (keep)", @dbgargs;
$line =~ s/\Q$2\E//;
$level++;
}
# preserve #if 0/#if 1, if $dead_code = 0
elsif (!$dead_code && $line =~ m@^\s*#\s*if\s*([01])[^\d]@) {
$state{$level} = "ifother";
$if{$level} = 1;
dbgline "#if $1", @dbgargs;
$level++;
}
# handle all ifdef/ifndef lines
elsif ($line =~ /^\s*#\s*if(n?)def\s*(\w+)/o) {
if (exists $defs{$2}) {
$state{$level} = 'if';
$if{$level} = ($1 eq 'n') ? !$defs{$2} : $defs{$2};
dbgline "#if$1def $2", @dbgargs;
$level++;
next;
}
$state{$level} = "ifother";
$if{$level} = 1;
dbgline "#if$1def (other)", @dbgargs;
$level++;
}
# handle all ifs
elsif ($line =~ /^\s*#\s*if\s+(.*)$/o) {
my $res = evalexp($1);
if (defined $res) {
$state{$level} = 'if';
$if{$level} = $res;
dbgline '#if '.($res?'(yes)':'(no)'), @dbgargs;
$level++;
next;
} else {
$state{$level} = 'ifother';
$if{$level} = 1;
dbgline '#if (other)', @dbgargs;
$level++;
}
}
# handle all elifs
elsif ($line =~ /^\s*#\s*elif\s+(.*)$/o || $line =~ /^\s*#\s*elseif\s+(.*)$/o) {
my $exp = $1;
$level--;
$level < 0 and die "more elifs than ifs";
$state{$level} =~ /if/ or die "unmatched elif";
if ($state{$level} eq 'if' && !$if{$level}) {
my $res = evalexp($exp);
defined $res or die 'moving from if to ifother';
$state{$level} = 'if';
$if{$level} = $res;
dbgline '#elif1 '.($res?'(yes)':'(no)'), @dbgargs;
$level++;
next;
} elsif ($state{$level} ne 'ifother') {
$if{$level} = 0;
$state{$level} = 'elif';
dbgline '#elif0', @dbgargs;
$level++;
next;
}
$level++;
}
elsif ($line =~ /^\s*#\s*else/o) {
$level--;
$level < 0 and die "more elses than ifs";
$state{$level} =~ /if/ or die "unmatched else";
$if{$level} = !$if{$level} if ($state{$level} eq 'if');
$state{$level} =~ s/^if/else/o; # if -> else, ifother -> elseother, elif -> elif
dbgline '#else', @dbgargs;
$level++;
next if $state{$level-1} !~ /other$/o;
}
elsif ($line =~ /^\s*#\s*endif/o) {
$level--;
$level < 0 and die "more endifs than ifs";
dbgline '#endif', @dbgargs;
next if $state{$level} !~ /other$/o;
}
my $print = 1;
for (my $i=0;$i<$level;$i++) {
next if $state{$i} =~ /other$/o; # keep code in ifother/elseother blocks
if (!$if{$i}) {
$print = 0;
dbgline 'DEL', @{[\$i, \%state, \%if, \$line]};
last;
}
}
print OUT "$line\n" if $print;
}
close IN;
close OUT;
}
#################################################################
sub parse_dir {
my $file = $File::Find::name;
return if ($file =~ /CVS/);
return if ($file =~ /~$/);
my $f2 = $file;
$f2 =~ s/^\Q$SRC\E/$DESTDIR/;
my $mode = (stat($file))[2];
if ($mode & S_IFDIR) {
print("mkdir -p '$f2'\n");
system("mkdir -p '$f2'"); # should check for error
return;
}
print "from $file to $f2\n";
if ($file =~ m/.*\.[ch]$/) {
filter_source($file, $f2);
} else {
system("cp $file $f2");
}
}
# main
printf "kernel is %s (0x%x)\n",$VERSION,$LINUXCODE;
# remove any trailing slashes from dir names. don't pass in just '/'
$SRC =~ s|/*$||; $DESTDIR =~ s|/*$||;
print "finding files at $SRC\n";
find({wanted => \&parse_dir, no_chdir => 1}, $SRC);

30
v4l/scripts/headers_convert.pl Executable file
View File

@@ -0,0 +1,30 @@
#!/usr/bin/perl
#
# headers_install prepare the listed header files for use in
# user space and copy the files to their destination.
#
use strict;
use warnings;
foreach (@ARGV) {
my $file = $_;
my $tmpfile = $file . ".tmp";
open(my $infile, '<', "$file")
or die "$file: $!\n";
open(my $outfile, '>', "$tmpfile") or die "$tmpfile: $!\n";
while (my $line = <$infile>) {
$line =~ s/([\s(])__user\s/$1/g;
$line =~ s/([\s(])__force\s/$1/g;
$line =~ s/([\s(])__iomem\s/$1/g;
$line =~ s/\s__attribute_const__\s/ /g;
$line =~ s/\s__attribute_const__$//g;
$line =~ s/^#include <linux\/compiler.h>//;
printf $outfile "%s", $line;
}
close $outfile;
close $infile;
system "mv $tmpfile $file";
}
exit 0;

125
v4l/scripts/hg-pull-req.pl Executable file
View File

@@ -0,0 +1,125 @@
#!/usr/bin/perl
# Copyright (C) 2006 Trent Piepho <xyzzy@speakeasy.org>
# Automatic pull request generator
# Generates a pull request for all changesets in current Hg repository, that
# do not appear in a remote repository.
#
# There are _three_ repositories involved in this operation.
#
# The first is the remote repository that you want your changes to be pulled
# into. The default is the master repository at
# http://linuxtv.org/hg/v4l-dvb, but you can specify something else if you
# want. This repository is called the "to repo".
#
# The next two repositories should be copies of each other. The first is your
# local repository. You must run this script from some directory in that
# repository. The second repository is a remote copy on some public server,
# e.g. linuxtv.org. This is called the "from repo". The default for the from
# repo is the "default-push" path from the Hg configuration, which is where hg
# will push to if you don't specify a path to "hg push". The script will do
# some checks to make sure these two repositories are copies of each other.
#
# The repository used to the changesets are comming from is local repository,
# due to Mercurial's limitations. However, links to your local repository
# would be useless in a pull request, because no one else can see your local
# repository. So, the links are change to use the "from repo" instead. This
# is why your local repo and the from repo must be copies of each other.
# Running "hg push" before generating the pull request should be enough.
$maintainer = 'Mauro';
$to_repo = 'http://linuxtv.org/hg/v4l-dvb';
# Default for when a default-push path wasn't defined
$from_repo_base = 'http://linuxtv.org/hg/~username/';
# What to open for the pull request
$output_file = '>&STDOUT';
# Example, to a local file: '>pull_req'
# Example, file on remote host: '|ssh remote.host.com cat \\> pull_req'
# Text of the pull request. $nstr is e.g. "changeset" or "42 changesets"
$salutation = <<'EOF';
$maintainer,
Please pull from $from_repo
for the following $nstr:
EOF
# The closing of the request, name and fname taken from hg username setting
$valediction = <<'EOF';
Thanks,
$fname
EOF
if($#ARGV < 0) {
if(`hg showconfig paths` =~ m/^paths\.default-push=(.*)$/m) {
$from_repo = $1;
$from_repo =~ s/^ssh:/http:/;
} else {
`hg root` =~ m|/([^/]+)\n$|;
my $repo = $1;
$from_repo = $from_repo_base . $repo;
}
}
$from_repo = $ARGV[0] if($#ARGV >= 0);
$to_repo = $ARGV[1] if($#ARGV >= 1);
open OUT, $output_file or die "Opening: $!";
if (`hg outgoing $from_repo` !~ /^no changes found$/m ||
`hg incoming $from_repo` !~ /^no changes found$/m) {
my $cur = `hg root`; chomp $cur;
print "$cur and $from_repo do not match!\n";
print "Prehaps you forgot to push your changes?\n";
exit;
}
open IN, "hg outgoing -M $to_repo |";
while(<IN>) {
if(/^changeset:\s+\d+:([[:xdigit:]]{12})$/) {
push @changesets, $1;
} elsif(/^summary:\s+(\S.*)$/) {
if ($1 =~ /^merge:/) {
# Skip merge changesets
pop @changesets;
} else {
push @summaries, $1;
}
}
}
close IN;
$#changesets == $#summaries or die "Confused by hg outgoing output";
foreach (0 .. $#summaries) {
if($summaries[$_] =~ /^merge:/) {
splice @summaries, $_, 1;
splice @changesets, $_, 1;
}
}
$n = $#changesets + 1;
$n > 0 or die "Nothing to pull!";
$nstr = ($n==1)?"changeset":"$n changesets";
print OUT eval qq("$salutation");
for (0 .. $#summaries) {
printf OUT "%02d/%02d: $summaries[$_]\n", $_+1, $n;
print OUT "$from_repo?cmd=changeset;node=$changesets[$_]\n";
print OUT "\n";
}
print OUT "\n";
open IN, 'hg export ' . join(' ', @changesets) . '| diffstat |';
print OUT while(<IN>);
close IN;
`hg showconfig ui.username` =~ m/((\S+).*)\s+</;
my $name = $1; my $fname = $2;
print OUT eval qq("$valediction");

221
v4l/scripts/hghead.pl Executable file
View File

@@ -0,0 +1,221 @@
#!/usr/bin/perl
use strict;
#################################################################
# analyse diffs
my $in = shift;
my $line;
my $subject;
my $sub_ok=0;
my $init=0;
my $num=0;
my $hgimport=0;
my $mmimport=0;
my $maint_ok=0;
my $noblank=1;
my $maintainer_name=$ENV{CHANGE_LOG_NAME};
my $maintainer_email=$ENV{CHANGE_LOG_EMAIL_ADDRESS};
my $from="";
my $body="";
my $priority="";
my $signed="";
my $fromname="";
open IN, "<$in";
while ($line = <IN>) {
if ($line =~ m/^\s*Index.*/) {
last;
}
if ($line =~ m/^diff .*/) {
last;
}
if ($line =~ m/^\-\-\- .*/) {
last;
}
if ($line =~ m/^\-\-\-\-.*/) {
$body="";
next;
}
if ($line =~ m/^\-\-\-.*/) {
last;
}
if ($line =~ m/^\+\+\+ .*/) {
last;
}
if ($line =~ m/^#\s*Date\s*(.*)/) {
print "#Date: $1\n";
next;
}
if ($line =~ m/^Date:\s*(.*)/) {
print "#Date: $1\n";
next;
}
$line =~ s/^#\sUser/From:/;
my $tag=$line;
my $arg=$line;
$tag =~ s/\s*([^\s]+:)\s*(.*)\n/\1/;
$arg =~ s/\s*([^\s]+:)\s*(.*)\n/\2/;
$tag =~ tr/A-Z/a-z/;
if ($tag =~ m/^from:/) {
if ($arg =~ m/^[\s\"]*([^\"]*)[\s\"]*<(.*)>/) {
if ($1 eq "") {
next;
}
my $name=$1;
my $email=$2;
$name =~ s/\s+$//;
$email =~ s/\s+$//;
$fromname="$name <$email>";
$from= "From: $fromname\n";
next;
}
if ($line =~ m/^From:\sakpm\@osdl.org/) {
$mmimport=1;
next;
}
print "Bad: author line have a wrong syntax: $line\n";
die;
}
if ($tag =~ m/^subject:/) {
$subject = "$arg\n";
$sub_ok = 1;
next;
}
if ($tag =~ m/^priority:/) {
$arg =~ tr/A-Z/a-z/;
# Replace the -git branch names for high/normal/low
$arg =~ s/^fixes$/high/;
$arg =~ s/^fix$/high/;
$arg =~ s/^working$/normal/;
$arg =~ s/^work$/normal/;
$arg =~ s/^pending$/low/;
$priority = "Priority: $arg";
next;
}
if ($line =~ m;^ .*\/.*\| *[0-9]*;) {
next;
}
if ($line =~m/\d+\s*file.* changed, /) {
next;
}
if ($tag =~ m/^signed-off-by:.*/) {
$noblank=1;
if ($line =~ m/$maintainer_name/) {
$maint_ok=1;
}
$signed="$signed$line";
next;
}
if ( ($line =~ m/^\# HG changeset patch/) ||
($line =~ m/^has been added to the -mm tree. Its filename is/) ) {
$sub_ok=0;
$init=0;
$num=0;
$maint_ok=0;
$noblank=1;
$from="";
$body="";
$subject="";
$hgimport=1;
next;
}
if ($tag =~ m/^(acked-by|thanks-to|reviewed-by|noticed-by|tested-by|cc):/) {
$signed="$signed$line";
next;
}
# Keep review lines together with the signatures
if ($line =~ m/^\[.*\@.*\:.*\]\n/) {
$signed="$signed$line";
next;
}
if ($tag =~ m/changeset:\s*(.*)\n/) {
$num=$1;
}
if ($line =~ m|^(V4L\/DVB\s*\(.+\)\s*:.*\n)|) {
$subject=$1;
$sub_ok = 1;
$line="\n";
}
if ($line =~ m/^#/) {
next;
}
if ($sub_ok == 0) {
if ($line =~ m/^\s*\n/) {
next;
}
$sub_ok=1;
if ($subject =~ m|V4L\/DVB\s*(.+)|) {
$subject=$1;
}
$subject=$line;
next;
}
if ($noblank) {
if ($line =~ m/^\n/) {
next;
}
}
if (!$init) {
$init=1;
$noblank=0;
}
$body="$body$line";
}
close IN;
if ($from eq "") {
print "Bad: author doesn't exist!\n";
die;
}
if (!$maint_ok && $maintainer_name && $maintainer_email) {
print "#No maintainer's signature. Adding it.\n";
$signed=$signed."Signed-off-by: $maintainer_name <$maintainer_email>\n";
}
if (!$signed =~ m/$from/) {
print "Bad: Author didn't signed his patch!\n";
die;
}
$from=~s/^[\n\s]+//;
$from=~s/[\n\s]+$//;
$subject=~s/^[\n\s]+//;
$subject=~s/[\n\s]+$//;
$body=~s/^[\n]+//;
$body=~s/[\n\s]+$//;
if ($priority ne "") {
$body="$body\n\n$priority";
}
$body="$body\n\n$signed";
$body=~s/^[\n\s]+//;
$body=~s/[\n\s]+$//;
# First from is used by hg to recognize commiter name
print "#Committer: $maintainer_name <$maintainer_email>\n";
print "$subject\n\n$from\n\n$body\n";

133
v4l/scripts/hwdata.pl Executable file
View File

@@ -0,0 +1,133 @@
#!/usr/bin/perl -w
# This script is used to generate hwdata pci info. We are going to
# submit this data periodically to linux PCI ID's Project http://pciids.sf.net
my %map = (
"PCI_ANY_ID" => "0",
"PCI_VENDOR_ID_PHILIPS" => "1131",
"PCI_VENDOR_ID_ASUSTEK" => "1043",
"PCI_VENDOR_ID_MATROX" => "102B",
"PCI_VENDOR_ID_ATI" => "1002",
);
sub fix_id($) {
my $id = shift;
$id = $map{$id} if defined($map{$id});
$id =~ s/^0x//;
return $id;
}
open ($input, "../saa7134-cards.c");
print ("\n");
print ("1131 Philips Semiconductors\n");
my %data;
while (<$input>) {
if (/\[(SAA7134_BOARD_\w+)\]/) {
$id = $1;
$data{$id}->{id} = $id;
$data{$id}->{subvendor} = "0";
};
next unless defined($id);
if (!defined($data{$id}) || !defined($data{$id}->{name})) {
$data{$id}->{name} = $1 if (/\.name\s*=\s*\"([^\"]+)\"/);
}
# saa7134_pci_tbl
$device = $1 if (/\.device\s*=\s*(\w+),/);
$subvendor = fix_id($1) if (/\.subvendor\s*=\s*(\w+),/);
$subdevice = fix_id($1) if (/\.subdevice\s*=\s*(\w+),/);
if (/.driver_data\s*=\s*(\w+),/) {
if (defined($data{$1}) &&
defined($subvendor) && $subvendor ne "0" &&
defined($subdevice) && $subdevice ne "0" &&
defined($device)) {
$data{$1}->{device} = $device;
$data{$1}->{subvendor} = $subvendor;
$data{$1}->{subdevice} = $subdevice;
undef $device;
undef $subvendor;
undef $subdevice;
}
}
}
sub print_cards ($) {
my $filter = shift;
foreach my $item (sort {$data{$a}->{subvendor} cmp $data{$b}->{subvendor}} keys (%data))
{
if (defined ($data{$item}->{device}) && ($data{$item}->{device} eq $filter)) {
printf("\t\t");
printf("%s %s %s", $data{$item}->{subvendor}, $data{$item}->{subdevice}, $data{$item}->{name});
print "\n";
}
}
}
print ("\t7130 SAA7130 Video Broadcast Decoder\n");
print_cards ("PCI_DEVICE_ID_PHILIPS_SAA7130");
print ("\t7133 SAA7133/SAA7135 Video Broadcast Decoder\n");
print_cards ("PCI_DEVICE_ID_PHILIPS_SAA7133");
print ("\t7134 SAA7134 Video Broadcast Decoder\n");
print_cards ("PCI_DEVICE_ID_PHILIPS_SAA7134");
open ($input, "../cx88-cards.c");
%data=();
while (<$input>) {
if (/\[(CX88_BOARD_\w+)\]/) {
$id = $1;
$data{$id}->{id} = $id;
$data{$id}->{subvendor} = "0";
};
next unless defined($id);
if (!defined($data{$id}) || !defined($data{$id}->{name})) {
$data{$id}->{name} = $1 if (/\.name\s*=\s*\"([^\"]+)\"/);
}
$subvendor = fix_id($1) if (/\.subvendor\s*=\s*(\w+),/);
$subdevice = fix_id($1) if (/\.subdevice\s*=\s*(\w+),/);
if (/.card\s*=\s*(\w+),/) {
if (defined($data{$1}) &&
defined($subvendor) && $subvendor ne "0" &&
defined($subdevice) && $subdevice ne "0") {
$data{$1}->{subvendor} = $subvendor;
$data{$1}->{subdevice} = $subdevice;
undef $subvendor;
undef $subdevice;
}
}
}
print ("14f1 Conexant\n");
print ("\t8800 CX23880/1/2/3 PCI Video and Audio Decoder\n");
foreach my $item (sort {$data{$a}->{subvendor} cmp $data{$b}->{subvendor}} keys (%data))
{
if (defined ($data{$item}->{subdevice}) && ($data{$item}->{subvendor} ne "0")) {
printf("\t\t");
printf("%s %s %s", $data{$item}->{subvendor}, $data{$item}->{subdevice}, $data{$item}->{name});
print "\n";
}
}
print ("109e Brooktree Corporation\n");
print ("\t032e Bt878 Video Capture\n");
%data=();
open ($input, "../bttv-cards.c");
while (<$input>) {
if (/\{\s*0x(\w{4})(\w{4}),.*\"([^\"]+)\"\s\},/)
{
printf ("\t\t%s %s %s\n", $2, $1, $3);
}
}
printf ("\n");

422
v4l/scripts/make_config_compat.pl Executable file
View File

@@ -0,0 +1,422 @@
#!/usr/bin/perl
use strict;
my $kdir=shift or die "should specify a kernel dir";
my $infile=shift or die "should specify an input config file";
my $outfile=shift or die "should specify an output config file";
my $out;
sub check_spin_lock()
{
my $file = "$kdir/include/linux/netdevice.h";
my $old_syntax = 1;
open INNET, "<$file" or die "File not found: $file";
while (<INNET>) {
if (m/netif_tx_lock_bh/) {
$old_syntax = 0;
last;
}
}
if ($old_syntax) {
$out.= "\n#define OLD_XMIT_LOCK 1\n";
}
close INNET;
}
sub check_sound_driver_h()
{
my $file = "$kdir/include/sound/driver.h";
my $old_syntax = 1;
open INNET, "<$file" or return;
while (<INNET>) {
if (m/This file is deprecated/) {
$old_syntax = 0;
last;
}
}
if ($old_syntax) {
$out.= "\n#define NEED_SOUND_DRIVER_H 1\n";
}
close INNET;
}
sub check_snd_pcm_rate_to_rate_bit()
{
my $file = "$kdir/include/sound/pcm.h";
my $old_syntax = 1;
open INNET, "<$file" or die "File not found: $file";
while (<INNET>) {
if (m/snd_pcm_rate_to_rate_bit/) {
$old_syntax = 0;
last;
}
}
if ($old_syntax) {
$out.= "\n#define COMPAT_PCM_TO_RATE_BIT 1\n";
}
close INNET;
}
sub check_snd_ctl_boolean_mono_info()
{
my $file = "$kdir/include/sound/control.h";
my $old_syntax = 1;
open INNET, "<$file" or die "File not found: $file";
while (<INNET>) {
if (m/snd_ctl_boolean_mono_info/) {
$old_syntax = 0;
last;
}
}
if ($old_syntax) {
$out.= "\n#define COMPAT_SND_CTL_BOOLEAN_MONO 1\n";
}
close INNET;
}
sub check_bool()
{
my $file = "$kdir/include/linux/types.h";
my $old_syntax = 1;
open INDEP, "<$file" or die "File not found: $file";
while (<INDEP>) {
if (m/^\s*typedef.*bool;/) {
$old_syntax = 0;
last;
}
}
if ($old_syntax) {
$out.= "\n#define NEED_BOOL_TYPE 1\n";
}
close INDEP;
}
sub check_is_singular()
{
my $file = "$kdir/include/linux/list.h";
my $need_compat = 1;
open INNET, "<$file" or die "File not found: $file";
while (<INNET>) {
if (m/list_is_singular/) {
$need_compat = 0;
last;
}
}
if ($need_compat) {
$out.= "\n#define NEED_IS_SINGULAR 1\n";
}
close INNET;
}
sub check_clamp()
{
my $file = "$kdir/include/linux/kernel.h";
my $need_compat = 1;
open INNET, "<$file" or die "File not found: $file";
while (<INNET>) {
if (m/define\s+clamp/) {
$need_compat = 0;
last;
}
}
if ($need_compat) {
$out.= "\n#define NEED_CLAMP 1\n";
}
close INNET;
}
sub check_proc_create()
{
my $file = "$kdir/include/linux/proc_fs.h";
my $need_compat = 1;
open INNET, "<$file" or die "File not found: $file";
while (<INNET>) {
if (m/proc_create/) {
$need_compat = 0;
last;
}
}
if ($need_compat) {
$out.= "\n#define NEED_PROC_CREATE 1\n";
}
close INNET;
}
sub check_pcm_lock()
{
my $file = "$kdir/include/sound/pcm.h";
my $need_compat = 1;
open INNET, "<$file" or die "File not found: $file";
while (<INNET>) {
if (m/pcm_stream_lock/) {
$need_compat = 0;
last;
}
}
if ($need_compat) {
$out.= "\n#define NO_PCM_LOCK 1\n";
}
close INNET;
}
sub check_algo_control()
{
my $file = "$kdir/include/linux/i2c.h";
my $need_compat = 0;
open INNET, "<$file" or die "File not found: $file";
while (<INNET>) {
if (m/algo_control/) {
$need_compat = 1;
last;
}
}
if ($need_compat) {
$out.= "\n#define NEED_ALGO_CONTROL 1\n";
}
close INNET;
}
sub check_net_dev()
{
my $file = "$kdir/include/linux/netdevice.h";
my $need_compat = 1;
open INNET, "<$file" or die "File not found: $file";
while (<INNET>) {
if (m/netdev_priv/) {
$need_compat = 0;
last;
}
}
if ($need_compat) {
$out.= "\n#define NEED_NETDEV_PRIV 1\n";
}
close INNET;
}
sub check_usb_endpoint_type()
{
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/pci_ioremap_bar/) {
$need_compat = 0;
last;
}
}
if ($need_compat) {
$out.= "\n#define NEED_PCI_IOREMAP_BAR 1\n";
}
close INNET;
}
sub check_snd_card_create()
{
my $file = "$kdir/include/sound/core.h";
my $need_compat = 1;
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_SND_CARD_CREATE\n";
}
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_snd_BUG_ON()
{
my @files = ( "$kdir/include/sound/core.h" );
foreach my $file ( @files ) {
open IN, "<$file" or die "File not found: $file";
while (<IN>) {
if (m/snd_BUG_ON/) {
close IN;
# definition found. No need for compat
return;
}
}
close IN;
}
# definition not found. This means that we need compat
$out.= "\n#define NEED_SND_BUG_ON 1\n";
}
sub check_bitops()
{
my @files = ( "$kdir/include/linux/bitops.h" );
foreach my $file ( @files ) {
open IN, "<$file" or next;
while (<IN>) {
if (m/#define\s+BIT\(/) {
close IN;
# definition found. No need for compat
return;
}
}
close IN;
}
# definition not found. This means that we need compat
$out.= "\n#define NEED_BITOPS 1\n";
}
sub check_delayed_work()
{
my @files = ( "$kdir//include/linux/workqueue.h" );
foreach my $file ( @files ) {
open IN, "<$file" or die "File not found: $file";
while (<IN>) {
if (m/struct\s+delayed_work/) {
close IN;
# definition found. No need for compat
return;
}
}
close IN;
}
# definition not found. This means that we need compat
$out.= "\n#define NEED_DELAYED_WORK 1\n";
}
sub check_other_dependencies()
{
check_spin_lock();
check_sound_driver_h();
check_snd_ctl_boolean_mono_info();
check_snd_pcm_rate_to_rate_bit();
check_bool();
check_is_singular();
check_clamp();
check_proc_create();
check_pcm_lock();
check_algo_control();
check_net_dev();
check_usb_endpoint_type();
check_pci_ioremap_bar();
check_snd_card_create();
check_poll_schedule();
check_snd_BUG_ON();
check_bitops();
check_delayed_work();
}
# Do the basic rules
open IN, "<$infile" or die "File not found: $infile";
$out.= "#ifndef __CONFIG_COMPAT_H__\n";
$out.= "#define __CONFIG_COMPAT_H__\n\n";
$out.= "#include <linux/version.h>\n\n";
$out.= "#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)\n";
$out.= "#include <generated/autoconf.h>\n";
$out.= "#else\n";
$out.= "#include <linux/autoconf.h>\n";
$out.= "#endif\n\n";
# mmdebug.h includes autoconf.h. So if this header exists,
# then include it before our config is set.
if (-f "$kdir/include/linux/mmdebug.h") {
$out.= "#include <linux/mmdebug.h>\n\n";
}
while(<IN>) {
next unless /^(\S+)\s*:= (\S+)$/;
$out.= "#undef $1\n";
$out.= "#undef $1_MODULE\n";
if($2 eq "n") {
next;
} elsif($2 eq "m") {
$out.= "#define $1_MODULE 1\n";
} elsif($2 eq "y") {
$out.= "#define $1 1\n";
} else {
$out.= "#define $1 $2\n";
}
}
close IN;
check_other_dependencies();
open OUT, ">$outfile" or die 'Unable to write $outfile';
print OUT "$out\n#endif\n";
close OUT

683
v4l/scripts/make_kconfig.pl Executable file
View File

@@ -0,0 +1,683 @@
#!/usr/bin/perl
use FileHandle;
use strict;
my %depend = ();
my %minver = ();
my %config = ();
my %stringopt = ();
my %intopt = ();
my %hexopt = ();
my %tristate = ();
my %kernopts = ();
my %depmods = ();
my ($version, $level, $sublevel, $kernver);
my $kernel = shift;
my $kernsrc = shift;
my $force_kconfig = shift;
my $debug=0;
###########################################################
# Read a .config file (first argument) and put the resulting options in a
# hash, which is returned. This subroutine should be called in a hash
# context or it will not be very useful.
sub process_config($)
{
my $filename = shift;
my %conf;
my $in = new FileHandle;
open $in, $filename or die "File not found: $filename";
while (<$in>) {
if (/^CONFIG_(\w+)\s*=\s*(\S.*?)\s*$/) {
my $c = \($conf{$1} = $2);
$$c =~ y/nmy/012/ if $$c =~ /^.$/;
next;
}
if (/^# CONFIG_(\w+) is not set$/) {
$conf{$1} = 0;
next;
}
unless (/^#|$/) {
print "Confused by this line in $filename:\n$_";
}
}
close $in;
return %conf;
}
sub add_bool($)
{
my $arg=shift;
exists $config{$arg} or die "Adding unknown boolean '$arg'";
print "Boolean: $arg\n" if $debug;
$tristate{$arg} = "bool";
}
sub add_tristate($)
{
my $arg=shift;
exists $config{$arg} or die "Adding unknown tristate '$arg'";
print "Tristate: $arg\n" if $debug;
$tristate{$arg}="tristate";
# tri default is 'm'
$config{$arg} = 1 if($config{$arg});
}
sub add_int($)
{
my $arg=shift;
print "Int: $arg\n" if $debug;
exists $config{$arg} or die "Adding unknown int '$arg'";
$intopt{$arg} = 0;
}
sub add_hex($)
{
my $arg=shift;
print "Hex: $arg\n" if $debug;
exists $config{$arg} or die "Adding unknown hex '$arg'";
$hexopt{$arg} = 0;
}
sub add_string($)
{
my $arg=shift;
print "String: $arg\n" if $debug;
exists $config{$arg} or die "Adding unknown string '$arg'";
$stringopt{$arg} = "";
}
sub set_int_value($$)
{
my $key = shift;
my $val = shift;
exists $intopt{$key} or die "Default for unknown int option '$key'";
$intopt{$key} = $val;
}
sub set_hex_value($$)
{
my $key = shift;
my $val = shift;
exists $hexopt{$key} or die "Default for unknown hex option '$key'";
$hexopt{$key} = "0x$val";
}
sub set_string_value($$)
{
my $key = shift;
my $val = shift;
exists $stringopt{$key} or die "Default for unknown string option '$key'";
$stringopt{$key} = "\"$val\"";
}
sub add_config($)
{
my $arg = shift;
if ($arg =~ /^(\w+)\s*$/) {
$config{$1} = 2;
} else {
die "Do not understand config variable '$arg'";
}
}
########################################
# Turn option off, iff it already exists
sub disable_config($)
{
my $key = shift;
$config{$key} = 0 if (exists $config{$key});
}
# %{$depend{'FOO'}} lists all variables which depend on FOO. This is the
# reverse of the variables that FOO depends on.
my %depend = ();
sub finddeps($$)
{
my $key = shift;
my $deps = shift;
$deps =~ s/^\W+//;
$depend{$_}{$key} = 1 foreach(split(/\W[\Wynm]*/, $deps));
}
# @{$depends{'FOO'}} is a list of dependency expressions that FOO depends
# on. This is the reverse of the variables that depend on FOO.
my %depends = ();
sub depends($$)
{
my $key = shift;
my $deps = shift;
(!defined $key || $key eq '') and
die "Got bad key with $deps\n";
finddeps($key, $deps);
push @{$depends{$key}}, $deps;
}
sub selects($$$)
{
my $key = shift;
my $select = shift;
my $if = shift;
finddeps($key, $select);
if(defined $if) {
finddeps($key, $if);
# Transform "select X if Y" into "depends on !Y || X"
$select = "!($if) || ($select)";
}
push @{$depends{$key}}, $select;
}
# Needs:
# %depend <- %depend{FOO} lists the variables that depend on FOO
# %depends <- %depends{FOO} lists the dependency expressions for FOO
# %config <- the value of all media variables
# %kernopts <- the value of all kernel variables (including media ones)
#
# Checks the dependencies of all media variables, recursively. Returns
# a new hash that has the new values of all media variables.
sub checkdeps()
{
my %allconfig;
@allconfig{keys %depend} = @kernopts{keys %depend};
@allconfig{keys %config} = values %config;
# Set undef values to 0
map { defined $_ or $_ = 0 } values %allconfig;
# First run, check deps for all the v4l-dvb variables. Following
# runs, check all variables which depend on a variable that was
# changed. Stop when no more variables change.
for(my %changed = (), my @tocheck = keys %config; @tocheck;
@tocheck = keys %changed, %changed = ()) {
foreach (@tocheck) {
next unless($allconfig{$_}); # skip disabled vars
if (!checkvardeps($_)) {
$changed{$_} = 1 foreach keys %{$depend{$_}};
}
}
}
return map { $_ => $allconfig{$_} } keys %config;
# Check the dependencies of a variable, if one fails the variable
# is set to 0. Returns 0 if the variable failed, 1 if it passed.
sub checkvardeps($) {
my $key = shift;
my $deps = $depends{$key};
foreach (@$deps) {
next if($_ eq '');
if (!eval(toperl($_))) {
print "Disabling $key, dependency '$_' not met\n" if $debug;
$allconfig{$key} = 0;
return 0;
}
}
return 1;
}
# Convert a Kconfig expression to a Perl expression
sub toperl($)
{
local $_ = shift;
# Turn n,m,y into 0,1,2
s/\bn\b/0/g; s/\bm\b/1/g; s/\by\b/2/g;
# Turn = into ==, but keep != as != (ie. not !==)
s/(?<!!)=/==/g;
# Turn FOO into the value of $allconfig{FOO}
s/\b([A-Za-z_]\w*)\b/$allconfig{$1}/g;
return $_;
}
}
# Text to be added to disabled options
my $disabled_msg = <<'EOF';
---help---
WARNING! This driver needs at least kernel %s! It may not
compile or work correctly on your kernel, which is too old.
EOF
# List of all kconfig files read in, used to make dependencies for the
# output combined Kconfig file.
my @kconfigfiles = ();
# "if" statements found in Kconfig files.
my @kifs = ();
# Read and parse a Kconfig file. First argument is base of source
# directory tree, the second is the file to open (with path). Recursivly
# parses Kconfig files from 'source' directives.
#
# Prints to OUT a combined version of all the Kconfig files. This file
# is edited slightly to disable options that need a newer kernel.
sub open_kconfig($$) {
my ($dir,$file)=@_;
my $in = new FileHandle;
my $key;
my $disabled = 0;
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,
# but that is a pain to keep track of.
if ($in_help && /^\S/) {
$in_help = 0;
} elsif ($in_help) {
# Still inside help text
next;
}
# Start of help text
if (/^\s*(---)?help(---)?\s*$/) {
$in_help = 1;
# Insert VIDEO_KERNEL_VERSION dependency, default
# n line, and help text note for disabled drivers.
if ($disabled) {
if(exists $tristate{$key} && !$default_seen) {
print OUT "\tdefault n\n";
}
print OUT "\tdepends on VIDEO_KERNEL_VERSION\n";
$line = sprintf($disabled_msg, $minver{$key});
}
next;
}
# No help text should get processed past this point
$in_help and die "I'm very confused";
# start of a new stanza, reset
if (/^\w/) {
$disabled = 0;
$default_seen = 0;
$key = undef;
$if = "";
}
next if (/^\s*#/ || /^\s*$/); # skip comments and blank lines
# Erase any comments on this line
s/(?<!\\)#(.*)$//;
if (m|^\s*source\s+"([^"]+)"\s*$| ||
m|^\s*source\s+(\S+)\s*$|) {
open_kconfig($dir, "$dir/$1");
$line = ''; # don't print the source line itself
next;
}
my $nothandled = 0;
if (m|^\s*(?:menu)?config (\w+)\s*$|) {
$key = $1;
$if = "";
print "Found config '$key' at $file:$.\n" if $debug;
add_config($key);
if (exists $minver{$key} &&
cmp_ver($minver{$key}, $kernver) > 0) {
$disabled = 1;
disable_config($key);
print "$key: Requires at least kernel $minver{$key}\n";
print OUT "# $key disabled for insufficient kernel version\n";
} else {
$disabled=0;
}
# Add dependencies from enclosing if/endif blocks
depends($key, $_) foreach (@kifs);
} elsif (m|^\s*comment\s+"[^"]*"\s*$|) {
$key = 'comment';
} elsif (m|^\s*menu\s+"[^"]*"\s*$|) {
$key = 'menu';
push @kifs, ''; # placeholder for any depends on clauses
} elsif (m|^\s*if\s+(.+?)\s*$|) {
push @kifs, $1;
} elsif (/^\s*end(if|menu)\s*(?:#.*)?$/) {
# Won't handle menu/if blocks that aren't strictly
# nested, but no one should do that!
$#kifs >= 0 or die "Unmatched end$1 at $file:$.\n";
pop @kifs;
} else {
$nothandled = 1;
}
next unless ($nothandled);
# Remaining Kconfig directives only makse sense inside Kconfig blocks
unless(defined $key) {
print "Skipping $file:$. $_" if $debug;
next;
}
# Don't process any directives in comment blocks
next if ($key eq 'comment');
# Only depends on lines are accepted in menus
if ($key eq 'menu') {
if (m|^\s*depends on\s+(.+?)\s*$|) {
my $x = pop @kifs;
$x .= ' && ' if($x ne '');
$x .= "($1)";
push @kifs, $x;
} else {
print "Skipping unexpected line in menu stanza $file:$.$_" if $debug;
}
next;
}
# config type
if(/^\s*bool(ean)?\s/) {
add_bool($key);
if (m|if (.*)\s*$|) {
printf("Boolean $key with if '$1'\n") if $debug;
if ($if eq "") {
$if = "($1)";
} else {
$if .= " && ($1)";
}
}
} elsif (/^\s*tristate\s/) {
add_tristate($key);
if (m|if (.*)\s*$|) {
printf("Boolean $key with if '$1'\n") if $debug;
if ($if eq "") {
$if = "($1)";
} else {
$if .= " && ($1)";
}
}
} elsif (/^\s*int\s/) {
add_int($key);
} elsif (/^\s*hex\s/) {
add_hex($key);
} elsif (/^\s*string\s/) {
add_string($key);
# select and depend lines
} elsif (m|^\s*depends on\s+(.+?)\s*$|) {
depends($key, $1);
} elsif (m|^\s*select\s+(\w+)(\s+if\s+(.+?))?\s*$|) {
selects($key, $1, $3);
# default lines
} elsif (m|^\s*default\s+(.+?)(?:\s+if .*)?\s*$|) {
my $o = $1;
if ($2 ne "") {
if ($if eq "") {
$if = "($2)";
} else {
$if .= " && ($2)";
}
}
# Get default for int options
if ($o =~ m|^"(\d+)"$| && exists $intopt{$key}) {
set_int_value($key, $1);
# Get default for hex options
} elsif ($o =~ m|^"(0x)?([[:xdigit:]]+)"$| && exists $hexopt{$key}) {
set_hex_value($key, $2);
# Get default for string options
} elsif ($o =~ m|^"(.*)"$| && exists $stringopt{$key}) {
set_string_value($key, $1);
# Override default for disabled tri/bool options
# We don't care about the default for tri/bool options otherwise
} elsif (!$o =~ /^(y|n|m|"yes"|"no")$/i && exists $tristate{$key}) {
print "Default is an expression at $file:$. $_\n" if $debug;
if ($if eq "") {
depends($key, "$o");
}
}
if ($if ne "") {
# FIXME: What happens if no default clause exists?
# the $if won't be handled
depends($key, "$if || $o");
}
if ($disabled) {
$default_seen = 1;
$line = "\tdefault n\n";
}
} else {
print "Skipping $file:$. $_" if $debug;
}
} continue {
print OUT $line;
}
close $in;
}
sub parse_versions()
{
my $in = new FileHandle;
my $ver;
open $in, '<versions.txt' or die "File not found: versions.txt";
while (<$in>) {
if (/\[(\d+\.\d+\.\d+)\]/) {
$ver = $1;
} elsif (/^\s*(\w+)/) {
$minver{$1} = $ver;
print "minimal version for $1 is $ver\n" if $debug;
}
}
close $in;
}
# Read in the .version file to get the kernel version
sub get_version()
{
open IN, '<.version' or die 'File not found: .version';
while (<IN>) {
if (/KERNELRELEASE\s*[:]*[=]+\s*(\d+)\.(\d+)\.(\d+)/) {
$version=$1;
$level=$2;
$sublevel=$3;
return $kernver="$version.$level.$sublevel";
}
}
close IN;
}
# Like ver1 <=> ver2, but understands X.Y.Z version strings
sub cmp_ver($$)
{
shift =~ /(\d+)\.(\d+)\.(\d+)/;
my ($v1_ver,$v1_level,$v1_sublevel) = ($1,$2,$3);
shift =~ /(\d+)\.(\d+)\.(\d+)/;
my ($v2_ver,$v2_level,$v2_sublevel) = ($1,$2,$3);
my $cmp = $v1_ver <=> $v2_ver;
return $cmp unless($cmp == 0);
$cmp = $v1_level <=> $v2_level;
return $cmp unless($cmp == 0);
return $v1_sublevel <=> $v2_sublevel;
}
# Get kernel version
get_version();
print "Preparing to compile for kernel version $kernver\n";
# Get Kernel's config settings
%kernopts = process_config("$kernel/.config");
# Modules must be on, or building out of tree drivers makes no sense
if(!$kernopts{MODULES}) {
print <<"EOF";
You appear to have loadable modules turned off in your kernel. You can
not compile the v4l-dvb drivers, as modules, and use them with a kernel
that has modules disabled.
If you want to compile these drivers into your kernel, you should
use 'make kernel-links' to link the source for these drivers into
your kernel tree. Then configure and compile the kernel.
EOF
exit -1;
}
# Kernel < 2.6.22 is missing the HAS_IOMEM option
if (!defined $kernopts{HAS_IOMEM} && cmp_ver($kernver, '2.6.22') < 0) {
$kernopts{HAS_IOMEM} = 2;
}
# Kernel < 2.6.22 is missing the HAS_DMA option
if (!defined $kernopts{HAS_DMA} && cmp_ver($kernver, '2.6.22') < 0) {
$kernopts{HAS_DMA} = 2;
}
# Kernel < 2.6.23 is missing the VIRT_TO_BUS option
if (!defined $kernopts{VIRT_TO_BUS} && cmp_ver($kernver, '2.6.23') < 0) {
# VIRT_TO_BUS -> !PPC64
$kernopts{VIRT_TO_BUS} = 2 - $kernopts{PPC64};
}
# Get minimum kernel version for our variables
parse_versions();
kernelcheck();
open OUT, ">Kconfig" or die "Cannot write Kconfig file";
print OUT <<"EOF";
mainmenu "V4L/DVB menu"
source Kconfig.kern
config VIDEO_KERNEL_VERSION
bool "Enable drivers not supported by this kernel"
default n
---help---
Normally drivers that require a kernel newer $version.$level.$sublevel,
the kernel you are compiling for now, will be disabled.
Turning this switch on will let you enabled them, but be warned
they may not work properly or even compile.
They may also work fine, and the only reason they are listed as
requiring a newer kernel is that no one has tested them with an
older one yet.
If the driver works, please post a report to the V4L mailing list:
linux-media\@vger.kernel.org.
Unless you know what you are doing, you should answer N.
EOF
open_kconfig('../linux', '../linux/drivers/media/Kconfig');
open_kconfig('.', './Kconfig.sound');
open_kconfig('.', './Kconfig.staging');
close OUT;
# These options should default to off
disable_config('DVB_AV7110_FIRMWARE');
disable_config('DVB_CINERGYT2_TUNING');
disable_config('VIDEO_HELPER_CHIPS_AUTO');
disable_config('VIDEO_FIXED_MINOR_RANGES');
disable_config('STAGING');
disable_config('STAGING_BROKEN');
$intopt { "DVB_MAX_ADAPTERS" } = 8;
# Check dependencies
my %newconfig = checkdeps();
# TODO: tell the user which options were disabled at this point
%config = %newconfig;
# Create Kconfig.kern, listing all non-media (i.e. kernel) variables
# that something depended on.
$depend{MODULES}{always} = 1; # Make sure MODULES will appear
open OUT, '>Kconfig.kern' or die "Cannot write Kconfig.kern file: $!";
while (my ($key, $deps) = each %depend) {
next if exists $config{$key}; # Skip media variables
print OUT "# Needed by ", join(', ', keys %$deps), "\n";
print OUT "config $key\n\ttristate\n";
print OUT "\tdefault ", qw(n m y)[$kernopts{$key}], "\n\n";
}
close OUT;
# Create make dependency rules for the Kconfig file
open OUT, '>.kconfig.dep' or die "Cannot write .kconfig.dep file: $!";
print OUT 'Kconfig: ';
print OUT join(" \\\n\t", @kconfigfiles), "\n";
close OUT;
# Produce a .config file if forced or one doesn't already exist
if ($force_kconfig==1 || !-e '.config') {
open OUT, '>.config' or die "Cannot write .config file: $!";
foreach (keys %tristate) {
if ($config{$_}) {
print OUT "CONFIG_$_=", qw(n m y)[$config{$_}], "\n";
} else {
print OUT "# CONFIG_$_ is not set\n";
}
}
while (my ($key,$value) = each %intopt) {
print OUT "CONFIG_$key=$value\n" if($config{$key});
}
while (my ($key,$value) = each %hexopt) {
print OUT "CONFIG_$key=$value\n" if($config{$key});
}
while (my ($key,$value) = each %stringopt) {
print OUT "CONFIG_$key=$value\n" if($config{$key});
}
close OUT;
print "Created default (all yes) .config file\n";
}
# Check for full kernel sources and print a warning
sub kernelcheck()
{
my $fullkernel="$kernsrc/fs/fcntl.c";
if (! -e $fullkernel) {
print <<"EOF2";
***WARNING:*** You do not have the full kernel sources installed.
This does not prevent you from building the v4l-dvb tree if you have the
kernel headers, but the full kernel source may be required in order to use
make menuconfig / xconfig / qconfig.
If you are experiencing problems building the v4l-dvb tree, please try
building against a vanilla kernel before reporting a bug.
Vanilla kernels are available at http://kernel.org.
On most distros, this will compile a newly downloaded kernel:
cp /boot/config-`uname -r` <your kernel dir>/.config
cd <your kernel dir>
make all modules_install install
Please see your distro's web site for instructions to build a new kernel.
EOF2
}
print << "EOF3";
WARNING: This is the V4L/DVB backport tree, with experimental drivers
backported to run on legacy kernels from the development tree at:
http://git.linuxtv.org/media-tree.git.
It is generally safe to use it for testing a new driver or
feature, but its usage on production environments is risky.
Don't use it in production. You've been warned.
EOF3
sleep 5;
}

258
v4l/scripts/make_makefile.pl Executable file
View File

@@ -0,0 +1,258 @@
#!/usr/bin/perl
use FileHandle;
use File::Find;
my %instdir = ();
# Take a Makefile line of the form:
# obj-XXXXX = some_directory/ some_module.o
#
# All directories are processed by including the referenced Makefile and
# removing the directory. The modules are added to the list of modules
# to install. Prints the edited line to OUT.
# Arguments: directory Makefile is in, the objects, original line(s) from
# Makefile (with newlines intact).
sub check_line($$$)
{
my $dir = shift;
my $objs = shift;
my $orig = shift;
my $count = 0;
foreach(split /\s+/, $objs) {
if (m|/$|) { # Ends in /, means it's a directory
# Delete this directory from original Makefile line
$orig =~ s/$_[ \t]*//;
$_ .= 'Makefile';
# print STDERR "open new makefile $dir/$_\n";
open_makefile("$dir/$_");
next;
}
# It's a file, add it to list of files to install
s/\.o$/.ko/;
my $idir = $dir;
$idir =~ s|^../linux/drivers/media/||;
$instdir{$idir}{$_} = 1;
$count++;
}
# Removing any tailling whitespace, just to be neat
$orig =~ s/[ \t]+$//mg;
# Print out original line, less directories, if there is anything
# still there
print OUT $orig if($count);
}
# Uses the string being assigned from a line of the form:
# EXTRA_CFLAGS += -Idrivers/media/something -Dwhatever
#
# All the -Idrivers/media/something options get deleted. All the source
# files are linked into the v4l directory and built from there, so and -I
# option for them is unnecessary. The line is printed to OUT if there is
# anything left after that.
sub remove_includes($$)
{
my $flags = shift;
my $orig = shift;
my $count = 0;
foreach(split /\s+/, $flags) {
if (m|^-Idrivers/media|) {
# Remove any -I flags from original Makefile line
$orig =~ s/$_[ \t]*//;
next;
}
$count++; # Something wasn't deleted
}
$orig =~ s/[ \t]+$//mg;
# Print out original line if there is anything we didn't delete
print OUT $orig if($count);
}
sub open_makefile($) {
my $file = shift;
my $in = new FileHandle;
my $orig;
# only open a given Makefile once
return if exists $makefiles{$file};
$makefiles{$file} = 1;
$file =~ m|^(.*)/[^/]*$|;
my $dir = $1;
# print STDERR "opening $file (dir=$dir)\n";
$file =~ m|.*/(linux/.*)$|;
print OUT "# Including $1\n";
open $in, $file;
while (<$in>) {
# print STDERR "Line: $_";
# Skip comment lines
if (/^\s*#/) {
print OUT $_;
next;
}
m/^\s*-?include/ and die "Can't handle includes! In $file";
# Handle line continuations
if (/\\\n$/) {
$_ .= <$in>;
redo;
}
# $orig is what we will print, $_ is what we will parse
$orig = $_;
# Eat line continuations in string we will parse
s/\s*\\\n\s*/ /g;
# Eat comments
s/#.*$//;
if (/^\s*obj-.*:?=\s*(\S.*?)\s*$/) {
# print STDERR "obj matched '$1'\n";
check_line($dir, $1, $orig); # will print line for us
next;
}
if (/^\s*EXTRA_CFLAGS\s+\+?=\s*(\S.*?)\s*$/) {
# print STDERR "cflags matched '$1'\n";
remove_includes($1, $orig); # will print line for us
next;
}
print OUT $orig;
}
close $in;
}
my %obsolete;
sub getobsolete()
{
open OBSOLETE, '<obsolete.txt' or die "Can't open obsolete.txt: $!";
while (<OBSOLETE>) {
next if (/^\s*#/ || /^\s*$/);
chomp;
if (m|^(.*)/([^/]*)$|) {
$obsolete{$1}{"$2.ko"} = 1;
} else {
print "Unable to parse obsolete.txt:$.\n$_\n";
}
}
close OBSOLETE;
}
sub removeobsolete()
{
while ( my ($dir, $files) = each(%obsolete) ) {
print OUT "\t\@echo -e \"\\nRemoving obsolete files from \$(KDIR26)/$dir:\"\n";
print OUT "\t\@files='", join(' ', keys %$files), "'; ";
print OUT "for i in \$\$files;do if [ -e \$(DESTDIR)\$(KDIR26)/$dir/\$\$i ]; then ";
print OUT "echo -n \"\$\$i \";";
print OUT " rm \$(DESTDIR)\$(KDIR26)/$dir/\$\$i; fi; done; ";
print OUT "for i in \$\$files;do if [ -e \$(DESTDIR)\$(KDIR26)/$dir/\$\$i.gz ]; then ";
print OUT "echo -n \"\$\$i.gz \";";
print OUT " rm \$(DESTDIR)\$(KDIR26)/$dir/\$\$i.gz; fi; done; echo;\n\n";
}
}
#
# Special hack for Ubuntu with their non-standard dir
#
sub removeubuntu()
{
my $dest = "/lib/modules/\$(KERNELRELEASE)/ubuntu/media";
my $filelist;
while ( my ($dir, $files) = each(%instdir) ) {
$filelist .= ' '. join(' ', keys %$files);
}
while ( my ($dir, $files) = each(%obsolete) ) {
$filelist .= ' ' . join(' ', keys %$files);
}
$filelist =~ s/\s+$//;
print OUT "\t\@if [ -d $dest ]; then ";
print OUT "printf \"\\nHmm... distro kernel with a non-standard place for module backports detected.\\n";
print OUT "Please always prefer to use vanilla upstream kernel with V4L/DVB\\n";
print OUT "I'll try to remove old/obsolete LUM files from $dest:\\n\"; ";
print OUT "files='", $filelist, "'; ";
print OUT "for i in \$\$files;do find \"$dest\" \-name \"\$\$i\" \-exec echo \'{}\' \';\' ;";
print OUT " find \"$dest\" \-name \"\$\$i\" \-exec rm \'{}\' \';\' ;";
print OUT " done;";
print OUT " fi\n";
}
sub parse_dir()
{
my $file = $File::Find::name;
return if (!($file =~ /Makefile$/));
open_makefile($file);
}
##############################################################################
getobsolete();
open OUT, '>Makefile.media' or die 'Unable to write Makefile.media';
open_makefile('../linux/drivers/media/Makefile');
find({wanted => \&parse_dir, no_chdir => 1}, '../linux/drivers/staging');
# Creating Install rule
print OUT "media-install::\n";
removeobsolete();
removeubuntu();
print OUT "\t\@echo \"Installing kernel modules under \$(DESTDIR)\$(KDIR26)/:\"\n";
while (my ($dir, $files) = each %instdir) {
print OUT "\t\@n=0;for i in ", join(' ', keys %$files), ";do ";
print OUT "if [ -e \"\$\$i\" ]; then ";
print OUT "if [ \$\$n -eq 0 ]; then ";
print OUT "echo -n \"\t$dir/: \"; ";
print OUT "install -d \$(DESTDIR)\$(KDIR26)/$dir; fi; ";
print OUT "n=\$\$\(\(\$\$n+1\)\); ";
print OUT "if [ \$\$n -eq 4 ]; then echo; echo -n \"\t\t\"; n=1; fi; ";
print OUT "echo -n \"\$\$i \"; ";
print OUT "install -m 644 -c \$\$i \$(DESTDIR)\$(KDIR26)/$dir; fi; done; ";
print OUT "if [ \$\$n -ne 0 ]; then echo; ";
print OUT "strip --strip-debug \$(DESTDIR)\$(KDIR26)/$dir/*.ko; ";
print OUT "fi;\n\n";
}
print OUT "\t@echo\n";
print OUT "\t/sbin/depmod -a \$(KERNELRELEASE) \$(if \$(DESTDIR),-b \$(DESTDIR))\n\n";
# Creating Remove rule
print OUT "media-rminstall::\n";
removeobsolete();
removeubuntu();
while ( my ($dir, $files) = each(%instdir) ) {
print OUT "\t\@echo -e \"\\nRemoving old \$(KDIR26)/$dir files:\"\n";
print OUT "\t\@files='", join(' ', keys %$files), "'; ";
print OUT "for i in \$\$files;do if [ -e \$(DESTDIR)\$(KDIR26)/$dir/\$\$i ]; then ";
print OUT "echo -n \"\$\$i \";";
print OUT " rm \$(DESTDIR)\$(KDIR26)/$dir/\$\$i; fi; done; ";
print OUT "for i in \$\$files;do if [ -e \$(DESTDIR)\$(KDIR26)/$dir/\$\$i.gz ]; then ";
print OUT "echo -n \"\$\$i.gz \";";
print OUT " rm \$(DESTDIR)\$(KDIR26)/$dir/\$\$i.gz; fi; done; echo;\n\n";
}
my $mediadeps = join(" \\\n", map("\t../linux/drivers/media/$_/Makefile", keys %instdir));
$mediadeps =~ s,\.\./linux/drivers/media/\.\.,..,g;
# Print dependencies of Makefile.media
print OUT "Makefile.media: ../linux/drivers/media/Makefile \\\n";
print OUT "\tobsolete.txt \\\n";
print OUT $mediadeps;
print OUT "\n";
close OUT;

58
v4l/scripts/make_myconfig.pl Executable file
View File

@@ -0,0 +1,58 @@
#!/usr/bin/perl
# The purpose of this script is to produce a file named '.myconfig', in
# the same style as the '.config' file. Except .myconfig has disabled
# options explicitly set to 'n' rather than just omitted. This is to
# make sure they override any corresponding options that may be turned on
# in the Kernel's config files.
# The .myconfig file is what will be included in the v4l-dvb Makefile
# to control which drivers are built.
my %config = ();
my %allconfig = ();
open IN,".config";
while (<IN>) {
if (m/\s*(\w+)=\s*(\S*)/) {
#printf "%s=%s\n",$1,$2;
$config { $1 } = $2;
}
}
close IN;
# Build table of _all_ bool and tristate config variables
my $key = 0;
open IN,"Kconfig";
while (<IN>) {
if (/^(?:menu)?config\s+(\w+)\s*$/) {
$key == 0 or die "Couldn't find type of config '$key'";
$key = "CONFIG_$1";
} elsif (/^\s+bool(ean)?\s/) {
$allconfig{$key} = 'bool';
$key = 0;
} elsif (/^\s+tristate\s/) {
$allconfig{$key} = 'tristate';
$key = 0;
} elsif (/^\s+(int|hex|string)\s/) {
$allconfig{$key} = 'data';
$key = 0;
}
}
close IN;
exists $allconfig{0} and die "Unable to correctly parse Kconfig file";
# Produce output for including in a Makefile
# Explicitly set bool/tri options that didn't appear in .config to n
# 'data' options are only output if they appeared in .config
open OUT,">.myconfig";
while ( my ($key, $value) = each(%allconfig) ) {
if ($value eq 'data') {
next unless (exists $config{$key});
$value = $config{$key};
} else {
$value = exists $config{$key} ? $config{$key} : 'n';
}
printf OUT "%-44s := %s\n",$key,$value;
}
close OUT;

33
v4l/scripts/makelinks.sh Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/sh
# link drivers sources from CVS or release tarball into your 2.6.x kernel sources;
if test -z $1 || ! test -d $1 ; then
echo
echo " usage: $0 <path_to_kernel_to_patch>"
echo
exit
fi
echo "patching $1..."
cd linux
PWD=`pwd`
FINDDIR="-name CVS -prune -o -type d"
FINDFILE="-name CVS -prune -o -type f -not -name .cvsignore\
-not -name '*.rej' -not -name '*.orig'"
for dir in drivers include Documentation; do
find $dir $FINDDIR -exec mkdir -p -v $1/{} \;
find $dir $FINDFILE -exec ln -f -s $PWD/{} $1/{} \;
done
for dir in drivers/media include; do
find $dir $FINDDIR -exec ln -f -s $PWD/../v4l/compat.h $1/{} \; \
-exec touch $1/{}/config-compat.h \;
done
cat > $1/drivers/media/Kbuild <<EOF
EXTRA_CFLAGS+=-include include/linux/version.h -include compat.h
export EXTRA_CFLAGS
include drivers/media/Makefile
EOF

View File

@@ -0,0 +1 @@
changeset = changelog.tmpl

51
v4l/scripts/modules.sh Executable file
View File

@@ -0,0 +1,51 @@
#!/bin/sh
function xrmmod() {
local module regex
module="$1"
regex=`echo $module | sed -e 's/[-_]/[-_]/g'`
grep -qe "$regex" /proc/modules || return 0
echo "unload $module"
if test "$UID" = "0"; then
/sbin/rmmod $module
else
sudo /sbin/rmmod $module
fi
}
function xinsmod() {
local module regex file args
module="$1"
shift
args="$*"
regex=`echo $module | sed -e 's/[-_]/[-_]/g'`
grep -qe "$regex" /proc/modules && return
file=""
test -f "$module.o" && file="$module.o"
test -f "$module.ko" && file="$module.ko"
if test "$file" != ""; then
echo "load $file $args"
if test "$UID" = "0"; then
/sbin/insmod $file $args
else
sudo /sbin/insmod $file $args
fi
else
echo "load $module $args"
if test "$UID" = "0"; then
/sbin/modprobe $module $args
else
sudo /sbin/modprobe $module $args
fi
fi
}
function v4l2basic() {
for module in i2c-core i2c-algo-bit \
videodev v4l2-common v4l1-compat \
video-buf \
soundcore
do
xinsmod $module
done
}

147
v4l/scripts/prep_commit_msg.pl Executable file
View File

@@ -0,0 +1,147 @@
#!/usr/bin/perl
my $diff = 'diff';
if ($ARGV[0] eq '-q') {
$diff = 'qdiff';
shift;
}
my $autopatch = shift;
# Get Hg username from environment
my $user = $ENV{HGUSER};
sub hgrcuser($)
{
my $file = shift;
my $ui = 0;
open IN, '<', $file;
while (<IN>) {
$ui = 1 if (/^\s*\[ui\]/);
if ($ui && /^\s*username\s*=\s*(\S.*?)\s*$/) {
close IN;
return($1);
}
}
close IN;
return("");
}
# Didn't work? Try the repo's .hgrc file
if ($user eq "") {
my $hgroot = `hg root`;
chomp($hgroot);
$user = hgrcuser("$hgroot/.hg/hgrc");
}
# Ok, try ~/.hgrc next
if ($user eq "") {
$user = hgrcuser("$ENV{HOME}/.hgrc");
}
# Still no luck? Try some other environment variables
if ($user eq "") {
my $name = $ENV{CHANGE_LOG_NAME};
my $email = $ENV{CHANGE_LOG_EMAIL_ADDRESS};
$user = "$name <$email>" if ($name ne "" || $email ne "");
}
# Last try to come up with something
if ($user eq "") {
$user = "$ENV{USER} <>";
}
$checkpatch=$ENV{CHECKPATCH};
if (!$checkpatch) {
$checkpatch="/lib/modules/`uname -r`/build/scripts/checkpatch.pl";
}
my $cp_version;
open IN,"$checkpatch|";
while (<IN>) {
tr/A-Z/a-z/;
if (m/version\s*:\s*([\d\.]+)/) {
$cp_version = $1;
}
}
close IN;
my $intree_checkpatch = "scripts/checkpatch.pl --no-tree";
if (!open IN,"$intree_checkpatch|") {
$intree_checkpatch = "v4l/".$intree_checkpatch;
open IN,"$intree_checkpatch|";
}
while (<IN>) {
tr/A-Z/a-z/;
if (m/version\s*:\s*([\d\.]+)/) {
if ($1 > $cp_version) {
print "# WARNING: $checkpatch version $cp_version is\n"
."# older than $intree_checkpatch version"
." $1.\n# Using in-tree one.\n#\n";
$cp_version = $1;
$checkpatch = $intree_checkpatch;
}
}
}
close IN;
print "# Added/removed/changed files:\n";
system "hg $diff | diffstat -p1 -c";
open IN,"hg $diff | $checkpatch -q --nosignoff -|";
my $err=0;
while (<IN>) {
if (!$err) {
print "#\n# WARNING: $checkpatch version $cp_version returned ".
"some errors.\n# Please fix.\n#\n";
$err=1;
}
print "# $_";
}
close IN;
if (-s $autopatch) {
print "#\n# Note, a problem with your patch was detected! These changes were made\n";
print "# automatically: $autopatch\n";
system "diffstat -p0 -c $autopatch";
print "#\n# Please review these changes and see if they belong in your patch or not.\n";
}
if ($diff eq 'qdiff') {
# Use existing mq patch logfile?
open IN, "hg qheader |";
my @header = <IN>;
close IN;
if ($#header > 0) {
# Use existing header
print @header;
exit;
}
# No header, use pre-made log message below
# Hg will strip lines that start with "From: " from mq patch headers!
# In order to stop it, we insert this extra From line at the top,
# Hg will strip it and then leave the real from line alone.
print "From: $user\n\n";
}
print <<"EOF";
#
# Patch Subject (a brief description with less than 74 chars):
# From Line, identifying the name of the patch author
From: $user
# A detailed description:
# NEW: Please change the priority of the patch to "high" if the patch is
# a bug fix, or are meant to be applied at the first upstream
# version of a new driver whose changes don't depend on changes on
# core modules
Priority: normal
# At the end Signed-off-by: fields by patch author and committer, at least.
Signed-off-by: $user
EOF

586
v4l/scripts/prepare-ChangeLog.pl Executable file
View File

@@ -0,0 +1,586 @@
#!/usr/bin/perl -w
# -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 2 -*-
# Perl script to create a ChangeLog entry with names of files
# and functions from a hg diff.
#
# Darin Adler <darin@eazel.com>, started 20 April 2000
# Java support added by Maciej Stachowiak <mjs@eazel.com>
# last updated 28 December 2000
#
# Mauro Carvalho Chehab <mchehab@brturbo.com.br>: modified to
# allow signed-off-by tags, GMT Time and V4L format.
# CHANVE_LOG Env variables now are mandatory.
# Updated at 15 January 2005
#
# Mauro Carvalho Chehab <mchehab@brturbo.com.br>: modified to
# work with Mercurial
# Updated at 29 August 2005
#
# Mauro Carvalho Chehab <mchehab@brturbo.com.br>: modified to
# just generate a changelog entry
# Updated at 01 January 2006
##
# (Someone put a license in here, like maybe GPL.)
#
# TODO:
# Provide option to put new ChangeLog into a separate file
# instead of editing the ChangeLog.
# For new files, just say "New file" instead of listing
# function names.
# List functions that have been removed too.
# Decide what a good logical order is for the changed files
# other than a normal text "sort" (top level first?)
# (group directories?) (.h before .c?)
# Leave a diff file behind if asked, but in unified format.
# Handle C++ and yacc source files too (other languages?).
# Help merge when there are ChangeLog conflicts or if there's
# already a partly written ChangeLog entry.
# Find appropriate ChangeLog to edit for each changed file
# instead of always using ChangeLog in current directory.
# Add command line option to put the ChangeLog into a separate
# file or just spew it out stdout.
# Figure out how to allow -z options from .cvsrc to work without
# letting other bad options work. Currently the -f disables
# everything from the .cvsrc.
# Add CVS version numbers for each file too (can't do that until
# the changes are checked in, though).
# Work around diff stupidity where deleting a function that starts
# with a comment makes diff think that the following function
# has been changed (if the following function starts with a comment
# with the same first line, such as /**)
# Work around diff stupidity where deleting an entire function and
# the blank lines before it makes diff think you've changed the
# previous function.
use diagnostics;
use strict;
use English;
use Text::Wrap;
# Get environment variables required.
my $name = $ENV{CHANGE_LOG_NAME};
my $email_address = $ENV{CHANGE_LOG_EMAIL_ADDRESS};
my $login = $ENV{CHANGE_LOG_LOGIN};
my $outfile = shift || "";
if (!defined $name)
{
print STDERR "Please, define env var CHANGE_LOG_NAME.\n";
exit;
}
if (!defined $email_address)
{
print STDERR "Please, define env var CHANGE_LOG_EMAIL_ADDRESS.\n";
exit;
}
if (!defined $login)
{
print STDERR "Please, define env var CHANGE_LOG_LOGIN.\n";
exit;
}
# For each file, build a list of modified lines.
# Use line numbers from the "after" side of each diff.
print STDERR " Running hg diff to find changes.\n";
my %changed_line_ranges;
my $file;
open DIFF, "hg diff |" or die "The hg diff failed: $OS_ERROR.\n";
while (<DIFF>)
{
$file = $1 if /^diff -r .* (\S+)$/;
if (defined $file)
{
push @{$changed_line_ranges{$file}}, [ $2, $4 || $2 ];
}
}
close DIFF;
if (!%changed_line_ranges)
{
print STDERR " No changes found.\n";
exit;
}
# For each ".c" file, convert line range to function list.
print STDERR " Extracting affected function names from C source files.\n";
my %function_lists;
foreach my $file (keys %changed_line_ranges)
{
# An empty function list still indicates that something changed.
$function_lists{$file} = "";
# Only look for function names in .c files.
next unless $file =~ /\.(c|java)/;
# Find all the functions in the file.
open SOURCE, $file or next;
my @function_ranges = get_function_line_ranges(\*SOURCE, $file);
close SOURCE;
# Find all the modified functions.
my @functions;
my %saw_function;
my @change_ranges = (@{$changed_line_ranges{$file}}, []);
my @change_range = (0, 0);
FUNCTION: foreach my $function_range_ref (@function_ranges)
{
my @function_range = @$function_range_ref;
# Advance to successive change ranges.
for (;; @change_range = @{shift @change_ranges})
{
last FUNCTION unless @change_range;
# If past this function, move on to the next one.
next FUNCTION if $change_range[0] > $function_range[1];
# If an overlap with this function range, record the function name.
if ($change_range[1] >= $function_range[0]
and $change_range[0] <= $function_range[1])
{
if (!$saw_function{$function_range[2]})
{
$saw_function{$function_range[2]} = 1;
push @functions, $function_range[2];
}
next FUNCTION;
}
}
}
# Format the list of functions now.
$function_lists{$file} = " (" . join("), (", @functions) . "):" if @functions;
}
# Write out a new ChangeLog file.
print STDERR " Editing the ChangeLog file.\n";
my $date = sprintf "%d-%02d-%02d %02d:%02d",
1900 + (gmtime $BASETIME)[5], # year
1 + (gmtime $BASETIME)[4], # month
(gmtime $BASETIME)[3], # day within month
(gmtime $BASETIME)[2], # hour
(gmtime $BASETIME)[1]; # min
if ($outfile eq "") {
open CHANGE_LOG, ">&STDOUT";
} else {
open CHANGE_LOG, "> $outfile" or die "Could not write to $outfile\n.";
}
print CHANGE_LOG "$date $login\n\n";
foreach my $file (sort keys %function_lists)
{
my $lines = wrap("\t", "\t", "XX$file:$function_lists{$file}");
$lines =~ s/^\tXX/\t* /;
print CHANGE_LOG "$lines\n";
}
print CHANGE_LOG "\n\tSigned-off-by: $name <$email_address>\n";
close CHANGE_LOG;
# Done.
print STDERR " Done editing ChangeLog.\n";
exit;
sub get_function_line_ranges
{
my ($file_handle, $file_name) = @_;
if ($file_name =~ /\.c$/) {
return get_function_line_ranges_for_c ($file_handle, $file_name);
} elsif ($file_name =~ /\.java$/) {
return get_function_line_ranges_for_java ($file_handle, $file_name);
}
return ();
}
# Read a file and get all the line ranges of the things that look like C functions.
# A function name is the last word before an open parenthesis before the outer
# level open brace. A function starts at the first character after the last close
# brace or semicolon before the function name and ends at the close brace.
# Comment handling is simple-minded but will work for all but pathological cases.
#
# Result is a list of triples: [ start_line, end_line, function_name ].
sub get_function_line_ranges_for_c
{
my ($file_handle, $file_name) = @_;
my @ranges;
my $in_comment = 0;
my $in_macro = 0;
my $in_parentheses = 0;
my $in_braces = 0;
my $word = "";
my $potential_start = 0;
my $potential_name = "";
my $start = 0;
my $name = "";
while (<$file_handle>)
{
# Handle continued multi-line comment.
if ($in_comment)
{
next unless s-.*\*/--;
$in_comment = 0;
}
# Handle continued macro.
if ($in_macro)
{
$in_macro = 0 unless /\\$/;
next;
}
# Handle start of macro (or any preprocessor directive).
if (/^\s*\#/)
{
$in_macro = 1 if /^([^\\]|\\.)*\\$/;
next;
}
# Handle comments and quoted text.
while (m-(/\*|//|\'|\")-) # \' and \" keep emacs perl mode happy
{
my $match = $1;
if ($match eq "/*")
{
if (!s-/\*.*?\*/--)
{
s-/\*.*--;
$in_comment = 1;
}
}
elsif ($match eq "//")
{
s-//.*--;
}
else # ' or "
{
if (!s-$match([^\\]|\\.)*?$match--)
{
warn "mismatched quotes at line $INPUT_LINE_NUMBER in $file_name\n";
s-$match.*--;
}
}
}
# Find function names.
while (m-(\w+|[(){};])-g)
{
# Open parenthesis.
if ($1 eq "(")
{
$potential_name = $word unless $in_parentheses;
$in_parentheses++;
next;
}
# Close parenthesis.
if ($1 eq ")")
{
$in_parentheses--;
next;
}
# Open brace.
if ($1 eq "{")
{
# Promote potiential name to real function name at the
# start of the outer level set of braces (function body?).
if (!$in_braces and $potential_start)
{
$start = $potential_start;
$name = $potential_name;
}
$in_braces++;
next;
}
# Close brace.
if ($1 eq "}")
{
$in_braces--;
# End of an outer level set of braces.
# This could be a function body.
if (!$in_braces and $name)
{
push @ranges, [ $start, $INPUT_LINE_NUMBER, $name ];
$name = "";
}
$potential_start = 0;
$potential_name = "";
next;
}
# Semicolon.
if ($1 eq ";")
{
$potential_start = 0;
$potential_name = "";
next;
}
# Word.
$word = $1;
if (!$in_parentheses)
{
$potential_start = 0;
$potential_name = "";
}
if (!$potential_start)
{
$potential_start = $INPUT_LINE_NUMBER;
$potential_name = "";
}
}
}
warn "mismatched braces in $file_name\n" if $in_braces;
warn "mismatched parentheses in $file_name\n" if $in_parentheses;
return @ranges;
}
# Read a file and get all the line ranges of the things that look like Java
# classes, interfaces and methods.
#
# A class or interface name is the word that immediately follows
# `class' or `interface' when followed by an open curly brace and not
# a semicolon. It can appear at the top level, or inside another class
# or interface block, but not inside a function block
#
# A class or interface starts at the first character after the first close
# brace or after the function name and ends at the close brace.
#
# A function name is the last word before an open parenthesis before
# an open brace rather than a semicolon. It can appear at top level or
# inside a class or interface block, but not inside a function block.
#
# A function starts at the first character after the first close
# brace or after the function name and ends at the close brace.
#
# Comment handling is simple-minded but will work for all but pathological cases.
#
# Result is a list of triples: [ start_line, end_line, function_name ].
sub get_function_line_ranges_for_java
{
my ($file_handle, $file_name) = @_;
my @current_scopes;
my @ranges;
my $in_comment = 0;
my $in_macro = 0;
my $in_parentheses = 0;
my $in_braces = 0;
my $in_non_block_braces = 0;
my $class_or_interface_just_seen = 0;
my $word = "";
my $potential_start = 0;
my $potential_name = "";
my $potential_name_is_class_or_interface = 0;
my $start = 0;
my $name = "";
my $current_name_is_class_or_interface = 0;
while (<$file_handle>)
{
# Handle continued multi-line comment.
if ($in_comment)
{
next unless s-.*\*/--;
$in_comment = 0;
}
# Handle continued macro.
if ($in_macro)
{
$in_macro = 0 unless /\\$/;
next;
}
# Handle start of macro (or any preprocessor directive).
if (/^\s*\#/)
{
$in_macro = 1 if /^([^\\]|\\.)*\\$/;
next;
}
# Handle comments and quoted text.
while (m-(/\*|//|\'|\")-) # \' and \" keep emacs perl mode happy
{
my $match = $1;
if ($match eq "/*")
{
if (!s-/\*.*?\*/--)
{
s-/\*.*--;
$in_comment = 1;
}
}
elsif ($match eq "//")
{
s-//.*--;
}
else # ' or "
{
if (!s-$match([^\\]|\\.)*?$match--)
{
warn "mismatched quotes at line $INPUT_LINE_NUMBER in $file_name\n";
s-$match.*--;
}
}
}
# Find function names.
while (m-(\w+|[(){};])-g)
{
# Open parenthesis.
if ($1 eq "(")
{
if (!$in_parentheses) {
$potential_name = $word;
$potential_name_is_class_or_interface = 0;
}
$in_parentheses++;
next;
}
# Close parenthesis.
if ($1 eq ")")
{
$in_parentheses--;
next;
}
# Open brace.
if ($1 eq "{")
{
# Promote potiential name to real function name at the
# start of the outer level set of braces (function/class/interface body?).
if (!$in_non_block_braces
and (!$in_braces or $current_name_is_class_or_interface)
and $potential_start)
{
if ($name)
{
push @ranges, [ $start, ($INPUT_LINE_NUMBER - 1),
join ('.', @current_scopes) ];
}
$current_name_is_class_or_interface = $potential_name_is_class_or_interface;
$start = $potential_start;
$name = $potential_name;
push (@current_scopes, $name);
} else {
$in_non_block_braces++;
}
$potential_name = "";
$potential_start = 0;
$in_braces++;
next;
}
# Close brace.
if ($1 eq "}")
{
$in_braces--;
# End of an outer level set of braces.
# This could be a function body.
if (!$in_non_block_braces)
{
if ($name)
{
push @ranges, [ $start, $INPUT_LINE_NUMBER,
join ('.', @current_scopes) ];
pop (@current_scopes);
if (@current_scopes)
{
$current_name_is_class_or_interface = 1;
$start = $INPUT_LINE_NUMBER + 1;
$name = $current_scopes[$#current_scopes-1];
}
else
{
$current_name_is_class_or_interface = 0;
$start = 0;
$name = "";
}
}
}
else
{
$in_non_block_braces-- if $in_non_block_braces;
}
$potential_start = 0;
$potential_name = "";
next;
}
# Semicolon.
if ($1 eq ";")
{
$potential_start = 0;
$potential_name = "";
next;
}
if ($1 eq "class" or $1 eq "interface") {
$class_or_interface_just_seen = 1;
next;
}
# Word.
$word = $1;
if (!$in_parentheses)
{
if ($class_or_interface_just_seen) {
$potential_name = $word;
$potential_start = $INPUT_LINE_NUMBER;
$class_or_interface_just_seen = 0;
$potential_name_is_class_or_interface = 1;
next;
}
}
if (!$potential_start)
{
$potential_start = $INPUT_LINE_NUMBER;
$potential_name = "";
}
$class_or_interface_just_seen = 0;
}
}
warn "mismatched braces in $file_name\n" if $in_braces;
warn "mismatched parentheses in $file_name\n" if $in_parentheses;
return @ranges;
}

63
v4l/scripts/release.sh Executable file
View File

@@ -0,0 +1,63 @@
#!/bin/sh
# config
release="$HOME/kernel/release"
ver_bt="0.9.15"
ver_sa="0.2.12"
ver_cx="0.0.4"
# common files
files_v4l="v4l*.[ch] video-buf.[ch] videodev*.h"
files_tuner="tuner.[ch] tda9887.[ch]"
files_i2c="id.h audiochip.h"
files_common="$files_v4l $files_tuner $files_i2c doc"
# other files
files_ir="ir-common.[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"
files_cx="btcx*.[ch] cx*.[ch]"
######################################################################################
# helpers
function build_release () {
local name="$1"; shift
local version="$1"; shift
local files="$*"
local dest="$WORK/$name-$version"
local tarball="$release/$name-$version.tar.gz"
# copy / prepare stuff
mkdir "$dest"
cp -av $files "$dest" || exit 1
cp -v Makefile "$dest"
cp -v "scripts/config.$name" "$dest"/Make.config
# build test
(cd $dest; make) || exit 1
# (cd $dest; ls *.o; sleep 5)
(cd $dest; make clean)
# build tarball
tar czCf "$WORK" "$tarball" "$name-$version"
}
######################################################################################
# main
# tmp dir for my files
WORK="${TMPDIR-/tmp}/${0##*/}-$$"
mkdir "$WORK" || exit 1
trap 'rm -rf "$WORK"' EXIT
build_release "bttv" "$ver_bt" \
"$files_common" "$files_ir" "$files_audio" "$files_bttv"
build_release "saa7134" "$ver_sa" \
"$files_common" "$files_ir" "$files_audio" "$files_saa"
build_release "cx88" "$ver_cx" \
"$files_common" "$files_cx"

222
v4l/scripts/rmmod.pl Executable file
View File

@@ -0,0 +1,222 @@
#!/usr/bin/perl
use strict;
use File::Find;
my %depend = ();
my %depend2 = ();
my %rmlist = ();
my @nodep;
my @modlist;
my @allmodules;
my %reqmodules;
my %loaded = ();
my $i=0;
# Device debug parameters
# Module name Debug option
my %debug = ( "tuner" => "tuner_debug=1",
"dvb-core" => "cam_debug=1",
"dvb-ttpci" => "debug=247",
"b2c2-flexcop" => "debug=0x01",
"b2c2-flexcop-usb" => "debug=0x01",
"b2c2-flexcop-pci" => "debug=0x01",
"dvb-usb" => "debug=0x33",
"dvb-usb-gp8psk" => "debug=0x03",
"dvb-usb-vp7045" => "debug=0x03",
"dvb-usb-dtt200u" => "debug=0x03",
"dvb-usb-dibusb-common" => "debug=0x03",
);
sub getobsolete()
{
my @obsolete;
open OBSOLETE, '<obsolete.txt' or die "Unable to open obsolete.txt: $!";
while (<OBSOLETE>) {
next if (/^\s*#/ || /^\s*$/);
chomp;
m|^.*/([^/]+)$| and push @obsolete, $1;
}
close OBSOLETE;
return @obsolete;
}
sub findprog($)
{
foreach(split(/:/, $ENV{PATH}),qw(/sbin /usr/sbin /usr/local/sbin)) {
return "$_/$_[0]" if(-x "$_/$_[0]");
}
die "Can't find needed utility '$_[0]'";
}
sub parse_dir {
my $file = $File::Find::name;
my $modinfo = findprog('modinfo');
if (!($file =~ /[.]ko$/)) {
return;
}
my $module = $file;
$module =~ s|^[./]*(.*)[.]ko|\1|;
open IN, "$modinfo $file|grep depends|cut -b 17-|";
while (<IN>) {
my $deps = $_;
$deps =~ s/\n//;
$deps =~ s/[,]/ /g;
$deps = " $deps ";
$depend{$module} = $deps;
push @allmodules, $module;
$i++;
}
close IN;
}
sub parse_loaded {
open IN, "/proc/modules";
while (<IN>) {
m/^([\w\d_-]+)/;
$loaded{$1}=1;
}
close IN;
}
sub cleandep()
{
my $dep;
while ( my ($k, $v) = each(%depend) ) {
my $arg=$v;
my $arg2=" ";
while (!($arg =~ m/^\s*$/)) {
if ($arg =~ m/^ ([^ ]+) /) {
my $val=$1;
if (exists($depend{$val})) {
$arg2="$arg2 $val ";
} else {
$reqmodules{$val}=1;
}
}
$arg =~ s/^ [^ ]+//;
$arg2 =~ s/\s\s+/ /;
}
$depend2 { $k } = $arg2;
}
}
sub rmdep()
{
my $dep;
while ($dep=pop @nodep) {
while ( my ($k, $v) = each(%depend2) ) {
if ($v =~ m/\s($dep)\s/) {
$v =~ s/\s${dep}\s/ /;
$v =~ s/\s${dep}\s/ /;
$v =~ s/\s${dep}\s/ /;
$depend2 {$k} = $v;
}
}
}
}
sub orderdep ()
{
my $old;
do {
$old=$i;
while ( my ($key, $value) = each(%depend2) ) {
if ($value =~ m/^\s*$/) {
push @nodep, $key;
push @modlist, $key;
$i=$i-1;
delete $depend2 {$key};
}
}
rmdep();
} until ($old==$i);
while ( my ($key, $value) = each(%depend2) ) {
printf "ERROR: bad dependencies - $key ($value)\n";
}
}
sub insmod ($)
{
my $debug=shift;
my $modprobe = findprog('modprobe');
my $insmod = findprog('insmod');
while ( my ($key, $value) = each(%reqmodules) ) {
print ("$modprobe $key\n");
system ("$modprobe $key");
}
foreach my $key (@modlist) {
if ($debug) {
my $dbg=$debug{$key};
print "$insmod ./$key.ko $dbg\n";
system "$insmod ./$key.ko $dbg\n";
} else {
print "$insmod ./$key.ko\n";
system "$insmod ./$key.ko\n";
}
}
}
sub rmmod(@)
{
my $rmmod = findprog('rmmod');
my @not;
foreach (reverse @_) {
s/-/_/g;
if (exists ($loaded{$_})) {
print "$rmmod $_\n";
unshift @not, $_ if (system "$rmmod $_");
}
}
return @not;
}
sub prepare_cmd()
{
find(\&parse_dir, ".");
printf "found $i modules\n";
cleandep();
orderdep();
}
# main
my $mode=shift;
if ($mode eq "load") {
prepare_cmd;
insmod(0);
} else {
if ($mode eq "unload") {
prepare_cmd;
parse_loaded;
my @notunloaded = rmmod(@modlist, getobsolete());
@notunloaded = rmmod(@notunloaded) if (@notunloaded);
if (@notunloaded) {
print "Couldn't unload: ", join(' ', @notunloaded), "\n";
}
} elsif ($mode eq "reload") {
prepare_cmd;
parse_loaded;
rmmod(@modlist);
insmod(0);
} elsif ($mode eq "debug") {
prepare_cmd;
parse_loaded;
insmod(1);
} elsif ($mode eq "check") {
prepare_cmd;
parse_loaded;
} else {
printf "Usage: $0 [load|unload|reload|debug|check]\n";
}
}

60
v4l/scripts/saa7134.pl Executable file
View File

@@ -0,0 +1,60 @@
#!/usr/bin/perl -w
use strict;
my %map = (
"PCI_ANY_ID" => "0",
"PCI_VENDOR_ID_PHILIPS" => "1131",
"PCI_VENDOR_ID_ASUSTEK" => "1043",
"PCI_VENDOR_ID_MATROX" => "102B",
);
sub fix_id($) {
my $id = shift;
$id = $map{$id} if defined($map{$id});
$id =~ s/^0x//;
return $id;
}
my $new_entry = -1;
my $nr = 0;
my ($id,$subvendor,$subdevice);
my %data;
while (<>) {
# defines in header file
if (/#define\s+(SAA7134_BOARD_\w+)\s+(\d+)/) {
$data{$1}->{nr} = $2;
next;
}
# saa7134_boards
if (/\[(SAA7134_BOARD_\w+)\]/) {
$id = $1;
$data{$id}->{id} = $id;
# $data{$id}->{nr} = $nr++;
};
next unless defined($id);
if (!defined($data{$id}) || !defined($data{$id}->{name})) {
$data{$id}->{name} = $1 if (/\.name\s*=\s*\"([^\"]+)\"/);
}
# saa7134_pci_tbl
$subvendor = fix_id($1) if (/\.subvendor\s*=\s*(\w+)\s*,*/);
$subdevice = fix_id($1) if (/\.subdevice\s*=\s*(\w+)\s*,*/);
if (/.driver_data\s*=\s*(\w+)\s*,*/) {
if (defined($data{$1}) &&
defined($subvendor) && $subvendor ne "0" &&
defined($subdevice) && $subdevice ne "0") {
push @{$data{$1}->{subid}}, "$subvendor:$subdevice";
undef $subvendor;
undef $subdevice;
}
}
}
foreach my $item (sort { $data{$a}->{nr} <=> $data{$b}->{nr} } keys %data) {
printf("%3d -> %-40s", $data{$item}->{nr}, $data{$item}->{name});
printf(" [%s]",join(",",@{$data{$item}->{subid}}))
if defined($data{$item}->{subid});
print "\n";
}

57
v4l/scripts/saa7164.pl Executable file
View File

@@ -0,0 +1,57 @@
#!/usr/bin/perl -w
use strict;
my %map = (
"PCI_ANY_ID" => "0",
);
sub fix_id($) {
my $id = shift;
$id = $map{$id} if defined($map{$id});
$id =~ s/^0x//;
return $id;
}
my $new_entry = -1;
my $nr = 0;
my ($id,$subvendor,$subdevice);
my %data;
while (<>) {
# defines in header file
if (/#define\s+(SAA7164_BOARD_\w+)\s+(\d+)/) {
$data{$1}->{nr} = $2;
next;
}
# saa7164_boards
if (/\[(SAA7164_BOARD_\w+)\]/) {
$id = $1;
$data{$id}->{id} = $id;
# $data{$id}->{nr} = $nr++;
};
next unless defined($id);
if (!defined($data{$id}) || !defined($data{$id}->{name})) {
$data{$id}->{name} = $1 if (/\.name\s*=\s*\"([^\"]+)\"/);
}
# saa7164_pci_tbl
$subvendor = fix_id($1) if (/\.subvendor\s*=\s*(\w+),/);
$subdevice = fix_id($1) if (/\.subdevice\s*=\s*(\w+),/);
if (/.card\s*=\s*(\w+),/) {
if (defined($data{$1}) &&
defined($subvendor) && $subvendor ne "0" &&
defined($subdevice) && $subdevice ne "0") {
push @{$data{$1}->{subid}}, "$subvendor:$subdevice";
undef $subvendor;
undef $subdevice;
}
}
}
foreach my $item (sort { $data{$a}->{nr} <=> $data{$b}->{nr} } keys %data) {
printf("%3d -> %-51s", $data{$item}->{nr}, $data{$item}->{name});
printf(" [%s]",join(",",@{$data{$item}->{subid}}))
if defined($data{$item}->{subid});
print "\n";
}

View File

@@ -0,0 +1,36 @@
#!/bin/sh
# Strips trailing whitespace. Leading spaces and spaces after tabs are
# converted to the equivalent sequence of tabs only.
# Use the option "fast" to only check files Hg thinks are new or modified.
# The option "manifest" will use Hg's manifest command to check all files
# under Hg revision control.
# Otherwise, all files under the linux tree are checked, except files in CVS
# directories and .cvsignore files. This is the historical behavior.
if [ "x$1" = "xfast" ]; then
files="hg status -man"
elif [ "x$1" = "xqfast" ]; then
files="hg status --rev -2 -man"
elif [ "x$1" = "xmanifest" ]; then
files="hg manifest | cut '-d ' -f3"
else
files="find linux -type f -print"
fi
for file in `eval $files`; do
case "$file" in
*.gif | *.pdf | *.patch | *.h.xml | *.c.xml)
continue
;;
esac
perl -ne '
s/[ \t]+$//;
s<^ {8}> <\t>;
s<^ {1,7}\t> <\t>;
while( s<\t {8}> <\t\t>g || s<\t {1,7}\t> <\t\t>g ) {};
print' < "${file}" | \
diff -u --label="$file" "$file" --label="$file" -
done

51
v4l/scripts/tuner.pl Executable file
View File

@@ -0,0 +1,51 @@
#!/usr/bin/perl -w
use strict;
my $new_entry = -1;
my $nr = 0;
my ($id,$subvendor,$subdevice);
my %data;
my $H = shift;
my $C = shift;
my %blacklist;
open IN, "<$H";
while (<IN>) {
# defines in header file
if (/#define\s+(TUNER_\w+)\s+(\d+)/) {
my $num=$2;
$data{$1}->{nr} = $num;
if (/#define\s+TUNER_TDA9887/) {
$blacklist{$num}=1;
}
next;
}
}
close IN;
open IN, "<$C";
while (<IN>) {
# tuners
if (/\[(TUNER_\w+)\]/) {
$id = $1;
if ($id =~ m/TUNER_MAX/) {
next;
}
$data{$id}->{id} = $id;
};
next unless defined($id);
if (!defined($data{$id}) || !defined($data{$id}->{name})) {
$data{$id}->{name} = $1 if (/\.name\s*=\s*\"([^\"]+)\"/);
}
}
foreach my $item (sort { $data{$a}->{nr} <=> $data{$b}->{nr} } keys %data) {
if ($blacklist{$data{$item}->{nr}}) {
next;
}
printf("tuner=%d - %s", $data{$item}->{nr}, $data{$item}->{name});
print "\n";
}

106
v4l/scripts/update Executable file
View File

@@ -0,0 +1,106 @@
#!/bin/sh
source scripts/modules.sh
set -e
case "`hostname --short`" in
eskarina)
# btopt="card=10"
# btopt="card=6 remote=1"
;;
bogomips)
saopt="card=7"
;;
esac
###########################################################################
# unload
# bttv
xrmmod dst
xrmmod bt878
xrmmod ir-kbd-gpio
xrmmod ir-kbd-i2c
xrmmod bttv
# cx88
xrmmod cx88-dvb
xrmmod cx88-blackbird
xrmmod cx8802
xrmmod cx8801
xrmmod cx8800
xrmmod cx88xx
# saa7134
xrmmod saa7134-dvb
xrmmod saa7134-empress
xrmmod saa7134
# saa7146
xrmmod dvb_ttpci
xrmmod saa7146_vv
# dvb
xrmmod or51132
xrmmod cx22702
xrmmod mt352
xrmmod dvb-pll
# common
xrmmod btcx-risc
xrmmod ir-common
xrmmod video-buf-dvb
xrmmod video-buf
# i2c
xrmmod tuner
xrmmod msp3400
xrmmod tvaudio
xrmmod tda9887
xrmmod tveeprom
##########################################################################
# reload
sync; sleep 1;
# common
v4l2basic
#xrmmod video-buf
#xinsmod video-buf debug=0
#xrmmod v4l1-compat
#xinsmod v4l1-compat debug=1
xinsmod tveeprom debug=0
xinsmod dvb-pll debug=0
xinsmod btcx-risc debug=0
xinsmod ir-common debug=0 repeat=0
xinsmod tuner tuner_debug=0
xinsmod tda9887 debug=0 qss=1
xinsmod msp3400 debug=0
# bttv
xinsmod ir-kbd-i2c debug=0
xinsmod bttv bttv_debug=0 vbi_debug=0 irq_debug=0 \
fdsr=0 chroma_agc=1 vbibufs=4 irq_iswitch=0 i2c_scan=1 $btopt
xinsmod ir-kbd-gpio debug=0
# cx88
xinsmod cx88xx core_debug=0 audio_debug=0 ir_debug=1 \
i2c_debug=1 i2c_scan=1
xinsmod cx8800 video_debug=0 vbi_debug=0
xinsmod cx8801
xinsmod cx8802
xinsmod cx88-blackbird
# saa7134
xinsmod saa7134 audio_debug=0 i2c_scan=0 i2c_debug=0 oss=1 $saopt
xinsmod saa7134-empress
# dvb stuff
xinsmod cx22702 debug=0
xinsmod mt352 debug=1
xinsmod or51132
xinsmod tda1004x
xinsmod video-buf-dvb
xinsmod cx88-dvb
xinsmod saa7134-dvb

106
v4l/scripts/usbaudio_setup.sh Executable file
View File

@@ -0,0 +1,106 @@
#!/bin/bash
#
# Copyright (C) 2006 Markus Rechberger <mrechberger@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
which /usr/bin/dialog >/dev/null
if [ "0" != "$?" ]; then
echo "this tool requires \"dialog\" (http://hightek.org/dialog/)"
exit 1
fi
uid=`id -u`
if [ "0" != "$uid" ]; then
echo "this tool must be run as root, you can disable this message by editing the script but only do that unless you know what you're doing!"
exit 1
fi
which gcc > /dev/null
if [ "0" != "$?" ]; then
echo "this tool won't work unless you install gcc"
exit 1
fi
test -f ossid
if [ "0" != "$?" ]; then
cat > ossid.c <<_EOF
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <linux/soundcard.h>
#include <fcntl.h>
#include <unistd.h>
int main(int argc, char **argv){
int fd;
struct mixer_info *info;
fd=open(argv[1],O_RDONLY);
if(fd>=0){
info=malloc(sizeof(struct mixer_info));
ioctl(fd,SOUND_MIXER_INFO,info);
printf("%c \"%s %s\"\n",(argv[1][strlen(argv[1])-1]=='p')?'0':(argv[1][strlen(argv[1])-1]+1),info->name,info->id);
free(info);
close(fd);
} else {
return 1;
}
return 0;
}
_EOF
gcc ossid.c -o ossid
rm ossid.c
fi
test -f /proc/asound/cards
if [ "0" != "$?" ]; then
dialog --title "Welcome" --backtitle "Empia Sound Configuration" \
--msgbox "Your system doesn't support ALSA, please have a look at \
www.alsa-project.org and set it up properly \
Press any key to continue... " 11 50
exit 1;
fi
dialog --title "Welcome" --backtitle "Empia Sound Configuration" \
--msgbox "This tool was written to ease up sound configuration for
* Terratec Hybrid XS
* Terratec Cinergy 250 USB 2.0
* Hauppauge HVR 900
* and possible others :)
first select an usb audio source, as target choose your soundcard
Press any key to continue... " 13 60
ls /dev/dsp* | while read a; do ./ossid $a; done | xargs dialog --menu "Choose your TV Audio source:" 12 60 5 2>/tmp/em2880_source.$$
ls /dev/dsp* | while read a; do ./ossid $a; done | xargs dialog --menu "Choose your output soundcard device:" 12 60 5 2>/tmp/em2880_dst.$$
source=`egrep '^[0-9p]' /tmp/em2880_source.$$`
dst=`egrep '^[0-9p]' /tmp/em2880_dst.$$`
echo "playing $source to $dst";
if [ "$source" = "0" ]; then
device="/dev/dsp"
else
device="/dev/dsp`expr $source - 1`"
fi
if [ "$dst" = "0" ]; then
device2="/dev/dsp"
else
device2="/dev/dsp`expr $source - 1`"
fi
clear
echo "Using command: sox -r 48000 -w -c 2 -t ossdsp $device -t ossdsp $device2"
sox -r 48000 -w -c 2 -t ossdsp $device -t ossdsp $device2

42
v4l/scripts/usbvision.pl Executable file
View File

@@ -0,0 +1,42 @@
#!/usr/bin/perl -w
use strict;
my $new_entry = -1;
my $nr = 0;
my ($id,$subvendor,$subdevice);
my %data;
while (<>) {
# defines in header file
if (/#define\s*(\w+)\s*(\d+)/) {
$data{$1}->{nr} = $2;
next;
}
# boards
if (/^\s*\[([\w\d_]+)\]\s*=\s*{/) {
$id = $1;
$data{$id}->{id} = $id;
};
next unless defined($id);
if (/USB_DEVICE.*0x([0-9a-fA-F]*).*0x([0-9a-fA-F]*).*/)
{
$subvendor=$1;
$subdevice=$2;
}
if(/driver_info\s*=\s*([\w\d_]+)/)
{
push @{$data{$1}->{subid}}, "$subvendor:$subdevice";
}
if (!defined($data{$id}) || !defined($data{$id}->{name})) {
$data{$id}->{name} = $1 if (/\.ModelString\s*=\s*\"([^\"]+)\"/);
}
}
foreach my $item (sort { $data{$a}->{nr} <=> $data{$b}->{nr} } keys %data) {
printf("%3d -> %-56s", $data{$item}->{nr}, $data{$item}->{name});
printf(" [%s]",join(",",@{$data{$item}->{subid}}))
if defined($data{$item}->{subid});
print "\n";
}

151
v4l/versions.txt Normal file
View File

@@ -0,0 +1,151 @@
# Use this for stuff for drivers that don't compile
[2.6.99]
[2.6.36]
LIRC
IR_LIRC_CODEC
IR_IMON
IR_MCEUSB
[2.6.34]
MACH_DAVINCI_DM6467_EVM
MFD_TIMBERDALE
RADIO_SAA7706H
VIDEO_TVP7002
[2.6.33]
SOC_CAMERA
SOC_CAMERA_MT9V022
SOC_CAMERA_MT9M001
SOC_CAMERA_MT9M111
SOC_CAMERA_MT9T031
SOC_CAMERA_OV772X
SOC_CAMERA_TW9910
SOC_CAMERA_PLATFORM
VIDEO_AK881X
V4L2_MEM2MEM_DEV
[2.6.32]
# These rely on arch support that wasn't available until 2.6.32
VIDEO_SH_MOBILE_CEU
VIDEO_PXA27x
VIDEO_TLG2300
[2.6.31]
# These rely on arch support that wasn't available until 2.6.31
VIDEO_VPSS_SYSTEM
VIDEO_VPFE_CAPTURE
VIDEO_DM6446_CCDC
VIDEO_DM355_CCDC
# Start version for those drivers - probably compile with older versions
VIDEO_CX25821
VIDEO_CX25821_ALSA
VIDEO_ADV7180
RADIO_TEF6862
# follow_pfn needed by VIDEOBUF_DMA_CONTIG and drivers that use it
VIDEOBUF_DMA_CONTIG
VIDEOBUF_VMALLOC
DISPLAY_DAVINCI_DM646X_EVM
VIDEO_VPFE_CAPTURE
VIDEO_MX1
VIDEO_MX3
[2.6.30]
# Needs const id_table pointer in struct hpsb_protocol_driver
DVB_FIREDTV_IEEE1394
[2.6.26]
# Requires struct i2c_device_id
VIDEO_TVP514X
VIDEO_ADV7180
# requires id_table and new i2c stuff
RADIO_TEA5764
VIDEO_THS7303
VIDEO_ADV7343
RADIO_SI4713
I2C_SI4713
[2.6.24]
# Some freezer routines
USB_GSPCA_SN9C20X_EVDEV
DVB_PT1
# Requires linux/mmc/sdio_func.h
SMS_SDIO_DRV
VIDEO_SAA7164
[2.6.23]
# Needs field intf_assoc in struct usb_host_config
VIDEO_CX231XX
# This driver needs print_hex_dump with a const void * argument
DVB_FIREDTV
# writel/readl headers moved
DVB_MANTIS
MANTIS_CORE
[2.6.22]
#This driver requires I2C probe/remove fields
VIDEO_TCM825X
# This driver requires list_first_entry
USB_STKWEBCAM
# This driver needs div64_64
DVB_DRX397XD
# Assumes struct input_dev has a dev field
DVB_DM1105
# This driver needs hrtimer API
VIDEO_CX88
[2.6.20]
#This driver requires HID_REQ_GET_REPORT
USB_SI470X
RADIO_SI470X
# use of struct delayed_work
USB_GSPCA_FINEPIX
USB_GSPCA_JEILINJ
# uses linux/hid.h and struct delayed_work
USB_SI470X
# due to INIT_WORK changes
USB_GSPCA_SQ905
USB_GSPCA_SQ905C
VIDEO_HDPVR
# due to device_move
VIDEO_PVRUSB2
# due to struct file.f_path
VIDEO_CPIA
[2.6.19]
# requires vmalloc_user/remap_vmalloc_range
VIDEO_CAFE_CCIC
VIDEO_TM6000
#struct device vs struct class_device issues
USB_ET61X251
USB_SN9C102
USB_PWC
USB_PWC_DEBUG
USB_OV511
USB_STV680
USB_S2255
VIDEO_USBVISION
# Uses supports_autosuspend
USB_MR800
USB_DSBR
# Uses MODULE_FIRMWARE
DVB_AV7110
# usb_complete_t changed prototype
USB_ZR364XX
[2.6.18]
# Uses remap_vmalloc_range()
VIDEOBUF_VMALLOC
# Uses new class interface, which did not start to appear until 2.6.18.
VIDEO_PVRUSB2_SYSFS
# linux/uaccess.h
VIDEO_PMS
[2.6.17]
# DVB_CORE_ATTACH relies on symbol_put_addr which hangs pre-2.6.17
DVB_CORE_ATTACH
# Various changes to ALSA structs
VIDEO_CX18_ALSA
# cx18 needs list_for_each_entry_from
VIDEO_CX18