Re: [PATCH spi/for-next] spi: sh-msiof: Add R-Car Gen 2 and 3 fallback bindings

2016-12-14 Thread Mark Brown
On Mon, Dec 12, 2016 at 10:49:35AM +0100, Simon Horman wrote:

> + { .compatible = "renesas,sh-msiof",.data = &sh_data }, // 
> Deprecated

C++ style comment here, please send a followup fixing this.


signature.asc
Description: PGP signature


Applied "spi: sh-msiof: Add R-Car Gen 2 and 3 fallback bindings" to the spi tree

2016-12-14 Thread Mark Brown
The patch

   spi: sh-msiof: Add R-Car Gen 2 and 3 fallback bindings

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 4286db8456f4fa0c6af2b6b9abc5991a7e7da69c Mon Sep 17 00:00:00 2001
From: Simon Horman 
Date: Mon, 12 Dec 2016 10:49:35 +0100
Subject: [PATCH] spi: sh-msiof: Add R-Car Gen 2 and 3 fallback bindings

In the case of Renesas R-Car hardware we know that there are generations of
SoCs, e.g. Gen 2 and Gen 3. But beyond that it's not clear what the
relationship between IP blocks might be. For example, I believe that
r8a7790 is older than r8a7791 but that doesn't imply that the latter is a
descendant of the former or vice versa.

We can, however, by examining the documentation and behaviour of the
hardware at run-time observe that the current driver implementation appears
to be compatible with the IP blocks on SoCs within a given generation.

For the above reasons and convenience when enabling new SoCs a
per-generation fallback compatibility string scheme is being adopted for
drivers for Renesas SoCs.

Also:
* Deprecate renesas,sh-msiof. It seems poorly named as it is only
  compatible with SH-Mobile. It also appears unused in mainline.

Signed-off-by: Simon Horman 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Mark Brown 
---
 Documentation/devicetree/bindings/spi/sh-msiof.txt | 19 +--
 drivers/spi/spi-sh-msiof.c |  4 +++-
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/sh-msiof.txt 
b/Documentation/devicetree/bindings/spi/sh-msiof.txt
index da6614c63796..dc975064fa27 100644
--- a/Documentation/devicetree/bindings/spi/sh-msiof.txt
+++ b/Documentation/devicetree/bindings/spi/sh-msiof.txt
@@ -1,17 +1,23 @@
 Renesas MSIOF spi controller
 
 Required properties:
-- compatible   : "renesas,msiof-" for SoCs,
-"renesas,sh-msiof" for SuperH, or
-"renesas,sh-mobile-msiof" for SH Mobile series.
-Examples with soctypes are:
-"renesas,msiof-r8a7790" (R-Car H2)
+- compatible   : "renesas,msiof-r8a7790" (R-Car H2)
 "renesas,msiof-r8a7791" (R-Car M2-W)
 "renesas,msiof-r8a7792" (R-Car V2H)
 "renesas,msiof-r8a7793" (R-Car M2-N)
 "renesas,msiof-r8a7794" (R-Car E2)
 "renesas,msiof-r8a7796" (R-Car M3-W)
 "renesas,msiof-sh73a0" (SH-Mobile AG5)
+"renesas,sh-mobile-msiof" (generic SH-Mobile 
compatibile device)
+"renesas,rcar-gen2-msiof" (generic R-Car Gen2 
compatible device)
+"renesas,rcar-gen3-msiof" (generic R-Car Gen3 
compatible device)
+"renesas,sh-msiof"  (deprecated)
+
+When compatible with the generic version, nodes
+must list the SoC-specific version corresponding
+to the platform first followed by the generic
+version.
+
 - reg  : A list of offsets and lengths of the register sets for
 the device.
 If only one register set is present, it is to be used
@@ -61,7 +67,8 @@ Documentation/devicetree/bindings/pinctrl/renesas,*.
 Example:
 
msiof0: spi@e6e2 {
-   compatible = "renesas,msiof-r8a7791";
+   compatible = "renesas,msiof-r8a7791",
+"renesas,rcar-gen2-msiof";
reg = <0 0xe6e2 0 0x0064>;
interrupts = <0 156 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&mstp0_clks R8A7791_CLK_MSIOF0>;
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index 0012ad02e569..471ca211b76c 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -973,14 +973,16 @@ static 

Re: [PATCH/RFC v2 3/7] spi: core: Add support for registering SPI slave controllers

2016-12-15 Thread Mark Brown
On Sun, Sep 18, 2016 at 11:04:18AM +0200, Geert Uytterhoeven wrote:

> This is caused by moving the setup of master->dev.class.
> To fix this, I can
>   1) Introduce a separate spi_alloc_slave() function, which sets up
>  spi_slave_class instead of spi_master class,

This seems more idiomatic.


signature.asc
Description: PGP signature


Re: [PATCH/RFC v2 3/7] spi: core: Add support for registering SPI slave controllers

2016-12-15 Thread Mark Brown
On Mon, Sep 12, 2016 at 10:50:42PM +0200, Geert Uytterhoeven wrote:

> TBD:
>   - s/spi_master/spi_controller/ where appropriate,
>   - Provide wrappers (e.g. "#define spi_master spi_controller" until all
> SPI drivers have been converted),
>   - Do we want a separate spi_register_slave() instead?

This basically looks fine to me - there's these TBDs so I might be
missing things and we probably need some GPIO chip select handling but
that's a separate thing.  Sorry it took me so long to review this.


signature.asc
Description: PGP signature


Applied "spi: core: Extract of_spi_parse_dt()" to the spi tree

2016-12-15 Thread Mark Brown
The patch

   spi: core: Extract of_spi_parse_dt()

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From c2e51ac3d0542440d5b2b8b52ff2ad00751af4da Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven 
Date: Mon, 12 Sep 2016 22:50:41 +0200
Subject: [PATCH] spi: core: Extract of_spi_parse_dt()

Extract the parsing of SPI slave-specific properties into its own
function, so it can be reused later for SPI slave controllers.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Mark Brown 
---
 drivers/spi/spi.c | 60 +--
 1 file changed, 36 insertions(+), 24 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 656dd3e3220c..1861255866d7 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1502,37 +1502,18 @@ static int spi_master_initialize_queue(struct 
spi_master *master)
 /*-*/
 
 #if defined(CONFIG_OF)
-static struct spi_device *
-of_register_spi_device(struct spi_master *master, struct device_node *nc)
+static int of_spi_parse_dt(struct spi_master *master, struct spi_device *spi,
+  struct device_node *nc)
 {
-   struct spi_device *spi;
-   int rc;
u32 value;
-
-   /* Alloc an spi_device */
-   spi = spi_alloc_device(master);
-   if (!spi) {
-   dev_err(&master->dev, "spi_device alloc error for %s\n",
-   nc->full_name);
-   rc = -ENOMEM;
-   goto err_out;
-   }
-
-   /* Select device driver */
-   rc = of_modalias_node(nc, spi->modalias,
-   sizeof(spi->modalias));
-   if (rc < 0) {
-   dev_err(&master->dev, "cannot find modalias for %s\n",
-   nc->full_name);
-   goto err_out;
-   }
+   int rc;
 
/* Device address */
rc = of_property_read_u32(nc, "reg", &value);
if (rc) {
dev_err(&master->dev, "%s has no valid 'reg' property (%d)\n",
nc->full_name, rc);
-   goto err_out;
+   return rc;
}
spi->chip_select = value;
 
@@ -1590,10 +1571,41 @@ of_register_spi_device(struct spi_master *master, 
struct device_node *nc)
if (rc) {
dev_err(&master->dev, "%s has no valid 'spi-max-frequency' 
property (%d)\n",
nc->full_name, rc);
-   goto err_out;
+   return rc;
}
spi->max_speed_hz = value;
 
+   return 0;
+}
+
+static struct spi_device *
+of_register_spi_device(struct spi_master *master, struct device_node *nc)
+{
+   struct spi_device *spi;
+   int rc;
+
+   /* Alloc an spi_device */
+   spi = spi_alloc_device(master);
+   if (!spi) {
+   dev_err(&master->dev, "spi_device alloc error for %s\n",
+   nc->full_name);
+   rc = -ENOMEM;
+   goto err_out;
+   }
+
+   /* Select device driver */
+   rc = of_modalias_node(nc, spi->modalias,
+   sizeof(spi->modalias));
+   if (rc < 0) {
+   dev_err(&master->dev, "cannot find modalias for %s\n",
+   nc->full_name);
+   goto err_out;
+   }
+
+   rc = of_spi_parse_dt(master, spi, nc);
+   if (rc)
+   goto err_out;
+
/* Store a pointer to the node in the device structure */
of_node_get(nc);
spi->dev.of_node = nc;
-- 
2.11.0



Re: [PATCH/RFC v2 3/7] spi: core: Add support for registering SPI slave controllers

2016-12-19 Thread Mark Brown
On Mon, Dec 19, 2016 at 11:02:07AM +0100, Geert Uytterhoeven wrote:
> On Thu, Dec 15, 2016 at 6:53 PM, Mark Brown  wrote:
> > On Mon, Sep 12, 2016 at 10:50:42PM +0200, Geert Uytterhoeven wrote:
> >> TBD:
> >>   - s/spi_master/spi_controller/ where appropriate,
> >>   - Provide wrappers (e.g. "#define spi_master spi_controller" until all
> >> SPI drivers have been converted),
> >>   - Do we want a separate spi_register_slave() instead?

> > This basically looks fine to me - there's these TBDs so I might be
> > missing things and we probably need some GPIO chip select handling but

> Given the hard real-time requirements of SPI slave, supporting GPIO chip
> select may not be feasible.

It's not unknown for SPI devices to have some minimum time requirement
from chip select to first clock so it's workable and probably something
people will want at some point.  It can always be done later though.

> As I managed to fix the issue with spi_slave_abort() on MSIOF, I think
> the remaining
> obstacle is the DT binding.  Do you have any feedback or other
> suggestions in that area?

> IMHO having the ability to bind to an SPI slave handler either from DT or
> by using the sysfs virtual file is useful to have.

I think it'd be useful to have DT support but really I think the DT
maintainers are going to have more opinions on this than me.


signature.asc
Description: PGP signature


Applied "spi: sh-msiof: Do not use C++ style comment" to the spi tree

2016-12-20 Thread Mark Brown
The patch

   spi: sh-msiof: Do not use C++ style comment

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 264c3e8de4fbda1d1342213c78fb3788a43cfd41 Mon Sep 17 00:00:00 2001
From: Simon Horman 
Date: Tue, 20 Dec 2016 11:21:16 +0100
Subject: [PATCH] spi: sh-msiof: Do not use C++ style comment

4286db8456f4 ("spi: sh-msiof: Add R-Car Gen 2 and 3 fallback bindings")
added a C++ style comment. This is not in keeping with the style used
for comments elsewhere in this fine. Update it accordingly.

Signed-off-by: Simon Horman 
Signed-off-by: Mark Brown 
---
 drivers/spi/spi-sh-msiof.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index 471ca211b76c..1f00eeb0b5a3 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -982,7 +982,7 @@ static const struct of_device_id sh_msiof_match[] = {
{ .compatible = "renesas,rcar-gen2-msiof", .data = &r8a779x_data },
{ .compatible = "renesas,msiof-r8a7796",   .data = &r8a779x_data },
{ .compatible = "renesas,rcar-gen3-msiof", .data = &r8a779x_data },
-   { .compatible = "renesas,sh-msiof",.data = &sh_data }, // 
Deprecated
+   { .compatible = "renesas,sh-msiof",.data = &sh_data }, /* 
Deprecated */
{},
 };
 MODULE_DEVICE_TABLE(of, sh_msiof_match);
-- 
2.11.0



Applied "spi: sh-msiof: Remove useless memory allocation failure message" to the spi tree

2017-01-04 Thread Mark Brown
The patch

   spi: sh-msiof: Remove useless memory allocation failure message

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From e7ad4a73364c21f40963a35631b285b60fa3198c Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven 
Date: Wed, 4 Jan 2017 11:15:08 +0100
Subject: [PATCH] spi: sh-msiof: Remove useless memory allocation failure
 message

Printing an error on memory allocation failure is unnecessary.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Mark Brown 
---
 drivers/spi/spi-sh-msiof.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index 1f00eeb0b5a3..2ce15ca97782 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -1164,10 +1164,8 @@ static int sh_msiof_spi_probe(struct platform_device 
*pdev)
int ret;
 
master = spi_alloc_master(&pdev->dev, sizeof(struct sh_msiof_spi_priv));
-   if (master == NULL) {
-   dev_err(&pdev->dev, "failed to allocate spi master\n");
+   if (master == NULL)
return -ENOMEM;
-   }
 
p = spi_master_get_devdata(master);
 
-- 
2.11.0



Applied "spi: rspi: Remove useless memory allocation failure message" to the spi tree

2017-01-04 Thread Mark Brown
The patch

   spi: rspi: Remove useless memory allocation failure message

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From ffcfae3823751c72b615b57f700e563667002d09 Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven 
Date: Wed, 4 Jan 2017 11:15:07 +0100
Subject: [PATCH] spi: rspi: Remove useless memory allocation failure message

Printing an error on memory allocation failure is unnecessary.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Mark Brown 
---
 drivers/spi/spi-rspi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
index 9daf50031737..58b7e68013f3 100644
--- a/drivers/spi/spi-rspi.c
+++ b/drivers/spi/spi-rspi.c
@@ -1227,10 +1227,8 @@ static int rspi_probe(struct platform_device *pdev)
const struct spi_ops *ops;
 
master = spi_alloc_master(&pdev->dev, sizeof(struct rspi_data));
-   if (master == NULL) {
-   dev_err(&pdev->dev, "spi_alloc_master error.\n");
+   if (master == NULL)
return -ENOMEM;
-   }
 
of_id = of_match_device(rspi_of_match, &pdev->dev);
if (of_id) {
-- 
2.11.0



Re: [PATCH] spi: rspi: fix the bug related to mount/remount jffs2

2017-02-06 Thread Mark Brown
On Mon, Feb 06, 2017 at 10:02:13AM +0900, DongCV wrote:
> From: Dong 
> 
> This patch fixes the output warning logs and data loss when
> performing mount/umount then remount the device with jffs2 format.

This is not a good changelog since it does not describe what the problem
with the driver is or how the change fixes it - it just says that there
is a problem.

> This is the warning logs when performing mount/umount then remount the device 
> with jffs2 format:
> "root@linaro-naro:~# mount -t jffs2 /dev/mtdblock2 /mnt/media
> [ 3839.928013] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found 
> at 0x03b4: 0x1900 instead
> [ 3839.956515] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found 
> at 0x03b40004: 0x000c instead

Please think hard before including long log messages in upstream
reports, they often contain almost no useful information relative to
their size so often obscure the relevant content in your message.  Some
subset is usually much better (eg, "produces lots of errors like X"
here).


signature.asc
Description: PGP signature


Applied "spi: rspi: Fixes bogus received byte in qspi_transfer_in()" to the spi tree

2017-02-16 Thread Mark Brown
The patch

   spi: rspi: Fixes bogus received byte in qspi_transfer_in()

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 7264abc7000d601726aefb05189ea524ee3995ba Mon Sep 17 00:00:00 2001
From: DongCV 
Date: Wed, 15 Feb 2017 19:50:51 +0900
Subject: [PATCH] spi: rspi: Fixes bogus received byte in qspi_transfer_in()

In qspi_transfer_in(), when receiving the last n (or len) bytes of data,
one bogus byte was written in the receive buffer.
This code leads to a buffer overflow.

"jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found
at 0x03b4: 0x1900 instead
jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found
at 0x03b40004: 0x000c instead"

The error message above happens when trying to mount, unmount,
and remount a jffs2-formatted device.
This patch removed the bogus write to fixes: 3be09bec42a800d4
"spi: rspi: supports 32bytes buffer for DUAL and QUAD"

And here is Geert's comment:

"spi: rspi: Fix bogus received byte in qspi_transfer_in()
When there are less than QSPI_BUFFER_SIZE remaining bytes to be received,
qspi_transfer_in() writes one bogus byte in the receive buffer, possibly
leading to a buffer overflow.
This can be reproduced by mounting, unmounting, and remounting a
jffs2-formatted device, causing lots of warnings like:

"jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found
at 0x03b4: 0x1900 instead"

Remove the bogus write to fix this. "

Signed-off-by: DongCV 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Mark Brown 
---
 drivers/spi/spi-rspi.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
index 9daf50031737..2ee130138066 100644
--- a/drivers/spi/spi-rspi.c
+++ b/drivers/spi/spi-rspi.c
@@ -848,7 +848,6 @@ static int qspi_transfer_in(struct rspi_data *rspi, struct 
spi_transfer *xfer)
ret = rspi_pio_transfer(rspi, NULL, rx, n);
if (ret < 0)
return ret;
-   *rx++ = ret;
}
n -= len;
}
-- 
2.11.0



Applied "spi: rspi: Replaces "n" by "len" in qspi_transfer_*()" to the spi tree

2017-02-16 Thread Mark Brown
The patch

   spi: rspi: Replaces "n" by "len" in qspi_transfer_*()

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From ad16d4a83ddc86151b4a6efe257ba74eb30f9f8e Mon Sep 17 00:00:00 2001
From: DongCV 
Date: Wed, 15 Feb 2017 19:50:52 +0900
Subject: [PATCH] spi: rspi: Replaces "n" by "len" in qspi_transfer_*()

This patch replaced "n" by "len" bytes of data in qspi_transfer_in() and
qspi_transfer_out() function. This will make improving readability.

Signed-off-by: DongCV 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Mark Brown 
---
 drivers/spi/spi-rspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
index 2ee130138066..bc3c8686f4d9 100644
--- a/drivers/spi/spi-rspi.c
+++ b/drivers/spi/spi-rspi.c
@@ -808,7 +808,7 @@ static int qspi_transfer_out(struct rspi_data *rspi, struct 
spi_transfer *xfer)
for (i = 0; i < len; i++)
rspi_write_data(rspi, *tx++);
} else {
-   ret = rspi_pio_transfer(rspi, tx, NULL, n);
+   ret = rspi_pio_transfer(rspi, tx, NULL, len);
if (ret < 0)
return ret;
}
@@ -845,7 +845,7 @@ static int qspi_transfer_in(struct rspi_data *rspi, struct 
spi_transfer *xfer)
for (i = 0; i < len; i++)
*rx++ = rspi_read_data(rspi);
} else {
-   ret = rspi_pio_transfer(rspi, NULL, rx, n);
+   ret = rspi_pio_transfer(rspi, NULL, rx, len);
if (ret < 0)
return ret;
}
-- 
2.11.0



Applied "ASoC: rcar: clear DE bit only in PDMACHCR when it stops" to the asoc tree

2017-03-15 Thread Mark Brown
The patch

   ASoC: rcar: clear DE bit only in PDMACHCR when it stops

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 62a10498afb27370ec6018e9d802b74850fd8d9a Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Tue, 14 Mar 2017 09:34:49 +0900
Subject: [PATCH] ASoC: rcar: clear DE bit only in PDMACHCR when it stops

R-Car datasheet indicates "Clear DE in PDMACHCR" for transfer stop,
but current code clears all bits in PDMACHCR.
Because of this, DE bit might never been cleared,
and it causes CMD overflow. This patch fixes this issue.

Signed-off-by: Kuninori Morimoto 
Tested-by: Hiroyuki Yokoyama 
Signed-off-by: Mark Brown 
---
 sound/soc/sh/rcar/dma.c | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
index 1f405c833867..c2e199b4fcf4 100644
--- a/sound/soc/sh/rcar/dma.c
+++ b/sound/soc/sh/rcar/dma.c
@@ -454,6 +454,20 @@ static u32 rsnd_dmapp_read(struct rsnd_dma *dma, u32 reg)
return ioread32(rsnd_dmapp_addr(dmac, dma, reg));
 }
 
+static void rsnd_dmapp_bset(struct rsnd_dma *dma, u32 data, u32 mask, u32 reg)
+{
+   struct rsnd_mod *mod = rsnd_mod_get(dma);
+   struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
+   struct rsnd_dma_ctrl *dmac = rsnd_priv_to_dmac(priv);
+   volatile void __iomem *addr = rsnd_dmapp_addr(dmac, dma, reg);
+   u32 val = ioread32(addr);
+
+   val &= ~mask;
+   val |= (data & mask);
+
+   iowrite32(val, addr);
+}
+
 static int rsnd_dmapp_stop(struct rsnd_mod *mod,
   struct rsnd_dai_stream *io,
   struct rsnd_priv *priv)
@@ -461,10 +475,10 @@ static int rsnd_dmapp_stop(struct rsnd_mod *mod,
struct rsnd_dma *dma = rsnd_mod_to_dma(mod);
int i;
 
-   rsnd_dmapp_write(dma, 0, PDMACHCR);
+   rsnd_dmapp_bset(dma, 0,  PDMACHCR_DE, PDMACHCR);
 
for (i = 0; i < 1024; i++) {
-   if (0 == rsnd_dmapp_read(dma, PDMACHCR))
+   if (0 == (rsnd_dmapp_read(dma, PDMACHCR) & PDMACHCR_DE))
return 0;
udelay(1);
}
-- 
2.11.0



Applied "ASoC: simple-scu-card: add new simple_priv_to_card() macro" to the asoc tree

2017-03-16 Thread Mark Brown
The patch

   ASoC: simple-scu-card: add new simple_priv_to_card() macro

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From d27f3b4a2d81e873de4d11899e510a1a507da8e3 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Wed, 15 Mar 2017 04:44:16 +
Subject: [PATCH] ASoC: simple-scu-card: add new simple_priv_to_card() macro

Current simple card driver is directly calling priv->snd_card
everywhere, but it makes unreadable code.
Let's use simple_priv_to_card() macro for it

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/generic/simple-scu-card.c | 35 ---
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/sound/soc/generic/simple-scu-card.c 
b/sound/soc/generic/simple-scu-card.c
index 93d7d8980cd5..cd0f3f50eebf 100644
--- a/sound/soc/generic/simple-scu-card.c
+++ b/sound/soc/generic/simple-scu-card.c
@@ -31,9 +31,10 @@ struct simple_card_data {
u32 convert_channels;
 };
 
-#define simple_priv_to_dev(priv) ((priv)->snd_card.dev)
-#define simple_priv_to_link(priv, i) ((priv)->snd_card.dai_link + (i))
+#define simple_priv_to_card(priv) (&(priv)->snd_card)
 #define simple_priv_to_props(priv, i) ((priv)->dai_props + (i))
+#define simple_priv_to_dev(priv) (simple_priv_to_card(priv)->dev)
+#define simple_priv_to_link(priv, i) (simple_priv_to_card(priv)->dai_link + 
(i))
 
 #define DAI"sound-dai"
 #define CELL   "#sound-dai-cells"
@@ -109,6 +110,7 @@ static int asoc_simple_card_dai_link_of(struct device_node 
*np,
struct device *dev = simple_priv_to_dev(priv);
struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx);
struct asoc_simple_dai *dai_props = simple_priv_to_props(priv, idx);
+   struct snd_soc_card *card = simple_priv_to_card(priv);
int ret;
 
if (is_fe) {
@@ -163,7 +165,7 @@ static int asoc_simple_card_dai_link_of(struct device_node 
*np,
if (ret < 0)
return ret;
 
-   snd_soc_of_parse_audio_prefix(&priv->snd_card,
+   snd_soc_of_parse_audio_prefix(card,
  &priv->codec_conf,
  dai_link->codec_of_node,
  PREFIX "prefix");
@@ -201,6 +203,7 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
 {
struct device *dev = simple_priv_to_dev(priv);
struct device_node *np;
+   struct snd_soc_card *card = simple_priv_to_card(priv);
unsigned int daifmt = 0;
bool is_fe;
int ret, i;
@@ -208,7 +211,7 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
if (!node)
return -EINVAL;
 
-   ret = snd_soc_of_parse_audio_routing(&priv->snd_card, PREFIX "routing");
+   ret = snd_soc_of_parse_audio_routing(card, PREFIX "routing");
if (ret < 0)
return ret;
 
@@ -239,12 +242,12 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
i++;
}
 
-   ret = asoc_simple_card_parse_card_name(&priv->snd_card, PREFIX);
+   ret = asoc_simple_card_parse_card_name(card, PREFIX);
if (ret < 0)
return ret;
 
dev_dbg(dev, "New card: %s\n",
-   priv->snd_card.name ? priv->snd_card.name : "");
+   card->name ? card->name : "");
dev_dbg(dev, "convert_rate %d\n", priv->convert_rate);
dev_dbg(dev, "convert_channels %d\n", priv->convert_channels);
 
@@ -256,6 +259,7 @@ static int asoc_simple_card_probe(struct platform_device 
*pdev)
struct simple_card_data *priv;
struct snd_soc_dai_link *dai_link;
struct asoc_simple_dai *dai_props;
+   struct snd_soc_card *card;
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
int num, ret;
@@ -276,12 +280,13 @@ static int asoc_simple_card_probe(struct platfo

Applied "ASoC: simple-card: add new simple_priv_to_card() macro" to the asoc tree

2017-03-16 Thread Mark Brown
The patch

   ASoC: simple-card: add new simple_priv_to_card() macro

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 5be509576cf634ad384025f50fc4fcb941d14256 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Wed, 15 Mar 2017 04:44:00 +
Subject: [PATCH] ASoC: simple-card: add new simple_priv_to_card() macro

Current simple card driver is directly calling priv->snd_card
everywhere, but it makes unreadable code.
Let's use simple_priv_to_card() macro for it

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/generic/simple-card.c | 41 +++--
 1 file changed, 23 insertions(+), 18 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 9ad05e237ee0..948f3ba02d12 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -40,9 +40,10 @@ struct simple_card_data {
struct snd_soc_dai_link *dai_link;
 };
 
-#define simple_priv_to_dev(priv) ((priv)->snd_card.dev)
-#define simple_priv_to_link(priv, i) ((priv)->snd_card.dai_link + (i))
+#define simple_priv_to_card(priv) (&(priv)->snd_card)
 #define simple_priv_to_props(priv, i) ((priv)->dai_props + (i))
+#define simple_priv_to_dev(priv) (simple_priv_to_card(priv)->dev)
+#define simple_priv_to_link(priv, i) (simple_priv_to_card(priv)->dai_link + 
(i))
 
 #define DAI"sound-dai"
 #define CELL   "#sound-dai-cells"
@@ -323,6 +324,7 @@ static int asoc_simple_card_parse_aux_devs(struct 
device_node *node,
 {
struct device *dev = simple_priv_to_dev(priv);
struct device_node *aux_node;
+   struct snd_soc_card *card = simple_priv_to_card(priv);
int i, n, len;
 
if (!of_find_property(node, PREFIX "aux-devs", &len))
@@ -332,19 +334,19 @@ static int asoc_simple_card_parse_aux_devs(struct 
device_node *node,
if (n <= 0)
return -EINVAL;
 
-   priv->snd_card.aux_dev = devm_kzalloc(dev,
-   n * sizeof(*priv->snd_card.aux_dev), GFP_KERNEL);
-   if (!priv->snd_card.aux_dev)
+   card->aux_dev = devm_kzalloc(dev,
+   n * sizeof(*card->aux_dev), GFP_KERNEL);
+   if (!card->aux_dev)
return -ENOMEM;
 
for (i = 0; i < n; i++) {
aux_node = of_parse_phandle(node, PREFIX "aux-devs", i);
if (!aux_node)
return -EINVAL;
-   priv->snd_card.aux_dev[i].codec_of_node = aux_node;
+   card->aux_dev[i].codec_of_node = aux_node;
}
 
-   priv->snd_card.num_aux_devs = n;
+   card->num_aux_devs = n;
return 0;
 }
 
@@ -352,6 +354,7 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
 struct simple_card_data *priv)
 {
struct device *dev = simple_priv_to_dev(priv);
+   struct snd_soc_card *card = simple_priv_to_card(priv);
struct device_node *dai_link;
int ret;
 
@@ -362,7 +365,7 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
 
/* The off-codec widgets */
if (of_property_read_bool(node, PREFIX "widgets")) {
-   ret = snd_soc_of_parse_audio_simple_widgets(&priv->snd_card,
+   ret = snd_soc_of_parse_audio_simple_widgets(card,
PREFIX "widgets");
if (ret)
goto card_parse_end;
@@ -370,7 +373,7 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
 
/* DAPM routes */
if (of_property_read_bool(node, PREFIX "routing")) {
-   ret = snd_soc_of_parse_audio_routing(&priv->snd_card,
+   ret = snd_soc_of_parse_audio_routing(card,
PREFIX "routing");
if (ret)
goto card_parse_end;
@@ -401,7 +404,7 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
goto card_parse_end;

Applied "ASoC: simple-scu-card: use defined dev on probe()" to the asoc tree

2017-03-16 Thread Mark Brown
The patch

   ASoC: simple-scu-card: use defined dev on probe()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 40b68dac75a1d16266d3c89244ccf7b899afac3e Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Wed, 15 Mar 2017 04:43:40 +
Subject: [PATCH] ASoC: simple-scu-card: use defined dev on probe()

Current asoc_simple_card_probe() already has dev definition,
but some place doesn't use it. Let's fix this issue.

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/generic/simple-scu-card.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/generic/simple-scu-card.c 
b/sound/soc/generic/simple-scu-card.c
index bb86ee042490..93d7d8980cd5 100644
--- a/sound/soc/generic/simple-scu-card.c
+++ b/sound/soc/generic/simple-scu-card.c
@@ -257,7 +257,7 @@ static int asoc_simple_card_probe(struct platform_device 
*pdev)
struct snd_soc_dai_link *dai_link;
struct asoc_simple_dai *dai_props;
struct device *dev = &pdev->dev;
-   struct device_node *np = pdev->dev.of_node;
+   struct device_node *np = dev->of_node;
int num, ret;
 
/* Allocate the private data */
@@ -292,7 +292,7 @@ static int asoc_simple_card_probe(struct platform_device 
*pdev)
 
snd_soc_card_set_drvdata(&priv->snd_card, priv);
 
-   ret = devm_snd_soc_register_card(&pdev->dev, &priv->snd_card);
+   ret = devm_snd_soc_register_card(dev, &priv->snd_card);
if (ret >= 0)
return ret;
 err:
-- 
2.11.0



Applied "ASoC: simple-card: use defined dev on probe()" to the asoc tree

2017-03-16 Thread Mark Brown
The patch

   ASoC: simple-card: use defined dev on probe()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From dcee9bfe8904518266c95d44a4f435a5f1fa59a1 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Wed, 15 Mar 2017 04:43:21 +
Subject: [PATCH] ASoC: simple-card: use defined dev on probe()

Current asoc_simple_card_probe() already has dev definition,
but some place doesn't use it. Let's fix this issue.

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/generic/simple-card.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index a385ff6bfa4b..9ad05e237ee0 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -418,8 +418,8 @@ static int asoc_simple_card_probe(struct platform_device 
*pdev)
struct simple_card_data *priv;
struct snd_soc_dai_link *dai_link;
struct simple_dai_props *dai_props;
-   struct device_node *np = pdev->dev.of_node;
struct device *dev = &pdev->dev;
+   struct device_node *np = dev->of_node;
int num, ret;
 
/* Get the number of DAI links */
@@ -491,7 +491,7 @@ static int asoc_simple_card_probe(struct platform_device 
*pdev)
 
snd_soc_card_set_drvdata(&priv->snd_card, priv);
 
-   ret = devm_snd_soc_register_card(&pdev->dev, &priv->snd_card);
+   ret = devm_snd_soc_register_card(dev, &priv->snd_card);
if (ret >= 0)
return ret;
 err:
-- 
2.11.0



Applied "ASoC: rcar: dma: remove unnecessary "volatile"" to the asoc tree

2017-03-16 Thread Mark Brown
The patch

   ASoC: rcar: dma: remove unnecessary "volatile"

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 9986943ef5d61a9bea3c86000d91d3b789f0060e Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Thu, 16 Mar 2017 04:22:09 +
Subject: [PATCH] ASoC: rcar: dma: remove unnecessary "volatile"

commit 2a3af642eb20("ASoC: rcar: clear DE bit only in PDMACHCR...")
added rsnd_dmapp_bset(), but it used copy-paste. Thus, it had
unnecessary "volatile", and had below warning on x86.
This patch fix it.

   sound/soc/sh/rcar/dma.c: In function 'rsnd_dmapp_bset':
>> sound/soc/sh/rcar/dma.c:463:21: warning: passing argument 1 of \
   'ioread32' discards 'volatile' qualifier from pointer target \
   type [-Wdiscarded-qualifiers]
 u32 val = ioread32(addr);
^~~~
   In file included from arch/x86/include/asm/io.h:203:0,
from arch/x86/include/asm/realmode.h:5,
from arch/x86/include/asm/acpi.h:33,
from arch/x86/include/asm/fixmap.h:19,
from arch/x86/include/asm/apic.h:10,
from arch/x86/include/asm/smp.h:12,
from include/linux/smp.h:59,
from include/linux/topology.h:33,
from include/linux/gfp.h:8,
from include/linux/idr.h:16,
from include/linux/kernfs.h:14,
from include/linux/sysfs.h:15,
from include/linux/kobject.h:21,
from include/linux/of.h:21,
from include/linux/of_dma.h:16,
from sound/soc/sh/rcar/dma.c:12:
   include/asm-generic/iomap.h:31:21: note: expected 'void *' \
   but argument is of type 'volatile void *'
extern unsigned int ioread32(void __iomem *);
^~~~
Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/sh/rcar/dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
index c2e199b4fcf4..241cb3b08a07 100644
--- a/sound/soc/sh/rcar/dma.c
+++ b/sound/soc/sh/rcar/dma.c
@@ -459,7 +459,7 @@ static void rsnd_dmapp_bset(struct rsnd_dma *dma, u32 data, 
u32 mask, u32 reg)
struct rsnd_mod *mod = rsnd_mod_get(dma);
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct rsnd_dma_ctrl *dmac = rsnd_priv_to_dmac(priv);
-   volatile void __iomem *addr = rsnd_dmapp_addr(dmac, dma, reg);
+   void __iomem *addr = rsnd_dmapp_addr(dmac, dma, reg);
u32 val = ioread32(addr);
 
val &= ~mask;
-- 
2.11.0



Applied "ASoC: rcar: ssi: don't set SSICR.CKDV = 000 with SSIWSR.CONT" to the asoc tree

2017-03-24 Thread Mark Brown
The patch

   ASoC: rcar: ssi: don't set SSICR.CKDV = 000 with SSIWSR.CONT

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 6b8530cc056efd4a11b034ca5b1e9f7e9563f553 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Wed, 22 Mar 2017 04:02:43 +
Subject: [PATCH] ASoC: rcar: ssi: don't set SSICR.CKDV = 000 with SSIWSR.CONT

R-Car Datasheet is indicating "SSICR.CKDV = 000 is invalid when
SSIWSR.WS_MODE = 1 or SSIWSR.CONT = 1".
Current driver will set CONT, thus, we shouldn't use CKDV = 000.
This patch fixup it.

Reported-by: Hiroyuki Yokoyama 
Signed-off-by: Kuninori Morimoto 
Tested-by: Hiroyuki Yokoyama 
Signed-off-by: Mark Brown 
---
 sound/soc/sh/rcar/ssi.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 411bda2387ad..135c5669f796 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -228,6 +228,15 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod,
for (j = 0; j < ARRAY_SIZE(ssi_clk_mul_table); j++) {
 
/*
+* It will set SSIWSR.CONT here, but SSICR.CKDV = 000
+* with it is not allowed. (SSIWSR.WS_MODE with
+* SSICR.CKDV = 000 is not allowed either).
+* Skip it. See SSICR.CKDV
+*/
+   if (j == 0)
+   continue;
+
+   /*
 * this driver is assuming that
 * system word is 32bit x chan
 * see rsnd_ssi_init()
-- 
2.11.0



Applied "ASoC: rcar: enable PCM RATE untile 192000" to the asoc tree

2017-03-24 Thread Mark Brown
The patch

   ASoC: rcar: enable PCM RATE untile 192000

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From dc2721564f6da549f6eb29ac5bca28d65beadcb7 Mon Sep 17 00:00:00 2001
From: Hiroyuki Yokoyama 
Date: Wed, 22 Mar 2017 05:43:35 +
Subject: [PATCH] ASoC: rcar: enable PCM RATE untile 192000

R-Car sound can handle untile 192000 rate.

Signed-off-by: Hiroyuki Yokoyama 
Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/sh/rcar/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 72966bdd3daa..3e852e00b277 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -96,7 +96,7 @@
 #include 
 #include "rsnd.h"
 
-#define RSND_RATES SNDRV_PCM_RATE_8000_96000
+#define RSND_RATES SNDRV_PCM_RATE_8000_192000
 #define RSND_FMTS (SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S16_LE)
 
 static const struct of_device_id rsnd_of_match[] = {
-- 
2.11.0



Applied "ASoC: core: remove pointless auxiliary from snd_soc_component" to the asoc tree

2017-03-24 Thread Mark Brown
The patch

   ASoC: core: remove pointless auxiliary from snd_soc_component

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 991454e17070eaf5286a666d9e896fd6fb332c72 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Fri, 24 Mar 2017 00:13:00 +
Subject: [PATCH] ASoC: core: remove pointless auxiliary from snd_soc_component

commit 1a653aa44725 ("ASoC: core: replace aux_comp_list to ...")
tried to replace aux_comp_list to component_dev_list,
but it failed because of binding timing. Thus, Sylwester fixuped it by
commit d2e3a1358c37 ("ASoC: Fix binding and probing of auxiliary...").

One of main purpose of commit 1a653aa44725 ("ASoC: core: replace...")
was remove replaceable list (= list_aux) from snd_soc_component by using
new "auxiliary" flags (but it failed).
Because of this background, current code has reborned card_aux_list
(= same as original list_aux), and almost pointless "auxiliary" flags.

Let's remove pointless "auxiliary" flags by this patch
This means, it is same as revert both
commit 1a653aa44725 ("ASoC: core: replace aux_comp_list to ...") and
commit d2e3a1358c37 ("ASoC: Fix binding and probing of auxiliary...").

Signed-off-by: Kuninori Morimoto 
Tested-by: Sylwester Nawrocki 
Signed-off-by: Mark Brown 
---
 include/sound/soc.h  |  1 -
 sound/soc/soc-core.c | 15 +--
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index cdfb55f7aede..ee838b0d5db8 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -812,7 +812,6 @@ struct snd_soc_component {
 
unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */
unsigned int registered_as_component:1;
-   unsigned int auxiliary:1; /* for auxiliary component of the card */
unsigned int suspended:1; /* is in suspend PM state */
 
struct list_head list;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index d29fbc7195a0..a6f840beacb0 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1776,7 +1776,6 @@ static int soc_bind_aux_dev(struct snd_soc_card *card, 
int num)
}
 
component->init = aux_dev->init;
-   component->auxiliary = 1;
list_add(&component->card_aux_list, &card->aux_comp_list);
 
return 0;
@@ -1788,14 +1787,13 @@ static int soc_bind_aux_dev(struct snd_soc_card *card, 
int num)
 
 static int soc_probe_aux_devices(struct snd_soc_card *card)
 {
-   struct snd_soc_component *comp, *tmp;
+   struct snd_soc_component *comp;
int order;
int ret;
 
for (order = SND_SOC_COMP_ORDER_FIRST; order <= SND_SOC_COMP_ORDER_LAST;
order++) {
-   list_for_each_entry_safe(comp, tmp, &card->aux_comp_list,
-card_aux_list) {
+   list_for_each_entry(comp, &card->aux_comp_list, card_aux_list) {
if (comp->driver->probe_order == order) {
ret = soc_probe_component(card, comp);
if (ret < 0) {
@@ -1804,7 +1802,6 @@ static int soc_probe_aux_devices(struct snd_soc_card 
*card)
comp->name, ret);
return ret;
}
-   list_del(&comp->card_aux_list);
}
}
}
@@ -1820,14 +1817,12 @@ static void soc_remove_aux_devices(struct snd_soc_card 
*card)
for (order = SND_SOC_COMP_ORDER_FIRST; order <= SND_SOC_COMP_ORDER_LAST;
order++) {
list_for_each_entry_safe(comp, _comp,
-   &card->component_dev_list, card_list) {
-
-   if (!comp->auxiliary)
-   continue;
+   &card->aux_comp_list, card_aux_list) {
 
if (comp->driver->remove_order == order) {
  

Applied "ASoC: rcar: remove rsnd_kctrl_remove()" to the asoc tree

2017-03-29 Thread Mark Brown
The patch

   ASoC: rcar: remove rsnd_kctrl_remove()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From e0c4211854bfebd5507761a2bfddaa9e37074230 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Tue, 28 Mar 2017 02:31:23 +
Subject: [PATCH] ASoC: rcar: remove rsnd_kctrl_remove()

Current rcar driver is trying to remove kctrl when remove time.
But, 1) rcar driver can't/shouldn't remove before removing sound
card driver, 2) sound card driver will call snd_ctl_dev_free()
and removes all kctrls by snd_ctl_remove().
Thus, rsnd_kctrl_remove() is not necessary. Current implementation
will get Oops when removing rcar driver after sound card.
This patch fix this issue.

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/sh/rcar/core.c |  9 -
 sound/soc/sh/rcar/dvc.c  | 16 
 sound/soc/sh/rcar/rsnd.h |  3 ---
 3 files changed, 28 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 3e852e00b277..134fe2ea4d9e 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -1039,15 +1039,6 @@ static int __rsnd_kctrl_new(struct rsnd_mod *mod,
return 0;
 }
 
-void _rsnd_kctrl_remove(struct rsnd_kctrl_cfg *cfg)
-{
-   if (cfg->card && cfg->kctrl)
-   snd_ctl_remove(cfg->card, cfg->kctrl);
-
-   cfg->card = NULL;
-   cfg->kctrl = NULL;
-}
-
 int rsnd_kctrl_new_m(struct rsnd_mod *mod,
 struct rsnd_dai_stream *io,
 struct snd_soc_pcm_runtime *rtd,
diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index cf8f59cdd8d7..994fdb7d0034 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -218,21 +218,6 @@ static int rsnd_dvc_probe_(struct rsnd_mod *mod,
return rsnd_cmd_attach(io, rsnd_mod_id(mod));
 }
 
-static int rsnd_dvc_remove_(struct rsnd_mod *mod,
-   struct rsnd_dai_stream *io,
-   struct rsnd_priv *priv)
-{
-   struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod);
-
-   rsnd_kctrl_remove(dvc->volume);
-   rsnd_kctrl_remove(dvc->mute);
-   rsnd_kctrl_remove(dvc->ren);
-   rsnd_kctrl_remove(dvc->rup);
-   rsnd_kctrl_remove(dvc->rdown);
-
-   return 0;
-}
-
 static int rsnd_dvc_init(struct rsnd_mod *mod,
 struct rsnd_dai_stream *io,
 struct rsnd_priv *priv)
@@ -332,7 +317,6 @@ static struct rsnd_mod_ops rsnd_dvc_ops = {
.name   = DVC_NAME,
.dma_req= rsnd_dvc_dma_req,
.probe  = rsnd_dvc_probe_,
-   .remove = rsnd_dvc_remove_,
.init   = rsnd_dvc_init,
.quit   = rsnd_dvc_quit,
.pcm_new= rsnd_dvc_pcm_new,
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 7410ec0174db..81ef3f18834a 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -611,9 +611,6 @@ struct rsnd_kctrl_cfg_s {
u32 val;
 };
 
-void _rsnd_kctrl_remove(struct rsnd_kctrl_cfg *cfg);
-#define rsnd_kctrl_remove(_cfg)_rsnd_kctrl_remove(&((_cfg).cfg))
-
 int rsnd_kctrl_new_m(struct rsnd_mod *mod,
 struct rsnd_dai_stream *io,
 struct snd_soc_pcm_runtime *rtd,
-- 
2.11.0



Applied "ASoC: rcar: call missing of_clk_del_provider() when remove" to the asoc tree

2017-03-30 Thread Mark Brown
The patch

   ASoC: rcar: call missing of_clk_del_provider() when remove

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From b5aac5a9adf667f907c34c520e023bc19f8c226c Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Thu, 30 Mar 2017 01:49:27 +
Subject: [PATCH] ASoC: rcar: call missing of_clk_del_provider() when remove

adg is calling of_clk_add_provider() when probe time,
thus, remove should call of_clk_del_provider(), it doesn't now.
This patch fix this issue.

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/sh/rcar/adg.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c
index 56107454bdb3..9665c1fa7216 100644
--- a/sound/soc/sh/rcar/adg.c
+++ b/sound/soc/sh/rcar/adg.c
@@ -587,5 +587,10 @@ int rsnd_adg_probe(struct rsnd_priv *priv)
 
 void rsnd_adg_remove(struct rsnd_priv *priv)
 {
+   struct device *dev = rsnd_priv_to_dev(priv);
+   struct device_node *np = dev->of_node;
+
+   of_clk_del_provider(np);
+
rsnd_adg_clk_disable(priv);
 }
-- 
2.11.0



Applied "ASoC: rcar: fixup of_clk_add_provider() usage for multi clkout" to the asoc tree

2017-03-30 Thread Mark Brown
The patch

   ASoC: rcar: fixup of_clk_add_provider() usage for multi clkout

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From d7f298197a22f11b38059f257842dac7c30a564c Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Thu, 30 Mar 2017 01:49:06 +
Subject: [PATCH] ASoC: rcar: fixup of_clk_add_provider() usage for multi
 clkout

Current adg is calling of_clk_add_povider() multiple times,
but it is not correct usage. This patch fixup its parameter
and call it once.

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/sh/rcar/adg.c | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c
index 85a33ac0a5c4..56107454bdb3 100644
--- a/sound/soc/sh/rcar/adg.c
+++ b/sound/soc/sh/rcar/adg.c
@@ -537,16 +537,14 @@ static void rsnd_adg_get_clkout(struct rsnd_priv *priv,
clk = clk_register_fixed_rate(dev, clkout_name[i],
  parent_clk_name, 0,
  req_rate);
-   if (!IS_ERR(clk)) {
-   adg->onecell.clks   = adg->clkout;
-   adg->onecell.clk_num= CLKOUTMAX;
-
+   adg->clkout[i] = ERR_PTR(-ENOENT);
+   if (!IS_ERR(clk))
adg->clkout[i] = clk;
-
-   of_clk_add_provider(np, of_clk_src_onecell_get,
-   &adg->onecell);
-   }
}
+   adg->onecell.clks   = adg->clkout;
+   adg->onecell.clk_num= CLKOUTMAX;
+   of_clk_add_provider(np, of_clk_src_onecell_get,
+   &adg->onecell);
}
 
adg->ckr = ckr;
-- 
2.11.0



Re: [RFC][PATCH] ASoC: soc-core: verify Sound Card normality

2017-03-30 Thread Mark Brown
On Wed, Mar 29, 2017 at 02:45:37AM +, Kuninori Morimoto wrote:

> To avoid Sound Card crash in (2) case, what we can do now is, add dirty
> flag on Sound Card, and avoid to open Sound Card.
> This patch solved this issue.

I think this is a good direction to at least start to mitigate these
problems (which we really should be doing) and hopefully make it easier
to do further improvements in future.  There's obviously more places
where we should be checking the flag (controls for example) but they can
be added later.  One thing I would like to see is instead of setting the
flag directly when we see a problem call a function to do it.  That way
if we want to improve things in the future we can do that without having
to update the callers again.


signature.asc
Description: PGP signature


Re: [alsa-devel] [RFC][PATCH] ASoC: soc-core: verify Sound Card normality

2017-04-04 Thread Mark Brown
On Fri, Mar 31, 2017 at 09:48:02AM +0200, Takashi Iwai wrote:
> Mark Brown wrote:

> > flag directly when we see a problem call a function to do it.  That way
> > if we want to improve things in the future we can do that without having
> > to update the callers again.

> BTW, ALSA core has snd_card_disconnect() that does this kind of
> shut-up from user-space.  It was introduced for hot-unplug, but
> basically unbinding is the software hot-unplug.  So, if ASoC won't
> rebind a once-unbound component, you can simply call
> snd_card_disconnect() at the component unbinding time to assure that
> no further user actions can be done.

Ah, that's exactly the sort of improvement I was thinking of!


signature.asc
Description: PGP signature


Re: [alsa-devel] [RFC][PATCH] ASoC: soc-core: verify Sound Card normality

2017-04-04 Thread Mark Brown
On Mon, Apr 03, 2017 at 10:37:42AM +0200, Takashi Iwai wrote:

> Ah, I see that snd_soc_unregister_card() has the check of
> card->instantiated, so it should be fine to call multiple times.

Yeah, we'd run into that often enough that it's worth handling nicely.


signature.asc
Description: PGP signature


Applied "ASoC: soc-core: verify Sound Card normality" to the asoc tree

2017-04-05 Thread Mark Brown
The patch

   ASoC: soc-core: verify Sound Card normality

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From c12c1aad98bb75b435e79c6208b56d2018b42f8b Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Mon, 3 Apr 2017 06:31:22 +
Subject: [PATCH] ASoC: soc-core: verify Sound Card normality

Current ALSA SoC Sound Card basically consists of CPU/Codec/Platform
components. If system uses Kernel modules, we can disable these drivers
by using rmmod command. In such case, we can't disable
CPU/Codec/Platform driver without disabling Sound Card driver.

But on the other hand, we can disable these drivers by using unbind
command. In such case, we can disable these drivers randomly.
In this case, we can create dirty Sound Card which is missing necessary
components.

(1) If user disabled Sound Card first, but did nothing to other drivers,
user can't use Sound because Sound Card is no longer exists.
(2) If user disabled CPU/Codec/Platform driver randomly, but did nothing
to Sound Card, user still be able to use Sound Card, because dirty Sound
Card still exists. In this case, Sound system will be crashed if user
started sound playback/capture. But we can't block such random unbind
now.

To avoid Sound Card crash in (2) case, we need to unregister Sound Card
whenever CPU/Codec/Platform component were unregistered.
This patch solves this issue.

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/soc-core.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index f1901bb1466e..de6d5609c252 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3076,6 +3076,11 @@ static void snd_soc_component_cleanup(struct 
snd_soc_component *component)
 
 static void snd_soc_component_del_unlocked(struct snd_soc_component *component)
 {
+   struct snd_soc_card *card = component->card;
+
+   if (card)
+   snd_soc_unregister_card(card);
+
list_del(&component->list);
 }
 
-- 
2.11.0



Re: [PATCH 3/3] ASoC: rsnd: control kctrl items acceptance anytime/runtime

2017-04-06 Thread Mark Brown
On Thu, Apr 06, 2017 at 07:25:48AM +, Kuninori Morimoto wrote:
> From: Kuninori Morimoto 
> 
> Current SRC/DVC/CTU adds kctrl for each device, but
> some of them shouldn't set *before* playback/capture.
> This patch control it more clearly

Why is there this restriction for these controls - what are they doing?


signature.asc
Description: PGP signature


Applied "ASoC: rsnd: tidyup src->convert_rate reset timing" to the asoc tree

2017-04-06 Thread Mark Brown
The patch

   ASoC: rsnd: tidyup src->convert_rate reset timing

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From fc99d23f6d3ec6b17772915114018444393e0ad1 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Thu, 6 Apr 2017 07:24:36 +
Subject: [PATCH] ASoC: rsnd: tidyup src->convert_rate reset timing

Current src->convert_rate will be set on .hw_param, and
be reset on .quit timing.
But, .hw_param will not be called again if user did Ctrl-Z + fg.
It should be reset on initial of .hw_param to keep its value.
Here, ctu.c already do this.
This patch solves this issue, other wise, MIXed sound will be
strange if user did like below.

> aplay -D plughw:0,0 sound_44100.wav &
> aplay -D plughw:0,1 sound_96000.wav
> Ctrl-Z
> fg # 96kHz will be played as 44.1kHz

Reported-by: Hiroyuki Yokoyama 
Signed-off-by: Kuninori Morimoto 
Tested-by: Hiroyuki Yokoyama 
Signed-off-by: Mark Brown 
---
 sound/soc/sh/rcar/src.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 42db48db09ba..20b5b2ec625e 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -167,6 +167,7 @@ static int rsnd_src_hw_params(struct rsnd_mod *mod,
 *  dpcm_fe_dai_hw_params()
 *  dpcm_be_dai_hw_params()
 */
+   src->convert_rate = 0;
if (fe->dai_link->dynamic) {
int stream = substream->stream;
struct snd_soc_dpcm *dpcm;
@@ -414,8 +415,6 @@ static int rsnd_src_quit(struct rsnd_mod *mod,
 
rsnd_mod_power_off(mod);
 
-   src->convert_rate = 0;
-
/* reset sync convert_rate */
src->sync.val = 0;
 
-- 
2.11.0



Applied "ASoC: rsnd: merge rsnd_kctrl_new_m/s/e into rsnd_kctrl_new()" to the asoc tree

2017-04-06 Thread Mark Brown
The patch

   ASoC: rsnd: merge rsnd_kctrl_new_m/s/e into rsnd_kctrl_new()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 32973dcf71ebee8806a6ee552665c5fad6857e16 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Thu, 6 Apr 2017 07:25:13 +
Subject: [PATCH] ASoC: rsnd: merge rsnd_kctrl_new_m/s/e into rsnd_kctrl_new()

Current rsnd driver is using rsnd_kctrl_new_m/s/e function,
but the differences are very few.
This patch merge these rsnd_kctrl_new_m/s/e into rsnd_kctrl_new

Signed-off-by: Kuninori Morimoto 
Tested-by: Hiroyuki Yokoyama 
Signed-off-by: Mark Brown 
---
 sound/soc/sh/rcar/core.c | 96 +---
 sound/soc/sh/rcar/dvc.c  |  8 ++--
 sound/soc/sh/rcar/rsnd.h | 50 -
 3 files changed, 62 insertions(+), 92 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 35c96e4bbd64..f8eb9d3d1949 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -1000,13 +1000,30 @@ static int rsnd_kctrl_put(struct snd_kcontrol *kctrl,
return change;
 }
 
-static int __rsnd_kctrl_new(struct rsnd_mod *mod,
-   struct rsnd_dai_stream *io,
-   struct snd_soc_pcm_runtime *rtd,
-   const unsigned char *name,
-   struct rsnd_kctrl_cfg *cfg,
-   void (*update)(struct rsnd_dai_stream *io,
-  struct rsnd_mod *mod))
+struct rsnd_kctrl_cfg *rsnd_kctrl_init_m(struct rsnd_kctrl_cfg_m *cfg)
+{
+   cfg->cfg.val = cfg->val;
+
+   return &cfg->cfg;
+}
+
+struct rsnd_kctrl_cfg *rsnd_kctrl_init_s(struct rsnd_kctrl_cfg_s *cfg)
+{
+   cfg->cfg.val = &cfg->val;
+
+   return &cfg->cfg;
+}
+
+int rsnd_kctrl_new(struct rsnd_mod *mod,
+  struct rsnd_dai_stream *io,
+  struct snd_soc_pcm_runtime *rtd,
+  const unsigned char *name,
+  void (*update)(struct rsnd_dai_stream *io,
+ struct rsnd_mod *mod),
+  struct rsnd_kctrl_cfg *cfg,
+  const char * const *texts,
+  int size,
+  u32 max)
 {
struct snd_card *card = rtd->card->snd_card;
struct snd_kcontrol *kctrl;
@@ -1021,6 +1038,9 @@ static int __rsnd_kctrl_new(struct rsnd_mod *mod,
};
int ret;
 
+   if (size > RSND_MAX_CHANNELS)
+   return -EINVAL;
+
kctrl = snd_ctl_new1(&knew, mod);
if (!kctrl)
return -ENOMEM;
@@ -1029,65 +1049,17 @@ static int __rsnd_kctrl_new(struct rsnd_mod *mod,
if (ret < 0)
return ret;
 
-   cfg->update = update;
-   cfg->card = card;
-   cfg->kctrl = kctrl;
-   cfg->io = io;
+   cfg->texts  = texts;
+   cfg->max= max;
+   cfg->size   = size;
+   cfg->update = update;
+   cfg->card   = card;
+   cfg->kctrl  = kctrl;
+   cfg->io = io;
 
return 0;
 }
 
-int rsnd_kctrl_new_m(struct rsnd_mod *mod,
-struct rsnd_dai_stream *io,
-struct snd_soc_pcm_runtime *rtd,
-const unsigned char *name,
-void (*update)(struct rsnd_dai_stream *io,
-   struct rsnd_mod *mod),
-struct rsnd_kctrl_cfg_m *_cfg,
-int ch_size,
-u32 max)
-{
-   if (ch_size > RSND_MAX_CHANNELS)
-   return -EINVAL;
-
-   _cfg->cfg.max   = max;
-   _cfg->cfg.size  = ch_size;
-   _cfg->cfg.val   = _cfg->val;
-   return __rsnd_kctrl_new(mod, io, rtd, name, &_cfg->cfg, update);
-}
-
-int rsnd_kctrl_new_s(struct rsnd_mod *mod,
-struct rsnd_dai_stream *io,
-struct snd_soc_pcm_runtime *rtd,
-const unsigned char *name,
-void (*update)(struct rsnd_dai_stream *io,
-  

Re: [PATCH 4/4] regulator: Add ROHM BD9571MWV-M PMIC regulator driver

2017-04-18 Thread Mark Brown
On Sun, Apr 16, 2017 at 08:08:01PM +0200, Marek Vasut wrote:

This looks good, a couple of minor things though:

> +static int bd9571mwv_regulator_is_enabled(struct regulator_dev *reg)
> +{
> + /* Always enabled. */
> + return 1;
> +}

This should be the default implementation, no need to open code it.

> +int bd9571mwv_set_voltage_sel_regmap(struct regulator_dev *rdev,
> +  unsigned int sel)
> +{
> + return regmap_write_bits(rdev->regmap, BD9571MWV_DVFS_SETVID,
> +  rdev->desc->vsel_mask, sel);
> +}

regulator_set_voltage_sel_regmap().


signature.asc
Description: PGP signature


Applied "ASoC: rsnd: enable clock-frequency for both 44.1kHz/48kHz" to the asoc tree

2017-04-19 Thread Mark Brown
The patch

   ASoC: rsnd: enable clock-frequency for both 44.1kHz/48kHz

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 25165f79adc76b812bfb4d8f2ab120aafb28d0e6 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Wed, 19 Apr 2017 00:45:52 +
Subject: [PATCH] ASoC: rsnd: enable clock-frequency for both 44.1kHz/48kHz

Current clock-frequency allows only 1 clock, but ADG can
handle both 44.1kHz/48kHz base clocks. This patch enables these.

On Salvator-X board, AUDIO_CLKOUT which is generated by ADG
is connected to ak4613 MCKI, and it should be synchronized with
LRCK. Thus, we need both 44.1kHz/48kHz base clock-frequency.
Otherwise, either one sounds strange in high frequency sound.

Signed-off-by: Kuninori Morimoto 
Tested-by: Hiroyuki Yokoyama 
Signed-off-by: Mark Brown 
---
 sound/soc/sh/rcar/adg.c | 39 ++-
 1 file changed, 26 insertions(+), 13 deletions(-)

diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c
index 214a9ce90bb4..96fef91b480c 100644
--- a/sound/soc/sh/rcar/adg.c
+++ b/sound/soc/sh/rcar/adg.c
@@ -43,6 +43,7 @@ struct rsnd_adg {
 };
 
 #define LRCLK_ASYNC(1 << 0)
+#define AUDIO_OUT_48   (1 << 1)
 #define adg_mode_flags(adg)(adg->flags)
 
 #define for_each_rsnd_clk(pos, adg, i) \
@@ -364,7 +365,10 @@ int rsnd_adg_ssi_clk_try_start(struct rsnd_mod *ssi_mod, 
unsigned int rate)
 
rsnd_adg_set_ssi_clk(ssi_mod, data);
 
-   if (!(adg_mode_flags(adg) & LRCLK_ASYNC)) {
+   if (adg_mode_flags(adg) & LRCLK_ASYNC) {
+   if (adg_mode_flags(adg) & AUDIO_OUT_48)
+   ckr = 0x8000;
+   } else {
if (0 == (rate % 8000))
ckr = 0x8000;
}
@@ -427,11 +431,14 @@ static void rsnd_adg_get_clkout(struct rsnd_priv *priv,
struct clk *clk;
struct device *dev = rsnd_priv_to_dev(priv);
struct device_node *np = dev->of_node;
+   struct property *prop;
u32 ckr, rbgx, rbga, rbgb;
-   u32 rate, req_rate = 0, div;
+   u32 rate, div;
+#define REQ_SIZE 2
+   u32 req_rate[REQ_SIZE] = {};
uint32_t count = 0;
unsigned long req_48kHz_rate, req_441kHz_rate;
-   int i;
+   int i, req_size;
const char *parent_clk_name = NULL;
static const char * const clkout_name[] = {
[CLKOUT]  = "audio_clkout",
@@ -452,13 +459,18 @@ static void rsnd_adg_get_clkout(struct rsnd_priv *priv,
 * ADG supports BRRA/BRRB output only
 * this means all clkout0/1/2/3 will be same rate
 */
-   of_property_read_u32(np, "clock-frequency", &req_rate);
+   prop = of_find_property(np, "clock-frequency", NULL);;
+   req_size = prop->length / sizeof(u32);
+
+   of_property_read_u32_array(np, "clock-frequency", req_rate, req_size);
req_48kHz_rate = 0;
req_441kHz_rate = 0;
-   if (0 == (req_rate % 44100))
-   req_441kHz_rate = req_rate;
-   if (0 == (req_rate % 48000))
-   req_48kHz_rate = req_rate;
+   for (i = 0; i < req_size; i++) {
+   if (0 == (req_rate[i] % 44100))
+   req_441kHz_rate = req_rate[i];
+   if (0 == (req_rate[i] % 48000))
+   req_48kHz_rate = req_rate[i];
+   }
 
/*
 * This driver is assuming that AUDIO_CLKA/AUDIO_CLKB/AUDIO_CLKC
@@ -505,10 +517,8 @@ static void rsnd_adg_get_clkout(struct rsnd_priv *priv,
rbgb = rbgx;
adg->rbgb_rate_for_48khz = rate / div;
ckr |= brg_table[i] << 16;
-   if (req_48kHz_rate) {
+   if (req_48kHz_rate)
parent_clk_name = __clk_get_name(clk);
-   ckr |= 0x8000;
-   }
}
}
}
@@ -523,7 +533,7 @@ static void rsnd_adg_get_clkout(struct rsnd_priv *priv,
 */

Applied "ASoC: rsnd: rsnd_mod_make_sure() is not under DEBUG" to the asoc tree

2017-04-19 Thread Mark Brown
The patch

   ASoC: rsnd: rsnd_mod_make_sure() is not under DEBUG

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 9ca5e57d78446c8bd42adff3dcae693703f91d9c Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Wed, 19 Apr 2017 00:41:24 +
Subject: [PATCH] ASoC: rsnd: rsnd_mod_make_sure() is not under DEBUG

rsnd_mod_make_sure() will be used any situation,
thus, under DEBUG is not realistic.
This patch move it to non DEBUG area

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/sh/rcar/core.c | 2 --
 sound/soc/sh/rcar/rsnd.h | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index f8eb9d3d1949..1744015408c3 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -110,7 +110,6 @@ MODULE_DEVICE_TABLE(of, rsnd_of_match);
 /*
  * rsnd_mod functions
  */
-#ifdef DEBUG
 void rsnd_mod_make_sure(struct rsnd_mod *mod, enum rsnd_mod_type type)
 {
if (mod->type != type) {
@@ -121,7 +120,6 @@ void rsnd_mod_make_sure(struct rsnd_mod *mod, enum 
rsnd_mod_type type)
 rsnd_mod_name(mod), rsnd_mod_id(mod));
}
 }
-#endif
 
 char *rsnd_mod_name(struct rsnd_mod *mod)
 {
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 3dc9e06f5943..dbf4163427e8 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -727,8 +727,8 @@ void rsnd_cmd_remove(struct rsnd_priv *priv);
 int rsnd_cmd_attach(struct rsnd_dai_stream *io, int id);
 struct rsnd_mod *rsnd_cmd_mod_get(struct rsnd_priv *priv, int id);
 
-#ifdef DEBUG
 void rsnd_mod_make_sure(struct rsnd_mod *mod, enum rsnd_mod_type type);
+#ifdef DEBUG
 #define rsnd_mod_confirm_ssi(mssi) rsnd_mod_make_sure(mssi, RSND_MOD_SSI)
 #define rsnd_mod_confirm_src(msrc) rsnd_mod_make_sure(msrc, RSND_MOD_SRC)
 #define rsnd_mod_confirm_dvc(mdvc) rsnd_mod_make_sure(mdvc, RSND_MOD_DVC)
-- 
2.11.0



Applied "ASoC: ak4613: use snd_soc_update_bits() to avoid Reserve bit on I/O CTRL" to the asoc tree

2017-04-19 Thread Mark Brown
The patch

   ASoC: ak4613: use snd_soc_update_bits() to avoid Reserve bit on I/O CTRL

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 4898b61e40d62ca1652af40935dbbb5d2e5fd93d Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Wed, 19 Apr 2017 00:40:38 +
Subject: [PATCH] ASoC: ak4613: use snd_soc_update_bits() to avoid Reserve bit
 on I/O CTRL

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/codecs/ak4613.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/ak4613.c b/sound/soc/codecs/ak4613.c
index e819dd8c82fd..b2dfddead227 100644
--- a/sound/soc/codecs/ak4613.c
+++ b/sound/soc/codecs/ak4613.c
@@ -75,6 +75,12 @@
 #define DFS_DOUBLE_SPEED   (1 << 2)
 #define DFS_QUAD_SPEED (2 << 2)
 
+/* ICTRL */
+#define ICTRL_MASK (0x3)
+
+/* OCTRL */
+#define OCTRL_MASK (0x3F)
+
 struct ak4613_formats {
unsigned int width;
unsigned int fmt;
@@ -365,8 +371,8 @@ static int ak4613_dai_hw_params(struct snd_pcm_substream 
*substream,
snd_soc_update_bits(codec, CTRL1, FMT_MASK, fmt_ctrl);
snd_soc_update_bits(codec, CTRL2, DFS_MASK, ctrl2);
 
-   snd_soc_write(codec, ICTRL, priv->ic);
-   snd_soc_write(codec, OCTRL, priv->oc);
+   snd_soc_update_bits(codec, ICTRL, ICTRL_MASK, priv->ic);
+   snd_soc_update_bits(codec, OCTRL, OCTRL_MASK, priv->oc);
 
 hw_params_end:
if (ret < 0)
-- 
2.11.0



Applied "regulator: Add ROHM BD9571MWV-M PMIC regulator driver" to the regulator tree

2017-04-25 Thread Mark Brown
The patch

   regulator: Add ROHM BD9571MWV-M PMIC regulator driver

has been applied to the regulator tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From e85c5a153fe237f261838fc9638c28f19e0f27c1 Mon Sep 17 00:00:00 2001
From: Marek Vasut 
Date: Mon, 24 Apr 2017 17:21:30 +0200
Subject: [PATCH] regulator: Add ROHM BD9571MWV-M PMIC regulator driver

Add driver for the regulator block in the ROHM BD9571MWV-W MFD PMIC.
This block supports three voltage monitors, VD18, VD25, VD33 for the
1V8, 2V5, 3V3 voltage rails and a single voltage regulator for the
DVFS rail.

Signed-off-by: Marek Vasut 
Signed-off-by: Mark Brown 
---
 drivers/regulator/Kconfig   |  11 ++
 drivers/regulator/Makefile  |   1 +
 drivers/regulator/bd9571mwv-regulator.c | 178 
 3 files changed, 190 insertions(+)
 create mode 100644 drivers/regulator/bd9571mwv-regulator.c

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index be06eb29c681..a27b97c5695b 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -163,6 +163,17 @@ config REGULATOR_BCM590XX
  BCM590xx PMUs. This will enable support for the software
  controllable LDO/Switching regulators.
 
+config REGULATOR_BD9571MWV
+   tristate "ROHM BD9571MWV Regulators"
+   depends on MFD_BD9571MWV
+   help
+ This driver provides support for the voltage regulators on the
+ ROHM BD9571MWV PMIC. This will enable support for the software
+ controllable regulator and voltage sampling units.
+
+ This driver can also be built as a module. If so, the module
+ will be called bd9571mwv-regulator.
+
 config REGULATOR_CPCAP
tristate "Motorola CPCAP regulator"
depends on MFD_CPCAP
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index ef7725e2592a..439b9b21f2fe 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -24,6 +24,7 @@ obj-$(CONFIG_REGULATOR_AS3711) += as3711-regulator.o
 obj-$(CONFIG_REGULATOR_AS3722) += as3722-regulator.o
 obj-$(CONFIG_REGULATOR_AXP20X) += axp20x-regulator.o
 obj-$(CONFIG_REGULATOR_BCM590XX) += bcm590xx-regulator.o
+obj-$(CONFIG_REGULATOR_BD9571MWV) += bd9571mwv-regulator.o
 obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
 obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o
 obj-$(CONFIG_REGULATOR_DA9055) += da9055-regulator.o
diff --git a/drivers/regulator/bd9571mwv-regulator.c 
b/drivers/regulator/bd9571mwv-regulator.c
new file mode 100644
index ..8ba206fec31e
--- /dev/null
+++ b/drivers/regulator/bd9571mwv-regulator.c
@@ -0,0 +1,178 @@
+/*
+ * ROHM BD9571MWV-M regulator driver
+ *
+ * Copyright (C) 2017 Marek Vasut 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether expressed or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License version 2 for more details.
+ *
+ * Based on the TPS65086 driver
+ *
+ * NOTE: VD09 is missing
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+enum bd9571mwv_regulators { VD09, VD18, VD25, VD33, DVFS };
+
+#define BD9571MWV_REG(_name, _of, _id, _ops, _vr, _vm, _nv, _min, _step, 
_lmin)\
+   {   \
+   .name   = _name,\
+   .of_match   = of_match_ptr(_of),\
+   .regulators_node= "regulators", \
+   .id = _id,  \
+   .ops= &_ops,\
+   .n_voltages = _nv,  \
+   .type   = REGULATOR_VOLTAGE,\
+   .owner  = THIS_MODULE,  \
+   .vsel_reg   = _vr,  

Re: [RESEND][PATCH V2 4/4] regulator: Add ROHM BD9571MWV-M PMIC regulator driver

2017-04-25 Thread Mark Brown
On Tue, Apr 25, 2017 at 08:32:10PM +0200, Marek Vasut wrote:
> Add driver for the regulator block in the ROHM BD9571MWV-W MFD PMIC.
> This block supports three voltage monitors, VD18, VD25, VD33 for the
> 1V8, 2V5, 3V3 voltage rails and a single voltage regulator for the
> DVFS rail.

Please do not submit new versions of already applied patches, please
submit incremental updates to the existing code.  Modifying existing
commits creates problems for other users building on top of those
commits so it's best practice to only change pubished git commits if
absolutely essential.


signature.asc
Description: PGP signature


Re: [PATCH] ASoC: ak4613: disable asymmetric audio interface format

2017-04-30 Thread Mark Brown
On Thu, Apr 27, 2017 at 05:22:51AM +, Kuninori Morimoto wrote:
> 
> From: Kuninori Morimoto 
> 
> Asymmetric audio interface formats exist in ak4613 by same
> register settings.

So long as nobody is actively using this disabling things is fine but
it's better to just remove the code rather than commenting it out,
people can always get the old code in git if they want.  Adding a
comment explaining why asymmetric modes aren't supported would eb good
though.


signature.asc
Description: PGP signature


Re: [PATCH 2/2] ASoC: sh: rcar: rsrc-card: don't open code of_device_get_match_data()

2016-03-02 Thread Mark Brown
On Tue, Mar 01, 2016 at 05:39:20PM +0100, Wolfram Sang wrote:

> Signed-off-by: Wolfram Sang 

Please ensure that your signoffs match the domain you're sending from,
at least the domain part - I'm fairly sure you're the same person but
it's not something I should need to think about.


signature.asc
Description: PGP signature


Re: [PATCH 2/6] ASoC: rsrc-card: add convert channels support

2016-03-05 Thread Mark Brown
On Thu, Mar 03, 2016 at 08:15:19AM +, Kuninori Morimoto wrote:

> Mark, can I send additional patch ?
> or is v2 patch better ?

An incremental patch is fine.


signature.asc
Description: PGP signature


Re: [PATCH 2/2] regulator: core: Ensure we are at least in bounds for our constraints

2016-03-29 Thread Mark Brown
On Tue, Mar 29, 2016 at 02:00:52PM +0200, Geert Uytterhoeven wrote:
> On Sun, Mar 27, 2016 at 11:08 AM, Mark Brown  wrote:

> > The existing check in the patch should be an || not an ==, or possibly
> > we should just not bother looking for min_uV at all.  I just pushed out
> > a version of that, let's see how that goes.

> Has the fix really been pushed out?

Yes.

> WARNING: CPU: 1 PID: 31 at drivers/regulator/core.c:2223
> _regulator_disable+0x2c/0x128
> unbalanced disables for SDHI0 VccQ

> when booting on r8a7791/koelsch.

This seems like a bug somewhere else in your code, we're looking at
changes in the voltage setting code but this is an unbalanced disable.

> I'm a bit confused by the discussion of "&&" vs. "||" vs. "==", but the
> warnings do go away when using "!=", cfr. the whitespace-damaged patch below.

> /* Voltage change possible? */
> -   if (constraints->min_uV && constraints->max_uV) {
> +   if (constraints->min_uV != constraints->max_uV) {

Do you have constraints that specify a maximum voltage but no minimum
(which I'd say are broken), or constraints that are just plain wrong but
are now being applied like specifying the entire range of the regulator?
The above might be some follow on error handling from something that
happened the change in handling of the constraints.  You need to look at
what the relevant regulator constraints are...

Previously both voltages needed to be non-zero and equal for anything to
happen, now they only need to both be non-zero.


signature.asc
Description: PGP signature


Re: [PATCH 2/2] regulator: core: Ensure we are at least in bounds for our constraints

2016-03-29 Thread Mark Brown
On Tue, Mar 29, 2016 at 08:05:34PM +0200, Geert Uytterhoeven wrote:

> sh_mobile_sdhi ee10.sd: Got WP GPIO
> ==> sh_mobile_sdhi ee10.sd: could not set regulator OCR (-22)
> gpio_rcar e6055400.gpio: sense irq = 6, type = 3
> sh_mobile_sdhi ee10.sd: mmc0 base at 0xee10 clock rate 97 MHz

> The line marked with the arrow is introduced by the changed check, and looks
> to be the origin of the failure.

This isn't making any sense.  Why would a change in how we apply voltage
constraints on initial probe of the regulator have an impact here?  The
changed code shouldn't even be executing at the point where the SDHCI
driver is trying to use the regulator.  There's something else going on
here.


signature.asc
Description: PGP signature


Re: [PATCH 2/2] regulator: core: Ensure we are at least in bounds for our constraints

2016-03-30 Thread Mark Brown
On Wed, Mar 30, 2016 at 09:07:21AM +, Haibo Chen wrote:

Please fix your mail client to word wrap within paragraphs at something
substantially less than 80 columns.  Doing this makes your messages much
easier to read and reply to.

> In our sdhci.c, we call the function 
> regulator_set_voltage ---> regulator_set_voltage_unlocked(struct regulator 
> *regulator, int min_uV, int max_uV)
> here, the parameter min_uV is 330, and the max_uV is 340
> 
> currently with your patch (the upper operator is &&), when insert a SD3.0 
> card, 
> it will do the sanity check, and return -EINVAL

> but when I change the upper operator from && to !=, 
> before the sanity check, it will first get the current_uV, and then go to out.
> 
> I'm not familiar with regulator common code. Hope the upper describe can help 
> you debug this issue.

No, that's not helping clarify anything.  To repeat what I said to Geert 
this patch changes code that is only called when the regulator is
probed.  This means that the changed code is not running when the SDHCI
code is running.  You need to investigate what exactly is causing the
error.

Just randomly thrashing around with a separate bit of code with no
coharent explanation for what you think is happening is not helping
here, we need some analysis of what is going on.  The change you are
both proposing is guaranteed to break other boards since it means that
the case we supported originally where we set a specific voltage that is
specified by setting equal minimum and maximum constraints is no longer
going have the voltage applied.

Having taken another look I *suspect* that the SDHCI code is broken in
the way it enumerates the set of voltages that can be set and that this
will probably trigger in other situations where the set of voltages that
can be set is limited but I can't put my finger on it, someone with the
ability to run the code will need to investigate.

The following patch *might* help the SDHCI but I'm just guessing and
like I say it looks like this is flagging up a problem in the SDHCI
code.

diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index f45106a44635..cd828dbf9d52 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -43,10 +43,12 @@ static void of_get_regulation_constraints(struct 
device_node *np,
constraints->max_uV = pval;
 
/* Voltage change possible? */
-   if (constraints->min_uV && constraints->max_uV) {
+   if (constraints->min_uV != constraints->max_uV)
constraints->valid_ops_mask |= REGULATOR_CHANGE_VOLTAGE;
+
+   /* Do we have a voltage range, if so try to apply it? */
+   if (constraints->min_uV && constraints->max_uV)
constraints->apply_uV = true;
-   }
 
if (!of_property_read_u32(np, "regulator-microvolt-offset", &pval))
constraints->uV_offset = pval;

> > -Original Message-
> > From: linux-mmc-ow...@vger.kernel.org [mailto:linux-mmc-
> > ow...@vger.kernel.org] On Behalf Of Mark Brown

Please don't top post, reply in line with needed context.  This allows
readers to readily follow the flow of conversation and understand what
you are talking about and also helps ensure that everything in the
discussion is being addressed.


signature.asc
Description: PGP signature


Re: Can we re-use dw-hdmi-ahb-audio ?

2016-04-18 Thread Mark Brown
On Thu, Apr 14, 2016 at 09:08:24AM +, Kuninori Morimoto wrote:

> I know we already have dw-hdmi-ahb-audio.c which is based on
> normal ALSA style, but I would like to use it as ASoC.
> I'm thinking that we can separate this existing dw-hdmi-ahb-audio driver
> into "common parts" and ahb "specific parts", and share common parts with 
> ASoC,
> like below, but what do you think ?

> dw-hdmi-audio.c   : dw-hdmi audio common function set
> dw-hdmi-ahb-audio.c   : dw-hdmi audio for ahb,  using dw-hdmi-audio.c
> dw-hdmi-soc-audio.c   : dw-hdmi audio for ASoC, using dw-hdmi-audio.c

Something similar has been done for other things like the PXA drivers in
the past.  It might get tricky to work out how to instantiate things
though.


signature.asc
Description: PGP signature


Applied "ASoC: rsnd: count .probe/.remove for rsnd_mod_call()" to the asoc tree

2016-04-28 Thread Mark Brown
The patch

   ASoC: rsnd: count .probe/.remove for rsnd_mod_call()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 1a5658c213116d56a1a38e83588f6636a57d6374 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Thu, 28 Apr 2016 01:49:48 +
Subject: [PATCH] ASoC: rsnd: count .probe/.remove for rsnd_mod_call()

Current rsnd_mod_call is counting its calling count to avoid unbalanced
function pair calling for error cases (ex init <-> quit).
SSI parent is now controlled as "mod" on current rsnd driver. Because of
this reason, SSI .remove function will be called twice if it was used as
SSI parent when user tried unbind. But probe/remove pair were not
counted. This patch counts probe/remove functions to avoid it.
Special thans Hiep

Reported-by: Hiep Cao Minh 
Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/sh/rcar/rsnd.h | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index fc89a67258ca..a8f61d79333b 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -276,8 +276,9 @@ struct rsnd_mod {
 /*
  * status
  *
- * 0xHCB0
+ * 0xHCBA
  *
+ * A   0: probe1: remove
  * B   0: init 1: quit
  * C   0: start1: stop
  *
@@ -287,19 +288,19 @@ struct rsnd_mod {
  * H   0: fallback
  * H   0: hw_params
  */
+#define __rsnd_mod_shift_probe 0
+#define __rsnd_mod_shift_remove0
 #define __rsnd_mod_shift_init  4
 #define __rsnd_mod_shift_quit  4
 #define __rsnd_mod_shift_start 8
 #define __rsnd_mod_shift_stop  8
-#define __rsnd_mod_shift_probe 28 /* always called */
-#define __rsnd_mod_shift_remove28 /* always called */
 #define __rsnd_mod_shift_irq   28 /* always called */
 #define __rsnd_mod_shift_pcm_new   28 /* always called */
 #define __rsnd_mod_shift_fallback  28 /* always called */
 #define __rsnd_mod_shift_hw_params 28 /* always called */
 
-#define __rsnd_mod_add_probe   0
-#define __rsnd_mod_add_remove  0
+#define __rsnd_mod_add_probe1
+#define __rsnd_mod_add_remove  -1
 #define __rsnd_mod_add_init 1
 #define __rsnd_mod_add_quit-1
 #define __rsnd_mod_add_start1
@@ -310,7 +311,7 @@ struct rsnd_mod {
 #define __rsnd_mod_add_hw_params   0
 
 #define __rsnd_mod_call_probe  0
-#define __rsnd_mod_call_remove 0
+#define __rsnd_mod_call_remove 1
 #define __rsnd_mod_call_init   0
 #define __rsnd_mod_call_quit   1
 #define __rsnd_mod_call_start  0
-- 
2.8.0.rc3



Applied "ASoC: rsnd: don't use prohibited number to PDMACHCRn.SRS" to the asoc tree

2016-05-10 Thread Mark Brown
The patch

   ASoC: rsnd: don't use prohibited number to PDMACHCRn.SRS

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From ee057d2ee73259f455cfbb7a4db808fc6b6405dd Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Tue, 10 May 2016 02:22:37 +
Subject: [PATCH] ASoC: rsnd: don't use prohibited number to PDMACHCRn.SRS

Current rsnd_dmapp_get_id() returns 0xFF as error code if system used
strange connection. It will be used as PDMACHCRn.SRS, but 0xFF is
prohibited number.
In order not to use prohibited number, this patch indicates error message
and returns 0x00 (same as SSI00) in error case.
Special thanks to Dung-san.

Reported-by: Nguyen Viet Dung 
Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/sh/rcar/dma.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
index 7658e8fd7bdc..6bc93cbb3049 100644
--- a/sound/soc/sh/rcar/dma.c
+++ b/sound/soc/sh/rcar/dma.c
@@ -316,11 +316,15 @@ static u32 rsnd_dmapp_get_id(struct rsnd_dai_stream *io,
size = ARRAY_SIZE(gen2_id_table_cmd);
}
 
-   if (!entry)
-   return 0xFF;
+   if ((!entry) || (size <= id)) {
+   struct device *dev = rsnd_priv_to_dev(rsnd_io_to_priv(io));
 
-   if (size <= id)
-   return 0xFF;
+   dev_err(dev, "unknown connection (%s[%d])\n",
+   rsnd_mod_name(mod), rsnd_mod_id(mod));
+
+   /* use non-prohibited SRS number as error */
+   return 0x00; /* SSI00 */
+   }
 
return entry[id];
 }
-- 
2.8.1



Applied "rcar: src: skip disabled-SRC nodes" to the asoc tree

2016-05-13 Thread Mark Brown
The patch

   rcar: src: skip disabled-SRC nodes

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From de1965159a34951a86267d13db4f2a67234139d3 Mon Sep 17 00:00:00 2001
From: Sergei Shtylyov 
Date: Thu, 12 May 2016 01:36:40 +0300
Subject: [PATCH] rcar: src: skip disabled-SRC nodes

The current device tree representation of the R-Car Sample Rate Converters
(SRC) assumes that they are numbered consecutively, starting from 0. Alas,
this  is not  the case with the R8A7794 SoC where SRC0 isn't present.  In
order to keep the existing  device trees working, I'm suggesting to use a
disabled node for SRC0.  Teach the SRC probe  to just skip disabled nodes.

Signed-off-by: Sergei Shtylyov 
Acked-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/sh/rcar/src.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 15d6ffe8be74..e39f916d0f2f 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -572,6 +572,9 @@ int rsnd_src_probe(struct rsnd_priv *priv)
 
i = 0;
for_each_child_of_node(node, np) {
+   if (!of_device_is_available(np))
+   goto skip;
+
src = rsnd_src_get(priv, i);
 
snprintf(name, RSND_SRC_NAME_SIZE, "%s.%d",
@@ -595,6 +598,7 @@ int rsnd_src_probe(struct rsnd_priv *priv)
if (ret)
goto rsnd_src_probe_done;
 
+skip:
i++;
}
 
-- 
2.8.1



Re: [PATCH 00/49] ASoC: add simple-card-core and standardize "simple" card

2016-05-23 Thread Mark Brown
On Fri, May 20, 2016 at 09:36:53AM +, Kuninori Morimoto wrote:

> These are very big patch-set, but basically just cleanup for
> simple-card driver.
> Now, we have simple-card driver, but it is not simple today.
> I would like to cleanup this.

This really is far too big.  Don't worry about it this time but in
future please try to keep patch serieses to a reasonable size, split
them up and send them separately (and not at the same time either).  A
huge stack of patches really does not look good as a reviewer.


signature.asc
Description: PGP signature


Re: [PATCH 01/49] ASoC: simple-card: remove duplicate header

2016-05-30 Thread Mark Brown
On Fri, May 20, 2016 at 09:38:39AM +, Kuninori Morimoto wrote:
> 
> From: Kuninori Morimoto 
> 
> simple-card.h includes soc.h, and soc.h includes soc-dai.h
> Let's remove these header.

It's not automatically good to remove headers, one common reason for
build breaks is that a file will rely on some header including another
header for an API it uses but then the header will change and the C file
will stop building.  It's better to directly include any headers that
are being used to avoid issues like this.


signature.asc
Description: PGP signature


Applied "ASoC: rsrc-card: remove unused dai_num" to the asoc tree

2016-05-30 Thread Mark Brown
The patch

   ASoC: rsrc-card: remove unused dai_num

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 52fd98bcaf22052fc8946d36b13d5e646b7b41b0 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Fri, 20 May 2016 09:39:55 +
Subject: [PATCH] ASoC: rsrc-card: remove unused dai_num

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/sh/rcar/rsrc-card.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 1bc7ecfc42a9..b85b5ee5fad4 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -64,7 +64,6 @@ struct rsrc_card_priv {
struct snd_soc_codec_conf codec_conf;
struct rsrc_card_dai *dai_props;
struct snd_soc_dai_link *dai_link;
-   int dai_num;
u32 convert_rate;
u32 convert_channels;
 };
@@ -418,7 +417,6 @@ static int rsrc_card_parse_of(struct device_node *node,
 
priv->dai_props = props;
priv->dai_link  = links;
-   priv->dai_num   = num;
 
/* Init snd_soc_card */
priv->snd_card.owner= THIS_MODULE;
-- 
2.8.1



Re: [PATCH 05/49] ASoC: add new simple-card-core.c

2016-05-30 Thread Mark Brown
On Fri, May 20, 2016 at 09:42:25AM +, Kuninori Morimoto wrote:

> future. Maybe it want to use simple-card like feature / function.
> Because of these background, this patch tries to create
> new simple-card-core, and provides common function to each drivers.
> 1st is asoc_simple_card_parse_daifmt()

This isn't really a core but more helper functions so should probably be
called -utils or something.  In the past we've added helpers to the
core, though this particular one is obviously a bit different as most
machine drivers should be expected to have the formats hard coded into
them - it's not something we'd normally have in the DT since it
shouldn't be varying except in the case of very generic drivers like
simple-card.


signature.asc
Description: PGP signature


Re: [PATCH 11/49] ASoC: simple-card-core: add asoc_simple_card_parse_card_widgets()

2016-05-30 Thread Mark Brown
On Fri, May 20, 2016 at 09:46:04AM +, Kuninori Morimoto wrote:

> +int asoc_simple_card_parse_card_widgets(struct snd_soc_card *card,
> + char *prefix)
> +{
> + struct device_node *np = card->dev->of_node;
> + char prop[128];
> + int ret = 0;
> +
> + snprintf(prop, sizeof(prop), "%swidgets", prefix);
> +
> + if (of_property_read_bool(np, prop))
> + ret = snd_soc_of_parse_audio_simple_widgets(card, prop);
> +
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_widgets);

This seems like an extremely thin wrapper around existing core
functionality, shouldn't we just be adding the property check into the
core?


signature.asc
Description: PGP signature


Re: [PATCH 14/49] ASoC: simple-card-core: add asoc_simple_card_parse_dpcm()

2016-05-30 Thread Mark Brown
On Fri, May 20, 2016 at 09:48:07AM +, Kuninori Morimoto wrote:
> From: Kuninori Morimoto 
> 
> simple-card like driver is supporting DPCM FE/BE.
> This patch makes this method simple style standard.

DPCM is very much an implementation detail of the current stack,
providing helpers that promote its use doesn't seem like the best idea -
we want to change it for in kernel use going forwards and that's going
to be harder with DPCM.  We should be encouraging bindings that make
DSPs look more like CODECs.


signature.asc
Description: PGP signature


Re: [PATCH 15/49] ASoC: simple-card-core: add asoc_simple_card_init_jack()

2016-05-30 Thread Mark Brown
On Fri, May 20, 2016 at 09:48:38AM +, Kuninori Morimoto wrote:
> From: Kuninori Morimoto 
> 
> simple-card is supporting jack/gpio.
> This patch makes this method simple style standard.

There was some recent discussion about a more complete core binding
for this based on the work that Dylan Reid had been pushing a while ago
- it's not clear that the simple-card binding is great for
generalization here.


signature.asc
Description: PGP signature


Applied "ASoC: simple-card: platform also uses asoc_simple_card_sub_parse_of()" to the asoc tree

2016-05-30 Thread Mark Brown
The patch

   ASoC: simple-card: platform also uses asoc_simple_card_sub_parse_of()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 5fb9cb165130cdb67fb3ac42b4510ed7677a077d Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Fri, 20 May 2016 09:40:41 +
Subject: [PATCH] ASoC: simple-card: platform also uses
 asoc_simple_card_sub_parse_of()

In current simple-card, platform is handled as special case,
but, the code is not readable.
This patch makes platform to use asoc_simple_card_sub_parse_of()

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/generic/simple-card.c | 31 +++
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 466492b7d4f5..4e39c0fa78c9 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -223,6 +223,9 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
u32 val;
int ret;
 
+   if (!np)
+   return 0;
+
/*
 * Get node via "sound-dai = <&phandle port>"
 * it will be used as xxx_of_node on soc_bind_dai_link()
@@ -238,9 +241,14 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
*args_count = args.args_count;
 
/* Get dai->name */
-   ret = snd_soc_of_get_dai_name(np, name);
-   if (ret < 0)
-   return ret;
+   if (name) {
+   ret = snd_soc_of_get_dai_name(np, name);
+   if (ret < 0)
+   return ret;
+   }
+
+   if (!dai)
+   return 0;
 
/* Parse TDM slot */
ret = snd_soc_of_parse_tdm_slot(np, &dai->tx_slot_mask,
@@ -374,21 +382,20 @@ static int asoc_simple_card_dai_link_of(struct 
device_node *node,
if (ret < 0)
goto dai_link_of_err;
 
+   ret = asoc_simple_card_sub_parse_of(plat, NULL,
+   &dai_link->platform_of_node,
+   NULL, NULL);
+   if (ret < 0)
+   goto dai_link_of_err;
+
if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) {
ret = -EINVAL;
goto dai_link_of_err;
}
 
-   if (plat) {
-   struct of_phandle_args args;
-
-   ret = of_parse_phandle_with_args(plat, "sound-dai",
-"#sound-dai-cells", 0, &args);
-   dai_link->platform_of_node = args.np;
-   } else {
-   /* Assumes platform == cpu */
+   /* Assumes platform == cpu */
+   if (!dai_link->platform_of_node)
dai_link->platform_of_node = dai_link->cpu_of_node;
-   }
 
/* DAI link name is created from CPU/CODEC dai name */
name = devm_kzalloc(dev,
-- 
2.8.1



Re: [PATCH 15/49] ASoC: simple-card-core: add asoc_simple_card_init_jack()

2016-05-31 Thread Mark Brown
On Tue, May 31, 2016 at 02:08:31AM +, Kuninori Morimoto wrote:

> > There was some recent discussion about a more complete core binding
> > for this based on the work that Dylan Reid had been pushing a while ago
> > - it's not clear that the simple-card binding is great for
> > generalization here.

> Can you show me where can I see it ?
> Anyway, I will keep this related function as static in simple-card,
> not simple-card-utils in v2.

This is the proposal from Dylan I was thinking of:

   http://thread.gmane.org/gmane.linux.alsa.devel/138906


signature.asc
Description: PGP signature


Re: [PATCH] ASoC: rsnd: adg :: AUDIO-CLKOUTn can synchronizes with L/R clock.

2016-06-07 Thread Mark Brown
On Tue, Jun 07, 2016 at 06:21:33AM +, Kuninori Morimoto wrote:
> From: Kuninori Morimoto 
> 
> AUDIO-CLKOUTn can synchronizes with L/R clock, and Salvator board
> needs it. Otherwise, specific frequency sound will be noisy.

Why would a user not want these clocks to be synchronous?  A lot of
CODECs will at least have better performance if their master clock is
synchronous to the audio clocks so it'd be a better default, is there an
advantage to not doing it?


signature.asc
Description: PGP signature


Re: [PATCH] ASoC: rsnd: adg :: AUDIO-CLKOUTn can synchronizes with L/R clock.

2016-06-08 Thread Mark Brown
On Wed, Jun 08, 2016 at 12:27:48AM +, Kuninori Morimoto wrote:

> > Why would a user not want these clocks to be synchronous?  A lot of
> > CODECs will at least have better performance if their master clock is
> > synchronous to the audio clocks so it'd be a better default, is there an
> > advantage to not doing it?

> I'm now confusing. We can set system clock on audio card, for example
> simple-card case, it is called as "system-clock-frequency".
> In my understanding, this "system clock" and above "master clock" are same 
> clock.
> but "system clock" is fixed rate (= not related to audio clock in many cases).
> Because of this, some codec doesn't request synchronous between
> master clock <-> audio clock, but, some codec requests synchronous it.
> Am I wrong ??

A lot of CODECs can to varying degrees tolerate this but it will tend to
show up in performance numbers, it's often not immediately obvious just
from a listening test.  Usually those that don't mind have a FLL or PLL
they're using to generate the actual audio master clock at a useful rate
for dividing down, or sometimes fancy digital logic to match things
up.

It's not a problem to have this configurable, I'm just thinking it might
be better to have the default be the other way around so that we default
to synchronous but can turn that off if it's required.


signature.asc
Description: PGP signature


Applied "ASoC: rsnd: adg :: AUDIO-CLKOUTn asynchronizes support" to the asoc tree

2016-06-09 Thread Mark Brown
The patch

   ASoC: rsnd: adg :: AUDIO-CLKOUTn asynchronizes support

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 7dc20319660d12d2ef642e572e8802c228b6c1cd Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Thu, 9 Jun 2016 03:21:37 +
Subject: [PATCH] ASoC: rsnd: adg :: AUDIO-CLKOUTn asynchronizes support

AUDIO-CLKOUTn can asynchronizes with L/R clock.
AUDIO-CLKOUTn synchronizes with L/R clock is now default behavior.

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 .../devicetree/bindings/sound/renesas,rsnd.txt |  2 ++
 sound/soc/sh/rcar/adg.c| 18 ++
 2 files changed, 20 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt 
b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
index c7b29df4a963..15a7316e4c91 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
@@ -373,6 +373,8 @@ Optional properties:
 - #clock-cells : it must be 0 if your system has audio_clkout
  it must be 1 if your system has 
audio_clkout0/1/2/3
 - clock-frequency  : for all audio_clkout0/1/2/3
+- clkout-lr-asynchronous   : boolean property. it indicates that 
audio_clkoutn
+ is asynchronizes with lr-clock.
 
 SSI subnode properties:
 - interrupts   : Should contain SSI interrupt for PIO transfer
diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c
index 49354d17ea55..7d3e0e46d64a 100644
--- a/sound/soc/sh/rcar/adg.c
+++ b/sound/soc/sh/rcar/adg.c
@@ -33,11 +33,15 @@ struct rsnd_adg {
struct clk *clkout[CLKOUTMAX];
struct clk_onecell_data onecell;
struct rsnd_mod mod;
+   u32 flags;
 
int rbga_rate_for_441khz; /* RBGA */
int rbgb_rate_for_48khz;  /* RBGB */
 };
 
+#define LRCLK_ASYNC(1 << 0)
+#define adg_mode_flags(adg)(adg->flags)
+
 #define for_each_rsnd_clk(pos, adg, i) \
for (i = 0; \
 (i < CLKMAX) &&\
@@ -355,6 +359,16 @@ found_clock:
 
rsnd_adg_set_ssi_clk(ssi_mod, data);
 
+   if (!(adg_mode_flags(adg) & LRCLK_ASYNC)) {
+   struct rsnd_mod *adg_mod = rsnd_mod_get(adg);
+   u32 ckr = 0;
+
+   if (0 == (rate % 8000))
+   ckr = 0x8000;
+
+   rsnd_mod_bset(adg_mod, SSICKR, 0x8000, ckr);
+   }
+
dev_dbg(dev, "ADG: %s[%d] selects 0x%x for %d\n",
rsnd_mod_name(ssi_mod), rsnd_mod_id(ssi_mod),
data, rate);
@@ -532,6 +546,7 @@ int rsnd_adg_probe(struct rsnd_priv *priv)
 {
struct rsnd_adg *adg;
struct device *dev = rsnd_priv_to_dev(priv);
+   struct device_node *np = dev->of_node;
 
adg = devm_kzalloc(dev, sizeof(*adg), GFP_KERNEL);
if (!adg) {
@@ -545,6 +560,9 @@ int rsnd_adg_probe(struct rsnd_priv *priv)
rsnd_adg_get_clkin(priv, adg);
rsnd_adg_get_clkout(priv, adg);
 
+   if (of_get_property(np, "clkout-lr-asynchronous", NULL))
+   adg->flags = LRCLK_ASYNC;
+
priv->adg = adg;
 
return 0;
-- 
2.8.1



Applied "ASoC: simple-card: use common PREFIX for each DT property" to the asoc tree

2016-06-13 Thread Mark Brown
The patch

   ASoC: simple-card: use common PREFIX for each DT property

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 548563fa3e430ce61db79aa11331da6e5f535a3b Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Tue, 31 May 2016 08:59:01 +
Subject: [PATCH] ASoC: simple-card: use common PREFIX for each DT property

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/generic/simple-card.c | 24 +---
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 4e39c0fa78c9..b6e6d9a12ec2 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -40,6 +40,8 @@ struct simple_card_data {
 #define simple_priv_to_link(priv, i) ((priv)->snd_card.dai_link + i)
 #define simple_priv_to_props(priv, i) ((priv)->dai_props + i)
 
+#define PREFIX "simple-audio-card,"
+
 static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
 {
struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -344,7 +346,7 @@ static int asoc_simple_card_dai_link_of(struct device_node 
*node,
 
/* For single DAI link & old style of DT node */
if (is_top_level_node)
-   prefix = "simple-audio-card,";
+   prefix = PREFIX;
 
snprintf(prop, sizeof(prop), "%scpu", prefix);
cpu = of_get_child_by_name(node, prop);
@@ -453,26 +455,26 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
return -EINVAL;
 
/* Parse the card name from DT */
-   snd_soc_of_parse_card_name(&priv->snd_card, "simple-audio-card,name");
+   snd_soc_of_parse_card_name(&priv->snd_card, PREFIX "name");
 
/* The off-codec widgets */
-   if (of_property_read_bool(node, "simple-audio-card,widgets")) {
+   if (of_property_read_bool(node, PREFIX "widgets")) {
ret = snd_soc_of_parse_audio_simple_widgets(&priv->snd_card,
-   "simple-audio-card,widgets");
+   PREFIX "widgets");
if (ret)
return ret;
}
 
/* DAPM routes */
-   if (of_property_read_bool(node, "simple-audio-card,routing")) {
+   if (of_property_read_bool(node, PREFIX "routing")) {
ret = snd_soc_of_parse_audio_routing(&priv->snd_card,
-   "simple-audio-card,routing");
+   PREFIX "routing");
if (ret)
return ret;
}
 
/* Factor to mclk, used in hw_params() */
-   ret = of_property_read_u32(node, "simple-audio-card,mclk-fs", &val);
+   ret = of_property_read_u32(node, PREFIX "mclk-fs", &val);
if (ret == 0)
priv->mclk_fs = val;
 
@@ -480,7 +482,7 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
priv->snd_card.name : "");
 
/* Single/Muti DAI link(s) & New style of DT node */
-   if (of_get_child_by_name(node, "simple-audio-card,dai-link")) {
+   if (of_get_child_by_name(node, PREFIX "dai-link")) {
struct device_node *np = NULL;
int i = 0;
 
@@ -502,13 +504,13 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
}
 
priv->gpio_hp_det = of_get_named_gpio_flags(node,
-   "simple-audio-card,hp-det-gpio", 0, &flags);
+   PREFIX "hp-det-gpio", 0, &flags);
priv->gpio_hp_det_invert = !!(flags & OF_GPIO_ACTIVE_LOW);
if (priv->gpio_hp_det == -EPROBE_DEFER)
return -EPROBE_DEFER;
 
priv->gpio_mic_det = of_get_named_gpio_flags(node,
-   "simple-audio-card,mic-det-gpio", 0, &flags);
+

Applied "ASoC: ak4613: Implement suspend callback" to the asoc tree

2016-06-17 Thread Mark Brown
The patch

   ASoC: ak4613: Implement suspend callback

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From f9ae17ba97e0fd134f7c0108c70e708313a07063 Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven 
Date: Thu, 16 Jun 2016 14:34:31 +0200
Subject: [PATCH] ASoC: ak4613: Implement suspend callback

Add the suspend callback to accompany the existing resume operation.
With the suspend/resume callbacks the regmap (regcache) state handling
can follow the recommended sequence.

Based on commit a2ebd58627e9aa48 ("ASoC: ak4642: Implement suspend
callback") by Peter Ujfalusi .

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Mark Brown 
---
 sound/soc/codecs/ak4613.c | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/ak4613.c b/sound/soc/codecs/ak4613.c
index 5013d2ba0c10..97798d250f08 100644
--- a/sound/soc/codecs/ak4613.c
+++ b/sound/soc/codecs/ak4613.c
@@ -437,15 +437,25 @@ static struct snd_soc_dai_driver ak4613_dai = {
.symmetric_rates = 1,
 };
 
-static int ak4613_resume(struct snd_soc_codec *codec)
+static int ak4613_suspend(struct snd_soc_codec *codec)
 {
struct regmap *regmap = dev_get_regmap(codec->dev, NULL);
 
+   regcache_cache_only(regmap, true);
regcache_mark_dirty(regmap);
+   return 0;
+}
+
+static int ak4613_resume(struct snd_soc_codec *codec)
+{
+   struct regmap *regmap = dev_get_regmap(codec->dev, NULL);
+
+   regcache_cache_only(regmap, false);
return regcache_sync(regmap);
 }
 
 static struct snd_soc_codec_driver soc_codec_dev_ak4613 = {
+   .suspend= ak4613_suspend,
.resume = ak4613_resume,
.set_bias_level = ak4613_set_bias_level,
.controls   = ak4613_snd_controls,
-- 
2.8.1



Applied "ASoC: wm8940: Enable cache usage to fix crashes on resume" to the asoc tree

2016-06-17 Thread Mark Brown
The patch

   ASoC: wm8940: Enable cache usage to fix crashes on resume

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 50c7a0ef2d97e56c7ce2f1ea5fe1d8e25aadc1bb Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven 
Date: Thu, 16 Jun 2016 14:34:32 +0200
Subject: [PATCH] ASoC: wm8940: Enable cache usage to fix crashes on resume

The wm8940 driver is using a regmap cache sync to restore the
configuration of the chip when switching from OFF to STANDBY, but does
not actually define a register cache which means that the restore is
never going to work and we trigger asserts in regmap.  Fix this by
enabling caching.

Based on commit d3030d11961a8c10 ("ASoC: ak4642: Enable cache usage to
fix crashes on resume") by Mark Brown .

Signed-off-by: Geert Uytterhoeven 
Acked-by: Charles Keepax 
Signed-off-by: Mark Brown 
---
 sound/soc/codecs/wm8940.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c
index f6f9395ea38e..1c600819f768 100644
--- a/sound/soc/codecs/wm8940.c
+++ b/sound/soc/codecs/wm8940.c
@@ -743,6 +743,7 @@ static const struct regmap_config wm8940_regmap = {
.max_register = WM8940_MONOMIX,
.reg_defaults = wm8940_reg_defaults,
.num_reg_defaults = ARRAY_SIZE(wm8940_reg_defaults),
+   .cache_type = REGCACHE_RBTREE,
 
.readable_reg = wm8940_readable_register,
.volatile_reg = wm8940_volatile_register,
-- 
2.8.1



Applied "ASoC: ak4613: Enable cache usage to fix crashes on resume" to the asoc tree

2016-06-17 Thread Mark Brown
The patch

   ASoC: ak4613: Enable cache usage to fix crashes on resume

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From dcd2d1f78664fdc75eadaaf65257834e24383d01 Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven 
Date: Thu, 16 Jun 2016 14:34:30 +0200
Subject: [PATCH] ASoC: ak4613: Enable cache usage to fix crashes on resume

During system resume:

kernel BUG at drivers/base/regmap/regcache.c:347!
...
PC is at regcache_sync+0x1c/0x128
LR is at ak4613_resume+0x28/0x34

The ak4613 driver is using a regmap cache sync to restore the
configuration of the chip on resume but does not actually define a
register cache which means that the resume is never going to work and we
trigger asserts in regmap.  Fix this by enabling caching.

Based on commit d3030d11961a8c10 ("ASoC: ak4642: Enable cache usage to
fix crashes on resume") by Mark Brown .

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Mark Brown 
---
 sound/soc/codecs/ak4613.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/codecs/ak4613.c b/sound/soc/codecs/ak4613.c
index 33d2f2e10e24..5013d2ba0c10 100644
--- a/sound/soc/codecs/ak4613.c
+++ b/sound/soc/codecs/ak4613.c
@@ -146,6 +146,7 @@ static const struct regmap_config ak4613_regmap_cfg = {
.max_register   = 0x16,
.reg_defaults   = ak4613_reg,
.num_reg_defaults   = ARRAY_SIZE(ak4613_reg),
+   .cache_type = REGCACHE_RBTREE,
 };
 
 static const struct of_device_id ak4613_of_match[] = {
-- 
2.8.1



Re: [PATCH 00/39 v2][RESEND] ASoC: add simple-card-core and standardize "simple" card

2016-06-25 Thread Mark Brown
On Fri, Jun 24, 2016 at 01:13:55AM +, Kuninori Morimoto wrote:

> These are resend of v2 of simple-card cleanup patches.

You last sent these (and more serieses) on Monday - this is *way* too
soon to be resending them, especially such a large series.

> Because of this stagnation, I already have almost
> 90 patches for simple-card + graph driver in locally...
> I would like to post them as soon as possible.

> OTOH, I know you don't like super big patchset, 
> Thus, I will post small batch patch set only today.
> I will post next small batch patch set if 1st batch was accepted.

They're already in my queue to review, resending another jumbo series is
just going to slow things down even further.  I'm getting through things
as fast as I can but I've been busy for the past little while and I do
tend to prioritise patch sets that are easier to review and where
there's broad and visible interest.  These are the same things I was
telling the Intel people when they were sending lots of driver serieses.


signature.asc
Description: PGP signature


Re: [PATCH 00/39 v2][RESEND] ASoC: add simple-card-core and standardize "simple" card

2016-06-26 Thread Mark Brown
On Sun, Jun 26, 2016 at 11:53:56PM +, Kuninori Morimoto wrote:

> > > These are resend of v2 of simple-card cleanup patches.

> > You last sent these (and more serieses) on Monday - this is *way* too
> > soon to be resending them, especially such a large series.

> Oops ??
> I sent it 1month ago ??

I got another copy a week ago.

> I thought this serieses was ignored or forgotten etc
> because there was no response form you during this 1month.
> Thus I tried "resend" patch-set.

That's fine, but please do bear in mind that it's a 39 patch series
which makes it a lot to get through and therefore slows things down.


signature.asc
Description: PGP signature


Applied "ASoC: hdmi-codec: callback function will be called with private data" to the asoc tree

2016-06-27 Thread Mark Brown
The patch

   ASoC: hdmi-codec: callback function will be called with private data

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From efc9194bcff84666832c6493bafa92029ac6634c Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Fri, 24 Jun 2016 02:47:55 +
Subject: [PATCH] ASoC: hdmi-codec: callback function will be called with
 private data

Current hdmi-codec driver is assuming that it will be registered
from HDMI driver. Because of this assumption, each callback function
has struct device pointer which is parent device (= HDMI).
Then, it can use dev_get_drvdata() to get private data.

OTOH, on some SoC/HDMI case, SoC has VIDEO/SOUND and HDMI IPs.
This case, it needs SoC VIDEO, SoC SOUND and HDMI video, HDMI codec
driver. In DesignWare HDMI IP case, SoC VIDEO (= DRM/KMS) driver tries
to bind DesignWare HDMI video driver, and HDMI codec driver
(= hdmi-codec). This case, above "parent device" of HDMI codec driver
is DRM/KMS driver and its "device" already has private data.

And, from DT and ASoC CPU/Codec/Card binding point of view, HDMI codec
(= hdmi-codec) needs to have "parent device" (= DRM/KMS), otherwise,
it never detect sound card.

Because of these reasons, some driver can't use dev_get_drvdata() to
get private data on hdmi-codec driver. This patch add new void pointer
on hdmi_codec_pdata for private data, and callback function will be
called with it.

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 include/sound/hdmi-codec.h| 13 -
 sound/soc/codecs/hdmi-codec.c | 15 ---
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/include/sound/hdmi-codec.h b/include/sound/hdmi-codec.h
index fc3a481ad91e..530c57bdefa0 100644
--- a/include/sound/hdmi-codec.h
+++ b/include/sound/hdmi-codec.h
@@ -53,18 +53,19 @@ struct hdmi_codec_params {
int channels;
 };
 
+struct hdmi_codec_pdata;
 struct hdmi_codec_ops {
/*
 * Called when ASoC starts an audio stream setup.
 * Optional
 */
-   int (*audio_startup)(struct device *dev);
+   int (*audio_startup)(struct device *dev, void *data);
 
/*
 * Configures HDMI-encoder for audio stream.
 * Mandatory
 */
-   int (*hw_params)(struct device *dev,
+   int (*hw_params)(struct device *dev, void *data,
 struct hdmi_codec_daifmt *fmt,
 struct hdmi_codec_params *hparms);
 
@@ -72,19 +73,20 @@ struct hdmi_codec_ops {
 * Shuts down the audio stream.
 * Mandatory
 */
-   void (*audio_shutdown)(struct device *dev);
+   void (*audio_shutdown)(struct device *dev, void *data);
 
/*
 * Mute/unmute HDMI audio stream.
 * Optional
 */
-   int (*digital_mute)(struct device *dev, bool enable);
+   int (*digital_mute)(struct device *dev, void *data, bool enable);
 
/*
 * Provides EDID-Like-Data from connected HDMI device.
 * Optional
 */
-   int (*get_eld)(struct device *dev, uint8_t *buf, size_t len);
+   int (*get_eld)(struct device *dev, void *data,
+  uint8_t *buf, size_t len);
 };
 
 /* HDMI codec initalization data */
@@ -93,6 +95,7 @@ struct hdmi_codec_pdata {
uint i2s:1;
uint spdif:1;
int max_i2s_channels;
+   void *data;
 };
 
 #define HDMI_CODEC_DRV_NAME "hdmi-audio-codec"
diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
index 8e36e883e453..f27d115626db 100644
--- a/sound/soc/codecs/hdmi-codec.c
+++ b/sound/soc/codecs/hdmi-codec.c
@@ -112,7 +112,7 @@ static int hdmi_codec_startup(struct snd_pcm_substream 
*substream,
return ret;
 
if (hcp->hcd.ops->audio_startup) {
-   ret = hcp->hcd.ops->audio_startup(dai->dev->parent);
+   ret = hcp->hcd.ops->audio_startup(dai->dev->parent, 
hcp->hcd.data);
if (ret) {
mutex_lock(&hcp->current_stream_lock);
hcp->current_stream = NULL;
@@ -122,8 +122,8 @@

Re: [PATCH 05/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_tdm()

2016-06-29 Thread Mark Brown
On Tue, May 31, 2016 at 09:00:40AM +, Kuninori Morimoto wrote:

> +int asoc_simple_card_parse_tdm(struct device_node *port_np,
> +struct asoc_simple_dai *simple_dai)
> +{
> + return snd_soc_of_parse_tdm_slot(port_np,
> +  &simple_dai->tx_slot_mask,
> +  &simple_dai->rx_slot_mask,
> +  &simple_dai->slots,
> +  &simple_dai->slot_width);
> +}
> +EXPORT_SYMBOL_GPL(asoc_simple_card_parse_tdm);

This is (obviously) a very thin wrapper around the existing interface.
If that makes sense then perhaps we should just update the existing
interface?


signature.asc
Description: PGP signature


Re: [PATCH 06/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_dailink_name()

2016-06-29 Thread Mark Brown
On Tue, May 31, 2016 at 09:01:09AM +, Kuninori Morimoto wrote:
> From: Kuninori Morimoto 
> 
> Current simple-card is creating dai_link->name / dai_link->stream_name.
> These are based on CPU + Codec name.
> It can be "fe.CPU" or "be.Codec" if it was DPCM.
> This patch adds simple card common function for it.

This looks like it's about putting DPCM into the DT.  Given that DPCM is
very much an implementation detail we're trying to get rid of this seems
like it's going in the wrong direction.  What's the intended use?


signature.asc
Description: PGP signature


Re: [PATCH 00/39 v2] ASoC: add simple-card-core and standardize "simple" card

2016-06-29 Thread Mark Brown
On Tue, May 31, 2016 at 08:56:55AM +, Kuninori Morimoto wrote:
> Hi Mark
> 
> These are v2 of simple-card cleanup patches.

I've said this a few times before but *please* try to make these patch
serieses smaller.  A 20 patch series is a large patch series, this is
twice that size...


signature.asc
Description: PGP signature


Re: [PATCH 09/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_clk()

2016-06-29 Thread Mark Brown
On Tue, May 31, 2016 at 09:02:22AM +, Kuninori Morimoto wrote:

> + struct clk *clk;
> + u32 val;
> +
> + /*
> +  * Parse dai->sysclk come from "clocks = <&xxx>"
> +  * (if system has common clock)
> +  *  or "system-clock-frequency = "
> +  *  or device's module clock.
> +  */
> + clk = of_clk_get(port_np, 0);
> + if (!IS_ERR(clk)) {
> + simple_dai->sysclk = clk_get_rate(clk);
> + simple_dai->clk = clk;
> + } else if (!of_property_read_u32(port_np, "system-clock-frequency", 
> &val)) {
> + simple_dai->sysclk = val;
> + } else {
> + clk = of_clk_get(endpoint_np, 0);
> + if (!IS_ERR(clk))
> + simple_dai->sysclk = clk_get_rate(clk);
> + }

This looks like we're leaking the clocks - devm_ might help here
perhaps?


signature.asc
Description: PGP signature


Re: [PATCH 08/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_card_prefix()

2016-06-29 Thread Mark Brown
On Tue, May 31, 2016 at 09:01:58AM +, Kuninori Morimoto wrote:

> +int asoc_simple_card_parse_card_prefix(struct snd_soc_card *card,
> +struct snd_soc_dai_link *dai_link,
> +struct snd_soc_codec_conf *codec_conf,
> +char *prefix)
> +{
> + char prop[128];
> +
> + snprintf(prop, sizeof(prop), "%sprefix", prefix);
> +
> + snd_soc_of_parse_audio_prefix(card, codec_conf,
> +   dai_link->codec_of_node,
> +   prop);
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_prefix);

Similar thin wrapper comment as before: what is this offering over the
underlying function?


signature.asc
Description: PGP signature


Applied "ASoC: add new simple-card-utils.c" to the asoc tree

2016-06-29 Thread Mark Brown
The patch

   ASoC: add new simple-card-utils.c

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From abd3147e69481caade441e8d8296fa3f541aea03 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Tue, 31 May 2016 09:00:14 +
Subject: [PATCH] ASoC: add new simple-card-utils.c

Current ALSA SoC has simple-card driver which is supporting both
platform and DT probe.
Now, some sound cards driver are created based on simple-card.
They have similar feature or function, but implemented separately
on each drivers. This is a waste of code.
OTOH, merging these driver into same driver is highly risk,
because it will be very difficult to keep compatibility.
More over, ALSA SoC want to have graph base of DT feature in the
future. Maybe it want to use simple-card like feature / function.
Because of these background, this patch creates simple-card
helper utils, and provides common function to each drivers.
1st is asoc_simple_card_parse_daifmt()

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 include/sound/simple_card_utils.h | 21 ++
 sound/soc/generic/Kconfig |  3 ++
 sound/soc/generic/Makefile|  2 ++
 sound/soc/generic/simple-card-utils.c | 54 +++
 4 files changed, 80 insertions(+)
 create mode 100644 include/sound/simple_card_utils.h
 create mode 100644 sound/soc/generic/simple-card-utils.c

diff --git a/include/sound/simple_card_utils.h 
b/include/sound/simple_card_utils.h
new file mode 100644
index ..7acc798016e0
--- /dev/null
+++ b/include/sound/simple_card_utils.h
@@ -0,0 +1,21 @@
+/*
+ * simple_card_core.h
+ *
+ * Copyright (c) 2016 Kuninori Morimoto 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __SIMPLE_CARD_CORE_H
+#define __SIMPLE_CARD_CORE_H
+
+#include 
+
+int asoc_simple_card_parse_daifmt(struct device *dev,
+ struct device_node *node,
+ struct device_node *codec,
+ char *prefix,
+ unsigned int *retfmt);
+
+#endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/Kconfig b/sound/soc/generic/Kconfig
index 610f61251640..26c2fe6a0b93 100644
--- a/sound/soc/generic/Kconfig
+++ b/sound/soc/generic/Kconfig
@@ -1,3 +1,6 @@
+config SND_SIMPLE_CARD_UTILS
+   tristate
+
 config SND_SIMPLE_CARD
tristate "ASoC Simple sound card support"
help
diff --git a/sound/soc/generic/Makefile b/sound/soc/generic/Makefile
index 9c3b246792bf..45602ca8536e 100644
--- a/sound/soc/generic/Makefile
+++ b/sound/soc/generic/Makefile
@@ -1,3 +1,5 @@
+obj-$(CONFIG_SND_SIMPLE_CARD_UTILS) := simple-card-utils.o
+
 snd-soc-simple-card-objs   := simple-card.o
 
 obj-$(CONFIG_SND_SIMPLE_CARD)  += snd-soc-simple-card.o
diff --git a/sound/soc/generic/simple-card-utils.c 
b/sound/soc/generic/simple-card-utils.c
new file mode 100644
index ..3f6b72526f71
--- /dev/null
+++ b/sound/soc/generic/simple-card-utils.c
@@ -0,0 +1,54 @@
+/*
+ * simple-card-core.c
+ *
+ * Copyright (c) 2016 Kuninori Morimoto 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include 
+#include 
+
+int asoc_simple_card_parse_daifmt(struct device *dev,
+ struct device_node *node,
+ struct device_node *codec,
+ char *prefix,
+ unsigned int *retfmt)
+{
+   struct device_node *bitclkmaster = NULL;
+   struct device_node *framemaster = NULL;
+   int prefix_len = prefix ? strlen(prefix) : 0;
+   unsigned int daifmt;
+
+   daifmt = snd_soc_of_parse_daifmt(node, prefix,
+&bitclkmaster, &framemaster);
+   daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
+
+   if (prefix_len &&a

Applied "ASoC: simple-card: add new asoc_simple_jack and use it" to the asoc tree

2016-06-29 Thread Mark Brown
The patch

   ASoC: simple-card: add new asoc_simple_jack and use it

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 9eac361877b3c96c8f68dffd7a7a3e92a2b85d0b Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Tue, 31 May 2016 08:59:46 +
Subject: [PATCH] ASoC: simple-card: add new asoc_simple_jack and use it

Current simple-card supports snd_soc_jack/pin/gpio.
These code are very similar, but driver has verbosity code.
So, this patch adds new snd_soc_jack and cleanups code

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/generic/simple-card.c | 153 
 1 file changed, 78 insertions(+), 75 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index b6e6d9a12ec2..8d0311ceded1 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -21,6 +21,12 @@
 #include 
 #include 
 
+struct asoc_simple_jack {
+   struct snd_soc_jack jack;
+   struct snd_soc_jack_pin pin;
+   struct snd_soc_jack_gpio gpio;
+};
+
 struct simple_card_data {
struct snd_soc_card snd_card;
struct simple_dai_props {
@@ -29,10 +35,8 @@ struct simple_card_data {
unsigned int mclk_fs;
} *dai_props;
unsigned int mclk_fs;
-   int gpio_hp_det;
-   int gpio_hp_det_invert;
-   int gpio_mic_det;
-   int gpio_mic_det_invert;
+   struct asoc_simple_jack hp_jack;
+   struct asoc_simple_jack mic_jack;
struct snd_soc_dai_link dai_link[]; /* dynamically allocated */
 };
 
@@ -42,6 +46,67 @@ struct simple_card_data {
 
 #define PREFIX "simple-audio-card,"
 
+#define asoc_simple_card_init_hp(card, sjack, prefix)\
+   asoc_simple_card_init_jack(card, sjack, 1, prefix)
+#define asoc_simple_card_init_mic(card, sjack, prefix)\
+   asoc_simple_card_init_jack(card, sjack, 0, prefix)
+static int asoc_simple_card_init_jack(struct snd_soc_card *card,
+ struct asoc_simple_jack *sjack,
+ int is_hp, char *prefix)
+{
+   struct device *dev = card->dev;
+   enum of_gpio_flags flags;
+   char prop[128];
+   char *pin_name;
+   char *gpio_name;
+   int mask;
+   int det;
+
+   sjack->gpio.gpio = -ENOENT;
+
+   if (is_hp) {
+   snprintf(prop, sizeof(prop), "%shp-det-gpio", prefix);
+   pin_name= "Headphones";
+   gpio_name   = "Headphone detection";
+   mask= SND_JACK_HEADPHONE;
+   } else {
+   snprintf(prop, sizeof(prop), "%smic-det-gpio", prefix);
+   pin_name= "Mic Jack";
+   gpio_name   = "Mic detection";
+   mask= SND_JACK_MICROPHONE;
+   }
+
+   det = of_get_named_gpio_flags(dev->of_node, prop, 0, &flags);
+   if (det == -EPROBE_DEFER)
+   return -EPROBE_DEFER;
+
+   if (gpio_is_valid(det)) {
+   sjack->pin.pin  = pin_name;
+   sjack->pin.mask = mask;
+
+   sjack->gpio.name= gpio_name;
+   sjack->gpio.report  = mask;
+   sjack->gpio.gpio= det;
+   sjack->gpio.invert  = !!(flags & OF_GPIO_ACTIVE_LOW);
+   sjack->gpio.debounce_time = 150;
+
+   snd_soc_card_jack_new(card, pin_name, mask,
+ &sjack->jack,
+ &sjack->pin, 1);
+
+   snd_soc_jack_add_gpios(&sjack->jack, 1,
+  &sjack->gpio);
+   }
+
+   return 0;
+}
+
+static void asoc_simple_card_remove_jack(struct asoc_simple_jack *sjack)
+{
+   if (gpio_is_valid(sjack->gpio.gpio))
+   snd_soc_jack_free_gpios(&sjack->jack, 1, &sjack->gpio);
+}
+
 static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
 {
struct snd_soc_pcm_run

Re: [PATCH 10/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_endpoint()

2016-06-29 Thread Mark Brown
On Tue, May 31, 2016 at 09:03:00AM +, Kuninori Morimoto wrote:
> From: Kuninori Morimoto 
> 
> simple-card needs to get its dai name and endpoint node.
> This patch makes it simple style standard

I'm finding these descriptions very clear and hard to follow, and the
lack of any changes to the simple-card code is a bit unclear.  Can I
suggest that future versions of this should have patches that move code
out of simple-card to helper functions as a single patch rather than
adding the helper in one and (I presume) the use in another?

In this case I'm not entirely clear what an endpoint is.


signature.asc
Description: PGP signature


Re: [PATCH 07/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()

2016-06-29 Thread Mark Brown
On Tue, May 31, 2016 at 09:01:34AM +, Kuninori Morimoto wrote:

> + if (!card->name)
> + card->name = card->dai_link->name;

This will unconditionally defererence dai_link but it's optional - we
can have analogue only cards.


signature.asc
Description: PGP signature


Re: [PATCH 07/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()

2016-07-01 Thread Mark Brown
On Thu, Jun 30, 2016 at 02:55:06AM +, Kuninori Morimoto wrote:

> > > + if (!card->name)
> > > + card->name = card->dai_link->name;

> > This will unconditionally defererence dai_link but it's optional - we
> > can have analogue only cards.

> This is not new feature. Current simple-card already has it.

Right, but simple-card does need DAIs IIRC while this is intended to be
more general.  All it needs is a check before the dereference to be safe
so it's trivial to handle.


signature.asc
Description: PGP signature


Re: [PATCH 09/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_clk()

2016-07-01 Thread Mark Brown
On Thu, Jun 30, 2016 at 12:39:12AM +, Kuninori Morimoto wrote:

> Oops, of_clk_get() doesn't have devm_of_clk_get() ?

Perhaps add it? 

> (and no of_clk_put() ... )
> I will keep above as-is in v3. We can fix it incrementally (?)

You can just use regular clk_put() with of_clk_get().


signature.asc
Description: PGP signature


Applied "ASoC: rsrc-card: use asoc_simple_card_parse_daifmt()" to the asoc tree

2016-07-01 Thread Mark Brown
The patch

   ASoC: rsrc-card: use asoc_simple_card_parse_daifmt()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From d6a4a9a45d072e3a27ea6e5f98192d78be621a9c Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Thu, 30 Jun 2016 06:03:13 +
Subject: [PATCH] ASoC: rsrc-card: use asoc_simple_card_parse_daifmt()

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/sh/Kconfig  |  1 +
 sound/soc/sh/rcar/rsrc-card.c | 38 --
 2 files changed, 5 insertions(+), 34 deletions(-)

diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig
index c9902a6d6fa0..9311f119feb5 100644
--- a/sound/soc/sh/Kconfig
+++ b/sound/soc/sh/Kconfig
@@ -44,6 +44,7 @@ config SND_SOC_RCAR
 
 config SND_SOC_RSRC_CARD
tristate "Renesas Sampling Rate Convert Sound Card"
+   select SND_SIMPLE_CARD_UTILS
help
  This option enables simple sound if you need sampling rate convert
 
diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 1bc7ecfc42a9..984d8fed0dbd 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 struct rsrc_card_of_data {
const char *prefix;
@@ -159,38 +160,6 @@ static int rsrc_card_be_hw_params_fixup(struct 
snd_soc_pcm_runtime *rtd,
return 0;
 }
 
-static int rsrc_card_parse_daifmt(struct device_node *node,
- struct device_node *codec,
- struct rsrc_card_priv *priv,
- struct snd_soc_dai_link *dai_link,
- unsigned int *retfmt)
-{
-   struct device_node *bitclkmaster = NULL;
-   struct device_node *framemaster = NULL;
-   unsigned int daifmt;
-
-   daifmt = snd_soc_of_parse_daifmt(node, NULL,
-&bitclkmaster, &framemaster);
-   daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
-
-   if (!bitclkmaster && !framemaster)
-   return -EINVAL;
-
-   if (codec == bitclkmaster)
-   daifmt |= (codec == framemaster) ?
-   SND_SOC_DAIFMT_CBM_CFM : SND_SOC_DAIFMT_CBM_CFS;
-   else
-   daifmt |= (codec == framemaster) ?
-   SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS;
-
-   of_node_put(bitclkmaster);
-   of_node_put(framemaster);
-
-   *retfmt = daifmt;
-
-   return 0;
-}
-
 static int rsrc_card_parse_links(struct device_node *np,
 struct rsrc_card_priv *priv,
 int idx, bool is_fe)
@@ -358,6 +327,7 @@ static int rsrc_card_dai_sub_link_of(struct device_node 
*node,
 static int rsrc_card_dai_link_of(struct device_node *node,
 struct rsrc_card_priv *priv)
 {
+   struct device *dev = rsrc_priv_to_dev(priv);
struct snd_soc_dai_link *dai_link;
struct device_node *np;
unsigned int daifmt = 0;
@@ -370,8 +340,8 @@ static int rsrc_card_dai_link_of(struct device_node *node,
dai_link = rsrc_priv_to_link(priv, i);
 
if (strcmp(np->name, "codec") == 0) {
-   ret = rsrc_card_parse_daifmt(node, np, priv,
-dai_link, &daifmt);
+   ret = asoc_simple_card_parse_daifmt(dev, node, np,
+   NULL, &daifmt);
if (ret < 0)
return ret;
break;
-- 
2.8.1



Applied "ASoC: simple-card: use asoc_simple_card_parse_daifmt()" to the asoc tree

2016-07-01 Thread Mark Brown
The patch

   ASoC: simple-card: use asoc_simple_card_parse_daifmt()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From cecdef3656956b0978bf86ecd1ce0542d2c61e97 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Thu, 30 Jun 2016 06:02:46 +
Subject: [PATCH] ASoC: simple-card: use asoc_simple_card_parse_daifmt()

We can use simpel utils asoc_simple_card_parse_daifmt().
Let's use it

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 include/sound/simple_card.h   | 11 +-
 include/sound/simple_card_utils.h | 10 +
 sound/soc/generic/Kconfig |  1 +
 sound/soc/generic/simple-card.c   | 46 ++-
 4 files changed, 14 insertions(+), 54 deletions(-)

diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h
index 0399352f3a62..a6a2e1547092 100644
--- a/include/sound/simple_card.h
+++ b/include/sound/simple_card.h
@@ -13,16 +13,7 @@
 #define __SIMPLE_CARD_H
 
 #include 
-
-struct asoc_simple_dai {
-   const char *name;
-   unsigned int sysclk;
-   int slots;
-   int slot_width;
-   unsigned int tx_slot_mask;
-   unsigned int rx_slot_mask;
-   struct clk *clk;
-};
+#include 
 
 struct asoc_simple_card_info {
const char *name;
diff --git a/include/sound/simple_card_utils.h 
b/include/sound/simple_card_utils.h
index 7acc798016e0..50aa7b22a94c 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -12,6 +12,16 @@
 
 #include 
 
+struct asoc_simple_dai {
+   const char *name;
+   unsigned int sysclk;
+   int slots;
+   int slot_width;
+   unsigned int tx_slot_mask;
+   unsigned int rx_slot_mask;
+   struct clk *clk;
+};
+
 int asoc_simple_card_parse_daifmt(struct device *dev,
  struct device_node *node,
  struct device_node *codec,
diff --git a/sound/soc/generic/Kconfig b/sound/soc/generic/Kconfig
index 26c2fe6a0b93..c01c5dd68601 100644
--- a/sound/soc/generic/Kconfig
+++ b/sound/soc/generic/Kconfig
@@ -3,5 +3,6 @@ config SND_SIMPLE_CARD_UTILS
 
 config SND_SIMPLE_CARD
tristate "ASoC Simple sound card support"
+   select SND_SIMPLE_CARD_UTILS
help
  This option enables generic simple sound card support
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 8d0311ceded1..e3a32d340482 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -308,48 +308,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
return 0;
 }
 
-static int asoc_simple_card_parse_daifmt(struct device_node *node,
-struct simple_card_data *priv,
-struct device_node *codec,
-char *prefix, int idx)
-{
-   struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx);
-   struct device *dev = simple_priv_to_dev(priv);
-   struct device_node *bitclkmaster = NULL;
-   struct device_node *framemaster = NULL;
-   unsigned int daifmt;
-
-   daifmt = snd_soc_of_parse_daifmt(node, prefix,
-&bitclkmaster, &framemaster);
-   daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
-
-   if (strlen(prefix) && !bitclkmaster && !framemaster) {
-   /*
-* No dai-link level and master setting was not found from
-* sound node level, revert back to legacy DT parsing and
-* take the settings from codec node.
-*/
-   dev_dbg(dev, "Revert to legacy daifmt parsing\n");
-
-   daifmt = snd_soc_of_parse_daifmt(codec, NULL, NULL, NULL) |
-   (daifmt & ~SND_SOC_DAIFMT_CLOCK_MASK);
-   } else {
-   if (codec == bitclkmaster)
-   daifmt |= (codec == framemaster) ?
-   SND_SOC_DAIFMT_CBM_CFM : SND_SOC_DAIFMT_CBM_CFS;
-   else
-   daifmt |= (codec == framemast

Re: [PATCH 07/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()

2016-07-04 Thread Mark Brown
On Mon, Jul 04, 2016 at 12:20:29AM +, Kuninori Morimoto wrote:

> > > > > > +   if (!card->name)
> > > > > > +   card->name = card->dai_link->name;

> > > > > This will unconditionally defererence dai_link but it's optional - we
> > > > > can have analogue only cards.

> > > > This is not new feature. Current simple-card already has it.

> > > Right, but simple-card does need DAIs IIRC while this is intended to be
> > > more general.  All it needs is a check before the dereference to be safe
> > > so it's trivial to handle.

> > Sorry, I'm not 100% understand.
> > Do you mean we don't need handle card->name ? (= we should remove above ?)
> > If so, we can't register card on simple-card. Because 
> > snd_soc_register_card()
> > requests it.

> This function tries to get card name from snd_soc_of_parse_card_name().
> and it tries to set card->name from dai_link if card still doesn't have name.
> So, above is optional 2nd try.
> Or, do you mean this if (!card->name) can goes to simple-card, instead of 
> utils ?
> I have no objection about it , but it can be double handling ?
> Because other simple family have same situation.

If we try to dereference card->dai_link without checking to see if it's
set then we'll crash.


signature.asc
Description: PGP signature


Re: [PATCH 07/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()

2016-07-05 Thread Mark Brown
On Mon, Jul 04, 2016 at 08:59:53AM +, Kuninori Morimoto wrote:

> > If we try to dereference card->dai_link without checking to see if it's
> > set then we'll crash.

> Ahh, do you mean we need like this ?

> if (!card->name && card->dai_link)
>   card->name = card->dai_link->name;

Yes, exactly.


signature.asc
Description: PGP signature


Re: [PATCH 3/6] ASoC: simple-card-utils: add asoc_simple_card_parse_dailink_name()

2016-07-05 Thread Mark Brown
On Tue, Jul 05, 2016 at 12:24:54AM +, Kuninori Morimoto wrote:

> Please let me know if your favored style is name format should be
> handled on each sound card, not in utils.c
> I can arrange it.

I'd definitely prefer to limit the usage of DPCM in generic code so
keeping it in the card seems safer.


signature.asc
Description: PGP signature


Re: [PATCH 1/7] ASoC: simple-card-utils: add asoc_simple_card_set_dailink_name()

2016-07-08 Thread Mark Brown
On Wed, Jul 06, 2016 at 10:01:27AM +0900, Kuninori Morimoto wrote:

> + if (name) {
> + ret = 0;
> +
> + dai_link->name =
> + dai_link->stream_name = name;
> + }

This code is unclear - it's valid C but the line break in the middle of
the set of assignments makes it look like the first assignment is an
error.  This should be two assignments.


signature.asc
Description: PGP signature


Applied "ASoC: simple-card: use asoc_simple_card_parse_card_name()" to the asoc tree

2016-07-16 Thread Mark Brown
The patch

   ASoC: simple-card: use asoc_simple_card_parse_card_name()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 3527d85b85e65401b7d93073b3ab4e687cdd2521 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Mon, 11 Jul 2016 23:59:40 +
Subject: [PATCH] ASoC: simple-card: use asoc_simple_card_parse_card_name()

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/generic/simple-card.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 07469cd9272c..43295f024982 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -427,9 +427,6 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
if (!node)
return -EINVAL;
 
-   /* Parse the card name from DT */
-   snd_soc_of_parse_card_name(&priv->snd_card, PREFIX "name");
-
/* The off-codec widgets */
if (of_property_read_bool(node, PREFIX "widgets")) {
ret = snd_soc_of_parse_audio_simple_widgets(&priv->snd_card,
@@ -451,9 +448,6 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
if (ret == 0)
priv->mclk_fs = val;
 
-   dev_dbg(dev, "New simple-card: %s\n", priv->snd_card.name ?
-   priv->snd_card.name : "");
-
/* Single/Muti DAI link(s) & New style of DT node */
if (of_get_child_by_name(node, PREFIX "dai-link")) {
struct device_node *np = NULL;
@@ -476,8 +470,9 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
return ret;
}
 
-   if (!priv->snd_card.name)
-   priv->snd_card.name = priv->snd_card.dai_link->name;
+   ret = asoc_simple_card_parse_card_name(&priv->snd_card, PREFIX);
+   if (ret)
+   return ret;
 
return 0;
 }
-- 
2.8.1



Applied "ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()" to the asoc tree

2016-07-16 Thread Mark Brown
The patch

   ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From fc55c9b5a2ea794c4b6be937522bcfe98be4770a Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Mon, 11 Jul 2016 23:59:16 +
Subject: [PATCH] ASoC: simple-card-utils: add
 asoc_simple_card_parse_card_name()

simple-card needs to get its card name.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 include/sound/simple_card_utils.h |  2 ++
 sound/soc/generic/simple-card-utils.c | 20 
 2 files changed, 22 insertions(+)

diff --git a/include/sound/simple_card_utils.h 
b/include/sound/simple_card_utils.h
index b88a8dcfe4ba..86088aed9002 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -30,5 +30,7 @@ int asoc_simple_card_parse_daifmt(struct device *dev,
 int asoc_simple_card_set_dailink_name(struct device *dev,
  struct snd_soc_dai_link *dai_link,
  const char *fmt, ...);
+int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
+char *prefix);
 
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-utils.c 
b/sound/soc/generic/simple-card-utils.c
index 48c73660b66a..d89a9a1b2471 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -75,3 +75,23 @@ int asoc_simple_card_set_dailink_name(struct device *dev,
return ret;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_set_dailink_name);
+
+int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
+char *prefix)
+{
+   char prop[128];
+   int ret;
+
+   snprintf(prop, sizeof(prop), "%sname", prefix);
+
+   /* Parse the card name from DT */
+   ret = snd_soc_of_parse_card_name(card, prop);
+   if (ret < 0)
+   return ret;
+
+   if (!card->name && card->dai_link)
+   card->name = card->dai_link->name;
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_name);
-- 
2.8.1



Applied "ASoC: simple-card-utils: add asoc_simple_card_set_dailink_name()" to the asoc tree

2016-07-16 Thread Mark Brown
The patch

   ASoC: simple-card-utils: add asoc_simple_card_set_dailink_name()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 1db3312e3ab1a776ae8f414640dd7c180ce38a75 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Mon, 11 Jul 2016 23:57:14 +
Subject: [PATCH] ASoC: simple-card-utils: add
 asoc_simple_card_set_dailink_name()

Current simple-card is creating dai_link->name / dai_link->stream_name.
These are based on CPU + Codec name, or "fe.CPU" or "be.Codec" if it
was DPCM.
This patch adds asoc_simple_card_set_dailink_name() and set dailink
name as common method.

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 include/sound/simple_card_utils.h |  3 +++
 sound/soc/generic/simple-card-utils.c | 23 +++
 2 files changed, 26 insertions(+)

diff --git a/include/sound/simple_card_utils.h 
b/include/sound/simple_card_utils.h
index 50aa7b22a94c..b88a8dcfe4ba 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -27,5 +27,8 @@ int asoc_simple_card_parse_daifmt(struct device *dev,
  struct device_node *codec,
  char *prefix,
  unsigned int *retfmt);
+int asoc_simple_card_set_dailink_name(struct device *dev,
+ struct snd_soc_dai_link *dai_link,
+ const char *fmt, ...);
 
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-utils.c 
b/sound/soc/generic/simple-card-utils.c
index 3f6b72526f71..48c73660b66a 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -52,3 +52,26 @@ int asoc_simple_card_parse_daifmt(struct device *dev,
return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_daifmt);
+
+int asoc_simple_card_set_dailink_name(struct device *dev,
+ struct snd_soc_dai_link *dai_link,
+ const char *fmt, ...)
+{
+   va_list ap;
+   char *name = NULL;
+   int ret = -ENOMEM;
+
+   va_start(ap, fmt);
+   name = devm_kvasprintf(dev, GFP_KERNEL, fmt, ap);
+   va_end(ap);
+
+   if (name) {
+   ret = 0;
+
+   dai_link->name  = name;
+   dai_link->stream_name   = name;
+   }
+
+   return ret;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_set_dailink_name);
-- 
2.8.1



Applied "ASoC: simple-card: use asoc_simple_card_parse_dailink_name()" to the asoc tree

2016-07-16 Thread Mark Brown
The patch

   ASoC: simple-card: use asoc_simple_card_parse_dailink_name()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 2e8d1c7d544089fe4894c504020d7ac7eb1de531 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Mon, 11 Jul 2016 23:57:34 +
Subject: [PATCH] ASoC: simple-card: use asoc_simple_card_parse_dailink_name()

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/generic/simple-card.c | 17 +
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index e3a32d340482..07469cd9272c 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -319,7 +319,6 @@ static int asoc_simple_card_dai_link_of(struct device_node 
*node,
struct device_node *cpu = NULL;
struct device_node *plat = NULL;
struct device_node *codec = NULL;
-   char *name;
char prop[128];
char *prefix = "";
int ret, cpu_args;
@@ -380,19 +379,13 @@ static int asoc_simple_card_dai_link_of(struct 
device_node *node,
if (!dai_link->platform_of_node)
dai_link->platform_of_node = dai_link->cpu_of_node;
 
-   /* DAI link name is created from CPU/CODEC dai name */
-   name = devm_kzalloc(dev,
-   strlen(dai_link->cpu_dai_name)   +
-   strlen(dai_link->codec_dai_name) + 2,
-   GFP_KERNEL);
-   if (!name) {
-   ret = -ENOMEM;
+   ret = asoc_simple_card_set_dailink_name(dev, dai_link,
+   "%s-%s",
+   dai_link->cpu_dai_name,
+   dai_link->codec_dai_name);
+   if (ret < 0)
goto dai_link_of_err;
-   }
 
-   sprintf(name, "%s-%s", dai_link->cpu_dai_name,
-   dai_link->codec_dai_name);
-   dai_link->name = dai_link->stream_name = name;
dai_link->ops = &asoc_simple_card_ops;
dai_link->init = asoc_simple_card_dai_init;
 
-- 
2.8.1



Applied "ASoC: rsrc-card: use asoc_simple_card_parse_dailink_name()" to the asoc tree

2016-07-16 Thread Mark Brown
The patch

   ASoC: rsrc-card: use asoc_simple_card_parse_dailink_name()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 8a99a6bd7f410e1b889c8cc59538009f40507aac Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Mon, 11 Jul 2016 23:58:25 +
Subject: [PATCH] ASoC: rsrc-card: use asoc_simple_card_parse_dailink_name()

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/sh/rcar/rsrc-card.c | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index c065a6df0680..81914ca56f00 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -47,7 +47,6 @@ static const struct of_device_id rsrc_card_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, rsrc_card_of_match);
 
-#define DAI_NAME_NUM   32
 struct rsrc_card_dai {
unsigned int sysclk;
unsigned int tx_slot_mask;
@@ -55,7 +54,6 @@ struct rsrc_card_dai {
int slots;
int slot_width;
struct clk *clk;
-   char dai_name[DAI_NAME_NUM];
 };
 
 #define IDX_CPU0
@@ -163,6 +161,7 @@ static int rsrc_card_parse_links(struct device_node *np,
 struct rsrc_card_priv *priv,
 int idx, bool is_fe)
 {
+   struct device *dev = rsrc_priv_to_dev(priv);
struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
struct rsrc_card_dai *dai_props = rsrc_priv_to_props(priv, idx);
struct of_phandle_args args;
@@ -200,9 +199,11 @@ static int rsrc_card_parse_links(struct device_node *np,
if (ret < 0)
return ret;
 
-   /* set dai_name */
-   snprintf(dai_props->dai_name, DAI_NAME_NUM, "fe.%s",
-dai_link->cpu_dai_name);
+   ret = asoc_simple_card_set_dailink_name(dev, dai_link,
+   "fe.%s",
+   dai_link->cpu_dai_name);
+   if (ret < 0)
+   return ret;
 
/*
 * In soc_bind_dai_link() will check cpu name after
@@ -216,7 +217,6 @@ static int rsrc_card_parse_links(struct device_node *np,
if (!args.args_count)
dai_link->cpu_dai_name = NULL;
} else {
-   struct device *dev = rsrc_priv_to_dev(priv);
const struct rsrc_card_of_data *of_data;
 
of_data = of_device_get_match_data(dev);
@@ -234,6 +234,12 @@ static int rsrc_card_parse_links(struct device_node *np,
if (ret < 0)
return ret;
 
+   ret = asoc_simple_card_set_dailink_name(dev, dai_link,
+   "be.%s",
+   
dai_link->codec_dai_name);
+   if (ret < 0)
+   return ret;
+
/* additional name prefix */
if (of_data) {
priv->codec_conf.of_node = dai_link->codec_of_node;
@@ -244,18 +250,12 @@ static int rsrc_card_parse_links(struct device_node *np,
  dai_link->codec_of_node,
  "audio-prefix");
}
-
-   /* set dai_name */
-   snprintf(dai_props->dai_name, DAI_NAME_NUM, "be.%s",
-dai_link->codec_dai_name);
}
 
/* Simple Card assumes platform == cpu */
dai_link->platform_of_node  = dai_link->cpu_of_node;
dai_link->dpcm_playback = 1;
dai_link->dpcm_capture  = 1;
-   dai_link->name  = dai_props->dai_name;
-   dai_link->stream_name   = dai_props->dai_name;
dai_link->ops   = &rsrc_card_ops;
dai_link->init  = rsr

Applied "ASoC: rsrc-card: use asoc_simple_card_parse_card_name()" to the asoc tree

2016-07-16 Thread Mark Brown
The patch

   ASoC: rsrc-card: use asoc_simple_card_parse_card_name()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 53ae918f117dbb86e7b872e3b7532839f752c895 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Tue, 12 Jul 2016 00:00:00 +
Subject: [PATCH] ASoC: rsrc-card: use asoc_simple_card_parse_card_name()

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/sh/rcar/rsrc-card.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 239a13a30bed..fa37f842b62f 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -395,9 +395,6 @@ static int rsrc_card_parse_of(struct device_node *node,
   "audio-routing");
}
 
-   /* Parse the card name from DT */
-   snd_soc_of_parse_card_name(&priv->snd_card, "card-name");
-
/* sampling rate convert */
of_property_read_u32(node, "convert-rate", &priv->convert_rate);
 
@@ -413,8 +410,9 @@ static int rsrc_card_parse_of(struct device_node *node,
if (ret < 0)
return ret;
 
-   if (!priv->snd_card.name)
-   priv->snd_card.name = priv->snd_card.dai_link->name;
+   ret = asoc_simple_card_parse_card_name(&priv->snd_card, "card-");
+   if (ret < 0)
+   return ret;
 
return 0;
 }
-- 
2.8.1



Applied "ASoC: rsrc-card: use asoc_simple_dai instead of rsrc_card_dai" to the asoc tree

2016-07-16 Thread Mark Brown
The patch

   ASoC: rsrc-card: use asoc_simple_dai instead of rsrc_card_dai

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 303c3be42815c2d12bf563dc0df9daceea1ebfad Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Mon, 11 Jul 2016 23:58:50 +
Subject: [PATCH] ASoC: rsrc-card: use asoc_simple_dai instead of rsrc_card_dai

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/sh/rcar/rsrc-card.c | 25 -
 1 file changed, 8 insertions(+), 17 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 81914ca56f00..239a13a30bed 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -47,21 +47,12 @@ static const struct of_device_id rsrc_card_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, rsrc_card_of_match);
 
-struct rsrc_card_dai {
-   unsigned int sysclk;
-   unsigned int tx_slot_mask;
-   unsigned int rx_slot_mask;
-   int slots;
-   int slot_width;
-   struct clk *clk;
-};
-
 #define IDX_CPU0
 #define IDX_CODEC  1
 struct rsrc_card_priv {
struct snd_soc_card snd_card;
struct snd_soc_codec_conf codec_conf;
-   struct rsrc_card_dai *dai_props;
+   struct asoc_simple_dai *dai_props;
struct snd_soc_dai_link *dai_link;
u32 convert_rate;
u32 convert_channels;
@@ -75,7 +66,7 @@ static int rsrc_card_startup(struct snd_pcm_substream 
*substream)
 {
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct rsrc_card_priv *priv =   snd_soc_card_get_drvdata(rtd->card);
-   struct rsrc_card_dai *dai_props =
+   struct asoc_simple_dai *dai_props =
rsrc_priv_to_props(priv, rtd->num);
 
return clk_prepare_enable(dai_props->clk);
@@ -85,7 +76,7 @@ static void rsrc_card_shutdown(struct snd_pcm_substream 
*substream)
 {
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct rsrc_card_priv *priv =   snd_soc_card_get_drvdata(rtd->card);
-   struct rsrc_card_dai *dai_props =
+   struct asoc_simple_dai *dai_props =
rsrc_priv_to_props(priv, rtd->num);
 
clk_disable_unprepare(dai_props->clk);
@@ -101,7 +92,7 @@ static int rsrc_card_dai_init(struct snd_soc_pcm_runtime 
*rtd)
struct rsrc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
struct snd_soc_dai *dai;
struct snd_soc_dai_link *dai_link;
-   struct rsrc_card_dai *dai_props;
+   struct asoc_simple_dai *dai_props;
int num = rtd->num;
int ret;
 
@@ -163,7 +154,7 @@ static int rsrc_card_parse_links(struct device_node *np,
 {
struct device *dev = rsrc_priv_to_dev(priv);
struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
-   struct rsrc_card_dai *dai_props = rsrc_priv_to_props(priv, idx);
+   struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
struct of_phandle_args args;
int ret;
 
@@ -267,7 +258,7 @@ static int rsrc_card_parse_clk(struct device_node *np,
   int idx, bool is_fe)
 {
struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
-   struct rsrc_card_dai *dai_props = rsrc_priv_to_props(priv, idx);
+   struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
struct clk *clk;
struct device_node *of_np = is_fe ? dai_link->cpu_of_node :
dai_link->codec_of_node;
@@ -304,7 +295,7 @@ static int rsrc_card_dai_sub_link_of(struct device_node 
*node,
 {
struct device *dev = rsrc_priv_to_dev(priv);
struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
-   struct rsrc_card_dai *dai_props = rsrc_priv_to_props(priv, idx);
+   struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
int ret;
 
ret = rsrc_card_parse_links(np, priv, idx, is_fe);
@@ -371,7 +362,7 @@ static int rsrc_card_parse_of(struct device_node *node,
  struct device *dev)
 {
const struct rsrc_card_of_data 

Re: [PATCH/RFC 4/6] spi: slave: Add SPI slave handler reporting boot up time

2016-07-18 Thread Mark Brown
On Wed, Jun 22, 2016 at 03:42:07PM +0200, Geert Uytterhoeven wrote:
> Add an SPI slave handler responding with the time of reception of the
> last SPI message.
> 
> This can be used by an external microcontroller as a dead man's switch.

The subject says boot up time, this says time of reception of the last
message.  Which is it?

> +static int spi_slave_time_send(struct spi_device *spi)
> +{
> + __be32 msg[2];
> + u32 rem_ns;
> + u64 ts;
> +
> + ts = local_clock();
> + rem_ns = do_div(ts, 10) / 1000;
> +
> + msg[0] = cpu_to_be32(ts);
> + msg[1] = cpu_to_be32(rem_ns);
> +
> + return spi_write(spi, &msg, sizeof(msg));
> +}

Looks like uptime which is a third thing.

> +static int spi_slave_time_remove(struct spi_device *spi)
> +{
> + struct spi_slave_time_priv *priv = spi_get_drvdata(spi);
> +
> + /* FIXME Doesn't work, as spi_write() is blocked on a completion */
> + kthread_stop(priv->thread);

spi_async()?  Still no cancellation on the actual operation but it
pushes it more inside the framework.


signature.asc
Description: PGP signature


Re: [PATCH/RFC 2/6] spi: core: Add support for registering SPI slave controllers

2016-07-18 Thread Mark Brown
On Wed, Jun 22, 2016 at 03:42:05PM +0200, Geert Uytterhoeven wrote:
> Add support for registering SPI slave controllers using the existing SPI
> master framework:
>   - SPI slave controllers must set the SPI_MASTER_IS_SLAVE flag in
> spi_master.flags,
>   - The "cs-gpios" property is ignored,
>   - The bus is described in DT as having a single slave node, "reg" and
> "spi-max-frequency" properties are ignored.
> 
> From the point of view of an SPI slave protocol handler, an SPI slave
> controller looks exactly like an ordinary SPI master controller.

I think this needs a *bit* more fleshing out around cancellation of
transfers, the inability to remove any of the modules due to them being
blocked in SPI calls.  Probably just an API call that allows us to
inject a timeout/cancellation but I think it does need to be there and
used before we start getting bad practice propagating around.

I'm also wondering about supporting varible length transfers but that's
going to be rather controller specific I fear and I'm not sure there's
much demand.

Otherwise the basic idea looks OK.


signature.asc
Description: PGP signature


Re: Is this bug ? dev_set/get_drvdata() of rtd

2016-07-27 Thread Mark Brown
On Wed, Jul 27, 2016 at 03:25:41AM +, Kuninori Morimoto wrote:

> I think device data of "rtd->dev" is set as "rtd" on soc_post_component_init()
> by using dev_set_drvdata(),
> and many soc-core functions are based on it (= they are using 
> dev_get_drvdata())

> But, soc.h has snd_soc_pcm_set_drvdata(). 
> device data of rtd->dev will be overwrite by this function ?
> But is this OK ? or bug ?

Looks like a bug, I suspect there's some confusion caused by old code
expecting there to be a soc-card device there and getting confused.

> static ssize_t codec_reg_show(xxx)
> {
>   struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
>   ...
> }

We can probably kill this file now, everything is on regmap now.

> 
> static ssize_t pmdown_time_show(xxx)
> {
>   struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
>   ...
> }

These ones will need a bit more looking at, they probably want to be on
the card using the card device I think.


signature.asc
Description: PGP signature


Re: [alsa-devel] Question about struct snd_soc_dai() :: cpu_dai->codec

2016-07-27 Thread Mark Brown
On Wed, Jul 27, 2016 at 10:51:26PM +0530, Vinod Koul wrote:
> On Wed, Jul 27, 2016 at 07:57:05AM +0200, Takashi Iwai wrote:

> > For unloading the module, yes, it should have been prevented by
> > managing the module refcount.  However, unbinding can't be stopped by
> > that.  It's a known problem.

> Oh yes, unload is an issue. Are these any solutions to prevent this?

> In core, should we de-register the card if one of the components exits. The
> .remove should be called for the driver, thus triggering unregister?

That's the theory but it's full of holes at the minute.  Someone needs
to sit down and fix all the holes in there.


signature.asc
Description: PGP signature


Re: [alsa-devel] Question about struct snd_soc_dai() :: cpu_dai->codec

2016-07-27 Thread Mark Brown
On Wed, Jul 27, 2016 at 08:11:49PM +0200, Takashi Iwai wrote:

> I'm wondering whether it's a better option to block the unbind
> behavior, either in driver base (allowing to return an error) or in
> the sound side (waiting in remove() until the sane point). 

That's certainly going to be a lot easier and part of the reason it's
never been looked at much is that (unlike USB) there's very little
reason why an ASoC sound card would ever be hotplugged - even in
development these days the normal development flow involves rebooting.


signature.asc
Description: PGP signature


Applied "ASoC: rsnd: Fixup SRCm_IFSVR calculate method" to the asoc tree

2016-07-27 Thread Mark Brown
The patch

   ASoC: rsnd: Fixup SRCm_IFSVR calculate method

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 24e06559a8f52889b3dd581d2ddd572421a73ae0 Mon Sep 17 00:00:00 2001
From: Hiroyuki Yokoyama 
Date: Mon, 25 Jul 2016 01:52:43 +
Subject: [PATCH] ASoC: rsnd: Fixup SRCm_IFSVR calculate method

This patch fixes the calculation accuracy degradation of SRCm_IFSVR
register value.

Signed-off-by: Hiroyuki Yokoyama 
Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/sh/rcar/src.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index e39f916d0f2f..969a5169de25 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -226,8 +226,12 @@ static void rsnd_src_set_convert_rate(struct 
rsnd_dai_stream *io,
ifscr = 0;
fsrate = 0;
if (fin != fout) {
+   u64 n;
+
ifscr = 1;
-   fsrate = 0x040 / fout * fin;
+   n = (u64)0x040 * fin;
+   do_div(n, fout);
+   fsrate = n;
}
 
/*
-- 
2.8.1



Re: [alsa-devel] Question about struct snd_soc_dai() :: cpu_dai->codec

2016-07-28 Thread Mark Brown
On Thu, Jul 28, 2016 at 10:33:31PM +0200, Lars-Peter Clausen wrote:
> On 07/28/2016 05:46 AM, Vinod Koul wrote:

> > I agree, it makese no sense for devices to be hotplugged. And for
> > developement flows people can do rmmond and insmod. That works fine!

> I don't agree. In my opinion hot-plug is an essential feature of a
> modern device driver framework and if ASoC wants to claim to fall in
> this category we ought to support it. Hotplug is something that always
> pops up sooner or later. E.g. if someone puts a ASoC supported CODEC on
> a hot-pluggable device (maybe USB) we don't want to duplicate the code,
> but be able to reuse.

Right, so there's two bits to hotplug - there's hotplugging individual
components separately to the card and there's hotplugging cards en
masse including some of their components.  The latter case definitely
does make sense and should have a reasonable chance of working already.
Hotplugging individual components is much more of a nice to have, though
as you say if someone wants to implement it that's obviously not a
problem.


signature.asc
Description: PGP signature


Re: [alsa-devel] Question about struct snd_soc_dai() :: cpu_dai->codec

2016-07-29 Thread Mark Brown
On Fri, Jul 29, 2016 at 11:01:27AM +0200, Lars-Peter Clausen wrote:

> In my opinion the flags are just as much a hack as the pointer. In an ideal
> setup the component does not need to know what type it is. The reason why we
> need this in ASoC is because the framework has grown over time and we need
> to support legacy code.

Yes, the pointer is essentially already a flag - having a separate flag
really doesn't add a huge amount here.  What we need to do is get rid of
the need for the flag entirely.


signature.asc
Description: PGP signature


Re: Question about struct snd_soc_dai() :: cpu_dai->codec

2016-07-29 Thread Mark Brown
On Sat, Jul 30, 2016 at 06:45:04AM +0900, Takashi Sakamoto wrote:

> In a point of 'reuse of codes', I cannot imagine what Lars said for USB
> devices, then post the questions.

Someone might make a fancy device connected via USB which doesn't
conform to the USB specs.

> But I think it's logically difficult to manage state of sound card; e.g.
> disconnect. When one sound card instance consists of instances of
> several 'DAI', 'Codecs' and 'Components' (this 'component' is not in
> ALSA core contexts[1]) and we try to unload one of them, then which
> state the card should be assigned to? Or no 'Codecs' drivers are loaded,
> then which state should be assigned to the card?

The card only instantiates when all the components of the card are
present, until then it defers probe.

> Additionally, when old Codec driver is unloaded and new Codec driver is
> loaded, then what should we do for corresponding PCM character devices
> are? Currently, once snd_card_regsiter() is called, we cannot
> insert/delete ALSA components such like PCM.

The card should be deinstantiated and reinstantiated whenever a
component driver unbinds and rebinds (respectively).  You'd need to
completely deregister the card to change the list of things it's
expecting currently.


signature.asc
Description: PGP signature


Re: [PATCH 1/3] drm: bridge: add DesignWare HDMI I2S audio support

2016-08-01 Thread Mark Brown
On Mon, Aug 01, 2016 at 04:57:07AM +, Kuninori Morimoto wrote:

> Mark, Thierry, Daniel
> I wonder who can be maintainer for this patch ??

It's a DRM patch so I'd expect someone in the DRM subsystem.


signature.asc
Description: PGP signature


  1   2   3   4   5   6   >