Skip to contentSkip to conversation

dt: bindings: Add support for CSI1 bus

PATCH In review Pavel Machek 13 participants 77 messages Dec 28, 2016 – Jul 12, 2017 3 messages not in the archive

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dt: bindings: Add support for CSI1 bus

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.

Document the CSI1/CCP2 properties strobe_clk_inv and strobe_clock properties. The former tells whether the strobe/clock signal is inverted, while the latter signifies the clock or strobe mode.

Documentation/devicetree/bindings/media/video-interfaces.txt +8 -3
index 9cd2a36..f0523f7 100644
@@ -76,6 +76,10 @@ 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 - CSI2
+  1 - parallel / Bt656
+  2 - 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
@@ -110,9 +114,10 @@ Optional endpoint properties
   lane and followed by the data lanes in the same order as in data-lanes.
   Valid values are 0 (normal) and 1 (inverted). The length of the array
   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.
-
+- clock-inv: Clock or strobe signal inversion.
+  Possible values: 0 -- not inverted; 1 -- inverted
+- strobe: Whether the clock signal is used as clock or strobe. Used
+  with CCP2, for instance.
 
 Example
 -------
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#1 lore raw

Hi Pavel,

Quoted 19 lines · Pavel Machek

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.

Document the CSI1/CCP2 properties strobe_clk_inv and strobe_clock properties. The former tells whether the strobe/clock signal is inverted, while the latter signifies the clock or strobe mode.

Documentation/devicetree/bindings/media/video-interfaces.txt +0 -0
index 9cd2a36..f0523f7 100644

Documentation/devicetree/bindings/media/video-interfaces.txt Optional endpoint properties · line 82

Quoted 7 lines
Documentation/devicetree/bindings/media/video-interfaces.txt +4 -0
@@ -76,6 +76,10 @@ 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 - CSI2
+  1 - parallel / Bt656
+  2 - CCP2

I wonder if we should make a difference between CCP2 and CSI-1 here, as it may make a difference in hardware configuration. The next patch does recognise that difference, so it should be present here as well.

Perhaps 2 - CSI1; 3 - CCP2. What do you think?

Quoted 19 lines
Documentation/devicetree/bindings/media/video-interfaces.txt +4 -3
 - 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
@@ -110,9 +114,10 @@ Optional endpoint properties
   lane and followed by the data lanes in the same order as in data-lanes.
   Valid values are 0 (normal) and 1 (inverted). The length of the array
   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.
-
+- clock-inv: Clock or strobe signal inversion.
+  Possible values: 0 -- not inverted; 1 -- inverted
+- strobe: Whether the clock signal is used as clock or strobe. Used
+  with CCP2, for instance.
 
 Example
 -------
Signature · 8 lines
Kind regards,

Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
Quoted 34 lines · Sakari Ailus

Hi Pavel,

Quoted 19 lines · Pavel Machek

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.

Document the CSI1/CCP2 properties strobe_clk_inv and strobe_clock properties. The former tells whether the strobe/clock signal is inverted, while the latter signifies the clock or strobe mode.

Documentation/devicetree/bindings/media/video-interfaces.txt +0 -0
index 9cd2a36..f0523f7 100644

Documentation/devicetree/bindings/media/video-interfaces.txt Optional endpoint properties · line 82

Quoted 7 lines
Documentation/devicetree/bindings/media/video-interfaces.txt +4 -0
@@ -76,6 +76,10 @@ 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 - CSI2
+  1 - parallel / Bt656
+  2 - CCP2

I wonder if we should make a difference between CCP2 and CSI-1 here, as it may make a difference in hardware configuration. The next patch does recognise that difference, so it should be present here as well.

Quoted 1 line

Perhaps 2 - CSI1; 3 - CCP2. What do you think?

Me, think..? Nah. :-).

Well, you have way more experience here, and yes, based on future patches, this makes sense.

Thanks, Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#3 lore raw
In reply to Pavel Machek
Quoted 5 lines · Pavel Machek

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.

What cases specifically?

Quoted 13 lines

Document the CSI1/CCP2 properties strobe_clk_inv and strobe_clock properties. The former tells whether the strobe/clock signal is inverted, while the latter signifies the clock or strobe mode.

Documentation/devicetree/bindings/media/video-interfaces.txt +0 -0
index 9cd2a36..f0523f7 100644

Documentation/devicetree/bindings/media/video-interfaces.txt Optional endpoint properties · line 80

Quoted 5 lines
Documentation/devicetree/bindings/media/video-interfaces.txt +2 -0
@@ -76,6 +76,10 @@ 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 - CSI2

As in MIPI CSI2?

Documentation/devicetree/bindings/media/video-interfaces.txt Optional endpoint properties · line 114

Quoted 11 lines
Documentation/devicetree/bindings/media/video-interfaces.txt +2 -2
+  1 - parallel / Bt656
+  2 - 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
@@ -110,9 +114,10 @@ Optional endpoint properties
   lane and followed by the data lanes in the same order as in data-lanes.
   Valid values are 0 (normal) and 1 (inverted). The length of the array
   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.

Why is this removed?

Documentation/devicetree/bindings/media/video-interfaces.txt Optional endpoint properties · line 118

Quoted 3 lines
Documentation/devicetree/bindings/media/video-interfaces.txt +2 -1
-
+- clock-inv: Clock or strobe signal inversion.
+  Possible values: 0 -- not inverted; 1 -- inverted

"invert" assumes I know what is normal and I do not. Define what is "normal" and name the property the opposite of that. If normal is data shifted on clock rising edge, then call the the property "clock-shift-falling-edge" for example..

Quoted 10 lines
Documentation/devicetree/bindings/media/video-interfaces.txt +2 -0
+- strobe: Whether the clock signal is used as clock or strobe. Used
+  with CCP2, for instance.
 
 Example
 -------
Signature · 3 lines
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Hi Rob,

Thanks for the review.

Quoted 8 lines · Rob Herring
Quoted 5 lines · Pavel Machek

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.

What cases specifically?

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.

Quoted 9 lines
Quoted 9 lines

Document the CSI1/CCP2 properties strobe_clk_inv and strobe_clock properties. The former tells whether the strobe/clock signal is inverted, while the latter signifies the clock or strobe mode.

Quoted 12 lines

Documentation/devicetree/bindings/media/video-interfaces.txt Optional endpoint properties · line 80

Quoted 10 lines
Documentation/devicetree/bindings/media/video-interfaces.txt +2 -0
index 9cd2a36..f0523f7 100644
@@ -76,6 +76,10 @@ 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 - CSI2

As in MIPI CSI2?

Yeah, I guess it'd make sense to make this explicit.

Quoted 14 lines

Documentation/devicetree/bindings/media/video-interfaces.txt Optional endpoint properties · line 114

Quoted 12 lines
Documentation/devicetree/bindings/media/video-interfaces.txt +2 -2
+  1 - parallel / Bt656
+  2 - 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
@@ -110,9 +114,10 @@ Optional endpoint properties
   lane and followed by the data lanes in the same order as in data-lanes.
   Valid values are 0 (normal) and 1 (inverted). The length of the array
   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.

Why is this removed?

Must have been by mistake. :-)

Quoted 9 lines

Documentation/devicetree/bindings/media/video-interfaces.txt Optional endpoint properties · line 118

Quoted 4 lines
Documentation/devicetree/bindings/media/video-interfaces.txt +2 -1
-
+- clock-inv: Clock or strobe signal inversion.
+  Possible values: 0 -- not inverted; 1 -- inverted

"invert" assumes I know what is normal and I do not. Define what is "normal" and name the property the opposite of that. If normal is data shifted on clock rising edge, then call the the property "clock-shift-falling-edge" for example..

The hardware documentation says this is the "strobe/clock inversion control signal". I'm not entirely sure whether this is just signal polarity (it's a differential signal) or inversion of an internal signal of the CCP2 block.

It might make sense to make this a private property for the OMAP 3 ISP instead. If it's seen elsewhere, then think about it again. I doubt it would, as CCP2 is an old bus that's used on Nokia N9, N950 and N900.

As strobe is included, I'd add that to the name. Say, "ti,clock-strobe-inv".

Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/media/video-interfaces.txt +2 -0
+- strobe: Whether the clock signal is used as clock or strobe. Used
+  with CCP2, for instance.
 
 Example
 -------
Signature · 8 lines
Kind regards,

Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw

Hi!

Quoted 10 lines

Thanks for the review.

Quoted 7 lines · Rob Herring
Quoted 5 lines · Pavel Machek

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.

Quoted 7 lines
Quoted 1 line

What cases specifically?

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.

Ok, I'll include that in the changelog.

Quoted 3 lines
Quoted 1 line

As in MIPI CSI2?

Yeah, I guess it'd make sense to make this explicit.

Ok.

Quoted 7 lines
Quoted 5 lines

Documentation/devicetree/bindings/media/video-interfaces.txt Optional endpoint properties · line 114

Quoted 3 lines

should be the combined length of data-lanes and clock-lanes properties.

Documentation/devicetree/bindings/media/video-interfaces.txt +0 -2
-  If the lane-polarities property is omitted, the value must be interpreted
-  as 0 (normal). This property is valid for serial busses only.

Why is this removed?

Must have been by mistake. :-)

Fixed.

Quoted 13 lines
Quoted 8 lines

Documentation/devicetree/bindings/media/video-interfaces.txt Optional endpoint properties · line 118

Quoted 3 lines
Documentation/devicetree/bindings/media/video-interfaces.txt +2 -1
-
+- clock-inv: Clock or strobe signal inversion.
+  Possible values: 0 -- not inverted; 1 -- inverted

"invert" assumes I know what is normal and I do not. Define what is "normal" and name the property the opposite of that. If normal is data shifted on clock rising edge, then call the the property "clock-shift-falling-edge" for example..

The hardware documentation says this is the "strobe/clock inversion control signal". I'm not entirely sure whether this is just signal polarity (it's a differential signal) or inversion of an internal signal of the CCP2 block.

Quoted 6 lines

It might make sense to make this a private property for the OMAP 3 ISP instead. If it's seen elsewhere, then think about it again. I doubt it would, as CCP2 is an old bus that's used on Nokia N9, N950 and N900.

As strobe is included, I'd add that to the name. Say, "ti,clock-strobe-inv".

Hmm. N900 does not use inversion. Would it make sense to simply hardcode it to "not-inverted" for now?

Device tree changes are PITA :-(.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#6 lore raw

Hi Pavel,

Quoted 16 lines · Pavel Machek
Quoted 16 lines
Quoted 7 lines
Quoted 2 lines
+- clock-inv: Clock or strobe signal inversion.
+  Possible values: 0 -- not inverted; 1 -- inverted

"invert" assumes I know what is normal and I do not. Define what is "normal" and name the property the opposite of that. If normal is data shifted on clock rising edge, then call the the property "clock-shift-falling-edge" for example..

The hardware documentation says this is the "strobe/clock inversion control signal". I'm not entirely sure whether this is just signal polarity (it's a differential signal) or inversion of an internal signal of the CCP2 block.

It might make sense to make this a private property for the OMAP 3 ISP instead. If it's seen elsewhere, then think about it again. I doubt it would, as CCP2 is an old bus that's used on Nokia N9, N950 and N900.

Quoted 7 lines
Quoted 2 lines

As strobe is included, I'd add that to the name. Say, "ti,clock-strobe-inv".

Hmm. N900 does not use inversion. Would it make sense to simply hardcode it to "not-inverted" for now?

Device tree changes are PITA :-(.

I can't remember what's used for the N9 secondary camera. As you said, we can always add it if needed though. So works for me.

Signature · 2 lines
Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
#7 lore raw

PATCH v2 1/1 dt: bindings: Add support for CSI1 bus

In reply to Pavel Machek

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.

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.

Document the CSI1/CCP2 property strobe. It signifies the clock or strobe mode.

Documentation/devicetree/bindings/media/video-interfaces.txt +7 -1
index 9cd2a36..08c4498 100644
@@ -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 - MIPI CSI2
+  1 - parallel / Bt656
+  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
@@ -112,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 or strobe. Used
+  with CCP2, for instance.
 
 Example
 -------
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Reviewed-by on v2 1/1
#8 lore raw

Hi,

Quoted 39 lines · Pavel Machek

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.

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.

Document the CSI1/CCP2 property strobe. It signifies the clock or strobe mode.

Documentation/devicetree/bindings/media/video-interfaces.txt +5 -0
index 9cd2a36..08c4498 100644
@@ -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 - MIPI CSI2
+  1 - parallel / Bt656
+  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

Documentation/devicetree/bindings/media/video-interfaces.txt Optional endpoint properties · line 124

Quoted 9 lines
Documentation/devicetree/bindings/media/video-interfaces.txt +2 -1
@@ -112,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 or strobe. Used
+  with CCP2, for instance.
 
 Example
 -------

-- Sebastian

#9 lore raw
In reply to Pavel Machek

Hi Pavel,

Quoted 25 lines · Pavel Machek

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.

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.

Document the CSI1/CCP2 property strobe. It signifies the clock or strobe mode.

Documentation/devicetree/bindings/media/video-interfaces.txt +0 -0
index 9cd2a36..08c4498 100644

Documentation/devicetree/bindings/media/video-interfaces.txt Optional endpoint properties · line 81

Quoted 6 lines
Documentation/devicetree/bindings/media/video-interfaces.txt +3 -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 - MIPI CSI2
+  1 - parallel / Bt656

Why not have separate values for parallel and BT.656?

baruch

Quoted 15 lines
Documentation/devicetree/bindings/media/video-interfaces.txt +4 -1
+  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
@@ -112,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 or strobe. Used
+  with CCP2, for instance.
 
 Example
 -------
Signature · 7 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - [email protected] - tel: +972.52.368.4656, http://www.tkos.co.il -
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#10 lore raw

Hi Baruch,

Quoted 23 lines · Baruch Siach

Hi Pavel,

Quoted 20 lines · Pavel Machek

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.

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.

Document the CSI1/CCP2 property strobe. It signifies the clock or strobe mode.

Quoted 13 lines

Documentation/devicetree/bindings/media/video-interfaces.txt Optional endpoint properties · line 81

Quoted 11 lines
Documentation/devicetree/bindings/media/video-interfaces.txt +3 -0
index 9cd2a36..08c4498 100644
@@ -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 - MIPI CSI2
+  1 - parallel / Bt656

Why not have separate values for parallel and BT.656?

The current implementation of V4L2 OF support digs the information from other properties (hsync-active, vsync-active and field-even-active). If any of them are present, the bus is considered to be a regular parallel bus --- the Bt.656 has no such signals.

CSI-2 bus is assumed if CSI-2 specific properties can be found. However, explicit bus type is needed as the type of the bus isn't anymore implicitly determinable with the addition of CSI-1 and CCP2 busses: they use the same properties.

Signature · 4 lines
Kind regards,

Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
#11 lore raw
In reply to Pavel Machek

Hi Pavel,

Quoted 25 lines · Pavel Machek

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.

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.

Document the CSI1/CCP2 property strobe. It signifies the clock or strobe mode.

Documentation/devicetree/bindings/media/video-interfaces.txt +0 -0
index 9cd2a36..08c4498 100644

Documentation/devicetree/bindings/media/video-interfaces.txt Optional endpoint properties · line 83

Quoted 8 lines
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 - MIPI CSI2
+  1 - parallel / Bt656
+  2 - MIPI CSI1
+  3 - CCP2

Actually, thinking about this again --- we only need to explictly specify busses if we're dealing with either CCP2 or CSI-1. The vast majority of the actual busses are and continue to be CSI-2 or either parallel or Bt.656. As they can be implicitly detected, we would have an option to just drop values 0 and 1 from above, i.e. only leave CSI-1 and CCP2. For now, specifying CSI-2 or parallel / Bt.656 adds no value as the old DT binaries without bus-type will need to be supported anyway.

Documentation/devicetree/bindings/media/video-interfaces.txt Optional endpoint properties · line 121

Quoted 10 lines
Documentation/devicetree/bindings/media/video-interfaces.txt +2 -1
 - 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
@@ -112,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 or strobe. Used
+  with CCP2, for instance.

How about the "ti,strobe-clock-inv" I proposed? No-one seems to know what this really truly means... or just drop it if it's not really needed.

Signature · 8 lines
Cheers,

Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20170119214905.GD3205-S+BSfZ9RZZmRSg0ZkenSGLdO1Tsj/[email protected]

#13 lore raw

Hi,

Quoted 45 lines · Sakari Ailus

Hi Pavel,

Quoted 25 lines · Pavel Machek

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.

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.

Document the CSI1/CCP2 property strobe. It signifies the clock or strobe mode.

Documentation/devicetree/bindings/media/video-interfaces.txt +0 -0
index 9cd2a36..08c4498 100644

Documentation/devicetree/bindings/media/video-interfaces.txt Optional endpoint properties · line 83

Quoted 8 lines
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 - MIPI CSI2
+  1 - parallel / Bt656
+  2 - MIPI CSI1
+  3 - CCP2

Actually, thinking about this again --- we only need to explictly specify busses if we're dealing with either CCP2 or CSI-1. The vast majority of the actual busses are and continue to be CSI-2 or either parallel or Bt.656. As they can be implicitly detected, we would have an option to just drop values 0 and 1 from above, i.e. only leave CSI-1 and CCP2. For now, specifying CSI-2 or parallel / Bt.656 adds no value as the old DT binaries without bus-type will need to be supported anyway.

Quoted 14 lines

Documentation/devicetree/bindings/media/video-interfaces.txt Optional endpoint properties · line 121

Quoted 10 lines
Documentation/devicetree/bindings/media/video-interfaces.txt +2 -1
 - 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
@@ -112,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 or strobe. Used
+  with CCP2, for instance.

How about the "ti,strobe-clock-inv" I proposed? No-one seems to know what this really truly means... or just drop it if it's not really needed.

Not really :), see https://www.spinics.net/lists/linux-media/msg99802.html and https://www.spinics.net/lists/linux-media/msg99800.html

"clock/strobe", and "strobe-inv" are two distinct properties, see CSI1B_CTRL description in OMAP TRM. BTW there is another property that is needed for both n900 cameras to operate correctly (VP_CLK_POL, bit 12 from the same reg), but that can be added later on when we have the other bits in place.

Ivo
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): cf372233-f047-6e2c-01eb-02e30e6b2de5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#15 lore raw

Hi Ivaylo,

Quoted 63 lines · Ivaylo Dimitrov

Hi,

Quoted 45 lines · Sakari Ailus

Hi Pavel,

Quoted 25 lines · Pavel Machek

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.

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.

Document the CSI1/CCP2 property strobe. It signifies the clock or strobe mode.

Documentation/devicetree/bindings/media/video-interfaces.txt +0 -0
index 9cd2a36..08c4498 100644

Documentation/devicetree/bindings/media/video-interfaces.txt Optional endpoint properties · line 83

Quoted 8 lines
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 - MIPI CSI2
+  1 - parallel / Bt656
+  2 - MIPI CSI1
+  3 - CCP2

Actually, thinking about this again --- we only need to explictly specify busses if we're dealing with either CCP2 or CSI-1. The vast majority of the actual busses are and continue to be CSI-2 or either parallel or Bt.656. As they can be implicitly detected, we would have an option to just drop values 0 and 1 from above, i.e. only leave CSI-1 and CCP2. For now, specifying CSI-2 or parallel / Bt.656 adds no value as the old DT binaries without bus-type will need to be supported anyway.

Quoted 14 lines

Documentation/devicetree/bindings/media/video-interfaces.txt Optional endpoint properties · line 121

Quoted 10 lines
Documentation/devicetree/bindings/media/video-interfaces.txt +2 -3
- 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
@@ -112,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 or strobe. Used
+  with CCP2, for instance.

How about the "ti,strobe-clock-inv" I proposed? No-one seems to know what this really truly means... or just drop it if it's not really needed.

Quoted 7 lines

Not really :), see https://www.spinics.net/lists/linux-media/msg99802.html
and https://www.spinics.net/lists/linux-media/msg99800.html

"clock/strobe", and "strobe-inv" are two distinct properties, see CSI1B_CTRL description in OMAP TRM. BTW there is another property that is needed for both n900 cameras to operate correctly (VP_CLK_POL, bit 12 from the same reg), but that can be added later on when we have the other bits in place.

Oh, indeed, my mistake. Please ignore that comment.

Signature · 6 lines
Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#16 lore raw
In reply to a message not in the archive

Hi!

Quoted 12 lines

Documentation/devicetree/bindings/media/video-interfaces.txt Optional endpoint properties · line 83

Quoted 11 lines
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 - MIPI CSI2
+  1 - parallel / Bt656
+  2 - MIPI CSI1
+  3 - CCP2
Quoted 7 lines

Actually, thinking about this again --- we only need to explictly specify busses if we're dealing with either CCP2 or CSI-1. The vast majority of the actual busses are and continue to be CSI-2 or either parallel or Bt.656. As they can be implicitly detected, we would have an option to just drop values 0 and 1 from above, i.e. only leave CSI-1 and CCP2. For now, specifying CSI-2 or parallel / Bt.656 adds no value as the old DT binaries without bus-type will need to be supported anyway.

Hmm. "Just deleting the others" may be a bit confusing... but what about this? It explains what we can autodetect.

Best regards,
Pavel

Documentation/devicetree/bindings/media/video-interfaces.txt +4 -4
index 08c4498..d54093b 100644
@@ -77,10 +77,10 @@ Optional endpoint properties
   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 - MIPI CSI2
-  1 - parallel / Bt656
-  2 - MIPI CSI1
-  3 - CCP2
+  0 - autodetect based on other properties (MIPI CSI2, parallel, Bt656)
+  1 - MIPI CSI1
+  2 - CCP2
+  Autodetection is default, and bus-type property may be omitted in that case.
 - 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 · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#17 lore raw

Hi Pavel,

Quoted 33 lines · Pavel Machek

Hi!

Quoted 12 lines

Documentation/devicetree/bindings/media/video-interfaces.txt Optional endpoint properties · line 83

Quoted 11 lines
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 - MIPI CSI2
+  1 - parallel / Bt656
+  2 - MIPI CSI1
+  3 - CCP2
Quoted 7 lines

Actually, thinking about this again --- we only need to explictly specify busses if we're dealing with either CCP2 or CSI-1. The vast majority of the actual busses are and continue to be CSI-2 or either parallel or Bt.656. As they can be implicitly detected, we would have an option to just drop values 0 and 1 from above, i.e. only leave CSI-1 and CCP2. For now, specifying CSI-2 or parallel / Bt.656 adds no value as the old DT binaries without bus-type will need to be supported anyway.

Hmm. "Just deleting the others" may be a bit confusing... but what about this? It explains what we can autodetect.

Best regards,
Pavel

Documentation/devicetree/bindings/media/video-interfaces.txt +0 -0
index 08c4498..d54093b 100644

Documentation/devicetree/bindings/media/video-interfaces.txt Optional endpoint properties · line 80

Quoted 8 lines
Documentation/devicetree/bindings/media/video-interfaces.txt +1 -4
@@ -77,10 +77,10 @@ Optional endpoint properties
   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 - MIPI CSI2
-  1 - parallel / Bt656
-  2 - MIPI CSI1
-  3 - CCP2
+  0 - autodetect based on other properties (MIPI CSI2, parallel, Bt656)

In the meantime, I also realised that we need to separate MIPI C-PHY and D-PHY from each other. So I think we'll need that property for CSI-2 nevertheless. How about:

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

I wouldn't add a separate entry for the parallel case as there are plenty of existing DT binaries with parallel interface configuration without phy-type property. They will need to be continue to be supported anyway, so there's not too much value in adding a type for that purpose.

I do find this a bit annoying; we should have had something like phy-type from day one rather than try to guess which phy is being used...

Quoted 8 lines
Documentation/devicetree/bindings/media/video-interfaces.txt +3 -0
+  1 - MIPI CSI1
+  2 - CCP2
+  Autodetection is default, and bus-type property may be omitted in that case.
 - 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 · 8 lines
Kind regards,

Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20170203141649.GC12291-S+BSfZ9RZZmRSg0ZkenSGLdO1Tsj/[email protected]

#19 lore raw

Hi!

Quoted 16 lines

Documentation/devicetree/bindings/media/video-interfaces.txt Optional endpoint properties · line 80

Quoted 6 lines

- bus-type: data bus type. Possible values are:

Documentation/devicetree/bindings/media/video-interfaces.txt +1 -4
-  0 - MIPI CSI2
-  1 - parallel / Bt656
-  2 - MIPI CSI1
-  3 - CCP2
+  0 - autodetect based on other properties (MIPI CSI2, parallel, Bt656)

In the meantime, I also realised that we need to separate MIPI C-PHY and D-PHY from each other. So I think we'll need that property for CSI-2 nevertheless. How about:

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

Quoted 7 lines

I wouldn't add a separate entry for the parallel case as there are plenty of existing DT binaries with parallel interface configuration without phy-type property. They will need to be continue to be supported anyway, so there's not too much value in adding a type for that purpose.

I do find this a bit annoying; we should have had something like phy-type from day one rather than try to guess which phy is being used...

Ok, v3 is in the mail.

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Reviewed-by Sebastian Reichel on v2 1/1
#20 lore raw
In reply to Pavel Machek

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.

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.

Document the CSI1/CCP2 property strobe. It signifies the clock or strobe mode.

Documentation/devicetree/bindings/media/video-interfaces.txt +8 -1
index 9cd2a36..6986fde 100644
@@ -76,6 +76,12 @@ 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
+  Autodetection is default, and bus-type property may be omitted in that case.
 - 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
@@ -112,7 +118,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 or strobe. Used
+  with CCP2, for instance.
 
 Example
 -------
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#21 lore raw

Hi Pavel,

Quoted 10 lines · Pavel Machek

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.

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.

Quoted 5 lines

Some hardware also supports multiple types of busses on the same interfaces.

Document the CSI1/CCP2 property strobe. It signifies the clock or strobe mode.

Thanks. I split this into two (bus type + strobe). The result is in here:

<URL:https://git.linuxtv.org/sailus/media_tree.git/commit/?h=ccp2>

How about the rest? :-) I guess we could get the CCP2 support in omap3isp without the video bus switch. It'd be nice to have this in a single patchset.

Signature · 4 lines
Kind regards,

Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
#22 lore raw

PATCH 1/1 omap3isp: add support for CSI1 bus

Obtain the CSI1/CCP2 bus parameters from the OF node.

ISP CSI1 module needs all the bits correctly set to work.

OMAP3430 needs various syscon CONTROL_CSIRXFE bits set in order to operate. Implement the missing functionality.

---

Quoted 3 lines

How about the rest? :-) I guess we could get the CCP2 support in omap3isp without the video bus switch. It'd be nice to have this in a single patchset.

Ok, here you go, what about this?

Pavel

drivers/media/platform/omap3isp/isp.c +113 -45
index 0321d84..88bc7c6 100644
@@ -2024,21 +2024,92 @@ enum isp_of_phy {
 	ISP_OF_PHY_CSIPHY2,
 };
 
-static int isp_of_parse_node(struct device *dev, struct device_node *node,
-			     struct isp_async_subdev *isd)
+void __isp_of_parse_node_csi1(struct device *dev,
+				   struct isp_ccp2_cfg *buscfg,
+				   struct v4l2_of_endpoint *vep)
+{
+	buscfg->lanecfg.clk.pos = vep->bus.mipi_csi1.clock_lane;
+	buscfg->lanecfg.clk.pol =
+		vep->bus.mipi_csi1.lane_polarity[0];
+	dev_dbg(dev, "clock lane polarity %u, pos %u\n",
+		buscfg->lanecfg.clk.pol,
+		buscfg->lanecfg.clk.pos);
+
+	buscfg->lanecfg.data[0].pos = vep->bus.mipi_csi2.data_lanes[0];
+	buscfg->lanecfg.data[0].pol =
+		vep->bus.mipi_csi2.lane_polarities[1];
+	dev_dbg(dev, "data lane polarity %u, pos %u\n",
+		buscfg->lanecfg.data[0].pol,
+		buscfg->lanecfg.data[0].pos);
+
+	buscfg->strobe_clk_pol = vep->bus.mipi_csi1.clock_inv;
+	buscfg->phy_layer = vep->bus.mipi_csi1.strobe;
+	buscfg->ccp2_mode = vep->bus_type == V4L2_MBUS_CCP2;
+
+	dev_dbg(dev, "clock_inv %u strobe %u ccp2 %u\n",
+		buscfg->strobe_clk_pol,
+		buscfg->phy_layer,
+		buscfg->ccp2_mode);
+	/*
+	 * FIXME: now we assume the CRC is always there.
+	 * Implement a way to obtain this information from the
+	 * sensor. Frame descriptors, perhaps?
+	 */
+	buscfg->crc = 1;
+
+	buscfg->vp_clk_pol = 1;
+}
+
+static void isp_of_parse_node_csi1(struct device *dev,
+				   struct isp_bus_cfg *buscfg,
+				   struct v4l2_of_endpoint *vep)
+{
+	if (vep->base.port == ISP_OF_PHY_CSIPHY1)
+		buscfg->interface = ISP_INTERFACE_CCP2B_PHY1;
+	else
+		buscfg->interface = ISP_INTERFACE_CCP2B_PHY2;
+	__isp_of_parse_node_csi1(dev, &buscfg->bus.ccp2, vep);
+}
+
+static void isp_of_parse_node_csi2(struct device *dev,
+				   struct isp_bus_cfg *buscfg,
+				   struct v4l2_of_endpoint *vep)
 {
-	struct isp_bus_cfg *buscfg = &isd->bus;
-	struct v4l2_of_endpoint vep;
 	unsigned int i;
-	int ret;
 
-	ret = v4l2_of_parse_endpoint(node, &vep);
-	if (ret)
-		return ret;
+	if (vep->base.port == ISP_OF_PHY_CSIPHY1)
+		buscfg->interface = ISP_INTERFACE_CSI2C_PHY1;
+	else
+		buscfg->interface = ISP_INTERFACE_CSI2A_PHY2;
+	buscfg->bus.csi2.lanecfg.clk.pos = vep->bus.mipi_csi2.clock_lane;
+	buscfg->bus.csi2.lanecfg.clk.pol =
+			vep->bus.mipi_csi2.lane_polarities[0];
+	dev_dbg(dev, "clock lane polarity %u, pos %u\n",
+		buscfg->bus.csi2.lanecfg.clk.pol,
+		buscfg->bus.csi2.lanecfg.clk.pos);
+
+	for (i = 0; i < ISP_CSIPHY2_NUM_DATA_LANES; i++) {
+		buscfg->bus.csi2.lanecfg.data[i].pos =
+			vep->bus.mipi_csi2.data_lanes[i];
+		buscfg->bus.csi2.lanecfg.data[i].pol =
+			vep->bus.mipi_csi2.lane_polarities[i + 1];
+		dev_dbg(dev, "data lane %u polarity %u, pos %u\n", i,
+			buscfg->bus.csi2.lanecfg.data[i].pol,
+				buscfg->bus.csi2.lanecfg.data[i].pos);
+	}
 
-	dev_dbg(dev, "parsing endpoint %s, interface %u\n", node->full_name,
-		vep.base.port);
+	/*
+	 * FIXME: now we assume the CRC is always there.
+	 * Implement a way to obtain this information from the
+	 * sensor. Frame descriptors, perhaps?
+	 */
+	buscfg->bus.csi2.crc = 1;
+}
 
+static int isp_endpoint_to_buscfg(struct device *dev,
+				  struct v4l2_of_endpoint vep,
+				  struct isp_bus_cfg *buscfg)
+{
 	switch (vep.base.port) {
 	case ISP_OF_PHY_PARALLEL:
 		buscfg->interface = ISP_INTERFACE_PARALLEL;
@@ -2059,45 +2130,42 @@ static int isp_of_parse_node(struct device *dev, struct device_node *node,
 
 	case ISP_OF_PHY_CSIPHY1:
 	case ISP_OF_PHY_CSIPHY2:
-		/* FIXME: always assume CSI-2 for now. */
-		switch (vep.base.port) {
-		case ISP_OF_PHY_CSIPHY1:
-			buscfg->interface = ISP_INTERFACE_CSI2C_PHY1;
-			break;
-		case ISP_OF_PHY_CSIPHY2:
-			buscfg->interface = ISP_INTERFACE_CSI2A_PHY2;
-			break;
-		}
-		buscfg->bus.csi2.lanecfg.clk.pos = vep.bus.mipi_csi2.clock_lane;
-		buscfg->bus.csi2.lanecfg.clk.pol =
-			vep.bus.mipi_csi2.lane_polarities[0];
-		dev_dbg(dev, "clock lane polarity %u, pos %u\n",
-			buscfg->bus.csi2.lanecfg.clk.pol,
-			buscfg->bus.csi2.lanecfg.clk.pos);
-
-		for (i = 0; i < ISP_CSIPHY2_NUM_DATA_LANES; i++) {
-			buscfg->bus.csi2.lanecfg.data[i].pos =
-				vep.bus.mipi_csi2.data_lanes[i];
-			buscfg->bus.csi2.lanecfg.data[i].pol =
-				vep.bus.mipi_csi2.lane_polarities[i + 1];
-			dev_dbg(dev, "data lane %u polarity %u, pos %u\n", i,
-				buscfg->bus.csi2.lanecfg.data[i].pol,
-				buscfg->bus.csi2.lanecfg.data[i].pos);
-		}
-
-		/*
-		 * FIXME: now we assume the CRC is always there.
-		 * Implement a way to obtain this information from the
-		 * sensor. Frame descriptors, perhaps?
-		 */
-		buscfg->bus.csi2.crc = 1;
+		if (vep.bus_type == V4L2_MBUS_CSI2)
+			isp_of_parse_node_csi2(dev, buscfg, &vep);
+		else
+			isp_of_parse_node_csi1(dev, buscfg, &vep);
 		break;
 
 	default:
+		return -1;
+	}
+	return 0;
+}
+
+static int isp_of_parse_node_endpoint(struct device *dev,
+				      struct device_node *node,
+				      struct isp_async_subdev *isd)
+{
+	struct isp_bus_cfg *buscfg;
+	struct v4l2_of_endpoint vep;
+	int ret;
+
+	isd->bus = devm_kzalloc(dev, sizeof(*isd->bus), GFP_KERNEL);
+	if (!isd->bus)
+		return -ENOMEM;
+
+	buscfg = isd->bus;
+
+	ret = v4l2_of_parse_endpoint(node, &vep);
+	if (ret)
+		return ret;
+
+	dev_dbg(dev, "parsing endpoint %s, interface %u\n", node->full_name,
+		vep.base.port);
+
+	if (isp_endpoint_to_buscfg(dev, vep, buscfg))
 		dev_warn(dev, "%s: invalid interface %u\n", node->full_name,
 			 vep.base.port);
-		break;
-	}
 
 	return 0;
 }
@@ -2124,7 +2192,7 @@ static int isp_of_parse_nodes(struct device *dev,
 
 		notifier->subdevs[notifier->num_subdevs] = &isd->asd;
 
-		if (isp_of_parse_node(dev, node, isd)) {
+		if (isp_of_parse_node_endpoint(dev, node, isd)) {
 			of_node_put(node);
 			return -EINVAL;
 		}
drivers/media/platform/omap3isp/isp.h +1 -1
index 7e6f663..c0b9d1d 100644
@@ -228,7 +228,7 @@ struct isp_device {
 
 struct isp_async_subdev {
 	struct v4l2_subdev *sd;
-	struct isp_bus_cfg bus;
+	struct isp_bus_cfg *bus;
 	struct v4l2_async_subdev asd;
 };
 
drivers/media/platform/omap3isp/ispccp2.c +40 -2

78 lines not on this page · raw message

drivers/media/platform/omap3isp/ispreg.h +4 -0
index b5ea8da..d084839 100644
@@ -87,6 +87,8 @@
 #define ISPCCP2_CTRL_PHY_SEL_MASK	0x1
 #define ISPCCP2_CTRL_PHY_SEL_SHIFT	1
 #define ISPCCP2_CTRL_IO_OUT_SEL		(1 << 2)
+#define ISPCCP2_CTRL_IO_OUT_SEL_MASK	0x1
+#define ISPCCP2_CTRL_IO_OUT_SEL_SHIFT	2
 #define ISPCCP2_CTRL_MODE		(1 << 4)
 #define ISPCCP2_CTRL_VP_CLK_FORCE_ON	(1 << 9)
 #define ISPCCP2_CTRL_INV		(1 << 10)
@@ -94,6 +96,8 @@
 #define ISPCCP2_CTRL_INV_SHIFT		10
 #define ISPCCP2_CTRL_VP_ONLY_EN		(1 << 11)
 #define ISPCCP2_CTRL_VP_CLK_POL		(1 << 12)
+#define ISPCCP2_CTRL_VP_CLK_POL_MASK	0x1
+#define ISPCCP2_CTRL_VP_CLK_POL_SHIFT	12
 #define ISPCCP2_CTRL_VPCLK_DIV_SHIFT	15
 #define ISPCCP2_CTRL_VPCLK_DIV_MASK	0x1ffff /* [31:15] */
 #define ISPCCP2_CTRL_VP_OUT_CTRL_SHIFT	8 /* 3430 bits */
drivers/media/platform/omap3isp/omap3isp.h +1 -0
index 443e8f7..f6d1d0d 100644
@@ -108,6 +108,7 @@ struct isp_ccp2_cfg {
 	unsigned int ccp2_mode:1;
 	unsigned int phy_layer:1;
 	unsigned int vpclk_div:2;
+	unsigned int vp_clk_pol:1;
 	struct isp_csiphy_lanes_cfg lanecfg;
 };
 
include/media/v4l2-mediabus.h +4 -0
index 34cc99e..315c167 100644
@@ -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,
 };
 
include/media/v4l2-of.h +17 -0
index 4dc34b2..63a52ee 100644
@@ -53,6 +53,22 @@ struct v4l2_of_bus_parallel {
 };
 
 /**
+ * struct v4l2_of_bus_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
+ * @data_lane: the number of the data lane
+ * @clock_lane: the number of the clock lane
+ */
+struct v4l2_of_bus_mipi_csi1 {
+	bool clock_inv;
+	bool strobe;
+	bool lane_polarity[2];
+	unsigned char data_lane;
+	unsigned char clock_lane;
+};
+
+/**
  * struct v4l2_of_endpoint - the endpoint data structure
  * @base: struct of_endpoint containing port, id, and local of_node
  * @bus_type: bus type
@@ -66,6 +82,7 @@ struct v4l2_of_endpoint {
 	enum v4l2_mbus_type bus_type;
 	union {
 		struct v4l2_of_bus_parallel parallel;
+		struct v4l2_of_bus_mipi_csi1 mipi_csi1;
 		struct v4l2_of_bus_mipi_csi2 mipi_csi2;
 	} bus;
 	u64 *link_frequencies;
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#23 lore raw

Re: [PATCH] omap3isp: add support for CSI1 bus

url: https://github.com/0day-ci/linux/commits/Pavel-Machek/omap3isp-add-support-for-CSI1-bus/20170208-222249 reproduce: make htmldocs

Hi Pavel,

[auto build test WARNING on v4.9-rc8]
[cannot apply to linuxtv-media/master next-20170208]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Pavel-Machek/omap3isp-add-support-for-CSI1-bus/20170208-222249
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

make[3]: warning: jobserver unavailable: using -j1. Add '+' to parent make rule. include/linux/init.h:1: warning: no structured comments found
include/linux/workqueue.h:392: warning: No description found for parameter '...' include/linux/workqueue.h:392: warning: Excess function parameter 'args' description in 'alloc_workqueue' include/linux/workqueue.h:413: warning: No description found for parameter '...' include/linux/workqueue.h:413: warning: Excess function parameter 'args' description in 'alloc_ordered_workqueue' include/linux/kthread.h:26: warning: No description found for parameter '...'
kernel/sys.c:1: warning: no structured comments found
drivers/dma-buf/seqno-fence.c:1: warning: no structured comments found include/linux/fence-array.h:61: warning: No description found for parameter 'fence' include/sound/core.h:324: warning: No description found for parameter '...' include/sound/core.h:335: warning: No description found for parameter '...' include/sound/core.h:388: warning: No description found for parameter '...' include/media/media-entity.h:1054: warning: No description found for parameter '...'

>> include/media/v4l2-of.h:69: warning: No description found for parameter 'lane_polarity[2]'

include/net/mac80211.h:3207: ERROR: Unexpected indentation.
include/net/mac80211.h:3210: WARNING: Block quote ends without a blank line; unexpected unindent. include/net/mac80211.h:3212: ERROR: Unexpected indentation.
include/net/mac80211.h:3213: WARNING: Block quote ends without a blank line; unexpected unindent. include/net/mac80211.h:1772: ERROR: Unexpected indentation.
include/net/mac80211.h:1776: WARNING: Block quote ends without a blank line; unexpected unindent. kernel/sched/fair.c:7259: WARNING: Inline emphasis start-string without end-string. kernel/time/timer.c:1240: ERROR: Unexpected indentation.
kernel/time/timer.c:1242: ERROR: Unexpected indentation.
kernel/time/timer.c:1243: WARNING: Block quote ends without a blank line; unexpected unindent. include/linux/wait.h:121: WARNING: Block quote ends without a blank line; unexpected unindent. include/linux/wait.h:124: ERROR: Unexpected indentation.
include/linux/wait.h:126: WARNING: Block quote ends without a blank line; unexpected unindent. kernel/time/hrtimer.c:1021: WARNING: Block quote ends without a blank line; unexpected unindent. kernel/signal.c:317: WARNING: Inline literal start-string without end-string. drivers/base/firmware_class.c:1348: WARNING: Bullet list ends without a blank line; unexpected unindent. drivers/message/fusion/mptbase.c:5054: WARNING: Definition list ends without a blank line; unexpected unindent. drivers/tty/serial/serial_core.c:1893: WARNING: Definition list ends without a blank line; unexpected unindent. include/linux/spi/spi.h:369: ERROR: Unexpected indentation.
WARNING: dvipng command 'dvipng' cannot be run (needed for math display), check the imgmath_dvipng setting

vim +69 include/media/v4l2-of.h

    53	};
    54	
    55	/**
    56	 * struct v4l2_of_bus_csi1 - CSI-1/CCP2 data bus structure
    57	 * @clock_inv: polarity of clock/strobe signal
    58	 *	       false - not inverted, true - inverted
    59	 * @strobe: false - data/clock, true - data/strobe
    60	 * @data_lane: the number of the data lane
    61	 * @clock_lane: the number of the clock lane
    62	 */
    63	struct v4l2_of_bus_mipi_csi1 {
    64		bool clock_inv;
    65		bool strobe;
    66		bool lane_polarity[2];
    67		unsigned char data_lane;
    68		unsigned char clock_lane;
  > 69	};

70
71 /**
72 * struct v4l2_of_endpoint - the endpoint data structure
73 * @base: struct of_endpoint containing port, id, and local of_node
74 * @bus_type: bus type
75 * @bus: bus configuration data structure
76 * @link_frequencies: array of supported link frequencies
77 * @nr_of_link_frequencies: number of elements in link_frequenccies array

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#24 lore raw

Re: [PATCH] omap3isp: add support for CSI1 bus

In reply to Pavel Machek

Hi Pavel,

Thank you for the patch.

Quoted 26 lines · On Wednesday 08 Feb 2017 13:57:38 Pavel Machek wrote:

Obtain the CSI1/CCP2 bus parameters from the OF node.

ISP CSI1 module needs all the bits correctly set to work.

OMAP3430 needs various syscon CONTROL_CSIRXFE bits set in order to operate. Implement the missing functionality.

---

Quoted 3 lines

How about the rest? :-) I guess we could get the CCP2 support in omap3isp without the video bus switch. It'd be nice to have this in a single patchset.

Ok, here you go, what about this?

Pavel

(quoted diff) +0 -0

b/drivers/media/platform/omap3isp/isp.c index 0321d84..88bc7c6 100644

drivers/media/platform/omap3isp/isp.c enum isp_of_phy { · line 2029

Quoted 8 lines
drivers/media/platform/omap3isp/isp.c +3 -2
@@ -2024,21 +2024,92 @@ enum isp_of_phy {
 	ISP_OF_PHY_CSIPHY2,
 };
 
-static int isp_of_parse_node(struct device *dev, struct device_node *node,
-			     struct isp_async_subdev *isd)
+void __isp_of_parse_node_csi1(struct device *dev,
+				   struct isp_ccp2_cfg *buscfg,
+				   struct v4l2_of_endpoint *vep)

This function isn't use anywhere else, you can merge it with isp_of_parse_node_csi1().

drivers/media/platform/omap3isp/isp.c enum isp_of_phy { · line 2040

Quoted 11 lines
drivers/media/platform/omap3isp/isp.c +11 -0
+{
+	buscfg->lanecfg.clk.pos = vep->bus.mipi_csi1.clock_lane;
+	buscfg->lanecfg.clk.pol =
+		vep->bus.mipi_csi1.lane_polarity[0];
+	dev_dbg(dev, "clock lane polarity %u, pos %u\n",
+		buscfg->lanecfg.clk.pol,
+		buscfg->lanecfg.clk.pos);
+
+	buscfg->lanecfg.data[0].pos = vep->bus.mipi_csi2.data_lanes[0];
+	buscfg->lanecfg.data[0].pol =
+		vep->bus.mipi_csi2.lane_polarities[1];

bus.mipi_csi2 ?

Quoted 39 lines
drivers/media/platform/omap3isp/isp.c +36 -2
+	dev_dbg(dev, "data lane polarity %u, pos %u\n",
+		buscfg->lanecfg.data[0].pol,
+		buscfg->lanecfg.data[0].pos);
+
+	buscfg->strobe_clk_pol = vep->bus.mipi_csi1.clock_inv;
+	buscfg->phy_layer = vep->bus.mipi_csi1.strobe;
+	buscfg->ccp2_mode = vep->bus_type == V4L2_MBUS_CCP2;
+
+	dev_dbg(dev, "clock_inv %u strobe %u ccp2 %u\n",
+		buscfg->strobe_clk_pol,
+		buscfg->phy_layer,
+		buscfg->ccp2_mode);
+	/*
+	 * FIXME: now we assume the CRC is always there.
+	 * Implement a way to obtain this information from the
+	 * sensor. Frame descriptors, perhaps?
+	 */
+	buscfg->crc = 1;
+
+	buscfg->vp_clk_pol = 1;
+}
+
+static void isp_of_parse_node_csi1(struct device *dev,
+				   struct isp_bus_cfg *buscfg,
+				   struct v4l2_of_endpoint *vep)
+{
+	if (vep->base.port == ISP_OF_PHY_CSIPHY1)
+		buscfg->interface = ISP_INTERFACE_CCP2B_PHY1;
+	else
+		buscfg->interface = ISP_INTERFACE_CCP2B_PHY2;
+	__isp_of_parse_node_csi1(dev, &buscfg->bus.ccp2, vep);
+}
+
+static void isp_of_parse_node_csi2(struct device *dev,
+				   struct isp_bus_cfg *buscfg,
+				   struct v4l2_of_endpoint *vep)
 {
-	struct isp_bus_cfg *buscfg = &isd->bus;
-	struct v4l2_of_endpoint vep;

drivers/media/platform/omap3isp/isp.c enum isp_of_phy { · line 2083

Quoted 10 lines
drivers/media/platform/omap3isp/isp.c +4 -4
 	unsigned int i;
-	int ret;
 
-	ret = v4l2_of_parse_endpoint(node, &vep);
-	if (ret)
-		return ret;
+	if (vep->base.port == ISP_OF_PHY_CSIPHY1)
+		buscfg->interface = ISP_INTERFACE_CSI2C_PHY1;
+	else
+		buscfg->interface = ISP_INTERFACE_CSI2A_PHY2;

I would keep this code in the caller to avoid code duplication with isp_of_parse_node_csi1().

Quoted 39 lines
drivers/media/platform/omap3isp/isp.c +27 -2
+	buscfg->bus.csi2.lanecfg.clk.pos = vep->bus.mipi_csi2.clock_lane;
+	buscfg->bus.csi2.lanecfg.clk.pol =
+			vep->bus.mipi_csi2.lane_polarities[0];
+	dev_dbg(dev, "clock lane polarity %u, pos %u\n",
+		buscfg->bus.csi2.lanecfg.clk.pol,
+		buscfg->bus.csi2.lanecfg.clk.pos);
+
+	for (i = 0; i < ISP_CSIPHY2_NUM_DATA_LANES; i++) {
+		buscfg->bus.csi2.lanecfg.data[i].pos =
+			vep->bus.mipi_csi2.data_lanes[i];
+		buscfg->bus.csi2.lanecfg.data[i].pol =
+			vep->bus.mipi_csi2.lane_polarities[i + 1];
+		dev_dbg(dev, "data lane %u polarity %u, pos %u\n", i,
+			buscfg->bus.csi2.lanecfg.data[i].pol,
+				buscfg->bus.csi2.lanecfg.data[i].pos);
+	}
 
-	dev_dbg(dev, "parsing endpoint %s, interface %u\n", node->full_name,
-		vep.base.port);
+	/*
+	 * FIXME: now we assume the CRC is always there.
+	 * Implement a way to obtain this information from the
+	 * sensor. Frame descriptors, perhaps?
+	 */
+	buscfg->bus.csi2.crc = 1;
+}
 
+static int isp_endpoint_to_buscfg(struct device *dev,
+				  struct v4l2_of_endpoint vep,
+				  struct isp_bus_cfg *buscfg)
+{
 	switch (vep.base.port) {
 	case ISP_OF_PHY_PARALLEL:
 		buscfg->interface = ISP_INTERFACE_PARALLEL;
@@ -2059,45 +2130,42 @@ static int isp_of_parse_node(struct device *dev,
 struct device_node *node,
 
 	case ISP_OF_PHY_CSIPHY1:
 	case ISP_OF_PHY_CSIPHY2:

drivers/media/platform/omap3isp/isp.c static int isp_of_parse_node(struct device *dev, · line 2072

Quoted 10 lines
drivers/media/platform/omap3isp/isp.c +0 -10
-		/* FIXME: always assume CSI-2 for now. */
-		switch (vep.base.port) {
-		case ISP_OF_PHY_CSIPHY1:
-			buscfg->interface = ISP_INTERFACE_CSI2C_PHY1;
-			break;
-		case ISP_OF_PHY_CSIPHY2:
-			buscfg->interface = ISP_INTERFACE_CSI2A_PHY2;
-			break;
-		}
-		buscfg->bus.csi2.lanecfg.clk.pos = 

vep.bus.mipi_csi2.clock_lane;

Quoted 20 lines
drivers/media/platform/omap3isp/isp.c +0 -20
-		buscfg->bus.csi2.lanecfg.clk.pol =
-			vep.bus.mipi_csi2.lane_polarities[0];
-		dev_dbg(dev, "clock lane polarity %u, pos %u\n",
-			buscfg->bus.csi2.lanecfg.clk.pol,
-			buscfg->bus.csi2.lanecfg.clk.pos);
-
-		for (i = 0; i < ISP_CSIPHY2_NUM_DATA_LANES; i++) {
-			buscfg->bus.csi2.lanecfg.data[i].pos =
-				vep.bus.mipi_csi2.data_lanes[i];
-			buscfg->bus.csi2.lanecfg.data[i].pol =
-				vep.bus.mipi_csi2.lane_polarities[i + 1];
-			dev_dbg(dev, "data lane %u polarity %u, pos %u\n", i,
-				buscfg->bus.csi2.lanecfg.data[i].pol,
-				buscfg->bus.csi2.lanecfg.data[i].pos);
-		}
-
-		/*
-		 * FIXME: now we assume the CRC is always there.
-		 * Implement a way to obtain this information from the
-		 * sensor. Frame descriptors, perhaps?

drivers/media/platform/omap3isp/isp.c static int isp_of_parse_node(struct device *dev, struct device_node *node, · line 2140

Quoted 10 lines
drivers/media/platform/omap3isp/isp.c +5 -2
-		 */
-		buscfg->bus.csi2.crc = 1;
+		if (vep.bus_type == V4L2_MBUS_CSI2)
+			isp_of_parse_node_csi2(dev, buscfg, &vep);
+		else
+			isp_of_parse_node_csi1(dev, buscfg, &vep);
 		break;
 
 	default:
+		return -1;

Please use the appropriate error code.

drivers/media/platform/omap3isp/isp.c static int isp_of_parse_node(struct device *dev, struct device_node *node, · line 2153

Quoted 13 lines
drivers/media/platform/omap3isp/isp.c +13 -0
+	}
+	return 0;
+}
+
+static int isp_of_parse_node_endpoint(struct device *dev,
+				      struct device_node *node,
+				      struct isp_async_subdev *isd)
+{
+	struct isp_bus_cfg *buscfg;
+	struct v4l2_of_endpoint vep;
+	int ret;
+
+	isd->bus = devm_kzalloc(dev, sizeof(*isd->bus), GFP_KERNEL);

Why do you now need to allocate this manually ?

drivers/media/platform/omap3isp/isp.c static int isp_of_parse_node(struct device *dev, struct device_node *node, · line 2166

Quoted 13 lines
drivers/media/platform/omap3isp/isp.c +13 -0
+	if (!isd->bus)
+		return -ENOMEM;
+
+	buscfg = isd->bus;
+
+	ret = (node, &vep);
+	if (ret)
+		return ret;
+
+	dev_dbg(dev, "parsing endpoint %s, interface %u\n", node->full_name,
+		vep.base.port);
+
+	if (isp_endpoint_to_buscfg(dev, vep, buscfg))

I'm fine splitting the CSI1/CSI2 parsing code to separate functions, but I don't think there's a need to split isp_endpoint_to_buscfg(). You can keep that part inline.

Quoted 44 lines
drivers/media/platform/omap3isp/isp.c +0 -2
 		dev_warn(dev, "%s: invalid interface %u\n", node->full_name,
 			 vep.base.port);
-		break;
-	}
 
 	return 0;

}

drivers/media/platform/omap3isp/isp.c +1 -1
@@ -2124,7 +2192,7 @@ static int isp_of_parse_nodes(struct device *dev,
 
 		notifier->subdevs[notifier->num_subdevs] = &isd->asd;
 
-		if (isp_of_parse_node(dev, node, isd)) {
+		if (isp_of_parse_node_endpoint(dev, node, isd)) {
 			of_node_put(node);
 			return -EINVAL;
 		}
(quoted diff) +0 -0

b/drivers/media/platform/omap3isp/isp.h index 7e6f663..c0b9d1d 100644

drivers/media/platform/omap3isp/isp.h +1 -1
@@ -228,7 +228,7 @@ struct isp_device {
 
 struct isp_async_subdev {
 	struct v4l2_subdev *sd;
-	struct isp_bus_cfg bus;
+	struct isp_bus_cfg *bus;
 	struct v4l2_async_subdev asd;
 };
 
(quoted diff) +0 -0

b/drivers/media/platform/omap3isp/ispccp2.c index ca09523..4edb55a 100644

drivers/media/platform/omap3isp/ispccp2.c +3 -0
@@ -21,6 +21,9 @@
 #include <linux/mutex.h>
 #include <linux/uaccess.h>
 #include <linux/regulator/consumer.h>
+#include <linux/regmap.h>
+
+#include <media/v4l2-of.h>
 
 #include "isp.h"
 #include "ispreg.h"

drivers/media/platform/omap3isp/ispccp2.c static int ccp2_if_enable(struct isp_ccp2_device *ccp2, · line 166

Quoted 4 lines
drivers/media/platform/omap3isp/ispccp2.c +1 -0
@@ -160,6 +163,33 @@ static int ccp2_if_enable(struct isp_ccp2_device *ccp2,
 u8 enable) return ret;
 	}
 
+	if (isp->revision == ISP_REVISION_2_0) {

The isp_csiphy.c code checks phy->isp->phy_type for the same purpose, shouldn't you use that too ?

drivers/media/platform/omap3isp/ispccp2.c static int ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable) · line 177

Quoted 11 lines
drivers/media/platform/omap3isp/ispccp2.c +11 -0
+		struct media_pad *pad;
+		struct v4l2_subdev *sensor;
+		const struct isp_ccp2_cfg *buscfg;
+		u32 csirxfe;
+
+		pad = media_entity_remote_pad(&ccp2->pads[CCP2_PAD_SINK]);
+		sensor = media_entity_to_v4l2_subdev(pad->entity);
+		/* Struct isp_bus_cfg has union inside */
+		buscfg = &((struct isp_bus_cfg *)sensor->host_priv)->bus.ccp2;
+
+

One blank line is enough.

drivers/media/platform/omap3isp/ispccp2.c static int ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable) · line 188

Quoted 11 lines
drivers/media/platform/omap3isp/ispccp2.c +11 -0
+		if (enable) {
+			csirxfe = OMAP343X_CONTROL_CSIRXFE_PWRDNZ |
+				  OMAP343X_CONTROL_CSIRXFE_RESET;
+
+			if (buscfg->phy_layer)
+				csirxfe |= OMAP343X_CONTROL_CSIRXFE_SELFORM;
+
+			if (buscfg->strobe_clk_pol)
+				csirxfe |= OMAP343X_CONTROL_CSIRXFE_CSIB_INV;
+		} else
+			csirxfe = 0;

You need curly braces for the else statement too.

drivers/media/platform/omap3isp/ispccp2.c static int ccp2_if_enable(struct isp_ccp2_device *ccp2, · line 190

Quoted 2 lines
drivers/media/platform/omap3isp/ispccp2.c +2 -0
+
+		regmap_write(isp->syscon, isp->syscon_offset, csirxfe);

Isn't this already configured by csiphy_routing_cfg_3430(), called through omap3isp_csiphy_acquire() ? You'll need to add support for the strobe/clock polarity there, but the rest should already be handled.

drivers/media/platform/omap3isp/ispccp2.c static int ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable)

Quoted 5 lines
drivers/media/platform/omap3isp/ispccp2.c +2 -0
+	}
+
 	/* Enable/Disable all the LCx channels */
 	for (i = 0; i < CCP2_LCx_CHANS_NUM; i++)
 		isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_CCP2, 

ISPCCP2_LCx_CTRL(i),

Quoted 21 lines
drivers/media/platform/omap3isp/ispccp2.c +5 -2
@@ -213,14 +243,17 @@ static int ccp2_phyif_config(struct isp_ccp2_device
 *ccp2, struct isp_device *isp = to_isp_device(ccp2);
 	u32 val;
 
-	/* CCP2B mode */
 	val = isp_reg_readl(isp, OMAP3_ISP_IOMEM_CCP2, ISPCCP2_CTRL) |
-			    ISPCCP2_CTRL_IO_OUT_SEL | ISPCCP2_CTRL_MODE;
+	      ISPCCP2_CTRL_MODE;
 	/* Data/strobe physical layer */
 	BIT_SET(val, ISPCCP2_CTRL_PHY_SEL_SHIFT, ISPCCP2_CTRL_PHY_SEL_MASK,
 		buscfg->phy_layer);
+	BIT_SET(val, ISPCCP2_CTRL_IO_OUT_SEL_SHIFT,
+		ISPCCP2_CTRL_IO_OUT_SEL_MASK, buscfg->ccp2_mode);
 	BIT_SET(val, ISPCCP2_CTRL_INV_SHIFT, ISPCCP2_CTRL_INV_MASK,
 		buscfg->strobe_clk_pol);
+	BIT_SET(val, ISPCCP2_CTRL_VP_CLK_POL_SHIFT,
+		ISPCCP2_CTRL_VP_CLK_POL_MASK, buscfg->vp_clk_pol);
 	isp_reg_writel(isp, val, OMAP3_ISP_IOMEM_CCP2, ISPCCP2_CTRL);
 
 	val = isp_reg_readl(isp, OMAP3_ISP_IOMEM_CCP2, ISPCCP2_CTRL);

drivers/media/platform/omap3isp/ispccp2.c static void ccp2_lcx_config(struct isp_ccp2_device · line 377

Quoted 6 lines
drivers/media/platform/omap3isp/ispccp2.c +3 -0
@@ -339,6 +372,9 @@ static void ccp2_lcx_config(struct isp_ccp2_device
 *ccp2, isp_reg_set(isp, OMAP3_ISP_IOMEM_CCP2, ISPCCP2_LC01_IRQENABLE, val);
 }
 
+void __isp_of_parse_node_csi1(struct device *dev,
+			      struct isp_ccp2_cfg *buscfg,
+			      struct v4l2_of_endpoint *vep);

This isn't needed.

include/media/v4l2-mediabus.h

Quoted 50 lines
drivers/media/platform/omap3isp/ispccp2.c +2 -0
 /*
  * ccp2_if_configure - Configure ccp2 with data from sensor
  * @ccp2: Pointer to ISP CCP2 device
@@ -1137,6 +1173,8 @@ int omap3isp_ccp2_init(struct isp_device *isp)
 	if (isp->revision == ISP_REVISION_2_0) {
 		ccp2->vdds_csib = devm_regulator_get(isp->dev, "vdds_csib");
 		if (IS_ERR(ccp2->vdds_csib)) {
+			if (PTR_ERR(ccp2->vdds_csib) == -EPROBE_DEFER)
+				return -EPROBE_DEFER;
 			dev_dbg(isp->dev,
 				"Could not get regulator vdds_csib\n");
 			ccp2->vdds_csib = NULL;
(quoted diff) +0 -0

b/drivers/media/platform/omap3isp/ispreg.h index b5ea8da..d084839 100644

drivers/media/platform/omap3isp/ispreg.h +4 -0
@@ -87,6 +87,8 @@
 #define ISPCCP2_CTRL_PHY_SEL_MASK	0x1
 #define ISPCCP2_CTRL_PHY_SEL_SHIFT	1
 #define ISPCCP2_CTRL_IO_OUT_SEL		(1 << 2)
+#define ISPCCP2_CTRL_IO_OUT_SEL_MASK	0x1
+#define ISPCCP2_CTRL_IO_OUT_SEL_SHIFT	2
 #define ISPCCP2_CTRL_MODE		(1 << 4)
 #define ISPCCP2_CTRL_VP_CLK_FORCE_ON	(1 << 9)
 #define ISPCCP2_CTRL_INV		(1 << 10)
@@ -94,6 +96,8 @@
 #define ISPCCP2_CTRL_INV_SHIFT		10
 #define ISPCCP2_CTRL_VP_ONLY_EN		(1 << 11)
 #define ISPCCP2_CTRL_VP_CLK_POL		(1 << 12)
+#define ISPCCP2_CTRL_VP_CLK_POL_MASK	0x1
+#define ISPCCP2_CTRL_VP_CLK_POL_SHIFT	12
 #define ISPCCP2_CTRL_VPCLK_DIV_SHIFT	15
 #define ISPCCP2_CTRL_VPCLK_DIV_MASK	0x1ffff /* [31:15] */
 #define ISPCCP2_CTRL_VP_OUT_CTRL_SHIFT	8 /* 3430 bits */
(quoted diff) +0 -0

b/drivers/media/platform/omap3isp/omap3isp.h index 443e8f7..f6d1d0d 100644

drivers/media/platform/omap3isp/omap3isp.h +1 -0
@@ -108,6 +108,7 @@ struct isp_ccp2_cfg {
 	unsigned int ccp2_mode:1;
 	unsigned int phy_layer:1;
 	unsigned int vpclk_div:2;
+	unsigned int vp_clk_pol:1;
 	struct isp_csiphy_lanes_cfg lanecfg;
 };
 
include/media/v4l2-mediabus.h +0 -0
index 34cc99e..315c167 100644

You should split the V4L2 core changes to a separate patch.

include/media/v4l2-mediabus.h line 73

Quoted 6 lines
include/media/v4l2-mediabus.h +2 -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)

It would help if you could provide, in comments or in the commit message, a few pointers to information about CSI-1 and CCP2.

include/media/v4l2-mediabus.h line 80

Quoted 7 lines
include/media/v4l2-mediabus.h +2 -0
  * @V4L2_MBUS_CSI2:	MIPI CSI-2 serial interface
  */
 enum v4l2_mbus_type {
 	V4L2_MBUS_PARALLEL,
 	V4L2_MBUS_BT656,
+	V4L2_MBUS_CSI1,
+	V4L2_MBUS_CCP2,

That's nice, but v4l2_of_parse_endpoint() never sets the bus type to CSI1 or CCP2. You need to fix that (and update the related DT bindings).

Quoted 12 lines
include/media/v4l2-mediabus.h +0 -0
 	V4L2_MBUS_CSI2,
 };
 
include/media/v4l2-of.h +1 -0
index 4dc34b2..63a52ee 100644
@@ -53,6 +53,22 @@ struct v4l2_of_bus_parallel {
 };
 
 /**
+ * struct v4l2_of_bus_csi1 - CSI-1/CCP2 data bus structure

include/media/v4l2-of.h struct v4l2_of_bus_parallel { · line 66

Quoted 10 lines
include/media/v4l2-of.h +10 -0
+ * @clock_inv: polarity of clock/strobe signal
+ *	       false - not inverted, true - inverted
+ * @strobe: false - data/clock, true - data/strobe
+ * @data_lane: the number of the data lane
+ * @clock_lane: the number of the clock lane
+ */
+struct v4l2_of_bus_mipi_csi1 {
+	bool clock_inv;
+	bool strobe;
+	bool lane_polarity[2];

This field isn't documented.

Quoted 16 lines
include/media/v4l2-of.h +6 -0
+	unsigned char data_lane;
+	unsigned char clock_lane;
+};
+
+/**
  * struct v4l2_of_endpoint - the endpoint data structure
  * @base: struct of_endpoint containing port, id, and local of_node
  * @bus_type: bus type
@@ -66,6 +82,7 @@ struct v4l2_of_endpoint {
 	enum v4l2_mbus_type bus_type;
 	union {
 		struct v4l2_of_bus_parallel parallel;
+		struct v4l2_of_bus_mipi_csi1 mipi_csi1;
 		struct v4l2_of_bus_mipi_csi2 mipi_csi2;
 	} bus;
 	u64 *link_frequencies;
Signature · 3 lines
Regards,

Laurent Pinchart
#25 lore raw

Re: [PATCH] omap3isp: add support for CSI1 bus

Hi!

Quoted 8 lines
Quoted 8 lines
(quoted diff) +0 -0

b/drivers/media/platform/omap3isp/isp.c index 0321d84..88bc7c6 100644

drivers/media/platform/omap3isp/isp.c +0 -0
@@ -2024,21 +2024,92 @@ enum isp_of_phy {
 	ISP_OF_PHY_CSIPHY2,
 };
 
Quoted 8 lines

drivers/media/platform/omap3isp/isp.c enum isp_of_phy { · line 2029

Quoted 5 lines
drivers/media/platform/omap3isp/isp.c +3 -2
-static int isp_of_parse_node(struct device *dev, struct device_node *node,
-			     struct isp_async_subdev *isd)
+void __isp_of_parse_node_csi1(struct device *dev,
+				   struct isp_ccp2_cfg *buscfg,
+				   struct v4l2_of_endpoint *vep)

This function isn't use anywhere else, you can merge it with isp_of_parse_node_csi1().

I'd prefer not to. First, it will be used separately in future, and second, expresions would be uglier.

Quoted 5 lines
Quoted 5 lines
drivers/media/platform/omap3isp/isp.c +5 -0
+{
+	buscfg->lanecfg.clk.pos = vep->bus.mipi_csi1.clock_lane;
+	buscfg->lanecfg.clk.pol =
+		vep->bus.mipi_csi1.lane_polarity[0];
+	dev_dbg(dev, "clock lane polarity %u, pos %u\n",
Quoted 8 lines

drivers/media/platform/omap3isp/isp.c enum isp_of_phy { · line 2040

Quoted 6 lines
drivers/media/platform/omap3isp/isp.c +6 -0
+		buscfg->lanecfg.clk.pol,
+		buscfg->lanecfg.clk.pos);
+
+	buscfg->lanecfg.data[0].pos = vep->bus.mipi_csi2.data_lanes[0];
+	buscfg->lanecfg.data[0].pol =
+		vep->bus.mipi_csi2.lane_polarities[1];

bus.mipi_csi2 ?

Good catch. Fixed.

Quoted 10 lines

drivers/media/platform/omap3isp/isp.c enum isp_of_phy { · line 2083

Quoted 7 lines
drivers/media/platform/omap3isp/isp.c +4 -3
-	ret = v4l2_of_parse_endpoint(node, &vep);
-	if (ret)
-		return ret;
+	if (vep->base.port == ISP_OF_PHY_CSIPHY1)
+		buscfg->interface = ISP_INTERFACE_CSI2C_PHY1;
+	else
+		buscfg->interface = ISP_INTERFACE_CSI2A_PHY2;

I would keep this code in the caller to avoid code duplication with isp_of_parse_node_csi1().

Take a closer look. Code in _csi1 is different.

Quoted 6 lines

drivers/media/platform/omap3isp/isp.c static int isp_of_parse_node(struct device *dev, struct device_node *node, · line 2140

Quoted 4 lines
drivers/media/platform/omap3isp/isp.c +1 -0
 		break;
 
 	default:
+		return -1;

Please use the appropriate error code.

Ok.

Quoted 6 lines
Quoted 6 lines
drivers/media/platform/omap3isp/isp.c +6 -0
+	return 0;
+}
+
+static int isp_of_parse_node_endpoint(struct device *dev,
+				      struct device_node *node,
+				      struct isp_async_subdev *isd)
Quoted 8 lines

drivers/media/platform/omap3isp/isp.c static int isp_of_parse_node(struct device *dev, struct device_node *node, · line 2153

Quoted 6 lines
drivers/media/platform/omap3isp/isp.c +6 -0
+{
+	struct isp_bus_cfg *buscfg;
+	struct v4l2_of_endpoint vep;
+	int ret;
+
+	isd->bus = devm_kzalloc(dev, sizeof(*isd->bus), GFP_KERNEL);

Why do you now need to allocate this manually ?

bus is now a pointer.

Quoted 8 lines

drivers/media/platform/omap3isp/isp.c static int isp_of_parse_node(struct device *dev, struct device_node *node, · line 2166

Quoted 4 lines
drivers/media/platform/omap3isp/isp.c +4 -0
+	dev_dbg(dev, "parsing endpoint %s, interface %u\n", node->full_name,
+		vep.base.port);
+
+	if (isp_endpoint_to_buscfg(dev, vep, buscfg))

I'm fine splitting the CSI1/CSI2 parsing code to separate functions, but I don't think there's a need to split isp_endpoint_to_buscfg(). You can keep that part inline.

I'd prefer smaller functions here. I tried to read the original and it was not too easy.

Quoted 8 lines
Quoted 8 lines
(quoted diff) +0 -0

b/drivers/media/platform/omap3isp/ispccp2.c index ca09523..4edb55a 100644

drivers/media/platform/omap3isp/ispccp2.c +0 -0
@@ -160,6 +163,33 @@ static int ccp2_if_enable(struct isp_ccp2_device *ccp2,
 u8 enable) return ret;
 	}
 
Quoted 4 lines

drivers/media/platform/omap3isp/ispccp2.c static int ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable) · line 166

Quoted 1 line
drivers/media/platform/omap3isp/ispccp2.c +1 -0
+	if (isp->revision == ISP_REVISION_2_0) {

The isp_csiphy.c code checks phy->isp->phy_type for the same purpose, shouldn't you use that too ?

Do you want me to do phy->isp->phy_type == ISP_PHY_TYPE_3430 check here? Can do...

Quoted 5 lines

drivers/media/platform/omap3isp/ispccp2.c static int ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable) · line 177

Quoted 3 lines
drivers/media/platform/omap3isp/ispccp2.c +3 -0
+		buscfg = &((struct isp_bus_cfg *)sensor->host_priv)->bus.ccp2;
+
+

One blank line is enough.

Ok.

Quoted 5 lines
Quoted 5 lines
drivers/media/platform/omap3isp/ispccp2.c +5 -0
+		if (enable) {
+			csirxfe = OMAP343X_CONTROL_CSIRXFE_PWRDNZ |
+				  OMAP343X_CONTROL_CSIRXFE_RESET;
+
+			if (buscfg->phy_layer)
Quoted 8 lines

drivers/media/platform/omap3isp/ispccp2.c static int ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable) · line 188

Quoted 6 lines
drivers/media/platform/omap3isp/ispccp2.c +6 -0
+				csirxfe |= OMAP343X_CONTROL_CSIRXFE_SELFORM;
+
+			if (buscfg->strobe_clk_pol)
+				csirxfe |= OMAP343X_CONTROL_CSIRXFE_CSIB_INV;
+		} else
+			csirxfe = 0;

You need curly braces for the else statement too.

Easy enough.

Quoted 6 lines

drivers/media/platform/omap3isp/ispccp2.c static int ccp2_if_enable(struct isp_ccp2_device *ccp2, · line 182

Quoted 2 lines
drivers/media/platform/omap3isp/ispccp2.c +2 -0
+
+		regmap_write(isp->syscon, isp->syscon_offset, csirxfe);

Isn't this already configured by csiphy_routing_cfg_3430(), called through omap3isp_csiphy_acquire() ? You'll need to add support for the strobe/clock polarity there, but the rest should already be handled.

Let me check...

Quoted 9 lines

drivers/media/platform/omap3isp/ispccp2.c line 73

Quoted 6 lines
drivers/media/platform/omap3isp/ispccp2.c +2 -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)

It would help if you could provide, in comments or in the commit message, a few pointers to information about CSI-1 and CCP2.

There's not much good information :-(.

http://electronics.stackexchange.com/questions/134395/differences-between-mipi-csi1-and-mipi-csi2

Quoted 16 lines
Quoted 4 lines
drivers/media/platform/omap3isp/ispccp2.c +1 -0
 /**
+ * struct v4l2_of_bus_csi1 - CSI-1/CCP2 data bus structure

drivers/media/platform/omap3isp/ispccp2.c

Quoted 10 lines
drivers/media/platform/omap3isp/ispccp2.c +10 -0
+ * @clock_inv: polarity of clock/strobe signal
+ *	       false - not inverted, true - inverted
+ * @strobe: false - data/clock, true - data/strobe
+ * @data_lane: the number of the data lane
+ * @clock_lane: the number of the clock lane
+ */
+struct v4l2_of_bus_mipi_csi1 {
+	bool clock_inv;
+	bool strobe;
+	bool lane_polarity[2];

This field isn't documented.

Yep, automatic checker already told me. Plus, similar field elsewhere is called "lane_polarities" but I believe "polarity" is a better name.

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#26 lore raw

Re: [PATCH] omap3isp: add support for CSI1 bus

Hi Pavel,

Quoted 20 lines · On Wednesday 15 Feb 2017 10:42:29 Pavel Machek wrote:

Hi!

Quoted 8 lines
Quoted 8 lines
(quoted diff) +0 -0

b/drivers/media/platform/omap3isp/isp.c index 0321d84..88bc7c6 100644

drivers/media/platform/omap3isp/isp.c +0 -0
@@ -2024,21 +2024,92 @@ enum isp_of_phy {
 	ISP_OF_PHY_CSIPHY2,
 };
 
Quoted 9 lines

drivers/media/platform/omap3isp/isp.c enum isp_of_phy { · line 2029

Quoted 6 lines
drivers/media/platform/omap3isp/isp.c +3 -2
-static int isp_of_parse_node(struct device *dev, struct device_node
 *node,
-			     struct isp_async_subdev *isd)
+void __isp_of_parse_node_csi1(struct device *dev,
+				   struct isp_ccp2_cfg *buscfg,
+				   struct v4l2_of_endpoint *vep)

This function isn't use anywhere else, you can merge it with isp_of_parse_node_csi1().

Quoted 2 lines

I'd prefer not to. First, it will be used separately in future, and second, expresions would be uglier.

Where will it be used ? As for the uglier part, I don't agree, otherwise I wouldn't have proposed it.

Quoted 53 lines
Quoted 5 lines
Quoted 5 lines
drivers/media/platform/omap3isp/isp.c +5 -0
+{
+	buscfg->lanecfg.clk.pos = vep->bus.mipi_csi1.clock_lane;
+	buscfg->lanecfg.clk.pol =
+		vep->bus.mipi_csi1.lane_polarity[0];
+	dev_dbg(dev, "clock lane polarity %u, pos %u\n",
Quoted 8 lines

drivers/media/platform/omap3isp/isp.c enum isp_of_phy { · line 2040

Quoted 6 lines
drivers/media/platform/omap3isp/isp.c +6 -0
+		buscfg->lanecfg.clk.pol,
+		buscfg->lanecfg.clk.pos);
+
+	buscfg->lanecfg.data[0].pos = vep->bus.mipi_csi2.data_lanes[0];
+	buscfg->lanecfg.data[0].pol =
+		vep->bus.mipi_csi2.lane_polarities[1];

bus.mipi_csi2 ?

Good catch. Fixed.

Quoted 10 lines

drivers/media/platform/omap3isp/isp.c enum isp_of_phy { · line 2083

Quoted 7 lines
drivers/media/platform/omap3isp/isp.c +4 -3
-	ret = v4l2_of_parse_endpoint(node, &vep);
-	if (ret)
-		return ret;
+	if (vep->base.port == ISP_OF_PHY_CSIPHY1)
+		buscfg->interface = ISP_INTERFACE_CSI2C_PHY1;
+	else
+		buscfg->interface = ISP_INTERFACE_CSI2A_PHY2;

I would keep this code in the caller to avoid code duplication with isp_of_parse_node_csi1().

Take a closer look. Code in _csi1 is different.

Quoted 6 lines

drivers/media/platform/omap3isp/isp.c static int isp_of_parse_node(struct device *dev, struct device_node *node, · line 2140

Quoted 4 lines
drivers/media/platform/omap3isp/isp.c +1 -0
 		break;
 
 	default:
+		return -1;

Please use the appropriate error code.

Ok.

Quoted 6 lines
Quoted 6 lines
drivers/media/platform/omap3isp/isp.c +6 -0
+	return 0;
+}
+
+static int isp_of_parse_node_endpoint(struct device *dev,
+				      struct device_node *node,
+				      struct isp_async_subdev *isd)
Quoted 8 lines

drivers/media/platform/omap3isp/isp.c static int isp_of_parse_node(struct device *dev, struct device_node *node, · line 2153

Quoted 6 lines
drivers/media/platform/omap3isp/isp.c +6 -0
+{
+	struct isp_bus_cfg *buscfg;
+	struct v4l2_of_endpoint vep;
+	int ret;
+
+	isd->bus = devm_kzalloc(dev, sizeof(*isd->bus), GFP_KERNEL);

Why do you now need to allocate this manually ?

Quoted 1 line

bus is now a pointer.

I've seen that, but why have you changed it ?

Quoted 11 lines
Quoted 8 lines

drivers/media/platform/omap3isp/isp.c static int isp_of_parse_node(struct device *dev, struct device_node *node, · line 2166

Quoted 4 lines
drivers/media/platform/omap3isp/isp.c +4 -0
+	dev_dbg(dev, "parsing endpoint %s, interface %u\n", node->full_name,
+		vep.base.port);
+
+	if (isp_endpoint_to_buscfg(dev, vep, buscfg))

I'm fine splitting the CSI1/CSI2 parsing code to separate functions, but I don't think there's a need to split isp_endpoint_to_buscfg(). You can keep that part inline.

I'd prefer smaller functions here. I tried to read the original and it was not too easy.

This function became a kzalloc (which I still don't see why you need it), a call to v4l2_of_parse_endpoint(), and then isp_endpoint_to_buscfg(). That's too small to be a function of its own. Please merge isp_of_parse_node_endpoint() and isp_endpoint_to_buscfg().

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
(quoted diff) +0 -0

b/drivers/media/platform/omap3isp/ispccp2.c index ca09523..4edb55a 100644

drivers/media/platform/omap3isp/ispccp2.c +0 -0
@@ -160,6 +163,33 @@ static int ccp2_if_enable(struct isp_ccp2_device
 *ccp2, u8 enable) return ret;
 
 	}
 
Quoted 7 lines
Quoted 4 lines

drivers/media/platform/omap3isp/ispccp2.c static int ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable) · line 166

Quoted 1 line
drivers/media/platform/omap3isp/ispccp2.c +1 -0
+	if (isp->revision == ISP_REVISION_2_0) {

The isp_csiphy.c code checks phy->isp->phy_type for the same purpose, shouldn't you use that too ?

Do you want me to do phy->isp->phy_type == ISP_PHY_TYPE_3430 check here? Can do...

Yes that's what I meant.

Quoted 67 lines
Quoted 5 lines

drivers/media/platform/omap3isp/ispccp2.c static int ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable) · line 177

Quoted 3 lines
drivers/media/platform/omap3isp/ispccp2.c +3 -0
+		buscfg = &((struct isp_bus_cfg *)sensor->host_priv)->bus.ccp2;
+
+

One blank line is enough.

Ok.

Quoted 5 lines
Quoted 5 lines
drivers/media/platform/omap3isp/ispccp2.c +5 -0
+		if (enable) {
+			csirxfe = OMAP343X_CONTROL_CSIRXFE_PWRDNZ |
+				  OMAP343X_CONTROL_CSIRXFE_RESET;
+
+			if (buscfg->phy_layer)
Quoted 8 lines

drivers/media/platform/omap3isp/ispccp2.c static int ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable) · line 188

Quoted 6 lines
drivers/media/platform/omap3isp/ispccp2.c +6 -0
+				csirxfe |= OMAP343X_CONTROL_CSIRXFE_SELFORM;
+
+			if (buscfg->strobe_clk_pol)
+				csirxfe |= OMAP343X_CONTROL_CSIRXFE_CSIB_INV;
+		} else
+			csirxfe = 0;

You need curly braces for the else statement too.

Easy enough.

Quoted 6 lines

drivers/media/platform/omap3isp/ispccp2.c static int ccp2_if_enable(struct isp_ccp2_device · line 183

Quoted 2 lines
drivers/media/platform/omap3isp/ispccp2.c +2 -0
+
+		regmap_write(isp->syscon, isp->syscon_offset, csirxfe);

Isn't this already configured by csiphy_routing_cfg_3430(), called through omap3isp_csiphy_acquire() ? You'll need to add support for the strobe/clock polarity there, but the rest should already be handled.

Let me check...

Quoted 10 lines
Quoted 7 lines
drivers/media/platform/omap3isp/ispccp2.c +0 -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)

It would help if you could provide, in comments or in the commit message, a few pointers to information about CSI-1 and CCP2.

There's not much good information :-(.

http://electronics.stackexchange.com/questions/134395/differences-between-mi
pi-csi1-and-mipi-csi2

Quoted 15 lines

drivers/media/platform/omap3isp/ispccp2.c

Quoted 13 lines

/**

+ * struct v4l2_of_bus_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
+ * @data_lane: the number of the data lane
+ * @clock_lane: the number of the clock lane
+ */

drivers/media/platform/omap3isp/ispccp2.c +4 -0
+struct v4l2_of_bus_mipi_csi1 {
+	bool clock_inv;
+	bool strobe;
+	bool lane_polarity[2];

This field isn't documented.

Yep, automatic checker already told me. Plus, similar field elsewhere is called "lane_polarities" but I believe "polarity" is a better name.

Signature · 3 lines
Regards,

Laurent Pinchart
#27 lore raw

PATCH 1/1 omap3isp: avoid uninitialized memory

Code in ispcsiphy is quite confusing, and does not initialize phy1 in case of isp rev. 2. Set it to zero, to prevent confusion.

index 8f73f6d..a2474b6 100644

drivers/media/platform/omap3isp/ispcsiphy.c +9 -7
@@ -362,14 +374,16 @@ int omap3isp_csiphy_init(struct isp_device *isp)
 	phy2->phy_regs = OMAP3_ISP_IOMEM_CSIPHY2;
 	mutex_init(&phy2->mutex);
 
-	if (isp->revision == ISP_REVISION_15_0) {
-		phy1->isp = isp;
-		phy1->csi2 = &isp->isp_csi2c;
-		phy1->num_data_lanes = ISP_CSIPHY1_NUM_DATA_LANES;
-		phy1->cfg_regs = OMAP3_ISP_IOMEM_CSI2C_REGS1;
-		phy1->phy_regs = OMAP3_ISP_IOMEM_CSIPHY1;
-		mutex_init(&phy1->mutex);
+	if (isp->revision != ISP_REVISION_15_0) {
+		memset(phy1, sizeof(*phy1), 0);
+		return 0;
 	}
 
+	phy1->isp = isp;
+	phy1->csi2 = &isp->isp_csi2c;
+	phy1->num_data_lanes = ISP_CSIPHY1_NUM_DATA_LANES;
+	phy1->cfg_regs = OMAP3_ISP_IOMEM_CSI2C_REGS1;
+	phy1->phy_regs = OMAP3_ISP_IOMEM_CSIPHY1;
+	mutex_init(&phy1->mutex);
 	return 0;
 }
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#28 lore raw

Re: [PATCH] omap3isp: avoid uninitialized memory

Hi Pavel,

Quoted 13 lines · Pavel Machek

Code in ispcsiphy is quite confusing, and does not initialize phy1 in case of isp rev. 2. Set it to zero, to prevent confusion.

index 8f73f6d..a2474b6 100644

drivers/media/platform/omap3isp/ispcsiphy.c +0 -0
@@ -362,14 +374,16 @@ int omap3isp_csiphy_init(struct isp_device *isp)
 	phy2->phy_regs = OMAP3_ISP_IOMEM_CSIPHY2;
 	mutex_init(&phy2->mutex);
 

drivers/media/platform/omap3isp/ispcsiphy.c int omap3isp_csiphy_init(struct isp_device *isp) · line 379

Quoted 10 lines
drivers/media/platform/omap3isp/ispcsiphy.c +3 -7
-	if (isp->revision == ISP_REVISION_15_0) {
-		phy1->isp = isp;
-		phy1->csi2 = &isp->isp_csi2c;
-		phy1->num_data_lanes = ISP_CSIPHY1_NUM_DATA_LANES;
-		phy1->cfg_regs = OMAP3_ISP_IOMEM_CSI2C_REGS1;
-		phy1->phy_regs = OMAP3_ISP_IOMEM_CSIPHY1;
-		mutex_init(&phy1->mutex);
+	if (isp->revision != ISP_REVISION_15_0) {
+		memset(phy1, sizeof(*phy1), 0);
+		return 0;

Isn't the memory allocated using kzalloc(), meaning it's already zero?

Quoted 12 lines
drivers/media/platform/omap3isp/ispcsiphy.c +6 -0
 	}
 
+	phy1->isp = isp;
+	phy1->csi2 = &isp->isp_csi2c;
+	phy1->num_data_lanes = ISP_CSIPHY1_NUM_DATA_LANES;
+	phy1->cfg_regs = OMAP3_ISP_IOMEM_CSI2C_REGS1;
+	phy1->phy_regs = OMAP3_ISP_IOMEM_CSIPHY1;
+	mutex_init(&phy1->mutex);
 	return 0;
 }
Signature · 4 lines
Kind regards,

Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
#29 lore raw

[media] omap3isp: Correctly set IO_OUT_SEL and VP_CLK_POL for CCP2 mode

In reply to Laurent Pinchart

ISP CSI1 module needs all the bits correctly set to work.

index ca09523..e6584a2 100644

drivers/media/platform/omap3isp/ispccp2.c +5 -2
@@ -213,14 +236,17 @@ static int ccp2_phyif_config(struct isp_ccp2_device *ccp2,
 	struct isp_device *isp = to_isp_device(ccp2);
 	u32 val;
 
-	/* CCP2B mode */
 	val = isp_reg_readl(isp, OMAP3_ISP_IOMEM_CCP2, ISPCCP2_CTRL) |
-			    ISPCCP2_CTRL_IO_OUT_SEL | ISPCCP2_CTRL_MODE;
+			    ISPCCP2_CTRL_MODE;
 	/* Data/strobe physical layer */
 	BIT_SET(val, ISPCCP2_CTRL_PHY_SEL_SHIFT, ISPCCP2_CTRL_PHY_SEL_MASK,
 		buscfg->phy_layer);
+	BIT_SET(val, ISPCCP2_CTRL_IO_OUT_SEL_SHIFT,
+		ISPCCP2_CTRL_IO_OUT_SEL_MASK, buscfg->ccp2_mode);
 	BIT_SET(val, ISPCCP2_CTRL_INV_SHIFT, ISPCCP2_CTRL_INV_MASK,
 		buscfg->strobe_clk_pol);
+	BIT_SET(val, ISPCCP2_CTRL_VP_CLK_POL_SHIFT,
+		ISPCCP2_CTRL_VP_CLK_POL_MASK, buscfg->vp_clk_pol);
 	isp_reg_writel(isp, val, OMAP3_ISP_IOMEM_CCP2, ISPCCP2_CTRL);
 
 	val = isp_reg_readl(isp, OMAP3_ISP_IOMEM_CCP2, ISPCCP2_CTRL);
drivers/media/platform/omap3isp/ispreg.h +4 -0
index b5ea8da..d084839 100644
@@ -87,6 +87,8 @@
 #define ISPCCP2_CTRL_PHY_SEL_MASK	0x1
 #define ISPCCP2_CTRL_PHY_SEL_SHIFT	1
 #define ISPCCP2_CTRL_IO_OUT_SEL		(1 << 2)
+#define ISPCCP2_CTRL_IO_OUT_SEL_MASK	0x1
+#define ISPCCP2_CTRL_IO_OUT_SEL_SHIFT	2
 #define ISPCCP2_CTRL_MODE		(1 << 4)
 #define ISPCCP2_CTRL_VP_CLK_FORCE_ON	(1 << 9)
 #define ISPCCP2_CTRL_INV		(1 << 10)
@@ -94,6 +96,8 @@
 #define ISPCCP2_CTRL_INV_SHIFT		10
 #define ISPCCP2_CTRL_VP_ONLY_EN		(1 << 11)
 #define ISPCCP2_CTRL_VP_CLK_POL		(1 << 12)
+#define ISPCCP2_CTRL_VP_CLK_POL_MASK	0x1
+#define ISPCCP2_CTRL_VP_CLK_POL_SHIFT	12
 #define ISPCCP2_CTRL_VPCLK_DIV_SHIFT	15
 #define ISPCCP2_CTRL_VPCLK_DIV_MASK	0x1ffff /* [31:15] */
 #define ISPCCP2_CTRL_VP_OUT_CTRL_SHIFT	8 /* 3430 bits */
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#30 lore raw

Re: [media] omap3isp: Correctly set IO_OUT_SEL and VP_CLK_POL for CCP2 mode

reproduce: wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross…

Hi Pavel,

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v4.10 next-20170303]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Pavel-Machek/omap3isp-Correctly-set-IO_OUT_SEL-and-VP_CLK_POL-for-CCP2-mode/20170303-164739
base:   git://linuxtv.org/media_tree.git master
config: arm-omap2plus_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705

reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm

All errors (new ones prefixed by >>):

drivers/media/platform/omap3isp/ispccp2.c: In function 'ccp2_phyif_config':

>> drivers/media/platform/omap3isp/ispccp2.c:226:39: error: 'const struct isp_ccp2_cfg' has no member named 'vp_clk_pol'; did you mean 'vpclk_div'?
      ISPCCP2_CTRL_VP_CLK_POL_MASK, buscfg->vp_clk_pol);
                                          ^
   drivers/media/platform/omap3isp/ispccp2.c:61:8: note: in definition of macro 'BIT_SET'
       | ((val) << (shift));  \
           ^~~

vim +226 drivers/media/platform/omap3isp/ispccp2.c

220 buscfg->phy_layer);
221 BIT_SET(val, ISPCCP2_CTRL_IO_OUT_SEL_SHIFT,
222 ISPCCP2_CTRL_IO_OUT_SEL_MASK, buscfg->ccp2_mode);
223 BIT_SET(val, ISPCCP2_CTRL_INV_SHIFT, ISPCCP2_CTRL_INV_MASK,
224 buscfg->strobe_clk_pol);
225 BIT_SET(val, ISPCCP2_CTRL_VP_CLK_POL_SHIFT,

 > 226			ISPCCP2_CTRL_VP_CLK_POL_MASK, buscfg->vp_clk_pol);

227 isp_reg_writel(isp, val, OMAP3_ISP_IOMEM_CCP2, ISPCCP2_CTRL);
228
229 val = isp_reg_readl(isp, OMAP3_ISP_IOMEM_CCP2, ISPCCP2_CTRL);

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#31 lore raw

Re: [media] omap3isp: Correctly set IO_OUT_SEL and VP_CLK_POL for CCP2 mode

Hi!

Quoted 4 lines

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v4.10 next-20170303]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

Yes, the patch is against Sakari's ccp2 branch. It should work ok there.

I don't think you can do much to fix the automated system....

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#32 lore raw

Re: [kbuild-all] [media] omap3isp: Correctly set IO_OUT_SEL and VP_CLK_POL for CCP2 mode

Quoted 8 lines · Pavel Machek

Hi!

Quoted 4 lines

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v4.10 next-20170303]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

Yes, the patch is against Sakari's ccp2 branch. It should work ok there.

Could you tell us the url of Sakari's tree? thus we can add it to 0day's monitoring list.

Thanks,
Xiaolong

Quoted 15 lines

I don't think you can do much to fix the automated system....

Pavel

Signature · 9 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html



_______________________________________________
kbuild-all mailing list
[email protected]
https://lists.01.org/mailman/listinfo/kbuild-all
build bot
#33 lore raw

Re: [media] omap3isp: Correctly set IO_OUT_SEL and VP_CLK_POL for CCP2 mode

In reply to Pavel Machek
We could, if "git format-patch" can be setup to auto append lines

On Fri, Mar 03, 2017 at 10:48:38PM +0100, Pavel Machek wrote:

>Hi!
>
>> [auto build test ERROR on linuxtv-media/master]
>> [also build test ERROR on v4.10 next-20170303]
>> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>>
>
>Yes, the patch is against Sakari's ccp2 branch. It should work ok there.
>
>I don't think you can do much to fix the automated system....

We could, if "git format-patch" can be setup to auto append lines

parent-commit: X
parent-patch-id: Y

With that information, as long as the parent commit/patch is public -- either by "git push" or posting patch to mailing lists -- we'll have good chance to find and use it as the base for "git am".

Currently "git format-patch" already has the option "--base=auto" to auto append the more accurate lines

base-commit: P
prerequisite-patch-id: X
prerequisite-patch-id: Y
prerequisite-patch-id: Z

That's the best information git can offer. Unfortunately it cannot ALWAYS work without human aid. What's worse, when it cannot figure out the base-commit, the whole "git format-patch" command will abort like this

       $ git format-patch -1
       fatal: base commit shouldn't be in revision list

That fatal error makes it not a viable option to always turn on "--base=auto" in .gitconfig.

Without a fully-automated solution, I don't think many people will bother or remember to manually specify base-commit before sending patches out.

To effectively save the robot from "base commit" guessing works, what we can do is to

1) append "parent-commit"/"parent-patch-id" lines when git cannot figure out and append the "base-commit"/"prerequisite-patch-id" lines. So that the test robot always get the information to do its job.

2) advise kernel developers to run this once

git config format.useAutoBase yes

to configure "--base=auto" as the default behavior.

Thanks,
Fengguang

#35 lore raw

Re: [media] omap3isp: Correctly set IO_OUT_SEL and VP_CLK_POL for CCP2 mode

Quoted 8 lines · Sakari Ailus
Quoted 5 lines · Pavel Machek

ISP CSI1 module needs all the bits correctly set to work.

How are you sending the patches?

manually using mutt, for series I do something with git. Hmm. And script I was using for that disappeared :-(.

Quoted 1 line

I've applied this to the ccp2 branch.

Thanks,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#36 lore raw

Re: [PATCH] omap3isp: add support for CSI1 bus

In reply to Laurent Pinchart

Hi!

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines

drivers/media/platform/omap3isp/isp.c static int isp_of_parse_node(struct device *dev, struct device_node *node, · line 2153

Quoted 10 lines
drivers/media/platform/omap3isp/isp.c +10 -0
+
+static int isp_of_parse_node_endpoint(struct device *dev,
+				      struct device_node *node,
+				      struct isp_async_subdev *isd)
+{
+	struct isp_bus_cfg *buscfg;
+	struct v4l2_of_endpoint vep;
+	int ret;
+
+	isd->bus = devm_kzalloc(dev, sizeof(*isd->bus), GFP_KERNEL);

Why do you now need to allocate this manually ?

Quoted 3 lines
Quoted 1 line

bus is now a pointer.

I've seen that, but why have you changed it ?

subdev support. Needs to go into separate patch. Will be done shortly.

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

drivers/media/platform/omap3isp/ispccp2.c static int ccp2_if_enable(struct isp_ccp2_device · line 167

Quoted 7 lines

+++ b/drivers/media/platform/omap3isp/ispccp2.c

drivers/media/platform/omap3isp/ispccp2.c +1 -0
@@ -160,6 +163,33 @@ static int ccp2_if_enable(struct isp_ccp2_device
 *ccp2, u8 enable) return ret;
 
 	}
 
+	if (isp->revision == ISP_REVISION_2_0) {

The isp_csiphy.c code checks phy->isp->phy_type for the same purpose, shouldn't you use that too ?

Quoted 4 lines
Quoted 2 lines

Do you want me to do phy->isp->phy_type == ISP_PHY_TYPE_3430 check here? Can do...

Yes that's what I meant.

Ok, that's something I can do.

But code is still somewhat "interesting". Code in omap3isp_csiphy_acquire() assumes csi2, and I don't need most of it.. so I'll just not use it, but it looks strange. I'll post new patch shortly.

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
#37 lore raw

PATCH v2 1/1 omap3isp: add support for CSI1 bus

Hi!

Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Quoted 10 lines

Review static int ccp2_if_enable(struct isp_ccp2_device · line 167

Quoted 7 lines

+++ b/drivers/media/platform/omap3isp/ispccp2.c

(quoted diff) +1 -0
@@ -160,6 +163,33 @@ static int ccp2_if_enable(struct isp_ccp2_device
 *ccp2, u8 enable) return ret;
 
 	}
 
+	if (isp->revision == ISP_REVISION_2_0) {

The isp_csiphy.c code checks phy->isp->phy_type for the same purpose, shouldn't you use that too ?

Do you want me to do phy->isp->phy_type == ISP_PHY_TYPE_3430 check here? Can do...

Quoted 7 lines
Quoted 1 line

Yes that's what I meant.

Ok, that's something I can do.

But code is still somewhat "interesting". Code in omap3isp_csiphy_acquire() assumes csi2, and I don't need most of it.. so I'll just not use it, but it looks strange. I'll post new patch shortly.

Ok, how about this one?

Pavel

omap3isp: add rest of CSI1 support

CSI1 needs one more bit to be set up. Do just that.

It is not as straightforward as I'd like, see the comments in the code for explanation.

index ca09523..b6e055e 100644

drivers/media/platform/omap3isp/ispccp2.c +26 -0
@@ -21,6 +23,7 @@
 #include <linux/mutex.h>
 #include <linux/uaccess.h>
 #include <linux/regulator/consumer.h>
+#include <linux/regmap.h>
 
 #include "isp.h"
 #include "ispreg.h"
@@ -160,6 +163,22 @@ static int ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable)
 			return ret;
 	}
 
+	if (isp->phy_type == ISP_PHY_TYPE_3430) {
+		struct media_pad *pad;
+		struct v4l2_subdev *sensor;
+		const struct isp_ccp2_cfg *buscfg;
+
+		pad = media_entity_remote_pad(&ccp2->pads[CCP2_PAD_SINK]);
+		sensor = media_entity_to_v4l2_subdev(pad->entity);
+		/* Struct isp_bus_cfg has union inside */
+		buscfg = &((struct isp_bus_cfg *)sensor->host_priv)->bus.ccp2;
+
+		csiphy_routing_cfg_3430(&isp->isp_csiphy2,
+					ISP_INTERFACE_CCP2B_PHY1,
+					enable, !!buscfg->phy_layer,
+					buscfg->strobe_clk_pol);
+	}
+
 	/* Enable/Disable all the LCx channels */
 	for (i = 0; i < CCP2_LCx_CHANS_NUM; i++)
 		isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_CCP2, ISPCCP2_LCx_CTRL(i),
@@ -1137,10 +1159,19 @@ int omap3isp_ccp2_init(struct isp_device *isp)
 	if (isp->revision == ISP_REVISION_2_0) {
 		ccp2->vdds_csib = devm_regulator_get(isp->dev, "vdds_csib");
 		if (IS_ERR(ccp2->vdds_csib)) {
+			if (PTR_ERR(ccp2->vdds_csib) == -EPROBE_DEFER)
+				return -EPROBE_DEFER;
 			dev_dbg(isp->dev,
 				"Could not get regulator vdds_csib\n");
 			ccp2->vdds_csib = NULL;
 		}
+		/*
+		 * If we set up ccp2->phy here,
+		 * omap3isp_csiphy_acquire() will go ahead and assume
+		 * csi2, dereferencing some null pointers.
+		 *
+		 * ccp2->phy = &isp->isp_csiphy2;
+		 */
 	} else if (isp->revision == ISP_REVISION_15_0) {
 		ccp2->phy = &isp->isp_csiphy1;
 	}
drivers/media/platform/omap3isp/ispcsiphy.c +6 -3
index 871d4fe..897097b 100644
@@ -68,8 +68,8 @@ static void csiphy_routing_cfg_3630(struct isp_csiphy *phy,
 	regmap_write(phy->isp->syscon, phy->isp->syscon_offset, reg);
 }
 
-static void csiphy_routing_cfg_3430(struct isp_csiphy *phy, u32 iface, bool on,
-				    bool ccp2_strobe)
+void csiphy_routing_cfg_3430(struct isp_csiphy *phy, u32 iface, bool on,
+			     bool ccp2_strobe, bool strobe_clk_pol)
 {
 	u32 csirxfe = OMAP343X_CONTROL_CSIRXFE_PWRDNZ
 		| OMAP343X_CONTROL_CSIRXFE_RESET;
@@ -85,6 +85,9 @@ static void csiphy_routing_cfg_3430(struct isp_csiphy *phy, u32 iface, bool on,
 
 	if (ccp2_strobe)
 		csirxfe |= OMAP343X_CONTROL_CSIRXFE_SELFORM;
+	
+	if (strobe_clk_pol)
+		csirxfe |= OMAP343X_CONTROL_CSIRXFE_CSIB_INV;
 
 	regmap_write(phy->isp->syscon, phy->isp->syscon_offset, csirxfe);
 }
@@ -108,7 +111,7 @@ static void csiphy_routing_cfg(struct isp_csiphy *phy,
 	if (phy->isp->phy_type == ISP_PHY_TYPE_3630 && on)
 		return csiphy_routing_cfg_3630(phy, iface, ccp2_strobe);
 	if (phy->isp->phy_type == ISP_PHY_TYPE_3430)
-		return csiphy_routing_cfg_3430(phy, iface, on, ccp2_strobe);
+		return csiphy_routing_cfg_3430(phy, iface, on, ccp2_strobe, false);
 }
 
 /*
drivers/media/platform/omap3isp/ispcsiphy.h +3 -0
index 28b63b2..88c5c1e8 100644
@@ -40,4 +40,7 @@ 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 csiphy_routing_cfg_3430(struct isp_csiphy *phy, u32 iface, bool on,
+				    bool ccp2_strobe, bool strobe_clk_pol);
+
 #endif	/* OMAP3_ISP_CSI_PHY_H */
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#38 lore raw

Re: [PATCHv2] omap3isp: add support for CSI1 bus

Hi Pavel,

Quoted 56 lines · Pavel Machek

Hi!

Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Quoted 10 lines

Review static int ccp2_if_enable(struct isp_ccp2_device · line 167

Quoted 7 lines

+++ b/drivers/media/platform/omap3isp/ispccp2.c

(quoted diff) +1 -0
@@ -160,6 +163,33 @@ static int ccp2_if_enable(struct isp_ccp2_device
 *ccp2, u8 enable) return ret;
 
 	}
 
+	if (isp->revision == ISP_REVISION_2_0) {

The isp_csiphy.c code checks phy->isp->phy_type for the same purpose, shouldn't you use that too ?

Do you want me to do phy->isp->phy_type == ISP_PHY_TYPE_3430 check here? Can do...

Quoted 7 lines
Quoted 1 line

Yes that's what I meant.

Ok, that's something I can do.

But code is still somewhat "interesting". Code in omap3isp_csiphy_acquire() assumes csi2, and I don't need most of it.. so I'll just not use it, but it looks strange. I'll post new patch shortly.

Ok, how about this one?

Pavel

omap3isp: add rest of CSI1 support

CSI1 needs one more bit to be set up. Do just that.

It is not as straightforward as I'd like, see the comments in the code for explanation.

index ca09523..b6e055e 100644

drivers/media/platform/omap3isp/ispccp2.c +5 -0
@@ -21,6 +23,7 @@
 #include <linux/mutex.h>
 #include <linux/uaccess.h>
 #include <linux/regulator/consumer.h>
+#include <linux/regmap.h>
 
 #include "isp.h"
 #include "ispreg.h"
@@ -160,6 +163,22 @@ static int ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable)
 			return ret;
 	}
 
+	if (isp->phy_type == ISP_PHY_TYPE_3430) {
+		struct media_pad *pad;
+		struct v4l2_subdev *sensor;
+		const struct isp_ccp2_cfg *buscfg;

drivers/media/platform/omap3isp/ispccp2.c static int ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable) · line 179

Quoted 10 lines
drivers/media/platform/omap3isp/ispccp2.c +10 -0
+
+		pad = media_entity_remote_pad(&ccp2->pads[CCP2_PAD_SINK]);
+		sensor = media_entity_to_v4l2_subdev(pad->entity);
+		/* Struct isp_bus_cfg has union inside */
+		buscfg = &((struct isp_bus_cfg *)sensor->host_priv)->bus.ccp2;
+
+		csiphy_routing_cfg_3430(&isp->isp_csiphy2,
+					ISP_INTERFACE_CCP2B_PHY1,
+					enable, !!buscfg->phy_layer,
+					buscfg->strobe_clk_pol);

You should do this through omap3isp_csiphy_acquire(), and not call csiphy_routing_cfg_3430() directly from here.

drivers/media/platform/omap3isp/ispccp2.c int omap3isp_ccp2_init(struct isp_device *isp) · line 1163

Quoted 11 lines
drivers/media/platform/omap3isp/ispccp2.c +4 -0
+	}
+
 	/* Enable/Disable all the LCx channels */
 	for (i = 0; i < CCP2_LCx_CHANS_NUM; i++)
 		isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_CCP2, ISPCCP2_LCx_CTRL(i),
@@ -1137,10 +1159,19 @@ int omap3isp_ccp2_init(struct isp_device *isp)
 	if (isp->revision == ISP_REVISION_2_0) {
 		ccp2->vdds_csib = devm_regulator_get(isp->dev, "vdds_csib");
 		if (IS_ERR(ccp2->vdds_csib)) {
+			if (PTR_ERR(ccp2->vdds_csib) == -EPROBE_DEFER)
+				return -EPROBE_DEFER;

This should go to a separate patch.

drivers/media/platform/omap3isp/ispccp2.c int omap3isp_ccp2_init(struct isp_device *isp) · line 1173

Quoted 10 lines
drivers/media/platform/omap3isp/ispccp2.c +6 -0
 			dev_dbg(isp->dev,
 				"Could not get regulator vdds_csib\n");
 			ccp2->vdds_csib = NULL;
 		}
+		/*
+		 * If we set up ccp2->phy here,
+		 * omap3isp_csiphy_acquire() will go ahead and assume
+		 * csi2, dereferencing some null pointers.
+		 *
+		 * ccp2->phy = &isp->isp_csiphy2;

That needs to be fixed separately.

Quoted 53 lines
drivers/media/platform/omap3isp/ispccp2.c +1 -0
+		 */
 	} else if (isp->revision == ISP_REVISION_15_0) {
 		ccp2->phy = &isp->isp_csiphy1;
 	}
drivers/media/platform/omap3isp/ispcsiphy.c +6 -3
index 871d4fe..897097b 100644
@@ -68,8 +68,8 @@ static void csiphy_routing_cfg_3630(struct isp_csiphy *phy,
 	regmap_write(phy->isp->syscon, phy->isp->syscon_offset, reg);
 }
 
-static void csiphy_routing_cfg_3430(struct isp_csiphy *phy, u32 iface, bool on,
-				    bool ccp2_strobe)
+void csiphy_routing_cfg_3430(struct isp_csiphy *phy, u32 iface, bool on,
+			     bool ccp2_strobe, bool strobe_clk_pol)
 {
 	u32 csirxfe = OMAP343X_CONTROL_CSIRXFE_PWRDNZ
 		| OMAP343X_CONTROL_CSIRXFE_RESET;
@@ -85,6 +85,9 @@ static void csiphy_routing_cfg_3430(struct isp_csiphy *phy, u32 iface, bool on,
 
 	if (ccp2_strobe)
 		csirxfe |= OMAP343X_CONTROL_CSIRXFE_SELFORM;
+	
+	if (strobe_clk_pol)
+		csirxfe |= OMAP343X_CONTROL_CSIRXFE_CSIB_INV;
 
 	regmap_write(phy->isp->syscon, phy->isp->syscon_offset, csirxfe);
 }
@@ -108,7 +111,7 @@ static void csiphy_routing_cfg(struct isp_csiphy *phy,
 	if (phy->isp->phy_type == ISP_PHY_TYPE_3630 && on)
 		return csiphy_routing_cfg_3630(phy, iface, ccp2_strobe);
 	if (phy->isp->phy_type == ISP_PHY_TYPE_3430)
-		return csiphy_routing_cfg_3430(phy, iface, on, ccp2_strobe);
+		return csiphy_routing_cfg_3430(phy, iface, on, ccp2_strobe, false);
 }
 
 /*
drivers/media/platform/omap3isp/ispcsiphy.h +3 -0
index 28b63b2..88c5c1e8 100644
@@ -40,4 +40,7 @@ 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 csiphy_routing_cfg_3430(struct isp_csiphy *phy, u32 iface, bool on,
+				    bool ccp2_strobe, bool strobe_clk_pol);
+
 #endif	/* OMAP3_ISP_CSI_PHY_H */
Signature · 4 lines
Kind regards,

Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
#39 lore raw

Re: [PATCHv2] omap3isp: add support for CSI1 bus

Hi!

Quoted 7 lines
Quoted 7 lines

Ok, how about this one?
omap3isp: add rest of CSI1 support

CSI1 needs one more bit to be set up. Do just that.

It is not as straightforward as I'd like, see the comments in the code for explanation.

...

Quoted 9 lines
Quoted 9 lines
drivers/media/platform/omap3isp/ispccp2.c +9 -0
+	if (isp->phy_type == ISP_PHY_TYPE_3430) {
+		struct media_pad *pad;
+		struct v4l2_subdev *sensor;
+		const struct isp_ccp2_cfg *buscfg;
+
+		pad = media_entity_remote_pad(&ccp2->pads[CCP2_PAD_SINK]);
+		sensor = media_entity_to_v4l2_subdev(pad->entity);
+		/* Struct isp_bus_cfg has union inside */
+		buscfg = &((struct isp_bus_cfg *)sensor->host_priv)->bus.ccp2;
Quoted 8 lines

drivers/media/platform/omap3isp/ispccp2.c static int ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable) · line 179

Quoted 5 lines
drivers/media/platform/omap3isp/ispccp2.c +5 -0
+
+		csiphy_routing_cfg_3430(&isp->isp_csiphy2,
+					ISP_INTERFACE_CCP2B_PHY1,
+					enable, !!buscfg->phy_layer,
+					buscfg->strobe_clk_pol);

You should do this through omap3isp_csiphy_acquire(), and not call csiphy_routing_cfg_3430() directly from here.

Well, unfortunately omap3isp_csiphy_acquire() does have csi2 assumptions hard-coded :-(.

This will probably fail.

	        rval = omap3isp_csi2_reset(phy->csi2);
	        if (rval < 0)
		                goto done;

And this will oops:

static int omap3isp_csiphy_config(struct isp_csiphy *phy)

{
	struct isp_csi2_device *csi2 = phy->csi2;
        struct isp_pipeline *pipe = to_isp_pipeline(&csi2->subdev.entity);

struct isp_bus_cfg *buscfg = pipe->external->host_priv;

Quoted 8 lines

drivers/media/platform/omap3isp/ispccp2.c int omap3isp_ccp2_init(struct isp_device *isp) · line 1163

Quoted 6 lines
drivers/media/platform/omap3isp/ispccp2.c +2 -0
@@ -1137,10 +1159,19 @@ int omap3isp_ccp2_init(struct isp_device *isp)
 	if (isp->revision == ISP_REVISION_2_0) {
 		ccp2->vdds_csib = devm_regulator_get(isp->dev, "vdds_csib");
 		if (IS_ERR(ccp2->vdds_csib)) {
+			if (PTR_ERR(ccp2->vdds_csib) == -EPROBE_DEFER)
+				return -EPROBE_DEFER;

This should go to a separate patch.

Ok, easy enough.

Quoted 4 lines
Quoted 4 lines
drivers/media/platform/omap3isp/ispccp2.c +0 -0
 			dev_dbg(isp->dev,
 				"Could not get regulator vdds_csib\n");
 			ccp2->vdds_csib = NULL;
 		}
Quoted 8 lines

drivers/media/platform/omap3isp/ispccp2.c int omap3isp_ccp2_init(struct isp_device *isp) · line 1173

Quoted 6 lines
drivers/media/platform/omap3isp/ispccp2.c +6 -0
+		/*
+		 * If we set up ccp2->phy here,
+		 * omap3isp_csiphy_acquire() will go ahead and assume
+		 * csi2, dereferencing some null pointers.
+		 *
+		 * ccp2->phy = &isp->isp_csiphy2;

That needs to be fixed separately.

See analysis above. Yes, it would be nice to fix it. Can you provide some hints how to do that? Maybe even patch to test? :-).

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#40 lore raw

Re: [PATCHv2] omap3isp: add support for CSI1 bus

Hi Pavel,

Quoted 28 lines · Pavel Machek

Hi!

Quoted 7 lines
Quoted 7 lines

Ok, how about this one?
omap3isp: add rest of CSI1 support

CSI1 needs one more bit to be set up. Do just that.

It is not as straightforward as I'd like, see the comments in the code for explanation.

...

Quoted 9 lines
Quoted 9 lines
drivers/media/platform/omap3isp/ispccp2.c +9 -0
+	if (isp->phy_type == ISP_PHY_TYPE_3430) {
+		struct media_pad *pad;
+		struct v4l2_subdev *sensor;
+		const struct isp_ccp2_cfg *buscfg;
+
+		pad = media_entity_remote_pad(&ccp2->pads[CCP2_PAD_SINK]);
+		sensor = media_entity_to_v4l2_subdev(pad->entity);
+		/* Struct isp_bus_cfg has union inside */
+		buscfg = &((struct isp_bus_cfg *)sensor->host_priv)->bus.ccp2;
Quoted 8 lines

drivers/media/platform/omap3isp/ispccp2.c static int ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable) · line 179

Quoted 5 lines
drivers/media/platform/omap3isp/ispccp2.c +5 -0
+
+		csiphy_routing_cfg_3430(&isp->isp_csiphy2,
+					ISP_INTERFACE_CCP2B_PHY1,
+					enable, !!buscfg->phy_layer,
+					buscfg->strobe_clk_pol);

You should do this through omap3isp_csiphy_acquire(), and not call csiphy_routing_cfg_3430() directly from here.

Quoted 8 lines

Well, unfortunately omap3isp_csiphy_acquire() does have csi2 assumptions hard-coded :-(.

This will probably fail.

	        rval = omap3isp_csi2_reset(phy->csi2);
	        if (rval < 0)
		                goto done;

Yes. It needs to be fixed. :-)

Quoted 8 lines

And this will oops:

static int omap3isp_csiphy_config(struct isp_csiphy *phy)

{
	struct isp_csi2_device *csi2 = phy->csi2;
        struct isp_pipeline *pipe = to_isp_pipeline(&csi2->subdev.entity);

struct isp_bus_cfg *buscfg = pipe->external->host_priv;

There seems to be some more work left, yes. :-I

Quoted 25 lines
Quoted 9 lines

drivers/media/platform/omap3isp/ispccp2.c int omap3isp_ccp2_init(struct isp_device *isp) · line 1163

Quoted 7 lines
drivers/media/platform/omap3isp/ispccp2.c +2 -0
@@ -1137,10 +1159,19 @@ int omap3isp_ccp2_init(struct isp_device *isp)
 	if (isp->revision == ISP_REVISION_2_0) {
 		ccp2->vdds_csib = devm_regulator_get(isp->dev, "vdds_csib");
 		if (IS_ERR(ccp2->vdds_csib)) {
+			if (PTR_ERR(ccp2->vdds_csib) == -EPROBE_DEFER)
+				return -EPROBE_DEFER;

This should go to a separate patch.

Ok, easy enough.

Quoted 4 lines
Quoted 4 lines
drivers/media/platform/omap3isp/ispccp2.c +0 -0
 			dev_dbg(isp->dev,
 				"Could not get regulator vdds_csib\n");
 			ccp2->vdds_csib = NULL;
 		}
Quoted 8 lines

drivers/media/platform/omap3isp/ispccp2.c int omap3isp_ccp2_init(struct isp_device *isp) · line 1173

Quoted 6 lines
drivers/media/platform/omap3isp/ispccp2.c +6 -0
+		/*
+		 * If we set up ccp2->phy here,
+		 * omap3isp_csiphy_acquire() will go ahead and assume
+		 * csi2, dereferencing some null pointers.
+		 *
+		 * ccp2->phy = &isp->isp_csiphy2;

That needs to be fixed separately.

Quoted 2 lines

See analysis above. Yes, it would be nice to fix it. Can you provide some hints how to do that? Maybe even patch to test? :-).

If I only will have the time. Let's see if I can find some time this week-end.

Signature · 4 lines
Kind regards,

Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
#41 lore raw

Re: [PATCHv2] omap3isp: add support for CSI1 bus

In reply to Pavel Machek

Hi Pavel,

Quoted 28 lines · Pavel Machek

Hi!

Quoted 7 lines
Quoted 7 lines

Ok, how about this one?
omap3isp: add rest of CSI1 support

CSI1 needs one more bit to be set up. Do just that.

It is not as straightforward as I'd like, see the comments in the code for explanation.

...

Quoted 9 lines
Quoted 9 lines
drivers/media/platform/omap3isp/ispccp2.c +9 -0
+	if (isp->phy_type == ISP_PHY_TYPE_3430) {
+		struct media_pad *pad;
+		struct v4l2_subdev *sensor;
+		const struct isp_ccp2_cfg *buscfg;
+
+		pad = media_entity_remote_pad(&ccp2->pads[CCP2_PAD_SINK]);
+		sensor = media_entity_to_v4l2_subdev(pad->entity);
+		/* Struct isp_bus_cfg has union inside */
+		buscfg = &((struct isp_bus_cfg *)sensor->host_priv)->bus.ccp2;
Quoted 8 lines

drivers/media/platform/omap3isp/ispccp2.c static int ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable) · line 179

Quoted 5 lines
drivers/media/platform/omap3isp/ispccp2.c +5 -0
+
+		csiphy_routing_cfg_3430(&isp->isp_csiphy2,
+					ISP_INTERFACE_CCP2B_PHY1,
+					enable, !!buscfg->phy_layer,
+					buscfg->strobe_clk_pol);

You should do this through omap3isp_csiphy_acquire(), and not call csiphy_routing_cfg_3430() directly from here.

Quoted 8 lines

Well, unfortunately omap3isp_csiphy_acquire() does have csi2 assumptions hard-coded :-(.

This will probably fail.

	        rval = omap3isp_csi2_reset(phy->csi2);
	        if (rval < 0)
		                goto done;

Could you try to two patches I've applied on the ccp2 branch (I'll remove them if there are issues).

That's compile tested for now only.

Signature · 4 lines
Regards,

Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
#42 lore raw

Re: [PATCHv2] omap3isp: add support for CSI1 bus

Quoted 36 lines · Sakari Ailus

Hi Pavel,

Quoted 33 lines · Pavel Machek

Hi!

Quoted 7 lines
Quoted 7 lines

Ok, how about this one?
omap3isp: add rest of CSI1 support

CSI1 needs one more bit to be set up. Do just that.

It is not as straightforward as I'd like, see the comments in the code for explanation.

...

Quoted 9 lines
Quoted 9 lines
drivers/media/platform/omap3isp/ispccp2.c +9 -0
+	if (isp->phy_type == ISP_PHY_TYPE_3430) {
+		struct media_pad *pad;
+		struct v4l2_subdev *sensor;
+		const struct isp_ccp2_cfg *buscfg;
+
+		pad = media_entity_remote_pad(&ccp2->pads[CCP2_PAD_SINK]);
+		sensor = media_entity_to_v4l2_subdev(pad->entity);
+		/* Struct isp_bus_cfg has union inside */
+		buscfg = &((struct isp_bus_cfg *)sensor->host_priv)->bus.ccp2;
Quoted 8 lines

drivers/media/platform/omap3isp/ispccp2.c static int ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable) · line 179

Quoted 5 lines
drivers/media/platform/omap3isp/ispccp2.c +5 -0
+
+		csiphy_routing_cfg_3430(&isp->isp_csiphy2,
+					ISP_INTERFACE_CCP2B_PHY1,
+					enable, !!buscfg->phy_layer,
+					buscfg->strobe_clk_pol);

You should do this through omap3isp_csiphy_acquire(), and not call csiphy_routing_cfg_3430() directly from here.

Well, unfortunately omap3isp_csiphy_acquire() does have csi2 assumptions hard-coded :-(.

This will probably fail.

Quoted 8 lines
Quoted 3 lines
	        rval = omap3isp_csi2_reset(phy->csi2);
	        if (rval < 0)
		                goto done;

Could you try to two patches I've applied on the ccp2 branch (I'll remove them if there are issues).

That's compile tested for now only.

One more thing. What's needed for configuring the PHY for CCP2?

For instance, is the CSI-2 PHY regulator still needed in omap3isp_csiphy_acquire()? One way to do this might go to see the original driver for N900; I don't have the TRM at hand right now.

Signature · 4 lines
Kind regards,

Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
#43 lore raw

Re: [PATCHv2] omap3isp: add support for CSI1 bus

Hi Sakari,

Quoted 45 lines · On Saturday 04 Mar 2017 17:39:46 Sakari Ailus wrote:
Quoted 44 lines · Sakari Ailus
Quoted 31 lines · Pavel Machek
Quoted 8 lines
Quoted 8 lines

Ok, how about this one?
omap3isp: add rest of CSI1 support

CSI1 needs one more bit to be set up. Do just that.

It is not as straightforward as I'd like, see the comments in the code for explanation.

...

Quoted 11 lines
Quoted 11 lines
drivers/media/platform/omap3isp/ispccp2.c +9 -2
+	if (isp->phy_type == ISP_PHY_TYPE_3430) {
+		struct media_pad *pad;
+		struct v4l2_subdev *sensor;
+		const struct isp_ccp2_cfg *buscfg;
+
+		pad = media_entity_remote_pad(&ccp2
->pads[CCP2_PAD_SINK]);
+		sensor = media_entity_to_v4l2_subdev(pad->entity);
+		/* Struct isp_bus_cfg has union inside */
+		buscfg = &((struct isp_bus_cfg *)sensor->host_priv)
->bus.ccp2;
Quoted 8 lines

drivers/media/platform/omap3isp/ispccp2.c static int ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable) · line 179

Quoted 5 lines
drivers/media/platform/omap3isp/ispccp2.c +5 -0
+
+		csiphy_routing_cfg_3430(&isp->isp_csiphy2,
+					ISP_INTERFACE_CCP2B_PHY1,
+					enable, !!buscfg->phy_layer,
+					buscfg->strobe_clk_pol);

You should do this through omap3isp_csiphy_acquire(), and not call csiphy_routing_cfg_3430() directly from here.

Quoted 8 lines

Well, unfortunately omap3isp_csiphy_acquire() does have csi2 assumptions hard-coded :-(.

This will probably fail.

	        rval = omap3isp_csi2_reset(phy->csi2);
	        if (rval < 0)
		                goto done;

Could you try to two patches I've applied on the ccp2 branch (I'll remove them if there are issues).

Quoted 7 lines
Quoted 1 line

That's compile tested for now only.

One more thing. What's needed for configuring the PHY for CCP2?

For instance, is the CSI-2 PHY regulator still needed in omap3isp_csiphy_acquire()? One way to do this might go to see the original driver for N900; I don't have the TRM at hand right now.

The OMAP34xx TRM and data manual both mention separate VDDS power supplies for the CSIb and CSI2 I/O complexes.

vdds_csi2 CSI2 Complex I/O
vdds_csib CSIb Complex I/O

On OMAP36xx, we instead have

vdda_csiphy1 Input power for camera PHY buffer
vdda_csiphy2 Input power for camera PHY buffer

We need to enable the vds_csib regulator to operate the CSI1/CCP2 PHY, but that regulator gets enabled in ispccp2.c as that module is powered by the vdds_csib supply on OMAP34xx. However, it won't hurt to do so, and the code could be simpler if we manage the regulators the same way on OMAP34xx and OMAP36xx.

Signature · 3 lines
Regards,

Laurent Pinchart
#44 lore raw

[bug] omap3isp: missing support for ENUM_FMT

Hi!

Currently, ispvideo.c does not support enum_format. This causes problems for example for libv4l2.

Now, I'm pretty sure patch below is not the right fix. But it fixes libv4l2 problem for me.

Pointer to right solution welcome.

Regards,
Pavel

drivers/media/platform/omap3isp/ispvideo.c +39 -0
index 218e6d7..2ce0327 100644
@@ -772,6 +772,44 @@ isp_video_try_format(struct file *file, void *fh, struct v4l2_format *format)
 }
 
 static int
+isp_video_enum_format(struct file *file, void *fh, struct v4l2_fmtdesc *format)
+{
+	struct isp_video *video = video_drvdata(file);
+	struct v4l2_subdev_format fmt;
+	struct v4l2_subdev *subdev;
+	u32 pad;
+	int ret;
+
+	printk("ispvideo: enum_fmt\n");
+
+	subdev = isp_video_remote_subdev(video, &pad);
+	if (subdev == NULL) {
+		printk("No subdev\n");
+		//return -EINVAL;
+	}
+
+	//isp_video_pix_to_mbus(&format->fmt.pix, &fmt.format);
+	if (format->index)
+		return -EINVAL;
+	format->type = video->type;
+	format->flags = 0;
+	strcpy(format->description, "subdev description");
+	format->pixelformat = V4L2_PIX_FMT_SGRBG10;
+
+	printk("Returning SRGBG10\n");
+#if 0	
+	fmt.pad = pad;
+	fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
+	ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
+	if (ret)
+		return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
+
+	isp_video_mbus_to_pix(video, &fmt.format, &format->fmt.pix);
+#endif
+	return 0;
+}
+
+static int
 isp_video_get_selection(struct file *file, void *fh, struct v4l2_selection *sel)
 {
 	struct isp_video *video = video_drvdata(file);
@@ -1276,6 +1314,7 @@ static const struct v4l2_ioctl_ops isp_video_ioctl_ops = {
 	.vidioc_g_fmt_vid_cap		= isp_video_get_format,
 	.vidioc_s_fmt_vid_cap		= isp_video_set_format,
 	.vidioc_try_fmt_vid_cap		= isp_video_try_format,
+	.vidioc_enum_fmt_vid_cap        = isp_video_enum_format,
 	.vidioc_g_fmt_vid_out		= isp_video_get_format,
 	.vidioc_s_fmt_vid_out		= isp_video_set_format,
 	.vidioc_try_fmt_vid_out		= isp_video_try_format,
Quoted 73 lines · Laurent Pinchart

Hi Sakari,

Quoted 45 lines · On Saturday 04 Mar 2017 17:39:46 Sakari Ailus wrote:
Quoted 44 lines · Sakari Ailus
Quoted 31 lines · Pavel Machek
Quoted 8 lines
Quoted 8 lines

Ok, how about this one?
omap3isp: add rest of CSI1 support

CSI1 needs one more bit to be set up. Do just that.

It is not as straightforward as I'd like, see the comments in the code for explanation.

...

Quoted 11 lines
Quoted 11 lines
(quoted diff) +9 -2
+	if (isp->phy_type == ISP_PHY_TYPE_3430) {
+		struct media_pad *pad;
+		struct v4l2_subdev *sensor;
+		const struct isp_ccp2_cfg *buscfg;
+
+		pad = media_entity_remote_pad(&ccp2
->pads[CCP2_PAD_SINK]);
+		sensor = media_entity_to_v4l2_subdev(pad->entity);
+		/* Struct isp_bus_cfg has union inside */
+		buscfg = &((struct isp_bus_cfg *)sensor->host_priv)
->bus.ccp2;
Quoted 8 lines

Review

Quoted 5 lines
(quoted diff) +5 -0
+
+		csiphy_routing_cfg_3430(&isp->isp_csiphy2,
+					ISP_INTERFACE_CCP2B_PHY1,
+					enable, !!buscfg->phy_layer,
+					buscfg->strobe_clk_pol);

You should do this through omap3isp_csiphy_acquire(), and not call csiphy_routing_cfg_3430() directly from here.

Quoted 8 lines

Well, unfortunately omap3isp_csiphy_acquire() does have csi2 assumptions hard-coded :-(.

This will probably fail.

	        rval = omap3isp_csi2_reset(phy->csi2);
	        if (rval < 0)
		                goto done;

Could you try to two patches I've applied on the ccp2 branch (I'll remove them if there are issues).

Quoted 7 lines
Quoted 1 line

That's compile tested for now only.

One more thing. What's needed for configuring the PHY for CCP2?

For instance, is the CSI-2 PHY regulator still needed in omap3isp_csiphy_acquire()? One way to do this might go to see the original driver for N900; I don't have the TRM at hand right now.

The OMAP34xx TRM and data manual both mention separate VDDS power supplies for the CSIb and CSI2 I/O complexes.

vdds_csi2 CSI2 Complex I/O
vdds_csib CSIb Complex I/O

On OMAP36xx, we instead have

vdda_csiphy1 Input power for camera PHY buffer
vdda_csiphy2 Input power for camera PHY buffer

We need to enable the vds_csib regulator to operate the CSI1/CCP2 PHY, but that regulator gets enabled in ispccp2.c as that module is powered by the vdds_csib supply on OMAP34xx. However, it won't hurt to do so, and the code could be simpler if we manage the regulators the same way on OMAP34xx and OMAP36xx.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#45 lore raw

Re: [bug] omap3isp: missing support for ENUM_FMT

Hi Pavel,

Quoted 9 lines · Pavel Machek

Hi!

Currently, ispvideo.c does not support enum_format. This causes problems for example for libv4l2.

Now, I'm pretty sure patch below is not the right fix. But it fixes libv4l2 problem for me.

Pointer to right solution welcome.

The issue with providing ENUM_FMT support on MC-enabled drivers is that the media bus format has an effect to which pixel formats are available.

What has been discussed in the past but what remains unimplemented is to add the media bus code to v4l2_fmtdesc for user to choose. That would allow meaningful ENUM_FMT support.

For users such as libv4l2, i.e. code == 0 --- it should just tell the user what it can do with the active media bus format.

Signature · 4 lines
Kind regards,

Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
#46 lore raw

Re: [PATCHv2] omap3isp: add support for CSI1 bus

In reply to Sakari Ailus

Hi!

Quoted 23 lines
Quoted 23 lines
Quoted 9 lines
Quoted 9 lines
drivers/media/platform/omap3isp/ispccp2.c +9 -0
+	if (isp->phy_type == ISP_PHY_TYPE_3430) {
+		struct media_pad *pad;
+		struct v4l2_subdev *sensor;
+		const struct isp_ccp2_cfg *buscfg;
+
+		pad = media_entity_remote_pad(&ccp2->pads[CCP2_PAD_SINK]);
+		sensor = media_entity_to_v4l2_subdev(pad->entity);
+		/* Struct isp_bus_cfg has union inside */
+		buscfg = &((struct isp_bus_cfg *)sensor->host_priv)->bus.ccp2;
Quoted 8 lines

drivers/media/platform/omap3isp/ispccp2.c static int ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable) · line 179

Quoted 5 lines
drivers/media/platform/omap3isp/ispccp2.c +5 -0
+
+		csiphy_routing_cfg_3430(&isp->isp_csiphy2,
+					ISP_INTERFACE_CCP2B_PHY1,
+					enable, !!buscfg->phy_layer,
+					buscfg->strobe_clk_pol);

You should do this through omap3isp_csiphy_acquire(), and not call csiphy_routing_cfg_3430() directly from here.

Well, unfortunately omap3isp_csiphy_acquire() does have csi2 assumptions hard-coded :-(.

This will probably fail.

Quoted 8 lines
Quoted 3 lines
	        rval = omap3isp_csi2_reset(phy->csi2);
	        if (rval < 0)
		                goto done;

Could you try to two patches I've applied on the ccp2 branch (I'll remove them if there are issues).

That's compile tested for now only.

Thanks! They seem to be step in right direction. I still need to call csiphy_routing_cfg_3430() directly for camera to work, but at least it does not crash if I set up the phy pointer. I'll debug it some more.

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
#47 lore raw

Re: [PATCHv2] omap3isp: add support for CSI1 bus

In reply to Sakari Ailus

Hi!

Quoted 10 lines
Quoted 5 lines

This will probably fail.

	        rval = omap3isp_csi2_reset(phy->csi2);
	        if (rval < 0)
		                goto done;

Could you try to two patches I've applied on the ccp2 branch (I'll remove them if there are issues).

That's compile tested for now only.

They help a lot. Now I can use similar code paths...

Not yet a mergeable patch, but already better than it was.

Thanks and best regards,
Pavel

drivers/media/platform/omap3isp/ispccp2.c +2 -0
index 24a9fc5..79838bd 100644
@@ -21,6 +23,7 @@
 #include <linux/mutex.h>
 #include <linux/uaccess.h>
 #include <linux/regulator/consumer.h>
+#include <linux/regmap.h>
 
 #include "isp.h"
 #include "ispreg.h"
@@ -1149,6 +1170,7 @@ int omap3isp_ccp2_init(struct isp_device *isp)
 				"Could not get regulator vdds_csib\n");
 			ccp2->vdds_csib = NULL;
 		}
+		ccp2->phy = &isp->isp_csiphy2;
 	} else if (isp->revision == ISP_REVISION_15_0) {
 		ccp2->phy = &isp->isp_csiphy1;
 	}
drivers/media/platform/omap3isp/ispcsiphy.c +37 -18

98 lines not on this page · raw message

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#48 lore raw

PATCH 1/1 v4l2-fwnode: Fix clock lane parsing

In reply to Sakari Ailus

Fix clock lane parsing in v4l2-fwnode.

drivers/media/v4l2-core/v4l2-fwnode.c +1 -1
index d6666d3..44036b8 100644
@@ -167,7 +167,7 @@ void v4l2_fwnode_endpoint_parse_csi1_bus(struct fwnode_handle *fwn,
                bus->data_lane = v;
 
        if (!fwnode_property_read_u32(fwn, "clock-lanes", &v))
-               bus->data_lane = v;
+               bus->clock_lane = v;
 
        if (bus_type == V4L2_FWNODE_BUS_TYPE_CCP2)
 	       vfwn->bus_type = V4L2_MBUS_CCP2;
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#49 lore raw

Re: [PATCH] v4l2-fwnode: Fix clock lane parsing

Quoted 9 lines · Pavel Machek

Fix clock lane parsing in v4l2-fwnode.

drivers/media/v4l2-core/v4l2-fwnode.c +0 -0
index d6666d3..44036b8 100644

drivers/media/v4l2-core/v4l2-fwnode.c void v4l2_fwnode_endpoint_parse_csi1_bus(struct fwnode_handle *fwn, · line 170

Quoted 5 lines
drivers/media/v4l2-core/v4l2-fwnode.c +1 -1
@@ -167,7 +167,7 @@ void v4l2_fwnode_endpoint_parse_csi1_bus(struct fwnode_handle *fwn,
                bus->data_lane = v;
 
        if (!fwnode_property_read_u32(fwn, "clock-lanes", &v))
-               bus->data_lane = v;
+               bus->clock_lane = v;

Oh my. Did I really write it like that?

I'll merge your fix next Monday. Thanks!

Signature · 2 lines
Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
#50 lore raw

v4l2-fwnode: status, plans for merge, any branch to merge against?

Hi!

Are there any news about the fwnode branch?

I have quite usable camera, but it is still based on 982e8e40390d26430ef106fede41594139a4111c (that's v4.10). It would be good to see fwnode stuff upstream... are there any plans for that?

Is there stable branch to which I could move the stuff?

Thanks,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#51 lore raw

Re: v4l2-fwnode: status, plans for merge, any branch to merge against?

Hi Pavel,

Quoted 9 lines · Pavel Machek

Hi!

Are there any news about the fwnode branch?

I have quite usable camera, but it is still based on 982e8e40390d26430ef106fede41594139a4111c (that's v4.10). It would be good to see fwnode stuff upstream... are there any plans for that?

Is there stable branch to which I could move the stuff?

What's relevant for most V4L2 drivers is in linux-media right now.

There are new features that will take some time to get in. The trouble has been, and continue to be, that the patches need to go through various trees so it'll take some time for them to be merged.

I expect to have most of them in during the next merge window.

Signature · 4 lines
Kind regards,

Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
#52 lore raw

Re: v4l2-fwnode: status, plans for merge, any branch to merge against?

Hi!

Quoted 8 lines
Quoted 7 lines

Are there any news about the fwnode branch?

I have quite usable camera, but it is still based on 982e8e40390d26430ef106fede41594139a4111c (that's v4.10). It would be good to see fwnode stuff upstream... are there any plans for that?

Is there stable branch to which I could move the stuff?

Quoted 7 lines

What's relevant for most V4L2 drivers is in linux-media right now.

There are new features that will take some time to get in. The trouble has been, and continue to be, that the patches need to go through various trees so it'll take some time for them to be merged.

I expect to have most of them in during the next merge window.

So git://linuxtv.org/media_tree.git branch master is the right one to work one?

Thanks,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#53 lore raw

Re: v4l2-fwnode: status, plans for merge, any branch to merge against?

Hi, Pavel!

Quoted 12 lines · Pavel Machek

Hi!

Quoted 10 lines
Quoted 7 lines

Are there any news about the fwnode branch?

I have quite usable camera, but it is still based on 982e8e40390d26430ef106fede41594139a4111c (that's v4.10). It would be good to see fwnode stuff upstream... are there any plans for that?

Is there stable branch to which I could move the stuff?

What's relevant for most V4L2 drivers is in linux-media right now.

Quoted 8 lines
Quoted 5 lines

There are new features that will take some time to get in. The trouble has been, and continue to be, that the patches need to go through various trees so it'll take some time for them to be merged.

I expect to have most of them in during the next merge window.

So git://linuxtv.org/media_tree.git branch master is the right one to work one?

I also pushed the rebased ccp2 branch there:

<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=ccp2>

It's now right on the top of media-tree master.

Signature · 4 lines
Regards,

Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
#54 lore raw

Re: v4l2-fwnode: status, plans for merge, any branch to merge against?

Hi!

Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 7 lines

Are there any news about the fwnode branch?

I have quite usable camera, but it is still based on 982e8e40390d26430ef106fede41594139a4111c (that's v4.10). It would be good to see fwnode stuff upstream... are there any plans for that?

Is there stable branch to which I could move the stuff?

What's relevant for most V4L2 drivers is in linux-media right now.

There are new features that will take some time to get in. The trouble has been, and continue to be, that the patches need to go through various trees so it'll take some time for them to be merged.

I expect to have most of them in during the next merge window.

Quoted 8 lines
Quoted 2 lines

So git://linuxtv.org/media_tree.git branch master is the right one to work one?

I also pushed the rebased ccp2 branch there:

<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=ccp2>

It's now right on the top of media-tree master.

Thanks, that's what I was looking for.

Unfortunately, it does not compile.

CC drivers/media/platform/omap3isp/ispcsiphy.o
drivers/media/platform/omap3isp/isp.c: In function 'isp_fwnode_parse':
drivers/media/platform/omap3isp/isp.c:2029:35: error: 'fwn' undeclared (first use in this function) drivers/media/platform/omap3isp/isp.c:2029:35: note: each undeclared identifier is reported only once for each function it appears in drivers/media/platform/omap3isp/isp.c:2029:2: error: incompatible type for argument 2 of 'v4l2_fwnode_endpoint_parse'
In file included from drivers/media/platform/omap3isp/isp.c:67:0:
./include/media/v4l2-fwnode.h:112:5: note: expected 'struct v4l2_fwnode_endpoint *' but argument is of type 'struct v4l2_fwnode_endpoint'
scripts/Makefile.build:302: recipe for target 'drivers/media/platform/omap3isp/isp.o' failed
make[4]: *** [drivers/media/platform/omap3isp/isp.o] Error 1 make[4]: *** Waiting for unfinished jobs.... scripts/Makefile.build:561: recipe for target 'drivers/media/platform/omap3isp' failed
make[3]: *** [drivers/media/platform/omap3isp] Error 2

You can get my config if needed. Now let me try to fix it... It was not too bad, good.

commit 364340e7aa037535a65d2ef2a1711c97d233fede

Author: Pavel <[email protected]>
Date:   Wed Jun 14 21:40:37 2017 +0200

Fix compilation of omap3isp/isp.c.

drivers/media/platform/omap3isp/isp.c +1 -1
index 4ca3fc9..b80debf 100644
@@ -2026,7 +2026,7 @@ static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode,
 
 	isd->bus = buscfg;
 
-	ret = v4l2_fwnode_endpoint_parse(fwn, vep);
+	ret = v4l2_fwnode_endpoint_parse(fwnode, &vep);
 	if (ret)
 		return ret;
 

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#55 lore raw

Re: v4l2-fwnode: status, plans for merge, any branch to merge against?

drivers/media/platform/omap3isp/isp.c static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode, · line 2031

Quoted 12 lines · Pavel Machek
drivers/media/platform/omap3isp/isp.c +1 -1
index 4ca3fc9..b80debf 100644
@@ -2026,7 +2026,7 @@ static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode,
 
 	isd->bus = buscfg;
 
-	ret = v4l2_fwnode_endpoint_parse(fwn, vep);
+	ret = v4l2_fwnode_endpoint_parse(fwnode, &vep);
 	if (ret)
 		return ret;

I just pushed the fix there.

Btw. I think we should probably drop the change allocating the sub-device configuration separately. It's better to associate the lens, flash and eeprom (where it exists) to the sensor than to the CSI-2 receiver. In that case there are no async sub-devices without bus configuration.

Signature · 2 lines
Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
#56 lore raw

Re: v4l2-fwnode: status, plans for merge, any branch to merge against?

Quoted 16 lines · Sakari Ailus

drivers/media/platform/omap3isp/isp.c static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode, · line 2031

Quoted 12 lines · Pavel Machek
drivers/media/platform/omap3isp/isp.c +1 -1
index 4ca3fc9..b80debf 100644
@@ -2026,7 +2026,7 @@ static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode,
 
 	isd->bus = buscfg;
 
-	ret = v4l2_fwnode_endpoint_parse(fwn, vep);
+	ret = v4l2_fwnode_endpoint_parse(fwnode, &vep);
 	if (ret)
 		return ret;

I just pushed the fix there.

Quoted 4 lines

Btw. I think we should probably drop the change allocating the sub-device configuration separately. It's better to associate the lens, flash and eeprom (where it exists) to the sensor than to the CSI-2 receiver. In that case there are no async sub-devices without bus configuration.

Actually I thought about that a bit, and am not sure about that.

CSI-2 receiver may not be good place to associate lens and flash with, agreed.

But is sensor a good place? In particular, phones with two cameras cooperating (for example one black&white and one color) are getting common. It seems to be true that each sensor has a lens and autofocus motor associated, but flash LED is common, and both sensors are designed to work as one device.

But yes, that's still better than placing it at CSI-2 receiver. But I guess we should make sure that flash LED can associated with more than one sensor, and maybe we should have some kind of "camera package" entity.

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
#57 lore raw

n900 camera on v4.12-rc (was Re: v4l2-fwnode: status, plans for merge, any branch to merge against?)

In reply to Sakari Ailus

Hi!

Ok, so I played a bit, and now I have working camera in v4.12-rc3.
https://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-n900.git/
camera-fw5-3 is recommended branch to play with.

Sakari, should I attempt to clean/send you patches, or would it be better to wait till ccp2 branch is merged upstream? There's one compile fix, I'll submit that one in following email.

I even have patches for v4l2-utils, so digital camera can be used as ... digital camera :-). (With rather slow autofocus, and 1Mpix only at the moment, but hey, its a start, and I already have _one_ nice picture from it.)

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
#58 lore raw

PATCH 1/1 omap3isp: fix compilation

In reply to Sakari Ailus

Fix compilation of isp.c

drivers/media/platform/omap3isp/isp.c +1 -1
index 4ca3fc9..b80debf 100644
@@ -2026,7 +2026,7 @@ static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode,
 
 	isd->bus = buscfg;
 
-	ret = v4l2_fwnode_endpoint_parse(fwn, vep);
+	ret = v4l2_fwnode_endpoint_parse(fwnode, &vep);
 	if (ret)
 		return ret;
 
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#59 lore raw

Re: [PATCH] omap3isp: fix compilation

Quoted 11 lines · Pavel Machek

Fix compilation of isp.c

drivers/media/platform/omap3isp/isp.c +0 -0
index 4ca3fc9..b80debf 100644

drivers/media/platform/omap3isp/isp.c static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode, · line 2032

Quoted 8 lines
drivers/media/platform/omap3isp/isp.c +1 -1
@@ -2026,7 +2026,7 @@ static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode,
 
  	isd->bus = buscfg;
 
-	ret = v4l2_fwnode_endpoint_parse(fwn, vep);
+	ret = v4l2_fwnode_endpoint_parse(fwnode, &vep);
  	if (ret)
  		return ret;
 

You're using something old since the media tree master already uses &vep.

Regards,

Hans

#60 lore raw

Re: [PATCH] omap3isp: fix compilation

Quoted 5 lines · Hans Verkuil
Quoted 4 lines · Pavel Machek

Fix compilation of isp.c

Quoted 13 lines

drivers/media/platform/omap3isp/isp.c static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode, · line 2030

Quoted 11 lines
drivers/media/platform/omap3isp/isp.c +1 -1
index 4ca3fc9..b80debf 100644
@@ -2026,7 +2026,7 @@ static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode,
 	isd->bus = buscfg;
-	ret = v4l2_fwnode_endpoint_parse(fwn, vep);
+	ret = v4l2_fwnode_endpoint_parse(fwnode, &vep);
 	if (ret)
 		return ret;
 

You're using something old since the media tree master already uses &vep.

Well, yes and no. Pavel is using my ccp2 support branch I recently rebased. :-)

Signature · 2 lines
Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
#61 lore raw

Re: v4l2-fwnode: status, plans for merge, any branch to merge against?

In reply to Sakari Ailus

Hi!

Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 7 lines

Are there any news about the fwnode branch?

I have quite usable camera, but it is still based on 982e8e40390d26430ef106fede41594139a4111c (that's v4.10). It would be good to see fwnode stuff upstream... are there any plans for that?

Is there stable branch to which I could move the stuff?

What's relevant for most V4L2 drivers is in linux-media right now.

There are new features that will take some time to get in. The trouble has been, and continue to be, that the patches need to go through various trees so it'll take some time for them to be merged.

I expect to have most of them in during the next merge window.

Quoted 8 lines
Quoted 2 lines

So git://linuxtv.org/media_tree.git branch master is the right one to work one?

I also pushed the rebased ccp2 branch there:

<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=ccp2>

It's now right on the top of media-tree master.

Is ccp2 branch expected to go into 4.13, too?

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
#62 lore raw

Re: v4l2-fwnode: status, plans for merge, any branch to merge against?

Quoted 21 lines · Pavel Machek

Hi!

Quoted 19 lines
Quoted 18 lines
Quoted 8 lines
Quoted 7 lines

Are there any news about the fwnode branch?

I have quite usable camera, but it is still based on 982e8e40390d26430ef106fede41594139a4111c (that's v4.10). It would be good to see fwnode stuff upstream... are there any plans for that?

Is there stable branch to which I could move the stuff?

Quoted 7 lines

What's relevant for most V4L2 drivers is in linux-media right now.

There are new features that will take some time to get in. The trouble has been, and continue to be, that the patches need to go through various trees so it'll take some time for them to be merged.

I expect to have most of them in during the next merge window.

So git://linuxtv.org/media_tree.git branch master is the right one to work one?

Quoted 7 lines
Quoted 5 lines

I also pushed the rebased ccp2 branch there:

<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=ccp2>

It's now right on the top of media-tree master.

Is ccp2 branch expected to go into 4.13, too?

Hi Pavel,

What I've done is just rebased the ccp2 branch. In other words, the patches in that branch are no more ready than they were.

To get these merged we should ideally

1) Make sure there will be no regressions,

2) clean things up in the omap3isp; which resources are needed and when (e.g. regulators, PHY configuration) isn't clear at the moment and

2) have one driver using the implementation.

At least 1) is needed. I think a number of framework patches could be mergeable before 2) and 3) are done. I can prepare a set later this week. But even that'd be likely for 4.14, not 4.13.

Signature · 4 lines
Kind regards,

Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
#63 lore raw

Re: v4l2-fwnode: status, plans for merge, any branch to merge against?

Hi!

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 4 lines
Quoted 1 line

I expect to have most of them in during the next merge window.

So git://linuxtv.org/media_tree.git branch master is the right one to work one?

I also pushed the rebased ccp2 branch there:

<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=ccp2>

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

It's now right on the top of media-tree master.

Is ccp2 branch expected to go into 4.13, too?

Hi Pavel,

What I've done is just rebased the ccp2 branch. In other words, the patches in that branch are no more ready than they were.

I thought they were ready even back then :-).

Quoted 3 lines

To get these merged we should ideally

1) Make sure there will be no regressions,

Well, all I have running recent kernels is N900. If ccp branch works for you on N9, that's probably as much testing as we can get.

Quoted 8 lines

2) clean things up in the omap3isp; which resources are needed and when (e.g. regulators, PHY configuration) isn't clear at the moment and

2) have one driver using the implementation.

At least 1) is needed. I think a number of framework patches could be mergeable before 2) and 3) are done. I can prepare a set later this week. But even that'd be likely for 4.14, not 4.13.

Yep, it is too late for v4.13 now. But getting stuff ready for v4.14 would be good.

I started looking through the patches; I believe they are safe, but it is probably better to review the series you've just mailed.

The driver using the implementation -- yes, I have it all working on n900 (incuding userland, I can actually take photos.) I can post the series, or better link to kernel.org.

Right now, my goal would be to get sensor working on N900 with mainline (without flash and focus).

I'd very much like any comment on patch attached below.

Age Commit message (Expand) Author Files Lines
2017-06-16 omap3isp: Destroy CSI-2 phy mutexes in error and module
2017-06-16 omap3isp: Skip CSI-2 receiver initialisation in CCP2
2017-06-16 omap3isp: Correctly put the last iterated endpoint
2017-06-16 omap3isp: Always initialise isp and mutex for csiphy1
2017-06-16 omap3isp: Return -EPROBE_DEFER if the required
2017-06-16 omap3isp: Correctly set IO_OUT_SEL and VP_CLK_POL for CCP2

2017-06-16    omap3isp: Make external sub-device bus configuration a
2017-06-15    omap3isp: Parse CSI1 configuration from the device tree
2017-06-15    omap3isp: Check for valid port in endpoints	Sakari

2017-06-15 omap3isp: Ignore endpoints with invalid configuration

# Nothing changes for bus_type == V4L2_MBUS_CSI2. FIXME: Is bus_type
set correctly?

2017-06-15 smiapp: add CCP2 support Pavel Machek 1

# bus_type will be guess, so no code changes on existing system:

2017-06-15 v4l: Add support for CSI-1 and CCP2 busses Sakari

# Reads unused value -> can't break anything:

2017-06-13 v4l: fwnode: Obtain data bus type from FW Sakari

# No code changes -> totally safe:

2017-06-13 v4l: fwnode: Call CSI2 bus csi2, not csi Sakari
2017-06-13 dt: bindings: Add strobe property for CCP2 Sakari
2017-06-13 dt: bindings: Explicitly specify bus type

Best regards,
Pavel

commit 1220492dd4c1872c8036caa573680f95aabc69bc

Author: Pavel <[email protected]>
Date:   Tue Feb 28 12:02:26 2017 +0100

omap3isp: add CSI1 support

Use proper code path for csi1/ccp2 support.

drivers/media/platform/omap3isp/ispccp2.c +1 -0
index 24a9fc5..47210b1 100644
@@ -1149,6 +1149,7 @@ int omap3isp_ccp2_init(struct isp_device *isp)
 				"Could not get regulator vdds_csib\n");
 			ccp2->vdds_csib = NULL;
 		}
+		ccp2->phy = &isp->isp_csiphy2;
 	} else if (isp->revision == ISP_REVISION_15_0) {
 		ccp2->phy = &isp->isp_csiphy1;
 	}
drivers/media/platform/omap3isp/ispcsiphy.c +11 -7
index 50c0f64..862fdd3 100644
@@ -197,9 +197,10 @@ static int omap3isp_csiphy_config(struct isp_csiphy *phy)
 	}
 
 	if (buscfg->interface == ISP_INTERFACE_CCP2B_PHY1
-	    || buscfg->interface == ISP_INTERFACE_CCP2B_PHY2)
+	    || buscfg->interface == ISP_INTERFACE_CCP2B_PHY2) {
 		lanes = &buscfg->bus.ccp2.lanecfg;
-	else
+		phy->num_data_lanes = 1;
+	} else
 		lanes = &buscfg->bus.csi2.lanecfg;
 
 	/* Clock and data lanes verification */
@@ -302,13 +303,16 @@ int omap3isp_csiphy_acquire(struct isp_csiphy *phy)
 	if (rval < 0)
 		goto done;
 
-	rval = csiphy_set_power(phy, ISPCSI2_PHY_CFG_PWR_CMD_ON);
-	if (rval) {
-		regulator_disable(phy->vdd);
-		goto done;
+	if (phy->isp->revision == ISP_REVISION_15_0) {
+		rval = csiphy_set_power(phy, ISPCSI2_PHY_CFG_PWR_CMD_ON);
+		if (rval) {
+			regulator_disable(phy->vdd);
+			goto done;
+		}
+
+		csiphy_power_autoswitch_enable(phy, true);
 	}
 
-	csiphy_power_autoswitch_enable(phy, true);
 	phy->phy_in_use = 1;
 
 done:
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#64 lore raw

Re: v4l2-fwnode: status, plans for merge, any branch to merge against?

Hi Pavel,

Quoted 127 lines · Pavel Machek

Hi!

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 4 lines
Quoted 1 line

I expect to have most of them in during the next merge window.

So git://linuxtv.org/media_tree.git branch master is the right one to work one?

I also pushed the rebased ccp2 branch there:

<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=ccp2>

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

It's now right on the top of media-tree master.

Is ccp2 branch expected to go into 4.13, too?

Hi Pavel,

What I've done is just rebased the ccp2 branch. In other words, the patches in that branch are no more ready than they were.

I thought they were ready even back then :-).

Quoted 3 lines

To get these merged we should ideally

1) Make sure there will be no regressions,

Well, all I have running recent kernels is N900. If ccp branch works for you on N9, that's probably as much testing as we can get.

Quoted 8 lines

2) clean things up in the omap3isp; which resources are needed and when (e.g. regulators, PHY configuration) isn't clear at the moment and

2) have one driver using the implementation.

At least 1) is needed. I think a number of framework patches could be mergeable before 2) and 3) are done. I can prepare a set later this week. But even that'd be likely for 4.14, not 4.13.

Yep, it is too late for v4.13 now. But getting stuff ready for v4.14 would be good.

I started looking through the patches; I believe they are safe, but it is probably better to review the series you've just mailed.

The driver using the implementation -- yes, I have it all working on n900 (incuding userland, I can actually take photos.) I can post the series, or better link to kernel.org.

Right now, my goal would be to get sensor working on N900 with mainline (without flash and focus).

I'd very much like any comment on patch attached below.

Age Commit message (Expand) Author Files Lines
2017-06-16 omap3isp: Destroy CSI-2 phy mutexes in error and module
2017-06-16 omap3isp: Skip CSI-2 receiver initialisation in CCP2
2017-06-16 omap3isp: Correctly put the last iterated endpoint
2017-06-16 omap3isp: Always initialise isp and mutex for csiphy1
2017-06-16 omap3isp: Return -EPROBE_DEFER if the required
2017-06-16 omap3isp: Correctly set IO_OUT_SEL and VP_CLK_POL for CCP2

2017-06-16    omap3isp: Make external sub-device bus configuration a
2017-06-15    omap3isp: Parse CSI1 configuration from the device tree
2017-06-15    omap3isp: Check for valid port in endpoints	Sakari

2017-06-15 omap3isp: Ignore endpoints with invalid configuration

# Nothing changes for bus_type == V4L2_MBUS_CSI2. FIXME: Is bus_type
set correctly?

2017-06-15 smiapp: add CCP2 support Pavel Machek 1

# bus_type will be guess, so no code changes on existing system:

2017-06-15 v4l: Add support for CSI-1 and CCP2 busses Sakari

# Reads unused value -> can't break anything:

2017-06-13 v4l: fwnode: Obtain data bus type from FW Sakari

# No code changes -> totally safe:

2017-06-13 v4l: fwnode: Call CSI2 bus csi2, not csi Sakari
2017-06-13 dt: bindings: Add strobe property for CCP2 Sakari
2017-06-13 dt: bindings: Explicitly specify bus type

Best regards,
Pavel

commit 1220492dd4c1872c8036caa573680f95aabc69bc

Author: Pavel <[email protected]>
Date:   Tue Feb 28 12:02:26 2017 +0100

omap3isp: add CSI1 support

Use proper code path for csi1/ccp2 support.

drivers/media/platform/omap3isp/ispccp2.c +1 -0
index 24a9fc5..47210b1 100644
@@ -1149,6 +1149,7 @@ int omap3isp_ccp2_init(struct isp_device *isp)
 				"Could not get regulator vdds_csib\n");
 			ccp2->vdds_csib = NULL;
 		}
+		ccp2->phy = &isp->isp_csiphy2;
 	} else if (isp->revision == ISP_REVISION_15_0) {
 		ccp2->phy = &isp->isp_csiphy1;
 	}
drivers/media/platform/omap3isp/ispcsiphy.c +3 -2
index 50c0f64..862fdd3 100644
@@ -197,9 +197,10 @@ static int omap3isp_csiphy_config(struct isp_csiphy *phy)
 	}
 
 	if (buscfg->interface == ISP_INTERFACE_CCP2B_PHY1
-	    || buscfg->interface == ISP_INTERFACE_CCP2B_PHY2)
+	    || buscfg->interface == ISP_INTERFACE_CCP2B_PHY2) {
 		lanes = &buscfg->bus.ccp2.lanecfg;
-	else
+		phy->num_data_lanes = 1;
+	} else
 		lanes = &buscfg->bus.csi2.lanecfg;
 
 	/* Clock and data lanes verification */

drivers/media/platform/omap3isp/ispcsiphy.c int omap3isp_csiphy_acquire(struct isp_csiphy *phy) · line 306

Quoted 8 lines
drivers/media/platform/omap3isp/ispcsiphy.c +1 -4
@@ -302,13 +303,16 @@ int omap3isp_csiphy_acquire(struct isp_csiphy *phy)
 	if (rval < 0)
 		goto done;
 
-	rval = csiphy_set_power(phy, ISPCSI2_PHY_CFG_PWR_CMD_ON);
-	if (rval) {
-		regulator_disable(phy->vdd);
-		goto done;
+	if (phy->isp->revision == ISP_REVISION_15_0) {

Shouldn't you make the related changes to omap3isp_csiphy_release() as well?

Other than that the patch looks good to me.

Quoted 14 lines
drivers/media/platform/omap3isp/ispcsiphy.c +7 -1
+		rval = csiphy_set_power(phy, ISPCSI2_PHY_CFG_PWR_CMD_ON);
+		if (rval) {
+			regulator_disable(phy->vdd);
+			goto done;
+		}
+
+		csiphy_power_autoswitch_enable(phy, true);
 	}
 
-	csiphy_power_autoswitch_enable(phy, true);
 	phy->phy_in_use = 1;
 
 done:
Signature · 4 lines
Kind regards,

Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
#65 lore raw

Re: v4l2-fwnode: status, plans for merge, any branch to merge against?

Hi!

Quoted 16 lines
Quoted 16 lines
Quoted 1 line

1) Make sure there will be no regressions,

Well, all I have running recent kernels is N900. If ccp branch works for you on N9, that's probably as much testing as we can get.

Quoted 8 lines

2) clean things up in the omap3isp; which resources are needed and when (e.g. regulators, PHY configuration) isn't clear at the moment and

2) have one driver using the implementation.

At least 1) is needed. I think a number of framework patches could be mergeable before 2) and 3) are done. I can prepare a set later this week. But even that'd be likely for 4.14, not 4.13.

Yep, it is too late for v4.13 now. But getting stuff ready for v4.14 would be good.

...

Quoted 13 lines

drivers/media/platform/omap3isp/ispcsiphy.c int omap3isp_csiphy_acquire(struct isp_csiphy *phy) · line 306

Quoted 9 lines
drivers/media/platform/omap3isp/ispcsiphy.c +1 -4
@@ -302,13 +303,16 @@ int omap3isp_csiphy_acquire(struct isp_csiphy *phy)
 	if (rval < 0)
 		goto done;
 
-	rval = csiphy_set_power(phy, ISPCSI2_PHY_CFG_PWR_CMD_ON);
-	if (rval) {
-		regulator_disable(phy->vdd);
-		goto done;
+	if (phy->isp->revision == ISP_REVISION_15_0) {

Shouldn't you make the related changes to omap3isp_csiphy_release() as well?

Quoted 1 line

Other than that the patch looks good to me.

Ah, yes, that needs to be fixed. Thanks for review.

I'll refresh the series. I believe we now have everything neccessary to have useful driver for 4.14. Series is still based on 4.12-rc3, I can rebase it when there's better base.

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
#66 lore raw

omap3isp: is capture mode working? what hardware? was Re: v4l2-fwnode: status, plans for merge, any branch to merge against?

In reply to Sakari Ailus

Hi!

Quoted 6 lines

What I've done is just rebased the ccp2 branch. In other words, the patches in that branch are no more ready than they were.

To get these merged we should ideally

1) Make sure there will be no regressions,

I grepped dts trees a bit... where is omap3isp currently used? Anything besides N9 and N950?

Does the capture mode currently work for you?

Because as far as I can tell, formatter is disabled, so video is in wrong format for the userspace.

So something like patch below is needed; (of course after adjusting the comment etc.)

Thanks,
Pavel

commit eb81524b8b44bbff2518b272cb3de304157bd3ba

Author: Pavel <[email protected]>
Date:   Mon Feb 13 21:26:51 2017 +0100

omap3isp: fix VP2SDR bit so capture (not preview) works

This is neccessary for capture (not preview) to work properly on N900. Why is unknown.

drivers/media/platform/omap3isp/ispccdc.c +2 -1
index 7207558..2fb755f 100644
@@ -1186,7 +1186,8 @@ static void ccdc_configure(struct isp_ccdc_device *ccdc)
 	/* Use the raw, unprocessed data when writing to memory. The H3A and
 	 * histogram modules are still fed with lens shading corrected data.
 	 */
-	syn_mode &= ~ISPCCDC_SYN_MODE_VP2SDR;
+//	syn_mode &= ~ISPCCDC_SYN_MODE_VP2SDR;
+	syn_mode |= ISPCCDC_SYN_MODE_VP2SDR;
 
 	if (ccdc->output & CCDC_OUTPUT_MEMORY)
 		syn_mode |= ISPCCDC_SYN_MODE_WEN;
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#67 lore raw

RFC 1/1 omap3isp: add support for CSI1 bus

In reply to Sakari Ailus

omap3isp: add rest of CSI1 support

CSI1 needs one more bit to be set up. Do just that.

---

Hmm. Looking at that... num_data_lanes probably should be modified in local variable, not globally like this. Should I do that?

Anything else that needs fixing?

index 24a9fc5..6feba36 100644

drivers/media/platform/omap3isp/ispccp2.c +2 -0
@@ -21,6 +23,7 @@
 #include <linux/mutex.h>
 #include <linux/uaccess.h>
 #include <linux/regulator/consumer.h>
+#include <linux/regmap.h>
 
 #include "isp.h"
 #include "ispreg.h"
@@ -1149,6 +1152,7 @@ int omap3isp_ccp2_init(struct isp_device *isp)
 				"Could not get regulator vdds_csib\n");
 			ccp2->vdds_csib = NULL;
 		}
+		ccp2->phy = &isp->isp_csiphy2;
 	} else if (isp->revision == ISP_REVISION_15_0) {
 		ccp2->phy = &isp->isp_csiphy1;
 	}
drivers/media/platform/omap3isp/ispcsiphy.c +11 -7
index 50c0f64..cd6351b 100644
@@ -197,9 +200,10 @@ static int omap3isp_csiphy_config(struct isp_csiphy *phy)
 	}
 
 	if (buscfg->interface == ISP_INTERFACE_CCP2B_PHY1
-	    || buscfg->interface == ISP_INTERFACE_CCP2B_PHY2)
+	    || buscfg->interface == ISP_INTERFACE_CCP2B_PHY2) {
 		lanes = &buscfg->bus.ccp2.lanecfg;
-	else
+		phy->num_data_lanes = 1;
+	} else
 		lanes = &buscfg->bus.csi2.lanecfg;
 
 	/* Clock and data lanes verification */
@@ -302,13 +306,16 @@ int omap3isp_csiphy_acquire(struct isp_csiphy *phy)
 	if (rval < 0)
 		goto done;
 
-	rval = csiphy_set_power(phy, ISPCSI2_PHY_CFG_PWR_CMD_ON);
-	if (rval) {
-		regulator_disable(phy->vdd);
-		goto done;
+	if (phy->isp->revision == ISP_REVISION_15_0) {
+		rval = csiphy_set_power(phy, ISPCSI2_PHY_CFG_PWR_CMD_ON);
+		if (rval) {
+			regulator_disable(phy->vdd);
+			goto done;
+		}
+		
+		csiphy_power_autoswitch_enable(phy, true);		
 	}
 
-	csiphy_power_autoswitch_enable(phy, true);
 	phy->phy_in_use = 1;
 
 done:
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#68 lore raw

Re: [RFC] omap3isp: add support for CSI1 bus

Quoted 4 lines · Pavel Machek

omap3isp: add rest of CSI1 support

CSI1 needs one more bit to be set up. Do just that.

Quoted 8 lines

---

Hmm. Looking at that... num_data_lanes probably should be modified in local variable, not globally like this. Should I do that?

Anything else that needs fixing?

Ping? Feedback here would be nice. This is last "interesting" piece of the hardware support...

Best regards,
Pavel

Quoted 59 lines

index 24a9fc5..6feba36 100644

drivers/media/platform/omap3isp/ispccp2.c +2 -0
@@ -21,6 +23,7 @@
 #include <linux/mutex.h>
 #include <linux/uaccess.h>
 #include <linux/regulator/consumer.h>
+#include <linux/regmap.h>
 
 #include "isp.h"
 #include "ispreg.h"
@@ -1149,6 +1152,7 @@ int omap3isp_ccp2_init(struct isp_device *isp)
 				"Could not get regulator vdds_csib\n");
 			ccp2->vdds_csib = NULL;
 		}
+		ccp2->phy = &isp->isp_csiphy2;
 	} else if (isp->revision == ISP_REVISION_15_0) {
 		ccp2->phy = &isp->isp_csiphy1;
 	}
drivers/media/platform/omap3isp/ispcsiphy.c +11 -7
index 50c0f64..cd6351b 100644
@@ -197,9 +200,10 @@ static int omap3isp_csiphy_config(struct isp_csiphy *phy)
 	}
 
 	if (buscfg->interface == ISP_INTERFACE_CCP2B_PHY1
-	    || buscfg->interface == ISP_INTERFACE_CCP2B_PHY2)
+	    || buscfg->interface == ISP_INTERFACE_CCP2B_PHY2) {
 		lanes = &buscfg->bus.ccp2.lanecfg;
-	else
+		phy->num_data_lanes = 1;
+	} else
 		lanes = &buscfg->bus.csi2.lanecfg;
 
 	/* Clock and data lanes verification */
@@ -302,13 +306,16 @@ int omap3isp_csiphy_acquire(struct isp_csiphy *phy)
 	if (rval < 0)
 		goto done;
 
-	rval = csiphy_set_power(phy, ISPCSI2_PHY_CFG_PWR_CMD_ON);
-	if (rval) {
-		regulator_disable(phy->vdd);
-		goto done;
+	if (phy->isp->revision == ISP_REVISION_15_0) {
+		rval = csiphy_set_power(phy, ISPCSI2_PHY_CFG_PWR_CMD_ON);
+		if (rval) {
+			regulator_disable(phy->vdd);
+			goto done;
+		}
+		
+		csiphy_power_autoswitch_enable(phy, true);		
 	}
 
-	csiphy_power_autoswitch_enable(phy, true);
 	phy->phy_in_use = 1;
 
 done:
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#69 lore raw

Re: [RFC] omap3isp: add support for CSI1 bus

Quoted 9 lines · Pavel Machek
Quoted 8 lines · Pavel Machek

omap3isp: add rest of CSI1 support

CSI1 needs one more bit to be set up. Do just that.

---

Quoted 7 lines
Quoted 4 lines

Hmm. Looking at that... num_data_lanes probably should be modified in local variable, not globally like this. Should I do that?

Anything else that needs fixing?

Ping? Feedback here would be nice. This is last "interesting" piece of the hardware support...

Any news here? You complained that I was not pushy enough in the past ;-).

Pavel

Quoted 62 lines
Quoted 59 lines

index 24a9fc5..6feba36 100644

drivers/media/platform/omap3isp/ispccp2.c +2 -0
@@ -21,6 +23,7 @@
 #include <linux/mutex.h>
 #include <linux/uaccess.h>
 #include <linux/regulator/consumer.h>
+#include <linux/regmap.h>
 
 #include "isp.h"
 #include "ispreg.h"
@@ -1149,6 +1152,7 @@ int omap3isp_ccp2_init(struct isp_device *isp)
 				"Could not get regulator vdds_csib\n");
 			ccp2->vdds_csib = NULL;
 		}
+		ccp2->phy = &isp->isp_csiphy2;
 	} else if (isp->revision == ISP_REVISION_15_0) {
 		ccp2->phy = &isp->isp_csiphy1;
 	}
drivers/media/platform/omap3isp/ispcsiphy.c +11 -7
index 50c0f64..cd6351b 100644
@@ -197,9 +200,10 @@ static int omap3isp_csiphy_config(struct isp_csiphy *phy)
 	}
 
 	if (buscfg->interface == ISP_INTERFACE_CCP2B_PHY1
-	    || buscfg->interface == ISP_INTERFACE_CCP2B_PHY2)
+	    || buscfg->interface == ISP_INTERFACE_CCP2B_PHY2) {
 		lanes = &buscfg->bus.ccp2.lanecfg;
-	else
+		phy->num_data_lanes = 1;
+	} else
 		lanes = &buscfg->bus.csi2.lanecfg;
 
 	/* Clock and data lanes verification */
@@ -302,13 +306,16 @@ int omap3isp_csiphy_acquire(struct isp_csiphy *phy)
 	if (rval < 0)
 		goto done;
 
-	rval = csiphy_set_power(phy, ISPCSI2_PHY_CFG_PWR_CMD_ON);
-	if (rval) {
-		regulator_disable(phy->vdd);
-		goto done;
+	if (phy->isp->revision == ISP_REVISION_15_0) {
+		rval = csiphy_set_power(phy, ISPCSI2_PHY_CFG_PWR_CMD_ON);
+		if (rval) {
+			regulator_disable(phy->vdd);
+			goto done;
+		}
+		
+		csiphy_power_autoswitch_enable(phy, true);		
 	}
 
-	csiphy_power_autoswitch_enable(phy, true);
 	phy->phy_in_use = 1;
 
 done:
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#70 lore raw

Re: [PATCHv2] omap3isp: add support for CSI1 bus

In reply to Sakari Ailus

Hi Pavel,

Quoted 36 lines · Sakari Ailus

Hi Pavel,

Quoted 33 lines · Pavel Machek

Hi!

Quoted 7 lines
Quoted 7 lines

Ok, how about this one?
omap3isp: add rest of CSI1 support

CSI1 needs one more bit to be set up. Do just that.

It is not as straightforward as I'd like, see the comments in the code for explanation.

...

Quoted 9 lines
Quoted 9 lines
drivers/media/platform/omap3isp/ispccp2.c +9 -0
+	if (isp->phy_type == ISP_PHY_TYPE_3430) {
+		struct media_pad *pad;
+		struct v4l2_subdev *sensor;
+		const struct isp_ccp2_cfg *buscfg;
+
+		pad = media_entity_remote_pad(&ccp2->pads[CCP2_PAD_SINK]);
+		sensor = media_entity_to_v4l2_subdev(pad->entity);
+		/* Struct isp_bus_cfg has union inside */
+		buscfg = &((struct isp_bus_cfg *)sensor->host_priv)->bus.ccp2;
Quoted 8 lines

drivers/media/platform/omap3isp/ispccp2.c static int ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable) · line 179

Quoted 5 lines
drivers/media/platform/omap3isp/ispccp2.c +5 -0
+
+		csiphy_routing_cfg_3430(&isp->isp_csiphy2,
+					ISP_INTERFACE_CCP2B_PHY1,
+					enable, !!buscfg->phy_layer,
+					buscfg->strobe_clk_pol);

You should do this through omap3isp_csiphy_acquire(), and not call csiphy_routing_cfg_3430() directly from here.

Well, unfortunately omap3isp_csiphy_acquire() does have csi2 assumptions hard-coded :-(.

This will probably fail.

Quoted 9 lines
Quoted 3 lines
	        rval = omap3isp_csi2_reset(phy->csi2);
	        if (rval < 0)
		                goto done;

Could you try to two patches I've applied on the ccp2 branch (I'll remove them if there are issues).

That's compile tested for now only.

I've updated the CCP2 patches here on top of the latest fwnode patches:

<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=ccp2>

No even compile testing this time though. I'm afraid I haven't had the time to otherwise to work on the CCP2 support, so there are no other changes besides the rebase.

I intend to send a pull request for the fwnode patches once we have the next rc1 in media tree so then we can have the patches on plain media tree master branch.

Signature · 4 lines
Regards,

Sakari Ailus
e-mail: [email protected]     XMPP: [email protected]
#71 lore raw

Re: [PATCHv2] omap3isp: add support for CSI1 bus

Hi!

Quoted 6 lines
Quoted 5 lines

Could you try to two patches I've applied on the ccp2 branch (I'll remove them if there are issues).

That's compile tested for now only.

Quoted 7 lines

I've updated the CCP2 patches here on top of the latest fwnode patches:

<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=ccp2>

No even compile testing this time though. I'm afraid I haven't had the time to otherwise to work on the CCP2 support, so there are no other changes besides the rebase.

It seems they don't compile. Hmmm. Did I do something wrong? "struct fwnode_endpoint" seems to be only used in v4l2-fwnode.h; that can't be right...?

CC drivers/media/i2c/smiapp/smiapp-core.o
In file included from drivers/media/i2c/smiapp/smiapp-core.c:35:0:
./include/media/v4l2-fwnode.h:83:25: error: field 'base' has incomplete type
drivers/media/i2c/smiapp/smiapp-core.c: In function 'smiapp_get_hwconfig':
drivers/media/i2c/smiapp/smiapp-core.c:2790:9: error: implicit declaration of function 'dev_fwnode' [-Werror=implicit-function-declaration] drivers/media/i2c/smiapp/smiapp-core.c:2790:33: warning:
initialization makes pointer from integer without a cast [enabled by default]
drivers/media/i2c/smiapp/smiapp-core.c:2797:2: error: implicit declaration of function 'fwnode_graph_get_next_endpoint' [-Werror=implicit-function-declaration]

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
#72 lore raw

Re: [PATCHv2] omap3isp: add support for CSI1 bus

Hi!

Quoted 2 lines

It seems they don't compile. Hmmm. Did I do something wrong? "struct fwnode_endpoint" seems to be only used in v4l2-fwnode.h; that can't be right...?

Next problem is missing dev_fwnode; fixed. Next problem is

pavel@duo:/data/l/linux-n900$ git grep fwnode_graph_get_next_endpoint
.
drivers/media/i2c/smiapp/smiapp-core.c: ep =
fwnode_graph_get_next_endpoint(fwnode, NULL);
drivers/media/platform/omap3isp/isp.c:  while ((fwnode =
fwnode_graph_get_next_endpoint(dev_fwnode(dev),

So sorry, I guess I should wait for version that compiles ;-).
Pavel

drivers/base/property.c +0 -5
index c458c63..f52a260 100644
@@ -182,11 +182,6 @@ static int pset_prop_read_string(struct property_set *pset,
 	return 0;
 }
 
-static inline struct fwnode_handle *dev_fwnode(struct device *dev)
-{
-	return IS_ENABLED(CONFIG_OF) && dev->of_node ?
-		&dev->of_node->fwnode : dev->fwnode;
-}
 
 /**
  * device_property_present - check if a property of a device is present
include/linux/fwnode.h +6 -0
index 8bd28ce..9215e23 100644
@@ -27,4 +27,10 @@ struct fwnode_handle {
 	struct fwnode_handle *secondary;
 };
 
+static inline struct fwnode_handle *dev_fwnode(struct device *dev)
+{
+	return IS_ENABLED(CONFIG_OF) && dev->of_node ?
+		&dev->of_node->fwnode : dev->fwnode;
+}
+
 #endif
include/media/v4l2-fwnode.h +1 -1
index d762a55..9e9cfbc 100644
@@ -80,7 +80,7 @@ struct v4l2_fwnode_bus_mipi_csi1 {
  * @nr_of_link_frequencies: number of elements in link_frequenccies array
  */
 struct v4l2_fwnode_endpoint {
-	struct fwnode_endpoint base;
+	/*struct fwnode_endpoint base; */
 	/*
 	 * Fields below this line will be zeroed by
 	 * v4l2_fwnode_parse_endpoint()
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#73 lore raw

PATCH 1/1 omap3isp: wait for regulators to come up

In reply to Pavel Machek

If regulator returns -EPROBE_DEFER, we need to return it too, so that omap3isp will be re-probed when regulator is ready.

drivers/media/platform/omap3isp/ispccp2.c +2 -0
index ca09523..b6e055e 100644
@@ -1137,10 +1159,12 @@ int omap3isp_ccp2_init(struct isp_device *isp)
 	if (isp->revision == ISP_REVISION_2_0) {
 		ccp2->vdds_csib = devm_regulator_get(isp->dev, "vdds_csib");
 		if (IS_ERR(ccp2->vdds_csib)) {
+			if (PTR_ERR(ccp2->vdds_csib) == -EPROBE_DEFER)
+				return -EPROBE_DEFER;
 			dev_dbg(isp->dev,
 				"Could not get regulator vdds_csib\n");
 			ccp2->vdds_csib = NULL;
 		}
 	} else if (isp->revision == ISP_REVISION_15_0) {
 		ccp2->phy = &isp->isp_csiphy1;
 	}
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Reviewed-by on v1 1/1
#74 lore raw

Re: [PATCH] omap3isp: wait for regulators to come up

Hi Pavel,

Thank you for the patch.

Quoted 10 lines · On Thursday 02 Mar 2017 13:45:32 Pavel Machek wrote:

If regulator returns -EPROBE_DEFER, we need to return it too, so that omap3isp will be re-probed when regulator is ready.

(quoted diff) +0 -0

b/drivers/media/platform/omap3isp/ispccp2.c index ca09523..b6e055e 100644

drivers/media/platform/omap3isp/ispccp2.c int omap3isp_ccp2_init(struct isp_device *isp) · line 1163

Quoted 5 lines
drivers/media/platform/omap3isp/ispccp2.c +2 -0
@@ -1137,10 +1159,12 @@ int omap3isp_ccp2_init(struct isp_device *isp)
 	if (isp->revision == ISP_REVISION_2_0) {
 		ccp2->vdds_csib = devm_regulator_get(isp->dev, "vdds_csib");
 		if (IS_ERR(ccp2->vdds_csib)) {
+			if (PTR_ERR(ccp2->vdds_csib) == -EPROBE_DEFER)
+				return -EPROBE_DEFER;

This looks good to me, but it will result in the caller printing a "CCP2 initialization failed" error message, which I'm not sure is right. Maybe we should move that message to the omap3isp_ccp2_init() function ?

In any case, this change is fine, so

Quoted 7 lines
drivers/media/platform/omap3isp/ispccp2.c +0 -0
 			dev_dbg(isp->dev,
 				"Could not get regulator vdds_csib\n");
 			ccp2->vdds_csib = NULL;
 		}
 	} else if (isp->revision == ISP_REVISION_15_0) {
 		ccp2->phy = &isp->isp_csiphy1;
 	}
Signature · 3 lines
Regards,

Laurent Pinchart
Applied
#75 lore raw

Re: [PATCH] omap3isp: wait for regulators to come up

Quoted 25 lines · Laurent Pinchart

Hi Pavel,

Thank you for the patch.

Quoted 10 lines · On Thursday 02 Mar 2017 13:45:32 Pavel Machek wrote:

If regulator returns -EPROBE_DEFER, we need to return it too, so that omap3isp will be re-probed when regulator is ready.

(quoted diff) +0 -0

b/drivers/media/platform/omap3isp/ispccp2.c index ca09523..b6e055e 100644

drivers/media/platform/omap3isp/ispccp2.c int omap3isp_ccp2_init(struct isp_device *isp) · line 1163

Quoted 5 lines
drivers/media/platform/omap3isp/ispccp2.c +2 -0
@@ -1137,10 +1159,12 @@ int omap3isp_ccp2_init(struct isp_device *isp)
 	if (isp->revision == ISP_REVISION_2_0) {
 		ccp2->vdds_csib = devm_regulator_get(isp->dev, "vdds_csib");
 		if (IS_ERR(ccp2->vdds_csib)) {
+			if (PTR_ERR(ccp2->vdds_csib) == -EPROBE_DEFER)
+				return -EPROBE_DEFER;

This looks good to me, but it will result in the caller printing a "CCP2 initialization failed" error message, which I'm not sure is right. Maybe we should move that message to the omap3isp_ccp2_init() function ?

Quoted 3 lines

In any case, this change is fine, so

Applied to ccp2 branch with the error message moved. The old message is still printed if the error code is different.

Signature · 2 lines
Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
#76 lore raw

Re: [PATCH] omap3isp: add support for CSI1 bus

In reply to Laurent Pinchart

Hi!

Quoted 14 lines

Review

Quoted 11 lines
(quoted diff) +11 -0
+		if (enable) {
+			csirxfe = OMAP343X_CONTROL_CSIRXFE_PWRDNZ |
+				  OMAP343X_CONTROL_CSIRXFE_RESET;
+
+			if (buscfg->phy_layer)
+				csirxfe |= OMAP343X_CONTROL_CSIRXFE_SELFORM;
+
+			if (buscfg->strobe_clk_pol)
+				csirxfe |= OMAP343X_CONTROL_CSIRXFE_CSIB_INV;
+		} else
+			csirxfe = 0;

You need curly braces for the else statement too.

Quoted 6 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+		regmap_write(isp->syscon, isp->syscon_offset, csirxfe);

Isn't this already configured by csiphy_routing_cfg_3430(), called through omap3isp_csiphy_acquire() ? You'll need to add support for the strobe/clock polarity there, but the rest should already be handled.

It seems csiphy_routing_cfg_3430 is not called at all. I added printks, but they don't trigger. If you have an idea what is going on there, it would help...
Pavel

drivers/media/platform/omap3isp/ispcsiphy.c +6 -0
index 6b814e1..fe9303a 100644
@@ -30,6 +30,8 @@ static void csiphy_routing_cfg_3630(struct isp_csiphy *phy,
 	u32 reg;
 	u32 shift, mode;
 
+	printk("routing cfg 3630: iface %d, %d\n", iface, ISP_INTERFACE_CCP2B_PHY1);
+	
 	regmap_read(phy->isp->syscon, phy->isp->syscon_offset, &reg);
 
 	switch (iface) {
@@ -74,6 +76,9 @@ static void csiphy_routing_cfg_3430(struct isp_csiphy *phy, u32 iface, bool on,
 	u32 csirxfe = OMAP343X_CONTROL_CSIRXFE_PWRDNZ
 		| OMAP343X_CONTROL_CSIRXFE_RESET;
 
+	/* FIXME: can this be used instead of if (isp->revision) in ispccp2.c? */
+	
+	printk("routing cfg: iface %d, %d\n", iface, ISP_INTERFACE_CCP2B_PHY1);
 	/* Only the CCP2B on PHY1 is configurable. */
 	if (iface != ISP_INTERFACE_CCP2B_PHY1)
 		return;
@@ -105,6 +110,7 @@ static void csiphy_routing_cfg(struct isp_csiphy *phy,
 			       enum isp_interface_type iface, bool on,
 			       bool ccp2_strobe)
 {
+	printk("csiphy_routing_cfg\n");
 	if (phy->isp->phy_type == ISP_PHY_TYPE_3630 && on)
 		return csiphy_routing_cfg_3630(phy, iface, ccp2_strobe);
 	if (phy->isp->phy_type == ISP_PHY_TYPE_3430)
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#77 lore raw

Re: [PATCH] omap3isp: add support for CSI1 bus

Hi,

Quoted 3 lines · Pavel Machek

It seems csiphy_routing_cfg_3430 is not called at all. I added printks, but they don't trigger. If you have an idea what is going on there, it would help...

You added printk to csiphy_routing_cfg_3630 instead of csiphy_routing_cfg_3430 and N900 has OMAP3430. Function should be called when you start (or stop) using the camera:

csiphy_routing_cfg_3430(...) csiphy_routing_cfg(...) omap3isp_csiphy_config(...) omap3isp_csiphy_acquire(...) & omap3isp_csiphy_release(...) ccp2_s_stream(...)

-- Sebastian

Quoted 31 lines
drivers/media/platform/omap3isp/ispcsiphy.c +6 -0
index 6b814e1..fe9303a 100644
@@ -30,6 +30,8 @@ static void csiphy_routing_cfg_3630(struct isp_csiphy *phy,
 	u32 reg;
 	u32 shift, mode;
 
+	printk("routing cfg 3630: iface %d, %d\n", iface, ISP_INTERFACE_CCP2B_PHY1);
+	
 	regmap_read(phy->isp->syscon, phy->isp->syscon_offset, &reg);
 
 	switch (iface) {
@@ -74,6 +76,9 @@ static void csiphy_routing_cfg_3430(struct isp_csiphy *phy, u32 iface, bool on,
 	u32 csirxfe = OMAP343X_CONTROL_CSIRXFE_PWRDNZ
 		| OMAP343X_CONTROL_CSIRXFE_RESET;
 
+	/* FIXME: can this be used instead of if (isp->revision) in ispccp2.c? */
+	
+	printk("routing cfg: iface %d, %d\n", iface, ISP_INTERFACE_CCP2B_PHY1);
 	/* Only the CCP2B on PHY1 is configurable. */
 	if (iface != ISP_INTERFACE_CCP2B_PHY1)
 		return;
@@ -105,6 +110,7 @@ static void csiphy_routing_cfg(struct isp_csiphy *phy,
 			       enum isp_interface_type iface, bool on,
 			       bool ccp2_strobe)
 {
+	printk("csiphy_routing_cfg\n");
 	if (phy->isp->phy_type == ISP_PHY_TYPE_3630 && on)
 		return csiphy_routing_cfg_3630(phy, iface, ccp2_strobe);
 	if (phy->isp->phy_type == ISP_PHY_TYPE_3430)
#78 lore raw

Re: [PATCH] omap3isp: add support for CSI1 bus

Quoted 11 lines · Sebastian Reichel

Hi,

Quoted 3 lines · Pavel Machek

It seems csiphy_routing_cfg_3430 is not called at all. I added printks, but they don't trigger. If you have an idea what is going on there, it would help...

You added printk to csiphy_routing_cfg_3630 instead of csiphy_routing_cfg_3430 and N900 has OMAP3430. Function should be called when you start (or stop) using the camera:

Quoted 5 lines

csiphy_routing_cfg_3430(...) csiphy_routing_cfg(...) omap3isp_csiphy_config(...) omap3isp_csiphy_acquire(...) & omap3isp_csiphy_release(...) ccp2_s_stream(...)

Take another look, I believe I added printk to both of them.

Thanks for the expected backtrace, that should help figuring it out.

Quoted 33 lines

-- Sebastian

Quoted 31 lines
drivers/media/platform/omap3isp/ispcsiphy.c +6 -0
index 6b814e1..fe9303a 100644
@@ -30,6 +30,8 @@ static void csiphy_routing_cfg_3630(struct isp_csiphy *phy,
 	u32 reg;
 	u32 shift, mode;
 
+	printk("routing cfg 3630: iface %d, %d\n", iface, ISP_INTERFACE_CCP2B_PHY1);
+	
 	regmap_read(phy->isp->syscon, phy->isp->syscon_offset, &reg);
 
 	switch (iface) {
@@ -74,6 +76,9 @@ static void csiphy_routing_cfg_3430(struct isp_csiphy *phy, u32 iface, bool on,
 	u32 csirxfe = OMAP343X_CONTROL_CSIRXFE_PWRDNZ
 		| OMAP343X_CONTROL_CSIRXFE_RESET;
 
+	/* FIXME: can this be used instead of if (isp->revision) in ispccp2.c? */
+	
+	printk("routing cfg: iface %d, %d\n", iface, ISP_INTERFACE_CCP2B_PHY1);
 	/* Only the CCP2B on PHY1 is configurable. */
 	if (iface != ISP_INTERFACE_CCP2B_PHY1)
 		return;
@@ -105,6 +110,7 @@ static void csiphy_routing_cfg(struct isp_csiphy *phy,
 			       enum isp_interface_type iface, bool on,
 			       bool ccp2_strobe)
 {
+	printk("csiphy_routing_cfg\n");
 	if (phy->isp->phy_type == ISP_PHY_TYPE_3630 && on)
 		return csiphy_routing_cfg_3630(phy, iface, ccp2_strobe);
 	if (phy->isp->phy_type == ISP_PHY_TYPE_3430)
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Acked-by
#79 lore raw
In reply to Pavel Machek
Quoted 13 lines · Pavel Machek

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.

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.

Quoted 7 lines

Document the CSI1/CCP2 property strobe. It signifies the clock or strobe mode.

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html