^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef __SOUND_HWDEP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define __SOUND_HWDEP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Hardware dependent layer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <sound/asound.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/poll.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/android_kabi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) struct snd_hwdep;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) /* hwdep file ops; all ops can be NULL */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) struct snd_hwdep_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) long long (*llseek)(struct snd_hwdep *hw, struct file *file,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) long long offset, int orig);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) long (*read)(struct snd_hwdep *hw, char __user *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) long count, loff_t *offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) long (*write)(struct snd_hwdep *hw, const char __user *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) long count, loff_t *offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) int (*open)(struct snd_hwdep *hw, struct file * file);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) int (*release)(struct snd_hwdep *hw, struct file * file);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) __poll_t (*poll)(struct snd_hwdep *hw, struct file *file,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) poll_table *wait);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) int (*ioctl)(struct snd_hwdep *hw, struct file *file,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) unsigned int cmd, unsigned long arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) int (*ioctl_compat)(struct snd_hwdep *hw, struct file *file,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) unsigned int cmd, unsigned long arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) int (*mmap)(struct snd_hwdep *hw, struct file *file,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) struct vm_area_struct *vma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) int (*dsp_status)(struct snd_hwdep *hw,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) struct snd_hwdep_dsp_status *status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) int (*dsp_load)(struct snd_hwdep *hw,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) struct snd_hwdep_dsp_image *image);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) ANDROID_KABI_RESERVE(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) struct snd_hwdep {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) struct snd_card *card;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) int device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) char id[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) char name[80];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) int iface;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #ifdef CONFIG_SND_OSSEMUL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) int oss_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) int ossreg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) struct snd_hwdep_ops ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) wait_queue_head_t open_wait;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) void *private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) void (*private_free) (struct snd_hwdep *hwdep);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) struct device dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) struct mutex open_mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) int used; /* reference counter */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) unsigned int dsp_loaded; /* bit fields of loaded dsp indices */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) unsigned int exclusive:1; /* exclusive access mode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) ANDROID_KABI_RESERVE(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) extern int snd_hwdep_new(struct snd_card *card, char *id, int device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) struct snd_hwdep **rhwdep);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) #endif /* __SOUND_HWDEP_H */