aboutsummaryrefslogtreecommitdiffstats
path: root/include/media/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 /include/media/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 'include/media/davinci')
-rw-r--r--include/media/davinci/dm644x_ccdc.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/include/media/davinci/dm644x_ccdc.h b/include/media/davinci/dm644x_ccdc.h
index 3e178eb52fb3..852e96c4bb46 100644
--- a/include/media/davinci/dm644x_ccdc.h
+++ b/include/media/davinci/dm644x_ccdc.h
@@ -38,17 +38,23 @@ enum ccdc_sample_line {
38 CCDC_SAMPLE_16LINES 38 CCDC_SAMPLE_16LINES
39}; 39};
40 40
41/* enum for Alaw gama width */ 41/* enum for Alaw gamma width */
42enum ccdc_gama_width { 42enum ccdc_gamma_width {
43 CCDC_GAMMA_BITS_15_6, 43 CCDC_GAMMA_BITS_15_6, /* use bits 15-6 for gamma */
44 CCDC_GAMMA_BITS_14_5, 44 CCDC_GAMMA_BITS_14_5,
45 CCDC_GAMMA_BITS_13_4, 45 CCDC_GAMMA_BITS_13_4,
46 CCDC_GAMMA_BITS_12_3, 46 CCDC_GAMMA_BITS_12_3,
47 CCDC_GAMMA_BITS_11_2, 47 CCDC_GAMMA_BITS_11_2,
48 CCDC_GAMMA_BITS_10_1, 48 CCDC_GAMMA_BITS_10_1,
49 CCDC_GAMMA_BITS_09_0 49 CCDC_GAMMA_BITS_09_0 /* use bits 9-0 for gamma */
50}; 50};
51 51
52/* returns the highest bit used for the gamma */
53static inline u8 ccdc_gamma_width_max_bit(enum ccdc_gamma_width width)
54{
55 return 15 - width;
56}
57
52enum ccdc_data_size { 58enum ccdc_data_size {
53 CCDC_DATA_16BITS, 59 CCDC_DATA_16BITS,
54 CCDC_DATA_15BITS, 60 CCDC_DATA_15BITS,
@@ -60,12 +66,18 @@ enum ccdc_data_size {
60 CCDC_DATA_8BITS 66 CCDC_DATA_8BITS
61}; 67};
62 68
69/* returns the highest bit used for this data size */
70static inline u8 ccdc_data_size_max_bit(enum ccdc_data_size sz)
71{
72 return sz == CCDC_DATA_8BITS ? 7 : 15 - sz;
73}
74
63/* structure for ALaw */ 75/* structure for ALaw */
64struct ccdc_a_law { 76struct ccdc_a_law {
65 /* Enable/disable A-Law */ 77 /* Enable/disable A-Law */
66 unsigned char enable; 78 unsigned char enable;
67 /* Gama Width Input */ 79 /* Gamma Width Input */
68 enum ccdc_gama_width gama_wd; 80 enum ccdc_gamma_width gamma_wd;
69}; 81};
70 82
71/* structure for Black Clamping */ 83/* structure for Black Clamping */