Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 3/8] PM / Domains: Allow domain power states to be read from DT
From: Ulf Hansson @ 2016-10-10 10:01 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1475879821-8035-4-git-send-email-lina.iyer@linaro.org>

On 8 October 2016 at 00:36, Lina Iyer <lina.iyer@linaro.org> wrote:
> This patch allows domains to define idle states in the DT. SoC's can
> define domain idle states in DT using the "domain-idle-states" property
> of the domain provider. Add API to read the idle states from DT that can
> be set in the genpd object.
>
> This patch is based on the original patch by Marc Titinger.
>
> Signed-off-by: Marc Titinger <mtitinger+renesas@baylibre.com>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> Signed-off-by: Lina Iyer <lina.iyer@linaro.org>
> ---
>  drivers/base/power/domain.c | 95 +++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/pm_domain.h   |  8 ++++
>  2 files changed, 103 insertions(+)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 4e87170..4208b67 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -1917,6 +1917,101 @@ out:
>         return ret ? -EPROBE_DEFER : 0;
>  }
>  EXPORT_SYMBOL_GPL(genpd_dev_pm_attach);
> +
> +static const struct of_device_id idle_state_match[] = {
> +       { .compatible = "arm,idle-state", },
> +       { }
> +};
> +
> +static int genpd_parse_state(struct genpd_power_state *genpd_state,
> +                                   struct device_node *state_node)
> +{
> +       int err;
> +       u32 residency;
> +       u32 entry_latency, exit_latency;
> +       const struct of_device_id *match_id;
> +
> +       match_id = of_match_node(idle_state_match, state_node);
> +       if (!match_id)
> +               return -EINVAL;
> +
> +       err = of_property_read_u32(state_node, "entry-latency-us",
> +                                               &entry_latency);
> +       if (err) {
> +               pr_debug(" * %s missing entry-latency-us property\n",
> +                                               state_node->full_name);
> +               return -EINVAL;
> +       }
> +
> +       err = of_property_read_u32(state_node, "exit-latency-us",
> +                                               &exit_latency);
> +       if (err) {
> +               pr_debug(" * %s missing exit-latency-us property\n",
> +                                               state_node->full_name);
> +               return -EINVAL;
> +       }
> +
> +       err = of_property_read_u32(state_node, "min-residency-us", &residency);
> +       if (!err)
> +               genpd_state->residency_ns = 1000 * residency;
> +
> +       genpd_state->power_on_latency_ns = 1000 * exit_latency;
> +       genpd_state->power_off_latency_ns = 1000 * entry_latency;
> +
> +       return 0;
> +}
> +
> +/**
> + * of_genpd_parse_idle_states: Return array of idle states for the genpd.
> + *
> + * @dn: The genpd device node
> + * @states: The pointer to which the state array will be saved.
> + * @n: The count of elements in the array returned from this function.
> + *
> + * Returns the device states parsed from the OF node. The memory for the states
> + * is allocated by this function and is the responsibility of the caller to
> + * free the memory after use.
> + */
> +int of_genpd_parse_idle_states(struct device_node *dn,
> +                       struct genpd_power_state **states, int *n)

Instead of taking **states as a parameter, let's instead return it as
a pointer for the allocated struct. In case of failures, let's return
ERR_PTR().

> +{
> +       struct genpd_power_state *st;
> +       struct device_node *np;
> +       int i = 0;
> +       int err, ret;
> +       int count;
> +       struct of_phandle_iterator it;
> +
> +       count = of_count_phandle_with_args(dn, "domain-idle-states", NULL);

If count is zero or an error, we should return an error code (ERR_PTR()). Right?

> +
> +       st = kcalloc(count, sizeof(*st), GFP_KERNEL);
> +       if (!st)
> +               return -ENOMEM;
> +
> +       /* Loop over the phandles until all the requested entry is found */
> +       of_for_each_phandle(&it, err, dn, "domain-idle-states", NULL, 0) {
> +               np = of_node_get(it.node);

I don't think you need to increment the usage count for the device
node as that is already managed by of_for_each_phandle().

It's only in the error case below, when it's needed.

> +               ret = genpd_parse_state(&st[i++], np);
> +               if (ret) {
> +                       pr_err
> +                       ("Parsing idle state node %s failed with err %d\n",
> +                                                       np->full_name, ret);
> +                       of_node_put(np);
> +                       goto fail;

The goto seems unnecessary. Why not deal with all error handling here
and return the error code?

> +               }
> +               of_node_put(np);

According the comment above, you should be able to remove this.

> +       }
> +
> +       *n = count;
> +       *states = st;
> +
> +       return 0;
> +fail:
> +       kfree(st);
> +       return ret;
> +}
> +EXPORT_SYMBOL(of_genpd_parse_idle_states);

Please use EXPORT_SYMBOL_GPL() instead.

> +
>  #endif /* CONFIG_PM_GENERIC_DOMAINS_OF */
>
>
> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
> index f4492eb..b489496 100644
> --- a/include/linux/pm_domain.h
> +++ b/include/linux/pm_domain.h
> @@ -205,6 +205,8 @@ extern int of_genpd_add_device(struct of_phandle_args *args,
>  extern int of_genpd_add_subdomain(struct of_phandle_args *parent,
>                                   struct of_phandle_args *new_subdomain);
>  extern struct generic_pm_domain *of_genpd_remove_last(struct device_node *np);
> +extern int of_genpd_parse_idle_states(struct device_node *dn,
> +                       struct genpd_power_state **states, int *n);
>
>  int genpd_dev_pm_attach(struct device *dev);
>  #else /* !CONFIG_PM_GENERIC_DOMAINS_OF */
> @@ -234,6 +236,12 @@ static inline int of_genpd_add_subdomain(struct of_phandle_args *parent,
>         return -ENODEV;
>  }
>
> +static inline int of_genpd_parse_idle_states(struct device_node *dn,
> +                       struct genpd_power_state **states, int *n)
> +{
> +       return -ENODEV;
> +}
> +
>  static inline int genpd_dev_pm_attach(struct device *dev)
>  {
>         return -ENODEV;
> --
> 2.7.4
>

Kind regards
Uffe

^ permalink raw reply

* [PATCH v1 1/2] ARM: dts: add rockchip PX3 Evaluation board
From: Heiko Stuebner @ 2016-10-10  9:54 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <64f4be31-1b19-60e3-da7c-f2fec186fab9@suse.de>

Hi Andreas, Andy,

Am Dienstag, 13. September 2016, 14:14:01 CEST schrieb Andreas F?rber:
> Hi Andy,
> 
> This patch didn't make it to linux-rockchip list somehow...
> Not sure why I'm CC'ed, I don't have access to such a board to check, so
> just a couple formal nitpicks:
> 
> Am 10.09.2016 um 19:44 schrieb Andy Yan:
> > PX3 EVB is designed by Rockchip for automotive field,
> > which intergrated with CVBS(TP2825)/MIPI DSI/LVDS/HDMI
> 
> "integrated"
> but the grammar is somewhat incorrect with "which" referring to field -
> I assume you meant "with integrated CVBS..."?
> 
> > video input/output interface, WIFI/BT/GPS(on a module
> 
> Also please always leave a space before an opening parenthesis in
> English text. Similarly above, spaces around "/" would help recognize
> that MIPI DSI belongs together rather than being two lists.
> 
> If nothing else applies below then maybe Heiko can edit it for you?

I've fixed the remarks in the commit description.


> > named S500 which based on MT6620), Gsensor BMA250E and
> > light&proximity sensor STK3410.
> > 
> > Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> > 
> > ---
> > 
> > Changes in v1:
> > - board rename
> > - add vendor prefix for i2c interfaced sensors
> > - use stdout-path to set the default console
> > 
> >  Documentation/devicetree/bindings/arm/rockchip.txt |   4 +
> >  arch/arm/boot/dts/Makefile                         |   1 +
> >  arch/arm/boot/dts/rk3188-px3-evb.dts               | 337
> >  +++++++++++++++++++++ 3 files changed, 342 insertions(+)
> >  create mode 100644 arch/arm/boot/dts/rk3188-px3-evb.dts
> > 
> > diff --git a/Documentation/devicetree/bindings/arm/rockchip.txt
> > b/Documentation/devicetree/bindings/arm/rockchip.txt index
> > 6668645..6da3881 100644
> > --- a/Documentation/devicetree/bindings/arm/rockchip.txt
> > +++ b/Documentation/devicetree/bindings/arm/rockchip.txt
> > @@ -21,6 +21,10 @@ Rockchip platforms device tree bindings
> > 
> >      Required root node properties:
> >        - compatible = "radxa,rock", "rockchip,rk3188";
> > 
> > +- Rockchip PX3 Evaluation board:
> > +    Required root node properties:
> > +      - compatible = "rockchip,px3-evb", "rockchip,px3",
> > "rockchip,rk3188";
> How compatible is PX3 with RK3188? It is a separate SoC product:
> 
> http://www.rock-chips.com/a/en/products/rkpower/2015/1125/730.html
> 
> Wondering whether or not to drop the third compatible string.

As discussed in IRC (and with arm-soc maintainers), I intend to keep the 
rk3188 part, as the chip really is just a (hardened?) variant of the consumer 
rk3188, but shares the same internals with the original.

> > +
> > 
> >  - Radxa Rock2 Square board:
> >      Required root node properties:
> >        - compatible = "radxa,rock2-square", "rockchip,rk3288";
> > 
> > diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> > index faacd52..88d27a2 100644
> > --- a/arch/arm/boot/dts/Makefile
> > +++ b/arch/arm/boot/dts/Makefile
> > @@ -620,6 +620,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += \
> > 
> >  	rk3066a-marsboard.dtb \
> >  	rk3066a-rayeager.dtb \
> >  	rk3188-radxarock.dtb \
> > 
> > +	rk3188-px3-evb.dtb \
> 
> Affects file naming as well: px3-evb.dtb?

see above

> 
> >  	rk3228-evb.dtb \
> >  	rk3229-evb.dtb \
> >  	rk3288-evb-act8846.dtb \
> > 
> > diff --git a/arch/arm/boot/dts/rk3188-px3-evb.dts
> > b/arch/arm/boot/dts/rk3188-px3-evb.dts new file mode 100644
> > index 0000000..f6bc738
> > --- /dev/null
> > +++ b/arch/arm/boot/dts/rk3188-px3-evb.dts
> > @@ -0,0 +1,337 @@
> > +/*
> > + * Copyright (c) 2016 Andy Yan <andy.yan@rock-chips.com>
> > + *
> > + * This file is dual-licensed: you can use it either under the terms
> > + * of the GPL or the X11 license, at your option. Note that this dual
> > + * licensing only applies to this file, and not this project as a
> > + * whole.
> > + *
> > + *  a) This file is free software; you can redistribute it and/or
> > + *     modify it under the terms of the GNU General Public License as
> > + *     published by the Free Software Foundation; either version 2 of the
> > + *     License, or (at your option) any later version.
> > + *
> > + *     This file is distributed in the hope that it will be useful,
> > + *     but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > + *     GNU General Public License for more details.
> > + *
> > + * Or, alternatively,
> > + *
> > + *  b) Permission is hereby granted, free of charge, to any person
> > + *     obtaining a copy of this software and associated documentation
> > + *     files (the "Software"), to deal in the Software without
> > + *     restriction, including without limitation the rights to use,
> > + *     copy, modify, merge, publish, distribute, sublicense, and/or
> > + *     sell copies of the Software, and to permit persons to whom the
> > + *     Software is furnished to do so, subject to the following
> > + *     conditions:
> > + *
> > + *     The above copyright notice and this permission notice shall be
> > + *     included in all copies or substantial portions of the Software.
> > + *
> > + *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> > + *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
> > + *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> > + *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
> > + *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
> > + *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> > + *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> > + *     OTHER DEALINGS IN THE SOFTWARE.
> > + */
> > +
> > +/dts-v1/;
> > +#include <dt-bindings/input/input.h>
> > +#include "rk3188.dtsi"
> 
> I'm surprised there is no [rk3188-]px3.dtsi here! Surely some automotive
> vendor may design their own board with it and should have at least the
> two trailing compatible strings pre-set.

see above. I don't think there is a need to pollute the directory with 
(nearly) empty dtsi files, especially as the compatible will get overwritten by 
a board compatible anyway.

> 
> > +
> > +/ {
> > +	model = "Rockchip PX3-EVB";
> > +	compatible = "rockchip,px3-evb", "rockchip,px3", "rockchip,rk3188";
> > +
> > +	chosen {
> > +		stdout-path = "serial2:115200n8";
> > +	};
> > +
> > +	memory {
> > +		device_type = "memory";
> > +		reg = <0x60000000 0x80000000>;
> > +	};
> > +
> > +	gpio-keys {
> > +		compatible = "gpio-keys";
> > +		autorepeat;
> > +
> > +		power {
> > +			gpios = <&gpio0 4 GPIO_ACTIVE_LOW>;
> > +			linux,code = <KEY_POWER>;
> > +			label = "GPIO Key Power";
> > +			linux,input-type = <1>;
> > +			wakeup-source;
> > +			debounce-interval = <100>;
> > +		};
> > +	};
> > +
> > +	vcc_sys: vsys-regulator {
> > +		compatible = "regulator-fixed";
> > +		regulator-name = "vsys";
> > +		regulator-min-microvolt = <5000000>;
> > +		regulator-max-microvolt = <5000000>;
> > +		regulator-boot-on;
> > +	};
> > +};
> > +
> > +&cpu0 {
> > +	cpu0-supply = <&vdd_cpu>;
> > +};
> > +
> > +&i2c0 {
> > +	status = "okay";
> > +
> > +	 /* Accelerometer */
> 
> Space after tab intentional?
> 
> > +	bma250 at 18 {
> > +		compatible = "bosch,bma250";
> > +		reg = <0x18>;
> > +		interrupt-parent = <&gpio0>;
> > +		interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
> > +	};
> > +
> > +	stk3410 at 48 {
> > +		compatible = "sensortek,STK3310";
> > +		reg = <0x48>;
> > +		interrupt-parent = <&gpio1>;
> > +		interrupts = <5 IRQ_TYPE_LEVEL_LOW>;
> > +	};
> 
> Generally it is undesired to repeat the compatible name as node name -
> did you compare other .dts files? (e.g., accelerometer at 18 would be
> self-documenting) If this is a copy from an existing .dts then please
> ignore this comment.

due to the compatible ambiguity, I had dropped the stk3410 node anyway.
I've also checked how the bma250 gets specified and there are both variants in 
use (accelerometer@ and bmc250@). So to set a good example for the future, 
I've changed the node name to accelerometer at 18 and dropped the now self 
explanatory comment obove it.


> 
> > +};
> > +
> > +&i2c1 {
> > +	status = "okay";
> > +	clock-frequency = <400000>;
> 
> Insert white line?

done


Heiko

^ permalink raw reply

* [PATCH] Reorganize STM32 clocks in order to prepare them for PLLI2S and PLLSAI
From: Daniel Thompson @ 2016-10-10  9:37 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1475791294-5804-1-git-send-email-user@localhost>

On 06/10/16 23:01, radek wrote:
> From: Radoslaw Pietrzyk <radoslaw.pietrzyk@gmail.com>
>
> Signed-off-by: Radoslaw Pietrzyk <radoslaw.pietrzyk@gmail.com>
> ---
>  drivers/clk/clk-stm32f4.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/clk/clk-stm32f4.c b/drivers/clk/clk-stm32f4.c
> index 02d6810..1fd3eac 100644
> --- a/drivers/clk/clk-stm32f4.c
> +++ b/drivers/clk/clk-stm32f4.c
> @@ -245,9 +245,10 @@ static void stm32f4_rcc_register_pll(const char *hse_clk, const char *hsi_clk)
>  	const char   *pllsrc = pllcfgr & BIT(22) ? hse_clk : hsi_clk;
>  	unsigned long pllq   = (pllcfgr >> 24) & 0xf;
>
> -	clk_register_fixed_factor(NULL, "vco", pllsrc, 0, plln, pllm);
> -	clk_register_fixed_factor(NULL, "pll", "vco", 0, 1, pllp);
> -	clk_register_fixed_factor(NULL, "pll48", "vco", 0, 1, pllq);
> +	clk_register_fixed_factor(NULL, "vco-div", pllsrc, 0, 1, pllm);
> +	clk_register_fixed_factor(NULL, "vco-mul", "vco-div", 0, plln, 1);
> +	clk_register_fixed_factor(NULL, "pll", "vco-mul", 0, 1, pllp);
> +	clk_register_fixed_factor(NULL, "pll48", "vco-mul", 0, 1, pllq);

I'm struggling to marry this up to the clock tree diagram for the 
F4-series (and there's no patch description to help me).

I can see the value of naming the "/M" pre-division separately (and 
agree that its hard to find it a good name for this clock in the 
datasheet). However I am struggling to work out why we'd want to rename 
the vco output.

For me the names for the multiplies clock within each pll emerges fairly 
cleanly from the datasheet (PLL -> vco, PLLI2S -> vcoi2s, PLLSAI -> 
vcosai). What does the '-mul' add?


Daniel.

^ permalink raw reply

* [PATCH v5 2/5] drm/bridge: Add RGB to VGA bridge support
From: Archit Taneja @ 2016-10-10  9:34 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <2147837.toaTVtNybe@avalon>



On 10/10/2016 12:45 PM, Laurent Pinchart wrote:
> Hi Archit,
>
> On Monday 10 Oct 2016 11:05:10 Archit Taneja wrote:
>> On 10/07/2016 02:44 PM, Maxime Ripard wrote:
>>> On Fri, Oct 07, 2016 at 10:27:31AM +0530, Archit Taneja wrote:
>
> [snip]
>
>>>> If no one has any more objections within the next day, I'll pull in
>>>> Maxime's v5 RGB to VGA bridge driver, and change the compatible to
>>>> "dumb-vga-dac".
>>>
>>> That works for me. You'll probably want to update the Kconfig and file
>>> name to match though.
>>
>> Queued to drm-misc, with the changes suggested by you and Laurent.
>
> Those changes would have been worth a repost. I've had a look at the patch
> you've committed and it looks OK to me, so no harm done (the commit message is
> a bit inaccurate, but it's not the end of the world). Could you please make
> sure you repost patches in the future when you change them in non-trivial ways
> ?

Sorry about that. Will repost from now onwards if the changes are too
significant.

Archit

>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply

* [PATCH] arm64: defconfig: enable EEPROM_AT25 config option
From: Arnd Bergmann @ 2016-10-10  9:20 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <a61b2b9d-356f-f24b-914b-0fb0e2bcdcc6@gmail.com>

On Monday, October 10, 2016 2:08:05 AM CEST Florian Fainelli wrote:
> On 10/07/2016 02:23 PM, Scott Branden wrote:
> > Enable support for on board SPI EEPROM by turning on
> > CONFIG_EEPROM_AT25.
> > 
> > Signed-off-by: Scott Branden <scott.branden@broadcom.com>
> 
> Looks fine to me, unless this needs to be a module, Arnd, what do you think?

Please either make it a module or explain in the patch description
why it should be built-in.

	Arnd

^ permalink raw reply

* [PATCH v3 07/12] scsi/ncr5380: Store IO ports and addresses in host private data
From: Russell King - ARM Linux @ 2016-10-10  9:19 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <5c9f6b4913bc8bc4938d2de0bb19d4289226ec26.1476051962.git.fthain@telegraphics.com.au>

On Mon, Oct 10, 2016 at 12:46:53AM -0400, Finn Thain wrote:
> The various 5380 drivers inconsistently store register pointers
> either in the Scsi_Host struct "legacy crap" area or in special,
> board-specific members of the NCR5380_hostdata struct. Uniform
> use of the latter struct makes for simpler and faster code (see
> the following patches) and helps to reduce use of the
> NCR5380_implementation_fields macro.
> 
> Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
> Reviewed-by: Hannes Reinecke <hare@suse.com>
> Tested-by: Ondrej Zary <linux@rainbow-software.org>
> Tested-by: Michael Schmitz <schmitzmic@gmail.com>
> ---
>  drivers/scsi/arm/cumana_1.c | 60 ++++++++++++++++++++--------------------
>  drivers/scsi/arm/oak.c      | 23 ++++++++--------

For these two,

Acked-by: Russell King <rmk+kernel@armlinux.org.uk>

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply

* [PATCH v3 10/12] scsi/ncr5380: Expedite register polling
From: Russell King - ARM Linux @ 2016-10-10  9:17 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <2806ba151f6983923fa0aae700245dfeb4cfaf38.1476051962.git.fthain@telegraphics.com.au>

On Mon, Oct 10, 2016 at 12:46:53AM -0400, Finn Thain wrote:
> Avoid the call to NCR5380_poll_politely2() when possible. The call is
> easily short-circuited on the PIO fast path, using the inline wrapper.
> This requires that the NCR5380_read macro be made available before
> any #include "NCR5380.h" so a few declarations have to be moved too.
> 
> Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
> Reviewed-by: Hannes Reinecke <hare@suse.com>
> Tested-by: Ondrej Zary <linux@rainbow-software.org>
> Tested-by: Michael Schmitz <schmitzmic@gmail.com>
> ---

> diff --git a/drivers/scsi/arm/cumana_1.c b/drivers/scsi/arm/cumana_1.c
> index ae1d4c6..fb7600d 100644
> --- a/drivers/scsi/arm/cumana_1.c
> +++ b/drivers/scsi/arm/cumana_1.c
> @@ -29,6 +29,10 @@
>  #define NCR5380_implementation_fields	\
>  	unsigned ctrl
>  
> +struct NCR5380_hostdata;
> +static u8 cumanascsi_read(struct NCR5380_hostdata *, unsigned int);
> +static void cumanascsi_write(struct NCR5380_hostdata *, unsigned int, u8);
> +
>  #include "../NCR5380.h"
>  
>  #define CTRL	0x16fc

This seems to be non-obviously unrelated to this commit - should it be in
some other commit?

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply

* [PATCH v3 11/12] scsi/ncr5380: Use correct types for DMA routines
From: Russell King - ARM Linux @ 2016-10-10  9:15 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <8390541e30d7b7cd418a7b5095fdb4b5fc7aa0ed.1476051962.git.fthain@telegraphics.com.au>

On Mon, Oct 10, 2016 at 12:46:53AM -0400, Finn Thain wrote:
> Apply prototypes to get consistent function signatures for the DMA
> functions implemented in the board-specific drivers. To avoid using
> macros to alter actual parameters, some of those functions are reworked
> slightly.
> 
> This is a step toward the goal of passing the board-specific routines
> to the core driver using an ops struct (as in a platform driver or
> library module).
> 
> This also helps fix some inconsistent types: where the core driver uses
> ints (cmd->SCp.this_residual and hostdata->dma_len) for keeping track of
> transfers, certain board-specific routines used unsigned long.
> 
> While we are fixing these function signatures, pass the hostdata pointer
> to DMA routines instead of a Scsi_Host pointer, for shorter and faster
> code.
> 
> Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
> Reviewed-by: Hannes Reinecke <hare@suse.com>
> Tested-by: Ondrej Zary <linux@rainbow-software.org>
> Tested-by: Michael Schmitz <schmitzmic@gmail.com>
> ---
>  drivers/scsi/arm/cumana_1.c | 26 ++++++++++------
>  drivers/scsi/arm/oak.c      | 13 ++++----

For these two,

Acked-by: Russell King <rmk+kernel@armlinux.org.uk>

Thanks.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply

* [PATCH v3] arm64: mm: move zero page from .bss to right before swapper_pg_dir
From: Ard Biesheuvel @ 2016-10-10  9:14 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20161009231017.GA11582@remoulade>

On 10 October 2016 at 00:10, Mark Rutland <mark.rutland@arm.com> wrote:
> On Fri, Oct 07, 2016 at 10:31:14AM +0100, Ard Biesheuvel wrote:
>> On 12 September 2016 at 17:15, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
>> > Move the statically allocated zero page from the .bss section to right
>> > before swapper_pg_dir. This allows us to refer to its physical address
>> > by simply reading TTBR1_EL1 (which always points to swapper_pg_dir and
>> > always has its ASID field cleared), and subtracting PAGE_SIZE.
>> >
>> > To protect the zero page from inadvertent modification, carve out a
>> > segment that covers it as well as idmap_pg_dir[], and mark it read-only
>> > in both the primary and the linear mappings of the kernel.
>
> [...]
>
>> > -       map_kernel_segment(pgd, _data, _end, PAGE_KERNEL, &vmlinux_data);
>> > +       map_kernel_segment(pgd, _data, __robss_start, PAGE_KERNEL,
>> > +                          &vmlinux_data);
>> > +       map_kernel_segment(pgd, __robss_start, __robss_end, PAGE_KERNEL_RO,
>> > +                          &vmlinux_robss);
>>
>> I realised it is actually unnecessary to map the idmap and the zero
>> page into the kernel mapping, so we could drop this line.
>
> Given that drivers use the zero page, I wouldn't be entirely surprised to see
> phys_to_virt(virt_to_phys(zero_page)) happen indirectly, and the end result
> read. Are we sure that doesn't happen anywhere?
>

That conversion would actually still work, it would be the direct
reference that is left unmapped. But given that it is mapped R/O
anyway (which is the whole point of the patch), it makes more sense to
follow the principle of least surprise, and make the direct symbol
dereference work as expected.

> For the idmap, I think we might walk that were we to take a fault (though
> perhaps we don't). Otherwise, unless we add a sysfs walker for it I guess we
> don't strictly need it in the linear map.
>

Likewise, this is the kernel mapping not the linear mapping. But given
how little this matters, please forget I said anything :-)

^ permalink raw reply

* [PATCH v3 08/12] scsi/ncr5380: Use correct types for device register accessors
From: Russell King - ARM Linux @ 2016-10-10  9:13 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <7f9f43fa2d3ba08a3277b749ea38acad3c8e8337.1476051962.git.fthain@telegraphics.com.au>

On Mon, Oct 10, 2016 at 12:46:53AM -0400, Finn Thain wrote:
> For timeout values adopt unsigned long, which is the type of jiffies etc.
> 
> For chip register values and bit masks pass u8, which is the return type
> of readb, inb etc.
> 
> For device register offsets adopt unsigned int, as it is suitable for
> adding to base addresses.
> 
> Pass the NCR5380_hostdata pointer to the board-specific routines instead
> of the Scsi_Host pointer. The board-specific code is concerned with
> hardware and not with SCSI protocol or the mid-layer.
> 
> Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
> Reviewed-by: Hannes Reinecke <hare@suse.com>
> Tested-by: Ondrej Zary <linux@rainbow-software.org>
> Tested-by: Michael Schmitz <schmitzmic@gmail.com>
> ---
>  drivers/scsi/arm/cumana_1.c | 20 +++++++++++---------
>  drivers/scsi/arm/oak.c      |  6 ++----

For these two:

Acked-by: Russell King <rmk+kernel@armlinux.org.uk>

Thanks.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply

* camera on n900, v4.8
From: Pavel Machek @ 2016-10-10  9:11 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20161010084859.GD4467@pali>

On Mon 2016-10-10 10:48:59, Pali Roh?r wrote:
> On Wednesday 05 October 2016 21:03:41 Pavel Machek wrote:
> > Hi!
> > 
> > Camera has some non-trivial dependencies on N900; it seems to rely on
> > gpio-switch.c, for example. I'll try to strip the diff further, but in
> > the meantime, here's the version I'm working with.
> > 
> 
> With "Camera" do you mean some Maemo userspace application? Because I
> think that nobody else could depends on gpio-switch kernel driver.

With camera, I mean kernel drivers for /dev/video*. I don't know why
they depend on gpio-switch.c, but they do.

I'm using fcam-dev for userspace control of camera. I'd prefer not to
touch anything w/o sources.

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161010/1f4c86e0/attachment.sig>

^ permalink raw reply

* [PATCH v3 02/12] scsi/cumana_1: Remove unused cumanascsi_setup() function
From: Russell King - ARM Linux @ 2016-10-10  9:11 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <0e4fe7993945cd855f230f95bc0d7410dd5a9baa.1476051962.git.fthain@telegraphics.com.au>

On Mon, Oct 10, 2016 at 12:46:52AM -0400, Finn Thain wrote:
> Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
> Reviewed-by: Hannes Reinecke <hare@suse.com>

Thanks.

Acked-by: Russell King <rmk+kernel@armlinux.org.uk>

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply

* [PATCH] ARM: dts: rockchip: Reserve unusable memory region on rk3066
From: Paweł Jarosz @ 2016-10-10  9:11 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <67831fd0-76af-a793-0b2f-958e45633fe8@rock-chips.com>

Hi


W dniu 10.10.2016 o 09:18, Huang, Tao pisze:
> Our IC guy need us tell them which master can not access such area, DMA
> or EMMC Controller or GPU, etc? Could you tell me how to reproduce such
> issue?
> And we can confirm CPU core can access this memory through /dev/mem and
> the test board is 1GB too. Personally, I don't think RK3066 has such
> limit because when we verify this chip, we don't found such limit at all.
>
> Thanks,
> Huang, Tao

I'm getting this on Ubuntu 16.04 with mainline kernel.
My board always freezes when i type: "memtester 800M"

^ permalink raw reply

* [PATCH] arm64: defconfig: enable EEPROM_AT25 config option
From: Florian Fainelli @ 2016-10-10  9:08 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1475875432-13627-1-git-send-email-scott.branden@broadcom.com>



On 10/07/2016 02:23 PM, Scott Branden wrote:
> Enable support for on board SPI EEPROM by turning on
> CONFIG_EEPROM_AT25.
> 
> Signed-off-by: Scott Branden <scott.branden@broadcom.com>

Looks fine to me, unless this needs to be a module, Arnd, what do you think?

> ---
>  arch/arm64/configs/defconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
> index eadf485..9955ee1 100644
> --- a/arch/arm64/configs/defconfig
> +++ b/arch/arm64/configs/defconfig
> @@ -136,6 +136,7 @@ CONFIG_MTD_SPI_NOR=y
>  CONFIG_BLK_DEV_LOOP=y
>  CONFIG_BLK_DEV_NBD=m
>  CONFIG_VIRTIO_BLK=y
> +CONFIG_EEPROM_AT25=y
>  CONFIG_SRAM=y
>  # CONFIG_SCSI_PROC_FS is not set
>  CONFIG_BLK_DEV_SD=y
> 

-- 
Florian

^ permalink raw reply

* [PATCH] ARM: dts: fix naming of pinctrl node
From: Florian Fainelli @ 2016-10-10  9:07 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <6039a5f9-2b36-c427-2f8a-addf76cf1c26@broadcom.com>



On 10/08/2016 02:03 PM, Ray Jui wrote:
> 
> 
> On 10/8/2016 1:34 PM, Scott Branden wrote:
>> Remove 0x from pinctrl node to match device tree naming convention.
>>
>> Signed-off-by: Scott Branden <scott.branden@broadcom.com>
>> ---
>>  arch/arm/boot/dts/bcm-cygnus.dtsi | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/boot/dts/bcm-cygnus.dtsi
>> b/arch/arm/boot/dts/bcm-cygnus.dtsi
>> index fabc9f3..539c58f 100644
>> --- a/arch/arm/boot/dts/bcm-cygnus.dtsi
>> +++ b/arch/arm/boot/dts/bcm-cygnus.dtsi
>> @@ -108,7 +108,7 @@
>>              };
>>          };
>>
>> -        pinctrl: pinctrl at 0x0301d0c8 {
>> +        pinctrl: pinctrl at 0301d0c8 {
>>              compatible = "brcm,cygnus-pinmux";
>>              reg = <0x0301d0c8 0x30>,
>>                    <0x0301d24c 0x2c>;
>>
> 
> Looks good to me!
> 
> Reviewed-by: Ray Jui <ray.jui@broadcom.com>

Applied, thanks!
-- 
Florian

^ permalink raw reply

* [PATCH v2] arm64: dts: rename ns2.txt to brcm,ns2.txt
From: Florian Fainelli @ 2016-10-10  9:06 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <c0cfffa7-d72a-6acb-c457-cd696e24f2eb@broadcom.com>



On 10/08/2016 02:02 PM, Ray Jui wrote:
> On 10/8/2016 1:48 PM, Scott Branden wrote:
>> Rename ns2.txt to brcm,ns2.txt to match naming convention followed
>> by rest of Broadcom binding documentation.
>>
>> Signed-off-by: Scott Branden <scott.branden@broadcom.com>
>> ---
>>  Documentation/devicetree/bindings/arm/bcm/{ns2.txt => brcm,ns2.txt} | 0
>>  1 file changed, 0 insertions(+), 0 deletions(-)
>>  rename Documentation/devicetree/bindings/arm/bcm/{ns2.txt =>
>> brcm,ns2.txt} (100%)
>>
>> diff --git a/Documentation/devicetree/bindings/arm/bcm/ns2.txt
>> b/Documentation/devicetree/bindings/arm/bcm/brcm,ns2.txt
>> similarity index 100%
>> rename from Documentation/devicetree/bindings/arm/bcm/ns2.txt
>> rename to Documentation/devicetree/bindings/arm/bcm/brcm,ns2.txt
>>
> 
> Looks good to me!
> 
> Reviewed-by: Ray Jui <ray.jui@broadcom.com>

Applied, thanks!
-- 
Florian

^ permalink raw reply

* [PATCH v7 3/3] ARM: sunxi: Enable VGA bridge
From: Maxime Ripard @ 2016-10-10  9:05 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <cover.60fc2fa7a6c5b5800b4e3a97b5598216817e0d9c.1476090316.git-series.maxime.ripard@free-electrons.com>

Enable the VGA bridge used on the A13-Olinuxino in the sunxi defconfig

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 arch/arm/configs/sunxi_defconfig | 1 +
 1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/arch/arm/configs/sunxi_defconfig b/arch/arm/configs/sunxi_defconfig
index 714da336ec86..dfeee5c51b40 100644
--- a/arch/arm/configs/sunxi_defconfig
+++ b/arch/arm/configs/sunxi_defconfig
@@ -98,6 +98,7 @@ CONFIG_MEDIA_RC_SUPPORT=y
 CONFIG_RC_DEVICES=y
 CONFIG_IR_SUNXI=y
 CONFIG_DRM=y
+CONFIG_DRM_DUMB_VGA_DAC=y
 CONFIG_DRM_SUN4I=y
 CONFIG_FB=y
 CONFIG_FB_SIMPLE=y
-- 
git-series 0.8.10

^ permalink raw reply related

* [PATCH v7 2/3] ARM: multi_v7: enable VGA bridge
From: Maxime Ripard @ 2016-10-10  9:05 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <cover.60fc2fa7a6c5b5800b4e3a97b5598216817e0d9c.1476090316.git-series.maxime.ripard@free-electrons.com>

Enable the RGB to VGA bridge driver in the defconfig

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 arch/arm/configs/multi_v7_defconfig | 1 +
 1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 2c8665cd9dc5..aae732bd6681 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -567,6 +567,7 @@ CONFIG_DRM=y
 CONFIG_DRM_I2C_ADV7511=m
 # CONFIG_DRM_I2C_CH7006 is not set
 # CONFIG_DRM_I2C_SIL164 is not set
+CONFIG_DRM_DUMB_VGA_DAC=m
 CONFIG_DRM_NXP_PTN3460=m
 CONFIG_DRM_PARADE_PS8622=m
 CONFIG_DRM_NOUVEAU=m
-- 
git-series 0.8.10

^ permalink raw reply related

* [PATCH v7 1/3] ARM: sun5i: a13-olinuxino: Enable VGA bridge
From: Maxime Ripard @ 2016-10-10  9:05 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <cover.60fc2fa7a6c5b5800b4e3a97b5598216817e0d9c.1476090316.git-series.maxime.ripard@free-electrons.com>

Now that we have support for the VGA bridges using our DRM driver, enable
the display engine for the Olimex A13-Olinuxino.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/boot/dts/sun5i-a13-olinuxino.dts | 54 ++++++++++++++++++++++++-
 1 file changed, 54 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
index b3c234c65ea1..bb7210e0e4a9 100644
--- a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
+++ b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
@@ -72,6 +72,47 @@
 			default-state = "on";
 		};
 	};
+
+	bridge {
+		compatible = "dumb-vga-dac";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port at 0 {
+				reg = <0>;
+
+				vga_bridge_in: endpoint {
+					remote-endpoint = <&tcon0_out_vga>;
+				};
+			};
+
+			port at 1 {
+				reg = <1>;
+
+				vga_bridge_out: endpoint {
+					remote-endpoint = <&vga_con_in>;
+				};
+			};
+		};
+	};
+
+	vga {
+		compatible = "vga-connector";
+
+		port {
+			vga_con_in: endpoint {
+				remote-endpoint = <&vga_bridge_out>;
+			};
+		};
+	};
+};
+
+&be0 {
+	status = "okay";
 };
 
 &ehci0 {
@@ -211,6 +252,19 @@
 	status = "okay";
 };
 
+&tcon0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&lcd_rgb666_pins>;
+	status = "okay";
+};
+
+&tcon0_out {
+	tcon0_out_vga: endpoint at 0 {
+		reg = <0>;
+		remote-endpoint = <&vga_bridge_in>;
+	};
+};
+
 &uart1 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart1_pins_b>;
-- 
git-series 0.8.10

^ permalink raw reply related

* [PATCH v7 0/3] drm: Add Support for Passive RGB to VGA bridges
From: Maxime Ripard @ 2016-10-10  9:05 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

This serie is about adding support for the RGB to VGA bridge found in
the A13-Olinuxino and the CHIP VGA adapter.

Both these boards rely on an entirely passive bridge made out of
resitor ladders that do not require any initialisation. The only thing
needed is to get the timings from the screen if available (and if not,
fall back on XGA standards), set up the display pipeline to output on
the RGB bus with the proper timings, and you're done.

This serie also fixes a bunch of bugs uncovered when trying to
increase the resolution, and hence the pixel clock, of our
pipeline. It also fixes a few bugs in the DRM driver itself that went
unnoticed before.

Let me know what you think,
Maxime

Changes from v6:
  - Reworked the patches to match the compatible and driver name merged

Changes from v5:
  - Renamed to simple-vga-dac

Changes from v4:
  - Removed unused functions

Changes from v3:
  - Depends on OF in Kconfig
  - Fixed typos in the driver comments
  - Removed the mention of a "passive" bridge in the bindings doc
  - Made the strcuture const
  - Removed the nops and best_encoders implementations
  - Removed the call to drm_bridge_enable in the sun4i driver

Changes from v2:
  - Changed the compatible as suggested
  - Rebased on top 4.8

Changes from v1:
  - Switch to using a vga-connector
  - Use drm_encoder bridge pointer instead of doing our own
  - Report the connector status as unknown instead of connected by
    default, and as connected only if we can retrieve the EDID.
  - Switch to of_i2c_get_adapter by node, and put the reference when done
  - Rebased on linux-next

Maxime Ripard (5):
  drm/sun4i: rgb: Remove the bridge enable/disable functions
  drm/bridge: Add RGB to VGA bridge support
  ARM: sun5i: a13-olinuxino: Enable VGA bridge
  ARM: multi_v7: enable VGA bridge
  ARM: sunxi: Enable VGA bridge

 .../bindings/display/bridge/rgb-to-vga-bridge.txt  |  48 +++++
 arch/arm/boot/dts/sun5i-a13-olinuxino.dts          |  54 +++++
 arch/arm/configs/multi_v7_defconfig                |   1 +
 arch/arm/configs/sunxi_defconfig                   |   1 +
 drivers/gpu/drm/bridge/Kconfig                     |   7 +
 drivers/gpu/drm/bridge/Makefile                    |   1 +
 drivers/gpu/drm/bridge/rgb-to-vga.c                | 229 +++++++++++++++++++++
 drivers/gpu/drm/sun4i/sun4i_rgb.c                  |   6 -
 8 files changed, 341 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/rgb-to-vga-bridge.txt
 create mode 100644 drivers/gpu/drm/bridge/rgb-to-vga.c

--
2.9.3

Maxime Ripard (3):
  ARM: sun5i: a13-olinuxino: Enable VGA bridge
  ARM: multi_v7: enable VGA bridge
  ARM: sunxi: Enable VGA bridge

 arch/arm/boot/dts/sun5i-a13-olinuxino.dts | 54 ++++++++++++++++++++++++-
 arch/arm/configs/multi_v7_defconfig       |  1 +-
 arch/arm/configs/sunxi_defconfig          |  1 +-
 3 files changed, 56 insertions(+), 0 deletions(-)

-- 
git-series 0.8.10

^ permalink raw reply

* [PATCH 4/5] rpmsg: Driver for user space endpoint interface
From: Marek Novak @ 2016-10-10  9:00 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1475900595-8375-4-git-send-email-bjorn.andersson@linaro.org>

-----Original Message-----
From: Bjorn Andersson [mailto:bjorn.andersson at linaro.org] 
Sent: Saturday, October 08, 2016 6:23 AM
To: Ohad Ben-Cohen <ohad@wizery.com>; Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Jonathan Corbet <corbet@lwn.net>; Linus Walleij <linus.walleij@linaro.org>; Marek Novak <marek.novak@nxp.com>; Matteo Sartori <matteo.sartori@t3lab.it>; Michal Simek <monstr@monstr.eu>; linux-doc at vger.kernel.org; linux-kernel at vger.kernel.org; linux-remoteproc at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux-arm-msm at vger.kernel.org
Subject: [PATCH 4/5] rpmsg: Driver for user space endpoint interface

This driver allows rpmsg instances to expose access to rpmsg endpoints to user space processes. It provides a control interface, allowing userspace to export endpoints and an endpoint interface for each exposed endpoint.

The implementation is based on prior art by Texas Instrument, Google, PetaLogix and was derived from a FreeRTOS performance statistics driver written by Michal Simek.

The control interface provides a "create endpoint" ioctl, which is fed a name, source and destination address. The three values are used to create the endpoint, in a backend-specific way, and a rpmsg endpoint device is created - with the three parameters are available in sysfs for udev usage.

E.g. to create an endpoint device for one of the Qualcomm SMD channel related to DIAG one would issue:

  struct rpmsg_endpoint_info info = { "DIAG_CNTL", 0, 0 };
  int fd = open("/dev/rpmsg_ctrl0", O_RDWR);
  ioctl(fd, RPMSG_CREATE_EPT_IOCTL, &info);

Each created endpoint device shows up as an individual character device in /dev, allowing permission to be controlled on a per-endpoint basis.
The rpmsg endpoint will be created and destroyed following the opening and closing of the endpoint device, allowing rpmsg backends to open and close the physical channel, if supported by the wire protocol.

Cc: Marek Novak <marek.novak@nxp.com>
Cc: Matteo Sartori <matteo.sartori@t3lab.it>
Cc: Michal Simek <monstr@monstr.eu>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 Documentation/ioctl/ioctl-number.txt |   1 +
 drivers/rpmsg/Makefile               |   2 +-
 drivers/rpmsg/rpmsg_char.c           | 576 +++++++++++++++++++++++++++++++++++
 drivers/rpmsg/rpmsg_internal.h       |   2 +
 include/uapi/linux/rpmsg.h           |  35 +++
 5 files changed, 615 insertions(+), 1 deletion(-)  create mode 100644 drivers/rpmsg/rpmsg_char.c  create mode 100644 include/uapi/linux/rpmsg.h

diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl-number.txt
index 81c7f2bb7daf..08244bea5048 100644
--- a/Documentation/ioctl/ioctl-number.txt
+++ b/Documentation/ioctl/ioctl-number.txt
@@ -321,6 +321,7 @@ Code  Seq#(hex)	Include File		Comments
 0xB1	00-1F	PPPoX			<mailto:mostrows@styx.uwaterloo.ca>
 0xB3	00	linux/mmc/ioctl.h
 0xB4	00-0F	linux/gpio.h		<mailto:linux-gpio@vger.kernel.org>
+0xB5	00-0F	uapi/linux/rpmsg.h	<mailto:linux-remoteproc@vger.kernel.org>
 0xC0	00-0F	linux/usb/iowarrior.h
 0xCA	00-0F	uapi/misc/cxl.h
 0xCA	80-8F	uapi/scsi/cxlflash_ioctl.h
diff --git a/drivers/rpmsg/Makefile b/drivers/rpmsg/Makefile index ae9c9132cf76..5daf1209b77d 100644
--- a/drivers/rpmsg/Makefile
+++ b/drivers/rpmsg/Makefile
@@ -1,3 +1,3 @@
-obj-$(CONFIG_RPMSG)		+= rpmsg_core.o
+obj-$(CONFIG_RPMSG)		+= rpmsg_core.o rpmsg_char.o
 obj-$(CONFIG_RPMSG_QCOM_SMD)	+= qcom_smd.o
 obj-$(CONFIG_RPMSG_VIRTIO)	+= virtio_rpmsg_bus.o
diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c new file mode 100644 index 000000000000..a398a63e8d44
--- /dev/null
+++ b/drivers/rpmsg/rpmsg_char.c
@@ -0,0 +1,576 @@
+/*
+ * Copyright (c) 2016, Linaro Ltd.
+ * Copyright (c) 2012, Michal Simek <monstr@monstr.eu>
+ * Copyright (c) 2012, PetaLogix
+ * Copyright (c) 2011, Texas Instruments, Inc.
+ * Copyright (c) 2011, Google, Inc.
+ *
+ * Based on rpmsg performance statistics driver by Michal Simek, which 
+in turn
+ * was based on TI & Google OMX rpmsg driver.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#include <linux/cdev.h>
+#include <linux/device.h>
+#include <linux/fs.h>
+#include <linux/idr.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/rpmsg.h>
+#include <linux/skbuff.h>
+#include <linux/slab.h>
+#include <linux/uaccess.h>
+#include <uapi/linux/rpmsg.h>
+
+#include "rpmsg_internal.h"
+
+#define RPMSG_DEV_MAX	256
+
+static dev_t rpmsg_major;
+static struct class *rpmsg_class;
+
+static DEFINE_IDA(rpmsg_ctrl_ida);
+static DEFINE_IDA(rpmsg_ept_ida);
+static DEFINE_IDA(rpmsg_minor_ida);
+
+#define dev_to_eptdev(dev) container_of(dev, struct rpmsg_eptdev, dev) 
+#define cdev_to_eptdev(i_cdev) container_of(i_cdev, struct 
+rpmsg_eptdev, cdev)
+
+#define dev_to_ctrldev(dev) container_of(dev, struct rpmsg_ctrldev, 
+dev) #define cdev_to_ctrldev(i_cdev) container_of(i_cdev, struct 
+rpmsg_ctrldev, cdev)
+
+struct rpmsg_ctrldev {
+	struct rpmsg_device *rpdev;
+	struct cdev cdev;
+	struct device dev;
+};
+
+struct rpmsg_eptdev {
+	struct device dev;
+	struct cdev cdev;
+
+	struct rpmsg_device *rpdev;
+	struct rpmsg_channel_info chinfo;
+
+	struct mutex ept_lock;
+	struct rpmsg_endpoint *ept;
+
+	spinlock_t queue_lock;
+	struct sk_buff_head queue;
+	wait_queue_head_t readq;
+};
+
+static int rpmsg_eptdev_destroy(struct rpmsg_eptdev *eptdev);
+
+
+static int rpmsg_cdev_register(struct device *dev,
+			       struct cdev *cdev,
+			       const struct file_operations *fops,
+			       dev_t *assigned_devt)
+{
+	dev_t devt;
+	int ret;
+
+	ret = ida_simple_get(&rpmsg_minor_ida, 0, 0, GFP_KERNEL);
+	if (ret < 0)
+		return ret;
+
+	devt = MKDEV(MAJOR(rpmsg_major), ret);
+
+	cdev_init(cdev, fops);
+	cdev->owner = THIS_MODULE;
+	ret = cdev_add(cdev, devt, 1);
+	if (ret < 0) {
+		dev_err(dev, "cdev_add failed: %d\n", ret);
+		ida_simple_remove(&rpmsg_minor_ida, MINOR(devt));
+		return ret;
+	}
+
+	*assigned_devt = devt;
+	return 0;
+}
+
+static int rpmsg_ept_cb(struct rpmsg_device *rpdev, void *buf, int len,
+			void *priv, u32 addr)
+{
+	struct rpmsg_eptdev *eptdev = priv;
+	struct sk_buff *skb;
+
+	skb = alloc_skb(len, GFP_ATOMIC);
+	if (!skb)
+		return -ENOMEM;
+
+	memcpy(skb_put(skb, len), buf, len);
+
+	spin_lock(&eptdev->queue_lock);
+	skb_queue_tail(&eptdev->queue, skb);
+	spin_unlock(&eptdev->queue_lock);
+
+	/* wake up any blocking processes, waiting for new data */
+	wake_up_interruptible(&eptdev->readq);
+
+	return 0;
+}
+
+static int rpmsg_eptdev_open(struct inode *inode, struct file *filp) {
+	struct rpmsg_eptdev *eptdev = cdev_to_eptdev(inode->i_cdev);
+	struct rpmsg_endpoint *ept;
+	struct rpmsg_device *rpdev = eptdev->rpdev;
+	struct device *dev = &eptdev->dev;
+
+	get_device(dev);
+
+	ept = rpmsg_create_ept(rpdev, rpmsg_ept_cb, eptdev, eptdev->chinfo);
+	if (!ept) {
+		dev_err(dev, "failed to open %s\n", eptdev->chinfo.name);
+		put_device(dev);
+		return -EINVAL;
+	}
+
+	eptdev->ept = ept;
+	filp->private_data = eptdev;
+
+	return 0;
+}
+
+static int rpmsg_eptdev_release(struct inode *inode, struct file *filp) 
+{
+	struct rpmsg_eptdev *eptdev = cdev_to_eptdev(inode->i_cdev);
+	struct device *dev = &eptdev->dev;
+	struct sk_buff *skb;
+
+	/* Close the endpoint, if it's not already destroyed by the parent */
+	if (eptdev->ept)
+		rpmsg_destroy_ept(eptdev->ept);
+
+	/* Discard all SKBs */
+	while (!skb_queue_empty(&eptdev->queue)) {
+		skb = skb_dequeue(&eptdev->queue);
+		kfree_skb(skb);
+	}
+
+	put_device(dev);
+
+	return 0;
+}
+
+static long rpmsg_eptdev_ioctl(struct file *fp, unsigned int cmd,
+			       unsigned long arg)
+{
+	struct rpmsg_eptdev *eptdev = fp->private_data;
+
+	if (cmd != RPMSG_DESTROY_EPT_IOCTL)
+		return -EINVAL;
+
+	return rpmsg_eptdev_destroy(eptdev);
+}
+
+static ssize_t rpmsg_eptdev_read(struct file *filp, char __user *buf,
+				 size_t count, loff_t *f_pos)
+{
+	struct rpmsg_eptdev *eptdev = filp->private_data;
+	unsigned long flags;
+	struct sk_buff *skb;
+	int use;
+
+	spin_lock_irqsave(&eptdev->queue_lock, flags);
+
+	/* Wait for data in the queue */
+	if (skb_queue_empty(&eptdev->queue)) {
+		spin_unlock_irqrestore(&eptdev->queue_lock, flags);
+
+		if (filp->f_flags & O_NONBLOCK)
+			return -EAGAIN;
+
+		/* Wait until we get data or the endpoint goes away */
+		if (wait_event_interruptible(eptdev->readq,
+					     !skb_queue_empty(&eptdev->queue) ||
+					     !eptdev->ept))
+			return -ERESTARTSYS;
+
+		/* We lost the endpoint while waiting */
+		if (!eptdev->ept)
+			return -EPIPE;
+
+		spin_lock_irqsave(&eptdev->queue_lock, flags);
+	}
+
+	skb = skb_dequeue(&eptdev->queue);
+	if (!skb)
+		return -EFAULT;
+
+	spin_unlock_irqrestore(&eptdev->queue_lock, flags);
+
+	use = min_t(size_t, count, skb->len);
+	if (copy_to_user(buf, skb->data, use))
+		use = -EFAULT;
+
+	kfree_skb(skb);
+
+	return use;
+}
+
+static ssize_t rpmsg_eptdev_write(struct file *filp, const char __user *buf,
+				  size_t count, loff_t *f_pos)
+{
+	struct rpmsg_eptdev *eptdev = filp->private_data;
+	void *kbuf;
+	int ret;
+
+	kbuf = kzalloc(count, GFP_KERNEL);
+	if (!kbuf)
+		return -ENOMEM;
+
+	if (copy_from_user(kbuf, buf, count)) {
+		ret = -EFAULT;
+		goto free_kbuf;
+	}
+
+	if (mutex_lock_interruptible(&eptdev->ept_lock)) {
+		ret = -ERESTARTSYS;
+		goto free_kbuf;
+	}
+
+	if (!eptdev->ept) {
+		ret = -EPIPE;
+		goto unlock_eptdev;
+	}
+
+	if (filp->f_flags & O_NONBLOCK)
+		ret = rpmsg_trysend(eptdev->ept, kbuf, count);
+	else
+		ret = rpmsg_send(eptdev->ept, kbuf, count);
+
+unlock_eptdev:
+	mutex_unlock(&eptdev->ept_lock);
+
+free_kbuf:
+	kfree(kbuf);
+	return ret;
+}
+
+static const struct file_operations rpmsg_eptdev_fops = {
+	.owner = THIS_MODULE,
+	.open = rpmsg_eptdev_open,
+	.release = rpmsg_eptdev_release,
+	.read = rpmsg_eptdev_read,
+	.write = rpmsg_eptdev_write,
+	.unlocked_ioctl = rpmsg_eptdev_ioctl,
+};
+
+static ssize_t name_show(struct device *dev, struct device_attribute *attr,
+			 char *buf)
+{
+	struct rpmsg_eptdev *eptdev = dev_get_drvdata(dev);
+
+	return sprintf(buf, "%s\n", eptdev->chinfo.name); } static 
+DEVICE_ATTR_RO(name);
+
+static ssize_t src_show(struct device *dev, struct device_attribute *attr,
+			 char *buf)
+{
+	struct rpmsg_eptdev *eptdev = dev_get_drvdata(dev);
+
+	return sprintf(buf, "%d\n", eptdev->chinfo.src); } static 
+DEVICE_ATTR_RO(src);
+
+static ssize_t dst_show(struct device *dev, struct device_attribute *attr,
+			 char *buf)
+{
+	struct rpmsg_eptdev *eptdev = dev_get_drvdata(dev);
+
+	return sprintf(buf, "%d\n", eptdev->chinfo.dst); } static 
+DEVICE_ATTR_RO(dst);
+
+static struct attribute *rpmsg_eptdev_attrs[] = {
+	&dev_attr_name.attr,
+	&dev_attr_src.attr,
+	&dev_attr_dst.attr,
+	NULL
+};
+ATTRIBUTE_GROUPS(rpmsg_eptdev);
+
+static void rpmsg_eptdev_release_device(struct device *dev) {
+	struct rpmsg_eptdev *eptdev = dev_to_eptdev(dev);
+
+	ida_simple_remove(&rpmsg_minor_ida, MINOR(eptdev->dev.devt));
+	kfree(eptdev);
+}
+
+static int rpmsg_eptdev_create(struct rpmsg_ctrldev *ctrldev,
+			       struct rpmsg_channel_info chinfo) {
+	struct rpmsg_device *rpdev = ctrldev->rpdev;
+	struct rpmsg_eptdev *eptdev;
+	struct device *dev;
+	int ret;
+	int id;
+
+	eptdev = kzalloc(sizeof(*eptdev), GFP_KERNEL);
+	if (!eptdev)
+		return -ENOMEM;
+
+	eptdev->rpdev = rpdev;
+	eptdev->chinfo = chinfo;
+
+	mutex_init(&eptdev->ept_lock);
+	spin_lock_init(&eptdev->queue_lock);
+	skb_queue_head_init(&eptdev->queue);
+	init_waitqueue_head(&eptdev->readq);
+
+	id = ida_simple_get(&rpmsg_ept_ida, 0, 0, GFP_KERNEL);
+	if (id < 0) {
+		kfree(eptdev);
+		return id;
+	}
+
+	dev = &eptdev->dev;
+	device_initialize(dev);
+	dev->class = rpmsg_class;
+	dev->id = id;
+	dev->parent = &ctrldev->dev;
+	dev->release = rpmsg_eptdev_release_device;
+	dev->groups = rpmsg_eptdev_groups;
+	dev_set_name(dev, "rpmsg%d", id);
+	dev_set_drvdata(dev, eptdev);
+
+	ret = rpmsg_cdev_register(dev, &eptdev->cdev,
+				  &rpmsg_eptdev_fops, &dev->devt);
+	if (ret) {
+		dev_err(dev, "cdev_add failed: %d\n", ret);
+		goto out;
+	}
+
+	ret = device_add(dev);
+	if (ret) {
+		dev_err(dev, "device_register failed: %d\n", ret);
+		goto out;
+	}
+
+out:
+	if (ret < 0)
+		put_device(dev);
+
+	return ret;
+}
+
+static int rpmsg_eptdev_destroy(struct rpmsg_eptdev *eptdev) {
+	struct rpmsg_endpoint *ept = eptdev->ept;
+
+	mutex_lock(&eptdev->ept_lock);
+	eptdev->ept = NULL;
+	mutex_unlock(&eptdev->ept_lock);
+
+	rpmsg_destroy_ept(ept);
+
+	/* wake up any blocking processes */
+	wake_up_interruptible(&eptdev->readq);
+
+	cdev_del(&eptdev->cdev);
+	device_del(&eptdev->dev);
+	put_device(&eptdev->dev);
+
+	return 0;
+}
+
+static int rpmsg_ctrldev_open(struct inode *inode, struct file *filp) {
+	struct rpmsg_ctrldev *ctrldev = cdev_to_ctrldev(inode->i_cdev);
+
+	get_device(&ctrldev->rpdev->dev);
+	filp->private_data = ctrldev;
+
+	return 0;
+}
+
+static int rpmsg_ctrldev_release(struct inode *inode, struct file 
+*filp) {
+	struct rpmsg_ctrldev *ctrldev = cdev_to_ctrldev(inode->i_cdev);
+
+	put_device(&ctrldev->rpdev->dev);
+
+	return 0;
+}
+
+static long rpmsg_ctrldev_ioctl(struct file *fp, unsigned int cmd,
+				unsigned long arg)
+{
+	struct rpmsg_ctrldev *ctrldev = fp->private_data;
+	void __user *argp = (void __user *)arg;
+	struct rpmsg_endpoint_info eptinfo;
+	struct rpmsg_channel_info chinfo;
+
+	if (cmd != RPMSG_CREATE_EPT_IOCTL)
+		return -EINVAL;
+
+	if (copy_from_user(&eptinfo, argp, sizeof(eptinfo)))
+		return -EFAULT;
+
+	memcpy(chinfo.name, eptinfo.name, RPMSG_NAME_SIZE);
+	chinfo.name[RPMSG_NAME_SIZE-1] = '\0';
+	chinfo.src = eptinfo.src;
+	chinfo.dst = eptinfo.dst;
+
+	return rpmsg_eptdev_create(ctrldev, chinfo); };
+
+static const struct file_operations rpmsg_ctrldev_fops = {
+	.owner = THIS_MODULE,
+	.open = rpmsg_ctrldev_open,
+	.release = rpmsg_ctrldev_release,
+	.unlocked_ioctl = rpmsg_ctrldev_ioctl, };
+
+static void rpmsg_chrdev_release_device(struct device *dev) {
+	struct rpmsg_ctrldev *ctrldev = dev_to_ctrldev(dev);
+
+	ida_simple_remove(&rpmsg_ctrl_ida, MINOR(dev->devt));
+	cdev_del(&ctrldev->cdev);
+	kfree(ctrldev);
+}
+
+static int rpmsg_chrdev_probe(struct rpmsg_device *rpdev) {
+	struct rpmsg_ctrldev *ctrldev;
+	struct device *dev;
+	int ret;
+	int id;
+
+	ctrldev = kzalloc(sizeof(*ctrldev), GFP_KERNEL);
+	if (!ctrldev)
+		return -ENOMEM;
+
+	dev = &ctrldev->dev;
+
+	ctrldev->rpdev = rpdev;
+
+	id = ida_simple_get(&rpmsg_ctrl_ida, 0, 0, GFP_KERNEL);
+	if (id < 0) {
+		kfree(ctrldev);
+		return id;
+	}
+
+	device_initialize(dev);
+	dev->parent = &rpdev->dev;
+	dev->class = rpmsg_class;
+	dev->release = rpmsg_chrdev_release_device;
+	dev_set_name(&ctrldev->dev, "rpmsg_ctrl%d", id);
+
+	ret = rpmsg_cdev_register(dev, &ctrldev->cdev,
+				  &rpmsg_ctrldev_fops, &dev->devt);
+	if (ret < 0) {
+		put_device(dev);
+		return ret;
+	}
+
+	ret = device_add(dev);
+	if (ret) {
+		dev_err(&rpdev->dev, "device_register failed: %d\n", ret);
+		put_device(dev);
+	}
+
+	dev_set_drvdata(&rpdev->dev, ctrldev);
+
+	return ret;
+}
+
+static int _rpmsg_eptdev_destroy(struct device *dev, void *data) {
+	struct rpmsg_eptdev *eptdev = dev_to_eptdev(dev);
+
+	return rpmsg_eptdev_destroy(eptdev);
+}
+
+static void rpmsg_chrdev_remove(struct rpmsg_device *rpdev) {
+	struct rpmsg_ctrldev *ctrldev = dev_get_drvdata(&rpdev->dev);
+	int ret;
+
+	/* Destroy all endpoints */
+	ret = device_for_each_child(&ctrldev->dev, NULL, _rpmsg_eptdev_destroy);
+	if (ret)
+		dev_warn(&rpdev->dev, "failed to nuke endpoints: %d\n", ret);
+
+	device_del(&ctrldev->dev);
+	put_device(&ctrldev->dev);
+}
+
+static struct rpmsg_driver rpmsg_chrdev_driver = {
+	.probe = rpmsg_chrdev_probe,
+	.remove = rpmsg_chrdev_remove,
+	.drv = {
+		.name = "rpmsg_chrdev",
+	},
+};
+
+/**
+ * rpmsg_chrdev_register_device() - register chrdev device based on rpdev
+ * @rpdev:	prepared rpdev to be used for creating endpoints
+ *
+ * This function wraps rpmsg_register_device() preparing the rpdev for 
+use as
+ * basis for the rpmsg chrdev.
+ */
+int rpmsg_chrdev_register_device(struct rpmsg_device *rpdev) {
+	strcpy(rpdev->id.name, "rpmsg_chrdev");
+	rpdev->driver_override = "rpmsg_chrdev";
+
+	return rpmsg_register_device(rpdev);
+}
+EXPORT_SYMBOL(rpmsg_chrdev_register_device);
+
+static int rpmsg_char_init(void)
+{
+	int ret;
+
+	ret = alloc_chrdev_region(&rpmsg_major, 0, RPMSG_DEV_MAX, "rpmsg");
+	if (ret < 0) {
+		pr_err("rpmsg: failed to allocate char dev region\n");
+		return ret;
+	}
+
+	rpmsg_class = class_create(THIS_MODULE, "rpmsg");
+	if (IS_ERR(rpmsg_class)) {
+		pr_err("failed to create rpmsg class\n");
+		ret = PTR_ERR(rpmsg_class);
+		goto unregister_chrdev;
+	}
+
+	ret = register_rpmsg_driver(&rpmsg_chrdev_driver);
+	if (ret < 0) {
+		pr_err("rpmsgchr: failed to register rpmsg driver\n");
+		goto destroy_class;
+	}
+
+	return 0;
+
+destroy_class:
+	class_destroy(rpmsg_class);
+
+unregister_chrdev:
+	unregister_chrdev_region(rpmsg_major, RPMSG_DEV_MAX);
+
+	return ret;
+}
+postcore_initcall(rpmsg_char_init);
+
+static void rpmsg_chrdev_exit(void)
+{
+	unregister_rpmsg_driver(&rpmsg_chrdev_driver);
+	unregister_chrdev_region(rpmsg_major, RPMSG_DEV_MAX); } 
+module_exit(rpmsg_chrdev_exit);
diff --git a/drivers/rpmsg/rpmsg_internal.h b/drivers/rpmsg/rpmsg_internal.h index 8075a20f919b..53d300eacc1c 100644
--- a/drivers/rpmsg/rpmsg_internal.h
+++ b/drivers/rpmsg/rpmsg_internal.h
@@ -79,4 +79,6 @@ int rpmsg_unregister_device(struct device *parent,  struct device *rpmsg_find_device(struct device *parent,
 				 struct rpmsg_channel_info *chinfo);
 
+int rpmsg_chrdev_register_device(struct rpmsg_device *rpdev);
+
 #endif
diff --git a/include/uapi/linux/rpmsg.h b/include/uapi/linux/rpmsg.h new file mode 100644 index 000000000000..dedc226e0d3f
--- /dev/null
+++ b/include/uapi/linux/rpmsg.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2016, Linaro Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _UAPI_RPMSG_H_
+#define _UAPI_RPMSG_H_
+
+#include <linux/ioctl.h>
+#include <linux/types.h>
+
+/**
+ * struct rpmsg_endpoint_info - endpoint info representation
+ * @name: name of service
+ * @src: local address
+ * @dst: destination address
+ */
+struct rpmsg_endpoint_info {
+	char name[32];
+	__u32 src;
+	__u32 dst;
+};
+
+#define RPMSG_CREATE_EPT_IOCTL	_IOW(0xb5, 0x1, struct rpmsg_endpoint_info)
+#define RPMSG_DESTROY_EPT_IOCTL	_IO(0xb5, 0x2)
+
+#endif
--
2.5.0
----------------------------------------

Hi Bjorn,

Great patch!
You managed to simplify what I was trying to accomplish with my patch (https://raw.githubusercontent.com/NXPmicro/rpmsg-sysfs/0aa1817545a765c200b1b2f9b6680a420dcf9171/rpmsg_sysfs_interface.patch )

I am looking forward for your patch being upstreamed!
Did you place a pull request?
Can you share with me/us a link to your fork, where the patch is applied?

Thanks,
Marek

^ permalink raw reply related

* [PATCH devicetree] ARM: BCM53573: Specify PMU and its ILP clock in the DT
From: Florian Fainelli @ 2016-10-10  8:57 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20160917201346.15060-1-zajec5@gmail.com>



On 09/17/2016 01:13 PM, Rafa? Mi?ecki wrote:
> From: Rafa? Mi?ecki <rafal@milecki.pl>
> 
> ILP clock (sometimes called a "slow clock") is a part of PMU (Power
> Management Unit). There has been recently added a driver for it, so add
> a proper entry in the DT as well.
> 
> Signed-off-by: Rafa? Mi?ecki <rafal@milecki.pl>

Applied, thanks!
-- 
Florian

^ permalink raw reply

* camera on n900, v4.8
From: Pali Rohár @ 2016-10-10  8:48 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20161005190340.GA25755@amd>

On Wednesday 05 October 2016 21:03:41 Pavel Machek wrote:
> Hi!
> 
> Camera has some non-trivial dependencies on N900; it seems to rely on
> gpio-switch.c, for example. I'll try to strip the diff further, but in
> the meantime, here's the version I'm working with.
> 
> 									Pavel
> 
> 

With "Camera" do you mean some Maemo userspace application? Because I
think that nobody else could depends on gpio-switch kernel driver.

Anyway, it should be easy to rewrite such gpio-switch application to use
either input kernel events (from /dev/input/something) or directly check
gpio state via /sys/class/gpio/.

IIRC Maemo's Camera needed gpio-switch for testing if back camera cover
is open or closed and for checking when camera push button pressed and
released.

-- 
Pali Roh?r
pali.rohar at gmail.com

^ permalink raw reply

* [PATCH v2 1/8] PM / Domains: Make genpd state allocation dynamic
From: Ulf Hansson @ 2016-10-10  8:40 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1475879821-8035-2-git-send-email-lina.iyer@linaro.org>

On 8 October 2016 at 00:36, Lina Iyer <lina.iyer@linaro.org> wrote:
> Allow PM Domain states to be defined dynamically by the drivers. This
> removes the limitation on the maximum number of states possible for a
> domain.
>
> Cc: Axel Haslam <ahaslam+renesas@baylibre.com>
> Suggested-by: Ulf Hansson <ulf.hansson@linaro.org>
> Signed-off-by: Lina Iyer <lina.iyer@linaro.org>
> ---
>  arch/arm/mach-imx/gpc.c     | 17 ++++++++++-------
>  drivers/base/power/domain.c | 36 ++++++++++++++++++++++++------------
>  include/linux/pm_domain.h   |  5 ++---
>  3 files changed, 36 insertions(+), 22 deletions(-)
>
> diff --git a/arch/arm/mach-imx/gpc.c b/arch/arm/mach-imx/gpc.c
> index 0df062d..57a410b 100644
> --- a/arch/arm/mach-imx/gpc.c
> +++ b/arch/arm/mach-imx/gpc.c
> @@ -380,13 +380,6 @@ static struct pu_domain imx6q_pu_domain = {
>                 .name = "PU",
>                 .power_off = imx6q_pm_pu_power_off,
>                 .power_on = imx6q_pm_pu_power_on,
> -               .states = {
> -                       [0] = {
> -                               .power_off_latency_ns = 25000,
> -                               .power_on_latency_ns = 2000000,
> -                       },
> -               },
> -               .state_count = 1,
>         },
>  };
>
> @@ -430,6 +423,16 @@ static int imx_gpc_genpd_init(struct device *dev, struct regulator *pu_reg)
>         if (!IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS))
>                 return 0;
>
> +       imx6q_pu_domain.base.states = devm_kzalloc(dev,
> +                                       sizeof(*imx6q_pu_domain.base.states),
> +                                       GFP_KERNEL);
> +       if (!imx6q_pu_domain.base.states)
> +               return -ENOMEM;
> +
> +       imx6q_pu_domain.base.states[0].power_off_latency_ns = 25000;
> +       imx6q_pu_domain.base.states[0].power_on_latency_ns = 2000000;
> +       imx6q_pu_domain.base.state_count = 1;
> +
>         pm_genpd_init(&imx6q_pu_domain.base, NULL, false);
>         return of_genpd_add_provider_onecell(dev->of_node,
>                                              &imx_gpc_onecell_data);
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index e023066..4e87170 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -1282,6 +1282,21 @@ out:
>  }
>  EXPORT_SYMBOL_GPL(pm_genpd_remove_subdomain);
>
> +static int genpd_set_default_power_state(struct generic_pm_domain *genpd)
> +{
> +       struct genpd_power_state *state;
> +
> +       state = kzalloc(sizeof(*state), GFP_KERNEL);
> +       if (!state)
> +               return -ENOMEM;
> +
> +       genpd->states = state;
> +       genpd->state_count = 1;
> +       genpd->free = state;
> +
> +       return 0;
> +}
> +
>  /**
>   * pm_genpd_init - Initialize a generic I/O PM domain object.
>   * @genpd: PM domain object to initialize.
> @@ -1293,6 +1308,8 @@ EXPORT_SYMBOL_GPL(pm_genpd_remove_subdomain);
>  int pm_genpd_init(struct generic_pm_domain *genpd,
>                   struct dev_power_governor *gov, bool is_off)
>  {
> +       int ret;
> +
>         if (IS_ERR_OR_NULL(genpd))
>                 return -EINVAL;
>
> @@ -1325,19 +1342,12 @@ int pm_genpd_init(struct generic_pm_domain *genpd,
>                 genpd->dev_ops.start = pm_clk_resume;
>         }
>
> -       if (genpd->state_idx >= GENPD_MAX_NUM_STATES) {
> -               pr_warn("Initial state index out of bounds.\n");
> -               genpd->state_idx = GENPD_MAX_NUM_STATES - 1;
> -       }
> -
> -       if (genpd->state_count > GENPD_MAX_NUM_STATES) {
> -               pr_warn("Limiting states to  %d\n", GENPD_MAX_NUM_STATES);
> -               genpd->state_count = GENPD_MAX_NUM_STATES;
> -       }
> -
>         /* Use only one "off" state if there were no states declared */
> -       if (genpd->state_count == 0)
> -               genpd->state_count = 1;
> +       if (genpd->state_count == 0) {
> +               ret = genpd_set_default_power_state(genpd);
> +               if (ret)
> +                       return ret;
> +       }
>
>         mutex_lock(&gpd_list_lock);
>         list_add(&genpd->gpd_list_node, &gpd_list);
> @@ -1374,6 +1384,8 @@ static int genpd_remove(struct generic_pm_domain *genpd)
>                 kfree(link);
>         }
>
> +       kfree(genpd->free);
> +

To be safe, let's move this after cancel_work_sync() - as to prevent
no accesses is made to ->states pointer after you have freed it.

>         list_del(&genpd->gpd_list_node);
>         mutex_unlock(&genpd->lock);
>         cancel_work_sync(&genpd->power_off_work);
> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
> index a09fe5c..de1d8f3 100644
> --- a/include/linux/pm_domain.h
> +++ b/include/linux/pm_domain.h
> @@ -19,8 +19,6 @@
>  /* Defines used for the flags field in the struct generic_pm_domain */
>  #define GENPD_FLAG_PM_CLK      (1U << 0) /* PM domain uses PM clk */
>
> -#define GENPD_MAX_NUM_STATES   8 /* Number of possible low power states */
> -
>  enum gpd_status {
>         GPD_STATE_ACTIVE = 0,   /* PM domain is active */
>         GPD_STATE_POWER_OFF,    /* PM domain is off */
> @@ -70,9 +68,10 @@ struct generic_pm_domain {
>         void (*detach_dev)(struct generic_pm_domain *domain,
>                            struct device *dev);
>         unsigned int flags;             /* Bit field of configs for genpd */
> -       struct genpd_power_state states[GENPD_MAX_NUM_STATES];
> +       struct genpd_power_state *states;
>         unsigned int state_count; /* number of states */
>         unsigned int state_idx; /* state that genpd will go to when off */
> +       void *free; /* Free the state that was allocated for default */
>
>  };
>
> --
> 2.7.4
>

After the minor change suggested above, you may add my ack.

Kind regards
Uffe

^ permalink raw reply

* [PATCH] efi/arm: fix absolute relocation detection for older toolchains
From: Jon Hunter @ 2016-10-10  8:39 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CAKv+Gu-QJt4-c2Egnog0TdjJ0hLdg8g4Q303T2R9u_F3RXcwOA@mail.gmail.com>


On 05/10/16 18:30, Ard Biesheuvel wrote:
> On 4 October 2016 at 22:30, Matt Fleming <matt@codeblueprint.co.uk> wrote:
>> On Tue, 04 Oct, at 11:34:31AM, Ard Biesheuvel wrote:
>>>
>>> These relocations are harmless, since the debug ones are only
>>> interpreted by the debugger, and the ones generated by
>>> EXPORT_SYMBOL(sort) will never be referenced, since the symbols they
>>> contain are either renamed to __efistub_xxx (arm64), or they are not
>>> part of the kernel proper (arm)
>>>
>>> So both cases are false positives, but the diagnostic is important,
>>> and so breaking the build is appropriate for any other absolute
>>> relocation that may appear.
>>>
>>> The effect of the patch is not that the diagnostic is ignored, but
>>> that these relocations are not generated in the first place (-g0) or
>>> removed explicitly (ksymtab/krcrctab+sort) rather than via a wildcard.
>>> So other than not breaking the build, this patch should have no user
>>> observeable differences.
>>
>> Thanks Ard, sounds reasonable. Feel free to take this through
>> whichever tree you think is best.
>>
>> Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
> 
> Thanks Matt.
> 
> Arnd: could you take this on top of the patch that adds CONFIG_EFI to
> multi_v7_defconfig? That would minimize the breakage, I think.

Can someone pick up this fix? -next has been broken for me since 20th
Sept :-(

Cheers
Jon

-- 
nvpublic

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox