@@ -479,7 +479,7 @@ static int tas2781_save_calibration(struct tasdevice_priv *tas_priv)
479479 dev_dbg (tas_priv -> dev , "%4ld-%2d-%2d, %2d:%2d:%2d\n" ,
480480 tm -> tm_year , tm -> tm_mon , tm -> tm_mday ,
481481 tm -> tm_hour , tm -> tm_min , tm -> tm_sec );
482- tas2781_apply_calib (tas_priv );
482+ tasdevice_apply_calibration (tas_priv );
483483 } else
484484 tas_priv -> cali_data .total_sz = 0 ;
485485
@@ -582,7 +582,7 @@ static void tasdev_fw_ready(const struct firmware *fmw, void *context)
582582 /* If calibrated data occurs error, dsp will still works with default
583583 * calibrated data inside algo.
584584 */
585- tas2781_save_calibration (tas_priv );
585+ tasdevice_save_calibration (tas_priv );
586586
587587 tasdevice_tuning_switch (tas_hda -> priv , 0 );
588588
@@ -685,10 +685,6 @@ static int tas2781_hda_i2c_probe(struct i2c_client *clt)
685685 const char * device_name ;
686686 int ret ;
687687
688- if (strstr (dev_name (& clt -> dev ), "TIAS2781" ))
689- device_name = "TIAS2781" ;
690- else
691- return - ENODEV ;
692688
693689 tas_hda = devm_kzalloc (& clt -> dev , sizeof (* tas_hda ), GFP_KERNEL );
694690 if (!tas_hda )
@@ -701,6 +697,13 @@ static int tas2781_hda_i2c_probe(struct i2c_client *clt)
701697 if (!tas_hda -> priv )
702698 return - ENOMEM ;
703699
700+ if (strstr (dev_name (& clt -> dev ), "TIAS2781" )) {
701+ device_name = "TIAS2781" ;
702+ tas_hda -> priv -> save_calibration = tas2781_save_calibration ;
703+ tas_hda -> priv -> apply_calibration = tas2781_apply_calib ;
704+ } else
705+ return - ENODEV ;
706+
704707 tas_hda -> priv -> irq_info .irq = clt -> irq ;
705708 ret = tas2781_read_acpi (tas_hda -> priv , device_name );
706709 if (ret )
@@ -767,8 +770,6 @@ static int tas2781_runtime_suspend(struct device *dev)
767770static int tas2781_runtime_resume (struct device * dev )
768771{
769772 struct tas2781_hda * tas_hda = dev_get_drvdata (dev );
770- unsigned long calib_data_sz =
771- tas_hda -> priv -> ndev * TASDEVICE_SPEAKER_CALIBRATION_SIZE ;
772773
773774 dev_dbg (tas_hda -> dev , "Runtime Resume\n" );
774775
@@ -779,8 +780,7 @@ static int tas2781_runtime_resume(struct device *dev)
779780 /* If calibrated data occurs error, dsp will still works with default
780781 * calibrated data inside algo.
781782 */
782- if (tas_hda -> priv -> cali_data .total_sz > calib_data_sz )
783- tas2781_apply_calib (tas_hda -> priv );
783+ tasdevice_apply_calibration (tas_hda -> priv );
784784
785785 mutex_unlock (& tas_hda -> priv -> codec_lock );
786786
@@ -811,8 +811,6 @@ static int tas2781_system_suspend(struct device *dev)
811811static int tas2781_system_resume (struct device * dev )
812812{
813813 struct tas2781_hda * tas_hda = dev_get_drvdata (dev );
814- unsigned long calib_data_sz =
815- tas_hda -> priv -> ndev * TASDEVICE_SPEAKER_CALIBRATION_SIZE ;
816814 int i , ret ;
817815
818816 dev_info (tas_hda -> priv -> dev , "System Resume\n" );
@@ -834,8 +832,7 @@ static int tas2781_system_resume(struct device *dev)
834832 /* If calibrated data occurs error, dsp will still work with default
835833 * calibrated data inside algo.
836834 */
837- if (tas_hda -> priv -> cali_data .total_sz > calib_data_sz )
838- tas2781_apply_calib (tas_hda -> priv );
835+ tasdevice_apply_calibration (tas_hda -> priv );
839836 mutex_unlock (& tas_hda -> priv -> codec_lock );
840837
841838 return 0 ;
0 commit comments