aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-07-06 08:07:33 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-08-11 14:58:41 -0400
commit7bec7ef8604d0cd4da2e297279d94546fe2efa2e (patch)
tree7dcb9a781967ca04fce4cdc64db91a1cc4c2fe6d /drivers/media/video
parent6f1dd566fd80c7be597ba541922e0dd570fbc2f4 (diff)
[media] omap3isp: preview: Reorder configuration functions
Reorder the configuration and enable functions to match the parameters order. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/omap3isp/isppreview.c452
1 files changed, 226 insertions, 226 deletions
diff --git a/drivers/media/video/omap3isp/isppreview.c b/drivers/media/video/omap3isp/isppreview.c
index b22a549d4a91..9a8628417b50 100644
--- a/drivers/media/video/omap3isp/isppreview.c
+++ b/drivers/media/video/omap3isp/isppreview.c
@@ -157,64 +157,53 @@ static u32 luma_enhance_table[] = {
157}; 157};
158 158
159/* 159/*
160 * preview_enable_invalaw - Enable/disable Inverse A-Law decompression 160 * preview_config_luma_enhancement - Configure the Luminance Enhancement table
161 */
162static void preview_enable_invalaw(struct isp_prev_device *prev, bool enable)
163{
164 struct isp_device *isp = to_isp_device(prev);
165
166 if (enable)
167 isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
168 ISPPRV_PCR_WIDTH | ISPPRV_PCR_INVALAW);
169 else
170 isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
171 ISPPRV_PCR_WIDTH | ISPPRV_PCR_INVALAW);
172}
173
174/*
175 * preview_enable_drkframe_capture - Enable/disable Dark Frame Capture
176 */ 161 */
177static void 162static void
178preview_enable_drkframe_capture(struct isp_prev_device *prev, bool enable) 163preview_config_luma_enhancement(struct isp_prev_device *prev,
164 const struct prev_params *params)
179{ 165{
180 struct isp_device *isp = to_isp_device(prev); 166 struct isp_device *isp = to_isp_device(prev);
167 const struct omap3isp_prev_luma *yt = &params->luma;
168 unsigned int i;
181 169
182 if (enable) 170 isp_reg_writel(isp, ISPPRV_YENH_TABLE_ADDR,
183 isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, 171 OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
184 ISPPRV_PCR_DRKFCAP); 172 for (i = 0; i < OMAP3ISP_PREV_YENH_TBL_SIZE; i++) {
185 else 173 isp_reg_writel(isp, yt->table[i],
186 isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, 174 OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_DATA);
187 ISPPRV_PCR_DRKFCAP); 175 }
188} 176}
189 177
190/* 178/*
191 * preview_enable_drkframe - Enable/disable Dark Frame Subtraction 179 * preview_enable_luma_enhancement - Enable/disable Luminance Enhancement
192 */ 180 */
193static void preview_enable_drkframe(struct isp_prev_device *prev, bool enable) 181static void
182preview_enable_luma_enhancement(struct isp_prev_device *prev, bool enable)
194{ 183{
195 struct isp_device *isp = to_isp_device(prev); 184 struct isp_device *isp = to_isp_device(prev);
196 185
197 if (enable) 186 if (enable)
198 isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, 187 isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
199 ISPPRV_PCR_DRKFEN); 188 ISPPRV_PCR_YNENHEN);
200 else 189 else
201 isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, 190 isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
202 ISPPRV_PCR_DRKFEN); 191 ISPPRV_PCR_YNENHEN);
203} 192}
204 193
205/* 194/*
206 * preview_enable_hmed - Enable/disable the Horizontal Median Filter 195 * preview_enable_invalaw - Enable/disable Inverse A-Law decompression
207 */ 196 */
208static void preview_enable_hmed(struct isp_prev_device *prev, bool enable) 197static void preview_enable_invalaw(struct isp_prev_device *prev, bool enable)
209{ 198{
210 struct isp_device *isp = to_isp_device(prev); 199 struct isp_device *isp = to_isp_device(prev);
211 200
212 if (enable) 201 if (enable)
213 isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, 202 isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
214 ISPPRV_PCR_HMEDEN); 203 ISPPRV_PCR_WIDTH | ISPPRV_PCR_INVALAW);
215 else 204 else
216 isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, 205 isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
217 ISPPRV_PCR_HMEDEN); 206 ISPPRV_PCR_WIDTH | ISPPRV_PCR_INVALAW);
218} 207}
219 208
220/* 209/*
@@ -233,46 +222,18 @@ static void preview_config_hmed(struct isp_prev_device *prev,
233} 222}
234 223
235/* 224/*
236 * preview_config_noisefilter - Configure the Noise Filter 225 * preview_enable_hmed - Enable/disable the Horizontal Median Filter
237 */
238static void
239preview_config_noisefilter(struct isp_prev_device *prev,
240 const struct prev_params *params)
241{
242 struct isp_device *isp = to_isp_device(prev);
243 const struct omap3isp_prev_nf *nf = &params->nf;
244 unsigned int i;
245
246 isp_reg_writel(isp, nf->spread, OMAP3_ISP_IOMEM_PREV, ISPPRV_NF);
247 isp_reg_writel(isp, ISPPRV_NF_TABLE_ADDR,
248 OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
249 for (i = 0; i < OMAP3ISP_PREV_NF_TBL_SIZE; i++) {
250 isp_reg_writel(isp, nf->table[i],
251 OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_DATA);
252 }
253}
254
255/*
256 * preview_config_dcor - Configure Couplet Defect Correction
257 */ 226 */
258static void 227static void preview_enable_hmed(struct isp_prev_device *prev, bool enable)
259preview_config_dcor(struct isp_prev_device *prev,
260 const struct prev_params *params)
261{ 228{
262 struct isp_device *isp = to_isp_device(prev); 229 struct isp_device *isp = to_isp_device(prev);
263 const struct omap3isp_prev_dcor *dcor = &params->dcor;
264 230
265 isp_reg_writel(isp, dcor->detect_correct[0], 231 if (enable)
266 OMAP3_ISP_IOMEM_PREV, ISPPRV_CDC_THR0); 232 isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
267 isp_reg_writel(isp, dcor->detect_correct[1], 233 ISPPRV_PCR_HMEDEN);
268 OMAP3_ISP_IOMEM_PREV, ISPPRV_CDC_THR1); 234 else
269 isp_reg_writel(isp, dcor->detect_correct[2], 235 isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
270 OMAP3_ISP_IOMEM_PREV, ISPPRV_CDC_THR2); 236 ISPPRV_PCR_HMEDEN);
271 isp_reg_writel(isp, dcor->detect_correct[3],
272 OMAP3_ISP_IOMEM_PREV, ISPPRV_CDC_THR3);
273 isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
274 ISPPRV_PCR_DCCOUP,
275 dcor->couplet_mode_en ? ISPPRV_PCR_DCCOUP : 0);
276} 237}
277 238
278/* 239/*
@@ -305,55 +266,6 @@ preview_config_cfa(struct isp_prev_device *prev,
305} 266}
306 267
307/* 268/*
308 * preview_config_gammacorrn - Configure the Gamma Correction tables
309 */
310static void
311preview_config_gammacorrn(struct isp_prev_device *prev,
312 const struct prev_params *params)
313{
314 struct isp_device *isp = to_isp_device(prev);
315 const struct omap3isp_prev_gtables *gt = &params->gamma;
316 unsigned int i;
317
318 isp_reg_writel(isp, ISPPRV_REDGAMMA_TABLE_ADDR,
319 OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
320 for (i = 0; i < OMAP3ISP_PREV_GAMMA_TBL_SIZE; i++)
321 isp_reg_writel(isp, gt->red[i], OMAP3_ISP_IOMEM_PREV,
322 ISPPRV_SET_TBL_DATA);
323
324 isp_reg_writel(isp, ISPPRV_GREENGAMMA_TABLE_ADDR,
325 OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
326 for (i = 0; i < OMAP3ISP_PREV_GAMMA_TBL_SIZE; i++)
327 isp_reg_writel(isp, gt->green[i], OMAP3_ISP_IOMEM_PREV,
328 ISPPRV_SET_TBL_DATA);
329
330 isp_reg_writel(isp, ISPPRV_BLUEGAMMA_TABLE_ADDR,
331 OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
332 for (i = 0; i < OMAP3ISP_PREV_GAMMA_TBL_SIZE; i++)
333 isp_reg_writel(isp, gt->blue[i], OMAP3_ISP_IOMEM_PREV,
334 ISPPRV_SET_TBL_DATA);
335}
336
337/*
338 * preview_config_luma_enhancement - Configure the Luminance Enhancement table
339 */
340static void
341preview_config_luma_enhancement(struct isp_prev_device *prev,
342 const struct prev_params *params)
343{
344 struct isp_device *isp = to_isp_device(prev);
345 const struct omap3isp_prev_luma *yt = &params->luma;
346 unsigned int i;
347
348 isp_reg_writel(isp, ISPPRV_YENH_TABLE_ADDR,
349 OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
350 for (i = 0; i < OMAP3ISP_PREV_YENH_TBL_SIZE; i++) {
351 isp_reg_writel(isp, yt->table[i],
352 OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_DATA);
353 }
354}
355
356/*
357 * preview_config_chroma_suppression - Configure Chroma Suppression 269 * preview_config_chroma_suppression - Configure Chroma Suppression
358 */ 270 */
359static void 271static void
@@ -370,72 +282,6 @@ preview_config_chroma_suppression(struct isp_prev_device *prev,
370} 282}
371 283
372/* 284/*
373 * preview_enable_noisefilter - Enable/disable the Noise Filter
374 */
375static void
376preview_enable_noisefilter(struct isp_prev_device *prev, bool enable)
377{
378 struct isp_device *isp = to_isp_device(prev);
379
380 if (enable)
381 isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
382 ISPPRV_PCR_NFEN);
383 else
384 isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
385 ISPPRV_PCR_NFEN);
386}
387
388/*
389 * preview_enable_dcor - Enable/disable Couplet Defect Correction
390 */
391static void preview_enable_dcor(struct isp_prev_device *prev, bool enable)
392{
393 struct isp_device *isp = to_isp_device(prev);
394
395 if (enable)
396 isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
397 ISPPRV_PCR_DCOREN);
398 else
399 isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
400 ISPPRV_PCR_DCOREN);
401}
402
403/*
404 * preview_enable_gammabypass - Enable/disable Gamma Bypass
405 *
406 * When gamma bypass is enabled, the output of the gamma correction is the 8 MSB
407 * of the 10-bit input .
408 */
409static void
410preview_enable_gammabypass(struct isp_prev_device *prev, bool enable)
411{
412 struct isp_device *isp = to_isp_device(prev);
413
414 if (enable)
415 isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
416 ISPPRV_PCR_GAMMA_BYPASS);
417 else
418 isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
419 ISPPRV_PCR_GAMMA_BYPASS);
420}
421
422/*
423 * preview_enable_luma_enhancement - Enable/disable Luminance Enhancement
424 */
425static void
426preview_enable_luma_enhancement(struct isp_prev_device *prev, bool enable)
427{
428 struct isp_device *isp = to_isp_device(prev);
429
430 if (enable)
431 isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
432 ISPPRV_PCR_YNENHEN);
433 else
434 isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
435 ISPPRV_PCR_YNENHEN);
436}
437
438/*
439 * preview_enable_chroma_suppression - Enable/disable Chrominance Suppression 285 * preview_enable_chroma_suppression - Enable/disable Chrominance Suppression
440 */ 286 */
441static void 287static void
@@ -579,26 +425,175 @@ preview_config_csc(struct isp_prev_device *prev,
579} 425}
580 426
581/* 427/*
582 * preview_update_contrast - Updates the contrast. 428 * preview_config_yc_range - Configure the max and min Y and C values
583 * @contrast: Pointer to hold the current programmed contrast value. 429 */
430static void
431preview_config_yc_range(struct isp_prev_device *prev,
432 const struct prev_params *params)
433{
434 struct isp_device *isp = to_isp_device(prev);
435 const struct omap3isp_prev_yclimit *yc = &params->yclimit;
436
437 isp_reg_writel(isp,
438 yc->maxC << ISPPRV_SETUP_YC_MAXC_SHIFT |
439 yc->maxY << ISPPRV_SETUP_YC_MAXY_SHIFT |
440 yc->minC << ISPPRV_SETUP_YC_MINC_SHIFT |
441 yc->minY << ISPPRV_SETUP_YC_MINY_SHIFT,
442 OMAP3_ISP_IOMEM_PREV, ISPPRV_SETUP_YC);
443}
444
445/*
446 * preview_config_dcor - Configure Couplet Defect Correction
447 */
448static void
449preview_config_dcor(struct isp_prev_device *prev,
450 const struct prev_params *params)
451{
452 struct isp_device *isp = to_isp_device(prev);
453 const struct omap3isp_prev_dcor *dcor = &params->dcor;
454
455 isp_reg_writel(isp, dcor->detect_correct[0],
456 OMAP3_ISP_IOMEM_PREV, ISPPRV_CDC_THR0);
457 isp_reg_writel(isp, dcor->detect_correct[1],
458 OMAP3_ISP_IOMEM_PREV, ISPPRV_CDC_THR1);
459 isp_reg_writel(isp, dcor->detect_correct[2],
460 OMAP3_ISP_IOMEM_PREV, ISPPRV_CDC_THR2);
461 isp_reg_writel(isp, dcor->detect_correct[3],
462 OMAP3_ISP_IOMEM_PREV, ISPPRV_CDC_THR3);
463 isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
464 ISPPRV_PCR_DCCOUP,
465 dcor->couplet_mode_en ? ISPPRV_PCR_DCCOUP : 0);
466}
467
468/*
469 * preview_enable_dcor - Enable/disable Couplet Defect Correction
470 */
471static void preview_enable_dcor(struct isp_prev_device *prev, bool enable)
472{
473 struct isp_device *isp = to_isp_device(prev);
474
475 if (enable)
476 isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
477 ISPPRV_PCR_DCOREN);
478 else
479 isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
480 ISPPRV_PCR_DCOREN);
481}
482
483/*
484 * preview_enable_gammabypass - Enable/disable Gamma Bypass
584 * 485 *
585 * Value should be programmed before enabling the module. 486 * When gamma bypass is enabled, the output of the gamma correction is the 8 MSB
487 * of the 10-bit input .
586 */ 488 */
587static void 489static void
588preview_update_contrast(struct isp_prev_device *prev, u8 contrast) 490preview_enable_gammabypass(struct isp_prev_device *prev, bool enable)
589{ 491{
590 struct prev_params *params; 492 struct isp_device *isp = to_isp_device(prev);
591 unsigned long flags;
592 493
593 spin_lock_irqsave(&prev->params.lock, flags); 494 if (enable)
594 params = (prev->params.active & OMAP3ISP_PREV_CONTRAST) 495 isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
595 ? &prev->params.params[0] : &prev->params.params[1]; 496 ISPPRV_PCR_GAMMA_BYPASS);
497 else
498 isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
499 ISPPRV_PCR_GAMMA_BYPASS);
500}
596 501
597 if (params->contrast != (contrast * ISPPRV_CONTRAST_UNITS)) { 502/*
598 params->contrast = contrast * ISPPRV_CONTRAST_UNITS; 503 * preview_enable_drkframe_capture - Enable/disable Dark Frame Capture
599 params->update |= OMAP3ISP_PREV_CONTRAST; 504 */
505static void
506preview_enable_drkframe_capture(struct isp_prev_device *prev, bool enable)
507{
508 struct isp_device *isp = to_isp_device(prev);
509
510 if (enable)
511 isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
512 ISPPRV_PCR_DRKFCAP);
513 else
514 isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
515 ISPPRV_PCR_DRKFCAP);
516}
517
518/*
519 * preview_enable_drkframe - Enable/disable Dark Frame Subtraction
520 */
521static void preview_enable_drkframe(struct isp_prev_device *prev, bool enable)
522{
523 struct isp_device *isp = to_isp_device(prev);
524
525 if (enable)
526 isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
527 ISPPRV_PCR_DRKFEN);
528 else
529 isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
530 ISPPRV_PCR_DRKFEN);
531}
532
533/*
534 * preview_config_noisefilter - Configure the Noise Filter
535 */
536static void
537preview_config_noisefilter(struct isp_prev_device *prev,
538 const struct prev_params *params)
539{
540 struct isp_device *isp = to_isp_device(prev);
541 const struct omap3isp_prev_nf *nf = &params->nf;
542 unsigned int i;
543
544 isp_reg_writel(isp, nf->spread, OMAP3_ISP_IOMEM_PREV, ISPPRV_NF);
545 isp_reg_writel(isp, ISPPRV_NF_TABLE_ADDR,
546 OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
547 for (i = 0; i < OMAP3ISP_PREV_NF_TBL_SIZE; i++) {
548 isp_reg_writel(isp, nf->table[i],
549 OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_DATA);
600 } 550 }
601 spin_unlock_irqrestore(&prev->params.lock, flags); 551}
552
553/*
554 * preview_enable_noisefilter - Enable/disable the Noise Filter
555 */
556static void
557preview_enable_noisefilter(struct isp_prev_device *prev, bool enable)
558{
559 struct isp_device *isp = to_isp_device(prev);
560
561 if (enable)
562 isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
563 ISPPRV_PCR_NFEN);
564 else
565 isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
566 ISPPRV_PCR_NFEN);
567}
568
569/*
570 * preview_config_gammacorrn - Configure the Gamma Correction tables
571 */
572static void
573preview_config_gammacorrn(struct isp_prev_device *prev,
574 const struct prev_params *params)
575{
576 struct isp_device *isp = to_isp_device(prev);
577 const struct omap3isp_prev_gtables *gt = &params->gamma;
578 unsigned int i;
579
580 isp_reg_writel(isp, ISPPRV_REDGAMMA_TABLE_ADDR,
581 OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
582 for (i = 0; i < OMAP3ISP_PREV_GAMMA_TBL_SIZE; i++)
583 isp_reg_writel(isp, gt->red[i], OMAP3_ISP_IOMEM_PREV,
584 ISPPRV_SET_TBL_DATA);
585
586 isp_reg_writel(isp, ISPPRV_GREENGAMMA_TABLE_ADDR,
587 OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
588 for (i = 0; i < OMAP3ISP_PREV_GAMMA_TBL_SIZE; i++)
589 isp_reg_writel(isp, gt->green[i], OMAP3_ISP_IOMEM_PREV,
590 ISPPRV_SET_TBL_DATA);
591
592 isp_reg_writel(isp, ISPPRV_BLUEGAMMA_TABLE_ADDR,
593 OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
594 for (i = 0; i < OMAP3ISP_PREV_GAMMA_TBL_SIZE; i++)
595 isp_reg_writel(isp, gt->blue[i], OMAP3_ISP_IOMEM_PREV,
596 ISPPRV_SET_TBL_DATA);
602} 597}
603 598
604/* 599/*
@@ -618,57 +613,62 @@ preview_config_contrast(struct isp_prev_device *prev,
618} 613}
619 614
620/* 615/*
621 * preview_update_brightness - Updates the brightness in preview module. 616 * preview_config_brightness - Configure the Brightness
622 * @brightness: Pointer to hold the current programmed brightness value. 617 */
618static void
619preview_config_brightness(struct isp_prev_device *prev,
620 const struct prev_params *params)
621{
622 struct isp_device *isp = to_isp_device(prev);
623
624 isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_CNT_BRT,
625 0xff << ISPPRV_CNT_BRT_BRT_SHIFT,
626 params->brightness << ISPPRV_CNT_BRT_BRT_SHIFT);
627}
628
629/*
630 * preview_update_contrast - Updates the contrast.
631 * @contrast: Pointer to hold the current programmed contrast value.
623 * 632 *
633 * Value should be programmed before enabling the module.
624 */ 634 */
625static void 635static void
626preview_update_brightness(struct isp_prev_device *prev, u8 brightness) 636preview_update_contrast(struct isp_prev_device *prev, u8 contrast)
627{ 637{
628 struct prev_params *params; 638 struct prev_params *params;
629 unsigned long flags; 639 unsigned long flags;
630 640
631 spin_lock_irqsave(&prev->params.lock, flags); 641 spin_lock_irqsave(&prev->params.lock, flags);
632 params = (prev->params.active & OMAP3ISP_PREV_BRIGHTNESS) 642 params = (prev->params.active & OMAP3ISP_PREV_CONTRAST)
633 ? &prev->params.params[0] : &prev->params.params[1]; 643 ? &prev->params.params[0] : &prev->params.params[1];
634 644
635 if (params->brightness != (brightness * ISPPRV_BRIGHT_UNITS)) { 645 if (params->contrast != (contrast * ISPPRV_CONTRAST_UNITS)) {
636 params->brightness = brightness * ISPPRV_BRIGHT_UNITS; 646 params->contrast = contrast * ISPPRV_CONTRAST_UNITS;
637 params->update |= OMAP3ISP_PREV_BRIGHTNESS; 647 params->update |= OMAP3ISP_PREV_CONTRAST;
638 } 648 }
639 spin_unlock_irqrestore(&prev->params.lock, flags); 649 spin_unlock_irqrestore(&prev->params.lock, flags);
640} 650}
641 651
642/* 652/*
643 * preview_config_brightness - Configure the Brightness 653 * preview_update_brightness - Updates the brightness in preview module.
654 * @brightness: Pointer to hold the current programmed brightness value.
655 *
644 */ 656 */
645static void 657static void
646preview_config_brightness(struct isp_prev_device *prev, 658preview_update_brightness(struct isp_prev_device *prev, u8 brightness)
647 const struct prev_params *params)
648{ 659{
649 struct isp_device *isp = to_isp_device(prev); 660 struct prev_params *params;
650 661 unsigned long flags;
651 isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_CNT_BRT,
652 0xff << ISPPRV_CNT_BRT_BRT_SHIFT,
653 params->brightness << ISPPRV_CNT_BRT_BRT_SHIFT);
654}
655 662
656/* 663 spin_lock_irqsave(&prev->params.lock, flags);
657 * preview_config_yc_range - Configure the max and min Y and C values 664 params = (prev->params.active & OMAP3ISP_PREV_BRIGHTNESS)
658 */ 665 ? &prev->params.params[0] : &prev->params.params[1];
659static void
660preview_config_yc_range(struct isp_prev_device *prev,
661 const struct prev_params *params)
662{
663 struct isp_device *isp = to_isp_device(prev);
664 const struct omap3isp_prev_yclimit *yc = &params->yclimit;
665 666
666 isp_reg_writel(isp, 667 if (params->brightness != (brightness * ISPPRV_BRIGHT_UNITS)) {
667 yc->maxC << ISPPRV_SETUP_YC_MAXC_SHIFT | 668 params->brightness = brightness * ISPPRV_BRIGHT_UNITS;
668 yc->maxY << ISPPRV_SETUP_YC_MAXY_SHIFT | 669 params->update |= OMAP3ISP_PREV_BRIGHTNESS;
669 yc->minC << ISPPRV_SETUP_YC_MINC_SHIFT | 670 }
670 yc->minY << ISPPRV_SETUP_YC_MINY_SHIFT, 671 spin_unlock_irqrestore(&prev->params.lock, flags);
671 OMAP3_ISP_IOMEM_PREV, ISPPRV_SETUP_YC);
672} 672}
673 673
674static u32 674static u32