* [PATCH v2 01/10] dma-engine: sun4i: Add a quirk to support different chips
@ 2024-10-27 9:14 Csókás, Bence
2024-10-27 9:14 ` [PATCH v2 02/10] dma-engine: sun4i: Add has_reset option to quirk Csókás, Bence
` (8 more replies)
0 siblings, 9 replies; 24+ messages in thread
From: Csókás, Bence @ 2024-10-27 9:14 UTC (permalink / raw)
To: dmaengine, linux-arm-kernel, linux-sunxi, linux-kernel
Cc: Mesih Kilinc, Csókás, Bence, Vinod Koul, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland
From: Mesih Kilinc <mesihkilinc@gmail.com>
Allwinner suniv F1C100s has similar DMA engine to sun4i. Several
registers has different addresses. Total dma channels, endpoint counts
and max burst counts are also different.
In order to support F1C100s add a quirk structure to hold IC specific
data.
Signed-off-by: Mesih Kilinc <mesihkilinc@gmail.com>
[ csokas.bence: Resolve conflict in `sun4i_dma_prep_dma_cyclic()`, fix whitespace ]
Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
---
Notes:
Changes in v2:
* Whitespace
drivers/dma/sun4i-dma.c | 138 ++++++++++++++++++++++++++++++----------
1 file changed, 106 insertions(+), 32 deletions(-)
diff --git a/drivers/dma/sun4i-dma.c b/drivers/dma/sun4i-dma.c
index 2e7f9b07fdd2..d472f57a39ea 100644
--- a/drivers/dma/sun4i-dma.c
+++ b/drivers/dma/sun4i-dma.c
@@ -13,6 +13,7 @@
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/of_dma.h>
+#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
@@ -31,6 +32,8 @@
#define SUN4I_DMA_CFG_SRC_ADDR_MODE(mode) ((mode) << 5)
#define SUN4I_DMA_CFG_SRC_DRQ_TYPE(type) (type)
+#define SUN4I_MAX_BURST 8
+
/** Normal DMA register values **/
/* Normal DMA source/destination data request type values */
@@ -132,6 +135,32 @@
#define SUN4I_DDMA_MAX_SEG_SIZE SZ_16M
#define SUN4I_DMA_MAX_SEG_SIZE SUN4I_NDMA_MAX_SEG_SIZE
+/*
+ * Hardware channels / ports representation
+ *
+ * The hardware is used in several SoCs, with differing numbers
+ * of channels and endpoints. This structure ties those numbers
+ * to a certain compatible string.
+ */
+struct sun4i_dma_config {
+ u32 ndma_nr_max_channels;
+ u32 ndma_nr_max_vchans;
+
+ u32 ddma_nr_max_channels;
+ u32 ddma_nr_max_vchans;
+
+ u32 dma_nr_max_channels;
+
+ void (*set_dst_data_width)(u32 *p_cfg, s8 data_width);
+ void (*set_src_data_width)(u32 *p_cfg, s8 data_width);
+ int (*convert_burst)(u32 maxburst);
+
+ u8 ndma_drq_sdram;
+ u8 ddma_drq_sdram;
+
+ u8 max_burst;
+};
+
struct sun4i_dma_pchan {
/* Register base of channel */
void __iomem *base;
@@ -170,7 +199,7 @@ struct sun4i_dma_contract {
};
struct sun4i_dma_dev {
- DECLARE_BITMAP(pchans_used, SUN4I_DMA_NR_MAX_CHANNELS);
+ unsigned long *pchans_used;
struct dma_device slave;
struct sun4i_dma_pchan *pchans;
struct sun4i_dma_vchan *vchans;
@@ -178,6 +207,7 @@ struct sun4i_dma_dev {
struct clk *clk;
int irq;
spinlock_t lock;
+ const struct sun4i_dma_config *cfg;
};
static struct sun4i_dma_dev *to_sun4i_dma_dev(struct dma_device *dev)
@@ -200,7 +230,17 @@ static struct device *chan2dev(struct dma_chan *chan)
return &chan->dev->device;
}
-static int convert_burst(u32 maxburst)
+static void set_dst_data_width_a10(u32 *p_cfg, s8 data_width)
+{
+ *p_cfg |= SUN4I_DMA_CFG_DST_DATA_WIDTH(data_width);
+}
+
+static void set_src_data_width_a10(u32 *p_cfg, s8 data_width)
+{
+ *p_cfg |= SUN4I_DMA_CFG_SRC_DATA_WIDTH(data_width);
+}
+
+static int convert_burst_a10(u32 maxburst)
{
if (maxburst > 8)
return -EINVAL;
@@ -233,15 +273,15 @@ static struct sun4i_dma_pchan *find_and_use_pchan(struct sun4i_dma_dev *priv,
int i, max;
/*
- * pchans 0-SUN4I_NDMA_NR_MAX_CHANNELS are normal, and
- * SUN4I_NDMA_NR_MAX_CHANNELS+ are dedicated ones
+ * pchans 0-priv->cfg->ndma_nr_max_channels are normal, and
+ * priv->cfg->ndma_nr_max_channels+ are dedicated ones
*/
if (vchan->is_dedicated) {
- i = SUN4I_NDMA_NR_MAX_CHANNELS;
- max = SUN4I_DMA_NR_MAX_CHANNELS;
+ i = priv->cfg->ndma_nr_max_channels;
+ max = priv->cfg->dma_nr_max_channels;
} else {
i = 0;
- max = SUN4I_NDMA_NR_MAX_CHANNELS;
+ max = priv->cfg->ndma_nr_max_channels;
}
spin_lock_irqsave(&priv->lock, flags);
@@ -444,6 +484,7 @@ generate_ndma_promise(struct dma_chan *chan, dma_addr_t src, dma_addr_t dest,
size_t len, struct dma_slave_config *sconfig,
enum dma_transfer_direction direction)
{
+ struct sun4i_dma_dev *priv = to_sun4i_dma_dev(chan->device);
struct sun4i_dma_promise *promise;
int ret;
@@ -467,13 +508,13 @@ generate_ndma_promise(struct dma_chan *chan, dma_addr_t src, dma_addr_t dest,
sconfig->src_addr_width, sconfig->dst_addr_width);
/* Source burst */
- ret = convert_burst(sconfig->src_maxburst);
+ ret = priv->cfg->convert_burst(sconfig->src_maxburst);
if (ret < 0)
goto fail;
promise->cfg |= SUN4I_DMA_CFG_SRC_BURST_LENGTH(ret);
/* Destination burst */
- ret = convert_burst(sconfig->dst_maxburst);
+ ret = priv->cfg->convert_burst(sconfig->dst_maxburst);
if (ret < 0)
goto fail;
promise->cfg |= SUN4I_DMA_CFG_DST_BURST_LENGTH(ret);
@@ -482,13 +523,13 @@ generate_ndma_promise(struct dma_chan *chan, dma_addr_t src, dma_addr_t dest,
ret = convert_buswidth(sconfig->src_addr_width);
if (ret < 0)
goto fail;
- promise->cfg |= SUN4I_DMA_CFG_SRC_DATA_WIDTH(ret);
+ priv->cfg->set_src_data_width(&promise->cfg, ret);
/* Destination bus width */
ret = convert_buswidth(sconfig->dst_addr_width);
if (ret < 0)
goto fail;
- promise->cfg |= SUN4I_DMA_CFG_DST_DATA_WIDTH(ret);
+ priv->cfg->set_dst_data_width(&promise->cfg, ret);
return promise;
@@ -510,6 +551,7 @@ static struct sun4i_dma_promise *
generate_ddma_promise(struct dma_chan *chan, dma_addr_t src, dma_addr_t dest,
size_t len, struct dma_slave_config *sconfig)
{
+ struct sun4i_dma_dev *priv = to_sun4i_dma_dev(chan->device);
struct sun4i_dma_promise *promise;
int ret;
@@ -524,13 +566,13 @@ generate_ddma_promise(struct dma_chan *chan, dma_addr_t src, dma_addr_t dest,
SUN4I_DDMA_CFG_BYTE_COUNT_MODE_REMAIN;
/* Source burst */
- ret = convert_burst(sconfig->src_maxburst);
+ ret = priv->cfg->convert_burst(sconfig->src_maxburst);
if (ret < 0)
goto fail;
promise->cfg |= SUN4I_DMA_CFG_SRC_BURST_LENGTH(ret);
/* Destination burst */
- ret = convert_burst(sconfig->dst_maxburst);
+ ret = priv->cfg->convert_burst(sconfig->dst_maxburst);
if (ret < 0)
goto fail;
promise->cfg |= SUN4I_DMA_CFG_DST_BURST_LENGTH(ret);
@@ -539,13 +581,13 @@ generate_ddma_promise(struct dma_chan *chan, dma_addr_t src, dma_addr_t dest,
ret = convert_buswidth(sconfig->src_addr_width);
if (ret < 0)
goto fail;
- promise->cfg |= SUN4I_DMA_CFG_SRC_DATA_WIDTH(ret);
+ priv->cfg->set_src_data_width(&promise->cfg, ret);
/* Destination bus width */
ret = convert_buswidth(sconfig->dst_addr_width);
if (ret < 0)
goto fail;
- promise->cfg |= SUN4I_DMA_CFG_DST_DATA_WIDTH(ret);
+ priv->cfg->set_dst_data_width(&promise->cfg, ret);
return promise;
@@ -622,6 +664,7 @@ static struct dma_async_tx_descriptor *
sun4i_dma_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest,
dma_addr_t src, size_t len, unsigned long flags)
{
+ struct sun4i_dma_dev *priv = to_sun4i_dma_dev(chan->device);
struct sun4i_dma_vchan *vchan = to_sun4i_dma_vchan(chan);
struct dma_slave_config *sconfig = &vchan->cfg;
struct sun4i_dma_promise *promise;
@@ -638,8 +681,8 @@ sun4i_dma_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest,
*/
sconfig->src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
sconfig->dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
- sconfig->src_maxburst = 8;
- sconfig->dst_maxburst = 8;
+ sconfig->src_maxburst = priv->cfg->max_burst;
+ sconfig->dst_maxburst = priv->cfg->max_burst;
if (vchan->is_dedicated)
promise = generate_ddma_promise(chan, src, dest, len, sconfig);
@@ -654,11 +697,13 @@ sun4i_dma_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest,
/* Configure memcpy mode */
if (vchan->is_dedicated) {
- promise->cfg |= SUN4I_DMA_CFG_SRC_DRQ_TYPE(SUN4I_DDMA_DRQ_TYPE_SDRAM) |
- SUN4I_DMA_CFG_DST_DRQ_TYPE(SUN4I_DDMA_DRQ_TYPE_SDRAM);
+ promise->cfg |=
+ SUN4I_DMA_CFG_SRC_DRQ_TYPE(priv->cfg->ddma_drq_sdram) |
+ SUN4I_DMA_CFG_DST_DRQ_TYPE(priv->cfg->ddma_drq_sdram);
} else {
- promise->cfg |= SUN4I_DMA_CFG_SRC_DRQ_TYPE(SUN4I_NDMA_DRQ_TYPE_SDRAM) |
- SUN4I_DMA_CFG_DST_DRQ_TYPE(SUN4I_NDMA_DRQ_TYPE_SDRAM);
+ promise->cfg |=
+ SUN4I_DMA_CFG_SRC_DRQ_TYPE(priv->cfg->ndma_drq_sdram) |
+ SUN4I_DMA_CFG_DST_DRQ_TYPE(priv->cfg->ndma_drq_sdram);
}
/* Fill the contract with our only promise */
@@ -673,6 +718,7 @@ sun4i_dma_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf, size_t len,
size_t period_len, enum dma_transfer_direction dir,
unsigned long flags)
{
+ struct sun4i_dma_dev *priv = to_sun4i_dma_dev(chan->device);
struct sun4i_dma_vchan *vchan = to_sun4i_dma_vchan(chan);
struct dma_slave_config *sconfig = &vchan->cfg;
struct sun4i_dma_promise *promise;
@@ -696,11 +742,11 @@ sun4i_dma_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf, size_t len,
if (vchan->is_dedicated) {
io_mode = SUN4I_DDMA_ADDR_MODE_IO;
linear_mode = SUN4I_DDMA_ADDR_MODE_LINEAR;
- ram_type = SUN4I_DDMA_DRQ_TYPE_SDRAM;
+ ram_type = priv->cfg->ddma_drq_sdram;
} else {
io_mode = SUN4I_NDMA_ADDR_MODE_IO;
linear_mode = SUN4I_NDMA_ADDR_MODE_LINEAR;
- ram_type = SUN4I_NDMA_DRQ_TYPE_SDRAM;
+ ram_type = priv->cfg->ndma_drq_sdram;
}
if (dir == DMA_MEM_TO_DEV) {
@@ -793,6 +839,7 @@ sun4i_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
unsigned int sg_len, enum dma_transfer_direction dir,
unsigned long flags, void *context)
{
+ struct sun4i_dma_dev *priv = to_sun4i_dma_dev(chan->device);
struct sun4i_dma_vchan *vchan = to_sun4i_dma_vchan(chan);
struct dma_slave_config *sconfig = &vchan->cfg;
struct sun4i_dma_promise *promise;
@@ -818,11 +865,11 @@ sun4i_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
if (vchan->is_dedicated) {
io_mode = SUN4I_DDMA_ADDR_MODE_IO;
linear_mode = SUN4I_DDMA_ADDR_MODE_LINEAR;
- ram_type = SUN4I_DDMA_DRQ_TYPE_SDRAM;
+ ram_type = priv->cfg->ddma_drq_sdram;
} else {
io_mode = SUN4I_NDMA_ADDR_MODE_IO;
linear_mode = SUN4I_NDMA_ADDR_MODE_LINEAR;
- ram_type = SUN4I_NDMA_DRQ_TYPE_SDRAM;
+ ram_type = priv->cfg->ndma_drq_sdram;
}
if (dir == DMA_MEM_TO_DEV)
@@ -1150,6 +1197,10 @@ static int sun4i_dma_probe(struct platform_device *pdev)
if (!priv)
return -ENOMEM;
+ priv->cfg = of_device_get_match_data(&pdev->dev);
+ if (!priv->cfg)
+ return -ENODEV;
+
priv->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(priv->base))
return PTR_ERR(priv->base);
@@ -1197,23 +1248,26 @@ static int sun4i_dma_probe(struct platform_device *pdev)
priv->slave.dev = &pdev->dev;
- priv->pchans = devm_kcalloc(&pdev->dev, SUN4I_DMA_NR_MAX_CHANNELS,
+ priv->pchans = devm_kcalloc(&pdev->dev, priv->cfg->dma_nr_max_channels,
sizeof(struct sun4i_dma_pchan), GFP_KERNEL);
priv->vchans = devm_kcalloc(&pdev->dev, SUN4I_DMA_NR_MAX_VCHANS,
sizeof(struct sun4i_dma_vchan), GFP_KERNEL);
- if (!priv->vchans || !priv->pchans)
+ priv->pchans_used = devm_kcalloc(&pdev->dev,
+ BITS_TO_LONGS(priv->cfg->dma_nr_max_channels),
+ sizeof(unsigned long), GFP_KERNEL);
+ if (!priv->vchans || !priv->pchans || !priv->pchans_used)
return -ENOMEM;
/*
- * [0..SUN4I_NDMA_NR_MAX_CHANNELS) are normal pchans, and
- * [SUN4I_NDMA_NR_MAX_CHANNELS..SUN4I_DMA_NR_MAX_CHANNELS) are
+ * [0..priv->cfg->ndma_nr_max_channels) are normal pchans, and
+ * [priv->cfg->ndma_nr_max_channels..priv->cfg->dma_nr_max_channels) are
* dedicated ones
*/
- for (i = 0; i < SUN4I_NDMA_NR_MAX_CHANNELS; i++)
+ for (i = 0; i < priv->cfg->ndma_nr_max_channels; i++)
priv->pchans[i].base = priv->base +
SUN4I_NDMA_CHANNEL_REG_BASE(i);
- for (j = 0; i < SUN4I_DMA_NR_MAX_CHANNELS; i++, j++) {
+ for (j = 0; i < priv->cfg->dma_nr_max_channels; i++, j++) {
priv->pchans[i].base = priv->base +
SUN4I_DDMA_CHANNEL_REG_BASE(j);
priv->pchans[i].is_dedicated = 1;
@@ -1284,8 +1338,28 @@ static void sun4i_dma_remove(struct platform_device *pdev)
clk_disable_unprepare(priv->clk);
}
+static struct sun4i_dma_config sun4i_a10_dma_cfg = {
+ .ndma_nr_max_channels = SUN4I_NDMA_NR_MAX_CHANNELS,
+ .ndma_nr_max_vchans = SUN4I_NDMA_NR_MAX_VCHANS,
+
+ .ddma_nr_max_channels = SUN4I_DDMA_NR_MAX_CHANNELS,
+ .ddma_nr_max_vchans = SUN4I_DDMA_NR_MAX_VCHANS,
+
+ .dma_nr_max_channels = SUN4I_NDMA_NR_MAX_CHANNELS +
+ SUN4I_DDMA_NR_MAX_CHANNELS,
+
+ .set_dst_data_width = set_dst_data_width_a10,
+ .set_src_data_width = set_src_data_width_a10,
+ .convert_burst = convert_burst_a10,
+
+ .ndma_drq_sdram = SUN4I_NDMA_DRQ_TYPE_SDRAM,
+ .ddma_drq_sdram = SUN4I_DDMA_DRQ_TYPE_SDRAM,
+
+ .max_burst = SUN4I_MAX_BURST,
+};
+
static const struct of_device_id sun4i_dma_match[] = {
- { .compatible = "allwinner,sun4i-a10-dma" },
+ { .compatible = "allwinner,sun4i-a10-dma", .data = &sun4i_a10_dma_cfg },
{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, sun4i_dma_match);
--
2.34.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v2 02/10] dma-engine: sun4i: Add has_reset option to quirk
2024-10-27 9:14 [PATCH v2 01/10] dma-engine: sun4i: Add a quirk to support different chips Csókás, Bence
@ 2024-10-27 9:14 ` Csókás, Bence
2024-10-27 18:03 ` Csókás Bence
` (3 more replies)
2024-10-27 9:14 ` [PATCH v2 03/10] dt-bindings: dmaengine: Add Allwinner suniv F1C100s DMA Csókás, Bence
` (7 subsequent siblings)
8 siblings, 4 replies; 24+ messages in thread
From: Csókás, Bence @ 2024-10-27 9:14 UTC (permalink / raw)
To: dmaengine, linux-arm-kernel, linux-sunxi, linux-kernel
Cc: Mesih Kilinc, Csókás, Bence, Vinod Koul, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, Philipp Zabel
From: Mesih Kilinc <mesihkilinc@gmail.com>
Allwinner suniv F1C100s has a reset bit for DMA in CCU. Sun4i do not
has this bit but in order to support suniv we need to add it. So add
support for reset bit.
Signed-off-by: Mesih Kilinc <mesihkilinc@gmail.com>
[ csokas.bence: Rebased and addressed comments ]
Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
---
Notes:
Changes in v2:
* Call reset_control_deassert() unconditionally, as it supports optional resets
* Use dev_err_probe()
* Whitespace
drivers/dma/sun4i-dma.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/dma/sun4i-dma.c b/drivers/dma/sun4i-dma.c
index d472f57a39ea..0a45089461e1 100644
--- a/drivers/dma/sun4i-dma.c
+++ b/drivers/dma/sun4i-dma.c
@@ -15,6 +15,7 @@
#include <linux/of_dma.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
+#include <linux/reset.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
@@ -159,6 +160,7 @@ struct sun4i_dma_config {
u8 ddma_drq_sdram;
u8 max_burst;
+ bool has_reset;
};
struct sun4i_dma_pchan {
@@ -208,6 +210,7 @@ struct sun4i_dma_dev {
int irq;
spinlock_t lock;
const struct sun4i_dma_config *cfg;
+ struct reset_control *rst;
};
static struct sun4i_dma_dev *to_sun4i_dma_dev(struct dma_device *dev)
@@ -1215,6 +1218,15 @@ static int sun4i_dma_probe(struct platform_device *pdev)
return PTR_ERR(priv->clk);
}
+ if (priv->cfg->has_reset) {
+ priv->rst = devm_reset_control_get_exclusive(&pdev->dev,
+ NULL);
+ if (IS_ERR(priv->rst)) {
+ dev_err_probe(&pdev->dev, "Failed to get reset control\n");
+ return PTR_ERR(priv->rst);
+ }
+ }
+
platform_set_drvdata(pdev, priv);
spin_lock_init(&priv->lock);
@@ -1287,6 +1299,14 @@ static int sun4i_dma_probe(struct platform_device *pdev)
return ret;
}
+ /* Deassert the reset control */
+ ret = reset_control_deassert(priv->rst);
+ if (ret) {
+ dev_err(&pdev->dev,
+ "Failed to deassert the reset control\n");
+ goto err_clk_disable;
+ }
+
/*
* Make sure the IRQs are all disabled and accounted for. The bootloader
* likes to leave these dirty
@@ -1356,6 +1376,7 @@ static struct sun4i_dma_config sun4i_a10_dma_cfg = {
.ddma_drq_sdram = SUN4I_DDMA_DRQ_TYPE_SDRAM,
.max_burst = SUN4I_MAX_BURST,
+ .has_reset = false,
};
static const struct of_device_id sun4i_dma_match[] = {
--
2.34.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v2 03/10] dt-bindings: dmaengine: Add Allwinner suniv F1C100s DMA
2024-10-27 9:14 [PATCH v2 01/10] dma-engine: sun4i: Add a quirk to support different chips Csókás, Bence
2024-10-27 9:14 ` [PATCH v2 02/10] dma-engine: sun4i: Add has_reset option to quirk Csókás, Bence
@ 2024-10-27 9:14 ` Csókás, Bence
2024-10-27 20:40 ` Krzysztof Kozlowski
2024-10-27 9:14 ` [PATCH v2 04/10] dma-engine: sun4i: Add support for Allwinner suniv F1C100s Csókás, Bence
` (6 subsequent siblings)
8 siblings, 1 reply; 24+ messages in thread
From: Csókás, Bence @ 2024-10-27 9:14 UTC (permalink / raw)
To: Chen-Yu Tsai, Maxime Ripard, dmaengine, devicetree,
linux-arm-kernel, linux-sunxi, linux-kernel
Cc: Csókás, Bence, Conor Dooley, Vinod Koul, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jernej Skrabec, Samuel Holland
Add compatible string for Allwinner suniv F1C100s DMA.
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/linux-kernel/20241024-recycler-borrowing-5d4296fd4a56@spud/
[ csokas.bence: Reimplemented Mesih Kilinc's binding in YAML ]
Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
---
.../devicetree/bindings/dma/allwinner,sun4i-a10-dma.yaml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/dma/allwinner,sun4i-a10-dma.yaml b/Documentation/devicetree/bindings/dma/allwinner,sun4i-a10-dma.yaml
index 02d5bd035409..9b5180c0a7c4 100644
--- a/Documentation/devicetree/bindings/dma/allwinner,sun4i-a10-dma.yaml
+++ b/Documentation/devicetree/bindings/dma/allwinner,sun4i-a10-dma.yaml
@@ -22,7 +22,9 @@ properties:
number.
compatible:
- const: allwinner,sun4i-a10-dma
+ enum:
+ - allwinner,sun4i-a10-dma
+ - allwinner,suniv-f1c100s-dma
reg:
maxItems: 1
--
2.34.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v2 04/10] dma-engine: sun4i: Add support for Allwinner suniv F1C100s
2024-10-27 9:14 [PATCH v2 01/10] dma-engine: sun4i: Add a quirk to support different chips Csókás, Bence
2024-10-27 9:14 ` [PATCH v2 02/10] dma-engine: sun4i: Add has_reset option to quirk Csókás, Bence
2024-10-27 9:14 ` [PATCH v2 03/10] dt-bindings: dmaengine: Add Allwinner suniv F1C100s DMA Csókás, Bence
@ 2024-10-27 9:14 ` Csókás, Bence
2024-10-27 9:14 ` [PATCH v2 05/10] ARM: dts: suniv: f1c100s: Add support for DMA Csókás, Bence
` (5 subsequent siblings)
8 siblings, 0 replies; 24+ messages in thread
From: Csókás, Bence @ 2024-10-27 9:14 UTC (permalink / raw)
To: dmaengine, linux-kernel, linux-arm-kernel, linux-sunxi
Cc: Mesih Kilinc, Csókás, Bence, Vinod Koul, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland
From: Mesih Kilinc <mesihkilinc@gmail.com>
DMA of Allwinner suniv F1C100s is similar to sun4i. It has 4 NDMA, 4
DDMA channels and endpoints are different. Also F1C100s has reset bit
for DMA in CCU. Add support for it.
Signed-off-by: Mesih Kilinc <mesihkilinc@gmail.com>
[ csokas.bence: Rebased on current master ]
Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
---
drivers/dma/Kconfig | 4 +--
drivers/dma/sun4i-dma.c | 60 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index d9ec1e69e428..fc25bfc356f3 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -162,8 +162,8 @@ config DMA_SA11X0
config DMA_SUN4I
tristate "Allwinner A10 DMA SoCs support"
- depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I
- default (MACH_SUN4I || MACH_SUN5I || MACH_SUN7I)
+ depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUNIV
+ default (MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUNIV)
select DMA_ENGINE
select DMA_VIRTUAL_CHANNELS
help
diff --git a/drivers/dma/sun4i-dma.c b/drivers/dma/sun4i-dma.c
index 0a45089461e1..cb52976b56aa 100644
--- a/drivers/dma/sun4i-dma.c
+++ b/drivers/dma/sun4i-dma.c
@@ -33,7 +33,11 @@
#define SUN4I_DMA_CFG_SRC_ADDR_MODE(mode) ((mode) << 5)
#define SUN4I_DMA_CFG_SRC_DRQ_TYPE(type) (type)
+#define SUNIV_DMA_CFG_DST_DATA_WIDTH(width) ((width) << 24)
+#define SUNIV_DMA_CFG_SRC_DATA_WIDTH(width) ((width) << 8)
+
#define SUN4I_MAX_BURST 8
+#define SUNIV_MAX_BURST 4
/** Normal DMA register values **/
@@ -41,6 +45,9 @@
#define SUN4I_NDMA_DRQ_TYPE_SDRAM 0x16
#define SUN4I_NDMA_DRQ_TYPE_LIMIT (0x1F + 1)
+#define SUNIV_NDMA_DRQ_TYPE_SDRAM 0x11
+#define SUNIV_NDMA_DRQ_TYPE_LIMIT (0x17 + 1)
+
/** Normal DMA register layout **/
/* Dedicated DMA source/destination address mode values */
@@ -54,6 +61,9 @@
#define SUN4I_NDMA_CFG_BYTE_COUNT_MODE_REMAIN BIT(15)
#define SUN4I_NDMA_CFG_SRC_NON_SECURE BIT(6)
+#define SUNIV_NDMA_CFG_CONT_MODE BIT(29)
+#define SUNIV_NDMA_CFG_WAIT_STATE(n) ((n) << 26)
+
/** Dedicated DMA register values **/
/* Dedicated DMA source/destination address mode values */
@@ -66,6 +76,9 @@
#define SUN4I_DDMA_DRQ_TYPE_SDRAM 0x1
#define SUN4I_DDMA_DRQ_TYPE_LIMIT (0x1F + 1)
+#define SUNIV_DDMA_DRQ_TYPE_SDRAM 0x1
+#define SUNIV_DDMA_DRQ_TYPE_LIMIT (0x9 + 1)
+
/** Dedicated DMA register layout **/
/* Dedicated DMA configuration register layout */
@@ -119,6 +132,11 @@
#define SUN4I_DMA_NR_MAX_VCHANS \
(SUN4I_NDMA_NR_MAX_VCHANS + SUN4I_DDMA_NR_MAX_VCHANS)
+#define SUNIV_NDMA_NR_MAX_CHANNELS 4
+#define SUNIV_DDMA_NR_MAX_CHANNELS 4
+#define SUNIV_NDMA_NR_MAX_VCHANS (24 * 2 - 1)
+#define SUNIV_DDMA_NR_MAX_VCHANS 10
+
/* This set of SUN4I_DDMA timing parameters were found experimentally while
* working with the SPI driver and seem to make it behave correctly */
#define SUN4I_DDMA_MAGIC_SPI_PARAMETERS \
@@ -243,6 +261,16 @@ static void set_src_data_width_a10(u32 *p_cfg, s8 data_width)
*p_cfg |= SUN4I_DMA_CFG_SRC_DATA_WIDTH(data_width);
}
+static void set_dst_data_width_f1c100s(u32 *p_cfg, s8 data_width)
+{
+ *p_cfg |= SUNIV_DMA_CFG_DST_DATA_WIDTH(data_width);
+}
+
+static void set_src_data_width_f1c100s(u32 *p_cfg, s8 data_width)
+{
+ *p_cfg |= SUNIV_DMA_CFG_SRC_DATA_WIDTH(data_width);
+}
+
static int convert_burst_a10(u32 maxburst)
{
if (maxburst > 8)
@@ -252,6 +280,15 @@ static int convert_burst_a10(u32 maxburst)
return (maxburst >> 2);
}
+static int convert_burst_f1c100s(u32 maxburst)
+{
+ if (maxburst > 4)
+ return -EINVAL;
+
+ /* 1 -> 0, 4 -> 1 */
+ return (maxburst >> 2);
+}
+
static int convert_buswidth(enum dma_slave_buswidth addr_width)
{
if (addr_width > DMA_SLAVE_BUSWIDTH_4_BYTES)
@@ -1379,8 +1416,31 @@ static struct sun4i_dma_config sun4i_a10_dma_cfg = {
.has_reset = false,
};
+static struct sun4i_dma_config suniv_f1c100s_dma_cfg = {
+ .ndma_nr_max_channels = SUNIV_NDMA_NR_MAX_CHANNELS,
+ .ndma_nr_max_vchans = SUNIV_NDMA_NR_MAX_VCHANS,
+
+ .ddma_nr_max_channels = SUNIV_DDMA_NR_MAX_CHANNELS,
+ .ddma_nr_max_vchans = SUNIV_DDMA_NR_MAX_VCHANS,
+
+ .dma_nr_max_channels = SUNIV_NDMA_NR_MAX_CHANNELS +
+ SUNIV_DDMA_NR_MAX_CHANNELS,
+
+ .set_dst_data_width = set_dst_data_width_f1c100s,
+ .set_src_data_width = set_src_data_width_f1c100s,
+ .convert_burst = convert_burst_f1c100s,
+
+ .ndma_drq_sdram = SUNIV_NDMA_DRQ_TYPE_SDRAM,
+ .ddma_drq_sdram = SUNIV_DDMA_DRQ_TYPE_SDRAM,
+
+ .max_burst = SUNIV_MAX_BURST,
+ .has_reset = true,
+};
+
static const struct of_device_id sun4i_dma_match[] = {
{ .compatible = "allwinner,sun4i-a10-dma", .data = &sun4i_a10_dma_cfg },
+ { .compatible = "allwinner,suniv-f1c100s-dma",
+ .data = &suniv_f1c100s_dma_cfg },
{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, sun4i_dma_match);
--
2.34.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v2 05/10] ARM: dts: suniv: f1c100s: Add support for DMA
2024-10-27 9:14 [PATCH v2 01/10] dma-engine: sun4i: Add a quirk to support different chips Csókás, Bence
` (2 preceding siblings ...)
2024-10-27 9:14 ` [PATCH v2 04/10] dma-engine: sun4i: Add support for Allwinner suniv F1C100s Csókás, Bence
@ 2024-10-27 9:14 ` Csókás, Bence
2024-10-27 9:14 ` [PATCH v2 06/10] ASoC: sun4i-codec: Add DMA Max Burst field Csókás, Bence
` (4 subsequent siblings)
8 siblings, 0 replies; 24+ messages in thread
From: Csókás, Bence @ 2024-10-27 9:14 UTC (permalink / raw)
To: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel
Cc: Mesih Kilinc, Csókás, Bence, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland
From: Mesih Kilinc <mesihkilinc@gmail.com>
Allwinner suniv F1C100s now has DMA support. Enable it under device
tree.
Signed-off-by: Mesih Kilinc <mesihkilinc@gmail.com>
[ csokas.bence: Rebased on current master ]
Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
---
arch/arm/boot/dts/allwinner/suniv-f1c100s.dtsi | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/arm/boot/dts/allwinner/suniv-f1c100s.dtsi b/arch/arm/boot/dts/allwinner/suniv-f1c100s.dtsi
index 3c61d59ab5f8..290efe026ceb 100644
--- a/arch/arm/boot/dts/allwinner/suniv-f1c100s.dtsi
+++ b/arch/arm/boot/dts/allwinner/suniv-f1c100s.dtsi
@@ -6,6 +6,7 @@
#include <dt-bindings/clock/suniv-ccu-f1c100s.h>
#include <dt-bindings/reset/suniv-ccu-f1c100s.h>
+#include <dt-bindings/dma/sun4i-a10.h>
/ {
#address-cells = <1>;
@@ -159,6 +160,15 @@ usbphy: phy@1c13400 {
status = "disabled";
};
+ dma: dma-controller@1c02000 {
+ compatible = "allwinner,suniv-f1c100s-dma";
+ reg = <0x01c02000 0x1000>;
+ interrupts = <18>;
+ clocks = <&ccu CLK_BUS_DMA>;
+ resets = <&ccu RST_BUS_DMA>;
+ #dma-cells = <2>;
+ };
+
ccu: clock@1c20000 {
compatible = "allwinner,suniv-f1c100s-ccu";
reg = <0x01c20000 0x400>;
--
2.34.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v2 06/10] ASoC: sun4i-codec: Add DMA Max Burst field
2024-10-27 9:14 [PATCH v2 01/10] dma-engine: sun4i: Add a quirk to support different chips Csókás, Bence
` (3 preceding siblings ...)
2024-10-27 9:14 ` [PATCH v2 05/10] ARM: dts: suniv: f1c100s: Add support for DMA Csókás, Bence
@ 2024-10-27 9:14 ` Csókás, Bence
2024-10-27 9:14 ` [PATCH v2 07/10] dt-bindings: sound: Add Allwinner suniv F1C100s Audio Codec Csókás, Bence
` (3 subsequent siblings)
8 siblings, 0 replies; 24+ messages in thread
From: Csókás, Bence @ 2024-10-27 9:14 UTC (permalink / raw)
To: linux-sound, linux-arm-kernel, linux-sunxi, linux-kernel
Cc: Mesih Kilinc, Csókás, Bence, Liam Girdwood, Mark Brown,
Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland
From: Mesih Kilinc <mesihkilinc@gmail.com>
Allwinner suniv F1C100s has similar DMA engine to sun4i but it has
smaller max burst size compared to sun4i. Add a quirk field to
differantitate between them.
Signed-off-by: Mesih Kilinc <mesihkilinc@gmail.com>
[ csokas.bence: Rebased on current master ]
Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
---
sound/soc/sunxi/sun4i-codec.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 330bc0c09f56..4953b5013c58 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -228,6 +228,8 @@
/* TODO H3 DAP (Digital Audio Processing) bits */
+#define SUN4I_DMA_MAX_BURST (8)
+
struct sun4i_codec {
struct device *dev;
struct regmap *regmap;
@@ -1568,6 +1570,7 @@ struct sun4i_codec_quirks {
unsigned int reg_dac_txdata; /* TX FIFO offset for DMA config */
unsigned int reg_adc_rxdata; /* RX FIFO offset for DMA config */
bool has_reset;
+ u32 dma_max_burst;
};
static const struct sun4i_codec_quirks sun4i_codec_quirks = {
@@ -1577,6 +1580,7 @@ static const struct sun4i_codec_quirks sun4i_codec_quirks = {
.reg_adc_fifoc = REG_FIELD(SUN4I_CODEC_ADC_FIFOC, 0, 31),
.reg_dac_txdata = SUN4I_CODEC_DAC_TXDATA,
.reg_adc_rxdata = SUN4I_CODEC_ADC_RXDATA,
+ .dma_max_burst = SUN4I_DMA_MAX_BURST,
};
static const struct sun4i_codec_quirks sun6i_a31_codec_quirks = {
@@ -1587,6 +1591,7 @@ static const struct sun4i_codec_quirks sun6i_a31_codec_quirks = {
.reg_dac_txdata = SUN4I_CODEC_DAC_TXDATA,
.reg_adc_rxdata = SUN6I_CODEC_ADC_RXDATA,
.has_reset = true,
+ .dma_max_burst = SUN4I_DMA_MAX_BURST,
};
static const struct sun4i_codec_quirks sun7i_codec_quirks = {
@@ -1596,6 +1601,7 @@ static const struct sun4i_codec_quirks sun7i_codec_quirks = {
.reg_adc_fifoc = REG_FIELD(SUN4I_CODEC_ADC_FIFOC, 0, 31),
.reg_dac_txdata = SUN4I_CODEC_DAC_TXDATA,
.reg_adc_rxdata = SUN4I_CODEC_ADC_RXDATA,
+ .dma_max_burst = SUN4I_DMA_MAX_BURST,
};
static const struct sun4i_codec_quirks sun8i_a23_codec_quirks = {
@@ -1606,6 +1612,7 @@ static const struct sun4i_codec_quirks sun8i_a23_codec_quirks = {
.reg_dac_txdata = SUN4I_CODEC_DAC_TXDATA,
.reg_adc_rxdata = SUN6I_CODEC_ADC_RXDATA,
.has_reset = true,
+ .dma_max_burst = SUN4I_DMA_MAX_BURST,
};
static const struct sun4i_codec_quirks sun8i_h3_codec_quirks = {
@@ -1621,6 +1628,7 @@ static const struct sun4i_codec_quirks sun8i_h3_codec_quirks = {
.reg_dac_txdata = SUN8I_H3_CODEC_DAC_TXDATA,
.reg_adc_rxdata = SUN6I_CODEC_ADC_RXDATA,
.has_reset = true,
+ .dma_max_burst = SUN4I_DMA_MAX_BURST,
};
static const struct sun4i_codec_quirks sun8i_v3s_codec_quirks = {
@@ -1635,6 +1643,7 @@ static const struct sun4i_codec_quirks sun8i_v3s_codec_quirks = {
.reg_dac_txdata = SUN8I_H3_CODEC_DAC_TXDATA,
.reg_adc_rxdata = SUN6I_CODEC_ADC_RXDATA,
.has_reset = true,
+ .dma_max_burst = SUN4I_DMA_MAX_BURST,
};
static const struct of_device_id sun4i_codec_of_match[] = {
@@ -1757,12 +1766,12 @@ static int sun4i_codec_probe(struct platform_device *pdev)
/* DMA configuration for TX FIFO */
scodec->playback_dma_data.addr = res->start + quirks->reg_dac_txdata;
- scodec->playback_dma_data.maxburst = 8;
+ scodec->playback_dma_data.maxburst = quirks->dma_max_burst;
scodec->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
/* DMA configuration for RX FIFO */
scodec->capture_dma_data.addr = res->start + quirks->reg_adc_rxdata;
- scodec->capture_dma_data.maxburst = 8;
+ scodec->capture_dma_data.maxburst = quirks->dma_max_burst;
scodec->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
ret = devm_snd_soc_register_component(&pdev->dev, quirks->codec,
--
2.34.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v2 07/10] dt-bindings: sound: Add Allwinner suniv F1C100s Audio Codec
2024-10-27 9:14 [PATCH v2 01/10] dma-engine: sun4i: Add a quirk to support different chips Csókás, Bence
` (4 preceding siblings ...)
2024-10-27 9:14 ` [PATCH v2 06/10] ASoC: sun4i-codec: Add DMA Max Burst field Csókás, Bence
@ 2024-10-27 9:14 ` Csókás, Bence
2024-10-27 9:14 ` [PATCH v2 08/10] ASoC: sun4i-codec: Add support for Allwinner suniv F1C100s Csókás, Bence
` (2 subsequent siblings)
8 siblings, 0 replies; 24+ messages in thread
From: Csókás, Bence @ 2024-10-27 9:14 UTC (permalink / raw)
To: Chen-Yu Tsai, Maxime Ripard, linux-sound, devicetree,
linux-arm-kernel, linux-sunxi, linux-kernel
Cc: Csókás, Bence, Liam Girdwood, Mark Brown, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jernej Skrabec, Samuel Holland
Add compatible string for Allwinner suniv F1C100s audio codec.
[ csokas.bence: Reimplement Mesih Kilinc's binding in YAML ]
Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
---
.../sound/allwinner,sun4i-a10-codec.yaml | 31 +++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-codec.yaml b/Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-codec.yaml
index 78273647f766..16f4f7a40d9d 100644
--- a/Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-codec.yaml
+++ b/Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-codec.yaml
@@ -22,6 +22,7 @@ properties:
- allwinner,sun8i-a23-codec
- allwinner,sun8i-h3-codec
- allwinner,sun8i-v3s-codec
+ - allwinner,suniv-f1c100s-codec
reg:
maxItems: 1
@@ -70,6 +71,7 @@ properties:
- MIC1
- MIC2
- MIC3
+ - MIC
# Microphone Biases from the SoC
- HBIAS
@@ -80,6 +82,8 @@ properties:
- Headset Mic
- Line In
- Line Out
+ - Right FM In
+ - Left FM In
- Mic
- Speaker
@@ -229,6 +233,33 @@ allOf:
- Mic
- Speaker
+ - if:
+ properties:
+ compatible:
+ enum:
+ - allwinner,suniv-f1c100s-codec
+
+ then:
+ properties:
+ allwinner,audio-routing:
+ items:
+ enum:
+ - HP
+ - HPCOM
+ - LINEIN
+ - LINEOUT
+ - MIC
+ - HBIAS
+ - MBIAS
+ - Headphone
+ - Headset Mic
+ - Line In
+ - Line Out
+ - Right FM In
+ - Left FM In
+ - Mic
+ - Speaker
+
unevaluatedProperties: false
examples:
--
2.34.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v2 08/10] ASoC: sun4i-codec: Add support for Allwinner suniv F1C100s
2024-10-27 9:14 [PATCH v2 01/10] dma-engine: sun4i: Add a quirk to support different chips Csókás, Bence
` (5 preceding siblings ...)
2024-10-27 9:14 ` [PATCH v2 07/10] dt-bindings: sound: Add Allwinner suniv F1C100s Audio Codec Csókás, Bence
@ 2024-10-27 9:14 ` Csókás, Bence
2024-10-27 9:14 ` [PATCH v2 09/10] ARM: dts: suniv: f1c100s: Add support for Audio Codec Csókás, Bence
2024-10-27 9:14 ` [PATCH v2 10/10] ARM: dts: suniv: f1c100s: Activate Audio Codec for Lichee Pi Nano Csókás, Bence
8 siblings, 0 replies; 24+ messages in thread
From: Csókás, Bence @ 2024-10-27 9:14 UTC (permalink / raw)
To: linux-sound, linux-arm-kernel, linux-sunxi, linux-kernel
Cc: Mesih Kilinc, Csókás, Bence, Liam Girdwood, Mark Brown,
Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland
From: Mesih Kilinc <mesihkilinc@gmail.com>
Allwinner suniv F1C100s has similar but primitive audio codec
comparared to sun4i. Add support for it.
Signed-off-by: Mesih Kilinc <mesihkilinc@gmail.com>
[ csokas.bence: Remove `non_legacy_dai_naming` ]
Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
---
Notes:
Changes in v2:
* Whitespace
sound/soc/sunxi/sun4i-codec.c | 352 ++++++++++++++++++++++++++++++++++
1 file changed, 352 insertions(+)
diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 4953b5013c58..e253fb8a4226 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -5,6 +5,7 @@
* Copyright 2015 Maxime Ripard <maxime.ripard@free-electrons.com>
* Copyright 2015 Adam Sampson <ats@offog.org>
* Copyright 2016 Chen-Yu Tsai <wens@csie.org>
+ * Copyright 2018 Mesih Kilinc <mesihkilinc@gmail.com>
*
* Based on the Allwinner SDK driver, released under the GPL.
*/
@@ -230,6 +231,62 @@
#define SUN4I_DMA_MAX_BURST (8)
+/* suniv specific registers */
+
+#define SUNIV_DMA_MAX_BURST (4)
+
+/* Codec DAC digital controls and FIFO registers */
+#define SUNIV_CODEC_ADC_FIFOC (0x10)
+#define SUNIV_CODEC_ADC_FIFOC_EN_AD (28)
+#define SUNIV_CODEC_ADC_FIFOS (0x14)
+#define SUNIV_CODEC_ADC_RXDATA (0x18)
+
+/* Output mixer and gain controls */
+#define SUNIV_CODEC_OM_DACA_CTRL (0x20)
+#define SUNIV_CODEC_OM_DACA_CTRL_DACAREN (31)
+#define SUNIV_CODEC_OM_DACA_CTRL_DACALEN (30)
+#define SUNIV_CODEC_OM_DACA_CTRL_RMIXEN (29)
+#define SUNIV_CODEC_OM_DACA_CTRL_LMIXEN (28)
+#define SUNIV_CODEC_OM_DACA_CTRL_RHPPAMUTE (27)
+#define SUNIV_CODEC_OM_DACA_CTRL_LHPPAMUTE (26)
+#define SUNIV_CODEC_OM_DACA_CTRL_RHPIS (25)
+#define SUNIV_CODEC_OM_DACA_CTRL_LHPIS (24)
+#define SUNIV_CODEC_OM_DACA_CTRL_HPCOM_CTL (22)
+#define SUNIV_CODEC_OM_DACA_CTRL_COMPTEN (21)
+#define SUNIV_CODEC_OM_DACA_CTRL_RMIXMUTE_MICIN (20)
+#define SUNIV_CODEC_OM_DACA_CTRL_RMIXMUTE_LINEIN (19)
+#define SUNIV_CODEC_OM_DACA_CTRL_RMIXMUTE_FMIN (18)
+#define SUNIV_CODEC_OM_DACA_CTRL_RMIXMUTE_RDAC (17)
+#define SUNIV_CODEC_OM_DACA_CTRL_RMIXMUTE_LDAC (16)
+#define SUNIV_CODEC_OM_DACA_CTRL_HPPAEN (15)
+#define SUNIV_CODEC_OM_DACA_CTRL_LMIXMUTE_MICIN (12)
+#define SUNIV_CODEC_OM_DACA_CTRL_LMIXMUTE_LINEIN (11)
+#define SUNIV_CODEC_OM_DACA_CTRL_LMIXMUTE_FMIN (10)
+#define SUNIV_CODEC_OM_DACA_CTRL_LMIXMUTE_LDAC (9)
+#define SUNIV_CODEC_OM_DACA_CTRL_LMIXMUTE_RDAC (8)
+#define SUNIV_CODEC_OM_DACA_CTRL_LTLNMUTE (7)
+#define SUNIV_CODEC_OM_DACA_CTRL_RTLNMUTE (6)
+#define SUNIV_CODEC_OM_DACA_CTRL_HPVOL (0)
+
+/* Analog Input Mixer controls */
+#define SUNIV_CODEC_ADC_ACTL (0x24)
+#define SUNIV_CODEC_ADC_ADCEN (31)
+#define SUNIV_CODEC_ADC_MICG (24)
+#define SUNIV_CODEC_ADC_LINEINVOL (21)
+#define SUNIV_CODEC_ADC_ADCG (16)
+#define SUNIV_CODEC_ADC_ADCMIX_MIC (13)
+#define SUNIV_CODEC_ADC_ADCMIX_FMINL (12)
+#define SUNIV_CODEC_ADC_ADCMIX_FMINR (11)
+#define SUNIV_CODEC_ADC_ADCMIX_LINEIN (10)
+#define SUNIV_CODEC_ADC_ADCMIX_LOUT (9)
+#define SUNIV_CODEC_ADC_ADCMIX_ROUT (8)
+#define SUNIV_CODEC_ADC_PASPEEDSELECT (7)
+#define SUNIV_CODEC_ADC_FMINVOL (4)
+#define SUNIV_CODEC_ADC_MICAMPEN (3)
+#define SUNIV_CODEC_ADC_MICBOOST (0)
+
+#define SUNIV_CODEC_ADC_DBG (0x4c)
+
struct sun4i_codec {
struct device *dev;
struct regmap *regmap;
@@ -1218,6 +1275,228 @@ static const struct snd_soc_component_driver sun8i_a23_codec_codec = {
.endianness = 1,
};
+/*suniv F1C100s codec */
+
+/* headphone controls */
+static const char * const suniv_codec_hp_src_enum_text[] = {
+ "DAC", "Mixer",
+};
+
+static SOC_ENUM_DOUBLE_DECL(suniv_codec_hp_src_enum,
+ SUNIV_CODEC_OM_DACA_CTRL,
+ SUNIV_CODEC_OM_DACA_CTRL_LHPIS,
+ SUNIV_CODEC_OM_DACA_CTRL_RHPIS,
+ suniv_codec_hp_src_enum_text);
+
+static const struct snd_kcontrol_new suniv_codec_hp_src[] = {
+ SOC_DAPM_ENUM("Headphone Source Playback Route",
+ suniv_codec_hp_src_enum),
+};
+
+/* mixer controls */
+static const struct snd_kcontrol_new suniv_codec_adc_mixer_controls[] = {
+ SOC_DAPM_SINGLE("Right Out Capture Switch", SUNIV_CODEC_ADC_ACTL,
+ SUNIV_CODEC_ADC_ADCMIX_ROUT, 1, 0),
+ SOC_DAPM_SINGLE("Left Out Capture Switch", SUNIV_CODEC_ADC_ACTL,
+ SUNIV_CODEC_ADC_ADCMIX_LOUT, 1, 0),
+ SOC_DAPM_SINGLE("Line In Capture Switch", SUNIV_CODEC_ADC_ACTL,
+ SUNIV_CODEC_ADC_ADCMIX_LINEIN, 1, 0),
+ SOC_DAPM_SINGLE("Right FM In Capture Switch", SUNIV_CODEC_ADC_ACTL,
+ SUNIV_CODEC_ADC_ADCMIX_FMINR, 1, 0),
+ SOC_DAPM_SINGLE("Left FM In Capture Switch", SUNIV_CODEC_ADC_ACTL,
+ SUNIV_CODEC_ADC_ADCMIX_FMINL, 1, 0),
+ SOC_DAPM_SINGLE("Mic Capture Switch", SUNIV_CODEC_ADC_ACTL,
+ SUNIV_CODEC_ADC_ADCMIX_MIC, 1, 0),
+};
+
+static const struct snd_kcontrol_new suniv_codec_dac_lmixer_controls[] = {
+ SOC_DAPM_SINGLE("Right DAC Playback Switch", SUNIV_CODEC_OM_DACA_CTRL,
+ SUNIV_CODEC_OM_DACA_CTRL_LMIXMUTE_RDAC, 1, 0),
+ SOC_DAPM_SINGLE("Left DAC Playback Switch", SUNIV_CODEC_OM_DACA_CTRL,
+ SUNIV_CODEC_OM_DACA_CTRL_LMIXMUTE_LDAC, 1, 0),
+ SOC_DAPM_SINGLE("FM In Playback Switch", SUNIV_CODEC_OM_DACA_CTRL,
+ SUNIV_CODEC_OM_DACA_CTRL_LMIXMUTE_FMIN, 1, 0),
+ SOC_DAPM_SINGLE("Line In Playback Switch", SUNIV_CODEC_OM_DACA_CTRL,
+ SUNIV_CODEC_OM_DACA_CTRL_LMIXMUTE_LINEIN, 1, 0),
+ SOC_DAPM_SINGLE("Mic In Playback Switch", SUNIV_CODEC_OM_DACA_CTRL,
+ SUNIV_CODEC_OM_DACA_CTRL_LMIXMUTE_MICIN, 1, 0),
+};
+
+static const struct snd_kcontrol_new suniv_codec_dac_rmixer_controls[] = {
+ SOC_DAPM_SINGLE("Left DAC Playback Switch", SUNIV_CODEC_OM_DACA_CTRL,
+ SUNIV_CODEC_OM_DACA_CTRL_RMIXMUTE_LDAC, 1, 0),
+ SOC_DAPM_SINGLE("Right DAC Playback Switch", SUNIV_CODEC_OM_DACA_CTRL,
+ SUNIV_CODEC_OM_DACA_CTRL_RMIXMUTE_RDAC, 1, 0),
+ SOC_DAPM_SINGLE("FM In Playback Switch", SUNIV_CODEC_OM_DACA_CTRL,
+ SUNIV_CODEC_OM_DACA_CTRL_RMIXMUTE_FMIN, 1, 0),
+ SOC_DAPM_SINGLE("Line In Playback Switch", SUNIV_CODEC_OM_DACA_CTRL,
+ SUNIV_CODEC_OM_DACA_CTRL_RMIXMUTE_LINEIN, 1, 0),
+ SOC_DAPM_SINGLE("Mic In Playback Switch", SUNIV_CODEC_OM_DACA_CTRL,
+ SUNIV_CODEC_OM_DACA_CTRL_RMIXMUTE_MICIN, 1, 0),
+};
+
+static const DECLARE_TLV_DB_SCALE(suniv_codec_dvol_scale, -7308, 116, 0);
+static const DECLARE_TLV_DB_SCALE(suniv_codec_hp_vol_scale, -6300, 100, 1);
+static const DECLARE_TLV_DB_SCALE(suniv_codec_out_mixer_pregain_scale,
+ -450, 150, 0);
+
+static const DECLARE_TLV_DB_RANGE(suniv_codec_mic_gain_scale,
+ 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0),
+ 1, 7, TLV_DB_SCALE_ITEM(2400, 300, 0),
+);
+
+static const struct snd_kcontrol_new suniv_codec_codec_widgets[] = {
+ SOC_SINGLE_TLV("DAC Playback Volume", SUN4I_CODEC_DAC_DPC,
+ SUN4I_CODEC_DAC_DPC_DVOL, 0x3f, 1,
+ suniv_codec_dvol_scale),
+ SOC_SINGLE_TLV("Headphone Playback Volume",
+ SUNIV_CODEC_OM_DACA_CTRL,
+ SUNIV_CODEC_OM_DACA_CTRL_HPVOL, 0x3f, 0,
+ suniv_codec_hp_vol_scale),
+ SOC_DOUBLE("Headphone Playback Switch",
+ SUNIV_CODEC_OM_DACA_CTRL,
+ SUNIV_CODEC_OM_DACA_CTRL_LHPPAMUTE,
+ SUNIV_CODEC_OM_DACA_CTRL_RHPPAMUTE, 1, 0),
+ SOC_SINGLE_TLV("Line In Playback Volume",
+ SUNIV_CODEC_ADC_ACTL, SUNIV_CODEC_ADC_LINEINVOL,
+ 0x7, 0, suniv_codec_out_mixer_pregain_scale),
+ SOC_SINGLE_TLV("FM In Playback Volume",
+ SUNIV_CODEC_ADC_ACTL, SUNIV_CODEC_ADC_FMINVOL,
+ 0x7, 0, suniv_codec_out_mixer_pregain_scale),
+ SOC_SINGLE_TLV("Mic In Playback Volume",
+ SUNIV_CODEC_ADC_ACTL, SUNIV_CODEC_ADC_MICG,
+ 0x7, 0, suniv_codec_out_mixer_pregain_scale),
+
+ /* Microphone Amp boost gains */
+ SOC_SINGLE_TLV("Mic Boost Volume", SUNIV_CODEC_ADC_ACTL,
+ SUNIV_CODEC_ADC_MICBOOST, 0x7, 0,
+ suniv_codec_mic_gain_scale),
+ SOC_SINGLE_TLV("ADC Capture Volume",
+ SUNIV_CODEC_ADC_ACTL, SUNIV_CODEC_ADC_ADCG,
+ 0x7, 0, suniv_codec_out_mixer_pregain_scale),
+};
+
+static const struct snd_soc_dapm_widget suniv_codec_codec_dapm_widgets[] = {
+ /* Microphone inputs */
+ SND_SOC_DAPM_INPUT("MIC"),
+
+ /* Microphone Bias */
+ /* deleted: HBIAS, MBIAS */
+
+ /* Mic input path */
+ SND_SOC_DAPM_PGA("Mic Amplifier", SUNIV_CODEC_ADC_ACTL,
+ SUNIV_CODEC_ADC_MICAMPEN, 0, NULL, 0),
+
+ /* Line In */
+ SND_SOC_DAPM_INPUT("LINEIN"),
+
+ /* FM In */
+ SND_SOC_DAPM_INPUT("FMINR"),
+ SND_SOC_DAPM_INPUT("FMINL"),
+
+ /* Digital parts of the ADCs */
+ SND_SOC_DAPM_SUPPLY("ADC Enable", SUNIV_CODEC_ADC_FIFOC,
+ SUNIV_CODEC_ADC_FIFOC_EN_AD, 0,
+ NULL, 0),
+
+ /* Analog parts of the ADCs */
+ SND_SOC_DAPM_ADC("ADC", "Codec Capture", SUNIV_CODEC_ADC_ACTL,
+ SUNIV_CODEC_ADC_ADCEN, 0),
+
+ /* ADC Mixers */
+ SOC_MIXER_ARRAY("ADC Mixer", SUNIV_CODEC_ADC_ACTL,
+ SND_SOC_NOPM, 0,
+ suniv_codec_adc_mixer_controls),
+
+ /* Digital parts of the DACs */
+ SND_SOC_DAPM_SUPPLY("DAC Enable", SUN4I_CODEC_DAC_DPC,
+ SUN4I_CODEC_DAC_DPC_EN_DA, 0,
+ NULL, 0),
+
+ /* Analog parts of the DACs */
+ SND_SOC_DAPM_DAC("Left DAC", "Codec Playback",
+ SUNIV_CODEC_OM_DACA_CTRL,
+ SUNIV_CODEC_OM_DACA_CTRL_DACALEN, 0),
+ SND_SOC_DAPM_DAC("Right DAC", "Codec Playback",
+ SUNIV_CODEC_OM_DACA_CTRL,
+ SUNIV_CODEC_OM_DACA_CTRL_DACAREN, 0),
+
+ /* Mixers */
+ SOC_MIXER_ARRAY("Left Mixer", SUNIV_CODEC_OM_DACA_CTRL,
+ SUNIV_CODEC_OM_DACA_CTRL_LMIXEN, 0,
+ suniv_codec_dac_lmixer_controls),
+ SOC_MIXER_ARRAY("Right Mixer", SUNIV_CODEC_OM_DACA_CTRL,
+ SUNIV_CODEC_OM_DACA_CTRL_RMIXEN, 0,
+ suniv_codec_dac_rmixer_controls),
+
+ /* Headphone output path */
+ SND_SOC_DAPM_MUX("Headphone Source Playback Route",
+ SND_SOC_NOPM, 0, 0, suniv_codec_hp_src),
+ SND_SOC_DAPM_OUT_DRV("Headphone Amp", SUNIV_CODEC_OM_DACA_CTRL,
+ SUNIV_CODEC_OM_DACA_CTRL_HPPAEN, 0, NULL, 0),
+ SND_SOC_DAPM_SUPPLY("HPCOM Protection", SUNIV_CODEC_OM_DACA_CTRL,
+ SUNIV_CODEC_OM_DACA_CTRL_COMPTEN, 0, NULL, 0),
+ SND_SOC_DAPM_REG(snd_soc_dapm_supply, "HPCOM", SUNIV_CODEC_OM_DACA_CTRL,
+ SUNIV_CODEC_OM_DACA_CTRL_HPCOM_CTL, 0x3, 0x3, 0),
+ SND_SOC_DAPM_OUTPUT("HP"),
+};
+
+static const struct snd_soc_dapm_route suniv_codec_codec_dapm_routes[] = {
+ /* DAC Routes */
+ { "Left DAC", NULL, "DAC Enable" },
+ { "Right DAC", NULL, "DAC Enable" },
+
+ /* Microphone Routes */
+ { "Mic Amplifier", NULL, "MIC"},
+
+ /* Left Mixer Routes */
+ { "Left Mixer", "Right DAC Playback Switch", "Right DAC" },
+ { "Left Mixer", "Left DAC Playback Switch", "Left DAC" },
+ { "Left Mixer", "FM In Playback Switch", "FMINL" },
+ { "Left Mixer", "Line In Playback Switch", "LINEIN" },
+ { "Left Mixer", "Mic In Playback Switch", "Mic Amplifier" },
+
+ /* Right Mixer Routes */
+ { "Right Mixer", "Left DAC Playback Switch", "Left DAC" },
+ { "Right Mixer", "Right DAC Playback Switch", "Right DAC" },
+ { "Right Mixer", "FM In Playback Switch", "FMINR" },
+ { "Right Mixer", "Line In Playback Switch", "LINEIN" },
+ { "Right Mixer", "Mic In Playback Switch", "Mic Amplifier" },
+
+ /* ADC Mixer Routes */
+ { "ADC Mixer", "Right Out Capture Switch", "Right Mixer" },
+ { "ADC Mixer", "Left Out Capture Switch", "Left Mixer" },
+ { "ADC Mixer", "Line In Capture Switch", "LINEIN" },
+ { "ADC Mixer", "Right FM In Capture Switch", "FMINR" },
+ { "ADC Mixer", "Left FM In Capture Switch", "FMINL" },
+ { "ADC Mixer", "Mic Capture Switch", "Mic Amplifier" },
+
+ /* Headphone Routes */
+ { "Headphone Source Playback Route", "DAC", "Left DAC" },
+ { "Headphone Source Playback Route", "DAC", "Right DAC" },
+ { "Headphone Source Playback Route", "Mixer", "Left Mixer" },
+ { "Headphone Source Playback Route", "Mixer", "Right Mixer" },
+ { "Headphone Amp", NULL, "Headphone Source Playback Route" },
+ { "HP", NULL, "Headphone Amp" },
+ { "HPCOM", NULL, "HPCOM Protection" },
+
+ /* ADC Routes */
+ { "ADC", NULL, "ADC Mixer" },
+ { "ADC", NULL, "ADC Enable" },
+};
+
+static const struct snd_soc_component_driver suniv_codec_codec = {
+ .controls = suniv_codec_codec_widgets,
+ .num_controls = ARRAY_SIZE(suniv_codec_codec_widgets),
+ .dapm_widgets = suniv_codec_codec_dapm_widgets,
+ .num_dapm_widgets = ARRAY_SIZE(suniv_codec_codec_dapm_widgets),
+ .dapm_routes = suniv_codec_codec_dapm_routes,
+ .num_dapm_routes = ARRAY_SIZE(suniv_codec_codec_dapm_routes),
+ .idle_bias_on = 1,
+ .use_pmdown_time = 1,
+ .endianness = 1,
+};
+
static const struct snd_soc_component_driver sun4i_codec_component = {
.name = "sun4i-codec",
.legacy_dai_naming = 1,
@@ -1520,6 +1799,56 @@ static struct snd_soc_card *sun8i_v3s_codec_create_card(struct device *dev)
return card;
};
+static const struct snd_soc_dapm_widget suniv_codec_card_dapm_widgets[] = {
+ SND_SOC_DAPM_HP("Headphone", NULL),
+ SND_SOC_DAPM_LINE("Line In", NULL),
+ SND_SOC_DAPM_LINE("Right FM In", NULL),
+ SND_SOC_DAPM_LINE("Left FM In", NULL),
+ SND_SOC_DAPM_MIC("Mic", NULL),
+ SND_SOC_DAPM_SPK("Speaker", sun4i_codec_spk_event),
+};
+
+/* Connect digital side enables to analog side widgets */
+static const struct snd_soc_dapm_route suniv_codec_card_routes[] = {
+ /* ADC Routes */
+ { "ADC", NULL, "ADC Enable" },
+ { "Codec Capture", NULL, "ADC" },
+
+ /* DAC Routes */
+ { "Left DAC", NULL, "DAC Enable" },
+ { "Right DAC", NULL, "DAC Enable" },
+ { "Left DAC", NULL, "Codec Playback" },
+ { "Right DAC", NULL, "Codec Playback" },
+};
+
+static struct snd_soc_card *suniv_codec_create_card(struct device *dev)
+{
+ struct snd_soc_card *card;
+ int ret;
+
+ card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL);
+ if (!card)
+ return ERR_PTR(-ENOMEM);
+
+ card->dai_link = sun4i_codec_create_link(dev, &card->num_links);
+ if (!card->dai_link)
+ return ERR_PTR(-ENOMEM);
+
+ card->dev = dev;
+ card->name = "F1C100s Audio Codec";
+ card->dapm_widgets = suniv_codec_card_dapm_widgets;
+ card->num_dapm_widgets = ARRAY_SIZE(suniv_codec_card_dapm_widgets);
+ card->dapm_routes = suniv_codec_card_routes;
+ card->num_dapm_routes = ARRAY_SIZE(suniv_codec_card_routes);
+ card->fully_routed = true;
+
+ ret = snd_soc_of_parse_audio_routing(card, "allwinner,audio-routing");
+ if (ret)
+ dev_warn(dev, "failed to parse audio-routing: %d\n", ret);
+
+ return card;
+};
+
static const struct regmap_config sun4i_codec_regmap_config = {
.reg_bits = 32,
.reg_stride = 4,
@@ -1562,6 +1891,13 @@ static const struct regmap_config sun8i_v3s_codec_regmap_config = {
.max_register = SUN8I_H3_CODEC_ADC_DBG,
};
+static const struct regmap_config suniv_codec_regmap_config = {
+ .reg_bits = 32,
+ .reg_stride = 4,
+ .val_bits = 32,
+ .max_register = SUNIV_CODEC_ADC_DBG,
+};
+
struct sun4i_codec_quirks {
const struct regmap_config *regmap_config;
const struct snd_soc_component_driver *codec;
@@ -1646,6 +1982,17 @@ static const struct sun4i_codec_quirks sun8i_v3s_codec_quirks = {
.dma_max_burst = SUN4I_DMA_MAX_BURST,
};
+static const struct sun4i_codec_quirks suniv_f1c100s_codec_quirks = {
+ .regmap_config = &suniv_codec_regmap_config,
+ .codec = &suniv_codec_codec,
+ .create_card = suniv_codec_create_card,
+ .reg_adc_fifoc = REG_FIELD(SUNIV_CODEC_ADC_FIFOC, 0, 31),
+ .reg_dac_txdata = SUN4I_CODEC_DAC_TXDATA,
+ .reg_adc_rxdata = SUNIV_CODEC_ADC_RXDATA,
+ .has_reset = true,
+ .dma_max_burst = SUNIV_DMA_MAX_BURST,
+};
+
static const struct of_device_id sun4i_codec_of_match[] = {
{
.compatible = "allwinner,sun4i-a10-codec",
@@ -1671,6 +2018,10 @@ static const struct of_device_id sun4i_codec_of_match[] = {
.compatible = "allwinner,sun8i-v3s-codec",
.data = &sun8i_v3s_codec_quirks,
},
+ {
+ .compatible = "allwinner,suniv-f1c100s-codec",
+ .data = &suniv_f1c100s_codec_quirks,
+ },
{}
};
MODULE_DEVICE_TABLE(of, sun4i_codec_of_match);
@@ -1846,4 +2197,5 @@ MODULE_AUTHOR("Emilio López <emilio@elopez.com.ar>");
MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>");
MODULE_AUTHOR("Maxime Ripard <maxime.ripard@free-electrons.com>");
MODULE_AUTHOR("Chen-Yu Tsai <wens@csie.org>");
+MODULE_AUTHOR("Mesih Kilinc <mesikilinc@gmail.com>");
MODULE_LICENSE("GPL");
--
2.34.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v2 09/10] ARM: dts: suniv: f1c100s: Add support for Audio Codec
2024-10-27 9:14 [PATCH v2 01/10] dma-engine: sun4i: Add a quirk to support different chips Csókás, Bence
` (6 preceding siblings ...)
2024-10-27 9:14 ` [PATCH v2 08/10] ASoC: sun4i-codec: Add support for Allwinner suniv F1C100s Csókás, Bence
@ 2024-10-27 9:14 ` Csókás, Bence
2024-10-27 9:14 ` [PATCH v2 10/10] ARM: dts: suniv: f1c100s: Activate Audio Codec for Lichee Pi Nano Csókás, Bence
8 siblings, 0 replies; 24+ messages in thread
From: Csókás, Bence @ 2024-10-27 9:14 UTC (permalink / raw)
To: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel
Cc: Mesih Kilinc, Csókás, Bence, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland
From: Mesih Kilinc <mesihkilinc@gmail.com>
Allwinner suniv F1C100s now has basic audio codec support. Enable it
under device tree.
Signed-off-by: Mesih Kilinc <mesihkilinc@gmail.com>
[ csokas.bence: Rebased on current master ]
Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
---
arch/arm/boot/dts/allwinner/suniv-f1c100s.dtsi | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/arch/arm/boot/dts/allwinner/suniv-f1c100s.dtsi b/arch/arm/boot/dts/allwinner/suniv-f1c100s.dtsi
index 290efe026ceb..e4b41bc93852 100644
--- a/arch/arm/boot/dts/allwinner/suniv-f1c100s.dtsi
+++ b/arch/arm/boot/dts/allwinner/suniv-f1c100s.dtsi
@@ -336,5 +336,19 @@ uart2: serial@1c25800 {
resets = <&ccu RST_BUS_UART2>;
status = "disabled";
};
+
+ codec: codec@1c23c00 {
+ #sound-dai-cells = <0>;
+ compatible = "allwinner,suniv-f1c100s-codec";
+ reg = <0x01c23c00 0x400>;
+ interrupts = <21>;
+ clocks = <&ccu CLK_BUS_CODEC>, <&ccu CLK_CODEC>;
+ clock-names = "apb", "codec";
+ dmas = <&dma SUN4I_DMA_NORMAL 12>,
+ <&dma SUN4I_DMA_NORMAL 12>;
+ dma-names = "rx", "tx";
+ resets = <&ccu RST_BUS_CODEC>;
+ status = "disabled";
+ };
};
};
--
2.34.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v2 10/10] ARM: dts: suniv: f1c100s: Activate Audio Codec for Lichee Pi Nano
2024-10-27 9:14 [PATCH v2 01/10] dma-engine: sun4i: Add a quirk to support different chips Csókás, Bence
` (7 preceding siblings ...)
2024-10-27 9:14 ` [PATCH v2 09/10] ARM: dts: suniv: f1c100s: Add support for Audio Codec Csókás, Bence
@ 2024-10-27 9:14 ` Csókás, Bence
8 siblings, 0 replies; 24+ messages in thread
From: Csókás, Bence @ 2024-10-27 9:14 UTC (permalink / raw)
To: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel
Cc: Mesih Kilinc, Csókás, Bence, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland
From: Mesih Kilinc <mesihkilinc@gmail.com>
Allwinner suniv F1C100s now has basic audio codec support. Activate it
for Lichee Pi Nano board.
Signed-off-by: Mesih Kilinc <mesihkilinc@gmail.com>
[ csokas.bence: Moved and fixed conflict ]
Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
---
.../boot/dts/allwinner/suniv-f1c100s-licheepi-nano.dts | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/arm/boot/dts/allwinner/suniv-f1c100s-licheepi-nano.dts b/arch/arm/boot/dts/allwinner/suniv-f1c100s-licheepi-nano.dts
index 43896723a994..472ded0aafcf 100644
--- a/arch/arm/boot/dts/allwinner/suniv-f1c100s-licheepi-nano.dts
+++ b/arch/arm/boot/dts/allwinner/suniv-f1c100s-licheepi-nano.dts
@@ -62,6 +62,14 @@ &uart0 {
status = "okay";
};
+&codec {
+ allwinner,audio-routing =
+ "Headphone", "HP",
+ "Headphone", "HPCOM",
+ "MIC", "Mic";
+ status = "okay";
+};
+
&usb_otg {
dr_mode = "otg";
status = "okay";
--
2.34.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH v2 02/10] dma-engine: sun4i: Add has_reset option to quirk
2024-10-27 9:14 ` [PATCH v2 02/10] dma-engine: sun4i: Add has_reset option to quirk Csókás, Bence
@ 2024-10-27 18:03 ` Csókás Bence
2024-10-27 18:08 ` [PATCH v3 " Csókás, Bence
2024-10-27 19:12 ` [PATCH v2 " kernel test robot
` (2 subsequent siblings)
3 siblings, 1 reply; 24+ messages in thread
From: Csókás Bence @ 2024-10-27 18:03 UTC (permalink / raw)
To: dmaengine, linux-arm-kernel, linux-sunxi, linux-kernel
Cc: Mesih Kilinc, Vinod Koul, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Philipp Zabel
On 2024. 10. 27. 10:14, Csókás, Bence wrote:
> From: Mesih Kilinc <mesihkilinc@gmail.com>
>
> Allwinner suniv F1C100s has a reset bit for DMA in CCU. Sun4i do not
> has this bit but in order to support suniv we need to add it. So add
> support for reset bit.
>
> Signed-off-by: Mesih Kilinc <mesihkilinc@gmail.com>
> [ csokas.bence: Rebased and addressed comments ]
> Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
> ---
>
> Notes:
> Changes in v2:
> * Call reset_control_deassert() unconditionally, as it supports optional resets
> * Use dev_err_probe()
I missed one, namely:
> + dev_err(&pdev->dev,
> + "Failed to deassert the reset control\n");
> + goto err_clk_disable;
> + }
For now I'll resubmit just this patch, and then wait for more comments
that may arise during the week, then resubmit the whole amended series.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v3 02/10] dma-engine: sun4i: Add has_reset option to quirk
2024-10-27 18:03 ` Csókás Bence
@ 2024-10-27 18:08 ` Csókás, Bence
2024-10-27 20:43 ` Krzysztof Kozlowski
0 siblings, 1 reply; 24+ messages in thread
From: Csókás, Bence @ 2024-10-27 18:08 UTC (permalink / raw)
To: dmaengine, linux-arm-kernel, linux-sunxi, linux-kernel
Cc: Mesih Kilinc, Csókás, Bence, Vinod Koul, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, Philipp Zabel
From: Mesih Kilinc <mesihkilinc@gmail.com>
Allwinner suniv F1C100s has a reset bit for DMA in CCU. Sun4i do not
has this bit but in order to support suniv we need to add it. So add
support for reset bit.
Signed-off-by: Mesih Kilinc <mesihkilinc@gmail.com>
[ csokas.bence: Rebased and addressed comments ]
Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
---
Notes:
Changes in v2:
* Call reset_control_deassert() unconditionally, as it supports optional resets
* Use dev_err_probe()
* Whitespace
Changes in v3:
* More dev_err_probe()
drivers/dma/sun4i-dma.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/dma/sun4i-dma.c b/drivers/dma/sun4i-dma.c
index d472f57a39ea..f485d6f378c0 100644
--- a/drivers/dma/sun4i-dma.c
+++ b/drivers/dma/sun4i-dma.c
@@ -15,6 +15,7 @@
#include <linux/of_dma.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
+#include <linux/reset.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
@@ -159,6 +160,7 @@ struct sun4i_dma_config {
u8 ddma_drq_sdram;
u8 max_burst;
+ bool has_reset;
};
struct sun4i_dma_pchan {
@@ -208,6 +210,7 @@ struct sun4i_dma_dev {
int irq;
spinlock_t lock;
const struct sun4i_dma_config *cfg;
+ struct reset_control *rst;
};
static struct sun4i_dma_dev *to_sun4i_dma_dev(struct dma_device *dev)
@@ -1215,6 +1218,16 @@ static int sun4i_dma_probe(struct platform_device *pdev)
return PTR_ERR(priv->clk);
}
+ if (priv->cfg->has_reset) {
+ priv->rst = devm_reset_control_get_exclusive(&pdev->dev,
+ NULL);
+ if (IS_ERR(priv->rst)) {
+ dev_err_probe(&pdev->dev, PTR_ERR(priv->rst),
+ "Failed to get reset control\n");
+ return PTR_ERR(priv->rst);
+ }
+ }
+
platform_set_drvdata(pdev, priv);
spin_lock_init(&priv->lock);
@@ -1287,6 +1300,14 @@ static int sun4i_dma_probe(struct platform_device *pdev)
return ret;
}
+ /* Deassert the reset control */
+ ret = reset_control_deassert(priv->rst);
+ if (ret) {
+ dev_err_probe(&pdev->dev, ret,
+ "Failed to deassert the reset control\n");
+ goto err_clk_disable;
+ }
+
/*
* Make sure the IRQs are all disabled and accounted for. The bootloader
* likes to leave these dirty
@@ -1356,6 +1377,7 @@ static struct sun4i_dma_config sun4i_a10_dma_cfg = {
.ddma_drq_sdram = SUN4I_DDMA_DRQ_TYPE_SDRAM,
.max_burst = SUN4I_MAX_BURST,
+ .has_reset = false,
};
static const struct of_device_id sun4i_dma_match[] = {
--
2.34.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH v2 02/10] dma-engine: sun4i: Add has_reset option to quirk
2024-10-27 9:14 ` [PATCH v2 02/10] dma-engine: sun4i: Add has_reset option to quirk Csókás, Bence
2024-10-27 18:03 ` Csókás Bence
@ 2024-10-27 19:12 ` kernel test robot
2024-10-27 20:05 ` kernel test robot
2024-10-27 20:42 ` Krzysztof Kozlowski
3 siblings, 0 replies; 24+ messages in thread
From: kernel test robot @ 2024-10-27 19:12 UTC (permalink / raw)
To: Csókás, Bence, dmaengine, linux-arm-kernel, linux-sunxi,
linux-kernel
Cc: oe-kbuild-all, Mesih Kilinc, Csókás, Bence, Vinod Koul,
Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel
Hi Bence,
kernel test robot noticed the following build errors:
[auto build test ERROR on sunxi/sunxi/for-next]
[also build test ERROR on vkoul-dmaengine/next broonie-sound/for-next arm64/for-next/core clk/clk-next kvmarm/next rockchip/for-next shawnguo/for-next soc/for-next arm/for-next arm/fixes linus/master v6.12-rc4 next-20241025]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Cs-k-s-Bence/dma-engine-sun4i-Add-has_reset-option-to-quirk/20241027-172307
base: https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux.git sunxi/for-next
patch link: https://lore.kernel.org/r/20241027091440.1913863-2-csokas.bence%40prolan.hu
patch subject: [PATCH v2 02/10] dma-engine: sun4i: Add has_reset option to quirk
config: arm-multi_v7_defconfig (https://download.01.org/0day-ci/archive/20241028/202410280225.baqFmTsa-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 13.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241028/202410280225.baqFmTsa-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410280225.baqFmTsa-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
drivers/dma/sun4i-dma.c: In function 'sun4i_dma_probe':
>> drivers/dma/sun4i-dma.c:1225:51: warning: passing argument 2 of 'dev_err_probe' makes integer from pointer without a cast [-Wint-conversion]
1225 | dev_err_probe(&pdev->dev, "Failed to get reset control\n");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| char *
In file included from include/linux/device.h:15,
from include/linux/dma-mapping.h:8,
from drivers/dma/sun4i-dma.c:10:
include/linux/dev_printk.h:278:64: note: expected 'int' but argument is of type 'char *'
278 | __printf(3, 4) int dev_err_probe(const struct device *dev, int err, const char *fmt, ...);
| ~~~~^~~
>> drivers/dma/sun4i-dma.c:1225:25: error: too few arguments to function 'dev_err_probe'
1225 | dev_err_probe(&pdev->dev, "Failed to get reset control\n");
| ^~~~~~~~~~~~~
include/linux/dev_printk.h:278:20: note: declared here
278 | __printf(3, 4) int dev_err_probe(const struct device *dev, int err, const char *fmt, ...);
| ^~~~~~~~~~~~~
vim +/dev_err_probe +1225 drivers/dma/sun4i-dma.c
1193
1194 static int sun4i_dma_probe(struct platform_device *pdev)
1195 {
1196 struct sun4i_dma_dev *priv;
1197 int i, j, ret;
1198
1199 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
1200 if (!priv)
1201 return -ENOMEM;
1202
1203 priv->cfg = of_device_get_match_data(&pdev->dev);
1204 if (!priv->cfg)
1205 return -ENODEV;
1206
1207 priv->base = devm_platform_ioremap_resource(pdev, 0);
1208 if (IS_ERR(priv->base))
1209 return PTR_ERR(priv->base);
1210
1211 priv->irq = platform_get_irq(pdev, 0);
1212 if (priv->irq < 0)
1213 return priv->irq;
1214
1215 priv->clk = devm_clk_get(&pdev->dev, NULL);
1216 if (IS_ERR(priv->clk)) {
1217 dev_err(&pdev->dev, "No clock specified\n");
1218 return PTR_ERR(priv->clk);
1219 }
1220
1221 if (priv->cfg->has_reset) {
1222 priv->rst = devm_reset_control_get_exclusive(&pdev->dev,
1223 NULL);
1224 if (IS_ERR(priv->rst)) {
> 1225 dev_err_probe(&pdev->dev, "Failed to get reset control\n");
1226 return PTR_ERR(priv->rst);
1227 }
1228 }
1229
1230 platform_set_drvdata(pdev, priv);
1231 spin_lock_init(&priv->lock);
1232
1233 dma_set_max_seg_size(&pdev->dev, SUN4I_DMA_MAX_SEG_SIZE);
1234
1235 dma_cap_zero(priv->slave.cap_mask);
1236 dma_cap_set(DMA_PRIVATE, priv->slave.cap_mask);
1237 dma_cap_set(DMA_MEMCPY, priv->slave.cap_mask);
1238 dma_cap_set(DMA_CYCLIC, priv->slave.cap_mask);
1239 dma_cap_set(DMA_SLAVE, priv->slave.cap_mask);
1240
1241 INIT_LIST_HEAD(&priv->slave.channels);
1242 priv->slave.device_free_chan_resources = sun4i_dma_free_chan_resources;
1243 priv->slave.device_tx_status = sun4i_dma_tx_status;
1244 priv->slave.device_issue_pending = sun4i_dma_issue_pending;
1245 priv->slave.device_prep_slave_sg = sun4i_dma_prep_slave_sg;
1246 priv->slave.device_prep_dma_memcpy = sun4i_dma_prep_dma_memcpy;
1247 priv->slave.device_prep_dma_cyclic = sun4i_dma_prep_dma_cyclic;
1248 priv->slave.device_config = sun4i_dma_config;
1249 priv->slave.device_terminate_all = sun4i_dma_terminate_all;
1250 priv->slave.copy_align = 2;
1251 priv->slave.src_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) |
1252 BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) |
1253 BIT(DMA_SLAVE_BUSWIDTH_4_BYTES);
1254 priv->slave.dst_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) |
1255 BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) |
1256 BIT(DMA_SLAVE_BUSWIDTH_4_BYTES);
1257 priv->slave.directions = BIT(DMA_DEV_TO_MEM) |
1258 BIT(DMA_MEM_TO_DEV);
1259 priv->slave.residue_granularity = DMA_RESIDUE_GRANULARITY_BURST;
1260
1261 priv->slave.dev = &pdev->dev;
1262
1263 priv->pchans = devm_kcalloc(&pdev->dev, priv->cfg->dma_nr_max_channels,
1264 sizeof(struct sun4i_dma_pchan), GFP_KERNEL);
1265 priv->vchans = devm_kcalloc(&pdev->dev, SUN4I_DMA_NR_MAX_VCHANS,
1266 sizeof(struct sun4i_dma_vchan), GFP_KERNEL);
1267 priv->pchans_used = devm_kcalloc(&pdev->dev,
1268 BITS_TO_LONGS(priv->cfg->dma_nr_max_channels),
1269 sizeof(unsigned long), GFP_KERNEL);
1270 if (!priv->vchans || !priv->pchans || !priv->pchans_used)
1271 return -ENOMEM;
1272
1273 /*
1274 * [0..priv->cfg->ndma_nr_max_channels) are normal pchans, and
1275 * [priv->cfg->ndma_nr_max_channels..priv->cfg->dma_nr_max_channels) are
1276 * dedicated ones
1277 */
1278 for (i = 0; i < priv->cfg->ndma_nr_max_channels; i++)
1279 priv->pchans[i].base = priv->base +
1280 SUN4I_NDMA_CHANNEL_REG_BASE(i);
1281
1282 for (j = 0; i < priv->cfg->dma_nr_max_channels; i++, j++) {
1283 priv->pchans[i].base = priv->base +
1284 SUN4I_DDMA_CHANNEL_REG_BASE(j);
1285 priv->pchans[i].is_dedicated = 1;
1286 }
1287
1288 for (i = 0; i < SUN4I_DMA_NR_MAX_VCHANS; i++) {
1289 struct sun4i_dma_vchan *vchan = &priv->vchans[i];
1290
1291 spin_lock_init(&vchan->vc.lock);
1292 vchan->vc.desc_free = sun4i_dma_free_contract;
1293 vchan_init(&vchan->vc, &priv->slave);
1294 }
1295
1296 ret = clk_prepare_enable(priv->clk);
1297 if (ret) {
1298 dev_err(&pdev->dev, "Couldn't enable the clock\n");
1299 return ret;
1300 }
1301
1302 /* Deassert the reset control */
1303 ret = reset_control_deassert(priv->rst);
1304 if (ret) {
1305 dev_err(&pdev->dev,
1306 "Failed to deassert the reset control\n");
1307 goto err_clk_disable;
1308 }
1309
1310 /*
1311 * Make sure the IRQs are all disabled and accounted for. The bootloader
1312 * likes to leave these dirty
1313 */
1314 writel(0, priv->base + SUN4I_DMA_IRQ_ENABLE_REG);
1315 writel(0xFFFFFFFF, priv->base + SUN4I_DMA_IRQ_PENDING_STATUS_REG);
1316
1317 ret = devm_request_irq(&pdev->dev, priv->irq, sun4i_dma_interrupt,
1318 0, dev_name(&pdev->dev), priv);
1319 if (ret) {
1320 dev_err(&pdev->dev, "Cannot request IRQ\n");
1321 goto err_clk_disable;
1322 }
1323
1324 ret = dma_async_device_register(&priv->slave);
1325 if (ret) {
1326 dev_warn(&pdev->dev, "Failed to register DMA engine device\n");
1327 goto err_clk_disable;
1328 }
1329
1330 ret = of_dma_controller_register(pdev->dev.of_node, sun4i_dma_of_xlate,
1331 priv);
1332 if (ret) {
1333 dev_err(&pdev->dev, "of_dma_controller_register failed\n");
1334 goto err_dma_unregister;
1335 }
1336
1337 dev_dbg(&pdev->dev, "Successfully probed SUN4I_DMA\n");
1338
1339 return 0;
1340
1341 err_dma_unregister:
1342 dma_async_device_unregister(&priv->slave);
1343 err_clk_disable:
1344 clk_disable_unprepare(priv->clk);
1345 return ret;
1346 }
1347
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2 02/10] dma-engine: sun4i: Add has_reset option to quirk
2024-10-27 9:14 ` [PATCH v2 02/10] dma-engine: sun4i: Add has_reset option to quirk Csókás, Bence
2024-10-27 18:03 ` Csókás Bence
2024-10-27 19:12 ` [PATCH v2 " kernel test robot
@ 2024-10-27 20:05 ` kernel test robot
2024-10-27 20:42 ` Krzysztof Kozlowski
3 siblings, 0 replies; 24+ messages in thread
From: kernel test robot @ 2024-10-27 20:05 UTC (permalink / raw)
To: Csókás, Bence, dmaengine, linux-arm-kernel, linux-sunxi,
linux-kernel
Cc: oe-kbuild-all, Mesih Kilinc, Csókás, Bence, Vinod Koul,
Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel
Hi Bence,
kernel test robot noticed the following build errors:
[auto build test ERROR on sunxi/sunxi/for-next]
[also build test ERROR on vkoul-dmaengine/next broonie-sound/for-next arm64/for-next/core clk/clk-next kvmarm/next rockchip/for-next shawnguo/for-next soc/for-next arm/for-next arm/fixes linus/master v6.12-rc4 next-20241025]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Cs-k-s-Bence/dma-engine-sun4i-Add-has_reset-option-to-quirk/20241027-172307
base: https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux.git sunxi/for-next
patch link: https://lore.kernel.org/r/20241027091440.1913863-2-csokas.bence%40prolan.hu
patch subject: [PATCH v2 02/10] dma-engine: sun4i: Add has_reset option to quirk
config: arm-sunxi_defconfig (https://download.01.org/0day-ci/archive/20241028/202410280330.S1S4TKbz-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241028/202410280330.S1S4TKbz-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410280330.S1S4TKbz-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/dma/sun4i-dma.c: In function 'sun4i_dma_probe':
>> drivers/dma/sun4i-dma.c:1225:51: error: passing argument 2 of 'dev_err_probe' makes integer from pointer without a cast [-Wint-conversion]
1225 | dev_err_probe(&pdev->dev, "Failed to get reset control\n");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| char *
In file included from include/linux/device.h:15,
from include/linux/dma-mapping.h:8,
from drivers/dma/sun4i-dma.c:10:
include/linux/dev_printk.h:278:64: note: expected 'int' but argument is of type 'char *'
278 | __printf(3, 4) int dev_err_probe(const struct device *dev, int err, const char *fmt, ...);
| ~~~~^~~
drivers/dma/sun4i-dma.c:1225:25: error: too few arguments to function 'dev_err_probe'
1225 | dev_err_probe(&pdev->dev, "Failed to get reset control\n");
| ^~~~~~~~~~~~~
include/linux/dev_printk.h:278:20: note: declared here
278 | __printf(3, 4) int dev_err_probe(const struct device *dev, int err, const char *fmt, ...);
| ^~~~~~~~~~~~~
vim +/dev_err_probe +1225 drivers/dma/sun4i-dma.c
1193
1194 static int sun4i_dma_probe(struct platform_device *pdev)
1195 {
1196 struct sun4i_dma_dev *priv;
1197 int i, j, ret;
1198
1199 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
1200 if (!priv)
1201 return -ENOMEM;
1202
1203 priv->cfg = of_device_get_match_data(&pdev->dev);
1204 if (!priv->cfg)
1205 return -ENODEV;
1206
1207 priv->base = devm_platform_ioremap_resource(pdev, 0);
1208 if (IS_ERR(priv->base))
1209 return PTR_ERR(priv->base);
1210
1211 priv->irq = platform_get_irq(pdev, 0);
1212 if (priv->irq < 0)
1213 return priv->irq;
1214
1215 priv->clk = devm_clk_get(&pdev->dev, NULL);
1216 if (IS_ERR(priv->clk)) {
1217 dev_err(&pdev->dev, "No clock specified\n");
1218 return PTR_ERR(priv->clk);
1219 }
1220
1221 if (priv->cfg->has_reset) {
1222 priv->rst = devm_reset_control_get_exclusive(&pdev->dev,
1223 NULL);
1224 if (IS_ERR(priv->rst)) {
> 1225 dev_err_probe(&pdev->dev, "Failed to get reset control\n");
1226 return PTR_ERR(priv->rst);
1227 }
1228 }
1229
1230 platform_set_drvdata(pdev, priv);
1231 spin_lock_init(&priv->lock);
1232
1233 dma_set_max_seg_size(&pdev->dev, SUN4I_DMA_MAX_SEG_SIZE);
1234
1235 dma_cap_zero(priv->slave.cap_mask);
1236 dma_cap_set(DMA_PRIVATE, priv->slave.cap_mask);
1237 dma_cap_set(DMA_MEMCPY, priv->slave.cap_mask);
1238 dma_cap_set(DMA_CYCLIC, priv->slave.cap_mask);
1239 dma_cap_set(DMA_SLAVE, priv->slave.cap_mask);
1240
1241 INIT_LIST_HEAD(&priv->slave.channels);
1242 priv->slave.device_free_chan_resources = sun4i_dma_free_chan_resources;
1243 priv->slave.device_tx_status = sun4i_dma_tx_status;
1244 priv->slave.device_issue_pending = sun4i_dma_issue_pending;
1245 priv->slave.device_prep_slave_sg = sun4i_dma_prep_slave_sg;
1246 priv->slave.device_prep_dma_memcpy = sun4i_dma_prep_dma_memcpy;
1247 priv->slave.device_prep_dma_cyclic = sun4i_dma_prep_dma_cyclic;
1248 priv->slave.device_config = sun4i_dma_config;
1249 priv->slave.device_terminate_all = sun4i_dma_terminate_all;
1250 priv->slave.copy_align = 2;
1251 priv->slave.src_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) |
1252 BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) |
1253 BIT(DMA_SLAVE_BUSWIDTH_4_BYTES);
1254 priv->slave.dst_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) |
1255 BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) |
1256 BIT(DMA_SLAVE_BUSWIDTH_4_BYTES);
1257 priv->slave.directions = BIT(DMA_DEV_TO_MEM) |
1258 BIT(DMA_MEM_TO_DEV);
1259 priv->slave.residue_granularity = DMA_RESIDUE_GRANULARITY_BURST;
1260
1261 priv->slave.dev = &pdev->dev;
1262
1263 priv->pchans = devm_kcalloc(&pdev->dev, priv->cfg->dma_nr_max_channels,
1264 sizeof(struct sun4i_dma_pchan), GFP_KERNEL);
1265 priv->vchans = devm_kcalloc(&pdev->dev, SUN4I_DMA_NR_MAX_VCHANS,
1266 sizeof(struct sun4i_dma_vchan), GFP_KERNEL);
1267 priv->pchans_used = devm_kcalloc(&pdev->dev,
1268 BITS_TO_LONGS(priv->cfg->dma_nr_max_channels),
1269 sizeof(unsigned long), GFP_KERNEL);
1270 if (!priv->vchans || !priv->pchans || !priv->pchans_used)
1271 return -ENOMEM;
1272
1273 /*
1274 * [0..priv->cfg->ndma_nr_max_channels) are normal pchans, and
1275 * [priv->cfg->ndma_nr_max_channels..priv->cfg->dma_nr_max_channels) are
1276 * dedicated ones
1277 */
1278 for (i = 0; i < priv->cfg->ndma_nr_max_channels; i++)
1279 priv->pchans[i].base = priv->base +
1280 SUN4I_NDMA_CHANNEL_REG_BASE(i);
1281
1282 for (j = 0; i < priv->cfg->dma_nr_max_channels; i++, j++) {
1283 priv->pchans[i].base = priv->base +
1284 SUN4I_DDMA_CHANNEL_REG_BASE(j);
1285 priv->pchans[i].is_dedicated = 1;
1286 }
1287
1288 for (i = 0; i < SUN4I_DMA_NR_MAX_VCHANS; i++) {
1289 struct sun4i_dma_vchan *vchan = &priv->vchans[i];
1290
1291 spin_lock_init(&vchan->vc.lock);
1292 vchan->vc.desc_free = sun4i_dma_free_contract;
1293 vchan_init(&vchan->vc, &priv->slave);
1294 }
1295
1296 ret = clk_prepare_enable(priv->clk);
1297 if (ret) {
1298 dev_err(&pdev->dev, "Couldn't enable the clock\n");
1299 return ret;
1300 }
1301
1302 /* Deassert the reset control */
1303 ret = reset_control_deassert(priv->rst);
1304 if (ret) {
1305 dev_err(&pdev->dev,
1306 "Failed to deassert the reset control\n");
1307 goto err_clk_disable;
1308 }
1309
1310 /*
1311 * Make sure the IRQs are all disabled and accounted for. The bootloader
1312 * likes to leave these dirty
1313 */
1314 writel(0, priv->base + SUN4I_DMA_IRQ_ENABLE_REG);
1315 writel(0xFFFFFFFF, priv->base + SUN4I_DMA_IRQ_PENDING_STATUS_REG);
1316
1317 ret = devm_request_irq(&pdev->dev, priv->irq, sun4i_dma_interrupt,
1318 0, dev_name(&pdev->dev), priv);
1319 if (ret) {
1320 dev_err(&pdev->dev, "Cannot request IRQ\n");
1321 goto err_clk_disable;
1322 }
1323
1324 ret = dma_async_device_register(&priv->slave);
1325 if (ret) {
1326 dev_warn(&pdev->dev, "Failed to register DMA engine device\n");
1327 goto err_clk_disable;
1328 }
1329
1330 ret = of_dma_controller_register(pdev->dev.of_node, sun4i_dma_of_xlate,
1331 priv);
1332 if (ret) {
1333 dev_err(&pdev->dev, "of_dma_controller_register failed\n");
1334 goto err_dma_unregister;
1335 }
1336
1337 dev_dbg(&pdev->dev, "Successfully probed SUN4I_DMA\n");
1338
1339 return 0;
1340
1341 err_dma_unregister:
1342 dma_async_device_unregister(&priv->slave);
1343 err_clk_disable:
1344 clk_disable_unprepare(priv->clk);
1345 return ret;
1346 }
1347
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2 03/10] dt-bindings: dmaengine: Add Allwinner suniv F1C100s DMA
2024-10-27 9:14 ` [PATCH v2 03/10] dt-bindings: dmaengine: Add Allwinner suniv F1C100s DMA Csókás, Bence
@ 2024-10-27 20:40 ` Krzysztof Kozlowski
0 siblings, 0 replies; 24+ messages in thread
From: Krzysztof Kozlowski @ 2024-10-27 20:40 UTC (permalink / raw)
To: Csókás, Bence
Cc: Chen-Yu Tsai, Maxime Ripard, dmaengine, devicetree,
linux-arm-kernel, linux-sunxi, linux-kernel, Conor Dooley,
Vinod Koul, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Jernej Skrabec, Samuel Holland
On Sun, Oct 27, 2024 at 10:14:34AM +0100, Csókás, Bence wrote:
> Add compatible string for Allwinner suniv F1C100s DMA.
>
> Acked-by: Conor Dooley <conor.dooley@microchip.com>
> Link: https://lore.kernel.org/linux-kernel/20241024-recycler-borrowing-5d4296fd4a56@spud/
> [ csokas.bence: Reimplemented Mesih Kilinc's binding in YAML ]
> Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
Missing quotes? Are you sure this passes checkpatch?
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2 02/10] dma-engine: sun4i: Add has_reset option to quirk
2024-10-27 9:14 ` [PATCH v2 02/10] dma-engine: sun4i: Add has_reset option to quirk Csókás, Bence
` (2 preceding siblings ...)
2024-10-27 20:05 ` kernel test robot
@ 2024-10-27 20:42 ` Krzysztof Kozlowski
2024-10-28 7:37 ` Csókás Bence
3 siblings, 1 reply; 24+ messages in thread
From: Krzysztof Kozlowski @ 2024-10-27 20:42 UTC (permalink / raw)
To: Csókás, Bence
Cc: dmaengine, linux-arm-kernel, linux-sunxi, linux-kernel,
Mesih Kilinc, Vinod Koul, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Philipp Zabel
On Sun, Oct 27, 2024 at 10:14:32AM +0100, Csókás, Bence wrote:
> From: Mesih Kilinc <mesihkilinc@gmail.com>
>
> Allwinner suniv F1C100s has a reset bit for DMA in CCU. Sun4i do not
> has this bit but in order to support suniv we need to add it. So add
> support for reset bit.
>
> static struct sun4i_dma_dev *to_sun4i_dma_dev(struct dma_device *dev)
> @@ -1215,6 +1218,15 @@ static int sun4i_dma_probe(struct platform_device *pdev)
> return PTR_ERR(priv->clk);
> }
>
> + if (priv->cfg->has_reset) {
> + priv->rst = devm_reset_control_get_exclusive(&pdev->dev,
> + NULL);
> + if (IS_ERR(priv->rst)) {
> + dev_err_probe(&pdev->dev, "Failed to get reset control\n");
syntax is: return dev_err_probe()
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 02/10] dma-engine: sun4i: Add has_reset option to quirk
2024-10-27 18:08 ` [PATCH v3 " Csókás, Bence
@ 2024-10-27 20:43 ` Krzysztof Kozlowski
2024-10-28 7:31 ` Csókás Bence
0 siblings, 1 reply; 24+ messages in thread
From: Krzysztof Kozlowski @ 2024-10-27 20:43 UTC (permalink / raw)
To: Csókás, Bence
Cc: dmaengine, linux-arm-kernel, linux-sunxi, linux-kernel,
Mesih Kilinc, Vinod Koul, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Philipp Zabel
On Sun, Oct 27, 2024 at 07:08:55PM +0100, Csókás, Bence wrote:
> From: Mesih Kilinc <mesihkilinc@gmail.com>
>
> Allwinner suniv F1C100s has a reset bit for DMA in CCU. Sun4i do not
> has this bit but in order to support suniv we need to add it. So add
> support for reset bit.
>
> Signed-off-by: Mesih Kilinc <mesihkilinc@gmail.com>
> [ csokas.bence: Rebased and addressed comments ]
> Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
> ---
>
> Notes:
> Changes in v2:
> * Call reset_control_deassert() unconditionally, as it supports optional resets
> * Use dev_err_probe()
> * Whitespace
> Changes in v3:
> * More dev_err_probe()
You did not build v2. Then you send v3... which you also did not build.
Please start at least compiling your own code. Then start testing it,
but without building it cannot obviously be even tested.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 02/10] dma-engine: sun4i: Add has_reset option to quirk
2024-10-27 20:43 ` Krzysztof Kozlowski
@ 2024-10-28 7:31 ` Csókás Bence
2024-10-28 8:11 ` Krzysztof Kozlowski
0 siblings, 1 reply; 24+ messages in thread
From: Csókás Bence @ 2024-10-28 7:31 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: dmaengine, linux-arm-kernel, linux-sunxi, linux-kernel,
Mesih Kilinc, Vinod Koul, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Philipp Zabel
Hi,
On 2024. 10. 27. 21:43, Krzysztof Kozlowski wrote:
> You did not build v2. Then you send v3... which you also did not build.
>
> Please start at least compiling your own code. Then start testing it,
> but without building it cannot obviously be even tested.
I forgot to rebase an amend! before sending v2, which I corrected in v3.
I *did* in fact build v3 (after the aforementioned correction) rebased
on top of Linux 6.5, which is what I have available for my board. And I
also *did* test with aplay and confirmed to have working audio. If you
believe there are differences between 6.5 and master that break v3 of
the patch, then please point those out as opposed to making accusations.
Bence
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2 02/10] dma-engine: sun4i: Add has_reset option to quirk
2024-10-27 20:42 ` Krzysztof Kozlowski
@ 2024-10-28 7:37 ` Csókás Bence
2024-10-28 7:44 ` Chen-Yu Tsai
2024-10-28 8:08 ` Krzysztof Kozlowski
0 siblings, 2 replies; 24+ messages in thread
From: Csókás Bence @ 2024-10-28 7:37 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: dmaengine, linux-arm-kernel, linux-sunxi, linux-kernel,
Mesih Kilinc, Vinod Koul, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Philipp Zabel
Hi,
On 2024. 10. 27. 21:42, Krzysztof Kozlowski wrote:
> On Sun, Oct 27, 2024 at 10:14:32AM +0100, Csókás, Bence wrote:
>> From: Mesih Kilinc <mesihkilinc@gmail.com>
>>
>> Allwinner suniv F1C100s has a reset bit for DMA in CCU. Sun4i do not
>> has this bit but in order to support suniv we need to add it. So add
>> support for reset bit.
>>
>> static struct sun4i_dma_dev *to_sun4i_dma_dev(struct dma_device *dev)
>> @@ -1215,6 +1218,15 @@ static int sun4i_dma_probe(struct platform_device *pdev)
>> return PTR_ERR(priv->clk);
>> }
>>
>> + if (priv->cfg->has_reset) {
>> + priv->rst = devm_reset_control_get_exclusive(&pdev->dev,
>> + NULL);
>> + if (IS_ERR(priv->rst)) {
>> + dev_err_probe(&pdev->dev, "Failed to get reset control\n");
>
> syntax is: return dev_err_probe()
>
> Best regards,
> Krzysztof
Thanks! And regarding v3 of this patch, I have `clk_disable_unprepare()`
after `dev_err_probe()`, I assume I have to let that be i.e. not return
immediately?
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2 02/10] dma-engine: sun4i: Add has_reset option to quirk
2024-10-28 7:37 ` Csókás Bence
@ 2024-10-28 7:44 ` Chen-Yu Tsai
2024-10-28 13:12 ` Csókás Bence
2024-10-28 8:08 ` Krzysztof Kozlowski
1 sibling, 1 reply; 24+ messages in thread
From: Chen-Yu Tsai @ 2024-10-28 7:44 UTC (permalink / raw)
To: Csókás Bence
Cc: Krzysztof Kozlowski, dmaengine, linux-arm-kernel, linux-sunxi,
linux-kernel, Mesih Kilinc, Vinod Koul, Jernej Skrabec,
Samuel Holland, Philipp Zabel
On Mon, Oct 28, 2024 at 3:37 PM Csókás Bence <csokas.bence@prolan.hu> wrote:
>
> Hi,
>
> On 2024. 10. 27. 21:42, Krzysztof Kozlowski wrote:
> > On Sun, Oct 27, 2024 at 10:14:32AM +0100, Csókás, Bence wrote:
> >> From: Mesih Kilinc <mesihkilinc@gmail.com>
> >>
> >> Allwinner suniv F1C100s has a reset bit for DMA in CCU. Sun4i do not
> >> has this bit but in order to support suniv we need to add it. So add
> >> support for reset bit.
> >>
> >> static struct sun4i_dma_dev *to_sun4i_dma_dev(struct dma_device *dev)
> >> @@ -1215,6 +1218,15 @@ static int sun4i_dma_probe(struct platform_device *pdev)
> >> return PTR_ERR(priv->clk);
> >> }
> >>
> >> + if (priv->cfg->has_reset) {
> >> + priv->rst = devm_reset_control_get_exclusive(&pdev->dev,
> >> + NULL);
> >> + if (IS_ERR(priv->rst)) {
> >> + dev_err_probe(&pdev->dev, "Failed to get reset control\n");
> >
> > syntax is: return dev_err_probe()
> >
> > Best regards,
> > Krzysztof
>
> Thanks! And regarding v3 of this patch, I have `clk_disable_unprepare()`
> after `dev_err_probe()`, I assume I have to let that be i.e. not return
> immediately?
I suggest adding a patch to switch the clk API calls to devm_clk_get_enabled()
which handles all the cleanup. Similarly you can switch to
devm_reset_control_get_exclusive_deasserted()
for this patch.
ChenYu
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2 02/10] dma-engine: sun4i: Add has_reset option to quirk
2024-10-28 7:37 ` Csókás Bence
2024-10-28 7:44 ` Chen-Yu Tsai
@ 2024-10-28 8:08 ` Krzysztof Kozlowski
1 sibling, 0 replies; 24+ messages in thread
From: Krzysztof Kozlowski @ 2024-10-28 8:08 UTC (permalink / raw)
To: Csókás Bence
Cc: dmaengine, linux-arm-kernel, linux-sunxi, linux-kernel,
Mesih Kilinc, Vinod Koul, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Philipp Zabel
On 28/10/2024 08:37, Csókás Bence wrote:
> Hi,
>
> On 2024. 10. 27. 21:42, Krzysztof Kozlowski wrote:
>> On Sun, Oct 27, 2024 at 10:14:32AM +0100, Csókás, Bence wrote:
>>> From: Mesih Kilinc <mesihkilinc@gmail.com>
>>>
>>> Allwinner suniv F1C100s has a reset bit for DMA in CCU. Sun4i do not
>>> has this bit but in order to support suniv we need to add it. So add
>>> support for reset bit.
>>>
>>> static struct sun4i_dma_dev *to_sun4i_dma_dev(struct dma_device *dev)
>>> @@ -1215,6 +1218,15 @@ static int sun4i_dma_probe(struct platform_device *pdev)
>>> return PTR_ERR(priv->clk);
>>> }
>>>
>>> + if (priv->cfg->has_reset) {
>>> + priv->rst = devm_reset_control_get_exclusive(&pdev->dev,
>>> + NULL);
>>> + if (IS_ERR(priv->rst)) {
>>> + dev_err_probe(&pdev->dev, "Failed to get reset control\n");
>>
>> syntax is: return dev_err_probe()
>>
>> Best regards,
>> Krzysztof
>
> Thanks! And regarding v3 of this patch, I have `clk_disable_unprepare()`
No, you do not. Read your code correctly.
+ dev_err_probe(&pdev->dev, "Failed to get reset control\n");
+ return PTR_ERR(priv->rst);
Where is here clk_disable_unprepare()?
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 02/10] dma-engine: sun4i: Add has_reset option to quirk
2024-10-28 7:31 ` Csókás Bence
@ 2024-10-28 8:11 ` Krzysztof Kozlowski
0 siblings, 0 replies; 24+ messages in thread
From: Krzysztof Kozlowski @ 2024-10-28 8:11 UTC (permalink / raw)
To: Csókás Bence
Cc: dmaengine, linux-arm-kernel, linux-sunxi, linux-kernel,
Mesih Kilinc, Vinod Koul, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Philipp Zabel
On 28/10/2024 08:31, Csókás Bence wrote:
> Hi,
>
> On 2024. 10. 27. 21:43, Krzysztof Kozlowski wrote:
>> You did not build v2. Then you send v3... which you also did not build.
>>
>> Please start at least compiling your own code. Then start testing it,
>> but without building it cannot obviously be even tested.
>
> I forgot to rebase an amend! before sending v2, which I corrected in v3.
> I *did* in fact build v3 (after the aforementioned correction) rebased
> on top of Linux 6.5, which is what I have available for my board. And I
We cannot take patches based on v6.5. That's some close to ancient
kernel nowadays.
> also *did* test with aplay and confirmed to have working audio. If you
> believe there are differences between 6.5 and master that break v3 of
Yes, there are thousands of changes with possible impact.
All your patches must be prepared on latest mainline tree. All your SoC
code must be tested on *latest mainline tree*.
> the patch, then please point those out as opposed to making accusations.
First, your code does not build. Your code might not even apply. I do
not have to point patches causing it, because your job is to work on
mainline. But if you ask about patches causing issues, then I also do
not have to go through 50 000 commits which could have possible impact,
because you are supposed to work on mainline kernel.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2 02/10] dma-engine: sun4i: Add has_reset option to quirk
2024-10-28 7:44 ` Chen-Yu Tsai
@ 2024-10-28 13:12 ` Csókás Bence
2024-10-28 16:22 ` Csókás Bence
0 siblings, 1 reply; 24+ messages in thread
From: Csókás Bence @ 2024-10-28 13:12 UTC (permalink / raw)
To: wens
Cc: Krzysztof Kozlowski, dmaengine, linux-arm-kernel, linux-sunxi,
linux-kernel, Mesih Kilinc, Vinod Koul, Jernej Skrabec,
Samuel Holland, Philipp Zabel
On 2024. 10. 28. 8:44, Chen-Yu Tsai wrote:
> I suggest adding a patch to switch the clk API calls to devm_clk_get_enabled()
> which handles all the cleanup. Similarly you can switch to
>
> devm_reset_control_get_exclusive_deasserted()
>
> for this patch.
>
>
> ChenYu
Huh, that's a new API! Thanks, I'll switch to that then.
Regarding the change to devm_clk_get_enabled(), I think that should be a
separate patch from this series, where all the pre-existing dev_err()'s
get changed as well. If someone wants to work on that, go ahead, but if
no one does then after this series is merged I might get around to that too.
Bence
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2 02/10] dma-engine: sun4i: Add has_reset option to quirk
2024-10-28 13:12 ` Csókás Bence
@ 2024-10-28 16:22 ` Csókás Bence
0 siblings, 0 replies; 24+ messages in thread
From: Csókás Bence @ 2024-10-28 16:22 UTC (permalink / raw)
To: wens
Cc: Krzysztof Kozlowski, dmaengine, linux-arm-kernel, linux-sunxi,
linux-kernel, Mesih Kilinc, Vinod Koul, Jernej Skrabec,
Samuel Holland, Philipp Zabel
On 2024. 10. 28. 14:12, Csókás Bence wrote:
>
>
> On 2024. 10. 28. 8:44, Chen-Yu Tsai wrote:
>> I suggest adding a patch to switch the clk API calls to
>> devm_clk_get_enabled()
>> which handles all the cleanup. Similarly you can switch to
>>
>> devm_reset_control_get_exclusive_deasserted()
>>
>> for this patch.
>>
>>
>> ChenYu
>
> Huh, that's a new API! Thanks, I'll switch to that then.
Actually, it doesn't seem to be merged to Linus' tree yet. I'll probably
just switch it after it is merged.
Bence
^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2024-10-28 16:38 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-27 9:14 [PATCH v2 01/10] dma-engine: sun4i: Add a quirk to support different chips Csókás, Bence
2024-10-27 9:14 ` [PATCH v2 02/10] dma-engine: sun4i: Add has_reset option to quirk Csókás, Bence
2024-10-27 18:03 ` Csókás Bence
2024-10-27 18:08 ` [PATCH v3 " Csókás, Bence
2024-10-27 20:43 ` Krzysztof Kozlowski
2024-10-28 7:31 ` Csókás Bence
2024-10-28 8:11 ` Krzysztof Kozlowski
2024-10-27 19:12 ` [PATCH v2 " kernel test robot
2024-10-27 20:05 ` kernel test robot
2024-10-27 20:42 ` Krzysztof Kozlowski
2024-10-28 7:37 ` Csókás Bence
2024-10-28 7:44 ` Chen-Yu Tsai
2024-10-28 13:12 ` Csókás Bence
2024-10-28 16:22 ` Csókás Bence
2024-10-28 8:08 ` Krzysztof Kozlowski
2024-10-27 9:14 ` [PATCH v2 03/10] dt-bindings: dmaengine: Add Allwinner suniv F1C100s DMA Csókás, Bence
2024-10-27 20:40 ` Krzysztof Kozlowski
2024-10-27 9:14 ` [PATCH v2 04/10] dma-engine: sun4i: Add support for Allwinner suniv F1C100s Csókás, Bence
2024-10-27 9:14 ` [PATCH v2 05/10] ARM: dts: suniv: f1c100s: Add support for DMA Csókás, Bence
2024-10-27 9:14 ` [PATCH v2 06/10] ASoC: sun4i-codec: Add DMA Max Burst field Csókás, Bence
2024-10-27 9:14 ` [PATCH v2 07/10] dt-bindings: sound: Add Allwinner suniv F1C100s Audio Codec Csókás, Bence
2024-10-27 9:14 ` [PATCH v2 08/10] ASoC: sun4i-codec: Add support for Allwinner suniv F1C100s Csókás, Bence
2024-10-27 9:14 ` [PATCH v2 09/10] ARM: dts: suniv: f1c100s: Add support for Audio Codec Csókás, Bence
2024-10-27 9:14 ` [PATCH v2 10/10] ARM: dts: suniv: f1c100s: Activate Audio Codec for Lichee Pi Nano Csókás, Bence
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).