Lines Matching full:mod

80 	struct rsnd_mod mod;  member
112 #define rsnd_mod_to_ssi(_mod) container_of((_mod), struct rsnd_ssi, mod)
114 #define rsnd_ssi_is_multi_secondary(mod, io) \ argument
115 (rsnd_ssi_multi_secondaries(io) & (1 << rsnd_mod_id(mod)))
116 #define rsnd_ssi_is_run_mods(mod, io) \ argument
117 (rsnd_ssi_run_mods(io) & (1 << rsnd_mod_id(mod)))
118 #define rsnd_ssi_can_output_clk(mod) (!__rsnd_ssi_is_pin_sharing(mod)) argument
122 struct rsnd_mod *mod = rsnd_io_to_mod_ssi(io); in rsnd_ssi_use_busif() local
123 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_use_busif()
126 if (!rsnd_ssi_is_dma_mode(mod)) in rsnd_ssi_use_busif()
137 static void rsnd_ssi_status_clear(struct rsnd_mod *mod) in rsnd_ssi_status_clear() argument
139 rsnd_mod_write(mod, SSISR, 0); in rsnd_ssi_status_clear()
142 static u32 rsnd_ssi_status_get(struct rsnd_mod *mod) in rsnd_ssi_status_get() argument
144 return rsnd_mod_read(mod, SSISR); in rsnd_ssi_status_get()
147 static void rsnd_ssi_status_check(struct rsnd_mod *mod, in rsnd_ssi_status_check() argument
150 struct rsnd_priv *priv = rsnd_mod_to_priv(mod); in rsnd_ssi_status_check()
156 status = rsnd_ssi_status_get(mod); in rsnd_ssi_status_check()
163 dev_warn(dev, "%s status check failed\n", rsnd_mod_name(mod)); in rsnd_ssi_status_check()
177 struct rsnd_mod *mod = rsnd_io_to_mod(io, types[i]); in rsnd_ssi_multi_secondaries() local
179 if (!mod) in rsnd_ssi_multi_secondaries()
182 mask |= 1 << rsnd_mod_id(mod); in rsnd_ssi_multi_secondaries()
264 static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod, in rsnd_ssi_master_clk_start() argument
270 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_master_clk_start()
281 if (!rsnd_ssi_can_output_clk(mod)) in rsnd_ssi_master_clk_start()
284 if (rsnd_ssi_is_multi_secondary(mod, io)) in rsnd_ssi_master_clk_start()
311 ret = rsnd_adg_ssi_clk_try_start(mod, main_rate); in rsnd_ssi_master_clk_start()
332 rsnd_mod_name(mod), chan, rate); in rsnd_ssi_master_clk_start()
341 static void rsnd_ssi_master_clk_stop(struct rsnd_mod *mod, in rsnd_ssi_master_clk_stop() argument
345 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_master_clk_stop()
350 if (!rsnd_ssi_can_output_clk(mod)) in rsnd_ssi_master_clk_stop()
360 rsnd_adg_ssi_clk_stop(mod); in rsnd_ssi_master_clk_stop()
363 static void rsnd_ssi_config_init(struct rsnd_mod *mod, in rsnd_ssi_config_init() argument
370 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_config_init()
410 if (rsnd_ssi_is_parent(mod, io)) in rsnd_ssi_config_init()
443 if (rsnd_ssi_is_dma_mode(mod)) { in rsnd_ssi_config_init()
456 static void rsnd_ssi_register_setup(struct rsnd_mod *mod) in rsnd_ssi_register_setup() argument
458 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_register_setup()
460 rsnd_mod_write(mod, SSIWSR, ssi->wsr); in rsnd_ssi_register_setup()
461 rsnd_mod_write(mod, SSICR, ssi->cr_own | in rsnd_ssi_register_setup()
468 * SSI mod common functions
470 static int rsnd_ssi_init(struct rsnd_mod *mod, in rsnd_ssi_init() argument
474 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_init()
477 if (!rsnd_ssi_is_run_mods(mod, io)) in rsnd_ssi_init()
480 ret = rsnd_ssi_master_clk_start(mod, io); in rsnd_ssi_init()
486 ret = rsnd_mod_power_on(mod); in rsnd_ssi_init()
490 rsnd_ssi_config_init(mod, io); in rsnd_ssi_init()
492 rsnd_ssi_register_setup(mod); in rsnd_ssi_init()
495 rsnd_ssi_status_clear(mod); in rsnd_ssi_init()
500 static int rsnd_ssi_quit(struct rsnd_mod *mod, in rsnd_ssi_quit() argument
504 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_quit()
507 if (!rsnd_ssi_is_run_mods(mod, io)) in rsnd_ssi_quit()
511 dev_err(dev, "%s usrcnt error\n", rsnd_mod_name(mod)); in rsnd_ssi_quit()
515 rsnd_ssi_master_clk_stop(mod, io); in rsnd_ssi_quit()
517 rsnd_mod_power_off(mod); in rsnd_ssi_quit()
530 static int rsnd_ssi_hw_params(struct rsnd_mod *mod, in rsnd_ssi_hw_params() argument
549 static int rsnd_ssi_start(struct rsnd_mod *mod, in rsnd_ssi_start() argument
553 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_start()
555 if (!rsnd_ssi_is_run_mods(mod, io)) in rsnd_ssi_start()
569 if (rsnd_ssi_is_parent(mod, io)) in rsnd_ssi_start()
574 rsnd_mod_write(mod, SSICR, ssi->cr_own | in rsnd_ssi_start()
582 static int rsnd_ssi_stop(struct rsnd_mod *mod, in rsnd_ssi_stop() argument
586 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_stop()
589 if (!rsnd_ssi_is_run_mods(mod, io)) in rsnd_ssi_stop()
592 if (rsnd_ssi_is_parent(mod, io)) in rsnd_ssi_stop()
604 rsnd_mod_write(mod, SSICR, cr | ssi->cr_en); in rsnd_ssi_stop()
605 rsnd_ssi_status_check(mod, DIRQ); in rsnd_ssi_stop()
618 rsnd_mod_write(mod, SSICR, cr); /* disabled all */ in rsnd_ssi_stop()
619 rsnd_ssi_status_check(mod, IIRQ); in rsnd_ssi_stop()
626 static int rsnd_ssi_irq(struct rsnd_mod *mod, in rsnd_ssi_irq() argument
633 int id = rsnd_mod_id(mod); in rsnd_ssi_irq()
641 if (rsnd_ssi_is_parent(mod, io)) in rsnd_ssi_irq()
644 if (!rsnd_ssi_is_run_mods(mod, io)) in rsnd_ssi_irq()
648 val = rsnd_ssi_is_dma_mode(mod) ? 0x0e000000 : 0x0f000000; in rsnd_ssi_irq()
663 rsnd_mod_write(mod, SSI_INT_ENABLE, val); in rsnd_ssi_irq()
668 static bool rsnd_ssi_pio_interrupt(struct rsnd_mod *mod,
670 static void __rsnd_ssi_interrupt(struct rsnd_mod *mod, in __rsnd_ssi_interrupt() argument
673 struct rsnd_priv *priv = rsnd_mod_to_priv(mod); in __rsnd_ssi_interrupt()
675 int is_dma = rsnd_ssi_is_dma_mode(mod); in __rsnd_ssi_interrupt()
686 status = rsnd_ssi_status_get(mod); in __rsnd_ssi_interrupt()
690 elapsed = rsnd_ssi_pio_interrupt(mod, io); in __rsnd_ssi_interrupt()
695 rsnd_mod_name(mod), status); in __rsnd_ssi_interrupt()
700 stop |= rsnd_ssiu_busif_err_status_clear(mod); in __rsnd_ssi_interrupt()
702 rsnd_ssi_status_clear(mod); in __rsnd_ssi_interrupt()
716 struct rsnd_mod *mod = data; in rsnd_ssi_interrupt() local
718 rsnd_mod_interrupt(mod, __rsnd_ssi_interrupt); in rsnd_ssi_interrupt()
723 static u32 *rsnd_ssi_get_status(struct rsnd_mod *mod, in rsnd_ssi_get_status() argument
741 * OTOH, using each mod's status is good for MUX case. in rsnd_ssi_get_status()
755 return rsnd_mod_get_status(mod, io, type); in rsnd_ssi_get_status()
761 static void rsnd_ssi_parent_attach(struct rsnd_mod *mod, in rsnd_ssi_parent_attach() argument
765 struct rsnd_priv *priv = rsnd_mod_to_priv(mod); in rsnd_ssi_parent_attach()
767 if (!__rsnd_ssi_is_pin_sharing(mod)) in rsnd_ssi_parent_attach()
773 if (rsnd_ssi_is_multi_secondary(mod, io)) in rsnd_ssi_parent_attach()
776 switch (rsnd_mod_id(mod)) { in rsnd_ssi_parent_attach()
791 static int rsnd_ssi_pcm_new(struct rsnd_mod *mod, in rsnd_ssi_pcm_new() argument
800 rsnd_ssi_parent_attach(mod, io); in rsnd_ssi_pcm_new()
805 static int rsnd_ssi_common_probe(struct rsnd_mod *mod, in rsnd_ssi_common_probe() argument
810 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_common_probe()
817 if (rsnd_ssi_is_multi_secondary(mod, io)) in rsnd_ssi_common_probe()
832 * mod->status. in rsnd_ssi_common_probe()
840 dev_name(dev), mod); in rsnd_ssi_common_probe()
848 static int rsnd_ssi_common_remove(struct rsnd_mod *mod, in rsnd_ssi_common_remove() argument
852 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_common_remove()
855 /* Do nothing if non SSI (= SSI parent, multi SSI) mod */ in rsnd_ssi_common_remove()
856 if (pure_ssi_mod != mod) in rsnd_ssi_common_remove()
861 free_irq(ssi->irq, mod); in rsnd_ssi_common_remove()
872 static bool rsnd_ssi_pio_interrupt(struct rsnd_mod *mod, in rsnd_ssi_pio_interrupt() argument
876 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_pio_interrupt()
891 rsnd_mod_write(mod, SSITDR, (*buf) << shift); in rsnd_ssi_pio_interrupt()
893 *buf = (rsnd_mod_read(mod, SSIRDR) >> shift); in rsnd_ssi_pio_interrupt()
915 static int rsnd_ssi_pio_init(struct rsnd_mod *mod, in rsnd_ssi_pio_init() argument
920 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_pio_init()
922 if (!rsnd_ssi_is_parent(mod, io)) { in rsnd_ssi_pio_init()
930 return rsnd_ssi_init(mod, io, priv); in rsnd_ssi_pio_init()
933 static int rsnd_ssi_pio_pointer(struct rsnd_mod *mod, in rsnd_ssi_pio_pointer() argument
937 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_pio_pointer()
960 static int rsnd_ssi_dma_probe(struct rsnd_mod *mod, in rsnd_ssi_dma_probe() argument
970 if (rsnd_ssi_is_multi_secondary(mod, io)) in rsnd_ssi_dma_probe()
973 ret = rsnd_ssi_common_probe(mod, io, priv); in rsnd_ssi_dma_probe()
978 ret = rsnd_dma_attach(io, mod, &io->dma); in rsnd_ssi_dma_probe()
983 static int rsnd_ssi_fallback(struct rsnd_mod *mod, in rsnd_ssi_fallback() argument
996 mod->ops = &rsnd_ssi_pio_ops; in rsnd_ssi_fallback()
998 dev_info(dev, "%s fallback to PIO mode\n", rsnd_mod_name(mod)); in rsnd_ssi_fallback()
1004 struct rsnd_mod *mod) in rsnd_ssi_dma_req() argument
1006 struct rsnd_priv *priv = rsnd_mod_to_priv(mod); in rsnd_ssi_dma_req()
1027 SSI_NAME, mod, name); in rsnd_ssi_dma_req()
1033 struct rsnd_mod *mod) in rsnd_ssi_debug_info() argument
1036 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_debug_info()
1042 seq_printf(m, "pin share: %d\n", __rsnd_ssi_is_pin_sharing(mod)); in rsnd_ssi_debug_info()
1043 seq_printf(m, "can out clk: %d\n", rsnd_ssi_can_output_clk(mod)); in rsnd_ssi_debug_info()
1044 seq_printf(m, "multi secondary: %d\n", rsnd_ssi_is_multi_secondary(mod, io)); in rsnd_ssi_debug_info()
1050 rsnd_debugfs_mod_reg_show(m, mod, RSND_GEN2_SSI, in rsnd_ssi_debug_info()
1051 rsnd_mod_id(mod) * 0x40, 0x40); in rsnd_ssi_debug_info()
1075 int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod) in rsnd_ssi_is_dma_mode() argument
1077 return mod->ops == &rsnd_ssi_dma_ops; in rsnd_ssi_is_dma_mode()
1081 * ssi mod function
1083 static void rsnd_ssi_connect(struct rsnd_mod *mod, in rsnd_ssi_connect() argument
1100 rsnd_dai_connect(mod, io, type); in rsnd_ssi_connect()
1124 struct rsnd_mod *mod; in rsnd_parse_connect_ssi() local
1132 mod = rsnd_ssi_mod_get(priv, i); in rsnd_parse_connect_ssi()
1135 rsnd_ssi_connect(mod, &rdai->playback); in rsnd_parse_connect_ssi()
1137 rsnd_ssi_connect(mod, &rdai->capture); in rsnd_parse_connect_ssi()
1152 int __rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod) in __rsnd_ssi_is_pin_sharing() argument
1154 if (!mod) in __rsnd_ssi_is_pin_sharing()
1157 return !!(rsnd_flags_has(rsnd_mod_to_ssi(mod), RSND_SSI_CLK_PIN_SHARE)); in __rsnd_ssi_is_pin_sharing()