Skip to content

Commit

Permalink
sound_card_init: Remove workaround for applying TAS2563 Calibration Data
Browse files Browse the repository at this point in the history
The data length portion for TAS2563 Calibration Data is now not
automatically changed. Remove the workaround where we add a buffer byte
and just apply the data length byte to the calibration data instead.

BUG=b:345629513
TEST=`amixer -c 0 contents` and check that the Speaker Calibrated Data
is applied correctly

Change-Id: I5618d03d739d4903bb01ea7355422c8f43f7ca4f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/5939020
Auto-Submit: Baili Deng <[email protected]>
Tested-by: Baili Deng <[email protected]>
Reviewed-by: Judy Hsiao <[email protected]>
Tested-by: [email protected] <[email protected]>
Commit-Queue: Baili Deng <[email protected]>
  • Loading branch information
baili0411 authored and Chromeos LUCI committed Oct 22, 2024
1 parent 220d144 commit 76b09f1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions sound_card_init/amp/src/tas2563/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ impl Amp for TAS2563 {
impl TAS2563 {
const TEMP_UPPER_LIMIT_CELSIUS: f32 = 40.0;
const TEMP_LOWER_LIMIT_CELSIUS: f32 = 0.0;
const CALIB_DATA_LEN_2_CH: usize = 59;
const CALIB_DATA_LEN_4_CH: usize = 101;

/// Creates an `TAS2563`.
/// # Arguments
///
Expand All @@ -308,6 +311,13 @@ impl TAS2563 {
/// Applies the calibration value to the amp.
fn apply_calibration_value(&mut self, calib: &[TAS2563CalibData]) -> Result<()> {
let mut values: Vec<u8> = Vec::new();
if calib.len() == 2 {
values.push(Self::CALIB_DATA_LEN_2_CH as u8);
} else if calib.len() == 4 {
values.push(Self::CALIB_DATA_LEN_4_CH as u8);
} else {
return Err(Error::InvalidChannelNumber(calib.len().try_into().unwrap()).into());
}
for (
ch,
&TAS2563CalibData {
Expand All @@ -330,8 +340,6 @@ impl TAS2563 {
values.extend(rms_pow.to_be_bytes());
values.extend(tlimit.to_be_bytes());
}
// Add the extra byte for fitting the total length of the data.
values.push(0 as u8);

if calib.len() == 2 {
self.card
Expand Down

0 comments on commit 76b09f1

Please sign in to comment.