Commit Graph

1065419 Commits

Author SHA1 Message Date
Pavel Hofman
91eed275da FROMGIT: usb: gadget: f_uac2: Define specific wTerminalType
Several users have reported that their Win10 does not enumerate UAC2
gadget with the existing wTerminalType set to
UAC_INPUT_TERMINAL_UNDEFINED/UAC_INPUT_TERMINAL_UNDEFINED, e.g.
https://github.com/raspberrypi/linux/issues/4587#issuecomment-926567213.
While the constant is officially defined by the USB terminal types
document, e.g. XMOS firmware for UAC2 (commonly used for Win10) defines
no undefined output terminal type in its usbaudio20.h header.

Therefore wTerminalType of EP-IN is set to
UAC_INPUT_TERMINAL_MICROPHONE and wTerminalType of EP-OUT to
UAC_OUTPUT_TERMINAL_SPEAKER for the UAC2 gadget.

Change-Id: I1b0cf3096c4fe49c2f5a6cb73560cb999fca1e57
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220131071813.7433-1-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 5432184107
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
2022-03-18 14:48:07 +08:00
Yunhao Tian
e528854e3a FROMGIT: usb: gadget: f_uac2: allow changing interface name via configfs
This adds "function_name" configfs entry to change string value
of the iInterface field. This field will be shown in Windows' audio
settings panel, so being able to change it is useful. It will default
to "Source/Sink" just as before.

Change-Id: I87c889452f23ace3f68f53f368f31691dade73d7
Signed-off-by: Yunhao Tian <t123yh.xyz@gmail.com>
Link: https://lore.kernel.org/r/20220122112446.1415547-2-t123yh.xyz@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 993a44fa85
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
2022-03-18 14:48:07 +08:00
Pavel Hofman
2d476da02b UPSTREAM: docs: ABI: fixed formatting in configfs-usb-gadget-uac2
Added missing tab, line breaks.

Change-Id: I0f5ec04a4e7ad362730d083ccabe3662f277d704
Fixes: e3088ebc1b ("docs: ABI: added missing num_requests param to UAC2")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Link: https://lore.kernel.org/r/20220108105608.10726-1-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit cbb4f5f435)
2022-03-18 14:48:07 +08:00
Yunhao Tian
7dcc24ef4c FROMGIT: usb: gadget: f_uac1: allow changing interface name via configfs
This adds "function_name" configfs entry to change string value
of the iInterface field. This field will be shown in Windows' audio
settings panel, so being able to change it is useful. It will default
to "AC Interface" just as before if unchanged.

Change-Id: I374c651d5ede2160ca7fe7062401c7c405079062
Signed-off-by: Yunhao Tian <t123yh.xyz@gmail.com>
Link: https://lore.kernel.org/r/20220122112446.1415547-1-t123yh.xyz@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit dfb05b5dc3
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
2022-03-18 14:48:07 +08:00
Pavel Hofman
c2e5a60d0a FROMGIT: usb: gadget: f_uac1: Add suspend callback
Add suspend callback to f_uac1 function, calling corresponding method
of u_audio in order to stop the respective PCM streams and to notify
subscribed clients about the stop.

Change-Id: Id25cc522885c8e5d18a7735eafd7fbd7acd12c50
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Link: https://lore.kernel.org/r/20220121155308.48794-11-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit d1d11dd130
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
2022-03-18 14:48:07 +08:00
Pavel Hofman
180e972f04 FROMGIT: usb: gadget: f_uac2: Add suspend callback
When USB cable gets disconnected, the undergoing playback/capture
stalls, without any notification to u_audio about the change.
Experiments with a dwc2 gadget revealed that Suspend interrupt is
thrown at cable disconnection, which the gadget framework translates to
calling suspend callback of a function, if it is defined.

Add the suspend callback to f_uac2 function, calling
corresponding method of u_audio in order to stop the respective PCM
streams and to notify subscribed clients at cable disconnection.

Change-Id: I51b836f3d55d1d8f80bc1e2a9bb95ee07d643be5
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Link: https://lore.kernel.org/r/20220121155308.48794-10-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 7ff4a3b548
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
2022-03-18 14:48:07 +08:00
Pavel Hofman
7559956d2c FROMGIT: usb: gadget: u_audio: Add suspend call
Add exported method u_audio_suspend which sets stream status to
inactive and sends notifications. The method does not free any
resources.

Change-Id: I09c9b18389f7a8970c5d5386ea08b88b3a099758
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Link: https://lore.kernel.org/r/20220121155308.48794-9-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 62385cf158
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
2022-03-18 14:48:07 +08:00
Pavel Hofman
e5ea5b99b7 FROMGIT: usb: gadget: u_audio: Rate ctl notifies about current srate (0=stopped)
The Playback/Capture ctl currently reports rate value set by USB
control selector UAC2_CS_CONTROL_SAM_FREQ (fixed for UAC1). When the
stops playback/capture, the reported value does not change.  The gadget
side has no information whether the host has started/stopped
capture/playback.

This patch sets the value reported by the respective rate ctl to zero
when the host side has stopped playback/capture. Also, it calls
snd_ctl_notify when start/stop  occurs, so that a subscribed client can
act appropriately.

Tests have confirmed that USB hosts change UAC2_CS_CONTROL_SAM_FREQ
before switching altsetting to activate playback/capture, resulting in
correct order (params->c/p_srate is set to requested rate before
u_audio_start_capture/playback is called).

The gadget rate notifications are used by user-space audio gadget
controller gaudio_ctl https://github.com/pavhofman/gaudio_ctl.

Change-Id: I813226a3bcbdedb33b2d9aa25c7e5d2682d58674
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Link: https://lore.kernel.org/r/20220121155308.48794-8-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 8fe9a03f43
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
2022-03-18 14:48:07 +08:00
Julian Scheel
e7815ba979 FROMGIT: usb: gadget: f_uac1: Support multiple sampling rates
A list of sampling rates can be specified via configfs. All enabled
sampling rates are sent to the USB host on request. When the host
selects a sampling rate the internal active rate is updated.

Config strings with single value stay compatible with the previous version.

Multiple samplerates passed as configuration arrays to g_audio module
when built for f_uac1.

Change-Id: I11f388fe94f099a0ee61ead27ce5ad3e7f0f1c5f
Signed-off-by: Julian Scheel <julian@jusst.de>
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Link: https://lore.kernel.org/r/20220121155308.48794-7-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 695d39ffc2
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
2022-03-18 14:48:07 +08:00
Julian Scheel
e9f5c24b18 FROMGIT: usb: gadget: f_uac2: Support multiple sampling rates
A list of sampling rates can be specified via configfs. All enabled
sampling rates are sent to the USB host on request. When the host
selects a sampling rate, the internal active rate (stored in
struct f_uac2) is updated.

The gadget no longer supports only one frequency. Therefore USB strings
corresponding to the clock sources are renamed from specific Hz value to
general names Input clock/Output clock.

Config strings with single value stay compatible with the previous
version.

Multiple samplerates passed as configuration arrays to g_audio module
when built for f_uac2.

Change-Id: I8b9e8c3417a6fae5767b8f5dd8a6804236579877
Signed-off-by: Julian Scheel <julian@jusst.de>
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Link: https://lore.kernel.org/r/20220121155308.48794-6-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit a7339e4f57
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
2022-03-18 14:48:07 +08:00
Pavel Hofman
5a41dd6a05 FROMGIT: usb: gadget:audio: Replace deprecated macro S_IRUGO
Use octal digits as suggested by checkpatch instead of the deprecated
macro.

Change-Id: I6d14b1a7ea64df237f3a51f92157bdee33fb86db
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Link: https://lore.kernel.org/r/20220121155308.48794-2-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit ce6a7bfbe5
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
2022-03-18 14:48:07 +08:00
Pavel Hofman
8364c8e571 UPSTREAM: docs: ABI: fixed req_number desc in UAC1
Fixed wording of the req_number description in UAC1 docs.

Change-Id: I24dcbf4a31898daed623b060daeda635c5d4fbad
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Link: https://lore.kernel.org/r/20211225130929.205629-2-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit a8cf051603)
2022-03-18 14:48:07 +08:00
Pavel Hofman
288239ee00 UPSTREAM: docs: ABI: added missing num_requests param to UAC2
The existing configfs-usb-gadget-uac2 ABI doc for testing was missing
the num_requests param. The patch adds the parameter to the document.

Change-Id: Idd380fef7411db3ecc4f06a7d6e43ceca68f1a97
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Link: https://lore.kernel.org/r/20211225130929.205629-1-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit e3088ebc1b)
2022-03-18 14:48:07 +08:00
Mauro Carvalho Chehab
83bc257d94 UPSTREAM: ABI: configfs-usb-gadget-uac1: fix a broken table
Changeset 0356e6283c ("usb: gadget: f_uac1: add volume and mute support")
added some new elements to the table but didn't care enough to actually
adjust the columns, causing the output to be broken as warned by
Sphinx when producing the documentation.

Readjust it for it to be a valid ReST table.

Change-Id: I2c8a1dff01779e7ee5418b66aa52ddc70029fd8d
Fixes: 0356e6283c ("usb: gadget: f_uac1: add volume and mute support")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/044b0c14c35922bdcca50551fe2aa870baae9b06.1632740376.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 1b8af67cae)
2022-03-18 14:48:07 +08:00
Mauro Carvalho Chehab
21f8a7fb61 UPSTREAM: ABI: configfs-usb-gadget-uac2: fix a broken table
Changeset af6cbe09920 ("usb: gadget: f_uac2: add volume and mute support")
added some new elements to the table but didn't care enough to actually
adjust the columns, causing the output to be broken as warned by
Sphinx when producing the documentation.

Readjust it for it to be a valid ReST table.

Change-Id: I8a0ae4fbc93b0587a8b4d3459ef90829778d7da0
Fixes: eaf6cbe099 ("usb: gadget: f_uac2: add volume and mute support")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/d253819a4c201b942d754682bb91dd278300fb79.1632740376.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 5ef803538b)
2022-03-18 14:48:07 +08:00
Hu Haowen
0fb672fa56 UPSTREAM: docs: usb: fix malformed table
The tables are separated with tabs and spaces mixed together, leading
to malformation. Changed the characters all into spaces to solve this
issue.

Change-Id: I9004ca26e2ea0fbe397a1cb3e21bae639c240751
Signed-off-by: Hu Haowen <src.res@email.cn>
Link: https://lore.kernel.org/r/20210805040146.121526-1-src.res@email.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 9c0edd5649)
2022-03-18 14:48:07 +08:00
Pavel Hofman
194ea1f571 FROMGIT: usb: gadget: u_audio: Add capture/playback srate getter
UAC1/UAC2 functions will need to query u_audio about the currently set
srate. Add the getter functions.

Change-Id: I5d7e38d52eb073cdd1ab1692994cf7cd2f9e7757
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Link: https://lore.kernel.org/r/20220121155308.48794-5-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit eb3a1ce6f5
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
2022-03-18 14:48:07 +08:00
Pavel Hofman
f948999ac8 FROMGIT: usb: gadget: u_audio: Move dynamic srate from params to rtd
Parameters uac_params.p_srate/c_srate are dynamic now and are not part
of parametric configuration anymore. Move them to the
runtime struct uac_rtd_params for each stream.

Change-Id: I4ce2dcf8b342d86f5b82167194a438af267837bc
Suggested-by: John Keeping <john@metanate.com>
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Link: https://lore.kernel.org/r/20220121155308.48794-4-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 8722a949e6
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
2022-03-18 14:48:07 +08:00
Julian Scheel
7ab40ff566 FROMGIT: usb: gadget: u_audio: Support multiple sampling rates
Implement support for multiple sampling rates in u_audio part of the
audio gadget. The currently configured rates are exposed through
read-only amixer controls 'Capture Rate' and 'Playback Rate'.

Change-Id: Idcdcddf34a165553753b2a9af17a688b0e8ab4f0
Signed-off-by: Julian Scheel <julian@jusst.de>
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Link: https://lore.kernel.org/r/20220121155308.48794-3-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit c565ad07ef
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
2022-03-18 14:48:07 +08:00
Pavel Hofman
1fc9aac7c0 UPSTREAM: usb: gadget: u_audio: Subdevice 0 for capture ctls
Both capture and playback alsa devices use subdevice 0. Yet capture-side
ctls are defined for subdevice 1. The patch sets subdevice 0 for them.

Change-Id: I18ebe7c5f59c108fb48b205af4a3f84839b5f71d
Fixes: 02de698ca8 ("usb: gadget: u_audio: add bi-directional volume and mute support")
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Link: https://lore.kernel.org/r/20220105104643.90125-1-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 601a5bc1ae)
2022-03-18 14:48:07 +08:00
John Keeping
3e3779b910 UPSTREAM: usb: gadget: u_audio: fix calculations for small bInterval
If bInterval is 1, then p_interval is 8000 and p_interval_mil is 8E9,
which is too big for a 32-bit value.  While the storage is indeed
64-bit, this value is used as the divisor in do_div() which will
truncate it into a uint32_t leading to incorrect calculated values.

Switch back to keeping the base value in struct snd_uac_chip which fits
easily into an int, meaning that the division can be done in two steps
with the divisor fitting safely into a uint32_t on both steps.

Change-Id: I602559a8977803545ef2b83021cc9cbac2db24b5
Fixes: 6fec018a7e ("usb: gadget: u_audio.c: Adding Playback Pitch ctl for sync playback")
Tested-by: Pavel Hofman <pavel.hofman@ivitera.com>
Signed-off-by: John Keeping <john@metanate.com>
Link: https://lore.kernel.org/r/20220104183243.718258-1-john@metanate.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit f2f69bf65d)
2022-03-18 14:48:07 +08:00
Pavel Hofman
7c0605bc8d UPSTREAM: usb:gadget: f_uac1: fixed sync playback
The u_audio param fb_max was not set to its default value in f_uac1.c.
As a result the maximum value of Playback Pitch ctl was kept at 1000000,
not allowing to set faster playback pitch for UAC1.

The setting required moving the default constant UAC2_DEF_FB_MAX from
u_uac2.h to FBACK_FAST_MAX in u_audio.h as that header is common for
f_uac1.c and f_uac2.c.

Change-Id: Ie85199656e096dc931dffa465e706a8526b5856d
Fixes: 6fec018a7e ("usb: gadget: u_audio.c: Adding Playback Pitch ctl for sync playback")
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Link: https://lore.kernel.org/r/20211022140339.248669-1-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit d9f2734843)
2022-03-18 14:48:07 +08:00
Pavel Hofman
46889912f2 UPSTREAM: usb: gadget: u_audio.c: Adding Playback Pitch ctl for sync playback
EP IN is hard-coded as ASYNC both in f_uac1 and f_uac2 but u_audio sends
steady number of audio frames in each USB packet, without any control.

This patch adds 'Playback Pitch 1000000' ctl analogous to the existing
'Capture Pitch 1000000' ctl. The calculation of playback req->length in
u_audio_iso_complete respects the Playback Pitch ctl value to 1ppm now.

Max. value for Playback Pitch is configured by the existing parameter
uac2_opts->fb_max, used also for the Capture Pitch.

Since the EP IN packet size can be increased by uac2_opts->fb_max now,
maxPacketSize for the playback direction is calculated by the same
algorithm as for the async capture direction in
f_uac2.c:set_ep_max_packet_size.

Change-Id: Id19a55560a23497c75fc62debcb7dd6de98a53fe
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Link: https://lore.kernel.org/r/20211013073934.36476-1-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 6fec018a7e)
2022-03-18 14:48:07 +08:00
Colin Ian King
f1cef857d5 UPSTREAM: usb: gadget: f_uac2: clean up some inconsistent indenting
There are bunch of statements where the indentation is not correct,
clean these up.

Change-Id: I6540cf83e40dd7f825b315f035273e37f4ea7287
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210902224758.57600-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 18d6b39ee8)
2022-03-18 14:48:07 +08:00
Pavel Hofman
4d7a4c3d18 UPSTREAM: usb: gadget: f_uac1: fixing inconsistent indenting
Fixing inconsistent indenting identified by kernel test
robot.

Change-Id: If5831eafe2909a5a0d4955ecbddc3b176415e1a0
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Acked-By: Felipe Balbi <balbi@kernel.org>
Link: https://lore.kernel.org/r/20210817100555.4437-1-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 1bc2208355)
2022-03-18 14:48:07 +08:00
Colin Ian King
6c4eefb07f UPSTREAM: usb: gadget: f_uac2: remove redundant assignments to pointer i_feature
Pointer i_feature is being initialized with a value and then immediately
re-assigned a new value in the next statement. Fix this by replacing the
the redundant initialization with the following assigned value.

Change-Id: I1cf2dd348b049a0dcb902ea674386daec68ee07e
Acked-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Addresses-Coverity: ("Unused value")
Link: https://lore.kernel.org/r/20210804125907.111654-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 59e477af7b)
2022-03-18 14:48:07 +08:00
Ruslan Bilovol
7cff8ea0d7 UPSTREAM: usb: gadget: f_uac1: add volume and mute support
This adds bi-directional (host->device, device->host)
volume/mute support to the f_uac1 driver by adding
Feature Units and interrupt endpoint.

Currently only master channel is supported.

Volume and mute are configurable through configfs,
by default volume has -100..0 dB range with 1 dB step.

Similar to existing flexible endpoints configuration,
Feature Unit won't be added to the topology if both
mute and volume are not enabled, also interrupt endpoint
isn't added to the device if no feature unit is present

Change-Id: I9454a92291d5055286db4ef73a0038e30420fd24
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Link: https://lore.kernel.org/r/20210712125529.76070-5-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 0356e6283c)
2022-03-18 14:48:07 +08:00
Ruslan Bilovol
fe9da54e56 UPSTREAM: usb: gadget: f_uac2: add volume and mute support
This adds bi-directional (host->device, device->host)
volume/mute support to the f_uac2 driver by adding
Feature Units and interrupt endpoint.

Currently only master channel is supported.

Volume and mute are configurable through configfs,
by default volume has -100..0 dB range with 1 dB step.

Similar to existing flexible endpoints configuration,
Feature Unit won't be added to the topology if both
mute and volume are not enabled, also interrupt endpoint
isn't added to the device if no feature unit is present

Change-Id: I6666075ac963745c450fb5eeb81ff058572fad66
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Link: https://lore.kernel.org/r/20210712125529.76070-4-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit eaf6cbe099)
2022-03-18 14:48:07 +08:00
Ruslan Bilovol
a5ae50658a UPSTREAM: usb: gadget: u_audio: add bi-directional volume and mute support
USB Audio Class 1/2 have ability to change device's
volume and mute by USB Host through class-specific control
requests. Device also can notify Host about volume/mute
change on its side through optional interrupt endpoint.

This patch adds Volume and Mute ALSA controls which can be
used by user to send and receive notifications to/from
the USB Host about Volume and Mute change.

These params come from f_uac* so volume and mute controls
will be created only if the function support and enable
each explicitly

Change-Id: I5ac616d8b37b31a6be7c3114e407c17cd4b87369
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Link: https://lore.kernel.org/r/20210712125529.76070-3-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 02de698ca8)
2022-03-18 14:48:07 +08:00
Ruslan Bilovol
1fad4be082 UPSTREAM: usb: audio-v2: add ability to define feature unit descriptor
Similar to UAC1 spec, UAC2 feature unit descriptor
has variable size.

Current audio-v2 feature unit descriptor structure
is used for parsing descriptors, but can't be used
to define your own descriptor.

Add a new macro similar to what audio v1 already has.

Change-Id: I253f2a6eefe74055132920e0e56ac908500147ae
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Link: https://lore.kernel.org/r/20210712125529.76070-2-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit b48f8939b9)
2022-03-18 14:48:07 +08:00
Ruslan Bilovol
ec18ff031f UPSTREAM: usb: gadget: f_uac1: disable IN/OUT ep if unused
User can configure f_uac1 function via p_chmask/c_chmask
whether uac1 shall support playback and/or capture,
but it has only effect on the created ALSA device,
but not on the USB descriptor.

This patch adds playback/capture descriptors
dependent on that parameter. It is similar to
the same conversion done earlier for f_uac2

Change-Id: Ie25ef738a2dbc4a781a874bd7f1f015afda33b1b
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
Link: https://lore.kernel.org/r/1614599375-8803-6-git-send-email-ruslan.bilovol@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 254cb1e0d7)
2022-03-18 14:48:07 +08:00
Yiqing Zeng
75a2a7aa38 media: i2c: add sc530ai sensor driver
Signed-off-by: Yiqing Zeng <zack.zeng@rock-chips.com>
Change-Id: Icc4feae09b7497777e2f1bc586bd220caeac92a5
2022-03-18 14:31:07 +08:00
Sugar Zhang
6745dcaff6 ARM: dts: rv1106-evb: Fix root partition
Because partition 'envparam' has been removed, so, fix it.
OTOH, uboot will also override this if 'sys_bootargs' specified
in env partition.

e.g. env_emmc

blkdevparts=mmcblk0:32K(env),512K@32K(idblock),4M(uboot),32M(boot),2G(rootfs),1G(oem),2G(userdata),-(media)
sys_bootargs=root=/dev/mmcblk0p5 rootfstype=ext4

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: I7917dee2e642cc18c926e99eae623083453c4693
2022-03-18 14:29:43 +08:00
Chen Shunqing
8dca81808b media: rockchip: hdmirx: fix power on abnormal
Signed-off-by: Chen Shunqing <csq@rock-chips.com>
Change-Id: Ic02eff1f8dd1cae6ef1c1de87fc4e6839dfdceb0
2022-03-18 14:23:59 +08:00
Lin Jianhua
c1e51c428e arm64: dts: rockchip: rk3588s-evb2-lp5: fixup iomux of dp0
from dp1m2_pins to dp0m2_pins.

Signed-off-by: Lin Jianhua <linjh@rock-chips.com>
Change-Id: Id6c2aef3307bcc5670497cf32355bb78c7cc1f7c
2022-03-18 14:14:39 +08:00
Weng Tao
e0f5e518d4 clk: rockchip: rk3588: Add pll rate table for 955Mhz and 785Mhz
Signed-off-by: Weng Tao <tao.weng@rock-chips.com>
Change-Id: I669f79667fce318cc0ae919a52babd3cdbb52610
2022-03-18 14:12:53 +08:00
Addy Ke
84c39b1c84 arm64: dts: rockchip: toybrick change sound card-name to rockchip-es8388
Signed-off-by: Addy Ke <addy.ke@rock-chips.com>
Change-Id: I15a0292c80946efc54f7c83d461f3d20e71f7f64
2022-03-18 14:12:03 +08:00
Addy Ke
ce00575632 arm64: dts: rockchip: add and enable dp sound cards for rk3588 toybrick
Signed-off-by: Addy Ke <addy.ke@rock-chips.com>
Change-Id: I9d4db8be3594415f8c7e1e0ab3530f030c1aeca5
2022-03-18 11:36:27 +08:00
Addy Ke
5521c6447b arm64: dts: rockchip: rk3588-toybrick: enable suspend
Signed-off-by: Addy Ke <addy.ke@rock-chips.com>
Change-Id: I8febc05e4ba112178eb28adfba1a5b5442b12fdd
2022-03-18 11:34:33 +08:00
Addy Ke
8f08a64ede arm64: dts: rockchip: rk3588-toybrick-x0: enable hdmirx_ctrler
Enable hdmirx_ctrler and reserve cma memory for hdmi-in application

Signed-off-by: Addy Ke <addy.ke@rock-chips.com>
Change-Id: Ie3f3deeeb24f549c82649029ed683a2aa6956068
2022-03-18 11:32:25 +08:00
Addy Ke
3250048625 arm64: dts: rockchip: enable av1d iommu for rk3588 toybrick
Signed-off-by: Addy Ke <addy.ke@rock-chips.com>
Change-Id: Ia95ff7d2b9245a72cff8abdd3c08b57ddaecd0d6
2022-03-18 11:24:43 +08:00
Jianqun Xu
e7514f3b3c media: platform: rockchip: hdmirx select VIDEOBUF2_DMA_CONTIG
The hdmirx allocates memory through videobuf2 and call the
vb2_dma_contig_ops, but the hdmirx not select the VIDEOBUF2_DMA_CONTIG
itself, but the ISP will select it instead.

When a patch for ISP may not select VIDEOBUF2_DMA_CONTIG, the hdmirx
will fail to compile since not defined videobuf2_dma_contig_ops.

So select VIDEOBUF2_DMA_CONTIG by hdmirx indeed.

Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
Change-Id: Ibcf45da96053cb280e208b160ba24b2c1614a7b6
2022-03-18 08:24:38 +08:00
Jianqun Xu
2cc285e065 media: platform: rockchip: source rockchip dir to subdir
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
Change-Id: Iffe0151bda9f05dba871907f93c0e9aef0f40ae8
2022-03-17 20:45:30 +08:00
Jianqun Xu
ef34c63346 media: videobuf2: add vb2_cma_sg_memops
Currently videobuf2 supports videobuf2-dma-sg, videobuf2-dma-contig and
videobuf2-vmalloc.

- vb2_dma_sg_memops
  created by videobuf2-dma-sg driver,
  allocates memory through 'alloc_pages' and manager them with scatter
  gather list (sgt).

- vb2_dma_contig_memops
  created by videobuf2-dma-contig driver,
  allocates memory through dma_alloc_attrs, may result in many kinds of
  memory, including 'cma_alloc'.

- vb2_vmalloc_memops
  created by videobuf2-vmalloc driver,
  allocates memory through vmalloc_user.

In some case device requires allocate memory through cma_alloc and manager
them by sgt, the new driver is named videobuf2-cma-sg.

- vb2_cma_sg_memops
  created by videobuf2-cma-sg driver,
  allocates memory through 'cma_alloc' and manager them with sgt.

Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
Change-Id: Ic974dd41aa3dcf9588311ad8ed6c166f3064d6fd
Signed-off-by: Cai YiWei <cyw@rock-chips.com>
2022-03-17 20:36:28 +08:00
Chen Shunqing
9acb3cd2ce media: rockchip: hdmirx: fix crash for write node
Some registers is read only, write these registers will cause crash.

Signed-off-by: Chen Shunqing <csq@rock-chips.com>
Change-Id: If4bde6f21d525c2fc6fe3c56d54fce58d4900762
2022-03-17 20:35:33 +08:00
Zefa Chen
c2caac3167 ARM: dts: rockchip: add csidphy for rv1106
Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com>
Change-Id: Ia6d4dbadba3367758bf66f9b30022c5901f2143a
2022-03-17 19:40:22 +08:00
Zefa Chen
df0cb947c3 ARM: dts: rockchip: add vicap and csi2 for rv1106
Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com>
Change-Id: I6badb39a4ccdf6f35a390b6782bb927ea08adeb3
2022-03-17 19:37:42 +08:00
Yu Qiaowei
08dd467bdf video: rockchip: rga3: Fix wrong size calculation when YUV import buffer
Update driver version to 1.2.6

Signed-off-by: Yu Qiaowei <cerf.yu@rock-chips.com>
Change-Id: I21d32c09a976c01a8eb4a603e5d316c9ad87eddf
2022-03-17 19:25:16 +08:00
Yu Qiaowei
549f921cdf video: rockchip: rga3: Change pr_debug to pr_info
Signed-off-by: Yu Qiaowei <cerf.yu@rock-chips.com>
Change-Id: I90ce679ff4b43bc4c3252ab44d14be16826ad16c
2022-03-17 19:24:35 +08:00
Yu Qiaowei
b63852bfde video: rockchip: rga3: adapt to kernel 5.4
Signed-off-by: Yu Qiaowei <cerf.yu@rock-chips.com>
Change-Id: I848573243aaa5a2779575df2ee9dcf7845f2c57b
2022-03-17 19:23:55 +08:00