@@ -605,23 +605,74 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = {
605605void rsnd_path_parse (struct rsnd_priv * priv ,
606606 struct rsnd_dai_stream * io )
607607{
608- struct rsnd_mod * src = rsnd_io_to_mod_src (io );
609608 struct rsnd_mod * dvc = rsnd_io_to_mod_dvc (io );
610- int src_id = rsnd_mod_id (src );
611- u32 path [] = {
612- [0 ] = 0x30000 ,
613- [1 ] = 0x30001 ,
614- [2 ] = 0x40000 ,
615- [3 ] = 0x10000 ,
616- [4 ] = 0x20000 ,
617- [5 ] = 0x40100
618- };
609+ struct rsnd_mod * mix = rsnd_io_to_mod_mix (io );
610+ struct rsnd_mod * src = rsnd_io_to_mod_src (io );
611+ struct rsnd_mod * cmd ;
612+ struct device * dev = rsnd_priv_to_dev (priv );
613+ u32 data ;
619614
620615 /* Gen1 is not supported */
621616 if (rsnd_is_gen1 (priv ))
622617 return ;
623618
624- rsnd_mod_write (dvc , CMD_ROUTE_SLCT , path [src_id ]);
619+ if (!mix && !dvc )
620+ return ;
621+
622+ if (mix ) {
623+ struct rsnd_dai * rdai ;
624+ int i ;
625+ u32 path [] = {
626+ [0 ] = 0 ,
627+ [1 ] = 1 << 0 ,
628+ [2 ] = 0 ,
629+ [3 ] = 0 ,
630+ [4 ] = 0 ,
631+ [5 ] = 1 << 8
632+ };
633+
634+ /*
635+ * it is assuming that integrater is well understanding about
636+ * data path. Here doesn't check impossible connection,
637+ * like src2 + src5
638+ */
639+ data = 0 ;
640+ for_each_rsnd_dai (rdai , priv , i ) {
641+ io = & rdai -> playback ;
642+ if (mix == rsnd_io_to_mod_mix (io ))
643+ data |= path [rsnd_mod_id (src )];
644+
645+ io = & rdai -> capture ;
646+ if (mix == rsnd_io_to_mod_mix (io ))
647+ data |= path [rsnd_mod_id (src )];
648+ }
649+
650+ /*
651+ * We can't use ctu = rsnd_io_ctu() here.
652+ * Since, ID of dvc/mix are 0 or 1 (= same as CMD number)
653+ * but ctu IDs are 0 - 7 (= CTU00 - CTU13)
654+ */
655+ cmd = mix ;
656+ } else {
657+ u32 path [] = {
658+ [0 ] = 0x30000 ,
659+ [1 ] = 0x30001 ,
660+ [2 ] = 0x40000 ,
661+ [3 ] = 0x10000 ,
662+ [4 ] = 0x20000 ,
663+ [5 ] = 0x40100
664+ };
665+
666+ data = path [rsnd_mod_id (src )];
667+
668+ cmd = dvc ;
669+ }
670+
671+ dev_dbg (dev , "ctu/mix path = 0x%08x" , data );
672+
673+ rsnd_mod_write (cmd , CMD_ROUTE_SLCT , data );
674+
675+ rsnd_mod_write (cmd , CMD_CTRL , 0x10 );
625676}
626677
627678static int rsnd_path_init (struct rsnd_priv * priv ,
@@ -656,6 +707,11 @@ static int rsnd_path_init(struct rsnd_priv *priv,
656707 if (ret < 0 )
657708 return ret ;
658709
710+ /* MIX */
711+ ret = rsnd_path_add (priv , io , mix );
712+ if (ret < 0 )
713+ return ret ;
714+
659715 /* DVC */
660716 ret = rsnd_path_add (priv , io , dvc );
661717 if (ret < 0 )
@@ -672,13 +728,14 @@ static void rsnd_of_parse_dai(struct platform_device *pdev,
672728 struct device_node * ssi_node , * ssi_np ;
673729 struct device_node * src_node , * src_np ;
674730 struct device_node * ctu_node , * ctu_np ;
731+ struct device_node * mix_node , * mix_np ;
675732 struct device_node * dvc_node , * dvc_np ;
676733 struct device_node * playback , * capture ;
677734 struct rsnd_dai_platform_info * dai_info ;
678735 struct rcar_snd_info * info = rsnd_priv_to_info (priv );
679736 struct device * dev = & pdev -> dev ;
680737 int nr , i ;
681- int dai_i , ssi_i , src_i , ctu_i , dvc_i ;
738+ int dai_i , ssi_i , src_i , ctu_i , mix_i , dvc_i ;
682739
683740 if (!of_data )
684741 return ;
@@ -705,6 +762,7 @@ static void rsnd_of_parse_dai(struct platform_device *pdev,
705762 ssi_node = of_get_child_by_name (dev -> of_node , "rcar_sound,ssi" );
706763 src_node = of_get_child_by_name (dev -> of_node , "rcar_sound,src" );
707764 ctu_node = of_get_child_by_name (dev -> of_node , "rcar_sound,ctu" );
765+ mix_node = of_get_child_by_name (dev -> of_node , "rcar_sound,mix" );
708766 dvc_node = of_get_child_by_name (dev -> of_node , "rcar_sound,dvc" );
709767
710768#define mod_parse (name ) \
@@ -742,6 +800,7 @@ if (name##_node) { \
742800 mod_parse (ssi );
743801 mod_parse (src );
744802 mod_parse (ctu );
803+ mod_parse (mix );
745804 mod_parse (dvc );
746805
747806 of_node_put (playback );
@@ -1155,6 +1214,7 @@ static int rsnd_probe(struct platform_device *pdev)
11551214 rsnd_ssi_probe ,
11561215 rsnd_src_probe ,
11571216 rsnd_ctu_probe ,
1217+ rsnd_mix_probe ,
11581218 rsnd_dvc_probe ,
11591219 rsnd_adg_probe ,
11601220 rsnd_dai_probe ,
@@ -1251,6 +1311,7 @@ static int rsnd_remove(struct platform_device *pdev)
12511311 rsnd_ssi_remove ,
12521312 rsnd_src_remove ,
12531313 rsnd_ctu_remove ,
1314+ rsnd_mix_remove ,
12541315 rsnd_dvc_remove ,
12551316 };
12561317 int ret = 0 , i ;
0 commit comments