Re: [PATCH] devicetree: Add video bus switch

2017-12-22 Thread Pavel Machek
Hi!

> > > I don't really object using g_endpoint_config() as a temporary solution;
> > > I'd like to have Laurent's opinion on that though. Another option is to
> > > wait, but we've already waited a looong time (as in total).
> > 
> > Laurent, do you have some input here? We have simple "2 cameras
> > connected to one signal processor" situation here. We need some way of
> > passing endpoint configuration from the sensors through the switch. I
> > did this:
> 
> Could you give me a bit more information about the platform you're targeting: 
> how the switch is connected, what kind of switch it is, and what endpoint 
> configuration data you need ?

Platform is Nokia N900, Ivaylo already gave pointer to schematics.

Switch is controlled using GPIO, and basically there's CSI
configuration that would normally be in the device tree, but now we
have two CSI configurations to select from...

> > 9) Highly reconfigurable hardware - Julien Beraud
> > 
> > - 44 sub-devices connected with an interconnect.
> > - As long as formats match, any sub-device could be connected to any
> > - other sub-device through a link.
> > - The result is 44 * 44 links at worst.
> > - A switch sub-device proposed as the solution to model the
> > - interconnect. The sub-devices are connected to the switch
> > - sub-devices through the hardware links that connect to the
> > - interconnect.
> > - The switch would be controlled through new IOCTLs S_ROUTING and
> > - G_ROUTING.
> > - Patches available:
> >  http://git.linuxtv.org/cgit.cgi/pinchartl/media.git/log/?h=xilinx-wip
> > 
> > but the patches are from 2005. So I guess I'll need some guidance here...
> 
> You made me feel very old for a moment. The patches are from 2015 :-)

Sorry about that :-).
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


signature.asc
Description: Digital signature


Re: [PATCH] devicetree: Add video bus switch

2017-12-21 Thread Ivaylo Dimitrov

Hi,

On 20.12.2017 19:54, Laurent Pinchart wrote:

Hi Pavel,

On Saturday, 4 February 2017 23:56:10 EET Pavel Machek wrote:

Hi!


+Required properties
+===
+
+compatible : must contain "video-bus-switch"


How generic is this? Should we have e.g. nokia,video-bus-switch? And
if so, change the file name accordingly.


Generic for "single GPIO controls the switch", AFAICT. But that should
be common enough...


Um, yes. Then... how about: video-bus-switch-gpio? No Nokia prefix.


Ok, done. I also fixed the english a bit.


+reg: The interface:
+ 0 - port for image signal processor
+ 1 - port for first camera sensor
+ 2 - port for second camera sensor


I'd say this must be pretty much specific to the one in N900. You
could have more ports. Or you could say that ports beyond 0 are
camera sensors. I guess this is good enough for now though, it can be
changed later on with the source if a need arises.


Well, I'd say that selecting between two sensors is going to be the
common case. If someone needs more than two, it will no longer be
simple GPIO, so we'll have some fixing to do.


It could be two GPIOs --- that's how the GPIO I2C mux works.

But I'd be surprised if someone ever uses something like that
again. ;-)


I'd say.. lets handle that when we see hardware like that.


Btw. was it still considered a problem that the endpoint properties
for the sensors can be different? With the g_routing() pad op which is
to be added, the ISP driver (should actually go to a framework
somewhere) could parse the graph and find the proper endpoint there.


I don't know about g_routing. I added g_endpoint_config method that
passes the configuration, and that seems to work for me.

I don't see g_routing in next-20170201 . Is there place to look?


I think there was a patch by Laurent to LMML quite some time ago. I
suppose that set will be repicked soonish.

I don't really object using g_endpoint_config() as a temporary solution;
I'd like to have Laurent's opinion on that though. Another option is to
wait, but we've already waited a looong time (as in total).


Laurent, do you have some input here? We have simple "2 cameras
connected to one signal processor" situation here. We need some way of
passing endpoint configuration from the sensors through the switch. I
did this:


Could you give me a bit more information about the platform you're targeting:
how the switch is connected, what kind of switch it is, and what endpoint



http://plan9.stanleylieber.com/hardware/n900/n900.schematics.pdf, on 
page 2, see N5801 and N5802.



configuration data you need ?


@@ -415,6 +416,8 @@ struct v4l2_subdev_video_ops {
  const struct v4l2_mbus_config *cfg);
 int (*s_rx_buffer)(struct v4l2_subdev *sd, void *buf,
unsigned int *size);
+   int (*g_endpoint_config)(struct v4l2_subdev *sd,
+   struct v4l2_of_endpoint *cfg);


Google of g_routing tells me:

9) Highly reconfigurable hardware - Julien Beraud

- 44 sub-devices connected with an interconnect.
- As long as formats match, any sub-device could be connected to any
- other sub-device through a link.
- The result is 44 * 44 links at worst.
- A switch sub-device proposed as the solution to model the
- interconnect. The sub-devices are connected to the switch
- sub-devices through the hardware links that connect to the
- interconnect.
- The switch would be controlled through new IOCTLs S_ROUTING and
- G_ROUTING.
- Patches available:
  http://git.linuxtv.org/cgit.cgi/pinchartl/media.git/log/?h=xilinx-wip

but the patches are from 2005. So I guess I'll need some guidance here...


You made me feel very old for a moment. The patches are from 2015 :-)


I'll reply to the other patch containing the code.




Regards,
Ivo


Re: [PATCH] devicetree: Add video bus switch

2017-12-21 Thread Sakari Ailus
On Wed, Dec 20, 2017 at 07:54:12PM +0200, Laurent Pinchart wrote:
> Hi Pavel,
> 
> On Saturday, 4 February 2017 23:56:10 EET Pavel Machek wrote:
> > Hi!
> > 
> >  +Required properties
> >  +===
> >  +
> >  +compatible: must contain "video-bus-switch"
> > >>> 
> > >>> How generic is this? Should we have e.g. nokia,video-bus-switch? And
> > >>> if so, change the file name accordingly.
> > >> 
> > >> Generic for "single GPIO controls the switch", AFAICT. But that should
> > >> be common enough...
> > > 
> > > Um, yes. Then... how about: video-bus-switch-gpio? No Nokia prefix.
> > 
> > Ok, done. I also fixed the english a bit.
> > 
> >  +reg   : The interface:
> >  +0 - port for image signal processor
> >  +1 - port for first camera sensor
> >  +2 - port for second camera sensor
> > >>> 
> > >>> I'd say this must be pretty much specific to the one in N900. You
> > >>> could have more ports. Or you could say that ports beyond 0 are
> > >>> camera sensors. I guess this is good enough for now though, it can be
> > >>> changed later on with the source if a need arises.
> > >> 
> > >> Well, I'd say that selecting between two sensors is going to be the
> > >> common case. If someone needs more than two, it will no longer be
> > >> simple GPIO, so we'll have some fixing to do.
> > > 
> > > It could be two GPIOs --- that's how the GPIO I2C mux works.
> > > 
> > > But I'd be surprised if someone ever uses something like that
> > > again. ;-)
> > 
> > I'd say.. lets handle that when we see hardware like that.
> > 
> > >>> Btw. was it still considered a problem that the endpoint properties
> > >>> for the sensors can be different? With the g_routing() pad op which is
> > >>> to be added, the ISP driver (should actually go to a framework
> > >>> somewhere) could parse the graph and find the proper endpoint there.
> > >> 
> > >> I don't know about g_routing. I added g_endpoint_config method that
> > >> passes the configuration, and that seems to work for me.
> > >> 
> > >> I don't see g_routing in next-20170201 . Is there place to look?
> > > 
> > > I think there was a patch by Laurent to LMML quite some time ago. I
> > > suppose that set will be repicked soonish.
> > > 
> > > I don't really object using g_endpoint_config() as a temporary solution;
> > > I'd like to have Laurent's opinion on that though. Another option is to
> > > wait, but we've already waited a looong time (as in total).
> > 
> > Laurent, do you have some input here? We have simple "2 cameras
> > connected to one signal processor" situation here. We need some way of
> > passing endpoint configuration from the sensors through the switch. I
> > did this:
> 
> Could you give me a bit more information about the platform you're targeting: 
> how the switch is connected, what kind of switch it is, and what endpoint 
> configuration data you need ?
> 
> > >> @@ -415,6 +416,8 @@ struct v4l2_subdev_video_ops {
> > >>  const struct v4l2_mbus_config *cfg);
> > >> int (*s_rx_buffer)(struct v4l2_subdev *sd, void *buf,
> > >>unsigned int *size);
> > >> +   int (*g_endpoint_config)(struct v4l2_subdev *sd,
> > >> +   struct v4l2_of_endpoint *cfg);
> > 
> > Google of g_routing tells me:
> > 
> > 9) Highly reconfigurable hardware - Julien Beraud
> > 
> > - 44 sub-devices connected with an interconnect.
> > - As long as formats match, any sub-device could be connected to any
> > - other sub-device through a link.
> > - The result is 44 * 44 links at worst.
> > - A switch sub-device proposed as the solution to model the
> > - interconnect. The sub-devices are connected to the switch
> > - sub-devices through the hardware links that connect to the
> > - interconnect.
> > - The switch would be controlled through new IOCTLs S_ROUTING and
> > - G_ROUTING.
> > - Patches available:
> >  http://git.linuxtv.org/cgit.cgi/pinchartl/media.git/log/?h=xilinx-wip
> > 
> > but the patches are from 2005. So I guess I'll need some guidance here...
> 
> You made me feel very old for a moment. The patches are from 2015 :-)

There are up-to-date patches here:

https://git.linuxtv.org/sailus/media_tree.git/log/?h=vc>

-- 
Sakari Ailus
e-mail: sakari.ai...@iki.fi


Re: [PATCH] devicetree: Add video bus switch

2017-12-20 Thread Laurent Pinchart
Hi Pavel,

On Saturday, 4 February 2017 23:56:10 EET Pavel Machek wrote:
> Hi!
> 
>  +Required properties
>  +===
>  +
>  +compatible  : must contain "video-bus-switch"
> >>> 
> >>> How generic is this? Should we have e.g. nokia,video-bus-switch? And
> >>> if so, change the file name accordingly.
> >> 
> >> Generic for "single GPIO controls the switch", AFAICT. But that should
> >> be common enough...
> > 
> > Um, yes. Then... how about: video-bus-switch-gpio? No Nokia prefix.
> 
> Ok, done. I also fixed the english a bit.
> 
>  +reg : The interface:
>  +  0 - port for image signal processor
>  +  1 - port for first camera sensor
>  +  2 - port for second camera sensor
> >>> 
> >>> I'd say this must be pretty much specific to the one in N900. You
> >>> could have more ports. Or you could say that ports beyond 0 are
> >>> camera sensors. I guess this is good enough for now though, it can be
> >>> changed later on with the source if a need arises.
> >> 
> >> Well, I'd say that selecting between two sensors is going to be the
> >> common case. If someone needs more than two, it will no longer be
> >> simple GPIO, so we'll have some fixing to do.
> > 
> > It could be two GPIOs --- that's how the GPIO I2C mux works.
> > 
> > But I'd be surprised if someone ever uses something like that
> > again. ;-)
> 
> I'd say.. lets handle that when we see hardware like that.
> 
> >>> Btw. was it still considered a problem that the endpoint properties
> >>> for the sensors can be different? With the g_routing() pad op which is
> >>> to be added, the ISP driver (should actually go to a framework
> >>> somewhere) could parse the graph and find the proper endpoint there.
> >> 
> >> I don't know about g_routing. I added g_endpoint_config method that
> >> passes the configuration, and that seems to work for me.
> >> 
> >> I don't see g_routing in next-20170201 . Is there place to look?
> > 
> > I think there was a patch by Laurent to LMML quite some time ago. I
> > suppose that set will be repicked soonish.
> > 
> > I don't really object using g_endpoint_config() as a temporary solution;
> > I'd like to have Laurent's opinion on that though. Another option is to
> > wait, but we've already waited a looong time (as in total).
> 
> Laurent, do you have some input here? We have simple "2 cameras
> connected to one signal processor" situation here. We need some way of
> passing endpoint configuration from the sensors through the switch. I
> did this:

Could you give me a bit more information about the platform you're targeting: 
how the switch is connected, what kind of switch it is, and what endpoint 
configuration data you need ?

> >> @@ -415,6 +416,8 @@ struct v4l2_subdev_video_ops {
> >>  const struct v4l2_mbus_config *cfg);
> >> int (*s_rx_buffer)(struct v4l2_subdev *sd, void *buf,
> >>unsigned int *size);
> >> +   int (*g_endpoint_config)(struct v4l2_subdev *sd,
> >> +   struct v4l2_of_endpoint *cfg);
> 
> Google of g_routing tells me:
> 
> 9) Highly reconfigurable hardware - Julien Beraud
> 
> - 44 sub-devices connected with an interconnect.
> - As long as formats match, any sub-device could be connected to any
> - other sub-device through a link.
> - The result is 44 * 44 links at worst.
> - A switch sub-device proposed as the solution to model the
> - interconnect. The sub-devices are connected to the switch
> - sub-devices through the hardware links that connect to the
> - interconnect.
> - The switch would be controlled through new IOCTLs S_ROUTING and
> - G_ROUTING.
> - Patches available:
>  http://git.linuxtv.org/cgit.cgi/pinchartl/media.git/log/?h=xilinx-wip
> 
> but the patches are from 2005. So I guess I'll need some guidance here...

You made me feel very old for a moment. The patches are from 2015 :-)

> > I'll reply to the other patch containing the code.

-- 
Regards,

Laurent Pinchart



Re: [PATCH] devicetree: Add video bus switch

2017-03-02 Thread Pavel Machek
On Mon 2017-02-13 12:20:35, Sakari Ailus wrote:
> Hi Pavel,
> 
> On Mon, Feb 13, 2017 at 10:54:20AM +0100, Pavel Machek wrote:
> > Hi!
> > 
> > > > Take a look at the wikipedia. If you do "one at a time" at 100Hz, you
> > > > can claim it is time-domain multiplex. But we are plain switching the
> > > > cameras. It takes second (or so) to setup the pipeline.
> > > > 
> > > > This is not multiplex.
> > > 
> > > The functionality is still the same, isn't it? Does it change what it is 
> > > if
> > > the frequency might be 100 Hz or 0,01 Hz?
> > 
> > Well. In your living your you can have a switch, which is switch at
> > much less than 0.01Hz. You can also have a dimmer, which is a PWM,
> > which is switch at 100Hz or so. So yes, I'd say switch and mux are
> > different things.
> 
> Light switches are mostly on/off switches. It'd be interesting to have a
> light switch that you could use to light either of the light bulbs in a room
> but not to switch both of them on at the same time. Or off... :-)
> 
> I wonder if everyone would be happy with a statement saying that it's a
> on / on switch which is used to implement a multiplexer?

I believe the difference is the timescale. If it switches "slow" it is
a switch. If it switches fast, it is a dimmer, mux, or something

Anyway, someone else was faster, so they get to name their creation...

Pavel

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


signature.asc
Description: Digital signature


Re: [PATCH] devicetree: Add video bus switch

2017-02-13 Thread Sakari Ailus
Hi Pavel,

On Mon, Feb 13, 2017 at 10:54:20AM +0100, Pavel Machek wrote:
> Hi!
> 
> > > Take a look at the wikipedia. If you do "one at a time" at 100Hz, you
> > > can claim it is time-domain multiplex. But we are plain switching the
> > > cameras. It takes second (or so) to setup the pipeline.
> > > 
> > > This is not multiplex.
> > 
> > The functionality is still the same, isn't it? Does it change what it is if
> > the frequency might be 100 Hz or 0,01 Hz?
> 
> Well. In your living your you can have a switch, which is switch at
> much less than 0.01Hz. You can also have a dimmer, which is a PWM,
> which is switch at 100Hz or so. So yes, I'd say switch and mux are
> different things.

Light switches are mostly on/off switches. It'd be interesting to have a
light switch that you could use to light either of the light bulbs in a room
but not to switch both of them on at the same time. Or off... :-)

I wonder if everyone would be happy with a statement saying that it's a
on / on switch which is used to implement a multiplexer?

> 
> > I was a bit annoyed for having to have two drivers for switching the source
> > (one for GPIO, another for syscon / register), where both of the drivers
> > would be essentially the same with the minor exception of having a slightly
> > different means to toggle the mux setting.
> 
> Well, most of the video-bus-switch is the video4linux glue. Actual
> switching is very very small part. So.. where is the other driver?
> Looks like we have the same problem.

It's here, slightly hidden in plain sight in the same patch with the MUX
framework:

https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1328763.html>

> 
> > The MUX framework adds an API for controlling the MUX. Thus we'll need only
> > a single driver that uses the MUX framework API for V4L2. As an added bonus,
> > V4L2 would be in line with the rest of the MUX usage in the kernel.
> > 
> > The set appears to already contain a GPIO MUX. What's needed would be to use
> > the MUX API instead of direct GPIOs usage.
> 
> If there's a driver that already does switching for video4linux
> devices? Do you have a pointer?

I don't think there's one. But with MUX API, we'll be fine using a single
driver instead of two (other one for syscon on iMX).

Cc Steve and Philipp.

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk


Re: [PATCH] devicetree: Add video bus switch

2017-02-13 Thread Pavel Machek
Hi!

> > Take a look at the wikipedia. If you do "one at a time" at 100Hz, you
> > can claim it is time-domain multiplex. But we are plain switching the
> > cameras. It takes second (or so) to setup the pipeline.
> > 
> > This is not multiplex.
> 
> The functionality is still the same, isn't it? Does it change what it is if
> the frequency might be 100 Hz or 0,01 Hz?

Well. In your living your you can have a switch, which is switch at
much less than 0.01Hz. You can also have a dimmer, which is a PWM,
which is switch at 100Hz or so. So yes, I'd say switch and mux are
different things.

> I was a bit annoyed for having to have two drivers for switching the source
> (one for GPIO, another for syscon / register), where both of the drivers
> would be essentially the same with the minor exception of having a slightly
> different means to toggle the mux setting.

Well, most of the video-bus-switch is the video4linux glue. Actual
switching is very very small part. So.. where is the other driver?
Looks like we have the same problem.

> The MUX framework adds an API for controlling the MUX. Thus we'll need only
> a single driver that uses the MUX framework API for V4L2. As an added bonus,
> V4L2 would be in line with the rest of the MUX usage in the kernel.
> 
> The set appears to already contain a GPIO MUX. What's needed would be to use
> the MUX API instead of direct GPIOs usage.

If there's a driver that already does switching for video4linux
devices? Do you have a pointer?

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


signature.asc
Description: Digital signature


Re: [PATCH] devicetree: Add video bus switch

2017-02-10 Thread Sakari Ailus
Hi Pavel,

On Fri, Feb 10, 2017 at 08:54:35PM +0100, Pavel Machek wrote:
> 
> > >>> > diff --git 
> > >>> > a/Documentation/devicetree/bindings/media/video-bus-switch.txt 
> > >>> > b/Documentation/devicetree/bindings/media/video-bus-switch.txt
> > >>> > new file mode 100644
> > >>> > index 000..1b9f8e0
> > >>> > --- /dev/null
> > >>> > +++ b/Documentation/devicetree/bindings/media/video-bus-switch.txt
> > >>> > @@ -0,0 +1,63 @@
> > >>> > +Video Bus Switch Binding
> > >>> > +
> > >>>
> > >>> I'd call it a mux rather than switch.
> > >>
> > >> It is a switch, not a multiplexor (
> > >> https://en.wikipedia.org/wiki/Multiplexing ). Only one camera can
> > >> operate at a time.
> > >
> > > It's no different than an i2c mux. It's one at a time.
> 
> Take a look at the wikipedia. If you do "one at a time" at 100Hz, you
> can claim it is time-domain multiplex. But we are plain switching the
> cameras. It takes second (or so) to setup the pipeline.
> 
> This is not multiplex.

The functionality is still the same, isn't it? Does it change what it is if
the frequency might be 100 Hz or 0,01 Hz?

I was a bit annoyed for having to have two drivers for switching the source
(one for GPIO, another for syscon / register), where both of the drivers
would be essentially the same with the minor exception of having a slightly
different means to toggle the mux setting.

The MUX framework adds an API for controlling the MUX. Thus we'll need only
a single driver that uses the MUX framework API for V4L2. As an added bonus,
V4L2 would be in line with the rest of the MUX usage in the kernel.

The set appears to already contain a GPIO MUX. What's needed would be to use
the MUX API instead of direct GPIOs usage.

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] devicetree: Add video bus switch

2017-02-10 Thread Pavel Machek
On Thu 2017-02-09 16:58:29, Rob Herring wrote:
> On Wed, Feb 8, 2017 at 4:34 PM, Pavel Machek  wrote:
> >> > +
> >> > +This is a binding for a gpio controlled switch for camera interfaces. 
> >> > Such a
> >> > +device is used on some embedded devices to connect two cameras to the 
> >> > same
> >> > +interface of a image signal processor.
> >> > +
> >> > +Required properties
> >> > +===
> >> > +
> >> > +compatible : must contain "video-bus-switch"
> >>
> >> video-bus-gpio-mux
> >
> > Sakari already asked for rename here. I believe I waited reasonable
> > time, but got no input from you, so I did rename it. Now you decide on
> > different name.
> >
> > Can we either get timely reactions or less bikeshedding?
> 
> You mean less than 5 days because I don't see any other version of
> this? But in short, no, you can't.

Could we switch device tree bindings from "cc: subsystem, to: device
tree" to "to: subsystem, cc: device tree" mode? Currently it takes
more effort to merge the device tree parts than the relevant driver,
and that is not quite good.

Best regards,
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


signature.asc
Description: Digital signature


Re: [PATCH] devicetree: Add video bus switch

2017-02-10 Thread Pavel Machek

> >>> > diff --git 
> >>> > a/Documentation/devicetree/bindings/media/video-bus-switch.txt 
> >>> > b/Documentation/devicetree/bindings/media/video-bus-switch.txt
> >>> > new file mode 100644
> >>> > index 000..1b9f8e0
> >>> > --- /dev/null
> >>> > +++ b/Documentation/devicetree/bindings/media/video-bus-switch.txt
> >>> > @@ -0,0 +1,63 @@
> >>> > +Video Bus Switch Binding
> >>> > +
> >>>
> >>> I'd call it a mux rather than switch.
> >>
> >> It is a switch, not a multiplexor (
> >> https://en.wikipedia.org/wiki/Multiplexing ). Only one camera can
> >> operate at a time.
> >
> > It's no different than an i2c mux. It's one at a time.

Take a look at the wikipedia. If you do "one at a time" at 100Hz, you
can claim it is time-domain multiplex. But we are plain switching the
cameras. It takes second (or so) to setup the pipeline.

This is not multiplex.

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


signature.asc
Description: Digital signature


Re: [PATCH] devicetree: Add video bus switch

2017-02-09 Thread Rob Herring
On Wed, Feb 8, 2017 at 4:34 PM, Pavel Machek  wrote:
>> > +
>> > +This is a binding for a gpio controlled switch for camera interfaces. 
>> > Such a
>> > +device is used on some embedded devices to connect two cameras to the same
>> > +interface of a image signal processor.
>> > +
>> > +Required properties
>> > +===
>> > +
>> > +compatible : must contain "video-bus-switch"
>>
>> video-bus-gpio-mux
>
> Sakari already asked for rename here. I believe I waited reasonable
> time, but got no input from you, so I did rename it. Now you decide on
> different name.
>
> Can we either get timely reactions or less bikeshedding?

You mean less than 5 days because I don't see any other version of
this? But in short, no, you can't.

Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] devicetree: Add video bus switch

2017-02-09 Thread Rob Herring
On Wed, Feb 8, 2017 at 4:30 PM, Pavel Machek  wrote:
> On Wed 2017-02-08 15:36:09, Rob Herring wrote:
>> On Fri, Feb 03, 2017 at 01:35:08PM +0100, Pavel Machek wrote:
>> >
>> > N900 contains front and back camera, with a switch between the
>> > two. This adds support for the switch component, and it is now
>> > possible to select between front and back cameras during runtime.
>> >
>> > This adds documentation for the devicetree binding.
>> >
>> > Signed-off-by: Sebastian Reichel 
>> > Signed-off-by: Ivaylo Dimitrov 
>> > Signed-off-by: Pavel Machek 
>> >
>> >
>> > diff --git a/Documentation/devicetree/bindings/media/video-bus-switch.txt 
>> > b/Documentation/devicetree/bindings/media/video-bus-switch.txt
>> > new file mode 100644
>> > index 000..1b9f8e0
>> > --- /dev/null
>> > +++ b/Documentation/devicetree/bindings/media/video-bus-switch.txt
>> > @@ -0,0 +1,63 @@
>> > +Video Bus Switch Binding
>> > +
>>
>> I'd call it a mux rather than switch.
>
> It is a switch, not a multiplexor (
> https://en.wikipedia.org/wiki/Multiplexing ). Only one camera can
> operate at a time.

It's no different than an i2c mux. It's one at a time.

>
>> BTW, there's a new mux-controller binding under review you might look
>> at. It would only be needed here if the mux ctrl also controls other
>> things.
>
> Do you have a pointer?

Let me Google that for you:

>
>> > +Required Port nodes
>> > +===
>> > +
>> > +More documentation on these bindings is available in
>> > +video-interfaces.txt in the same directory.
>> > +
>> > +reg: The interface:
>> > + 0 - port for image signal processor
>> > + 1 - port for first camera sensor
>> > + 2 - port for second camera sensor
>>
>> This could be used for display side as well. So describe these just as
>> inputs and outputs.
>
> I'd prefer not to confuse people. I guess that would be 0 -- output
> port, 1, 2 -- input ports... But this is media data, are you sure it
> is good idea to change this?

And I'd prefer something that can be reused by others.

>
> Pavel
> --
> (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 linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] devicetree: Add video bus switch

2017-02-09 Thread Rob Herring
On Thu, Feb 9, 2017 at 5:02 PM, Rob Herring  wrote:
> On Wed, Feb 8, 2017 at 4:30 PM, Pavel Machek  wrote:
>> On Wed 2017-02-08 15:36:09, Rob Herring wrote:
>>> On Fri, Feb 03, 2017 at 01:35:08PM +0100, Pavel Machek wrote:
>>> >
>>> > N900 contains front and back camera, with a switch between the
>>> > two. This adds support for the switch component, and it is now
>>> > possible to select between front and back cameras during runtime.
>>> >
>>> > This adds documentation for the devicetree binding.
>>> >
>>> > Signed-off-by: Sebastian Reichel 
>>> > Signed-off-by: Ivaylo Dimitrov 
>>> > Signed-off-by: Pavel Machek 
>>> >
>>> >
>>> > diff --git a/Documentation/devicetree/bindings/media/video-bus-switch.txt 
>>> > b/Documentation/devicetree/bindings/media/video-bus-switch.txt
>>> > new file mode 100644
>>> > index 000..1b9f8e0
>>> > --- /dev/null
>>> > +++ b/Documentation/devicetree/bindings/media/video-bus-switch.txt
>>> > @@ -0,0 +1,63 @@
>>> > +Video Bus Switch Binding
>>> > +
>>>
>>> I'd call it a mux rather than switch.
>>
>> It is a switch, not a multiplexor (
>> https://en.wikipedia.org/wiki/Multiplexing ). Only one camera can
>> operate at a time.
>
> It's no different than an i2c mux. It's one at a time.
>
>>
>>> BTW, there's a new mux-controller binding under review you might look
>>> at. It would only be needed here if the mux ctrl also controls other
>>> things.
>>
>> Do you have a pointer?
>
> Let me Google that for you:

https://lwn.net/Articles/713971/

>
>>
>>> > +Required Port nodes
>>> > +===
>>> > +
>>> > +More documentation on these bindings is available in
>>> > +video-interfaces.txt in the same directory.
>>> > +
>>> > +reg: The interface:
>>> > + 0 - port for image signal processor
>>> > + 1 - port for first camera sensor
>>> > + 2 - port for second camera sensor
>>>
>>> This could be used for display side as well. So describe these just as
>>> inputs and outputs.
>>
>> I'd prefer not to confuse people. I guess that would be 0 -- output
>> port, 1, 2 -- input ports... But this is media data, are you sure it
>> is good idea to change this?
>
> And I'd prefer something that can be reused by others.
>
>>
>> Pavel
>> --
>> (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 linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] devicetree: Add video bus switch

2017-02-08 Thread Pavel Machek
> > +
> > +This is a binding for a gpio controlled switch for camera interfaces. Such 
> > a
> > +device is used on some embedded devices to connect two cameras to the same
> > +interface of a image signal processor.
> > +
> > +Required properties
> > +===
> > +
> > +compatible : must contain "video-bus-switch"
> 
> video-bus-gpio-mux

Sakari already asked for rename here. I believe I waited reasonable
time, but got no input from you, so I did rename it. Now you decide on
different name.

Can we either get timely reactions or less bikeshedding?

Thanks,

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


signature.asc
Description: Digital signature


Re: [PATCH] devicetree: Add video bus switch

2017-02-08 Thread Pavel Machek
On Wed 2017-02-08 15:36:09, Rob Herring wrote:
> On Fri, Feb 03, 2017 at 01:35:08PM +0100, Pavel Machek wrote:
> > 
> > N900 contains front and back camera, with a switch between the
> > two. This adds support for the switch component, and it is now
> > possible to select between front and back cameras during runtime.
> > 
> > This adds documentation for the devicetree binding.
> > 
> > Signed-off-by: Sebastian Reichel 
> > Signed-off-by: Ivaylo Dimitrov 
> > Signed-off-by: Pavel Machek 
> > 
> > 
> > diff --git a/Documentation/devicetree/bindings/media/video-bus-switch.txt 
> > b/Documentation/devicetree/bindings/media/video-bus-switch.txt
> > new file mode 100644
> > index 000..1b9f8e0
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/media/video-bus-switch.txt
> > @@ -0,0 +1,63 @@
> > +Video Bus Switch Binding
> > +
> 
> I'd call it a mux rather than switch.

It is a switch, not a multiplexor (
https://en.wikipedia.org/wiki/Multiplexing ). Only one camera can
operate at a time.

> BTW, there's a new mux-controller binding under review you might look 
> at. It would only be needed here if the mux ctrl also controls other 
> things.

Do you have a pointer?

> > +Required Port nodes
> > +===
> > +
> > +More documentation on these bindings is available in
> > +video-interfaces.txt in the same directory.
> > +
> > +reg: The interface:
> > + 0 - port for image signal processor
> > + 1 - port for first camera sensor
> > + 2 - port for second camera sensor
> 
> This could be used for display side as well. So describe these just as 
> inputs and outputs.

I'd prefer not to confuse people. I guess that would be 0 -- output
port, 1, 2 -- input ports... But this is media data, are you sure it
is good idea to change this?

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


signature.asc
Description: Digital signature


Re: [PATCH] devicetree: Add video bus switch

2017-02-08 Thread Rob Herring
On Fri, Feb 03, 2017 at 01:35:08PM +0100, Pavel Machek wrote:
> 
> N900 contains front and back camera, with a switch between the
> two. This adds support for the switch component, and it is now
> possible to select between front and back cameras during runtime.
> 
> This adds documentation for the devicetree binding.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Ivaylo Dimitrov 
> Signed-off-by: Pavel Machek 
> 
> 
> diff --git a/Documentation/devicetree/bindings/media/video-bus-switch.txt 
> b/Documentation/devicetree/bindings/media/video-bus-switch.txt
> new file mode 100644
> index 000..1b9f8e0
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/video-bus-switch.txt
> @@ -0,0 +1,63 @@
> +Video Bus Switch Binding
> +

I'd call it a mux rather than switch.

BTW, there's a new mux-controller binding under review you might look 
at. It would only be needed here if the mux ctrl also controls other 
things.

> +
> +This is a binding for a gpio controlled switch for camera interfaces. Such a
> +device is used on some embedded devices to connect two cameras to the same
> +interface of a image signal processor.
> +
> +Required properties
> +===
> +
> +compatible   : must contain "video-bus-switch"

video-bus-gpio-mux

> +switch-gpios : GPIO specifier for the gpio, which can toggle the

mux-gpios to align with existing GPIO controlled muxes.

> +   selected camera. The GPIO should be configured, so
> +   that a disabled GPIO means, that the first port is
> +   selected.
> +
> +Required Port nodes
> +===
> +
> +More documentation on these bindings is available in
> +video-interfaces.txt in the same directory.
> +
> +reg  : The interface:
> +   0 - port for image signal processor
> +   1 - port for first camera sensor
> +   2 - port for second camera sensor

This could be used for display side as well. So describe these just as 
inputs and outputs.

Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] devicetree: Add video bus switch

2017-02-05 Thread Sebastian Reichel
Hi,

On Sun, Feb 05, 2017 at 10:12:20PM +0100, Pavel Machek wrote:
> > > 9) Highly reconfigurable hardware - Julien Beraud
> > > 
> > > - 44 sub-devices connected with an interconnect.
> > > - As long as formats match, any sub-device could be connected to any
> > > - other sub-device through a link.
> > > - The result is 44 * 44 links at worst.
> > > - A switch sub-device proposed as the solution to model the
> > > - interconnect. The sub-devices are connected to the switch
> > > - sub-devices through the hardware links that connect to the
> > > - interconnect.
> > > - The switch would be controlled through new IOCTLs S_ROUTING and
> > > - G_ROUTING.
> > > - Patches available:
> > >  http://git.linuxtv.org/cgit.cgi/pinchartl/media.git/log/?h=xilinx-wip
> > > 
> > > but the patches are from 2005. So I guess I'll need some guidance here...
> > 
> > Yeah, that's where it began (2015?), but right now I can only suggest to
> > wait until there's more. My estimate is within next couple of weeks /
> > months. But it won't be years.
> 
> Ok, week or two would be ok, couple of months is not. And all I need
> is single hook in common structure.
> 
> So if g_endpoint_config hook looks sane to _you_, I suggest we simply
> proceed. Now, maybe Mauro Carvalho Chehab 
> or Laurent or Julien will want a different solution, but
> then... they'll have to suggest something doable now, not in couple of
> months.
> 
> Does that sound like a plan?
> 
> Mauro added to cc list, so we can get some input.

side note: It's an kernel-internal API only used by the media
subsystem. Code can be easily updated to use an improved API
at any time.

-- Sebastian


signature.asc
Description: PGP signature


Re: [PATCH] devicetree: Add video bus switch

2017-02-05 Thread Pavel Machek
Hi!

> > 9) Highly reconfigurable hardware - Julien Beraud
> > 
> > - 44 sub-devices connected with an interconnect.
> > - As long as formats match, any sub-device could be connected to any
> > - other sub-device through a link.
> > - The result is 44 * 44 links at worst.
> > - A switch sub-device proposed as the solution to model the
> > - interconnect. The sub-devices are connected to the switch
> > - sub-devices through the hardware links that connect to the
> > - interconnect.
> > - The switch would be controlled through new IOCTLs S_ROUTING and
> > - G_ROUTING.
> > - Patches available:
> >  http://git.linuxtv.org/cgit.cgi/pinchartl/media.git/log/?h=xilinx-wip
> > 
> > but the patches are from 2005. So I guess I'll need some guidance here...
> 
> Yeah, that's where it began (2015?), but right now I can only suggest to
> wait until there's more. My estimate is within next couple of weeks /
> months. But it won't be years.

Ok, week or two would be ok, couple of months is not. And all I need
is single hook in common structure.

So if g_endpoint_config hook looks sane to _you_, I suggest we simply
proceed. Now, maybe Mauro Carvalho Chehab 
or Laurent or Julien will want a different solution, but
then... they'll have to suggest something doable now, not in couple of
months.

Does that sound like a plan?

Mauro added to cc list, so we can get some input.

Best regards,
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


signature.asc
Description: Digital signature


Re: [PATCH] devicetree: Add video bus switch

2017-02-04 Thread Sakari Ailus
Hi Pavel,

On Sat, Feb 04, 2017 at 10:56:10PM +0100, Pavel Machek wrote:
> Hi!
> 
> > > > > +Required properties
> > > > > +===
> > > > > +
> > > > > +compatible   : must contain "video-bus-switch"
> > > > 
> > > > How generic is this? Should we have e.g. nokia,video-bus-switch? And if 
> > > > so,
> > > > change the file name accordingly.
> > > 
> > > Generic for "single GPIO controls the switch", AFAICT. But that should
> > > be common enough...
> > 
> > Um, yes. Then... how about: video-bus-switch-gpio? No Nokia prefix.
> 
> Ok, done. I also fixed the english a bit.
> 
> > > > > +reg  : The interface:
> > > > > +   0 - port for image signal processor
> > > > > +   1 - port for first camera sensor
> > > > > +   2 - port for second camera sensor
> > > > 
> > > > I'd say this must be pretty much specific to the one in N900. You could 
> > > > have
> > > > more ports. Or you could say that ports beyond 0 are camera sensors. I 
> > > > guess
> > > > this is good enough for now though, it can be changed later on with the
> > > > source if a need arises.
> > > 
> > > Well, I'd say that selecting between two sensors is going to be the
> > > common case. If someone needs more than two, it will no longer be
> > > simple GPIO, so we'll have some fixing to do.
> > 
> > It could be two GPIOs --- that's how the GPIO I2C mux works.
> > 
> > But I'd be surprised if someone ever uses something like that
> > again. ;-)
> 
> I'd say.. lets handle that when we see hardware like that.

Yes. :-)

> 
> > > > Btw. was it still considered a problem that the endpoint properties for 
> > > > the
> > > > sensors can be different? With the g_routing() pad op which is to be 
> > > > added,
> > > > the ISP driver (should actually go to a framework somewhere) could 
> > > > parse the
> > > > graph and find the proper endpoint there.
> > > 
> > > I don't know about g_routing. I added g_endpoint_config method that
> > > passes the configuration, and that seems to work for me.
> > > 
> > > I don't see g_routing in next-20170201 . Is there place to look?
> > 
> > I think there was a patch by Laurent to LMML quite some time ago. I suppose
> > that set will be repicked soonish.
> > 
> > I don't really object using g_endpoint_config() as a temporary solution; I'd
> > like to have Laurent's opinion on that though. Another option is to wait,
> > but we've already waited a looong time (as in total).
> 
> Laurent, do you have some input here? We have simple "2 cameras
> connected to one signal processor" situation here. We need some way of
> passing endpoint configuration from the sensors through the switch. I
> did this:
> 
> > > @@ -415,6 +416,8 @@ struct v4l2_subdev_video_ops {
> > >  const struct v4l2_mbus_config *cfg);
> > > int (*s_rx_buffer)(struct v4l2_subdev *sd, void *buf,
> > >unsigned int *size);
> > > +   int (*g_endpoint_config)(struct v4l2_subdev *sd,
> > > +   struct v4l2_of_endpoint *cfg);
> 
> Google of g_routing tells me:
> 
> 9) Highly reconfigurable hardware - Julien Beraud
> 
> - 44 sub-devices connected with an interconnect.
> - As long as formats match, any sub-device could be connected to any
> - other sub-device through a link.
> - The result is 44 * 44 links at worst.
> - A switch sub-device proposed as the solution to model the
> - interconnect. The sub-devices are connected to the switch
> - sub-devices through the hardware links that connect to the
> - interconnect.
> - The switch would be controlled through new IOCTLs S_ROUTING and
> - G_ROUTING.
> - Patches available:
>  http://git.linuxtv.org/cgit.cgi/pinchartl/media.git/log/?h=xilinx-wip
> 
> but the patches are from 2005. So I guess I'll need some guidance here...

Yeah, that's where it began (2015?), but right now I can only suggest to
wait until there's more. My estimate is within next couple of weeks /
months. But it won't be years.

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] devicetree: Add video bus switch

2017-02-04 Thread Pavel Machek
Hi!

> > > > +Required properties
> > > > +===
> > > > +
> > > > +compatible : must contain "video-bus-switch"
> > > 
> > > How generic is this? Should we have e.g. nokia,video-bus-switch? And if 
> > > so,
> > > change the file name accordingly.
> > 
> > Generic for "single GPIO controls the switch", AFAICT. But that should
> > be common enough...
> 
> Um, yes. Then... how about: video-bus-switch-gpio? No Nokia prefix.

Ok, done. I also fixed the english a bit.

> > > > +reg: The interface:
> > > > + 0 - port for image signal processor
> > > > + 1 - port for first camera sensor
> > > > + 2 - port for second camera sensor
> > > 
> > > I'd say this must be pretty much specific to the one in N900. You could 
> > > have
> > > more ports. Or you could say that ports beyond 0 are camera sensors. I 
> > > guess
> > > this is good enough for now though, it can be changed later on with the
> > > source if a need arises.
> > 
> > Well, I'd say that selecting between two sensors is going to be the
> > common case. If someone needs more than two, it will no longer be
> > simple GPIO, so we'll have some fixing to do.
> 
> It could be two GPIOs --- that's how the GPIO I2C mux works.
> 
> But I'd be surprised if someone ever uses something like that
> again. ;-)

I'd say.. lets handle that when we see hardware like that.

> > > Btw. was it still considered a problem that the endpoint properties for 
> > > the
> > > sensors can be different? With the g_routing() pad op which is to be 
> > > added,
> > > the ISP driver (should actually go to a framework somewhere) could parse 
> > > the
> > > graph and find the proper endpoint there.
> > 
> > I don't know about g_routing. I added g_endpoint_config method that
> > passes the configuration, and that seems to work for me.
> > 
> > I don't see g_routing in next-20170201 . Is there place to look?
> 
> I think there was a patch by Laurent to LMML quite some time ago. I suppose
> that set will be repicked soonish.
> 
> I don't really object using g_endpoint_config() as a temporary solution; I'd
> like to have Laurent's opinion on that though. Another option is to wait,
> but we've already waited a looong time (as in total).

Laurent, do you have some input here? We have simple "2 cameras
connected to one signal processor" situation here. We need some way of
passing endpoint configuration from the sensors through the switch. I
did this:

> > @@ -415,6 +416,8 @@ struct v4l2_subdev_video_ops {
> >  const struct v4l2_mbus_config *cfg);
> > int (*s_rx_buffer)(struct v4l2_subdev *sd, void *buf,
> >unsigned int *size);
> > +   int (*g_endpoint_config)(struct v4l2_subdev *sd,
> > +   struct v4l2_of_endpoint *cfg);

Google of g_routing tells me:

9) Highly reconfigurable hardware - Julien Beraud

- 44 sub-devices connected with an interconnect.
- As long as formats match, any sub-device could be connected to any
- other sub-device through a link.
- The result is 44 * 44 links at worst.
- A switch sub-device proposed as the solution to model the
- interconnect. The sub-devices are connected to the switch
- sub-devices through the hardware links that connect to the
- interconnect.
- The switch would be controlled through new IOCTLs S_ROUTING and
- G_ROUTING.
- Patches available:
 http://git.linuxtv.org/cgit.cgi/pinchartl/media.git/log/?h=xilinx-wip

but the patches are from 2005. So I guess I'll need some guidance here...

> I'll reply to the other patch containing the code.

Ok, thanks.
Pavel

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


signature.asc
Description: Digital signature


Re: [PATCH] devicetree: Add video bus switch

2017-02-03 Thread Sebastian Reichel
Hi,

On Fri, Feb 03, 2017 at 10:07:28PM +0100, Pavel Machek wrote:
> On Fri 2017-02-03 14:32:19, Pali Rohár wrote:
> > On Friday 03 February 2017 13:35:08 Pavel Machek wrote:
> > > N900 contains front and back camera, with a switch between the
> > > two. This adds support for the switch component, and it is now
> > > possible to select between front and back cameras during runtime.
> > 
> > IIRC for controlling cameras on N900 there are two GPIOs. Should
> > not you have both in switch driver?
>
> I guess you recall wrongly :-). Switch seems to work. The issue was
> with switch GPIO also serving as reset GPIO for one sensor, or
> something like that, if _I_ recall correctly ;-).

I have a schematic in my master thesis, which shows how the camera
sensors are connected to the SoC. The PDF is available here:

https://www.uni-oldenburg.de/fileadmin/user_upload/informatik/ag/svs/download/thesis/Reichel_Sebastian.pdf

The schematic is on page 37 (or 45 if your PDF reader does not
use different numbers for the preamble stuff).

--Sebastian


signature.asc
Description: PGP signature


Re: [PATCH] devicetree: Add video bus switch

2017-02-03 Thread Sakari Ailus
Hi Pavel,

On Fri, Feb 03, 2017 at 10:06:10PM +0100, Pavel Machek wrote:
> Hi!
> 
> > My apologies for the delays in reviewing. Feel free to ping me in the future
> > if this happens. :-)
> 
> No problem :-). If you could review the C-code, too... that would be
> nice. It should be in your inbox somewhere (and I attached it below,
> without the dts part).
> 
> 
> > > +Required properties
> > > +===
> > > +
> > > +compatible   : must contain "video-bus-switch"
> > 
> > How generic is this? Should we have e.g. nokia,video-bus-switch? And if so,
> > change the file name accordingly.
> 
> Generic for "single GPIO controls the switch", AFAICT. But that should
> be common enough...

Um, yes. Then... how about: video-bus-switch-gpio? No Nokia prefix.

> 
> > > +reg  : The interface:
> > > +   0 - port for image signal processor
> > > +   1 - port for first camera sensor
> > > +   2 - port for second camera sensor
> > 
> > I'd say this must be pretty much specific to the one in N900. You could have
> > more ports. Or you could say that ports beyond 0 are camera sensors. I guess
> > this is good enough for now though, it can be changed later on with the
> > source if a need arises.
> 
> Well, I'd say that selecting between two sensors is going to be the
> common case. If someone needs more than two, it will no longer be
> simple GPIO, so we'll have some fixing to do.

It could be two GPIOs --- that's how the GPIO I2C mux works.

But I'd be surprised if someone ever uses something like that again. ;-)

> 
> > Btw. was it still considered a problem that the endpoint properties for the
> > sensors can be different? With the g_routing() pad op which is to be added,
> > the ISP driver (should actually go to a framework somewhere) could parse the
> > graph and find the proper endpoint there.
> 
> I don't know about g_routing. I added g_endpoint_config method that
> passes the configuration, and that seems to work for me.
> 
> I don't see g_routing in next-20170201 . Is there place to look?

I think there was a patch by Laurent to LMML quite some time ago. I suppose
that set will be repicked soonish.

I don't really object using g_endpoint_config() as a temporary solution; I'd
like to have Laurent's opinion on that though. Another option is to wait,
but we've already waited a looong time (as in total).

I'll reply to the other patch containing the code.

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] devicetree: Add video bus switch

2017-02-03 Thread Pavel Machek
On Fri 2017-02-03 14:32:19, Pali Rohár wrote:
> On Friday 03 February 2017 13:35:08 Pavel Machek wrote:
> > N900 contains front and back camera, with a switch between the
> > two. This adds support for the switch component, and it is now
> > possible to select between front and back cameras during runtime.
> 
> IIRC for controlling cameras on N900 there are two GPIOs. Should not you
> have both in switch driver?

I guess you recall wrongly :-). Switch seems to work. The issue was
with switch GPIO also serving as reset GPIO for one sensor, or
something like that, if _I_ recall correctly ;-).

Best regards,
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


signature.asc
Description: Digital signature


Re: [PATCH] devicetree: Add video bus switch

2017-02-03 Thread Pavel Machek
Hi!

> My apologies for the delays in reviewing. Feel free to ping me in the future
> if this happens. :-)

No problem :-). If you could review the C-code, too... that would be
nice. It should be in your inbox somewhere (and I attached it below,
without the dts part).


> > +Required properties
> > +===
> > +
> > +compatible : must contain "video-bus-switch"
> 
> How generic is this? Should we have e.g. nokia,video-bus-switch? And if so,
> change the file name accordingly.

Generic for "single GPIO controls the switch", AFAICT. But that should
be common enough...

> > +reg: The interface:
> > + 0 - port for image signal processor
> > + 1 - port for first camera sensor
> > + 2 - port for second camera sensor
> 
> I'd say this must be pretty much specific to the one in N900. You could have
> more ports. Or you could say that ports beyond 0 are camera sensors. I guess
> this is good enough for now though, it can be changed later on with the
> source if a need arises.

Well, I'd say that selecting between two sensors is going to be the
common case. If someone needs more than two, it will no longer be
simple GPIO, so we'll have some fixing to do.

> Btw. was it still considered a problem that the endpoint properties for the
> sensors can be different? With the g_routing() pad op which is to be added,
> the ISP driver (should actually go to a framework somewhere) could parse the
> graph and find the proper endpoint there.

I don't know about g_routing. I added g_endpoint_config method that
passes the configuration, and that seems to work for me.

I don't see g_routing in next-20170201 . Is there place to look?

Best regards,
Pavel

---

N900 contains front and back camera, with a switch between the
two. This adds support for the switch component, and it is now
possible to select between front and back cameras during runtime.

Signed-off-by: Sebastian Reichel 
Signed-off-by: Ivaylo Dimitrov 
Signed-off-by: Pavel Machek 


diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index ce4a96f..a4b509e 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -91,6 +91,16 @@ config VIDEO_OMAP3_DEBUG
---help---
  Enable debug messages on OMAP 3 camera controller driver.
 
+config VIDEO_BUS_SWITCH
+   tristate "Video Bus switch"
+   depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
+   depends on MEDIA_CONTROLLER
+   depends on OF
+   ---help---
+ Driver for a GPIO controlled video bus switch, which is used to
+ connect two camera sensors to the same port a the image signal
+ processor.
+
 config VIDEO_PXA27x
tristate "PXA27x Quick Capture Interface driver"
depends on VIDEO_DEV && HAS_DMA
diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile
index 40b18d1..8eafc27 100644
--- a/drivers/media/platform/Makefile
+++ b/drivers/media/platform/Makefile
@@ -11,6 +11,8 @@ obj-$(CONFIG_VIDEO_MMP_CAMERA) += marvell-ccic/
 obj-$(CONFIG_VIDEO_OMAP3)  += omap3isp/
 obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o
 
+obj-$(CONFIG_VIDEO_BUS_SWITCH) += video-bus-switch.o
+
 obj-$(CONFIG_VIDEO_VIU) += fsl-viu.o
 
 obj-$(CONFIG_VIDEO_VIVID)  += vivid/
diff --git a/drivers/media/platform/video-bus-switch.c 
b/drivers/media/platform/video-bus-switch.c
new file mode 100644
index 000..6400cfc
--- /dev/null
+++ b/drivers/media/platform/video-bus-switch.c
@@ -0,0 +1,387 @@
+/*
+ * Generic driver for video bus switches
+ *
+ * Copyright (C) 2015 Sebastian Reichel 
+ * Copyright (C) 2016 Pavel Machek 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#define DEBUG
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * TODO:
+ * isp_subdev_notifier_complete() calls v4l2_device_register_subdev_nodes()
+ */
+
+#define CSI_SWITCH_SUBDEVS 2
+#define CSI_SWITCH_PORTS 3
+
+enum vbs_state {
+   CSI_SWITCH_DISABLED = 0,
+   CSI_SWITCH_PORT_1 = 1,
+   CSI_SWITCH_PORT_2 = 2,
+};
+
+struct vbs_src_pads {
+   struct media_entity *src;
+   int src_pad;
+};
+
+struct vbs_data {
+   struct gpio_desc *swgpio;
+   struct v4l2_subdev subdev;
+   struct v4l2_async_notifier notifier;
+   struct media_pad pads[CSI_SWITCH_PORTS];
+   struct vbs_src_pads src_pads[CSI_SWITCH_PORTS];
+   struct v4l2_of_endpoint vep[CSI_SWITCH_PORTS];
+   enum vbs_state state;
+};
+
+struct vbs_async_subdev {

Re: [PATCH] devicetree: Add video bus switch

2017-02-03 Thread Pali Rohár
On Friday 03 February 2017 13:35:08 Pavel Machek wrote:
> N900 contains front and back camera, with a switch between the
> two. This adds support for the switch component, and it is now
> possible to select between front and back cameras during runtime.

IIRC for controlling cameras on N900 there are two GPIOs. Should not you
have both in switch driver?

-- 
Pali Rohár
pali.ro...@gmail.com
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] devicetree: Add video bus switch

2017-02-03 Thread Sakari Ailus
Hi Pavel,

My apologies for the delays in reviewing. Feel free to ping me in the future
if this happens. :-)

On Fri, Feb 03, 2017 at 01:35:08PM +0100, Pavel Machek wrote:
> 
> N900 contains front and back camera, with a switch between the
> two. This adds support for the switch component, and it is now
> possible to select between front and back cameras during runtime.
> 
> This adds documentation for the devicetree binding.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Ivaylo Dimitrov 
> Signed-off-by: Pavel Machek 
> 
> 
> diff --git a/Documentation/devicetree/bindings/media/video-bus-switch.txt 
> b/Documentation/devicetree/bindings/media/video-bus-switch.txt
> new file mode 100644
> index 000..1b9f8e0
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/video-bus-switch.txt
> @@ -0,0 +1,63 @@
> +Video Bus Switch Binding
> +
> +
> +This is a binding for a gpio controlled switch for camera interfaces. Such a
> +device is used on some embedded devices to connect two cameras to the same
> +interface of a image signal processor.
> +
> +Required properties
> +===
> +
> +compatible   : must contain "video-bus-switch"

How generic is this? Should we have e.g. nokia,video-bus-switch? And if so,
change the file name accordingly.

> +switch-gpios : GPIO specifier for the gpio, which can toggle the
> +   selected camera. The GPIO should be configured, so
> +   that a disabled GPIO means, that the first port is
> +   selected.
> +
> +Required Port nodes
> +===
> +
> +More documentation on these bindings is available in
> +video-interfaces.txt in the same directory.
> +
> +reg  : The interface:
> +   0 - port for image signal processor
> +   1 - port for first camera sensor
> +   2 - port for second camera sensor

I'd say this must be pretty much specific to the one in N900. You could have
more ports. Or you could say that ports beyond 0 are camera sensors. I guess
this is good enough for now though, it can be changed later on with the
source if a need arises.

Btw. was it still considered a problem that the endpoint properties for the
sensors can be different? With the g_routing() pad op which is to be added,
the ISP driver (should actually go to a framework somewhere) could parse the
graph and find the proper endpoint there.

I don't think we need to wait for that now, but this is how the problem
could be solved going forward.

> +
> +Example
> +===
> +
> +video-bus-switch {
> + compatible = "video-bus-switch"
> + switch-gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>;
> +
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> +
> + csi_switch_in: endpoint {
> + remote-endpoint = <&csi_isp>;
> + };
> + };
> +
> + port@1 {
> + reg = <1>;
> +
> + csi_switch_out1: endpoint {
> + remote-endpoint = <&csi_cam1>;
> + };
> + };
> +
> + port@2 {
> + reg = <2>;
> +
> + csi_switch_out2: endpoint {
> + remote-endpoint = <&csi_cam2>;
> + };
> + };
> + };
> +};
> 
> 
> 

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] devicetree: Add video bus switch

2017-02-03 Thread Pavel Machek

N900 contains front and back camera, with a switch between the
two. This adds support for the switch component, and it is now
possible to select between front and back cameras during runtime.

This adds documentation for the devicetree binding.

Signed-off-by: Sebastian Reichel 
Signed-off-by: Ivaylo Dimitrov 
Signed-off-by: Pavel Machek 


diff --git a/Documentation/devicetree/bindings/media/video-bus-switch.txt 
b/Documentation/devicetree/bindings/media/video-bus-switch.txt
new file mode 100644
index 000..1b9f8e0
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/video-bus-switch.txt
@@ -0,0 +1,63 @@
+Video Bus Switch Binding
+
+
+This is a binding for a gpio controlled switch for camera interfaces. Such a
+device is used on some embedded devices to connect two cameras to the same
+interface of a image signal processor.
+
+Required properties
+===
+
+compatible : must contain "video-bus-switch"
+switch-gpios   : GPIO specifier for the gpio, which can toggle the
+ selected camera. The GPIO should be configured, so
+ that a disabled GPIO means, that the first port is
+ selected.
+
+Required Port nodes
+===
+
+More documentation on these bindings is available in
+video-interfaces.txt in the same directory.
+
+reg: The interface:
+ 0 - port for image signal processor
+ 1 - port for first camera sensor
+ 2 - port for second camera sensor
+
+Example
+===
+
+video-bus-switch {
+   compatible = "video-bus-switch"
+   switch-gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+
+   csi_switch_in: endpoint {
+   remote-endpoint = <&csi_isp>;
+   };
+   };
+
+   port@1 {
+   reg = <1>;
+
+   csi_switch_out1: endpoint {
+   remote-endpoint = <&csi_cam1>;
+   };
+   };
+
+   port@2 {
+   reg = <2>;
+
+   csi_switch_out2: endpoint {
+   remote-endpoint = <&csi_cam2>;
+   };
+   };
+   };
+};



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


signature.asc
Description: Digital signature