devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Daniel Baluta <daniel.baluta@nxp.com>
Cc: devicetree <devicetree@vger.kernel.org>,
	ALSA Development Mailing List <alsa-devel@alsa-project.org>,
	"S.j. Wang" <shengjiu.wang@nxp.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	wakasugi.jb@om.asahi-kasei.co.jp,
	Cosmin Samoila <cosmin.samoila@nxp.com>,
	Mark Brown <broonie@kernel.org>,
	Daniel Baluta <daniel.baluta@gmail.com>,
	dl-linux-imx <linux-imx@nxp.com>,
	Fabio Estevam <fabio.estevam@nxp.com>,
	Mihai Serban <mihai.serban@nxp.com>,
	Mihai Serban <mihai.serban@gmail.com>
Subject: Re: [PATCH v2 1/2] ASoC: codecs: Add support for AK5558 ADC driver
Date: Fri, 2 Feb 2018 21:33:18 +0200	[thread overview]
Message-ID: <CAHp75VfyVfGdCfjV_iaXFcRcanbgwFSgJRfu8eojdbMONMUOaQ@mail.gmail.com> (raw)
In-Reply-To: <1517588406-3295-2-git-send-email-daniel.baluta@nxp.com>

On Fri, Feb 2, 2018 at 6:20 PM, Daniel Baluta <daniel.baluta@nxp.com> wrote:
> AK5558 is a 32-bit, 768 kHZ sampling, differential input ADC
> for digital audio systems.
>
> Datasheet is available at:
>
> https://www.akm.com/akm/en/file/datasheet/AK5558VN.pdf
>
> Initial patch includes support for normal and TDM modes.
>
> Signed-off-by: Junichi Wakasugi <wakasugi.jb@om.asahi-kasei.co.jp>
> [initial coding for 3.18 kernel]
> Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
> [cleanups and porting to 4.9 kernel]
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> [tdm support]
> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
> [pm support, cleanups and porting to latest kernel]

Thanks for an update.

Couple of nitpicks below, otherwise FWIW,
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>


> @@ -0,0 +1,626 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*

> + * ak5558.c  --  audio driver for AK5558 ADC

I would remove filename. If file is ever be renamed this will make an
additional noise.

> + *
> + * Copyright (C) 2015 Asahi Kasei Microdevices Corporation
> + * Copyright 2018 NXP
> + */

> +#include <linux/module.h>
> +#include <linux/delay.h>
> +#include <linux/slab.h>
> +#include <linux/gpio/consumer.h>
> +#include <sound/soc.h>
> +#include <sound/soc-dapm.h>
> +#include <sound/pcm.h>
> +#include <sound/pcm_params.h>
> +#include <linux/pm_runtime.h>
> +#include <sound/initval.h>
> +#include <linux/i2c.h>
> +#include <sound/tlv.h>
> +#include <linux/of_gpio.h>
> +#include <linux/regmap.h>

I would rather keep it sorted

 +#include <linux/delay.h>
 +#include <linux/gpio/consumer.h>
 +#include <linux/i2c.h>
 +#include <linux/module.h>
 +#include <linux/pm_runtime.h>
 +#include <linux/regmap.h>
 +#include <linux/slab.h>
      // yeah keep an empty line here to split groups
 +#include <sound/initval.h>
 +#include <sound/pcm.h>
 +#include <sound/pcm_params.h>
 +#include <sound/soc.h>
 +#include <sound/soc-dapm.h>
 +#include <sound/tlv.h>

+#include <linux/of_gpio.h>

This one is redundant.

> +static int ak5558_set_dai_mute(struct snd_soc_dai *dai, int mute)
> +{
> +       struct snd_soc_codec *codec = dai->codec;
> +       struct ak5558_priv *ak5558 = snd_soc_codec_get_drvdata(codec);

> +       int ndt = 0;

It might be even

      int ndt = max(ak5558->fs ? 583000 / ak5558->fs : 5, 5);

> +       if (!mute)
> +               return 0;
> +

> +       if (ak5558->fs != 0)
> +               ndt = 583000 / ak5558->fs;
> +
> +       msleep(max(ndt, 5));

...and here just

       msleep(ndt);

But I don't know if Mark is okay with that.

> +
> +       return 0;
> +}

> +       pm_runtime_enable(&i2c->dev);
> +       pm_runtime_disable(&client->dev);

I'm also not sure about these calls, but I leave it to you.

> +static const struct i2c_device_id ak5558_i2c_id[] = {
> +       { "ak5558", 0 },
> +       { }
> +};
> +MODULE_DEVICE_TABLE(i2c, ak5558_i2c_id);

I dunno if it's really helpful to have. Though it's up to Mark and you.

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2018-02-02 19:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-02 16:20 [PATCH v2 0/2] Add support for AK5558 ADC Daniel Baluta
2018-02-02 16:20 ` [PATCH v2 1/2] ASoC: codecs: Add support for AK5558 ADC driver Daniel Baluta
2018-02-02 19:33   ` Andy Shevchenko [this message]
2018-02-02 23:11     ` Mark Brown
     [not found]       ` <20180202231102.GA2705-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2018-02-04 14:31         ` Andy Shevchenko
2018-02-04 14:42           ` Daniel Baluta
2018-02-02 16:20 ` [PATCH v2 2/2] ASoC: ak5558: Add bindings for AK5558 ADC Daniel Baluta
2018-02-02 22:48   ` [alsa-devel] " Fabio Estevam
     [not found]   ` <1517588406-3295-3-git-send-email-daniel.baluta-3arQi8VN3Tc@public.gmane.org>
2018-02-05  6:09     ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHp75VfyVfGdCfjV_iaXFcRcanbgwFSgJRfu8eojdbMONMUOaQ@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=cosmin.samoila@nxp.com \
    --cc=daniel.baluta@gmail.com \
    --cc=daniel.baluta@nxp.com \
    --cc=devicetree@vger.kernel.org \
    --cc=fabio.estevam@nxp.com \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mihai.serban@gmail.com \
    --cc=mihai.serban@nxp.com \
    --cc=shengjiu.wang@nxp.com \
    --cc=wakasugi.jb@om.asahi-kasei.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).