blob: d76412b84b48c224a84df86049308ebb675d59db [file] [log] [blame]
Kuninori Morimoto1536a962013-07-21 21:35:52 -07001/*
2 * Renesas R-Car SRU/SCU/SSIU/SSI support
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
12#ifndef RCAR_SND_H
13#define RCAR_SND_H
14
15#include <linux/sh_clk.h>
16
Kuninori Morimoto07539c12013-07-21 21:36:35 -070017#define RSND_GEN1_SRU 0
Kuninori Morimotodfc94032013-07-21 21:36:46 -070018#define RSND_GEN1_ADG 1
Kuninori Morimotoae5c3222013-07-21 21:36:57 -070019#define RSND_GEN1_SSI 2
Kuninori Morimoto1536a962013-07-21 21:35:52 -070020
Kuninori Morimoto32475262013-11-19 01:06:15 -080021#define RSND_GEN2_SCU 0
Kuninori Morimotodfc94032013-07-21 21:36:46 -070022#define RSND_GEN2_ADG 1
Kuninori Morimotoae5c3222013-07-21 21:36:57 -070023#define RSND_GEN2_SSIU 2
24#define RSND_GEN2_SSI 3
Kuninori Morimoto07539c12013-07-21 21:36:35 -070025
Kuninori Morimotoae5c3222013-07-21 21:36:57 -070026#define RSND_BASE_MAX 4
27
28/*
29 * flags
30 *
Kuninori Morimoto4b4dab82013-07-28 18:58:29 -070031 * 0xAB000000
Kuninori Morimotoae5c3222013-07-21 21:36:57 -070032 *
33 * A : clock sharing settings
Kuninori Morimoto4b4dab82013-07-28 18:58:29 -070034 * B : SSI direction
Kuninori Morimotoae5c3222013-07-21 21:36:57 -070035 */
36#define RSND_SSI_CLK_PIN_SHARE (1 << 31)
Kuninori Morimotod9288d02014-06-22 17:56:23 -070037#define RSND_SSI_NO_BUSIF (1 << 30) /* SSI+DMA without BUSIF */
Kuninori Morimoto4b4dab82013-07-28 18:58:29 -070038
Kuninori Morimoto78f13d02014-03-03 20:49:50 -080039#define RSND_SSI(_dma_id, _pio_irq, _flags) \
40{ .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }
Kuninori Morimoto4b4dab82013-07-28 18:58:29 -070041#define RSND_SSI_UNUSED \
Kuninori Morimoto29e69fd2014-05-08 01:59:26 -070042{ .dma_id = -1, .pio_irq = -1, .flags = 0 }
Kuninori Morimoto4b4dab82013-07-28 18:58:29 -070043
Kuninori Morimotoae5c3222013-07-21 21:36:57 -070044struct rsnd_ssi_platform_info {
Kuninori Morimoto849fc822013-07-28 18:59:02 -070045 int dma_id;
Kuninori Morimotoae5c3222013-07-21 21:36:57 -070046 int pio_irq;
47 u32 flags;
48};
Kuninori Morimoto07539c12013-07-21 21:36:35 -070049
Kuninori Morimotoba9c9492014-03-03 20:51:21 -080050#define RSND_SRC(rate, _dma_id) \
Kuninori Morimoto29e69fd2014-05-08 01:59:26 -070051{ .convert_rate = rate, .dma_id = _dma_id, }
Kuninori Morimotoba9c9492014-03-03 20:51:21 -080052#define RSND_SRC_UNUSED \
Kuninori Morimoto29e69fd2014-05-08 01:59:26 -070053{ .convert_rate = 0, .dma_id = -1, }
Kuninori Morimotoba9c9492014-03-03 20:51:21 -080054
55struct rsnd_src_platform_info {
Kuninori Morimotoef749402013-12-19 19:28:51 -080056 u32 convert_rate; /* sampling rate convert */
Kuninori Morimoto629509c2014-01-23 18:42:00 -080057 int dma_id; /* for Gen2 SCU */
Kuninori Morimoto07539c12013-07-21 21:36:35 -070058};
Kuninori Morimoto1536a962013-07-21 21:35:52 -070059
Kuninori Morimotobff58ea2014-05-08 17:44:49 -070060/*
61 * flags
62 */
63struct rsnd_dvc_platform_info {
64 u32 flags;
65};
66
Kuninori Morimoto78f13d02014-03-03 20:49:50 -080067struct rsnd_dai_path_info {
68 struct rsnd_ssi_platform_info *ssi;
Kuninori Morimotoba9c9492014-03-03 20:51:21 -080069 struct rsnd_src_platform_info *src;
Kuninori Morimotobff58ea2014-05-08 17:44:49 -070070 struct rsnd_dvc_platform_info *dvc;
Kuninori Morimoto78f13d02014-03-03 20:49:50 -080071};
72
73struct rsnd_dai_platform_info {
74 struct rsnd_dai_path_info playback;
75 struct rsnd_dai_path_info capture;
76};
77
Kuninori Morimoto33377442013-07-21 21:36:21 -070078/*
79 * flags
80 *
81 * 0x0000000A
82 *
83 * A : generation
84 */
Kuninori Morimotoc5d5a582013-10-11 00:07:01 -070085#define RSND_GEN_MASK (0xF << 0)
Kuninori Morimoto33377442013-07-21 21:36:21 -070086#define RSND_GEN1 (1 << 0) /* fixme */
87#define RSND_GEN2 (2 << 0) /* fixme */
88
Kuninori Morimoto1536a962013-07-21 21:35:52 -070089struct rcar_snd_info {
90 u32 flags;
Kuninori Morimotoae5c3222013-07-21 21:36:57 -070091 struct rsnd_ssi_platform_info *ssi_info;
92 int ssi_info_nr;
Kuninori Morimotoba9c9492014-03-03 20:51:21 -080093 struct rsnd_src_platform_info *src_info;
94 int src_info_nr;
Kuninori Morimotobff58ea2014-05-08 17:44:49 -070095 struct rsnd_dvc_platform_info *dvc_info;
96 int dvc_info_nr;
Kuninori Morimoto78f13d02014-03-03 20:49:50 -080097 struct rsnd_dai_platform_info *dai_info;
98 int dai_info_nr;
Kuninori Morimoto1536a962013-07-21 21:35:52 -070099 int (*start)(int id);
100 int (*stop)(int id);
101};
102
103#endif