Re: [PATCH v2 1/2] media: entity: Add pad_from_fwnode entity operation

2017-05-26 Thread Sakari Ailus
Hejssan,

On Wed, May 24, 2017 at 04:07:36PM +0200, Niklas Söderlund wrote:
> Hi Sakari,
> 
> Thanks for your feedback.
> 
> On 2017-05-24 16:21:37 +0300, Sakari Ailus wrote:
> > Hi Niklas,
> > 
> > On Wed, May 24, 2017 at 02:09:06AM +0200, Niklas Söderlund wrote:
> > > From: Niklas Söderlund 
> > > 
> > > The optional operation can be used by entities to report how it maps its
> > > fwnode endpoints to media pad numbers. This is useful for devices which
> > > require advanced mappings of pads.
> > > 
> > > Signed-off-by: Niklas Söderlund 
> > > ---
> > >  include/media/media-entity.h | 6 ++
> > >  1 file changed, 6 insertions(+)
> > > 
> > > diff --git a/include/media/media-entity.h b/include/media/media-entity.h
> > > index c7c254c5bca1761b..2aea22b0409d1070 100644
> > > --- a/include/media/media-entity.h
> > > +++ b/include/media/media-entity.h
> > > @@ -21,6 +21,7 @@
> > >  
> > >  #include 
> > >  #include 
> > > +#include 
> > >  #include 
> > >  #include 
> > >  #include 
> > > @@ -171,6 +172,9 @@ struct media_pad {
> > >  
> > >  /**
> > >   * struct media_entity_operations - Media entity operations
> > > + * @pad_from_fwnode: Return the pad number based on a fwnode 
> > > endpoint.
> > > + *   This operation can be used to map a fwnode to a
> > > + *   media pad number. Optional.
> > >   * @link_setup:  Notify the entity of link changes. The 
> > > operation can
> > >   *   return an error, in which case link setup will 
> > > be
> > >   *   cancelled. Optional.
> > > @@ -184,6 +188,8 @@ struct media_pad {
> > >   *mutex held.
> > >   */
> > >  struct media_entity_operations {
> > > + int (*pad_from_fwnode)(struct fwnode_endpoint *endpoint,
> > > +unsigned int *pad);
> > 
> > Hmm. How about calling this get_fwnode_pad for instance? I wonder what
> > others think.
> 
> I'm OK with this name change, will update for next version.
> 
> > 
> > You could just return the pad number still, and a negative value on error. I
> > think we won't have more than INT_MAX pads. :-)
> 
> I did that at first but then I remembered all the review comments I have 
> gotten earlier about using int as the type for pads :-) If you and 
> others agree in this case returning the pad as int or a negative value 
> as error I have no problem chaining this for the next version.

unsigned int was proposed for there was no need for negative values. In this
case there is.

I don't really have a strong opinion either way. I wonder what Hans or
Laurent thinks.

-- 
Regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk


Re: [PATCH v5 3/7] media: i2c: max2175: Add MAX2175 support

2017-05-26 Thread Sakari Ailus
On Fri, May 26, 2017 at 02:47:32PM +, Ramesh Shanmugasundaram wrote:
> Hi Sakari,
> 
> Thanks for the review comments on the patches. Sorry for the late response
> as I was caught up with another work.

No worries.

> 
> I will incorporate your comments and rebase it on top of your branch. I
> see it is not there in media-tree master yet. Please let me know if there
> is a change in plan.

I've sent a pull request to Mauro here and my expectation is it'll reach
media tree master in not too distant future:



-- 
Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk


Re: [PATCH 5/5] drm: dw-hdmi-i2s: add .get_dai_id callback for ALSA SoC

2017-05-26 Thread Mark Brown
On Wed, May 24, 2017 at 11:34:46PM +, Kuninori Morimoto wrote:

> > As far as I understand what's going on with the graph code this seems to
> > make sense to me.  How do we want to go about handling the patch?

> This is comment to me ? or DRM maintainer ?

> If to me, any case (pickup by Mark, or by DRM maintainer) is OK for me

The world in general - mainly the DRM people I guess.


signature.asc
Description: PGP signature


RE: [PATCH v5 3/7] media: i2c: max2175: Add MAX2175 support

2017-05-26 Thread Ramesh Shanmugasundaram
Hi Sakari,

Thanks for the review comments on the patches. Sorry for the late response as I 
was caught up with another work. 

I will incorporate your comments and rebase it on top of your branch. I see it 
is not there in media-tree master yet. Please let me know if there is a change 
in plan.

Thanks,
Ramesh

> Subject: Re: [PATCH v5 3/7] media: i2c: max2175: Add MAX2175 support
> 
> Hi Ramesh,
> 
> On Tue, May 09, 2017 at 02:37:34PM +0100, Ramesh Shanmugasundaram wrote:
> ...
> > +#include 
> > +#include 
> > +#include 
> 
> Could you rebase this on the V4L2 fwnode patchset here, please?
> 
> 
> 
> It depends on other patches which will reach media-tree master in next
> rc1, for now I've merged them here:
> 
> 
> 
> I'll send a pull request for media-tree once we have 4.12rc1 in media-tree
> master.
> 
> Thanks.
> 
> --
> Kind regards,
> 
> Sakari Ailus
> e-mail: sakari.ai...@iki.fi   XMPP: sai...@retiisi.org.uk


Applied "spi: sh-msiof: Add slave mode support" to the spi tree

2017-05-26 Thread Mark Brown
The patch

   spi: sh-msiof: Add slave mode support

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 cf9e4784f3bde3e4749163384f27450ddffe746c Mon Sep 17 00:00:00 2001
From: Hisashi Nakamura 
Date: Mon, 22 May 2017 15:11:43 +0200
Subject: [PATCH] spi: sh-msiof: Add slave mode support

Add slave mode support to the MSIOF driver, in both PIO and DMA mode.

For now this only supports the transmission of messages with a size
that is known in advance.

Signed-off-by: Hisashi Nakamura 
Signed-off-by: Hiromitsu Yamasaki 
[geert: Timeout handling cleanup, spi core integration, cancellation,
rewording]
Signed-off-by: Geert Uytterhoeven 
Acked-by: Rob Herring 
Signed-off-by: Mark Brown 
---
 Documentation/devicetree/bindings/spi/sh-msiof.txt |   2 +
 drivers/spi/spi-sh-msiof.c | 111 +++--
 include/linux/spi/sh_msiof.h   |   6 ++
 3 files changed, 86 insertions(+), 33 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/sh-msiof.txt 
b/Documentation/devicetree/bindings/spi/sh-msiof.txt
index dc975064fa27..64ee489571c4 100644
--- a/Documentation/devicetree/bindings/spi/sh-msiof.txt
+++ b/Documentation/devicetree/bindings/spi/sh-msiof.txt
@@ -38,6 +38,8 @@ Optional properties:
 specifiers, one for transmission, and one for
 reception.
 - dma-names: Must contain a list of two DMA names, "tx" and "rx".
+- spi-slave: Empty property indicating the SPI controller is used
+in slave mode.
 - renesas,dtdl : delay sync signal (setup) in transmit mode.
 Must contain one of the following values:
 0   (no bit delay)
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index 2ce15ca97782..c304c7167866 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -2,7 +2,8 @@
  * SuperH MSIOF SPI Master Interface
  *
  * Copyright (c) 2009 Magnus Damm
- * Copyright (C) 2014 Glider bvba
+ * Copyright (C) 2014 Renesas Electronics Corporation
+ * Copyright (C) 2014-2017 Glider bvba
  *
  * 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
@@ -33,7 +34,6 @@
 
 #include 
 
-
 struct sh_msiof_chipdata {
u16 tx_fifo_size;
u16 rx_fifo_size;
@@ -53,6 +53,7 @@ struct sh_msiof_spi_priv {
void *rx_dma_page;
dma_addr_t tx_dma_addr;
dma_addr_t rx_dma_addr;
+   bool slave_aborted;
 };
 
 #define TMDR1  0x00/* Transmit Mode Register 1 */
@@ -337,7 +338,10 @@ static void sh_msiof_spi_set_pin_regs(struct 
sh_msiof_spi_priv *p,
tmp |= !cs_high << MDR1_SYNCAC_SHIFT;
tmp |= lsb_first << MDR1_BITLSB_SHIFT;
tmp |= sh_msiof_spi_get_dtdl_and_syncdl(p);
-   sh_msiof_write(p, TMDR1, tmp | MDR1_TRMD | TMDR1_PCON);
+   if (spi_controller_is_slave(p->master))
+   sh_msiof_write(p, TMDR1, tmp | TMDR1_PCON);
+   else
+   sh_msiof_write(p, TMDR1, tmp | MDR1_TRMD | TMDR1_PCON);
if (p->master->flags & SPI_MASTER_MUST_TX) {
/* These bits are reserved if RX needs TX */
tmp &= ~0x;
@@ -564,17 +568,19 @@ static int sh_msiof_prepare_message(struct spi_master 
*master,
 
 static int sh_msiof_spi_start(struct sh_msiof_spi_priv *p, void *rx_buf)
 {
-   int ret;
+   bool slave = spi_controller_is_slave(p->master);
+   int ret = 0;
 
/* setup clock and rx/tx signals */
-   ret = sh_msiof_modify_ctr_wait(p, 0, CTR_TSCKE);
+   if (!slave)
+   ret = sh_msiof_modify_ctr_wait(p, 0, CTR_TSCKE);
if (rx_buf && !ret)
ret = sh_msiof_modify_ctr_wait(p, 0, CTR_RXE);
if (!ret)
ret = sh_msiof_modify_ctr_wait(p, 0, CTR_TXE);
 
/* start by setting frame bit */
-   if (!ret)
+   if (!ret && !slave)
ret = 

Applied "spi: slave: Add SPI slave handler controlling system state" to the spi tree

2017-05-26 Thread Mark Brown
The patch

   spi: slave: Add SPI slave handler controlling system state

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 ce70e06c093a9609377e93ee20e7c528e156af14 Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven 
Date: Mon, 22 May 2017 15:11:45 +0200
Subject: [PATCH] spi: slave: Add SPI slave handler controlling system state

Add an example SPI slave handler to allow remote control of system
reboot, power off, halt, and suspend.

Signed-off-by: Geert Uytterhoeven 
Reviewed-by: Andy Shevchenko 
Signed-off-by: Mark Brown 
---
 drivers/spi/Kconfig|   6 ++
 drivers/spi/Makefile   |   1 +
 drivers/spi/spi-slave-system-control.c | 154 +
 3 files changed, 161 insertions(+)
 create mode 100644 drivers/spi/spi-slave-system-control.c

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index ade542c5bfd8..e6d9e329a380 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -802,6 +802,12 @@ config SPI_SLAVE_TIME
  SPI slave handler responding with the time of reception of the last
  SPI message.
 
+config SPI_SLAVE_SYSTEM_CONTROL
+   tristate "SPI slave handler controlling system state"
+   help
+ SPI slave handler to allow remote control of system reboot, power
+ off, halt, and suspend.
+
 endif # SPI_SLAVE
 
 endif # SPI
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index fb078693dbe4..1d7923e8c63b 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -108,3 +108,4 @@ obj-$(CONFIG_SPI_ZYNQMP_GQSPI)  += 
spi-zynqmp-gqspi.o
 
 # SPI slave protocol handlers
 obj-$(CONFIG_SPI_SLAVE_TIME)   += spi-slave-time.o
+obj-$(CONFIG_SPI_SLAVE_SYSTEM_CONTROL) += spi-slave-system-control.o
diff --git a/drivers/spi/spi-slave-system-control.c 
b/drivers/spi/spi-slave-system-control.c
new file mode 100644
index ..c0257e937995
--- /dev/null
+++ b/drivers/spi/spi-slave-system-control.c
@@ -0,0 +1,154 @@
+/*
+ * SPI slave handler controlling system state
+ *
+ * This SPI slave handler allows remote control of system reboot, power off,
+ * halt, and suspend.
+ *
+ * Copyright (C) 2016-2017 Glider bvba
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Usage (assuming /dev/spidev2.0 corresponds to the SPI master on the remote
+ * system):
+ *
+ *   # reboot='\x7c\x50'
+ *   # poweroff='\x71\x3f'
+ *   # halt='\x38\x76'
+ *   # suspend='\x1b\x1b'
+ *   # spidev_test -D /dev/spidev2.0 -p $suspend # or $reboot, $poweroff, $halt
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * The numbers are chosen to display something human-readable on two 7-segment
+ * displays connected to two 74HC595 shift registers
+ */
+#define CMD_REBOOT 0x7c50  /* rb */
+#define CMD_POWEROFF   0x713f  /* OF */
+#define CMD_HALT   0x3876  /* HL */
+#define CMD_SUSPEND0x1b1b  /* ZZ */
+
+struct spi_slave_system_control_priv {
+   struct spi_device *spi;
+   struct completion finished;
+   struct spi_transfer xfer;
+   struct spi_message msg;
+   __be16 cmd;
+};
+
+static
+int spi_slave_system_control_submit(struct spi_slave_system_control_priv 
*priv);
+
+static void spi_slave_system_control_complete(void *arg)
+{
+   struct spi_slave_system_control_priv *priv = arg;
+   u16 cmd;
+   int ret;
+
+   if (priv->msg.status)
+   goto terminate;
+
+   cmd = be16_to_cpu(priv->cmd);
+   switch (cmd) {
+   case CMD_REBOOT:
+   dev_info(>spi->dev, "Rebooting system...\n");
+   kernel_restart(NULL);
+
+   case CMD_POWEROFF:
+   dev_info(>spi->dev, "Powering off system...\n");
+   kernel_power_off();
+   break;
+
+   case CMD_HALT:
+   dev_info(>spi->dev, "Halting system...\n");
+   kernel_halt();
+   break;
+
+   case CMD_SUSPEND:
+   dev_info(>spi->dev, 

Applied "spi: Document SPI slave controller support" to the spi tree

2017-05-26 Thread Mark Brown
The patch

   spi: Document SPI slave controller support

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 aa2ea9115bc3f0735aa65b833076cc5fe3da1489 Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven 
Date: Mon, 22 May 2017 15:11:42 +0200
Subject: [PATCH] spi: Document SPI slave controller support

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Mark Brown 
---
 Documentation/spi/spi-summary | 27 ---
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/Documentation/spi/spi-summary b/Documentation/spi/spi-summary
index d1824b399b2d..1721c1b570c3 100644
--- a/Documentation/spi/spi-summary
+++ b/Documentation/spi/spi-summary
@@ -62,8 +62,8 @@ chips described as using "three wire" signaling: SCK, data, 
nCSx.
 (That data line is sometimes called MOMI or SISO.)
 
 Microcontrollers often support both master and slave sides of the SPI
-protocol.  This document (and Linux) currently only supports the master
-side of SPI interactions.
+protocol.  This document (and Linux) supports both the master and slave
+sides of SPI interactions.
 
 
 Who uses it?  On what kinds of systems?
@@ -154,9 +154,8 @@ control audio interfaces, present touchscreen sensors as 
input interfaces,
 or monitor temperature and voltage levels during industrial processing.
 And those might all be sharing the same controller driver.
 
-A "struct spi_device" encapsulates the master-side interface between
-those two types of driver.  At this writing, Linux has no slave side
-programming interface.
+A "struct spi_device" encapsulates the controller-side interface between
+those two types of drivers.
 
 There is a minimal core of SPI programming interfaces, focussing on
 using the driver model to connect controller and protocol drivers using
@@ -177,10 +176,24 @@ shows up in sysfs in several locations:
/sys/bus/spi/drivers/D ... driver for one or more spi*.* devices
 
/sys/class/spi_master/spiB ... symlink (or actual device node) to
-   a logical node which could hold class related state for the
-   controller managing bus "B".  All spiB.* devices share one
+   a logical node which could hold class related state for the SPI
+   master controller managing bus "B".  All spiB.* devices share one
physical SPI bus segment, with SCLK, MOSI, and MISO.
 
+   /sys/devices/.../CTLR/slave ... virtual file for (un)registering the
+   slave device for an SPI slave controller.
+   Writing the driver name of an SPI slave handler to this file
+   registers the slave device; writing "(null)" unregisters the slave
+   device.
+   Reading from this file shows the name of the slave device ("(null)"
+   if not registered).
+
+   /sys/class/spi_slave/spiB ... symlink (or actual device node) to
+   a logical node which could hold class related state for the SPI
+   slave controller on bus "B".  When registered, a single spiB.*
+   device is present here, possible sharing the physical SPI bus
+   segment with other SPI slave devices.
+
 Note that the actual location of the controller's class state depends
 on whether you enabled CONFIG_SYSFS_DEPRECATED or not.  At this time,
 the only class-specific state is the bus number ("B" in "spiB"), so
-- 
2.11.0



Applied "spi: Document DT bindings for SPI controllers in slave mode" to the spi tree

2017-05-26 Thread Mark Brown
The patch

   spi: Document DT bindings for SPI controllers in slave mode

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 a8830cb19cfea04edb0381b52fd90eec44986eb9 Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven 
Date: Mon, 22 May 2017 15:11:40 +0200
Subject: [PATCH] spi: Document DT bindings for SPI controllers in slave mode

Signed-off-by: Geert Uytterhoeven 
Reviewed-by: Rob Herring 
Signed-off-by: Mark Brown 
---
 Documentation/devicetree/bindings/spi/spi-bus.txt | 76 ++-
 1 file changed, 45 insertions(+), 31 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt 
b/Documentation/devicetree/bindings/spi/spi-bus.txt
index 4b1d6e74c744..1f6e86f787ef 100644
--- a/Documentation/devicetree/bindings/spi/spi-bus.txt
+++ b/Documentation/devicetree/bindings/spi/spi-bus.txt
@@ -1,17 +1,23 @@
 SPI (Serial Peripheral Interface) busses
 
-SPI busses can be described with a node for the SPI master device
-and a set of child nodes for each SPI slave on the bus.  For this
-discussion, it is assumed that the system's SPI controller is in
-SPI master mode.  This binding does not describe SPI controllers
-in slave mode.
+SPI busses can be described with a node for the SPI controller device
+and a set of child nodes for each SPI slave on the bus.  The system's SPI
+controller may be described for use in SPI master mode or in SPI slave mode,
+but not for both at the same time.
 
-The SPI master node requires the following properties:
+The SPI controller node requires the following properties:
+- compatible  - Name of SPI bus controller following generic names
+   recommended practice.
+
+In master mode, the SPI controller node requires the following additional
+properties:
 - #address-cells  - number of cells required to define a chip select
address on the SPI bus.
 - #size-cells - should be zero.
-- compatible  - name of SPI bus controller following generic names
-   recommended practice.
+
+In slave mode, the SPI controller node requires one additional property:
+- spi-slave   - Empty property.
+
 No other properties are required in the SPI bus node.  It is assumed
 that a driver for an SPI bus device will understand that it is an SPI bus.
 However, the binding does not attempt to define the specific method for
@@ -21,7 +27,7 @@ assumption that board specific platform code will be used to 
manage
 chip selects.  Individual drivers can define additional properties to
 support describing the chip select layout.
 
-Optional properties:
+Optional properties (master mode only):
 - cs-gpios   - gpios chip select.
 - num-cs - total number of chipselects.
 
@@ -41,28 +47,36 @@ cs1 : native
 cs2 :  1 0
 cs3 :  2 0
 
-SPI slave nodes must be children of the SPI master node and can
-contain the following properties.
-- reg - (required) chip select address of device.
-- compatible  - (required) name of SPI device following generic names
-   recommended practice.
-- spi-max-frequency - (required) Maximum SPI clocking speed of device in Hz.
-- spi-cpol- (optional) Empty property indicating device requires
-   inverse clock polarity (CPOL) mode.
-- spi-cpha- (optional) Empty property indicating device requires
-   shifted clock phase (CPHA) mode.
-- spi-cs-high - (optional) Empty property indicating device requires
-   chip select active high.
-- spi-3wire   - (optional) Empty property indicating device requires
-   3-wire mode.
-- spi-lsb-first   - (optional) Empty property indicating device requires
-   LSB first mode.
-- spi-tx-bus-width - (optional) The bus width (number of data wires) that is
-  used for MOSI. Defaults to 1 if not present.
-- spi-rx-bus-width - (optional) The bus width (number of data wires) that is
-  used for MISO. Defaults to 1 if not present.
-- spi-rx-delay-us  - (optional) Microsecond delay after a read transfer.
-- spi-tx-delay-us  - (optional) 

Applied "spi: core: Add support for registering SPI slave controllers" to the spi tree

2017-05-26 Thread Mark Brown
The patch

   spi: core: Add support for registering SPI slave controllers

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 6c364062bfed3c34490e85bea52ff6e2d4f0f281 Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven 
Date: Mon, 22 May 2017 15:11:41 +0200
Subject: [PATCH] spi: core: Add support for registering SPI slave controllers

Add support for registering SPI slave controllers using the existing SPI
master framework:
  - SPI slave controllers must use spi_alloc_slave() instead of
spi_alloc_master(), and should provide an additional callback
"slave_abort" to abort an ongoing SPI transfer request,
  - SPI slave controllers are added to a new "spi_slave" device class,
  - SPI slave handlers can be bound to the SPI slave device represented
by an SPI slave controller using a DT child node named "slave",
  - Alternatively, (un)binding an SPI slave handler to the SPI slave
device represented by an SPI slave controller can be done by
(un)registering the slave device through a sysfs virtual file named
"slave".

>From the point of view of an SPI slave protocol handler, an SPI slave
controller looks almost like an ordinary SPI master controller. The only
exception is that a transfer request will block on the remote SPI
master, and may be cancelled using spi_slave_abort().

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Mark Brown 
---
 drivers/spi/Kconfig |  14 +++-
 drivers/spi/Makefile|   2 +
 drivers/spi/spi.c   | 179 +---
 include/linux/spi/spi.h |  35 --
 4 files changed, 201 insertions(+), 29 deletions(-)

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 1761c9004fc1..df8ddec24b5d 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -784,6 +784,18 @@ config SPI_TLE62X0
 
 endif # SPI_MASTER
 
-# (slave support would go here)
+#
+# SLAVE side ... listening to other SPI masters
+#
+
+config SPI_SLAVE
+   bool "SPI slave protocol handlers"
+   help
+ If your system has a slave-capable SPI controller, you can enable
+ slave protocol handlers.
+
+if SPI_SLAVE
+
+endif # SPI_SLAVE
 
 endif # SPI
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index b375a7a89216..e50852c6fcb8 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -105,3 +105,5 @@ obj-$(CONFIG_SPI_XILINX)+= spi-xilinx.o
 obj-$(CONFIG_SPI_XLP)  += spi-xlp.o
 obj-$(CONFIG_SPI_XTENSA_XTFPGA)+= spi-xtensa-xtfpga.o
 obj-$(CONFIG_SPI_ZYNQMP_GQSPI) += spi-zynqmp-gqspi.o
+
+# SPI slave protocol handlers
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 89254a55eb2e..6a8280bdc7a8 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1535,15 +1535,6 @@ static int of_spi_parse_dt(struct spi_master *master, 
struct spi_device *spi,
u32 value;
int rc;
 
-   /* Device address */
-   rc = of_property_read_u32(nc, "reg", );
-   if (rc) {
-   dev_err(>dev, "%s has no valid 'reg' property (%d)\n",
-   nc->full_name, rc);
-   return rc;
-   }
-   spi->chip_select = value;
-
/* Mode (clock phase/polarity/etc.) */
if (of_find_property(nc, "spi-cpha", NULL))
spi->mode |= SPI_CPHA;
@@ -1593,6 +1584,24 @@ static int of_spi_parse_dt(struct spi_master *master, 
struct spi_device *spi,
}
}
 
+   if (spi_controller_is_slave(master)) {
+   if (strcmp(nc->name, "slave")) {
+   dev_err(>dev, "%s is not called 'slave'\n",
+   nc->full_name);
+   return -EINVAL;
+   }
+   return 0;
+   }
+
+   /* Device address */
+   rc = of_property_read_u32(nc, "reg", );
+   if (rc) {
+   dev_err(>dev, "%s has no valid 'reg' property (%d)\n",
+   nc->full_name, rc);
+   return rc;
+   }
+   spi->chip_select = value;
+
/* Device speed */
rc = of_property_read_u32(nc, 

Applied "spi: slave: Add SPI slave handler reporting uptime at previous message" to the spi tree

2017-05-26 Thread Mark Brown
The patch

   spi: slave: Add SPI slave handler reporting uptime at previous 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 29f9ffa0e1f9a17c866c04a01acfc9976d78f29a Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven 
Date: Mon, 22 May 2017 15:11:44 +0200
Subject: [PATCH] spi: slave: Add SPI slave handler reporting uptime at
 previous message

Add an example SPI slave handler responding with the uptime at the time
of reception of the last SPI message.

This can be used by an external microcontroller as a dead man's switch.

Signed-off-by: Geert Uytterhoeven 
Reviewed-by: Andy Shevchenko 
Signed-off-by: Mark Brown 
---
 drivers/spi/Kconfig  |   6 ++
 drivers/spi/Makefile |   1 +
 drivers/spi/spi-slave-time.c | 129 +++
 3 files changed, 136 insertions(+)
 create mode 100644 drivers/spi/spi-slave-time.c

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index df8ddec24b5d..ade542c5bfd8 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -796,6 +796,12 @@ config SPI_SLAVE
 
 if SPI_SLAVE
 
+config SPI_SLAVE_TIME
+   tristate "SPI slave handler reporting boot up time"
+   help
+ SPI slave handler responding with the time of reception of the last
+ SPI message.
+
 endif # SPI_SLAVE
 
 endif # SPI
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index e50852c6fcb8..fb078693dbe4 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -107,3 +107,4 @@ obj-$(CONFIG_SPI_XTENSA_XTFPGA) += 
spi-xtensa-xtfpga.o
 obj-$(CONFIG_SPI_ZYNQMP_GQSPI) += spi-zynqmp-gqspi.o
 
 # SPI slave protocol handlers
+obj-$(CONFIG_SPI_SLAVE_TIME)   += spi-slave-time.o
diff --git a/drivers/spi/spi-slave-time.c b/drivers/spi/spi-slave-time.c
new file mode 100644
index ..f2e07a392d68
--- /dev/null
+++ b/drivers/spi/spi-slave-time.c
@@ -0,0 +1,129 @@
+/*
+ * SPI slave handler reporting uptime at reception of previous SPI message
+ *
+ * This SPI slave handler sends the time of reception of the last SPI message
+ * as two 32-bit unsigned integers in binary format and in network byte order,
+ * representing the number of seconds and fractional seconds (in microseconds)
+ * since boot up.
+ *
+ * Copyright (C) 2016-2017 Glider bvba
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Usage (assuming /dev/spidev2.0 corresponds to the SPI master on the remote
+ * system):
+ *
+ *   # spidev_test -D /dev/spidev2.0 -p dummy-8B
+ *   spi mode: 0x0
+ *   bits per word: 8
+ *   max speed: 50 Hz (500 KHz)
+ *   RX | 00 00 04 6D 00 09 5B BB ...
+ * ^
+ * seconds  microseconds
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+
+struct spi_slave_time_priv {
+   struct spi_device *spi;
+   struct completion finished;
+   struct spi_transfer xfer;
+   struct spi_message msg;
+   __be32 buf[2];
+};
+
+static int spi_slave_time_submit(struct spi_slave_time_priv *priv);
+
+static void spi_slave_time_complete(void *arg)
+{
+   struct spi_slave_time_priv *priv = arg;
+   int ret;
+
+   ret = priv->msg.status;
+   if (ret)
+   goto terminate;
+
+   ret = spi_slave_time_submit(priv);
+   if (ret)
+   goto terminate;
+
+   return;
+
+terminate:
+   dev_info(>spi->dev, "Terminating\n");
+   complete(>finished);
+}
+
+static int spi_slave_time_submit(struct spi_slave_time_priv *priv)
+{
+   u32 rem_us;
+   int ret;
+   u64 ts;
+
+   ts = local_clock();
+   rem_us = do_div(ts, 10) / 1000;
+
+   priv->buf[0] = cpu_to_be32(ts);
+   priv->buf[1] = cpu_to_be32(rem_us);
+
+   spi_message_init_with_transfers(>msg, >xfer, 1);
+
+   priv->msg.complete = spi_slave_time_complete;
+   priv->msg.context = priv;
+
+   ret = spi_async(priv->spi, >msg);
+   if (ret)
+   dev_err(>spi->dev, 

Applied "ASoC: rsnd: fixup parent_clk_name of AUDIO_CLKOUTx" to the asoc tree

2017-05-26 Thread Mark Brown
The patch

   ASoC: rsnd: fixup parent_clk_name of AUDIO_CLKOUTx

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 e8a3ce1130134046e9da132aa4d043566df8237d Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Fri, 26 May 2017 01:44:19 +
Subject: [PATCH] ASoC: rsnd: fixup parent_clk_name of AUDIO_CLKOUTx

commit 25165f79adc7 ("ASoC: rsnd: enable clock-frequency for both
44.1kHz/48kHz") supported both 44.1kHz/48kHz for AUDIO_CLKOUTx,
but it didn't care its parent clock name.
This patch fixes it.

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

diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c
index 66203d107a11..d3b0dc145a56 100644
--- a/sound/soc/sh/rcar/adg.c
+++ b/sound/soc/sh/rcar/adg.c
@@ -507,7 +507,8 @@ static void rsnd_adg_get_clkout(struct rsnd_priv *priv,
rbga = rbgx;
adg->rbga_rate_for_441khz = rate / div;
ckr |= brg_table[i] << 20;
-   if (req_441kHz_rate)
+   if (req_441kHz_rate &&
+   !(adg_mode_flags(adg) & AUDIO_OUT_48))
parent_clk_name = __clk_get_name(clk);
}
}
@@ -522,7 +523,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 &&
+   (adg_mode_flags(adg) & AUDIO_OUT_48))
parent_clk_name = __clk_get_name(clk);
}
}
-- 
2.11.0



Applied "ASoC: simple-card-utils: remove strict limitation of bit/frame master" to the asoc tree

2017-05-26 Thread Mark Brown
The patch

   ASoC: simple-card-utils: remove strict limitation of bit/frame master

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 155b8f3aa633dbce887cded6b6b9399a3c62683e Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto 
Date: Thu, 25 May 2017 01:51:31 +
Subject: [PATCH] ASoC: simple-card-utils: remove strict limitation of
 bit/frame master

Current asoc_simple_card_parse_daifmt is keeping backward compatibility
for bitmaster/framemaster which didn't use phandle.
The keep compatibility, it is checking prefix length, but it is
too strict. let's loosen it. Otherwise, OF-graph base sound card
which doesn't have prefix can't detect daifmt.

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

diff --git a/sound/soc/generic/simple-card-utils.c 
b/sound/soc/generic/simple-card-utils.c
index fe726e83d0bd..9c7f5b91b90a 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -21,14 +21,13 @@ int asoc_simple_card_parse_daifmt(struct device *dev,
 {
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,
 , );
daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
 
-   if (prefix_len && !bitclkmaster && !framemaster) {
+   if (!bitclkmaster && !framemaster) {
/*
 * No dai-link level and master setting was not found from
 * sound node level, revert back to legacy DT parsing and
-- 
2.11.0



Re: [PATCH 0/2] arm64: renesas: add 12288000 for sound ADG

2017-05-26 Thread Simon Horman
On Wed, May 24, 2017 at 02:14:52AM +, Kuninori Morimoto wrote:
> 
> Hi Simon
> 
> These adds missing audio clock settings to salvator / ulcb
> 
> Kuninori Morimoto (2):
>   arm64: renesas: salvator-x: add 12288000 for sound ADG
>   arm64: renesas: ulcb: add 12288000 for sound ADG

Thanks, I have queued these up for v4.13.
If you'd like them considered for -stable then let me know
and we can try and work something out.


Re: [PATCH] arm: dts: r7s72100: Add support for GR-Peach

2017-05-26 Thread Simon Horman
On Wed, May 24, 2017 at 09:07:02AM +0200, jmondi wrote:
> Hello Simon,
> 
> On Tue, May 23, 2017 at 09:25:40PM +0200, Geert Uytterhoeven wrote:
> > On Tue, May 23, 2017 at 9:20 PM, Jacopo Mondi  
> > wrote:
> > > Add device tree source for Renesas GR-Peach board.
> > > GR-Peach is an RZ/A1H based board with 10MB of on-chip SRAM and 8MB
> > > QSPI flash storage.
> > > Add support for the board, and create a 2MB partition to use as rootfs.
> > >
> > > Signed-off-by: Jacopo Mondi 
> >
> > Reviewed-by: Geert Uytterhoeven 
> 
> I forgot to change subject to "PATCH v2".
> Could you please take this one, or would you like me to resend with
> Geert's reviewed-by ?

No need to repost, I've queued-up this version for v4.13.


Re: [PATCH v3 0/4] r8a7793 Gose video input support

2017-05-26 Thread Simon Horman
On Fri, May 19, 2017 at 03:07:00PM +0200, Ulrich Hecht wrote:
> Hi!
> 
> This is a by-the-datasheet implementation of analog and digital video input
> on the Gose board.
> 
> This revision adds new bindings that distinguish between ADV7180 variants
> with three and six input ports. There are numerous variants of this chip,
> but since all that have "CP" in their names have three inputs, and all that
> have "ST" have six, I have limited myself to two new compatible strings,
> "adv7180cp" and "adv7180st".
> 
> The digital input patch has received minor tweaks of the port names for
> consistency, and the Gose analog input patch has been modified to use the
> new bindings, and a composite video connector has been added.
> 
> CU
> Uli
> 
> 
> Changes since v2:
> - hdmi: port hdmi_con renamed to hdmi_con_out
> - adv7180: added new compatibility strings and bindings
> - composite: added connector, use new bindings
> 
> Changes since v1:
> - r8a7793.dtsi: added VIN2
> - modeled HDMI decoder input/output and connector
> - added "renesas,rcar-gen2-vin" compat strings
> - removed unnecessary "remote" node and aliases
> - set ADV7612 interrupt to GP4_2
> 
> 
> Ulrich Hecht (4):
>   ARM: dts: gose: add HDMI input

I have queued-up the above patch for v4.13.

>   media: adv7180: add adv7180cp, adv7180st compatible strings
>   media: adv7180: Add adv7180cp, adv7180st bindings
>   ARM: dts: gose: add composite video input

I have marked the above dts patch as "deferred" pending acceptance
of the binding. Please repost or otherwise ping me once that has happened.

>  .../devicetree/bindings/media/i2c/adv7180.txt  |  15 +++
>  arch/arm/boot/dts/r8a7793-gose.dts | 127 
> -
>  drivers/media/i2c/adv7180.c|   2 +
>  3 files changed, 142 insertions(+), 2 deletions(-)
> 
> -- 
> 2.7.4
>