18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci#ifndef __SOUND_HWDEP_H
38c2ecf20Sopenharmony_ci#define __SOUND_HWDEP_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci/*
68c2ecf20Sopenharmony_ci *  Hardware dependent layer
78c2ecf20Sopenharmony_ci *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <sound/asound.h>
118c2ecf20Sopenharmony_ci#include <linux/poll.h>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_cistruct snd_hwdep;
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci/* hwdep file ops; all ops can be NULL */
168c2ecf20Sopenharmony_cistruct snd_hwdep_ops {
178c2ecf20Sopenharmony_ci	long long (*llseek)(struct snd_hwdep *hw, struct file *file,
188c2ecf20Sopenharmony_ci			    long long offset, int orig);
198c2ecf20Sopenharmony_ci	long (*read)(struct snd_hwdep *hw, char __user *buf,
208c2ecf20Sopenharmony_ci		     long count, loff_t *offset);
218c2ecf20Sopenharmony_ci	long (*write)(struct snd_hwdep *hw, const char __user *buf,
228c2ecf20Sopenharmony_ci		      long count, loff_t *offset);
238c2ecf20Sopenharmony_ci	int (*open)(struct snd_hwdep *hw, struct file * file);
248c2ecf20Sopenharmony_ci	int (*release)(struct snd_hwdep *hw, struct file * file);
258c2ecf20Sopenharmony_ci	__poll_t (*poll)(struct snd_hwdep *hw, struct file *file,
268c2ecf20Sopenharmony_ci			     poll_table *wait);
278c2ecf20Sopenharmony_ci	int (*ioctl)(struct snd_hwdep *hw, struct file *file,
288c2ecf20Sopenharmony_ci		     unsigned int cmd, unsigned long arg);
298c2ecf20Sopenharmony_ci	int (*ioctl_compat)(struct snd_hwdep *hw, struct file *file,
308c2ecf20Sopenharmony_ci			    unsigned int cmd, unsigned long arg);
318c2ecf20Sopenharmony_ci	int (*mmap)(struct snd_hwdep *hw, struct file *file,
328c2ecf20Sopenharmony_ci		    struct vm_area_struct *vma);
338c2ecf20Sopenharmony_ci	int (*dsp_status)(struct snd_hwdep *hw,
348c2ecf20Sopenharmony_ci			  struct snd_hwdep_dsp_status *status);
358c2ecf20Sopenharmony_ci	int (*dsp_load)(struct snd_hwdep *hw,
368c2ecf20Sopenharmony_ci			struct snd_hwdep_dsp_image *image);
378c2ecf20Sopenharmony_ci};
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_cistruct snd_hwdep {
408c2ecf20Sopenharmony_ci	struct snd_card *card;
418c2ecf20Sopenharmony_ci	struct list_head list;
428c2ecf20Sopenharmony_ci	int device;
438c2ecf20Sopenharmony_ci	char id[32];
448c2ecf20Sopenharmony_ci	char name[80];
458c2ecf20Sopenharmony_ci	int iface;
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci#ifdef CONFIG_SND_OSSEMUL
488c2ecf20Sopenharmony_ci	int oss_type;
498c2ecf20Sopenharmony_ci	int ossreg;
508c2ecf20Sopenharmony_ci#endif
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci	struct snd_hwdep_ops ops;
538c2ecf20Sopenharmony_ci	wait_queue_head_t open_wait;
548c2ecf20Sopenharmony_ci	void *private_data;
558c2ecf20Sopenharmony_ci	void (*private_free) (struct snd_hwdep *hwdep);
568c2ecf20Sopenharmony_ci	struct device dev;
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci	struct mutex open_mutex;
598c2ecf20Sopenharmony_ci	int used;			/* reference counter */
608c2ecf20Sopenharmony_ci	unsigned int dsp_loaded;	/* bit fields of loaded dsp indices */
618c2ecf20Sopenharmony_ci	unsigned int exclusive:1;	/* exclusive access mode */
628c2ecf20Sopenharmony_ci};
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ciextern int snd_hwdep_new(struct snd_card *card, char *id, int device,
658c2ecf20Sopenharmony_ci			 struct snd_hwdep **rhwdep);
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci#endif /* __SOUND_HWDEP_H */
68