Add retry mechanism for volume write (#3121)

This commit is contained in:
qwer123
2026-04-10 14:33:48 +08:00
committed by GitHub
parent ef2ae9874b
commit fc18992442
6 changed files with 34 additions and 26 deletions
+7 -6
View File
@@ -306,21 +306,22 @@ class WM8731 : public audio::Codec {
});
}
void set_wm_headphone_volume(const volume_t volume) {
bool set_wm_headphone_volume(const volume_t volume) {
const auto normalized = headphone_gain_range().normalize(volume);
auto n = normalized.centibel() / 10;
write(LeftHeadphoneOut{
bool tag = write(LeftHeadphoneOut{
.lhpvol = static_cast<reg_t>(n),
.lzcen = 0,
.lrhpboth = 1,
.reserved0 = 0,
});
return tag;
}
void set_headphone_volume(const volume_t volume) override {
bool set_headphone_volume(const volume_t volume) override {
headphone_volume = volume;
set_wm_headphone_volume(volume);
return set_wm_headphone_volume(volume);
}
volume_range_t headphone_gain_range() const override {
@@ -422,8 +423,8 @@ class WM8731 : public audio::Codec {
void write(const LeftLineIn value);
void write(const RightLineIn value);
void write(const LeftHeadphoneOut value);
void write(const RightHeadphoneOut value);
bool write(const LeftHeadphoneOut value);
bool write(const RightHeadphoneOut value);
void write(const AnalogAudioPathControl value);
void write(const DigitalAudioPathControl value);
void write(const PowerDownControl value);