blob: 4cecd0c175f607c7f3cae2a2fb03660f81131799 [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 Morimoto6cfad782014-11-27 08:08:10 +000039#define RSND_SSI(_dma_id, _irq, _flags) \
40{ .dma_id = _dma_id, .irq = _irq, .flags = _flags }
Kuninori Morimoto4b4dab82013-07-28 18:58:29 -070041#define RSND_SSI_UNUSED \
Kuninori Morimoto6cfad782014-11-27 08:08:10 +000042{ .dma_id = -1, .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 Morimoto6cfad782014-11-27 08:08:10 +000046 int irq;
Kuninori Morimotoae5c3222013-07-21 21:36:57 -070047 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 Morimotocfcefe02015-01-08 01:52:36 +000058 int irq;
Kuninori Morimoto07539c12013-07-21 21:36:35 -070059};
Kuninori Morimoto1536a962013-07-21 21:35:52 -070060
Kuninori Morimotobff58ea2014-05-08 17:44:49 -070061/*
62 * flags
63 */
64struct rsnd_dvc_platform_info {
65 u32 flags;
66};
67
Kuninori Morimoto78f13d02014-03-03 20:49:50 -080068struct rsnd_dai_path_info {
69 struct rsnd_ssi_platform_info *ssi;
Kuninori Morimotoba9c9492014-03-03 20:51:21 -080070 struct rsnd_src_platform_info *src;
Kuninori Morimotobff58ea2014-05-08 17:44:49 -070071 struct rsnd_dvc_platform_info *dvc;
Kuninori Morimoto78f13d02014-03-03 20:49:50 -080072};
73
74struct rsnd_dai_platform_info {
75 struct rsnd_dai_path_info playback;
76 struct rsnd_dai_path_info capture;
77};
78
Kuninori Morimoto33377442013-07-21 21:36:21 -070079/*
80 * flags
81 *
82 * 0x0000000A
83 *
84 * A : generation
85 */
Kuninori Morimotoc5d5a582013-10-11 00:07:01 -070086#define RSND_GEN_MASK (0xF << 0)
Kuninori Morimoto33377442013-07-21 21:36:21 -070087#define RSND_GEN1 (1 << 0) /* fixme */
88#define RSND_GEN2 (2 << 0) /* fixme */
89
Kuninori Morimoto1536a962013-07-21 21:35:52 -070090struct rcar_snd_info {
91 u32 flags;
Kuninori Morimotoae5c3222013-07-21 21:36:57 -070092 struct rsnd_ssi_platform_info *ssi_info;
93 int ssi_info_nr;
Kuninori Morimotoba9c9492014-03-03 20:51:21 -080094 struct rsnd_src_platform_info *src_info;
95 int src_info_nr;
Kuninori Morimotobff58ea2014-05-08 17:44:49 -070096 struct rsnd_dvc_platform_info *dvc_info;
97 int dvc_info_nr;
Kuninori Morimoto78f13d02014-03-03 20:49:50 -080098 struct rsnd_dai_platform_info *dai_info;
99 int dai_info_nr;
Kuninori Morimoto1536a962013-07-21 21:35:52 -0700100 int (*start)(int id);
101 int (*stop)(int id);
102};
103
104#endif