[linux-sunxi] Re: [PATCH v3 4/4] regulator: axp20x: add the AXP813

2016-09-23 Thread Rob Herring
On Fri, Sep 23, 2016 at 09:22:41AM +0200, Jean-Francois Moine wrote:
> The X-Powers AXP813 PMIC is close to the AXP803.
> It is used in some Allwinner boards as the Sinovoip BananaPi M3+.
> 
> Signed-off-by: Jean-Francois Moine 
> ---
>  Documentation/devicetree/bindings/mfd/axp20x.txt |   9 +-
>  drivers/mfd/axp20x.c |   2 +
>  drivers/regulator/Makefile   |   2 +-
>  drivers/regulator/axp813.c   | 229 
> +++
>  include/linux/mfd/axp20x.h   |   1 +
>  5 files changed, 239 insertions(+), 4 deletions(-)
>  create mode 100644 drivers/regulator/axp813.c
> 
> diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt 
> b/Documentation/devicetree/bindings/mfd/axp20x.txt
> index 3332d02..62019fb 100644
> --- a/Documentation/devicetree/bindings/mfd/axp20x.txt
> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> @@ -8,11 +8,12 @@ axp221 (X-Powers)
>  axp223 (X-Powers)
>  axp803 (X-Powers)
>  axp809 (X-Powers)
> +axp813 (X-Powers)
>  
>  Required properties:
>  - compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
> "x-powers,axp221", "x-powers,axp223", "x-powers,axp803",
> -   "x-powers,axp806", "x-powers,axp809"
> +   "x-powers,axp806", "x-powers,axp809", "x-powers,axp813"

Same comment here.

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 v3 3/4] regulator: axp20x: add the AXP803

2016-09-23 Thread Rob Herring
On Fri, Sep 23, 2016 at 09:00:42AM +0200, Jean-Francois Moine wrote:
> The X-Powers AXP803 PMIC is close to the AXP809 with more outputs.
> It is used in some Allwinner boards as the Sinovoip BananaPi M64
> and the Pine A64.
> 
> Signed-off-by: Jean-Francois Moine 
> ---
> not tested
> ---
>  Documentation/devicetree/bindings/mfd/axp20x.txt |  32 +++-
>  drivers/mfd/axp20x.c |  13 ++
>  drivers/regulator/Makefile   |   3 +-
>  drivers/regulator/axp803.c   | 225 
> +++
>  include/linux/mfd/axp20x.h   |   1 +
>  5 files changed, 271 insertions(+), 3 deletions(-)
>  create mode 100644 drivers/regulator/axp803.c
> 
> diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt 
> b/Documentation/devicetree/bindings/mfd/axp20x.txt
> index 8f3ad9a..3332d02 100644
> --- a/Documentation/devicetree/bindings/mfd/axp20x.txt
> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> @@ -6,12 +6,13 @@ axp202 (X-Powers)
>  axp209 (X-Powers)
>  axp221 (X-Powers)
>  axp223 (X-Powers)
> +axp803 (X-Powers)
>  axp809 (X-Powers)
>  
>  Required properties:
>  - compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
> -   "x-powers,axp221", "x-powers,axp223", "x-powers,axp806",
> -   "x-powers,axp809"
> +   "x-powers,axp221", "x-powers,axp223", "x-powers,axp803",
> +   "x-powers,axp806", "x-powers,axp809"

If you respin this, please reformat this to one per line.

Acked-by: Rob Herring 

>  - reg: The I2C slave address or RSB hardware address for the AXP chip
>  - interrupt-parent: The parent interrupt controller
>  - interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
> @@ -86,6 +87,33 @@ LDO_IO1: LDO   : ips-supply
> : GPIO 1
>  RTC_LDO  : LDO   : ips-supply: always on
>  DRIVEVBUS: Enable output : drivevbus-supply  : external regulator
>  
> +AXP803 regulators, type, and corresponding input supply names:
> +
> +Regulator  TypeSupply Name Notes
> +-  --- -
> +DCDC1: DC-DC buck: vin1-supply
> +DCDC2: DC-DC buck: vin2-supply
> +DCDC3: DC-DC buck: vin3-supply
> +DCDC4: DC-DC buck: vin4-supply
> +DCDC5: DC-DC buck: vin5-supply
> +DCDC6: DC-DC buck: vin6-supply
> +ALDO1: LDO   : aldoin-supply : shared supply
> +ALDO2: LDO   : aldoin-supply : shared supply
> +ALDO3: LDO   : aldoin-supply : shared supply
> +DLDO1: LDO   : dldoin-supply : shared supply
> +DLDO2: LDO   : dldoin-supply : shared supply
> +DLDO3: LDO   : dldoin-supply : shared supply
> +DLDO4: LDO   : dldoin-supply : shared supply
> +ELDO1: LDO   : eldoin-supply : shared supply
> +ELDO2: LDO   : eldoin-supply : shared supply
> +ELDO3: LDO   : eldoin-supply : shared supply
> +FLDO1: LDO   : fldoin-supply : shared supply
> +FLDO2: LDO   : fldoin-supply : shared supply
> +RTC_LDO  : LDO   : ips-supply: always on
> +LDO_IO0  : LDO   : ips-supply: GPIO 0
> +LDO_IO1  : LDO   : ips-supply: GPIO 1
> +DC1SW: On/Off Switch :   : DCDC1 secondary output
> +
>  AXP806 regulators, type, and corresponding input supply names:
>  
>  Regulator  TypeSupply Name Notes

-- 
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.


Re: [linux-sunxi] SPI in Linux 4.8.0-rc6: Weird dip in SCLK right when slave select goes low

2016-09-23 Thread Siarhei Siamashka
On Fri, 23 Sep 2016 10:48:11 +0300
Maxime Ripard  wrote:

> On Fri, Sep 23, 2016 at 04:03:57AM +0300, Siarhei Siamashka wrote:
> > On Thu, 22 Sep 2016 23:52:52 +0200
> > Danny Milosavljevic  wrote:
> >   
> > > Hello,
> > > 
> > > when using SPI on Allwinner A20 with CPOL=1 and CPHA=1 with Linux 
> > > 4.8.0-rc6 Psychotic Stoned Sheep I see a weird dip in the beginning 
> > > (which also confuses the slave) on the SCLK line right when SSEL goes low 
> > > - see attachment.
> > > 
> > > The lines are, starting from the top, SCLK MOSI MISO SSEL.
> > > 
> > > I'm using spidev.
> > > 
> > > Did anyone see this problem before?  
> > 
> > Hi,
> > 
> > I'm not sure, but something like this might be somehow related:
> > https://patchwork.kernel.org/patch/7960811/
> >
> > As a random thing to check, I would also advise to verify the
> > pull-up/pull-down settings for the SCLK pin.
> > 
> > And maybe as another test, change the driver to automatically
> > drive the SSEL pin instead of doing this manually.  
> 
> We cannot do that

Well, of course we can do that. At least for the troubleshooting
purposes. And it's somewhat better than giving up and just going
to cry in a corner ;-)

> this would break the framework's expectations with
> the behaviour you're suposed to have in set_cs (which is why we ended
> up using the manual mode), and especially that it's supposed to happen
> right away and control the logical level of the CS line.

My understanding is that the framework is probably designed this way
in order to be able to use any *arbitrary* GPIO pin for the chip
select role. But the SPI controller itself can take care of the
*dedicated* chip select pin and assert/deassert it before/after
doing SPI message transfers. Patching the driver (again, only as a
troubleshooting experiment) should be relatively easy: the code
that changes the CS pin state just needs to be commented out and
the manual mode disabled.

My random guess about what might be happening is the following:
The SoC has a weak pull-up for the SCLK pin. And the slave device
has this pin in a high impedance state when the chip select pin
is deasserted. But after the SPI driver manually asserts the chip
select pin, the slave device probably changes the SCLK pin to
a strong pull-down state, overpowering the SoC pull-up for a
while. Then the SPI message transfer gets started by the SPI
driver and the SPI controller starts driving the SCLK pin for
real. Again, this is only a random guess and it definitely needs
to be verified.

Only Danny is lucky enough to have the right tools and a perfectly
reproducible test case. We can think about a proper fix (compatible
with the framework expectations) after we figure out what is actually
going on.

-- 
Best regards,
Siarhei Siamashka

-- 
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 v5 1/3] ASoC: sun4i-codec: Rename sun4i_codec_widgets for consistency

2016-09-23 Thread Maxime Ripard
Hi,

On Thu, Sep 22, 2016 at 09:13:11AM +0200, Danny Milosavljevic wrote:
> ASoC: sun4i-codec: Rename "sun4i_codec_widgets" to "sun4i_codec_controls" for
> consistency with the struct field name.

Your commit log still has the flaws your other patches had in the
previous version.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

-- 
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.


signature.asc
Description: PGP signature


Re: [linux-sunxi] Get SoC temperature and cpu frequency on SinA33

2016-09-23 Thread Maxime Ripard
Hi Ciprian,

On Fri, Sep 23, 2016 at 04:13:27AM -0700, Ciprian Manea wrote:
>   
>I'm trying to determine the thermal throttling  on the A33, but in order 
> to do that I  need to read the 
> cpu frequency and the SoC temperature.
> 
>   But I see no entry in the sysfs related to the soc temp or cpu freq..
> 
> Anyone knows if there is any work done in this direction or how to enable 
> these features ?

CPUFreq and thermal throttling is not implemented at the
moment. Quentin's work here: 
http://lists.infradead.org/pipermail/linux-arm-kernel/2016-September/453203.html

should be a great introduction for the CPU temperature readout, and we
can probably reuse the work that has been done for the A31 for cpufreq.

Maxime


-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

-- 
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.


signature.asc
Description: PGP signature


[linux-sunxi] Get SoC temperature and cpu frequency on SinA33

2016-09-23 Thread Ciprian Manea
  
   I'm trying to determine the thermal throttling  on the A33, but in order 
to do that I  need to read the 
cpu frequency and the SoC temperature.

  But I see no entry in the sysfs related to the soc temp or cpu freq..

Anyone knows if there is any work done in this direction or how to enable 
these features ?

Thanks

-- 
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] [PATCH v3 3/4] regulator: axp20x: add the AXP803

2016-09-23 Thread Jean-Francois Moine
The X-Powers AXP803 PMIC is close to the AXP809 with more outputs.
It is used in some Allwinner boards as the Sinovoip BananaPi M64
and the Pine A64.

Signed-off-by: Jean-Francois Moine 
---
not tested
---
 Documentation/devicetree/bindings/mfd/axp20x.txt |  32 +++-
 drivers/mfd/axp20x.c |  13 ++
 drivers/regulator/Makefile   |   3 +-
 drivers/regulator/axp803.c   | 225 +++
 include/linux/mfd/axp20x.h   |   1 +
 5 files changed, 271 insertions(+), 3 deletions(-)
 create mode 100644 drivers/regulator/axp803.c

diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt 
b/Documentation/devicetree/bindings/mfd/axp20x.txt
index 8f3ad9a..3332d02 100644
--- a/Documentation/devicetree/bindings/mfd/axp20x.txt
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -6,12 +6,13 @@ axp202 (X-Powers)
 axp209 (X-Powers)
 axp221 (X-Powers)
 axp223 (X-Powers)
+axp803 (X-Powers)
 axp809 (X-Powers)
 
 Required properties:
 - compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
- "x-powers,axp221", "x-powers,axp223", "x-powers,axp806",
- "x-powers,axp809"
+ "x-powers,axp221", "x-powers,axp223", "x-powers,axp803",
+ "x-powers,axp806", "x-powers,axp809"
 - reg: The I2C slave address or RSB hardware address for the AXP chip
 - interrupt-parent: The parent interrupt controller
 - interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
@@ -86,6 +87,33 @@ LDO_IO1  : LDO   : ips-supply
: GPIO 1
 RTC_LDO: LDO   : ips-supply: always on
 DRIVEVBUS  : Enable output : drivevbus-supply  : external regulator
 
+AXP803 regulators, type, and corresponding input supply names:
+
+RegulatorTypeSupply Name Notes
+---- -
+DCDC1  : DC-DC buck: vin1-supply
+DCDC2  : DC-DC buck: vin2-supply
+DCDC3  : DC-DC buck: vin3-supply
+DCDC4  : DC-DC buck: vin4-supply
+DCDC5  : DC-DC buck: vin5-supply
+DCDC6  : DC-DC buck: vin6-supply
+ALDO1  : LDO   : aldoin-supply : shared supply
+ALDO2  : LDO   : aldoin-supply : shared supply
+ALDO3  : LDO   : aldoin-supply : shared supply
+DLDO1  : LDO   : dldoin-supply : shared supply
+DLDO2  : LDO   : dldoin-supply : shared supply
+DLDO3  : LDO   : dldoin-supply : shared supply
+DLDO4  : LDO   : dldoin-supply : shared supply
+ELDO1  : LDO   : eldoin-supply : shared supply
+ELDO2  : LDO   : eldoin-supply : shared supply
+ELDO3  : LDO   : eldoin-supply : shared supply
+FLDO1  : LDO   : fldoin-supply : shared supply
+FLDO2  : LDO   : fldoin-supply : shared supply
+RTC_LDO: LDO   : ips-supply: always on
+LDO_IO0: LDO   : ips-supply: GPIO 0
+LDO_IO1: LDO   : ips-supply: GPIO 1
+DC1SW  : On/Off Switch :   : DCDC1 secondary output
+
 AXP806 regulators, type, and corresponding input supply names:
 
 RegulatorTypeSupply Name Notes
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index ba130be..7c90b12 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -38,6 +38,7 @@ static const char * const axp20x_model_names[] = {
"AXP221",
"AXP223",
"AXP288",
+   "AXP803",
"AXP806",
"AXP809",
 };
@@ -739,6 +740,14 @@ static struct mfd_cell axp809_cells[] = {
},
 };
 
+static struct mfd_cell axp803_cells[] = {
+   {
+   .name   = "axp20x-pek",
+   .num_resources  = ARRAY_SIZE(axp809_pek_resources),
+   .resources  = axp809_pek_resources,
+   },
+};
+
 static struct axp20x_dev *axp20x_pm_power_off;
 static void axp20x_power_off(void)
 {
@@ -801,6 +810,10 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
axp20x->regmap_cfg = _regmap_config;
axp20x->regmap_irq_chip = _regmap_irq_chip;
break;
+   case AXP803_ID:
+   axp20x->cells = axp803_cells;
+   axp20x->nr_cells = ARRAY_SIZE(axp803_cells);
+   break;
case AXP806_ID:
axp20x->nr_cells = ARRAY_SIZE(axp806_cells);
axp20x->cells = axp806_cells;
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 225a026..2cbb280 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -21,7 +21,8 @@ obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
 obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
 

[linux-sunxi] [PATCH v3 1/4] regulator: axp20x: move device independant parts to new files

2016-09-23 Thread Jean-Francois Moine
The axp20x driver contains device specific and device independant parts.
This patch moves the independant parts to new .c/.h files.

Signed-off-by: Jean-Francois Moine 
---
 drivers/regulator/Makefile   |   2 +-
 drivers/regulator/axp-regulator.c| 308 ++
 drivers/regulator/axp-regulator.h| 127 +++
 drivers/regulator/axp20x-regulator.c | 415 +++
 4 files changed, 464 insertions(+), 388 deletions(-)
 create mode 100644 drivers/regulator/axp-regulator.c
 create mode 100644 drivers/regulator/axp-regulator.h

diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 2142a5d..225a026 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -21,7 +21,7 @@ obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
 obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
 obj-$(CONFIG_REGULATOR_AS3711) += as3711-regulator.o
 obj-$(CONFIG_REGULATOR_AS3722) += as3722-regulator.o
-obj-$(CONFIG_REGULATOR_AXP20X) += axp20x-regulator.o
+obj-$(CONFIG_REGULATOR_AXP20X) += axp20x-regulator.o axp-regulator.o
 obj-$(CONFIG_REGULATOR_BCM590XX) += bcm590xx-regulator.o
 obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
 obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o
diff --git a/drivers/regulator/axp-regulator.c 
b/drivers/regulator/axp-regulator.c
new file mode 100644
index 000..0d7adb6
--- /dev/null
+++ b/drivers/regulator/axp-regulator.c
@@ -0,0 +1,308 @@
+/*
+ * AXP regulators driver
+ *
+ * Copyright (C) 2016 Jean-Francois Moine 
+ * Copyright (C) 2013 Carlo Caione 
+ *
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "axp-regulator.h"
+
+#define AXP20X_WORKMODE_DCDC2_MASK BIT(2)
+#define AXP20X_WORKMODE_DCDC3_MASK BIT(1)
+#define AXP22X_WORKMODE_DCDCX_MASK(x)  BIT(x)
+
+#define AXP20X_FREQ_DCDC_MASK  0x0f
+
+#define AXP22X_MISC_N_VBUSEN_FUNC  BIT(4)
+
+const struct regulator_ops axp_ops_fixed = {
+   .list_voltage   = regulator_list_voltage_linear,
+};
+EXPORT_SYMBOL_GPL(axp_ops_fixed);
+
+const struct regulator_ops axp_ops_range = {
+   .set_voltage_sel= regulator_set_voltage_sel_regmap,
+   .get_voltage_sel= regulator_get_voltage_sel_regmap,
+   .list_voltage   = regulator_list_voltage_linear_range,
+   .enable = regulator_enable_regmap,
+   .disable= regulator_disable_regmap,
+   .is_enabled = regulator_is_enabled_regmap,
+};
+EXPORT_SYMBOL_GPL(axp_ops_range);
+
+const struct regulator_ops axp_ops = {
+   .set_voltage_sel= regulator_set_voltage_sel_regmap,
+   .get_voltage_sel= regulator_get_voltage_sel_regmap,
+   .list_voltage   = regulator_list_voltage_linear,
+   .enable = regulator_enable_regmap,
+   .disable= regulator_disable_regmap,
+   .is_enabled = regulator_is_enabled_regmap,
+};
+EXPORT_SYMBOL_GPL(axp_ops);
+
+const struct regulator_ops axp_ops_sw = {
+   .enable = regulator_enable_regmap,
+   .disable= regulator_disable_regmap,
+   .is_enabled = regulator_is_enabled_regmap,
+};
+EXPORT_SYMBOL_GPL(axp_ops_sw);
+
+static const struct regulator_desc axp22x_drivevbus_regulator = {
+   .name   = "drivevbus",
+   .supply_name= "drivevbus",
+   .of_match   = of_match_ptr("drivevbus"),
+   .regulators_node = of_match_ptr("regulators"),
+   .type   = REGULATOR_VOLTAGE,
+   .owner  = THIS_MODULE,
+   .enable_reg = AXP20X_VBUS_IPSOUT_MGMT,
+   .enable_mask= BIT(2),
+   .ops= _ops_sw,
+};
+
+static int axp_set_dcdc_freq(struct device *dev,
+   u32 dcdcfreq)
+{
+   struct axp20x_dev *axp20x = dev_get_drvdata(dev);
+   unsigned int reg = AXP20X_DCDC_FREQ;
+   u32 min, max, def, step;
+
+   switch (axp20x->variant) {
+   case AXP202_ID:
+   case AXP209_ID:
+   min = 750;
+   max = 1875;
+   def = 1500;
+   step = 75;
+   break;
+   case AXP806_ID:
+   /*
+* AXP806 DCDC work frequency setting has the same range and
+* step as AXP22X, but at a different register.
+* Fall through to the check below.
+* (See include/linux/mfd/axp20x.h)
+*/
+   reg = AXP806_DCDC_FREQ_CTRL;
+   case AXP221_ID:
+   case AXP223_ID:
+   case AXP809_ID:
+   min = 

[linux-sunxi] [PATCH v3 2/4] regulator: axp20x: duplicate the MFD axp20x-rsb code

2016-09-23 Thread Jean-Francois Moine
The axp20x rsb driver handles many different devices.
Duplicating its code in a generic regulator driver permits
to probe/remove individual devices.

Signed-off-by: Jean-Francois Moine 
---
 drivers/regulator/axp-regulator.c | 39 +++
 drivers/regulator/axp-regulator.h |  6 ++
 2 files changed, 45 insertions(+)

diff --git a/drivers/regulator/axp-regulator.c 
b/drivers/regulator/axp-regulator.c
index 0d7adb6..17943fb 100644
--- a/drivers/regulator/axp-regulator.c
+++ b/drivers/regulator/axp-regulator.c
@@ -303,6 +303,45 @@ int axp_regulator_create(struct device *dev,
 }
 EXPORT_SYMBOL_GPL(axp_regulator_create);
 
+/* probe/remove RSB devices */
+int axp_rsb_probe(struct sunxi_rsb_device *rdev,
+ struct axp20x_dev *axp20x,
+ const struct axp_cfg *axp_cfg)
+{
+   int ret;
+
+   axp20x->dev = >dev;
+   axp20x->irq = rdev->irq;
+   dev_set_drvdata(>dev, axp20x);
+
+   ret = axp20x_match_device(axp20x);
+   if (ret)
+   return ret;
+
+   axp20x->regmap = devm_regmap_init_sunxi_rsb(rdev,
+   axp20x->regmap_cfg);
+   if (IS_ERR(axp20x->regmap)) {
+   ret = PTR_ERR(axp20x->regmap);
+   dev_err(>dev, "regmap init failed: %d\n", ret);
+   return ret;
+   }
+
+   ret = axp20x_device_probe(axp20x);
+   if (ret < 0)
+   return ret;
+
+   return axp_regulator_create(>dev, axp_cfg);
+}
+EXPORT_SYMBOL_GPL(axp_rsb_probe);
+
+int axp_rsb_remove(struct sunxi_rsb_device *rdev)
+{
+   struct axp20x_dev *axp20x = sunxi_rsb_device_get_drvdata(rdev);
+
+   return axp20x_device_remove(axp20x);
+}
+EXPORT_SYMBOL_GPL(axp_rsb_remove);
+
 MODULE_AUTHOR("Carlo Caione ");
 MODULE_DESCRIPTION("Regulator Module for AXP PMIC");
 MODULE_LICENSE("GPL v2");
diff --git a/drivers/regulator/axp-regulator.h 
b/drivers/regulator/axp-regulator.h
index 0adf1b0..085eaa0 100644
--- a/drivers/regulator/axp-regulator.h
+++ b/drivers/regulator/axp-regulator.h
@@ -124,4 +124,10 @@ struct axp_cfg {
 int axp_regulator_create(struct device *dev,
 const struct axp_cfg *axp_cfg);
 
+struct sunxi_rsb_device;
+int axp_rsb_probe(struct sunxi_rsb_device *rdev,
+ struct axp20x_dev *axp20x,
+ const struct axp_cfg *axp_cfg);
+int axp_rsb_remove(struct sunxi_rsb_device *rdev);
+
 #endif /* __AXP_REGULATOR_H__ */
-- 
2.10.0

-- 
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] [PATCH v3 4/4] regulator: axp20x: add the AXP813

2016-09-23 Thread Jean-Francois Moine
The X-Powers AXP813 PMIC is close to the AXP803.
It is used in some Allwinner boards as the Sinovoip BananaPi M3+.

Signed-off-by: Jean-Francois Moine 
---
 Documentation/devicetree/bindings/mfd/axp20x.txt |   9 +-
 drivers/mfd/axp20x.c |   2 +
 drivers/regulator/Makefile   |   2 +-
 drivers/regulator/axp813.c   | 229 +++
 include/linux/mfd/axp20x.h   |   1 +
 5 files changed, 239 insertions(+), 4 deletions(-)
 create mode 100644 drivers/regulator/axp813.c

diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt 
b/Documentation/devicetree/bindings/mfd/axp20x.txt
index 3332d02..62019fb 100644
--- a/Documentation/devicetree/bindings/mfd/axp20x.txt
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -8,11 +8,12 @@ axp221 (X-Powers)
 axp223 (X-Powers)
 axp803 (X-Powers)
 axp809 (X-Powers)
+axp813 (X-Powers)
 
 Required properties:
 - compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
  "x-powers,axp221", "x-powers,axp223", "x-powers,axp803",
- "x-powers,axp806", "x-powers,axp809"
+ "x-powers,axp806", "x-powers,axp809", "x-powers,axp813"
 - reg: The I2C slave address or RSB hardware address for the AXP chip
 - interrupt-parent: The parent interrupt controller
 - interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
@@ -87,7 +88,7 @@ LDO_IO1   : LDO   : ips-supply
: GPIO 1
 RTC_LDO: LDO   : ips-supply: always on
 DRIVEVBUS  : Enable output : drivevbus-supply  : external regulator
 
-AXP803 regulators, type, and corresponding input supply names:
+AXP803/AXP813 regulators, type, and corresponding input supply names:
 
 RegulatorTypeSupply Name Notes
 ---- -
@@ -97,6 +98,7 @@ DCDC3 : DC-DC buck: vin3-supply
 DCDC4  : DC-DC buck: vin4-supply
 DCDC5  : DC-DC buck: vin5-supply
 DCDC6  : DC-DC buck: vin6-supply
+DCDC7  : DC-DC buck: vin7-supply   : (813 only)
 ALDO1  : LDO   : aldoin-supply : shared supply
 ALDO2  : LDO   : aldoin-supply : shared supply
 ALDO3  : LDO   : aldoin-supply : shared supply
@@ -109,10 +111,11 @@ ELDO2 : LDO   : eldoin-supply : 
shared supply
 ELDO3  : LDO   : eldoin-supply : shared supply
 FLDO1  : LDO   : fldoin-supply : shared supply
 FLDO2  : LDO   : fldoin-supply : shared supply
+FLDO3  : LDO   : fldoin-supply : shared supply (813 only)
 RTC_LDO: LDO   : ips-supply: always on
 LDO_IO0: LDO   : ips-supply: GPIO 0
 LDO_IO1: LDO   : ips-supply: GPIO 1
-DC1SW  : On/Off Switch :   : DCDC1 secondary output
+DC1SW  : On/Off Switch :   : DCDC1 secondary output (803 
only)
 
 AXP806 regulators, type, and corresponding input supply names:
 
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 7c90b12..4f2303d 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -41,6 +41,7 @@ static const char * const axp20x_model_names[] = {
"AXP803",
"AXP806",
"AXP809",
+   "AXP813",
 };
 
 static const struct regmap_range axp152_writeable_ranges[] = {
@@ -811,6 +812,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
axp20x->regmap_irq_chip = _regmap_irq_chip;
break;
case AXP803_ID:
+   case AXP813_ID:
axp20x->cells = axp803_cells;
axp20x->nr_cells = ARRAY_SIZE(axp803_cells);
break;
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 2cbb280..a678ba6 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -22,7 +22,7 @@ obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o 
arizona-ldo1.o
 obj-$(CONFIG_REGULATOR_AS3711) += as3711-regulator.o
 obj-$(CONFIG_REGULATOR_AS3722) += as3722-regulator.o
 obj-$(CONFIG_REGULATOR_AXP20X) += axp20x-regulator.o axp-regulator.o \
-   axp803.o
+   axp803.o axp813.o
 obj-$(CONFIG_REGULATOR_BCM590XX) += bcm590xx-regulator.o
 obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
 obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o
diff --git a/drivers/regulator/axp813.c b/drivers/regulator/axp813.c
new file mode 100644
index 000..99bfaaa
--- /dev/null
+++ b/drivers/regulator/axp813.c
@@ -0,0 +1,229 @@
+/*
+ * AXP813 regulator driver
+ *
+ * Copyright (C) 2016 Jean-Francois Moine 
+ *
+ * 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 

[linux-sunxi] [PATCH v3 0/4] regulator: axp20x: support AXP803/AXP813 variants

2016-09-23 Thread Jean-Francois Moine
This patch series adds support for the X-Powers AXP803 and AXP813 PMICs.
It is based on the previous patch series
regulator: axp20x: Simplify various code

v3:
- put the code of the new devices in new files instead of in the common
  axp20x file.
- fix errors about the regulators and interrupts
v2:
- fix lack of support of dcdc frequency
- notice that the AXP803 is also handled
- send the patch to the DT maintainers

Jean-Francois Moine (4):
  regulator: axp20x: move device independant parts to new files
  regulator: axp20x: duplicate the MFD axp20x-rsb code
  regulator: axp20x: add the AXP803
  regulator: axp20x: add the AXP813

 Documentation/devicetree/bindings/mfd/axp20x.txt |  29 ++-
 drivers/mfd/axp20x.c |  15 +
 drivers/regulator/Makefile   |   3 +-
 drivers/regulator/axp-regulator.c| 347 +++
 drivers/regulator/axp-regulator.h| 133 
 drivers/regulator/axp20x-regulator.c | 415 ++-
 drivers/regulator/axp803.c   | 225 
 drivers/regulator/axp813.c   | 229 +
 include/linux/mfd/axp20x.h   |   2 +
 9 files changed, 1012 insertions(+), 388 deletions(-)
 create mode 100644 drivers/regulator/axp-regulator.c
 create mode 100644 drivers/regulator/axp-regulator.h
 create mode 100644 drivers/regulator/axp803.c
 create mode 100644 drivers/regulator/axp813.c

-- 
2.10.0

-- 
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] [PATCH 1/3] regulator: axp20x: simplify poly-phase handling

2016-09-23 Thread Jean-Francois Moine
Building a list (bitmap) of the slaves included in poly-phase groups
at probe startup time simplifies the treatment in the regulator
creation loop.

Signed-off-by: Jean-Francois Moine 
---
 drivers/regulator/axp20x-regulator.c | 45 +---
 1 file changed, 21 insertions(+), 24 deletions(-)

diff --git a/drivers/regulator/axp20x-regulator.c 
b/drivers/regulator/axp20x-regulator.c
index 54382ef..4e5e7c8 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -477,30 +477,24 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev 
*rdev, int id, u32 work
 }
 
 /*
- * This function checks whether a regulator is part of a poly-phase
- * output setup based on the registers settings. Returns true if it is.
+ * This function checks which regulators are part of poly-phase
+ * output setups based on the registers settings.
+ * Returns a bitmap of these regulators.
  */
-static bool axp20x_is_polyphase_slave(struct axp20x_dev *axp20x, int id)
+static u32 axp20x_polyphase_slave(struct axp20x_dev *axp20x)
 {
-   u32 reg = 0;
-
-   /* Only AXP806 has poly-phase outputs */
-   if (axp20x->variant != AXP806_ID)
-   return false;
+   u32 reg = 0, bitmap = 0;
 
regmap_read(axp20x->regmap, AXP806_DCDC_MODE_CTRL2, );
 
-   switch (id) {
-   case AXP806_DCDCB:
-   return (((reg & GENMASK(7, 6)) == BIT(6)) ||
-   ((reg & GENMASK(7, 6)) == BIT(7)));
-   case AXP806_DCDCC:
-   return ((reg & GENMASK(7, 6)) == BIT(7));
-   case AXP806_DCDCE:
-   return !!(reg & BIT(5));
-   }
+   if ((reg & GENMASK(7, 6)) == BIT(5))
+   bitmap |= 1 << AXP806_DCDCE;
+   if ((reg & GENMASK(7, 6)) == BIT(6))
+   bitmap |= 1 << AXP806_DCDCB;
+   if ((reg & GENMASK(7, 6)) == BIT(7))
+   bitmap |= (1 << AXP806_DCDCB) | (1 << AXP806_DCDCC);
 
-   return false;
+   return bitmap;
 }
 
 static int axp20x_regulator_probe(struct platform_device *pdev)
@@ -518,6 +512,7 @@ static int axp20x_regulator_probe(struct platform_device 
*pdev)
const char *dcdc1_name = axp22x_regulators[AXP22X_DCDC1].name;
const char *dcdc5_name = axp22x_regulators[AXP22X_DCDC5].name;
bool drivevbus = false;
+   u32 skip_bitmap = 0;
 
switch (axp20x->variant) {
case AXP202_ID:
@@ -535,6 +530,13 @@ static int axp20x_regulator_probe(struct platform_device 
*pdev)
case AXP806_ID:
regulators = axp806_regulators;
nregulators = AXP806_REG_ID_MAX;
+
+   /*
+* The regulators which are slave in a poly-phase setup
+* are skipped, as their controls are bound to the master
+* regulator and won't work.
+*/
+   skip_bitmap |= axp20x_polyphase_slave(axp20x);
break;
case AXP809_ID:
regulators = axp809_regulators;
@@ -553,12 +555,7 @@ static int axp20x_regulator_probe(struct platform_device 
*pdev)
const struct regulator_desc *desc = [i];
struct regulator_desc *new_desc;
 
-   /*
-* If this regulator is a slave in a poly-phase setup,
-* skip it, as its controls are bound to the master
-* regulator and won't work.
-*/
-   if (axp20x_is_polyphase_slave(axp20x, i))
+   if (skip_bitmap & (1 << i))
continue;
 
/*
-- 
2.10.0

-- 
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] [PATCH 0/3] regulator: axp20x: Simplify various code

2016-09-23 Thread Jean-Francois Moine
This patch series just simplifies a bit the code of the AXP20x driver.
It does not contain any fonctional changes.
It will be used as a base for adding new AXP devices (patches to come).
It applies on linux-next.

Jean-Francois Moine (3):
  regulator: axp20x: simplify poly-phase handling
  regulator: axp20x: simplify the treatment of linked regulators
  regulator: axp20x: simplify device access

 drivers/regulator/axp20x-regulator.c | 114 ++-
 1 file changed, 60 insertions(+), 54 deletions(-)

-- 
2.10.0

-- 
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] [PATCH 2/3] regulator: axp20x: simplify the treatment of linked regulators

2016-09-23 Thread Jean-Francois Moine
Using ancillary variables for handling the linked regulators simplifies
the loop of regulator creation and makes easier the addition of new
regulator types.

Signed-off-by: Jean-Francois Moine 
---
 drivers/regulator/axp20x-regulator.c | 24 
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/regulator/axp20x-regulator.c 
b/drivers/regulator/axp20x-regulator.c
index 4e5e7c8..7405f5b 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -511,6 +511,10 @@ static int axp20x_regulator_probe(struct platform_device 
*pdev)
u32 workmode;
const char *dcdc1_name = axp22x_regulators[AXP22X_DCDC1].name;
const char *dcdc5_name = axp22x_regulators[AXP22X_DCDC5].name;
+   s8 dcdc1_ix = -1;
+   s8 dcdc5_ix = -1;
+   s8 dc1sw_ix = -1;
+   s8 dc5ldo_ix = -1;
bool drivevbus = false;
u32 skip_bitmap = 0;
 
@@ -524,6 +528,10 @@ static int axp20x_regulator_probe(struct platform_device 
*pdev)
case AXP223_ID:
regulators = axp22x_regulators;
nregulators = AXP22X_REG_ID_MAX;
+   dcdc1_ix = AXP22X_DCDC1;
+   dcdc5_ix = AXP22X_DCDC5;
+   dc1sw_ix = AXP22X_DC1SW;
+   dc5ldo_ix = AXP22X_DC5LDO;
drivevbus = of_property_read_bool(pdev->dev.parent->of_node,
  "x-powers,drive-vbus-en");
break;
@@ -541,6 +549,10 @@ static int axp20x_regulator_probe(struct platform_device 
*pdev)
case AXP809_ID:
regulators = axp809_regulators;
nregulators = AXP809_REG_ID_MAX;
+   dcdc1_ix = AXP809_DCDC1;
+   dcdc5_ix = AXP809_DCDC5;
+   dc1sw_ix = AXP809_DC1SW;
+   dc5ldo_ix = AXP809_DC5LDO;
break;
default:
dev_err(>dev, "Unsupported AXP variant: %ld\n",
@@ -567,8 +579,7 @@ static int axp20x_regulator_probe(struct platform_device 
*pdev)
 * part of this loop to see where we save the DT defined
 * name.
 */
-   if ((regulators == axp22x_regulators && i == AXP22X_DC1SW) ||
-   (regulators == axp809_regulators && i == AXP809_DC1SW)) {
+   if (i == dc1sw_ix && dcdc1_name) {
new_desc = devm_kzalloc(>dev, sizeof(*desc),
GFP_KERNEL);
*new_desc = regulators[i];
@@ -576,8 +587,7 @@ static int axp20x_regulator_probe(struct platform_device 
*pdev)
desc = new_desc;
}
 
-   if ((regulators == axp22x_regulators && i == AXP22X_DC5LDO) ||
-   (regulators == axp809_regulators && i == AXP809_DC5LDO)) {
+   if (i == dc5ldo_ix && dcdc5_name) {
new_desc = devm_kzalloc(>dev, sizeof(*desc),
GFP_KERNEL);
*new_desc = regulators[i];
@@ -605,14 +615,12 @@ static int axp20x_regulator_probe(struct platform_device 
*pdev)
/*
 * Save AXP22X DCDC1 / DCDC5 regulator names for later.
 */
-   if ((regulators == axp22x_regulators && i == AXP22X_DCDC1) ||
-   (regulators == axp809_regulators && i == AXP809_DCDC1))
+   if (i == dcdc1_ix)
of_property_read_string(rdev->dev.of_node,
"regulator-name",
_name);
 
-   if ((regulators == axp22x_regulators && i == AXP22X_DCDC5) ||
-   (regulators == axp809_regulators && i == AXP809_DCDC5))
+   if (i == dcdc5_ix)
of_property_read_string(rdev->dev.of_node,
"regulator-name",
_name);
-- 
2.10.0

-- 
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] [PATCH 3/3] regulator: axp20x: simplify device access

2016-09-23 Thread Jean-Francois Moine
Use the pointer to the main regulator device instead of the pointer
to the child platform device.

Signed-off-by: Jean-Francois Moine 
---
 drivers/regulator/axp20x-regulator.c | 45 ++--
 1 file changed, 23 insertions(+), 22 deletions(-)

diff --git a/drivers/regulator/axp20x-regulator.c 
b/drivers/regulator/axp20x-regulator.c
index 7405f5b..244ddc3 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -347,9 +347,9 @@ static const struct regulator_desc axp809_regulators[] = {
AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)),
 };
 
-static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
+static int axp20x_set_dcdc_freq(struct device *dev, u32 dcdcfreq)
 {
-   struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
+   struct axp20x_dev *axp20x = dev_get_drvdata(dev);
unsigned int reg = AXP20X_DCDC_FREQ;
u32 min, max, def, step;
 
@@ -378,7 +378,7 @@ static int axp20x_set_dcdc_freq(struct platform_device 
*pdev, u32 dcdcfreq)
step = 150;
break;
default:
-   dev_err(>dev,
+   dev_err(dev,
"Setting DCDC frequency for unsupported AXP variant\n");
return -EINVAL;
}
@@ -388,13 +388,13 @@ static int axp20x_set_dcdc_freq(struct platform_device 
*pdev, u32 dcdcfreq)
 
if (dcdcfreq < min) {
dcdcfreq = min;
-   dev_warn(>dev, "DCDC frequency too low. Set to %ukHz\n",
+   dev_warn(dev, "DCDC frequency too low. Set to %ukHz\n",
 min);
}
 
if (dcdcfreq > max) {
dcdcfreq = max;
-   dev_warn(>dev, "DCDC frequency too high. Set to %ukHz\n",
+   dev_warn(dev, "DCDC frequency too high. Set to %ukHz\n",
 max);
}
 
@@ -404,24 +404,24 @@ static int axp20x_set_dcdc_freq(struct platform_device 
*pdev, u32 dcdcfreq)
  AXP20X_FREQ_DCDC_MASK, dcdcfreq);
 }
 
-static int axp20x_regulator_parse_dt(struct platform_device *pdev)
+static int axp20x_regulator_parse_dt(struct device *dev)
 {
struct device_node *np, *regulators;
int ret;
u32 dcdcfreq = 0;
 
-   np = of_node_get(pdev->dev.parent->of_node);
+   np = of_node_get(dev->of_node);
if (!np)
return 0;
 
regulators = of_get_child_by_name(np, "regulators");
if (!regulators) {
-   dev_warn(>dev, "regulators node not found\n");
+   dev_warn(dev, "regulators node not found\n");
} else {
of_property_read_u32(regulators, "x-powers,dcdc-freq", 
);
-   ret = axp20x_set_dcdc_freq(pdev, dcdcfreq);
+   ret = axp20x_set_dcdc_freq(dev, dcdcfreq);
if (ret < 0) {
-   dev_err(>dev, "Error setting dcdc frequency: 
%d\n", ret);
+   dev_err(dev, "Error setting dcdc frequency: %d\n", ret);
return ret;
}
 
@@ -499,11 +499,12 @@ static u32 axp20x_polyphase_slave(struct axp20x_dev 
*axp20x)
 
 static int axp20x_regulator_probe(struct platform_device *pdev)
 {
+   struct device *dev = pdev->dev.parent;
struct regulator_dev *rdev;
-   struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
+   struct axp20x_dev *axp20x = dev_get_drvdata(dev);
const struct regulator_desc *regulators;
struct regulator_config config = {
-   .dev = pdev->dev.parent,
+   .dev = dev,
.regmap = axp20x->regmap,
.driver_data = axp20x,
};
@@ -532,7 +533,7 @@ static int axp20x_regulator_probe(struct platform_device 
*pdev)
dcdc5_ix = AXP22X_DCDC5;
dc1sw_ix = AXP22X_DC1SW;
dc5ldo_ix = AXP22X_DC5LDO;
-   drivevbus = of_property_read_bool(pdev->dev.parent->of_node,
+   drivevbus = of_property_read_bool(dev->of_node,
  "x-powers,drive-vbus-en");
break;
case AXP806_ID:
@@ -555,13 +556,13 @@ static int axp20x_regulator_probe(struct platform_device 
*pdev)
dc5ldo_ix = AXP809_DC5LDO;
break;
default:
-   dev_err(>dev, "Unsupported AXP variant: %ld\n",
+   dev_err(dev, "Unsupported AXP variant: %ld\n",
axp20x->variant);
return -EINVAL;
}
 
/* This only sets the dcdc freq. Ignore any errors */
-   axp20x_regulator_parse_dt(pdev);
+   axp20x_regulator_parse_dt(dev);
 
for (i = 0; i < nregulators; i++) {
const struct regulator_desc *desc = [i];
@@ -580,7 +581,7 @@ static int axp20x_regulator_probe(struct platform_device 
*pdev)
 * name.

Re: [linux-sunxi] SPI in Linux 4.8.0-rc6: Weird dip in SCLK right when slave select goes low

2016-09-23 Thread Maxime Ripard
On Fri, Sep 23, 2016 at 04:03:57AM +0300, Siarhei Siamashka wrote:
> On Thu, 22 Sep 2016 23:52:52 +0200
> Danny Milosavljevic  wrote:
> 
> > Hello,
> > 
> > when using SPI on Allwinner A20 with CPOL=1 and CPHA=1 with Linux 4.8.0-rc6 
> > Psychotic Stoned Sheep I see a weird dip in the beginning (which also 
> > confuses the slave) on the SCLK line right when SSEL goes low - see 
> > attachment.
> > 
> > The lines are, starting from the top, SCLK MOSI MISO SSEL.
> > 
> > I'm using spidev.
> > 
> > Did anyone see this problem before?
> 
> Hi,
> 
> I'm not sure, but something like this might be somehow related:
> https://patchwork.kernel.org/patch/7960811/
>
> As a random thing to check, I would also advise to verify the
> pull-up/pull-down settings for the SCLK pin.
> 
> And maybe as another test, change the driver to automatically
> drive the SSEL pin instead of doing this manually.

We cannot do that, this would break the framework's expectations with
the behaviour you're suposed to have in set_cs (which is why we ended
up using the manual mode), and especially that it's supposed to happen
right away and control the logical level of the CS line.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

-- 
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.


signature.asc
Description: PGP signature


Re: [linux-sunxi] SPI in Linux 4.8.0-rc6: Weird dip in SCLK right when slave select goes low

2016-09-23 Thread Maxime Ripard
Hi Danny,

On Thu, Sep 22, 2016 at 11:52:52PM +0200, Danny Milosavljevic wrote:
> Hello,
> 
> when using SPI on Allwinner A20 with CPOL=1 and CPHA=1 with Linux
> 4.8.0-rc6 Psychotic Stoned Sheep I see a weird dip in the beginning
> (which also confuses the slave) on the SCLK line right when SSEL
> goes low - see attachment.

That's weird indeed. Is it a regression, or is it something you just
noticed?

Thanks,
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

-- 
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.


signature.asc
Description: PGP signature