~aleteoryx/muditaos

dd8a06928977803354dee1583e34e59a79daa63c — Szymon Mroczek 5 years ago 8d9719e
[EGD-4389] Microphone bias activation quick fix (#1012)

[EGD-4389] Microphone bias activation quick fix.
2 files changed, 17 insertions(+), 5 deletions(-)

M changelog.md
M module-bsp/board/rt1051/bsp/headset/headset.cpp
M changelog.md => changelog.md +1 -0
@@ 25,6 25,7 @@
* `[Text]` Fixed newline handling.
* `[appmgr]` Fixed applications closing.
* `[audio]` Fixed crash on attempt to open non-existent file
* `[audio]` Fixed handling of headset microphone LDO DCDC.

## [0.45.1 2020-11-06]


M module-bsp/board/rt1051/bsp/headset/headset.cpp => module-bsp/board/rt1051/bsp/headset/headset.cpp +16 -5
@@ 33,7 33,7 @@ namespace bsp
        static constexpr uint8_t HEADSET_DEV_SET_DET_EN = 1 << 5;
        static constexpr uint8_t HEADSET_DEV_SET_DEB_1S = 0x06;

        static constexpr uint16_t HEADSET_POLL_INTERVAL_MS = 2500;
        static constexpr uint16_t HEADSET_POLL_INTERVAL_MS = 500;

        static std::shared_ptr<drivers::DriverI2C> i2c;
        static std::shared_ptr<drivers::DriverGPIO> gpio;


@@ 42,6 42,7 @@ namespace bsp

        static xQueueHandle qHandleIrq = nullptr;
        static bool HeadsetInserted    = false;
        static bool MicrophoneInserted = false;

        static bool ReadInsertionStatus()
        {


@@ 56,6 57,7 @@ namespace bsp

            if (((reg & 0x08) == 0) && (HeadsetInserted == true)) {
                HeadsetInserted = false;
                MicrophoneInserted = false;
                LOG_INFO("Headset removed");
                gpio->WritePin(static_cast<uint32_t>(BoardDefinitions::MIC_BIAS_DRIVER_EN), 0);



@@ 63,24 65,31 @@ namespace bsp
            }

            if (((reg & 0x08) != 0) && (HeadsetInserted == false)) {
                HeadsetInserted = true;
                LOG_INFO("Headset inserted");
                HeadsetInserted = true;

                if ((reg & 0x01) != 0) {
                    LOG_INFO("Headset 3-pole detected");
                    gpio->WritePin(static_cast<uint32_t>(BoardDefinitions::MIC_BIAS_DRIVER_EN), 0);
                    MicrophoneInserted = false;
                }
                if ((reg & 0x02) != 0) {
                    LOG_INFO("Headset 4-pole OMTP detected");
                    gpio->WritePin(static_cast<uint32_t>(BoardDefinitions::MIC_BIAS_DRIVER_EN), 1);
                    MicrophoneInserted = true;
                }
                if ((reg & 0x04) != 0) {
                    LOG_INFO("Headset 4-pole Standard detected");
                    gpio->WritePin(static_cast<uint32_t>(BoardDefinitions::MIC_BIAS_DRIVER_EN), 1);
                    MicrophoneInserted = true;
                }
                ret = true;
            }

            if (MicrophoneInserted == true) {
                gpio->WritePin(static_cast<uint32_t>(BoardDefinitions::MIC_BIAS_DRIVER_EN), 1);
            }
            else {
                gpio->WritePin(static_cast<uint32_t>(BoardDefinitions::MIC_BIAS_DRIVER_EN), 0);
            }

            return ret;
        }



@@ 109,6 118,7 @@ namespace bsp
            qHandleIrq = qHandle;

            HeadsetInserted = false;
            MicrophoneInserted = false;

            gpio->WritePin(static_cast<uint32_t>(BoardDefinitions::MIC_BIAS_DRIVER_EN), 0);



@@ 153,6 163,7 @@ namespace bsp
        {
            qHandleIrq      = nullptr;
            HeadsetInserted = false;
            MicrophoneInserted = false;

            i2c.reset();