All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ALSA: hda: tas2781: fix tas2563 EFI data endianness
@ 2025-08-29 16:04 Gergo Koteles
  2025-08-29 16:04 ` [PATCH 2/2] ALSA: hda: tas2781: reorder tas2563 calibration variables Gergo Koteles
  2025-08-30  7:42 ` [PATCH 1/2] ALSA: hda: tas2781: fix tas2563 EFI data endianness Takashi Iwai
  0 siblings, 2 replies; 3+ messages in thread
From: Gergo Koteles @ 2025-08-29 16:04 UTC (permalink / raw)
  To: Shenghao Ding, Kevin Lu, Baojun Xu, Jaroslav Kysela, Takashi Iwai
  Cc: linux-sound, linux-kernel, alsa-devel, Gergo Koteles, stable

Before conversion to unify the calibration data management, the
tas2563_apply_calib() function performed the big endian conversion and
wrote the calibration data to the device. The writing is now done by the
common tasdev_load_calibrated_data() function, but without conversion.

Put the values into the calibration data buffer with the expected
endianness.

Fixes: 4fe238513407 ("ALSA: hda/tas2781: Move and unified the calibrated-data getting function for SPI and I2C into the tas2781_hda lib")
Cc: <stable@vger.kernel.org>
Signed-off-by: Gergo Koteles <soyer@irl.hu>
---
 sound/hda/codecs/side-codecs/tas2781_hda_i2c.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c b/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c
index e34b17f0c9b9..1eac751ab2a6 100644
--- a/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c
+++ b/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c
@@ -310,6 +310,7 @@ static int tas2563_save_calibration(struct tas2781_hda *h)
 	struct cali_reg *r = &cd->cali_reg_array;
 	unsigned int offset = 0;
 	unsigned char *data;
+	__be32 bedata;
 	efi_status_t status;
 	unsigned int attr;
 	int ret, i, j, k;
@@ -351,6 +352,8 @@ static int tas2563_save_calibration(struct tas2781_hda *h)
 					i, j, status);
 				return -EINVAL;
 			}
+			bedata = cpu_to_be32(*(uint32_t *)&data[offset]);
+			memcpy(&data[offset], &bedata, sizeof(bedata));
 			offset += TAS2563_CAL_DATA_SIZE;
 		}
 	}
-- 
2.51.0


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

* [PATCH 2/2] ALSA: hda: tas2781: reorder tas2563 calibration variables
  2025-08-29 16:04 [PATCH 1/2] ALSA: hda: tas2781: fix tas2563 EFI data endianness Gergo Koteles
@ 2025-08-29 16:04 ` Gergo Koteles
  2025-08-30  7:42 ` [PATCH 1/2] ALSA: hda: tas2781: fix tas2563 EFI data endianness Takashi Iwai
  1 sibling, 0 replies; 3+ messages in thread
From: Gergo Koteles @ 2025-08-29 16:04 UTC (permalink / raw)
  To: Shenghao Ding, Kevin Lu, Baojun Xu, Jaroslav Kysela, Takashi Iwai
  Cc: linux-sound, linux-kernel, alsa-devel, Gergo Koteles, stable

The tasdev_load_calibrated_data() function expects the calibration data
values in the cali_data buffer as R0, R0Low, InvR0, Power, TLim which
is not the same as what tas2563_save_calibration() writes to the buffer.

Reorder the EFI variables in the tas2563_save_calibration() function
to put the values in the buffer in the correct order.

Fixes: 4fe238513407 ("ALSA: hda/tas2781: Move and unified the calibrated-data getting function for SPI and I2C into the tas2781_hda lib")
Cc: <stable@vger.kernel.org>
Signed-off-by: Gergo Koteles <soyer@irl.hu>
---
 sound/hda/codecs/side-codecs/tas2781_hda_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c b/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c
index 1eac751ab2a6..83eb19bb9bce 100644
--- a/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c
+++ b/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c
@@ -300,7 +300,7 @@ static int tas2563_save_calibration(struct tas2781_hda *h)
 {
 	efi_guid_t efi_guid = tasdev_fct_efi_guid[LENOVO];
 	char *vars[TASDEV_CALIB_N] = {
-		"R0_%d", "InvR0_%d", "R0_Low_%d", "Power_%d", "TLim_%d"
+		"R0_%d", "R0_Low_%d", "InvR0_%d", "Power_%d", "TLim_%d"
 	};
 	efi_char16_t efi_name[TAS2563_CAL_VAR_NAME_MAX];
 	unsigned long max_size = TAS2563_CAL_DATA_SIZE;
-- 
2.51.0


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

* Re: [PATCH 1/2] ALSA: hda: tas2781: fix tas2563 EFI data endianness
  2025-08-29 16:04 [PATCH 1/2] ALSA: hda: tas2781: fix tas2563 EFI data endianness Gergo Koteles
  2025-08-29 16:04 ` [PATCH 2/2] ALSA: hda: tas2781: reorder tas2563 calibration variables Gergo Koteles
@ 2025-08-30  7:42 ` Takashi Iwai
  1 sibling, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2025-08-30  7:42 UTC (permalink / raw)
  To: Gergo Koteles
  Cc: Shenghao Ding, Kevin Lu, Baojun Xu, Jaroslav Kysela, Takashi Iwai,
	linux-sound, linux-kernel, alsa-devel, stable

On Fri, 29 Aug 2025 18:04:49 +0200,
Gergo Koteles wrote:
> 
> Before conversion to unify the calibration data management, the
> tas2563_apply_calib() function performed the big endian conversion and
> wrote the calibration data to the device. The writing is now done by the
> common tasdev_load_calibrated_data() function, but without conversion.
> 
> Put the values into the calibration data buffer with the expected
> endianness.
> 
> Fixes: 4fe238513407 ("ALSA: hda/tas2781: Move and unified the calibrated-data getting function for SPI and I2C into the tas2781_hda lib")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Gergo Koteles <soyer@irl.hu>

Applied both patches now.


thanks,

Takashi

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

end of thread, other threads:[~2025-08-30  7:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-29 16:04 [PATCH 1/2] ALSA: hda: tas2781: fix tas2563 EFI data endianness Gergo Koteles
2025-08-29 16:04 ` [PATCH 2/2] ALSA: hda: tas2781: reorder tas2563 calibration variables Gergo Koteles
2025-08-30  7:42 ` [PATCH 1/2] ALSA: hda: tas2781: fix tas2563 EFI data endianness Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.