[media] v4l: Group media bus pixel codes by types and sort them alphabetically
Adding new pixel codes at the end of the enumeration will soon create a
mess, so group the pixel codes by type and sort them by bus_width, bits
per component, samples per pixel and order of subsamples.
As the codes are part of the kernel ABI their value can't change when a
new code is inserted in the enumeration, so they are given an explicit
numerical value. When inserting a new pixel code developers must use and
update the next free value.
[media] v4l: Replace enums with fixed-sized fields in public structure
The v4l2_mbus_framefmt structure will be part of the public userspace
API and used (albeit indirectly) as an ioctl argument. As such, its size
must be fixed across userspace ABIs.
Replace the v4l2_field and v4l2_colorspace enums by __u32 fields and add
padding for future enhancements.
[media] v4l: Make v4l2_subdev inherit from media_entity
V4L2 subdevices are media entities. As such they need to inherit from
(include) the media_entity structure.
When registering/unregistering the subdevice, the media entity is
automatically registered/unregistered. The entity is acquired on device
open and released on device close.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Acked-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] v4l: Make video_device inherit from media_entity
V4L2 devices are media entities. As such they need to inherit from
(include) the media_entity structure.
When registering/unregistering the device, the media entity is
automatically registered/unregistered. The entity is acquired on device
open and released on device close.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Acked-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] v4l: Add a media_device pointer to the v4l2_device structure
The pointer will later be used to register/unregister media entities
when registering/unregistering a v4l2_subdev or a video_device.
With the introduction of media devices, device drivers need to store a
pointer to a driver-specific structure in the device's drvdata.
v4l2_device can't claim ownership of the drvdata anymore.
To maintain compatibility with drivers that rely on v4l2_device storing
a pointer to itself in the device's drvdata, v4l2_device_register() will
keep doing so if the drvdata is NULL.
Laurent Pinchart [Wed, 25 Aug 2010 12:00:41 +0000 (09:00 -0300)]
[media] media: Pipelines and media streams
Drivers often need to associate pipeline objects to entities, and to
take stream state into account when configuring entities and links. The
pipeline API helps drivers manage that information.
When starting streaming, drivers call media_entity_pipeline_start(). The
function marks all entities connected to the given entity through
enabled links, either directly or indirectly, as streaming. Similarly,
when stopping the stream, drivers call media_entity_pipeline_stop().
The media_entity_pipeline_start() function takes a pointer to a media
pipeline and stores it in every entity in the graph. Drivers should
embed the media_pipeline structure in higher-level pipeline structures
and can then access the pipeline through the media_entity structure.
Link configuration will fail with -EBUSY by default if either end of the
link is a streaming entity, unless the link is marked with the
MEDIA_LNK_FL_DYNAMIC flag.
Create the following ioctl and implement it at the media device level to
setup links.
- MEDIA_IOC_SETUP_LINK: Modify the properties of a given link
The only property that can currently be modified is the ENABLED link
flag to enable/disable a link. Links marked with the IMMUTABLE link flag
can not be enabled or disabled.
Enabling or disabling a link has effects on entities' use count. Those
changes are automatically propagated through the graph.
[media] media: Entities, pads and links enumeration
Create the following two ioctls and implement them at the media device
level to enumerate entities, pads and links.
- MEDIA_IOC_ENUM_ENTITIES: Enumerate entities and their properties
- MEDIA_IOC_ENUM_LINKS: Enumerate all pads and links for a given entity
Entity IDs can be non-contiguous. Userspace applications should
enumerate entities using the MEDIA_ENT_ID_FLAG_NEXT flag. When the flag
is set in the entity ID, the MEDIA_IOC_ENUM_ENTITIES will return the
next entity with an ID bigger than the requested one.
Only forward links that originate at one of the entity's source pads are
returned during the enumeration process.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Acked-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Due to the wide differences between drivers regarding power management
needs, the media controller does not implement power management.
However, the media_entity structure includes a use_count field that
media drivers can use to track the number of users of every entity for
power management needs.
The use_count field is owned by media drivers and must not be touched by
entity drivers. Access to the field must be protected by the media
device graph_mutex lock.
Sakari Ailus [Sun, 7 Mar 2010 19:14:14 +0000 (16:14 -0300)]
[media] media: Entity graph traversal
Add media entity graph traversal. The traversal follows enabled links by
depth first. Traversing graph backwards is prevented by comparing the next
possible entity in the graph with the previous one. Multiply connected
graphs are thus not supported.
As video hardware pipelines become increasingly complex and
configurable, the current hardware description through v4l2 subdevices
reaches its limits. In addition to enumerating and configuring
subdevices, video camera drivers need a way to discover and modify at
runtime how those subdevices are connected. This is done through new
elements called entities, pads and links.
An entity is a basic media hardware building block. It can correspond to
a large variety of logical blocks such as physical hardware devices
(CMOS sensor for instance), logical hardware devices (a building block
in a System-on-Chip image processing pipeline), DMA channels or physical
connectors.
A pad is a connection endpoint through which an entity can interact with
other entities. Data (not restricted to video) produced by an entity
flows from the entity's output to one or more entity inputs. Pads should
not be confused with physical pins at chip boundaries.
A link is a point-to-point oriented connection between two pads, either
on the same entity or on different entities. Data flows from a source
pad to a sink pad.
Links are stored in the source entity. To make backwards graph walk
faster, a copy of all links is also stored in the sink entity. The copy
is known as a backlink and is only used to help graph traversal.
The entity API is made of three functions:
- media_entity_init() initializes an entity. The caller must provide an
array of pads as well as an estimated number of links. The links array
is allocated dynamically and will be reallocated if it grows beyond the
initial estimate.
- media_entity_cleanup() frees resources allocated for an entity. It
must be called during the cleanup phase after unregistering the entity
and before freeing it.
- media_entity_create_link() creates a link between two entities. An
entry in the link array of each entity is allocated and stores pointers
to source and sink pads.
When a media device is unregistered, all its entities are unregistered
automatically.
The code is based on Hans Verkuil <hverkuil@xs4all.nl> initial work.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Acked-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The media_device structure abstracts functions common to all kind of
media devices (v4l2, dvb, alsa, ...). It manages media entities and
offers a userspace API to discover and configure the media device
internal topology.
The media_devnode structure provides support for registering and
unregistering character devices using a dynamic major number. Reference
counting is handled internally, making device drivers easier to write
without having to solve the open/disconnect race condition issue over
and over again.
The code is based on video/v4l2-dev.c.
[mchehab@redhat.com: Remove linux/smp_lock.h include to not break compilation on bisect] Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] v4l: Share code between video_usercopy and video_ioctl2
The two functions are mostly identical. They handle the copy_from_user
and copy_to_user operations related with V4L2 ioctls and call the real
ioctl handler.
Create a __video_usercopy function that implements the core of
video_usercopy and video_ioctl2, and call that function from both.
Arnd Bergmann [Wed, 2 Mar 2011 20:15:15 +0000 (17:15 -0300)]
[media] staging/cx25721: serialize access to devlist
Out of the three files accessing the device list,
one uses a mutex, one uses the BKL and one does
not have any locking. That is of course pointless,
so let's make all of them use the same mutex,
and get rid of one more BKL user.
[media] dw2102: i2c transfer corrected for yet another cards
Related to Acorp DS120 and some revisions of DVBWorld DW2102.
If you read three or more registers at one time, you get wrong value for third etc.
Actually, it didn't affect the driver as it reads registers only by one at a time.
But it needs to correct.
Signed-off-by: Igor M. Liplianin <liplianin@me.by> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Matti Aaltonen [Tue, 1 Mar 2011 13:10:37 +0000 (10:10 -0300)]
[media] ASoC: WL1273 FM radio: Access I2C IO functions through pointers
These changes are needed to keep up with the changes in the
MFD core and V4L2 parts of the wl1273 FM radio driver.
Use function pointers instead of exported functions for I2C IO.
Also move all preprocessor constants from the wl1273.h to
include/linux/mfd/wl1273-core.h.
Also update the year in the copyright statement.
Signed-off-by: Matti J. Aaltonen <matti.j.aaltonen@nokia.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Matti Aaltonen [Tue, 1 Mar 2011 13:10:35 +0000 (10:10 -0300)]
[media] MFD: WL1273 FM Radio: MFD driver for the FM radio
This is the core of the WL1273 FM radio driver, it connects
the two child modules. The two child drivers are
drivers/media/radio/radio-wl1273.c and sound/soc/codecs/wl1273.c.
The radio-wl1273 driver implements the V4L2 interface and communicates
with the device. The ALSA codec offers digital audio, without it only
analog audio is available.
Signed-off-by: Matti J. Aaltonen <matti.j.aaltonen@nokia.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Daniel Drake [Fri, 11 Feb 2011 21:15:02 +0000 (18:15 -0300)]
[media] via-camera: Add suspend/resume support
Add suspend/resume support to the via-camera driver, so that the video
continues streaming over a suspend-resume cycle.
Originally implemented by Jon Corbet.
[mchehab@redhat.com: fix a small CodingStyle issue] Signed-off-by: Daniel Drake <dsd@laptop.org> Acked-by: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Dan Carpenter [Tue, 15 Feb 2011 10:10:08 +0000 (07:10 -0300)]
[media] stv090x: handle allocation failures
kmalloc() can fail so check whether state->internal is NULL.
append_internal() can return NULL on allocation failures so check that.
Also if we hit the error condition later in the function then there is
a memory leak and we need to call remove_dev() to fix it.
Also Oliver Endriss pointed out an additional leak that I missed in the
first version of this patch.
Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-by: Oliver Endriss <o.endriss@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
get_user_pages() may return -errno, such as -EFAULT. So don't blindly use
its return value as an offset into dma->map[] for the next get_user_pages()
call. Since we'll give up and return an error if either fails, don't even
make the second call if the first failed to give us exactly what we were
looking for.
The old code would also call put_page() on as many elements of dma->map[]
as we'd asked for, regardless of how many were valid.
[Andy Walls modified this patch to return -EFAULT instead of -EINVAL
as Paul's observation "I'm not sure -EINVAL is the best return code vs
-EFAULT or -ENOMEM, [...]" was correct. The return value bubbles up
as a return code for write(), for which the V4L2 API spec indicates
EINVAL is incorrect and EFAULT is correct.]
Signed-off-by: Paul Cassella <fortytwo-ivtv@maneteren.bigw.org> Signed-off-by: Andy Walls <awalls@md.metrocast.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Andy Walls [Wed, 9 Feb 2011 01:39:28 +0000 (22:39 -0300)]
[media] ivtv: Fix sparse warning regarding a user pointer in ivtv_write_vbi_from_user()
Fix the first, botched attempt at preventing direct use of a user pointer in
ivtv_write_vbi().
Reported-by: Dr. David Alan Gilbert <linux@treblig.org> Signed-off-by: Andy Walls <awalls@md.metrocast.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Paul Cassella [Wed, 9 Feb 2011 01:22:52 +0000 (22:22 -0300)]
[media] ivtv: udma: handle get_user_pages() returning fewer pages than we asked for
get_user_pages() may return fewer page than we ask for. As we give up and
return an error in this case, we need to put_page() each of the pages we
did get.
[Andy Walls modified the patch, only removing the braces in the 'for'
statement, to eliminate a checkpatch warning.]
Signed-off-by: Paul Cassella <fortytwo-ivtv@manetheren.bigw.org> Signed-off-by: Andy Walls <awalls@md.metrocast.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
MarkusF wrote:
I accidently got a Terratec Cinergy S2 USB HD (instead of a Terratec Cinergy S2 PCI HD).
I found in the windows driver, that the driver is for the usb ids:
0CCD:00A8
1F4D:3000
The dvb-s2 usb adapter has the id 0CCD-00A8.
So I patches your driver and added the usb id, where the 1F4D:3000 is
and it worked (after I downloaded the firmware dvb-fe-ds3000.fw).
w_scan found the channels and vdr is working fine.
Signed-off-by: Igor M. Liplianin <liplianin@me.by> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] dw2102: use separate firmwares for Prof 1100, TeVii S630, S660
Before this patch we can use only one card type from list due to
sharing one firmware name. Now it's fixed.
Also driver tries to attach only appropriate demod for this cards.
Signed-off-by: Igor M. Liplianin <liplianin@me.by> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Jesper Juhl [Sun, 6 Feb 2011 20:49:02 +0000 (17:49 -0300)]
[media] TTUSB DVB: ttusb_boot_dsp() needs to release_firmware() or it leaks memory
In drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c:ttusb_boot_dsp() we
need to call release_firmware(fw) before returning or we'll leak - no
matter if we succeed or fail.
pvrusb2: The origin of the capability bounds rectangle may differ from
(left=0,top=0) so the calculation should use absolute coordinates,
here below, or use relative coordinates like
cropl_val-cap->bounds.left and cropt_val-cap->bounds.top.
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Mike Isely [Sun, 13 Feb 2011 20:31:55 +0000 (17:31 -0300)]
[media] pvrusb2: Handle change of mode before handling change of video standard
pvrusb2: Recognize and handle mode change before dealing with changes
related to the video standard. Even though the video standard should
only matter when in analog mode, doing this way is technically cleaner
in case there's other stuff that might depend on both.
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Stefan Richter [Sun, 6 Feb 2011 14:41:44 +0000 (11:41 -0300)]
[media] firedtv: drop obsolete backend abstraction
Since the drivers/ieee1394/ backend was removed from firedtv, its I/O no
longer needs to be abstracted as exchangeable backend methods.
Also, ieee1394 variants of module and device probe and removal are no
longer there. Move module probe and removal into firedtv-fw.c where
device probe and removal are implemented.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Dmitri Belimov [Fri, 18 Feb 2011 01:11:05 +0000 (22:11 -0300)]
[media] tm6000: add radio support to the driver
Changes:
Add function tm6000_set_reg_mask for change some bits in regs. Very usefull, simplify some code with this function.
Add control mute
Add control volume
Add control audio input MUX
Add support radio
Radio works well. TV works too
Known bugs:
The programm gnomeradio can't set freq for radio, it use old v4l API. Audio over USB works via arecord.
The programm mplayer can set freq but no any audio
mplayer -v -rawaudio rate=48000 radio://105.2/capture driver=v4l2:alsa:adevice=hw.1,0:amode=1:audiorate=48000:forceaudio:immediatemode=0
When start watch TV very shortly after radio the kernel crashed hardly. Didn't stop all USB URBs, need some time for stop.
Lawrence Rust [Sun, 6 Feb 2011 20:46:12 +0000 (17:46 -0300)]
[media] Add proper audio support for Nova-S Plus with wm8775 ADC
This patch adds audio DMA capture and ALSA mixer elements for the line
input jack of the Hauppauge Nova-S-plus DVB-S PCI card. The Nova-S-plus
has a WM8775 ADC that is currently not detected. This patch enables
this chip and exports volume, balance mute and ALC elements for ALSA
mixer controls.
[mchehab@redhat.com: Changed the patch to only talk with wm8775 if board
info says so. Also, added platform_data support, to avoid changing the
behaviour for other boards, and fixed CodingStyle]
[awalls@md.metrocast.net: Changed patch to make the WM8775_GID defintion
bridge driver private and let the bridge driver set the value of
v4l2_subdev.grp_id.]
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Thomas Weber [Mon, 31 Jan 2011 12:16:09 +0000 (09:16 -0300)]
[media] omap24xxcam: Fix compilation
Add linux/sched.h because of missing declaration of TASK_NORMAL.
This patch fixes the following error:
drivers/media/video/omap24xxcam.c: In function
'omap24xxcam_vbq_complete':
drivers/media/video/omap24xxcam.c:415: error: 'TASK_NORMAL' undeclared
(first use in this function)
drivers/media/video/omap24xxcam.c:415: error: (Each undeclared
identifier is reported only once
drivers/media/video/omap24xxcam.c:415: error: for each function it
appears in.)
Signed-off-by: Thomas Weber <weber@corscience.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Peter Huewe [Sun, 30 Jan 2011 19:33:01 +0000 (16:33 -0300)]
[media] video/saa7164: Fix sparse warning: Using plain integer as NULL pointer
This patch fixes the warning "Using plain integer as NULL pointer",
generated by sparse, by replacing
if (var == 0)
with
if (!var)
after an allocation
and all other offending 0s with NULL.