162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*****************************************************************************
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Copyright (C) 2008 Cedric Bregardis <cedric.bregardis@free.fr> and
562306a36Sopenharmony_ci * Jean-Christian Hassler <jhassler@free.fr>
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * This file is part of the Audiowerk2 ALSA driver
862306a36Sopenharmony_ci *
962306a36Sopenharmony_ci *****************************************************************************/
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#ifndef AW2_SAA7146_H
1262306a36Sopenharmony_ci#define AW2_SAA7146_H
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#define NB_STREAM_PLAYBACK 2
1562306a36Sopenharmony_ci#define NB_STREAM_CAPTURE 1
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#define NUM_STREAM_PLAYBACK_ANA 0
1862306a36Sopenharmony_ci#define NUM_STREAM_PLAYBACK_DIG 1
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#define NUM_STREAM_CAPTURE_ANA 0
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_citypedef void (*snd_aw2_saa7146_it_cb) (void *);
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_cistruct snd_aw2_saa7146_cb_param {
2562306a36Sopenharmony_ci	snd_aw2_saa7146_it_cb p_it_callback;
2662306a36Sopenharmony_ci	void *p_callback_param;
2762306a36Sopenharmony_ci};
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci/* definition of the chip-specific record */
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_cistruct snd_aw2_saa7146 {
3262306a36Sopenharmony_ci	void __iomem *base_addr;
3362306a36Sopenharmony_ci};
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ciextern void snd_aw2_saa7146_setup(struct snd_aw2_saa7146 *chip,
3662306a36Sopenharmony_ci				  void __iomem *pci_base_addr);
3762306a36Sopenharmony_ciextern int snd_aw2_saa7146_free(struct snd_aw2_saa7146 *chip);
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ciextern void snd_aw2_saa7146_pcm_init_playback(struct snd_aw2_saa7146 *chip,
4062306a36Sopenharmony_ci					      int stream_number,
4162306a36Sopenharmony_ci					      unsigned long dma_addr,
4262306a36Sopenharmony_ci					      unsigned long period_size,
4362306a36Sopenharmony_ci					      unsigned long buffer_size);
4462306a36Sopenharmony_ciextern void snd_aw2_saa7146_pcm_init_capture(struct snd_aw2_saa7146 *chip,
4562306a36Sopenharmony_ci					     int stream_number,
4662306a36Sopenharmony_ci					     unsigned long dma_addr,
4762306a36Sopenharmony_ci					     unsigned long period_size,
4862306a36Sopenharmony_ci					     unsigned long buffer_size);
4962306a36Sopenharmony_ciextern void snd_aw2_saa7146_define_it_playback_callback(unsigned int
5062306a36Sopenharmony_ci							stream_number,
5162306a36Sopenharmony_ci							snd_aw2_saa7146_it_cb
5262306a36Sopenharmony_ci							p_it_callback,
5362306a36Sopenharmony_ci							void *p_callback_param);
5462306a36Sopenharmony_ciextern void snd_aw2_saa7146_define_it_capture_callback(unsigned int
5562306a36Sopenharmony_ci						       stream_number,
5662306a36Sopenharmony_ci						       snd_aw2_saa7146_it_cb
5762306a36Sopenharmony_ci						       p_it_callback,
5862306a36Sopenharmony_ci						       void *p_callback_param);
5962306a36Sopenharmony_ciextern void snd_aw2_saa7146_pcm_trigger_start_capture(struct snd_aw2_saa7146
6062306a36Sopenharmony_ci						      *chip, int stream_number);
6162306a36Sopenharmony_ciextern void snd_aw2_saa7146_pcm_trigger_stop_capture(struct snd_aw2_saa7146
6262306a36Sopenharmony_ci						     *chip, int stream_number);
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ciextern void snd_aw2_saa7146_pcm_trigger_start_playback(struct snd_aw2_saa7146
6562306a36Sopenharmony_ci						       *chip,
6662306a36Sopenharmony_ci						       int stream_number);
6762306a36Sopenharmony_ciextern void snd_aw2_saa7146_pcm_trigger_stop_playback(struct snd_aw2_saa7146
6862306a36Sopenharmony_ci						      *chip, int stream_number);
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ciextern irqreturn_t snd_aw2_saa7146_interrupt(int irq, void *dev_id);
7162306a36Sopenharmony_ciextern unsigned int snd_aw2_saa7146_get_hw_ptr_playback(struct snd_aw2_saa7146
7262306a36Sopenharmony_ci							*chip,
7362306a36Sopenharmony_ci							int stream_number,
7462306a36Sopenharmony_ci							unsigned char
7562306a36Sopenharmony_ci							*start_addr,
7662306a36Sopenharmony_ci							unsigned int
7762306a36Sopenharmony_ci							buffer_size);
7862306a36Sopenharmony_ciextern unsigned int snd_aw2_saa7146_get_hw_ptr_capture(struct snd_aw2_saa7146
7962306a36Sopenharmony_ci						       *chip,
8062306a36Sopenharmony_ci						       int stream_number,
8162306a36Sopenharmony_ci						       unsigned char
8262306a36Sopenharmony_ci						       *start_addr,
8362306a36Sopenharmony_ci						       unsigned int
8462306a36Sopenharmony_ci						       buffer_size);
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ciextern void snd_aw2_saa7146_use_digital_input(struct snd_aw2_saa7146 *chip,
8762306a36Sopenharmony_ci					      int use_digital);
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ciextern int snd_aw2_saa7146_is_using_digital_input(struct snd_aw2_saa7146
9062306a36Sopenharmony_ci						  *chip);
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci#endif
93