lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 06 Nov 2015 19:35:11 +0800
From:	Shunqian Zheng <zhengsq@...k-chips.com>
To:	Mark Brown <broonie@...nel.org>
CC:	robh+dt@...nel.org, pawel.moll@....com, mark.rutland@....com,
	ijc+devicetree@...lion.org.uk, galak@...eaurora.org,
	heiko@...ech.de, lgirdwood@...il.com, perex@...ex.cz,
	tiwai@...e.com, benzh@...omium.org, benchan@...gle.com,
	kmixter@...gle.com, linux-arm-kernel@...ts.infradead.org,
	linux-kernel@...r.kernel.org, linux-rockchip@...ts.infradead.org
Subject: Re: [PATCH v3 1/2] ASoC: codec: Inno codec driver for RK3036 SoC

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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ