[REVIEW PATCH 04/11] davinci_vpfe: fix copy-paste errors in several comments.

2013-03-04 Thread Hans Verkuil
From: Hans Verkuil 

This removes some incorrect dv_preset references left over from copy-and-paste
errors.

Signed-off-by: Hans Verkuil 
Acked-by: Lad, Prabhakar 
---
 drivers/staging/media/davinci_vpfe/vpfe_video.c |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c 
b/drivers/staging/media/davinci_vpfe/vpfe_video.c
index 99ccbeb..19dc5b0 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
@@ -1016,12 +1016,12 @@ vpfe_query_dv_timings(struct file *file, void *fh,
 }
 
 /*
- * vpfe_s_dv_timings() - set dv_preset on external subdev
+ * vpfe_s_dv_timings() - set dv_timings on external subdev
  * @file: file pointer
  * @priv: void pointer
  * @timings: pointer to v4l2_dv_timings structure
  *
- * set dv_timings pointed by preset on external subdev through
+ * set dv_timings pointed by timings on external subdev through
  * v4l2_device_call_until_err, this configures amplifier also
  *
  * Return 0 on success, error code otherwise
@@ -1042,12 +1042,12 @@ vpfe_s_dv_timings(struct file *file, void *fh,
 }
 
 /*
- * vpfe_g_dv_timings() - get dv_preset which is set on external subdev
+ * vpfe_g_dv_timings() - get dv_timings which is set on external subdev
  * @file: file pointer
  * @priv: void pointer
  * @timings: pointer to v4l2_dv_timings structure
  *
- * get dv_preset which is set on external subdev through
+ * get dv_timings which is set on external subdev through
  * v4l2_subdev_call
  *
  * Return 0 on success, error code otherwise
@@ -1423,7 +1423,7 @@ static int vpfe_dqbuf(struct file *file, void *priv,
 }
 
 /*
- * vpfe_streamon() - get dv_preset which is set on external subdev
+ * vpfe_streamon() - start streaming
  * @file: file pointer
  * @priv: void pointer
  * @buf_type: enum v4l2_buf_type
@@ -1472,7 +1472,7 @@ static int vpfe_streamon(struct file *file, void *priv,
 }
 
 /*
- * vpfe_streamoff() - get dv_preset which is set on external subdev
+ * vpfe_streamoff() - stop streaming
  * @file: file pointer
  * @priv: void pointer
  * @buf_type: enum v4l2_buf_type
-- 
1.7.10.4

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[REVIEW PATCH 00/11] davinci/blackfin DV_PRESET/current_norm removal

2013-03-04 Thread Hans Verkuil
Hi all,

This patch series is for the most part identical to the RFC patch series
posted earlier:

http://www.mail-archive.com/linux-media@vger.kernel.org/msg58762.html

The main changes are:

- dropped the Samsung-related patches, those will go through a separate
  patch series.
- added patches 7-10.

The first set of patches deal with the removal of the obsolete dv_preset
API. Patch 7 converts one last davinci driver to the control framework,
patches 8 and 9 remove the use of the obsolete current_norm field and
patch 10 fixes a compiler warning.

Scott, the blackfin patch is here only because I want to make a single pull
request for both the davinci and blackfin patches. Since you have already
acked your patch there is no need for you to do anything.

Prabhakar, if you can look at patches 7-10 (note that patch 7 is different
from the one you saw earlier), then that would be appreciated. Once I have
your ack I can make a pull request by the end of the week.

Regards,

Hans

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[REVIEW PATCH 10/11] davinci/dm644x_ccdc: fix compiler warning

2013-03-04 Thread Hans Verkuil
From: Hans Verkuil 

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]

Signed-off-by: Hans Verkuil 
---
 drivers/media/platform/davinci/dm644x_ccdc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/davinci/dm644x_ccdc.c 
b/drivers/media/platform/davinci/dm644x_ccdc.c
index 318e805..41f0a80 100644
--- a/drivers/media/platform/davinci/dm644x_ccdc.c
+++ b/drivers/media/platform/davinci/dm644x_ccdc.c
@@ -230,7 +230,7 @@ static int validate_ccdc_param(struct 
ccdc_config_params_raw *ccdcparam)
if (ccdcparam->alaw.enable) {
if ((ccdcparam->alaw.gama_wd > CCDC_GAMMA_BITS_09_0) ||
(ccdcparam->alaw.gama_wd < CCDC_GAMMA_BITS_15_6) ||
-   (ccdcparam->alaw.gama_wd < ccdcparam->data_sz)) {
+   (ccdcparam->alaw.gama_wd < (unsigned)ccdcparam->data_sz)) {
dev_dbg(ccdc_cfg.dev, "\nInvalid data line select");
return -1;
}
-- 
1.7.10.4

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[REVIEW PATCH 02/11] tvp7002: use dv_timings structs instead of presets.

2013-03-04 Thread Hans Verkuil
From: Hans Verkuil 

In the functions tvp7002_mbus_fmt(), tvp7002_log_status and tvp7002_probe()
we should use the dv_timings data structures instead of dv_preset data
structures and functions.

This is the second step towards removing the deprecated preset support of this
driver.

Signed-off-by: Hans Verkuil 
Acked-by: Lad, Prabhakar 
---
 drivers/media/i2c/tvp7002.c |   54 ++-
 1 file changed, 17 insertions(+), 37 deletions(-)

diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
index 7995eeb..d7a08bc 100644
--- a/drivers/media/i2c/tvp7002.c
+++ b/drivers/media/i2c/tvp7002.c
@@ -677,16 +677,10 @@ static int tvp7002_s_ctrl(struct v4l2_ctrl *ctrl)
 static int tvp7002_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt 
*f)
 {
struct tvp7002 *device = to_tvp7002(sd);
-   struct v4l2_dv_enum_preset e_preset;
-   int error;
-
-   /* Calculate height and width based on current standard */
-   error = v4l_fill_dv_preset_info(device->current_timings->preset, 
&e_preset);
-   if (error)
-   return error;
+   const struct v4l2_bt_timings *bt = &device->current_timings->timings.bt;
 
-   f->width = e_preset.width;
-   f->height = e_preset.height;
+   f->width = bt->width;
+   f->height = bt->height;
f->code = V4L2_MBUS_FMT_YUYV10_1X20;
f->field = device->current_timings->scanmode;
f->colorspace = device->current_timings->color_space;
@@ -896,35 +890,21 @@ static int tvp7002_s_stream(struct v4l2_subdev *sd, int 
enable)
  */
 static int tvp7002_log_status(struct v4l2_subdev *sd)
 {
-   const struct tvp7002_timings_definition *timings = tvp7002_timings;
struct tvp7002 *device = to_tvp7002(sd);
-   struct v4l2_dv_enum_preset e_preset;
-   struct v4l2_dv_preset detected;
-   int i;
+   const struct v4l2_bt_timings *bt;
+   int detected;
 
-   detected.preset = V4L2_DV_INVALID;
-   /* Find my current standard*/
-   tvp7002_query_dv_preset(sd, &detected);
+   /* Find my current timings */
+   tvp7002_query_dv(sd, &detected);
 
-   /* Print standard related code values */
-   for (i = 0; i < NUM_TIMINGS; i++, timings++)
-   if (timings->preset == detected.preset)
-   break;
-
-   if (v4l_fill_dv_preset_info(device->current_timings->preset, &e_preset))
-   return -EINVAL;
-
-   v4l2_info(sd, "Selected DV Preset: %s\n", e_preset.name);
-   v4l2_info(sd, "   Pixels per line: %u\n", e_preset.width);
-   v4l2_info(sd, "   Lines per frame: %u\n\n", e_preset.height);
-   if (i == NUM_TIMINGS) {
-   v4l2_info(sd, "Detected DV Preset: None\n");
+   bt = &device->current_timings->timings.bt;
+   v4l2_info(sd, "Selected DV Timings: %ux%u\n", bt->width, bt->height);
+   if (detected == NUM_TIMINGS) {
+   v4l2_info(sd, "Detected DV Timings: None\n");
} else {
-   if (v4l_fill_dv_preset_info(timings->preset, &e_preset))
-   return -EINVAL;
-   v4l2_info(sd, "Detected DV Preset: %s\n", e_preset.name);
-   v4l2_info(sd, "  Pixels per line: %u\n", e_preset.width);
-   v4l2_info(sd, "  Lines per frame: %u\n\n", e_preset.height);
+   bt = &tvp7002_timings[detected].timings.bt;
+   v4l2_info(sd, "Detected DV Timings: %ux%u\n",
+   bt->width, bt->height);
}
v4l2_info(sd, "Streaming enabled: %s\n",
device->streaming ? "yes" : "no");
@@ -1019,7 +999,7 @@ static int tvp7002_probe(struct i2c_client *c, const 
struct i2c_device_id *id)
 {
struct v4l2_subdev *sd;
struct tvp7002 *device;
-   struct v4l2_dv_preset preset;
+   struct v4l2_dv_timings timings;
int polarity_a;
int polarity_b;
u8 revision;
@@ -1080,8 +1060,8 @@ static int tvp7002_probe(struct i2c_client *c, const 
struct i2c_device_id *id)
return error;
 
/* Set registers according to default video mode */
-   preset.preset = device->current_timings->preset;
-   error = tvp7002_s_dv_preset(sd, &preset);
+   timings = device->current_timings->timings;
+   error = tvp7002_s_dv_timings(sd, &timings);
 
v4l2_ctrl_handler_init(&device->hdl, 1);
v4l2_ctrl_new_std(&device->hdl, &tvp7002_ctrl_ops,
-- 
1.7.10.4

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[REVIEW PATCH 03/11] tvp7002: remove dv_preset support.

2013-03-04 Thread Hans Verkuil
From: Hans Verkuil 

Finally remove the dv_preset support from this driver. Note that dv_preset
support was already removed from any bridge drivers that use this i2c
driver, so the dv_preset ops were no longer called and can be removed
safely.

Signed-off-by: Hans Verkuil 
Acked-by: Lad, Prabhakar 
---
 drivers/media/i2c/tvp7002.c |   70 ---
 1 file changed, 70 deletions(-)

diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
index d7a08bc..7406de9 100644
--- a/drivers/media/i2c/tvp7002.c
+++ b/drivers/media/i2c/tvp7002.c
@@ -328,7 +328,6 @@ static const struct i2c_reg_value tvp7002_parms_720P50[] = {
 
 /* Timings definition for handling device operation */
 struct tvp7002_timings_definition {
-   u32 preset;
struct v4l2_dv_timings timings;
const struct i2c_reg_value *p_settings;
enum v4l2_colorspace color_space;
@@ -342,7 +341,6 @@ struct tvp7002_timings_definition {
 /* Struct list for digital video timings */
 static const struct tvp7002_timings_definition tvp7002_timings[] = {
{
-   V4L2_DV_720P60,
V4L2_DV_BT_CEA_1280X720P60,
tvp7002_parms_720P60,
V4L2_COLORSPACE_REC709,
@@ -353,7 +351,6 @@ static const struct tvp7002_timings_definition 
tvp7002_timings[] = {
153
},
{
-   V4L2_DV_1080I60,
V4L2_DV_BT_CEA_1920X1080I60,
tvp7002_parms_1080I60,
V4L2_COLORSPACE_REC709,
@@ -364,7 +361,6 @@ static const struct tvp7002_timings_definition 
tvp7002_timings[] = {
205
},
{
-   V4L2_DV_1080I50,
V4L2_DV_BT_CEA_1920X1080I50,
tvp7002_parms_1080I50,
V4L2_COLORSPACE_REC709,
@@ -375,7 +371,6 @@ static const struct tvp7002_timings_definition 
tvp7002_timings[] = {
245
},
{
-   V4L2_DV_720P50,
V4L2_DV_BT_CEA_1280X720P50,
tvp7002_parms_720P50,
V4L2_COLORSPACE_REC709,
@@ -386,7 +381,6 @@ static const struct tvp7002_timings_definition 
tvp7002_timings[] = {
183
},
{
-   V4L2_DV_1080P60,
V4L2_DV_BT_CEA_1920X1080P60,
tvp7002_parms_1080P60,
V4L2_COLORSPACE_REC709,
@@ -397,7 +391,6 @@ static const struct tvp7002_timings_definition 
tvp7002_timings[] = {
102
},
{
-   V4L2_DV_480P59_94,
V4L2_DV_BT_CEA_720X480P59_94,
tvp7002_parms_480P,
V4L2_COLORSPACE_SMPTE170M,
@@ -408,7 +401,6 @@ static const struct tvp7002_timings_definition 
tvp7002_timings[] = {
0x
},
{
-   V4L2_DV_576P50,
V4L2_DV_BT_CEA_720X576P50,
tvp7002_parms_576P,
V4L2_COLORSPACE_SMPTE170M,
@@ -588,32 +580,6 @@ static int tvp7002_write_inittab(struct v4l2_subdev *sd,
return error;
 }
 
-/*
- * tvp7002_s_dv_preset() - Set digital video preset
- * @sd: ptr to v4l2_subdev struct
- * @dv_preset: ptr to v4l2_dv_preset struct
- *
- * Set the digital video preset for a TVP7002 decoder device.
- * Returns zero when successful or -EINVAL if register access fails.
- */
-static int tvp7002_s_dv_preset(struct v4l2_subdev *sd,
-   struct v4l2_dv_preset *dv_preset)
-{
-   struct tvp7002 *device = to_tvp7002(sd);
-   u32 preset;
-   int i;
-
-   for (i = 0; i < NUM_TIMINGS; i++) {
-   preset = tvp7002_timings[i].preset;
-   if (preset == dv_preset->preset) {
-   device->current_timings = &tvp7002_timings[i];
-   return tvp7002_write_inittab(sd, 
tvp7002_timings[i].p_settings);
-   }
-   }
-
-   return -EINVAL;
-}
-
 static int tvp7002_s_dv_timings(struct v4l2_subdev *sd,
struct v4l2_dv_timings *dv_timings)
 {
@@ -752,22 +718,6 @@ static int tvp7002_query_dv(struct v4l2_subdev *sd, int 
*index)
return 0;
 }
 
-static int tvp7002_query_dv_preset(struct v4l2_subdev *sd,
-   struct v4l2_dv_preset *qpreset)
-{
-   int index;
-   int err = tvp7002_query_dv(sd, &index);
-
-   if (err || index == NUM_TIMINGS) {
-   qpreset->preset = V4L2_DV_INVALID;
-   if (err == -ENOLINK)
-   err = 0;
-   return err;
-   }
-   qpreset->preset = tvp7002_timings[index].preset;
-   return 0;
-}
-
 static int tvp7002_query_dv_timings(struct v4l2_subdev *sd,
struct v4l2_dv_timings *timings)
 {
@@ -915,23 +865,6 @@ static int tvp7002_log_status(struct v4l2_subdev *sd)
return 0;
 }
 
-/*
- * tvp7002_enum_dv_presets() - Enum supported digital video formats
- * @sd: point

[REVIEW PATCH 08/11] davinci/vpbe_display: remove deprecated current_norm.

2013-03-04 Thread Hans Verkuil
From: Hans Verkuil 

Since vpbe_display already provides a g_std op setting current_norm
didn't do anything. Remove that code.

Signed-off-by: Hans Verkuil 
---
 drivers/media/platform/davinci/vpbe_display.c |   10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/media/platform/davinci/vpbe_display.c 
b/drivers/media/platform/davinci/vpbe_display.c
index 1f59955..a9e90b0 100644
--- a/drivers/media/platform/davinci/vpbe_display.c
+++ b/drivers/media/platform/davinci/vpbe_display.c
@@ -1176,10 +1176,6 @@ vpbe_display_s_dv_timings(struct file *file, void *priv,
"Failed to set the dv timings info\n");
return -EINVAL;
}
-   /* set the current norm to zero to be consistent. If STD is used
-* v4l2 layer will set the norm properly on successful s_std call
-*/
-   layer->video_dev.current_norm = 0;
 
return 0;
 }
@@ -1693,12 +1689,8 @@ static int init_vpbe_layer(int i, struct vpbe_display 
*disp_dev,
vbd->vfl_dir= VFL_DIR_TX;
 
if (disp_dev->vpbe_dev->current_timings.timings_type &
-   VPBE_ENC_STD) {
+   VPBE_ENC_STD)
vbd->tvnorms = (V4L2_STD_525_60 | V4L2_STD_625_50);
-   vbd->current_norm =
-   disp_dev->vpbe_dev->current_timings.std_id;
-   } else
-   vbd->current_norm = 0;
 
snprintf(vbd->name, sizeof(vbd->name),
"DaVinci_VPBE Display_DRIVER_V%d.%d.%d",
-- 
1.7.10.4

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[REVIEW PATCH 05/11] davinci: remove VPBE_ENC_DV_PRESET and rename VPBE_ENC_CUSTOM_TIMINGS

2013-03-04 Thread Hans Verkuil
From: Hans Verkuil 

Remove VPBE_ENC_DV_PRESET (the DV_PRESET API is no longer supported) and
VPBE_ENC_CUSTOM_TIMINGS is renamed to VPBE_ENC_DV_TIMINGS since the old
"CUSTOM_TIMINGS" name is deprecated in favor of "DV_TIMINGS".

Signed-off-by: Hans Verkuil 
Acked-by: Lad, Prabhakar 
Acked-by: Sekhar Nori 
---
 arch/arm/mach-davinci/board-dm644x-evm.c  |4 ++--
 arch/arm/mach-davinci/dm644x.c|2 +-
 drivers/media/platform/davinci/vpbe.c |8 
 drivers/media/platform/davinci/vpbe_display.c |2 +-
 drivers/media/platform/davinci/vpbe_venc.c|8 
 include/media/davinci/vpbe_types.h|3 +--
 6 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c 
b/arch/arm/mach-davinci/board-dm644x-evm.c
index 8e1b4ff..e8dc70b 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -649,7 +649,7 @@ static struct vpbe_enc_mode_info dm644xevm_enc_std_timing[] 
= {
 static struct vpbe_enc_mode_info dm644xevm_enc_preset_timing[] = {
{
.name   = "480p59_94",
-   .timings_type   = VPBE_ENC_CUSTOM_TIMINGS,
+   .timings_type   = VPBE_ENC_DV_TIMINGS,
.dv_timings = V4L2_DV_BT_CEA_720X480P59_94,
.interlaced = 0,
.xres   = 720,
@@ -661,7 +661,7 @@ static struct vpbe_enc_mode_info 
dm644xevm_enc_preset_timing[] = {
},
{
.name   = "576p50",
-   .timings_type   = VPBE_ENC_CUSTOM_TIMINGS,
+   .timings_type   = VPBE_ENC_DV_TIMINGS,
.dv_timings = V4L2_DV_BT_CEA_720X576P50,
.interlaced = 0,
.xres   = 720,
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index db1dd92..ee0e994 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -706,7 +706,7 @@ static int dm644x_venc_setup_clock(enum 
vpbe_enc_timings_type type,
v |= DM644X_VPSS_DACCLKEN;
writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL));
break;
-   case VPBE_ENC_CUSTOM_TIMINGS:
+   case VPBE_ENC_DV_TIMINGS:
if (pclock <= 2700) {
v |= DM644X_VPSS_DACCLKEN;
writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL));
diff --git a/drivers/media/platform/davinci/vpbe.c 
b/drivers/media/platform/davinci/vpbe.c
index 4ca0f9a..2a49f00 100644
--- a/drivers/media/platform/davinci/vpbe.c
+++ b/drivers/media/platform/davinci/vpbe.c
@@ -344,7 +344,7 @@ static int vpbe_s_dv_timings(struct vpbe_device *vpbe_dev,
return -EINVAL;
 
for (i = 0; i < output->num_modes; i++) {
-   if (output->modes[i].timings_type == VPBE_ENC_CUSTOM_TIMINGS &&
+   if (output->modes[i].timings_type == VPBE_ENC_DV_TIMINGS &&
!memcmp(&output->modes[i].dv_timings,
dv_timings, sizeof(*dv_timings)))
break;
@@ -385,7 +385,7 @@ static int vpbe_g_dv_timings(struct vpbe_device *vpbe_dev,
 struct v4l2_dv_timings *dv_timings)
 {
if (vpbe_dev->current_timings.timings_type &
- VPBE_ENC_CUSTOM_TIMINGS) {
+ VPBE_ENC_DV_TIMINGS) {
*dv_timings = vpbe_dev->current_timings.dv_timings;
return 0;
}
@@ -412,7 +412,7 @@ static int vpbe_enum_dv_timings(struct vpbe_device 
*vpbe_dev,
return -EINVAL;
 
for (i = 0; i < output->num_modes; i++) {
-   if (output->modes[i].timings_type == VPBE_ENC_CUSTOM_TIMINGS) {
+   if (output->modes[i].timings_type == VPBE_ENC_DV_TIMINGS) {
if (j == timings->index)
break;
j++;
@@ -515,7 +515,7 @@ static int vpbe_set_mode(struct vpbe_device *vpbe_dev,
return vpbe_s_std(vpbe_dev,
 &preset_mode->std_id);
if (preset_mode->timings_type &
-   VPBE_ENC_CUSTOM_TIMINGS) {
+   VPBE_ENC_DV_TIMINGS) {
dv_timings =
preset_mode->dv_timings;
return vpbe_s_dv_timings(vpbe_dev, &dv_timings);
diff --git a/drivers/media/platform/davinci/vpbe_display.c 
b/drivers/media/platform/davinci/vpbe_display.c
index 5e6b0ca..1f59955 100644
--- a/drivers/media/platform/davinci/vpbe_display.c
+++ b/drivers/media/platform/davinci/vpbe_display.c
@@ -1202,7 +1202,7 @@ vpbe_display_g_dv_timings(struct file *file, void *priv,
/* Get the given standard in the encoder */
 
if (vpbe_dev->current_timings.timings_type &
-

[REVIEW PATCH 11/11] blackfin: replace V4L2_IN/OUT_CAP_CUSTOM_TIMINGS by DV_TIMINGS

2013-03-04 Thread Hans Verkuil
From: Hans Verkuil 

The use of V4L2_IN/OUT_CAP_CUSTOM_TIMINGS is obsolete, use DV_TIMINGS instead.
Note that V4L2_IN/OUT_CAP_CUSTOM_TIMINGS is just a #define for
V4L2_IN/OUT_CAP_DV_TIMINGS.

At some point in the future these CUSTOM_TIMINGS defines might be removed.

Signed-off-by: Hans Verkuil 
Acked-by: Scott Jiang 
---
 arch/blackfin/mach-bf609/boards/ezkit.c|8 
 drivers/media/platform/blackfin/bfin_capture.c |4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/blackfin/mach-bf609/boards/ezkit.c 
b/arch/blackfin/mach-bf609/boards/ezkit.c
index 61c1f47..97d7016 100644
--- a/arch/blackfin/mach-bf609/boards/ezkit.c
+++ b/arch/blackfin/mach-bf609/boards/ezkit.c
@@ -936,19 +936,19 @@ static struct v4l2_input adv7842_inputs[] = {
.index = 2,
.name = "Component",
.type = V4L2_INPUT_TYPE_CAMERA,
-   .capabilities = V4L2_IN_CAP_CUSTOM_TIMINGS,
+   .capabilities = V4L2_IN_CAP_DV_TIMINGS,
},
{
.index = 3,
.name = "VGA",
.type = V4L2_INPUT_TYPE_CAMERA,
-   .capabilities = V4L2_IN_CAP_CUSTOM_TIMINGS,
+   .capabilities = V4L2_IN_CAP_DV_TIMINGS,
},
{
.index = 4,
.name = "HDMI",
.type = V4L2_INPUT_TYPE_CAMERA,
-   .capabilities = V4L2_IN_CAP_CUSTOM_TIMINGS,
+   .capabilities = V4L2_IN_CAP_DV_TIMINGS,
},
 };
 
@@ -1074,7 +1074,7 @@ static struct v4l2_output adv7511_outputs[] = {
.index = 0,
.name = "HDMI",
.type = V4L2_INPUT_TYPE_CAMERA,
-   .capabilities = V4L2_OUT_CAP_CUSTOM_TIMINGS,
+   .capabilities = V4L2_OUT_CAP_DV_TIMINGS,
},
 };
 
diff --git a/drivers/media/platform/blackfin/bfin_capture.c 
b/drivers/media/platform/blackfin/bfin_capture.c
index 5f209d5..6691355 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -384,7 +384,7 @@ static int bcap_start_streaming(struct vb2_queue *vq, 
unsigned int count)
params.ppi_control = bcap_dev->cfg->ppi_control;
params.int_mask = bcap_dev->cfg->int_mask;
if (bcap_dev->cfg->inputs[bcap_dev->cur_input].capabilities
-   & V4L2_IN_CAP_CUSTOM_TIMINGS) {
+   & V4L2_IN_CAP_DV_TIMINGS) {
struct v4l2_bt_timings *bt = &bcap_dev->dv_timings.bt;
 
params.hdelay = bt->hsync + bt->hbackporch;
@@ -1110,7 +1110,7 @@ static int bcap_probe(struct platform_device *pdev)
}
bcap_dev->std = std;
}
-   if (config->inputs[0].capabilities & V4L2_IN_CAP_CUSTOM_TIMINGS) {
+   if (config->inputs[0].capabilities & V4L2_IN_CAP_DV_TIMINGS) {
struct v4l2_dv_timings dv_timings;
ret = v4l2_subdev_call(bcap_dev->sd, video,
g_dv_timings, &dv_timings);
-- 
1.7.10.4

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[REVIEW PATCH 01/11] tvp7002: replace 'preset' by 'timings' in various structs/variables.

2013-03-04 Thread Hans Verkuil
From: Hans Verkuil 

This is the first step towards removing the deprecated preset support of this
driver.

Signed-off-by: Hans Verkuil 
Acked-by: Lad, Prabhakar 
---
 drivers/media/i2c/tvp7002.c |   90 +--
 1 file changed, 45 insertions(+), 45 deletions(-)

diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
index 537f6b4..7995eeb 100644
--- a/drivers/media/i2c/tvp7002.c
+++ b/drivers/media/i2c/tvp7002.c
@@ -326,8 +326,8 @@ static const struct i2c_reg_value tvp7002_parms_720P50[] = {
{ TVP7002_EOR, 0xff, TVP7002_RESERVED }
 };
 
-/* Preset definition for handling device operation */
-struct tvp7002_preset_definition {
+/* Timings definition for handling device operation */
+struct tvp7002_timings_definition {
u32 preset;
struct v4l2_dv_timings timings;
const struct i2c_reg_value *p_settings;
@@ -339,8 +339,8 @@ struct tvp7002_preset_definition {
u16 cpl_max;
 };
 
-/* Struct list for digital video presets */
-static const struct tvp7002_preset_definition tvp7002_presets[] = {
+/* Struct list for digital video timings */
+static const struct tvp7002_timings_definition tvp7002_timings[] = {
{
V4L2_DV_720P60,
V4L2_DV_BT_CEA_1280X720P60,
@@ -420,7 +420,7 @@ static const struct tvp7002_preset_definition 
tvp7002_presets[] = {
}
 };
 
-#define NUM_PRESETSARRAY_SIZE(tvp7002_presets)
+#define NUM_TIMINGS ARRAY_SIZE(tvp7002_timings)
 
 /* Device definition */
 struct tvp7002 {
@@ -431,7 +431,7 @@ struct tvp7002 {
int ver;
int streaming;
 
-   const struct tvp7002_preset_definition *current_preset;
+   const struct tvp7002_timings_definition *current_timings;
 };
 
 /*
@@ -603,11 +603,11 @@ static int tvp7002_s_dv_preset(struct v4l2_subdev *sd,
u32 preset;
int i;
 
-   for (i = 0; i < NUM_PRESETS; i++) {
-   preset = tvp7002_presets[i].preset;
+   for (i = 0; i < NUM_TIMINGS; i++) {
+   preset = tvp7002_timings[i].preset;
if (preset == dv_preset->preset) {
-   device->current_preset = &tvp7002_presets[i];
-   return tvp7002_write_inittab(sd, 
tvp7002_presets[i].p_settings);
+   device->current_timings = &tvp7002_timings[i];
+   return tvp7002_write_inittab(sd, 
tvp7002_timings[i].p_settings);
}
}
 
@@ -623,12 +623,12 @@ static int tvp7002_s_dv_timings(struct v4l2_subdev *sd,
 
if (dv_timings->type != V4L2_DV_BT_656_1120)
return -EINVAL;
-   for (i = 0; i < NUM_PRESETS; i++) {
-   const struct v4l2_bt_timings *t = 
&tvp7002_presets[i].timings.bt;
+   for (i = 0; i < NUM_TIMINGS; i++) {
+   const struct v4l2_bt_timings *t = 
&tvp7002_timings[i].timings.bt;
 
if (!memcmp(bt, t, &bt->standards - &bt->width)) {
-   device->current_preset = &tvp7002_presets[i];
-   return tvp7002_write_inittab(sd, 
tvp7002_presets[i].p_settings);
+   device->current_timings = &tvp7002_timings[i];
+   return tvp7002_write_inittab(sd, 
tvp7002_timings[i].p_settings);
}
}
return -EINVAL;
@@ -639,7 +639,7 @@ static int tvp7002_g_dv_timings(struct v4l2_subdev *sd,
 {
struct tvp7002 *device = to_tvp7002(sd);
 
-   *dv_timings = device->current_preset->timings;
+   *dv_timings = device->current_timings->timings;
return 0;
 }
 
@@ -681,15 +681,15 @@ static int tvp7002_mbus_fmt(struct v4l2_subdev *sd, 
struct v4l2_mbus_framefmt *f
int error;
 
/* Calculate height and width based on current standard */
-   error = v4l_fill_dv_preset_info(device->current_preset->preset, 
&e_preset);
+   error = v4l_fill_dv_preset_info(device->current_timings->preset, 
&e_preset);
if (error)
return error;
 
f->width = e_preset.width;
f->height = e_preset.height;
f->code = V4L2_MBUS_FMT_YUYV10_1X20;
-   f->field = device->current_preset->scanmode;
-   f->colorspace = device->current_preset->color_space;
+   f->field = device->current_timings->scanmode;
+   f->colorspace = device->current_timings->color_space;
 
v4l2_dbg(1, debug, sd, "MBUS_FMT: Width - %d, Height - %d",
f->width, f->height);
@@ -697,16 +697,16 @@ static int tvp7002_mbus_fmt(struct v4l2_subdev *sd, 
struct v4l2_mbus_framefmt *f
 }
 
 /*
- * tvp7002_query_dv_preset() - query DV preset
+ * tvp7002_query_dv() - query DV timings
  * @sd: pointer to standard V4L2 sub-device structure
- * @qpreset: standard V4L2 v4l2_dv_preset structure
+ * @index: index into the tvp7002_timings array
  *
- * Returns the current DV preset by TVP7002. If no active input is
+ * Returns the current DV timings detected by TVP7002. If no active input is
  * detected, ret

[REVIEW PATCH 07/11] davinci/vpfe_capture: convert to the control framework.

2013-03-04 Thread Hans Verkuil
From: Hans Verkuil 

Signed-off-by: Hans Verkuil 
---
 drivers/media/platform/davinci/vpfe_capture.c |   47 -
 1 file changed, 7 insertions(+), 40 deletions(-)

diff --git a/drivers/media/platform/davinci/vpfe_capture.c 
b/drivers/media/platform/davinci/vpfe_capture.c
index 28d019d..70facc0 100644
--- a/drivers/media/platform/davinci/vpfe_capture.c
+++ b/drivers/media/platform/davinci/vpfe_capture.c
@@ -1107,6 +1107,7 @@ static int vpfe_g_input(struct file *file, void *priv, 
unsigned int *index)
 static int vpfe_s_input(struct file *file, void *priv, unsigned int index)
 {
struct vpfe_device *vpfe_dev = video_drvdata(file);
+   struct v4l2_subdev *sd;
struct vpfe_subdev_info *sdinfo;
int subdev_index, inp_index;
struct vpfe_route *route;
@@ -1138,14 +1139,15 @@ static int vpfe_s_input(struct file *file, void *priv, 
unsigned int index)
}
 
sdinfo = &vpfe_dev->cfg->sub_devs[subdev_index];
+   sd = vpfe_dev->sd[subdev_index];
route = &sdinfo->routes[inp_index];
if (route && sdinfo->can_route) {
input = route->input;
output = route->output;
}
 
-   ret = v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, sdinfo->grp_id,
-video, s_routing, input, output, 0);
+   if (sd)
+   ret = v4l2_subdev_call(sd, video, s_routing, input, output, 0);
 
if (ret) {
v4l2_err(&vpfe_dev->v4l2_dev,
@@ -1154,6 +1156,8 @@ static int vpfe_s_input(struct file *file, void *priv, 
unsigned int index)
goto unlock_out;
}
vpfe_dev->current_subdev = sdinfo;
+   if (sd)
+   vpfe_dev->v4l2_dev.ctrl_handler = sd->ctrl_handler;
vpfe_dev->current_input = index;
vpfe_dev->std_index = 0;
 
@@ -1439,41 +1443,6 @@ static int vpfe_dqbuf(struct file *file, void *priv,
  buf, file->f_flags & O_NONBLOCK);
 }
 
-static int vpfe_queryctrl(struct file *file, void *priv,
-   struct v4l2_queryctrl *qctrl)
-{
-   struct vpfe_device *vpfe_dev = video_drvdata(file);
-   struct vpfe_subdev_info *sdinfo;
-
-   sdinfo = vpfe_dev->current_subdev;
-
-   return v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, sdinfo->grp_id,
-core, queryctrl, qctrl);
-
-}
-
-static int vpfe_g_ctrl(struct file *file, void *priv, struct v4l2_control 
*ctrl)
-{
-   struct vpfe_device *vpfe_dev = video_drvdata(file);
-   struct vpfe_subdev_info *sdinfo;
-
-   sdinfo = vpfe_dev->current_subdev;
-
-   return v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, sdinfo->grp_id,
-core, g_ctrl, ctrl);
-}
-
-static int vpfe_s_ctrl(struct file *file, void *priv, struct v4l2_control 
*ctrl)
-{
-   struct vpfe_device *vpfe_dev = video_drvdata(file);
-   struct vpfe_subdev_info *sdinfo;
-
-   sdinfo = vpfe_dev->current_subdev;
-
-   return v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, sdinfo->grp_id,
-core, s_ctrl, ctrl);
-}
-
 /*
  * vpfe_calculate_offsets : This function calculates buffers offset
  * for top and bottom field
@@ -1781,9 +1750,6 @@ static const struct v4l2_ioctl_ops vpfe_ioctl_ops = {
.vidioc_querystd = vpfe_querystd,
.vidioc_s_std= vpfe_s_std,
.vidioc_g_std= vpfe_g_std,
-   .vidioc_queryctrl= vpfe_queryctrl,
-   .vidioc_g_ctrl   = vpfe_g_ctrl,
-   .vidioc_s_ctrl   = vpfe_s_ctrl,
.vidioc_reqbufs  = vpfe_reqbufs,
.vidioc_querybuf = vpfe_querybuf,
.vidioc_qbuf = vpfe_qbuf,
@@ -2007,6 +1973,7 @@ static int vpfe_probe(struct platform_device *pdev)
 
/* set first sub device as current one */
vpfe_dev->current_subdev = &vpfe_cfg->sub_devs[0];
+   vpfe_dev->v4l2_dev.ctrl_handler = vpfe_dev->sd[0]->ctrl_handler;
 
/* We have at least one sub device to work with */
mutex_unlock(&ccdc_lock);
-- 
1.7.10.4

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[REVIEW PATCH 09/11] davinci/vpfe_capture: remove current_norm

2013-03-04 Thread Hans Verkuil
From: Hans Verkuil 

Since vpfe_capture already provided a g_std op setting current_norm
does not actually do anything. Remove it.

Signed-off-by: Hans Verkuil 
---
 drivers/media/platform/davinci/vpfe_capture.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/platform/davinci/vpfe_capture.c 
b/drivers/media/platform/davinci/vpfe_capture.c
index 70facc0..3d1af67 100644
--- a/drivers/media/platform/davinci/vpfe_capture.c
+++ b/drivers/media/platform/davinci/vpfe_capture.c
@@ -1884,7 +1884,6 @@ static int vpfe_probe(struct platform_device *pdev)
vfd->fops   = &vpfe_fops;
vfd->ioctl_ops  = &vpfe_ioctl_ops;
vfd->tvnorms= 0;
-   vfd->current_norm   = V4L2_STD_PAL;
vfd->v4l2_dev   = &vpfe_dev->v4l2_dev;
snprintf(vfd->name, sizeof(vfd->name),
 "%s_V%d.%d.%d",
-- 
1.7.10.4

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[REVIEW PATCH 06/11] davinci: replace V4L2_OUT_CAP_CUSTOM_TIMINGS by V4L2_OUT_CAP_DV_TIMINGS

2013-03-04 Thread Hans Verkuil
From: Hans Verkuil 

The use of V4L2_OUT_CAP_CUSTOM_TIMINGS is deprecated, use DV_TIMINGS instead.
Note that V4L2_OUT_CAP_CUSTOM_TIMINGS is just a #define for
V4L2_OUT_CAP_DV_TIMINGS.

At some point in the future these CUSTOM_TIMINGS defines might be removed.

Signed-off-by: Hans Verkuil 
Acked-by: Lad, Prabhakar 
Acked-by: Sekhar Nori 
---
 arch/arm/mach-davinci/board-dm646x-evm.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c 
b/arch/arm/mach-davinci/board-dm646x-evm.c
index 6e2f163..43f35d6 100644
--- a/arch/arm/mach-davinci/board-dm646x-evm.c
+++ b/arch/arm/mach-davinci/board-dm646x-evm.c
@@ -514,7 +514,7 @@ static const struct vpif_output dm6467_ch0_outputs[] = {
.index = 1,
.name = "Component",
.type = V4L2_OUTPUT_TYPE_ANALOG,
-   .capabilities = V4L2_OUT_CAP_CUSTOM_TIMINGS,
+   .capabilities = V4L2_OUT_CAP_DV_TIMINGS,
},
.subdev_name = "adv7343",
.output_route = ADV7343_COMPONENT_ID,
-- 
1.7.10.4

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


Re: [REVIEW PATCH 09/11] davinci/vpfe_capture: remove current_norm

2013-03-04 Thread Prabhakar Lad
Hi Hans,

Thanks for the patch!

On Mon, Mar 4, 2013 at 2:35 PM, Hans Verkuil  wrote:
> From: Hans Verkuil 
>
> Since vpfe_capture already provided a g_std op setting current_norm
> does not actually do anything. Remove it.
>
> Signed-off-by: Hans Verkuil 

Acked-by: Lad, Prabhakar 

Regards,
--Prabhakar Lad

> ---
>  drivers/media/platform/davinci/vpfe_capture.c |1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/media/platform/davinci/vpfe_capture.c 
> b/drivers/media/platform/davinci/vpfe_capture.c
> index 70facc0..3d1af67 100644
> --- a/drivers/media/platform/davinci/vpfe_capture.c
> +++ b/drivers/media/platform/davinci/vpfe_capture.c
> @@ -1884,7 +1884,6 @@ static int vpfe_probe(struct platform_device *pdev)
> vfd->fops   = &vpfe_fops;
> vfd->ioctl_ops  = &vpfe_ioctl_ops;
> vfd->tvnorms= 0;
> -   vfd->current_norm   = V4L2_STD_PAL;
> vfd->v4l2_dev   = &vpfe_dev->v4l2_dev;
> snprintf(vfd->name, sizeof(vfd->name),
>  "%s_V%d.%d.%d",
> --
> 1.7.10.4
>
___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


Re: [REVIEW PATCH 07/11] davinci/vpfe_capture: convert to the control framework.

2013-03-04 Thread Prabhakar Lad
Hi Hans,

On Mon, Mar 4, 2013 at 2:35 PM, Hans Verkuil  wrote:
> From: Hans Verkuil 
>
> Signed-off-by: Hans Verkuil 

Acked-by: Lad, Prabhakar 

Regards,
--Prabhakar Lad

> ---
>  drivers/media/platform/davinci/vpfe_capture.c |   47 
> -
>  1 file changed, 7 insertions(+), 40 deletions(-)
>
> diff --git a/drivers/media/platform/davinci/vpfe_capture.c 
> b/drivers/media/platform/davinci/vpfe_capture.c
> index 28d019d..70facc0 100644
> --- a/drivers/media/platform/davinci/vpfe_capture.c
> +++ b/drivers/media/platform/davinci/vpfe_capture.c
> @@ -1107,6 +1107,7 @@ static int vpfe_g_input(struct file *file, void *priv, 
> unsigned int *index)
>  static int vpfe_s_input(struct file *file, void *priv, unsigned int index)
>  {
> struct vpfe_device *vpfe_dev = video_drvdata(file);
> +   struct v4l2_subdev *sd;
> struct vpfe_subdev_info *sdinfo;
> int subdev_index, inp_index;
> struct vpfe_route *route;
> @@ -1138,14 +1139,15 @@ static int vpfe_s_input(struct file *file, void 
> *priv, unsigned int index)
> }
>
> sdinfo = &vpfe_dev->cfg->sub_devs[subdev_index];
> +   sd = vpfe_dev->sd[subdev_index];
> route = &sdinfo->routes[inp_index];
> if (route && sdinfo->can_route) {
> input = route->input;
> output = route->output;
> }
>
> -   ret = v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, sdinfo->grp_id,
> -video, s_routing, input, output, 0);
> +   if (sd)
> +   ret = v4l2_subdev_call(sd, video, s_routing, input, output, 
> 0);
>
> if (ret) {
> v4l2_err(&vpfe_dev->v4l2_dev,
> @@ -1154,6 +1156,8 @@ static int vpfe_s_input(struct file *file, void *priv, 
> unsigned int index)
> goto unlock_out;
> }
> vpfe_dev->current_subdev = sdinfo;
> +   if (sd)
> +   vpfe_dev->v4l2_dev.ctrl_handler = sd->ctrl_handler;
> vpfe_dev->current_input = index;
> vpfe_dev->std_index = 0;
>
> @@ -1439,41 +1443,6 @@ static int vpfe_dqbuf(struct file *file, void *priv,
>   buf, file->f_flags & O_NONBLOCK);
>  }
>
> -static int vpfe_queryctrl(struct file *file, void *priv,
> -   struct v4l2_queryctrl *qctrl)
> -{
> -   struct vpfe_device *vpfe_dev = video_drvdata(file);
> -   struct vpfe_subdev_info *sdinfo;
> -
> -   sdinfo = vpfe_dev->current_subdev;
> -
> -   return v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, sdinfo->grp_id,
> -core, queryctrl, qctrl);
> -
> -}
> -
> -static int vpfe_g_ctrl(struct file *file, void *priv, struct v4l2_control 
> *ctrl)
> -{
> -   struct vpfe_device *vpfe_dev = video_drvdata(file);
> -   struct vpfe_subdev_info *sdinfo;
> -
> -   sdinfo = vpfe_dev->current_subdev;
> -
> -   return v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, sdinfo->grp_id,
> -core, g_ctrl, ctrl);
> -}
> -
> -static int vpfe_s_ctrl(struct file *file, void *priv, struct v4l2_control 
> *ctrl)
> -{
> -   struct vpfe_device *vpfe_dev = video_drvdata(file);
> -   struct vpfe_subdev_info *sdinfo;
> -
> -   sdinfo = vpfe_dev->current_subdev;
> -
> -   return v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, sdinfo->grp_id,
> -core, s_ctrl, ctrl);
> -}
> -
>  /*
>   * vpfe_calculate_offsets : This function calculates buffers offset
>   * for top and bottom field
> @@ -1781,9 +1750,6 @@ static const struct v4l2_ioctl_ops vpfe_ioctl_ops = {
> .vidioc_querystd = vpfe_querystd,
> .vidioc_s_std= vpfe_s_std,
> .vidioc_g_std= vpfe_g_std,
> -   .vidioc_queryctrl= vpfe_queryctrl,
> -   .vidioc_g_ctrl   = vpfe_g_ctrl,
> -   .vidioc_s_ctrl   = vpfe_s_ctrl,
> .vidioc_reqbufs  = vpfe_reqbufs,
> .vidioc_querybuf = vpfe_querybuf,
> .vidioc_qbuf = vpfe_qbuf,
> @@ -2007,6 +1973,7 @@ static int vpfe_probe(struct platform_device *pdev)
>
> /* set first sub device as current one */
> vpfe_dev->current_subdev = &vpfe_cfg->sub_devs[0];
> +   vpfe_dev->v4l2_dev.ctrl_handler = vpfe_dev->sd[0]->ctrl_handler;
>
> /* We have at least one sub device to work with */
> mutex_unlock(&ccdc_lock);
> --
> 1.7.10.4
>
___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


Re: [REVIEW PATCH 08/11] davinci/vpbe_display: remove deprecated current_norm.

2013-03-04 Thread Prabhakar Lad
Hi Hans,

Thanks for the patch!

On Mon, Mar 4, 2013 at 2:35 PM, Hans Verkuil  wrote:
> From: Hans Verkuil 
>
> Since vpbe_display already provides a g_std op setting current_norm
> didn't do anything. Remove that code.
>
> Signed-off-by: Hans Verkuil 

Acked-by: Lad, Prabhakar 

Regards,
--Prabhakar Lad

> ---
>  drivers/media/platform/davinci/vpbe_display.c |   10 +-
>  1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/drivers/media/platform/davinci/vpbe_display.c 
> b/drivers/media/platform/davinci/vpbe_display.c
> index 1f59955..a9e90b0 100644
> --- a/drivers/media/platform/davinci/vpbe_display.c
> +++ b/drivers/media/platform/davinci/vpbe_display.c
> @@ -1176,10 +1176,6 @@ vpbe_display_s_dv_timings(struct file *file, void 
> *priv,
> "Failed to set the dv timings info\n");
> return -EINVAL;
> }
> -   /* set the current norm to zero to be consistent. If STD is used
> -* v4l2 layer will set the norm properly on successful s_std call
> -*/
> -   layer->video_dev.current_norm = 0;
>
> return 0;
>  }
> @@ -1693,12 +1689,8 @@ static int init_vpbe_layer(int i, struct vpbe_display 
> *disp_dev,
> vbd->vfl_dir= VFL_DIR_TX;
>
> if (disp_dev->vpbe_dev->current_timings.timings_type &
> -   VPBE_ENC_STD) {
> +   VPBE_ENC_STD)
> vbd->tvnorms = (V4L2_STD_525_60 | V4L2_STD_625_50);
> -   vbd->current_norm =
> -   disp_dev->vpbe_dev->current_timings.std_id;
> -   } else
> -   vbd->current_norm = 0;
>
> snprintf(vbd->name, sizeof(vbd->name),
> "DaVinci_VPBE Display_DRIVER_V%d.%d.%d",
> --
> 1.7.10.4
>
___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


Re: [REVIEW PATCH 10/11] davinci/dm644x_ccdc: fix compiler warning

2013-03-04 Thread Prabhakar Lad
Hi Hans,

On Mon, Mar 4, 2013 at 2:35 PM, Hans Verkuil  wrote:
> From: Hans Verkuil 
>
> 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]
>
please refer this discussion [1], where Mauro has suggested
few options for fixing it.

Regards,
--Prabhakar Lad

[1] https://patchwork.kernel.org/patch/1923091/

> Signed-off-by: Hans Verkuil 
> ---
>  drivers/media/platform/davinci/dm644x_ccdc.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/davinci/dm644x_ccdc.c 
> b/drivers/media/platform/davinci/dm644x_ccdc.c
> index 318e805..41f0a80 100644
> --- a/drivers/media/platform/davinci/dm644x_ccdc.c
> +++ b/drivers/media/platform/davinci/dm644x_ccdc.c
> @@ -230,7 +230,7 @@ static int validate_ccdc_param(struct 
> ccdc_config_params_raw *ccdcparam)
> if (ccdcparam->alaw.enable) {
> if ((ccdcparam->alaw.gama_wd > CCDC_GAMMA_BITS_09_0) ||
> (ccdcparam->alaw.gama_wd < CCDC_GAMMA_BITS_15_6) ||
> -   (ccdcparam->alaw.gama_wd < ccdcparam->data_sz)) {
> +   (ccdcparam->alaw.gama_wd < (unsigned)ccdcparam->data_sz)) 
> {
> dev_dbg(ccdc_cfg.dev, "\nInvalid data line select");
> return -1;
> }
> --
> 1.7.10.4
>
___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


Re: [REVIEW PATCH 10/11] davinci/dm644x_ccdc: fix compiler warning

2013-03-04 Thread Hans Verkuil
On Mon March 4 2013 10:29:26 Prabhakar Lad wrote:
> Hi Hans,
> 
> On Mon, Mar 4, 2013 at 2:35 PM, Hans Verkuil  wrote:
> > From: Hans Verkuil 
> >
> > 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]
> >
> please refer this discussion [1], where Mauro has suggested
> few options for fixing it.

Ah, good. I'll try and do a proper fix.

BTW, does 'CCDC_GAMMA_BITS_15_6' mean '15 bits'? I'm not sure about the meaning
of the '_6' suffix. Also, I assume that 'gama' in 'enum ccdc_gama_width' is a
misspelling for 'gamma', right?

Regards,

Hans

> 
> Regards,
> --Prabhakar Lad
> 
> [1] https://patchwork.kernel.org/patch/1923091/
> 
> > Signed-off-by: Hans Verkuil 
> > ---
> >  drivers/media/platform/davinci/dm644x_ccdc.c |2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/media/platform/davinci/dm644x_ccdc.c 
> > b/drivers/media/platform/davinci/dm644x_ccdc.c
> > index 318e805..41f0a80 100644
> > --- a/drivers/media/platform/davinci/dm644x_ccdc.c
> > +++ b/drivers/media/platform/davinci/dm644x_ccdc.c
> > @@ -230,7 +230,7 @@ static int validate_ccdc_param(struct 
> > ccdc_config_params_raw *ccdcparam)
> > if (ccdcparam->alaw.enable) {
> > if ((ccdcparam->alaw.gama_wd > CCDC_GAMMA_BITS_09_0) ||
> > (ccdcparam->alaw.gama_wd < CCDC_GAMMA_BITS_15_6) ||
> > -   (ccdcparam->alaw.gama_wd < ccdcparam->data_sz)) {
> > +   (ccdcparam->alaw.gama_wd < 
> > (unsigned)ccdcparam->data_sz)) {
> > dev_dbg(ccdc_cfg.dev, "\nInvalid data line select");
> > return -1;
> > }
> > --
> > 1.7.10.4
> >
> 
___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


Re: [REVIEW PATCH 10/11] davinci/dm644x_ccdc: fix compiler warning

2013-03-04 Thread Prabhakar Lad
Hi Hans,

On Mon, Mar 4, 2013 at 3:06 PM, Hans Verkuil  wrote:
> On Mon March 4 2013 10:29:26 Prabhakar Lad wrote:
>> Hi Hans,
>>
>> On Mon, Mar 4, 2013 at 2:35 PM, Hans Verkuil  wrote:
>> > From: Hans Verkuil 
>> >
>> > 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]
>> >
>> please refer this discussion [1], where Mauro has suggested
>> few options for fixing it.
>
> Ah, good. I'll try and do a proper fix.
>
> BTW, does 'CCDC_GAMMA_BITS_15_6' mean '15 bits'? I'm not sure about the 
> meaning
> of the '_6' suffix. Also, I assume that 'gama' in 'enum ccdc_gama_width' is a
> misspelling for 'gamma', right?
>
Its the gamma width input, Since the data resolution can be greater
than 10-bits,
the 10-bits for input to A-Law operation is specified by this bit.
'CCDC_GAMMA_BITS_15_6'
means bits 6-15 are input for A-Law operation.

Yes 'gama' in 'enum ccdc_gama_width' is misspelled.

Regards,
--Prabhakar

> Regards,
>
> Hans
>
>>
>> Regards,
>> --Prabhakar Lad
>>
>> [1] https://patchwork.kernel.org/patch/1923091/
>>
>> > Signed-off-by: Hans Verkuil 
>> > ---
>> >  drivers/media/platform/davinci/dm644x_ccdc.c |2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/drivers/media/platform/davinci/dm644x_ccdc.c 
>> > b/drivers/media/platform/davinci/dm644x_ccdc.c
>> > index 318e805..41f0a80 100644
>> > --- a/drivers/media/platform/davinci/dm644x_ccdc.c
>> > +++ b/drivers/media/platform/davinci/dm644x_ccdc.c
>> > @@ -230,7 +230,7 @@ static int validate_ccdc_param(struct 
>> > ccdc_config_params_raw *ccdcparam)
>> > if (ccdcparam->alaw.enable) {
>> > if ((ccdcparam->alaw.gama_wd > CCDC_GAMMA_BITS_09_0) ||
>> > (ccdcparam->alaw.gama_wd < CCDC_GAMMA_BITS_15_6) ||
>> > -   (ccdcparam->alaw.gama_wd < ccdcparam->data_sz)) {
>> > +   (ccdcparam->alaw.gama_wd < 
>> > (unsigned)ccdcparam->data_sz)) {
>> > dev_dbg(ccdc_cfg.dev, "\nInvalid data line 
>> > select");
>> > return -1;
>> > }
>> > --
>> > 1.7.10.4
>> >
>>
___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[PATCH] ARM: davinci: defconfig: enable CGROUPS

2013-03-04 Thread Sekhar Nori
Newer filesystems like Fedora-18 don't support kernels where
cgroups is not enabled.

Enable it in defconfig so users don't have to enable
it themselves.

Signed-off-by: Sekhar Nori 
---
 arch/arm/configs/da8xx_omapl_defconfig |1 +
 arch/arm/configs/davinci_all_defconfig |1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/arm/configs/da8xx_omapl_defconfig 
b/arch/arm/configs/da8xx_omapl_defconfig
index 9aaad36..7c86813 100644
--- a/arch/arm/configs/da8xx_omapl_defconfig
+++ b/arch/arm/configs/da8xx_omapl_defconfig
@@ -5,6 +5,7 @@ CONFIG_POSIX_MQUEUE=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=14
+CONFIG_CGROUPS=y
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_EXPERT=y
 CONFIG_MODULES=y
diff --git a/arch/arm/configs/davinci_all_defconfig 
b/arch/arm/configs/davinci_all_defconfig
index 3edc78a..c86fd75 100644
--- a/arch/arm/configs/davinci_all_defconfig
+++ b/arch/arm/configs/davinci_all_defconfig
@@ -5,6 +5,7 @@ CONFIG_POSIX_MQUEUE=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=14
+CONFIG_CGROUPS=y
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_EXPERT=y
 CONFIG_MODULES=y
-- 
1.7.10.1

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[REVIEW PATCH 2/2] davinci: more gama -> gamma typo fixes.

2013-03-04 Thread Hans Verkuil
From: Hans Verkuil 

Signed-off-by: Hans Verkuil 
---
 drivers/media/platform/davinci/dm355_ccdc.c  |   10 +-
 drivers/media/platform/davinci/dm355_ccdc_regs.h |2 +-
 drivers/media/platform/davinci/isif.c|2 +-
 drivers/media/platform/davinci/isif_regs.h   |4 ++--
 include/media/davinci/dm355_ccdc.h   |6 +++---
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/media/platform/davinci/dm355_ccdc.c 
b/drivers/media/platform/davinci/dm355_ccdc.c
index 4277e4a..2364dba 100644
--- a/drivers/media/platform/davinci/dm355_ccdc.c
+++ b/drivers/media/platform/davinci/dm355_ccdc.c
@@ -85,7 +85,7 @@ static struct ccdc_oper_config {
.mfilt1 = CCDC_NO_MEDIAN_FILTER1,
.mfilt2 = CCDC_NO_MEDIAN_FILTER2,
.alaw = {
-   .gama_wd = 2,
+   .gamma_wd = 2,
},
.blk_clamp = {
.sample_pixel = 1,
@@ -303,8 +303,8 @@ static int validate_ccdc_param(struct 
ccdc_config_params_raw *ccdcparam)
}
 
if (ccdcparam->alaw.enable) {
-   if (ccdcparam->alaw.gama_wd < CCDC_GAMMA_BITS_13_4 ||
-   ccdcparam->alaw.gama_wd > CCDC_GAMMA_BITS_09_0) {
+   if (ccdcparam->alaw.gamma_wd < CCDC_GAMMA_BITS_13_4 ||
+   ccdcparam->alaw.gamma_wd > CCDC_GAMMA_BITS_09_0) {
dev_dbg(ccdc_cfg.dev, "Invalid value of ALAW\n");
return -EINVAL;
}
@@ -680,8 +680,8 @@ static int ccdc_config_raw(void)
/* Enable and configure aLaw register if needed */
if (config_params->alaw.enable) {
val |= (CCDC_ALAW_ENABLE |
-   ((config_params->alaw.gama_wd &
-   CCDC_ALAW_GAMA_WD_MASK) <<
+   ((config_params->alaw.gamma_wd &
+   CCDC_ALAW_GAMMA_WD_MASK) <<
CCDC_GAMMAWD_INPUT_SHIFT));
}
 
diff --git a/drivers/media/platform/davinci/dm355_ccdc_regs.h 
b/drivers/media/platform/davinci/dm355_ccdc_regs.h
index d6d2ef0..2e1946e 100644
--- a/drivers/media/platform/davinci/dm355_ccdc_regs.h
+++ b/drivers/media/platform/davinci/dm355_ccdc_regs.h
@@ -153,7 +153,7 @@
 #define CCDC_VDHDEN_ENABLE (1 << 16)
 #define CCDC_LPF_ENABLE(1 << 14)
 #define CCDC_ALAW_ENABLE   1
-#define CCDC_ALAW_GAMA_WD_MASK 7
+#define CCDC_ALAW_GAMMA_WD_MASK7
 #define CCDC_REC656IF_BT656_EN 3
 
 #define CCDC_FMTCFG_FMTMODE_MASK   3
diff --git a/drivers/media/platform/davinci/isif.c 
b/drivers/media/platform/davinci/isif.c
index 5050f92..abc3ae3 100644
--- a/drivers/media/platform/davinci/isif.c
+++ b/drivers/media/platform/davinci/isif.c
@@ -604,7 +604,7 @@ static int isif_config_raw(void)
if (module_params->compress.alg == ISIF_ALAW)
val |= ISIF_ALAW_ENABLE;
 
-   val |= (params->data_msb << ISIF_ALAW_GAMA_WD_SHIFT);
+   val |= (params->data_msb << ISIF_ALAW_GAMMA_WD_SHIFT);
regw(val, CGAMMAWD);
 
/* Configure DPCM compression settings */
diff --git a/drivers/media/platform/davinci/isif_regs.h 
b/drivers/media/platform/davinci/isif_regs.h
index aa69a46..3993aec 100644
--- a/drivers/media/platform/davinci/isif_regs.h
+++ b/drivers/media/platform/davinci/isif_regs.h
@@ -203,8 +203,8 @@
 #define ISIF_LPF_MASK  1
 
 /* GAMMAWD registers */
-#define ISIF_ALAW_GAMA_WD_MASK 0xF
-#define ISIF_ALAW_GAMA_WD_SHIFT1
+#define ISIF_ALAW_GAMMA_WD_MASK0xF
+#define ISIF_ALAW_GAMMA_WD_SHIFT   1
 #define ISIF_ALAW_ENABLE   1
 #define ISIF_GAMMAWD_CFA_SHIFT 5
 
diff --git a/include/media/davinci/dm355_ccdc.h 
b/include/media/davinci/dm355_ccdc.h
index adf2fe4..c669a9f 100644
--- a/include/media/davinci/dm355_ccdc.h
+++ b/include/media/davinci/dm355_ccdc.h
@@ -38,7 +38,7 @@ enum ccdc_sample_line {
CCDC_SAMPLE_16LINES
 };
 
-/* enum for Alaw gama width */
+/* enum for Alaw gamma width */
 enum ccdc_gamma_width {
CCDC_GAMMA_BITS_13_4,
CCDC_GAMMA_BITS_12_3,
@@ -97,8 +97,8 @@ enum ccdc_mfilt2 {
 struct ccdc_a_law {
/* Enable/disable A-Law */
unsigned char enable;
-   /* Gama Width Input */
-   enum ccdc_gamma_width gama_wd;
+   /* Gamma Width Input */
+   enum ccdc_gamma_width gamma_wd;
 };
 
 /* structure for Black Clamping */
-- 
1.7.10.4

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[REVIEW PATCH 0/2] davinci: fix compiler warning

2013-03-04 Thread Hans Verkuil
Hi all,

This is a second try at fixing the dm644x_ccdc compiler warning.
In addition it also fixes more 'gama' misspellings.

Prabhakar, can you look at this? I think this is a good solution
for this compiler warning.

Regards,

Hans

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[REVIEW PATCH 1/2] davinci/dm644x_ccdc: fix compiler warning

2013-03-04 Thread Hans Verkuil
From: Hans Verkuil 

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 
---
 drivers/media/platform/davinci/dm644x_ccdc.c  |   13 ++-
 drivers/media/platform/davinci/dm644x_ccdc_regs.h |2 +-
 include/media/davinci/dm644x_ccdc.h   |   24 +++--
 3 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/drivers/media/platform/davinci/dm644x_ccdc.c 
b/drivers/media/platform/davinci/dm644x_ccdc.c
index 318e805..971d639 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)
 static int validate_ccdc_param(struct ccdc_config_params_raw *ccdcparam)
 {
if (ccdcparam->alaw.enable) {
-   if ((ccdcparam->alaw.gama_wd > CCDC_GAMMA_BITS_09_0) ||
-   (ccdcparam->alaw.gama_wd < CCDC_GAMMA_BITS_15_6) ||
-   (ccdcparam->alaw.gama_wd < ccdcparam->data_sz)) {
+   u8 max_gamma = 
ccdc_gamma_width_max_bit(ccdcparam->alaw.gamma_wd);
+   u8 max_data = ccdc_data_size_max_bit(ccdcparam->data_sz);
+
+   if ((ccdcparam->alaw.gamma_wd > CCDC_GAMMA_BITS_09_0) ||
+   (ccdcparam->alaw.gamma_wd < CCDC_GAMMA_BITS_15_6) ||
+   (max_gamma > max_data)) {
dev_dbg(ccdc_cfg.dev, "\nInvalid data line select");
return -1;
}
@@ -560,8 +563,8 @@ void ccdc_config_raw(void)
 
/* Enable and configure aLaw register if needed */
if (config_params->alaw.enable) {
-   val = ((config_params->alaw.gama_wd &
- CCDC_ALAW_GAMA_WD_MASK) | CCDC_ALAW_ENABLE);
+   val = ((config_params->alaw.gamma_wd &
+ CCDC_ALAW_GAMMA_WD_MASK) | CCDC_ALAW_ENABLE);
regw(val, CCDC_ALAW);
dev_dbg(ccdc_cfg.dev, "\nWriting 0x%x to ALAW...\n", val);
}
diff --git a/drivers/media/platform/davinci/dm644x_ccdc_regs.h 
b/drivers/media/platform/davinci/dm644x_ccdc_regs.h
index 90370e4..2b0aca5 100644
--- a/drivers/media/platform/davinci/dm644x_ccdc_regs.h
+++ b/drivers/media/platform/davinci/dm644x_ccdc_regs.h
@@ -84,7 +84,7 @@
 #define CCDC_VDHDEN_ENABLE (1 << 16)
 #define CCDC_LPF_ENABLE(1 << 14)
 #define CCDC_ALAW_ENABLE   (1 << 3)
-#define CCDC_ALAW_GAMA_WD_MASK 7
+#define CCDC_ALAW_GAMMA_WD_MASK7
 #define CCDC_BLK_CLAMP_ENABLE  (1 << 31)
 #define CCDC_BLK_SGAIN_MASK0x1F
 #define CCDC_BLK_ST_PXL_MASK   0x7FFF
diff --git a/include/media/davinci/dm644x_ccdc.h 
b/include/media/davinci/dm644x_ccdc.h
index 3e178eb..852e96c 100644
--- a/include/media/davinci/dm644x_ccdc.h
+++ b/include/media/davinci/dm644x_ccdc.h
@@ -38,17 +38,23 @@ enum ccdc_sample_line {
CCDC_SAMPLE_16LINES
 };
 
-/* enum for Alaw gama width */
-enum ccdc_gama_width {
-   CCDC_GAMMA_BITS_15_6,
+/* enum for Alaw gamma width */
+enum ccdc_gamma_width {
+   CCDC_GAMMA_BITS_15_6,   /* use bits 15-6 for gamma */
CCDC_GAMMA_BITS_14_5,
CCDC_GAMMA_BITS_13_4,
CCDC_GAMMA_BITS_12_3,
CCDC_GAMMA_BITS_11_2,
CCDC_GAMMA_BITS_10_1,
-   CCDC_GAMMA_BITS_09_0
+   CCDC_GAMMA_BITS_09_0/* use bits 9-0 for gamma */
 };
 
+/* returns the highest bit used for the gamma */
+static inline u8 ccdc_gamma_width_max_bit(enum ccdc_gamma_width width)
+{
+   return 15 - width;
+}
+
 enum ccdc_data_size {
CCDC_DATA_16BITS,
CCDC_DATA_15BITS,
@@ -60,12 +66,18 @@ enum ccdc_data_size {
CCDC_DATA_8BITS
 };
 
+/* returns the highest bit used for this data size */
+static inline u8 ccdc_data_size_max_bit(enum ccdc_data_size sz)
+{
+   return sz == CCDC_DATA_8BITS ? 7 : 15 - sz;
+}
+
 /* structure for ALaw */
 struct ccdc_a_law {
/* Enable/disable A-Law */
unsigned char enable;
-   /* Gama Width Input */
-   enum ccdc_gama_width gama_wd;
+   /* Gamma Width Input */
+   enum ccdc_gamma_width gamma_wd;
 };
 
 /* structure for Black Clamping */
-- 
1.7.10.4

_

Re: [REVIEW PATCH 2/2] davinci: more gama -> gamma typo fixes.

2013-03-04 Thread Prabhakar Lad
Hi Hans,

Thanks for the patch!

On Mon, Mar 4, 2013 at 4:49 PM, Hans Verkuil  wrote:
> From: Hans Verkuil 
>
> Signed-off-by: Hans Verkuil 

Acked-by: Lad, Prabhakar 

Regards,
--Prabhakar Lad

> ---
>  drivers/media/platform/davinci/dm355_ccdc.c  |   10 +-
>  drivers/media/platform/davinci/dm355_ccdc_regs.h |2 +-
>  drivers/media/platform/davinci/isif.c|2 +-
>  drivers/media/platform/davinci/isif_regs.h   |4 ++--
>  include/media/davinci/dm355_ccdc.h   |6 +++---
>  5 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/media/platform/davinci/dm355_ccdc.c 
> b/drivers/media/platform/davinci/dm355_ccdc.c
> index 4277e4a..2364dba 100644
> --- a/drivers/media/platform/davinci/dm355_ccdc.c
> +++ b/drivers/media/platform/davinci/dm355_ccdc.c
> @@ -85,7 +85,7 @@ static struct ccdc_oper_config {
> .mfilt1 = CCDC_NO_MEDIAN_FILTER1,
> .mfilt2 = CCDC_NO_MEDIAN_FILTER2,
> .alaw = {
> -   .gama_wd = 2,
> +   .gamma_wd = 2,
> },
> .blk_clamp = {
> .sample_pixel = 1,
> @@ -303,8 +303,8 @@ static int validate_ccdc_param(struct 
> ccdc_config_params_raw *ccdcparam)
> }
>
> if (ccdcparam->alaw.enable) {
> -   if (ccdcparam->alaw.gama_wd < CCDC_GAMMA_BITS_13_4 ||
> -   ccdcparam->alaw.gama_wd > CCDC_GAMMA_BITS_09_0) {
> +   if (ccdcparam->alaw.gamma_wd < CCDC_GAMMA_BITS_13_4 ||
> +   ccdcparam->alaw.gamma_wd > CCDC_GAMMA_BITS_09_0) {
> dev_dbg(ccdc_cfg.dev, "Invalid value of ALAW\n");
> return -EINVAL;
> }
> @@ -680,8 +680,8 @@ static int ccdc_config_raw(void)
> /* Enable and configure aLaw register if needed */
> if (config_params->alaw.enable) {
> val |= (CCDC_ALAW_ENABLE |
> -   ((config_params->alaw.gama_wd &
> -   CCDC_ALAW_GAMA_WD_MASK) <<
> +   ((config_params->alaw.gamma_wd &
> +   CCDC_ALAW_GAMMA_WD_MASK) <<
> CCDC_GAMMAWD_INPUT_SHIFT));
> }
>
> diff --git a/drivers/media/platform/davinci/dm355_ccdc_regs.h 
> b/drivers/media/platform/davinci/dm355_ccdc_regs.h
> index d6d2ef0..2e1946e 100644
> --- a/drivers/media/platform/davinci/dm355_ccdc_regs.h
> +++ b/drivers/media/platform/davinci/dm355_ccdc_regs.h
> @@ -153,7 +153,7 @@
>  #define CCDC_VDHDEN_ENABLE (1 << 16)
>  #define CCDC_LPF_ENABLE(1 << 14)
>  #define CCDC_ALAW_ENABLE   1
> -#define CCDC_ALAW_GAMA_WD_MASK 7
> +#define CCDC_ALAW_GAMMA_WD_MASK7
>  #define CCDC_REC656IF_BT656_EN 3
>
>  #define CCDC_FMTCFG_FMTMODE_MASK   3
> diff --git a/drivers/media/platform/davinci/isif.c 
> b/drivers/media/platform/davinci/isif.c
> index 5050f92..abc3ae3 100644
> --- a/drivers/media/platform/davinci/isif.c
> +++ b/drivers/media/platform/davinci/isif.c
> @@ -604,7 +604,7 @@ static int isif_config_raw(void)
> if (module_params->compress.alg == ISIF_ALAW)
> val |= ISIF_ALAW_ENABLE;
>
> -   val |= (params->data_msb << ISIF_ALAW_GAMA_WD_SHIFT);
> +   val |= (params->data_msb << ISIF_ALAW_GAMMA_WD_SHIFT);
> regw(val, CGAMMAWD);
>
> /* Configure DPCM compression settings */
> diff --git a/drivers/media/platform/davinci/isif_regs.h 
> b/drivers/media/platform/davinci/isif_regs.h
> index aa69a46..3993aec 100644
> --- a/drivers/media/platform/davinci/isif_regs.h
> +++ b/drivers/media/platform/davinci/isif_regs.h
> @@ -203,8 +203,8 @@
>  #define ISIF_LPF_MASK  1
>
>  /* GAMMAWD registers */
> -#define ISIF_ALAW_GAMA_WD_MASK 0xF
> -#define ISIF_ALAW_GAMA_WD_SHIFT1
> +#define ISIF_ALAW_GAMMA_WD_MASK0xF
> +#define ISIF_ALAW_GAMMA_WD_SHIFT   1
>  #define ISIF_ALAW_ENABLE   1
>  #define ISIF_GAMMAWD_CFA_SHIFT 5
>
> diff --git a/include/media/davinci/dm355_ccdc.h 
> b/include/media/davinci/dm355_ccdc.h
> index adf2fe4..c669a9f 100644
> --- a/include/media/davinci/dm355_ccdc.h
> +++ b/include/media/davinci/dm355_ccdc.h
> @@ -38,7 +38,7 @@ enum ccdc_sample_line {
> CCDC_SAMPLE_16LINES
>  };
>
> -/* enum for Alaw gama width */
> +/* enum for Alaw gamma width */
>  enum ccdc_gamma_width {
> CCDC_GAMMA_BITS_13_4,
> CCDC_GAMMA_BITS_12_3,
> @@ -97,8 +97,8 @@ enum ccdc_mfilt2 {
>  struct ccdc_a_law {
> /* Enable/disable A-Law */
> unsigned char enable;
> -   /* Gama Width Input */
> -   enum ccdc_gamma_width gama_wd;
> +   /* Gamma Width Input */
> +   enum ccdc_gamma_wi

Re: [REVIEW PATCH 1/2] davinci/dm644x_ccdc: fix compiler warning

2013-03-04 Thread Prabhakar Lad
Hi Hans,

Thanks for the fix!

On Mon, Mar 4, 2013 at 4:49 PM, Hans Verkuil  wrote:
> From: Hans Verkuil 
>
> 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.
>
True!

> 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 

Acked-by: Lad, Prabhakar 

Regards,
--Prabhakar Lad

> ---
>  drivers/media/platform/davinci/dm644x_ccdc.c  |   13 ++-
>  drivers/media/platform/davinci/dm644x_ccdc_regs.h |2 +-
>  include/media/davinci/dm644x_ccdc.h   |   24 
> +++--
>  3 files changed, 27 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/media/platform/davinci/dm644x_ccdc.c 
> b/drivers/media/platform/davinci/dm644x_ccdc.c
> index 318e805..971d639 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)
>  static int validate_ccdc_param(struct ccdc_config_params_raw *ccdcparam)
>  {
> if (ccdcparam->alaw.enable) {
> -   if ((ccdcparam->alaw.gama_wd > CCDC_GAMMA_BITS_09_0) ||
> -   (ccdcparam->alaw.gama_wd < CCDC_GAMMA_BITS_15_6) ||
> -   (ccdcparam->alaw.gama_wd < ccdcparam->data_sz)) {
> +   u8 max_gamma = 
> ccdc_gamma_width_max_bit(ccdcparam->alaw.gamma_wd);
> +   u8 max_data = ccdc_data_size_max_bit(ccdcparam->data_sz);
> +
> +   if ((ccdcparam->alaw.gamma_wd > CCDC_GAMMA_BITS_09_0) ||
> +   (ccdcparam->alaw.gamma_wd < CCDC_GAMMA_BITS_15_6) ||
> +   (max_gamma > max_data)) {
> dev_dbg(ccdc_cfg.dev, "\nInvalid data line select");
> return -1;
> }
> @@ -560,8 +563,8 @@ void ccdc_config_raw(void)
>
> /* Enable and configure aLaw register if needed */
> if (config_params->alaw.enable) {
> -   val = ((config_params->alaw.gama_wd &
> - CCDC_ALAW_GAMA_WD_MASK) | CCDC_ALAW_ENABLE);
> +   val = ((config_params->alaw.gamma_wd &
> + CCDC_ALAW_GAMMA_WD_MASK) | CCDC_ALAW_ENABLE);
> regw(val, CCDC_ALAW);
> dev_dbg(ccdc_cfg.dev, "\nWriting 0x%x to ALAW...\n", val);
> }
> diff --git a/drivers/media/platform/davinci/dm644x_ccdc_regs.h 
> b/drivers/media/platform/davinci/dm644x_ccdc_regs.h
> index 90370e4..2b0aca5 100644
> --- a/drivers/media/platform/davinci/dm644x_ccdc_regs.h
> +++ b/drivers/media/platform/davinci/dm644x_ccdc_regs.h
> @@ -84,7 +84,7 @@
>  #define CCDC_VDHDEN_ENABLE (1 << 16)
>  #define CCDC_LPF_ENABLE(1 << 14)
>  #define CCDC_ALAW_ENABLE   (1 << 3)
> -#define CCDC_ALAW_GAMA_WD_MASK 7
> +#define CCDC_ALAW_GAMMA_WD_MASK7
>  #define CCDC_BLK_CLAMP_ENABLE  (1 << 31)
>  #define CCDC_BLK_SGAIN_MASK0x1F
>  #define CCDC_BLK_ST_PXL_MASK   0x7FFF
> diff --git a/include/media/davinci/dm644x_ccdc.h 
> b/include/media/davinci/dm644x_ccdc.h
> index 3e178eb..852e96c 100644
> --- a/include/media/davinci/dm644x_ccdc.h
> +++ b/include/media/davinci/dm644x_ccdc.h
> @@ -38,17 +38,23 @@ enum ccdc_sample_line {
> CCDC_SAMPLE_16LINES
>  };
>
> -/* enum for Alaw gama width */
> -enum ccdc_gama_width {
> -   CCDC_GAMMA_BITS_15_6,
> +/* enum for Alaw gamma width */
> +enum ccdc_gamma_width {
> +   CCDC_GAMMA_BITS_15_6,   /* use bits 15-6 for gamma */
> CCDC_GAMMA_BITS_14_5,
> CCDC_GAMMA_BITS_13_4,
> CCDC_GAMMA_BITS_12_3,
> CCDC_GAMMA_BITS_11_2,
> CCDC_GAMMA_BITS_10_1,
> -   CCDC_GAMMA_BITS_09_0
> +   CCDC_GAMMA_BITS_09_0/* use bits 9-0 for gamma */
>  };
>
> +/* returns the highest bit used for the gamma */
> +static inline u8 ccdc_gamma_width_max_bit(enum ccdc_gamma_width width)
> +{
> +   return 15 - width;
> +}
> +
>  enum ccdc_data_size {
> CCDC_DATA_16BITS,
> CCDC_DATA_15BITS,
> @@ -60,12 +66,18 @@ enum ccdc_data_size {
> CCDC_DATA_8BITS
>  };
>
> +/* returns the highest bit used for this data size */
> +static inline u8 ccdc_data_size_max_bit(enum ccdc_data_size sz)
> +{
> +   return sz == CCDC

[PATCH v2 0/4] Enable SPI flash support on da850-evm DT kernel

2013-03-04 Thread Manjunathappa, Prakash
Patch enables support for m25p64 SPI flash support on
da850-EVM.

Testing information:
da850-evm comes with partitions specified in DT blob.
Able to mount/umount and create/delete files on filesystem partition.

Depends on below patch in spi-next branch of 
git://git.secretlab.ca/git/linux-2.6.git.
"spi/davinci: add OF support for the spi controller"

Applies on top of v3.9/dt-2 branch of linux_davinci tree:
git://gitorious.org/linux-davinci/linux-davinci.git

Since v1:
Look for m25p64 instead of m25p80 flash chip and correct partition information.

Dropping below accepted patch:
"spi/davinci: fix module build error"

Considered below missed out patch:
spi/davinci: add DT binding documentation

Manjunathappa, Prakash (3):
  ARM: davinci: da850: add SPI1 DT node
  ARM: davinci: da850: override SPI DT node device name
  ARM: davinci: da850-evm: add SPI flash support

Murali Karicheri (1):
  spi/davinci: add DT binding documentation

 .../devicetree/bindings/spi/spi-davinci.txt|   51 
 arch/arm/boot/dts/da850-evm.dts|   40 +++
 arch/arm/boot/dts/da850.dtsi   |   18 +++
 arch/arm/mach-davinci/da8xx-dt.c   |1 +
 4 files changed, 110 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/spi/spi-davinci.txt

-- 
1.7.4.1

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[PATCH v2 1/4] spi/davinci: add DT binding documentation

2013-03-04 Thread Manjunathappa, Prakash
From: Murali Karicheri 

Get back missed out binding documentation submitted along
with below patch:
"spi/davinci: add OF support for the spi controller"

Signed-off-by: Murali Karicheri 
Reviewed-by: Grant Likely 
Signed-off-by: Manjunathappa, Prakash 
---
Resubmitting it as it is missed out while merging.

 .../devicetree/bindings/spi/spi-davinci.txt|   51 
 1 files changed, 51 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/spi/spi-davinci.txt

diff --git a/Documentation/devicetree/bindings/spi/spi-davinci.txt 
b/Documentation/devicetree/bindings/spi/spi-davinci.txt
new file mode 100644
index 000..a62d7a8
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/spi-davinci.txt
@@ -0,0 +1,51 @@
+Davinci SPI controller device bindings
+
+Required properties:
+- #address-cells: number of cells required to define a chip select
+   address on the SPI bus. Should be set to 1.
+- #size-cells: should be zero.
+- compatible:
+   - "ti,dm644x-spi" for SPI used similar to that on DM644x SoC family
+   - "ti,da8xx-spi" for SPI used similar to that on DA8xx SoC family
+- reg: Offset and length of SPI controller register space
+- num-cs: Number of chip selects
+- ti,davinci-spi-intr-line: interrupt line used to connect the SPI
+   IP to the interrupt controller withn the SoC. Possible values
+   are 0 and 1. Manual says one of the two possible interrupt
+   lines can be tied to the interrupt controller. Set this
+   based on a specifc SoC configuration.
+- interrupts: interrupt number offset at the irq parent
+- clocks: spi clk phandle
+
+Example of a NOR flash slave device (n25q032) connected to DaVinci
+SPI controller device over the SPI bus.
+
+spi0:spi@20BF {
+   #address-cells   = <1>;
+   #size-cells  = <0>;
+   compatible   = "ti,dm644x-spi";
+   reg  = <0x20BF 0x1000>;
+   num-cs   = <4>;
+   ti,davinci-spi-intr-line= <0>;
+   interrupts   = <338>;
+   clocks   = <&clkspi>;
+
+   flash: n25q032@0 {
+#address-cells = <1>;
+#size-cells = <1>;
+compatible = "st,m25p32";
+spi-max-frequency = <2500>;
+reg = <0>;
+
+partition@0 {
+label = "u-boot-spl";
+reg = <0x0 0x8>;
+read-only;
+};
+
+partition@1 {
+label = "test";
+reg = <0x8 0x38>;
+};
+   };
+};
-- 
1.7.4.1

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[PATCH v2 2/4] ARM: davinci: da850: add SPI1 DT node

2013-03-04 Thread Manjunathappa, Prakash
Patch adds SPI1 DT node along with pinmux data.

Signed-off-by: Manjunathappa, Prakash 
---
 arch/arm/boot/dts/da850.dtsi |   18 ++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
index 3ec1bda..bfd6756 100644
--- a/arch/arm/boot/dts/da850.dtsi
+++ b/arch/arm/boot/dts/da850.dtsi
@@ -62,6 +62,14 @@
0x10 0x2200 0xff00
>;
};
+   spi1_pins: pinmux_spi_pins {
+   pinctrl-single,bits = <
+   /* SIMO, SOMI, ENA,
+* CLK, CS[0], CS[1]
+*/
+   0x14 0x0011 0x00ff
+   >;
+   };
};
serial0: serial@1c42000 {
compatible = "ns16550a";
@@ -107,6 +115,16 @@
reg = <0x21000 0x1000>;
status = "disabled";
};
+   spi1: spi@1f0e000 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "ti,da8xx-spi";
+   reg = <0x30e000 0x1000>;
+   num-cs = <4>;
+   ti,davinci-spi-intr-line = <1>;
+   interrupts = <56>;
+   status = "disabled";
+   };
};
nand_cs3@6200 {
compatible = "ti,davinci-nand";
-- 
1.7.4.1

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[PATCH v2 4/4] ARM: davinci: da850-evm: add SPI flash support

2013-03-04 Thread Manjunathappa, Prakash
Enable m25p64 SPI flash support on da850-EVM. Also
add partition information of SPI flash.

Signed-off-by: Manjunathappa, Prakash 
---
Since v1:
Look for m25p64 instead of m25p80.
Corrected the filesystem partition information.

 arch/arm/boot/dts/da850-evm.dts |   40 +++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
index c359872..3306d82 100644
--- a/arch/arm/boot/dts/da850-evm.dts
+++ b/arch/arm/boot/dts/da850-evm.dts
@@ -41,6 +41,46 @@
wdt: wdt@1c21000 {
status = "okay";
};
+   spi1: spi@1f0e000 {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <&spi1_pins>;
+   flash: m25p80@0 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "m25p64";
+   spi-max-frequency = <3000>;
+   reg = <0>;
+   partition@0 {
+   label = "U-Boot-SPL";
+   reg = <0x 0x0001>;
+   read-only;
+   };
+   partition@1 {
+   label = "U-Boot";
+   reg = <0x0001 0x0008>;
+   read-only;
+   };
+   partition@2 {
+   label = "U-Boot-Env";
+   reg = <0x0009 0x0001>;
+   read-only;
+   };
+   partition@3 {
+   label = "Kernel";
+   reg = <0x000a 0x0028>;
+   };
+   partition@4 {
+   label = "Filesystem";
+   reg = <0x0032 0x0040>;
+   };
+   partition@5 {
+   label = "MAC-Address";
+   reg = <0x0072 0x0001>;
+   read-only;
+   };
+   };
+   };
};
nand_cs3@6200 {
status = "okay";
-- 
1.7.4.1

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[PATCH v2 3/4] ARM: davinci: da850: override SPI DT node device name

2013-03-04 Thread Manjunathappa, Prakash
Populate OF_DEV_AUXDATA with desired device name expected by spi-davinci
driver. Without this clk_get of spi-davinci DT driver fails.

Signed-off-by: Manjunathappa, Prakash 
---
 arch/arm/mach-davinci/da8xx-dt.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
index 5404e92..05f142a 100644
--- a/arch/arm/mach-davinci/da8xx-dt.c
+++ b/arch/arm/mach-davinci/da8xx-dt.c
@@ -40,6 +40,7 @@ static void __init da8xx_init_irq(void)
 struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
OF_DEV_AUXDATA("ti,davinci-i2c", 0x01c22000, "i2c_davinci.1", NULL),
OF_DEV_AUXDATA("ti,davinci-wdt", 0x01c21000, "watchdog", NULL),
+   OF_DEV_AUXDATA("ti,da8xx-spi", 0x01f0e000, "spi_davinci.1", NULL),
{}
 };
 
-- 
1.7.4.1

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


RE: [PATCH 0/4] Enable SPI flash support on da850-evm DT kernel

2013-03-04 Thread Manjunathappa, Prakash
Hi Grant,

On Sun, Mar 03, 2013 at 04:43:55, Grant Likely wrote:
> On Wed, 27 Feb 2013 11:32:39 +, "Manjunathappa, Prakash" 
>  wrote:
> > On Wed, Feb 27, 2013 at 14:09:57, Nori, Sekhar wrote:
> > > On 2/25/2013 4:14 PM, Manjunathappa, Prakash wrote:
> > > > Patch enables support for m25p80 SPI flash support on
> > > > da850-EVM.
> > > > 
> > > > Testing information:
> > > > da850-evm comes with partitions specified in DT blob.
> > > > Able to mount/umount and create/delete files on filesystem partition.
> > > > 
> > > > Depends on below patch in spi-next branch of 
> > > > git://git.secretlab.ca/git/linux-2.6.git.
> > > > "spi/davinci: add OF support for the spi controller"
> > > > 
> > 
> > Grant,
> > I could not find binding documentation changes submitted with above patch.
> > I checked in spi-next and linux-next.
> 
> It must have been missed then. It happens sometimes. Can someone submit
> a fixup patch please?
> 

I have taken care in my next version of this series.

Thanks,
Prakash

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


RE: [PATCH v2 4/4] ARM: davinci: da850-evm: add SPI flash support

2013-03-04 Thread Manjunathappa, Prakash
On Mon, Mar 04, 2013 at 18:29:15, Manjunathappa, Prakash wrote:
> Enable m25p64 SPI flash support on da850-EVM. Also
> add partition information of SPI flash.
> 
> Signed-off-by: Manjunathappa, Prakash 
> ---
> Since v1:
> Look for m25p64 instead of m25p80.
> Corrected the filesystem partition information.
> 
>  arch/arm/boot/dts/da850-evm.dts |   40 
> +++
>  1 files changed, 40 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
> index c359872..3306d82 100644
> --- a/arch/arm/boot/dts/da850-evm.dts
> +++ b/arch/arm/boot/dts/da850-evm.dts
> @@ -41,6 +41,46 @@
>   wdt: wdt@1c21000 {
>   status = "okay";
>   };
> + spi1: spi@1f0e000 {
> + status = "okay";
> + pinctrl-names = "default";
> + pinctrl-0 = <&spi1_pins>;
> + flash: m25p80@0 {
> + #address-cells = <1>;
> + #size-cells = <1>;
> + compatible = "m25p64";
> + spi-max-frequency = <3000>;
> + reg = <0>;
> + partition@0 {
> + label = "U-Boot-SPL";
> + reg = <0x 0x0001>;
> + read-only;
> + };
> + partition@1 {
> + label = "U-Boot";
> + reg = <0x0001 0x0008>;
> + read-only;
> + };
> + partition@2 {
> + label = "U-Boot-Env";
> + reg = <0x0009 0x0001>;
> + read-only;
> + };
> + partition@3 {
> + label = "Kernel";
> + reg = <0x000a 0x0028>;
> + };
> + partition@4 {
> + label = "Filesystem";
> + reg = <0x0032 0x0040>;
> + };
> + partition@5 {
> + label = "MAC-Address";
> + reg = <0x0072 0x0001>;

Ah... MAC address is at the end of 8MB flash. Need to change above:
reg = <0x007f 0x0001>;
Will send v3 for this.

Thanks,
Prakash

> + read-only;
> + };
> + };
> + };
>   };
>   nand_cs3@6200 {
>   status = "okay";
> -- 
> 1.7.4.1
> 
> 

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


Re: [PATCH v2 1/4] spi/davinci: add DT binding documentation

2013-03-04 Thread Arnd Bergmann
On Monday 04 March 2013 18:29:12 Manjunathappa, Prakash wrote:
> diff --git a/Documentation/devicetree/bindings/spi/spi-davinci.txt 
> b/Documentation/devicetree/bindings/spi/spi-davinci.txt
> new file mode 100644
> index 000..a62d7a8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/spi/spi-davinci.txt
> @@ -0,0 +1,51 @@
> +Davinci SPI controller device bindings
> +
> +Required properties:
> +- #address-cells: number of cells required to define a chip select
> + address on the SPI bus. Should be set to 1.
> +- #size-cells: should be zero.
> +- compatible:
> + - "ti,dm644x-spi" for SPI used similar to that on DM644x SoC family
> + - "ti,da8xx-spi" for SPI used similar to that on DA8xx SoC family

In general, you should avoid wildcards in "compatible" properties.
Better use the number of the first chip that introduced the specific
version of the device.

> +- reg: Offset and length of SPI controller register space
> +- num-cs: Number of chip selects
> +- ti,davinci-spi-intr-line: interrupt line used to connect the SPI
> + IP to the interrupt controller withn the SoC. Possible values
> + are 0 and 1. Manual says one of the two possible interrupt
> + lines can be tied to the interrupt controller. Set this
> + based on a specifc SoC configuration.
> +- interrupts: interrupt number offset at the irq parent

I would not call this an "offset". It is an interrupt descriptor
which may be something other than a simple number.

Unfortunately, there is no way to provide an "invalid" interrupt,
otherwise you could just list both interrupts, out of which at
least one should be valid, and drop the ti,davinci-spi-intr-line
property.

One thing you could do instead though is to use the "interrupt-names"
property to define "irq0" and "irq1" interrupts, and in the
implementation use the first one you find.

Arnd
___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[PATCH] arm: davinci: fix edma dmaengine induced null pointer dereference on da830

2013-03-04 Thread Matt Porter
This adds additional error checking to the private edma api implementation
to catch the case where the edma_alloc_slot() has an invalid controller
parameter. The edma dmaengine wrapper driver relies on this condition
being handled in order to avoid setting up a second edma dmaengine
instance on DA830.

Verfied using a DA850 with the second EDMA controller platform instance
removed to simulate a DA830 which only has a single EDMA controller.

Reported-by: Tomas Novotny 
Signed-off-by: Matt Porter 
Cc: sta...@kernel.org
---
 arch/arm/mach-davinci/dma.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
index a685e97..f9eb836 100644
--- a/arch/arm/mach-davinci/dma.c
+++ b/arch/arm/mach-davinci/dma.c
@@ -747,6 +747,8 @@ int edma_alloc_slot(unsigned ctlr, int slot)
slot = EDMA_CHAN_SLOT(slot);
 
if (slot < 0) {
+   if (!edma_cc[ctlr])
+   return -EINVAL;
slot = edma_cc[ctlr]->num_channels;
for (;;) {
slot = find_next_zero_bit(edma_cc[ctlr]->edma_inuse,
-- 
1.7.9.5

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


Re: EDMA and kernel panic (null pointer) on da830

2013-03-04 Thread Matt Porter
On Tue, Feb 19, 2013 at 11:37:25AM +, Tomas Novotny wrote:
> On Tue, 19 Feb 2013 15:45:20 +0530, Sekhar Nori  wrote:
> > + LAKML and Matt
> > 
> > On 2/18/2013 9:09 PM, Tomas Novotny wrote:
> > >   Hi all,
> > > 
> > > I'm working on custom board based on AM1707, which is quite similar to
> > > EVM. Board file is derived from board-da830-evm.c.
> > >   I'm unable to boot because of null pointer access in edma after
> > > upgrading linux-davinci to v3.7-davinci1. The DMA was working in 3.3
> > > on my board.
> > >   The pointer is accessed in the arch/arm/mach-davinci/dma.c in
> > > function edma_alloc_slot on the line 750:
> > > slot = edma_cc[ctlr]->num_channels;
> > >   The problem is, that allocation is performed also with ctlr =
> > > 1, which shouldn't (?) be done on AM1707, as there is only one channel
> > > controller.
> > >   I can see the problem on v3.7-davinci1 and latest commit
> > > (c03f8ea25) in the linux-davinci. I don't have EVM now, so I can't
> > > check untouched v3.7-davinci1. But changes are done only in the board
> > > file and DMA related code is the same.
> > >   Is anybody here, who has similar issue? Or is it working for
> > > anybody here on the da830?
> > >   If you want, I can post more information. For beginning, kernel
> > > log is attached.
> > >   Thanks and best regards,
> > > 
> > >   Stoupa
> > > 
> > > DEBUG switched on in dma.c; added own print of pointer in the
> > > edma_alloc_slot:
> > > Booting Linux on physical CPU 0x0
> > > Linux version 3.8.0-rc7-08807-g00c74d8-dirty (tom@pcnovotny-t) (gcc 
> > > version 4.6.3 (Sourcery CodeBench Lite 2012.03-57) ) #118 PREEM...
> > > CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
> > > CPU: VIVT data cache, VIVT instruction cache
> > > Machine: ELKO EP iNELS Central Unit 3
> > > bootconsole [earlycon0] enabled
> > > Memory policy: ECC disabled, Data cache writeback
> > > DaVinci da830/omap-l137 rev2.0 variant 0x9
> > > On node 0 totalpages: 16384
> > > free_area_init_node: node 0, pgdat c038e0e0, node_mem_map c03ac000
> > >   DMA zone: 128 pages used for memmap
> > >   DMA zone: 0 pages reserved
> > >   DMA zone: 16256 pages, LIFO batch:3
> > > pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
> > > pcpu-alloc: [0] 0 
> > > Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
> > > Kernel command line: console=ttyS1,115200n8 noinitrd rw rootwait 
> > > rootfstype=jffs2 root=mtd3 mtdparts=davinci_nand.1:128k(u-boot_env)ro...
> > > PID hash table entries: 256 (order: -2, 1024 bytes)
> > > Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
> > > Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
> > > __ex_table already sorted, skipping sort
> > > Memory: 64MB = 64MB total
> > > Memory: 61168k/61168k available, 4368k reserved, 0K highmem
> > > Virtual kernel memory layout:
> > > vector  : 0x - 0x1000   (   4 kB)
> > > fixmap  : 0xfff0 - 0xfffe   ( 896 kB)
> > > vmalloc : 0xc480 - 0xff00   ( 936 MB)
> > > lowmem  : 0xc000 - 0xc400   (  64 MB)
> > >   .text : 0xc0008000 - 0xc03441c8   (3313 kB)
> > >   .init : 0xc0345000 - 0xc0365e00   ( 132 kB)
> > >   .data : 0xc0366000 - 0xc038eb60   ( 163 kB)
> > >.bss : 0xc038eb60 - 0xc03ab578   ( 115 kB)
> > > SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
> > > NR_IRQS:245
> > > sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956ms
> > > Calibrating delay loop... 148.88 BogoMIPS (lpj=78)
> > > pid_max: default: 32768 minimum: 301
> > > Mount-cache hash table entries: 512
> > > CPU: Testing write buffer coherency: ok
> > > Setting up static identity map for 0xc02af890 - 0xc02af8cc
> > > DaVinci: 128 gpio irqs
> > > NET: Registered protocol family 16
> > > DMA: preallocated 256 KiB pool for atomic coherent allocations
> > > edma edma: DMA REG BASE ADDR=fec0
> > > bio: create slab  at 0
> > > EDMA: edma_alloc_slot: edma_cc[ctlr]: c3847000
> > > edma-dma-engine edma-dma-engine.0: TI EDMA DMA engine driver
> > > EDMA: edma_alloc_slot: edma_cc[ctlr]:   (null)
> > > Unable to handle kernel NULL pointer dereference at virtual address 
> > > 
> > > pgd = c0004000
> > > [] *pgd=
> > > Internal error: Oops: 5 [#1] PREEMPT ARM
> > > CPU: 0Not tainted  (3.8.0-rc7-08807-g00c74d8-dirty #118)
> > > PC is at edma_alloc_slot+0x8c/0xf4
> > > LR is at edma_alloc_slot+0x84/0xf4
> > > pc : []lr : []psr: 6053
> > > sp : c3823e40  ip : 0001  fp : 
> > > r10: c034520c  r9 : c0365b9c  r8 : c0383908
> > > r7 : c038ee54  r6 : c038ee54  r5 : 0001  r4 : c386af10
> > > r3 : c3822000  r2 : 0001  r1 :   r0 : 
> > >  
> > > Flags: nZCv  IRQs on  FIQs off  Mode SVC_32  ISA ARM  Segment kernel  
> > >  
> > > Control: 0005317f  Table: c0004000  DAC: 0017 
> > >  
> > > Process swapper (pid: 1, s

DM6446 using multiple USB devices

2013-03-04 Thread Danny Marsh
I have read many posts and I am still unclear if there is a solution to our 
issue.

We are using a custom DM6446 board running Linux git kernel 3.0.0 with a 
TUSB2046B hub.

We are trying to hook up 2 usbnet devices (using the cdc_ethernet driver).

Each device needs the following EPs.

TUSB2046B - 1 Interrupt EP

USB Device 1 - 1 Interrupt EP + 2 Bulk EPs

USB Device 2 - 1 Interrupt EP + 2 Bulk EPs

1.  Is there a hardware limitation in the DM6446 that prevents us from doing 
this?

2.  Is there a software work around ("Interrupt endpoint scheduling")  that 
works with devices that need Interrupt EPs?  If so what kernel version do I 
need?

Thanks,
Danny
___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


Re: [PATCH v7 01/10] ARM: davinci: move private EDMA API to arm/common

2013-03-04 Thread Matt Porter
On Sat, Feb 09, 2013 at 09:35:53PM +0530, Sekhar Nori wrote:
> Hi Matt,
> 
> This version introduces build/bisect issues.

Ok, see later comment which addresses this...

> On 2/1/2013 11:52 PM, Matt Porter wrote:
> > Move mach-davinci/dma.c to common/edma.c so it can be used
> > by OMAP (specifically AM33xx) as well.
> > 
> > Signed-off-by: Matt Porter 
> > Acked-by: Sekhar Nori 
> 
> > diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/common/edma.c
> 
> > @@ -25,7 +25,7 @@
> >  #include 
> >  #include 
> >  
> > -#include 
> > +#include 
> 
> >  /*---*/
> > +static int edma_of_read_u32_to_s8_array(const struct device_node *np,
> > +const char *propname, s8 *out_values,
> > +size_t sz)
> > +{
> > +   int ret;
> > +
> > +   ret = of_property_read_u8_array(np, propname, out_values, sz);
> 
> This needs  to be included in this file.
> 
> > +static int edma_xbar_event_map(struct device *dev,
> > +  struct device_node *node,
> > +  struct edma_soc_info *pdata, int len)
> > +{
> > +   int ret = 0;
> > +   int i;
> > +   struct resource res;
> > +   void *xbar;
> > +   const s16 (*xbar_chans)[2];
> > +   u32 shift, offset, mux;
> > +
> > +   xbar_chans = devm_kzalloc(dev,
> > + len/sizeof(s16) + 2*sizeof(s16),
> > + GFP_KERNEL);
> > +   if (!xbar_chans)
> > +   return -ENOMEM;
> > +
> > +   ret = of_address_to_resource(node, 1, &res);
> 
> of_address_to_resource() needs 
> 
> > +   if (IS_ERR_VALUE(ret))
> 
> This needs 
> 
> > +   return -EIO;
> > +
> > +   xbar = devm_ioremap(dev, res.start, resource_size(&res));
> > +   if (!xbar)
> > +   return -ENOMEM;
> > +
> > +   ret = edma_of_read_u32_to_s16_array(node,
> > +   "ti,edma-xbar-event-map",
> > +   (s16 *)xbar_chans,
> > +   len/sizeof(u32));
> > +   if (IS_ERR_VALUE(ret))
> > +   return -EIO;
> > +
> > +   for (i = 0; xbar_chans[i][0] != -1; i++) {
> > +   shift = (xbar_chans[i][1] % 4) * 8;
> > +   offset = xbar_chans[i][1] >> 2;
> > +   offset <<= 2;
> > +   mux = readl((void *)((u32)xbar + offset));
> > +   mux &= ~(0xff << shift);
> > +   mux |= xbar_chans[i][0] << shift;
> > +   writel(mux, (void *)((u32)xbar + offset));
> > +   }
> > +
> > +   pdata->xbar_chans = xbar_chans;
> 
> There is no member xbar_chans ATM. It seems to be introduced in 03/10.
> 
> > +
> > +static struct of_dma_filter_info edma_filter_info = {
> 
> of_dma_filter_info needs .
> 
> > +   .filter_fn = edma_filter_fn,
> 
> edma_filter_fn needs 
> 
> BTW, I am not sure if you really intended to introduce EDMA DT support
> in this patch. I thought 1/10 was supposed to just move EDMA private API
> to a common place. If you really want to introduce DT support as well,
> that should be noted in the description. I think it is better done in a
> later patch.

This was a complete fubared rebase for this patch. As you noticed, I
got hunks from 3/10 in there and the bisect test didn't run so it was
missed. I've got this fixed up for v8 which address all these comments
that stem from that issue.

> > diff --git a/sound/soc/davinci/davinci-sffsdr.c 
> > b/sound/soc/davinci/davinci-sffsdr.c
> 
> > @@ -17,6 +17,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -28,12 +29,14 @@
> >  #include 
> >  #endif
> >  
> > -#include 
> >  
> >  #include "../codecs/pcm3008.h"
> >  #include "davinci-pcm.h"
> >  #include "davinci-i2s.h"
> >  
> > +#define DAVINCI_DMA_MCBSP_TX   2
> > +#define DAVINCI_DMA_MCBSP_RX   3
> > +
> >  /*
> >   * CLKX and CLKR are the inputs for the Sample Rate Generator.
> >   * FSX and FSR are outputs, driven by the sample Rate Generator.
> > @@ -124,7 +127,7 @@ static struct resource sffsdr_snd_resources[] = {
> >  
> >  static struct evm_snd_platform_data sffsdr_snd_data = {
> > .tx_dma_ch  = DAVINCI_DMA_MCBSP_TX,
> > -   .rx_dma_ch  = DAVINCI_DMA_MCBSP_RX,
> 
> > +   .rx_dma_ch  = DAVINCI_DMA_MCBAP_RX,
> 
> Typo here. Should be DAVINCI_DMA_MCBSP_RX. Unfortunately
> davinci-sffsdr.c seems to be broken already.

Ok, fixed..definitely shouldn't break it more.

-Matt
___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


Re: [PATCH v7 01/10] ARM: davinci: move private EDMA API to arm/common

2013-03-04 Thread Matt Porter
On Sat, Feb 09, 2013 at 08:08:50PM +, Russell King wrote:
> On Sat, Feb 09, 2013 at 09:35:53PM +0530, Sekhar Nori wrote:
> > On 2/1/2013 11:52 PM, Matt Porter wrote:
> > > + ret = of_address_to_resource(node, 1, &res);
> > 
> > of_address_to_resource() needs 
> > 
> > > + if (IS_ERR_VALUE(ret))
> > 
> > This needs 
> 
> More importantly, is this the correct way to check for errors from
> of_address_to_resource() ?  Grepping the source shows that either less
> than 0 or non-zero are the commonly used conditions here.

Yes, it's not correct. Fixed to check for non-zero/zero in the two cases
where of_address_to_resource() is used.

-Matt
___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


Re: [PATCH] arm: davinci: fix edma dmaengine induced null pointer dereference on da830

2013-03-04 Thread Sekhar Nori
Hi Matt,

I dropped the copy to stable folks since they dont want to be involved
in patch reviews of this kind.

On 3/4/2013 10:22 PM, Matt Porter wrote:
> This adds additional error checking to the private edma api implementation
> to catch the case where the edma_alloc_slot() has an invalid controller
> parameter. The edma dmaengine wrapper driver relies on this condition
> being handled in order to avoid setting up a second edma dmaengine
> instance on DA830.
> 
> Verfied using a DA850 with the second EDMA controller platform instance
> removed to simulate a DA830 which only has a single EDMA controller.
> 
> Reported-by: Tomas Novotny 
> Signed-off-by: Matt Porter 
> Cc: sta...@kernel.org

This should be sta...@vger.kernel.org per
Documentation/stable_kernel_rules.txt. Also, I think it is better to
request the back port only from v3.7.x+ since the bug is important only
after drivers/dma/edma.c was merged. So:

Cc: sta...@vger.kernel.org # v3.7.x+

> ---
>  arch/arm/mach-davinci/dma.c |2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
> index a685e97..f9eb836 100644
> --- a/arch/arm/mach-davinci/dma.c
> +++ b/arch/arm/mach-davinci/dma.c
> @@ -747,6 +747,8 @@ int edma_alloc_slot(unsigned ctlr, int slot)
>   slot = EDMA_CHAN_SLOT(slot);
>  
>   if (slot < 0) {
> + if (!edma_cc[ctlr])
> + return -EINVAL;

Shouldn't such a check be done outside of the if() since there is an
'else if' later which also accesses edma_cc[ctlr]

} else if (slot < edma_cc[ctlr]->num_channels ||
slot >= edma_cc[ctlr]->num_slots) {
return -EINVAL;

Thanks,
Sekhar
___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source