Re: [PATCHv3 5/6] pinctrl: sh-pfc: r8a7778: Use lookup function for bias data

2016-11-12 Thread Laurent Pinchart
Hi Niklas, Thank you for the patch. On Saturday 12 Nov 2016 17:04:28 Niklas Söderlund wrote: > Change the data structure and use the generic sh_pfc_pin_to_bias_info() > function to get the register offset and bit information. > > Suggested-by: Laurent Pinchart

Re: [PATCHv3 4/6] pinctrl: sh-pfc: r8a7795: Use lookup function for bias data

2016-11-12 Thread Laurent Pinchart
Hi Niklas, Thank you for the patch. On Saturday 12 Nov 2016 17:04:27 Niklas Söderlund wrote: > There is a bug in the r8a7795 bias code where a WARN() is trigged > anytime a pin from PUEN0/PUD0is accessed. > > # cat /sys/kernel/debug/pinctrl/e606.pfc/pinconf-pins > > WARNING: CPU: 2 PID:

Re: [PATCHv3 2/6] pinctrl: sh-pfc: Add helper to handle bias lookup table

2016-11-12 Thread Laurent Pinchart
Hi Niklas, Thank you for the patch. On Saturday 12 Nov 2016 17:04:25 Niklas Söderlund wrote: > On some SoC there are no simple mapping of pins to bias register bits > and a lookup table is needed. This logic is already implemented in some > SoC specific drivers that could benefit from a generic

[PATCHv2 1/2] pinctrl: sh-pfc: r8a7796: Add drive strength support

2016-11-12 Thread Niklas Söderlund
Define the drive strength registers for the R8A7796. Add pins which are not part of a GPIO bank nor can be muxed between different functions but which still allow for there drive-strength to be configured. Signed-off-by: Niklas Söderlund ---

[PATCHv2 0/2] pinctrl: sh-pfc: r8a7796: Add drive strength and bias support

2016-11-12 Thread Niklas Söderlund
Hi, These patches add drive strength and bias support for both GPIO and none GPIO pins to r8a7796. Similar to the none GPIO pins for r8a7795 the system to derive unique pin numbers are the R-Car M3SiP pin layout. Tested on M3-W and the series depends on the series '[PATCHv3 0/6] pinctrl: sh-pfc:

[PATCHv2 2/2] pinctrl: sh-pfc: r8a7796: Add bias pinconf support

2016-11-12 Thread Niklas Söderlund
Implements pull-up and pull-down. On this SoC there is no simple mapping of GP pins to bias register bits, so we need a table. Signed-off-by: Niklas Söderlund --- drivers/pinctrl/sh-pfc/pfc-r8a7796.c | 355 +++ 1 file

[PATCHv3 1/6] pinctrl: sh-pfc: Do not unconditionally support PIN_CONFIG_BIAS_DISABLE

2016-11-12 Thread Niklas Söderlund
Always stating PIN_CONFIG_BIAS_DISABLE is supported gives untrue output when examining /sys/kernel/debug/pinctrl/e606.pfc/pinconf-pins if the operation get_bias() is implemented but the pin is not handled by the get_bias() implementation. In that case the output will state that "input bias

[PATCHv3 6/6] pinctrl: sh-pfc: Support named pins with custom configuration

2016-11-12 Thread Niklas Söderlund
Pins not associated with a GPIO port can still have other configuration parameters. Add a new macro SH_PFC_PIN_NAMED_CFG which allows for named pins to be declared with a set of configurations. The new macro is an modification of SH_PFC_PIN_NAMED to allow for optional configuration to be assigned.

[PATCHv3 0/6] pinctrl: sh-pfc: Fixups for bias handling and preparation for none GPIO pins

2016-11-12 Thread Niklas Söderlund
Hi, This series fixes two issues I encounter for bias handling in the PFC while preparing my drive strength patch set. I also attached a new patch 6/6 that adds the macro SH_PFC_PIN_NAMED_CFG() and was previously part of the series 'pinctrl: sh-pfc: r8a7795: Support none GPIO pins with

[PATCHv3 3/6] pinctrl: sh-pfc: r8a7795: Simplify get bias logic

2016-11-12 Thread Niklas Söderlund
The last else statement is missing braces and there indentation level can be reduced. Suggested-by: Laurent Pinchart Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart ---

[PATCHv3 2/6] pinctrl: sh-pfc: Add helper to handle bias lookup table

2016-11-12 Thread Niklas Söderlund
On some SoC there are no simple mapping of pins to bias register bits and a lookup table is needed. This logic is already implemented in some SoC specific drivers that could benefit from a generic implementation. Add helpers to deal with the lookup which later can be used by the SoC specific

[PATCHv3 4/6] pinctrl: sh-pfc: r8a7795: Use lookup function for bias data

2016-11-12 Thread Niklas Söderlund
There is a bug in the r8a7795 bias code where a WARN() is trigged anytime a pin from PUEN0/PUD0is accessed. # cat /sys/kernel/debug/pinctrl/e606.pfc/pinconf-pins WARNING: CPU: 2 PID: 2391 at drivers/pinctrl/sh-pfc/pfc-r8a7795.c:5364 r8a7795_pinmux_get_bias+0xbc/0xc8 [..] Call trace: []

[PATCHv3 5/6] pinctrl: sh-pfc: r8a7778: Use lookup function for bias data

2016-11-12 Thread Niklas Söderlund
Change the data structure and use the generic sh_pfc_pin_to_bias_info() function to get the register offset and bit information. Suggested-by: Laurent Pinchart Signed-off-by: Niklas Söderlund ---

Re: [PATCHv2 4/6] pinctrl: sh-pfc: r8a7795: Use lookup function for bias data

2016-11-12 Thread Niklas Söderlund
Hi Laurent, Thanks for your feedback! On 2016-11-12 03:47:50 +0200, Laurent Pinchart wrote: > Hi Niklas, > > Thank you for the patch. > > On Friday 11 Nov 2016 21:30:19 Niklas Söderlund wrote: > > From: Niklas Söderlund > > > > There is a bug in the

Re: [PATCHv2 2/6] pinctrl: sh-pfc: Add helper to handle bias lookup table

2016-11-12 Thread Niklas Söderlund
Hi Laurent, Thanks you for the feedback. On 2016-11-12 03:46:11 +0200, Laurent Pinchart wrote: > Hi Niklas, > > Thank you for the patch. > > On Friday 11 Nov 2016 21:30:17 Niklas Söderlund wrote: > > From: Niklas Söderlund > > > > On some SoC there are

[PATCHv2 07/32] media: rcar-vin: add wrapper to get rvin_graph_entity

2016-11-12 Thread Niklas Söderlund
Update the driver to retrieve the code and mbus_cfg values from a rvin_graph_entity retrieved from a wrapper function instead of directly accessing the entity for the digital port. This is done to prepare for Gen3 support where the subdeivce might change during runtime, so to directly accesses a

[PATCHv2 04/32] media: rcar-vin: use rvin_reset_format() in S_DV_TIMINGS

2016-11-12 Thread Niklas Söderlund
Use rvin_reset_format() in rvin_s_dv_timings() instead if just resetting a few fields. This fixes an issue where the field format was not properly set after S_DV_TIMINGS. Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 8

[PATCHv2 06/32] media: rcar-vin: fix standard in input enumeration

2016-11-12 Thread Niklas Söderlund
If the subdevice supports dv_timings_cap the driver should not fill in the standard. Also don't use the standard from probe time ask the subdevice each time, this is done in preparation for Gen3 support where the source subdevice might change during runtime. Signed-off-by: Niklas Söderlund

[PATCHv2 08/32] media: rcar-vin: move subdev source and sink pad index to rvin_graph_entity

2016-11-12 Thread Niklas Söderlund
Move the sink and source pad index from struct rvin_dev to struct rvin_graph_entity. This is done in preparation of Gen3 support where the active subdeivce can be changed during runtime. And if the subdevice is changed the pad numbers are different so it's better to read them a rvin_graph_entity

[PATCHv2 09/32] media: rcar-vin: move pad number discovery to async complete handler

2016-11-12 Thread Niklas Söderlund
The rvin_v4l2_probe() handler will with Gen3 support need to handle more then one subdevice. To prepare for this move the digital subdev pad number discover to the digital specific async notification complete function. Signed-off-by: Niklas Söderlund ---

[PATCHv2 10/32] media: rcar-vin: use pad information when verifying media bus format

2016-11-12 Thread Niklas Söderlund
Now that the pad information is present in struct rvin_graph_entity use it when verifying the media bus format. Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-core.c | 1 + 1 file changed, 1 insertion(+) diff --git

[PATCHv2 12/32] media: rcar-vin: split rvin_s_fmt_vid_cap()

2016-11-12 Thread Niklas Söderlund
The functionality provided by rvin_s_fmt_vid_cap() will be needed in other places to add Gen3 support. Split it up in a function which do the work and one which interface with the v4l2 API. Signed-off-by: Niklas Söderlund ---

[PATCHv2 11/32] media: rcar-vin: refactor pad lookup code

2016-11-12 Thread Niklas Söderlund
The code to lookup which pad is source and sink can be broken out to a helper function. A bad check is also dropped in this refactoring. If the subdeivce don't supply pad information the driver would not be able to use it if the check is kept. Signed-off-by: Niklas Söderlund

[PATCHv2 13/32] media: rcar-vin: register the video device early

2016-11-12 Thread Niklas Söderlund
This is done to prepare for Gen3 support where there can be more then one video pipeline which can terminate in a particular VIN instance. Each pipeline have its own set of subdevices so to attach to a specific subdevice at probe time is not possible. The pipelines will be configured using the

[PATCHv2 15/32] media: rcar-vin: move max width and height information to chip information

2016-11-12 Thread Niklas Söderlund
On Gen3 the max supported width and height will be different from Gen2. Move the limits to the struct chip_info to prepare for Gen3 support. Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-core.c | 6 ++

[PATCHv2 19/32] media: rcar-vin: add functions to manipulate Gen3 CHSEL value

2016-11-12 Thread Niklas Söderlund
On Gen3 the CSI routing is controlled by the VnCSI_IFMD register. One feature of this register is that it's only present in the VIN0 and VIN4 instances. The register in VIN0 controls the routing for VIN0-3 and the register in VIN4 controls routing for VIN4-7. To be able to control routing from a

[PATCHv2 00/32] rcar-vin: Add Gen3 with media controller support

2016-11-12 Thread Niklas Söderlund
Hi All, This series enable Gen3 VIN support in rcar-vin driver for Renesas r8a7795 and r8a7796. It is based on top of v4.9-rc1. Parts of this series was previously part of an different series from me which enabled Gen3 support in a different way (using s_input instead of a media controller) but

[PATCHv2 05/32] media: rcar-vin: fix how pads are handled for v4l2 subdeivce operations

2016-11-12 Thread Niklas Söderlund
The rcar-vin driver only uses one pad, pad number 0. All v4l2 operations which did not check that the requested operation was for pad 0 have been updated with a check to enforce this. All v4l2 operations that stored (and later restore) the requested pad before substituting it for the

[PATCHv2 03/32] media: rcar-vin: reset bytesperline and sizeimage when resetting format

2016-11-12 Thread Niklas Söderlund
These two fields where forgotten when refactoring the format reset code path. If they are not also reset at the same time as width and hight the format read using G_FMT will not match reality. Signed-off-by: Niklas Söderlund ---

[PATCHv2 31/32] media: rcar-vin: enable support for r8a7795

2016-11-12 Thread Niklas Söderlund
Add the SoC specific information for Renesas r8a7795. Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/Kconfig | 2 +- drivers/media/platform/rcar-vin/rcar-core.c | 71 + 2 files changed, 72

[PATCHv2 16/32] media: rcar-vin: change name of video device

2016-11-12 Thread Niklas Söderlund
The rcar-vin driver needs to be part of a media controller to support Gen3. Give each VIN instance a unique name so it can be referenced from userspace. Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 3 ++- 1 file

[PATCHv2 20/32] media: rcar-vin: expose a sink pad if we are on Gen3

2016-11-12 Thread Niklas Söderlund
Refactor the probe code path to look for the digital subdevice, if one is found use it just like the driver did before (Gen2 mode) but if it's not found prepare for a Gen3 mode by registering a pad for the media controller API to use. Signed-off-by: Niklas Söderlund

[PATCHv2 18/32] media: rcar-vin: enable Gen3 hardware configuration

2016-11-12 Thread Niklas Söderlund
Add the register needed to work with Gen3 hardware. This patch adds the logic for how to work with the Gen3 hardware. More work is required to enable the subdevice structure needed to configure capturing. Signed-off-by: Niklas Söderlund ---

[PATCHv2 28/32] media: rcar-vin: propagate format to bridge

2016-11-12 Thread Niklas Söderlund
The CSI2 bridge needs to know the video format, propagate it after the video source have had its say on the format. Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 15 +++ 1 file changed, 15 insertions(+) diff

[PATCHv2 02/32] media: entity: Add media_entity_has_route() function

2016-11-12 Thread Niklas Söderlund
From: Laurent Pinchart This is a wrapper around the media entity has_route operation. Signed-off-by: Laurent Pinchart Signed-off-by: Michal Simek Signed-off-by: Sakari Ailus

[PATCHv2 25/32] media: rcar-vin: enable CSI2 group subdevices in lookup helpers

2016-11-12 Thread Niklas Söderlund
Make the subdevice helpers look not only at the local digital subdevice but also for the CSI2 group subdevices which can be present on Gen3. Which CSI2 group subdevices are found depends on the CSI2 subgroup routing which is stored in the CHSEL register of the subgroup master (VIN0 for VIN0-3 and

[PATCHv2 22/32] media: rcar-vin: add chsel information to rvin_info

2016-11-12 Thread Niklas Söderlund
Each Gen3 SoC have a limited set of predefined routing possibilities for which CSI2 device and virtual channel can be routed to which VIN instance. Prepare to store this information in the struct rvin_info. Signed-off-by: Niklas Söderlund ---

[PATCHv2 29/32] media: rcar-vin: attach to CSI2 group when the video device is opened

2016-11-12 Thread Niklas Söderlund
Attempt to attach to the subdevices pointed out by the routing from the CSI2 group when the video device is opened. This is the last piece missing to enable CSI2 groups on Gen3. If the current CSI2 routing for the group points ta a set of subdevices which are not present (not all routings are

[PATCHv2 32/32] media: rcar-vin: enable support for r8a7796

2016-11-12 Thread Niklas Söderlund
Add the SoC specific information for Renesas r8a7796. Signed-off-by: Niklas Söderlund --- .../devicetree/bindings/media/rcar_vin.txt | 1 + drivers/media/platform/rcar-vin/rcar-core.c| 63 ++ 2 files changed, 64

[PATCHv2 30/32] media: rcar-vin: add Gen3 devicetree bindings documentation

2016-11-12 Thread Niklas Söderlund
Document the Gen3 devicetree bindings. The new bindings are all handled in the port@1 node, if an endpoint is described as on Gen2 in port@0 the driver will work in Gen2 mode and this is supported on Gen3. The new CSI-2 video sources are only supported on Gen3. Signed-off-by: Niklas Söderlund

[PATCHv2 17/32] media: rcar-vin: clarify error message from the digital notifier

2016-11-12 Thread Niklas Söderlund
Some of the parser functions previously only used by the digital subdevice OF/V4L2 async code will be shared with the CSI2 group notifiers. Clarify which notifier register error message and mark which functions are generic helpers. Signed-off-by: Niklas Söderlund

[PATCHv2 21/32] media: rcar-vin: add group allocator functions

2016-11-12 Thread Niklas Söderlund
On Gen3 all VIN instances which wish to interact with with the shared CSI2 resource needs to be part of the same media device and share other information, such as subdevices and be able to call routing operations on other VIN instances. This patch adds a group allocator which joins all VIN

[PATCHv2 23/32] media: rcar-vin: parse Gen3 OF and setup media graph

2016-11-12 Thread Niklas Söderlund
Parse the VIN Gen3 OF graph and register all devices in the CSI2 group common media device. Once a subdevice is added to the common media device list as many links as possible are added and if possible enabled. The links between the video source device and the CSI2 bridge are enabled as immutable

[PATCHv2 24/32] media: rcar-vin: add link notify for Gen3

2016-11-12 Thread Niklas Söderlund
Add the ability to process media device link change request. Link enablement are a bit complicated on Gen3, if it's possible to enable a link depends on what other links already are enabled. On Gen3 the 8 VIN are split into two subgroups (VIN0-3 and VIN4-7) and from a routing perspective these two

[PATCHv2 26/32] media: rcar-vin: add helpers for bridge

2016-11-12 Thread Niklas Söderlund
On Gen3 there might be a CSI2 bridge between the video source and the VIN. Add helpers to check for this and to fetch the bridge subdevice. Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-core.c | 19 +++

[PATCHv2 14/32] media: rcar-vin: move chip information to own struct

2016-11-12 Thread Niklas Söderlund
When Gen3 support is added to the driver more then chip id will be different for the different Soc. To avoid a lot of if statements in the code create a struct chip_info to contain this information. Signed-off-by: Niklas Söderlund ---

[PATCHv2 27/32] media: rcar-vin: start/stop the CSI2 bridge stream

2016-11-12 Thread Niklas Söderlund
On Gen3 the CSI2 bridge stream needs to be start/stop in conjunction with the video source. Create helpers to deal with both the Gen2 single subdevice case and the Gen3 CSI2 group case. In the Gen3 case there might be other simultaneous users of the bridge and source devices so examine each

[PATCHv2 01/32] media: entity: Add has_route entity operation

2016-11-12 Thread Niklas Söderlund
From: Laurent Pinchart The optional operation can be used by entities to report whether two pads are internally connected. Signed-off-by: Laurent Pinchart Signed-off-by: Michal Simek Signed-off-by:

[PATCHv4] media: rcar-csi2: add Renesas R-Car MIPI CSI-2 driver

2016-11-12 Thread Niklas Söderlund
A V4L2 driver for Renesas R-Car MIPI CSI-2 interface. The driver supports the rcar-vin driver on R-Car Gen3 SoCs where a separate driver is needed to receive CSI-2. Driver is based on a prototype by Koji Matsuoka in the Renesas BSP. Signed-off-by: Niklas Söderlund

Re: [PATCH 1/3] gen-image: support overlapping hue areas for HGT frames

2016-11-12 Thread Niklas Söderlund
Hi Laurent, Thank you for the feedback. On 2016-11-11 16:53:15 +0200, Laurent Pinchart wrote: > Hi Niklas, > > Thank you for the patch. > > On Tuesday 04 Oct 2016 15:09:13 Niklas Söderlund wrote: > > From: Niklas Söderlund > > > > The HGT can operate