From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7E0EC47255 for ; Mon, 11 May 2020 11:03:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A159C20801 for ; Mon, 11 May 2020 11:03:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589195030; bh=DgjQ4t5B+iWHHzTaX1d+gS0bC2w3AC2yiTIZkqa7eeM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=mI+punV05Y/hHg+yHuqwBxA7lZ2+RinHOFU6kE23r2LSmRAYFSA5P6ObCvRx33eJS XVFTCu/gRwPoFg35fPi+an7wXCgGH3DG6wm0vnGXsAdV7ktC/gwsUJvDQLEFnEONxa o589yDmxuksvLtpyX8sGu6ENQqa+B3p08pjsjJRg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729143AbgEKLDt (ORCPT ); Mon, 11 May 2020 07:03:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:50582 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725993AbgEKLDt (ORCPT ); Mon, 11 May 2020 07:03:49 -0400 Received: from localhost (fw-tnat.cambridge.arm.com [217.140.96.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5D888206F9; Mon, 11 May 2020 11:03:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589195028; bh=DgjQ4t5B+iWHHzTaX1d+gS0bC2w3AC2yiTIZkqa7eeM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ilMbR2RbeQu1sVlK/6nq9NvkernGroLe5nJnzglwmy/sJ4zbJghwgi4k9M7dGdIVy C+GW49ni9H21Y77QNl1v8EPAMCtc78nuk0c57nJpt5k7kZWydXbRhbfAy1OzyyH+lt T9ZReD/SOo1Nn2M+OnyIZCyZPazmZRm6kuouGbVw= Date: Mon, 11 May 2020 12:03:46 +0100 From: Mark Brown To: Steve Lee Cc: lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, ckeepax@opensource.cirrus.com, geert@linux-m68k.org, rf@opensource.wolfsonmicro.com, shumingf@realtek.com, srinivas.kandagatla@linaro.org, krzk@kernel.org, dmurphy@ti.com, jack.yu@realtek.com, nuno.sa@analog.com, steves.lee@maximintegrated.com, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, ryan.lee.maxim@gmail.com Subject: Re: [PATCH 2/2] ASoC: max98390: Added Amplifier Driver Message-ID: <20200511110346.GE8216@sirena.org.uk> References: <20200509031919.9006-1-steves.lee@maximintegrated.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="tNQTSEo8WG/FKZ8E" Content-Disposition: inline In-Reply-To: <20200509031919.9006-1-steves.lee@maximintegrated.com> X-Cookie: TANSTAAFL User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --tNQTSEo8WG/FKZ8E Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, May 09, 2020 at 12:19:19PM +0900, Steve Lee wrote: > Signed-off-by: Steve Lee This looks mostly good, a few smallish things below though: > +++ b/sound/soc/codecs/max98390.c > @@ -0,0 +1,1039 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (c) 2020, Maxim Integrated. > + */ Please make the entire comment a C++ one so things look more intentional. > + dev_info(component->dev, "Tdm mode : %d\n", > + max98390->tdm_mode); This is a bit noisy, please make it at most a dev_dbg(). > +static const char * const max98390_analog_gain_text[] = { > + "Mute", "3dB", "6dB", "9dB", "12dB", "15dB", "18dB"}; Use TLV data with regulator Volume controls for volumes, don't make them enums. > +static const char * const max98390_boost_voltage_text[] = { > + "6.5V", "6.625V", "6.75V", "6.875V", "7V", "7.125V", "7.25V", "7.375V", > + "7.5V", "7.625V", "7.75V", "7.875V", "8V", "8.125V", "8.25V", "8.375V", > + "8.5V", "8.625V", "8.75V", "8.875V", "9V", "9.125V", "9.25V", "9.375V", > + "9.5V", "9.625V", "9.75V", "9.875V", "10V" > +}; Is this really something that should be configured at runtime rather than through DT? > +static const char * const max98390_current_limit_text[] = { > + "0.00A", "0.50A", "1.00A", "1.05A", "1.10A", "1.15A", "1.20A", "1.25A", > + "1.30A", "1.35A", "1.40A", "1.45A", "1.50A", "1.55A", "1.60A", "1.65A", This looks like it should be in DT too. > +static int max98390_dsm_calib_get(struct snd_kcontrol *kcontrol, > + struct snd_ctl_elem_value *ucontrol) > +{ > + struct snd_soc_component *component = > + snd_soc_kcontrol_component(kcontrol); > + > + dev_warn(component->dev, "Get dsm_calib_get not supported\n"); > + > + return 0; > +} Just don't implement the operation if you can't implement it. > + dev_info(component->dev, > + "max98390: param fw size %d\n", > + fw->size); This should probably be a dev_dbg() too. > + /* Amp Setting */ > + regmap_write(max98390->regmap, MAX98390_CLK_MON, 0x6f); > + regmap_write(max98390->regmap, MAX98390_PCM_RX_EN_A, 0x03); > + regmap_write(max98390->regmap, MAX98390_R203D_SPK_GAIN, 0x05); > + regmap_write(max98390->regmap, MAX98390_MEAS_EN, 0x03); > + regmap_write(max98390->regmap, MAX98390_PWR_GATE_CTL, 0x2d); > + regmap_write(max98390->regmap, MAX98390_ENV_TRACK_VOUT_HEADROOM, 0x0e); > + regmap_write(max98390->regmap, MAX98390_BOOST_BYPASS1, 0x46); > + regmap_write(max98390->regmap, MAX98390_FET_SCALING3, 0x03); Are some of these things that might vary per system? If so they probably shouldn't be hard code but instead in DT. Things like the speaker gain jump out. > +static int max98390_suspend(struct device *dev) > +{ > + struct max98390_priv *max98390 = dev_get_drvdata(dev); > + > + dev_info(dev, "%s:Enter\n", __func__); dev_dbg() > +static int max98390_resume(struct device *dev) > +{ > + struct max98390_priv *max98390 = dev_get_drvdata(dev); > + > + dev_info(dev, "%s:Enter\n", __func__); dev_dbg() > + dev_info(&i2c->dev, "ASoC: MAX98390 i2c probe\n"); Just drop this. > + ret = device_property_read_u32(&i2c->dev, "maxim,temperature_calib", > + &max98390->ambient_temp_value); Normally for DT that'd be maxim,temperature-calib. --tNQTSEo8WG/FKZ8E Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl65MREACgkQJNaLcl1U h9Agswf/W7wxYge4lX5Nh8L9Ijk9piGmVyMcg0PO7bOy0r7wGdBZN85THGa7q4XD XvddrMrImLsI1/bur3AJ4R0Qxi6SM7VsWGtYvIM153KPDPJAeu4cAesjD2PhsHzL tFWU11c9Ziq0chNU8t7Mx9i0gYMcxvEgDjMGQlY7+FMJqYlh2ivRq6gpYYtPMWVA oGscpFnuOz8aJ8QBC/OrLyljDofbaoBzVcp0Jng5wo89azm0nKN9yTxCaBUr/oop ET+J+wQ0eWbFVCBCukvT9zi3ODi0EoE+kQeO6Iuqo2QQCMye57CWMRb50F/ZSl7a 6YpOnVX+X/Fooyrx6G8hauaEjUS8Pg== =sOxO -----END PGP SIGNATURE----- --tNQTSEo8WG/FKZ8E-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C550AC47255 for ; Mon, 11 May 2020 11:04:51 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 541F7206F9 for ; Mon, 11 May 2020 11:04:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="f0T9SfbC"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="ilMbR2Rb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 541F7206F9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9792886E; Mon, 11 May 2020 13:03:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9792886E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1589195089; bh=DgjQ4t5B+iWHHzTaX1d+gS0bC2w3AC2yiTIZkqa7eeM=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=f0T9SfbCIdG1ogKZMxBVgfsyzR+2cn+FDLRG6VytI3kwv8K0ghVkkSAqSelUp5UhJ p6U0ISszIlpPtk0X6n/mykVf53IYpYmwy3AQY5AbBJ5ES2yflsD7veVakf4bRMyoXm 31ficlgrDCX8AF8Uof0faODbXPdkIeuis6C0qk10= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 0DB00F80107; Mon, 11 May 2020 13:03:59 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DFA8AF80157; Mon, 11 May 2020 13:03:57 +0200 (CEST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A64E8F80107 for ; Mon, 11 May 2020 13:03:50 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A64E8F80107 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="ilMbR2Rb" Received: from localhost (fw-tnat.cambridge.arm.com [217.140.96.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5D888206F9; Mon, 11 May 2020 11:03:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589195028; bh=DgjQ4t5B+iWHHzTaX1d+gS0bC2w3AC2yiTIZkqa7eeM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ilMbR2RbeQu1sVlK/6nq9NvkernGroLe5nJnzglwmy/sJ4zbJghwgi4k9M7dGdIVy C+GW49ni9H21Y77QNl1v8EPAMCtc78nuk0c57nJpt5k7kZWydXbRhbfAy1OzyyH+lt T9ZReD/SOo1Nn2M+OnyIZCyZPazmZRm6kuouGbVw= Date: Mon, 11 May 2020 12:03:46 +0100 From: Mark Brown To: Steve Lee Subject: Re: [PATCH 2/2] ASoC: max98390: Added Amplifier Driver Message-ID: <20200511110346.GE8216@sirena.org.uk> References: <20200509031919.9006-1-steves.lee@maximintegrated.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="tNQTSEo8WG/FKZ8E" Content-Disposition: inline In-Reply-To: <20200509031919.9006-1-steves.lee@maximintegrated.com> X-Cookie: TANSTAAFL User-Agent: Mutt/1.10.1 (2018-07-13) Cc: jack.yu@realtek.com, alsa-devel@alsa-project.org, ryan.lee.maxim@gmail.com, ckeepax@opensource.cirrus.com, steves.lee@maximintegrated.com, linux-kernel@vger.kernel.org, tiwai@suse.com, krzk@kernel.org, lgirdwood@gmail.com, nuno.sa@analog.com, geert@linux-m68k.org, dmurphy@ti.com, shumingf@realtek.com, srinivas.kandagatla@linaro.org, rf@opensource.wolfsonmicro.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" --tNQTSEo8WG/FKZ8E Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, May 09, 2020 at 12:19:19PM +0900, Steve Lee wrote: > Signed-off-by: Steve Lee This looks mostly good, a few smallish things below though: > +++ b/sound/soc/codecs/max98390.c > @@ -0,0 +1,1039 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (c) 2020, Maxim Integrated. > + */ Please make the entire comment a C++ one so things look more intentional. > + dev_info(component->dev, "Tdm mode : %d\n", > + max98390->tdm_mode); This is a bit noisy, please make it at most a dev_dbg(). > +static const char * const max98390_analog_gain_text[] = { > + "Mute", "3dB", "6dB", "9dB", "12dB", "15dB", "18dB"}; Use TLV data with regulator Volume controls for volumes, don't make them enums. > +static const char * const max98390_boost_voltage_text[] = { > + "6.5V", "6.625V", "6.75V", "6.875V", "7V", "7.125V", "7.25V", "7.375V", > + "7.5V", "7.625V", "7.75V", "7.875V", "8V", "8.125V", "8.25V", "8.375V", > + "8.5V", "8.625V", "8.75V", "8.875V", "9V", "9.125V", "9.25V", "9.375V", > + "9.5V", "9.625V", "9.75V", "9.875V", "10V" > +}; Is this really something that should be configured at runtime rather than through DT? > +static const char * const max98390_current_limit_text[] = { > + "0.00A", "0.50A", "1.00A", "1.05A", "1.10A", "1.15A", "1.20A", "1.25A", > + "1.30A", "1.35A", "1.40A", "1.45A", "1.50A", "1.55A", "1.60A", "1.65A", This looks like it should be in DT too. > +static int max98390_dsm_calib_get(struct snd_kcontrol *kcontrol, > + struct snd_ctl_elem_value *ucontrol) > +{ > + struct snd_soc_component *component = > + snd_soc_kcontrol_component(kcontrol); > + > + dev_warn(component->dev, "Get dsm_calib_get not supported\n"); > + > + return 0; > +} Just don't implement the operation if you can't implement it. > + dev_info(component->dev, > + "max98390: param fw size %d\n", > + fw->size); This should probably be a dev_dbg() too. > + /* Amp Setting */ > + regmap_write(max98390->regmap, MAX98390_CLK_MON, 0x6f); > + regmap_write(max98390->regmap, MAX98390_PCM_RX_EN_A, 0x03); > + regmap_write(max98390->regmap, MAX98390_R203D_SPK_GAIN, 0x05); > + regmap_write(max98390->regmap, MAX98390_MEAS_EN, 0x03); > + regmap_write(max98390->regmap, MAX98390_PWR_GATE_CTL, 0x2d); > + regmap_write(max98390->regmap, MAX98390_ENV_TRACK_VOUT_HEADROOM, 0x0e); > + regmap_write(max98390->regmap, MAX98390_BOOST_BYPASS1, 0x46); > + regmap_write(max98390->regmap, MAX98390_FET_SCALING3, 0x03); Are some of these things that might vary per system? If so they probably shouldn't be hard code but instead in DT. Things like the speaker gain jump out. > +static int max98390_suspend(struct device *dev) > +{ > + struct max98390_priv *max98390 = dev_get_drvdata(dev); > + > + dev_info(dev, "%s:Enter\n", __func__); dev_dbg() > +static int max98390_resume(struct device *dev) > +{ > + struct max98390_priv *max98390 = dev_get_drvdata(dev); > + > + dev_info(dev, "%s:Enter\n", __func__); dev_dbg() > + dev_info(&i2c->dev, "ASoC: MAX98390 i2c probe\n"); Just drop this. > + ret = device_property_read_u32(&i2c->dev, "maxim,temperature_calib", > + &max98390->ambient_temp_value); Normally for DT that'd be maxim,temperature-calib. --tNQTSEo8WG/FKZ8E Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl65MREACgkQJNaLcl1U h9Agswf/W7wxYge4lX5Nh8L9Ijk9piGmVyMcg0PO7bOy0r7wGdBZN85THGa7q4XD XvddrMrImLsI1/bur3AJ4R0Qxi6SM7VsWGtYvIM153KPDPJAeu4cAesjD2PhsHzL tFWU11c9Ziq0chNU8t7Mx9i0gYMcxvEgDjMGQlY7+FMJqYlh2ivRq6gpYYtPMWVA oGscpFnuOz8aJ8QBC/OrLyljDofbaoBzVcp0Jng5wo89azm0nKN9yTxCaBUr/oop ET+J+wQ0eWbFVCBCukvT9zi3ODi0EoE+kQeO6Iuqo2QQCMye57CWMRb50F/ZSl7a 6YpOnVX+X/Fooyrx6G8hauaEjUS8Pg== =sOxO -----END PGP SIGNATURE----- --tNQTSEo8WG/FKZ8E--