diff mbox series

[2/2] ASoC: imx-card: Add playback_only or capture_only support

Message ID 20250211035737.3886974-3-shengjiu.wang@nxp.com (mailing list archive)
State Superseded
Headers show
Series ASoC: imx-card: support playback or capture only | expand

Commit Message

Shengjiu Wang Feb. 11, 2025, 3:57 a.m. UTC
With the DPCM case, the backend only support capture or
playback, then the linked frontend can only support
capture or playback, but frontend can't automatically
enable only capture or playback, it needs the input
from dt-binding.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
 sound/soc/fsl/imx-card.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Frank Li Feb. 11, 2025, 3:34 p.m. UTC | #1
On Tue, Feb 11, 2025 at 11:57:37AM +0800, Shengjiu Wang wrote:
> With the DPCM case, the backend only support capture or
> playback, then the linked frontend can only support
> capture or playback, but frontend can't automatically
> enable only capture or playback, it needs the input
> from dt-binding.

wrap at 75 chars

>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> ---
>  sound/soc/fsl/imx-card.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c
> index ac043ad367ac..905294682996 100644
> --- a/sound/soc/fsl/imx-card.c
> +++ b/sound/soc/fsl/imx-card.c
> @@ -518,6 +518,7 @@ static int imx_card_parse_of(struct imx_card_data *data)
>  	struct snd_soc_dai_link *link;
>  	struct dai_link_data *link_data;
>  	struct of_phandle_args args;
> +	bool playback_only, capture_only;
>  	int ret, num_links;
>  	u32 asrc_fmt = 0;
>  	u32 width;
> @@ -679,6 +680,10 @@ static int imx_card_parse_of(struct imx_card_data *data)
>  			link->ops = &imx_aif_ops;
>  		}
>
> +		graph_util_parse_link_direction(np, &playback_only, &capture_only);
> +		link->playback_only = playback_only;
> +		link->capture_only = capture_only;
> +

if only use once, needn't local variable.

graph_util_parse_link_direction(np, &link->playback_only, &link->capture_only)

Frank

>  		/* Get dai fmt */
>  		ret = simple_util_parse_daifmt(dev, np, codec,
>  					       NULL, &link->dai_fmt);
> --
> 2.34.1
>
Shengjiu Wang Feb. 12, 2025, 3:48 a.m. UTC | #2
On Tue, Feb 11, 2025 at 11:34 PM Frank Li <Frank.li@nxp.com> wrote:
>
> On Tue, Feb 11, 2025 at 11:57:37AM +0800, Shengjiu Wang wrote:
> > With the DPCM case, the backend only support capture or
> > playback, then the linked frontend can only support
> > capture or playback, but frontend can't automatically
> > enable only capture or playback, it needs the input
> > from dt-binding.
>
> wrap at 75 chars

On my side, there are in 75 chars...

>
> >
> > Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> > ---
> >  sound/soc/fsl/imx-card.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c
> > index ac043ad367ac..905294682996 100644
> > --- a/sound/soc/fsl/imx-card.c
> > +++ b/sound/soc/fsl/imx-card.c
> > @@ -518,6 +518,7 @@ static int imx_card_parse_of(struct imx_card_data *data)
> >       struct snd_soc_dai_link *link;
> >       struct dai_link_data *link_data;
> >       struct of_phandle_args args;
> > +     bool playback_only, capture_only;
> >       int ret, num_links;
> >       u32 asrc_fmt = 0;
> >       u32 width;
> > @@ -679,6 +680,10 @@ static int imx_card_parse_of(struct imx_card_data *data)
> >                       link->ops = &imx_aif_ops;
> >               }
> >
> > +             graph_util_parse_link_direction(np, &playback_only, &capture_only);
> > +             link->playback_only = playback_only;
> > +             link->capture_only = capture_only;
> > +
>
> if only use once, needn't local variable.
>
> graph_util_parse_link_direction(np, &link->playback_only, &link->capture_only)

sound/soc/fsl/imx-card.c:683:53: error: cannot take address of
bit-field ‘playback_only’
  683 |                 graph_util_parse_link_direction(np,
&link->playback_only, &link->capture_only);
      |                                                     ^
sound/soc/fsl/imx-card.c:683:75: error: cannot take address of
bit-field ‘capture_only’
  683 |                 graph_util_parse_link_direction(np,
&link->playback_only, &link->capture_only);

There are errors with it.

best regards
Shengjiu Wang
>
> Frank
>
> >               /* Get dai fmt */
> >               ret = simple_util_parse_daifmt(dev, np, codec,
> >                                              NULL, &link->dai_fmt);
> > --
> > 2.34.1
> >
Mark Brown Feb. 12, 2025, 1:25 p.m. UTC | #3
On Wed, Feb 12, 2025 at 11:48:43AM +0800, Shengjiu Wang wrote:
> On Tue, Feb 11, 2025 at 11:34 PM Frank Li <Frank.li@nxp.com> wrote:
> > On Tue, Feb 11, 2025 at 11:57:37AM +0800, Shengjiu Wang wrote:

> > > With the DPCM case, the backend only support capture or
> > > playback, then the linked frontend can only support
> > > capture or playback, but frontend can't automatically
> > > enable only capture or playback, it needs the input
> > > from dt-binding.

> > wrap at 75 chars

> On my side, there are in 75 chars...

It's wrapped as above in the copy I got FWIW.
Frank Li Feb. 12, 2025, 3:47 p.m. UTC | #4
On Wed, Feb 12, 2025 at 11:48:43AM +0800, Shengjiu Wang wrote:
> On Tue, Feb 11, 2025 at 11:34 PM Frank Li <Frank.li@nxp.com> wrote:
> >
> > On Tue, Feb 11, 2025 at 11:57:37AM +0800, Shengjiu Wang wrote:
> > > With the DPCM case, the backend only support capture or
> > > playback, then the linked frontend can only support
> > > capture or playback, but frontend can't automatically
> > > enable only capture or playback, it needs the input
> > > from dt-binding.
> >
> > wrap at 75 chars
>
> On my side, there are in 75 chars...
>
> >
> > >
> > > Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> > > ---
> > >  sound/soc/fsl/imx-card.c | 5 +++++
> > >  1 file changed, 5 insertions(+)
> > >
> > > diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c
> > > index ac043ad367ac..905294682996 100644
> > > --- a/sound/soc/fsl/imx-card.c
> > > +++ b/sound/soc/fsl/imx-card.c
> > > @@ -518,6 +518,7 @@ static int imx_card_parse_of(struct imx_card_data *data)
> > >       struct snd_soc_dai_link *link;
> > >       struct dai_link_data *link_data;
> > >       struct of_phandle_args args;
> > > +     bool playback_only, capture_only;
> > >       int ret, num_links;
> > >       u32 asrc_fmt = 0;
> > >       u32 width;
> > > @@ -679,6 +680,10 @@ static int imx_card_parse_of(struct imx_card_data *data)
> > >                       link->ops = &imx_aif_ops;
> > >               }
> > >
> > > +             graph_util_parse_link_direction(np, &playback_only, &capture_only);
> > > +             link->playback_only = playback_only;
> > > +             link->capture_only = capture_only;
> > > +
> >
> > if only use once, needn't local variable.
> >
> > graph_util_parse_link_direction(np, &link->playback_only, &link->capture_only)
>
> sound/soc/fsl/imx-card.c:683:53: error: cannot take address of
> bit-field ‘playback_only’
>   683 |                 graph_util_parse_link_direction(np,
> &link->playback_only, &link->capture_only);
>       |                                                     ^
> sound/soc/fsl/imx-card.c:683:75: error: cannot take address of
> bit-field ‘capture_only’
>   683 |                 graph_util_parse_link_direction(np,
> &link->playback_only, &link->capture_only);
>
> There are errors with it.

Okay, it should be fine.

Frank

>
> best regards
> Shengjiu Wang
> >
> > Frank
> >
> > >               /* Get dai fmt */
> > >               ret = simple_util_parse_daifmt(dev, np, codec,
> > >                                              NULL, &link->dai_fmt);
> > > --
> > > 2.34.1
> > >
diff mbox series

Patch

diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c
index ac043ad367ac..905294682996 100644
--- a/sound/soc/fsl/imx-card.c
+++ b/sound/soc/fsl/imx-card.c
@@ -518,6 +518,7 @@  static int imx_card_parse_of(struct imx_card_data *data)
 	struct snd_soc_dai_link *link;
 	struct dai_link_data *link_data;
 	struct of_phandle_args args;
+	bool playback_only, capture_only;
 	int ret, num_links;
 	u32 asrc_fmt = 0;
 	u32 width;
@@ -679,6 +680,10 @@  static int imx_card_parse_of(struct imx_card_data *data)
 			link->ops = &imx_aif_ops;
 		}
 
+		graph_util_parse_link_direction(np, &playback_only, &capture_only);
+		link->playback_only = playback_only;
+		link->capture_only = capture_only;
+
 		/* Get dai fmt */
 		ret = simple_util_parse_daifmt(dev, np, codec,
 					       NULL, &link->dai_fmt);