Received: by 2002:a05:7412:85a1:b0:e2:908c:2ebd with SMTP id n33csp66507rdh; Mon, 30 Oct 2023 14:05:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGnD6pxU2m4UK/SNSusRO2kstbFTwDpECmvoKsBitf0f49PW8/LNcpxfSZAXqzNbErnoey3 X-Received: by 2002:a05:6a21:9997:b0:15a:3eaa:b7ea with SMTP id ve23-20020a056a21999700b0015a3eaab7eamr15281001pzb.5.1698699957697; Mon, 30 Oct 2023 14:05:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698699957; cv=none; d=google.com; s=arc-20160816; b=u0+HfJ0A8y28FGWTL7+TW81MnVkZxS+QHRHgBz3mZRYhDKBk5w2z8UiUbfwvsHIMNk uHUn5vww6yvND10T+Mb5PjyY/iVb+cnLBVw0IfGwrtXZZllOl7DJVAgUYVEEFepHIJOq U1RpuFi+5hsq3fICNrWqPUjrQng5xcQ9WXTHvY//TMpK5VitjTQ3mXgPkEFU9IBTviCn DBgNCii0gbYQhdHXoxTuT4mv5f3FvMa0NQtcBApkFJ8BX0anXBfrZoNvsQKS9SnMx3P5 XRn8F1MJxcIZpNGTisbKslEsc2ZOS6SITsKiukLw+2SvrTsyKpPx4KUKQrgdmjt0ssbh 8BWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=sBADRh2pc9WJBMDSTzX4mMLVYFCsd8wTm/ej2rrc0yg=; fh=+K7eN4hqa0wemsydoyMB8xqvnuemK9cmULV6R57ezqw=; b=UF/m5SaSO2E2bc1OmUQ3NsVCVZuVGDHieiWFV65zsQodk/9JWpgx/3tX6kEwNFPaY5 KAX8XRW3O/PCbURkJmDgXF5BJh7AewvBMRpjO9OrUhYqMUX/cZuH8HQ9xBVV0dYM11q9 Upn9cCQ9VOK2W3xGGY6xe0CByIhQod0WAMuF06XBB213k8wu7PmmxbIzMZktjrZRpXoA eQ3MSzC+CG5l5QtK7E3Hxavoggt5Nkw/3E1IMaDLesdr+6pJZ+ElO90Ie/d/N4TIlxNS dctL50xlHMNbdBub6Hv9KTi1NJ3Z/Bx4C6J9M+2obyoqXkP9Kzo7nDRhXnbiO5Gd/YTe o+hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="N9QSXF/t"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id k6-20020a633d06000000b0058b8c72c5ddsi5484327pga.607.2023.10.30.14.05.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 14:05:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="N9QSXF/t"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id A9832807CF62; Mon, 30 Oct 2023 14:05:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231846AbjJ3VFQ (ORCPT + 99 others); Mon, 30 Oct 2023 17:05:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229764AbjJ3VFP (ORCPT ); Mon, 30 Oct 2023 17:05:15 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F91AE1 for ; Mon, 30 Oct 2023 14:05:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698699912; x=1730235912; h=message-id:date:mime-version:subject:from:to:cc: references:in-reply-to:content-transfer-encoding; bh=LKLP6UEl/pkjGe0QKZIWac46a5g0E8T9ZC0+kHW1Z4g=; b=N9QSXF/t2GWYZ5g14ApqZ4oHKy2mPUpUD0FH+9/TdRnGcwcqh3lbFvIB 8aylIYepCIxEL2OEQ4Gjgqd2z2B7OHutsaByewvhl/01LDQLp40WPnMVD NDjQ6vy5oxrq8QPQCIvCsGrfJIduodngQDdU3XfYIe7McyEG1PK0fpqj8 KqrpUJpjQF5oLHkYIsWjFA65Thpf6x1zfYmGyQwiKEZpSqbAaEcd2OhyI hu05GO3NYy0dhdwBeMqBxjKfblqt+A9p5+rY7a50mknZc2ks4vQ1zAmDF ecFdBFvT/g4d9e7NdRRndm9WDcNw7Ezi8fEH3Cs4jGS8Uu9HMG0zRaX3F g==; X-IronPort-AV: E=McAfee;i="6600,9927,10879"; a="9691829" X-IronPort-AV: E=Sophos;i="6.03,264,1694761200"; d="scan'208";a="9691829" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2023 14:05:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10879"; a="795365560" X-IronPort-AV: E=Sophos;i="6.03,264,1694761200"; d="scan'208";a="795365560" Received: from wezedi-mobl1.amr.corp.intel.com (HELO [10.212.223.192]) ([10.212.223.192]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2023 14:05:10 -0700 Message-ID: <85890ed8-0ab3-4b14-879b-be9f0c760db8@linux.intel.com> Date: Mon, 30 Oct 2023 16:05:09 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] ASoC: tas2783: Add source files for tas2783 driver. Content-Language: en-US From: Pierre-Louis Bossart To: Mark Brown Cc: Baojun Xu , lgirdwood@gmail.com, perex@perex.cz, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, kevin-lu@ti.com, shenghao-ding@ti.com, peeyush@ti.com, navada@ti.com, tiwai@suse.de References: <20231028092409.96813-1-baojun.xu@ti.com> <7f4465c1-5e8e-4c5f-bbff-d2c930326986@linux.intel.com> <9d922584-288a-4b73-83ef-477d1bc58521@sirena.org.uk> <9b94488e-206d-419b-92ed-e70aab11907b@linux.intel.com> In-Reply-To: <9b94488e-206d-419b-92ed-e70aab11907b@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 30 Oct 2023 14:05:29 -0700 (PDT) On 10/30/23 12:40, Pierre-Louis Bossart wrote: > > > On 10/30/23 12:20, Mark Brown wrote: >> On Mon, Oct 30, 2023 at 11:05:39AM -0500, Pierre-Louis Bossart wrote: >> >>>> +static bool tas2783_readable_register(struct device *dev, unsigned int reg) >>>> +{ >>>> + switch (reg) { >>>> + case 0x000 ... 0x080: /* Data port 0. */ >> >>> No, this is wrong. All the data port 'standard' registers are "owned" by >>> the SoundWire core and handled during the port prepare/configure/bank >>> switch routines. Do not use them for regmap. >> >>> In other words, you *shall* only define vendor-specific registers in >>> this codec driver. >> >> This seems to come up a moderate amount and is an understandable thing >> to do - could you (or someone else who knows SoundWire) perhaps send a >> patch for the regmap SoundWire integration which does some validation >> here during registration and at least prints a warning? > > Good suggestion, we could indeed check that the registers are NOT in the > range [0,0xBF] for all ports - only the range [0xC0..FF] is allowed for > implementation-defined values. I'll try to cook something up. After checking, the following ranges are invalid for codec drivers: for address < 0x1000 LSB = 0x00 - 0xBF standard or reserved 0x1800 – 0x1FFF reserved 0x48000000 - 0xFFFFFFFF reserved is the recommendation to check the regmap_config and its 'yes_ranges'? Presumably if the range_min or range_max is within the invalid values above then the configuration can be tagged as problematic in the dmesg log or rejected with an error code?