mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
media updates for v4.4-rc1
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAABAgAGBQJWOJZoAAoJEAhfPr2O5OEVmjYP/0RnfVjvRDtx0RxHDmvsowlt
sHyrm5C7VME06b4J3O9qpC7PbMCAalvSkYp+bbxF+b//9EfwjvRER+NR8ebgn1Mw
1NQKMtCusWRf4RzI+9osB3pFYgg/cYG2nKl0QVCXHL6xZszEQ9dBrFHEEHfVe8db
JU1fGuF6TQNJdYgsVNMN9rStRB0vj3urfehLjB+E138VzDAnzPNA7I7Z4xsWWJw3
V+J7CWLN1xW9IT59LXtRjbD/aCF9KrAmGigS0nCtDz7XVRPh+ZoXQLD073uLP2L3
uYxOmadvc5+5iVwUP4zSsJ6+vw9kLr6Q30sNtLP7V+VkCSlCQNTOePLavB5T8qVY
M2qALvwWjujtoSEjZHr7TqrlEpio98OSy1dNJ8GmuOb3UUAKocNN8sGG8h2nR/BR
wv2OL/XPNcyB2LV6HeHZz9JiXB+rTbyXEN8CP2cD8ruGhNM5haak3d2l4FYszRXr
/a/5JlYAcNrJii6PAXHyBtm6l0C4GPiAk3HQhII2fTErRr8fpln/G5AfaKjun5H8
1Rbxx5JP+5qSHozmz2hNb4w92qqtPugj7qqu7sHCbwKLhh2Aspwo12GkN9acOIsI
Kn1U/DWMRrkyptJAxBihsrEX3BXeQdNOPydKfMYEM7qE8EfTDM0uaIFQ+KVWCmNA
Qh2TXAp6CZiuBvaqKzyl
=sR0p
-----END PGP SIGNATURE-----
Merge tag 'media/v4.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab:
"Media updates, including:
- Lots of improvements at the kABI documentation
- Split of Videobuf2 into a common part and a V4L2 specific one
- Split of the VB2 tracing events into a separate header file
- s5p-mfc got support for Exynos 5433
- v4l2 fixes for 64-bits alignment when running 32 bits userspace
on ARM
- Added support for SDR radio transmitter at core, vivid and hackrf
drivers
- Some y2038 fixups
- Some improvements at V4L2 colorspace support
- saa7164 converted to use the V4L2 core control framework
- several new boards additions, cleanups and fixups
PS: There are two patches for scripts/kernel-doc that are needed by
the documentation patches on Media. Jon is OK on merging those via
my tree"
* tag 'media/v4.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (146 commits)
[media] c8sectpfe: Remove select on CONFIG_FW_LOADER_USER_HELPER_FALLBACK
[media] DocBook media: update copyright/version numbers
[media] ivtv: Convert to get_user_pages_unlocked()
[media] media/v4l2-ctrls: fix setting autocluster to manual with VIDIOC_S_CTRL
[media] DocBook media: Fix a typo in encoder cmd
[media] DocBook: add SDR specific info to G_MODULATOR / S_MODULATOR
[media] DocBook: add SDR specific info to G_TUNER / S_TUNER
[media] hackrf: do not set human readable name for formats
[media] hackrf: add support for transmitter
[media] hackrf: switch to single function which configures everything
[media] hackrf: add control for RF amplifier
[media] DocBook: add modulator type field
[media] v4l: add type field to v4l2_modulator struct
[media] DocBook: document SDR transmitter
[media] v4l2: add support for SDR transmitter
[media] DocBook: document tuner RF gain control
[media] v4l2: add RF gain control
[media] v4l2: rename V4L2_TUNER_ADC to V4L2_TUNER_SDR
[media] media/vivid-osd: fix info leak in ioctl
[media] media: videobuf2: Move v4l2-specific stuff to videobuf2-v4l2
...
This commit is contained in:
commit
b037865754
262 changed files with 7846 additions and 7866 deletions
|
|
@ -32,9 +32,9 @@
|
|||
#include <linux/time.h>
|
||||
#include <linux/dvb/dmx.h>
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
/* Common definitions */
|
||||
/*--------------------------------------------------------------------------*/
|
||||
/*
|
||||
* Common definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
* DMX_MAX_FILTER_SIZE: Maximum length (in bytes) of a section/PES filter.
|
||||
|
|
@ -45,7 +45,8 @@
|
|||
#endif
|
||||
|
||||
/*
|
||||
* DMX_MAX_SECFEED_SIZE: Maximum length (in bytes) of a private section feed filter.
|
||||
* DMX_MAX_SECFEED_SIZE: Maximum length (in bytes) of a private section feed
|
||||
* filter.
|
||||
*/
|
||||
|
||||
#ifndef DMX_MAX_SECTION_SIZE
|
||||
|
|
@ -55,139 +56,296 @@
|
|||
#define DMX_MAX_SECFEED_SIZE (DMX_MAX_SECTION_SIZE + 188)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* enum dmx_success: Success codes for the Demux Callback API.
|
||||
* TS packet reception
|
||||
*/
|
||||
|
||||
enum dmx_success {
|
||||
DMX_OK = 0, /* Received Ok */
|
||||
DMX_LENGTH_ERROR, /* Incorrect length */
|
||||
DMX_OVERRUN_ERROR, /* Receiver ring buffer overrun */
|
||||
DMX_CRC_ERROR, /* Incorrect CRC */
|
||||
DMX_FRAME_ERROR, /* Frame alignment error */
|
||||
DMX_FIFO_ERROR, /* Receiver FIFO overrun */
|
||||
DMX_MISSED_ERROR /* Receiver missed packet */
|
||||
} ;
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
/* TS packet reception */
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/* TS filter type for set() */
|
||||
|
||||
#define TS_PACKET 1 /* send TS packets (188 bytes) to callback (default) */
|
||||
#define TS_PAYLOAD_ONLY 2 /* in case TS_PACKET is set, only send the TS
|
||||
payload (<=184 bytes per packet) to callback */
|
||||
#define TS_DECODER 4 /* send stream to built-in decoder (if present) */
|
||||
#define TS_DEMUX 8 /* in case TS_PACKET is set, send the TS to
|
||||
the demux device, not to the dvr device */
|
||||
/**
|
||||
* enum ts_filter_type - filter type bitmap for dmx_ts_feed.set()
|
||||
*
|
||||
* @TS_PACKET: Send TS packets (188 bytes) to callback (default).
|
||||
* @TS_PAYLOAD_ONLY: In case TS_PACKET is set, only send the TS payload
|
||||
* (<=184 bytes per packet) to callback
|
||||
* @TS_DECODER: Send stream to built-in decoder (if present).
|
||||
* @TS_DEMUX: In case TS_PACKET is set, send the TS to the demux
|
||||
* device, not to the dvr device
|
||||
*/
|
||||
enum ts_filter_type {
|
||||
TS_PACKET = 1,
|
||||
TS_PAYLOAD_ONLY = 2,
|
||||
TS_DECODER = 4,
|
||||
TS_DEMUX = 8,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct dmx_ts_feed - Structure that contains a TS feed filter
|
||||
*
|
||||
* @is_filtering: Set to non-zero when filtering in progress
|
||||
* @parent: pointer to struct dmx_demux
|
||||
* @priv: pointer to private data of the API client
|
||||
* @set: sets the TS filter
|
||||
* @start_filtering: starts TS filtering
|
||||
* @stop_filtering: stops TS filtering
|
||||
*
|
||||
* A TS feed is typically mapped to a hardware PID filter on the demux chip.
|
||||
* Using this API, the client can set the filtering properties to start/stop
|
||||
* filtering TS packets on a particular TS feed.
|
||||
*/
|
||||
struct dmx_ts_feed {
|
||||
int is_filtering; /* Set to non-zero when filtering in progress */
|
||||
struct dmx_demux *parent; /* Back-pointer */
|
||||
void *priv; /* Pointer to private data of the API client */
|
||||
int (*set) (struct dmx_ts_feed *feed,
|
||||
u16 pid,
|
||||
int type,
|
||||
enum dmx_ts_pes pes_type,
|
||||
size_t circular_buffer_size,
|
||||
struct timespec timeout);
|
||||
int (*start_filtering) (struct dmx_ts_feed* feed);
|
||||
int (*stop_filtering) (struct dmx_ts_feed* feed);
|
||||
int is_filtering;
|
||||
struct dmx_demux *parent;
|
||||
void *priv;
|
||||
int (*set)(struct dmx_ts_feed *feed,
|
||||
u16 pid,
|
||||
int type,
|
||||
enum dmx_ts_pes pes_type,
|
||||
size_t circular_buffer_size,
|
||||
struct timespec timeout);
|
||||
int (*start_filtering)(struct dmx_ts_feed *feed);
|
||||
int (*stop_filtering)(struct dmx_ts_feed *feed);
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
/* Section reception */
|
||||
/*--------------------------------------------------------------------------*/
|
||||
/*
|
||||
* Section reception
|
||||
*/
|
||||
|
||||
/**
|
||||
* struct dmx_section_filter - Structure that describes a section filter
|
||||
*
|
||||
* @filter_value: Contains up to 16 bytes (128 bits) of the TS section header
|
||||
* that will be matched by the section filter
|
||||
* @filter_mask: Contains a 16 bytes (128 bits) filter mask with the bits
|
||||
* specified by @filter_value that will be used on the filter
|
||||
* match logic.
|
||||
* @filter_mode: Contains a 16 bytes (128 bits) filter mode.
|
||||
* @parent: Pointer to struct dmx_section_feed.
|
||||
* @priv: Pointer to private data of the API client.
|
||||
*
|
||||
*
|
||||
* The @filter_mask controls which bits of @filter_value are compared with
|
||||
* the section headers/payload. On a binary value of 1 in filter_mask, the
|
||||
* corresponding bits are compared. The filter only accepts sections that are
|
||||
* equal to filter_value in all the tested bit positions.
|
||||
*/
|
||||
struct dmx_section_filter {
|
||||
u8 filter_value [DMX_MAX_FILTER_SIZE];
|
||||
u8 filter_mask [DMX_MAX_FILTER_SIZE];
|
||||
u8 filter_mode [DMX_MAX_FILTER_SIZE];
|
||||
struct dmx_section_feed* parent; /* Back-pointer */
|
||||
void* priv; /* Pointer to private data of the API client */
|
||||
u8 filter_value[DMX_MAX_FILTER_SIZE];
|
||||
u8 filter_mask[DMX_MAX_FILTER_SIZE];
|
||||
u8 filter_mode[DMX_MAX_FILTER_SIZE];
|
||||
struct dmx_section_feed *parent; /* Back-pointer */
|
||||
void *priv; /* Pointer to private data of the API client */
|
||||
};
|
||||
|
||||
/**
|
||||
* struct dmx_section_feed - Structure that contains a section feed filter
|
||||
*
|
||||
* @is_filtering: Set to non-zero when filtering in progress
|
||||
* @parent: pointer to struct dmx_demux
|
||||
* @priv: pointer to private data of the API client
|
||||
* @check_crc: If non-zero, check the CRC values of filtered sections.
|
||||
* @set: sets the section filter
|
||||
* @allocate_filter: This function is used to allocate a section filter on
|
||||
* the demux. It should only be called when no filtering
|
||||
* is in progress on this section feed. If a filter cannot
|
||||
* be allocated, the function fails with -ENOSPC.
|
||||
* @release_filter: This function releases all the resources of a
|
||||
* previously allocated section filter. The function
|
||||
* should not be called while filtering is in progress
|
||||
* on this section feed. After calling this function,
|
||||
* the caller should not try to dereference the filter
|
||||
* pointer.
|
||||
* @start_filtering: starts section filtering
|
||||
* @stop_filtering: stops section filtering
|
||||
*
|
||||
* A TS feed is typically mapped to a hardware PID filter on the demux chip.
|
||||
* Using this API, the client can set the filtering properties to start/stop
|
||||
* filtering TS packets on a particular TS feed.
|
||||
*/
|
||||
struct dmx_section_feed {
|
||||
int is_filtering; /* Set to non-zero when filtering in progress */
|
||||
struct dmx_demux* parent; /* Back-pointer */
|
||||
void* priv; /* Pointer to private data of the API client */
|
||||
int is_filtering;
|
||||
struct dmx_demux *parent;
|
||||
void *priv;
|
||||
|
||||
int check_crc;
|
||||
|
||||
/* private: Used internally at dvb_demux.c */
|
||||
u32 crc_val;
|
||||
|
||||
u8 *secbuf;
|
||||
u8 secbuf_base[DMX_MAX_SECFEED_SIZE];
|
||||
u16 secbufp, seclen, tsfeedp;
|
||||
|
||||
int (*set) (struct dmx_section_feed* feed,
|
||||
u16 pid,
|
||||
size_t circular_buffer_size,
|
||||
int check_crc);
|
||||
int (*allocate_filter) (struct dmx_section_feed* feed,
|
||||
struct dmx_section_filter** filter);
|
||||
int (*release_filter) (struct dmx_section_feed* feed,
|
||||
struct dmx_section_filter* filter);
|
||||
int (*start_filtering) (struct dmx_section_feed* feed);
|
||||
int (*stop_filtering) (struct dmx_section_feed* feed);
|
||||
/* public: */
|
||||
int (*set)(struct dmx_section_feed *feed,
|
||||
u16 pid,
|
||||
size_t circular_buffer_size,
|
||||
int check_crc);
|
||||
int (*allocate_filter)(struct dmx_section_feed *feed,
|
||||
struct dmx_section_filter **filter);
|
||||
int (*release_filter)(struct dmx_section_feed *feed,
|
||||
struct dmx_section_filter *filter);
|
||||
int (*start_filtering)(struct dmx_section_feed *feed);
|
||||
int (*stop_filtering)(struct dmx_section_feed *feed);
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
/* Callback functions */
|
||||
/*--------------------------------------------------------------------------*/
|
||||
/*
|
||||
* Callback functions
|
||||
*/
|
||||
|
||||
typedef int (*dmx_ts_cb) ( const u8 * buffer1,
|
||||
size_t buffer1_length,
|
||||
const u8 * buffer2,
|
||||
size_t buffer2_length,
|
||||
struct dmx_ts_feed* source,
|
||||
enum dmx_success success);
|
||||
/**
|
||||
* typedef dmx_ts_cb - DVB demux TS filter callback function prototype
|
||||
*
|
||||
* @buffer1: Pointer to the start of the filtered TS packets.
|
||||
* @buffer1_length: Length of the TS data in buffer1.
|
||||
* @buffer2: Pointer to the tail of the filtered TS packets, or NULL.
|
||||
* @buffer2_length: Length of the TS data in buffer2.
|
||||
* @source: Indicates which TS feed is the source of the callback.
|
||||
*
|
||||
* This function callback prototype, provided by the client of the demux API,
|
||||
* is called from the demux code. The function is only called when filtering
|
||||
* on ae TS feed has been enabled using the start_filtering() function at
|
||||
* the &dmx_demux.
|
||||
* Any TS packets that match the filter settings are copied to a circular
|
||||
* buffer. The filtered TS packets are delivered to the client using this
|
||||
* callback function. The size of the circular buffer is controlled by the
|
||||
* circular_buffer_size parameter of the &dmx_ts_feed.@set function.
|
||||
* It is expected that the @buffer1 and @buffer2 callback parameters point to
|
||||
* addresses within the circular buffer, but other implementations are also
|
||||
* possible. Note that the called party should not try to free the memory
|
||||
* the @buffer1 and @buffer2 parameters point to.
|
||||
*
|
||||
* When this function is called, the @buffer1 parameter typically points to
|
||||
* the start of the first undelivered TS packet within a circular buffer.
|
||||
* The @buffer2 buffer parameter is normally NULL, except when the received
|
||||
* TS packets have crossed the last address of the circular buffer and
|
||||
* ”wrapped” to the beginning of the buffer. In the latter case the @buffer1
|
||||
* parameter would contain an address within the circular buffer, while the
|
||||
* @buffer2 parameter would contain the first address of the circular buffer.
|
||||
* The number of bytes delivered with this function (i.e. @buffer1_length +
|
||||
* @buffer2_length) is usually equal to the value of callback_length parameter
|
||||
* given in the set() function, with one exception: if a timeout occurs before
|
||||
* receiving callback_length bytes of TS data, any undelivered packets are
|
||||
* immediately delivered to the client by calling this function. The timeout
|
||||
* duration is controlled by the set() function in the TS Feed API.
|
||||
*
|
||||
* If a TS packet is received with errors that could not be fixed by the
|
||||
* TS-level forward error correction (FEC), the Transport_error_indicator
|
||||
* flag of the TS packet header should be set. The TS packet should not be
|
||||
* discarded, as the error can possibly be corrected by a higher layer
|
||||
* protocol. If the called party is slow in processing the callback, it
|
||||
* is possible that the circular buffer eventually fills up. If this happens,
|
||||
* the demux driver should discard any TS packets received while the buffer
|
||||
* is full and return -EOVERFLOW.
|
||||
*
|
||||
* The type of data returned to the callback can be selected by the
|
||||
* &dmx_ts_feed.@set function. The type parameter decides if the raw
|
||||
* TS packet (TS_PACKET) or just the payload (TS_PACKET|TS_PAYLOAD_ONLY)
|
||||
* should be returned. If additionally the TS_DECODER bit is set the stream
|
||||
* will also be sent to the hardware MPEG decoder.
|
||||
*
|
||||
* Return:
|
||||
* 0, on success;
|
||||
* -EOVERFLOW, on buffer overflow.
|
||||
*/
|
||||
typedef int (*dmx_ts_cb)(const u8 *buffer1,
|
||||
size_t buffer1_length,
|
||||
const u8 *buffer2,
|
||||
size_t buffer2_length,
|
||||
struct dmx_ts_feed *source);
|
||||
|
||||
typedef int (*dmx_section_cb) ( const u8 * buffer1,
|
||||
size_t buffer1_len,
|
||||
const u8 * buffer2,
|
||||
size_t buffer2_len,
|
||||
struct dmx_section_filter * source,
|
||||
enum dmx_success success);
|
||||
/**
|
||||
* typedef dmx_section_cb - DVB demux TS filter callback function prototype
|
||||
*
|
||||
* @buffer1: Pointer to the start of the filtered section, e.g.
|
||||
* within the circular buffer of the demux driver.
|
||||
* @buffer1_len: Length of the filtered section data in @buffer1,
|
||||
* including headers and CRC.
|
||||
* @buffer2: Pointer to the tail of the filtered section data,
|
||||
* or NULL. Useful to handle the wrapping of a
|
||||
* circular buffer.
|
||||
* @buffer2_len: Length of the filtered section data in @buffer2,
|
||||
* including headers and CRC.
|
||||
* @source: Indicates which section feed is the source of the
|
||||
* callback.
|
||||
*
|
||||
* This function callback prototype, provided by the client of the demux API,
|
||||
* is called from the demux code. The function is only called when
|
||||
* filtering of sections has been enabled using the function
|
||||
* &dmx_ts_feed.@start_filtering. When the demux driver has received a
|
||||
* complete section that matches at least one section filter, the client
|
||||
* is notified via this callback function. Normally this function is called
|
||||
* for each received section; however, it is also possible to deliver
|
||||
* multiple sections with one callback, for example when the system load
|
||||
* is high. If an error occurs while receiving a section, this
|
||||
* function should be called with the corresponding error type set in the
|
||||
* success field, whether or not there is data to deliver. The Section Feed
|
||||
* implementation should maintain a circular buffer for received sections.
|
||||
* However, this is not necessary if the Section Feed API is implemented as
|
||||
* a client of the TS Feed API, because the TS Feed implementation then
|
||||
* buffers the received data. The size of the circular buffer can be
|
||||
* configured using the &dmx_ts_feed.@set function in the Section Feed API.
|
||||
* If there is no room in the circular buffer when a new section is received,
|
||||
* the section must be discarded. If this happens, the value of the success
|
||||
* parameter should be DMX_OVERRUN_ERROR on the next callback.
|
||||
*/
|
||||
typedef int (*dmx_section_cb)(const u8 *buffer1,
|
||||
size_t buffer1_len,
|
||||
const u8 *buffer2,
|
||||
size_t buffer2_len,
|
||||
struct dmx_section_filter *source);
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
/* DVB Front-End */
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* enum dmx_frontend_source - Used to identify the type of frontend
|
||||
*
|
||||
* @DMX_MEMORY_FE: The source of the demux is memory. It means that
|
||||
* the MPEG-TS to be filtered comes from userspace,
|
||||
* via write() syscall.
|
||||
*
|
||||
* @DMX_FRONTEND_0: The source of the demux is a frontend connected
|
||||
* to the demux.
|
||||
*/
|
||||
enum dmx_frontend_source {
|
||||
DMX_MEMORY_FE,
|
||||
DMX_FRONTEND_0,
|
||||
DMX_FRONTEND_1,
|
||||
DMX_FRONTEND_2,
|
||||
DMX_FRONTEND_3,
|
||||
DMX_STREAM_0, /* external stream input, e.g. LVDS */
|
||||
DMX_STREAM_1,
|
||||
DMX_STREAM_2,
|
||||
DMX_STREAM_3
|
||||
};
|
||||
|
||||
/**
|
||||
* struct dmx_frontend - Structure that lists the frontends associated with
|
||||
* a demux
|
||||
*
|
||||
* @connectivity_list: List of front-ends that can be connected to a
|
||||
* particular demux;
|
||||
* @source: Type of the frontend.
|
||||
*
|
||||
* FIXME: this structure should likely be replaced soon by some
|
||||
* media-controller based logic.
|
||||
*/
|
||||
struct dmx_frontend {
|
||||
struct list_head connectivity_list; /* List of front-ends that can
|
||||
be connected to a particular
|
||||
demux */
|
||||
struct list_head connectivity_list;
|
||||
enum dmx_frontend_source source;
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
/* MPEG-2 TS Demux */
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Flags OR'ed in the capabilities field of struct dmx_demux.
|
||||
* MPEG-2 TS Demux
|
||||
*/
|
||||
|
||||
#define DMX_TS_FILTERING 1
|
||||
#define DMX_PES_FILTERING 2
|
||||
#define DMX_SECTION_FILTERING 4
|
||||
#define DMX_MEMORY_BASED_FILTERING 8 /* write() available */
|
||||
#define DMX_CRC_CHECKING 16
|
||||
#define DMX_TS_DESCRAMBLING 32
|
||||
/**
|
||||
* enum dmx_demux_caps - MPEG-2 TS Demux capabilities bitmap
|
||||
*
|
||||
* @DMX_TS_FILTERING: set if TS filtering is supported;
|
||||
* @DMX_SECTION_FILTERING: set if section filtering is supported;
|
||||
* @DMX_MEMORY_BASED_FILTERING: set if write() available.
|
||||
*
|
||||
* Those flags are OR'ed in the &dmx_demux.&capabilities field
|
||||
*/
|
||||
enum dmx_demux_caps {
|
||||
DMX_TS_FILTERING = 1,
|
||||
DMX_SECTION_FILTERING = 4,
|
||||
DMX_MEMORY_BASED_FILTERING = 8,
|
||||
};
|
||||
|
||||
/*
|
||||
* Demux resource type identifier.
|
||||
|
|
@ -200,42 +358,241 @@ struct dmx_frontend {
|
|||
*.
|
||||
*/
|
||||
|
||||
#define DMX_FE_ENTRY(list) list_entry(list, struct dmx_frontend, connectivity_list)
|
||||
#define DMX_FE_ENTRY(list) \
|
||||
list_entry(list, struct dmx_frontend, connectivity_list)
|
||||
|
||||
/**
|
||||
* struct dmx_demux - Structure that contains the demux capabilities and
|
||||
* callbacks.
|
||||
*
|
||||
* @capabilities: Bitfield of capability flags.
|
||||
*
|
||||
* @frontend: Front-end connected to the demux
|
||||
*
|
||||
* @priv: Pointer to private data of the API client
|
||||
*
|
||||
* @open: This function reserves the demux for use by the caller and, if
|
||||
* necessary, initializes the demux. When the demux is no longer needed,
|
||||
* the function @close should be called. It should be possible for
|
||||
* multiple clients to access the demux at the same time. Thus, the
|
||||
* function implementation should increment the demux usage count when
|
||||
* @open is called and decrement it when @close is called.
|
||||
* The @demux function parameter contains a pointer to the demux API and
|
||||
* instance data.
|
||||
* It returns
|
||||
* 0 on success;
|
||||
* -EUSERS, if maximum usage count was reached;
|
||||
* -EINVAL, on bad parameter.
|
||||
*
|
||||
* @close: This function reserves the demux for use by the caller and, if
|
||||
* necessary, initializes the demux. When the demux is no longer needed,
|
||||
* the function @close should be called. It should be possible for
|
||||
* multiple clients to access the demux at the same time. Thus, the
|
||||
* function implementation should increment the demux usage count when
|
||||
* @open is called and decrement it when @close is called.
|
||||
* The @demux function parameter contains a pointer to the demux API and
|
||||
* instance data.
|
||||
* It returns
|
||||
* 0 on success;
|
||||
* -ENODEV, if demux was not in use (e. g. no users);
|
||||
* -EINVAL, on bad parameter.
|
||||
*
|
||||
* @write: This function provides the demux driver with a memory buffer
|
||||
* containing TS packets. Instead of receiving TS packets from the DVB
|
||||
* front-end, the demux driver software will read packets from memory.
|
||||
* Any clients of this demux with active TS, PES or Section filters will
|
||||
* receive filtered data via the Demux callback API (see 0). The function
|
||||
* returns when all the data in the buffer has been consumed by the demux.
|
||||
* Demux hardware typically cannot read TS from memory. If this is the
|
||||
* case, memory-based filtering has to be implemented entirely in software.
|
||||
* The @demux function parameter contains a pointer to the demux API and
|
||||
* instance data.
|
||||
* The @buf function parameter contains a pointer to the TS data in
|
||||
* kernel-space memory.
|
||||
* The @count function parameter contains the length of the TS data.
|
||||
* It returns
|
||||
* 0 on success;
|
||||
* -ERESTARTSYS, if mutex lock was interrupted;
|
||||
* -EINTR, if a signal handling is pending;
|
||||
* -ENODEV, if demux was removed;
|
||||
* -EINVAL, on bad parameter.
|
||||
*
|
||||
* @allocate_ts_feed: Allocates a new TS feed, which is used to filter the TS
|
||||
* packets carrying a certain PID. The TS feed normally corresponds to a
|
||||
* hardware PID filter on the demux chip.
|
||||
* The @demux function parameter contains a pointer to the demux API and
|
||||
* instance data.
|
||||
* The @feed function parameter contains a pointer to the TS feed API and
|
||||
* instance data.
|
||||
* The @callback function parameter contains a pointer to the callback
|
||||
* function for passing received TS packet.
|
||||
* It returns
|
||||
* 0 on success;
|
||||
* -ERESTARTSYS, if mutex lock was interrupted;
|
||||
* -EBUSY, if no more TS feeds is available;
|
||||
* -EINVAL, on bad parameter.
|
||||
*
|
||||
* @release_ts_feed: Releases the resources allocated with @allocate_ts_feed.
|
||||
* Any filtering in progress on the TS feed should be stopped before
|
||||
* calling this function.
|
||||
* The @demux function parameter contains a pointer to the demux API and
|
||||
* instance data.
|
||||
* The @feed function parameter contains a pointer to the TS feed API and
|
||||
* instance data.
|
||||
* It returns
|
||||
* 0 on success;
|
||||
* -EINVAL on bad parameter.
|
||||
*
|
||||
* @allocate_section_feed: Allocates a new section feed, i.e. a demux resource
|
||||
* for filtering and receiving sections. On platforms with hardware
|
||||
* support for section filtering, a section feed is directly mapped to
|
||||
* the demux HW. On other platforms, TS packets are first PID filtered in
|
||||
* hardware and a hardware section filter then emulated in software. The
|
||||
* caller obtains an API pointer of type dmx_section_feed_t as an out
|
||||
* parameter. Using this API the caller can set filtering parameters and
|
||||
* start receiving sections.
|
||||
* The @demux function parameter contains a pointer to the demux API and
|
||||
* instance data.
|
||||
* The @feed function parameter contains a pointer to the TS feed API and
|
||||
* instance data.
|
||||
* The @callback function parameter contains a pointer to the callback
|
||||
* function for passing received TS packet.
|
||||
* It returns
|
||||
* 0 on success;
|
||||
* -EBUSY, if no more TS feeds is available;
|
||||
* -EINVAL, on bad parameter.
|
||||
*
|
||||
* @release_section_feed: Releases the resources allocated with
|
||||
* @allocate_section_feed, including allocated filters. Any filtering in
|
||||
* progress on the section feed should be stopped before calling this
|
||||
* function.
|
||||
* The @demux function parameter contains a pointer to the demux API and
|
||||
* instance data.
|
||||
* The @feed function parameter contains a pointer to the TS feed API and
|
||||
* instance data.
|
||||
* It returns
|
||||
* 0 on success;
|
||||
* -EINVAL, on bad parameter.
|
||||
*
|
||||
* @add_frontend: Registers a connectivity between a demux and a front-end,
|
||||
* i.e., indicates that the demux can be connected via a call to
|
||||
* @connect_frontend to use the given front-end as a TS source. The
|
||||
* client of this function has to allocate dynamic or static memory for
|
||||
* the frontend structure and initialize its fields before calling this
|
||||
* function. This function is normally called during the driver
|
||||
* initialization. The caller must not free the memory of the frontend
|
||||
* struct before successfully calling @remove_frontend.
|
||||
* The @demux function parameter contains a pointer to the demux API and
|
||||
* instance data.
|
||||
* The @frontend function parameter contains a pointer to the front-end
|
||||
* instance data.
|
||||
* It returns
|
||||
* 0 on success;
|
||||
* -EINVAL, on bad parameter.
|
||||
*
|
||||
* @remove_frontend: Indicates that the given front-end, registered by a call
|
||||
* to @add_frontend, can no longer be connected as a TS source by this
|
||||
* demux. The function should be called when a front-end driver or a demux
|
||||
* driver is removed from the system. If the front-end is in use, the
|
||||
* function fails with the return value of -EBUSY. After successfully
|
||||
* calling this function, the caller can free the memory of the frontend
|
||||
* struct if it was dynamically allocated before the @add_frontend
|
||||
* operation.
|
||||
* The @demux function parameter contains a pointer to the demux API and
|
||||
* instance data.
|
||||
* The @frontend function parameter contains a pointer to the front-end
|
||||
* instance data.
|
||||
* It returns
|
||||
* 0 on success;
|
||||
* -ENODEV, if the front-end was not found,
|
||||
* -EINVAL, on bad parameter.
|
||||
*
|
||||
* @get_frontends: Provides the APIs of the front-ends that have been
|
||||
* registered for this demux. Any of the front-ends obtained with this
|
||||
* call can be used as a parameter for @connect_frontend. The include
|
||||
* file demux.h contains the macro DMX_FE_ENTRY() for converting an
|
||||
* element of the generic type struct &list_head * to the type
|
||||
* struct &dmx_frontend *. The caller must not free the memory of any of
|
||||
* the elements obtained via this function call.
|
||||
* The @demux function parameter contains a pointer to the demux API and
|
||||
* instance data.
|
||||
* It returns a struct list_head pointer to the list of front-end
|
||||
* interfaces, or NULL in the case of an empty list.
|
||||
*
|
||||
* @connect_frontend: Connects the TS output of the front-end to the input of
|
||||
* the demux. A demux can only be connected to a front-end registered to
|
||||
* the demux with the function @add_frontend. It may or may not be
|
||||
* possible to connect multiple demuxes to the same front-end, depending
|
||||
* on the capabilities of the HW platform. When not used, the front-end
|
||||
* should be released by calling @disconnect_frontend.
|
||||
* The @demux function parameter contains a pointer to the demux API and
|
||||
* instance data.
|
||||
* The @frontend function parameter contains a pointer to the front-end
|
||||
* instance data.
|
||||
* It returns
|
||||
* 0 on success;
|
||||
* -EINVAL, on bad parameter.
|
||||
*
|
||||
* @disconnect_frontend: Disconnects the demux and a front-end previously
|
||||
* connected by a @connect_frontend call.
|
||||
* The @demux function parameter contains a pointer to the demux API and
|
||||
* instance data.
|
||||
* It returns
|
||||
* 0 on success;
|
||||
* -EINVAL on bad parameter.
|
||||
*
|
||||
* @get_pes_pids: Get the PIDs for DMX_PES_AUDIO0, DMX_PES_VIDEO0,
|
||||
* DMX_PES_TELETEXT0, DMX_PES_SUBTITLE0 and DMX_PES_PCR0.
|
||||
* The @demux function parameter contains a pointer to the demux API and
|
||||
* instance data.
|
||||
* The @pids function parameter contains an array with five u16 elements
|
||||
* where the PIDs will be stored.
|
||||
* It returns
|
||||
* 0 on success;
|
||||
* -EINVAL on bad parameter.
|
||||
*/
|
||||
|
||||
struct dmx_demux {
|
||||
u32 capabilities; /* Bitfield of capability flags */
|
||||
struct dmx_frontend* frontend; /* Front-end connected to the demux */
|
||||
void* priv; /* Pointer to private data of the API client */
|
||||
int (*open) (struct dmx_demux* demux);
|
||||
int (*close) (struct dmx_demux* demux);
|
||||
int (*write) (struct dmx_demux* demux, const char __user *buf, size_t count);
|
||||
int (*allocate_ts_feed) (struct dmx_demux* demux,
|
||||
struct dmx_ts_feed** feed,
|
||||
dmx_ts_cb callback);
|
||||
int (*release_ts_feed) (struct dmx_demux* demux,
|
||||
struct dmx_ts_feed* feed);
|
||||
int (*allocate_section_feed) (struct dmx_demux* demux,
|
||||
struct dmx_section_feed** feed,
|
||||
dmx_section_cb callback);
|
||||
int (*release_section_feed) (struct dmx_demux* demux,
|
||||
struct dmx_section_feed* feed);
|
||||
int (*add_frontend) (struct dmx_demux* demux,
|
||||
struct dmx_frontend* frontend);
|
||||
int (*remove_frontend) (struct dmx_demux* demux,
|
||||
struct dmx_frontend* frontend);
|
||||
struct list_head* (*get_frontends) (struct dmx_demux* demux);
|
||||
int (*connect_frontend) (struct dmx_demux* demux,
|
||||
struct dmx_frontend* frontend);
|
||||
int (*disconnect_frontend) (struct dmx_demux* demux);
|
||||
enum dmx_demux_caps capabilities;
|
||||
struct dmx_frontend *frontend;
|
||||
void *priv;
|
||||
int (*open)(struct dmx_demux *demux);
|
||||
int (*close)(struct dmx_demux *demux);
|
||||
int (*write)(struct dmx_demux *demux, const char __user *buf,
|
||||
size_t count);
|
||||
int (*allocate_ts_feed)(struct dmx_demux *demux,
|
||||
struct dmx_ts_feed **feed,
|
||||
dmx_ts_cb callback);
|
||||
int (*release_ts_feed)(struct dmx_demux *demux,
|
||||
struct dmx_ts_feed *feed);
|
||||
int (*allocate_section_feed)(struct dmx_demux *demux,
|
||||
struct dmx_section_feed **feed,
|
||||
dmx_section_cb callback);
|
||||
int (*release_section_feed)(struct dmx_demux *demux,
|
||||
struct dmx_section_feed *feed);
|
||||
int (*add_frontend)(struct dmx_demux *demux,
|
||||
struct dmx_frontend *frontend);
|
||||
int (*remove_frontend)(struct dmx_demux *demux,
|
||||
struct dmx_frontend *frontend);
|
||||
struct list_head *(*get_frontends)(struct dmx_demux *demux);
|
||||
int (*connect_frontend)(struct dmx_demux *demux,
|
||||
struct dmx_frontend *frontend);
|
||||
int (*disconnect_frontend)(struct dmx_demux *demux);
|
||||
|
||||
int (*get_pes_pids) (struct dmx_demux* demux, u16 *pids);
|
||||
int (*get_pes_pids)(struct dmx_demux *demux, u16 *pids);
|
||||
|
||||
int (*get_caps) (struct dmx_demux* demux, struct dmx_caps *caps);
|
||||
|
||||
int (*set_source) (struct dmx_demux* demux, const dmx_source_t *src);
|
||||
|
||||
int (*get_stc) (struct dmx_demux* demux, unsigned int num,
|
||||
u64 *stc, unsigned int *base);
|
||||
/* private: Not used upstream and never documented */
|
||||
#if 0
|
||||
int (*get_caps)(struct dmx_demux *demux, struct dmx_caps *caps);
|
||||
int (*set_source)(struct dmx_demux *demux, const dmx_source_t *src);
|
||||
#endif
|
||||
/*
|
||||
* private: Only used at av7110, to read some data from firmware.
|
||||
* As this was never documented, we have no clue about what's
|
||||
* there, and its usage on other drivers aren't encouraged.
|
||||
*/
|
||||
int (*get_stc)(struct dmx_demux *demux, unsigned int num,
|
||||
u64 *stc, unsigned int *base);
|
||||
};
|
||||
|
||||
#endif /* #ifndef __DEMUX_H */
|
||||
|
|
|
|||
|
|
@ -352,8 +352,7 @@ static void dvb_dmxdev_filter_timer(struct dmxdev_filter *dmxdevfilter)
|
|||
|
||||
static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len,
|
||||
const u8 *buffer2, size_t buffer2_len,
|
||||
struct dmx_section_filter *filter,
|
||||
enum dmx_success success)
|
||||
struct dmx_section_filter *filter)
|
||||
{
|
||||
struct dmxdev_filter *dmxdevfilter = filter->priv;
|
||||
int ret;
|
||||
|
|
@ -386,8 +385,7 @@ static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len,
|
|||
|
||||
static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len,
|
||||
const u8 *buffer2, size_t buffer2_len,
|
||||
struct dmx_ts_feed *feed,
|
||||
enum dmx_success success)
|
||||
struct dmx_ts_feed *feed)
|
||||
{
|
||||
struct dmxdev_filter *dmxdevfilter = feed->priv;
|
||||
struct dvb_ringbuffer *buffer;
|
||||
|
|
@ -1023,6 +1021,9 @@ static int dvb_demux_do_ioctl(struct file *file,
|
|||
dmxdev->demux->get_pes_pids(dmxdev->demux, parg);
|
||||
break;
|
||||
|
||||
#if 0
|
||||
/* Not used upstream and never documented */
|
||||
|
||||
case DMX_GET_CAPS:
|
||||
if (!dmxdev->demux->get_caps) {
|
||||
ret = -EINVAL;
|
||||
|
|
@ -1038,6 +1039,7 @@ static int dvb_demux_do_ioctl(struct file *file,
|
|||
}
|
||||
ret = dmxdev->demux->set_source(dmxdev->demux, parg);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case DMX_GET_STC:
|
||||
if (!dmxdev->demux->get_stc) {
|
||||
|
|
|
|||
|
|
@ -257,6 +257,7 @@
|
|||
#define USB_PID_TERRATEC_CINERGY_T_XXS_2 0x00ab
|
||||
#define USB_PID_TERRATEC_H7 0x10b4
|
||||
#define USB_PID_TERRATEC_H7_2 0x10a3
|
||||
#define USB_PID_TERRATEC_H7_3 0x10a5
|
||||
#define USB_PID_TERRATEC_T3 0x10a0
|
||||
#define USB_PID_TERRATEC_T5 0x10a1
|
||||
#define USB_PID_NOXON_DAB_STICK 0x00b3
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
* 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 Lesser General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _DVB_CA_EN50221_H_
|
||||
|
|
@ -37,50 +33,53 @@
|
|||
#define DVB_CA_EN50221_CAMCHANGE_REMOVED 0
|
||||
#define DVB_CA_EN50221_CAMCHANGE_INSERTED 1
|
||||
|
||||
|
||||
|
||||
/* Structure describing a CA interface */
|
||||
/**
|
||||
* struct dvb_ca_en50221- Structure describing a CA interface
|
||||
*
|
||||
* @owner: the module owning this structure
|
||||
* @read_attribute_mem: function for reading attribute memory on the CAM
|
||||
* @write_attribute_mem: function for writing attribute memory on the CAM
|
||||
* @read_cam_control: function for reading the control interface on the CAM
|
||||
* @write_cam_control: function for reading the control interface on the CAM
|
||||
* @slot_reset: function to reset the CAM slot
|
||||
* @slot_shutdown: function to shutdown a CAM slot
|
||||
* @slot_ts_enable: function to enable the Transport Stream on a CAM slot
|
||||
* @poll_slot_status: function to poll slot status. Only necessary if
|
||||
* DVB_CA_FLAG_EN50221_IRQ_CAMCHANGE is not set.
|
||||
* @data: private data, used by caller.
|
||||
* @private: Opaque data used by the dvb_ca core. Do not modify!
|
||||
*
|
||||
* NOTE: the read_*, write_* and poll_slot_status functions will be
|
||||
* called for different slots concurrently and need to use locks where
|
||||
* and if appropriate. There will be no concurrent access to one slot.
|
||||
*/
|
||||
struct dvb_ca_en50221 {
|
||||
struct module *owner;
|
||||
|
||||
/* the module owning this structure */
|
||||
struct module* owner;
|
||||
int (*read_attribute_mem)(struct dvb_ca_en50221 *ca,
|
||||
int slot, int address);
|
||||
int (*write_attribute_mem)(struct dvb_ca_en50221 *ca,
|
||||
int slot, int address, u8 value);
|
||||
|
||||
/* NOTE: the read_*, write_* and poll_slot_status functions will be
|
||||
* called for different slots concurrently and need to use locks where
|
||||
* and if appropriate. There will be no concurrent access to one slot.
|
||||
*/
|
||||
int (*read_cam_control)(struct dvb_ca_en50221 *ca,
|
||||
int slot, u8 address);
|
||||
int (*write_cam_control)(struct dvb_ca_en50221 *ca,
|
||||
int slot, u8 address, u8 value);
|
||||
|
||||
/* functions for accessing attribute memory on the CAM */
|
||||
int (*read_attribute_mem)(struct dvb_ca_en50221* ca, int slot, int address);
|
||||
int (*write_attribute_mem)(struct dvb_ca_en50221* ca, int slot, int address, u8 value);
|
||||
int (*slot_reset)(struct dvb_ca_en50221 *ca, int slot);
|
||||
int (*slot_shutdown)(struct dvb_ca_en50221 *ca, int slot);
|
||||
int (*slot_ts_enable)(struct dvb_ca_en50221 *ca, int slot);
|
||||
|
||||
/* functions for accessing the control interface on the CAM */
|
||||
int (*read_cam_control)(struct dvb_ca_en50221* ca, int slot, u8 address);
|
||||
int (*write_cam_control)(struct dvb_ca_en50221* ca, int slot, u8 address, u8 value);
|
||||
int (*poll_slot_status)(struct dvb_ca_en50221 *ca, int slot, int open);
|
||||
|
||||
/* Functions for controlling slots */
|
||||
int (*slot_reset)(struct dvb_ca_en50221* ca, int slot);
|
||||
int (*slot_shutdown)(struct dvb_ca_en50221* ca, int slot);
|
||||
int (*slot_ts_enable)(struct dvb_ca_en50221* ca, int slot);
|
||||
void *data;
|
||||
|
||||
/*
|
||||
* Poll slot status.
|
||||
* Only necessary if DVB_CA_FLAG_EN50221_IRQ_CAMCHANGE is not set
|
||||
*/
|
||||
int (*poll_slot_status)(struct dvb_ca_en50221* ca, int slot, int open);
|
||||
|
||||
/* private data, used by caller */
|
||||
void* data;
|
||||
|
||||
/* Opaque data used by the dvb_ca core. Do not modify! */
|
||||
void* private;
|
||||
void *private;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/* ******************************************************************************** */
|
||||
/* Functions for reporting IRQ events */
|
||||
/*
|
||||
* Functions for reporting IRQ events
|
||||
*/
|
||||
|
||||
/**
|
||||
* dvb_ca_en50221_camchange_irq - A CAMCHANGE IRQ has occurred.
|
||||
|
|
@ -89,7 +88,8 @@ struct dvb_ca_en50221 {
|
|||
* @slot: Slot concerned.
|
||||
* @change_type: One of the DVB_CA_CAMCHANGE_* values
|
||||
*/
|
||||
void dvb_ca_en50221_camchange_irq(struct dvb_ca_en50221* pubca, int slot, int change_type);
|
||||
void dvb_ca_en50221_camchange_irq(struct dvb_ca_en50221 *pubca, int slot,
|
||||
int change_type);
|
||||
|
||||
/**
|
||||
* dvb_ca_en50221_camready_irq - A CAMREADY IRQ has occurred.
|
||||
|
|
@ -97,7 +97,7 @@ void dvb_ca_en50221_camchange_irq(struct dvb_ca_en50221* pubca, int slot, int ch
|
|||
* @pubca: CA instance.
|
||||
* @slot: Slot concerned.
|
||||
*/
|
||||
void dvb_ca_en50221_camready_irq(struct dvb_ca_en50221* pubca, int slot);
|
||||
void dvb_ca_en50221_camready_irq(struct dvb_ca_en50221 *pubca, int slot);
|
||||
|
||||
/**
|
||||
* dvb_ca_en50221_frda_irq - An FR or a DA IRQ has occurred.
|
||||
|
|
@ -105,12 +105,11 @@ void dvb_ca_en50221_camready_irq(struct dvb_ca_en50221* pubca, int slot);
|
|||
* @ca: CA instance.
|
||||
* @slot: Slot concerned.
|
||||
*/
|
||||
void dvb_ca_en50221_frda_irq(struct dvb_ca_en50221* ca, int slot);
|
||||
void dvb_ca_en50221_frda_irq(struct dvb_ca_en50221 *ca, int slot);
|
||||
|
||||
|
||||
|
||||
/* ******************************************************************************** */
|
||||
/* Initialisation/shutdown functions */
|
||||
/*
|
||||
* Initialisation/shutdown functions
|
||||
*/
|
||||
|
||||
/**
|
||||
* dvb_ca_en50221_init - Initialise a new DVB CA device.
|
||||
|
|
@ -122,15 +121,15 @@ void dvb_ca_en50221_frda_irq(struct dvb_ca_en50221* ca, int slot);
|
|||
*
|
||||
* @return 0 on success, nonzero on failure
|
||||
*/
|
||||
extern int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, struct dvb_ca_en50221* ca, int flags, int slot_count);
|
||||
extern int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter,
|
||||
struct dvb_ca_en50221 *ca, int flags,
|
||||
int slot_count);
|
||||
|
||||
/**
|
||||
* dvb_ca_en50221_release - Release a DVB CA device.
|
||||
*
|
||||
* @ca: The associated dvb_ca instance.
|
||||
*/
|
||||
extern void dvb_ca_en50221_release(struct dvb_ca_en50221* ca);
|
||||
|
||||
|
||||
extern void dvb_ca_en50221_release(struct dvb_ca_en50221 *ca);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ static inline int dvb_dmx_swfilter_payload(struct dvb_demux_feed *feed,
|
|||
|
||||
feed->peslen += count;
|
||||
|
||||
return feed->cb.ts(&buf[p], count, NULL, 0, &feed->feed.ts, DMX_OK);
|
||||
return feed->cb.ts(&buf[p], count, NULL, 0, &feed->feed.ts);
|
||||
}
|
||||
|
||||
static int dvb_dmx_swfilter_sectionfilter(struct dvb_demux_feed *feed,
|
||||
|
|
@ -152,7 +152,7 @@ static int dvb_dmx_swfilter_sectionfilter(struct dvb_demux_feed *feed,
|
|||
return 0;
|
||||
|
||||
return feed->cb.sec(feed->feed.sec.secbuf, feed->feed.sec.seclen,
|
||||
NULL, 0, &f->filter, DMX_OK);
|
||||
NULL, 0, &f->filter);
|
||||
}
|
||||
|
||||
static inline int dvb_dmx_swfilter_section_feed(struct dvb_demux_feed *feed)
|
||||
|
|
@ -367,8 +367,7 @@ static inline void dvb_dmx_swfilter_packet_type(struct dvb_demux_feed *feed,
|
|||
if (feed->ts_type & TS_PAYLOAD_ONLY)
|
||||
dvb_dmx_swfilter_payload(feed, buf);
|
||||
else
|
||||
feed->cb.ts(buf, 188, NULL, 0, &feed->feed.ts,
|
||||
DMX_OK);
|
||||
feed->cb.ts(buf, 188, NULL, 0, &feed->feed.ts);
|
||||
}
|
||||
if (feed->ts_type & TS_DECODER)
|
||||
if (feed->demux->write_to_decoder)
|
||||
|
|
@ -469,7 +468,7 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
|
|||
if (feed->pid == pid)
|
||||
dvb_dmx_swfilter_packet_type(feed, buf);
|
||||
else if (feed->pid == 0x2000)
|
||||
feed->cb.ts(buf, 188, NULL, 0, &feed->feed.ts, DMX_OK);
|
||||
feed->cb.ts(buf, 188, NULL, 0, &feed->feed.ts);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -588,7 +587,7 @@ void dvb_dmx_swfilter_raw(struct dvb_demux *demux, const u8 *buf, size_t count)
|
|||
|
||||
spin_lock_irqsave(&demux->lock, flags);
|
||||
|
||||
demux->feed->cb.ts(buf, count, NULL, 0, &demux->feed->feed.ts, DMX_OK);
|
||||
demux->feed->cb.ts(buf, count, NULL, 0, &demux->feed->feed.ts);
|
||||
|
||||
spin_unlock_irqrestore(&demux->lock, flags);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -761,7 +761,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
|
|||
|
||||
static int dvb_net_ts_callback(const u8 *buffer1, size_t buffer1_len,
|
||||
const u8 *buffer2, size_t buffer2_len,
|
||||
struct dmx_ts_feed *feed, enum dmx_success success)
|
||||
struct dmx_ts_feed *feed)
|
||||
{
|
||||
struct net_device *dev = feed->priv;
|
||||
|
||||
|
|
@ -870,8 +870,7 @@ static void dvb_net_sec(struct net_device *dev,
|
|||
|
||||
static int dvb_net_sec_callback(const u8 *buffer1, size_t buffer1_len,
|
||||
const u8 *buffer2, size_t buffer2_len,
|
||||
struct dmx_section_filter *filter,
|
||||
enum dmx_success success)
|
||||
struct dmx_section_filter *filter)
|
||||
{
|
||||
struct net_device *dev = filter->priv;
|
||||
|
||||
|
|
|
|||
|
|
@ -184,10 +184,6 @@ int dvb_unregister_adapter(struct dvb_adapter *adap);
|
|||
* @pdvbdev: pointer to the place where the new struct dvb_device will be
|
||||
* stored
|
||||
* @template: Template used to create &pdvbdev;
|
||||
* @device: pointer to struct device that corresponds to the device driver
|
||||
* @adapter_nums: Array with a list of the numbers for @dvb_register_adapter;
|
||||
* to select among them. Typically, initialized with:
|
||||
* DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nums)
|
||||
* @priv: private data
|
||||
* @type: type of the device: DVB_DEVICE_SEC, DVB_DEVICE_FRONTEND,
|
||||
* DVB_DEVICE_DEMUX, DVB_DEVICE_DVR, DVB_DEVICE_CA, DVB_DEVICE_NET
|
||||
|
|
|
|||
|
|
@ -2950,10 +2950,9 @@ struct dvb_frontend *drxd_attach(const struct drxd_config *config,
|
|||
{
|
||||
struct drxd_state *state = NULL;
|
||||
|
||||
state = kmalloc(sizeof(struct drxd_state), GFP_KERNEL);
|
||||
state = kzalloc(sizeof(*state), GFP_KERNEL);
|
||||
if (!state)
|
||||
return NULL;
|
||||
memset(state, 0, sizeof(*state));
|
||||
|
||||
state->ops = drxd_ops;
|
||||
state->dev = dev;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include <media/v4l2-ioctl.h>
|
||||
#include <media/v4l2-ctrls.h>
|
||||
#include <media/v4l2-event.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
#include <media/videobuf2-vmalloc.h>
|
||||
|
||||
#include <linux/platform_device.h>
|
||||
|
|
@ -107,7 +108,8 @@ static const unsigned int NUM_FORMATS = ARRAY_SIZE(formats);
|
|||
|
||||
/* intermediate buffers with raw data from the USB device */
|
||||
struct rtl2832_sdr_frame_buf {
|
||||
struct vb2_buffer vb; /* common v4l buffer stuff -- must be first */
|
||||
/* common v4l buffer stuff -- must be first */
|
||||
struct vb2_v4l2_buffer vb;
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
|
|
@ -304,13 +306,13 @@ static void rtl2832_sdr_urb_complete(struct urb *urb)
|
|||
}
|
||||
|
||||
/* fill framebuffer */
|
||||
ptr = vb2_plane_vaddr(&fbuf->vb, 0);
|
||||
ptr = vb2_plane_vaddr(&fbuf->vb.vb2_buf, 0);
|
||||
len = rtl2832_sdr_convert_stream(dev, ptr, urb->transfer_buffer,
|
||||
urb->actual_length);
|
||||
vb2_set_plane_payload(&fbuf->vb, 0, len);
|
||||
v4l2_get_timestamp(&fbuf->vb.v4l2_buf.timestamp);
|
||||
fbuf->vb.v4l2_buf.sequence = dev->sequence++;
|
||||
vb2_buffer_done(&fbuf->vb, VB2_BUF_STATE_DONE);
|
||||
vb2_set_plane_payload(&fbuf->vb.vb2_buf, 0, len);
|
||||
v4l2_get_timestamp(&fbuf->vb.timestamp);
|
||||
fbuf->vb.sequence = dev->sequence++;
|
||||
vb2_buffer_done(&fbuf->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
||||
}
|
||||
skip:
|
||||
usb_submit_urb(urb, GFP_ATOMIC);
|
||||
|
|
@ -464,7 +466,7 @@ static void rtl2832_sdr_cleanup_queued_bufs(struct rtl2832_sdr_dev *dev)
|
|||
buf = list_entry(dev->queued_bufs.next,
|
||||
struct rtl2832_sdr_frame_buf, list);
|
||||
list_del(&buf->list);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
spin_unlock_irqrestore(&dev->queued_bufs_lock, flags);
|
||||
}
|
||||
|
|
@ -488,7 +490,7 @@ static int rtl2832_sdr_querycap(struct file *file, void *fh,
|
|||
|
||||
/* Videobuf2 operations */
|
||||
static int rtl2832_sdr_queue_setup(struct vb2_queue *vq,
|
||||
const struct v4l2_format *fmt, unsigned int *nbuffers,
|
||||
const void *parg, unsigned int *nbuffers,
|
||||
unsigned int *nplanes, unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
struct rtl2832_sdr_dev *dev = vb2_get_drv_priv(vq);
|
||||
|
|
@ -518,14 +520,15 @@ static int rtl2832_sdr_buf_prepare(struct vb2_buffer *vb)
|
|||
|
||||
static void rtl2832_sdr_buf_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct rtl2832_sdr_dev *dev = vb2_get_drv_priv(vb->vb2_queue);
|
||||
struct rtl2832_sdr_frame_buf *buf =
|
||||
container_of(vb, struct rtl2832_sdr_frame_buf, vb);
|
||||
container_of(vbuf, struct rtl2832_sdr_frame_buf, vb);
|
||||
unsigned long flags;
|
||||
|
||||
/* Check the device has not disconnected between prep and queuing */
|
||||
if (!dev->udev) {
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -233,6 +233,15 @@ static int ml86v7667_g_mbus_config(struct v4l2_subdev *sd,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ml86v7667_g_std(struct v4l2_subdev *sd, v4l2_std_id *std)
|
||||
{
|
||||
struct ml86v7667_priv *priv = to_ml86v7667(sd);
|
||||
|
||||
*std = priv->std;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ml86v7667_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
|
||||
{
|
||||
struct ml86v7667_priv *priv = to_ml86v7667(sd);
|
||||
|
|
@ -282,6 +291,7 @@ static const struct v4l2_ctrl_ops ml86v7667_ctrl_ops = {
|
|||
};
|
||||
|
||||
static struct v4l2_subdev_video_ops ml86v7667_subdev_video_ops = {
|
||||
.g_std = ml86v7667_g_std,
|
||||
.s_std = ml86v7667_s_std,
|
||||
.querystd = ml86v7667_querystd,
|
||||
.g_input_status = ml86v7667_g_input_status,
|
||||
|
|
@ -427,7 +437,6 @@ MODULE_DEVICE_TABLE(i2c, ml86v7667_id);
|
|||
static struct i2c_driver ml86v7667_i2c_driver = {
|
||||
.driver = {
|
||||
.name = DRV_NAME,
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = ml86v7667_probe,
|
||||
.remove = ml86v7667_remove,
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ static int s5c73m3_i2c_read(struct i2c_client *client, u16 addr, u16 *data)
|
|||
*/
|
||||
ret = i2c_transfer(client->adapter, msg, 2);
|
||||
if (ret == 2) {
|
||||
*data = be16_to_cpup((u16 *)rbuf);
|
||||
*data = be16_to_cpup((__be16 *)rbuf);
|
||||
v4l2_dbg(4, s5c73m3_dbg, client,
|
||||
"%s: addr: 0x%04x, data: 0x%04x\n",
|
||||
__func__, addr, *data);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ static const struct of_device_id s5c73m3_spi_ids[] = {
|
|||
{ .compatible = "samsung,s5c73m3" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, s5c73m3_spi_ids);
|
||||
|
||||
enum spi_direction {
|
||||
SPI_DIR_RX,
|
||||
|
|
|
|||
|
|
@ -3131,6 +3131,7 @@ static const struct of_device_id smiapp_of_table[] = {
|
|||
{ .compatible = "nokia,smia" },
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, smiapp_of_table);
|
||||
|
||||
static const struct i2c_device_id smiapp_id_table[] = {
|
||||
{ SMIAPP_NAME, 0 },
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include <linux/videodev2.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/module.h>
|
||||
#include <media/v4l2-async.h>
|
||||
#include <media/v4l2-device.h>
|
||||
#include <media/tvp5150.h>
|
||||
#include <media/v4l2-ctrls.h>
|
||||
|
|
@ -1172,8 +1173,7 @@ static int tvp5150_probe(struct i2c_client *c,
|
|||
sd->ctrl_handler = &core->hdl;
|
||||
if (core->hdl.error) {
|
||||
res = core->hdl.error;
|
||||
v4l2_ctrl_handler_free(&core->hdl);
|
||||
return res;
|
||||
goto err;
|
||||
}
|
||||
v4l2_ctrl_handler_setup(&core->hdl);
|
||||
|
||||
|
|
@ -1186,9 +1186,17 @@ static int tvp5150_probe(struct i2c_client *c,
|
|||
core->rect.left = 0;
|
||||
core->rect.width = TVP5150_H_MAX;
|
||||
|
||||
res = v4l2_async_register_subdev(sd);
|
||||
if (res < 0)
|
||||
goto err;
|
||||
|
||||
if (debug > 1)
|
||||
tvp5150_log_status(sd);
|
||||
return 0;
|
||||
|
||||
err:
|
||||
v4l2_ctrl_handler_free(&core->hdl);
|
||||
return res;
|
||||
}
|
||||
|
||||
static int tvp5150_remove(struct i2c_client *c)
|
||||
|
|
@ -1200,7 +1208,7 @@ static int tvp5150_remove(struct i2c_client *c)
|
|||
"tvp5150.c: removing tvp5150 adapter on address 0x%x\n",
|
||||
c->addr << 1);
|
||||
|
||||
v4l2_device_unregister_subdev(sd);
|
||||
v4l2_async_unregister_subdev(sd);
|
||||
v4l2_ctrl_handler_free(&decoder->hdl);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,8 +235,8 @@ __must_check int media_entity_pipeline_start(struct media_entity *entity,
|
|||
media_entity_graph_walk_start(&graph, entity);
|
||||
|
||||
while ((entity = media_entity_graph_walk_next(&graph))) {
|
||||
DECLARE_BITMAP(active, entity->num_pads);
|
||||
DECLARE_BITMAP(has_no_links, entity->num_pads);
|
||||
DECLARE_BITMAP(active, MEDIA_ENTITY_MAX_PADS);
|
||||
DECLARE_BITMAP(has_no_links, MEDIA_ENTITY_MAX_PADS);
|
||||
unsigned int i;
|
||||
|
||||
entity->stream_count++;
|
||||
|
|
|
|||
|
|
@ -3625,13 +3625,10 @@ static void
|
|||
bttv_irq_wakeup_vbi(struct bttv *btv, struct bttv_buffer *wakeup,
|
||||
unsigned int state)
|
||||
{
|
||||
struct timeval ts;
|
||||
|
||||
if (NULL == wakeup)
|
||||
return;
|
||||
|
||||
v4l2_get_timestamp(&ts);
|
||||
wakeup->vb.ts = ts;
|
||||
v4l2_get_timestamp(&wakeup->vb.ts);
|
||||
wakeup->vb.field_count = btv->field_count;
|
||||
wakeup->vb.state = state;
|
||||
wake_up(&wakeup->vb.done);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
config VIDEO_COBALT
|
||||
tristate "Cisco Cobalt support"
|
||||
depends on VIDEO_V4L2 && I2C && MEDIA_CONTROLLER
|
||||
depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
|
||||
depends on PCI_MSI && MTD_COMPLEX_MAPPINGS
|
||||
depends on GPIOLIB || COMPILE_TEST
|
||||
depends on SND
|
||||
|
|
|
|||
|
|
@ -290,8 +290,8 @@ bool cobalt_cpld_set_freq(struct cobalt *cobalt, unsigned f_out)
|
|||
0x01, 0xc7, 0xfc, 0x7f, 0x53, 0x62).
|
||||
*/
|
||||
|
||||
cobalt_dbg(1, "%u: %02x %02x %02x %02x %02x %02x\n", f_out,
|
||||
regs[0], regs[1], regs[2], regs[3], regs[4], regs[5]);
|
||||
cobalt_dbg(1, "%u: %6ph\n", f_out, regs);
|
||||
|
||||
while (retries--) {
|
||||
u8 read_regs[6];
|
||||
|
||||
|
|
@ -330,9 +330,7 @@ bool cobalt_cpld_set_freq(struct cobalt *cobalt, unsigned f_out)
|
|||
|
||||
if (!memcmp(read_regs, regs, sizeof(read_regs)))
|
||||
break;
|
||||
cobalt_dbg(1, "retry: %02x %02x %02x %02x %02x %02x\n",
|
||||
read_regs[0], read_regs[1], read_regs[2],
|
||||
read_regs[3], read_regs[4], read_regs[5]);
|
||||
cobalt_dbg(1, "retry: %6ph\n", read_regs);
|
||||
}
|
||||
if (2 - retries)
|
||||
cobalt_info("Needed %d retries\n", 2 - retries);
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include <media/v4l2-ioctl.h>
|
||||
#include <media/v4l2-device.h>
|
||||
#include <media/v4l2-fh.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
#include <media/videobuf2-dma-sg.h>
|
||||
|
||||
#include "m00233_video_measure_memmap_package.h"
|
||||
|
|
@ -206,11 +207,12 @@ struct sg_dma_desc_info {
|
|||
#define COBALT_STREAM_FL_ADV_IRQ 1
|
||||
|
||||
struct cobalt_buffer {
|
||||
struct vb2_buffer vb;
|
||||
struct vb2_v4l2_buffer vb;
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
static inline struct cobalt_buffer *to_cobalt_buffer(struct vb2_buffer *vb2)
|
||||
static inline
|
||||
struct cobalt_buffer *to_cobalt_buffer(struct vb2_v4l2_buffer *vb2)
|
||||
{
|
||||
return container_of(vb2, struct cobalt_buffer, vb);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,11 +134,12 @@ done:
|
|||
skip = true;
|
||||
s->skip_first_frames--;
|
||||
}
|
||||
v4l2_get_timestamp(&cb->vb.v4l2_buf.timestamp);
|
||||
v4l2_get_timestamp(&cb->vb.timestamp);
|
||||
/* TODO: the sequence number should be read from the FPGA so we
|
||||
also know about dropped frames. */
|
||||
cb->vb.v4l2_buf.sequence = s->sequence++;
|
||||
vb2_buffer_done(&cb->vb, (skip || s->unstable_frame) ?
|
||||
cb->vb.sequence = s->sequence++;
|
||||
vb2_buffer_done(&cb->vb.vb2_buf,
|
||||
(skip || s->unstable_frame) ?
|
||||
VB2_BUF_STATE_REQUEUEING : VB2_BUF_STATE_DONE);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,11 +43,11 @@ static const struct v4l2_dv_timings cea1080p60 = V4L2_DV_BT_CEA_1920X1080P60;
|
|||
|
||||
/* vb2 DMA streaming ops */
|
||||
|
||||
static int cobalt_queue_setup(struct vb2_queue *q,
|
||||
const struct v4l2_format *fmt,
|
||||
static int cobalt_queue_setup(struct vb2_queue *q, const void *parg,
|
||||
unsigned int *num_buffers, unsigned int *num_planes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
const struct v4l2_format *fmt = parg;
|
||||
struct cobalt_stream *s = q->drv_priv;
|
||||
unsigned size = s->stride * s->height;
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ static int cobalt_buf_init(struct vb2_buffer *vb)
|
|||
const size_t bytes =
|
||||
COBALT_MAX_HEIGHT * max_pages_per_line * 0x20;
|
||||
const size_t audio_bytes = ((1920 * 4) / PAGE_SIZE + 1) * 0x20;
|
||||
struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->v4l2_buf.index];
|
||||
struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->index];
|
||||
struct sg_table *sg_desc = vb2_dma_sg_plane_desc(vb, 0);
|
||||
unsigned size;
|
||||
int ret;
|
||||
|
|
@ -105,17 +105,18 @@ static int cobalt_buf_init(struct vb2_buffer *vb)
|
|||
static void cobalt_buf_cleanup(struct vb2_buffer *vb)
|
||||
{
|
||||
struct cobalt_stream *s = vb->vb2_queue->drv_priv;
|
||||
struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->v4l2_buf.index];
|
||||
struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->index];
|
||||
|
||||
descriptor_list_free(desc);
|
||||
}
|
||||
|
||||
static int cobalt_buf_prepare(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cobalt_stream *s = vb->vb2_queue->drv_priv;
|
||||
|
||||
vb2_set_plane_payload(vb, 0, s->stride * s->height);
|
||||
vb->v4l2_buf.field = V4L2_FIELD_NONE;
|
||||
vbuf->field = V4L2_FIELD_NONE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -128,7 +129,7 @@ static void chain_all_buffers(struct cobalt_stream *s)
|
|||
|
||||
list_for_each(p, &s->bufs) {
|
||||
cb = list_entry(p, struct cobalt_buffer, list);
|
||||
desc[i] = &s->dma_desc_info[cb->vb.v4l2_buf.index];
|
||||
desc[i] = &s->dma_desc_info[cb->vb.vb2_buf.index];
|
||||
if (i > 0)
|
||||
descriptor_list_chain(desc[i-1], desc[i]);
|
||||
i++;
|
||||
|
|
@ -137,10 +138,11 @@ static void chain_all_buffers(struct cobalt_stream *s)
|
|||
|
||||
static void cobalt_buf_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct vb2_queue *q = vb->vb2_queue;
|
||||
struct cobalt_stream *s = q->drv_priv;
|
||||
struct cobalt_buffer *cb = to_cobalt_buffer(vb);
|
||||
struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->v4l2_buf.index];
|
||||
struct cobalt_buffer *cb = to_cobalt_buffer(vbuf);
|
||||
struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->index];
|
||||
unsigned long flags;
|
||||
|
||||
/* Prepare new buffer */
|
||||
|
|
@ -284,7 +286,7 @@ static void cobalt_dma_start_streaming(struct cobalt_stream *s)
|
|||
&vo->control);
|
||||
}
|
||||
cb = list_first_entry(&s->bufs, struct cobalt_buffer, list);
|
||||
omni_sg_dma_start(s, &s->dma_desc_info[cb->vb.v4l2_buf.index]);
|
||||
omni_sg_dma_start(s, &s->dma_desc_info[cb->vb.vb2_buf.index]);
|
||||
spin_unlock_irqrestore(&s->irqlock, flags);
|
||||
}
|
||||
|
||||
|
|
@ -381,7 +383,7 @@ static void cobalt_dma_stop_streaming(struct cobalt_stream *s)
|
|||
spin_lock_irqsave(&s->irqlock, flags);
|
||||
list_for_each(p, &s->bufs) {
|
||||
cb = list_entry(p, struct cobalt_buffer, list);
|
||||
desc = &s->dma_desc_info[cb->vb.v4l2_buf.index];
|
||||
desc = &s->dma_desc_info[cb->vb.vb2_buf.index];
|
||||
/* Stop DMA after this descriptor chain */
|
||||
descriptor_list_end_of_chain(desc);
|
||||
}
|
||||
|
|
@ -416,7 +418,7 @@ static void cobalt_stop_streaming(struct vb2_queue *q)
|
|||
list_for_each_safe(p, safe, &s->bufs) {
|
||||
cb = list_entry(p, struct cobalt_buffer, list);
|
||||
list_del(&cb->list);
|
||||
vb2_buffer_done(&cb->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&cb->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
spin_unlock_irqrestore(&s->irqlock, flags);
|
||||
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ static void cx18_mdl_send_to_videobuf(struct cx18_stream *s,
|
|||
}
|
||||
|
||||
if (dispatch) {
|
||||
vb_buf->vb.ts = ktime_to_timeval(ktime_get());
|
||||
v4l2_get_timestamp(&vb_buf->vb.ts);
|
||||
list_del(&vb_buf->vb.queue);
|
||||
vb_buf->vb.state = VIDEOBUF_DONE;
|
||||
wake_up(&vb_buf->vb.done);
|
||||
|
|
|
|||
|
|
@ -1138,7 +1138,7 @@ static int cx23885_initialize_codec(struct cx23885_dev *dev, int startencoder)
|
|||
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
||||
static int queue_setup(struct vb2_queue *q, const void *parg,
|
||||
unsigned int *num_buffers, unsigned int *num_planes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
|
|
@ -1155,17 +1155,19 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
|||
|
||||
static int buffer_prepare(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx23885_dev *dev = vb->vb2_queue->drv_priv;
|
||||
struct cx23885_buffer *buf =
|
||||
container_of(vb, struct cx23885_buffer, vb);
|
||||
container_of(vbuf, struct cx23885_buffer, vb);
|
||||
|
||||
return cx23885_buf_prepare(buf, &dev->ts1);
|
||||
}
|
||||
|
||||
static void buffer_finish(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx23885_dev *dev = vb->vb2_queue->drv_priv;
|
||||
struct cx23885_buffer *buf = container_of(vb,
|
||||
struct cx23885_buffer *buf = container_of(vbuf,
|
||||
struct cx23885_buffer, vb);
|
||||
|
||||
cx23885_free_buffer(dev, buf);
|
||||
|
|
@ -1173,8 +1175,9 @@ static void buffer_finish(struct vb2_buffer *vb)
|
|||
|
||||
static void buffer_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx23885_dev *dev = vb->vb2_queue->drv_priv;
|
||||
struct cx23885_buffer *buf = container_of(vb,
|
||||
struct cx23885_buffer *buf = container_of(vbuf,
|
||||
struct cx23885_buffer, vb);
|
||||
|
||||
cx23885_buf_queue(&dev->ts1, buf);
|
||||
|
|
@ -1201,7 +1204,7 @@ static int cx23885_start_streaming(struct vb2_queue *q, unsigned int count)
|
|||
struct cx23885_buffer, queue);
|
||||
|
||||
list_del(&buf->queue);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED);
|
||||
}
|
||||
spin_unlock_irqrestore(&dev->slock, flags);
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -427,12 +427,13 @@ static void cx23885_wakeup(struct cx23885_tsport *port,
|
|||
buf = list_entry(q->active.next,
|
||||
struct cx23885_buffer, queue);
|
||||
|
||||
v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
|
||||
buf->vb.v4l2_buf.sequence = q->count++;
|
||||
dprintk(1, "[%p/%d] wakeup reg=%d buf=%d\n", buf, buf->vb.v4l2_buf.index,
|
||||
v4l2_get_timestamp(&buf->vb.timestamp);
|
||||
buf->vb.sequence = q->count++;
|
||||
dprintk(1, "[%p/%d] wakeup reg=%d buf=%d\n", buf,
|
||||
buf->vb.vb2_buf.index,
|
||||
count, q->count);
|
||||
list_del(&buf->queue);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
||||
}
|
||||
|
||||
int cx23885_sram_channel_setup(struct cx23885_dev *dev,
|
||||
|
|
@ -1453,12 +1454,12 @@ int cx23885_buf_prepare(struct cx23885_buffer *buf, struct cx23885_tsport *port)
|
|||
{
|
||||
struct cx23885_dev *dev = port->dev;
|
||||
int size = port->ts_packet_size * port->ts_packet_count;
|
||||
struct sg_table *sgt = vb2_dma_sg_plane_desc(&buf->vb, 0);
|
||||
struct sg_table *sgt = vb2_dma_sg_plane_desc(&buf->vb.vb2_buf, 0);
|
||||
|
||||
dprintk(1, "%s: %p\n", __func__, buf);
|
||||
if (vb2_plane_size(&buf->vb, 0) < size)
|
||||
if (vb2_plane_size(&buf->vb.vb2_buf, 0) < size)
|
||||
return -EINVAL;
|
||||
vb2_set_plane_payload(&buf->vb, 0, size);
|
||||
vb2_set_plane_payload(&buf->vb.vb2_buf, 0, size);
|
||||
|
||||
cx23885_risc_databuffer(dev->pci, &buf->risc,
|
||||
sgt->sgl,
|
||||
|
|
@ -1503,7 +1504,7 @@ void cx23885_buf_queue(struct cx23885_tsport *port, struct cx23885_buffer *buf)
|
|||
if (list_empty(&cx88q->active)) {
|
||||
list_add_tail(&buf->queue, &cx88q->active);
|
||||
dprintk(1, "[%p/%d] %s - first active\n",
|
||||
buf, buf->vb.v4l2_buf.index, __func__);
|
||||
buf, buf->vb.vb2_buf.index, __func__);
|
||||
} else {
|
||||
buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
|
||||
prev = list_entry(cx88q->active.prev, struct cx23885_buffer,
|
||||
|
|
@ -1511,7 +1512,7 @@ void cx23885_buf_queue(struct cx23885_tsport *port, struct cx23885_buffer *buf)
|
|||
list_add_tail(&buf->queue, &cx88q->active);
|
||||
prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
|
||||
dprintk(1, "[%p/%d] %s - append to active\n",
|
||||
buf, buf->vb.v4l2_buf.index, __func__);
|
||||
buf, buf->vb.vb2_buf.index, __func__);
|
||||
}
|
||||
spin_unlock_irqrestore(&dev->slock, flags);
|
||||
}
|
||||
|
|
@ -1530,9 +1531,10 @@ static void do_cancel_buffers(struct cx23885_tsport *port, char *reason)
|
|||
buf = list_entry(q->active.next, struct cx23885_buffer,
|
||||
queue);
|
||||
list_del(&buf->queue);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
dprintk(1, "[%p/%d] %s - dma=0x%08lx\n",
|
||||
buf, buf->vb.v4l2_buf.index, reason, (unsigned long)buf->risc.dma);
|
||||
buf, buf->vb.vb2_buf.index, reason,
|
||||
(unsigned long)buf->risc.dma);
|
||||
}
|
||||
spin_unlock_irqrestore(&port->slock, flags);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
|||
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
||||
static int queue_setup(struct vb2_queue *q, const void *parg,
|
||||
unsigned int *num_buffers, unsigned int *num_planes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
|
|
@ -110,18 +110,20 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
|||
|
||||
static int buffer_prepare(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx23885_tsport *port = vb->vb2_queue->drv_priv;
|
||||
struct cx23885_buffer *buf =
|
||||
container_of(vb, struct cx23885_buffer, vb);
|
||||
container_of(vbuf, struct cx23885_buffer, vb);
|
||||
|
||||
return cx23885_buf_prepare(buf, port);
|
||||
}
|
||||
|
||||
static void buffer_finish(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx23885_tsport *port = vb->vb2_queue->drv_priv;
|
||||
struct cx23885_dev *dev = port->dev;
|
||||
struct cx23885_buffer *buf = container_of(vb,
|
||||
struct cx23885_buffer *buf = container_of(vbuf,
|
||||
struct cx23885_buffer, vb);
|
||||
|
||||
cx23885_free_buffer(dev, buf);
|
||||
|
|
@ -129,8 +131,9 @@ static void buffer_finish(struct vb2_buffer *vb)
|
|||
|
||||
static void buffer_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx23885_tsport *port = vb->vb2_queue->drv_priv;
|
||||
struct cx23885_buffer *buf = container_of(vb,
|
||||
struct cx23885_buffer *buf = container_of(vbuf,
|
||||
struct cx23885_buffer, vb);
|
||||
|
||||
cx23885_buf_queue(port, buf);
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ static int cx23885_start_vbi_dma(struct cx23885_dev *dev,
|
|||
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
||||
static int queue_setup(struct vb2_queue *q, const void *parg,
|
||||
unsigned int *num_buffers, unsigned int *num_planes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
|
|
@ -138,8 +138,9 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
|||
|
||||
static int buffer_prepare(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx23885_dev *dev = vb->vb2_queue->drv_priv;
|
||||
struct cx23885_buffer *buf = container_of(vb,
|
||||
struct cx23885_buffer *buf = container_of(vbuf,
|
||||
struct cx23885_buffer, vb);
|
||||
struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
|
||||
unsigned lines = VBI_PAL_LINE_COUNT;
|
||||
|
|
@ -161,7 +162,8 @@ static int buffer_prepare(struct vb2_buffer *vb)
|
|||
|
||||
static void buffer_finish(struct vb2_buffer *vb)
|
||||
{
|
||||
struct cx23885_buffer *buf = container_of(vb,
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx23885_buffer *buf = container_of(vbuf,
|
||||
struct cx23885_buffer, vb);
|
||||
|
||||
cx23885_free_buffer(vb->vb2_queue->drv_priv, buf);
|
||||
|
|
@ -190,8 +192,10 @@ static void buffer_finish(struct vb2_buffer *vb)
|
|||
*/
|
||||
static void buffer_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx23885_dev *dev = vb->vb2_queue->drv_priv;
|
||||
struct cx23885_buffer *buf = container_of(vb, struct cx23885_buffer, vb);
|
||||
struct cx23885_buffer *buf = container_of(vbuf,
|
||||
struct cx23885_buffer, vb);
|
||||
struct cx23885_buffer *prev;
|
||||
struct cx23885_dmaqueue *q = &dev->vbiq;
|
||||
unsigned long flags;
|
||||
|
|
@ -206,7 +210,7 @@ static void buffer_queue(struct vb2_buffer *vb)
|
|||
list_add_tail(&buf->queue, &q->active);
|
||||
spin_unlock_irqrestore(&dev->slock, flags);
|
||||
dprintk(2, "[%p/%d] vbi_queue - first active\n",
|
||||
buf, buf->vb.v4l2_buf.index);
|
||||
buf, buf->vb.vb2_buf.index);
|
||||
|
||||
} else {
|
||||
buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
|
||||
|
|
@ -217,7 +221,7 @@ static void buffer_queue(struct vb2_buffer *vb)
|
|||
spin_unlock_irqrestore(&dev->slock, flags);
|
||||
prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
|
||||
dprintk(2, "[%p/%d] buffer_queue - append to active\n",
|
||||
buf, buf->vb.v4l2_buf.index);
|
||||
buf, buf->vb.vb2_buf.index);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -245,7 +249,7 @@ static void cx23885_stop_streaming(struct vb2_queue *q)
|
|||
struct cx23885_buffer, queue);
|
||||
|
||||
list_del(&buf->queue);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
spin_unlock_irqrestore(&dev->slock, flags);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,12 +104,12 @@ void cx23885_video_wakeup(struct cx23885_dev *dev,
|
|||
buf = list_entry(q->active.next,
|
||||
struct cx23885_buffer, queue);
|
||||
|
||||
buf->vb.v4l2_buf.sequence = q->count++;
|
||||
v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
|
||||
dprintk(2, "[%p/%d] wakeup reg=%d buf=%d\n", buf, buf->vb.v4l2_buf.index,
|
||||
count, q->count);
|
||||
buf->vb.sequence = q->count++;
|
||||
v4l2_get_timestamp(&buf->vb.timestamp);
|
||||
dprintk(2, "[%p/%d] wakeup reg=%d buf=%d\n", buf,
|
||||
buf->vb.vb2_buf.index, count, q->count);
|
||||
list_del(&buf->queue);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
||||
}
|
||||
|
||||
int cx23885_set_tvnorm(struct cx23885_dev *dev, v4l2_std_id norm)
|
||||
|
|
@ -315,7 +315,7 @@ static int cx23885_start_video_dma(struct cx23885_dev *dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
||||
static int queue_setup(struct vb2_queue *q, const void *parg,
|
||||
unsigned int *num_buffers, unsigned int *num_planes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
|
|
@ -329,9 +329,10 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
|||
|
||||
static int buffer_prepare(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx23885_dev *dev = vb->vb2_queue->drv_priv;
|
||||
struct cx23885_buffer *buf =
|
||||
container_of(vb, struct cx23885_buffer, vb);
|
||||
container_of(vbuf, struct cx23885_buffer, vb);
|
||||
u32 line0_offset, line1_offset;
|
||||
struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
|
||||
int field_tff;
|
||||
|
|
@ -401,7 +402,7 @@ static int buffer_prepare(struct vb2_buffer *vb)
|
|||
BUG();
|
||||
}
|
||||
dprintk(2, "[%p/%d] buffer_init - %dx%d %dbpp \"%s\" - dma=0x%08lx\n",
|
||||
buf, buf->vb.v4l2_buf.index,
|
||||
buf, buf->vb.vb2_buf.index,
|
||||
dev->width, dev->height, dev->fmt->depth, dev->fmt->name,
|
||||
(unsigned long)buf->risc.dma);
|
||||
return 0;
|
||||
|
|
@ -409,7 +410,8 @@ static int buffer_prepare(struct vb2_buffer *vb)
|
|||
|
||||
static void buffer_finish(struct vb2_buffer *vb)
|
||||
{
|
||||
struct cx23885_buffer *buf = container_of(vb,
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx23885_buffer *buf = container_of(vbuf,
|
||||
struct cx23885_buffer, vb);
|
||||
|
||||
cx23885_free_buffer(vb->vb2_queue->drv_priv, buf);
|
||||
|
|
@ -438,8 +440,9 @@ static void buffer_finish(struct vb2_buffer *vb)
|
|||
*/
|
||||
static void buffer_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx23885_dev *dev = vb->vb2_queue->drv_priv;
|
||||
struct cx23885_buffer *buf = container_of(vb,
|
||||
struct cx23885_buffer *buf = container_of(vbuf,
|
||||
struct cx23885_buffer, vb);
|
||||
struct cx23885_buffer *prev;
|
||||
struct cx23885_dmaqueue *q = &dev->vidq;
|
||||
|
|
@ -455,7 +458,7 @@ static void buffer_queue(struct vb2_buffer *vb)
|
|||
if (list_empty(&q->active)) {
|
||||
list_add_tail(&buf->queue, &q->active);
|
||||
dprintk(2, "[%p/%d] buffer_queue - first active\n",
|
||||
buf, buf->vb.v4l2_buf.index);
|
||||
buf, buf->vb.vb2_buf.index);
|
||||
} else {
|
||||
buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
|
||||
prev = list_entry(q->active.prev, struct cx23885_buffer,
|
||||
|
|
@ -463,7 +466,7 @@ static void buffer_queue(struct vb2_buffer *vb)
|
|||
list_add_tail(&buf->queue, &q->active);
|
||||
prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
|
||||
dprintk(2, "[%p/%d] buffer_queue - append to active\n",
|
||||
buf, buf->vb.v4l2_buf.index);
|
||||
buf, buf->vb.vb2_buf.index);
|
||||
}
|
||||
spin_unlock_irqrestore(&dev->slock, flags);
|
||||
}
|
||||
|
|
@ -492,7 +495,7 @@ static void cx23885_stop_streaming(struct vb2_queue *q)
|
|||
struct cx23885_buffer, queue);
|
||||
|
||||
list_del(&buf->queue);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
spin_unlock_irqrestore(&dev->slock, flags);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ struct cx23885_riscmem {
|
|||
/* buffer for one video frame */
|
||||
struct cx23885_buffer {
|
||||
/* common v4l buffer stuff -- must be first */
|
||||
struct vb2_buffer vb;
|
||||
struct vb2_v4l2_buffer vb;
|
||||
struct list_head queue;
|
||||
|
||||
/* cx23885 specific */
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ struct cx25821_audio_dev {
|
|||
|
||||
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
|
||||
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
|
||||
static bool enable[SNDRV_CARDS] = { 1, [1 ... (SNDRV_CARDS - 1)] = 1 };
|
||||
static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
|
||||
|
||||
module_param_array(enable, bool, NULL, 0444);
|
||||
MODULE_PARM_DESC(enable, "Enable cx25821 soundcard. default enabled.");
|
||||
|
|
|
|||
|
|
@ -130,10 +130,10 @@ int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status)
|
|||
buf = list_entry(dmaq->active.next,
|
||||
struct cx25821_buffer, queue);
|
||||
|
||||
v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
|
||||
buf->vb.v4l2_buf.sequence = dmaq->count++;
|
||||
v4l2_get_timestamp(&buf->vb.timestamp);
|
||||
buf->vb.sequence = dmaq->count++;
|
||||
list_del(&buf->queue);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
||||
}
|
||||
spin_unlock(&dev->slock);
|
||||
handled++;
|
||||
|
|
@ -141,10 +141,11 @@ int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status)
|
|||
return handled;
|
||||
}
|
||||
|
||||
static int cx25821_queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
||||
static int cx25821_queue_setup(struct vb2_queue *q, const void *parg,
|
||||
unsigned int *num_buffers, unsigned int *num_planes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
const struct v4l2_format *fmt = parg;
|
||||
struct cx25821_channel *chan = q->drv_priv;
|
||||
unsigned size = (chan->fmt->depth * chan->width * chan->height) >> 3;
|
||||
|
||||
|
|
@ -159,10 +160,11 @@ static int cx25821_queue_setup(struct vb2_queue *q, const struct v4l2_format *fm
|
|||
|
||||
static int cx25821_buffer_prepare(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx25821_channel *chan = vb->vb2_queue->drv_priv;
|
||||
struct cx25821_dev *dev = chan->dev;
|
||||
struct cx25821_buffer *buf =
|
||||
container_of(vb, struct cx25821_buffer, vb);
|
||||
container_of(vbuf, struct cx25821_buffer, vb);
|
||||
struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
|
||||
u32 line0_offset;
|
||||
int bpl_local = LINE_SIZE_D1;
|
||||
|
|
@ -176,7 +178,7 @@ static int cx25821_buffer_prepare(struct vb2_buffer *vb)
|
|||
if (vb2_plane_size(vb, 0) < chan->height * buf->bpl)
|
||||
return -EINVAL;
|
||||
vb2_set_plane_payload(vb, 0, chan->height * buf->bpl);
|
||||
buf->vb.v4l2_buf.field = chan->field;
|
||||
buf->vb.field = chan->field;
|
||||
|
||||
if (chan->pixel_formats == PIXEL_FRMT_411) {
|
||||
bpl_local = buf->bpl;
|
||||
|
|
@ -231,7 +233,7 @@ static int cx25821_buffer_prepare(struct vb2_buffer *vb)
|
|||
}
|
||||
|
||||
dprintk(2, "[%p/%d] buffer_prep - %dx%d %dbpp \"%s\" - dma=0x%08lx\n",
|
||||
buf, buf->vb.v4l2_buf.index, chan->width, chan->height,
|
||||
buf, buf->vb.vb2_buf.index, chan->width, chan->height,
|
||||
chan->fmt->depth, chan->fmt->name,
|
||||
(unsigned long)buf->risc.dma);
|
||||
|
||||
|
|
@ -240,8 +242,9 @@ static int cx25821_buffer_prepare(struct vb2_buffer *vb)
|
|||
|
||||
static void cx25821_buffer_finish(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx25821_buffer *buf =
|
||||
container_of(vb, struct cx25821_buffer, vb);
|
||||
container_of(vbuf, struct cx25821_buffer, vb);
|
||||
struct cx25821_channel *chan = vb->vb2_queue->drv_priv;
|
||||
struct cx25821_dev *dev = chan->dev;
|
||||
|
||||
|
|
@ -250,8 +253,9 @@ static void cx25821_buffer_finish(struct vb2_buffer *vb)
|
|||
|
||||
static void cx25821_buffer_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx25821_buffer *buf =
|
||||
container_of(vb, struct cx25821_buffer, vb);
|
||||
container_of(vbuf, struct cx25821_buffer, vb);
|
||||
struct cx25821_channel *chan = vb->vb2_queue->drv_priv;
|
||||
struct cx25821_dev *dev = chan->dev;
|
||||
struct cx25821_buffer *prev;
|
||||
|
|
@ -300,7 +304,7 @@ static void cx25821_stop_streaming(struct vb2_queue *q)
|
|||
struct cx25821_buffer, queue);
|
||||
|
||||
list_del(&buf->queue);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
spin_unlock_irqrestore(&dev->slock, flags);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-device.h>
|
||||
#include <media/v4l2-ctrls.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
#include <media/videobuf2-dma-sg.h>
|
||||
|
||||
#include "cx25821-reg.h"
|
||||
|
|
@ -127,7 +128,7 @@ struct cx25821_riscmem {
|
|||
/* buffer for one video frame */
|
||||
struct cx25821_buffer {
|
||||
/* common v4l buffer stuff -- must be first */
|
||||
struct vb2_buffer vb;
|
||||
struct vb2_v4l2_buffer vb;
|
||||
struct list_head queue;
|
||||
|
||||
/* cx25821 specific */
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ typedef struct cx88_audio_dev snd_cx88_card_t;
|
|||
|
||||
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
|
||||
static const char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
|
||||
static bool enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 1};
|
||||
static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
|
||||
|
||||
module_param_array(enable, bool, NULL, 0444);
|
||||
MODULE_PARM_DESC(enable, "Enable cx88x soundcard. default enabled.");
|
||||
|
|
|
|||
|
|
@ -637,7 +637,7 @@ static int blackbird_stop_codec(struct cx8802_dev *dev)
|
|||
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
||||
static int queue_setup(struct vb2_queue *q, const void *parg,
|
||||
unsigned int *num_buffers, unsigned int *num_planes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
|
|
@ -653,16 +653,18 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
|||
|
||||
static int buffer_prepare(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
|
||||
struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
|
||||
struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
|
||||
|
||||
return cx8802_buf_prepare(vb->vb2_queue, dev, buf);
|
||||
}
|
||||
|
||||
static void buffer_finish(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
|
||||
struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
|
||||
struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
|
||||
struct cx88_riscmem *risc = &buf->risc;
|
||||
|
||||
if (risc->cpu)
|
||||
|
|
@ -672,8 +674,9 @@ static void buffer_finish(struct vb2_buffer *vb)
|
|||
|
||||
static void buffer_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
|
||||
struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
|
||||
struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
|
||||
|
||||
cx8802_buf_queue(dev, buf);
|
||||
}
|
||||
|
|
@ -721,7 +724,7 @@ fail:
|
|||
struct cx88_buffer, list);
|
||||
|
||||
list_del(&buf->list);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED);
|
||||
}
|
||||
spin_unlock_irqrestore(&dev->slock, flags);
|
||||
return err;
|
||||
|
|
@ -749,7 +752,7 @@ static void stop_streaming(struct vb2_queue *q)
|
|||
struct cx88_buffer, list);
|
||||
|
||||
list_del(&buf->list);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
spin_unlock_irqrestore(&dev->slock, flags);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -518,11 +518,11 @@ void cx88_wakeup(struct cx88_core *core,
|
|||
|
||||
buf = list_entry(q->active.next,
|
||||
struct cx88_buffer, list);
|
||||
v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
|
||||
buf->vb.v4l2_buf.field = core->field;
|
||||
buf->vb.v4l2_buf.sequence = q->count++;
|
||||
v4l2_get_timestamp(&buf->vb.timestamp);
|
||||
buf->vb.field = core->field;
|
||||
buf->vb.sequence = q->count++;
|
||||
list_del(&buf->list);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
||||
}
|
||||
|
||||
void cx88_shutdown(struct cx88_core *core)
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
|||
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
||||
static int queue_setup(struct vb2_queue *q, const void *parg,
|
||||
unsigned int *num_buffers, unsigned int *num_planes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
|
|
@ -99,16 +99,18 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
|||
|
||||
static int buffer_prepare(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
|
||||
struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
|
||||
struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
|
||||
|
||||
return cx8802_buf_prepare(vb->vb2_queue, dev, buf);
|
||||
}
|
||||
|
||||
static void buffer_finish(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
|
||||
struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
|
||||
struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
|
||||
struct cx88_riscmem *risc = &buf->risc;
|
||||
|
||||
if (risc->cpu)
|
||||
|
|
@ -118,8 +120,9 @@ static void buffer_finish(struct vb2_buffer *vb)
|
|||
|
||||
static void buffer_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
|
||||
struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
|
||||
struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
|
||||
|
||||
cx8802_buf_queue(dev, buf);
|
||||
}
|
||||
|
|
@ -149,7 +152,7 @@ static void stop_streaming(struct vb2_queue *q)
|
|||
struct cx88_buffer, list);
|
||||
|
||||
list_del(&buf->list);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
spin_unlock_irqrestore(&dev->slock, flags);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ static int cx8802_restart_queue(struct cx8802_dev *dev,
|
|||
|
||||
buf = list_entry(q->active.next, struct cx88_buffer, list);
|
||||
dprintk(2,"restart_queue [%p/%d]: restart dma\n",
|
||||
buf, buf->vb.v4l2_buf.index);
|
||||
buf, buf->vb.vb2_buf.index);
|
||||
cx8802_start_dma(dev, q, buf);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -225,13 +225,13 @@ int cx8802_buf_prepare(struct vb2_queue *q, struct cx8802_dev *dev,
|
|||
struct cx88_buffer *buf)
|
||||
{
|
||||
int size = dev->ts_packet_size * dev->ts_packet_count;
|
||||
struct sg_table *sgt = vb2_dma_sg_plane_desc(&buf->vb, 0);
|
||||
struct sg_table *sgt = vb2_dma_sg_plane_desc(&buf->vb.vb2_buf, 0);
|
||||
struct cx88_riscmem *risc = &buf->risc;
|
||||
int rc;
|
||||
|
||||
if (vb2_plane_size(&buf->vb, 0) < size)
|
||||
if (vb2_plane_size(&buf->vb.vb2_buf, 0) < size)
|
||||
return -EINVAL;
|
||||
vb2_set_plane_payload(&buf->vb, 0, size);
|
||||
vb2_set_plane_payload(&buf->vb.vb2_buf, 0, size);
|
||||
|
||||
rc = cx88_risc_databuffer(dev->pci, risc, sgt->sgl,
|
||||
dev->ts_packet_size, dev->ts_packet_count, 0);
|
||||
|
|
@ -259,7 +259,7 @@ void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf)
|
|||
dprintk( 1, "queue is empty - first active\n" );
|
||||
list_add_tail(&buf->list, &cx88q->active);
|
||||
dprintk(1,"[%p/%d] %s - first active\n",
|
||||
buf, buf->vb.v4l2_buf.index, __func__);
|
||||
buf, buf->vb.vb2_buf.index, __func__);
|
||||
|
||||
} else {
|
||||
buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
|
||||
|
|
@ -268,7 +268,7 @@ void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf)
|
|||
list_add_tail(&buf->list, &cx88q->active);
|
||||
prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
|
||||
dprintk( 1, "[%p/%d] %s - append to active\n",
|
||||
buf, buf->vb.v4l2_buf.index, __func__);
|
||||
buf, buf->vb.vb2_buf.index, __func__);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -284,7 +284,7 @@ static void do_cancel_buffers(struct cx8802_dev *dev)
|
|||
while (!list_empty(&q->active)) {
|
||||
buf = list_entry(q->active.next, struct cx88_buffer, list);
|
||||
list_del(&buf->list);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
spin_unlock_irqrestore(&dev->slock,flags);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,14 +100,14 @@ int cx8800_restart_vbi_queue(struct cx8800_dev *dev,
|
|||
|
||||
buf = list_entry(q->active.next, struct cx88_buffer, list);
|
||||
dprintk(2,"restart_queue [%p/%d]: restart dma\n",
|
||||
buf, buf->vb.v4l2_buf.index);
|
||||
buf, buf->vb.vb2_buf.index);
|
||||
cx8800_start_vbi_dma(dev, q, buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
||||
static int queue_setup(struct vb2_queue *q, const void *parg,
|
||||
unsigned int *num_buffers, unsigned int *num_planes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
|
|
@ -125,8 +125,9 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
|||
|
||||
static int buffer_prepare(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
|
||||
struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
|
||||
struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
|
||||
struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
|
||||
unsigned int lines;
|
||||
unsigned int size;
|
||||
|
|
@ -149,8 +150,9 @@ static int buffer_prepare(struct vb2_buffer *vb)
|
|||
|
||||
static void buffer_finish(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
|
||||
struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
|
||||
struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
|
||||
struct cx88_riscmem *risc = &buf->risc;
|
||||
|
||||
if (risc->cpu)
|
||||
|
|
@ -160,8 +162,9 @@ static void buffer_finish(struct vb2_buffer *vb)
|
|||
|
||||
static void buffer_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
|
||||
struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
|
||||
struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
|
||||
struct cx88_buffer *prev;
|
||||
struct cx88_dmaqueue *q = &dev->vbiq;
|
||||
|
||||
|
|
@ -174,7 +177,7 @@ static void buffer_queue(struct vb2_buffer *vb)
|
|||
list_add_tail(&buf->list, &q->active);
|
||||
cx8800_start_vbi_dma(dev, q, buf);
|
||||
dprintk(2,"[%p/%d] vbi_queue - first active\n",
|
||||
buf, buf->vb.v4l2_buf.index);
|
||||
buf, buf->vb.vb2_buf.index);
|
||||
|
||||
} else {
|
||||
buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
|
||||
|
|
@ -182,7 +185,7 @@ static void buffer_queue(struct vb2_buffer *vb)
|
|||
list_add_tail(&buf->list, &q->active);
|
||||
prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
|
||||
dprintk(2,"[%p/%d] buffer_queue - append to active\n",
|
||||
buf, buf->vb.v4l2_buf.index);
|
||||
buf, buf->vb.vb2_buf.index);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -213,7 +216,7 @@ static void stop_streaming(struct vb2_queue *q)
|
|||
struct cx88_buffer, list);
|
||||
|
||||
list_del(&buf->list);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
spin_unlock_irqrestore(&dev->slock, flags);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ static int restart_video_queue(struct cx8800_dev *dev,
|
|||
if (!list_empty(&q->active)) {
|
||||
buf = list_entry(q->active.next, struct cx88_buffer, list);
|
||||
dprintk(2,"restart_queue [%p/%d]: restart dma\n",
|
||||
buf, buf->vb.v4l2_buf.index);
|
||||
buf, buf->vb.vb2_buf.index);
|
||||
start_video_dma(dev, q, buf);
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -429,7 +429,7 @@ static int restart_video_queue(struct cx8800_dev *dev,
|
|||
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
||||
static int queue_setup(struct vb2_queue *q, const void *parg,
|
||||
unsigned int *num_buffers, unsigned int *num_planes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
|
|
@ -444,9 +444,10 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
|||
|
||||
static int buffer_prepare(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
|
||||
struct cx88_core *core = dev->core;
|
||||
struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
|
||||
struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
|
||||
struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
|
||||
|
||||
buf->bpl = core->width * dev->fmt->depth >> 3;
|
||||
|
|
@ -489,7 +490,7 @@ static int buffer_prepare(struct vb2_buffer *vb)
|
|||
break;
|
||||
}
|
||||
dprintk(2,"[%p/%d] buffer_prepare - %dx%d %dbpp \"%s\" - dma=0x%08lx\n",
|
||||
buf, buf->vb.v4l2_buf.index,
|
||||
buf, buf->vb.vb2_buf.index,
|
||||
core->width, core->height, dev->fmt->depth, dev->fmt->name,
|
||||
(unsigned long)buf->risc.dma);
|
||||
return 0;
|
||||
|
|
@ -497,8 +498,9 @@ static int buffer_prepare(struct vb2_buffer *vb)
|
|||
|
||||
static void buffer_finish(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
|
||||
struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
|
||||
struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
|
||||
struct cx88_riscmem *risc = &buf->risc;
|
||||
|
||||
if (risc->cpu)
|
||||
|
|
@ -508,8 +510,9 @@ static void buffer_finish(struct vb2_buffer *vb)
|
|||
|
||||
static void buffer_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
|
||||
struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
|
||||
struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
|
||||
struct cx88_buffer *prev;
|
||||
struct cx88_core *core = dev->core;
|
||||
struct cx88_dmaqueue *q = &dev->vidq;
|
||||
|
|
@ -522,7 +525,7 @@ static void buffer_queue(struct vb2_buffer *vb)
|
|||
if (list_empty(&q->active)) {
|
||||
list_add_tail(&buf->list, &q->active);
|
||||
dprintk(2,"[%p/%d] buffer_queue - first active\n",
|
||||
buf, buf->vb.v4l2_buf.index);
|
||||
buf, buf->vb.vb2_buf.index);
|
||||
|
||||
} else {
|
||||
buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
|
||||
|
|
@ -530,7 +533,7 @@ static void buffer_queue(struct vb2_buffer *vb)
|
|||
list_add_tail(&buf->list, &q->active);
|
||||
prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
|
||||
dprintk(2, "[%p/%d] buffer_queue - append to active\n",
|
||||
buf, buf->vb.v4l2_buf.index);
|
||||
buf, buf->vb.vb2_buf.index);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -560,7 +563,7 @@ static void stop_streaming(struct vb2_queue *q)
|
|||
struct cx88_buffer, list);
|
||||
|
||||
list_del(&buf->list);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
spin_unlock_irqrestore(&dev->slock, flags);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@ struct cx88_riscmem {
|
|||
/* buffer for one video frame */
|
||||
struct cx88_buffer {
|
||||
/* common v4l buffer stuff -- must be first */
|
||||
struct vb2_buffer vb;
|
||||
struct vb2_v4l2_buffer vb;
|
||||
struct list_head list;
|
||||
|
||||
/* cx88 specific */
|
||||
|
|
|
|||
|
|
@ -131,11 +131,12 @@ static int wait_i2c_reg(void __iomem *addr)
|
|||
}
|
||||
|
||||
static int
|
||||
dt3155_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
|
||||
dt3155_queue_setup(struct vb2_queue *vq, const void *parg,
|
||||
unsigned int *nbuffers, unsigned int *num_planes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
|
||||
{
|
||||
const struct v4l2_format *fmt = parg;
|
||||
struct dt3155_priv *pd = vb2_get_drv_priv(vq);
|
||||
unsigned size = pd->width * pd->height;
|
||||
|
||||
|
|
@ -160,7 +161,7 @@ static int dt3155_buf_prepare(struct vb2_buffer *vb)
|
|||
static int dt3155_start_streaming(struct vb2_queue *q, unsigned count)
|
||||
{
|
||||
struct dt3155_priv *pd = vb2_get_drv_priv(q);
|
||||
struct vb2_buffer *vb = pd->curr_buf;
|
||||
struct vb2_buffer *vb = &pd->curr_buf->vb2_buf;
|
||||
dma_addr_t dma_addr;
|
||||
|
||||
pd->sequence = 0;
|
||||
|
|
@ -208,7 +209,7 @@ static void dt3155_stop_streaming(struct vb2_queue *q)
|
|||
|
||||
spin_lock_irq(&pd->lock);
|
||||
if (pd->curr_buf) {
|
||||
vb2_buffer_done(pd->curr_buf, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&pd->curr_buf->vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
pd->curr_buf = NULL;
|
||||
}
|
||||
|
||||
|
|
@ -222,6 +223,7 @@ static void dt3155_stop_streaming(struct vb2_queue *q)
|
|||
|
||||
static void dt3155_buf_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct dt3155_priv *pd = vb2_get_drv_priv(vb->vb2_queue);
|
||||
|
||||
/* pd->vidq.streaming = 1 when dt3155_buf_queue() is invoked */
|
||||
|
|
@ -229,7 +231,7 @@ static void dt3155_buf_queue(struct vb2_buffer *vb)
|
|||
if (pd->curr_buf)
|
||||
list_add_tail(&vb->done_entry, &pd->dmaq);
|
||||
else
|
||||
pd->curr_buf = vb;
|
||||
pd->curr_buf = vbuf;
|
||||
spin_unlock_irq(&pd->lock);
|
||||
}
|
||||
|
||||
|
|
@ -269,14 +271,14 @@ static irqreturn_t dt3155_irq_handler_even(int irq, void *dev_id)
|
|||
|
||||
spin_lock(&ipd->lock);
|
||||
if (ipd->curr_buf && !list_empty(&ipd->dmaq)) {
|
||||
v4l2_get_timestamp(&ipd->curr_buf->v4l2_buf.timestamp);
|
||||
ipd->curr_buf->v4l2_buf.sequence = ipd->sequence++;
|
||||
ipd->curr_buf->v4l2_buf.field = V4L2_FIELD_NONE;
|
||||
vb2_buffer_done(ipd->curr_buf, VB2_BUF_STATE_DONE);
|
||||
v4l2_get_timestamp(&ipd->curr_buf->timestamp);
|
||||
ipd->curr_buf->sequence = ipd->sequence++;
|
||||
ipd->curr_buf->field = V4L2_FIELD_NONE;
|
||||
vb2_buffer_done(&ipd->curr_buf->vb2_buf, VB2_BUF_STATE_DONE);
|
||||
|
||||
ivb = list_first_entry(&ipd->dmaq, typeof(*ivb), done_entry);
|
||||
list_del(&ivb->done_entry);
|
||||
ipd->curr_buf = ivb;
|
||||
ipd->curr_buf = to_vb2_v4l2_buffer(ivb);
|
||||
dma_addr = vb2_dma_contig_plane_dma_addr(ivb, 0);
|
||||
iowrite32(dma_addr, ipd->regs + EVEN_DMA_START);
|
||||
iowrite32(dma_addr + ipd->width, ipd->regs + ODD_DMA_START);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include <linux/interrupt.h>
|
||||
#include <media/v4l2-device.h>
|
||||
#include <media/v4l2-dev.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
|
||||
#define DT3155_NAME "dt3155"
|
||||
#define DT3155_VER_MAJ 2
|
||||
|
|
@ -181,7 +182,7 @@ struct dt3155_priv {
|
|||
struct pci_dev *pdev;
|
||||
struct vb2_queue vidq;
|
||||
struct vb2_alloc_ctx *alloc_ctx;
|
||||
struct vb2_buffer *curr_buf;
|
||||
struct vb2_v4l2_buffer *curr_buf;
|
||||
struct mutex mux;
|
||||
struct list_head dmaq;
|
||||
spinlock_t lock;
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
#include "ivtv-alsa-pcm.h"
|
||||
|
||||
int ivtv_alsa_debug;
|
||||
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
|
||||
|
||||
#define IVTV_DEBUG_ALSA_INFO(fmt, arg...) \
|
||||
do { \
|
||||
|
|
@ -54,6 +55,10 @@ MODULE_PARM_DESC(debug,
|
|||
"\t\t\t 1/0x0001: warning\n"
|
||||
"\t\t\t 2/0x0002: info\n");
|
||||
|
||||
module_param_array(index, int, NULL, 0444);
|
||||
MODULE_PARM_DESC(index,
|
||||
"Index value for IVTV ALSA capture interface(s).\n");
|
||||
|
||||
MODULE_AUTHOR("Andy Walls");
|
||||
MODULE_DESCRIPTION("CX23415/CX23416 ALSA Interface");
|
||||
MODULE_SUPPORTED_DEVICE("CX23415/CX23416 MPEG2 encoder");
|
||||
|
|
@ -137,7 +142,7 @@ static int snd_ivtv_init(struct v4l2_device *v4l2_dev)
|
|||
struct ivtv *itv = to_ivtv(v4l2_dev);
|
||||
struct snd_card *sc = NULL;
|
||||
struct snd_ivtv_card *itvsc;
|
||||
int ret;
|
||||
int ret, idx;
|
||||
|
||||
/* Numbrs steps from "Writing an ALSA Driver" by Takashi Iwai */
|
||||
|
||||
|
|
@ -145,8 +150,10 @@ static int snd_ivtv_init(struct v4l2_device *v4l2_dev)
|
|||
/* This is a no-op for us. We'll use the itv->instance */
|
||||
|
||||
/* (2) Create a card instance */
|
||||
/* use first available id if not specified otherwise*/
|
||||
idx = index[itv->instance] == -1 ? SNDRV_DEFAULT_IDX1 : index[itv->instance];
|
||||
ret = snd_card_new(&itv->pdev->dev,
|
||||
SNDRV_DEFAULT_IDX1, /* use first available id */
|
||||
idx,
|
||||
SNDRV_DEFAULT_STR1, /* xid from end of shortname*/
|
||||
THIS_MODULE, 0, &sc);
|
||||
if (ret) {
|
||||
|
|
@ -196,6 +203,9 @@ static int snd_ivtv_init(struct v4l2_device *v4l2_dev)
|
|||
goto err_exit_free;
|
||||
}
|
||||
|
||||
IVTV_ALSA_INFO("%s: Instance %d registered as ALSA card %d\n",
|
||||
__func__, itv->instance, sc->number);
|
||||
|
||||
return 0;
|
||||
|
||||
err_exit_free:
|
||||
|
|
|
|||
|
|
@ -75,15 +75,15 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma,
|
|||
ivtv_udma_get_page_info (&uv_dma, (unsigned long)args->uv_source, 360 * uv_decode_height);
|
||||
|
||||
/* Get user pages for DMA Xfer */
|
||||
down_read(¤t->mm->mmap_sem);
|
||||
y_pages = get_user_pages(current, current->mm, y_dma.uaddr, y_dma.page_count, 0, 1, &dma->map[0], NULL);
|
||||
y_pages = get_user_pages_unlocked(current, current->mm,
|
||||
y_dma.uaddr, y_dma.page_count, 0, 1,
|
||||
&dma->map[0]);
|
||||
uv_pages = 0; /* silence gcc. value is set and consumed only if: */
|
||||
if (y_pages == y_dma.page_count) {
|
||||
uv_pages = get_user_pages(current, current->mm,
|
||||
uv_dma.uaddr, uv_dma.page_count, 0, 1,
|
||||
&dma->map[y_pages], NULL);
|
||||
uv_pages = get_user_pages_unlocked(current, current->mm,
|
||||
uv_dma.uaddr, uv_dma.page_count, 0, 1,
|
||||
&dma->map[y_pages]);
|
||||
}
|
||||
up_read(¤t->mm->mmap_sem);
|
||||
|
||||
if (y_pages != y_dma.page_count || uv_pages != uv_dma.page_count) {
|
||||
int rc = -EFAULT;
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ struct netup_dma {
|
|||
u8 num;
|
||||
spinlock_t lock;
|
||||
struct netup_unidvb_dev *ndev;
|
||||
struct netup_dma_regs *regs;
|
||||
struct netup_dma_regs __iomem *regs;
|
||||
u32 ring_buffer_size;
|
||||
u8 *addr_virt;
|
||||
dma_addr_t addr_phys;
|
||||
|
|
@ -82,7 +82,7 @@ struct netup_i2c {
|
|||
wait_queue_head_t wq;
|
||||
struct i2c_adapter adap;
|
||||
struct netup_unidvb_dev *dev;
|
||||
struct netup_i2c_regs *regs;
|
||||
struct netup_i2c_regs __iomem *regs;
|
||||
struct i2c_msg *msg;
|
||||
enum netup_i2c_state state;
|
||||
u32 xmit_size;
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ static int netup_unidvb_ci_read_attribute_mem(struct dvb_ca_en50221 *en50221,
|
|||
{
|
||||
struct netup_ci_state *state = en50221->data;
|
||||
struct netup_unidvb_dev *dev = state->dev;
|
||||
u8 val = state->membase8_config[addr];
|
||||
u8 val = *((u8 __force *)state->membase8_io + addr);
|
||||
|
||||
dev_dbg(&dev->pci_dev->dev,
|
||||
"%s(): addr=0x%x val=0x%x\n", __func__, addr, val);
|
||||
|
|
@ -162,7 +162,7 @@ static int netup_unidvb_ci_write_attribute_mem(struct dvb_ca_en50221 *en50221,
|
|||
|
||||
dev_dbg(&dev->pci_dev->dev,
|
||||
"%s(): addr=0x%x data=0x%x\n", __func__, addr, data);
|
||||
state->membase8_config[addr] = data;
|
||||
*((u8 __force *)state->membase8_io + addr) = data;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -171,7 +171,7 @@ static int netup_unidvb_ci_read_cam_ctl(struct dvb_ca_en50221 *en50221,
|
|||
{
|
||||
struct netup_ci_state *state = en50221->data;
|
||||
struct netup_unidvb_dev *dev = state->dev;
|
||||
u8 val = state->membase8_io[addr];
|
||||
u8 val = *((u8 __force *)state->membase8_io + addr);
|
||||
|
||||
dev_dbg(&dev->pci_dev->dev,
|
||||
"%s(): addr=0x%x val=0x%x\n", __func__, addr, val);
|
||||
|
|
@ -186,7 +186,7 @@ static int netup_unidvb_ci_write_cam_ctl(struct dvb_ca_en50221 *en50221,
|
|||
|
||||
dev_dbg(&dev->pci_dev->dev,
|
||||
"%s(): addr=0x%x data=0x%x\n", __func__, addr, data);
|
||||
state->membase8_io[addr] = data;
|
||||
*((u8 __force *)state->membase8_io + addr) = data;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -226,7 +226,7 @@ int netup_unidvb_ci_register(struct netup_unidvb_dev *dev,
|
|||
__func__, result);
|
||||
return result;
|
||||
}
|
||||
writew(NETUP_UNIDVB_IRQ_CI, (u16 *)(dev->bmmio0 + REG_IMASK_SET));
|
||||
writew(NETUP_UNIDVB_IRQ_CI, dev->bmmio0 + REG_IMASK_SET);
|
||||
dev_info(&pci_dev->dev,
|
||||
"%s(): CI adapter %d init done\n", __func__, num);
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include <linux/interrupt.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/list.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
#include <media/videobuf2-vmalloc.h>
|
||||
|
||||
#include "netup_unidvb.h"
|
||||
|
|
@ -110,7 +111,7 @@ struct netup_dma_regs {
|
|||
} __packed __aligned(1);
|
||||
|
||||
struct netup_unidvb_buffer {
|
||||
struct vb2_buffer vb;
|
||||
struct vb2_v4l2_buffer vb;
|
||||
struct list_head list;
|
||||
u32 size;
|
||||
};
|
||||
|
|
@ -189,12 +190,10 @@ static void netup_unidvb_dma_enable(struct netup_dma *dma, int enable)
|
|||
"%s(): DMA%d enable %d\n", __func__, dma->num, enable);
|
||||
if (enable) {
|
||||
writel(BIT_DMA_RUN, &dma->regs->ctrlstat_set);
|
||||
writew(irq_mask,
|
||||
(u16 *)(dma->ndev->bmmio0 + REG_IMASK_SET));
|
||||
writew(irq_mask, dma->ndev->bmmio0 + REG_IMASK_SET);
|
||||
} else {
|
||||
writel(BIT_DMA_RUN, &dma->regs->ctrlstat_clear);
|
||||
writew(irq_mask,
|
||||
(u16 *)(dma->ndev->bmmio0 + REG_IMASK_CLEAR));
|
||||
writew(irq_mask, dma->ndev->bmmio0 + REG_IMASK_CLEAR);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -278,7 +277,7 @@ static irqreturn_t netup_unidvb_isr(int irq, void *dev_id)
|
|||
}
|
||||
|
||||
static int netup_unidvb_queue_setup(struct vb2_queue *vq,
|
||||
const struct v4l2_format *fmt,
|
||||
const void *parg,
|
||||
unsigned int *nbuffers,
|
||||
unsigned int *nplanes,
|
||||
unsigned int sizes[],
|
||||
|
|
@ -300,7 +299,8 @@ static int netup_unidvb_queue_setup(struct vb2_queue *vq,
|
|||
static int netup_unidvb_buf_prepare(struct vb2_buffer *vb)
|
||||
{
|
||||
struct netup_dma *dma = vb2_get_drv_priv(vb->vb2_queue);
|
||||
struct netup_unidvb_buffer *buf = container_of(vb,
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct netup_unidvb_buffer *buf = container_of(vbuf,
|
||||
struct netup_unidvb_buffer, vb);
|
||||
|
||||
dev_dbg(&dma->ndev->pci_dev->dev, "%s(): buf 0x%p\n", __func__, buf);
|
||||
|
|
@ -312,7 +312,8 @@ static void netup_unidvb_buf_queue(struct vb2_buffer *vb)
|
|||
{
|
||||
unsigned long flags;
|
||||
struct netup_dma *dma = vb2_get_drv_priv(vb->vb2_queue);
|
||||
struct netup_unidvb_buffer *buf = container_of(vb,
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct netup_unidvb_buffer *buf = container_of(vbuf,
|
||||
struct netup_unidvb_buffer, vb);
|
||||
|
||||
dev_dbg(&dma->ndev->pci_dev->dev, "%s(): %p\n", __func__, buf);
|
||||
|
|
@ -509,7 +510,7 @@ static int netup_unidvb_ring_copy(struct netup_dma *dma,
|
|||
{
|
||||
u32 copy_bytes, ring_bytes;
|
||||
u32 buff_bytes = NETUP_DMA_PACKETS_COUNT * 188 - buf->size;
|
||||
u8 *p = vb2_plane_vaddr(&buf->vb, 0);
|
||||
u8 *p = vb2_plane_vaddr(&buf->vb.vb2_buf, 0);
|
||||
struct netup_unidvb_dev *ndev = dma->ndev;
|
||||
|
||||
if (p == NULL) {
|
||||
|
|
@ -522,7 +523,7 @@ static int netup_unidvb_ring_copy(struct netup_dma *dma,
|
|||
ring_bytes = dma->ring_buffer_size - dma->data_offset;
|
||||
copy_bytes = (ring_bytes > buff_bytes) ?
|
||||
buff_bytes : ring_bytes;
|
||||
memcpy_fromio(p, dma->addr_virt + dma->data_offset, copy_bytes);
|
||||
memcpy_fromio(p, (u8 __iomem *)(dma->addr_virt + dma->data_offset), copy_bytes);
|
||||
p += copy_bytes;
|
||||
buf->size += copy_bytes;
|
||||
buff_bytes -= copy_bytes;
|
||||
|
|
@ -535,7 +536,7 @@ static int netup_unidvb_ring_copy(struct netup_dma *dma,
|
|||
ring_bytes = dma->data_size;
|
||||
copy_bytes = (ring_bytes > buff_bytes) ?
|
||||
buff_bytes : ring_bytes;
|
||||
memcpy_fromio(p, dma->addr_virt + dma->data_offset, copy_bytes);
|
||||
memcpy_fromio(p, (u8 __iomem *)(dma->addr_virt + dma->data_offset), copy_bytes);
|
||||
buf->size += copy_bytes;
|
||||
dma->data_size -= copy_bytes;
|
||||
dma->data_offset += copy_bytes;
|
||||
|
|
@ -579,9 +580,9 @@ static void netup_unidvb_dma_worker(struct work_struct *work)
|
|||
dev_dbg(&ndev->pci_dev->dev,
|
||||
"%s(): buffer %p done, size %d\n",
|
||||
__func__, buf, buf->size);
|
||||
v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
|
||||
vb2_set_plane_payload(&buf->vb, 0, buf->size);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);
|
||||
v4l2_get_timestamp(&buf->vb.timestamp);
|
||||
vb2_set_plane_payload(&buf->vb.vb2_buf, 0, buf->size);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
||||
}
|
||||
}
|
||||
work_done:
|
||||
|
|
@ -599,7 +600,7 @@ static void netup_unidvb_queue_cleanup(struct netup_dma *dma)
|
|||
buf = list_first_entry(&dma->free_buffers,
|
||||
struct netup_unidvb_buffer, list);
|
||||
list_del(&buf->list);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
spin_unlock_irqrestore(&dma->lock, flags);
|
||||
}
|
||||
|
|
@ -641,10 +642,10 @@ static int netup_unidvb_dma_init(struct netup_unidvb_dev *ndev, int num)
|
|||
__func__, num, dma->addr_virt,
|
||||
(unsigned long long)dma->addr_phys,
|
||||
dma->ring_buffer_size);
|
||||
memset_io(dma->addr_virt, 0, dma->ring_buffer_size);
|
||||
memset_io((u8 __iomem *)dma->addr_virt, 0, dma->ring_buffer_size);
|
||||
dma->addr_last = dma->addr_phys;
|
||||
dma->high_addr = (u32)(dma->addr_phys & 0xC0000000);
|
||||
dma->regs = (struct netup_dma_regs *)(num == 0 ?
|
||||
dma->regs = (struct netup_dma_regs __iomem *)(num == 0 ?
|
||||
ndev->bmmio0 + NETUP_DMA0_ADDR :
|
||||
ndev->bmmio0 + NETUP_DMA1_ADDR);
|
||||
writel((NETUP_DMA_BLOCKS_COUNT << 24) |
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ static int netup_i2c_init(struct netup_unidvb_dev *ndev, int bus_num)
|
|||
i2c = &ndev->i2c[bus_num];
|
||||
spin_lock_init(&i2c->lock);
|
||||
init_waitqueue_head(&i2c->wq);
|
||||
i2c->regs = (struct netup_i2c_regs *)(ndev->bmmio0 +
|
||||
i2c->regs = (struct netup_i2c_regs __iomem *)(ndev->bmmio0 +
|
||||
(bus_num == 0 ? NETUP_I2C_BUS0_ADDR : NETUP_I2C_BUS1_ADDR));
|
||||
netup_i2c_reset(i2c);
|
||||
i2c->adap = netup_i2c_adapter;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ struct netup_spi_regs {
|
|||
struct netup_spi {
|
||||
struct device *dev;
|
||||
struct spi_master *master;
|
||||
struct netup_spi_regs *regs;
|
||||
struct netup_spi_regs __iomem *regs;
|
||||
u8 __iomem *mmio;
|
||||
spinlock_t lock;
|
||||
wait_queue_head_t waitq;
|
||||
|
|
@ -200,7 +200,7 @@ int netup_spi_init(struct netup_unidvb_dev *ndev)
|
|||
spin_lock_init(&nspi->lock);
|
||||
init_waitqueue_head(&nspi->waitq);
|
||||
nspi->master = master;
|
||||
nspi->regs = (struct netup_spi_regs *)(ndev->bmmio0 + 0x4000);
|
||||
nspi->regs = (struct netup_spi_regs __iomem *)(ndev->bmmio0 + 0x4000);
|
||||
writew(2, &nspi->regs->clock_divider);
|
||||
writew(NETUP_UNIDVB_IRQ_SPI, ndev->bmmio0 + REG_IMASK_SET);
|
||||
ndev->spi = nspi;
|
||||
|
|
|
|||
|
|
@ -5884,6 +5884,42 @@ struct saa7134_board saa7134_boards[] = {
|
|||
.amux = LINE1,
|
||||
},
|
||||
},
|
||||
[SAA7134_BOARD_LEADTEK_WINFAST_TV2100_FM] = {
|
||||
.name = "Leadtek Winfast TV2100 FM",
|
||||
.audio_clock = 0x00187de7,
|
||||
.tuner_type = TUNER_TNF_5335MF,
|
||||
.radio_type = UNSET,
|
||||
.tuner_addr = ADDR_UNSET,
|
||||
.radio_addr = ADDR_UNSET,
|
||||
.gpiomask = 0x0d,
|
||||
.inputs = {{
|
||||
.name = name_tv_mono,
|
||||
.vmux = 1,
|
||||
.amux = LINE1,
|
||||
.gpio = 0x00,
|
||||
.tv = 1,
|
||||
}, {
|
||||
.name = name_comp1,
|
||||
.vmux = 3,
|
||||
.amux = LINE2,
|
||||
.gpio = 0x08,
|
||||
}, {
|
||||
.name = name_svideo,
|
||||
.vmux = 8,
|
||||
.amux = LINE2,
|
||||
.gpio = 0x08,
|
||||
} },
|
||||
.radio = {
|
||||
.name = name_radio,
|
||||
.amux = LINE1,
|
||||
.gpio = 0x04,
|
||||
},
|
||||
.mute = {
|
||||
.name = name_mute,
|
||||
.amux = LINE1,
|
||||
.gpio = 0x08,
|
||||
},
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -7148,6 +7184,12 @@ struct pci_device_id saa7134_pci_tbl[] = {
|
|||
.subvendor = 0x1461, /* Avermedia Technologies Inc */
|
||||
.subdevice = 0xa10a,
|
||||
.driver_data = SAA7134_BOARD_AVERMEDIA_505,
|
||||
}, {
|
||||
.vendor = PCI_VENDOR_ID_PHILIPS,
|
||||
.device = PCI_DEVICE_ID_PHILIPS_SAA7130,
|
||||
.subvendor = 0x107d,
|
||||
.subdevice = 0x6f3a,
|
||||
.driver_data = SAA7134_BOARD_LEADTEK_WINFAST_TV2100_FM,
|
||||
}, {
|
||||
/* --- boards without eeprom + subsystem ID --- */
|
||||
.vendor = PCI_VENDOR_ID_PHILIPS,
|
||||
|
|
@ -7545,6 +7587,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
|
|||
case SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS:
|
||||
case SAA7134_BOARD_ROVERMEDIA_LINK_PRO_FM:
|
||||
case SAA7134_BOARD_LEADTEK_WINFAST_DTV1000S:
|
||||
case SAA7134_BOARD_LEADTEK_WINFAST_TV2100_FM:
|
||||
dev->has_remote = SAA7134_REMOTE_GPIO;
|
||||
break;
|
||||
case SAA7134_BOARD_FLYDVBS_LR300:
|
||||
|
|
|
|||
|
|
@ -216,13 +216,14 @@ int saa7134_buffer_count(unsigned int size, unsigned int count)
|
|||
|
||||
int saa7134_buffer_startpage(struct saa7134_buf *buf)
|
||||
{
|
||||
return saa7134_buffer_pages(vb2_plane_size(&buf->vb2, 0)) * buf->vb2.v4l2_buf.index;
|
||||
return saa7134_buffer_pages(vb2_plane_size(&buf->vb2.vb2_buf, 0))
|
||||
* buf->vb2.vb2_buf.index;
|
||||
}
|
||||
|
||||
unsigned long saa7134_buffer_base(struct saa7134_buf *buf)
|
||||
{
|
||||
unsigned long base;
|
||||
struct sg_table *dma = vb2_dma_sg_plane_desc(&buf->vb2, 0);
|
||||
struct sg_table *dma = vb2_dma_sg_plane_desc(&buf->vb2.vb2_buf, 0);
|
||||
|
||||
base = saa7134_buffer_startpage(buf) * 4096;
|
||||
base += dma->sgl[0].offset;
|
||||
|
|
@ -308,9 +309,9 @@ void saa7134_buffer_finish(struct saa7134_dev *dev,
|
|||
core_dbg("buffer_finish %p\n", q->curr);
|
||||
|
||||
/* finish current buffer */
|
||||
v4l2_get_timestamp(&q->curr->vb2.v4l2_buf.timestamp);
|
||||
q->curr->vb2.v4l2_buf.sequence = q->seq_nr++;
|
||||
vb2_buffer_done(&q->curr->vb2, state);
|
||||
v4l2_get_timestamp(&q->curr->vb2.timestamp);
|
||||
q->curr->vb2.sequence = q->seq_nr++;
|
||||
vb2_buffer_done(&q->curr->vb2.vb2_buf, state);
|
||||
q->curr = NULL;
|
||||
}
|
||||
|
||||
|
|
@ -375,7 +376,8 @@ void saa7134_stop_streaming(struct saa7134_dev *dev, struct saa7134_dmaqueue *q)
|
|||
if (!list_empty(&q->queue)) {
|
||||
list_for_each_safe(pos, n, &q->queue) {
|
||||
tmp = list_entry(pos, struct saa7134_buf, entry);
|
||||
vb2_buffer_done(&tmp->vb2, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&tmp->vb2.vb2_buf,
|
||||
VB2_BUF_STATE_ERROR);
|
||||
list_del(pos);
|
||||
tmp = NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -835,6 +835,13 @@ int saa7134_input_init1(struct saa7134_dev *dev)
|
|||
mask_keycode = 0xffff;
|
||||
raw_decode = true;
|
||||
break;
|
||||
case SAA7134_BOARD_LEADTEK_WINFAST_TV2100_FM:
|
||||
ir_codes = RC_MAP_LEADTEK_Y04G0051;
|
||||
mask_keydown = 0x0040000; /* Enable GPIO18 line on both edges */
|
||||
mask_keyup = 0x0040000;
|
||||
mask_keycode = 0xffff;
|
||||
raw_decode = true;
|
||||
break;
|
||||
}
|
||||
if (NULL == ir_codes) {
|
||||
pr_err("Oops: IR config error [card=%d]\n", dev->board);
|
||||
|
|
|
|||
|
|
@ -79,8 +79,9 @@ static int buffer_activate(struct saa7134_dev *dev,
|
|||
|
||||
int saa7134_ts_buffer_init(struct vb2_buffer *vb2)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb2);
|
||||
struct saa7134_dmaqueue *dmaq = vb2->vb2_queue->drv_priv;
|
||||
struct saa7134_buf *buf = container_of(vb2, struct saa7134_buf, vb2);
|
||||
struct saa7134_buf *buf = container_of(vbuf, struct saa7134_buf, vb2);
|
||||
|
||||
dmaq->curr = NULL;
|
||||
buf->activate = buffer_activate;
|
||||
|
|
@ -91,9 +92,10 @@ EXPORT_SYMBOL_GPL(saa7134_ts_buffer_init);
|
|||
|
||||
int saa7134_ts_buffer_prepare(struct vb2_buffer *vb2)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb2);
|
||||
struct saa7134_dmaqueue *dmaq = vb2->vb2_queue->drv_priv;
|
||||
struct saa7134_dev *dev = dmaq->dev;
|
||||
struct saa7134_buf *buf = container_of(vb2, struct saa7134_buf, vb2);
|
||||
struct saa7134_buf *buf = container_of(vbuf, struct saa7134_buf, vb2);
|
||||
struct sg_table *dma = vb2_dma_sg_plane_desc(vb2, 0);
|
||||
unsigned int lines, llength, size;
|
||||
|
||||
|
|
@ -107,14 +109,14 @@ int saa7134_ts_buffer_prepare(struct vb2_buffer *vb2)
|
|||
return -EINVAL;
|
||||
|
||||
vb2_set_plane_payload(vb2, 0, size);
|
||||
vb2->v4l2_buf.field = dev->field;
|
||||
vbuf->field = dev->field;
|
||||
|
||||
return saa7134_pgtable_build(dev->pci, &dmaq->pt, dma->sgl, dma->nents,
|
||||
saa7134_buffer_startpage(buf));
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(saa7134_ts_buffer_prepare);
|
||||
|
||||
int saa7134_ts_queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
||||
int saa7134_ts_queue_setup(struct vb2_queue *q, const void *parg,
|
||||
unsigned int *nbuffers, unsigned int *nplanes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
|
|
@ -148,10 +150,12 @@ int saa7134_ts_start_streaming(struct vb2_queue *vq, unsigned int count)
|
|||
|
||||
list_for_each_entry_safe(buf, tmp, &dmaq->queue, entry) {
|
||||
list_del(&buf->entry);
|
||||
vb2_buffer_done(&buf->vb2, VB2_BUF_STATE_QUEUED);
|
||||
vb2_buffer_done(&buf->vb2.vb2_buf,
|
||||
VB2_BUF_STATE_QUEUED);
|
||||
}
|
||||
if (dmaq->curr) {
|
||||
vb2_buffer_done(&dmaq->curr->vb2, VB2_BUF_STATE_QUEUED);
|
||||
vb2_buffer_done(&dmaq->curr->vb2.vb2_buf,
|
||||
VB2_BUF_STATE_QUEUED);
|
||||
dmaq->curr = NULL;
|
||||
}
|
||||
return -EBUSY;
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ static int buffer_activate(struct saa7134_dev *dev,
|
|||
struct saa7134_buf *buf,
|
||||
struct saa7134_buf *next)
|
||||
{
|
||||
struct saa7134_dmaqueue *dmaq = buf->vb2.vb2_queue->drv_priv;
|
||||
struct saa7134_dmaqueue *dmaq = buf->vb2.vb2_buf.vb2_queue->drv_priv;
|
||||
unsigned long control, base;
|
||||
|
||||
vbi_dbg("buffer_activate [%p]\n", buf);
|
||||
|
|
@ -119,8 +119,9 @@ static int buffer_prepare(struct vb2_buffer *vb2)
|
|||
{
|
||||
struct saa7134_dmaqueue *dmaq = vb2->vb2_queue->drv_priv;
|
||||
struct saa7134_dev *dev = dmaq->dev;
|
||||
struct saa7134_buf *buf = container_of(vb2, struct saa7134_buf, vb2);
|
||||
struct sg_table *dma = vb2_dma_sg_plane_desc(&buf->vb2, 0);
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb2);
|
||||
struct saa7134_buf *buf = container_of(vbuf, struct saa7134_buf, vb2);
|
||||
struct sg_table *dma = vb2_dma_sg_plane_desc(vb2, 0);
|
||||
unsigned int size;
|
||||
|
||||
if (dma->sgl->offset) {
|
||||
|
|
@ -137,7 +138,7 @@ static int buffer_prepare(struct vb2_buffer *vb2)
|
|||
saa7134_buffer_startpage(buf));
|
||||
}
|
||||
|
||||
static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
||||
static int queue_setup(struct vb2_queue *q, const void *parg,
|
||||
unsigned int *nbuffers, unsigned int *nplanes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
|
|
@ -161,7 +162,8 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
|||
static int buffer_init(struct vb2_buffer *vb2)
|
||||
{
|
||||
struct saa7134_dmaqueue *dmaq = vb2->vb2_queue->drv_priv;
|
||||
struct saa7134_buf *buf = container_of(vb2, struct saa7134_buf, vb2);
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb2);
|
||||
struct saa7134_buf *buf = container_of(vbuf, struct saa7134_buf, vb2);
|
||||
|
||||
dmaq->curr = NULL;
|
||||
buf->activate = buffer_activate;
|
||||
|
|
|
|||
|
|
@ -791,7 +791,7 @@ static int buffer_activate(struct saa7134_dev *dev,
|
|||
struct saa7134_buf *buf,
|
||||
struct saa7134_buf *next)
|
||||
{
|
||||
struct saa7134_dmaqueue *dmaq = buf->vb2.vb2_queue->drv_priv;
|
||||
struct saa7134_dmaqueue *dmaq = buf->vb2.vb2_buf.vb2_queue->drv_priv;
|
||||
unsigned long base,control,bpl;
|
||||
unsigned long bpl_uv,lines_uv,base2,base3,tmp; /* planar */
|
||||
|
||||
|
|
@ -872,7 +872,8 @@ static int buffer_activate(struct saa7134_dev *dev,
|
|||
static int buffer_init(struct vb2_buffer *vb2)
|
||||
{
|
||||
struct saa7134_dmaqueue *dmaq = vb2->vb2_queue->drv_priv;
|
||||
struct saa7134_buf *buf = container_of(vb2, struct saa7134_buf, vb2);
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb2);
|
||||
struct saa7134_buf *buf = container_of(vbuf, struct saa7134_buf, vb2);
|
||||
|
||||
dmaq->curr = NULL;
|
||||
buf->activate = buffer_activate;
|
||||
|
|
@ -883,8 +884,9 @@ static int buffer_prepare(struct vb2_buffer *vb2)
|
|||
{
|
||||
struct saa7134_dmaqueue *dmaq = vb2->vb2_queue->drv_priv;
|
||||
struct saa7134_dev *dev = dmaq->dev;
|
||||
struct saa7134_buf *buf = container_of(vb2, struct saa7134_buf, vb2);
|
||||
struct sg_table *dma = vb2_dma_sg_plane_desc(&buf->vb2, 0);
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb2);
|
||||
struct saa7134_buf *buf = container_of(vbuf, struct saa7134_buf, vb2);
|
||||
struct sg_table *dma = vb2_dma_sg_plane_desc(vb2, 0);
|
||||
unsigned int size;
|
||||
|
||||
if (dma->sgl->offset) {
|
||||
|
|
@ -896,13 +898,13 @@ static int buffer_prepare(struct vb2_buffer *vb2)
|
|||
return -EINVAL;
|
||||
|
||||
vb2_set_plane_payload(vb2, 0, size);
|
||||
vb2->v4l2_buf.field = dev->field;
|
||||
vbuf->field = dev->field;
|
||||
|
||||
return saa7134_pgtable_build(dev->pci, &dmaq->pt, dma->sgl, dma->nents,
|
||||
saa7134_buffer_startpage(buf));
|
||||
}
|
||||
|
||||
static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
||||
static int queue_setup(struct vb2_queue *q, const void *parg,
|
||||
unsigned int *nbuffers, unsigned int *nplanes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
|
|
@ -932,7 +934,8 @@ void saa7134_vb2_buffer_queue(struct vb2_buffer *vb)
|
|||
{
|
||||
struct saa7134_dmaqueue *dmaq = vb->vb2_queue->drv_priv;
|
||||
struct saa7134_dev *dev = dmaq->dev;
|
||||
struct saa7134_buf *buf = container_of(vb, struct saa7134_buf, vb2);
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct saa7134_buf *buf = container_of(vbuf, struct saa7134_buf, vb2);
|
||||
|
||||
saa7134_buffer_queue(dev, dmaq, buf);
|
||||
}
|
||||
|
|
@ -953,10 +956,12 @@ int saa7134_vb2_start_streaming(struct vb2_queue *vq, unsigned int count)
|
|||
|
||||
list_for_each_entry_safe(buf, tmp, &dmaq->queue, entry) {
|
||||
list_del(&buf->entry);
|
||||
vb2_buffer_done(&buf->vb2, VB2_BUF_STATE_QUEUED);
|
||||
vb2_buffer_done(&buf->vb2.vb2_buf,
|
||||
VB2_BUF_STATE_QUEUED);
|
||||
}
|
||||
if (dmaq->curr) {
|
||||
vb2_buffer_done(&dmaq->curr->vb2, VB2_BUF_STATE_QUEUED);
|
||||
vb2_buffer_done(&dmaq->curr->vb2.vb2_buf,
|
||||
VB2_BUF_STATE_QUEUED);
|
||||
dmaq->curr = NULL;
|
||||
}
|
||||
return -EBUSY;
|
||||
|
|
|
|||
|
|
@ -342,6 +342,7 @@ struct saa7134_card_ir {
|
|||
#define SAA7134_BOARD_AVERMEDIA_A706 192
|
||||
#define SAA7134_BOARD_WIS_VOYAGER 193
|
||||
#define SAA7134_BOARD_AVERMEDIA_505 194
|
||||
#define SAA7134_BOARD_LEADTEK_WINFAST_TV2100_FM 195
|
||||
|
||||
#define SAA7134_MAXBOARDS 32
|
||||
#define SAA7134_INPUT_MAX 8
|
||||
|
|
@ -459,7 +460,7 @@ struct saa7134_thread {
|
|||
/* buffer for one video/vbi/ts frame */
|
||||
struct saa7134_buf {
|
||||
/* common v4l buffer stuff -- must be first */
|
||||
struct vb2_buffer vb2;
|
||||
struct vb2_v4l2_buffer vb2;
|
||||
|
||||
/* saa7134 specific */
|
||||
unsigned int top_seen;
|
||||
|
|
@ -819,7 +820,7 @@ void saa7134_video_fini(struct saa7134_dev *dev);
|
|||
|
||||
int saa7134_ts_buffer_init(struct vb2_buffer *vb2);
|
||||
int saa7134_ts_buffer_prepare(struct vb2_buffer *vb2);
|
||||
int saa7134_ts_queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
||||
int saa7134_ts_queue_setup(struct vb2_queue *q, const void *parg,
|
||||
unsigned int *nbuffers, unsigned int *nplanes,
|
||||
unsigned int sizes[], void *alloc_ctxs[]);
|
||||
int saa7134_ts_start_streaming(struct vb2_queue *vq, unsigned int count);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ config VIDEO_SAA7164
|
|||
select FW_LOADER
|
||||
select VIDEO_TUNER
|
||||
select VIDEO_TVEEPROM
|
||||
select VIDEOBUF_DVB
|
||||
select DVB_TDA10048 if MEDIA_SUBDRV_AUTOSELECT
|
||||
select DVB_S5H1411 if MEDIA_SUBDRV_AUTOSELECT
|
||||
select MEDIA_TUNER_TDA18271 if MEDIA_SUBDRV_AUTOSELECT
|
||||
|
|
|
|||
|
|
@ -25,6 +25,18 @@
|
|||
#define ENCODER_MIN_BITRATE 1000000
|
||||
#define ENCODER_DEF_BITRATE 5000000
|
||||
|
||||
/*
|
||||
* This is a dummy non-zero value for the sizeimage field of v4l2_pix_format.
|
||||
* It is not actually used for anything since this driver does not support
|
||||
* stream I/O, only read(), and because this driver produces an MPEG stream
|
||||
* and not discrete frames. But the V4L2 spec doesn't allow for this value
|
||||
* to be 0, so set it to 0x10000 instead.
|
||||
*
|
||||
* If we ever change this driver to support stream I/O, then this field
|
||||
* will be the size of the streaming buffers.
|
||||
*/
|
||||
#define SAA7164_SIZEIMAGE (0x10000)
|
||||
|
||||
static struct saa7164_tvnorm saa7164_tvnorms[] = {
|
||||
{
|
||||
.name = "NTSC-M",
|
||||
|
|
@ -35,24 +47,6 @@ static struct saa7164_tvnorm saa7164_tvnorms[] = {
|
|||
}
|
||||
};
|
||||
|
||||
static const u32 saa7164_v4l2_ctrls[] = {
|
||||
V4L2_CID_BRIGHTNESS,
|
||||
V4L2_CID_CONTRAST,
|
||||
V4L2_CID_SATURATION,
|
||||
V4L2_CID_HUE,
|
||||
V4L2_CID_AUDIO_VOLUME,
|
||||
V4L2_CID_SHARPNESS,
|
||||
V4L2_CID_MPEG_STREAM_TYPE,
|
||||
V4L2_CID_MPEG_VIDEO_ASPECT,
|
||||
V4L2_CID_MPEG_VIDEO_B_FRAMES,
|
||||
V4L2_CID_MPEG_VIDEO_GOP_SIZE,
|
||||
V4L2_CID_MPEG_AUDIO_MUTE,
|
||||
V4L2_CID_MPEG_VIDEO_BITRATE_MODE,
|
||||
V4L2_CID_MPEG_VIDEO_BITRATE,
|
||||
V4L2_CID_MPEG_VIDEO_BITRATE_PEAK,
|
||||
0
|
||||
};
|
||||
|
||||
/* Take the encoder configuration form the port struct and
|
||||
* flush it to the hardware.
|
||||
*/
|
||||
|
|
@ -211,10 +205,8 @@ static int saa7164_encoder_initialize(struct saa7164_port *port)
|
|||
}
|
||||
|
||||
/* -- V4L2 --------------------------------------------------------- */
|
||||
static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id id)
|
||||
int saa7164_s_std(struct saa7164_port *port, v4l2_std_id id)
|
||||
{
|
||||
struct saa7164_encoder_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
struct saa7164_dev *dev = port->dev;
|
||||
unsigned int i;
|
||||
|
||||
|
|
@ -240,22 +232,33 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id id)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *id)
|
||||
static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id id)
|
||||
{
|
||||
struct saa7164_encoder_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
|
||||
return saa7164_s_std(fh->port, id);
|
||||
}
|
||||
|
||||
int saa7164_g_std(struct saa7164_port *port, v4l2_std_id *id)
|
||||
{
|
||||
*id = port->std;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_enum_input(struct file *file, void *priv,
|
||||
struct v4l2_input *i)
|
||||
static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *id)
|
||||
{
|
||||
int n;
|
||||
struct saa7164_encoder_fh *fh = file->private_data;
|
||||
|
||||
char *inputs[] = { "tuner", "composite", "svideo", "aux",
|
||||
"composite 2", "svideo 2", "aux 2" };
|
||||
return saa7164_g_std(fh->port, id);
|
||||
}
|
||||
|
||||
int saa7164_enum_input(struct file *file, void *priv, struct v4l2_input *i)
|
||||
{
|
||||
static const char * const inputs[] = {
|
||||
"tuner", "composite", "svideo", "aux",
|
||||
"composite 2", "svideo 2", "aux 2"
|
||||
};
|
||||
int n;
|
||||
|
||||
if (i->index >= 7)
|
||||
return -EINVAL;
|
||||
|
|
@ -273,10 +276,8 @@ static int vidioc_enum_input(struct file *file, void *priv,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_g_input(struct file *file, void *priv, unsigned int *i)
|
||||
int saa7164_g_input(struct saa7164_port *port, unsigned int *i)
|
||||
{
|
||||
struct saa7164_encoder_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
struct saa7164_dev *dev = port->dev;
|
||||
|
||||
if (saa7164_api_get_videomux(port) != SAA_OK)
|
||||
|
|
@ -289,10 +290,15 @@ static int vidioc_g_input(struct file *file, void *priv, unsigned int *i)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
|
||||
static int vidioc_g_input(struct file *file, void *priv, unsigned int *i)
|
||||
{
|
||||
struct saa7164_encoder_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
|
||||
return saa7164_g_input(fh->port, i);
|
||||
}
|
||||
|
||||
int saa7164_s_input(struct saa7164_port *port, unsigned int i)
|
||||
{
|
||||
struct saa7164_dev *dev = port->dev;
|
||||
|
||||
dprintk(DBGLVL_ENC, "%s() input=%d\n", __func__, i);
|
||||
|
|
@ -308,8 +314,14 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_g_tuner(struct file *file, void *priv,
|
||||
struct v4l2_tuner *t)
|
||||
static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
|
||||
{
|
||||
struct saa7164_encoder_fh *fh = file->private_data;
|
||||
|
||||
return saa7164_s_input(fh->port, i);
|
||||
}
|
||||
|
||||
int saa7164_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t)
|
||||
{
|
||||
struct saa7164_encoder_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
|
|
@ -319,38 +331,45 @@ static int vidioc_g_tuner(struct file *file, void *priv,
|
|||
return -EINVAL;
|
||||
|
||||
strcpy(t->name, "tuner");
|
||||
t->type = V4L2_TUNER_ANALOG_TV;
|
||||
t->capability = V4L2_TUNER_CAP_NORM | V4L2_TUNER_CAP_STEREO;
|
||||
t->rangelow = SAA7164_TV_MIN_FREQ;
|
||||
t->rangehigh = SAA7164_TV_MAX_FREQ;
|
||||
|
||||
dprintk(DBGLVL_ENC, "VIDIOC_G_TUNER: tuner type %d\n", t->type);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_s_tuner(struct file *file, void *priv,
|
||||
const struct v4l2_tuner *t)
|
||||
int saa7164_s_tuner(struct file *file, void *priv,
|
||||
const struct v4l2_tuner *t)
|
||||
{
|
||||
if (0 != t->index)
|
||||
return -EINVAL;
|
||||
|
||||
/* Update the A/V core */
|
||||
return 0;
|
||||
}
|
||||
|
||||
int saa7164_g_frequency(struct saa7164_port *port, struct v4l2_frequency *f)
|
||||
{
|
||||
if (f->tuner)
|
||||
return -EINVAL;
|
||||
|
||||
f->frequency = port->freq;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_g_frequency(struct file *file, void *priv,
|
||||
struct v4l2_frequency *f)
|
||||
{
|
||||
struct saa7164_encoder_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
|
||||
f->type = V4L2_TUNER_ANALOG_TV;
|
||||
f->frequency = port->freq;
|
||||
|
||||
return 0;
|
||||
return saa7164_g_frequency(fh->port, f);
|
||||
}
|
||||
|
||||
static int vidioc_s_frequency(struct file *file, void *priv,
|
||||
const struct v4l2_frequency *f)
|
||||
int saa7164_s_frequency(struct saa7164_port *port,
|
||||
const struct v4l2_frequency *f)
|
||||
{
|
||||
struct saa7164_encoder_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
struct saa7164_dev *dev = port->dev;
|
||||
struct saa7164_port *tsport;
|
||||
struct dvb_frontend *fe;
|
||||
|
|
@ -370,16 +389,13 @@ static int vidioc_s_frequency(struct file *file, void *priv,
|
|||
if (f->tuner != 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (f->type != V4L2_TUNER_ANALOG_TV)
|
||||
return -EINVAL;
|
||||
|
||||
port->freq = f->frequency;
|
||||
port->freq = clamp(f->frequency,
|
||||
SAA7164_TV_MIN_FREQ, SAA7164_TV_MAX_FREQ);
|
||||
|
||||
/* Update the hardware */
|
||||
if (port->nr == SAA7164_PORT_ENC1)
|
||||
tsport = &dev->ports[SAA7164_PORT_TS1];
|
||||
else
|
||||
if (port->nr == SAA7164_PORT_ENC2)
|
||||
else if (port->nr == SAA7164_PORT_ENC2)
|
||||
tsport = &dev->ports[SAA7164_PORT_TS2];
|
||||
else
|
||||
BUG();
|
||||
|
|
@ -396,253 +412,54 @@ static int vidioc_s_frequency(struct file *file, void *priv,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_g_ctrl(struct file *file, void *priv,
|
||||
struct v4l2_control *ctl)
|
||||
static int vidioc_s_frequency(struct file *file, void *priv,
|
||||
const struct v4l2_frequency *f)
|
||||
{
|
||||
struct saa7164_encoder_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
struct saa7164_dev *dev = port->dev;
|
||||
|
||||
dprintk(DBGLVL_ENC, "%s(id=%d, value=%d)\n", __func__,
|
||||
ctl->id, ctl->value);
|
||||
|
||||
switch (ctl->id) {
|
||||
case V4L2_CID_BRIGHTNESS:
|
||||
ctl->value = port->ctl_brightness;
|
||||
break;
|
||||
case V4L2_CID_CONTRAST:
|
||||
ctl->value = port->ctl_contrast;
|
||||
break;
|
||||
case V4L2_CID_SATURATION:
|
||||
ctl->value = port->ctl_saturation;
|
||||
break;
|
||||
case V4L2_CID_HUE:
|
||||
ctl->value = port->ctl_hue;
|
||||
break;
|
||||
case V4L2_CID_SHARPNESS:
|
||||
ctl->value = port->ctl_sharpness;
|
||||
break;
|
||||
case V4L2_CID_AUDIO_VOLUME:
|
||||
ctl->value = port->ctl_volume;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return saa7164_s_frequency(fh->port, f);
|
||||
}
|
||||
|
||||
static int vidioc_s_ctrl(struct file *file, void *priv,
|
||||
struct v4l2_control *ctl)
|
||||
{
|
||||
struct saa7164_encoder_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
struct saa7164_dev *dev = port->dev;
|
||||
int ret = 0;
|
||||
|
||||
dprintk(DBGLVL_ENC, "%s(id=%d, value=%d)\n", __func__,
|
||||
ctl->id, ctl->value);
|
||||
|
||||
switch (ctl->id) {
|
||||
case V4L2_CID_BRIGHTNESS:
|
||||
if ((ctl->value >= 0) && (ctl->value <= 255)) {
|
||||
port->ctl_brightness = ctl->value;
|
||||
saa7164_api_set_usercontrol(port,
|
||||
PU_BRIGHTNESS_CONTROL);
|
||||
} else
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
case V4L2_CID_CONTRAST:
|
||||
if ((ctl->value >= 0) && (ctl->value <= 255)) {
|
||||
port->ctl_contrast = ctl->value;
|
||||
saa7164_api_set_usercontrol(port, PU_CONTRAST_CONTROL);
|
||||
} else
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
case V4L2_CID_SATURATION:
|
||||
if ((ctl->value >= 0) && (ctl->value <= 255)) {
|
||||
port->ctl_saturation = ctl->value;
|
||||
saa7164_api_set_usercontrol(port,
|
||||
PU_SATURATION_CONTROL);
|
||||
} else
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
case V4L2_CID_HUE:
|
||||
if ((ctl->value >= 0) && (ctl->value <= 255)) {
|
||||
port->ctl_hue = ctl->value;
|
||||
saa7164_api_set_usercontrol(port, PU_HUE_CONTROL);
|
||||
} else
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
case V4L2_CID_SHARPNESS:
|
||||
if ((ctl->value >= 0) && (ctl->value <= 255)) {
|
||||
port->ctl_sharpness = ctl->value;
|
||||
saa7164_api_set_usercontrol(port, PU_SHARPNESS_CONTROL);
|
||||
} else
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
case V4L2_CID_AUDIO_VOLUME:
|
||||
if ((ctl->value >= -83) && (ctl->value <= 24)) {
|
||||
port->ctl_volume = ctl->value;
|
||||
saa7164_api_set_audio_volume(port, port->ctl_volume);
|
||||
} else
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int saa7164_get_ctrl(struct saa7164_port *port,
|
||||
struct v4l2_ext_control *ctrl)
|
||||
{
|
||||
struct saa7164_encoder_params *params = &port->encoder_params;
|
||||
|
||||
switch (ctrl->id) {
|
||||
case V4L2_CID_MPEG_VIDEO_BITRATE:
|
||||
ctrl->value = params->bitrate;
|
||||
break;
|
||||
case V4L2_CID_MPEG_STREAM_TYPE:
|
||||
ctrl->value = params->stream_type;
|
||||
break;
|
||||
case V4L2_CID_MPEG_AUDIO_MUTE:
|
||||
ctrl->value = params->ctl_mute;
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_ASPECT:
|
||||
ctrl->value = params->ctl_aspect;
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
|
||||
ctrl->value = params->bitrate_mode;
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_B_FRAMES:
|
||||
ctrl->value = params->refdist;
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK:
|
||||
ctrl->value = params->bitrate_peak;
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
|
||||
ctrl->value = params->gop_size;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_g_ext_ctrls(struct file *file, void *priv,
|
||||
struct v4l2_ext_controls *ctrls)
|
||||
{
|
||||
struct saa7164_encoder_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
int i, err = 0;
|
||||
|
||||
if (ctrls->ctrl_class == V4L2_CTRL_CLASS_MPEG) {
|
||||
for (i = 0; i < ctrls->count; i++) {
|
||||
struct v4l2_ext_control *ctrl = ctrls->controls + i;
|
||||
|
||||
err = saa7164_get_ctrl(port, ctrl);
|
||||
if (err) {
|
||||
ctrls->error_idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return err;
|
||||
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int saa7164_try_ctrl(struct v4l2_ext_control *ctrl, int ac3)
|
||||
{
|
||||
int ret = -EINVAL;
|
||||
|
||||
switch (ctrl->id) {
|
||||
case V4L2_CID_MPEG_VIDEO_BITRATE:
|
||||
if ((ctrl->value >= ENCODER_MIN_BITRATE) &&
|
||||
(ctrl->value <= ENCODER_MAX_BITRATE))
|
||||
ret = 0;
|
||||
break;
|
||||
case V4L2_CID_MPEG_STREAM_TYPE:
|
||||
if ((ctrl->value == V4L2_MPEG_STREAM_TYPE_MPEG2_PS) ||
|
||||
(ctrl->value == V4L2_MPEG_STREAM_TYPE_MPEG2_TS))
|
||||
ret = 0;
|
||||
break;
|
||||
case V4L2_CID_MPEG_AUDIO_MUTE:
|
||||
if ((ctrl->value >= 0) &&
|
||||
(ctrl->value <= 1))
|
||||
ret = 0;
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_ASPECT:
|
||||
if ((ctrl->value >= V4L2_MPEG_VIDEO_ASPECT_1x1) &&
|
||||
(ctrl->value <= V4L2_MPEG_VIDEO_ASPECT_221x100))
|
||||
ret = 0;
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
|
||||
if ((ctrl->value >= 0) &&
|
||||
(ctrl->value <= 255))
|
||||
ret = 0;
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
|
||||
if ((ctrl->value == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR) ||
|
||||
(ctrl->value == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR))
|
||||
ret = 0;
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_B_FRAMES:
|
||||
if ((ctrl->value >= 1) &&
|
||||
(ctrl->value <= 3))
|
||||
ret = 0;
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK:
|
||||
if ((ctrl->value >= ENCODER_MIN_BITRATE) &&
|
||||
(ctrl->value <= ENCODER_MAX_BITRATE))
|
||||
ret = 0;
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int vidioc_try_ext_ctrls(struct file *file, void *priv,
|
||||
struct v4l2_ext_controls *ctrls)
|
||||
{
|
||||
int i, err = 0;
|
||||
|
||||
if (ctrls->ctrl_class == V4L2_CTRL_CLASS_MPEG) {
|
||||
for (i = 0; i < ctrls->count; i++) {
|
||||
struct v4l2_ext_control *ctrl = ctrls->controls + i;
|
||||
|
||||
err = saa7164_try_ctrl(ctrl, 0);
|
||||
if (err) {
|
||||
ctrls->error_idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int saa7164_set_ctrl(struct saa7164_port *port,
|
||||
struct v4l2_ext_control *ctrl)
|
||||
static int saa7164_s_ctrl(struct v4l2_ctrl *ctrl)
|
||||
{
|
||||
struct saa7164_port *port =
|
||||
container_of(ctrl->handler, struct saa7164_port, ctrl_handler);
|
||||
struct saa7164_encoder_params *params = &port->encoder_params;
|
||||
int ret = 0;
|
||||
|
||||
switch (ctrl->id) {
|
||||
case V4L2_CID_BRIGHTNESS:
|
||||
port->ctl_brightness = ctrl->val;
|
||||
saa7164_api_set_usercontrol(port, PU_BRIGHTNESS_CONTROL);
|
||||
break;
|
||||
case V4L2_CID_CONTRAST:
|
||||
port->ctl_contrast = ctrl->val;
|
||||
saa7164_api_set_usercontrol(port, PU_CONTRAST_CONTROL);
|
||||
break;
|
||||
case V4L2_CID_SATURATION:
|
||||
port->ctl_saturation = ctrl->val;
|
||||
saa7164_api_set_usercontrol(port, PU_SATURATION_CONTROL);
|
||||
break;
|
||||
case V4L2_CID_HUE:
|
||||
port->ctl_hue = ctrl->val;
|
||||
saa7164_api_set_usercontrol(port, PU_HUE_CONTROL);
|
||||
break;
|
||||
case V4L2_CID_SHARPNESS:
|
||||
port->ctl_sharpness = ctrl->val;
|
||||
saa7164_api_set_usercontrol(port, PU_SHARPNESS_CONTROL);
|
||||
break;
|
||||
case V4L2_CID_AUDIO_VOLUME:
|
||||
port->ctl_volume = ctrl->val;
|
||||
saa7164_api_set_audio_volume(port, port->ctl_volume);
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_BITRATE:
|
||||
params->bitrate = ctrl->value;
|
||||
params->bitrate = ctrl->val;
|
||||
break;
|
||||
case V4L2_CID_MPEG_STREAM_TYPE:
|
||||
params->stream_type = ctrl->value;
|
||||
params->stream_type = ctrl->val;
|
||||
break;
|
||||
case V4L2_CID_MPEG_AUDIO_MUTE:
|
||||
params->ctl_mute = ctrl->value;
|
||||
params->ctl_mute = ctrl->val;
|
||||
ret = saa7164_api_audio_mute(port, params->ctl_mute);
|
||||
if (ret != SAA_OK) {
|
||||
printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__,
|
||||
|
|
@ -651,7 +468,7 @@ static int saa7164_set_ctrl(struct saa7164_port *port,
|
|||
}
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_ASPECT:
|
||||
params->ctl_aspect = ctrl->value;
|
||||
params->ctl_aspect = ctrl->val;
|
||||
ret = saa7164_api_set_aspect_ratio(port);
|
||||
if (ret != SAA_OK) {
|
||||
printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__,
|
||||
|
|
@ -660,55 +477,24 @@ static int saa7164_set_ctrl(struct saa7164_port *port,
|
|||
}
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
|
||||
params->bitrate_mode = ctrl->value;
|
||||
params->bitrate_mode = ctrl->val;
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_B_FRAMES:
|
||||
params->refdist = ctrl->value;
|
||||
params->refdist = ctrl->val;
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK:
|
||||
params->bitrate_peak = ctrl->value;
|
||||
params->bitrate_peak = ctrl->val;
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
|
||||
params->gop_size = ctrl->value;
|
||||
params->gop_size = ctrl->val;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
/* TODO: Update the hardware */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int vidioc_s_ext_ctrls(struct file *file, void *priv,
|
||||
struct v4l2_ext_controls *ctrls)
|
||||
{
|
||||
struct saa7164_encoder_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
int i, err = 0;
|
||||
|
||||
if (ctrls->ctrl_class == V4L2_CTRL_CLASS_MPEG) {
|
||||
for (i = 0; i < ctrls->count; i++) {
|
||||
struct v4l2_ext_control *ctrl = ctrls->controls + i;
|
||||
|
||||
err = saa7164_try_ctrl(ctrl, 0);
|
||||
if (err) {
|
||||
ctrls->error_idx = i;
|
||||
break;
|
||||
}
|
||||
err = saa7164_set_ctrl(port, ctrl);
|
||||
if (err) {
|
||||
ctrls->error_idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return err;
|
||||
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int vidioc_querycap(struct file *file, void *priv,
|
||||
struct v4l2_capability *cap)
|
||||
{
|
||||
|
|
@ -745,145 +531,22 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
|
||||
static int vidioc_fmt_vid_cap(struct file *file, void *priv,
|
||||
struct v4l2_format *f)
|
||||
{
|
||||
struct saa7164_encoder_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
struct saa7164_dev *dev = port->dev;
|
||||
|
||||
f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
|
||||
f->fmt.pix.bytesperline = 0;
|
||||
f->fmt.pix.sizeimage =
|
||||
port->ts_packet_size * port->ts_packet_count;
|
||||
f->fmt.pix.colorspace = 0;
|
||||
f->fmt.pix.sizeimage = SAA7164_SIZEIMAGE;
|
||||
f->fmt.pix.field = V4L2_FIELD_INTERLACED;
|
||||
f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
|
||||
f->fmt.pix.width = port->width;
|
||||
f->fmt.pix.height = port->height;
|
||||
|
||||
dprintk(DBGLVL_ENC, "VIDIOC_G_FMT: w: %d, h: %d\n",
|
||||
port->width, port->height);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
|
||||
struct v4l2_format *f)
|
||||
{
|
||||
struct saa7164_encoder_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
struct saa7164_dev *dev = port->dev;
|
||||
|
||||
f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
|
||||
f->fmt.pix.bytesperline = 0;
|
||||
f->fmt.pix.sizeimage =
|
||||
port->ts_packet_size * port->ts_packet_count;
|
||||
f->fmt.pix.colorspace = 0;
|
||||
dprintk(DBGLVL_ENC, "VIDIOC_TRY_FMT: w: %d, h: %d\n",
|
||||
port->width, port->height);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
|
||||
struct v4l2_format *f)
|
||||
{
|
||||
struct saa7164_encoder_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
struct saa7164_dev *dev = port->dev;
|
||||
|
||||
f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
|
||||
f->fmt.pix.bytesperline = 0;
|
||||
f->fmt.pix.sizeimage =
|
||||
port->ts_packet_size * port->ts_packet_count;
|
||||
f->fmt.pix.colorspace = 0;
|
||||
|
||||
dprintk(DBGLVL_ENC, "VIDIOC_S_FMT: w: %d, h: %d, f: %d\n",
|
||||
f->fmt.pix.width, f->fmt.pix.height, f->fmt.pix.field);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fill_queryctrl(struct saa7164_encoder_params *params,
|
||||
struct v4l2_queryctrl *c)
|
||||
{
|
||||
switch (c->id) {
|
||||
case V4L2_CID_BRIGHTNESS:
|
||||
return v4l2_ctrl_query_fill(c, 0x0, 0xff, 1, 127);
|
||||
case V4L2_CID_CONTRAST:
|
||||
return v4l2_ctrl_query_fill(c, 0x0, 0xff, 1, 66);
|
||||
case V4L2_CID_SATURATION:
|
||||
return v4l2_ctrl_query_fill(c, 0x0, 0xff, 1, 62);
|
||||
case V4L2_CID_HUE:
|
||||
return v4l2_ctrl_query_fill(c, 0x0, 0xff, 1, 128);
|
||||
case V4L2_CID_SHARPNESS:
|
||||
return v4l2_ctrl_query_fill(c, 0x0, 0x0f, 1, 8);
|
||||
case V4L2_CID_MPEG_AUDIO_MUTE:
|
||||
return v4l2_ctrl_query_fill(c, 0x0, 0x01, 1, 0);
|
||||
case V4L2_CID_AUDIO_VOLUME:
|
||||
return v4l2_ctrl_query_fill(c, -83, 24, 1, 20);
|
||||
case V4L2_CID_MPEG_VIDEO_BITRATE:
|
||||
return v4l2_ctrl_query_fill(c,
|
||||
ENCODER_MIN_BITRATE, ENCODER_MAX_BITRATE,
|
||||
100000, ENCODER_DEF_BITRATE);
|
||||
case V4L2_CID_MPEG_STREAM_TYPE:
|
||||
return v4l2_ctrl_query_fill(c,
|
||||
V4L2_MPEG_STREAM_TYPE_MPEG2_PS,
|
||||
V4L2_MPEG_STREAM_TYPE_MPEG2_TS,
|
||||
1, V4L2_MPEG_STREAM_TYPE_MPEG2_PS);
|
||||
case V4L2_CID_MPEG_VIDEO_ASPECT:
|
||||
return v4l2_ctrl_query_fill(c,
|
||||
V4L2_MPEG_VIDEO_ASPECT_1x1,
|
||||
V4L2_MPEG_VIDEO_ASPECT_221x100,
|
||||
1, V4L2_MPEG_VIDEO_ASPECT_4x3);
|
||||
case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
|
||||
return v4l2_ctrl_query_fill(c, 1, 255, 1, 15);
|
||||
case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
|
||||
return v4l2_ctrl_query_fill(c,
|
||||
V4L2_MPEG_VIDEO_BITRATE_MODE_VBR,
|
||||
V4L2_MPEG_VIDEO_BITRATE_MODE_CBR,
|
||||
1, V4L2_MPEG_VIDEO_BITRATE_MODE_VBR);
|
||||
case V4L2_CID_MPEG_VIDEO_B_FRAMES:
|
||||
return v4l2_ctrl_query_fill(c,
|
||||
1, 3, 1, 1);
|
||||
case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK:
|
||||
return v4l2_ctrl_query_fill(c,
|
||||
ENCODER_MIN_BITRATE, ENCODER_MAX_BITRATE,
|
||||
100000, ENCODER_DEF_BITRATE);
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
static int vidioc_queryctrl(struct file *file, void *priv,
|
||||
struct v4l2_queryctrl *c)
|
||||
{
|
||||
struct saa7164_encoder_fh *fh = priv;
|
||||
struct saa7164_port *port = fh->port;
|
||||
int i, next;
|
||||
u32 id = c->id;
|
||||
|
||||
memset(c, 0, sizeof(*c));
|
||||
|
||||
next = !!(id & V4L2_CTRL_FLAG_NEXT_CTRL);
|
||||
c->id = id & ~V4L2_CTRL_FLAG_NEXT_CTRL;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(saa7164_v4l2_ctrls); i++) {
|
||||
if (next) {
|
||||
if (c->id < saa7164_v4l2_ctrls[i])
|
||||
c->id = saa7164_v4l2_ctrls[i];
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c->id == saa7164_v4l2_ctrls[i])
|
||||
return fill_queryctrl(&port->encoder_params, c);
|
||||
|
||||
if (c->id < saa7164_v4l2_ctrls[i])
|
||||
break;
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int saa7164_encoder_stop_port(struct saa7164_port *port)
|
||||
{
|
||||
struct saa7164_dev *dev = port->dev;
|
||||
|
|
@ -1084,8 +747,10 @@ static int fops_open(struct file *file)
|
|||
if (NULL == fh)
|
||||
return -ENOMEM;
|
||||
|
||||
file->private_data = fh;
|
||||
fh->port = port;
|
||||
v4l2_fh_init(&fh->fh, video_devdata(file));
|
||||
v4l2_fh_add(&fh->fh);
|
||||
file->private_data = fh;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1106,7 +771,8 @@ static int fops_release(struct file *file)
|
|||
}
|
||||
}
|
||||
|
||||
file->private_data = NULL;
|
||||
v4l2_fh_del(&fh->fh);
|
||||
v4l2_fh_exit(&fh->fh);
|
||||
kfree(fh);
|
||||
|
||||
return 0;
|
||||
|
|
@ -1250,10 +916,11 @@ err:
|
|||
|
||||
static unsigned int fops_poll(struct file *file, poll_table *wait)
|
||||
{
|
||||
unsigned long req_events = poll_requested_events(wait);
|
||||
struct saa7164_encoder_fh *fh =
|
||||
(struct saa7164_encoder_fh *)file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
unsigned int mask = 0;
|
||||
unsigned int mask = v4l2_ctrl_poll(file, wait);
|
||||
|
||||
port->last_poll_msecs_diff = port->last_poll_msecs;
|
||||
port->last_poll_msecs = jiffies_to_msecs(jiffies);
|
||||
|
|
@ -1263,26 +930,18 @@ static unsigned int fops_poll(struct file *file, poll_table *wait)
|
|||
saa7164_histogram_update(&port->poll_interval,
|
||||
port->last_poll_msecs_diff);
|
||||
|
||||
if (!video_is_registered(port->v4l_device))
|
||||
return -EIO;
|
||||
if (!(req_events & (POLLIN | POLLRDNORM)))
|
||||
return mask;
|
||||
|
||||
if (atomic_cmpxchg(&fh->v4l_reading, 0, 1) == 0) {
|
||||
if (atomic_inc_return(&port->v4l_reader_count) == 1) {
|
||||
if (saa7164_encoder_initialize(port) < 0)
|
||||
return -EINVAL;
|
||||
return mask | POLLERR;
|
||||
saa7164_encoder_start_streaming(port);
|
||||
msleep(200);
|
||||
}
|
||||
}
|
||||
|
||||
/* blocking wait for buffer */
|
||||
if ((file->f_flags & O_NONBLOCK) == 0) {
|
||||
if (wait_event_interruptible(port->wait_read,
|
||||
saa7164_enc_next_buf(port))) {
|
||||
return -ERESTARTSYS;
|
||||
}
|
||||
}
|
||||
|
||||
/* Pull the first buffer from the used list */
|
||||
if (!list_empty(&port->list_buf_used.list))
|
||||
mask |= POLLIN | POLLRDNORM;
|
||||
|
|
@ -1290,6 +949,10 @@ static unsigned int fops_poll(struct file *file, poll_table *wait)
|
|||
return mask;
|
||||
}
|
||||
|
||||
static const struct v4l2_ctrl_ops saa7164_ctrl_ops = {
|
||||
.s_ctrl = saa7164_s_ctrl,
|
||||
};
|
||||
|
||||
static const struct v4l2_file_operations mpeg_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = fops_open,
|
||||
|
|
@ -1302,24 +965,21 @@ static const struct v4l2_file_operations mpeg_fops = {
|
|||
static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
|
||||
.vidioc_s_std = vidioc_s_std,
|
||||
.vidioc_g_std = vidioc_g_std,
|
||||
.vidioc_enum_input = vidioc_enum_input,
|
||||
.vidioc_enum_input = saa7164_enum_input,
|
||||
.vidioc_g_input = vidioc_g_input,
|
||||
.vidioc_s_input = vidioc_s_input,
|
||||
.vidioc_g_tuner = vidioc_g_tuner,
|
||||
.vidioc_s_tuner = vidioc_s_tuner,
|
||||
.vidioc_g_tuner = saa7164_g_tuner,
|
||||
.vidioc_s_tuner = saa7164_s_tuner,
|
||||
.vidioc_g_frequency = vidioc_g_frequency,
|
||||
.vidioc_s_frequency = vidioc_s_frequency,
|
||||
.vidioc_s_ctrl = vidioc_s_ctrl,
|
||||
.vidioc_g_ctrl = vidioc_g_ctrl,
|
||||
.vidioc_querycap = vidioc_querycap,
|
||||
.vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
|
||||
.vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap,
|
||||
.vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap,
|
||||
.vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap,
|
||||
.vidioc_g_ext_ctrls = vidioc_g_ext_ctrls,
|
||||
.vidioc_s_ext_ctrls = vidioc_s_ext_ctrls,
|
||||
.vidioc_try_ext_ctrls = vidioc_try_ext_ctrls,
|
||||
.vidioc_queryctrl = vidioc_queryctrl,
|
||||
.vidioc_g_fmt_vid_cap = vidioc_fmt_vid_cap,
|
||||
.vidioc_try_fmt_vid_cap = vidioc_fmt_vid_cap,
|
||||
.vidioc_s_fmt_vid_cap = vidioc_fmt_vid_cap,
|
||||
.vidioc_log_status = v4l2_ctrl_log_status,
|
||||
.vidioc_subscribe_event = v4l2_ctrl_subscribe_event,
|
||||
.vidioc_unsubscribe_event = v4l2_event_unsubscribe,
|
||||
};
|
||||
|
||||
static struct video_device saa7164_mpeg_template = {
|
||||
|
|
@ -1357,6 +1017,7 @@ static struct video_device *saa7164_encoder_alloc(
|
|||
int saa7164_encoder_register(struct saa7164_port *port)
|
||||
{
|
||||
struct saa7164_dev *dev = port->dev;
|
||||
struct v4l2_ctrl_handler *hdl = &port->ctrl_handler;
|
||||
int result = -ENODEV;
|
||||
|
||||
dprintk(DBGLVL_ENC, "%s()\n", __func__);
|
||||
|
|
@ -1381,19 +1042,52 @@ int saa7164_encoder_register(struct saa7164_port *port)
|
|||
port->video_format = EU_VIDEO_FORMAT_MPEG_2;
|
||||
port->audio_format = 0;
|
||||
port->video_resolution = 0;
|
||||
port->ctl_brightness = 127;
|
||||
port->ctl_contrast = 66;
|
||||
port->ctl_hue = 128;
|
||||
port->ctl_saturation = 62;
|
||||
port->ctl_sharpness = 8;
|
||||
port->encoder_params.bitrate = ENCODER_DEF_BITRATE;
|
||||
port->encoder_params.bitrate_peak = ENCODER_DEF_BITRATE;
|
||||
port->encoder_params.bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_CBR;
|
||||
port->encoder_params.stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_PS;
|
||||
port->encoder_params.ctl_mute = 0;
|
||||
port->encoder_params.ctl_aspect = V4L2_MPEG_VIDEO_ASPECT_4x3;
|
||||
port->encoder_params.refdist = 1;
|
||||
port->encoder_params.gop_size = SAA7164_ENCODER_DEFAULT_GOP_SIZE;
|
||||
port->freq = SAA7164_TV_MIN_FREQ;
|
||||
|
||||
v4l2_ctrl_handler_init(hdl, 14);
|
||||
v4l2_ctrl_new_std(hdl, &saa7164_ctrl_ops,
|
||||
V4L2_CID_BRIGHTNESS, 0, 255, 1, 127);
|
||||
v4l2_ctrl_new_std(hdl, &saa7164_ctrl_ops,
|
||||
V4L2_CID_CONTRAST, 0, 255, 1, 66);
|
||||
v4l2_ctrl_new_std(hdl, &saa7164_ctrl_ops,
|
||||
V4L2_CID_SATURATION, 0, 255, 1, 62);
|
||||
v4l2_ctrl_new_std(hdl, &saa7164_ctrl_ops,
|
||||
V4L2_CID_HUE, 0, 255, 1, 128);
|
||||
v4l2_ctrl_new_std(hdl, &saa7164_ctrl_ops,
|
||||
V4L2_CID_SHARPNESS, 0x0, 0x0f, 1, 8);
|
||||
v4l2_ctrl_new_std(hdl, &saa7164_ctrl_ops,
|
||||
V4L2_CID_MPEG_AUDIO_MUTE, 0x0, 0x01, 1, 0);
|
||||
v4l2_ctrl_new_std(hdl, &saa7164_ctrl_ops,
|
||||
V4L2_CID_AUDIO_VOLUME, -83, 24, 1, 20);
|
||||
v4l2_ctrl_new_std(hdl, &saa7164_ctrl_ops,
|
||||
V4L2_CID_MPEG_VIDEO_BITRATE,
|
||||
ENCODER_MIN_BITRATE, ENCODER_MAX_BITRATE,
|
||||
100000, ENCODER_DEF_BITRATE);
|
||||
v4l2_ctrl_new_std_menu(hdl, &saa7164_ctrl_ops,
|
||||
V4L2_CID_MPEG_STREAM_TYPE,
|
||||
V4L2_MPEG_STREAM_TYPE_MPEG2_TS, 0,
|
||||
V4L2_MPEG_STREAM_TYPE_MPEG2_PS);
|
||||
v4l2_ctrl_new_std_menu(hdl, &saa7164_ctrl_ops,
|
||||
V4L2_CID_MPEG_VIDEO_ASPECT,
|
||||
V4L2_MPEG_VIDEO_ASPECT_221x100, 0,
|
||||
V4L2_MPEG_VIDEO_ASPECT_4x3);
|
||||
v4l2_ctrl_new_std(hdl, &saa7164_ctrl_ops,
|
||||
V4L2_CID_MPEG_VIDEO_GOP_SIZE, 1, 255, 1, 15);
|
||||
v4l2_ctrl_new_std_menu(hdl, &saa7164_ctrl_ops,
|
||||
V4L2_CID_MPEG_VIDEO_BITRATE_MODE,
|
||||
V4L2_MPEG_VIDEO_BITRATE_MODE_CBR, 0,
|
||||
V4L2_MPEG_VIDEO_BITRATE_MODE_VBR);
|
||||
v4l2_ctrl_new_std(hdl, &saa7164_ctrl_ops,
|
||||
V4L2_CID_MPEG_VIDEO_B_FRAMES, 1, 3, 1, 1);
|
||||
v4l2_ctrl_new_std(hdl, &saa7164_ctrl_ops,
|
||||
V4L2_CID_MPEG_VIDEO_BITRATE_PEAK,
|
||||
ENCODER_MIN_BITRATE, ENCODER_MAX_BITRATE,
|
||||
100000, ENCODER_DEF_BITRATE);
|
||||
if (hdl->error) {
|
||||
result = hdl->error;
|
||||
goto failed;
|
||||
}
|
||||
|
||||
port->std = V4L2_STD_NTSC_M;
|
||||
|
||||
if (port->encodernorm.id & V4L2_STD_525_60)
|
||||
|
|
@ -1412,6 +1106,8 @@ int saa7164_encoder_register(struct saa7164_port *port)
|
|||
goto failed;
|
||||
}
|
||||
|
||||
port->v4l_device->ctrl_handler = hdl;
|
||||
v4l2_ctrl_handler_setup(hdl);
|
||||
video_set_drvdata(port->v4l_device, port);
|
||||
result = video_register_device(port->v4l_device,
|
||||
VFL_TYPE_GRABBER, -1);
|
||||
|
|
@ -1466,6 +1162,7 @@ void saa7164_encoder_unregister(struct saa7164_port *port)
|
|||
|
||||
port->v4l_device = NULL;
|
||||
}
|
||||
v4l2_ctrl_handler_free(&port->ctrl_handler);
|
||||
|
||||
dprintk(DBGLVL_ENC, "%s(port=%d) done\n", __func__, port->nr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,20 +21,6 @@
|
|||
|
||||
#include "saa7164.h"
|
||||
|
||||
static struct saa7164_tvnorm saa7164_tvnorms[] = {
|
||||
{
|
||||
.name = "NTSC-M",
|
||||
.id = V4L2_STD_NTSC_M,
|
||||
}, {
|
||||
.name = "NTSC-JP",
|
||||
.id = V4L2_STD_NTSC_M_JP,
|
||||
}
|
||||
};
|
||||
|
||||
static const u32 saa7164_v4l2_ctrls[] = {
|
||||
0
|
||||
};
|
||||
|
||||
/* Take the encoder configuration from the port struct and
|
||||
* flush it to the hardware.
|
||||
*/
|
||||
|
|
@ -43,23 +29,13 @@ static void saa7164_vbi_configure(struct saa7164_port *port)
|
|||
struct saa7164_dev *dev = port->dev;
|
||||
dprintk(DBGLVL_VBI, "%s()\n", __func__);
|
||||
|
||||
port->vbi_params.width = port->width;
|
||||
port->vbi_params.height = port->height;
|
||||
port->vbi_params.width = port->enc_port->width;
|
||||
port->vbi_params.height = port->enc_port->height;
|
||||
port->vbi_params.is_50hz =
|
||||
(port->encodernorm.id & V4L2_STD_625_50) != 0;
|
||||
(port->enc_port->encodernorm.id & V4L2_STD_625_50) != 0;
|
||||
|
||||
/* Set up the DIF (enable it) for analog mode by default */
|
||||
saa7164_api_initialize_dif(port);
|
||||
|
||||
/* Configure the correct video standard */
|
||||
#if 0
|
||||
saa7164_api_configure_dif(port, port->encodernorm.id);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* Ensure the audio decoder is correct configured */
|
||||
saa7164_api_set_audio_std(port);
|
||||
#endif
|
||||
dprintk(DBGLVL_VBI, "%s() ends\n", __func__);
|
||||
}
|
||||
|
||||
|
|
@ -186,468 +162,50 @@ static int saa7164_vbi_initialize(struct saa7164_port *port)
|
|||
static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id id)
|
||||
{
|
||||
struct saa7164_vbi_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
struct saa7164_dev *dev = port->dev;
|
||||
unsigned int i;
|
||||
|
||||
dprintk(DBGLVL_VBI, "%s(id=0x%x)\n", __func__, (u32)id);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(saa7164_tvnorms); i++) {
|
||||
if (id & saa7164_tvnorms[i].id)
|
||||
break;
|
||||
}
|
||||
if (i == ARRAY_SIZE(saa7164_tvnorms))
|
||||
return -EINVAL;
|
||||
|
||||
port->encodernorm = saa7164_tvnorms[i];
|
||||
port->std = id;
|
||||
|
||||
/* Update the audio decoder while is not running in
|
||||
* auto detect mode.
|
||||
*/
|
||||
saa7164_api_set_audio_std(port);
|
||||
|
||||
dprintk(DBGLVL_VBI, "%s(id=0x%x) OK\n", __func__, (u32)id);
|
||||
|
||||
return 0;
|
||||
return saa7164_s_std(fh->port->enc_port, id);
|
||||
}
|
||||
|
||||
static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *id)
|
||||
{
|
||||
struct saa7164_encoder_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
|
||||
*id = port->std;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_enum_input(struct file *file, void *priv,
|
||||
struct v4l2_input *i)
|
||||
{
|
||||
int n;
|
||||
|
||||
char *inputs[] = { "tuner", "composite", "svideo", "aux",
|
||||
"composite 2", "svideo 2", "aux 2" };
|
||||
|
||||
if (i->index >= 7)
|
||||
return -EINVAL;
|
||||
|
||||
strcpy(i->name, inputs[i->index]);
|
||||
|
||||
if (i->index == 0)
|
||||
i->type = V4L2_INPUT_TYPE_TUNER;
|
||||
else
|
||||
i->type = V4L2_INPUT_TYPE_CAMERA;
|
||||
|
||||
for (n = 0; n < ARRAY_SIZE(saa7164_tvnorms); n++)
|
||||
i->std |= saa7164_tvnorms[n].id;
|
||||
|
||||
return 0;
|
||||
return saa7164_g_std(fh->port->enc_port, id);
|
||||
}
|
||||
|
||||
static int vidioc_g_input(struct file *file, void *priv, unsigned int *i)
|
||||
{
|
||||
struct saa7164_vbi_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
struct saa7164_dev *dev = port->dev;
|
||||
|
||||
if (saa7164_api_get_videomux(port) != SAA_OK)
|
||||
return -EIO;
|
||||
|
||||
*i = (port->mux_input - 1);
|
||||
|
||||
dprintk(DBGLVL_VBI, "%s() input=%d\n", __func__, *i);
|
||||
|
||||
return 0;
|
||||
return saa7164_g_input(fh->port->enc_port, i);
|
||||
}
|
||||
|
||||
static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
|
||||
{
|
||||
struct saa7164_vbi_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
struct saa7164_dev *dev = port->dev;
|
||||
|
||||
dprintk(DBGLVL_VBI, "%s() input=%d\n", __func__, i);
|
||||
|
||||
if (i >= 7)
|
||||
return -EINVAL;
|
||||
|
||||
port->mux_input = i + 1;
|
||||
|
||||
if (saa7164_api_set_videomux(port) != SAA_OK)
|
||||
return -EIO;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_g_tuner(struct file *file, void *priv,
|
||||
struct v4l2_tuner *t)
|
||||
{
|
||||
struct saa7164_vbi_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
struct saa7164_dev *dev = port->dev;
|
||||
|
||||
if (0 != t->index)
|
||||
return -EINVAL;
|
||||
|
||||
strcpy(t->name, "tuner");
|
||||
t->type = V4L2_TUNER_ANALOG_TV;
|
||||
t->capability = V4L2_TUNER_CAP_NORM | V4L2_TUNER_CAP_STEREO;
|
||||
|
||||
dprintk(DBGLVL_VBI, "VIDIOC_G_TUNER: tuner type %d\n", t->type);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_s_tuner(struct file *file, void *priv,
|
||||
const struct v4l2_tuner *t)
|
||||
{
|
||||
/* Update the A/V core */
|
||||
return 0;
|
||||
return saa7164_s_input(fh->port->enc_port, i);
|
||||
}
|
||||
|
||||
static int vidioc_g_frequency(struct file *file, void *priv,
|
||||
struct v4l2_frequency *f)
|
||||
{
|
||||
struct saa7164_vbi_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
|
||||
f->type = V4L2_TUNER_ANALOG_TV;
|
||||
f->frequency = port->freq;
|
||||
|
||||
return 0;
|
||||
return saa7164_g_frequency(fh->port->enc_port, f);
|
||||
}
|
||||
|
||||
static int vidioc_s_frequency(struct file *file, void *priv,
|
||||
const struct v4l2_frequency *f)
|
||||
{
|
||||
struct saa7164_vbi_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
struct saa7164_dev *dev = port->dev;
|
||||
struct saa7164_port *tsport;
|
||||
struct dvb_frontend *fe;
|
||||
|
||||
/* TODO: Pull this for the std */
|
||||
struct analog_parameters params = {
|
||||
.mode = V4L2_TUNER_ANALOG_TV,
|
||||
.audmode = V4L2_TUNER_MODE_STEREO,
|
||||
.std = port->encodernorm.id,
|
||||
.frequency = f->frequency
|
||||
};
|
||||
|
||||
/* Stop the encoder */
|
||||
dprintk(DBGLVL_VBI, "%s() frequency=%d tuner=%d\n", __func__,
|
||||
f->frequency, f->tuner);
|
||||
|
||||
if (f->tuner != 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (f->type != V4L2_TUNER_ANALOG_TV)
|
||||
return -EINVAL;
|
||||
|
||||
port->freq = f->frequency;
|
||||
|
||||
/* Update the hardware */
|
||||
if (port->nr == SAA7164_PORT_VBI1)
|
||||
tsport = &dev->ports[SAA7164_PORT_TS1];
|
||||
else
|
||||
if (port->nr == SAA7164_PORT_VBI2)
|
||||
tsport = &dev->ports[SAA7164_PORT_TS2];
|
||||
else
|
||||
BUG();
|
||||
|
||||
fe = tsport->dvb.frontend;
|
||||
|
||||
if (fe && fe->ops.tuner_ops.set_analog_params)
|
||||
fe->ops.tuner_ops.set_analog_params(fe, ¶ms);
|
||||
else
|
||||
printk(KERN_ERR "%s() No analog tuner, aborting\n", __func__);
|
||||
|
||||
saa7164_vbi_initialize(port);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_g_ctrl(struct file *file, void *priv,
|
||||
struct v4l2_control *ctl)
|
||||
{
|
||||
struct saa7164_vbi_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
struct saa7164_dev *dev = port->dev;
|
||||
|
||||
dprintk(DBGLVL_VBI, "%s(id=%d, value=%d)\n", __func__,
|
||||
ctl->id, ctl->value);
|
||||
|
||||
switch (ctl->id) {
|
||||
case V4L2_CID_BRIGHTNESS:
|
||||
ctl->value = port->ctl_brightness;
|
||||
break;
|
||||
case V4L2_CID_CONTRAST:
|
||||
ctl->value = port->ctl_contrast;
|
||||
break;
|
||||
case V4L2_CID_SATURATION:
|
||||
ctl->value = port->ctl_saturation;
|
||||
break;
|
||||
case V4L2_CID_HUE:
|
||||
ctl->value = port->ctl_hue;
|
||||
break;
|
||||
case V4L2_CID_SHARPNESS:
|
||||
ctl->value = port->ctl_sharpness;
|
||||
break;
|
||||
case V4L2_CID_AUDIO_VOLUME:
|
||||
ctl->value = port->ctl_volume;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_s_ctrl(struct file *file, void *priv,
|
||||
struct v4l2_control *ctl)
|
||||
{
|
||||
struct saa7164_vbi_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
struct saa7164_dev *dev = port->dev;
|
||||
int ret = 0;
|
||||
|
||||
dprintk(DBGLVL_VBI, "%s(id=%d, value=%d)\n", __func__,
|
||||
ctl->id, ctl->value);
|
||||
|
||||
switch (ctl->id) {
|
||||
case V4L2_CID_BRIGHTNESS:
|
||||
if ((ctl->value >= 0) && (ctl->value <= 255)) {
|
||||
port->ctl_brightness = ctl->value;
|
||||
saa7164_api_set_usercontrol(port,
|
||||
PU_BRIGHTNESS_CONTROL);
|
||||
} else
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
case V4L2_CID_CONTRAST:
|
||||
if ((ctl->value >= 0) && (ctl->value <= 255)) {
|
||||
port->ctl_contrast = ctl->value;
|
||||
saa7164_api_set_usercontrol(port, PU_CONTRAST_CONTROL);
|
||||
} else
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
case V4L2_CID_SATURATION:
|
||||
if ((ctl->value >= 0) && (ctl->value <= 255)) {
|
||||
port->ctl_saturation = ctl->value;
|
||||
saa7164_api_set_usercontrol(port,
|
||||
PU_SATURATION_CONTROL);
|
||||
} else
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
case V4L2_CID_HUE:
|
||||
if ((ctl->value >= 0) && (ctl->value <= 255)) {
|
||||
port->ctl_hue = ctl->value;
|
||||
saa7164_api_set_usercontrol(port, PU_HUE_CONTROL);
|
||||
} else
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
case V4L2_CID_SHARPNESS:
|
||||
if ((ctl->value >= 0) && (ctl->value <= 255)) {
|
||||
port->ctl_sharpness = ctl->value;
|
||||
saa7164_api_set_usercontrol(port, PU_SHARPNESS_CONTROL);
|
||||
} else
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
case V4L2_CID_AUDIO_VOLUME:
|
||||
if ((ctl->value >= -83) && (ctl->value <= 24)) {
|
||||
port->ctl_volume = ctl->value;
|
||||
saa7164_api_set_audio_volume(port, port->ctl_volume);
|
||||
} else
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
}
|
||||
int ret = saa7164_s_frequency(fh->port->enc_port, f);
|
||||
|
||||
if (ret == 0)
|
||||
saa7164_vbi_initialize(fh->port);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int saa7164_get_ctrl(struct saa7164_port *port,
|
||||
struct v4l2_ext_control *ctrl)
|
||||
{
|
||||
struct saa7164_vbi_params *params = &port->vbi_params;
|
||||
|
||||
switch (ctrl->id) {
|
||||
case V4L2_CID_MPEG_STREAM_TYPE:
|
||||
ctrl->value = params->stream_type;
|
||||
break;
|
||||
case V4L2_CID_MPEG_AUDIO_MUTE:
|
||||
ctrl->value = params->ctl_mute;
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_ASPECT:
|
||||
ctrl->value = params->ctl_aspect;
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_B_FRAMES:
|
||||
ctrl->value = params->refdist;
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
|
||||
ctrl->value = params->gop_size;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_g_ext_ctrls(struct file *file, void *priv,
|
||||
struct v4l2_ext_controls *ctrls)
|
||||
{
|
||||
struct saa7164_vbi_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
int i, err = 0;
|
||||
|
||||
if (ctrls->ctrl_class == V4L2_CTRL_CLASS_MPEG) {
|
||||
for (i = 0; i < ctrls->count; i++) {
|
||||
struct v4l2_ext_control *ctrl = ctrls->controls + i;
|
||||
|
||||
err = saa7164_get_ctrl(port, ctrl);
|
||||
if (err) {
|
||||
ctrls->error_idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return err;
|
||||
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int saa7164_try_ctrl(struct v4l2_ext_control *ctrl, int ac3)
|
||||
{
|
||||
int ret = -EINVAL;
|
||||
|
||||
switch (ctrl->id) {
|
||||
case V4L2_CID_MPEG_STREAM_TYPE:
|
||||
if ((ctrl->value == V4L2_MPEG_STREAM_TYPE_MPEG2_PS) ||
|
||||
(ctrl->value == V4L2_MPEG_STREAM_TYPE_MPEG2_TS))
|
||||
ret = 0;
|
||||
break;
|
||||
case V4L2_CID_MPEG_AUDIO_MUTE:
|
||||
if ((ctrl->value >= 0) &&
|
||||
(ctrl->value <= 1))
|
||||
ret = 0;
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_ASPECT:
|
||||
if ((ctrl->value >= V4L2_MPEG_VIDEO_ASPECT_1x1) &&
|
||||
(ctrl->value <= V4L2_MPEG_VIDEO_ASPECT_221x100))
|
||||
ret = 0;
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
|
||||
if ((ctrl->value >= 0) &&
|
||||
(ctrl->value <= 255))
|
||||
ret = 0;
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_B_FRAMES:
|
||||
if ((ctrl->value >= 1) &&
|
||||
(ctrl->value <= 3))
|
||||
ret = 0;
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int vidioc_try_ext_ctrls(struct file *file, void *priv,
|
||||
struct v4l2_ext_controls *ctrls)
|
||||
{
|
||||
int i, err = 0;
|
||||
|
||||
if (ctrls->ctrl_class == V4L2_CTRL_CLASS_MPEG) {
|
||||
for (i = 0; i < ctrls->count; i++) {
|
||||
struct v4l2_ext_control *ctrl = ctrls->controls + i;
|
||||
|
||||
err = saa7164_try_ctrl(ctrl, 0);
|
||||
if (err) {
|
||||
ctrls->error_idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int saa7164_set_ctrl(struct saa7164_port *port,
|
||||
struct v4l2_ext_control *ctrl)
|
||||
{
|
||||
struct saa7164_vbi_params *params = &port->vbi_params;
|
||||
int ret = 0;
|
||||
|
||||
switch (ctrl->id) {
|
||||
case V4L2_CID_MPEG_STREAM_TYPE:
|
||||
params->stream_type = ctrl->value;
|
||||
break;
|
||||
case V4L2_CID_MPEG_AUDIO_MUTE:
|
||||
params->ctl_mute = ctrl->value;
|
||||
ret = saa7164_api_audio_mute(port, params->ctl_mute);
|
||||
if (ret != SAA_OK) {
|
||||
printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__,
|
||||
ret);
|
||||
ret = -EIO;
|
||||
}
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_ASPECT:
|
||||
params->ctl_aspect = ctrl->value;
|
||||
ret = saa7164_api_set_aspect_ratio(port);
|
||||
if (ret != SAA_OK) {
|
||||
printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__,
|
||||
ret);
|
||||
ret = -EIO;
|
||||
}
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_B_FRAMES:
|
||||
params->refdist = ctrl->value;
|
||||
break;
|
||||
case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
|
||||
params->gop_size = ctrl->value;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* TODO: Update the hardware */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int vidioc_s_ext_ctrls(struct file *file, void *priv,
|
||||
struct v4l2_ext_controls *ctrls)
|
||||
{
|
||||
struct saa7164_vbi_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
int i, err = 0;
|
||||
|
||||
if (ctrls->ctrl_class == V4L2_CTRL_CLASS_MPEG) {
|
||||
for (i = 0; i < ctrls->count; i++) {
|
||||
struct v4l2_ext_control *ctrl = ctrls->controls + i;
|
||||
|
||||
err = saa7164_try_ctrl(ctrl, 0);
|
||||
if (err) {
|
||||
ctrls->error_idx = i;
|
||||
break;
|
||||
}
|
||||
err = saa7164_set_ctrl(port, ctrl);
|
||||
if (err) {
|
||||
ctrls->error_idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return err;
|
||||
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int vidioc_querycap(struct file *file, void *priv,
|
||||
struct v4l2_capability *cap)
|
||||
{
|
||||
|
|
@ -672,144 +230,6 @@ static int vidioc_querycap(struct file *file, void *priv,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
|
||||
struct v4l2_fmtdesc *f)
|
||||
{
|
||||
if (f->index != 0)
|
||||
return -EINVAL;
|
||||
|
||||
strlcpy(f->description, "VBI", sizeof(f->description));
|
||||
f->pixelformat = V4L2_PIX_FMT_MPEG;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
|
||||
struct v4l2_format *f)
|
||||
{
|
||||
struct saa7164_vbi_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
struct saa7164_dev *dev = port->dev;
|
||||
|
||||
f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
|
||||
f->fmt.pix.bytesperline = 0;
|
||||
f->fmt.pix.sizeimage =
|
||||
port->ts_packet_size * port->ts_packet_count;
|
||||
f->fmt.pix.colorspace = 0;
|
||||
f->fmt.pix.width = port->width;
|
||||
f->fmt.pix.height = port->height;
|
||||
|
||||
dprintk(DBGLVL_VBI, "VIDIOC_G_FMT: w: %d, h: %d\n",
|
||||
port->width, port->height);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
|
||||
struct v4l2_format *f)
|
||||
{
|
||||
struct saa7164_vbi_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
struct saa7164_dev *dev = port->dev;
|
||||
|
||||
f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
|
||||
f->fmt.pix.bytesperline = 0;
|
||||
f->fmt.pix.sizeimage =
|
||||
port->ts_packet_size * port->ts_packet_count;
|
||||
f->fmt.pix.colorspace = 0;
|
||||
dprintk(DBGLVL_VBI, "VIDIOC_TRY_FMT: w: %d, h: %d\n",
|
||||
port->width, port->height);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
|
||||
struct v4l2_format *f)
|
||||
{
|
||||
struct saa7164_vbi_fh *fh = file->private_data;
|
||||
struct saa7164_port *port = fh->port;
|
||||
struct saa7164_dev *dev = port->dev;
|
||||
|
||||
f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
|
||||
f->fmt.pix.bytesperline = 0;
|
||||
f->fmt.pix.sizeimage =
|
||||
port->ts_packet_size * port->ts_packet_count;
|
||||
f->fmt.pix.colorspace = 0;
|
||||
|
||||
dprintk(DBGLVL_VBI, "VIDIOC_S_FMT: w: %d, h: %d, f: %d\n",
|
||||
f->fmt.pix.width, f->fmt.pix.height, f->fmt.pix.field);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fill_queryctrl(struct saa7164_vbi_params *params,
|
||||
struct v4l2_queryctrl *c)
|
||||
{
|
||||
switch (c->id) {
|
||||
case V4L2_CID_BRIGHTNESS:
|
||||
return v4l2_ctrl_query_fill(c, 0x0, 0xff, 1, 127);
|
||||
case V4L2_CID_CONTRAST:
|
||||
return v4l2_ctrl_query_fill(c, 0x0, 0xff, 1, 66);
|
||||
case V4L2_CID_SATURATION:
|
||||
return v4l2_ctrl_query_fill(c, 0x0, 0xff, 1, 62);
|
||||
case V4L2_CID_HUE:
|
||||
return v4l2_ctrl_query_fill(c, 0x0, 0xff, 1, 128);
|
||||
case V4L2_CID_SHARPNESS:
|
||||
return v4l2_ctrl_query_fill(c, 0x0, 0x0f, 1, 8);
|
||||
case V4L2_CID_MPEG_AUDIO_MUTE:
|
||||
return v4l2_ctrl_query_fill(c, 0x0, 0x01, 1, 0);
|
||||
case V4L2_CID_AUDIO_VOLUME:
|
||||
return v4l2_ctrl_query_fill(c, -83, 24, 1, 20);
|
||||
case V4L2_CID_MPEG_STREAM_TYPE:
|
||||
return v4l2_ctrl_query_fill(c,
|
||||
V4L2_MPEG_STREAM_TYPE_MPEG2_PS,
|
||||
V4L2_MPEG_STREAM_TYPE_MPEG2_TS,
|
||||
1, V4L2_MPEG_STREAM_TYPE_MPEG2_PS);
|
||||
case V4L2_CID_MPEG_VIDEO_ASPECT:
|
||||
return v4l2_ctrl_query_fill(c,
|
||||
V4L2_MPEG_VIDEO_ASPECT_1x1,
|
||||
V4L2_MPEG_VIDEO_ASPECT_221x100,
|
||||
1, V4L2_MPEG_VIDEO_ASPECT_4x3);
|
||||
case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
|
||||
return v4l2_ctrl_query_fill(c, 1, 255, 1, 15);
|
||||
case V4L2_CID_MPEG_VIDEO_B_FRAMES:
|
||||
return v4l2_ctrl_query_fill(c,
|
||||
1, 3, 1, 1);
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
static int vidioc_queryctrl(struct file *file, void *priv,
|
||||
struct v4l2_queryctrl *c)
|
||||
{
|
||||
struct saa7164_vbi_fh *fh = priv;
|
||||
struct saa7164_port *port = fh->port;
|
||||
int i, next;
|
||||
u32 id = c->id;
|
||||
|
||||
memset(c, 0, sizeof(*c));
|
||||
|
||||
next = !!(id & V4L2_CTRL_FLAG_NEXT_CTRL);
|
||||
c->id = id & ~V4L2_CTRL_FLAG_NEXT_CTRL;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(saa7164_v4l2_ctrls); i++) {
|
||||
if (next) {
|
||||
if (c->id < saa7164_v4l2_ctrls[i])
|
||||
c->id = saa7164_v4l2_ctrls[i];
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c->id == saa7164_v4l2_ctrls[i])
|
||||
return fill_queryctrl(&port->vbi_params, c);
|
||||
|
||||
if (c->id < saa7164_v4l2_ctrls[i])
|
||||
break;
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int saa7164_vbi_stop_port(struct saa7164_port *port)
|
||||
{
|
||||
struct saa7164_dev *dev = port->dev;
|
||||
|
|
@ -999,7 +419,6 @@ static int saa7164_vbi_fmt(struct file *file, void *priv,
|
|||
struct v4l2_format *f)
|
||||
{
|
||||
/* ntsc */
|
||||
f->fmt.vbi.samples_per_line = 1600;
|
||||
f->fmt.vbi.samples_per_line = 1440;
|
||||
f->fmt.vbi.sampling_rate = 27000000;
|
||||
f->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY;
|
||||
|
|
@ -1009,6 +428,7 @@ static int saa7164_vbi_fmt(struct file *file, void *priv,
|
|||
f->fmt.vbi.count[0] = 18;
|
||||
f->fmt.vbi.start[1] = 263 + 10 + 1;
|
||||
f->fmt.vbi.count[1] = 18;
|
||||
memset(f->fmt.vbi.reserved, 0, sizeof(f->fmt.vbi.reserved));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1031,8 +451,10 @@ static int fops_open(struct file *file)
|
|||
if (NULL == fh)
|
||||
return -ENOMEM;
|
||||
|
||||
file->private_data = fh;
|
||||
fh->port = port;
|
||||
v4l2_fh_init(&fh->fh, video_devdata(file));
|
||||
v4l2_fh_add(&fh->fh);
|
||||
file->private_data = fh;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1053,7 +475,8 @@ static int fops_release(struct file *file)
|
|||
}
|
||||
}
|
||||
|
||||
file->private_data = NULL;
|
||||
v4l2_fh_del(&fh->fh);
|
||||
v4l2_fh_exit(&fh->fh);
|
||||
kfree(fh);
|
||||
|
||||
return 0;
|
||||
|
|
@ -1248,24 +671,14 @@ static const struct v4l2_file_operations vbi_fops = {
|
|||
static const struct v4l2_ioctl_ops vbi_ioctl_ops = {
|
||||
.vidioc_s_std = vidioc_s_std,
|
||||
.vidioc_g_std = vidioc_g_std,
|
||||
.vidioc_enum_input = vidioc_enum_input,
|
||||
.vidioc_enum_input = saa7164_enum_input,
|
||||
.vidioc_g_input = vidioc_g_input,
|
||||
.vidioc_s_input = vidioc_s_input,
|
||||
.vidioc_g_tuner = vidioc_g_tuner,
|
||||
.vidioc_s_tuner = vidioc_s_tuner,
|
||||
.vidioc_g_tuner = saa7164_g_tuner,
|
||||
.vidioc_s_tuner = saa7164_s_tuner,
|
||||
.vidioc_g_frequency = vidioc_g_frequency,
|
||||
.vidioc_s_frequency = vidioc_s_frequency,
|
||||
.vidioc_s_ctrl = vidioc_s_ctrl,
|
||||
.vidioc_g_ctrl = vidioc_g_ctrl,
|
||||
.vidioc_querycap = vidioc_querycap,
|
||||
.vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
|
||||
.vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap,
|
||||
.vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap,
|
||||
.vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap,
|
||||
.vidioc_g_ext_ctrls = vidioc_g_ext_ctrls,
|
||||
.vidioc_s_ext_ctrls = vidioc_s_ext_ctrls,
|
||||
.vidioc_try_ext_ctrls = vidioc_try_ext_ctrls,
|
||||
.vidioc_queryctrl = vidioc_queryctrl,
|
||||
.vidioc_g_fmt_vbi_cap = saa7164_vbi_fmt,
|
||||
.vidioc_try_fmt_vbi_cap = saa7164_vbi_fmt,
|
||||
.vidioc_s_fmt_vbi_cap = saa7164_vbi_fmt,
|
||||
|
|
@ -1335,7 +748,7 @@ int saa7164_vbi_register(struct saa7164_port *port)
|
|||
goto failed;
|
||||
}
|
||||
|
||||
port->std = V4L2_STD_NTSC_M;
|
||||
port->enc_port = &dev->ports[port->nr - 2];
|
||||
video_set_drvdata(port->v4l_device, port);
|
||||
result = video_register_device(port->v4l_device,
|
||||
VFL_TYPE_VBI, -1);
|
||||
|
|
|
|||
|
|
@ -54,8 +54,6 @@
|
|||
|
||||
#include <media/tuner.h>
|
||||
#include <media/tveeprom.h>
|
||||
#include <media/videobuf-dma-sg.h>
|
||||
#include <media/videobuf-dvb.h>
|
||||
#include <dvb_demux.h>
|
||||
#include <dvb_frontend.h>
|
||||
#include <dvb_net.h>
|
||||
|
|
@ -64,6 +62,8 @@
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-ioctl.h>
|
||||
#include <media/v4l2-device.h>
|
||||
#include <media/v4l2-ctrls.h>
|
||||
#include <media/v4l2-event.h>
|
||||
|
||||
#include "saa7164-reg.h"
|
||||
#include "saa7164-types.h"
|
||||
|
|
@ -117,7 +117,11 @@
|
|||
#define DBGLVL_CPU 8192
|
||||
|
||||
#define SAA7164_NORMS \
|
||||
(V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_JP | V4L2_STD_NTSC_443)
|
||||
(V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_JP)
|
||||
|
||||
/* TV frequency range copied from tuner-core.c */
|
||||
#define SAA7164_TV_MIN_FREQ (44U * 16U)
|
||||
#define SAA7164_TV_MAX_FREQ (958U * 16U)
|
||||
|
||||
enum port_t {
|
||||
SAA7164_MPEG_UNDEFINED = 0,
|
||||
|
|
@ -185,11 +189,13 @@ struct saa7164_subid {
|
|||
};
|
||||
|
||||
struct saa7164_encoder_fh {
|
||||
struct v4l2_fh fh;
|
||||
struct saa7164_port *port;
|
||||
atomic_t v4l_reading;
|
||||
};
|
||||
|
||||
struct saa7164_vbi_fh {
|
||||
struct v4l2_fh fh;
|
||||
struct saa7164_port *port;
|
||||
atomic_t v4l_reading;
|
||||
};
|
||||
|
|
@ -381,12 +387,11 @@ struct saa7164_port {
|
|||
/* Encoder */
|
||||
/* Defaults established in saa7164-encoder.c */
|
||||
struct saa7164_tvnorm encodernorm;
|
||||
struct v4l2_ctrl_handler ctrl_handler;
|
||||
v4l2_std_id std;
|
||||
u32 height;
|
||||
u32 width;
|
||||
u32 freq;
|
||||
u32 ts_packet_size;
|
||||
u32 ts_packet_count;
|
||||
u8 mux_input;
|
||||
u8 encoder_profile;
|
||||
u8 video_format;
|
||||
|
|
@ -419,6 +424,7 @@ struct saa7164_port {
|
|||
/* V4L VBI */
|
||||
struct tmComResVBIFormatDescrHeader vbi_fmt_ntsc;
|
||||
struct saa7164_vbi_params vbi_params;
|
||||
struct saa7164_port *enc_port;
|
||||
|
||||
/* Debug */
|
||||
u32 sync_errors;
|
||||
|
|
@ -594,6 +600,16 @@ extern int saa7164_buffer_zero_offsets(struct saa7164_port *port, int i);
|
|||
|
||||
/* ----------------------------------------------------------- */
|
||||
/* saa7164-encoder.c */
|
||||
int saa7164_s_std(struct saa7164_port *port, v4l2_std_id id);
|
||||
int saa7164_g_std(struct saa7164_port *port, v4l2_std_id *id);
|
||||
int saa7164_enum_input(struct file *file, void *priv, struct v4l2_input *i);
|
||||
int saa7164_g_input(struct saa7164_port *port, unsigned int *i);
|
||||
int saa7164_s_input(struct saa7164_port *port, unsigned int i);
|
||||
int saa7164_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t);
|
||||
int saa7164_s_tuner(struct file *file, void *priv, const struct v4l2_tuner *t);
|
||||
int saa7164_g_frequency(struct saa7164_port *port, struct v4l2_frequency *f);
|
||||
int saa7164_s_frequency(struct saa7164_port *port,
|
||||
const struct v4l2_frequency *f);
|
||||
int saa7164_encoder_register(struct saa7164_port *port);
|
||||
void saa7164_encoder_unregister(struct saa7164_port *port);
|
||||
|
||||
|
|
|
|||
|
|
@ -458,11 +458,12 @@ static inline u32 vop_usec(const vop_header *vh)
|
|||
static int solo_fill_jpeg(struct solo_enc_dev *solo_enc,
|
||||
struct vb2_buffer *vb, const vop_header *vh)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct solo_dev *solo_dev = solo_enc->solo_dev;
|
||||
struct sg_table *vbuf = vb2_dma_sg_plane_desc(vb, 0);
|
||||
struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
|
||||
int frame_size;
|
||||
|
||||
vb->v4l2_buf.flags |= V4L2_BUF_FLAG_KEYFRAME;
|
||||
vbuf->flags |= V4L2_BUF_FLAG_KEYFRAME;
|
||||
|
||||
if (vb2_plane_size(vb, 0) < vop_jpeg_size(vh) + solo_enc->jpeg_len)
|
||||
return -EIO;
|
||||
|
|
@ -470,7 +471,7 @@ static int solo_fill_jpeg(struct solo_enc_dev *solo_enc,
|
|||
frame_size = ALIGN(vop_jpeg_size(vh) + solo_enc->jpeg_len, DMA_ALIGN);
|
||||
vb2_set_plane_payload(vb, 0, vop_jpeg_size(vh) + solo_enc->jpeg_len);
|
||||
|
||||
return solo_send_desc(solo_enc, solo_enc->jpeg_len, vbuf,
|
||||
return solo_send_desc(solo_enc, solo_enc->jpeg_len, sgt,
|
||||
vop_jpeg_offset(vh) - SOLO_JPEG_EXT_ADDR(solo_dev),
|
||||
frame_size, SOLO_JPEG_EXT_ADDR(solo_dev),
|
||||
SOLO_JPEG_EXT_SIZE(solo_dev));
|
||||
|
|
@ -479,8 +480,9 @@ static int solo_fill_jpeg(struct solo_enc_dev *solo_enc,
|
|||
static int solo_fill_mpeg(struct solo_enc_dev *solo_enc,
|
||||
struct vb2_buffer *vb, const vop_header *vh)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct solo_dev *solo_dev = solo_enc->solo_dev;
|
||||
struct sg_table *vbuf = vb2_dma_sg_plane_desc(vb, 0);
|
||||
struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
|
||||
int frame_off, frame_size;
|
||||
int skip = 0;
|
||||
|
||||
|
|
@ -488,15 +490,15 @@ static int solo_fill_mpeg(struct solo_enc_dev *solo_enc,
|
|||
return -EIO;
|
||||
|
||||
/* If this is a key frame, add extra header */
|
||||
vb->v4l2_buf.flags &= ~(V4L2_BUF_FLAG_KEYFRAME | V4L2_BUF_FLAG_PFRAME |
|
||||
vbuf->flags &= ~(V4L2_BUF_FLAG_KEYFRAME | V4L2_BUF_FLAG_PFRAME |
|
||||
V4L2_BUF_FLAG_BFRAME);
|
||||
if (!vop_type(vh)) {
|
||||
skip = solo_enc->vop_len;
|
||||
vb->v4l2_buf.flags |= V4L2_BUF_FLAG_KEYFRAME;
|
||||
vbuf->flags |= V4L2_BUF_FLAG_KEYFRAME;
|
||||
vb2_set_plane_payload(vb, 0, vop_mpeg_size(vh) +
|
||||
solo_enc->vop_len);
|
||||
} else {
|
||||
vb->v4l2_buf.flags |= V4L2_BUF_FLAG_PFRAME;
|
||||
vbuf->flags |= V4L2_BUF_FLAG_PFRAME;
|
||||
vb2_set_plane_payload(vb, 0, vop_mpeg_size(vh));
|
||||
}
|
||||
|
||||
|
|
@ -505,7 +507,7 @@ static int solo_fill_mpeg(struct solo_enc_dev *solo_enc,
|
|||
sizeof(*vh)) % SOLO_MP4E_EXT_SIZE(solo_dev);
|
||||
frame_size = ALIGN(vop_mpeg_size(vh) + skip, DMA_ALIGN);
|
||||
|
||||
return solo_send_desc(solo_enc, skip, vbuf, frame_off, frame_size,
|
||||
return solo_send_desc(solo_enc, skip, sgt, frame_off, frame_size,
|
||||
SOLO_MP4E_EXT_ADDR(solo_dev),
|
||||
SOLO_MP4E_EXT_SIZE(solo_dev));
|
||||
}
|
||||
|
|
@ -513,6 +515,7 @@ static int solo_fill_mpeg(struct solo_enc_dev *solo_enc,
|
|||
static int solo_enc_fillbuf(struct solo_enc_dev *solo_enc,
|
||||
struct vb2_buffer *vb, struct solo_enc_buf *enc_buf)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
const vop_header *vh = enc_buf->vh;
|
||||
int ret;
|
||||
|
||||
|
|
@ -527,17 +530,18 @@ static int solo_enc_fillbuf(struct solo_enc_dev *solo_enc,
|
|||
}
|
||||
|
||||
if (!ret) {
|
||||
vb->v4l2_buf.sequence = solo_enc->sequence++;
|
||||
vb->v4l2_buf.timestamp.tv_sec = vop_sec(vh);
|
||||
vb->v4l2_buf.timestamp.tv_usec = vop_usec(vh);
|
||||
vbuf->sequence = solo_enc->sequence++;
|
||||
vbuf->timestamp.tv_sec = vop_sec(vh);
|
||||
vbuf->timestamp.tv_usec = vop_usec(vh);
|
||||
|
||||
/* Check for motion flags */
|
||||
if (solo_is_motion_on(solo_enc) && enc_buf->motion) {
|
||||
struct v4l2_event ev = {
|
||||
.type = V4L2_EVENT_MOTION_DET,
|
||||
.u.motion_det = {
|
||||
.flags = V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ,
|
||||
.frame_sequence = vb->v4l2_buf.sequence,
|
||||
.flags
|
||||
= V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ,
|
||||
.frame_sequence = vbuf->sequence,
|
||||
.region_mask = enc_buf->motion ? 1 : 0,
|
||||
},
|
||||
};
|
||||
|
|
@ -571,7 +575,7 @@ static void solo_enc_handle_one(struct solo_enc_dev *solo_enc,
|
|||
list_del(&vb->list);
|
||||
spin_unlock_irqrestore(&solo_enc->av_lock, flags);
|
||||
|
||||
solo_enc_fillbuf(solo_enc, &vb->vb, enc_buf);
|
||||
solo_enc_fillbuf(solo_enc, &vb->vb.vb2_buf, enc_buf);
|
||||
unlock:
|
||||
mutex_unlock(&solo_enc->lock);
|
||||
}
|
||||
|
|
@ -659,7 +663,7 @@ static int solo_ring_thread(void *data)
|
|||
}
|
||||
|
||||
static int solo_enc_queue_setup(struct vb2_queue *q,
|
||||
const struct v4l2_format *fmt,
|
||||
const void *parg,
|
||||
unsigned int *num_buffers,
|
||||
unsigned int *num_planes, unsigned int sizes[],
|
||||
void *alloc_ctxs[])
|
||||
|
|
@ -678,10 +682,11 @@ static int solo_enc_queue_setup(struct vb2_queue *q,
|
|||
|
||||
static void solo_enc_buf_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct vb2_queue *vq = vb->vb2_queue;
|
||||
struct solo_enc_dev *solo_enc = vb2_get_drv_priv(vq);
|
||||
struct solo_vb2_buf *solo_vb =
|
||||
container_of(vb, struct solo_vb2_buf, vb);
|
||||
container_of(vbuf, struct solo_vb2_buf, vb);
|
||||
|
||||
spin_lock(&solo_enc->av_lock);
|
||||
list_add_tail(&solo_vb->list, &solo_enc->vidq_active);
|
||||
|
|
@ -734,25 +739,26 @@ static void solo_enc_stop_streaming(struct vb2_queue *q)
|
|||
struct solo_vb2_buf, list);
|
||||
|
||||
list_del(&buf->list);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
spin_unlock_irqrestore(&solo_enc->av_lock, flags);
|
||||
}
|
||||
|
||||
static void solo_enc_buf_finish(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct solo_enc_dev *solo_enc = vb2_get_drv_priv(vb->vb2_queue);
|
||||
struct sg_table *vbuf = vb2_dma_sg_plane_desc(vb, 0);
|
||||
struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
|
||||
|
||||
switch (solo_enc->fmt) {
|
||||
case V4L2_PIX_FMT_MPEG4:
|
||||
case V4L2_PIX_FMT_H264:
|
||||
if (vb->v4l2_buf.flags & V4L2_BUF_FLAG_KEYFRAME)
|
||||
sg_copy_from_buffer(vbuf->sgl, vbuf->nents,
|
||||
if (vbuf->flags & V4L2_BUF_FLAG_KEYFRAME)
|
||||
sg_copy_from_buffer(sgt->sgl, sgt->nents,
|
||||
solo_enc->vop, solo_enc->vop_len);
|
||||
break;
|
||||
default: /* V4L2_PIX_FMT_MJPEG */
|
||||
sg_copy_from_buffer(vbuf->sgl, vbuf->nents,
|
||||
sg_copy_from_buffer(sgt->sgl, sgt->nents,
|
||||
solo_enc->jpeg_header, solo_enc->jpeg_len);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include <media/v4l2-ioctl.h>
|
||||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-event.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
#include <media/videobuf2-dma-contig.h>
|
||||
|
||||
#include "solo6x10.h"
|
||||
|
|
@ -191,13 +192,14 @@ static int solo_v4l2_set_ch(struct solo_dev *solo_dev, u8 ch)
|
|||
static void solo_fillbuf(struct solo_dev *solo_dev,
|
||||
struct vb2_buffer *vb)
|
||||
{
|
||||
dma_addr_t vbuf;
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
dma_addr_t addr;
|
||||
unsigned int fdma_addr;
|
||||
int error = -1;
|
||||
int i;
|
||||
|
||||
vbuf = vb2_dma_contig_plane_dma_addr(vb, 0);
|
||||
if (!vbuf)
|
||||
addr = vb2_dma_contig_plane_dma_addr(vb, 0);
|
||||
if (!addr)
|
||||
goto finish_buf;
|
||||
|
||||
if (erase_off(solo_dev)) {
|
||||
|
|
@ -213,7 +215,7 @@ static void solo_fillbuf(struct solo_dev *solo_dev,
|
|||
fdma_addr = SOLO_DISP_EXT_ADDR + (solo_dev->old_write *
|
||||
(SOLO_HW_BPL * solo_vlines(solo_dev)));
|
||||
|
||||
error = solo_p2m_dma_t(solo_dev, 0, vbuf, fdma_addr,
|
||||
error = solo_p2m_dma_t(solo_dev, 0, addr, fdma_addr,
|
||||
solo_bytesperline(solo_dev),
|
||||
solo_vlines(solo_dev), SOLO_HW_BPL);
|
||||
}
|
||||
|
|
@ -222,8 +224,8 @@ finish_buf:
|
|||
if (!error) {
|
||||
vb2_set_plane_payload(vb, 0,
|
||||
solo_vlines(solo_dev) * solo_bytesperline(solo_dev));
|
||||
vb->v4l2_buf.sequence = solo_dev->sequence++;
|
||||
v4l2_get_timestamp(&vb->v4l2_buf.timestamp);
|
||||
vbuf->sequence = solo_dev->sequence++;
|
||||
v4l2_get_timestamp(&vbuf->timestamp);
|
||||
}
|
||||
|
||||
vb2_buffer_done(vb, error ? VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE);
|
||||
|
|
@ -256,7 +258,7 @@ static void solo_thread_try(struct solo_dev *solo_dev)
|
|||
|
||||
spin_unlock(&solo_dev->slock);
|
||||
|
||||
solo_fillbuf(solo_dev, &vb->vb);
|
||||
solo_fillbuf(solo_dev, &vb->vb.vb2_buf);
|
||||
}
|
||||
|
||||
assert_spin_locked(&solo_dev->slock);
|
||||
|
|
@ -311,7 +313,7 @@ static void solo_stop_thread(struct solo_dev *solo_dev)
|
|||
solo_dev->kthread = NULL;
|
||||
}
|
||||
|
||||
static int solo_queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
||||
static int solo_queue_setup(struct vb2_queue *q, const void *parg,
|
||||
unsigned int *num_buffers, unsigned int *num_planes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
|
|
@ -345,10 +347,11 @@ static void solo_stop_streaming(struct vb2_queue *q)
|
|||
|
||||
static void solo_buf_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct vb2_queue *vq = vb->vb2_queue;
|
||||
struct solo_dev *solo_dev = vb2_get_drv_priv(vq);
|
||||
struct solo_vb2_buf *solo_vb =
|
||||
container_of(vb, struct solo_vb2_buf, vb);
|
||||
container_of(vbuf, struct solo_vb2_buf, vb);
|
||||
|
||||
spin_lock(&solo_dev->slock);
|
||||
list_add_tail(&solo_vb->list, &solo_dev->vidq_active);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
#include <media/v4l2-dev.h>
|
||||
#include <media/v4l2-device.h>
|
||||
#include <media/v4l2-ctrls.h>
|
||||
#include <media/videobuf2-core.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
|
||||
#include "solo6x10-regs.h"
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ struct solo_p2m_dev {
|
|||
#define OSD_TEXT_MAX 44
|
||||
|
||||
struct solo_vb2_buf {
|
||||
struct vb2_buffer vb;
|
||||
struct vb2_v4l2_buffer vb;
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -88,11 +88,11 @@
|
|||
|
||||
|
||||
struct vip_buffer {
|
||||
struct vb2_buffer vb;
|
||||
struct vb2_v4l2_buffer vb;
|
||||
struct list_head list;
|
||||
dma_addr_t dma;
|
||||
};
|
||||
static inline struct vip_buffer *to_vip_buffer(struct vb2_buffer *vb2)
|
||||
static inline struct vip_buffer *to_vip_buffer(struct vb2_v4l2_buffer *vb2)
|
||||
{
|
||||
return container_of(vb2, struct vip_buffer, vb);
|
||||
}
|
||||
|
|
@ -265,7 +265,7 @@ static void vip_active_buf_next(struct sta2x11_vip *vip)
|
|||
|
||||
|
||||
/* Videobuf2 Operations */
|
||||
static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
|
||||
static int queue_setup(struct vb2_queue *vq, const void *parg,
|
||||
unsigned int *nbuffers, unsigned int *nplanes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
|
|
@ -287,7 +287,8 @@ static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
|
|||
};
|
||||
static int buffer_init(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vip_buffer *vip_buf = to_vip_buffer(vb);
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct vip_buffer *vip_buf = to_vip_buffer(vbuf);
|
||||
|
||||
vip_buf->dma = vb2_dma_contig_plane_dma_addr(vb, 0);
|
||||
INIT_LIST_HEAD(&vip_buf->list);
|
||||
|
|
@ -296,8 +297,9 @@ static int buffer_init(struct vb2_buffer *vb)
|
|||
|
||||
static int buffer_prepare(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct sta2x11_vip *vip = vb2_get_drv_priv(vb->vb2_queue);
|
||||
struct vip_buffer *vip_buf = to_vip_buffer(vb);
|
||||
struct vip_buffer *vip_buf = to_vip_buffer(vbuf);
|
||||
unsigned long size;
|
||||
|
||||
size = vip->format.sizeimage;
|
||||
|
|
@ -307,14 +309,15 @@ static int buffer_prepare(struct vb2_buffer *vb)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
vb2_set_plane_payload(&vip_buf->vb, 0, size);
|
||||
vb2_set_plane_payload(&vip_buf->vb.vb2_buf, 0, size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
static void buffer_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct sta2x11_vip *vip = vb2_get_drv_priv(vb->vb2_queue);
|
||||
struct vip_buffer *vip_buf = to_vip_buffer(vb);
|
||||
struct vip_buffer *vip_buf = to_vip_buffer(vbuf);
|
||||
|
||||
spin_lock(&vip->lock);
|
||||
list_add_tail(&vip_buf->list, &vip->buffer_list);
|
||||
|
|
@ -329,8 +332,9 @@ static void buffer_queue(struct vb2_buffer *vb)
|
|||
}
|
||||
static void buffer_finish(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct sta2x11_vip *vip = vb2_get_drv_priv(vb->vb2_queue);
|
||||
struct vip_buffer *vip_buf = to_vip_buffer(vb);
|
||||
struct vip_buffer *vip_buf = to_vip_buffer(vbuf);
|
||||
|
||||
/* Buffer handled, remove it from the list */
|
||||
spin_lock(&vip->lock);
|
||||
|
|
@ -370,7 +374,7 @@ static void stop_streaming(struct vb2_queue *vq)
|
|||
/* Release all active buffers */
|
||||
spin_lock(&vip->lock);
|
||||
list_for_each_entry_safe(vip_buf, node, &vip->buffer_list, list) {
|
||||
vb2_buffer_done(&vip_buf->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&vip_buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
list_del(&vip_buf->list);
|
||||
}
|
||||
spin_unlock(&vip->lock);
|
||||
|
|
@ -813,9 +817,9 @@ static irqreturn_t vip_irq(int irq, struct sta2x11_vip *vip)
|
|||
/* Disable acquisition */
|
||||
reg_write(vip, DVP_CTL, reg_read(vip, DVP_CTL) & ~DVP_CTL_ENA);
|
||||
/* Remove the active buffer from the list */
|
||||
v4l2_get_timestamp(&vip->active->vb.v4l2_buf.timestamp);
|
||||
vip->active->vb.v4l2_buf.sequence = vip->sequence++;
|
||||
vb2_buffer_done(&vip->active->vb, VB2_BUF_STATE_DONE);
|
||||
v4l2_get_timestamp(&vip->active->vb.timestamp);
|
||||
vip->active->vb.sequence = vip->sequence++;
|
||||
vb2_buffer_done(&vip->active->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
||||
}
|
||||
|
||||
return IRQ_HANDLED;
|
||||
|
|
|
|||
|
|
@ -303,7 +303,6 @@ static int arm_thread(void *data)
|
|||
static int DvbDmxFilterCallback(u8 *buffer1, size_t buffer1_len,
|
||||
u8 *buffer2, size_t buffer2_len,
|
||||
struct dvb_demux_filter *dvbdmxfilter,
|
||||
enum dmx_success success,
|
||||
struct av7110 *av7110)
|
||||
{
|
||||
if (!dvbdmxfilter->feed->demux->dmx.frontend)
|
||||
|
|
@ -329,16 +328,14 @@ static int DvbDmxFilterCallback(u8 *buffer1, size_t buffer1_len,
|
|||
}
|
||||
return dvbdmxfilter->feed->cb.sec(buffer1, buffer1_len,
|
||||
buffer2, buffer2_len,
|
||||
&dvbdmxfilter->filter,
|
||||
DMX_OK);
|
||||
&dvbdmxfilter->filter);
|
||||
case DMX_TYPE_TS:
|
||||
if (!(dvbdmxfilter->feed->ts_type & TS_PACKET))
|
||||
return 0;
|
||||
if (dvbdmxfilter->feed->ts_type & TS_PAYLOAD_ONLY)
|
||||
return dvbdmxfilter->feed->cb.ts(buffer1, buffer1_len,
|
||||
buffer2, buffer2_len,
|
||||
&dvbdmxfilter->feed->feed.ts,
|
||||
DMX_OK);
|
||||
&dvbdmxfilter->feed->feed.ts);
|
||||
else
|
||||
av7110_p2t_write(buffer1, buffer1_len,
|
||||
dvbdmxfilter->feed->pid,
|
||||
|
|
@ -422,7 +419,7 @@ static void debiirq(unsigned long cookie)
|
|||
DvbDmxFilterCallback((u8 *)av7110->debi_virt,
|
||||
av7110->debilen, NULL, 0,
|
||||
av7110->handle2filter[handle],
|
||||
DMX_OK, av7110);
|
||||
av7110);
|
||||
xfer = RX_BUFF;
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ int av7110_record_cb(struct dvb_filter_pes2ts *p2t, u8 *buf, size_t len)
|
|||
buf[4] = buf[5] = 0;
|
||||
if (dvbdmxfeed->ts_type & TS_PAYLOAD_ONLY)
|
||||
return dvbdmxfeed->cb.ts(buf, len, NULL, 0,
|
||||
&dvbdmxfeed->feed.ts, DMX_OK);
|
||||
&dvbdmxfeed->feed.ts);
|
||||
else
|
||||
return dvb_filter_pes2ts(p2t, buf, len, 1);
|
||||
}
|
||||
|
|
@ -112,7 +112,7 @@ static int dvb_filter_pes2ts_cb(void *priv, unsigned char *data)
|
|||
struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *) priv;
|
||||
|
||||
dvbdmxfeed->cb.ts(data, 188, NULL, 0,
|
||||
&dvbdmxfeed->feed.ts, DMX_OK);
|
||||
&dvbdmxfeed->feed.ts);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -815,7 +815,7 @@ static void p_to_t(u8 const *buf, long int length, u16 pid, u8 *counter,
|
|||
memcpy(obuf + l, buf + c, TS_SIZE - l);
|
||||
c = length;
|
||||
}
|
||||
feed->cb.ts(obuf, 188, NULL, 0, &feed->feed.ts, DMX_OK);
|
||||
feed->cb.ts(obuf, 188, NULL, 0, &feed->feed.ts);
|
||||
pes_start = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -376,10 +376,11 @@ static int tw68_buffer_count(unsigned int size, unsigned int count)
|
|||
/* ------------------------------------------------------------- */
|
||||
/* vb2 queue operations */
|
||||
|
||||
static int tw68_queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
||||
static int tw68_queue_setup(struct vb2_queue *q, const void *parg,
|
||||
unsigned int *num_buffers, unsigned int *num_planes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
const struct v4l2_format *fmt = parg;
|
||||
struct tw68_dev *dev = vb2_get_drv_priv(q);
|
||||
unsigned tot_bufs = q->num_buffers + *num_buffers;
|
||||
|
||||
|
|
@ -423,9 +424,10 @@ static int tw68_queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
|||
*/
|
||||
static void tw68_buf_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct vb2_queue *vq = vb->vb2_queue;
|
||||
struct tw68_dev *dev = vb2_get_drv_priv(vq);
|
||||
struct tw68_buf *buf = container_of(vb, struct tw68_buf, vb);
|
||||
struct tw68_buf *buf = container_of(vbuf, struct tw68_buf, vb);
|
||||
struct tw68_buf *prev;
|
||||
unsigned long flags;
|
||||
|
||||
|
|
@ -457,9 +459,10 @@ static void tw68_buf_queue(struct vb2_buffer *vb)
|
|||
*/
|
||||
static int tw68_buf_prepare(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct vb2_queue *vq = vb->vb2_queue;
|
||||
struct tw68_dev *dev = vb2_get_drv_priv(vq);
|
||||
struct tw68_buf *buf = container_of(vb, struct tw68_buf, vb);
|
||||
struct tw68_buf *buf = container_of(vbuf, struct tw68_buf, vb);
|
||||
struct sg_table *dma = vb2_dma_sg_plane_desc(vb, 0);
|
||||
unsigned size, bpl;
|
||||
|
||||
|
|
@ -499,9 +502,10 @@ static int tw68_buf_prepare(struct vb2_buffer *vb)
|
|||
|
||||
static void tw68_buf_finish(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct vb2_queue *vq = vb->vb2_queue;
|
||||
struct tw68_dev *dev = vb2_get_drv_priv(vq);
|
||||
struct tw68_buf *buf = container_of(vb, struct tw68_buf, vb);
|
||||
struct tw68_buf *buf = container_of(vbuf, struct tw68_buf, vb);
|
||||
|
||||
pci_free_consistent(dev->pci, buf->size, buf->cpu, buf->dma);
|
||||
}
|
||||
|
|
@ -528,7 +532,7 @@ static void tw68_stop_streaming(struct vb2_queue *q)
|
|||
container_of(dev->active.next, struct tw68_buf, list);
|
||||
|
||||
list_del(&buf->list);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1012,10 +1016,10 @@ void tw68_irq_video_done(struct tw68_dev *dev, unsigned long status)
|
|||
buf = list_entry(dev->active.next, struct tw68_buf, list);
|
||||
list_del(&buf->list);
|
||||
spin_unlock(&dev->slock);
|
||||
v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
|
||||
buf->vb.v4l2_buf.field = dev->field;
|
||||
buf->vb.v4l2_buf.sequence = dev->seqnr++;
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);
|
||||
v4l2_get_timestamp(&buf->vb.timestamp);
|
||||
buf->vb.field = dev->field;
|
||||
buf->vb.sequence = dev->seqnr++;
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
||||
status &= ~(TW68_DMAPI);
|
||||
if (0 == status)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include <media/v4l2-ioctl.h>
|
||||
#include <media/v4l2-ctrls.h>
|
||||
#include <media/v4l2-device.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
#include <media/videobuf2-dma-sg.h>
|
||||
|
||||
#include "tw68-reg.h"
|
||||
|
|
@ -118,7 +119,7 @@ struct tw68_dev; /* forward delclaration */
|
|||
|
||||
/* buffer for one video/vbi/ts frame */
|
||||
struct tw68_buf {
|
||||
struct vb2_buffer vb;
|
||||
struct vb2_v4l2_buffer vb;
|
||||
struct list_head list;
|
||||
|
||||
unsigned int size;
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ config VIDEO_SH_VEU
|
|||
|
||||
config VIDEO_RENESAS_JPU
|
||||
tristate "Renesas JPEG Processing Unit"
|
||||
depends on VIDEO_DEV && VIDEO_V4L2
|
||||
depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA
|
||||
depends on ARCH_SHMOBILE || COMPILE_TEST
|
||||
select VIDEOBUF2_DMA_CONTIG
|
||||
select V4L2_MEM2MEM_DEV
|
||||
|
|
|
|||
|
|
@ -307,7 +307,8 @@ static inline struct vpfe_device *to_vpfe(struct vpfe_ccdc *ccdc)
|
|||
return container_of(ccdc, struct vpfe_device, ccdc);
|
||||
}
|
||||
|
||||
static inline struct vpfe_cap_buffer *to_vpfe_buffer(struct vb2_buffer *vb)
|
||||
static inline
|
||||
struct vpfe_cap_buffer *to_vpfe_buffer(struct vb2_v4l2_buffer *vb)
|
||||
{
|
||||
return container_of(vb, struct vpfe_cap_buffer, vb);
|
||||
}
|
||||
|
|
@ -1257,14 +1258,14 @@ static inline void vpfe_schedule_next_buffer(struct vpfe_device *vpfe)
|
|||
list_del(&vpfe->next_frm->list);
|
||||
|
||||
vpfe_set_sdr_addr(&vpfe->ccdc,
|
||||
vb2_dma_contig_plane_dma_addr(&vpfe->next_frm->vb, 0));
|
||||
vb2_dma_contig_plane_dma_addr(&vpfe->next_frm->vb.vb2_buf, 0));
|
||||
}
|
||||
|
||||
static inline void vpfe_schedule_bottom_field(struct vpfe_device *vpfe)
|
||||
{
|
||||
unsigned long addr;
|
||||
|
||||
addr = vb2_dma_contig_plane_dma_addr(&vpfe->next_frm->vb, 0) +
|
||||
addr = vb2_dma_contig_plane_dma_addr(&vpfe->next_frm->vb.vb2_buf, 0) +
|
||||
vpfe->field_off;
|
||||
|
||||
vpfe_set_sdr_addr(&vpfe->ccdc, addr);
|
||||
|
|
@ -1280,10 +1281,10 @@ static inline void vpfe_schedule_bottom_field(struct vpfe_device *vpfe)
|
|||
*/
|
||||
static inline void vpfe_process_buffer_complete(struct vpfe_device *vpfe)
|
||||
{
|
||||
v4l2_get_timestamp(&vpfe->cur_frm->vb.v4l2_buf.timestamp);
|
||||
vpfe->cur_frm->vb.v4l2_buf.field = vpfe->fmt.fmt.pix.field;
|
||||
vpfe->cur_frm->vb.v4l2_buf.sequence = vpfe->sequence++;
|
||||
vb2_buffer_done(&vpfe->cur_frm->vb, VB2_BUF_STATE_DONE);
|
||||
v4l2_get_timestamp(&vpfe->cur_frm->vb.timestamp);
|
||||
vpfe->cur_frm->vb.field = vpfe->fmt.fmt.pix.field;
|
||||
vpfe->cur_frm->vb.sequence = vpfe->sequence++;
|
||||
vb2_buffer_done(&vpfe->cur_frm->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
||||
vpfe->cur_frm = vpfe->next_frm;
|
||||
}
|
||||
|
||||
|
|
@ -1907,10 +1908,11 @@ static void vpfe_calculate_offsets(struct vpfe_device *vpfe)
|
|||
* the buffer count and buffer size
|
||||
*/
|
||||
static int vpfe_queue_setup(struct vb2_queue *vq,
|
||||
const struct v4l2_format *fmt,
|
||||
const void *parg,
|
||||
unsigned int *nbuffers, unsigned int *nplanes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
const struct v4l2_format *fmt = parg;
|
||||
struct vpfe_device *vpfe = vb2_get_drv_priv(vq);
|
||||
|
||||
if (fmt && fmt->fmt.pix.sizeimage < vpfe->fmt.fmt.pix.sizeimage)
|
||||
|
|
@ -1942,6 +1944,7 @@ static int vpfe_queue_setup(struct vb2_queue *vq,
|
|||
*/
|
||||
static int vpfe_buffer_prepare(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct vpfe_device *vpfe = vb2_get_drv_priv(vb->vb2_queue);
|
||||
|
||||
vb2_set_plane_payload(vb, 0, vpfe->fmt.fmt.pix.sizeimage);
|
||||
|
|
@ -1949,7 +1952,7 @@ static int vpfe_buffer_prepare(struct vb2_buffer *vb)
|
|||
if (vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0))
|
||||
return -EINVAL;
|
||||
|
||||
vb->v4l2_buf.field = vpfe->fmt.fmt.pix.field;
|
||||
vbuf->field = vpfe->fmt.fmt.pix.field;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1960,8 +1963,9 @@ static int vpfe_buffer_prepare(struct vb2_buffer *vb)
|
|||
*/
|
||||
static void vpfe_buffer_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct vpfe_device *vpfe = vb2_get_drv_priv(vb->vb2_queue);
|
||||
struct vpfe_cap_buffer *buf = to_vpfe_buffer(vb);
|
||||
struct vpfe_cap_buffer *buf = to_vpfe_buffer(vbuf);
|
||||
unsigned long flags = 0;
|
||||
|
||||
/* add the buffer to the DMA queue */
|
||||
|
|
@ -2006,7 +2010,7 @@ static int vpfe_start_streaming(struct vb2_queue *vq, unsigned int count)
|
|||
list_del(&vpfe->cur_frm->list);
|
||||
spin_unlock_irqrestore(&vpfe->dma_queue_lock, flags);
|
||||
|
||||
addr = vb2_dma_contig_plane_dma_addr(&vpfe->cur_frm->vb, 0);
|
||||
addr = vb2_dma_contig_plane_dma_addr(&vpfe->cur_frm->vb.vb2_buf, 0);
|
||||
|
||||
vpfe_set_sdr_addr(&vpfe->ccdc, (unsigned long)(addr));
|
||||
|
||||
|
|
@ -2023,7 +2027,7 @@ static int vpfe_start_streaming(struct vb2_queue *vq, unsigned int count)
|
|||
err:
|
||||
list_for_each_entry_safe(buf, tmp, &vpfe->dma_queue, list) {
|
||||
list_del(&buf->list);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
@ -2055,13 +2059,14 @@ static void vpfe_stop_streaming(struct vb2_queue *vq)
|
|||
/* release all active buffers */
|
||||
spin_lock_irqsave(&vpfe->dma_queue_lock, flags);
|
||||
if (vpfe->cur_frm == vpfe->next_frm) {
|
||||
vb2_buffer_done(&vpfe->cur_frm->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&vpfe->cur_frm->vb.vb2_buf,
|
||||
VB2_BUF_STATE_ERROR);
|
||||
} else {
|
||||
if (vpfe->cur_frm != NULL)
|
||||
vb2_buffer_done(&vpfe->cur_frm->vb,
|
||||
vb2_buffer_done(&vpfe->cur_frm->vb.vb2_buf,
|
||||
VB2_BUF_STATE_ERROR);
|
||||
if (vpfe->next_frm != NULL)
|
||||
vb2_buffer_done(&vpfe->next_frm->vb,
|
||||
vb2_buffer_done(&vpfe->next_frm->vb.vb2_buf,
|
||||
VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
|
||||
|
|
@ -2069,7 +2074,8 @@ static void vpfe_stop_streaming(struct vb2_queue *vq)
|
|||
vpfe->next_frm = list_entry(vpfe->dma_queue.next,
|
||||
struct vpfe_cap_buffer, list);
|
||||
list_del(&vpfe->next_frm->list);
|
||||
vb2_buffer_done(&vpfe->next_frm->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&vpfe->next_frm->vb.vb2_buf,
|
||||
VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
spin_unlock_irqrestore(&vpfe->dma_queue_lock, flags);
|
||||
}
|
||||
|
|
@ -2546,11 +2552,12 @@ static int vpfe_probe(struct platform_device *pdev)
|
|||
if (IS_ERR(ccdc->ccdc_cfg.base_addr))
|
||||
return PTR_ERR(ccdc->ccdc_cfg.base_addr);
|
||||
|
||||
vpfe->irq = platform_get_irq(pdev, 0);
|
||||
if (vpfe->irq <= 0) {
|
||||
ret = platform_get_irq(pdev, 0);
|
||||
if (ret <= 0) {
|
||||
dev_err(&pdev->dev, "No IRQ resource\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
vpfe->irq = ret;
|
||||
|
||||
ret = devm_request_irq(vpfe->pdev, vpfe->irq, vpfe_isr, 0,
|
||||
"vpfe_capture0", vpfe);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include <media/v4l2-dev.h>
|
||||
#include <media/v4l2-device.h>
|
||||
#include <media/v4l2-ioctl.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
#include <media/videobuf2-dma-contig.h>
|
||||
|
||||
#include "am437x-vpfe_regs.h"
|
||||
|
|
@ -104,7 +105,7 @@ struct vpfe_config {
|
|||
};
|
||||
|
||||
struct vpfe_cap_buffer {
|
||||
struct vb2_buffer vb;
|
||||
struct vb2_v4l2_buffer vb;
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ struct bcap_format {
|
|||
};
|
||||
|
||||
struct bcap_buffer {
|
||||
struct vb2_buffer vb;
|
||||
struct vb2_v4l2_buffer vb;
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
|
|
@ -149,7 +149,7 @@ static const struct bcap_format bcap_formats[] = {
|
|||
|
||||
static irqreturn_t bcap_isr(int irq, void *dev_id);
|
||||
|
||||
static struct bcap_buffer *to_bcap_vb(struct vb2_buffer *vb)
|
||||
static struct bcap_buffer *to_bcap_vb(struct vb2_v4l2_buffer *vb)
|
||||
{
|
||||
return container_of(vb, struct bcap_buffer, vb);
|
||||
}
|
||||
|
|
@ -202,10 +202,11 @@ static void bcap_free_sensor_formats(struct bcap_device *bcap_dev)
|
|||
}
|
||||
|
||||
static int bcap_queue_setup(struct vb2_queue *vq,
|
||||
const struct v4l2_format *fmt,
|
||||
const void *parg,
|
||||
unsigned int *nbuffers, unsigned int *nplanes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
const struct v4l2_format *fmt = parg;
|
||||
struct bcap_device *bcap_dev = vb2_get_drv_priv(vq);
|
||||
|
||||
if (fmt && fmt->fmt.pix.sizeimage < bcap_dev->fmt.sizeimage)
|
||||
|
|
@ -223,6 +224,7 @@ static int bcap_queue_setup(struct vb2_queue *vq,
|
|||
|
||||
static int bcap_buffer_prepare(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct bcap_device *bcap_dev = vb2_get_drv_priv(vb->vb2_queue);
|
||||
unsigned long size = bcap_dev->fmt.sizeimage;
|
||||
|
||||
|
|
@ -233,15 +235,16 @@ static int bcap_buffer_prepare(struct vb2_buffer *vb)
|
|||
}
|
||||
vb2_set_plane_payload(vb, 0, size);
|
||||
|
||||
vb->v4l2_buf.field = bcap_dev->fmt.field;
|
||||
vbuf->field = bcap_dev->fmt.field;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void bcap_buffer_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct bcap_device *bcap_dev = vb2_get_drv_priv(vb->vb2_queue);
|
||||
struct bcap_buffer *buf = to_bcap_vb(vb);
|
||||
struct bcap_buffer *buf = to_bcap_vb(vbuf);
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&bcap_dev->lock, flags);
|
||||
|
|
@ -251,8 +254,9 @@ static void bcap_buffer_queue(struct vb2_buffer *vb)
|
|||
|
||||
static void bcap_buffer_cleanup(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct bcap_device *bcap_dev = vb2_get_drv_priv(vb->vb2_queue);
|
||||
struct bcap_buffer *buf = to_bcap_vb(vb);
|
||||
struct bcap_buffer *buf = to_bcap_vb(vbuf);
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&bcap_dev->lock, flags);
|
||||
|
|
@ -333,7 +337,8 @@ static int bcap_start_streaming(struct vb2_queue *vq, unsigned int count)
|
|||
struct bcap_buffer, list);
|
||||
/* remove buffer from the dma queue */
|
||||
list_del_init(&bcap_dev->cur_frm->list);
|
||||
addr = vb2_dma_contig_plane_dma_addr(&bcap_dev->cur_frm->vb, 0);
|
||||
addr = vb2_dma_contig_plane_dma_addr(&bcap_dev->cur_frm->vb.vb2_buf,
|
||||
0);
|
||||
/* update DMA address */
|
||||
ppi->ops->update_addr(ppi, (unsigned long)addr);
|
||||
/* enable ppi */
|
||||
|
|
@ -344,7 +349,7 @@ static int bcap_start_streaming(struct vb2_queue *vq, unsigned int count)
|
|||
err:
|
||||
list_for_each_entry_safe(buf, tmp, &bcap_dev->dma_queue, list) {
|
||||
list_del(&buf->list);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
@ -367,13 +372,15 @@ static void bcap_stop_streaming(struct vb2_queue *vq)
|
|||
|
||||
/* release all active buffers */
|
||||
if (bcap_dev->cur_frm)
|
||||
vb2_buffer_done(&bcap_dev->cur_frm->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&bcap_dev->cur_frm->vb.vb2_buf,
|
||||
VB2_BUF_STATE_ERROR);
|
||||
|
||||
while (!list_empty(&bcap_dev->dma_queue)) {
|
||||
bcap_dev->cur_frm = list_entry(bcap_dev->dma_queue.next,
|
||||
struct bcap_buffer, list);
|
||||
list_del_init(&bcap_dev->cur_frm->list);
|
||||
vb2_buffer_done(&bcap_dev->cur_frm->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&bcap_dev->cur_frm->vb.vb2_buf,
|
||||
VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -392,18 +399,19 @@ static irqreturn_t bcap_isr(int irq, void *dev_id)
|
|||
{
|
||||
struct ppi_if *ppi = dev_id;
|
||||
struct bcap_device *bcap_dev = ppi->priv;
|
||||
struct vb2_buffer *vb = &bcap_dev->cur_frm->vb;
|
||||
struct vb2_v4l2_buffer *vbuf = &bcap_dev->cur_frm->vb;
|
||||
struct vb2_buffer *vb = &vbuf->vb2_buf;
|
||||
dma_addr_t addr;
|
||||
|
||||
spin_lock(&bcap_dev->lock);
|
||||
|
||||
if (!list_empty(&bcap_dev->dma_queue)) {
|
||||
v4l2_get_timestamp(&vb->v4l2_buf.timestamp);
|
||||
v4l2_get_timestamp(&vbuf->timestamp);
|
||||
if (ppi->err) {
|
||||
vb2_buffer_done(vb, VB2_BUF_STATE_ERROR);
|
||||
ppi->err = false;
|
||||
} else {
|
||||
vb->v4l2_buf.sequence = bcap_dev->sequence++;
|
||||
vbuf->sequence = bcap_dev->sequence++;
|
||||
vb2_buffer_done(vb, VB2_BUF_STATE_DONE);
|
||||
}
|
||||
bcap_dev->cur_frm = list_entry(bcap_dev->dma_queue.next,
|
||||
|
|
@ -420,7 +428,8 @@ static irqreturn_t bcap_isr(int irq, void *dev_id)
|
|||
if (bcap_dev->stop) {
|
||||
complete(&bcap_dev->comp);
|
||||
} else {
|
||||
addr = vb2_dma_contig_plane_dma_addr(&bcap_dev->cur_frm->vb, 0);
|
||||
addr = vb2_dma_contig_plane_dma_addr(
|
||||
&bcap_dev->cur_frm->vb.vb2_buf, 0);
|
||||
ppi->ops->update_addr(ppi, (unsigned long)addr);
|
||||
ppi->ops->start(ppi);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include <media/v4l2-ctrls.h>
|
||||
#include <media/v4l2-fh.h>
|
||||
#include <media/v4l2-mem2mem.h>
|
||||
#include <media/videobuf2-core.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
#include <media/videobuf2-dma-contig.h>
|
||||
#include <media/videobuf2-vmalloc.h>
|
||||
|
||||
|
|
@ -179,31 +179,32 @@ static void coda_kfifo_sync_to_device_write(struct coda_ctx *ctx)
|
|||
}
|
||||
|
||||
static int coda_bitstream_queue(struct coda_ctx *ctx,
|
||||
struct vb2_buffer *src_buf)
|
||||
struct vb2_v4l2_buffer *src_buf)
|
||||
{
|
||||
u32 src_size = vb2_get_plane_payload(src_buf, 0);
|
||||
u32 src_size = vb2_get_plane_payload(&src_buf->vb2_buf, 0);
|
||||
u32 n;
|
||||
|
||||
n = kfifo_in(&ctx->bitstream_fifo, vb2_plane_vaddr(src_buf, 0),
|
||||
src_size);
|
||||
n = kfifo_in(&ctx->bitstream_fifo,
|
||||
vb2_plane_vaddr(&src_buf->vb2_buf, 0), src_size);
|
||||
if (n < src_size)
|
||||
return -ENOSPC;
|
||||
|
||||
src_buf->v4l2_buf.sequence = ctx->qsequence++;
|
||||
src_buf->sequence = ctx->qsequence++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool coda_bitstream_try_queue(struct coda_ctx *ctx,
|
||||
struct vb2_buffer *src_buf)
|
||||
struct vb2_v4l2_buffer *src_buf)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (coda_get_bitstream_payload(ctx) +
|
||||
vb2_get_plane_payload(src_buf, 0) + 512 >= ctx->bitstream.size)
|
||||
vb2_get_plane_payload(&src_buf->vb2_buf, 0) + 512 >=
|
||||
ctx->bitstream.size)
|
||||
return false;
|
||||
|
||||
if (vb2_plane_vaddr(src_buf, 0) == NULL) {
|
||||
if (vb2_plane_vaddr(&src_buf->vb2_buf, 0) == NULL) {
|
||||
v4l2_err(&ctx->dev->v4l2_dev, "trying to queue empty buffer\n");
|
||||
return true;
|
||||
}
|
||||
|
|
@ -224,7 +225,7 @@ static bool coda_bitstream_try_queue(struct coda_ctx *ctx,
|
|||
|
||||
void coda_fill_bitstream(struct coda_ctx *ctx, bool streaming)
|
||||
{
|
||||
struct vb2_buffer *src_buf;
|
||||
struct vb2_v4l2_buffer *src_buf;
|
||||
struct coda_buffer_meta *meta;
|
||||
unsigned long flags;
|
||||
u32 start;
|
||||
|
|
@ -257,7 +258,7 @@ void coda_fill_bitstream(struct coda_ctx *ctx, bool streaming)
|
|||
}
|
||||
|
||||
/* Dump empty buffers */
|
||||
if (!vb2_get_plane_payload(src_buf, 0)) {
|
||||
if (!vb2_get_plane_payload(&src_buf->vb2_buf, 0)) {
|
||||
src_buf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx);
|
||||
v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_DONE);
|
||||
continue;
|
||||
|
|
@ -276,9 +277,9 @@ void coda_fill_bitstream(struct coda_ctx *ctx, bool streaming)
|
|||
|
||||
meta = kmalloc(sizeof(*meta), GFP_KERNEL);
|
||||
if (meta) {
|
||||
meta->sequence = src_buf->v4l2_buf.sequence;
|
||||
meta->timecode = src_buf->v4l2_buf.timecode;
|
||||
meta->timestamp = src_buf->v4l2_buf.timestamp;
|
||||
meta->sequence = src_buf->sequence;
|
||||
meta->timecode = src_buf->timecode;
|
||||
meta->timestamp = src_buf->timestamp;
|
||||
meta->start = start;
|
||||
meta->end = ctx->bitstream_fifo.kfifo.in &
|
||||
ctx->bitstream_fifo.kfifo.mask;
|
||||
|
|
@ -483,20 +484,21 @@ err:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int coda_encode_header(struct coda_ctx *ctx, struct vb2_buffer *buf,
|
||||
static int coda_encode_header(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf,
|
||||
int header_code, u8 *header, int *size)
|
||||
{
|
||||
struct vb2_buffer *vb = &buf->vb2_buf;
|
||||
struct coda_dev *dev = ctx->dev;
|
||||
size_t bufsize;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
if (dev->devtype->product == CODA_960)
|
||||
memset(vb2_plane_vaddr(buf, 0), 0, 64);
|
||||
memset(vb2_plane_vaddr(vb, 0), 0, 64);
|
||||
|
||||
coda_write(dev, vb2_dma_contig_plane_dma_addr(buf, 0),
|
||||
coda_write(dev, vb2_dma_contig_plane_dma_addr(vb, 0),
|
||||
CODA_CMD_ENC_HEADER_BB_START);
|
||||
bufsize = vb2_plane_size(buf, 0);
|
||||
bufsize = vb2_plane_size(vb, 0);
|
||||
if (dev->devtype->product == CODA_960)
|
||||
bufsize /= 1024;
|
||||
coda_write(dev, bufsize, CODA_CMD_ENC_HEADER_BB_SIZE);
|
||||
|
|
@ -509,14 +511,14 @@ static int coda_encode_header(struct coda_ctx *ctx, struct vb2_buffer *buf,
|
|||
|
||||
if (dev->devtype->product == CODA_960) {
|
||||
for (i = 63; i > 0; i--)
|
||||
if (((char *)vb2_plane_vaddr(buf, 0))[i] != 0)
|
||||
if (((char *)vb2_plane_vaddr(vb, 0))[i] != 0)
|
||||
break;
|
||||
*size = i + 1;
|
||||
} else {
|
||||
*size = coda_read(dev, CODA_REG_BIT_WR_PTR(ctx->reg_idx)) -
|
||||
coda_read(dev, CODA_CMD_ENC_HEADER_BB_START);
|
||||
}
|
||||
memcpy(header, vb2_plane_vaddr(buf, 0), *size);
|
||||
memcpy(header, vb2_plane_vaddr(vb, 0), *size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -799,7 +801,7 @@ static int coda_start_encoding(struct coda_ctx *ctx)
|
|||
struct v4l2_device *v4l2_dev = &dev->v4l2_dev;
|
||||
struct coda_q_data *q_data_src, *q_data_dst;
|
||||
u32 bitstream_buf, bitstream_size;
|
||||
struct vb2_buffer *buf;
|
||||
struct vb2_v4l2_buffer *buf;
|
||||
int gamma, ret, value;
|
||||
u32 dst_fourcc;
|
||||
int num_fb;
|
||||
|
|
@ -810,7 +812,7 @@ static int coda_start_encoding(struct coda_ctx *ctx)
|
|||
dst_fourcc = q_data_dst->fourcc;
|
||||
|
||||
buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
|
||||
bitstream_buf = vb2_dma_contig_plane_dma_addr(buf, 0);
|
||||
bitstream_buf = vb2_dma_contig_plane_dma_addr(&buf->vb2_buf, 0);
|
||||
bitstream_size = q_data_dst->sizeimage;
|
||||
|
||||
if (!coda_is_initialized(dev)) {
|
||||
|
|
@ -1185,7 +1187,7 @@ out:
|
|||
static int coda_prepare_encode(struct coda_ctx *ctx)
|
||||
{
|
||||
struct coda_q_data *q_data_src, *q_data_dst;
|
||||
struct vb2_buffer *src_buf, *dst_buf;
|
||||
struct vb2_v4l2_buffer *src_buf, *dst_buf;
|
||||
struct coda_dev *dev = ctx->dev;
|
||||
int force_ipicture;
|
||||
int quant_param = 0;
|
||||
|
|
@ -1200,8 +1202,8 @@ static int coda_prepare_encode(struct coda_ctx *ctx)
|
|||
q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
|
||||
dst_fourcc = q_data_dst->fourcc;
|
||||
|
||||
src_buf->v4l2_buf.sequence = ctx->osequence;
|
||||
dst_buf->v4l2_buf.sequence = ctx->osequence;
|
||||
src_buf->sequence = ctx->osequence;
|
||||
dst_buf->sequence = ctx->osequence;
|
||||
ctx->osequence++;
|
||||
|
||||
/*
|
||||
|
|
@ -1209,12 +1211,12 @@ static int coda_prepare_encode(struct coda_ctx *ctx)
|
|||
* frame as IDR. This is a problem for some decoders that can't
|
||||
* recover when a frame is lost.
|
||||
*/
|
||||
if (src_buf->v4l2_buf.sequence % ctx->params.gop_size) {
|
||||
src_buf->v4l2_buf.flags |= V4L2_BUF_FLAG_PFRAME;
|
||||
src_buf->v4l2_buf.flags &= ~V4L2_BUF_FLAG_KEYFRAME;
|
||||
if (src_buf->sequence % ctx->params.gop_size) {
|
||||
src_buf->flags |= V4L2_BUF_FLAG_PFRAME;
|
||||
src_buf->flags &= ~V4L2_BUF_FLAG_KEYFRAME;
|
||||
} else {
|
||||
src_buf->v4l2_buf.flags |= V4L2_BUF_FLAG_KEYFRAME;
|
||||
src_buf->v4l2_buf.flags &= ~V4L2_BUF_FLAG_PFRAME;
|
||||
src_buf->flags |= V4L2_BUF_FLAG_KEYFRAME;
|
||||
src_buf->flags &= ~V4L2_BUF_FLAG_PFRAME;
|
||||
}
|
||||
|
||||
if (dev->devtype->product == CODA_960)
|
||||
|
|
@ -1224,9 +1226,9 @@ static int coda_prepare_encode(struct coda_ctx *ctx)
|
|||
* Copy headers at the beginning of the first frame for H.264 only.
|
||||
* In MPEG4 they are already copied by the coda.
|
||||
*/
|
||||
if (src_buf->v4l2_buf.sequence == 0) {
|
||||
if (src_buf->sequence == 0) {
|
||||
pic_stream_buffer_addr =
|
||||
vb2_dma_contig_plane_dma_addr(dst_buf, 0) +
|
||||
vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0) +
|
||||
ctx->vpu_header_size[0] +
|
||||
ctx->vpu_header_size[1] +
|
||||
ctx->vpu_header_size[2];
|
||||
|
|
@ -1234,20 +1236,21 @@ static int coda_prepare_encode(struct coda_ctx *ctx)
|
|||
ctx->vpu_header_size[0] -
|
||||
ctx->vpu_header_size[1] -
|
||||
ctx->vpu_header_size[2];
|
||||
memcpy(vb2_plane_vaddr(dst_buf, 0),
|
||||
memcpy(vb2_plane_vaddr(&dst_buf->vb2_buf, 0),
|
||||
&ctx->vpu_header[0][0], ctx->vpu_header_size[0]);
|
||||
memcpy(vb2_plane_vaddr(dst_buf, 0) + ctx->vpu_header_size[0],
|
||||
&ctx->vpu_header[1][0], ctx->vpu_header_size[1]);
|
||||
memcpy(vb2_plane_vaddr(dst_buf, 0) + ctx->vpu_header_size[0] +
|
||||
ctx->vpu_header_size[1], &ctx->vpu_header[2][0],
|
||||
ctx->vpu_header_size[2]);
|
||||
memcpy(vb2_plane_vaddr(&dst_buf->vb2_buf, 0)
|
||||
+ ctx->vpu_header_size[0], &ctx->vpu_header[1][0],
|
||||
ctx->vpu_header_size[1]);
|
||||
memcpy(vb2_plane_vaddr(&dst_buf->vb2_buf, 0)
|
||||
+ ctx->vpu_header_size[0] + ctx->vpu_header_size[1],
|
||||
&ctx->vpu_header[2][0], ctx->vpu_header_size[2]);
|
||||
} else {
|
||||
pic_stream_buffer_addr =
|
||||
vb2_dma_contig_plane_dma_addr(dst_buf, 0);
|
||||
vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0);
|
||||
pic_stream_buffer_size = q_data_dst->sizeimage;
|
||||
}
|
||||
|
||||
if (src_buf->v4l2_buf.flags & V4L2_BUF_FLAG_KEYFRAME) {
|
||||
if (src_buf->flags & V4L2_BUF_FLAG_KEYFRAME) {
|
||||
force_ipicture = 1;
|
||||
switch (dst_fourcc) {
|
||||
case V4L2_PIX_FMT_H264:
|
||||
|
|
@ -1324,7 +1327,7 @@ static int coda_prepare_encode(struct coda_ctx *ctx)
|
|||
|
||||
static void coda_finish_encode(struct coda_ctx *ctx)
|
||||
{
|
||||
struct vb2_buffer *src_buf, *dst_buf;
|
||||
struct vb2_v4l2_buffer *src_buf, *dst_buf;
|
||||
struct coda_dev *dev = ctx->dev;
|
||||
u32 wr_ptr, start_ptr;
|
||||
|
||||
|
|
@ -1338,13 +1341,13 @@ static void coda_finish_encode(struct coda_ctx *ctx)
|
|||
wr_ptr = coda_read(dev, CODA_REG_BIT_WR_PTR(ctx->reg_idx));
|
||||
|
||||
/* Calculate bytesused field */
|
||||
if (dst_buf->v4l2_buf.sequence == 0) {
|
||||
vb2_set_plane_payload(dst_buf, 0, wr_ptr - start_ptr +
|
||||
if (dst_buf->sequence == 0) {
|
||||
vb2_set_plane_payload(&dst_buf->vb2_buf, 0,
|
||||
ctx->vpu_header_size[0] +
|
||||
ctx->vpu_header_size[1] +
|
||||
ctx->vpu_header_size[2]);
|
||||
} else {
|
||||
vb2_set_plane_payload(dst_buf, 0, wr_ptr - start_ptr);
|
||||
vb2_set_plane_payload(&dst_buf->vb2_buf, 0, wr_ptr - start_ptr);
|
||||
}
|
||||
|
||||
v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev, "frame size = %u\n",
|
||||
|
|
@ -1354,18 +1357,18 @@ static void coda_finish_encode(struct coda_ctx *ctx)
|
|||
coda_read(dev, CODA_RET_ENC_PIC_FLAG);
|
||||
|
||||
if (coda_read(dev, CODA_RET_ENC_PIC_TYPE) == 0) {
|
||||
dst_buf->v4l2_buf.flags |= V4L2_BUF_FLAG_KEYFRAME;
|
||||
dst_buf->v4l2_buf.flags &= ~V4L2_BUF_FLAG_PFRAME;
|
||||
dst_buf->flags |= V4L2_BUF_FLAG_KEYFRAME;
|
||||
dst_buf->flags &= ~V4L2_BUF_FLAG_PFRAME;
|
||||
} else {
|
||||
dst_buf->v4l2_buf.flags |= V4L2_BUF_FLAG_PFRAME;
|
||||
dst_buf->v4l2_buf.flags &= ~V4L2_BUF_FLAG_KEYFRAME;
|
||||
dst_buf->flags |= V4L2_BUF_FLAG_PFRAME;
|
||||
dst_buf->flags &= ~V4L2_BUF_FLAG_KEYFRAME;
|
||||
}
|
||||
|
||||
dst_buf->v4l2_buf.timestamp = src_buf->v4l2_buf.timestamp;
|
||||
dst_buf->v4l2_buf.flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
|
||||
dst_buf->v4l2_buf.flags |=
|
||||
src_buf->v4l2_buf.flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
|
||||
dst_buf->v4l2_buf.timecode = src_buf->v4l2_buf.timecode;
|
||||
dst_buf->timestamp = src_buf->timestamp;
|
||||
dst_buf->flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
|
||||
dst_buf->flags |=
|
||||
src_buf->flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
|
||||
dst_buf->timecode = src_buf->timecode;
|
||||
|
||||
v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_DONE);
|
||||
|
||||
|
|
@ -1378,8 +1381,8 @@ static void coda_finish_encode(struct coda_ctx *ctx)
|
|||
|
||||
v4l2_dbg(1, coda_debug, &dev->v4l2_dev,
|
||||
"job finished: encoding frame (%d) (%s)\n",
|
||||
dst_buf->v4l2_buf.sequence,
|
||||
(dst_buf->v4l2_buf.flags & V4L2_BUF_FLAG_KEYFRAME) ?
|
||||
dst_buf->sequence,
|
||||
(dst_buf->flags & V4L2_BUF_FLAG_KEYFRAME) ?
|
||||
"KEYFRAME" : "PFRAME");
|
||||
}
|
||||
|
||||
|
|
@ -1716,7 +1719,7 @@ static int coda_start_decoding(struct coda_ctx *ctx)
|
|||
|
||||
static int coda_prepare_decode(struct coda_ctx *ctx)
|
||||
{
|
||||
struct vb2_buffer *dst_buf;
|
||||
struct vb2_v4l2_buffer *dst_buf;
|
||||
struct coda_dev *dev = ctx->dev;
|
||||
struct coda_q_data *q_data_dst;
|
||||
struct coda_buffer_meta *meta;
|
||||
|
|
@ -1763,7 +1766,7 @@ static int coda_prepare_decode(struct coda_ctx *ctx)
|
|||
* well as the rotator buffer output.
|
||||
* ROT_INDEX needs to be < 0x40, but > ctx->num_internal_frames.
|
||||
*/
|
||||
coda_write(dev, CODA_MAX_FRAMEBUFFERS + dst_buf->v4l2_buf.index,
|
||||
coda_write(dev, CODA_MAX_FRAMEBUFFERS + dst_buf->vb2_buf.index,
|
||||
CODA9_CMD_DEC_PIC_ROT_INDEX);
|
||||
|
||||
reg_addr = CODA9_CMD_DEC_PIC_ROT_ADDR_Y;
|
||||
|
|
@ -1838,7 +1841,7 @@ static void coda_finish_decode(struct coda_ctx *ctx)
|
|||
struct coda_dev *dev = ctx->dev;
|
||||
struct coda_q_data *q_data_src;
|
||||
struct coda_q_data *q_data_dst;
|
||||
struct vb2_buffer *dst_buf;
|
||||
struct vb2_v4l2_buffer *dst_buf;
|
||||
struct coda_buffer_meta *meta;
|
||||
unsigned long payload;
|
||||
unsigned long flags;
|
||||
|
|
@ -2029,15 +2032,15 @@ static void coda_finish_decode(struct coda_ctx *ctx)
|
|||
if (ctx->display_idx >= 0 &&
|
||||
ctx->display_idx < ctx->num_internal_frames) {
|
||||
dst_buf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx);
|
||||
dst_buf->v4l2_buf.sequence = ctx->osequence++;
|
||||
dst_buf->sequence = ctx->osequence++;
|
||||
|
||||
dst_buf->v4l2_buf.flags &= ~(V4L2_BUF_FLAG_KEYFRAME |
|
||||
dst_buf->flags &= ~(V4L2_BUF_FLAG_KEYFRAME |
|
||||
V4L2_BUF_FLAG_PFRAME |
|
||||
V4L2_BUF_FLAG_BFRAME);
|
||||
dst_buf->v4l2_buf.flags |= ctx->frame_types[ctx->display_idx];
|
||||
dst_buf->flags |= ctx->frame_types[ctx->display_idx];
|
||||
meta = &ctx->frame_metas[ctx->display_idx];
|
||||
dst_buf->v4l2_buf.timecode = meta->timecode;
|
||||
dst_buf->v4l2_buf.timestamp = meta->timestamp;
|
||||
dst_buf->timecode = meta->timecode;
|
||||
dst_buf->timestamp = meta->timestamp;
|
||||
|
||||
trace_coda_dec_rot_done(ctx, dst_buf, meta);
|
||||
|
||||
|
|
@ -2052,15 +2055,15 @@ static void coda_finish_decode(struct coda_ctx *ctx)
|
|||
payload = width * height * 2;
|
||||
break;
|
||||
}
|
||||
vb2_set_plane_payload(dst_buf, 0, payload);
|
||||
vb2_set_plane_payload(&dst_buf->vb2_buf, 0, payload);
|
||||
|
||||
coda_m2m_buf_done(ctx, dst_buf, ctx->frame_errors[display_idx] ?
|
||||
VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE);
|
||||
|
||||
v4l2_dbg(1, coda_debug, &dev->v4l2_dev,
|
||||
"job finished: decoding frame (%d) (%s)\n",
|
||||
dst_buf->v4l2_buf.sequence,
|
||||
(dst_buf->v4l2_buf.flags & V4L2_BUF_FLAG_KEYFRAME) ?
|
||||
dst_buf->sequence,
|
||||
(dst_buf->flags & V4L2_BUF_FLAG_KEYFRAME) ?
|
||||
"KEYFRAME" : "PFRAME");
|
||||
} else {
|
||||
v4l2_dbg(1, coda_debug, &dev->v4l2_dev,
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
#include <media/v4l2-event.h>
|
||||
#include <media/v4l2-ioctl.h>
|
||||
#include <media/v4l2-mem2mem.h>
|
||||
#include <media/videobuf2-core.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
#include <media/videobuf2-dma-contig.h>
|
||||
#include <media/videobuf2-vmalloc.h>
|
||||
|
||||
|
|
@ -84,9 +84,9 @@ unsigned int coda_read(struct coda_dev *dev, u32 reg)
|
|||
}
|
||||
|
||||
void coda_write_base(struct coda_ctx *ctx, struct coda_q_data *q_data,
|
||||
struct vb2_buffer *buf, unsigned int reg_y)
|
||||
struct vb2_v4l2_buffer *buf, unsigned int reg_y)
|
||||
{
|
||||
u32 base_y = vb2_dma_contig_plane_dma_addr(buf, 0);
|
||||
u32 base_y = vb2_dma_contig_plane_dma_addr(&buf->vb2_buf, 0);
|
||||
u32 base_cb, base_cr;
|
||||
|
||||
switch (q_data->fourcc) {
|
||||
|
|
@ -684,17 +684,17 @@ static int coda_qbuf(struct file *file, void *priv,
|
|||
}
|
||||
|
||||
static bool coda_buf_is_end_of_stream(struct coda_ctx *ctx,
|
||||
struct vb2_buffer *buf)
|
||||
struct vb2_v4l2_buffer *buf)
|
||||
{
|
||||
struct vb2_queue *src_vq;
|
||||
|
||||
src_vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
|
||||
|
||||
return ((ctx->bit_stream_param & CODA_BIT_STREAM_END_FLAG) &&
|
||||
(buf->v4l2_buf.sequence == (ctx->qsequence - 1)));
|
||||
(buf->sequence == (ctx->qsequence - 1)));
|
||||
}
|
||||
|
||||
void coda_m2m_buf_done(struct coda_ctx *ctx, struct vb2_buffer *buf,
|
||||
void coda_m2m_buf_done(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf,
|
||||
enum vb2_buffer_state state)
|
||||
{
|
||||
const struct v4l2_event eos_event = {
|
||||
|
|
@ -702,7 +702,7 @@ void coda_m2m_buf_done(struct coda_ctx *ctx, struct vb2_buffer *buf,
|
|||
};
|
||||
|
||||
if (coda_buf_is_end_of_stream(ctx, buf)) {
|
||||
buf->v4l2_buf.flags |= V4L2_BUF_FLAG_LAST;
|
||||
buf->flags |= V4L2_BUF_FLAG_LAST;
|
||||
|
||||
v4l2_event_queue_fh(&ctx->fh, &eos_event);
|
||||
}
|
||||
|
|
@ -1131,8 +1131,7 @@ static void set_default_params(struct coda_ctx *ctx)
|
|||
/*
|
||||
* Queue operations
|
||||
*/
|
||||
static int coda_queue_setup(struct vb2_queue *vq,
|
||||
const struct v4l2_format *fmt,
|
||||
static int coda_queue_setup(struct vb2_queue *vq, const void *parg,
|
||||
unsigned int *nbuffers, unsigned int *nplanes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
|
|
@ -1175,6 +1174,7 @@ static int coda_buf_prepare(struct vb2_buffer *vb)
|
|||
|
||||
static void coda_buf_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct coda_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
|
||||
struct vb2_queue *vq = vb->vb2_queue;
|
||||
struct coda_q_data *q_data;
|
||||
|
|
@ -1193,12 +1193,12 @@ static void coda_buf_queue(struct vb2_buffer *vb)
|
|||
if (vb2_get_plane_payload(vb, 0) == 0)
|
||||
coda_bit_stream_end_flag(ctx);
|
||||
mutex_lock(&ctx->bitstream_mutex);
|
||||
v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vb);
|
||||
v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf);
|
||||
if (vb2_is_streaming(vb->vb2_queue))
|
||||
coda_fill_bitstream(ctx, true);
|
||||
mutex_unlock(&ctx->bitstream_mutex);
|
||||
} else {
|
||||
v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vb);
|
||||
v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1247,7 +1247,7 @@ static int coda_start_streaming(struct vb2_queue *q, unsigned int count)
|
|||
struct coda_ctx *ctx = vb2_get_drv_priv(q);
|
||||
struct v4l2_device *v4l2_dev = &ctx->dev->v4l2_dev;
|
||||
struct coda_q_data *q_data_src, *q_data_dst;
|
||||
struct vb2_buffer *buf;
|
||||
struct vb2_v4l2_buffer *buf;
|
||||
int ret = 0;
|
||||
|
||||
q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
|
||||
|
|
@ -1338,7 +1338,7 @@ static void coda_stop_streaming(struct vb2_queue *q)
|
|||
{
|
||||
struct coda_ctx *ctx = vb2_get_drv_priv(q);
|
||||
struct coda_dev *dev = ctx->dev;
|
||||
struct vb2_buffer *buf;
|
||||
struct vb2_v4l2_buffer *buf;
|
||||
unsigned long flags;
|
||||
bool stop;
|
||||
|
||||
|
|
|
|||
|
|
@ -178,12 +178,12 @@ int coda_jpeg_write_tables(struct coda_ctx *ctx)
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool coda_jpeg_check_buffer(struct coda_ctx *ctx, struct vb2_buffer *vb)
|
||||
bool coda_jpeg_check_buffer(struct coda_ctx *ctx, struct vb2_v4l2_buffer *vb)
|
||||
{
|
||||
void *vaddr = vb2_plane_vaddr(vb, 0);
|
||||
void *vaddr = vb2_plane_vaddr(&vb->vb2_buf, 0);
|
||||
u16 soi = be16_to_cpup((__be16 *)vaddr);
|
||||
u16 eoi = be16_to_cpup((__be16 *)(vaddr +
|
||||
vb2_get_plane_payload(vb, 0) - 2));
|
||||
vb2_get_plane_payload(&vb->vb2_buf, 0) - 2));
|
||||
|
||||
return soi == SOI_MARKER && eoi == EOI_MARKER;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include <media/v4l2-ctrls.h>
|
||||
#include <media/v4l2-device.h>
|
||||
#include <media/v4l2-fh.h>
|
||||
#include <media/videobuf2-core.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
|
||||
#include "coda_regs.h"
|
||||
|
||||
|
|
@ -243,7 +243,7 @@ extern int coda_debug;
|
|||
void coda_write(struct coda_dev *dev, u32 data, u32 reg);
|
||||
unsigned int coda_read(struct coda_dev *dev, u32 reg);
|
||||
void coda_write_base(struct coda_ctx *ctx, struct coda_q_data *q_data,
|
||||
struct vb2_buffer *buf, unsigned int reg_y);
|
||||
struct vb2_v4l2_buffer *buf, unsigned int reg_y);
|
||||
|
||||
int coda_alloc_aux_buf(struct coda_dev *dev, struct coda_aux_buf *buf,
|
||||
size_t size, const char *name, struct dentry *parent);
|
||||
|
|
@ -284,12 +284,12 @@ static inline unsigned int coda_get_bitstream_payload(struct coda_ctx *ctx)
|
|||
|
||||
void coda_bit_stream_end_flag(struct coda_ctx *ctx);
|
||||
|
||||
void coda_m2m_buf_done(struct coda_ctx *ctx, struct vb2_buffer *buf,
|
||||
void coda_m2m_buf_done(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf,
|
||||
enum vb2_buffer_state state);
|
||||
|
||||
int coda_h264_padding(int size, char *p);
|
||||
|
||||
bool coda_jpeg_check_buffer(struct coda_ctx *ctx, struct vb2_buffer *vb);
|
||||
bool coda_jpeg_check_buffer(struct coda_ctx *ctx, struct vb2_v4l2_buffer *vb);
|
||||
int coda_jpeg_write_tables(struct coda_ctx *ctx);
|
||||
void coda_set_jpeg_compression_quality(struct coda_ctx *ctx, int quality);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#define __CODA_TRACE_H__
|
||||
|
||||
#include <linux/tracepoint.h>
|
||||
#include <media/videobuf2-core.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
|
||||
#include "coda.h"
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ TRACE_EVENT(coda_bit_done,
|
|||
);
|
||||
|
||||
DECLARE_EVENT_CLASS(coda_buf_class,
|
||||
TP_PROTO(struct coda_ctx *ctx, struct vb2_buffer *buf),
|
||||
TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf),
|
||||
|
||||
TP_ARGS(ctx, buf),
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ DECLARE_EVENT_CLASS(coda_buf_class,
|
|||
|
||||
TP_fast_assign(
|
||||
__entry->minor = ctx->fh.vdev->minor;
|
||||
__entry->index = buf->v4l2_buf.index;
|
||||
__entry->index = buf->vb2_buf.index;
|
||||
__entry->ctx = ctx->idx;
|
||||
),
|
||||
|
||||
|
|
@ -70,17 +70,17 @@ DECLARE_EVENT_CLASS(coda_buf_class,
|
|||
);
|
||||
|
||||
DEFINE_EVENT(coda_buf_class, coda_enc_pic_run,
|
||||
TP_PROTO(struct coda_ctx *ctx, struct vb2_buffer *buf),
|
||||
TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf),
|
||||
TP_ARGS(ctx, buf)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(coda_buf_class, coda_enc_pic_done,
|
||||
TP_PROTO(struct coda_ctx *ctx, struct vb2_buffer *buf),
|
||||
TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf),
|
||||
TP_ARGS(ctx, buf)
|
||||
);
|
||||
|
||||
DECLARE_EVENT_CLASS(coda_buf_meta_class,
|
||||
TP_PROTO(struct coda_ctx *ctx, struct vb2_buffer *buf,
|
||||
TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf,
|
||||
struct coda_buffer_meta *meta),
|
||||
|
||||
TP_ARGS(ctx, buf, meta),
|
||||
|
|
@ -95,7 +95,7 @@ DECLARE_EVENT_CLASS(coda_buf_meta_class,
|
|||
|
||||
TP_fast_assign(
|
||||
__entry->minor = ctx->fh.vdev->minor;
|
||||
__entry->index = buf->v4l2_buf.index;
|
||||
__entry->index = buf->vb2_buf.index;
|
||||
__entry->start = meta->start;
|
||||
__entry->end = meta->end;
|
||||
__entry->ctx = ctx->idx;
|
||||
|
|
@ -107,7 +107,7 @@ DECLARE_EVENT_CLASS(coda_buf_meta_class,
|
|||
);
|
||||
|
||||
DEFINE_EVENT(coda_buf_meta_class, coda_bit_queue,
|
||||
TP_PROTO(struct coda_ctx *ctx, struct vb2_buffer *buf,
|
||||
TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf,
|
||||
struct coda_buffer_meta *meta),
|
||||
TP_ARGS(ctx, buf, meta)
|
||||
);
|
||||
|
|
@ -146,7 +146,7 @@ DEFINE_EVENT(coda_meta_class, coda_dec_pic_done,
|
|||
);
|
||||
|
||||
DEFINE_EVENT(coda_buf_meta_class, coda_dec_rot_done,
|
||||
TP_PROTO(struct coda_ctx *ctx, struct vb2_buffer *buf,
|
||||
TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf,
|
||||
struct coda_buffer_meta *meta),
|
||||
TP_ARGS(ctx, buf, meta)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -74,8 +74,8 @@ static void vpbe_isr_even_field(struct vpbe_display *disp_obj,
|
|||
if (layer->cur_frm == layer->next_frm)
|
||||
return;
|
||||
|
||||
v4l2_get_timestamp(&layer->cur_frm->vb.v4l2_buf.timestamp);
|
||||
vb2_buffer_done(&layer->cur_frm->vb, VB2_BUF_STATE_DONE);
|
||||
v4l2_get_timestamp(&layer->cur_frm->vb.timestamp);
|
||||
vb2_buffer_done(&layer->cur_frm->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
||||
/* Make cur_frm pointing to next_frm */
|
||||
layer->cur_frm = layer->next_frm;
|
||||
}
|
||||
|
|
@ -104,8 +104,8 @@ static void vpbe_isr_odd_field(struct vpbe_display *disp_obj,
|
|||
list_del(&layer->next_frm->list);
|
||||
spin_unlock(&disp_obj->dma_queue_lock);
|
||||
/* Mark state of the frame to active */
|
||||
layer->next_frm->vb.state = VB2_BUF_STATE_ACTIVE;
|
||||
addr = vb2_dma_contig_plane_dma_addr(&layer->next_frm->vb, 0);
|
||||
layer->next_frm->vb.vb2_buf.state = VB2_BUF_STATE_ACTIVE;
|
||||
addr = vb2_dma_contig_plane_dma_addr(&layer->next_frm->vb.vb2_buf, 0);
|
||||
osd_device->ops.start_layer(osd_device,
|
||||
layer->layer_info.id,
|
||||
addr,
|
||||
|
|
@ -228,11 +228,12 @@ static int vpbe_buffer_prepare(struct vb2_buffer *vb)
|
|||
* This function allocates memory for the buffers
|
||||
*/
|
||||
static int
|
||||
vpbe_buffer_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
|
||||
vpbe_buffer_queue_setup(struct vb2_queue *vq, const void *parg,
|
||||
unsigned int *nbuffers, unsigned int *nplanes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
|
||||
{
|
||||
const struct v4l2_format *fmt = parg;
|
||||
/* Get the file handle object and layer object */
|
||||
struct vpbe_layer *layer = vb2_get_drv_priv(vq);
|
||||
struct vpbe_device *vpbe_dev = layer->disp_dev->vpbe_dev;
|
||||
|
|
@ -259,8 +260,9 @@ vpbe_buffer_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
|
|||
*/
|
||||
static void vpbe_buffer_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
/* Get the file handle object and layer object */
|
||||
struct vpbe_disp_buffer *buf = container_of(vb,
|
||||
struct vpbe_disp_buffer *buf = container_of(vbuf,
|
||||
struct vpbe_disp_buffer, vb);
|
||||
struct vpbe_layer *layer = vb2_get_drv_priv(vb->vb2_queue);
|
||||
struct vpbe_display *disp = layer->disp_dev;
|
||||
|
|
@ -290,7 +292,7 @@ static int vpbe_start_streaming(struct vb2_queue *vq, unsigned int count)
|
|||
/* Remove buffer from the buffer queue */
|
||||
list_del(&layer->cur_frm->list);
|
||||
/* Mark state of the current frame to active */
|
||||
layer->cur_frm->vb.state = VB2_BUF_STATE_ACTIVE;
|
||||
layer->cur_frm->vb.vb2_buf.state = VB2_BUF_STATE_ACTIVE;
|
||||
/* Initialize field_id and started member */
|
||||
layer->field_id = 0;
|
||||
|
||||
|
|
@ -299,10 +301,12 @@ static int vpbe_start_streaming(struct vb2_queue *vq, unsigned int count)
|
|||
if (ret < 0) {
|
||||
struct vpbe_disp_buffer *buf, *tmp;
|
||||
|
||||
vb2_buffer_done(&layer->cur_frm->vb, VB2_BUF_STATE_QUEUED);
|
||||
vb2_buffer_done(&layer->cur_frm->vb.vb2_buf,
|
||||
VB2_BUF_STATE_QUEUED);
|
||||
list_for_each_entry_safe(buf, tmp, &layer->dma_queue, list) {
|
||||
list_del(&buf->list);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf,
|
||||
VB2_BUF_STATE_QUEUED);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
@ -332,13 +336,14 @@ static void vpbe_stop_streaming(struct vb2_queue *vq)
|
|||
/* release all active buffers */
|
||||
spin_lock_irqsave(&disp->dma_queue_lock, flags);
|
||||
if (layer->cur_frm == layer->next_frm) {
|
||||
vb2_buffer_done(&layer->cur_frm->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&layer->cur_frm->vb.vb2_buf,
|
||||
VB2_BUF_STATE_ERROR);
|
||||
} else {
|
||||
if (layer->cur_frm != NULL)
|
||||
vb2_buffer_done(&layer->cur_frm->vb,
|
||||
vb2_buffer_done(&layer->cur_frm->vb.vb2_buf,
|
||||
VB2_BUF_STATE_ERROR);
|
||||
if (layer->next_frm != NULL)
|
||||
vb2_buffer_done(&layer->next_frm->vb,
|
||||
vb2_buffer_done(&layer->next_frm->vb.vb2_buf,
|
||||
VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
|
||||
|
|
@ -346,7 +351,8 @@ static void vpbe_stop_streaming(struct vb2_queue *vq)
|
|||
layer->next_frm = list_entry(layer->dma_queue.next,
|
||||
struct vpbe_disp_buffer, list);
|
||||
list_del(&layer->next_frm->list);
|
||||
vb2_buffer_done(&layer->next_frm->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&layer->next_frm->vb.vb2_buf,
|
||||
VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
spin_unlock_irqrestore(&disp->dma_queue_lock, flags);
|
||||
}
|
||||
|
|
@ -383,7 +389,7 @@ static int vpbe_set_osd_display_params(struct vpbe_display *disp_dev,
|
|||
unsigned long addr;
|
||||
int ret;
|
||||
|
||||
addr = vb2_dma_contig_plane_dma_addr(&layer->cur_frm->vb, 0);
|
||||
addr = vb2_dma_contig_plane_dma_addr(&layer->cur_frm->vb.vb2_buf, 0);
|
||||
/* Set address in the display registers */
|
||||
osd_device->ops.start_layer(osd_device,
|
||||
layer->layer_info.id,
|
||||
|
|
|
|||
|
|
@ -57,7 +57,8 @@ static u8 channel_first_int[VPIF_NUMBER_OF_OBJECTS][2] = { {1, 1} };
|
|||
/* Is set to 1 in case of SDTV formats, 2 in case of HDTV formats. */
|
||||
static int ycmux_mode;
|
||||
|
||||
static inline struct vpif_cap_buffer *to_vpif_buffer(struct vb2_buffer *vb)
|
||||
static inline
|
||||
struct vpif_cap_buffer *to_vpif_buffer(struct vb2_v4l2_buffer *vb)
|
||||
{
|
||||
return container_of(vb, struct vpif_cap_buffer, vb);
|
||||
}
|
||||
|
|
@ -72,6 +73,7 @@ static inline struct vpif_cap_buffer *to_vpif_buffer(struct vb2_buffer *vb)
|
|||
*/
|
||||
static int vpif_buffer_prepare(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct vb2_queue *q = vb->vb2_queue;
|
||||
struct channel_obj *ch = vb2_get_drv_priv(q);
|
||||
struct common_obj *common;
|
||||
|
|
@ -85,7 +87,7 @@ static int vpif_buffer_prepare(struct vb2_buffer *vb)
|
|||
if (vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0))
|
||||
return -EINVAL;
|
||||
|
||||
vb->v4l2_buf.field = common->fmt.fmt.pix.field;
|
||||
vbuf->field = common->fmt.fmt.pix.field;
|
||||
|
||||
addr = vb2_dma_contig_plane_dma_addr(vb, 0);
|
||||
if (!IS_ALIGNED((addr + common->ytop_off), 8) ||
|
||||
|
|
@ -112,10 +114,11 @@ static int vpif_buffer_prepare(struct vb2_buffer *vb)
|
|||
* the buffer count and buffer size
|
||||
*/
|
||||
static int vpif_buffer_queue_setup(struct vb2_queue *vq,
|
||||
const struct v4l2_format *fmt,
|
||||
const void *parg,
|
||||
unsigned int *nbuffers, unsigned int *nplanes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
const struct v4l2_format *fmt = parg;
|
||||
struct channel_obj *ch = vb2_get_drv_priv(vq);
|
||||
struct common_obj *common;
|
||||
|
||||
|
|
@ -145,8 +148,9 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq,
|
|||
*/
|
||||
static void vpif_buffer_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct channel_obj *ch = vb2_get_drv_priv(vb->vb2_queue);
|
||||
struct vpif_cap_buffer *buf = to_vpif_buffer(vb);
|
||||
struct vpif_cap_buffer *buf = to_vpif_buffer(vbuf);
|
||||
struct common_obj *common;
|
||||
unsigned long flags;
|
||||
|
||||
|
|
@ -214,7 +218,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
|
|||
list_del(&common->cur_frm->list);
|
||||
spin_unlock_irqrestore(&common->irqlock, flags);
|
||||
|
||||
addr = vb2_dma_contig_plane_dma_addr(&common->cur_frm->vb, 0);
|
||||
addr = vb2_dma_contig_plane_dma_addr(&common->cur_frm->vb.vb2_buf, 0);
|
||||
|
||||
common->set_addr(addr + common->ytop_off,
|
||||
addr + common->ybtm_off,
|
||||
|
|
@ -243,7 +247,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
|
|||
err:
|
||||
list_for_each_entry_safe(buf, tmp, &common->dma_queue, list) {
|
||||
list_del(&buf->list);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED);
|
||||
}
|
||||
spin_unlock_irqrestore(&common->irqlock, flags);
|
||||
|
||||
|
|
@ -286,13 +290,14 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
|
|||
/* release all active buffers */
|
||||
spin_lock_irqsave(&common->irqlock, flags);
|
||||
if (common->cur_frm == common->next_frm) {
|
||||
vb2_buffer_done(&common->cur_frm->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&common->cur_frm->vb.vb2_buf,
|
||||
VB2_BUF_STATE_ERROR);
|
||||
} else {
|
||||
if (common->cur_frm != NULL)
|
||||
vb2_buffer_done(&common->cur_frm->vb,
|
||||
vb2_buffer_done(&common->cur_frm->vb.vb2_buf,
|
||||
VB2_BUF_STATE_ERROR);
|
||||
if (common->next_frm != NULL)
|
||||
vb2_buffer_done(&common->next_frm->vb,
|
||||
vb2_buffer_done(&common->next_frm->vb.vb2_buf,
|
||||
VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
|
||||
|
|
@ -300,7 +305,8 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
|
|||
common->next_frm = list_entry(common->dma_queue.next,
|
||||
struct vpif_cap_buffer, list);
|
||||
list_del(&common->next_frm->list);
|
||||
vb2_buffer_done(&common->next_frm->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&common->next_frm->vb.vb2_buf,
|
||||
VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
spin_unlock_irqrestore(&common->irqlock, flags);
|
||||
}
|
||||
|
|
@ -325,9 +331,8 @@ static struct vb2_ops video_qops = {
|
|||
*/
|
||||
static void vpif_process_buffer_complete(struct common_obj *common)
|
||||
{
|
||||
v4l2_get_timestamp(&common->cur_frm->vb.v4l2_buf.timestamp);
|
||||
vb2_buffer_done(&common->cur_frm->vb,
|
||||
VB2_BUF_STATE_DONE);
|
||||
v4l2_get_timestamp(&common->cur_frm->vb.timestamp);
|
||||
vb2_buffer_done(&common->cur_frm->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
||||
/* Make curFrm pointing to nextFrm */
|
||||
common->cur_frm = common->next_frm;
|
||||
}
|
||||
|
|
@ -350,7 +355,7 @@ static void vpif_schedule_next_buffer(struct common_obj *common)
|
|||
/* Remove that buffer from the buffer queue */
|
||||
list_del(&common->next_frm->list);
|
||||
spin_unlock(&common->irqlock);
|
||||
addr = vb2_dma_contig_plane_dma_addr(&common->next_frm->vb, 0);
|
||||
addr = vb2_dma_contig_plane_dma_addr(&common->next_frm->vb.vb2_buf, 0);
|
||||
|
||||
/* Set top and bottom field addresses in VPIF registers */
|
||||
common->set_addr(addr + common->ytop_off,
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ struct video_obj {
|
|||
};
|
||||
|
||||
struct vpif_cap_buffer {
|
||||
struct vb2_buffer vb;
|
||||
struct vb2_v4l2_buffer vb;
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,8 @@ static struct device *vpif_dev;
|
|||
static void vpif_calculate_offsets(struct channel_obj *ch);
|
||||
static void vpif_config_addr(struct channel_obj *ch, int muxmode);
|
||||
|
||||
static inline struct vpif_disp_buffer *to_vpif_buffer(struct vb2_buffer *vb)
|
||||
static inline
|
||||
struct vpif_disp_buffer *to_vpif_buffer(struct vb2_v4l2_buffer *vb)
|
||||
{
|
||||
return container_of(vb, struct vpif_disp_buffer, vb);
|
||||
}
|
||||
|
|
@ -68,6 +69,7 @@ static inline struct vpif_disp_buffer *to_vpif_buffer(struct vb2_buffer *vb)
|
|||
*/
|
||||
static int vpif_buffer_prepare(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct channel_obj *ch = vb2_get_drv_priv(vb->vb2_queue);
|
||||
struct common_obj *common;
|
||||
|
||||
|
|
@ -77,7 +79,7 @@ static int vpif_buffer_prepare(struct vb2_buffer *vb)
|
|||
if (vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0))
|
||||
return -EINVAL;
|
||||
|
||||
vb->v4l2_buf.field = common->fmt.fmt.pix.field;
|
||||
vbuf->field = common->fmt.fmt.pix.field;
|
||||
|
||||
if (vb->vb2_queue->type != V4L2_BUF_TYPE_SLICED_VBI_OUTPUT) {
|
||||
unsigned long addr = vb2_dma_contig_plane_dma_addr(vb, 0);
|
||||
|
|
@ -107,10 +109,11 @@ static int vpif_buffer_prepare(struct vb2_buffer *vb)
|
|||
* the buffer count and buffer size
|
||||
*/
|
||||
static int vpif_buffer_queue_setup(struct vb2_queue *vq,
|
||||
const struct v4l2_format *fmt,
|
||||
const void *parg,
|
||||
unsigned int *nbuffers, unsigned int *nplanes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
const struct v4l2_format *fmt = parg;
|
||||
struct channel_obj *ch = vb2_get_drv_priv(vq);
|
||||
struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
|
||||
|
||||
|
|
@ -138,7 +141,8 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq,
|
|||
*/
|
||||
static void vpif_buffer_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vpif_disp_buffer *buf = to_vpif_buffer(vb);
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct vpif_disp_buffer *buf = to_vpif_buffer(vbuf);
|
||||
struct channel_obj *ch = vb2_get_drv_priv(vb->vb2_queue);
|
||||
struct common_obj *common;
|
||||
unsigned long flags;
|
||||
|
|
@ -197,7 +201,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
|
|||
list_del(&common->cur_frm->list);
|
||||
spin_unlock_irqrestore(&common->irqlock, flags);
|
||||
|
||||
addr = vb2_dma_contig_plane_dma_addr(&common->cur_frm->vb, 0);
|
||||
addr = vb2_dma_contig_plane_dma_addr(&common->cur_frm->vb.vb2_buf, 0);
|
||||
common->set_addr((addr + common->ytop_off),
|
||||
(addr + common->ybtm_off),
|
||||
(addr + common->ctop_off),
|
||||
|
|
@ -229,7 +233,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
|
|||
err:
|
||||
list_for_each_entry_safe(buf, tmp, &common->dma_queue, list) {
|
||||
list_del(&buf->list);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED);
|
||||
}
|
||||
spin_unlock_irqrestore(&common->irqlock, flags);
|
||||
|
||||
|
|
@ -264,13 +268,14 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
|
|||
/* release all active buffers */
|
||||
spin_lock_irqsave(&common->irqlock, flags);
|
||||
if (common->cur_frm == common->next_frm) {
|
||||
vb2_buffer_done(&common->cur_frm->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&common->cur_frm->vb.vb2_buf,
|
||||
VB2_BUF_STATE_ERROR);
|
||||
} else {
|
||||
if (common->cur_frm != NULL)
|
||||
vb2_buffer_done(&common->cur_frm->vb,
|
||||
vb2_buffer_done(&common->cur_frm->vb.vb2_buf,
|
||||
VB2_BUF_STATE_ERROR);
|
||||
if (common->next_frm != NULL)
|
||||
vb2_buffer_done(&common->next_frm->vb,
|
||||
vb2_buffer_done(&common->next_frm->vb.vb2_buf,
|
||||
VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
|
||||
|
|
@ -278,7 +283,8 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
|
|||
common->next_frm = list_entry(common->dma_queue.next,
|
||||
struct vpif_disp_buffer, list);
|
||||
list_del(&common->next_frm->list);
|
||||
vb2_buffer_done(&common->next_frm->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&common->next_frm->vb.vb2_buf,
|
||||
VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
spin_unlock_irqrestore(&common->irqlock, flags);
|
||||
}
|
||||
|
|
@ -306,7 +312,7 @@ static void process_progressive_mode(struct common_obj *common)
|
|||
spin_unlock(&common->irqlock);
|
||||
|
||||
/* Set top and bottom field addrs in VPIF registers */
|
||||
addr = vb2_dma_contig_plane_dma_addr(&common->next_frm->vb, 0);
|
||||
addr = vb2_dma_contig_plane_dma_addr(&common->next_frm->vb.vb2_buf, 0);
|
||||
common->set_addr(addr + common->ytop_off,
|
||||
addr + common->ybtm_off,
|
||||
addr + common->ctop_off,
|
||||
|
|
@ -324,10 +330,10 @@ static void process_interlaced_mode(int fid, struct common_obj *common)
|
|||
/* one frame is displayed If next frame is
|
||||
* available, release cur_frm and move on */
|
||||
/* Copy frame display time */
|
||||
v4l2_get_timestamp(&common->cur_frm->vb.v4l2_buf.timestamp);
|
||||
v4l2_get_timestamp(&common->cur_frm->vb.timestamp);
|
||||
/* Change status of the cur_frm */
|
||||
vb2_buffer_done(&common->cur_frm->vb,
|
||||
VB2_BUF_STATE_DONE);
|
||||
vb2_buffer_done(&common->cur_frm->vb.vb2_buf,
|
||||
VB2_BUF_STATE_DONE);
|
||||
/* Make cur_frm pointing to next_frm */
|
||||
common->cur_frm = common->next_frm;
|
||||
|
||||
|
|
@ -380,10 +386,10 @@ static irqreturn_t vpif_channel_isr(int irq, void *dev_id)
|
|||
if (!channel_first_int[i][channel_id]) {
|
||||
/* Mark status of the cur_frm to
|
||||
* done and unlock semaphore on it */
|
||||
v4l2_get_timestamp(&common->cur_frm->vb.
|
||||
v4l2_buf.timestamp);
|
||||
vb2_buffer_done(&common->cur_frm->vb,
|
||||
VB2_BUF_STATE_DONE);
|
||||
v4l2_get_timestamp(
|
||||
&common->cur_frm->vb.timestamp);
|
||||
vb2_buffer_done(&common->cur_frm->vb.vb2_buf,
|
||||
VB2_BUF_STATE_DONE);
|
||||
/* Make cur_frm pointing to next_frm */
|
||||
common->cur_frm = common->next_frm;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ struct video_obj {
|
|||
};
|
||||
|
||||
struct vpif_disp_buffer {
|
||||
struct vb2_buffer vb;
|
||||
struct vb2_v4l2_buffer vb;
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include <linux/videodev2.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <media/videobuf2-core.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
#include <media/v4l2-ctrls.h>
|
||||
#include <media/v4l2-device.h>
|
||||
#include <media/v4l2-mem2mem.h>
|
||||
|
|
@ -136,7 +136,7 @@ struct gsc_fmt {
|
|||
* @idx : index of G-Scaler input buffer
|
||||
*/
|
||||
struct gsc_input_buf {
|
||||
struct vb2_buffer vb;
|
||||
struct vb2_v4l2_buffer vb;
|
||||
struct list_head list;
|
||||
int idx;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ static void gsc_m2m_stop_streaming(struct vb2_queue *q)
|
|||
|
||||
void gsc_m2m_job_finish(struct gsc_ctx *ctx, int vb_state)
|
||||
{
|
||||
struct vb2_buffer *src_vb, *dst_vb;
|
||||
struct vb2_v4l2_buffer *src_vb, *dst_vb;
|
||||
|
||||
if (!ctx || !ctx->m2m_ctx)
|
||||
return;
|
||||
|
|
@ -86,11 +86,11 @@ void gsc_m2m_job_finish(struct gsc_ctx *ctx, int vb_state)
|
|||
dst_vb = v4l2_m2m_dst_buf_remove(ctx->m2m_ctx);
|
||||
|
||||
if (src_vb && dst_vb) {
|
||||
dst_vb->v4l2_buf.timestamp = src_vb->v4l2_buf.timestamp;
|
||||
dst_vb->v4l2_buf.timecode = src_vb->v4l2_buf.timecode;
|
||||
dst_vb->v4l2_buf.flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
|
||||
dst_vb->v4l2_buf.flags |=
|
||||
src_vb->v4l2_buf.flags
|
||||
dst_vb->timestamp = src_vb->timestamp;
|
||||
dst_vb->timecode = src_vb->timecode;
|
||||
dst_vb->flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
|
||||
dst_vb->flags |=
|
||||
src_vb->flags
|
||||
& V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
|
||||
|
||||
v4l2_m2m_buf_done(src_vb, vb_state);
|
||||
|
|
@ -109,23 +109,23 @@ static void gsc_m2m_job_abort(void *priv)
|
|||
static int gsc_get_bufs(struct gsc_ctx *ctx)
|
||||
{
|
||||
struct gsc_frame *s_frame, *d_frame;
|
||||
struct vb2_buffer *src_vb, *dst_vb;
|
||||
struct vb2_v4l2_buffer *src_vb, *dst_vb;
|
||||
int ret;
|
||||
|
||||
s_frame = &ctx->s_frame;
|
||||
d_frame = &ctx->d_frame;
|
||||
|
||||
src_vb = v4l2_m2m_next_src_buf(ctx->m2m_ctx);
|
||||
ret = gsc_prepare_addr(ctx, src_vb, s_frame, &s_frame->addr);
|
||||
ret = gsc_prepare_addr(ctx, &src_vb->vb2_buf, s_frame, &s_frame->addr);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
dst_vb = v4l2_m2m_next_dst_buf(ctx->m2m_ctx);
|
||||
ret = gsc_prepare_addr(ctx, dst_vb, d_frame, &d_frame->addr);
|
||||
ret = gsc_prepare_addr(ctx, &dst_vb->vb2_buf, d_frame, &d_frame->addr);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
dst_vb->v4l2_buf.timestamp = src_vb->v4l2_buf.timestamp;
|
||||
dst_vb->timestamp = src_vb->timestamp;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -212,7 +212,7 @@ put_device:
|
|||
}
|
||||
|
||||
static int gsc_m2m_queue_setup(struct vb2_queue *vq,
|
||||
const struct v4l2_format *fmt,
|
||||
const void *parg,
|
||||
unsigned int *num_buffers, unsigned int *num_planes,
|
||||
unsigned int sizes[], void *allocators[])
|
||||
{
|
||||
|
|
@ -255,12 +255,13 @@ static int gsc_m2m_buf_prepare(struct vb2_buffer *vb)
|
|||
|
||||
static void gsc_m2m_buf_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct gsc_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
|
||||
|
||||
pr_debug("ctx: %p, ctx->state: 0x%x", ctx, ctx->state);
|
||||
|
||||
if (ctx->m2m_ctx)
|
||||
v4l2_m2m_buf_queue(ctx->m2m_ctx, vb);
|
||||
v4l2_m2m_buf_queue(ctx->m2m_ctx, vbuf);
|
||||
}
|
||||
|
||||
static struct vb2_ops gsc_m2m_qops = {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include <media/v4l2-device.h>
|
||||
#include <media/v4l2-ioctl.h>
|
||||
#include <media/v4l2-mem2mem.h>
|
||||
#include <media/videobuf2-core.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
#include <media/videobuf2-dma-contig.h>
|
||||
|
||||
#include "common.h"
|
||||
|
|
@ -103,7 +103,7 @@ static int fimc_capture_state_cleanup(struct fimc_dev *fimc, bool suspend)
|
|||
/* Release unused buffers */
|
||||
while (!suspend && !list_empty(&cap->pending_buf_q)) {
|
||||
buf = fimc_pending_queue_pop(cap);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
/* If suspending put unused buffers onto pending queue */
|
||||
while (!list_empty(&cap->active_buf_q)) {
|
||||
|
|
@ -111,7 +111,7 @@ static int fimc_capture_state_cleanup(struct fimc_dev *fimc, bool suspend)
|
|||
if (suspend)
|
||||
fimc_pending_queue_add(cap, buf);
|
||||
else
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
|
||||
fimc_hw_reset(fimc);
|
||||
|
|
@ -183,8 +183,6 @@ void fimc_capture_irq_handler(struct fimc_dev *fimc, int deq_buf)
|
|||
struct v4l2_subdev *csis = p->subdevs[IDX_CSIS];
|
||||
struct fimc_frame *f = &cap->ctx->d_frame;
|
||||
struct fimc_vid_buffer *v_buf;
|
||||
struct timeval *tv;
|
||||
struct timespec ts;
|
||||
|
||||
if (test_and_clear_bit(ST_CAPT_SHUT, &fimc->state)) {
|
||||
wake_up(&fimc->irq_queue);
|
||||
|
|
@ -193,16 +191,12 @@ void fimc_capture_irq_handler(struct fimc_dev *fimc, int deq_buf)
|
|||
|
||||
if (!list_empty(&cap->active_buf_q) &&
|
||||
test_bit(ST_CAPT_RUN, &fimc->state) && deq_buf) {
|
||||
ktime_get_real_ts(&ts);
|
||||
|
||||
v_buf = fimc_active_queue_pop(cap);
|
||||
|
||||
tv = &v_buf->vb.v4l2_buf.timestamp;
|
||||
tv->tv_sec = ts.tv_sec;
|
||||
tv->tv_usec = ts.tv_nsec / NSEC_PER_USEC;
|
||||
v_buf->vb.v4l2_buf.sequence = cap->frame_count++;
|
||||
v4l2_get_timestamp(&v_buf->vb.timestamp);
|
||||
v_buf->vb.sequence = cap->frame_count++;
|
||||
|
||||
vb2_buffer_done(&v_buf->vb, VB2_BUF_STATE_DONE);
|
||||
vb2_buffer_done(&v_buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
||||
}
|
||||
|
||||
if (!list_empty(&cap->pending_buf_q)) {
|
||||
|
|
@ -233,7 +227,7 @@ void fimc_capture_irq_handler(struct fimc_dev *fimc, int deq_buf)
|
|||
list_for_each_entry(v_buf, &cap->active_buf_q, list) {
|
||||
if (v_buf->index != index)
|
||||
continue;
|
||||
vaddr = vb2_plane_vaddr(&v_buf->vb, plane);
|
||||
vaddr = vb2_plane_vaddr(&v_buf->vb.vb2_buf, plane);
|
||||
v4l2_subdev_call(csis, video, s_rx_buffer,
|
||||
vaddr, &size);
|
||||
break;
|
||||
|
|
@ -338,16 +332,17 @@ int fimc_capture_resume(struct fimc_dev *fimc)
|
|||
if (list_empty(&vid_cap->pending_buf_q))
|
||||
break;
|
||||
buf = fimc_pending_queue_pop(vid_cap);
|
||||
buffer_queue(&buf->vb);
|
||||
buffer_queue(&buf->vb.vb2_buf);
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *pfmt,
|
||||
static int queue_setup(struct vb2_queue *vq, const void *parg,
|
||||
unsigned int *num_buffers, unsigned int *num_planes,
|
||||
unsigned int sizes[], void *allocators[])
|
||||
{
|
||||
const struct v4l2_format *pfmt = parg;
|
||||
const struct v4l2_pix_format_mplane *pixm = NULL;
|
||||
struct fimc_ctx *ctx = vq->drv_priv;
|
||||
struct fimc_frame *frame = &ctx->d_frame;
|
||||
|
|
@ -410,8 +405,9 @@ static int buffer_prepare(struct vb2_buffer *vb)
|
|||
|
||||
static void buffer_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct fimc_vid_buffer *buf
|
||||
= container_of(vb, struct fimc_vid_buffer, vb);
|
||||
= container_of(vbuf, struct fimc_vid_buffer, vb);
|
||||
struct fimc_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
|
||||
struct fimc_dev *fimc = ctx->fimc_dev;
|
||||
struct fimc_vid_cap *vid_cap = &fimc->vid_cap;
|
||||
|
|
@ -420,7 +416,7 @@ static void buffer_queue(struct vb2_buffer *vb)
|
|||
int min_bufs;
|
||||
|
||||
spin_lock_irqsave(&fimc->slock, flags);
|
||||
fimc_prepare_addr(ctx, &buf->vb, &ctx->d_frame, &buf->paddr);
|
||||
fimc_prepare_addr(ctx, &buf->vb.vb2_buf, &ctx->d_frame, &buf->paddr);
|
||||
|
||||
if (!test_bit(ST_CAPT_SUSPENDED, &fimc->state) &&
|
||||
!test_bit(ST_CAPT_STREAM, &fimc->state) &&
|
||||
|
|
@ -1472,7 +1468,8 @@ void fimc_sensor_notify(struct v4l2_subdev *sd, unsigned int notification,
|
|||
if (!list_empty(&fimc->vid_cap.active_buf_q)) {
|
||||
buf = list_entry(fimc->vid_cap.active_buf_q.next,
|
||||
struct fimc_vid_buffer, list);
|
||||
vb2_set_plane_payload(&buf->vb, 0, *((u32 *)arg));
|
||||
vb2_set_plane_payload(&buf->vb.vb2_buf, 0,
|
||||
*((u32 *)arg));
|
||||
}
|
||||
fimc_capture_irq_handler(fimc, 1);
|
||||
fimc_deactivate_capture(fimc);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include <linux/slab.h>
|
||||
#include <linux/clk.h>
|
||||
#include <media/v4l2-ioctl.h>
|
||||
#include <media/videobuf2-core.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
#include <media/videobuf2-dma-contig.h>
|
||||
|
||||
#include "fimc-core.h"
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#include <linux/sizes.h>
|
||||
|
||||
#include <media/media-entity.h>
|
||||
#include <media/videobuf2-core.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
#include <media/v4l2-ctrls.h>
|
||||
#include <media/v4l2-device.h>
|
||||
#include <media/v4l2-mem2mem.h>
|
||||
|
|
@ -224,7 +224,7 @@ struct fimc_addr {
|
|||
* @index: buffer index for the output DMA engine
|
||||
*/
|
||||
struct fimc_vid_buffer {
|
||||
struct vb2_buffer vb;
|
||||
struct vb2_v4l2_buffer vb;
|
||||
struct list_head list;
|
||||
struct fimc_addr paddr;
|
||||
int index;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#include <linux/sizes.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/types.h>
|
||||
#include <media/videobuf2-core.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
#include <media/v4l2-ctrls.h>
|
||||
|
||||
#include "fimc-isp.h"
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include <media/v4l2-device.h>
|
||||
#include <media/v4l2-ioctl.h>
|
||||
#include <media/videobuf2-core.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
#include <media/videobuf2-dma-contig.h>
|
||||
#include <media/exynos-fimc.h>
|
||||
|
||||
|
|
@ -39,10 +39,11 @@
|
|||
#include "fimc-is-param.h"
|
||||
|
||||
static int isp_video_capture_queue_setup(struct vb2_queue *vq,
|
||||
const struct v4l2_format *pfmt,
|
||||
const void *parg,
|
||||
unsigned int *num_buffers, unsigned int *num_planes,
|
||||
unsigned int sizes[], void *allocators[])
|
||||
{
|
||||
const struct v4l2_format *pfmt = parg;
|
||||
struct fimc_isp *isp = vb2_get_drv_priv(vq);
|
||||
struct v4l2_pix_format_mplane *vid_fmt = &isp->video_capture.pixfmt;
|
||||
const struct v4l2_pix_format_mplane *pixm = NULL;
|
||||
|
|
@ -194,10 +195,11 @@ static int isp_video_capture_buffer_prepare(struct vb2_buffer *vb)
|
|||
|
||||
static void isp_video_capture_buffer_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct fimc_isp *isp = vb2_get_drv_priv(vb->vb2_queue);
|
||||
struct fimc_is_video *video = &isp->video_capture;
|
||||
struct fimc_is *is = fimc_isp_to_is(isp);
|
||||
struct isp_video_buf *ivb = to_isp_video_buf(vb);
|
||||
struct isp_video_buf *ivb = to_isp_video_buf(vbuf);
|
||||
unsigned long flags;
|
||||
unsigned int i;
|
||||
|
||||
|
|
@ -220,7 +222,7 @@ static void isp_video_capture_buffer_queue(struct vb2_buffer *vb)
|
|||
|
||||
isp_dbg(2, &video->ve.vdev,
|
||||
"dma_buf %pad (%d/%d/%d) addr: %pad\n",
|
||||
&buf_index, ivb->index, i, vb->v4l2_buf.index,
|
||||
&buf_index, ivb->index, i, vb->index,
|
||||
&ivb->dma_addr[i]);
|
||||
}
|
||||
|
||||
|
|
@ -242,7 +244,7 @@ static void isp_video_capture_buffer_queue(struct vb2_buffer *vb)
|
|||
void fimc_isp_video_irq_handler(struct fimc_is *is)
|
||||
{
|
||||
struct fimc_is_video *video = &is->isp.video_capture;
|
||||
struct vb2_buffer *vb;
|
||||
struct vb2_v4l2_buffer *vbuf;
|
||||
int buf_index;
|
||||
|
||||
/* TODO: Ensure the DMA is really stopped in stop_streaming callback */
|
||||
|
|
@ -250,10 +252,10 @@ void fimc_isp_video_irq_handler(struct fimc_is *is)
|
|||
return;
|
||||
|
||||
buf_index = (is->i2h_cmd.args[1] - 1) % video->buf_count;
|
||||
vb = &video->buffers[buf_index]->vb;
|
||||
vbuf = &video->buffers[buf_index]->vb;
|
||||
|
||||
v4l2_get_timestamp(&vb->v4l2_buf.timestamp);
|
||||
vb2_buffer_done(vb, VB2_BUF_STATE_DONE);
|
||||
v4l2_get_timestamp(&vbuf->timestamp);
|
||||
vb2_buffer_done(&vbuf->vb2_buf, VB2_BUF_STATE_DONE);
|
||||
|
||||
video->buf_mask &= ~BIT(buf_index);
|
||||
fimc_is_hw_set_isp_buf_mask(is, video->buf_mask);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#ifndef FIMC_ISP_VIDEO__
|
||||
#define FIMC_ISP_VIDEO__
|
||||
|
||||
#include <media/videobuf2-core.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
#include "fimc-isp.h"
|
||||
|
||||
#ifdef CONFIG_VIDEO_EXYNOS4_ISP_DMA_CAPTURE
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#include <linux/videodev2.h>
|
||||
|
||||
#include <media/media-entity.h>
|
||||
#include <media/videobuf2-core.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
#include <media/v4l2-device.h>
|
||||
#include <media/v4l2-mediabus.h>
|
||||
#include <media/exynos-fimc.h>
|
||||
|
|
@ -102,7 +102,7 @@ struct fimc_isp_ctrls {
|
|||
};
|
||||
|
||||
struct isp_video_buf {
|
||||
struct vb2_buffer vb;
|
||||
struct vb2_v4l2_buffer vb;
|
||||
dma_addr_t dma_addr[FIMC_ISP_MAX_PLANES];
|
||||
unsigned int index;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include <media/v4l2-device.h>
|
||||
#include <media/v4l2-ioctl.h>
|
||||
#include <media/v4l2-mem2mem.h>
|
||||
#include <media/videobuf2-core.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
#include <media/videobuf2-dma-contig.h>
|
||||
#include <media/exynos-fimc.h>
|
||||
|
||||
|
|
@ -200,7 +200,7 @@ static int fimc_lite_reinit(struct fimc_lite *fimc, bool suspend)
|
|||
/* Release unused buffers */
|
||||
while (!suspend && !list_empty(&fimc->pending_buf_q)) {
|
||||
buf = fimc_lite_pending_queue_pop(fimc);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
/* If suspending put unused buffers onto pending queue */
|
||||
while (!list_empty(&fimc->active_buf_q)) {
|
||||
|
|
@ -208,7 +208,7 @@ static int fimc_lite_reinit(struct fimc_lite *fimc, bool suspend)
|
|||
if (suspend)
|
||||
fimc_lite_pending_queue_add(fimc, buf);
|
||||
else
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&fimc->slock, flags);
|
||||
|
|
@ -254,8 +254,6 @@ static irqreturn_t flite_irq_handler(int irq, void *priv)
|
|||
struct fimc_lite *fimc = priv;
|
||||
struct flite_buffer *vbuf;
|
||||
unsigned long flags;
|
||||
struct timeval *tv;
|
||||
struct timespec ts;
|
||||
u32 intsrc;
|
||||
|
||||
spin_lock_irqsave(&fimc->slock, flags);
|
||||
|
|
@ -294,13 +292,10 @@ static irqreturn_t flite_irq_handler(int irq, void *priv)
|
|||
test_bit(ST_FLITE_RUN, &fimc->state) &&
|
||||
!list_empty(&fimc->active_buf_q)) {
|
||||
vbuf = fimc_lite_active_queue_pop(fimc);
|
||||
ktime_get_ts(&ts);
|
||||
tv = &vbuf->vb.v4l2_buf.timestamp;
|
||||
tv->tv_sec = ts.tv_sec;
|
||||
tv->tv_usec = ts.tv_nsec / NSEC_PER_USEC;
|
||||
vbuf->vb.v4l2_buf.sequence = fimc->frame_count++;
|
||||
v4l2_get_timestamp(&vbuf->vb.timestamp);
|
||||
vbuf->vb.sequence = fimc->frame_count++;
|
||||
flite_hw_mask_dma_buffer(fimc, vbuf->index);
|
||||
vb2_buffer_done(&vbuf->vb, VB2_BUF_STATE_DONE);
|
||||
vb2_buffer_done(&vbuf->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
||||
}
|
||||
|
||||
if (test_bit(ST_FLITE_CONFIG, &fimc->state))
|
||||
|
|
@ -360,10 +355,11 @@ static void stop_streaming(struct vb2_queue *q)
|
|||
fimc_lite_stop_capture(fimc, false);
|
||||
}
|
||||
|
||||
static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *pfmt,
|
||||
static int queue_setup(struct vb2_queue *vq, const void *parg,
|
||||
unsigned int *num_buffers, unsigned int *num_planes,
|
||||
unsigned int sizes[], void *allocators[])
|
||||
{
|
||||
const struct v4l2_format *pfmt = parg;
|
||||
const struct v4l2_pix_format_mplane *pixm = NULL;
|
||||
struct fimc_lite *fimc = vq->drv_priv;
|
||||
struct flite_frame *frame = &fimc->out_frame;
|
||||
|
|
@ -422,8 +418,9 @@ static int buffer_prepare(struct vb2_buffer *vb)
|
|||
|
||||
static void buffer_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct flite_buffer *buf
|
||||
= container_of(vb, struct flite_buffer, vb);
|
||||
= container_of(vbuf, struct flite_buffer, vb);
|
||||
struct fimc_lite *fimc = vb2_get_drv_priv(vb->vb2_queue);
|
||||
unsigned long flags;
|
||||
|
||||
|
|
@ -1637,7 +1634,7 @@ static int fimc_lite_resume(struct device *dev)
|
|||
if (list_empty(&fimc->pending_buf_q))
|
||||
break;
|
||||
buf = fimc_lite_pending_queue_pop(fimc);
|
||||
buffer_queue(&buf->vb);
|
||||
buffer_queue(&buf->vb.vb2_buf);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include <linux/videodev2.h>
|
||||
|
||||
#include <media/media-entity.h>
|
||||
#include <media/videobuf2-core.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
#include <media/v4l2-ctrls.h>
|
||||
#include <media/v4l2-device.h>
|
||||
#include <media/v4l2-mediabus.h>
|
||||
|
|
@ -100,7 +100,7 @@ struct flite_frame {
|
|||
* @index: DMA start address register's index
|
||||
*/
|
||||
struct flite_buffer {
|
||||
struct vb2_buffer vb;
|
||||
struct vb2_v4l2_buffer vb;
|
||||
struct list_head list;
|
||||
dma_addr_t paddr;
|
||||
unsigned short index;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include <linux/slab.h>
|
||||
#include <linux/clk.h>
|
||||
#include <media/v4l2-ioctl.h>
|
||||
#include <media/videobuf2-core.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
#include <media/videobuf2-dma-contig.h>
|
||||
|
||||
#include "common.h"
|
||||
|
|
@ -42,7 +42,7 @@ static unsigned int get_m2m_fmt_flags(unsigned int stream_type)
|
|||
|
||||
void fimc_m2m_job_finish(struct fimc_ctx *ctx, int vb_state)
|
||||
{
|
||||
struct vb2_buffer *src_vb, *dst_vb;
|
||||
struct vb2_v4l2_buffer *src_vb, *dst_vb;
|
||||
|
||||
if (!ctx || !ctx->fh.m2m_ctx)
|
||||
return;
|
||||
|
|
@ -99,7 +99,7 @@ static void stop_streaming(struct vb2_queue *q)
|
|||
|
||||
static void fimc_device_run(void *priv)
|
||||
{
|
||||
struct vb2_buffer *src_vb, *dst_vb;
|
||||
struct vb2_v4l2_buffer *src_vb, *dst_vb;
|
||||
struct fimc_ctx *ctx = priv;
|
||||
struct fimc_frame *sf, *df;
|
||||
struct fimc_dev *fimc;
|
||||
|
|
@ -123,19 +123,19 @@ static void fimc_device_run(void *priv)
|
|||
}
|
||||
|
||||
src_vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
|
||||
ret = fimc_prepare_addr(ctx, src_vb, sf, &sf->paddr);
|
||||
ret = fimc_prepare_addr(ctx, &src_vb->vb2_buf, sf, &sf->paddr);
|
||||
if (ret)
|
||||
goto dma_unlock;
|
||||
|
||||
dst_vb = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
|
||||
ret = fimc_prepare_addr(ctx, dst_vb, df, &df->paddr);
|
||||
ret = fimc_prepare_addr(ctx, &dst_vb->vb2_buf, df, &df->paddr);
|
||||
if (ret)
|
||||
goto dma_unlock;
|
||||
|
||||
dst_vb->v4l2_buf.timestamp = src_vb->v4l2_buf.timestamp;
|
||||
dst_vb->v4l2_buf.flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
|
||||
dst_vb->v4l2_buf.flags |=
|
||||
src_vb->v4l2_buf.flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
|
||||
dst_vb->timestamp = src_vb->timestamp;
|
||||
dst_vb->flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
|
||||
dst_vb->flags |=
|
||||
src_vb->flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
|
||||
|
||||
/* Reconfigure hardware if the context has changed. */
|
||||
if (fimc->m2m.ctx != ctx) {
|
||||
|
|
@ -176,7 +176,7 @@ static void fimc_job_abort(void *priv)
|
|||
fimc_m2m_shutdown(priv);
|
||||
}
|
||||
|
||||
static int fimc_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
|
||||
static int fimc_queue_setup(struct vb2_queue *vq, const void *parg,
|
||||
unsigned int *num_buffers, unsigned int *num_planes,
|
||||
unsigned int sizes[], void *allocators[])
|
||||
{
|
||||
|
|
@ -220,8 +220,9 @@ static int fimc_buf_prepare(struct vb2_buffer *vb)
|
|||
|
||||
static void fimc_buf_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct fimc_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
|
||||
v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vb);
|
||||
v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf);
|
||||
}
|
||||
|
||||
static struct vb2_ops fimc_qops = {
|
||||
|
|
|
|||
|
|
@ -706,7 +706,8 @@ static irqreturn_t s5pcsis_irq_handler(int irq, void *dev_id)
|
|||
else
|
||||
offset = S5PCSIS_PKTDATA_ODD;
|
||||
|
||||
memcpy(pktbuf->data, state->regs + offset, pktbuf->len);
|
||||
memcpy(pktbuf->data, (u8 __force *)state->regs + offset,
|
||||
pktbuf->len);
|
||||
pktbuf->data = NULL;
|
||||
rmb();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,18 +200,18 @@ static void dma_callback(void *data)
|
|||
{
|
||||
struct deinterlace_ctx *curr_ctx = data;
|
||||
struct deinterlace_dev *pcdev = curr_ctx->dev;
|
||||
struct vb2_buffer *src_vb, *dst_vb;
|
||||
struct vb2_v4l2_buffer *src_vb, *dst_vb;
|
||||
|
||||
atomic_set(&pcdev->busy, 0);
|
||||
|
||||
src_vb = v4l2_m2m_src_buf_remove(curr_ctx->m2m_ctx);
|
||||
dst_vb = v4l2_m2m_dst_buf_remove(curr_ctx->m2m_ctx);
|
||||
|
||||
dst_vb->v4l2_buf.timestamp = src_vb->v4l2_buf.timestamp;
|
||||
dst_vb->v4l2_buf.flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
|
||||
dst_vb->v4l2_buf.flags |=
|
||||
src_vb->v4l2_buf.flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
|
||||
dst_vb->v4l2_buf.timecode = src_vb->v4l2_buf.timecode;
|
||||
dst_vb->timestamp = src_vb->timestamp;
|
||||
dst_vb->flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
|
||||
dst_vb->flags |=
|
||||
src_vb->flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
|
||||
dst_vb->timecode = src_vb->timecode;
|
||||
|
||||
v4l2_m2m_buf_done(src_vb, VB2_BUF_STATE_DONE);
|
||||
v4l2_m2m_buf_done(dst_vb, VB2_BUF_STATE_DONE);
|
||||
|
|
@ -225,7 +225,7 @@ static void deinterlace_issue_dma(struct deinterlace_ctx *ctx, int op,
|
|||
int do_callback)
|
||||
{
|
||||
struct deinterlace_q_data *s_q_data;
|
||||
struct vb2_buffer *src_buf, *dst_buf;
|
||||
struct vb2_v4l2_buffer *src_buf, *dst_buf;
|
||||
struct deinterlace_dev *pcdev = ctx->dev;
|
||||
struct dma_chan *chan = pcdev->dma_chan;
|
||||
struct dma_device *dmadev = chan->device;
|
||||
|
|
@ -243,8 +243,9 @@ static void deinterlace_issue_dma(struct deinterlace_ctx *ctx, int op,
|
|||
s_height = s_q_data->height;
|
||||
s_size = s_width * s_height;
|
||||
|
||||
p_in = (dma_addr_t)vb2_dma_contig_plane_dma_addr(src_buf, 0);
|
||||
p_out = (dma_addr_t)vb2_dma_contig_plane_dma_addr(dst_buf, 0);
|
||||
p_in = (dma_addr_t)vb2_dma_contig_plane_dma_addr(&src_buf->vb2_buf, 0);
|
||||
p_out = (dma_addr_t)vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf,
|
||||
0);
|
||||
if (!p_in || !p_out) {
|
||||
v4l2_err(&pcdev->v4l2_dev,
|
||||
"Acquiring kernel pointers to buffers failed\n");
|
||||
|
|
@ -797,7 +798,7 @@ struct vb2_dc_conf {
|
|||
};
|
||||
|
||||
static int deinterlace_queue_setup(struct vb2_queue *vq,
|
||||
const struct v4l2_format *fmt,
|
||||
const void *parg,
|
||||
unsigned int *nbuffers, unsigned int *nplanes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
|
|
@ -849,8 +850,10 @@ static int deinterlace_buf_prepare(struct vb2_buffer *vb)
|
|||
|
||||
static void deinterlace_buf_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct deinterlace_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
|
||||
v4l2_m2m_buf_queue(ctx->m2m_ctx, vb);
|
||||
|
||||
v4l2_m2m_buf_queue(ctx->m2m_ctx, vbuf);
|
||||
}
|
||||
|
||||
static struct vb2_ops deinterlace_qops = {
|
||||
|
|
|
|||
|
|
@ -201,18 +201,18 @@ struct mcam_dma_desc {
|
|||
|
||||
/*
|
||||
* Our buffer type for working with videobuf2. Note that the vb2
|
||||
* developers have decreed that struct vb2_buffer must be at the
|
||||
* developers have decreed that struct vb2_v4l2_buffer must be at the
|
||||
* beginning of this structure.
|
||||
*/
|
||||
struct mcam_vb_buffer {
|
||||
struct vb2_buffer vb_buf;
|
||||
struct vb2_v4l2_buffer vb_buf;
|
||||
struct list_head queue;
|
||||
struct mcam_dma_desc *dma_desc; /* Descriptor virtual address */
|
||||
dma_addr_t dma_desc_pa; /* Descriptor physical address */
|
||||
int dma_desc_nent; /* Number of mapped descriptors */
|
||||
};
|
||||
|
||||
static inline struct mcam_vb_buffer *vb_to_mvb(struct vb2_buffer *vb)
|
||||
static inline struct mcam_vb_buffer *vb_to_mvb(struct vb2_v4l2_buffer *vb)
|
||||
{
|
||||
return container_of(vb, struct mcam_vb_buffer, vb_buf);
|
||||
}
|
||||
|
|
@ -221,14 +221,14 @@ static inline struct mcam_vb_buffer *vb_to_mvb(struct vb2_buffer *vb)
|
|||
* Hand a completed buffer back to user space.
|
||||
*/
|
||||
static void mcam_buffer_done(struct mcam_camera *cam, int frame,
|
||||
struct vb2_buffer *vbuf)
|
||||
struct vb2_v4l2_buffer *vbuf)
|
||||
{
|
||||
vbuf->v4l2_buf.bytesused = cam->pix_format.sizeimage;
|
||||
vbuf->v4l2_buf.sequence = cam->buf_seq[frame];
|
||||
vbuf->v4l2_buf.field = V4L2_FIELD_NONE;
|
||||
v4l2_get_timestamp(&vbuf->v4l2_buf.timestamp);
|
||||
vb2_set_plane_payload(vbuf, 0, cam->pix_format.sizeimage);
|
||||
vb2_buffer_done(vbuf, VB2_BUF_STATE_DONE);
|
||||
vbuf->vb2_buf.planes[0].bytesused = cam->pix_format.sizeimage;
|
||||
vbuf->sequence = cam->buf_seq[frame];
|
||||
vbuf->field = V4L2_FIELD_NONE;
|
||||
v4l2_get_timestamp(&vbuf->timestamp);
|
||||
vb2_set_plane_payload(&vbuf->vb2_buf, 0, cam->pix_format.sizeimage);
|
||||
vb2_buffer_done(&vbuf->vb2_buf, VB2_BUF_STATE_DONE);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -482,7 +482,8 @@ static void mcam_frame_tasklet(unsigned long data)
|
|||
* Drop the lock during the big copy. This *should* be safe...
|
||||
*/
|
||||
spin_unlock_irqrestore(&cam->dev_lock, flags);
|
||||
memcpy(vb2_plane_vaddr(&buf->vb_buf, 0), cam->dma_bufs[bufno],
|
||||
memcpy(vb2_plane_vaddr(&buf->vb_buf.vb2_buf, 0),
|
||||
cam->dma_bufs[bufno],
|
||||
cam->pix_format.sizeimage);
|
||||
mcam_buffer_done(cam, bufno, &buf->vb_buf);
|
||||
spin_lock_irqsave(&cam->dev_lock, flags);
|
||||
|
|
@ -548,7 +549,7 @@ static void mcam_set_contig_buffer(struct mcam_camera *cam, int frame)
|
|||
{
|
||||
struct mcam_vb_buffer *buf;
|
||||
dma_addr_t dma_handle;
|
||||
struct vb2_buffer *vb;
|
||||
struct vb2_v4l2_buffer *vb;
|
||||
|
||||
/*
|
||||
* If there are no available buffers, go into single mode
|
||||
|
|
@ -570,7 +571,7 @@ static void mcam_set_contig_buffer(struct mcam_camera *cam, int frame)
|
|||
cam->vb_bufs[frame] = buf;
|
||||
vb = &buf->vb_buf;
|
||||
|
||||
dma_handle = vb2_dma_contig_plane_dma_addr(vb, 0);
|
||||
dma_handle = vb2_dma_contig_plane_dma_addr(&vb->vb2_buf, 0);
|
||||
mcam_write_yuv_bases(cam, frame, dma_handle);
|
||||
}
|
||||
|
||||
|
|
@ -1048,10 +1049,11 @@ static int mcam_read_setup(struct mcam_camera *cam)
|
|||
*/
|
||||
|
||||
static int mcam_vb_queue_setup(struct vb2_queue *vq,
|
||||
const struct v4l2_format *fmt, unsigned int *nbufs,
|
||||
const void *parg, unsigned int *nbufs,
|
||||
unsigned int *num_planes, unsigned int sizes[],
|
||||
void *alloc_ctxs[])
|
||||
{
|
||||
const struct v4l2_format *fmt = parg;
|
||||
struct mcam_camera *cam = vb2_get_drv_priv(vq);
|
||||
int minbufs = (cam->buffer_mode == B_DMA_contig) ? 3 : 2;
|
||||
|
||||
|
|
@ -1071,7 +1073,8 @@ static int mcam_vb_queue_setup(struct vb2_queue *vq,
|
|||
|
||||
static void mcam_vb_buf_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct mcam_vb_buffer *mvb = vb_to_mvb(vb);
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct mcam_vb_buffer *mvb = vb_to_mvb(vbuf);
|
||||
struct mcam_camera *cam = vb2_get_drv_priv(vb->vb2_queue);
|
||||
unsigned long flags;
|
||||
int start;
|
||||
|
|
@ -1096,14 +1099,14 @@ static void mcam_vb_requeue_bufs(struct vb2_queue *vq,
|
|||
|
||||
spin_lock_irqsave(&cam->dev_lock, flags);
|
||||
list_for_each_entry_safe(buf, node, &cam->buffers, queue) {
|
||||
vb2_buffer_done(&buf->vb_buf, state);
|
||||
vb2_buffer_done(&buf->vb_buf.vb2_buf, state);
|
||||
list_del(&buf->queue);
|
||||
}
|
||||
for (i = 0; i < MAX_DMA_BUFS; i++) {
|
||||
buf = cam->vb_bufs[i];
|
||||
|
||||
if (buf) {
|
||||
vb2_buffer_done(&buf->vb_buf, state);
|
||||
vb2_buffer_done(&buf->vb_buf.vb2_buf, state);
|
||||
cam->vb_bufs[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -1198,7 +1201,8 @@ static const struct vb2_ops mcam_vb2_ops = {
|
|||
*/
|
||||
static int mcam_vb_sg_buf_init(struct vb2_buffer *vb)
|
||||
{
|
||||
struct mcam_vb_buffer *mvb = vb_to_mvb(vb);
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct mcam_vb_buffer *mvb = vb_to_mvb(vbuf);
|
||||
struct mcam_camera *cam = vb2_get_drv_priv(vb->vb2_queue);
|
||||
int ndesc = cam->pix_format.sizeimage/PAGE_SIZE + 1;
|
||||
|
||||
|
|
@ -1214,7 +1218,8 @@ static int mcam_vb_sg_buf_init(struct vb2_buffer *vb)
|
|||
|
||||
static int mcam_vb_sg_buf_prepare(struct vb2_buffer *vb)
|
||||
{
|
||||
struct mcam_vb_buffer *mvb = vb_to_mvb(vb);
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct mcam_vb_buffer *mvb = vb_to_mvb(vbuf);
|
||||
struct sg_table *sg_table = vb2_dma_sg_plane_desc(vb, 0);
|
||||
struct mcam_dma_desc *desc = mvb->dma_desc;
|
||||
struct scatterlist *sg;
|
||||
|
|
@ -1230,8 +1235,9 @@ static int mcam_vb_sg_buf_prepare(struct vb2_buffer *vb)
|
|||
|
||||
static void mcam_vb_sg_buf_cleanup(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct mcam_camera *cam = vb2_get_drv_priv(vb->vb2_queue);
|
||||
struct mcam_vb_buffer *mvb = vb_to_mvb(vb);
|
||||
struct mcam_vb_buffer *mvb = vb_to_mvb(vbuf);
|
||||
int ndesc = cam->pix_format.sizeimage/PAGE_SIZE + 1;
|
||||
|
||||
dma_free_coherent(cam->dev, ndesc * sizeof(struct mcam_dma_desc),
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-ctrls.h>
|
||||
#include <media/v4l2-dev.h>
|
||||
#include <media/videobuf2-core.h>
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
|
||||
/*
|
||||
* Create our own symbols for the supported buffer modes, but, for now,
|
||||
|
|
|
|||
|
|
@ -351,7 +351,7 @@ static irqreturn_t emmaprp_irq(int irq_emma, void *data)
|
|||
{
|
||||
struct emmaprp_dev *pcdev = data;
|
||||
struct emmaprp_ctx *curr_ctx;
|
||||
struct vb2_buffer *src_vb, *dst_vb;
|
||||
struct vb2_v4l2_buffer *src_vb, *dst_vb;
|
||||
unsigned long flags;
|
||||
u32 irqst;
|
||||
|
||||
|
|
@ -375,13 +375,13 @@ static irqreturn_t emmaprp_irq(int irq_emma, void *data)
|
|||
src_vb = v4l2_m2m_src_buf_remove(curr_ctx->m2m_ctx);
|
||||
dst_vb = v4l2_m2m_dst_buf_remove(curr_ctx->m2m_ctx);
|
||||
|
||||
dst_vb->v4l2_buf.timestamp = src_vb->v4l2_buf.timestamp;
|
||||
dst_vb->v4l2_buf.flags &=
|
||||
dst_vb->timestamp = src_vb->timestamp;
|
||||
dst_vb->flags &=
|
||||
~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
|
||||
dst_vb->v4l2_buf.flags |=
|
||||
src_vb->v4l2_buf.flags
|
||||
dst_vb->flags |=
|
||||
src_vb->flags
|
||||
& V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
|
||||
dst_vb->v4l2_buf.timecode = src_vb->v4l2_buf.timecode;
|
||||
dst_vb->timecode = src_vb->timecode;
|
||||
|
||||
spin_lock_irqsave(&pcdev->irqlock, flags);
|
||||
v4l2_m2m_buf_done(src_vb, VB2_BUF_STATE_DONE);
|
||||
|
|
@ -689,7 +689,7 @@ static const struct v4l2_ioctl_ops emmaprp_ioctl_ops = {
|
|||
* Queue operations
|
||||
*/
|
||||
static int emmaprp_queue_setup(struct vb2_queue *vq,
|
||||
const struct v4l2_format *fmt,
|
||||
const void *parg,
|
||||
unsigned int *nbuffers, unsigned int *nplanes,
|
||||
unsigned int sizes[], void *alloc_ctxs[])
|
||||
{
|
||||
|
|
@ -742,8 +742,9 @@ static int emmaprp_buf_prepare(struct vb2_buffer *vb)
|
|||
|
||||
static void emmaprp_buf_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct emmaprp_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
|
||||
v4l2_m2m_buf_queue(ctx->m2m_ctx, vb);
|
||||
v4l2_m2m_buf_queue(ctx->m2m_ctx, vbuf);
|
||||
}
|
||||
|
||||
static struct vb2_ops emmaprp_qops = {
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ static int isp_stat_buf_queue(struct ispstat *stat)
|
|||
if (!stat->active_buf)
|
||||
return STAT_NO_BUF;
|
||||
|
||||
ktime_get_ts(&stat->active_buf->ts);
|
||||
v4l2_get_timestamp(&stat->active_buf->ts);
|
||||
|
||||
stat->active_buf->buf_size = stat->buf_size;
|
||||
if (isp_stat_buf_check_magic(stat, stat->active_buf)) {
|
||||
|
|
@ -496,8 +496,7 @@ int omap3isp_stat_request_statistics(struct ispstat *stat,
|
|||
return PTR_ERR(buf);
|
||||
}
|
||||
|
||||
data->ts.tv_sec = buf->ts.tv_sec;
|
||||
data->ts.tv_usec = buf->ts.tv_nsec / NSEC_PER_USEC;
|
||||
data->ts = buf->ts;
|
||||
data->config_counter = buf->config_counter;
|
||||
data->frame_number = buf->frame_number;
|
||||
data->buf_size = buf->buf_size;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ struct ispstat_buffer {
|
|||
struct sg_table sgt;
|
||||
void *virt_addr;
|
||||
dma_addr_t dma_addr;
|
||||
struct timespec ts;
|
||||
struct timeval ts;
|
||||
u32 buf_size;
|
||||
u32 frame_number;
|
||||
u16 config_counter;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue