techpack: audio: tfa98xx: add error translation routine
Clang warns:
./techpack/audio/asoc/codecs/tfa98xx/tfa_dsp.c:3055:9: warning: implicit conversion
from enumeration type 'enum Tfa98xx_Error' to different enumeration type
'enum tfa_error' [-Wenum-conversion]
return err;
~~~~~~ ^~~
./techpack/audio/asoc/codecs/tfa98xx/tfa_dsp.c:3090:9: warning: implicit conversion
from enumeration type 'enum Tfa98xx_Error' to different enumeration type
'enum tfa_error' [-Wenum-conversion]
return err;
~~~~~~ ^~~
./techpack/audio/asoc/codecs/tfa98xx/tfa_dsp.c:3142:9: warning: implicit conversion
from enumeration type 'enum Tfa98xx_Error' to different enumeration type
'enum tfa_error' [-Wenum-conversion]
return err;
~~~~~~ ^~~
Change-Id: I4d1d428f0306bbe6bb25d8beab8a74307aaeadf7
diff --git a/techpack/audio/asoc/codecs/tfa98xx/tfa_dsp.c b/techpack/audio/asoc/codecs/tfa98xx/tfa_dsp.c
index e44fe46..dc578f8 100644
--- a/techpack/audio/asoc/codecs/tfa98xx/tfa_dsp.c
+++ b/techpack/audio/asoc/codecs/tfa98xx/tfa_dsp.c
@@ -2909,6 +2909,24 @@ enum Tfa98xx_Error tfaRunWaitCalibration(Tfa98xx_handle_t handle, int *calibrate
return err;
}
+enum tfa_error tfa98xxTotfa(enum Tfa98xx_Error err)
+{
+ switch(err) {
+ case Tfa98xx_Error_Ok:
+ return tfa_error_ok;
+ case Tfa98xx_Error_Device:
+ return tfa_error_device;
+ case Tfa98xx_Error_Bad_Parameter:
+ return tfa_error_bad_param;
+ case Tfa98xx_Error_NoClock:
+ return tfa_error_noclock;
+ case Tfa98xx_Error_StateTimedOut:
+ return tfa_error_timeout;
+ default:
+ return tfa_error_bad_param;
+ }
+}
+
enum tfa_error tfa_start(int next_profile, int *vstep)
{
enum Tfa98xx_Error err = Tfa98xx_Error_Ok;
@@ -3052,7 +3070,7 @@ enum tfa_error tfa_start(int next_profile, int *vstep)
tfaContClose(dev); /* close all of them */
}
- return err;
+ return tfa98xxTotfa(err);
}
enum tfa_error tfa_stop(void)
@@ -3087,7 +3105,7 @@ enum tfa_error tfa_stop(void)
error_exit:
for( dev=0; dev < devcount; dev++)
tfaContClose(dev); /* close all of them */
- return err;
+ return tfa98xxTotfa(err);
}
/*
@@ -3139,7 +3157,7 @@ enum tfa_error tfa_reset(void)
tfaContClose(dev);
}
- return err;
+ return tfa98xxTotfa(err);
}
/*