Prepare for CCP2 / CSI-1 support, omap3isp fixes
Sakari Ailus
maintainercover Prepare for CCP2 / CSI-1 support, omap3isp fixes
Hi Pavel and others,
Most of these patches have been posted to the list in some form or other already but a lot has happened since. Thus reposting. There are more patches in my ccp2 branch but they're not quite ready as such, for the reasons discussed previously.
Pavel Machek (1):
smiapp: add CCP2 support
Sakari Ailus (7):
dt: bindings: Explicitly specify bus type
dt: bindings: Add strobe property for CCP2
v4l: fwnode: Call CSI2 bus csi2, not csi
v4l: fwnode: Obtain data bus type from FW
v4l: Add support for CSI-1 and CCP2 busses
omap3isp: Check for valid port in endpoints
omap3isp: Destroy CSI-2 phy mutexes in error and module removal
.../devicetree/bindings/media/video-interfaces.txt | 8 ++- drivers/media/i2c/smiapp/smiapp-core.c | 14 +++-- drivers/media/platform/omap3isp/isp.c | 8 ++- drivers/media/platform/omap3isp/ispcsiphy.c | 6 ++ drivers/media/platform/omap3isp/ispcsiphy.h | 1 + drivers/media/platform/pxa_camera.c | 3 + drivers/media/platform/soc_camera/soc_mediabus.c | 3 + drivers/media/v4l2-core/v4l2-fwnode.c | 73 ++++++++++++++++++---- include/media/v4l2-fwnode.h | 19 ++++++ include/media/v4l2-mediabus.h | 4 ++ 10 files changed, 118 insertions(+), 21 deletions(-)
Signature · 1 line
2.11.0
Sakari Ailus
maintainerPATCH 1/8 dt: bindings: Explicitly specify bus type
From: Sakari Ailus <[email protected]>
In the vast majority of cases the bus type is known to the driver(s) since a receiver or transmitter can only support a single one. There are cases however where different options are possible, or the bus type cannot be automatically detected.
The existing V4L2 OF support tries to figure out the bus type and parse the bus parameters based on that. This does not scale too well as there are multiple serial busses that share common properties.
Some hardware also supports multiple types of busses on the same interfaces.
--- Documentation/devicetree/bindings/media/video-interfaces.txt | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/media/video-interfaces.txt +5 -0
@@ -76,6 +76,11 @@ Optional endpoint properties mode horizontal and vertical synchronization signals are provided to the slave device (data source) by the master device (data sink). In the master mode the data source device is also the source of the synchronization signals. +- bus-type: data bus type. Possible values are: + 0 - autodetect based on other properties (MIPI CSI-2 D-PHY, parallel or Bt656) + 1 - MIPI CSI-2 C-PHY + 2 - MIPI CSI1 + 3 - CCP2 - bus-width: number of data lines actively used, valid for the parallel busses. - data-shift: on the parallel data busses, if bus-width is used to specify the number of data lines, data-shift can be used to specify which data lines are
Signature · 1 line
2.11.0
Sakari Ailus
maintainerPATCH 2/8 dt: bindings: Add strobe property for CCP2
In reply to Sakari AilusDocument the CSI1/CCP2 property strobe. It signifies the clock or strobe mode.
--- Documentation/devicetree/bindings/media/video-interfaces.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/media/video-interfaces.txt +2 -1
@@ -117,7 +117,8 @@ Optional endpoint properties should be the combined length of data-lanes and clock-lanes properties. If the lane-polarities property is omitted, the value must be interpreted as 0 (normal). This property is valid for serial busses only. - +- strobe: Whether the clock signal is used as clock (0) or strobe (1). Used + with CCP2, for instance. Example -------
Signature · 1 line
2.11.0
Sakari Ailus
maintainerPATCH 3/8 v4l: fwnode: Call CSI2 bus csi2, not csi
In reply to Sakari AilusThe function to parse CSI2 bus parameters was called v4l2_fwnode_endpoint_parse_csi_bus(), rename it as v4l2_fwnode_endpoint_parse_csi2_bus() in anticipation of CSI1/CCP2 support.
--- drivers/media/v4l2-core/v4l2-fwnode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/v4l2-core/v4l2-fwnode.c +3 -3
@@ -28,8 +28,8 @@#include <media/v4l2-fwnode.h> -static int v4l2_fwnode_endpoint_parse_csi_bus (struct fwnode_handle *fwnode, -struct v4l2_fwnode_endpoint *vep) +static int v4l2_fwnode_endpoint_parse_csi2_bus (struct fwnode_handle *fwnode, +struct v4l2_fwnode_endpoint *vep) {struct v4l2_fwnode_bus_mipi_csi2 *bus = &vep->bus.mipi_csi2;bool have_clk_lane = false;
@@ -176,7 +176,7 @@ int v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode,memset (&vep->bus_type,0 ,sizeof (*vep) - offsetof(typeof(*vep), bus_type)); - rval =v4l2_fwnode_endpoint_parse_csi_bus (fwnode, vep); + rval =v4l2_fwnode_endpoint_parse_csi2_bus (fwnode, vep);if (rval)return rval;/*
Signature · 1 line
2.11.0
Sakari Ailus
maintainerPATCH 4/8 v4l: fwnode: Obtain data bus type from FW
In reply to Sakari AilusFrom: Sakari Ailus <[email protected]>
Just obtain it. It'll actually get used soon with CSI-1/CCP2.
--- drivers/media/v4l2-core/v4l2-fwnode.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/media/v4l2-core/v4l2-fwnode.c +11 -0
@@ -28,6 +28,14 @@#include <media/v4l2-fwnode.h> +enum v4l2_fwnode_bus_type { +V4L2_FWNODE_BUS_TYPE_GUESS =0 , +V4L2_FWNODE_BUS_TYPE_CSI2_CPHY , +V4L2_FWNODE_BUS_TYPE_CSI1 , +V4L2_FWNODE_BUS_TYPE_CCP2 , +NR_OF_V4L2_FWNODE_BUS_TYPE , +}; +static int v4l2_fwnode_endpoint_parse_csi2_bus (struct fwnode_handle *fwnode,struct v4l2_fwnode_endpoint *vep) {
@@ -168,6 +176,7 @@ static void v4l2_fwnode_endpoint_parse_parallel_bus(int v4l2_fwnode_endpoint_parse (struct fwnode_handle *fwnode,struct v4l2_fwnode_endpoint *vep) { +u32 bus_type =0 ;int rval;fwnode_graph_parse_endpoint (fwnode, &vep->base);
@@ -176,6 +185,8 @@ int v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode,memset (&vep->bus_type,0 ,sizeof (*vep) - offsetof(typeof(*vep), bus_type)); +fwnode_property_read_u32 (fwnode,"bus-type" , &bus_type); + rval =v4l2_fwnode_endpoint_parse_csi2_bus (fwnode, vep);if (rval)return rval;
Signature · 1 line
2.11.0
Sakari Ailus
maintainerPATCH 5/8 v4l: Add support for CSI-1 and CCP2 busses
In reply to Sakari AilusFrom: Sakari Ailus <[email protected]>
CCP2 and CSI-1, are older single data lane serial busses.
--- drivers/media/platform/pxa_camera.c | 3 ++ drivers/media/platform/soc_camera/soc_mediabus.c | 3 ++ drivers/media/v4l2-core/v4l2-fwnode.c | 58 +++++++++++++++++++----- include/media/v4l2-fwnode.h | 19 ++++++++ include/media/v4l2-mediabus.h | 4 ++ 5 files changed, 76 insertions(+), 11 deletions(-)
drivers/media/platform/pxa_camera.c +3 -0
@@ -638,6 +638,9 @@ static unsigned int pxa_mbus_config_compatible(const struct v4l2_mbus_config *cf mipi_clock = common_flags & (V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK |V4L2_MBUS_CSI2_CONTINUOUS_CLOCK );return (!mipi_lanes || !mipi_clock) ?0 : common_flags; +default : +__WARN (); +return -EINVAL ; }return 0 ; }
drivers/media/platform/soc_camera/soc_mediabus.c +3 -0
@@ -508,6 +508,9 @@ unsigned int soc_mbus_config_compatible(const struct v4l2_mbus_config *cfg, mipi_clock = common_flags & (V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK |V4L2_MBUS_CSI2_CONTINUOUS_CLOCK );return (!mipi_lanes || !mipi_clock) ?0 : common_flags; +default : +__WARN (); +return -EINVAL ; }return 0 ; }
drivers/media/v4l2-core/v4l2-fwnode.c +47 -11
70 lines not on this page · raw message
include/media/v4l2-fwnode.h +19 -0
@@ -56,6 +56,24 @@ struct v4l2_fwnode_bus_parallel { };/** +* struct v4l2_fwnode_bus_mipi_csi1 - CSI-1/CCP2 data bus structure +* @clock_inv: polarity of clock/strobe signal +* false - not inverted, true - inverted +* @strobe: false - data/clock, true - data/strobe +* @lane_polarity: the polarities of the clock (index 0) and data lanes +index (1) +* @data_lane: the number of the data lane +* @clock_lane: the number of the clock lane +*/ +struct v4l2_fwnode_bus_mipi_csi1 { +bool clock_inv; +bool strobe; +bool lane_polarity[2 ]; +unsigned char data_lane; +unsigned char clock_lane; +}; + +/** * struct v4l2_fwnode_endpoint - the endpoint data structure * @base: fwnode endpoint of the v4l2_fwnode * @bus_type: bus type
@@ -72,6 +90,7 @@ struct v4l2_fwnode_endpoint {enum v4l2_mbus_type bus_type;union {struct v4l2_fwnode_bus_parallel parallel; +struct v4l2_fwnode_bus_mipi_csi1 mipi_csi1;struct v4l2_fwnode_bus_mipi_csi2 mipi_csi2; } bus;u64 *link_frequencies;
include/media/v4l2-mediabus.h +4 -0
@@ -69,11 +69,15 @@* @V4L2_MBUS_PARALLEL: parallel interface with hsync and vsync * @V4L2_MBUS_BT656: parallel interface with embedded synchronisation, can * also be used for BT.1120 +* @V4L2_MBUS_CSI1: MIPI CSI-1 serial interface +* @V4L2_MBUS_CCP2: CCP2 (Compact Camera Port 2) * @V4L2_MBUS_CSI2: MIPI CSI-2 serial interface */ enum v4l2_mbus_type {V4L2_MBUS_PARALLEL ,V4L2_MBUS_BT656 , +V4L2_MBUS_CSI1 , +V4L2_MBUS_CCP2 ,V4L2_MBUS_CSI2 , };
Signature · 1 line
2.11.0
Sakari Ailus
maintainerPATCH 6/8 smiapp: add CCP2 support
In reply to Sakari AilusFrom: Pavel Machek <[email protected]>
Add support for CCP2 connected SMIA sensors as found on the Nokia N900.
--- drivers/media/i2c/smiapp/smiapp-core.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/media/i2c/smiapp/smiapp-core.c +10 -4
@@ -2809,13 +2809,19 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)switch (bus_cfg->bus_type) {case V4L2_MBUS_CSI2 : hwcfg->csi_signalling_mode =SMIAPP_CSI_SIGNALLING_MODE_CSI2 ; + hwcfg->lanes = bus_cfg->bus.mipi_csi2.num_data_lanes; +break ; +case V4L2_MBUS_CCP2 : + hwcfg->csi_signalling_mode = (bus_cfg->bus.mipi_csi1.strobe) ? +SMIAPP_CSI_SIGNALLING_MODE_CCP2_DATA_STROBE : +SMIAPP_CSI_SIGNALLING_MODE_CCP2_DATA_CLOCK ; + hwcfg->lanes =1 ;break ; -/* FIXME: add CCP2 support. */ default : +dev_err (dev,"unsupported bus %u\n" , bus_cfg->bus_type); goto out_err; } - hwcfg->lanes = bus_cfg->bus.mipi_csi2.num_data_lanes;dev_dbg (dev,"lanes %u\n" , hwcfg->lanes);/* NVM size is not mandatory */
@@ -2828,8 +2834,8 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev) goto out_err; } -dev_dbg (dev,"nvm %d, clk %d, csi %d\n" , hwcfg->nvm_size, - hwcfg->ext_clk, hwcfg->csi_signalling_mode); +dev_dbg (dev,"nvm %d, clk %d, mode %d\n" , + hwcfg->nvm_size, hwcfg->ext_clk, hwcfg->csi_signalling_mode);if (!bus_cfg->nr_of_link_frequencies) {dev_warn (dev,"no link frequencies defined\n" );
Signature · 1 line
2.11.0
Sakari Ailus
maintainerPATCH 7/8 omap3isp: Check for valid port in endpoints
In reply to Sakari AilusCheck that we do have a valid port in an endpoint, return an error if not.
--- drivers/media/platform/omap3isp/isp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/omap3isp/isp.c +1 -1
@@ -2081,7 +2081,7 @@ static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode,default :dev_warn (dev,"%s: invalid interface %u\n" ,to_of_node (fwnode)->full_name, vep.base.port); -break ; +return -EINVAL ; }return 0 ;
Signature · 1 line
2.11.0
Sakari Ailus
maintainerPATCH 8/8 omap3isp: Destroy CSI-2 phy mutexes in error and module removal
In reply to Sakari AilusThe CSI-2 phy driver did initialise mutexes in its init function but there was no corresponding cleanup function destroying them. Fix that. Also clean up ISP module initialisation a little.
--- drivers/media/platform/omap3isp/isp.c | 6 ++++-- drivers/media/platform/omap3isp/ispcsiphy.c | 6 ++++++ drivers/media/platform/omap3isp/ispcsiphy.h | 1 + 3 files changed, 11 insertions(+), 2 deletions(-)
drivers/media/platform/omap3isp/isp.c +4 -2
@@ -1859,6 +1859,7 @@ static void isp_cleanup_modules(struct isp_device *isp)omap3isp_ccdc_cleanup (isp);omap3isp_ccp2_cleanup (isp);omap3isp_csi2_cleanup (isp); +omap3isp_csiphy_cleanup (isp); }static int isp_initialize_modules (struct isp_device *isp)
@@ -1868,7 +1869,7 @@ static int isp_initialize_modules(struct isp_device *isp) ret =omap3isp_csiphy_init (isp);if (ret <0 ) {dev_err (isp->dev,"CSI PHY initialization failed\n" ); - goto error_csiphy; +return ret; } ret =omap3isp_csi2_init (isp);
@@ -1937,7 +1938,8 @@ static int isp_initialize_modules(struct isp_device *isp) error_ccp2:omap3isp_csi2_cleanup (isp); error_csi2: -error_csiphy: +omap3isp_csiphy_cleanup (isp); +return ret; }
drivers/media/platform/omap3isp/ispcsiphy.c +6 -0
@@ -345,3 +345,9 @@ int omap3isp_csiphy_init(struct isp_device *isp)return 0 ; } + +void omap3isp_csiphy_cleanup (struct isp_device *isp) +{ +mutex_destroy (&isp->isp_csiphy1.mutex); +mutex_destroy (&isp->isp_csiphy2.mutex); +}
drivers/media/platform/omap3isp/ispcsiphy.h +1 -0
@@ -39,5 +39,6 @@ struct isp_csiphy {int omap3isp_csiphy_acquire (struct isp_csiphy *phy);void omap3isp_csiphy_release (struct isp_csiphy *phy);int omap3isp_csiphy_init (struct isp_device *isp); +void omap3isp_csiphy_cleanup (struct isp_device *isp);#endif /* OMAP3_ISP_CSI_PHY_H */
Signature · 1 line
2.11.0
Hi!
Quoted 4 lines
Most of these patches have been posted to the list in some form or other already but a lot has happened since. Thus reposting. There are more patches in my ccp2 branch but they're not quite ready as such, for the reasons discussed previously.
I'm using Sakari's ccp2 branch as a basis of camera support for N900. camera-fw5-6 branch on kernel.org has the code, and it works rather well.
Yes, there's more work to be done (finishing the support in omap3isp, connecting focus, flash, all the userland support, ...), but this is good basis and is ready now.
Thus (for the series)
Best regards,
Pavel
Quoted 12 lines
Pavel Machek (1):
smiapp: add CCP2 supportSakari Ailus (7):
dt: bindings: Explicitly specify bus type
dt: bindings: Add strobe property for CCP2
v4l: fwnode: Call CSI2 bus csi2, not csi
v4l: fwnode: Obtain data bus type from FW
v4l: Add support for CSI-1 and CCP2 busses
omap3isp: Check for valid port in endpoints
omap3isp: Destroy CSI-2 phy mutexes in error and module removal
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH 3/8] v4l: fwnode: Call CSI2 bus csi2, not csi
In reply to Sakari AilusHi,
Quoted 6 lines · Sakari Ailus
The function to parse CSI2 bus parameters was called
v4l2_fwnode_endpoint_parse_csi_bus(), rename it asv4l2_fwnode_endpoint_parse_csi2_bus()in anticipation of CSI1/CCP2 support.Signed-off-by Sakari Ailus <[email protected]>
-- Sebastian
Quoted 31 lines
--- drivers/media/v4l2-core/v4l2-fwnode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/media/v4l2-core/v4l2-fwnode.c +3
-3@@ -28,8 +28,8 @@#include <media/v4l2-fwnode.h> -static int v4l2_fwnode_endpoint_parse_csi_bus (struct fwnode_handle *fwnode, -struct v4l2_fwnode_endpoint *vep) +static int v4l2_fwnode_endpoint_parse_csi2_bus (struct fwnode_handle *fwnode, +struct v4l2_fwnode_endpoint *vep) {struct v4l2_fwnode_bus_mipi_csi2 *bus = &vep->bus.mipi_csi2;bool have_clk_lane = false;@@ -176,7 +176,7 @@ int v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode,memset (&vep->bus_type,0 ,sizeof (*vep) - offsetof(typeof(*vep), bus_type)); - rval =v4l2_fwnode_endpoint_parse_csi_bus (fwnode, vep); + rval =v4l2_fwnode_endpoint_parse_csi2_bus (fwnode, vep);if (rval)return rval;/* Signature · 1 line
2.11.0
Re: [PATCH 4/8] v4l: fwnode: Obtain data bus type from FW
In reply to Sakari AilusHi,
Quoted 5 lines · Sakari Ailus
From: Sakari Ailus <[email protected]>
Just obtain it. It'll actually get used soon with CSI-1/CCP2.
Signed-off-by Sakari Ailus <[email protected]>
-- Sebastian
Quoted 43 lines
--- drivers/media/v4l2-core/v4l2-fwnode.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/media/v4l2-core/v4l2-fwnode.c +11
-0@@ -28,6 +28,14 @@#include <media/v4l2-fwnode.h> +enum v4l2_fwnode_bus_type { +V4L2_FWNODE_BUS_TYPE_GUESS =0 , +V4L2_FWNODE_BUS_TYPE_CSI2_CPHY , +V4L2_FWNODE_BUS_TYPE_CSI1 , +V4L2_FWNODE_BUS_TYPE_CCP2 , +NR_OF_V4L2_FWNODE_BUS_TYPE , +}; +static int v4l2_fwnode_endpoint_parse_csi2_bus (struct fwnode_handle *fwnode,struct v4l2_fwnode_endpoint *vep) {@@ -168,6 +176,7 @@ static void v4l2_fwnode_endpoint_parse_parallel_bus(int v4l2_fwnode_endpoint_parse (struct fwnode_handle *fwnode,struct v4l2_fwnode_endpoint *vep) { +u32 bus_type =0 ;int rval;fwnode_graph_parse_endpoint (fwnode, &vep->base);@@ -176,6 +185,8 @@ int v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode,memset (&vep->bus_type,0 ,sizeof (*vep) - offsetof(typeof(*vep), bus_type)); +fwnode_property_read_u32 (fwnode,"bus-type" , &bus_type); + rval =v4l2_fwnode_endpoint_parse_csi2_bus (fwnode, vep);if (rval)return rval;Signature · 1 line
2.11.0
Re: [PATCH 5/8] v4l: Add support for CSI-1 and CCP2 busses
In reply to Sakari AilusHi,
Quoted 6 lines · Sakari Ailus
From: Sakari Ailus <[email protected]>
CCP2 and CSI-1, are older single data lane serial busses.
Signed-off-by Sakari Ailus <[email protected]>Signed-off-by Pavel Machek <[email protected]>
-- Sebastian
Quoted 172 lines
--- drivers/media/platform/pxa_camera.c | 3 ++ drivers/media/platform/soc_camera/soc_mediabus.c | 3 ++ drivers/media/v4l2-core/v4l2-fwnode.c | 58 +++++++++++++++++++----- include/media/v4l2-fwnode.h | 19 ++++++++ include/media/v4l2-mediabus.h | 4 ++ 5 files changed, 76 insertions(+), 11 deletions(-)drivers/media/platform/pxa_camera.c +3
-0@@ -638,6 +638,9 @@ static unsigned int pxa_mbus_config_compatible(const struct v4l2_mbus_config *cf mipi_clock = common_flags & (V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK |V4L2_MBUS_CSI2_CONTINUOUS_CLOCK );return (!mipi_lanes || !mipi_clock) ?0 : common_flags; +default : +__WARN (); +return -EINVAL ; }return 0 ; }drivers/media/platform/soc_camera/soc_mediabus.c +3
-0@@ -508,6 +508,9 @@ unsigned int soc_mbus_config_compatible(const struct v4l2_mbus_config *cfg, mipi_clock = common_flags & (V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK |V4L2_MBUS_CSI2_CONTINUOUS_CLOCK );return (!mipi_lanes || !mipi_clock) ?0 : common_flags; +default : +__WARN (); +return -EINVAL ; }return 0 ; }drivers/media/v4l2-core/v4l2-fwnode.c +47
-11@@ -154,6 +154,31 @@ static void v4l2_fwnode_endpoint_parse_parallel_bus( } +void v4l2_fwnode_endpoint_parse_csi1_bus (struct fwnode_handle *fwnode, +struct v4l2_fwnode_endpoint *vep, +u32 bus_type) +{ +struct v4l2_fwnode_bus_mipi_csi1 *bus = &vep->bus.mipi_csi1; +u32 v; + +if (!fwnode_property_read_u32 (fwnode,"clock-inv" , &v)) + bus->clock_inv = v; + +if (!fwnode_property_read_u32 (fwnode,"strobe" , &v)) + bus->strobe = v; + +if (!fwnode_property_read_u32 (fwnode,"data-lanes" , &v)) + bus->data_lane = v; + +if (!fwnode_property_read_u32 (fwnode,"clock-lanes" , &v)) + bus->clock_lane = v; + +if (bus_type ==V4L2_FWNODE_BUS_TYPE_CCP2 ) + vep->bus_type =V4L2_MBUS_CCP2 ; +else + vep->bus_type =V4L2_MBUS_CSI1 ; +} +/** * v4l2_fwnode_endpoint_parse() - parse all fwnode node properties * @fwnode: pointer to the endpoint's fwnode handle @@ -187,17 +212,28 @@ int v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode,fwnode_property_read_u32 (fwnode,"bus-type" , &bus_type); - rval =v4l2_fwnode_endpoint_parse_csi2_bus (fwnode, vep); -if (rval) -return rval; -/* -* Parse the parallel video bus properties only if none -* of the MIPI CSI-2 specific properties were found. -*/ -if (vep->bus.mipi_csi2.flags ==0 ) -v4l2_fwnode_endpoint_parse_parallel_bus (fwnode, vep); - -return 0 ; +switch (bus_type) { +case V4L2_FWNODE_BUS_TYPE_GUESS : + rval =v4l2_fwnode_endpoint_parse_csi2_bus (fwnode, vep); +if (rval) +return rval; +/* +* Parse the parallel video bus properties only if none +* of the MIPI CSI-2 specific properties were found. +*/ +if (vep->bus.mipi_csi2.flags ==0 ) +v4l2_fwnode_endpoint_parse_parallel_bus (fwnode, vep); + +return 0 ; +case V4L2_FWNODE_BUS_TYPE_CCP2 : +case V4L2_FWNODE_BUS_TYPE_CSI1 : +v4l2_fwnode_endpoint_parse_csi1_bus (fwnode, vep, bus_type); + +return 0 ; +default : +pr_warn ("unsupported bus type %u\n" , bus_type); +return -EINVAL ; + } }EXPORT_SYMBOL_GPL (v4l2_fwnode_endpoint_parse);include/media/v4l2-fwnode.h +19
-0@@ -56,6 +56,24 @@ struct v4l2_fwnode_bus_parallel { };/** +* struct v4l2_fwnode_bus_mipi_csi1 - CSI-1/CCP2 data bus structure +* @clock_inv: polarity of clock/strobe signal +* false - not inverted, true - inverted +* @strobe: false - data/clock, true - data/strobe +* @lane_polarity: the polarities of the clock (index 0) and data lanes +index (1) +* @data_lane: the number of the data lane +* @clock_lane: the number of the clock lane +*/ +struct v4l2_fwnode_bus_mipi_csi1 { +bool clock_inv; +bool strobe; +bool lane_polarity[2 ]; +unsigned char data_lane; +unsigned char clock_lane; +}; + +/** * struct v4l2_fwnode_endpoint - the endpoint data structure * @base: fwnode endpoint of the v4l2_fwnode * @bus_type: bus type @@ -72,6 +90,7 @@ struct v4l2_fwnode_endpoint {enum v4l2_mbus_type bus_type;union {struct v4l2_fwnode_bus_parallel parallel; +struct v4l2_fwnode_bus_mipi_csi1 mipi_csi1;struct v4l2_fwnode_bus_mipi_csi2 mipi_csi2; } bus;u64 *link_frequencies;include/media/v4l2-mediabus.h +4
-0@@ -69,11 +69,15 @@* @V4L2_MBUS_PARALLEL: parallel interface with hsync and vsync * @V4L2_MBUS_BT656: parallel interface with embedded synchronisation, can * also be used for BT.1120 +* @V4L2_MBUS_CSI1: MIPI CSI-1 serial interface +* @V4L2_MBUS_CCP2: CCP2 (Compact Camera Port 2) * @V4L2_MBUS_CSI2: MIPI CSI-2 serial interface */ enum v4l2_mbus_type {V4L2_MBUS_PARALLEL ,V4L2_MBUS_BT656 , +V4L2_MBUS_CSI1 , +V4L2_MBUS_CCP2 ,V4L2_MBUS_CSI2 , };Signature · 1 line
2.11.0
Re: [PATCH 7/8] omap3isp: Check for valid port in endpoints
In reply to Sakari AilusHi,
Quoted 3 lines · Sakari Ailus
Check that we do have a valid port in an endpoint, return an error if not.
Signed-off-by Sakari Ailus <[email protected]>
-- Sebastian
Quoted 20 lines
--- drivers/media/platform/omap3isp/isp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/platform/omap3isp/isp.c +1
-1@@ -2081,7 +2081,7 @@ static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode,default :dev_warn (dev,"%s: invalid interface %u\n" ,to_of_node (fwnode)->full_name, vep.base.port); -break ; +return -EINVAL ; }return 0 ;Signature · 1 line
2.11.0
Re: [PATCH 7/8] omap3isp: Check for valid port in endpoints
Quoted 8 lines · Sebastian Reichel
Hi,
Quoted 3 lines · Sakari Ailus
Check that we do have a valid port in an endpoint, return an error if not.
Signed-off-by Sakari Ailus <[email protected]>Reviewed-by Sebastian Reichel <[email protected]>
Thanks for the reviews, Sebastian and Pavel!
I'll send a pull request on these for 4.14 once we have -rc1 in the media tree.
Signature · 2 lines
Sakari Ailus e-mail: [email protected] XMPP: [email protected]
Re: [PATCH 7/8] omap3isp: Check for valid port in endpoints
Hi!
Quoted 11 lines
Quoted 6 lines · Sakari Ailus
Quoted 3 lines
Check that we do have a valid port in an endpoint, return an error if not.
Signed-off-by Sakari Ailus <[email protected]>Reviewed-by Sebastian Reichel <[email protected]>Thanks for the reviews, Sebastian and Pavel!
I'll send a pull request on these for 4.14 once we have -rc1 in the media tree.
I can update my patches when updated ccp2 branch is ready.
And actually, I'd quite like to get rest of support ready for 4.14, too. I believe we are close enough.
I re-checked, and it seems to work w/o the "smiapp-pll: Take existing divisor into account in minimum divisor check" patch; so with "omap3isp: add CSI1 support" plus the other ccp2 patches, plus dts changes, we should be ok.
Best regards,
Pavel
commit eba2751794239780efb256ce7079294a4d4c6e74
Author: Pavel <[email protected]> Date: Mon Feb 13 21:18:27 2017 +0100
From: Sakari Ailus <[email protected]>
Required added multiplier (and divisor) calculation did not take into account the existing divisor when checking the values against the minimum divisor. Do just that.
drivers/media/i2c/smiapp-pll.c +2 -1
@@ -227,7 +227,8 @@ static int __smiapp_pll_calculate( more_mul_factor =lcm (div, pll->pre_pll_clk_div) / div;dev_dbg (dev,"more_mul_factor: %u\n" , more_mul_factor); - more_mul_factor =lcm (more_mul_factor, op_limits->min_sys_clk_div); + more_mul_factor =lcm (more_mul_factor, +DIV_ROUND_UP (op_limits->min_sys_clk_div, div));dev_dbg (dev,"more_mul_factor: min_op_sys_clk_div: %d\n" , more_mul_factor); i =roundup (more_mul_min, more_mul_factor);
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH 5/8] v4l: Add support for CSI-1 and CCP2 busses
In reply to Sakari AilusEm Thu, 6 Jul 2017 02:00:16 +0300
Sakari Ailus <[email protected]> escreveu:
Quoted 65 lines
From: Sakari Ailus <[email protected]>
CCP2 and CSI-1, are older single data lane serial busses.
Signed-off-by Sakari Ailus <[email protected]>Signed-off-by Pavel Machek <[email protected]>--- drivers/media/platform/pxa_camera.c | 3 ++ drivers/media/platform/soc_camera/soc_mediabus.c | 3 ++ drivers/media/v4l2-core/v4l2-fwnode.c | 58 +++++++++++++++++++----- include/media/v4l2-fwnode.h | 19 ++++++++ include/media/v4l2-mediabus.h | 4 ++ 5 files changed, 76 insertions(+), 11 deletions(-)drivers/media/platform/pxa_camera.c +3
-0@@ -638,6 +638,9 @@ static unsigned int pxa_mbus_config_compatible(const struct v4l2_mbus_config *cf mipi_clock = common_flags & (V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK |V4L2_MBUS_CSI2_CONTINUOUS_CLOCK );return (!mipi_lanes || !mipi_clock) ?0 : common_flags; +default : +__WARN (); +return -EINVAL ; }return 0 ; }drivers/media/platform/soc_camera/soc_mediabus.c +3
-0@@ -508,6 +508,9 @@ unsigned int soc_mbus_config_compatible(const struct v4l2_mbus_config *cfg, mipi_clock = common_flags & (V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK |V4L2_MBUS_CSI2_CONTINUOUS_CLOCK );return (!mipi_lanes || !mipi_clock) ?0 : common_flags; +default : +__WARN (); +return -EINVAL ; }return 0 ; }drivers/media/v4l2-core/v4l2-fwnode.c +15
-0@@ -154,6 +154,31 @@ static void v4l2_fwnode_endpoint_parse_parallel_bus( } +void v4l2_fwnode_endpoint_parse_csi1_bus (struct fwnode_handle *fwnode, +struct v4l2_fwnode_endpoint *vep, +u32 bus_type) +{ +struct v4l2_fwnode_bus_mipi_csi1 *bus = &vep->bus.mipi_csi1; +u32 v; + +if (!fwnode_property_read_u32 (fwnode,"clock-inv" , &v)) + bus->clock_inv = v; + +if (!fwnode_property_read_u32 (fwnode,"strobe" , &v)) + bus->strobe = v; + +if (!fwnode_property_read_u32 (fwnode,"data-lanes" , &v)) + bus->data_lane = v;
drivers/media/v4l2-core/v4l2-fwnode.c static void v4l2_fwnode_endpoint_parse_parallel_bus( · line 181
Quoted 10 lines
drivers/media/v4l2-core/v4l2-fwnode.c +10
-0+ +if (!fwnode_property_read_u32 (fwnode,"clock-lanes" , &v)) + bus->clock_lane = v; + +if (bus_type ==V4L2_FWNODE_BUS_TYPE_CCP2 ) + vep->bus_type =V4L2_MBUS_CCP2 ; +else + vep->bus_type =V4L2_MBUS_CSI1 ; +} +
This function is indented with whitespaces! Next time, please check with checkpatch.
I fixed when merging it upstream.
Thanks,
Mauro
Re: [PATCH 5/8] v4l: Add support for CSI-1 and CCP2 busses
Quoted 82 lines · Mauro Carvalho Chehab
Em Thu, 6 Jul 2017 02:00:16 +0300
Sakari Ailus <[email protected]> escreveu:Quoted 65 lines
From: Sakari Ailus <[email protected]>
CCP2 and CSI-1, are older single data lane serial busses.
Signed-off-by Sakari Ailus <[email protected]>Signed-off-by Pavel Machek <[email protected]>--- drivers/media/platform/pxa_camera.c | 3 ++ drivers/media/platform/soc_camera/soc_mediabus.c | 3 ++ drivers/media/v4l2-core/v4l2-fwnode.c | 58 +++++++++++++++++++----- include/media/v4l2-fwnode.h | 19 ++++++++ include/media/v4l2-mediabus.h | 4 ++ 5 files changed, 76 insertions(+), 11 deletions(-)drivers/media/platform/pxa_camera.c +3
-0@@ -638,6 +638,9 @@ static unsigned int pxa_mbus_config_compatible(const struct v4l2_mbus_config *cf mipi_clock = common_flags & (V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK |V4L2_MBUS_CSI2_CONTINUOUS_CLOCK );return (!mipi_lanes || !mipi_clock) ?0 : common_flags; +default : +__WARN (); +return -EINVAL ; }return 0 ; }drivers/media/platform/soc_camera/soc_mediabus.c +3
-0@@ -508,6 +508,9 @@ unsigned int soc_mbus_config_compatible(const struct v4l2_mbus_config *cfg, mipi_clock = common_flags & (V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK |V4L2_MBUS_CSI2_CONTINUOUS_CLOCK );return (!mipi_lanes || !mipi_clock) ?0 : common_flags; +default : +__WARN (); +return -EINVAL ; }return 0 ; }drivers/media/v4l2-core/v4l2-fwnode.c +15
-0@@ -154,6 +154,31 @@ static void v4l2_fwnode_endpoint_parse_parallel_bus( } +void v4l2_fwnode_endpoint_parse_csi1_bus (struct fwnode_handle *fwnode, +struct v4l2_fwnode_endpoint *vep, +u32 bus_type) +{ +struct v4l2_fwnode_bus_mipi_csi1 *bus = &vep->bus.mipi_csi1; +u32 v; + +if (!fwnode_property_read_u32 (fwnode,"clock-inv" , &v)) + bus->clock_inv = v; + +if (!fwnode_property_read_u32 (fwnode,"strobe" , &v)) + bus->strobe = v; + +if (!fwnode_property_read_u32 (fwnode,"data-lanes" , &v)) + bus->data_lane = v;drivers/media/v4l2-core/v4l2-fwnode.c static void v4l2_fwnode_endpoint_parse_parallel_bus( · line 181
Quoted 10 lines
drivers/media/v4l2-core/v4l2-fwnode.c +10
-0+ +if (!fwnode_property_read_u32 (fwnode,"clock-lanes" , &v)) + bus->clock_lane = v; + +if (bus_type ==V4L2_FWNODE_BUS_TYPE_CCP2 ) + vep->bus_type =V4L2_MBUS_CCP2 ; +else + vep->bus_type =V4L2_MBUS_CSI1 ; +} +This function is indented with whitespaces! Next time, please check with checkpatch.
Quoted 1 line
I fixed when merging it upstream.
Well, what can I say?
Apologies for the collateral damage, and thanks! :-)
Signature · 4 lines
Regards, Sakari Ailus e-mail: [email protected] XMPP: [email protected]
Re: [PATCH 5/8] v4l: Add support for CSI-1 and CCP2 busses
Em Wed, 19 Jul 2017 23:53:30 +0300
Sakari Ailus <[email protected]> escreveu:
Quoted 83 lines · Mauro Carvalho Chehab
Quoted 82 lines
Em Thu, 6 Jul 2017 02:00:16 +0300
Sakari Ailus <[email protected]> escreveu:Quoted 65 lines
From: Sakari Ailus <[email protected]>
CCP2 and CSI-1, are older single data lane serial busses.
Signed-off-by Sakari Ailus <[email protected]>Signed-off-by Pavel Machek <[email protected]>--- drivers/media/platform/pxa_camera.c | 3 ++ drivers/media/platform/soc_camera/soc_mediabus.c | 3 ++ drivers/media/v4l2-core/v4l2-fwnode.c | 58 +++++++++++++++++++----- include/media/v4l2-fwnode.h | 19 ++++++++ include/media/v4l2-mediabus.h | 4 ++ 5 files changed, 76 insertions(+), 11 deletions(-)drivers/media/platform/pxa_camera.c +3
-0@@ -638,6 +638,9 @@ static unsigned int pxa_mbus_config_compatible(const struct v4l2_mbus_config *cf mipi_clock = common_flags & (V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK |V4L2_MBUS_CSI2_CONTINUOUS_CLOCK );return (!mipi_lanes || !mipi_clock) ?0 : common_flags; +default : +__WARN (); +return -EINVAL ; }return 0 ; }drivers/media/platform/soc_camera/soc_mediabus.c +3
-0@@ -508,6 +508,9 @@ unsigned int soc_mbus_config_compatible(const struct v4l2_mbus_config *cfg, mipi_clock = common_flags & (V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK |V4L2_MBUS_CSI2_CONTINUOUS_CLOCK );return (!mipi_lanes || !mipi_clock) ?0 : common_flags; +default : +__WARN (); +return -EINVAL ; }return 0 ; }drivers/media/v4l2-core/v4l2-fwnode.c +15
-0@@ -154,6 +154,31 @@ static void v4l2_fwnode_endpoint_parse_parallel_bus( } +void v4l2_fwnode_endpoint_parse_csi1_bus (struct fwnode_handle *fwnode, +struct v4l2_fwnode_endpoint *vep, +u32 bus_type) +{ +struct v4l2_fwnode_bus_mipi_csi1 *bus = &vep->bus.mipi_csi1; +u32 v; + +if (!fwnode_property_read_u32 (fwnode,"clock-inv" , &v)) + bus->clock_inv = v; + +if (!fwnode_property_read_u32 (fwnode,"strobe" , &v)) + bus->strobe = v; + +if (!fwnode_property_read_u32 (fwnode,"data-lanes" , &v)) + bus->data_lane = v;drivers/media/v4l2-core/v4l2-fwnode.c static void v4l2_fwnode_endpoint_parse_parallel_bus( · line 181
Quoted 10 lines
drivers/media/v4l2-core/v4l2-fwnode.c +10
-0+ +if (!fwnode_property_read_u32 (fwnode,"clock-lanes" , &v)) + bus->clock_lane = v; + +if (bus_type ==V4L2_FWNODE_BUS_TYPE_CCP2 ) + vep->bus_type =V4L2_MBUS_CCP2 ; +else + vep->bus_type =V4L2_MBUS_CSI1 ; +} +This function is indented with whitespaces! Next time, please check with checkpatch.
Quoted 5 lines
Quoted 1 line
I fixed when merging it upstream.
Well, what can I say?
Apologies for the collateral damage, and thanks! :-)
Nevermind. From time to time, I end fixing small things like this while merging ;)
I suspect that you cut and paste this function from some other place, as all lines inside it started with 7 spaces...
Regards,
Mauro
Re: [PATCH 5/8] v4l: Add support for CSI-1 and CCP2 busses
In reply to Sakari AilusHi!
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/media/v4l2-core/v4l2-fwnode.c +9
-0+void v4l2_fwnode_endpoint_parse_csi1_bus (struct fwnode_handle *fwnode, +struct v4l2_fwnode_endpoint *vep, +u32 bus_type) +{ +struct v4l2_fwnode_bus_mipi_csi1 *bus = &vep->bus.mipi_csi1; +u32 v; + +if (!fwnode_property_read_u32 (fwnode,"clock-inv" , &v)) + bus->clock_inv = v;
...
Quoted 6 lines
Quoted 4 lines
This function is indented with whitespaces! Next time, please check with checkpatch.
I fixed when merging it upstream.
Well, what can I say?
You can probably blame Pavel copy/pasting patches from emails.
Sorry about that.
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html