Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3115879ybl; Fri, 20 Dec 2019 04:13:12 -0800 (PST) X-Google-Smtp-Source: APXvYqzi3jxUFtlfqvNT8ACN1dhQtm/9g7sUhDMzaA7aR3cah2iTh5DOdt6OpBPjZaCcP2r1oTIK X-Received: by 2002:aca:d483:: with SMTP id l125mr3402916oig.124.1576843992031; Fri, 20 Dec 2019 04:13:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576843992; cv=none; d=google.com; s=arc-20160816; b=l3m6ytvl4ISC714wkVdytOuMZmlqIVqKohjvnfv8UQTaGRMxnqJr2VNHw4QYYd+xW4 JWHz5CnrlpVXB3YmOO5cNAFDa43equcuSEjHSHUQKabzXe5d2HYCpM4QyMqbwWgupU/m 7qWB5IICJNHN8ARzCvD1xpLQ/Da8q9wtZUi/vwahUylc9xg5dlkY3W4Vawqjzya9QmaC v5PaRA9uYfC4hfbw8QnJb9kaGvlUEwA+v9dZkG/hhkKUMOb0bE/UJulZZqMc1c0FuOhH meS+ttiFXMrGsGddmSwe0oguzDif3RYckLm+Pu7eVwQJWYx6uEhKx58BM1OomhkB2wEQ SXrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=L92keL6a6+X4NF9bVLaGGGOWecI+N2SsaZKZ+4VN+fc=; b=qXg4egxfa6uabjBC3rYkyZphDmihapOrPYU2s1s8/ZZ+DAHeH65S+c0AdASJM2/2Ad a5/AoEaAwXPZHaw95u6TM4QLZewSs1PpbEMaHDELw/GdUfXjQL9mCIiOTiXX/mCRV88O jLI2BfOPB91OJqG46Y6X0FWe3aE0ZPVEdOTuuVwPFygZBhS6wQSX1yHZGuj7Wo1hPcaf wxNqVBAJgp2P4TMSrEqvdc1SlOR6B06iB1PMNr0V2WiYCVc7/uGcKkMVom8ptgULYhX7 9YkIIG92CTmzw1crRhQ1oVMGs+w73PW2U8Omu4+K0BbzC31VK6duk5nUHkkVv3YRMoqt qRDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a10si4720361oia.232.2019.12.20.04.13.00; Fri, 20 Dec 2019 04:13:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727276AbfLTML4 (ORCPT + 99 others); Fri, 20 Dec 2019 07:11:56 -0500 Received: from foss.arm.com ([217.140.110.172]:50244 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727191AbfLTMLz (ORCPT ); Fri, 20 Dec 2019 07:11:55 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EA40830E; Fri, 20 Dec 2019 04:11:54 -0800 (PST) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 683BC3F719; Fri, 20 Dec 2019 04:11:54 -0800 (PST) Date: Fri, 20 Dec 2019 12:11:52 +0000 From: Mark Brown To: Jeff Chang Cc: lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, matthias.bgg@gmail.com, alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, jeff_chang@richtek.com Subject: Re: [PATCH] ASoC: Add MediaTek MT6660 Speaker Amp Driver Message-ID: <20191220121152.GC4790@sirena.org.uk> References: <1576836934-5370-1-git-send-email-richtek.jeff.chang@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Y5rl02BVI9TCfPar" Content-Disposition: inline In-Reply-To: <1576836934-5370-1-git-send-email-richtek.jeff.chang@gmail.com> X-Cookie: I think we're in trouble. 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 --Y5rl02BVI9TCfPar Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Dec 20, 2019 at 06:15:34PM +0800, Jeff Chang wrote: > +++ b/sound/soc/codecs/mt6660.c > @@ -0,0 +1,653 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (c) 2019 MediaTek Inc. > + */ Please make the entire comment a C++ one so things look more intentional. > + { MT6660_REG_DEVID, 2}, > + { MT6660_REG_TDM_CFG3, 2}, > + { MT6660_REG_HCLIP_CTRL, 2}, > + { MT6660_REG_DA_GAIN, 2}, Missing space before the } (the same thing happens in some of the other tables). > +static int mt6660_component_get_volsw(struct snd_kcontrol *kcontrol, > + struct snd_ctl_elem_value *ucontrol) > +{ > + struct snd_soc_component *component = > + snd_soc_kcontrol_component(kcontrol); > + struct mt6660_chip *chip = (struct mt6660_chip *) > + snd_soc_component_get_drvdata(component); > + int ret = -EINVAL; > + > + if (!strcmp(kcontrol->id.name, "Chip_Rev")) { Why would this be used on a different control? > + SOC_SINGLE_EXT("BoostMode", MT6660_REG_BST_CTRL, 0, 3, 0, > + snd_soc_get_volsw, snd_soc_put_volsw), Boost Mode. You've also got a lot of these controls that are _EXT but you then just use standard operations so it's not clear why you're using _EXT. > + SOC_SINGLE_EXT("audio input selection", MT6660_REG_DATAO_SEL, 6, 3, 0, > + snd_soc_get_volsw, snd_soc_put_volsw), Audio Input Selection, but this looks like it should be a DAPM control if it's controlling audio routing. A simple numerical setting definitely doesn't seem like the right thing. > + SOC_SINGLE_EXT("AUD LOOP BACK Switch", MT6660_REG_PATH_BYPASS, 4, 1, 0, > + snd_soc_get_volsw, snd_soc_put_volsw), This sounds like it should be a DAPM thing too. > +static int mt6660_component_probe(struct snd_soc_component *component) > +{ > + struct mt6660_chip *chip = snd_soc_component_get_drvdata(component); > + int ret = 0; > + > + dev_info(component->dev, "%s\n", __func__); dev_dbg() at most but probably better to remove this and the other similar dev_info()s. > +static inline int _mt6660_chip_id_check(struct mt6660_chip *chip) > +{ > + u8 id[2] = {0}; > + int ret = 0; > + > + ret = i2c_smbus_read_i2c_block_data(chip->i2c, MT6660_REG_DEVID, 2, id); > + if (ret < 0) > + return ret; > + ret = (id[0] << 8) + id[1]; > + ret &= 0x0ff0; > + if (ret != 0x00e0 && ret != 0x01e0) > + return -ENODEV; It'd be better to print an error message saying we don't recognize the device to help people doing debugging. > + if (of_property_read_u32(np, "rt,init_setting_num", &val)) { > + dev_info(dev, "no init setting\n"); > + chip->plat_data.init_setting_num = 0; You should be adding a DT binding document for any new DT bindings. --Y5rl02BVI9TCfPar Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl38uogACgkQJNaLcl1U h9B+kQf6AzhZSat7mqBSwJVubwAXZcJ6ApJ29GlB2ypbTdOhUOTKKR8ytA2kMg6l Ifw88ajLzpL4jAIHwwS3NOMonMD/9KgNLfQVgMxzuzsYyRYBmj7p9lXsYICNIvoe nSn2nPJfw5g5PlMZ+qwxyNNMTOkui6qKCFoFS77TJq0hsbTh+x6azMfn8VVRwrL+ VRXPN2C9mAdyrVPw/XPjkTyCrXw8P6brXK6qW23Y14FRQ8dXke0rhMumWytquybM ebURG75CUEXyykGbNGHoJa4ycypd5AA/LYR86mzRbs7Mxiqlmw3co8/C44n4XKM0 QungC3A3a98p1kNSIiBM9g2Ie+cgBw== =pOxx -----END PGP SIGNATURE----- --Y5rl02BVI9TCfPar--