Lines Matching +full:clock +full:- +full:master
1 // SPDX-License-Identifier: GPL-2.0
3 // Fifo-attached Serial Interface (FSI) support for SH7724
12 #include <linux/dma-mapping.h>
42 /* master register */
102 #define SE (1 << 0) /* Fix the master clock */
166 * |<-------------------- period--------------------->|
169 * ||<----- frame ----->|<------ frame ----->| ... |
170 * |+--------------------+--------------------+- ... |
172 * |+--------------------+--------------------+- ... |
185 * --> go to codecs
189 * FSI clock
191 * FSIxCLK [CPG] (ick) -------> |
192 * |-> FSI_DIV (div)-> FSI2
193 * FSIxCK [external] (xck) ---> |
235 /* see [FSI clock] */
250 struct fsi_master *master; member
255 struct fsi_clk clock; member
278 (!(io) ? -ENODEV : \
279 !((io)->handler->func) ? 0 : \
280 (io)->handler->func(args))
303 return &fsi->playback == io; in fsi_stream_is_play()
335 __fsi_reg_write((p->base + REG_##r), d)
338 __fsi_reg_read((p->base + REG_##r))
341 __fsi_reg_mask_set((p->base + REG_##r), m, d)
344 #define fsi_core_read(p, r) _fsi_master_read(p, p->core->r)
345 static u32 _fsi_master_read(struct fsi_master *master, u32 reg) in _fsi_master_read() argument
350 spin_lock_irqsave(&master->lock, flags); in _fsi_master_read()
351 ret = __fsi_reg_read(master->base + reg); in _fsi_master_read()
352 spin_unlock_irqrestore(&master->lock, flags); in _fsi_master_read()
358 #define fsi_core_mask_set(p, r, m, d) _fsi_master_mask_set(p, p->core->r, m, d)
359 static void _fsi_master_mask_set(struct fsi_master *master, in _fsi_master_mask_set() argument
364 spin_lock_irqsave(&master->lock, flags); in _fsi_master_mask_set()
365 __fsi_reg_mask_set(master->base + reg, mask, data); in _fsi_master_mask_set()
366 spin_unlock_irqrestore(&master->lock, flags); in _fsi_master_mask_set()
372 static int fsi_version(struct fsi_master *master) in fsi_version() argument
374 return master->core->ver; in fsi_version()
379 return fsi->master; in fsi_get_master()
384 return fsi->clk_master; in fsi_is_clk_master()
389 return fsi->master->base == fsi->base; in fsi_is_port_a()
394 return fsi->spdif; in fsi_is_spdif()
399 return fsi->enable_stream; in fsi_is_enable_stream()
404 return substream->stream == SNDRV_PCM_STREAM_PLAYBACK; in fsi_is_play()
416 struct fsi_master *master = snd_soc_dai_get_drvdata(dai); in fsi_get_priv_frm_dai() local
418 if (dai->id == 0) in fsi_get_priv_frm_dai()
419 return &master->fsia; in fsi_get_priv_frm_dai()
421 return &master->fsib; in fsi_get_priv_frm_dai()
445 return frames * fsi->chan_num; in fsi_frame2sample()
450 return samples / fsi->chan_num; in fsi_sample2frame()
475 fsi->playback.oerr_num++; in fsi_count_fifo_err()
478 fsi->playback.uerr_num++; in fsi_count_fifo_err()
481 fsi->capture.oerr_num++; in fsi_count_fifo_err()
484 fsi->capture.uerr_num++; in fsi_count_fifo_err()
496 return fsi_is_play(substream) ? &fsi->playback : &fsi->capture; in fsi_stream_get()
502 struct fsi_master *master = fsi_get_master(fsi); in fsi_stream_is_working() local
506 spin_lock_irqsave(&master->lock, flags); in fsi_stream_is_working()
507 ret = !!(io->substream && io->substream->runtime); in fsi_stream_is_working()
508 spin_unlock_irqrestore(&master->lock, flags); in fsi_stream_is_working()
515 return io->priv; in fsi_stream_to_priv()
522 struct snd_pcm_runtime *runtime = substream->runtime; in fsi_stream_init()
523 struct fsi_master *master = fsi_get_master(fsi); in fsi_stream_init() local
526 spin_lock_irqsave(&master->lock, flags); in fsi_stream_init()
527 io->substream = substream; in fsi_stream_init()
528 io->buff_sample_capa = fsi_frame2sample(fsi, runtime->buffer_size); in fsi_stream_init()
529 io->buff_sample_pos = 0; in fsi_stream_init()
530 io->period_samples = fsi_frame2sample(fsi, runtime->period_size); in fsi_stream_init()
531 io->period_pos = 0; in fsi_stream_init()
532 io->sample_width = samples_to_bytes(runtime, 1); in fsi_stream_init()
533 io->bus_option = 0; in fsi_stream_init()
534 io->oerr_num = -1; /* ignore 1st err */ in fsi_stream_init()
535 io->uerr_num = -1; /* ignore 1st err */ in fsi_stream_init()
537 spin_unlock_irqrestore(&master->lock, flags); in fsi_stream_init()
542 struct snd_soc_dai *dai = fsi_get_dai(io->substream); in fsi_stream_quit()
543 struct fsi_master *master = fsi_get_master(fsi); in fsi_stream_quit() local
546 spin_lock_irqsave(&master->lock, flags); in fsi_stream_quit()
548 if (io->oerr_num > 0) in fsi_stream_quit()
549 dev_err(dai->dev, "over_run = %d\n", io->oerr_num); in fsi_stream_quit()
551 if (io->uerr_num > 0) in fsi_stream_quit()
552 dev_err(dai->dev, "under_run = %d\n", io->uerr_num); in fsi_stream_quit()
555 io->substream = NULL; in fsi_stream_quit()
556 io->buff_sample_capa = 0; in fsi_stream_quit()
557 io->buff_sample_pos = 0; in fsi_stream_quit()
558 io->period_samples = 0; in fsi_stream_quit()
559 io->period_pos = 0; in fsi_stream_quit()
560 io->sample_width = 0; in fsi_stream_quit()
561 io->bus_option = 0; in fsi_stream_quit()
562 io->oerr_num = 0; in fsi_stream_quit()
563 io->uerr_num = 0; in fsi_stream_quit()
564 spin_unlock_irqrestore(&master->lock, flags); in fsi_stream_quit()
571 return -EIO; in fsi_stream_transfer()
587 io = &fsi->playback; in fsi_stream_probe()
590 io = &fsi->capture; in fsi_stream_probe()
606 io = &fsi->playback; in fsi_stream_remove()
609 io = &fsi->capture; in fsi_stream_remove()
626 struct fsi_master *master = fsi_get_master(fsi); in fsi_format_bus_setup() local
628 u32 fmt = fsi->fmt; in fsi_format_bus_setup()
630 if (fsi_version(master) >= 2) { in fsi_format_bus_setup()
674 struct fsi_master *master = fsi_get_master(fsi); in fsi_irq_enable() local
676 fsi_core_mask_set(master, imsk, data, data); in fsi_irq_enable()
677 fsi_core_mask_set(master, iemsk, data, data); in fsi_irq_enable()
683 struct fsi_master *master = fsi_get_master(fsi); in fsi_irq_disable() local
685 fsi_core_mask_set(master, imsk, data, 0); in fsi_irq_disable()
686 fsi_core_mask_set(master, iemsk, data, 0); in fsi_irq_disable()
689 static u32 fsi_irq_get_status(struct fsi_master *master) in fsi_irq_get_status() argument
691 return fsi_core_read(master, int_st); in fsi_irq_get_status()
697 struct fsi_master *master = fsi_get_master(fsi); in fsi_irq_clear_status() local
699 data |= AB_IO(1, fsi_get_port_shift(fsi, &fsi->playback)); in fsi_irq_clear_status()
700 data |= AB_IO(1, fsi_get_port_shift(fsi, &fsi->capture)); in fsi_irq_clear_status()
703 fsi_core_mask_set(master, int_st, data, 0); in fsi_irq_clear_status()
707 * SPDIF master clock function
713 struct fsi_master *master = fsi_get_master(fsi); in fsi_spdif_clk_ctrl() local
720 fsi_core_mask_set(master, a_mclk, mask, val) : in fsi_spdif_clk_ctrl()
721 fsi_core_mask_set(master, b_mclk, mask, val); in fsi_spdif_clk_ctrl()
725 * clock function
735 struct fsi_clk *clock = &fsi->clock; in fsi_clk_init() local
738 clock->xck = NULL; in fsi_clk_init()
739 clock->ick = NULL; in fsi_clk_init()
740 clock->div = NULL; in fsi_clk_init()
741 clock->rate = 0; in fsi_clk_init()
742 clock->count = 0; in fsi_clk_init()
743 clock->set_rate = set_rate; in fsi_clk_init()
745 clock->own = devm_clk_get(dev, NULL); in fsi_clk_init()
746 if (IS_ERR(clock->own)) in fsi_clk_init()
747 return -EINVAL; in fsi_clk_init()
749 /* external clock */ in fsi_clk_init()
751 clock->xck = devm_clk_get(dev, is_porta ? "xcka" : "xckb"); in fsi_clk_init()
752 if (IS_ERR(clock->xck)) { in fsi_clk_init()
753 dev_err(dev, "can't get xck clock\n"); in fsi_clk_init()
754 return -EINVAL; in fsi_clk_init()
756 if (clock->xck == clock->own) { in fsi_clk_init()
757 dev_err(dev, "cpu doesn't support xck clock\n"); in fsi_clk_init()
758 return -EINVAL; in fsi_clk_init()
764 clock->ick = devm_clk_get(dev, is_porta ? "icka" : "ickb"); in fsi_clk_init()
765 if (IS_ERR(clock->ick)) { in fsi_clk_init()
766 dev_err(dev, "can't get ick clock\n"); in fsi_clk_init()
767 return -EINVAL; in fsi_clk_init()
769 if (clock->ick == clock->own) { in fsi_clk_init()
770 dev_err(dev, "cpu doesn't support ick clock\n"); in fsi_clk_init()
771 return -EINVAL; in fsi_clk_init()
775 /* FSI-DIV */ in fsi_clk_init()
777 clock->div = devm_clk_get(dev, is_porta ? "diva" : "divb"); in fsi_clk_init()
778 if (IS_ERR(clock->div)) { in fsi_clk_init()
779 dev_err(dev, "can't get div clock\n"); in fsi_clk_init()
780 return -EINVAL; in fsi_clk_init()
782 if (clock->div == clock->own) { in fsi_clk_init()
783 dev_err(dev, "cpu doesn't support div clock\n"); in fsi_clk_init()
784 return -EINVAL; in fsi_clk_init()
794 fsi->clock.rate = rate; in fsi_clk_valid()
799 return fsi->clock.set_rate && in fsi_clk_is_valid()
800 fsi->clock.rate; in fsi_clk_is_valid()
806 struct fsi_clk *clock = &fsi->clock; in fsi_clk_enable() local
807 int ret = -EINVAL; in fsi_clk_enable()
812 if (0 == clock->count) { in fsi_clk_enable()
813 ret = clock->set_rate(dev, fsi); in fsi_clk_enable()
819 clk_enable(clock->xck); in fsi_clk_enable()
820 clk_enable(clock->ick); in fsi_clk_enable()
821 clk_enable(clock->div); in fsi_clk_enable()
823 clock->count++; in fsi_clk_enable()
832 struct fsi_clk *clock = &fsi->clock; in fsi_clk_disable() local
835 return -EINVAL; in fsi_clk_disable()
837 if (1 == clock->count--) { in fsi_clk_disable()
838 clk_disable(clock->xck); in fsi_clk_disable()
839 clk_disable(clock->ick); in fsi_clk_disable()
840 clk_disable(clock->div); in fsi_clk_disable()
855 return -EINVAL; in fsi_clk_set_ackbpf()
877 return -EINVAL; in fsi_clk_set_ackbpf()
902 return -EINVAL; in fsi_clk_set_ackbpf()
916 struct clk *xck = fsi->clock.xck; in fsi_clk_set_rate_external()
917 struct clk *ick = fsi->clock.ick; in fsi_clk_set_rate_external()
918 unsigned long rate = fsi->clock.rate; in fsi_clk_set_rate_external()
923 /* check clock rate */ in fsi_clk_set_rate_external()
926 dev_err(dev, "unsupported clock rate\n"); in fsi_clk_set_rate_external()
927 return -EINVAL; in fsi_clk_set_rate_external()
933 bpfmd = fsi->chan_num * 32; in fsi_clk_set_rate_external()
948 struct clk *ick = fsi->clock.ick; in fsi_clk_set_rate_cpg()
949 struct clk *div = fsi->clock.div; in fsi_clk_set_rate_cpg()
950 unsigned long rate = fsi->clock.rate; in fsi_clk_set_rate_cpg()
957 int ret = -EINVAL; in fsi_clk_set_rate_cpg()
968 bpfmd = fsi->chan_num * 32; in fsi_clk_set_rate_cpg()
977 * The clock flow is in fsi_clk_set_rate_cpg()
983 * frequency of audio clock from ick clock only. in fsi_clk_set_rate_cpg()
984 * Because ick is created from its parent clock. in fsi_clk_set_rate_cpg()
988 * actual = cout / adjustment (by FSI-DIV) ~= target in fsi_clk_set_rate_cpg()
997 if (cout > 100000000) /* max clock = 100MHz */ in fsi_clk_set_rate_cpg()
1000 /* cout/actual audio clock */ in fsi_clk_set_rate_cpg()
1005 diff = abs(actual - target); in fsi_clk_set_rate_cpg()
1015 dev_err(dev, "ick clock failed\n"); in fsi_clk_set_rate_cpg()
1016 return -EIO; in fsi_clk_set_rate_cpg()
1021 dev_err(dev, "div clock failed\n"); in fsi_clk_set_rate_cpg()
1022 return -EIO; in fsi_clk_set_rate_cpg()
1033 io->buff_sample_pos += size; in fsi_pointer_update()
1035 if (io->buff_sample_pos >= in fsi_pointer_update()
1036 io->period_samples * (io->period_pos + 1)) { in fsi_pointer_update()
1037 struct snd_pcm_substream *substream = io->substream; in fsi_pointer_update()
1038 struct snd_pcm_runtime *runtime = substream->runtime; in fsi_pointer_update()
1040 io->period_pos++; in fsi_pointer_update()
1042 if (io->period_pos >= runtime->periods) { in fsi_pointer_update()
1043 io->buff_sample_pos = 0; in fsi_pointer_update()
1044 io->period_pos = 0; in fsi_pointer_update()
1106 struct snd_pcm_runtime *runtime = io->substream->runtime; in fsi_pio_get_area()
1108 return runtime->dma_area + in fsi_pio_get_area()
1109 samples_to_bytes(runtime, io->buff_sample_pos); in fsi_pio_get_area()
1120 return -EINVAL; in fsi_pio_transfer()
1124 switch (io->sample_width) { in fsi_pio_transfer()
1132 return -EINVAL; in fsi_pio_transfer()
1147 sample_space = io->buff_sample_capa - io->buff_sample_pos; in fsi_pio_pop()
1163 sample_residues = io->buff_sample_capa - io->buff_sample_pos; in fsi_pio_push()
1164 sample_space = io->fifo_sample_capa - in fsi_pio_push()
1178 struct fsi_master *master = fsi_get_master(fsi); in fsi_pio_start_stop() local
1187 fsi_master_mask_set(master, CLK_RST, clk, (enable) ? clk : 0); in fsi_pio_start_stop()
1202 io->bus_option = BUSOP_SET(24, PACKAGE_24BITBUS_BACK) | in fsi_pio_push_init()
1205 io->bus_option = BUSOP_SET(24, PACKAGE_24BITBUS_BACK) | in fsi_pio_push_init()
1215 io->bus_option = BUSOP_SET(24, PACKAGE_24BITBUS_BACK) | in fsi_pio_pop_init()
1234 struct fsi_master *master = data; in fsi_interrupt() local
1235 u32 int_st = fsi_irq_get_status(master); in fsi_interrupt()
1238 fsi_master_mask_set(master, SOFT_RST, IR, 0); in fsi_interrupt()
1239 fsi_master_mask_set(master, SOFT_RST, IR, IR); in fsi_interrupt()
1242 fsi_stream_transfer(&master->fsia.playback); in fsi_interrupt()
1244 fsi_stream_transfer(&master->fsib.playback); in fsi_interrupt()
1246 fsi_stream_transfer(&master->fsia.capture); in fsi_interrupt()
1248 fsi_stream_transfer(&master->fsib.capture); in fsi_interrupt()
1250 fsi_count_fifo_err(&master->fsia); in fsi_interrupt()
1251 fsi_count_fifo_err(&master->fsib); in fsi_interrupt()
1253 fsi_irq_clear_status(&master->fsia); in fsi_interrupt()
1254 fsi_irq_clear_status(&master->fsib); in fsi_interrupt()
1268 io->bus_option = BUSOP_SET(24, PACKAGE_24BITBUS_BACK) | in fsi_dma_init()
1279 fsi_pointer_update(io, io->period_samples); in fsi_dma_complete()
1286 struct snd_soc_dai *dai = fsi_get_dai(io->substream); in fsi_dma_transfer()
1287 struct snd_pcm_substream *substream = io->substream; in fsi_dma_transfer()
1291 int ret = -EIO; in fsi_dma_transfer()
1298 desc = dmaengine_prep_dma_cyclic(io->chan, in fsi_dma_transfer()
1299 substream->runtime->dma_addr, in fsi_dma_transfer()
1305 dev_err(dai->dev, "dmaengine_prep_dma_cyclic() fail\n"); in fsi_dma_transfer()
1309 desc->callback = fsi_dma_complete; in fsi_dma_transfer()
1310 desc->callback_param = io; in fsi_dma_transfer()
1313 dev_err(dai->dev, "tx_submit() fail\n"); in fsi_dma_transfer()
1317 dma_async_issue_pending(io->chan); in fsi_dma_transfer()
1344 struct fsi_master *master = fsi_get_master(fsi); in fsi_dma_push_start_stop() local
1350 dmaengine_terminate_all(io->chan); in fsi_dma_push_start_stop()
1353 fsi_master_mask_set(master, CLK_RST, clk, (enable) ? clk : 0); in fsi_dma_push_start_stop()
1367 io->chan = dma_request_channel(mask, shdma_chan_filter, in fsi_dma_probe()
1368 (void *)io->dma_id); in fsi_dma_probe()
1370 io->chan = dma_request_slave_channel(dev, is_play ? "tx" : "rx"); in fsi_dma_probe()
1372 if (io->chan) { in fsi_dma_probe()
1377 cfg.dst_addr = fsi->phys + REG_DODT; in fsi_dma_probe()
1381 cfg.src_addr = fsi->phys + REG_DIDT; in fsi_dma_probe()
1386 ret = dmaengine_slave_config(io->chan, &cfg); in fsi_dma_probe()
1388 dma_release_channel(io->chan); in fsi_dma_probe()
1389 io->chan = NULL; in fsi_dma_probe()
1393 if (!io->chan) { in fsi_dma_probe()
1397 fsi->playback.handler = &fsi_pio_push_handler; in fsi_dma_probe()
1399 fsi->capture.handler = &fsi_pio_pop_handler; in fsi_dma_probe()
1414 if (io->chan) in fsi_dma_remove()
1415 dma_release_channel(io->chan); in fsi_dma_remove()
1417 io->chan = NULL; in fsi_dma_remove()
1436 struct fsi_master *master = fsi_get_master(fsi); in fsi_fifo_init() local
1441 /* get on-chip RAM capacity */ in fsi_fifo_init()
1442 shift = fsi_master_read(master, FIFO_SZ); in fsi_fifo_init()
1452 * FIFOs are used in 4-channel units in 3-channel mode in fsi_fifo_init()
1453 * and in 8-channel units in 5- to 7-channel mode in fsi_fifo_init()
1457 * ex) if 256 words of DP-RAM is connected in fsi_fifo_init()
1467 for (i = 1; i < fsi->chan_num; i <<= 1) in fsi_fifo_init()
1470 fsi->chan_num, frame_capa); in fsi_fifo_init()
1472 io->fifo_sample_capa = fsi_frame2sample(fsi, frame_capa); in fsi_fifo_init()
1493 /* clock setting */ in fsi_hw_startup()
1499 /* clock inversion (CKG2) */ in fsi_hw_startup()
1501 if (fsi->bit_clk_inv) in fsi_hw_startup()
1503 if (fsi->lr_clk_inv) in fsi_hw_startup()
1519 switch (io->sample_width) { in fsi_hw_startup()
1521 data = BUSOP_GET(16, io->bus_option); in fsi_hw_startup()
1524 data = BUSOP_GET(24, io->bus_option); in fsi_hw_startup()
1536 /* start master clock */ in fsi_hw_startup()
1546 /* stop master clock */ in fsi_hw_shutdown()
1582 ret = fsi_hw_startup(fsi, io, dai->dev); in fsi_dai_trigger()
1590 ret = fsi_hw_shutdown(fsi, dai->dev); in fsi_dai_trigger()
1603 fsi->fmt = CR_I2S; in fsi_set_fmt_dai()
1604 fsi->chan_num = 2; in fsi_set_fmt_dai()
1607 fsi->fmt = CR_PCM; in fsi_set_fmt_dai()
1608 fsi->chan_num = 2; in fsi_set_fmt_dai()
1611 return -EINVAL; in fsi_set_fmt_dai()
1619 struct fsi_master *master = fsi_get_master(fsi); in fsi_set_fmt_spdif() local
1621 if (fsi_version(master) < 2) in fsi_set_fmt_spdif()
1622 return -EINVAL; in fsi_set_fmt_spdif()
1624 fsi->fmt = CR_DTMD_SPDIF_PCM | CR_PCM; in fsi_set_fmt_spdif()
1625 fsi->chan_num = 2; in fsi_set_fmt_spdif()
1635 /* set clock master audio interface */ in fsi_dai_set_fmt()
1640 fsi->clk_master = 1; /* cpu is master */ in fsi_dai_set_fmt()
1643 return -EINVAL; in fsi_dai_set_fmt()
1646 /* set clock inversion */ in fsi_dai_set_fmt()
1649 fsi->bit_clk_inv = 0; in fsi_dai_set_fmt()
1650 fsi->lr_clk_inv = 1; in fsi_dai_set_fmt()
1653 fsi->bit_clk_inv = 1; in fsi_dai_set_fmt()
1654 fsi->lr_clk_inv = 0; in fsi_dai_set_fmt()
1657 fsi->bit_clk_inv = 1; in fsi_dai_set_fmt()
1658 fsi->lr_clk_inv = 1; in fsi_dai_set_fmt()
1662 fsi->bit_clk_inv = 0; in fsi_dai_set_fmt()
1663 fsi->lr_clk_inv = 0; in fsi_dai_set_fmt()
1668 if (fsi->clk_cpg) in fsi_dai_set_fmt()
1669 fsi_clk_init(dai->dev, fsi, 0, 1, 1, in fsi_dai_set_fmt()
1672 fsi_clk_init(dai->dev, fsi, 1, 1, 0, in fsi_dai_set_fmt()
1724 struct snd_pcm_runtime *runtime = substream->runtime; in fsi_pcm_open()
1741 return fsi_sample2frame(fsi, io->buff_sample_pos); in fsi_pointer()
1755 rtd->pcm, in fsi_pcm_new()
1757 rtd->card->snd_card->dev, in fsi_pcm_new()
1768 .name = "fsia-dai",
1784 .name = "fsib-dai",
1823 { "spdif-connection", SH_FSI_FMT_SPDIF }, in fsi_of_parse()
1824 { "stream-mode-support", SH_FSI_ENABLE_STREAM_MODE }, in fsi_of_parse()
1825 { "use-internal-clock", SH_FSI_CLK_CPG }, in fsi_of_parse()
1833 info->flags = flags; in fsi_of_parse()
1835 dev_dbg(dev, "%s flags : %lx\n", name, info->flags); in fsi_of_parse()
1841 if (info->flags & SH_FSI_FMT_SPDIF) in fsi_port_info_init()
1842 fsi->spdif = 1; in fsi_port_info_init()
1844 if (info->flags & SH_FSI_CLK_CPG) in fsi_port_info_init()
1845 fsi->clk_cpg = 1; in fsi_port_info_init()
1847 if (info->flags & SH_FSI_ENABLE_STREAM_MODE) in fsi_port_info_init()
1848 fsi->enable_stream = 1; in fsi_port_info_init()
1854 fsi->playback.handler = &fsi_pio_push_handler; /* default PIO */ in fsi_handler_init()
1855 fsi->playback.priv = fsi; in fsi_handler_init()
1856 fsi->capture.handler = &fsi_pio_pop_handler; /* default PIO */ in fsi_handler_init()
1857 fsi->capture.priv = fsi; in fsi_handler_init()
1859 if (info->tx_id) { in fsi_handler_init()
1860 fsi->playback.dma_id = info->tx_id; in fsi_handler_init()
1861 fsi->playback.handler = &fsi_dma_push_handler; in fsi_handler_init()
1900 struct fsi_master *master; in fsi_probe() local
1901 struct device_node *np = pdev->dev.of_node; in fsi_probe()
1913 core = of_device_get_match_data(&pdev->dev); in fsi_probe()
1914 fsi_of_parse("fsia", np, &info.port_a, &pdev->dev); in fsi_probe()
1915 fsi_of_parse("fsib", np, &info.port_b, &pdev->dev); in fsi_probe()
1917 const struct platform_device_id *id_entry = pdev->id_entry; in fsi_probe()
1919 core = (struct fsi_core *)id_entry->driver_data; in fsi_probe()
1921 if (pdev->dev.platform_data) in fsi_probe()
1922 memcpy(&info, pdev->dev.platform_data, sizeof(info)); in fsi_probe()
1926 dev_err(&pdev->dev, "unknown fsi device\n"); in fsi_probe()
1927 return -ENODEV; in fsi_probe()
1933 dev_err(&pdev->dev, "Not enough FSI platform resources.\n"); in fsi_probe()
1934 return -ENODEV; in fsi_probe()
1937 master = devm_kzalloc(&pdev->dev, sizeof(*master), GFP_KERNEL); in fsi_probe()
1938 if (!master) in fsi_probe()
1939 return -ENOMEM; in fsi_probe()
1941 master->base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); in fsi_probe()
1942 if (!master->base) { in fsi_probe()
1943 dev_err(&pdev->dev, "Unable to ioremap FSI registers.\n"); in fsi_probe()
1944 return -ENXIO; in fsi_probe()
1947 /* master setting */ in fsi_probe()
1948 master->core = core; in fsi_probe()
1949 spin_lock_init(&master->lock); in fsi_probe()
1952 fsi = &master->fsia; in fsi_probe()
1953 fsi->base = master->base; in fsi_probe()
1954 fsi->phys = res->start; in fsi_probe()
1955 fsi->master = master; in fsi_probe()
1958 ret = fsi_stream_probe(fsi, &pdev->dev); in fsi_probe()
1960 dev_err(&pdev->dev, "FSIA stream probe failed\n"); in fsi_probe()
1965 fsi = &master->fsib; in fsi_probe()
1966 fsi->base = master->base + 0x40; in fsi_probe()
1967 fsi->phys = res->start + 0x40; in fsi_probe()
1968 fsi->master = master; in fsi_probe()
1971 ret = fsi_stream_probe(fsi, &pdev->dev); in fsi_probe()
1973 dev_err(&pdev->dev, "FSIB stream probe failed\n"); in fsi_probe()
1977 pm_runtime_enable(&pdev->dev); in fsi_probe()
1978 dev_set_drvdata(&pdev->dev, master); in fsi_probe()
1980 ret = devm_request_irq(&pdev->dev, irq, &fsi_interrupt, 0, in fsi_probe()
1981 dev_name(&pdev->dev), master); in fsi_probe()
1983 dev_err(&pdev->dev, "irq request err\n"); in fsi_probe()
1987 ret = devm_snd_soc_register_component(&pdev->dev, &fsi_soc_component, in fsi_probe()
1990 dev_err(&pdev->dev, "cannot snd component register\n"); in fsi_probe()
1997 pm_runtime_disable(&pdev->dev); in fsi_probe()
1998 fsi_stream_remove(&master->fsib); in fsi_probe()
2000 fsi_stream_remove(&master->fsia); in fsi_probe()
2007 struct fsi_master *master; in fsi_remove() local
2009 master = dev_get_drvdata(&pdev->dev); in fsi_remove()
2011 pm_runtime_disable(&pdev->dev); in fsi_remove()
2013 fsi_stream_remove(&master->fsia); in fsi_remove()
2014 fsi_stream_remove(&master->fsib); in fsi_remove()
2043 struct fsi_master *master = dev_get_drvdata(dev); in fsi_suspend() local
2044 struct fsi_priv *fsia = &master->fsia; in fsi_suspend()
2045 struct fsi_priv *fsib = &master->fsib; in fsi_suspend()
2047 __fsi_suspend(fsia, &fsia->playback, dev); in fsi_suspend()
2048 __fsi_suspend(fsia, &fsia->capture, dev); in fsi_suspend()
2050 __fsi_suspend(fsib, &fsib->playback, dev); in fsi_suspend()
2051 __fsi_suspend(fsib, &fsib->capture, dev); in fsi_suspend()
2058 struct fsi_master *master = dev_get_drvdata(dev); in fsi_resume() local
2059 struct fsi_priv *fsia = &master->fsia; in fsi_resume()
2060 struct fsi_priv *fsib = &master->fsib; in fsi_resume()
2062 __fsi_resume(fsia, &fsia->playback, dev); in fsi_resume()
2063 __fsi_resume(fsia, &fsia->capture, dev); in fsi_resume()
2065 __fsi_resume(fsib, &fsib->playback, dev); in fsi_resume()
2066 __fsi_resume(fsib, &fsib->capture, dev); in fsi_resume()
2078 .name = "fsi-pcm-audio",
2092 MODULE_ALIAS("platform:fsi-pcm-audio");