From 5607fed986e5cf881333d3567545a385b0ae9f5f Mon Sep 17 00:00:00 2001 From: "peter.yang" Date: Wed, 22 Nov 2017 07:33:59 +0000 Subject: [PATCH] override channels in dts setting --- seeed-4mic-voicecard-overlay.dts | 2 ++ seeed-4mic-voicecard.dtbo | Bin 2238 -> 2359 bytes seeed-8mic-voicecard-overlay.dts | 4 +++- seeed-8mic-voicecard.dtbo | Bin 2422 -> 2543 bytes simple-card.c | 39 ++++++++++++++++++++++++------- 5 files changed, 36 insertions(+), 9 deletions(-) diff --git a/seeed-4mic-voicecard-overlay.dts b/seeed-4mic-voicecard-overlay.dts index f526a3b..1c9ef66 100644 --- a/seeed-4mic-voicecard-overlay.dts +++ b/seeed-4mic-voicecard-overlay.dts @@ -51,6 +51,8 @@ simple-audio-card,bitclock-master = <&codec_dai>; simple-audio-card,frame-master = <&codec_dai>; + simple-audio-card,channels-playback-override = <4>; + simple-audio-card,channels-capture-override = <4>; cpu_dai: simple-audio-card,cpu { sound-dai = <&i2s>; diff --git a/seeed-4mic-voicecard.dtbo b/seeed-4mic-voicecard.dtbo index 171004707692737cd44627f9d4ebff1dbc06e323..02649abdad53e5035a2f1dec32e2441ec3341218 100644 GIT binary patch delta 328 zcmdldxLru&0`I@K3=Ev+3=9kw3=HfhKw1Nc1%X%qh=G8KnSp`r&qj^cOrrmRToxb( zihyWF9S}X4gW1i9G2%ZEAW0hc4%00GD~20$ZU0mZZ@ z*R!fHewn<4HJb6qBsOKnzmrwiWm;Wm7I~7mzSDT qtXq(iSecZVoUNN*mReMlnUXqrA-k|7Tsk?ipro`Y6(K9cu?7HZ@=5yu delta 247 zcmdlkv`3j(nK5CZ|@Dh39&I~z4#Gfg&Twl-q; z4+21OW*}w(N^=5fCM3QTkgWja1C3zRoxFfqn$ZbJich}G>@36p(u}Mje6j|MKV#hF z3Kna|jLBPA^cjmMKLL`}lSNpS89OK6WYy&dY5@X}l?Ff~Cj!N^C(mb9VVphr2x~Os n{K*Pz%8W}UyRglI7!Okna$or54{Z93ahny`MHnada;yRXEo?9? diff --git a/seeed-8mic-voicecard-overlay.dts b/seeed-8mic-voicecard-overlay.dts index 095ab5e..447b93b 100644 --- a/seeed-8mic-voicecard-overlay.dts +++ b/seeed-8mic-voicecard-overlay.dts @@ -55,9 +55,11 @@ simple-audio-card,format = "dsp_a"; simple-audio-card,name = "seeed-8mic-voicecard"; status = "okay"; - + simple-audio-card,bitclock-master = <&codec_dai>; simple-audio-card,frame-master = <&codec_dai>; + simple-audio-card,channels-playback-override = <8>; + simple-audio-card,channels-capture-override = <8>; cpu_dai: simple-audio-card,cpu { sound-dai = <&i2s>; diff --git a/seeed-8mic-voicecard.dtbo b/seeed-8mic-voicecard.dtbo index fcd994eab901d0ed1aa7598254abcbe3a01d0c67..c718454609e2cb959345c2171b2f5b84c65a75b4 100644 GIT binary patch delta 336 zcmew+^j=uw0`I@K3=Ev_85kHW7#P@}0BH>%76f7eAO->^ZlL&@jT+g^qW^(h4j^U* zVipDlMja4;atE`U5o5%EAV88z03j(nK5CZ|@CZKrFMvZLd$(xz2jTrue z08pG6h*^NroIsihi7y3YD?s@`BN%ljE3im2Isr-X$-yknLJT0y$Qr^YuVC?KjGO#} z#hNi=vI(m`WAWq^AXz%%O_u8Q(|IVGx-bKEQmEQcpu_dai.clk); - rtd->cpu_dai->driver->playback.channels_min = 8; - rtd->cpu_dai->driver->playback.channels_max = 8; - rtd->cpu_dai->driver->capture.channels_min = 8; - rtd->cpu_dai->driver->capture.channels_max = 8; + if (rtd->cpu_dai->driver->playback.channels_min) { + priv->channels_playback_default = rtd->cpu_dai->driver->playback.channels_min; + } + if (rtd->cpu_dai->driver->capture.channels_min) { + priv->channels_capture_default = rtd->cpu_dai->driver->capture.channels_min; + } + rtd->cpu_dai->driver->playback.channels_min = priv->channels_playback_override; + rtd->cpu_dai->driver->playback.channels_max = priv->channels_playback_override; + rtd->cpu_dai->driver->capture.channels_min = priv->channels_capture_override; + rtd->cpu_dai->driver->capture.channels_max = priv->channels_capture_override; return ret; } @@ -140,10 +150,10 @@ static void asoc_simple_card_shutdown(struct snd_pcm_substream *substream) struct simple_dai_props *dai_props = simple_priv_to_props(priv, rtd->num); - rtd->cpu_dai->driver->playback.channels_min = 2; - rtd->cpu_dai->driver->playback.channels_max = 2; - rtd->cpu_dai->driver->capture.channels_min = 2; - rtd->cpu_dai->driver->capture.channels_max = 2; + rtd->cpu_dai->driver->playback.channels_min = priv->channels_playback_default; + rtd->cpu_dai->driver->playback.channels_max = priv->channels_playback_default; + rtd->cpu_dai->driver->capture.channels_min = priv->channels_capture_default; + rtd->cpu_dai->driver->capture.channels_max = priv->channels_capture_default; clk_disable_unprepare(dai_props->cpu_dai.clk); @@ -421,6 +431,19 @@ static int asoc_simple_card_parse_of(struct device_node *node, ret = asoc_simple_card_parse_aux_devs(node, priv); + priv->channels_playback_default = 0; + priv->channels_playback_override = 2; + priv->channels_capture_default = 0; + priv->channels_capture_override = 2; + of_property_read_u32(node, PREFIX "channels-playback-default", + &priv->channels_playback_default); + of_property_read_u32(node, PREFIX "channels-playback-override", + &priv->channels_playback_override); + of_property_read_u32(node, PREFIX "channels-capture-default", + &priv->channels_capture_default); + of_property_read_u32(node, PREFIX "channels-capture-override", + &priv->channels_capture_override); + card_parse_end: of_node_put(dai_link);