RE: [PATCH resend] can: rcar_can: convert to SPDX identifiers
Hi Morimoto-san, Thank you for the patch. > Subject: [PATCH resend] can: rcar_can: convert to SPDX identifiers > > > From: Kuninori Morimoto > > This patch updates license to use SPDX-License-Identifier > instead of verbose license text. > > Signed-off-by: Kuninori Morimoto > Reviewed-by: Simon Horman Acked-by: Ramesh Shanmugasundaram Thanks, Ramesh > --- > Wolfgang, Marc > > 2 weeks past, resend patch > > drivers/net/can/rcar/Kconfig | 1 + > drivers/net/can/rcar/Makefile | 1 + > drivers/net/can/rcar/rcar_can.c | 6 +- > drivers/net/can/rcar/rcar_canfd.c | 6 +- > 4 files changed, 4 insertions(+), 10 deletions(-) > > diff --git a/drivers/net/can/rcar/Kconfig b/drivers/net/can/rcar/Kconfig > index 7b03a3a..bd5a8fc 100644 > --- a/drivers/net/can/rcar/Kconfig > +++ b/drivers/net/can/rcar/Kconfig > @@ -1,3 +1,4 @@ > +# SPDX-License-Identifier: GPL-2.0 > config CAN_RCAR > tristate "Renesas R-Car CAN controller" > depends on ARCH_RENESAS || ARM > diff --git a/drivers/net/can/rcar/Makefile b/drivers/net/can/rcar/Makefile > index 08de36a..c9185b0 100644 > --- a/drivers/net/can/rcar/Makefile > +++ b/drivers/net/can/rcar/Makefile > @@ -1,3 +1,4 @@ > +# SPDX-License-Identifier: GPL-2.0 > # > # Makefile for the Renesas R-Car CAN & CAN FD controller drivers > # > diff --git a/drivers/net/can/rcar/rcar_can.c > b/drivers/net/can/rcar/rcar_can.c > index 11662f4..06f90a0 100644 > --- a/drivers/net/can/rcar/rcar_can.c > +++ b/drivers/net/can/rcar/rcar_can.c > @@ -1,12 +1,8 @@ > +// SPDX-License-Identifier: GPL-2.0+ > /* Renesas R-Car CAN device driver > * > * Copyright (C) 2013 Cogent Embedded, Inc. > * Copyright (C) 2013 Renesas Solutions Corp. > - * > - * 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 > diff --git a/drivers/net/can/rcar/rcar_canfd.c > b/drivers/net/can/rcar/rcar_canfd.c > index 602c19e..0541000 100644 > --- a/drivers/net/can/rcar/rcar_canfd.c > +++ b/drivers/net/can/rcar/rcar_canfd.c > @@ -1,11 +1,7 @@ > +// SPDX-License-Identifier: GPL-2.0+ > /* Renesas R-Car CAN FD device driver > * > * Copyright (C) 2015 Renesas Electronics Corp. > - * > - * 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. > */ > > /* The R-Car CAN FD controller can operate in either one of the below two > modes > -- > 2.7.4
RE: [PATCH 2/2] arm64: dts: renesas: eagle: add CAN-FD support
> Subject: [PATCH 2/2] arm64: dts: renesas: eagle: add CAN-FD support > > Define the Eagle board dependent part of the CAN-FD device node. > > Based on the original (and large) patch by Vladimir Barinov. > > Signed-off-by: Vladimir Barinov > Signed-off-by: Sergei Shtylyov > Acked-by: Ramesh Shanmugasundaram Thanks, Ramesh
RE: [PATCH 1/2] arm64: dts: renesas: r8a77970: add CAN-FD support
> Subject: [PATCH 1/2] arm64: dts: renesas: r8a77970: add CAN-FD support > > Define the generic R8A77970 part of the CAN-FD device node. > > Based on the original (and large) patch by Vladimir Barinov. > > Signed-off-by: Vladimir Barinov > Signed-off-by: Sergei Shtylyov Acked-by: Ramesh Shanmugasundaram Thanks, Ramesh
RE: [PATCH] DT: net: can: rcar_canfd: document R8A77970 bindings
Hello Sergei, Thanks for your patch. > Subject: [PATCH] DT: net: can: rcar_canfd: document R8A77970 bindings > > Document the R-Car V3M (R8A77970) SoC support in the R-Car CAN-FD > bindings. > > Signed-off-by: Sergei Shtylyov Reviewed-by: Ramesh Shanmugasundaram Thanks, Ramesh
RE: [PATCH 0/2] Add R8A77970/Eagle CAN-FD support
Hello Sergei, Thanks. I did search my DT folder before response but it is queued under different folder ☹ Sorry for the noise. Thanks, Ramesh > Subject: Re: [PATCH 0/2] Add R8A77970/Eagle CAN-FD support > > Hello! > > On 04/27/2018 12:46 PM, Ramesh Shanmugasundaram wrote: > > > Thank you for your patch. > > Could you also update the dt bindings please? A separate patch or part > of this series. > >I'd posted it just before these patches, see: > > https://patchwork.kernel.org/patch/10366727/ > > MBR, Sergei
RE: [PATCH 0/2] Add R8A77970/Eagle CAN-FD support
Hi Sergei, Thank you for your patch. Could you also update the dt bindings please? A separate patch or part of this series. > Subject: [PATCH 0/2] Add R8A77970/Eagle CAN-FD support > > Hello! > > Here's the set of 2 patches against Simon Horman's 'renesas.git' repo's > 'renesas-devel-20180426-v4.17-rc2' tag. We're adding the R8A77970 CAN-FD > device node and then enable single chnanel CAN-FD support on the Eagle > board. > > [1/2] arm64: dts: renesas: r8a77970: add CAN-FD support > [2/2] arm64: dts: renesas: eagle: add CAN-FD support > > WBR, Sergei Thanks, Ramesh
RE: [PATCH -next] media: rcar_drif: fix error return code in rcar_drif_alloc_dmachannels()
Hi Wei Yongjun, Thank you for the patch. > Subject: [PATCH -next] media: rcar_drif: fix error return code in > rcar_drif_alloc_dmachannels() > > Fix to return error code -ENODEV from the dma_request_slave_channel() > error handling case instead of 0, as done elsewhere in this function. > rc can be overwrite to 0 by dmaengine_slave_config() in the for loop. > > Signed-off-by: Wei Yongjun Reviewed-by: Ramesh Shanmugasundaram Thanks, Ramesh > --- > drivers/media/platform/rcar_drif.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/platform/rcar_drif.c > b/drivers/media/platform/rcar_drif.c > index b2e080e..dc7e280 100644 > --- a/drivers/media/platform/rcar_drif.c > +++ b/drivers/media/platform/rcar_drif.c > @@ -274,7 +274,7 @@ static int rcar_drif_alloc_dmachannels(struct > rcar_drif_sdr *sdr) { > struct dma_slave_config dma_cfg; > unsigned int i; > - int ret = -ENODEV; > + int ret; > > for_each_rcar_drif_channel(i, &sdr->cur_ch_mask) { > struct rcar_drif *ch = sdr->ch[i]; > @@ -282,6 +282,7 @@ static int rcar_drif_alloc_dmachannels(struct > rcar_drif_sdr *sdr) > ch->dmach = dma_request_slave_channel(&ch->pdev->dev, "rx"); > if (!ch->dmach) { > rdrif_err(sdr, "ch%u: dma channel req failed\n", i); > + ret = -ENODEV; > goto dmach_error; > }
[PATCH 1/2] pinctrl: sh-pfc: r8a7795: Add CAN support
This patch adds CAN[0-1] pinmux support for R-Car H3 ES2.0. The pin config is identical to H3 ES1.*. Signed-off-by: Ramesh Shanmugasundaram Reviewed-by: Fabrizio Castro --- drivers/pinctrl/sh-pfc/pfc-r8a7795.c | 52 1 file changed, 52 insertions(+) diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c index d1cec6d12e81..59249a990cef 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c @@ -1781,6 +1781,38 @@ static const unsigned int avb_avtp_capture_b_mux[] = { AVB_AVTP_CAPTURE_B_MARK, }; +/* - CAN -- */ +static const unsigned int can0_data_a_pins[] = { + /* TX, RX */ + RCAR_GP_PIN(1, 23), RCAR_GP_PIN(1, 24), +}; +static const unsigned int can0_data_a_mux[] = { + CAN0_TX_A_MARK, CAN0_RX_A_MARK, +}; +static const unsigned int can0_data_b_pins[] = { + /* TX, RX */ + RCAR_GP_PIN(2, 0), RCAR_GP_PIN(2, 1), +}; +static const unsigned int can0_data_b_mux[] = { + CAN0_TX_B_MARK, CAN0_RX_B_MARK, +}; +static const unsigned int can1_data_pins[] = { + /* TX, RX */ + RCAR_GP_PIN(1, 22), RCAR_GP_PIN(1, 26), +}; +static const unsigned int can1_data_mux[] = { + CAN1_TX_MARK, CAN1_RX_MARK, +}; + +/* - CAN Clock -- */ +static const unsigned int can_clk_pins[] = { + /* CLK */ + RCAR_GP_PIN(1, 25), +}; +static const unsigned int can_clk_mux[] = { + CAN_CLK_MARK, +}; + /* - DRIF0 --- */ static const unsigned int drif0_ctrl_a_pins[] = { /* CLK, SYNC */ @@ -3843,6 +3875,10 @@ static const struct sh_pfc_pin_group pinmux_groups[] = { SH_PFC_PIN_GROUP(avb_avtp_capture_a), SH_PFC_PIN_GROUP(avb_avtp_match_b), SH_PFC_PIN_GROUP(avb_avtp_capture_b), + SH_PFC_PIN_GROUP(can0_data_a), + SH_PFC_PIN_GROUP(can0_data_b), + SH_PFC_PIN_GROUP(can1_data), + SH_PFC_PIN_GROUP(can_clk), SH_PFC_PIN_GROUP(drif0_ctrl_a), SH_PFC_PIN_GROUP(drif0_data0_a), SH_PFC_PIN_GROUP(drif0_data1_a), @@ -4154,6 +4190,19 @@ static const char * const avb_groups[] = { "avb_avtp_capture_b", }; +static const char * const can0_groups[] = { + "can0_data_a", + "can0_data_b", +}; + +static const char * const can1_groups[] = { + "can1_data", +}; + +static const char * const can_clk_groups[] = { + "can_clk", +}; + static const char * const drif0_groups[] = { "drif0_ctrl_a", "drif0_data0_a", @@ -4559,6 +4608,9 @@ static const char * const usb30_groups[] = { static const struct sh_pfc_function pinmux_functions[] = { SH_PFC_FUNCTION(audio_clk), SH_PFC_FUNCTION(avb), + SH_PFC_FUNCTION(can0), + SH_PFC_FUNCTION(can1), + SH_PFC_FUNCTION(can_clk), SH_PFC_FUNCTION(drif0), SH_PFC_FUNCTION(drif1), SH_PFC_FUNCTION(drif2), -- 2.12.2
[PATCH 2/2] pinctrl: sh-pfc: r8a7795: Add CAN FD support
This patch adds CAN FD[0-1] pinmux support for R-Car H3 ES2.0. The pin config is identical to H3 ES1.*. Signed-off-by: Ramesh Shanmugasundaram Reviewed-by: Fabrizio Castro --- drivers/pinctrl/sh-pfc/pfc-r8a7795.c | 37 1 file changed, 37 insertions(+) diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c index 59249a990cef..34a2dc471e5a 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c @@ -1813,6 +1813,29 @@ static const unsigned int can_clk_mux[] = { CAN_CLK_MARK, }; +/* - CAN FD --- */ +static const unsigned int canfd0_data_a_pins[] = { + /* TX, RX */ + RCAR_GP_PIN(1, 23), RCAR_GP_PIN(1, 24), +}; +static const unsigned int canfd0_data_a_mux[] = { + CANFD0_TX_A_MARK, CANFD0_RX_A_MARK, +}; +static const unsigned int canfd0_data_b_pins[] = { + /* TX, RX */ + RCAR_GP_PIN(2, 0), RCAR_GP_PIN(2, 1), +}; +static const unsigned int canfd0_data_b_mux[] = { + CANFD0_TX_B_MARK, CANFD0_RX_B_MARK, +}; +static const unsigned int canfd1_data_pins[] = { + /* TX, RX */ + RCAR_GP_PIN(1, 22), RCAR_GP_PIN(1, 26), +}; +static const unsigned int canfd1_data_mux[] = { + CANFD1_TX_MARK, CANFD1_RX_MARK, +}; + /* - DRIF0 --- */ static const unsigned int drif0_ctrl_a_pins[] = { /* CLK, SYNC */ @@ -3879,6 +3902,9 @@ static const struct sh_pfc_pin_group pinmux_groups[] = { SH_PFC_PIN_GROUP(can0_data_b), SH_PFC_PIN_GROUP(can1_data), SH_PFC_PIN_GROUP(can_clk), + SH_PFC_PIN_GROUP(canfd0_data_a), + SH_PFC_PIN_GROUP(canfd0_data_b), + SH_PFC_PIN_GROUP(canfd1_data), SH_PFC_PIN_GROUP(drif0_ctrl_a), SH_PFC_PIN_GROUP(drif0_data0_a), SH_PFC_PIN_GROUP(drif0_data1_a), @@ -4203,6 +4229,15 @@ static const char * const can_clk_groups[] = { "can_clk", }; +static const char * const canfd0_groups[] = { + "canfd0_data_a", + "canfd0_data_b", +}; + +static const char * const canfd1_groups[] = { + "canfd1_data", +}; + static const char * const drif0_groups[] = { "drif0_ctrl_a", "drif0_data0_a", @@ -4611,6 +4646,8 @@ static const struct sh_pfc_function pinmux_functions[] = { SH_PFC_FUNCTION(can0), SH_PFC_FUNCTION(can1), SH_PFC_FUNCTION(can_clk), + SH_PFC_FUNCTION(canfd0), + SH_PFC_FUNCTION(canfd1), SH_PFC_FUNCTION(drif0), SH_PFC_FUNCTION(drif1), SH_PFC_FUNCTION(drif2), -- 2.12.2
[PATCH 0/2] Add CAN & CAN FD pinctrl support for R-Car H3 ES2.0
Hi Geert, All, This series adds CAN and CAN FD pinctrl support for R-Car H3 ES2.0. The pin config is identical to H3 ES1.x. This series is based on renesas-drivers repo commit: cdf382160c46b29ce99532ed4378ddc044a5a1c9 Thanks, Ramesh. Ramesh Shanmugasundaram (2): pinctrl: sh-pfc: r8a7795: Add CAN support pinctrl: sh-pfc: r8a7795: Add CAN FD support drivers/pinctrl/sh-pfc/pfc-r8a7795.c | 89 1 file changed, 89 insertions(+) -- 2.12.2
RE: [PATCH] [media] rcar_drif: fix potential uninitialized variable use
Hi Arnd, Thank you for the patch. > Subject: [PATCH] [media] rcar_drif: fix potential uninitialized variable > use > > Older compilers like gcc-4.6 may run into a case that returns an > uninitialized variable from rcar_drif_enable_rx() if that function was > ever called with an empty cur_ch_mask: > > drivers/media/platform/rcar_drif.c:658:2: error: ‘ret’ may be used > uninitialized in this function [-Werror=uninitialized] > > Newer compilers don't have that problem as they optimize the 'ret' > variable away and just return zero in that case. > > This changes the function to return -EINVAL for this particular failure, > to make it consistent across all compiler versions. > In case gcc gets changed to report a warning for it in the future, it's > also a good idea to shut it up now. > > Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82203 > Signed-off-by: Arnd Bergmann Acked-by: Ramesh Shanmugasundaram Thanks, Ramesh
[PATCH v3 2/2] regmap: Avoid namespace collision within macro & tidy up
Renamed variable "timeout" to "__timeout" & "pollret" to "__ret" to avoid namespace collision. Tidy up macro arguments with parentheses. Signed-off-by: Ramesh Shanmugasundaram --- include/linux/regmap.h | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 978abfbac617..1474ab0a3922 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -120,23 +120,24 @@ struct reg_sequence { */ #define regmap_read_poll_timeout(map, addr, val, cond, sleep_us, timeout_us) \ ({ \ - ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \ - int pollret; \ + ktime_t __timeout = ktime_add_us(ktime_get(), timeout_us); \ + int __ret; \ might_sleep_if(sleep_us); \ for (;;) { \ - pollret = regmap_read((map), (addr), &(val)); \ - if (pollret) \ + __ret = regmap_read((map), (addr), &(val)); \ + if (__ret) \ break; \ if (cond) \ break; \ - if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \ - pollret = regmap_read((map), (addr), &(val)); \ + if ((timeout_us) && \ + ktime_compare(ktime_get(), __timeout) > 0) { \ + __ret = regmap_read((map), (addr), &(val)); \ break; \ } \ if (sleep_us) \ - usleep_range((sleep_us >> 2) + 1, sleep_us); \ + usleep_range(((sleep_us) >> 2) + 1, sleep_us); \ } \ - pollret ?: ((cond) ? 0 : -ETIMEDOUT); \ + __ret ?: ((cond) ? 0 : -ETIMEDOUT); \ }) #ifdef CONFIG_REGMAP -- 2.12.2
[PATCH v3 1/2] iopoll: Avoid namespace collision within macros & tidy up
Renamed variable "timeout" to "__timeout" to avoid namespace collision. Tidy up macro arguments with parentheses. Signed-off-by: Ramesh Shanmugasundaram --- include/linux/iopoll.h | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h index d29e1e21bf3f..e000172bee54 100644 --- a/include/linux/iopoll.h +++ b/include/linux/iopoll.h @@ -42,18 +42,19 @@ */ #define readx_poll_timeout(op, addr, val, cond, sleep_us, timeout_us) \ ({ \ - ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \ + ktime_t __timeout = ktime_add_us(ktime_get(), timeout_us); \ might_sleep_if(sleep_us); \ for (;;) { \ (val) = op(addr); \ if (cond) \ break; \ - if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \ + if ((timeout_us) && \ + ktime_compare(ktime_get(), __timeout) > 0) { \ (val) = op(addr); \ break; \ } \ if (sleep_us) \ - usleep_range((sleep_us >> 2) + 1, sleep_us); \ + usleep_range(((sleep_us) >> 2) + 1, sleep_us); \ } \ (cond) ? 0 : -ETIMEDOUT; \ }) @@ -77,12 +78,13 @@ */ #define readx_poll_timeout_atomic(op, addr, val, cond, delay_us, timeout_us) \ ({ \ - ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \ + ktime_t __timeout = ktime_add_us(ktime_get(), timeout_us); \ for (;;) { \ (val) = op(addr); \ if (cond) \ break; \ - if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \ + if ((timeout_us) && \ + ktime_compare(ktime_get(), __timeout) > 0) { \ (val) = op(addr); \ break; \ } \ -- 2.12.2
[PATCH v3 0/2] Avoid namespace collision within macros & tidy up
Hi Mark, The readx_poll_timeout & similar macros defines local variable that can cause name space collision with the caller. Fixed this issue by prefixing them with underscores. Also tidied couple of instances where the macro arguments are used in expressions without parentheses. This patchset is based on top of today's linux-next repo. commit b18ea5c46031 ("Add linux-next specific files for 20170703") Change history: v3: - Rebased - Corrected parentheses spelling v2: - iopoll.h: - Enclosed timeout_us & sleep_us arguments with parentheses - regmap.h: - Enclosed timeout_us & sleep_us arguments with parentheses - Renamed pollret to __ret Note: timeout_us causes a spare check warning as identified here [1]. [1] https://www.mail-archive.com/linux-renesas-soc@vger.kernel.org/msg15138.html Thanks, Ramesh Ramesh Shanmugasundaram (2): iopoll: Avoid namespace collision within macros & tidy up regmap: Avoid namespace collision within macro & tidy up include/linux/iopoll.h | 12 +++- include/linux/regmap.h | 17 + 2 files changed, 16 insertions(+), 13 deletions(-) -- 2.12.2
RE: [PATCH v2 1/2] iopoll: Avoid namespace collision within macros & tidyup
Hi Geert, Thanks for the review. Replying to the thread to update what we discussed in IRC sometime back. > On Tue, Jun 13, 2017 at 3:33 PM, Ramesh Shanmugasundaram > wrote: > > Renamed variable "timeout" to "__timeout" to avoid namespace collision. > > Tidy up macro arguments with paranthesis. > > > > Signed-off-by: Ramesh Shanmugasundaram > > > > Thanks for your patches! > > > --- a/include/linux/iopoll.h > > +++ b/include/linux/iopoll.h > > @@ -42,18 +42,19 @@ > > */ > > #define readx_poll_timeout(op, addr, val, cond, sleep_us, timeout_us) > > \ ({ \ > > - ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \ > > + ktime_t __timeout = ktime_add_us(ktime_get(), timeout_us); \ > > I think timeout_us should be within parentheses, too. It is not required as it is passed as an function (ktime_add_us) argument. > > > might_sleep_if(sleep_us); \ > > for (;;) { \ > > (val) = op(addr); \ > > if (cond) \ > > break; \ > > - if (timeout_us && ktime_compare(ktime_get(), timeout) > > 0) { \ > > + if ((timeout_us) && \ > > + ktime_compare(ktime_get(), __timeout) > 0) { \ > > (val) = op(addr); \ > > break; \ > > } \ > > if (sleep_us) \ > > - usleep_range((sleep_us >> 2) + 1, sleep_us); \ > > + usleep_range(((sleep_us) >> 2) + 1, sleep_us); > > + \ > > Same for sleep_us. > > Also in readx_poll_timeout_atomic(), and in your second patch. Same as the above comment. Thanks, Ramesh
RE: [PATCH] arm64: dts: r8a7796: Add DRIF support
Hi Simon, > Subject: Re: [PATCH] arm64: dts: r8a7796: Add DRIF support > > On Tue, Jun 27, 2017 at 01:54:38PM +0100, Ramesh Shanmugasundaram wrote: > > Adds the DRIF controller nodes for r8a7796. > > > > Signed-off-by: Ramesh Shanmugasundaram > > > > --- > > Hi Simon, > > > >This patch is based on renesas-devel-20170626-v4.12-rc7 tag. > >It is verified on M3 ES1.0. I also verified there are no regression > issues > >with this addition. > > > >The driver[1] is pushed into the media_tree. The bindings[2] are > ACK'ed > >by Geert & Rob and in the media_tree queue. > > > >[1] > https://git.linuxtv.org/media_tree.git/commit/?id=7625ee981af166ddb569e2e6 > c0006e2af471326f > >[2] > > https://www.mail-archive.com/linux-renesas-soc@vger.kernel.org/msg1560 > > 2.html > > > > Thanks, > > Ramesh. > > > > arch/arm64/boot/dts/renesas/r8a7796.dtsi | 120 > > +++ > > 1 file changed, 120 insertions(+) > > > > diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi > > b/arch/arm64/boot/dts/renesas/r8a7796.dtsi > > index 1f6710912045..df04d132a127 100644 > > --- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi > > +++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi > > @@ -639,6 +639,126 @@ > > }; > > }; > > > > + drif00: rif@e6f4 { > > + compatible = "renesas,r8a7796-drif", > > +"renesas,rcar-gen3-drif"; > > + reg = <0 0xe6f4 0 0x64>; > > + interrupts = ; > > + clocks = <&cpg CPG_MOD 515>; > > + clock-names = "fck"; > > + dmas = <&dmac1 0x20>, <&dmac2 0x20>; > > The dmas property seems a little strange. I would have expected to allow > ether dmac1 or dmac2 to be used for both tx and rx: > > dmas = <&dmac1 0x20>, <&dmac1 0x20>, > <&dmac2 0x20>, <&dmac2 0x20>; > It is an rx-only interface that can use either dmac1 or 2. > > > + dma-names = "rx", "rx"; > > + power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; > > + resets = <&cpg 515>; > > + renesas,bonding = <&drif01>; > > + status = "disabled"; > > + }; > Thanks, Ramesh
[PATCH] arm64: dts: r8a7796: Add DRIF support
Adds the DRIF controller nodes for r8a7796. Signed-off-by: Ramesh Shanmugasundaram --- Hi Simon, This patch is based on renesas-devel-20170626-v4.12-rc7 tag. It is verified on M3 ES1.0. I also verified there are no regression issues with this addition. The driver[1] is pushed into the media_tree. The bindings[2] are ACK'ed by Geert & Rob and in the media_tree queue. [1] https://git.linuxtv.org/media_tree.git/commit/?id=7625ee981af166ddb569e2e6c0006e2af471326f [2] https://www.mail-archive.com/linux-renesas-soc@vger.kernel.org/msg15602.html Thanks, Ramesh. arch/arm64/boot/dts/renesas/r8a7796.dtsi | 120 +++ 1 file changed, 120 insertions(+) diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi b/arch/arm64/boot/dts/renesas/r8a7796.dtsi index 1f6710912045..df04d132a127 100644 --- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi @@ -639,6 +639,126 @@ }; }; + drif00: rif@e6f4 { + compatible = "renesas,r8a7796-drif", +"renesas,rcar-gen3-drif"; + reg = <0 0xe6f4 0 0x64>; + interrupts = ; + clocks = <&cpg CPG_MOD 515>; + clock-names = "fck"; + dmas = <&dmac1 0x20>, <&dmac2 0x20>; + dma-names = "rx", "rx"; + power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; + resets = <&cpg 515>; + renesas,bonding = <&drif01>; + status = "disabled"; + }; + + drif01: rif@e6f5 { + compatible = "renesas,r8a7796-drif", +"renesas,rcar-gen3-drif"; + reg = <0 0xe6f5 0 0x64>; + interrupts = ; + clocks = <&cpg CPG_MOD 514>; + clock-names = "fck"; + dmas = <&dmac1 0x22>, <&dmac2 0x22>; + dma-names = "rx", "rx"; + power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; + resets = <&cpg 514>; + renesas,bonding = <&drif00>; + status = "disabled"; + }; + + drif10: rif@e6f6 { + compatible = "renesas,r8a7796-drif", +"renesas,rcar-gen3-drif"; + reg = <0 0xe6f6 0 0x64>; + interrupts = ; + clocks = <&cpg CPG_MOD 513>; + clock-names = "fck"; + dmas = <&dmac1 0x24>, <&dmac2 0x24>; + dma-names = "rx", "rx"; + power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; + resets = <&cpg 513>; + renesas,bonding = <&drif11>; + status = "disabled"; + }; + + drif11: rif@e6f7 { + compatible = "renesas,r8a7796-drif", +"renesas,rcar-gen3-drif"; + reg = <0 0xe6f7 0 0x64>; + interrupts = ; + clocks = <&cpg CPG_MOD 512>; + clock-names = "fck"; + dmas = <&dmac1 0x26>, <&dmac2 0x26>; + dma-names = "rx", "rx"; + power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; + resets = <&cpg 512>; + renesas,bonding = <&drif10>; + status = "disabled"; + }; + + drif20: rif@e6f8 { + compatible = "renesas,r8a7796-drif", +"renesas,rcar-gen3-drif"; + reg = <0 0xe6f8 0 0x64>; + interrupts = ; + clocks = <&cpg CPG_MOD 511>; + clock-names = "fck"; + dmas = <&dmac1 0x28>, <&dmac2 0x28>; + dma-names = "rx", "rx"; + power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; + resets = <&cpg 511>; +
RE: [PATCH] arm64: dts: r8a7795: Add DRIF support
Hi Simon, > Subject: Re: [PATCH] arm64: dts: r8a7795: Add DRIF support > > On Fri, Jun 23, 2017 at 10:13:20AM +0100, Ramesh Shanmugasundaram wrote: > > Adds the DRIF controller nodes for r8a7795. > > > > Signed-off-by: Ramesh Shanmugasundaram > > > > --- > > Hi Simon, > > > >This patch is based on renesas-devel-20170622-v4.12-rc6 tag. > >It is verified on both H3 ES1.1 and ES2.0 SoC revisions. > > > >The bindings[1] and the driver[2] were pushed into the media_tree. > > > >[1] > https://git.linuxtv.org/media_tree.git/commit/?id=54a707ea011601f06cc5ef7f > e6d0daac71ab0622 > >[2] > > https://git.linuxtv.org/media_tree.git/commit/?id=7625ee981af166ddb569 > > e2e6c0006e2af471326f > > > > Thanks. Has this been tested not to cause regressions when applied on top > of renesas-devel-20170622-v4.12-rc6 (without the driver > changes) ? Yes, I just tested it without the driver changes on top of renesas-devel-20170622-v4.12-rc6 and it works fine on both ES1.1 & 2.0s. Thanks, Ramesh
[PATCH] dt-bindings: media: Add r8a7796 DRIF bindings
Add r8a7796 DRIF bindings. Signed-off-by: Ramesh Shanmugasundaram --- Hi DT & Media maintainers, All, This patch adds DRIF bindings for R8A7796 SoC. It is based on media_tree - commit 76724b30f222 Thanks, Ramesh. Documentation/devicetree/bindings/media/renesas,drif.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/media/renesas,drif.txt b/Documentation/devicetree/bindings/media/renesas,drif.txt index 39516b94c28f..0d8974aa8b38 100644 --- a/Documentation/devicetree/bindings/media/renesas,drif.txt +++ b/Documentation/devicetree/bindings/media/renesas,drif.txt @@ -40,6 +40,7 @@ To summarize, Required properties of an internal channel: --- - compatible: "renesas,r8a7795-drif" if DRIF controller is a part of R8A7795 SoC. + "renesas,r8a7796-drif" if DRIF controller is a part of R8A7796 SoC. "renesas,rcar-gen3-drif" for a generic R-Car Gen3 compatible device. When compatible with the generic version, nodes must list the -- 2.12.2
[PATCH] arm64: dts: r8a7795: Add DRIF support
Adds the DRIF controller nodes for r8a7795. Signed-off-by: Ramesh Shanmugasundaram --- Hi Simon, This patch is based on renesas-devel-20170622-v4.12-rc6 tag. It is verified on both H3 ES1.1 and ES2.0 SoC revisions. The bindings[1] and the driver[2] were pushed into the media_tree. [1] https://git.linuxtv.org/media_tree.git/commit/?id=54a707ea011601f06cc5ef7fe6d0daac71ab0622 [2] https://git.linuxtv.org/media_tree.git/commit/?id=7625ee981af166ddb569e2e6c0006e2af471326f Thanks, Ramesh. arch/arm64/boot/dts/renesas/r8a7795.dtsi | 120 +++ 1 file changed, 120 insertions(+) diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi index e31c1b660b3f..24283ad057eb 100644 --- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi @@ -691,6 +691,126 @@ }; }; + drif00: rif@e6f4 { + compatible = "renesas,r8a7795-drif", +"renesas,rcar-gen3-drif"; + reg = <0 0xe6f4 0 0x64>; + interrupts = ; + clocks = <&cpg CPG_MOD 515>; + clock-names = "fck"; + dmas = <&dmac1 0x20>, <&dmac2 0x20>; + dma-names = "rx", "rx"; + power-domains = <&sysc R8A7795_PD_ALWAYS_ON>; + resets = <&cpg 515>; + renesas,bonding = <&drif01>; + status = "disabled"; + }; + + drif01: rif@e6f5 { + compatible = "renesas,r8a7795-drif", +"renesas,rcar-gen3-drif"; + reg = <0 0xe6f5 0 0x64>; + interrupts = ; + clocks = <&cpg CPG_MOD 514>; + clock-names = "fck"; + dmas = <&dmac1 0x22>, <&dmac2 0x22>; + dma-names = "rx", "rx"; + power-domains = <&sysc R8A7795_PD_ALWAYS_ON>; + resets = <&cpg 514>; + renesas,bonding = <&drif00>; + status = "disabled"; + }; + + drif10: rif@e6f6 { + compatible = "renesas,r8a7795-drif", +"renesas,rcar-gen3-drif"; + reg = <0 0xe6f6 0 0x64>; + interrupts = ; + clocks = <&cpg CPG_MOD 513>; + clock-names = "fck"; + dmas = <&dmac1 0x24>, <&dmac2 0x24>; + dma-names = "rx", "rx"; + power-domains = <&sysc R8A7795_PD_ALWAYS_ON>; + resets = <&cpg 513>; + renesas,bonding = <&drif11>; + status = "disabled"; + }; + + drif11: rif@e6f7 { + compatible = "renesas,r8a7795-drif", +"renesas,rcar-gen3-drif"; + reg = <0 0xe6f7 0 0x64>; + interrupts = ; + clocks = <&cpg CPG_MOD 512>; + clock-names = "fck"; + dmas = <&dmac1 0x26>, <&dmac2 0x26>; + dma-names = "rx", "rx"; + power-domains = <&sysc R8A7795_PD_ALWAYS_ON>; + resets = <&cpg 512>; + renesas,bonding = <&drif10>; + status = "disabled"; + }; + + drif20: rif@e6f8 { + compatible = "renesas,r8a7795-drif", +"renesas,rcar-gen3-drif"; + reg = <0 0xe6f8 0 0x64>; + interrupts = ; + clocks = <&cpg CPG_MOD 511>; + clock-names = "fck"; + dmas = <&dmac1 0x28>, <&dmac2 0x28>; + dma-names = "rx", "rx"; + power-domains = <&sysc R8A7795_PD_ALWAYS_ON>; + resets = <&cpg 511>; + renesas,bonding = <&drif21>; +
RE: [PATCH v2 0/2] Avoid namespace collision within macros & tidyup
> Subject: Re: [PATCH v2 0/2] Avoid namespace collision within macros & > tidyup > > On 13/06/17 14:33, Ramesh Shanmugasundaram wrote: > > Hi All, > > > > The readx_poll_timeout & similar macros defines local variable that > > can cause name space collision with the caller. Fixed this issue by > > prefixing them with underscores. > > The compound statement has a local variable scope, so these won't collide > with the caller I believe. But xxx_poll_timeout is a macro?? Usage regmap_read_poll_timeout(..., timeout) with variable name "timeout" in the caller results in include/linux/regmap.h:123:20: warning: 'timeout' is used uninitialized in this function [-Wuninitialized] ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \ > > > Also tidied couple of instances where the macro arguments are used in > > expressions without paranthesis. > > > > This patchset is based on top of today's linux-next repo. > > commit bc4c75f41a1c ("Add linux-next specific files for 20170613") > > > > Change history: > > > > v2: > > - iopoll.h: > > - Enclosed timeout_us & sleep_us arguments with paranthesis > > - regmap.h: > > - Enclosed timeout_us & sleep_us arguments with paranthesis > > - Renamed pollret to __ret > > > > Note: timeout_us cause spare check warning as identified here [1]. > > > > [1] > > https://www.mail-archive.com/linux-renesas-soc@vger.kernel.org/msg1513 > > 8.html > > > > Thanks, > > Ramesh > > > > Ramesh Shanmugasundaram (2): > >iopoll: Avoid namespace collision within macros & tidyup > >regmap: Avoid namespace collision within macro & tidyup > > > > include/linux/iopoll.h | 12 +++- > > include/linux/regmap.h | 17 + > > 2 files changed, 16 insertions(+), 13 deletions(-) > >
[PATCH v2 1/2] iopoll: Avoid namespace collision within macros & tidyup
Renamed variable "timeout" to "__timeout" to avoid namespace collision. Tidy up macro arguments with paranthesis. Signed-off-by: Ramesh Shanmugasundaram --- include/linux/iopoll.h | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h index d29e1e21bf3f..e000172bee54 100644 --- a/include/linux/iopoll.h +++ b/include/linux/iopoll.h @@ -42,18 +42,19 @@ */ #define readx_poll_timeout(op, addr, val, cond, sleep_us, timeout_us) \ ({ \ - ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \ + ktime_t __timeout = ktime_add_us(ktime_get(), timeout_us); \ might_sleep_if(sleep_us); \ for (;;) { \ (val) = op(addr); \ if (cond) \ break; \ - if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \ + if ((timeout_us) && \ + ktime_compare(ktime_get(), __timeout) > 0) { \ (val) = op(addr); \ break; \ } \ if (sleep_us) \ - usleep_range((sleep_us >> 2) + 1, sleep_us); \ + usleep_range(((sleep_us) >> 2) + 1, sleep_us); \ } \ (cond) ? 0 : -ETIMEDOUT; \ }) @@ -77,12 +78,13 @@ */ #define readx_poll_timeout_atomic(op, addr, val, cond, delay_us, timeout_us) \ ({ \ - ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \ + ktime_t __timeout = ktime_add_us(ktime_get(), timeout_us); \ for (;;) { \ (val) = op(addr); \ if (cond) \ break; \ - if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \ + if ((timeout_us) && \ + ktime_compare(ktime_get(), __timeout) > 0) { \ (val) = op(addr); \ break; \ } \ -- 2.12.2
[PATCH v2 2/2] regmap: Avoid namespace collision within macro & tidyup
Renamed variable "timeout" to "__timeout" & "pollret" to "__ret" to avoid namespace collision. Tidy up macro arguments with paranthesis. Signed-off-by: Ramesh Shanmugasundaram --- include/linux/regmap.h | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 86eeacc1425a..ebc7282abc80 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -120,23 +120,24 @@ struct reg_sequence { */ #define regmap_read_poll_timeout(map, addr, val, cond, sleep_us, timeout_us) \ ({ \ - ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \ - int pollret; \ + ktime_t __timeout = ktime_add_us(ktime_get(), timeout_us); \ + int __ret; \ might_sleep_if(sleep_us); \ for (;;) { \ - pollret = regmap_read((map), (addr), &(val)); \ - if (pollret) \ + __ret = regmap_read((map), (addr), &(val)); \ + if (__ret) \ break; \ if (cond) \ break; \ - if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \ - pollret = regmap_read((map), (addr), &(val)); \ + if ((timeout_us) && \ + ktime_compare(ktime_get(), __timeout) > 0) { \ + __ret = regmap_read((map), (addr), &(val)); \ break; \ } \ if (sleep_us) \ - usleep_range((sleep_us >> 2) + 1, sleep_us); \ + usleep_range(((sleep_us) >> 2) + 1, sleep_us); \ } \ - pollret ?: ((cond) ? 0 : -ETIMEDOUT); \ + __ret ?: ((cond) ? 0 : -ETIMEDOUT); \ }) #ifdef CONFIG_REGMAP -- 2.12.2
[PATCH v2 0/2] Avoid namespace collision within macros & tidyup
Hi All, The readx_poll_timeout & similar macros defines local variable that can cause name space collision with the caller. Fixed this issue by prefixing them with underscores. Also tidied couple of instances where the macro arguments are used in expressions without paranthesis. This patchset is based on top of today's linux-next repo. commit bc4c75f41a1c ("Add linux-next specific files for 20170613") Change history: v2: - iopoll.h: - Enclosed timeout_us & sleep_us arguments with paranthesis - regmap.h: - Enclosed timeout_us & sleep_us arguments with paranthesis - Renamed pollret to __ret Note: timeout_us cause spare check warning as identified here [1]. [1] https://www.mail-archive.com/linux-renesas-soc@vger.kernel.org/msg15138.html Thanks, Ramesh Ramesh Shanmugasundaram (2): iopoll: Avoid namespace collision within macros & tidyup regmap: Avoid namespace collision within macro & tidyup include/linux/iopoll.h | 12 +++- include/linux/regmap.h | 17 + 2 files changed, 16 insertions(+), 13 deletions(-) -- 2.12.2
[PATCH v10] media: i2c: max2175: Add MAX2175 support
This patch adds driver support for the MAX2175 chip. This is Maxim Integrated's RF to Bits tuner front end chip designed for software-defined radio solutions. This driver exposes the tuner as a sub-device instance with standard and custom controls to configure the device. Signed-off-by: Ramesh Shanmugasundaram --- Hi Hans, As discussed in #v4l, here is the v10 of this patch alone. Hi Geert, I changed the timeout interval to usecs and removed the work around comment. I will also be posting a patch fixing the regmap header. Thanks, Ramesh. v10: - On second thought, converted the msec timeout interval to usecs to avoid the comment & macro limitations. Refer #v4l (Hans) v9: - Work around to avoid a sparse warning generated because of regmap_read_poll_timeout macro implementation. v8: - Fixed smatch warnings in max2175_load_from_rom(). v7: - Made I2S enable/disable control as private (Mauro). v6: - Addressed Sakari's comments. They are: - Added uapi header file. - Added newline at the end of the function before return. - Cleaned up header file inclusion. - Used fwnode_ apis whereever applicable. - Cleaned up debug statements. - Removed separate dir for max2175. v5: - sck -> Sample clock is clarified in driver documentation (Hans) - "refout-load-pF" is renamed to "refout-load" as per updated bindings. --- Documentation/media/v4l-drivers/index.rst |1 + Documentation/media/v4l-drivers/max2175.rst | 62 ++ drivers/media/i2c/Kconfig | 12 + drivers/media/i2c/Makefile |2 + drivers/media/i2c/max2175.c | 1453 +++ drivers/media/i2c/max2175.h | 109 ++ include/uapi/linux/max2175.h| 28 + 7 files changed, 1667 insertions(+) create mode 100644 Documentation/media/v4l-drivers/max2175.rst create mode 100644 drivers/media/i2c/max2175.c create mode 100644 drivers/media/i2c/max2175.h create mode 100644 include/uapi/linux/max2175.h diff --git a/Documentation/media/v4l-drivers/index.rst b/Documentation/media/v4l-drivers/index.rst index 90fe22a6414a..2e24d6806052 100644 --- a/Documentation/media/v4l-drivers/index.rst +++ b/Documentation/media/v4l-drivers/index.rst @@ -42,6 +42,7 @@ For more details see the file COPYING in the source distribution of Linux. davinci-vpbe fimc ivtv + max2175 meye omap3isp omap4_camera diff --git a/Documentation/media/v4l-drivers/max2175.rst b/Documentation/media/v4l-drivers/max2175.rst new file mode 100644 index ..04478c25d57a --- /dev/null +++ b/Documentation/media/v4l-drivers/max2175.rst @@ -0,0 +1,62 @@ +Maxim Integrated MAX2175 RF to bits tuner driver + + +The MAX2175 driver implements the following driver-specific controls: + +``V4L2_CID_MAX2175_I2S_ENABLE`` +--- +Enable/Disable I2S output of the tuner. This is a private control +that can be accessed only using the subdev interface. +Refer to Documentation/media/kapi/v4l2-controls for more details. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``(0)`` + - I2S output is disabled. +* - ``(1)`` + - I2S output is enabled. + +``V4L2_CID_MAX2175_HSLS`` +- +The high-side/low-side (HSLS) control of the tuner for a given band. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``(0)`` + - The LO frequency position is below the desired frequency. +* - ``(1)`` + - The LO frequency position is above the desired frequency. + +``V4L2_CID_MAX2175_RX_MODE (menu)`` +--- +The Rx mode controls a number of preset parameters of the tuner like +sample clock (sck), sampling rate etc. These multiple settings are +provided under one single label called Rx mode in the datasheet. The +list below shows the supported modes with a brief description. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``"Europe modes"`` +* - ``"FM 1.2" (0)`` + - This configures FM band with a sample rate of 0.512 million +samples/sec with a 10.24 MHz sck. +* - ``"DAB 1.2" (1)`` + - This configures VHF band with a sample rate of 2.048 million +samples/sec with a 32.768 MHz sck. + +* - ``"North America modes"`` +* - ``"FM 1.0" (0)`` + - This configures FM band with a sample rate of 0.7441875 million +samples/sec with a 14.88375 MHz sck. +* - ``"DAB 1.2" (1)`` + - This configures FM band with a sample rate of 0.372 million +samples/sec with a 7.441875 MHz sck. diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kc
[PATCH v9] media: i2c: max2175: Add MAX2175 support
This patch adds driver support for the MAX2175 chip. This is Maxim Integrated's RF to Bits tuner front end chip designed for software-defined radio solutions. This driver exposes the tuner as a sub-device instance with standard and custom controls to configure the device. Signed-off-by: Ramesh Shanmugasundaram --- Hi Hans, As requested, here is the v9 of this patch alone implementing the work around to avoid the sparse warning. https://www.mail-archive.com/linux-renesas-soc@vger.kernel.org/msg15138.html For some reason, I could not reproduce this warning in my setup :-( Thanks, Ramesh. v9: - Work around to avoid a sparse warning generated because of regmap_read_poll_timeout macro implementation. v8: - Fixed smatch warnings in max2175_load_from_rom(). v7: - Made I2S enable/disable control as private (Mauro). v6: - Addressed Sakari's comments. They are: - Added uapi header file. - Added newline at the end of the function before return. - Cleaned up header file inclusion. - Used fwnode_ apis whereever applicable. - Cleaned up debug statements. - Removed separate dir for max2175. v5: - sck -> Sample clock is clarified in driver documentation (Hans) - "refout-load-pF" is renamed to "refout-load" as per updated bindings. --- Documentation/media/v4l-drivers/index.rst |1 + Documentation/media/v4l-drivers/max2175.rst | 62 ++ drivers/media/i2c/Kconfig | 12 + drivers/media/i2c/Makefile |2 + drivers/media/i2c/max2175.c | 1458 +++ drivers/media/i2c/max2175.h | 109 ++ include/uapi/linux/max2175.h| 28 + 7 files changed, 1672 insertions(+) create mode 100644 Documentation/media/v4l-drivers/max2175.rst create mode 100644 drivers/media/i2c/max2175.c create mode 100644 drivers/media/i2c/max2175.h create mode 100644 include/uapi/linux/max2175.h diff --git a/Documentation/media/v4l-drivers/index.rst b/Documentation/media/v4l-drivers/index.rst index 90fe22a6414a..2e24d6806052 100644 --- a/Documentation/media/v4l-drivers/index.rst +++ b/Documentation/media/v4l-drivers/index.rst @@ -42,6 +42,7 @@ For more details see the file COPYING in the source distribution of Linux. davinci-vpbe fimc ivtv + max2175 meye omap3isp omap4_camera diff --git a/Documentation/media/v4l-drivers/max2175.rst b/Documentation/media/v4l-drivers/max2175.rst new file mode 100644 index ..04478c25d57a --- /dev/null +++ b/Documentation/media/v4l-drivers/max2175.rst @@ -0,0 +1,62 @@ +Maxim Integrated MAX2175 RF to bits tuner driver + + +The MAX2175 driver implements the following driver-specific controls: + +``V4L2_CID_MAX2175_I2S_ENABLE`` +--- +Enable/Disable I2S output of the tuner. This is a private control +that can be accessed only using the subdev interface. +Refer to Documentation/media/kapi/v4l2-controls for more details. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``(0)`` + - I2S output is disabled. +* - ``(1)`` + - I2S output is enabled. + +``V4L2_CID_MAX2175_HSLS`` +- +The high-side/low-side (HSLS) control of the tuner for a given band. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``(0)`` + - The LO frequency position is below the desired frequency. +* - ``(1)`` + - The LO frequency position is above the desired frequency. + +``V4L2_CID_MAX2175_RX_MODE (menu)`` +--- +The Rx mode controls a number of preset parameters of the tuner like +sample clock (sck), sampling rate etc. These multiple settings are +provided under one single label called Rx mode in the datasheet. The +list below shows the supported modes with a brief description. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``"Europe modes"`` +* - ``"FM 1.2" (0)`` + - This configures FM band with a sample rate of 0.512 million +samples/sec with a 10.24 MHz sck. +* - ``"DAB 1.2" (1)`` + - This configures VHF band with a sample rate of 2.048 million +samples/sec with a 32.768 MHz sck. + +* - ``"North America modes"`` +* - ``"FM 1.0" (0)`` + - This configures FM band with a sample rate of 0.7441875 million +samples/sec with a 14.88375 MHz sck. +* - ``"DAB 1.2" (1)`` + - This configures FM band with a sample rate of 0.372 million +samples/sec with a 7.441875 MHz sck. diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index c380e2475c82..c0e6e78883b0 100644 --- a/drivers/media/i2c/Kconfig +++ b/dr
[PATCH v8 1/8] media: v4l2-ctrls: Reserve controls for MAX217X
Reserve controls for MAX217X RF to Bits tuner family. These hybrid radio receiver chips are highly programmable and hence reserving 32 controls. Signed-off-by: Ramesh Shanmugasundaram Acked-by: Laurent Pinchart --- include/uapi/linux/v4l2-controls.h | 5 + 1 file changed, 5 insertions(+) diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 0d2e1e01fbd5..83b28b41123f 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -180,6 +180,11 @@ enum v4l2_colorfx { * We reserve 16 controls for this driver. */ #define V4L2_CID_USER_TC358743_BASE(V4L2_CID_USER_BASE + 0x1080) +/* The base for the max217x driver controls. + * We reserve 32 controls for this driver + */ +#define V4L2_CID_USER_MAX217X_BASE (V4L2_CID_USER_BASE + 0x1090) + /* MPEG-class control IDs */ /* The MPEG controls are applicable to all codec controls * and the 'MPEG' part of the define is historical */ -- 2.12.2
[PATCH v8 4/8] media: Add new SDR formats PC16, PC18 & PC20
This patch adds support for the three new SDR formats. These formats were prefixed with "planar" indicating I & Q data are not interleaved as in other formats. Here, I & Q data constitutes the top half and bottom half of the received buffer respectively. V4L2_SDR_FMT_PCU16BE - 14-bit complex (I & Q) unsigned big-endian sample inside 16-bit. V4L2 FourCC: PC16 V4L2_SDR_FMT_PCU18BE - 16-bit complex (I & Q) unsigned big-endian sample inside 18-bit. V4L2 FourCC: PC18 V4L2_SDR_FMT_PCU20BE - 18-bit complex (I & Q) unsigned big-endian sample inside 20-bit. V4L2 FourCC: PC20 Signed-off-by: Ramesh Shanmugasundaram --- drivers/media/v4l2-core/v4l2-ioctl.c | 3 +++ include/uapi/linux/videodev2.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 4f27cfa134a1..ce40183d9daa 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1229,6 +1229,9 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_SDR_FMT_CS8: descr = "Complex S8"; break; case V4L2_SDR_FMT_CS14LE: descr = "Complex S14LE"; break; case V4L2_SDR_FMT_RU12LE: descr = "Real U12LE"; break; + case V4L2_SDR_FMT_PCU16BE: descr = "Planar Complex U16BE"; break; + case V4L2_SDR_FMT_PCU18BE: descr = "Planar Complex U18BE"; break; + case V4L2_SDR_FMT_PCU20BE: descr = "Planar Complex U20BE"; break; case V4L2_TCH_FMT_DELTA_TD16: descr = "16-bit signed deltas"; break; case V4L2_TCH_FMT_DELTA_TD08: descr = "8-bit signed deltas"; break; case V4L2_TCH_FMT_TU16: descr = "16-bit unsigned touch data"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 2b8feb86d09e..45cf7359822c 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -669,6 +669,9 @@ struct v4l2_pix_format { #define V4L2_SDR_FMT_CS8 v4l2_fourcc('C', 'S', '0', '8') /* complex s8 */ #define V4L2_SDR_FMT_CS14LE v4l2_fourcc('C', 'S', '1', '4') /* complex s14le */ #define V4L2_SDR_FMT_RU12LE v4l2_fourcc('R', 'U', '1', '2') /* real u12le */ +#define V4L2_SDR_FMT_PCU16BE v4l2_fourcc('P', 'C', '1', '6') /* planar complex u16be */ +#define V4L2_SDR_FMT_PCU18BE v4l2_fourcc('P', 'C', '1', '8') /* planar complex u18be */ +#define V4L2_SDR_FMT_PCU20BE v4l2_fourcc('P', 'C', '2', '0') /* planar complex u20be */ /* Touch formats - used for Touch devices */ #define V4L2_TCH_FMT_DELTA_TD16v4l2_fourcc('T', 'D', '1', '6') /* 16-bit signed deltas */ -- 2.12.2
[PATCH v8 7/8] media: platform: rcar_drif: Add DRIF support
This patch adds Digital Radio Interface (DRIF) support to R-Car Gen3 SoCs. The driver exposes each instance of DRIF as a V4L2 SDR device. A DRIF device represents a channel and each channel can have one or two sub-channels respectively depending on the target board. DRIF supports only Rx functionality. It receives samples from a RF frontend tuner chip it is interfaced with. The combination of DRIF and the tuner device, which is registered as a sub-device, determines the receive sample rate and format. In order to be compliant as a V4L2 SDR device, DRIF needs to bind with the tuner device, which can be provided by a third party vendor. DRIF acts as a slave device and the tuner device acts as a master transmitting the samples. The driver allows asynchronous binding of a tuner device that is registered as a v4l2 sub-device. The driver can learn about the tuner it is interfaced with based on port endpoint properties of the device in device tree. The V4L2 SDR device inherits the controls exposed by the tuner device. The device can also be configured to use either one or both of the data pins at runtime based on the master (tuner) configuration. Signed-off-by: Ramesh Shanmugasundaram --- v8: - Fixed smatch warnings in two places. v7: - Added COMPILE_TEST to rcar_drif (Hans added it in last pull request). v6: - Used fwnode_ apis wherever applicable. - Cleaned up debug prints. --- drivers/media/platform/Kconfig | 25 + drivers/media/platform/Makefile|1 + drivers/media/platform/rcar_drif.c | 1498 3 files changed, 1524 insertions(+) create mode 100644 drivers/media/platform/rcar_drif.c diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 288d3b0dc812..a2fc37d0d29e 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -538,3 +538,28 @@ config VIDEO_STI_HDMI_CEC between compatible devices. endif #CEC_PLATFORM_DRIVERS + +menuconfig SDR_PLATFORM_DRIVERS + bool "SDR platform devices" + depends on MEDIA_SDR_SUPPORT + default n + ---help--- + Say Y here to enable support for platform-specific SDR Drivers. + +if SDR_PLATFORM_DRIVERS + +config VIDEO_RCAR_DRIF + tristate "Renesas Digitial Radio Interface (DRIF)" + depends on VIDEO_V4L2 && HAS_DMA + depends on ARCH_RENESAS || COMPILE_TEST + select VIDEOBUF2_VMALLOC + ---help--- + Say Y if you want to enable R-Car Gen3 DRIF support. DRIF is Digital + Radio Interface that interfaces with an RF front end chip. It is a + receiver of digital data which uses DMA to transfer received data to + a configured location for an application to use. + + To compile this driver as a module, choose M here; the module + will be called rcar_drif. + +endif # SDR_PLATFORM_DRIVERS diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index c3588d570f5d..4cfbb9d0c6cf 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -52,6 +52,7 @@ obj-$(CONFIG_VIDEO_SH_VOU)+= sh_vou.o obj-$(CONFIG_SOC_CAMERA) += soc_camera/ +obj-$(CONFIG_VIDEO_RCAR_DRIF) += rcar_drif.o obj-$(CONFIG_VIDEO_RENESAS_FCP)+= rcar-fcp.o obj-$(CONFIG_VIDEO_RENESAS_FDP1) += rcar_fdp1.o obj-$(CONFIG_VIDEO_RENESAS_JPU)+= rcar_jpu.o diff --git a/drivers/media/platform/rcar_drif.c b/drivers/media/platform/rcar_drif.c new file mode 100644 index ..522364ff0d5d --- /dev/null +++ b/drivers/media/platform/rcar_drif.c @@ -0,0 +1,1498 @@ +/* + * R-Car Gen3 Digital Radio Interface (DRIF) driver + * + * Copyright (C) 2017 Renesas Electronics Corporation + * + * 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. + */ + +/* + * The R-Car DRIF is a receive only MSIOF like controller with an + * external master device driving the SCK. It receives data into a FIFO, + * then this driver uses the SYS-DMAC engine to move the data from + * the device to memory. + * + * Each DRIF channel DRIFx (as per datasheet) contains two internal + * channels DRIFx0 & DRIFx1 within itself with each having its own resources + * like module clk, register set, irq and dma. These internal channels share + * common CLK & SYNC from master. The two data pins D0 & D1 shall be + * considered to represent the two internal channels. This internal split + * is not visible to the master device. + * + * Depending on the maste
[PATCH v8 8/8] MAINTAINERS: Add entry for R-Car DRIF & MAX2175 drivers
Add maintainter entry for the R-Car DRIF and MAX2175 drivers. Signed-off-by: Ramesh Shanmugasundaram --- MAINTAINERS | 19 +++ 1 file changed, 19 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 053c3bdd1fe5..cfa78fe5142a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8031,6 +8031,16 @@ S: Maintained F: Documentation/hwmon/max20751 F: drivers/hwmon/max20751.c +MAX2175 SDR TUNER DRIVER +M: Ramesh Shanmugasundaram +L: linux-me...@vger.kernel.org +T: git git://linuxtv.org/media_tree.git +S: Maintained +F: Documentation/devicetree/bindings/media/i2c/max2175.txt +F: Documentation/media/v4l-drivers/max2175.rst +F: drivers/media/i2c/max2175* +F: include/uapi/linux/max2175.h + MAX6650 HARDWARE MONITOR AND FAN CONTROLLER DRIVER L: linux-hw...@vger.kernel.org S: Orphan @@ -8111,6 +8121,15 @@ L: linux-...@vger.kernel.org S: Maintained F: drivers/iio/dac/cio-dac.c +MEDIA DRIVERS FOR RENESAS - DRIF +M: Ramesh Shanmugasundaram +L: linux-me...@vger.kernel.org +L: linux-renesas-soc@vger.kernel.org +T: git git://linuxtv.org/media_tree.git +S: Supported +F: Documentation/devicetree/bindings/media/renesas,drif.txt +F: drivers/media/platform/rcar_drif.c + MEDIA DRIVERS FOR RENESAS - FCP M: Laurent Pinchart L: linux-me...@vger.kernel.org -- 2.12.2
[PATCH v8 3/8] media: i2c: max2175: Add MAX2175 support
This patch adds driver support for the MAX2175 chip. This is Maxim Integrated's RF to Bits tuner front end chip designed for software-defined radio solutions. This driver exposes the tuner as a sub-device instance with standard and custom controls to configure the device. Signed-off-by: Ramesh Shanmugasundaram --- v8: - Fixed smatch warnings in max2175_load_from_rom(). v7: - Made I2S enable/disable control as private (Mauro). v6: - Addressed Sakari's comments. They are: - Added uapi header file. - Added newline at the end of the function before return. - Cleaned up header file inclusion. - Used fwnode_ apis whereever applicable. - Cleaned up debug statements. - Removed separate dir for max2175. v5: - sck -> Sample clock is clarified in driver documentation (Hans) - "refout-load-pF" is renamed to "refout-load" as per updated bindings. --- Documentation/media/v4l-drivers/index.rst |1 + Documentation/media/v4l-drivers/max2175.rst | 62 ++ drivers/media/i2c/Kconfig | 12 + drivers/media/i2c/Makefile |2 + drivers/media/i2c/max2175.c | 1453 +++ drivers/media/i2c/max2175.h | 109 ++ include/uapi/linux/max2175.h| 28 + 7 files changed, 1667 insertions(+) create mode 100644 Documentation/media/v4l-drivers/max2175.rst create mode 100644 drivers/media/i2c/max2175.c create mode 100644 drivers/media/i2c/max2175.h create mode 100644 include/uapi/linux/max2175.h diff --git a/Documentation/media/v4l-drivers/index.rst b/Documentation/media/v4l-drivers/index.rst index 90fe22a6414a..2e24d6806052 100644 --- a/Documentation/media/v4l-drivers/index.rst +++ b/Documentation/media/v4l-drivers/index.rst @@ -42,6 +42,7 @@ For more details see the file COPYING in the source distribution of Linux. davinci-vpbe fimc ivtv + max2175 meye omap3isp omap4_camera diff --git a/Documentation/media/v4l-drivers/max2175.rst b/Documentation/media/v4l-drivers/max2175.rst new file mode 100644 index ..04478c25d57a --- /dev/null +++ b/Documentation/media/v4l-drivers/max2175.rst @@ -0,0 +1,62 @@ +Maxim Integrated MAX2175 RF to bits tuner driver + + +The MAX2175 driver implements the following driver-specific controls: + +``V4L2_CID_MAX2175_I2S_ENABLE`` +--- +Enable/Disable I2S output of the tuner. This is a private control +that can be accessed only using the subdev interface. +Refer to Documentation/media/kapi/v4l2-controls for more details. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``(0)`` + - I2S output is disabled. +* - ``(1)`` + - I2S output is enabled. + +``V4L2_CID_MAX2175_HSLS`` +- +The high-side/low-side (HSLS) control of the tuner for a given band. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``(0)`` + - The LO frequency position is below the desired frequency. +* - ``(1)`` + - The LO frequency position is above the desired frequency. + +``V4L2_CID_MAX2175_RX_MODE (menu)`` +--- +The Rx mode controls a number of preset parameters of the tuner like +sample clock (sck), sampling rate etc. These multiple settings are +provided under one single label called Rx mode in the datasheet. The +list below shows the supported modes with a brief description. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``"Europe modes"`` +* - ``"FM 1.2" (0)`` + - This configures FM band with a sample rate of 0.512 million +samples/sec with a 10.24 MHz sck. +* - ``"DAB 1.2" (1)`` + - This configures VHF band with a sample rate of 2.048 million +samples/sec with a 32.768 MHz sck. + +* - ``"North America modes"`` +* - ``"FM 1.0" (0)`` + - This configures FM band with a sample rate of 0.7441875 million +samples/sec with a 14.88375 MHz sck. +* - ``"DAB 1.2" (1)`` + - This configures FM band with a sample rate of 0.372 million +samples/sec with a 7.441875 MHz sck. diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index c380e2475c82..c0e6e78883b0 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -796,6 +796,18 @@ config VIDEO_SAA6752HS To compile this driver as a module, choose M here: the module will be called saa6752hs. +comment "SDR tuner chips" + +config SDR_MAX2175 + tristate "Maxim 2175 RF to Bits tuner" + depends on VIDEO_V4L2 && MEDIA_SDR_SUPPORT && I2C + ---help--- + Support for
[PATCH v8 5/8] doc_rst: media: New SDR formats PC16, PC18 & PC20
This patch adds documentation for the three new SDR formats V4L2_SDR_FMT_PCU16BE V4L2_SDR_FMT_PCU18BE V4L2_SDR_FMT_PCU20BE Signed-off-by: Ramesh Shanmugasundaram --- .../media/uapi/v4l/pixfmt-sdr-pcu16be.rst | 55 ++ .../media/uapi/v4l/pixfmt-sdr-pcu18be.rst | 55 ++ .../media/uapi/v4l/pixfmt-sdr-pcu20be.rst | 54 + Documentation/media/uapi/v4l/sdr-formats.rst | 3 ++ 4 files changed, 167 insertions(+) create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst new file mode 100644 index ..2de1b1a0f517 --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst @@ -0,0 +1,55 @@ +.. -*- coding: utf-8; mode: rst -*- + +.. _V4L2-SDR-FMT-PCU16BE: + +** +V4L2_SDR_FMT_PCU16BE ('PC16') +** + +Planar complex unsigned 16-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadrature (IQ). Both I +and Q are represented as a 16 bit unsigned big endian number stored in +32 bit space. The remaining unused bits within the 32 bit space will be +padded with 0. I value starts first and Q value starts at an offset +equalling half of the buffer size (i.e.) offset = buffersize/2. Out of +the 16 bits, bit 15:2 (14 bit) is data and bit 1:0 (2 bit) can be any +value. + +**Byte Order.** +Each cell is one byte. + +.. flat-table:: +:header-rows: 1 +:stub-columns: 0 + +* - Offset: + - Byte B0 + - Byte B1 + - Byte B2 + - Byte B3 +* - start + 0: + - I'\ :sub:`0[13:6]` + - I'\ :sub:`0[5:0]; B1[1:0]=pad` + - pad + - pad +* - start + 4: + - I'\ :sub:`1[13:6]` + - I'\ :sub:`1[5:0]; B1[1:0]=pad` + - pad + - pad +* - ... +* - start + offset: + - Q'\ :sub:`0[13:6]` + - Q'\ :sub:`0[5:0]; B1[1:0]=pad` + - pad + - pad +* - start + offset + 4: + - Q'\ :sub:`1[13:6]` + - Q'\ :sub:`1[5:0]; B1[1:0]=pad` + - pad + - pad diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst new file mode 100644 index ..da8b26bf6b95 --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst @@ -0,0 +1,55 @@ +.. -*- coding: utf-8; mode: rst -*- + +.. _V4L2-SDR-FMT-PCU18BE: + +** +V4L2_SDR_FMT_PCU18BE ('PC18') +** + +Planar complex unsigned 18-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadrature (IQ). Both I +and Q are represented as a 18 bit unsigned big endian number stored in +32 bit space. The remaining unused bits within the 32 bit space will be +padded with 0. I value starts first and Q value starts at an offset +equalling half of the buffer size (i.e.) offset = buffersize/2. Out of +the 18 bits, bit 17:2 (16 bit) is data and bit 1:0 (2 bit) can be any +value. + +**Byte Order.** +Each cell is one byte. + +.. flat-table:: +:header-rows: 1 +:stub-columns: 0 + +* - Offset: + - Byte B0 + - Byte B1 + - Byte B2 + - Byte B3 +* - start + 0: + - I'\ :sub:`0[17:10]` + - I'\ :sub:`0[9:2]` + - I'\ :sub:`0[1:0]; B2[5:0]=pad` + - pad +* - start + 4: + - I'\ :sub:`1[17:10]` + - I'\ :sub:`1[9:2]` + - I'\ :sub:`1[1:0]; B2[5:0]=pad` + - pad +* - ... +* - start + offset: + - Q'\ :sub:`0[17:10]` + - Q'\ :sub:`0[9:2]` + - Q'\ :sub:`0[1:0]; B2[5:0]=pad` + - pad +* - start + offset + 4: + - Q'\ :sub:`1[17:10]` + - Q'\ :sub:`1[9:2]` + - Q'\ :sub:`1[1:0]; B2[5:0]=pad` + - pad diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst new file mode 100644 index ..5499eed39477 --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst @@ -0,0 +1,54 @@ +.. -*- coding: utf-8; mode: rst -*- +.. _V4L2-SDR-FMT-PCU20BE: + +** +V4L2_SDR_FMT_PCU20BE ('PC20') +** + +Planar complex unsigned 20-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadra
[PATCH v8 0/8] Add V4L2 SDR (DRIF & MAX2175) driver
RY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported) Buffer ioctls: test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test VIDIOC_EXPBUF: OK (Not Supported) Test input 0: Total: 43, Succeeded: 43, Failed: 0, Warnings: 0 root@salvator-x:~# [2] "bonding" DT property discussion (https://www.mail-archive.com/linux-renesas-soc@vger.kernel.org/msg09415.html) Ramesh Shanmugasundaram (8): media: v4l2-ctrls: Reserve controls for MAX217X dt-bindings: media: Add MAX2175 binding description media: i2c: max2175: Add MAX2175 support media: Add new SDR formats PC16, PC18 & PC20 doc_rst: media: New SDR formats PC16, PC18 & PC20 dt-bindings: media: Add Renesas R-Car DRIF binding media: platform: rcar_drif: Add DRIF support MAINTAINERS: Add entry for R-Car DRIF & MAX2175 drivers .../devicetree/bindings/media/i2c/max2175.txt | 59 + .../devicetree/bindings/media/renesas,drif.txt | 176 +++ .../devicetree/bindings/property-units.txt |1 + .../media/uapi/v4l/pixfmt-sdr-pcu16be.rst | 55 + .../media/uapi/v4l/pixfmt-sdr-pcu18be.rst | 55 + .../media/uapi/v4l/pixfmt-sdr-pcu20be.rst | 54 + Documentation/media/uapi/v4l/sdr-formats.rst |3 + Documentation/media/v4l-drivers/index.rst |1 + Documentation/media/v4l-drivers/max2175.rst| 62 + MAINTAINERS| 19 + drivers/media/i2c/Kconfig | 12 + drivers/media/i2c/Makefile |2 + drivers/media/i2c/max2175.c| 1453 +++ drivers/media/i2c/max2175.h| 109 ++ drivers/media/platform/Kconfig | 25 + drivers/media/platform/Makefile|1 + drivers/media/platform/rcar_drif.c | 1498 drivers/media/v4l2-core/v4l2-ioctl.c |3 + include/uapi/linux/max2175.h | 28 + include/uapi/linux/v4l2-controls.h |5 + include/uapi/linux/videodev2.h |3 + 21 files changed, 3624 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/max2175.txt create mode 100644 Documentation/devicetree/bindings/media/renesas,drif.txt create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst create mode 100644 Documentation/media/v4l-drivers/max2175.rst create mode 100644 drivers/media/i2c/max2175.c create mode 100644 drivers/media/i2c/max2175.h create mode 100644 drivers/media/platform/rcar_drif.c create mode 100644 include/uapi/linux/max2175.h -- 2.12.2
[PATCH v8 6/8] dt-bindings: media: Add Renesas R-Car DRIF binding
Add binding documentation for Renesas R-Car Digital Radio Interface (DRIF) controller. Signed-off-by: Ramesh Shanmugasundaram Acked-by: Rob Herring --- .../devicetree/bindings/media/renesas,drif.txt | 176 + 1 file changed, 176 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/renesas,drif.txt diff --git a/Documentation/devicetree/bindings/media/renesas,drif.txt b/Documentation/devicetree/bindings/media/renesas,drif.txt new file mode 100644 index ..39516b94c28f --- /dev/null +++ b/Documentation/devicetree/bindings/media/renesas,drif.txt @@ -0,0 +1,176 @@ +Renesas R-Car Gen3 Digital Radio Interface controller (DRIF) + + +R-Car Gen3 DRIF is a SPI like receive only slave device. A general +representation of DRIF interfacing with a master device is shown below. + ++-++-+ +| |-SCK--->|CLK | +| Master|-SS>|SYNC DRIFn (slave) | +| |-SD0--->|D0 | +| |-SD1--->|D1 | ++-++-+ + +As per datasheet, each DRIF channel (drifn) is made up of two internal +channels (drifn0 & drifn1). These two internal channels share the common +CLK & SYNC. Each internal channel has its own dedicated resources like +irq, dma channels, address space & clock. This internal split is not +visible to the external master device. + +The device tree model represents each internal channel as a separate node. +The internal channels sharing the CLK & SYNC are tied together by their +phandles using a property called "renesas,bonding". For the rest of +the documentation, unless explicitly stated, the word channel implies an +internal channel. + +When both internal channels are enabled they need to be managed together +as one (i.e.) they cannot operate alone as independent devices. Out of the +two, one of them needs to act as a primary device that accepts common +properties of both the internal channels. This channel is identified by a +property called "renesas,primary-bond". + +To summarize, + - When both the internal channels that are bonded together are enabled, + the zeroth channel is selected as primary-bond. This channels accepts + properties common to all the members of the bond. + - When only one of the bonded channels need to be enabled, the property + "renesas,bonding" or "renesas,primary-bond" will have no effect. That + enabled channel can act alone as any other independent device. + +Required properties of an internal channel: +--- +- compatible: "renesas,r8a7795-drif" if DRIF controller is a part of R8A7795 SoC. + "renesas,rcar-gen3-drif" for a generic R-Car Gen3 compatible device. + + When compatible with the generic version, nodes must list the + SoC-specific version corresponding to the platform first + followed by the generic version. + +- reg: offset and length of that channel. +- interrupts: associated with that channel. +- clocks: phandle and clock specifier of that channel. +- clock-names: clock input name string: "fck". +- dmas: phandles to the DMA channels. +- dma-names: names of the DMA channel: "rx". +- renesas,bonding: phandle to the other channel. + +Optional properties of an internal channel: +--- +- power-domains: phandle to the respective power domain. + +Required properties of an internal channel when: + - It is the only enabled channel of the bond (or) + - If it acts as primary among enabled bonds + +- pinctrl-0: pin control group to be used for this channel. +- pinctrl-names: must be "default". +- renesas,primary-bond: empty property indicating the channel acts as primary + among the bonded channels. +- port: child port node corresponding to the data input, in accordance with + the video interface bindings defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. The port + node must contain at least one endpoint. + +Optional endpoint property: +--- +- sync-active: Indicates sync signal polarity, 0/1 for low/high respectively. + This property maps to SYNCAC bit in the hardware manual. The + default is 1 (active high). + +Example: + + +(1) Both internal channels enabled: +--- + +When interfacing with a third party tuner device with two data pins as shown +below. + ++-++-+ +|
[PATCH v8 2/8] dt-bindings: media: Add MAX2175 binding description
Add device tree binding documentation for MAX2175 RF to bits tuner device. Signed-off-by: Ramesh Shanmugasundaram Acked-by: Rob Herring --- .../devicetree/bindings/media/i2c/max2175.txt | 59 ++ .../devicetree/bindings/property-units.txt | 1 + 2 files changed, 60 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/max2175.txt diff --git a/Documentation/devicetree/bindings/media/i2c/max2175.txt b/Documentation/devicetree/bindings/media/i2c/max2175.txt new file mode 100644 index ..02b4e9cd7b1b --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/max2175.txt @@ -0,0 +1,59 @@ +Maxim Integrated MAX2175 RF to Bits tuner +- + +The MAX2175 IC is an advanced analog/digital hybrid-radio receiver with +RF to Bits® front-end designed for software-defined radio solutions. + +Required properties: + +- compatible: "maxim,max2175" for MAX2175 RF-to-bits tuner. +- clocks: clock specifier. +- port: child port node corresponding to the I2S output, in accordance with + the video interface bindings defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. The port + node must contain at least one endpoint. + +Optional properties: + +- maxim,master : phandle to the master tuner if it is a slave. This + is used to define two tuners in diversity mode + (1 master, 1 slave). By default each tuner is an + individual master. +- maxim,refout-load : load capacitance value (in picofarads) on reference + output drive level. The possible load values are: +0 (default - refout disabled) + 10 + 20 + 30 + 40 + 60 + 70 +- maxim,am-hiz-filter : empty property indicates the AM Hi-Z filter is used + in this hardware for AM antenna input. + +Example: + + +Board specific DTS file + +/* Fixed XTAL clock node */ +maxim_xtal: clock { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <36864000>; +}; + +/* A tuner device instance under i2c bus */ +max2175_0: tuner@60 { + compatible = "maxim,max2175"; + reg = <0x60>; + clocks = <&maxim_xtal>; + maxim,refout-load = <10>; + + port { + max2175_0_ep: endpoint { + remote-endpoint = <&slave_rx_device>; + }; + }; + +}; diff --git a/Documentation/devicetree/bindings/property-units.txt b/Documentation/devicetree/bindings/property-units.txt index 12278d79f6c0..7c9f6ee918f1 100644 --- a/Documentation/devicetree/bindings/property-units.txt +++ b/Documentation/devicetree/bindings/property-units.txt @@ -28,6 +28,7 @@ Electricity -ohms : Ohms -micro-ohms: micro Ohms -microvolt : micro volts +-picofarads: picofarads Temperature -- 2.12.2
[PATCH] MAINTAINERS: Add entry for R-Car DRIF & MAX2175 drivers
Add maintainter entry for the R-Car DRIF and MAX2175 drivers. Signed-off-by: Ramesh Shanmugasundaram --- Hi Hans, Added the missing MAINTAINTERS entry on top of this (https://www.mail-archive.com/linux-renesas-soc@vger.kernel.org/msg15081.html) series as requested. Thanks, Ramesh. --- MAINTAINERS | 19 +++ 1 file changed, 19 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 053c3bdd1fe5..cfa78fe5142a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8031,6 +8031,16 @@ S: Maintained F: Documentation/hwmon/max20751 F: drivers/hwmon/max20751.c +MAX2175 SDR TUNER DRIVER +M: Ramesh Shanmugasundaram +L: linux-me...@vger.kernel.org +T: git git://linuxtv.org/media_tree.git +S: Maintained +F: Documentation/devicetree/bindings/media/i2c/max2175.txt +F: Documentation/media/v4l-drivers/max2175.rst +F: drivers/media/i2c/max2175* +F: include/uapi/linux/max2175.h + MAX6650 HARDWARE MONITOR AND FAN CONTROLLER DRIVER L: linux-hw...@vger.kernel.org S: Orphan @@ -8111,6 +8121,15 @@ L: linux-...@vger.kernel.org S: Maintained F: drivers/iio/dac/cio-dac.c +MEDIA DRIVERS FOR RENESAS - DRIF +M: Ramesh Shanmugasundaram +L: linux-me...@vger.kernel.org +L: linux-renesas-soc@vger.kernel.org +T: git git://linuxtv.org/media_tree.git +S: Supported +F: Documentation/devicetree/bindings/media/renesas,drif.txt +F: drivers/media/platform/rcar_drif.c + MEDIA DRIVERS FOR RENESAS - FCP M: Laurent Pinchart L: linux-me...@vger.kernel.org -- 2.12.2
[PATCH v7 6/7] dt-bindings: media: Add Renesas R-Car DRIF binding
Add binding documentation for Renesas R-Car Digital Radio Interface (DRIF) controller. Signed-off-by: Ramesh Shanmugasundaram Acked-by: Rob Herring --- .../devicetree/bindings/media/renesas,drif.txt | 176 + 1 file changed, 176 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/renesas,drif.txt diff --git a/Documentation/devicetree/bindings/media/renesas,drif.txt b/Documentation/devicetree/bindings/media/renesas,drif.txt new file mode 100644 index ..39516b94c28f --- /dev/null +++ b/Documentation/devicetree/bindings/media/renesas,drif.txt @@ -0,0 +1,176 @@ +Renesas R-Car Gen3 Digital Radio Interface controller (DRIF) + + +R-Car Gen3 DRIF is a SPI like receive only slave device. A general +representation of DRIF interfacing with a master device is shown below. + ++-++-+ +| |-SCK--->|CLK | +| Master|-SS>|SYNC DRIFn (slave) | +| |-SD0--->|D0 | +| |-SD1--->|D1 | ++-++-+ + +As per datasheet, each DRIF channel (drifn) is made up of two internal +channels (drifn0 & drifn1). These two internal channels share the common +CLK & SYNC. Each internal channel has its own dedicated resources like +irq, dma channels, address space & clock. This internal split is not +visible to the external master device. + +The device tree model represents each internal channel as a separate node. +The internal channels sharing the CLK & SYNC are tied together by their +phandles using a property called "renesas,bonding". For the rest of +the documentation, unless explicitly stated, the word channel implies an +internal channel. + +When both internal channels are enabled they need to be managed together +as one (i.e.) they cannot operate alone as independent devices. Out of the +two, one of them needs to act as a primary device that accepts common +properties of both the internal channels. This channel is identified by a +property called "renesas,primary-bond". + +To summarize, + - When both the internal channels that are bonded together are enabled, + the zeroth channel is selected as primary-bond. This channels accepts + properties common to all the members of the bond. + - When only one of the bonded channels need to be enabled, the property + "renesas,bonding" or "renesas,primary-bond" will have no effect. That + enabled channel can act alone as any other independent device. + +Required properties of an internal channel: +--- +- compatible: "renesas,r8a7795-drif" if DRIF controller is a part of R8A7795 SoC. + "renesas,rcar-gen3-drif" for a generic R-Car Gen3 compatible device. + + When compatible with the generic version, nodes must list the + SoC-specific version corresponding to the platform first + followed by the generic version. + +- reg: offset and length of that channel. +- interrupts: associated with that channel. +- clocks: phandle and clock specifier of that channel. +- clock-names: clock input name string: "fck". +- dmas: phandles to the DMA channels. +- dma-names: names of the DMA channel: "rx". +- renesas,bonding: phandle to the other channel. + +Optional properties of an internal channel: +--- +- power-domains: phandle to the respective power domain. + +Required properties of an internal channel when: + - It is the only enabled channel of the bond (or) + - If it acts as primary among enabled bonds + +- pinctrl-0: pin control group to be used for this channel. +- pinctrl-names: must be "default". +- renesas,primary-bond: empty property indicating the channel acts as primary + among the bonded channels. +- port: child port node corresponding to the data input, in accordance with + the video interface bindings defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. The port + node must contain at least one endpoint. + +Optional endpoint property: +--- +- sync-active: Indicates sync signal polarity, 0/1 for low/high respectively. + This property maps to SYNCAC bit in the hardware manual. The + default is 1 (active high). + +Example: + + +(1) Both internal channels enabled: +--- + +When interfacing with a third party tuner device with two data pins as shown +below. + ++-++-+ +|
[PATCH v7 4/7] media: Add new SDR formats PC16, PC18 & PC20
This patch adds support for the three new SDR formats. These formats were prefixed with "planar" indicating I & Q data are not interleaved as in other formats. Here, I & Q data constitutes the top half and bottom half of the received buffer respectively. V4L2_SDR_FMT_PCU16BE - 14-bit complex (I & Q) unsigned big-endian sample inside 16-bit. V4L2 FourCC: PC16 V4L2_SDR_FMT_PCU18BE - 16-bit complex (I & Q) unsigned big-endian sample inside 18-bit. V4L2 FourCC: PC18 V4L2_SDR_FMT_PCU20BE - 18-bit complex (I & Q) unsigned big-endian sample inside 20-bit. V4L2 FourCC: PC20 Signed-off-by: Ramesh Shanmugasundaram --- drivers/media/v4l2-core/v4l2-ioctl.c | 3 +++ include/uapi/linux/videodev2.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 4f27cfa134a1..ce40183d9daa 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1229,6 +1229,9 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_SDR_FMT_CS8: descr = "Complex S8"; break; case V4L2_SDR_FMT_CS14LE: descr = "Complex S14LE"; break; case V4L2_SDR_FMT_RU12LE: descr = "Real U12LE"; break; + case V4L2_SDR_FMT_PCU16BE: descr = "Planar Complex U16BE"; break; + case V4L2_SDR_FMT_PCU18BE: descr = "Planar Complex U18BE"; break; + case V4L2_SDR_FMT_PCU20BE: descr = "Planar Complex U20BE"; break; case V4L2_TCH_FMT_DELTA_TD16: descr = "16-bit signed deltas"; break; case V4L2_TCH_FMT_DELTA_TD08: descr = "8-bit signed deltas"; break; case V4L2_TCH_FMT_TU16: descr = "16-bit unsigned touch data"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 2b8feb86d09e..45cf7359822c 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -669,6 +669,9 @@ struct v4l2_pix_format { #define V4L2_SDR_FMT_CS8 v4l2_fourcc('C', 'S', '0', '8') /* complex s8 */ #define V4L2_SDR_FMT_CS14LE v4l2_fourcc('C', 'S', '1', '4') /* complex s14le */ #define V4L2_SDR_FMT_RU12LE v4l2_fourcc('R', 'U', '1', '2') /* real u12le */ +#define V4L2_SDR_FMT_PCU16BE v4l2_fourcc('P', 'C', '1', '6') /* planar complex u16be */ +#define V4L2_SDR_FMT_PCU18BE v4l2_fourcc('P', 'C', '1', '8') /* planar complex u18be */ +#define V4L2_SDR_FMT_PCU20BE v4l2_fourcc('P', 'C', '2', '0') /* planar complex u20be */ /* Touch formats - used for Touch devices */ #define V4L2_TCH_FMT_DELTA_TD16v4l2_fourcc('T', 'D', '1', '6') /* 16-bit signed deltas */ -- 2.12.2
[PATCH v7 7/7] media: platform: rcar_drif: Add DRIF support
This patch adds Digital Radio Interface (DRIF) support to R-Car Gen3 SoCs. The driver exposes each instance of DRIF as a V4L2 SDR device. A DRIF device represents a channel and each channel can have one or two sub-channels respectively depending on the target board. DRIF supports only Rx functionality. It receives samples from a RF frontend tuner chip it is interfaced with. The combination of DRIF and the tuner device, which is registered as a sub-device, determines the receive sample rate and format. In order to be compliant as a V4L2 SDR device, DRIF needs to bind with the tuner device, which can be provided by a third party vendor. DRIF acts as a slave device and the tuner device acts as a master transmitting the samples. The driver allows asynchronous binding of a tuner device that is registered as a v4l2 sub-device. The driver can learn about the tuner it is interfaced with based on port endpoint properties of the device in device tree. The V4L2 SDR device inherits the controls exposed by the tuner device. The device can also be configured to use either one or both of the data pins at runtime based on the master (tuner) configuration. Signed-off-by: Ramesh Shanmugasundaram --- v7: - Added COMPILE_TEST to rcar_drif (Hans added it in last pull request). v6: - Used fwnode_ apis wherever applicable. - Cleaned up debug prints. --- drivers/media/platform/Kconfig | 25 + drivers/media/platform/Makefile|1 + drivers/media/platform/rcar_drif.c | 1500 3 files changed, 1526 insertions(+) create mode 100644 drivers/media/platform/rcar_drif.c diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 288d3b0dc812..a2fc37d0d29e 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -538,3 +538,28 @@ config VIDEO_STI_HDMI_CEC between compatible devices. endif #CEC_PLATFORM_DRIVERS + +menuconfig SDR_PLATFORM_DRIVERS + bool "SDR platform devices" + depends on MEDIA_SDR_SUPPORT + default n + ---help--- + Say Y here to enable support for platform-specific SDR Drivers. + +if SDR_PLATFORM_DRIVERS + +config VIDEO_RCAR_DRIF + tristate "Renesas Digitial Radio Interface (DRIF)" + depends on VIDEO_V4L2 && HAS_DMA + depends on ARCH_RENESAS || COMPILE_TEST + select VIDEOBUF2_VMALLOC + ---help--- + Say Y if you want to enable R-Car Gen3 DRIF support. DRIF is Digital + Radio Interface that interfaces with an RF front end chip. It is a + receiver of digital data which uses DMA to transfer received data to + a configured location for an application to use. + + To compile this driver as a module, choose M here; the module + will be called rcar_drif. + +endif # SDR_PLATFORM_DRIVERS diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index c3588d570f5d..4cfbb9d0c6cf 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -52,6 +52,7 @@ obj-$(CONFIG_VIDEO_SH_VOU)+= sh_vou.o obj-$(CONFIG_SOC_CAMERA) += soc_camera/ +obj-$(CONFIG_VIDEO_RCAR_DRIF) += rcar_drif.o obj-$(CONFIG_VIDEO_RENESAS_FCP)+= rcar-fcp.o obj-$(CONFIG_VIDEO_RENESAS_FDP1) += rcar_fdp1.o obj-$(CONFIG_VIDEO_RENESAS_JPU)+= rcar_jpu.o diff --git a/drivers/media/platform/rcar_drif.c b/drivers/media/platform/rcar_drif.c new file mode 100644 index ..1f00bbe501bf --- /dev/null +++ b/drivers/media/platform/rcar_drif.c @@ -0,0 +1,1500 @@ +/* + * R-Car Gen3 Digital Radio Interface (DRIF) driver + * + * Copyright (C) 2017 Renesas Electronics Corporation + * + * 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. + */ + +/* + * The R-Car DRIF is a receive only MSIOF like controller with an + * external master device driving the SCK. It receives data into a FIFO, + * then this driver uses the SYS-DMAC engine to move the data from + * the device to memory. + * + * Each DRIF channel DRIFx (as per datasheet) contains two internal + * channels DRIFx0 & DRIFx1 within itself with each having its own resources + * like module clk, register set, irq and dma. These internal channels share + * common CLK & SYNC from master. The two data pins D0 & D1 shall be + * considered to represent the two internal channels. This internal split + * is not visible to the master device. + * + * Depending on the master device, a DRIF channel can use + *
[PATCH v7 3/7] media: i2c: max2175: Add MAX2175 support
This patch adds driver support for the MAX2175 chip. This is Maxim Integrated's RF to Bits tuner front end chip designed for software-defined radio solutions. This driver exposes the tuner as a sub-device instance with standard and custom controls to configure the device. Signed-off-by: Ramesh Shanmugasundaram --- v7: - Made I2S enable/disable control as private (Mauro). v6: - Addressed Sakari's comments. They are: - Added uapi header file. - Added newline at the end of the function before return. - Cleaned up header file inclusion. - Used fwnode_ apis whereever applicable. - Cleaned up debug statements. - Removed separate dir for max2175. v5: - sck -> Sample clock is clarified in driver documentation (Hans) - "refout-load-pF" is renamed to "refout-load" as per updated bindings. --- Documentation/media/v4l-drivers/index.rst |1 + Documentation/media/v4l-drivers/max2175.rst | 62 ++ drivers/media/i2c/Kconfig | 12 + drivers/media/i2c/Makefile |2 + drivers/media/i2c/max2175.c | 1453 +++ drivers/media/i2c/max2175.h | 109 ++ include/uapi/linux/max2175.h| 28 + 7 files changed, 1667 insertions(+) create mode 100644 Documentation/media/v4l-drivers/max2175.rst create mode 100644 drivers/media/i2c/max2175.c create mode 100644 drivers/media/i2c/max2175.h create mode 100644 include/uapi/linux/max2175.h diff --git a/Documentation/media/v4l-drivers/index.rst b/Documentation/media/v4l-drivers/index.rst index 90fe22a6414a..2e24d6806052 100644 --- a/Documentation/media/v4l-drivers/index.rst +++ b/Documentation/media/v4l-drivers/index.rst @@ -42,6 +42,7 @@ For more details see the file COPYING in the source distribution of Linux. davinci-vpbe fimc ivtv + max2175 meye omap3isp omap4_camera diff --git a/Documentation/media/v4l-drivers/max2175.rst b/Documentation/media/v4l-drivers/max2175.rst new file mode 100644 index ..04478c25d57a --- /dev/null +++ b/Documentation/media/v4l-drivers/max2175.rst @@ -0,0 +1,62 @@ +Maxim Integrated MAX2175 RF to bits tuner driver + + +The MAX2175 driver implements the following driver-specific controls: + +``V4L2_CID_MAX2175_I2S_ENABLE`` +--- +Enable/Disable I2S output of the tuner. This is a private control +that can be accessed only using the subdev interface. +Refer to Documentation/media/kapi/v4l2-controls for more details. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``(0)`` + - I2S output is disabled. +* - ``(1)`` + - I2S output is enabled. + +``V4L2_CID_MAX2175_HSLS`` +- +The high-side/low-side (HSLS) control of the tuner for a given band. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``(0)`` + - The LO frequency position is below the desired frequency. +* - ``(1)`` + - The LO frequency position is above the desired frequency. + +``V4L2_CID_MAX2175_RX_MODE (menu)`` +--- +The Rx mode controls a number of preset parameters of the tuner like +sample clock (sck), sampling rate etc. These multiple settings are +provided under one single label called Rx mode in the datasheet. The +list below shows the supported modes with a brief description. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``"Europe modes"`` +* - ``"FM 1.2" (0)`` + - This configures FM band with a sample rate of 0.512 million +samples/sec with a 10.24 MHz sck. +* - ``"DAB 1.2" (1)`` + - This configures VHF band with a sample rate of 2.048 million +samples/sec with a 32.768 MHz sck. + +* - ``"North America modes"`` +* - ``"FM 1.0" (0)`` + - This configures FM band with a sample rate of 0.7441875 million +samples/sec with a 14.88375 MHz sck. +* - ``"DAB 1.2" (1)`` + - This configures FM band with a sample rate of 0.372 million +samples/sec with a 7.441875 MHz sck. diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index c380e2475c82..c0e6e78883b0 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -796,6 +796,18 @@ config VIDEO_SAA6752HS To compile this driver as a module, choose M here: the module will be called saa6752hs. +comment "SDR tuner chips" + +config SDR_MAX2175 + tristate "Maxim 2175 RF to Bits tuner" + depends on VIDEO_V4L2 && MEDIA_SDR_SUPPORT && I2C + ---help--- + Support for Maxim 2175 tuner. It is an advanced analog/digital + r
[PATCH v7 5/7] doc_rst: media: New SDR formats PC16, PC18 & PC20
This patch adds documentation for the three new SDR formats V4L2_SDR_FMT_PCU16BE V4L2_SDR_FMT_PCU18BE V4L2_SDR_FMT_PCU20BE Signed-off-by: Ramesh Shanmugasundaram --- .../media/uapi/v4l/pixfmt-sdr-pcu16be.rst | 55 ++ .../media/uapi/v4l/pixfmt-sdr-pcu18be.rst | 55 ++ .../media/uapi/v4l/pixfmt-sdr-pcu20be.rst | 54 + Documentation/media/uapi/v4l/sdr-formats.rst | 3 ++ 4 files changed, 167 insertions(+) create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst new file mode 100644 index ..2de1b1a0f517 --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst @@ -0,0 +1,55 @@ +.. -*- coding: utf-8; mode: rst -*- + +.. _V4L2-SDR-FMT-PCU16BE: + +** +V4L2_SDR_FMT_PCU16BE ('PC16') +** + +Planar complex unsigned 16-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadrature (IQ). Both I +and Q are represented as a 16 bit unsigned big endian number stored in +32 bit space. The remaining unused bits within the 32 bit space will be +padded with 0. I value starts first and Q value starts at an offset +equalling half of the buffer size (i.e.) offset = buffersize/2. Out of +the 16 bits, bit 15:2 (14 bit) is data and bit 1:0 (2 bit) can be any +value. + +**Byte Order.** +Each cell is one byte. + +.. flat-table:: +:header-rows: 1 +:stub-columns: 0 + +* - Offset: + - Byte B0 + - Byte B1 + - Byte B2 + - Byte B3 +* - start + 0: + - I'\ :sub:`0[13:6]` + - I'\ :sub:`0[5:0]; B1[1:0]=pad` + - pad + - pad +* - start + 4: + - I'\ :sub:`1[13:6]` + - I'\ :sub:`1[5:0]; B1[1:0]=pad` + - pad + - pad +* - ... +* - start + offset: + - Q'\ :sub:`0[13:6]` + - Q'\ :sub:`0[5:0]; B1[1:0]=pad` + - pad + - pad +* - start + offset + 4: + - Q'\ :sub:`1[13:6]` + - Q'\ :sub:`1[5:0]; B1[1:0]=pad` + - pad + - pad diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst new file mode 100644 index ..da8b26bf6b95 --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst @@ -0,0 +1,55 @@ +.. -*- coding: utf-8; mode: rst -*- + +.. _V4L2-SDR-FMT-PCU18BE: + +** +V4L2_SDR_FMT_PCU18BE ('PC18') +** + +Planar complex unsigned 18-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadrature (IQ). Both I +and Q are represented as a 18 bit unsigned big endian number stored in +32 bit space. The remaining unused bits within the 32 bit space will be +padded with 0. I value starts first and Q value starts at an offset +equalling half of the buffer size (i.e.) offset = buffersize/2. Out of +the 18 bits, bit 17:2 (16 bit) is data and bit 1:0 (2 bit) can be any +value. + +**Byte Order.** +Each cell is one byte. + +.. flat-table:: +:header-rows: 1 +:stub-columns: 0 + +* - Offset: + - Byte B0 + - Byte B1 + - Byte B2 + - Byte B3 +* - start + 0: + - I'\ :sub:`0[17:10]` + - I'\ :sub:`0[9:2]` + - I'\ :sub:`0[1:0]; B2[5:0]=pad` + - pad +* - start + 4: + - I'\ :sub:`1[17:10]` + - I'\ :sub:`1[9:2]` + - I'\ :sub:`1[1:0]; B2[5:0]=pad` + - pad +* - ... +* - start + offset: + - Q'\ :sub:`0[17:10]` + - Q'\ :sub:`0[9:2]` + - Q'\ :sub:`0[1:0]; B2[5:0]=pad` + - pad +* - start + offset + 4: + - Q'\ :sub:`1[17:10]` + - Q'\ :sub:`1[9:2]` + - Q'\ :sub:`1[1:0]; B2[5:0]=pad` + - pad diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst new file mode 100644 index ..5499eed39477 --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst @@ -0,0 +1,54 @@ +.. -*- coding: utf-8; mode: rst -*- +.. _V4L2-SDR-FMT-PCU20BE: + +** +V4L2_SDR_FMT_PCU20BE ('PC20') +** + +Planar complex unsigned 20-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadra
[PATCH v7 2/7] dt-bindings: media: Add MAX2175 binding description
Add device tree binding documentation for MAX2175 RF to bits tuner device. Signed-off-by: Ramesh Shanmugasundaram Acked-by: Rob Herring --- .../devicetree/bindings/media/i2c/max2175.txt | 59 ++ .../devicetree/bindings/property-units.txt | 1 + 2 files changed, 60 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/max2175.txt diff --git a/Documentation/devicetree/bindings/media/i2c/max2175.txt b/Documentation/devicetree/bindings/media/i2c/max2175.txt new file mode 100644 index ..02b4e9cd7b1b --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/max2175.txt @@ -0,0 +1,59 @@ +Maxim Integrated MAX2175 RF to Bits tuner +- + +The MAX2175 IC is an advanced analog/digital hybrid-radio receiver with +RF to Bits® front-end designed for software-defined radio solutions. + +Required properties: + +- compatible: "maxim,max2175" for MAX2175 RF-to-bits tuner. +- clocks: clock specifier. +- port: child port node corresponding to the I2S output, in accordance with + the video interface bindings defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. The port + node must contain at least one endpoint. + +Optional properties: + +- maxim,master : phandle to the master tuner if it is a slave. This + is used to define two tuners in diversity mode + (1 master, 1 slave). By default each tuner is an + individual master. +- maxim,refout-load : load capacitance value (in picofarads) on reference + output drive level. The possible load values are: +0 (default - refout disabled) + 10 + 20 + 30 + 40 + 60 + 70 +- maxim,am-hiz-filter : empty property indicates the AM Hi-Z filter is used + in this hardware for AM antenna input. + +Example: + + +Board specific DTS file + +/* Fixed XTAL clock node */ +maxim_xtal: clock { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <36864000>; +}; + +/* A tuner device instance under i2c bus */ +max2175_0: tuner@60 { + compatible = "maxim,max2175"; + reg = <0x60>; + clocks = <&maxim_xtal>; + maxim,refout-load = <10>; + + port { + max2175_0_ep: endpoint { + remote-endpoint = <&slave_rx_device>; + }; + }; + +}; diff --git a/Documentation/devicetree/bindings/property-units.txt b/Documentation/devicetree/bindings/property-units.txt index 12278d79f6c0..7c9f6ee918f1 100644 --- a/Documentation/devicetree/bindings/property-units.txt +++ b/Documentation/devicetree/bindings/property-units.txt @@ -28,6 +28,7 @@ Electricity -ohms : Ohms -micro-ohms: micro Ohms -microvolt : micro volts +-picofarads: picofarads Temperature -- 2.12.2
[PATCH v7 0/7] Add V4L2 SDR (DRIF & MAX2175) driver
DECODER_CMD: OK (Not Supported) Buffer ioctls: test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test VIDIOC_EXPBUF: OK (Not Supported) Test input 0: Total: 43, Succeeded: 43, Failed: 0, Warnings: 0 root@salvator-x:~# [2] "bonding" DT property discussion (https://www.mail-archive.com/linux-renesas-soc@vger.kernel.org/msg09415.html) Ramesh Shanmugasundaram (7): media: v4l2-ctrls: Reserve controls for MAX217X dt-bindings: media: Add MAX2175 binding description media: i2c: max2175: Add MAX2175 support media: Add new SDR formats PC16, PC18 & PC20 doc_rst: media: New SDR formats PC16, PC18 & PC20 dt-bindings: media: Add Renesas R-Car DRIF binding media: platform: rcar_drif: Add DRIF support .../devicetree/bindings/media/i2c/max2175.txt | 59 + .../devicetree/bindings/media/renesas,drif.txt | 176 +++ .../devicetree/bindings/property-units.txt |1 + .../media/uapi/v4l/pixfmt-sdr-pcu16be.rst | 55 + .../media/uapi/v4l/pixfmt-sdr-pcu18be.rst | 55 + .../media/uapi/v4l/pixfmt-sdr-pcu20be.rst | 54 + Documentation/media/uapi/v4l/sdr-formats.rst |3 + Documentation/media/v4l-drivers/index.rst |1 + Documentation/media/v4l-drivers/max2175.rst| 62 + drivers/media/i2c/Kconfig | 12 + drivers/media/i2c/Makefile |2 + drivers/media/i2c/max2175.c| 1453 +++ drivers/media/i2c/max2175.h| 109 ++ drivers/media/platform/Kconfig | 25 + drivers/media/platform/Makefile|1 + drivers/media/platform/rcar_drif.c | 1500 drivers/media/v4l2-core/v4l2-ioctl.c |3 + include/uapi/linux/max2175.h | 28 + include/uapi/linux/v4l2-controls.h |5 + include/uapi/linux/videodev2.h |3 + 20 files changed, 3607 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/max2175.txt create mode 100644 Documentation/devicetree/bindings/media/renesas,drif.txt create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst create mode 100644 Documentation/media/v4l-drivers/max2175.rst create mode 100644 drivers/media/i2c/max2175.c create mode 100644 drivers/media/i2c/max2175.h create mode 100644 drivers/media/platform/rcar_drif.c create mode 100644 include/uapi/linux/max2175.h -- 2.12.2
[PATCH v7 1/7] media: v4l2-ctrls: Reserve controls for MAX217X
Reserve controls for MAX217X RF to Bits tuner family. These hybrid radio receiver chips are highly programmable and hence reserving 32 controls. Signed-off-by: Ramesh Shanmugasundaram Acked-by: Laurent Pinchart --- include/uapi/linux/v4l2-controls.h | 5 + 1 file changed, 5 insertions(+) diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 0d2e1e01fbd5..83b28b41123f 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -180,6 +180,11 @@ enum v4l2_colorfx { * We reserve 16 controls for this driver. */ #define V4L2_CID_USER_TC358743_BASE(V4L2_CID_USER_BASE + 0x1080) +/* The base for the max217x driver controls. + * We reserve 32 controls for this driver + */ +#define V4L2_CID_USER_MAX217X_BASE (V4L2_CID_USER_BASE + 0x1090) + /* MPEG-class control IDs */ /* The MPEG controls are applicable to all codec controls * and the 'MPEG' part of the define is historical */ -- 2.12.2
RE: [PATCH v6 3/7] media: i2c: max2175: Add MAX2175 support
> Em Thu, 8 Jun 2017 09:42:43 + > Ramesh Shanmugasundaram escreveu: > > > > Subject: Re: [PATCH v6 3/7] media: i2c: max2175: Add MAX2175 support > > > > > > Em Wed, 31 May 2017 09:44:53 +0100 > > > Ramesh Shanmugasundaram > escreveu: > > > > > > > +++ b/Documentation/media/v4l-drivers/max2175.rst > > > > @@ -0,0 +1,60 @@ > > > > +Maxim Integrated MAX2175 RF to bits tuner driver > > > > + > > > > + > > > > +The MAX2175 driver implements the following driver-specific > controls: > > > > + > > > > +``V4L2_CID_MAX2175_I2S_ENABLE`` > > > > +--- > > > > +Enable/Disable I2S output of the tuner. > > > > + > > > > +.. flat-table:: > > > > +:header-rows: 0 > > > > +:stub-columns: 0 > > > > +:widths: 1 4 > > > > + > > > > +* - ``(0)`` > > > > + - I2S output is disabled. > > > > +* - ``(1)`` > > > > + - I2S output is enabled. > > > > > > Hmm... There are other drivers at the subsystem that use I2S (for > > > audio - not for SDR - but I guess the issue is similar). > > > > > > On such drivers, the bridge driver controls it directly, being sure > > > that I2S is enabled when it is expecting some data coming from the I2S > bus. > > > > > > On some drivers, there are both I2S and A/D inputs at the bridge > chipset. > > > On such drivers, enabling/disabling I2S is done via VIDIOC_S_INPUT > > > (and optionally via ALSA mixer), being transparent to the user if > > > the stream comes from a tuner via I2S or from a directly connected A/D > input. > > > > > > I don't think it is a good idea to enable it via a control, as, if > > > the bridge driver is expecting data via I2S, disabling it will cause > > > timeouts at the videobuf handling. > > > > The MAX2175 device is exposed as a v4l2 subdev with tuner ops and can > interface with an SDR device. When the tuner is configured, the I2S output > is enabled by default. From an independent tuner device perspective, this > default behaviour is enough and this control may not be needed/used. > > > > However, for the use case here, the R-Car DRIF device acts as the main > SDR device and the Maxim MAX2175 provides a sub-dev interface with tuner > ops. > > > > +-++-+ > > | |-SCK--->|CLK | > > | Master|-SS>|SYNC DRIFn (slave) | > > | (MAX2175) |-SD0--->|D0 | > > | |-SD1--->|D1 | > > +-++-+ > > > > The DRIF device design is such that it involves separate register writes > to enable Rx on each of the data line. To keep both the data lines in sync > it expects the master device to enable output after both the data line Rx > are enabled. > > > > This level of control is exposed as a feature in the MAX2175 using this > control. When interfaced with DRIF this control is used to achieve the > desired functionality. When not interfaced with DRIF, the MAX2175 default > behaviour does not have to change because of DRIF and hence this I2S > control may be unused. Like MAX2175, DRIF is also an independent device > and can interface with a different third party tuner. > > > > Hence, this I2S enable/disable is exposed as a user control. The end > user application (knowing both these devices) is expected to use these > controls appropriately. Please let me know if I need to explain anything > in further detail. > > > The usecase is clear. That's exactly what other drivers with I2S do, > except that, on those other drivers, they pass I2S control info via > platform_data (they're not platform drivers). > > With those drivers, generic applications work as-is via the standard > video, radio or sdr devnodes, without knowing about I2S. > > The main difference here is that you're requiring an specialized > application for this device to work, Specialized application may be needed for this specific combination of devices (DRIF + MAX2175) only. For MAX2175 alone, a generic application itself would be enough. The MAX2175 will have I2S output enabled by default and the SDR device have to just enable/disable its own RX during .start_streaming/.stop_streaming. as a generic one won't be aware of > this device-specific control, and may end by exposing this "internal" > control to the end user. That is OK for embedded usage, but, as soon as > this is used on some non-embedded usecase (with is likely, as there are > several PC consumer products using other chips from Maxim), we'll have > problems. > > I guess the solution here is to make such control visible only via the > subdev interface. > Did you mean using v4l2_subdev_tuner_ops? It does not have a method as of today to support this. The video, audio subdev ops supports s_stream method. We may need to create one for tuner ops. Thanks, Ramesh
RE: [PATCH v6 3/7] media: i2c: max2175: Add MAX2175 support
> Subject: Re: [PATCH v6 3/7] media: i2c: max2175: Add MAX2175 support > > Em Wed, 31 May 2017 09:44:53 +0100 > Ramesh Shanmugasundaram escreveu: > > > +++ b/Documentation/media/v4l-drivers/max2175.rst > > @@ -0,0 +1,60 @@ > > +Maxim Integrated MAX2175 RF to bits tuner driver > > + > > + > > +The MAX2175 driver implements the following driver-specific controls: > > + > > +``V4L2_CID_MAX2175_I2S_ENABLE`` > > +--- > > +Enable/Disable I2S output of the tuner. > > + > > +.. flat-table:: > > +:header-rows: 0 > > +:stub-columns: 0 > > +:widths: 1 4 > > + > > +* - ``(0)`` > > + - I2S output is disabled. > > +* - ``(1)`` > > + - I2S output is enabled. > > Hmm... There are other drivers at the subsystem that use I2S (for audio - > not for SDR - but I guess the issue is similar). > > On such drivers, the bridge driver controls it directly, being sure that > I2S is enabled when it is expecting some data coming from the I2S bus. > > On some drivers, there are both I2S and A/D inputs at the bridge chipset. > On such drivers, enabling/disabling I2S is done via VIDIOC_S_INPUT (and > optionally via ALSA mixer), being transparent to the user if the stream > comes from a tuner via I2S or from a directly connected A/D input. > > I don't think it is a good idea to enable it via a control, as, if the > bridge driver is expecting data via I2S, disabling it will cause timeouts > at the videobuf handling. The MAX2175 device is exposed as a v4l2 subdev with tuner ops and can interface with an SDR device. When the tuner is configured, the I2S output is enabled by default. From an independent tuner device perspective, this default behaviour is enough and this control may not be needed/used. However, for the use case here, the R-Car DRIF device acts as the main SDR device and the Maxim MAX2175 provides a sub-dev interface with tuner ops. +-++-+ | |-SCK--->|CLK | | Master|-SS>|SYNC DRIFn (slave) | | (MAX2175) |-SD0--->|D0 | | |-SD1--->|D1 | +-++-+ The DRIF device design is such that it involves separate register writes to enable Rx on each of the data line. To keep both the data lines in sync it expects the master device to enable output after both the data line Rx are enabled. This level of control is exposed as a feature in the MAX2175 using this control. When interfaced with DRIF this control is used to achieve the desired functionality. When not interfaced with DRIF, the MAX2175 default behaviour does not have to change because of DRIF and hence this I2S control may be unused. Like MAX2175, DRIF is also an independent device and can interface with a different third party tuner. Hence, this I2S enable/disable is exposed as a user control. The end user application (knowing both these devices) is expected to use these controls appropriately. Please let me know if I need to explain anything in further detail. Thanks, Ramesh
[PATCH v6 6/7] dt-bindings: media: Add Renesas R-Car DRIF binding
Add binding documentation for Renesas R-Car Digital Radio Interface (DRIF) controller. Signed-off-by: Ramesh Shanmugasundaram Acked-by: Rob Herring --- .../devicetree/bindings/media/renesas,drif.txt | 176 + 1 file changed, 176 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/renesas,drif.txt diff --git a/Documentation/devicetree/bindings/media/renesas,drif.txt b/Documentation/devicetree/bindings/media/renesas,drif.txt new file mode 100644 index ..39516b94c28f --- /dev/null +++ b/Documentation/devicetree/bindings/media/renesas,drif.txt @@ -0,0 +1,176 @@ +Renesas R-Car Gen3 Digital Radio Interface controller (DRIF) + + +R-Car Gen3 DRIF is a SPI like receive only slave device. A general +representation of DRIF interfacing with a master device is shown below. + ++-++-+ +| |-SCK--->|CLK | +| Master|-SS>|SYNC DRIFn (slave) | +| |-SD0--->|D0 | +| |-SD1--->|D1 | ++-++-+ + +As per datasheet, each DRIF channel (drifn) is made up of two internal +channels (drifn0 & drifn1). These two internal channels share the common +CLK & SYNC. Each internal channel has its own dedicated resources like +irq, dma channels, address space & clock. This internal split is not +visible to the external master device. + +The device tree model represents each internal channel as a separate node. +The internal channels sharing the CLK & SYNC are tied together by their +phandles using a property called "renesas,bonding". For the rest of +the documentation, unless explicitly stated, the word channel implies an +internal channel. + +When both internal channels are enabled they need to be managed together +as one (i.e.) they cannot operate alone as independent devices. Out of the +two, one of them needs to act as a primary device that accepts common +properties of both the internal channels. This channel is identified by a +property called "renesas,primary-bond". + +To summarize, + - When both the internal channels that are bonded together are enabled, + the zeroth channel is selected as primary-bond. This channels accepts + properties common to all the members of the bond. + - When only one of the bonded channels need to be enabled, the property + "renesas,bonding" or "renesas,primary-bond" will have no effect. That + enabled channel can act alone as any other independent device. + +Required properties of an internal channel: +--- +- compatible: "renesas,r8a7795-drif" if DRIF controller is a part of R8A7795 SoC. + "renesas,rcar-gen3-drif" for a generic R-Car Gen3 compatible device. + + When compatible with the generic version, nodes must list the + SoC-specific version corresponding to the platform first + followed by the generic version. + +- reg: offset and length of that channel. +- interrupts: associated with that channel. +- clocks: phandle and clock specifier of that channel. +- clock-names: clock input name string: "fck". +- dmas: phandles to the DMA channels. +- dma-names: names of the DMA channel: "rx". +- renesas,bonding: phandle to the other channel. + +Optional properties of an internal channel: +--- +- power-domains: phandle to the respective power domain. + +Required properties of an internal channel when: + - It is the only enabled channel of the bond (or) + - If it acts as primary among enabled bonds + +- pinctrl-0: pin control group to be used for this channel. +- pinctrl-names: must be "default". +- renesas,primary-bond: empty property indicating the channel acts as primary + among the bonded channels. +- port: child port node corresponding to the data input, in accordance with + the video interface bindings defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. The port + node must contain at least one endpoint. + +Optional endpoint property: +--- +- sync-active: Indicates sync signal polarity, 0/1 for low/high respectively. + This property maps to SYNCAC bit in the hardware manual. The + default is 1 (active high). + +Example: + + +(1) Both internal channels enabled: +--- + +When interfacing with a third party tuner device with two data pins as shown +below. + ++-++-+ +|
[PATCH v6 5/7] doc_rst: media: New SDR formats PC16, PC18 & PC20
This patch adds documentation for the three new SDR formats V4L2_SDR_FMT_PCU16BE V4L2_SDR_FMT_PCU18BE V4L2_SDR_FMT_PCU20BE Signed-off-by: Ramesh Shanmugasundaram --- .../media/uapi/v4l/pixfmt-sdr-pcu16be.rst | 55 ++ .../media/uapi/v4l/pixfmt-sdr-pcu18be.rst | 55 ++ .../media/uapi/v4l/pixfmt-sdr-pcu20be.rst | 54 + Documentation/media/uapi/v4l/sdr-formats.rst | 3 ++ 4 files changed, 167 insertions(+) create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst new file mode 100644 index ..2de1b1a0f517 --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst @@ -0,0 +1,55 @@ +.. -*- coding: utf-8; mode: rst -*- + +.. _V4L2-SDR-FMT-PCU16BE: + +** +V4L2_SDR_FMT_PCU16BE ('PC16') +** + +Planar complex unsigned 16-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadrature (IQ). Both I +and Q are represented as a 16 bit unsigned big endian number stored in +32 bit space. The remaining unused bits within the 32 bit space will be +padded with 0. I value starts first and Q value starts at an offset +equalling half of the buffer size (i.e.) offset = buffersize/2. Out of +the 16 bits, bit 15:2 (14 bit) is data and bit 1:0 (2 bit) can be any +value. + +**Byte Order.** +Each cell is one byte. + +.. flat-table:: +:header-rows: 1 +:stub-columns: 0 + +* - Offset: + - Byte B0 + - Byte B1 + - Byte B2 + - Byte B3 +* - start + 0: + - I'\ :sub:`0[13:6]` + - I'\ :sub:`0[5:0]; B1[1:0]=pad` + - pad + - pad +* - start + 4: + - I'\ :sub:`1[13:6]` + - I'\ :sub:`1[5:0]; B1[1:0]=pad` + - pad + - pad +* - ... +* - start + offset: + - Q'\ :sub:`0[13:6]` + - Q'\ :sub:`0[5:0]; B1[1:0]=pad` + - pad + - pad +* - start + offset + 4: + - Q'\ :sub:`1[13:6]` + - Q'\ :sub:`1[5:0]; B1[1:0]=pad` + - pad + - pad diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst new file mode 100644 index ..da8b26bf6b95 --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst @@ -0,0 +1,55 @@ +.. -*- coding: utf-8; mode: rst -*- + +.. _V4L2-SDR-FMT-PCU18BE: + +** +V4L2_SDR_FMT_PCU18BE ('PC18') +** + +Planar complex unsigned 18-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadrature (IQ). Both I +and Q are represented as a 18 bit unsigned big endian number stored in +32 bit space. The remaining unused bits within the 32 bit space will be +padded with 0. I value starts first and Q value starts at an offset +equalling half of the buffer size (i.e.) offset = buffersize/2. Out of +the 18 bits, bit 17:2 (16 bit) is data and bit 1:0 (2 bit) can be any +value. + +**Byte Order.** +Each cell is one byte. + +.. flat-table:: +:header-rows: 1 +:stub-columns: 0 + +* - Offset: + - Byte B0 + - Byte B1 + - Byte B2 + - Byte B3 +* - start + 0: + - I'\ :sub:`0[17:10]` + - I'\ :sub:`0[9:2]` + - I'\ :sub:`0[1:0]; B2[5:0]=pad` + - pad +* - start + 4: + - I'\ :sub:`1[17:10]` + - I'\ :sub:`1[9:2]` + - I'\ :sub:`1[1:0]; B2[5:0]=pad` + - pad +* - ... +* - start + offset: + - Q'\ :sub:`0[17:10]` + - Q'\ :sub:`0[9:2]` + - Q'\ :sub:`0[1:0]; B2[5:0]=pad` + - pad +* - start + offset + 4: + - Q'\ :sub:`1[17:10]` + - Q'\ :sub:`1[9:2]` + - Q'\ :sub:`1[1:0]; B2[5:0]=pad` + - pad diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst new file mode 100644 index ..5499eed39477 --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst @@ -0,0 +1,54 @@ +.. -*- coding: utf-8; mode: rst -*- +.. _V4L2-SDR-FMT-PCU20BE: + +** +V4L2_SDR_FMT_PCU20BE ('PC20') +** + +Planar complex unsigned 20-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadra
[PATCH v6 0/7] Add V4L2 SDR (DRIF & MAX2175) driver
ted) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported) Buffer ioctls: test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test VIDIOC_EXPBUF: OK (Not Supported) Test input 0: Total: 43, Succeeded: 43, Failed: 0, Warnings: 0 root@salvator-x:~# [2] "bonding" DT property discussion (https://www.mail-archive.com/linux-renesas-soc@vger.kernel.org/msg09415.html) Ramesh Shanmugasundaram (7): media: v4l2-ctrls: Reserve controls for MAX217X dt-bindings: media: Add MAX2175 binding description media: i2c: max2175: Add MAX2175 support media: Add new SDR formats PC16, PC18 & PC20 doc_rst: media: New SDR formats PC16, PC18 & PC20 dt-bindings: media: Add Renesas R-Car DRIF binding media: platform: rcar_drif: Add DRIF support .../devicetree/bindings/media/i2c/max2175.txt | 59 + .../devicetree/bindings/media/renesas,drif.txt | 176 +++ .../devicetree/bindings/property-units.txt |1 + .../media/uapi/v4l/pixfmt-sdr-pcu16be.rst | 55 + .../media/uapi/v4l/pixfmt-sdr-pcu18be.rst | 55 + .../media/uapi/v4l/pixfmt-sdr-pcu20be.rst | 54 + Documentation/media/uapi/v4l/sdr-formats.rst |3 + Documentation/media/v4l-drivers/index.rst |1 + Documentation/media/v4l-drivers/max2175.rst| 60 + drivers/media/i2c/Kconfig | 12 + drivers/media/i2c/Makefile |2 + drivers/media/i2c/max2175.c| 1448 +++ drivers/media/i2c/max2175.h| 107 ++ drivers/media/platform/Kconfig | 25 + drivers/media/platform/Makefile|1 + drivers/media/platform/rcar_drif.c | 1500 drivers/media/v4l2-core/v4l2-ioctl.c |3 + include/uapi/linux/max2175.h | 28 + include/uapi/linux/v4l2-controls.h |5 + include/uapi/linux/videodev2.h |3 + 20 files changed, 3598 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/max2175.txt create mode 100644 Documentation/devicetree/bindings/media/renesas,drif.txt create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst create mode 100644 Documentation/media/v4l-drivers/max2175.rst create mode 100644 drivers/media/i2c/max2175.c create mode 100644 drivers/media/i2c/max2175.h create mode 100644 drivers/media/platform/rcar_drif.c create mode 100644 include/uapi/linux/max2175.h -- 2.12.2
[PATCH v6 1/7] media: v4l2-ctrls: Reserve controls for MAX217X
Reserve controls for MAX217X RF to Bits tuner family. These hybrid radio receiver chips are highly programmable and hence reserving 32 controls. Signed-off-by: Ramesh Shanmugasundaram Acked-by: Laurent Pinchart --- include/uapi/linux/v4l2-controls.h | 5 + 1 file changed, 5 insertions(+) diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 0d2e1e01fbd5..83b28b41123f 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -180,6 +180,11 @@ enum v4l2_colorfx { * We reserve 16 controls for this driver. */ #define V4L2_CID_USER_TC358743_BASE(V4L2_CID_USER_BASE + 0x1080) +/* The base for the max217x driver controls. + * We reserve 32 controls for this driver + */ +#define V4L2_CID_USER_MAX217X_BASE (V4L2_CID_USER_BASE + 0x1090) + /* MPEG-class control IDs */ /* The MPEG controls are applicable to all codec controls * and the 'MPEG' part of the define is historical */ -- 2.12.2
[PATCH v6 7/7] media: platform: rcar_drif: Add DRIF support
This patch adds Digital Radio Interface (DRIF) support to R-Car Gen3 SoCs. The driver exposes each instance of DRIF as a V4L2 SDR device. A DRIF device represents a channel and each channel can have one or two sub-channels respectively depending on the target board. DRIF supports only Rx functionality. It receives samples from a RF frontend tuner chip it is interfaced with. The combination of DRIF and the tuner device, which is registered as a sub-device, determines the receive sample rate and format. In order to be compliant as a V4L2 SDR device, DRIF needs to bind with the tuner device, which can be provided by a third party vendor. DRIF acts as a slave device and the tuner device acts as a master transmitting the samples. The driver allows asynchronous binding of a tuner device that is registered as a v4l2 sub-device. The driver can learn about the tuner it is interfaced with based on port endpoint properties of the device in device tree. The V4L2 SDR device inherits the controls exposed by the tuner device. The device can also be configured to use either one or both of the data pins at runtime based on the master (tuner) configuration. Signed-off-by: Ramesh Shanmugasundaram --- v6: - Used fwnode_ apis wherever applicable. - Cleaned up debug prints. --- drivers/media/platform/Kconfig | 25 + drivers/media/platform/Makefile|1 + drivers/media/platform/rcar_drif.c | 1500 3 files changed, 1526 insertions(+) create mode 100644 drivers/media/platform/rcar_drif.c diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 317f8d41e4ad..f10994dc032d 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -523,3 +523,28 @@ config VIDEO_STI_HDMI_CEC between compatible devices. endif #CEC_PLATFORM_DRIVERS + +menuconfig SDR_PLATFORM_DRIVERS + bool "SDR platform devices" + depends on MEDIA_SDR_SUPPORT + default n + ---help--- + Say Y here to enable support for platform-specific SDR Drivers. + +if SDR_PLATFORM_DRIVERS + +config VIDEO_RCAR_DRIF + tristate "Renesas Digitial Radio Interface (DRIF)" + depends on VIDEO_V4L2 && HAS_DMA + depends on ARCH_RENESAS + select VIDEOBUF2_VMALLOC + ---help--- + Say Y if you want to enable R-Car Gen3 DRIF support. DRIF is Digital + Radio Interface that interfaces with an RF front end chip. It is a + receiver of digital data which uses DMA to transfer received data to + a configured location for an application to use. + + To compile this driver as a module, choose M here; the module + will be called rcar_drif. + +endif # SDR_PLATFORM_DRIVERS diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index 63303d63c64c..6349698bb37a 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -52,6 +52,7 @@ obj-$(CONFIG_VIDEO_SH_VOU)+= sh_vou.o obj-$(CONFIG_SOC_CAMERA) += soc_camera/ +obj-$(CONFIG_VIDEO_RCAR_DRIF) += rcar_drif.o obj-$(CONFIG_VIDEO_RENESAS_FCP)+= rcar-fcp.o obj-$(CONFIG_VIDEO_RENESAS_FDP1) += rcar_fdp1.o obj-$(CONFIG_VIDEO_RENESAS_JPU)+= rcar_jpu.o diff --git a/drivers/media/platform/rcar_drif.c b/drivers/media/platform/rcar_drif.c new file mode 100644 index ..1f00bbe501bf --- /dev/null +++ b/drivers/media/platform/rcar_drif.c @@ -0,0 +1,1500 @@ +/* + * R-Car Gen3 Digital Radio Interface (DRIF) driver + * + * Copyright (C) 2017 Renesas Electronics Corporation + * + * 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. + */ + +/* + * The R-Car DRIF is a receive only MSIOF like controller with an + * external master device driving the SCK. It receives data into a FIFO, + * then this driver uses the SYS-DMAC engine to move the data from + * the device to memory. + * + * Each DRIF channel DRIFx (as per datasheet) contains two internal + * channels DRIFx0 & DRIFx1 within itself with each having its own resources + * like module clk, register set, irq and dma. These internal channels share + * common CLK & SYNC from master. The two data pins D0 & D1 shall be + * considered to represent the two internal channels. This internal split + * is not visible to the master device. + * + * Depending on the master device, a DRIF channel can use + * (1) both internal channels (D0 & D1) to receive data in parallel (or) + * (2) one internal ch
[PATCH v6 4/7] media: Add new SDR formats PC16, PC18 & PC20
This patch adds support for the three new SDR formats. These formats were prefixed with "planar" indicating I & Q data are not interleaved as in other formats. Here, I & Q data constitutes the top half and bottom half of the received buffer respectively. V4L2_SDR_FMT_PCU16BE - 14-bit complex (I & Q) unsigned big-endian sample inside 16-bit. V4L2 FourCC: PC16 V4L2_SDR_FMT_PCU18BE - 16-bit complex (I & Q) unsigned big-endian sample inside 18-bit. V4L2 FourCC: PC18 V4L2_SDR_FMT_PCU20BE - 18-bit complex (I & Q) unsigned big-endian sample inside 20-bit. V4L2 FourCC: PC20 Signed-off-by: Ramesh Shanmugasundaram --- drivers/media/v4l2-core/v4l2-ioctl.c | 3 +++ include/uapi/linux/videodev2.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index e5a2187381db..ca1e920d3e7c 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1229,6 +1229,9 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_SDR_FMT_CS8: descr = "Complex S8"; break; case V4L2_SDR_FMT_CS14LE: descr = "Complex S14LE"; break; case V4L2_SDR_FMT_RU12LE: descr = "Real U12LE"; break; + case V4L2_SDR_FMT_PCU16BE: descr = "Planar Complex U16BE"; break; + case V4L2_SDR_FMT_PCU18BE: descr = "Planar Complex U18BE"; break; + case V4L2_SDR_FMT_PCU20BE: descr = "Planar Complex U20BE"; break; case V4L2_TCH_FMT_DELTA_TD16: descr = "16-bit signed deltas"; break; case V4L2_TCH_FMT_DELTA_TD08: descr = "8-bit signed deltas"; break; case V4L2_TCH_FMT_TU16: descr = "16-bit unsigned touch data"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 2b8feb86d09e..45cf7359822c 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -669,6 +669,9 @@ struct v4l2_pix_format { #define V4L2_SDR_FMT_CS8 v4l2_fourcc('C', 'S', '0', '8') /* complex s8 */ #define V4L2_SDR_FMT_CS14LE v4l2_fourcc('C', 'S', '1', '4') /* complex s14le */ #define V4L2_SDR_FMT_RU12LE v4l2_fourcc('R', 'U', '1', '2') /* real u12le */ +#define V4L2_SDR_FMT_PCU16BE v4l2_fourcc('P', 'C', '1', '6') /* planar complex u16be */ +#define V4L2_SDR_FMT_PCU18BE v4l2_fourcc('P', 'C', '1', '8') /* planar complex u18be */ +#define V4L2_SDR_FMT_PCU20BE v4l2_fourcc('P', 'C', '2', '0') /* planar complex u20be */ /* Touch formats - used for Touch devices */ #define V4L2_TCH_FMT_DELTA_TD16v4l2_fourcc('T', 'D', '1', '6') /* 16-bit signed deltas */ -- 2.12.2
[PATCH v6 2/7] dt-bindings: media: Add MAX2175 binding description
Add device tree binding documentation for MAX2175 RF to bits tuner device. Signed-off-by: Ramesh Shanmugasundaram Acked-by: Rob Herring --- v6: - clocks property updated. - pico-farads renamed to picofarads (Sakari). v5: - pF in property-units.txt is renamed to pico-farads (Geert) - "maxim,refout-load-pF" is renamed to "maxim,refout-load". --- .../devicetree/bindings/media/i2c/max2175.txt | 59 ++ .../devicetree/bindings/property-units.txt | 1 + 2 files changed, 60 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/max2175.txt diff --git a/Documentation/devicetree/bindings/media/i2c/max2175.txt b/Documentation/devicetree/bindings/media/i2c/max2175.txt new file mode 100644 index ..02b4e9cd7b1b --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/max2175.txt @@ -0,0 +1,59 @@ +Maxim Integrated MAX2175 RF to Bits tuner +- + +The MAX2175 IC is an advanced analog/digital hybrid-radio receiver with +RF to Bits® front-end designed for software-defined radio solutions. + +Required properties: + +- compatible: "maxim,max2175" for MAX2175 RF-to-bits tuner. +- clocks: clock specifier. +- port: child port node corresponding to the I2S output, in accordance with + the video interface bindings defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. The port + node must contain at least one endpoint. + +Optional properties: + +- maxim,master : phandle to the master tuner if it is a slave. This + is used to define two tuners in diversity mode + (1 master, 1 slave). By default each tuner is an + individual master. +- maxim,refout-load : load capacitance value (in picofarads) on reference + output drive level. The possible load values are: +0 (default - refout disabled) + 10 + 20 + 30 + 40 + 60 + 70 +- maxim,am-hiz-filter : empty property indicates the AM Hi-Z filter is used + in this hardware for AM antenna input. + +Example: + + +Board specific DTS file + +/* Fixed XTAL clock node */ +maxim_xtal: clock { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <36864000>; +}; + +/* A tuner device instance under i2c bus */ +max2175_0: tuner@60 { + compatible = "maxim,max2175"; + reg = <0x60>; + clocks = <&maxim_xtal>; + maxim,refout-load = <10>; + + port { + max2175_0_ep: endpoint { + remote-endpoint = <&slave_rx_device>; + }; + }; + +}; diff --git a/Documentation/devicetree/bindings/property-units.txt b/Documentation/devicetree/bindings/property-units.txt index 12278d79f6c0..7c9f6ee918f1 100644 --- a/Documentation/devicetree/bindings/property-units.txt +++ b/Documentation/devicetree/bindings/property-units.txt @@ -28,6 +28,7 @@ Electricity -ohms : Ohms -micro-ohms: micro Ohms -microvolt : micro volts +-picofarads: picofarads Temperature -- 2.12.2
[PATCH v6 3/7] media: i2c: max2175: Add MAX2175 support
This patch adds driver support for the MAX2175 chip. This is Maxim Integrated's RF to Bits tuner front end chip designed for software-defined radio solutions. This driver exposes the tuner as a sub-device instance with standard and custom controls to configure the device. Signed-off-by: Ramesh Shanmugasundaram --- v6: - Addressed Sakari's comments. They are: - Added uapi header file. - Added newline at the end of the function before return. - Cleaned up header file inclusion. - Used fwnode_ apis whereever applicable. - Cleaned up debug statements. - Removed separate dir for max2175. v5: - sck -> Sample clock is clarified in driver documentation (Hans) - "refout-load-pF" is renamed to "refout-load" as per updated bindings. --- Documentation/media/v4l-drivers/index.rst |1 + Documentation/media/v4l-drivers/max2175.rst | 60 ++ drivers/media/i2c/Kconfig | 12 + drivers/media/i2c/Makefile |2 + drivers/media/i2c/max2175.c | 1448 +++ drivers/media/i2c/max2175.h | 107 ++ include/uapi/linux/max2175.h| 28 + 7 files changed, 1658 insertions(+) create mode 100644 Documentation/media/v4l-drivers/max2175.rst create mode 100644 drivers/media/i2c/max2175.c create mode 100644 drivers/media/i2c/max2175.h create mode 100644 include/uapi/linux/max2175.h diff --git a/Documentation/media/v4l-drivers/index.rst b/Documentation/media/v4l-drivers/index.rst index 90fe22a6414a..2e24d6806052 100644 --- a/Documentation/media/v4l-drivers/index.rst +++ b/Documentation/media/v4l-drivers/index.rst @@ -42,6 +42,7 @@ For more details see the file COPYING in the source distribution of Linux. davinci-vpbe fimc ivtv + max2175 meye omap3isp omap4_camera diff --git a/Documentation/media/v4l-drivers/max2175.rst b/Documentation/media/v4l-drivers/max2175.rst new file mode 100644 index ..94fb815f043b --- /dev/null +++ b/Documentation/media/v4l-drivers/max2175.rst @@ -0,0 +1,60 @@ +Maxim Integrated MAX2175 RF to bits tuner driver + + +The MAX2175 driver implements the following driver-specific controls: + +``V4L2_CID_MAX2175_I2S_ENABLE`` +--- +Enable/Disable I2S output of the tuner. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``(0)`` + - I2S output is disabled. +* - ``(1)`` + - I2S output is enabled. + +``V4L2_CID_MAX2175_HSLS`` +- +The high-side/low-side (HSLS) control of the tuner for a given band. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``(0)`` + - The LO frequency position is below the desired frequency. +* - ``(1)`` + - The LO frequency position is above the desired frequency. + +``V4L2_CID_MAX2175_RX_MODE (menu)`` +--- +The Rx mode controls a number of preset parameters of the tuner like +sample clock (sck), sampling rate etc. These multiple settings are +provided under one single label called Rx mode in the datasheet. The +list below shows the supported modes with a brief description. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``"Europe modes"`` +* - ``"FM 1.2" (0)`` + - This configures FM band with a sample rate of 0.512 million +samples/sec with a 10.24 MHz sck. +* - ``"DAB 1.2" (1)`` + - This configures VHF band with a sample rate of 2.048 million +samples/sec with a 32.768 MHz sck. + +* - ``"North America modes"`` +* - ``"FM 1.0" (0)`` + - This configures FM band with a sample rate of 0.7441875 million +samples/sec with a 14.88375 MHz sck. +* - ``"DAB 1.2" (1)`` + - This configures FM band with a sample rate of 0.372 million +samples/sec with a 7.441875 MHz sck. diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index 7c23b7a1fd05..5e94935c0822 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -793,6 +793,18 @@ config VIDEO_SAA6752HS To compile this driver as a module, choose M here: the module will be called saa6752hs. +comment "SDR tuner chips" + +config SDR_MAX2175 + tristate "Maxim 2175 RF to Bits tuner" + depends on VIDEO_V4L2 && MEDIA_SDR_SUPPORT && I2C + ---help--- + Support for Maxim 2175 tuner. It is an advanced analog/digital + radio receiver with RF-to-Bits front-end designed for SDR solutions. + + To compile this driver as a module, choose M here; the + module will be called max2175. + comment "Miscellaneous helpe
RE: [PATCH v5 3/7] media: i2c: max2175: Add MAX2175 support
Hi Sakari, Thanks for the review comments on the patches. Sorry for the late response as I was caught up with another work. I will incorporate your comments and rebase it on top of your branch. I see it is not there in media-tree master yet. Please let me know if there is a change in plan. Thanks, Ramesh > Subject: Re: [PATCH v5 3/7] media: i2c: max2175: Add MAX2175 support > > Hi Ramesh, > > On Tue, May 09, 2017 at 02:37:34PM +0100, Ramesh Shanmugasundaram wrote: > ... > > +#include > > +#include > > +#include > > Could you rebase this on the V4L2 fwnode patchset here, please? > > https://git.linuxtv.org/sailus/media_tree.git/log/?h=v4l2-acpi> > > It depends on other patches which will reach media-tree master in next > rc1, for now I've merged them here: > > https://git.linuxtv.org/sailus/media_tree.git/log/?h=v4l2-acpi-merge> > > I'll send a pull request for media-tree once we have 4.12rc1 in media-tree > master. > > Thanks. > > -- > Kind regards, > > Sakari Ailus > e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
[PATCH v5 5/7] doc_rst: media: New SDR formats PC16, PC18 & PC20
This patch adds documentation for the three new SDR formats V4L2_SDR_FMT_PCU16BE V4L2_SDR_FMT_PCU18BE V4L2_SDR_FMT_PCU20BE Signed-off-by: Ramesh Shanmugasundaram --- .../media/uapi/v4l/pixfmt-sdr-pcu16be.rst | 55 ++ .../media/uapi/v4l/pixfmt-sdr-pcu18be.rst | 55 ++ .../media/uapi/v4l/pixfmt-sdr-pcu20be.rst | 54 + Documentation/media/uapi/v4l/sdr-formats.rst | 3 ++ 4 files changed, 167 insertions(+) create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst new file mode 100644 index ..2de1b1a0f517 --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst @@ -0,0 +1,55 @@ +.. -*- coding: utf-8; mode: rst -*- + +.. _V4L2-SDR-FMT-PCU16BE: + +** +V4L2_SDR_FMT_PCU16BE ('PC16') +** + +Planar complex unsigned 16-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadrature (IQ). Both I +and Q are represented as a 16 bit unsigned big endian number stored in +32 bit space. The remaining unused bits within the 32 bit space will be +padded with 0. I value starts first and Q value starts at an offset +equalling half of the buffer size (i.e.) offset = buffersize/2. Out of +the 16 bits, bit 15:2 (14 bit) is data and bit 1:0 (2 bit) can be any +value. + +**Byte Order.** +Each cell is one byte. + +.. flat-table:: +:header-rows: 1 +:stub-columns: 0 + +* - Offset: + - Byte B0 + - Byte B1 + - Byte B2 + - Byte B3 +* - start + 0: + - I'\ :sub:`0[13:6]` + - I'\ :sub:`0[5:0]; B1[1:0]=pad` + - pad + - pad +* - start + 4: + - I'\ :sub:`1[13:6]` + - I'\ :sub:`1[5:0]; B1[1:0]=pad` + - pad + - pad +* - ... +* - start + offset: + - Q'\ :sub:`0[13:6]` + - Q'\ :sub:`0[5:0]; B1[1:0]=pad` + - pad + - pad +* - start + offset + 4: + - Q'\ :sub:`1[13:6]` + - Q'\ :sub:`1[5:0]; B1[1:0]=pad` + - pad + - pad diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst new file mode 100644 index ..da8b26bf6b95 --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst @@ -0,0 +1,55 @@ +.. -*- coding: utf-8; mode: rst -*- + +.. _V4L2-SDR-FMT-PCU18BE: + +** +V4L2_SDR_FMT_PCU18BE ('PC18') +** + +Planar complex unsigned 18-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadrature (IQ). Both I +and Q are represented as a 18 bit unsigned big endian number stored in +32 bit space. The remaining unused bits within the 32 bit space will be +padded with 0. I value starts first and Q value starts at an offset +equalling half of the buffer size (i.e.) offset = buffersize/2. Out of +the 18 bits, bit 17:2 (16 bit) is data and bit 1:0 (2 bit) can be any +value. + +**Byte Order.** +Each cell is one byte. + +.. flat-table:: +:header-rows: 1 +:stub-columns: 0 + +* - Offset: + - Byte B0 + - Byte B1 + - Byte B2 + - Byte B3 +* - start + 0: + - I'\ :sub:`0[17:10]` + - I'\ :sub:`0[9:2]` + - I'\ :sub:`0[1:0]; B2[5:0]=pad` + - pad +* - start + 4: + - I'\ :sub:`1[17:10]` + - I'\ :sub:`1[9:2]` + - I'\ :sub:`1[1:0]; B2[5:0]=pad` + - pad +* - ... +* - start + offset: + - Q'\ :sub:`0[17:10]` + - Q'\ :sub:`0[9:2]` + - Q'\ :sub:`0[1:0]; B2[5:0]=pad` + - pad +* - start + offset + 4: + - Q'\ :sub:`1[17:10]` + - Q'\ :sub:`1[9:2]` + - Q'\ :sub:`1[1:0]; B2[5:0]=pad` + - pad diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst new file mode 100644 index ..5499eed39477 --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst @@ -0,0 +1,54 @@ +.. -*- coding: utf-8; mode: rst -*- +.. _V4L2-SDR-FMT-PCU20BE: + +** +V4L2_SDR_FMT_PCU20BE ('PC20') +** + +Planar complex unsigned 20-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadra
[PATCH v5 7/7] media: platform: rcar_drif: Add DRIF support
This patch adds Digital Radio Interface (DRIF) support to R-Car Gen3 SoCs. The driver exposes each instance of DRIF as a V4L2 SDR device. A DRIF device represents a channel and each channel can have one or two sub-channels respectively depending on the target board. DRIF supports only Rx functionality. It receives samples from a RF frontend tuner chip it is interfaced with. The combination of DRIF and the tuner device, which is registered as a sub-device, determines the receive sample rate and format. In order to be compliant as a V4L2 SDR device, DRIF needs to bind with the tuner device, which can be provided by a third party vendor. DRIF acts as a slave device and the tuner device acts as a master transmitting the samples. The driver allows asynchronous binding of a tuner device that is registered as a v4l2 sub-device. The driver can learn about the tuner it is interfaced with based on port endpoint properties of the device in device tree. The V4L2 SDR device inherits the controls exposed by the tuner device. The device can also be configured to use either one or both of the data pins at runtime based on the master (tuner) configuration. Signed-off-by: Ramesh Shanmugasundaram --- drivers/media/platform/Kconfig | 25 + drivers/media/platform/Makefile|1 + drivers/media/platform/rcar_drif.c | 1488 3 files changed, 1514 insertions(+) create mode 100644 drivers/media/platform/rcar_drif.c diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 73c3bc5deadf..433397802ef2 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -520,3 +520,28 @@ menuconfig DVB_PLATFORM_DRIVERS if DVB_PLATFORM_DRIVERS source "drivers/media/platform/sti/c8sectpfe/Kconfig" endif #DVB_PLATFORM_DRIVERS + +menuconfig SDR_PLATFORM_DRIVERS + bool "SDR platform devices" + depends on MEDIA_SDR_SUPPORT + default n + ---help--- + Say Y here to enable support for platform-specific SDR Drivers. + +if SDR_PLATFORM_DRIVERS + +config VIDEO_RCAR_DRIF + tristate "Renesas Digitial Radio Interface (DRIF)" + depends on VIDEO_V4L2 && HAS_DMA + depends on ARCH_RENESAS + select VIDEOBUF2_VMALLOC + ---help--- + Say Y if you want to enable R-Car Gen3 DRIF support. DRIF is Digital + Radio Interface that interfaces with an RF front end chip. It is a + receiver of digital data which uses DMA to transfer received data to + a configured location for an application to use. + + To compile this driver as a module, choose M here; the module + will be called rcar_drif. + +endif # SDR_PLATFORM_DRIVERS diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index 63303d63c64c..6349698bb37a 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -52,6 +52,7 @@ obj-$(CONFIG_VIDEO_SH_VOU)+= sh_vou.o obj-$(CONFIG_SOC_CAMERA) += soc_camera/ +obj-$(CONFIG_VIDEO_RCAR_DRIF) += rcar_drif.o obj-$(CONFIG_VIDEO_RENESAS_FCP)+= rcar-fcp.o obj-$(CONFIG_VIDEO_RENESAS_FDP1) += rcar_fdp1.o obj-$(CONFIG_VIDEO_RENESAS_JPU)+= rcar_jpu.o diff --git a/drivers/media/platform/rcar_drif.c b/drivers/media/platform/rcar_drif.c new file mode 100644 index ..d357e247f339 --- /dev/null +++ b/drivers/media/platform/rcar_drif.c @@ -0,0 +1,1488 @@ +/* + * R-Car Gen3 Digital Radio Interface (DRIF) driver + * + * Copyright (C) 2017 Renesas Electronics Corporation + * + * 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. + */ + +/* + * The R-Car DRIF is a receive only MSIOF like controller with an + * external master device driving the SCK. It receives data into a FIFO, + * then this driver uses the SYS-DMAC engine to move the data from + * the device to memory. + * + * Each DRIF channel DRIFx (as per datasheet) contains two internal + * channels DRIFx0 & DRIFx1 within itself with each having its own resources + * like module clk, register set, irq and dma. These internal channels share + * common CLK & SYNC from master. The two data pins D0 & D1 shall be + * considered to represent the two internal channels. This internal split + * is not visible to the master device. + * + * Depending on the master device, a DRIF channel can use + * (1) both internal channels (D0 & D1) to receive data in parallel (or) + * (2) one internal channel (D0 or D1) t
[PATCH v5 6/7] dt-bindings: media: Add Renesas R-Car DRIF binding
Add binding documentation for Renesas R-Car Digital Radio Interface (DRIF) controller. Signed-off-by: Ramesh Shanmugasundaram --- v5: - Addressed Rob's comments on v4: - Formatted compatible string entries. - Removed "status". - Removed board and SoC specific bindings classification example. - Removed pinctrl nodes. --- .../devicetree/bindings/media/renesas,drif.txt | 177 + 1 file changed, 177 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/renesas,drif.txt diff --git a/Documentation/devicetree/bindings/media/renesas,drif.txt b/Documentation/devicetree/bindings/media/renesas,drif.txt new file mode 100644 index ..ec718c8bd937 --- /dev/null +++ b/Documentation/devicetree/bindings/media/renesas,drif.txt @@ -0,0 +1,177 @@ +Renesas R-Car Gen3 Digital Radio Interface controller (DRIF) + + +R-Car Gen3 DRIF is a SPI like receive only slave device. A general +representation of DRIF interfacing with a master device is shown below. + ++-++-+ +| |-SCK--->|CLK | +| Master|-SS>|SYNC DRIFn (slave) | +| |-SD0--->|D0 | +| |-SD1--->|D1 | ++-++-+ + +As per datasheet, each DRIF channel (drifn) is made up of two internal +channels (drifn0 & drifn1). These two internal channels share the common +CLK & SYNC. Each internal channel has its own dedicated resources like +irq, dma channels, address space & clock. This internal split is not +visible to the external master device. + +The device tree model represents each internal channel as a separate node. +The internal channels sharing the CLK & SYNC are tied together by their +phandles using a property called "renesas,bonding". For the rest of +the documentation, unless explicitly stated, the word channel implies an +internal channel. + +When both internal channels are enabled they need to be managed together +as one (i.e.) they cannot operate alone as independent devices. Out of the +two, one of them needs to act as a primary device that accepts common +properties of both the internal channels. This channel is identified by a +property called "renesas,primary-bond". + +To summarize, + - When both the internal channels that are bonded together are enabled, + the zeroth channel is selected as primary-bond. This channels accepts + properties common to all the members of the bond. + - When only one of the bonded channels need to be enabled, the property + "renesas,bonding" or "renesas,primary-bond" will have no effect. That + enabled channel can act alone as any other independent device. + +Required properties of an internal channel: +--- +- compatible: "renesas,r8a7795-drif" if DRIF controller is a part of R8A7795 SoC. + "renesas,rcar-gen3-drif" for a generic R-Car Gen3 compatible device. + + When compatible with the generic version, nodes must list the + SoC-specific version corresponding to the platform first + followed by the generic version. + +- reg: offset and length of that channel. +- interrupts: associated with that channel. +- clocks: phandle and clock specifier of that channel. +- clock-names: clock input name string: "fck". +- dmas: phandles to the DMA channels. +- dma-names: names of the DMA channel: "rx". +- renesas,bonding: phandle to the other channel. + +Optional properties of an internal channel: +--- +- power-domains: phandle to the respective power domain. + +Required properties of an internal channel when: + - It is the only enabled channel of the bond (or) + - If it acts as primary among enabled bonds + +- pinctrl-0: pin control group to be used for this channel. +- pinctrl-names: must be "default". +- renesas,primary-bond: empty property indicating the channel acts as primary + among the bonded channels. +- port: child port node corresponding to the data input, in accordance with + the video interface bindings defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. The port + node must contain at least one endpoint. + +Optional endpoint property: +--- +- sync-active: Indicates sync signal polarity, 0/1 for low/high respectively. + This property maps to SYNCAC bit in the hardware manual. The + default is 1 (active high). + +Example: + + +(1) Both internal channels
[PATCH v5 4/7] media: Add new SDR formats PC16, PC18 & PC20
This patch adds support for the three new SDR formats. These formats were prefixed with "planar" indicating I & Q data are not interleaved as in other formats. Here, I & Q data constitutes the top half and bottom half of the received buffer respectively. V4L2_SDR_FMT_PCU16BE - 14-bit complex (I & Q) unsigned big-endian sample inside 16-bit. V4L2 FourCC: PC16 V4L2_SDR_FMT_PCU18BE - 16-bit complex (I & Q) unsigned big-endian sample inside 18-bit. V4L2 FourCC: PC18 V4L2_SDR_FMT_PCU20BE - 18-bit complex (I & Q) unsigned big-endian sample inside 20-bit. V4L2 FourCC: PC20 Signed-off-by: Ramesh Shanmugasundaram --- drivers/media/v4l2-core/v4l2-ioctl.c | 3 +++ include/uapi/linux/videodev2.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index e5a2187381db..ca1e920d3e7c 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1229,6 +1229,9 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_SDR_FMT_CS8: descr = "Complex S8"; break; case V4L2_SDR_FMT_CS14LE: descr = "Complex S14LE"; break; case V4L2_SDR_FMT_RU12LE: descr = "Real U12LE"; break; + case V4L2_SDR_FMT_PCU16BE: descr = "Planar Complex U16BE"; break; + case V4L2_SDR_FMT_PCU18BE: descr = "Planar Complex U18BE"; break; + case V4L2_SDR_FMT_PCU20BE: descr = "Planar Complex U20BE"; break; case V4L2_TCH_FMT_DELTA_TD16: descr = "16-bit signed deltas"; break; case V4L2_TCH_FMT_DELTA_TD08: descr = "8-bit signed deltas"; break; case V4L2_TCH_FMT_TU16: descr = "16-bit unsigned touch data"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 2b8feb86d09e..45cf7359822c 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -669,6 +669,9 @@ struct v4l2_pix_format { #define V4L2_SDR_FMT_CS8 v4l2_fourcc('C', 'S', '0', '8') /* complex s8 */ #define V4L2_SDR_FMT_CS14LE v4l2_fourcc('C', 'S', '1', '4') /* complex s14le */ #define V4L2_SDR_FMT_RU12LE v4l2_fourcc('R', 'U', '1', '2') /* real u12le */ +#define V4L2_SDR_FMT_PCU16BE v4l2_fourcc('P', 'C', '1', '6') /* planar complex u16be */ +#define V4L2_SDR_FMT_PCU18BE v4l2_fourcc('P', 'C', '1', '8') /* planar complex u18be */ +#define V4L2_SDR_FMT_PCU20BE v4l2_fourcc('P', 'C', '2', '0') /* planar complex u20be */ /* Touch formats - used for Touch devices */ #define V4L2_TCH_FMT_DELTA_TD16v4l2_fourcc('T', 'D', '1', '6') /* 16-bit signed deltas */ -- 2.12.2
[PATCH v5 3/7] media: i2c: max2175: Add MAX2175 support
This patch adds driver support for the MAX2175 chip. This is Maxim Integrated's RF to Bits tuner front end chip designed for software-defined radio solutions. This driver exposes the tuner as a sub-device instance with standard and custom controls to configure the device. Signed-off-by: Ramesh Shanmugasundaram --- v5: - sck -> Sample clock is clarified in driver documentation (Hans) - "refout-load-pF" is renamed to "refout-load" as per updated bindings. --- Documentation/media/v4l-drivers/index.rst |1 + Documentation/media/v4l-drivers/max2175.rst | 60 ++ drivers/media/i2c/Kconfig |4 + drivers/media/i2c/Makefile |2 + drivers/media/i2c/max2175/Kconfig |8 + drivers/media/i2c/max2175/Makefile |4 + drivers/media/i2c/max2175/max2175.c | 1437 +++ drivers/media/i2c/max2175/max2175.h | 108 ++ 8 files changed, 1624 insertions(+) create mode 100644 Documentation/media/v4l-drivers/max2175.rst create mode 100644 drivers/media/i2c/max2175/Kconfig create mode 100644 drivers/media/i2c/max2175/Makefile create mode 100644 drivers/media/i2c/max2175/max2175.c create mode 100644 drivers/media/i2c/max2175/max2175.h diff --git a/Documentation/media/v4l-drivers/index.rst b/Documentation/media/v4l-drivers/index.rst index a606d1cdac13..d8cade53d496 100644 --- a/Documentation/media/v4l-drivers/index.rst +++ b/Documentation/media/v4l-drivers/index.rst @@ -42,6 +42,7 @@ For more details see the file COPYING in the source distribution of Linux. davinci-vpbe fimc ivtv +max2175 meye omap3isp omap4_camera diff --git a/Documentation/media/v4l-drivers/max2175.rst b/Documentation/media/v4l-drivers/max2175.rst new file mode 100644 index ..94fb815f043b --- /dev/null +++ b/Documentation/media/v4l-drivers/max2175.rst @@ -0,0 +1,60 @@ +Maxim Integrated MAX2175 RF to bits tuner driver + + +The MAX2175 driver implements the following driver-specific controls: + +``V4L2_CID_MAX2175_I2S_ENABLE`` +--- +Enable/Disable I2S output of the tuner. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``(0)`` + - I2S output is disabled. +* - ``(1)`` + - I2S output is enabled. + +``V4L2_CID_MAX2175_HSLS`` +- +The high-side/low-side (HSLS) control of the tuner for a given band. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``(0)`` + - The LO frequency position is below the desired frequency. +* - ``(1)`` + - The LO frequency position is above the desired frequency. + +``V4L2_CID_MAX2175_RX_MODE (menu)`` +--- +The Rx mode controls a number of preset parameters of the tuner like +sample clock (sck), sampling rate etc. These multiple settings are +provided under one single label called Rx mode in the datasheet. The +list below shows the supported modes with a brief description. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``"Europe modes"`` +* - ``"FM 1.2" (0)`` + - This configures FM band with a sample rate of 0.512 million +samples/sec with a 10.24 MHz sck. +* - ``"DAB 1.2" (1)`` + - This configures VHF band with a sample rate of 2.048 million +samples/sec with a 32.768 MHz sck. + +* - ``"North America modes"`` +* - ``"FM 1.0" (0)`` + - This configures FM band with a sample rate of 0.7441875 million +samples/sec with a 14.88375 MHz sck. +* - ``"DAB 1.2" (1)`` + - This configures FM band with a sample rate of 0.372 million +samples/sec with a 7.441875 MHz sck. diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index b358d1a40688..d9fc1311794f 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -785,6 +785,10 @@ config VIDEO_SAA6752HS To compile this driver as a module, choose M here: the module will be called saa6752hs. +comment "SDR tuner chips" + +source "drivers/media/i2c/max2175/Kconfig" + comment "Miscellaneous helper chips" config VIDEO_THS7303 diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index 62323ec66be8..39567c415425 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -7,6 +7,8 @@ obj-$(CONFIG_VIDEO_CX25840) += cx25840/ obj-$(CONFIG_VIDEO_M5MOLS) += m5mols/ obj-y += soc_camera/ +obj-$(CONFIG_SDR_MAX2175) += max2175/ + obj-$(CONFIG_VIDEO_APTINA_PLL) += aptina-pll.o obj-$(CONFIG_VIDEO_TVAUDIO) += tvaudio.o obj-$(CONFIG_VIDEO_TDA7432) += tda7432.o diff --git a/drivers/media/i2c/max2175/
[PATCH v5 1/7] media: v4l2-ctrls: Reserve controls for MAX217X
Reserve controls for MAX217X RF to Bits tuner family. These hybrid radio receiver chips are highly programmable and hence reserving 32 controls. Signed-off-by: Ramesh Shanmugasundaram Acked-by: Laurent Pinchart --- include/uapi/linux/v4l2-controls.h | 5 + 1 file changed, 5 insertions(+) diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 0d2e1e01fbd5..83b28b41123f 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -180,6 +180,11 @@ enum v4l2_colorfx { * We reserve 16 controls for this driver. */ #define V4L2_CID_USER_TC358743_BASE(V4L2_CID_USER_BASE + 0x1080) +/* The base for the max217x driver controls. + * We reserve 32 controls for this driver + */ +#define V4L2_CID_USER_MAX217X_BASE (V4L2_CID_USER_BASE + 0x1090) + /* MPEG-class control IDs */ /* The MPEG controls are applicable to all codec controls * and the 'MPEG' part of the define is historical */ -- 2.12.2
[PATCH v5 0/7] Add V4L2 SDR (DRIF & MAX2175) driver
or-x:~# [2] "bonding" DT property discussion (https://www.mail-archive.com/linux-renesas-soc@vger.kernel.org/msg09415.html) Ramesh Shanmugasundaram (7): media: v4l2-ctrls: Reserve controls for MAX217X dt-bindings: media: Add MAX2175 binding description media: i2c: max2175: Add MAX2175 support media: Add new SDR formats PC16, PC18 & PC20 doc_rst: media: New SDR formats PC16, PC18 & PC20 dt-bindings: media: Add Renesas R-Car DRIF binding media: platform: rcar_drif: Add DRIF support .../devicetree/bindings/media/i2c/max2175.txt | 61 + .../devicetree/bindings/media/renesas,drif.txt | 177 +++ .../devicetree/bindings/property-units.txt |1 + .../media/uapi/v4l/pixfmt-sdr-pcu16be.rst | 55 + .../media/uapi/v4l/pixfmt-sdr-pcu18be.rst | 55 + .../media/uapi/v4l/pixfmt-sdr-pcu20be.rst | 54 + Documentation/media/uapi/v4l/sdr-formats.rst |3 + Documentation/media/v4l-drivers/index.rst |1 + Documentation/media/v4l-drivers/max2175.rst| 60 + drivers/media/i2c/Kconfig |4 + drivers/media/i2c/Makefile |2 + drivers/media/i2c/max2175/Kconfig |8 + drivers/media/i2c/max2175/Makefile |4 + drivers/media/i2c/max2175/max2175.c| 1437 +++ drivers/media/i2c/max2175/max2175.h| 108 ++ drivers/media/platform/Kconfig | 25 + drivers/media/platform/Makefile|1 + drivers/media/platform/rcar_drif.c | 1488 drivers/media/v4l2-core/v4l2-ioctl.c |3 + include/uapi/linux/v4l2-controls.h |5 + include/uapi/linux/videodev2.h |3 + 21 files changed, 3555 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/max2175.txt create mode 100644 Documentation/devicetree/bindings/media/renesas,drif.txt create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst create mode 100644 Documentation/media/v4l-drivers/max2175.rst create mode 100644 drivers/media/i2c/max2175/Kconfig create mode 100644 drivers/media/i2c/max2175/Makefile create mode 100644 drivers/media/i2c/max2175/max2175.c create mode 100644 drivers/media/i2c/max2175/max2175.h create mode 100644 drivers/media/platform/rcar_drif.c -- 2.12.2
[PATCH v5 2/7] dt-bindings: media: Add MAX2175 binding description
Add device tree binding documentation for MAX2175 RF to bits tuner device. Signed-off-by: Ramesh Shanmugasundaram Acked-by: Rob Herring --- v5: - pF in property-units.txt is renamed to pico-farads (Geert) - "maxim,refout-load-pF" is renamed to "maxim,refout-load". --- .../devicetree/bindings/media/i2c/max2175.txt | 61 ++ .../devicetree/bindings/property-units.txt | 1 + 2 files changed, 62 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/max2175.txt diff --git a/Documentation/devicetree/bindings/media/i2c/max2175.txt b/Documentation/devicetree/bindings/media/i2c/max2175.txt new file mode 100644 index ..dce421857efe --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/max2175.txt @@ -0,0 +1,61 @@ +Maxim Integrated MAX2175 RF to Bits tuner +- + +The MAX2175 IC is an advanced analog/digital hybrid-radio receiver with +RF to Bits® front-end designed for software-defined radio solutions. + +Required properties: + +- compatible: "maxim,max2175" for MAX2175 RF-to-bits tuner. +- clocks: phandle to the fixed xtal clock. +- clock-names: name of the fixed xtal clock, shall be "xtal". +- port: child port node corresponding to the I2S output, in accordance with + the video interface bindings defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. The port + node must contain at least one endpoint. + +Optional properties: + +- maxim,master : phandle to the master tuner if it is a slave. This + is used to define two tuners in diversity mode + (1 master, 1 slave). By default each tuner is an + individual master. +- maxim,refout-load : load capacitance value (in pico-farads) on reference + output drive level. The possible load values are: +0 (default - refout disabled) + 10 + 20 + 30 + 40 + 60 + 70 +- maxim,am-hiz-filter : empty property indicates the AM Hi-Z filter is used + in this hardware for AM antenna input. + +Example: + + +Board specific DTS file + +/* Fixed XTAL clock node */ +maxim_xtal: clock { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <36864000>; +}; + +/* A tuner device instance under i2c bus */ +max2175_0: tuner@60 { + compatible = "maxim,max2175"; + reg = <0x60>; + clocks = <&maxim_xtal>; + clock-names = "xtal"; + maxim,refout-load = <10>; + + port { + max2175_0_ep: endpoint { + remote-endpoint = <&slave_rx_device>; + }; + }; + +}; diff --git a/Documentation/devicetree/bindings/property-units.txt b/Documentation/devicetree/bindings/property-units.txt index 0849618a9df0..2d1d28843c96 100644 --- a/Documentation/devicetree/bindings/property-units.txt +++ b/Documentation/devicetree/bindings/property-units.txt @@ -30,6 +30,7 @@ Electricity -micro-ohms: micro Ohms -microwatt-hours: micro Watt-hours -microvolt : micro volts +-pico-farads : picofarads Temperature -- 2.12.2
[PATCH v4 5/7] doc_rst: media: New SDR formats PC16, PC18 & PC20
This patch adds documentation for the three new SDR formats V4L2_SDR_FMT_PCU16BE V4L2_SDR_FMT_PCU18BE V4L2_SDR_FMT_PCU20BE Signed-off-by: Ramesh Shanmugasundaram --- .../media/uapi/v4l/pixfmt-sdr-pcu16be.rst | 55 ++ .../media/uapi/v4l/pixfmt-sdr-pcu18be.rst | 55 ++ .../media/uapi/v4l/pixfmt-sdr-pcu20be.rst | 54 + Documentation/media/uapi/v4l/sdr-formats.rst | 3 ++ 4 files changed, 167 insertions(+) create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst new file mode 100644 index ..2de1b1a0f517 --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst @@ -0,0 +1,55 @@ +.. -*- coding: utf-8; mode: rst -*- + +.. _V4L2-SDR-FMT-PCU16BE: + +** +V4L2_SDR_FMT_PCU16BE ('PC16') +** + +Planar complex unsigned 16-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadrature (IQ). Both I +and Q are represented as a 16 bit unsigned big endian number stored in +32 bit space. The remaining unused bits within the 32 bit space will be +padded with 0. I value starts first and Q value starts at an offset +equalling half of the buffer size (i.e.) offset = buffersize/2. Out of +the 16 bits, bit 15:2 (14 bit) is data and bit 1:0 (2 bit) can be any +value. + +**Byte Order.** +Each cell is one byte. + +.. flat-table:: +:header-rows: 1 +:stub-columns: 0 + +* - Offset: + - Byte B0 + - Byte B1 + - Byte B2 + - Byte B3 +* - start + 0: + - I'\ :sub:`0[13:6]` + - I'\ :sub:`0[5:0]; B1[1:0]=pad` + - pad + - pad +* - start + 4: + - I'\ :sub:`1[13:6]` + - I'\ :sub:`1[5:0]; B1[1:0]=pad` + - pad + - pad +* - ... +* - start + offset: + - Q'\ :sub:`0[13:6]` + - Q'\ :sub:`0[5:0]; B1[1:0]=pad` + - pad + - pad +* - start + offset + 4: + - Q'\ :sub:`1[13:6]` + - Q'\ :sub:`1[5:0]; B1[1:0]=pad` + - pad + - pad diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst new file mode 100644 index ..da8b26bf6b95 --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst @@ -0,0 +1,55 @@ +.. -*- coding: utf-8; mode: rst -*- + +.. _V4L2-SDR-FMT-PCU18BE: + +** +V4L2_SDR_FMT_PCU18BE ('PC18') +** + +Planar complex unsigned 18-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadrature (IQ). Both I +and Q are represented as a 18 bit unsigned big endian number stored in +32 bit space. The remaining unused bits within the 32 bit space will be +padded with 0. I value starts first and Q value starts at an offset +equalling half of the buffer size (i.e.) offset = buffersize/2. Out of +the 18 bits, bit 17:2 (16 bit) is data and bit 1:0 (2 bit) can be any +value. + +**Byte Order.** +Each cell is one byte. + +.. flat-table:: +:header-rows: 1 +:stub-columns: 0 + +* - Offset: + - Byte B0 + - Byte B1 + - Byte B2 + - Byte B3 +* - start + 0: + - I'\ :sub:`0[17:10]` + - I'\ :sub:`0[9:2]` + - I'\ :sub:`0[1:0]; B2[5:0]=pad` + - pad +* - start + 4: + - I'\ :sub:`1[17:10]` + - I'\ :sub:`1[9:2]` + - I'\ :sub:`1[1:0]; B2[5:0]=pad` + - pad +* - ... +* - start + offset: + - Q'\ :sub:`0[17:10]` + - Q'\ :sub:`0[9:2]` + - Q'\ :sub:`0[1:0]; B2[5:0]=pad` + - pad +* - start + offset + 4: + - Q'\ :sub:`1[17:10]` + - Q'\ :sub:`1[9:2]` + - Q'\ :sub:`1[1:0]; B2[5:0]=pad` + - pad diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst new file mode 100644 index ..5499eed39477 --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst @@ -0,0 +1,54 @@ +.. -*- coding: utf-8; mode: rst -*- +.. _V4L2-SDR-FMT-PCU20BE: + +** +V4L2_SDR_FMT_PCU20BE ('PC20') +** + +Planar complex unsigned 20-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadra
[PATCH v4 7/7] media: platform: rcar_drif: Add DRIF support
This patch adds Digital Radio Interface (DRIF) support to R-Car Gen3 SoCs. The driver exposes each instance of DRIF as a V4L2 SDR device. A DRIF device represents a channel and each channel can have one or two sub-channels respectively depending on the target board. DRIF supports only Rx functionality. It receives samples from a RF frontend tuner chip it is interfaced with. The combination of DRIF and the tuner device, which is registered as a sub-device, determines the receive sample rate and format. In order to be compliant as a V4L2 SDR device, DRIF needs to bind with the tuner device, which can be provided by a third party vendor. DRIF acts as a slave device and the tuner device acts as a master transmitting the samples. The driver allows asynchronous binding of a tuner device that is registered as a v4l2 sub-device. The driver can learn about the tuner it is interfaced with based on port endpoint properties of the device in device tree. The V4L2 SDR device inherits the controls exposed by the tuner device. The device can also be configured to use either one or both of the data pins at runtime based on the master (tuner) configuration. Signed-off-by: Ramesh Shanmugasundaram --- v4: - Number of agreed review comments from Laurent are addressed. (https://www.mail-archive.com/linux-renesas-soc@vger.kernel.org/msg13340.html) --- drivers/media/platform/Kconfig | 25 + drivers/media/platform/Makefile|1 + drivers/media/platform/rcar_drif.c | 1488 3 files changed, 1514 insertions(+) create mode 100644 drivers/media/platform/rcar_drif.c diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 73c3bc5deadf..433397802ef2 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -520,3 +520,28 @@ menuconfig DVB_PLATFORM_DRIVERS if DVB_PLATFORM_DRIVERS source "drivers/media/platform/sti/c8sectpfe/Kconfig" endif #DVB_PLATFORM_DRIVERS + +menuconfig SDR_PLATFORM_DRIVERS + bool "SDR platform devices" + depends on MEDIA_SDR_SUPPORT + default n + ---help--- + Say Y here to enable support for platform-specific SDR Drivers. + +if SDR_PLATFORM_DRIVERS + +config VIDEO_RCAR_DRIF + tristate "Renesas Digitial Radio Interface (DRIF)" + depends on VIDEO_V4L2 && HAS_DMA + depends on ARCH_RENESAS + select VIDEOBUF2_VMALLOC + ---help--- + Say Y if you want to enable R-Car Gen3 DRIF support. DRIF is Digital + Radio Interface that interfaces with an RF front end chip. It is a + receiver of digital data which uses DMA to transfer received data to + a configured location for an application to use. + + To compile this driver as a module, choose M here; the module + will be called rcar_drif. + +endif # SDR_PLATFORM_DRIVERS diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index 63303d63c64c..6349698bb37a 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -52,6 +52,7 @@ obj-$(CONFIG_VIDEO_SH_VOU)+= sh_vou.o obj-$(CONFIG_SOC_CAMERA) += soc_camera/ +obj-$(CONFIG_VIDEO_RCAR_DRIF) += rcar_drif.o obj-$(CONFIG_VIDEO_RENESAS_FCP)+= rcar-fcp.o obj-$(CONFIG_VIDEO_RENESAS_FDP1) += rcar_fdp1.o obj-$(CONFIG_VIDEO_RENESAS_JPU)+= rcar_jpu.o diff --git a/drivers/media/platform/rcar_drif.c b/drivers/media/platform/rcar_drif.c new file mode 100644 index ..d357e247f339 --- /dev/null +++ b/drivers/media/platform/rcar_drif.c @@ -0,0 +1,1488 @@ +/* + * R-Car Gen3 Digital Radio Interface (DRIF) driver + * + * Copyright (C) 2017 Renesas Electronics Corporation + * + * 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. + */ + +/* + * The R-Car DRIF is a receive only MSIOF like controller with an + * external master device driving the SCK. It receives data into a FIFO, + * then this driver uses the SYS-DMAC engine to move the data from + * the device to memory. + * + * Each DRIF channel DRIFx (as per datasheet) contains two internal + * channels DRIFx0 & DRIFx1 within itself with each having its own resources + * like module clk, register set, irq and dma. These internal channels share + * common CLK & SYNC from master. The two data pins D0 & D1 shall be + * considered to represent the two internal channels. This internal split + * is not visible to the master device. + * + * Depending on the m
[PATCH v4 4/7] media: Add new SDR formats PC16, PC18 & PC20
This patch adds support for the three new SDR formats. These formats were prefixed with "planar" indicating I & Q data are not interleaved as in other formats. Here, I & Q data constitutes the top half and bottom half of the received buffer respectively. V4L2_SDR_FMT_PCU16BE - 14-bit complex (I & Q) unsigned big-endian sample inside 16-bit. V4L2 FourCC: PC16 V4L2_SDR_FMT_PCU18BE - 16-bit complex (I & Q) unsigned big-endian sample inside 18-bit. V4L2 FourCC: PC18 V4L2_SDR_FMT_PCU20BE - 18-bit complex (I & Q) unsigned big-endian sample inside 20-bit. V4L2 FourCC: PC20 Signed-off-by: Ramesh Shanmugasundaram --- drivers/media/v4l2-core/v4l2-ioctl.c | 3 +++ include/uapi/linux/videodev2.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index e5a2187381db..ca1e920d3e7c 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1229,6 +1229,9 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_SDR_FMT_CS8: descr = "Complex S8"; break; case V4L2_SDR_FMT_CS14LE: descr = "Complex S14LE"; break; case V4L2_SDR_FMT_RU12LE: descr = "Real U12LE"; break; + case V4L2_SDR_FMT_PCU16BE: descr = "Planar Complex U16BE"; break; + case V4L2_SDR_FMT_PCU18BE: descr = "Planar Complex U18BE"; break; + case V4L2_SDR_FMT_PCU20BE: descr = "Planar Complex U20BE"; break; case V4L2_TCH_FMT_DELTA_TD16: descr = "16-bit signed deltas"; break; case V4L2_TCH_FMT_DELTA_TD08: descr = "8-bit signed deltas"; break; case V4L2_TCH_FMT_TU16: descr = "16-bit unsigned touch data"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 2b8feb86d09e..45cf7359822c 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -669,6 +669,9 @@ struct v4l2_pix_format { #define V4L2_SDR_FMT_CS8 v4l2_fourcc('C', 'S', '0', '8') /* complex s8 */ #define V4L2_SDR_FMT_CS14LE v4l2_fourcc('C', 'S', '1', '4') /* complex s14le */ #define V4L2_SDR_FMT_RU12LE v4l2_fourcc('R', 'U', '1', '2') /* real u12le */ +#define V4L2_SDR_FMT_PCU16BE v4l2_fourcc('P', 'C', '1', '6') /* planar complex u16be */ +#define V4L2_SDR_FMT_PCU18BE v4l2_fourcc('P', 'C', '1', '8') /* planar complex u18be */ +#define V4L2_SDR_FMT_PCU20BE v4l2_fourcc('P', 'C', '2', '0') /* planar complex u20be */ /* Touch formats - used for Touch devices */ #define V4L2_TCH_FMT_DELTA_TD16v4l2_fourcc('T', 'D', '1', '6') /* 16-bit signed deltas */ -- 2.12.2
[PATCH v4 2/7] dt-bindings: media: Add MAX2175 binding description
Add device tree binding documentation for MAX2175 RF to bits tuner device. Signed-off-by: Ramesh Shanmugasundaram Acked-by: Rob Herring --- v4: - port property description modified as suggested by Laurent. - Renamed property name slave to master (Laurent). - Renamed property name am-hiz to am-hiz-filter and modified description. --- .../devicetree/bindings/media/i2c/max2175.txt | 61 ++ .../devicetree/bindings/property-units.txt | 1 + 2 files changed, 62 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/max2175.txt diff --git a/Documentation/devicetree/bindings/media/i2c/max2175.txt b/Documentation/devicetree/bindings/media/i2c/max2175.txt new file mode 100644 index ..a5e3bc8f6753 --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/max2175.txt @@ -0,0 +1,61 @@ +Maxim Integrated MAX2175 RF to Bits tuner +- + +The MAX2175 IC is an advanced analog/digital hybrid-radio receiver with +RF to Bits® front-end designed for software-defined radio solutions. + +Required properties: + +- compatible: "maxim,max2175" for MAX2175 RF-to-bits tuner. +- clocks: phandle to the fixed xtal clock. +- clock-names: name of the fixed xtal clock, shall be "xtal". +- port: child port node corresponding to the I2S output, in accordance with + the video interface bindings defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. The port + node must contain at least one endpoint. + +Optional properties: + +- maxim,master : phandle to the master tuner if it is a slave. This + is used to define two tuners in diversity mode + (1 master, 1 slave). By default each tuner is an + individual master. +- maxim,refout-load-pF: load capacitance value (in pF) on reference + output drive level. The possible load values are: +0 (default - refout disabled) + 10 + 20 + 30 + 40 + 60 + 70 +- maxim,am-hiz-filter : empty property indicates the AM Hi-Z filter is used + in this hardware for AM antenna input. + +Example: + + +Board specific DTS file + +/* Fixed XTAL clock node */ +maxim_xtal: clock { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <36864000>; +}; + +/* A tuner device instance under i2c bus */ +max2175_0: tuner@60 { + compatible = "maxim,max2175"; + reg = <0x60>; + clocks = <&maxim_xtal>; + clock-names = "xtal"; + maxim,refout-load-pF = <10>; + + port { + max2175_0_ep: endpoint { + remote-endpoint = <&slave_rx_device>; + }; + }; + +}; diff --git a/Documentation/devicetree/bindings/property-units.txt b/Documentation/devicetree/bindings/property-units.txt index 12278d79f6c0..f1f1c22aa5de 100644 --- a/Documentation/devicetree/bindings/property-units.txt +++ b/Documentation/devicetree/bindings/property-units.txt @@ -28,6 +28,7 @@ Electricity -ohms : Ohms -micro-ohms: micro Ohms -microvolt : micro volts +-pF: pico farads Temperature -- 2.12.2
[PATCH v4 6/7] dt-bindings: media: Add Renesas R-Car DRIF binding
Add binding documentation for Renesas R-Car Digital Radio Interface (DRIF) controller. Signed-off-by: Ramesh Shanmugasundaram --- v4: - port property description modified as suggested by Laurent. - removed renesas vendor tag from sync-active end-point property (Rob) --- .../devicetree/bindings/media/renesas,drif.txt | 187 + 1 file changed, 187 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/renesas,drif.txt diff --git a/Documentation/devicetree/bindings/media/renesas,drif.txt b/Documentation/devicetree/bindings/media/renesas,drif.txt new file mode 100644 index ..12428f969958 --- /dev/null +++ b/Documentation/devicetree/bindings/media/renesas,drif.txt @@ -0,0 +1,187 @@ +Renesas R-Car Gen3 Digital Radio Interface controller (DRIF) + + +R-Car Gen3 DRIF is a SPI like receive only slave device. A general +representation of DRIF interfacing with a master device is shown below. + ++-++-+ +| |-SCK--->|CLK | +| Master|-SS>|SYNC DRIFn (slave) | +| |-SD0--->|D0 | +| |-SD1--->|D1 | ++-++-+ + +As per datasheet, each DRIF channel (drifn) is made up of two internal +channels (drifn0 & drifn1). These two internal channels share the common +CLK & SYNC. Each internal channel has its own dedicated resources like +irq, dma channels, address space & clock. This internal split is not +visible to the external master device. + +The device tree model represents each internal channel as a separate node. +The internal channels sharing the CLK & SYNC are tied together by their +phandles using a new property called "renesas,bonding". For the rest of +the documentation, unless explicitly stated, the word channel implies an +internal channel. + +When both internal channels are enabled they need to be managed together +as one (i.e.) they cannot operate alone as independent devices. Out of the +two, one of them needs to act as a primary device that accepts common +properties of both the internal channels. This channel is identified by a +new property called "renesas,primary-bond". + +To summarize, + - When both the internal channels that are bonded together are enabled, + the zeroth channel is selected as primary-bond. This channels accepts + properties common to all the members of the bond. + - When only one of the bonded channels need to be enabled, the property + "renesas,bonding" or "renesas,primary-bond" will have no effect. That + enabled channel can act alone as any other independent device. + +Required properties of an internal channel: +--- +- compatible: "renesas,r8a7795-drif" if DRIF controller is a part of R8A7795 SoC. + "renesas,rcar-gen3-drif" for a generic R-Car Gen3 compatible device. + When compatible with the generic version, nodes must list the + SoC-specific version corresponding to the platform first + followed by the generic version. +- reg: offset and length of that channel. +- interrupts: associated with that channel. +- clocks: phandle and clock specifier of that channel. +- clock-names: clock input name string: "fck". +- dmas: phandles to the DMA channels. +- dma-names: names of the DMA channel: "rx". +- renesas,bonding: phandle to the other channel. + +Optional properties of an internal channel: +--- +- power-domains: phandle to the respective power domain. + +Required properties of an internal channel when: + - It is the only enabled channel of the bond (or) + - If it acts as primary among enabled bonds + +- pinctrl-0: pin control group to be used for this channel. +- pinctrl-names: must be "default". +- renesas,primary-bond: empty property indicating the channel acts as primary + among the bonded channels. +- port: child port node corresponding to the data input, in accordance with + the video interface bindings defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. The port + node must contain at least one endpoint. + +Optional endpoint property: +--- +- sync-active: Indicates sync signal polarity, 0/1 for low/high respectively. + This property maps to SYNCAC bit in the hardware manual. The + default is 1 (active high). + +Example + + +SoC common dtsi file + + drif00: rif@e6f4 { + compatible = "renesas,r8a77
[PATCH v4 3/7] media: i2c: max2175: Add MAX2175 support
This patch adds driver support for the MAX2175 chip. This is Maxim Integrated's RF to Bits tuner front end chip designed for software-defined radio solutions. This driver exposes the tuner as a sub-device instance with standard and custom controls to configure the device. Signed-off-by: Ramesh Shanmugasundaram --- v4: - Addressed v4l2_ctrl name string convention (Hans) - "HSLS above/below" to "HSLS Above/Below" - "RX MODE" to "RX Mode" --- Documentation/media/v4l-drivers/index.rst |1 + Documentation/media/v4l-drivers/max2175.rst | 60 ++ drivers/media/i2c/Kconfig |4 + drivers/media/i2c/Makefile |2 + drivers/media/i2c/max2175/Kconfig |8 + drivers/media/i2c/max2175/Makefile |4 + drivers/media/i2c/max2175/max2175.c | 1437 +++ drivers/media/i2c/max2175/max2175.h | 108 ++ 8 files changed, 1624 insertions(+) create mode 100644 Documentation/media/v4l-drivers/max2175.rst create mode 100644 drivers/media/i2c/max2175/Kconfig create mode 100644 drivers/media/i2c/max2175/Makefile create mode 100644 drivers/media/i2c/max2175/max2175.c create mode 100644 drivers/media/i2c/max2175/max2175.h diff --git a/Documentation/media/v4l-drivers/index.rst b/Documentation/media/v4l-drivers/index.rst index a606d1cdac13..d8cade53d496 100644 --- a/Documentation/media/v4l-drivers/index.rst +++ b/Documentation/media/v4l-drivers/index.rst @@ -42,6 +42,7 @@ For more details see the file COPYING in the source distribution of Linux. davinci-vpbe fimc ivtv +max2175 meye omap3isp omap4_camera diff --git a/Documentation/media/v4l-drivers/max2175.rst b/Documentation/media/v4l-drivers/max2175.rst new file mode 100644 index ..201af8f217e9 --- /dev/null +++ b/Documentation/media/v4l-drivers/max2175.rst @@ -0,0 +1,60 @@ +Maxim Integrated MAX2175 RF to bits tuner driver + + +The MAX2175 driver implements the following driver-specific controls: + +``V4L2_CID_MAX2175_I2S_ENABLE`` +--- +Enable/Disable I2S output of the tuner. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``(0)`` + - I2S output is disabled. +* - ``(1)`` + - I2S output is enabled. + +``V4L2_CID_MAX2175_HSLS`` +- +The high-side/low-side (HSLS) control of the tuner for a given band. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``(0)`` + - The LO frequency position is below the desired frequency. +* - ``(1)`` + - The LO frequency position is above the desired frequency. + +``V4L2_CID_MAX2175_RX_MODE (menu)`` +--- +The Rx mode controls a number of preset parameters of the tuner like sck +rate, sampling rate etc. These multiple settings are provided under one +single label called Rx mode in the datasheet. The list below shows the +supported modes with a brief description. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``"Europe modes"`` +* - ``"FM 1.2" (0)`` + - This configures FM band with a sample rate of 0.512 million +samples/sec with a 10.24 MHz sck. +* - ``"DAB 1.2" (1)`` + - This configures VHF band with a sample rate of 2.048 million +samples/sec with a 32.768 MHz sck. + +* - ``"North America modes"`` +* - ``"FM 1.0" (0)`` + - This configures FM band with a sample rate of 0.7441875 million +samples/sec with a 14.88375 MHz sck. +* - ``"DAB 1.2" (1)`` + - This configures FM band with a sample rate of 0.372 million +samples/sec with a 7.441875 MHz sck. diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index b358d1a40688..d9fc1311794f 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -785,6 +785,10 @@ config VIDEO_SAA6752HS To compile this driver as a module, choose M here: the module will be called saa6752hs. +comment "SDR tuner chips" + +source "drivers/media/i2c/max2175/Kconfig" + comment "Miscellaneous helper chips" config VIDEO_THS7303 diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index 62323ec66be8..39567c415425 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -7,6 +7,8 @@ obj-$(CONFIG_VIDEO_CX25840) += cx25840/ obj-$(CONFIG_VIDEO_M5MOLS) += m5mols/ obj-y += soc_camera/ +obj-$(CONFIG_SDR_MAX2175) += max2175/ + obj-$(CONFIG_VIDEO_APTINA_PLL) += aptina-pll.o obj-$(CONFIG_VIDEO_TVAUDIO) += tvaudio.o obj-$(CONFIG_VIDEO_TDA7432) += tda7432.o diff --git a/drivers/media/i2c/max2175/K
[PATCH v4 1/7] media: v4l2-ctrls: Reserve controls for MAX217X
Reserve controls for MAX217X RF to Bits tuner family. These hybrid radio receiver chips are highly programmable and hence reserving 32 controls. Signed-off-by: Ramesh Shanmugasundaram Acked-by: Laurent Pinchart --- include/uapi/linux/v4l2-controls.h | 5 + 1 file changed, 5 insertions(+) diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 0d2e1e01fbd5..83b28b41123f 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -180,6 +180,11 @@ enum v4l2_colorfx { * We reserve 16 controls for this driver. */ #define V4L2_CID_USER_TC358743_BASE(V4L2_CID_USER_BASE + 0x1080) +/* The base for the max217x driver controls. + * We reserve 32 controls for this driver + */ +#define V4L2_CID_USER_MAX217X_BASE (V4L2_CID_USER_BASE + 0x1090) + /* MPEG-class control IDs */ /* The MPEG controls are applicable to all codec controls * and the 'MPEG' part of the define is historical */ -- 2.12.2
[PATCH v4 0/7] Add V4L2 SDR (DRIF & MAX2175) driver
Hi Media, DT maintainers, All, This patch set contains two drivers - Renesas R-Car Digital Radio Interface (DRIF) driver - Maxim's MAX2175 RF to Bits tuner driver These patches were based on top of media-next repo commit:6d95b3f24881c0fd0f345eca959a2a803a040930 These two drivers combined together expose a V4L2 SDR device that is compliant with the V4L2 framework [1]. Agreed review comments are incorporated in this series. The rcar_drif device is modelled using "renesas,bonding" property. The discussion on this property is available here [2]. Change history: v3 -> v4: - Added ACKs rcar_drif: - Incorporated a number of review comments from Laurent on DRIF driver. - Addressed comments from Rob and Laurent on bindings. max2175: - Minor changes addressing Hans and Laurent's comments v2 -> v3: rcar_drif: - Reduced DRIF DT properties to expose tested I2S mode only (Hans - discussion on #v4l) - Fixed error path clean up of ctrl_hdl on rcar_drif v1 -> v2: - SDR formats renamed as "planar" instead of sliced (Hans) - Documentation formatting correction (Laurent) rcar_drif: - DT model using "bonding" property - Addressed Laurent's coments on bindings - DT optional parameters rename & rework - Addressed Han's comments on driver - Addressed Geert's comments on DT max2175: - Avoided scaling using method proposed by Antti. Thanks - Bindings is a separate patch (Rob) - Addressed Rob's comment on bindings - Added Custom controls documentation (Laurent) [1] v4l2-compliance report: root@salvator-x:~# v4l2-compliance -S /dev/swradio0 v4l2-compliance SHA : b514d615166bdc0901a4c71261b87db31e89f464 Driver Info: Driver name : rcar_drif Card type : R-Car DRIF Bus info : platform:R-Car DRIF Driver version: 4.11.0 Capabilities : 0x8531 SDR Capture Tuner Read/Write Streaming Extended Pix Format Device Capabilities Device Caps : 0x0531 SDR Capture Tuner Read/Write Streaming Extended Pix Format Compliance test for device /dev/swradio0 (not using libv4l2): Required ioctls: test VIDIOC_QUERYCAP: OK Allow for multiple opens: test second sdr open: OK test VIDIOC_QUERYCAP: OK test VIDIOC_G/S_PRIORITY: OK test for unlimited opens: OK Debug ioctls: test VIDIOC_DBG_G/S_REGISTER: OK test VIDIOC_LOG_STATUS: OK Input ioctls: test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK test VIDIOC_G/S_FREQUENCY: OK test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported) test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported) Inputs: 0 Audio Inputs: 0 Tuners: 1 Output ioctls: test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported) Outputs: 0 Audio Outputs: 0 Modulators: 0 Input/Output configuration ioctls: test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported) Control ioctls: test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK test VIDIOC_G/S_CTRL: OK test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 5 Private Controls: 3 Format ioctls: test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK test VIDIOC_TRY_FMT: OK test VIDIOC_S_FMT: OK test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported) test Composing: OK (Not Supported) test Scaling: OK (Not Supported) Codec ioctls: test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported) Buffer ioctls: test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test VIDIOC_EXPBUF: OK (Not Supported) Test input 0: Total: 43, Succeeded: 43, Failed: 0, Warnings: 0 root@salvator-x:~# [2] "bonding" DT property discussion (ht
RE: [PATCH v3 5/7] doc_rst: media: New SDR formats PC16, PC18 & PC20
Hi Laurent, Thanks for the review comments. > On Tuesday 07 Feb 2017 15:02:35 Ramesh Shanmugasundaram wrote: > > This patch adds documentation for the three new SDR formats > > > > V4L2_SDR_FMT_PCU16BE > > V4L2_SDR_FMT_PCU18BE > > V4L2_SDR_FMT_PCU20BE > > > > Signed-off-by: Ramesh Shanmugasundaram > > --- > > .../media/uapi/v4l/pixfmt-sdr-pcu16be.rst | 55 > +++ > > .../media/uapi/v4l/pixfmt-sdr-pcu18be.rst | 55 > +++ > > .../media/uapi/v4l/pixfmt-sdr-pcu20be.rst | 54 > +++ > > Documentation/media/uapi/v4l/sdr-formats.rst | 3 ++ > > 4 files changed, 167 insertions(+) > > create mode 100644 > > Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst > > create mode 100644 > > Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst > > create mode 100644 > > Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst > > > > diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst > > b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst new file mode > > 100644 index 000..2de1b1a > > --- /dev/null > > +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst > > @@ -0,0 +1,55 @@ > > +.. -*- coding: utf-8; mode: rst -*- > > + > > +.. _V4L2-SDR-FMT-PCU16BE: > > + > > +** > > +V4L2_SDR_FMT_PCU16BE ('PC16') > > +** > > + > > +Planar complex unsigned 16-bit big endian IQ sample > > + > > +Description > > +=== > > + > > +This format contains a sequence of complex number samples. Each > > +complex number consist of two parts called In-phase and Quadrature > > +(IQ). Both I and Q are represented as a 16 bit unsigned big endian > > +number stored in > > +32 bit space. The remaining unused bits within the 32 bit space will > > +be padded with 0. I value starts first and Q value starts at an > > +offset equalling half of the buffer size (i.e.) offset = > > +buffersize/2. Out of the 16 bits, bit 15:2 (14 bit) is data and bit > > +1:0 (2 bit) can be any value. > > This sounds very strange to me. Are the two lower bits always random ? > What is that used for ? It could be zeros or it could be status bits in case of MAX2175 (if enabled). I mentioned any value because the user app does not have any assumptions on these bits value. > > > +**Byte Order.** > > +Each cell is one byte. > > + > > +.. flat-table:: > > +:header-rows: 1 > > +:stub-columns: 0 > > + > > +* - Offset: > > + - Byte B0 > > + - Byte B1 > > + - Byte B2 > > + - Byte B3 > > +* - start + 0: > > + - I'\ :sub:`0[13:6]` > > + - I'\ :sub:`0[5:0]; B1[1:0]=pad` > > + - pad > > + - pad > > +* - start + 4: > > + - I'\ :sub:`1[13:6]` > > + - I'\ :sub:`1[5:0]; B1[1:0]=pad` > > + - pad > > + - pad > > +* - ... > > +* - start + offset: > > + - Q'\ :sub:`0[13:6]` > > + - Q'\ :sub:`0[5:0]; B1[1:0]=pad` > > + - pad > > + - pad > > +* - start + offset + 4: > > + - Q'\ :sub:`1[13:6]` > > + - Q'\ :sub:`1[5:0]; B1[1:0]=pad` > > + - pad > > + - pad > > diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst > > b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst new file mode > > 100644 index 000..da8b26b > > --- /dev/null > > +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst > > @@ -0,0 +1,55 @@ > > +.. -*- coding: utf-8; mode: rst -*- > > + > > +.. _V4L2-SDR-FMT-PCU18BE: > > + > > +** > > +V4L2_SDR_FMT_PCU18BE ('PC18') > > +** > > + > > +Planar complex unsigned 18-bit big endian IQ sample > > + > > +Description > > +=== > > + > > +This format contains a sequence of complex number samples. Each > > +complex number consist of two parts called In-phase and Quadrature > > +(IQ). Both I and Q are represented as a 18 bit unsigned big endian > > +number stored in > > +32 bit space. The remaining unused bits within the 32 bit space will > > +be padded with 0. I value starts first and Q value starts at an > > +offset equalling half of the buffer size (i.e.) offset = > > +buffersize/2. Out of the 18 bits, bit 17:2 (16 bit) is data and bit > > +1:0 (2
RE: [PATCH v3 7/7] media: platform: rcar_drif: Add DRIF support
Hi Laurent, Many thanks for your time & the review comments. I have agreed to most of the comments and a few need further discussion. Could you please take a look at those? > On Tuesday 07 Feb 2017 15:02:37 Ramesh Shanmugasundaram wrote: > > This patch adds Digital Radio Interface (DRIF) support to R-Car Gen3 > SoCs. > > The driver exposes each instance of DRIF as a V4L2 SDR device. A DRIF > > device represents a channel and each channel can have one or two > > sub-channels respectively depending on the target board. > > > > DRIF supports only Rx functionality. It receives samples from a RF > > frontend tuner chip it is interfaced with. The combination of DRIF and > > the tuner device, which is registered as a sub-device, determines the > > receive sample rate and format. > > > > In order to be compliant as a V4L2 SDR device, DRIF needs to bind with > > the tuner device, which can be provided by a third party vendor. DRIF > > acts as a slave device and the tuner device acts as a master > > transmitting the samples. The driver allows asynchronous binding of a > > tuner device that is registered as a v4l2 sub-device. The driver can > > learn about the tuner it is interfaced with based on port endpoint > > properties of the device in device tree. The V4L2 SDR device inherits > > the controls exposed by the tuner device. > > > > The device can also be configured to use either one or both of the > > data pins at runtime based on the master (tuner) configuration. > > > > Signed-off-by: Ramesh Shanmugasundaram > > > > --- > > drivers/media/platform/Kconfig | 25 + > > drivers/media/platform/Makefile|1 + > > drivers/media/platform/rcar_drif.c | 1534 > > + > > 3 files changed, 1560 insertions(+) > > create mode 100644 drivers/media/platform/rcar_drif.c > > [snip] > > > diff --git a/drivers/media/platform/rcar_drif.c > > b/drivers/media/platform/rcar_drif.c new file mode 100644 index > > 000..88950e3 > > --- /dev/null > > +++ b/drivers/media/platform/rcar_drif.c > > @@ -0,0 +1,1534 @@ > > [snip] > > > +/* > > + * The R-Car DRIF is a receive only MSIOF like controller with an > > + * external master device driving the SCK. It receives data into a > > +FIFO, > > + * then this driver uses the SYS-DMAC engine to move the data from > > + * the device to memory. > > + * > > + * Each DRIF channel DRIFx (as per datasheet) contains two internal > > + * channels DRIFx0 & DRIFx1 within itself with each having its own > > resources > > + * like module clk, register set, irq and dma. These internal > > + channels > > share > > + * common CLK & SYNC from master. The two data pins D0 & D1 shall be > > + * considered to represent the two internal channels. This internal > > + split > > + * is not visible to the master device. > > + * > > + * Depending on the master device, a DRIF channel can use > > + * (1) both internal channels (D0 & D1) to receive data in parallel > > + (or) > > + * (2) one internal channel (D0 or D1) to receive data > > + * > > + * The primary design goal of this controller is to act as Digitial > > + Radio > > s/Digitial/Digital/ Agreed > > > + * Interface that receives digital samples from a tuner device. Hence > > + the > > + * driver exposes the device as a V4L2 SDR device. In order to > > + qualify as > > + * a V4L2 SDR device, it should possess tuner interface as mandated > > + by the > > + * framework. This driver expects a tuner driver (sub-device) to bind > > + * asynchronously with this device and the combined drivers shall > > + expose > > + * a V4L2 compliant SDR device. The DRIF driver is independent of the > > + * tuner vendor. > > + * > > + * The DRIF h/w can support I2S mode and Frame start synchronization > > + pulse > > mode. > > + * This driver is tested for I2S mode only because of the > > + availability of > > + * suitable master devices. Hence, not all configurable options of > > + DRIF h/w > > + * like lsb/msb first, syncdl, dtdl etc. are exposed via DT and I2S > > defaults > > + * are used. These can be exposed later if needed after testing. > > + */ > > [snip] > > > +#define to_rcar_drif_buf_pair(sdr, ch_num, > > idx)(sdr->ch[!(ch_num)]->buf[idx]) > > You should enclose both sdr and idx in parenthesis, as they can be > expressions. Agreed. > > > + > > +#define for_each_rcar_drif_channel(ch, ch_mask)
RE: [PATCH v3 2/7] dt-bindings: media: Add MAX2175 binding description
Hi Laurent, > On Tuesday 11 Apr 2017 09:57:45 Ramesh Shanmugasundaram wrote: > > > On Tuesday 07 Feb 2017 15:02:32 Ramesh Shanmugasundaram wrote: > > >> Add device tree binding documentation for MAX2175 Rf to bits tuner > > >> device. > > >> > > >> Signed-off-by: Ramesh Shanmugasundaram > > >> --- > > >> > > >> .../devicetree/bindings/media/i2c/max2175.txt | 61 > +++ > > >> .../devicetree/bindings/property-units.txt | 1 + > > >> 2 files changed, 62 insertions(+) > > >> create mode 100644 > > >> > > >> Documentation/devicetree/bindings/media/i2c/max2175.txt > > >> > > >> diff --git > > >> a/Documentation/devicetree/bindings/media/i2c/max2175.txt > > >> b/Documentation/devicetree/bindings/media/i2c/max2175.txt new file > > >> mode 100644 index 000..f591ab4 > > >> --- /dev/null > > >> +++ b/Documentation/devicetree/bindings/media/i2c/max2175.txt > > [snip] > > > >> +- maxim,am-hiz: empty property indicates AM Hi-Z filter > path > > >> is > > >> +selected for AM antenna input. By default this > > >> +filter path is not used. > > > > > > Isn't this something that should be selected at runtime through a > > > control ? Or does the hardware design dictate whether the filter has > > > to be used or must not be used ? > > > > This is dictated by the h/w design and not selectable at run-time. > > I will update these changes in the next patchset. > > In that case I'm fine with a property, but could we name it in such a way > that it describes the hardware instead of instructing the software on how > to configure the device ? For instance (and this is a made-up example as I > don't know exactly how this works), if the AM Hi-Z filter is required when > dealing with AM frequencies and forbidden when dealing with other > frequency bands, and > *if* boards have to be designed specifically for one frequency band (AM, > FM, VHF, L, ...) without any way to accept different bands, then you could > instead use > > maxim,frequency-band = "AM"; > > and enable the filter accordingly in the driver. This would be in my > opinion a better system hardware description. I am not sure. The AM antenna input path has a default filter and AM Hi-Z filter. H/W dictates the path to be used for AM input only and this is fixed. The device can be configured to use different bands at runtime & not AM only. I could edit the description as below: - maxim,am-hiz: empty property indicates AM Hi-Z filter path usage for AM antenna input as dictated by hardware design. By default this filter path is not used. Is it any better? Do you still think the property name should be changed please? Thanks, Ramesh
RE: [PATCH v3 2/7] dt-bindings: media: Add MAX2175 binding description
Hi Laurent, Thanks for the review comments. > > On Tuesday 07 Feb 2017 15:02:32 Ramesh Shanmugasundaram wrote: > > Add device tree binding documentation for MAX2175 Rf to bits tuner > > device. > > > > Signed-off-by: Ramesh Shanmugasundaram > > --- > > .../devicetree/bindings/media/i2c/max2175.txt | 61 > +++ > > .../devicetree/bindings/property-units.txt | 1 + > > 2 files changed, 62 insertions(+) > > create mode 100644 > > Documentation/devicetree/bindings/media/i2c/max2175.txt > > > > diff --git a/Documentation/devicetree/bindings/media/i2c/max2175.txt > > b/Documentation/devicetree/bindings/media/i2c/max2175.txt new file > > mode > > 100644 > > index 000..f591ab4 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/media/i2c/max2175.txt > > @@ -0,0 +1,61 @@ > > +Maxim Integrated MAX2175 RF to Bits tuner > > +- > > + > > +The MAX2175 IC is an advanced analog/digital hybrid-radio receiver > > +with RF to Bits(r) front-end designed for software-defined radio > solutions. > > + > > +Required properties: > > + > > +- compatible: "maxim,max2175" for MAX2175 RF-to-bits tuner. > > +- clocks: phandle to the fixed xtal clock. > > +- clock-names: name of the fixed xtal clock. > > I would mention that the name has to be "xtal". Maybe something like > > - clock-names: name of the fixed xtal clock, shall be "xtal". Agreed. > > > +- port: child port node of a tuner that defines the local and remote > > + endpoints. The remote endpoint is assumed to be an SDR device > > + that is capable of receiving the digital samples from the tuner. > > You should refer to the OF graphs bindings here. How about the following > to document the port node ? > > - port: child port node corresponding to the I2S output, in accordance > with the video interface bindings defined in > Documentation/devicetree/bindings/media/video-interfaces.txt. The port > node must contain at least one endpoint. Agreed. > > > +Optional properties: > > + > > +- maxim,slave: phandle to the master tuner if it is a slave. > This > > + is used to define two tuners in diversity mode > > + (1 master, 1 slave). By default each tuner is an > > + individual master. > > It seems weird to me to name a property "slave" when it points to the > master tuner. Shouldn't it be named "maxim,master" ? Agreed. > > > +- maxim,refout-load-pF: load capacitance value (in pF) on reference > > + output drive level. The possible load values are > > +0 (default - refout disabled) > > + 10 > > + 20 > > + 30 > > + 40 > > + 60 > > + 70 > > +- maxim,am-hiz : empty property indicates AM Hi-Z filter path > is > > + selected for AM antenna input. By default this > > + filter path is not used. > > Isn't this something that should be selected at runtime through a control > ? Or does the hardware design dictate whether the filter has to be used or > must not be used ? This is dictated by the h/w design and not selectable at run-time. I will update these changes in the next patchset. Thanks, Ramesh
RE: [PATCH v3 6/7] dt-bindings: media: Add Renesas R-Car DRIF binding
Hi Rob, Thank you for the review comments. > Subject: Re: [PATCH v3 6/7] dt-bindings: media: Add Renesas R-Car DRIF > binding > > On Tue, Feb 07, 2017 at 03:02:36PM +0000, Ramesh Shanmugasundaram wrote: > > Add binding documentation for Renesas R-Car Digital Radio Interface > > (DRIF) controller. > > > > Signed-off-by: Ramesh Shanmugasundaram > > > > --- > > .../devicetree/bindings/media/renesas,drif.txt | 186 > + > > 1 file changed, 186 insertions(+) > > create mode 100644 > > Documentation/devicetree/bindings/media/renesas,drif.txt > > > > diff --git a/Documentation/devicetree/bindings/media/renesas,drif.txt > > b/Documentation/devicetree/bindings/media/renesas,drif.txt > > new file mode 100644 > > index 000..6315609 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/media/renesas,drif.txt > > @@ -0,0 +1,186 @@ > > +Renesas R-Car Gen3 Digital Radio Interface controller (DRIF) > > + > > + > > +R-Car Gen3 DRIF is a SPI like receive only slave device. A general > > +representation of DRIF interfacing with a master device is shown below. > > + > > ++-++-+ > > +| |-SCK--->|CLK | > > +| Master|-SS>|SYNC DRIFn (slave) | > > +| |-SD0--->|D0 | > > +| |-SD1--->|D1 | > > ++-++-+ > > + > > +As per the datasheet, each DRIF channel (drifn) is made up of two > > +internal channels (drifn0 & drifn1). These two internal channels > > +share the common CLK & SYNC. Each internal channel has its own > > +dedicated resources like irq, dma channels, address space & clock. > > +This internal split is not visible to the external master device. > > + > > +The device tree model represents each internal channel as a separate > node. > > +The internal channels sharing the CLK & SYNC are tied together by > > +their phandles using a new property called "renesas,bonding". For the > > +rest of the documentation, unless explicitly stated, the word channel > > +implies an internal channel. > > + > > +When both internal channels are enabled they need to be managed > > +together as one (i.e.) they cannot operate alone as independent > > +devices. Out of the two, one of them needs to act as a primary device > > +that accepts common properties of both the internal channels. This > > +channel is identified by a new property called "renesas,primary-bond". > > + > > +To summarize, > > + - When both the internal channels that are bonded together are > enabled, > > + the zeroth channel is selected as primary-bond. This channels > accepts > > + properties common to all the members of the bond. > > + - When only one of the bonded channels need to be enabled, the > property > > + "renesas,bonding" or "renesas,primary-bond" will have no effect. > That > > + enabled channel can act alone as any other independent device. > > + > > +Required properties of an internal channel: > > +--- > > +- compatible: "renesas,r8a7795-drif" if DRIF controller is a part of > R8A7795 SoC. > > + "renesas,rcar-gen3-drif" for a generic R-Car Gen3 compatible > device. > > + When compatible with the generic version, nodes must list the > > + SoC-specific version corresponding to the platform first > > + followed by the generic version. > > +- reg: offset and length of that channel. > > +- interrupts: associated with that channel. > > +- clocks: phandle and clock specifier of that channel. > > +- clock-names: clock input name string: "fck". > > +- dmas: phandles to the DMA channels. > > +- dma-names: names of the DMA channel: "rx". > > +- renesas,bonding: phandle to the other channel. > > + > > +Optional properties of an internal channel: > > +--- > > +- power-domains: phandle to the respective power domain. > > + > > +Required properties of an internal channel when: > > + - It is the only enabled channel of the bond (or) > > + - If it acts as primary among enabled bonds > > + > > +- pinctrl-0
[PATCH v3 3/7] media: i2c: max2175: Add MAX2175 support
This patch adds driver support for the MAX2175 chip. This is Maxim Integrated's RF to Bits tuner front end chip designed for software-defined radio solutions. This driver exposes the tuner as a sub-device instance with standard and custom controls to configure the device. Signed-off-by: Ramesh Shanmugasundaram --- Documentation/media/v4l-drivers/index.rst |1 + Documentation/media/v4l-drivers/max2175.rst | 60 ++ drivers/media/i2c/Kconfig |4 + drivers/media/i2c/Makefile |2 + drivers/media/i2c/max2175/Kconfig |8 + drivers/media/i2c/max2175/Makefile |4 + drivers/media/i2c/max2175/max2175.c | 1438 +++ drivers/media/i2c/max2175/max2175.h | 108 ++ 8 files changed, 1625 insertions(+) create mode 100644 Documentation/media/v4l-drivers/max2175.rst create mode 100644 drivers/media/i2c/max2175/Kconfig create mode 100644 drivers/media/i2c/max2175/Makefile create mode 100644 drivers/media/i2c/max2175/max2175.c create mode 100644 drivers/media/i2c/max2175/max2175.h diff --git a/Documentation/media/v4l-drivers/index.rst b/Documentation/media/v4l-drivers/index.rst index a606d1c..d8cade5 100644 --- a/Documentation/media/v4l-drivers/index.rst +++ b/Documentation/media/v4l-drivers/index.rst @@ -42,6 +42,7 @@ For more details see the file COPYING in the source distribution of Linux. davinci-vpbe fimc ivtv +max2175 meye omap3isp omap4_camera diff --git a/Documentation/media/v4l-drivers/max2175.rst b/Documentation/media/v4l-drivers/max2175.rst new file mode 100644 index 000..201af8f --- /dev/null +++ b/Documentation/media/v4l-drivers/max2175.rst @@ -0,0 +1,60 @@ +Maxim Integrated MAX2175 RF to bits tuner driver + + +The MAX2175 driver implements the following driver-specific controls: + +``V4L2_CID_MAX2175_I2S_ENABLE`` +--- +Enable/Disable I2S output of the tuner. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``(0)`` + - I2S output is disabled. +* - ``(1)`` + - I2S output is enabled. + +``V4L2_CID_MAX2175_HSLS`` +- +The high-side/low-side (HSLS) control of the tuner for a given band. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``(0)`` + - The LO frequency position is below the desired frequency. +* - ``(1)`` + - The LO frequency position is above the desired frequency. + +``V4L2_CID_MAX2175_RX_MODE (menu)`` +--- +The Rx mode controls a number of preset parameters of the tuner like sck +rate, sampling rate etc. These multiple settings are provided under one +single label called Rx mode in the datasheet. The list below shows the +supported modes with a brief description. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``"Europe modes"`` +* - ``"FM 1.2" (0)`` + - This configures FM band with a sample rate of 0.512 million +samples/sec with a 10.24 MHz sck. +* - ``"DAB 1.2" (1)`` + - This configures VHF band with a sample rate of 2.048 million +samples/sec with a 32.768 MHz sck. + +* - ``"North America modes"`` +* - ``"FM 1.0" (0)`` + - This configures FM band with a sample rate of 0.7441875 million +samples/sec with a 14.88375 MHz sck. +* - ``"DAB 1.2" (1)`` + - This configures FM band with a sample rate of 0.372 million +samples/sec with a 7.441875 MHz sck. diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index cee1dae..3fd1443 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -751,6 +751,10 @@ config VIDEO_SAA6752HS To compile this driver as a module, choose M here: the module will be called saa6752hs. +comment "SDR tuner chips" + +source "drivers/media/i2c/max2175/Kconfig" + comment "Miscellaneous helper chips" config VIDEO_THS7303 diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index 5bc7bbe..d8a079e 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -7,6 +7,8 @@ obj-$(CONFIG_VIDEO_CX25840) += cx25840/ obj-$(CONFIG_VIDEO_M5MOLS) += m5mols/ obj-y += soc_camera/ +obj-$(CONFIG_SDR_MAX2175) += max2175/ + obj-$(CONFIG_VIDEO_APTINA_PLL) += aptina-pll.o obj-$(CONFIG_VIDEO_TVAUDIO) += tvaudio.o obj-$(CONFIG_VIDEO_TDA7432) += tda7432.o diff --git a/drivers/media/i2c/max2175/Kconfig b/drivers/media/i2c/max2175/Kconfig new file mode 100644 index 000..93a8f83 --- /dev/null +++ b/drivers/media/i2c/max2175/Kconfig @@ -0,0 +1,8 @@ +config SDR_MAX2175 + tristate "Ma
[PATCH v3 5/7] doc_rst: media: New SDR formats PC16, PC18 & PC20
This patch adds documentation for the three new SDR formats V4L2_SDR_FMT_PCU16BE V4L2_SDR_FMT_PCU18BE V4L2_SDR_FMT_PCU20BE Signed-off-by: Ramesh Shanmugasundaram --- .../media/uapi/v4l/pixfmt-sdr-pcu16be.rst | 55 ++ .../media/uapi/v4l/pixfmt-sdr-pcu18be.rst | 55 ++ .../media/uapi/v4l/pixfmt-sdr-pcu20be.rst | 54 + Documentation/media/uapi/v4l/sdr-formats.rst | 3 ++ 4 files changed, 167 insertions(+) create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst new file mode 100644 index 000..2de1b1a --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst @@ -0,0 +1,55 @@ +.. -*- coding: utf-8; mode: rst -*- + +.. _V4L2-SDR-FMT-PCU16BE: + +** +V4L2_SDR_FMT_PCU16BE ('PC16') +** + +Planar complex unsigned 16-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadrature (IQ). Both I +and Q are represented as a 16 bit unsigned big endian number stored in +32 bit space. The remaining unused bits within the 32 bit space will be +padded with 0. I value starts first and Q value starts at an offset +equalling half of the buffer size (i.e.) offset = buffersize/2. Out of +the 16 bits, bit 15:2 (14 bit) is data and bit 1:0 (2 bit) can be any +value. + +**Byte Order.** +Each cell is one byte. + +.. flat-table:: +:header-rows: 1 +:stub-columns: 0 + +* - Offset: + - Byte B0 + - Byte B1 + - Byte B2 + - Byte B3 +* - start + 0: + - I'\ :sub:`0[13:6]` + - I'\ :sub:`0[5:0]; B1[1:0]=pad` + - pad + - pad +* - start + 4: + - I'\ :sub:`1[13:6]` + - I'\ :sub:`1[5:0]; B1[1:0]=pad` + - pad + - pad +* - ... +* - start + offset: + - Q'\ :sub:`0[13:6]` + - Q'\ :sub:`0[5:0]; B1[1:0]=pad` + - pad + - pad +* - start + offset + 4: + - Q'\ :sub:`1[13:6]` + - Q'\ :sub:`1[5:0]; B1[1:0]=pad` + - pad + - pad diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst new file mode 100644 index 000..da8b26b --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst @@ -0,0 +1,55 @@ +.. -*- coding: utf-8; mode: rst -*- + +.. _V4L2-SDR-FMT-PCU18BE: + +** +V4L2_SDR_FMT_PCU18BE ('PC18') +** + +Planar complex unsigned 18-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadrature (IQ). Both I +and Q are represented as a 18 bit unsigned big endian number stored in +32 bit space. The remaining unused bits within the 32 bit space will be +padded with 0. I value starts first and Q value starts at an offset +equalling half of the buffer size (i.e.) offset = buffersize/2. Out of +the 18 bits, bit 17:2 (16 bit) is data and bit 1:0 (2 bit) can be any +value. + +**Byte Order.** +Each cell is one byte. + +.. flat-table:: +:header-rows: 1 +:stub-columns: 0 + +* - Offset: + - Byte B0 + - Byte B1 + - Byte B2 + - Byte B3 +* - start + 0: + - I'\ :sub:`0[17:10]` + - I'\ :sub:`0[9:2]` + - I'\ :sub:`0[1:0]; B2[5:0]=pad` + - pad +* - start + 4: + - I'\ :sub:`1[17:10]` + - I'\ :sub:`1[9:2]` + - I'\ :sub:`1[1:0]; B2[5:0]=pad` + - pad +* - ... +* - start + offset: + - Q'\ :sub:`0[17:10]` + - Q'\ :sub:`0[9:2]` + - Q'\ :sub:`0[1:0]; B2[5:0]=pad` + - pad +* - start + offset + 4: + - Q'\ :sub:`1[17:10]` + - Q'\ :sub:`1[9:2]` + - Q'\ :sub:`1[1:0]; B2[5:0]=pad` + - pad diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst new file mode 100644 index 000..5499eed --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst @@ -0,0 +1,54 @@ +.. -*- coding: utf-8; mode: rst -*- +.. _V4L2-SDR-FMT-PCU20BE: + +** +V4L2_SDR_FMT_PCU20BE ('PC20') +** + +Planar complex unsigned 20-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadrature (IQ). Both I +and Q are rep
[PATCH v3 6/7] dt-bindings: media: Add Renesas R-Car DRIF binding
Add binding documentation for Renesas R-Car Digital Radio Interface (DRIF) controller. Signed-off-by: Ramesh Shanmugasundaram --- .../devicetree/bindings/media/renesas,drif.txt | 186 + 1 file changed, 186 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/renesas,drif.txt diff --git a/Documentation/devicetree/bindings/media/renesas,drif.txt b/Documentation/devicetree/bindings/media/renesas,drif.txt new file mode 100644 index 000..6315609 --- /dev/null +++ b/Documentation/devicetree/bindings/media/renesas,drif.txt @@ -0,0 +1,186 @@ +Renesas R-Car Gen3 Digital Radio Interface controller (DRIF) + + +R-Car Gen3 DRIF is a SPI like receive only slave device. A general +representation of DRIF interfacing with a master device is shown below. + ++-++-+ +| |-SCK--->|CLK | +| Master|-SS>|SYNC DRIFn (slave) | +| |-SD0--->|D0 | +| |-SD1--->|D1 | ++-++-+ + +As per the datasheet, each DRIF channel (drifn) is made up of two internal +channels (drifn0 & drifn1). These two internal channels share the common +CLK & SYNC. Each internal channel has its own dedicated resources like +irq, dma channels, address space & clock. This internal split is not +visible to the external master device. + +The device tree model represents each internal channel as a separate node. +The internal channels sharing the CLK & SYNC are tied together by their +phandles using a new property called "renesas,bonding". For the rest of +the documentation, unless explicitly stated, the word channel implies an +internal channel. + +When both internal channels are enabled they need to be managed together +as one (i.e.) they cannot operate alone as independent devices. Out of the +two, one of them needs to act as a primary device that accepts common +properties of both the internal channels. This channel is identified by a +new property called "renesas,primary-bond". + +To summarize, + - When both the internal channels that are bonded together are enabled, + the zeroth channel is selected as primary-bond. This channels accepts + properties common to all the members of the bond. + - When only one of the bonded channels need to be enabled, the property + "renesas,bonding" or "renesas,primary-bond" will have no effect. That + enabled channel can act alone as any other independent device. + +Required properties of an internal channel: +--- +- compatible: "renesas,r8a7795-drif" if DRIF controller is a part of R8A7795 SoC. + "renesas,rcar-gen3-drif" for a generic R-Car Gen3 compatible device. + When compatible with the generic version, nodes must list the + SoC-specific version corresponding to the platform first + followed by the generic version. +- reg: offset and length of that channel. +- interrupts: associated with that channel. +- clocks: phandle and clock specifier of that channel. +- clock-names: clock input name string: "fck". +- dmas: phandles to the DMA channels. +- dma-names: names of the DMA channel: "rx". +- renesas,bonding: phandle to the other channel. + +Optional properties of an internal channel: +--- +- power-domains: phandle to the respective power domain. + +Required properties of an internal channel when: + - It is the only enabled channel of the bond (or) + - If it acts as primary among enabled bonds + +- pinctrl-0: pin control group to be used for this channel. +- pinctrl-names: must be "default". +- renesas,primary-bond: empty property indicating the channel acts as primary + among the bonded channels. +- port: child port node of a channel that defines the local and remote + endpoints. The remote endpoint is assumed to be a third party tuner + device endpoint. + +Optional endpoint property: +--- +- renesas,sync-active : Indicates sync signal polarity, 0/1 for low/high +respectively. This property maps to SYNCAC bit in the +hardware manual. The default is 1 (active high) + +Example + + +SoC common dtsi file + + drif00: rif@e6f4 { + compatible = "renesas,r8a7795-drif", +"renesas,rcar-gen3-drif"; + reg = <0 0xe6f4 0 0x64>; + interrupts = ; +
[PATCH v3 2/7] dt-bindings: media: Add MAX2175 binding description
Add device tree binding documentation for MAX2175 Rf to bits tuner device. Signed-off-by: Ramesh Shanmugasundaram --- .../devicetree/bindings/media/i2c/max2175.txt | 61 ++ .../devicetree/bindings/property-units.txt | 1 + 2 files changed, 62 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/max2175.txt diff --git a/Documentation/devicetree/bindings/media/i2c/max2175.txt b/Documentation/devicetree/bindings/media/i2c/max2175.txt new file mode 100644 index 000..f591ab4 --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/max2175.txt @@ -0,0 +1,61 @@ +Maxim Integrated MAX2175 RF to Bits tuner +- + +The MAX2175 IC is an advanced analog/digital hybrid-radio receiver with +RF to Bits® front-end designed for software-defined radio solutions. + +Required properties: + +- compatible: "maxim,max2175" for MAX2175 RF-to-bits tuner. +- clocks: phandle to the fixed xtal clock. +- clock-names: name of the fixed xtal clock. +- port: child port node of a tuner that defines the local and remote + endpoints. The remote endpoint is assumed to be an SDR device + that is capable of receiving the digital samples from the tuner. + +Optional properties: + +- maxim,slave: phandle to the master tuner if it is a slave. This + is used to define two tuners in diversity mode + (1 master, 1 slave). By default each tuner is an + individual master. +- maxim,refout-load-pF: load capacitance value (in pF) on reference + output drive level. The possible load values are +0 (default - refout disabled) + 10 + 20 + 30 + 40 + 60 + 70 +- maxim,am-hiz : empty property indicates AM Hi-Z filter path is + selected for AM antenna input. By default this + filter path is not used. + +Example: + + +Board specific DTS file + +/* Fixed XTAL clock node */ +maxim_xtal: clock { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <36864000>; +}; + +/* A tuner device instance under i2c bus */ +max2175_0: tuner@60 { + compatible = "maxim,max2175"; + reg = <0x60>; + clocks = <&maxim_xtal>; + clock-names = "xtal"; + maxim,refout-load-pF = <10>; + + port { + max2175_0_ep: endpoint { + remote-endpoint = <&slave_rx_device>; + }; + }; + +}; diff --git a/Documentation/devicetree/bindings/property-units.txt b/Documentation/devicetree/bindings/property-units.txt index 12278d7..f1f1c22 100644 --- a/Documentation/devicetree/bindings/property-units.txt +++ b/Documentation/devicetree/bindings/property-units.txt @@ -28,6 +28,7 @@ Electricity -ohms : Ohms -micro-ohms: micro Ohms -microvolt : micro volts +-pF: pico farads Temperature -- 1.9.1
[PATCH v3 1/7] media: v4l2-ctrls: Reserve controls for MAX217X
Reserve controls for MAX217X RF to Bits tuner family. These hybrid radio receiver chips are highly programmable and hence reserving 32 controls. Signed-off-by: Ramesh Shanmugasundaram --- include/uapi/linux/v4l2-controls.h | 5 + 1 file changed, 5 insertions(+) diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 0d2e1e0..83b28b4 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -180,6 +180,11 @@ enum v4l2_colorfx { * We reserve 16 controls for this driver. */ #define V4L2_CID_USER_TC358743_BASE(V4L2_CID_USER_BASE + 0x1080) +/* The base for the max217x driver controls. + * We reserve 32 controls for this driver + */ +#define V4L2_CID_USER_MAX217X_BASE (V4L2_CID_USER_BASE + 0x1090) + /* MPEG-class control IDs */ /* The MPEG controls are applicable to all codec controls * and the 'MPEG' part of the define is historical */ -- 1.9.1
[PATCH v3 7/7] media: platform: rcar_drif: Add DRIF support
This patch adds Digital Radio Interface (DRIF) support to R-Car Gen3 SoCs. The driver exposes each instance of DRIF as a V4L2 SDR device. A DRIF device represents a channel and each channel can have one or two sub-channels respectively depending on the target board. DRIF supports only Rx functionality. It receives samples from a RF frontend tuner chip it is interfaced with. The combination of DRIF and the tuner device, which is registered as a sub-device, determines the receive sample rate and format. In order to be compliant as a V4L2 SDR device, DRIF needs to bind with the tuner device, which can be provided by a third party vendor. DRIF acts as a slave device and the tuner device acts as a master transmitting the samples. The driver allows asynchronous binding of a tuner device that is registered as a v4l2 sub-device. The driver can learn about the tuner it is interfaced with based on port endpoint properties of the device in device tree. The V4L2 SDR device inherits the controls exposed by the tuner device. The device can also be configured to use either one or both of the data pins at runtime based on the master (tuner) configuration. Signed-off-by: Ramesh Shanmugasundaram --- drivers/media/platform/Kconfig | 25 + drivers/media/platform/Makefile|1 + drivers/media/platform/rcar_drif.c | 1534 3 files changed, 1560 insertions(+) create mode 100644 drivers/media/platform/rcar_drif.c diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 0245af0..bf40568 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -435,3 +435,28 @@ menuconfig DVB_PLATFORM_DRIVERS if DVB_PLATFORM_DRIVERS source "drivers/media/platform/sti/c8sectpfe/Kconfig" endif #DVB_PLATFORM_DRIVERS + +menuconfig SDR_PLATFORM_DRIVERS + bool "SDR platform devices" + depends on MEDIA_SDR_SUPPORT + default n + ---help--- + Say Y here to enable support for platform-specific SDR Drivers. + +if SDR_PLATFORM_DRIVERS + +config VIDEO_RCAR_DRIF + tristate "Renesas Digitial Radio Interface (DRIF)" + depends on VIDEO_V4L2 && HAS_DMA + depends on ARCH_RENESAS + select VIDEOBUF2_VMALLOC + ---help--- + Say Y if you want to enable R-Car Gen3 DRIF support. DRIF is Digital + Radio Interface that interfaces with an RF front end chip. It is a + receiver of digital data which uses DMA to transfer received data to + a configured location for an application to use. + + To compile this driver as a module, choose M here; the module + will be called rcar_drif. + +endif # SDR_PLATFORM_DRIVERS diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index 5b3cb27..1c2daaf 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -47,6 +47,7 @@ obj-$(CONFIG_VIDEO_SH_VOU)+= sh_vou.o obj-$(CONFIG_SOC_CAMERA) += soc_camera/ +obj-$(CONFIG_VIDEO_RCAR_DRIF) += rcar_drif.o obj-$(CONFIG_VIDEO_RENESAS_FCP)+= rcar-fcp.o obj-$(CONFIG_VIDEO_RENESAS_FDP1) += rcar_fdp1.o obj-$(CONFIG_VIDEO_RENESAS_JPU)+= rcar_jpu.o diff --git a/drivers/media/platform/rcar_drif.c b/drivers/media/platform/rcar_drif.c new file mode 100644 index 000..88950e3 --- /dev/null +++ b/drivers/media/platform/rcar_drif.c @@ -0,0 +1,1534 @@ +/* + * R-Car Gen3 Digital Radio Interface (DRIF) driver + * + * Copyright (C) 2016 Renesas Electronics Corporation + * + * 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. + */ + +/* + * The R-Car DRIF is a receive only MSIOF like controller with an + * external master device driving the SCK. It receives data into a FIFO, + * then this driver uses the SYS-DMAC engine to move the data from + * the device to memory. + * + * Each DRIF channel DRIFx (as per datasheet) contains two internal + * channels DRIFx0 & DRIFx1 within itself with each having its own resources + * like module clk, register set, irq and dma. These internal channels share + * common CLK & SYNC from master. The two data pins D0 & D1 shall be + * considered to represent the two internal channels. This internal split + * is not visible to the master device. + * + * Depending on the master device, a DRIF channel can use + * (1) both internal channels (D0 & D1) to receive data in parallel (or) + * (2) one internal channel (D0 or D1) to receive data + * + * The primar
[PATCH v3 4/7] media: Add new SDR formats PC16, PC18 & PC20
This patch adds support for the three new SDR formats. These formats were prefixed with "planar" indicating I & Q data are not interleaved as in other formats. Here, I & Q data constitutes the top half and bottom half of the received buffer. V4L2_SDR_FMT_PCU16BE - 14-bit complex (I & Q) unsigned big-endian sample inside 16-bit. V4L2 FourCC: PC16 V4L2_SDR_FMT_PCU18BE - 16-bit complex (I & Q) unsigned big-endian sample inside 18-bit. V4L2 FourCC: PC18 V4L2_SDR_FMT_PCU20BE - 18-bit complex (I & Q) unsigned big-endian sample inside 20-bit. V4L2 FourCC: PC20 Signed-off-by: Ramesh Shanmugasundaram --- drivers/media/v4l2-core/v4l2-ioctl.c | 3 +++ include/uapi/linux/videodev2.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 0c3f238..fdf6c913 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1213,6 +1213,9 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_SDR_FMT_CS8: descr = "Complex S8"; break; case V4L2_SDR_FMT_CS14LE: descr = "Complex S14LE"; break; case V4L2_SDR_FMT_RU12LE: descr = "Real U12LE"; break; + case V4L2_SDR_FMT_PCU16BE: descr = "Planar Complex U16BE"; break; + case V4L2_SDR_FMT_PCU18BE: descr = "Planar Complex U18BE"; break; + case V4L2_SDR_FMT_PCU20BE: descr = "Planar Complex U20BE"; break; case V4L2_TCH_FMT_DELTA_TD16: descr = "16-bit signed deltas"; break; case V4L2_TCH_FMT_DELTA_TD08: descr = "8-bit signed deltas"; break; case V4L2_TCH_FMT_TU16: descr = "16-bit unsigned touch data"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 46e8a2e3..26a31c8 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -669,6 +669,9 @@ struct v4l2_pix_format { #define V4L2_SDR_FMT_CS8 v4l2_fourcc('C', 'S', '0', '8') /* complex s8 */ #define V4L2_SDR_FMT_CS14LE v4l2_fourcc('C', 'S', '1', '4') /* complex s14le */ #define V4L2_SDR_FMT_RU12LE v4l2_fourcc('R', 'U', '1', '2') /* real u12le */ +#define V4L2_SDR_FMT_PCU16BE v4l2_fourcc('P', 'C', '1', '6') /* planar complex u16be */ +#define V4L2_SDR_FMT_PCU18BE v4l2_fourcc('P', 'C', '1', '8') /* planar complex u18be */ +#define V4L2_SDR_FMT_PCU20BE v4l2_fourcc('P', 'C', '2', '0') /* planar complex u20be */ /* Touch formats - used for Touch devices */ #define V4L2_TCH_FMT_DELTA_TD16v4l2_fourcc('T', 'D', '1', '6') /* 16-bit signed deltas */ -- 1.9.1
[PATCH v3 0/7] Add V4L2 SDR (DRIF & MAX2175) driver
Hi Media, DT maintainers, All, This patch set contains two drivers - Renesas R-Car Digital Radio Interface (DRIF) driver - Maxim's MAX2175 RF to Bits tuner driver These patches were based on top of media-tree repo commit: 47b037a0512d9f8675ec2693bed46c8ea6a884ab These two drivers combined together expose a V4L2 SDR device that is compliant with the V4L2 framework [1]. Agreed review comments are incorporated in this series. The rcar_drif device is modelled using "renesas,bonding" property. The discussion on this property is available here [2]. Change history: v2 -> v3: rcar_drif: - Reduced DRIF DT properties to expose tested I2S mode only (Hans - discussion on #v4l) - Fixed error path clean up of ctrl_hdl on rcar_drif v1 -> v2: - SDR formats renamed as "planar" instead of sliced (Hans) - Documentation formatting correction (Laurent) rcar_drif: - DT model using "bonding" property - Addressed Laurent's coments on bindings - DT optional parameters rename & rework - Addressed Han's comments on driver - Addressed Geert's comments on DT max2175: - Avoided scaling using method proposed by Antti. Thanks - Bindings is a separate patch (Rob) - Addressed Rob's comment on bindings - Added Custom controls documentation (Laurent) [1] v4l2-compliance report root@salvator-x:~# v4l2-compliance -S /dev/swradio0 v4l2-compliance SHA : 788b674f3827607c09c31be11c91638f816aa6ae Driver Info: Driver name : rcar_drif Card type : R-Car DRIF Bus info : platform:R-Car DRIF Driver version: 4.10.0 Capabilities : 0x8531 SDR Capture Tuner Read/Write Streaming Extended Pix Format Device Capabilities Device Caps : 0x0531 SDR Capture Tuner Read/Write Streaming Extended Pix Format Compliance test for device /dev/swradio0 (not using libv4l2): Required ioctls: test VIDIOC_QUERYCAP: OK Allow for multiple opens: test second sdr open: OK test VIDIOC_QUERYCAP: OK test VIDIOC_G/S_PRIORITY: OK test for unlimited opens: OK Debug ioctls: test VIDIOC_DBG_G/S_REGISTER: OK test VIDIOC_LOG_STATUS: OK Input ioctls: test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK test VIDIOC_G/S_FREQUENCY: OK test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported) test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported) Inputs: 0 Audio Inputs: 0 Tuners: 1 Output ioctls: test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported) Outputs: 0 Audio Outputs: 0 Modulators: 0 Input/Output configuration ioctls: test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported) Control ioctls: test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK test VIDIOC_G/S_CTRL: OK test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 5 Private Controls: 3 Format ioctls: test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK test VIDIOC_TRY_FMT: OK test VIDIOC_S_FMT: OK test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported) test Composing: OK (Not Supported) test Scaling: OK (Not Supported) Codec ioctls: test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported) Buffer ioctls: test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test VIDIOC_EXPBUF: OK (Not Supported) Test input 0: Total: 43, Succeeded: 43, Failed: 0, Warnings: 0 root@salvator-x:~# [2] "bonding" DT property discussion (https://www.mail-archive.com/linux-renesas-soc@vger.kernel.org/msg09415.html) Ramesh Shanmugasundaram (7): media: v4l2-ctrls: Reserve controls for MAX217X dt-bindings: media: Add MAX2175 binding description media: i2c: max2175: Add MAX2175 suppo
RE: [PATCH v2 6/7] dt-bindings: media: Add Renesas R-Car DRIF binding
Hi Hans, Many thanks for the response & comments. > Subject: Re: [PATCH v2 6/7] dt-bindings: media: Add Renesas R-Car DRIF > binding > > On 01/10/2017 10:31 AM, Ramesh Shanmugasundaram wrote: > > Hi Laurent, > > > >>>>>> On Wednesday 21 Dec 2016 08:10:37 Ramesh Shanmugasundaram wrote: > >>>>>>> Add binding documentation for Renesas R-Car Digital Radio > >>>>>>> Interface > >>>>>>> (DRIF) controller. > >>>>>>> > >>>>>>> Signed-off-by: Ramesh Shanmugasundaram > >>>>>>> --- > >>>>>>> > >>>>>>> .../devicetree/bindings/media/renesas,drif.txt | 202 > >> + > >>>>>>> 1 file changed, 202 insertions(+) create mode 100644 > >>>>>>> > >>>>>>> Documentation/devicetree/bindings/media/renesas,drif.txt > >>>>>>> > >>>>>>> diff --git > >>>>>>> a/Documentation/devicetree/bindings/media/renesas,drif.txt > >>>>>>> b/Documentation/devicetree/bindings/media/renesas,drif.txt new > >>>>>>> file mode 100644 index 000..1f3feaf > >>>>>>> --- /dev/null > >>>>>>> +++ b/Documentation/devicetree/bindings/media/renesas,drif.txt > >>>>>>> > >>>>>>> +Optional properties of an internal channel when: > >>>>>>> + - It is the only enabled channel of the bond (or) > >>>>>>> + - If it acts as primary among enabled bonds > >>>>>>> + > >>>>>>> +- renesas,syncmd : sync mode > >>>>>>> + 0 (Frame start sync pulse mode. 1-bit > >>>>>>> +width > >>>>>>> pulse > >>>>>>> + indicates start of a frame) > >>>>>>> + 1 (L/R sync or I2S mode) (default) > >>>>>>> +- renesas,lsb-first: empty property indicates lsb bit is > >> received > >>>>>>> first. > >>>>>>> + When not defined msb bit is received > >>>>>>> +first > >>>>>>> +(default) > >>>>>>> +- renesas,syncac-active: Indicates sync signal polarity, 0/1 > >>>>>>> +for > >>>>>>> low/high > >>> > >>> Shouldn't this be 'renesas,sync-active' instead of syncac-active? > >>> > >>> I'm not sure if syncac is intended or if it is a typo. > >>> > >>>>>>> + respectively. The default is 1 (active > high) > >>>>>>> +- renesas,dtdl : delay between sync signal and start of > >>>>>>> reception. > >>>>>>> + The possible values are represented in > >>>>>>> + 0.5 > >> clock > >>>>>>> + cycle units and the range is 0 to 4. The > >> default > >>>>>>> + value is 2 (i.e.) 1 clock cycle delay. > >>>>>>> +- renesas,syncdl : delay between end of reception and sync > >>>>>>> signal edge. > >>>>>>> + The possible values are represented in > >>>>>>> + 0.5 > >> clock > >>>>>>> + cycle units and the range is 0 to 4 & 6. > >>>>>>> + The > >>>>>>> default > >>>>>>> + value is 0 (i.e.) no delay. > > Are these properties actually going to be used by anyone? Just curious. Yes. Each of this property should be set appropriately based on the master device it interfaces with. > > >>>>>> > >>>>>> Most of these properties are pretty similar to the video bus > >>>>>> properties defined at the endpoint level in > >>>>>> Documentation/devicetree/bindings/media/video-interfaces.txt. I > >>>>>> believe it would make sense to use OF graph and try to > >>>>>> standardize these properties similarly. > >>> > >>> Other than sync-active, is there real
RE: [PATCH 3/4] arm64: dts: r8a7795: Link ARM GIC to clock and clock domain
Hi Geert, > Subject: [PATCH 3/4] arm64: dts: r8a7795: Link ARM GIC to clock and clock > domain > > Link the ARM GIC to the INTC-AP module clock, and add it to the SYSC > "always-on" PM Domain, so it can be power managed using that clock. > > Note that currently the GIC-400 driver doesn't support module clocks nor > Runtime PM, so this must be handled as a critical clock. > > Signed-off-by: Geert Uytterhoeven > --- > arch/arm64/boot/dts/renesas/r8a7795.dtsi | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi > b/arch/arm64/boot/dts/renesas/r8a7795.dtsi > index 026a16ac41b422a1..0627df2a0b810c86 100644 > --- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi > +++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi > @@ -166,6 +166,9 @@ > <0x0 0xf106 0 0x2>; > interrupts =(GIC_CPU_MASK_SIMPLE(4) | > IRQ_TYPE_LEVEL_HIGH)>; > + clocks = <&cpg CPG_MOD 408>; > + clock-names = "clk"; Should the module clock be named "fck"? Thanks, Ramesh
RE: [PATCH v2 6/7] dt-bindings: media: Add Renesas R-Car DRIF binding
Hi Laurent, > > >>> On Wednesday 21 Dec 2016 08:10:37 Ramesh Shanmugasundaram wrote: > > >>>> Add binding documentation for Renesas R-Car Digital Radio > > >>>> Interface > > >>>> (DRIF) controller. > > >>>> > > >>>> Signed-off-by: Ramesh Shanmugasundaram > > >>>> --- > > >>>> > > >>>> .../devicetree/bindings/media/renesas,drif.txt | 202 > + > > >>>> 1 file changed, 202 insertions(+) create mode 100644 > > >>>> > > >>>> Documentation/devicetree/bindings/media/renesas,drif.txt > > >>>> > > >>>> diff --git > > >>>> a/Documentation/devicetree/bindings/media/renesas,drif.txt > > >>>> b/Documentation/devicetree/bindings/media/renesas,drif.txt new > > >>>> file mode 100644 index 000..1f3feaf > > >>>> --- /dev/null > > >>>> +++ b/Documentation/devicetree/bindings/media/renesas,drif.txt > > >>>> > > >>>> +Optional properties of an internal channel when: > > >>>> + - It is the only enabled channel of the bond (or) > > >>>> + - If it acts as primary among enabled bonds > > >>>> + > > >>>> +- renesas,syncmd : sync mode > > >>>> + 0 (Frame start sync pulse mode. 1-bit > > >>>> +width > > >>>> pulse > > >>>> + indicates start of a frame) > > >>>> + 1 (L/R sync or I2S mode) (default) > > >>>> +- renesas,lsb-first: empty property indicates lsb bit is > received > > >>>> first. > > >>>> + When not defined msb bit is received first > > >>>> +(default) > > >>>> +- renesas,syncac-active: Indicates sync signal polarity, 0/1 for > > >>>> low/high > > > > Shouldn't this be 'renesas,sync-active' instead of syncac-active? > > > > I'm not sure if syncac is intended or if it is a typo. > > > > >>>> + respectively. The default is 1 (active high) > > >>>> +- renesas,dtdl : delay between sync signal and start of > > >>>> reception. > > >>>> + The possible values are represented in 0.5 > clock > > >>>> + cycle units and the range is 0 to 4. The > default > > >>>> + value is 2 (i.e.) 1 clock cycle delay. > > >>>> +- renesas,syncdl : delay between end of reception and sync > > >>>> signal edge. > > >>>> + The possible values are represented in 0.5 > clock > > >>>> + cycle units and the range is 0 to 4 & 6. > > >>>> + The > > >>>> default > > >>>> + value is 0 (i.e.) no delay. > > >>> > > >>> Most of these properties are pretty similar to the video bus > > >>> properties defined at the endpoint level in > > >>> Documentation/devicetree/bindings/media/video-interfaces.txt. I > > >>> believe it would make sense to use OF graph and try to standardize > > >>> these properties similarly. > > > > Other than sync-active, is there really anything else that is similar? > > And even the sync-active isn't a good fit since here there is only one > > sync signal instead of two for video (h and vsync). > > That's why I said similar, not identical :-) My point is that, if we > consider that we could connect multiple sources to the DRIF, using OF > graph would make sense, and the above properties should then be defined > per endpoint. Thanks for the clarifications. I have some questions. - Assuming two devices are interfaced with DRIF and they are represented using two endpoints, the control signal related properties of DRIF might still need to be same for both endpoints? For e.g. syncac-active cannot be different in both endpoints? - I suppose "lsb-first", "dtdl" & "syncdl" may be defined per endpoint. However, h/w manual says same register values needs to be programmed for both the internal channels of a channel. Same with "syncmd" property. We could still define them as per endpoint prop
RE: [PATCH v2 6/7] dt-bindings: media: Add Renesas R-Car DRIF binding
Hi Hans, Thanks for the review. > >>> On Wednesday 21 Dec 2016 08:10:37 Ramesh Shanmugasundaram wrote: > >>>> Add binding documentation for Renesas R-Car Digital Radio Interface > >>>> (DRIF) controller. > >>>> > >>>> Signed-off-by: Ramesh Shanmugasundaram > >>>> --- > >>>> .../devicetree/bindings/media/renesas,drif.txt | 202 > >> ++ > >>>> 1 file changed, 202 insertions(+) > >>>> create mode 100644 > >>>> Documentation/devicetree/bindings/media/renesas,drif.txt > >>>> > >>>> diff --git > >>>> a/Documentation/devicetree/bindings/media/renesas,drif.txt > >>>> b/Documentation/devicetree/bindings/media/renesas,drif.txt new file > >>>> mode > >>>> 100644 > >>>> index 000..1f3feaf > >>>> --- /dev/null > >>>> +++ b/Documentation/devicetree/bindings/media/renesas,drif.txt > >> > >>>> +Optional properties of an internal channel when: > >>>> + - It is the only enabled channel of the bond (or) > >>>> + - If it acts as primary among enabled bonds > >>>> + > >>>> +- renesas,syncmd : sync mode > >>>> + 0 (Frame start sync pulse mode. 1-bit width > >> pulse > >>>> + indicates start of a frame) > >>>> + 1 (L/R sync or I2S mode) (default) > >>>> +- renesas,lsb-first: empty property indicates lsb bit is > received > >>>> first. > >>>> + When not defined msb bit is received first > >>>> +(default) > >>>> +- renesas,syncac-active: Indicates sync signal polarity, 0/1 for > >> low/high > > Shouldn't this be 'renesas,sync-active' instead of syncac-active? > > I'm not sure if syncac is intended or if it is a typo. Yes, "syncac" is intended. I kept the same name as in h/w manual for easy reference. Same for other properties - syncmd, dtdl & syncdl. > > >>>> + respectively. The default is 1 (active high) > >>>> +- renesas,dtdl : delay between sync signal and start of > >> reception. > >>>> + The possible values are represented in 0.5 > clock > >>>> + cycle units and the range is 0 to 4. The > default > >>>> + value is 2 (i.e.) 1 clock cycle delay. > >>>> +- renesas,syncdl : delay between end of reception and sync > >> signal > >>>> edge. > >>>> + The possible values are represented in 0.5 > clock > >>>> + cycle units and the range is 0 to 4 & 6. The > >> default > >>>> + value is 0 (i.e.) no delay. > >>> > >>> Most of these properties are pretty similar to the video bus > >>> properties defined at the endpoint level in > >>> Documentation/devicetree/bindings/media/video-interfaces.txt. I > >>> believe it would make sense to use OF graph and try to standardize > >>> these properties similarly. > > Other than sync-active, is there really anything else that is similar? And > even the sync-active isn't a good fit since here there is only one sync > signal instead of two for video (h and vsync). > > Regards, > > Hans > Thanks, Ramesh
Possible issue?
Noticed (only once so far) the below issue on renesas-drivers-2016-12-27-v4.10-rc1 with lockdep enabled. Anybody else seen it? [2.520105] [2.521598] == [2.527771] [ INFO: possible circular locking dependency detected ] [2.534033] 4.10.0-rc1-00012-g862fa6e-dirty #19 Not tainted [2.539598] --- [2.545857] swapper/0/1 is trying to acquire lock: [2.550641] (&genpd->mlock){+.+.+.}, at: [] genpd_lock_mtx+0x24/0x30 [2.558654] [2.558654] but task is already holding lock: [2.564479] (prepare_lock){+.+...}, at: [] clk_prepare_lock+0x2c/0xe8 [2.572575] [2.572575] which lock already depends on the new lock. [2.572575] [2.580745] [2.580745] the existing dependency chain (in reverse order) is: [2.588219] [2.588219] -> #2 (prepare_lock){+.+...}: [2.593702] [2.593712] [] __lock_acquire+0x1608/0x1688 [2.601539] [2.601544] [] lock_acquire+0xcc/0x298 [2.608937] [2.608945] [] mutex_lock_nested+0x78/0x648 [2.616771] [2.616775] [] clk_prepare_lock+0x54/0xe8 [2.624428] [2.624433] [] __clk_create_clk.part.16+0x5c/0xb0 [2.632780] [2.632784] [] __of_clk_get_from_provider+0x124/0x168 [2.641479] [2.641483] [] __of_clk_get_by_name+0x108/0x120 [2.649656] [2.649660] [] clk_get+0x3c/0x90 [2.656532] [2.656535] [] devm_clk_get+0x50/0xa8 [2.663842] [2.663849] [] rsnd_adg_probe+0x98/0x590 [2.671415] [2.671420] [] rsnd_probe+0xd8/0x5b8 [2.678639] [2.678645] [] platform_drv_probe+0x58/0xc0 [2.686471] [2.686478] [] driver_probe_device+0x2c4/0x458 [2.694565] [2.694568] [] __driver_attach+0x12c/0x130 [2.702308] [2.702312] [] bus_for_each_dev+0x70/0xb0 [2.709965] [2.709969] [] driver_attach+0x30/0x40 [2.717361] [2.717365] [] bus_add_driver+0x250/0x2c0 [2.725017] [2.725021] [] driver_register+0x68/0x100 [2.732674] [2.732677] [] __platform_driver_register+0x54/0x60 [2.741198] [2.741207] [] rsnd_driver_init+0x18/0x20 [2.748860] [2.748866] [] do_one_initcall+0x44/0x138 [2.756519] [2.756526] [] kernel_init_freeable+0x1f8/0x298 [2.764700] [2.764704] [] kernel_init+0x18/0x108 [2.772010] [2.772013] [] ret_from_fork+0x10/0x40 [2.779405] [2.779405] -> #1 (of_clk_mutex){+.+.+.}: [2.784888] [2.784892] [] __lock_acquire+0x1608/0x1688 [2.792719] [2.792722] [] lock_acquire+0xcc/0x298 [2.800115] [2.800119] [] mutex_lock_nested+0x78/0x648 [2.807945] [2.807948] [] __of_clk_get_from_provider+0x4c/0x168 [2.816557] [2.816560] [] of_clk_get_from_provider+0x30/0x40 [2.824907] [2.824912] [] cpg_mssr_attach_dev+0xcc/0x1e8 [2.832912] [2.832915] [] genpd_add_device+0x104/0x228 [2.840742] [2.840745] [] genpd_dev_pm_attach+0xac/0x2d0 [2.848745] [2.848752] [] dev_pm_domain_attach+0x20/0x30 [2.856753] [2.856755] [] platform_drv_probe+0x3c/0xc0 [2.864582] [2.864586] [] driver_probe_device+0x2c4/0x458 [2.872673] [2.872676] [] __driver_attach+0x12c/0x130 [2.880416] [2.880419] [] bus_for_each_dev+0x70/0xb0 [2.888073] [2.888076] [] driver_attach+0x30/0x40 [2.895469] [2.895472] [] bus_add_driver+0x250/0x2c0 [2.903126] [2.903130] [] driver_register+0x68/0x100 [2.910783] [2.910786] [] __platform_driver_register+0x54/0x60 [2.919307] [2.919314] [] rcar_gen3_phy_usb2_driver_init+0x18/0x20 [2.928182] [2.928185] [] do_one_initcall+0x44/0x138 [2.935838] [2.935841] [] kernel_init_freeable+0x1f8/0x298 [2.944015] [2.944019] [] kernel_init+0x18/0x108 [2.951324] [2.951327] [] ret_from_fork+0x10/0x40 [2.958721] [2.958721] -> #0 (&genpd->mlock){+.+.+.}: [2.964289] [2.964293] [] print_circular_bug+0x80/0x2e0 [2.972206] [2.972210] [] __lock_acquire+0x1630/0x1688 [2.980036] [2.980040] [] lock_acquire+0xcc/0x298 [2.987432] [2.987436] [] mutex_lock_nested+0x78/0x648 [2.995262] [2.995265] [] genpd_lock_mtx+0x24/0x30 [3.002744] [3.002747] [] genpd_runtime_resume+0xe0/0x270 [3.010834] [3.010838] [] __rpm_callback+0xe8/0x260 [3.018405] [3.018407] [] rpm_callback+0x38/0xa8 [3.025713] [3.025716] [] rpm_resume+0x4bc/0x710 [3.033021] [3.033024] [] __pm_runtime_resume+0x64/0xa0 [3.040938] [3.040945] [] rcar_i2c_master_xfer+0x4c/0x4b8 [3.049032] [3.049036] [] __i2c_transfer+0x13c/0x9a8 [3.056690] [3.056693] [] i2c_transfer+0x6c/0xf8 [3.063999] [3.064002] [] i2c_smbus_xfer_emulated+0x11c/0x528 [3.072436] [3.072439] [] i2c_smbus_xfer+0x1ac/0x8e0 [3.080092] [3.080095] [] i2c_smbus_read_byte_data+0x3c/0x50 [3.088442] [3.088446] [] cs2000_bset.isra.1+0x34/0x60 [3.096273] [3.096277] [] cs2000_enable_dev_config+0x34/0x60 [
RE: [PATCH v2 6/7] dt-bindings: media: Add Renesas R-Car DRIF binding
Hi Laurent, Geert, Thanks for the review comments. > > On Wednesday 21 Dec 2016 08:10:37 Ramesh Shanmugasundaram wrote: > >> Add binding documentation for Renesas R-Car Digital Radio Interface > >> (DRIF) controller. > >> > >> Signed-off-by: Ramesh Shanmugasundaram > >> --- > >> .../devicetree/bindings/media/renesas,drif.txt | 202 > ++ > >> 1 file changed, 202 insertions(+) > >> create mode 100644 > >> Documentation/devicetree/bindings/media/renesas,drif.txt > >> > >> diff --git a/Documentation/devicetree/bindings/media/renesas,drif.txt > >> b/Documentation/devicetree/bindings/media/renesas,drif.txt new file > >> mode > >> 100644 > >> index 000..1f3feaf > >> --- /dev/null > >> +++ b/Documentation/devicetree/bindings/media/renesas,drif.txt > > >> +Optional properties of an internal channel when: > >> + - It is the only enabled channel of the bond (or) > >> + - If it acts as primary among enabled bonds > >> + > >> +- renesas,syncmd : sync mode > >> + 0 (Frame start sync pulse mode. 1-bit width > pulse > >> + indicates start of a frame) > >> + 1 (L/R sync or I2S mode) (default) > >> +- renesas,lsb-first: empty property indicates lsb bit is received > >> first. > >> + When not defined msb bit is received first > >> +(default) > >> +- renesas,syncac-active: Indicates sync signal polarity, 0/1 for > low/high > >> + respectively. The default is 1 (active high) > >> +- renesas,dtdl : delay between sync signal and start of > reception. > >> + The possible values are represented in 0.5 clock > >> + cycle units and the range is 0 to 4. The default > >> + value is 2 (i.e.) 1 clock cycle delay. > >> +- renesas,syncdl : delay between end of reception and sync > signal > >> edge. > >> + The possible values are represented in 0.5 clock > >> + cycle units and the range is 0 to 4 & 6. The > default > >> + value is 0 (i.e.) no delay. > > > > Most of these properties are pretty similar to the video bus > > properties defined at the endpoint level in > > Documentation/devicetree/bindings/media/video-interfaces.txt. I > > believe it would make sense to use OF graph and try to standardize > > these properties similarly. > > Note that the last two properties match the those in > Documentation/devicetree/bindings/spi/sh-msiof.txt. > We may want to use one DRIF channel as a plain SPI slave with the > (modified) MSIOF driver in the future. Should I leave it as it is or modify these as in video-interfaces.txt? Shall we conclude on this please? Thanks, Ramesh
[PATCH v2 3/7] media: i2c: max2175: Add MAX2175 support
This patch adds driver support for the MAX2175 chip. This is Maxim Integrated's RF to Bits tuner front end chip designed for software-defined radio solutions. This driver exposes the tuner as a sub-device instance with standard and custom controls to configure the device. Signed-off-by: Ramesh Shanmugasundaram --- Documentation/media/v4l-drivers/index.rst |1 + Documentation/media/v4l-drivers/max2175.rst | 60 ++ drivers/media/i2c/Kconfig |4 + drivers/media/i2c/Makefile |2 + drivers/media/i2c/max2175/Kconfig |8 + drivers/media/i2c/max2175/Makefile |4 + drivers/media/i2c/max2175/max2175.c | 1438 +++ drivers/media/i2c/max2175/max2175.h | 108 ++ 8 files changed, 1625 insertions(+) create mode 100644 Documentation/media/v4l-drivers/max2175.rst create mode 100644 drivers/media/i2c/max2175/Kconfig create mode 100644 drivers/media/i2c/max2175/Makefile create mode 100644 drivers/media/i2c/max2175/max2175.c create mode 100644 drivers/media/i2c/max2175/max2175.h diff --git a/Documentation/media/v4l-drivers/index.rst b/Documentation/media/v4l-drivers/index.rst index a606d1c..d8cade5 100644 --- a/Documentation/media/v4l-drivers/index.rst +++ b/Documentation/media/v4l-drivers/index.rst @@ -42,6 +42,7 @@ For more details see the file COPYING in the source distribution of Linux. davinci-vpbe fimc ivtv +max2175 meye omap3isp omap4_camera diff --git a/Documentation/media/v4l-drivers/max2175.rst b/Documentation/media/v4l-drivers/max2175.rst new file mode 100644 index 000..201af8f --- /dev/null +++ b/Documentation/media/v4l-drivers/max2175.rst @@ -0,0 +1,60 @@ +Maxim Integrated MAX2175 RF to bits tuner driver + + +The MAX2175 driver implements the following driver-specific controls: + +``V4L2_CID_MAX2175_I2S_ENABLE`` +--- +Enable/Disable I2S output of the tuner. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``(0)`` + - I2S output is disabled. +* - ``(1)`` + - I2S output is enabled. + +``V4L2_CID_MAX2175_HSLS`` +- +The high-side/low-side (HSLS) control of the tuner for a given band. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``(0)`` + - The LO frequency position is below the desired frequency. +* - ``(1)`` + - The LO frequency position is above the desired frequency. + +``V4L2_CID_MAX2175_RX_MODE (menu)`` +--- +The Rx mode controls a number of preset parameters of the tuner like sck +rate, sampling rate etc. These multiple settings are provided under one +single label called Rx mode in the datasheet. The list below shows the +supported modes with a brief description. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``"Europe modes"`` +* - ``"FM 1.2" (0)`` + - This configures FM band with a sample rate of 0.512 million +samples/sec with a 10.24 MHz sck. +* - ``"DAB 1.2" (1)`` + - This configures VHF band with a sample rate of 2.048 million +samples/sec with a 32.768 MHz sck. + +* - ``"North America modes"`` +* - ``"FM 1.0" (0)`` + - This configures FM band with a sample rate of 0.7441875 million +samples/sec with a 14.88375 MHz sck. +* - ``"DAB 1.2" (1)`` + - This configures FM band with a sample rate of 0.372 million +samples/sec with a 7.441875 MHz sck. diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index b31fa6f..d6ebeab 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -749,6 +749,10 @@ config VIDEO_SAA6752HS To compile this driver as a module, choose M here: the module will be called saa6752hs. +comment "SDR tuner chips" + +source "drivers/media/i2c/max2175/Kconfig" + comment "Miscellaneous helper chips" config VIDEO_THS7303 diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index 92773b2..cfae721 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -6,6 +6,8 @@ obj-$(CONFIG_VIDEO_CX25840) += cx25840/ obj-$(CONFIG_VIDEO_M5MOLS) += m5mols/ obj-y += soc_camera/ +obj-$(CONFIG_SDR_MAX2175) += max2175/ + obj-$(CONFIG_VIDEO_APTINA_PLL) += aptina-pll.o obj-$(CONFIG_VIDEO_TVAUDIO) += tvaudio.o obj-$(CONFIG_VIDEO_TDA7432) += tda7432.o diff --git a/drivers/media/i2c/max2175/Kconfig b/drivers/media/i2c/max2175/Kconfig new file mode 100644 index 000..93a8f83 --- /dev/null +++ b/drivers/media/i2c/max2175/Kconfig @@ -0,0 +1,8 @@ +config SDR_MAX2175 + tristate "Ma
[PATCH v2 6/7] dt-bindings: media: Add Renesas R-Car DRIF binding
Add binding documentation for Renesas R-Car Digital Radio Interface (DRIF) controller. Signed-off-by: Ramesh Shanmugasundaram --- .../devicetree/bindings/media/renesas,drif.txt | 202 + 1 file changed, 202 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/renesas,drif.txt diff --git a/Documentation/devicetree/bindings/media/renesas,drif.txt b/Documentation/devicetree/bindings/media/renesas,drif.txt new file mode 100644 index 000..1f3feaf --- /dev/null +++ b/Documentation/devicetree/bindings/media/renesas,drif.txt @@ -0,0 +1,202 @@ +Renesas R-Car Gen3 Digital Radio Interface controller (DRIF) + + +R-Car Gen3 DRIF is a SPI like receive only slave device. A general +representation of DRIF interfacing with a master device is shown below. + ++-++-+ +| |-SCK--->|CLK | +| Master|-SS>|SYNC DRIFn (slave) | +| |-SD0--->|D0 | +| |-SD1--->|D1 | ++-++-+ + +As per datasheet, each DRIF channel (drifn) is made up of two internal +channels (drifn0 & drifn1). These two internal channels share the common +CLK & SYNC. Each internal channel has its own dedicated resources like +irq, dma channels, address space & clock. This internal split is not +visible to the external master device. + +The device tree model represents each internal channel as a separate node. +The internal channels sharing the CLK & SYNC are tied together by their +phandles using a new property called "renesas,bonding". For the rest of +the documentation, unless explicitly stated, the word channel implies an +internal channel. + +When both internal channels are enabled they need to be managed together +as one (i.e.) they cannot operate alone as independent devices. Out of the +two, one of them needs to act as a primary device that accepts common +properties of both the internal channels. This channel is identified by a +new property called "renesas,primary-bond". + +To summarize, + - When both the internal channels that are bonded together are enabled, + the zeroth channel is selected as primary-bond. This channels accepts + properties common to all the members of the bond. + - When only one of the bonded channels need to be enabled, the property + "renesas,bonding" or "renesas,primary-bond" will have no effect. That + enabled channel can act alone as any other independent device. + +Required properties of an internal channel: +--- +- compatible: "renesas,r8a7795-drif" if DRIF controller is a part of R8A7795 SoC. + "renesas,rcar-gen3-drif" for a generic R-Car Gen3 compatible device. + When compatible with the generic version, nodes must list the + SoC-specific version corresponding to the platform first + followed by the generic version. +- reg: offset and length of that channel. +- interrupts: associated with that channel. +- clocks: phandle and clock specifier of that channel. +- clock-names: clock input name string: "fck". +- dmas: phandles to the DMA channels. +- dma-names: names of the DMA channel: "rx". +- renesas,bonding: phandle to the other channel. + +Optional properties of an internal channel: +--- +- power-domains: phandle to the respective power domain. + +Required properties of an internal channel when: + - It is the only enabled channel of the bond (or) + - If it acts as primary among enabled bonds + +- pinctrl-0: pin control group to be used for this channel. +- pinctrl-names: must be "default". +- renesas,primary-bond: empty property indicating the channel acts as primary + among the bonded channels. +- port: child port node of a channel that defines the local and remote + endpoints. The remote endpoint is assumed to be a third party tuner + device endpoint. + +Optional properties of an internal channel when: + - It is the only enabled channel of the bond (or) + - If it acts as primary among enabled bonds + +- renesas,syncmd : sync mode +0 (Frame start sync pulse mode. 1-bit width pulse + indicates start of a frame) +1 (L/R sync or I2S mode) (default) +- renesas,lsb-first: empty property indicates lsb bit is received first. +When not defined msb bit is received first (default) +- renesas,syncac-active: Indicates sync s
[PATCH v2 7/7] media: platform: rcar_drif: Add DRIF support
This patch adds Digital Radio Interface (DRIF) support to R-Car Gen3 SoCs. The driver exposes each instance of DRIF as a V4L2 SDR device. A DRIF device represents a channel and each channel can have one or two sub-channels respectively depending on the target board. DRIF supports only Rx functionality. It receives samples from a RF frontend tuner chip it is interfaced with. The combination of DRIF and the tuner device, which is registered as a sub-device, determines the receive sample rate and format. In order to be compliant as a V4L2 SDR device, DRIF needs to bind with the tuner device, which can be provided by a third party vendor. DRIF acts as a slave device and the tuner device acts as a master transmitting the samples. The driver allows asynchronous binding of a tuner device that is registered as a v4l2 sub-device. The driver can learn about the tuner it is interfaced with based on port endpoint properties of the device in device tree. The V4L2 SDR device inherits the controls exposed by the tuner device. The device can also be configured to use either one or both of the data pins at runtime based on the master (tuner) configuration. Signed-off-by: Ramesh Shanmugasundaram --- drivers/media/platform/Kconfig | 25 + drivers/media/platform/Makefile|1 + drivers/media/platform/rcar_drif.c | 1593 3 files changed, 1619 insertions(+) create mode 100644 drivers/media/platform/rcar_drif.c diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index d944421..d288146 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -421,3 +421,28 @@ menuconfig DVB_PLATFORM_DRIVERS if DVB_PLATFORM_DRIVERS source "drivers/media/platform/sti/c8sectpfe/Kconfig" endif #DVB_PLATFORM_DRIVERS + +menuconfig SDR_PLATFORM_DRIVERS + bool "SDR platform devices" + depends on MEDIA_SDR_SUPPORT + default n + ---help--- + Say Y here to enable support for platform-specific SDR Drivers. + +if SDR_PLATFORM_DRIVERS + +config VIDEO_RCAR_DRIF + tristate "Renesas Digitial Radio Interface (DRIF)" + depends on VIDEO_V4L2 && HAS_DMA + depends on ARCH_RENESAS + select VIDEOBUF2_VMALLOC + ---help--- + Say Y if you want to enable R-Car Gen3 DRIF support. DRIF is Digital + Radio Interface that interfaces with an RF front end chip. It is a + receiver of digital data which uses DMA to transfer received data to + a configured location for an application to use. + + To compile this driver as a module, choose M here; the module + will be called rcar_drif. + +endif # SDR_PLATFORM_DRIVERS diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index 5b3cb27..1c2daaf 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -47,6 +47,7 @@ obj-$(CONFIG_VIDEO_SH_VOU)+= sh_vou.o obj-$(CONFIG_SOC_CAMERA) += soc_camera/ +obj-$(CONFIG_VIDEO_RCAR_DRIF) += rcar_drif.o obj-$(CONFIG_VIDEO_RENESAS_FCP)+= rcar-fcp.o obj-$(CONFIG_VIDEO_RENESAS_FDP1) += rcar_fdp1.o obj-$(CONFIG_VIDEO_RENESAS_JPU)+= rcar_jpu.o diff --git a/drivers/media/platform/rcar_drif.c b/drivers/media/platform/rcar_drif.c new file mode 100644 index 000..0827bd8 --- /dev/null +++ b/drivers/media/platform/rcar_drif.c @@ -0,0 +1,1593 @@ +/* + * R-Car Gen3 Digital Radio Interface (DRIF) driver + * + * Copyright (C) 2016 Renesas Electronics Corporation + * + * 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. + */ + +/* + * The R-Car DRIF is a receive only MSIOF like controller with an + * external master device driving the SCK. It receives data into a FIFO, + * then this driver uses the SYS-DMAC engine to move the data from + * the device to memory. + * + * Each DRIF channel DRIFx (as per datasheet) contains two internal + * channels DRIFx0 & DRIFx1 within itself with each having its own resources + * like module clk, register set, irq and dma. These internal channels share + * common CLK & SYNC from master. The two data pins D0 & D1 shall be + * considered to represent the two internal channels. This internal split + * is not visible to the master device. + * + * Depending on the master device, a DRIF channel can use + * (1) both internal channels (D0 & D1) to receive data in parallel (or) + * (2) one internal channel (D0 or D1) to receive data + * + * The primar
[PATCH v2 5/7] doc_rst: media: New SDR formats PC16, PC18 & PC20
This patch adds documentation for the three new SDR formats V4L2_SDR_FMT_PCU16BE V4L2_SDR_FMT_PCU18BE V4L2_SDR_FMT_PCU20BE Signed-off-by: Ramesh Shanmugasundaram --- .../media/uapi/v4l/pixfmt-sdr-pcu16be.rst | 55 ++ .../media/uapi/v4l/pixfmt-sdr-pcu18be.rst | 55 ++ .../media/uapi/v4l/pixfmt-sdr-pcu20be.rst | 55 ++ Documentation/media/uapi/v4l/sdr-formats.rst | 3 ++ 4 files changed, 168 insertions(+) create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst new file mode 100644 index 000..2de1b1a --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst @@ -0,0 +1,55 @@ +.. -*- coding: utf-8; mode: rst -*- + +.. _V4L2-SDR-FMT-PCU16BE: + +** +V4L2_SDR_FMT_PCU16BE ('PC16') +** + +Planar complex unsigned 16-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadrature (IQ). Both I +and Q are represented as a 16 bit unsigned big endian number stored in +32 bit space. The remaining unused bits within the 32 bit space will be +padded with 0. I value starts first and Q value starts at an offset +equalling half of the buffer size (i.e.) offset = buffersize/2. Out of +the 16 bits, bit 15:2 (14 bit) is data and bit 1:0 (2 bit) can be any +value. + +**Byte Order.** +Each cell is one byte. + +.. flat-table:: +:header-rows: 1 +:stub-columns: 0 + +* - Offset: + - Byte B0 + - Byte B1 + - Byte B2 + - Byte B3 +* - start + 0: + - I'\ :sub:`0[13:6]` + - I'\ :sub:`0[5:0]; B1[1:0]=pad` + - pad + - pad +* - start + 4: + - I'\ :sub:`1[13:6]` + - I'\ :sub:`1[5:0]; B1[1:0]=pad` + - pad + - pad +* - ... +* - start + offset: + - Q'\ :sub:`0[13:6]` + - Q'\ :sub:`0[5:0]; B1[1:0]=pad` + - pad + - pad +* - start + offset + 4: + - Q'\ :sub:`1[13:6]` + - Q'\ :sub:`1[5:0]; B1[1:0]=pad` + - pad + - pad diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst new file mode 100644 index 000..da8b26b --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst @@ -0,0 +1,55 @@ +.. -*- coding: utf-8; mode: rst -*- + +.. _V4L2-SDR-FMT-PCU18BE: + +** +V4L2_SDR_FMT_PCU18BE ('PC18') +** + +Planar complex unsigned 18-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadrature (IQ). Both I +and Q are represented as a 18 bit unsigned big endian number stored in +32 bit space. The remaining unused bits within the 32 bit space will be +padded with 0. I value starts first and Q value starts at an offset +equalling half of the buffer size (i.e.) offset = buffersize/2. Out of +the 18 bits, bit 17:2 (16 bit) is data and bit 1:0 (2 bit) can be any +value. + +**Byte Order.** +Each cell is one byte. + +.. flat-table:: +:header-rows: 1 +:stub-columns: 0 + +* - Offset: + - Byte B0 + - Byte B1 + - Byte B2 + - Byte B3 +* - start + 0: + - I'\ :sub:`0[17:10]` + - I'\ :sub:`0[9:2]` + - I'\ :sub:`0[1:0]; B2[5:0]=pad` + - pad +* - start + 4: + - I'\ :sub:`1[17:10]` + - I'\ :sub:`1[9:2]` + - I'\ :sub:`1[1:0]; B2[5:0]=pad` + - pad +* - ... +* - start + offset: + - Q'\ :sub:`0[17:10]` + - Q'\ :sub:`0[9:2]` + - Q'\ :sub:`0[1:0]; B2[5:0]=pad` + - pad +* - start + offset + 4: + - Q'\ :sub:`1[17:10]` + - Q'\ :sub:`1[9:2]` + - Q'\ :sub:`1[1:0]; B2[5:0]=pad` + - pad diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst new file mode 100644 index 000..b073be5 --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst @@ -0,0 +1,55 @@ +.. -*- coding: utf-8; mode: rst -*- +.. _V4L2-SDR-FMT-PCU20BE: + +** +V4L2_SDR_FMT_PCU20BE ('PC20') +** + +Planar complex unsigned 20-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadrature (IQ). Both I +and Q are rep
[PATCH v2 4/7] media: Add new SDR formats PC16, PC18 & PC20
This patch adds support for the three new SDR formats. These formats were prefixed with "planar" indicating I & Q data are not interleaved as in other formats. Here, I & Q data constitutes the top half and bottom half of the received buffer. V4L2_SDR_FMT_PCU16BE - 14-bit complex (I & Q) unsigned big-endian sample inside 16-bit. V4L2 FourCC: PC16 V4L2_SDR_FMT_PCU18BE - 16-bit complex (I & Q) unsigned big-endian sample inside 18-bit. V4L2 FourCC: PC18 V4L2_SDR_FMT_PCU20BE - 18-bit complex (I & Q) unsigned big-endian sample inside 20-bit. V4L2 FourCC: PC20 Signed-off-by: Ramesh Shanmugasundaram --- drivers/media/v4l2-core/v4l2-ioctl.c | 3 +++ include/uapi/linux/videodev2.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 0c3f238..fdf6c913 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1213,6 +1213,9 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_SDR_FMT_CS8: descr = "Complex S8"; break; case V4L2_SDR_FMT_CS14LE: descr = "Complex S14LE"; break; case V4L2_SDR_FMT_RU12LE: descr = "Real U12LE"; break; + case V4L2_SDR_FMT_PCU16BE: descr = "Planar Complex U16BE"; break; + case V4L2_SDR_FMT_PCU18BE: descr = "Planar Complex U18BE"; break; + case V4L2_SDR_FMT_PCU20BE: descr = "Planar Complex U20BE"; break; case V4L2_TCH_FMT_DELTA_TD16: descr = "16-bit signed deltas"; break; case V4L2_TCH_FMT_DELTA_TD08: descr = "8-bit signed deltas"; break; case V4L2_TCH_FMT_TU16: descr = "16-bit unsigned touch data"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 46e8a2e3..26a31c8 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -669,6 +669,9 @@ struct v4l2_pix_format { #define V4L2_SDR_FMT_CS8 v4l2_fourcc('C', 'S', '0', '8') /* complex s8 */ #define V4L2_SDR_FMT_CS14LE v4l2_fourcc('C', 'S', '1', '4') /* complex s14le */ #define V4L2_SDR_FMT_RU12LE v4l2_fourcc('R', 'U', '1', '2') /* real u12le */ +#define V4L2_SDR_FMT_PCU16BE v4l2_fourcc('P', 'C', '1', '6') /* planar complex u16be */ +#define V4L2_SDR_FMT_PCU18BE v4l2_fourcc('P', 'C', '1', '8') /* planar complex u18be */ +#define V4L2_SDR_FMT_PCU20BE v4l2_fourcc('P', 'C', '2', '0') /* planar complex u20be */ /* Touch formats - used for Touch devices */ #define V4L2_TCH_FMT_DELTA_TD16v4l2_fourcc('T', 'D', '1', '6') /* 16-bit signed deltas */ -- 1.9.1
[PATCH v2 1/7] media: v4l2-ctrls: Reserve controls for MAX217X
Reserve controls for MAX217X RF to Bits tuner family. These hybrid radio receiver chips are highly programmable and hence reserving 32 controls. Signed-off-by: Ramesh Shanmugasundaram --- include/uapi/linux/v4l2-controls.h | 5 + 1 file changed, 5 insertions(+) diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 0d2e1e0..83b28b4 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -180,6 +180,11 @@ enum v4l2_colorfx { * We reserve 16 controls for this driver. */ #define V4L2_CID_USER_TC358743_BASE(V4L2_CID_USER_BASE + 0x1080) +/* The base for the max217x driver controls. + * We reserve 32 controls for this driver + */ +#define V4L2_CID_USER_MAX217X_BASE (V4L2_CID_USER_BASE + 0x1090) + /* MPEG-class control IDs */ /* The MPEG controls are applicable to all codec controls * and the 'MPEG' part of the define is historical */ -- 1.9.1
[PATCH v2 2/7] dt-bindings: media: Add MAX2175 binding description
Add device tree binding documentation for MAX2175 Rf to bits tuner device. Signed-off-by: Ramesh Shanmugasundaram --- .../devicetree/bindings/media/i2c/max2175.txt | 61 ++ .../devicetree/bindings/property-units.txt | 1 + 2 files changed, 62 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/max2175.txt diff --git a/Documentation/devicetree/bindings/media/i2c/max2175.txt b/Documentation/devicetree/bindings/media/i2c/max2175.txt new file mode 100644 index 000..f591ab4 --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/max2175.txt @@ -0,0 +1,61 @@ +Maxim Integrated MAX2175 RF to Bits tuner +- + +The MAX2175 IC is an advanced analog/digital hybrid-radio receiver with +RF to Bits® front-end designed for software-defined radio solutions. + +Required properties: + +- compatible: "maxim,max2175" for MAX2175 RF-to-bits tuner. +- clocks: phandle to the fixed xtal clock. +- clock-names: name of the fixed xtal clock. +- port: child port node of a tuner that defines the local and remote + endpoints. The remote endpoint is assumed to be an SDR device + that is capable of receiving the digital samples from the tuner. + +Optional properties: + +- maxim,slave: phandle to the master tuner if it is a slave. This + is used to define two tuners in diversity mode + (1 master, 1 slave). By default each tuner is an + individual master. +- maxim,refout-load-pF: load capacitance value (in pF) on reference + output drive level. The possible load values are +0 (default - refout disabled) + 10 + 20 + 30 + 40 + 60 + 70 +- maxim,am-hiz : empty property indicates AM Hi-Z filter path is + selected for AM antenna input. By default this + filter path is not used. + +Example: + + +Board specific DTS file + +/* Fixed XTAL clock node */ +maxim_xtal: clock { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <36864000>; +}; + +/* A tuner device instance under i2c bus */ +max2175_0: tuner@60 { + compatible = "maxim,max2175"; + reg = <0x60>; + clocks = <&maxim_xtal>; + clock-names = "xtal"; + maxim,refout-load-pF = <10>; + + port { + max2175_0_ep: endpoint { + remote-endpoint = <&slave_rx_device>; + }; + }; + +}; diff --git a/Documentation/devicetree/bindings/property-units.txt b/Documentation/devicetree/bindings/property-units.txt index 12278d7..f1f1c22 100644 --- a/Documentation/devicetree/bindings/property-units.txt +++ b/Documentation/devicetree/bindings/property-units.txt @@ -28,6 +28,7 @@ Electricity -ohms : Ohms -micro-ohms: micro Ohms -microvolt : micro volts +-pF: pico farads Temperature -- 1.9.1
[PATCH v2 0/7] Add V4L2 SDR (DRIF & MAX2175) driver
This patch set contains two drivers - Renesas R-Car Digital Radio Interface (DRIF) driver - Maxim's MAX2175 RF to Bits tuner driver These patches were based on top of media-next repo commit: 65390ea01ce678379da32b01f39fcfac4903f256 These two drivers combined together expose a V4L2 SDR device that is compliant with the V4L2 framework [1]. Agreed review comments are incorporated in this series. The rcar_drif device is modelled using "renesas,bonding" property. The discussion on this property is available here [2]. Change history: v1 -> v2: - SDR formats renamed as "planar" instead of sliced (Hans) - Documentation formatting correction (Laurent) rcar_drif: - DT model using "bonding" property - Addressed Laurent's coments on bindings - DT optional parameters rename & rework - Addressed Han's comments on driver - Addressed Geert's comments on DT max2175: - Avoided scaling using method proposed by Antti. Thanks - Bindings is a separate patch (Rob) - Addressed Rob's comment on bindings - Added Custom controls documentation (Laurent) Ramesh Shanmugasundaram (7): media: v4l2-ctrls: Reserve controls for MAX217X dt-bindings: media: Add MAX2175 binding description media: i2c: max2175: Add MAX2175 support media: Add new SDR formats PC16, PC18 & PC20 doc_rst: media: New SDR formats PC16, PC18 & PC20 dt-bindings: media: Add Renesas R-Car DRIF binding media: platform: rcar_drif: Add DRIF support [1] v4l2-compliance report: root@salvator-x:~# v4l2-compliance -S /dev/swradio0 v4l2-compliance SHA : 188e604d57bec065078ff772c802b93ddb6def4b Driver Info: Driver name : rcar_drif Card type : R-Car DRIF Bus info : platform:R-Car DRIF Driver version: 4.9.0 Capabilities : 0x8531 SDR Capture Tuner Read/Write Streaming Extended Pix Format Device Capabilities Device Caps : 0x0531 SDR Capture Tuner Read/Write Streaming Extended Pix Format Compliance test for device /dev/swradio0 (not using libv4l2): Required ioctls: test VIDIOC_QUERYCAP: OK Allow for multiple opens: test second sdr open: OK test VIDIOC_QUERYCAP: OK test VIDIOC_G/S_PRIORITY: OK test for unlimited opens: OK Debug ioctls: test VIDIOC_DBG_G/S_REGISTER: OK test VIDIOC_LOG_STATUS: OK Input ioctls: test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK test VIDIOC_G/S_FREQUENCY: OK test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported) test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported) Inputs: 0 Audio Inputs: 0 Tuners: 1 Output ioctls: test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported) Outputs: 0 Audio Outputs: 0 Modulators: 0 Input/Output configuration ioctls: test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported) Control ioctls: test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK test VIDIOC_G/S_CTRL: OK test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 5 Private Controls: 3 Format ioctls: test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK test VIDIOC_TRY_FMT: OK test VIDIOC_S_FMT: OK test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported) test Composing: OK (Not Supported) test Scaling: OK (Not Supported) Codec ioctls: test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported) Buffer ioctls: test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test VIDIOC_EXPBUF: OK (Not Supported) Test input 0: Total: 43, Succeeded: 43, Failed: 0, Warnings: 0 root@salvator-x:~# [2] "bonding" DT property discussion (https://www.mail-archive.com/linux-renesas-soc@vger.kernel.org/msg09415.htm
RE: [RFC] New Device Tree property - "bonding"
Hello Rob, > > >> On Monday 05 Dec 2016 09:57:32 Rob Herring wrote: > > >> > On Mon, Dec 5, 2016 at 8:40 AM, Laurent Pinchart wrote: > > >> > > On Monday 05 Dec 2016 08:18:34 Rob Herring wrote: > > >> > >> On Fri, Nov 25, 2016 at 10:55 AM, Ramesh Shanmugasundaram wrote: > > >> > >>> Hello DT maintainers, > > >> > >>> > > >> > >>> In one of the Renesas SoCs we have a device called DRIF > > >> > >>> (Digital Radio > > >> > >>> Interface) controller. A DRIF channel contains 4 external > > >> > >>> pins > > >> > >>> - SCK, SYNC, Data pins D0 & D1. > > >> > >>> > > >> > >>> Internally a DRIF channel is made up of two SPI slave devices > > >> > >>> (also called sub-channels here) that share common CLK & SYNC > > >> > >>> signals but have their own resource set. The DRIF channel can > > >> > >>> have either one of the sub-channel active at a time or both. > > >> > >>> When both sub-channels are active, they need to be managed > > >> > >>> together as one device as they share same CLK & SYNC. We plan > > >> > >>> to tie these two sub-channels together with a new property > > >> > >>> called > > "renesas,bonding". > > >> > >> > > >> > >> Is there no need to describe the master device? No GPIOs, > > >> > >> regulators or other sideband controls needed? If that's never > > >> > >> needed (which seems doubtful), then I would do something > > >> > >> different here probably with the master device as a child of > > >> > >> one DRIF and then phandles to master from the other DRIFs. > > >> > >> Otherwise, this looks > > >> fine to me. > > >> > > > > >> > > Here's a bit of background. > > >> > > > > >> > > The DRIF is an SPI receiver. It has three input pins, a clock > > >> > > line, a data line and a sync signal. The device is designed to > > >> > > be connected to a variety of data sources, usually plain SPI (1 > > >> > > data line), IIS (1 data > > >> > > line) but also radio tuners that output I/Q data > > >> > > (http://www.ni.com/tutorial/4805/en/) over two data lines. > > >> > > > > >> > > In the case of IQ each data sample is split in two I and Q > > >> > > values (typically 16 to 20 bits each in this case), and the > > >> > > values are transmitted serially over one data line each. The > > >> > > synchronization and clock signals are common to both data > > >> > > lines. The DRIF is optimized for this use case as the DRIF > > >> > > instances in the SoC (each of them having independent clocks, > > >> > > interrupts and control > > >> > > registers) are grouped by two, and the two instances in a group > > >> > > handle a single data line each but share the same clock and > > >> > > sync > > input. > > >> > > > > >> > > On the software side we need to group the I and Q values, which > > >> > > are DMA'ed to memory by the two DRIF instances, and make them > > >> > > available to userspace. The V4L2 API used here in SDR (Software > > >> > > Defined Radio) mode supports such use cases and exposes a > > >> > > single device node to userspace that allows control of the two > > >> > > DRIF instances as a single device. To be able to implement this > > >> > > we need kernel code to be aware of DRIF groups and, while > > >> > > binding to the DRIF instances separately, expose only one V4L2 > > >> > > device to > > userspace for each group. > > >> > > > > >> > > There's no master or slave instance from a hardware point of > > >> > > view, but the two instances are not interchangeable as they > > >> > > carry separate > > >> information. > > >> > > They must thus be identified at the driver level. > > >> > > > >> > By master, I meant the external master device that generates the > > >> > IQ
RE: [RFC] New Device Tree property - "bonding"
Hi Rob, > >> On Monday 05 Dec 2016 09:57:32 Rob Herring wrote: > >> > On Mon, Dec 5, 2016 at 8:40 AM, Laurent Pinchart wrote: > >> > > On Monday 05 Dec 2016 08:18:34 Rob Herring wrote: > >> > >> On Fri, Nov 25, 2016 at 10:55 AM, Ramesh Shanmugasundaram wrote: > >> > >>> Hello DT maintainers, > >> > >>> > >> > >>> In one of the Renesas SoCs we have a device called DRIF > >> > >>> (Digital Radio > >> > >>> Interface) controller. A DRIF channel contains 4 external pins > >> > >>> - SCK, SYNC, Data pins D0 & D1. > >> > >>> > >> > >>> Internally a DRIF channel is made up of two SPI slave devices > >> > >>> (also called sub-channels here) that share common CLK & SYNC > >> > >>> signals but have their own resource set. The DRIF channel can > >> > >>> have either one of the sub-channel active at a time or both. > >> > >>> When both sub-channels are active, they need to be managed > >> > >>> together as one device as they share same CLK & SYNC. We plan > >> > >>> to tie these two sub-channels together with a new property called > "renesas,bonding". > >> > >> > >> > >> Is there no need to describe the master device? No GPIOs, > >> > >> regulators or other sideband controls needed? If that's never > >> > >> needed (which seems doubtful), then I would do something > >> > >> different here probably with the master device as a child of one > >> > >> DRIF and then phandles to master from the other DRIFs. > >> > >> Otherwise, this looks > >> fine to me. > >> > > > >> > > Here's a bit of background. > >> > > > >> > > The DRIF is an SPI receiver. It has three input pins, a clock > >> > > line, a data line and a sync signal. The device is designed to be > >> > > connected to a variety of data sources, usually plain SPI (1 data > >> > > line), IIS (1 data > >> > > line) but also radio tuners that output I/Q data > >> > > (http://www.ni.com/tutorial/4805/en/) over two data lines. > >> > > > >> > > In the case of IQ each data sample is split in two I and Q values > >> > > (typically 16 to 20 bits each in this case), and the values are > >> > > transmitted serially over one data line each. The synchronization > >> > > and clock signals are common to both data lines. The DRIF is > >> > > optimized for this use case as the DRIF instances in the SoC > >> > > (each of them having independent clocks, interrupts and control > >> > > registers) are grouped by two, and the two instances in a group > >> > > handle a single data line each but share the same clock and sync > input. > >> > > > >> > > On the software side we need to group the I and Q values, which > >> > > are DMA'ed to memory by the two DRIF instances, and make them > >> > > available to userspace. The V4L2 API used here in SDR (Software > >> > > Defined Radio) mode supports such use cases and exposes a single > >> > > device node to userspace that allows control of the two DRIF > >> > > instances as a single device. To be able to implement this we > >> > > need kernel code to be aware of DRIF groups and, while binding to > >> > > the DRIF instances separately, expose only one V4L2 device to > userspace for each group. > >> > > > >> > > There's no master or slave instance from a hardware point of > >> > > view, but the two instances are not interchangeable as they carry > >> > > separate > >> information. > >> > > They must thus be identified at the driver level. > >> > > >> > By master, I meant the external master device that generates the IQ > >> > data, not which of the internal DRIF blocks is a master of the other. > >> > So back to my question, does the external master device need to be > >> > described? I worry the answer now for a simple case is no, but then > >> > later people are going to have cases needing to describe more. We > >> > need to answer this question first before we can decide what this > >> > binding should look like. > >> > >> Oh ye