aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/davinci
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2013-03-04 05:18:38 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-03-19 15:16:04 -0400
commit1de1951930d4450d1645a0a907b710f268af42c3 (patch)
treefafa302bede6d683050882b14ad3c48766ede5c1 /drivers/media/platform/davinci
parentb12aed0ec518eb348ae0f6d196fd726c57670823 (diff)
[media] davinci/dm644x_ccdc: fix compiler warning
drivers/media/platform/davinci/dm644x_ccdc.c: In function ‘validate_ccdc_param’: drivers/media/platform/davinci/dm644x_ccdc.c:233:32: warning: comparison between ‘enum ccdc_gama_width’ and ‘enum ccdc_data_size’ [-Wenum-compare] It took a bit of work, see this thread of an earlier attempt to fix this: https://patchwork.kernel.org/patch/1923091/ I've chosen not to follow the suggestions in that thread since gamma_width is really a different property from data_size. What you really want is to know if gamma_width fits inside data_size and for that you need to translate each enum into a maximum bit number so you can safely compare the two. So I put in two static inline translation functions instead, keeping the rest of the code the same (except for fixing the 'gama' typo). Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Lad, Prabhakar <prabhakar.lad@ti.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/platform/davinci')
-rw-r--r--drivers/media/platform/davinci/dm644x_ccdc.c13
-rw-r--r--drivers/media/platform/davinci/dm644x_ccdc_regs.h2
2 files changed, 9 insertions, 6 deletions
diff --git a/drivers/media/platform/davinci/dm644x_ccdc.c b/drivers/media/platform/davinci/dm644x_ccdc.c
index 318e80512998..971d639b6674 100644
--- a/drivers/media/platform/davinci/dm644x_ccdc.c
+++ b/drivers/media/platform/davinci/dm644x_ccdc.c
@@ -228,9 +228,12 @@ static void ccdc_readregs(void)
228static int validate_ccdc_param(struct ccdc_config_params_raw *ccdcparam) 228static int validate_ccdc_param(struct ccdc_config_params_raw *ccdcparam)
229{ 229{
230 if (ccdcparam->alaw.enable) { 230 if (ccdcparam->alaw.enable) {
231 if ((ccdcparam->alaw.gama_wd > CCDC_GAMMA_BITS_09_0) || 231 u8 max_gamma = ccdc_gamma_width_max_bit(ccdcparam->alaw.gamma_wd);
232 (ccdcparam->alaw.gama_wd < CCDC_GAMMA_BITS_15_6) || 232 u8 max_data = ccdc_data_size_max_bit(ccdcparam->data_sz);
233 (ccdcparam->alaw.gama_wd < ccdcparam->data_sz)) { 233
234 if ((ccdcparam->alaw.gamma_wd > CCDC_GAMMA_BITS_09_0) ||
235 (ccdcparam->alaw.gamma_wd < CCDC_GAMMA_BITS_15_6) ||
236 (max_gamma > max_data)) {
234 dev_dbg(ccdc_cfg.dev, "\nInvalid data line select"); 237 dev_dbg(ccdc_cfg.dev, "\nInvalid data line select");
235 return -1; 238 return -1;
236 } 239 }
@@ -560,8 +563,8 @@ void ccdc_config_raw(void)
560 563
561 /* Enable and configure aLaw register if needed */ 564 /* Enable and configure aLaw register if needed */
562 if (config_params->alaw.enable) { 565 if (config_params->alaw.enable) {
563 val = ((config_params->alaw.gama_wd & 566 val = ((config_params->alaw.gamma_wd &
564 CCDC_ALAW_GAMA_WD_MASK) | CCDC_ALAW_ENABLE); 567 CCDC_ALAW_GAMMA_WD_MASK) | CCDC_ALAW_ENABLE);
565 regw(val, CCDC_ALAW); 568 regw(val, CCDC_ALAW);
566 dev_dbg(ccdc_cfg.dev, "\nWriting 0x%x to ALAW...\n", val); 569 dev_dbg(ccdc_cfg.dev, "\nWriting 0x%x to ALAW...\n", val);
567 } 570 }
diff --git a/drivers/media/platform/davinci/dm644x_ccdc_regs.h b/drivers/media/platform/davinci/dm644x_ccdc_regs.h
index 90370e414e2c..2b0aca5383f0 100644
--- a/drivers/media/platform/davinci/dm644x_ccdc_regs.h
+++ b/drivers/media/platform/davinci/dm644x_ccdc_regs.h
@@ -84,7 +84,7 @@
84#define CCDC_VDHDEN_ENABLE (1 << 16) 84#define CCDC_VDHDEN_ENABLE (1 << 16)
85#define CCDC_LPF_ENABLE (1 << 14) 85#define CCDC_LPF_ENABLE (1 << 14)
86#define CCDC_ALAW_ENABLE (1 << 3) 86#define CCDC_ALAW_ENABLE (1 << 3)
87#define CCDC_ALAW_GAMA_WD_MASK 7 87#define CCDC_ALAW_GAMMA_WD_MASK 7
88#define CCDC_BLK_CLAMP_ENABLE (1 << 31) 88#define CCDC_BLK_CLAMP_ENABLE (1 << 31)
89#define CCDC_BLK_SGAIN_MASK 0x1F 89#define CCDC_BLK_SGAIN_MASK 0x1F
90#define CCDC_BLK_ST_PXL_MASK 0x7FFF 90#define CCDC_BLK_ST_PXL_MASK 0x7FFF