brintos

brintos / linux-shallow public Read only

0
0
Text · 1.1 KiB · f73a891 Raw
49 lines · c
1/* SPDX-License-Identifier: GPL-2.0-only OR MIT */2/*3 * Apple mailbox message format4 *5 * Copyright The Asahi Linux Contributors6 */7 8#ifndef _APPLE_MAILBOX_H_9#define _APPLE_MAILBOX_H_10 11#include <linux/device.h>12#include <linux/types.h>13 14/* encodes a single 96bit message sent over the single channel */15struct apple_mbox_msg {16	u64 msg0;17	u32 msg1;18};19 20struct apple_mbox {21	struct device *dev;22	void __iomem *regs;23	const struct apple_mbox_hw *hw;24	bool active;25 26	int irq_recv_not_empty;27	int irq_send_empty;28 29	spinlock_t rx_lock;30	spinlock_t tx_lock;31 32	struct completion tx_empty;33 34	/** Receive callback for incoming messages */35	void (*rx)(struct apple_mbox *mbox, struct apple_mbox_msg msg, void *cookie);36	void *cookie;37};38 39struct apple_mbox *apple_mbox_get(struct device *dev, int index);40struct apple_mbox *apple_mbox_get_byname(struct device *dev, const char *name);41 42int apple_mbox_start(struct apple_mbox *mbox);43void apple_mbox_stop(struct apple_mbox *mbox);44int apple_mbox_poll(struct apple_mbox *mbox);45int apple_mbox_send(struct apple_mbox *mbox, struct apple_mbox_msg msg,46		    bool atomic);47 48#endif49