mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Shenghao Ding <shenghao-ding@ti.com>
Cc: <broonie@kernel.org>, <andriy.shevchenko@linux.intel.com>,
	<lgirdwood@gmail.com>, <perex@perex.cz>,
	<pierre-louis.bossart@linux.intel.com>, <13564923607@139.com>,
	<alsa-devel@alsa-project.org>, <linux-kernel@vger.kernel.org>,
	<liam.r.girdwood@intel.com>, <cameron.berkenpas@gmail.com>,
	<baojun.xu@ti.com>, <soyer@irl.hu>, <Baojun.Xu@fpt.com>,
	<robinchen@ti.com>
Subject: Re: [PATCH v1] ALSA: ASoC/tas2781: fix wrong calibrated data order
Date: Wed, 07 Aug 2024 11:30:53 +0200	[thread overview]
Message-ID: <87r0b07k8i.wl-tiwai@suse.de> (raw)
In-Reply-To: <20240807075541.1458-1-shenghao-ding@ti.com>

On Wed, 07 Aug 2024 09:55:40 +0200,
Shenghao Ding wrote:
> 
> From: Baojun Xu <baojun.xu@ti.com>
> 
> Wrong calibration data order cause sound too low in some device.
> Fix wrong calibrated data order, add calibration data converssion
> by get_unaligned_be32() after reading from UEFI.
> 
> Fixes: 5be27f1e3ec9 ("ALSA: hda/tas2781: Add tas2781 HDA driver")
> Signed-off-by: Baojun Xu <baojun.xu@ti.com>
> 
> ---
> v1:
>  - Change copyright date, and add new maintainer.
>  - Add unaligned.h included for get_unaligned_be32().
>  - In tas2781_apply_calib(), change data address transfer directly to
>    get data by get_unaligned_be32(), and send address to device.
> ---
>  sound/pci/hda/tas2781_hda_i2c.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/sound/pci/hda/tas2781_hda_i2c.c b/sound/pci/hda/tas2781_hda_i2c.c
> index 49bd7097d..4dc3350d5 100644
> --- a/sound/pci/hda/tas2781_hda_i2c.c
> +++ b/sound/pci/hda/tas2781_hda_i2c.c
> @@ -2,10 +2,12 @@
>  //
>  // TAS2781 HDA I2C driver
>  //
> -// Copyright 2023 Texas Instruments, Inc.
> +// Copyright 2023 - 2024 Texas Instruments, Inc.
>  //
>  // Author: Shenghao Ding <shenghao-ding@ti.com>
> +// Current maintainer: Baojun Xu <baojun.xu@ti.com>
>  
> +#include <asm/unaligned.h>
>  #include <linux/acpi.h>
>  #include <linux/crc8.h>
>  #include <linux/crc32.h>
> @@ -519,20 +521,21 @@ static void tas2781_apply_calib(struct tasdevice_priv *tas_priv)
>  	static const unsigned char rgno_array[CALIB_MAX] = {
>  		0x74, 0x0c, 0x14, 0x70, 0x7c,
>  	};
> -	unsigned char *data;
> -	int i, j, rc;
> +	int i, j, rc, data;
> +	int offset = 0;

data should be __be32 type, to be more explicit.


Takashi

>  
>  	for (i = 0; i < tas_priv->ndev; i++) {
> -		data = tas_priv->cali_data.data +
> -			i * TASDEVICE_SPEAKER_CALIBRATION_SIZE;
>  		for (j = 0; j < CALIB_MAX; j++) {
> +			data = get_unaligned_be32(
> +				&tas_priv->cali_data.data[offset]);
>  			rc = tasdevice_dev_bulk_write(tas_priv, i,
>  				TASDEVICE_REG(0, page_array[j], rgno_array[j]),
> -				&(data[4 * j]), 4);
> +				(unsigned char *)&data, 4);
>  			if (rc < 0)
>  				dev_err(tas_priv->dev,
>  					"chn %d calib %d bulk_wr err = %d\n",
>  					i, j, rc);
> +			offset += 4;
>  		}
>  	}
>  }
> -- 
> 2.40.1
> 

      reply	other threads:[~2024-08-07  9:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-07  7:55 Shenghao Ding
2024-08-07  9:30 ` Takashi Iwai [this message]

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=87r0b07k8i.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=13564923607@139.com \
    --cc=Baojun.Xu@fpt.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=baojun.xu@ti.com \
    --cc=broonie@kernel.org \
    --cc=cameron.berkenpas@gmail.com \
    --cc=lgirdwood@gmail.com \
    --cc=liam.r.girdwood@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=robinchen@ti.com \
    --cc=shenghao-ding@ti.com \
    --cc=soyer@irl.hu \
    /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

all inboxes | Powered by JetHome®