linux/include/sound/wss.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef __SOUND_WSS_H
#define __SOUND_WSS_H

/*
 *  Copyright (c) by Jaroslav Kysela <[email protected]>
 *  Definitions for CS4231 & InterWave chips & compatible chips
 */

#include <sound/control.h>
#include <sound/pcm.h>
#include <sound/timer.h>

#include <sound/cs4231-regs.h>

/* defines for codec.mode */

#define WSS_MODE_NONE
#define WSS_MODE_PLAY
#define WSS_MODE_RECORD
#define WSS_MODE_TIMER
#define WSS_MODE_OPEN

/* defines for codec.hardware */

#define WSS_HW_DETECT
#define WSS_HW_DETECT3
#define WSS_HW_TYPE_MASK
#define WSS_HW_CS4231_MASK
#define WSS_HW_CS4231
#define WSS_HW_CS4231A
#define WSS_HW_AD1845
#define WSS_HW_CS4232_MASK
#define WSS_HW_CS4232
#define WSS_HW_CS4232A
#define WSS_HW_CS4236
#define WSS_HW_CS4236B_MASK
#define WSS_HW_CS4235
#define WSS_HW_CS4236B
#define WSS_HW_CS4237B
#define WSS_HW_CS4238B
#define WSS_HW_CS4239
#define WSS_HW_AD1848_MASK
#define WSS_HW_AD1847
#define WSS_HW_AD1848
#define WSS_HW_CS4248
#define WSS_HW_CMI8330
#define WSS_HW_THINKPAD
/* compatible, but clones */
#define WSS_HW_INTERWAVE
#define WSS_HW_OPL3SA2
#define WSS_HW_OPTI93X

/* defines for codec.hwshare */
#define WSS_HWSHARE_IRQ
#define WSS_HWSHARE_DMA1
#define WSS_HWSHARE_DMA2

/* IBM Thinkpad specific stuff */
#define AD1848_THINKPAD_CTL_PORT1
#define AD1848_THINKPAD_CTL_PORT2
#define AD1848_THINKPAD_CS4248_ENABLE_BIT

struct snd_wss {};

/* exported functions */

void snd_wss_out(struct snd_wss *chip, unsigned char reg, unsigned char val);
unsigned char snd_wss_in(struct snd_wss *chip, unsigned char reg);
void snd_cs4236_ext_out(struct snd_wss *chip,
			unsigned char reg, unsigned char val);
unsigned char snd_cs4236_ext_in(struct snd_wss *chip, unsigned char reg);
void snd_wss_mce_up(struct snd_wss *chip);
void snd_wss_mce_down(struct snd_wss *chip);

void snd_wss_overrange(struct snd_wss *chip);

irqreturn_t snd_wss_interrupt(int irq, void *dev_id);

const char *snd_wss_chip_id(struct snd_wss *chip);

int snd_wss_create(struct snd_card *card,
		      unsigned long port,
		      unsigned long cport,
		      int irq, int dma1, int dma2,
		      unsigned short hardware,
		      unsigned short hwshare,
		      struct snd_wss **rchip);
int snd_wss_pcm(struct snd_wss *chip, int device);
int snd_wss_timer(struct snd_wss *chip, int device);
int snd_wss_mixer(struct snd_wss *chip);

const struct snd_pcm_ops *snd_wss_get_pcm_ops(int direction);

int snd_cs4236_create(struct snd_card *card,
		      unsigned long port,
		      unsigned long cport,
		      int irq, int dma1, int dma2,
		      unsigned short hardware,
		      unsigned short hwshare,
		      struct snd_wss **rchip);
int snd_cs4236_pcm(struct snd_wss *chip, int device);
int snd_cs4236_mixer(struct snd_wss *chip);

/*
 *  mixer library
 */

#define WSS_SINGLE(xname, xindex, reg, shift, mask, invert)

int snd_wss_info_single(struct snd_kcontrol *kcontrol,
			struct snd_ctl_elem_info *uinfo);
int snd_wss_get_single(struct snd_kcontrol *kcontrol,
			struct snd_ctl_elem_value *ucontrol);
int snd_wss_put_single(struct snd_kcontrol *kcontrol,
			struct snd_ctl_elem_value *ucontrol);

#define WSS_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert)

#define WSS_SINGLE_TLV(xname, xindex, reg, shift, mask, invert, xtlv)

#define WSS_DOUBLE_TLV(xname, xindex, left_reg, right_reg, \
			shift_left, shift_right, mask, invert, xtlv)


int snd_wss_info_double(struct snd_kcontrol *kcontrol,
			struct snd_ctl_elem_info *uinfo);
int snd_wss_get_double(struct snd_kcontrol *kcontrol,
			struct snd_ctl_elem_value *ucontrol);
int snd_wss_put_double(struct snd_kcontrol *kcontrol,
			struct snd_ctl_elem_value *ucontrol);

#endif /* __SOUND_WSS_H */