Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161281AbbKFLfa (ORCPT ); Fri, 6 Nov 2015 06:35:30 -0500 Received: from regular1.263xmail.com ([211.150.99.138]:57361 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161168AbbKFLf0 (ORCPT ); Fri, 6 Nov 2015 06:35:26 -0500 X-263anti-spam: KSV:0;BIG:0;ABS:1;DNS:0;ATT:0;SPF:S; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 1 X-SKE-CHECKED: 1 X-ADDR-CHECKED: 0 X-RL-SENDER: zhengsq@rock-chips.com X-FST-TO: linux-rockchip@lists.infradead.org X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: zhengsq@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 Message-ID: <563C906F.8020502@rock-chips.com> Date: Fri, 06 Nov 2015 19:35:11 +0800 From: Shunqian Zheng Reply-To: zhengsq@rock-chips.com User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Mark Brown 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 References: <1446799162-15635-1-git-send-email-zhengsq@rock-chips.com> <1446799162-15635-2-git-send-email-zhengsq@rock-chips.com> <20151106104541.GC18409@sirena.org.uk> In-Reply-To: <20151106104541.GC18409@sirena.org.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2786 Lines: 83 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, ®val); 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/