Re: [PATCH v2 3/7] ASoC: mediatek: mt7986: support etdm in platform driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2023-07-04 at 10:58 +0200, AngeloGioacchino Del Regno wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  Il 26/06/23 04:34, Maso Huang ha scritto:
> > Add mt7986 etdm dai driver support.
> > 
> > Signed-off-by: Maso Huang <maso.huang@xxxxxxxxxxxx>
> > ---
> >   sound/soc/mediatek/mt7986/mt7986-dai-etdm.c | 421
> ++++++++++++++++++++
> >   1 file changed, 421 insertions(+)
> >   create mode 100644 sound/soc/mediatek/mt7986/mt7986-dai-etdm.c
> > 
> > diff --git a/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c
> b/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c
> > new file mode 100644
> > index 000000000000..672deb59ea46
> > --- /dev/null
> > +++ b/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c
> > @@ -0,0 +1,421 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * MediaTek ALSA SoC Audio DAI eTDM Control
> > + *
> > + * Copyright (c) 2021 MediaTek Inc.
> > + * Author: Vic Wu <vic.wu@xxxxxxxxxxxx>
> > + *         Maso Huang <maso.huang@xxxxxxxxxxxx>
> > + */
> > +
> > +#include <linux/bitops.h>
> > +#include <linux/regmap.h>
> > +#include <sound/pcm_params.h>
> > +#include "mt7986-afe-clk.h"
> > +#include "mt7986-afe-common.h"
> > +#include "mt7986-reg.h"
> > +
> > +enum {
> > +HOPPING_CLK = 0,
> > +APLL_CLK = 1,
> > +};
> > +
> > +enum {
> > +MTK_DAI_ETDM_FORMAT_I2S = 0,
> > +MTK_DAI_ETDM_FORMAT_DSPA = 4,
> > +MTK_DAI_ETDM_FORMAT_DSPB = 5,
> > +};
> > +
> > +enum {
> > +ETDM_IN5 = 2,
> > +ETDM_OUT5 = 10,
> > +};
> > +
> > +enum {
> > +MTK_ETDM_RATE_8K = 0,
> > +MTK_ETDM_RATE_12K = 1,
> > +MTK_ETDM_RATE_16K = 2,
> > +MTK_ETDM_RATE_24K = 3,
> > +MTK_ETDM_RATE_32K = 4,
> > +MTK_ETDM_RATE_48K = 5,
> > +MTK_ETDM_RATE_96K = 7,
> > +MTK_ETDM_RATE_192K = 9,
> > +MTK_ETDM_RATE_11K = 16,
> > +MTK_ETDM_RATE_22K = 17,
> > +MTK_ETDM_RATE_44K = 18,
> > +MTK_ETDM_RATE_88K = 19,
> > +MTK_ETDM_RATE_176K = 20,
> > +};
> > +
> > +struct mtk_dai_etdm_priv {
> > +bool bck_inv;
> > +bool lrck_inv;
> > +bool slave_mode;
> > +unsigned int format;
> > +};
> > +
> > +static unsigned int mt7986_etdm_rate_transform(struct device *dev,
> > +unsigned int rate)
> 
> Please either fix indentation or just do it in one line, 86 columns
> are ok.
> 

OK.

> > +{
> > +switch (rate) {
> > +case 8000:
> > +return MTK_ETDM_RATE_8K;
> > +case 11025:
> > +return MTK_ETDM_RATE_11K;
> > +case 12000:
> > +return MTK_ETDM_RATE_12K;
> > +case 16000:
> > +return MTK_ETDM_RATE_16K;
> > +case 22050:
> > +return MTK_ETDM_RATE_22K;
> > +case 24000:
> > +return MTK_ETDM_RATE_24K;
> > +case 32000:
> > +return MTK_ETDM_RATE_32K;
> > +case 44100:
> > +return MTK_ETDM_RATE_44K;
> > +case 48000:
> > +return MTK_ETDM_RATE_48K;
> > +case 88200:
> > +return MTK_ETDM_RATE_88K;
> > +case 96000:
> > +return MTK_ETDM_RATE_96K;
> > +case 176400:
> > +return MTK_ETDM_RATE_176K;
> > +case 192000:
> > +return MTK_ETDM_RATE_192K;
> > +default:
> > +dev_warn(dev, "%s(), rate %u invalid, use %d!!!\n",
> 
> s/use/using/g
> 

OK.

> > + __func__, rate, MTK_ETDM_RATE_48K);
> > +return MTK_ETDM_RATE_48K;
> > +}
> > +}
> > +
> > +static int get_etdm_wlen(unsigned int bitwidth)
> > +{
> > +return bitwidth <= 16 ? 16 : 32;
> > +}
> > +
> > +/* dai component */
> > +/* interconnection */
> > +
> > +static const struct snd_kcontrol_new o124_mix[] = {
> > +SOC_DAPM_SINGLE_AUTODISABLE("I032_Switch", AFE_CONN124_1, 0, 1,
> 0),
> > +};
> > +
> > +static const struct snd_kcontrol_new o125_mix[] = {
> > +SOC_DAPM_SINGLE_AUTODISABLE("I033_Switch", AFE_CONN125_1, 1, 1,
> 0),
> > +};
> > +
> > +static const struct snd_soc_dapm_widget mtk_dai_etdm_widgets[] = {
> > +
> > +/* DL */
> > +SND_SOC_DAPM_MIXER("I150", SND_SOC_NOPM, 0, 0, NULL, 0),
> > +SND_SOC_DAPM_MIXER("I151", SND_SOC_NOPM, 0, 0, NULL, 0),
> > +/* UL */
> > +SND_SOC_DAPM_MIXER("O124", SND_SOC_NOPM, 0, 0,
> > +   o124_mix, ARRAY_SIZE(o124_mix)),
> 
> Fits in one line.
> 

OK.

> > +SND_SOC_DAPM_MIXER("O125", SND_SOC_NOPM, 0, 0,
> > +   o125_mix, ARRAY_SIZE(o125_mix)),
> 
> This one too.
> 

OK.

> > +};
> > +
> > +static const struct snd_soc_dapm_route mtk_dai_etdm_routes[] = {
> > +{"I150", NULL, "ETDM Capture"},
> > +{"I151", NULL, "ETDM Capture"},
> > +{"ETDM Playback", NULL, "O124"},
> > +{"ETDM Playback", NULL, "O125"},
> > +{"O124", "I032_Switch", "I032"},
> > +{"O125", "I033_Switch", "I033"},
> > +};
> > +
> > +/* dai ops */
> > +static int mtk_dai_etdm_startup(struct snd_pcm_substream
> *substream,
> > +struct snd_soc_dai *dai)
> > +{
> > +struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
> > +
> > +mt7986_afe_enable_clock(afe);
> > +
> > +regmap_update_bits(afe->regmap, AUDIO_TOP_CON2, CLK_OUT5_PDN_MASK,
> > +   0);
> > +regmap_update_bits(afe->regmap, AUDIO_TOP_CON2, CLK_IN5_PDN_MASK,
> > +   0);
> 
> Both do fit in one line (and others in this file).
> 

OK.

> After fixing that,
> 
> Reviewed-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@xxxxxxxxxxxxx>

Hi Angelo,

Thanks for your review.
I'll fix them in v3 patch.

Best regards,
Maso





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux