[PATCH 3/4] videodev2.h: fix comment

2015-03-07 Thread Hans Verkuil
From: Hans Verkuil 

Signed-off-by: Hans Verkuil 
---
 include/uapi/linux/videodev2.h | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index fbdc360..15b21e4 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -268,9 +268,10 @@ enum v4l2_ycbcr_encoding {
 
 enum v4l2_quantization {
/*
-* The default for R'G'B' quantization is always full range. For
-* Y'CbCr the quantization is always limited range, except for
-* SYCC, XV601, XV709 or JPEG: those are full range.
+* The default for R'G'B' quantization is always full range, except
+* for the BT2020 colorspace. For Y'CbCr the quantization is always
+* limited range, except for COLORSPACE_JPEG, SYCC, XV601 or XV709:
+* those are full range.
 */
V4L2_QUANTIZATION_DEFAULT = 0,
V4L2_QUANTIZATION_FULL_RANGE  = 1,
-- 
2.1.4

--
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 4/4] vivid: BT.2020 R'G'B' is limited range

2015-03-07 Thread Hans Verkuil
From: Hans Verkuil 

Signed-off-by: Hans Verkuil 
---
 drivers/media/platform/vivid/vivid-tpg.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/platform/vivid/vivid-tpg.c 
b/drivers/media/platform/vivid/vivid-tpg.c
index 34493f4..acb73b6 100644
--- a/drivers/media/platform/vivid/vivid-tpg.c
+++ b/drivers/media/platform/vivid/vivid-tpg.c
@@ -1265,6 +1265,10 @@ static void tpg_recalc(struct tpg_data *tpg)
V4L2_QUANTIZATION_LIM_RANGE;
break;
}
+   } else if (tpg->colorspace == V4L2_COLORSPACE_BT2020) {
+   /* R'G'B' BT.2020 is limited range */
+   tpg->real_quantization =
+   V4L2_QUANTIZATION_LIM_RANGE;
}
}
tpg_precalculate_colors(tpg);
-- 
2.1.4

--
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 0/4] Colorspace fixes

2015-03-07 Thread Hans Verkuil
From: Hans Verkuil 

Two colorspace fixes:

- fix wrong xv601/709 formulas in the colorspace chapter
- BT.2020 RGB is limited range, not full range. Update where needed.

Regards,

Hans

Hans Verkuil (4):
  DocBook media: fix xv601/709 formulas
  DocBook media: BT.2020 RGB uses limited quantization range
  videodev2.h: fix comment
  vivid: BT.2020 R'G'B' is limited range

 Documentation/DocBook/media/v4l/pixfmt.xml | 23 ---
 drivers/media/platform/vivid/vivid-tpg.c   |  4 
 include/uapi/linux/videodev2.h |  7 ---
 3 files changed, 20 insertions(+), 14 deletions(-)

-- 
2.1.4

--
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 1/4] DocBook media: fix xv601/709 formulas

2015-03-07 Thread Hans Verkuil
From: Hans Verkuil 

The denominator for the scaling and offsets is 256, not 255. Fix this.

Signed-off-by: Hans Verkuil 
---
 Documentation/DocBook/media/v4l/pixfmt.xml | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml 
b/Documentation/DocBook/media/v4l/pixfmt.xml
index 13540fa..f2175f0 100644
--- a/Documentation/DocBook/media/v4l/pixfmt.xml
+++ b/Documentation/DocBook/media/v4l/pixfmt.xml
@@ -790,9 +790,9 @@ case the BT.601 Y'CbCr encoding is used.
 is similar to the Rec. 709 encoding, but it allows for R', G' and B' values 
that are outside the range
 [0…1]. The resulting Y', Cb and Cr values are scaled and offset:
  
-
Y' = (219 / 255) * (0.2126R' + 0.7152G' + 0.0722B') + (16 / 255)
-
Cb = (224 / 255) * (-0.1146R' - 0.3854G' + 0.5B')
-
Cr = (224 / 255) * (0.5R' - 0.4542G' - 0.0458B')
+
Y' = (219 / 256) * (0.2126R' + 0.7152G' + 0.0722B') + (16 / 256)
+
Cb = (224 / 256) * (-0.1146R' - 0.3854G' + 0.5B')
+
Cr = (224 / 256) * (0.5R' - 0.4542G' - 0.0458B')
  

   
@@ -802,9 +802,9 @@ is similar to the Rec. 709 encoding, but it allows for R', 
G' and B' values that
 to the BT.601 encoding, but it allows for R', G' and B' values that are 
outside the range
 [0…1]. The resulting Y', Cb and Cr values are scaled and offset:
  
-
Y' = (219 / 255) * (0.299R' + 0.587G' + 0.114B') + (16 / 255)
-
Cb = (224 / 255) * (-0.169R' - 0.331G' + 0.5B')
-
Cr = (224 / 255) * (0.5R' - 0.419G' - 0.081B')
+
Y' = (219 / 256) * (0.299R' + 0.587G' + 0.114B') + (16 / 256)
+
Cb = (224 / 256) * (-0.169R' - 0.331G' + 0.5B')
+
Cr = (224 / 256) * (0.5R' - 0.419G' - 0.081B')
  

   
-- 
2.1.4

--
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 2/4] DocBook media: BT.2020 RGB uses limited quantization range

2015-03-07 Thread Hans Verkuil
From: Hans Verkuil 

In contrast to all other colorspaces, the BT.2020 colorspace uses
limited range R'G'B' quantization as the default.

This was incorrected documented, so fix this.

Signed-off-by: Hans Verkuil 
---
 Documentation/DocBook/media/v4l/pixfmt.xml | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml 
b/Documentation/DocBook/media/v4l/pixfmt.xml
index f2175f0..56bdd24 100644
--- a/Documentation/DocBook/media/v4l/pixfmt.xml
+++ b/Documentation/DocBook/media/v4l/pixfmt.xml
@@ -483,8 +483,8 @@ is the Y'CbCr encoding identifier (&v4l2-ycbcr-encoding;) 
to specify non-standar
 Y'CbCr encodings and the third is the quantization identifier 
(&v4l2-quantization;)
 to specify non-standard quantization methods. Most of the time only the 
colorspace
 field of &v4l2-pix-format; or &v4l2-pix-format-mplane; needs to be filled in. 
Note
-that the default R'G'B' quantization is always full range for all colorspaces,
-so this won't be mentioned explicitly for each colorspace description.
+that the default R'G'B' quantization is full range for all colorspaces except 
for
+BT.2020 which uses limited range R'G'B' quantization.
 
 
   V4L2 Colorspaces
@@ -598,7 +598,8 @@ so this won't be mentioned explicitly for each colorspace 
description.
  
V4L2_QUANTIZATION_DEFAULT
Use the default quantization encoding as defined by the 
colorspace.
-This is always full range for R'G'B' and usually limited range for 
Y'CbCr.
+This is always full range for R'G'B' (except for the BT.2020 colorspace) and 
usually
+limited range for Y'CbCr.
  
  
V4L2_QUANTIZATION_FULL_RANGE
@@ -967,8 +968,8 @@ SMPTE 170M/BT.601. The Y'CbCr quantization is limited 
range.
   Colorspace BT.2020 
(V4L2_COLORSPACE_BT2020)
   The  standard defines the colorspace 
used by Ultra-high definition
 television (UHDTV). The default Y'CbCr encoding is 
V4L2_YCBCR_ENC_BT2020.
-The default Y'CbCr quantization is limited range. The chromaticities of the 
primary colors and
-the white reference are:
+The default R'G'B' quantization is limited range (!), and so is the default 
Y'CbCr quantization.
+The chromaticities of the primary colors and the white reference are:
   
 BT.2020 Chromaticities
 
-- 
2.1.4

--
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] v4l2-ioctl: tidy up debug messages

2015-03-07 Thread Hans Verkuil
Make sure the format fields are reported consistently.

Signed-off-by: Hans Verkuil 
---
 drivers/media/v4l2-core/v4l2-ioctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c 
b/drivers/media/v4l2-core/v4l2-ioctl.c
index b084072..84fb034 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -257,7 +257,7 @@ static void v4l_print_format(const void *arg, bool 
write_only)
pr_cont(", width=%u, height=%u, "
"pixelformat=%c%c%c%c, field=%s, "
"bytesperline=%u, sizeimage=%u, colorspace=%d, "
-   "flags %x, ycbcr_enc=%u, quantization=%u\n",
+   "flags=0x%x, ycbcr_enc=%u, quantization=%u\n",
pix->width, pix->height,
(pix->pixelformat & 0xff),
(pix->pixelformat >>  8) & 0xff,
@@ -273,7 +273,7 @@ static void v4l_print_format(const void *arg, bool 
write_only)
mp = &p->fmt.pix_mp;
pr_cont(", width=%u, height=%u, "
"format=%c%c%c%c, field=%s, "
-   "colorspace=%d, num_planes=%u, flags=%x, "
+   "colorspace=%d, num_planes=%u, flags=0x%x, "
"ycbcr_enc=%u, quantization=%u\n",
mp->width, mp->height,
(mp->pixelformat & 0xff),
-- 
2.1.4

--
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] v4l2-framework.txt: debug -> dev_debug

2015-03-07 Thread Hans Verkuil
The debug attribute was renamed to dev_debug. Update the doc accordingly.

Signed-off-by: Hans Verkuil 
---
 Documentation/video4linux/v4l2-framework.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/video4linux/v4l2-framework.txt 
b/Documentation/video4linux/v4l2-framework.txt
index f586e29..59e619f 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -793,8 +793,8 @@ video_register_device_no_warn() instead.
 
 Whenever a device node is created some attributes are also created for you.
 If you look in /sys/class/video4linux you see the devices. Go into e.g.
-video0 and you will see 'name', 'debug' and 'index' attributes. The 'name'
-attribute is the 'name' field of the video_device struct. The 'debug' attribute
+video0 and you will see 'name', 'dev_debug' and 'index' attributes. The 'name'
+attribute is the 'name' field of the video_device struct. The 'dev_debug' 
attribute
 can be used to enable core debugging. See the next section for more detailed
 information on this.
 
@@ -821,7 +821,7 @@ unregister the device if the registration failed.
 video device debugging
 --
 
-The 'debug' attribute that is created for each video, vbi, radio or swradio
+The 'dev_debug' attribute that is created for each video, vbi, radio or swradio
 device in /sys/class/video4linux// allows you to enable logging of
 file operations.
 
-- 
2.1.4

--
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


cron job: media_tree daily build: WARNINGS

2015-03-07 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Sun Mar  8 04:00:18 CET 2015
git branch: test
git hash:   3d945be05ac1e806af075e9315bc1b3409adae2b
gcc version:i686-linux-gcc (GCC) 4.9.1
sparse version: v0.5.0-44-g40791b9
smatch version: 0.4.1-3153-g7d56ab3
host hardware:  x86_64
host os:3.18.0-5.slh.1-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.32.27-i686: OK
linux-2.6.33.7-i686: OK
linux-2.6.34.7-i686: OK
linux-2.6.35.9-i686: OK
linux-2.6.36.4-i686: OK
linux-2.6.37.6-i686: OK
linux-2.6.38.8-i686: OK
linux-2.6.39.4-i686: OK
linux-3.0.60-i686: OK
linux-3.1.10-i686: OK
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: OK
linux-3.7.4-i686: OK
linux-3.8-i686: WARNINGS
linux-3.9.2-i686: WARNINGS
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12.23-i686: OK
linux-3.13.11-i686: OK
linux-3.14.9-i686: OK
linux-3.15.2-i686: OK
linux-3.16.7-i686: OK
linux-3.17.8-i686: OK
linux-3.18.7-i686: OK
linux-3.19-i686: OK
linux-4.0-rc1-i686: OK
linux-2.6.32.27-x86_64: OK
linux-2.6.33.7-x86_64: OK
linux-2.6.34.7-x86_64: OK
linux-2.6.35.9-x86_64: OK
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
linux-3.0.60-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: WARNINGS
linux-3.9.2-x86_64: WARNINGS
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12.23-x86_64: OK
linux-3.13.11-x86_64: OK
linux-3.14.9-x86_64: OK
linux-3.15.2-x86_64: OK
linux-3.16.7-x86_64: OK
linux-3.17.8-x86_64: OK
linux-3.18.7-x86_64: OK
linux-3.19-x86_64: OK
linux-4.0-rc1-x86_64: OK
apps: OK
spec-git: OK
sparse: WARNINGS
smatch: ERRORS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Sunday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Sunday.tar.bz2

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/media.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 3/3] media: atmel-isi: remove mck back compatiable code as we don't need it

2015-03-07 Thread Laurent Pinchart
On Friday 06 March 2015 21:25:36 Guennadi Liakhovetski wrote:
> On Fri, 6 Mar 2015, Josh Wu wrote:
> > On 3/5/2015 6:41 PM, Laurent Pinchart wrote:
> >> On Thursday 05 March 2015 13:01:01 Josh Wu wrote:
> >>> The master clock should handled by sensor itself.
> >> 
> >> I like that :-)
> >> 
> >>> Signed-off-by: Josh Wu 
> >>> ---
> >>> 
> >>>   drivers/media/platform/soc_camera/atmel-isi.c | 32 ---
> >>>   1 file changed, 32 deletions(-)
> >>> 
> >>> diff --git a/drivers/media/platform/soc_camera/atmel-isi.c
> >>> b/drivers/media/platform/soc_camera/atmel-isi.c index 4a384f1..50375ce
> >>> 100644
> >>> --- a/drivers/media/platform/soc_camera/atmel-isi.c
> >>> +++ b/drivers/media/platform/soc_camera/atmel-isi.c
> >>> @@ -83,8 +83,6 @@ struct atmel_isi {
> >>> 
> >>>   struct completion   complete;
> >>>   /* ISI peripherial clock */
> >>>   struct clk  *pclk;
> >>> 
> >>> - /* ISI_MCK, feed to camera sensor to generate pixel clock */
> >>> - struct clk  *mck;
> >>> 
> >>>   unsigned intirq;
> >>>   
> >>>   struct isi_platform_datapdata;
> >>> 
> >>> @@ -725,26 +723,12 @@ static void isi_camera_remove_device(struct
> >>> soc_camera_device *icd) /* Called with .host_lock held */
> >>> 
> >>>   static int isi_camera_clock_start(struct soc_camera_host *ici)
> >>>   {
> >>> 
> >>> - struct atmel_isi *isi = ici->priv;
> >>> - int ret;
> >>> -
> >>> - if (!IS_ERR(isi->mck)) {
> >>> - ret = clk_prepare_enable(isi->mck);
> >>> - if (ret) {
> >>> - return ret;
> >>> - }
> >>> - }
> >>> -
> >>> 
> >>>   return 0;
> >> 
> >> Would it make sense to make the clock_start and clock_stop operations
> >> optional in the soc-camera core ?
> > 
> > I agree. For those camera host which don't provide master clock for
> > sensor, clock_start and clock_stop should be optional.
> > 
> > Hi, Guennadi
> > 
> > Do you agree with this?
> 
> Yes, sure, we can do this. Would anyone like to prepare a patch?

Josh, would you like to do that, or should I give it a go ?

-- 
Regards,

Laurent Pinchart
--
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: [RFC 17/18] arm: dts: n950, n9: Add primary camera support

2015-03-07 Thread Sakari Ailus
Hi Laurent,

On Sun, Mar 08, 2015 at 01:56:13AM +0200, Laurent Pinchart wrote:
> Hi Sakari,
> 
> Thank you for the patch.
> 
> On Saturday 07 March 2015 23:41:14 Sakari Ailus wrote:
> > Add support for the primary camera of the Nokia N950 and N9.
> > 
> > Signed-off-by: Sakari Ailus 
> > ---
> >  arch/arm/boot/dts/omap3-n9.dts   |   39 +++
> >  arch/arm/boot/dts/omap3-n950-n9.dtsi |4 
> >  arch/arm/boot/dts/omap3-n950.dts |   39 +++
> >  3 files changed, 78 insertions(+), 4 deletions(-)
> > 
> > diff --git a/arch/arm/boot/dts/omap3-n9.dts b/arch/arm/boot/dts/omap3-n9.dts
> > index 9938b5d..05f32ae 100644
> > --- a/arch/arm/boot/dts/omap3-n9.dts
> > +++ b/arch/arm/boot/dts/omap3-n9.dts
> > @@ -16,3 +16,42 @@
> > model = "Nokia N9";
> > compatible = "nokia,omap3-n9", "ti,omap36xx", "ti,omap3";
> >  };
> > +
> > +&i2c2 {
> > +   clock-frequency = <40>;
> > +
> > +   smia_1: camera@10 {
> > +   compatible = "nokia,smia";
> > +   reg = <0x10>;
> > +   /* No reset gpio */
> > +   vana-supply = <&vaux3>;
> > +   clocks = <&omap3_isp 0>;
> > +   clock-frequency = <960>;
> > +   nokia,nvm-size = <1024>; /* 16 * 64 */
> 
> You could actually specify that as "<(16 * 64)>".

Will fix.

> > +   link-frequencies = /bits/ 64 <19920 21000 49920>;
> > +   port {
> > +   smia_1_1: endpoint {
> > +   clock-lanes = <0>;
> > +   data-lanes = <1 2>;
> > +   remote-endpoint = <&csi2a_ep>;
> > +   };
> > +   };
> > +   };
> > +};
> > +
> > +&omap3_isp {
> > +   vdd-csiphy1-supply = <&vaux2>;
> > +   vdd-csiphy2-supply = <&vaux2>;
> > +   ports {
> > +   port@2 {
> > +   reg = <2>;
> > +   csi2a_ep: endpoint {
> > +   remote-endpoint = <&smia_1_1>;
> > +   clock-lanes = <2>;
> > +   data-lanes = <1 3>;
> > +   crc = <1>;
> > +   lane-polarity = <1 1 1>;
> > +   };
> > +   };
> > +   };
> > +};
> > diff --git a/arch/arm/boot/dts/omap3-n950-n9.dtsi
> > b/arch/arm/boot/dts/omap3-n950-n9.dtsi index c41db94..51e5043 100644
> > --- a/arch/arm/boot/dts/omap3-n950-n9.dtsi
> > +++ b/arch/arm/boot/dts/omap3-n950-n9.dtsi
> > @@ -86,10 +86,6 @@
> > regulator-max-microvolt = <280>;
> >  };
> > 
> > -&i2c2 {
> > -   clock-frequency = <40>;
> > -};
> > -
> 
> What's the reason for moving this to the N9 and N950 DT files as you keep the 
> same value in both ?

Just before submitting the patches I thought someone might ask. :-D

I'll fix that.

> >  &i2c3 {
> > clock-frequency = <40>;
> >  };
> > diff --git a/arch/arm/boot/dts/omap3-n950.dts
> > b/arch/arm/boot/dts/omap3-n950.dts index 261c558..2b2ed9c 100644
> > --- a/arch/arm/boot/dts/omap3-n950.dts
> > +++ b/arch/arm/boot/dts/omap3-n950.dts
> > @@ -16,3 +16,42 @@
> > model = "Nokia N950";
> > compatible = "nokia,omap3-n950", "ti,omap36xx", "ti,omap3";
> >  };
> > +
> > +&i2c2 {
> > +   clock-frequency = <40>;
> > +
> > +   smia_1: camera@10 {
> > +   compatible = "nokia,smia";
> > +   reg = <0x10>;
> > +   /* No reset gpio */
> > +   vana-supply = <&vaux3>;
> > +   clocks = <&omap3_isp 0>;
> > +   clock-frequency = <960>;
> > +   nokia,nvm-size = <1024>; /* 16 * 64 */
> > +   link-frequencies = /bits/ 64 <21000 33360 39840>;
> > +   port {
> > +   smia_1_1: endpoint {
> > +   clock-lanes = <0>;
> > +   data-lanes = <1 2>;
> > +   remote-endpoint = <&csi2a_ep>;
> > +   };
> > +   };
> > +   };
> > +};
> > +
> > +&omap3_isp {
> > +   vdd-csiphy1-supply = <&vaux2>;
> > +   vdd-csiphy2-supply = <&vaux2>;
> > +   ports {
> > +   port@2 {
> > +   reg = <2>;
> > +   csi2a_ep: endpoint {
> > +   remote-endpoint = <&smia_1_1>;
> > +   clock-lanes = <2>;
> > +   data-lanes = <3 1>;
> > +   crc = <1>;
> > +   lane-polarity = <1 1 1>;
> > +   };
> > +   };
> > +   };
> > +};
> 

-- 
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: [RFC 12/18] dt: bindings: Add lane-polarity property to endpoint nodes

2015-03-07 Thread Sakari Ailus
Hi Laurent,

On Sun, Mar 08, 2015 at 01:46:02AM +0200, Laurent Pinchart wrote:
> Hi Sakari,
> 
> Thank you for the patch.
> 
> (CC'ing Sylwester)
> 
> On Saturday 07 March 2015 23:41:09 Sakari Ailus wrote:
> > Add lane-polarity property to endpoint nodes. This essentially tells that
> > the order of the differential signal wires is inverted.
> > 
> > Signed-off-by: Sakari Ailus 
> > ---
> >  Documentation/devicetree/bindings/media/video-interfaces.txt |5 +
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/media/video-interfaces.txt
> > b/Documentation/devicetree/bindings/media/video-interfaces.txt index
> > 571b4c6..058d1e6 100644
> > --- a/Documentation/devicetree/bindings/media/video-interfaces.txt
> > +++ b/Documentation/devicetree/bindings/media/video-interfaces.txt
> > @@ -106,6 +106,11 @@ Optional endpoint properties
> >  - link-frequencies: Allowed data bus frequencies. For MIPI CSI-2, for
> >instance, this is the actual frequency of the bus, not bits per clock per
> > lane value. An array of 64-bit unsigned integers.
> > +- lane-polarity: an array of polarities of the lanes starting from the
> > clock
> > +  lane and followed by the data lanes in the same order as in data-lanes.
> > +  Valid values are 0 (normal) and 1 (inverted).
> 
> Would it make sense to add #define's for this ?

Good question. I don't really have too much of an opinion. I think I'd just
use a number until someone else needs this. :-)

> > The length of the array
> > +  should be the combined length of data-lanes and clock-lanes
> > properties.
> > +  This property is valid for serial busses only.
> 
> You should also document what happens when the property is omitted.

Will add.

-- 
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: [RFC 17/18] arm: dts: n950, n9: Add primary camera support

2015-03-07 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

On Saturday 07 March 2015 23:41:14 Sakari Ailus wrote:
> Add support for the primary camera of the Nokia N950 and N9.
> 
> Signed-off-by: Sakari Ailus 
> ---
>  arch/arm/boot/dts/omap3-n9.dts   |   39 +++
>  arch/arm/boot/dts/omap3-n950-n9.dtsi |4 
>  arch/arm/boot/dts/omap3-n950.dts |   39 +++
>  3 files changed, 78 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/omap3-n9.dts b/arch/arm/boot/dts/omap3-n9.dts
> index 9938b5d..05f32ae 100644
> --- a/arch/arm/boot/dts/omap3-n9.dts
> +++ b/arch/arm/boot/dts/omap3-n9.dts
> @@ -16,3 +16,42 @@
>   model = "Nokia N9";
>   compatible = "nokia,omap3-n9", "ti,omap36xx", "ti,omap3";
>  };
> +
> +&i2c2 {
> + clock-frequency = <40>;
> +
> + smia_1: camera@10 {
> + compatible = "nokia,smia";
> + reg = <0x10>;
> + /* No reset gpio */
> + vana-supply = <&vaux3>;
> + clocks = <&omap3_isp 0>;
> + clock-frequency = <960>;
> + nokia,nvm-size = <1024>; /* 16 * 64 */

You could actually specify that as "<(16 * 64)>".

> + link-frequencies = /bits/ 64 <19920 21000 49920>;
> + port {
> + smia_1_1: endpoint {
> + clock-lanes = <0>;
> + data-lanes = <1 2>;
> + remote-endpoint = <&csi2a_ep>;
> + };
> + };
> + };
> +};
> +
> +&omap3_isp {
> + vdd-csiphy1-supply = <&vaux2>;
> + vdd-csiphy2-supply = <&vaux2>;
> + ports {
> + port@2 {
> + reg = <2>;
> + csi2a_ep: endpoint {
> + remote-endpoint = <&smia_1_1>;
> + clock-lanes = <2>;
> + data-lanes = <1 3>;
> + crc = <1>;
> + lane-polarity = <1 1 1>;
> + };
> + };
> + };
> +};
> diff --git a/arch/arm/boot/dts/omap3-n950-n9.dtsi
> b/arch/arm/boot/dts/omap3-n950-n9.dtsi index c41db94..51e5043 100644
> --- a/arch/arm/boot/dts/omap3-n950-n9.dtsi
> +++ b/arch/arm/boot/dts/omap3-n950-n9.dtsi
> @@ -86,10 +86,6 @@
>   regulator-max-microvolt = <280>;
>  };
> 
> -&i2c2 {
> - clock-frequency = <40>;
> -};
> -

What's the reason for moving this to the N9 and N950 DT files as you keep the 
same value in both ?

>  &i2c3 {
>   clock-frequency = <40>;
>  };
> diff --git a/arch/arm/boot/dts/omap3-n950.dts
> b/arch/arm/boot/dts/omap3-n950.dts index 261c558..2b2ed9c 100644
> --- a/arch/arm/boot/dts/omap3-n950.dts
> +++ b/arch/arm/boot/dts/omap3-n950.dts
> @@ -16,3 +16,42 @@
>   model = "Nokia N950";
>   compatible = "nokia,omap3-n950", "ti,omap36xx", "ti,omap3";
>  };
> +
> +&i2c2 {
> + clock-frequency = <40>;
> +
> + smia_1: camera@10 {
> + compatible = "nokia,smia";
> + reg = <0x10>;
> + /* No reset gpio */
> + vana-supply = <&vaux3>;
> + clocks = <&omap3_isp 0>;
> + clock-frequency = <960>;
> + nokia,nvm-size = <1024>; /* 16 * 64 */
> + link-frequencies = /bits/ 64 <21000 33360 39840>;
> + port {
> + smia_1_1: endpoint {
> + clock-lanes = <0>;
> + data-lanes = <1 2>;
> + remote-endpoint = <&csi2a_ep>;
> + };
> + };
> + };
> +};
> +
> +&omap3_isp {
> + vdd-csiphy1-supply = <&vaux2>;
> + vdd-csiphy2-supply = <&vaux2>;
> + ports {
> + port@2 {
> + reg = <2>;
> + csi2a_ep: endpoint {
> + remote-endpoint = <&smia_1_1>;
> + clock-lanes = <2>;
> + data-lanes = <3 1>;
> + crc = <1>;
> + lane-polarity = <1 1 1>;
> + };
> + };
> + };
> +};

-- 
Regards,

Laurent Pinchart

--
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: [RFC 16/18] arm: dts: omap3: Add DT entries for OMAP 3

2015-03-07 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

On Saturday 07 March 2015 23:41:13 Sakari Ailus wrote:
> The resources the ISP needs are slightly different on 3[45]xx and 3[67]xx.
> Especially the phy-type property is different.
> 
> Signed-off-by: Sakari Ailus 
> ---
>  arch/arm/boot/dts/omap34xx.dtsi |   15 +++
>  arch/arm/boot/dts/omap36xx.dtsi |   15 +++
>  2 files changed, 30 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/omap34xx.dtsi
> b/arch/arm/boot/dts/omap34xx.dtsi index 3819c1e..4c034d0 100644
> --- a/arch/arm/boot/dts/omap34xx.dtsi
> +++ b/arch/arm/boot/dts/omap34xx.dtsi
> @@ -37,6 +37,21 @@
>   pinctrl-single,register-width = <16>;
>   pinctrl-single,function-mask = <0xff1f>;
>   };
> +
> + omap3_isp: omap3_isp@480bc000 {
> + compatible = "ti,omap3-isp";
> + reg = <0x480bc000 0x12fc
> +0x480bd800 0x017c>;
> + interrupts = <24>;
> + iommus = <&mmu_isp>;
> + syscon = <&omap3_scm_general 0xdc>;
> + ti,phy-type = <0>;
> + #clock-cells = <1>;
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;

How about predefining the ports too ?

> + };
> + };
>   };
>  };
> 
> diff --git a/arch/arm/boot/dts/omap36xx.dtsi
> b/arch/arm/boot/dts/omap36xx.dtsi index 541704a..31ac41c 100644
> --- a/arch/arm/boot/dts/omap36xx.dtsi
> +++ b/arch/arm/boot/dts/omap36xx.dtsi
> @@ -69,6 +69,21 @@
>   pinctrl-single,register-width = <16>;
>   pinctrl-single,function-mask = <0xff1f>;
>   };
> +
> + omap3_isp: omap3_isp@480bc000 {
> + compatible = "ti,omap3-isp";
> + reg = <0x480bc000 0x12fc
> +0x480bd800 0x0600>;
> + interrupts = <24>;
> + iommus = <&mmu_isp>;
> + syscon = <&omap3_scm_general 0x2f0>;
> + ti,phy-type = <1>;
> + #clock-cells = <1>;
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;

And obviously here too.

> + };
> + };
>   };
>  };

-- 
Regards,

Laurent Pinchart

--
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: [RFC 05/18] omap3isp: Platform data could be NULL

2015-03-07 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

On Saturday 07 March 2015 23:41:02 Sakari Ailus wrote:
> Only check for call platform data callback functions if there's platform
> data. Also take care of a few other cases where the NULL pdata pointer could
> have been accessed, and remove the check for NULL dev->platform_data
> pointer.
> 
> Removing the check for NULL dev->platform_data isn't strictly needed by the
> DT support but there's no harm from that either: the device now can be used
> without sensors, for instance.
> 
> Signed-off-by: Sakari Ailus 

Acked-by: Laurent Pinchart 

> ---
>  drivers/media/platform/omap3isp/isp.c  |   10 --
>  drivers/media/platform/omap3isp/ispvideo.c |6 +++---
>  2 files changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/media/platform/omap3isp/isp.c
> b/drivers/media/platform/omap3isp/isp.c index 01356dd..b836bc8 100644
> --- a/drivers/media/platform/omap3isp/isp.c
> +++ b/drivers/media/platform/omap3isp/isp.c
> @@ -330,8 +330,8 @@ static int isp_xclk_init(struct isp_device *isp)
>   if (np)
>   continue;
> 
> - if (pdata->xclks[i].con_id == NULL &&
> - pdata->xclks[i].dev_id == NULL)
> + if (!pdata || (pdata->xclks[i].con_id == NULL &&
> +pdata->xclks[i].dev_id == NULL))
>   continue;
> 
>   xclk->lookup = kzalloc(sizeof(*xclk->lookup), GFP_KERNEL);
> @@ -1989,7 +1989,8 @@ static int isp_register_entities(struct isp_device
> *isp) goto done;
> 
>   /* Register external entities */
> - for (subdevs = pdata->subdevs; subdevs && subdevs->subdevs; ++subdevs) {
> + for (subdevs = pdata ? pdata->subdevs : NULL;
> +  subdevs && subdevs->subdevs; ++subdevs) {
>   struct v4l2_subdev *sensor =
>   isp_register_subdev_group(isp, subdevs->subdevs);
> 
> @@ -2271,9 +2272,6 @@ static int isp_probe(struct platform_device *pdev)
>   int ret;
>   int i, m;
> 
> - if (pdata == NULL)
> - return -EINVAL;
> -
>   isp = devm_kzalloc(&pdev->dev, sizeof(*isp), GFP_KERNEL);
>   if (!isp) {
>   dev_err(&pdev->dev, "could not allocate memory\n");
> diff --git a/drivers/media/platform/omap3isp/ispvideo.c
> b/drivers/media/platform/omap3isp/ispvideo.c index 3fe9047..d644164 100644
> --- a/drivers/media/platform/omap3isp/ispvideo.c
> +++ b/drivers/media/platform/omap3isp/ispvideo.c
> @@ -1022,7 +1022,7 @@ isp_video_streamon(struct file *file, void *fh, enum
> v4l2_buf_type type)
> 
>   pipe->entities = 0;
> 
> - if (video->isp->pdata->set_constraints)
> + if (video->isp->pdata && video->isp->pdata->set_constraints)
>   video->isp->pdata->set_constraints(video->isp, true);
>   pipe->l3_ick = clk_get_rate(video->isp->clock[ISP_CLK_L3_ICK]);
>   pipe->max_rate = pipe->l3_ick;
> @@ -1104,7 +1104,7 @@ err_set_stream:
>  err_check_format:
>   media_entity_pipeline_stop(&video->video.entity);
>  err_pipeline_start:
> - if (video->isp->pdata->set_constraints)
> + if (video->isp->pdata && video->isp->pdata->set_constraints)
>   video->isp->pdata->set_constraints(video->isp, false);
>   /* The DMA queue must be emptied here, otherwise CCDC interrupts that
>* will get triggered the next time the CCDC is powered up will try to
> @@ -1165,7 +1165,7 @@ isp_video_streamoff(struct file *file, void *fh, enum
> v4l2_buf_type type) video->queue = NULL;
>   video->error = false;
> 
> - if (video->isp->pdata->set_constraints)
> + if (video->isp->pdata && video->isp->pdata->set_constraints)
>   video->isp->pdata->set_constraints(video->isp, false);
>   media_entity_pipeline_stop(&video->video.entity);

-- 
Regards,

Laurent Pinchart

--
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: [RFC 13/18] v4l: of: Read lane-polarity endpoint property

2015-03-07 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

On Saturday 07 March 2015 23:41:10 Sakari Ailus wrote:
> Add lane_polarity field to struct v4l2_of_bus_mipi_csi2 and write the
> contents of the lane polarity property to it. The field tells the polarity
> of the physical lanes starting from the first one. Any unused lanes are
> ignored, i.e. only the polarity of the used lanes is specified.
> 
> Signed-off-by: Sakari Ailus 
> ---
>  drivers/media/v4l2-core/v4l2-of.c |   21 -
>  include/media/v4l2-of.h   |3 +++
>  2 files changed, 19 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-of.c
> b/drivers/media/v4l2-core/v4l2-of.c index b4ed9a9..a7a855e 100644
> --- a/drivers/media/v4l2-core/v4l2-of.c
> +++ b/drivers/media/v4l2-core/v4l2-of.c
> @@ -23,7 +23,6 @@ static void v4l2_of_parse_csi_bus(const struct device_node
> *node, struct v4l2_of_endpoint *endpoint)
>  {
>   struct v4l2_of_bus_mipi_csi2 *bus = &endpoint->bus.mipi_csi2;
> - u32 data_lanes[ARRAY_SIZE(bus->data_lanes)];
>   struct property *prop;
>   bool have_clk_lane = false;
>   unsigned int flags = 0;
> @@ -34,14 +33,26 @@ static void v4l2_of_parse_csi_bus(const struct
> device_node *node, const __be32 *lane = NULL;
>   int i;
> 
> - for (i = 0; i < ARRAY_SIZE(data_lanes); i++) {
> - lane = of_prop_next_u32(prop, lane, &data_lanes[i]);
> + for (i = 0; i < ARRAY_SIZE(bus->data_lanes); i++) {
> + lane = of_prop_next_u32(prop, lane, &v);
>   if (!lane)
>   break;
> + bus->data_lanes[i] = v;
>   }
>   bus->num_data_lanes = i;
> - while (i--)
> - bus->data_lanes[i] = data_lanes[i];
> + }
> +
> + prop = of_find_property(node, "lane-polarity", NULL);
> + if (prop) {
> + const __be32 *polarity = NULL;
> + int i;

Could you please use unsigned int instead of int as the loop index can't have 
negative value ? Feel free to fix the index in the previous loop too :-)

> +
> + for (i = 0; i < ARRAY_SIZE(bus->lane_polarity); i++) {
> + polarity = of_prop_next_u32(prop, polarity, &v);
> + if (!polarity)
> + break;
> + bus->lane_polarity[i] = v;
> + }

Should we check that i == num_data_lines + 1 ?

>   }
> 
>   if (!of_property_read_u32(node, "clock-lanes", &v)) {
> diff --git a/include/media/v4l2-of.h b/include/media/v4l2-of.h
> index 70fa7b7..a70eb52 100644
> --- a/include/media/v4l2-of.h
> +++ b/include/media/v4l2-of.h
> @@ -29,12 +29,15 @@ struct device_node;
>   * @data_lanes: an array of physical data lane indexes
>   * @clock_lane: physical lane index of the clock lane
>   * @num_data_lanes: number of data lanes
> + * @lane_polarity: polarity of the lanes. The order is the same of
> + *  the physical lanes.
>   */
>  struct v4l2_of_bus_mipi_csi2 {
>   unsigned int flags;
>   unsigned char data_lanes[4];
>   unsigned char clock_lane;
>   unsigned short num_data_lanes;
> + bool lane_polarity[5];
>  };
> 
>  /**

-- 
Regards,

Laurent Pinchart

--
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: [RFC 12/18] dt: bindings: Add lane-polarity property to endpoint nodes

2015-03-07 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

(CC'ing Sylwester)

On Saturday 07 March 2015 23:41:09 Sakari Ailus wrote:
> Add lane-polarity property to endpoint nodes. This essentially tells that
> the order of the differential signal wires is inverted.
> 
> Signed-off-by: Sakari Ailus 
> ---
>  Documentation/devicetree/bindings/media/video-interfaces.txt |5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/media/video-interfaces.txt
> b/Documentation/devicetree/bindings/media/video-interfaces.txt index
> 571b4c6..058d1e6 100644
> --- a/Documentation/devicetree/bindings/media/video-interfaces.txt
> +++ b/Documentation/devicetree/bindings/media/video-interfaces.txt
> @@ -106,6 +106,11 @@ Optional endpoint properties
>  - link-frequencies: Allowed data bus frequencies. For MIPI CSI-2, for
>instance, this is the actual frequency of the bus, not bits per clock per
> lane value. An array of 64-bit unsigned integers.
> +- lane-polarity: an array of polarities of the lanes starting from the
> clock
> +  lane and followed by the data lanes in the same order as in data-lanes.
> +  Valid values are 0 (normal) and 1 (inverted).

Would it make sense to add #define's for this ?

> The length of the array
> +  should be the combined length of data-lanes and clock-lanes
> properties.
> +  This property is valid for serial busses only.

You should also document what happens when the property is omitted.

>  Example

-- 
Regards,

Laurent Pinchart

--
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: [RFC 10/18] omap3isp: Move the syscon register out of the ISP register maps

2015-03-07 Thread Sakari Ailus
Hi Laurent,

On Sun, Mar 08, 2015 at 01:34:17AM +0200, Laurent Pinchart wrote:
> Hi Sakari,
> 
> Thank you for the patch.
> 
> (CC'ing linux-omap and Tony)

Thanks.

> On Saturday 07 March 2015 23:41:07 Sakari Ailus wrote:
> > The syscon register isn't part of the ISP, use it through the syscom driver
> > regmap instead. The syscom block is considered to be from 343x on ISP
> > revision 2.0 whereas 15.0 is assumed to have 3630 syscon.
> > 
> > Signed-off-by: Sakari Ailus 
> > ---
> >  arch/arm/boot/dts/omap3.dtsi|2 +-
> >  arch/arm/mach-omap2/devices.c   |   10 --
> >  drivers/media/platform/omap3isp/isp.c   |   19 +++
> >  drivers/media/platform/omap3isp/isp.h   |   19 +--
> >  drivers/media/platform/omap3isp/ispcsiphy.c |   20 +---
> 
> You might be asked to split the patch into two, let's see what Tony says.
> 
> >  5 files changed, 42 insertions(+), 28 deletions(-)
> > 
> > diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
> > index 01b7111..fe0b293 100644
> > --- a/arch/arm/boot/dts/omap3.dtsi
> > +++ b/arch/arm/boot/dts/omap3.dtsi
> > @@ -183,7 +183,7 @@
> > 
> > omap3_scm_general: tisyscon@48002270 {
> > compatible = "syscon";
> > -   reg = <0x48002270 0x2f0>;
> > +   reg = <0x48002270 0x2f4>;
> > };
> > 
> > pbias_regulator: pbias_regulator {
> > diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
> > index 1afb50d..e945957 100644
> > --- a/arch/arm/mach-omap2/devices.c
> > +++ b/arch/arm/mach-omap2/devices.c
> > @@ -143,16 +143,6 @@ static struct resource omap3isp_resources[] = {
> > .flags  = IORESOURCE_MEM,
> > },
> > {
> > -   .start  = OMAP343X_CTRL_BASE + OMAP343X_CONTROL_CSIRXFE,
> > -   .end= OMAP343X_CTRL_BASE + OMAP343X_CONTROL_CSIRXFE 
> > + 3,
> > -   .flags  = IORESOURCE_MEM,
> > -   },
> > -   {
> > -   .start  = OMAP343X_CTRL_BASE + 
> > OMAP3630_CONTROL_CAMERA_PHY_CTRL,
> > -   .end= OMAP343X_CTRL_BASE + 
> > OMAP3630_CONTROL_CAMERA_PHY_CTRL + 3,
> > -   .flags  = IORESOURCE_MEM,
> > -   },
> > -   {
> > .start  = 24 + OMAP_INTC_START,
> > .flags  = IORESOURCE_IRQ,
> > }
> > diff --git a/drivers/media/platform/omap3isp/isp.c
> > b/drivers/media/platform/omap3isp/isp.c index 68d7edfc..4ff4bbd 100644
> > --- a/drivers/media/platform/omap3isp/isp.c
> > +++ b/drivers/media/platform/omap3isp/isp.c
> > @@ -51,6 +51,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -94,8 +95,9 @@ static const struct isp_res_mapping isp_res_maps[] = {
> >1 << OMAP3_ISP_IOMEM_RESZ |
> >1 << OMAP3_ISP_IOMEM_SBL |
> >1 << OMAP3_ISP_IOMEM_CSI2A_REGS1 |
> > -  1 << OMAP3_ISP_IOMEM_CSIPHY2 |
> > -  1 << OMAP3_ISP_IOMEM_343X_CONTROL_CSIRXFE,
> > +  1 << OMAP3_ISP_IOMEM_CSIPHY2,
> > +   .syscon_offset = 0xdc,
> > +   .phy_type = ISP_PHY_TYPE_3430,
> > },
> > {
> > .isp_rev = ISP_REVISION_15_0,
> > @@ -112,8 +114,9 @@ static const struct isp_res_mapping isp_res_maps[] = {
> >1 << OMAP3_ISP_IOMEM_CSI2A_REGS2 |
> >1 << OMAP3_ISP_IOMEM_CSI2C_REGS1 |
> >1 << OMAP3_ISP_IOMEM_CSIPHY1 |
> > -  1 << OMAP3_ISP_IOMEM_CSI2C_REGS2 |
> > -  1 << OMAP3_ISP_IOMEM_3630_CONTROL_CAMERA_PHY_CTRL,
> > +  1 << OMAP3_ISP_IOMEM_CSI2C_REGS2,
> > +   .syscon_offset = 0x2f0,
> > +   .phy_type = ISP_PHY_TYPE_3630,
> > },
> >  };
> > 
> > @@ -2352,6 +2355,14 @@ static int isp_probe(struct platform_device *pdev)
> > }
> > }
> > 
> > +   isp->syscon = syscon_regmap_lookup_by_pdevname("syscon.0");
> > +   isp->syscon_offset = isp_res_maps[m].syscon_offset;
> > +   isp->phy_type = isp_res_maps[m].phy_type;
> 
> You could move those two lines after the error check to keep the check closer 
> to the source of error.

Ack.

> Apart from that,
> 
> Acked-by: Laurent Pinchart 

Thanks for the acks!

-- 
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: [RFC 11/18] omap3isp: Replace many MMIO regions by two

2015-03-07 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

(CC'ing linux-omap and Tony)

On Saturday 07 March 2015 23:41:08 Sakari Ailus wrote:
> The omap3isp MMIO register block is contiguous in the MMIO register space
> apart from the fact that the ISP IOMMU register block is in the middle of
> the area. Ioremap it at two occasions, and keep the rest of the layout of
> the register space internal to the omap3isp driver.
> 
> Signed-off-by: Sakari Ailus 

Acked-by: Laurent Pinchart 

> ---
>  arch/arm/mach-omap2/devices.c |   66 +--
>  arch/arm/mach-omap2/omap34xx.h|   36 +--

Once again you might be asked to split this. However, it would be pretty 
painful, so it would be nice if we could merge everything through the Linux 
media tree. You will need an ack from Tony.

>  drivers/media/platform/omap3isp/isp.c |  113 --
>  drivers/media/platform/omap3isp/isp.h |4 +-
>  4 files changed, 66 insertions(+), 153 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
> index e945957..990338f 100644
> --- a/arch/arm/mach-omap2/devices.c
> +++ b/arch/arm/mach-omap2/devices.c
> @@ -74,72 +74,12 @@ omap_postcore_initcall(omap3_l3_init);
>  static struct resource omap3isp_resources[] = {
>   {
>   .start  = OMAP3430_ISP_BASE,
> - .end= OMAP3430_ISP_END,
> + .end= OMAP3430_ISP_BASE + 0x12fc,
>   .flags  = IORESOURCE_MEM,
>   },
>   {
> - .start  = OMAP3430_ISP_CCP2_BASE,
> - .end= OMAP3430_ISP_CCP2_END,
> - .flags  = IORESOURCE_MEM,
> - },
> - {
> - .start  = OMAP3430_ISP_CCDC_BASE,
> - .end= OMAP3430_ISP_CCDC_END,
> - .flags  = IORESOURCE_MEM,
> - },
> - {
> - .start  = OMAP3430_ISP_HIST_BASE,
> - .end= OMAP3430_ISP_HIST_END,
> - .flags  = IORESOURCE_MEM,
> - },
> - {
> - .start  = OMAP3430_ISP_H3A_BASE,
> - .end= OMAP3430_ISP_H3A_END,
> - .flags  = IORESOURCE_MEM,
> - },
> - {
> - .start  = OMAP3430_ISP_PREV_BASE,
> - .end= OMAP3430_ISP_PREV_END,
> - .flags  = IORESOURCE_MEM,
> - },
> - {
> - .start  = OMAP3430_ISP_RESZ_BASE,
> - .end= OMAP3430_ISP_RESZ_END,
> - .flags  = IORESOURCE_MEM,
> - },
> - {
> - .start  = OMAP3430_ISP_SBL_BASE,
> - .end= OMAP3430_ISP_SBL_END,
> - .flags  = IORESOURCE_MEM,
> - },
> - {
> - .start  = OMAP3430_ISP_CSI2A_REGS1_BASE,
> - .end= OMAP3430_ISP_CSI2A_REGS1_END,
> - .flags  = IORESOURCE_MEM,
> - },
> - {
> - .start  = OMAP3430_ISP_CSIPHY2_BASE,
> - .end= OMAP3430_ISP_CSIPHY2_END,
> - .flags  = IORESOURCE_MEM,
> - },
> - {
> - .start  = OMAP3630_ISP_CSI2A_REGS2_BASE,
> - .end= OMAP3630_ISP_CSI2A_REGS2_END,
> - .flags  = IORESOURCE_MEM,
> - },
> - {
> - .start  = OMAP3630_ISP_CSI2C_REGS1_BASE,
> - .end= OMAP3630_ISP_CSI2C_REGS1_END,
> - .flags  = IORESOURCE_MEM,
> - },
> - {
> - .start  = OMAP3630_ISP_CSIPHY1_BASE,
> - .end= OMAP3630_ISP_CSIPHY1_END,
> - .flags  = IORESOURCE_MEM,
> - },
> - {
> - .start  = OMAP3630_ISP_CSI2C_REGS2_BASE,
> - .end= OMAP3630_ISP_CSI2C_REGS2_END,
> + .start  = OMAP3430_ISP_BASE2,
> + .end= OMAP3430_ISP_BASE2 + 0x0600,
>   .flags  = IORESOURCE_MEM,
>   },
>   {
> diff --git a/arch/arm/mach-omap2/omap34xx.h b/arch/arm/mach-omap2/omap34xx.h
> index c0d1b4b..ed0024d 100644
> --- a/arch/arm/mach-omap2/omap34xx.h
> +++ b/arch/arm/mach-omap2/omap34xx.h
> @@ -46,39 +46,9 @@
> 
>  #define OMAP34XX_IC_BASE 0x4820
> 
> -#define OMAP3430_ISP_BASE(L4_34XX_BASE + 0xBC000)
> -#define OMAP3430_ISP_CBUFF_BASE  (OMAP3430_ISP_BASE + 0x0100)
> -#define OMAP3430_ISP_CCP2_BASE   (OMAP3430_ISP_BASE + 0x0400)
> -#define OMAP3430_ISP_CCDC_BASE   (OMAP3430_ISP_BASE + 0x0600)
> -#define OMAP3430_ISP_HIST_BASE   (OMAP3430_ISP_BASE + 0x0A00)
> -#define OMAP3430_ISP_H3A_BASE(OMAP3430_ISP_BASE + 0x0C00)
> -#define OMAP3430_ISP_PREV_BASE   (OMAP3430_ISP_BASE + 0x0E00)
> -#define OMAP3430_ISP_RESZ_BASE   (OMAP3430_ISP_BASE + 0x1000)
> -#

Re: [RFC 18/18] omap3isp: Deprecate platform data support

2015-03-07 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

On Saturday 07 March 2015 23:41:15 Sakari Ailus wrote:
> Print a warning when the driver is used with platform data. Existing
> platform data user should move to DT now.
> 
> Signed-off-by: Sakari Ailus 

Acked-by: Laurent Pinchart 

> ---
>  drivers/media/platform/omap3isp/isp.c |2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/media/platform/omap3isp/isp.c
> b/drivers/media/platform/omap3isp/isp.c index 2c9bc0d..e4a78bb 100644
> --- a/drivers/media/platform/omap3isp/isp.c
> +++ b/drivers/media/platform/omap3isp/isp.c
> @@ -2447,6 +2447,8 @@ static int isp_probe(struct platform_device *pdev)
>   isp->syscon = syscon_regmap_lookup_by_pdevname("syscon.0");
>   if (IS_ERR(isp->syscon))
>   return PTR_ERR(isp->syscon);
> + dev_warn(&pdev->dev,
> +  "Platform data support is deprecated! Please move to 
> DT now!
\n");
>   }
> 
>   isp->autoidle = autoidle;

-- 
Regards,

Laurent Pinchart

--
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: [RFC 10/18] omap3isp: Move the syscon register out of the ISP register maps

2015-03-07 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

(CC'ing linux-omap and Tony)

On Saturday 07 March 2015 23:41:07 Sakari Ailus wrote:
> The syscon register isn't part of the ISP, use it through the syscom driver
> regmap instead. The syscom block is considered to be from 343x on ISP
> revision 2.0 whereas 15.0 is assumed to have 3630 syscon.
> 
> Signed-off-by: Sakari Ailus 
> ---
>  arch/arm/boot/dts/omap3.dtsi|2 +-
>  arch/arm/mach-omap2/devices.c   |   10 --
>  drivers/media/platform/omap3isp/isp.c   |   19 +++
>  drivers/media/platform/omap3isp/isp.h   |   19 +--
>  drivers/media/platform/omap3isp/ispcsiphy.c |   20 +---

You might be asked to split the patch into two, let's see what Tony says.

>  5 files changed, 42 insertions(+), 28 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
> index 01b7111..fe0b293 100644
> --- a/arch/arm/boot/dts/omap3.dtsi
> +++ b/arch/arm/boot/dts/omap3.dtsi
> @@ -183,7 +183,7 @@
> 
>   omap3_scm_general: tisyscon@48002270 {
>   compatible = "syscon";
> - reg = <0x48002270 0x2f0>;
> + reg = <0x48002270 0x2f4>;
>   };
> 
>   pbias_regulator: pbias_regulator {
> diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
> index 1afb50d..e945957 100644
> --- a/arch/arm/mach-omap2/devices.c
> +++ b/arch/arm/mach-omap2/devices.c
> @@ -143,16 +143,6 @@ static struct resource omap3isp_resources[] = {
>   .flags  = IORESOURCE_MEM,
>   },
>   {
> - .start  = OMAP343X_CTRL_BASE + OMAP343X_CONTROL_CSIRXFE,
> - .end= OMAP343X_CTRL_BASE + OMAP343X_CONTROL_CSIRXFE 
> + 3,
> - .flags  = IORESOURCE_MEM,
> - },
> - {
> - .start  = OMAP343X_CTRL_BASE + 
> OMAP3630_CONTROL_CAMERA_PHY_CTRL,
> - .end= OMAP343X_CTRL_BASE + 
> OMAP3630_CONTROL_CAMERA_PHY_CTRL + 3,
> - .flags  = IORESOURCE_MEM,
> - },
> - {
>   .start  = 24 + OMAP_INTC_START,
>   .flags  = IORESOURCE_IRQ,
>   }
> diff --git a/drivers/media/platform/omap3isp/isp.c
> b/drivers/media/platform/omap3isp/isp.c index 68d7edfc..4ff4bbd 100644
> --- a/drivers/media/platform/omap3isp/isp.c
> +++ b/drivers/media/platform/omap3isp/isp.c
> @@ -51,6 +51,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -94,8 +95,9 @@ static const struct isp_res_mapping isp_res_maps[] = {
>  1 << OMAP3_ISP_IOMEM_RESZ |
>  1 << OMAP3_ISP_IOMEM_SBL |
>  1 << OMAP3_ISP_IOMEM_CSI2A_REGS1 |
> -1 << OMAP3_ISP_IOMEM_CSIPHY2 |
> -1 << OMAP3_ISP_IOMEM_343X_CONTROL_CSIRXFE,
> +1 << OMAP3_ISP_IOMEM_CSIPHY2,
> + .syscon_offset = 0xdc,
> + .phy_type = ISP_PHY_TYPE_3430,
>   },
>   {
>   .isp_rev = ISP_REVISION_15_0,
> @@ -112,8 +114,9 @@ static const struct isp_res_mapping isp_res_maps[] = {
>  1 << OMAP3_ISP_IOMEM_CSI2A_REGS2 |
>  1 << OMAP3_ISP_IOMEM_CSI2C_REGS1 |
>  1 << OMAP3_ISP_IOMEM_CSIPHY1 |
> -1 << OMAP3_ISP_IOMEM_CSI2C_REGS2 |
> -1 << OMAP3_ISP_IOMEM_3630_CONTROL_CAMERA_PHY_CTRL,
> +1 << OMAP3_ISP_IOMEM_CSI2C_REGS2,
> + .syscon_offset = 0x2f0,
> + .phy_type = ISP_PHY_TYPE_3630,
>   },
>  };
> 
> @@ -2352,6 +2355,14 @@ static int isp_probe(struct platform_device *pdev)
>   }
>   }
> 
> + isp->syscon = syscon_regmap_lookup_by_pdevname("syscon.0");
> + isp->syscon_offset = isp_res_maps[m].syscon_offset;
> + isp->phy_type = isp_res_maps[m].phy_type;

You could move those two lines after the error check to keep the check closer 
to the source of error.

Apart from that,

Acked-by: Laurent Pinchart 

> + if (IS_ERR(isp->syscon)) {
> + ret = PTR_ERR(isp->syscon);
> + goto error_isp;
> + }
> +
>   /* IOMMU */
>   ret = isp_attach_iommu(isp);
>   if (ret < 0) {
> diff --git a/drivers/media/platform/omap3isp/isp.h
> b/drivers/media/platform/omap3isp/isp.h index 9535524..03d2129 100644
> --- a/drivers/media/platform/omap3isp/isp.h
> +++ b/drivers/media/platform/omap3isp/isp.h
> @@ -59,8 +59,6 @@ enum isp_mem_resources {
>   OMAP3_ISP_IOMEM_CSI2C_REGS1,
>   OMAP3_ISP_IOMEM_CSIPHY1,
>   OMAP3_ISP_IOMEM_CSI2C_REGS2,
> - OMAP3_ISP_IOMEM_343X_CONTROL_CSIRXFE,
> - OMAP3_ISP_IOMEM_3630_CONTROL_CAMERA_PHY_CTRL,
>   OMAP3_ISP_IOMEM_LAST
>  };
> 
> @@ -93,14 +91,25 @@ enum isp_subclk_resource {
>  /* ISP2P: OMAP 36xx */
>  #define ISP_REVISION_15_00xF0
> 
> +#define ISP_PHY_TY

Anspruch €950,000.00

2015-03-07 Thread Qatar Foundation


Liebe Begünstigte,

Sie wurden ausgewählt, um (€950.000,00 EURO) als Charity-Spenden / Hilfe der 
Qatar Foundation erhalten. Kontaktieren Sie uns über E-Mail für weitere 
Informationen;

Mit freundlichen Grüßen,
Ingenieur Saad Al Muhannadi.
Kontakt e-mail: saadalm...@gmail.com

Präsident der Qatar Foundation.
--
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


[GIT PULL v2 for v4.1] smiapp DT u64 property workaround removal

2015-03-07 Thread Sakari Ailus
Hi Mauro,

This pull request reverts the smiapp driver's u64 array DT property read
workaround, and uses of_property_read_u64_array() which is the correct API
function for reading u64 arrays from DT.

since v1:

Based on a discussion with Laurent, I merged the two patches. The commit
message of the second patch remains the same while it includes the revert.

Please pull.


The following changes since commit 3d945be05ac1e806af075e9315bc1b3409adae2b:

  [media] mn88473: simplify bandwidth registers setting code (2015-03-03 
13:09:12 -0300)

are available in the git repository at:

  ssh://linuxtv.org/git/sailus/media_tree.git tags/smiapp-dt-2

for you to fetch changes up to e70a7fb677087253b83119ec3033e58a5720f97a:

  smiapp: Use of_property_read_u64_array() to read a 64-bit number array 
(2015-03-08 01:22:48 +0200)


Sakari Ailus (1):
  smiapp: Use of_property_read_u64_array() to read a 64-bit number array

 drivers/media/i2c/smiapp/smiapp-core.c |   28 +---
 1 file changed, 5 insertions(+), 23 deletions(-)

-- 
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: [RFC 09/18] omap3isp: Replace mmio_base_phys array with the histogram block base

2015-03-07 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

On Saturday 07 March 2015 23:41:06 Sakari Ailus wrote:
> Only the histogram sub-block driver uses the physical address. Do not store
> it for other sub-blocks.
> 
> Signed-off-by: Sakari Ailus 

Acked-by: Laurent Pinchart 

> ---
>  drivers/media/platform/omap3isp/isp.c |3 ++-
>  drivers/media/platform/omap3isp/isp.h |6 +++---
>  drivers/media/platform/omap3isp/isphist.c |2 +-
>  3 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/platform/omap3isp/isp.c
> b/drivers/media/platform/omap3isp/isp.c index c045318..68d7edfc 100644
> --- a/drivers/media/platform/omap3isp/isp.c
> +++ b/drivers/media/platform/omap3isp/isp.c
> @@ -2247,7 +2247,8 @@ static int isp_map_mem_resource(struct platform_device
> *pdev, if (IS_ERR(isp->mmio_base[res]))
>   return PTR_ERR(isp->mmio_base[res]);
> 
> - isp->mmio_base_phys[res] = mem->start;
> + if (res == OMAP3_ISP_IOMEM_HIST)
> + isp->mmio_hist_base_phys = mem->start;
> 
>   return 0;
>  }
> diff --git a/drivers/media/platform/omap3isp/isp.h
> b/drivers/media/platform/omap3isp/isp.h index b932a6f..9535524 100644
> --- a/drivers/media/platform/omap3isp/isp.h
> +++ b/drivers/media/platform/omap3isp/isp.h
> @@ -138,8 +138,8 @@ struct isp_xclk {
>   * @irq_num: Currently used IRQ number.
>   * @mmio_base: Array with kernel base addresses for ioremapped ISP register
> * regions.
> - * @mmio_base_phys: Array with physical L4 bus addresses for ISP register
> - *  regions.
> + * @mmio_hist_base_phys: Physical L4 bus address for ISP hist block
> register + *   region.
>   * @mapping: IOMMU mapping
>   * @stat_lock: Spinlock for handling statistics
>   * @isp_mutex: Mutex for serializing requests to ISP.
> @@ -175,7 +175,7 @@ struct isp_device {
>   unsigned int irq_num;
> 
>   void __iomem *mmio_base[OMAP3_ISP_IOMEM_LAST];
> - unsigned long mmio_base_phys[OMAP3_ISP_IOMEM_LAST];
> + unsigned long mmio_hist_base_phys;
> 
>   struct dma_iommu_mapping *mapping;
> 
> diff --git a/drivers/media/platform/omap3isp/isphist.c
> b/drivers/media/platform/omap3isp/isphist.c index ce822c3..3bb9c4f 100644
> --- a/drivers/media/platform/omap3isp/isphist.c
> +++ b/drivers/media/platform/omap3isp/isphist.c
> @@ -70,7 +70,7 @@ static void hist_dma_config(struct ispstat *hist)
>   hist->dma_config.sync_mode = OMAP_DMA_SYNC_ELEMENT;
>   hist->dma_config.frame_count = 1;
>   hist->dma_config.src_amode = OMAP_DMA_AMODE_CONSTANT;
> - hist->dma_config.src_start = isp->mmio_base_phys[OMAP3_ISP_IOMEM_HIST]
> + hist->dma_config.src_start = isp->mmio_hist_base_phys
>  + ISPHIST_DATA;
>   hist->dma_config.dst_amode = OMAP_DMA_AMODE_POST_INC;
>   hist->dma_config.src_or_dst_synch = OMAP_DMA_SRC_SYNC;

-- 
Regards,

Laurent Pinchart

--
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: [RFC 08/18] omap3isp: Calculate vpclk_div for CSI-2

2015-03-07 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

On Saturday 07 March 2015 23:41:05 Sakari Ailus wrote:
> The video port clock is l3_ick divided by vpclk_div. This clock must be high
> enough for the external pixel rate. The video port requires two clock
> cycles to process a pixel.
> 
> Signed-off-by: Sakari Ailus 

Acked-by: Laurent Pinchart 

> ---
>  drivers/media/platform/omap3isp/ispcsi2.c |8 +++-
>  include/media/omap3isp.h  |2 --
>  2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/platform/omap3isp/ispcsi2.c
> b/drivers/media/platform/omap3isp/ispcsi2.c index 14d279d..97cdfeb 100644
> --- a/drivers/media/platform/omap3isp/ispcsi2.c
> +++ b/drivers/media/platform/omap3isp/ispcsi2.c
> @@ -548,6 +548,7 @@ int omap3isp_csi2_reset(struct isp_csi2_device *csi2)
> 
>  static int csi2_configure(struct isp_csi2_device *csi2)
>  {
> + struct isp_pipeline *pipe = to_isp_pipeline(&csi2->subdev.entity);
>   const struct isp_bus_cfg *buscfg;
>   struct isp_device *isp = csi2->isp;
>   struct isp_csi2_timing_cfg *timing = &csi2->timing[0];
> @@ -570,7 +571,12 @@ static int csi2_configure(struct isp_csi2_device *csi2)
> csi2->frame_skip = 0;
>   v4l2_subdev_call(sensor, sensor, g_skip_frames, &csi2->frame_skip);
> 
> - csi2->ctrl.vp_out_ctrl = buscfg->bus.csi2.vpclk_div;
> + csi2->ctrl.vp_out_ctrl =
> + clamp_t(unsigned int, pipe->l3_ick / pipe->external_rate - 1,
> + 1, 3);
> + dev_dbg(isp->dev, "%s: l3_ick %lu, external_rate %u, vp_out_ctrl %u\n",
> + __func__, pipe->l3_ick,  pipe->external_rate,
> + csi2->ctrl.vp_out_ctrl);
>   csi2->ctrl.frame_mode = ISP_CSI2_FRAME_IMMEDIATE;
>   csi2->ctrl.ecc_enable = buscfg->bus.csi2.crc;
> 
> diff --git a/include/media/omap3isp.h b/include/media/omap3isp.h
> index 39e0748..0f0c08b 100644
> --- a/include/media/omap3isp.h
> +++ b/include/media/omap3isp.h
> @@ -129,11 +129,9 @@ struct isp_ccp2_cfg {
>  /**
>   * struct isp_csi2_cfg - CSI2 interface configuration
>   * @crc: Enable the cyclic redundancy check
> - * @vpclk_div: Video port output clock control
>   */
>  struct isp_csi2_cfg {
>   unsigned crc:1;
> - unsigned vpclk_div:2;
>   struct isp_csiphy_lanes_cfg lanecfg;
>  };

-- 
Regards,

Laurent Pinchart

--
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: [RFC 07/18] omap3isp: Rename regulators to better suit the Device Tree

2015-03-07 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

On Saturday 07 March 2015 23:41:04 Sakari Ailus wrote:
> Rename VDD_CSIPHY1 as vdd-csiphy1 and VDD_CSIPHY2 as vdd-csiphy2.
> 
> Signed-off-by: Sakari Ailus 

Acked-by: Laurent Pinchart 

> ---
>  drivers/media/platform/omap3isp/isp.c |4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/omap3isp/isp.c
> b/drivers/media/platform/omap3isp/isp.c index 1b5c6df..c045318 100644
> --- a/drivers/media/platform/omap3isp/isp.c
> +++ b/drivers/media/platform/omap3isp/isp.c
> @@ -2292,8 +2292,8 @@ static int isp_probe(struct platform_device *pdev)
>   platform_set_drvdata(pdev, isp);
> 
>   /* Regulators */
> - isp->isp_csiphy1.vdd = devm_regulator_get(&pdev->dev, "VDD_CSIPHY1");
> - isp->isp_csiphy2.vdd = devm_regulator_get(&pdev->dev, "VDD_CSIPHY2");
> + isp->isp_csiphy1.vdd = devm_regulator_get(&pdev->dev, "vdd-csiphy1");
> + isp->isp_csiphy2.vdd = devm_regulator_get(&pdev->dev, "vdd-csiphy2");
> 
>   /* Clocks
>*

-- 
Regards,

Laurent Pinchart

--
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: [RFC 03/18] omap3isp: Separate external link creation from platform data parsing

2015-03-07 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

On Saturday 07 March 2015 23:41:00 Sakari Ailus wrote:
> Move the code which connects the external entity to an ISP entity into a
> separate function. This disconnects it from parsing the platform data.
> 
> Signed-off-by: Sakari Ailus 
> ---
>  drivers/media/platform/omap3isp/isp.c |  147  +++--
>  1 file changed, 74 insertions(+), 73 deletions(-)
> 
> diff --git a/drivers/media/platform/omap3isp/isp.c
> b/drivers/media/platform/omap3isp/isp.c index 4ab674d..a607f26 100644
> --- a/drivers/media/platform/omap3isp/isp.c
> +++ b/drivers/media/platform/omap3isp/isp.c
> @@ -1832,6 +1832,77 @@ isp_register_subdev_group(struct isp_device *isp,
>   return sensor;
>  }
> 
> +static int isp_link_entity(
> + struct isp_device *isp, struct media_entity *entity,
> + enum isp_interface_type interface)
> +{
> + struct media_entity *input;
> + unsigned int flags;
> + unsigned int pad;
> + unsigned int i;
> +
> + /* Connect the sensor to the correct interface module.
> +  * Parallel sensors are connected directly to the CCDC, while
> +  * serial sensors are connected to the CSI2a, CCP2b or CSI2c
> +  * receiver through CSIPHY1 or CSIPHY2.
> +  */
> + switch (interface) {
> + case ISP_INTERFACE_PARALLEL:
> + input = &isp->isp_ccdc.subdev.entity;
> + pad = CCDC_PAD_SINK;
> + flags = 0;
> + break;
> +
> + case ISP_INTERFACE_CSI2A_PHY2:
> + input = &isp->isp_csi2a.subdev.entity;
> + pad = CSI2_PAD_SINK;
> + flags = MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED;
> + break;
> +
> + case ISP_INTERFACE_CCP2B_PHY1:
> + case ISP_INTERFACE_CCP2B_PHY2:
> + input = &isp->isp_ccp2.subdev.entity;
> + pad = CCP2_PAD_SINK;
> + flags = 0;
> + break;
> +
> + case ISP_INTERFACE_CSI2C_PHY1:
> + input = &isp->isp_csi2c.subdev.entity;
> + pad = CSI2_PAD_SINK;
> + flags = MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED;
> + break;
> +
> + default:
> + dev_err(isp->dev, "%s: invalid interface type %u\n", __func__,
> + interface);
> + return -EINVAL;
> + }
> +
> + /*
> +  * Not all interfaces are available on all revisions of the
> +  * ISP. The sub-devices of those interfaces aren't initialised
> +  * in such a case. Check this by ensuring the num_pads is
> +  * non-zero.
> +  */
> + if (!input->num_pads) {
> + dev_err(isp->dev, "%s: invalid input %u\n", entity->name,
> + interface);
> + return -EINVAL;
> + }
> +
> + for (i = 0; i < entity->num_pads; i++) {
> + if (entity->pads[i].flags & MEDIA_PAD_FL_SOURCE)
> + break;
> + }
> + if (i == entity->num_pads) {
> + dev_err(isp->dev, "%s: no source pad in external entity\n",
> + __func__);
> + return -EINVAL;
> + }
> +
> + return media_entity_create_link(entity, i, input, pad, flags);
> +}
> +
>  static int isp_register_entities(struct isp_device *isp)
>  {
>   struct isp_platform_data *pdata = isp->pdata;
> @@ -1894,85 +1965,15 @@ static int isp_register_entities(struct isp_device
> *isp)
> 
>   /* Register external entities */
>   for (subdevs = pdata->subdevs; subdevs && subdevs->subdevs; ++subdevs) {
> - struct v4l2_subdev *sensor;
> - struct media_entity *input;
> - unsigned int flags;
> - unsigned int pad;
> - unsigned int i;
> + struct v4l2_subdev *sensor =
> + isp_register_subdev_group(isp, subdevs->subdevs);
> 
> - sensor = isp_register_subdev_group(isp, subdevs->subdevs);

Nit-picking a bit, I'd keep the variable declaration and the function call 
separate here, as isp_register_subdev_group() is much more than an 
initializer. Apart from that,

Acked-by: Laurent Pinchart 

>   if (sensor == NULL)
>   continue;
> 
>   sensor->host_priv = subdevs;
> 
> - /* Connect the sensor to the correct interface module. Parallel
> -  * sensors are connected directly to the CCDC, while serial
> -  * sensors are connected to the CSI2a, CCP2b or CSI2c receiver
> -  * through CSIPHY1 or CSIPHY2.
> -  */
> - switch (subdevs->interface) {
> - case ISP_INTERFACE_PARALLEL:
> - input = &isp->isp_ccdc.subdev.entity;
> - pad = CCDC_PAD_SINK;
> - flags = 0;
> - break;
> -
> - case ISP_INTERFACE_CSI2A_PHY2:
> - input = &isp->isp_csi2a.subdev.entity;
> - pad = CSI2_PAD_SINK;
> - flags = MEDIA

Re: [GIT PULL for v4.1] smiapp DT u64 property workaround removal

2015-03-07 Thread Laurent Pinchart
Hi Sakari,

On Sunday 08 March 2015 01:20:40 Sakari Ailus wrote:
> On Sun, Mar 08, 2015 at 01:15:38AM +0200, Laurent Pinchart wrote:
> > > Sakari Ailus (2):
> > >   Revert "[media] smiapp: Don't compile of_read_number() if
> > >   CONFIG_OF isn't defined"
> > >   smiapp: Use of_property_read_u64_array() to read a 64-bit number
> > >   array
> > 
> > Won't this cause a bisection breakage if CONFIG_OF isn't enabled ?
> 
> Technically you're right: it does "break" bisect if smiapp is compiled in on
> a non-DT platform. Such a platform is not supported in a mainline kernel so
> I don't think this is a really major issue.
> 
> I could combine the patches if you think this is an issue.

It would break bisection with allmodconfig on non-DT platforms for instance. I 
think combining the two patches would make sense.

-- 
Regards,

Laurent Pinchart

--
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: [GIT PULL for v4.1] smiapp DT u64 property workaround removal

2015-03-07 Thread Sakari Ailus
Hi Laurent,

On Sun, Mar 08, 2015 at 01:15:38AM +0200, Laurent Pinchart wrote:
> > Sakari Ailus (2):
> >   Revert "[media] smiapp: Don't compile of_read_number() if CONFIG_OF
> > isn't defined"
> >   smiapp: Use of_property_read_u64_array() to read a 64-bit number array
> 
> Won't this cause a bisection breakage if CONFIG_OF isn't enabled ?

Technically you're right: it does "break" bisect if smiapp is compiled in on
a non-DT platform. Such a platform is not supported in a mainline kernel so
I don't think this is a really major issue.

I could combine the patches if you think this is an issue.

-- 
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: [RFC 02/18] omap3isp: Avoid a BUG_ON() in media_entity_create_link()

2015-03-07 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

On Saturday 07 March 2015 23:40:59 Sakari Ailus wrote:
> If an uninitialised v4l2_subdev struct was passed to
> media_entity_create_link(), one of the BUG_ON()'s in the function will be
> hit since media_entity.num_pads will be zero. Avoid this by checking whether
> the num_pads field is non-zero for the interface.
> 
> Signed-off-by: Sakari Ailus 

Acked-by: Laurent Pinchart 

> ---
>  drivers/media/platform/omap3isp/isp.c |   13 +
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/media/platform/omap3isp/isp.c
> b/drivers/media/platform/omap3isp/isp.c index fb193b6..4ab674d 100644
> --- a/drivers/media/platform/omap3isp/isp.c
> +++ b/drivers/media/platform/omap3isp/isp.c
> @@ -1946,6 +1946,19 @@ static int isp_register_entities(struct isp_device
> *isp) goto done;
>   }
> 
> + /*
> +  * Not all interfaces are available on all revisions
> +  * of the ISP. The sub-devices of those interfaces
> +  * aren't initialised in such a case. Check this by
> +  * ensuring the num_pads is non-zero.
> +  */
> + if (!input->num_pads) {
> + dev_err(isp->dev, "%s: invalid input %u\n",
> + entity->name, subdevs->interface);
> + ret = -EINVAL;
> + goto done;
> + }
> +
>   for (i = 0; i < sensor->entity.num_pads; i++) {
>   if (sensor->entity.pads[i].flags & MEDIA_PAD_FL_SOURCE)
>   break;

-- 
Regards,

Laurent Pinchart

--
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: [RFC 01/18] omap3isp: Fix error handling in probe

2015-03-07 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

On Saturday 07 March 2015 23:40:58 Sakari Ailus wrote:
> The mutex was not destroyed correctly if dma_coerce_mask_and_coherent()
> failed for some reason.
> 
> Signed-off-by: Sakari Ailus 

Acked-by: Laurent Pinchart 

> ---
>  drivers/media/platform/omap3isp/isp.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/omap3isp/isp.c
> b/drivers/media/platform/omap3isp/isp.c index deca809..fb193b6 100644
> --- a/drivers/media/platform/omap3isp/isp.c
> +++ b/drivers/media/platform/omap3isp/isp.c
> @@ -2252,7 +2252,7 @@ static int isp_probe(struct platform_device *pdev)
> 
>   ret = dma_coerce_mask_and_coherent(isp->dev, DMA_BIT_MASK(32));
>   if (ret)
> - return ret;
> + goto error;
> 
>   platform_set_drvdata(pdev, isp);

-- 
Regards,

Laurent Pinchart

--
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: [GIT PULL for v4.1] smiapp DT u64 property workaround removal

2015-03-07 Thread Laurent Pinchart
Hi Sakari,

On Sunday 08 March 2015 00:06:34 Sakari Ailus wrote:
> Hi Mauro,
> 
> This pull request reverts the smiapp driver's u64 array DT property read
> workaround, and uses of_property_read_u64_array() (second patch) which is
> the correct API function for reading u64 arrays from DT.
> 
> Please pull.
> 
> 
> The following changes since commit 3d945be05ac1e806af075e9315bc1b3409adae2b:
> 
>   [media] mn88473: simplify bandwidth registers setting code (2015-03-03
> 13:09:12 -0300)
> 
> are available in the git repository at:
> 
>   ssh://linuxtv.org/git/sailus/media_tree.git smiapp-dt
> 
> for you to fetch changes up to 5f36db86e0cbb48c102fee8a3fe2b98a33f13199:
> 
>   smiapp: Use of_property_read_u64_array() to read a 64-bit number array
> (2015-03-08 00:00:20 +0200)
> 
> 
> Sakari Ailus (2):
>   Revert "[media] smiapp: Don't compile of_read_number() if CONFIG_OF
> isn't defined"
>   smiapp: Use of_property_read_u64_array() to read a 64-bit number array

Won't this cause a bisection breakage if CONFIG_OF isn't enabled ?

>  drivers/media/i2c/smiapp/smiapp-core.c |   28 +---
>  1 file changed, 5 insertions(+), 23 deletions(-)

-- 
Regards,

Laurent Pinchart

--
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 v3] media: i2c: add support for omnivision's ov2659 sensor

2015-03-07 Thread Paul Bolle
On Sat, 2015-03-07 at 15:21 +, Lad Prabhakar wrote:
> --- /dev/null
> +++ b/drivers/media/i2c/ov2659.c
> @@ -0,0 +1,1495 @@
> +/*
> + * Omnivision OV2659 CMOS Image Sensor driver
> + *
> + * Copyright (C) 2015 Texas Instruments, Inc.
> + *
> + * Benoit Parrot 
> + * Lad, Prabhakar 
> + *
> + * This program is free software; you may redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; version 2 of the License.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
> + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
> + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
> + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> + * SOFTWARE.
> + */

This states the license of this modules is GPL v2.

> +MODULE_LICENSE("GPL");

So you probably want
MODULE_LICENSE("GPL v2");

here.

(If you think this is a bit silly, and somewhere I think so too, you're
invited to jump into the discussion starting at
https://lkml.org/lkml/2015/3/7/119 .)



Paul Bolle

--
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


[GIT PULL for v4.1] smiapp sparse fix

2015-03-07 Thread Sakari Ailus
Hi Mauro,

Just a single patch, a trivial sparse fix to make a variable which is only
used in a single file, static.

Please pull.


The following changes since commit 3d945be05ac1e806af075e9315bc1b3409adae2b:

  [media] mn88473: simplify bandwidth registers setting code (2015-03-03 
13:09:12 -0300)

are available in the git repository at:

  ssh://linuxtv.org/git/sailus/media_tree.git smiapp-sparse-fix

for you to fetch changes up to e52b738434e74f05534a4475161e846c3bf390c4:

  smiapp: Make pixel_order_str static (2015-03-08 00:49:06 +0200)


Sakari Ailus (1):
  smiapp: Make pixel_order_str static

 drivers/media/i2c/smiapp/smiapp-core.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
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


[GIT PULL for v4.1] smiapp DT u64 property workaround removal

2015-03-07 Thread Sakari Ailus
Hi Mauro,

This pull request reverts the smiapp driver's u64 array DT property read
workaround, and uses of_property_read_u64_array() (second patch) which is
the correct API function for reading u64 arrays from DT.

Please pull.


The following changes since commit 3d945be05ac1e806af075e9315bc1b3409adae2b:

  [media] mn88473: simplify bandwidth registers setting code (2015-03-03 
13:09:12 -0300)

are available in the git repository at:

  ssh://linuxtv.org/git/sailus/media_tree.git smiapp-dt

for you to fetch changes up to 5f36db86e0cbb48c102fee8a3fe2b98a33f13199:

  smiapp: Use of_property_read_u64_array() to read a 64-bit number array 
(2015-03-08 00:00:20 +0200)


Sakari Ailus (2):
  Revert "[media] smiapp: Don't compile of_read_number() if CONFIG_OF isn't 
defined"
  smiapp: Use of_property_read_u64_array() to read a 64-bit number array

 drivers/media/i2c/smiapp/smiapp-core.c |   28 +---
 1 file changed, 5 insertions(+), 23 deletions(-)

-- 
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 v3] media: i2c: add support for omnivision's ov2659 sensor

2015-03-07 Thread Sakari Ailus
Hi Prabhakar,

On Sat, Mar 07, 2015 at 03:21:40PM +, Lad Prabhakar wrote:
> + pixel-clock-frequency = <7000>;

As commented privately, could you use the link-frequencies property for this
purpose? On parallel bus if often equals the pixel clock, but works much
better on serial busses.

It'd documented in video-interfaces.txt.

-- 
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


[RFC 18/18] omap3isp: Deprecate platform data support

2015-03-07 Thread Sakari Ailus
Print a warning when the driver is used with platform data. Existing
platform data user should move to DT now.

Signed-off-by: Sakari Ailus 
---
 drivers/media/platform/omap3isp/isp.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index 2c9bc0d..e4a78bb 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -2447,6 +2447,8 @@ static int isp_probe(struct platform_device *pdev)
isp->syscon = syscon_regmap_lookup_by_pdevname("syscon.0");
if (IS_ERR(isp->syscon))
return PTR_ERR(isp->syscon);
+   dev_warn(&pdev->dev,
+"Platform data support is deprecated! Please move to 
DT now!\n");
}
 
isp->autoidle = autoidle;
-- 
1.7.10.4

--
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


[RFC 17/18] arm: dts: n950, n9: Add primary camera support

2015-03-07 Thread Sakari Ailus
Add support for the primary camera of the Nokia N950 and N9.

Signed-off-by: Sakari Ailus 
---
 arch/arm/boot/dts/omap3-n9.dts   |   39 ++
 arch/arm/boot/dts/omap3-n950-n9.dtsi |4 
 arch/arm/boot/dts/omap3-n950.dts |   39 ++
 3 files changed, 78 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/omap3-n9.dts b/arch/arm/boot/dts/omap3-n9.dts
index 9938b5d..05f32ae 100644
--- a/arch/arm/boot/dts/omap3-n9.dts
+++ b/arch/arm/boot/dts/omap3-n9.dts
@@ -16,3 +16,42 @@
model = "Nokia N9";
compatible = "nokia,omap3-n9", "ti,omap36xx", "ti,omap3";
 };
+
+&i2c2 {
+   clock-frequency = <40>;
+
+   smia_1: camera@10 {
+   compatible = "nokia,smia";
+   reg = <0x10>;
+   /* No reset gpio */
+   vana-supply = <&vaux3>;
+   clocks = <&omap3_isp 0>;
+   clock-frequency = <960>;
+   nokia,nvm-size = <1024>; /* 16 * 64 */
+   link-frequencies = /bits/ 64 <19920 21000 49920>;
+   port {
+   smia_1_1: endpoint {
+   clock-lanes = <0>;
+   data-lanes = <1 2>;
+   remote-endpoint = <&csi2a_ep>;
+   };
+   };
+   };
+};
+
+&omap3_isp {
+   vdd-csiphy1-supply = <&vaux2>;
+   vdd-csiphy2-supply = <&vaux2>;
+   ports {
+   port@2 {
+   reg = <2>;
+   csi2a_ep: endpoint {
+   remote-endpoint = <&smia_1_1>;
+   clock-lanes = <2>;
+   data-lanes = <1 3>;
+   crc = <1>;
+   lane-polarity = <1 1 1>;
+   };
+   };
+   };
+};
diff --git a/arch/arm/boot/dts/omap3-n950-n9.dtsi 
b/arch/arm/boot/dts/omap3-n950-n9.dtsi
index c41db94..51e5043 100644
--- a/arch/arm/boot/dts/omap3-n950-n9.dtsi
+++ b/arch/arm/boot/dts/omap3-n950-n9.dtsi
@@ -86,10 +86,6 @@
regulator-max-microvolt = <280>;
 };
 
-&i2c2 {
-   clock-frequency = <40>;
-};
-
 &i2c3 {
clock-frequency = <40>;
 };
diff --git a/arch/arm/boot/dts/omap3-n950.dts b/arch/arm/boot/dts/omap3-n950.dts
index 261c558..2b2ed9c 100644
--- a/arch/arm/boot/dts/omap3-n950.dts
+++ b/arch/arm/boot/dts/omap3-n950.dts
@@ -16,3 +16,42 @@
model = "Nokia N950";
compatible = "nokia,omap3-n950", "ti,omap36xx", "ti,omap3";
 };
+
+&i2c2 {
+   clock-frequency = <40>;
+
+   smia_1: camera@10 {
+   compatible = "nokia,smia";
+   reg = <0x10>;
+   /* No reset gpio */
+   vana-supply = <&vaux3>;
+   clocks = <&omap3_isp 0>;
+   clock-frequency = <960>;
+   nokia,nvm-size = <1024>; /* 16 * 64 */
+   link-frequencies = /bits/ 64 <21000 33360 39840>;
+   port {
+   smia_1_1: endpoint {
+   clock-lanes = <0>;
+   data-lanes = <1 2>;
+   remote-endpoint = <&csi2a_ep>;
+   };
+   };
+   };
+};
+
+&omap3_isp {
+   vdd-csiphy1-supply = <&vaux2>;
+   vdd-csiphy2-supply = <&vaux2>;
+   ports {
+   port@2 {
+   reg = <2>;
+   csi2a_ep: endpoint {
+   remote-endpoint = <&smia_1_1>;
+   clock-lanes = <2>;
+   data-lanes = <3 1>;
+   crc = <1>;
+   lane-polarity = <1 1 1>;
+   };
+   };
+   };
+};
-- 
1.7.10.4

--
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


[RFC 01/18] omap3isp: Fix error handling in probe

2015-03-07 Thread Sakari Ailus
The mutex was not destroyed correctly if dma_coerce_mask_and_coherent()
failed for some reason.

Signed-off-by: Sakari Ailus 
---
 drivers/media/platform/omap3isp/isp.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index deca809..fb193b6 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -2252,7 +2252,7 @@ static int isp_probe(struct platform_device *pdev)
 
ret = dma_coerce_mask_and_coherent(isp->dev, DMA_BIT_MASK(32));
if (ret)
-   return ret;
+   goto error;
 
platform_set_drvdata(pdev, isp);
 
-- 
1.7.10.4

--
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


[RFC 14/18] dt: bindings: Add bindings for omap3isp

2015-03-07 Thread Sakari Ailus
Signed-off-by: Sakari Ailus 
---
 .../devicetree/bindings/media/ti,omap3isp.txt  |   64 
 MAINTAINERS|1 +
 2 files changed, 65 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/ti,omap3isp.txt

diff --git a/Documentation/devicetree/bindings/media/ti,omap3isp.txt 
b/Documentation/devicetree/bindings/media/ti,omap3isp.txt
new file mode 100644
index 000..2059524
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/ti,omap3isp.txt
@@ -0,0 +1,64 @@
+OMAP 3 ISP Device Tree bindings
+===
+
+More documentation on these bindings is available in
+video-interfaces.txt in the same directory.
+
+Required properties
+===
+
+compatible : "ti,omap3-isp"
+reg: a set of two register block physical addresses and
+ lengths
+interrupts : the interrupt number
+iommus : phandle of the IOMMU
+syscon : syscon phandle and register offset
+ti,phy-type: 0 -- 3430; 1 -- 3630
+#clock-cells   : Must be 1 --- the ISP provides two external clocks,
+ cam_xclka and cam_xclkb, at indices 0 and 1,
+ respectively. Please find more information on common
+ clock bindings in ../clock/clock-bindings.txt.
+
+Port nodes (optional)
+-
+
+reg: The interface:
+ 0 - parallel (CCDC)
+ 1 - CSIPHY1 -- CSI2C / CCP2B on 3630;
+ CSI1 -- CSIb on 3430
+ 2 - CSIPHY2 -- CSI2A / CCP2B on 3630;
+ CSI2 -- CSIa on 3430
+
+Optional properties
+===
+
+vdd-csiphy1-supply : voltage supply of the CSI-2 PHY 1
+vdd-csiphy2-supply : voltage supply of the CSI-2 PHY 2
+
+Endpoint nodes
+--
+
+lane-polarity  : lane polarity (required on CSI-2)
+ 0 -- not inverted; 1 -- inverted
+data-lanes : an array of data lanes from 1 to 3. The length can
+ be either 1 or 2. (required CSI-2)
+clock-lanes: the clock lane (from 1 to 3). (required on CSI-2)
+
+
+Example
+===
+
+   omap3_isp: omap3_isp@480bc000 {
+   compatible = "ti,omap3-isp";
+   reg = <0x480bc000 0x12fc
+  0x480bd800 0x0600>;
+   interrupts = <24>;
+   iommus = <&mmu_isp>;
+   syscon = <&omap3_scm_general 0x2f0>;
+   ti,phy-type = <1>;
+   #clock-cells = <1>;
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   };
+   };
diff --git a/MAINTAINERS b/MAINTAINERS
index ddc5a8c..cdeef39 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7079,6 +7079,7 @@ L:linux-media@vger.kernel.org
 S: Maintained
 F: drivers/media/platform/omap3isp/
 F: drivers/staging/media/omap4iss/
+F: Documentation/devicetree/bindings/media/ti,omap3isp.txt
 
 OMAP USB SUPPORT
 M: Felipe Balbi 
-- 
1.7.10.4

--
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


[RFC 11/18] omap3isp: Replace many MMIO regions by two

2015-03-07 Thread Sakari Ailus
The omap3isp MMIO register block is contiguous in the MMIO register space
apart from the fact that the ISP IOMMU register block is in the middle of
the area. Ioremap it at two occasions, and keep the rest of the layout of
the register space internal to the omap3isp driver.

Signed-off-by: Sakari Ailus 
---
 arch/arm/mach-omap2/devices.c |   66 +--
 arch/arm/mach-omap2/omap34xx.h|   36 +--
 drivers/media/platform/omap3isp/isp.c |  113 +
 drivers/media/platform/omap3isp/isp.h |4 +-
 4 files changed, 66 insertions(+), 153 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index e945957..990338f 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -74,72 +74,12 @@ omap_postcore_initcall(omap3_l3_init);
 static struct resource omap3isp_resources[] = {
{
.start  = OMAP3430_ISP_BASE,
-   .end= OMAP3430_ISP_END,
+   .end= OMAP3430_ISP_BASE + 0x12fc,
.flags  = IORESOURCE_MEM,
},
{
-   .start  = OMAP3430_ISP_CCP2_BASE,
-   .end= OMAP3430_ISP_CCP2_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3430_ISP_CCDC_BASE,
-   .end= OMAP3430_ISP_CCDC_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3430_ISP_HIST_BASE,
-   .end= OMAP3430_ISP_HIST_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3430_ISP_H3A_BASE,
-   .end= OMAP3430_ISP_H3A_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3430_ISP_PREV_BASE,
-   .end= OMAP3430_ISP_PREV_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3430_ISP_RESZ_BASE,
-   .end= OMAP3430_ISP_RESZ_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3430_ISP_SBL_BASE,
-   .end= OMAP3430_ISP_SBL_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3430_ISP_CSI2A_REGS1_BASE,
-   .end= OMAP3430_ISP_CSI2A_REGS1_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3430_ISP_CSIPHY2_BASE,
-   .end= OMAP3430_ISP_CSIPHY2_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3630_ISP_CSI2A_REGS2_BASE,
-   .end= OMAP3630_ISP_CSI2A_REGS2_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3630_ISP_CSI2C_REGS1_BASE,
-   .end= OMAP3630_ISP_CSI2C_REGS1_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3630_ISP_CSIPHY1_BASE,
-   .end= OMAP3630_ISP_CSIPHY1_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3630_ISP_CSI2C_REGS2_BASE,
-   .end= OMAP3630_ISP_CSI2C_REGS2_END,
+   .start  = OMAP3430_ISP_BASE2,
+   .end= OMAP3430_ISP_BASE2 + 0x0600,
.flags  = IORESOURCE_MEM,
},
{
diff --git a/arch/arm/mach-omap2/omap34xx.h b/arch/arm/mach-omap2/omap34xx.h
index c0d1b4b..ed0024d 100644
--- a/arch/arm/mach-omap2/omap34xx.h
+++ b/arch/arm/mach-omap2/omap34xx.h
@@ -46,39 +46,9 @@
 
 #define OMAP34XX_IC_BASE   0x4820
 
-#define OMAP3430_ISP_BASE  (L4_34XX_BASE + 0xBC000)
-#define OMAP3430_ISP_CBUFF_BASE(OMAP3430_ISP_BASE + 0x0100)
-#define OMAP3430_ISP_CCP2_BASE (OMAP3430_ISP_BASE + 0x0400)
-#define OMAP3430_ISP_CCDC_BASE (OMAP3430_ISP_BASE + 0x0600)
-#define OMAP3430_ISP_HIST_BASE (OMAP3430_ISP_BASE + 0x0A00)
-#define OMAP3430_ISP_H3A_BASE  (OMAP3430_ISP_BASE + 0x0C00)
-#define OMAP3430_ISP_PREV_BASE (OMAP3430_ISP_BASE + 0x0E00)
-#define OMAP3430_ISP_RESZ_BASE (OMAP3430_ISP_BASE + 0x1000)
-#define OMAP3430_ISP_SBL_BASE  (OMAP3430_ISP_BASE + 0x1200)
-#define OMAP3430_ISP_MMU_BASE  (OMAP3430_ISP_BASE + 0x1400)
-#define OMAP3430_ISP_CSI2A_REGS1_BASE  (OMAP3430_ISP_BASE + 0x1800)
-#define OMAP3430_ISP_CSIPHY2_BASE  (OMAP3430_ISP_BASE + 0x1970)
-#define OMAP3630_ISP_CSI2A_REGS2_BASE  (OMAP3430_ISP_BASE + 0x19C0)
-#define OMAP3630_ISP_CSI2C_REGS1_BASE  (OMAP3430_ISP_BASE + 0x1C00)
-#define OMAP3630_ISP_CSIPHY1_BASE 

[RFC 16/18] arm: dts: omap3: Add DT entries for OMAP 3

2015-03-07 Thread Sakari Ailus
The resources the ISP needs are slightly different on 3[45]xx and 3[67]xx.
Especially the phy-type property is different.

Signed-off-by: Sakari Ailus 
---
 arch/arm/boot/dts/omap34xx.dtsi |   15 +++
 arch/arm/boot/dts/omap36xx.dtsi |   15 +++
 2 files changed, 30 insertions(+)

diff --git a/arch/arm/boot/dts/omap34xx.dtsi b/arch/arm/boot/dts/omap34xx.dtsi
index 3819c1e..4c034d0 100644
--- a/arch/arm/boot/dts/omap34xx.dtsi
+++ b/arch/arm/boot/dts/omap34xx.dtsi
@@ -37,6 +37,21 @@
pinctrl-single,register-width = <16>;
pinctrl-single,function-mask = <0xff1f>;
};
+
+   omap3_isp: omap3_isp@480bc000 {
+   compatible = "ti,omap3-isp";
+   reg = <0x480bc000 0x12fc
+  0x480bd800 0x017c>;
+   interrupts = <24>;
+   iommus = <&mmu_isp>;
+   syscon = <&omap3_scm_general 0xdc>;
+   ti,phy-type = <0>;
+   #clock-cells = <1>;
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   };
+   };
};
 };
 
diff --git a/arch/arm/boot/dts/omap36xx.dtsi b/arch/arm/boot/dts/omap36xx.dtsi
index 541704a..31ac41c 100644
--- a/arch/arm/boot/dts/omap36xx.dtsi
+++ b/arch/arm/boot/dts/omap36xx.dtsi
@@ -69,6 +69,21 @@
pinctrl-single,register-width = <16>;
pinctrl-single,function-mask = <0xff1f>;
};
+
+   omap3_isp: omap3_isp@480bc000 {
+   compatible = "ti,omap3-isp";
+   reg = <0x480bc000 0x12fc
+  0x480bd800 0x0600>;
+   interrupts = <24>;
+   iommus = <&mmu_isp>;
+   syscon = <&omap3_scm_general 0x2f0>;
+   ti,phy-type = <1>;
+   #clock-cells = <1>;
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   };
+   };
};
 };
 
-- 
1.7.10.4

--
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


[RFC 04/18] omap3isp: DT support for clocks

2015-03-07 Thread Sakari Ailus
From: Laurent Pinchart 

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/omap3isp/isp.c |   25 +
 1 file changed, 25 insertions(+)

diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index a607f26..01356dd 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -279,9 +279,21 @@ static const struct clk_init_data isp_xclk_init_data = {
.num_parents = 1,
 };
 
+static struct clk *isp_xclk_src_get(struct of_phandle_args *clkspec, void 
*data)
+{
+   unsigned int idx = clkspec->args[0];
+   struct isp_device *isp = data;
+
+   if (idx >= ARRAY_SIZE(isp->xclks))
+   return ERR_PTR(-ENOENT);
+
+   return isp->xclks[idx].clk;
+}
+
 static int isp_xclk_init(struct isp_device *isp)
 {
struct isp_platform_data *pdata = isp->pdata;
+   struct device_node *np = isp->dev->of_node;
struct clk_init_data init;
unsigned int i;
 
@@ -312,6 +324,12 @@ static int isp_xclk_init(struct isp_device *isp)
if (IS_ERR(xclk->clk))
return PTR_ERR(xclk->clk);
 
+   /* When instantiated from DT we don't need to register clock
+* aliases.
+*/
+   if (np)
+   continue;
+
if (pdata->xclks[i].con_id == NULL &&
pdata->xclks[i].dev_id == NULL)
continue;
@@ -327,13 +345,20 @@ static int isp_xclk_init(struct isp_device *isp)
clkdev_add(xclk->lookup);
}
 
+   if (np)
+   of_clk_add_provider(np, isp_xclk_src_get, isp);
+
return 0;
 }
 
 static void isp_xclk_cleanup(struct isp_device *isp)
 {
+   struct device_node *np = isp->dev->of_node;
unsigned int i;
 
+   if (np)
+   of_clk_del_provider(np);
+
for (i = 0; i < ARRAY_SIZE(isp->xclks); ++i) {
struct isp_xclk *xclk = &isp->xclks[i];
 
-- 
1.7.10.4

--
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


[RFC 12/18] dt: bindings: Add lane-polarity property to endpoint nodes

2015-03-07 Thread Sakari Ailus
Add lane-polarity property to endpoint nodes. This essentially tells that
the order of the differential signal wires is inverted.

Signed-off-by: Sakari Ailus 
---
 Documentation/devicetree/bindings/media/video-interfaces.txt |5 +
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/video-interfaces.txt 
b/Documentation/devicetree/bindings/media/video-interfaces.txt
index 571b4c6..058d1e6 100644
--- a/Documentation/devicetree/bindings/media/video-interfaces.txt
+++ b/Documentation/devicetree/bindings/media/video-interfaces.txt
@@ -106,6 +106,11 @@ Optional endpoint properties
 - link-frequencies: Allowed data bus frequencies. For MIPI CSI-2, for
   instance, this is the actual frequency of the bus, not bits per clock per
   lane value. An array of 64-bit unsigned integers.
+- lane-polarity: an array of polarities of the lanes starting from the clock
+  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.
+  This property is valid for serial busses only.
 
 
 Example
-- 
1.7.10.4

--
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


[RFC 13/18] v4l: of: Read lane-polarity endpoint property

2015-03-07 Thread Sakari Ailus
Add lane_polarity field to struct v4l2_of_bus_mipi_csi2 and write the
contents of the lane polarity property to it. The field tells the polarity
of the physical lanes starting from the first one. Any unused lanes are
ignored, i.e. only the polarity of the used lanes is specified.

Signed-off-by: Sakari Ailus 
---
 drivers/media/v4l2-core/v4l2-of.c |   21 -
 include/media/v4l2-of.h   |3 +++
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-of.c 
b/drivers/media/v4l2-core/v4l2-of.c
index b4ed9a9..a7a855e 100644
--- a/drivers/media/v4l2-core/v4l2-of.c
+++ b/drivers/media/v4l2-core/v4l2-of.c
@@ -23,7 +23,6 @@ static void v4l2_of_parse_csi_bus(const struct device_node 
*node,
  struct v4l2_of_endpoint *endpoint)
 {
struct v4l2_of_bus_mipi_csi2 *bus = &endpoint->bus.mipi_csi2;
-   u32 data_lanes[ARRAY_SIZE(bus->data_lanes)];
struct property *prop;
bool have_clk_lane = false;
unsigned int flags = 0;
@@ -34,14 +33,26 @@ static void v4l2_of_parse_csi_bus(const struct device_node 
*node,
const __be32 *lane = NULL;
int i;
 
-   for (i = 0; i < ARRAY_SIZE(data_lanes); i++) {
-   lane = of_prop_next_u32(prop, lane, &data_lanes[i]);
+   for (i = 0; i < ARRAY_SIZE(bus->data_lanes); i++) {
+   lane = of_prop_next_u32(prop, lane, &v);
if (!lane)
break;
+   bus->data_lanes[i] = v;
}
bus->num_data_lanes = i;
-   while (i--)
-   bus->data_lanes[i] = data_lanes[i];
+   }
+
+   prop = of_find_property(node, "lane-polarity", NULL);
+   if (prop) {
+   const __be32 *polarity = NULL;
+   int i;
+
+   for (i = 0; i < ARRAY_SIZE(bus->lane_polarity); i++) {
+   polarity = of_prop_next_u32(prop, polarity, &v);
+   if (!polarity)
+   break;
+   bus->lane_polarity[i] = v;
+   }
}
 
if (!of_property_read_u32(node, "clock-lanes", &v)) {
diff --git a/include/media/v4l2-of.h b/include/media/v4l2-of.h
index 70fa7b7..a70eb52 100644
--- a/include/media/v4l2-of.h
+++ b/include/media/v4l2-of.h
@@ -29,12 +29,15 @@ struct device_node;
  * @data_lanes: an array of physical data lane indexes
  * @clock_lane: physical lane index of the clock lane
  * @num_data_lanes: number of data lanes
+ * @lane_polarity: polarity of the lanes. The order is the same of
+ *the physical lanes.
  */
 struct v4l2_of_bus_mipi_csi2 {
unsigned int flags;
unsigned char data_lanes[4];
unsigned char clock_lane;
unsigned short num_data_lanes;
+   bool lane_polarity[5];
 };
 
 /**
-- 
1.7.10.4

--
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


[RFC 15/18] omap3isp: Add support for the Device Tree

2015-03-07 Thread Sakari Ailus
Add the ISP device to omap3 DT include file and add support to the driver to
use it.

Also obtain information on the external entities and the ISP configuration
related to them through the Device Tree in addition to the platform data.

Signed-off-by: Sakari Ailus 
---
 drivers/media/platform/omap3isp/isp.c   |  206 +--
 drivers/media/platform/omap3isp/isp.h   |   11 ++
 drivers/media/platform/omap3isp/ispcsiphy.c |7 +
 3 files changed, 213 insertions(+), 11 deletions(-)

diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index 7804895..2c9bc0d 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -64,6 +64,7 @@
 
 #include 
 #include 
+#include 
 
 #include "isp.h"
 #include "ispreg.h"
@@ -1991,6 +1992,14 @@ static int isp_register_entities(struct isp_device *isp)
if (ret < 0)
goto done;
 
+   /*
+* Device Tree --- the external of the sub-devices will be
+* registered later. Same goes for the sub-device node
+* registration.
+*/
+   if (isp->dev->of_node)
+   return 0;
+
/* Register external entities */
for (isp_subdev = pdata ? pdata->subdevs : NULL;
 isp_subdev && isp_subdev->board_info; isp_subdev++) {
@@ -2016,8 +2025,10 @@ static int isp_register_entities(struct isp_device *isp)
ret = v4l2_device_register_subdev_nodes(&isp->v4l2_dev);
 
 done:
-   if (ret < 0)
+   if (ret < 0) {
isp_unregister_entities(isp);
+   v4l2_async_notifier_unregister(&isp->notifier);
+   }
 
return ret;
 }
@@ -2232,6 +2243,7 @@ static int isp_remove(struct platform_device *pdev)
 {
struct isp_device *isp = platform_get_drvdata(pdev);
 
+   v4l2_async_notifier_unregister(&isp->notifier);
isp_unregister_entities(isp);
isp_cleanup_modules(isp);
isp_xclk_cleanup(isp);
@@ -2243,6 +2255,151 @@ static int isp_remove(struct platform_device *pdev)
return 0;
 }
 
+enum isp_of_phy {
+   ISP_OF_PHY_PARALLEL = 0,
+   ISP_OF_PHY_CSIPHY1,
+   ISP_OF_PHY_CSIPHY2,
+};
+
+static int isp_of_parse_node(struct device *dev, struct device_node *node,
+struct isp_async_subdev *isd)
+{
+   struct isp_bus_cfg *buscfg = &isd->bus;
+   struct v4l2_of_endpoint vep;
+   unsigned int i;
+
+   v4l2_of_parse_endpoint(node, &vep);
+
+   dev_dbg(dev, "interface %u\n", vep.base.port);
+
+   switch (vep.base.port) {
+   case ISP_OF_PHY_PARALLEL:
+   buscfg->interface = ISP_INTERFACE_PARALLEL;
+   buscfg->bus.parallel.data_lane_shift =
+   vep.bus.parallel.data_shift;
+   buscfg->bus.parallel.clk_pol =
+   !!(vep.bus.parallel.flags
+  & V4L2_MBUS_PCLK_SAMPLE_FALLING);
+   buscfg->bus.parallel.hs_pol =
+   !!(vep.bus.parallel.flags & V4L2_MBUS_VSYNC_ACTIVE_LOW);
+   buscfg->bus.parallel.vs_pol =
+   !!(vep.bus.parallel.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW);
+   buscfg->bus.parallel.fld_pol =
+   !!(vep.bus.parallel.flags & V4L2_MBUS_FIELD_EVEN_LOW);
+   buscfg->bus.parallel.data_pol =
+   !!(vep.bus.parallel.flags & V4L2_MBUS_DATA_ACTIVE_LOW);
+   break;
+
+   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_polarity[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_polarity[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.
+* Imp

[RFC 07/18] omap3isp: Rename regulators to better suit the Device Tree

2015-03-07 Thread Sakari Ailus
Rename VDD_CSIPHY1 as vdd-csiphy1 and VDD_CSIPHY2 as vdd-csiphy2.

Signed-off-by: Sakari Ailus 
---
 drivers/media/platform/omap3isp/isp.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index 1b5c6df..c045318 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -2292,8 +2292,8 @@ static int isp_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, isp);
 
/* Regulators */
-   isp->isp_csiphy1.vdd = devm_regulator_get(&pdev->dev, "VDD_CSIPHY1");
-   isp->isp_csiphy2.vdd = devm_regulator_get(&pdev->dev, "VDD_CSIPHY2");
+   isp->isp_csiphy1.vdd = devm_regulator_get(&pdev->dev, "vdd-csiphy1");
+   isp->isp_csiphy2.vdd = devm_regulator_get(&pdev->dev, "vdd-csiphy2");
 
/* Clocks
 *
-- 
1.7.10.4

--
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


[RFC 03/18] omap3isp: Separate external link creation from platform data parsing

2015-03-07 Thread Sakari Ailus
Move the code which connects the external entity to an ISP entity into a
separate function. This disconnects it from parsing the platform data.

Signed-off-by: Sakari Ailus 
---
 drivers/media/platform/omap3isp/isp.c |  147 +
 1 file changed, 74 insertions(+), 73 deletions(-)

diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index 4ab674d..a607f26 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -1832,6 +1832,77 @@ isp_register_subdev_group(struct isp_device *isp,
return sensor;
 }
 
+static int isp_link_entity(
+   struct isp_device *isp, struct media_entity *entity,
+   enum isp_interface_type interface)
+{
+   struct media_entity *input;
+   unsigned int flags;
+   unsigned int pad;
+   unsigned int i;
+
+   /* Connect the sensor to the correct interface module.
+* Parallel sensors are connected directly to the CCDC, while
+* serial sensors are connected to the CSI2a, CCP2b or CSI2c
+* receiver through CSIPHY1 or CSIPHY2.
+*/
+   switch (interface) {
+   case ISP_INTERFACE_PARALLEL:
+   input = &isp->isp_ccdc.subdev.entity;
+   pad = CCDC_PAD_SINK;
+   flags = 0;
+   break;
+
+   case ISP_INTERFACE_CSI2A_PHY2:
+   input = &isp->isp_csi2a.subdev.entity;
+   pad = CSI2_PAD_SINK;
+   flags = MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED;
+   break;
+
+   case ISP_INTERFACE_CCP2B_PHY1:
+   case ISP_INTERFACE_CCP2B_PHY2:
+   input = &isp->isp_ccp2.subdev.entity;
+   pad = CCP2_PAD_SINK;
+   flags = 0;
+   break;
+
+   case ISP_INTERFACE_CSI2C_PHY1:
+   input = &isp->isp_csi2c.subdev.entity;
+   pad = CSI2_PAD_SINK;
+   flags = MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED;
+   break;
+
+   default:
+   dev_err(isp->dev, "%s: invalid interface type %u\n", __func__,
+   interface);
+   return -EINVAL;
+   }
+
+   /*
+* Not all interfaces are available on all revisions of the
+* ISP. The sub-devices of those interfaces aren't initialised
+* in such a case. Check this by ensuring the num_pads is
+* non-zero.
+*/
+   if (!input->num_pads) {
+   dev_err(isp->dev, "%s: invalid input %u\n", entity->name,
+   interface);
+   return -EINVAL;
+   }
+
+   for (i = 0; i < entity->num_pads; i++) {
+   if (entity->pads[i].flags & MEDIA_PAD_FL_SOURCE)
+   break;
+   }
+   if (i == entity->num_pads) {
+   dev_err(isp->dev, "%s: no source pad in external entity\n",
+   __func__);
+   return -EINVAL;
+   }
+
+   return media_entity_create_link(entity, i, input, pad, flags);
+}
+
 static int isp_register_entities(struct isp_device *isp)
 {
struct isp_platform_data *pdata = isp->pdata;
@@ -1894,85 +1965,15 @@ static int isp_register_entities(struct isp_device *isp)
 
/* Register external entities */
for (subdevs = pdata->subdevs; subdevs && subdevs->subdevs; ++subdevs) {
-   struct v4l2_subdev *sensor;
-   struct media_entity *input;
-   unsigned int flags;
-   unsigned int pad;
-   unsigned int i;
+   struct v4l2_subdev *sensor =
+   isp_register_subdev_group(isp, subdevs->subdevs);
 
-   sensor = isp_register_subdev_group(isp, subdevs->subdevs);
if (sensor == NULL)
continue;
 
sensor->host_priv = subdevs;
 
-   /* Connect the sensor to the correct interface module. Parallel
-* sensors are connected directly to the CCDC, while serial
-* sensors are connected to the CSI2a, CCP2b or CSI2c receiver
-* through CSIPHY1 or CSIPHY2.
-*/
-   switch (subdevs->interface) {
-   case ISP_INTERFACE_PARALLEL:
-   input = &isp->isp_ccdc.subdev.entity;
-   pad = CCDC_PAD_SINK;
-   flags = 0;
-   break;
-
-   case ISP_INTERFACE_CSI2A_PHY2:
-   input = &isp->isp_csi2a.subdev.entity;
-   pad = CSI2_PAD_SINK;
-   flags = MEDIA_LNK_FL_IMMUTABLE
- | MEDIA_LNK_FL_ENABLED;
-   break;
-
-   case ISP_INTERFACE_CCP2B_PHY1:
-   case ISP_INTERFACE_CCP2B_PHY2:
-   input = &isp->isp_ccp2.subdev.entity;
-   pad = CCP2_PAD_SINK;
-   flags = 0;
-   

[RFC 05/18] omap3isp: Platform data could be NULL

2015-03-07 Thread Sakari Ailus
Only check for call platform data callback functions if there's platform
data. Also take care of a few other cases where the NULL pdata pointer could
have been accessed, and remove the check for NULL dev->platform_data
pointer.

Removing the check for NULL dev->platform_data isn't strictly needed by the
DT support but there's no harm from that either: the device now can be used
without sensors, for instance.

Signed-off-by: Sakari Ailus 
---
 drivers/media/platform/omap3isp/isp.c  |   10 --
 drivers/media/platform/omap3isp/ispvideo.c |6 +++---
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index 01356dd..b836bc8 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -330,8 +330,8 @@ static int isp_xclk_init(struct isp_device *isp)
if (np)
continue;
 
-   if (pdata->xclks[i].con_id == NULL &&
-   pdata->xclks[i].dev_id == NULL)
+   if (!pdata || (pdata->xclks[i].con_id == NULL &&
+  pdata->xclks[i].dev_id == NULL))
continue;
 
xclk->lookup = kzalloc(sizeof(*xclk->lookup), GFP_KERNEL);
@@ -1989,7 +1989,8 @@ static int isp_register_entities(struct isp_device *isp)
goto done;
 
/* Register external entities */
-   for (subdevs = pdata->subdevs; subdevs && subdevs->subdevs; ++subdevs) {
+   for (subdevs = pdata ? pdata->subdevs : NULL;
+subdevs && subdevs->subdevs; ++subdevs) {
struct v4l2_subdev *sensor =
isp_register_subdev_group(isp, subdevs->subdevs);
 
@@ -2271,9 +2272,6 @@ static int isp_probe(struct platform_device *pdev)
int ret;
int i, m;
 
-   if (pdata == NULL)
-   return -EINVAL;
-
isp = devm_kzalloc(&pdev->dev, sizeof(*isp), GFP_KERNEL);
if (!isp) {
dev_err(&pdev->dev, "could not allocate memory\n");
diff --git a/drivers/media/platform/omap3isp/ispvideo.c 
b/drivers/media/platform/omap3isp/ispvideo.c
index 3fe9047..d644164 100644
--- a/drivers/media/platform/omap3isp/ispvideo.c
+++ b/drivers/media/platform/omap3isp/ispvideo.c
@@ -1022,7 +1022,7 @@ isp_video_streamon(struct file *file, void *fh, enum 
v4l2_buf_type type)
 
pipe->entities = 0;
 
-   if (video->isp->pdata->set_constraints)
+   if (video->isp->pdata && video->isp->pdata->set_constraints)
video->isp->pdata->set_constraints(video->isp, true);
pipe->l3_ick = clk_get_rate(video->isp->clock[ISP_CLK_L3_ICK]);
pipe->max_rate = pipe->l3_ick;
@@ -1104,7 +1104,7 @@ err_set_stream:
 err_check_format:
media_entity_pipeline_stop(&video->video.entity);
 err_pipeline_start:
-   if (video->isp->pdata->set_constraints)
+   if (video->isp->pdata && video->isp->pdata->set_constraints)
video->isp->pdata->set_constraints(video->isp, false);
/* The DMA queue must be emptied here, otherwise CCDC interrupts that
 * will get triggered the next time the CCDC is powered up will try to
@@ -1165,7 +1165,7 @@ isp_video_streamoff(struct file *file, void *fh, enum 
v4l2_buf_type type)
video->queue = NULL;
video->error = false;
 
-   if (video->isp->pdata->set_constraints)
+   if (video->isp->pdata && video->isp->pdata->set_constraints)
video->isp->pdata->set_constraints(video->isp, false);
media_entity_pipeline_stop(&video->video.entity);
 
-- 
1.7.10.4

--
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


[RFC 06/18] omap3isp: Refactor device configuration structs for Device Tree

2015-03-07 Thread Sakari Ailus
Make omap3isp configuration data structures more suitable for consumption by
the DT by separating the I2C bus information of all the sub-devices in a
group and the ISP bus information from each other. The ISP bus information
is made a pointer instead of being directly embedded in the struct.

In the case of the DT only the sensor specific information on the ISP bus
configuration is retained. The structs are renamed to reflect that.

After this change the structs needed to describe device configuration can be
allocated and accessed separately without those needed only in the case of
platform data. The platform data related structs can be later removed once
the support for platform data can be removed.

Signed-off-by: Sakari Ailus 
Cc: Mike Rapoport 
Cc: Igor Grinberg 
---
 arch/arm/mach-omap2/board-cm-t35.c  |   57 +++---
 drivers/media/platform/omap3isp/isp.c   |   86 +--
 drivers/media/platform/omap3isp/isp.h   |2 +-
 drivers/media/platform/omap3isp/ispccdc.c   |   26 
 drivers/media/platform/omap3isp/ispccp2.c   |   22 +++
 drivers/media/platform/omap3isp/ispcsi2.c   |8 +--
 drivers/media/platform/omap3isp/ispcsiphy.c |   21 ---
 include/media/omap3isp.h|   34 +--
 8 files changed, 119 insertions(+), 137 deletions(-)

diff --git a/arch/arm/mach-omap2/board-cm-t35.c 
b/arch/arm/mach-omap2/board-cm-t35.c
index 91738a1..b5dfbc1 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -492,51 +492,36 @@ static struct twl4030_platform_data cm_t35_twldata = {
 #include 
 #include "devices.h"
 
-static struct i2c_board_info cm_t35_isp_i2c_boardinfo[] = {
+static struct isp_platform_subdev cm_t35_isp_subdevs[] = {
{
-   I2C_BOARD_INFO("mt9t001", 0x5d),
-   },
-   {
-   I2C_BOARD_INFO("tvp5150", 0x5c),
-   },
-};
-
-static struct isp_subdev_i2c_board_info cm_t35_isp_primary_subdevs[] = {
-   {
-   .board_info = &cm_t35_isp_i2c_boardinfo[0],
-   .i2c_adapter_id = 3,
-   },
-   { NULL, 0, },
-};
-
-static struct isp_subdev_i2c_board_info cm_t35_isp_secondary_subdevs[] = {
-   {
-   .board_info = &cm_t35_isp_i2c_boardinfo[1],
+   .board_info = &(struct i2c_board_info){
+   I2C_BOARD_INFO("mt9t001", 0x5d)
+   },
.i2c_adapter_id = 3,
-   },
-   { NULL, 0, },
-};
-
-static struct isp_v4l2_subdevs_group cm_t35_isp_subdevs[] = {
-   {
-   .subdevs = cm_t35_isp_primary_subdevs,
-   .interface = ISP_INTERFACE_PARALLEL,
-   .bus = {
-   .parallel = {
-   .clk_pol = 1,
+   .bus = &(struct isp_bus_cfg){
+   .interface = ISP_INTERFACE_PARALLEL,
+   .bus = {
+   .parallel = {
+   .clk_pol = 1,
+   },
},
},
},
{
-   .subdevs = cm_t35_isp_secondary_subdevs,
-   .interface = ISP_INTERFACE_PARALLEL,
-   .bus = {
-   .parallel = {
-   .clk_pol = 0,
+   .board_info = &(struct i2c_board_info){
+   I2C_BOARD_INFO("tvp5150", 0x5c),
+   },
+   .i2c_adapter_id = 3,
+   .bus = &(struct isp_bus_cfg){
+   .interface = ISP_INTERFACE_PARALLEL,
+   .bus = {
+   .parallel = {
+   .clk_pol = 0,
+   },
},
},
},
-   { NULL, 0, },
+   { 0 },
 };
 
 static struct isp_platform_data cm_t35_isp_pdata = {
diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index b836bc8..1b5c6df 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -447,7 +447,7 @@ static void isp_core_init(struct isp_device *isp, int idle)
  */
 void omap3isp_configure_bridge(struct isp_device *isp,
   enum ccdc_input_entity input,
-  const struct isp_parallel_platform_data *pdata,
+  const struct isp_parallel_cfg *parcfg,
   unsigned int shift, unsigned int bridge)
 {
u32 ispctrl_val;
@@ -462,8 +462,8 @@ void omap3isp_configure_bridge(struct isp_device *isp,
switch (input) {
case CCDC_INPUT_PARALLEL:
ispctrl_val |= ISPCTRL_PAR_SER_CLK_SEL_PARALLEL;
-   ispctrl_val |= pdata->clk_pol << ISPCTRL_PAR_CLK_POL_SHIFT;
-   shift += pdata->data_lane_shift * 2;
+   ispctrl_val |= parcfg->clk_pol << ISPCTRL_PAR_CLK_P

[RFC 02/18] omap3isp: Avoid a BUG_ON() in media_entity_create_link()

2015-03-07 Thread Sakari Ailus
If an uninitialised v4l2_subdev struct was passed to
media_entity_create_link(), one of the BUG_ON()'s in the function will be
hit since media_entity.num_pads will be zero. Avoid this by checking whether
the num_pads field is non-zero for the interface.

Signed-off-by: Sakari Ailus 
---
 drivers/media/platform/omap3isp/isp.c |   13 +
 1 file changed, 13 insertions(+)

diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index fb193b6..4ab674d 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -1946,6 +1946,19 @@ static int isp_register_entities(struct isp_device *isp)
goto done;
}
 
+   /*
+* Not all interfaces are available on all revisions
+* of the ISP. The sub-devices of those interfaces
+* aren't initialised in such a case. Check this by
+* ensuring the num_pads is non-zero.
+*/
+   if (!input->num_pads) {
+   dev_err(isp->dev, "%s: invalid input %u\n",
+   entity->name, subdevs->interface);
+   ret = -EINVAL;
+   goto done;
+   }
+
for (i = 0; i < sensor->entity.num_pads; i++) {
if (sensor->entity.pads[i].flags & MEDIA_PAD_FL_SOURCE)
break;
-- 
1.7.10.4

--
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


[RFC 09/18] omap3isp: Replace mmio_base_phys array with the histogram block base

2015-03-07 Thread Sakari Ailus
Only the histogram sub-block driver uses the physical address. Do not store
it for other sub-blocks.

Signed-off-by: Sakari Ailus 
---
 drivers/media/platform/omap3isp/isp.c |3 ++-
 drivers/media/platform/omap3isp/isp.h |6 +++---
 drivers/media/platform/omap3isp/isphist.c |2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index c045318..68d7edfc 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -2247,7 +2247,8 @@ static int isp_map_mem_resource(struct platform_device 
*pdev,
if (IS_ERR(isp->mmio_base[res]))
return PTR_ERR(isp->mmio_base[res]);
 
-   isp->mmio_base_phys[res] = mem->start;
+   if (res == OMAP3_ISP_IOMEM_HIST)
+   isp->mmio_hist_base_phys = mem->start;
 
return 0;
 }
diff --git a/drivers/media/platform/omap3isp/isp.h 
b/drivers/media/platform/omap3isp/isp.h
index b932a6f..9535524 100644
--- a/drivers/media/platform/omap3isp/isp.h
+++ b/drivers/media/platform/omap3isp/isp.h
@@ -138,8 +138,8 @@ struct isp_xclk {
  * @irq_num: Currently used IRQ number.
  * @mmio_base: Array with kernel base addresses for ioremapped ISP register
  * regions.
- * @mmio_base_phys: Array with physical L4 bus addresses for ISP register
- *  regions.
+ * @mmio_hist_base_phys: Physical L4 bus address for ISP hist block register
+ *  region.
  * @mapping: IOMMU mapping
  * @stat_lock: Spinlock for handling statistics
  * @isp_mutex: Mutex for serializing requests to ISP.
@@ -175,7 +175,7 @@ struct isp_device {
unsigned int irq_num;
 
void __iomem *mmio_base[OMAP3_ISP_IOMEM_LAST];
-   unsigned long mmio_base_phys[OMAP3_ISP_IOMEM_LAST];
+   unsigned long mmio_hist_base_phys;
 
struct dma_iommu_mapping *mapping;
 
diff --git a/drivers/media/platform/omap3isp/isphist.c 
b/drivers/media/platform/omap3isp/isphist.c
index ce822c3..3bb9c4f 100644
--- a/drivers/media/platform/omap3isp/isphist.c
+++ b/drivers/media/platform/omap3isp/isphist.c
@@ -70,7 +70,7 @@ static void hist_dma_config(struct ispstat *hist)
hist->dma_config.sync_mode = OMAP_DMA_SYNC_ELEMENT;
hist->dma_config.frame_count = 1;
hist->dma_config.src_amode = OMAP_DMA_AMODE_CONSTANT;
-   hist->dma_config.src_start = isp->mmio_base_phys[OMAP3_ISP_IOMEM_HIST]
+   hist->dma_config.src_start = isp->mmio_hist_base_phys
   + ISPHIST_DATA;
hist->dma_config.dst_amode = OMAP_DMA_AMODE_POST_INC;
hist->dma_config.src_or_dst_synch = OMAP_DMA_SRC_SYNC;
-- 
1.7.10.4

--
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


[RFC 00/18] Device tree support for omap3isp, N9[50] primary camera

2015-03-07 Thread Sakari Ailus
Hi folks,

I've had this patchset hanging around for a long, long time, and now it's
time to send it out to linux-media.

For OMAP 3, first there are a few patches for random and tiny bugfixes and
then preparation for DT support (including compile tested rework of cm-t35
board code).

The lane-polarity DT binding is added to video-interfaces.txt for this, I
believe, is hardly specific to the OMAP 3 ISP. The same property is read by
the V4L2 OF parser as well.

ISP DT support is added for both OMAP 34xx and 36xx, but it remains tested
on 3630 only. The primary camera support is added for both N950 and N9, the
latter of which is tested. The differences are quite small between the two
in both of the cases, but still testing definitely wouldn't hurt.

The secondary camera support is still lacking primarily due to the I2C
address conflict: both of the cameras have the same I2C address. It'd also
require CCP2 bus support, which is relatively trivial to add.

Effects of Philipp Zabel's patch "of: Decrement refcount of previous
endpoint in of_graph_get_next_endpoint" aren't yet taken into account in
this series. I'll address this in the next set if changes (small I presume)
are needed.

-- 
Kind regards,
Sakari

--
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


[RFC 10/18] omap3isp: Move the syscon register out of the ISP register maps

2015-03-07 Thread Sakari Ailus
The syscon register isn't part of the ISP, use it through the syscom driver
regmap instead. The syscom block is considered to be from 343x on ISP
revision 2.0 whereas 15.0 is assumed to have 3630 syscon.

Signed-off-by: Sakari Ailus 
---
 arch/arm/boot/dts/omap3.dtsi|2 +-
 arch/arm/mach-omap2/devices.c   |   10 --
 drivers/media/platform/omap3isp/isp.c   |   19 +++
 drivers/media/platform/omap3isp/isp.h   |   19 +--
 drivers/media/platform/omap3isp/ispcsiphy.c |   20 +---
 5 files changed, 42 insertions(+), 28 deletions(-)

diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index 01b7111..fe0b293 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -183,7 +183,7 @@
 
omap3_scm_general: tisyscon@48002270 {
compatible = "syscon";
-   reg = <0x48002270 0x2f0>;
+   reg = <0x48002270 0x2f4>;
};
 
pbias_regulator: pbias_regulator {
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 1afb50d..e945957 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -143,16 +143,6 @@ static struct resource omap3isp_resources[] = {
.flags  = IORESOURCE_MEM,
},
{
-   .start  = OMAP343X_CTRL_BASE + OMAP343X_CONTROL_CSIRXFE,
-   .end= OMAP343X_CTRL_BASE + OMAP343X_CONTROL_CSIRXFE 
+ 3,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP343X_CTRL_BASE + 
OMAP3630_CONTROL_CAMERA_PHY_CTRL,
-   .end= OMAP343X_CTRL_BASE + 
OMAP3630_CONTROL_CAMERA_PHY_CTRL + 3,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
.start  = 24 + OMAP_INTC_START,
.flags  = IORESOURCE_IRQ,
}
diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index 68d7edfc..4ff4bbd 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -51,6 +51,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -94,8 +95,9 @@ static const struct isp_res_mapping isp_res_maps[] = {
   1 << OMAP3_ISP_IOMEM_RESZ |
   1 << OMAP3_ISP_IOMEM_SBL |
   1 << OMAP3_ISP_IOMEM_CSI2A_REGS1 |
-  1 << OMAP3_ISP_IOMEM_CSIPHY2 |
-  1 << OMAP3_ISP_IOMEM_343X_CONTROL_CSIRXFE,
+  1 << OMAP3_ISP_IOMEM_CSIPHY2,
+   .syscon_offset = 0xdc,
+   .phy_type = ISP_PHY_TYPE_3430,
},
{
.isp_rev = ISP_REVISION_15_0,
@@ -112,8 +114,9 @@ static const struct isp_res_mapping isp_res_maps[] = {
   1 << OMAP3_ISP_IOMEM_CSI2A_REGS2 |
   1 << OMAP3_ISP_IOMEM_CSI2C_REGS1 |
   1 << OMAP3_ISP_IOMEM_CSIPHY1 |
-  1 << OMAP3_ISP_IOMEM_CSI2C_REGS2 |
-  1 << OMAP3_ISP_IOMEM_3630_CONTROL_CAMERA_PHY_CTRL,
+  1 << OMAP3_ISP_IOMEM_CSI2C_REGS2,
+   .syscon_offset = 0x2f0,
+   .phy_type = ISP_PHY_TYPE_3630,
},
 };
 
@@ -2352,6 +2355,14 @@ static int isp_probe(struct platform_device *pdev)
}
}
 
+   isp->syscon = syscon_regmap_lookup_by_pdevname("syscon.0");
+   isp->syscon_offset = isp_res_maps[m].syscon_offset;
+   isp->phy_type = isp_res_maps[m].phy_type;
+   if (IS_ERR(isp->syscon)) {
+   ret = PTR_ERR(isp->syscon);
+   goto error_isp;
+   }
+
/* IOMMU */
ret = isp_attach_iommu(isp);
if (ret < 0) {
diff --git a/drivers/media/platform/omap3isp/isp.h 
b/drivers/media/platform/omap3isp/isp.h
index 9535524..03d2129 100644
--- a/drivers/media/platform/omap3isp/isp.h
+++ b/drivers/media/platform/omap3isp/isp.h
@@ -59,8 +59,6 @@ enum isp_mem_resources {
OMAP3_ISP_IOMEM_CSI2C_REGS1,
OMAP3_ISP_IOMEM_CSIPHY1,
OMAP3_ISP_IOMEM_CSI2C_REGS2,
-   OMAP3_ISP_IOMEM_343X_CONTROL_CSIRXFE,
-   OMAP3_ISP_IOMEM_3630_CONTROL_CAMERA_PHY_CTRL,
OMAP3_ISP_IOMEM_LAST
 };
 
@@ -93,14 +91,25 @@ enum isp_subclk_resource {
 /* ISP2P: OMAP 36xx */
 #define ISP_REVISION_15_0  0xF0
 
+#define ISP_PHY_TYPE_3430  0
+#define ISP_PHY_TYPE_3630  1
+
+struct regmap;
+
 /*
  * struct isp_res_mapping - Map ISP io resources to ISP revision.
  * @isp_rev: ISP_REVISION_x_x
  * @map: bitmap for enum isp_mem_resources
+ * @syscon_offset: offset of the syscon register for 343x / 3630
+ * (CONTROL_CSIRXFE / CONTROL_CAMERA_PHY_CTRL, respectively)
+ * from the syscon base address
+ * @phy_type: ISP_PHY_TYPE_{3430,3630}
  */
 struc

[RFC 08/18] omap3isp: Calculate vpclk_div for CSI-2

2015-03-07 Thread Sakari Ailus
The video port clock is l3_ick divided by vpclk_div. This clock must be high
enough for the external pixel rate. The video port requires two clock cycles
to process a pixel.

Signed-off-by: Sakari Ailus 
---
 drivers/media/platform/omap3isp/ispcsi2.c |8 +++-
 include/media/omap3isp.h  |2 --
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/omap3isp/ispcsi2.c 
b/drivers/media/platform/omap3isp/ispcsi2.c
index 14d279d..97cdfeb 100644
--- a/drivers/media/platform/omap3isp/ispcsi2.c
+++ b/drivers/media/platform/omap3isp/ispcsi2.c
@@ -548,6 +548,7 @@ int omap3isp_csi2_reset(struct isp_csi2_device *csi2)
 
 static int csi2_configure(struct isp_csi2_device *csi2)
 {
+   struct isp_pipeline *pipe = to_isp_pipeline(&csi2->subdev.entity);
const struct isp_bus_cfg *buscfg;
struct isp_device *isp = csi2->isp;
struct isp_csi2_timing_cfg *timing = &csi2->timing[0];
@@ -570,7 +571,12 @@ static int csi2_configure(struct isp_csi2_device *csi2)
csi2->frame_skip = 0;
v4l2_subdev_call(sensor, sensor, g_skip_frames, &csi2->frame_skip);
 
-   csi2->ctrl.vp_out_ctrl = buscfg->bus.csi2.vpclk_div;
+   csi2->ctrl.vp_out_ctrl =
+   clamp_t(unsigned int, pipe->l3_ick / pipe->external_rate - 1,
+   1, 3);
+   dev_dbg(isp->dev, "%s: l3_ick %lu, external_rate %u, vp_out_ctrl %u\n",
+   __func__, pipe->l3_ick,  pipe->external_rate,
+   csi2->ctrl.vp_out_ctrl);
csi2->ctrl.frame_mode = ISP_CSI2_FRAME_IMMEDIATE;
csi2->ctrl.ecc_enable = buscfg->bus.csi2.crc;
 
diff --git a/include/media/omap3isp.h b/include/media/omap3isp.h
index 39e0748..0f0c08b 100644
--- a/include/media/omap3isp.h
+++ b/include/media/omap3isp.h
@@ -129,11 +129,9 @@ struct isp_ccp2_cfg {
 /**
  * struct isp_csi2_cfg - CSI2 interface configuration
  * @crc: Enable the cyclic redundancy check
- * @vpclk_div: Video port output clock control
  */
 struct isp_csi2_cfg {
unsigned crc:1;
-   unsigned vpclk_div:2;
struct isp_csiphy_lanes_cfg lanecfg;
 };
 
-- 
1.7.10.4

--
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 v3][RFC] add raw video stream support for Samsung SUR40

2015-03-07 Thread Hans Verkuil
On 03/07/2015 08:52 PM, Florian Echtler wrote:
> On 06.03.2015 12:47, Hans Verkuil wrote:
>> On 03/06/2015 12:24 PM, Florian Echtler wrote:
>>> On 21.02.2015 11:22, Hans Verkuil wrote:
 On 02/20/2015 10:46 PM, Florian Echtler wrote:
> On 16.02.2015 12:40, Hans Verkuil wrote:
>> I prefer to dig into this a little bit more, as I don't really understand
>> it. Set the videobuf2-core debug level to 1 and see what the warnings 
>> are.
>> Since 'buf.qbuf' fails in v4l2-compliance, it's something in the 
>> VIDIOC_QBUF
>> sequence that returns an error, so you need to pinpoint that.
> OK, I don't currently have access to the hardware, but I will try this
> as soon as possible.
>>> Finally got a chance to try again with videobuf2-core.debug=1. Same
>>> result on 3.19 and 4.0-rc2, after running v4l2-compliance -s from
>>> today's master (full log attached, but important part is below):
>>>
>>> I'm not familiar enough with the inner workings of videobuf2 to make any
>>> sense of it, any new insights from you guys?
>>
>> Can you do:
>> echo 2 >/sys/class/video4linux/videoX/dev_debug
>> and run again?
>> That way I see the vb2 debug messages in related to the issued ioctls.
> See attachment, this is the full syslog output from one v4l2-compliance
> run on 4.0-rc2, with video0/dev_debug=2 and core.debug=1.
> 
>> And if you can also supply the v4l2-compliance -s output, just for
>> reference?
> Also attached for completeness, the important part is:
> 
> Streaming ioctls:
>   test read/write: OK
>   test MMAP: OK
>   fail: v4l2-test-buffers.cpp(280): !g_timestamp().tv_sec &&
> !g_timestamp().tv_usec

Hmm, I don't think I saw this before.

Anyway, looking at the code I think I see at least one thing that is dubious
and that needs to be changed:

In sur40_process_video() you check for buffers at the start:

if (list_empty(&sur40->buf_list))
return;

Replace this with:

if (!vb2_start_streaming_called(&sur40->queue))
return;

This will wait until start_streaming was called before it starts processing
video (and start_streaming is only called if at least 3 buffers have been
queued).

Right now the first buffer can be returned without STREAMON actually having
been called. That's certainly wrong.

Whether that is the cause of this bug I do not know, but fix this first.

If this doesn't solve it, then please do another run but this time use

echo 10 >/sys/class/video4linux/videoX/dev_debug

so I see the (D)QBUF ioctls as well. Otherwise use the same procedure as
before.

Thanks!

Hans
--
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 v3 00/15] media: blackfin: bfin_capture enhancements

2015-03-07 Thread Hans Verkuil
On 03/07/2015 05:22 PM, Lad, Prabhakar wrote:
> On Thu, Mar 5, 2015 at 10:26 AM, Hans Verkuil  wrote:
>> On 03/05/15 10:44, Scott Jiang wrote:
>>> Hi Hans,
> [snip]
>
> cd utils/v4l2-compliance
> cat *.cpp >x.cpp
> g++ -o v4l2-compliance x.cpp -I . -I ../../include/ -DNO_LIBV4L2
>
> I've never used uclibc, so I don't know what the limitations are.
>
 Not sure what exactly fails, I haven’t tried compiling it, that was a
 response from Scott for v2 series.

>>>
>>> I found if I disabled libjpeg ./configure --without-jpeg, it can pass
>>> compilation.
>>
>> Great!
>>
>>> Would you like me to send the result now or after Lad's v4 patch?
>>
>> Send it now as v4 won't have any meaningful code changes.
>>
> But anyway I cant help here much if there are any compliance issues,
> as i don't have the hardware.

Often compliance issues are trivially fixed, even without hardware. But step
one is just to run the tool and see what it reports.

Regards,

Hans

--
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 v3 00/15] media: blackfin: bfin_capture enhancements

2015-03-07 Thread Lad, Prabhakar
On Thu, Mar 5, 2015 at 10:26 AM, Hans Verkuil  wrote:
> On 03/05/15 10:44, Scott Jiang wrote:
>> Hi Hans,
[snip]

 cd utils/v4l2-compliance
 cat *.cpp >x.cpp
 g++ -o v4l2-compliance x.cpp -I . -I ../../include/ -DNO_LIBV4L2

 I've never used uclibc, so I don't know what the limitations are.

>>> Not sure what exactly fails, I haven’t tried compiling it, that was a
>>> response from Scott for v2 series.
>>>
>>
>> I found if I disabled libjpeg ./configure --without-jpeg, it can pass
>> compilation.
>
> Great!
>
>> Would you like me to send the result now or after Lad's v4 patch?
>
> Send it now as v4 won't have any meaningful code changes.
>
But anyway I cant help here much if there are any compliance issues,
as i don't have the hardware.

Thanks,
--Prabhakar Lad
--
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] media: am437x-vpfe: embed video_device struct in vpfe_device

2015-03-07 Thread Lad Prabhakar
From: "Lad, Prabhakar" 

Embed video_device struct (video_dev) in vpfe_device and
Unregister path doesn't need to free the video_device
structure, hence, change the video_device.release callback
point to video_device_release_empty.

Signed-off-by: Lad, Prabhakar 
---
 drivers/media/platform/am437x/am437x-vpfe.c | 21 ++---
 drivers/media/platform/am437x/am437x-vpfe.h |  2 +-
 2 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/drivers/media/platform/am437x/am437x-vpfe.c 
b/drivers/media/platform/am437x/am437x-vpfe.c
index 8e056eb..a30cc2f 100644
--- a/drivers/media/platform/am437x/am437x-vpfe.c
+++ b/drivers/media/platform/am437x/am437x-vpfe.c
@@ -2316,7 +2316,7 @@ vpfe_async_bound(struct v4l2_async_notifier *notifier,
return -EINVAL;
}
 
-   vpfe->video_dev->tvnorms |= sdinfo->inputs[0].std;
+   vpfe->video_dev.tvnorms |= sdinfo->inputs[0].std;
 
/* setup the supported formats & indexes */
for (j = 0, i = 0; ; ++j) {
@@ -2389,9 +2389,9 @@ static int vpfe_probe_complete(struct vpfe_device *vpfe)
 
INIT_LIST_HEAD(&vpfe->dma_queue);
 
-   vdev = vpfe->video_dev;
+   vdev = &vpfe->video_dev;
strlcpy(vdev->name, VPFE_MODULE_NAME, sizeof(vdev->name));
-   vdev->release = video_device_release;
+   vdev->release = video_device_release_empty;
vdev->fops = &vpfe_fops;
vdev->ioctl_ops = &vpfe_ioctl_ops;
vdev->v4l2_dev = &vpfe->v4l2_dev;
@@ -2399,7 +2399,7 @@ static int vpfe_probe_complete(struct vpfe_device *vpfe)
vdev->queue = q;
vdev->lock = &vpfe->lock;
video_set_drvdata(vdev, vpfe);
-   err = video_register_device(vpfe->video_dev, VFL_TYPE_GRABBER, -1);
+   err = video_register_device(&vpfe->video_dev, VFL_TYPE_GRABBER, -1);
if (err) {
vpfe_err(vpfe,
"Unable to register video device.\n");
@@ -2564,17 +2564,11 @@ static int vpfe_probe(struct platform_device *pdev)
return -EINVAL;
}
 
-   vpfe->video_dev = video_device_alloc();
-   if (!vpfe->video_dev) {
-   dev_err(&pdev->dev, "Unable to allocate video device\n");
-   return -ENOMEM;
-   }
-
ret = v4l2_device_register(&pdev->dev, &vpfe->v4l2_dev);
if (ret) {
vpfe_err(vpfe,
"Unable to register v4l2 device.\n");
-   goto probe_out_video_release;
+   return ret;
}
 
/* set the driver data in platform device */
@@ -2612,9 +2606,6 @@ static int vpfe_probe(struct platform_device *pdev)
 
 probe_out_v4l2_unregister:
v4l2_device_unregister(&vpfe->v4l2_dev);
-probe_out_video_release:
-   if (!video_is_registered(vpfe->video_dev))
-   video_device_release(vpfe->video_dev);
return ret;
 }
 
@@ -2631,7 +2622,7 @@ static int vpfe_remove(struct platform_device *pdev)
 
v4l2_async_notifier_unregister(&vpfe->notifier);
v4l2_device_unregister(&vpfe->v4l2_dev);
-   video_unregister_device(vpfe->video_dev);
+   video_unregister_device(&vpfe->video_dev);
 
return 0;
 }
diff --git a/drivers/media/platform/am437x/am437x-vpfe.h 
b/drivers/media/platform/am437x/am437x-vpfe.h
index 956fb9e..5bfb356 100644
--- a/drivers/media/platform/am437x/am437x-vpfe.h
+++ b/drivers/media/platform/am437x/am437x-vpfe.h
@@ -222,7 +222,7 @@ struct vpfe_ccdc {
 struct vpfe_device {
/* V4l2 specific parameters */
/* Identifies video device for this channel */
-   struct video_device *video_dev;
+   struct video_device video_dev;
/* sub devices */
struct v4l2_subdev **sd;
/* vpfe cfg */
-- 
2.1.0

--
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 0/2] media: am437x-vpfe: trivial fixes

2015-03-07 Thread Lad Prabhakar
From: "Lad, Prabhakar" 


Lad, Prabhakar (2):
  media: am437x-vpfe: match the OF node/i2c addr instead of name
  media: am437x-vpfe: return error in case memory allocation failure

 drivers/media/platform/am437x/am437x-vpfe.c | 33 +++--
 drivers/media/platform/am437x/am437x-vpfe.h |  1 -
 2 files changed, 17 insertions(+), 17 deletions(-)

-- 
2.1.0

--
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 2/2] media: am437x-vpfe: return error in case memory allocation failure

2015-03-07 Thread Lad Prabhakar
From: "Lad, Prabhakar" 

return error in case devm_kzalloc() fails.

Signed-off-by: Lad, Prabhakar 
---
 drivers/media/platform/am437x/am437x-vpfe.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/media/platform/am437x/am437x-vpfe.c 
b/drivers/media/platform/am437x/am437x-vpfe.c
index 3d59ae0..8e056eb 100644
--- a/drivers/media/platform/am437x/am437x-vpfe.c
+++ b/drivers/media/platform/am437x/am437x-vpfe.c
@@ -2501,6 +2501,12 @@ vpfe_get_pdata(struct platform_device *pdev)
pdata->asd[i] = devm_kzalloc(&pdev->dev,
 sizeof(struct v4l2_async_subdev),
 GFP_KERNEL);
+   if (!pdata->asd[i]) {
+   of_node_put(rem);
+   pdata = NULL;
+   goto done;
+   }
+
pdata->asd[i]->match_type = V4L2_ASYNC_MATCH_OF;
pdata->asd[i]->match.of.node = rem;
of_node_put(rem);
-- 
2.1.0

--
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 1/2] media: am437x-vpfe: match the OF node/i2c addr instead of name

2015-03-07 Thread Lad Prabhakar
From: "Lad, Prabhakar" 

Instead of matching the subdevs with their name, match
it with OF node/ i2c address and adapter number.

Signed-off-by: Lad, Prabhakar 
---
 drivers/media/platform/am437x/am437x-vpfe.c | 27 +++
 drivers/media/platform/am437x/am437x-vpfe.h |  1 -
 2 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/drivers/media/platform/am437x/am437x-vpfe.c 
b/drivers/media/platform/am437x/am437x-vpfe.c
index 8166b38..3d59ae0 100644
--- a/drivers/media/platform/am437x/am437x-vpfe.c
+++ b/drivers/media/platform/am437x/am437x-vpfe.c
@@ -1701,11 +1701,16 @@ static int vpfe_get_app_input_index(struct vpfe_device 
*vpfe,
 {
struct vpfe_config *cfg = vpfe->cfg;
struct vpfe_subdev_info *sdinfo;
+   struct i2c_client *client;
+   struct i2c_client *curr_client;
int i, j = 0;
 
+   curr_client = v4l2_get_subdevdata(vpfe->current_subdev->sd);
for (i = 0; i < ARRAY_SIZE(vpfe->cfg->asd); i++) {
sdinfo = &cfg->sub_devs[i];
-   if (!strcmp(sdinfo->name, vpfe->current_subdev->name)) {
+   client = v4l2_get_subdevdata(sdinfo->sd);
+   if (client->addr == curr_client->addr &&
+   client->adapter->nr == client->adapter->nr) {
if (vpfe->current_input >= 1)
return -1;
*app_input_index = j + vpfe->current_input;
@@ -2297,20 +2302,10 @@ vpfe_async_bound(struct v4l2_async_notifier *notifier,
vpfe_dbg(1, vpfe, "vpfe_async_bound\n");
 
for (i = 0; i < ARRAY_SIZE(vpfe->cfg->asd); i++) {
-   sdinfo = &vpfe->cfg->sub_devs[i];
-
-   if (!strcmp(sdinfo->name, subdev->name)) {
+   if (vpfe->cfg->asd[i]->match.of.node == asd[i].match.of.node) {
+   sdinfo = &vpfe->cfg->sub_devs[i];
vpfe->sd[i] = subdev;
-   vpfe_info(vpfe,
-"v4l2 sub device %s registered\n",
-subdev->name);
-   vpfe->sd[i]->grp_id =
-   sdinfo->grp_id;
-   /* update tvnorms from the sub devices */
-   for (j = 0; j < 1; j++)
-   vpfe->video_dev->tvnorms |=
-   sdinfo->inputs[j].std;
-
+   vpfe->sd[i]->grp_id = sdinfo->grp_id;
found = true;
break;
}
@@ -2321,6 +2316,8 @@ vpfe_async_bound(struct v4l2_async_notifier *notifier,
return -EINVAL;
}
 
+   vpfe->video_dev->tvnorms |= sdinfo->inputs[0].std;
+
/* setup the supported formats & indexes */
for (j = 0, i = 0; ; ++j) {
struct vpfe_fmt *fmt;
@@ -2501,8 +2498,6 @@ vpfe_get_pdata(struct platform_device *pdev)
goto done;
}
 
-   strncpy(sdinfo->name, rem->name, sizeof(sdinfo->name));
-
pdata->asd[i] = devm_kzalloc(&pdev->dev,
 sizeof(struct v4l2_async_subdev),
 GFP_KERNEL);
diff --git a/drivers/media/platform/am437x/am437x-vpfe.h 
b/drivers/media/platform/am437x/am437x-vpfe.h
index 0f55735..956fb9e 100644
--- a/drivers/media/platform/am437x/am437x-vpfe.h
+++ b/drivers/media/platform/am437x/am437x-vpfe.h
@@ -83,7 +83,6 @@ struct vpfe_route {
 };
 
 struct vpfe_subdev_info {
-char name[32];
/* Sub device group id */
int grp_id;
/* inputs available at the sub device */
-- 
2.1.0

--
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 v3] media: i2c: add support for omnivision's ov2659 sensor

2015-03-07 Thread Lad Prabhakar
From: Benoit Parrot 

this patch adds support for omnivision's ov2659
sensor, the driver supports following features:
1: Asynchronous probing
2: DT support
3: Media controller support

Signed-off-by: Benoit Parrot 
Signed-off-by: Lad, Prabhakar 
---
 Changes for v3:
 a: Fixed review comments pointed by Sakari.

 v2: https://patchwork.kernel.org/patch/5859801/
 v1: https://patchwork.linuxtv.org/patch/27919/

 .../devicetree/bindings/media/i2c/ov2659.txt   |   38 +
 MAINTAINERS|   10 +
 drivers/media/i2c/Kconfig  |   11 +
 drivers/media/i2c/Makefile |1 +
 drivers/media/i2c/ov2659.c | 1495 
 include/media/ov2659.h |   33 +
 6 files changed, 1588 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/ov2659.txt
 create mode 100644 drivers/media/i2c/ov2659.c
 create mode 100644 include/media/ov2659.h

diff --git a/Documentation/devicetree/bindings/media/i2c/ov2659.txt 
b/Documentation/devicetree/bindings/media/i2c/ov2659.txt
new file mode 100644
index 000..01d8d59
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/ov2659.txt
@@ -0,0 +1,38 @@
+* OV2659 1/5-Inch 2Mp SOC Camera
+
+The Omnivision OV2659 is a 1/5-inch SOC camera, with an active array size of
+1632H x 1212V. It is programmable through a SCCB. The OV2659 sensor supports
+multiple resolutions output, such as UXGA, SVGA, 720p. It also can support
+YUV422, RGB565/555 or raw RGB output formats.
+
+Required Properties:
+- compatible: Must be "ovti,ov2659"
+- reg: I2C slave address
+- clocks: reference to the xvclk input clock.
+- clock-names: should be "xvclk".
+- pixel-clock-frequency: Pixel clock frequency.
+
+For further reading on port node refer to
+Documentation/devicetree/bindings/media/video-interfaces.txt.
+
+Example:
+
+   i2c0@1c22000 {
+   ...
+   ...
+ov2659@30 {
+   compatible = "ovti,ov2659";
+   reg = <0x30>;
+
+   clocks = <&clk_ov2659 0>;
+   clock-names = "xvclk";
+
+   port {
+   ov2659_0: endpoint {
+   remote-endpoint = <&vpfe_ep>;
+   pixel-clock-frequency = <7000>;
+   };
+   };
+   };
+   ...
+   };
diff --git a/MAINTAINERS b/MAINTAINERS
index ddc5a8c..4006cc8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8910,6 +8910,16 @@ T:   git 
git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git
 S: Maintained
 F: drivers/media/platform/am437x/
 
+OV2659 OMNIVISION SENSOR DRIVER
+M: Lad, Prabhakar 
+L: linux-media@vger.kernel.org
+W: http://linuxtv.org/
+Q: http://patchwork.linuxtv.org/project/linux-media/list/
+T: git git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git
+S: Maintained
+F: drivers/media/i2c/ov2659.c
+F: include/media/ov2659.h
+
 SIS 190 ETHERNET DRIVER
 M: Francois Romieu 
 L: net...@vger.kernel.org
diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index da58c9b..6f30ea7 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -466,6 +466,17 @@ config VIDEO_APTINA_PLL
 config VIDEO_SMIAPP_PLL
tristate
 
+config VIDEO_OV2659
+   tristate "OmniVision OV2659 sensor support"
+   depends on VIDEO_V4L2 && I2C
+   depends on MEDIA_CAMERA_SUPPORT
+   ---help---
+ This is a Video4Linux2 sensor-level driver for the OmniVision
+ OV2659 camera.
+
+ To compile this driver as a module, choose M here: the
+ module will be called ov2659.
+
 config VIDEO_OV7640
tristate "OmniVision OV7640 sensor support"
depends on I2C && VIDEO_V4L2
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index 98589001..f165fae 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -77,3 +77,4 @@ obj-$(CONFIG_VIDEO_SMIAPP_PLL)+= smiapp-pll.o
 obj-$(CONFIG_VIDEO_AK881X) += ak881x.o
 obj-$(CONFIG_VIDEO_IR_I2C)  += ir-kbd-i2c.o
 obj-$(CONFIG_VIDEO_ML86V7667)  += ml86v7667.o
+obj-$(CONFIG_VIDEO_OV2659) += ov2659.o
diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c
new file mode 100644
index 000..98c8a18
--- /dev/null
+++ b/drivers/media/i2c/ov2659.c
@@ -0,0 +1,1495 @@
+/*
+ * Omnivision OV2659 CMOS Image Sensor driver
+ *
+ * Copyright (C) 2015 Texas Instruments, Inc.
+ *
+ * Benoit Parrot 
+ * Lad, Prabhakar 
+ *
+ * This program is free software; you may redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPL