Linux Audio

Check our new training course

Loading...
v6.13.7
  1/* SPDX-License-Identifier: GPL-2.0-or-later */
  2/*
  3 * atmel_ssc_dai.h - ALSA SSC interface for the Atmel  SoC
  4 *
  5 * Copyright (C) 2005 SAN People
  6 * Copyright (C) 2008 Atmel
  7 *
  8 * Author: Sedji Gaouaou <sedji.gaouaou@atmel.com>
  9 *         ATMEL CORP.
 10 *
 11 * Based on at91-ssc.c by
 12 * Frank Mandarino <fmandarino@endrelia.com>
 13 * Based on pxa2xx Platform drivers by
 14 * Liam Girdwood <lrg@slimlogic.co.uk>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 15 */
 16
 17#ifndef _ATMEL_SSC_DAI_H
 18#define _ATMEL_SSC_DAI_H
 19
 20#include <linux/types.h>
 21#include <linux/atmel-ssc.h>
 22
 23#include "atmel-pcm.h"
 24
 25/* SSC system clock ids */
 26#define ATMEL_SYSCLK_MCK	0 /* SSC uses AT91 MCK as system clock */
 27
 28/* SSC divider ids */
 29#define ATMEL_SSC_CMR_DIV	0 /* MCK divider for BCLK */
 30#define ATMEL_SSC_TCMR_PERIOD	1 /* BCLK divider for transmit FS */
 31#define ATMEL_SSC_RCMR_PERIOD	2 /* BCLK divider for receive FS */
 32/*
 33 * SSC direction masks
 34 */
 35#define SSC_DIR_MASK_UNUSED	0
 36#define SSC_DIR_MASK_PLAYBACK	1
 37#define SSC_DIR_MASK_CAPTURE	2
 38
 39/*
 40 * SSC register values that Atmel left out of <linux/atmel-ssc.h>.  These
 41 * are expected to be used with SSC_BF
 42 */
 43/* START bit field values */
 44#define SSC_START_CONTINUOUS	0
 45#define SSC_START_TX_RX		1
 46#define SSC_START_LOW_RF	2
 47#define SSC_START_HIGH_RF	3
 48#define SSC_START_FALLING_RF	4
 49#define SSC_START_RISING_RF	5
 50#define SSC_START_LEVEL_RF	6
 51#define SSC_START_EDGE_RF	7
 52#define SSS_START_COMPARE_0	8
 53
 54/* CKI bit field values */
 55#define SSC_CKI_FALLING		0
 56#define SSC_CKI_RISING		1
 57
 58/* CKO bit field values */
 59#define SSC_CKO_NONE		0
 60#define SSC_CKO_CONTINUOUS	1
 61#define SSC_CKO_TRANSFER	2
 62
 63/* CKS bit field values */
 64#define SSC_CKS_DIV		0
 65#define SSC_CKS_CLOCK		1
 66#define SSC_CKS_PIN		2
 67
 68/* FSEDGE bit field values */
 69#define SSC_FSEDGE_POSITIVE	0
 70#define SSC_FSEDGE_NEGATIVE	1
 71
 72/* FSOS bit field values */
 73#define SSC_FSOS_NONE		0
 74#define SSC_FSOS_NEGATIVE	1
 75#define SSC_FSOS_POSITIVE	2
 76#define SSC_FSOS_LOW		3
 77#define SSC_FSOS_HIGH		4
 78#define SSC_FSOS_TOGGLE		5
 79
 80#define START_DELAY		1
 81
 82struct atmel_ssc_state {
 83	u32 ssc_cmr;
 84	u32 ssc_rcmr;
 85	u32 ssc_rfmr;
 86	u32 ssc_tcmr;
 87	u32 ssc_tfmr;
 88	u32 ssc_sr;
 89	u32 ssc_imr;
 90};
 91
 92
 93struct atmel_ssc_info {
 94	char *name;
 95	struct ssc_device *ssc;
 
 96	unsigned short dir_mask;	/* 0=unused, 1=playback, 2=capture */
 97	unsigned short initialized;	/* true if SSC has been initialized */
 98	unsigned short daifmt;
 99	unsigned short cmr_div;
100	unsigned short tcmr_period;
101	unsigned short rcmr_period;
102	unsigned int forced_divider;
103	struct atmel_pcm_dma_params *dma_params[2];
104	struct atmel_ssc_state ssc_state;
105	unsigned long mck_rate;
106};
107
108int atmel_ssc_set_audio(int ssc_id);
109void atmel_ssc_put_audio(int ssc_id);
110
111#endif /* _AT91_SSC_DAI_H */
v4.10.11
 
  1/*
  2 * atmel_ssc_dai.h - ALSA SSC interface for the Atmel  SoC
  3 *
  4 * Copyright (C) 2005 SAN People
  5 * Copyright (C) 2008 Atmel
  6 *
  7 * Author: Sedji Gaouaou <sedji.gaouaou@atmel.com>
  8 *         ATMEL CORP.
  9 *
 10 * Based on at91-ssc.c by
 11 * Frank Mandarino <fmandarino@endrelia.com>
 12 * Based on pxa2xx Platform drivers by
 13 * Liam Girdwood <lrg@slimlogic.co.uk>
 14 *
 15 * This program is free software; you can redistribute it and/or modify
 16 * it under the terms of the GNU General Public License as published by
 17 * the Free Software Foundation; either version 2 of the License, or
 18 * (at your option) any later version.
 19 *
 20 * This program is distributed in the hope that it will be useful,
 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 23 * GNU General Public License for more details.
 24 *
 25 * You should have received a copy of the GNU General Public License
 26 * along with this program; if not, write to the Free Software
 27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 28 */
 29
 30#ifndef _ATMEL_SSC_DAI_H
 31#define _ATMEL_SSC_DAI_H
 32
 33#include <linux/types.h>
 34#include <linux/atmel-ssc.h>
 35
 36#include "atmel-pcm.h"
 37
 38/* SSC system clock ids */
 39#define ATMEL_SYSCLK_MCK	0 /* SSC uses AT91 MCK as system clock */
 40
 41/* SSC divider ids */
 42#define ATMEL_SSC_CMR_DIV	0 /* MCK divider for BCLK */
 43#define ATMEL_SSC_TCMR_PERIOD	1 /* BCLK divider for transmit FS */
 44#define ATMEL_SSC_RCMR_PERIOD	2 /* BCLK divider for receive FS */
 45/*
 46 * SSC direction masks
 47 */
 48#define SSC_DIR_MASK_UNUSED	0
 49#define SSC_DIR_MASK_PLAYBACK	1
 50#define SSC_DIR_MASK_CAPTURE	2
 51
 52/*
 53 * SSC register values that Atmel left out of <linux/atmel-ssc.h>.  These
 54 * are expected to be used with SSC_BF
 55 */
 56/* START bit field values */
 57#define SSC_START_CONTINUOUS	0
 58#define SSC_START_TX_RX		1
 59#define SSC_START_LOW_RF	2
 60#define SSC_START_HIGH_RF	3
 61#define SSC_START_FALLING_RF	4
 62#define SSC_START_RISING_RF	5
 63#define SSC_START_LEVEL_RF	6
 64#define SSC_START_EDGE_RF	7
 65#define SSS_START_COMPARE_0	8
 66
 67/* CKI bit field values */
 68#define SSC_CKI_FALLING		0
 69#define SSC_CKI_RISING		1
 70
 71/* CKO bit field values */
 72#define SSC_CKO_NONE		0
 73#define SSC_CKO_CONTINUOUS	1
 74#define SSC_CKO_TRANSFER	2
 75
 76/* CKS bit field values */
 77#define SSC_CKS_DIV		0
 78#define SSC_CKS_CLOCK		1
 79#define SSC_CKS_PIN		2
 80
 81/* FSEDGE bit field values */
 82#define SSC_FSEDGE_POSITIVE	0
 83#define SSC_FSEDGE_NEGATIVE	1
 84
 85/* FSOS bit field values */
 86#define SSC_FSOS_NONE		0
 87#define SSC_FSOS_NEGATIVE	1
 88#define SSC_FSOS_POSITIVE	2
 89#define SSC_FSOS_LOW		3
 90#define SSC_FSOS_HIGH		4
 91#define SSC_FSOS_TOGGLE		5
 92
 93#define START_DELAY		1
 94
 95struct atmel_ssc_state {
 96	u32 ssc_cmr;
 97	u32 ssc_rcmr;
 98	u32 ssc_rfmr;
 99	u32 ssc_tcmr;
100	u32 ssc_tfmr;
101	u32 ssc_sr;
102	u32 ssc_imr;
103};
104
105
106struct atmel_ssc_info {
107	char *name;
108	struct ssc_device *ssc;
109	spinlock_t lock;	/* lock for dir_mask */
110	unsigned short dir_mask;	/* 0=unused, 1=playback, 2=capture */
111	unsigned short initialized;	/* true if SSC has been initialized */
112	unsigned short daifmt;
113	unsigned short cmr_div;
114	unsigned short tcmr_period;
115	unsigned short rcmr_period;
116	unsigned int forced_divider;
117	struct atmel_pcm_dma_params *dma_params[2];
118	struct atmel_ssc_state ssc_state;
119	unsigned long mck_rate;
120};
121
122int atmel_ssc_set_audio(int ssc_id);
123void atmel_ssc_put_audio(int ssc_id);
124
125#endif /* _AT91_SSC_DAI_H */