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, benchan@google.com,
	kmixter@google.com, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org
Subject: Re: [PATCH v3 1/2] ASoC: codec: Inno codec driver for RK3036 SoC
Date: Fri, 06 Nov 2015 19:35:11 +0800	[thread overview]
Message-ID: <563C906F.8020502@rock-chips.com> (raw)
In-Reply-To: <20151106104541.GC18409@sirena.org.uk>

Hi Mark,

On 2015年11月06日 18:45, Mark Brown wrote:
> On Fri, Nov 06, 2015 at 04:39:21PM +0800, Shunqian Zheng wrote:
>
>> +	SOC_ENUM("Anti-pop", rk3036_codec_antipop_enum),
> As discussed this shouldn't be an enum.
Sure, I'll write the .get/.put/.info() for this.
Here is the preview of it.
Do you think the following is good to go?

static int rk3036_codec_antipop_info(struct snd_kcontrol *kcontrol,
                                      struct snd_ctl_elem_info *uinfo)
{
         uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
         uinfo->count = 2;
         uinfo->value.integer.min = 0;
         uinfo->value.integer.max = 1;

         return 0;
}

static int rk3036_codec_antipop_get(struct snd_kcontrol *kcontrol,
         struct snd_ctl_elem_value *ucontrol)
{
         struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
         int val, ret, regval;


         ret = snd_soc_component_read(component, INNO_R09, &regval);
         if (ret)
                 return ret;
         val = ((regval >> INNO_R09_HPL_ANITPOP_SHIFT) &
                INNO_R09_HP_ANTIPOP_MSK) == INNO_R09_HP_ANTIPOP_ON;
         ucontrol->value.integer.value[0] = val;

         val = ((regval >> INNO_R09_HPR_ANITPOP_SHIFT) &
                INNO_R09_HP_ANTIPOP_MSK) == INNO_R09_HP_ANTIPOP_ON;
         ucontrol->value.integer.value[1] = val;

         return 0;
}

static int rk3036_codec_antipop_put(struct snd_kcontrol *kcontrol,
         struct snd_ctl_elem_value *ucontrol)
{
         struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
         int val, ret, regmsk;

         val = (ucontrol->value.integer.value[0] ?
                INNO_R09_HP_ANTIPOP_ON : INNO_R09_HP_ANTIPOP_OFF ) <<
               INNO_R09_HPL_ANITPOP_SHIFT;
         val |= (ucontrol->value.integer.value[1] ?
                 INNO_R09_HP_ANTIPOP_ON : INNO_R09_HP_ANTIPOP_OFF ) <<
                INNO_R09_HPR_ANITPOP_SHIFT;

         regmsk = INNO_R09_HP_ANTIPOP_MSK << INNO_R09_HPL_ANITPOP_SHIFT |
                  INNO_R09_HP_ANTIPOP_MSK << INNO_R09_HPR_ANITPOP_SHIFT;

         ret = snd_soc_component_update_bits(component, INNO_R09,
                                             regmsk, val);
         if (ret < 0)
                 return ret;

         return 0;
}

#define SOC_RK3036_CODEC_ANTIPOP_DECL(xname) \
{       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
         .info = rk3036_codec_antipop_info, .get = 
rk3036_codec_antipop_get, \
         .put = rk3036_codec_antipop_put, }


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 v3 1/2] ASoC: codec: Inno codec driver for RK3036 SoC
Date: Fri, 06 Nov 2015 19:35:11 +0800	[thread overview]
Message-ID: <563C906F.8020502@rock-chips.com> (raw)
In-Reply-To: <20151106104541.GC18409@sirena.org.uk>

Hi Mark,

On 2015?11?06? 18:45, Mark Brown wrote:
> On Fri, Nov 06, 2015 at 04:39:21PM +0800, Shunqian Zheng wrote:
>
>> +	SOC_ENUM("Anti-pop", rk3036_codec_antipop_enum),
> As discussed this shouldn't be an enum.
Sure, I'll write the .get/.put/.info() for this.
Here is the preview of it.
Do you think the following is good to go?

static int rk3036_codec_antipop_info(struct snd_kcontrol *kcontrol,
                                      struct snd_ctl_elem_info *uinfo)
{
         uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
         uinfo->count = 2;
         uinfo->value.integer.min = 0;
         uinfo->value.integer.max = 1;

         return 0;
}

static int rk3036_codec_antipop_get(struct snd_kcontrol *kcontrol,
         struct snd_ctl_elem_value *ucontrol)
{
         struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
         int val, ret, regval;


         ret = snd_soc_component_read(component, INNO_R09, &regval);
         if (ret)
                 return ret;
         val = ((regval >> INNO_R09_HPL_ANITPOP_SHIFT) &
                INNO_R09_HP_ANTIPOP_MSK) == INNO_R09_HP_ANTIPOP_ON;
         ucontrol->value.integer.value[0] = val;

         val = ((regval >> INNO_R09_HPR_ANITPOP_SHIFT) &
                INNO_R09_HP_ANTIPOP_MSK) == INNO_R09_HP_ANTIPOP_ON;
         ucontrol->value.integer.value[1] = val;

         return 0;
}

static int rk3036_codec_antipop_put(struct snd_kcontrol *kcontrol,
         struct snd_ctl_elem_value *ucontrol)
{
         struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
         int val, ret, regmsk;

         val = (ucontrol->value.integer.value[0] ?
                INNO_R09_HP_ANTIPOP_ON : INNO_R09_HP_ANTIPOP_OFF ) <<
               INNO_R09_HPL_ANITPOP_SHIFT;
         val |= (ucontrol->value.integer.value[1] ?
                 INNO_R09_HP_ANTIPOP_ON : INNO_R09_HP_ANTIPOP_OFF ) <<
                INNO_R09_HPR_ANITPOP_SHIFT;

         regmsk = INNO_R09_HP_ANTIPOP_MSK << INNO_R09_HPL_ANITPOP_SHIFT |
                  INNO_R09_HP_ANTIPOP_MSK << INNO_R09_HPR_ANITPOP_SHIFT;

         ret = snd_soc_component_update_bits(component, INNO_R09,
                                             regmsk, val);
         if (ret < 0)
                 return ret;

         return 0;
}

#define SOC_RK3036_CODEC_ANTIPOP_DECL(xname) \
{       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
         .info = rk3036_codec_antipop_info, .get = 
rk3036_codec_antipop_get, \
         .put = rk3036_codec_antipop_put, }


Thank you very much,
Shunqian

  reply	other threads:[~2015-11-06 11:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-06  8:39 [PATCH v3 0/2] Audio Codec Driver of RK3036 SoC Shunqian Zheng
2015-11-06  8:39 ` Shunqian Zheng
     [not found] ` <1446799162-15635-1-git-send-email-zhengsq-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2015-11-06  8:39   ` [PATCH v3 1/2] ASoC: codec: Inno codec driver for " Shunqian Zheng
2015-11-06  8:39     ` Shunqian Zheng
2015-11-06  8:39     ` Shunqian Zheng
2015-11-06 10:45     ` Mark Brown
2015-11-06 10:45       ` Mark Brown
2015-11-06 11:35       ` Shunqian Zheng [this message]
2015-11-06 11:35         ` Shunqian Zheng
2015-11-06 11:47         ` Mark Brown
2015-11-06 11:47           ` Mark Brown
2015-11-06  8:39 ` [PATCH v3 2/2] ASoC: RK3036: Add binding doc of inno-rk3036 codec driver Shunqian Zheng
2015-11-06  8:39   ` 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=563C906F.8020502@rock-chips.com \
    --to=zhengsq@rock-chips.com \
    --cc=benchan@google.com \
    --cc=benzh@chromium.org \
    --cc=broonie@kernel.org \
    --cc=galak@codeaurora.org \
    --cc=heiko@sntech.de \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=kmixter@google.com \
    --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.