Re: OV7670 driver for Mini2440

2013-07-26 Thread Anvesh Manne
Hi Sylwester,

Can you guide me on how to write a patch to interface ov7670 with mini2440?

Thnaks,
Anvesh

On 20-Mar-2013, at 1:57 AM, Sylwester Nawrocki wrote:

 Hi Anvesh,
 
 On 03/19/2013 03:41 PM, Anvesh Manne wrote:
 Hello,
 
 Cc linux-media mailing list.
 
 I am trying to get the OV7670 module to work with Mini2440. Despite my
 best efforts, i am ending with the following image.
 
 OK, what kernel version and drivers are you currently using. Is it some
 custom BSP or the Pengutronix's one ?
 
 The image looks like there is a mismatch in configured pixel format at
 the sensor and the s3c2440 CAMIF device.
 
 Can you guide me on how to install your driver from
 (http://git.linuxtv.org/snawrocki/media.git/commit/caa3b9af18f344ef9b21377f7dc4631bd6a99d19)
 along with the driver from http://patchwork.linuxtv.org/patch/563/ ?
 
 There is already ov7670 sensor driver in the mainline kernel that
 looks much better then the one from the link above. With a small
 patch we should be able to use it with Mini2440.
 
 If possible, I suggest you to use latest kernel that can be found here:
 http://git.linuxtv.org/media_tree.git
 
 I have directly interfaced OV7670 to the Camera port of Mini2440.
 
 Thanks for you help.
 
 Anvesh
 
 --
 
 Regards,
 Sylwester

--
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: [omap3isp] xclk deadlock

2013-07-26 Thread Tomi Valkeinen
On 17/07/13 15:50, Laurent Pinchart wrote:
 Hi Jakub,
 
 (CC'ing Tomi Valkeinen)
 
 On Friday 12 July 2013 16:44:44 Jakub Piotr Cłapa wrote:

 2. When exiting from live the kernel hangs more often then not
 (sometimes it is accompanied by Unhandled fault: external abort on
 non-linefetch in dispc_write_irqenable in omapdss).
 
 I'll pass this one to Tomi :-)

Sounds like something is enabling/disabling dispc interrupts after the
clocks have already been turned off.

So what's the context here? What kernel? Using omapfb, or...? I hope not
omap_vout, because that's rather unmaintained =).

 Tomi




signature.asc
Description: OpenPGP digital signature


Re: [RFC] Dropping of channels-conf from dtv-scan-tables

2013-07-26 Thread Huei-Horng Yo
Sorry for my off-topic, because dvb-apps' 'scan' utility output wrong
encoding of channels-conf in Taiwan, that's why 'tw-All' channels-conf
is still useful for some Taiwan people. Or someone could review my
patch about this encoding issue? ([PATCH][dvb-apps] Fix 'scan' utility
region 0x14 encoding from BIG5 to UTF-16BE)

Thanks,

Huei-Horng Yo

2013/7/12 Oliver Schinagl oliver+l...@schinagl.nl:
 Hey all,

 The channels-conf directory in the dtv-scan-tables repository is bitrotten.
 Besides tw-All, the newest addition is over 6 years ago, with some being as
 old as 9 years. While I'm sure it's possible that the channels-conf are
 still accurate, it's not really needed any longer.

 Unless valid reasons are brought up to keep it, I will move it to a seperate
 branch and delete it from the master branch in the next few weeks.

 Thanks,

 Oliver
 --
 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
--
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 v3.11]

2013-07-26 Thread Hans Verkuil
Hi Prabhakar,

On 07/26/2013 06:33 AM, Prabhakar Lad wrote:
 Hi Hans,
 
 On Thu, Jul 25, 2013 at 6:55 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 Hi Prabhakar,

 On Thu 11 July 2013 19:25:15 Prabhakar Lad wrote:
 Hi Hans,

 On Thu, Jun 27, 2013 at 12:25 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 (Same as my previous git pull message, but with more cleanup patches and
 [snip]
 Lad, Prabhakar (9):
   media: i2c: ths8200: support asynchronous probing
   media: i2c: ths8200: add OF support
   media: i2c: adv7343: add support for asynchronous probing
   media: i2c: tvp7002: add support for asynchronous probing
   media: i2c: tvp7002: remove manual setting of subdev name
   media: i2c: tvp514x: remove manual setting of subdev name
   media: i2c: tvp514x: add support for asynchronous probing
   media: davinci: vpif: capture: add V4L2-async support
   media: davinci: vpif: display: add V4L2-async support

 I see last two patches missing in Mauro's pull request for v3.11 and 
 v3.11-rc1.

 I had to split up my pull request into fixes for 3.11 and new stuff for 3.12
 since the merge window was about to open at the time.

 Ok no problem.
 
 Your 'missing' patches are here:

 http://git.linuxtv.org/hverkuil/media_tree.git/shortlog/refs/heads/for-v3.12

 Yeah I saw it lately.
 
 In the next few days I'll try to process all remaining patches delegated to 
 me.
 Ok
 
 If you have patches not yet delegated to me, or that are not in my for-v3.12
 branch, then let me know.

 There are few patches, whose state is new do you want me to point them ?

Only if they are either not in patchwork, or are in patchwork but not delegated 
to me.

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: width and height of JPEG compressed images

2013-07-26 Thread Sakari Ailus
Hi Sylwester and Thomas,

On Wed, Jul 24, 2013 at 10:39:11AM +0200, Sylwester Nawrocki wrote:
 Hi,
 
 On 07/24/2013 09:47 AM, Thomas Vajzovic wrote:
   On 23 July 2013 23:21 Sakari Ailus wrote:
  On Sun, Jul 21, 2013 at 10:38:18PM +0200, Sylwester Nawrocki wrote:
  On 07/19/2013 10:28 PM, Sakari Ailus wrote:
  On Sat, Jul 06, 2013 at 09:58:23PM +0200, Sylwester Nawrocki wrote:
  On 07/05/2013 10:22 AM, Thomas Vajzovic wrote:
 
  The hardware reads AxB sensor pixels from its array, resamples them
  to CxD image pixels, and then compresses them to ExF bytes.
 
  sensor matrix (AxB pixels) -  binning/skipping (CxD pixels) -
  -  JPEG compresion (width = C, height = D, sizeimage ExF bytes)
 
  Does the user need to specify ExF, for other purposes than limiting
  the size of the image? I would leave this up to the sensor driver
  (with reasonable alignment). The sensor driver would tell about this
  to the receiver through
 
  AFAIU ExF is closely related to the memory buffer size, so the sensor
  driver itself wouldn't have enough information to fix up ExF, would it ?
 
  If the desired sizeimage is known, F can be calculated if E is fixed, say
  1024 should probably work for everyone, shoulnd't it?
  
  It's a nice clean idea (and I did already consider it) but it reduces the
  flexibility of the system as a whole.
  
  Suppose an embedded device wants to send the compressed image over a
  network in packets of 1500 bytes, and they want to allow 3 packets per
  frame.  Your proposal limits sizeimage to a multiple of 1K, so they have
  to set sizeimage to 4K when they want 4.5K, meaning that they waste 500
  bytes of bandwidth every frame.
  
  You could say tough luck, extra overhead like this is something you should
  expect if you want to use a general purpose API like V4L2, but why make
  it worse if we can make it better?
 
 I entirely agree with that. Other issue with fixed number of samples
 per line is that internal (FIFO) line buffer size of the transmitter
 devices will vary, and for example some devices might have line buffer
 smaller than the value we have arbitrarily chosen. I'd expect the
 optimal number of samples per line to vary among different devices
 and use cases.

I guess the sensor driver could factor the size as well (provided it can
choose an arbitrary size) but then to be fully generic, I think alignment
must also be taken care of. Many receivers might require width to be even
but some might have tighter requirements. They have a minimum width, too.

To make this working in a generic case might not be worth the time and
effort of being able to shave up to 1 kiB off of video buffer allocations.

Remember v4l2_buffer.length is different from v4l2_pix_format.sizeimage.
Hmm. Yes --- so to the sensor goes desired maximum size, and back you'd get
ExF (i.e. buffer length) AND the size of the image.

What do you think?

-- 
Cheers,

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


siano: divide error: 0000 [#1] SMP

2013-07-26 Thread Petr Janecek
Hello,
  since about 3.10, siano dvb-t tuner (usb id 187f:0202) crashes the
machine when plugged in before boot. No such problem if connected later.


Regards,

Petr


[   38.387145] divide error:  [#1] SMP 
[   38.391132] Modules linked in: ip6table_filter ip6_tables ebtable_nat 
ebtables ipt_REJECT xt_CHECKSUM iptable_mangle xt_tcpudp iptable_filter 
ip_tables x_tables bridge stp llc kvm_intel kvm dm_crypt snd_hda_codec_hdmi 
snd_hda_codec_idt snd_hda_intel snd_hda_codec snd_hwdep smsusb smsdvb dvb_core 
snd_pcm smsmdtv snd_seq_midi snd_rawmidi snd_seq_midi_event snd_seq snd_timer 
snd_seq_device snd soundcore lpc_ich serio_raw snd_page_alloc coretemp nfsd 
nfs_acl auth_rpcgss oid_registry nfs fscache binfmt_misc lockd sunrpc xfs 
exportfs libcrc32c hid_generic usbhid hid e1000e firewire_ohci ptp i915 ahci 
drm_kms_helper firewire_core crc_itu_t libahci drm i2c_algo_bit pps_core video 
usb_storage [last unloaded: ipmi_msghandler]
[   38.397124] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.11.0-rc2 #6
[   38.397124] Hardware name:  /DG45ID, BIOS 
IDG4510H.86A.0135.2011.0225.1100 02/25/2011
[   38.397124] task: 81c10440 ti: 81c0 task.ti: 
81c0
[   38.397124] RIP: 0010:[a043d1a2]  [a043d1a2] 
smsdvb_update_per_slices+0xd2/0xe0 [smsdvb]
[   38.397124] RSP: 0018:88012bc03c18  EFLAGS: 00010046
[   38.397124] RAX:  RBX: 880124599000 RCX: 
[   38.397124] RDX:  RSI: 8800370da008 RDI: 880124599000
[   38.397124] RBP: 88012bc03c18 R08: 0001 R09: 0001
[   38.397124] R10:  R11:  R12: 880124d24ac0
[   38.397124] R13: 8800370da008 R14: 8800370da000 R15: 8800370042e0
[   38.397124] FS:  () GS:88012bc0() 
knlGS:
[   38.397124] CS:  0010 DS:  ES:  CR0: 8005003b
[   38.397124] CR2: 7f186c361c80 CR3: 0001240a8000 CR4: 000407f0
[   38.397124] Stack:
[   38.397124]  88012bc03c48 a043e088 8800370da000 
880124d24ac0
[   38.397124]  880125482000 fffc020c 88012bc03c78 
a042e6e1
[   38.397124]  8801268f0390 8800370da000 8801268f 
8801268f03b0
[   38.397124] Call Trace:
[   38.397124]  IRQ 
[   38.397124]  [a043e088] smsdvb_onresponse+0x1b8/0x280 [smsdvb]
[   38.397124]  [a042e6e1] smscore_onresponse+0x91/0x450 [smsmdtv]
[   38.397124]  [a045e184] smsusb_onresponse+0xb4/0x1f0 [smsusb]
[   38.397124]  [8147f084] usb_hcd_giveback_urb+0x64/0xe0
[   38.397124]  [81495d81] ehci_urb_done+0x71/0xb0
[   38.397124]  [814992ed] qh_completions+0x1ed/0x380
[   38.397124]  [8149994b] scan_async+0x7b/0xe0
[   38.397124]  [8149b130] ehci_work+0x70/0xd0
[   38.397124]  [8149b431] ehci_irq+0x201/0x2c0
[   38.397124]  [8147e23e] usb_hcd_irq+0x2e/0x50
[   38.397124]  [810e6af5] handle_irq_event_percpu+0x75/0x260
[   38.397124]  [810e6d28] handle_irq_event+0x48/0x70
[   38.397124]  [810e9d5e] ? handle_fasteoi_irq+0x1e/0x100
[   38.397124]  [810e9d9a] handle_fasteoi_irq+0x5a/0x100
[   38.397124]  [81004940] handle_irq+0x60/0x150
[   38.397124]  [81644906] ? atomic_notifier_call_chain+0x16/0x20
[   38.397124]  [8164b21a] do_IRQ+0x5a/0xe0
[   38.397124]  [816406aa] common_interrupt+0x6a/0x6a
[   38.397124]  EOI 
[   38.397124]  [814f6b5b] ? cpuidle_enter_state+0x5b/0xe0
[   38.397124]  [814f6b57] ? cpuidle_enter_state+0x57/0xe0
[   38.397124]  [814f6ca0] cpuidle_idle_call+0xc0/0x260
[   38.397124]  [8100bcbe] arch_cpu_idle+0xe/0x30
[   38.397124]  [8109dcf6] cpu_idle_loop+0x86/0x270
[   38.397124]  [8109df4b] cpu_startup_entry+0x6b/0x70
[   38.397124]  [81624d51] rest_init+0xd1/0xe0
[   38.397124]  [81624c85] ? rest_init+0x5/0xe0
[   38.397124]  [81cefe70] start_kernel+0x3c1/0x3ce
[   38.397124]  [81cef941] ? repair_env_string+0x5a/0x5a
[   38.397124]  [81cef5a6] x86_64_start_reservations+0x2a/0x2c
[   38.397124]  [81cef694] x86_64_start_kernel+0xec/0xf3
[   38.397124] Code: 00 00 03 48 01 87 05 0b 00 00 8b 46 4c 48 01 87 96 0a 00 
00 8b 46 48 48 01 87 bb 0a 00 00 8b 4e 10 89 c8 c1 e0 10 29 c8 03 4e 0c 48 f7 
f1 89 87 e8 0b 00 00 5d c3 0f 1f 00 66 66 66 66 90 55 48 
[   38.397124] RIP  [a043d1a2] smsdvb_update_per_slices+0xd2/0xe0 
[smsdvb]
[   38.397124]  RSP 88012bc03c18
[   38.397124] ---[ end trace 8ecbe785c081e3cd ]---

--
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/7] [media] vsp1: Use the maximum number defined in platform data

2013-07-26 Thread Katsuya Matsubara
The VSP1 driver allows to define the maximum number of each module
such as RPF, WPF, and UDS in a platform data definition.
This suppresses operations for nonexistent or unused modules.

Signed-off-by: Katsuya Matsubara ma...@igel.co.jp
---
 drivers/media/platform/vsp1/vsp1_drv.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
b/drivers/media/platform/vsp1/vsp1_drv.c
index 0ead308..a8c21f8 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -35,7 +35,7 @@ static irqreturn_t vsp1_irq_handler(int irq, void *data)
irqreturn_t ret = IRQ_NONE;
unsigned int i;
 
-   for (i = 0; i  VPS1_MAX_WPF; ++i) {
+   for (i = 0; i  vsp1-pdata-wpf_count; ++i) {
struct vsp1_rwpf *wpf = vsp1-wpf[i];
struct vsp1_pipeline *pipe;
u32 status;
@@ -243,7 +243,7 @@ static void vsp1_device_init(struct vsp1_device *vsp1)
/* Reset any channel that might be running. */
status = vsp1_read(vsp1, VI6_STATUS);
 
-   for (i = 0; i  VPS1_MAX_WPF; ++i) {
+   for (i = 0; i  vsp1-pdata-wpf_count; ++i) {
unsigned int timeout;
 
if (!(status  VI6_STATUS_SYS_ACT(i)))
@@ -265,10 +265,10 @@ static void vsp1_device_init(struct vsp1_device *vsp1)
vsp1_write(vsp1, VI6_CLK_DCSWT, (8  VI6_CLK_DCSWT_CSTPW_SHIFT) |
   (8  VI6_CLK_DCSWT_CSTRW_SHIFT));
 
-   for (i = 0; i  VPS1_MAX_RPF; ++i)
+   for (i = 0; i  vsp1-pdata-rpf_count; ++i)
vsp1_write(vsp1, VI6_DPR_RPF_ROUTE(i), VI6_DPR_NODE_UNUSED);
 
-   for (i = 0; i  VPS1_MAX_UDS; ++i)
+   for (i = 0; i  vsp1-pdata-uds_count; ++i)
vsp1_write(vsp1, VI6_DPR_UDS_ROUTE(i), VI6_DPR_NODE_UNUSED);
 
vsp1_write(vsp1, VI6_DPR_SRU_ROUTE, VI6_DPR_NODE_UNUSED);
-- 
1.7.9.5

--
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 3/7] [media] vsp1: Rewrite the definition of registers' offset as enum and arrays

2013-07-26 Thread Katsuya Matsubara
This replaces the macro definitions of register offset with
one written as enum and arrays. It could be useful for supporting
multiple versions of the H/W IP.

Signed-off-by: Katsuya Matsubara ma...@igel.co.jp
---
 drivers/media/platform/vsp1/vsp1.h|   15 +-
 drivers/media/platform/vsp1/vsp1_drv.c|  195 -
 drivers/media/platform/vsp1/vsp1_entity.c |   18 +-
 drivers/media/platform/vsp1/vsp1_regs.h   |  450 +
 drivers/media/platform/vsp1/vsp1_rpf.c|   12 +-
 drivers/media/platform/vsp1/vsp1_uds.c|   12 +-
 drivers/media/platform/vsp1/vsp1_video.c  |3 +-
 drivers/media/platform/vsp1/vsp1_wpf.c|   20 +-
 8 files changed, 501 insertions(+), 224 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1.h 
b/drivers/media/platform/vsp1/vsp1.h
index 11ac94b..8db5bbb 100644
--- a/drivers/media/platform/vsp1/vsp1.h
+++ b/drivers/media/platform/vsp1/vsp1.h
@@ -55,19 +55,26 @@ struct vsp1_device {
 
struct v4l2_device v4l2_dev;
struct media_device media_dev;
+
+   const unsigned int *reg_offs;
 };
 
 struct vsp1_device *vsp1_device_get(struct vsp1_device *vsp1);
 void vsp1_device_put(struct vsp1_device *vsp1);
 
-static inline u32 vsp1_read(struct vsp1_device *vsp1, u32 reg)
+static inline u32 _vsp1_read(struct vsp1_device *vsp1,
+int reg, unsigned int off)
 {
-   return ioread32(vsp1-mmio + reg);
+   return ioread32(vsp1-mmio + vsp1-reg_offs[reg] + off);
 }
 
-static inline void vsp1_write(struct vsp1_device *vsp1, u32 reg, u32 data)
+static inline void _vsp1_write(struct vsp1_device *vsp1,
+  int reg, unsigned int off, u32 data)
 {
-   iowrite32(data, vsp1-mmio + reg);
+   iowrite32(data, vsp1-mmio + vsp1-reg_offs[reg] + off);
 }
 
+#define vsp1_read(_dev, _reg)  _vsp1_read((_dev), (_reg), 0)
+#define vsp1_write(_dev, _reg, _dat)   _vsp1_write((_dev), (_reg), 0, (_dat))
+
 #endif /* __VSP1_H__ */
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
b/drivers/media/platform/vsp1/vsp1_drv.c
index a8c21f8..42f51d8 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -44,8 +44,8 @@ static irqreturn_t vsp1_irq_handler(int irq, void *data)
continue;
 
pipe = to_vsp1_pipeline(wpf-entity.subdev.entity);
-   status = vsp1_read(vsp1, VI6_WPF_IRQ_STA(i));
-   vsp1_write(vsp1, VI6_WPF_IRQ_STA(i), ~status  mask);
+   status = vsp1_read(vsp1, VI6_WPF_IRQ_STA0 + i);
+   vsp1_write(vsp1, VI6_WPF_IRQ_STA0 + i, ~status  mask);
 
if (status  VI6_WFP_IRQ_STA_FRE) {
vsp1_pipeline_frame_end(pipe);
@@ -266,10 +266,10 @@ static void vsp1_device_init(struct vsp1_device *vsp1)
   (8  VI6_CLK_DCSWT_CSTRW_SHIFT));
 
for (i = 0; i  vsp1-pdata-rpf_count; ++i)
-   vsp1_write(vsp1, VI6_DPR_RPF_ROUTE(i), VI6_DPR_NODE_UNUSED);
+   vsp1_write(vsp1, VI6_DPR_RPF_ROUTE0 + i, VI6_DPR_NODE_UNUSED);
 
for (i = 0; i  vsp1-pdata-uds_count; ++i)
-   vsp1_write(vsp1, VI6_DPR_UDS_ROUTE(i), VI6_DPR_NODE_UNUSED);
+   vsp1_write(vsp1, VI6_DPR_UDS_ROUTE0 + i, VI6_DPR_NODE_UNUSED);
 
vsp1_write(vsp1, VI6_DPR_SRU_ROUTE, VI6_DPR_NODE_UNUSED);
vsp1_write(vsp1, VI6_DPR_LUT_ROUTE, VI6_DPR_NODE_UNUSED);
@@ -403,6 +403,191 @@ vsp1_get_platform_data(struct platform_device *pdev)
return pdata;
 }
 
+static const unsigned int vsp1_reg_offs[] = {
+   [VI6_CMD0]  = 0x,
+   [VI6_CMD1]  = 0x + 1 * 4,
+   [VI6_CMD2]  = 0x + 2 * 4,
+   [VI6_CMD3]  = 0x + 3 * 4,
+   [VI6_CLK_DCSWT] = 0x0018,
+   [VI6_SRESET]= 0x0028,
+   [VI6_STATUS]= 0x0038,
+   [VI6_WPF_IRQ_ENB0]  = 0x0048,
+   [VI6_WPF_IRQ_ENB1]  = 0x0048 + 1 * 12,
+   [VI6_WPF_IRQ_ENB2]  = 0x0048 + 2 * 12,
+   [VI6_WPF_IRQ_ENB3]  = 0x0048 + 3 * 12,
+   [VI6_WPF_IRQ_STA0]  = 0x004c,
+   [VI6_WPF_IRQ_STA1]  = 0x004c + 1 * 12,
+   [VI6_WPF_IRQ_STA2]  = 0x004c + 2 * 12,
+   [VI6_WPF_IRQ_STA3]  = 0x004c + 3 * 12,
+   [VI6_DISP_IRQ_ENB]  = 0x0078,
+   [VI6_DISP_IRQ_STA]  = 0x007c,
+   [VI6_WPF_LINE_COUNT0]   = 0x0084,
+   [VI6_WPF_LINE_COUNT1]   = 0x0084 + 1 * 4,
+   [VI6_WPF_LINE_COUNT2]   = 0x0084 + 2 * 4,
+   [VI6_WPF_LINE_COUNT3]   = 0x0084 + 3 * 4,
+
+   [VI6_DL_CTRL]   = 0x0100,
+   [VI6_DL_HDR_ADDR0]  = 0x0104,
+   [VI6_DL_HDR_ADDR1]  = 0x0104 + 1 * 4,
+   [VI6_DL_HDR_ADDR2]  = 0x0104 + 2 * 4,
+   [VI6_DL_HDR_ADDR3]  = 0x0104 + 3 * 4,
+   [VI6_DL_SWAP]   = 0x0114,
+   [VI6_DL_EXT_CTRL]   = 0x011c,
+   [VI6_DL_BODY_SIZE]  = 0x0120,
+
+   [VI6_RPF_SRC_BSIZE] = 0x0300,
+   

[PATCH 1/7] [media] vsp1: Fix lack of the sink entity registration for enabled links

2013-07-26 Thread Katsuya Matsubara
Each source entity maintains a pointer to the counterpart sink
entity while an enabled link connects them. It should be managed by
the setup_link callback in the media controller framework at runtime.
However, enabled links which connect RPFs and WPFs that have an
equivalent index number are created during initialization.
This registers the pointer to a sink entity from the source entity
when an enabled link is created.

Signed-off-by: Katsuya Matsubara ma...@igel.co.jp
---
 drivers/media/platform/vsp1/vsp1_drv.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
b/drivers/media/platform/vsp1/vsp1_drv.c
index 756929e..0ead308 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -101,6 +101,9 @@ static int vsp1_create_links(struct vsp1_device *vsp1, 
struct vsp1_entity *sink)
   entity, pad, flags);
if (ret  0)
return ret;
+
+   if (flags  MEDIA_LNK_FL_ENABLED)
+   source-sink = entity;
}
}
 
-- 
1.7.9.5

--
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/7] [media] vsp1: Add VIO6 support

2013-07-26 Thread Katsuya Matsubara
Hi Laurent,

Could you please consider the following patches to add VIO6 support
into your VSP1 driver implementation?
Any comments or ideas of better implementation are of course welcome.

The first two patches are fixes, not only for VIO6.
The next four patches are preparations of supporting multiple
versions of the H/W IP.
The final one is adding definitions of VIO6.

The code has been tested on an Armadillo800EVA board.

The series is based on the following patchset:
 [PATCH v3 0/5] Renesas VSP1 driver
 [PATCH v3 1/5] media: Add support for circular graph traversal
 [PATCH v3 2/5] v4l: Fix V4L2_MBUS_FMT_YUV10_1X30 media bus pixel code value
 [PATCH v3 3/5] v4l: Add media format codes for ARGB and AYUV on 32-bit 
busses
 [PATCH v3 4/5] v4l: Add V4L2_PIX_FMT_NV16M and V4L2_PIX_FMT_NV61M formats
 [PATCH v3 5/5] v4l: Renesas R-Car VSP1 driver


Katsuya Matsubara (7):
  [media] vsp1: Fix lack of the sink entity setting for enabled links.
  [media] vsp1: Use the maximum number defined in platform data
  [media] vsp1: Rewrite the definition of registers' offset as enum and
arrays
  [media] vsp1: Rewrite the value definitions for DPR routing as enum
and arrays
  [media] vsp1: Introduce bit operations for the DPR route registers
  [media] vsp1: Move the DPR_WPF_FPORCH register settings into the
device initialization
  [media] vsp1: Add VIO6 support

 drivers/media/platform/vsp1/vsp1.h|   23 +-
 drivers/media/platform/vsp1/vsp1_drv.c|  492 ++--
 drivers/media/platform/vsp1/vsp1_entity.c |   31 +-
 drivers/media/platform/vsp1/vsp1_entity.h |3 +-
 drivers/media/platform/vsp1/vsp1_lif.c|2 +-
 drivers/media/platform/vsp1/vsp1_regs.h   |  497 +
 drivers/media/platform/vsp1/vsp1_rpf.c|   19 +-
 drivers/media/platform/vsp1/vsp1_uds.c|   14 +-
 drivers/media/platform/vsp1/vsp1_video.c  |   27 +-
 drivers/media/platform/vsp1/vsp1_wpf.c|   29 +-
 10 files changed, 849 insertions(+), 288 deletions(-)

-- 
Thanks,

Katsuya Matsubara / IGEL Co., Ltd.
ma...@igel.co.jp
--
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 5/7] [media] vsp1: Introduce bit operations for the DPR route registers

2013-07-26 Thread Katsuya Matsubara
This change allows support for H/W IPs in which multiple DPR route
registers are combined into one.

Signed-off-by: Katsuya Matsubara ma...@igel.co.jp
---
 drivers/media/platform/vsp1/vsp1.h   |1 +
 drivers/media/platform/vsp1/vsp1_drv.c   |   94 +++---
 drivers/media/platform/vsp1/vsp1_video.c |   23 +---
 3 files changed, 77 insertions(+), 41 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1.h 
b/drivers/media/platform/vsp1/vsp1.h
index 4d9b6c8..31c24a3 100644
--- a/drivers/media/platform/vsp1/vsp1.h
+++ b/drivers/media/platform/vsp1/vsp1.h
@@ -39,6 +39,7 @@ struct vsp1_uds;
 struct vsp1_dpr_route {
unsigned int id;
int reg;
+   int shift;
 };
 
 struct vsp1_device {
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
b/drivers/media/platform/vsp1/vsp1_drv.c
index 920edb1..ca05431 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -240,6 +240,7 @@ static void vsp1_device_init(struct vsp1_device *vsp1)
unsigned int i;
u32 status;
u32 route_unused = vsp1-routes[VI6_DPR_NODE_UNUSED].id;
+   u32 val;
 
/* Reset any channel that might be running. */
status = vsp1_read(vsp1, VI6_STATUS);
@@ -266,18 +267,43 @@ static void vsp1_device_init(struct vsp1_device *vsp1)
vsp1_write(vsp1, VI6_CLK_DCSWT, (8  VI6_CLK_DCSWT_CSTPW_SHIFT) |
   (8  VI6_CLK_DCSWT_CSTRW_SHIFT));
 
-   for (i = 0; i  vsp1-pdata-rpf_count; ++i)
-   vsp1_write(vsp1, VI6_DPR_RPF_ROUTE0 + i, route_unused);
+   for (i = 0; i  vsp1-pdata-rpf_count; ++i) {
+   val = vsp1_read(vsp1, VI6_DPR_RPF_ROUTE0 + i);
+   val |= route_unused
+vsp1-routes[VI6_DPR_NODE_RPF0 + i].shift;
+   vsp1_write(vsp1, VI6_DPR_RPF_ROUTE0 + i, val);
+   }
+
+   for (i = 0; i  vsp1-pdata-uds_count; ++i) {
+   val = vsp1_read(vsp1, VI6_DPR_UDS_ROUTE0 + i);
+   val |= route_unused
+vsp1-routes[VI6_DPR_NODE_UDS0 + i].shift;
+   vsp1_write(vsp1, VI6_DPR_UDS_ROUTE0 + i, val);
+   }
+
+   val = vsp1_read(vsp1, VI6_DPR_SRU_ROUTE);
+   val |= route_unused  vsp1-routes[VI6_DPR_NODE_SRU].shift;
+   vsp1_write(vsp1, VI6_DPR_SRU_ROUTE, val);
+
+   val = vsp1_read(vsp1, VI6_DPR_LUT_ROUTE);
+   val |= route_unused  vsp1-routes[VI6_DPR_NODE_LUT].shift;
+   vsp1_write(vsp1, VI6_DPR_LUT_ROUTE, val);
+
+   val = vsp1_read(vsp1, VI6_DPR_CLU_ROUTE);
+   val |= route_unused  vsp1-routes[VI6_DPR_NODE_CLU].shift;
+   vsp1_write(vsp1, VI6_DPR_CLU_ROUTE, val);
+
+   val = vsp1_read(vsp1, VI6_DPR_HST_ROUTE);
+   val |= route_unused  vsp1-routes[VI6_DPR_NODE_HST].shift;
+   vsp1_write(vsp1, VI6_DPR_HST_ROUTE, val);
 
-   for (i = 0; i  vsp1-pdata-uds_count; ++i)
-   vsp1_write(vsp1, VI6_DPR_UDS_ROUTE0 + i, route_unused);
+   val = vsp1_read(vsp1, VI6_DPR_HSI_ROUTE);
+   val |= route_unused  vsp1-routes[VI6_DPR_NODE_HSI].shift;
+   vsp1_write(vsp1, VI6_DPR_HSI_ROUTE, val);
 
-   vsp1_write(vsp1, VI6_DPR_SRU_ROUTE, route_unused);
-   vsp1_write(vsp1, VI6_DPR_LUT_ROUTE, route_unused);
-   vsp1_write(vsp1, VI6_DPR_CLU_ROUTE, route_unused);
-   vsp1_write(vsp1, VI6_DPR_HST_ROUTE, route_unused);
-   vsp1_write(vsp1, VI6_DPR_HSI_ROUTE, route_unused);
-   vsp1_write(vsp1, VI6_DPR_BRU_ROUTE, route_unused);
+   val = vsp1_read(vsp1, VI6_DPR_BRU_ROUTE);
+   val |= route_unused  vsp1-routes[VI6_DPR_NODE_BRU_OUT].shift;
+   vsp1_write(vsp1, VI6_DPR_BRU_ROUTE, val);
 
vsp1_write(vsp1, VI6_DPR_HGO_SMPPT, (7  VI6_DPR_SMPPT_TGW_SHIFT) |
   (route_unused  VI6_DPR_SMPPT_PT_SHIFT));
@@ -590,30 +616,30 @@ static const unsigned int vsp1_reg_offs[] = {
 };
 
 static const struct vsp1_dpr_route vsp1_routes[] = {
-   [VI6_DPR_NODE_RPF0] = {  0, VI6_DPR_RPF_ROUTE0  },
-   [VI6_DPR_NODE_RPF1] = {  1, VI6_DPR_RPF_ROUTE0 + 1 },
-   [VI6_DPR_NODE_RPF2] = {  2, VI6_DPR_RPF_ROUTE0 + 2 },
-   [VI6_DPR_NODE_RPF3] = {  3, VI6_DPR_RPF_ROUTE0 + 3 },
-   [VI6_DPR_NODE_RPF4] = {  4, VI6_DPR_RPF_ROUTE0 + 4 },
-   [VI6_DPR_NODE_SRU]  = { 16, VI6_DPR_SRU_ROUTE },
-   [VI6_DPR_NODE_UDS0] = { 17, VI6_DPR_UDS_ROUTE0 },
-   [VI6_DPR_NODE_UDS1] = { 18, VI6_DPR_UDS_ROUTE0 + 1 },
-   [VI6_DPR_NODE_UDS2] = { 19, VI6_DPR_UDS_ROUTE0 + 2 },
-   [VI6_DPR_NODE_LUT]  = { 22, VI6_DPR_LUT_ROUTE },
-   [VI6_DPR_NODE_BRU_IN0]  = { 23, 0 },
-   [VI6_DPR_NODE_BRU_IN1]  = { 24, 0 },
-   [VI6_DPR_NODE_BRU_IN2]  = { 25, 0 },
-   [VI6_DPR_NODE_BRU_IN3]  = { 26, 0 },
-   [VI6_DPR_NODE_BRU_OUT]  = { 27, VI6_DPR_BRU_ROUTE },
-   [VI6_DPR_NODE_CLU]  = { 29, VI6_DPR_CLU_ROUTE },
-   [VI6_DPR_NODE_HST]  = { 30, VI6_DPR_HST_ROUTE },
-   [VI6_DPR_NODE_HSI]  = { 31, VI6_DPR_HSI_ROUTE },
-   

[PATCH 6/7] [media] vsp1: Move the DPR_WPF_FPORCH register settings into the device initialization

2013-07-26 Thread Katsuya Matsubara
The DPR_WPR_FPORCH registers must be set once with a constant value
and they are never varied at runtime.
So it can be moved into the vsp1_device_init function that will be
invoked just one time.

Signed-off-by: Katsuya Matsubara ma...@igel.co.jp
---
 drivers/media/platform/vsp1/vsp1_drv.c  |9 +
 drivers/media/platform/vsp1/vsp1_regs.h |2 +-
 drivers/media/platform/vsp1/vsp1_wpf.c  |3 ---
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
b/drivers/media/platform/vsp1/vsp1_drv.c
index ca05431..c24f43f 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -241,6 +241,12 @@ static void vsp1_device_init(struct vsp1_device *vsp1)
u32 status;
u32 route_unused = vsp1-routes[VI6_DPR_NODE_UNUSED].id;
u32 val;
+   const u32 fporch_fp[VPS1_MAX_WPF] = {
+   (VI6_DPR_WPF_FPORCH_FP_WPFN  8),
+   (VI6_DPR_WPF_FPORCH_FP_WPFN  8),
+   (VI6_DPR_WPF_FPORCH_FP_WPFN  8),
+   (VI6_DPR_WPF_FPORCH_FP_WPFN  8),
+   };
 
/* Reset any channel that might be running. */
status = vsp1_read(vsp1, VI6_STATUS);
@@ -305,6 +311,9 @@ static void vsp1_device_init(struct vsp1_device *vsp1)
val |= route_unused  vsp1-routes[VI6_DPR_NODE_BRU_OUT].shift;
vsp1_write(vsp1, VI6_DPR_BRU_ROUTE, val);
 
+   for (i = 0; i  VPS1_MAX_WPF; ++i)
+   vsp1_write(vsp1, VI6_DPR_WPF_FPORCH0 + i, fporch_fp[i]);
+
vsp1_write(vsp1, VI6_DPR_HGO_SMPPT, (7  VI6_DPR_SMPPT_TGW_SHIFT) |
   (route_unused  VI6_DPR_SMPPT_PT_SHIFT));
vsp1_write(vsp1, VI6_DPR_HGT_SMPPT, (7  VI6_DPR_SMPPT_TGW_SHIFT) |
diff --git a/drivers/media/platform/vsp1/vsp1_regs.h 
b/drivers/media/platform/vsp1/vsp1_regs.h
index b201202..bd9f72e 100644
--- a/drivers/media/platform/vsp1/vsp1_regs.h
+++ b/drivers/media/platform/vsp1/vsp1_regs.h
@@ -507,7 +507,7 @@ enum {
  * Macros for DPR Control Registers
  */
 
-#define VI6_DPR_WPF_FPORCH_FP_WPFN (5  8)
+#define VI6_DPR_WPF_FPORCH_FP_WPFN 5
 
 #define VI6_DPR_ROUTE_FXA_MASK (0xff  8)
 #define VI6_DPR_ROUTE_FXA_SHIFT16
diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c 
b/drivers/media/platform/vsp1/vsp1_wpf.c
index 37779ef..af1f1b8 100644
--- a/drivers/media/platform/vsp1/vsp1_wpf.c
+++ b/drivers/media/platform/vsp1/vsp1_wpf.c
@@ -104,9 +104,6 @@ static int wpf_s_stream(struct v4l2_subdev *subdev, int 
enable)
 
vsp1_wpf_write(wpf, VI6_WPF_OUTFMT, outfmt);
 
-   vsp1_write(vsp1, VI6_DPR_WPF_FPORCH0 + wpf-entity.index,
-  VI6_DPR_WPF_FPORCH_FP_WPFN);
-
vsp1_write(vsp1, VI6_WPF_WRBCK_CTRL, 0);
 
/* Enable interrupts */
-- 
1.7.9.5

--
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 7/7] [media] vsp1: Add VIO6 support

2013-07-26 Thread Katsuya Matsubara
VIO6 is an older version of the VSP1 used by many of the current
Renesas R-Car/R-Mobile SoCs.
This patch just handles the differences between VSP1 and VIO6,
by adjusting the offset of some registers and the DPR register
operation.

Signed-off-by: Katsuya Matsubara ma...@igel.co.jp
---
 drivers/media/platform/vsp1/vsp1.h  |1 +
 drivers/media/platform/vsp1/vsp1_drv.c  |  226 +--
 drivers/media/platform/vsp1/vsp1_regs.h |8 ++
 drivers/media/platform/vsp1/vsp1_rpf.c  |5 +
 drivers/media/platform/vsp1/vsp1_wpf.c  |6 +-
 5 files changed, 230 insertions(+), 16 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1.h 
b/drivers/media/platform/vsp1/vsp1.h
index 31c24a3..efd8085 100644
--- a/drivers/media/platform/vsp1/vsp1.h
+++ b/drivers/media/platform/vsp1/vsp1.h
@@ -51,6 +51,7 @@ struct vsp1_device {
 
struct mutex lock;
int ref_count;
+   bool is_vio6;
 
struct vsp1_lif *lif;
struct vsp1_rwpf *rpf[VPS1_MAX_RPF];
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
b/drivers/media/platform/vsp1/vsp1_drv.c
index c24f43f..d685d72 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -241,11 +241,21 @@ static void vsp1_device_init(struct vsp1_device *vsp1)
u32 status;
u32 route_unused = vsp1-routes[VI6_DPR_NODE_UNUSED].id;
u32 val;
-   const u32 fporch_fp[VPS1_MAX_WPF] = {
-   (VI6_DPR_WPF_FPORCH_FP_WPFN  8),
-   (VI6_DPR_WPF_FPORCH_FP_WPFN  8),
-   (VI6_DPR_WPF_FPORCH_FP_WPFN  8),
-   (VI6_DPR_WPF_FPORCH_FP_WPFN  8),
+   const u32 fporch_fp[][VPS1_MAX_WPF] = {
+   {
+   (VI6_DPR_WPF_FPORCH_FP_WPFN  8),
+   (VI6_DPR_WPF_FPORCH_FP_WPFN  8),
+   (VI6_DPR_WPF_FPORCH_FP_WPFN  8),
+   (VI6_DPR_WPF_FPORCH_FP_WPFN  8),
+   },
+   {
+   0,
+   0,
+   (VI6_DPR_WPF_FPORCH_FP_WPFN  16) |
+   (VI6_DPR_WPF_FPORCH_FP_WPFN   8) |
+   (VI6_DPR_WPF_FPORCH_FP_WPFN   0),
+   VI6_DPR_WPF_FPORCH_FP_WPFN  24,
+   },
};
 
/* Reset any channel that might be running. */
@@ -312,12 +322,17 @@ static void vsp1_device_init(struct vsp1_device *vsp1)
vsp1_write(vsp1, VI6_DPR_BRU_ROUTE, val);
 
for (i = 0; i  VPS1_MAX_WPF; ++i)
-   vsp1_write(vsp1, VI6_DPR_WPF_FPORCH0 + i, fporch_fp[i]);
-
-   vsp1_write(vsp1, VI6_DPR_HGO_SMPPT, (7  VI6_DPR_SMPPT_TGW_SHIFT) |
-  (route_unused  VI6_DPR_SMPPT_PT_SHIFT));
-   vsp1_write(vsp1, VI6_DPR_HGT_SMPPT, (7  VI6_DPR_SMPPT_TGW_SHIFT) |
-  (route_unused  VI6_DPR_SMPPT_PT_SHIFT));
+   vsp1_write(vsp1, VI6_DPR_WPF_FPORCH0 + i,
+  fporch_fp[vsp1-is_vio6 ? 1 : 0][i]);
+
+   if (!vsp1-is_vio6) {
+   vsp1_write(vsp1, VI6_DPR_HGO_SMPPT,
+  (7  VI6_DPR_SMPPT_TGW_SHIFT) |
+  (route_unused  VI6_DPR_SMPPT_PT_SHIFT));
+   vsp1_write(vsp1, VI6_DPR_HGT_SMPPT,
+  (7  VI6_DPR_SMPPT_TGW_SHIFT) |
+  (route_unused  VI6_DPR_SMPPT_PT_SHIFT));
+   }
 }
 
 /*
@@ -651,7 +666,147 @@ static const struct vsp1_dpr_route vsp1_routes[] = {
[VI6_DPR_NODE_UNUSED]   = { 63, 0, 0 },
 };
 
-static int vsp1_probe(struct platform_device *pdev)
+static const unsigned int vio6_reg_offs[] = {
+   [VI6_CMD0]  = 0x,
+   [VI6_CMD1]  = 0x + 1 * 4,
+   [VI6_CMD2]  = 0x + 2 * 4,
+   [VI6_CMD3]  = 0x + 3 * 4,
+   [VI6_SRESET]= 0x0018,
+   [VI6_STATUS]= 0x0020,
+   [VI6_WPF_IRQ_ENB0]  = 0x0030,
+   [VI6_WPF_IRQ_ENB1]  = 0x0030 + 1 * 12,
+   [VI6_WPF_IRQ_ENB2]  = 0x0030 + 2 * 12,
+   [VI6_WPF_IRQ_ENB3]  = 0x0030 + 3 * 12,
+   [VI6_WPF_IRQ_STA0]  = 0x0034,
+   [VI6_WPF_IRQ_STA1]  = 0x0034 + 1 * 12,
+   [VI6_WPF_IRQ_STA2]  = 0x0034 + 2 * 12,
+   [VI6_WPF_IRQ_STA3]  = 0x0034 + 3 * 12,
+
+   [VI6_RPF_SRC_BSIZE] = 0x0300,
+   [VI6_RPF_SRC_ESIZE] = 0x0304,
+   [VI6_RPF_INFMT] = 0x0308,
+   [VI6_RPF_DSWAP] = 0x030c,
+   [VI6_RPF_LOC]   = 0x0310,
+   [VI6_RPF_ALPH_SEL]  = 0x0314,
+   [VI6_RPF_VRTCOL_SET]= 0x0318,
+   [VI6_RPF_MSK_CTRL]  = 0x031c,
+   [VI6_RPF_MSK_SET0]  = 0x0320,
+   [VI6_RPF_MSK_SET1]  = 0x0324,
+   [VI6_RPF_CKEY_CTRL] = 0x0328,
+   [VI6_RPF_CKEY_SET0] = 0x032c,
+   [VI6_RPF_CKEY_SET1] = 0x0330,
+   [VI6_RPF_SRCM_PSTRIDE]  = 0x0364,
+   [VI6_RPF_SRCM_ASTRIDE]  = 0x0368,
+   [VI6_RPF_SRCM_ADDR_Y]   = 0x036c,
+   [VI6_RPF_SRCM_ADDR_C0]  = 

[PATCH 4/7] [media] vsp1: Rewrite the value definitions for DPR routing as enum and arrays

2013-07-26 Thread Katsuya Matsubara
This rewrites the value definitions for DPR routing as enum and arrays
rather than macros to support multiple versions of the H/W IP.

Signed-off-by: Katsuya Matsubara ma...@igel.co.jp
---
 drivers/media/platform/vsp1/vsp1.h|6 
 drivers/media/platform/vsp1/vsp1_drv.c|   49 +++--
 drivers/media/platform/vsp1/vsp1_entity.c |   31 +-
 drivers/media/platform/vsp1/vsp1_entity.h |3 +-
 drivers/media/platform/vsp1/vsp1_lif.c|2 +-
 drivers/media/platform/vsp1/vsp1_regs.h   |   39 ---
 drivers/media/platform/vsp1/vsp1_rpf.c|2 +-
 drivers/media/platform/vsp1/vsp1_uds.c|2 +-
 drivers/media/platform/vsp1/vsp1_video.c  |   15 ++---
 drivers/media/platform/vsp1/vsp1_wpf.c|2 +-
 10 files changed, 88 insertions(+), 63 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1.h 
b/drivers/media/platform/vsp1/vsp1.h
index 8db5bbb..4d9b6c8 100644
--- a/drivers/media/platform/vsp1/vsp1.h
+++ b/drivers/media/platform/vsp1/vsp1.h
@@ -36,6 +36,11 @@ struct vsp1_uds;
 #define VPS1_MAX_UDS   3
 #define VPS1_MAX_WPF   4
 
+struct vsp1_dpr_route {
+   unsigned int id;
+   int reg;
+};
+
 struct vsp1_device {
struct device *dev;
struct vsp1_platform_data *pdata;
@@ -57,6 +62,7 @@ struct vsp1_device {
struct media_device media_dev;
 
const unsigned int *reg_offs;
+   const struct vsp1_dpr_route *routes;
 };
 
 struct vsp1_device *vsp1_device_get(struct vsp1_device *vsp1);
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
b/drivers/media/platform/vsp1/vsp1_drv.c
index 42f51d8..920edb1 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -239,6 +239,7 @@ static void vsp1_device_init(struct vsp1_device *vsp1)
 {
unsigned int i;
u32 status;
+   u32 route_unused = vsp1-routes[VI6_DPR_NODE_UNUSED].id;
 
/* Reset any channel that might be running. */
status = vsp1_read(vsp1, VI6_STATUS);
@@ -266,22 +267,22 @@ static void vsp1_device_init(struct vsp1_device *vsp1)
   (8  VI6_CLK_DCSWT_CSTRW_SHIFT));
 
for (i = 0; i  vsp1-pdata-rpf_count; ++i)
-   vsp1_write(vsp1, VI6_DPR_RPF_ROUTE0 + i, VI6_DPR_NODE_UNUSED);
+   vsp1_write(vsp1, VI6_DPR_RPF_ROUTE0 + i, route_unused);
 
for (i = 0; i  vsp1-pdata-uds_count; ++i)
-   vsp1_write(vsp1, VI6_DPR_UDS_ROUTE0 + i, VI6_DPR_NODE_UNUSED);
+   vsp1_write(vsp1, VI6_DPR_UDS_ROUTE0 + i, route_unused);
 
-   vsp1_write(vsp1, VI6_DPR_SRU_ROUTE, VI6_DPR_NODE_UNUSED);
-   vsp1_write(vsp1, VI6_DPR_LUT_ROUTE, VI6_DPR_NODE_UNUSED);
-   vsp1_write(vsp1, VI6_DPR_CLU_ROUTE, VI6_DPR_NODE_UNUSED);
-   vsp1_write(vsp1, VI6_DPR_HST_ROUTE, VI6_DPR_NODE_UNUSED);
-   vsp1_write(vsp1, VI6_DPR_HSI_ROUTE, VI6_DPR_NODE_UNUSED);
-   vsp1_write(vsp1, VI6_DPR_BRU_ROUTE, VI6_DPR_NODE_UNUSED);
+   vsp1_write(vsp1, VI6_DPR_SRU_ROUTE, route_unused);
+   vsp1_write(vsp1, VI6_DPR_LUT_ROUTE, route_unused);
+   vsp1_write(vsp1, VI6_DPR_CLU_ROUTE, route_unused);
+   vsp1_write(vsp1, VI6_DPR_HST_ROUTE, route_unused);
+   vsp1_write(vsp1, VI6_DPR_HSI_ROUTE, route_unused);
+   vsp1_write(vsp1, VI6_DPR_BRU_ROUTE, route_unused);
 
vsp1_write(vsp1, VI6_DPR_HGO_SMPPT, (7  VI6_DPR_SMPPT_TGW_SHIFT) |
-  (VI6_DPR_NODE_UNUSED  VI6_DPR_SMPPT_PT_SHIFT));
+  (route_unused  VI6_DPR_SMPPT_PT_SHIFT));
vsp1_write(vsp1, VI6_DPR_HGT_SMPPT, (7  VI6_DPR_SMPPT_TGW_SHIFT) |
-  (VI6_DPR_NODE_UNUSED  VI6_DPR_SMPPT_PT_SHIFT));
+  (route_unused  VI6_DPR_SMPPT_PT_SHIFT));
 }
 
 /*
@@ -588,6 +589,33 @@ static const unsigned int vsp1_reg_offs[] = {
[VI6_CLU_DATA]  = 0x7404,
 };
 
+static const struct vsp1_dpr_route vsp1_routes[] = {
+   [VI6_DPR_NODE_RPF0] = {  0, VI6_DPR_RPF_ROUTE0  },
+   [VI6_DPR_NODE_RPF1] = {  1, VI6_DPR_RPF_ROUTE0 + 1 },
+   [VI6_DPR_NODE_RPF2] = {  2, VI6_DPR_RPF_ROUTE0 + 2 },
+   [VI6_DPR_NODE_RPF3] = {  3, VI6_DPR_RPF_ROUTE0 + 3 },
+   [VI6_DPR_NODE_RPF4] = {  4, VI6_DPR_RPF_ROUTE0 + 4 },
+   [VI6_DPR_NODE_SRU]  = { 16, VI6_DPR_SRU_ROUTE },
+   [VI6_DPR_NODE_UDS0] = { 17, VI6_DPR_UDS_ROUTE0 },
+   [VI6_DPR_NODE_UDS1] = { 18, VI6_DPR_UDS_ROUTE0 + 1 },
+   [VI6_DPR_NODE_UDS2] = { 19, VI6_DPR_UDS_ROUTE0 + 2 },
+   [VI6_DPR_NODE_LUT]  = { 22, VI6_DPR_LUT_ROUTE },
+   [VI6_DPR_NODE_BRU_IN0]  = { 23, 0 },
+   [VI6_DPR_NODE_BRU_IN1]  = { 24, 0 },
+   [VI6_DPR_NODE_BRU_IN2]  = { 25, 0 },
+   [VI6_DPR_NODE_BRU_IN3]  = { 26, 0 },
+   [VI6_DPR_NODE_BRU_OUT]  = { 27, VI6_DPR_BRU_ROUTE },
+   [VI6_DPR_NODE_CLU]  = { 29, VI6_DPR_CLU_ROUTE },
+   [VI6_DPR_NODE_HST]  = { 30, VI6_DPR_HST_ROUTE },
+   [VI6_DPR_NODE_HSI]  = { 31, VI6_DPR_HSI_ROUTE },
+   

Re: [PATCH RFC FINAL v5] media: OF: add sync-on-green-active property

2013-07-26 Thread Hans Verkuil
Hi Prabhakar,

On 07/17/2013 05:47 PM, Prabhakar Lad wrote:
 From: Lad, Prabhakar prabhakar.cse...@gmail.com
 
 This patch adds 'sync-on-green-active' property as part
 of endpoint property.
 
 Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
 ---
   Changes for v5:
   1: Changed description for sync-on-green-active property in
  documentation file as suggested by Sylwester.
   
   Changes for v4:
   1: Fixed review comments pointed by Sylwester.
 
   Changes for v3:
   1: Fixed review comments pointed by Laurent and Sylwester.
 
   RFC v2 https://patchwork.kernel.org/patch/2578091/
 
   RFC V1 https://patchwork.kernel.org/patch/2572341/
 
  .../devicetree/bindings/media/video-interfaces.txt |2 ++
  drivers/media/v4l2-core/v4l2-of.c  |4 
  include/media/v4l2-mediabus.h  |2 ++
  3 files changed, 8 insertions(+)
 
 diff --git a/Documentation/devicetree/bindings/media/video-interfaces.txt 
 b/Documentation/devicetree/bindings/media/video-interfaces.txt
 index e022d2d..ce719f8 100644
 --- a/Documentation/devicetree/bindings/media/video-interfaces.txt
 +++ b/Documentation/devicetree/bindings/media/video-interfaces.txt
 @@ -88,6 +88,8 @@ Optional endpoint properties
  - field-even-active: field signal level during the even field data 
 transmission.
  - pclk-sample: sample data on rising (1) or falling (0) edge of the pixel 
 clock
signal.
 +- sync-on-green-active: active state of Sync-on-green (SoG) signal, 0/1 for
 +  LOW/HIGH respectively.
  - data-lanes: an array of physical data lane indexes. Position of an entry
determines the logical lane number, while the value of an entry indicates
physical lane, e.g. for 2-lane MIPI CSI-2 bus we could have
 diff --git a/drivers/media/v4l2-core/v4l2-of.c 
 b/drivers/media/v4l2-core/v4l2-of.c
 index aa59639..5c4c9f0 100644
 --- a/drivers/media/v4l2-core/v4l2-of.c
 +++ b/drivers/media/v4l2-core/v4l2-of.c
 @@ -100,6 +100,10 @@ static void v4l2_of_parse_parallel_bus(const struct 
 device_node *node,
   if (!of_property_read_u32(node, data-shift, v))
   bus-data_shift = v;
  
 + if (!of_property_read_u32(node, sync-on-green-active, v))
 + flags |= v ? V4L2_MBUS_VIDEO_SOG_ACTIVE_HIGH :
 + V4L2_MBUS_VIDEO_SOG_ACTIVE_LOW;
 +
   bus-flags = flags;
  
  }
 diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h
 index 83ae07e..d47eb81 100644
 --- a/include/media/v4l2-mediabus.h
 +++ b/include/media/v4l2-mediabus.h
 @@ -40,6 +40,8 @@
  #define V4L2_MBUS_FIELD_EVEN_HIGH(1  10)
  /* FIELD = 1/0 - Field1 (odd)/Field2 (even) */
  #define V4L2_MBUS_FIELD_EVEN_LOW (1  11)
 +#define V4L2_MBUS_VIDEO_SOG_ACTIVE_HIGH  (1  12)
 +#define V4L2_MBUS_VIDEO_SOG_ACTIVE_LOW   (1  13)

Can you add a short comment for these new flags? Similar to what you added in
video-interfaces.txt?

Thanks!

Hans

  
  /* Serial flags */
  /* How many lanes the client can use */
 
--
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 v4] media: i2c: tvp7002: add OF support

2013-07-26 Thread Hans Verkuil
Hi Prabhakar,

On 07/18/2013 05:54 PM, Lad, Prabhakar wrote:
 From: Lad, Prabhakar prabhakar.cse...@gmail.com
 
 add OF support for the tvp7002 driver.
 
 Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
 ---
  This patch depends on https://patchwork.kernel.org/patch/2828800/
  
  Changes for v4:
  1: Improved descrition of end point properties.
 
  Changes for v3:
  1: Fixed review comments pointed by Sylwester.
 
  .../devicetree/bindings/media/i2c/tvp7002.txt  |   53 
  drivers/media/i2c/tvp7002.c|   67 
 ++--
  2 files changed, 113 insertions(+), 7 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/media/i2c/tvp7002.txt
 
 diff --git a/Documentation/devicetree/bindings/media/i2c/tvp7002.txt 
 b/Documentation/devicetree/bindings/media/i2c/tvp7002.txt
 new file mode 100644
 index 000..1d00935
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/media/i2c/tvp7002.txt
 @@ -0,0 +1,53 @@
 +* Texas Instruments TV7002 video decoder
 +
 +The TVP7002 device supports digitizing of video and graphics signal in RGB 
 and
 +YPbPr color space.
 +
 +Required Properties :
 +- compatible : Must be ti,tvp7002
 +
 +Optional Properties:
 +- hsync-active: HSYNC Polarity configuration for the bus. Default value when
 +  this property is not specified is 0.
 +
 +- vsync-active: VSYNC Polarity configuration for the bus. Default value when
 +  this property is not specified is 0.
 +
 +- pclk-sample: Clock polarity of the bus. Default value when this property is
 +  not specified is 0.
 +
 +- sync-on-green-active: Active state of Sync-on-green signal property of the
 +  endpoint.
 +  0 = Normal Operation (Default)

I would extend this a little bit:

  0 = Normal Operation (Active Low, Default)

 +  1 = Inverted operation
 +
 +- field-even-active: Active-high Field ID output polarity control of the bus.
 +  Under normal operation, the field ID output is set to logic 1 for an odd 
 field
 +  (field 1)and set to logic 0 for an even field (field 0).

Add space before 'and'.

 +  0 = Normal operation (default)
 +  1 = FID output polarity inverted
 +
 +For further reading of port node refer 
 Documentation/devicetree/bindings/media/
 +video-interfaces.txt.
 +
 +Example:
 +
 + i2c0@1c22000 {
 + ...
 + ...
 + tvp7002@5c {
 + compatible = ti,tvp7002;
 + reg = 0x5c;
 +
 + port {
 + tvp7002_1: endpoint {
 + hsync-active = 1;
 + vsync-active = 1;
 + pclk-sample = 0;
 + sync-on-green-active = 1;
 + field-even-active = 0;
 + };
 + };
 + };
 + ...
 + };
 diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
 index f6b1f3f..24a08fa 100644
 --- a/drivers/media/i2c/tvp7002.c
 +++ b/drivers/media/i2c/tvp7002.c
 @@ -35,6 +35,8 @@
  #include media/v4l2-device.h
  #include media/v4l2-common.h
  #include media/v4l2-ctrls.h
 +#include media/v4l2-of.h
 +
  #include tvp7002_reg.h
  
  MODULE_DESCRIPTION(TI TVP7002 Video and Graphics Digitizer driver);
 @@ -943,6 +945,48 @@ static const struct v4l2_subdev_ops tvp7002_ops = {
   .pad = tvp7002_pad_ops,
  };
  
 +static struct tvp7002_config *
 +tvp7002_get_pdata(struct i2c_client *client)
 +{
 + struct v4l2_of_endpoint bus_cfg;
 + struct tvp7002_config *pdata;
 + struct device_node *endpoint;
 + unsigned int flags;
 +
 + if (!IS_ENABLED(CONFIG_OF) || !client-dev.of_node)
 + return client-dev.platform_data;
 +
 + endpoint = v4l2_of_get_next_endpoint(client-dev.of_node, NULL);
 + if (!endpoint)
 + return NULL;
 +
 + pdata = devm_kzalloc(client-dev, sizeof(*pdata), GFP_KERNEL);
 + if (!pdata)
 + goto done;
 +
 + v4l2_of_parse_endpoint(endpoint, bus_cfg);
 + flags = bus_cfg.bus.parallel.flags;
 +
 + if (flags  V4L2_MBUS_HSYNC_ACTIVE_HIGH)
 + pdata-hs_polarity = 1;
 +
 + if (flags  V4L2_MBUS_VSYNC_ACTIVE_HIGH)
 + pdata-vs_polarity = 1;
 +
 + if (flags  V4L2_MBUS_PCLK_SAMPLE_RISING)
 + pdata-clk_polarity = 1;
 +
 + if (flags  V4L2_MBUS_FIELD_EVEN_HIGH)
 + pdata-fid_polarity = 1;
 +
 + if (flags  V4L2_MBUS_VIDEO_SOG_ACTIVE_HIGH)
 + pdata-sog_polarity = 1;
 +
 +done:
 + of_node_put(endpoint);
 + return pdata;
 +}
 +
  /*
   * tvp7002_probe - Probe a TVP7002 device
   * @c: ptr to i2c_client struct
 @@ -954,32 +998,32 @@ static const struct v4l2_subdev_ops tvp7002_ops = {
   */
  static int tvp7002_probe(struct i2c_client *c, const struct i2c_device_id 
 *id)
  {
 + struct tvp7002_config *pdata = tvp7002_get_pdata(c);
   struct v4l2_subdev *sd;
   

Re: [RFC] Dropping of channels-conf from dtv-scan-tables

2013-07-26 Thread Oliver Schinagl

On 26-07-13 10:14, Huei-Horng Yo wrote:

Sorry for my off-topic, because dvb-apps' 'scan' utility output wrong
encoding of channels-conf in Taiwan, that's why 'tw-All' channels-conf
is still useful for some Taiwan people. Or someone could review my
patch about this encoding issue? ([PATCH][dvb-apps] Fix 'scan' utility
region 0x14 encoding from BIG5 to UTF-16BE)
Did you notify the maintainer? of the dvb-apps? I think manu is still 
one of the dvb-apps maintainers.





Thanks,

Huei-Horng Yo

2013/7/12 Oliver Schinagl oliver+l...@schinagl.nl:

Hey all,

The channels-conf directory in the dtv-scan-tables repository is bitrotten.
Besides tw-All, the newest addition is over 6 years ago, with some being as
old as 9 years. While I'm sure it's possible that the channels-conf are
still accurate, it's not really needed any longer.

Unless valid reasons are brought up to keep it, I will move it to a seperate
branch and delete it from the master branch in the next few weeks.

Thanks,

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


--
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 v8] V4L2: soc_camera: Renesas R-Car VIN driver

2013-07-26 Thread Guennadi Liakhovetski
Hello Matsubara-san

On Thu, 25 Jul 2013, Katsuya MATSUBARA wrote:

 
  Hi Vladimir,
 
 From: Vladimir Barinov vladimir.bari...@cogentembedded.com
 Date: Thu, 25 Jul 2013 10:55:51 +0400
 
  Hi  Matsubara-san,
  
  On 07/25/2013 07:01 AM, Katsuya MATSUBARA wrote:
Hi Vladimir,
 
Thank you for the revised patch.
 
  From: Sergei Shtylyovsergei.shtyl...@cogentembedded.com
  Date: Sat, 20 Jul 2013 03:14:34 +0400
 
  From: Vladimir Barinovvladimir.bari...@cogentembedded.com
 
  Add Renesas R-Car VIN (Video In) V4L2 driver.
 
  Based on the patch by Phil Edworthyphil.edwor...@renesas.com.
 
  Signed-off-by: Vladimir Barinovvladimir.bari...@cogentembedded.com
  [Sergei: removed deprecated IRQF_DISABLED flag, reordered/renamed
  'enum chip_id'
  values, reordered rcar_vin_id_table[] entries, removed senseless
  parens from
  to_buf_list() macro, used ALIGN() macro in rcar_vin_setup(), added {}
  to the
  *if* statement and used 'bool' values instead of 0/1 where necessary,
  *removed
  unused macros, done some reformatting and clarified some comments.]
  Signed-off-by: Sergei Shtylyovsergei.shtyl...@cogentembedded.com
 
  ---
  This patch is against the 'media_tree.git' repo.
 
  Changes since version 7:
  - remove 'icd' field from 'struct rcar_vin_priv' in accordance with the
  - commit
 f7f6ce2d09c86bd80ee11bd654a1ac1e8f5dfe13 ([media] soc-camera: move
 common code
 to soc_camera.c);
  - added mandatory clock_{start|stop}() methods in accordance with the
  - commit
 a78fcc11264b824d9651b55abfeedd16d5cd8415 ([media] soc-camera: make
 .clock_
 {start,stop} compulsory, .add / .remove optional).
  From: Vladimir Barinovvladimir.bari...@cogentembedded.com
  Subject: Re: [PATCH v6] V4L2: soc_camera: Renesas R-Car VIN driver
  Date: Sat, 22 Jun 2013 15:45:10 +0400
 
  But, captured images are still incorrect that means wrong
  order of fields desite '_BT' chosen for V4L2_STD_525_60.
 
  I've ordered the NTSC camera.
  I will return once I get it.
Did you get an NTSC camera and see the field order issue
occurs on your BOCK-W board?
  Yes I did.
You may want to consider adding a workaround into
the VIN driver if the issue remains in the latest patch.
  Have you seen this patch https://linuxtv.org/patch/19278/ ?
 
 Oh, I missed the mail.
 I tested it now and confirmed the issue has gone!

Does this mean I can add your Tested-by to v9 of this driver?

 Thank you for fixing it.
 ---
 Katsuya Matsubara / IGEL Co., Ltd
 ma...@igel.co.jp

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
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] soc_camera: fix compiler warning

2013-07-26 Thread Guennadi Liakhovetski
Hi Hans

Thanks for the patch.

On Thu, 25 Jul 2013, Hans Verkuil wrote:

 
 media_build/v4l/soc_camera.c: In function 'soc_camera_host_register':
 media_build/v4l/soc_camera.c:1513:10: warning: 'sasd' may be used 
 uninitialized in this function [-Wmaybe-uninitialized]
   snprintf(clk_name, sizeof(clk_name), %d-%04x,
   ^
 media_build/v4l/soc_camera.c:1464:34: note: 'sasd' was declared here
   struct soc_camera_async_subdev *sasd;
   ^

Heh, cool... You did report a similar warning earlier, for which I cooked 
up a patch [media] V4L2: soc-camera: fix uninitialised use compiler 
warning and IIRC you reported that with that patch the warning 
disappeared... How come we've got another one now? Have you updated your 
compiler again or what can be the reason?

In principle I have nothing against this patch, just wondering where 
you're getting your compilers from ;-)

 By changing the type of 'i' to unsigned and changing a condition we finally
 convince the compiler that sasd is really initialized.
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com

I haven't got any more 3.11 fixed in my queue and we have to push this 
before -rc3 / rc4 ;) So, if you prefer, feel free to take it via your tree 
with my

Acked-by: Guennadi Liakhovetski g.liakhovet...@gmx.de

Thanks
Guennadi

 ---
  drivers/media/platform/soc_camera/soc_camera.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/media/platform/soc_camera/soc_camera.c 
 b/drivers/media/platform/soc_camera/soc_camera.c
 index 2dd0e52..ed7a99f 100644
 --- a/drivers/media/platform/soc_camera/soc_camera.c
 +++ b/drivers/media/platform/soc_camera/soc_camera.c
 @@ -1466,7 +1466,8 @@ static int scan_async_group(struct soc_camera_host *ici,
   struct soc_camera_device *icd;
   struct soc_camera_desc sdesc = {.host_desc.bus_id = ici-nr,};
   char clk_name[V4L2_SUBDEV_NAME_SIZE];
 - int ret, i;
 + unsigned int i;
 + int ret;
  
   /* First look for a sensor */
   for (i = 0; i  size; i++) {
 @@ -1475,7 +1476,7 @@ static int scan_async_group(struct soc_camera_host *ici,
   break;
   }
  
 - if (i == size || asd[i]-bus_type != V4L2_ASYNC_BUS_I2C) {
 + if (i = size || asd[i]-bus_type != V4L2_ASYNC_BUS_I2C) {
   /* All useless */
   dev_err(ici-v4l2_dev.dev, No I2C data source found!\n);
   return -ENODEV;
 -- 
 1.8.3.2
 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
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] exynos-gsc: Register v4l2 device

2013-07-26 Thread Arun Kumar K
Gscaler video device registration was happening without
reference to a parent v4l2_dev causing probe to fail.
The patch creates a parent v4l2 device and uses it for
gsc m2m video device registration.

Signed-off-by: Arun Kumar K arun...@samsung.com
---
 drivers/media/platform/exynos-gsc/gsc-core.c |9 -
 drivers/media/platform/exynos-gsc/gsc-core.h |1 +
 drivers/media/platform/exynos-gsc/gsc-m2m.c  |1 +
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c 
b/drivers/media/platform/exynos-gsc/gsc-core.c
index 559fab2..1ec60264 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -1122,10 +1122,14 @@ static int gsc_probe(struct platform_device *pdev)
goto err_clk;
}
 
-   ret = gsc_register_m2m_device(gsc);
+   ret = v4l2_device_register(dev, gsc-v4l2_dev);
if (ret)
goto err_clk;
 
+   ret = gsc_register_m2m_device(gsc);
+   if (ret)
+   goto err_v4l2;
+
platform_set_drvdata(pdev, gsc);
pm_runtime_enable(dev);
ret = pm_runtime_get_sync(pdev-dev);
@@ -1147,6 +1151,8 @@ err_pm:
pm_runtime_put(dev);
 err_m2m:
gsc_unregister_m2m_device(gsc);
+err_v4l2:
+   v4l2_device_unregister(gsc-v4l2_dev);
 err_clk:
gsc_clk_put(gsc);
return ret;
@@ -1157,6 +1163,7 @@ static int gsc_remove(struct platform_device *pdev)
struct gsc_dev *gsc = platform_get_drvdata(pdev);
 
gsc_unregister_m2m_device(gsc);
+   v4l2_device_unregister(gsc-v4l2_dev);
 
vb2_dma_contig_cleanup_ctx(gsc-alloc_ctx);
pm_runtime_disable(pdev-dev);
diff --git a/drivers/media/platform/exynos-gsc/gsc-core.h 
b/drivers/media/platform/exynos-gsc/gsc-core.h
index cc19bba..76435d3 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.h
+++ b/drivers/media/platform/exynos-gsc/gsc-core.h
@@ -343,6 +343,7 @@ struct gsc_dev {
unsigned long   state;
struct vb2_alloc_ctx*alloc_ctx;
struct video_device vdev;
+   struct v4l2_device  v4l2_dev;
 };
 
 /**
diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c 
b/drivers/media/platform/exynos-gsc/gsc-m2m.c
index 40a73f7..e576ff2 100644
--- a/drivers/media/platform/exynos-gsc/gsc-m2m.c
+++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c
@@ -751,6 +751,7 @@ int gsc_register_m2m_device(struct gsc_dev *gsc)
gsc-vdev.release   = video_device_release_empty;
gsc-vdev.lock  = gsc-lock;
gsc-vdev.vfl_dir   = VFL_DIR_M2M;
+   gsc-vdev.v4l2_dev  = gsc-v4l2_dev;
snprintf(gsc-vdev.name, sizeof(gsc-vdev.name), %s.%d:m2m,
GSC_MODULE_NAME, gsc-id);
 
-- 
1.7.9.5

--
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 PATCH 0/2] tea575x: Move from sound to media

2013-07-26 Thread Hans Verkuil
Hi Ondrej!

On 06/13/2013 11:42 PM, Ondrej Zary wrote:
 Hello,
 TEA575x is neither a sound device nor an i2c device. Let's finally move it 
 from sound/i2c/other to drivers/media/radio.
 
 Tested with snd-es1968, snd-fm801 and radio-sf16fmr2.
 
 I guess the Kconfig dependencies are not correct.

Thanks for looking at this. Moving this module makes a lot of sense.

I looked at the Kconfig dependencies and I suggest the changes in the diff 
below.
I did some testing with make menuconfig, trying various combinations of 'y' and 
'M'
and this handled everything I threw at it :-)

If you agree with this, can you make a new patch series? It might be best to 
wait
until your other changes to tea575x have been merged into media_tree.git.
I've accepted those and will post a pull request for them Monday at the latest.

I need an Ack from the alsa maintainer as well.

Regards,

Hans

Signed-off-by: Hans Verkuil hans.verk...@cisco.com

diff --git a/drivers/medidiff --git a/drivers/media/radio/Kconfig 
b/drivers/media/radio/Kconfig
index d529ba7..39882dd 100644
--- a/drivers/media/radio/Kconfig
+++ b/drivers/media/radio/Kconfig
@@ -12,6 +12,9 @@ menuconfig RADIO_ADAPTERS
 
 if RADIO_ADAPTERS  VIDEO_V4L2
 
+config RADIO_TEA575X
+   tristate
+
 config RADIO_SI470X
bool Silicon Labs Si470x FM Radio Receiver support
depends on VIDEO_V4L2
@@ -61,7 +64,8 @@ config USB_DSBR
 
 config RADIO_MAXIRADIO
tristate Guillemot MAXI Radio FM 2000 radio
-   depends on VIDEO_V4L2  PCI  SND
+   depends on VIDEO_V4L2  PCI
+   select RADIO_TEA575X
---help---
  Choose Y here if you have this radio card.  This card may also be
  found as Gemtek PCI FM.
@@ -76,7 +80,8 @@ config RADIO_MAXIRADIO
 
 config RADIO_SHARK
tristate Griffin radioSHARK USB radio receiver
-   depends on USB  SND
+   depends on USB
+   select RADIO_TEA575X
---help---
  Choose Y here if you have this radio receiver.
 
@@ -393,7 +398,8 @@ config RADIO_SF16FMI
 
 config RADIO_SF16FMR2
tristate SF16-FMR2/SF16-FMD2 Radio
-   depends on ISA  VIDEO_V4L2  SND
+   depends on ISA  VIDEO_V4L2
+   select RADIO_TEA575X
---help---
  Choose Y here if you have one of these FM radio cards.
 
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
index fe6fa93..9df80ef 100644
--- a/sound/pci/Kconfig
+++ b/sound/pci/Kconfig
@@ -1,10 +1,5 @@
 # ALSA PCI drivers
 
-config SND_TEA575X
-   tristate
-   depends on SND_FM801_TEA575X_BOOL || SND_ES1968_RADIO || RADIO_SF16FMR2 
|| RADIO_MAXIRADIO || RADIO_SHARK
-   default SND_FM801 || SND_ES1968 || RADIO_SF16FMR2 || RADIO_MAXIRADIO || 
RADIO_SHARK
-
 menuconfig SND_PCI
bool PCI sound devices
depends on PCI
@@ -542,7 +537,9 @@ config SND_ES1968_INPUT
 config SND_ES1968_RADIO
bool Enable TEA5757 radio tuner support for es1968
depends on SND_ES1968
+   depends on MEDIA_RADIO_SUPPORT
depends on VIDEO_V4L2=y || VIDEO_V4L2=SND_ES1968
+   select RADIO_TEA575X
help
  Say Y here to include support for TEA5757 radio tuner integrated on
  some MediaForte cards (e.g. SF64-PCE2).
@@ -562,7 +559,9 @@ config SND_FM801
 config SND_FM801_TEA575X_BOOL
bool ForteMedia FM801 + TEA5757 tuner
depends on SND_FM801
+   depends on MEDIA_RADIO_SUPPORT
depends on VIDEO_V4L2=y || VIDEO_V4L2=SND_FM801
+   select RADIO_TEA575X
help
  Say Y here to include support for soundcards based on the ForteMedia
  FM801 chip with a TEA5757 tuner (MediaForte SF256-PCS, SF256-PCP and
--
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] soc_camera: fix compiler warning

2013-07-26 Thread Hans Verkuil
Hi Guennadi,

On 07/26/2013 01:26 PM, Guennadi Liakhovetski wrote:
 Hi Hans
 
 Thanks for the patch.
 
 On Thu, 25 Jul 2013, Hans Verkuil wrote:
 

 media_build/v4l/soc_camera.c: In function 'soc_camera_host_register':
 media_build/v4l/soc_camera.c:1513:10: warning: 'sasd' may be used 
 uninitialized in this function [-Wmaybe-uninitialized]
   snprintf(clk_name, sizeof(clk_name), %d-%04x,
   ^
 media_build/v4l/soc_camera.c:1464:34: note: 'sasd' was declared here
   struct soc_camera_async_subdev *sasd;
   ^
 
 Heh, cool... You did report a similar warning earlier, for which I cooked 
 up a patch [media] V4L2: soc-camera: fix uninitialised use compiler 
 warning and IIRC you reported that with that patch the warning 
 disappeared... How come we've got another one now? Have you updated your 
 compiler again or what can be the reason?

It worked, but only for i686. The x86_64 compiler (exactly the same gcc version
BTW) still couldn't understand that it really was initialized. See the build
logs from the past few weeks.

 In principle I have nothing against this patch, just wondering where 
 you're getting your compilers from ;-)

Well, the compiler is just downloaded from gnu.org and regularly updated when
a new version is released.

The problem is not with the current git build, but with the compatibility 
builds.
As far as I can tell different kernel versions may turn on or off different
compiler warnings, so compiling for different kernels gives different results.

 By changing the type of 'i' to unsigned and changing a condition we finally
 convince the compiler that sasd is really initialized.

 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 
 I haven't got any more 3.11 fixed in my queue and we have to push this 
 before -rc3 / rc4 ;) So, if you prefer, feel free to take it via your tree 
 with my
 
 Acked-by: Guennadi Liakhovetski g.liakhovet...@gmx.de

This is just for 3.12, there is no need to go to 3.11 for this since the warning
doesn't appear when compiling 3.11.

Do you still want me to take it, or do you prefer to queue it for 3.12 yourself?
For the record, I expect to post a pull request for 3.12 today or Monday at the
latest, so it's no problem for me.

Hans

 
 Thanks
 Guennadi
 
 ---
  drivers/media/platform/soc_camera/soc_camera.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

 diff --git a/drivers/media/platform/soc_camera/soc_camera.c 
 b/drivers/media/platform/soc_camera/soc_camera.c
 index 2dd0e52..ed7a99f 100644
 --- a/drivers/media/platform/soc_camera/soc_camera.c
 +++ b/drivers/media/platform/soc_camera/soc_camera.c
 @@ -1466,7 +1466,8 @@ static int scan_async_group(struct soc_camera_host 
 *ici,
  struct soc_camera_device *icd;
  struct soc_camera_desc sdesc = {.host_desc.bus_id = ici-nr,};
  char clk_name[V4L2_SUBDEV_NAME_SIZE];
 -int ret, i;
 +unsigned int i;
 +int ret;
  
  /* First look for a sensor */
  for (i = 0; i  size; i++) {
 @@ -1475,7 +1476,7 @@ static int scan_async_group(struct soc_camera_host 
 *ici,
  break;
  }
  
 -if (i == size || asd[i]-bus_type != V4L2_ASYNC_BUS_I2C) {
 +if (i = size || asd[i]-bus_type != V4L2_ASYNC_BUS_I2C) {
  /* All useless */
  dev_err(ici-v4l2_dev.dev, No I2C data source found!\n);
  return -ENODEV;
 -- 
 1.8.3.2

 
 ---
 Guennadi Liakhovetski, Ph.D.
 Freelance Open-Source Software Developer
 http://www.open-technology.de/
 
--
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] soc_camera: fix compiler warning

2013-07-26 Thread Guennadi Liakhovetski
On Fri, 26 Jul 2013, Hans Verkuil wrote:

 Hi Guennadi,
 
 On 07/26/2013 01:26 PM, Guennadi Liakhovetski wrote:
  Hi Hans
  
  Thanks for the patch.
  
  On Thu, 25 Jul 2013, Hans Verkuil wrote:
  
 
  media_build/v4l/soc_camera.c: In function 'soc_camera_host_register':
  media_build/v4l/soc_camera.c:1513:10: warning: 'sasd' may be used 
  uninitialized in this function [-Wmaybe-uninitialized]
snprintf(clk_name, sizeof(clk_name), %d-%04x,
^
  media_build/v4l/soc_camera.c:1464:34: note: 'sasd' was declared here
struct soc_camera_async_subdev *sasd;
^
  
  Heh, cool... You did report a similar warning earlier, for which I cooked 
  up a patch [media] V4L2: soc-camera: fix uninitialised use compiler 
  warning and IIRC you reported that with that patch the warning 
  disappeared... How come we've got another one now? Have you updated your 
  compiler again or what can be the reason?
 
 It worked, but only for i686. The x86_64 compiler (exactly the same gcc 
 version
 BTW) still couldn't understand that it really was initialized. See the build
 logs from the past few weeks.
 
  In principle I have nothing against this patch, just wondering where 
  you're getting your compilers from ;-)
 
 Well, the compiler is just downloaded from gnu.org and regularly updated when
 a new version is released.
 
 The problem is not with the current git build, but with the compatibility 
 builds.
 As far as I can tell different kernel versions may turn on or off different
 compiler warnings, so compiling for different kernels gives different results.

Ok, good...

  By changing the type of 'i' to unsigned and changing a condition we finally
  convince the compiler that sasd is really initialized.
 
  Signed-off-by: Hans Verkuil hans.verk...@cisco.com
  
  I haven't got any more 3.11 fixed in my queue and we have to push this 
  before -rc3 / rc4 ;) So, if you prefer, feel free to take it via your tree 
  with my
  
  Acked-by: Guennadi Liakhovetski g.liakhovet...@gmx.de
 
 This is just for 3.12, there is no need to go to 3.11 for this since the 
 warning
 doesn't appear when compiling 3.11.
 
 Do you still want me to take it, or do you prefer to queue it for 3.12 
 yourself?
 For the record, I expect to post a pull request for 3.12 today or Monday at 
 the
 latest, so it's no problem for me.

I'll take it then

Thanks
Guennadi

   Hans
 
  
  Thanks
  Guennadi
  
  ---
   drivers/media/platform/soc_camera/soc_camera.c | 5 +++--
   1 file changed, 3 insertions(+), 2 deletions(-)
 
  diff --git a/drivers/media/platform/soc_camera/soc_camera.c 
  b/drivers/media/platform/soc_camera/soc_camera.c
  index 2dd0e52..ed7a99f 100644
  --- a/drivers/media/platform/soc_camera/soc_camera.c
  +++ b/drivers/media/platform/soc_camera/soc_camera.c
  @@ -1466,7 +1466,8 @@ static int scan_async_group(struct soc_camera_host 
  *ici,
 struct soc_camera_device *icd;
 struct soc_camera_desc sdesc = {.host_desc.bus_id = ici-nr,};
 char clk_name[V4L2_SUBDEV_NAME_SIZE];
  -  int ret, i;
  +  unsigned int i;
  +  int ret;
   
 /* First look for a sensor */
 for (i = 0; i  size; i++) {
  @@ -1475,7 +1476,7 @@ static int scan_async_group(struct soc_camera_host 
  *ici,
 break;
 }
   
  -  if (i == size || asd[i]-bus_type != V4L2_ASYNC_BUS_I2C) {
  +  if (i = size || asd[i]-bus_type != V4L2_ASYNC_BUS_I2C) {
 /* All useless */
 dev_err(ici-v4l2_dev.dev, No I2C data source found!\n);
 return -ENODEV;
  -- 
  1.8.3.2

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
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 v10 3/8] usb: phy: twl4030: use the new generic PHY framework

2013-07-26 Thread Kishon Vijay Abraham I
Used the generic PHY framework API to create the PHY. For powering on
and powering off the PHY, power_on and power_off ops are used. Once the
MUSB OMAP glue is adapted to the new framework, the suspend and resume
ops of usb phy library will be removed. Also twl4030-usb driver is moved
to drivers/phy/.

However using the old usb phy library cannot be completely removed
because otg is intertwined with phy and moving to the new
framework completely will break otg. Once we have a separate otg state machine,
we can get rid of the usb phy library.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
Acked-by: Felipe Balbi ba...@ti.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 drivers/phy/Kconfig |   11 ++
 drivers/phy/Makefile|1 +
 drivers/{usb = }/phy/phy-twl4030-usb.c |   56 +--
 drivers/usb/phy/Kconfig |9 -
 drivers/usb/phy/Makefile|1 -
 include/linux/i2c/twl.h |2 ++
 6 files changed, 67 insertions(+), 13 deletions(-)
 rename drivers/{usb = }/phy/phy-twl4030-usb.c (95%)

diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 38c3477..ac239ac 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -27,4 +27,15 @@ config OMAP_USB2
  The USB OTG controller communicates with the comparator using this
  driver.
 
+config TWL4030_USB
+   tristate TWL4030 USB Transceiver Driver
+   depends on TWL4030_CORE  REGULATOR_TWL4030  USB_MUSB_OMAP2PLUS
+   select GENERIC_PHY
+   select USB_PHY
+   help
+ Enable this to support the USB OTG transceiver on TWL4030
+ family chips (including the TWL5030 and TPS659x0 devices).
+ This transceiver supports high and full speed devices plus,
+ in host mode, low speed.
+
 endmenu
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index ed5b088..0dd8a98 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -4,3 +4,4 @@
 
 obj-$(CONFIG_GENERIC_PHY)  += phy-core.o
 obj-$(CONFIG_OMAP_USB2)+= phy-omap-usb2.o
+obj-$(CONFIG_TWL4030_USB)  += phy-twl4030-usb.o
diff --git a/drivers/usb/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c
similarity index 95%
rename from drivers/usb/phy/phy-twl4030-usb.c
rename to drivers/phy/phy-twl4030-usb.c
index 8f78d2d..494f107 100644
--- a/drivers/usb/phy/phy-twl4030-usb.c
+++ b/drivers/phy/phy-twl4030-usb.c
@@ -33,6 +33,7 @@
 #include linux/io.h
 #include linux/delay.h
 #include linux/usb/otg.h
+#include linux/phy/phy.h
 #include linux/usb/musb-omap.h
 #include linux/usb/ulpi.h
 #include linux/i2c/twl.h
@@ -431,6 +432,14 @@ static void twl4030_phy_suspend(struct twl4030_usb *twl, 
int controller_off)
dev_dbg(twl-dev, %s\n, __func__);
 }
 
+static int twl4030_phy_power_off(struct phy *phy)
+{
+   struct twl4030_usb *twl = phy_get_drvdata(phy);
+
+   twl4030_phy_suspend(twl, 0);
+   return 0;
+}
+
 static void __twl4030_phy_resume(struct twl4030_usb *twl)
 {
twl4030_phy_power(twl, 1);
@@ -459,6 +468,14 @@ static void twl4030_phy_resume(struct twl4030_usb *twl)
}
 }
 
+static int twl4030_phy_power_on(struct phy *phy)
+{
+   struct twl4030_usb *twl = phy_get_drvdata(phy);
+
+   twl4030_phy_resume(twl);
+   return 0;
+}
+
 static int twl4030_usb_ldo_init(struct twl4030_usb *twl)
 {
/* Enable writing to power configuration registers */
@@ -602,13 +619,22 @@ static int twl4030_usb_phy_init(struct usb_phy *phy)
status = twl4030_usb_linkstat(twl);
twl-linkstat = status;
 
-   if (status == OMAP_MUSB_ID_GROUND || status == OMAP_MUSB_VBUS_VALID)
+   if (status == OMAP_MUSB_ID_GROUND || status == OMAP_MUSB_VBUS_VALID) {
omap_musb_mailbox(twl-linkstat);
+   twl4030_phy_resume(twl);
+   }
 
sysfs_notify(twl-dev-kobj, NULL, vbus);
return 0;
 }
 
+static int twl4030_phy_init(struct phy *phy)
+{
+   struct twl4030_usb *twl = phy_get_drvdata(phy);
+
+   return twl4030_usb_phy_init(twl-phy);
+}
+
 static int twl4030_set_suspend(struct usb_phy *x, int suspend)
 {
struct twl4030_usb *twl = phy_to_twl(x);
@@ -646,13 +672,23 @@ static int twl4030_set_host(struct usb_otg *otg, struct 
usb_bus *host)
return 0;
 }
 
+static const struct phy_ops ops = {
+   .init   = twl4030_phy_init,
+   .power_on   = twl4030_phy_power_on,
+   .power_off  = twl4030_phy_power_off,
+   .owner  = THIS_MODULE,
+};
+
 static int twl4030_usb_probe(struct platform_device *pdev)
 {
struct twl4030_usb_data *pdata = pdev-dev.platform_data;
struct twl4030_usb  *twl;
+   struct phy  *phy;
int status, err;
struct usb_otg  *otg;
struct device_node  *np = pdev-dev.of_node;
+   struct phy_provider *phy_provider;
+   struct phy_init_data

[PATCH v10 0/8] PHY framework

2013-07-26 Thread Kishon Vijay Abraham I
Added a generic PHY framework that provides a set of APIs for the PHY drivers
to create/destroy a PHY and APIs for the PHY users to obtain a reference to
the PHY with or without using phandle.

This framework will be of use only to devices that uses external PHY (PHY
functionality is not embedded within the controller).

The intention of creating this framework is to bring the phy drivers spread
all over the Linux kernel to drivers/phy to increase code re-use and to
increase code maintainability.

Comments to make PHY as bus wasn't done because PHY devices can be part of
other bus and making a same device attached to multiple bus leads to bad
design.

If the PHY driver has to send notification on connect/disconnect, the PHY
driver should make use of the extcon framework. Using this susbsystem
to use extcon framwork will have to be analysed.

You can find this patch series @
git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git testing

I'll create a new branch *next* once this patch series is finalized. All the
PHY driver development that depends on PHY framework can be based on this
branch.

Did USB enumeration testing in panda and beagle after applying [1]

[1] - https://lkml.org/lkml/2013/7/26/88

Changes from v9:
* Fixed Greg's concern on having *find PHY by string* and changed it to Tomasz
  pseudo code.
* move omap-usb2 phy and twl4030-usb phy to drivers/phy
* made all the dependent drivers select GENERIC_PHY instead of having depends
  on
* Made PHY core to assign the id's (so changed the phy_create API).
* Adapted twl4030-usb to the new design.

Changes from v8:
* Added phy_set_drvdata and phy_get_drvdata in phy.h.
* Changed phy_create API not to take void *priv. private data should now be set
  using phy_set_drvdata now.
Changes from v7:
* Fixed Documentation
* Added to_phy, of_phy_provider_register and devm_of_phy_provider_register
* modified runtime_pm usage in phy_init, phy_exit, phy_power_on and
  phy_power_off. Now phy_power_on will enable the clocks and phy_power_off will
  disable the clocks.
* pm_runtime_no_callbacks() is added so that pm_runtime_get_sync doesn't fail
* modified other patches to adhere to the changes in the PHY framework
* removed usb: phy: twl4030: twl4030 shouldn't be subsys_initcall as it will
  be merged separately.
* reference counting has been added to protect phy ops when the PHY is shared
  by multiple consumers.

Changes from v6
* corrected few typos in Documentation
* Changed PHY Subsystem to *bool* in Kconfig (to avoid compilation errors when
  PHY Subsystem is kept as module and the dependent modules are built-in)
* Added if pm_runtime_enabled check before runtime pm calls.

Changes from v5:
* removed the new sysfs entries as it dint have any new information other than
  what is already there in /sys/devices/...
* removed a bunch of APIs added to get the PHY and now only phy_get and
  devm_phy_get are used.
* Added new APIs to register/unregister the PHY provider. This is needed for
  dt boot case.
* Enabled pm runtime and incorporated the comments given by Alan Stern in a
  different patch series by Gautam.
* Removed the *phy_bind* API. Now the phy binding information should be passed
  using the platform data to the controller devices.
* Fixed a few typos.

Changes from v4:
* removed of_phy_get_with_args/devm_of_phy_get_with_args. Now the *phy 
providers*
  should use their custom implementation of of_xlate or use of_phy_xlate to get
  *phy instance* from *phy providers*.
* Added of_phy_xlate to be used by *phy providers* if it provides only one PHY.
* changed phy_core from having subsys_initcall to module_init.
* other minor fixes.

Changes from v3:
* Changed the return value of PHY APIs to ENOSYS
* Added APIs of_phy_get_with_args/devm_of_phy_get_with_args to support getting
  PHYs if the same IP implements multiple PHYs.
* modified phy_bind API so that the binding information can now be _updated_.
  In effect of this removed the binding information added in board files and
  added only in usb-musb.c. If a particular board uses a different phy binding,
  it can update it in board file after usb_musb_init().
* Added Documentation/devicetree/bindings/phy/phy-bindings.txt for dt binding
  information.

Changes from v2:
* removed phy_descriptor structure completely so changed the APIs which were
  taking phy_descriptor as parameters
* Added 2 more APIs *of_phy_get_byname* and *devm_of_phy_get_byname* to be used
  by PHY user drivers which has *phy* and *phy-names* binding in the dt data
* Fixed a few typos
* Removed phy_list and we now use class_dev_iter_init, class_dev_iter_next and
  class_dev_iter_exit for traversing through the phy list. (Note we still need
  phy_bind list and phy_bind_mutex).
* Changed the sysfs entry name from *bind* to *phy_bind*.

Changes from v1:
* Added Documentation for the PHY framework
* Added few more APIs mostly w.r.t devres
* Modified omap-usb2 and twl4030 to make use of the new framework

Kishon Vijay Abraham I 

[PATCH v10 7/8] usb: phy: omap-usb2: remove *set_suspend* callback from omap-usb2

2013-07-26 Thread Kishon Vijay Abraham I
Now that omap-usb2 is adapted to the new generic PHY framework,
*set_suspend* ops can be removed from omap-usb2 driver.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
Acked-by: Felipe Balbi ba...@ti.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 drivers/phy/phy-omap-usb2.c |   25 -
 1 file changed, 25 deletions(-)

diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index 25e0f3c..dec3fab 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -97,29 +97,6 @@ static int omap_usb_set_peripheral(struct usb_otg *otg,
return 0;
 }
 
-static int omap_usb2_suspend(struct usb_phy *x, int suspend)
-{
-   u32 ret;
-   struct omap_usb *phy = phy_to_omapusb(x);
-
-   if (suspend  !phy-is_suspended) {
-   omap_control_usb_phy_power(phy-control_dev, 0);
-   pm_runtime_put_sync(phy-dev);
-   phy-is_suspended = 1;
-   } else if (!suspend  phy-is_suspended) {
-   ret = pm_runtime_get_sync(phy-dev);
-   if (ret  0) {
-   dev_err(phy-dev, get_sync failed with err %d\n,
-   ret);
-   return ret;
-   }
-   omap_control_usb_phy_power(phy-control_dev, 1);
-   phy-is_suspended = 0;
-   }
-
-   return 0;
-}
-
 static int omap_usb_power_off(struct phy *x)
 {
struct omap_usb *phy = phy_get_drvdata(x);
@@ -167,7 +144,6 @@ static int omap_usb2_probe(struct platform_device *pdev)
 
phy-phy.dev= phy-dev;
phy-phy.label  = omap-usb2;
-   phy-phy.set_suspend= omap_usb2_suspend;
phy-phy.otg= otg;
phy-phy.type   = USB_PHY_TYPE_USB2;
 
@@ -182,7 +158,6 @@ static int omap_usb2_probe(struct platform_device *pdev)
return -ENODEV;
}
 
-   phy-is_suspended   = 1;
omap_control_usb_phy_power(phy-control_dev, 0);
 
otg-set_host   = omap_usb_set_host;
-- 
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


[PATCH v10 8/8] usb: phy: twl4030-usb: remove *set_suspend* and *phy_init* ops

2013-07-26 Thread Kishon Vijay Abraham I
Now that twl4030-usb is adapted to the new generic PHY framework,
*set_suspend* and *phy_init* ops can be removed from twl4030-usb driver.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
Acked-by: Felipe Balbi ba...@ti.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 drivers/phy/phy-twl4030-usb.c |   57 ++---
 1 file changed, 13 insertions(+), 44 deletions(-)

diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c
index 494f107..c437211 100644
--- a/drivers/phy/phy-twl4030-usb.c
+++ b/drivers/phy/phy-twl4030-usb.c
@@ -422,25 +422,20 @@ static void twl4030_phy_power(struct twl4030_usb *twl, 
int on)
}
 }
 
-static void twl4030_phy_suspend(struct twl4030_usb *twl, int controller_off)
+static int twl4030_phy_power_off(struct phy *phy)
 {
+   struct twl4030_usb *twl = phy_get_drvdata(phy);
+
if (twl-asleep)
-   return;
+   return 0;
 
twl4030_phy_power(twl, 0);
twl-asleep = 1;
dev_dbg(twl-dev, %s\n, __func__);
-}
-
-static int twl4030_phy_power_off(struct phy *phy)
-{
-   struct twl4030_usb *twl = phy_get_drvdata(phy);
-
-   twl4030_phy_suspend(twl, 0);
return 0;
 }
 
-static void __twl4030_phy_resume(struct twl4030_usb *twl)
+static void __twl4030_phy_power_on(struct twl4030_usb *twl)
 {
twl4030_phy_power(twl, 1);
twl4030_i2c_access(twl, 1);
@@ -449,11 +444,13 @@ static void __twl4030_phy_resume(struct twl4030_usb *twl)
twl4030_i2c_access(twl, 0);
 }
 
-static void twl4030_phy_resume(struct twl4030_usb *twl)
+static int twl4030_phy_power_on(struct phy *phy)
 {
+   struct twl4030_usb *twl = phy_get_drvdata(phy);
+
if (!twl-asleep)
-   return;
-   __twl4030_phy_resume(twl);
+   return 0;
+   __twl4030_phy_power_on(twl);
twl-asleep = 0;
dev_dbg(twl-dev, %s\n, __func__);
 
@@ -466,13 +463,6 @@ static void twl4030_phy_resume(struct twl4030_usb *twl)
cancel_delayed_work(twl-id_workaround_work);
schedule_delayed_work(twl-id_workaround_work, HZ);
}
-}
-
-static int twl4030_phy_power_on(struct phy *phy)
-{
-   struct twl4030_usb *twl = phy_get_drvdata(phy);
-
-   twl4030_phy_resume(twl);
return 0;
 }
 
@@ -604,9 +594,9 @@ static void twl4030_id_workaround_work(struct work_struct 
*work)
}
 }
 
-static int twl4030_usb_phy_init(struct usb_phy *phy)
+static int twl4030_phy_init(struct phy *phy)
 {
-   struct twl4030_usb *twl = phy_to_twl(phy);
+   struct twl4030_usb *twl = phy_get_drvdata(phy);
enum omap_musb_vbus_id_status status;
 
/*
@@ -621,32 +611,13 @@ static int twl4030_usb_phy_init(struct usb_phy *phy)
 
if (status == OMAP_MUSB_ID_GROUND || status == OMAP_MUSB_VBUS_VALID) {
omap_musb_mailbox(twl-linkstat);
-   twl4030_phy_resume(twl);
+   twl4030_phy_power_on(phy);
}
 
sysfs_notify(twl-dev-kobj, NULL, vbus);
return 0;
 }
 
-static int twl4030_phy_init(struct phy *phy)
-{
-   struct twl4030_usb *twl = phy_get_drvdata(phy);
-
-   return twl4030_usb_phy_init(twl-phy);
-}
-
-static int twl4030_set_suspend(struct usb_phy *x, int suspend)
-{
-   struct twl4030_usb *twl = phy_to_twl(x);
-
-   if (suspend)
-   twl4030_phy_suspend(twl, 1);
-   else
-   twl4030_phy_resume(twl);
-
-   return 0;
-}
-
 static int twl4030_set_peripheral(struct usb_otg *otg,
struct usb_gadget *gadget)
 {
@@ -719,8 +690,6 @@ static int twl4030_usb_probe(struct platform_device *pdev)
twl-phy.label  = twl4030;
twl-phy.otg= otg;
twl-phy.type   = USB_PHY_TYPE_USB2;
-   twl-phy.set_suspend= twl4030_set_suspend;
-   twl-phy.init   = twl4030_usb_phy_init;
 
otg-phy= twl-phy;
otg-set_host   = twl4030_set_host;
-- 
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


[PATCH v10 5/8] ARM: dts: omap: update usb_otg_hs data

2013-07-26 Thread Kishon Vijay Abraham I
Updated the usb_otg_hs dt data to include the *phy* and *phy-names*
binding in order for the driver to use the new generic PHY framework.
Also updated the Documentation to include the binding information.
The PHY binding information can be found at
Documentation/devicetree/bindings/phy/phy-bindings.txt

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
Acked-by: Felipe Balbi ba...@ti.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 Documentation/devicetree/bindings/usb/omap-usb.txt |5 +
 Documentation/devicetree/bindings/usb/usb-phy.txt  |6 ++
 arch/arm/boot/dts/omap3-beagle-xm.dts  |2 ++
 arch/arm/boot/dts/omap3-evm.dts|2 ++
 arch/arm/boot/dts/omap3-overo.dtsi |2 ++
 arch/arm/boot/dts/omap4.dtsi   |3 +++
 arch/arm/boot/dts/twl4030.dtsi |1 +
 7 files changed, 21 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt 
b/Documentation/devicetree/bindings/usb/omap-usb.txt
index 57e71f6..825790d 100644
--- a/Documentation/devicetree/bindings/usb/omap-usb.txt
+++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
@@ -19,6 +19,9 @@ OMAP MUSB GLUE
  - power : Should be 50. This signifies the controller can supply up to
100mA when operating in host mode.
  - usb-phy : the phandle for the PHY device
+ - phys : the phandle for the PHY device (used by generic PHY framework)
+ - phy-names : the names of the PHY corresponding to the PHYs present in the
+   *phy* phandle.
 
 Optional properties:
  - ctrl-module : phandle of the control module this glue uses to write to
@@ -33,6 +36,8 @@ usb_otg_hs: usb_otg_hs@4a0ab000 {
num-eps = 16;
ram-bits = 12;
ctrl-module = omap_control_usb;
+   phys = usb2_phy;
+   phy-names = usb2-phy;
 };
 
 Board specific device node entry
diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt 
b/Documentation/devicetree/bindings/usb/usb-phy.txt
index 61496f5..c0245c8 100644
--- a/Documentation/devicetree/bindings/usb/usb-phy.txt
+++ b/Documentation/devicetree/bindings/usb/usb-phy.txt
@@ -5,6 +5,8 @@ OMAP USB2 PHY
 Required properties:
  - compatible: Should be ti,omap-usb2
  - reg : Address and length of the register set for the device.
+ - #phy-cells: determine the number of cells that should be given in the
+   phandle while referencing this phy.
 
 Optional properties:
  - ctrl-module : phandle of the control module used by PHY driver to power on
@@ -16,6 +18,7 @@ usb2phy@4a0ad080 {
compatible = ti,omap-usb2;
reg = 0x4a0ad080 0x58;
ctrl-module = omap_control_usb;
+   #phy-cells = 0;
 };
 
 OMAP USB3 PHY
@@ -25,6 +28,8 @@ Required properties:
  - reg : Address and length of the register set for the device.
  - reg-names: The names of the register addresses corresponding to the 
registers
filled in reg.
+ - #phy-cells: determine the number of cells that should be given in the
+   phandle while referencing this phy.
 
 Optional properties:
  - ctrl-module : phandle of the control module used by PHY driver to power on
@@ -39,4 +44,5 @@ usb3phy@4a084400 {
  0x4a084c00 0x40;
reg-names = phy_rx, phy_tx, pll_ctrl;
ctrl-module = omap_control_usb;
+   #phy-cells = 0;
 };
diff --git a/arch/arm/boot/dts/omap3-beagle-xm.dts 
b/arch/arm/boot/dts/omap3-beagle-xm.dts
index afdb164..533b2da 100644
--- a/arch/arm/boot/dts/omap3-beagle-xm.dts
+++ b/arch/arm/boot/dts/omap3-beagle-xm.dts
@@ -144,6 +144,8 @@
 usb_otg_hs {
interface-type = 0;
usb-phy = usb2_phy;
+   phys = usb2_phy;
+   phy-names = usb2-phy;
mode = 3;
power = 50;
 };
diff --git a/arch/arm/boot/dts/omap3-evm.dts b/arch/arm/boot/dts/omap3-evm.dts
index 7d4329d..4134dd0 100644
--- a/arch/arm/boot/dts/omap3-evm.dts
+++ b/arch/arm/boot/dts/omap3-evm.dts
@@ -70,6 +70,8 @@
 usb_otg_hs {
interface-type = 0;
usb-phy = usb2_phy;
+   phys = usb2_phy;
+   phy-names = usb2-phy;
mode = 3;
power = 50;
 };
diff --git a/arch/arm/boot/dts/omap3-overo.dtsi 
b/arch/arm/boot/dts/omap3-overo.dtsi
index 8f1abec..a461d2f 100644
--- a/arch/arm/boot/dts/omap3-overo.dtsi
+++ b/arch/arm/boot/dts/omap3-overo.dtsi
@@ -76,6 +76,8 @@
 usb_otg_hs {
interface-type = 0;
usb-phy = usb2_phy;
+   phys = usb2_phy;
+   phy-names = usb2-phy;
mode = 3;
power = 50;
 };
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 22d9f2b..1e8e2fe 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -520,6 +520,7 @@
compatible = ti,omap-usb2;
reg = 0x4a0ad080 0x58;
ctrl-module = omap_control_usb;
+   #phy-cells = 0;
};
};
 
@@ -658,6 +659,8 @@
interrupt-names = mc, dma;

[PATCH v10 6/8] usb: musb: omap2430: use the new generic PHY framework

2013-07-26 Thread Kishon Vijay Abraham I
Use the generic PHY framework API to get the PHY. The usb_phy_set_resume
and usb_phy_set_suspend is replaced with power_on and
power_off to align with the new PHY framework.

musb-xceiv can't be removed as of now because musb core uses xceiv.state and
xceiv.otg. Once there is a separate state machine to handle otg, these can be
moved out of xceiv and then we can start using the generic PHY framework.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
Acked-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/Kconfig |1 +
 drivers/usb/musb/musb_core.h |2 ++
 drivers/usb/musb/omap2430.c  |   26 --
 3 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index 797e3fd..25e2e57 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -76,6 +76,7 @@ config USB_MUSB_TUSB6010
 config USB_MUSB_OMAP2PLUS
tristate OMAP2430 and onwards
depends on ARCH_OMAP2PLUS
+   select GENERIC_PHY
 
 config USB_MUSB_AM35X
tristate AM35x
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 7d341c3..6e567bd 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -46,6 +46,7 @@
 #include linux/usb.h
 #include linux/usb/otg.h
 #include linux/usb/musb.h
+#include linux/phy/phy.h
 
 struct musb;
 struct musb_hw_ep;
@@ -346,6 +347,7 @@ struct musb {
u16 int_tx;
 
struct usb_phy  *xceiv;
+   struct phy  *phy;
 
int nIrq;
unsignedirq_wake:1;
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 6708a3b..f7b33f4 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -348,11 +348,21 @@ static int omap2430_musb_init(struct musb *musb)
 * up through ULPI.  TWL4030-family PMICs include one,
 * which needs a driver, drivers aren't always needed.
 */
-   if (dev-parent-of_node)
+   if (dev-parent-of_node) {
+   musb-phy = devm_phy_get(dev-parent, usb2-phy);
+
+   /* We can't totally remove musb-xceiv as of now because
+* musb core uses xceiv.state and xceiv.otg. Once we have
+* a separate state machine to handle otg, these can be moved
+* out of xceiv and then we can start using the generic PHY
+* framework
+*/
musb-xceiv = devm_usb_get_phy_by_phandle(dev-parent,
usb-phy, 0);
-   else
+   } else {
musb-xceiv = devm_usb_get_phy_dev(dev, 0);
+   musb-phy = devm_phy_get(dev, usb);
+   }
 
if (IS_ERR(musb-xceiv)) {
status = PTR_ERR(musb-xceiv);
@@ -364,6 +374,10 @@ static int omap2430_musb_init(struct musb *musb)
return -EPROBE_DEFER;
}
 
+   if (IS_ERR(musb-phy)) {
+   pr_err(HS USB OTG: no PHY configured\n);
+   return PTR_ERR(musb-phy);
+   }
musb-isr = omap2430_musb_interrupt;
 
status = pm_runtime_get_sync(dev);
@@ -397,7 +411,7 @@ static int omap2430_musb_init(struct musb *musb)
if (glue-status != OMAP_MUSB_UNKNOWN)
omap_musb_set_mailbox(glue);
 
-   usb_phy_init(musb-xceiv);
+   phy_init(musb-phy);
 
pm_runtime_put_noidle(musb-controller);
return 0;
@@ -460,6 +474,7 @@ static int omap2430_musb_exit(struct musb *musb)
del_timer_sync(musb_idle_timer);
 
omap2430_low_level_exit(musb);
+   phy_exit(musb-phy);
 
return 0;
 }
@@ -633,7 +648,7 @@ static int omap2430_runtime_suspend(struct device *dev)
OTG_INTERFSEL);
 
omap2430_low_level_exit(musb);
-   usb_phy_set_suspend(musb-xceiv, 1);
+   phy_power_off(musb-phy);
}
 
return 0;
@@ -648,8 +663,7 @@ static int omap2430_runtime_resume(struct device *dev)
omap2430_low_level_init(musb);
musb_writel(musb-mregs, OTG_INTERFSEL,
musb-context.otg_interfsel);
-
-   usb_phy_set_suspend(musb-xceiv, 0);
+   phy_power_on(musb-phy);
}
 
return 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


[PATCH v10 1/8] drivers: phy: add generic PHY framework

2013-07-26 Thread Kishon Vijay Abraham I
The PHY framework provides a set of APIs for the PHY drivers to
create/destroy a PHY and APIs for the PHY users to obtain a reference to the
PHY with or without using phandle. For dt-boot, the PHY drivers should
also register *PHY provider* with the framework.

PHY drivers should create the PHY by passing id and ops like init, exit,
power_on and power_off. This framework is also pm runtime enabled.

The documentation for the generic PHY framework is added in
Documentation/phy.txt and the documentation for dt binding can be found at
Documentation/devicetree/bindings/phy/phy-bindings.txt

Cc: Tomasz Figa t.f...@samsung.com
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
Acked-by: Felipe Balbi ba...@ti.com
Tested-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 .../devicetree/bindings/phy/phy-bindings.txt   |   66 ++
 Documentation/phy.txt  |  166 +
 MAINTAINERS|8 +
 drivers/Kconfig|2 +
 drivers/Makefile   |2 +
 drivers/phy/Kconfig|   18 +
 drivers/phy/Makefile   |5 +
 drivers/phy/phy-core.c |  714 
 include/linux/phy/phy.h|  270 
 9 files changed, 1251 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/phy-bindings.txt
 create mode 100644 Documentation/phy.txt
 create mode 100644 drivers/phy/Kconfig
 create mode 100644 drivers/phy/Makefile
 create mode 100644 drivers/phy/phy-core.c
 create mode 100644 include/linux/phy/phy.h

diff --git a/Documentation/devicetree/bindings/phy/phy-bindings.txt 
b/Documentation/devicetree/bindings/phy/phy-bindings.txt
new file mode 100644
index 000..8ae844f
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/phy-bindings.txt
@@ -0,0 +1,66 @@
+This document explains only the device tree data binding. For general
+information about PHY subsystem refer to Documentation/phy.txt
+
+PHY device node
+===
+
+Required Properties:
+#phy-cells:Number of cells in a PHY specifier;  The meaning of all those
+   cells is defined by the binding for the phy node. The PHY
+   provider can use the values in cells to find the appropriate
+   PHY.
+
+For example:
+
+phys: phy {
+compatible = xxx;
+reg = ...;
+.
+.
+#phy-cells = 1;
+.
+.
+};
+
+That node describes an IP block (PHY provider) that implements 2 different 
PHYs.
+In order to differentiate between these 2 PHYs, an additonal specifier should 
be
+given while trying to get a reference to it.
+
+PHY user node
+=
+
+Required Properties:
+phys : the phandle for the PHY device (used by the PHY subsystem)
+phy-names : the names of the PHY corresponding to the PHYs present in the
+   *phys* phandle
+
+Example 1:
+usb1: usb_otg_ss@xxx {
+compatible = xxx;
+reg = xxx;
+.
+.
+phys = usb2_phy, usb3_phy;
+phy-names = usb2phy, usb3phy;
+.
+.
+};
+
+This node represents a controller that uses two PHYs, one for usb2 and one for
+usb3.
+
+Example 2:
+usb2: usb_otg_ss@xxx {
+compatible = xxx;
+reg = xxx;
+.
+.
+phys = phys 1;
+phy-names = usbphy;
+.
+.
+};
+
+This node represents a controller that uses one of the PHYs of the PHY provider
+device defined previously. Note that the phy handle has an additional specifier
+1 to differentiate between the two PHYs.
diff --git a/Documentation/phy.txt b/Documentation/phy.txt
new file mode 100644
index 000..4e056c4
--- /dev/null
+++ b/Documentation/phy.txt
@@ -0,0 +1,166 @@
+   PHY SUBSYSTEM
+ Kishon Vijay Abraham I kis...@ti.com
+
+This document explains the Generic PHY Framework along with the APIs provided,
+and how-to-use.
+
+1. Introduction
+
+*PHY* is the abbreviation for physical layer. It is used to connect a device
+to the physical medium e.g., the USB controller has a PHY to provide functions
+such as serialization, de-serialization, encoding, decoding and is responsible
+for obtaining the required data transmission rate. Note that some USB
+controllers have PHY functionality embedded into it and others use an external
+PHY. Other peripherals that use PHY include Wireless LAN, Ethernet,
+SATA etc.
+
+The intention of creating this framework is to bring the PHY drivers spread
+all over the Linux kernel to drivers/phy to increase code re-use and for
+better code maintainability.
+
+This framework will be of use only to devices that use external PHY (PHY
+functionality is not embedded within the controller).
+
+2. Registering/Unregistering the PHY provider
+
+PHY provider refers to an entity that implements one or more PHY instances.
+For the simple case where the PHY provider implements only a single instance of
+the 

[PATCH v10 4/8] arm: omap3: twl: add phy consumer data in twl4030_usb_data

2013-07-26 Thread Kishon Vijay Abraham I
The PHY framework uses the phy consumer data populated in platform data in the
case of non-dt boot to return the reference to the PHY when the controller
(PHY consumer) requests for it. So populated the phy consumer data in the 
platform
data of twl usb.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 arch/arm/mach-omap2/twl-common.c |   11 +++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index c05898f..b0d54da 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -24,6 +24,7 @@
 #include linux/i2c/twl.h
 #include linux/gpio.h
 #include linux/string.h
+#include linux/phy/phy.h
 #include linux/regulator/machine.h
 #include linux/regulator/fixed.h
 
@@ -90,8 +91,18 @@ void __init omap_pmic_late_init(void)
 }
 
 #if defined(CONFIG_ARCH_OMAP3)
+struct phy_consumer consumers[] = {
+   PHY_CONSUMER(musb-hdrc.0, usb),
+};
+
+struct phy_init_data init_data = {
+   .consumers = consumers,
+   .num_consumers = ARRAY_SIZE(consumers),
+};
+
 static struct twl4030_usb_data omap3_usb_pdata = {
.usb_mode   = T2_USB_MODE_ULPI,
+   .init_data  = init_data,
 };
 
 static int omap3_batt_table[] = {
-- 
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


[PATCH v10 2/8] usb: phy: omap-usb2: use the new generic PHY framework

2013-07-26 Thread Kishon Vijay Abraham I
Used the generic PHY framework API to create the PHY. Now the power off and
power on are done in omap_usb_power_off and omap_usb_power_on respectively.
The omap-usb2 driver is also moved to driver/phy.

However using the old USB PHY library cannot be completely removed
because OTG is intertwined with PHY and moving to the new framework
will break OTG. Once we have a separate OTG state machine, we
can get rid of the USB PHY library.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
Acked-by: Felipe Balbi ba...@ti.com
---
 drivers/phy/Kconfig   |   12 +
 drivers/phy/Makefile  |1 +
 drivers/{usb = }/phy/phy-omap-usb2.c |   45 ++---
 drivers/usb/phy/Kconfig   |   10 
 drivers/usb/phy/Makefile  |1 -
 5 files changed, 54 insertions(+), 15 deletions(-)
 rename drivers/{usb = }/phy/phy-omap-usb2.c (88%)

diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 349bef2..38c3477 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -15,4 +15,16 @@ config GENERIC_PHY
  phy users can obtain reference to the PHY. All the users of this
  framework should select this config.
 
+config OMAP_USB2
+   tristate OMAP USB2 PHY Driver
+   depends on ARCH_OMAP2PLUS
+   select GENERIC_PHY
+   select USB_PHY
+   select OMAP_CONTROL_USB
+   help
+ Enable this to support the transceiver that is part of SOC. This
+ driver takes care of all the PHY functionality apart from comparator.
+ The USB OTG controller communicates with the comparator using this
+ driver.
+
 endmenu
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index 9e9560f..ed5b088 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -3,3 +3,4 @@
 #
 
 obj-$(CONFIG_GENERIC_PHY)  += phy-core.o
+obj-$(CONFIG_OMAP_USB2)+= phy-omap-usb2.o
diff --git a/drivers/usb/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
similarity index 88%
rename from drivers/usb/phy/phy-omap-usb2.c
rename to drivers/phy/phy-omap-usb2.c
index 844ab68..25e0f3c 100644
--- a/drivers/usb/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -28,6 +28,7 @@
 #include linux/pm_runtime.h
 #include linux/delay.h
 #include linux/usb/omap_control_usb.h
+#include linux/phy/phy.h
 
 /**
  * omap_usb2_set_comparator - links the comparator present in the sytem with
@@ -119,10 +120,36 @@ static int omap_usb2_suspend(struct usb_phy *x, int 
suspend)
return 0;
 }
 
+static int omap_usb_power_off(struct phy *x)
+{
+   struct omap_usb *phy = phy_get_drvdata(x);
+
+   omap_control_usb_phy_power(phy-control_dev, 0);
+
+   return 0;
+}
+
+static int omap_usb_power_on(struct phy *x)
+{
+   struct omap_usb *phy = phy_get_drvdata(x);
+
+   omap_control_usb_phy_power(phy-control_dev, 1);
+
+   return 0;
+}
+
+static struct phy_ops ops = {
+   .power_on   = omap_usb_power_on,
+   .power_off  = omap_usb_power_off,
+   .owner  = THIS_MODULE,
+};
+
 static int omap_usb2_probe(struct platform_device *pdev)
 {
struct omap_usb *phy;
+   struct phy  *generic_phy;
struct usb_otg  *otg;
+   struct phy_provider *phy_provider;
 
phy = devm_kzalloc(pdev-dev, sizeof(*phy), GFP_KERNEL);
if (!phy) {
@@ -144,6 +171,11 @@ static int omap_usb2_probe(struct platform_device *pdev)
phy-phy.otg= otg;
phy-phy.type   = USB_PHY_TYPE_USB2;
 
+   phy_provider = devm_of_phy_provider_register(phy-dev,
+   of_phy_simple_xlate);
+   if (IS_ERR(phy_provider))
+   return PTR_ERR(phy_provider);
+
phy-control_dev = omap_get_control_dev();
if (IS_ERR(phy-control_dev)) {
dev_dbg(pdev-dev, Failed to get control device\n);
@@ -159,6 +191,15 @@ static int omap_usb2_probe(struct platform_device *pdev)
otg-start_srp  = omap_usb_start_srp;
otg-phy= phy-phy;
 
+   platform_set_drvdata(pdev, phy);
+   pm_runtime_enable(phy-dev);
+
+   generic_phy = devm_phy_create(phy-dev, ops, NULL);
+   if (IS_ERR(generic_phy))
+   return PTR_ERR(generic_phy);
+
+   phy_set_drvdata(generic_phy, phy);
+
phy-wkupclk = devm_clk_get(phy-dev, usb_phy_cm_clk32k);
if (IS_ERR(phy-wkupclk)) {
dev_err(pdev-dev, unable to get usb_phy_cm_clk32k\n);
@@ -174,10 +215,6 @@ static int omap_usb2_probe(struct platform_device *pdev)
 
usb_add_phy_dev(phy-phy);
 
-   platform_set_drvdata(pdev, phy);
-
-   pm_runtime_enable(phy-dev);
-
return 0;
 }
 
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 3622fff..7813238 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -72,16 +72,6 @@ config 

[RESEND PATCH v10 2/8] usb: phy: omap-usb2: use the new generic PHY framework

2013-07-26 Thread Kishon Vijay Abraham I
Used the generic PHY framework API to create the PHY. Now the power off and
power on are done in omap_usb_power_off and omap_usb_power_on respectively.
The omap-usb2 driver is also moved to driver/phy.

However using the old USB PHY library cannot be completely removed
because OTG is intertwined with PHY and moving to the new framework
will break OTG. Once we have a separate OTG state machine, we
can get rid of the USB PHY library.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
Acked-by: Felipe Balbi ba...@ti.com
---
 drivers/phy/Kconfig   |   12 +
 drivers/phy/Makefile  |1 +
 drivers/{usb = }/phy/phy-omap-usb2.c |   45 ++---
 drivers/usb/phy/Kconfig   |   10 
 drivers/usb/phy/Makefile  |1 -
 5 files changed, 54 insertions(+), 15 deletions(-)
 rename drivers/{usb = }/phy/phy-omap-usb2.c (88%)

diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 349bef2..38c3477 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -15,4 +15,16 @@ config GENERIC_PHY
  phy users can obtain reference to the PHY. All the users of this
  framework should select this config.
 
+config OMAP_USB2
+   tristate OMAP USB2 PHY Driver
+   depends on ARCH_OMAP2PLUS
+   select GENERIC_PHY
+   select USB_PHY
+   select OMAP_CONTROL_USB
+   help
+ Enable this to support the transceiver that is part of SOC. This
+ driver takes care of all the PHY functionality apart from comparator.
+ The USB OTG controller communicates with the comparator using this
+ driver.
+
 endmenu
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index 9e9560f..ed5b088 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -3,3 +3,4 @@
 #
 
 obj-$(CONFIG_GENERIC_PHY)  += phy-core.o
+obj-$(CONFIG_OMAP_USB2)+= phy-omap-usb2.o
diff --git a/drivers/usb/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
similarity index 88%
rename from drivers/usb/phy/phy-omap-usb2.c
rename to drivers/phy/phy-omap-usb2.c
index 844ab68..25e0f3c 100644
--- a/drivers/usb/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -28,6 +28,7 @@
 #include linux/pm_runtime.h
 #include linux/delay.h
 #include linux/usb/omap_control_usb.h
+#include linux/phy/phy.h
 
 /**
  * omap_usb2_set_comparator - links the comparator present in the sytem with
@@ -119,10 +120,36 @@ static int omap_usb2_suspend(struct usb_phy *x, int 
suspend)
return 0;
 }
 
+static int omap_usb_power_off(struct phy *x)
+{
+   struct omap_usb *phy = phy_get_drvdata(x);
+
+   omap_control_usb_phy_power(phy-control_dev, 0);
+
+   return 0;
+}
+
+static int omap_usb_power_on(struct phy *x)
+{
+   struct omap_usb *phy = phy_get_drvdata(x);
+
+   omap_control_usb_phy_power(phy-control_dev, 1);
+
+   return 0;
+}
+
+static struct phy_ops ops = {
+   .power_on   = omap_usb_power_on,
+   .power_off  = omap_usb_power_off,
+   .owner  = THIS_MODULE,
+};
+
 static int omap_usb2_probe(struct platform_device *pdev)
 {
struct omap_usb *phy;
+   struct phy  *generic_phy;
struct usb_otg  *otg;
+   struct phy_provider *phy_provider;
 
phy = devm_kzalloc(pdev-dev, sizeof(*phy), GFP_KERNEL);
if (!phy) {
@@ -144,6 +171,11 @@ static int omap_usb2_probe(struct platform_device *pdev)
phy-phy.otg= otg;
phy-phy.type   = USB_PHY_TYPE_USB2;
 
+   phy_provider = devm_of_phy_provider_register(phy-dev,
+   of_phy_simple_xlate);
+   if (IS_ERR(phy_provider))
+   return PTR_ERR(phy_provider);
+
phy-control_dev = omap_get_control_dev();
if (IS_ERR(phy-control_dev)) {
dev_dbg(pdev-dev, Failed to get control device\n);
@@ -159,6 +191,15 @@ static int omap_usb2_probe(struct platform_device *pdev)
otg-start_srp  = omap_usb_start_srp;
otg-phy= phy-phy;
 
+   platform_set_drvdata(pdev, phy);
+   pm_runtime_enable(phy-dev);
+
+   generic_phy = devm_phy_create(phy-dev, ops, NULL);
+   if (IS_ERR(generic_phy))
+   return PTR_ERR(generic_phy);
+
+   phy_set_drvdata(generic_phy, phy);
+
phy-wkupclk = devm_clk_get(phy-dev, usb_phy_cm_clk32k);
if (IS_ERR(phy-wkupclk)) {
dev_err(pdev-dev, unable to get usb_phy_cm_clk32k\n);
@@ -174,10 +215,6 @@ static int omap_usb2_probe(struct platform_device *pdev)
 
usb_add_phy_dev(phy-phy);
 
-   platform_set_drvdata(pdev, phy);
-
-   pm_runtime_enable(phy-dev);
-
return 0;
 }
 
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 3622fff..7813238 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -72,16 +72,6 @@ config 

[RESEND PATCH v10 3/8] usb: phy: twl4030: use the new generic PHY framework

2013-07-26 Thread Kishon Vijay Abraham I
Used the generic PHY framework API to create the PHY. For powering on
and powering off the PHY, power_on and power_off ops are used. Once the
MUSB OMAP glue is adapted to the new framework, the suspend and resume
ops of usb phy library will be removed. Also twl4030-usb driver is moved
to drivers/phy/.

However using the old usb phy library cannot be completely removed
because otg is intertwined with phy and moving to the new
framework completely will break otg. Once we have a separate otg state machine,
we can get rid of the usb phy library.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
Acked-by: Felipe Balbi ba...@ti.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 drivers/phy/Kconfig |   11 ++
 drivers/phy/Makefile|1 +
 drivers/{usb = }/phy/phy-twl4030-usb.c |   56 +--
 drivers/usb/phy/Kconfig |9 -
 drivers/usb/phy/Makefile|1 -
 include/linux/i2c/twl.h |2 ++
 6 files changed, 67 insertions(+), 13 deletions(-)
 rename drivers/{usb = }/phy/phy-twl4030-usb.c (95%)

diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 38c3477..ac239ac 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -27,4 +27,15 @@ config OMAP_USB2
  The USB OTG controller communicates with the comparator using this
  driver.
 
+config TWL4030_USB
+   tristate TWL4030 USB Transceiver Driver
+   depends on TWL4030_CORE  REGULATOR_TWL4030  USB_MUSB_OMAP2PLUS
+   select GENERIC_PHY
+   select USB_PHY
+   help
+ Enable this to support the USB OTG transceiver on TWL4030
+ family chips (including the TWL5030 and TPS659x0 devices).
+ This transceiver supports high and full speed devices plus,
+ in host mode, low speed.
+
 endmenu
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index ed5b088..0dd8a98 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -4,3 +4,4 @@
 
 obj-$(CONFIG_GENERIC_PHY)  += phy-core.o
 obj-$(CONFIG_OMAP_USB2)+= phy-omap-usb2.o
+obj-$(CONFIG_TWL4030_USB)  += phy-twl4030-usb.o
diff --git a/drivers/usb/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c
similarity index 95%
rename from drivers/usb/phy/phy-twl4030-usb.c
rename to drivers/phy/phy-twl4030-usb.c
index 8f78d2d..494f107 100644
--- a/drivers/usb/phy/phy-twl4030-usb.c
+++ b/drivers/phy/phy-twl4030-usb.c
@@ -33,6 +33,7 @@
 #include linux/io.h
 #include linux/delay.h
 #include linux/usb/otg.h
+#include linux/phy/phy.h
 #include linux/usb/musb-omap.h
 #include linux/usb/ulpi.h
 #include linux/i2c/twl.h
@@ -431,6 +432,14 @@ static void twl4030_phy_suspend(struct twl4030_usb *twl, 
int controller_off)
dev_dbg(twl-dev, %s\n, __func__);
 }
 
+static int twl4030_phy_power_off(struct phy *phy)
+{
+   struct twl4030_usb *twl = phy_get_drvdata(phy);
+
+   twl4030_phy_suspend(twl, 0);
+   return 0;
+}
+
 static void __twl4030_phy_resume(struct twl4030_usb *twl)
 {
twl4030_phy_power(twl, 1);
@@ -459,6 +468,14 @@ static void twl4030_phy_resume(struct twl4030_usb *twl)
}
 }
 
+static int twl4030_phy_power_on(struct phy *phy)
+{
+   struct twl4030_usb *twl = phy_get_drvdata(phy);
+
+   twl4030_phy_resume(twl);
+   return 0;
+}
+
 static int twl4030_usb_ldo_init(struct twl4030_usb *twl)
 {
/* Enable writing to power configuration registers */
@@ -602,13 +619,22 @@ static int twl4030_usb_phy_init(struct usb_phy *phy)
status = twl4030_usb_linkstat(twl);
twl-linkstat = status;
 
-   if (status == OMAP_MUSB_ID_GROUND || status == OMAP_MUSB_VBUS_VALID)
+   if (status == OMAP_MUSB_ID_GROUND || status == OMAP_MUSB_VBUS_VALID) {
omap_musb_mailbox(twl-linkstat);
+   twl4030_phy_resume(twl);
+   }
 
sysfs_notify(twl-dev-kobj, NULL, vbus);
return 0;
 }
 
+static int twl4030_phy_init(struct phy *phy)
+{
+   struct twl4030_usb *twl = phy_get_drvdata(phy);
+
+   return twl4030_usb_phy_init(twl-phy);
+}
+
 static int twl4030_set_suspend(struct usb_phy *x, int suspend)
 {
struct twl4030_usb *twl = phy_to_twl(x);
@@ -646,13 +672,23 @@ static int twl4030_set_host(struct usb_otg *otg, struct 
usb_bus *host)
return 0;
 }
 
+static const struct phy_ops ops = {
+   .init   = twl4030_phy_init,
+   .power_on   = twl4030_phy_power_on,
+   .power_off  = twl4030_phy_power_off,
+   .owner  = THIS_MODULE,
+};
+
 static int twl4030_usb_probe(struct platform_device *pdev)
 {
struct twl4030_usb_data *pdata = pdev-dev.platform_data;
struct twl4030_usb  *twl;
+   struct phy  *phy;
int status, err;
struct usb_otg  *otg;
struct device_node  *np = pdev-dev.of_node;
+   struct phy_provider *phy_provider;
+   struct phy_init_data

[RESEND PATCH v10 4/8] arm: omap3: twl: add phy consumer data in twl4030_usb_data

2013-07-26 Thread Kishon Vijay Abraham I
The PHY framework uses the phy consumer data populated in platform data in the
case of non-dt boot to return the reference to the PHY when the controller
(PHY consumer) requests for it. So populated the phy consumer data in the 
platform
data of twl usb.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 arch/arm/mach-omap2/twl-common.c |   11 +++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index c05898f..b0d54da 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -24,6 +24,7 @@
 #include linux/i2c/twl.h
 #include linux/gpio.h
 #include linux/string.h
+#include linux/phy/phy.h
 #include linux/regulator/machine.h
 #include linux/regulator/fixed.h
 
@@ -90,8 +91,18 @@ void __init omap_pmic_late_init(void)
 }
 
 #if defined(CONFIG_ARCH_OMAP3)
+struct phy_consumer consumers[] = {
+   PHY_CONSUMER(musb-hdrc.0, usb),
+};
+
+struct phy_init_data init_data = {
+   .consumers = consumers,
+   .num_consumers = ARRAY_SIZE(consumers),
+};
+
 static struct twl4030_usb_data omap3_usb_pdata = {
.usb_mode   = T2_USB_MODE_ULPI,
+   .init_data  = init_data,
 };
 
 static int omap3_batt_table[] = {
-- 
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


[RESEND PATCH v10 7/8] usb: phy: omap-usb2: remove *set_suspend* callback from omap-usb2

2013-07-26 Thread Kishon Vijay Abraham I
Now that omap-usb2 is adapted to the new generic PHY framework,
*set_suspend* ops can be removed from omap-usb2 driver.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
Acked-by: Felipe Balbi ba...@ti.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 drivers/phy/phy-omap-usb2.c |   25 -
 1 file changed, 25 deletions(-)

diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index 25e0f3c..dec3fab 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -97,29 +97,6 @@ static int omap_usb_set_peripheral(struct usb_otg *otg,
return 0;
 }
 
-static int omap_usb2_suspend(struct usb_phy *x, int suspend)
-{
-   u32 ret;
-   struct omap_usb *phy = phy_to_omapusb(x);
-
-   if (suspend  !phy-is_suspended) {
-   omap_control_usb_phy_power(phy-control_dev, 0);
-   pm_runtime_put_sync(phy-dev);
-   phy-is_suspended = 1;
-   } else if (!suspend  phy-is_suspended) {
-   ret = pm_runtime_get_sync(phy-dev);
-   if (ret  0) {
-   dev_err(phy-dev, get_sync failed with err %d\n,
-   ret);
-   return ret;
-   }
-   omap_control_usb_phy_power(phy-control_dev, 1);
-   phy-is_suspended = 0;
-   }
-
-   return 0;
-}
-
 static int omap_usb_power_off(struct phy *x)
 {
struct omap_usb *phy = phy_get_drvdata(x);
@@ -167,7 +144,6 @@ static int omap_usb2_probe(struct platform_device *pdev)
 
phy-phy.dev= phy-dev;
phy-phy.label  = omap-usb2;
-   phy-phy.set_suspend= omap_usb2_suspend;
phy-phy.otg= otg;
phy-phy.type   = USB_PHY_TYPE_USB2;
 
@@ -182,7 +158,6 @@ static int omap_usb2_probe(struct platform_device *pdev)
return -ENODEV;
}
 
-   phy-is_suspended   = 1;
omap_control_usb_phy_power(phy-control_dev, 0);
 
otg-set_host   = omap_usb_set_host;
-- 
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


[RESEND PATCH v10 8/8] usb: phy: twl4030-usb: remove *set_suspend* and *phy_init* ops

2013-07-26 Thread Kishon Vijay Abraham I
Now that twl4030-usb is adapted to the new generic PHY framework,
*set_suspend* and *phy_init* ops can be removed from twl4030-usb driver.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
Acked-by: Felipe Balbi ba...@ti.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 drivers/phy/phy-twl4030-usb.c |   57 ++---
 1 file changed, 13 insertions(+), 44 deletions(-)

diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c
index 494f107..c437211 100644
--- a/drivers/phy/phy-twl4030-usb.c
+++ b/drivers/phy/phy-twl4030-usb.c
@@ -422,25 +422,20 @@ static void twl4030_phy_power(struct twl4030_usb *twl, 
int on)
}
 }
 
-static void twl4030_phy_suspend(struct twl4030_usb *twl, int controller_off)
+static int twl4030_phy_power_off(struct phy *phy)
 {
+   struct twl4030_usb *twl = phy_get_drvdata(phy);
+
if (twl-asleep)
-   return;
+   return 0;
 
twl4030_phy_power(twl, 0);
twl-asleep = 1;
dev_dbg(twl-dev, %s\n, __func__);
-}
-
-static int twl4030_phy_power_off(struct phy *phy)
-{
-   struct twl4030_usb *twl = phy_get_drvdata(phy);
-
-   twl4030_phy_suspend(twl, 0);
return 0;
 }
 
-static void __twl4030_phy_resume(struct twl4030_usb *twl)
+static void __twl4030_phy_power_on(struct twl4030_usb *twl)
 {
twl4030_phy_power(twl, 1);
twl4030_i2c_access(twl, 1);
@@ -449,11 +444,13 @@ static void __twl4030_phy_resume(struct twl4030_usb *twl)
twl4030_i2c_access(twl, 0);
 }
 
-static void twl4030_phy_resume(struct twl4030_usb *twl)
+static int twl4030_phy_power_on(struct phy *phy)
 {
+   struct twl4030_usb *twl = phy_get_drvdata(phy);
+
if (!twl-asleep)
-   return;
-   __twl4030_phy_resume(twl);
+   return 0;
+   __twl4030_phy_power_on(twl);
twl-asleep = 0;
dev_dbg(twl-dev, %s\n, __func__);
 
@@ -466,13 +463,6 @@ static void twl4030_phy_resume(struct twl4030_usb *twl)
cancel_delayed_work(twl-id_workaround_work);
schedule_delayed_work(twl-id_workaround_work, HZ);
}
-}
-
-static int twl4030_phy_power_on(struct phy *phy)
-{
-   struct twl4030_usb *twl = phy_get_drvdata(phy);
-
-   twl4030_phy_resume(twl);
return 0;
 }
 
@@ -604,9 +594,9 @@ static void twl4030_id_workaround_work(struct work_struct 
*work)
}
 }
 
-static int twl4030_usb_phy_init(struct usb_phy *phy)
+static int twl4030_phy_init(struct phy *phy)
 {
-   struct twl4030_usb *twl = phy_to_twl(phy);
+   struct twl4030_usb *twl = phy_get_drvdata(phy);
enum omap_musb_vbus_id_status status;
 
/*
@@ -621,32 +611,13 @@ static int twl4030_usb_phy_init(struct usb_phy *phy)
 
if (status == OMAP_MUSB_ID_GROUND || status == OMAP_MUSB_VBUS_VALID) {
omap_musb_mailbox(twl-linkstat);
-   twl4030_phy_resume(twl);
+   twl4030_phy_power_on(phy);
}
 
sysfs_notify(twl-dev-kobj, NULL, vbus);
return 0;
 }
 
-static int twl4030_phy_init(struct phy *phy)
-{
-   struct twl4030_usb *twl = phy_get_drvdata(phy);
-
-   return twl4030_usb_phy_init(twl-phy);
-}
-
-static int twl4030_set_suspend(struct usb_phy *x, int suspend)
-{
-   struct twl4030_usb *twl = phy_to_twl(x);
-
-   if (suspend)
-   twl4030_phy_suspend(twl, 1);
-   else
-   twl4030_phy_resume(twl);
-
-   return 0;
-}
-
 static int twl4030_set_peripheral(struct usb_otg *otg,
struct usb_gadget *gadget)
 {
@@ -719,8 +690,6 @@ static int twl4030_usb_probe(struct platform_device *pdev)
twl-phy.label  = twl4030;
twl-phy.otg= otg;
twl-phy.type   = USB_PHY_TYPE_USB2;
-   twl-phy.set_suspend= twl4030_set_suspend;
-   twl-phy.init   = twl4030_usb_phy_init;
 
otg-phy= twl-phy;
otg-set_host   = twl4030_set_host;
-- 
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


[RESEND PATCH v10 6/8] usb: musb: omap2430: use the new generic PHY framework

2013-07-26 Thread Kishon Vijay Abraham I
Use the generic PHY framework API to get the PHY. The usb_phy_set_resume
and usb_phy_set_suspend is replaced with power_on and
power_off to align with the new PHY framework.

musb-xceiv can't be removed as of now because musb core uses xceiv.state and
xceiv.otg. Once there is a separate state machine to handle otg, these can be
moved out of xceiv and then we can start using the generic PHY framework.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
Acked-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/Kconfig |1 +
 drivers/usb/musb/musb_core.h |2 ++
 drivers/usb/musb/omap2430.c  |   26 --
 3 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index 797e3fd..25e2e57 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -76,6 +76,7 @@ config USB_MUSB_TUSB6010
 config USB_MUSB_OMAP2PLUS
tristate OMAP2430 and onwards
depends on ARCH_OMAP2PLUS
+   select GENERIC_PHY
 
 config USB_MUSB_AM35X
tristate AM35x
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 7d341c3..6e567bd 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -46,6 +46,7 @@
 #include linux/usb.h
 #include linux/usb/otg.h
 #include linux/usb/musb.h
+#include linux/phy/phy.h
 
 struct musb;
 struct musb_hw_ep;
@@ -346,6 +347,7 @@ struct musb {
u16 int_tx;
 
struct usb_phy  *xceiv;
+   struct phy  *phy;
 
int nIrq;
unsignedirq_wake:1;
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 6708a3b..f7b33f4 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -348,11 +348,21 @@ static int omap2430_musb_init(struct musb *musb)
 * up through ULPI.  TWL4030-family PMICs include one,
 * which needs a driver, drivers aren't always needed.
 */
-   if (dev-parent-of_node)
+   if (dev-parent-of_node) {
+   musb-phy = devm_phy_get(dev-parent, usb2-phy);
+
+   /* We can't totally remove musb-xceiv as of now because
+* musb core uses xceiv.state and xceiv.otg. Once we have
+* a separate state machine to handle otg, these can be moved
+* out of xceiv and then we can start using the generic PHY
+* framework
+*/
musb-xceiv = devm_usb_get_phy_by_phandle(dev-parent,
usb-phy, 0);
-   else
+   } else {
musb-xceiv = devm_usb_get_phy_dev(dev, 0);
+   musb-phy = devm_phy_get(dev, usb);
+   }
 
if (IS_ERR(musb-xceiv)) {
status = PTR_ERR(musb-xceiv);
@@ -364,6 +374,10 @@ static int omap2430_musb_init(struct musb *musb)
return -EPROBE_DEFER;
}
 
+   if (IS_ERR(musb-phy)) {
+   pr_err(HS USB OTG: no PHY configured\n);
+   return PTR_ERR(musb-phy);
+   }
musb-isr = omap2430_musb_interrupt;
 
status = pm_runtime_get_sync(dev);
@@ -397,7 +411,7 @@ static int omap2430_musb_init(struct musb *musb)
if (glue-status != OMAP_MUSB_UNKNOWN)
omap_musb_set_mailbox(glue);
 
-   usb_phy_init(musb-xceiv);
+   phy_init(musb-phy);
 
pm_runtime_put_noidle(musb-controller);
return 0;
@@ -460,6 +474,7 @@ static int omap2430_musb_exit(struct musb *musb)
del_timer_sync(musb_idle_timer);
 
omap2430_low_level_exit(musb);
+   phy_exit(musb-phy);
 
return 0;
 }
@@ -633,7 +648,7 @@ static int omap2430_runtime_suspend(struct device *dev)
OTG_INTERFSEL);
 
omap2430_low_level_exit(musb);
-   usb_phy_set_suspend(musb-xceiv, 1);
+   phy_power_off(musb-phy);
}
 
return 0;
@@ -648,8 +663,7 @@ static int omap2430_runtime_resume(struct device *dev)
omap2430_low_level_init(musb);
musb_writel(musb-mregs, OTG_INTERFSEL,
musb-context.otg_interfsel);
-
-   usb_phy_set_suspend(musb-xceiv, 0);
+   phy_power_on(musb-phy);
}
 
return 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


[RESEND PATCH v10 5/8] ARM: dts: omap: update usb_otg_hs data

2013-07-26 Thread Kishon Vijay Abraham I
Updated the usb_otg_hs dt data to include the *phy* and *phy-names*
binding in order for the driver to use the new generic PHY framework.
Also updated the Documentation to include the binding information.
The PHY binding information can be found at
Documentation/devicetree/bindings/phy/phy-bindings.txt

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
Acked-by: Felipe Balbi ba...@ti.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 Documentation/devicetree/bindings/usb/omap-usb.txt |5 +
 Documentation/devicetree/bindings/usb/usb-phy.txt  |6 ++
 arch/arm/boot/dts/omap3-beagle-xm.dts  |2 ++
 arch/arm/boot/dts/omap3-evm.dts|2 ++
 arch/arm/boot/dts/omap3-overo.dtsi |2 ++
 arch/arm/boot/dts/omap4.dtsi   |3 +++
 arch/arm/boot/dts/twl4030.dtsi |1 +
 7 files changed, 21 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt 
b/Documentation/devicetree/bindings/usb/omap-usb.txt
index 57e71f6..825790d 100644
--- a/Documentation/devicetree/bindings/usb/omap-usb.txt
+++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
@@ -19,6 +19,9 @@ OMAP MUSB GLUE
  - power : Should be 50. This signifies the controller can supply up to
100mA when operating in host mode.
  - usb-phy : the phandle for the PHY device
+ - phys : the phandle for the PHY device (used by generic PHY framework)
+ - phy-names : the names of the PHY corresponding to the PHYs present in the
+   *phy* phandle.
 
 Optional properties:
  - ctrl-module : phandle of the control module this glue uses to write to
@@ -33,6 +36,8 @@ usb_otg_hs: usb_otg_hs@4a0ab000 {
num-eps = 16;
ram-bits = 12;
ctrl-module = omap_control_usb;
+   phys = usb2_phy;
+   phy-names = usb2-phy;
 };
 
 Board specific device node entry
diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt 
b/Documentation/devicetree/bindings/usb/usb-phy.txt
index 61496f5..c0245c8 100644
--- a/Documentation/devicetree/bindings/usb/usb-phy.txt
+++ b/Documentation/devicetree/bindings/usb/usb-phy.txt
@@ -5,6 +5,8 @@ OMAP USB2 PHY
 Required properties:
  - compatible: Should be ti,omap-usb2
  - reg : Address and length of the register set for the device.
+ - #phy-cells: determine the number of cells that should be given in the
+   phandle while referencing this phy.
 
 Optional properties:
  - ctrl-module : phandle of the control module used by PHY driver to power on
@@ -16,6 +18,7 @@ usb2phy@4a0ad080 {
compatible = ti,omap-usb2;
reg = 0x4a0ad080 0x58;
ctrl-module = omap_control_usb;
+   #phy-cells = 0;
 };
 
 OMAP USB3 PHY
@@ -25,6 +28,8 @@ Required properties:
  - reg : Address and length of the register set for the device.
  - reg-names: The names of the register addresses corresponding to the 
registers
filled in reg.
+ - #phy-cells: determine the number of cells that should be given in the
+   phandle while referencing this phy.
 
 Optional properties:
  - ctrl-module : phandle of the control module used by PHY driver to power on
@@ -39,4 +44,5 @@ usb3phy@4a084400 {
  0x4a084c00 0x40;
reg-names = phy_rx, phy_tx, pll_ctrl;
ctrl-module = omap_control_usb;
+   #phy-cells = 0;
 };
diff --git a/arch/arm/boot/dts/omap3-beagle-xm.dts 
b/arch/arm/boot/dts/omap3-beagle-xm.dts
index afdb164..533b2da 100644
--- a/arch/arm/boot/dts/omap3-beagle-xm.dts
+++ b/arch/arm/boot/dts/omap3-beagle-xm.dts
@@ -144,6 +144,8 @@
 usb_otg_hs {
interface-type = 0;
usb-phy = usb2_phy;
+   phys = usb2_phy;
+   phy-names = usb2-phy;
mode = 3;
power = 50;
 };
diff --git a/arch/arm/boot/dts/omap3-evm.dts b/arch/arm/boot/dts/omap3-evm.dts
index 7d4329d..4134dd0 100644
--- a/arch/arm/boot/dts/omap3-evm.dts
+++ b/arch/arm/boot/dts/omap3-evm.dts
@@ -70,6 +70,8 @@
 usb_otg_hs {
interface-type = 0;
usb-phy = usb2_phy;
+   phys = usb2_phy;
+   phy-names = usb2-phy;
mode = 3;
power = 50;
 };
diff --git a/arch/arm/boot/dts/omap3-overo.dtsi 
b/arch/arm/boot/dts/omap3-overo.dtsi
index 8f1abec..a461d2f 100644
--- a/arch/arm/boot/dts/omap3-overo.dtsi
+++ b/arch/arm/boot/dts/omap3-overo.dtsi
@@ -76,6 +76,8 @@
 usb_otg_hs {
interface-type = 0;
usb-phy = usb2_phy;
+   phys = usb2_phy;
+   phy-names = usb2-phy;
mode = 3;
power = 50;
 };
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 22d9f2b..1e8e2fe 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -520,6 +520,7 @@
compatible = ti,omap-usb2;
reg = 0x4a0ad080 0x58;
ctrl-module = omap_control_usb;
+   #phy-cells = 0;
};
};
 
@@ -658,6 +659,8 @@
interrupt-names = mc, dma;

[RESEND PATCH v10 0/8] PHY framework

2013-07-26 Thread Kishon Vijay Abraham I
Resending with fixed device tree mailing address!

Added a generic PHY framework that provides a set of APIs for the PHY drivers
to create/destroy a PHY and APIs for the PHY users to obtain a reference to
the PHY with or without using phandle.

This framework will be of use only to devices that uses external PHY (PHY
functionality is not embedded within the controller).

The intention of creating this framework is to bring the phy drivers spread
all over the Linux kernel to drivers/phy to increase code re-use and to
increase code maintainability.

Comments to make PHY as bus wasn't done because PHY devices can be part of
other bus and making a same device attached to multiple bus leads to bad
design.

If the PHY driver has to send notification on connect/disconnect, the PHY
driver should make use of the extcon framework. Using this susbsystem
to use extcon framwork will have to be analysed.

You can find this patch series @
git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git testing

I'll create a new branch *next* once this patch series is finalized. All the
PHY driver development that depends on PHY framework can be based on this
branch.

Did USB enumeration testing in panda and beagle after applying [1]

[1] - https://lkml.org/lkml/2013/7/26/88

Changes from v9:
* Fixed Greg's concern on having *find PHY by string* and changed it to Tomasz
  pseudo code.
* move omap-usb2 phy and twl4030-usb phy to drivers/phy
* made all the dependent drivers select GENERIC_PHY instead of having depends
  on
* Made PHY core to assign the id's (so changed the phy_create API).
* Adapted twl4030-usb to the new design.

Changes from v8:
* Added phy_set_drvdata and phy_get_drvdata in phy.h.
* Changed phy_create API not to take void *priv. private data should now be set
  using phy_set_drvdata now.
Changes from v7:
* Fixed Documentation
* Added to_phy, of_phy_provider_register and devm_of_phy_provider_register
* modified runtime_pm usage in phy_init, phy_exit, phy_power_on and
  phy_power_off. Now phy_power_on will enable the clocks and phy_power_off will
  disable the clocks.
* pm_runtime_no_callbacks() is added so that pm_runtime_get_sync doesn't fail
* modified other patches to adhere to the changes in the PHY framework
* removed usb: phy: twl4030: twl4030 shouldn't be subsys_initcall as it will
  be merged separately.
* reference counting has been added to protect phy ops when the PHY is shared
  by multiple consumers.

Changes from v6
* corrected few typos in Documentation
* Changed PHY Subsystem to *bool* in Kconfig (to avoid compilation errors when
  PHY Subsystem is kept as module and the dependent modules are built-in)
* Added if pm_runtime_enabled check before runtime pm calls.

Changes from v5:
* removed the new sysfs entries as it dint have any new information other than
  what is already there in /sys/devices/...
* removed a bunch of APIs added to get the PHY and now only phy_get and
  devm_phy_get are used.
* Added new APIs to register/unregister the PHY provider. This is needed for
  dt boot case.
* Enabled pm runtime and incorporated the comments given by Alan Stern in a
  different patch series by Gautam.
* Removed the *phy_bind* API. Now the phy binding information should be passed
  using the platform data to the controller devices.
* Fixed a few typos.

Changes from v4:
* removed of_phy_get_with_args/devm_of_phy_get_with_args. Now the *phy 
providers*
  should use their custom implementation of of_xlate or use of_phy_xlate to get
  *phy instance* from *phy providers*.
* Added of_phy_xlate to be used by *phy providers* if it provides only one PHY.
* changed phy_core from having subsys_initcall to module_init.
* other minor fixes.

Changes from v3:
* Changed the return value of PHY APIs to ENOSYS
* Added APIs of_phy_get_with_args/devm_of_phy_get_with_args to support getting
  PHYs if the same IP implements multiple PHYs.
* modified phy_bind API so that the binding information can now be _updated_.
  In effect of this removed the binding information added in board files and
  added only in usb-musb.c. If a particular board uses a different phy binding,
  it can update it in board file after usb_musb_init().
* Added Documentation/devicetree/bindings/phy/phy-bindings.txt for dt binding
  information.

Changes from v2:
* removed phy_descriptor structure completely so changed the APIs which were
  taking phy_descriptor as parameters
* Added 2 more APIs *of_phy_get_byname* and *devm_of_phy_get_byname* to be used
  by PHY user drivers which has *phy* and *phy-names* binding in the dt data
* Fixed a few typos
* Removed phy_list and we now use class_dev_iter_init, class_dev_iter_next and
  class_dev_iter_exit for traversing through the phy list. (Note we still need
  phy_bind list and phy_bind_mutex).
* Changed the sysfs entry name from *bind* to *phy_bind*.

Changes from v1:
* Added Documentation for the PHY framework
* Added few more APIs mostly w.r.t devres
* Modified omap-usb2 and twl4030 to make 

[RESEND PATCH v10 1/8] drivers: phy: add generic PHY framework

2013-07-26 Thread Kishon Vijay Abraham I
The PHY framework provides a set of APIs for the PHY drivers to
create/destroy a PHY and APIs for the PHY users to obtain a reference to the
PHY with or without using phandle. For dt-boot, the PHY drivers should
also register *PHY provider* with the framework.

PHY drivers should create the PHY by passing id and ops like init, exit,
power_on and power_off. This framework is also pm runtime enabled.

The documentation for the generic PHY framework is added in
Documentation/phy.txt and the documentation for dt binding can be found at
Documentation/devicetree/bindings/phy/phy-bindings.txt

Cc: Tomasz Figa t.f...@samsung.com
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
Acked-by: Felipe Balbi ba...@ti.com
Tested-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 .../devicetree/bindings/phy/phy-bindings.txt   |   66 ++
 Documentation/phy.txt  |  166 +
 MAINTAINERS|8 +
 drivers/Kconfig|2 +
 drivers/Makefile   |2 +
 drivers/phy/Kconfig|   18 +
 drivers/phy/Makefile   |5 +
 drivers/phy/phy-core.c |  714 
 include/linux/phy/phy.h|  270 
 9 files changed, 1251 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/phy-bindings.txt
 create mode 100644 Documentation/phy.txt
 create mode 100644 drivers/phy/Kconfig
 create mode 100644 drivers/phy/Makefile
 create mode 100644 drivers/phy/phy-core.c
 create mode 100644 include/linux/phy/phy.h

diff --git a/Documentation/devicetree/bindings/phy/phy-bindings.txt 
b/Documentation/devicetree/bindings/phy/phy-bindings.txt
new file mode 100644
index 000..8ae844f
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/phy-bindings.txt
@@ -0,0 +1,66 @@
+This document explains only the device tree data binding. For general
+information about PHY subsystem refer to Documentation/phy.txt
+
+PHY device node
+===
+
+Required Properties:
+#phy-cells:Number of cells in a PHY specifier;  The meaning of all those
+   cells is defined by the binding for the phy node. The PHY
+   provider can use the values in cells to find the appropriate
+   PHY.
+
+For example:
+
+phys: phy {
+compatible = xxx;
+reg = ...;
+.
+.
+#phy-cells = 1;
+.
+.
+};
+
+That node describes an IP block (PHY provider) that implements 2 different 
PHYs.
+In order to differentiate between these 2 PHYs, an additonal specifier should 
be
+given while trying to get a reference to it.
+
+PHY user node
+=
+
+Required Properties:
+phys : the phandle for the PHY device (used by the PHY subsystem)
+phy-names : the names of the PHY corresponding to the PHYs present in the
+   *phys* phandle
+
+Example 1:
+usb1: usb_otg_ss@xxx {
+compatible = xxx;
+reg = xxx;
+.
+.
+phys = usb2_phy, usb3_phy;
+phy-names = usb2phy, usb3phy;
+.
+.
+};
+
+This node represents a controller that uses two PHYs, one for usb2 and one for
+usb3.
+
+Example 2:
+usb2: usb_otg_ss@xxx {
+compatible = xxx;
+reg = xxx;
+.
+.
+phys = phys 1;
+phy-names = usbphy;
+.
+.
+};
+
+This node represents a controller that uses one of the PHYs of the PHY provider
+device defined previously. Note that the phy handle has an additional specifier
+1 to differentiate between the two PHYs.
diff --git a/Documentation/phy.txt b/Documentation/phy.txt
new file mode 100644
index 000..4e056c4
--- /dev/null
+++ b/Documentation/phy.txt
@@ -0,0 +1,166 @@
+   PHY SUBSYSTEM
+ Kishon Vijay Abraham I kis...@ti.com
+
+This document explains the Generic PHY Framework along with the APIs provided,
+and how-to-use.
+
+1. Introduction
+
+*PHY* is the abbreviation for physical layer. It is used to connect a device
+to the physical medium e.g., the USB controller has a PHY to provide functions
+such as serialization, de-serialization, encoding, decoding and is responsible
+for obtaining the required data transmission rate. Note that some USB
+controllers have PHY functionality embedded into it and others use an external
+PHY. Other peripherals that use PHY include Wireless LAN, Ethernet,
+SATA etc.
+
+The intention of creating this framework is to bring the PHY drivers spread
+all over the Linux kernel to drivers/phy to increase code re-use and for
+better code maintainability.
+
+This framework will be of use only to devices that use external PHY (PHY
+functionality is not embedded within the controller).
+
+2. Registering/Unregistering the PHY provider
+
+PHY provider refers to an entity that implements one or more PHY instances.
+For the simple case where the PHY provider implements only a single instance of
+the 

Re: [PATCH 3/3] bttv: Convert to generic TEA575x interface

2013-07-26 Thread Hans Verkuil
Hi Ondrej,

On 06/03/2013 10:46 AM, Hans Verkuil wrote:
 On Tue May 14 2013 22:54:45 Ondrej Zary wrote:
 Remove tea575x-specific code from bttv and use the common driver instead.

 Signed-off-by: Ondrej Zary li...@rainbow-software.org
 ---
  drivers/media/pci/bt8xx/bttv-cards.c  |  317 
 -
  drivers/media/pci/bt8xx/bttv-driver.c |6 +-
  drivers/media/pci/bt8xx/bttvp.h   |   14 +-
  sound/pci/Kconfig |4 +-
  4 files changed, 124 insertions(+), 217 deletions(-)

 
 ...
 
 diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
 index fe6fa93..83e0df5 100644
 --- a/sound/pci/Kconfig
 +++ b/sound/pci/Kconfig
 @@ -2,8 +2,8 @@
  
  config SND_TEA575X
  tristate
 -depends on SND_FM801_TEA575X_BOOL || SND_ES1968_RADIO || RADIO_SF16FMR2 
 || RADIO_MAXIRADIO || RADIO_SHARK
 -default SND_FM801 || SND_ES1968 || RADIO_SF16FMR2 || RADIO_MAXIRADIO || 
 RADIO_SHARK
 +depends on SND_FM801_TEA575X_BOOL || SND_ES1968_RADIO || RADIO_SF16FMR2 
 || RADIO_MAXIRADIO || RADIO_SHARK || VIDEO_BT848
 +default SND_FM801 || SND_ES1968 || RADIO_SF16FMR2 || RADIO_MAXIRADIO || 
 RADIO_SHARK || VIDEO_BT848
  
  menuconfig SND_PCI
  bool PCI sound devices

 
 In addition, bttv should also become dependent on SND.
 
 Frankly, isn't it time that tea575x-tuner moves to drivers/media/common or
 driver/media/radio? It's really weird to have such a fairly widely used v4l
 module in sound.

It makes more sense to add this patch to the patch series moving tea575x to 
drivers/media.
It simplifies the Kconfig handling substantially.

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 v2 1/8] [media] coda: use vb2_set_plane_payload instead of setting v4l2_planes[0].bytesused directly

2013-07-26 Thread Mauro Carvalho Chehab
Hi Philipp,

Em Fri, 21 Jun 2013 09:55:27 +0200
Philipp Zabel p.za...@pengutronix.de escreveu:

 Signed-off-by: Philipp Zabel p.za...@pengutronix.de

Please provide a description of the patch.

Thanks!
Mauro

 ---
  drivers/media/platform/coda.c | 10 +-
  1 file changed, 5 insertions(+), 5 deletions(-)
 
 diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
 index c4566c4..90f3386 100644
 --- a/drivers/media/platform/coda.c
 +++ b/drivers/media/platform/coda.c
 @@ -1662,12 +1662,12 @@ static irqreturn_t coda_irq_handler(int irq, void 
 *data)
   wr_ptr = coda_read(dev, CODA_REG_BIT_WR_PTR(ctx-idx));
   /* Calculate bytesused field */
   if (dst_buf-v4l2_buf.sequence == 0) {
 - dst_buf-v4l2_planes[0].bytesused = (wr_ptr - start_ptr) +
 - ctx-vpu_header_size[0] +
 - ctx-vpu_header_size[1] +
 - ctx-vpu_header_size[2];
 + vb2_set_plane_payload(dst_buf, 0, wr_ptr - start_ptr +
 + ctx-vpu_header_size[0] +
 + ctx-vpu_header_size[1] +
 + ctx-vpu_header_size[2]);
   } else {
 - dst_buf-v4l2_planes[0].bytesused = (wr_ptr - start_ptr);
 + vb2_set_plane_payload(dst_buf, 0, wr_ptr - start_ptr);
   }
  
   v4l2_dbg(1, coda_debug, ctx-dev-v4l2_dev, frame size = %u\n,


-- 

Cheers,
Mauro
--
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] mt9v032: Use the common clock framework

2013-07-26 Thread Sylwester Nawrocki

Hi Laurent,

On 07/05/2013 12:55 PM, Laurent Pinchart wrote:

Configure the device external clock using the common clock framework
instead of a board code callback function.

Signed-off-by: Laurent Pinchartlaurent.pinch...@ideasonboard.com
---
  drivers/media/i2c/mt9v032.c | 16 ++--
  include/media/mt9v032.h |  4 
  2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c
index 60c6f67..7b30640 100644
--- a/drivers/media/i2c/mt9v032.c
+++ b/drivers/media/i2c/mt9v032.c
@@ -12,6 +12,7 @@
   * published by the Free Software Foundation.
   */

+#includelinux/clk.h
  #includelinux/delay.h
  #includelinux/i2c.h
  #includelinux/log2.h
@@ -135,6 +136,8 @@ struct mt9v032 {
struct mutex power_lock;
int power_count;

+   struct clk *clk;
+
struct mt9v032_platform_data *pdata;

u32 sysclk;
@@ -219,10 +222,8 @@ static int mt9v032_power_on(struct mt9v032 *mt9v032)
struct i2c_client *client = v4l2_get_subdevdata(mt9v032-subdev);
int ret;

-   if (mt9v032-pdata-set_clock) {
-   mt9v032-pdata-set_clock(mt9v032-subdev, mt9v032-sysclk);
-   udelay(1);
-   }
+   clk_prepare_enable(mt9v032-clk);
+   udelay(1);

/* Reset the chip and stop data read out */
ret = mt9v032_write(client, MT9V032_RESET, 1);
@@ -238,8 +239,7 @@ static int mt9v032_power_on(struct mt9v032 *mt9v032)

  static void mt9v032_power_off(struct mt9v032 *mt9v032)
  {
-   if (mt9v032-pdata-set_clock)
-   mt9v032-pdata-set_clock(mt9v032-subdev, 0);
+   clk_disable_unprepare(mt9v032-clk);
  }

  static int __mt9v032_set_power(struct mt9v032 *mt9v032, bool on)
@@ -748,6 +748,10 @@ static int mt9v032_probe(struct i2c_client *client,
if (!mt9v032)
return -ENOMEM;

+   mt9v032-clk = devm_clk_get(client-dev, NULL);
+   if (IS_ERR(mt9v032-clk))
+   return PTR_ERR(mt9v032-clk);
+
mutex_init(mt9v032-power_lock);
mt9v032-pdata = pdata;

diff --git a/include/media/mt9v032.h b/include/media/mt9v032.h
index 78fd39e..12175a6 100644
--- a/include/media/mt9v032.h
+++ b/include/media/mt9v032.h
@@ -1,13 +1,9 @@
  #ifndef _MEDIA_MT9V032_H
  #define _MEDIA_MT9V032_H

-struct v4l2_subdev;
-
  struct mt9v032_platform_data {
unsigned int clk_pol:1;

-   void (*set_clock)(struct v4l2_subdev *subdev, unsigned int rate);
-
const s64 *link_freqs;
s64 link_def_freq;
  };


Is there clk_put() somewhere in this patch ? I would expect it somewhere
around driver remove() callback, but can't see it. :-/

Regards,
Sylwester
--
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] mt9v032: Use the common clock framework

2013-07-26 Thread Laurent Pinchart
Hi Sylwester,

On Friday 26 July 2013 15:11:08 Sylwester Nawrocki wrote:
 On 07/05/2013 12:55 PM, Laurent Pinchart wrote:
  Configure the device external clock using the common clock framework
  instead of a board code callback function.
  
  Signed-off-by: Laurent Pinchartlaurent.pinch...@ideasonboard.com
  ---
  
drivers/media/i2c/mt9v032.c | 16 ++--
include/media/mt9v032.h |  4 
2 files changed, 10 insertions(+), 10 deletions(-)
  
  diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c
  index 60c6f67..7b30640 100644
  --- a/drivers/media/i2c/mt9v032.c
  +++ b/drivers/media/i2c/mt9v032.c
  @@ -12,6 +12,7 @@
 * published by the Free Software Foundation.
 */
  
  +#includelinux/clk.h
#includelinux/delay.h
#includelinux/i2c.h
#includelinux/log2.h
  @@ -135,6 +136,8 @@ struct mt9v032 {
  struct mutex power_lock;
  int power_count;
  
  +   struct clk *clk;
  +
  struct mt9v032_platform_data *pdata;
  
  u32 sysclk;
  @@ -219,10 +222,8 @@ static int mt9v032_power_on(struct mt9v032 *mt9v032)
  struct i2c_client *client = v4l2_get_subdevdata(mt9v032-subdev);
  int ret;
  
  -   if (mt9v032-pdata-set_clock) {
  -   mt9v032-pdata-set_clock(mt9v032-subdev, mt9v032-sysclk);
  -   udelay(1);
  -   }
  +   clk_prepare_enable(mt9v032-clk);
  +   udelay(1);
  
  /* Reset the chip and stop data read out */
  ret = mt9v032_write(client, MT9V032_RESET, 1);
  @@ -238,8 +239,7 @@ static int mt9v032_power_on(struct mt9v032 *mt9v032)
  
static void mt9v032_power_off(struct mt9v032 *mt9v032)
{
  -   if (mt9v032-pdata-set_clock)
  -   mt9v032-pdata-set_clock(mt9v032-subdev, 0);
  +   clk_disable_unprepare(mt9v032-clk);
}

static int __mt9v032_set_power(struct mt9v032 *mt9v032, bool on)
  @@ -748,6 +748,10 @@ static int mt9v032_probe(struct i2c_client *client,
  if (!mt9v032)
  return -ENOMEM;
  
  +   mt9v032-clk = devm_clk_get(client-dev, NULL);
  +   if (IS_ERR(mt9v032-clk))
  +   return PTR_ERR(mt9v032-clk);
  +
  mutex_init(mt9v032-power_lock);
  mt9v032-pdata = pdata;
  
  diff --git a/include/media/mt9v032.h b/include/media/mt9v032.h
  index 78fd39e..12175a6 100644
  --- a/include/media/mt9v032.h
  +++ b/include/media/mt9v032.h
  @@ -1,13 +1,9 @@
#ifndef _MEDIA_MT9V032_H
#define _MEDIA_MT9V032_H
  
  -struct v4l2_subdev;
  -
struct mt9v032_platform_data {
  unsigned int clk_pol:1;
  -   void (*set_clock)(struct v4l2_subdev *subdev, unsigned int rate);
  -
  const s64 *link_freqs;
  s64 link_def_freq;
};
 
 Is there clk_put() somewhere in this patch ? I would expect it somewhere
 around driver remove() callback, but can't see it. :-/

There's *devm_*clk_get() instead :-)

-- 
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] Dropping of channels-conf from dtv-scan-tables

2013-07-26 Thread Huei-Horng Yo
2013/7/26 Oliver Schinagl oliver+l...@schinagl.nl:
 On 26-07-13 10:14, Huei-Horng Yo wrote:

 Sorry for my off-topic, because dvb-apps' 'scan' utility output wrong
 encoding of channels-conf in Taiwan, that's why 'tw-All' channels-conf
 is still useful for some Taiwan people. Or someone could review my
 patch about this encoding issue? ([PATCH][dvb-apps] Fix 'scan' utility
 region 0x14 encoding from BIG5 to UTF-16BE)

 Did you notify the maintainer? of the dvb-apps? I think manu is still one of
 the dvb-apps maintainers.

Oliver:

Thanks, I looked at the Mercurial repositories at
http://www.linuxtv.org/hg/, it shows 'unknown' at contact field.
--
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 v2 1/8] [media] coda: use vb2_set_plane_payload instead of setting v4l2_planes[0].bytesused directly

2013-07-26 Thread Philipp Zabel
Hi Mauro,

Am Freitag, den 26.07.2013, 10:02 -0300 schrieb Mauro Carvalho Chehab:
 Hi Philipp,
 
 Em Fri, 21 Jun 2013 09:55:27 +0200
 Philipp Zabel p.za...@pengutronix.de escreveu:
 
  Signed-off-by: Philipp Zabel p.za...@pengutronix.de
 
 Please provide a description of the patch.

Sorry, how about this:

As stated in the vb2_buffer documentation, drivers should not directly fill
 in v4l2_planes[0].bytesused, but should use vb2_set_plane_payload()
 function instead. No functional changes.

regards
Philipp

 Thanks!
 Mauro
 
  ---
   drivers/media/platform/coda.c | 10 +-
   1 file changed, 5 insertions(+), 5 deletions(-)
  
  diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
  index c4566c4..90f3386 100644
  --- a/drivers/media/platform/coda.c
  +++ b/drivers/media/platform/coda.c
  @@ -1662,12 +1662,12 @@ static irqreturn_t coda_irq_handler(int irq, void 
  *data)
  wr_ptr = coda_read(dev, CODA_REG_BIT_WR_PTR(ctx-idx));
  /* Calculate bytesused field */
  if (dst_buf-v4l2_buf.sequence == 0) {
  -   dst_buf-v4l2_planes[0].bytesused = (wr_ptr - start_ptr) +
  -   ctx-vpu_header_size[0] +
  -   ctx-vpu_header_size[1] +
  -   ctx-vpu_header_size[2];
  +   vb2_set_plane_payload(dst_buf, 0, wr_ptr - start_ptr +
  +   ctx-vpu_header_size[0] +
  +   ctx-vpu_header_size[1] +
  +   ctx-vpu_header_size[2]);
  } else {
  -   dst_buf-v4l2_planes[0].bytesused = (wr_ptr - start_ptr);
  +   vb2_set_plane_payload(dst_buf, 0, wr_ptr - start_ptr);
  }
   
  v4l2_dbg(1, coda_debug, ctx-dev-v4l2_dev, frame size = %u\n,
 
 


--
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 1/4] [media] em28xx: fix assignment of the eeprom data.

2013-07-26 Thread Hans Verkuil
Ouch. I'll take this for 3.11 and CC linux-stable for 3.10.

I'm amazed that this hasn't been discovered earlier.

Thanks!

Hans

On 07/17/2013 12:57 AM, Alban Browaeys wrote:
 Set the config structure pointer to the eeprom data pointer (data,
 here eedata dereferenced) not the pointer to the pointer to
 the eeprom data (eedata itself).
 
 Signed-off-by: Alban Browaeys pra...@yahoo.com
 ---
  drivers/media/usb/em28xx/em28xx-i2c.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c 
 b/drivers/media/usb/em28xx/em28xx-i2c.c
 index 4851cc2..c4ff973 100644
 --- a/drivers/media/usb/em28xx/em28xx-i2c.c
 +++ b/drivers/media/usb/em28xx/em28xx-i2c.c
 @@ -726,7 +726,7 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned 
 bus,
  
   *eedata = data;
   *eedata_len = len;
 - dev_config = (void *)eedata;
 + dev_config = (void *)*eedata;
  
   switch (le16_to_cpu(dev_config-chip_conf)  4  0x3) {
   case 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


Re: [PATCH 4/4] [media] em28xx: Fix vidioc fmt vid cap v4l2 compliance

2013-07-26 Thread Hans Verkuil
The change to g_fmt_vid_cap isn't necessary as that's automatically cleared.
Only the s_fmt_vid_cap change is needed. I'll drop the first chunk and accept 
the
second.

Thanks,

Hans

On 07/17/2013 01:06 AM, Alban Browaeys wrote:
 Set fmt.pix.priv to zero in vidioc_g_fmt_vid_cap
  and vidioc_try_fmt_vid_cap.
 
 Catched by v4l2-compliance.
 
 Signed-off-by: Alban Browaeys pra...@yahoo.com
 ---
  drivers/media/usb/em28xx/em28xx-video.c | 3 +++
  1 file changed, 3 insertions(+)
 
 diff --git a/drivers/media/usb/em28xx/em28xx-video.c 
 b/drivers/media/usb/em28xx/em28xx-video.c
 index 1a577ed..42930a4 100644
 --- a/drivers/media/usb/em28xx/em28xx-video.c
 +++ b/drivers/media/usb/em28xx/em28xx-video.c
 @@ -943,6 +943,8 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void 
 *priv,
   else
   f-fmt.pix.field = dev-interlaced ?
  V4L2_FIELD_INTERLACED : V4L2_FIELD_TOP;
 + f-fmt.pix.priv = 0;
 +
   return 0;
  }
  
 @@ -1008,6 +1010,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, 
 void *priv,
   else
   f-fmt.pix.field = dev-interlaced ?
  V4L2_FIELD_INTERLACED : V4L2_FIELD_TOP;
 + f-fmt.pix.priv = 0;
  
   return 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


[GIT PULL FOR v3.11] Various fixes for 3.11

2013-07-26 Thread Hans Verkuil
Hi Mauro,

Here is a list of fixes for 3.11. Compared to the pull request from yesterday
I added the em28xx fix for a nasty bug introduced in 3.10 (I added a CC to
linux-stable for that one).

Regards,

Hans

The following changes since commit c859e6ef33ac0c9a5e9e934fe11a2232752b4e96:

  [media] dib0700: add support for PCTV 2002e  PCTV 2002e SE (2013-07-22 
07:48:11 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git for-v3.11

for you to fetch changes up to 18fc04d74da48f42d51a5db30f58249462dc5474:

  em28xx: fix assignment of the eeprom data. (2013-07-26 15:30:46 +0200)


Alban Browaeys (1):
  em28xx: fix assignment of the eeprom data.

Alexey Khoroshilov (1):
  hdpvr: fix iteration over uninitialized lists in hdpvr_probe()

Andrzej Hajda (2):
  DocBook: upgrade media_api DocBook version to 4.2
  v4l2: added missing mutex.h include to v4l2-ctrls.h

Hans Verkuil (2):
  ml86v7667: fix compile warning: 'ret' set but not used
  usbtv: fix dependency

Lubomir Rintel (2):
  usbtv: Fix deinterlacing
  usbtv: Throw corrupted frames away

 Documentation/DocBook/media_api.tmpl  |  4 ++--
 drivers/media/i2c/ml86v7667.c |  4 ++--
 drivers/media/usb/em28xx/em28xx-i2c.c |  2 +-
 drivers/media/usb/hdpvr/hdpvr-core.c  | 11 ++-
 drivers/media/usb/usbtv/Kconfig   |  2 +-
 drivers/media/usb/usbtv/usbtv.c   | 51 
++-
 include/media/v4l2-ctrls.h|  1 +
 7 files changed, 51 insertions(+), 24 deletions(-)
--
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] mt9v032: Use the common clock framework

2013-07-26 Thread Sylwester Nawrocki

Hi Laurent,

On 07/26/2013 03:15 PM, Laurent Pinchart wrote:

On Friday 26 July 2013 15:11:08 Sylwester Nawrocki wrote:

On 07/05/2013 12:55 PM, Laurent Pinchart wrote:

Configure the device external clock using the common clock framework
instead of a board code callback function.

Signed-off-by: Laurent Pinchartlaurent.pinch...@ideasonboard.com
---

   drivers/media/i2c/mt9v032.c | 16 ++--
   include/media/mt9v032.h |  4 
   2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c
index 60c6f67..7b30640 100644
--- a/drivers/media/i2c/mt9v032.c
+++ b/drivers/media/i2c/mt9v032.c
@@ -12,6 +12,7 @@
* published by the Free Software Foundation.
*/

+#includelinux/clk.h
   #includelinux/delay.h
   #includelinux/i2c.h
   #includelinux/log2.h
@@ -135,6 +136,8 @@ struct mt9v032 {
struct mutex power_lock;
int power_count;

+   struct clk *clk;
+
struct mt9v032_platform_data *pdata;

u32 sysclk;
@@ -219,10 +222,8 @@ static int mt9v032_power_on(struct mt9v032 *mt9v032)
struct i2c_client *client = v4l2_get_subdevdata(mt9v032-subdev);
int ret;

-   if (mt9v032-pdata-set_clock) {
-   mt9v032-pdata-set_clock(mt9v032-subdev, mt9v032-sysclk);
-   udelay(1);
-   }
+   clk_prepare_enable(mt9v032-clk);
+   udelay(1);

/* Reset the chip and stop data read out */
ret = mt9v032_write(client, MT9V032_RESET, 1);
@@ -238,8 +239,7 @@ static int mt9v032_power_on(struct mt9v032 *mt9v032)

   static void mt9v032_power_off(struct mt9v032 *mt9v032)
   {
-   if (mt9v032-pdata-set_clock)
-   mt9v032-pdata-set_clock(mt9v032-subdev, 0);
+   clk_disable_unprepare(mt9v032-clk);
   }

   static int __mt9v032_set_power(struct mt9v032 *mt9v032, bool on)
@@ -748,6 +748,10 @@ static int mt9v032_probe(struct i2c_client *client,
if (!mt9v032)
return -ENOMEM;

+   mt9v032-clk = devm_clk_get(client-dev, NULL);
+   if (IS_ERR(mt9v032-clk))
+   return PTR_ERR(mt9v032-clk);
+
mutex_init(mt9v032-power_lock);
mt9v032-pdata = pdata;

diff --git a/include/media/mt9v032.h b/include/media/mt9v032.h
index 78fd39e..12175a6 100644
--- a/include/media/mt9v032.h
+++ b/include/media/mt9v032.h
@@ -1,13 +1,9 @@
   #ifndef _MEDIA_MT9V032_H
   #define _MEDIA_MT9V032_H

-struct v4l2_subdev;
-
   struct mt9v032_platform_data {
unsigned int clk_pol:1;
-   void (*set_clock)(struct v4l2_subdev *subdev, unsigned int rate);
-
const s64 *link_freqs;
s64 link_def_freq;
   };


Is there clk_put() somewhere in this patch ? I would expect it somewhere
around driver remove() callback, but can't see it. :-/


There's *devm_*clk_get() instead :-)


Ah, I knew I must have been forgetting or overlooking something! ;)

Do you rely on the fact that __clk_get()/__clk_put() doesn't get reference
on the clock supplier module (to avoid locking modules in memory) ? I was
planning on adding module_get()/module_put() inside __clk_get()/__clk_out()
for the common clock API implementation.

Regards,
Sylwester
--
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 v3 3/3] saa7115: Implement i2c_board_info.platform_data

2013-07-26 Thread Hans Verkuil
Hi Jon Arne,

Patches 1  2 look good to me. But I do have a few comments for this one:

On 07/04/2013 01:27 AM, Jon Arne Jørgensen wrote:
 Implement i2c_board_info.platform_data handling in the driver so we can
 make device specific changes to the chips we support.
 
 I'm adding a new init table for the gm7113c chip because the old saa7113
 init table has a illegal and wrong defaults according to the datasheet.
 
 I'm also adding an option to the platform_data struct to choose the 
 gm7113c_init
 table even if you are writing a driver for the saa7113 chip.
 
 This implementation is only adding overrides for the SAA7113 and GM7113C 
 chips.
 
 Signed-off-by: Jon Arne Jørgensen jona...@jonarne.no
 ---
  drivers/media/i2c/saa7115.c  | 144 
 ---
  drivers/media/i2c/saa711x_regs.h |  15 
  include/media/saa7115.h  |  65 ++
  3 files changed, 215 insertions(+), 9 deletions(-)
 
 diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
 index 17a464d..dd51e16 100644
 --- a/drivers/media/i2c/saa7115.c
 +++ b/drivers/media/i2c/saa7115.c
 @@ -225,19 +225,55 @@ static const unsigned char saa7111_init[] = {
   0x00, 0x00
  };
  
 -/* SAA7113/GM7113C init codes
 - * It's important that R_14... R_17 == 0x00
 - * for the gm7113c chip to deliver stable video
 - */
 +/* This table has one illegal value, and some values that are not
 +   correct according to the datasheet initialization table.
 +
 +   If you need a table with legal/default values tell the driver in
 +   i2c_board_info.platform_data, and you will get the gm7113c_init
 +   table instead. */
 +
 +/* SAA7113 Init codes */
  static const unsigned char saa7113_init[] = {
   R_01_INC_DELAY, 0x08,
   R_02_INPUT_CNTL_1, 0xc2,
   R_03_INPUT_CNTL_2, 0x30,
   R_04_INPUT_CNTL_3, 0x00,
   R_05_INPUT_CNTL_4, 0x00,
 - R_06_H_SYNC_START, 0x89,
 + R_06_H_SYNC_START, 0x89,/* Illegal value - min. value = 0x94 */
 + R_07_H_SYNC_STOP, 0x0d,
 + R_08_SYNC_CNTL, 0x88,   /* OBS. HTC = VTR Mode - Not default */

Can you mention the correct default in the comment?

 + R_09_LUMA_CNTL, 0x01,
 + R_0A_LUMA_BRIGHT_CNTL, 0x80,
 + R_0B_LUMA_CONTRAST_CNTL, 0x47,
 + R_0C_CHROMA_SAT_CNTL, 0x40,
 + R_0D_CHROMA_HUE_CNTL, 0x00,
 + R_0E_CHROMA_CNTL_1, 0x01,
 + R_0F_CHROMA_GAIN_CNTL, 0x2a,
 + R_10_CHROMA_CNTL_2, 0x08,   /* Not datasheet default */

Ditto.

 + R_11_MODE_DELAY_CNTL, 0x0c,
 + R_12_RT_SIGNAL_CNTL, 0x07,  /* Not datasheet default */

Ditto.

 + R_13_RT_X_PORT_OUT_CNTL, 0x00,
 + R_14_ANAL_ADC_COMPAT_CNTL, 0x00,
 + R_15_VGATE_START_FID_CHG, 0x00,
 + R_16_VGATE_STOP, 0x00,
 + R_17_MISC_VGATE_CONF_AND_MSB, 0x00,
 +
 + 0x00, 0x00
 +};
 +
 +/* GM7113C is a clone of the SAA7113 chip
 +   This init table is copied out of the saa7113 datasheet.
 +   In R_08 we enable Automatic Field Detection [AUFD],
 +   this is disabled when saa711x_set_v4lstd is called. */
 +static const unsigned char gm7113c_init[] = {
 + R_01_INC_DELAY, 0x08,
 + R_02_INPUT_CNTL_1, 0xc0,
 + R_03_INPUT_CNTL_2, 0x33,
 + R_04_INPUT_CNTL_3, 0x00,
 + R_05_INPUT_CNTL_4, 0x00,
 + R_06_H_SYNC_START, 0xe9,
   R_07_H_SYNC_STOP, 0x0d,
 - R_08_SYNC_CNTL, 0x88,
 + R_08_SYNC_CNTL, 0x98,   /* AUFD - BIT7 Enabled */
   R_09_LUMA_CNTL, 0x01,
   R_0A_LUMA_BRIGHT_CNTL, 0x80,
   R_0B_LUMA_CONTRAST_CNTL, 0x47,
 @@ -245,9 +281,9 @@ static const unsigned char saa7113_init[] = {
   R_0D_CHROMA_HUE_CNTL, 0x00,
   R_0E_CHROMA_CNTL_1, 0x01,
   R_0F_CHROMA_GAIN_CNTL, 0x2a,
 - R_10_CHROMA_CNTL_2, 0x08,
 + R_10_CHROMA_CNTL_2, 0x00,
   R_11_MODE_DELAY_CNTL, 0x0c,
 - R_12_RT_SIGNAL_CNTL, 0x07,
 + R_12_RT_SIGNAL_CNTL, 0x01,
   R_13_RT_X_PORT_OUT_CNTL, 0x00,
   R_14_ANAL_ADC_COMPAT_CNTL, 0x00,
   R_15_VGATE_START_FID_CHG, 0x00,
 @@ -1585,6 +1621,85 @@ static const struct v4l2_subdev_ops saa711x_ops = {
  
  /* --- */
  
 +static void saa711x_write_platform_data(struct saa711x_state *state,
 + struct saa7115_platform_data *data)
 +{
 + struct v4l2_subdev *sd = state-sd;
 + u8 work;
 +
 + if (state-ident != GM7113C 
 + state-ident != SAA7113)
 + return;
 +
 + if (data-saa7113_r08_htc) {
 + work = saa711x_read(sd, R_08_SYNC_CNTL);
 + work = ~SAA7113_R_08_HTC_MASK;
 + work |= ((*data-saa7113_r08_htc)  SAA7113_R_08_HTC_OFFSET);
 + if (*data-saa7113_r08_htc != SAA7113_HTC_RESERVED) {
 + v4l2_dbg(1, debug, sd,
 + set R_08 HTC [Mask 0x%02x] [Value 0x%02x]\n,
 + SAA7113_R_08_HTC_MASK, *data-saa7113_r08_htc);

I would leave out the check against RESERVED (see also my comment later in the
header) 

Re: [PATCH v4] media: i2c: tvp7002: add OF support

2013-07-26 Thread Prabhakar Lad
Hi Hans,

Thanks for the review.

On Fri, Jul 26, 2013 at 3:39 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 Hi Prabhakar,

 On 07/18/2013 05:54 PM, Lad, Prabhakar wrote:
 From: Lad, Prabhakar prabhakar.cse...@gmail.com

 add OF support for the tvp7002 driver.

 Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
 ---
  This patch depends on https://patchwork.kernel.org/patch/2828800/

  Changes for v4:
  1: Improved descrition of end point properties.

  Changes for v3:
  1: Fixed review comments pointed by Sylwester.

  .../devicetree/bindings/media/i2c/tvp7002.txt  |   53 
  drivers/media/i2c/tvp7002.c|   67 
 ++--
  2 files changed, 113 insertions(+), 7 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/media/i2c/tvp7002.txt

 diff --git a/Documentation/devicetree/bindings/media/i2c/tvp7002.txt 
 b/Documentation/devicetree/bindings/media/i2c/tvp7002.txt
 new file mode 100644
 index 000..1d00935
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/media/i2c/tvp7002.txt
 @@ -0,0 +1,53 @@
 +* Texas Instruments TV7002 video decoder
 +
 +The TVP7002 device supports digitizing of video and graphics signal in RGB 
 and
 +YPbPr color space.
 +
 +Required Properties :
 +- compatible : Must be ti,tvp7002
 +
 +Optional Properties:
 +- hsync-active: HSYNC Polarity configuration for the bus. Default value when
 +  this property is not specified is 0.
 +
 +- vsync-active: VSYNC Polarity configuration for the bus. Default value when
 +  this property is not specified is 0.
 +
 +- pclk-sample: Clock polarity of the bus. Default value when this property 
 is
 +  not specified is 0.
 +
 +- sync-on-green-active: Active state of Sync-on-green signal property of the
 +  endpoint.
 +  0 = Normal Operation (Default)

 I would extend this a little bit:

   0 = Normal Operation (Active Low, Default)

Ok.

 +  1 = Inverted operation
 +
 +- field-even-active: Active-high Field ID output polarity control of the 
 bus.
 +  Under normal operation, the field ID output is set to logic 1 for an odd 
 field
 +  (field 1)and set to logic 0 for an even field (field 0).

 Add space before 'and'.

Ok will fix it.

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


Re: [PATCH RFC FINAL v5] media: OF: add sync-on-green-active property

2013-07-26 Thread Prabhakar Lad
Hi Hans,

Thanks for the review.

On Fri, Jul 26, 2013 at 3:27 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 Hi Prabhakar,

 On 07/17/2013 05:47 PM, Prabhakar Lad wrote:
 From: Lad, Prabhakar prabhakar.cse...@gmail.com

 This patch adds 'sync-on-green-active' property as part
 of endpoint property.

 Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
 ---
   Changes for v5:
   1: Changed description for sync-on-green-active property in
  documentation file as suggested by Sylwester.

   Changes for v4:
   1: Fixed review comments pointed by Sylwester.

   Changes for v3:
   1: Fixed review comments pointed by Laurent and Sylwester.

   RFC v2 https://patchwork.kernel.org/patch/2578091/

   RFC V1 https://patchwork.kernel.org/patch/2572341/

  .../devicetree/bindings/media/video-interfaces.txt |2 ++
  drivers/media/v4l2-core/v4l2-of.c  |4 
  include/media/v4l2-mediabus.h  |2 ++
  3 files changed, 8 insertions(+)

 diff --git a/Documentation/devicetree/bindings/media/video-interfaces.txt 
 b/Documentation/devicetree/bindings/media/video-interfaces.txt
 index e022d2d..ce719f8 100644
 --- a/Documentation/devicetree/bindings/media/video-interfaces.txt
 +++ b/Documentation/devicetree/bindings/media/video-interfaces.txt
 @@ -88,6 +88,8 @@ Optional endpoint properties
  - field-even-active: field signal level during the even field data 
 transmission.
  - pclk-sample: sample data on rising (1) or falling (0) edge of the pixel 
 clock
signal.
 +- sync-on-green-active: active state of Sync-on-green (SoG) signal, 0/1 for
 +  LOW/HIGH respectively.
  - data-lanes: an array of physical data lane indexes. Position of an entry
determines the logical lane number, while the value of an entry indicates
physical lane, e.g. for 2-lane MIPI CSI-2 bus we could have
 diff --git a/drivers/media/v4l2-core/v4l2-of.c 
 b/drivers/media/v4l2-core/v4l2-of.c
 index aa59639..5c4c9f0 100644
 --- a/drivers/media/v4l2-core/v4l2-of.c
 +++ b/drivers/media/v4l2-core/v4l2-of.c
 @@ -100,6 +100,10 @@ static void v4l2_of_parse_parallel_bus(const struct 
 device_node *node,
   if (!of_property_read_u32(node, data-shift, v))
   bus-data_shift = v;

 + if (!of_property_read_u32(node, sync-on-green-active, v))
 + flags |= v ? V4L2_MBUS_VIDEO_SOG_ACTIVE_HIGH :
 + V4L2_MBUS_VIDEO_SOG_ACTIVE_LOW;
 +
   bus-flags = flags;

  }
 diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h
 index 83ae07e..d47eb81 100644
 --- a/include/media/v4l2-mediabus.h
 +++ b/include/media/v4l2-mediabus.h
 @@ -40,6 +40,8 @@
  #define V4L2_MBUS_FIELD_EVEN_HIGH(1  10)
  /* FIELD = 1/0 - Field1 (odd)/Field2 (even) */
  #define V4L2_MBUS_FIELD_EVEN_LOW (1  11)
 +#define V4L2_MBUS_VIDEO_SOG_ACTIVE_HIGH  (1  12)
 +#define V4L2_MBUS_VIDEO_SOG_ACTIVE_LOW   (1  13)

 Can you add a short comment for these new flags? Similar to what you added in
 video-interfaces.txt?

OK will fix it and repost.

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


Re: [PATCH 35/50] media: usb: cx231xx: spin_lock in complete() cleanup

2013-07-26 Thread Hans Verkuil


On 07/11/2013 11:05 AM, Ming Lei wrote:
 Complete() will be run with interrupt enabled, so change to
 spin_lock_irqsave().
 
 Cc: Mauro Carvalho Chehab mche...@redhat.com
 Cc: Hans Verkuil hans.verk...@cisco.com
 Cc: linux-media@vger.kernel.org
 Signed-off-by: Ming Lei ming@canonical.com
 ---
  drivers/media/usb/cx231xx/cx231xx-audio.c |6 ++
  drivers/media/usb/cx231xx/cx231xx-core.c  |   10 ++
  drivers/media/usb/cx231xx/cx231xx-vbi.c   |5 +++--
  3 files changed, 15 insertions(+), 6 deletions(-)
 
 diff --git a/drivers/media/usb/cx231xx/cx231xx-audio.c 
 b/drivers/media/usb/cx231xx/cx231xx-audio.c
 index 81a1d97..58c1b5c 100644
 --- a/drivers/media/usb/cx231xx/cx231xx-audio.c
 +++ b/drivers/media/usb/cx231xx/cx231xx-audio.c
 @@ -136,6 +136,7 @@ static void cx231xx_audio_isocirq(struct urb *urb)
   stride = runtime-frame_bits  3;
  
   for (i = 0; i  urb-number_of_packets; i++) {
 + unsigned long flags;
   int length = urb-iso_frame_desc[i].actual_length /
stride;
   cp = (unsigned char *)urb-transfer_buffer +
 @@ -158,6 +159,7 @@ static void cx231xx_audio_isocirq(struct urb *urb)
  length * stride);
   }
  
 + local_irq_save(flags);
   snd_pcm_stream_lock(substream);

Can't you use snd_pcm_stream_lock_irqsave here?

Ditto for the other media drivers where this happens: em28xx and tlg2300.

I've reviewed the media driver changes and they look OK to me, so if
my comment above is fixed, then I can merge them for 3.12. Or are these
changes required for 3.11?

Regards,

Hans

  
   dev-adev.hwptr_done_capture += length;
 @@ -174,6 +176,7 @@ static void cx231xx_audio_isocirq(struct urb *urb)
   period_elapsed = 1;
   }
   snd_pcm_stream_unlock(substream);
 + local_irq_restore(flags);
   }
   if (period_elapsed)
   snd_pcm_period_elapsed(substream);
 @@ -224,6 +227,7 @@ static void cx231xx_audio_bulkirq(struct urb *urb)
   stride = runtime-frame_bits  3;
  
   if (1) {
 + unsigned long flags;
   int length = urb-actual_length /
stride;
   cp = (unsigned char *)urb-transfer_buffer;
 @@ -242,6 +246,7 @@ static void cx231xx_audio_bulkirq(struct urb *urb)
  length * stride);
   }
  
 + local_irq_save(flags);
   snd_pcm_stream_lock(substream);
  
   dev-adev.hwptr_done_capture += length;
 @@ -258,6 +263,7 @@ static void cx231xx_audio_bulkirq(struct urb *urb)
   period_elapsed = 1;
   }
   snd_pcm_stream_unlock(substream);
 + local_irq_restore(flags);
   }
   if (period_elapsed)
   snd_pcm_period_elapsed(substream);
 diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c 
 b/drivers/media/usb/cx231xx/cx231xx-core.c
 index 4ba3ce0..593b397 100644
 --- a/drivers/media/usb/cx231xx/cx231xx-core.c
 +++ b/drivers/media/usb/cx231xx/cx231xx-core.c
 @@ -798,6 +798,7 @@ static void cx231xx_isoc_irq_callback(struct urb *urb)
   container_of(dma_q, struct cx231xx_video_mode, vidq);
   struct cx231xx *dev = container_of(vmode, struct cx231xx, video_mode);
   int i;
 + unsigned long flags;
  
   switch (urb-status) {
   case 0: /* success */
 @@ -813,9 +814,9 @@ static void cx231xx_isoc_irq_callback(struct urb *urb)
   }
  
   /* Copy data from URB */
 - spin_lock(dev-video_mode.slock);
 + spin_lock_irqsave(dev-video_mode.slock, flags);
   dev-video_mode.isoc_ctl.isoc_copy(dev, urb);
 - spin_unlock(dev-video_mode.slock);
 + spin_unlock_irqrestore(dev-video_mode.slock, flags);
  
   /* Reset urb buffers */
   for (i = 0; i  urb-number_of_packets; i++) {
 @@ -842,6 +843,7 @@ static void cx231xx_bulk_irq_callback(struct urb *urb)
   struct cx231xx_video_mode *vmode =
   container_of(dma_q, struct cx231xx_video_mode, vidq);
   struct cx231xx *dev = container_of(vmode, struct cx231xx, video_mode);
 + unsigned long flags;
  
   switch (urb-status) {
   case 0: /* success */
 @@ -857,9 +859,9 @@ static void cx231xx_bulk_irq_callback(struct urb *urb)
   }
  
   /* Copy data from URB */
 - spin_lock(dev-video_mode.slock);
 + spin_lock_irqsave(dev-video_mode.slock, flags);
   dev-video_mode.bulk_ctl.bulk_copy(dev, urb);
 - spin_unlock(dev-video_mode.slock);
 + spin_unlock_irqrestore(dev-video_mode.slock, flags);
  
   /* Reset urb buffers */
   

[GIT PULL FOR v3.12] Accumulated patches for 3.12

2013-07-26 Thread Hans Verkuil
These are all outstanding patches for v4l2 drivers and video 
receivers/transmitters.
If I missed any, then please let me know!

Regards,

Hans

The following changes since commit c859e6ef33ac0c9a5e9e934fe11a2232752b4e96:

  [media] dib0700: add support for PCTV 2002e  PCTV 2002e SE (2013-07-22 
07:48:11 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git for-v3.12

for you to fetch changes up to 80db3da9d332840b5029756ed44420c31e923f5d:

  em28xx: Fix vidioc fmt vid cap v4l2 compliance (2013-07-26 15:26:01 +0200)


Alban Browaeys (1):
  em28xx: Fix vidioc fmt vid cap v4l2 compliance

Alexey Khoroshilov (2):
  tlg2300: implement error handling in poseidon_probe()
  tlg2300: fix checking firmware in poseidon_probe()

Ezequiel Garcia (2):
  stk1160: Allow to change input while streaming
  media: stk1160: Ignore unchanged standard set

Lad, Prabhakar (13):
  media: i2c: ths8200: support asynchronous probing
  media: i2c: ths8200: add OF support
  media: i2c: adv7343: add support for asynchronous probing
  media: i2c: tvp7002: add support for asynchronous probing
  media: i2c: tvp514x: add support for asynchronous probing
  media: davinci: vpif: capture: add V4L2-async support
  media: davinci: vpif: display: add V4L2-async support
  media: davinci: vpbe_venc: convert to devm_* api
  media: davinci: vpbe_osd: convert to devm_* api
  media: davinci: vpbe_display: convert to devm* api
  media: davinci: vpss: convert to devm* api
  media: i2c: adv7343: make the platform data members as array
  media: i2c: adv7343: add OF support

Libin Yang (7):
  marvell-ccic: add MIPI support for marvell-ccic driver
  marvell-ccic: add clock tree support for marvell-ccic driver
  marvell-ccic: reset ccic phy when stop streaming for stability
  marvell-ccic: refine mcam_set_contig_buffer function
  marvell-ccic: add new formats support for marvell-ccic driver
  marvell-ccic: add SOF / EOF pair check for marvell-ccic driver
  marvell-ccic: switch to resource managed allocation and request

Libo Chen (1):
  drivers/media/radio/radio-maxiradio: Convert to module_pci_driver

Lubomir Rintel (1):
  usbtv: Add S-Video input support

Ondrej Zary (4):
  tea575x-tuner: move HW init to a separate function
  bttv: stop abusing mbox_we for sw_status
  radio-aztech: Convert to generic lm7000 implementation
  radio-aztech: Implement signal strength detection and fix stereo detection

Vladimir Barinov (1):
  ml86v7667: override default field interlace order

Wei Yongjun (1):
  usbtv: remove unused including linux/version.h

 Documentation/devicetree/bindings/media/i2c/adv7343.txt |  48 ++
 Documentation/devicetree/bindings/media/i2c/ths8200.txt |  19 
 arch/arm/mach-davinci/board-da850-evm.c |   6 +-
 drivers/media/i2c/adv7343.c |  89 
+++
 drivers/media/i2c/ml86v7667.c   |   3 +-
 drivers/media/i2c/ths8200.c |  18 +++-
 drivers/media/i2c/tvp514x.c |  20 +++--
 drivers/media/i2c/tvp7002.c |   6 ++
 drivers/media/pci/bt8xx/bttv-cards.c|  26 ++
 drivers/media/pci/bt8xx/bttvp.h |   3 +
 drivers/media/platform/davinci/vpbe_display.c   |  23 ++---
 drivers/media/platform/davinci/vpbe_osd.c   |  45 +++---
 drivers/media/platform/davinci/vpbe_venc.c  |  97 

 drivers/media/platform/davinci/vpif_capture.c   | 151 
++--
 drivers/media/platform/davinci/vpif_capture.h   |   2 +
 drivers/media/platform/davinci/vpif_display.c   | 210 
+++-
 drivers/media/platform/davinci/vpif_display.h   |   3 +-
 drivers/media/platform/davinci/vpss.c   |  62 +++--
 drivers/media/platform/marvell-ccic/cafe-driver.c   |   4 +-
 drivers/media/platform/marvell-ccic/mcam-core.c | 325 
+---
 drivers/media/platform/marvell-ccic/mcam-core.h |  50 ++-
 drivers/media/platform/marvell-ccic/mmp-driver.c| 274 
-
 drivers/media/radio/radio-aztech.c  |  81 ++---
 drivers/media/radio/radio-maxiradio.c   |  13 +--
 drivers/media/usb/em28xx/em28xx-video.c |   1 +
 drivers/media/usb/stk1160/stk1160-v4l.c |   6 +-
 drivers/media/usb/tlg2300/pd-main.c |  37 ++--
 drivers/media/usb/usbtv/usbtv.c | 100 
+
 include/media/adv7343.h

Re: [PATCH v2 6/8] [media] coda: dynamic IRAM setup for decoder

2013-07-26 Thread Mauro Carvalho Chehab
Em Fri, 21 Jun 2013 09:55:32 +0200
Philipp Zabel p.za...@pengutronix.de escreveu:

 Signed-off-by: Philipp Zabel p.za...@pengutronix.de

Please add a description for the patch.

Thanks!
Mauro

 ---
  drivers/media/platform/coda.c | 50 
 +--
  1 file changed, 48 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
 index 1f3bd43..856a93e 100644
 --- a/drivers/media/platform/coda.c
 +++ b/drivers/media/platform/coda.c
 @@ -1212,6 +1212,7 @@ static void coda_setup_iram(struct coda_ctx *ctx)
   int ipacdc_size;
   int bitram_size;
   int dbk_size;
 + int ovl_size;
   int mb_width;
   int me_size;
   int size;
 @@ -1273,7 +1274,47 @@ static void coda_setup_iram(struct coda_ctx *ctx)
   size -= ipacdc_size;
   }
  
 - /* OVL disabled for encoder */
 + /* OVL and BTP disabled for encoder */
 + } else if (ctx-inst_type == CODA_INST_DECODER) {
 + struct coda_q_data *q_data_dst;
 + int mb_height;
 +
 + q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
 + mb_width = DIV_ROUND_UP(q_data_dst-width, 16);
 + mb_height = DIV_ROUND_UP(q_data_dst-height, 16);
 +
 + dbk_size = round_up(256 * mb_width, 1024);
 + if (size = dbk_size) {
 + iram_info-axi_sram_use |= CODA7_USE_HOST_DBK_ENABLE;
 + iram_info-buf_dbk_y_use = dev-iram_paddr;
 + iram_info-buf_dbk_c_use = dev-iram_paddr +
 +dbk_size / 2;
 + size -= dbk_size;
 + } else {
 + goto out;
 + }
 +
 + bitram_size = round_up(128 * mb_width, 1024);
 + if (size = bitram_size) {
 + iram_info-axi_sram_use |= CODA7_USE_HOST_BIT_ENABLE;
 + iram_info-buf_bit_use = iram_info-buf_dbk_c_use +
 +  dbk_size / 2;
 + size -= bitram_size;
 + } else {
 + goto out;
 + }
 +
 + ipacdc_size = round_up(128 * mb_width, 1024);
 + if (size = ipacdc_size) {
 + iram_info-axi_sram_use |= CODA7_USE_HOST_IP_ENABLE;
 + iram_info-buf_ip_ac_dc_use = iram_info-buf_bit_use +
 +   bitram_size;
 + size -= ipacdc_size;
 + } else {
 + goto out;
 + }
 +
 + ovl_size = round_up(80 * mb_width, 1024);
   }
  
  out:
 @@ -1300,7 +1341,12 @@ out:
  
   if (dev-devtype-product == CODA_7541) {
   /* TODO - Enabling these causes picture errors on CODA7541 */
 - if (ctx-inst_type == CODA_INST_ENCODER) {
 + if (ctx-inst_type == CODA_INST_DECODER) {
 + /* fw 1.4.50 */
 + iram_info-axi_sram_use = ~(CODA7_USE_HOST_IP_ENABLE |
 +  CODA7_USE_IP_ENABLE);
 + } else {
 + /* fw 13.4.29 */
   iram_info-axi_sram_use = ~(CODA7_USE_HOST_IP_ENABLE |
CODA7_USE_HOST_DBK_ENABLE |
CODA7_USE_IP_ENABLE |


-- 

Cheers,
Mauro
--
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


[omapdss] fault in dispc_write_irqenable [was: Re: [omap3isp] xclk deadlock]

2013-07-26 Thread Jakub Piotr Cłapa

Dear Tomi,

Thanks for your reply.

On 26.07.13 09:50, Tomi Valkeinen wrote:

Sounds like something is enabling/disabling dispc interrupts after the
clocks have already been turned off.

So what's the context here? What kernel?


This was on 3.10 from Laurent's board/beagle/mt9p031 branch. I am in the 
middle of doing some bisecting to figure out some unrelated problems 
with omap3isp so in a couple days I may have more data about which 
versions work and which do not.



Using omapfb, or...? I hope not
omap_vout, because that's rather unmaintained =).


Laurent's live application is using the V4L2 API for video output (to 
get free YUV conversion and DMA) so I guess this unfortunatelly counts 
as using omap_vout. Are there any alternatives I should look into? IIUC 
to use omapfb I would need to manually copy RGB data into the 
framebuffer on each frame.


--
regards,
Jakub Piotr Cłapa
LoEE.pl
--
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: [omap3isp] xclk deadlock

2013-07-26 Thread Laurent Pinchart
Hi Jakub,

On Thursday 18 July 2013 00:17:19 Jakub Piotr Cłapa wrote:
 On 17.07.13 14:50, Laurent Pinchart wrote:
  Hi Jakub,
  
  3. After setting up a simple pipeline using media-ctl[2] I get CCDC
  won't become idle errors. If I do this after running live I also get
  (unless it hangs) the CCDC Register dump [1]. Otherwise I only get the
  stream of kernel log messages without anything else from omap3isp.
  
  4. I recreated the live pipeline (judging by the lack of differences
  in media-ctl -p output [3]) and used yavta. I get the same hangs but
  when I don't I can check the UYVY frames one by one. They look bad at
  any stride (I dropped the UV components and tried to get some meaningful
  output in the GIMP raw image data import dialog by adjustung the
  width).
  
  Would you be able to bisect the problems ? Please also see below for more
  comments.
 
 I think the clock  voltage regulator framework changes in omap3beagle.c
 would require reverting for earlier versions? Are there any other things I
 should watch out for?

Not that I can think of, no.

  As a side note, you can use raw2rgbpnm (https://gitorious.org/raw2rgbpnm)
  to convert raw binary images to a more usable format.
 
 Thanks. The nice thing about the GIMP import tool is interactiveness, which
 is good when (I suspect) I don't know the proper image dimensions.
 
  [2]:
  media-ctl -r -l 'mt9p031 2-0048:0-OMAP3 ISP CCDC:0[1], OMAP3 ISP
  CCDC:1-OMAP3 ISP CCDC output:0[1]'
  media-ctl -v -f 'mt9p031 2-0048:0 [SGRBG12 800x600 (96,72)/2400x1800],
  OMAP3 ISP CCDC:1 [SGRBG8 800x600]'
  
  You're trying to configure the sensor output to 800x600, but the closest
  resolution the sensor can deliver is 864x648. The sensor driver will thus
  return that resolution, and media-ctl will automatically configure the
  connected pad (CCDC sink pad 0) with the same resolution. Similarly, you
  try to configure the CCDC output to 800x600, but the CCDC driver will
  automatically set its output resolution (on source pad 1) to 864x648.
  media- ctl won't complain, and your pipeline will be correctly
  configured, but not in the resolution you expect.
  
  yavta -f SGRBG12 -s 800x600 -n 8 --skip 4 --capture=5 -F'frame-#.bin'
  $(media-ctl -e OMAP3 ISP CCDC output)
  
  Can you run this without error ? You're trying to capture in 800x600 at
  the CCDC output but the pipeline has been configured with a different
  resolution. The OMAP3 ISP driver should return an error when you start
  the video stream. If it doesn't, that's a driver bug.
 
 I think you missed my ingenious sensor crop. ;) The sensor should be
 capable of scaling to 800x600 if it crops to (96,72)/2400x1800 first
 (this just requires 3x binning). I tried this on 3.2.24 and it worked.

You're right, my bad.

  [4]:
  
  @@ -21,9 +21,9 @@
  
 omap3isp omap3isp: ###RSZ YENH=0x
 omap3isp omap3isp: 
 omap3isp omap3isp: -Preview Register dump--
  
  -omap3isp omap3isp: ###PRV PCR=0x180e0609
  -omap3isp omap3isp: ###PRV HORZ_INFO=0x0006035b
  -omap3isp omap3isp: ###PRV VERT_INFO=0x0286
  +omap3isp omap3isp: ###PRV PCR=0x180e0600
  
  Bits 0 and 3 are the ENABLE and ONESHOT bits respectively. The registers
  dump might have been displayed at a different time in v3.2.24 (although I
  haven't checked);
  
  +omap3isp omap3isp: ###PRV HORZ_INFO=0x00080359
  +omap3isp omap3isp: ###PRV VERT_INFO=0x00020284
  
  Those two registers contain the input crop rectangle coordinates (left/top
  in bits 31-16, right/bottom in bits 15-0). Note that this is the internal
  crop rectangle, which takes rows and columns required for internal
  processing into account. It will thus not match the user-visible crop
  rectangle at the sink pad.
  
  The crop rectangle has changed from (6,0)/860x647 to (8,2)/850x643. The
  preview engine internally crops 4 rows and 4 columns (2 on each side) when
  converting from Bayer to YUV, so the (8,2)/850x643 crop rectangle becomes
  (10,4)/846x639 after manual and internal cropping, which matches the value
  reported by media-ctl -p.
 
 But why does those cropping differences (between 3.2.24 and 3.10) happen at
 all? I run the same live code on 3.2.24 and 3.10, with the same sensor and
 output resolution. I think I got the same `media-ctl -p` output after
 running `live` on both kernels but will check this tomorrow.

If media-ctl -p reports the exact same pipeline configuration on both kernel 
versions then there's an issue.

 If these internal cropping rectangles on 3.10 were wrong it would probably
 explain the bad synchronization problem.

 omap3isp omap3isp: ###PRV RSDR_ADDR=0x
 omap3isp omap3isp: ###PRV RADR_OFFSET=0x
 omap3isp omap3isp: ###PRV DSDR_ADDR=0x
  
  @@ -52,7 +52,7 @@
  
 omap3isp omap3isp: ###PRV CNT_BRT=0x1000
 omap3isp omap3isp: ###PRV CSUP=0x
 omap3isp omap3isp: ###PRV SETUP_YC=0xff00ff00
  
  -omap3isp omap3isp: 

Re: [omapdss] fault in dispc_write_irqenable [was: Re: [omap3isp] xclk deadlock]

2013-07-26 Thread Laurent Pinchart
Hi Jakub,

On Friday 26 July 2013 17:37:36 Jakub Piotr Cłapa wrote:
 Dear Tomi,
 
 Thanks for your reply.
 
 On 26.07.13 09:50, Tomi Valkeinen wrote:
  Sounds like something is enabling/disabling dispc interrupts after the
  clocks have already been turned off.
  
  So what's the context here? What kernel?
 
 This was on 3.10 from Laurent's board/beagle/mt9p031 branch. I am in the
 middle of doing some bisecting to figure out some unrelated problems
 with omap3isp so in a couple days I may have more data about which
 versions work and which do not.
 
  Using omapfb, or...? I hope not
  omap_vout, because that's rather unmaintained =).
 
 Laurent's live application is using the V4L2 API for video output (to
 get free YUV conversion and DMA) so I guess this unfortunatelly counts
 as using omap_vout. Are there any alternatives I should look into? IIUC
 to use omapfb I would need to manually copy RGB data into the
 framebuffer on each frame.

It should be possible to port the live application to use DRM/KMS with omapdrm 
for the display side, without requiring any memory copy. That's somewhere on 
my TODO list, but I won't have time to work on that before way too long.

-- 
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] mt9v032: Use the common clock framework

2013-07-26 Thread Laurent Pinchart
Hi Sylwester,

On Friday 26 July 2013 15:36:22 Sylwester Nawrocki wrote:
 On 07/26/2013 03:15 PM, Laurent Pinchart wrote:
  On Friday 26 July 2013 15:11:08 Sylwester Nawrocki wrote:
  On 07/05/2013 12:55 PM, Laurent Pinchart wrote:
  Configure the device external clock using the common clock framework
  instead of a board code callback function.
  
  Signed-off-by: Laurent Pinchartlaurent.pinch...@ideasonboard.com
  ---
  
 drivers/media/i2c/mt9v032.c | 16 ++--
 include/media/mt9v032.h |  4 
 2 files changed, 10 insertions(+), 10 deletions(-)
  
  diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c
  index 60c6f67..7b30640 100644
  --- a/drivers/media/i2c/mt9v032.c
  +++ b/drivers/media/i2c/mt9v032.c
  @@ -12,6 +12,7 @@
  * published by the Free Software Foundation.
  */
  
  +#includelinux/clk.h
 #includelinux/delay.h
 #includelinux/i2c.h
 #includelinux/log2.h
  @@ -135,6 +136,8 @@ struct mt9v032 {
struct mutex power_lock;
int power_count;
  
  + struct clk *clk;
  +
struct mt9v032_platform_data *pdata;

u32 sysclk;
  @@ -219,10 +222,8 @@ static int mt9v032_power_on(struct mt9v032
  *mt9v032)
struct i2c_client *client = 
  v4l2_get_subdevdata(mt9v032-subdev);
int ret;
  
  - if (mt9v032-pdata-set_clock) {
  - mt9v032-pdata-set_clock(mt9v032-subdev, mt9v032-sysclk);
  - udelay(1);
  - }
  + clk_prepare_enable(mt9v032-clk);
  + udelay(1);
  
/* Reset the chip and stop data read out */
ret = mt9v032_write(client, MT9V032_RESET, 1);
  @@ -238,8 +239,7 @@ static int mt9v032_power_on(struct mt9v032 *mt9v032)
  
 static void mt9v032_power_off(struct mt9v032 *mt9v032)
 {
  - if (mt9v032-pdata-set_clock)
  - mt9v032-pdata-set_clock(mt9v032-subdev, 0);
  + clk_disable_unprepare(mt9v032-clk);
 }
 
 static int __mt9v032_set_power(struct mt9v032 *mt9v032, bool on)
  @@ -748,6 +748,10 @@ static int mt9v032_probe(struct i2c_client *client,
if (!mt9v032)
return -ENOMEM;
  
  + mt9v032-clk = devm_clk_get(client-dev, NULL);
  + if (IS_ERR(mt9v032-clk))
  + return PTR_ERR(mt9v032-clk);
  +
mutex_init(mt9v032-power_lock);
mt9v032-pdata = pdata;
  
  diff --git a/include/media/mt9v032.h b/include/media/mt9v032.h
  index 78fd39e..12175a6 100644
  --- a/include/media/mt9v032.h
  +++ b/include/media/mt9v032.h
  @@ -1,13 +1,9 @@
 #ifndef _MEDIA_MT9V032_H
 #define _MEDIA_MT9V032_H
  
  -struct v4l2_subdev;
  -
 struct mt9v032_platform_data {
unsigned int clk_pol:1;
  - void (*set_clock)(struct v4l2_subdev *subdev, unsigned int rate);
  -
const s64 *link_freqs;
s64 link_def_freq;
 };
  
  Is there clk_put() somewhere in this patch ? I would expect it somewhere
  around driver remove() callback, but can't see it. :-/
  
  There's *devm_*clk_get() instead :-)
 
 Ah, I knew I must have been forgetting or overlooking something! ;)
 
 Do you rely on the fact that __clk_get()/__clk_put() doesn't get reference
 on the clock supplier module (to avoid locking modules in memory) ? I was
 planning on adding module_get()/module_put() inside __clk_get()/__clk_out()
 for the common clock API implementation.

I'm currently relying on that, but I'm aware it's not a good idea. We need to 
find a solution to fix the problem in the context of the v4l2-async framework.

-- 
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 0/7] [media] vsp1: Add VIO6 support

2013-07-26 Thread Laurent Pinchart
Hi Matsubara-san,

On Friday 26 July 2013 18:32:10 Katsuya Matsubara wrote:
 Hi Laurent,
 
 Could you please consider the following patches to add VIO6 support into
 your VSP1 driver implementation?
 Any comments or ideas of better implementation are of course welcome.

Thank you for the patches. The first two patches being fixes, I've already 
applied them to my tree. I will review the remaining patches as soon as 
possible and will send you my comments.

 The first two patches are fixes, not only for VIO6.
 The next four patches are preparations of supporting multiple versions of
 the H/W IP.
 The final one is adding definitions of VIO6.
 
 The code has been tested on an Armadillo800EVA board.
 
 The series is based on the following patchset:
  [PATCH v3 0/5] Renesas VSP1 driver
  [PATCH v3 1/5] media: Add support for circular graph traversal
  [PATCH v3 2/5] v4l: Fix V4L2_MBUS_FMT_YUV10_1X30 media bus pixel code value
 [PATCH v3 3/5] v4l: Add media format codes for ARGB and AYUV on
 32-bit busses [PATCH v3 4/5] v4l: Add V4L2_PIX_FMT_NV16M and
 V4L2_PIX_FMT_NV61M formats [PATCH v3 5/5] v4l: Renesas R-Car VSP1 driver
 
 
 Katsuya Matsubara (7):
   [media] vsp1: Fix lack of the sink entity setting for enabled links.
   [media] vsp1: Use the maximum number defined in platform data
   [media] vsp1: Rewrite the definition of registers' offset as enum and
 arrays
   [media] vsp1: Rewrite the value definitions for DPR routing as enum
 and arrays
   [media] vsp1: Introduce bit operations for the DPR route registers
   [media] vsp1: Move the DPR_WPF_FPORCH register settings into the
 device initialization
   [media] vsp1: Add VIO6 support
 
  drivers/media/platform/vsp1/vsp1.h|   23 +-
  drivers/media/platform/vsp1/vsp1_drv.c|  492 --
  drivers/media/platform/vsp1/vsp1_entity.c |   31 +-
  drivers/media/platform/vsp1/vsp1_entity.h |3 +-
  drivers/media/platform/vsp1/vsp1_lif.c|2 +-
  drivers/media/platform/vsp1/vsp1_regs.h   |  497 ++
  drivers/media/platform/vsp1/vsp1_rpf.c|   19 +-
  drivers/media/platform/vsp1/vsp1_uds.c|   14 +-
  drivers/media/platform/vsp1/vsp1_video.c  |   27 +-
  drivers/media/platform/vsp1/vsp1_wpf.c|   29 +-
  10 files changed, 849 insertions(+), 288 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


cron job: media_tree daily build: ERRORS

2013-07-26 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:   Fri Jul 26 19:00:23 CEST 2013
git branch: test
git hash:   51dd4d70fc59564454a4dcb90d6d46d39a4a97ef
gcc version:i686-linux-gcc (GCC) 4.8.1
sparse version: v0.4.5-rc1
host hardware:  x86_64
host os:3.9-7.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.31.14-i686: ERRORS
linux-2.6.32.27-i686: ERRORS
linux-2.6.33.7-i686: ERRORS
linux-2.6.34.7-i686: ERRORS
linux-2.6.35.9-i686: ERRORS
linux-2.6.36.4-i686: ERRORS
linux-2.6.37.6-i686: ERRORS
linux-2.6.38.8-i686: ERRORS
linux-2.6.39.4-i686: ERRORS
linux-3.0.60-i686: ERRORS
linux-3.10-i686: OK
linux-3.1.10-i686: ERRORS
linux-3.2.37-i686: ERRORS
linux-3.3.8-i686: ERRORS
linux-3.4.27-i686: WARNINGS
linux-3.5.7-i686: WARNINGS
linux-3.6.11-i686: WARNINGS
linux-3.7.4-i686: WARNINGS
linux-3.8-i686: WARNINGS
linux-3.9.2-i686: WARNINGS
linux-2.6.31.14-x86_64: ERRORS
linux-2.6.32.27-x86_64: ERRORS
linux-2.6.33.7-x86_64: ERRORS
linux-2.6.34.7-x86_64: ERRORS
linux-2.6.35.9-x86_64: ERRORS
linux-2.6.36.4-x86_64: ERRORS
linux-2.6.37.6-x86_64: ERRORS
linux-2.6.38.8-x86_64: ERRORS
linux-2.6.39.4-x86_64: ERRORS
linux-3.0.60-x86_64: ERRORS
linux-3.10-x86_64: OK
linux-3.1.10-x86_64: ERRORS
linux-3.2.37-x86_64: ERRORS
linux-3.3.8-x86_64: ERRORS
linux-3.4.27-x86_64: WARNINGS
linux-3.5.7-x86_64: WARNINGS
linux-3.6.11-x86_64: WARNINGS
linux-3.7.4-x86_64: WARNINGS
linux-3.8-x86_64: WARNINGS
linux-3.9.2-x86_64: WARNINGS
apps: WARNINGS
spec-git: OK
sparse version: v0.4.5-rc1
sparse: ERRORS

Detailed results are available here:

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

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Friday.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: [omapdss] fault in dispc_write_irqenable [was: Re: [omap3isp] xclk deadlock]

2013-07-26 Thread Jakub Piotr Cłapa

On 26.07.13 17:52, Laurent Pinchart wrote:

Using omapfb, or...? I hope not
omap_vout, because that's rather unmaintained =).


Laurent's live application is using the V4L2 API for video output (to
get free YUV conversion and DMA) so I guess this unfortunatelly counts
as using omap_vout. Are there any alternatives I should look into? IIUC
to use omapfb I would need to manually copy RGB data into the
framebuffer on each frame.


It should be possible to port the live application to use DRM/KMS with omapdrm
for the display side, without requiring any memory copy. That's somewhere on
my TODO list, but I won't have time to work on that before way too long.


I could look into it myself but is there any documentation on omapdrm?

From what I found libdrm should probably be used but information about 
it's API is really scarce:

https://dvdhrm.wordpress.com/2012/09/13/linux-drm-mode-setting-api/
http://dvdhrm.wordpress.com/2012/12/21/advanced-drm-mode-setting-api/
http://virtuousgeek.org/blog/index.php/jbarnes/2011/10/31/writing_stanalone_programs_with_egl_and_

The last one seems focused on OpenGL so I don't think it applies.

Are there any good sources to learn about this? Or maybe some pointers 
on where to start with reading source code?


--
regards,
Jakub Piotr Cłapa
LoEE.pl
--
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: [omapdss] fault in dispc_write_irqenable [was: Re: [omap3isp] xclk deadlock]

2013-07-26 Thread Laurent Pinchart
Hi Jakub,

On Friday 26 July 2013 21:02:35 Jakub Piotr Cłapa wrote:
 On 26.07.13 17:52, Laurent Pinchart wrote:
  Using omapfb, or...? I hope not
  omap_vout, because that's rather unmaintained =).
  
  Laurent's live application is using the V4L2 API for video output (to
  get free YUV conversion and DMA) so I guess this unfortunatelly counts
  as using omap_vout. Are there any alternatives I should look into? IIUC
  to use omapfb I would need to manually copy RGB data into the
  framebuffer on each frame.
  
  It should be possible to port the live application to use DRM/KMS with
  omapdrm for the display side, without requiring any memory copy. That's
  somewhere on my TODO list, but I won't have time to work on that before
  way too long.
 I could look into it myself but is there any documentation on omapdrm?
 
 From what I found libdrm should probably be used but information about it's
 API is really scarce:
 https://dvdhrm.wordpress.com/2012/09/13/linux-drm-mode-setting-api/
 http://dvdhrm.wordpress.com/2012/12/21/advanced-drm-mode-setting-api/
 http://virtuousgeek.org/blog/index.php/jbarnes/2011/10/31/writing_stanalone_
 programs_with_egl_and_
 
 The last one seems focused on OpenGL so I don't think it applies.
 
 Are there any good sources to learn about this? Or maybe some pointers on
 where to start with reading source code?

http://events.linuxfoundation.org/sites/events/files/lcjpcojp13_pinchart.pdf

A bit of shameless self-advertising :-)

It would have been clearer with the video, but it seems the talk hasn't been 
recorded :-/ There's also http://www.youtube.com/watch?v=Ja8fM7rTae4 that 
mostly focuses on the kernel side but starts with explanations of the key KMS 
concepts.

As far as KMS is concerned, libdrm is mostly a wrapper, so any documentation 
on the KMS ioctls can help 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: [omap3isp] xclk deadlock

2013-07-26 Thread Jakub Piotr Cłapa

Dear Laurent,

The offending commit is
b2da46e52fe7871cba36e1a435844502c0eccf39

After reverting it I get good image on v3.5-rc1. Unfortunatelly trying 
to revert it on the board/beagle/mt9p031 branch causes conflicts and I 
am too tired to even try to fix them right now.


The hanging unfortunatelly remains. It hangs most of the time with 
(ctrl-c was pressed at ≈133 seconds):


[   39.601318] omap3isp omap3isp: ###CCDC LSC_INITIAL=0x
[   39.607299] omap3isp omap3isp: ###CCDC LSC_TABLE_BASE=0x
[   39.613586] omap3isp omap3isp: ###CCDC LSC_TABLE_OFFSET=0x
[   39.620056] omap3isp omap3isp: 

[  133.516906] omap3isp omap3isp: OMAP3 ISP AEWB: user wants to disable 
module.

[  133.524383] omap3isp omap3isp: OMAP3 ISP AEWB: module is being disabled
[  133.531311] omap3isp omap3isp: OMAP3 ISP AF: user wants to disable 
module.

[  133.538543] omap3isp omap3isp: OMAP3 ISP AF: module is being disabled
[  133.545288] omap3isp omap3isp: OMAP3 ISP histogram: user wants to 
disable module.
[  133.553131] omap3isp omap3isp: OMAP3 ISP histogram: module is being 
disabled


One time I got a lucky and after 1 second elapsed I got:

[   35.250274] omap3isp omap3isp: Unable to stop OMAP3 ISP CCDC
477 images processed in 16.655242 seconds (28.639629 fps)

The second line is console output from ./live.



PS. In case anybody would wish to reproduce my results:

For kernels 3.3 - 3.9 you have to apply:
https://linuxtv.org/patch/10250/
to get omapdss to work.

Until 15693b57931b19f3bb4664cb4fa3f6f966058749 (between 3.4 and 3.5-rc1) 
you can use for the board intergration patch:

https://github.com/MaxGalemin/buildroot/blob/develop/board/beagleboard/xm/kernel-patches/linux-0003-Add-support-for-MT9P031-Aptina-image-sensor-driver.patch

Later ones needs to replace the reset callback with a GPIO number and 
remove the COLOR/MONOCHROME parameter.


The rest is wrestling with changing kernel config parameter names. 
(DVI-TFP410? ;)


--
regards,
Jakub Piotr Cłapa
LoEE.pl
--
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