[linux-sunxi] Re: [PATCH v5 30/46] regulator: pwm: retrieve correct voltage

2016-04-07 Thread Boris Brezillon
Hi Mark,

On Wed, 30 Mar 2016 14:24:10 -0700
Mark Brown  wrote:

> On Wed, Mar 30, 2016 at 10:03:53PM +0200, Boris Brezillon wrote:
> > The continuous PWM voltage regulator is caching the voltage value in
> > the ->volt_uV field. While most of the time this value should reflect the
> > real voltage, sometime it can be sightly different if the PWM device
> > rounded the set_duty_cycle request.
> > Moreover, this value is not valid until someone has modified the regulator
> > output.
> 
> Acked-by: Mark Brown 

Actually this patch introduces a bug (reported by Stephen):

"
I applied your patch series [PATCH v5 00/46] pwm: add support for
atomic update and found a null pointer dereference when probing a
pwm-regulator at boot. See the below stack trace:

[ 4.282374] [] pwm_regulator_get_voltage+0x78/0xa0
[ 4.289344] [] regulator_attr_is_visible+0x7c/0x264
[ 4.296408] [] internal_create_group+0x14c/0x280
[ 4.303184] [] sysfs_create_group+0x14/0x1c
[ 4.309483] [] sysfs_create_groups+0x30/0x78
[ 4.315881] [] device_add+0x224/0x4d8
[ 4.321609] [] device_register+0x1c/0x28
[ 4.327623] [] regulator_register+0x2e4/0xc14
[ 4.334112] [] devm_regulator_register+0x54/0x94
[ 4.340887] [] pwm_regulator_probe+0x278/0x2b8
[ 4.347473] [] platform_drv_probe+0x58/0xa4
[ 4.353772] [] driver_probe_device+0x114/0x2ac
[ 4.360358] [] __driver_attach+0x64/0x90
[ 4.366371] [] bus_for_each_dev+0x74/0x90
[ 4.372478] [] driver_attach+0x20/0x28
[ 4.378299] [] bus_add_driver+0xe8/0x1e0
[ 4.384312] [] driver_register+0x98/0xe4
[ 4.390326] [] __platform_driver_register+0x48/0x50
[ 4.397388] [] pwm_regulator_driver_init+0x18/0x20
[ 4.404356] [] do_one_initcall+0xf8/0x180
[ 4.410466] [] kernel_init_freeable+0x154/0x1f4
[ 4.417148] [] kernel_init+0x10/0xf8
[ 4.422782] [] ret_from_fork+0x10/0x40

It looks like the root cause is that regulator_attr_is_visible will
try to get the voltage, but at this point in regulator_register,
rdev->constraints is still null. So
pwm_duty_cycle_percentage_to_voltage will dereference a null
rdev->constraints pointer.
"

The problem is that we need to know the min and max voltage constraints
to calculate the current voltage. ->get_voltage() is called when the
sysfs attributes are created (part of device registration), and
set_machine_constraints() is called after device_register(), thus
leading to the NULL pointer dereference.

Is there any reason for calling set_machine_constraints() after
device_register() in regulator_register()?

Best Regards,

Boris

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] SinoVoip BPi M2+

2016-04-07 Thread Thomas Kaiser
Just a try to save others some time. SinoVoip sent me a developer/review 
sample yesterday and I did some testing.

Wiki stub: http://linux-sunxi.org/Sinovoip_Banana_Pi_M2%2B

Since BPi M2+ is more or less a 99% clone of Orange Pi Plus/PC it was 
pretty easy to combine OPi PC/Plus stuff to a working .dts (everything 
tested except the stuff I'm not interested in: WiFi/BT). Fex, defconfig and 
a .dts available at the link above. Since they do not sent their camera 
module with the board I couldn't test this.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] Re: [PATCH 3/4] ARM: dts: Add binding documentation for AXP20x pmic ac power supply

2016-04-07 Thread Rob Herring
On Sun, Apr 03, 2016 at 03:15:06PM +0200, Michael Haas wrote:
> Add binding documentation for the ac power supply part of the AXP20x
> pmic.
> 
> Signed-off-by: Michael Haas 
> ---
>  .../bindings/power_supply/axp20x_ac_power.txt  | 34 
> ++
>  1 file changed, 34 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/power_supply/axp20x_ac_power.txt

Acked-by: Rob Herring 

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] Re: [PATCH] clk: sunxi: Add CSI (camera's Sensors Interface) module clock driver for sun[457]i

2016-04-07 Thread Yassin Jaffer
Hi Maxime

I had a look at your display clock driver.The only issue I have is setting 
the clock parents. A simple mask wont do it. 
I guess using table is the only way. The CSI is only clock which is using 
irregular parents mux. The remaining clocks
including VE, can be based on your display clock driver. 
Thanx.

On Monday, March 21, 2016 at 7:42:48 PM UTC+11, Maxime Ripard wrote:
>
> Hi Yassin, 
>
> On Thu, Mar 17, 2016 at 07:43:42PM +1100, yassin...@gmail.com 
>  wrote: 
> > From: Yassin Jaffer  
> > 
> > This patch adds a composite clock type consisting of 
> > a clock gate, mux, configurable dividers, and a reset control. 
> > 
> > Signed-off-by: Yassin Jaffer  
> > --- 
> >  Documentation/devicetree/bindings/clock/sunxi.txt |   1 + 
> >  drivers/clk/sunxi/Makefile|   1 + 
> >  drivers/clk/sunxi/clk-a10-csi.c   | 188 
> ++ 
> >  3 files changed, 190 insertions(+) 
> >  create mode 100644 drivers/clk/sunxi/clk-a10-csi.c 
> > 
> > diff --git a/Documentation/devicetree/bindings/clock/sunxi.txt 
> b/Documentation/devicetree/bindings/clock/sunxi.txt 
> > index e59f57b..c3826f7 100644 
> > --- a/Documentation/devicetree/bindings/clock/sunxi.txt 
> > +++ b/Documentation/devicetree/bindings/clock/sunxi.txt 
> > @@ -77,6 +77,7 @@ Required properties: 
> >  "allwinner,sun9i-a80-usb-mod-clk" - for usb gates + resets on 
> A80 
> >  "allwinner,sun9i-a80-usb-phy-clk" - for usb phy gates + resets 
> on A80 
> >  "allwinner,sun4i-a10-ve-clk" - for the Video Engine clock 
> > +"allwinner,sun4i-a10-csi-clk" - for the CSI module 
> >   
> >  Required properties for all clocks: 
> >  - reg : shall be the control register address for the clock. 
> > diff --git a/drivers/clk/sunxi/Makefile b/drivers/clk/sunxi/Makefile 
> > index 3fd7901..42ce752 100644 
> > --- a/drivers/clk/sunxi/Makefile 
> > +++ b/drivers/clk/sunxi/Makefile 
> > @@ -7,6 +7,7 @@ obj-y += clk-a10-codec.o 
> >  obj-y += clk-a10-hosc.o 
> >  obj-y += clk-a10-mod1.o 
> >  obj-y += clk-a10-pll2.o 
> > +obj-y += clk-a10-csi.o 
> >  obj-y += clk-a10-ve.o 
> >  obj-y += clk-a20-gmac.o 
> >  obj-y += clk-mod0.o 
> > diff --git a/drivers/clk/sunxi/clk-a10-csi.c 
> b/drivers/clk/sunxi/clk-a10-csi.c 
> > new file mode 100644 
> > index 000..f17d206 
> > --- /dev/null 
> > +++ b/drivers/clk/sunxi/clk-a10-csi.c 
> > @@ -0,0 +1,188 @@ 
> > +/* 
> > + * Copyright 2016 Yassin Jaffer 
> > + * 
> > + * Yassin Jaffer  
> > + * 
> > + * This program 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 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  
> > +#include  
> > +#include  
> > +#include  
> > +#include  
> > + 
> > +static DEFINE_SPINLOCK(sun4i_csi_lock); 
> > + 
> > +#define SUN4I_CSI_PARENTS   5 
> > +#define SUN4I_CSI_GATE_BIT  31 
> > +#define SUN4I_CSI_RESET_BIT 30 
> > +#define SUN4I_CSI_MUX_SHIFT 24 
> > +#define SUN4I_CSI_DIV_WIDTH 5 
> > +#define SUN4I_CSI_DIV_SHIFT 0 
> > + 
> > +static u32 sun4i_csi_mux_table[SUN4I_CSI_PARENTS] = { 
> > +0x0, 
> > +0x1, 
> > +0x2, 
> > +0x5, 
> > +0x6, 
> > +}; 
> > + 
> > +struct csi_reset_data { 
> > +void __iomem*reg; 
> > +spinlock_t*lock; /* lock for reset 
> handling */ 
> > +struct reset_controller_devrcdev; 
> > +}; 
> > + 
> > +static int sun4i_csi_assert(struct reset_controller_dev *rcdev, 
> > +unsigned long id) 
> > +{ 
> > +struct csi_reset_data *data = container_of(rcdev, 
> > +  struct 
> csi_reset_data, 
> > +  rcdev); 
> > +unsigned long flags; 
> > +u32 reg; 
> > + 
> > +spin_lock_irqsave(data->lock, flags); 
> > + 
> > +reg = readl(data->reg); 
> > +writel(reg & ~BIT(SUN4I_CSI_RESET_BIT), data->reg); 
> > + 
> > +spin_unlock_irqrestore(data->lock, flags); 
> > + 
> > +return 0; 
> > +} 
> > + 
> > +static int sun4i_csi_deassert(struct reset_controller_dev *rcdev, 
> > +  unsigned long id) 
> > +{ 
> > +struct csi_reset_data *data = container_of(rcdev, 
> > +  struct 
> csi_reset_data, 
> > +  rcdev); 
> > +unsigned long 

[linux-sunxi] Re: [PATCH 00/12] mtd: get rid of of_mtd.{c,h} and of_get_nand_xx()

2016-04-07 Thread Franklin S Cooper Jr.


On 04/01/2016 07:54 AM, Boris Brezillon wrote:
> Hello,
> 
> of_mtd.{h,c} are providing the of_get_nand_xxx() helpers to help NAND
> controller drivers parse some generic NAND DT properties.
> An infrastructure has recently been added to NAND core to automatically
> parse those properties when nand_scan_ident() is called, thus removing
> the need for NAND controller drivers to manually parse them.
> 
> This series modifies drivers still making use of those helpers to rely
> on NAND core initialization, and get rid of the of_mtd.{c,h} files by
> moving the of_get_nand_xx() helpers into nand_base.c.
> 

Nothing broke when I ran some NAND tests on my AM335x GP EVM (OMAP SOC).
Tested-by: Franklin S Cooper Jr. 

> Best Regards,
> 
> Boris
> 
> Boris Brezillon (12):
>   mtd: nand: remove unneeded of_mtd.h inclusions
>   mtd: nand: atmel: rely on generic DT parsing done in nand_scan_ident()
>   mtd: nand: omap2: rely on generic DT parsing done in nand_scan_ident()
>   mtd: nand: brcm: rely on generic DT parsing done in nand_scan_ident()
>   mtd: nand: davinci: rely on generic DT parsing done in
> nand_scan_ident()
>   mtd: nand: gpmi: rely on generic DT parsing done in nand_scan_ident()
>   mtd: nand: hisi504: rely on generic DT parsing done in
> nand_scan_ident()
>   mtd: nand: lpc32xx: rely on generic DT parsing done in
> nand_scan_ident()
>   mtd: nand: mxc: rely on generic DT parsing done in nand_scan_ident()
>   mtd: nand: pxa3xx: rely on generic DT parsing done in
> nand_scan_ident()
>   mtd: nand: sh_flctl: rely on generic DT parsing done in
> nand_scan_ident()
>   mtd: nand: move of_get_nand_xxx() helpers into nand_base.c
> 
>  drivers/memory/omap-gpmc.c |   7 --
>  drivers/mtd/nand/atmel_nand.c  | 133 +++-
>  drivers/mtd/nand/brcmnand/brcmnand.c   |   5 +-
>  drivers/mtd/nand/davinci_nand.c|  85 +-
>  drivers/mtd/nand/gpmi-nand/gpmi-nand.c |  21 +++--
>  drivers/mtd/nand/hisi504_nand.c|  14 +--
>  drivers/mtd/nand/jz4780_nand.c |   1 -
>  drivers/mtd/nand/lpc32xx_mlc.c |   1 -
>  drivers/mtd/nand/lpc32xx_slc.c |  24 ++---
>  drivers/mtd/nand/mxc_nand.c|  50 +--
>  drivers/mtd/nand/nand_base.c   |  99 -
>  drivers/mtd/nand/omap2.c   |   9 +-
>  drivers/mtd/nand/pxa3xx_nand.c |  28 +++---
>  drivers/mtd/nand/qcom_nandc.c  |   1 -
>  drivers/mtd/nand/sh_flctl.c|  31 +++
>  drivers/mtd/nand/sunxi_nand.c  |   1 -
>  drivers/mtd/nand/vf610_nfc.c   |   1 -
>  drivers/of/Makefile|   1 -
>  drivers/of/of_mtd.c| 155 
> -
>  include/linux/of_mtd.h |  56 
>  20 files changed, 291 insertions(+), 432 deletions(-)
>  delete mode 100644 drivers/of/of_mtd.c
>  delete mode 100644 include/linux/of_mtd.h
> 

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.