On 32-bit architectures PAGE_ALIGN() truncates 64-bit values to the 32-bit
boundary. For example:
u64 val = PAGE_ALIGN(size);
always returns a value < 4GB even if size is greater than 4GB.
The problem resides in PAGE_MASK definition (from include/asm-x86/page.h for
example):
#define PAGE_SHIFT 12
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))
...
#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
The "~" is performed on a 32-bit value, so everything in "and" with
PAGE_MASK greater than 4GB will be truncated to the 32-bit boundary.
Using the ALIGN() macro seems to be the right way, because it uses
typeof(addr) for the mask.
Also move the PAGE_ALIGN() definitions out of include/asm-*/page.h in
include/linux/mm.h.
See also lkml discussion: http://lkml.org/lkml/2008/6/11/237
[akpm@linux-foundation.org: fix drivers/media/video/uvc/uvc_queue.c]
[akpm@linux-foundation.org: fix v850]
[akpm@linux-foundation.org: fix powerpc]
[akpm@linux-foundation.org: fix arm]
[akpm@linux-foundation.org: fix mips]
[akpm@linux-foundation.org: fix drivers/media/video/pvrusb2/pvrusb2-dvb.c]
[akpm@linux-foundation.org: fix drivers/mtd/maps/uclinux.c]
[akpm@linux-foundation.org: fix powerpc]
Signed-off-by: Andrea Righi <righi.andrea@gmail.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
device_create() is race-prone, so use the race-free
device_create_drvdata() instead as device_create() is going away.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Fix a bug in get_index that was introduced earlier.
Also fix two error handling lock-ups in videodev and cx18 that
where found thanks to that bug.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Instead of letting VIDEO_IR_I2C to be selected by VIDEO_IR, if I2C, convert it
into a symbol that depends on both VIDEO_IR and I2C.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Currently, saa7134 is dependent of ir-kbd-i2c, since it uses a symbol that is
defined there. However, as this symbol is used only on saa7134, there's no
sense on keeping it defined there (or on ir-commons).
So, let's move it to saa7134 and remove one symbol for being exported.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Use Hans Verkuil's suggested method of implementing get_index which doesn't
depend on class_for_each_device and instead uses the video_device array. This
simplifies the code and reduces its memory footprint.
Signed-off-by: Brandon Philips <bphilips@suse.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Those changes, together with some proper patches, will allow out-of-tree
compilation for for kernels < 2.6.19
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Having an _auto suffix is less ambiguous than a 'saa711x' identifier.
It's also used like this in the saa7127 driver.
Thanks to Jean Delvare for suggesting this.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
The saa7127 driver supports all of SAA7126, SAA7127, SAA7128 and
SAA1729 devices. Declare all these devices, so that board drivers can
tell which device is present, instead of always relying on
auto-detection (which needs to write to the chip, eek!).
We still need the detection for ivtv, so a special device name
"saa7127_auto" can be used when the caller doesn't know exactly which
device is present.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Same issue as for cx25840: this function sets up the standard timings
and has nothing to do with VBI setup.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
For several MPEG controls and the volume control the default as returned
by VIDIOC_QUERYCTRL was incorrect and did not match the actual initial
value.
This is now fixed for cx18 and ivtv.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
cx25840_vbi_setup has nothing to do with setting up VBI, but everything
with setting up the standard. Move to cx25840-core.c and rename.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
The sn9c102 driver claims to support usb-ID 0x0c45:0x6011, which is
a sn9c102 with ov6650 sensor, but the sn9c102 driver does not support the
ov6650 sensor (tested). Also the sn9c102 driver claims to support usb-ID
0x0c45:0x603f, which is a sn9c102 with CISVF10 sensor, but the sn9c102
driver does not support the CISVF10 sensor (not tested).
Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
(does not work with ov6650)
Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
1) Don't change the red and blue pre-gain's from their defaults
2) Actually make the powerline freq ctrl available to userspace
Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
sonixb: Common code between ov6650 and ov7630.
Fix brightness oscillation with ov6650 sensor.
Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Thanks to http://zc0302.sourceforge.net/zc0302.php, we have some hints
about what each zc3xx register means.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
sonixb: Bad initialization of sensor for 352x288 mode.
(from Hans de Goede)
sonixj: Clean-up source.
Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
sonixb: Better gain for ov6650.
Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
gspca: Protect dq_callback() against simultaneous USB exchanges.
Temporary buffer for USB exchanges added in the device struct.
(all) Use a temporary buffer for all USB exchanges.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
gspca: Empty the application queues on streamoff ioctl.
streamon/off and qbuf ioctls may be done by any application.
Don't handle MJPEG pixel format as JPEG.
(thanks to Hans de Goede)
Authorize reqbufs ioctl when streaming.
Bad mutex unlock in poll() when streaming problem.
(thanks to Mauro Carvalho Chehab)
Don't handle 'webcam disconnected' in stream off.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
sonixb: Do auto gain for tas5110 / ov6650 sensors.
pac207: Move the auto_gain function to gspca.
gspca: New function gspca_auto_gain_n_exposure().
Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
vc032x: Light frequency was not initialized.
Change the pixel format of bridge VC0321 to V4L2_PIX_FMT_YUV420
('YU12').
Set a bridge to all webcams.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This patch adds a simple platform camera device. Useful for testing
cameras with SoC camera host drivers. Only one single pixel format
and resolution combination is supported.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This is V3 of the SuperH Mobile CEU soc_camera driver.
The CEU hardware block is configured in a transparent data fetch
mode, frames are captured from the attached camera and written to
physically contiguous memory buffers provided by the newly added
videobuf-dma-contig queue. Tested on sh7722 and sh7723 processors.
Changes since V2:
- remove SUPERH Kconfig dependency
- move sh_mobile_ceu.h to include/media
- add board callback support with enable_camera()/disable_camera()
- add support for declare_coherent_memory
- rework video memory limit
- more verbose error messages
Changes since V1:
- fixed the CEU driver to work with the newly updated patches
Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This is V3 of the physically contiguous videobuf queues patch.
Useful for hardware such as the SuperH Mobile CEU which doesn't
support scatter gatter bus mastering.
Since it may be difficult to allocate large chunks of physically
contiguous memory after some uptime due to fragmentation, this code
allocates memory using dma_alloc_coherent(). Architectures supporting
dma_declare_coherent_memory() can easily avoid fragmentation issues
by using dma_declare_coherent_memory() to force dma_alloc_coherent()
to allocate from a certain pre-allocated memory area.
Changes since V2
- use dma_handle for physical address
- use "scatter gather" instead of "scatter gatter"
Changes since V1:
- use dev_err() instead of pr_err()
- remember size in struct videobuf_dma_contig_memory
- keep struct videobuf_dma_contig_memory in .c file
- let videobuf_to_dma_contig() return dma_addr_t
- implement __videobuf_sync()
- return statements, white space and other minor fixes
Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>