Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions
fsi.c File Reference
#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/pm_runtime.h>
#include <linux/io.h>
#include <linux/scatterlist.h>
#include <linux/sh_dma.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/workqueue.h>
#include <sound/soc.h>
#include <sound/sh_fsi.h>

Go to the source code of this file.

Data Structures

struct  fsi_stream
 
struct  fsi_priv
 
struct  fsi_stream_handler
 
struct  fsi_core
 
struct  fsi_master
 

Macros

#define REG_DO_FMT   0x0000
 
#define REG_DOFF_CTL   0x0004
 
#define REG_DOFF_ST   0x0008
 
#define REG_DI_FMT   0x000C
 
#define REG_DIFF_CTL   0x0010
 
#define REG_DIFF_ST   0x0014
 
#define REG_CKG1   0x0018
 
#define REG_CKG2   0x001C
 
#define REG_DIDT   0x0020
 
#define REG_DODT   0x0024
 
#define REG_MUTE_ST   0x0028
 
#define REG_OUT_DMAC   0x002C
 
#define REG_OUT_SEL   0x0030
 
#define REG_IN_DMAC   0x0038
 
#define MST_CLK_RST   0x0210
 
#define MST_SOFT_RST   0x0214
 
#define MST_FIFO_SZ   0x0218
 
#define A_MST_CTLR   0x0180
 
#define B_MST_CTLR   0x01A0
 
#define CPU_INT_ST   0x01F4
 
#define CPU_IEMSK   0x01F8
 
#define CPU_IMSK   0x01FC
 
#define INT_ST   0x0200
 
#define IEMSK   0x0204
 
#define IMSK   0x0208
 
#define CR_BWS_MASK   (0x3 << 20) /* FSI2 */
 
#define CR_BWS_24   (0x0 << 20) /* FSI2 */
 
#define CR_BWS_16   (0x1 << 20) /* FSI2 */
 
#define CR_BWS_20   (0x2 << 20) /* FSI2 */
 
#define CR_DTMD_PCM   (0x0 << 8) /* FSI2 */
 
#define CR_DTMD_SPDIF_PCM   (0x1 << 8) /* FSI2 */
 
#define CR_DTMD_SPDIF_STREAM   (0x2 << 8) /* FSI2 */
 
#define CR_MONO   (0x0 << 4)
 
#define CR_MONO_D   (0x1 << 4)
 
#define CR_PCM   (0x2 << 4)
 
#define CR_I2S   (0x3 << 4)
 
#define CR_TDM   (0x4 << 4)
 
#define CR_TDM_D   (0x5 << 4)
 
#define VDMD_MASK   (0x3 << 4)
 
#define VDMD_FRONT   (0x0 << 4) /* Package in front */
 
#define VDMD_BACK   (0x1 << 4) /* Package in back */
 
#define VDMD_STREAM   (0x2 << 4) /* Stream mode(16bit * 2) */
 
#define DMA_ON   (0x1 << 0)
 
#define IRQ_HALF   0x00100000
 
#define FIFO_CLR   0x00000001
 
#define ERR_OVER   0x00000010
 
#define ERR_UNDER   0x00000001
 
#define ST_ERR   (ERR_OVER | ERR_UNDER)
 
#define ACKMD_MASK   0x00007000
 
#define BPFMD_MASK   0x00000700
 
#define DIMD   (1 << 4)
 
#define DOMD   (1 << 0)
 
#define BP   (1 << 4) /* Fix the signal of Biphase output */
 
#define SE   (1 << 0) /* Fix the master clock */
 
#define CRB   (1 << 4)
 
#define CRA   (1 << 0)
 
#define BI_SHIFT   12
 
#define BO_SHIFT   8
 
#define AI_SHIFT   4
 
#define AO_SHIFT   0
 
#define AB_IO(param, shift)   (param << shift)
 
#define PBSR   (1 << 12) /* Port B Software Reset */
 
#define PASR   (1 << 8) /* Port A Software Reset */
 
#define IR   (1 << 4) /* Interrupt Reset */
 
#define FSISR   (1 << 0) /* Software Reset */
 
#define DMMD   (1 << 4) /* SPDIF output timing 0: Biphase only */
 
#define FIFO_SZ_MASK   0x7
 
#define FSI_RATES   SNDRV_PCM_RATE_8000_96000
 
#define FSI_FMTS   (SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S16_LE)
 
#define SHIFT_16DATA   0
 
#define SHIFT_24DATA   4
 
#define PACKAGE_24BITBUS_BACK   0
 
#define PACKAGE_24BITBUS_FRONT   1
 
#define PACKAGE_16BITBUS_STREAM   2
 
#define BUSOP_SET(s, a)   ((a) << SHIFT_ ## s ## DATA)
 
#define BUSOP_GET(s, a)   (((a) >> SHIFT_ ## s ## DATA) & 0xF)
 
#define fsi_stream_handler_call(io, func, args...)
 
#define fsi_reg_write(p, r, d)   __fsi_reg_write((p->base + REG_##r), d)
 
#define fsi_reg_read(p, r)   __fsi_reg_read((p->base + REG_##r))
 
#define fsi_reg_mask_set(p, r, m, d)   __fsi_reg_mask_set((p->base + REG_##r), m, d)
 
#define fsi_master_read(p, r)   _fsi_master_read(p, MST_##r)
 
#define fsi_core_read(p, r)   _fsi_master_read(p, p->core->r)
 
#define fsi_master_mask_set(p, r, m, d)   _fsi_master_mask_set(p, MST_##r, m, d)
 
#define fsi_core_mask_set(p, r, m, d)   _fsi_master_mask_set(p, p->core->r, m, d)
 
#define fsi_stream_start(fsi, io)   fsi_stream_handler_call(io, start_stop, fsi, io, 1)
 
#define fsi_stream_stop(fsi, io)   fsi_stream_handler_call(io, start_stop, fsi, io, 0)
 
#define PREALLOC_BUFFER   (32 * 1024)
 
#define PREALLOC_BUFFER_MAX   (32 * 1024)
 

Typedefs

typedef int(* set_rate_func )(struct device *dev, int rate, int enable)
 

Functions

 MODULE_DEVICE_TABLE (platform, fsi_id_table)
 
 module_platform_driver (fsi_driver)
 
 MODULE_LICENSE ("GPL")
 
 MODULE_DESCRIPTION ("SuperH onchip FSI audio driver")
 
 MODULE_AUTHOR ("Kuninori Morimoto <[email protected]>")
 
 MODULE_ALIAS ("platform:fsi-pcm-audio")
 

Macro Definition Documentation

#define A_MST_CTLR   0x0180

Definition at line 49 of file fsi.c.

#define AB_IO (   param,
  shift 
)    (param << shift)

Definition at line 114 of file fsi.c.

#define ACKMD_MASK   0x00007000

Definition at line 96 of file fsi.c.

#define AI_SHIFT   4

Definition at line 112 of file fsi.c.

#define AO_SHIFT   0

Definition at line 113 of file fsi.c.

#define B_MST_CTLR   0x01A0

Definition at line 50 of file fsi.c.

#define BI_SHIFT   12

Definition at line 110 of file fsi.c.

#define BO_SHIFT   8

Definition at line 111 of file fsi.c.

#define BP   (1 << 4) /* Fix the signal of Biphase output */

Definition at line 102 of file fsi.c.

#define BPFMD_MASK   0x00000700

Definition at line 97 of file fsi.c.

#define BUSOP_GET (   s,
  a 
)    (((a) >> SHIFT_ ## s ## DATA) & 0xF)

Definition at line 152 of file fsi.c.

#define BUSOP_SET (   s,
  a 
)    ((a) << SHIFT_ ## s ## DATA)

Definition at line 151 of file fsi.c.

#define CPU_IEMSK   0x01F8

Definition at line 52 of file fsi.c.

#define CPU_IMSK   0x01FC

Definition at line 53 of file fsi.c.

#define CPU_INT_ST   0x01F4

Definition at line 51 of file fsi.c.

#define CR_BWS_16   (0x1 << 20) /* FSI2 */

Definition at line 62 of file fsi.c.

#define CR_BWS_20   (0x2 << 20) /* FSI2 */

Definition at line 63 of file fsi.c.

#define CR_BWS_24   (0x0 << 20) /* FSI2 */

Definition at line 61 of file fsi.c.

#define CR_BWS_MASK   (0x3 << 20) /* FSI2 */

Definition at line 60 of file fsi.c.

#define CR_DTMD_PCM   (0x0 << 8) /* FSI2 */

Definition at line 65 of file fsi.c.

#define CR_DTMD_SPDIF_PCM   (0x1 << 8) /* FSI2 */

Definition at line 66 of file fsi.c.

#define CR_DTMD_SPDIF_STREAM   (0x2 << 8) /* FSI2 */

Definition at line 67 of file fsi.c.

#define CR_I2S   (0x3 << 4)

Definition at line 72 of file fsi.c.

#define CR_MONO   (0x0 << 4)

Definition at line 69 of file fsi.c.

#define CR_MONO_D   (0x1 << 4)

Definition at line 70 of file fsi.c.

#define CR_PCM   (0x2 << 4)

Definition at line 71 of file fsi.c.

#define CR_TDM   (0x4 << 4)

Definition at line 73 of file fsi.c.

#define CR_TDM_D   (0x5 << 4)

Definition at line 74 of file fsi.c.

#define CRA   (1 << 0)

Definition at line 107 of file fsi.c.

#define CRB   (1 << 4)

Definition at line 106 of file fsi.c.

#define DIMD   (1 << 4)

Definition at line 98 of file fsi.c.

#define DMA_ON   (0x1 << 0)

Definition at line 83 of file fsi.c.

#define DMMD   (1 << 4) /* SPDIF output timing 0: Biphase only */

Definition at line 123 of file fsi.c.

#define DOMD   (1 << 0)

Definition at line 99 of file fsi.c.

#define ERR_OVER   0x00000010

Definition at line 91 of file fsi.c.

#define ERR_UNDER   0x00000001

Definition at line 92 of file fsi.c.

#define FIFO_CLR   0x00000001

Definition at line 88 of file fsi.c.

#define FIFO_SZ_MASK   0x7

Definition at line 127 of file fsi.c.

#define fsi_core_mask_set (   p,
  r,
  m,
  d 
)    _fsi_master_mask_set(p, p->core->r, m, d)

Definition at line 334 of file fsi.c.

#define fsi_core_read (   p,
  r 
)    _fsi_master_read(p, p->core->r)

Definition at line 320 of file fsi.c.

Definition at line 131 of file fsi.c.

#define fsi_master_mask_set (   p,
  r,
  m,
  d 
)    _fsi_master_mask_set(p, MST_##r, m, d)

Definition at line 333 of file fsi.c.

#define fsi_master_read (   p,
  r 
)    _fsi_master_read(p, MST_##r)

Definition at line 319 of file fsi.c.

#define FSI_RATES   SNDRV_PCM_RATE_8000_96000

Definition at line 129 of file fsi.c.

#define fsi_reg_mask_set (   p,
  r,
  m,
  d 
)    __fsi_reg_mask_set((p->base + REG_##r), m, d)

Definition at line 316 of file fsi.c.

#define fsi_reg_read (   p,
  r 
)    __fsi_reg_read((p->base + REG_##r))

Definition at line 313 of file fsi.c.

#define fsi_reg_write (   p,
  r,
  d 
)    __fsi_reg_write((p->base + REG_##r), d)

Definition at line 310 of file fsi.c.

#define fsi_stream_handler_call (   io,
  func,
  args... 
)
Value:
(!(io) ? -ENODEV : \
!((io)->handler->func) ? 0 : \
(io)->handler->func(args))

Definition at line 257 of file fsi.c.

#define fsi_stream_start (   fsi,
  io 
)    fsi_stream_handler_call(io, start_stop, fsi, io, 1)

Definition at line 569 of file fsi.c.

#define fsi_stream_stop (   fsi,
  io 
)    fsi_stream_handler_call(io, start_stop, fsi, io, 0)

Definition at line 572 of file fsi.c.

#define FSISR   (1 << 0) /* Software Reset */

Definition at line 120 of file fsi.c.

#define IEMSK   0x0204

Definition at line 55 of file fsi.c.

#define IMSK   0x0208

Definition at line 56 of file fsi.c.

#define INT_ST   0x0200

Definition at line 54 of file fsi.c.

#define IR   (1 << 4) /* Interrupt Reset */

Definition at line 119 of file fsi.c.

#define IRQ_HALF   0x00100000

Definition at line 87 of file fsi.c.

#define MST_CLK_RST   0x0210

Definition at line 44 of file fsi.c.

#define MST_FIFO_SZ   0x0218

Definition at line 46 of file fsi.c.

#define MST_SOFT_RST   0x0214

Definition at line 45 of file fsi.c.

#define PACKAGE_16BITBUS_STREAM   2

Definition at line 149 of file fsi.c.

#define PACKAGE_24BITBUS_BACK   0

Definition at line 147 of file fsi.c.

#define PACKAGE_24BITBUS_FRONT   1

Definition at line 148 of file fsi.c.

#define PASR   (1 << 8) /* Port A Software Reset */

Definition at line 118 of file fsi.c.

#define PBSR   (1 << 12) /* Port B Software Reset */

Definition at line 117 of file fsi.c.

#define PREALLOC_BUFFER   (32 * 1024)

Definition at line 1556 of file fsi.c.

#define PREALLOC_BUFFER_MAX   (32 * 1024)

Definition at line 1557 of file fsi.c.

#define REG_CKG1   0x0018

Definition at line 34 of file fsi.c.

#define REG_CKG2   0x001C

Definition at line 35 of file fsi.c.

#define REG_DI_FMT   0x000C

Definition at line 31 of file fsi.c.

#define REG_DIDT   0x0020

Definition at line 36 of file fsi.c.

#define REG_DIFF_CTL   0x0010

Definition at line 32 of file fsi.c.

#define REG_DIFF_ST   0x0014

Definition at line 33 of file fsi.c.

#define REG_DO_FMT   0x0000

Definition at line 28 of file fsi.c.

#define REG_DODT   0x0024

Definition at line 37 of file fsi.c.

#define REG_DOFF_CTL   0x0004

Definition at line 29 of file fsi.c.

#define REG_DOFF_ST   0x0008

Definition at line 30 of file fsi.c.

#define REG_IN_DMAC   0x0038

Definition at line 41 of file fsi.c.

#define REG_MUTE_ST   0x0028

Definition at line 38 of file fsi.c.

#define REG_OUT_DMAC   0x002C

Definition at line 39 of file fsi.c.

#define REG_OUT_SEL   0x0030

Definition at line 40 of file fsi.c.

#define SE   (1 << 0) /* Fix the master clock */

Definition at line 103 of file fsi.c.

#define SHIFT_16DATA   0

Definition at line 144 of file fsi.c.

#define SHIFT_24DATA   4

Definition at line 145 of file fsi.c.

#define ST_ERR   (ERR_OVER | ERR_UNDER)

Definition at line 93 of file fsi.c.

#define VDMD_BACK   (0x1 << 4) /* Package in back */

Definition at line 80 of file fsi.c.

#define VDMD_FRONT   (0x0 << 4) /* Package in front */

Definition at line 79 of file fsi.c.

#define VDMD_MASK   (0x3 << 4)

Definition at line 78 of file fsi.c.

#define VDMD_STREAM   (0x2 << 4) /* Stream mode(16bit * 2) */

Definition at line 81 of file fsi.c.

Typedef Documentation

typedef int(* set_rate_func)(struct device *dev, int rate, int enable)

Definition at line 133 of file fsi.c.

Function Documentation

MODULE_ALIAS ( "platform:fsi-pcm-audio )
MODULE_AUTHOR ( "Kuninori Morimoto <[email protected]>"  )
MODULE_DESCRIPTION ( "SuperH onchip FSI audio driver )
MODULE_DEVICE_TABLE ( platform  ,
fsi_id_table   
)
MODULE_LICENSE ( "GPL"  )
module_platform_driver ( fsi_driver  )