340953b1f6
- Add input-gain-percent property (0..2000, default 100) to everest,es8311 binding - Extend Es8311Config with input_gain_percent, Es8311Data with input_gain float - Implement get_input_gain_multiplier() so audio-stream can apply digital boost on top of HW gain - Change HW gain mapping 100% -> 42dB (was 24dB) to restore +30dB behavior remembered from pre audio-stream driver (ES8311 supports 0/6/12/18/24/30/36/42 per vendor) - Validate percent <=2000 in start_device() - Set ES3C28P (2.8" color) and ES3C35P (3.5" color) DTS to input-gain-percent = <100> (no extra digital, pure HW 42dB max, software volume can lower) - Fixes quiet mic even at 100% and allows tunable digital boost via devicetree for boards with quiet MEMS capsules
41 lines
1.2 KiB
C
41 lines
1.2 KiB
C
// SPDX-License-Identifier: Apache-2.0
|
|
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include <tactility/error.h>
|
|
#include <tactility/drivers/audio_codec.h>
|
|
|
|
struct Device;
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* @brief ES8311 codec device configuration.
|
|
*
|
|
* The ES8311 is wired as both control (I2C) and audio (I2S) device: the I2C
|
|
* bus is the device's parent (per i2c-device.yaml), while the I2S controller
|
|
* is referenced via a devicetree phandle. It operates in dual mode
|
|
* (speaker output + mic input) on boards such as M5Stack StickS3.
|
|
*/
|
|
struct Es8311Config {
|
|
/** I2C address on the bus (typically 0x18) */
|
|
uint8_t address;
|
|
/** I2S controller device that carries audio data */
|
|
struct Device* i2s_device;
|
|
/**
|
|
* Extra fixed digital gain multiplier applied by audio_stream on top of the ES8311's
|
|
* own hardware ADC gain (0..24dB), as an integer percentage (100 = 1.0x / no extra boost).
|
|
* Small MEMS mic capsules can still sound quiet even near max hardware gain; this is for
|
|
* boards where 24dB hardware gain alone isn't enough. devicetree has no float property type,
|
|
* hence the x100 integer encoding.
|
|
*/
|
|
uint16_t input_gain_percent;
|
|
};
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|