Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1875489lqm; Fri, 3 May 2024 08:53:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXFkcGjDGtSW57jZjyh8/RVxrtJ3YpDZKtwRctSWRXVcD7Fyyqqez5wkeC3FQ6M28oHrx/xgYxW6yK7YOofylLiikZ075hvC/yTamBvDg== X-Google-Smtp-Source: AGHT+IHCygAdfa6ahVlwm0z0bTTKHhUIytGF7XxYdn7HWanHfju+VMELCkkc+tQNCPZWt5dS1rPz X-Received: by 2002:a17:902:f60e:b0:1e1:1791:3681 with SMTP id n14-20020a170902f60e00b001e117913681mr3975382plg.61.1714751602631; Fri, 03 May 2024 08:53:22 -0700 (PDT) Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id j18-20020a170903029200b001e589306d73si3261026plr.26.2024.05.03.08.53.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 08:53:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-167857-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=ZGn43vEQ; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-167857-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167857-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C9AA2B21677 for ; Fri, 3 May 2024 15:53:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 825211552FE; Fri, 3 May 2024 15:53:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZGn43vEQ" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08A1D8495 for ; Fri, 3 May 2024 15:53:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714751590; cv=none; b=QHjUYj/Sm/jjO+KhwSR8sHpsOvE5y6cR5cJsnB7aGqCYArRXNnOaD8d952EkW0Srbijm54WKi1Kz+OzbQiROh/BkYbjybLKTw9MYn4yz1DeVOp3HoAHMBzQlmLi6jdcc2NRY/ee7jkCFKyY7/ofXLdFyHpmOHPvj/JaE7jE7Kh4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714751590; c=relaxed/simple; bh=sc4C0K4F3XTmWdl75AnpnLYNRwZvYCekBch4PLnPnEk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OGlZA22tZimZPuoAqz3+3PkOHebVIDlebkA0px8QK3jeL37RJ9h1Z84XzmxtrRv6Iu5e2dso6UJhoIGsaQbUOm1ZpZJxuUKebHT78BQs4IL4XelpREgB0ijX5nTpHSv/GAmc6CNYr1PzvN5RSYxjymvNv9vtH1ZTD/DPMWwJdEg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ZGn43vEQ; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714751590; x=1746287590; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=sc4C0K4F3XTmWdl75AnpnLYNRwZvYCekBch4PLnPnEk=; b=ZGn43vEQ5FT2AQ++4zXtkwXHD2QdvofjoYCuxNbuBFkDqduoGmpcOzLz tbXIX0jUstdZbq/Z/fGA83+Z/f44bVUDG3GFvwhxtqXhYOjRcw90A2rev jgAqPJTGpjTlnYEOx3UlvLvD56GyhNYx3cf04PkvKv9bTtPgjB0t93hO7 mpgMsqHmEdzn59+kcmouSy43MBQLE7mrFoF/JlqzZCIDSDTabrTOm5FAs sGhU/skbShs9D06HAqJbh5YnorpFIE/RnrMEMe0ys4eadEuAQ+duvL7fS SdxoWGMSWHnsTubdyjGfFKQ2gW1PG3BR0DT7esJwl91zi0sBNbHw/kCjL A==; X-CSE-ConnectionGUID: 6X6UZEuXSJGRUUE62Jn9sg== X-CSE-MsgGUID: cZSRXkukTrmvbD7A+cRmig== X-IronPort-AV: E=McAfee;i="6600,9927,11063"; a="14380755" X-IronPort-AV: E=Sophos;i="6.07,251,1708416000"; d="scan'208";a="14380755" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 May 2024 08:53:08 -0700 X-CSE-ConnectionGUID: NxmVgb00QnylCsGnoo2E3w== X-CSE-MsgGUID: pIEK1+KDQQup5ePDCpig+A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,251,1708416000"; d="scan'208";a="27511938" Received: from smile.fi.intel.com ([10.237.72.54]) by fmviesa007.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 May 2024 08:53:04 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1s2vDX-00000003h8U-3nrd; Fri, 03 May 2024 18:52:59 +0300 Date: Fri, 3 May 2024 18:52:59 +0300 From: Andy Shevchenko To: Shenghao Ding Cc: broonie@kernel.org, lgirdwood@gmail.com, perex@perex.cz, pierre-louis.bossart@linux.intel.com, 13916275206@139.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, liam.r.girdwood@intel.com, bard.liao@intel.com, yung-chuan.liao@linux.intel.com, kevin-lu@ti.com, cameron.berkenpas@gmail.com, tiwai@suse.de, baojun.xu@ti.com, soyer@irl.hu, Baojun.Xu@fpt.com Subject: Re: [PATCH v3] ALSA: ASoc/tas2781: Fix wrong loading calibrated data sequence Message-ID: References: <20240502232450.484-1-shenghao-ding@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240502232450.484-1-shenghao-ding@ti.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Fri, May 03, 2024 at 07:24:49AM +0800, Shenghao Ding wrote: > Calibrated data will be set to default after loading DSP config params, > which will cause speaker protection work abnormally. Reload calibrated > data after loading DSP config params. .. > +static void tasdev_load_calibrated_data(struct tasdevice_priv *priv, int i) > +{ > + struct tasdevice_fw *cal_fmw = priv->tasdevice[i].cali_data_fmw; > + > + if (cal_fmw) { Better variant is struct tasdevice_calibration *cal; struct tasdevice_fw *cal_fmw; cal_fmw = priv->tasdevice[i].cali_data_fmw; if (!cal_fmw) return; > + struct tasdevice_calibration *cal = cal_fmw->calibrations; > + > + if (cal) > + load_calib_data(priv, &cal->dev_data); > + } In the similar way cal = cal_fmw->calibrations; if (!cal) return; load_calib_data(priv, &cal->dev_data); > +} The result is much easier to read and understand and maintain, as it makes harder to squeeze the code between initialization and use and breaking things. .. > + if (tas_priv->tasdevice[i].is_loaderr == false > + && tas_priv->tasdevice[i].is_loading == true) > tas_priv->tasdevice[i].cur_prog = prm_no; While at it, make it better (fix the indentation and move operator to the previous line): if (tas_priv->tasdevice[i].is_loaderr == false && tas_priv->tasdevice[i].is_loading == true) tas_priv->tasdevice[i].cur_prog = prm_no; .. > if (tas_priv->tasdevice[i].is_loaderr == true) { > status |= 1 << (i + 4); Side note: Use BIT() > continue; .. > + if (tas_priv->tasdevice[i].is_loaderr == false > + && tas_priv->tasdevice[i].is_loading == true) { As per above. > + tasdev_load_calibrated_data(tas_priv, i); > tas_priv->tasdevice[i].cur_conf = cfg_no; > + } -- With Best Regards, Andy Shevchenko