Lines Matching full:fsi
3 // Fifo-attached Serial Interface (FSI) support for SH7724
46 /* core register (depend on FSI version) */
151 * FSI driver use below type name for variable
176 * FSI FIFO image
188 * FSI clock
206 int fifo_sample_capa; /* sample capacity of FSI FIFO */
234 /* see [FSI clock] */
240 struct fsi_priv *fsi);
268 int (*init)(struct fsi_priv *fsi, struct fsi_stream *io);
269 int (*quit)(struct fsi_priv *fsi, struct fsi_stream *io);
270 int (*probe)(struct fsi_priv *fsi, struct fsi_stream *io, struct device *dev);
271 int (*transfer)(struct fsi_priv *fsi, struct fsi_stream *io);
272 int (*remove)(struct fsi_priv *fsi, struct fsi_stream *io);
273 int (*start_stop)(struct fsi_priv *fsi, struct fsi_stream *io,
299 static inline int fsi_stream_is_play(struct fsi_priv *fsi, in fsi_stream_is_play() argument
302 return &fsi->playback == io; in fsi_stream_is_play()
376 static struct fsi_master *fsi_get_master(struct fsi_priv *fsi) in fsi_get_master() argument
378 return fsi->master; in fsi_get_master()
381 static int fsi_is_clk_master(struct fsi_priv *fsi) in fsi_is_clk_master() argument
383 return fsi->clk_master; in fsi_is_clk_master()
386 static int fsi_is_port_a(struct fsi_priv *fsi) in fsi_is_port_a() argument
388 return fsi->master->base == fsi->base; in fsi_is_port_a()
391 static int fsi_is_spdif(struct fsi_priv *fsi) in fsi_is_spdif() argument
393 return fsi->spdif; in fsi_is_spdif()
396 static int fsi_is_enable_stream(struct fsi_priv *fsi) in fsi_is_enable_stream() argument
398 return fsi->enable_stream; in fsi_is_enable_stream()
428 static u32 fsi_get_port_shift(struct fsi_priv *fsi, struct fsi_stream *io) in fsi_get_port_shift() argument
430 int is_play = fsi_stream_is_play(fsi, io); in fsi_get_port_shift()
431 int is_porta = fsi_is_port_a(fsi); in fsi_get_port_shift()
442 static int fsi_frame2sample(struct fsi_priv *fsi, int frames) in fsi_frame2sample() argument
444 return frames * fsi->chan_num; in fsi_frame2sample()
447 static int fsi_sample2frame(struct fsi_priv *fsi, int samples) in fsi_sample2frame() argument
449 return samples / fsi->chan_num; in fsi_sample2frame()
452 static int fsi_get_current_fifo_samples(struct fsi_priv *fsi, in fsi_get_current_fifo_samples() argument
455 int is_play = fsi_stream_is_play(fsi, io); in fsi_get_current_fifo_samples()
460 fsi_reg_read(fsi, DOFF_ST) : in fsi_get_current_fifo_samples()
461 fsi_reg_read(fsi, DIFF_ST); in fsi_get_current_fifo_samples()
465 return fsi_frame2sample(fsi, frames); in fsi_get_current_fifo_samples()
468 static void fsi_count_fifo_err(struct fsi_priv *fsi) in fsi_count_fifo_err() argument
470 u32 ostatus = fsi_reg_read(fsi, DOFF_ST); in fsi_count_fifo_err()
471 u32 istatus = fsi_reg_read(fsi, DIFF_ST); in fsi_count_fifo_err()
474 fsi->playback.oerr_num++; in fsi_count_fifo_err()
477 fsi->playback.uerr_num++; in fsi_count_fifo_err()
480 fsi->capture.oerr_num++; in fsi_count_fifo_err()
483 fsi->capture.uerr_num++; in fsi_count_fifo_err()
485 fsi_reg_write(fsi, DOFF_ST, 0); in fsi_count_fifo_err()
486 fsi_reg_write(fsi, DIFF_ST, 0); in fsi_count_fifo_err()
492 static inline struct fsi_stream *fsi_stream_get(struct fsi_priv *fsi, in fsi_stream_get() argument
495 return fsi_is_play(substream) ? &fsi->playback : &fsi->capture; in fsi_stream_get()
498 static int fsi_stream_is_working(struct fsi_priv *fsi, in fsi_stream_is_working() argument
501 struct fsi_master *master = fsi_get_master(fsi); in fsi_stream_is_working()
517 static void fsi_stream_init(struct fsi_priv *fsi, in fsi_stream_init() argument
522 struct fsi_master *master = fsi_get_master(fsi); in fsi_stream_init()
527 io->buff_sample_capa = fsi_frame2sample(fsi, runtime->buffer_size); in fsi_stream_init()
529 io->period_samples = fsi_frame2sample(fsi, runtime->period_size); in fsi_stream_init()
535 fsi_stream_handler_call(io, init, fsi, io); in fsi_stream_init()
539 static void fsi_stream_quit(struct fsi_priv *fsi, struct fsi_stream *io) in fsi_stream_quit() argument
542 struct fsi_master *master = fsi_get_master(fsi); in fsi_stream_quit()
553 fsi_stream_handler_call(io, quit, fsi, io); in fsi_stream_quit()
568 struct fsi_priv *fsi = fsi_stream_to_priv(io); in fsi_stream_transfer() local
569 if (!fsi) in fsi_stream_transfer()
572 return fsi_stream_handler_call(io, transfer, fsi, io); in fsi_stream_transfer()
575 #define fsi_stream_start(fsi, io)\ argument
576 fsi_stream_handler_call(io, start_stop, fsi, io, 1)
578 #define fsi_stream_stop(fsi, io)\ argument
579 fsi_stream_handler_call(io, start_stop, fsi, io, 0)
581 static int fsi_stream_probe(struct fsi_priv *fsi, struct device *dev) in fsi_stream_probe() argument
586 io = &fsi->playback; in fsi_stream_probe()
587 ret1 = fsi_stream_handler_call(io, probe, fsi, io, dev); in fsi_stream_probe()
589 io = &fsi->capture; in fsi_stream_probe()
590 ret2 = fsi_stream_handler_call(io, probe, fsi, io, dev); in fsi_stream_probe()
600 static int fsi_stream_remove(struct fsi_priv *fsi) in fsi_stream_remove() argument
605 io = &fsi->playback; in fsi_stream_remove()
606 ret1 = fsi_stream_handler_call(io, remove, fsi, io); in fsi_stream_remove()
608 io = &fsi->capture; in fsi_stream_remove()
609 ret2 = fsi_stream_handler_call(io, remove, fsi, io); in fsi_stream_remove()
622 static void fsi_format_bus_setup(struct fsi_priv *fsi, struct fsi_stream *io, in fsi_format_bus_setup() argument
625 struct fsi_master *master = fsi_get_master(fsi); in fsi_format_bus_setup()
626 int is_play = fsi_stream_is_play(fsi, io); in fsi_format_bus_setup()
627 u32 fmt = fsi->fmt; in fsi_format_bus_setup()
655 fsi_reg_write(fsi, OUT_DMAC, dma); in fsi_format_bus_setup()
657 fsi_reg_write(fsi, IN_DMAC, dma); in fsi_format_bus_setup()
661 fsi_reg_write(fsi, DO_FMT, fmt); in fsi_format_bus_setup()
663 fsi_reg_write(fsi, DI_FMT, fmt); in fsi_format_bus_setup()
670 static void fsi_irq_enable(struct fsi_priv *fsi, struct fsi_stream *io) in fsi_irq_enable() argument
672 u32 data = AB_IO(1, fsi_get_port_shift(fsi, io)); in fsi_irq_enable()
673 struct fsi_master *master = fsi_get_master(fsi); in fsi_irq_enable()
679 static void fsi_irq_disable(struct fsi_priv *fsi, struct fsi_stream *io) in fsi_irq_disable() argument
681 u32 data = AB_IO(1, fsi_get_port_shift(fsi, io)); in fsi_irq_disable()
682 struct fsi_master *master = fsi_get_master(fsi); in fsi_irq_disable()
693 static void fsi_irq_clear_status(struct fsi_priv *fsi) in fsi_irq_clear_status() argument
696 struct fsi_master *master = fsi_get_master(fsi); in fsi_irq_clear_status()
698 data |= AB_IO(1, fsi_get_port_shift(fsi, &fsi->playback)); in fsi_irq_clear_status()
699 data |= AB_IO(1, fsi_get_port_shift(fsi, &fsi->capture)); in fsi_irq_clear_status()
710 static void fsi_spdif_clk_ctrl(struct fsi_priv *fsi, int enable) in fsi_spdif_clk_ctrl() argument
712 struct fsi_master *master = fsi_get_master(fsi); in fsi_spdif_clk_ctrl()
718 fsi_is_port_a(fsi) ? in fsi_spdif_clk_ctrl()
727 struct fsi_priv *fsi, in fsi_clk_init() argument
732 struct fsi_priv *fsi)) in fsi_clk_init()
734 struct fsi_clk *clock = &fsi->clock; in fsi_clk_init()
735 int is_porta = fsi_is_port_a(fsi); in fsi_clk_init()
774 /* FSI-DIV */ in fsi_clk_init()
790 #define fsi_clk_invalid(fsi) fsi_clk_valid(fsi, 0) argument
791 static void fsi_clk_valid(struct fsi_priv *fsi, unsigned long rate) in fsi_clk_valid() argument
793 fsi->clock.rate = rate; in fsi_clk_valid()
796 static int fsi_clk_is_valid(struct fsi_priv *fsi) in fsi_clk_is_valid() argument
798 return fsi->clock.set_rate && in fsi_clk_is_valid()
799 fsi->clock.rate; in fsi_clk_is_valid()
803 struct fsi_priv *fsi) in fsi_clk_enable() argument
805 struct fsi_clk *clock = &fsi->clock; in fsi_clk_enable()
808 if (!fsi_clk_is_valid(fsi)) in fsi_clk_enable()
812 ret = clock->set_rate(dev, fsi); in fsi_clk_enable()
814 fsi_clk_invalid(fsi); in fsi_clk_enable()
842 struct fsi_priv *fsi) in fsi_clk_disable() argument
844 struct fsi_clk *clock = &fsi->clock; in fsi_clk_disable()
846 if (!fsi_clk_is_valid(fsi)) in fsi_clk_disable()
859 struct fsi_priv *fsi, in fsi_clk_set_ackbpf() argument
919 fsi_reg_mask_set(fsi, CKG1, (ACKMD_MASK | BPFMD_MASK) , data); in fsi_clk_set_ackbpf()
926 struct fsi_priv *fsi) in fsi_clk_set_rate_external() argument
928 struct clk *xck = fsi->clock.xck; in fsi_clk_set_rate_external()
929 struct clk *ick = fsi->clock.ick; in fsi_clk_set_rate_external()
930 unsigned long rate = fsi->clock.rate; in fsi_clk_set_rate_external()
945 bpfmd = fsi->chan_num * 32; in fsi_clk_set_rate_external()
950 ret = fsi_clk_set_ackbpf(dev, fsi, ackmd, bpfmd); in fsi_clk_set_rate_external()
958 struct fsi_priv *fsi) in fsi_clk_set_rate_cpg() argument
960 struct clk *ick = fsi->clock.ick; in fsi_clk_set_rate_cpg()
961 struct clk *div = fsi->clock.div; in fsi_clk_set_rate_cpg()
962 unsigned long rate = fsi->clock.rate; in fsi_clk_set_rate_cpg()
980 bpfmd = fsi->chan_num * 32; in fsi_clk_set_rate_cpg()
982 ret = fsi_clk_set_ackbpf(dev, fsi, ackmd, bpfmd); in fsi_clk_set_rate_cpg()
991 * [CPG] = cout => [FSI_DIV] = audio => [FSI] => [codec] in fsi_clk_set_rate_cpg()
1000 * actual = cout / adjustment (by FSI-DIV) ~= target in fsi_clk_set_rate_cpg()
1066 static void fsi_pio_push16(struct fsi_priv *fsi, u8 *_buf, int samples) in fsi_pio_push16() argument
1070 if (fsi_is_enable_stream(fsi)) { in fsi_pio_push16()
1079 fsi_reg_write(fsi, DODT, buf[i]); in fsi_pio_push16()
1085 fsi_reg_write(fsi, DODT, ((u32)*(buf + i) << 8)); in fsi_pio_push16()
1089 static void fsi_pio_pop16(struct fsi_priv *fsi, u8 *_buf, int samples) in fsi_pio_pop16() argument
1095 *(buf + i) = (u16)(fsi_reg_read(fsi, DIDT) >> 8); in fsi_pio_pop16()
1098 static void fsi_pio_push32(struct fsi_priv *fsi, u8 *_buf, int samples) in fsi_pio_push32() argument
1104 fsi_reg_write(fsi, DODT, *(buf + i)); in fsi_pio_push32()
1107 static void fsi_pio_pop32(struct fsi_priv *fsi, u8 *_buf, int samples) in fsi_pio_pop32() argument
1113 *(buf + i) = fsi_reg_read(fsi, DIDT); in fsi_pio_pop32()
1116 static u8 *fsi_pio_get_area(struct fsi_priv *fsi, struct fsi_stream *io) in fsi_pio_get_area() argument
1124 static int fsi_pio_transfer(struct fsi_priv *fsi, struct fsi_stream *io, in fsi_pio_transfer() argument
1125 void (*run16)(struct fsi_priv *fsi, u8 *buf, int samples), in fsi_pio_transfer() argument
1126 void (*run32)(struct fsi_priv *fsi, u8 *buf, int samples), in fsi_pio_transfer() argument
1131 if (!fsi_stream_is_working(fsi, io)) in fsi_pio_transfer()
1134 buf = fsi_pio_get_area(fsi, io); in fsi_pio_transfer()
1138 run16(fsi, buf, samples); in fsi_pio_transfer()
1141 run32(fsi, buf, samples); in fsi_pio_transfer()
1152 static int fsi_pio_pop(struct fsi_priv *fsi, struct fsi_stream *io) in fsi_pio_pop() argument
1154 int sample_residues; /* samples in FSI fifo */ in fsi_pio_pop()
1158 sample_residues = fsi_get_current_fifo_samples(fsi, io); in fsi_pio_pop()
1163 return fsi_pio_transfer(fsi, io, in fsi_pio_pop()
1169 static int fsi_pio_push(struct fsi_priv *fsi, struct fsi_stream *io) in fsi_pio_push() argument
1172 int sample_space; /* FSI fifo free samples space */ in fsi_pio_push()
1177 fsi_get_current_fifo_samples(fsi, io); in fsi_pio_push()
1181 return fsi_pio_transfer(fsi, io, in fsi_pio_push()
1187 static int fsi_pio_start_stop(struct fsi_priv *fsi, struct fsi_stream *io, in fsi_pio_start_stop() argument
1190 struct fsi_master *master = fsi_get_master(fsi); in fsi_pio_start_stop()
1191 u32 clk = fsi_is_port_a(fsi) ? CRA : CRB; in fsi_pio_start_stop()
1194 fsi_irq_enable(fsi, io); in fsi_pio_start_stop()
1196 fsi_irq_disable(fsi, io); in fsi_pio_start_stop()
1198 if (fsi_is_clk_master(fsi)) in fsi_pio_start_stop()
1204 static int fsi_pio_push_init(struct fsi_priv *fsi, struct fsi_stream *io) in fsi_pio_push_init() argument
1213 if (fsi_is_enable_stream(fsi)) in fsi_pio_push_init()
1222 static int fsi_pio_pop_init(struct fsi_priv *fsi, struct fsi_stream *io) in fsi_pio_pop_init() argument
1274 static int fsi_dma_init(struct fsi_priv *fsi, struct fsi_stream *io) in fsi_dma_init() argument
1289 struct fsi_priv *fsi = fsi_stream_to_priv(io); in fsi_dma_complete() local
1293 fsi_count_fifo_err(fsi); in fsi_dma_complete()
1296 static int fsi_dma_transfer(struct fsi_priv *fsi, struct fsi_stream *io) in fsi_dma_transfer() argument
1301 int is_play = fsi_stream_is_play(fsi, io); in fsi_dma_transfer()
1334 * In DMAEngine case, codec and FSI cannot be started simultaneously in fsi_dma_transfer()
1335 * since FSI is using the scheduler work queue. in fsi_dma_transfer()
1336 * Therefore, in capture case, probably FSI FIFO will have got in fsi_dma_transfer()
1341 if (ERR_OVER & fsi_reg_read(fsi, DIFF_ST)) { in fsi_dma_transfer()
1342 fsi_reg_mask_set(fsi, DIFF_CTL, FIFO_CLR, FIFO_CLR); in fsi_dma_transfer()
1343 fsi_reg_write(fsi, DIFF_ST, 0); in fsi_dma_transfer()
1353 static int fsi_dma_push_start_stop(struct fsi_priv *fsi, struct fsi_stream *io, in fsi_dma_push_start_stop() argument
1356 struct fsi_master *master = fsi_get_master(fsi); in fsi_dma_push_start_stop()
1357 u32 clk = fsi_is_port_a(fsi) ? CRA : CRB; in fsi_dma_push_start_stop()
1360 fsi_reg_mask_set(fsi, OUT_DMAC, DMA_ON, enable); in fsi_dma_push_start_stop()
1364 if (fsi_is_clk_master(fsi)) in fsi_dma_push_start_stop()
1370 static int fsi_dma_probe(struct fsi_priv *fsi, struct fsi_stream *io, struct device *dev) in fsi_dma_probe() argument
1372 int is_play = fsi_stream_is_play(fsi, io); in fsi_dma_probe()
1391 cfg.dst_addr = fsi->phys + REG_DODT; in fsi_dma_probe()
1395 cfg.src_addr = fsi->phys + REG_DIDT; in fsi_dma_probe()
1411 fsi->playback.handler = &fsi_pio_push_handler; in fsi_dma_probe()
1413 fsi->capture.handler = &fsi_pio_pop_handler; in fsi_dma_probe()
1418 return fsi_stream_probe(fsi, dev); in fsi_dma_probe()
1424 static int fsi_dma_remove(struct fsi_priv *fsi, struct fsi_stream *io) in fsi_dma_remove() argument
1426 fsi_stream_stop(fsi, io); in fsi_dma_remove()
1446 static void fsi_fifo_init(struct fsi_priv *fsi, in fsi_fifo_init() argument
1450 struct fsi_master *master = fsi_get_master(fsi); in fsi_fifo_init()
1451 int is_play = fsi_stream_is_play(fsi, io); in fsi_fifo_init()
1457 shift >>= fsi_get_port_shift(fsi, io); in fsi_fifo_init()
1481 for (i = 1; i < fsi->chan_num; i <<= 1) in fsi_fifo_init()
1484 fsi->chan_num, frame_capa); in fsi_fifo_init()
1486 io->fifo_sample_capa = fsi_frame2sample(fsi, frame_capa); in fsi_fifo_init()
1493 fsi_reg_write(fsi, DOFF_CTL, IRQ_HALF); in fsi_fifo_init()
1494 fsi_reg_mask_set(fsi, DOFF_CTL, FIFO_CLR, FIFO_CLR); in fsi_fifo_init()
1496 fsi_reg_write(fsi, DIFF_CTL, IRQ_HALF); in fsi_fifo_init()
1497 fsi_reg_mask_set(fsi, DIFF_CTL, FIFO_CLR, FIFO_CLR); in fsi_fifo_init()
1501 static int fsi_hw_startup(struct fsi_priv *fsi, in fsi_hw_startup() argument
1508 if (fsi_is_clk_master(fsi)) in fsi_hw_startup()
1511 fsi_reg_mask_set(fsi, CKG1, (DIMD | DOMD), data); in fsi_hw_startup()
1515 if (fsi->bit_clk_inv) in fsi_hw_startup()
1517 if (fsi->lr_clk_inv) in fsi_hw_startup()
1519 if (fsi_is_clk_master(fsi)) in fsi_hw_startup()
1521 fsi_reg_write(fsi, CKG2, data); in fsi_hw_startup()
1524 if (fsi_is_spdif(fsi)) { in fsi_hw_startup()
1525 fsi_spdif_clk_ctrl(fsi, 1); in fsi_hw_startup()
1526 fsi_reg_mask_set(fsi, OUT_SEL, DMMD, DMMD); in fsi_hw_startup()
1541 fsi_format_bus_setup(fsi, io, data, dev); in fsi_hw_startup()
1544 fsi_irq_disable(fsi, io); in fsi_hw_startup()
1545 fsi_irq_clear_status(fsi); in fsi_hw_startup()
1548 fsi_fifo_init(fsi, io, dev); in fsi_hw_startup()
1551 if (fsi_is_clk_master(fsi)) in fsi_hw_startup()
1552 return fsi_clk_enable(dev, fsi); in fsi_hw_startup()
1557 static int fsi_hw_shutdown(struct fsi_priv *fsi, in fsi_hw_shutdown() argument
1561 if (fsi_is_clk_master(fsi)) in fsi_hw_shutdown()
1562 return fsi_clk_disable(dev, fsi); in fsi_hw_shutdown()
1570 struct fsi_priv *fsi = fsi_get_priv(substream); in fsi_dai_startup() local
1572 fsi_clk_invalid(fsi); in fsi_dai_startup()
1580 struct fsi_priv *fsi = fsi_get_priv(substream); in fsi_dai_shutdown() local
1582 fsi_clk_invalid(fsi); in fsi_dai_shutdown()
1588 struct fsi_priv *fsi = fsi_get_priv(substream); in fsi_dai_trigger() local
1589 struct fsi_stream *io = fsi_stream_get(fsi, substream); in fsi_dai_trigger()
1594 fsi_stream_init(fsi, io, substream); in fsi_dai_trigger()
1596 ret = fsi_hw_startup(fsi, io, dai->dev); in fsi_dai_trigger()
1598 ret = fsi_stream_start(fsi, io); in fsi_dai_trigger()
1604 ret = fsi_hw_shutdown(fsi, dai->dev); in fsi_dai_trigger()
1605 fsi_stream_stop(fsi, io); in fsi_dai_trigger()
1606 fsi_stream_quit(fsi, io); in fsi_dai_trigger()
1613 static int fsi_set_fmt_dai(struct fsi_priv *fsi, unsigned int fmt) in fsi_set_fmt_dai() argument
1617 fsi->fmt = CR_I2S; in fsi_set_fmt_dai()
1618 fsi->chan_num = 2; in fsi_set_fmt_dai()
1621 fsi->fmt = CR_PCM; in fsi_set_fmt_dai()
1622 fsi->chan_num = 2; in fsi_set_fmt_dai()
1631 static int fsi_set_fmt_spdif(struct fsi_priv *fsi) in fsi_set_fmt_spdif() argument
1633 struct fsi_master *master = fsi_get_master(fsi); in fsi_set_fmt_spdif()
1638 fsi->fmt = CR_DTMD_SPDIF_PCM | CR_PCM; in fsi_set_fmt_spdif()
1639 fsi->chan_num = 2; in fsi_set_fmt_spdif()
1646 struct fsi_priv *fsi = fsi_get_priv_frm_dai(dai); in fsi_dai_set_fmt() local
1654 fsi->clk_master = 1; /* cpu is master */ in fsi_dai_set_fmt()
1663 fsi->bit_clk_inv = 0; in fsi_dai_set_fmt()
1664 fsi->lr_clk_inv = 1; in fsi_dai_set_fmt()
1667 fsi->bit_clk_inv = 1; in fsi_dai_set_fmt()
1668 fsi->lr_clk_inv = 0; in fsi_dai_set_fmt()
1671 fsi->bit_clk_inv = 1; in fsi_dai_set_fmt()
1672 fsi->lr_clk_inv = 1; in fsi_dai_set_fmt()
1676 fsi->bit_clk_inv = 0; in fsi_dai_set_fmt()
1677 fsi->lr_clk_inv = 0; in fsi_dai_set_fmt()
1681 if (fsi_is_clk_master(fsi)) { in fsi_dai_set_fmt()
1682 if (fsi->clk_cpg) in fsi_dai_set_fmt()
1683 fsi_clk_init(dai->dev, fsi, 0, 1, 1, in fsi_dai_set_fmt()
1686 fsi_clk_init(dai->dev, fsi, 1, 1, 0, in fsi_dai_set_fmt()
1691 if (fsi_is_spdif(fsi)) in fsi_dai_set_fmt()
1692 ret = fsi_set_fmt_spdif(fsi); in fsi_dai_set_fmt()
1694 ret = fsi_set_fmt_dai(fsi, fmt & SND_SOC_DAIFMT_FORMAT_MASK); in fsi_dai_set_fmt()
1703 struct fsi_priv *fsi = fsi_get_priv(substream); in fsi_dai_hw_params() local
1705 if (fsi_is_clk_master(fsi)) in fsi_dai_hw_params()
1706 fsi_clk_valid(fsi, params_rate(params)); in fsi_dai_hw_params()
1767 struct fsi_priv *fsi = fsi_get_priv(substream); in fsi_pointer() local
1768 struct fsi_stream *io = fsi_stream_get(fsi, substream); in fsi_pointer()
1770 return fsi_sample2frame(fsi, io->buff_sample_pos); in fsi_pointer()
1831 .name = "fsi",
1867 static void fsi_port_info_init(struct fsi_priv *fsi, in fsi_port_info_init() argument
1871 fsi->spdif = 1; in fsi_port_info_init()
1874 fsi->clk_cpg = 1; in fsi_port_info_init()
1877 fsi->enable_stream = 1; in fsi_port_info_init()
1880 static void fsi_handler_init(struct fsi_priv *fsi, in fsi_handler_init() argument
1883 fsi->playback.handler = &fsi_pio_push_handler; /* default PIO */ in fsi_handler_init()
1884 fsi->playback.priv = fsi; in fsi_handler_init()
1885 fsi->capture.handler = &fsi_pio_pop_handler; /* default PIO */ in fsi_handler_init()
1886 fsi->capture.priv = fsi; in fsi_handler_init()
1889 fsi->playback.dma_id = info->tx_id; in fsi_handler_init()
1890 fsi->playback.handler = &fsi_dma_push_handler; in fsi_handler_init()
1933 struct fsi_priv *fsi; in fsi_probe() local
1955 dev_err(&pdev->dev, "unknown fsi device\n"); in fsi_probe()
1962 dev_err(&pdev->dev, "Not enough FSI platform resources.\n"); in fsi_probe()
1972 dev_err(&pdev->dev, "Unable to ioremap FSI registers.\n"); in fsi_probe()
1980 /* FSI A setting */ in fsi_probe()
1981 fsi = &master->fsia; in fsi_probe()
1982 fsi->base = master->base; in fsi_probe()
1983 fsi->phys = res->start; in fsi_probe()
1984 fsi->master = master; in fsi_probe()
1985 fsi_port_info_init(fsi, &info.port_a); in fsi_probe()
1986 fsi_handler_init(fsi, &info.port_a); in fsi_probe()
1987 ret = fsi_stream_probe(fsi, &pdev->dev); in fsi_probe()
1993 /* FSI B setting */ in fsi_probe()
1994 fsi = &master->fsib; in fsi_probe()
1995 fsi->base = master->base + 0x40; in fsi_probe()
1996 fsi->phys = res->start + 0x40; in fsi_probe()
1997 fsi->master = master; in fsi_probe()
1998 fsi_port_info_init(fsi, &info.port_b); in fsi_probe()
1999 fsi_handler_init(fsi, &info.port_b); in fsi_probe()
2000 ret = fsi_stream_probe(fsi, &pdev->dev); in fsi_probe()
2046 static void __fsi_suspend(struct fsi_priv *fsi, in __fsi_suspend() argument
2050 if (!fsi_stream_is_working(fsi, io)) in __fsi_suspend()
2053 fsi_stream_stop(fsi, io); in __fsi_suspend()
2054 fsi_hw_shutdown(fsi, dev); in __fsi_suspend()
2057 static void __fsi_resume(struct fsi_priv *fsi, in __fsi_resume() argument
2061 if (!fsi_stream_is_working(fsi, io)) in __fsi_resume()
2064 fsi_hw_startup(fsi, io, dev); in __fsi_resume()
2065 fsi_stream_start(fsi, io); in __fsi_resume()
2105 .name = "fsi-pcm-audio",
2117 MODULE_DESCRIPTION("SuperH onchip FSI audio driver");
2119 MODULE_ALIAS("platform:fsi-pcm-audio");