RE: [EXTERNAL] Re: [PATCH v1] ASoc: tas2781: Add Calibration Kcontrols and tas2563 digtial gain for Chromebook

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

> -----Original Message-----
> From: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> Sent: Wednesday, May 22, 2024 8:02 PM
> To: Ding, Shenghao <shenghao-ding@xxxxxx>
> Cc: broonie@xxxxxxxxxx; lgirdwood@xxxxxxxxx; perex@xxxxxxxx; pierre-
> louis.bossart@xxxxxxxxxxxxxxx; 13916275206@xxxxxxx;
> judyhsiao@xxxxxxxxxx; alsa-devel@xxxxxxxxxxxxxxxx; Salazar, Ivan <i-
> salazar@xxxxxx>; linux-kernel@xxxxxxxxxxxxxxx; Chadha, Jasjot Singh <j-
> chadha@xxxxxx>; liam.r.girdwood@xxxxxxxxx; bard.liao@xxxxxxxxx; yung-
> chuan.liao@xxxxxxxxxxxxxxx; Rao, Dipa <dipa@xxxxxx>; Lu, Kevin <kevin-
> lu@xxxxxx>; yuhsuan@xxxxxxxxxx; tiwai@xxxxxxx; Xu, Baojun
> <baojun.xu@xxxxxx>; soyer@xxxxxx; Baojun.Xu@xxxxxxx; Navada Kanyana,
> Mukund <navada@xxxxxx>; cujomalainey@xxxxxxxxxx; Kutty, Aanya
> <aanya@xxxxxx>; Mahmud, Nayeem <nayeem.mahmud@xxxxxx>
> 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@xxxxxxxxxxx
> 
........................
> > +	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




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux