162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci#ifndef __SOUND_HWDEP_H
362306a36Sopenharmony_ci#define __SOUND_HWDEP_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci/*
662306a36Sopenharmony_ci *  Hardware dependent layer
762306a36Sopenharmony_ci *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
862306a36Sopenharmony_ci */
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#include <sound/asound.h>
1162306a36Sopenharmony_ci#include <linux/poll.h>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_cistruct snd_hwdep;
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci/* hwdep file ops; all ops can be NULL */
1662306a36Sopenharmony_cistruct snd_hwdep_ops {
1762306a36Sopenharmony_ci	long long (*llseek)(struct snd_hwdep *hw, struct file *file,
1862306a36Sopenharmony_ci			    long long offset, int orig);
1962306a36Sopenharmony_ci	long (*read)(struct snd_hwdep *hw, char __user *buf,
2062306a36Sopenharmony_ci		     long count, loff_t *offset);
2162306a36Sopenharmony_ci	long (*write)(struct snd_hwdep *hw, const char __user *buf,
2262306a36Sopenharmony_ci		      long count, loff_t *offset);
2362306a36Sopenharmony_ci	int (*open)(struct snd_hwdep *hw, struct file * file);
2462306a36Sopenharmony_ci	int (*release)(struct snd_hwdep *hw, struct file * file);
2562306a36Sopenharmony_ci	__poll_t (*poll)(struct snd_hwdep *hw, struct file *file,
2662306a36Sopenharmony_ci			     poll_table *wait);
2762306a36Sopenharmony_ci	int (*ioctl)(struct snd_hwdep *hw, struct file *file,
2862306a36Sopenharmony_ci		     unsigned int cmd, unsigned long arg);
2962306a36Sopenharmony_ci	int (*ioctl_compat)(struct snd_hwdep *hw, struct file *file,
3062306a36Sopenharmony_ci			    unsigned int cmd, unsigned long arg);
3162306a36Sopenharmony_ci	int (*mmap)(struct snd_hwdep *hw, struct file *file,
3262306a36Sopenharmony_ci		    struct vm_area_struct *vma);
3362306a36Sopenharmony_ci	int (*dsp_status)(struct snd_hwdep *hw,
3462306a36Sopenharmony_ci			  struct snd_hwdep_dsp_status *status);
3562306a36Sopenharmony_ci	int (*dsp_load)(struct snd_hwdep *hw,
3662306a36Sopenharmony_ci			struct snd_hwdep_dsp_image *image);
3762306a36Sopenharmony_ci};
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_cistruct snd_hwdep {
4062306a36Sopenharmony_ci	struct snd_card *card;
4162306a36Sopenharmony_ci	struct list_head list;
4262306a36Sopenharmony_ci	int device;
4362306a36Sopenharmony_ci	char id[32];
4462306a36Sopenharmony_ci	char name[80];
4562306a36Sopenharmony_ci	int iface;
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci#ifdef CONFIG_SND_OSSEMUL
4862306a36Sopenharmony_ci	int oss_type;
4962306a36Sopenharmony_ci	int ossreg;
5062306a36Sopenharmony_ci#endif
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci	struct snd_hwdep_ops ops;
5362306a36Sopenharmony_ci	wait_queue_head_t open_wait;
5462306a36Sopenharmony_ci	void *private_data;
5562306a36Sopenharmony_ci	void (*private_free) (struct snd_hwdep *hwdep);
5662306a36Sopenharmony_ci	struct device *dev;
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci	struct mutex open_mutex;
5962306a36Sopenharmony_ci	int used;			/* reference counter */
6062306a36Sopenharmony_ci	unsigned int dsp_loaded;	/* bit fields of loaded dsp indices */
6162306a36Sopenharmony_ci	unsigned int exclusive:1;	/* exclusive access mode */
6262306a36Sopenharmony_ci};
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ciextern int snd_hwdep_new(struct snd_card *card, char *id, int device,
6562306a36Sopenharmony_ci			 struct snd_hwdep **rhwdep);
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci#endif /* __SOUND_HWDEP_H */
68