All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shunqian Zheng <zhengsq@rock-chips.com>
To: Mark Brown <broonie@kernel.org>
Cc: robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com,
	ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
	heiko@sntech.de, lgirdwood@gmail.com, perex@perex.cz,
	tiwai@suse.com, benzh@chromium.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org,
	alsa-devel@alsa-project.org
Subject: Re: [PATCH v1 1/4] ASoC: codec: Inno codec driver for RK3036 SoC
Date: Thu, 05 Nov 2015 17:52:02 +0800	[thread overview]
Message-ID: <563B26C2.60005@rock-chips.com> (raw)
In-Reply-To: <20151019190949.GP32054@sirena.org.uk>

Mark,
I sended the v2 patches and fixed the follows,

On 2015年10月20日 03:09, Mark Brown wrote:
> On Tue, Oct 13, 2015 at 09:01:06AM +0800, Shunqian Zheng wrote:
>
>> +config SND_SOC_INNO_RK3036
>> +	tristate "Inno codec driver for RK3036 SoC"
>> +	depends on ARCH_ROCKCHIP
>> +
> There doesn't appear to be any build dependency here so can we have an
> || COMPILE_TEST please and also add to SND_SOC_ALL_CODECS.
Delete the dependency and add to SND_SOC_ALL_CODECS.
>
>> +#define DEBUG
> Please remove this for upstream.
Removed.
>
>> +static int rk3036_codec_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
>> +				       unsigned int fre, int dir)
>> +{
>> +	/* Nothing to be done here */
>> +	return 0;
>> +}
> Remove empty functions, if they can be empty they can just be omitted.
Removed.
>
>> +static int rk3036_codec_dai_digital_mute(struct snd_soc_dai *dai, int mute)
>> +{
>> +	struct snd_soc_codec *codec = dai->codec;
>> +	unsigned int val = 0;
>> +
>> +	dev_dbg(codec->dev, "rk3036_codec dai mute : %d\n", mute);
>> +	if (mute)
>> +		val |= INNO_REG_09_HP_OUTR_MUTE_YES |
>> +		       INNO_REG_09_HP_OUTL_MUTE_YES;
>> +	else
>> +		val |= INNO_REG_09_HP_OUTR_MUTE_NO |
>> +		       INNO_REG_09_HP_OUTL_MUTE_NO;
> Does the device actually need muting to avoid audio issues?  If not it
> looks like this is something that might be better made a user visible
> control instead.
Make mute as a control.
>
>> +static void rk3036_codec_power_off(struct snd_soc_codec *codec)
>> +{
>> +	struct inno_reg_val *reg_val;
>> +	int i;
>> +static void rk3036_codec_power_on(struct snd_soc_codec *codec)
>> +{
>> +	struct inno_reg_val *reg_val;
>> +	int i;
> I'd expect to see these be part of the set_bias_level() operation.
Move the part of setting precharge current  to set_bias_level()
>
>> +	dev_dbg(codec->dev, "rk3036_codec power on\n");
>> +	/* set a big current for capacitor discharging. */
>> +	snd_soc_write(codec, INNO_REG_10, INNO_REG_10_MAX_CUR);
>> +	mdelay(10);
>> +	/* start precharge */
>> +	snd_soc_write(codec, INNO_REG_06, INNO_REG_06_DAC_PRECHARGE);
>> +	mdelay(100);
>> +
>> +	for (i = 0; i < ARRAY_SIZE(inno_codec_open_path); i++) {
>> +		reg_val = &inno_codec_open_path[i];
>> +		snd_soc_write(codec, reg_val->reg, reg_val->val);
>> +		mdelay(5);
>> +	}
> This looks suspicious...  why isn't the power up sequence managed via
> DAPM?
Use DAPM to manage the power up path.
>
>> +static struct regmap *rk3036_codec_get_regmap(struct device *dev)
>> +{
>> +	struct rk3036_codec_priv *priv = dev_get_drvdata(dev);
>> +
>> +	dev_dbg(dev, "rk3036_codec get regmap\n");
>> +	return priv->regmap;
>> +}
> There's already dev_get_regmap().
Delete this functions.
>
>> +static int codec_reg_read(void *context, unsigned int reg, unsigned int *val)
>> +{
>> +	struct rk3036_codec_priv *priv = context;
>> +	void __iomem *base = priv->base;
>> +
>> +	*val = readl(base + reg);
>> +	return 0;
>> +}
>> +static struct regmap_bus codec_regmap_bus = {
>> +	.reg_read = codec_reg_read,
>> +	.reg_write = codec_reg_write,
> This looks like it's just regmap_mmio, why not just use that?
Use the devm_regmap_init_mmio().
>
>> +	ret = regmap_write(grf, 0x00140, BIT(16 + 10) | BIT(10));
>> +	if (ret != 0) {
> Can we have some defines for this rather than all the magic numbers?
Define some macros for grf select.
>
>> +static void rk3036_codec_platform_shutdown(struct platform_device *pdev)
>> +{
>> +	/*TODO:*/
>> +}
> If you use DAPM you shouldn't need to do anything here.
Delete it.

Thank you very much,
Shunqian



WARNING: multiple messages have this Message-ID (diff)
From: zhengsq@rock-chips.com (Shunqian Zheng)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v1 1/4] ASoC: codec: Inno codec driver for RK3036 SoC
Date: Thu, 05 Nov 2015 17:52:02 +0800	[thread overview]
Message-ID: <563B26C2.60005@rock-chips.com> (raw)
In-Reply-To: <20151019190949.GP32054@sirena.org.uk>

Mark,
I sended the v2 patches and fixed the follows,

On 2015?10?20? 03:09, Mark Brown wrote:
> On Tue, Oct 13, 2015 at 09:01:06AM +0800, Shunqian Zheng wrote:
>
>> +config SND_SOC_INNO_RK3036
>> +	tristate "Inno codec driver for RK3036 SoC"
>> +	depends on ARCH_ROCKCHIP
>> +
> There doesn't appear to be any build dependency here so can we have an
> || COMPILE_TEST please and also add to SND_SOC_ALL_CODECS.
Delete the dependency and add to SND_SOC_ALL_CODECS.
>
>> +#define DEBUG
> Please remove this for upstream.
Removed.
>
>> +static int rk3036_codec_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
>> +				       unsigned int fre, int dir)
>> +{
>> +	/* Nothing to be done here */
>> +	return 0;
>> +}
> Remove empty functions, if they can be empty they can just be omitted.
Removed.
>
>> +static int rk3036_codec_dai_digital_mute(struct snd_soc_dai *dai, int mute)
>> +{
>> +	struct snd_soc_codec *codec = dai->codec;
>> +	unsigned int val = 0;
>> +
>> +	dev_dbg(codec->dev, "rk3036_codec dai mute : %d\n", mute);
>> +	if (mute)
>> +		val |= INNO_REG_09_HP_OUTR_MUTE_YES |
>> +		       INNO_REG_09_HP_OUTL_MUTE_YES;
>> +	else
>> +		val |= INNO_REG_09_HP_OUTR_MUTE_NO |
>> +		       INNO_REG_09_HP_OUTL_MUTE_NO;
> Does the device actually need muting to avoid audio issues?  If not it
> looks like this is something that might be better made a user visible
> control instead.
Make mute as a control.
>
>> +static void rk3036_codec_power_off(struct snd_soc_codec *codec)
>> +{
>> +	struct inno_reg_val *reg_val;
>> +	int i;
>> +static void rk3036_codec_power_on(struct snd_soc_codec *codec)
>> +{
>> +	struct inno_reg_val *reg_val;
>> +	int i;
> I'd expect to see these be part of the set_bias_level() operation.
Move the part of setting precharge current  to set_bias_level()
>
>> +	dev_dbg(codec->dev, "rk3036_codec power on\n");
>> +	/* set a big current for capacitor discharging. */
>> +	snd_soc_write(codec, INNO_REG_10, INNO_REG_10_MAX_CUR);
>> +	mdelay(10);
>> +	/* start precharge */
>> +	snd_soc_write(codec, INNO_REG_06, INNO_REG_06_DAC_PRECHARGE);
>> +	mdelay(100);
>> +
>> +	for (i = 0; i < ARRAY_SIZE(inno_codec_open_path); i++) {
>> +		reg_val = &inno_codec_open_path[i];
>> +		snd_soc_write(codec, reg_val->reg, reg_val->val);
>> +		mdelay(5);
>> +	}
> This looks suspicious...  why isn't the power up sequence managed via
> DAPM?
Use DAPM to manage the power up path.
>
>> +static struct regmap *rk3036_codec_get_regmap(struct device *dev)
>> +{
>> +	struct rk3036_codec_priv *priv = dev_get_drvdata(dev);
>> +
>> +	dev_dbg(dev, "rk3036_codec get regmap\n");
>> +	return priv->regmap;
>> +}
> There's already dev_get_regmap().
Delete this functions.
>
>> +static int codec_reg_read(void *context, unsigned int reg, unsigned int *val)
>> +{
>> +	struct rk3036_codec_priv *priv = context;
>> +	void __iomem *base = priv->base;
>> +
>> +	*val = readl(base + reg);
>> +	return 0;
>> +}
>> +static struct regmap_bus codec_regmap_bus = {
>> +	.reg_read = codec_reg_read,
>> +	.reg_write = codec_reg_write,
> This looks like it's just regmap_mmio, why not just use that?
Use the devm_regmap_init_mmio().
>
>> +	ret = regmap_write(grf, 0x00140, BIT(16 + 10) | BIT(10));
>> +	if (ret != 0) {
> Can we have some defines for this rather than all the magic numbers?
Define some macros for grf select.
>
>> +static void rk3036_codec_platform_shutdown(struct platform_device *pdev)
>> +{
>> +	/*TODO:*/
>> +}
> If you use DAPM you shouldn't need to do anything here.
Delete it.

Thank you very much,
Shunqian

  reply	other threads:[~2015-11-05  9:52 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-13  1:01 [PATCH v1 0/4] Audio Codec Driver of RK3036 SoC Shunqian Zheng
2015-10-13  1:01 ` Shunqian Zheng
2015-10-13  1:01 ` [PATCH v1 1/4] ASoC: codec: Inno codec driver for " Shunqian Zheng
2015-10-13  1:01   ` Shunqian Zheng
2015-10-19  6:56   ` [alsa-devel] " Ricard Wanderlof
2015-10-19  6:56     ` Ricard Wanderlof
2015-10-19  6:56     ` Ricard Wanderlof
2015-10-19 18:54     ` Mark Brown
2015-10-19 18:54       ` Mark Brown
2015-10-19 18:54       ` Mark Brown
2015-10-19 19:09   ` Mark Brown
2015-10-19 19:09     ` Mark Brown
2015-11-05  9:52     ` Shunqian Zheng [this message]
2015-11-05  9:52       ` Shunqian Zheng
2015-10-13  1:01 ` [PATCH v1 2/4] ASoC: RK3036: Add binding doc of inno-rk3036 codec driver Shunqian Zheng
2015-10-13  1:01   ` Shunqian Zheng
2015-10-13  1:01 ` [PATCH v1 3/4] ASoC: Add codec machine driver for RK3036 Shunqian Zheng
2015-10-13  1:01   ` Shunqian Zheng
2015-10-13  1:01   ` Shunqian Zheng
2015-10-19 12:12   ` Sjoerd Simons
2015-10-19 12:12     ` Sjoerd Simons
2015-10-19 19:13   ` Mark Brown
2015-10-19 19:13     ` Mark Brown
2015-10-24  3:18     ` Shunqian Zheng
2015-10-24  3:18       ` Shunqian Zheng
2015-10-24  3:18       ` Shunqian Zheng
2015-10-13  1:01 ` [PATCH v1 4/4] ASoC: RK3036: Add binding doc for audio machine driver Shunqian Zheng
2015-10-13  1:01   ` Shunqian Zheng

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=563B26C2.60005@rock-chips.com \
    --to=zhengsq@rock-chips.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=benzh@chromium.org \
    --cc=broonie@kernel.org \
    --cc=galak@codeaurora.org \
    --cc=heiko@sntech.de \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=perex@perex.cz \
    --cc=robh+dt@kernel.org \
    --cc=tiwai@suse.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.