Skip to content

[SDW][RT711] calibration timed out #2611

Closed

Description

@plbossart

During kmod load/unload tests (Intel test 1025), we see this error

[ 1998.004550] rt711 sdw:0:25d:711:0: [rt711_sdw_read] 7558 85d8 9c58 acd8 => 0000f888
[ 1998.004563] rt711_calibration, calibration time-out!
[ 1998.004912] rt711 sdw:0:25d:711:0: [rt711_sdw_write] 7520 85a0 7420 84a0 <= 006f 0583
[ 1998.005015] rt711 sdw:0:25d:711:0: [rt711_sdw_write] 3501 <= 0003
[ 1998.005024] rt711 sdw:0:25d:711:0: rt711_calibration calibration complete, ret=-110

rt711-calibration-dmesg.txt

Opens:
a) is this really an error? the status of rt711_calibration() is not tested by anyone
b) is this really good to use the same function directly and with a workqueue? This code seems suspicious:

	if (rt711->first_hw_init)
		rt711_calibration(rt711);
	else {
		INIT_DELAYED_WORK(&rt711->jack_detect_work,
			rt711_jack_detect_handler);
		INIT_DELAYED_WORK(&rt711->jack_btn_check_work,
			rt711_btn_check_handler);
		mutex_init(&rt711->calibrate_mutex);
		INIT_WORK(&rt711->calibration_work, rt711_calibration_work);
		schedule_work(&rt711->calibration_work);
	}

On init we use a work queue but later we call the function directly?
Should we always rely on schedule_work(), so that during remove/suspend we wait for the calibration to be finished? If the calibration is handled directly it's not clear what happens?

Activity

  1. plbossart commented on Dec 8, 2020

    @plbossart
    MemberAuthor
  2. bardliao commented on Dec 9, 2020

    @bardliao
    Collaborator

    I see below in the dmesg.

    [ 1993.074141] rt711 sdw:0:25d:711:0: [rt711_sdw_read] 7558 85d8 9c58 acd8 => 0000f888
    [ 1993.074974] rt711 sdw:0:25d:711:0: [rt711_sdw_read] b921 0000 => 80000000
    [ 1993.075474] rt711 sdw:0:25d:711:0: [rt711_sdw_read] 7520 85a0 9c20 aca0 => 00000800
    [ 1993.076120] rt711 sdw:0:25d:711:0: [rt711_sdw_read] 7520 85a0 9c20 aca0 => 00000030
    [ 1993.076123] rt711 sdw:0:25d:711:0: in rt711_jack_detect_handler, jack_type=0x3
    [ 1993.076125] rt711 sdw:0:25d:711:0: in rt711_jack_detect_handler, btn_type=0x0
    [ 1993.085664] rt711 sdw:0:25d:711:0: [rt711_sdw_read] 7558 85d8 9c58 acd8 => 0000f888
    

    Do we need to use mutex here?

  3. shumingfan commented on Dec 9, 2020

    @shumingfan

    @plbossart @bardliao I just want to save time for system boot, so I use the schedule_work() for the first time.
    If the driver re-do the io_init after the system resumes, I want to make sure the calibration is done before the playback/capture operations.

    I think this issue could be caused by the power state of the codec. The power state was changed to D3 in the put function of kcontrol.
    Could you test again with the following patch?

    @@ -544,9 +544,11 @@ static int rt711_set_amp_gain_put(struct snd_kcontrol *kcontrol,
                            break;
            }
    
    +       mutex_lock(&rt711->calibrate_mutex);
            if (dapm->bias_level <= SND_SOC_BIAS_STANDBY)
                    regmap_write(rt711->regmap,
                                    RT711_SET_AUDIO_POWER_STATE, AC_PWRST_D3);
    +       mutex_unlock(&rt711->calibrate_mutex);
            return 0;
     }
    
  4. added
    bugSomething isn't working
    CMLApplies to Comet Lake platform
    SDWApplies to SoundWire bus for codec connection
    codecCodec HW or driver restriction
    on Dec 11, 2020
  5. plbossart commented on Dec 11, 2020

    @plbossart
    MemberAuthor
  6. mengdonglin commented on Dec 14, 2020

    @mengdonglin

    @plbossart @bardliao Can we close this issue as #2626 got merged?

  7. bardliao commented on Dec 14, 2020

    @bardliao
    Collaborator

    @plbossart @bardliao Can we close this issue as #2626 got merged?

    Let's check the test result for few more days. We can close the issue if we don't see it in our daily test.

  8. bardliao commented on Dec 17, 2020

    @bardliao
    Collaborator

    Not reproduce in recent test report.

  9. shumingfan commented on Dec 21, 2020

    @shumingfan

    Not reproduce in recent test report.

    The patch was merged to the for-next branch.
    https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/commit/?id=6108f990c0887d3e8f1db2d13c7012e40a061f28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

CMLApplies to Comet Lake platformP1Blocker bugs or important featuresSDWApplies to SoundWire bus for codec connectionbugSomething isn't workingcodecCodec HW or driver restrictionfix submittedFix submitted but not merged yet

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions