[PATCH] staging : lustre : Remove braces from single line body.
Remove unnecessary braces from single line if statement. This warning is found using checkpatch.pl. Signed-off-by: Tabrez khan --- drivers/staging/lustre/lustre/osc/lproc_osc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c index f0062d4..098ef1e 100644 --- a/drivers/staging/lustre/lustre/osc/lproc_osc.c +++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c @@ -585,9 +585,9 @@ static ssize_t max_pages_per_rpc_store(struct kobject *kobj, chunk_mask = ~((1 << (cli->cl_chunkbits - PAGE_SHIFT)) - 1); /* max_pages_per_rpc must be chunk aligned */ val = (val + ~chunk_mask) & chunk_mask; - if (val == 0 || val > ocd->ocd_brw_size >> PAGE_SHIFT) { + if (val == 0 || val > ocd->ocd_brw_size >> PAGE_SHIFT) return -ERANGE; - } + spin_lock(&cli->cl_loi_list_lock); cli->cl_max_pages_per_rpc = val; client_adjust_max_dirty(cli); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging:lustre:fixed space coding style in o2iblnd_cb.c
Space required before assignment operator, to make close to kernel coding style. This error is found using checkpatch.pl. Signed-off-by: Tabrez khan --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c index b27de88..ba1782b 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -3276,7 +3276,7 @@ kiblnd_disconnect_conn(struct kib_conn *conn) int kiblnd_connd(void *arg) { - spinlock_t *lock= &kiblnd_data.kib_connd_lock; + spinlock_t *lock = &kiblnd_data.kib_connd_lock; wait_queue_t wait; unsigned long flags; struct kib_conn *conn; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging:lustre:fixed space coding style in o2iblnd_cb.c
Space required before assignment operator, to make close to kernel coding style. This error is found using checkpatch.pl. Signed-off-by: Tabrez khan --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c index b27de88..ba1782b 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -3276,7 +3276,7 @@ kiblnd_disconnect_conn(struct kib_conn *conn) int kiblnd_connd(void *arg) { - spinlock_t *lock= &kiblnd_data.kib_connd_lock; + spinlock_t *lock = &kiblnd_data.kib_connd_lock; wait_queue_t wait; unsigned long flags; struct kib_conn *conn; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: r8188eu: fix spelling mistake on xmitframe_coalsece
From: Colin Ian King trivial fix to spelling mistake of function name in debuf message, should be xmitframe_coalesce instead of xmitframe_coalsece. Signed-off-by: Colin Ian King --- drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c index 85650b2..53e312a 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c @@ -635,7 +635,7 @@ s32 rtw_hal_xmit(struct adapter *adapt, struct xmit_frame *pxmitframe) if (res == _SUCCESS) { rtw_dump_xframe(adapt, pxmitframe); } else { - DBG_88E("==> %s xmitframe_coalsece failed\n", __func__); + DBG_88E("==> %s xmitframe_coalesce failed\n", __func__); rtw_free_xmitbuf(pxmitpriv, pxmitbuf); rtw_free_xmitframe(pxmitpriv, pxmitframe); } -- 2.10.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 12/15] hyperv: move VMBus connection ids to uapi
On Wed, 28 Dec 2016 20:09:44 +0300 Roman Kagan wrote: > On Wed, Dec 21, 2016 at 07:54:11PM +, KY Srinivasan wrote: > > > > > > > -Original Message- > > > From: Stephen Hemminger [mailto:step...@networkplumber.org] > > > Sent: Wednesday, December 21, 2016 10:03 AM > > > To: Christoph Hellwig > > > Cc: Paolo Bonzini ; Roman Kagan > > > ; Radim Krčmář ; KY > > > Srinivasan ; Vitaly Kuznetsov > > > ; k...@vger.kernel.org; Denis V . Lunev > > > ; Haiyang Zhang ; > > > x...@kernel.org; linux-ker...@vger.kernel.org; Ingo Molnar > > > ; H. Peter Anvin ; > > > de...@linuxdriverproject.org; Thomas Gleixner > > > Subject: Re: [PATCH 12/15] hyperv: move VMBus connection ids to uapi > > > > > > On Wed, 21 Dec 2016 09:58:36 -0800 > > > Christoph Hellwig wrote: > > > > > > > On Wed, Dec 21, 2016 at 09:50:49AM -0800, Stephen Hemminger wrote: > > > > > Lastly, there is licensing issues on headers. It would be good to > > > > > have any > > > > > userspace ABI headers licensed with a more liberal license so that > > > > > BSD > > > and DPDK drivers > > > > > could use them directly. Right now each one reinvents. > > > > > > > > Microsoft could easily solves this problem by offering a suitably > > > > liberally licensed header documenting the full HyperV guest protocol > > > > that Linux and other projects could use. > > > > > > The issue is if same header file mixes kernel and userspace API stuff. > > > > > > Once the files are arranged right, I will submit trivial change to > > > comments > > > to indicate the liberal licensing of userspace API headers. > > > > Let us take this one step at a time. I know for a fact that not all the > > guest host > > protocols on Hyper-V are guaranteed to be stable. Some of the protocols are > > part of > > the published MSFT standards such RNDIS and these obviously are guaranteed > > to be > > stable. For the rest it is less clear. The fact that we need to ensure > > compatibility of existing > > Windows guests tells me that any host side changes will be versioned and > > the hosts will always > > support older guests. > > > > I would like to minimize what we include in the uapi header; especially > > when MSFT has made no guarantees > > with regards how they may be evolved. I will also work on getting some > > clarity on both stability and > > under what license we would expose the uapi header. > > Am I correct assuming that QEMU is currently the only user of > arch/x86/include/uapi/asm/hyperv.h? > > Then I think we're fine withdrawing it from uapi as a whole and letting > QEMU pull it in through its header-harvesting scripts (as does now > anyway). This would lift all licensing and longterm API stability > expectations. That makes sense, but if it is not in uapi then any changes may break QEMU in future (without regret). If QEMU is diving in and extracting non UAPI headers then that is a bad idea. It is outside the scope of this. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging:lustre:remove braces from single-line body
Remove unnecessary braces from single line if statement. This warning is found using checkpatch.pl. Signed-off-by: Tabrez khan --- drivers/staging/lustre/lustre/obdecho/echo_client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index 505582f..3050fa7 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -1694,9 +1694,9 @@ static int echo_client_connect(const struct lu_env *env, struct lustre_handle conn = { 0 }; rc = class_connect(&conn, src, cluuid); - if (rc == 0) { + if (rc == 0) *exp = class_conn2export(&conn); - } + return rc; } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: wilc1000: Fix endian sparse warning
drivers/staging/wilc1000/linux_wlan.c:995:18: warning: restricted __be16 degrades to integer Signed-off-by: Mike Kofron --- drivers/staging/wilc1000/linux_wlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index e59cab5..f293779 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -992,7 +992,7 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev) tx_data->skb = skb; eth_h = (struct ethhdr *)(skb->data); - if (eth_h->h_proto == 0x8e88) + if (eth_h->h_proto == cpu_to_be16(0x8e88)) netdev_dbg(ndev, "EAPOL transmitted\n"); ih = (struct iphdr *)(skb->data + sizeof(struct ethhdr)); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 00/20] i.MX Media Driver
This is a media driver for video capture on i.MX. Refer to Documentation/media/v4l-drivers/imx.rst for example capture pipelines on SabreSD, SabreAuto, and SabreLite reference platforms. This patchset includes the OF graph layout as proposed by Philipp Zabel, with only minor changes which are enumerated in the patch header. Philipp Zabel (2): ARM: dts: imx6qdl: Add mipi_ipu1/2 multiplexers, mipi_csi, and their connections media: imx: Add video switch subdev driver Steve Longerbeam (18): ARM: dts: imx6qdl: Add compatible, clocks, irqs to MIPI CSI-2 node ARM: dts: imx6qdl: add media device ARM: dts: imx6-sabrelite: add OV5642 and OV5640 camera sensors ARM: dts: imx6-sabresd: add OV5642 and OV5640 camera sensors ARM: dts: imx6-sabreauto: create i2cmux for i2c3 ARM: dts: imx6-sabreauto: add reset-gpios property for max7310_b ARM: dts: imx6-sabreauto: add pinctrl for gpt input capture ARM: dts: imx6-sabreauto: add the ADV7180 video decoder gpio: pca953x: Add optional reset gpio control media: Add i.MX media core driver media: imx: Add CSI subdev driver media: imx: Add SMFC subdev driver media: imx: Add IC subdev drivers media: imx: Add Camera Interface subdev driver media: imx: Add MIPI CSI-2 Receiver subdev driver media: imx: Add MIPI CSI-2 OV5640 sensor subdev driver media: imx: Add Parallel OV5642 sensor subdev driver ARM: imx_v6_v7_defconfig: Enable staging video4linux drivers .../devicetree/bindings/gpio/gpio-pca953x.txt |4 + Documentation/devicetree/bindings/media/imx.txt| 205 + Documentation/media/v4l-drivers/imx.rst| 429 ++ arch/arm/boot/dts/imx6dl-sabrelite.dts |5 + arch/arm/boot/dts/imx6dl-sabresd.dts |5 + arch/arm/boot/dts/imx6dl.dtsi | 183 + arch/arm/boot/dts/imx6q-sabrelite.dts |6 + arch/arm/boot/dts/imx6q-sabresd.dts|5 + arch/arm/boot/dts/imx6q.dtsi | 123 + arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 142 +- arch/arm/boot/dts/imx6qdl-sabrelite.dtsi | 122 +- arch/arm/boot/dts/imx6qdl-sabresd.dtsi | 114 +- arch/arm/boot/dts/imx6qdl.dtsi | 25 +- arch/arm/configs/imx_v6_v7_defconfig | 10 +- drivers/gpio/gpio-pca953x.c| 17 + drivers/staging/media/Kconfig |2 + drivers/staging/media/Makefile |1 + drivers/staging/media/imx/Kconfig | 36 + drivers/staging/media/imx/Makefile | 16 + drivers/staging/media/imx/TODO | 18 + drivers/staging/media/imx/imx-camif.c | 1011 + drivers/staging/media/imx/imx-csi.c| 638 +++ drivers/staging/media/imx/imx-ic-common.c | 113 + drivers/staging/media/imx/imx-ic-pp.c | 636 +++ drivers/staging/media/imx/imx-ic-prpenc.c | 1037 + drivers/staging/media/imx/imx-ic-prpvf.c | 1181 ++ drivers/staging/media/imx/imx-ic.h | 36 + drivers/staging/media/imx/imx-media-common.c | 981 + drivers/staging/media/imx/imx-media-dev.c | 479 +++ drivers/staging/media/imx/imx-media-fim.c | 508 +++ drivers/staging/media/imx/imx-media-internal-sd.c | 456 ++ drivers/staging/media/imx/imx-media-of.c | 291 ++ drivers/staging/media/imx/imx-media-of.h | 25 + drivers/staging/media/imx/imx-media.h | 290 ++ drivers/staging/media/imx/imx-mipi-csi2.c | 509 +++ drivers/staging/media/imx/imx-smfc.c | 739 drivers/staging/media/imx/imx-video-switch.c | 349 ++ drivers/staging/media/imx/ov5640-mipi.c| 2349 +++ drivers/staging/media/imx/ov5642.c | 4364 include/media/imx.h| 15 + include/uapi/Kbuild|1 + include/uapi/linux/v4l2-controls.h |4 + include/uapi/media/Kbuild |2 + include/uapi/media/imx.h | 30 + 44 files changed, 17484 insertions(+), 28 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/imx.txt create mode 100644 Documentation/media/v4l-drivers/imx.rst create mode 100644 drivers/staging/media/imx/Kconfig create mode 100644 drivers/staging/media/imx/Makefile create mode 100644 drivers/staging/media/imx/TODO create mode 100644 drivers/staging/media/imx/imx-camif.c create mode 100644 drivers/staging/media/imx/imx-csi.c create mode 100644 drivers/staging/media/imx/imx-ic-common.c create mode 100644 drivers/staging/media/imx/imx-ic-pp.c create mode 100644 drivers/staging/media/imx/imx-ic-prpenc.c create mode 100644 drivers/staging/media/imx/imx-ic-prpvf.c create mode 100644 drivers/staging/media/imx/imx-ic.h create mode 100644 drivers/staging/medi
[PATCH 01/20] ARM: dts: imx6qdl: Add compatible, clocks, irqs to MIPI CSI-2 node
Add to the MIPI CSI2 receiver node: compatible string, interrupt sources, clocks. Signed-off-by: Steve Longerbeam --- arch/arm/boot/dts/imx6qdl.dtsi | 7 +++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi index 53e6e63..7b546e3 100644 --- a/arch/arm/boot/dts/imx6qdl.dtsi +++ b/arch/arm/boot/dts/imx6qdl.dtsi @@ -1125,7 +1125,14 @@ }; mipi_csi: mipi@021dc000 { + compatible = "fsl,imx-mipi-csi2"; reg = <0x021dc000 0x4000>; + interrupts = <0 100 0x04>, <0 101 0x04>; + clocks = <&clks IMX6QDL_CLK_HSI_TX>, +<&clks IMX6QDL_CLK_VIDEO_27M>, +<&clks IMX6QDL_CLK_EIM_SEL>; + clock-names = "dphy_clk", "cfg_clk", "pix_clk"; + status = "disabled"; }; mipi_dsi: mipi@021e { -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/20] ARM: dts: imx6qdl: Add mipi_ipu1/2 multiplexers, mipi_csi, and their connections
From: Philipp Zabel This patch adds the device tree graph connecting the input multiplexers to the IPU CSIs and the MIPI-CSI2 gasket on i.MX6. The MIPI_IPU multiplexers are added as children of the iomuxc-gpr syscon device node. On i.MX6Q/D two two-input multiplexers in front of IPU1 CSI0 and IPU2 CSI1 allow to select between CSI0/1 parallel input pads and the MIPI CSI-2 virtual channels 0/3. On i.MX6DL/S two five-input multiplexers in front of IPU1 CSI0 and IPU1 CSI1 allow to select between CSI0/1 parallel input pads and any of the four MIPI CSI-2 virtual channels. Signed-off-by: Philipp Zabel - Removed some dangling/unused endpoints (ipu2_csi0_from_csi2ipu) - Renamed the mipi virtual channel endpoint labels, from "mipi_csiX_..." to "mipi_vcX...". - Added input endpoints to the video muxes for the connections from parallel sensors. - Added input endpoints to the mipi_csi for the connections from mipi csi-2 sensors. - The video multiplexer node has compatible string "imx-video-mux" instead of "video-multiplexer". - The video multiplexer node indicates GPR register via reg propert only, (register offset and bitmask), instead of specifying with "bit-mask" and "bit-shift" properties. Signed-off-by: Steve Longerbeam --- arch/arm/boot/dts/imx6dl.dtsi | 183 + arch/arm/boot/dts/imx6q.dtsi | 119 +++ arch/arm/boot/dts/imx6qdl.dtsi | 10 ++- 3 files changed, 311 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/imx6dl.dtsi b/arch/arm/boot/dts/imx6dl.dtsi index 1ade195..0a1718c 100644 --- a/arch/arm/boot/dts/imx6dl.dtsi +++ b/arch/arm/boot/dts/imx6dl.dtsi @@ -181,6 +181,189 @@ "di0", "di1"; }; +&gpr { + ipu1_csi0_mux: ipu1_csi0_mux@34 { + compatible = "imx-video-mux"; + reg = <0x34 0x07>; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + port@0 { + reg = <0>; + + ipu1_csi0_mux_from_mipi_vc0: endpoint { + remote-endpoint = <&mipi_vc0_to_ipu1_csi0_mux>; + }; + }; + + port@1 { + reg = <1>; + + ipu1_csi0_mux_from_mipi_vc1: endpoint { + remote-endpoint = <&mipi_vc1_to_ipu1_csi0_mux>; + }; + }; + + port@2 { + reg = <2>; + + ipu1_csi0_mux_from_mipi_vc2: endpoint { + remote-endpoint = <&mipi_vc2_to_ipu1_csi0_mux>; + }; + }; + + port@3 { + reg = <3>; + + ipu1_csi0_mux_from_mipi_vc3: endpoint { + remote-endpoint = <&mipi_vc3_to_ipu1_csi0_mux>; + }; + }; + + port@4 { + reg = <4>; + + ipu1_csi0_mux_from_parallel_sensor: endpoint { + }; + }; + + port@5 { + reg = <5>; + + ipu1_csi0_mux_to_ipu1_csi0: endpoint { + remote-endpoint = <&ipu1_csi0_from_ipu1_csi0_mux>; + }; + }; + }; + + ipu1_csi1_mux: ipu1_csi1_mux@34 { + compatible = "imx-video-mux"; + reg = <0x34 0x38>; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + port@0 { + reg = <0>; + + ipu1_csi1_mux_from_mipi_vc0: endpoint { + remote-endpoint = <&mipi_vc0_to_ipu1_csi1_mux>; + }; + }; + + port@1 { + reg = <1>; + + ipu1_csi1_mux_from_mipi_vc1: endpoint { + remote-endpoint = <&mipi_vc1_to_ipu1_csi1_mux>; + }; + }; + + port@2 { + reg = <2>; + + ipu1_csi1_mux_from_mipi_vc2: endpoint { + remote-endpoint = <&mipi_vc2_to_ipu1_csi1_mux>; + }; + }; + + port@3 { + reg = <3>; + + ipu1_csi1_mux_from_mipi_vc3: endpoint { + remote-endpoint = <&mipi_vc3_to_ipu1_csi1_mux>; + }; + }; + + port@4 { + reg = <4>; + + ipu1_csi1_mux_from_parallel_sensor: endpoint { + }; + }; + + port@5 { + reg = <5>; + + ipu1_csi1_mux_to_ipu1_csi1: endpoint { +
[PATCH 05/20] ARM: dts: imx6-sabresd: add OV5642 and OV5640 camera sensors
Enables the OV5642 parallel-bus sensor, and the OV5640 MIPI CSI-2 sensor. The OV5642 connects to the parallel-bus mux input port on ipu1_csi0_mux. The OV5640 connects to the input port on the MIPI CSI-2 receiver on mipi_csi. It is set to transmit over MIPI virtual channel 1. Until the OV5652 sensor module compatible with the SabreSD becomes available for testing, the ov5642 node is currently disabled. Signed-off-by: Steve Longerbeam --- arch/arm/boot/dts/imx6dl-sabresd.dts | 5 ++ arch/arm/boot/dts/imx6q-sabresd.dts| 5 ++ arch/arm/boot/dts/imx6qdl-sabresd.dtsi | 114 - 3 files changed, 123 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/imx6dl-sabresd.dts b/arch/arm/boot/dts/imx6dl-sabresd.dts index 1e45f2f..6cf7a50 100644 --- a/arch/arm/boot/dts/imx6dl-sabresd.dts +++ b/arch/arm/boot/dts/imx6dl-sabresd.dts @@ -15,3 +15,8 @@ model = "Freescale i.MX6 DualLite SABRE Smart Device Board"; compatible = "fsl,imx6dl-sabresd", "fsl,imx6dl"; }; + +&ipu1_csi1_from_ipu1_csi1_mux { + data-lanes = <0 1>; + clock-lanes = <2>; +}; diff --git a/arch/arm/boot/dts/imx6q-sabresd.dts b/arch/arm/boot/dts/imx6q-sabresd.dts index 9cbdfe7..8c1d7ad 100644 --- a/arch/arm/boot/dts/imx6q-sabresd.dts +++ b/arch/arm/boot/dts/imx6q-sabresd.dts @@ -23,3 +23,8 @@ &sata { status = "okay"; }; + +&ipu1_csi1_from_mipi_vc1 { + data-lanes = <0 1>; + clock-lanes = <2>; +}; diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi index 55ef535..39b4228 100644 --- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi +++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi @@ -10,6 +10,7 @@ * http://www.gnu.org/copyleft/gpl.html */ +#include #include #include @@ -146,6 +147,33 @@ }; }; +&ipu1_csi0_from_ipu1_csi0_mux { + bus-width = <8>; + data-shift = <12>; /* Lines 19:12 used */ + hsync-active = <1>; + vsync-active = <1>; +}; + +&ipu1_csi0_mux_from_parallel_sensor { + remote-endpoint = <&ov5642_to_ipu1_csi0_mux>; +}; + +&ipu1_csi0 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ipu1_csi0>; +}; + +&mipi_csi { + status = "okay"; +}; + +/* Incoming port from sensor */ +&mipi_csi_from_mipi_sensor { + remote-endpoint = <&ov5640_to_mipi_csi>; + data-lanes = <0 1>; + clock-lanes = <2>; +}; + &audmux { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_audmux>; @@ -214,7 +242,33 @@ 0x8014 /* 4:FN_DMICCDAT */ 0x /* 5:Default */ >; - }; + }; + + camera: ov5642@3c { + compatible = "ovti,ov5642"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ov5642>; + clocks = <&clks IMX6QDL_CLK_CKO>; + clock-names = "xclk"; + reg = <0x3c>; + xclk = <2400>; + DOVDD-supply = <&vgen4_reg>; /* 1.8v */ + AVDD-supply = <&vgen5_reg>; /* 2.8v, rev C board is VGEN3 + rev B board is VGEN5 */ + DVDD-supply = <&vgen2_reg>; /* 1.5v*/ + pwdn-gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>; /* SD1_DAT0 */ + reset-gpios = <&gpio1 17 GPIO_ACTIVE_LOW>; /* SD1_DAT1 */ + status = "disabled"; + + port { + ov5642_to_ipu1_csi0_mux: endpoint { + remote-endpoint = <&ipu1_csi0_mux_from_parallel_sensor>; + bus-width = <8>; + hsync-active = <1>; + vsync-active = <1>; + }; + }; + }; }; &i2c2 { @@ -322,6 +376,34 @@ }; }; }; + + mipi_camera: ov5640@3c { + compatible = "ovti,ov5640_mipi"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ov5640>; + reg = <0x3c>; + clocks = <&clks IMX6QDL_CLK_CKO>; + clock-names = "xclk"; + xclk = <2400>; + DOVDD-supply = <&vgen4_reg>; /* 1.8v */ + AVDD-supply = <&vgen5_reg>; /* 2.8v, rev C board is VGEN3 + rev B board is VGEN5 */ + DVDD-supply = <&vgen2_reg>; /* 1.5v*/ + pwdn-gpios = <&gpio1 19 GPIO_ACTIVE_HIGH>; /* SD1_DAT2 */ + reset-gpios = <&gpio1 20 GPIO_ACTIVE_LOW>; /* SD1_CLK */ + + port { + #address-cells = <1>; + #size-cells = <0>; + + ov5640_to_mipi_csi: endpoint@1 { + reg = <1>; + remote-endpoint = <&mipi_csi_from_mipi_sensor>; + data-lanes = <0 1>; +
[PATCH 03/20] ARM: dts: imx6qdl: add media device
Signed-off-by: Steve Longerbeam --- arch/arm/boot/dts/imx6q.dtsi | 4 arch/arm/boot/dts/imx6qdl.dtsi | 8 2 files changed, 12 insertions(+) diff --git a/arch/arm/boot/dts/imx6q.dtsi b/arch/arm/boot/dts/imx6q.dtsi index 56a314f..2fbe0b3 100644 --- a/arch/arm/boot/dts/imx6q.dtsi +++ b/arch/arm/boot/dts/imx6q.dtsi @@ -454,3 +454,7 @@ &vpu { compatible = "fsl,imx6q-vpu", "cnm,coda960"; }; + +&media0 { + ports = <&ipu1_csi0>, <&ipu1_csi1>, <&ipu2_csi0>, <&ipu2_csi1>; +}; diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi index 89218a4..12ae045 100644 --- a/arch/arm/boot/dts/imx6qdl.dtsi +++ b/arch/arm/boot/dts/imx6qdl.dtsi @@ -1296,5 +1296,13 @@ }; }; }; + + media0: media@0 { + compatible = "fsl,imx-media"; + ports = <&ipu1_csi0>, <&ipu1_csi1>; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + }; }; }; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/20] ARM: dts: imx6-sabrelite: add OV5642 and OV5640 camera sensors
Enables the OV5642 parallel-bus sensor, and the OV5640 MIPI CSI-2 sensor. Both hang off the same i2c2 bus, so they require different (and non- default) i2c slave addresses. The OV5642 connects to the parallel-bus mux input port on ipu1_csi0_mux. The OV5640 connects to the input port on the MIPI CSI-2 receiver on mipi_csi. It is set to transmit over MIPI virtual channel 1. Note there is a pin conflict with GPIO6. This pin functions as a power input pin to the OV5642, but ENET uses it as the h/w workaround for erratum ERR006687, to wake-up the ARM cores on normal RX and TX packet done events (see 6261c4c8). So workaround 6261c4c8 is reverted here to support the OV5642, and the "fsl,err006687-workaround-present" boolean also must be removed. The result is that the CPUidle driver will no longer allow entering the deep idle states on the sabrelite. Signed-off-by: Steve Longerbeam --- arch/arm/boot/dts/imx6dl-sabrelite.dts | 5 ++ arch/arm/boot/dts/imx6q-sabrelite.dts| 6 ++ arch/arm/boot/dts/imx6qdl-sabrelite.dtsi | 122 ++- 3 files changed, 129 insertions(+), 4 deletions(-) diff --git a/arch/arm/boot/dts/imx6dl-sabrelite.dts b/arch/arm/boot/dts/imx6dl-sabrelite.dts index 0f06ca5..fec2524 100644 --- a/arch/arm/boot/dts/imx6dl-sabrelite.dts +++ b/arch/arm/boot/dts/imx6dl-sabrelite.dts @@ -48,3 +48,8 @@ model = "Freescale i.MX6 DualLite SABRE Lite Board"; compatible = "fsl,imx6dl-sabrelite", "fsl,imx6dl"; }; + +&ipu1_csi1_from_ipu1_csi1_mux { + data-lanes = <0 1>; + clock-lanes = <2>; +}; diff --git a/arch/arm/boot/dts/imx6q-sabrelite.dts b/arch/arm/boot/dts/imx6q-sabrelite.dts index 66d10d8..9e2d26d 100644 --- a/arch/arm/boot/dts/imx6q-sabrelite.dts +++ b/arch/arm/boot/dts/imx6q-sabrelite.dts @@ -52,3 +52,9 @@ &sata { status = "okay"; }; + +&ipu1_csi1_from_mipi_vc1 { + data-lanes = <0 1>; + clock-lanes = <2>; +}; + diff --git a/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi b/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi index 1f9076e..4a50bb1 100644 --- a/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi +++ b/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi @@ -39,6 +39,8 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ + +#include #include #include @@ -96,6 +98,15 @@ }; }; + mipi_xclk: mipi_xclk { + compatible = "pwm-clock"; + #clock-cells = <0>; + clock-frequency = <2200>; + clock-output-names = "mipi_pwm3"; + pwms = <&pwm3 0 45>; /* 1 / 45 ns = 22 MHz */ + status = "okay"; + }; + gpio-keys { compatible = "gpio-keys"; pinctrl-names = "default"; @@ -220,6 +231,22 @@ }; }; +&ipu1_csi0_from_ipu1_csi0_mux { + bus-width = <8>; + data-shift = <12>; /* Lines 19:12 used */ + hsync-active = <1>; + vync-active = <1>; +}; + +&ipu1_csi0_mux_from_parallel_sensor { + remote-endpoint = <&ov5642_to_ipu1_csi0_mux>; +}; + +&ipu1_csi0 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ipu1_csi0>; +}; + &audmux { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_audmux>; @@ -271,9 +298,6 @@ txd1-skew-ps = <0>; txd2-skew-ps = <0>; txd3-skew-ps = <0>; - interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, - <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; - fsl,err006687-workaround-present; status = "okay"; }; @@ -302,6 +326,52 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_i2c2>; status = "okay"; + + camera: ov5642@42 { + compatible = "ovti,ov5642"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ov5642>; + clocks = <&clks IMX6QDL_CLK_CKO2>; + clock-names = "xclk"; + reg = <0x42>; + xclk = <2400>; + reset-gpios = <&gpio1 8 GPIO_ACTIVE_LOW>; + pwdn-gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; + gp-gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>; + + port { + ov5642_to_ipu1_csi0_mux: endpoint { + remote-endpoint = <&ipu1_csi0_mux_from_parallel_sensor>; + bus-width = <8>; + hsync-active = <1>; + vsync-active = <1>; + }; + }; + }; + + mipi_camera: ov5640@40 { + compatible = "ovti,ov5640_mipi"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ov5640>; + clocks = <&mipi_xclk>; + clock-names = "xclk"; + reg = <0x40>; + xclk = <2200>; + reset-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>; /* NANDF_D5 */ + pwdn-gpi
[PATCH 09/20] ARM: dts: imx6-sabreauto: add the ADV7180 video decoder
Enables the ADV7180 decoder sensor. The ADV7180 connects to the parallel-bus mux input on ipu1_csi0_mux. On the sabreauto, two analog video inputs are routed to the ADV7180, composite on Ain1, and composite on Ain3. Those inputs are defined via inputs and input-names under the ADV7180 node. The ADV7180 power pin is via max7310_b port expander. Signed-off-by: Steve Longerbeam --- arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 56 1 file changed, 56 insertions(+) diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi index 83ac2ff..30ee378 100644 --- a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi @@ -147,10 +147,42 @@ gpio-controller; #gpio-cells = <2>; }; + + camera: adv7180@21 { + compatible = "adi,adv7180"; + reg = <0x21>; + powerdown-gpios = <&max7310_b 2 GPIO_ACTIVE_LOW>; + interrupt-parent = <&gpio1>; + interrupts = <27 0x8>; + inputs = <0x00 0x02>; + input-names = "ADV7180 Composite on Ain1", + "ADV7180 Composite on Ain3"; + + port { + adv7180_to_ipu1_csi0_mux: endpoint { + remote-endpoint = <&ipu1_csi0_mux_from_parallel_sensor>; + bus-width = <8>; + }; + }; + }; }; }; }; +&ipu1_csi0_from_ipu1_csi0_mux { + bus-width = <8>; +}; + +&ipu1_csi0_mux_from_parallel_sensor { + remote-endpoint = <&adv7180_to_ipu1_csi0_mux>; + bus-width = <8>; +}; + +&ipu1_csi0 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ipu1_csi0>; +}; + &clks { assigned-clocks = <&clks IMX6QDL_PLL4_BYPASS_SRC>, <&clks IMX6QDL_PLL4_BYPASS>, @@ -451,6 +483,30 @@ >; }; + pinctrl_ipu1_csi0: ipu1grp-csi0 { + fsl,pins = < + MX6QDL_PAD_CSI0_DAT4__IPU1_CSI0_DATA04 0x8000 + MX6QDL_PAD_CSI0_DAT5__IPU1_CSI0_DATA05 0x8000 + MX6QDL_PAD_CSI0_DAT6__IPU1_CSI0_DATA06 0x8000 + MX6QDL_PAD_CSI0_DAT7__IPU1_CSI0_DATA07 0x8000 + MX6QDL_PAD_CSI0_DAT8__IPU1_CSI0_DATA08 0x8000 + MX6QDL_PAD_CSI0_DAT9__IPU1_CSI0_DATA09 0x8000 + MX6QDL_PAD_CSI0_DAT10__IPU1_CSI0_DATA10 0x8000 + MX6QDL_PAD_CSI0_DAT11__IPU1_CSI0_DATA11 0x8000 + MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12 0x8000 + MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13 0x8000 + MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14 0x8000 + MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15 0x8000 + MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16 0x8000 + MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17 0x8000 + MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18 0x8000 + MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19 0x8000 + MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK 0x8000 + MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC 0x8000 + MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC 0x8000 + >; + }; + pinctrl_pwm3: pwm1grp { fsl,pins = < MX6QDL_PAD_SD4_DAT1__PWM3_OUT 0x1b0b1 -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/20] gpio: pca953x: Add optional reset gpio control
Add optional reset-gpios pin control. If present, de-assert the specified reset gpio pin to bring the chip out of reset. Signed-off-by: Steve Longerbeam Cc: Linus Walleij Cc: Alexandre Courbot Cc: linux-g...@vger.kernel.org Cc: linux-ker...@vger.kernel.org --- v2: - documented optional reset-gpios property in Documentation/devicetree/bindings/gpio/gpio-pca953x.txt. --- Documentation/devicetree/bindings/gpio/gpio-pca953x.txt | 4 drivers/gpio/gpio-pca953x.c | 17 + 2 files changed, 21 insertions(+) diff --git a/Documentation/devicetree/bindings/gpio/gpio-pca953x.txt b/Documentation/devicetree/bindings/gpio/gpio-pca953x.txt index 08dd15f..da54f4c 100644 --- a/Documentation/devicetree/bindings/gpio/gpio-pca953x.txt +++ b/Documentation/devicetree/bindings/gpio/gpio-pca953x.txt @@ -29,6 +29,10 @@ Required properties: onsemi,pca9654 exar,xra1202 +Optional properties: + - reset-gpios: GPIO specification for the RESET input + + Example: diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index d5d72d8..d1c0bd5 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c @@ -22,6 +22,7 @@ #include #include #include +#include #define PCA953X_INPUT 0 #define PCA953X_OUTPUT 1 @@ -133,6 +134,7 @@ struct pca953x_chip { const char *const *names; unsigned long driver_data; struct regulator *regulator; + struct gpio_desc *reset_gpio; const struct pca953x_reg_config *regs; @@ -756,6 +758,21 @@ static int pca953x_probe(struct i2c_client *client, } else { chip->gpio_start = -1; irq_base = 0; + + /* see if we need to de-assert a reset pin */ + chip->reset_gpio = devm_gpiod_get_optional(&client->dev, + "reset", + GPIOD_OUT_LOW); + if (IS_ERR(chip->reset_gpio)) { + dev_err(&client->dev, "request for reset pin failed\n"); + return PTR_ERR(chip->reset_gpio); + } + + if (chip->reset_gpio) { + /* bring chip out of reset */ + dev_info(&client->dev, "releasing reset\n"); + gpiod_set_value(chip->reset_gpio, 0); + } } chip->client = client; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/20] ARM: dts: imx6-sabreauto: create i2cmux for i2c3
The sabreauto uses a steering pin to select between the SDA signal on i2c3 bus, and a data-in pin for an SPI NOR chip. Use i2cmux to control this steering pin. Idle state of the i2cmux selects SPI NOR. This is not a classic way to use i2cmux, since one side of the mux selects something other than an i2c bus, but it works and is probably the cleanest solution. Note that if one thread is attempting to access SPI NOR while another thread is accessing i2c3, the SPI NOR access will fail since the i2cmux has selected the SDA pin rather than SPI NOR data-in. This couldn't be avoided in any case, the board is not designed to allow concurrent i2c3 and SPI NOR functions (and the default device-tree does not enable SPI NOR anyway). Devices hanging off i2c3 should now be defined under i2cmux, so that the steering pin can be properly controlled to access those devices. The port expanders (MAX7310) are thus moved into i2cmux. Signed-off-by: Steve Longerbeam --- arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 65 +--- 1 file changed, 44 insertions(+), 21 deletions(-) diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi index 52390ba..4a6d038 100644 --- a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi @@ -108,6 +108,44 @@ default-brightness-level = <7>; status = "okay"; }; + + i2cmux { + compatible = "i2c-mux-gpio"; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c3mux>; + mux-gpios = <&gpio5 4 0>; + i2c-parent = <&i2c3>; + idle-state = <0>; + + i2c@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + + max7310_a: gpio@30 { + compatible = "maxim,max7310"; + reg = <0x30>; + gpio-controller; + #gpio-cells = <2>; + }; + + max7310_b: gpio@32 { + compatible = "maxim,max7310"; + reg = <0x32>; + gpio-controller; + #gpio-cells = <2>; + }; + + max7310_c: gpio@34 { + compatible = "maxim,max7310"; + reg = <0x34>; + gpio-controller; + #gpio-cells = <2>; + }; + }; + }; }; &clks { @@ -291,27 +329,6 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_i2c3>; status = "okay"; - - max7310_a: gpio@30 { - compatible = "maxim,max7310"; - reg = <0x30>; - gpio-controller; - #gpio-cells = <2>; - }; - - max7310_b: gpio@32 { - compatible = "maxim,max7310"; - reg = <0x32>; - gpio-controller; - #gpio-cells = <2>; - }; - - max7310_c: gpio@34 { - compatible = "maxim,max7310"; - reg = <0x34>; - gpio-controller; - #gpio-cells = <2>; - }; }; &iomuxc { @@ -419,6 +436,12 @@ >; }; + pinctrl_i2c3mux: i2c3muxgrp { + fsl,pins = < + MX6QDL_PAD_EIM_A24__GPIO5_IO04 0x8000 + >; + }; + pinctrl_pwm3: pwm1grp { fsl,pins = < MX6QDL_PAD_SD4_DAT1__PWM3_OUT 0x1b0b1 -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 12/20] media: imx: Add CSI subdev driver
This is a media entity subdevice for the i.MX Camera Serial Interface module. Signed-off-by: Steve Longerbeam --- drivers/staging/media/imx/Kconfig | 13 + drivers/staging/media/imx/Makefile | 2 + drivers/staging/media/imx/imx-csi.c | 638 3 files changed, 653 insertions(+) create mode 100644 drivers/staging/media/imx/imx-csi.c diff --git a/drivers/staging/media/imx/Kconfig b/drivers/staging/media/imx/Kconfig index bfde58d..ce2d2c8 100644 --- a/drivers/staging/media/imx/Kconfig +++ b/drivers/staging/media/imx/Kconfig @@ -6,3 +6,16 @@ config VIDEO_IMX_MEDIA Say yes here to enable support for video4linux media controller driver for the i.MX5/6 SOC. +if VIDEO_IMX_MEDIA +menu "i.MX5/6 Media Sub devices" + +config VIDEO_IMX_CAMERA + tristate "i.MX5/6 Camera driver" + depends on VIDEO_IMX_MEDIA && VIDEO_DEV && I2C + select VIDEOBUF2_DMA_CONTIG + default y + ---help--- + A video4linux camera capture driver for i.MX5/6. + +endmenu +endif diff --git a/drivers/staging/media/imx/Makefile b/drivers/staging/media/imx/Makefile index ef9f11b..133672a 100644 --- a/drivers/staging/media/imx/Makefile +++ b/drivers/staging/media/imx/Makefile @@ -4,3 +4,5 @@ imx-media-objs := imx-media-dev.o imx-media-fim.o imx-media-internal-sd.o \ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media.o obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-common.o +obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o + diff --git a/drivers/staging/media/imx/imx-csi.c b/drivers/staging/media/imx/imx-csi.c new file mode 100644 index 000..975eafb --- /dev/null +++ b/drivers/staging/media/imx/imx-csi.c @@ -0,0 +1,638 @@ +/* + * V4L2 Capture CSI Subdev for Freescale i.MX5/6 SOC + * + * Copyright (c) 2014-2016 Mentor Graphics Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include "imx-media.h" + +#define CSI_NUM_PADS 2 + +struct csi_priv { + struct device *dev; + struct ipu_soc *ipu; + struct imx_media_dev *md; + struct v4l2_subdev sd; + struct media_pad pad[CSI_NUM_PADS]; + struct v4l2_mbus_framefmt format_mbus[CSI_NUM_PADS]; + struct v4l2_mbus_config sensor_mbus_cfg; + struct v4l2_rect crop; + struct ipu_csi *csi; + int csi_id; + int input_pad; + int output_pad; + bool power_on; /* power is on */ + bool stream_on; /* streaming is on */ + + /* the sink for the captured frames */ + struct v4l2_subdev *sink_sd; + enum ipu_csi_dest dest; + struct v4l2_subdev *src_sd; + + struct v4l2_ctrl_handler ctrl_hdlr; + struct imx_media_fim *fim; + + /* the attached sensor at stream on */ + struct imx_media_subdev *sensor; +}; + +static inline struct csi_priv *sd_to_dev(struct v4l2_subdev *sdev) +{ + return container_of(sdev, struct csi_priv, sd); +} + +/* Update the CSI whole sensor and active windows */ +static int csi_setup(struct csi_priv *priv) +{ + struct v4l2_mbus_framefmt infmt; + + ipu_csi_set_window(priv->csi, &priv->crop); + + /* +* the ipu-csi doesn't understand ALTERNATE, but it only +* needs to know whether the stream is interlaced, so set +* to INTERLACED if infmt field is ALTERNATE. +*/ + infmt = priv->format_mbus[priv->input_pad]; + if (infmt.field == V4L2_FIELD_ALTERNATE) + infmt.field = V4L2_FIELD_INTERLACED; + + ipu_csi_init_interface(priv->csi, &priv->sensor_mbus_cfg, &infmt); + + ipu_csi_set_dest(priv->csi, priv->dest); + + ipu_csi_dump(priv->csi); + + return 0; +} + +static int csi_start(struct csi_priv *priv) +{ + int ret; + + if (!priv->sensor) { + v4l2_err(&priv->sd, "no sensor attached\n"); + return -EINVAL; + } + + ret = csi_setup(priv); + if (ret) + return ret; + + /* start the frame interval monitor */ + ret = imx_media_fim_set_stream(priv->fim, priv->sensor, true); + if (ret) + return ret; + + ret = ipu_csi_enable(priv->csi); + if (ret) { + v4l2_err(&priv->sd, "CSI enable error: %d\n", ret); + return ret; + } + + return 0; +} + +static void csi_stop(struct csi_priv *priv) +{ + /* stop the frame interval monitor */ + imx_media_fim_set_stream(priv->fim, priv->sensor, false); + + ipu_csi_disable(priv->csi); +} + +static int csi_s_stream(struct v4l2_subdev *sd, int enable) +{ + struct csi_priv *priv = v4l2_get_subdevdata(sd); + int ret = 0; + + if (!priv->src_sd || !priv->sink_sd) + return -EPIPE; + +
[PATCH 13/20] media: imx: Add SMFC subdev driver
This is a media entity subdevice driver for the i.MX Sensor Multi-FIFO Controller module. Video frames are received from the CSI and can be routed to various sinks including the i.MX Image Converter for scaling, color-space conversion, motion compensated deinterlacing, and image rotation. --- drivers/staging/media/imx/Makefile | 1 + drivers/staging/media/imx/imx-smfc.c | 739 +++ 2 files changed, 740 insertions(+) create mode 100644 drivers/staging/media/imx/imx-smfc.c diff --git a/drivers/staging/media/imx/Makefile b/drivers/staging/media/imx/Makefile index 133672a..3559d7b 100644 --- a/drivers/staging/media/imx/Makefile +++ b/drivers/staging/media/imx/Makefile @@ -5,4 +5,5 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media.o obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-common.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o +obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o diff --git a/drivers/staging/media/imx/imx-smfc.c b/drivers/staging/media/imx/imx-smfc.c new file mode 100644 index 000..75a3875 --- /dev/null +++ b/drivers/staging/media/imx/imx-smfc.c @@ -0,0 +1,739 @@ +/* + * V4L2 Capture SMFC Subdev for Freescale i.MX5/6 SOC + * + * This subdevice handles capture of raw/unconverted video frames + * from the CSI, directly to memory via the Sensor Multi-FIFO Controller. + * + * Copyright (c) 2012-2016 Mentor Graphics Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "imx-media.h" + +/* + * Min/Max supported width and heights. + * + * We allow planar output from the SMFC, so we have to align + * output width by 16 pixels to meet IDMAC alignment requirements, + * which also means input width must have the same alignment. + */ +#define MIN_W 176 +#define MIN_H 144 +#define MAX_W 8192 +#define MAX_H 4096 +#define W_ALIGN4 /* multiple of 16 pixels */ +#define H_ALIGN1 /* multiple of 2 lines */ +#define S_ALIGN1 /* multiple of 2 */ + +#define SMFC_NUM_PADS 2 + +struct imx_smfc_priv { + struct device*dev; + struct ipu_soc *ipu; + struct imx_media_dev *md; + struct v4l2_subdev sd; + struct media_pad pad[SMFC_NUM_PADS]; + int ipu_id; + int smfc_id; + int input_pad; + int output_pad; + + struct ipuv3_channel *smfc_ch; + struct ipu_smfc *smfc; + + struct v4l2_mbus_framefmt format_mbus[SMFC_NUM_PADS]; + const struct imx_media_pixfmt *cc[SMFC_NUM_PADS]; + + struct v4l2_mbus_config sensor_mbus_cfg; + + /* the dma buffer ring to send to sink */ + struct imx_media_dma_buf_ring *out_ring; + struct imx_media_dma_buf *next; + + int ipu_buf_num; /* ipu double buffer index: 0-1 */ + + /* the sink that will receive the dma buffers */ + struct v4l2_subdev *sink_sd; + struct v4l2_subdev *src_sd; + + /* +* the CSI id and mipi virtual channel number at +* link validate +*/ + int csi_id; + int vc_num; + + /* the attached sensor at stream on */ + struct imx_media_subdev *sensor; + + spinlock_t irqlock; + struct timer_list eof_timeout_timer; + int eof_irq; + int nfb4eof_irq; + + bool stream_on; /* streaming is on */ + bool last_eof; /* waiting for last EOF at stream off */ + struct completion last_eof_comp; +}; + +static void imx_smfc_put_ipu_resources(struct imx_smfc_priv *priv) +{ + if (!IS_ERR_OR_NULL(priv->smfc_ch)) + ipu_idmac_put(priv->smfc_ch); + priv->smfc_ch = NULL; + + if (!IS_ERR_OR_NULL(priv->smfc)) + ipu_smfc_put(priv->smfc); + priv->smfc = NULL; +} + +static int imx_smfc_get_ipu_resources(struct imx_smfc_priv *priv) +{ + int ch_num, ret; + + priv->ipu = priv->md->ipu[priv->ipu_id]; + + ch_num = IPUV3_CHANNEL_CSI0 + priv->smfc_id; + + priv->smfc = ipu_smfc_get(priv->ipu, ch_num); + if (IS_ERR(priv->smfc)) { + v4l2_err(&priv->sd, "failed to get SMFC\n"); + ret = PTR_ERR(priv->smfc); + goto out; + } + + priv->smfc_ch = ipu_idmac_get(priv->ipu, ch_num); + if (IS_ERR(priv->smfc_ch)) { + v4l2_err(&priv->sd, "could not get IDMAC channel %u\n", ch_num); + ret = PTR_ERR(priv->smfc_ch); + goto out; + } + + return 0; +out: + imx_smfc_put_ipu_resources(priv); + return ret; +} + +static irqreturn_t imx_smfc_eof_interrupt(int irq, void *dev_id) +{ + struct imx_smfc_priv *priv = dev_id; + struct imx
[PATCH 07/20] ARM: dts: imx6-sabreauto: add reset-gpios property for max7310_b
The reset pin to the port expander chip (MAX7310) is controlled by a gpio, so define a reset-gpios property to control it. There are three MAX7310's on the SabreAuto CPU card (max7310_[abc]), but all use the same pin for their reset. Since all can't acquire the same pin, assign it to max7310_b, that chip is needed by more functions (usb and adv7180). Signed-off-by: Steve Longerbeam --- arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 9 + 1 file changed, 9 insertions(+) diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi index 4a6d038..516bac6 100644 --- a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi @@ -136,6 +136,9 @@ reg = <0x32>; gpio-controller; #gpio-cells = <2>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_max7310>; + reset-gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; }; max7310_c: gpio@34 { @@ -442,6 +445,12 @@ >; }; + pinctrl_max7310: max7310grp { + fsl,pins = < + MX6QDL_PAD_SD2_DAT0__GPIO1_IO15 0x8000 + >; + }; + pinctrl_pwm3: pwm1grp { fsl,pins = < MX6QDL_PAD_SD4_DAT1__PWM3_OUT 0x1b0b1 -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/20] ARM: dts: imx6-sabreauto: add pinctrl for gpt input capture
Add pinctrl groups for both GPT input capture channels. Signed-off-by: Steve Longerbeam --- arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 12 1 file changed, 12 insertions(+) diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi index 516bac6..83ac2ff 100644 --- a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi @@ -457,6 +457,18 @@ >; }; + pinctrl_gpt_input_capture0: gptinputcapture0grp { + fsl,pins = < + MX6QDL_PAD_SD1_DAT0__GPT_CAPTURE1 0x8000 + >; + }; + + pinctrl_gpt_input_capture1: gptinputcapture1grp { + fsl,pins = < + MX6QDL_PAD_SD1_DAT1__GPT_CAPTURE2 0x8000 + >; + }; + pinctrl_spdif: spdifgrp { fsl,pins = < MX6QDL_PAD_KEY_COL3__SPDIF_IN 0x1b0b0 -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 15/20] media: imx: Add Camera Interface subdev driver
This is the camera interface driver that provides the v4l2 user interface. Frames can be received from various sources: - directly from SMFC for capturing unconverted images directly from camera sensors. - from the IC pre-process encode task. - from the IC pre-process viewfinder task. - from the IC post-process task. Signed-off-by: Steve Longerbeam --- drivers/staging/media/imx/Makefile|2 +- drivers/staging/media/imx/imx-camif.c | 1011 + 2 files changed, 1012 insertions(+), 1 deletion(-) create mode 100644 drivers/staging/media/imx/imx-camif.c diff --git a/drivers/staging/media/imx/Makefile b/drivers/staging/media/imx/Makefile index d2a962c..fe9e992 100644 --- a/drivers/staging/media/imx/Makefile +++ b/drivers/staging/media/imx/Makefile @@ -8,4 +8,4 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-ic.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o - +obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-camif.o diff --git a/drivers/staging/media/imx/imx-camif.c b/drivers/staging/media/imx/imx-camif.c new file mode 100644 index 000..034a1ff --- /dev/null +++ b/drivers/staging/media/imx/imx-camif.c @@ -0,0 +1,1011 @@ +/* + * Video Camera Capture Subdev for Freescale i.MX5/6 SOC + * + * Copyright (c) 2012-2016 Mentor Graphics Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "imx-media.h" + +#define DEVICE_NAME "imx-media-camif" + +#define CAMIF_NUM_PADS 2 + +#define CAMIF_DQ_TIMEOUT5000 + +struct camif_priv; + +struct camif_priv { + struct device *dev; + struct video_devicevfd; + struct media_pipeline mp; + struct imx_media_dev *md; + struct v4l2_subdev sd; + struct media_pad pad[CAMIF_NUM_PADS]; + struct media_pad vd_pad; + int id; + int input_pad; + int output_pad; + + struct v4l2_mbus_framefmt format_mbus[CAMIF_NUM_PADS]; + const struct imx_media_pixfmt *cc[CAMIF_NUM_PADS]; + + /* dma buffer ring */ + struct imx_media_dma_buf_ring *in_ring; + struct v4l2_subdev *src_sd; + + struct mutex mutex; /* capture device mutex */ + spinlock_t q_lock; /* protect ready_q */ + + /* buffer queue used in videobuf2 */ + struct vb2_queue buffer_queue; + + /* streaming buffer queue */ + struct list_head ready_q; + + /* controls inherited from subdevs */ + struct v4l2_ctrl_handler ctrl_hdlr; + + /* misc status */ + intcurrent_input; /* the current input */ + v4l2_std_idcurrent_std; /* current standard */ + bool stop; /* streaming is stopping */ +}; + +/* In bytes, per queue */ +#define VID_MEM_LIMIT SZ_64M + +static struct vb2_ops camif_qops; + +/* + * Video ioctls follow + */ + +static int vidioc_querycap(struct file *file, void *fh, + struct v4l2_capability *cap) +{ + strncpy(cap->driver, DEVICE_NAME, sizeof(cap->driver) - 1); + strncpy(cap->card, DEVICE_NAME, sizeof(cap->card) - 1); + cap->bus_info[0] = 0; + cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; + cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; + + return 0; +} + +static int camif_enum_fmt_vid_cap(struct file *file, void *fh, + struct v4l2_fmtdesc *f) +{ + const struct imx_media_pixfmt *cc; + u32 code; + int ret; + + ret = imx_media_enum_format(&code, f->index, true, true); + if (ret) + return ret; + cc = imx_media_find_format(0, code, true, true); + if (!cc) + return -EINVAL; + + f->pixelformat = cc->fourcc; + + return 0; +} + +static int camif_g_fmt_vid_cap(struct file *file, void *fh, + struct v4l2_format *f) +{ + struct camif_priv *priv = video_drvdata(file); + struct v4l2_mbus_framefmt *outfmt; + + /* user format is the same as the format from output pad */ + outfmt = &priv->format_mbus[priv->output_pad]; + return imx_media_mbus_fmt_to_pix_fmt(&f->fmt.pix, outfmt); +} + +static int camif_try_fmt_vid_cap(struct file *file, void *fh, + struct v4l2_format *f) +{ + return camif_g_fmt_vid_cap(file, fh, f); +} + +static int camif_s_fmt_vid_cap(struct file *file, void *fh, + struct v4l2_format *f) +{ + struct camif_
[PATCH 11/20] media: Add i.MX media core driver
Add the core media driver for i.MX SOC. Signed-off-by: Steve Longerbeam --- Documentation/devicetree/bindings/media/imx.txt | 205 + Documentation/media/v4l-drivers/imx.rst | 429 ++ drivers/staging/media/Kconfig | 2 + drivers/staging/media/Makefile| 1 + drivers/staging/media/imx/Kconfig | 8 + drivers/staging/media/imx/Makefile| 6 + drivers/staging/media/imx/TODO| 18 + drivers/staging/media/imx/imx-media-common.c | 981 ++ drivers/staging/media/imx/imx-media-dev.c | 479 +++ drivers/staging/media/imx/imx-media-fim.c | 508 +++ drivers/staging/media/imx/imx-media-internal-sd.c | 456 ++ drivers/staging/media/imx/imx-media-of.c | 291 +++ drivers/staging/media/imx/imx-media-of.h | 25 + drivers/staging/media/imx/imx-media.h | 290 +++ include/media/imx.h | 15 + include/uapi/Kbuild | 1 + include/uapi/linux/v4l2-controls.h| 4 + include/uapi/media/Kbuild | 2 + include/uapi/media/imx.h | 30 + 19 files changed, 3751 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/imx.txt create mode 100644 Documentation/media/v4l-drivers/imx.rst create mode 100644 drivers/staging/media/imx/Kconfig create mode 100644 drivers/staging/media/imx/Makefile create mode 100644 drivers/staging/media/imx/TODO create mode 100644 drivers/staging/media/imx/imx-media-common.c create mode 100644 drivers/staging/media/imx/imx-media-dev.c create mode 100644 drivers/staging/media/imx/imx-media-fim.c create mode 100644 drivers/staging/media/imx/imx-media-internal-sd.c create mode 100644 drivers/staging/media/imx/imx-media-of.c create mode 100644 drivers/staging/media/imx/imx-media-of.h create mode 100644 drivers/staging/media/imx/imx-media.h create mode 100644 include/media/imx.h create mode 100644 include/uapi/media/Kbuild create mode 100644 include/uapi/media/imx.h diff --git a/Documentation/devicetree/bindings/media/imx.txt b/Documentation/devicetree/bindings/media/imx.txt new file mode 100644 index 000..3593354 --- /dev/null +++ b/Documentation/devicetree/bindings/media/imx.txt @@ -0,0 +1,205 @@ +Freescale i.MX Media Video Devices + +Video Media Controller node +--- + +This is the parent media controller node for video capture support. + +Required properties: +- compatible : "fsl,imx-media"; +- ports : Should contain a list of phandles pointing to camera + sensor interface ports of IPU devices + + +fim child node +-- + +This is an optional child node of the ipu_csi port nodes. It can be used +to modify the default control values for the video capture Frame +Interval Monitor. Refer to Documentation/media/v4l-drivers/imx.rst for +more info on the Frame Interval Monitor. + +Optional properties: +- enable : enable (1) or disable (0) the FIM; +- num-avg : how many frame intervals the FIM will average; +- num-skip: how many frames the FIM will skip after a video + capture restart before beginning to sample frame + intervals; +- tolerance-range : a range of tolerances for the averaged frame + interval error, specified as , in usec. + The FIM will signal a frame interval error if + min < error < max. If the max is <= min, then + tolerance range is disabled (interval error if + error > min). +- input-capture-channel: an input capture channel and channel flags, +specified as . The channel number +must be 0 or 1. The flags can be +IRQ_TYPE_EDGE_RISING, IRQ_TYPE_EDGE_FALLING, or +IRQ_TYPE_EDGE_BOTH, and specify which input +capture signal edge will trigger the event. If +an input capture channel is specified, the FIM +will use this method to measure frame intervals +instead of via the EOF interrupt. The input capture +method is much preferred over EOF as it is not +subject to interrupt latency errors. However it +requires routing the VSYNC or FIELD output +signals of the camera sensor to one of the +i.MX input capture pads (SD1_DAT0, SD1_DAT1), +which also gives up support for SD1. + + +mipi_csi2 node +-- + +This is the device node for the MIPI CSI-2 Receiver, required for MIPI +CSI-2 sensors. + +Required properties: +- compatible : "fsl,imx-mipi-csi2"; +- reg : physical base address and l
[PATCH 17/20] media: imx: Add video switch subdev driver
From: Philipp Zabel This driver can handle SoC internal and extern video bus multiplexers, controlled either by register bit fields or by GPIO. Signed-off-by: Sascha Hauer Signed-off-by: Philipp Zabel Signed-off-by: Steve Longerbeam --- drivers/staging/media/imx/Makefile | 1 + drivers/staging/media/imx/imx-video-switch.c | 349 +++ 2 files changed, 350 insertions(+) create mode 100644 drivers/staging/media/imx/imx-video-switch.c diff --git a/drivers/staging/media/imx/Makefile b/drivers/staging/media/imx/Makefile index 0decef7..e3d6d8d 100644 --- a/drivers/staging/media/imx/Makefile +++ b/drivers/staging/media/imx/Makefile @@ -10,3 +10,4 @@ obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-camif.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-mipi-csi2.o +obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-video-switch.o diff --git a/drivers/staging/media/imx/imx-video-switch.c b/drivers/staging/media/imx/imx-video-switch.c new file mode 100644 index 000..33e3652 --- /dev/null +++ b/drivers/staging/media/imx/imx-video-switch.c @@ -0,0 +1,349 @@ +/* + * devicetree probed mediacontrol video multiplexer. + * + * Copyright (C) 2013 Sascha Hauer, Pengutronix + * Copyright (c) 2016 Mentor Graphics Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "imx-media.h" + +struct vidsw { + struct device *dev; + struct imx_media_dev *md; + struct v4l2_subdev subdev; + struct media_pad *pads; + struct v4l2_mbus_framefmt *format_mbus; + struct v4l2_of_endpoint *endpoint; + struct regmap_field *field; + struct gpio_desc *gpio; + int output_pad; + int numpads; + int active; +}; + +#define to_vidsw(sd) container_of(sd, struct vidsw, subdev) + +static int vidsw_set_mux(struct vidsw *vidsw, int input_index) +{ + if (vidsw->active >= 0) { + if (vidsw->active == input_index) + return 0; + else + return -EBUSY; + } + + vidsw->active = input_index; + + dev_dbg(vidsw->dev, "setting %d active\n", vidsw->active); + + if (vidsw->field) + regmap_field_write(vidsw->field, vidsw->active); + else if (vidsw->gpio) + gpiod_set_value(vidsw->gpio, vidsw->active); + + return 0; +} + +static int vidsw_link_setup(struct media_entity *entity, + const struct media_pad *local, + const struct media_pad *remote, u32 flags) +{ + struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity); + struct vidsw *vidsw = to_vidsw(sd); + + dev_dbg(vidsw->dev, "link setup %s -> %s", remote->entity->name, + local->entity->name); + + if (local->flags & MEDIA_PAD_FL_SINK) { + if (!(flags & MEDIA_LNK_FL_ENABLED)) { + if (local->index == vidsw->active) { + dev_dbg(vidsw->dev, "going inactive\n"); + vidsw->active = -1; + } + return 0; + } + + return vidsw_set_mux(vidsw, local->index); + } + + return 0; +} + +static struct media_entity_operations vidsw_ops = { + .link_setup = vidsw_link_setup, + .link_validate = v4l2_subdev_link_validate, +}; + +/* + * retrieve our pads parsed from the OF graph by the media device + */ +static int vidsw_registered(struct v4l2_subdev *sd) +{ + struct vidsw *vidsw = container_of(sd, struct vidsw, subdev); + struct device_node *np = vidsw->dev->of_node; + struct imx_media_subdev *imxsd; + struct device_node *epnode; + struct imx_media_pad *pad; + int i, ret; + + vidsw->md = dev_get_drvdata(sd->v4l2_dev->dev); + + imxsd = imx_media_find_subdev_by_sd(vidsw->md, sd); + if (IS_ERR(imxsd)) + return PTR_ERR(imxsd); + + if (imxsd->num_sink_pads < 2 || imxsd->num_src_pads != 1) + return -EINVAL; + + vidsw->numpads = imxsd->num_sink_pads + imxsd->num_src_pads; + + vidsw->pads = devm_kzalloc(vidsw->dev, + vidsw->numpads * sizeof(*vidsw->pads), + GFP_KERNEL); + if (!vidsw->pads) + return -ENOMEM; + +
[PATCH 16/20] media: imx: Add MIPI CSI-2 Receiver subdev driver
Adds MIPI CSI-2 Receiver subdev driver. This subdev is required for sensors with a MIPI CSI2 interface. Signed-off-by: Steve Longerbeam --- drivers/staging/media/imx/Makefile| 1 + drivers/staging/media/imx/imx-mipi-csi2.c | 509 ++ 2 files changed, 510 insertions(+) create mode 100644 drivers/staging/media/imx/imx-mipi-csi2.c diff --git a/drivers/staging/media/imx/Makefile b/drivers/staging/media/imx/Makefile index fe9e992..0decef7 100644 --- a/drivers/staging/media/imx/Makefile +++ b/drivers/staging/media/imx/Makefile @@ -9,3 +9,4 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-ic.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-camif.o +obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-mipi-csi2.o diff --git a/drivers/staging/media/imx/imx-mipi-csi2.c b/drivers/staging/media/imx/imx-mipi-csi2.c new file mode 100644 index 000..84df16e --- /dev/null +++ b/drivers/staging/media/imx/imx-mipi-csi2.c @@ -0,0 +1,509 @@ +/* + * MIPI CSI-2 Receiver Subdev for Freescale i.MX5/6 SOC. + * + * Copyright (c) 2012-2014 Mentor Graphics Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "imx-media.h" + +/* + * there must be 5 pads: 1 input pad from sensor, and + * the 4 virtual channel output pads + */ +#define CSI2_NUM_SINK_PADS 1 +#define CSI2_NUM_SRC_PADS 4 +#define CSI2_NUM_PADS 5 + +struct imxcsi2_dev { + struct device *dev; + struct imx_media_dev *md; + struct v4l2_subdev sd; + struct media_pad pad[CSI2_NUM_PADS]; + struct v4l2_mbus_framefmt format_mbus; + struct v4l2_subdev *src_sd; + struct v4l2_subdev *sink_sd[CSI2_NUM_SRC_PADS]; + intinput_pad; + struct clk *dphy_clk; + struct clk *cfg_clk; + struct clk *pix_clk; /* what is this? */ + void __iomem *base; + int intr1; + int intr2; + struct v4l2_of_bus_mipi_csi2 bus; + boolon; + boolstream_on; +}; + +#define DEVICE_NAME "imx-mipi-csi2" + +/* Register offsets */ +#define CSI2_VERSION0x000 +#define CSI2_N_LANES0x004 +#define CSI2_PHY_SHUTDOWNZ 0x008 +#define CSI2_DPHY_RSTZ 0x00c +#define CSI2_RESETN 0x010 +#define CSI2_PHY_STATE 0x014 +#define CSI2_DATA_IDS_1 0x018 +#define CSI2_DATA_IDS_2 0x01c +#define CSI2_ERR1 0x020 +#define CSI2_ERR2 0x024 +#define CSI2_MSK1 0x028 +#define CSI2_MSK2 0x02c +#define CSI2_PHY_TST_CTRL0 0x030 +#define CSI2_PHY_TST_CTRL1 0x034 +#define CSI2_SFT_RESET 0xf00 + +static inline struct imxcsi2_dev *sd_to_dev(struct v4l2_subdev *sdev) +{ + return container_of(sdev, struct imxcsi2_dev, sd); +} + +static inline u32 imxcsi2_read(struct imxcsi2_dev *csi2, unsigned int regoff) +{ + return readl(csi2->base + regoff); +} + +static inline void imxcsi2_write(struct imxcsi2_dev *csi2, u32 val, +unsigned int regoff) +{ + writel(val, csi2->base + regoff); +} + +static void imxcsi2_set_lanes(struct imxcsi2_dev *csi2) +{ + int lanes = csi2->bus.num_data_lanes; + + imxcsi2_write(csi2, lanes - 1, CSI2_N_LANES); +} + +static void imxcsi2_enable(struct imxcsi2_dev *csi2, bool enable) +{ + if (enable) { + imxcsi2_write(csi2, 0x, CSI2_PHY_SHUTDOWNZ); + imxcsi2_write(csi2, 0x, CSI2_DPHY_RSTZ); + imxcsi2_write(csi2, 0x, CSI2_RESETN); + } else { + imxcsi2_write(csi2, 0x0, CSI2_PHY_SHUTDOWNZ); + imxcsi2_write(csi2, 0x0, CSI2_DPHY_RSTZ); + imxcsi2_write(csi2, 0x0, CSI2_RESETN); + } +} + +static void imxcsi2_reset(struct imxcsi2_dev *csi2) +{ + imxcsi2_enable(csi2, false); + + imxcsi2_write(csi2, 0x0001, CSI2_PHY_TST_CTRL0); + imxcsi2_write(csi2, 0x, CSI2_PHY_TST_CTRL1); + imxcsi2_write(csi2, 0x, CSI2_PHY_TST_CTRL0); + imxcsi2_write(csi2, 0x0002, CSI2_PHY_TST_CTRL0); + imxcsi2_write(csi2, 0x00010044, CSI2_PHY_TST_CTRL1); + imxcsi2_write(csi2, 0x, CSI2_PHY_TST_CTRL0); + imxcsi2_write(csi2, 0x0014, CSI2_PHY_TST_CTRL1); + imxcsi2_write(csi2, 0x0002, CSI2_PHY_TST_CTRL0); + imxcsi2_write(csi2, 0x, CSI2_PHY_TST
[PATCH 14/20] media: imx: Add IC subdev drivers
This is a set of three media entity subdevice drivers for the i.MX Image Converter. The i.MX IC module contains three independent "tasks": - Pre-processing Encode task: video frames are routed directly from the CSI and can be scaled, color-space converted, and rotated. Scaled output is limited to 1024x1024 resolution. Output frames can be routed to various sinks including the post-processing subdev task described below. - Pre-processing Viewfinder task: this task can perform the same conversions as the pre-process encode task, but in addition can be used for hardware motion compensated deinterlacing. Frames can come either directly from the CSIs or from memory via IDMAC channels. Scaled output is limited to 1024x1024 resolution. Output frames can be routed to various sinks including the post-processing subdev task. - Post-processing task: same conversions as pre-process encode. However this subdevice driver sends frames to the i.MX IPU image converter which supports image tiling, which allows scaled output up to 4096x4096 resolution. Output frames can be routed to the camera interface driver or a mem2mem driver. --- drivers/staging/media/imx/Makefile|2 + drivers/staging/media/imx/imx-ic-common.c | 113 +++ drivers/staging/media/imx/imx-ic-pp.c | 636 drivers/staging/media/imx/imx-ic-prpenc.c | 1037 + drivers/staging/media/imx/imx-ic-prpvf.c | 1181 + drivers/staging/media/imx/imx-ic.h| 36 + 6 files changed, 3005 insertions(+) create mode 100644 drivers/staging/media/imx/imx-ic-common.c create mode 100644 drivers/staging/media/imx/imx-ic-pp.c create mode 100644 drivers/staging/media/imx/imx-ic-prpenc.c create mode 100644 drivers/staging/media/imx/imx-ic-prpvf.c create mode 100644 drivers/staging/media/imx/imx-ic.h diff --git a/drivers/staging/media/imx/Makefile b/drivers/staging/media/imx/Makefile index 3559d7b..d2a962c 100644 --- a/drivers/staging/media/imx/Makefile +++ b/drivers/staging/media/imx/Makefile @@ -1,8 +1,10 @@ imx-media-objs := imx-media-dev.o imx-media-fim.o imx-media-internal-sd.o \ imx-media-of.o +imx-ic-objs := imx-ic-common.o imx-ic-prpenc.o imx-ic-prpvf.o imx-ic-pp.o obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media.o obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-common.o +obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-ic.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o diff --git a/drivers/staging/media/imx/imx-ic-common.c b/drivers/staging/media/imx/imx-ic-common.c new file mode 100644 index 000..1b40558 --- /dev/null +++ b/drivers/staging/media/imx/imx-ic-common.c @@ -0,0 +1,113 @@ +/* + * V4L2 Image Converter Subdev for Freescale i.MX5/6 SOC + * + * Copyright (c) 2014-2016 Mentor Graphics Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#include +#include +#include +#include +#include "imx-media.h" +#include "imx-ic.h" + +static struct imx_ic_ops *ic_ops[IC_NUM_TASKS] = { + [IC_TASK_ENCODER]= &imx_ic_prpenc_ops, + [IC_TASK_VIEWFINDER] = &imx_ic_prpvf_ops, + [IC_TASK_POST_PROCESSOR] = &imx_ic_pp_ops, +}; + +static int imx_ic_probe(struct platform_device *pdev) +{ + struct imx_media_internal_sd_platformdata *pdata; + struct imx_ic_priv *priv; + int ret; + + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + platform_set_drvdata(pdev, &priv->sd); + priv->dev = &pdev->dev; + + /* get our ipu_id, grp_id and IC task id */ + pdata = priv->dev->platform_data; + priv->ipu_id = pdata->ipu_id; + switch (pdata->grp_id) { + case IMX_MEDIA_GRP_ID_IC_PRPENC: + priv->task_id = IC_TASK_ENCODER; + break; + case IMX_MEDIA_GRP_ID_IC_PRPVF: + priv->task_id = IC_TASK_VIEWFINDER; + break; + case IMX_MEDIA_GRP_ID_IC_PP0...IMX_MEDIA_GRP_ID_IC_PP3: + priv->task_id = IC_TASK_POST_PROCESSOR; + break; + default: + return -EINVAL; + } + + v4l2_subdev_init(&priv->sd, ic_ops[priv->task_id]->subdev_ops); + v4l2_set_subdevdata(&priv->sd, priv); + priv->sd.internal_ops = ic_ops[priv->task_id]->internal_ops; + priv->sd.entity.ops = ic_ops[priv->task_id]->entity_ops; + priv->sd.entity.function = MEDIA_ENT_F_PROC_VIDEO_SCALER; + priv->sd.dev = &pdev->dev; + priv->sd.owner = THIS_MODULE; + priv->sd.flags = V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS; + priv->sd.grp_id = pdata->grp_id; + strncpy(priv->sd.name, pdata->sd_name, sizeof(priv->sd.name)); + + ret = ic_ops[priv
[PATCH 20/20] ARM: imx_v6_v7_defconfig: Enable staging video4linux drivers
Enable imx v4l2 staging drivers. For video capture on the SabreAuto, the ADV7180 video decoder also requires the i2c-mux-gpio and the max7310 port expander. The Sabrelite requires PWM clocks for the OV5640. Signed-off-by: Steve Longerbeam --- arch/arm/configs/imx_v6_v7_defconfig | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig index cbe7faf..5da4d8e 100644 --- a/arch/arm/configs/imx_v6_v7_defconfig +++ b/arch/arm/configs/imx_v6_v7_defconfig @@ -51,6 +51,7 @@ CONFIG_PREEMPT_VOLUNTARY=y CONFIG_AEABI=y CONFIG_HIGHMEM=y CONFIG_CMA=y +CONFIG_FORCE_MAX_ZONEORDER=14 CONFIG_CMDLINE="noinitrd console=ttymxc0,115200" CONFIG_KEXEC=y CONFIG_CPU_FREQ=y @@ -181,6 +182,7 @@ CONFIG_SERIAL_FSL_LPUART=y CONFIG_SERIAL_FSL_LPUART_CONSOLE=y # CONFIG_I2C_COMPAT is not set CONFIG_I2C_CHARDEV=y +CONFIG_I2C_MUX=y CONFIG_I2C_MUX_GPIO=y # CONFIG_I2C_HELPER_AUTO is not set CONFIG_I2C_ALGOPCF=m @@ -194,11 +196,11 @@ CONFIG_GPIO_SYSFS=y CONFIG_GPIO_MC9S08DZ60=y CONFIG_GPIO_PCA953X=y CONFIG_GPIO_STMPE=y -CONFIG_POWER_SUPPLY=y CONFIG_POWER_RESET=y CONFIG_POWER_RESET_IMX=y CONFIG_POWER_RESET_SYSCON=y CONFIG_POWER_RESET_SYSCON_POWEROFF=y +CONFIG_POWER_SUPPLY=y CONFIG_SENSORS_GPIO_FAN=y CONFIG_SENSORS_IIO_HWMON=y CONFIG_THERMAL=y @@ -221,6 +223,8 @@ CONFIG_REGULATOR_PFUZE100=y CONFIG_MEDIA_SUPPORT=y CONFIG_MEDIA_CAMERA_SUPPORT=y CONFIG_MEDIA_RC_SUPPORT=y +CONFIG_MEDIA_CONTROLLER=y +CONFIG_VIDEO_V4L2_SUBDEV_API=y CONFIG_RC_DEVICES=y CONFIG_IR_GPIO_CIR=y CONFIG_MEDIA_USB_SUPPORT=y @@ -229,6 +233,8 @@ CONFIG_V4L_PLATFORM_DRIVERS=y CONFIG_SOC_CAMERA=y CONFIG_V4L_MEM2MEM_DRIVERS=y CONFIG_VIDEO_CODA=y +# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set +CONFIG_VIDEO_ADV7180=m CONFIG_SOC_CAMERA_OV2640=y CONFIG_IMX_IPUV3_CORE=y CONFIG_DRM=y @@ -338,6 +344,8 @@ CONFIG_FSL_EDMA=y CONFIG_IMX_SDMA=y CONFIG_MXS_DMA=y CONFIG_STAGING=y +CONFIG_STAGING_MEDIA=y +CONFIG_COMMON_CLK_PWM=y CONFIG_IIO=y CONFIG_VF610_ADC=y CONFIG_MPL3115=y -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 18/20] media: imx: Add MIPI CSI-2 OV5640 sensor subdev driver
This driver is based on ov5640_mipi.c from Freescale imx_3.10.17_1.0.0_beta branch, modified heavily to bring forward to latest interfaces and code cleanup. Signed-off-by: Steve Longerbeam --- drivers/staging/media/imx/Kconfig |8 + drivers/staging/media/imx/Makefile |2 + drivers/staging/media/imx/ov5640-mipi.c | 2349 +++ 3 files changed, 2359 insertions(+) create mode 100644 drivers/staging/media/imx/ov5640-mipi.c diff --git a/drivers/staging/media/imx/Kconfig b/drivers/staging/media/imx/Kconfig index ce2d2c8..09f373d 100644 --- a/drivers/staging/media/imx/Kconfig +++ b/drivers/staging/media/imx/Kconfig @@ -17,5 +17,13 @@ config VIDEO_IMX_CAMERA ---help--- A video4linux camera capture driver for i.MX5/6. +config IMX_OV5640_MIPI + tristate "OmniVision OV5640 MIPI CSI-2 camera support" + depends on GPIOLIB && VIDEO_IMX_CAMERA + select IMX_MIPI_CSI2 + default y + ---help--- + MIPI CSI-2 OV5640 Camera support. + endmenu endif diff --git a/drivers/staging/media/imx/Makefile b/drivers/staging/media/imx/Makefile index e3d6d8d..f96e623 100644 --- a/drivers/staging/media/imx/Makefile +++ b/drivers/staging/media/imx/Makefile @@ -11,3 +11,5 @@ obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-camif.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-mipi-csi2.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-video-switch.o + +obj-$(CONFIG_IMX_OV5640_MIPI) += ov5640-mipi.o diff --git a/drivers/staging/media/imx/ov5640-mipi.c b/drivers/staging/media/imx/ov5640-mipi.c new file mode 100644 index 000..a83b581 --- /dev/null +++ b/drivers/staging/media/imx/ov5640-mipi.c @@ -0,0 +1,2349 @@ +/* + * Copyright (c) 2014 Mentor Graphics Inc. + * Copyright (C) 2011-2013 Freescale Semiconductor, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define OV5640_VOLTAGE_ANALOG 280 +#define OV5640_VOLTAGE_DIGITAL_CORE 150 +#define OV5640_VOLTAGE_DIGITAL_IO 180 + +#define MIN_FPS 15 +#define MAX_FPS 30 +#define DEFAULT_FPS 30 + +/* min/typical/max system clock (xclk) frequencies */ +#define OV5640_XCLK_MIN 600 +#define OV5640_XCLK_TYP 2400 +#define OV5640_XCLK_MAX 5400 + +/* min/typical/max pixel clock (mclk) frequencies */ +#define OV5640_MCLK_MIN 4800 +#define OV5640_MCLK_TYP 4800 +#define OV5640_MCLK_MAX 9600 + +#define OV5640_CHIP_ID 0x300A +#define OV5640_SLAVE_ID 0x3100 +#define OV5640_DEFAULT_SLAVE_ID 0x3c + +#define OV5640_MAX_CONTROLS 64 + +enum ov5640_mode { + ov5640_mode_MIN = 0, + ov5640_mode_QCIF_176_144 = 0, + ov5640_mode_QVGA_320_240, + ov5640_mode_VGA_640_480, + ov5640_mode_NTSC_720_480, + ov5640_mode_PAL_720_576, + ov5640_mode_XGA_1024_768, + ov5640_mode_720P_1280_720, + ov5640_mode_1080P_1920_1080, + ov5640_mode_QSXGA_2592_1944, + ov5640_num_modes, + ov5640_mode_INIT = 0xff, /*only for sensor init*/ +}; + +enum ov5640_frame_rate { + ov5640_15_fps, + ov5640_30_fps +}; + +static int ov5640_framerates[] = { + [ov5640_15_fps] = 15, + [ov5640_30_fps] = 30, +}; +#define ov5640_num_framerates ARRAY_SIZE(ov5640_framerates) + +/* image size under 1280 * 960 are SUBSAMPLING + * image size upper 1280 * 960 are SCALING + */ +enum ov5640_downsize_mode { + SUBSAMPLING, + SCALING, +}; + +struct reg_value { + u16 reg_addr; + u8 val; + u8 mask; + u32 delay_ms; +}; + +struct ov5640_mode_info { + enum ov5640_mode mode; + enum ov5640_downsize_mode dn_mode; + u32 width; + u32 height; + struct reg_value *init_data_ptr; + u32 init_data_size; +}; + +struct ov5640_dev { + struct i2c_client *i2c_client; + struct device *dev; + struct v4l2_subdev sd; + struct media_pad pad; + struct v4l2_ctrl_handler ctrl_hdl; + struct v4l2_of_endpoint ep; /* the parsed DT endpoint info */ + struct v4l2_mbus_framefmt fmt; + struct v4l2_captureparm streamcap; + struct clk *xclk; /* system clock to OV5640 */ + int xclk_freq;/* requested xclk freq from devicetree */ + + enum ov5640_mode current_mode; + enum ov5640_frame_rate current_fr; + + bool on; + bool awb_on; + bool agc_on; + + /* cached control settings */ + int ctrl_cache[OV5640_MAX_CONTROLS]; + + struct gpio_desc *reset_gpio; + struct gpio_desc *pwdn_gpio; + struct gpio_de
[PATCH 3/3] staging: rtl8188eu: remove unused members from struct recv_priv
Since commit da25a8ec6b2d ("staging: rtl8188eu: remove unused debugging functions") is_signal_dbg is never set to true, so the code under if (adapter->recvpriv.is_signal_dbg) is dead. Remove the variable and the dead code. The signal_strength_dbg was referenced only in the code that is being removed, so remove it as well. Also fix coding style issues in the touched lines. Cc: Greg Kroah-Hartman Cc: Larry Finger Cc: Ivan Safonov Cc: de...@driverdev.osuosl.org Signed-off-by: Luca Ceresoli --- drivers/staging/rtl8188eu/core/rtw_recv.c| 75 +++- drivers/staging/rtl8188eu/include/rtw_recv.h | 2 - 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index 3e6edb63d36b..f46e63e9e24b 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -2064,45 +2064,48 @@ static void rtw_signal_stat_timer_hdl(unsigned long data) u8 avg_signal_qual = 0; u8 _alpha = 3; /* this value is based on converging_constant = 5000 and sampling_interval = 1000 */ - if (adapter->recvpriv.is_signal_dbg) { - /* update the user specific value, signal_strength_dbg, to signal_strength, rssi */ - adapter->recvpriv.signal_strength = adapter->recvpriv.signal_strength_dbg; - adapter->recvpriv.rssi = (s8)translate_percentage_to_dbm((u8)adapter->recvpriv.signal_strength_dbg); - } else { - if (recvpriv->signal_strength_data.update_req == 0) {/* update_req is clear, means we got rx */ - avg_signal_strength = recvpriv->signal_strength_data.avg_val; - /* after avg_vals are acquired, we can re-stat the signal values */ - recvpriv->signal_strength_data.update_req = 1; - } - - if (recvpriv->signal_qual_data.update_req == 0) {/* update_req is clear, means we got rx */ - avg_signal_qual = recvpriv->signal_qual_data.avg_val; - /* after avg_vals are acquired, we can re-stat the signal values */ - recvpriv->signal_qual_data.update_req = 1; - } + if (recvpriv->signal_strength_data.update_req == 0) { + /* update_req is clear, means we got rx */ + avg_signal_strength = recvpriv->signal_strength_data.avg_val; + /* after avg_vals are acquired, we can re-stat the signal +* values +*/ + recvpriv->signal_strength_data.update_req = 1; + } - /* update value of signal_strength, rssi, signal_qual */ - if (check_fwstate(&adapter->mlmepriv, _FW_UNDER_SURVEY) == false) { - tmp_s = avg_signal_strength+(_alpha-1)*recvpriv->signal_strength; - if (tmp_s % _alpha) - tmp_s = tmp_s/_alpha + 1; - else - tmp_s = tmp_s/_alpha; - if (tmp_s > 100) - tmp_s = 100; + if (recvpriv->signal_qual_data.update_req == 0) { + /* update_req is clear, means we got rx */ + avg_signal_qual = recvpriv->signal_qual_data.avg_val; + /* after avg_vals are acquired, we can re-stat the signal +* values +*/ + recvpriv->signal_qual_data.update_req = 1; + } - tmp_q = avg_signal_qual+(_alpha-1)*recvpriv->signal_qual; - if (tmp_q % _alpha) - tmp_q = tmp_q/_alpha + 1; - else - tmp_q = tmp_q/_alpha; - if (tmp_q > 100) - tmp_q = 100; + /* update value of signal_strength, rssi, signal_qual */ + if (check_fwstate(&adapter->mlmepriv, _FW_UNDER_SURVEY) == false) { + tmp_s = avg_signal_strength + + (_alpha - 1) * recvpriv->signal_strength; + if (tmp_s % _alpha) + tmp_s = tmp_s / _alpha + 1; + else + tmp_s = tmp_s / _alpha; + if (tmp_s > 100) + tmp_s = 100; + + tmp_q = avg_signal_qual + + (_alpha - 1) * recvpriv->signal_qual; + if (tmp_q % _alpha) + tmp_q = tmp_q / _alpha + 1; + else + tmp_q = tmp_q / _alpha; + if (tmp_q > 100) + tmp_q = 100; - recvpriv->signal_strength = tmp_s; - recvpriv->rssi = (s8)translate_percentage_to_dbm(tmp_s); - recvpriv->signal_qual = tmp_q; - } + recvpriv->signal_strength = t
[PATCH 1/3] staging: rtl8188eu: remove unused field bRxRSSIDisplay in struct adapter
Since commit da25a8ec6b2d ("staging: rtl8188eu: remove unused debugging functions") this field is never set set to any nonzero value, so it is actually always zero. It is also used only once, as a boolean inside an if(). This means the code under that if() is dead code, so remove it as well. Cc: Greg Kroah-Hartman Cc: Larry Finger Cc: Ivan Safonov Cc: de...@driverdev.osuosl.org Signed-off-by: Luca Ceresoli --- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 3 --- drivers/staging/rtl8188eu/include/drv_types.h | 1 - drivers/staging/rtl8188eu/os_dep/os_intfs.c | 2 -- 3 files changed, 6 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index d9c114776cab..15d134dbe741 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -4707,9 +4707,6 @@ void linked_status_chk(struct adapter *padapter) struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info); struct sta_priv *pstapriv = &padapter->stapriv; - if (padapter->bRxRSSIDisplay) - _linked_rx_signal_strehgth_display(padapter); - if (is_client_associated_to_ap(padapter)) { /* linked infrastructure client mode */ diff --git a/drivers/staging/rtl8188eu/include/drv_types.h b/drivers/staging/rtl8188eu/include/drv_types.h index e86419e525d8..0fd2a2d9be20 100644 --- a/drivers/staging/rtl8188eu/include/drv_types.h +++ b/drivers/staging/rtl8188eu/include/drv_types.h @@ -168,7 +168,6 @@ struct adapter { u8 bFWReady; u8 bReadPortCancel; u8 bWritePortCancel; - u8 bRxRSSIDisplay; struct mutex hw_init_mutex; }; diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c b/drivers/staging/rtl8188eu/os_dep/os_intfs.c index 8fc3fadf065f..5f6a24546a91 100644 --- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c +++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c @@ -413,7 +413,6 @@ static u8 rtw_init_default_value(struct adapter *padapter) /* misc. */ padapter->bReadPortCancel = false; padapter->bWritePortCancel = false; - padapter->bRxRSSIDisplay = 0; return _SUCCESS; } @@ -426,7 +425,6 @@ u8 rtw_reset_drv_sw(struct adapter *padapter) rtw_hal_def_value_init(padapter); padapter->bReadPortCancel = false; padapter->bWritePortCancel = false; - padapter->bRxRSSIDisplay = 0; pmlmepriv->scan_interval = SCAN_INTERVAL;/* 30*2 sec = 60sec */ padapter->xmitpriv.tx_pkts = 0; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/3] staging: rtl8188eu: remove unused function _linked_rx_signal_strehgth_display
Not referenced anymore since the removal of field bRxRSSIDisplay in struct adapter. Cc: Greg Kroah-Hartman Cc: Larry Finger Cc: Ivan Safonov Cc: de...@driverdev.osuosl.org Signed-off-by: Luca Ceresoli --- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 17 - 1 file changed, 17 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index 15d134dbe741..bb1ee2bee528 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -4664,23 +4664,6 @@ void mlmeext_sta_del_event_callback(struct adapter *padapter) Following are the functions for the timer handlers */ -void _linked_rx_signal_strehgth_display(struct adapter *padapter); -void _linked_rx_signal_strehgth_display(struct adapter *padapter) -{ - struct mlme_ext_priv*pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info); - u8 mac_id; - int UndecoratedSmoothedPWDB; - if ((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE) - mac_id = 0; - else if ((pmlmeinfo->state&0x03) == _HW_STATE_AP_) - mac_id = 2; - - rtw_hal_get_def_var(padapter, HW_DEF_RA_INFO_DUMP, &mac_id); - - rtw_hal_get_def_var(padapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, &UndecoratedSmoothedPWDB); - DBG_88E("UndecoratedSmoothedPWDB:%d\n", UndecoratedSmoothedPWDB); -} static u8 chk_ap_is_alive(struct adapter *padapter, struct sta_info *psta) { -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 10/20] gpio: pca953x: Add optional reset gpio control
Hi, On Thu, 29 Dec 2016 14:27:25 -0800 Steve Longerbeam wrote: > Add optional reset-gpios pin control. If present, de-assert the > specified reset gpio pin to bring the chip out of reset. > > Signed-off-by: Steve Longerbeam > Cc: Linus Walleij > Cc: Alexandre Courbot > Cc: linux-g...@vger.kernel.org > Cc: linux-ker...@vger.kernel.org > > --- > > v2: > - documented optional reset-gpios property in > Documentation/devicetree/bindings/gpio/gpio-pca953x.txt. > --- > Documentation/devicetree/bindings/gpio/gpio-pca953x.txt | 4 > drivers/gpio/gpio-pca953x.c | 17 > + > 2 files changed, 21 insertions(+) > > diff --git a/Documentation/devicetree/bindings/gpio/gpio-pca953x.txt > b/Documentation/devicetree/bindings/gpio/gpio-pca953x.txt > index 08dd15f..da54f4c 100644 > --- a/Documentation/devicetree/bindings/gpio/gpio-pca953x.txt > +++ b/Documentation/devicetree/bindings/gpio/gpio-pca953x.txt > @@ -29,6 +29,10 @@ Required properties: > onsemi,pca9654 > exar,xra1202 > > +Optional properties: > + - reset-gpios: GPIO specification for the RESET input > + > + > Example: > > > diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c > index d5d72d8..d1c0bd5 100644 > --- a/drivers/gpio/gpio-pca953x.c > +++ b/drivers/gpio/gpio-pca953x.c > @@ -22,6 +22,7 @@ > #include > #include > #include > +#include > > #define PCA953X_INPUT0 > #define PCA953X_OUTPUT 1 > @@ -133,6 +134,7 @@ struct pca953x_chip { > const char *const *names; > unsigned long driver_data; > struct regulator *regulator; > + struct gpio_desc *reset_gpio; > > const struct pca953x_reg_config *regs; > > @@ -756,6 +758,21 @@ static int pca953x_probe(struct i2c_client *client, > } else { > chip->gpio_start = -1; > irq_base = 0; > + > + /* see if we need to de-assert a reset pin */ > + chip->reset_gpio = devm_gpiod_get_optional(&client->dev, > +"reset", > +GPIOD_OUT_LOW); > + if (IS_ERR(chip->reset_gpio)) { > + dev_err(&client->dev, "request for reset pin failed\n"); > + return PTR_ERR(chip->reset_gpio); > + } > + > + if (chip->reset_gpio) { > + /* bring chip out of reset */ > + dev_info(&client->dev, "releasing reset\n"); > + gpiod_set_value(chip->reset_gpio, 0); > The pin is already initialized to the inactive state thru the GPIOD_OUT_LOW flag in devm_gpiod_get_optional(), so this call to gpiod_set_value() is useless. Lothar Waßmann ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel