18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef PXA2XX_LIB_H
38c2ecf20Sopenharmony_ci#define PXA2XX_LIB_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <uapi/sound/asound.h>
68c2ecf20Sopenharmony_ci#include <linux/platform_device.h>
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci/* PCM */
98c2ecf20Sopenharmony_cistruct snd_pcm_substream;
108c2ecf20Sopenharmony_cistruct snd_pcm_hw_params;
118c2ecf20Sopenharmony_cistruct snd_soc_pcm_runtime;
128c2ecf20Sopenharmony_cistruct snd_pcm;
138c2ecf20Sopenharmony_cistruct snd_soc_component;
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciextern int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream,
168c2ecf20Sopenharmony_ci				struct snd_pcm_hw_params *params);
178c2ecf20Sopenharmony_ciextern int pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream);
188c2ecf20Sopenharmony_ciextern int pxa2xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd);
198c2ecf20Sopenharmony_ciextern snd_pcm_uframes_t pxa2xx_pcm_pointer(struct snd_pcm_substream *substream);
208c2ecf20Sopenharmony_ciextern int pxa2xx_pcm_prepare(struct snd_pcm_substream *substream);
218c2ecf20Sopenharmony_ciextern int pxa2xx_pcm_open(struct snd_pcm_substream *substream);
228c2ecf20Sopenharmony_ciextern int pxa2xx_pcm_close(struct snd_pcm_substream *substream);
238c2ecf20Sopenharmony_ciextern int pxa2xx_pcm_mmap(struct snd_pcm_substream *substream,
248c2ecf20Sopenharmony_ci	struct vm_area_struct *vma);
258c2ecf20Sopenharmony_ciextern int pxa2xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream);
268c2ecf20Sopenharmony_ciextern void pxa2xx_pcm_free_dma_buffers(struct snd_pcm *pcm);
278c2ecf20Sopenharmony_ciextern void pxa2xx_soc_pcm_free(struct snd_soc_component *component,
288c2ecf20Sopenharmony_ci				struct snd_pcm *pcm);
298c2ecf20Sopenharmony_ciextern int pxa2xx_soc_pcm_new(struct snd_soc_component *component,
308c2ecf20Sopenharmony_ci			      struct snd_soc_pcm_runtime *rtd);
318c2ecf20Sopenharmony_ciextern int pxa2xx_soc_pcm_open(struct snd_soc_component *component,
328c2ecf20Sopenharmony_ci			       struct snd_pcm_substream *substream);
338c2ecf20Sopenharmony_ciextern int pxa2xx_soc_pcm_close(struct snd_soc_component *component,
348c2ecf20Sopenharmony_ci				struct snd_pcm_substream *substream);
358c2ecf20Sopenharmony_ciextern int pxa2xx_soc_pcm_hw_params(struct snd_soc_component *component,
368c2ecf20Sopenharmony_ci				    struct snd_pcm_substream *substream,
378c2ecf20Sopenharmony_ci				    struct snd_pcm_hw_params *params);
388c2ecf20Sopenharmony_ciextern int pxa2xx_soc_pcm_hw_free(struct snd_soc_component *component,
398c2ecf20Sopenharmony_ci				  struct snd_pcm_substream *substream);
408c2ecf20Sopenharmony_ciextern int pxa2xx_soc_pcm_prepare(struct snd_soc_component *component,
418c2ecf20Sopenharmony_ci				  struct snd_pcm_substream *substream);
428c2ecf20Sopenharmony_ciextern int pxa2xx_soc_pcm_trigger(struct snd_soc_component *component,
438c2ecf20Sopenharmony_ci				  struct snd_pcm_substream *substream, int cmd);
448c2ecf20Sopenharmony_ciextern snd_pcm_uframes_t
458c2ecf20Sopenharmony_cipxa2xx_soc_pcm_pointer(struct snd_soc_component *component,
468c2ecf20Sopenharmony_ci		       struct snd_pcm_substream *substream);
478c2ecf20Sopenharmony_ciextern int pxa2xx_soc_pcm_mmap(struct snd_soc_component *component,
488c2ecf20Sopenharmony_ci			       struct snd_pcm_substream *substream,
498c2ecf20Sopenharmony_ci			       struct vm_area_struct *vma);
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci/* AC97 */
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ciextern int pxa2xx_ac97_read(int slot, unsigned short reg);
548c2ecf20Sopenharmony_ciextern int pxa2xx_ac97_write(int slot, unsigned short reg, unsigned short val);
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ciextern bool pxa2xx_ac97_try_warm_reset(void);
578c2ecf20Sopenharmony_ciextern bool pxa2xx_ac97_try_cold_reset(void);
588c2ecf20Sopenharmony_ciextern void pxa2xx_ac97_finish_reset(void);
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ciextern int pxa2xx_ac97_hw_suspend(void);
618c2ecf20Sopenharmony_ciextern int pxa2xx_ac97_hw_resume(void);
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ciextern int pxa2xx_ac97_hw_probe(struct platform_device *dev);
648c2ecf20Sopenharmony_ciextern void pxa2xx_ac97_hw_remove(struct platform_device *dev);
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci#endif
67