Skip to content

Commit d35cdd6

Browse files
committed
Merge tag 'asoc-v6.17-2' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: More updates for v6.17 A few more updates, mostly fixes and device IDs plus some small enhancements for the FSL xcvr driver.
2 parents 8a15ca0 + e95122a commit d35cdd6

File tree

7 files changed

+172
-55
lines changed

7 files changed

+172
-55
lines changed

Documentation/devicetree/bindings/sound/atmel,at91-ssc.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,14 @@ description:
1616

1717
properties:
1818
compatible:
19-
enum:
20-
- atmel,at91rm9200-ssc
21-
- atmel,at91sam9g45-ssc
19+
oneOf:
20+
- enum:
21+
- atmel,at91rm9200-ssc
22+
- atmel,at91sam9g45-ssc
23+
- items:
24+
- enum:
25+
- microchip,sam9x7-ssc
26+
- const: atmel,at91sam9g45-ssc
2227

2328
reg:
2429
maxItems: 1

include/sound/sdca_function.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -742,14 +742,14 @@ struct sdca_control_range {
742742
* struct sdca_control - information for one SDCA Control
743743
* @label: Name for the Control, from SDCA Specification v1.0, section 7.1.7.
744744
* @sel: Identifier used for addressing.
745-
* @value: Holds the Control value for constants and defaults.
746745
* @nbits: Number of bits used in the Control.
747-
* @interrupt_position: SCDA interrupt line that will alert to changes on this
748-
* Control.
746+
* @values: Holds the Control value for constants and defaults.
749747
* @cn_list: A bitmask showing the valid Control Numbers within this Control,
750748
* Control Numbers typically represent channels.
751-
* @range: Buffer describing valid range of values for the Control.
749+
* @interrupt_position: SCDA interrupt line that will alert to changes on this
750+
* Control.
752751
* @type: Format of the data in the Control.
752+
* @range: Buffer describing valid range of values for the Control.
753753
* @mode: Access mode of the Control.
754754
* @layers: Bitmask of access layers of the Control.
755755
* @deferrable: Indicates if the access to the Control can be deferred.
@@ -760,13 +760,13 @@ struct sdca_control {
760760
const char *label;
761761
int sel;
762762

763-
int value;
764763
int nbits;
765-
int interrupt_position;
764+
int *values;
766765
u64 cn_list;
766+
int interrupt_position;
767767

768-
struct sdca_control_range range;
769768
enum sdca_control_datatype type;
769+
struct sdca_control_range range;
770770
enum sdca_access_mode mode;
771771
u8 layers;
772772

sound/soc/codecs/aw88399.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2330,9 +2330,18 @@ static const struct i2c_device_id aw88399_i2c_id[] = {
23302330
};
23312331
MODULE_DEVICE_TABLE(i2c, aw88399_i2c_id);
23322332

2333+
#ifdef CONFIG_ACPI
2334+
static const struct acpi_device_id aw88399_acpi_match[] = {
2335+
{ "AWDZ8399", 0 },
2336+
{ },
2337+
};
2338+
MODULE_DEVICE_TABLE(acpi, aw88399_acpi_match);
2339+
#endif
2340+
23332341
static struct i2c_driver aw88399_i2c_driver = {
23342342
.driver = {
23352343
.name = AW88399_I2C_NAME,
2344+
.acpi_match_table = ACPI_PTR(aw88399_acpi_match),
23362345
},
23372346
.probe = aw88399_i2c_probe,
23382347
.id_table = aw88399_i2c_id,

sound/soc/fsl/fsl_xcvr.c

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,7 +1395,7 @@ static irqreturn_t irq0_isr(int irq, void *devid)
13951395
if (isr & FSL_XCVR_IRQ_NEW_CS) {
13961396
dev_dbg(dev, "Received new CS block\n");
13971397
isr_clr |= FSL_XCVR_IRQ_NEW_CS;
1398-
if (!xcvr->soc_data->spdif_only) {
1398+
if (xcvr->soc_data->fw_name) {
13991399
/* Data RAM is 4KiB, last two pages: 8 and 9. Select page 8. */
14001400
regmap_update_bits(xcvr->regmap, FSL_XCVR_EXT_CTRL,
14011401
FSL_XCVR_EXT_CTRL_PAGE_MASK,
@@ -1423,6 +1423,26 @@ static irqreturn_t irq0_isr(int irq, void *devid)
14231423
/* clear CS control register */
14241424
memset_io(reg_ctrl, 0, sizeof(val));
14251425
}
1426+
} else {
1427+
regmap_read(xcvr->regmap, FSL_XCVR_RX_CS_DATA_0,
1428+
(u32 *)&xcvr->rx_iec958.status[0]);
1429+
regmap_read(xcvr->regmap, FSL_XCVR_RX_CS_DATA_1,
1430+
(u32 *)&xcvr->rx_iec958.status[4]);
1431+
regmap_read(xcvr->regmap, FSL_XCVR_RX_CS_DATA_2,
1432+
(u32 *)&xcvr->rx_iec958.status[8]);
1433+
regmap_read(xcvr->regmap, FSL_XCVR_RX_CS_DATA_3,
1434+
(u32 *)&xcvr->rx_iec958.status[12]);
1435+
regmap_read(xcvr->regmap, FSL_XCVR_RX_CS_DATA_4,
1436+
(u32 *)&xcvr->rx_iec958.status[16]);
1437+
regmap_read(xcvr->regmap, FSL_XCVR_RX_CS_DATA_5,
1438+
(u32 *)&xcvr->rx_iec958.status[20]);
1439+
for (i = 0; i < 6; i++) {
1440+
val = *(u32 *)(xcvr->rx_iec958.status + i * 4);
1441+
*(u32 *)(xcvr->rx_iec958.status + i * 4) =
1442+
bitrev32(val);
1443+
}
1444+
regmap_set_bits(xcvr->regmap, FSL_XCVR_RX_DPTH_CTRL,
1445+
FSL_XCVR_RX_DPTH_CTRL_CSA);
14261446
}
14271447
}
14281448
if (isr & FSL_XCVR_IRQ_NEW_UD) {
@@ -1497,6 +1517,7 @@ static const struct fsl_xcvr_soc_data fsl_xcvr_imx93_data = {
14971517
};
14981518

14991519
static const struct fsl_xcvr_soc_data fsl_xcvr_imx95_data = {
1520+
.fw_name = "imx/xcvr/xcvr-imx95.bin",
15001521
.spdif_only = true,
15011522
.use_phy = true,
15021523
.use_edma = true,
@@ -1786,7 +1807,7 @@ static int fsl_xcvr_runtime_resume(struct device *dev)
17861807
}
17871808
}
17881809

1789-
if (xcvr->mode == FSL_XCVR_MODE_EARC) {
1810+
if (xcvr->soc_data->fw_name) {
17901811
ret = fsl_xcvr_load_firmware(xcvr);
17911812
if (ret) {
17921813
dev_err(dev, "failed to load firmware.\n");

sound/soc/fsl/imx-card.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ enum codec_type {
2626
CODEC_AK4497,
2727
CODEC_AK5552,
2828
CODEC_CS42888,
29+
CODEC_WM8524,
2930
};
3031

3132
/*
@@ -196,6 +197,13 @@ static struct imx_akcodec_tdm_fs_mul cs42888_tdm_fs_mul[] = {
196197
{ .min = 256, .max = 256, .mul = 256 },
197198
};
198199

200+
static struct imx_akcodec_fs_mul wm8524_fs_mul[] = {
201+
{ .rmin = 8000, .rmax = 32000, .wmin = 256, .wmax = 1152, },
202+
{ .rmin = 44100, .rmax = 48000, .wmin = 256, .wmax = 768, },
203+
{ .rmin = 88200, .rmax = 96000, .wmin = 128, .wmax = 384, },
204+
{ .rmin = 176400, .rmax = 192000, .wmin = 128, .wmax = 192, },
205+
};
206+
199207
static const u32 akcodec_rates[] = {
200208
8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200,
201209
96000, 176400, 192000, 352800, 384000, 705600, 768000,
@@ -229,6 +237,10 @@ static const u32 cs42888_tdm_channels[] = {
229237
1, 2, 3, 4, 5, 6, 7, 8,
230238
};
231239

240+
static const u32 wm8524_channels[] = {
241+
2,
242+
};
243+
232244
static bool format_is_dsd(struct snd_pcm_hw_params *params)
233245
{
234246
snd_pcm_format_t format = params_format(params);
@@ -261,6 +273,7 @@ static bool codec_is_akcodec(unsigned int type)
261273
case CODEC_AK5558:
262274
case CODEC_AK5552:
263275
case CODEC_CS42888:
276+
case CODEC_WM8524:
264277
return true;
265278
default:
266279
break;
@@ -477,9 +490,24 @@ static int imx_aif_startup(struct snd_pcm_substream *substream)
477490
return ret;
478491
}
479492

493+
static void imx_aif_shutdown(struct snd_pcm_substream *substream)
494+
{
495+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
496+
struct snd_soc_dai *cpu_dai;
497+
struct snd_soc_dai *codec_dai;
498+
int i;
499+
500+
for_each_rtd_cpu_dais(rtd, i, cpu_dai)
501+
snd_soc_dai_set_sysclk(cpu_dai, 0, 0, SND_SOC_CLOCK_OUT);
502+
503+
for_each_rtd_codec_dais(rtd, i, codec_dai)
504+
snd_soc_dai_set_sysclk(codec_dai, 0, 0, SND_SOC_CLOCK_IN);
505+
}
506+
480507
static const struct snd_soc_ops imx_aif_ops = {
481508
.hw_params = imx_aif_hw_params,
482509
.startup = imx_aif_startup,
510+
.shutdown = imx_aif_shutdown,
483511
};
484512

485513
static const struct snd_soc_ops imx_aif_ops_be = {
@@ -632,6 +660,8 @@ static int imx_card_parse_of(struct imx_card_data *data)
632660
plat_data->type = CODEC_AK5552;
633661
else if (!strcmp(link->codecs->dai_name, "cs42888"))
634662
plat_data->type = CODEC_CS42888;
663+
else if (!strcmp(link->codecs->dai_name, "wm8524-hifi"))
664+
plat_data->type = CODEC_WM8524;
635665

636666
} else {
637667
link->codecs = &snd_soc_dummy_dlc;
@@ -805,6 +835,10 @@ static int imx_card_probe(struct platform_device *pdev)
805835
data->dapm_routes[1].sink = "CPU-Capture";
806836
data->dapm_routes[1].source = "Capture";
807837
break;
838+
case CODEC_WM8524:
839+
data->dapm_routes[0].sink = "Playback";
840+
data->dapm_routes[0].source = "CPU-Playback";
841+
break;
808842
default:
809843
break;
810844
}
@@ -854,6 +888,12 @@ static int imx_card_probe(struct platform_device *pdev)
854888
plat_data->support_tdm_channels = cs42888_tdm_channels;
855889
plat_data->num_tdm_channels = ARRAY_SIZE(cs42888_tdm_channels);
856890
break;
891+
case CODEC_WM8524:
892+
plat_data->fs_mul = wm8524_fs_mul;
893+
plat_data->num_fs_mul = ARRAY_SIZE(wm8524_fs_mul);
894+
plat_data->support_channels = wm8524_channels;
895+
plat_data->num_channels = ARRAY_SIZE(wm8524_channels);
896+
break;
857897
default:
858898
break;
859899
}

sound/soc/sdca/sdca_functions.c

Lines changed: 62 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,43 @@ static int find_sdca_control_range(struct device *dev,
814814
return 0;
815815
}
816816

817+
static int find_sdca_control_value(struct device *dev, struct sdca_entity *entity,
818+
struct fwnode_handle *control_node,
819+
struct sdca_control *control,
820+
const char * const label)
821+
{
822+
char property[SDCA_PROPERTY_LENGTH];
823+
bool global = true;
824+
int ret, cn, i;
825+
u32 tmp;
826+
827+
snprintf(property, sizeof(property), "mipi-sdca-control-%s", label);
828+
829+
ret = fwnode_property_read_u32(control_node, property, &tmp);
830+
if (ret == -EINVAL)
831+
global = false;
832+
else if (ret)
833+
return ret;
834+
835+
i = 0;
836+
for_each_set_bit(cn, (unsigned long *)&control->cn_list,
837+
BITS_PER_TYPE(control->cn_list)) {
838+
if (!global) {
839+
snprintf(property, sizeof(property),
840+
"mipi-sdca-control-cn-%d-%s", cn, label);
841+
842+
ret = fwnode_property_read_u32(control_node, property, &tmp);
843+
if (ret)
844+
return ret;
845+
}
846+
847+
control->values[i] = tmp;
848+
i++;
849+
}
850+
851+
return 0;
852+
}
853+
817854
/*
818855
* TODO: Add support for -cn- properties, allowing different channels to have
819856
* different defaults etc.
@@ -843,44 +880,44 @@ static int find_sdca_entity_control(struct device *dev, struct sdca_entity *enti
843880

844881
control->layers = tmp;
845882

883+
ret = fwnode_property_read_u64(control_node, "mipi-sdca-control-cn-list",
884+
&control->cn_list);
885+
if (ret == -EINVAL) {
886+
/* Spec allows not specifying cn-list if only the first number is used */
887+
control->cn_list = 0x1;
888+
} else if (ret || !control->cn_list) {
889+
dev_err(dev, "%s: control %#x: cn list missing: %d\n",
890+
entity->label, control->sel, ret);
891+
return ret;
892+
}
893+
894+
control->values = devm_kzalloc(dev, hweight64(control->cn_list), GFP_KERNEL);
895+
if (!control->values)
896+
return -ENOMEM;
897+
846898
switch (control->mode) {
847899
case SDCA_ACCESS_MODE_DC:
848-
ret = fwnode_property_read_u32(control_node,
849-
"mipi-sdca-control-dc-value",
850-
&tmp);
900+
ret = find_sdca_control_value(dev, entity, control_node, control,
901+
"dc-value");
851902
if (ret) {
852903
dev_err(dev, "%s: control %#x: dc value missing: %d\n",
853904
entity->label, control->sel, ret);
854905
return ret;
855906
}
856907

857-
control->value = tmp;
858908
control->has_fixed = true;
859909
break;
860910
case SDCA_ACCESS_MODE_RW:
861911
case SDCA_ACCESS_MODE_DUAL:
862-
ret = fwnode_property_read_u32(control_node,
863-
"mipi-sdca-control-default-value",
864-
&tmp);
865-
if (!ret) {
866-
control->value = tmp;
912+
ret = find_sdca_control_value(dev, entity, control_node, control,
913+
"default-value");
914+
if (!ret)
867915
control->has_default = true;
868-
}
869-
870-
ret = fwnode_property_read_u32(control_node,
871-
"mipi-sdca-control-fixed-value",
872-
&tmp);
873-
if (!ret) {
874-
if (control->has_default && control->value != tmp) {
875-
dev_err(dev,
876-
"%s: control %#x: default and fixed value don't match\n",
877-
entity->label, control->sel);
878-
return -EINVAL;
879-
}
880916

881-
control->value = tmp;
917+
ret = find_sdca_control_value(dev, entity, control_node, control,
918+
"fixed-value");
919+
if (!ret)
882920
control->has_fixed = true;
883-
}
884921
fallthrough;
885922
case SDCA_ACCESS_MODE_RO:
886923
control->deferrable = fwnode_property_read_bool(control_node,
@@ -897,17 +934,6 @@ static int find_sdca_entity_control(struct device *dev, struct sdca_entity *enti
897934
return ret;
898935
}
899936

900-
ret = fwnode_property_read_u64(control_node, "mipi-sdca-control-cn-list",
901-
&control->cn_list);
902-
if (ret == -EINVAL) {
903-
/* Spec allows not specifying cn-list if only the first number is used */
904-
control->cn_list = 0x1;
905-
} else if (ret || !control->cn_list) {
906-
dev_err(dev, "%s: control %#x: cn list missing: %d\n",
907-
entity->label, control->sel, ret);
908-
return ret;
909-
}
910-
911937
ret = fwnode_property_read_u32(control_node,
912938
"mipi-sdca-control-interrupt-position",
913939
&tmp);
@@ -923,11 +949,10 @@ static int find_sdca_entity_control(struct device *dev, struct sdca_entity *enti
923949
control->type = find_sdca_control_datatype(entity, control);
924950
control->nbits = find_sdca_control_bits(entity, control);
925951

926-
dev_info(dev, "%s: %s: control %#x mode %#x layers %#x cn %#llx int %d value %#x %s\n",
952+
dev_info(dev, "%s: %s: control %#x mode %#x layers %#x cn %#llx int %d %s\n",
927953
entity->label, control->label, control->sel,
928954
control->mode, control->layers, control->cn_list,
929-
control->interrupt_position, control->value,
930-
control->deferrable ? "deferrable" : "");
955+
control->interrupt_position, control->deferrable ? "deferrable" : "");
931956

932957
return 0;
933958
}

0 commit comments

Comments
 (0)