~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/soc/sh/rcar/gen.c

Version: ~ [ linux-5.11-rc3 ] ~ [ linux-5.10.7 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.89 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.167 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.215 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.251 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.251 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Renesas R-Car Gen1 SRU/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 /*
 13  * #define DEBUG
 14  *
 15  * you can also add below in
 16  * ${LINUX}/drivers/base/regmap/regmap.c
 17  * for regmap debug
 18  *
 19  * #define LOG_DEVICE "xxxx.rcar_sound"
 20  */
 21 
 22 #include "rsnd.h"
 23 
 24 struct rsnd_gen {
 25         void __iomem *base[RSND_BASE_MAX];
 26 
 27         struct rsnd_gen_ops *ops;
 28 
 29         struct regmap *regmap[RSND_BASE_MAX];
 30         struct regmap_field *regs[RSND_REG_MAX];
 31 };
 32 
 33 #define rsnd_priv_to_gen(p)     ((struct rsnd_gen *)(p)->gen)
 34 
 35 struct rsnd_regmap_field_conf {
 36         int idx;
 37         unsigned int reg_offset;
 38         unsigned int id_offset;
 39 };
 40 
 41 #define RSND_REG_SET(id, offset, _id_offset)    \
 42 {                                               \
 43         .idx = id,                              \
 44         .reg_offset = offset,                   \
 45         .id_offset = _id_offset,                \
 46 }
 47 /* single address mapping */
 48 #define RSND_GEN_S_REG(id, offset)      \
 49         RSND_REG_SET(RSND_REG_##id, offset, 0)
 50 
 51 /* multi address mapping */
 52 #define RSND_GEN_M_REG(id, offset, _id_offset)  \
 53         RSND_REG_SET(RSND_REG_##id, offset, _id_offset)
 54 
 55 /*
 56  *              basic function
 57  */
 58 static int rsnd_is_accessible_reg(struct rsnd_priv *priv,
 59                                   struct rsnd_gen *gen, enum rsnd_reg reg)
 60 {
 61         if (!gen->regs[reg]) {
 62                 struct device *dev = rsnd_priv_to_dev(priv);
 63 
 64                 dev_err(dev, "unsupported register access %x\n", reg);
 65                 return 0;
 66         }
 67 
 68         return 1;
 69 }
 70 
 71 u32 rsnd_read(struct rsnd_priv *priv,
 72               struct rsnd_mod *mod, enum rsnd_reg reg)
 73 {
 74         struct device *dev = rsnd_priv_to_dev(priv);
 75         struct rsnd_gen *gen = rsnd_priv_to_gen(priv);
 76         u32 val;
 77 
 78         if (!rsnd_is_accessible_reg(priv, gen, reg))
 79                 return 0;
 80 
 81         dev_dbg(dev, "r %s[%d] - %4d : %08x\n",
 82                 rsnd_mod_name(mod), rsnd_mod_id(mod), reg, val);
 83 
 84         regmap_fields_read(gen->regs[reg], rsnd_mod_id(mod), &val);
 85 
 86         return val;
 87 }
 88 
 89 void rsnd_write(struct rsnd_priv *priv,
 90                 struct rsnd_mod *mod,
 91                 enum rsnd_reg reg, u32 data)
 92 {
 93         struct device *dev = rsnd_priv_to_dev(priv);
 94         struct rsnd_gen *gen = rsnd_priv_to_gen(priv);
 95 
 96         if (!rsnd_is_accessible_reg(priv, gen, reg))
 97                 return;
 98 
 99         dev_dbg(dev, "w %s[%d] - %4d : %08x\n",
100                 rsnd_mod_name(mod), rsnd_mod_id(mod), reg, data);
101 
102         regmap_fields_write(gen->regs[reg], rsnd_mod_id(mod), data);
103 }
104 
105 void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod,
106                enum rsnd_reg reg, u32 mask, u32 data)
107 {
108         struct device *dev = rsnd_priv_to_dev(priv);
109         struct rsnd_gen *gen = rsnd_priv_to_gen(priv);
110 
111         if (!rsnd_is_accessible_reg(priv, gen, reg))
112                 return;
113 
114         dev_dbg(dev, "b %s[%d] - %4d : %08x/%08x\n",
115                 rsnd_mod_name(mod), rsnd_mod_id(mod), reg, data, mask);
116 
117         regmap_fields_update_bits(gen->regs[reg], rsnd_mod_id(mod),
118                                   mask, data);
119 }
120 
121 #define rsnd_gen_regmap_init(priv, id_size, reg_id, conf)               \
122         _rsnd_gen_regmap_init(priv, id_size, reg_id, conf, ARRAY_SIZE(conf))
123 static int _rsnd_gen_regmap_init(struct rsnd_priv *priv,
124                                  int id_size,
125                                  int reg_id,
126                                  struct rsnd_regmap_field_conf *conf,
127                                  int conf_size)
128 {
129         struct platform_device *pdev = rsnd_priv_to_pdev(priv);
130         struct rsnd_gen *gen = rsnd_priv_to_gen(priv);
131         struct device *dev = rsnd_priv_to_dev(priv);
132         struct resource *res;
133         struct regmap_config regc;
134         struct regmap_field *regs;
135         struct regmap *regmap;
136         struct reg_field regf;
137         void __iomem *base;
138         int i;
139 
140         memset(&regc, 0, sizeof(regc));
141         regc.reg_bits = 32;
142         regc.val_bits = 32;
143         regc.reg_stride = 4;
144 
145         res = platform_get_resource(pdev, IORESOURCE_MEM, reg_id);
146         if (!res)
147                 return -ENODEV;
148 
149         base = devm_ioremap_resource(dev, res);
150         if (IS_ERR(base))
151                 return PTR_ERR(base);
152 
153         regmap = devm_regmap_init_mmio(dev, base, &regc);
154         if (IS_ERR(regmap))
155                 return PTR_ERR(regmap);
156 
157         gen->base[reg_id] = base;
158         gen->regmap[reg_id] = regmap;
159 
160         for (i = 0; i < conf_size; i++) {
161 
162                 regf.reg        = conf[i].reg_offset;
163                 regf.id_offset  = conf[i].id_offset;
164                 regf.lsb        = 0;
165                 regf.msb        = 31;
166                 regf.id_size    = id_size;
167 
168                 regs = devm_regmap_field_alloc(dev, regmap, regf);
169                 if (IS_ERR(regs))
170                         return PTR_ERR(regs);
171 
172                 gen->regs[conf[i].idx] = regs;
173         }
174 
175         return 0;
176 }
177 
178 /*
179  *      DMA read/write register offset
180  *
181  *      RSND_xxx_I_N    for Audio DMAC input
182  *      RSND_xxx_O_N    for Audio DMAC output
183  *      RSND_xxx_I_P    for Audio DMAC peri peri input
184  *      RSND_xxx_O_P    for Audio DMAC peri peri output
185  *
186  *      ex) R-Car H2 case
187  *            mod        / DMAC in    / DMAC out   / DMAC PP in / DMAC pp out
188  *      SSI : 0xec541000 / 0xec241008 / 0xec24100c
189  *      SSIU: 0xec541000 / 0xec100000 / 0xec100000 / 0xec400000 / 0xec400000
190  *      SCU : 0xec500000 / 0xec000000 / 0xec004000 / 0xec300000 / 0xec304000
191  *      CMD : 0xec500000 /            / 0xec008000                0xec308000
192  */
193 #define RDMA_SSI_I_N(addr, i)   (addr ##_reg - 0x00300000 + (0x40 * i) + 0x8)
194 #define RDMA_SSI_O_N(addr, i)   (addr ##_reg - 0x00300000 + (0x40 * i) + 0xc)
195 
196 #define RDMA_SSIU_I_N(addr, i)  (addr ##_reg - 0x00441000 + (0x1000 * i))
197 #define RDMA_SSIU_O_N(addr, i)  (addr ##_reg - 0x00441000 + (0x1000 * i))
198 
199 #define RDMA_SSIU_I_P(addr, i)  (addr ##_reg - 0x00141000 + (0x1000 * i))
200 #define RDMA_SSIU_O_P(addr, i)  (addr ##_reg - 0x00141000 + (0x1000 * i))
201 
202 #define RDMA_SRC_I_N(addr, i)   (addr ##_reg - 0x00500000 + (0x400 * i))
203 #define RDMA_SRC_O_N(addr, i)   (addr ##_reg - 0x004fc000 + (0x400 * i))
204 
205 #define RDMA_SRC_I_P(addr, i)   (addr ##_reg - 0x00200000 + (0x400 * i))
206 #define RDMA_SRC_O_P(addr, i)   (addr ##_reg - 0x001fc000 + (0x400 * i))
207 
208 #define RDMA_CMD_O_N(addr, i)   (addr ##_reg - 0x004f8000 + (0x400 * i))
209 #define RDMA_CMD_O_P(addr, i)   (addr ##_reg - 0x001f8000 + (0x400 * i))
210 
211 static dma_addr_t
212 rsnd_gen2_dma_addr(struct rsnd_priv *priv,
213                    struct rsnd_mod *mod,
214                    int is_play, int is_from)
215 {
216         struct platform_device *pdev = rsnd_priv_to_pdev(priv);
217         struct device *dev = rsnd_priv_to_dev(priv);
218         struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
219         dma_addr_t ssi_reg = platform_get_resource(pdev,
220                                 IORESOURCE_MEM, RSND_GEN2_SSI)->start;
221         dma_addr_t src_reg = platform_get_resource(pdev,
222                                 IORESOURCE_MEM, RSND_GEN2_SCU)->start;
223         int is_ssi = !!(rsnd_io_to_mod_ssi(io) == mod);
224         int use_src = !!rsnd_io_to_mod_src(io);
225         int use_dvc = !!rsnd_io_to_mod_dvc(io);
226         int id = rsnd_mod_id(mod);
227         struct dma_addr {
228                 dma_addr_t out_addr;
229                 dma_addr_t in_addr;
230         } dma_addrs[3][2][3] = {
231                 /* SRC */
232                 {{{ 0,                          0 },
233                 /* Capture */
234                   { RDMA_SRC_O_N(src, id),      RDMA_SRC_I_P(src, id) },
235                   { RDMA_CMD_O_N(src, id),      RDMA_SRC_I_P(src, id) } },
236                  /* Playback */
237                  {{ 0,                          0, },
238                   { RDMA_SRC_O_P(src, id),      RDMA_SRC_I_N(src, id) },
239                   { RDMA_CMD_O_P(src, id),      RDMA_SRC_I_N(src, id) } }
240                 },
241                 /* SSI */
242                 /* Capture */
243                 {{{ RDMA_SSI_O_N(ssi, id),      0 },
244                   { RDMA_SSIU_O_P(ssi, id),     0 },
245                   { RDMA_SSIU_O_P(ssi, id),     0 } },
246                  /* Playback */
247                  {{ 0,                          RDMA_SSI_I_N(ssi, id) },
248                   { 0,                          RDMA_SSIU_I_P(ssi, id) },
249                   { 0,                          RDMA_SSIU_I_P(ssi, id) } }
250                 },
251                 /* SSIU */
252                 /* Capture */
253                 {{{ RDMA_SSIU_O_N(ssi, id),     0 },
254                   { RDMA_SSIU_O_P(ssi, id),     0 },
255                   { RDMA_SSIU_O_P(ssi, id),     0 } },
256                  /* Playback */
257                  {{ 0,                          RDMA_SSIU_I_N(ssi, id) },
258                   { 0,                          RDMA_SSIU_I_P(ssi, id) },
259                   { 0,                          RDMA_SSIU_I_P(ssi, id) } } },
260         };
261 
262         /* it shouldn't happen */
263         if (use_dvc && !use_src)
264                 dev_err(dev, "DVC is selected without SRC\n");
265 
266         /* use SSIU or SSI ? */
267         if (is_ssi && (0 == strcmp(rsnd_mod_dma_name(mod), "ssiu")))
268                 is_ssi++;
269 
270         return (is_from) ?
271                 dma_addrs[is_ssi][is_play][use_src + use_dvc].out_addr :
272                 dma_addrs[is_ssi][is_play][use_src + use_dvc].in_addr;
273 }
274 
275 dma_addr_t rsnd_gen_dma_addr(struct rsnd_priv *priv,
276                              struct rsnd_mod *mod,
277                              int is_play, int is_from)
278 {
279         /*
280          * gen1 uses default DMA addr
281          */
282         if (rsnd_is_gen1(priv))
283                 return 0;
284 
285         if (!mod)
286                 return 0;
287 
288         return rsnd_gen2_dma_addr(priv, mod, is_play, is_from);
289 }
290 
291 /*
292  *              Gen2
293  */
294 static int rsnd_gen2_probe(struct platform_device *pdev,
295                            struct rsnd_priv *priv)
296 {
297         struct device *dev = rsnd_priv_to_dev(priv);
298         struct rsnd_regmap_field_conf conf_ssiu[] = {
299                 RSND_GEN_S_REG(SSI_MODE0,       0x800),
300                 RSND_GEN_S_REG(SSI_MODE1,       0x804),
301                 /* FIXME: it needs SSI_MODE2/3 in the future */
302                 RSND_GEN_M_REG(SSI_BUSIF_MODE,  0x0,    0x80),
303                 RSND_GEN_M_REG(SSI_BUSIF_ADINR, 0x4,    0x80),
304                 RSND_GEN_M_REG(BUSIF_DALIGN,    0x8,    0x80),
305                 RSND_GEN_M_REG(SSI_CTRL,        0x10,   0x80),
306                 RSND_GEN_M_REG(INT_ENABLE,      0x18,   0x80),
307         };
308         struct rsnd_regmap_field_conf conf_scu[] = {
309                 RSND_GEN_M_REG(SRC_BUSIF_MODE,  0x0,    0x20),
310                 RSND_GEN_M_REG(SRC_ROUTE_MODE0, 0xc,    0x20),
311                 RSND_GEN_M_REG(SRC_CTRL,        0x10,   0x20),
312                 RSND_GEN_M_REG(CMD_ROUTE_SLCT,  0x18c,  0x20),
313                 RSND_GEN_M_REG(CMD_CTRL,        0x190,  0x20),
314                 RSND_GEN_M_REG(SRC_SWRSR,       0x200,  0x40),
315                 RSND_GEN_M_REG(SRC_SRCIR,       0x204,  0x40),
316                 RSND_GEN_M_REG(SRC_ADINR,       0x214,  0x40),
317                 RSND_GEN_M_REG(SRC_IFSCR,       0x21c,  0x40),
318                 RSND_GEN_M_REG(SRC_IFSVR,       0x220,  0x40),
319                 RSND_GEN_M_REG(SRC_SRCCR,       0x224,  0x40),
320                 RSND_GEN_M_REG(SRC_BSDSR,       0x22c,  0x40),
321                 RSND_GEN_M_REG(SRC_BSISR,       0x238,  0x40),
322                 RSND_GEN_M_REG(DVC_SWRSR,       0xe00,  0x100),
323                 RSND_GEN_M_REG(DVC_DVUIR,       0xe04,  0x100),
324                 RSND_GEN_M_REG(DVC_ADINR,       0xe08,  0x100),
325                 RSND_GEN_M_REG(DVC_DVUCR,       0xe10,  0x100),
326                 RSND_GEN_M_REG(DVC_ZCMCR,       0xe14,  0x100),
327                 RSND_GEN_M_REG(DVC_VRCTR,       0xe18,  0x100),
328                 RSND_GEN_M_REG(DVC_VRPDR,       0xe1c,  0x100),
329                 RSND_GEN_M_REG(DVC_VRDBR,       0xe20,  0x100),
330                 RSND_GEN_M_REG(DVC_VOL0R,       0xe28,  0x100),
331                 RSND_GEN_M_REG(DVC_VOL1R,       0xe2c,  0x100),
332                 RSND_GEN_M_REG(DVC_DVUER,       0xe48,  0x100),
333         };
334         struct rsnd_regmap_field_conf conf_adg[] = {
335                 RSND_GEN_S_REG(BRRA,            0x00),
336                 RSND_GEN_S_REG(BRRB,            0x04),
337                 RSND_GEN_S_REG(SSICKR,          0x08),
338                 RSND_GEN_S_REG(AUDIO_CLK_SEL0,  0x0c),
339                 RSND_GEN_S_REG(AUDIO_CLK_SEL1,  0x10),
340                 RSND_GEN_S_REG(AUDIO_CLK_SEL2,  0x14),
341                 RSND_GEN_S_REG(DIV_EN,          0x30),
342                 RSND_GEN_S_REG(SRCIN_TIMSEL0,   0x34),
343                 RSND_GEN_S_REG(SRCIN_TIMSEL1,   0x38),
344                 RSND_GEN_S_REG(SRCIN_TIMSEL2,   0x3c),
345                 RSND_GEN_S_REG(SRCIN_TIMSEL3,   0x40),
346                 RSND_GEN_S_REG(SRCIN_TIMSEL4,   0x44),
347                 RSND_GEN_S_REG(SRCOUT_TIMSEL0,  0x48),
348                 RSND_GEN_S_REG(SRCOUT_TIMSEL1,  0x4c),
349                 RSND_GEN_S_REG(SRCOUT_TIMSEL2,  0x50),
350                 RSND_GEN_S_REG(SRCOUT_TIMSEL3,  0x54),
351                 RSND_GEN_S_REG(SRCOUT_TIMSEL4,  0x58),
352                 RSND_GEN_S_REG(CMDOUT_TIMSEL,   0x5c),
353         };
354         struct rsnd_regmap_field_conf conf_ssi[] = {
355                 RSND_GEN_M_REG(SSICR,           0x00,   0x40),
356                 RSND_GEN_M_REG(SSISR,           0x04,   0x40),
357                 RSND_GEN_M_REG(SSITDR,          0x08,   0x40),
358                 RSND_GEN_M_REG(SSIRDR,          0x0c,   0x40),
359                 RSND_GEN_M_REG(SSIWSR,          0x20,   0x40),
360         };
361         int ret_ssiu;
362         int ret_scu;
363         int ret_adg;
364         int ret_ssi;
365 
366         ret_ssiu = rsnd_gen_regmap_init(priv, 10, RSND_GEN2_SSIU, conf_ssiu);
367         ret_scu  = rsnd_gen_regmap_init(priv, 10, RSND_GEN2_SCU,  conf_scu);
368         ret_adg  = rsnd_gen_regmap_init(priv, 10, RSND_GEN2_ADG,  conf_adg);
369         ret_ssi  = rsnd_gen_regmap_init(priv, 10, RSND_GEN2_SSI,  conf_ssi);
370         if (ret_ssiu < 0 ||
371             ret_scu  < 0 ||
372             ret_adg  < 0 ||
373             ret_ssi  < 0)
374                 return ret_ssiu | ret_scu | ret_adg | ret_ssi;
375 
376         dev_dbg(dev, "Gen2 is probed\n");
377 
378         return 0;
379 }
380 
381 /*
382  *              Gen1
383  */
384 
385 static int rsnd_gen1_probe(struct platform_device *pdev,
386                            struct rsnd_priv *priv)
387 {
388         struct device *dev = rsnd_priv_to_dev(priv);
389         struct rsnd_regmap_field_conf conf_sru[] = {
390                 RSND_GEN_S_REG(SRC_ROUTE_SEL,   0x00),
391                 RSND_GEN_S_REG(SRC_TMG_SEL0,    0x08),
392                 RSND_GEN_S_REG(SRC_TMG_SEL1,    0x0c),
393                 RSND_GEN_S_REG(SRC_TMG_SEL2,    0x10),
394                 RSND_GEN_S_REG(SRC_ROUTE_CTRL,  0xc0),
395                 RSND_GEN_S_REG(SSI_MODE0,       0xD0),
396                 RSND_GEN_S_REG(SSI_MODE1,       0xD4),
397                 RSND_GEN_M_REG(SRC_BUSIF_MODE,  0x20,   0x4),
398                 RSND_GEN_M_REG(SRC_ROUTE_MODE0, 0x50,   0x8),
399                 RSND_GEN_M_REG(SRC_SWRSR,       0x200,  0x40),
400                 RSND_GEN_M_REG(SRC_SRCIR,       0x204,  0x40),
401                 RSND_GEN_M_REG(SRC_ADINR,       0x214,  0x40),
402                 RSND_GEN_M_REG(SRC_IFSCR,       0x21c,  0x40),
403                 RSND_GEN_M_REG(SRC_IFSVR,       0x220,  0x40),
404                 RSND_GEN_M_REG(SRC_SRCCR,       0x224,  0x40),
405                 RSND_GEN_M_REG(SRC_MNFSR,       0x228,  0x40),
406         };
407         struct rsnd_regmap_field_conf conf_adg[] = {
408                 RSND_GEN_S_REG(BRRA,            0x00),
409                 RSND_GEN_S_REG(BRRB,            0x04),
410                 RSND_GEN_S_REG(SSICKR,          0x08),
411                 RSND_GEN_S_REG(AUDIO_CLK_SEL0,  0x0c),
412                 RSND_GEN_S_REG(AUDIO_CLK_SEL1,  0x10),
413                 RSND_GEN_S_REG(AUDIO_CLK_SEL3,  0x18),
414                 RSND_GEN_S_REG(AUDIO_CLK_SEL4,  0x1c),
415                 RSND_GEN_S_REG(AUDIO_CLK_SEL5,  0x20),
416         };
417         struct rsnd_regmap_field_conf conf_ssi[] = {
418                 RSND_GEN_M_REG(SSICR,           0x00,   0x40),
419                 RSND_GEN_M_REG(SSISR,           0x04,   0x40),
420                 RSND_GEN_M_REG(SSITDR,          0x08,   0x40),
421                 RSND_GEN_M_REG(SSIRDR,          0x0c,   0x40),
422                 RSND_GEN_M_REG(SSIWSR,          0x20,   0x40),
423         };
424         int ret_sru;
425         int ret_adg;
426         int ret_ssi;
427 
428         ret_sru  = rsnd_gen_regmap_init(priv, 9, RSND_GEN1_SRU,  conf_sru);
429         ret_adg  = rsnd_gen_regmap_init(priv, 9, RSND_GEN1_ADG,  conf_adg);
430         ret_ssi  = rsnd_gen_regmap_init(priv, 9, RSND_GEN1_SSI,  conf_ssi);
431         if (ret_sru  < 0 ||
432             ret_adg  < 0 ||
433             ret_ssi  < 0)
434                 return ret_sru | ret_adg | ret_ssi;
435 
436         dev_dbg(dev, "Gen1 is probed\n");
437 
438         return 0;
439 }
440 
441 /*
442  *              Gen
443  */
444 static void rsnd_of_parse_gen(struct platform_device *pdev,
445                               const struct rsnd_of_data *of_data,
446                               struct rsnd_priv *priv)
447 {
448         struct rcar_snd_info *info = priv->info;
449 
450         if (!of_data)
451                 return;
452 
453         info->flags = of_data->flags;
454 }
455 
456 int rsnd_gen_probe(struct platform_device *pdev,
457                    const struct rsnd_of_data *of_data,
458                    struct rsnd_priv *priv)
459 {
460         struct device *dev = rsnd_priv_to_dev(priv);
461         struct rsnd_gen *gen;
462         int ret;
463 
464         rsnd_of_parse_gen(pdev, of_data, priv);
465 
466         gen = devm_kzalloc(dev, sizeof(*gen), GFP_KERNEL);
467         if (!gen) {
468                 dev_err(dev, "GEN allocate failed\n");
469                 return -ENOMEM;
470         }
471 
472         priv->gen = gen;
473 
474         ret = -ENODEV;
475         if (rsnd_is_gen1(priv))
476                 ret = rsnd_gen1_probe(pdev, priv);
477         else if (rsnd_is_gen2(priv))
478                 ret = rsnd_gen2_probe(pdev, priv);
479 
480         if (ret < 0)
481                 dev_err(dev, "unknown generation R-Car sound device\n");
482 
483         return ret;
484 }
485 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp