Commit Graph

175 Commits

Author SHA1 Message Date
Masayuki Ishikawa
1dc77c2ec5 drivers: audio: Introduce a driver-specific spinlock to cxd56.c
Summary:
- This commit introduces a driver-specific spinlock to cxd56.c
  to improve performance in SMP mode.

Impact:
- cxd56.c in SMP mode only

Testing:
- Tested with nxplayer and nxrecorder with the following configs
- spresense:wifi, spresense:wifi_smp

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-02-15 01:54:44 -08:00
Masayuki Ishikawa
d87f350831 arch, boards, drivers, include, sched, wireless: Change spinlock APIs.
Summary:
- This commit changes spinlock APIs (spin_lock_irqsave/spin_unlock_irqrestore)
- In the previous implementation, the global spinlock (i.e. g_irq_spin) was used.
- This commit allows to use caller specific spinlock but also supports to use
  g_irq_spin for backword compatibility (In this case, NULL must be specified)

Impact:
- None

Testing:
- Tested with the following configurations
- spresnse:wifi, spresense:wifi_smp
- esp32-devkitc:smp (QEMU), sabre6-quad:smp (QEMU)
- maxi-bit:smp (QEMU), sim:smp
- stm32f4discovery:wifi

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-02-07 21:28:56 -08:00
Alin Jerpelea
f22683a0a6 drivers: replace licenses with Apache 2.0
This change is a license change to Apache 2.0 license.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-01-26 05:11:58 -08:00
ligd
f63db66382 mqueue: add file_mq_xx for kernel use
Change-Id: Ida12f5938388cca2f233a4cde90277a218033645
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-05 02:40:43 -06:00
YAMAMOTO Takashi
2d78501e9a drivers/audio/audio_null.c: Fix a syslog format 2020-12-06 07:41:37 -06:00
YAMAMOTO Takashi
bdabaa87c6 drivers/audio/cs43l22.c: Fix a syslog format 2020-11-30 05:28:17 -06:00
Huang Qi
f0e8d10d1a drivers/audio: Make audio_null play at real speed
N/A
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Change-Id: I69a52ee2b03836006f613c4dc41837b6123ad2d5
2020-11-30 03:30:30 -06:00
Chaochao Cui
fbb3cd660b add simple wm8994 codec driver 2020-11-28 10:23:40 -03:00
YAMAMOTO Takashi
b3d39176bc drivers/audio/cxd56.c: Fix syslog formats 2020-11-27 05:18:57 -06:00
Tobias Johansson
c06c6ffa81 cxd56: add initial audio SRC implementation
Add basic sample rate conversion to the CXD56 Spresense audio
driver using libsamplerate. Currently conversion is only done
during playback and all output is fixed at 48 kHz.

Issues:
- 16 kHz SRC has glitches (unless data dump is enabled)
- 44.1 kHz SRC gets stuck
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2020-11-19 07:29:07 +09:00
YAMAMOTO Takashi
1373f476fb drivers/audio/wm8776.c: Fix a printf format warning 2020-11-16 08:29:00 -08:00
YAMAMOTO Takashi
a3b7391dcb drivers/audio/cs4344.c: Fix a printf format warning 2020-11-16 08:29:00 -08:00
YAMAMOTO Takashi
61bf05d26e drivers/audio/vs1053.c: Fix a printf format warning 2020-11-16 08:29:00 -08:00
YAMAMOTO Takashi
df86bfd4cd drivers/audio/cs43l22.c: Fix a printf format warning 2020-11-16 08:29:00 -08:00
YAMAMOTO Takashi
950fff8e66 drivers/audio/cxd56.c: Fix a printf format warning 2020-11-16 08:29:00 -08:00
YAMAMOTO Takashi
5ef5d2c598 drivers/audio/audio_null.c: Fix a printf format warning 2020-11-16 08:29:00 -08:00
YAMAMOTO Takashi
2cc96365b0 drivers/audio/wm8904.c: Fix a printf format warning 2020-11-16 08:29:00 -08:00
Tobias Johansson
2cce572162 drivers: audio: cxd56: rename queue status
This commit improves the readability for each state

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2020-11-06 11:11:27 +09:00
Tobias Johansson
43b21a4693 drivers: audio: cxd56: add I2S debugging
When audio fails it is usefull to have I2S transfer errors in place
to be able to track the issue

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2020-11-06 11:11:27 +09:00
Tobias Johansson
d572b06a6c drivers:audio: cxd56: move helpers to the header file
The Queue helpers should be moved to the header file

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2020-11-06 11:11:27 +09:00
Masayuki Ishikawa
89cfaf1e6a drivers: audio: Fix cxd56.c for SMP
Summary:
- Add spin_unlock_irqrestore to avoid deadlock
- Improve cxd56_resume() sequence
- Remove AUDIO_MSG_USER and call cxd56_stop_dma() for buffering
- Remove redandant 'Lock interrupt' and 'Unlock interrupt'

Impact:
- Affects all use cases with cxd56.c audio driver

Testing:
- Tested with spresense:rndis and spresense:rndis_smp

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-09-23 10:45:29 +02:00
Xiang Xiao
ae356001cf Change all files come from Xiaomi/Pinecone to Apache License 2.0
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-22 17:37:21 -06:00
SPRESENSE
d560ce65ff cxd56xx: spresense: Add some improvements and fix bugs for Spresense board
- Add new functions of GNSS
- Support the lower PWM frequency
- Add CONFIG_CPUFREQ_RELEASE_LOCK
- Add high speed ADC support
- Add HPADC input gain configuration
- Add eMMC device
- Frame buffer support
- Fix SD/GNSS/sensor drivers not worked
- Build errors
- Fix nxstyle issues
2020-07-28 09:13:05 +02:00
Masayuki Ishikawa
b6218c67f8 drivers: audio: Replace license header with Apache License 2.0
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-07-28 00:47:39 -05:00
Xiang Xiao
095e492cb3 libc: Replace nuttx/lib/math.h with math.h
Because user may replace math library with other implementation

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Idb5f2a8b2a70302c8561553b3bcbc40529b5257f
2020-06-29 06:32:10 +02:00
Matias Nitsche
b3327419d3 tone: stop tone using 0 duty, not stop() 2020-06-25 11:04:14 +01:00
Matias Nitsche
10a9464bcf tone: start playing tune immediately without delay 2020-06-25 11:04:14 +01:00
Masayuki Ishikawa
ae92afd250 drivers: audio: Fix cxd56_stop in cxd56.c
In the previous implementation, cxd56_stop() checked the internal
state before sending AUDIO_MSG_STOP to the message queue. However,
if the worker thread took time to turn on AMP, cxd560_stop() was
not able to send the message and caused a deadlock.

This commit fixes this issue by always sending AUDIO_MSG_STOP
regardless of the internal state.

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-06-16 08:52:40 +02:00
Masayuki Ishikawa
958ddc1926 drivers: audio: Add a buffering feature to cxd56
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-06-10 09:11:15 -03:00
Masayuki Ishikawa
8a60cc01e2 drivers: audio: Send stop message when received the final buffer
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-06-10 09:11:15 -03:00
Ouss4
36f54e280f Fix PR1201 nxstyle issues. 2020-06-05 15:54:17 -03:00
Ouss4
8da4b02350 drivers/audio: Add CS4344 driver. 2020-06-05 15:54:17 -03:00
Tobias Johansson
368fbd0dea cxd56: Fix lock issue in Spresense audio driver
Replace semaphore with spinlock in the DMA buffer handling code
since it is called from an interrupt.
2020-06-05 19:50:27 +08:00
Masayuki Ishikawa
4b9886fa29 drivers: audio: Return -ENOTTY in xxx_ioctl() if not handled
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-06-05 12:02:33 +08:00
Tobias Johansson
f2c957144a cxd56: Add input support to Spresense audio driver
Add recording support to the Nuttx audio driver for Spresense.
- Supports 16 bit data with 48 kHz sample rate only for now.
- Supports 1 (dual mono) 2 or 4 channels.
- Only analog mics have been tested so digital is considered
  unsupported.
2020-05-08 07:18:22 -06:00
Tobias Johansson
79589eca1a cxd56: replace Sony return values
- Replace Sony error codes with standard ones where possible
- Unify error message and remove some unnecessary info prints
2020-04-21 17:19:52 -06:00
Tobias Johansson
ecc4939453 cxd56: fix volume setting and improve volume range
- Setting volume now works except when in paused state
- Volume range decreased to be a little more sane
2020-04-21 17:19:52 -06:00
Tobias Johansson
36e756a915 cxd56: add support for pause and resume
Implements pause and resume functionality
2020-04-21 17:19:52 -06:00
Tobias Johansson
7a83177419 cxd56: disable unused audio effects
Disables audio effects that are not currently in use.
Also fixes some minor indentation issues.
2020-04-21 17:19:52 -06:00
Alin Jerpelea
d9d720b296 audio: nxstyle fixes for core and drivers
nxstyle fixes for the audio core and drivers

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2020-04-21 17:19:52 -06:00
Tobias Johansson
57e8f0451a cxd56: add initial Nuttx audio driver
Adds an initial Nuttx audio driver supporting the Spresense CXD56.
Being a work in progress the driver has a number of limitations:
- Audio playback only, no recording yet.
- Only 16 bit stereo playback is supported.
- In practice only 48kHz playback is supported due to missing SRC.
- Configure driver in "Device Drivers --> Audio Device Support".
2020-04-16 12:50:05 -06:00
Gregory Nutt
5b74974919 Check return from nxsem_wait_initialize()
Resolution of Issue 619 will require multiple steps, this part of the first step in that resolution:  Every call to nxsem_wait_uninterruptible() must handle the return value from nxsem_wait_uninterruptible properly.  This commit is only for those files under drivers/audio, drivers/net, and drivers/lcd.
2020-03-31 20:12:21 +01:00
Xiang Xiao
cde88cabcc Run codespell -w with the latest dictonary again
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-23 22:27:46 +01:00
Xiang Xiao
bd4e8e19d3 Run codespell -w against all files
and fix the wrong correction
2020-02-22 14:45:07 -06:00
Gregory Nutt
21aef0dd68 drivers/*/Kconfig: Consolidate driver Kconfig Files.
This commit does two things:

1. First, it reorganizes the driver Kconfig files so that each is self contained.  Before, a part of the driver configuration was in drivers/Kconfig and the rest was in in drivers/xyz/Konfig.  Now, all of the driver configuration is consolitated in the latter.

2. Second, this commit correct numerous serious errors introduced in a previous reorganization of the driver Kconfig files.  This was first noted by Nicholas Chin in PR270 for the case of the drivers/i2c/Kconfig but some examination indicates that the error was introduced into several other Kconfig files as well.

The nature of the introduced error was basically this:

- Nothing must intervene between the menuconfig selection and the following conditional configuration otpions.
- A previous PR erroneously introduced unconditional options between the menuconfig and the following confditional logic, thus corrupting the driver menus.

This error was easy to make because the driver Kconfig files were not well modularized.  Making them fully self-contained should eliminate this kind of error in the future.
2020-02-15 15:19:11 +01:00
Xiang Xiao
3cb259daa6 drivers/Kconfig: Move if/endif to subfolder Kconfig
Move if/endif to subfolder Kconfig and make ARCH_HAVE_XXX option always selectable by moving out of if/endif
2020-02-08 08:04:05 -06:00
Xiang Xiao
5c80b94820 Replace #include <semaphore.h> to #include <nuttx/semaphore.h>
Since the kernel side should call nxsem_xxx instead and remove the unused inclusion
2020-02-01 08:27:30 -06:00
Xiang Xiao
80277d1630
Refine the preprocessor conditional guard style (#190) 2020-01-31 19:07:39 +01:00
Xiang Xiao
68951e8d72 Remove exra whitespace from files (#189)
* Remove multiple newlines at the end of files
* Remove the whitespace from the end of lines
2020-01-31 09:24:49 -06:00
Xiang Xiao
6a3c2aded6 Fix wait loop and void cast (#24)
* Simplify EINTR/ECANCEL error handling

1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx

* Unify the void cast usage

1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
2020-01-02 10:54:43 -06:00