Re: [PATCH v4 06/12] media: dt-bindings: add bindings for i.MX7 media driver

2018-05-18 Thread Sakari Ailus
On Fri, May 18, 2018 at 09:27:58AM +0100, Rui Miguel Silva wrote:
> > > +endpoint node
> > > +-
> > > +
> > > +- data-lanes: (required) an array specifying active physical
> > > MIPI-CSI2
> > > + data input lanes and their mapping to logical lanes; the
> > > + array's content is unused, only its length is meaningful;

Btw. do note that you may get a warning due to this from the CSI-2 bus
property parsing code if the lane numbers are wrong.

> > > +
> > > +- fsl,csis-hs-settle : (optional) differential receiver (HS-RX)
> > > settle time;
> > 
> > Could you calculate this, as other drivers do? It probably changes
> > depending on the device runtime configuration.
> 
> The only reference to possible values to this parameter is given by
> table in [0], can you point me out the formula for imx7 in the
> documentation?

I don't know imx7 but the other CSI-2 drivers need no such system specific
configuration.

-- 
Sakari Ailus
sakari.ai...@linux.intel.com
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v5 06/12] media: dt-bindings: add bindings for i.MX7 media driver

2018-05-18 Thread Sakari Ailus
Hi Rui,

On Fri, May 18, 2018 at 10:28:00AM +0100, Rui Miguel Silva wrote:
> Add bindings documentation for i.MX7 media drivers.
> 
> Signed-off-by: Rui Miguel Silva 
> ---
>  .../devicetree/bindings/media/imx7.txt| 125 ++
>  1 file changed, 125 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/media/imx7.txt
> 
> diff --git a/Documentation/devicetree/bindings/media/imx7.txt 
> b/Documentation/devicetree/bindings/media/imx7.txt
> new file mode 100644
> index ..a26372630377
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/imx7.txt
> @@ -0,0 +1,125 @@
> +Freescale i.MX7 Media Video Device
> +==
> +
> +mipi_csi2 node
> +--
> +
> +This is the device node for the MIPI CSI-2 receiver core in i.MX7 SoC. It is
> +compatible with previous version of Samsung D-phy.
> +
> +Required properties:
> +
> +- compatible: "fsl,imx7-mipi-csi2";
> +- reg   : base address and length of the register set for the device;
> +- interrupts: should contain MIPI CSIS interrupt;
> +- clocks: list of clock specifiers, see
> +Documentation/devicetree/bindings/clock/clock-bindings.txt for 
> details;
> +- clock-names   : must contain "pclk", "wrap" and "phy" entries, matching
> +  entries in the clock property;
> +- power-domains : a phandle to the power domain, see
> +  Documentation/devicetree/bindings/power/power_domain.txt for 
> details.
> +- reset-names   : should include following entry "mrst";
> +- resets: a list of phandle, should contain reset entry of
> +  reset-names;
> +- phy-supply: from the generic phy bindings, a phandle to a regulator 
> that
> +   provides power to MIPI CSIS core;
> +- bus-width : maximum number of data lanes supported (SoC specific);
> +
> +Optional properties:
> +
> +- clock-frequency : The IP's main (system bus) clock frequency in Hz, default
> + value when this property is not specified is 166 MHz;
> +
> +port node
> +-
> +
> +- reg  : (required) can take the values 0 or 1, where 0 is 
> the
> + related sink port and port 1 should be the source one;

I don't have a datasheet --- does it discuss the hardware block's
interfaces in these terms?

> +
> +endpoint node
> +-
> +
> +- data-lanes: (required) an array specifying active physical MIPI-CSI2
> + data input lanes and their mapping to logical lanes; the
> + array's content is unused, only its length is meaningful;
> +
> +- fsl,csis-hs-settle : (optional) differential receiver (HS-RX) settle time;
> +
> +example:
> +
> +mipi_csi: mipi-csi@3075 {
> +#address-cells = <1>;
> +#size-cells = <0>;
> +
> +compatible = "fsl,imx7-mipi-csi2";
> +reg = <0x3075 0x1>;
> +interrupts = ;
> +clocks = < IMX7D_IPG_ROOT_CLK>,
> +< IMX7D_MIPI_CSI_ROOT_CLK>,
> +< IMX7D_MIPI_DPHY_ROOT_CLK>;
> +clock-names = "pclk", "wrap", "phy";
> +clock-names = "mipi", "phy";
> +clock-frequency = <16600>;
> +power-domains = <_mipi_phy>;
> +phy-supply = <_1p0d>;
> +resets = < IMX7_RESET_MIPI_PHY_MRST>;
> +reset-names = "mrst";
> +bus-width = <4>;
> +fsl,csis-hs-settle = <3>;
> +fsl,csis-clk-settle = <0>;
> +
> +port@0 {
> +reg = <0>;
> +
> +mipi_from_sensor: endpoint {
> +remote-endpoint = <_to_mipi>;
> +data-lanes = <1>;
> +};
> +};
> +
> +port@1 {
> +reg = <1>;
> +
> +mipi_vc0_to_csi_mux: endpoint {
> +remote-endpoint = <_mux_from_mipi_vc0>;
> +};
> +};
> +};
> +
> +
> +csi node
> +
> +
> +This is device node for the CMOS Sensor Interface (CSI) which enables the 
> chip
> +to connect directly to external CMOS image sensors.
> +
> +Required properties:
> +
> +- compatible: "fsl,imx7-csi";
> +- reg   : base address and length of the register set for the device;
> +- interrupts: should contain CSI interrupt;
> +- clocks: list of clock specifiers, see
> +Documentation/devicetree/bindings/clock/clock-bindings.txt for 
> details;
> +- clock-names   : must contain "axi", "mclk" and "dcic" entries, matching
> + entries in the clock property;
> +
> +example:
> +
> +csi: csi@3071 {
> +#address-cells = <1>;
> +   

Re: [PATCH v5 08/12] ARM: dts: imx7s: add multiplexer controls

2018-05-18 Thread Rui Miguel Silva

Hi Rob,
On Fri 18 May 2018 at 16:51, Rob Herring wrote:
On Fri, May 18, 2018 at 10:28:02AM +0100, Rui Miguel Silva 
wrote:
The IOMUXC General Purpose Register has bitfield to control 
video bus
multiplexer to control the CSI input between the MIPI-CSI2 and 
parallel

interface. Add that register and mask.

Signed-off-by: Rui Miguel Silva 
Reviewed-by: Philipp Zabel 
---
 arch/arm/boot/dts/imx7s.dtsi | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx7s.dtsi 
b/arch/arm/boot/dts/imx7s.dtsi

index 67450ad89940..3590dab529f9 100644
--- a/arch/arm/boot/dts/imx7s.dtsi
+++ b/arch/arm/boot/dts/imx7s.dtsi
@@ -520,8 +520,14 @@
 
 			gpr: iomuxc-gpr@3034 {
 compatible = 
 "fsl,imx7d-iomuxc-gpr",
-	"fsl,imx6q-iomuxc-gpr", 
"syscon";
+	"fsl,imx6q-iomuxc-gpr", 
"syscon", "simple-mfd";

reg = <0x3034 0x1>;
+
+   mux: mux-controller {
+   compatible = "mmio-mux";
+   #mux-control-cells = <1>;
+	mux-reg-masks = <0x14 
0x0010>;


If 1 bit control, then #mux-control-cells can be 0.


Ack.




+   };
};
 
 			ocotp: ocotp-ctrl@3035 {

--
2.17.0



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v5 07/12] ARM: dts: imx7s: add mipi phy power domain

2018-05-18 Thread Rui Miguel Silva

Hi Rob,
On Fri 18 May 2018 at 16:50, Rob Herring wrote:
On Fri, May 18, 2018 at 10:28:01AM +0100, Rui Miguel Silva 
wrote:

Add power domain index 0 related with mipi-phy to imx7s.

Signed-off-by: Rui Miguel Silva 
---
 arch/arm/boot/dts/imx7s.dtsi | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/imx7s.dtsi 
b/arch/arm/boot/dts/imx7s.dtsi

index 4d42335c0dee..67450ad89940 100644
--- a/arch/arm/boot/dts/imx7s.dtsi
+++ b/arch/arm/boot/dts/imx7s.dtsi
@@ -636,6 +636,12 @@
#address-cells = <1>;
#size-cells = <0>;
 
+	pgc_mipi_phy: 
pgc-power-domain@0 {


power-domain@0


I can change it, but...


+ 
#power-domain-cells = <0>;

+   reg = <0>;
+		power-supply = 
<_1p0d>;

+   };
+
 	pgc_pcie_phy: 
 pgc-power-domain@1 {


ditto.


This was not introduced by my patch, it is already there and I was
trying to be coherent with the existing naming.
but let me know if you like me to change it also.

---
Cheers,
Rui

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v5 06/12] media: dt-bindings: add bindings for i.MX7 media driver

2018-05-18 Thread Rui Miguel Silva

Hi Rob,
Thanks for your review, this and the other ones.
On Fri 18 May 2018 at 16:49, Rob Herring wrote:
On Fri, May 18, 2018 at 10:28:00AM +0100, Rui Miguel Silva 
wrote:

Add bindings documentation for i.MX7 media drivers.

Signed-off-by: Rui Miguel Silva 
---
 .../devicetree/bindings/media/imx7.txt| 125 
 ++

 1 file changed, 125 insertions(+)
 create mode 100644 
 Documentation/devicetree/bindings/media/imx7.txt


diff --git a/Documentation/devicetree/bindings/media/imx7.txt 
b/Documentation/devicetree/bindings/media/imx7.txt

new file mode 100644
index ..a26372630377
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/imx7.txt
@@ -0,0 +1,125 @@
+Freescale i.MX7 Media Video Device
+==
+
+mipi_csi2 node
+--
+
+This is the device node for the MIPI CSI-2 receiver core in 
i.MX7 SoC. It is

+compatible with previous version of Samsung D-phy.
+
+Required properties:
+
+- compatible: "fsl,imx7-mipi-csi2";
+- reg   : base address and length of the register set 
for the device;

+- interrupts: should contain MIPI CSIS interrupt;
+- clocks: list of clock specifiers, see
+ 
Documentation/devicetree/bindings/clock/clock-bindings.txt for 
details;
+- clock-names   : must contain "pclk", "wrap" and "phy" 
entries, matching

+  entries in the clock property;
+- power-domains : a phandle to the power domain, see
+ 
Documentation/devicetree/bindings/power/power_domain.txt for 
details.

+- reset-names   : should include following entry "mrst";
+- resets: a list of phandle, should contain reset 
entry of

+  reset-names;
+- phy-supply: from the generic phy bindings, a phandle to 
a regulator that

+ provides power to MIPI CSIS core;
+- bus-width : maximum number of data lanes supported (SoC 
specific);


This property is for parallel buses. Either just rely on 
data-lanes in 
the graph or this should be implied by the compatible.


Ack, will remove it.




+
+Optional properties:
+
+- clock-frequency : The IP's main (system bus) clock frequency 
in Hz, default
+		value when this property is not specified is 
166 MHz;

+
+port node
+-
+
+- reg		  : (required) can take the values 0 or 1, 
where 0 is the
+ related sink port and port 1 should be 
the source one;

+
+endpoint node
+-
+
+- data-lanes: (required) an array specifying active 
physical MIPI-CSI2
+		data input lanes and their mapping to logical 
lanes; the
+		array's content is unused, only its length is 
meaningful;

+
+- fsl,csis-hs-settle : (optional) differential receiver 
(HS-RX) settle time;


units and unit-suffix?


The information about this parameter is not much [0], but I think 
it
does not have units, it is the ratio between the Ths-settle and 
the

rx-clock period +/- constant.




+
+example:
+
+mipi_csi: mipi-csi@3075 {
+#address-cells = <1>;
+#size-cells = <0>;
+
+compatible = "fsl,imx7-mipi-csi2";
+reg = <0x3075 0x1>;
+interrupts = ;
+clocks = < IMX7D_IPG_ROOT_CLK>,
+< 
IMX7D_MIPI_CSI_ROOT_CLK>,
+< 
IMX7D_MIPI_DPHY_ROOT_CLK>;



+clock-names = "pclk", "wrap", "phy";
+clock-names = "mipi", "phy";


Err...


Yeah, thanks for notice it.




+clock-frequency = <16600>;
+power-domains = <_mipi_phy>;
+phy-supply = <_1p0d>;
+resets = < IMX7_RESET_MIPI_PHY_MRST>;
+reset-names = "mrst";
+bus-width = <4>;
+fsl,csis-hs-settle = <3>;
+fsl,csis-clk-settle = <0>;


Not documented.


It is the other way around, it should not be here in the example 
since

its value is always zero. [0] and I remove it from code and dts.




+
+port@0 {
+reg = <0>;
+
+mipi_from_sensor: endpoint {
+remote-endpoint = 
<_to_mipi>;

+data-lanes = <1>;
+};
+};
+
+port@1 {
+reg = <1>;
+
+mipi_vc0_to_csi_mux: endpoint {
+remote-endpoint = 
<_mux_from_mipi_vc0>;

+};
+};
+};
+
+
+csi node
+


I'd prefer these split into 2 files.


Sure, will do it.




+
+This is device node for the CMOS Sensor Interface (CSI) which 
enables the chip

+to connect directly to external CMOS image sensors.
+
+Required properties:
+
+- compatible: "fsl,imx7-csi";
+- reg   : base address and length of the register set 
for the device;

+- interrupts: should contain CSI interrupt;
+- clocks   

Re: [PATCH 05/15] mtd: nand: pxa3xx: remove the dmaengine compat need

2018-05-18 Thread Daniel Mack

Hi Robert,

Thanks for this series.

On Monday, April 02, 2018 04:26 PM, Robert Jarzmik wrote:

From: Robert Jarzmik 

As the pxa architecture switched towards the dmaengine slave map, the
old compatibility mechanism to acquire the dma requestor line number and
priority are not needed anymore.

This patch simplifies the dma resource acquisition, using the more
generic function dma_request_slave_channel().

Signed-off-by: Robert Jarzmik 
---
  drivers/mtd/nand/pxa3xx_nand.c | 10 +-


This driver was replaced by drivers/mtd/nand/raw/marvell_nand.c 
recently, so this patch can be dropped. I attached a version for the new 
driver which you can pick instead.



Thanks,
Daniel
>From c63bc40bdfe2d596e42919235840109a2f1b2776 Mon Sep 17 00:00:00 2001
From: Daniel Mack 
Date: Sat, 12 May 2018 21:50:13 +0200
Subject: [PATCH] mtd: rawnand: marvell: remove dmaengine compat code

As the pxa architecture switched towards the dmaengine slave map, the
old compatibility mechanism to acquire the dma requestor line number and
priority are not needed anymore.

This patch simplifies the dma resource acquisition, using the more
generic function dma_request_slave_channel().

Signed-off-by: Daniel Mack 
---
 drivers/mtd/nand/raw/marvell_nand.c | 11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c
index ebb1d141b900..30017cd7d91c 100644
--- a/drivers/mtd/nand/raw/marvell_nand.c
+++ b/drivers/mtd/nand/raw/marvell_nand.c
@@ -2612,8 +2612,6 @@ static int marvell_nfc_init_dma(struct marvell_nfc *nfc)
 		dev);
 	struct dma_slave_config config = {};
 	struct resource *r;
-	dma_cap_mask_t mask;
-	struct pxad_param param;
 	int ret;
 
 	if (!IS_ENABLED(CONFIG_PXA_DMA)) {
@@ -2632,14 +2630,7 @@ static int marvell_nfc_init_dma(struct marvell_nfc *nfc)
 		return -ENXIO;
 	}
 
-	param.drcmr = r->start;
-	param.prio = PXAD_PRIO_LOWEST;
-	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
-	nfc->dma_chan =
-		dma_request_slave_channel_compat(mask, pxad_filter_fn,
-		 , nfc->dev,
-		 "data");
+	nfc->dma_chan = dma_request_slave_channel(nfc->dev, "data");
 	if (!nfc->dma_chan) {
 		dev_err(nfc->dev,
 			"Unable to request data DMA channel\n");
-- 
2.14.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH v1] Drivers: HV: Send one page worth of kmsg dump over Hyper-V during panic

2018-05-18 Thread Sunil Muthuswamy
Thanks, Greg.

My first patch to the Linux kernel. Still making mistakes, but, learning 
through the documented process.

> -Original Message-
> From: Greg KH 
> Sent: Wednesday, May 9, 2018 11:51 PM
> To: Sunil Muthuswamy 
> Cc: Haiyang Zhang ;
> de...@linuxdriverproject.org; Stephen Hemminger
> 
> Subject: Re: [PATCH v1] Drivers: HV: Send one page worth of kmsg dump
> over Hyper-V during panic
> 
> On Wed, May 09, 2018 at 07:19:24PM +, Sunil Muthuswamy wrote:
> > In the VM mode on Hyper-V, currently, when the kernel panics, an error
> > code and few register values are populated in an MSR and the Hypervisor
> > notified. This information is collected on the host. The amount of
> > information currently collected is found to be limited and not very
> > actionable. To gather more actionable data, such as stack trace, the
> > proposal is to write one page worth of kmsg data on an allocated page
> > and the Hypervisor notified of the page address through the MSR.
> 
> Odd indentation, what editor made you do that?  Please move it all to the
> left.
I inserted them. Will fix.
> 
> >
> > CC: k...@microsoft.com
> > CC: sthem...@microsoft.com
> > Signed-off-by: Sunil Muthuswamy 
> > ---
> >  arch/x86/hyperv/hv_init.c  | 28 +
> >  arch/x86/include/asm/hyperv-tlfs.h |  5 ++--
> >  arch/x86/include/asm/mshyperv.h|  1 +
> >  drivers/hv/vmbus_drv.c | 61
> ++
> >  4 files changed, 93 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
> > index cfecc22..88ee90d 100644
> > --- a/arch/x86/hyperv/hv_init.c
> > +++ b/arch/x86/hyperv/hv_init.c
> > @@ -395,6 +395,34 @@ void hyperv_report_panic(struct pt_regs *regs,
> > long err)  }  EXPORT_SYMBOL_GPL(hyperv_report_panic);
> >
> > +void hyperv_report_panic_msg(phys_addr_t pa, size_t size) {
> > +   static bool panic_msg_reported;
> > +
> > +   if (panic_msg_reported)
> > +   return;
> > +   panic_msg_reported = true;
> 
> Why do you only care about the first message?
It is following the general direction from ' hyperv_report_panic', but, I don't 
think it needs to. Will change.
> 
> > +
> > +   /*
> > +* P3 to contain the physical address of the panic page & P4 to
> > +* contain the size of the panic data in that page. Rest of the
> > +* registers are no-op when the NOTIFY_MSG flag is set.
> > +*/
> > +   wrmsrl(HV_X64_MSR_CRASH_P0, 0);
> > +   wrmsrl(HV_X64_MSR_CRASH_P1, 0);
> > +   wrmsrl(HV_X64_MSR_CRASH_P2, 0);
> > +   wrmsrl(HV_X64_MSR_CRASH_P3, pa);
> > +   wrmsrl(HV_X64_MSR_CRASH_P4, size);
> > +
> > +   /*
> > +* Let Hyper-V know there is crash data available along with
> > +* the panic message.
> > +*/
> > +   wrmsrl(HV_X64_MSR_CRASH_CTL,
> > +  (HV_CRASH_CTL_CRASH_NOTIFY |
> HV_CRASH_CTL_CRASH_NOTIFY_MSG));
> > +} EXPORT_SYMBOL_GPL(hyperv_report_panic_msg);
> > +
> >  bool hv_is_hyperv_initialized(void)
> >  {
> > union hv_x64_msr_hypercall_contents hypercall_msr; diff --git
> > a/arch/x86/include/asm/hyperv-tlfs.h
> > b/arch/x86/include/asm/hyperv-tlfs.h
> > index 416cb0e..fc2932c 100644
> > --- a/arch/x86/include/asm/hyperv-tlfs.h
> > +++ b/arch/x86/include/asm/hyperv-tlfs.h
> > @@ -171,9 +171,10 @@
> >  #define HV_X64_ENLIGHTENED_VMCS_RECOMMENDED(1 << 14)
> >
> >  /*
> > - * Crash notification flag.
> > + * Crash notification flags.
> >   */
> > -#define HV_CRASH_CTL_CRASH_NOTIFY (1ULL << 63)
> > +#define HV_CRASH_CTL_CRASH_NOTIFY (1ULL << 63)
> > +#define HV_CRASH_CTL_CRASH_NOTIFY_MSG (1ULL << 62)
> 
> Not in numerical order?
> 
> And can you use the BIT() macro here instead?  Not a requirement, just a
> general question.
Will change in the next version.
> 
> >
> >  /* MSR used to identify the guest OS. */
> >  #define HV_X64_MSR_GUEST_OS_ID 0x4000
> > diff --git a/arch/x86/include/asm/mshyperv.h
> > b/arch/x86/include/asm/mshyperv.h index b90e796..ac83f2d 100644
> > --- a/arch/x86/include/asm/mshyperv.h
> > +++ b/arch/x86/include/asm/mshyperv.h
> > @@ -262,6 +262,7 @@ void hyperv_init(void);  void
> > hyperv_setup_mmu_ops(void);  void hyper_alloc_mmu(void);  void
> > hyperv_report_panic(struct pt_regs *regs, long err);
> > +void hyperv_report_panic_msg(phys_addr_t pa, size_t size);
> >  bool hv_is_hyperv_initialized(void);
> >  void hyperv_cleanup(void);
> >
> > diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index
> > b10fe26..40d915c 100644
> > --- a/drivers/hv/vmbus_drv.c
> > +++ b/drivers/hv/vmbus_drv.c
> > @@ -56,6 +56,8 @@ static struct completion probe_event;
> >
> >  static int hyperv_cpuhp_online;
> >
> > +static void *hv_panic_page;
> > +
> >  static int hyperv_panic_event(struct notifier_block *nb, unsigned long val,
> >   void *args)
> >  {
> > 

GCB

2018-05-18 Thread Kofi Abubarka

Ghana Commercial Bank,
Thorpe Rd, High Street,
P.O box GP 132,
Accra, Ghana.

Attention,

GCB has been delegated by International Monetary Fund in conjunction with
the Dept. of United Nation Foreign Affairs, to remit $1,900,000.00 USD
ONLY to you. However it has been tag overdue, it was during our quarterly
auditing process that your email address was discovered among the list of
victims who has been ignorantly having illegal financial dealings with
some online perpetrators who have taken advantage of your legitimate
transaction and for this reason you are contacted for compensation.

You are to re-confirm the below information for final verification
process, so we can proceed to transfer your already approved $1,900,000.00
into your later provisional bank account.

1. Full Names:
2. Telephone Number:
3. Alternative E-mail Address:
4. Copy of any identification document:

Your urgent response will be highly appreciated to enable us serve you better

Yours Sincerely,
Kofi Abubarka,
Head Corporate Affairs
Ghana Commercial Ban

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] Drivers: HV: Send one page worth of kmsg dump over Hyper-V during panic

2018-05-18 Thread Stephen Hemminger
On Fri, 18 May 2018 19:09:10 +
Sunil Muthuswamy  wrote:

>  
> +/*
> + * Boolean to control whether to report panic messages over Hyper-V.
> + *
> + * It can be set via /proc/sys/kernel/hyperv/record_panic_msg
> + */
> +int sysctl_record_panic_msg = 1;
> +

Looks good, this will help.

Please create new documentation to Documentation/sysctl/ for the new
sysctl.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


GCB

2018-05-18 Thread kofi

Ghana Commercial Bank,
Thorpe Rd, High Street,
P.O box GP 132,
Accra, Ghana.

Attention,

GCB has been delegated by International Monetary Fund in conjunction with
the Dept. of United Nation Foreign Affairs, to remit $1,900,000.00 USD
ONLY to you. However it has been tag overdue, it was during our quarterly
auditing process that your email address was discovered among the list of
victims who has been ignorantly having illegal financial dealings with
some online perpetrators who have taken advantage of your legitimate
transaction and for this reason you are contacted for compensation.

You are to re-confirm the below information for final verification
process, so we can proceed to transfer your already approved $1,900,000.00
into your later provisional bank account.

1. Full Names:
2. Telephone Number:
3. Alternative E-mail Address:
4. Copy of any identification document:

Your urgent response will be highly appreciated to enable us serve you better

Yours Sincerely,
Kofi Abubarka,
Head Corporate Affairs
Ghana Commercial Ba

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] Drivers: HV: Send one page worth of kmsg dump over Hyper-V during panic

2018-05-18 Thread Sunil Muthuswamy
In the VM mode on Hyper-V, currently, when the kernel panics, an error
code and few register values are populated in an MSR and the Hypervisor
notified. This information is collected on the host. The amount of
information currently collected is found to be limited and not very
actionable. To gather more actionable data, such as stack trace, the
proposal is to write one page worth of kmsg data on an allocated page
and the Hypervisor notified of the page address through the MSR.

- Added a sysctl option to control the behavior, with ON by default.

CC: k...@microsoft.com
CC: sthem...@microsoft.com
Signed-off-by: Sunil Muthuswamy 
---
 arch/x86/hyperv/hv_init.c  |  35 ++
 arch/x86/include/asm/hyperv-tlfs.h |   5 +-
 arch/x86/include/asm/mshyperv.h|   1 +
 drivers/hv/vmbus_drv.c | 128 +
 4 files changed, 167 insertions(+), 2 deletions(-)

diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
index cfecc22..fc1e3cb 100644
--- a/arch/x86/hyperv/hv_init.c
+++ b/arch/x86/hyperv/hv_init.c
@@ -395,6 +395,41 @@ void hyperv_report_panic(struct pt_regs *regs, long err)
 }
 EXPORT_SYMBOL_GPL(hyperv_report_panic);
 
+/**
+ * hyperv_report_panic_msg - report panic message to Hyper-V
+ * @pa: physical address of the panic page containing the message
+ * @size: size of the message in the page
+ *
+ */
+
+void hyperv_report_panic_msg(phys_addr_t pa, size_t size)
+{
+   static bool panic_msg_reported;
+
+   if (panic_msg_reported)
+   return;
+   panic_msg_reported = true;
+
+   /*
+* P3 to contain the physical address of the panic page & P4 to
+* contain the size of the panic data in that page. Rest of the
+* registers are no-op when the NOTIFY_MSG flag is set.
+*/
+   wrmsrl(HV_X64_MSR_CRASH_P0, 0);
+   wrmsrl(HV_X64_MSR_CRASH_P1, 0);
+   wrmsrl(HV_X64_MSR_CRASH_P2, 0);
+   wrmsrl(HV_X64_MSR_CRASH_P3, pa);
+   wrmsrl(HV_X64_MSR_CRASH_P4, size);
+
+   /*
+* Let Hyper-V know there is crash data available along with
+* the panic message.
+*/
+   wrmsrl(HV_X64_MSR_CRASH_CTL,
+  (HV_CRASH_CTL_CRASH_NOTIFY | HV_CRASH_CTL_CRASH_NOTIFY_MSG));
+}
+EXPORT_SYMBOL_GPL(hyperv_report_panic_msg);
+
 bool hv_is_hyperv_initialized(void)
 {
union hv_x64_msr_hypercall_contents hypercall_msr;
diff --git a/arch/x86/include/asm/hyperv-tlfs.h 
b/arch/x86/include/asm/hyperv-tlfs.h
index 416cb0e..fc2932c 100644
--- a/arch/x86/include/asm/hyperv-tlfs.h
+++ b/arch/x86/include/asm/hyperv-tlfs.h
@@ -171,9 +171,10 @@
 #define HV_X64_ENLIGHTENED_VMCS_RECOMMENDED(1 << 14)
 
 /*
- * Crash notification flag.
+ * Crash notification flags.
  */
-#define HV_CRASH_CTL_CRASH_NOTIFY (1ULL << 63)
+#define HV_CRASH_CTL_CRASH_NOTIFY (1ULL << 63)
+#define HV_CRASH_CTL_CRASH_NOTIFY_MSG (1ULL << 62)
 
 /* MSR used to identify the guest OS. */
 #define HV_X64_MSR_GUEST_OS_ID 0x4000
diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index b90e796..ac83f2d 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -262,6 +262,7 @@ void hyperv_init(void);
 void hyperv_setup_mmu_ops(void);
 void hyper_alloc_mmu(void);
 void hyperv_report_panic(struct pt_regs *regs, long err);
+void hyperv_report_panic_msg(phys_addr_t pa, size_t size);
 bool hv_is_hyperv_initialized(void);
 void hyperv_cleanup(void);
 
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index b10fe26..7b04f7f 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -56,6 +56,8 @@ static struct completion probe_event;
 
 static int hyperv_cpuhp_online;
 
+static void *hv_panic_page;
+
 static int hyperv_panic_event(struct notifier_block *nb, unsigned long val,
  void *args)
 {
@@ -1018,6 +1020,86 @@ static void vmbus_isr(void)
add_interrupt_randomness(HYPERVISOR_CALLBACK_VECTOR, 0);
 }
 
+/*
+ * Boolean to control whether to report panic messages over Hyper-V.
+ *
+ * It can be set via /proc/sys/kernel/hyperv/record_panic_msg
+ */
+int sysctl_record_panic_msg = 1;
+
+/*
+ * Callback from kmsg_dump. Grab as much as possible from the end of the kmsg
+ * buffer and call into Hyper-V to transfer the data.
+ */
+static void hv_kmsg_dump(struct kmsg_dumper *dumper,
+enum kmsg_dump_reason reason)
+{
+   size_t bytes_written;
+   phys_addr_t panic_pa;
+
+   /* We are only interested in panics. */
+   if (reason != KMSG_DUMP_PANIC)
+   return;
+
+   if (!sysctl_record_panic_msg)
+   return;
+
+   if (!hv_panic_page)
+   return;
+
+   panic_pa = virt_to_phys(hv_panic_page);
+
+   /*
+* Write dump contents to the page. No need to synchronize; panic should
+* be single-threaded.
+*/
+   if (!kmsg_dump_get_buffer(dumper, true, 

[PATCH v4 12/12] staging: iio: ad2s1200: Move driver out of staging

2018-05-18 Thread David Veenstra
Move the iio driver for the ad2s1200 and ad2s1205 resolver-to-digital
converter out of staging, into mainline iio subsystems.

Signed-off-by: David Veenstra 
---
 drivers/iio/Kconfig |   1 +
 drivers/iio/Makefile|   1 +
 drivers/iio/resolver/Kconfig|  17 ++
 drivers/iio/resolver/Makefile   |   5 +
 drivers/iio/resolver/ad2s1200.c | 210 
 drivers/staging/iio/resolver/Kconfig|  12 --
 drivers/staging/iio/resolver/Makefile   |   1 -
 drivers/staging/iio/resolver/ad2s1200.c | 210 
 8 files changed, 234 insertions(+), 223 deletions(-)
 create mode 100644 drivers/iio/resolver/Kconfig
 create mode 100644 drivers/iio/resolver/Makefile
 create mode 100644 drivers/iio/resolver/ad2s1200.c
 delete mode 100644 drivers/staging/iio/resolver/ad2s1200.c

diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig
index d69e85a8bdc3..d08aeb41cd07 100644
--- a/drivers/iio/Kconfig
+++ b/drivers/iio/Kconfig
@@ -93,6 +93,7 @@ source "drivers/iio/potentiometer/Kconfig"
 source "drivers/iio/potentiostat/Kconfig"
 source "drivers/iio/pressure/Kconfig"
 source "drivers/iio/proximity/Kconfig"
+source "drivers/iio/resolver/Kconfig"
 source "drivers/iio/temperature/Kconfig"
 
 endif # IIO
diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile
index d8cba9c229c0..cb5993251381 100644
--- a/drivers/iio/Makefile
+++ b/drivers/iio/Makefile
@@ -36,5 +36,6 @@ obj-y += potentiometer/
 obj-y += potentiostat/
 obj-y += pressure/
 obj-y += proximity/
+obj-y += resolver/
 obj-y += temperature/
 obj-y += trigger/
diff --git a/drivers/iio/resolver/Kconfig b/drivers/iio/resolver/Kconfig
new file mode 100644
index ..2ced9f22aa70
--- /dev/null
+++ b/drivers/iio/resolver/Kconfig
@@ -0,0 +1,17 @@
+#
+# Resolver/Synchro drivers
+#
+menu "Resolver to digital converters"
+
+config AD2S1200
+   tristate "Analog Devices ad2s1200/ad2s1205 driver"
+   depends on SPI
+   depends on GPIOLIB || COMPILE_TEST
+   help
+ Say yes here to build support for Analog Devices spi resolver
+ to digital converters, ad2s1200 and ad2s1205, provides direct access
+ via sysfs.
+
+ To compile this driver as a module, choose M here: the
+ module will be called ad2s1200.
+endmenu
diff --git a/drivers/iio/resolver/Makefile b/drivers/iio/resolver/Makefile
new file mode 100644
index ..4e1dccae07e7
--- /dev/null
+++ b/drivers/iio/resolver/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile for Resolver/Synchro drivers
+#
+
+obj-$(CONFIG_AD2S1200) += ad2s1200.o
diff --git a/drivers/iio/resolver/ad2s1200.c b/drivers/iio/resolver/ad2s1200.c
new file mode 100644
index ..28e618af9939
--- /dev/null
+++ b/drivers/iio/resolver/ad2s1200.c
@@ -0,0 +1,210 @@
+/*
+ * ad2s1200.c simple support for the ADI Resolver to Digital Converters:
+ * AD2S1200/1205
+ *
+ * Copyright (c) 2018-2018 David Veenstra 
+ * Copyright (c) 2010-2010 Analog Devices Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#define DRV_NAME "ad2s1200"
+
+/* input clock on serial interface */
+#define AD2S1200_HZ8192000
+/* clock period in nano second */
+#define AD2S1200_TSCLK (10 / AD2S1200_HZ)
+
+/**
+ * struct ad2s1200_state - driver instance specific data.
+ * @lock:  protects both the GPIO pins and the rx buffer.
+ * @sdev:  spi device.
+ * @sample:GPIO pin SAMPLE.
+ * @rdvel: GPIO pin RDVEL.
+ * @rx:buffer for spi transfers.
+ */
+struct ad2s1200_state {
+   struct mutex lock;
+   struct spi_device *sdev;
+   struct gpio_desc *sample;
+   struct gpio_desc *rdvel;
+   __be16 rx cacheline_aligned;
+};
+
+static int ad2s1200_read_raw(struct iio_dev *indio_dev,
+struct iio_chan_spec const *chan,
+int *val,
+int *val2,
+long m)
+{
+   struct ad2s1200_state *st = iio_priv(indio_dev);
+   int ret;
+
+   switch (m) {
+   case IIO_CHAN_INFO_SCALE:
+   switch (chan->type) {
+   case IIO_ANGL:
+   /* 2 * Pi / (2^12 - 1) ~= 0.001534355 */
+   *val = 0;
+   *val2 = 1534355;
+   return IIO_VAL_INT_PLUS_NANO;
+   case IIO_ANGL_VEL:
+   /* 2 * Pi ~= 6.283185 */
+   *val = 6;
+   *val2 = 283185;
+   return IIO_VAL_INT_PLUS_MICRO;
+   default:
+   return -EINVAL;
+   }
+  

[PATCH v4 10/12] staging: iio: ad2s1200: Add scaling factor for angle channel

2018-05-18 Thread David Veenstra
A scaling factor of approximately 2 * Pi / (2^12 -1) is added,
to scale the 12-bits angular position to radians.

A return type of IIO_VAL_INT_PLUS_NANO is used, so that the scale of
both the angle channel and angular velocity channel has 7 significant
digits.

Signed-off-by: David Veenstra 
---
 drivers/staging/iio/resolver/ad2s1200.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/staging/iio/resolver/ad2s1200.c 
b/drivers/staging/iio/resolver/ad2s1200.c
index 7b8af558e921..10d6d79dce79 100644
--- a/drivers/staging/iio/resolver/ad2s1200.c
+++ b/drivers/staging/iio/resolver/ad2s1200.c
@@ -58,6 +58,11 @@ static int ad2s1200_read_raw(struct iio_dev *indio_dev,
switch (m) {
case IIO_CHAN_INFO_SCALE:
switch (chan->type) {
+   case IIO_ANGL:
+   /* 2 * Pi / (2^12 - 1) ~= 0.001534355 */
+   *val = 0;
+   *val2 = 1534355;
+   return IIO_VAL_INT_PLUS_NANO;
case IIO_ANGL_VEL:
/* 2 * Pi ~= 6.283185 */
*val = 6;
@@ -112,6 +117,7 @@ static const struct iio_chan_spec ad2s1200_channels[] = {
.indexed = 1,
.channel = 0,
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
+   .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
}, {
.type = IIO_ANGL_VEL,
.indexed = 1,
-- 
2.17.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 09/12] staging: iio: ad2s1200: Add scaling factor for angular velocity channel

2018-05-18 Thread David Veenstra
The sysfs iio ABI states radians per second is expected as the unit for
angular velocity, but the 12-bit angular velocity register has
revolution per seconds as its unit. So a scaling factor of approximately
2 * Pi is added to the angular velocity channel.

Signed-off-by: David Veenstra 
---
Changes in v4:
 - Changed rps to revolutions per second in commit message
   to prevent confusion.

 drivers/staging/iio/resolver/ad2s1200.c | 71 -
 1 file changed, 45 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/iio/resolver/ad2s1200.c 
b/drivers/staging/iio/resolver/ad2s1200.c
index 67d9747f88a6..7b8af558e921 100644
--- a/drivers/staging/iio/resolver/ad2s1200.c
+++ b/drivers/staging/iio/resolver/ad2s1200.c
@@ -55,37 +55,55 @@ static int ad2s1200_read_raw(struct iio_dev *indio_dev,
struct ad2s1200_state *st = iio_priv(indio_dev);
int ret;
 
-   mutex_lock(>lock);
-   gpiod_set_value(st->sample, 0);
-
-   /* delay (6 * AD2S1200_TSCLK + 20) nano seconds */
-   udelay(1);
-   gpiod_set_value(st->sample, 1);
-   gpiod_set_value(st->rdvel, !!(chan->type == IIO_ANGL));
-
-   ret = spi_read(st->sdev, >rx, 2);
-   if (ret < 0) {
+   switch (m) {
+   case IIO_CHAN_INFO_SCALE:
+   switch (chan->type) {
+   case IIO_ANGL_VEL:
+   /* 2 * Pi ~= 6.283185 */
+   *val = 6;
+   *val2 = 283185;
+   return IIO_VAL_INT_PLUS_MICRO;
+   default:
+   return -EINVAL;
+   }
+   break;
+   case IIO_CHAN_INFO_RAW:
+   mutex_lock(>lock);
+   gpiod_set_value(st->sample, 0);
+
+   /* delay (6 * AD2S1200_TSCLK + 20) nano seconds */
+   udelay(1);
+   gpiod_set_value(st->sample, 1);
+   gpiod_set_value(st->rdvel, !!(chan->type == IIO_ANGL));
+
+   ret = spi_read(st->sdev, >rx, 2);
+   if (ret < 0) {
+   mutex_unlock(>lock);
+   return ret;
+   }
+
+   switch (chan->type) {
+   case IIO_ANGL:
+   *val = be16_to_cpup(>rx) >> 4;
+   break;
+   case IIO_ANGL_VEL:
+   *val = sign_extend32(be16_to_cpup(>rx) >> 4, 11);
+   break;
+   default:
+   mutex_unlock(>lock);
+   return -EINVAL;
+   }
+
+   /* delay (2 * AD2S1200_TSCLK + 20) ns for sample pulse */
+   udelay(1);
mutex_unlock(>lock);
-   return ret;
-   }
 
-   switch (chan->type) {
-   case IIO_ANGL:
-   *val = be16_to_cpup(>rx) >> 4;
-   break;
-   case IIO_ANGL_VEL:
-   *val = sign_extend32(be16_to_cpup(>rx) >> 4, 11);
-   break;
+   return IIO_VAL_INT;
default:
-   mutex_unlock(>lock);
-   return -EINVAL;
+   break;
}
 
-   /* delay (2 * AD2S1200_TSCLK + 20) ns for sample pulse */
-   udelay(1);
-   mutex_unlock(>lock);
-
-   return IIO_VAL_INT;
+   return -EINVAL;
 }
 
 static const struct iio_chan_spec ad2s1200_channels[] = {
@@ -99,6 +117,7 @@ static const struct iio_chan_spec ad2s1200_channels[] = {
.indexed = 1,
.channel = 0,
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
+   .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
}
 };
 
-- 
2.17.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 11/12] staging: iio: ad2s1200: Add copyright

2018-05-18 Thread David Veenstra
Add David Veenstra as a copyright holders and as an author,
for all of the staging clean ups of the ad2s1200 driver.

Signed-off-by: David Veenstra 
---
Changes in v4:
 - Introduced in this version.

 drivers/staging/iio/resolver/ad2s1200.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/iio/resolver/ad2s1200.c 
b/drivers/staging/iio/resolver/ad2s1200.c
index 10d6d79dce79..28e618af9939 100644
--- a/drivers/staging/iio/resolver/ad2s1200.c
+++ b/drivers/staging/iio/resolver/ad2s1200.c
@@ -2,6 +2,7 @@
  * ad2s1200.c simple support for the ADI Resolver to Digital Converters:
  * AD2S1200/1205
  *
+ * Copyright (c) 2018-2018 David Veenstra 
  * Copyright (c) 2010-2010 Analog Devices Inc.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -203,6 +204,7 @@ static struct spi_driver ad2s1200_driver = {
 };
 module_spi_driver(ad2s1200_driver);
 
+MODULE_AUTHOR("David Veenstra ");
 MODULE_AUTHOR("Graff Yang ");
 MODULE_DESCRIPTION("Analog Devices AD2S1200/1205 Resolver to Digital SPI 
driver");
 MODULE_LICENSE("GPL v2");
-- 
2.17.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 08/12] dt-bindings: iio: resolver: Document AD2S1200 bindings

2018-05-18 Thread David Veenstra
Add documentation for the device tree bindings of the AD2S1200 resolver.

Signed-off-by: David Veenstra 
---
Changes in v4:
 - Added vendor prefix to gpio function name.
 - Added unit address.
 - Changed commit subject to be more inline with other dt-bindings
   commit .

 .../bindings/iio/resolver/ad2s1200.txt   | 16 
 1 file changed, 16 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/resolver/ad2s1200.txt

diff --git a/Documentation/devicetree/bindings/iio/resolver/ad2s1200.txt 
b/Documentation/devicetree/bindings/iio/resolver/ad2s1200.txt
new file mode 100644
index ..bbf54260c911
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/resolver/ad2s1200.txt
@@ -0,0 +1,16 @@
+Analog Devices AD2S1200 and AD2S1205 Resolver-to-Digital Converter
+
+Required properties:
+ - compatible : should be "adi,ad2s1200" or "adi,ad2s1205"
+ - reg : the SPI chip select number of the device
+ - adi,sample-gpios : The GPIO pin connected to the SAMPLE line of the AD2S1200
+ - adi,rdvel-gpios : The GPIO pin connected to the RDVEL line of the AD2S1200
+
+Example:
+
+   resolver@0 {
+   compatible = "adi,ad2s1200";
+   reg = <4>;
+   adi,sample-gpios = < 5 GPIO_ACTIVE_HIGH>;
+   adi,rdvel-gpios = < 6 GPIO_ACTIVE_HIGH>;
+   };
-- 
2.17.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 07/12] staging: iio: ad2s1200: Add dt table

2018-05-18 Thread David Veenstra
Add device tree table for matching with the vendor ID.

Signed-off-by: David Veenstra 
---
Changes in v4:
 - Introduced in this version.

 drivers/staging/iio/resolver/ad2s1200.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/staging/iio/resolver/ad2s1200.c 
b/drivers/staging/iio/resolver/ad2s1200.c
index 9a8aa2448897..67d9747f88a6 100644
--- a/drivers/staging/iio/resolver/ad2s1200.c
+++ b/drivers/staging/iio/resolver/ad2s1200.c
@@ -154,6 +154,13 @@ static int ad2s1200_probe(struct spi_device *spi)
return devm_iio_device_register(>dev, indio_dev);
 }
 
+static const struct of_device_id ad2s1200_of_match[] = {
+   { .compatible = "adi,ad2s1200", },
+   { .compatible = "adi,ad2s1205", },
+   { }
+};
+MODULE_DEVICE_TABLE(of, ad2s1200_of_match);
+
 static const struct spi_device_id ad2s1200_id[] = {
{ "ad2s1200" },
{ "ad2s1205" },
@@ -164,6 +171,7 @@ MODULE_DEVICE_TABLE(spi, ad2s1200_id);
 static struct spi_driver ad2s1200_driver = {
.driver = {
.name = DRV_NAME,
+   .of_match_table = of_match_ptr(ad2s1200_of_match),
},
.probe = ad2s1200_probe,
.id_table = ad2s1200_id,
-- 
2.17.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 06/12] staging: iio: ad2s1200: Replace platform data with dt bindings

2018-05-18 Thread David Veenstra
Remove usage of platform data, and replace it with device tree
facilities.

Signed-off-by: David Veenstra 
---
Changes in v4:
 - Added vendor prefix to gpio function names.

 drivers/staging/iio/resolver/ad2s1200.c | 32 -
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/iio/resolver/ad2s1200.c 
b/drivers/staging/iio/resolver/ad2s1200.c
index b2c46a8c6b77..9a8aa2448897 100644
--- a/drivers/staging/iio/resolver/ad2s1200.c
+++ b/drivers/staging/iio/resolver/ad2s1200.c
@@ -25,9 +25,6 @@
 
 #define DRV_NAME "ad2s1200"
 
-/* input pin sample and rdvel is controlled by driver */
-#define AD2S1200_PN2
-
 /* input clock on serial interface */
 #define AD2S1200_HZ8192000
 /* clock period in nano second */
@@ -111,20 +108,9 @@ static const struct iio_info ad2s1200_info = {
 
 static int ad2s1200_probe(struct spi_device *spi)
 {
-   unsigned short *pins = spi->dev.platform_data;
struct ad2s1200_state *st;
struct iio_dev *indio_dev;
-   int pn, ret;
-
-   for (pn = 0; pn < AD2S1200_PN; pn++) {
-   ret = devm_gpio_request_one(>dev, pins[pn], GPIOF_DIR_OUT,
-   DRV_NAME);
-   if (ret) {
-   dev_err(>dev, "request gpio pin %d failed\n",
-   pins[pn]);
-   return ret;
-   }
-   }
+   int ret;
 
indio_dev = devm_iio_device_alloc(>dev, sizeof(*st));
if (!indio_dev)
@@ -134,8 +120,20 @@ static int ad2s1200_probe(struct spi_device *spi)
st = iio_priv(indio_dev);
mutex_init(>lock);
st->sdev = spi;
-   st->sample = gpio_to_desc(pins[0]);
-   st->rdvel = gpio_to_desc(pins[1]);
+
+   st->sample = devm_gpiod_get(>dev, "adi,sample", GPIOD_OUT_LOW);
+   if (IS_ERR(st->sample)) {
+   dev_err(>dev, "Failed to claim SAMPLE gpio: err=%ld\n",
+   PTR_ERR(st->sample));
+   return PTR_ERR(st->sample);
+   }
+
+   st->rdvel = devm_gpiod_get(>dev, "adi,rdvel", GPIOD_OUT_LOW);
+   if (IS_ERR(st->rdvel)) {
+   dev_err(>dev, "Failed to claim RDVEL gpio: err=%ld\n",
+   PTR_ERR(st->rdvel));
+   return PTR_ERR(st->rdvel);
+   }
 
indio_dev->dev.parent = >dev;
indio_dev->info = _info;
-- 
2.17.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 05/12] staging: iio: ad2s1200: Replace legacy gpio API with modern API

2018-05-18 Thread David Veenstra
The legacy, integer based gpio API is replaced with the modern
descriptor based API.

Signed-off-by: David Veenstra 
---
 drivers/staging/iio/resolver/ad2s1200.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/iio/resolver/ad2s1200.c 
b/drivers/staging/iio/resolver/ad2s1200.c
index 430cc62591fe..b2c46a8c6b77 100644
--- a/drivers/staging/iio/resolver/ad2s1200.c
+++ b/drivers/staging/iio/resolver/ad2s1200.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -43,8 +44,8 @@
 struct ad2s1200_state {
struct mutex lock;
struct spi_device *sdev;
-   int sample;
-   int rdvel;
+   struct gpio_desc *sample;
+   struct gpio_desc *rdvel;
__be16 rx cacheline_aligned;
 };
 
@@ -58,12 +59,12 @@ static int ad2s1200_read_raw(struct iio_dev *indio_dev,
int ret;
 
mutex_lock(>lock);
-   gpio_set_value(st->sample, 0);
+   gpiod_set_value(st->sample, 0);
 
/* delay (6 * AD2S1200_TSCLK + 20) nano seconds */
udelay(1);
-   gpio_set_value(st->sample, 1);
-   gpio_set_value(st->rdvel, !!(chan->type == IIO_ANGL));
+   gpiod_set_value(st->sample, 1);
+   gpiod_set_value(st->rdvel, !!(chan->type == IIO_ANGL));
 
ret = spi_read(st->sdev, >rx, 2);
if (ret < 0) {
@@ -133,8 +134,8 @@ static int ad2s1200_probe(struct spi_device *spi)
st = iio_priv(indio_dev);
mutex_init(>lock);
st->sdev = spi;
-   st->sample = pins[0];
-   st->rdvel = pins[1];
+   st->sample = gpio_to_desc(pins[0]);
+   st->rdvel = gpio_to_desc(pins[1]);
 
indio_dev->dev.parent = >dev;
indio_dev->info = _info;
-- 
2.17.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 00/12] iio: ad2s1200: Driver clean up

2018-05-18 Thread David Veenstra
For v1 see [1], for v2 see [2], for v3 see [3].

A summary of this patch:
1. Clean up of minor code style issues.
2. Replace legacy GPIO ABI with modern ABI and remove usage of.
   platform data.
4. Add scaling factor for angular position and angular velocity to
   match the sysfs IIO ABI.
5. Add documentation for device tree binding
6. Move driver to main line.

Changes in v4:
- Some new minor code style fix ups.
- Move spi setup to before iio device registration.
- Add vendor prefix to gpios function name, and dt docs.
- Add device tree table
- Add copyright.

Best regards,
David Veenstra

[1] https://marc.info/?l=linux-iio=152137920426820=2
[2] https://marc.info/?l=linux-iio=152425250915148=2
[3] https://marc.info/?l=linux-iio=152443456824272=2

David Veenstra (12):
  staging: iio: ad2s1200: Remove unneeded newline in license
  staging: iio: ad2s1200: Remove unneeded initializations
  staging: iio: ad2s1200: Add kernel docs to driver state
  staging: iio: ad2s1200: Setup spi before iio device register
  staging: iio: ad2s1200: Replace legacy gpio API with modern API
  staging: iio: ad2s1200: Replace platform data with dt bindings
  staging: iio: ad2s1200: Add dt table
  dt-bindings: iio: resolver: Document AD2S1200 bindings
  staging: iio: ad2s1200: Add scaling factor for angular velocity
channel
  staging: iio: ad2s1200: Add scaling factor for angle channel
  staging: iio: ad2s1200: Add copyright
  staging: iio: ad2s1200: Move driver out of staging

 .../bindings/iio/resolver/ad2s1200.txt|  16 ++
 drivers/iio/Kconfig   |   1 +
 drivers/iio/Makefile  |   1 +
 drivers/iio/resolver/Kconfig  |  17 ++
 drivers/iio/resolver/Makefile |   5 +
 drivers/iio/resolver/ad2s1200.c   | 210 ++
 drivers/staging/iio/resolver/Kconfig  |  12 -
 drivers/staging/iio/resolver/Makefile |   1 -
 drivers/staging/iio/resolver/ad2s1200.c   | 168 --
 9 files changed, 250 insertions(+), 181 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/iio/resolver/ad2s1200.txt
 create mode 100644 drivers/iio/resolver/Kconfig
 create mode 100644 drivers/iio/resolver/Makefile
 create mode 100644 drivers/iio/resolver/ad2s1200.c
 delete mode 100644 drivers/staging/iio/resolver/ad2s1200.c

-- 
2.17.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 04/12] staging: iio: ad2s1200: Setup spi before iio device register

2018-05-18 Thread David Veenstra
The spi should be set up before the device is registered as an iio
device.

This patch moves the setup to before the device registration.

Signed-off-by: David Veenstra 
---
Changes in v4:
 - Introduced in this version.

 drivers/staging/iio/resolver/ad2s1200.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/iio/resolver/ad2s1200.c 
b/drivers/staging/iio/resolver/ad2s1200.c
index 068aa86e9c11..430cc62591fe 100644
--- a/drivers/staging/iio/resolver/ad2s1200.c
+++ b/drivers/staging/iio/resolver/ad2s1200.c
@@ -143,15 +143,16 @@ static int ad2s1200_probe(struct spi_device *spi)
indio_dev->num_channels = ARRAY_SIZE(ad2s1200_channels);
indio_dev->name = spi_get_device_id(spi)->name;
 
-   ret = devm_iio_device_register(>dev, indio_dev);
-   if (ret)
-   return ret;
-
spi->max_speed_hz = AD2S1200_HZ;
spi->mode = SPI_MODE_3;
-   spi_setup(spi);
+   ret = spi_setup(spi);
+
+   if (ret < 0) {
+   dev_err(>dev, "spi_setup failed!\n");
+   return ret;
+   }
 
-   return 0;
+   return devm_iio_device_register(>dev, indio_dev);
 }
 
 static const struct spi_device_id ad2s1200_id[] = {
-- 
2.17.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 02/12] staging: iio: ad2s1200: Remove unneeded initializations

2018-05-18 Thread David Veenstra
Remove 2 initializations which are unneeded, because the
initialized values are never used.

Signed-off-by: David Veenstra 
---
Changes in v4:
 - Introduced in this version.

 drivers/staging/iio/resolver/ad2s1200.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/resolver/ad2s1200.c 
b/drivers/staging/iio/resolver/ad2s1200.c
index df3b34200a89..9bdcf0c86217 100644
--- a/drivers/staging/iio/resolver/ad2s1200.c
+++ b/drivers/staging/iio/resolver/ad2s1200.c
@@ -47,7 +47,7 @@ static int ad2s1200_read_raw(struct iio_dev *indio_dev,
 long m)
 {
struct ad2s1200_state *st = iio_priv(indio_dev);
-   int ret = 0;
+   int ret;
 
mutex_lock(>lock);
gpio_set_value(st->sample, 0);
@@ -105,7 +105,7 @@ static int ad2s1200_probe(struct spi_device *spi)
unsigned short *pins = spi->dev.platform_data;
struct ad2s1200_state *st;
struct iio_dev *indio_dev;
-   int pn, ret = 0;
+   int pn, ret;
 
for (pn = 0; pn < AD2S1200_PN; pn++) {
ret = devm_gpio_request_one(>dev, pins[pn], GPIOF_DIR_OUT,
-- 
2.17.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 03/12] staging: iio: ad2s1200: Add kernel docs to driver state

2018-05-18 Thread David Veenstra
Add missing kernel docs to the ad2s1200 driver state.

Signed-off-by: David Veenstra 
---
Changes in v4:
 - Simplified explanation of lock.

 drivers/staging/iio/resolver/ad2s1200.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/staging/iio/resolver/ad2s1200.c 
b/drivers/staging/iio/resolver/ad2s1200.c
index 9bdcf0c86217..068aa86e9c11 100644
--- a/drivers/staging/iio/resolver/ad2s1200.c
+++ b/drivers/staging/iio/resolver/ad2s1200.c
@@ -32,6 +32,14 @@
 /* clock period in nano second */
 #define AD2S1200_TSCLK (10 / AD2S1200_HZ)
 
+/**
+ * struct ad2s1200_state - driver instance specific data.
+ * @lock:  protects both the GPIO pins and the rx buffer.
+ * @sdev:  spi device.
+ * @sample:GPIO pin SAMPLE.
+ * @rdvel: GPIO pin RDVEL.
+ * @rx:buffer for spi transfers.
+ */
 struct ad2s1200_state {
struct mutex lock;
struct spi_device *sdev;
-- 
2.17.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 01/12] staging: iio: ad2s1200: Remove unneeded newline in license

2018-05-18 Thread David Veenstra
Remove unneeded newline in license, as it does not improve readability.

Signed-off-by: David Veenstra 
---
Changes in v4:
 - Introduced in this version.

 drivers/staging/iio/resolver/ad2s1200.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/iio/resolver/ad2s1200.c 
b/drivers/staging/iio/resolver/ad2s1200.c
index ea7336645116..df3b34200a89 100644
--- a/drivers/staging/iio/resolver/ad2s1200.c
+++ b/drivers/staging/iio/resolver/ad2s1200.c
@@ -7,7 +7,6 @@
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
- *
  */
 
 #include 
-- 
2.17.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: mt7621-eth: Refactor RX ring resource allocation and cleanup

2018-05-18 Thread Kamal Heib
Simplify the code of allocate and cleanup RX ring resources by using
helper functions, also make sure to free the allocated resources in
cause of allocation failure.

Signed-off-by: Kamal Heib 
---
 drivers/staging/mt7621-eth/mtk_eth_soc.c | 122 ---
 1 file changed, 81 insertions(+), 41 deletions(-)

diff --git a/drivers/staging/mt7621-eth/mtk_eth_soc.c 
b/drivers/staging/mt7621-eth/mtk_eth_soc.c
index 2c7a2e666bfb..16cd514e9790 100644
--- a/drivers/staging/mt7621-eth/mtk_eth_soc.c
+++ b/drivers/staging/mt7621-eth/mtk_eth_soc.c
@@ -278,38 +278,87 @@ static inline void mtk_set_txd_pdma(struct mtk_tx_dma 
*txd,
WRITE_ONCE(dma_txd->txd2, txd->txd2);
 }
 
-static void mtk_clean_rx(struct mtk_eth *eth, struct mtk_rx_ring *ring)
+static void mtk_rx_unmap_dma(struct mtk_eth *eth, struct mtk_rx_ring *ring)
 {
int i;
 
-   if (ring->rx_data && ring->rx_dma) {
-   for (i = 0; i < ring->rx_ring_size; i++) {
-   if (!ring->rx_data[i])
-   continue;
-   if (!ring->rx_dma[i].rxd1)
-   continue;
+   for (i = 0; i < ring->rx_ring_size; i++) {
+   if (ring->rx_dma[i].rxd1)
dma_unmap_single(eth->dev,
 ring->rx_dma[i].rxd1,
 ring->rx_buf_size,
 DMA_FROM_DEVICE);
+   }
+}
+
+static int mtk_rx_map_dma(struct mtk_eth *eth, struct mtk_rx_ring *ring)
+{
+   int i, pad;
+
+   if (!eth->soc->rx_2b_offset)
+   pad = NET_IP_ALIGN;
+
+   for (i = 0; i < ring->rx_ring_size; i++) {
+   dma_addr_t dma_addr = dma_map_single(eth->dev,
+   ring->rx_data[i] + NET_SKB_PAD + pad,
+   ring->rx_buf_size,
+   DMA_FROM_DEVICE);
+   if (unlikely(dma_mapping_error(eth->dev, dma_addr)))
+   goto unmap_dma;
+   ring->rx_dma[i].rxd1 = (unsigned int)dma_addr;
+
+   if (eth->soc->rx_sg_dma)
+   ring->rx_dma[i].rxd2 = RX_DMA_PLEN0(ring->rx_buf_size);
+   else
+   ring->rx_dma[i].rxd2 = RX_DMA_LSO;
+   }
+
+   return 0;
+
+unmap_dma:
+   mtk_rx_unmap_dma(eth, ring);
+   return -ENOMEM;
+}
+
+static void mtk_rx_free_frags(struct mtk_rx_ring *ring)
+{
+   int i;
+
+   for (i = 0; i < ring->rx_ring_size; i++) {
+   if (ring->rx_data[i])
skb_free_frag(ring->rx_data[i]);
-   }
-   kfree(ring->rx_data);
-   ring->rx_data = NULL;
}
+}
 
-   if (ring->rx_dma) {
-   dma_free_coherent(eth->dev,
- ring->rx_ring_size * sizeof(*ring->rx_dma),
- ring->rx_dma,
- ring->rx_phys);
-   ring->rx_dma = NULL;
+static int mtk_rx_alloc_frags(struct mtk_rx_ring *ring)
+{
+   int i;
+
+   for (i = 0; i < ring->rx_ring_size; i++) {
+   ring->rx_data[i] = netdev_alloc_frag(ring->frag_size);
+   if (!ring->rx_data[i])
+   goto free_frags;
}
+
+   return 0;
+
+free_frags:
+   mtk_rx_free_frags(ring);
+   return -ENOMEM;
+}
+
+static void mtk_clean_rx(struct mtk_eth *eth, struct mtk_rx_ring *ring)
+{
+   mtk_rx_unmap_dma(eth, ring);
+   mtk_rx_free_frags(ring);
+   dma_free_coherent(eth->dev, ring->rx_ring_size * sizeof(*ring->rx_dma),
+ ring->rx_dma, ring->rx_phys);
+   kfree(ring->rx_data);
 }
 
 static int mtk_dma_rx_alloc(struct mtk_eth *eth, struct mtk_rx_ring *ring)
 {
-   int i, pad = 0;
+   int err;
 
ring->frag_size = mtk_max_frag_size(ETH_DATA_LEN);
ring->rx_buf_size = mtk_max_buf_size(ring->frag_size);
@@ -317,38 +366,23 @@ static int mtk_dma_rx_alloc(struct mtk_eth *eth, struct 
mtk_rx_ring *ring)
ring->rx_data = kcalloc(ring->rx_ring_size, sizeof(*ring->rx_data),
GFP_KERNEL);
if (!ring->rx_data)
-   goto no_rx_mem;
+   return -ENOMEM;
 
-   for (i = 0; i < ring->rx_ring_size; i++) {
-   ring->rx_data[i] = netdev_alloc_frag(ring->frag_size);
-   if (!ring->rx_data[i])
-   goto no_rx_mem;
-   }
+   err = mtk_rx_alloc_frags(ring);
+   if (err)
+   goto free_rx_data;
 
ring->rx_dma =
dma_alloc_coherent(eth->dev,
   ring->rx_ring_size * sizeof(*ring->rx_dma),
   >rx_phys, GFP_ATOMIC | __GFP_ZERO);
if (!ring->rx_dma)
-   goto no_rx_mem;
-
-   if (!eth->soc->rx_2b_offset)
-   pad = NET_IP_ALIGN;
+ 

[PATCH v3 6/7] staging: rtl8192e: Remove blank space before or after '(' & ')' - style.

2018-05-18 Thread John Whitmore
Corrected coding style issues:
ERROR: space prohibited before that close parenthesis ')'
ERROR: space prohibited after that open parenthesis '('

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 275fadb6f365..cde149af4937 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -122,7 +122,7 @@ void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
  *  return:  none
  *  notice:  Driver should not print out this message by default.
  * 
*/
-void HTDebugHTCapability(u8 *CapIE, u8 *TitleString )
+void HTDebugHTCapability(u8 *CapIE, u8 *TitleString)
 {
 
static u8   EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};   // For 
11n EWC definition, 2007.07.17, by Emily
@@ -135,7 +135,7 @@ void HTDebugHTCapability(u8 *CapIE, u8 *TitleString )
} else {
pCapELE = (PHT_CAPABILITY_ELE)([0]);
}
-   IEEE80211_DEBUG(IEEE80211_DL_HT, ". Called by %s\n", 
TitleString );
+   IEEE80211_DEBUG(IEEE80211_DL_HT, ". Called by %s\n", 
TitleString);
 
IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupported Channel Width = %s\n", 
(pCapELE->ChlWidth)?"20MHz" : "20/40MHz");
IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport Short GI for 20M = %s\n", 
(pCapELE->ShortGI20Mhz)?"YES" : "NO");
@@ -306,17 +306,17 @@ u16  TxCountToDataRate(struct ieee80211_device *ieee, u8 
nDataRate)
isShortGI = 0;
 
  // nDataRate = nDataRate - 12;
-   } else if (nDataRate >= 0x20  && nDataRate <= 0x2f ) {  //(27, 
44)
+   } else if (nDataRate >= 0x20  && nDataRate <= 0x2f) {  //(27, 
44)
is40MHz = 1;
isShortGI = 0;
 
//nDataRate = nDataRate - 28;
-   } else if (nDataRate >= 0x30  && nDataRate <= 0x3f ) {  //(43, 
60)
+   } else if (nDataRate >= 0x30  && nDataRate <= 0x3f) {  //(43, 
60)
is40MHz = 0;
isShortGI = 1;
 
//nDataRate = nDataRate - 44;
-   } else if (nDataRate >= 0x40  && nDataRate <= 0x4f ) {  //(59, 
76)
+   } else if (nDataRate >= 0x40  && nDataRate <= 0x4f) {  //(59, 
76)
is40MHz = 1;
isShortGI = 1;
 
@@ -371,7 +371,7 @@ static void HTIOTPeerDetermine(struct ieee80211_device 
*ieee)
else if ((memcmp(net->bssid, UNKNOWN_BORADCOM, 3) == 0) ||
 (memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3) 
== 0) ||
 (memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3) 
== 0) ||
-(memcmp(net->bssid, NETGEAR834Bv2_BROADCOM, 3) == 0) )
+(memcmp(net->bssid, NETGEAR834Bv2_BROADCOM, 3) == 0))
pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM;
else if ((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3) == 0) ||
 (memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3) == 0) ||
@@ -641,7 +641,7 @@ void HTConstructInfoElement(struct ieee80211_device *ieee, 
u8 *posHTInfo, u8 *le
}
 
memset(posHTInfo, 0, *len);
-   if ( (ieee->iw_mode == IW_MODE_ADHOC) || (ieee->iw_mode == 
IW_MODE_MASTER)) { //ap mode is not currently supported
+   if ((ieee->iw_mode == IW_MODE_ADHOC) || (ieee->iw_mode == 
IW_MODE_MASTER)) { //ap mode is not currently supported
pHTInfoEle->ControlChl  = 
ieee->current_network.channel;
pHTInfoEle->ExtChlOffset= 
((!pHT->bRegBW40MHz) ? HT_EXTCHNL_OFFSET_NO_EXT :

(ieee->current_network.channel <= 6) ?
@@ -867,7 +867,7 @@ static u8 HTFilterMCSRate(struct ieee80211_device *ieee, u8 
*pSupportMCS,
u8 i = 0;
 
// filter out operational rate set not supported by AP, the length of 
it is 16
-   for (i = 0; i <= 15; i++){
+   for (i = 0; i <= 15; i++) {
pOperateMCS[i] = 
ieee->Regdot11HTOperationalRateSet[i][i];
}
 
@@ -965,7 +965,7 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
 
nMaxAMSDUSize = (pPeerHTCap->MaxAMSDUSize == 0) ? 3839 : 7935;
 
-   if (pHTInfo->nAMSDU_MaxSize > nMaxAMSDUSize )
+   if (pHTInfo->nAMSDU_MaxSize > nMaxAMSDUSize)
pHTInfo->nCurrent_AMSDU_MaxSize = nMaxAMSDUSize;
else
pHTInfo->nCurrent_AMSDU_MaxSize = pHTInfo->nAMSDU_MaxSize;
@@ -1009,7 +1009,7 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
pHTInfo->CurrentMPDUDensity = 

[PATCH v3 5/7] staging: rtl8192e: Correct style of braces - coding style.

2018-05-18 Thread John Whitmore
Corrected coding style issue:
ERROR: that open brace { should be on the previous line

Signed-off-by: John Whitmore 
---
 .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c| 203 -
 1 file changed, 72 insertions(+), 131 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 780ef00f8806..275fadb6f365 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -7,28 +7,28 @@ u8 MCS_FILTER_ALL[16] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0
 
 u8 MCS_FILTER_1SS[16] = {0xff, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
-u16 MCS_DATA_RATE[2][2][77] =
-   {   {   {13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78, 104, 
156, 208, 234, 260,
-   39, 78, 117, 234, 312, 351, 390, 52, 104, 156, 208, 
312, 416, 468, 520,
-   0, 78, 104, 130, 117, 156, 195, 104, 130, 130, 156, 
182, 182, 208, 156, 195,
-   195, 234, 273, 273, 312, 130, 156, 181, 156, 181, 208, 
234, 208, 234, 260, 260,
-   286, 195, 234, 273, 234, 273, 312, 351, 312, 351, 390, 
390, 429},   // Long GI, 20MHz
-   {14, 29, 43, 58, 87, 116, 130, 144, 29, 58, 87, 116, 
173, 231, 260, 289,
-   43, 87, 130, 173, 260, 347, 390, 433, 58, 116, 173, 
231, 347, 462, 520, 578,
-   0, 87, 116, 144, 130, 173, 217, 116, 144, 144, 173, 
202, 202, 231, 173, 217,
-   217, 260, 303, 303, 347, 144, 173, 202, 173, 202, 231, 
260, 231, 260, 289, 289,
-   318, 217, 260, 303, 260, 303, 347, 390, 347, 390, 433, 
433, 477}},  // Short GI, 20MHz
-   {   {27, 54, 81, 108, 162, 216, 243, 270, 54, 108, 162, 
216, 324, 432, 486, 540,
-   81, 162, 243, 324, 486, 648, 729, 810, 108, 216, 324, 
432, 648, 864, 972, 1080,
-   12, 162, 216, 270, 243, 324, 405, 216, 270, 270, 324, 
378, 378, 432, 324, 405,
-   405, 486, 567, 567, 648, 270, 324, 378, 324, 378, 432, 
486, 432, 486, 540, 540,
-   594, 405, 486, 567, 486, 567, 648, 729, 648, 729, 810, 
810, 891},   // Long GI, 40MHz
-   {30, 60, 90, 120, 180, 240, 270, 300, 60, 120, 180, 
240, 360, 480, 540, 600,
-   90, 180, 270, 360, 540, 720, 810, 900, 120, 240, 360, 
480, 720, 960, 1080, 1200,
-   13, 180, 240, 300, 270, 360, 450, 240, 300, 300, 360, 
420, 420, 480, 360, 450,
-   450, 540, 630, 630, 720, 300, 360, 420, 360, 420, 480, 
540, 480, 540, 600, 600,
-   660, 450, 540, 630, 540, 630, 720, 810, 720, 810, 900, 
900, 990}}   // Short GI, 40MHz
-   };
+u16 MCS_DATA_RATE[2][2][77] = {
+   {   {13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78, 104, 156, 208, 
234, 260,
+39, 78, 117, 234, 312, 351, 390, 52, 104, 156, 208, 312, 416, 
468, 520,
+0, 78, 104, 130, 117, 156, 195, 104, 130, 130, 156, 182, 182, 
208, 156, 195,
+195, 234, 273, 273, 312, 130, 156, 181, 156, 181, 208, 234, 
208, 234, 260, 260,
+286, 195, 234, 273, 234, 273, 312, 351, 312, 351, 390, 390, 
429},  // Long GI, 20MHz
+   {14, 29, 43, 58, 87, 116, 130, 144, 29, 58, 87, 116, 173, 231, 
260, 289,
+43, 87, 130, 173, 260, 347, 390, 433, 58, 116, 173, 231, 347, 
462, 520, 578,
+0, 87, 116, 144, 130, 173, 217, 116, 144, 144, 173, 202, 202, 
231, 173, 217,
+217, 260, 303, 303, 347, 144, 173, 202, 173, 202, 231, 260, 
231, 260, 289, 289,
+318, 217, 260, 303, 260, 303, 347, 390, 347, 390, 433, 433, 
477}   },  // Short GI, 20MHz
+   {   {27, 54, 81, 108, 162, 216, 243, 270, 54, 108, 162, 216, 324, 
432, 486, 540,
+81, 162, 243, 324, 486, 648, 729, 810, 108, 216, 324, 432, 
648, 864, 972, 1080,
+12, 162, 216, 270, 243, 324, 405, 216, 270, 270, 324, 378, 
378, 432, 324, 405,
+405, 486, 567, 567, 648, 270, 324, 378, 324, 378, 432, 486, 
432, 486, 540, 540,
+594, 405, 486, 567, 486, 567, 648, 729, 648, 729, 810, 810, 
891},  // Long GI, 40MHz
+   {30, 60, 90, 120, 180, 240, 270, 300, 60, 120, 180, 240, 360, 
480, 540, 600,
+90, 180, 270, 360, 540, 720, 810, 900, 120, 240, 360, 480, 
720, 960, 1080, 1200,
+13, 180, 240, 300, 270, 360, 450, 240, 300, 300, 360, 420, 
420, 480, 360, 450,
+450, 540, 630, 630, 720, 300, 360, 420, 360, 420, 480, 540, 
480, 540, 600, 600,
+660, 450, 540, 630, 540, 630, 720, 810, 720, 810, 900, 900, 
990}   }   // Short GI, 40MHz

[PATCH v3 7/7] staging: rtl8192e: Correct indentation of 'switch' & remove trailing spaces

2018-05-18 Thread John Whitmore
Corrected coding style issues:
ERROR: switch and case should be at the same indent
ERROR: trailing whitespace

Signed-off-by: John Whitmore 
---
 .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c| 49 +++---
 1 file changed, 24 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index cde149af4937..263c22ab1572 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -177,35 +177,35 @@ void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString)
IEEE80211_DEBUG(IEEE80211_DL_HT, "\tPrimary channel = %d\n", 
pHTInfoEle->ControlChl);
IEEE80211_DEBUG(IEEE80211_DL_HT, "\tSecondary channel =");
switch (pHTInfoEle->ExtChlOffset) {
-   case 0:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "Not Present\n");
-   break;
-   case 1:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "Upper channel\n");
-   break;
-   case 2:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "Reserved. 
Eooro!!!\n");
-   break;
-   case 3:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "Lower Channel\n");
-   break;
+   case 0:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "Not Present\n");
+   break;
+   case 1:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "Upper channel\n");
+   break;
+   case 2:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "Reserved. Eooro!!!\n");
+   break;
+   case 3:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "Lower Channel\n");
+   break;
}
IEEE80211_DEBUG(IEEE80211_DL_HT, "\tRecommended channel width = %s\n", 
(pHTInfoEle->RecommemdedTxWidth)?"20Mhz" : "40Mhz");
 
IEEE80211_DEBUG(IEEE80211_DL_HT, "\tOperation mode for protection = ");
switch (pHTInfoEle->OptMode) {
-   case 0:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "No Protection\n");
-   break;
-   case 1:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "HT non-member 
protection mode\n");
-   break;
-   case 2:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "Suggest to open 
protection\n");
-   break;
-   case 3:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "HT mixed mode\n");
-   break;
+   case 0:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "No Protection\n");
+   break;
+   case 1:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "HT non-member protection 
mode\n");
+   break;
+   case 2:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "Suggest to open 
protection\n");
+   break;
+   case 3:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "HT mixed mode\n");
+   break;
}
 
IEEE80211_DEBUG(IEEE80211_DL_HT, "\tBasic MCS Rate Set = 
[%x][%x][%x][%x][%x]\n", pHTInfoEle->BasicMSC[0],\
@@ -1019,7 +1019,6 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
pHTInfo->bCurrentAMPDUEnable = false;
pHTInfo->ForcedAMSDUMode = HT_AGG_FORCE_ENABLE;
pHTInfo->ForcedAMSDUMaxSize = 7935;
-   
pHTInfo->IOTAction |=  HT_IOT_ACT_TX_USE_AMSDU_8K;
}
 
-- 
2.16.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 4/7] staging: rtl8192e: Added blank space around operators - coding style.

2018-05-18 Thread John Whitmore
Corrected coding style issue:
ERROR: spaces required around that '==' etc. etc.

Signed-off-by: John Whitmore 
---
 .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c| 108 ++---
 1 file changed, 54 insertions(+), 54 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index efccfd85fe0e..780ef00f8806 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -60,8 +60,8 @@ void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
//printk("pHTinfo:%p, :%p, mptr:%p,  offsetof:%x\n", pHTInfo, 
, __mptr, offsetof(struct ieee80211_device, pHTInfo));
//printk("===>ieee:%p,\n", ieee);
// ShortGI support
-   pHTInfo->bRegShortGI20MHz= 1;
-   pHTInfo->bRegShortGI40MHz= 1;
+   pHTInfo->bRegShortGI20MHz = 1;
+   pHTInfo->bRegShortGI40MHz = 1;
 
// 40MHz channel support
pHTInfo->bRegBW40MHz = 1;
@@ -272,8 +272,8 @@ u16 HTHalfMcsToDataRate(struct ieee80211_device *ieee,  
u8  nMcsRate)
u8  is40MHz;
u8  isShortGI;
 
-   is40MHz  =  (IsHTHalfNmode40Bandwidth(ieee))?1:0;
-   isShortGI = (IsHTHalfNmodeSGI(ieee, is40MHz))? 1:0;
+   is40MHz  =  (IsHTHalfNmode40Bandwidth(ieee)) ? 1:0;
+   isShortGI = (IsHTHalfNmodeSGI(ieee, is40MHz)) ? 1:0;
 
return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate&0x7f)];
 }
@@ -283,10 +283,10 @@ u16 HTMcsToDataRate(struct ieee80211_device *ieee, u8 
nMcsRate)
 {
PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
 
-   u8  is40MHz = (pHTInfo->bCurBW40MHz)?1:0;
-   u8  isShortGI = (pHTInfo->bCurBW40MHz)?
-   ((pHTInfo->bCurShortGI40MHz)?1 
: 0) :
-   ((pHTInfo->bCurShortGI20MHz)?1 
: 0);
+   u8  is40MHz = (pHTInfo->bCurBW40MHz) ? 1:0;
+   u8  isShortGI = (pHTInfo->bCurBW40MHz) ?
+   ((pHTInfo->bCurShortGI40MHz) ? 
1 : 0) :
+   ((pHTInfo->bCurShortGI20MHz) ? 
1 : 0);
return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate&0x7f)];
 }
 
@@ -318,7 +318,7 @@ u16  TxCountToDataRate(struct ieee80211_device *ieee, u8 
nDataRate)
 
  // nDataRate = nDataRate - 12;
}
-   else if (nDataRate >=0x20  && nDataRate <= 0x2f ) //(27, 44)
+   else if (nDataRate >= 0x20  && nDataRate <= 0x2f ) //(27, 44)
{
is40MHz = 1;
isShortGI = 0;
@@ -349,17 +349,17 @@ bool IsHTHalfNmodeAPs(struct ieee80211_device *ieee)
 {
boolretValue = false;
struct ieee80211_network *net = >current_network;
-   if ((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3)==0) ||
-   (memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3)==0) ||
-   (memcmp(net->bssid, PCI_RALINK, 3)==0) ||
-   (memcmp(net->bssid, EDIMAX_RALINK, 3)==0) ||
-   (memcmp(net->bssid, AIRLINK_RALINK, 3)==0) ||
+   if ((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3) == 0) ||
+   (memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3) == 0) ||
+   (memcmp(net->bssid, PCI_RALINK, 3) == 0) ||
+   (memcmp(net->bssid, EDIMAX_RALINK, 3) == 0) ||
+   (memcmp(net->bssid, AIRLINK_RALINK, 3) == 0) ||
(net->ralink_cap_exist))
retValue = true;
-   else if ((memcmp(net->bssid, UNKNOWN_BORADCOM, 3)==0) ||
-(memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 
3)==0)||
-(memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 
3)==0)||
-(memcmp(net->bssid, NETGEAR834Bv2_BROADCOM, 3)==0) ||
+   else if ((memcmp(net->bssid, UNKNOWN_BORADCOM, 3) == 0) ||
+(memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3) 
== 0) ||
+(memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3) 
== 0) ||
+(memcmp(net->bssid, NETGEAR834Bv2_BROADCOM, 3) == 0) ||
 (net->broadcom_cap_exist))
retValue = true;
else if (net->bssht.bdRT2RTAggregation)
@@ -385,21 +385,21 @@ static void HTIOTPeerDetermine(struct ieee80211_device 
*ieee)
pHTInfo->IOTPeer = HT_IOT_PEER_REALTEK;
else if (net->broadcom_cap_exist)
pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM;
-   else if ((memcmp(net->bssid, UNKNOWN_BORADCOM, 3)==0) ||
-   (memcmp(net->bssid, 
LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0)||
-   (memcmp(net->bssid, 
LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3)==0)||
-   (memcmp(net->bssid, NETGEAR834Bv2_BROADCOM, 3)==0) )
+   else if ((memcmp(net->bssid, UNKNOWN_BORADCOM, 3) == 0) ||
+(memcmp(net->bssid, 

[PATCH v3 3/7] staging: rtl8192e: Add blank space before '(' - coding style.

2018-05-18 Thread John Whitmore
Corrected coding style issue:
"ERROR: space required before the open parenthesis '('"

Signed-off-by: John Whitmore 
---
 .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c| 166 ++---
 1 file changed, 83 insertions(+), 83 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 4507ec5401cc..efccfd85fe0e 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -67,7 +67,7 @@ void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
pHTInfo->bRegBW40MHz = 1;
 
// CCK rate support in 40MHz channel
-   if(pHTInfo->bRegBW40MHz)
+   if (pHTInfo->bRegBW40MHz)
pHTInfo->bRegSuppCCK = 1;
else
pHTInfo->bRegSuppCCK = true;
@@ -83,7 +83,7 @@ void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
 
// MIMO Power Save
pHTInfo->SelfMimoPs = 3;// 0: Static Mimo Ps, 1: Dynamic Mimo Ps, 3: No 
Limitation, 2: Reserved(Set to 3 automatically.)
-   if(pHTInfo->SelfMimoPs == 2)
+   if (pHTInfo->SelfMimoPs == 2)
pHTInfo->SelfMimoPs = 3;
// 8190 only. Assign rate operation mode to firmware
ieee->bTxDisableRateFallBack = 0;
@@ -128,7 +128,7 @@ void HTDebugHTCapability(u8 *CapIE, u8 *TitleString )
static u8   EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};   // For 
11n EWC definition, 2007.07.17, by Emily
PHT_CAPABILITY_ELE  pCapELE;
 
-   if(!memcmp(CapIE, EWC11NHTCap, sizeof(EWC11NHTCap)))
+   if (!memcmp(CapIE, EWC11NHTCap, sizeof(EWC11NHTCap)))
{
//EWC IE
IEEE80211_DEBUG(IEEE80211_DL_HT, "EWC IE in %s()\n", __func__);
@@ -165,7 +165,7 @@ void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString)
static u8   EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34};  // For 
11n EWC definition, 2007.07.17, by Emily
PHT_INFORMATION_ELE pHTInfoEle;
 
-   if(!memcmp(InfoIE, EWC11NHTInfo, sizeof(EWC11NHTInfo)))
+   if (!memcmp(InfoIE, EWC11NHTInfo, sizeof(EWC11NHTInfo)))
{
// Not EWC IE
IEEE80211_DEBUG(IEEE80211_DL_HT, "EWC IE in %s()\n", __func__);
@@ -225,13 +225,13 @@ static bool IsHTHalfNmode40Bandwidth(struct 
ieee80211_device *ieee)
boolretValue = false;
PRT_HIGH_THROUGHPUT  pHTInfo = ieee->pHTInfo;
 
-   if(!pHTInfo->bCurrentHTSupport) // wireless is n mode
+   if (!pHTInfo->bCurrentHTSupport)// wireless is n mode
retValue = false;
-   else if(!pHTInfo->bRegBW40MHz)  // station supports 40 bw
+   else if (!pHTInfo->bRegBW40MHz) // station supports 40 bw
retValue = false;
-   else if(!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))  // 
station in half n mode
+   else if (!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) // 
station in half n mode
retValue = false;
-   else if(((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ChlWidth) // ap 
support 40 bw
+   else if (((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ChlWidth) // ap 
support 40 bw
retValue = true;
else
retValue = false;
@@ -244,20 +244,20 @@ static bool IsHTHalfNmodeSGI(struct ieee80211_device 
*ieee, bool is40MHz)
boolretValue = false;
PRT_HIGH_THROUGHPUT  pHTInfo = ieee->pHTInfo;
 
-   if(!pHTInfo->bCurrentHTSupport) // wireless is n mode
+   if (!pHTInfo->bCurrentHTSupport)// wireless is n mode
retValue = false;
-   else if(!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))  // 
station in half n mode
+   else if (!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) // 
station in half n mode
retValue = false;
-   else if(is40MHz) // ap support 40 bw
+   else if (is40MHz) // ap support 40 bw
{
-   if(((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ShortGI40Mhz) 
// ap support 40 bw short GI
+   if 
(((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ShortGI40Mhz) // ap support 40 
bw short GI
retValue = true;
else
retValue = false;
}
else
{
-   if(((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ShortGI20Mhz) 
// ap support 40 bw short GI
+   if 
(((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ShortGI20Mhz) // ap support 40 
bw short GI
retValue = true;
else
retValue = false;
@@ -305,7 +305,7 @@ u16  TxCountToDataRate(struct ieee80211_device *ieee, u8 
nDataRate)
u8  is40MHz = 0;
u8  isShortGI = 0;
 
-   if(nDataRate < 12)
+   if (nDataRate < 12)
{

[PATCH v3 2/7] staging: rtl8192e: Added blank space around ':' - coding style.

2018-05-18 Thread John Whitmore
Corrected coding style issue: "ERROR: spaces required around that ':'"

Signed-off-by: John Whitmore 
---
 .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c| 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 5e8978b6c0cd..4507ec5401cc 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -138,12 +138,12 @@ void HTDebugHTCapability(u8 *CapIE, u8 *TitleString )
 
IEEE80211_DEBUG(IEEE80211_DL_HT, ". Called by %s\n", 
TitleString );
 
-   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupported Channel Width = %s\n", 
(pCapELE->ChlWidth)?"20MHz": "20/40MHz");
-   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport Short GI for 20M = %s\n", 
(pCapELE->ShortGI20Mhz)?"YES": "NO");
-   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport Short GI for 40M = %s\n", 
(pCapELE->ShortGI40Mhz)?"YES": "NO");
-   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport TX STBC = %s\n", 
(pCapELE->TxSTBC)?"YES": "NO");
-   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tMax AMSDU Size = %s\n", 
(pCapELE->MaxAMSDUSize)?"3839": "7935");
-   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport CCK in 20/40 mode = %s\n", 
(pCapELE->DssCCk)?"YES": "NO");
+   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupported Channel Width = %s\n", 
(pCapELE->ChlWidth)?"20MHz" : "20/40MHz");
+   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport Short GI for 20M = %s\n", 
(pCapELE->ShortGI20Mhz)?"YES" : "NO");
+   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport Short GI for 40M = %s\n", 
(pCapELE->ShortGI40Mhz)?"YES" : "NO");
+   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport TX STBC = %s\n", 
(pCapELE->TxSTBC)?"YES" : "NO");
+   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tMax AMSDU Size = %s\n", 
(pCapELE->MaxAMSDUSize)?"3839" : "7935");
+   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport CCK in 20/40 mode = %s\n", 
(pCapELE->DssCCk)?"YES" : "NO");
IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tMax AMPDU Factor = %d\n", 
pCapELE->MaxRxAMPDUFactor);
IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tMPDU Density = %d\n", 
pCapELE->MPDUDensity);
IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tMCS Rate Set = 
[%x][%x][%x][%x][%x]\n", pCapELE->MCS[0],\
@@ -193,7 +193,7 @@ void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString)
IEEE80211_DEBUG(IEEE80211_DL_HT, "Lower Channel\n");
break;
}
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "\tRecommended channel width = %s\n", 
(pHTInfoEle->RecommemdedTxWidth)?"20Mhz": "40Mhz");
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "\tRecommended channel width = %s\n", 
(pHTInfoEle->RecommemdedTxWidth)?"20Mhz" : "40Mhz");
 
IEEE80211_DEBUG(IEEE80211_DL_HT, "\tOperation mode for protection = ");
switch (pHTInfoEle->OptMode)
@@ -285,8 +285,8 @@ u16 HTMcsToDataRate(struct ieee80211_device *ieee, u8 
nMcsRate)
 
u8  is40MHz = (pHTInfo->bCurBW40MHz)?1:0;
u8  isShortGI = (pHTInfo->bCurBW40MHz)?
-   
((pHTInfo->bCurShortGI40MHz)?1:0):
-   
((pHTInfo->bCurShortGI20MHz)?1:0);
+   ((pHTInfo->bCurShortGI40MHz)?1 
: 0) :
+   ((pHTInfo->bCurShortGI20MHz)?1 
: 0);
return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate&0x7f)];
 }
 
@@ -676,9 +676,9 @@ void HTConstructInfoElement(struct ieee80211_device *ieee, 
u8 *posHTInfo, u8 *le
if ( (ieee->iw_mode == IW_MODE_ADHOC) || (ieee->iw_mode == 
IW_MODE_MASTER)) //ap mode is not currently supported
{
pHTInfoEle->ControlChl  = 
ieee->current_network.channel;
-   pHTInfoEle->ExtChlOffset= 
((!pHT->bRegBW40MHz)?HT_EXTCHNL_OFFSET_NO_EXT:
+   pHTInfoEle->ExtChlOffset= 
((!pHT->bRegBW40MHz)?HT_EXTCHNL_OFFSET_NO_EXT :

(ieee->current_network.channel<=6)?
-   
HT_EXTCHNL_OFFSET_UPPER:HT_EXTCHNL_OFFSET_LOWER);
+   
HT_EXTCHNL_OFFSET_UPPER : HT_EXTCHNL_OFFSET_LOWER);
pHTInfoEle->RecommemdedTxWidth  = pHT->bRegBW40MHz;
pHTInfoEle->RIFS= 0;
pHTInfoEle->PSMPAccessOnly  = 0;
-- 
2.16.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[Patch v3] staging: rtl8192e: Clear coding sytle errors

2018-05-18 Thread John Whitmore
Clear various coding style errors in 
drivers/staging/rtl8192u/ieee80211//rtl819x_HTProc.c

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 1/7] staging: rtl8192e: Remove blank space before ', ' - coding style.

2018-05-18 Thread John Whitmore
Corrected coding style issue: "ERROR: space prohibited before that ','"

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index bf7b7122d042..5e8978b6c0cd 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -8,7 +8,7 @@ u8 MCS_FILTER_ALL[16] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0
 u8 MCS_FILTER_1SS[16] = {0xff, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
 u16 MCS_DATA_RATE[2][2][77] =
-   {   {   {13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78 ,104, 
156, 208, 234, 260,
+   {   {   {13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78, 104, 
156, 208, 234, 260,
39, 78, 117, 234, 312, 351, 390, 52, 104, 156, 208, 
312, 416, 468, 520,
0, 78, 104, 130, 117, 156, 195, 104, 130, 130, 156, 
182, 182, 208, 156, 195,
195, 234, 273, 273, 312, 130, 156, 181, 156, 181, 208, 
234, 208, 234, 260, 260,
@@ -301,7 +301,7 @@ u16 HTMcsToDataRate(struct ieee80211_device *ieee, u8 
nMcsRate)
 u16  TxCountToDataRate(struct ieee80211_device *ieee, u8 nDataRate)
 {
//PRT_HIGH_THROUGHPUT   pHTInfo = ieee->pHTInfo;
-   u16 CCKOFDMRate[12] = {0x02 , 0x04 , 0x0b , 0x16 , 0x0c , 
0x12 , 0x18 , 0x24 , 0x30 , 0x48 , 0x60 , 0x6c};
+   u16 CCKOFDMRate[12] = {0x02, 0x04, 0x0b, 0x16, 0x0c, 0x12, 
0x18, 0x24, 0x30, 0x48, 0x60, 0x6c};
u8  is40MHz = 0;
u8  isShortGI = 0;
 
-- 
2.16.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v5 08/12] ARM: dts: imx7s: add multiplexer controls

2018-05-18 Thread Rob Herring
On Fri, May 18, 2018 at 10:28:02AM +0100, Rui Miguel Silva wrote:
> The IOMUXC General Purpose Register has bitfield to control video bus
> multiplexer to control the CSI input between the MIPI-CSI2 and parallel
> interface. Add that register and mask.
> 
> Signed-off-by: Rui Miguel Silva 
> Reviewed-by: Philipp Zabel 
> ---
>  arch/arm/boot/dts/imx7s.dtsi | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
> index 67450ad89940..3590dab529f9 100644
> --- a/arch/arm/boot/dts/imx7s.dtsi
> +++ b/arch/arm/boot/dts/imx7s.dtsi
> @@ -520,8 +520,14 @@
>  
>   gpr: iomuxc-gpr@3034 {
>   compatible = "fsl,imx7d-iomuxc-gpr",
> - "fsl,imx6q-iomuxc-gpr", "syscon";
> + "fsl,imx6q-iomuxc-gpr", "syscon", 
> "simple-mfd";
>   reg = <0x3034 0x1>;
> +
> + mux: mux-controller {
> + compatible = "mmio-mux";
> + #mux-control-cells = <1>;
> + mux-reg-masks = <0x14 0x0010>;

If 1 bit control, then #mux-control-cells can be 0.

> + };
>   };
>  
>   ocotp: ocotp-ctrl@3035 {
> -- 
> 2.17.0
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v5 07/12] ARM: dts: imx7s: add mipi phy power domain

2018-05-18 Thread Rob Herring
On Fri, May 18, 2018 at 10:28:01AM +0100, Rui Miguel Silva wrote:
> Add power domain index 0 related with mipi-phy to imx7s.
> 
> Signed-off-by: Rui Miguel Silva 
> ---
>  arch/arm/boot/dts/imx7s.dtsi | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
> index 4d42335c0dee..67450ad89940 100644
> --- a/arch/arm/boot/dts/imx7s.dtsi
> +++ b/arch/arm/boot/dts/imx7s.dtsi
> @@ -636,6 +636,12 @@
>   #address-cells = <1>;
>   #size-cells = <0>;
>  
> + pgc_mipi_phy: pgc-power-domain@0 {

power-domain@0

> + #power-domain-cells = <0>;
> + reg = <0>;
> + power-supply = <_1p0d>;
> + };
> +
>   pgc_pcie_phy: pgc-power-domain@1 {

ditto.

>   #power-domain-cells = <0>;
>   reg = <1>;
> -- 
> 2.17.0
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v5 06/12] media: dt-bindings: add bindings for i.MX7 media driver

2018-05-18 Thread Rob Herring
On Fri, May 18, 2018 at 10:28:00AM +0100, Rui Miguel Silva wrote:
> Add bindings documentation for i.MX7 media drivers.
> 
> Signed-off-by: Rui Miguel Silva 
> ---
>  .../devicetree/bindings/media/imx7.txt| 125 ++
>  1 file changed, 125 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/media/imx7.txt
> 
> diff --git a/Documentation/devicetree/bindings/media/imx7.txt 
> b/Documentation/devicetree/bindings/media/imx7.txt
> new file mode 100644
> index ..a26372630377
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/imx7.txt
> @@ -0,0 +1,125 @@
> +Freescale i.MX7 Media Video Device
> +==
> +
> +mipi_csi2 node
> +--
> +
> +This is the device node for the MIPI CSI-2 receiver core in i.MX7 SoC. It is
> +compatible with previous version of Samsung D-phy.
> +
> +Required properties:
> +
> +- compatible: "fsl,imx7-mipi-csi2";
> +- reg   : base address and length of the register set for the device;
> +- interrupts: should contain MIPI CSIS interrupt;
> +- clocks: list of clock specifiers, see
> +Documentation/devicetree/bindings/clock/clock-bindings.txt for 
> details;
> +- clock-names   : must contain "pclk", "wrap" and "phy" entries, matching
> +  entries in the clock property;
> +- power-domains : a phandle to the power domain, see
> +  Documentation/devicetree/bindings/power/power_domain.txt for 
> details.
> +- reset-names   : should include following entry "mrst";
> +- resets: a list of phandle, should contain reset entry of
> +  reset-names;
> +- phy-supply: from the generic phy bindings, a phandle to a regulator 
> that
> +   provides power to MIPI CSIS core;
> +- bus-width : maximum number of data lanes supported (SoC specific);

This property is for parallel buses. Either just rely on data-lanes in 
the graph or this should be implied by the compatible.

> +
> +Optional properties:
> +
> +- clock-frequency : The IP's main (system bus) clock frequency in Hz, default
> + value when this property is not specified is 166 MHz;
> +
> +port node
> +-
> +
> +- reg  : (required) can take the values 0 or 1, where 0 is 
> the
> + related sink port and port 1 should be the source one;
> +
> +endpoint node
> +-
> +
> +- data-lanes: (required) an array specifying active physical MIPI-CSI2
> + data input lanes and their mapping to logical lanes; the
> + array's content is unused, only its length is meaningful;
> +
> +- fsl,csis-hs-settle : (optional) differential receiver (HS-RX) settle time;

units and unit-suffix?

> +
> +example:
> +
> +mipi_csi: mipi-csi@3075 {
> +#address-cells = <1>;
> +#size-cells = <0>;
> +
> +compatible = "fsl,imx7-mipi-csi2";
> +reg = <0x3075 0x1>;
> +interrupts = ;
> +clocks = < IMX7D_IPG_ROOT_CLK>,
> +< IMX7D_MIPI_CSI_ROOT_CLK>,
> +< IMX7D_MIPI_DPHY_ROOT_CLK>;

> +clock-names = "pclk", "wrap", "phy";
> +clock-names = "mipi", "phy";

Err...

> +clock-frequency = <16600>;
> +power-domains = <_mipi_phy>;
> +phy-supply = <_1p0d>;
> +resets = < IMX7_RESET_MIPI_PHY_MRST>;
> +reset-names = "mrst";
> +bus-width = <4>;
> +fsl,csis-hs-settle = <3>;
> +fsl,csis-clk-settle = <0>;

Not documented.

> +
> +port@0 {
> +reg = <0>;
> +
> +mipi_from_sensor: endpoint {
> +remote-endpoint = <_to_mipi>;
> +data-lanes = <1>;
> +};
> +};
> +
> +port@1 {
> +reg = <1>;
> +
> +mipi_vc0_to_csi_mux: endpoint {
> +remote-endpoint = <_mux_from_mipi_vc0>;
> +};
> +};
> +};
> +
> +
> +csi node
> +

I'd prefer these split into 2 files.

> +
> +This is device node for the CMOS Sensor Interface (CSI) which enables the 
> chip
> +to connect directly to external CMOS image sensors.
> +
> +Required properties:
> +
> +- compatible: "fsl,imx7-csi";
> +- reg   : base address and length of the register set for the device;
> +- interrupts: should contain CSI interrupt;
> +- clocks: list of clock specifiers, see
> +Documentation/devicetree/bindings/clock/clock-bindings.txt for 
> details;
> +- clock-names   : must contain "axi", "mclk" and "dcic" entries, matching
> + entries in the clock property;


Re: [PATCH v5 06/12] media: dt-bindings: add bindings for i.MX7 media driver

2018-05-18 Thread Philipp Zabel
On Fri, 2018-05-18 at 10:28 +0100, Rui Miguel Silva wrote:
> Add bindings documentation for i.MX7 media drivers.
> 
> Signed-off-by: Rui Miguel Silva 
> ---
>  .../devicetree/bindings/media/imx7.txt| 125 ++
>  1 file changed, 125 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/media/imx7.txt
> 
> diff --git a/Documentation/devicetree/bindings/media/imx7.txt 
> b/Documentation/devicetree/bindings/media/imx7.txt
> new file mode 100644
> index ..a26372630377
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/imx7.txt
> @@ -0,0 +1,125 @@
> +Freescale i.MX7 Media Video Device
> +==
> +
> +mipi_csi2 node
> +--
> +
> +This is the device node for the MIPI CSI-2 receiver core in i.MX7 SoC. It is
> +compatible with previous version of Samsung D-phy.
> +
> +Required properties:
> +
> +- compatible: "fsl,imx7-mipi-csi2";
> +- reg   : base address and length of the register set for the device;
> +- interrupts: should contain MIPI CSIS interrupt;
> +- clocks: list of clock specifiers, see
> +Documentation/devicetree/bindings/clock/clock-bindings.txt for 
> details;
> +- clock-names   : must contain "pclk", "wrap" and "phy" entries, matching
> +  entries in the clock property;
> +- power-domains : a phandle to the power domain, see
> +  Documentation/devicetree/bindings/power/power_domain.txt for 
> details.
> +- reset-names   : should include following entry "mrst";
> +- resets: a list of phandle, should contain reset entry of
> +  reset-names;
> +- phy-supply: from the generic phy bindings, a phandle to a regulator 
> that
> +   provides power to MIPI CSIS core;
> +- bus-width : maximum number of data lanes supported (SoC specific);
> +
> +Optional properties:
> +
> +- clock-frequency : The IP's main (system bus) clock frequency in Hz, default
> + value when this property is not specified is 166 MHz;

Could this be obtained from one of the clock inputs via clk_get_rate?

regards
Philipp
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/1] scsi: storvsc: Avoid allocating memory for temp cpumasks

2018-05-18 Thread Martin K. Petersen

Michael,

> Current code allocates 240 Kbytes (in typical configs) for each
> synthetic SCSI controller to use as temp cpumask variables.  Recode to
> avoid needing the temp cpumask variables and remove the memory
> allocation.

Applied to 4.18/scsi-queue. Thanks!

-- 
Martin K. Petersen  Oracle Linux Engineering
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v5 01/12] media: staging/imx: refactor imx media device probe

2018-05-18 Thread Rui Miguel Silva

Hi Philipp,
Thanks for the quick review.

On Fri 18 May 2018 at 10:32, Philipp Zabel wrote:

Hi Rui,

thank you for refactoring, I think this is much better than 
having the

pretend capture-subsytem device in the DT.

I would like to get rid of the ipu_present flag, if it can be 
done

reasonably. For details, see below.


Yes, I will try to come with something that will play along with 
your

comments. will be in v6.

---
Cheers,
Rui

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 9/9] staging: iio: ad2s1200: Move driver out of staging

2018-05-18 Thread David Julian Veenstra
On 28, April 2018 17:46, Jonathan Cameron wrote:

> On Mon, 23 Apr 2018 00:04:42 +0200
> David Veenstra  wrote:
>
>> Move the iio driver for the ad2s1200 and ad2s1205 resolver-to-digital
>> converter out of staging, into mainline iio subsystems.
>> 
>> Signed-off-by: David Veenstra 
> A few more minor bits and bobs + suggestions.
>
> Some little things that I missed in earlier patches.  If I haven't
> taken the relevant patch, please roll the fixes in for V4.  If I have
> just do a little follow up patch.
>
> Very nearly there!
>

Thanks, I'll add all the recommendations in V4.

Best regards,
David Veenstra

> thanks,
>
> Jonathan
>
>> ---
>> Changes in v3:
>>  - Add mention of ad2s1205 in commit message.
>> 
>>  drivers/iio/Kconfig |   1 +
>>  drivers/iio/Makefile|   1 +
>>  drivers/iio/resolver/Kconfig|  17 +++
>>  drivers/iio/resolver/Makefile   |   5 +
>>  drivers/iio/resolver/ad2s1200.c | 201 
>> 
>>  drivers/staging/iio/resolver/Kconfig|  12 --
>>  drivers/staging/iio/resolver/Makefile   |   1 -
>>  drivers/staging/iio/resolver/ad2s1200.c | 201 
>> 
>>  8 files changed, 225 insertions(+), 214 deletions(-)
>>  create mode 100644 drivers/iio/resolver/Kconfig
>>  create mode 100644 drivers/iio/resolver/Makefile
>>  create mode 100644 drivers/iio/resolver/ad2s1200.c
>>  delete mode 100644 drivers/staging/iio/resolver/ad2s1200.c
>> 
>> diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig
>> index b3c8c6ef0dff..4bec3ccbf4a1 100644
>> --- a/drivers/iio/Kconfig
>> +++ b/drivers/iio/Kconfig
>> @@ -92,6 +92,7 @@ source "drivers/iio/potentiometer/Kconfig"
>>  source "drivers/iio/potentiostat/Kconfig"
>>  source "drivers/iio/pressure/Kconfig"
>>  source "drivers/iio/proximity/Kconfig"
>> +source "drivers/iio/resolver/Kconfig"
>>  source "drivers/iio/temperature/Kconfig"
>>  
>>  endif # IIO
>> diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile
>> index b16b2e9ddc40..1865361b8714 100644
>> --- a/drivers/iio/Makefile
>> +++ b/drivers/iio/Makefile
>> @@ -35,5 +35,6 @@ obj-y += potentiometer/
>>  obj-y += potentiostat/
>>  obj-y += pressure/
>>  obj-y += proximity/
>> +obj-y += resolver/
>>  obj-y += temperature/
>>  obj-y += trigger/
>> diff --git a/drivers/iio/resolver/Kconfig b/drivers/iio/resolver/Kconfig
>> new file mode 100644
>> index ..2ced9f22aa70
>> --- /dev/null
>> +++ b/drivers/iio/resolver/Kconfig
>> @@ -0,0 +1,17 @@
>> +#
>> +# Resolver/Synchro drivers
>> +#
>> +menu "Resolver to digital converters"
>> +
>> +config AD2S1200
>> +tristate "Analog Devices ad2s1200/ad2s1205 driver"
>> +depends on SPI
>> +depends on GPIOLIB || COMPILE_TEST
>> +help
>> +  Say yes here to build support for Analog Devices spi resolver
>> +  to digital converters, ad2s1200 and ad2s1205, provides direct access
>> +  via sysfs.
>> +
>> +  To compile this driver as a module, choose M here: the
>> +  module will be called ad2s1200.
>> +endmenu
>> diff --git a/drivers/iio/resolver/Makefile b/drivers/iio/resolver/Makefile
>> new file mode 100644
>> index ..4e1dccae07e7
>> --- /dev/null
>> +++ b/drivers/iio/resolver/Makefile
>> @@ -0,0 +1,5 @@
>> +#
>> +# Makefile for Resolver/Synchro drivers
>> +#
>> +
>> +obj-$(CONFIG_AD2S1200) += ad2s1200.o
>> diff --git a/drivers/iio/resolver/ad2s1200.c 
>> b/drivers/iio/resolver/ad2s1200.c
>> new file mode 100644
>> index ..d2b62308b31d
>> --- /dev/null
>> +++ b/drivers/iio/resolver/ad2s1200.c
>> @@ -0,0 +1,201 @@
>> +/*
>> + * ad2s1200.c simple support for the ADI Resolver to Digital Converters:
>> + * AD2S1200/1205
>> + *
>> + * Copyright (c) 2010-2010 Analog Devices Inc.
>
> I think you have done enough changes in here that if you want to add your
> own copyright I think it would be justified.
>
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> + *
>
> One of my pet hates if you want to clean it up :)
> No point in having a blank line above here.
>
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#include 
>> +#include 
>> +
>> +#define DRV_NAME "ad2s1200"
>> +
>> +/* input clock on serial interface */
>> +#define AD2S1200_HZ 8192000
>> +/* clock period in nano second */
>> +#define AD2S1200_TSCLK  (10 / AD2S1200_HZ)
>> +
>> +/**
>> + * struct ad2s1200_state - driver instance specific data.
>> + * @lock:   protects both the GPIO pins and the rx buffer, to prevent
>> + *  concurrent spi transactions.
>> + * @sdev:   spi device.
>> + * @sample: GPIO pin SAMPLE.
>> + * @rdvel:  GPIO pin RDVEL.
>> + * @rx: buffer for spi 

Re: [PATCH v3 6/9] staging: iio: ad2s1200: Add scaling factor for angular velocity channel

2018-05-18 Thread David Julian Veenstra

On 28, April 2018 17:35, Jonathan Cameron wrote:

> On Sat, 28 Apr 2018 18:23:44 +0100
> Jonathan Cameron  wrote:
>
>> On Mon, 23 Apr 2018 00:03:59 +0200
>> David Veenstra  wrote:
>> 
>> > The sysfs iio ABI states radians per second is expected as the unit for
>> > angular velocity, but the 12-bit angular velocity register has rps  
>> Really small point, but rps is a bit ambiguous given we are
>> talking about converting to radian's per second ;)
>> 
>> revs is the 'common' name for what it currently is I think.
>> 
>> Otherwise this looks good.
> Actually, I can't immediately tell from the datasheet what the scaling is...
>
> "Bit 15 through bit 4 correspond to the angular
> information. The angular position data format is unsigned
> binary, with all zeros corresponding to 0 degrees and all ones
> corresponding to 360 degrees –l LSB. The angular velocity data
> format instead is twos complement binary, with the MSB
> representing the rotation direction"
>
> Earlier was also had:
>
> "Data Format
> The digital angle signal represents the absolute position of the
> resolver shaft as a 12-bit unsigned binary word. The digital
> velocity signal is a 12-bit twos complement word, which
> represents the velocity of the resolver shaft rotating in either a
> clockwise or a counterclockwise direction."
>
> So for position the 12 bits correspond to 0 to 360 - 360/(2^12)
> hence _SCALE is 360/(2^12)
>
> But I'm not seeing any hint whatsoever on the scaling for the
> rotational velocity...
>
> Am I missing it somewhere?  you might be right in how you have
> read it given it will track up to 1000rps and we are 2 directional
> so -2048 to 2047 so not a huge amount of wasted space.
>
> Failing any other evidence I'll go with what you have until we
> can test this, but the datasheet could be clearer!

When I first read the datasheet it wasn't clear to me either. So I
emailed Michael Hennerich. He confirmed to me that the scaling factor
for degrees is indeed 360 / (2^12- 1). And he told me that the unit
for angular velocity is revolutions per second, and that I should
use a scaling factor of 2PI to convert it to rad/s.

Best regards,
David Veenstra

>
> Jonathan
>> 
>> Jonathan
>> 
>> 
>> > as its unit. So a scaling factor of approximately 2 * Pi is
>> > added to the angular velocity channel.
>> > 
>> > Signed-off-by: David Veenstra 
>> > ---
>> > Changes in v3:
>> >  - A decimal approximation of the scale is used, instead
>> >of a fractional approximation.
>> >  - Remove unneeded explanation of iio_convert_raw_to_processed.
>> > 
>> >  drivers/staging/iio/resolver/ad2s1200.c | 71 
>> > +
>> >  1 file changed, 45 insertions(+), 26 deletions(-)
>> > 
>> > diff --git a/drivers/staging/iio/resolver/ad2s1200.c 
>> > b/drivers/staging/iio/resolver/ad2s1200.c
>> > index 3c7163610ff6..3e1696e52c38 100644
>> > --- a/drivers/staging/iio/resolver/ad2s1200.c
>> > +++ b/drivers/staging/iio/resolver/ad2s1200.c
>> > @@ -57,37 +57,55 @@ static int ad2s1200_read_raw(struct iio_dev *indio_dev,
>> >struct ad2s1200_state *st = iio_priv(indio_dev);
>> >int ret = 0;
>> >  
>> > -  mutex_lock(>lock);
>> > -  gpiod_set_value(st->sample, 0);
>> > -
>> > -  /* delay (6 * AD2S1200_TSCLK + 20) nano seconds */
>> > -  udelay(1);
>> > -  gpiod_set_value(st->sample, 1);
>> > -  gpiod_set_value(st->rdvel, !!(chan->type == IIO_ANGL));
>> > -
>> > -  ret = spi_read(st->sdev, >rx, 2);
>> > -  if (ret < 0) {
>> > +  switch (m) {
>> > +  case IIO_CHAN_INFO_SCALE:
>> > +  switch (chan->type) {
>> > +  case IIO_ANGL_VEL:
>> > +  /* 2 * Pi ~= 6.283185 */
>> > +  *val = 6;
>> > +  *val2 = 283185;
>> > +  return IIO_VAL_INT_PLUS_MICRO;
>> > +  default:
>> > +  return -EINVAL;
>> > +  }
>> > +  break;
>> > +  case IIO_CHAN_INFO_RAW:
>> > +  mutex_lock(>lock);
>> > +  gpiod_set_value(st->sample, 0);
>> > +
>> > +  /* delay (6 * AD2S1200_TSCLK + 20) nano seconds */
>> > +  udelay(1);
>> > +  gpiod_set_value(st->sample, 1);
>> > +  gpiod_set_value(st->rdvel, !!(chan->type == IIO_ANGL));
>> > +
>> > +  ret = spi_read(st->sdev, >rx, 2);
>> > +  if (ret < 0) {
>> > +  mutex_unlock(>lock);
>> > +  return ret;
>> > +  }
>> > +
>> > +  switch (chan->type) {
>> > +  case IIO_ANGL:
>> > +  *val = be16_to_cpup(>rx) >> 4;
>> > +  break;
>> > +  case IIO_ANGL_VEL:
>> > +  *val = sign_extend32(be16_to_cpup(>rx) >> 4, 11);
>> > +  break;
>> > +  default:
>> > +  mutex_unlock(>lock);
>> > +  return -EINVAL;
>> > +  }
>> > +
>> > +  /* delay (2 * AD2S1200_TSCLK + 20) ns for sample pulse */
>> > + 

Re: [Drbd-dev] [PATCH 28/42] drbd: switch to proc_create_single

2018-05-18 Thread Lars Ellenberg
On Wed, May 16, 2018 at 11:43:32AM +0200, Christoph Hellwig wrote:
> And stop messing with try_module_get on THIS_MODULE, which doesn't make
> any sense here.

The idea was to increase module count on /proc/drbd access.

If someone holds /proc/drbd open, previously rmmod would
"succeed" in starting the unload, but then block on remove_proc_entry,
leading to a situation where the lsmod does not show drbd anymore,
but /proc/drbd being still there (but no longer accessible).

I'd rather have rmmod fail up front in this case.
And try_module_get() seemed most appropriate.

Lars

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 5/9] staging: iio: ad2s1200: Add documentation for device tree binding

2018-05-18 Thread David Julian Veenstra
On 28, April 2018 15:27, Jonathan Cameron wrote:

> On Fri, 27 Apr 2018 09:48:20 -0500
> Rob Herring  wrote:
>
>> On Mon, Apr 23, 2018 at 12:03:47AM +0200, David Veenstra wrote:
>> > Add documentation for the added device tree bindings.
>> > 
>> > Signed-off-by: David Veenstra 
>> > ---
>> > Changes in v3:
>> >  - Documentation is added to Documentation/devicetree/bindings/iio/resolver
>> >instead of staging directory.
>> >  - Add mention to ad2s1205 device.
>> > 
>> >  .../devicetree/bindings/iio/resolver/ad2s1200.txt| 16 
>> > 
>> >  1 file changed, 16 insertions(+)
>> >  create mode 100644 
>> > Documentation/devicetree/bindings/iio/resolver/ad2s1200.txt
>> > 
>> > diff --git a/Documentation/devicetree/bindings/iio/resolver/ad2s1200.txt 
>> > b/Documentation/devicetree/bindings/iio/resolver/ad2s1200.txt
>> > new file mode 100644
>> > index ..46b51db38368
>> > --- /dev/null
>> > +++ b/Documentation/devicetree/bindings/iio/resolver/ad2s1200.txt
>> > @@ -0,0 +1,16 @@
>> > +Analog Devices AD2S1200 and AD2S1205 Resolver-to-Digital Converter
>> > +
>> > +Required properties:
>> > + - compatible : should be "adi,ad2s1200" or "adi,ad2s1205"
>> > + - reg : the SPI chip select number of the device
>> > + - sample-gpios : The GPIO pin connected to the SAMPLE line of the 
>> > AD2S1200
>> > + - rdvel-gpios : The GPIO pin connected to the RDVEL line of the AD2S1200 
>> >  
>> 
>> Are these gpios something that would be common to resolvers (whatever 
>> that is) or specific to this chip. For the latter, you need vendor 
>> prefixes.
>
> They are pretty chip specific I think, so prefixes needed.
>
> I'd not really registered that gpios should be vendor prefixed for some reason
> (kind of obvious now you mention it).  We have only a few from a quick grep
> of the bindings for IIO devices (there are loads elsewhere that aren't and
> are clearly very much part specific).  Ah well, will try and do better moving
> forward on this!

The vendor prefixes are new to me. I'll add it in the next version.

Best regards,
David Veenstra

>
> Jonathan
>
>
>> 
>> > +
>> > +Example:
>> > +
>> > +  resolver {  
>> 
>> Missing unit address.
>> 
>> > +  compatible = "adi,ad2s1200";
>> > +  reg = <4>;
>> > +  sample-gpios = < 5 GPIO_ACTIVE_HIGH>;
>> > +  rdvel-gpios = < 6 GPIO_ACTIVE_HIGH>;
>> > +  };
>> > -- 
>> > 2.16.2
>> >   

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 1/9] staging: iio: ad2s1200: Add kernel docs to driver state

2018-05-18 Thread David Julian Veenstra
On 28, April 2018 17:11, Jonathan Cameron wrote:

> On Mon, 23 Apr 2018 00:02:51 +0200
> David Veenstra  wrote:
>
>> Add missing kernel docs to the ad2s1200 driver state.
>> 
>> Signed-off-by: David Veenstra 
> Hi David,
>
> Comment inline.
>
>> ---
>> Changes in v3:
>>  - Added more explanation to mutex lock.
>> 
>>  drivers/staging/iio/resolver/ad2s1200.c | 9 +
>>  1 file changed, 9 insertions(+)
>> 
>> diff --git a/drivers/staging/iio/resolver/ad2s1200.c 
>> b/drivers/staging/iio/resolver/ad2s1200.c
>> index 357fe3c382b3..17d65cb437fd 100644
>> --- a/drivers/staging/iio/resolver/ad2s1200.c
>> +++ b/drivers/staging/iio/resolver/ad2s1200.c
>> @@ -33,6 +33,15 @@
>>  /* clock period in nano second */
>>  #define AD2S1200_TSCLK  (10 / AD2S1200_HZ)
>>  
>> +/**
>> + * struct ad2s1200_state - driver instance specific data.
>> + * @lock:   protects both the GPIO pins and the rx buffer, to prevent
>> + *  concurrent spi transactions.
> It isn't actually preventing concurrent spi transactions - that
> is done by the spi core itself.  What it is preventing is
> concurrent 'actions' with the device - these involve
> a mixture of gpio changes and spi transactions.
>
> That would take some considerable explaining and frankly the code
> does the job just fine once people know to look.
>
> I'd just leave it as "protects both the GPIO pins and the rx buffer."
> Or feel free to see if you can come up with a brief description of
> exactly what we need to be 'atomic'.

Agreed that the code is clear. I'll revert the description.

Best regards,
David Veenstra

>
> Thanks,
>
> Jonathan
>
>> + * @sdev:   spi device.
>> + * @sample: GPIO pin SAMPLE.
>> + * @rdvel:  GPIO pin RDVEL.
>> + * @rx: buffer for spi transfers.
>> + */
>>  struct ad2s1200_state {
>>  struct mutex lock;
>>  struct spi_device *sdev;

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v5 02/12] media: staging/imx7: add imx7 CSI subdev driver

2018-05-18 Thread Philipp Zabel
On Fri, 2018-05-18 at 10:27 +0100, Rui Miguel Silva wrote:
> This add the media entity subdevice and control driver for the i.MX7
> CMOS Sensor Interface.
> 
> Signed-off-by: Rui Miguel Silva 
> ---
[...]
> +static int imx7_csi_probe(struct platform_device *pdev)
> +{
> + struct device *dev = >dev;
> + struct device_node *node = dev->of_node;
> + struct imx7_csi *csi;
> + struct resource *res;
> + int ret;
> +
> + csi = devm_kzalloc(>dev, sizeof(*csi), GFP_KERNEL);
> + if (!csi)
> + return -ENOMEM;
> +
> + platform_set_drvdata(pdev, >sd);
> + csi->dev = dev;
> +
> + ret = imx7_csi_parse_dt(csi);
> + if (ret < 0)
> + return -ENODEV;
> +
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + csi->irq = platform_get_irq(pdev, 0);
> + if (!res || csi->irq < 0) {
> + dev_err(dev, "Missing platform resources data\n");
> + return -ENODEV;
> + }
> +
> + csi->regbase = devm_ioremap_resource(dev, res);
> + if (IS_ERR(csi->regbase)) {
> + dev_err(dev, "Failed platform resources map\n");
> + return -ENODEV;
> + }
> +
> + spin_lock_init(>irqlock);
> + mutex_init(>lock);
> +
> + /* install interrupt handler */
> + ret = devm_request_irq(dev, csi->irq, imx7_csi_irq_handler, 0, "csi",
> +(void *)csi);
> + if (ret < 0) {
> + dev_err(dev, "Request CSI IRQ failed.\n");
> + return -ENODEV;
> + }
> +
> + /* add media device */
> + csi->imxmd = imx_media_dev_init(dev, false);
> + if (IS_ERR(csi->imxmd))
> + return PTR_ERR(csi->imxmd);
> +
> + ret = imx_media_of_add_csi(csi->imxmd, node);
> + if (ret < 0)
> + goto media_cleanup;
> +
> + ret = imx_media_dev_notifier_register(csi->imxmd);
> + if (ret < 0)
> + goto media_cleanup;
> +
> + v4l2_subdev_init(>sd, _csi_subdev_ops);
> + v4l2_set_subdevdata(>sd, csi);
> + csi->sd.internal_ops = _csi_internal_ops;
> + csi->sd.entity.ops = _csi_entity_ops;
> + csi->sd.entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;
> + csi->sd.dev = >dev;
> + csi->sd.owner = THIS_MODULE;
> + csi->sd.flags = V4L2_SUBDEV_FL_HAS_DEVNODE;
> + csi->sd.grp_id = IMX_MEDIA_GRP_ID_CSI0;

See my comments on the first patch. Since grp_id specifies an IPU CSI0,
it would be better to use a different id here to make clear this is a
standalone CSI as opposed to an IPU CSI.

regards
Philipp
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v5 01/12] media: staging/imx: refactor imx media device probe

2018-05-18 Thread Philipp Zabel
Hi Rui,

thank you for refactoring, I think this is much better than having the
pretend capture-subsytem device in the DT.

I would like to get rid of the ipu_present flag, if it can be done
reasonably. For details, see below.

On Fri, 2018-05-18 at 10:27 +0100, Rui Miguel Silva wrote:
> Refactor and move media device initialization code to a new common module, so 
> it
> can be used by other devices, this will allow for example a near to introduce
> imx7 CSI driver, to use this media device.
> 
> Also introduce a new flag to control the presence of IPU or not (imx6/5 have
> this but imx7 does not have).
> 
> Signed-off-by: Rui Miguel Silva 
> ---
>  drivers/staging/media/imx/Makefile|   1 +
>  .../staging/media/imx/imx-media-dev-common.c  | 102 ++
>  drivers/staging/media/imx/imx-media-dev.c |  89 ---
>  .../staging/media/imx/imx-media-internal-sd.c |   3 +
>  drivers/staging/media/imx/imx-media-of.c  |   6 +-
>  drivers/staging/media/imx/imx-media.h |  18 
>  6 files changed, 150 insertions(+), 69 deletions(-)
>  create mode 100644 drivers/staging/media/imx/imx-media-dev-common.c
> 
> diff --git a/drivers/staging/media/imx/Makefile 
> b/drivers/staging/media/imx/Makefile
> index 698a4210316e..a30b3033f9a3 100644
> --- a/drivers/staging/media/imx/Makefile
> +++ b/drivers/staging/media/imx/Makefile
> @@ -1,5 +1,6 @@
>  # SPDX-License-Identifier: GPL-2.0
>  imx-media-objs := imx-media-dev.o imx-media-internal-sd.o imx-media-of.o
> +imx-media-objs += imx-media-dev-common.o
>  imx-media-common-objs := imx-media-utils.o imx-media-fim.o
>  imx-media-ic-objs := imx-ic-common.o imx-ic-prp.o imx-ic-prpencvf.o
>  
> diff --git a/drivers/staging/media/imx/imx-media-dev-common.c 
> b/drivers/staging/media/imx/imx-media-dev-common.c
> new file mode 100644
> index ..7e9613ca5b5f
> --- /dev/null
> +++ b/drivers/staging/media/imx/imx-media-dev-common.c
> @@ -0,0 +1,102 @@
> +// SPDX-License-Identifier: GPL
> +/*
> + * V4L2 Media Controller Driver for Freescale common i.MX5/6/7 SOC
> + *
> + * Copyright (c) 2018 Linaro Ltd
> + * Copyright (c) 2016 Mentor Graphics Inc.
> + */
> +
> +#include 
> +#include 
> +#include "imx-media.h"
> +
> +static const struct v4l2_async_notifier_operations imx_media_subdev_ops = {
> + .bound = imx_media_subdev_bound,
> + .complete = imx_media_probe_complete,
> +};
> +
> +static const struct media_device_ops imx_media_md_ops = {
> + .link_notify = imx_media_link_notify,
> +};
> +
> +struct imx_media_dev *imx_media_dev_init(struct device *dev, bool 
> ipu_present)
> +{
> + struct imx_media_dev *imxmd;
> + int ret;
> +
> + imxmd = devm_kzalloc(dev, sizeof(*imxmd), GFP_KERNEL);
> + if (!imxmd)
> + return ERR_PTR(-ENOMEM);
> +
> + dev_set_drvdata(dev, imxmd);
> +
> + strlcpy(imxmd->md.model, "imx-media", sizeof(imxmd->md.model));
> + imxmd->md.ops = _media_md_ops;
> + imxmd->md.dev = dev;
> +
> + imxmd->ipu_present = ipu_present;

Storing this in the imxmd is not necessary if all subdevices are tagged
correctly, see below.

> +
> + mutex_init(>mutex);
> +
> + imxmd->v4l2_dev.mdev = >md;
> + strlcpy(imxmd->v4l2_dev.name, "imx-media",
> + sizeof(imxmd->v4l2_dev.name));
> +
> + media_device_init(>md);
> +
> + ret = v4l2_device_register(dev, >v4l2_dev);
> + if (ret < 0) {
> + v4l2_err(>v4l2_dev,
> +  "Failed to register v4l2_device: %d\n", ret);
> + goto cleanup;
> + }
> +
> + dev_set_drvdata(imxmd->v4l2_dev.dev, imxmd);
> +
> + INIT_LIST_HEAD(>vdev_list);
> +
> + return imxmd;
> +
> +cleanup:
> + media_device_cleanup(>md);
> +
> + return ERR_PTR(ret);
> +}
> +EXPORT_SYMBOL_GPL(imx_media_dev_init);
> +
> +int imx_media_dev_notifier_register(struct imx_media_dev *imxmd)
> +{
> + int ret;
> +
> + /* no subdevs? just bail */
> + if (imxmd->notifier.num_subdevs == 0) {
> + v4l2_err(>v4l2_dev, "no subdevs\n");
> + return -ENODEV;
> + }
> +
> + /* prepare the async subdev notifier and register it */
> + imxmd->notifier.ops = _media_subdev_ops;
> + ret = v4l2_async_notifier_register(>v4l2_dev,
> +>notifier);
> + if (ret) {
> + v4l2_err(>v4l2_dev,
> +  "v4l2_async_notifier_register failed with %d\n", ret);
> + return ret;
> + }
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(imx_media_dev_notifier_register);
> +
> +void imx_media_dev_cleanup(struct imx_media_dev *imxmd)
> +{
> + v4l2_device_unregister(>v4l2_dev);
> + media_device_cleanup(>md);
> +}
> +EXPORT_SYMBOL_GPL(imx_media_dev_cleanup);
> +
> +void imx_media_dev_notifier_unregister(struct imx_media_dev *imxmd)
> +{
> + v4l2_async_notifier_cleanup(>notifier);
> +}
> +EXPORT_SYMBOL_GPL(imx_media_dev_notifier_unregister);
> diff --git 

[PATCH] staging: mt7621-mmc: fix spelling mistake: "Eanable" -> "Enable"

2018-05-18 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in N_MSG message text

Signed-off-by: Colin Ian King 
---
 drivers/staging/mt7621-mmc/sd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index ddac4ce6457b..11bf4b4c3403 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -2032,7 +2032,7 @@ static void msdc_enable_cd_irq(struct msdc_host *host, 
int enable)
return;
}
 
-   N_MSG(CFG, "CD IRQ Eanable(%d)", enable);
+   N_MSG(CFG, "CD IRQ Enable(%d)", enable);
 
if (enable) {
/* card detection circuit relies on the core power so that the 
core power
-- 
2.17.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v5 11/12] media: imx7.rst: add documentation for i.MX7 media driver

2018-05-18 Thread Rui Miguel Silva
Add rst document to describe the i.MX7 media driver and also a working
example from the Warp7 board usage with a OV2680 sensor.

Signed-off-by: Rui Miguel Silva 
---
 Documentation/media/v4l-drivers/imx7.rst  | 157 ++
 Documentation/media/v4l-drivers/index.rst |   1 +
 2 files changed, 158 insertions(+)
 create mode 100644 Documentation/media/v4l-drivers/imx7.rst

diff --git a/Documentation/media/v4l-drivers/imx7.rst 
b/Documentation/media/v4l-drivers/imx7.rst
new file mode 100644
index ..cd1195d391c5
--- /dev/null
+++ b/Documentation/media/v4l-drivers/imx7.rst
@@ -0,0 +1,157 @@
+i.MX7 Video Capture Driver
+==
+
+Introduction
+
+
+The i.MX7 contrary to the i.MX5/6 family does not contain an Image Processing
+Unit (IPU); because of that the capabilities to perform operations or
+manipulation of the capture frames are less feature rich.
+
+For image capture the i.MX7 has three units:
+- CMOS Sensor Interface (CSI)
+- Video Multiplexer
+- MIPI CSI-2 Receiver
+
+::
+   |\
+   MIPI Camera Input ---> MIPI CSI-2 --- > | \
+   |  \
+   | M |
+   | U | -->  CSI ---> Capture
+   | X |
+   |  /
+   Parallel Camera Input > | /
+   |/
+
+For additional information, please refer to the latest versions of the i.MX7
+reference manual [#f1]_.
+
+Entities
+
+
+imx7-mipi-csi2
+--
+
+This is the MIPI CSI-2 receiver entity. It has one sink pad to receive the 
pixel
+data from MIPI CSI-2 camera sensor. It has one source pad, corresponding to the
+virtual channel 0. This module is compliant to previous version of Samsung
+D-phy, and supports two D-PHY Rx Data lanes.
+
+csi_mux
+---
+
+This is the video multiplexer. It has two sink pads to select from either 
camera
+sensor with a parallel interface or from MIPI CSI-2 virtual channel 0.  It has
+a single source pad that routes to the CSI.
+
+csi
+---
+
+The CSI enables the chip to connect directly to external CMOS image sensor. CSI
+can interface directly with Parallel and MIPI CSI-2 buses. It has 256 x 64 FIFO
+to store received image pixel data and embedded DMA controllers to transfer 
data
+from the FIFO through AHB bus.
+
+This entity has one sink pad that receives from the csi_mux entity and a single
+source pad that routes video frames directly to memory buffers. This pad is
+routed to a capture device node.
+
+Usage Notes
+---
+
+To aid in configuration and for backward compatibility with V4L2 applications
+that access controls only from video device nodes, the capture device 
interfaces
+inherit controls from the active entities in the current pipeline, so controls
+can be accessed either directly from the subdev or from the active capture
+device interface. For example, the sensor controls are available either from 
the
+sensor subdevs or from the active capture device.
+
+Warp7 with OV2680
+-
+
+On this platform an OV2680 MIPI CSI-2 module is connected to the internal MIPI
+CSI-2 receiver. The following example configures a video capture pipeline with
+an output of 800x600, and BGGR 10 bit bayer format:
+
+.. code-block:: none
+   # Setup links
+   media-ctl -l "'ov2680 1-0036':0 -> 'imx7-mipi-csis.0':0[1]"
+   media-ctl -l "'imx7-mipi-csis.0':1 -> 'csi_mux':1[1]"
+   media-ctl -l "'csi_mux':2 -> 'csi':0[1]"
+   media-ctl -l "'csi':1 -> 'csi capture':0[1]"
+
+   # Configure pads for pipeline
+   media-ctl -V "'ov2680 1-0036':0 [fmt:SBGGR10_1X10/800x600 field:none]"
+   media-ctl -V "'csi_mux':1 [fmt:SBGGR10_1X10/800x600 field:none]"
+   media-ctl -V "'csi_mux':2 [fmt:SBGGR10_1X10/800x600 field:none]"
+   media-ctl -V "'imx7-mipi-csis.0':0 [fmt:SBGGR10_1X10/800x600 field:none]"
+   media-ctl -V "'csi':0 [fmt:SBGGR10_1X10/800x600 field:none]"
+
+After this streaming can start. The v4l2-ctl tool can be used to select any of
+the resolutions supported by the sensor.
+
+.. code-block:: none
+root@imx7s-warp:~# media-ctl -p
+Media controller API version 4.17.0
+
+Media device information
+
+driver  imx-media
+model   imx-media
+serial
+bus info
+hw revision 0x0
+driver version  4.17.0
+
+Device topology
+- entity 1: csi (2 pads, 2 links)
+   type V4L2 subdev subtype Unknown flags 0
+   device node name /dev/v4l-subdev0
+   pad0: Sink
+   [fmt:SBGGR10_1X10/800x600 field:none]
+   <- "csi_mux":2 [ENABLED]
+   pad1: Source
+   [fmt:SBGGR10_1X10/800x600 field:none]
+   -> "csi capture":0 [ENABLED]
+
+- entity 4: csi capture (1 pad, 1 link)
+ 

[PATCH v5 09/12] ARM: dts: imx7: Add video mux, csi and mipi_csi and connections

2018-05-18 Thread Rui Miguel Silva
This patch adds the device tree nodes for csi, video multiplexer and mipi-csi
besides the graph connecting the necessary endpoints to make the media capture
entities to work in imx7 Warp board.

Also add the pin control related with the mipi_csi in that board.

Signed-off-by: Rui Miguel Silva 
---
 arch/arm/boot/dts/imx7s-warp.dts | 51 
 arch/arm/boot/dts/imx7s.dtsi | 28 ++
 2 files changed, 79 insertions(+)

diff --git a/arch/arm/boot/dts/imx7s-warp.dts b/arch/arm/boot/dts/imx7s-warp.dts
index 8a30b148534d..cb175ee2fc9d 100644
--- a/arch/arm/boot/dts/imx7s-warp.dts
+++ b/arch/arm/boot/dts/imx7s-warp.dts
@@ -310,6 +310,57 @@
status = "okay";
 };
 
+ {
+   csi_mux {
+   compatible = "video-mux";
+   mux-controls = < 0>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@1 {
+   reg = <1>;
+
+   csi_mux_from_mipi_vc0: endpoint {
+   remote-endpoint = <_vc0_to_csi_mux>;
+   };
+   };
+
+   port@2 {
+   reg = <2>;
+
+   csi_mux_to_csi: endpoint {
+   remote-endpoint = <_from_csi_mux>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
+
+   port {
+   csi_from_csi_mux: endpoint {
+   remote-endpoint = <_mux_to_csi>;
+   };
+   };
+};
+
+_csi {
+   clock-frequency = <16600>;
+   status = "okay";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   fsl,csis-hs-settle = <3>;
+
+   port@1 {
+   reg = <1>;
+
+   mipi_vc0_to_csi_mux: endpoint {
+   remote-endpoint = <_mux_from_mipi_vc0>;
+   };
+   };
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_wdog>;
diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
index 3590dab529f9..0bae41f2944c 100644
--- a/arch/arm/boot/dts/imx7s.dtsi
+++ b/arch/arm/boot/dts/imx7s.dtsi
@@ -46,6 +46,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "imx7d-pinfunc.h"
 
 / {
@@ -738,6 +739,17 @@
status = "disabled";
};
 
+   csi: csi@3071 {
+   compatible = "fsl,imx7-csi";
+   reg = <0x3071 0x1>;
+   interrupts = ;
+   clocks = < IMX7D_CLK_DUMMY>,
+   < IMX7D_CSI_MCLK_ROOT_CLK>,
+   < IMX7D_CLK_DUMMY>;
+   clock-names = "axi", "mclk", "dcic";
+   status = "disabled";
+   };
+
lcdif: lcdif@3073 {
compatible = "fsl,imx7d-lcdif", 
"fsl,imx28-lcdif";
reg = <0x3073 0x1>;
@@ -747,6 +759,22 @@
clock-names = "pix", "axi";
status = "disabled";
};
+
+   mipi_csi: mipi-csi@3075 {
+   compatible = "fsl,imx7-mipi-csi2";
+   reg = <0x3075 0x1>;
+   interrupts = ;
+   clocks = < IMX7D_IPG_ROOT_CLK>,
+   < IMX7D_MIPI_CSI_ROOT_CLK>,
+   < 
IMX7D_MIPI_DPHY_ROOT_CLK>;
+   clock-names = "pclk", "wrap", "phy";
+   power-domains = <_mipi_phy>;
+   phy-supply = <_1p0d>;
+   resets = < IMX7_RESET_MIPI_PHY_MRST>;
+   reset-names = "mrst";
+   bus-width = <2>;
+   status = "disabled";
+   };
};
 
aips3: aips-bus@3080 {
-- 
2.17.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v5 08/12] ARM: dts: imx7s: add multiplexer controls

2018-05-18 Thread Rui Miguel Silva
The IOMUXC General Purpose Register has bitfield to control video bus
multiplexer to control the CSI input between the MIPI-CSI2 and parallel
interface. Add that register and mask.

Signed-off-by: Rui Miguel Silva 
Reviewed-by: Philipp Zabel 
---
 arch/arm/boot/dts/imx7s.dtsi | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
index 67450ad89940..3590dab529f9 100644
--- a/arch/arm/boot/dts/imx7s.dtsi
+++ b/arch/arm/boot/dts/imx7s.dtsi
@@ -520,8 +520,14 @@
 
gpr: iomuxc-gpr@3034 {
compatible = "fsl,imx7d-iomuxc-gpr",
-   "fsl,imx6q-iomuxc-gpr", "syscon";
+   "fsl,imx6q-iomuxc-gpr", "syscon", 
"simple-mfd";
reg = <0x3034 0x1>;
+
+   mux: mux-controller {
+   compatible = "mmio-mux";
+   #mux-control-cells = <1>;
+   mux-reg-masks = <0x14 0x0010>;
+   };
};
 
ocotp: ocotp-ctrl@3035 {
-- 
2.17.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v5 12/12] media: staging/imx: add i.MX7 entries to TODO file

2018-05-18 Thread Rui Miguel Silva
Add some i.MX7 related entries to TODO file.

Signed-off-by: Rui Miguel Silva 
---
 drivers/staging/media/imx/TODO | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/staging/media/imx/TODO b/drivers/staging/media/imx/TODO
index aeeb15494a49..6f29b5ca5324 100644
--- a/drivers/staging/media/imx/TODO
+++ b/drivers/staging/media/imx/TODO
@@ -45,3 +45,12 @@
 
  Which means a port must not contain mixed-use endpoints, they
  must all refer to media links between V4L2 subdevices.
+
+- i.MX7: all of the above, since it uses the imx media core
+
+- i.MX7: use Frame Interval Monitor
+
+- i.MX7: runtime testing with parallel sensor, links setup and streaming
+
+- i.MX7: runtime testing with different formats, for the time only 10-bit bayer
+  is tested
-- 
2.17.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v5 06/12] media: dt-bindings: add bindings for i.MX7 media driver

2018-05-18 Thread Rui Miguel Silva
Add bindings documentation for i.MX7 media drivers.

Signed-off-by: Rui Miguel Silva 
---
 .../devicetree/bindings/media/imx7.txt| 125 ++
 1 file changed, 125 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/imx7.txt

diff --git a/Documentation/devicetree/bindings/media/imx7.txt 
b/Documentation/devicetree/bindings/media/imx7.txt
new file mode 100644
index ..a26372630377
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/imx7.txt
@@ -0,0 +1,125 @@
+Freescale i.MX7 Media Video Device
+==
+
+mipi_csi2 node
+--
+
+This is the device node for the MIPI CSI-2 receiver core in i.MX7 SoC. It is
+compatible with previous version of Samsung D-phy.
+
+Required properties:
+
+- compatible: "fsl,imx7-mipi-csi2";
+- reg   : base address and length of the register set for the device;
+- interrupts: should contain MIPI CSIS interrupt;
+- clocks: list of clock specifiers, see
+Documentation/devicetree/bindings/clock/clock-bindings.txt for details;
+- clock-names   : must contain "pclk", "wrap" and "phy" entries, matching
+  entries in the clock property;
+- power-domains : a phandle to the power domain, see
+  Documentation/devicetree/bindings/power/power_domain.txt for details.
+- reset-names   : should include following entry "mrst";
+- resets: a list of phandle, should contain reset entry of
+  reset-names;
+- phy-supply: from the generic phy bindings, a phandle to a regulator that
+ provides power to MIPI CSIS core;
+- bus-width : maximum number of data lanes supported (SoC specific);
+
+Optional properties:
+
+- clock-frequency : The IP's main (system bus) clock frequency in Hz, default
+   value when this property is not specified is 166 MHz;
+
+port node
+-
+
+- reg: (required) can take the values 0 or 1, where 0 is the
+ related sink port and port 1 should be the source one;
+
+endpoint node
+-
+
+- data-lanes: (required) an array specifying active physical MIPI-CSI2
+   data input lanes and their mapping to logical lanes; the
+   array's content is unused, only its length is meaningful;
+
+- fsl,csis-hs-settle : (optional) differential receiver (HS-RX) settle time;
+
+example:
+
+mipi_csi: mipi-csi@3075 {
+#address-cells = <1>;
+#size-cells = <0>;
+
+compatible = "fsl,imx7-mipi-csi2";
+reg = <0x3075 0x1>;
+interrupts = ;
+clocks = < IMX7D_IPG_ROOT_CLK>,
+< IMX7D_MIPI_CSI_ROOT_CLK>,
+< IMX7D_MIPI_DPHY_ROOT_CLK>;
+clock-names = "pclk", "wrap", "phy";
+clock-names = "mipi", "phy";
+clock-frequency = <16600>;
+power-domains = <_mipi_phy>;
+phy-supply = <_1p0d>;
+resets = < IMX7_RESET_MIPI_PHY_MRST>;
+reset-names = "mrst";
+bus-width = <4>;
+fsl,csis-hs-settle = <3>;
+fsl,csis-clk-settle = <0>;
+
+port@0 {
+reg = <0>;
+
+mipi_from_sensor: endpoint {
+remote-endpoint = <_to_mipi>;
+data-lanes = <1>;
+};
+};
+
+port@1 {
+reg = <1>;
+
+mipi_vc0_to_csi_mux: endpoint {
+remote-endpoint = <_mux_from_mipi_vc0>;
+};
+};
+};
+
+
+csi node
+
+
+This is device node for the CMOS Sensor Interface (CSI) which enables the chip
+to connect directly to external CMOS image sensors.
+
+Required properties:
+
+- compatible: "fsl,imx7-csi";
+- reg   : base address and length of the register set for the device;
+- interrupts: should contain CSI interrupt;
+- clocks: list of clock specifiers, see
+Documentation/devicetree/bindings/clock/clock-bindings.txt for details;
+- clock-names   : must contain "axi", "mclk" and "dcic" entries, matching
+ entries in the clock property;
+
+example:
+
+csi: csi@3071 {
+#address-cells = <1>;
+#size-cells = <0>;
+
+compatible = "fsl,imx7-csi";
+reg = <0x3071 0x1>;
+interrupts = ;
+clocks = < IMX7D_CLK_DUMMY>,
+< IMX7D_CSI_MCLK_ROOT_CLK>,
+< IMX7D_CLK_DUMMY>;
+clock-names = "axi", "mclk", "dcic";
+
+  

[PATCH v5 04/12] clk: imx7d: reset parent for mipi csi root

2018-05-18 Thread Rui Miguel Silva
To guarantee that we do not get Overflow in image FIFO the outer bandwidth has
to be faster than inputer bandwidth. For that it must be possible to set a
faster frequency clock. So set new parent to sys_pfd3 clock for the mipi csi
block.

Acked-by: Shawn Guo 
Signed-off-by: Rui Miguel Silva 
---
 drivers/clk/imx/clk-imx7d.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/imx/clk-imx7d.c b/drivers/clk/imx/clk-imx7d.c
index f7f4db2e6fa6..27877d05faa2 100644
--- a/drivers/clk/imx/clk-imx7d.c
+++ b/drivers/clk/imx/clk-imx7d.c
@@ -891,6 +891,8 @@ static void __init imx7d_clocks_init(struct device_node 
*ccm_node)
clk_set_parent(clks[IMX7D_PLL_AUDIO_MAIN_BYPASS], 
clks[IMX7D_PLL_AUDIO_MAIN]);
clk_set_parent(clks[IMX7D_PLL_VIDEO_MAIN_BYPASS], 
clks[IMX7D_PLL_VIDEO_MAIN]);
 
+   clk_set_parent(clks[IMX7D_MIPI_CSI_ROOT_SRC], 
clks[IMX7D_PLL_SYS_PFD3_CLK]);
+
/* use old gpt clk setting, gpt1 root clk must be twice as gpt counter 
freq */
clk_set_parent(clks[IMX7D_GPT1_ROOT_SRC], clks[IMX7D_OSC_24M_CLK]);
 
-- 
2.17.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v5 10/12] ARM: dts: imx7s-warp: add ov2680 sensor node

2018-05-18 Thread Rui Miguel Silva
Warp7 comes with a Omnivision OV2680 sensor, add the node here to make complete
the camera data path for this system. Add the needed regulator to the analog
voltage supply, the port and endpoints in mipi_csi node and the pinctrl for the
reset gpio.

Signed-off-by: Rui Miguel Silva 
---
 arch/arm/boot/dts/imx7s-warp.dts | 44 
 1 file changed, 44 insertions(+)

diff --git a/arch/arm/boot/dts/imx7s-warp.dts b/arch/arm/boot/dts/imx7s-warp.dts
index cb175ee2fc9d..bf04e13afd02 100644
--- a/arch/arm/boot/dts/imx7s-warp.dts
+++ b/arch/arm/boot/dts/imx7s-warp.dts
@@ -91,6 +91,14 @@
regulator-always-on;
};
 
+   reg_peri_3p15v: regulator-peri-3p15v {
+   compatible = "regulator-fixed";
+   regulator-name = "peri_3p15v_reg";
+   regulator-min-microvolt = <315>;
+   regulator-max-microvolt = <315>;
+   regulator-always-on;
+   };
+
sound {
compatible = "simple-audio-card";
simple-audio-card,name = "imx7-sgtl5000";
@@ -218,6 +226,27 @@
pinctrl-names = "default";
pinctrl-0 = <_i2c2>;
status = "okay";
+
+   ov2680: camera@36 {
+   compatible = "ovti,ov2680";
+   pinctrl-names = "default";
+   pinctrl-0 = <_ov2680>;
+   reg = <0x36>;
+   clocks = <>;
+   clock-names = "xvclk";
+   reset-gpios = < 3 GPIO_ACTIVE_LOW>;
+   DOVDD-supply = <_reg>;
+   DVDD-supply = <_reg>;
+   AVDD-supply = <_peri_3p15v>;
+
+   port {
+   ov2680_to_mipi: endpoint {
+   remote-endpoint = <_from_sensor>;
+   clock-lanes = <0>;
+   data-lanes = <1>;
+   };
+   };
+   };
 };
 
  {
@@ -352,6 +381,15 @@
#size-cells = <0>;
fsl,csis-hs-settle = <3>;
 
+   port@0 {
+   reg = <0>;
+
+   mipi_from_sensor: endpoint {
+   remote-endpoint = <_to_mipi>;
+   data-lanes = <1>;
+   };
+   };
+
port@1 {
reg = <1>;
 
@@ -408,6 +446,12 @@
>;
};
 
+   pinctrl_ov2680: ov2660grp {
+   fsl,pins = <
+   MX7D_PAD_LPSR_GPIO1_IO03__GPIO1_IO3 0x14
+   >;
+   };
+
pinctrl_sai1: sai1grp {
fsl,pins = <
MX7D_PAD_SAI1_RX_DATA__SAI1_RX_DATA00x1f
-- 
2.17.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v5 03/12] clk: imx7d: fix mipi dphy div parent

2018-05-18 Thread Rui Miguel Silva
Fix the mipi dphy root divider to mipi_dphy_pre_div, this would remove a orphan
clock and set the correct parent.

before:
cat clk_orphan_summary
 enable  prepare  protect
   clock  countcountcountrate   
accuracy   phase

 mipi_dphy_post_div   110   0  
0 0
mipi_dphy_root_clk110   0  
0 0

cat clk_dump | grep mipi_dphy
mipi_dphy_post_div110   0  
0 0
mipi_dphy_root_clk110   0  
0 0

after:
cat clk_dump | grep mipi_dphy
   mipi_dphy_src 1102400  0 0
   mipi_dphy_cg  1102400  0 0
  mipi_dphy_pre_div  1102400  0 0
 mipi_dphy_post_div  1102400  0 0
mipi_dphy_root_clk   1102400  0 0

Fixes: 8f6d8094b215 ("ARM: imx: add imx7d clk tree support")
Acked-by: Dong Aisheng 
Signed-off-by: Rui Miguel Silva 
---
 drivers/clk/imx/clk-imx7d.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-imx7d.c b/drivers/clk/imx/clk-imx7d.c
index 975a20d3cc94..f7f4db2e6fa6 100644
--- a/drivers/clk/imx/clk-imx7d.c
+++ b/drivers/clk/imx/clk-imx7d.c
@@ -729,7 +729,7 @@ static void __init imx7d_clocks_init(struct device_node 
*ccm_node)
clks[IMX7D_LCDIF_PIXEL_ROOT_DIV] = 
imx_clk_divider2("lcdif_pixel_post_div", "lcdif_pixel_pre_div", base + 0xa300, 
0, 6);
clks[IMX7D_MIPI_DSI_ROOT_DIV] = imx_clk_divider2("mipi_dsi_post_div", 
"mipi_dsi_pre_div", base + 0xa380, 0, 6);
clks[IMX7D_MIPI_CSI_ROOT_DIV] = imx_clk_divider2("mipi_csi_post_div", 
"mipi_csi_pre_div", base + 0xa400, 0, 6);
-   clks[IMX7D_MIPI_DPHY_ROOT_DIV] = imx_clk_divider2("mipi_dphy_post_div", 
"mipi_csi_dphy_div", base + 0xa480, 0, 6);
+   clks[IMX7D_MIPI_DPHY_ROOT_DIV] = imx_clk_divider2("mipi_dphy_post_div", 
"mipi_dphy_pre_div", base + 0xa480, 0, 6);
clks[IMX7D_SAI1_ROOT_DIV] = imx_clk_divider2("sai1_post_div", 
"sai1_pre_div", base + 0xa500, 0, 6);
clks[IMX7D_SAI2_ROOT_DIV] = imx_clk_divider2("sai2_post_div", 
"sai2_pre_div", base + 0xa580, 0, 6);
clks[IMX7D_SAI3_ROOT_DIV] = imx_clk_divider2("sai3_post_div", 
"sai3_pre_div", base + 0xa600, 0, 6);
-- 
2.17.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v5 05/12] media: staging/imx7: add MIPI CSI-2 receiver subdev for i.MX7

2018-05-18 Thread Rui Miguel Silva
Adds MIPI CSI-2 subdev for i.MX7 to connect with sensors with a MIPI CSI-2
interface.

Signed-off-by: Rui Miguel Silva 
---
 drivers/staging/media/imx/Makefile |1 +
 drivers/staging/media/imx/imx7-mipi-csis.c | 1154 
 2 files changed, 1155 insertions(+)
 create mode 100644 drivers/staging/media/imx/imx7-mipi-csis.c

diff --git a/drivers/staging/media/imx/Makefile 
b/drivers/staging/media/imx/Makefile
index 074f016d3519..d2d909a36239 100644
--- a/drivers/staging/media/imx/Makefile
+++ b/drivers/staging/media/imx/Makefile
@@ -14,3 +14,4 @@ obj-$(CONFIG_VIDEO_IMX_CSI) += imx-media-csi.o
 obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-mipi-csi2.o
 
 obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o
+obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-mipi-csis.o
diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c 
b/drivers/staging/media/imx/imx7-mipi-csis.c
new file mode 100644
index ..e56facea36ba
--- /dev/null
+++ b/drivers/staging/media/imx/imx7-mipi-csis.c
@@ -0,0 +1,1154 @@
+// SPDX-License-Identifier: GPL
+/*
+ * Freescale i.MX7 SoC series MIPI-CSI V3.3 receiver driver
+ *
+ * Copyright (C) 2018 Linaro Ltd
+ * Copyright (C) 2015-2016 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "imx-media.h"
+
+static int debug;
+module_param(debug, int, 0644);
+MODULE_PARM_DESC(debug, "Debug level (0-2)");
+
+#define CSIS_DRIVER_NAME   "imx7-mipi-csis"
+#define CSIS_SUBDEV_NAME   CSIS_DRIVER_NAME
+
+#define CSIS_PAD_SINK  0
+#define CSIS_PAD_SOURCE1
+#define CSIS_PADS_NUM  2
+
+#define MIPI_CSIS_DEF_PIX_WIDTH640
+#define MIPI_CSIS_DEF_PIX_HEIGHT   480
+
+/* Register map definition */
+
+/* CSIS common control */
+#define MIPI_CSIS_CMN_CTRL 0x04
+#define MIPI_CSIS_CMN_CTRL_UPDATE_SHADOW   BIT(16)
+#define MIPI_CSIS_CMN_CTRL_INTER_MODE  BIT(10)
+#define MIPI_CSIS_CMN_CTRL_UPDATE_SHADOW_CTRL  BIT(2)
+#define MIPI_CSIS_CMN_CTRL_RESET   BIT(1)
+#define MIPI_CSIS_CMN_CTRL_ENABLE  BIT(0)
+
+#define MIPI_CSIS_CMN_CTRL_LANE_NR_OFFSET  8
+#define MIPI_CSIS_CMN_CTRL_LANE_NR_MASK(3 << 8)
+
+/* CSIS clock control */
+#define MIPI_CSIS_CLK_CTRL 0x08
+#define MIPI_CSIS_CLK_CTRL_CLKGATE_TRAIL_CH3(x)(x << 28)
+#define MIPI_CSIS_CLK_CTRL_CLKGATE_TRAIL_CH2(x)(x << 24)
+#define MIPI_CSIS_CLK_CTRL_CLKGATE_TRAIL_CH1(x)(x << 20)
+#define MIPI_CSIS_CLK_CTRL_CLKGATE_TRAIL_CH0(x)(x << 16)
+#define MIPI_CSIS_CLK_CTRL_CLKGATE_EN_MSK  (0xf << 4)
+#define MIPI_CSIS_CLK_CTRL_WCLK_SRCBIT(0)
+
+/* CSIS Interrupt mask */
+#define MIPI_CSIS_INTMSK   0x10
+#define MIPI_CSIS_INTMSK_EVEN_BEFORE   BIT(31)
+#define MIPI_CSIS_INTMSK_EVEN_AFTERBIT(30)
+#define MIPI_CSIS_INTMSK_ODD_BEFOREBIT(29)
+#define MIPI_CSIS_INTMSK_ODD_AFTER BIT(28)
+#define MIPI_CSIS_INTMSK_FRAME_START   BIT(24)
+#define MIPI_CSIS_INTMSK_FRAME_END BIT(20)
+#define MIPI_CSIS_INTMSK_ERR_SOT_HSBIT(16)
+#define MIPI_CSIS_INTMSK_ERR_LOST_FS   BIT(12)
+#define MIPI_CSIS_INTMSK_ERR_LOST_FE   BIT(8)
+#define MIPI_CSIS_INTMSK_ERR_OVER  BIT(4)
+#define MIPI_CSIS_INTMSK_ERR_WRONG_CFG BIT(3)
+#define MIPI_CSIS_INTMSK_ERR_ECC   BIT(2)
+#define MIPI_CSIS_INTMSK_ERR_CRC   BIT(1)
+#define MIPI_CSIS_INTMSK_ERR_UNKNOWN   BIT(0)
+
+/* CSIS Interrupt source */
+#define MIPI_CSIS_INTSRC   0x14
+#define MIPI_CSIS_INTSRC_EVEN_BEFORE   BIT(31)
+#define MIPI_CSIS_INTSRC_EVEN_AFTERBIT(30)
+#define MIPI_CSIS_INTSRC_EVEN  BIT(30)
+#define MIPI_CSIS_INTSRC_ODD_BEFOREBIT(29)
+#define MIPI_CSIS_INTSRC_ODD_AFTER BIT(28)
+#define MIPI_CSIS_INTSRC_ODD   (0x3 << 28)
+#define MIPI_CSIS_INTSRC_NON_IMAGE_DATA(0xf << 28)
+#define MIPI_CSIS_INTSRC_FRAME_START   BIT(24)
+#define MIPI_CSIS_INTSRC_FRAME_END BIT(20)
+#define MIPI_CSIS_INTSRC_ERR_SOT_HSBIT(16)
+#define MIPI_CSIS_INTSRC_ERR_LOST_FS   BIT(12)
+#define MIPI_CSIS_INTSRC_ERR_LOST_FE   BIT(8)
+#define MIPI_CSIS_INTSRC_ERR_OVER  BIT(4)
+#define MIPI_CSIS_INTSRC_ERR_WRONG_CFG BIT(3)
+#define MIPI_CSIS_INTSRC_ERR_ECC   BIT(2)
+#define MIPI_CSIS_INTSRC_ERR_CRC   BIT(1)
+#define MIPI_CSIS_INTSRC_ERR_UNKNOWN   BIT(0)
+#define MIPI_CSIS_INTSRC_ERRORS0xf
+
+/* D-PHY status control */
+#define MIPI_CSIS_DPHYSTATUS   0x20
+#define MIPI_CSIS_DPHYSTATUS_ULPS_DAT  BIT(8)
+#define MIPI_CSIS_DPHYSTATUS_STOPSTATE_DAT BIT(4)
+#define MIPI_CSIS_DPHYSTATUS_ULPS_CLK  BIT(1)
+#define MIPI_CSIS_DPHYSTATUS_STOPSTATE_CLK BIT(0)
+
+/* D-PHY common control */
+#define MIPI_CSIS_DPHYCTRL

[PATCH v5 02/12] media: staging/imx7: add imx7 CSI subdev driver

2018-05-18 Thread Rui Miguel Silva
This add the media entity subdevice and control driver for the i.MX7
CMOS Sensor Interface.

Signed-off-by: Rui Miguel Silva 
---
 drivers/staging/media/imx/Kconfig  |9 +-
 drivers/staging/media/imx/Makefile |2 +
 drivers/staging/media/imx/imx7-media-csi.c | 1352 
 3 files changed, 1362 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/media/imx/imx7-media-csi.c

diff --git a/drivers/staging/media/imx/Kconfig 
b/drivers/staging/media/imx/Kconfig
index bfc17de56b17..40a11f988fc6 100644
--- a/drivers/staging/media/imx/Kconfig
+++ b/drivers/staging/media/imx/Kconfig
@@ -11,7 +11,7 @@ config VIDEO_IMX_MEDIA
  driver for the i.MX5/6 SOC.
 
 if VIDEO_IMX_MEDIA
-menu "i.MX5/6 Media Sub devices"
+menu "i.MX5/6/7 Media Sub devices"
 
 config VIDEO_IMX_CSI
tristate "i.MX5/6 Camera Sensor Interface driver"
@@ -20,5 +20,12 @@ config VIDEO_IMX_CSI
---help---
  A video4linux camera sensor interface driver for i.MX5/6.
 
+config VIDEO_IMX7_CSI
+   tristate "i.MX7 Camera Sensor Interface driver"
+   depends on VIDEO_IMX_MEDIA && VIDEO_DEV && I2C
+   default y
+   ---help---
+ A video4linux camera sensor interface driver for i.MX7.
+
 endmenu
 endif
diff --git a/drivers/staging/media/imx/Makefile 
b/drivers/staging/media/imx/Makefile
index a30b3033f9a3..074f016d3519 100644
--- a/drivers/staging/media/imx/Makefile
+++ b/drivers/staging/media/imx/Makefile
@@ -12,3 +12,5 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-ic.o
 
 obj-$(CONFIG_VIDEO_IMX_CSI) += imx-media-csi.o
 obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-mipi-csi2.o
+
+obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o
diff --git a/drivers/staging/media/imx/imx7-media-csi.c 
b/drivers/staging/media/imx/imx7-media-csi.c
new file mode 100644
index ..d739eb8be402
--- /dev/null
+++ b/drivers/staging/media/imx/imx7-media-csi.c
@@ -0,0 +1,1352 @@
+// SPDX-License-Identifier: GPL
+/*
+ * V4L2 Capture CSI Subdev for Freescale i.MX7 SOC
+ *
+ * Copyright (c) 2018 Linaro Ltd
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include "imx-media.h"
+
+#define IMX7_CSI_PAD_SINK  0
+#define IMX7_CSI_PAD_SRC   1
+#define IMX7_CSI_PADS_NUM  2
+
+/* reset values */
+#define CSICR1_RESET_VAL   0x4800
+#define CSICR2_RESET_VAL   0x0
+#define CSICR3_RESET_VAL   0x0
+
+/* csi control reg 1 */
+#define BIT_SWAP16_EN  BIT(31)
+#define BIT_EXT_VSYNC  BIT(30)
+#define BIT_EOF_INT_EN BIT(29)
+#define BIT_PRP_IF_EN  BIT(28)
+#define BIT_CCIR_MODE  BIT(27)
+#define BIT_COF_INT_EN BIT(26)
+#define BIT_SF_OR_INTENBIT(25)
+#define BIT_RF_OR_INTENBIT(24)
+#define BIT_SFF_DMA_DONE_INTEN  BIT(22)
+#define BIT_STATFF_INTEN   BIT(21)
+#define BIT_FB2_DMA_DONE_INTEN  BIT(20)
+#define BIT_FB1_DMA_DONE_INTEN  BIT(19)
+#define BIT_RXFF_INTEN BIT(18)
+#define BIT_SOF_POLBIT(17)
+#define BIT_SOF_INTEN  BIT(16)
+#define BIT_MCLKDIV(0xF << 12)
+#define BIT_HSYNC_POL  BIT(11)
+#define BIT_CCIR_ENBIT(10)
+#define BIT_MCLKEN BIT(9)
+#define BIT_FCCBIT(8)
+#define BIT_PACK_DIR   BIT(7)
+#define BIT_CLR_STATFIFO   BIT(6)
+#define BIT_CLR_RXFIFO BIT(5)
+#define BIT_GCLK_MODE  BIT(4)
+#define BIT_INV_DATA   BIT(3)
+#define BIT_INV_PCLK   BIT(2)
+#define BIT_REDGE  BIT(1)
+#define BIT_PIXEL_BIT  BIT(0)
+
+#define SHIFT_MCLKDIV  12
+
+/* control reg 3 */
+#define BIT_FRMCNT (0x << 16)
+#define BIT_FRMCNT_RST BIT(15)
+#define BIT_DMA_REFLASH_RFFBIT(14)
+#define BIT_DMA_REFLASH_SFFBIT(13)
+#define BIT_DMA_REQ_EN_RFF BIT(12)
+#define BIT_DMA_REQ_EN_SFF BIT(11)
+#define BIT_STATFF_LEVEL   (0x7 << 8)
+#define BIT_HRESP_ERR_EN   BIT(7)
+#define BIT_RXFF_LEVEL (0x7 << 4)
+#define BIT_TWO_8BIT_SENSORBIT(3)
+#define BIT_ZERO_PACK_EN   BIT(2)
+#define BIT_ECC_INT_EN BIT(1)
+#define BIT_ECC_AUTO_ENBIT(0)
+
+#define SHIFT_FRMCNT   16
+#define SHIFT_RXFIFO_LEVEL 4
+
+/* csi status reg */
+#define BIT_ADDR_CH_ERR_INTBIT(28)
+#define BIT_FIELD0_INT BIT(27)
+#define BIT_FIELD1_INT BIT(26)
+#define BIT_SFF_OR_INT BIT(25)
+#define BIT_RFF_OR_INT BIT(24)
+#define BIT_DMA_TSF_DONE_SFF   BIT(22)
+#define BIT_STATFF_INT BIT(21)
+#define BIT_DMA_TSF_DONE_FB2   BIT(20)
+#define BIT_DMA_TSF_DONE_FB1   BIT(19)
+#define BIT_RXFF_INT   BIT(18)
+#define BIT_EOF_INTBIT(17)
+#define BIT_SOF_INTBIT(16)
+#define BIT_F2_INT BIT(15)
+#define BIT_F1_INT BIT(14)
+#define 

[PATCH v5 07/12] ARM: dts: imx7s: add mipi phy power domain

2018-05-18 Thread Rui Miguel Silva
Add power domain index 0 related with mipi-phy to imx7s.

Signed-off-by: Rui Miguel Silva 
---
 arch/arm/boot/dts/imx7s.dtsi | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
index 4d42335c0dee..67450ad89940 100644
--- a/arch/arm/boot/dts/imx7s.dtsi
+++ b/arch/arm/boot/dts/imx7s.dtsi
@@ -636,6 +636,12 @@
#address-cells = <1>;
#size-cells = <0>;
 
+   pgc_mipi_phy: pgc-power-domain@0 {
+   #power-domain-cells = <0>;
+   reg = <0>;
+   power-supply = <_1p0d>;
+   };
+
pgc_pcie_phy: pgc-power-domain@1 {
#power-domain-cells = <0>;
reg = <1>;
-- 
2.17.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v5 00/12] media: staging/imx7: add i.MX7 media driver

2018-05-18 Thread Rui Miguel Silva
Hi,
This series introduces the Media driver to work with the i.MX7 SoC. it uses the
already existing imx media core drivers but since the i.MX7, contrary to
i.MX5/6, do not have an IPU and because of that some changes in the imx media
core are made along this series to make it support that case.

This patches adds CSI and MIPI-CSI2 drivers for i.MX7, along with several
configurations changes for this to work as a capture subsystem. Some bugs are
also fixed along the line. And necessary documentation.

For a more detailed view of the capture paths, pads links in the i.MX7 please
take a look at the documentation in PATCH 14.

The system used to test and develop this was the Warp7 board with an OV2680
sensor, which output format is 10-bit bayer. So, only MIPI interface was
tested, a scenario with an parallel input would nice to have.

*Important note*, this code depends on Steve Longerbeam series [0]:
[PATCH v4 00/13] media: imx: Switch to subdev notifiers
which the merging status is not clear to me, but the changes in there make
senses to this series

Bellow goes an example of the output of the pads and links and the output of
v4l2-compliance testing.

The v4l-utils version used is:
v4l2-compliance SHA   : 47d43b130dc6e9e0edc900759fb37649208371e4 from Apr 4th.

The Media Driver fail some tests but this failures are coming from code out of
scope of this series (video-mux, imx-capture), and some from the sensor OV2680
but that I think not related with the sensor driver but with the testing and
core.

The csi and mipi-csi entities pass all compliance tests.

Cheers,
Rui

[0]: https://www.mail-archive.com/linux-media@vger.kernel.org/msg131186.html

v4->v5:
Sakari Ailus:
 - fix remove of the capture entries in dts bindings in the right patch

Stephen Boyd:
 - Send all series to clk list

v3->v4:
Philipp Zabel:
 - refactor initialization code from media device probe to be possible to used
   from other modules
 - Remove index of csi from all accurrencs (dts, code, documentation)
 - Remove need for capture node for imx7
 - fix pinctrl for ov2680
 - add reviewed tag to add multiplexer controls patch

Fabio Estevam:
 - remove always on from new regulator

Randy Dunlap:
 - several text editing fixes in documentation

Myself:
 - rebase on top of v4 of Steve series
 - change CSI probe to initialize imx media device
 - remove csi mux parallel endpoint from mux to avoid warning message

v2->v3:
Philipp Zabel:
 - use of_match_device in imx-media-dev instead of of_device_match
 - fix number of data lanes from 4 to 2
 - change the clock definitions and use of mipi
 - move hs-settle from endpoint

Rob Herring:
 - fix phy-supply description
 - add vendor properties
 - fix examples indentations

Stephen Boyd: patch 3/14
 - fix double sign-off
 - add fixes tag

Dong Aisheng: patch 3/14
 - fix double sign-off
 - add Acked-by tag

Shawn Guo:
patch 4/14
 - remove line breakage in parent redifiniton
 - added Acked-by tag

 - dropped CMA area increase and add more verbose information in case of
   dma allocation failure
patch 9/14
 - remove extra line between cells and reg masks

Myself:
 - rework on frame end in csi
 - add rxcount in csi driver
 - add power supplies to ov2680 node and fix gpio polarity

v1->v2:
Dan Carpenter:
 - fix return paths and codes;
 - fix clk_frequency validation and return code;
 - handle the csi remove (release resources that was missing)
 - revert the logic arround the ipu_present flag

Philipp Zabel:
 - drop patch that changed the rgb formats and address the pixel/bus format in
   mipi_csis code.

MySelf:
 - add patch that add ov2680 node to the warp7 dts, so the all data path is
   complete.
 - add linux-clk mailing list to the clock patches cc:

 media-ctl -p
Media controller API version 4.17.0

Media device information

driver  imx-media
model   imx-media
serial
bus info
hw revision 0x0
driver version  4.17.0

Device topology
- entity 1: csi (2 pads, 2 links)
type V4L2 subdev subtype Unknown flags 0
device node name /dev/v4l-subdev0
pad0: Sink
[fmt:SBGGR10_1X10/800x600 field:none]
<- "csi_mux":2 [ENABLED]
pad1: Source
[fmt:SBGGR10_1X10/800x600 field:none]
-> "csi capture":0 [ENABLED]

- entity 4: csi capture (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video0
pad0: Sink
<- "csi":1 [ENABLED]

- entity 10: csi_mux (3 pads, 2 links)
 type V4L2 subdev subtype Unknown flags 0
 device node name /dev/v4l-subdev1
pad0: Sink
[fmt:unknown/0x0]
pad1: Sink
[fmt:SBGGR10_1X10/800x600 field:none]
<- "imx7-mipi-csis.0":1 [ENABLED]
pad2: Source
[fmt:SBGGR10_1X10/800x600 field:none]
-> "csi":0 [ENABLED]

- entity 14: imx7-mipi-csis.0 (2 pads, 2 links)
 type V4L2 

[PATCH v5 01/12] media: staging/imx: refactor imx media device probe

2018-05-18 Thread Rui Miguel Silva
Refactor and move media device initialization code to a new common module, so it
can be used by other devices, this will allow for example a near to introduce
imx7 CSI driver, to use this media device.

Also introduce a new flag to control the presence of IPU or not (imx6/5 have
this but imx7 does not have).

Signed-off-by: Rui Miguel Silva 
---
 drivers/staging/media/imx/Makefile|   1 +
 .../staging/media/imx/imx-media-dev-common.c  | 102 ++
 drivers/staging/media/imx/imx-media-dev.c |  89 ---
 .../staging/media/imx/imx-media-internal-sd.c |   3 +
 drivers/staging/media/imx/imx-media-of.c  |   6 +-
 drivers/staging/media/imx/imx-media.h |  18 
 6 files changed, 150 insertions(+), 69 deletions(-)
 create mode 100644 drivers/staging/media/imx/imx-media-dev-common.c

diff --git a/drivers/staging/media/imx/Makefile 
b/drivers/staging/media/imx/Makefile
index 698a4210316e..a30b3033f9a3 100644
--- a/drivers/staging/media/imx/Makefile
+++ b/drivers/staging/media/imx/Makefile
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 imx-media-objs := imx-media-dev.o imx-media-internal-sd.o imx-media-of.o
+imx-media-objs += imx-media-dev-common.o
 imx-media-common-objs := imx-media-utils.o imx-media-fim.o
 imx-media-ic-objs := imx-ic-common.o imx-ic-prp.o imx-ic-prpencvf.o
 
diff --git a/drivers/staging/media/imx/imx-media-dev-common.c 
b/drivers/staging/media/imx/imx-media-dev-common.c
new file mode 100644
index ..7e9613ca5b5f
--- /dev/null
+++ b/drivers/staging/media/imx/imx-media-dev-common.c
@@ -0,0 +1,102 @@
+// SPDX-License-Identifier: GPL
+/*
+ * V4L2 Media Controller Driver for Freescale common i.MX5/6/7 SOC
+ *
+ * Copyright (c) 2018 Linaro Ltd
+ * Copyright (c) 2016 Mentor Graphics Inc.
+ */
+
+#include 
+#include 
+#include "imx-media.h"
+
+static const struct v4l2_async_notifier_operations imx_media_subdev_ops = {
+   .bound = imx_media_subdev_bound,
+   .complete = imx_media_probe_complete,
+};
+
+static const struct media_device_ops imx_media_md_ops = {
+   .link_notify = imx_media_link_notify,
+};
+
+struct imx_media_dev *imx_media_dev_init(struct device *dev, bool ipu_present)
+{
+   struct imx_media_dev *imxmd;
+   int ret;
+
+   imxmd = devm_kzalloc(dev, sizeof(*imxmd), GFP_KERNEL);
+   if (!imxmd)
+   return ERR_PTR(-ENOMEM);
+
+   dev_set_drvdata(dev, imxmd);
+
+   strlcpy(imxmd->md.model, "imx-media", sizeof(imxmd->md.model));
+   imxmd->md.ops = _media_md_ops;
+   imxmd->md.dev = dev;
+
+   imxmd->ipu_present = ipu_present;
+
+   mutex_init(>mutex);
+
+   imxmd->v4l2_dev.mdev = >md;
+   strlcpy(imxmd->v4l2_dev.name, "imx-media",
+   sizeof(imxmd->v4l2_dev.name));
+
+   media_device_init(>md);
+
+   ret = v4l2_device_register(dev, >v4l2_dev);
+   if (ret < 0) {
+   v4l2_err(>v4l2_dev,
+"Failed to register v4l2_device: %d\n", ret);
+   goto cleanup;
+   }
+
+   dev_set_drvdata(imxmd->v4l2_dev.dev, imxmd);
+
+   INIT_LIST_HEAD(>vdev_list);
+
+   return imxmd;
+
+cleanup:
+   media_device_cleanup(>md);
+
+   return ERR_PTR(ret);
+}
+EXPORT_SYMBOL_GPL(imx_media_dev_init);
+
+int imx_media_dev_notifier_register(struct imx_media_dev *imxmd)
+{
+   int ret;
+
+   /* no subdevs? just bail */
+   if (imxmd->notifier.num_subdevs == 0) {
+   v4l2_err(>v4l2_dev, "no subdevs\n");
+   return -ENODEV;
+   }
+
+   /* prepare the async subdev notifier and register it */
+   imxmd->notifier.ops = _media_subdev_ops;
+   ret = v4l2_async_notifier_register(>v4l2_dev,
+  >notifier);
+   if (ret) {
+   v4l2_err(>v4l2_dev,
+"v4l2_async_notifier_register failed with %d\n", ret);
+   return ret;
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(imx_media_dev_notifier_register);
+
+void imx_media_dev_cleanup(struct imx_media_dev *imxmd)
+{
+   v4l2_device_unregister(>v4l2_dev);
+   media_device_cleanup(>md);
+}
+EXPORT_SYMBOL_GPL(imx_media_dev_cleanup);
+
+void imx_media_dev_notifier_unregister(struct imx_media_dev *imxmd)
+{
+   v4l2_async_notifier_cleanup(>notifier);
+}
+EXPORT_SYMBOL_GPL(imx_media_dev_notifier_unregister);
diff --git a/drivers/staging/media/imx/imx-media-dev.c 
b/drivers/staging/media/imx/imx-media-dev.c
index 7e7bd1c6c81b..6160070b72fb 100644
--- a/drivers/staging/media/imx/imx-media-dev.c
+++ b/drivers/staging/media/imx/imx-media-dev.c
@@ -87,6 +87,9 @@ static int imx_media_get_ipu(struct imx_media_dev *imxmd,
struct ipu_soc *ipu;
int ipu_id;
 
+   if (!imxmd->ipu_present)
+   return 0;
+
ipu = dev_get_drvdata(csi_sd->dev->parent);
if (!ipu) {
v4l2_err(>v4l2_dev,
@@ -107,9 +110,9 @@ static int imx_media_get_ipu(struct 

Re: [PATCH 38/42] isdn: replace ->proc_fops with ->proc_show

2018-05-18 Thread Paul Bolle
Hi Christoph,

(I don't think the patches of this series ever hit the ISDN related addresses
still found in MAINTAINERS. And now I might be a bit late.) 

Christoph Hellwig schreef op wo 16-05-2018 om 11:43 [+0200]:
> diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c
> index ccec7778cad2..dac5cd35e901 100644
> --- a/drivers/isdn/gigaset/capi.c
> +++ b/drivers/isdn/gigaset/capi.c
> @@ -2437,19 +2437,6 @@ static int gigaset_proc_show(struct seq_file *m, void 
> *v)
>   return 0;
>  }
>  
> -static int gigaset_proc_open(struct inode *inode, struct file *file)
> -{
> - return single_open(file, gigaset_proc_show, PDE_DATA(inode));
> -}
> -
> -static const struct file_operations gigaset_proc_fops = {
> - .owner  = THIS_MODULE,
> - .open   = gigaset_proc_open,
> - .read   = seq_read,
> - .llseek = seq_lseek,
> - .release= single_release,
> -};
> -
>  /**
>   * gigaset_isdn_regdev() - register device to LL
>   * @cs:  device descriptor structure.
> @@ -2478,8 +2465,7 @@ int gigaset_isdn_regdev(struct cardstate *cs, const 
> char *isdnid)
>   iif->ctr.register_appl = gigaset_register_appl;
>   iif->ctr.release_appl  = gigaset_release_appl;
>   iif->ctr.send_message  = gigaset_send_message;
> - iif->ctr.procinfo  = gigaset_procinfo;

Is this intentional? You didn't touch the procinfo method in the other ISDN
drivers, as far as I can see.

(If it was intentional, gigaset_procinfo() can of course be removed.)

> - iif->ctr.proc_fops = _proc_fops;
> + iif->ctr.proc_show = gigaset_proc_show,
>   INIT_LIST_HEAD(>appls);
>   skb_queue_head_init(>sendqueue);
>   atomic_set(>sendqlen, 0);

Thanks,


Paul Bolle
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 38/42] isdn: replace ->proc_fops with ->proc_show

2018-05-18 Thread Christoph Hellwig
On Fri, May 18, 2018 at 10:43:46AM +0200, Paul Bolle wrote:
> > iif->ctr.release_appl  = gigaset_release_appl;
> > iif->ctr.send_message  = gigaset_send_message;
> > -   iif->ctr.procinfo  = gigaset_procinfo;
> 
> Is this intentional? You didn't touch the procinfo method in the other ISDN
> drivers, as far as I can see.
> 
> (If it was intentional, gigaset_procinfo() can of course be removed.)

Already fixed in the branch in Als tree.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4 03/12] clk: imx7d: fix mipi dphy div parent

2018-05-18 Thread Rui Miguel Silva

Hi Stephen,
On Thu 17 May 2018 at 18:05, Stephen Boyd wrote:

Quoting Rui Miguel Silva (2018-05-17 05:50:24)
Fix the mipi dphy root divider to mipi_dphy_pre_div, this would 
remove a orphan

clock and set the correct parent.

before:
cat clk_orphan_summary
 enable  prepare  protect
   clock  countcountcount 
   rate   accuracy   phase


 mipi_dphy_post_div   110 
 0  0 0
mipi_dphy_root_clk110 
0  0 0


cat clk_dump | grep mipi_dphy
mipi_dphy_post_div110 
0  0 0
mipi_dphy_root_clk110 
0  0 0


after:
cat clk_dump | grep mipi_dphy
   mipi_dphy_src 110 
   2400  0 0
   mipi_dphy_cg  110 
   2400  0 0
  mipi_dphy_pre_div  110 
  2400  0 0
 mipi_dphy_post_div  110 
 2400  0 0
mipi_dphy_root_clk   110 
2400  0 0


Fixes: 8f6d8094b215 ("ARM: imx: add imx7d clk tree support")

Cc: linux-...@vger.kernel.org
Acked-by: Dong Aisheng 
Signed-off-by: Rui Miguel Silva 
---


I only get two patches out of the 12 and I don't get a cover 
letter.
Did you want me to pick up these clk patches into clk-next? 
Where are
the other patches? Can you cc lkml on all your kernel emails so 
I can

easily find them?


Yea, sorry, You are right, I will cc all patches to the lists. v5 
is on

the way and I will do that.

---
Cheers,
Rui


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



Re: [PATCH v4 06/12] media: dt-bindings: add bindings for i.MX7 media driver

2018-05-18 Thread Rui Miguel Silva

Hi Sakari,
Thanks for the review.
On Fri 18 May 2018 at 06:58, Sakari Ailus wrote:

Hi Rui,

On Thu, May 17, 2018 at 01:50:27PM +0100, Rui Miguel Silva 
wrote:

Add bindings documentation for i.MX7 media drivers.

Signed-off-by: Rui Miguel Silva 
---
 .../devicetree/bindings/media/imx7.txt| 145 
 ++

 1 file changed, 145 insertions(+)
 create mode 100644 
 Documentation/devicetree/bindings/media/imx7.txt


diff --git a/Documentation/devicetree/bindings/media/imx7.txt 
b/Documentation/devicetree/bindings/media/imx7.txt

new file mode 100644
index ..161cff8e6442
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/imx7.txt
@@ -0,0 +1,145 @@
+Freescale i.MX7 Media Video Device
+==
+
+Video Media Controller node
+---


Note that DT bindings document the hardware, they are as such 
not Linux

dependent.


This was removed in this series, however I removed it in the wrong 
patch,
If you see patch 11/12 you will see this being removed. I will fix 
this

in v5. Thanks for notice it.




+
+This is the media controller node for video capture support. 
It is a
+virtual device that lists the camera serial interface nodes 
that the

+media device will control.


Ditto.


+
+Required properties:
+- compatible : "fsl,imx7-capture-subsystem";
+- ports  : Should contain a list of phandles pointing to 
camera

+   sensor interface port of CSI
+
+example:
+
+capture-subsystem {


What's the purpose of this node, if you only refer to another 
device? This

one rather does not look like a real device at all.


+   compatible = "fsl,imx7-capture-subsystem";
+   ports = <>;
+};
+
+
+mipi_csi2 node
+--
+
+This is the device node for the MIPI CSI-2 receiver core in 
i.MX7 SoC. It is

+compatible with previous version of Samsung D-phy.
+
+Required properties:
+
+- compatible: "fsl,imx7-mipi-csi2";
+- reg   : base address and length of the register set 
for the device;

+- interrupts: should contain MIPI CSIS interrupt;
+- clocks: list of clock specifiers, see
+ 
Documentation/devicetree/bindings/clock/clock-bindings.txt for 
details;
+- clock-names   : must contain "pclk", "wrap" and "phy" 
entries, matching

+  entries in the clock property;
+- power-domains : a phandle to the power domain, see
+ 
Documentation/devicetree/bindings/power/power_domain.txt for 
details.

+- reset-names   : should include following entry "mrst";
+- resets: a list of phandle, should contain reset 
entry of

+  reset-names;
+- phy-supply: from the generic phy bindings, a phandle to 
a regulator that

+ provides power to MIPI CSIS core;
+- bus-width : maximum number of data lanes supported (SoC 
specific);

+
+Optional properties:
+
+- clock-frequency : The IP's main (system bus) clock frequency 
in Hz, default
+		value when this property is not specified is 
166 MHz;

+
+port node
+-
+
+- reg		  : (required) can take the values 0 or 1, 
where 0 is the
+ related sink port and port 1 should be 
the source one;

+
+endpoint node
+-
+
+- data-lanes: (required) an array specifying active 
physical MIPI-CSI2
+		data input lanes and their mapping to logical 
lanes; the
+		array's content is unused, only its length is 
meaningful;

+
+- fsl,csis-hs-settle : (optional) differential receiver 
(HS-RX) settle time;


Could you calculate this, as other drivers do? It probably 
changes

depending on the device runtime configuration.


The only reference to possible values to this parameter is given 
by

table in [0], can you point me out the formula for imx7 in the
documentation?

---
Cheers,
Rui

[0] https://community.nxp.com/thread/463777
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4 06/12] media: dt-bindings: add bindings for i.MX7 media driver

2018-05-18 Thread Sakari Ailus
Hi Rui,

On Thu, May 17, 2018 at 01:50:27PM +0100, Rui Miguel Silva wrote:
> Add bindings documentation for i.MX7 media drivers.
> 
> Signed-off-by: Rui Miguel Silva 
> ---
>  .../devicetree/bindings/media/imx7.txt| 145 ++
>  1 file changed, 145 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/media/imx7.txt
> 
> diff --git a/Documentation/devicetree/bindings/media/imx7.txt 
> b/Documentation/devicetree/bindings/media/imx7.txt
> new file mode 100644
> index ..161cff8e6442
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/imx7.txt
> @@ -0,0 +1,145 @@
> +Freescale i.MX7 Media Video Device
> +==
> +
> +Video Media Controller node
> +---

Note that DT bindings document the hardware, they are as such not Linux
dependent.

> +
> +This is the media controller node for video capture support. It is a
> +virtual device that lists the camera serial interface nodes that the
> +media device will control.

Ditto.

> +
> +Required properties:
> +- compatible : "fsl,imx7-capture-subsystem";
> +- ports  : Should contain a list of phandles pointing to camera
> + sensor interface port of CSI
> +
> +example:
> +
> +capture-subsystem {

What's the purpose of this node, if you only refer to another device? This
one rather does not look like a real device at all.

> + compatible = "fsl,imx7-capture-subsystem";
> + ports = <>;
> +};
> +
> +
> +mipi_csi2 node
> +--
> +
> +This is the device node for the MIPI CSI-2 receiver core in i.MX7 SoC. It is
> +compatible with previous version of Samsung D-phy.
> +
> +Required properties:
> +
> +- compatible: "fsl,imx7-mipi-csi2";
> +- reg   : base address and length of the register set for the device;
> +- interrupts: should contain MIPI CSIS interrupt;
> +- clocks: list of clock specifiers, see
> +Documentation/devicetree/bindings/clock/clock-bindings.txt for 
> details;
> +- clock-names   : must contain "pclk", "wrap" and "phy" entries, matching
> +  entries in the clock property;
> +- power-domains : a phandle to the power domain, see
> +  Documentation/devicetree/bindings/power/power_domain.txt for 
> details.
> +- reset-names   : should include following entry "mrst";
> +- resets: a list of phandle, should contain reset entry of
> +  reset-names;
> +- phy-supply: from the generic phy bindings, a phandle to a regulator 
> that
> +   provides power to MIPI CSIS core;
> +- bus-width : maximum number of data lanes supported (SoC specific);
> +
> +Optional properties:
> +
> +- clock-frequency : The IP's main (system bus) clock frequency in Hz, default
> + value when this property is not specified is 166 MHz;
> +
> +port node
> +-
> +
> +- reg  : (required) can take the values 0 or 1, where 0 is 
> the
> + related sink port and port 1 should be the source one;
> +
> +endpoint node
> +-
> +
> +- data-lanes: (required) an array specifying active physical MIPI-CSI2
> + data input lanes and their mapping to logical lanes; the
> + array's content is unused, only its length is meaningful;
> +
> +- fsl,csis-hs-settle : (optional) differential receiver (HS-RX) settle time;

Could you calculate this, as other drivers do? It probably changes
depending on the device runtime configuration.

> +
> +example:
> +
> +mipi_csi: mipi-csi@3075 {
> +#address-cells = <1>;
> +#size-cells = <0>;
> +
> +compatible = "fsl,imx7-mipi-csi2";
> +reg = <0x3075 0x1>;
> +interrupts = ;
> +clocks = < IMX7D_IPG_ROOT_CLK>,
> +< IMX7D_MIPI_CSI_ROOT_CLK>,
> +< IMX7D_MIPI_DPHY_ROOT_CLK>;
> +clock-names = "pclk", "wrap", "phy";
> +clock-names = "mipi", "phy";
> +clock-frequency = <16600>;
> +power-domains = <_mipi_phy>;
> +phy-supply = <_1p0d>;
> +resets = < IMX7_RESET_MIPI_PHY_MRST>;
> +reset-names = "mrst";
> +bus-width = <4>;
> +fsl,csis-hs-settle = <3>;
> +fsl,csis-clk-settle = <0>;
> +
> +port@0 {
> +reg = <0>;
> +
> +mipi_from_sensor: endpoint {
> +remote-endpoint = <_to_mipi>;
> +data-lanes = <1>;
> +};
> +};
> +
> +port@1 {
> +reg = <1>;
> +
> +mipi_vc0_to_csi_mux: endpoint {
> +remote-endpoint = <_mux_from_mipi_vc0>;
> +