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 8fe9a03f43https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
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 a7339e4f57https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
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)
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)
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)
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)
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)
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)
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)
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
Enable hdmirx_ctrler and reserve cma memory for hdmi-in application
Signed-off-by: Addy Ke <addy.ke@rock-chips.com>
Change-Id: Ie3f3deeeb24f549c82649029ed683a2aa6956068
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
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>
Some registers is read only, write these registers will cause crash.
Signed-off-by: Chen Shunqing <csq@rock-chips.com>
Change-Id: If4bde6f21d525c2fc6fe3c56d54fce58d4900762
If FRAME_SEND_CLR_P was set, cec packets may be sent incomplete.
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
Change-Id: Ic67518ea0c794fe6f997c87e45dedbfd6fb1fde3
1. Add rkvenc2 pagefault handler to dump memory region used in task.
2. Move rkvenc2_patch_dchs before write hardware register.
3. Add more dchs status log with DEBUG_CORE flag.
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I3fd5e14a3a5dd347373e3bc4e21d41db8c05fd21