Commit 43900951 authored by Geoffrey D. Bennett's avatar Geoffrey D. Bennett Committed by Takashi Iwai

ALSA: scarlett2: Rename gen4_write_addr to param_buf_addr

The location pointed to by gen4_write_addr and gen4_write_addr + 1 is
officially known as the parameter buffer. Update the code to match.
Signed-off-by: default avatarGeoffrey D. Bennett <g@b4.vu>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Message-ID: <aa36ecb8d3ce67387b5edf6c900f0b8a509241ce.1710264833.git.g@b4.vu>
parent 5bfb7c2a
...@@ -438,9 +438,9 @@ enum { ...@@ -438,9 +438,9 @@ enum {
/* Location, size, and activation command number for the configuration /* Location, size, and activation command number for the configuration
* parameters. Size is in bits and may be 0, 1, 8, or 16. * parameters. Size is in bits and may be 0, 1, 8, or 16.
* *
* A size of 0 indicates that the parameter is a byte-sized Scarlett * A size of 0 indicates that the parameter is a byte-sized
* Gen 4 configuration which is written through the gen4_write_addr * configuration which is set through the parameter buffer (but still
* location (but still read through the given offset location). * read through the given offset location).
* *
* Some Gen 4 configuration parameters are written with 0x02 for a * Some Gen 4 configuration parameters are written with 0x02 for a
* desired value of 0x01, and 0x03 for 0x00. These are indicated with * desired value of 0x01, and 0x03 for 0x00. These are indicated with
...@@ -457,7 +457,7 @@ struct scarlett2_config { ...@@ -457,7 +457,7 @@ struct scarlett2_config {
struct scarlett2_config_set { struct scarlett2_config_set {
const struct scarlett2_notification *notifications; const struct scarlett2_notification *notifications;
u16 gen4_write_addr; u16 param_buf_addr;
const struct scarlett2_config items[SCARLETT2_CONFIG_COUNT]; const struct scarlett2_config items[SCARLETT2_CONFIG_COUNT];
}; };
...@@ -625,7 +625,7 @@ static const struct scarlett2_config_set scarlett2_config_set_gen3c = { ...@@ -625,7 +625,7 @@ static const struct scarlett2_config_set scarlett2_config_set_gen3c = {
/* Solo Gen 4 */ /* Solo Gen 4 */
static const struct scarlett2_config_set scarlett2_config_set_gen4_solo = { static const struct scarlett2_config_set scarlett2_config_set_gen4_solo = {
.notifications = scarlett4_solo_notifications, .notifications = scarlett4_solo_notifications,
.gen4_write_addr = 0xd8, .param_buf_addr = 0xd8,
.items = { .items = {
[SCARLETT2_CONFIG_MSD_SWITCH] = { [SCARLETT2_CONFIG_MSD_SWITCH] = {
.offset = 0x47, .size = 8, .activate = 4 }, .offset = 0x47, .size = 8, .activate = 4 },
...@@ -653,7 +653,7 @@ static const struct scarlett2_config_set scarlett2_config_set_gen4_solo = { ...@@ -653,7 +653,7 @@ static const struct scarlett2_config_set scarlett2_config_set_gen4_solo = {
/* 2i2 Gen 4 */ /* 2i2 Gen 4 */
static const struct scarlett2_config_set scarlett2_config_set_gen4_2i2 = { static const struct scarlett2_config_set scarlett2_config_set_gen4_2i2 = {
.notifications = scarlett4_2i2_notifications, .notifications = scarlett4_2i2_notifications,
.gen4_write_addr = 0xfc, .param_buf_addr = 0xfc,
.items = { .items = {
[SCARLETT2_CONFIG_MSD_SWITCH] = { [SCARLETT2_CONFIG_MSD_SWITCH] = {
.offset = 0x49, .size = 8, .activate = 4 }, // 0x41 ?? .offset = 0x49, .size = 8, .activate = 4 }, // 0x41 ??
...@@ -696,7 +696,7 @@ static const struct scarlett2_config_set scarlett2_config_set_gen4_2i2 = { ...@@ -696,7 +696,7 @@ static const struct scarlett2_config_set scarlett2_config_set_gen4_2i2 = {
/* 4i4 Gen 4 */ /* 4i4 Gen 4 */
static const struct scarlett2_config_set scarlett2_config_set_gen4_4i4 = { static const struct scarlett2_config_set scarlett2_config_set_gen4_4i4 = {
.notifications = scarlett4_4i4_notifications, .notifications = scarlett4_4i4_notifications,
.gen4_write_addr = 0x130, .param_buf_addr = 0x130,
.items = { .items = {
[SCARLETT2_CONFIG_MSD_SWITCH] = { [SCARLETT2_CONFIG_MSD_SWITCH] = {
.offset = 0x5c, .size = 8, .activate = 4 }, .offset = 0x5c, .size = 8, .activate = 4 },
...@@ -2080,7 +2080,7 @@ static int scarlett2_usb_get_config( ...@@ -2080,7 +2080,7 @@ static int scarlett2_usb_get_config(
if (!config_item->offset) if (!config_item->offset)
return -EFAULT; return -EFAULT;
/* Gen 4 style parameters are always 1 byte */ /* Writes to the parameter buffer are always 1 byte */
size = config_item->size ? config_item->size : 8; size = config_item->size ? config_item->size : 8;
/* For byte-sized parameters, retrieve directly into buf */ /* For byte-sized parameters, retrieve directly into buf */
...@@ -2167,23 +2167,23 @@ static int scarlett2_usb_set_config( ...@@ -2167,23 +2167,23 @@ static int scarlett2_usb_set_config(
if (!config_item->offset) if (!config_item->offset)
return -EFAULT; return -EFAULT;
/* Gen 4 style writes are selected with size = 0; /* Writes via the parameter buffer are selected with size = 0;
* these are only byte-sized values written through a shared * these are only byte-sized values written through a shared
* location, different to the read address * location, different to the read address
*/ */
if (!config_item->size) { if (!config_item->size) {
if (!config_set->gen4_write_addr) if (!config_set->param_buf_addr)
return -EFAULT; return -EFAULT;
/* Place index in gen4_write_addr + 1 */ /* Place index in param_buf_addr + 1 */
err = scarlett2_usb_set_data( err = scarlett2_usb_set_data(
mixer, config_set->gen4_write_addr + 1, 1, index); mixer, config_set->param_buf_addr + 1, 1, index);
if (err < 0) if (err < 0)
return err; return err;
/* Place value in gen4_write_addr */ /* Place value in param_buf_addr */
err = scarlett2_usb_set_data( err = scarlett2_usb_set_data(
mixer, config_set->gen4_write_addr, 1, value); mixer, config_set->param_buf_addr, 1, value);
if (err < 0) if (err < 0)
return err; return err;
...@@ -2192,9 +2192,8 @@ static int scarlett2_usb_set_config( ...@@ -2192,9 +2192,8 @@ static int scarlett2_usb_set_config(
mixer, config_item->activate); mixer, config_item->activate);
} }
/* Not-Gen 4 style needs NVRAM save, supports /* Direct writes (not via the parameter buffer) need NVRAM
* bit-modification, and writing is done to the same place * save and support bit-modification
* that the value can be read from
*/ */
/* Cancel any pending NVRAM save */ /* Cancel any pending NVRAM save */
...@@ -2238,8 +2237,8 @@ static int scarlett2_usb_set_config( ...@@ -2238,8 +2237,8 @@ static int scarlett2_usb_set_config(
if (err < 0) if (err < 0)
return err; return err;
/* Gen 2 style writes to Gen 4 devices don't need saving */ /* Writes via the parameter buffer don't need a separate save step */
if (config_set->gen4_write_addr) if (config_set->param_buf_addr)
return 0; return 0;
/* Schedule the change to be written to NVRAM */ /* Schedule the change to be written to NVRAM */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment