Skip to content

Commit

Permalink
Merge pull request #5306 from bardliao/merge/sound-upstream-20250123
Browse files Browse the repository at this point in the history
Merge/sound upstream 20250123
  • Loading branch information
bardliao authored Jan 24, 2025
2 parents 2d96a28 + ebae280 commit e0657c0
Show file tree
Hide file tree
Showing 41 changed files with 5,103 additions and 191 deletions.
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/sound/fsl,micfil.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ properties:
- fsl,imx8mm-micfil
- fsl,imx8mp-micfil
- fsl,imx93-micfil
- fsl,imx943-micfil

reg:
maxItems: 1
Expand Down
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/sound/ti,pcm1681.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
$id: http://devicetree.org/schemas/sound/ti,pcm1681.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Texas Instruments PCM1681 8-channel PWM Processor
title: Texas Instruments PCM1681 8-channel Digital-to-Analog Converter

maintainers:
- Shenghao Ding <[email protected]>
Expand Down
10 changes: 6 additions & 4 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -8948,14 +8948,16 @@ L: [email protected]
S: Maintained
F: drivers/input/joystick/fsia6b.c

FOCUSRITE SCARLETT2 MIXER DRIVER (Scarlett Gen 2+ and Clarett)
FOCUSRITE CONTROL PROTOCOL/SCARLETT2 MIXER DRIVERS (Scarlett Gen 2+, Clarett, and Vocaster)
M: Geoffrey D. Bennett <[email protected]>
L: [email protected]
S: Maintained
W: https://github.com/geoffreybennett/scarlett-gen2
B: https://github.com/geoffreybennett/scarlett-gen2/issues
T: git https://github.com/geoffreybennett/scarlett-gen2.git
W: https://github.com/geoffreybennett/linux-fcp
B: https://github.com/geoffreybennett/linux-fcp/issues
T: git https://github.com/geoffreybennett/linux-fcp.git
F: include/uapi/sound/fcp.h
F: include/uapi/sound/scarlett2.h
F: sound/usb/fcp.c
F: sound/usb/mixer_scarlett2.c

FORCEDETH GIGABIT ETHERNET DRIVER
Expand Down
1 change: 1 addition & 0 deletions drivers/acpi/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1769,6 +1769,7 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device)
{"CSC3557", },
{"INT33FE", },
{"INT3515", },
{"TXNW2781", },
/* Non-conforming _HID for Cirrus Logic already released */
{"CLSA0100", },
{"CLSA0101", },
Expand Down
28 changes: 22 additions & 6 deletions drivers/base/regmap/regmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1557,24 +1557,40 @@ static int _regmap_select_page(struct regmap *map, unsigned int *reg,
return -EINVAL;
}

/* It is possible to have selector register inside data window.
In that case, selector register is located on every page and
it needs no page switching, when accessed alone. */
/*
* It is possible to have selector register inside data window.
* In that case, selector register is located on every page and it
* needs no page switching, when accessed alone.
*
* Nevertheless we should synchronize the cache values for it.
*/
if (val_num > 1 ||
range->window_start + win_offset != range->selector_reg) {
unsigned int page_off = win_page * range->window_len;
unsigned int sel_offset = range->selector_reg - range->window_start;
unsigned int sel_register = range->range_min + page_off + sel_offset;
unsigned int val = win_page << range->selector_shift;
unsigned int mask = range->selector_mask;

/* Use separate work_buf during page switching */
orig_work_buf = map->work_buf;
map->work_buf = map->selector_work_buf;

ret = _regmap_update_bits(map, range->selector_reg,
range->selector_mask,
win_page << range->selector_shift,
ret = _regmap_update_bits(map, range->selector_reg, mask, val,
&page_chg, false);

map->work_buf = orig_work_buf;

if (ret != 0)
return ret;

/*
* If selector register has been just updated, update the respective
* virtual copy as well.
*/
if (page_chg &&
in_range(range->selector_reg, range->window_start, range->window_len))
_regmap_update_bits(map, sel_register, mask, val, NULL, false);
}

*reg = range->window_start + win_offset;
Expand Down
12 changes: 12 additions & 0 deletions drivers/platform/x86/serial-multi-instantiate.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,17 @@ static const struct smi_node cs35l57_hda = {
.bus_type = SMI_AUTO_DETECT,
};

static const struct smi_node tas2781_hda = {
.instances = {
{ "tas2781-hda", IRQ_RESOURCE_AUTO, 0 },
{ "tas2781-hda", IRQ_RESOURCE_AUTO, 0 },
{ "tas2781-hda", IRQ_RESOURCE_AUTO, 0 },
{ "tas2781-hda", IRQ_RESOURCE_AUTO, 0 },
{}
},
.bus_type = SMI_AUTO_DETECT,
};

/*
* Note new device-ids must also be added to ignore_serial_bus_ids in
* drivers/acpi/scan.c: acpi_device_enumeration_by_parent().
Expand All @@ -396,6 +407,7 @@ static const struct acpi_device_id smi_acpi_ids[] = {
{ "CSC3556", (unsigned long)&cs35l56_hda },
{ "CSC3557", (unsigned long)&cs35l57_hda },
{ "INT3515", (unsigned long)&int3515_data },
{ "TXNW2781", (unsigned long)&tas2781_hda },
/* Non-conforming _HID for Cirrus Logic already released */
{ "CLSA0100", (unsigned long)&cs35l41_hda },
{ "CLSA0101", (unsigned long)&cs35l41_hda },
Expand Down
9 changes: 9 additions & 0 deletions include/sound/rawmidi.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,13 @@ long snd_rawmidi_kernel_read(struct snd_rawmidi_substream *substream,
long snd_rawmidi_kernel_write(struct snd_rawmidi_substream *substream,
const unsigned char *buf, long count);

/* set up the tied devices */
static inline void snd_rawmidi_tie_devices(struct snd_rawmidi *r1,
struct snd_rawmidi *r2)
{
/* tied_device field keeps the device+1 (so that 0 being unknown) */
r1->tied_device = r2->device + 1;
r2->tied_device = r1->device + 1;
}

#endif /* __SOUND_RAWMIDI_H */
7 changes: 7 additions & 0 deletions include/sound/simple_card_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ struct simple_util_priv {
#define simple_props_to_dai_codec(props, i) ((props)->codec_dai + i)
#define simple_props_to_codec_conf(props, i) ((props)->codec_conf + i)

/* has the same effect as simple_priv_to_props(). Preferred over
* simple_priv_to_props() when dealing with PCM runtime data as
* the ID stored in rtd->id may not be a valid array index.
*/
#define runtime_simple_priv_to_props(priv, rtd) \
((priv)->dai_props + ((rtd)->dai_link - (priv)->dai_link))

#define for_each_prop_dlc_cpus(props, i, cpu) \
for ((i) = 0; \
((i) < (props)->num.cpus) && \
Expand Down
3 changes: 3 additions & 0 deletions include/sound/soc-dai.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ int snd_soc_dai_set_channel_map(struct snd_soc_dai *dai,

int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate);

int snd_soc_dai_prepare(struct snd_soc_dai *dai,
struct snd_pcm_substream *substream);

/* Digital Audio Interface mute */
int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute,
int direction);
Expand Down
2 changes: 1 addition & 1 deletion include/uapi/sound/asound.h
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ enum {
#define SNDRV_RAWMIDI_INFO_UMP 0x00000008
#define SNDRV_RAWMIDI_INFO_STREAM_INACTIVE 0x00000010

#define SNDRV_RAWMIDI_DEVICE_UNKNOWN -1
#define SNDRV_RAWMIDI_DEVICE_UNKNOWN 0

struct snd_rawmidi_info {
unsigned int device; /* RO/WR (control): device number */
Expand Down
120 changes: 120 additions & 0 deletions include/uapi/sound/fcp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* Focusrite Control Protocol Driver for ALSA
*
* Copyright (c) 2024-2025 by Geoffrey D. Bennett <g at b4.vu>
*/
/*
* DOC: FCP (Focusrite Control Protocol) User-Space API
*
* This header defines the interface between the FCP kernel driver and
* user-space programs to enable the use of the proprietary features
* available in Focusrite USB audio interfaces. This includes Scarlett
* 2nd Gen, 3rd Gen, 4th Gen, Clarett USB, Clarett+, and Vocaster
* series devices.
*
* The interface is provided via ALSA's hwdep interface. Opening the
* hwdep device requires CAP_SYS_RAWIO privileges as this interface
* provides near-direct access.
*
* For details on the FCP protocol, refer to the kernel scarlett2
* driver in sound/usb/mixer_scarlett2.c and the fcp-support project
* at https://github.com/geoffreybennett/fcp-support
*
* For examples of using these IOCTLs, see the fcp-server source in
* the fcp-support project.
*
* IOCTL Interface
* --------------
* FCP_IOCTL_PVERSION:
* Returns the protocol version supported by the driver.
*
* FCP_IOCTL_INIT:
* Initialises the protocol and synchronises sequence numbers
* between the driver and device. Must be called at least once
* before sending commands. Can be safely called again at any time.
*
* FCP_IOCTL_CMD:
* Sends an FCP command to the device and returns the response.
* Requires prior initialisation via FCP_IOCTL_INIT.
*
* FCP_IOCTL_SET_METER_MAP:
* Configures the Level Meter control's mapping between device
* meters and control channels. Requires FCP_IOCTL_INIT to have been
* called first. The map size and number of slots cannot be changed
* after initial configuration, although the map itself can be
* updated. Once configured, the Level Meter remains functional even
* after the hwdep device is closed.
*
* FCP_IOCTL_SET_METER_LABELS:
* Set the labels for the Level Meter control. Requires
* FCP_IOCTL_SET_METER_MAP to have been called first. labels[]
* should contain a sequence of null-terminated labels corresponding
* to the control's channels.
*/
#ifndef __UAPI_SOUND_FCP_H
#define __UAPI_SOUND_FCP_H

#include <linux/types.h>
#include <linux/ioctl.h>

#define FCP_HWDEP_MAJOR 2
#define FCP_HWDEP_MINOR 0
#define FCP_HWDEP_SUBMINOR 0

#define FCP_HWDEP_VERSION \
((FCP_HWDEP_MAJOR << 16) | \
(FCP_HWDEP_MINOR << 8) | \
FCP_HWDEP_SUBMINOR)

#define FCP_HWDEP_VERSION_MAJOR(v) (((v) >> 16) & 0xFF)
#define FCP_HWDEP_VERSION_MINOR(v) (((v) >> 8) & 0xFF)
#define FCP_HWDEP_VERSION_SUBMINOR(v) ((v) & 0xFF)

/* Get protocol version */
#define FCP_IOCTL_PVERSION _IOR('S', 0x60, int)

/* Start the protocol */

/* Step 0 and step 2 responses are variable length and placed in
* resp[] one after the other.
*/
struct fcp_init {
__u16 step0_resp_size;
__u16 step2_resp_size;
__u32 init1_opcode;
__u32 init2_opcode;
__u8 resp[];
} __attribute__((packed));

#define FCP_IOCTL_INIT _IOWR('S', 0x64, struct fcp_init)

/* Perform a command */

/* The request data is placed in data[] and the response data will
* overwrite it.
*/
struct fcp_cmd {
__u32 opcode;
__u16 req_size;
__u16 resp_size;
__u8 data[];
} __attribute__((packed));
#define FCP_IOCTL_CMD _IOWR('S', 0x65, struct fcp_cmd)

/* Set the meter map */
struct fcp_meter_map {
__u16 map_size;
__u16 meter_slots;
__s16 map[];
} __attribute__((packed));
#define FCP_IOCTL_SET_METER_MAP _IOW('S', 0x66, struct fcp_meter_map)

/* Set the meter labels */
struct fcp_meter_labels {
__u16 labels_size;
char labels[];
} __attribute__((packed));
#define FCP_IOCTL_SET_METER_LABELS _IOW('S', 0x67, struct fcp_meter_labels)

#endif /* __UAPI_SOUND_FCP_H */
2 changes: 2 additions & 0 deletions include/uapi/sound/tlv.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#define SNDRV_CTL_TLVT_CHMAP_VAR 0x102 /* channels freely swappable */
#define SNDRV_CTL_TLVT_CHMAP_PAIRED 0x103 /* pair-wise swappable */

#define SNDRV_CTL_TLVT_FCP_CHANNEL_LABELS 0x110 /* channel labels */

/*
* TLV structure is right behind the struct snd_ctl_tlv:
* unsigned int type - see SNDRV_CTL_TLVT_*
Expand Down
1 change: 0 additions & 1 deletion sound/core/rawmidi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1837,7 +1837,6 @@ int snd_rawmidi_init(struct snd_rawmidi *rmidi,
INIT_LIST_HEAD(&rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams);
INIT_LIST_HEAD(&rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams);
rmidi->info_flags = info_flags;
rmidi->tied_device = SNDRV_RAWMIDI_DEVICE_UNKNOWN;

if (id != NULL)
strscpy(rmidi->id, id, sizeof(rmidi->id));
Expand Down
3 changes: 1 addition & 2 deletions sound/core/ump.c
Original file line number Diff line number Diff line change
Expand Up @@ -1382,8 +1382,7 @@ int snd_ump_attach_legacy_rawmidi(struct snd_ump_endpoint *ump,
ump_legacy_set_rawmidi_name(ump);
update_legacy_names(ump);

rmidi->tied_device = ump->core.device;
ump->core.tied_device = rmidi->device;
snd_rawmidi_tie_devices(rmidi, &ump->core);

ump_dbg(ump, "Created a legacy rawmidi #%d (%s)\n", device, id);
return 0;
Expand Down
Loading

0 comments on commit e0657c0

Please sign in to comment.