blob: f4a706f82cb733b14fc802575600dc8d7fb45ec3 [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 Morimoto4b4dab82013-07-28 18:58:29 -070037
Kuninori Morimoto78f13d02014-03-03 20:49:50 -080038#define RSND_SSI(_dma_id, _pio_irq, _flags) \
39{ .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }
Kuninori Morimoto4b4dab82013-07-28 18:58:29 -070040#define RSND_SSI_UNUSED \
Kuninori Morimoto29e69fd2014-05-08 01:59:26 -070041{ .dma_id = -1, .pio_irq = -1, .flags = 0 }
Kuninori Morimoto4b4dab82013-07-28 18:58:29 -070042
Kuninori Morimotoae5c3222013-07-21 21:36:57 -070043struct rsnd_ssi_platform_info {
Kuninori Morimoto849fc822013-07-28 18:59:02 -070044 int dma_id;
Kuninori Morimotoae5c3222013-07-21 21:36:57 -070045 int pio_irq;
46 u32 flags;
47};
Kuninori Morimoto07539c12013-07-21 21:36:35 -070048
Kuninori Morimotoba9c9492014-03-03 20:51:21 -080049#define RSND_SRC(rate, _dma_id) \
Kuninori Morimoto29e69fd2014-05-08 01:59:26 -070050{ .convert_rate = rate, .dma_id = _dma_id, }
Kuninori Morimotoba9c9492014-03-03 20:51:21 -080051#define RSND_SRC_UNUSED \
Kuninori Morimoto29e69fd2014-05-08 01:59:26 -070052{ .convert_rate = 0, .dma_id = -1, }
Kuninori Morimotoba9c9492014-03-03 20:51:21 -080053
54struct rsnd_src_platform_info {
Kuninori Morimotoef749402013-12-19 19:28:51 -080055 u32 convert_rate; /* sampling rate convert */
Kuninori Morimoto629509c2014-01-23 18:42:00 -080056 int dma_id; /* for Gen2 SCU */
Kuninori Morimoto07539c12013-07-21 21:36:35 -070057};
Kuninori Morimoto1536a962013-07-21 21:35:52 -070058
Kuninori Morimotobff58ea2014-05-08 17:44:49 -070059/*
60 * flags
61 */
62struct rsnd_dvc_platform_info {
63 u32 flags;
64};
65
Kuninori Morimoto78f13d02014-03-03 20:49:50 -080066struct rsnd_dai_path_info {
67 struct rsnd_ssi_platform_info *ssi;
Kuninori Morimotoba9c9492014-03-03 20:51:21 -080068 struct rsnd_src_platform_info *src;
Kuninori Morimotobff58ea2014-05-08 17:44:49 -070069 struct rsnd_dvc_platform_info *dvc;
Kuninori Morimoto78f13d02014-03-03 20:49:50 -080070};
71
72struct rsnd_dai_platform_info {
73 struct rsnd_dai_path_info playback;
74 struct rsnd_dai_path_info capture;
75};
76
Kuninori Morimoto33377442013-07-21 21:36:21 -070077/*
78 * flags
79 *
80 * 0x0000000A
81 *
82 * A : generation
83 */
Kuninori Morimotoc5d5a582013-10-11 00:07:01 -070084#define RSND_GEN_MASK (0xF << 0)
Kuninori Morimoto33377442013-07-21 21:36:21 -070085#define RSND_GEN1 (1 << 0) /* fixme */
86#define RSND_GEN2 (2 << 0) /* fixme */
87
Kuninori Morimoto1536a962013-07-21 21:35:52 -070088struct rcar_snd_info {
89 u32 flags;
Kuninori Morimotoae5c3222013-07-21 21:36:57 -070090 struct rsnd_ssi_platform_info *ssi_info;
91 int ssi_info_nr;
Kuninori Morimotoba9c9492014-03-03 20:51:21 -080092 struct rsnd_src_platform_info *src_info;
93 int src_info_nr;
Kuninori Morimotobff58ea2014-05-08 17:44:49 -070094 struct rsnd_dvc_platform_info *dvc_info;
95 int dvc_info_nr;
Kuninori Morimoto78f13d02014-03-03 20:49:50 -080096 struct rsnd_dai_platform_info *dai_info;
97 int dai_info_nr;
Kuninori Morimoto1536a962013-07-21 21:35:52 -070098 int (*start)(int id);
99 int (*stop)(int id);
100};
101
102#endif