RE: [PATCH] [media] s5p-jpeg: Adding Exynos7 Jpeg variant support

2015-01-12 Thread Tony K Nadackal
Hi Kukjin,

On Wednesday, January 07, 2015 6:09 PM, Jacek Anaszewski wrote,
 Hi Tony,
 
 On 01/07/2015 01:08 PM, Tony K Nadackal wrote:
  Dear Jacek,
 
  On Wednesday, January 07, 2015 3:15 PM Jacek Anaszewski wrote,
 
  Hi Tony,
 
  Sorry for late response, just got back from vacation.
 
  On 12/19/2014 04:37 AM, Tony K Nadackal wrote:
  Hi Jacek,
 
  On Wednesday, December 17, 2014 7:46 PM Jacek Anaszewski wrote,
  Hi Tony,
 
  Thanks for the patches.
 
 
  Thanks for the review.
 
  Please process them with scripts/checkpatch.pl as you will be
  submitting the
  next
  version - they contain many coding style related issues.
 
 
  I ran checkpatch before posting. Do you find any checkpatch related
  issues in the patch?
 
  There was a problem on my side, sorry for making confusion.
 
  My remaining comments below.
 
 
  [snip]
 
  +   if (ctx-jpeg-variant-version == SJPEG_EXYNOS7) {
  +   exynos4_jpeg_set_interrupt(jpeg-regs,
  SJPEG_EXYNOS7);
  +   exynos4_jpeg_set_enc_out_fmt(jpeg-regs,
  +   ctx-subsampling,
  EXYNOS7_ENC_FMT_MASK);
  +   exynos4_jpeg_set_img_fmt(jpeg-regs,
  +   ctx-out_q.fmt-fourcc,
  +
   EXYNOS7_SWAP_CHROMA_SHIFT);
  +   } else {
  +   exynos4_jpeg_set_interrupt(jpeg-regs,
  SJPEG_EXYNOS4);
  +   exynos4_jpeg_set_enc_out_fmt(jpeg-regs,
  +   ctx-subsampling,
  EXYNOS4_ENC_FMT_MASK);
  +   exynos4_jpeg_set_img_fmt(jpeg-regs,
  +   ctx-out_q.fmt-fourcc,
  +
   EXYNOS4_SWAP_CHROMA_SHIFT);
  +   }
  +
 
  I'd implement it this way:
 
  exynos4_jpeg_set_interrupt(jpeg-regs,
  ctx-jpeg-variant-version); exynos4_jpeg_set_enc_out_fmt(jpeg-regs,
 ctx-subsampling,
   (ctx-jpeg-variant-version == SJPEG_EXYNOS4) ?
   EXYNOS4_ENC_FMT_MASK :
   EXYNOS7_ENC_FMT_MASK);
  exynos4_jpeg_set_img_fmt(jpeg-regs, ctx-out_q.fmt-fourcc,
   (ctx-jpeg-variant-version == SJPEG_EXYNOS4) ?
   EXYNOS4_SWAP_CHROMA_SHIFT :
   EXYNOS7_SWAP_CHROMA_SHIFT);
 
 
  OK. Looks goods to me. Thanks for the suggestion.
 
  exynos4_jpeg_set_img_addr(ctx);
  exynos4_jpeg_set_jpeg_addr(ctx);
  exynos4_jpeg_set_encode_hoff_cnt(jpeg-regs,
 
  ctx-out_q.fmt-fourcc);
  } else {
  exynos4_jpeg_sw_reset(jpeg-regs);
  -   exynos4_jpeg_set_interrupt(jpeg-regs);
  exynos4_jpeg_set_img_addr(ctx);
  exynos4_jpeg_set_jpeg_addr(ctx);
  -   exynos4_jpeg_set_img_fmt(jpeg-regs, ctx-cap_q.fmt-
  fourcc);
 
  -   bitstream_size = DIV_ROUND_UP(ctx-out_q.size, 32);
  +   if (ctx-jpeg-variant-version == SJPEG_EXYNOS7) {
  +   exynos4_jpeg_set_interrupt(jpeg-regs,
  SJPEG_EXYNOS7);
  +   exynos4_jpeg_set_huff_tbl(jpeg-regs);
  +   exynos4_jpeg_set_huf_table_enable(jpeg-
 regs, 1);
  +
  +   /*
  +* JPEG IP allows storing 4 quantization tables
  +* We fill table 0 for luma and table 1 for
chroma
  +*/
  +   exynos4_jpeg_set_qtbl_lum(jpeg-regs,
  +   ctx-
 compr_quality);
  +   exynos4_jpeg_set_qtbl_chr(jpeg-regs,
  +   ctx-
 compr_quality);
 
  Is it really required to setup quantization tables for encoding?
 
 
  Without setting up the quantization tables, encoder is working fine.
  But, as per Exynos7 User Manual setting up the quantization tables
  are required for encoding also.
 
 
  Sorry I also got it mixed up.
  *Decoder* works fine without setting up the quantization tables. But
  this step is mentioned in User Manual.
 
 I'm ok with it provided that you will get an ack from Samsung SOCs maintainer.
 
  Actually I intended to ask if setting the quantization tables is
  required for *decoding*, as you set it also in decoding path, whereas
  for Exynos4 it is not required. I looks strange for me as
  quantization tables are usually required
  only
  for encoding raw images.
  The same is related to huffman tables.
 
  Huffman table is required for Exynos7 decoding.
  User Manual says about  Update_Huf_Tbl [bit 19 of PEG_CNTL],
  User/Host should mandatory program this Bit as 1 for every decoder
  operation. SFR HUFF_TBL_ENT and SFR HUFF_CNT should be programmed
  accordingly for every encoder/decoder operation.
 
 Same situation as above.
 
 
  +   exynos4_jpeg_set_stream_size(jpeg-regs, ctx-
  cap_q.w,
  +   ctx

RE: [PATCH v2 2/2] [media] s5p-jpeg: Adding Exynos7 JPEG variant

2015-01-07 Thread Tony K Nadackal
Hi Jacek,

On  Wednesday, January 07, 2015 3:43 PM : Jacek Anaszewski wrote,

 Hi Tony,
 
 On 12/19/2014 08:38 AM, Tony K Nadackal wrote:
  Fimp_jpeg used in Exynos7 is a revised version. Some register
  configurations are slightly different from JPEG in Exynos4.
  Added one more variant SJPEG_EXYNOS7 to handle these differences.
 
  Signed-off-by: Tony K Nadackal tony...@samsung.com
  ---
.../bindings/media/exynos-jpeg-codec.txt   |  2 +-
drivers/media/platform/s5p-jpeg/jpeg-core.c| 61
++-
 ---
drivers/media/platform/s5p-jpeg/jpeg-core.h| 10 ++--
drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c  | 32 ++--
drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.h  |  8 +--
drivers/media/platform/s5p-jpeg/jpeg-regs.h| 17 --
6 files changed, 93 insertions(+), 37 deletions(-)
 
  diff --git
  a/Documentation/devicetree/bindings/media/exynos-jpeg-codec.txt
  b/Documentation/devicetree/bindings/media/exynos-jpeg-codec.txt
  index bf52ed4..cd19417 100644
  --- a/Documentation/devicetree/bindings/media/exynos-jpeg-codec.txt
  +++ b/Documentation/devicetree/bindings/media/exynos-jpeg-codec.txt
  @@ -4,7 +4,7 @@ Required properties:
 
- compatible  : should be one of:
samsung,s5pv210-jpeg, samsung,exynos4210-jpeg,
  - samsung,exynos3250-jpeg;
  + samsung,exynos3250-jpeg, samsung,exynos7-jpeg;
- reg : address and length of the JPEG codec IP register set;
- interrupts  : specifies the JPEG codec IP interrupt;
- clock-names   : should contain:
 
 This should be put in a separate patch.

Checkpatch gives warning if this change is not there.
If that is ok with you, I will make this change a separate patch. 

[snip]

 --
 Best Regards,
 Jacek Anaszewski

Thanks and Regards,
Tony

--
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/2] [media] s5p-jpeg: Fix modification sequence of interrupt enable register

2015-01-07 Thread Tony K Nadackal
Hi Jacek,

On Wednesday, January 07, 2015 3:38 PM Jacek Anaszewski wrote,

 Hi Tony,
 
 On 12/19/2014 08:37 AM, Tony K Nadackal wrote:
  Fix the bug in modifying the interrupt enable register.
 
 For Exynos4 this was not a bug as there are only five bit fields used in the
 EXYNOS4_INT_EN_REG - all of them enable related interrupt signal and
 EXYNOS4_INT_EN_ALL value is 0x1f which just sets these bit fields to 1.
 

I agree that it is not a bug. 
I added the register read before modifying it to avoid any potential bugs in the
future.

 If for Exynos7 there are other bit fields in this register and it has to be
read prior
 setting to find out current state then I'd parametrize this function with
version
 argument as you do it in the patch adding support for Exynos7, but for Exynos4
 case I'd left the behaviour as it is currenlty, i.e.
 avoid reading the register and do it only for Exynos7 case.

Directly writing the value EXYNOS4_INT_EN_ALL (0x1B6 in Exynos7) to
EXYNOS4_INT_EN_REG works in case of Exynos7 too.
I  will parametrize this function with version to take care of the Exynos7 bit
fields.

 Effectively, this patch is not required, as it doesn't fix anything but adds
 redundant call to readl.
 
  Signed-off-by: Tony K Nadackal tony...@samsung.com
  ---
drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c | 5 -
1 file changed, 4 insertions(+), 1 deletion(-)
 
  diff --git a/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c
  b/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c
  index e53f13a..a61ff7e 100644
  --- a/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c
  +++ b/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c
  @@ -155,7 +155,10 @@ void exynos4_jpeg_set_enc_out_fmt(void __iomem
  *base, unsigned int out_fmt)
 
void exynos4_jpeg_set_interrupt(void __iomem *base)
{
  -   writel(EXYNOS4_INT_EN_ALL, base + EXYNOS4_INT_EN_REG);
  +   unsigned int reg;
  +
  +   reg = readl(base + EXYNOS4_INT_EN_REG)  ~EXYNOS4_INT_EN_MASK;
  +   writel(reg | EXYNOS4_INT_EN_ALL, base + EXYNOS4_INT_EN_REG);
}
 
unsigned int exynos4_jpeg_get_int_status(void __iomem *base)
 
 
 
 --
 Best Regards,
 Jacek Anaszewski

Thanks and Regards,
Tony

--
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] [media] s5p-jpeg: Adding Exynos7 Jpeg variant support

2015-01-07 Thread Tony K Nadackal
Dear Jacek,

On Wednesday, January 07, 2015 3:15 PM Jacek Anaszewski wrote,

 Hi Tony,
 
 Sorry for late response, just got back from vacation.
 
 On 12/19/2014 04:37 AM, Tony K Nadackal wrote:
  Hi Jacek,
 
  On Wednesday, December 17, 2014 7:46 PM Jacek Anaszewski wrote,
  Hi Tony,
 
  Thanks for the patches.
 
 
  Thanks for the review.
 
  Please process them with scripts/checkpatch.pl as you will be
  submitting the
  next
  version - they contain many coding style related issues.
 
 
  I ran checkpatch before posting. Do you find any checkpatch related
  issues in the patch?
 
 There was a problem on my side, sorry for making confusion.
 
  My remaining comments below.
 
 
  [snip]
 
  + if (ctx-jpeg-variant-version == SJPEG_EXYNOS7) {
  + exynos4_jpeg_set_interrupt(jpeg-regs,
  SJPEG_EXYNOS7);
  + exynos4_jpeg_set_enc_out_fmt(jpeg-regs,
  + ctx-subsampling,
  EXYNOS7_ENC_FMT_MASK);
  + exynos4_jpeg_set_img_fmt(jpeg-regs,
  + ctx-out_q.fmt-fourcc,
  + EXYNOS7_SWAP_CHROMA_SHIFT);
  + } else {
  + exynos4_jpeg_set_interrupt(jpeg-regs,
  SJPEG_EXYNOS4);
  + exynos4_jpeg_set_enc_out_fmt(jpeg-regs,
  + ctx-subsampling,
  EXYNOS4_ENC_FMT_MASK);
  + exynos4_jpeg_set_img_fmt(jpeg-regs,
  + ctx-out_q.fmt-fourcc,
  + EXYNOS4_SWAP_CHROMA_SHIFT);
  + }
  +
 
  I'd implement it this way:
 
  exynos4_jpeg_set_interrupt(jpeg-regs, ctx-jpeg-variant-version);
  exynos4_jpeg_set_enc_out_fmt(jpeg-regs, ctx-subsampling,
 (ctx-jpeg-variant-version == SJPEG_EXYNOS4) ?
 EXYNOS4_ENC_FMT_MASK :
 EXYNOS7_ENC_FMT_MASK);
  exynos4_jpeg_set_img_fmt(jpeg-regs, ctx-out_q.fmt-fourcc,
 (ctx-jpeg-variant-version == SJPEG_EXYNOS4) ?
 EXYNOS4_SWAP_CHROMA_SHIFT :
 EXYNOS7_SWAP_CHROMA_SHIFT);
 
 
  OK. Looks goods to me. Thanks for the suggestion.
 
exynos4_jpeg_set_img_addr(ctx);
exynos4_jpeg_set_jpeg_addr(ctx);
exynos4_jpeg_set_encode_hoff_cnt(jpeg-regs,
 
ctx-out_q.fmt-fourcc);
} else {
exynos4_jpeg_sw_reset(jpeg-regs);
  - exynos4_jpeg_set_interrupt(jpeg-regs);
exynos4_jpeg_set_img_addr(ctx);
exynos4_jpeg_set_jpeg_addr(ctx);
  - exynos4_jpeg_set_img_fmt(jpeg-regs, ctx-cap_q.fmt-
  fourcc);
 
  - bitstream_size = DIV_ROUND_UP(ctx-out_q.size, 32);
  + if (ctx-jpeg-variant-version == SJPEG_EXYNOS7) {
  + exynos4_jpeg_set_interrupt(jpeg-regs,
  SJPEG_EXYNOS7);
  + exynos4_jpeg_set_huff_tbl(jpeg-regs);
  + exynos4_jpeg_set_huf_table_enable(jpeg-regs, 1);
  +
  + /*
  +  * JPEG IP allows storing 4 quantization tables
  +  * We fill table 0 for luma and table 1 for chroma
  +  */
  + exynos4_jpeg_set_qtbl_lum(jpeg-regs,
  + ctx-compr_quality);
  + exynos4_jpeg_set_qtbl_chr(jpeg-regs,
  + ctx-compr_quality);
 
  Is it really required to setup quantization tables for encoding?
 
 
  Without setting up the quantization tables, encoder is working fine.
  But, as per Exynos7 User Manual setting up the quantization tables are
  required for encoding also.
 

Sorry I also got it mixed up.
*Decoder* works fine without setting up the quantization tables. But this step
is mentioned in User Manual.

 Actually I intended to ask if setting the quantization tables is required for
 *decoding*, as you set it also in decoding path, whereas for Exynos4 it is not
 required. I looks strange for me as quantization tables are usually required
only
 for encoding raw images.
 The same is related to huffman tables.

Huffman table is required for Exynos7 decoding.
User Manual says about  Update_Huf_Tbl [bit 19 of PEG_CNTL], User/Host should
mandatory program this Bit as 1 for every decoder operation. SFR
HUFF_TBL_ENT and SFR HUFF_CNT should be programmed accordingly for every
encoder/decoder operation.

 
  + exynos4_jpeg_set_stream_size(jpeg-regs, ctx-
  cap_q.w,
  + ctx-cap_q.h);
 
  For exynos4 this function writes the number of samples per line and
  number lines of the resulting JPEG image and is used only during
  encoding. Is the semantics of the related register different in case of
Exynos7?
 
 
  Yes. In case of Exynos7 Encoding, This step is required.
 
 Ack.

I will request Kukjin or any Samsung colleagues who has access to Exynos7 Manual
to give ack

RE: [PATCH] [media] s5p-jpeg: Clear JPEG_CODEC_ON bits in sw reset function

2015-01-04 Thread Tony K Nadackal
Gentle Reminder.

Thanks
Tony

 -Original Message-
 From: Tony K Nadackal [mailto:tony...@samsung.com]
 Sent: Wednesday, December 17, 2014 11:52 AM
 To: linux-media@vger.kernel.org; linux-arm-ker...@lists.infradead.org; linux-
 samsung-...@vger.kernel.org
 Cc: mche...@osg.samsung.com; j.anaszew...@samsung.com;
 kg...@kernel.org; k.deb...@samsung.com; s.nawro...@samsung.com;
 bhusha...@samsung.com; Tony K Nadackal
 Subject: [PATCH] [media] s5p-jpeg: Clear JPEG_CODEC_ON bits in sw reset
 function
 
 Bits EXYNOS4_DEC_MODE and EXYNOS4_ENC_MODE do not get cleared on
 software reset. These bits need to be cleared explicitly.
 
 Signed-off-by: Tony K Nadackal tony...@samsung.com
 ---
 This patch is created and tested on top of linux-next-20141210.
 It can be cleanly applied on media-next and kgene/for-next.
 
 
  drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c | 4 
  1 file changed, 4 insertions(+)
 
 diff --git a/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c
 b/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c
 index ab6d6f43..e53f13a 100644
 --- a/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c
 +++ b/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c
 @@ -21,6 +21,10 @@ void exynos4_jpeg_sw_reset(void __iomem *base)
   unsigned int reg;
 
   reg = readl(base + EXYNOS4_JPEG_CNTL_REG);
 + writel(reg  ~(EXYNOS4_DEC_MODE | EXYNOS4_ENC_MODE),
 + base + EXYNOS4_JPEG_CNTL_REG);
 +
 + reg = readl(base + EXYNOS4_JPEG_CNTL_REG);
   writel(reg  ~EXYNOS4_SOFT_RESET_HI, base +
 EXYNOS4_JPEG_CNTL_REG);
 
   udelay(100);
 --
 2.2.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] [media] s5p-jpeg: Fix crash in jpeg isr due to multiple interrupts.

2015-01-04 Thread Tony K Nadackal
Gentle Reminder.

Thanks
Tony

 -Original Message-
 From: Tony K Nadackal [mailto:tony...@samsung.com]
 Sent: Wednesday, December 17, 2014 11:55 AM
 To: linux-media@vger.kernel.org; linux-arm-ker...@lists.infradead.org; linux-
 samsung-...@vger.kernel.org
 Cc: mche...@osg.samsung.com; j.anaszew...@samsung.com;
 kg...@kernel.org; k.deb...@samsung.com; s.nawro...@samsung.com;
 bhusha...@samsung.com; Tony K Nadackal
 Subject: [PATCH] [media] s5p-jpeg: Fix crash in jpeg isr due to multiple
interrupts.
 
 In case of corrupt images, multiple interrupts may occur due to different
error
 scenarios.
 
 Since we are removing the src and dest buffers in the first interrupt itself,
crash
 occurs in the second error interrupts.
 
 Disable the global interrupt before we start processing the interrupt avoid
the
 crash.
 
 Disable System interrupt in isr to avoid the crash below.
 
 Unable to handle kernel NULL pointer dereference at virtual address 00c8
 pgd = ffc0007db000 [00c8] *pgd=fb006003,
 *pud=fb006003, *pmd=fb007003, *pte=006011001707
 Internal error: Oops: 9607 [#1] PREEMPT SMP Modules linked in:
 CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.18.0-next-20141210+ #22 Hardware
 name: Samsung Exynos7 Espresso board based on EXYNOS7 (DT)
 task: ffc00075e5c0 ti: ffc00074c000 task.ti: ffc00074c000 PC is at
 exynos4_jpeg_irq+0x30/0x15c LR is at exynos4_jpeg_irq+0x2c/0x15c pc :
 [ffc00040873c] lr : [ffc000408738] pstate: 81c5 sp :
 ffc00074fc60
 x29: ffc00074fc60 x28: 00404000
 x27: ffc000673928 x26: ffc000673940
 x25: ffc0007a030c x24: ffc0bb20a400
 x23: 0030 x22: ffc0ba56ba40
 x21:  x20: 
 x19: ffc0ba56ba18 x18: 
 x17:  x16: ffc00018b508
 x15:  x14: 
 x13: 00989680 x12: 00989680
 x11: 0004 x10: 0101010101010101
 x9 : 0020a285a9ea x8 : ffc0007af880
 x7 : ffc0bac001a8 x6 : ffc0bac0
 x5 : fffa x4 : ffc00040870c
 x3 : 0003 x2 : 00010003
 x1 : 00010002 x0 : 
 
 Process swapper/0 (pid: 0, stack limit = 0xffc00074c058)
 Stack: (0xffc00074fc60 to 0xffc00075)
 fc60: 0074fca0 ffc0 000e4508 ffc0 bb225300 ffc0 bb20a494 ffc0
 fc80:     0030  000f8c6c ffc0
 fca0: 0074fd00 ffc0 000e4644 ffc0 bb20a400 ffc0 bb20a494 ffc0
 fcc0: 00776a00 ffc0 00670da8 ffc0   0001 
 fce0: bb008000 ffc0 407db000  00081230 ffc0 000e4638 ffc0
 fd00: 0074fd40 ffc0 000e7338 ffc0 bb20a400 ffc0 bb20a494 ffc0
 fd20: 00776a00 ffc0 000e7280 ffc0 bb225300 ffc0 000e72e0 ffc0
 fd40: 0074fd70 ffc0 000e3d60 ffc0 0030  00743000 ffc0
 fd60: 0066e000 ffc0 006c2000 ffc0 0074fd90 ffc0 000e3e90 ffc0
 fd80: 007437c8 ffc0 000e3e6c ffc0 0074fdf0 ffc0 00082404 ffc0
 fda0: 0074fe20 ffc0 0075a000 ffc0 200c ff80 2010 ff80
 fdc0: 6145  00672cc8 ffc0 407d9000  befb9b40 ffc0
 fde0: 0074fe20 ffc0 01d2  0074ff40 ffc0 00085da8 ffc0
 fe00: 00758584 ffc0 0052c000 ffc0 0074ff40 ffc0 00087114 ffc0
 fe20:   0074ff50 ffc0 0067d760 ffc0 befb9adc ffc0
 fe40: 0001  d4414200 0020 d6a39c00 0020 007a6a18 ffc0
 fe60: 0075eb00 ffc0 0074fd60 ffc0 c185  0020 
 fe80: 0052d340 ffc0 0030  fffe 0fff  
 fea0: 0018b508 ffc0     00758584 ffc0
 fec0: 0052c000 ffc0 006c24e8 ffc0 007a030a ffc0 0001 
 fee0: 00672cc8 ffc0 407d9000  407db000  00081230 ffc0
 ff00: 4000 0040 0074ff40 ffc0 00087110 ffc0 0074ff40 ffc0
 ff20: 00087114 ffc0 6145  00758584 ffc0 0052c000 ffc0
 ff40: 0074ff50 ffc0 000db568 ffc0 0074ff90 ffc0 00515fdc ffc0
 ff60: 00758000 ffc0 007a3000 ffc0 007a3000 ffc0 befc8940 ffc0
 ff80: 4076  4000  0074ffb0 ffc0 006ff998 ffc0
 ffa0: 0002  006ff988 ffc0   400826c0 
 ffc0: 8f03a688  0e11  4800  410fd030
 
 ffe0: 0072c250 ffc0      
 Call trace:
 [ffc00040873c] exynos4_jpeg_irq+0x30/0x15c [ffce4504]
 handle_irq_event_percpu+0x6c/0x160
 [ffce4640] handle_irq_event+0x48/0x78 [ffce7334]
 handle_fasteoi_irq+0xe0/0x198 [ffce3d5c]
 generic_handle_irq+0x24/0x40 [ffce3e8c]
 __handle_domain_irq+0x80/0xf0 [ffc82400] gic_handle_irq+0x30/0x80
 Exception stack

RE: [PATCH v2 0/2] Adding support for Exynos7 Jpeg variant

2015-01-04 Thread Tony K Nadackal
Gentle Reminder.

Thanks,
Tony

 -Original Message-
 From: Tony K Nadackal [mailto:tony...@samsung.com]
 Sent: Friday, December 19, 2014 1:08 PM
 To: linux-media@vger.kernel.org; linux-arm-ker...@lists.infradead.org; linux-
 samsung-...@vger.kernel.org; devicet...@vger.kernel.org
 Cc: mche...@osg.samsung.com; j.anaszew...@samsung.com;
 kg...@kernel.org; k.deb...@samsung.com; s.nawro...@samsung.com;
 robh...@kernel.org; mark.rutl...@arm.com; bhusha...@samsung.com; Tony K
 Nadackal
 Subject: [PATCH v2 0/2] Adding support for Exynos7 Jpeg variant
 
 This patch series adds support for Exynos7 JPEG variant, which is mostly same
as
 Exynos4 JPEG variants with few register configuration differences.
 At the same time it modifies #define based JPEG variant macros into enum.
 Patch 1/2 fixes possible bug in setting INT EN register, where
 EXYNOS4_INT_EN_REG was getting modified without reading before.
 
 Patch set v1 and related discussion can be found here [1].
 
 [1]: http://www.spinics.net/lists/linux-samsung-soc/msg40308.html
 
 Changes since v1:
  - Added new patch 1/2 which fixes issues in writing EXYNOS4_INT_EN_REG.
  - Converted JPEG variant macros into enum as suggested by Jacek Anaszewski.
 
 
 Tony K Nadackal (2):
   [media] s5p-jpeg: Fix modification sequence of interrupt enable
 register
   [media] s5p-jpeg: Adding Exynos7 Jpeg variant
 
  .../bindings/media/exynos-jpeg-codec.txt   |  2 +-
  drivers/media/platform/s5p-jpeg/jpeg-core.c| 61 ++---
 -
  drivers/media/platform/s5p-jpeg/jpeg-core.h| 10 ++--
  drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c  | 33 +++-
 drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.h  |  8 +--
  drivers/media/platform/s5p-jpeg/jpeg-regs.h| 17 --
  6 files changed, 95 insertions(+), 36 deletions(-)
 
 --
 2.2.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] [media] s5p-jpeg: Initialize cb and cr to zero.

2015-01-04 Thread Tony K Nadackal
Gentle Reminder.

Thanks,
Tony

 -Original Message-
 From: Tony K Nadackal [mailto:tony...@samsung.com]
 Sent: Wednesday, December 17, 2014 12:51 PM
 To: linux-media@vger.kernel.org; linux-arm-ker...@lists.infradead.org; linux-
 samsung-...@vger.kernel.org
 Cc: mche...@osg.samsung.com; j.anaszew...@samsung.com;
 kg...@kernel.org; k.deb...@samsung.com; s.nawro...@samsung.com;
 bhusha...@samsung.com; Tony K Nadackal
 Subject: [PATCH] [media] s5p-jpeg: Initialize cb and cr to zero.
 
 To avoid garbage value written into image base address planes, initialize cb
and cr
 of structure s5p_jpeg_addr to zero.
 
 Signed-off-by: Tony K Nadackal tony...@samsung.com
 ---
 This patch is created and tested on top of linux-next-20141210.
 It can be cleanly applied on media-next and kgene/for-next.
 
  drivers/media/platform/s5p-jpeg/jpeg-core.c | 3 +++
  1 file changed, 3 insertions(+)
 
 diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c
 b/drivers/media/platform/s5p-jpeg/jpeg-core.c
 index 91bd3e6..54fa5d9 100644
 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
 +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
 @@ -1845,6 +1845,9 @@ static void exynos4_jpeg_set_img_addr(struct
 s5p_jpeg_ctx *ctx)
   struct s5p_jpeg_addr jpeg_addr;
   u32 pix_size, padding_bytes = 0;
 
 + jpeg_addr.cb = 0;
 + jpeg_addr.cr = 0;
 +
   pix_size = ctx-cap_q.w * ctx-cap_q.h;
 
   if (ctx-mode == S5P_JPEG_ENCODE) {
 --
 2.2.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] [media] s5p-jpeg: Adding Exynos7 Jpeg variant support

2014-12-18 Thread Tony K Nadackal
Hi Jacek,

On Wednesday, December 17, 2014 7:46 PM Jacek Anaszewski wrote,
 Hi Tony,
 
 Thanks for the patches.
 

Thanks for the review.

 Please process them with scripts/checkpatch.pl as you will be submitting the
next
 version - they contain many coding style related issues.
 

I ran checkpatch before posting. Do you find any checkpatch related issues in
the patch?

 My remaining comments below.
 

[snip]

  +   if (ctx-jpeg-variant-version == SJPEG_EXYNOS7) {
  +   exynos4_jpeg_set_interrupt(jpeg-regs,
 SJPEG_EXYNOS7);
  +   exynos4_jpeg_set_enc_out_fmt(jpeg-regs,
  +   ctx-subsampling,
 EXYNOS7_ENC_FMT_MASK);
  +   exynos4_jpeg_set_img_fmt(jpeg-regs,
  +   ctx-out_q.fmt-fourcc,
  +   EXYNOS7_SWAP_CHROMA_SHIFT);
  +   } else {
  +   exynos4_jpeg_set_interrupt(jpeg-regs,
 SJPEG_EXYNOS4);
  +   exynos4_jpeg_set_enc_out_fmt(jpeg-regs,
  +   ctx-subsampling,
 EXYNOS4_ENC_FMT_MASK);
  +   exynos4_jpeg_set_img_fmt(jpeg-regs,
  +   ctx-out_q.fmt-fourcc,
  +   EXYNOS4_SWAP_CHROMA_SHIFT);
  +   }
  +
 
 I'd implement it this way:
 
 exynos4_jpeg_set_interrupt(jpeg-regs, ctx-jpeg-variant-version);
 exynos4_jpeg_set_enc_out_fmt(jpeg-regs, ctx-subsampling,
   (ctx-jpeg-variant-version == SJPEG_EXYNOS4) ?
   EXYNOS4_ENC_FMT_MASK :
   EXYNOS7_ENC_FMT_MASK);
 exynos4_jpeg_set_img_fmt(jpeg-regs, ctx-out_q.fmt-fourcc,
   (ctx-jpeg-variant-version == SJPEG_EXYNOS4) ?
   EXYNOS4_SWAP_CHROMA_SHIFT :
   EXYNOS7_SWAP_CHROMA_SHIFT);
 

OK. Looks goods to me. Thanks for the suggestion.

  exynos4_jpeg_set_img_addr(ctx);
  exynos4_jpeg_set_jpeg_addr(ctx);
  exynos4_jpeg_set_encode_hoff_cnt(jpeg-regs,
  ctx-out_q.fmt-fourcc);
  } else {
  exynos4_jpeg_sw_reset(jpeg-regs);
  -   exynos4_jpeg_set_interrupt(jpeg-regs);
  exynos4_jpeg_set_img_addr(ctx);
  exynos4_jpeg_set_jpeg_addr(ctx);
  -   exynos4_jpeg_set_img_fmt(jpeg-regs, ctx-cap_q.fmt-
 fourcc);
 
  -   bitstream_size = DIV_ROUND_UP(ctx-out_q.size, 32);
  +   if (ctx-jpeg-variant-version == SJPEG_EXYNOS7) {
  +   exynos4_jpeg_set_interrupt(jpeg-regs,
 SJPEG_EXYNOS7);
  +   exynos4_jpeg_set_huff_tbl(jpeg-regs);
  +   exynos4_jpeg_set_huf_table_enable(jpeg-regs, 1);
  +
  +   /*
  +* JPEG IP allows storing 4 quantization tables
  +* We fill table 0 for luma and table 1 for chroma
  +*/
  +   exynos4_jpeg_set_qtbl_lum(jpeg-regs,
  +   ctx-compr_quality);
  +   exynos4_jpeg_set_qtbl_chr(jpeg-regs,
  +   ctx-compr_quality);
 
 Is it really required to setup quantization tables for encoding?
 

Without setting up the quantization tables, encoder is working fine.
But, as per Exynos7 User Manual setting up the quantization tables are required
for encoding also.

  +   exynos4_jpeg_set_stream_size(jpeg-regs, ctx-
 cap_q.w,
  +   ctx-cap_q.h);
 
 For exynos4 this function writes the number of samples per line and number
 lines of the resulting JPEG image and is used only during encoding. Is the
 semantics of the related register different in case of Exynos7?
 

Yes. In case of Exynos7 Encoding, This step is required.

[snip]

  --- a/drivers/media/platform/s5p-jpeg/jpeg-core.h
  +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.h
  @@ -71,6 +71,7 @@
#define SJPEG_S5P 1
#define SJPEG_EXYNOS3250  2
#define SJPEG_EXYNOS4 3
  +#define SJPEG_EXYNOS7  4
 
 As you adding a new variant I propose to turn these macros into enum.
 

Ok. I will make this change in my next version.

[snip]

  -void exynos4_jpeg_set_interrupt(void __iomem *base)
  +void exynos4_jpeg_set_interrupt(void __iomem *base, unsigned int
  +version)
{
  -   writel(EXYNOS4_INT_EN_ALL, base + EXYNOS4_INT_EN_REG);
  +   unsigned int reg;
  +
  +   reg = readl(base + EXYNOS4_INT_EN_REG) 
 ~EXYNOS4_INT_EN_MASK(version);
  +   writel(EXYNOS4_INT_EN_ALL(version), base + EXYNOS4_INT_EN_REG);
}
 
 I believe that adding readl is a fix. I'd enclose it into separate patch and
explain its
 merit.
 

Thanks for the suggestion.  I will make a separate patch for this bug fix.

[snip]

 
 --
 Best Regards,
 Jacek Anaszewski

Thanks,
Tony K Nadackal

--
To unsubscribe from this list

[PATCH v2 2/2] [media] s5p-jpeg: Adding Exynos7 JPEG variant

2014-12-18 Thread Tony K Nadackal
Fimp_jpeg used in Exynos7 is a revised version. Some register
configurations are slightly different from JPEG in Exynos4.
Added one more variant SJPEG_EXYNOS7 to handle these differences.

Signed-off-by: Tony K Nadackal tony...@samsung.com
---
 .../bindings/media/exynos-jpeg-codec.txt   |  2 +-
 drivers/media/platform/s5p-jpeg/jpeg-core.c| 61 ++
 drivers/media/platform/s5p-jpeg/jpeg-core.h| 10 ++--
 drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c  | 32 ++--
 drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.h  |  8 +--
 drivers/media/platform/s5p-jpeg/jpeg-regs.h| 17 --
 6 files changed, 93 insertions(+), 37 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/exynos-jpeg-codec.txt 
b/Documentation/devicetree/bindings/media/exynos-jpeg-codec.txt
index bf52ed4..cd19417 100644
--- a/Documentation/devicetree/bindings/media/exynos-jpeg-codec.txt
+++ b/Documentation/devicetree/bindings/media/exynos-jpeg-codec.txt
@@ -4,7 +4,7 @@ Required properties:
 
 - compatible   : should be one of:
  samsung,s5pv210-jpeg, samsung,exynos4210-jpeg,
- samsung,exynos3250-jpeg;
+ samsung,exynos3250-jpeg, samsung,exynos7-jpeg;
 - reg  : address and length of the JPEG codec IP register set;
 - interrupts   : specifies the JPEG codec IP interrupt;
 - clock-names   : should contain:
diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c 
b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index 54fa5d9..204013e 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -1225,8 +1225,9 @@ static int s5p_jpeg_try_fmt_vid_cap(struct file *file, 
void *priv,
return -EINVAL;
}
 
-   if ((ctx-jpeg-variant-version != SJPEG_EXYNOS4) ||
-   (ctx-mode != S5P_JPEG_DECODE))
+   if (((ctx-jpeg-variant-version != SJPEG_EXYNOS4) 
+   (ctx-jpeg-variant-version != SJPEG_EXYNOS7)) ||
+   (ctx-mode != S5P_JPEG_DECODE))
goto exit;
 
/*
@@ -1349,7 +1350,8 @@ static int s5p_jpeg_s_fmt(struct s5p_jpeg_ctx *ct, struct 
v4l2_format *f)
 * the JPEG_IMAGE_SIZE register. In order to avoid sysmmu
 * page fault calculate proper buffer size in such a case.
 */
-   if (ct-jpeg-variant-version == SJPEG_EXYNOS4 
+   if (((ct-jpeg-variant-version == SJPEG_EXYNOS4) ||
+   (ct-jpeg-variant-version == SJPEG_EXYNOS7)) 
f_type == FMT_TYPE_OUTPUT  ct-mode == S5P_JPEG_ENCODE)
q_data-size = exynos4_jpeg_get_output_buffer_size(ct,
f,
@@ -1901,7 +1903,8 @@ static void exynos4_jpeg_device_run(void *priv)
 
if (ctx-mode == S5P_JPEG_ENCODE) {
exynos4_jpeg_sw_reset(jpeg-regs);
-   exynos4_jpeg_set_interrupt(jpeg-regs);
+   exynos4_jpeg_set_interrupt(jpeg-regs,
+   ctx-jpeg-variant-version);
exynos4_jpeg_set_huf_table_enable(jpeg-regs, 1);
 
exynos4_jpeg_set_huff_tbl(jpeg-regs);
@@ -1918,20 +1921,50 @@ static void exynos4_jpeg_device_run(void *priv)
exynos4_jpeg_set_stream_size(jpeg-regs, ctx-cap_q.w,
ctx-cap_q.h);
 
-   exynos4_jpeg_set_enc_out_fmt(jpeg-regs, ctx-subsampling);
-   exynos4_jpeg_set_img_fmt(jpeg-regs, ctx-out_q.fmt-fourcc);
+   exynos4_jpeg_set_enc_out_fmt(jpeg-regs, ctx-subsampling,
+   (ctx-jpeg-variant-version == SJPEG_EXYNOS4) ?
+   EXYNOS4_ENC_FMT_MASK :
+   EXYNOS7_ENC_FMT_MASK);
+   exynos4_jpeg_set_img_fmt(jpeg-regs, ctx-out_q.fmt-fourcc,
+   (ctx-jpeg-variant-version == SJPEG_EXYNOS4) ?
+   EXYNOS4_SWAP_CHROMA_SHIFT :
+   EXYNOS7_SWAP_CHROMA_SHIFT);
exynos4_jpeg_set_img_addr(ctx);
exynos4_jpeg_set_jpeg_addr(ctx);
exynos4_jpeg_set_encode_hoff_cnt(jpeg-regs,
ctx-out_q.fmt-fourcc);
} else {
exynos4_jpeg_sw_reset(jpeg-regs);
-   exynos4_jpeg_set_interrupt(jpeg-regs);
+   exynos4_jpeg_set_interrupt(jpeg-regs,
+   ctx-jpeg-variant-version);
exynos4_jpeg_set_img_addr(ctx);
exynos4_jpeg_set_jpeg_addr(ctx);
-   exynos4_jpeg_set_img_fmt(jpeg-regs, ctx-cap_q.fmt-fourcc);
 
-   bitstream_size = DIV_ROUND_UP(ctx-out_q.size, 32);
+   if (ctx-jpeg-variant-version == SJPEG_EXYNOS7

[PATCH v2 1/2] [media] s5p-jpeg: Fix modification sequence of interrupt enable register

2014-12-18 Thread Tony K Nadackal
Fix the bug in modifying the interrupt enable register.

Signed-off-by: Tony K Nadackal tony...@samsung.com
---
 drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c 
b/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c
index e53f13a..a61ff7e 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c
@@ -155,7 +155,10 @@ void exynos4_jpeg_set_enc_out_fmt(void __iomem *base, 
unsigned int out_fmt)
 
 void exynos4_jpeg_set_interrupt(void __iomem *base)
 {
-   writel(EXYNOS4_INT_EN_ALL, base + EXYNOS4_INT_EN_REG);
+   unsigned int reg;
+
+   reg = readl(base + EXYNOS4_INT_EN_REG)  ~EXYNOS4_INT_EN_MASK;
+   writel(reg | EXYNOS4_INT_EN_ALL, base + EXYNOS4_INT_EN_REG);
 }
 
 unsigned int exynos4_jpeg_get_int_status(void __iomem *base)
-- 
2.2.0

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


[PATCH v2 0/2] Adding support for Exynos7 Jpeg variant

2014-12-18 Thread Tony K Nadackal
This patch series adds support for Exynos7 JPEG variant, which is mostly
same as Exynos4 JPEG variants with few register configuration differences.
At the same time it modifies #define based JPEG variant macros into enum.
Patch 1/2 fixes possible bug in setting INT EN register,
where EXYNOS4_INT_EN_REG was getting modified without reading before.

Patch set v1 and related discussion can be found here [1].

[1]: http://www.spinics.net/lists/linux-samsung-soc/msg40308.html

Changes since v1:
 - Added new patch 1/2 which fixes issues in writing EXYNOS4_INT_EN_REG.
 - Converted JPEG variant macros into enum as suggested by Jacek Anaszewski.


Tony K Nadackal (2):
  [media] s5p-jpeg: Fix modification sequence of interrupt enable
register
  [media] s5p-jpeg: Adding Exynos7 Jpeg variant

 .../bindings/media/exynos-jpeg-codec.txt   |  2 +-
 drivers/media/platform/s5p-jpeg/jpeg-core.c| 61 ++
 drivers/media/platform/s5p-jpeg/jpeg-core.h| 10 ++--
 drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c  | 33 +++-
 drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.h  |  8 +--
 drivers/media/platform/s5p-jpeg/jpeg-regs.h| 17 --
 6 files changed, 95 insertions(+), 36 deletions(-)

-- 
2.2.0

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


[PATCH] [media] s5p-jpeg: Clear JPEG_CODEC_ON bits in sw reset function

2014-12-16 Thread Tony K Nadackal
Bits EXYNOS4_DEC_MODE and EXYNOS4_ENC_MODE do not get cleared
on software reset. These bits need to be cleared explicitly.

Signed-off-by: Tony K Nadackal tony...@samsung.com
---
This patch is created and tested on top of linux-next-20141210.
It can be cleanly applied on media-next and kgene/for-next.


 drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c 
b/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c
index ab6d6f43..e53f13a 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c
@@ -21,6 +21,10 @@ void exynos4_jpeg_sw_reset(void __iomem *base)
unsigned int reg;
 
reg = readl(base + EXYNOS4_JPEG_CNTL_REG);
+   writel(reg  ~(EXYNOS4_DEC_MODE | EXYNOS4_ENC_MODE),
+   base + EXYNOS4_JPEG_CNTL_REG);
+
+   reg = readl(base + EXYNOS4_JPEG_CNTL_REG);
writel(reg  ~EXYNOS4_SOFT_RESET_HI, base + EXYNOS4_JPEG_CNTL_REG);
 
udelay(100);
-- 
2.2.0

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


[PATCH] [media] s5p-jpeg: Fix crash in jpeg isr due to multiple interrupts.

2014-12-16 Thread Tony K Nadackal
: 00672cc8 ffc0 407d9000  407db000  00081230 ffc0
ff00: 4000 0040 0074ff40 ffc0 00087110 ffc0 0074ff40 ffc0
[ffc85da4] el1_irq+0x64/0xd8
[ffcdb564] cpu_startup_entry+0x118/0x168
[ffc000515fd8] rest_init+0x7c/0x88
[ffc0006ff994] start_kernel+0x3a8/0x3bc
Code: 94045c34 f9406e60 97ffdc74 aa0003f4 (f9406400)
---[ end trace fa6dc0ea2efad21f ]---
Kernel panic - not syncing: Fatal exception in interrupt
---[ end Kernel panic - not syncing: Fatal exception in interrupt

Signed-off-by: Tony K Nadackal tony...@samsung.com
---
This patch is created and tested on top of linux-next-20141210.
It can be cleanly applied on media-next and kgene/for-next.

 drivers/media/platform/s5p-jpeg/jpeg-core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c 
b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index 12f7452..91bd3e6 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -1933,6 +1933,7 @@ static void exynos4_jpeg_device_run(void *priv)
exynos4_jpeg_set_dec_bitstream_size(jpeg-regs, bitstream_size);
}
 
+   exynos4_jpeg_set_sys_int_enable(jpeg-regs, 1);
exynos4_jpeg_set_enc_dec_mode(jpeg-regs, ctx-mode);
 
spin_unlock_irqrestore(ctx-jpeg-slock, flags);
@@ -2313,6 +2314,8 @@ static irqreturn_t exynos4_jpeg_irq(int irq, void *priv)
 
spin_lock(jpeg-slock);
 
+   exynos4_jpeg_set_sys_int_enable(jpeg-regs, 0);
+
curr_ctx = v4l2_m2m_get_curr_priv(jpeg-m2m_dev);
 
src_vb = v4l2_m2m_src_buf_remove(curr_ctx-fh.m2m_ctx);
-- 
2.2.0

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


[PATCH] [media] s5p-jpeg: Initialize cb and cr to zero.

2014-12-16 Thread Tony K Nadackal
To avoid garbage value written into image base address planes,
initialize cb and cr of structure s5p_jpeg_addr to zero.

Signed-off-by: Tony K Nadackal tony...@samsung.com
---
This patch is created and tested on top of linux-next-20141210.
It can be cleanly applied on media-next and kgene/for-next.

 drivers/media/platform/s5p-jpeg/jpeg-core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c 
b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index 91bd3e6..54fa5d9 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -1845,6 +1845,9 @@ static void exynos4_jpeg_set_img_addr(struct s5p_jpeg_ctx 
*ctx)
struct s5p_jpeg_addr jpeg_addr;
u32 pix_size, padding_bytes = 0;
 
+   jpeg_addr.cb = 0;
+   jpeg_addr.cr = 0;
+
pix_size = ctx-cap_q.w * ctx-cap_q.h;
 
if (ctx-mode == S5P_JPEG_ENCODE) {
-- 
2.2.0

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


[PATCH] [media] s5p-jpeg: Adding Exynos7 Jpeg variant support

2014-12-16 Thread Tony K Nadackal
Fimp_jpeg used in Exynos7 is a revised version. Some register
configurations are slightly different from Jpeg in Exynos4.
Added one more variant SJPEG_EXYNOS7 to handle these differences.

Signed-off-by: Tony K Nadackal tony...@samsung.com
---
This patch is created and tested on top of linux-next-20141210.
It can be cleanly applied on media-next and kgene/for-next.

 .../bindings/media/exynos-jpeg-codec.txt   |  2 +-
 drivers/media/platform/s5p-jpeg/jpeg-core.c| 69 +++---
 drivers/media/platform/s5p-jpeg/jpeg-core.h|  1 +
 drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c  | 33 ++-
 drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.h  |  8 ++-
 drivers/media/platform/s5p-jpeg/jpeg-regs.h| 17 --
 6 files changed, 98 insertions(+), 32 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/exynos-jpeg-codec.txt 
b/Documentation/devicetree/bindings/media/exynos-jpeg-codec.txt
index bf52ed4..cd19417 100644
--- a/Documentation/devicetree/bindings/media/exynos-jpeg-codec.txt
+++ b/Documentation/devicetree/bindings/media/exynos-jpeg-codec.txt
@@ -4,7 +4,7 @@ Required properties:
 
 - compatible   : should be one of:
  samsung,s5pv210-jpeg, samsung,exynos4210-jpeg,
- samsung,exynos3250-jpeg;
+ samsung,exynos3250-jpeg, samsung,exynos7-jpeg;
 - reg  : address and length of the JPEG codec IP register set;
 - interrupts   : specifies the JPEG codec IP interrupt;
 - clock-names   : should contain:
diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c 
b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index 54fa5d9..ad42a4e 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -1225,8 +1225,9 @@ static int s5p_jpeg_try_fmt_vid_cap(struct file *file, 
void *priv,
return -EINVAL;
}
 
-   if ((ctx-jpeg-variant-version != SJPEG_EXYNOS4) ||
-   (ctx-mode != S5P_JPEG_DECODE))
+   if (((ctx-jpeg-variant-version != SJPEG_EXYNOS4) 
+   (ctx-jpeg-variant-version != SJPEG_EXYNOS7)) ||
+   (ctx-mode != S5P_JPEG_DECODE))
goto exit;
 
/*
@@ -1349,7 +1350,8 @@ static int s5p_jpeg_s_fmt(struct s5p_jpeg_ctx *ct, struct 
v4l2_format *f)
 * the JPEG_IMAGE_SIZE register. In order to avoid sysmmu
 * page fault calculate proper buffer size in such a case.
 */
-   if (ct-jpeg-variant-version == SJPEG_EXYNOS4 
+   if (((ct-jpeg-variant-version == SJPEG_EXYNOS4) ||
+   (ct-jpeg-variant-version == SJPEG_EXYNOS7)) 
f_type == FMT_TYPE_OUTPUT  ct-mode == S5P_JPEG_ENCODE)
q_data-size = exynos4_jpeg_get_output_buffer_size(ct,
f,
@@ -1901,7 +1903,6 @@ static void exynos4_jpeg_device_run(void *priv)
 
if (ctx-mode == S5P_JPEG_ENCODE) {
exynos4_jpeg_sw_reset(jpeg-regs);
-   exynos4_jpeg_set_interrupt(jpeg-regs);
exynos4_jpeg_set_huf_table_enable(jpeg-regs, 1);
 
exynos4_jpeg_set_huff_tbl(jpeg-regs);
@@ -1918,20 +1919,60 @@ static void exynos4_jpeg_device_run(void *priv)
exynos4_jpeg_set_stream_size(jpeg-regs, ctx-cap_q.w,
ctx-cap_q.h);
 
-   exynos4_jpeg_set_enc_out_fmt(jpeg-regs, ctx-subsampling);
-   exynos4_jpeg_set_img_fmt(jpeg-regs, ctx-out_q.fmt-fourcc);
+   if (ctx-jpeg-variant-version == SJPEG_EXYNOS7) {
+   exynos4_jpeg_set_interrupt(jpeg-regs, SJPEG_EXYNOS7);
+   exynos4_jpeg_set_enc_out_fmt(jpeg-regs,
+   ctx-subsampling, EXYNOS7_ENC_FMT_MASK);
+   exynos4_jpeg_set_img_fmt(jpeg-regs,
+   ctx-out_q.fmt-fourcc,
+   EXYNOS7_SWAP_CHROMA_SHIFT);
+   } else {
+   exynos4_jpeg_set_interrupt(jpeg-regs, SJPEG_EXYNOS4);
+   exynos4_jpeg_set_enc_out_fmt(jpeg-regs,
+   ctx-subsampling, EXYNOS4_ENC_FMT_MASK);
+   exynos4_jpeg_set_img_fmt(jpeg-regs,
+   ctx-out_q.fmt-fourcc,
+   EXYNOS4_SWAP_CHROMA_SHIFT);
+   }
+
exynos4_jpeg_set_img_addr(ctx);
exynos4_jpeg_set_jpeg_addr(ctx);
exynos4_jpeg_set_encode_hoff_cnt(jpeg-regs,
ctx-out_q.fmt-fourcc);
} else {
exynos4_jpeg_sw_reset(jpeg-regs);
-   exynos4_jpeg_set_interrupt(jpeg-regs);
exynos4_jpeg_set_img_addr(ctx);
exynos4_jpeg_set_jpeg_addr(ctx