public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ding, Shenghao" <shenghao-ding@ti.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "broonie@kernel.org" <broonie@kernel.org>,
	"lgirdwood@gmail.com" <lgirdwood@gmail.com>,
	"perex@perex.cz" <perex@perex.cz>,
	"pierre-louis.bossart@linux.intel.com"
	<pierre-louis.bossart@linux.intel.com>,
	"13916275206@139.com" <13916275206@139.com>,
	"judyhsiao@google.com" <judyhsiao@google.com>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"Salazar, Ivan" <i-salazar@ti.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Chadha, Jasjot Singh" <j-chadha@ti.com>,
	"liam.r.girdwood@intel.com" <liam.r.girdwood@intel.com>,
	"bard.liao@intel.com" <bard.liao@intel.com>,
	"yung-chuan.liao@linux.intel.com"
	<yung-chuan.liao@linux.intel.com>, "Rao, Dipa" <dipa@ti.com>,
	"yuhsuan@google.com" <yuhsuan@google.com>,
	"tiwai@suse.de" <tiwai@suse.de>, "Xu, Baojun" <baojun.xu@ti.com>,
	"soyer@irl.hu" <soyer@irl.hu>,
	"Baojun.Xu@fpt.com" <Baojun.Xu@fpt.com>,
	"Navada Kanyana, Mukund" <navada@ti.com>,
	"cujomalainey@google.com" <cujomalainey@google.com>,
	"Kutty, Aanya" <aanya@ti.com>,
	"Mahmud, Nayeem" <nayeem.mahmud@ti.com>
Subject: RE: [EXTERNAL] Re: [PATCH v1] ASoc: tas2781: Add Calibration Kcontrols and tas2563 digtial gain for Chromebook
Date: Mon, 24 Jun 2024 11:42:11 +0000	[thread overview]
Message-ID: <6b6a0af1e55241c4b2acde42e9966e3b@ti.com> (raw)
In-Reply-To: <Zk3eq0k2Eq-gtejq@smile.fi.intel.com>

Hi Andy
Thanks for your comments. Following are my answers.

> -----Original Message-----
> From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Sent: Wednesday, May 22, 2024 8:02 PM
> To: Ding, Shenghao <shenghao-ding@ti.com>
> Cc: broonie@kernel.org; lgirdwood@gmail.com; perex@perex.cz; pierre-
> louis.bossart@linux.intel.com; 13916275206@139.com;
> judyhsiao@google.com; alsa-devel@alsa-project.org; Salazar, Ivan <i-
> salazar@ti.com>; linux-kernel@vger.kernel.org; Chadha, Jasjot Singh <j-
> chadha@ti.com>; liam.r.girdwood@intel.com; bard.liao@intel.com; yung-
> chuan.liao@linux.intel.com; Rao, Dipa <dipa@ti.com>; Lu, Kevin <kevin-
> lu@ti.com>; yuhsuan@google.com; tiwai@suse.de; Xu, Baojun
> <baojun.xu@ti.com>; soyer@irl.hu; Baojun.Xu@fpt.com; Navada Kanyana,
> Mukund <navada@ti.com>; cujomalainey@google.com; Kutty, Aanya
> <aanya@ti.com>; Mahmud, Nayeem <nayeem.mahmud@ti.com>
> Subject: [EXTERNAL] Re: [PATCH v1] ASoc: tas2781: Add Calibration Kcontrols
> and tas2563 digtial gain for Chromebook
> 
> On Wed, May 22, 2024 at 07: 29: 41PM +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 ZjQcmQRYFpfptBannerStart This message was sent from
> outside of Texas Instruments.
> Do not click links or open attachments unless you recognize the source of this
> email and know the content is safe. If you wish to report this message to IT
> Security, please forward the message as an attachment to
> phishing@list.ti.com
> 
........................
> > +	while (r > 1 + l) {
> > +		mid = (l + r) / 2;
> > +		ar_mid = get_unaligned_be32(tas2563_dvc_table[mid]);
> > +		if (target < ar_mid)
> > +			r = mid;
> > +		else
> > +			l = mid;
> > +	}
> 
> Hmm... I'm wondering if bsearch() can be utilised here.
Bsearch is to find out the value, in this function is to find out the member same as or closer to the input value.

> 
> ...
> 
> > +	ucontrol->value.integer.value[0] =
> > +		abs(target - ar_l) <= abs(target - ar_r) ? l : r;
> 
> I don't understand why do you need 'target' to be in this check.
> 
> ...
> 
> > +	uinfo->value.integer.max = (int)tas_priv->ndev - 1;
> 
> Why casting?
> 
> ...
> 
> > +	scnprintf(active_dev_name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
> 
> Why 'c' variant in use? You are ignoring the returned value. Isn't strscpy() you
> want or memtostr() (in both cases 2 parameters variant)?
> 
> > +		"Activate Tasdevice Id");
> 
> Same Q to all scnprintf() calls.
> 
> ...
> 
> > +	cali_data->data = devm_kzalloc(tas_priv->dev, tas_priv->ndev *
> > +		(cali_data->reg_array_sz * 4 + 1), GFP_KERNEL);
> 
> No way. First of all, we have kcalloc(), second, there is an overflow.h that has
> necessary macros to calculate sizes for memory allocations.
Memory allocated with devm_kzalloc is automatically freed on driver detach while kcalloc can’t
> 
> > +	if (!cali_data->data)
> > +		return -ENOMEM;
> 
> ...

BR
Shenghao Ding

  reply	other threads:[~2024-06-24 11:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22 11:29 [PATCH v1] ASoc: tas2781: Add Calibration Kcontrols and tas2563 digtial gain for Chromebook Shenghao Ding
2024-05-22 12:01 ` Andy Shevchenko
2024-06-24 11:42   ` Ding, Shenghao [this message]
2024-08-09 14:36     ` [EXTERNAL] " Andy Shevchenko
2024-05-22 13:40 ` Pierre-Louis Bossart
2024-05-22 22:30 ` kernel test robot
2024-05-23  0:34 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6b6a0af1e55241c4b2acde42e9966e3b@ti.com \
    --to=shenghao-ding@ti.com \
    --cc=13916275206@139.com \
    --cc=Baojun.Xu@fpt.com \
    --cc=aanya@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=baojun.xu@ti.com \
    --cc=bard.liao@intel.com \
    --cc=broonie@kernel.org \
    --cc=cujomalainey@google.com \
    --cc=dipa@ti.com \
    --cc=i-salazar@ti.com \
    --cc=j-chadha@ti.com \
    --cc=judyhsiao@google.com \
    --cc=lgirdwood@gmail.com \
    --cc=liam.r.girdwood@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=navada@ti.com \
    --cc=nayeem.mahmud@ti.com \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=soyer@irl.hu \
    --cc=tiwai@suse.de \
    --cc=yuhsuan@google.com \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox