stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v4] ALSA: hda/tas2781: Fix the order of TAS2781 calibrated-data
       [not found] <20250907222728.988-1-shenghao-ding@ti.com>
@ 2025-10-02 19:26 ` Gergo Koteles
  2025-10-03  6:08   ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Gergo Koteles @ 2025-10-02 19:26 UTC (permalink / raw)
  To: Shenghao Ding, tiwai
  Cc: broonie, andriy.shevchenko, 13564923607, 13916275206, alsa-devel,
	linux-kernel, baojun.xu, Baojun.Xu, stable

Cc: <stable@vger.kernel.org>

On Mon, 2025-09-08 at 06:27 +0800, Shenghao Ding wrote:
> A bug reported by one of my customers that the order of TAS2781
> calibrated-data is incorrect, the correct way is to move R0_Low
> and insert it between R0 and InvR0.
> 
> Fixes: 4fe238513407 ("ALSA: hda/tas2781: Move and unified the calibrated-data getting function for SPI and I2C into the tas2781_hda lib")
> Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
> 
> ---
> v4:
>  - Add missing base into cali_cnv().
> v3:
>  - Take Tiwai's advice on cali_cnv() to make it more simpler.
> v2:
>  - Submit to the sound branch maintained by Tiwai instead of linux-next
>    branch
>  - Drop other fix
> ---
>  sound/hda/codecs/side-codecs/tas2781_hda.c | 25 +++++++++++++++++-----
>  1 file changed, 20 insertions(+), 5 deletions(-)
> 
> diff --git a/sound/hda/codecs/side-codecs/tas2781_hda.c b/sound/hda/codecs/side-codecs/tas2781_hda.c
> index f46d2e06c64f..536940c78f00 100644
> --- a/sound/hda/codecs/side-codecs/tas2781_hda.c
> +++ b/sound/hda/codecs/side-codecs/tas2781_hda.c
> @@ -33,6 +33,23 @@ const efi_guid_t tasdev_fct_efi_guid[] = {
>  };
>  EXPORT_SYMBOL_NS_GPL(tasdev_fct_efi_guid, "SND_HDA_SCODEC_TAS2781");
>  
> +/*
> + * The order of calibrated-data writing function is a bit different from the
> + * order in UEFI. Here is the conversion to match the order of calibrated-data
> + * writing function.
> + */
> +static void cali_cnv(unsigned char *data, unsigned int base, int offset)
> +{
> +	struct cali_reg reg_data;
> +
> +	memcpy(&reg_data, &data[base], sizeof(reg_data));
> +	/* the data order has to be swapped between r0_low_reg and inv0_reg */
> +	swap(reg_data.r0_low_reg, reg_data.invr0_reg);
> +
> +	cpu_to_be32_array((__force __be32 *)(data + offset + 1),
> +		(u32 *)&reg_data, TASDEV_CALIB_N);
> +}
> +
>  static void tas2781_apply_calib(struct tasdevice_priv *p)
>  {
>  	struct calidata *cali_data = &p->cali_data;
> @@ -103,8 +120,7 @@ static void tas2781_apply_calib(struct tasdevice_priv *p)
>  
>  				data[l] = k;
>  				oft++;
> -				for (i = 0; i < TASDEV_CALIB_N * 4; i++)
> -					data[l + i + 1] = data[4 * oft + i];
> +				cali_cnv(data, 4 * oft, l);
>  				k++;
>  			}
>  		}
> @@ -130,9 +146,8 @@ static void tas2781_apply_calib(struct tasdevice_priv *p)
>  
>  		for (j = p->ndev - 1; j >= 0; j--) {
>  			l = j * (cali_data->cali_dat_sz_per_dev + 1);
> -			for (i = TASDEV_CALIB_N * 4; i > 0 ; i--)
> -				data[l + i] = data[p->index * 5 + i];
> -			data[l+i] = j;
> +			cali_cnv(data, cali_data->cali_dat_sz_per_dev * j, l);
> +			data[l] = j;
>  		}
>  	}
>  

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v4] ALSA: hda/tas2781: Fix the order of TAS2781 calibrated-data
  2025-10-02 19:26 ` [PATCH v4] ALSA: hda/tas2781: Fix the order of TAS2781 calibrated-data Gergo Koteles
@ 2025-10-03  6:08   ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2025-10-03  6:08 UTC (permalink / raw)
  To: Gergo Koteles
  Cc: Shenghao Ding, tiwai, broonie, andriy.shevchenko, 13564923607,
	13916275206, alsa-devel, linux-kernel, baojun.xu, Baojun.Xu,
	stable

On Thu, Oct 02, 2025 at 09:26:06PM +0200, Gergo Koteles wrote:
> Cc: <stable@vger.kernel.org>

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-10-03  6:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20250907222728.988-1-shenghao-ding@ti.com>
2025-10-02 19:26 ` [PATCH v4] ALSA: hda/tas2781: Fix the order of TAS2781 calibrated-data Gergo Koteles
2025-10-03  6:08   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).