Kuninori Morimoto | f239088 | 2012-04-08 21:17:50 -0700 | [diff] [blame] | 1 | /* |
| 2 | * ASoC simple sound card support |
| 3 | * |
| 4 | * Copyright (C) 2012 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 | */ |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 11 | #include <linux/clk.h> |
Kuninori Morimoto | f239088 | 2012-04-08 21:17:50 -0700 | [diff] [blame] | 12 | #include <linux/module.h> |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 13 | #include <linux/of.h> |
Kuninori Morimoto | f239088 | 2012-04-08 21:17:50 -0700 | [diff] [blame] | 14 | #include <linux/platform_device.h> |
Xiubo Li | ca919fe | 2014-01-14 12:35:32 +0800 | [diff] [blame] | 15 | #include <linux/string.h> |
Kuninori Morimoto | f239088 | 2012-04-08 21:17:50 -0700 | [diff] [blame] | 16 | #include <sound/simple_card.h> |
| 17 | |
Jean-Francois Moine | 45fce59 | 2014-01-15 16:51:56 +0100 | [diff] [blame] | 18 | struct simple_card_data { |
| 19 | struct snd_soc_card snd_card; |
| 20 | unsigned int daifmt; |
| 21 | struct asoc_simple_dai cpu_dai; |
| 22 | struct asoc_simple_dai codec_dai; |
| 23 | struct snd_soc_dai_link snd_link; |
| 24 | }; |
| 25 | |
Kuninori Morimoto | a4a2992 | 2013-01-10 16:49:11 -0800 | [diff] [blame] | 26 | static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai, |
| 27 | struct asoc_simple_dai *set, |
| 28 | unsigned int daifmt) |
| 29 | { |
| 30 | int ret = 0; |
| 31 | |
| 32 | daifmt |= set->fmt; |
| 33 | |
Xiubo Li | e874dde | 2013-12-23 13:24:59 +0800 | [diff] [blame] | 34 | if (daifmt) |
Kuninori Morimoto | a4a2992 | 2013-01-10 16:49:11 -0800 | [diff] [blame] | 35 | ret = snd_soc_dai_set_fmt(dai, daifmt); |
| 36 | |
Kuninori Morimoto | e244bb9 | 2013-10-17 22:46:49 -0700 | [diff] [blame] | 37 | if (ret == -ENOTSUPP) { |
| 38 | dev_dbg(dai->dev, "ASoC: set_fmt is not supported\n"); |
| 39 | ret = 0; |
| 40 | } |
| 41 | |
Kuninori Morimoto | a4a2992 | 2013-01-10 16:49:11 -0800 | [diff] [blame] | 42 | if (!ret && set->sysclk) |
| 43 | ret = snd_soc_dai_set_sysclk(dai, 0, set->sysclk, 0); |
| 44 | |
| 45 | return ret; |
| 46 | } |
| 47 | |
Kuninori Morimoto | f239088 | 2012-04-08 21:17:50 -0700 | [diff] [blame] | 48 | static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd) |
| 49 | { |
Jean-Francois Moine | b367a32 | 2014-01-15 16:52:00 +0100 | [diff] [blame^] | 50 | struct simple_card_data *priv = |
Xiubo Li | ba194a4 | 2014-01-13 17:08:08 +0800 | [diff] [blame] | 51 | snd_soc_card_get_drvdata(rtd->card); |
Kuninori Morimoto | f239088 | 2012-04-08 21:17:50 -0700 | [diff] [blame] | 52 | struct snd_soc_dai *codec = rtd->codec_dai; |
| 53 | struct snd_soc_dai *cpu = rtd->cpu_dai; |
Jean-Francois Moine | b367a32 | 2014-01-15 16:52:00 +0100 | [diff] [blame^] | 54 | unsigned int daifmt = priv->daifmt; |
Kuninori Morimoto | f239088 | 2012-04-08 21:17:50 -0700 | [diff] [blame] | 55 | int ret; |
| 56 | |
Jean-Francois Moine | b367a32 | 2014-01-15 16:52:00 +0100 | [diff] [blame^] | 57 | ret = __asoc_simple_card_dai_init(codec, &priv->codec_dai, daifmt); |
Kuninori Morimoto | a4a2992 | 2013-01-10 16:49:11 -0800 | [diff] [blame] | 58 | if (ret < 0) |
| 59 | return ret; |
Kuninori Morimoto | f239088 | 2012-04-08 21:17:50 -0700 | [diff] [blame] | 60 | |
Jean-Francois Moine | b367a32 | 2014-01-15 16:52:00 +0100 | [diff] [blame^] | 61 | ret = __asoc_simple_card_dai_init(cpu, &priv->cpu_dai, daifmt); |
Kuninori Morimoto | a4a2992 | 2013-01-10 16:49:11 -0800 | [diff] [blame] | 62 | if (ret < 0) |
| 63 | return ret; |
Kuninori Morimoto | f239088 | 2012-04-08 21:17:50 -0700 | [diff] [blame] | 64 | |
| 65 | return 0; |
| 66 | } |
| 67 | |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 68 | static int |
| 69 | asoc_simple_card_sub_parse_of(struct device_node *np, |
| 70 | struct asoc_simple_dai *dai, |
Jean-Francois Moine | 5200847 | 2014-01-15 16:51:48 +0100 | [diff] [blame] | 71 | const struct device_node **p_node, |
| 72 | const char **name) |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 73 | { |
Jean-Francois Moine | 201a0ea | 2014-01-15 16:51:41 +0100 | [diff] [blame] | 74 | struct device_node *node; |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 75 | struct clk *clk; |
| 76 | int ret; |
| 77 | |
| 78 | /* |
| 79 | * get node via "sound-dai = <&phandle port>" |
| 80 | * it will be used as xxx_of_node on soc_bind_dai_link() |
| 81 | */ |
Jean-Francois Moine | 201a0ea | 2014-01-15 16:51:41 +0100 | [diff] [blame] | 82 | node = of_parse_phandle(np, "sound-dai", 0); |
| 83 | if (!node) |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 84 | return -ENODEV; |
Jean-Francois Moine | 201a0ea | 2014-01-15 16:51:41 +0100 | [diff] [blame] | 85 | *p_node = node; |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 86 | |
| 87 | /* get dai->name */ |
Jean-Francois Moine | 5200847 | 2014-01-15 16:51:48 +0100 | [diff] [blame] | 88 | ret = snd_soc_of_get_dai_name(np, name); |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 89 | if (ret < 0) |
| 90 | goto parse_error; |
| 91 | |
| 92 | /* |
| 93 | * bitclock-inversion, frame-inversion |
| 94 | * bitclock-master, frame-master |
| 95 | * and specific "format" if it has |
| 96 | */ |
| 97 | dai->fmt = snd_soc_of_parse_daifmt(np, NULL); |
| 98 | |
| 99 | /* |
| 100 | * dai->sysclk come from |
| 101 | * "clocks = <&xxx>" (if system has common clock) |
| 102 | * or "system-clock-frequency = <xxx>" |
Xiubo Li | 71467e4 | 2013-12-23 15:25:38 +0800 | [diff] [blame] | 103 | * or device's module clock. |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 104 | */ |
Xiubo Li | 71467e4 | 2013-12-23 15:25:38 +0800 | [diff] [blame] | 105 | if (of_property_read_bool(np, "clocks")) { |
| 106 | clk = of_clk_get(np, 0); |
| 107 | if (IS_ERR(clk)) { |
| 108 | ret = PTR_ERR(clk); |
| 109 | goto parse_error; |
| 110 | } |
| 111 | |
| 112 | dai->sysclk = clk_get_rate(clk); |
| 113 | } else if (of_property_read_bool(np, "system-clock-frequency")) { |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 114 | of_property_read_u32(np, |
| 115 | "system-clock-frequency", |
| 116 | &dai->sysclk); |
Xiubo Li | 71467e4 | 2013-12-23 15:25:38 +0800 | [diff] [blame] | 117 | } else { |
Jean-Francois Moine | 201a0ea | 2014-01-15 16:51:41 +0100 | [diff] [blame] | 118 | clk = of_clk_get(node, 0); |
Xiubo Li | e2a19ac | 2014-01-06 12:34:36 +0800 | [diff] [blame] | 119 | if (!IS_ERR(clk)) |
| 120 | dai->sysclk = clk_get_rate(clk); |
Xiubo Li | 71467e4 | 2013-12-23 15:25:38 +0800 | [diff] [blame] | 121 | } |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 122 | |
| 123 | ret = 0; |
| 124 | |
| 125 | parse_error: |
Jean-Francois Moine | 201a0ea | 2014-01-15 16:51:41 +0100 | [diff] [blame] | 126 | of_node_put(node); |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 127 | |
| 128 | return ret; |
| 129 | } |
| 130 | |
| 131 | static int asoc_simple_card_parse_of(struct device_node *node, |
Jean-Francois Moine | b367a32 | 2014-01-15 16:52:00 +0100 | [diff] [blame^] | 132 | struct simple_card_data *priv, |
Jean-Francois Moine | 201a0ea | 2014-01-15 16:51:41 +0100 | [diff] [blame] | 133 | struct device *dev) |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 134 | { |
Jean-Francois Moine | b367a32 | 2014-01-15 16:52:00 +0100 | [diff] [blame^] | 135 | struct snd_soc_dai_link *dai_link = priv->snd_card.dai_link; |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 136 | struct device_node *np; |
| 137 | char *name; |
Xiubo Li | d4c2209 | 2013-12-23 12:57:01 +0800 | [diff] [blame] | 138 | int ret; |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 139 | |
| 140 | /* get CPU/CODEC common format via simple-audio-card,format */ |
Jean-Francois Moine | b367a32 | 2014-01-15 16:52:00 +0100 | [diff] [blame^] | 141 | priv->daifmt = snd_soc_of_parse_daifmt(node, "simple-audio-card,") & |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 142 | (SND_SOC_DAIFMT_FORMAT_MASK | SND_SOC_DAIFMT_INV_MASK); |
| 143 | |
Xiubo Li | d4c2209 | 2013-12-23 12:57:01 +0800 | [diff] [blame] | 144 | /* DAPM routes */ |
Xiubo Li | 8c0b823 | 2014-01-07 09:15:16 +0800 | [diff] [blame] | 145 | if (of_property_read_bool(node, "simple-audio-card,routing")) { |
Jean-Francois Moine | b367a32 | 2014-01-15 16:52:00 +0100 | [diff] [blame^] | 146 | ret = snd_soc_of_parse_audio_routing(&priv->snd_card, |
Xiubo Li | 8c0b823 | 2014-01-07 09:15:16 +0800 | [diff] [blame] | 147 | "simple-audio-card,routing"); |
Xiubo Li | f87a3e8 | 2014-01-07 09:13:42 +0800 | [diff] [blame] | 148 | if (ret) |
| 149 | return ret; |
| 150 | } |
Xiubo Li | d4c2209 | 2013-12-23 12:57:01 +0800 | [diff] [blame] | 151 | |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 152 | /* CPU sub-node */ |
| 153 | ret = -EINVAL; |
| 154 | np = of_get_child_by_name(node, "simple-audio-card,cpu"); |
| 155 | if (np) |
| 156 | ret = asoc_simple_card_sub_parse_of(np, |
Jean-Francois Moine | b367a32 | 2014-01-15 16:52:00 +0100 | [diff] [blame^] | 157 | &priv->cpu_dai, |
Jean-Francois Moine | 5200847 | 2014-01-15 16:51:48 +0100 | [diff] [blame] | 158 | &dai_link->cpu_of_node, |
| 159 | &dai_link->cpu_dai_name); |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 160 | if (ret < 0) |
| 161 | return ret; |
| 162 | |
| 163 | /* CODEC sub-node */ |
| 164 | ret = -EINVAL; |
| 165 | np = of_get_child_by_name(node, "simple-audio-card,codec"); |
| 166 | if (np) |
| 167 | ret = asoc_simple_card_sub_parse_of(np, |
Jean-Francois Moine | b367a32 | 2014-01-15 16:52:00 +0100 | [diff] [blame^] | 168 | &priv->codec_dai, |
Jean-Francois Moine | 5200847 | 2014-01-15 16:51:48 +0100 | [diff] [blame] | 169 | &dai_link->codec_of_node, |
| 170 | &dai_link->codec_dai_name); |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 171 | if (ret < 0) |
| 172 | return ret; |
| 173 | |
Jean-Francois Moine | 5200847 | 2014-01-15 16:51:48 +0100 | [diff] [blame] | 174 | if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) |
Xiubo Li | dd41e0c | 2013-12-20 14:39:50 +0800 | [diff] [blame] | 175 | return -EINVAL; |
| 176 | |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 177 | /* card name is created from CPU/CODEC dai name */ |
| 178 | name = devm_kzalloc(dev, |
Jean-Francois Moine | 5200847 | 2014-01-15 16:51:48 +0100 | [diff] [blame] | 179 | strlen(dai_link->cpu_dai_name) + |
| 180 | strlen(dai_link->codec_dai_name) + 2, |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 181 | GFP_KERNEL); |
Jean-Francois Moine | 5200847 | 2014-01-15 16:51:48 +0100 | [diff] [blame] | 182 | sprintf(name, "%s-%s", dai_link->cpu_dai_name, |
| 183 | dai_link->codec_dai_name); |
Jean-Francois Moine | b367a32 | 2014-01-15 16:52:00 +0100 | [diff] [blame^] | 184 | priv->snd_card.name = name; |
Jean-Francois Moine | 5ca8ba4 | 2014-01-15 16:51:45 +0100 | [diff] [blame] | 185 | dai_link->name = dai_link->stream_name = name; |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 186 | |
| 187 | /* simple-card assumes platform == cpu */ |
Jean-Francois Moine | 5ca8ba4 | 2014-01-15 16:51:45 +0100 | [diff] [blame] | 188 | dai_link->platform_of_node = dai_link->cpu_of_node; |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 189 | |
Jean-Francois Moine | 2bee991 | 2014-01-15 16:51:37 +0100 | [diff] [blame] | 190 | dev_dbg(dev, "card-name : %s\n", name); |
Jean-Francois Moine | b367a32 | 2014-01-15 16:52:00 +0100 | [diff] [blame^] | 191 | dev_dbg(dev, "platform : %04x\n", priv->daifmt); |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 192 | dev_dbg(dev, "cpu : %s / %04x / %d\n", |
Jean-Francois Moine | 5200847 | 2014-01-15 16:51:48 +0100 | [diff] [blame] | 193 | dai_link->cpu_dai_name, |
Jean-Francois Moine | b367a32 | 2014-01-15 16:52:00 +0100 | [diff] [blame^] | 194 | priv->cpu_dai.fmt, |
| 195 | priv->cpu_dai.sysclk); |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 196 | dev_dbg(dev, "codec : %s / %04x / %d\n", |
Jean-Francois Moine | 5200847 | 2014-01-15 16:51:48 +0100 | [diff] [blame] | 197 | dai_link->codec_dai_name, |
Jean-Francois Moine | b367a32 | 2014-01-15 16:52:00 +0100 | [diff] [blame^] | 198 | priv->codec_dai.fmt, |
| 199 | priv->codec_dai.sysclk); |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 200 | |
| 201 | return 0; |
| 202 | } |
| 203 | |
Kuninori Morimoto | f239088 | 2012-04-08 21:17:50 -0700 | [diff] [blame] | 204 | static int asoc_simple_card_probe(struct platform_device *pdev) |
| 205 | { |
Jean-Francois Moine | 45fce59 | 2014-01-15 16:51:56 +0100 | [diff] [blame] | 206 | struct simple_card_data *priv; |
Jean-Francois Moine | 5ca8ba4 | 2014-01-15 16:51:45 +0100 | [diff] [blame] | 207 | struct snd_soc_dai_link *dai_link; |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 208 | struct device_node *np = pdev->dev.of_node; |
Kuninori Morimoto | f89983e | 2012-12-25 22:52:33 -0800 | [diff] [blame] | 209 | struct device *dev = &pdev->dev; |
Xiubo Li | ca919fe | 2014-01-14 12:35:32 +0800 | [diff] [blame] | 210 | int ret; |
Kuninori Morimoto | f239088 | 2012-04-08 21:17:50 -0700 | [diff] [blame] | 211 | |
Jean-Francois Moine | ca65b49 | 2014-01-15 16:51:52 +0100 | [diff] [blame] | 212 | priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); |
| 213 | if (!priv) |
Xiubo Li | ca919fe | 2014-01-14 12:35:32 +0800 | [diff] [blame] | 214 | return -ENOMEM; |
| 215 | |
Jean-Francois Moine | 201a0ea | 2014-01-15 16:51:41 +0100 | [diff] [blame] | 216 | /* |
| 217 | * init snd_soc_card |
| 218 | */ |
Jean-Francois Moine | ca65b49 | 2014-01-15 16:51:52 +0100 | [diff] [blame] | 219 | priv->snd_card.owner = THIS_MODULE; |
| 220 | priv->snd_card.dev = dev; |
| 221 | dai_link = &priv->snd_link; |
| 222 | priv->snd_card.dai_link = dai_link; |
| 223 | priv->snd_card.num_links = 1; |
Xiubo Li | ca919fe | 2014-01-14 12:35:32 +0800 | [diff] [blame] | 224 | |
Jean-Francois Moine | 201a0ea | 2014-01-15 16:51:41 +0100 | [diff] [blame] | 225 | if (np && of_device_is_available(np)) { |
| 226 | |
Jean-Francois Moine | ca65b49 | 2014-01-15 16:51:52 +0100 | [diff] [blame] | 227 | ret = asoc_simple_card_parse_of(np, priv, dev); |
Xiubo Li | ca919fe | 2014-01-14 12:35:32 +0800 | [diff] [blame] | 228 | if (ret < 0) { |
| 229 | if (ret != -EPROBE_DEFER) |
| 230 | dev_err(dev, "parse error %d\n", ret); |
| 231 | return ret; |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 232 | } |
| 233 | } else { |
Jean-Francois Moine | ca65b49 | 2014-01-15 16:51:52 +0100 | [diff] [blame] | 234 | struct asoc_simple_card_info *cinfo; |
| 235 | |
| 236 | cinfo = dev->platform_data; |
| 237 | if (!cinfo) { |
Xiubo Li | 34787d0a | 2014-01-09 17:49:40 +0800 | [diff] [blame] | 238 | dev_err(dev, "no info for asoc-simple-card\n"); |
| 239 | return -EINVAL; |
| 240 | } |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 241 | |
Jean-Francois Moine | 7722f83 | 2014-01-15 16:51:33 +0100 | [diff] [blame] | 242 | if (!cinfo->name || |
| 243 | !cinfo->card || |
| 244 | !cinfo->codec_dai.name || |
| 245 | !cinfo->codec || |
| 246 | !cinfo->platform || |
| 247 | !cinfo->cpu_dai.name) { |
| 248 | dev_err(dev, "insufficient asoc_simple_card_info settings\n"); |
| 249 | return -EINVAL; |
| 250 | } |
Jean-Francois Moine | 2bee991 | 2014-01-15 16:51:37 +0100 | [diff] [blame] | 251 | |
Jean-Francois Moine | ca65b49 | 2014-01-15 16:51:52 +0100 | [diff] [blame] | 252 | priv->snd_card.name = cinfo->card; |
Jean-Francois Moine | 5ca8ba4 | 2014-01-15 16:51:45 +0100 | [diff] [blame] | 253 | dai_link->name = cinfo->name; |
| 254 | dai_link->stream_name = cinfo->name; |
| 255 | dai_link->platform_name = cinfo->platform; |
| 256 | dai_link->codec_name = cinfo->codec; |
Jean-Francois Moine | 5200847 | 2014-01-15 16:51:48 +0100 | [diff] [blame] | 257 | dai_link->cpu_dai_name = cinfo->cpu_dai.name; |
| 258 | dai_link->codec_dai_name = cinfo->codec_dai.name; |
Jean-Francois Moine | ca65b49 | 2014-01-15 16:51:52 +0100 | [diff] [blame] | 259 | memcpy(&priv->cpu_dai, &cinfo->cpu_dai, |
| 260 | sizeof(priv->cpu_dai)); |
| 261 | memcpy(&priv->codec_dai, &cinfo->codec_dai, |
| 262 | sizeof(priv->codec_dai)); |
Kuninori Morimoto | f239088 | 2012-04-08 21:17:50 -0700 | [diff] [blame] | 263 | } |
| 264 | |
| 265 | /* |
| 266 | * init snd_soc_dai_link |
| 267 | */ |
Jean-Francois Moine | 5ca8ba4 | 2014-01-15 16:51:45 +0100 | [diff] [blame] | 268 | dai_link->init = asoc_simple_card_dai_init; |
Kuninori Morimoto | f239088 | 2012-04-08 21:17:50 -0700 | [diff] [blame] | 269 | |
Jean-Francois Moine | ca65b49 | 2014-01-15 16:51:52 +0100 | [diff] [blame] | 270 | snd_soc_card_set_drvdata(&priv->snd_card, priv); |
Xiubo Li | ba194a4 | 2014-01-13 17:08:08 +0800 | [diff] [blame] | 271 | |
Jean-Francois Moine | ca65b49 | 2014-01-15 16:51:52 +0100 | [diff] [blame] | 272 | return devm_snd_soc_register_card(&pdev->dev, &priv->snd_card); |
Kuninori Morimoto | f239088 | 2012-04-08 21:17:50 -0700 | [diff] [blame] | 273 | } |
| 274 | |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 275 | static const struct of_device_id asoc_simple_of_match[] = { |
| 276 | { .compatible = "simple-audio-card", }, |
| 277 | {}, |
| 278 | }; |
| 279 | MODULE_DEVICE_TABLE(of, asoc_simple_of_match); |
| 280 | |
Kuninori Morimoto | f239088 | 2012-04-08 21:17:50 -0700 | [diff] [blame] | 281 | static struct platform_driver asoc_simple_card = { |
| 282 | .driver = { |
| 283 | .name = "asoc-simple-card", |
Fabio Estevam | c445be3 | 2013-08-23 14:35:17 -0300 | [diff] [blame] | 284 | .owner = THIS_MODULE, |
Kuninori Morimoto | fa558c2 | 2013-11-20 15:25:02 +0900 | [diff] [blame] | 285 | .of_match_table = asoc_simple_of_match, |
Kuninori Morimoto | f239088 | 2012-04-08 21:17:50 -0700 | [diff] [blame] | 286 | }, |
| 287 | .probe = asoc_simple_card_probe, |
Kuninori Morimoto | f239088 | 2012-04-08 21:17:50 -0700 | [diff] [blame] | 288 | }; |
| 289 | |
| 290 | module_platform_driver(asoc_simple_card); |
| 291 | |
Fabio Estevam | c445be3 | 2013-08-23 14:35:17 -0300 | [diff] [blame] | 292 | MODULE_ALIAS("platform:asoc-simple-card"); |
Kuninori Morimoto | f239088 | 2012-04-08 21:17:50 -0700 | [diff] [blame] | 293 | MODULE_LICENSE("GPL"); |
| 294 | MODULE_DESCRIPTION("ASoC Simple Sound Card"); |
| 295 | MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>"); |