Lines Matching refs:mbdata
131 static int try_mailbox(struct ivtv *itv, struct ivtv_mailbox_data *mbdata, int mb) in try_mailbox() argument
133 u32 flags = readl(&mbdata->mbox[mb].flags); in try_mailbox()
137 if (is_free && !test_and_set_bit(mb, &mbdata->busy)) { in try_mailbox()
138 write_sync(IVTV_MBOX_DRIVER_BUSY, &mbdata->mbox[mb].flags); in try_mailbox()
146 static int get_mailbox(struct ivtv *itv, struct ivtv_mailbox_data *mbdata, int flags) in get_mailbox() argument
150 int max_mbox = mbdata->max_mbox; in get_mailbox()
161 if (try_mailbox(itv, mbdata, mb)) in get_mailbox()
188 static void clear_all_mailboxes(struct ivtv *itv, struct ivtv_mailbox_data *mbdata) in clear_all_mailboxes() argument
192 for (i = 0; i <= mbdata->max_mbox; i++) { in clear_all_mailboxes()
194 i, readl(&mbdata->mbox[i].cmd), readl(&mbdata->mbox[i].flags)); in clear_all_mailboxes()
195 write_sync(0, &mbdata->mbox[i].flags); in clear_all_mailboxes()
196 clear_bit(i, &mbdata->busy); in clear_all_mailboxes()
202 struct ivtv_mailbox_data *mbdata = (cmd >= 128) ? &itv->enc_mbox : &itv->dec_mbox; in ivtv_api_call() local
209 if (NULL == mbdata) { in ivtv_api_call()
246 mb = i % (mbdata->max_mbox + 1); in ivtv_api_call()
247 if (try_mailbox(itv, mbdata, mb)) { in ivtv_api_call()
248 write_mailbox(&mbdata->mbox[mb], cmd, args, data); in ivtv_api_call()
249 clear_bit(mb, &mbdata->busy); in ivtv_api_call()
253 api_info[cmd].name, mb, readl(&mbdata->mbox[mb].flags)); in ivtv_api_call()
256 clear_all_mailboxes(itv, mbdata); in ivtv_api_call()
263 mb = get_mailbox(itv, mbdata, flags); in ivtv_api_call()
266 clear_all_mailboxes(itv, mbdata); in ivtv_api_call()
269 mbox = &mbdata->mbox[mb]; in ivtv_api_call()
276 clear_bit(mb, &mbdata->busy); in ivtv_api_call()
295 clear_bit(mb, &mbdata->busy); in ivtv_api_call()
311 clear_bit(mb, &mbdata->busy); in ivtv_api_call()
358 void ivtv_api_get_data(struct ivtv_mailbox_data *mbdata, int mb, in ivtv_api_get_data() argument
361 volatile u32 __iomem *p = mbdata->mbox[mb].data; in ivtv_api_get_data()