|
|
@@ -16,7 +16,7 @@ Signed-off-by: Maksim Kiselev <[email protected]>
|
|
|
|
|
|
--- a/sound/soc/sunxi/sun4i-codec.c
|
|
|
+++ b/sound/soc/sunxi/sun4i-codec.c
|
|
|
-@@ -232,15 +232,65 @@
|
|
|
+@@ -228,15 +228,65 @@
|
|
|
|
|
|
/* TODO H3 DAP (Digital Audio Processing) bits */
|
|
|
|
|
|
@@ -84,7 +84,7 @@ Signed-off-by: Maksim Kiselev <[email protected]>
|
|
|
struct regmap_field *reg_adc_fifoc;
|
|
|
|
|
|
struct snd_dmaengine_dai_dma_data capture_dma_data;
|
|
|
-@@ -250,33 +300,33 @@ struct sun4i_codec {
|
|
|
+@@ -246,33 +296,33 @@ struct sun4i_codec {
|
|
|
static void sun4i_codec_start_playback(struct sun4i_codec *scodec)
|
|
|
{
|
|
|
/* Flush TX FIFO */
|
|
|
@@ -126,7 +126,7 @@ Signed-off-by: Maksim Kiselev <[email protected]>
|
|
|
}
|
|
|
|
|
|
static int sun4i_codec_trigger(struct snd_pcm_substream *substream, int cmd,
|
|
|
-@@ -325,8 +375,8 @@ static int sun4i_codec_prepare_capture(s
|
|
|
+@@ -321,8 +371,8 @@ static int sun4i_codec_prepare_capture(s
|
|
|
|
|
|
/* Set RX FIFO trigger level */
|
|
|
regmap_field_update_bits(scodec->reg_adc_fifoc,
|
|
|
@@ -137,7 +137,7 @@ Signed-off-by: Maksim Kiselev <[email protected]>
|
|
|
|
|
|
/*
|
|
|
* FIXME: Undocumented in the datasheet, but
|
|
|
-@@ -360,13 +410,13 @@ static int sun4i_codec_prepare_playback(
|
|
|
+@@ -356,13 +406,13 @@ static int sun4i_codec_prepare_playback(
|
|
|
u32 val;
|
|
|
|
|
|
/* Flush the TX FIFO */
|
|
|
@@ -156,7 +156,7 @@ Signed-off-by: Maksim Kiselev <[email protected]>
|
|
|
|
|
|
if (substream->runtime->rate > 32000)
|
|
|
/* Use 64 bits FIR filter */
|
|
|
-@@ -375,13 +425,12 @@ static int sun4i_codec_prepare_playback(
|
|
|
+@@ -371,13 +421,12 @@ static int sun4i_codec_prepare_playback(
|
|
|
/* Use 32 bits FIR filter */
|
|
|
val = BIT(SUN4I_CODEC_DAC_FIFOC_FIR_VERSION);
|
|
|
|
|
|
@@ -174,7 +174,7 @@ Signed-off-by: Maksim Kiselev <[email protected]>
|
|
|
|
|
|
return 0;
|
|
|
};
|
|
|
-@@ -476,30 +525,32 @@ static int sun4i_codec_hw_params_capture
|
|
|
+@@ -472,30 +521,32 @@ static int sun4i_codec_hw_params_capture
|
|
|
7 << SUN4I_CODEC_ADC_FIFOC_ADC_FS,
|
|
|
hwrate << SUN4I_CODEC_ADC_FIFOC_ADC_FS);
|
|
|
|
|
|
@@ -218,7 +218,7 @@ Signed-off-by: Maksim Kiselev <[email protected]>
|
|
|
|
|
|
scodec->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
|
|
|
}
|
|
|
-@@ -514,9 +565,9 @@ static int sun4i_codec_hw_params_playbac
|
|
|
+@@ -510,9 +561,9 @@ static int sun4i_codec_hw_params_playbac
|
|
|
u32 val;
|
|
|
|
|
|
/* Set DAC sample rate */
|
|
|
@@ -231,7 +231,7 @@ Signed-off-by: Maksim Kiselev <[email protected]>
|
|
|
|
|
|
/* Set the number of channels we want to use */
|
|
|
if (params_channels(params) == 1)
|
|
|
-@@ -524,27 +575,26 @@ static int sun4i_codec_hw_params_playbac
|
|
|
+@@ -520,27 +571,26 @@ static int sun4i_codec_hw_params_playbac
|
|
|
else
|
|
|
val = 0;
|
|
|
|
|
|
@@ -269,7 +269,7 @@ Signed-off-by: Maksim Kiselev <[email protected]>
|
|
|
|
|
|
scodec->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
|
|
|
}
|
|
|
-@@ -565,7 +615,11 @@ static int sun4i_codec_hw_params(struct
|
|
|
+@@ -561,7 +611,11 @@ static int sun4i_codec_hw_params(struct
|
|
|
if (!clk_freq)
|
|
|
return -EINVAL;
|
|
|
|
|
|
@@ -282,7 +282,7 @@ Signed-off-by: Maksim Kiselev <[email protected]>
|
|
|
if (ret)
|
|
|
return ret;
|
|
|
|
|
|
-@@ -607,10 +661,14 @@ static int sun4i_codec_startup(struct sn
|
|
|
+@@ -587,10 +641,14 @@ static int sun4i_codec_startup(struct sn
|
|
|
* Stop issuing DRQ when we have room for less than 16 samples
|
|
|
* in our TX FIFO
|
|
|
*/
|
|
|
@@ -300,8 +300,8 @@ Signed-off-by: Maksim Kiselev <[email protected]>
|
|
|
}
|
|
|
|
|
|
static void sun4i_codec_shutdown(struct snd_pcm_substream *substream,
|
|
|
-@@ -619,7 +677,11 @@ static void sun4i_codec_shutdown(struct
|
|
|
- struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
|
|
+@@ -599,7 +657,11 @@ static void sun4i_codec_shutdown(struct
|
|
|
+ struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
|
|
|
struct sun4i_codec *scodec = snd_soc_card_get_drvdata(rtd->card);
|
|
|
|
|
|
- clk_disable_unprepare(scodec->clk_module);
|
|
|
@@ -313,7 +313,7 @@ Signed-off-by: Maksim Kiselev <[email protected]>
|
|
|
}
|
|
|
|
|
|
static const struct snd_soc_dai_ops sun4i_codec_dai_ops = {
|
|
|
-@@ -1229,6 +1291,55 @@ static const struct snd_soc_component_dr
|
|
|
+@@ -1216,6 +1278,55 @@ static const struct snd_soc_component_dr
|
|
|
.endianness = 1,
|
|
|
};
|
|
|
|
|
|
@@ -369,7 +369,7 @@ Signed-off-by: Maksim Kiselev <[email protected]>
|
|
|
static const struct snd_soc_component_driver sun4i_codec_component = {
|
|
|
.name = "sun4i-codec",
|
|
|
.legacy_dai_naming = 1,
|
|
|
-@@ -1532,6 +1643,66 @@ static struct snd_soc_card *sun8i_v3s_co
|
|
|
+@@ -1518,6 +1629,66 @@ static struct snd_soc_card *sun8i_v3s_co
|
|
|
return card;
|
|
|
};
|
|
|
|
|
|
@@ -436,7 +436,7 @@ Signed-off-by: Maksim Kiselev <[email protected]>
|
|
|
static const struct regmap_config sun4i_codec_regmap_config = {
|
|
|
.reg_bits = 32,
|
|
|
.reg_stride = 4,
|
|
|
-@@ -1574,21 +1745,22 @@ static const struct regmap_config sun8i_
|
|
|
+@@ -1560,21 +1731,22 @@ static const struct regmap_config sun8i_
|
|
|
.max_register = SUN8I_H3_CODEC_ADC_DBG,
|
|
|
};
|
|
|
|
|
|
@@ -467,7 +467,7 @@ Signed-off-by: Maksim Kiselev <[email protected]>
|
|
|
.reg_dac_txdata = SUN4I_CODEC_DAC_TXDATA,
|
|
|
.reg_adc_rxdata = SUN4I_CODEC_ADC_RXDATA,
|
|
|
};
|
|
|
-@@ -1597,7 +1769,11 @@ static const struct sun4i_codec_quirks s
|
|
|
+@@ -1583,7 +1755,11 @@ static const struct sun4i_codec_quirks s
|
|
|
.regmap_config = &sun6i_codec_regmap_config,
|
|
|
.codec = &sun6i_codec_codec,
|
|
|
.create_card = sun6i_codec_create_card,
|
|
|
@@ -479,7 +479,7 @@ Signed-off-by: Maksim Kiselev <[email protected]>
|
|
|
.reg_dac_txdata = SUN4I_CODEC_DAC_TXDATA,
|
|
|
.reg_adc_rxdata = SUN6I_CODEC_ADC_RXDATA,
|
|
|
.has_reset = true,
|
|
|
-@@ -1607,7 +1783,11 @@ static const struct sun4i_codec_quirks s
|
|
|
+@@ -1593,7 +1769,11 @@ static const struct sun4i_codec_quirks s
|
|
|
.regmap_config = &sun7i_codec_regmap_config,
|
|
|
.codec = &sun7i_codec_codec,
|
|
|
.create_card = sun4i_codec_create_card,
|
|
|
@@ -491,7 +491,7 @@ Signed-off-by: Maksim Kiselev <[email protected]>
|
|
|
.reg_dac_txdata = SUN4I_CODEC_DAC_TXDATA,
|
|
|
.reg_adc_rxdata = SUN4I_CODEC_ADC_RXDATA,
|
|
|
};
|
|
|
-@@ -1616,7 +1796,11 @@ static const struct sun4i_codec_quirks s
|
|
|
+@@ -1602,7 +1782,11 @@ static const struct sun4i_codec_quirks s
|
|
|
.regmap_config = &sun8i_a23_codec_regmap_config,
|
|
|
.codec = &sun8i_a23_codec_codec,
|
|
|
.create_card = sun8i_a23_codec_create_card,
|
|
|
@@ -503,7 +503,7 @@ Signed-off-by: Maksim Kiselev <[email protected]>
|
|
|
.reg_dac_txdata = SUN4I_CODEC_DAC_TXDATA,
|
|
|
.reg_adc_rxdata = SUN6I_CODEC_ADC_RXDATA,
|
|
|
.has_reset = true,
|
|
|
-@@ -1631,7 +1815,11 @@ static const struct sun4i_codec_quirks s
|
|
|
+@@ -1617,7 +1801,11 @@ static const struct sun4i_codec_quirks s
|
|
|
*/
|
|
|
.codec = &sun8i_a23_codec_codec,
|
|
|
.create_card = sun8i_h3_codec_create_card,
|
|
|
@@ -515,7 +515,7 @@ Signed-off-by: Maksim Kiselev <[email protected]>
|
|
|
.reg_dac_txdata = SUN8I_H3_CODEC_DAC_TXDATA,
|
|
|
.reg_adc_rxdata = SUN6I_CODEC_ADC_RXDATA,
|
|
|
.has_reset = true,
|
|
|
-@@ -1645,12 +1833,31 @@ static const struct sun4i_codec_quirks s
|
|
|
+@@ -1631,12 +1819,31 @@ static const struct sun4i_codec_quirks s
|
|
|
*/
|
|
|
.codec = &sun8i_a23_codec_codec,
|
|
|
.create_card = sun8i_v3s_codec_create_card,
|
|
|
@@ -547,7 +547,7 @@ Signed-off-by: Maksim Kiselev <[email protected]>
|
|
|
static const struct of_device_id sun4i_codec_of_match[] = {
|
|
|
{
|
|
|
.compatible = "allwinner,sun4i-a10-codec",
|
|
|
-@@ -1676,6 +1883,10 @@ static const struct of_device_id sun4i_c
|
|
|
+@@ -1662,6 +1869,10 @@ static const struct of_device_id sun4i_c
|
|
|
.compatible = "allwinner,sun8i-v3s-codec",
|
|
|
.data = &sun8i_v3s_codec_quirks,
|
|
|
},
|
|
|
@@ -558,7 +558,7 @@ Signed-off-by: Maksim Kiselev <[email protected]>
|
|
|
{}
|
|
|
};
|
|
|
MODULE_DEVICE_TABLE(of, sun4i_codec_of_match);
|
|
|
-@@ -1704,6 +1915,7 @@ static int sun4i_codec_probe(struct plat
|
|
|
+@@ -1690,6 +1901,7 @@ static int sun4i_codec_probe(struct plat
|
|
|
dev_err(&pdev->dev, "Failed to determine the quirks to use\n");
|
|
|
return -ENODEV;
|
|
|
}
|
|
|
@@ -566,7 +566,7 @@ Signed-off-by: Maksim Kiselev <[email protected]>
|
|
|
|
|
|
scodec->regmap = devm_regmap_init_mmio(&pdev->dev, base,
|
|
|
quirks->regmap_config);
|
|
|
-@@ -1719,10 +1931,24 @@ static int sun4i_codec_probe(struct plat
|
|
|
+@@ -1705,10 +1917,24 @@ static int sun4i_codec_probe(struct plat
|
|
|
return PTR_ERR(scodec->clk_apb);
|
|
|
}
|
|
|
|
|
|
@@ -595,7 +595,7 @@ Signed-off-by: Maksim Kiselev <[email protected]>
|
|
|
}
|
|
|
|
|
|
if (quirks->has_reset) {
|
|
|
-@@ -1751,6 +1977,16 @@ static int sun4i_codec_probe(struct plat
|
|
|
+@@ -1737,6 +1963,16 @@ static int sun4i_codec_probe(struct plat
|
|
|
dev_err(&pdev->dev, "Failed to create regmap fields: %d\n",
|
|
|
ret);
|
|
|
return ret;
|