Lines Matching refs: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()
312 ret = rsnd_adg_ssi_clk_try_start(mod, main_rate); in rsnd_ssi_master_clk_start()
333 rsnd_mod_name(mod), chan, rate); in rsnd_ssi_master_clk_start()
338 static void rsnd_ssi_master_clk_stop(struct rsnd_mod *mod, in rsnd_ssi_master_clk_stop() argument
342 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_master_clk_stop()
347 if (!rsnd_ssi_can_output_clk(mod)) in rsnd_ssi_master_clk_stop()
357 rsnd_adg_ssi_clk_stop(mod); in rsnd_ssi_master_clk_stop()
360 static void rsnd_ssi_config_init(struct rsnd_mod *mod, in rsnd_ssi_config_init() argument
367 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_config_init()
407 if (rsnd_ssi_is_parent(mod, io)) in rsnd_ssi_config_init()
440 if (rsnd_ssi_is_dma_mode(mod)) { in rsnd_ssi_config_init()
453 static void rsnd_ssi_register_setup(struct rsnd_mod *mod) in rsnd_ssi_register_setup() argument
455 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_register_setup()
457 rsnd_mod_write(mod, SSIWSR, ssi->wsr); in rsnd_ssi_register_setup()
458 rsnd_mod_write(mod, SSICR, ssi->cr_own | in rsnd_ssi_register_setup()
467 static int rsnd_ssi_init(struct rsnd_mod *mod, in rsnd_ssi_init() argument
471 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_init()
474 if (!rsnd_ssi_is_run_mods(mod, io)) in rsnd_ssi_init()
477 ret = rsnd_ssi_master_clk_start(mod, io); in rsnd_ssi_init()
483 rsnd_mod_power_on(mod); in rsnd_ssi_init()
485 rsnd_ssi_config_init(mod, io); in rsnd_ssi_init()
487 rsnd_ssi_register_setup(mod); in rsnd_ssi_init()
490 rsnd_ssi_status_clear(mod); in rsnd_ssi_init()
495 static int rsnd_ssi_quit(struct rsnd_mod *mod, in rsnd_ssi_quit() argument
499 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_quit()
502 if (!rsnd_ssi_is_run_mods(mod, io)) in rsnd_ssi_quit()
506 dev_err(dev, "%s usrcnt error\n", rsnd_mod_name(mod)); in rsnd_ssi_quit()
510 rsnd_ssi_master_clk_stop(mod, io); in rsnd_ssi_quit()
512 rsnd_mod_power_off(mod); in rsnd_ssi_quit()
525 static int rsnd_ssi_hw_params(struct rsnd_mod *mod, in rsnd_ssi_hw_params() argument
544 static int rsnd_ssi_start(struct rsnd_mod *mod, in rsnd_ssi_start() argument
548 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_start()
550 if (!rsnd_ssi_is_run_mods(mod, io)) in rsnd_ssi_start()
564 if (rsnd_ssi_is_parent(mod, io)) in rsnd_ssi_start()
569 rsnd_mod_write(mod, SSICR, ssi->cr_own | in rsnd_ssi_start()
577 static int rsnd_ssi_stop(struct rsnd_mod *mod, in rsnd_ssi_stop() argument
581 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_stop()
584 if (!rsnd_ssi_is_run_mods(mod, io)) in rsnd_ssi_stop()
587 if (rsnd_ssi_is_parent(mod, io)) in rsnd_ssi_stop()
599 rsnd_mod_write(mod, SSICR, cr | ssi->cr_en); in rsnd_ssi_stop()
600 rsnd_ssi_status_check(mod, DIRQ); in rsnd_ssi_stop()
613 rsnd_mod_write(mod, SSICR, cr); /* disabled all */ in rsnd_ssi_stop()
614 rsnd_ssi_status_check(mod, IIRQ); in rsnd_ssi_stop()
621 static int rsnd_ssi_irq(struct rsnd_mod *mod, in rsnd_ssi_irq() argument
628 int id = rsnd_mod_id(mod); in rsnd_ssi_irq()
636 if (rsnd_ssi_is_parent(mod, io)) in rsnd_ssi_irq()
639 if (!rsnd_ssi_is_run_mods(mod, io)) in rsnd_ssi_irq()
643 val = rsnd_ssi_is_dma_mode(mod) ? 0x0e000000 : 0x0f000000; in rsnd_ssi_irq()
658 rsnd_mod_write(mod, SSI_INT_ENABLE, val); in rsnd_ssi_irq()
663 static bool rsnd_ssi_pio_interrupt(struct rsnd_mod *mod,
665 static void __rsnd_ssi_interrupt(struct rsnd_mod *mod, in __rsnd_ssi_interrupt() argument
668 struct rsnd_priv *priv = rsnd_mod_to_priv(mod); in __rsnd_ssi_interrupt()
670 int is_dma = rsnd_ssi_is_dma_mode(mod); in __rsnd_ssi_interrupt()
681 status = rsnd_ssi_status_get(mod); in __rsnd_ssi_interrupt()
685 elapsed = rsnd_ssi_pio_interrupt(mod, io); in __rsnd_ssi_interrupt()
690 rsnd_mod_name(mod), status); in __rsnd_ssi_interrupt()
695 stop |= rsnd_ssiu_busif_err_status_clear(mod); in __rsnd_ssi_interrupt()
697 rsnd_ssi_status_clear(mod); in __rsnd_ssi_interrupt()
711 struct rsnd_mod *mod = data; in rsnd_ssi_interrupt() local
713 rsnd_mod_interrupt(mod, __rsnd_ssi_interrupt); in rsnd_ssi_interrupt()
718 static u32 *rsnd_ssi_get_status(struct rsnd_mod *mod, in rsnd_ssi_get_status() argument
750 return rsnd_mod_get_status(mod, io, type); in rsnd_ssi_get_status()
756 static void rsnd_ssi_parent_attach(struct rsnd_mod *mod, in rsnd_ssi_parent_attach() argument
760 struct rsnd_priv *priv = rsnd_mod_to_priv(mod); in rsnd_ssi_parent_attach()
762 if (!__rsnd_ssi_is_pin_sharing(mod)) in rsnd_ssi_parent_attach()
768 if (rsnd_ssi_is_multi_secondary(mod, io)) in rsnd_ssi_parent_attach()
771 switch (rsnd_mod_id(mod)) { in rsnd_ssi_parent_attach()
786 static int rsnd_ssi_pcm_new(struct rsnd_mod *mod, in rsnd_ssi_pcm_new() argument
795 rsnd_ssi_parent_attach(mod, io); in rsnd_ssi_pcm_new()
800 static int rsnd_ssi_common_probe(struct rsnd_mod *mod, in rsnd_ssi_common_probe() argument
805 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_common_probe()
812 if (rsnd_ssi_is_multi_secondary(mod, io)) in rsnd_ssi_common_probe()
835 dev_name(dev), mod); in rsnd_ssi_common_probe()
843 static int rsnd_ssi_common_remove(struct rsnd_mod *mod, in rsnd_ssi_common_remove() argument
847 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_common_remove()
851 if (pure_ssi_mod != mod) in rsnd_ssi_common_remove()
856 free_irq(ssi->irq, mod); in rsnd_ssi_common_remove()
867 static bool rsnd_ssi_pio_interrupt(struct rsnd_mod *mod, in rsnd_ssi_pio_interrupt() argument
871 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_pio_interrupt()
886 rsnd_mod_write(mod, SSITDR, (*buf) << shift); in rsnd_ssi_pio_interrupt()
888 *buf = (rsnd_mod_read(mod, SSIRDR) >> shift); in rsnd_ssi_pio_interrupt()
910 static int rsnd_ssi_pio_init(struct rsnd_mod *mod, in rsnd_ssi_pio_init() argument
915 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_pio_init()
917 if (!rsnd_ssi_is_parent(mod, io)) { in rsnd_ssi_pio_init()
925 return rsnd_ssi_init(mod, io, priv); in rsnd_ssi_pio_init()
928 static int rsnd_ssi_pio_pointer(struct rsnd_mod *mod, in rsnd_ssi_pio_pointer() argument
932 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_pio_pointer()
955 static int rsnd_ssi_dma_probe(struct rsnd_mod *mod, in rsnd_ssi_dma_probe() argument
965 if (rsnd_ssi_is_multi_secondary(mod, io)) in rsnd_ssi_dma_probe()
968 ret = rsnd_ssi_common_probe(mod, io, priv); in rsnd_ssi_dma_probe()
973 ret = rsnd_dma_attach(io, mod, &io->dma); in rsnd_ssi_dma_probe()
978 static int rsnd_ssi_fallback(struct rsnd_mod *mod, in rsnd_ssi_fallback() argument
991 mod->ops = &rsnd_ssi_pio_ops; in rsnd_ssi_fallback()
993 dev_info(dev, "%s fallback to PIO mode\n", rsnd_mod_name(mod)); in rsnd_ssi_fallback()
999 struct rsnd_mod *mod) in rsnd_ssi_dma_req() argument
1001 struct rsnd_priv *priv = rsnd_mod_to_priv(mod); in rsnd_ssi_dma_req()
1022 SSI_NAME, mod, name); in rsnd_ssi_dma_req()
1028 struct rsnd_mod *mod) in rsnd_ssi_debug_info() argument
1031 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); in rsnd_ssi_debug_info()
1037 seq_printf(m, "pin share: %d\n", __rsnd_ssi_is_pin_sharing(mod)); in rsnd_ssi_debug_info()
1038 seq_printf(m, "can out clk: %d\n", rsnd_ssi_can_output_clk(mod)); in rsnd_ssi_debug_info()
1039 seq_printf(m, "multi secondary: %d\n", rsnd_ssi_is_multi_secondary(mod, io)); in rsnd_ssi_debug_info()
1045 rsnd_debugfs_mod_reg_show(m, mod, RSND_GEN2_SSI, in rsnd_ssi_debug_info()
1046 rsnd_mod_id(mod) * 0x40, 0x40); in rsnd_ssi_debug_info()
1070 int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod) in rsnd_ssi_is_dma_mode() argument
1072 return mod->ops == &rsnd_ssi_dma_ops; in rsnd_ssi_is_dma_mode()
1078 static void rsnd_ssi_connect(struct rsnd_mod *mod, in rsnd_ssi_connect() argument
1095 rsnd_dai_connect(mod, io, type); in rsnd_ssi_connect()
1118 struct rsnd_mod *mod; in rsnd_parse_connect_ssi() local
1122 mod = rsnd_ssi_mod_get(priv, i); in rsnd_parse_connect_ssi()
1125 rsnd_ssi_connect(mod, &rdai->playback); in rsnd_parse_connect_ssi()
1127 rsnd_ssi_connect(mod, &rdai->capture); in rsnd_parse_connect_ssi()
1142 int __rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod) in __rsnd_ssi_is_pin_sharing() argument
1144 if (!mod) in __rsnd_ssi_is_pin_sharing()
1147 return !!(rsnd_flags_has(rsnd_mod_to_ssi(mod), RSND_SSI_CLK_PIN_SHARE)); in __rsnd_ssi_is_pin_sharing()