I managed to use Alsa API so I can read the microphone. My codes runs without any issue now and I read values but not sure if they are correct.
I set up the mic setting at it as instructed here
but when I run the command uname - a, I get
Linux raspberrypi 6.1.29 -v8+ SMP PREEMPT Wed May 24 14:46 BS 2023 aarch64 GNU/Linux
Not what I expect.
# arecord -l **** List of CAPTURE Hardware Devices **** card 2: sndrpihifiberry [snd_rpi_hifiberry_dacplusadc], device 0: HiFiBerry DAC+ADC HiFi multicodec-0  Subdevices: 1/1 Subdevice #0: subdevice #0
I read the same value with or without a mic connected via jack.
Any idea why I cant read the actual input from the mic. I doubt anything is wrong with my codes.