Commit Graph

238 Commits

Author SHA1 Message Date
mks2183 f9386282dc driver/audio: low level reset must always succeed
- considering simplicity and design assumption, the reset function must work without flaw.
  If it fails, there is no way to recover but to reset again. so checking return status does not
  bring additional benefit

- There is unnecessary switch inside switch which is making code not too readable

Signed-off-by: mks2183 <manishsharma3134@gmail.com>
2023-07-18 10:14:24 -03:00
Manish Kumar Sharma 6a1abbcf56 driver/audio: remove unnecessary switch in switch
- There is unnecessary switch inside switch which is making code not too readable

Signed-off-by: Manish Kumar Sharma <manishsharma3134@gmail.com>
2023-07-16 16:40:34 +08:00
simbit18 1b1ac6f3b7 Fix nuttx coding style
Remove TABs
Fix indentation
Fix Multi-line comments
Fix Comments to the Right of Statements.

Fix nuttx coding style

Fix Comments to the Right of Statements.
2023-07-13 19:30:56 +08:00
chao an 6ee9ec7656 build: add initial cmake build system
1. Update all CMakeLists.txt to adapt to new layout
2. Fix cmake build break
3. Update all new file license
4. Fully compatible with current compilation environment(use configure.sh or cmake as you choose)

------------------

How to test

From within nuttx/. Configure:

cmake -B build -DBOARD_CONFIG=sim/nsh -GNinja
cmake -B build -DBOARD_CONFIG=sim:nsh -GNinja
cmake -B build -DBOARD_CONFIG=sabre-6quad/smp -GNinja
cmake -B build -DBOARD_CONFIG=lm3s6965-ek/qemu-flat -GNinja

(or full path in custom board) :
cmake -B build -DBOARD_CONFIG=$PWD/boards/sim/sim/sim/configs/nsh -GNinja

This uses ninja generator (install with sudo apt install ninja-build). To build:

$ cmake --build build

menuconfig:

$ cmake --build build -t menuconfig

--------------------------

2. cmake/build: reformat the cmake style by cmake-format

https://github.com/cheshirekow/cmake_format

$ pip install cmakelang

$ for i in `find -name CMakeLists.txt`;do cmake-format $i -o $i;done
$ for i in `find -name *\.cmake`;do cmake-format $i -o $i;done

Co-authored-by: Matias N <matias@protobits.dev>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-08 13:50:48 +08:00
Petro Karashchenko c70b7f6b3d nuttx: improve C89 compatibility in common code
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-05-19 02:40:38 +08:00
simbit18 e320299ba7 drivers/audio/Kconfig: Fix Kconfig style
Remove spaces from Kconfig files
Add TABs
2023-05-10 22:51:11 +08:00
Lucas Saavedra Vaz 8b9dc54a0a drivers/audio: Add support for the ES8311 codec
Adds support for the ES8311 audio codec by Everest Semiconductor on NuttX. Both output and input are supported.
2023-05-04 18:41:54 -03:00
Lucas Saavedra Vaz d82d73c660 audio: Separate common settings for the ESXXXX family of products
To avoid code duplication, the common settings for Everest Semiconductor's codecs were separated in an "esxxxx_common" header
2023-05-04 18:41:54 -03:00
Lucas Saavedra Vaz a5a3b919a0 audio: Add i2s_getmclkfrequency function
Rename i2s_mclkfrequency to i2s_setmclkfrequency and add i2s_getmclkfrequency for getting the current MCLK frequency from the I2S interface
2023-05-04 18:41:54 -03:00
ZhongAn 7eeba71366 audio: add audio_dma device driver.
Signed-off-by: ZhongAn <zhongan@pinecone.net>
2023-04-22 01:50:51 +08:00
SPRESENSE 20424a8a59 drivers/audio/cxd56.c: Fix freeze audio and add underrun notify
Fix freeze audio driver when it start 2nd time.
And add underrun notify to application as an event.
2023-04-17 10:24:48 +02:00
Lucas Saavedra Vaz 326261dd7d drivers/audio/es8388: Add input support 2023-03-21 12:13:59 -03:00
Xiang Xiao 2c5f653bfd Remove the tail spaces from all files except Documentation
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-26 13:24:24 -08:00
chao an 3a0fdb019d nuttx: replace all ARRAY_SIZE()/ARRAYSIZE() to nitems()
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-09 20:05:44 +08:00
Gustavo Henrique Nihei e6b204f438 nuttx: Use MIN/MAX definitions from "sys/param.h"
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-02-01 23:47:44 +08:00
Xiang Xiao 779a610ca3 Remove the unnecessary NULL fields in global instance definition of file_operations
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-04 00:32:13 +02:00
Xiang Xiao 6d30726a1b Remove the unnecessary "return;" at the end of function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-27 22:23:50 +01:00
Xiang Xiao 7bda8747b2 Fix Error: audio/wm8994.c:485:26: error: result of comparison of constant 65536 with expression of type 'uint16_t' (aka 'unsigned short') is always false
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-21 17:39:04 +08:00
Lucas Saavedra Vaz fa0ccce046 audio: Add support for the ES8388 codec (output) 2022-11-08 10:03:18 -03:00
Tiago Medicci Serrano e791d73bb2 drivers/audio/cs4344: fix configure function when setting mclk 2022-11-05 00:37:00 +08:00
Tiago Medicci Serrano 64abc72052 drivers/audio/cs4344: add txchannels method and fix supported data width 2022-11-05 00:37:00 +08:00
Xiang Xiao 04863785f1 Fix Error: audio/cs43l22.c:356:24: error: unused function 'cs43l22_scalevolume' [-Werror,-Wunused-function]
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-30 16:03:35 +01:00
Xiang Xiao 8405b7b4ff Fix Error: audio/cxd56.c:1945:20: error: implicit conversion from enumeration type 'enum cxd56_audio_volid_e' to different enumeration type 'enum cxd56_vol_id_e' [-Werror,-Wenum-conversion]
cxd56_set_volume(CXD56_AUDIO_VOLID_MIXER_OUT, dev->volume);
  ~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: audio/cxd56.c:2735:34: error: implicit conversion from enumeration type 'enum cxd56_audio_volid_e' to different enumeration type 'enum cxd56_vol_id_e' [-Werror,-Wenum-conversion]
                cxd56_set_volume(CXD56_AUDIO_VOLID_MIXER_OUT, priv->volume);
                ~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: audio/cxd56.c:2736:34: error: implicit conversion from enumeration type 'enum cxd56_audio_volid_e' to different enumeration type 'enum cxd56_vol_id_e' [-Werror,-Wenum-conversion]
                cxd56_set_volume(CXD56_AUDIO_VOLID_MIXER_IN1, 0);
                ~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: audio/cxd56.c:2737:34: error: implicit conversion from enumeration type 'enum cxd56_audio_volid_e' to different enumeration type 'enum cxd56_vol_id_e' [-Werror,-Wenum-conversion]
                cxd56_set_volume(CXD56_AUDIO_VOLID_MIXER_IN2, 0);
                ~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: audio/cxd56.c:2755:34: error: implicit conversion from enumeration type 'enum cxd56_audio_volid_e' to different enumeration type 'enum cxd56_vol_id_e' [-Werror,-Wenum-conversion]
                cxd56_set_volume(CXD56_AUDIO_VOLID_MIXER_OUT,
                ~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: audio/cxd56.c:2757:34: error: implicit conversion from enumeration type 'enum cxd56_audio_volid_e' to different enumeration type 'enum cxd56_vol_id_e' [-Werror,-Wenum-conversion]
                cxd56_set_volume(CXD56_AUDIO_VOLID_MIXER_IN1,
                ~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: audio/cxd56.c:2759:34: error: implicit conversion from enumeration type 'enum cxd56_audio_volid_e' to different enumeration type 'enum cxd56_vol_id_e' [-Werror,-Wenum-conversion]
                cxd56_set_volume(CXD56_AUDIO_VOLID_MIXER_IN2,
                ~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: audio/cxd56.c:2764:34: error: implicit conversion from enumeration type 'enum cxd56_audio_volid_e' to different enumeration type 'enum cxd56_vol_id_e' [-Werror,-Wenum-conversion]
                cxd56_set_volume(CXD56_AUDIO_VOLID_MIXER_OUT, priv->volume);
                ~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: audio/cxd56.c:2765:34: error: implicit conversion from enumeration type 'enum cxd56_audio_volid_e' to different enumeration type 'enum cxd56_vol_id_e' [-Werror,-Wenum-conversion]
                cxd56_set_volume(CXD56_AUDIO_VOLID_MIXER_IN1, 0);
                ~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: audio/cxd56.c:2766:34: error: implicit conversion from enumeration type 'enum cxd56_audio_volid_e' to different enumeration type 'enum cxd56_vol_id_e' [-Werror,-Wenum-conversion]
                cxd56_set_volume(CXD56_AUDIO_VOLID_MIXER_IN2, 0);
                ~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-30 16:03:35 +01:00
anjiahao d7b4e91dda Call nxsem_destroy or nxmutex_destry in the error path
1.Don't check the return value of nxsem_init or nxmutex_init
2.Fix some style issue

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-30 13:56:52 +01:00
Tiago Medicci Serrano b4b0624f6a drivers/audio: add support for setting I2S's mclk on CS4344 codec
Set the mclk frequency on I2S lower half by 1) checking supported
sample rate, data width and mclk multiplier table and 2) setting
this value using the I2S_MCLKFREQUENCY macro. I2S driver may or
may not implement the i2s_mclkfrequency method for setting the
master clock.
2022-10-27 00:09:01 +08:00
Tiago Medicci Serrano 41475e11e0 drivers/audio: fix CS4344 supported sample rates 2022-10-27 00:09:01 +08:00
Xiang Xiao 6b31918b42 Remove the unnecessary cast for main_t, NULL and argv
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-18 08:51:45 +02:00
anjiahao d1d46335df Replace nxsem API when used as a lock with nxmutex API
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-17 15:59:46 +09:00
Xiang Xiao bdeaea3742 Remove the unnessary empty line after label
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-30 17:54:56 +02:00
Xiang Xiao 40ef5bc6db libc: Move queue.h from include to include/nuttx
to avoid the conflict with libuv's queue.h

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-26 08:04:58 +02:00
zhangyuan21 1a9252aec9 nuttx/queue: change some queue function to macro 2022-09-04 11:08:02 +08:00
okayserh 2696aee11d Fixed the bug that prevented the code from working in uninitialized
state (wrong I2C write size). Some improvements of the code.
2022-05-09 10:34:29 +08:00
okayserh 476770e9fd Added functionality for Audio support with the STM32F746 Discoboard
In particular additions to wm8994.h and filled functionality into
wm8994.c.

Resolved a few more remarks from review.
2022-05-07 11:52:51 -03:00
Takayoshi Koizumi afc09fb442 drivers/audio/cxd56: Workaround for HW issue of CXD56
Because of HW issue, Audio output volume is limited until -30db as maximum.
This commit fix it. And fix the bug of voulme control.
2022-04-28 08:12:47 +09:00
Xiang Xiao ef1a98dd00 Remove the unneeded void cast
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-17 23:32:05 +03:00
okayserh 218cbb470a Fixed source code format errors. 2022-04-10 19:12:10 -03:00
okayserh 56f0d72465 Minor fix, function name was wm8994_setvolume instead of
wm8904_setvolume.
2022-04-10 19:12:10 -03:00
okayserh eb3e8175de Fixes some issues with the implementation of the balance
functionality. In function "wm8904_hw_reset" the priv->balance
is initialized with b16HALF, indicating a range from
0 to b16ONE. In function "wm8904_setvolume" the assumed
range for priv->balance is between 0 and 1000. The changes
now make this consistent for 0 to b16ONE-1. Furthermore,
in wm8904_configure the change of balance was not implemented.
2022-04-10 19:12:10 -03:00
Petro Karashchenko d08fbca679 nuttx: unify FAR attribute usage across the code
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-04-04 21:32:58 +08:00
Petro Karashchenko 98ba65c422 c89: get rid of designated initializers in common code
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-28 13:39:27 +08:00
Xiang Xiao d7fe0127b0 Replece clock_gettime(CLOCK_REALTIME) with clock_systime_timespec if suitable
it's better to call the kernrel api insteaad user space api in kernel

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-24 01:06:36 +08:00
Petro Karashchenko 95db3ce741 nuttx: remove space befone newline in logs
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2021-12-29 23:37:56 +01:00
Petro Karashchenko 3ccb657dc2 nuttx: remove space befone newline in logs
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2021-12-27 21:01:19 -06:00
Tobias Johansson c7e604b20b drivers: audio: Fix build warning in cxd56
Signed-off-by: Tobias Johansson <tobias.johansson@sony.com>
2021-11-22 03:38:09 -06:00
Tobias Johansson 6f579b8118 drivers: audio: Use lib header for cxd56 SRC
Removes duplicate definitions in header cxd56_src.h and
includeis the proper library header samplerate.h instead.
Also corrects some related build issues.

Signed-off-by: Tobias Johansson <tobias.johansson@sony.com>
2021-11-22 03:38:09 -06:00
Tobias Johansson 6735cf412e drivers: audio: Don't stop cxd56 when stopped
Avoid trying to stop the driver when already stopped.

Signed-off-by: Tobias Johansson <tobias.johansson@sony.com>
2021-11-22 03:38:09 -06:00
Tobias Johansson e9e15689d0 drivers: audio: Close MQ in cxd56 SRC
Closes the message queue file handle when the sample
rate converter is de-initialized.

Signed-off-by: Tobias Johansson <tobias.johansson@sony.com>
2021-11-22 03:38:09 -06:00
Tobias Johansson 3828dd2b11 drivers: audio: Only start amp for HS in cxd56
Only enable the amplifier during playback to avoid clicks.

Signed-off-by: Tobias Johansson <tobias.johansson@sony.com>
2021-11-22 03:38:09 -06:00
Tobias Johansson b36d08ef45 drivers: audio: Limit supported rates in cxd56
Only support the audio sample rate 48kHz when the sample
rate converter is not enabled.

Signed-off-by: Tobias Johansson <tobias.johansson@sony.com>
2021-11-22 03:38:09 -06:00
Tobias Johansson 229bab35a3 drivers: audio: Fix SRC define naming in cxd56
Replaces the misnamed define CONFIG_CXD56_AUCIO_SRC with
CONFIG_AUDIO_CXD56_SRC.

Signed-off-by: Tobias Johansson <tobias.johansson@sony.com>
2021-11-22 03:38:09 -06:00