From 98bc745f4c1ff3cdd2b9da0595d65056886786cd Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 19 Jul 2008 23:53:41 -0300 Subject: backport commit 6606470dd1d628878383c96d10b52a77986ddac7 From: Mauro Carvalho Chehab Author: Jonathan Corbet Date: Fri May 16 14:28:31 2008 -0600 videodev: BKL pushdown Put explicit lock_kernel() calls into videodev_open(). That function itself seems OK, but one never knows about all the open() functions provided by underlying video drivers. Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/videodev.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/linux/drivers/media/video/videodev.c b/linux/drivers/media/video/videodev.c index b32b59afd..48e03618a 100644 --- a/linux/drivers/media/video/videodev.c +++ b/linux/drivers/media/video/videodev.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -492,6 +493,7 @@ static int video_open(struct inode *inode, struct file *file) if(minor>=VIDEO_NUM_DEVICES) return -ENODEV; + lock_kernel(); mutex_lock(&videodev_lock); vfl=video_device[minor]; if(vfl==NULL) { @@ -501,6 +503,7 @@ static int video_open(struct inode *inode, struct file *file) vfl=video_device[minor]; if (vfl==NULL) { mutex_unlock(&videodev_lock); + unlock_kernel(); return -ENODEV; } } @@ -518,6 +521,7 @@ static int video_open(struct inode *inode, struct file *file) } fops_put(old_fops); mutex_unlock(&videodev_lock); + unlock_kernel(); return err; } -- cgit v1.2.3 From e073c4802611d884e129fb37edd1ec9ca41ed50c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 20 Jul 2008 00:00:30 -0300 Subject: backport commit 9ad46a6ac5422882d9f9a7f0d77ca0766f56bb6e From: Mauro Carvalho Chehab Author: David Woodhouse Date: Fri May 23 23:58:24 2008 +0100 cx25840: treat firmware data as const kernel-sync: Signed-off-by: Mauro Carvalho Chehab --- .../drivers/media/video/cx25840/cx25840-firmware.c | 27 +++++++++------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/linux/drivers/media/video/cx25840/cx25840-firmware.c b/linux/drivers/media/video/cx25840/cx25840-firmware.c index 95b84ce21..04a5dbb65 100644 --- a/linux/drivers/media/video/cx25840/cx25840-firmware.c +++ b/linux/drivers/media/video/cx25840/cx25840-firmware.c @@ -80,7 +80,7 @@ static int check_fw_load(struct i2c_client *client, int size) return 0; } -static int fw_write(struct i2c_client *client, u8 *data, int size) +static int fw_write(struct i2c_client *client, const u8 *data, int size) { if (i2c_master_send(client, data, size) < size) { v4l_err(client, "firmware load i2c failure\n"); @@ -94,7 +94,8 @@ int cx25840_loadfw(struct i2c_client *client) { struct cx25840_state *state = i2c_get_clientdata(client); const struct firmware *fw = NULL; - u8 buffer[4], *ptr; + u8 buffer[FWSEND]; + const u8 *ptr; int size, retval; if (state->is_cx23885) @@ -109,29 +110,23 @@ int cx25840_loadfw(struct i2c_client *client) buffer[0] = 0x08; buffer[1] = 0x02; - buffer[2] = fw->data[0]; - buffer[3] = fw->data[1]; - retval = fw_write(client, buffer, 4); - if (retval < 0) { - release_firmware(fw); - return retval; - } - - size = fw->size - 2; + size = fw->size; ptr = fw->data; while (size > 0) { - ptr[0] = 0x08; - ptr[1] = 0x02; - retval = fw_write(client, ptr, min(FWSEND, size + 2)); + int len = min(FWSEND - 2, size); + + memcpy(buffer + 2, ptr, len); + + retval = fw_write(client, buffer, len + 2); if (retval < 0) { release_firmware(fw); return retval; } - size -= FWSEND - 2; - ptr += FWSEND - 2; + size -= len; + ptr += len; } end_fw_load(client); -- cgit v1.2.3 From c49e3088c034e1fc59f27b9a97ba1e1d3590320a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 20 Jul 2008 00:37:25 -0300 Subject: Complete firmware compilation scripts From: Mauro Carvalho Chehab This patch completes firmware compilation scripts: - linux/firmware/Makefile is just a copy of kernel script make file. It is not currently used by the building system; - Added two new targets for firmware compilation and instalation; - Fixes the COPYING file to explicitly state that the firmwares aren't covered by GPL; - make distclean will also cleanup the firmwares. Signed-off-by: Mauro Carvalho Chehab --- COPYING | 7 +++++++ INSTALL | 9 +++++++++ linux/firmware/Makefile | 47 +++++++++++++++++++++++++++++++++++++++++++++++ v4l/Makefile | 6 +++++- v4l/firmware/Makefile | 30 ++++++++++++++++++++++++------ 5 files changed, 92 insertions(+), 7 deletions(-) diff --git a/COPYING b/COPYING index ca442d313..9788c014c 100644 --- a/COPYING +++ b/COPYING @@ -1,3 +1,10 @@ + NOTE! This copyright does *not* cover the firmware hex files contained + under linux/firmware and v4l/firmware directories. Those firmwares are here + just as a convenience to make easier to develop and test V4L/DVB drivers. + + Mauro Carvalho Chehab + +---------------------------------------- NOTE! This copyright does *not* cover user programs that use kernel services by normal system calls - this is merely considered normal use diff --git a/INSTALL b/INSTALL index bad6ca80b..10cafb264 100644 --- a/INSTALL +++ b/INSTALL @@ -36,6 +36,15 @@ 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 + ======================= Module selection rules: (Those may require write access to kernel tree) diff --git a/linux/firmware/Makefile b/linux/firmware/Makefile index e2841d35d..9fe86041f 100644 --- a/linux/firmware/Makefile +++ b/linux/firmware/Makefile @@ -20,8 +20,55 @@ fw-external-y := $(subst ",,$(CONFIG_EXTRA_FIRMWARE)) # accurate. In the latter case it doesn't matter -- it'll use $(fw-shipped-all). # But be aware that the config file might not be included at all. +fw-shipped-$(CONFIG_ATARI_DSP56K) += dsp56k/bootstrap.bin +fw-shipped-$(CONFIG_ATM_AMBASSADOR) += atmsar11.fw +fw-shipped-$(CONFIG_COMPUTONE) += intelliport2.bin fw-shipped-$(CONFIG_DVB_TTUSB_BUDGET) += ttusb-budget/dspbootcode.bin +fw-shipped-$(CONFIG_SMCTR) += tr_smctr.bin +fw-shipped-$(CONFIG_SND_KORG1212) += korg/k1212.dsp +fw-shipped-$(CONFIG_SND_MAESTRO3) += ess/maestro3_assp_kernel.fw \ + ess/maestro3_assp_minisrc.fw +fw-shipped-$(CONFIG_SND_SB16_CSP) += sb16/mulaw_main.csp sb16/alaw_main.csp \ + sb16/ima_adpcm_init.csp \ + sb16/ima_adpcm_playback.csp \ + sb16/ima_adpcm_capture.csp +fw-shipped-$(CONFIG_SND_YMFPCI) += yamaha/ds1_ctrl.fw yamaha/ds1_dsp.fw \ + yamaha/ds1e_ctrl.fw fw-shipped-$(CONFIG_USB_DABUSB) += dabusb/firmware.fw dabusb/bitstream.bin +fw-shipped-$(CONFIG_USB_EMI26) += emi26/loader.fw emi26/firmware.fw \ + emi26/bitstream.fw +fw-shipped-$(CONFIG_USB_EMI62) += emi62/loader.fw emi62/bitstream.fw \ + emi62/spdif.fw emi62/midi.fw +fw-shipped-$(CONFIG_USB_KAWETH) += kaweth/new_code.bin kaweth/trigger_code.bin \ + kaweth/new_code_fix.bin \ + kaweth/trigger_code_fix.bin +ifdef CONFIG_FIRMWARE_IN_KERNEL +fw-shipped-$(CONFIG_USB_SERIAL_KEYSPAN_MPR) += keyspan/mpr.fw +fw-shipped-$(CONFIG_USB_SERIAL_KEYSPAN_USA18X) += keyspan/usa18x.fw +fw-shipped-$(CONFIG_USB_SERIAL_KEYSPAN_USA19) += keyspan/usa19.fw +fw-shipped-$(CONFIG_USB_SERIAL_KEYSPAN_USA19QI) += keyspan/usa19qi.fw +fw-shipped-$(CONFIG_USB_SERIAL_KEYSPAN_USA19QW) += keyspan/usa19qw.fw +fw-shipped-$(CONFIG_USB_SERIAL_KEYSPAN_USA19W) += keyspan/usa19w.fw +fw-shipped-$(CONFIG_USB_SERIAL_KEYSPAN_USA28) += keyspan/usa28.fw +fw-shipped-$(CONFIG_USB_SERIAL_KEYSPAN_USA28XA) += keyspan/usa28xa.fw +fw-shipped-$(CONFIG_USB_SERIAL_KEYSPAN_USA28XB) += keyspan/usa28xb.fw +fw-shipped-$(CONFIG_USB_SERIAL_KEYSPAN_USA28X) += keyspan/usa28x.fw +fw-shipped-$(CONFIG_USB_SERIAL_KEYSPAN_USA49W) += keyspan/usa49w.fw +fw-shipped-$(CONFIG_USB_SERIAL_KEYSPAN_USA49WLC) += keyspan/usa49wlc.fw +else +fw-shipped- += keyspan/mpr.fw keyspan/usa18x.fw keyspan/usa19.fw \ + keyspan/usa19qi.fw keyspan/usa19qw.fw keyspan/usa19w.fw \ + keyspan/usa28.fw keyspan/usa28xa.fw keyspan/usa28xb.fw \ + keyspan/usa28x.fw keyspan/usa49w.fw keyspan/usa49wlc.fw +endif +fw-shipped-$(CONFIG_USB_SERIAL_TI) += ti_3410.fw ti_5052.fw +fw-shipped-$(CONFIG_USB_SERIAL_EDGEPORT) += edgeport/boot.fw edgeport/boot2.fw \ + edgeport/down.fw edgeport/down2.fw +fw-shipped-$(CONFIG_USB_SERIAL_EDGEPORT_TI) += edgeport/down3.bin +fw-shipped-$(CONFIG_USB_SERIAL_WHITEHEAT) += whiteheat_loader.fw whiteheat.fw \ + # whiteheat_loader_debug.fw +fw-shipped-$(CONFIG_USB_SERIAL_KEYSPAN_PDA) += keyspan_pda/keyspan_pda.fw +fw-shipped-$(CONFIG_USB_SERIAL_XIRCOM) += keyspan_pda/xircom_pgs.fw fw-shipped-$(CONFIG_USB_VICAM) += vicam/firmware.fw fw-shipped-$(CONFIG_VIDEO_CPIA2) += cpia2/stv0672_vp4.bin diff --git a/v4l/Makefile b/v4l/Makefile index 579b85f88..b43b59867 100644 --- a/v4l/Makefile +++ b/v4l/Makefile @@ -39,7 +39,7 @@ endif # TOPDIR ################################################# # default compilation rule -default:: config-compat.h Makefile.media links oss # firmware +default:: config-compat.h Makefile.media links oss @echo Kernel build directory is $(OUTDIR) $(MAKE) -C $(OUTDIR) SUBDIRS=$(PWD) $(MYCFLAGS) modules ./scripts/rmmod.pl check @@ -206,6 +206,9 @@ install:: media-install remove rminstall:: media-rminstall +firmware_install:: + make -C firmware install + ################################################# # Compiling preparation rules @@ -287,6 +290,7 @@ distclean:: clean -rm -f scripts/lxdialog scripts/kconfig oss @find .. -name '*.orig' -exec rm '{}' \; @find .. -name '*.rej' -exec rm '{}' \; + $(MAKE) -C firmware distclean ################################################# # Kernel module insert/removal rules diff --git a/v4l/firmware/Makefile b/v4l/firmware/Makefile index c3624004c..e018ad92a 100644 --- a/v4l/firmware/Makefile +++ b/v4l/firmware/Makefile @@ -1,27 +1,45 @@ -TARGETS = ihex2fw ttusb-budget vicam.fw dabusb_bitstream dabusb.fw stv0672_v4 +DIRS = vicam dabusb ttusb-budget cpia2 + +TARGETS = ihex2fw vicam/firmware.fw dabusb/firmware.fw dabusb/bitstream.bin ttusb-budget/dspbootcode.bin cpia2/stv0672_vp4.bin + +#### default: $(TARGETS) clean: -rm $(TARGETS) +distclean: clean + -rmdir $(DIRS) + +install: default + -for i in $(DIRS); do mkdir /lib/firmware/$$i; done + -for i in $(TARGETS); do cp $$i /lib/firmware/$$i; done + + +###### + +mkdir: + -mkdir $(DIRS) + ihex2fw: ../../linux/firmware/ihex2fw.c gcc -Wall -o $@ $< -vicam.fw: ../../linux/firmware/vicam/firmware.H16 +vicam/firmware.fw: ../../linux/firmware/vicam/firmware.H16 mkdir + -mkdir vicam ./ihex2fw -w $< $@ -dabusb.fw: ../../linux/firmware/dabusb/firmware.HEX +dabusb/firmware.fw: ../../linux/firmware/dabusb/firmware.HEX mkdir ./ihex2fw $< $@ -ttusb-budget: ../../linux/firmware/ttusb-budget/dspbootcode.bin.ihex +ttusb-budget/dspbootcode.bin: ../../linux/firmware/ttusb-budget/dspbootcode.bin.ihex mkdir objcopy -Iihex -Obinary $< $@ -dabusb_bitstream: ../../linux/firmware/dabusb/bitstream.bin.ihex +dabusb/bitstream.bin: ../../linux/firmware/dabusb/bitstream.bin.ihex mkdir objcopy -Iihex -Obinary $< $@ -stv0672_v4: ../../linux/firmware/cpia2/stv0672_vp4.bin.ihex +cpia2/stv0672_vp4.bin: ../../linux/firmware/cpia2/stv0672_vp4.bin.ihex mkdir objcopy -Iihex -Obinary $< $@ -- cgit v1.2.3