ASoC: add Renesas R-Car core feature
[deliverable/linux.git] / sound / soc / sh / rcar / rsnd.h
CommitLineData
1536a968
KM
1/*
2 * Renesas R-Car
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef RSND_H
12#define RSND_H
13
14#include <linux/clk.h>
15#include <linux/device.h>
16#include <linux/io.h>
17#include <linux/list.h>
18#include <linux/module.h>
19#include <sound/rcar_snd.h>
20#include <sound/soc.h>
21#include <sound/pcm_params.h>
22
23/*
24 * pseudo register
25 *
26 * The register address offsets SRU/SCU/SSIU on Gen1/Gen2 are very different.
27 * This driver uses pseudo register in order to hide it.
28 * see gen1/gen2 for detail
29 */
30struct rsnd_priv;
31struct rsnd_dai;
32struct rsnd_dai_stream;
33
34/*
35 * R-Car sound DAI
36 */
37#define RSND_DAI_NAME_SIZE 16
38struct rsnd_dai_stream {
39 struct list_head head; /* head of rsnd_mod list */
40 struct snd_pcm_substream *substream;
41 int byte_pos;
42 int period_pos;
43 int byte_per_period;
44 int next_period_byte;
45};
46
47struct rsnd_dai {
48 char name[RSND_DAI_NAME_SIZE];
49 struct rsnd_dai_platform_info *info; /* rcar_snd.h */
50 struct rsnd_dai_stream playback;
51 struct rsnd_dai_stream capture;
52
53 int clk_master:1;
54 int bit_clk_inv:1;
55 int frm_clk_inv:1;
56 int sys_delay:1;
57 int data_alignment:1;
58};
59
60#define rsnd_dai_nr(priv) ((priv)->dai_nr)
61#define for_each_rsnd_dai(rdai, priv, i) \
62 for (i = 0, (rdai) = rsnd_dai_get(priv, i); \
63 i < rsnd_dai_nr(priv); \
64 i++, (rdai) = rsnd_dai_get(priv, i))
65
66struct rsnd_dai *rsnd_dai_get(struct rsnd_priv *priv, int id);
67int rsnd_dai_is_play(struct rsnd_dai *rdai, struct rsnd_dai_stream *io);
68#define rsnd_dai_get_platform_info(rdai) ((rdai)->info)
69
70void rsnd_dai_pointer_update(struct rsnd_dai_stream *io, int cnt);
71int rsnd_dai_pointer_offset(struct rsnd_dai_stream *io, int additional);
72
73/*
74 * R-Car sound priv
75 */
76struct rsnd_priv {
77
78 struct device *dev;
79 struct rcar_snd_info *info;
80 spinlock_t lock;
81
82 /*
83 * below value will be filled on rsnd_dai_probe()
84 */
85 struct snd_soc_dai_driver *daidrv;
86 struct rsnd_dai *rdai;
87 int dai_nr;
88};
89
90#define rsnd_priv_to_dev(priv) ((priv)->dev)
91#define rsnd_lock(priv, flags) spin_lock_irqsave(&priv->lock, flags)
92#define rsnd_unlock(priv, flags) spin_unlock_irqrestore(&priv->lock, flags)
93
94#endif
This page took 0.027728 seconds and 5 git commands to generate.