0001
0002
0003 #ifndef __SOC_SOF_CLIENT_H
0004 #define __SOC_SOF_CLIENT_H
0005
0006 #include <linux/auxiliary_bus.h>
0007 #include <linux/device.h>
0008 #include <linux/list.h>
0009 #include <sound/sof.h>
0010
0011 struct sof_ipc_fw_version;
0012 struct sof_ipc_cmd_hdr;
0013 struct snd_sof_dev;
0014 struct dentry;
0015
0016
0017
0018
0019
0020
0021
0022
0023 struct sof_client_dev {
0024 struct auxiliary_device auxdev;
0025 struct snd_sof_dev *sdev;
0026 struct list_head list;
0027 void *data;
0028 };
0029
0030 #define sof_client_dev_to_sof_dev(cdev) ((cdev)->sdev)
0031
0032 #define auxiliary_dev_to_sof_client_dev(auxiliary_dev) \
0033 container_of(auxiliary_dev, struct sof_client_dev, auxdev)
0034
0035 #define dev_to_sof_client_dev(dev) \
0036 container_of(to_auxiliary_dev(dev), struct sof_client_dev, auxdev)
0037
0038 int sof_client_ipc_tx_message(struct sof_client_dev *cdev, void *ipc_msg,
0039 void *reply_data, size_t reply_bytes);
0040
0041 struct dentry *sof_client_get_debugfs_root(struct sof_client_dev *cdev);
0042 struct device *sof_client_get_dma_dev(struct sof_client_dev *cdev);
0043 const struct sof_ipc_fw_version *sof_client_get_fw_version(struct sof_client_dev *cdev);
0044 size_t sof_client_get_ipc_max_payload_size(struct sof_client_dev *cdev);
0045 enum sof_ipc_type sof_client_get_ipc_type(struct sof_client_dev *cdev);
0046
0047
0048 int sof_client_core_module_get(struct sof_client_dev *cdev);
0049 void sof_client_core_module_put(struct sof_client_dev *cdev);
0050
0051
0052 typedef void (*sof_client_event_callback)(struct sof_client_dev *cdev, void *msg_buf);
0053
0054 int sof_client_register_ipc_rx_handler(struct sof_client_dev *cdev,
0055 u32 ipc_msg_type,
0056 sof_client_event_callback callback);
0057 void sof_client_unregister_ipc_rx_handler(struct sof_client_dev *cdev,
0058 u32 ipc_msg_type);
0059
0060
0061 typedef void (*sof_client_fw_state_callback)(struct sof_client_dev *cdev,
0062 enum sof_fw_state state);
0063
0064 int sof_client_register_fw_state_handler(struct sof_client_dev *cdev,
0065 sof_client_fw_state_callback callback);
0066 void sof_client_unregister_fw_state_handler(struct sof_client_dev *cdev);
0067 enum sof_fw_state sof_client_get_fw_state(struct sof_client_dev *cdev);
0068
0069 #endif