Merge remote-tracking branch 'regulator/topic/palmas' into regulator-next
[deliverable/linux.git] / drivers / mailbox / omap-mbox.h
CommitLineData
c869c75c
SA
1/*
2 * omap-mbox.h: OMAP mailbox internal definitions
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
340a614a 8
c869c75c
SA
9#ifndef OMAP_MBOX_H
10#define OMAP_MBOX_H
340a614a 11
b3e69146 12#include <linux/device.h>
c869c75c 13#include <linux/interrupt.h>
b5bebe41 14#include <linux/kfifo.h>
c869c75c
SA
15#include <linux/spinlock.h>
16#include <linux/workqueue.h>
17#include <linux/omap-mailbox.h>
340a614a
HD
18
19typedef int __bitwise omap_mbox_type_t;
20#define OMAP_MBOX_TYPE1 ((__force omap_mbox_type_t) 1)
21#define OMAP_MBOX_TYPE2 ((__force omap_mbox_type_t) 2)
22
23struct omap_mbox_ops {
24 omap_mbox_type_t type;
25 int (*startup)(struct omap_mbox *mbox);
26 void (*shutdown)(struct omap_mbox *mbox);
27 /* fifo */
28 mbox_msg_t (*fifo_read)(struct omap_mbox *mbox);
29 void (*fifo_write)(struct omap_mbox *mbox, mbox_msg_t msg);
30 int (*fifo_empty)(struct omap_mbox *mbox);
31 int (*fifo_full)(struct omap_mbox *mbox);
32 /* irq */
5ed8d32e
S
33 void (*enable_irq)(struct omap_mbox *mbox,
34 omap_mbox_irq_t irq);
35 void (*disable_irq)(struct omap_mbox *mbox,
36 omap_mbox_irq_t irq);
340a614a
HD
37 void (*ack_irq)(struct omap_mbox *mbox, omap_mbox_irq_t irq);
38 int (*is_irq)(struct omap_mbox *mbox, omap_mbox_irq_t irq);
c75ee752
HD
39 /* ctx */
40 void (*save_ctx)(struct omap_mbox *mbox);
41 void (*restore_ctx)(struct omap_mbox *mbox);
340a614a
HD
42};
43
44struct omap_mbox_queue {
45 spinlock_t lock;
b5bebe41 46 struct kfifo fifo;
340a614a 47 struct work_struct work;
5ed8d32e 48 struct tasklet_struct tasklet;
340a614a 49 struct omap_mbox *mbox;
d2295042 50 bool full;
340a614a
HD
51};
52
53struct omap_mbox {
b8a7cf8e 54 const char *name;
340a614a 55 unsigned int irq;
340a614a 56 struct omap_mbox_queue *txq, *rxq;
340a614a 57 struct omap_mbox_ops *ops;
f48cca87 58 struct device *dev;
340a614a 59 void *priv;
58256307 60 int use_count;
c869c75c 61 struct blocking_notifier_head notifier;
340a614a
HD
62};
63
9c80c8cd
FC
64int omap_mbox_register(struct device *parent, struct omap_mbox **);
65int omap_mbox_unregister(void);
340a614a 66
c869c75c 67#endif /* OMAP_MBOX_H */
This page took 0.610956 seconds and 5 git commands to generate.