Re: [PATCH/RFC 1/4] ipu_idmac: code clean-up and robustness improvements

2009-03-02 Thread Agustin

--- On 28/2/09, Guennadi Liakhovetski wrote:
 On Sat, 28 Feb 2009, Agustin wrote:
 
 Hi Guennadi,
 
 I am having trouble while probing ipu idmac:
 
 At boot:
 ipu-core: probe of ipu-core failed with error -22
 
 Which is apparently happening at ipu_idmac:1706:
1695 static int __init ipu_probe(struct platform_device *pdev)
...
1703 mem_ipu = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1704 mem_ic  = platform_get_resource(pdev, IORESOURCE_MEM, 1);
1705 if (!pdata || !mem_ipu || !mem_ic)
1706 return -EINVAL;
 
 Later on, I get error 16, Device or resource busy on
VIDIOC_S_FMT, apparently because mx3_camera can't get its dma channel.
 
 Any clue?

Are you sure it is failing here, have you verified with a printk? If it is 
indeed this place, then you probably didn't register all required 
resources in your platfom code. Look at my platform-bindings patch.

Thanks
Guennadi

Thanks, I was missing mx3_ipu_data struct at devices.c file. It happened 
because I had git-pulled Valentin's older patch from mxc-master which made your 
patch fail a few chunks, then the code was very similar when I checked it 
visually.

Now let's see if I can get back on track with my new hardware design and take 
those pics...

Regards,
--Agustí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/RFC 1/4] ipu_idmac: code clean-up and robustness improvements

2009-02-28 Thread Agustin

Hi Guennadi,

I am having trouble while probing ipu idmac:

At boot:
ipu-core: probe of ipu-core failed with error -22

Which is apparently happening at ipu_idmac:1706:
   1695 static int __init ipu_probe(struct platform_device *pdev)
   ...
   1703 mem_ipu = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   1704 mem_ic  = platform_get_resource(pdev, IORESOURCE_MEM, 1);
   1705 if (!pdata || !mem_ipu || !mem_ic)
   1706 return -EINVAL;

Later on, I get error 16, Device or resource busy on VIDIOC_S_FMT, apparently 
because mx3_camera can't get its dma channel.

Any clue?

--
Agustin Ferrin Pozuelo
Embedded Systems Consultant
http://embedded.ferrin.org/

--- On 18/2/09, Guennadi Liakhovetski wrote:
From: Guennadi Liakhovetski l...@denx.de

General code clean-up: remove superfluous semicolons, update comments.
Robustness improvements: add DMA error handling to the ISR, move common code
fragments to functions, fix scatter-gather element queuing in the ISR, survive
channel freeing and re-allocation in a quick succession.

Signed-off-by: Guennadi Liakhovetski l...@denx.de
---

As mentioned in PATCH 0/4 this one is only for completeness / testing 
here, will be submitted separately to the dmaengine queue. Dan, would be 
good if you could review it here to save time.

 drivers/dma/ipu/ipu_idmac.c |  300 ---
 1 files changed, 196 insertions(+), 104 deletions(-)

diff --git a/drivers/dma/ipu/ipu_idmac.c b/drivers/dma/ipu/ipu_idmac.c
index 1f154d0..91e6e4e 100644
--- a/drivers/dma/ipu/ipu_idmac.c
+++ b/drivers/dma/ipu/ipu_idmac.c
@@ -28,6 +28,9 @@
 #define FS_VF_IN_VALID 0x0002
 #define FS_ENC_IN_VALID0x0001
 
+static int ipu_disable_channel(struct idmac *idmac, struct idmac_channel
*ichan,
+  bool wait_for_stop);
+
 /*
  * There can be only one, we could allocate it dynamically, but then we'd
have
  * to add an extra parameter to some functions, and use something as ugly as
@@ -107,7 +110,7 @@ static uint32_t bytes_per_pixel(enum pixel_fmt fmt)
}
 }
 
-/* Enable / disable direct write to memory by the Camera Sensor Interface */
+/* Enable direct write to memory by the Camera Sensor Interface */
 static void ipu_ic_enable_task(struct ipu *ipu, enum ipu_channel channel)
 {
uint32_t ic_conf, mask;
@@ -126,6 +129,7 @@ static void ipu_ic_enable_task(struct ipu *ipu, enum
ipu_channel channel)
idmac_write_icreg(ipu, ic_conf, IC_CONF);
 }
 
+/* Called under spin_lock_irqsave(ipu_data.lock) */
 static void ipu_ic_disable_task(struct ipu *ipu, enum ipu_channel channel)
 {
uint32_t ic_conf, mask;
@@ -422,7 +426,7 @@ static void ipu_ch_param_set_size(union chan_param_mem
*params,
break;
default:
dev_err(ipu_data.dev,
-   mxc ipu: unimplemented pixel format %d\n, pixel_fmt);
+   mx3 ipu: unimplemented pixel format %d\n, pixel_fmt);
break;
}
 
@@ -433,20 +437,20 @@ static void ipu_ch_param_set_burst_size(union
chan_param_mem *params,
uint16_t burst_pixels)
 {
params-pp.npb = burst_pixels - 1;
-};
+}
 
 static void ipu_ch_param_set_buffer(union chan_param_mem *params,
dma_addr_t buf0, dma_addr_t buf1)
 {
params-pp.eba0 = buf0;
params-pp.eba1 = buf1;
-};
+}
 
 static void ipu_ch_param_set_rotation(union chan_param_mem *params,
  enum ipu_rotate_mode rotate)
 {
params-pp.bam = rotate;
-};
+}
 
 static void ipu_write_param_mem(uint32_t addr, uint32_t *data,
uint32_t num_words)
@@ -571,7 +575,7 @@ static uint32_t dma_param_addr(uint32_t dma_ch)
 {
/* Channel Parameter Memory */
return 0x1 | (dma_ch  4);
-};
+}
 
 static void ipu_channel_set_priority(struct ipu *ipu, enum ipu_channel
channel,
 bool prio)
@@ -611,7 +615,8 @@ static uint32_t ipu_channel_conf_mask(enum ipu_channel
channel)
 
 /**
  * ipu_enable_channel() - enable an IPU channel.
- * @channel:   channel ID.
+ * @idmac: IPU DMAC context.
+ * @ichan: IDMAC channel.
  * @return:0 on success or negative error code on failure.
  */
 static int ipu_enable_channel(struct idmac *idmac, struct idmac_channel
*ichan)
@@ -649,7 +654,7 @@ static int ipu_enable_channel(struct idmac *idmac, struct
idmac_channel *ichan)
 
 /**
  * ipu_init_channel_buffer() - initialize a buffer for logical IPU channel.
- * @channel:   channel ID.
+ * @ichan: IDMAC channel.
  * @pixel_fmt: pixel format of buffer. Pixel format is a FOURCC ASCII code.
  * @width: width of buffer in pixels.
  * @height:height of buffer in pixels.
@@ -687,7 +692,7 @@ static int ipu_init_channel_buffer(struct idmac_channel
*ichan,
}
 
/* IC channel's stride must be a multiple of 8 pixels */
-   if 

Re: [PATCH/RFC 1/4] ipu_idmac: code clean-up and robustness improvements

2009-02-28 Thread Guennadi Liakhovetski
On Sat, 28 Feb 2009, Agustin wrote:

 
 Hi Guennadi,
 
 I am having trouble while probing ipu idmac:
 
 At boot:
 ipu-core: probe of ipu-core failed with error -22
 
 Which is apparently happening at ipu_idmac:1706:
1695 static int __init ipu_probe(struct platform_device *pdev)
...
1703 mem_ipu = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1704 mem_ic  = platform_get_resource(pdev, IORESOURCE_MEM, 1);
1705 if (!pdata || !mem_ipu || !mem_ic)
1706 return -EINVAL;
 
 Later on, I get error 16, Device or resource busy on VIDIOC_S_FMT, 
 apparently because mx3_camera can't get its dma channel.
 
 Any clue?

Are you sure it is failing here, have you verified with a printk? If it is 
indeed this place, then you probably didn't register all required 
resources in your platfom code. Look at my platform-bindings patch.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
--
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 1/4] ipu_idmac: code clean-up and robustness improvements

2009-02-18 Thread Agustin
Guennadi,
 Guennadi Liakhovetski wrote:
 
 From: Guennadi Liakhovetski 
 
 General code clean-up: remove superfluous semicolons, update comments.
 Robustness improvements: add DMA error handling to the ISR, move common code
 fragments to functions, fix scatter-gather element queuing in the ISR, survive
 channel freeing and re-allocation in a quick succession.
 
 Signed-off-by: Guennadi Liakhovetski 
 ---
 
 As mentioned in PATCH 0/4 this one is only for completeness / testing 
 here, will be submitted separately to the dmaengine queue. Dan, would be 
 good if you could review it here to save time.
 
 drivers/dma/ipu/ipu_idmac.c |  300 ---
 1 files changed, 196 insertions(+), 104 deletions(-)
 
 diff --git a/drivers/dma/ipu/ipu_idmac.c b/drivers/dma/ipu/ipu_idmac.c
 index 1f154d0..91e6e4e 100644
 --- a/drivers/dma/ipu/ipu_idmac.c
 +++ b/drivers/dma/ipu/ipu_idmac.c
 @@ -28,6 +28,9 @@
 #define FS_VF_IN_VALID0x0002
 #define FS_ENC_IN_VALID0x0001
 
 +static int ipu_disable_channel(struct idmac *idmac, struct idmac_channel 
 *ichan,
 +   bool wait_for_stop);
 +
 /*
 ...

Thanks a lot for the patchset!

I am having some stoopid trouble while trying to apply this patch to 
'mxc-master':
$ patch -p1 --dry-run  p1
patching file drivers/dma/ipu/ipu_idmac.c
patch:  malformed patch at line 29: /*

Looks like your patches lost their format while on their way, specially every 
single line with a starting space has had it removed. Or is it my e-mail 
reader? I am trying to fix it manually, no luck.

--
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 1/4] ipu_idmac: code clean-up and robustness improvements

2009-02-18 Thread Guennadi Liakhovetski
On Wed, 18 Feb 2009, Agustin wrote:

 I am having some stoopid trouble while trying to apply this patch to 
 'mxc-master':
 $ patch -p1 --dry-run  p1
 patching file drivers/dma/ipu/ipu_idmac.c
 patch:  malformed patch at line 29: /*
 
 Looks like your patches lost their format while on their way, specially 
 every single line with a starting space has had it removed. Or is it my 
 e-mail reader? I am trying to fix it manually, no luck.

I would tip at your reader - I just saved my emails, that I received back 
from the list and applied them - no problem.

In fact, there is a small problem with the main camera patch - Kconfig and 
Makefile hunks do not apply to Linus' ToT, but that's easy to fix, I'll 
fix it up for pull.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
--
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 1/4] ipu_idmac: code clean-up and robustness improvements

2009-02-18 Thread Russell King - ARM Linux
On Wed, Feb 18, 2009 at 07:09:55AM -0800, Agustin wrote:
 Guennadi,
  Guennadi Liakhovetski wrote:
  diff --git a/drivers/dma/ipu/ipu_idmac.c b/drivers/dma/ipu/ipu_idmac.c
  index 1f154d0..91e6e4e 100644
  --- a/drivers/dma/ipu/ipu_idmac.c
  +++ b/drivers/dma/ipu/ipu_idmac.c
  @@ -28,6 +28,9 @@
  #define FS_VF_IN_VALID0x0002
  #define FS_ENC_IN_VALID0x0001
  
  +static int ipu_disable_channel(struct idmac *idmac, struct idmac_channel 
  *ichan,
  +   bool wait_for_stop);
  +
  /*
  ...
...
 $ patch -p1 --dry-run  p1
 patching file drivers/dma/ipu/ipu_idmac.c
 patch:  malformed patch at line 29: /*
 
 Looks like your patches lost their format while on their way,
 specially every single line with a starting space has had it
 removed. Or is it my e-mail reader? I am trying to fix it manually,
 no luck.

I think it's your mail reader - the version I have here is fine.
What you could do is look up the message in the mailing list archive
on lists.arm.linux.org.uk, and use the '(text/plain)' link to download
an unmangled copy of it.
--
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 1/4] ipu_idmac: code clean-up and robustness improvements

2009-02-18 Thread Agustin
--- On 18/2/09, Russell King -wrote:
 On Wed, Feb 18, 2009 at 07:09:55AM -0800, Agustin wrote:
  $ patch -p1 --dry-run  p1
  patching file drivers/dma/ipu/ipu_idmac.c
  patch:  malformed patch at line 29: /*
  
  Looks like your patches lost their format while on their way,
  specially every single line with a starting space has had it
  removed. Or is it my e-mail reader? I am trying to fix it
  manually, no luck.
 
 I think it's your mail reader - the version I have here is fine.
 What you could do is look up the message in the mailing list
 archive on lists.arm.linux.org.uk, and use the '(text/plain)'
 link to download an unmangled copy of it.

Thanks, that worked fine.
--
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