From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755223AbdCTOOi (ORCPT ); Mon, 20 Mar 2017 10:14:38 -0400 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:43673 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755195AbdCTOOb (ORCPT ); Mon, 20 Mar 2017 10:14:31 -0400 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.wolfsonmicro.com Date: Mon, 20 Mar 2017 14:14:07 +0000 From: Charles Keepax To: Ryan Lee CC: , , , , , , , , , , , , , , , , , , , , , Subject: Re: [alsa-devel] [PATCH] ASoC: Add support for Maxim Integrated MAX98927 Amplifier Message-ID: <20170320141407.GS6986@localhost.localdomain> References: <1489970423-29353-1-git-send-email-ryans.lee@maximintegrated.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1489970423-29353-1-git-send-email-ryans.lee@maximintegrated.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1703200124 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 20, 2017 at 09:40:23AM +0900, Ryan Lee wrote: > Signed-off-by: Ryan Lee > --- > Resubmit the intial version of MAX98927 driver. Added all fixes into the initial patch. > +static int max98927_reg_get(struct snd_kcontrol *kcontrol, > + struct snd_ctl_elem_value *ucontrol, unsigned int reg, > + unsigned int mask, unsigned int shift) > +{ > + struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); > + struct max98927_priv *max98927 = snd_soc_codec_get_drvdata(codec); > + int data; > + > + regmap_read(max98927->regmap, reg, &data); > + ucontrol->value.integer.value[0] = (data & mask) >> shift; > + return 0; > +} > + > +static int max98927_reg_put(struct snd_kcontrol *kcontrol, > + struct snd_ctl_elem_value *ucontrol, unsigned int reg, > + unsigned int mask, unsigned int shift) > +{ > + struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); > + struct max98927_priv *max98927 = snd_soc_codec_get_drvdata(codec); > + unsigned int sel = ucontrol->value.integer.value[0]; > + > + regmap_update_bits(max98927->regmap, reg, mask, sel << shift); > + dev_dbg(codec->dev, "%s: register 0x%02X, value 0x%02X\n", > + __func__, reg, sel); > + return 0; > +} These functions look a lot like they duplicate things the ASoC core does? > +static int max98927_boost_voltage_get(struct snd_kcontrol *kcontrol, > + struct snd_ctl_elem_value *ucontrol) > +{ > + return max98927_reg_get(kcontrol, ucontrol, > + MAX98927_R0040_BOOST_CTRL0, > + MAX98927_BOOST_CTRL0_VOUT_MASK, 0); > +} > + And can't these just be specified in the normal way with the register information attached to the control? There doesn't seem to be any special behaviour being added here. Apologies if I am missing something here. Thanks, Charles From mboxrd@z Thu Jan 1 00:00:00 1970 From: Charles Keepax Subject: Re: [PATCH] ASoC: Add support for Maxim Integrated MAX98927 Amplifier Date: Mon, 20 Mar 2017 14:14:07 +0000 Message-ID: <20170320141407.GS6986@localhost.localdomain> References: <1489970423-29353-1-git-send-email-ryans.lee@maximintegrated.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1489970423-29353-1-git-send-email-ryans.lee@maximintegrated.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Ryan Lee Cc: mark.rutland@arm.com, alsa-devel@alsa-project.org, kuninori.morimoto.gx@renesas.com, lgirdwood@gmail.com, tiwai@suse.com, srinivas.kandagatla@linaro.org, romain.perier@collabora.com, bardliao@realtek.com, lars@metafoo.de, axel.lin@ingics.com, Paul.Handrigan@cirrus.com, devicetree@vger.kernel.org, arnd@arndb.de, nh6z@nh6z.net, robh+dt@kernel.org, dgreid@google.com, oder_chiou@realtek.com, KCHSU0@nuvoton.com, linux-kernel@vger.kernel.org, petr@barix.com, broonie@kernel.org List-Id: devicetree@vger.kernel.org On Mon, Mar 20, 2017 at 09:40:23AM +0900, Ryan Lee wrote: > Signed-off-by: Ryan Lee > --- > Resubmit the intial version of MAX98927 driver. Added all fixes into the initial patch. > +static int max98927_reg_get(struct snd_kcontrol *kcontrol, > + struct snd_ctl_elem_value *ucontrol, unsigned int reg, > + unsigned int mask, unsigned int shift) > +{ > + struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); > + struct max98927_priv *max98927 = snd_soc_codec_get_drvdata(codec); > + int data; > + > + regmap_read(max98927->regmap, reg, &data); > + ucontrol->value.integer.value[0] = (data & mask) >> shift; > + return 0; > +} > + > +static int max98927_reg_put(struct snd_kcontrol *kcontrol, > + struct snd_ctl_elem_value *ucontrol, unsigned int reg, > + unsigned int mask, unsigned int shift) > +{ > + struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); > + struct max98927_priv *max98927 = snd_soc_codec_get_drvdata(codec); > + unsigned int sel = ucontrol->value.integer.value[0]; > + > + regmap_update_bits(max98927->regmap, reg, mask, sel << shift); > + dev_dbg(codec->dev, "%s: register 0x%02X, value 0x%02X\n", > + __func__, reg, sel); > + return 0; > +} These functions look a lot like they duplicate things the ASoC core does? > +static int max98927_boost_voltage_get(struct snd_kcontrol *kcontrol, > + struct snd_ctl_elem_value *ucontrol) > +{ > + return max98927_reg_get(kcontrol, ucontrol, > + MAX98927_R0040_BOOST_CTRL0, > + MAX98927_BOOST_CTRL0_VOUT_MASK, 0); > +} > + And can't these just be specified in the normal way with the register information attached to the control? There doesn't seem to be any special behaviour being added here. Apologies if I am missing something here. Thanks, Charles