28 #define IVTV_MBOX_FIRMWARE_DONE 0x00000004
29 #define IVTV_MBOX_DRIVER_DONE 0x00000002
30 #define IVTV_MBOX_DRIVER_BUSY 0x00000001
31 #define IVTV_MBOX_FREE 0x00000000
34 #define IVTV_API_STD_TIMEOUT 0x02000000
36 #define API_CACHE (1 << 0)
37 #define API_RESULT (1 << 1)
38 #define API_FAST_RESULT (3 << 1)
39 #define API_DMA (1 << 3)
40 #define API_HIGH_VOL (1 << 5)
41 #define API_NO_WAIT_MB (1 << 4)
42 #define API_NO_WAIT_RES (1 << 5)
43 #define API_NO_POLL (1 << 6)
50 #define API_ENTRY(x, f) [x] = { (f), #x }
173 for (i = 0; i <
retries; i++) {
174 for (mb = 1; mb <= max_mbox; mb++)
175 if (try_mailbox(itv, mbdata, mb))
206 for (i = 0; i <= mbdata->
max_mbox; i++) {
214 static int ivtv_api_call(
struct ivtv *itv,
int cmd,
int args,
u32 data[])
223 if (
NULL == mbdata) {
227 if (args < 0 || args > CX2341X_MBOX_MAX_DATA ||
229 IVTV_ERR(
"Invalid MB call: cmd = 0x%02x, args = %d\n", cmd, args);
259 for (i = 0; i < 100; i++) {
261 if (try_mailbox(itv, mbdata, mb)) {
262 write_mailbox(&mbdata->
mbox[mb], cmd, args, data);
269 IVTV_WARN(
"Could not find free DMA mailbox for %s\n", api_info[cmd].
name);
270 clear_all_mailboxes(itv, mbdata);
274 if ((flags & API_FAST_RESULT) == API_FAST_RESULT)
277 mb = get_mailbox(itv, mbdata, flags);
280 clear_all_mailboxes(itv, mbdata);
284 write_mailbox(mbox, cmd, args, data);
299 for (i = 0; i < 100; i++) {
305 if (
time_after(jiffies, then + api_timeout)) {
323 data[i] =
readl(&mbox->data[i]);
331 int res = ivtv_api_call(itv, cmd, args, data);
336 return (res == -
EBUSY) ? ivtv_api_call(itv, cmd, args, data) :
res;
341 return ivtv_api(priv, cmd, in, data);
350 for (i = 0; i < args; i++) {
354 return ivtv_api(itv, cmd, args, data);
364 for (i = 0; i < args; i++) {
368 return ivtv_api(itv, cmd, args, data);
377 for (i = 0; i <
argc; i++, p++)
385 for (i = 0; i < 256; i++)