themactep / thingino-firmware

Open-source firmware for Ingenic SoC IP cameras
https://thingino.com
MIT License
79 stars 28 forks source link

gpio_speaker needs active high/low configuration #113

Closed jayfan0 closed 1 month ago

jayfan0 commented 1 month ago

current env variable gpio_speaker seems to either be disabled or active high with the audio module.

current /etc/modules.d/audio is

audio spk_gpio=$(fw_printenv -n gpio_speaker || echo -1)

need to add logic with either o or O with the gpio-speaker definition to make the parameter as follows:

audio spk_gpio=$(fw_printenv -n gpio_speaker || echo -1) spk_level=0

where:

-1 = disabled
0 = active low
1 = active high
gtxaspec commented 1 month ago

fixed in https://github.com/themactep/thingino-firmware/commit/35ad8bf0bbccbada43a75666bebecbb1e0829f08 if you can @jayfan0, pull the latest changes, and run a clean make and see if its working for you.

jayfan0 commented 1 month ago

Thank you for this.

I can confirm that it works.

Both functionally and electrically (with a meter on the amplifier enable pin) for my camera, pin 63 is correctly set on kernel boot:

gpio_speaker 63 = amplifier is set high (3.3v) gpio_speaker 63O = amplifier is set high (3.3v) gpio_speaker 63o = amplifier is set low (0v)

jayfan0 commented 1 month ago

update:

Not defining any pin in gpio_speaker does not automatically set to -1. Defaults to 63 active high which locks that pin

manually setting to -1 does unlock the pin

If this is a universal audio driver default, what should the default be when not explicitly defining the pin? -1 or 63 ?

gtxaspec commented 1 month ago

fixed in https://github.com/themactep/thingino-firmware/commit/d805d5495dcea30e2d784d35c7b535eae40b631b

default is set to -1 if no gpio is specified in ENV

jayfan0 commented 1 month ago

tested and works fine. thank you

gpio_speaker 63 = amplifier is set high (3.3v) gpio_speaker 63O = amplifier is set high (3.3v) gpio_speaker 63o = amplifier is set low (0v) gpio_speaker = gpio 63 is free to manually toggle