Re: [PATCH v6 06/10] media: Add registration helpers for V4L2 flash sub-devices

2015-04-28 Thread Sakari Ailus
Hi Jacek,

On Tue, Apr 28, 2015 at 09:18:46AM +0200, Jacek Anaszewski wrote:
...
 +enum ctrl_init_data_id {
 + LED_MODE,
 + TORCH_INTENSITY,
 + FLASH_INTENSITY,
 + INDICATOR_INTENSITY,
 + FLASH_TIMEOUT,
 + STROBE_SOURCE,
 + /*
 +  * Only above values are applicable to
 +  * the 'ctrls' array in the struct v4l2_flash.
 +  */
 + FLASH_STROBE,
 + STROBE_STOP,
 + STROBE_STATUS,
 + FLASH_FAULT,
 + NUM_FLASH_CTRLS,
 +};

How about moving these to the .c file and allocating space for struct
v4l2_flash.ctrls?

I don't object this enum as such, but the names are pretty generic and
there's a single instance of using them in the header which easily can be
avoided.

With this change,

Acked-by: Sakari Ailus sakari.ai...@linux.intel.com

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 05/10] leds: Add driver for AAT1290 flash LED controller

2015-04-28 Thread Sakari Ailus
On Tue, Apr 28, 2015 at 09:18:45AM +0200, Jacek Anaszewski wrote:
 This patch adds a driver for the 1.5A Step-Up Current Regulator
 for Flash LEDs. The device is programmed through a Skyworks proprietary
 AS2Cwire serial digital interface.
 
 Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
 Acked-by: Kyungmin Park kyungmin.p...@samsung.com
 Acked-by: Sakari Ailus sakari.ai...@linux.intel.com
 Cc: Bryan Wu coolo...@gmail.com
 Cc: Richard Purdie rpur...@rpsys.net

Acked-by: Sakari Ailus sakari.ai...@linux.intel.com

-- 
Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] radio-bcm2048: remove unused var

2015-04-28 Thread Pavel Machek
On Tue 2015-04-28 09:03:41, Mauro Carvalho Chehab wrote:
 drivers/staging/media/bcm2048/radio-bcm2048.c: In function 
 'bcm2048_i2c_driver_probe':
 drivers/staging/media/bcm2048/radio-bcm2048.c:2596:11: warning: variable 
 'skip_release' set but not used [-Wunused-but-set-variable]
   int err, skip_release = 0;
^
 
 Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

Acked-by: Pavel Machek pa...@ucw.cz

 diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c 
 b/drivers/staging/media/bcm2048/radio-bcm2048.c
 index e9d0691b21d3..5e11a78ceef3 100644
 --- a/drivers/staging/media/bcm2048/radio-bcm2048.c
 +++ b/drivers/staging/media/bcm2048/radio-bcm2048.c
 @@ -2593,7 +2593,7 @@ static int bcm2048_i2c_driver_probe(struct i2c_client 
 *client,
   const struct i2c_device_id *id)
  {
   struct bcm2048_device *bdev;
 - int err, skip_release = 0;
 + int err;
  
   bdev = kzalloc(sizeof(*bdev), GFP_KERNEL);
   if (!bdev) {
 @@ -2646,7 +2646,6 @@ free_sysfs:
   bcm2048_sysfs_unregister_properties(bdev, ARRAY_SIZE(attrs));
  free_registration:
   video_unregister_device(bdev-videodev);
 - skip_release = 1;
  free_irq:
   if (client-irq)
   free_irq(client-irq, bdev);

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 10/10] leds: aat1290: add support for V4L2 Flash sub-device

2015-04-28 Thread Sakari Ailus
Hi Jacek,

On Tue, Apr 28, 2015 at 09:18:50AM +0200, Jacek Anaszewski wrote:
 Add support for V4L2 Flash sub-device to the aat1290 LED Flash class
 driver. The support allows for V4L2 Flash sub-device to take the control
 of the LED Flash class device.
 
 Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
 Acked-by: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Bryan Wu coolo...@gmail.com
 Cc: Richard Purdie rpur...@rpsys.net
 Cc: Sakari Ailus sakari.ai...@iki.fi
 ---
  drivers/leds/Kconfig|1 +
  drivers/leds/leds-aat1290.c |  137 
 +--
  2 files changed, 132 insertions(+), 6 deletions(-)
 
 diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
 index dd7834c..874df63 100644
 --- a/drivers/leds/Kconfig
 +++ b/drivers/leds/Kconfig
 @@ -47,6 +47,7 @@ config LEDS_AAT1290
   depends on LEDS_CLASS_FLASH
   depends on GPIOLIB
   depends on OF
 + depends on PINCTRL
   help
This option enables support for the LEDs on the AAT1290.
  
 diff --git a/drivers/leds/leds-aat1290.c b/drivers/leds/leds-aat1290.c
 index 03e5b96..f37f848 100644
 --- a/drivers/leds/leds-aat1290.c
 +++ b/drivers/leds/leds-aat1290.c
 @@ -17,9 +17,11 @@
  #include linux/module.h
  #include linux/mutex.h
  #include linux/of.h
 +#include linux/pinctrl/consumer.h
  #include linux/platform_device.h
  #include linux/slab.h
  #include linux/workqueue.h
 +#include media/v4l2-flash-led-class.h
  
  #define AAT1290_MOVIE_MODE_CURRENT_ADDR  17
  #define AAT1290_MAX_MM_CURR_PERCENT_016
 @@ -52,6 +54,8 @@ struct aat1290_led_config_data {
   u32 max_flash_current;
   /* maximum flash timeout */
   u32 max_flash_tm;
 + /* external strobe capability */
 + bool has_external_strobe;
   /* max LED brightness level */
   enum led_brightness max_brightness;
  };
 @@ -64,6 +68,8 @@ struct aat1290_led {
  
   /* corresponding LED Flash class device */
   struct led_classdev_flash fled_cdev;
 + /* V4L2 Flash device */
 + struct v4l2_flash *v4l2_flash;
  
   /* FLEN pin */
   struct gpio_desc *gpio_fl_en;
 @@ -230,11 +236,15 @@ static int aat1290_led_flash_timeout_set(struct 
 led_classdev_flash *fled_cdev,
  }
  
  static int aat1290_led_parse_dt(struct aat1290_led *led,
 - struct aat1290_led_config_data *cfg)
 + struct aat1290_led_config_data *cfg,
 + struct device_node **sub_node)
  {
   struct led_classdev *led_cdev = led-fled_cdev.led_cdev;
   struct device *dev = led-pdev-dev;
   struct device_node *child_node;
 +#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
 + struct pinctrl *pinctrl;
 +#endif
   int ret = 0;
  
   led-gpio_fl_en = devm_gpiod_get(dev, flen);
 @@ -251,6 +261,17 @@ static int aat1290_led_parse_dt(struct aat1290_led *led,
   return ret;
   }
  
 +#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
 + pinctrl = devm_pinctrl_get_select_default(led-pdev-dev);
 + if (IS_ERR(pinctrl)) {
 + cfg-has_external_strobe = false;
 + dev_info(dev,
 +  No support for external strobe detected.\n);
 + } else {
 + cfg-has_external_strobe = true;
 + }
 +#endif
 +
   child_node = of_get_next_available_child(dev-of_node, NULL);
   if (!child_node) {
   dev_err(dev, No DT child node found for connected LED.\n);
 @@ -288,6 +309,8 @@ static int aat1290_led_parse_dt(struct aat1290_led *led,
  
   of_node_put(child_node);
  
 + *sub_node = child_node;
 +
   return ret;
  }
  
 @@ -316,7 +339,8 @@ int init_mm_current_scale(struct aat1290_led *led,
   int i, max_mm_current =
   AAT1290_MAX_MM_CURRENT(cfg-max_flash_current);
  
 - led-mm_current_scale = kzalloc(sizeof(max_mm_current_percent),
 + led-mm_current_scale = devm_kzalloc(led-pdev-dev,
 + sizeof(max_mm_current_percent),
   GFP_KERNEL);
   if (!led-mm_current_scale)
   return -ENOMEM;
 @@ -329,11 +353,12 @@ int init_mm_current_scale(struct aat1290_led *led,
  }
  
  static int aat1290_led_get_configuration(struct aat1290_led *led,
 - struct aat1290_led_config_data *cfg)
 + struct aat1290_led_config_data *cfg,
 + struct device_node **sub_node)
  {
   int ret;
  
 - ret = aat1290_led_parse_dt(led, cfg);
 + ret = aat1290_led_parse_dt(led, cfg, sub_node);
   if (ret  0)
   return ret;
   /*
 @@ -346,7 +371,10 @@ static int aat1290_led_get_configuration(struct 
 aat1290_led *led,
  
   aat1290_led_validate_mm_current(led, cfg);
  
 - kfree(led-mm_current_scale);
 +#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
 +#else
 + devm_kfree(led-pdev-dev, led-mm_current_scale);
 +#endif
  
   return 0;
  }
 @@ -365,6 +393,83 

[PATCH 05/13] lgdt3306a: fix indentation

2015-04-28 Thread Mauro Carvalho Chehab
drivers/media/dvb-frontends/lgdt3306a.c:2104 lgdt3306a_DumpRegs() warn: 
inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/dvb-frontends/lgdt3306a.c 
b/drivers/media/dvb-frontends/lgdt3306a.c
index d9a2b0e768e0..0e2e43e9ede5 100644
--- a/drivers/media/dvb-frontends/lgdt3306a.c
+++ b/drivers/media/dvb-frontends/lgdt3306a.c
@@ -2101,7 +2101,7 @@ static void lgdt3306a_DumpRegs(struct lgdt3306a_state 
*state)
lgdt3306a_read_reg(state, regtab[i], regval1[i]);
if (regval1[i] != regval2[i]) {
lg_debug( %04X = %02X\n, regtab[i], regval1[i]);
-regval2[i] = regval1[i];
+   regval2[i] = regval1[i];
}
}
debug = sav_debug;
-- 
2.1.0

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


[PATCH 02/13] benq: fix indentation

2015-04-28 Thread Mauro Carvalho Chehab
drivers/media/usb/gspca/benq.c:239 sd_isoc_irq() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/usb/gspca/benq.c b/drivers/media/usb/gspca/benq.c
index 05f406deae13..790baed33963 100644
--- a/drivers/media/usb/gspca/benq.c
+++ b/drivers/media/usb/gspca/benq.c
@@ -236,8 +236,8 @@ static void sd_isoc_irq(struct urb *urb)
}
data = (u8 *) urb-transfer_buffer
+ urb-iso_frame_desc[i].offset;
-   gspca_frame_add(gspca_dev, INTER_PACKET,
-   data, SD_PKT_SZ);
+   gspca_frame_add(gspca_dev, INTER_PACKET,
+   data, SD_PKT_SZ);
}
 
/* resubmit the URBs */
-- 
2.1.0

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


[PATCH 04/13] dib3000mc: Fix indentation

2015-04-28 Thread Mauro Carvalho Chehab
drivers/media/dvb-frontends/dib3000mc.c:134 dib3000mc_setup_pwm_state() warn: 
inconsistent indenting
drivers/media/dvb-frontends/dib3000mc.c:144 dib3000mc_setup_pwm_state() warn: 
inconsistent indenting
drivers/media/dvb-frontends/dib3000mc.c:420 dib3000mc_sleep() warn: 
inconsistent indenting
drivers/media/dvb-frontends/dib3000mc.c:453 dib3000mc_set_channel_cfg() warn: 
inconsistent indenting

The last one is actually due to a commented code. Let's rework
it, in order to remove the sparse warning without removing the
dead code, as it may be useful in the future.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/dvb-frontends/dib3000mc.c 
b/drivers/media/dvb-frontends/dib3000mc.c
index ffad181a9692..ba5e832eb1d4 100644
--- a/drivers/media/dvb-frontends/dib3000mc.c
+++ b/drivers/media/dvb-frontends/dib3000mc.c
@@ -131,7 +131,7 @@ static int dib3000mc_set_timing(struct dib3000mc_state 
*state, s16 nfft, u32 bw,
 static int dib3000mc_setup_pwm_state(struct dib3000mc_state *state)
 {
u16 reg_51, reg_52 = state-cfg-agc-setup  0xfefb;
-if (state-cfg-pwm3_inversion) {
+   if (state-cfg-pwm3_inversion) {
reg_51 =  (2  14) | (0  10) | (7  6) | (2  2) | (2  
0);
reg_52 |= (1  2);
} else {
@@ -141,7 +141,7 @@ static int dib3000mc_setup_pwm_state(struct dib3000mc_state 
*state)
dib3000mc_write_word(state, 51, reg_51);
dib3000mc_write_word(state, 52, reg_52);
 
-if (state-cfg-use_pwm3)
+   if (state-cfg-use_pwm3)
dib3000mc_write_word(state, 245, (1  3) | (1  0));
else
dib3000mc_write_word(state, 245, 0);
@@ -417,7 +417,7 @@ static int dib3000mc_sleep(struct dvb_frontend *demod)
dib3000mc_write_word(state, 1032, 0x);
dib3000mc_write_word(state, 1033, 0xFFF0);
 
-return 0;
+   return 0;
 }
 
 static void dib3000mc_set_adp_cfg(struct dib3000mc_state *state, s16 qam)
@@ -447,10 +447,14 @@ static void dib3000mc_set_channel_cfg(struct 
dib3000mc_state *state,
dib3000mc_set_bandwidth(state, bw);
dib3000mc_set_timing(state, ch-transmission_mode, bw, 0);
 
-// if (boost)
-// dib3000mc_write_word(state, 100, (11  6) + 6);
-// else
+#if 1
+   dib3000mc_write_word(state, 100, (16  6) + 9);
+#else
+   if (boost)
+   dib3000mc_write_word(state, 100, (11  6) + 6);
+   else
dib3000mc_write_word(state, 100, (16  6) + 9);
+#endif
 
dib3000mc_write_word(state, 1027, 0x0800);
dib3000mc_write_word(state, 1027, 0x);
-- 
2.1.0

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


[PATCH 07/13] s5h1420: fix a buffer overflow when checking userspace params

2015-04-28 Thread Mauro Carvalho Chehab
The maximum size for a DiSEqC command is 6, according to the
userspace API. However, the code allows to write up to 7 values:
drivers/media/dvb-frontends/s5h1420.c:193 s5h1420_send_master_cmd() 
error: buffer overflow 'cmd-msg' 6 = 7

Cc: sta...@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/dvb-frontends/s5h1420.c 
b/drivers/media/dvb-frontends/s5h1420.c
index 93eeaf7118fd..0b4f8fe6bf99 100644
--- a/drivers/media/dvb-frontends/s5h1420.c
+++ b/drivers/media/dvb-frontends/s5h1420.c
@@ -180,7 +180,7 @@ static int s5h1420_send_master_cmd (struct dvb_frontend* fe,
int result = 0;
 
dprintk(enter %s\n, __func__);
-   if (cmd-msg_len  8)
+   if (cmd-msg_len  sizeof(cmd-msg))
return -EINVAL;
 
/* setup for DISEQC */
-- 
2.1.0

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


[PATCH 08/13] cx24116: fix a buffer overflow when checking userspace params

2015-04-28 Thread Mauro Carvalho Chehab
The maximum size for a DiSEqC command is 6, according to the
userspace API. However, the code allows to write up much more values:
drivers/media/dvb-frontends/cx24116.c:983 cx24116_send_diseqc_msg() 
error: buffer overflow 'd-msg' 6 = 23

Cc: sta...@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/dvb-frontends/cx24116.c 
b/drivers/media/dvb-frontends/cx24116.c
index 2916d7c74a1d..7bc68b355c0b 100644
--- a/drivers/media/dvb-frontends/cx24116.c
+++ b/drivers/media/dvb-frontends/cx24116.c
@@ -963,6 +963,10 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend *fe,
struct cx24116_state *state = fe-demodulator_priv;
int i, ret;
 
+   /* Validate length */
+   if (d-msg_len  sizeof(d-msg))
+return -EINVAL;
+
/* Dump DiSEqC message */
if (debug) {
printk(KERN_INFO cx24116: %s(, __func__);
@@ -974,10 +978,6 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend *fe,
printk() toneburst=%d\n, toneburst);
}
 
-   /* Validate length */
-   if (d-msg_len  (CX24116_ARGLEN - CX24116_DISEQC_MSGOFS))
-   return -EINVAL;
-
/* DiSEqC message */
for (i = 0; i  d-msg_len; i++)
state-dsec_cmd.args[CX24116_DISEQC_MSGOFS + i] = d-msg[i];
-- 
2.1.0

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


[PATCH 03/13] bcm3510: fix indentation

2015-04-28 Thread Mauro Carvalho Chehab
drivers/media/dvb-frontends/bcm3510.c:688 bcm3510_reset() warn: inconsistent 
indenting
drivers/media/dvb-frontends/bcm3510.c:711 bcm3510_clear_reset() warn: 
inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/dvb-frontends/bcm3510.c 
b/drivers/media/dvb-frontends/bcm3510.c
index 638c7aa0fb7e..23bfd00d42db 100644
--- a/drivers/media/dvb-frontends/bcm3510.c
+++ b/drivers/media/dvb-frontends/bcm3510.c
@@ -685,7 +685,7 @@ static int bcm3510_reset(struct bcm3510_state *st)
if ((ret = bcm3510_writeB(st,0xa0,v))  0)
return ret;
 
-t = jiffies + 3*HZ;
+   t = jiffies + 3*HZ;
while (time_before(jiffies, t)) {
msleep(10);
if ((ret = bcm3510_readB(st,0xa2,v))  0)
@@ -708,7 +708,7 @@ static int bcm3510_clear_reset(struct bcm3510_state *st)
if ((ret = bcm3510_writeB(st,0xa0,v))  0)
return ret;
 
-t = jiffies + 3*HZ;
+   t = jiffies + 3*HZ;
while (time_before(jiffies, t)) {
msleep(10);
if ((ret = bcm3510_readB(st,0xa2,v))  0)
-- 
2.1.0

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


[PATCH 06/13] stv0288: fix indentation

2015-04-28 Thread Mauro Carvalho Chehab
drivers/media/dvb-frontends/stv0288.c:137 stv0288_set_symbolrate() warn: 
inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/dvb-frontends/stv0288.c 
b/drivers/media/dvb-frontends/stv0288.c
index 632b25156e4c..ecf4bb3a3b6b 100644
--- a/drivers/media/dvb-frontends/stv0288.c
+++ b/drivers/media/dvb-frontends/stv0288.c
@@ -134,20 +134,20 @@ static int stv0288_set_symbolrate(struct dvb_frontend 
*fe, u32 srate)
 
temp = (unsigned int)srate / 1000;
 
-   temp = temp * 32768;
-   temp = temp / 25;
-   temp = temp / 125;
-   b[0] = (unsigned char)((temp  12)  0xff);
-   b[1] = (unsigned char)((temp  4)  0xff);
-   b[2] = (unsigned char)((temp  4)  0xf0);
-   stv0288_writeregI(state, 0x28, 0x80); /* SFRH */
-   stv0288_writeregI(state, 0x29, 0); /* SFRM */
-   stv0288_writeregI(state, 0x2a, 0); /* SFRL */
+   temp = temp * 32768;
+   temp = temp / 25;
+   temp = temp / 125;
+   b[0] = (unsigned char)((temp  12)  0xff);
+   b[1] = (unsigned char)((temp  4)  0xff);
+   b[2] = (unsigned char)((temp  4)  0xf0);
+   stv0288_writeregI(state, 0x28, 0x80); /* SFRH */
+   stv0288_writeregI(state, 0x29, 0); /* SFRM */
+   stv0288_writeregI(state, 0x2a, 0); /* SFRL */
 
-   stv0288_writeregI(state, 0x28, b[0]);
-   stv0288_writeregI(state, 0x29, b[1]);
-   stv0288_writeregI(state, 0x2a, b[2]);
-   dprintk(stv0288: stv0288_set_symbolrate\n);
+   stv0288_writeregI(state, 0x28, b[0]);
+   stv0288_writeregI(state, 0x29, b[1]);
+   stv0288_writeregI(state, 0x2a, b[2]);
+   dprintk(stv0288: stv0288_set_symbolrate\n);
 
return 0;
 }
-- 
2.1.0

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


[PATCH 01/13] go7007: don't use vb before test if it is not NULL

2015-04-28 Thread Mauro Carvalho Chehab
As reported by smatch:
drivers/media/usb/go7007/go7007-driver.c:452 frame_boundary() warn: 
variable dereferenced before check 'vb' (see line 449)

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/usb/go7007/go7007-driver.c 
b/drivers/media/usb/go7007/go7007-driver.c
index 95cffb771a62..0ab81ec8897a 100644
--- a/drivers/media/usb/go7007/go7007-driver.c
+++ b/drivers/media/usb/go7007/go7007-driver.c
@@ -446,7 +446,7 @@ static void go7007_motion_regions(struct go7007 *go, struct 
go7007_buffer *vb)
  */
 static struct go7007_buffer *frame_boundary(struct go7007 *go, struct 
go7007_buffer *vb)
 {
-   u32 *bytesused = vb-vb.v4l2_planes[0].bytesused;
+   u32 *bytesused;
struct go7007_buffer *vb_tmp = NULL;
 
if (vb == NULL) {
@@ -458,6 +458,7 @@ static struct go7007_buffer *frame_boundary(struct go7007 
*go, struct go7007_buf
go-next_seq++;
return vb;
}
+   bytesused = vb-vb.v4l2_planes[0].bytesused;
 
vb-vb.v4l2_buf.sequence = go-next_seq++;
if (vb-modet_active  *bytesused + 216  GO7007_BUF_SIZE)
-- 
2.1.0

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


Re: [PATCH v6 02/10] DT: Add documentation for the mfd Maxim max77693

2015-04-28 Thread Bryan Wu
On Tue, Apr 28, 2015 at 3:09 AM, Lee Jones lee.jo...@linaro.org wrote:
 On Tue, 28 Apr 2015, Jacek Anaszewski wrote:

 This patch adds device tree binding documentation for
 the flash cell of the Maxim max77693 multifunctional device.

 Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
 Signed-off-by: Andrzej Hajda a.ha...@samsung.com
 Acked-by: Kyungmin Park kyungmin.p...@samsung.com
 Acked-by: Sakari Ailus sakari.ai...@linux.intel.com
 Cc: Lee Jones lee.jo...@linaro.org
 Cc: Chanwoo Choi cw00.c...@samsung.com
 Cc: Bryan Wu coolo...@gmail.com
 Cc: Richard Purdie rpur...@rpsys.net
 Cc: devicet...@vger.kernel.org
 ---
  Documentation/devicetree/bindings/mfd/max77693.txt |   67 
 
  1 file changed, 67 insertions(+)

 Requires a LED Ack.


Please go with my Ack:

Acked-by: Bryan Wu coolo...@gmail.com

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


[PATCH 09/13] af9013: Don't accept invalid bandwidth

2015-04-28 Thread Mauro Carvalho Chehab
If userspace sends an invalid bandwidth, it should either return
EINVAL or switch to auto mode.

This driver will go past an array and program the hardware on a
wrong way if this happens.

Cc: sta...@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/dvb-frontends/af9013.c 
b/drivers/media/dvb-frontends/af9013.c
index 8001690d7576..ba6c8f6c42a1 100644
--- a/drivers/media/dvb-frontends/af9013.c
+++ b/drivers/media/dvb-frontends/af9013.c
@@ -605,6 +605,10 @@ static int af9013_set_frontend(struct dvb_frontend *fe)
}
}
 
+   /* Return an error if can't find bandwidth or the right clock */
+   if (i == ARRAY_SIZE(coeff_lut))
+   return -EINVAL;
+
ret = af9013_wr_regs(state, 0xae00, coeff_lut[i].val,
sizeof(coeff_lut[i].val));
}
-- 
2.1.0

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


[PATCH 13/13] vivid-radio-rx: Don't go past buffer

2015-04-28 Thread Mauro Carvalho Chehab
drivers/media/platform/vivid/vivid-radio-rx.c:198 
vivid_radio_rx_s_hw_freq_seek() error: buffer overflow 'vivid_radio_bands' 3 = 
3

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/platform/vivid/vivid-radio-rx.c 
b/drivers/media/platform/vivid/vivid-radio-rx.c
index c7651a506668..f99092ca8f5c 100644
--- a/drivers/media/platform/vivid/vivid-radio-rx.c
+++ b/drivers/media/platform/vivid/vivid-radio-rx.c
@@ -195,6 +195,8 @@ int vivid_radio_rx_s_hw_freq_seek(struct file *file, void 
*fh, const struct v4l2
if (dev-radio_rx_freq = 
vivid_radio_bands[band].rangelow 
dev-radio_rx_freq = 
vivid_radio_bands[band].rangehigh)
break;
+   if (band == TOT_BANDS)
+   return -EINVAL;
low = vivid_radio_bands[band].rangelow;
high = vivid_radio_bands[band].rangehigh;
}
-- 
2.1.0

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


[PATCH 12/13] zc3xx: remove dead code and uneeded gotos

2015-04-28 Thread Mauro Carvalho Chehab
As reported by smatch:
drivers/media/usb/gspca/zc3xx.c:5994 transfer_update() info: ignoring 
unreachable code.

That happens because there's a return that it is never called,
as the work queue runs an infinite loop, except when the device is
put to sleep or an error happens.

When an error happens, a break statement is enough to go out of
the loop. So, let's remove the goto, as break is the typical
instruction used to end a loop.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/usb/gspca/zc3xx.c b/drivers/media/usb/gspca/zc3xx.c
index 3762a045f744..c5d8ee6fa3c7 100644
--- a/drivers/media/usb/gspca/zc3xx.c
+++ b/drivers/media/usb/gspca/zc3xx.c
@@ -5942,23 +5942,23 @@ static void transfer_update(struct work_struct *work)
reg07 = 0;
 
good = 0;
-   for (;;) {
+   while (1) {
msleep(100);
 
/* To protect gspca_dev-usb_buf and gspca_dev-usb_err */
mutex_lock(gspca_dev-usb_lock);
 #ifdef CONFIG_PM
if (gspca_dev-frozen)
-   goto err;
+   break;
 #endif
if (!gspca_dev-present || !gspca_dev-streaming)
-   goto err;
+   break;
 
/* Bit 0 of register 11 indicates FIFO overflow */
gspca_dev-usb_err = 0;
reg11 = reg_r(gspca_dev, 0x0011);
if (gspca_dev-usb_err)
-   goto err;
+   break;
 
change = reg11  0x01;
if (change) {   /* overflow */
@@ -5987,12 +5987,12 @@ static void transfer_update(struct work_struct *work)
gspca_dev-usb_err = 0;
reg_w(gspca_dev, reg07, 0x0007);
if (gspca_dev-usb_err)
-   goto err;
+   break;
}
mutex_unlock(gspca_dev-usb_lock);
}
-   return;
-err:
+
+   /* Something went wrong. Unlock and return */
mutex_unlock(gspca_dev-usb_lock);
 }
 
-- 
2.1.0

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


[PATCH 11/13] zc3xx: don't go past quality array

2015-04-28 Thread Mauro Carvalho Chehab
drivers/media/usb/gspca/zc3xx.c:6363 zcxx_s_ctrl() error: buffer overflow 
'jpeg_qual' 3 = 3

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/usb/gspca/zc3xx.c b/drivers/media/usb/gspca/zc3xx.c
index d3e1b6d8bf49..3762a045f744 100644
--- a/drivers/media/usb/gspca/zc3xx.c
+++ b/drivers/media/usb/gspca/zc3xx.c
@@ -6360,7 +6360,7 @@ static int zcxx_s_ctrl(struct v4l2_ctrl *ctrl)
if (ctrl-val = jpeg_qual[i])
break;
}
-   if (i  0  i == qual  ctrl-val  jpeg_qual[i])
+   if (i == ARRAY_SIZE(jpeg_qual) || (i  0  i == qual  
ctrl-val  jpeg_qual[i]))
i--;
 
/* With high quality settings we need max bandwidth */
-- 
2.1.0

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


[PATCH 10/13] cx24117: fix a buffer overflow when checking userspace params

2015-04-28 Thread Mauro Carvalho Chehab
The maximum size for a DiSEqC command is 6, according to the
userspace API. However, the code allows to write up much more values:
drivers/media/dvb-frontends/cx24116.c:983 cx24116_send_diseqc_msg() 
error: buffer overflow 'd-msg' 6 = 23

Cc: sta...@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/dvb-frontends/cx24117.c 
b/drivers/media/dvb-frontends/cx24117.c
index acb965ce0358..af6363573efd 100644
--- a/drivers/media/dvb-frontends/cx24117.c
+++ b/drivers/media/dvb-frontends/cx24117.c
@@ -1043,7 +1043,7 @@ static int cx24117_send_diseqc_msg(struct dvb_frontend 
*fe,
dev_dbg(state-priv-i2c-dev, )\n);
 
/* Validate length */
-   if (d-msg_len  15)
+   if (d-msg_len  sizeof(d-msg))
return -EINVAL;
 
/* DiSEqC message */
-- 
2.1.0

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


[PATCH 08/13] cx24116: fix a buffer overflow when checking userspace params

2015-04-28 Thread Mauro Carvalho Chehab
The maximum size for a DiSEqC command is 6, according to the
userspace API. However, the code allows to write up much more values:
drivers/media/dvb-frontends/cx24116.c:983 cx24116_send_diseqc_msg() 
error: buffer overflow 'd-msg' 6 = 23

Cc: sta...@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/dvb-frontends/cx24116.c 
b/drivers/media/dvb-frontends/cx24116.c
index 2916d7c74a1d..7bc68b355c0b 100644
--- a/drivers/media/dvb-frontends/cx24116.c
+++ b/drivers/media/dvb-frontends/cx24116.c
@@ -963,6 +963,10 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend *fe,
struct cx24116_state *state = fe-demodulator_priv;
int i, ret;
 
+   /* Validate length */
+   if (d-msg_len  sizeof(d-msg))
+return -EINVAL;
+
/* Dump DiSEqC message */
if (debug) {
printk(KERN_INFO cx24116: %s(, __func__);
@@ -974,10 +978,6 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend *fe,
printk() toneburst=%d\n, toneburst);
}
 
-   /* Validate length */
-   if (d-msg_len  (CX24116_ARGLEN - CX24116_DISEQC_MSGOFS))
-   return -EINVAL;
-
/* DiSEqC message */
for (i = 0; i  d-msg_len; i++)
state-dsec_cmd.args[CX24116_DISEQC_MSGOFS + i] = d-msg[i];
-- 
2.1.0

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


Re: [PATCH v6 05/10] leds: Add driver for AAT1290 flash LED controller

2015-04-28 Thread Bryan Wu
On Tue, Apr 28, 2015 at 4:36 AM, Sakari Ailus sakari.ai...@iki.fi wrote:
 On Tue, Apr 28, 2015 at 09:18:45AM +0200, Jacek Anaszewski wrote:
 This patch adds a driver for the 1.5A Step-Up Current Regulator
 for Flash LEDs. The device is programmed through a Skyworks proprietary
 AS2Cwire serial digital interface.

 Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
 Acked-by: Kyungmin Park kyungmin.p...@samsung.com
 Acked-by: Sakari Ailus sakari.ai...@linux.intel.com
 Cc: Bryan Wu coolo...@gmail.com
 Cc: Richard Purdie rpur...@rpsys.net

 Acked-by: Sakari Ailus sakari.ai...@linux.intel.com

Applied, thanks,
-Bryan

 --
 Sakari Ailus
 e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 01/10] leds: unify the location of led-trigger API

2015-04-28 Thread Bryan Wu
On Tue, Apr 28, 2015 at 12:18 AM, Jacek Anaszewski
j.anaszew...@samsung.com wrote:
 Part of led-trigger API was in the private drivers/leds/leds.h header.
 Move it to the include/linux/leds.h header to unify the API location
 and announce it as public. It has been already exported from
 led-triggers.c with EXPORT_SYMBOL_GPL macro. The no-op definitions are
 changed from macros to inline to match the style of the surrounding code.

 Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
 Cc: Bryan Wu coolo...@gmail.com
 Cc: Richard Purdie rpur...@rpsys.net
 Acked-by: Sakari Ailus sakari.ai...@linux.intel.com

Applied, thanks,
-Bryan

 ---
  drivers/leds/leds.h  |   24 
  include/linux/leds.h |   25 +
  2 files changed, 25 insertions(+), 24 deletions(-)

 diff --git a/drivers/leds/leds.h b/drivers/leds/leds.h
 index 79efe57..bc89d7a 100644
 --- a/drivers/leds/leds.h
 +++ b/drivers/leds/leds.h
 @@ -13,7 +13,6 @@
  #ifndef __LEDS_H_INCLUDED
  #define __LEDS_H_INCLUDED

 -#include linux/device.h
  #include linux/rwsem.h
  #include linux/leds.h

 @@ -50,27 +49,4 @@ void led_stop_software_blink(struct led_classdev 
 *led_cdev);
  extern struct rw_semaphore leds_list_lock;
  extern struct list_head leds_list;

 -#ifdef CONFIG_LEDS_TRIGGERS
 -void led_trigger_set_default(struct led_classdev *led_cdev);
 -void led_trigger_set(struct led_classdev *led_cdev,
 -   struct led_trigger *trigger);
 -void led_trigger_remove(struct led_classdev *led_cdev);
 -
 -static inline void *led_get_trigger_data(struct led_classdev *led_cdev)
 -{
 -   return led_cdev-trigger_data;
 -}
 -
 -#else
 -#define led_trigger_set_default(x) do {} while (0)
 -#define led_trigger_set(x, y) do {} while (0)
 -#define led_trigger_remove(x) do {} while (0)
 -#define led_get_trigger_data(x) (NULL)
 -#endif
 -
 -ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr,
 -   const char *buf, size_t count);
 -ssize_t led_trigger_show(struct device *dev, struct device_attribute *attr,
 -   char *buf);
 -
  #endif /* __LEDS_H_INCLUDED */
 diff --git a/include/linux/leds.h b/include/linux/leds.h
 index 9a2b000..b122eea 100644
 --- a/include/linux/leds.h
 +++ b/include/linux/leds.h
 @@ -12,6 +12,7 @@
  #ifndef __LINUX_LEDS_H_INCLUDED
  #define __LINUX_LEDS_H_INCLUDED

 +#include linux/device.h
  #include linux/list.h
  #include linux/mutex.h
  #include linux/rwsem.h
 @@ -222,6 +223,11 @@ struct led_trigger {
 struct list_head  next_trig;
  };

 +ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr,
 +   const char *buf, size_t count);
 +ssize_t led_trigger_show(struct device *dev, struct device_attribute *attr,
 +   char *buf);
 +
  /* Registration functions for complex triggers */
  extern int led_trigger_register(struct led_trigger *trigger);
  extern void led_trigger_unregister(struct led_trigger *trigger);
 @@ -238,6 +244,16 @@ extern void led_trigger_blink_oneshot(struct led_trigger 
 *trigger,
   unsigned long *delay_on,
   unsigned long *delay_off,
   int invert);
 +extern void led_trigger_set_default(struct led_classdev *led_cdev);
 +extern void led_trigger_set(struct led_classdev *led_cdev,
 +   struct led_trigger *trigger);
 +extern void led_trigger_remove(struct led_classdev *led_cdev);
 +
 +static inline void *led_get_trigger_data(struct led_classdev *led_cdev)
 +{
 +   return led_cdev-trigger_data;
 +}
 +
  /**
   * led_trigger_rename_static - rename a trigger
   * @name: the new trigger name
 @@ -267,6 +283,15 @@ static inline void led_trigger_register_simple(const 
 char *name,
  static inline void led_trigger_unregister_simple(struct led_trigger 
 *trigger) {}
  static inline void led_trigger_event(struct led_trigger *trigger,
 enum led_brightness event) {}
 +static inline void led_trigger_set_default(struct led_classdev *led_cdev) {}
 +static inline void led_trigger_set(struct led_classdev *led_cdev,
 +   struct led_trigger *trigger) {}
 +static inline void led_trigger_remove(struct led_classdev *led_cdev) {}
 +static inline void *led_get_trigger_data(struct led_classdev *led_cdev)
 +{
 +   return NULL;
 +}
 +
  #endif /* CONFIG_LEDS_TRIGGERS */

  /* Trigger specific functions */
 --
 1.7.9.5

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


Re: [PATCH 02/14] cx18: avoid going past input/audio array

2015-04-28 Thread Andy Walls
On April 28, 2015 11:43:41 AM EDT, Mauro Carvalho Chehab 
mche...@osg.samsung.com wrote:
As reported by smatch:
   drivers/media/pci/cx18/cx18-driver.c:807 cx18_init_struct2() error:
buffer overflow 'cx-card-video_inputs' 6 = 6

That happens because nof_inputs and nof_audio_inputs can be initialized
as CX18_CARD_MAX_VIDEO_INPUTS, instead of CX18_CARD_MAX_VIDEO_INPUTS -
1.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/pci/cx18/cx18-driver.c
b/drivers/media/pci/cx18/cx18-driver.c
index 83f5074706f9..260e462d91b4 100644
--- a/drivers/media/pci/cx18/cx18-driver.c
+++ b/drivers/media/pci/cx18/cx18-driver.c
@@ -786,11 +786,11 @@ static void cx18_init_struct2(struct cx18 *cx)
 {
   int i;
 
-  for (i = 0; i  CX18_CARD_MAX_VIDEO_INPUTS; i++)
+  for (i = 0; i  CX18_CARD_MAX_VIDEO_INPUTS - 1; i++)
   if (cx-card-video_inputs[i].video_type == 0)
   break;
   cx-nof_inputs = i;
-  for (i = 0; i  CX18_CARD_MAX_AUDIO_INPUTS; i++)
+  for (i = 0; i  CX18_CARD_MAX_AUDIO_INPUTS - 1; i++)
   if (cx-card-audio_inputs[i].audio_type == 0)
   break;
   cx-nof_audio_inputs = i;

Acked-by: Andy Walls awa...@md.metrocast.net
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 04/10] DT: Add documentation for the Skyworks AAT1290

2015-04-28 Thread Bryan Wu
On Tue, Apr 28, 2015 at 12:18 AM, Jacek Anaszewski
j.anaszew...@samsung.com wrote:
 This patch adds device tree binding documentation for
 1.5A Step-Up Current Regulator for Flash LEDs.


Applied, thanks,
-Bryan

 Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
 Acked-by: Kyungmin Park kyungmin.p...@samsung.com
 Acked-by: Sakari Ailus sakari.ai...@linux.intel.com
 Cc: Bryan Wu coolo...@gmail.com
 Cc: Richard Purdie rpur...@rpsys.net
 Cc: devicet...@vger.kernel.org
 ---
  .../devicetree/bindings/leds/leds-aat1290.txt  |   41 
 
  1 file changed, 41 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/leds/leds-aat1290.txt

 diff --git a/Documentation/devicetree/bindings/leds/leds-aat1290.txt 
 b/Documentation/devicetree/bindings/leds/leds-aat1290.txt
 new file mode 100644
 index 000..ef88b9c
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/leds/leds-aat1290.txt
 @@ -0,0 +1,41 @@
 +* Skyworks Solutions, Inc. AAT1290 Current Regulator for Flash LEDs
 +
 +The device is controlled through two pins: FL_EN and EN_SET. The pins when,
 +asserted high, enable flash strobe and movie mode (max 1/2 of flash current)
 +respectively.
 +
 +Required properties:
 +
 +- compatible : Must be skyworks,aat1290.
 +- flen-gpios : Must be device tree identifier of the flash device FL_EN pin.
 +- enset-gpios : Must be device tree identifier of the flash device EN_SET 
 pin.
 +
 +A discrete LED element connected to the device must be represented by a child
 +node - see Documentation/devicetree/bindings/leds/common.txt.
 +
 +Required properties of the LED child node:
 +- led-max-microamp : see Documentation/devicetree/bindings/leds/common.txt
 +- flash-max-microamp : see Documentation/devicetree/bindings/leds/common.txt
 +   Maximum flash LED supply current can be calculated 
 using
 +   following formula: I = 1A * 162kohm / Rset.
 +- flash-timeout-us : see Documentation/devicetree/bindings/leds/common.txt
 + Maximum flash timeout can be calculated using following
 + formula: T = 8.82 * 10^9 * Ct.
 +
 +Optional properties of the LED child node:
 +- label : see Documentation/devicetree/bindings/leds/common.txt
 +
 +Example (by Ct = 220nF, Rset = 160kohm):
 +
 +aat1290 {
 +   compatible = skyworks,aat1290;
 +   flen-gpios = gpj1 1 GPIO_ACTIVE_HIGH;
 +   enset-gpios = gpj1 2 GPIO_ACTIVE_HIGH;
 +
 +   camera_flash: flash-led {
 +   label = aat1290-flash;
 +   led-max-microamp = 520833;
 +   flash-max-microamp = 1012500;
 +   flash-timeout-us = 194;
 +   };
 +};
 --
 1.7.9.5

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


[PATCH] radio-bcm2048: remove unused var

2015-04-28 Thread Mauro Carvalho Chehab
drivers/staging/media/bcm2048/radio-bcm2048.c: In function 
'bcm2048_i2c_driver_probe':
drivers/staging/media/bcm2048/radio-bcm2048.c:2596:11: warning: variable 
'skip_release' set but not used [-Wunused-but-set-variable]
  int err, skip_release = 0;
   ^

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c 
b/drivers/staging/media/bcm2048/radio-bcm2048.c
index e9d0691b21d3..5e11a78ceef3 100644
--- a/drivers/staging/media/bcm2048/radio-bcm2048.c
+++ b/drivers/staging/media/bcm2048/radio-bcm2048.c
@@ -2593,7 +2593,7 @@ static int bcm2048_i2c_driver_probe(struct i2c_client 
*client,
const struct i2c_device_id *id)
 {
struct bcm2048_device *bdev;
-   int err, skip_release = 0;
+   int err;
 
bdev = kzalloc(sizeof(*bdev), GFP_KERNEL);
if (!bdev) {
@@ -2646,7 +2646,6 @@ free_sysfs:
bcm2048_sysfs_unregister_properties(bdev, ARRAY_SIZE(attrs));
 free_registration:
video_unregister_device(bdev-videodev);
-   skip_release = 1;
 free_irq:
if (client-irq)
free_irq(client-irq, bdev);
-- 
2.1.0

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


Re: [PATCH v6 08/10] leds: max77693: add support for V4L2 Flash sub-device

2015-04-28 Thread Sakari Ailus
On Tue, Apr 28, 2015 at 09:18:48AM +0200, Jacek Anaszewski wrote:
 Add support for V4L2 Flash sub-device to the max77693 LED Flash class
 driver. The support allows for V4L2 Flash sub-device to take the control
 of the LED Flash class device.
 
 Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
 Acked-by: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Bryan Wu coolo...@gmail.com
 Cc: Richard Purdie rpur...@rpsys.net
 Cc: Sakari Ailus sakari.ai...@iki.fi

Acked-by: Sakari Ailus sakari.ai...@linux.intel.com

-- 
Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 0/3] Add media bdisp driver for stihxxx platforms

2015-04-28 Thread Fabien DESSENNE
Hi Hans,

Thank you for your quick feedback.
I have read your remarks and I shall be able to take care of all of them.
I need some rework days now.

Regarding v4l2-compliance (latest), here is the current status summary.
v4l2-compliance (no option) returns:
Total: 42, Succeeded: 42, Failed: 0, Warnings: 12.
The 12 warnings are all about the same which is highlighted here:
http://www.mail-archive.com/linux-media@vger.kernel.org/msg56550.html
I do not think this is really an issue so I do not plan to fix it.
If you disagree, please let me know!

Running v4l2-compliance -s returns 1 Failed TC (querybuf). I will investigate
this.

Running v4l2-compliance -f returns:
Total: 42, Succeeded: 42, Failed: 0, Warnings: 12.
(Stream using all formats: Not supported for M2M devices)

Anyway, I will run again v4l2-compliance with the reworked driver and
let you know about the detailed status.

BR
Fabien

 -Original Message-
 From: Hans Verkuil [mailto:hverk...@xs4all.nl]
 Sent: lundi 27 avril 2015 18:26
 To: Fabien DESSENNE; linux-media@vger.kernel.org
 Cc: Benjamin Gaignard
 Subject: Re: [PATCH 0/3] Add media bdisp driver for stihxxx platforms
 
 Hi Fabien,
 
 Thank you for this driver! Good to see V4L2 support for this SoC.
 
 I did a quick initial scan over the driver and there are a few things that 
 need
 to be addressed:
 
 - I think bdisp as the driver name is a bit generic, perhaps something like
   stih4xx-bdisp might be more appropriate. Similar to the exynos-* drivers.
 
 - Replace cropcap/g_crop/s_crop by the g/s_selection ioctls. The old ioctls
   are no longer supported for new drivers (the v4l2 core will automatically
   add support for those ioctls if g/s_selection is implemented in the driver).
   Read careful how crop and compose rectangles are used in a m2m device. I
   would expect that you implement cropping for the
 BUF_TYPE_VIDEO_OUTPUT side
   (i.e. memory to hardware) and implement composing for the
 BUF_TYPE_VIDEO_CAPTURE
   side (i.e. hardware to memory).
 
   If the hardware also support composition for output or cropping for capture,
   then let me know: in that case you will likely have to implement support for
   V4L2_SEL_TGT_NATIVE_SIZE as well.
 
 - Several ioctl and fop helpers were added to media/v4l2-mem2mem.h (e.g.
   v4l2_m2m_ioctl_reqbufs, v4l2_m2m_fop_mmap, etc.). Use these instead
 of
   rolling your own.
 
 - I would like to see the output of these v4l2-compliance commands:
 
   v4l2-compliance
   v4l2-compliance -s
   v4l2-compliance -f
 
   In all fairness: mem2mem devices are not often tested using v4l2-
 compliance
   and there may be problems testing this (-f will likely fail), but I still
   like to see the output so I know what works and what doesn't.
 
   Please use the latest v4l2-compliance code from the v4l-utils.git 
 repository.
   I won't accept the driver unless I see the results of these compliance 
 tests:
   running this is required for new drivers since it is a great way of 
 verifying
   the completeness of your driver.
 
 Regards,
 
   Hans
 
 On 04/27/2015 05:56 PM, Fabien Dessenne wrote:
  This series of patches adds the support of v4l2 2D blitter driver for
  STMicroelectronics SOC.
 
  The following features are supported and tested:
  - Color format conversion (RGB32, RGB24, RGB16, NV12, YUV420P)
  - Copy
  - Scale
  - Flip
  - Deinterlace
  - Wide (4K) picture support
  - Crop
 
  This driver uses the v4l2 mem2mem framework and its implementation
 was
  largely inspired by the Exynos G-Scaler (exynos-gsc) driver.
 
  The driver is mainly implemented across two files:
  - bdisp-v4l2.c
  - bdisp-hw.c
  bdisp-v4l2.c uses v4l2_m2m to manage the V4L2 interface with the
  userland. It calls the HW services that are implemented in bdisp-hw.c.
 
  The additional bdisp-debug.c file manages some debugfs entries.
 
  Fabien Dessenne (3):
[media] bdisp: add DT bindings documentation
[media] bdisp: 2D blitter driver using v4l2 mem2mem framework
[media] bdisp: add debug file system
 
   .../devicetree/bindings/media/st,stih4xx.txt   |   32 +
   drivers/media/platform/Kconfig |   10 +
   drivers/media/platform/Makefile|2 +
   drivers/media/platform/bdisp/Kconfig   |9 +
   drivers/media/platform/bdisp/Makefile  |3 +
   drivers/media/platform/bdisp/bdisp-debug.c |  668 +
   drivers/media/platform/bdisp/bdisp-filter.h|  346 +
   drivers/media/platform/bdisp/bdisp-hw.c|  823 +++
   drivers/media/platform/bdisp/bdisp-reg.h   |  235 +++
   drivers/media/platform/bdisp/bdisp-v4l2.c  | 1492
 
   drivers/media/platform/bdisp/bdisp.h   |  220 +++
   11 files changed, 3840 insertions(+)
   create mode 100644
  Documentation/devicetree/bindings/media/st,stih4xx.txt
   create mode 100644 drivers/media/platform/bdisp/Kconfig
   create mode 100644 

[PATCH 07/12] trivial: [media] cx25821: cx25821-medusa-reg.h: fix 0x0x prefix

2015-04-28 Thread Antonio Ospite
Fix the 0x0x prefix in integer constants.

In this case a padding 0 must also be inserted to make the constants
look like all the other 16 bits ones.

Signed-off-by: Antonio Ospite a...@ao2.it
Cc: Mauro Carvalho Chehab mche...@osg.samsung.com
Cc: linux-media@vger.kernel.org
---
 drivers/media/pci/cx25821/cx25821-medusa-reg.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/pci/cx25821/cx25821-medusa-reg.h 
b/drivers/media/pci/cx25821/cx25821-medusa-reg.h
index c98ac94..2e10643 100644
--- a/drivers/media/pci/cx25821/cx25821-medusa-reg.h
+++ b/drivers/media/pci/cx25821/cx25821-medusa-reg.h
@@ -84,9 +84,9 @@
 #defineABIST_BIN4_VGA3 0x01D4
 #defineABIST_BIN5_VGA4 0x01D8
 #defineABIST_BIN6_VGA5 0x01DC
-#defineABIST_BIN7_VGA6 0x0x1E0
-#defineABIST_CLAMP_A   0x0x1E4
-#defineABIST_CLAMP_B   0x0x1E8
+#defineABIST_BIN7_VGA6 0x01E0
+#defineABIST_CLAMP_A   0x01E4
+#defineABIST_CLAMP_B   0x01E8
 #defineABIST_CLAMP_C   0x01EC
 #defineABIST_CLAMP_D   0x01F0
 #defineABIST_CLAMP_E   0x01F4
-- 
2.1.4

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


Re: [PATCH v6 03/10] leds: Add support for max77693 mfd flash cell

2015-04-28 Thread Sakari Ailus
Hi Jacek,

On Tue, Apr 28, 2015 at 09:18:43AM +0200, Jacek Anaszewski wrote:
 This patch adds led-flash support to Maxim max77693 chipset.
 A device can be exposed to user space through LED subsystem
 sysfs interface. Device supports up to two leds which can
 work in flash and torch mode. The leds can be triggered
 externally or by software.
 
 Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
 Signed-off-by: Andrzej Hajda a.ha...@samsung.com
 Acked-by: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Bryan Wu coolo...@gmail.com
 Cc: Richard Purdie rpur...@rpsys.net
 Cc: Lee Jones lee.jo...@linaro.org
 Cc: Chanwoo Choi cw00.c...@samsung.com

Acked-by: Sakari Ailus sakari.ai...@linux.intel.com

-- 
Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 07/10] Documentation: leds: Add description of v4l2-flash sub-device

2015-04-28 Thread Sakari Ailus
Hi Jacek,

On Tue, Apr 28, 2015 at 09:18:47AM +0200, Jacek Anaszewski wrote:
...
 +On remove the v4l2_flash_release function has to be called, which takes one
 +argument - struct v4l2_flash pointer returned previously by v4l2_flash_init.
 +
 +Please refer to drivers/leds/leds-max77693.c for an exemplary usage of the
 +v4l2 flash API.

s/v4l2 flash API/V4L2 flash wrapper/ .

Acked-by: Sakari Ailus sakari.ai...@linux.intel.com

-- 
Regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] radio-bcm2048: remove unused var

2015-04-28 Thread Pali Rohár
On Tuesday 28 April 2015 09:03:41 Mauro Carvalho Chehab wrote:
 drivers/staging/media/bcm2048/radio-bcm2048.c: In function 
 'bcm2048_i2c_driver_probe':
 drivers/staging/media/bcm2048/radio-bcm2048.c:2596:11: warning: variable 
 'skip_release' set but not used [-Wunused-but-set-variable]
   int err, skip_release = 0;
^
 
 Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com
 
 diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c 
 b/drivers/staging/media/bcm2048/radio-bcm2048.c
 index e9d0691b21d3..5e11a78ceef3 100644
 --- a/drivers/staging/media/bcm2048/radio-bcm2048.c
 +++ b/drivers/staging/media/bcm2048/radio-bcm2048.c
 @@ -2593,7 +2593,7 @@ static int bcm2048_i2c_driver_probe(struct i2c_client 
 *client,
   const struct i2c_device_id *id)
  {
   struct bcm2048_device *bdev;
 - int err, skip_release = 0;
 + int err;
  
   bdev = kzalloc(sizeof(*bdev), GFP_KERNEL);
   if (!bdev) {
 @@ -2646,7 +2646,6 @@ free_sysfs:
   bcm2048_sysfs_unregister_properties(bdev, ARRAY_SIZE(attrs));
  free_registration:
   video_unregister_device(bdev-videodev);
 - skip_release = 1;
  free_irq:
   if (client-irq)
   free_irq(client-irq, bdev);

Looks good to me, so

Acked-by: Pali Rohár pali.ro...@gmail.com

-- 
Pali Rohár
pali.ro...@gmail.com
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] am437x: Fix a wrong identation

2015-04-28 Thread Mauro Carvalho Chehab
drivers/media/platform/am437x/am437x-vpfe.c:513 vpfe_ccdc_set_params() warn: 
inconsistent indenting

Cc: Benoit Parrot bpar...@ti.com
Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/platform/am437x/am437x-vpfe.c 
b/drivers/media/platform/am437x/am437x-vpfe.c
index 9c037ac10e10..57c8a653da4a 100644
--- a/drivers/media/platform/am437x/am437x-vpfe.c
+++ b/drivers/media/platform/am437x/am437x-vpfe.c
@@ -510,7 +510,7 @@ static int vpfe_ccdc_set_params(struct vpfe_ccdc *ccdc, 
void __user *params)
 
if (!vpfe_ccdc_validate_param(ccdc, raw_params)) {
vpfe_ccdc_update_raw_params(ccdc, raw_params);
-   return 0;
+   return 0;
}
 
return -EINVAL;
-- 
2.1.0

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


[PATCH 3/3] am437x: remove unused variable

2015-04-28 Thread Mauro Carvalho Chehab
drivers/media/platform/am437x/am437x-vpfe.c: In function 
'vpfe_get_subdev_input_index':
drivers/media/platform/am437x/am437x-vpfe.c:1679:27: warning: variable 'sdinfo' 
set but not used [-Wunused-but-set-variable]
  struct vpfe_subdev_info *sdinfo;
   ^

Cc: Benoit Parrot bpar...@ti.com
Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/platform/am437x/am437x-vpfe.c 
b/drivers/media/platform/am437x/am437x-vpfe.c
index 57c8a653da4a..73359652e486 100644
--- a/drivers/media/platform/am437x/am437x-vpfe.c
+++ b/drivers/media/platform/am437x/am437x-vpfe.c
@@ -1675,12 +1675,9 @@ vpfe_get_subdev_input_index(struct vpfe_device *vpfe,
int *subdev_input_index,
int app_input_index)
 {
-   struct vpfe_config *cfg = vpfe-cfg;
-   struct vpfe_subdev_info *sdinfo;
int i, j = 0;
 
for (i = 0; i  ARRAY_SIZE(vpfe-cfg-asd); i++) {
-   sdinfo = cfg-sub_devs[i];
if (app_input_index  (j + 1)) {
*subdev_index = i;
*subdev_input_index = app_input_index - j;
-- 
2.1.0

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


[PATCH 1/3] am437x-vpfe: really update the vpfe_ccdc_update_raw_params data

2015-04-28 Thread Mauro Carvalho Chehab
drivers/media/platform/am437x/am437x-vpfe.c: In function 
'vpfe_ccdc_update_raw_params':
drivers/media/platform/am437x/am437x-vpfe.c:430:38: warning: variable 
'config_params' set but not used [-Wunused-but-set-variable]
  struct vpfe_ccdc_config_params_raw *config_params =
  ^

vpfe_ccdc_update_raw_params() is supposed to update the raw
params at ccdc. However, it is just creating a local var and changing
it.

Compile-tested only.

Cc: Benoit Parrot bpar...@ti.com
Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/platform/am437x/am437x-vpfe.c 
b/drivers/media/platform/am437x/am437x-vpfe.c
index a30cc2f7e4f1..9c037ac10e10 100644
--- a/drivers/media/platform/am437x/am437x-vpfe.c
+++ b/drivers/media/platform/am437x/am437x-vpfe.c
@@ -430,7 +430,7 @@ vpfe_ccdc_update_raw_params(struct vpfe_ccdc *ccdc,
struct vpfe_ccdc_config_params_raw *config_params =
ccdc-ccdc_cfg.bayer.config_params;
 
-   config_params = raw_params;
+   *config_params = *raw_params;
 }
 
 /*
-- 
2.1.0

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


Re: [PATCH 08/14] avoid going past input/audio array

2015-04-28 Thread Andy Walls
On April 28, 2015 11:43:47 AM EDT, Mauro Carvalho Chehab 
mche...@osg.samsung.com wrote:
As reported by smatch:
   drivers/media/pci/ivtv/ivtv-driver.c:832 ivtv_init_struct2() error:
buffer overflow 'itv-card-video_inputs' 6 = 6

That happens because nof_inputs and nof_audio_inputs can be initialized
as IVTV_CARD_MAX_VIDEO_INPUTS, instead of IVTV_CARD_MAX_VIDEO_INPUTS -
1.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/pci/ivtv/ivtv-driver.c
b/drivers/media/pci/ivtv/ivtv-driver.c
index c2e60b4f292d..8616fa8193bc 100644
--- a/drivers/media/pci/ivtv/ivtv-driver.c
+++ b/drivers/media/pci/ivtv/ivtv-driver.c
@@ -805,11 +805,11 @@ static void ivtv_init_struct2(struct ivtv *itv)
 {
   int i;
 
-  for (i = 0; i  IVTV_CARD_MAX_VIDEO_INPUTS; i++)
+  for (i = 0; i  IVTV_CARD_MAX_VIDEO_INPUTS - 1; i++)
   if (itv-card-video_inputs[i].video_type == 0)
   break;
   itv-nof_inputs = i;
-  for (i = 0; i  IVTV_CARD_MAX_AUDIO_INPUTS; i++)
+  for (i = 0; i  IVTV_CARD_MAX_AUDIO_INPUTS - 1; i++)
   if (itv-card-audio_inputs[i].audio_type == 0)
   break;
   itv-nof_audio_inputs = i;

Acked-by: Andy Walls awa...@md.metrocast.net
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 03/10] leds: Add support for max77693 mfd flash cell

2015-04-28 Thread Bryan Wu
On Tue, Apr 28, 2015 at 4:36 AM, Sakari Ailus sakari.ai...@iki.fi wrote:
 Hi Jacek,

 On Tue, Apr 28, 2015 at 09:18:43AM +0200, Jacek Anaszewski wrote:
 This patch adds led-flash support to Maxim max77693 chipset.
 A device can be exposed to user space through LED subsystem
 sysfs interface. Device supports up to two leds which can
 work in flash and torch mode. The leds can be triggered
 externally or by software.

 Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
 Signed-off-by: Andrzej Hajda a.ha...@samsung.com
 Acked-by: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Bryan Wu coolo...@gmail.com
 Cc: Richard Purdie rpur...@rpsys.net
 Cc: Lee Jones lee.jo...@linaro.org
 Cc: Chanwoo Choi cw00.c...@samsung.com

 Acked-by: Sakari Ailus sakari.ai...@linux.intel.com

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


cron job: media_tree daily build: ERRORS

2015-04-28 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Wed Apr 29 04:00:18 CEST 2015
git branch: test
git hash:   bb17141cc57c40065462c64d61c0ae362466c0c0
gcc version:i686-linux-gcc (GCC) 5.1.0
sparse version: v0.5.0-44-g40791b9
smatch version: 0.4.1-3153-g7d56ab3
host hardware:  x86_64
host os:4.0.0-0.slh.2-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: WARNINGS
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: ERRORS
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.32.27-i686: ERRORS
linux-2.6.33.7-i686: ERRORS
linux-2.6.34.7-i686: ERRORS
linux-2.6.35.9-i686: ERRORS
linux-2.6.36.4-i686: ERRORS
linux-2.6.37.6-i686: ERRORS
linux-2.6.38.8-i686: ERRORS
linux-2.6.39.4-i686: ERRORS
linux-3.0.60-i686: ERRORS
linux-3.1.10-i686: ERRORS
linux-3.2.37-i686: ERRORS
linux-3.3.8-i686: ERRORS
linux-3.4.27-i686: ERRORS
linux-3.5.7-i686: ERRORS
linux-3.6.11-i686: ERRORS
linux-3.7.4-i686: ERRORS
linux-3.8-i686: ERRORS
linux-3.9.2-i686: ERRORS
linux-3.10.1-i686: ERRORS
linux-3.11.1-i686: ERRORS
linux-3.12.23-i686: ERRORS
linux-3.13.11-i686: ERRORS
linux-3.14.9-i686: ERRORS
linux-3.15.2-i686: ERRORS
linux-3.16.7-i686: ERRORS
linux-3.17.8-i686: ERRORS
linux-3.18.7-i686: ERRORS
linux-3.19-i686: ERRORS
linux-4.0-i686: ERRORS
linux-4.1-rc1-i686: WARNINGS
linux-2.6.32.27-x86_64: ERRORS
linux-2.6.33.7-x86_64: ERRORS
linux-2.6.34.7-x86_64: ERRORS
linux-2.6.35.9-x86_64: ERRORS
linux-2.6.36.4-x86_64: ERRORS
linux-2.6.37.6-x86_64: ERRORS
linux-2.6.38.8-x86_64: ERRORS
linux-2.6.39.4-x86_64: ERRORS
linux-3.0.60-x86_64: ERRORS
linux-3.1.10-x86_64: ERRORS
linux-3.2.37-x86_64: ERRORS
linux-3.3.8-x86_64: ERRORS
linux-3.4.27-x86_64: ERRORS
linux-3.5.7-x86_64: ERRORS
linux-3.6.11-x86_64: ERRORS
linux-3.7.4-x86_64: ERRORS
linux-3.8-x86_64: ERRORS
linux-3.9.2-x86_64: ERRORS
linux-3.10.1-x86_64: ERRORS
linux-3.11.1-x86_64: ERRORS
linux-3.12.23-x86_64: ERRORS
linux-3.13.11-x86_64: ERRORS
linux-3.14.9-x86_64: ERRORS
linux-3.15.2-x86_64: ERRORS
linux-3.16.7-x86_64: ERRORS
linux-3.17.8-x86_64: ERRORS
linux-3.18.7-x86_64: ERRORS
linux-3.19-x86_64: ERRORS
linux-4.0-x86_64: ERRORS
linux-4.1-rc1-x86_64: WARNINGS
apps: OK
spec-git: OK
sparse: WARNINGS
smatch: ERRORS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Wednesday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Wednesday.tar.bz2

The Media Infrastructure API from this daily build is here:

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


[PATCH 09/14] zoran: fix indent

2015-04-28 Thread Mauro Carvalho Chehab
As reported by smatch:
drivers/media/pci/zoran/zoran_device.c:1594 zoran_init_hardware() warn: 
inconsistent indenting

Fix indent. While here, fix CodingStyle and remove dead code, as it
can always be recovered from git logs.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/pci/zoran/zoran_device.c 
b/drivers/media/pci/zoran/zoran_device.c
index b6801e035ea4..40119b3c52c1 100644
--- a/drivers/media/pci/zoran/zoran_device.c
+++ b/drivers/media/pci/zoran/zoran_device.c
@@ -1584,14 +1584,11 @@ zoran_init_hardware (struct zoran *zr)
jpeg_codec_sleep(zr, 1);
jpeg_codec_sleep(zr, 0);
 
-   /* set individual interrupt enables (without GIRQ1)
-* but don't global enable until zoran_open() */
-
-   //btwrite(IRQ_MASK  ~ZR36057_ISR_GIRQ1, ZR36057_ICR);  // SW
-   // It looks like using only JPEGRepIRQEn is not always reliable,
-   // may be when JPEG codec crashes it won't generate IRQ? So,
-/*CP*/ //btwrite(IRQ_MASK, ZR36057_ICR); // 
Enable Vsync interrupts too. SMWHY ? LP
-   zr36057_init_vfe(zr);
+   /*
+* set individual interrupt enables (without GIRQ1)
+* but don't global enable until zoran_open()
+*/
+   zr36057_init_vfe(zr);
 
zr36057_enable_jpg(zr, BUZ_MODE_IDLE);
 
-- 
2.1.0

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


[PATCH 08/14] avoid going past input/audio array

2015-04-28 Thread Mauro Carvalho Chehab
As reported by smatch:
drivers/media/pci/ivtv/ivtv-driver.c:832 ivtv_init_struct2() error: 
buffer overflow 'itv-card-video_inputs' 6 = 6

That happens because nof_inputs and nof_audio_inputs can be initialized
as IVTV_CARD_MAX_VIDEO_INPUTS, instead of IVTV_CARD_MAX_VIDEO_INPUTS - 1.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/pci/ivtv/ivtv-driver.c 
b/drivers/media/pci/ivtv/ivtv-driver.c
index c2e60b4f292d..8616fa8193bc 100644
--- a/drivers/media/pci/ivtv/ivtv-driver.c
+++ b/drivers/media/pci/ivtv/ivtv-driver.c
@@ -805,11 +805,11 @@ static void ivtv_init_struct2(struct ivtv *itv)
 {
int i;
 
-   for (i = 0; i  IVTV_CARD_MAX_VIDEO_INPUTS; i++)
+   for (i = 0; i  IVTV_CARD_MAX_VIDEO_INPUTS - 1; i++)
if (itv-card-video_inputs[i].video_type == 0)
break;
itv-nof_inputs = i;
-   for (i = 0; i  IVTV_CARD_MAX_AUDIO_INPUTS; i++)
+   for (i = 0; i  IVTV_CARD_MAX_AUDIO_INPUTS - 1; i++)
if (itv-card-audio_inputs[i].audio_type == 0)
break;
itv-nof_audio_inputs = i;
-- 
2.1.0

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


[PATCH 04/14] ngene: preventing dereferencing a NULL pointer

2015-04-28 Thread Mauro Carvalho Chehab
As reported by smatch:
drivers/media/pci/ngene/ngene-core.c:1529 init_channel() error: we 
previously assumed 'chan-fe' could be null (see line 1521)

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/pci/ngene/ngene-core.c 
b/drivers/media/pci/ngene/ngene-core.c
index e29bc3af4baf..1b92d836a564 100644
--- a/drivers/media/pci/ngene/ngene-core.c
+++ b/drivers/media/pci/ngene/ngene-core.c
@@ -1526,10 +1526,12 @@ static int init_channel(struct ngene_channel *chan)
if (chan-fe2) {
if (dvb_register_frontend(adapter, chan-fe2)  0)
goto err;
-   chan-fe2-tuner_priv = chan-fe-tuner_priv;
-   memcpy(chan-fe2-ops.tuner_ops,
-  chan-fe-ops.tuner_ops,
-  sizeof(struct dvb_tuner_ops));
+   if (chan-fe) {
+   chan-fe2-tuner_priv = chan-fe-tuner_priv;
+   memcpy(chan-fe2-ops.tuner_ops,
+  chan-fe-ops.tuner_ops,
+  sizeof(struct dvb_tuner_ops));
+   }
}
 
if (chan-has_demux) {
-- 
2.1.0

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


[PATCH 07/14] radio-si476x: Fix indent

2015-04-28 Thread Mauro Carvalho Chehab
As reported by smatch:
drivers/media/radio/radio-si476x.c:571 
si476x_radio_do_post_powerup_init() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/radio/radio-si476x.c 
b/drivers/media/radio/radio-si476x.c
index dccf58691650..9cbb8cdf0ac0 100644
--- a/drivers/media/radio/radio-si476x.c
+++ b/drivers/media/radio/radio-si476x.c
@@ -568,8 +568,8 @@ static int si476x_radio_do_post_powerup_init(struct 
si476x_radio *radio,
err = regcache_sync_region(radio-core-regmap,
   SI476X_PROP_DIGITAL_IO_INPUT_SAMPLE_RATE,
   SI476X_PROP_DIGITAL_IO_OUTPUT_FORMAT);
-   if (err  0)
-   return err;
+   if (err  0)
+   return err;
 
err = regcache_sync_region(radio-core-regmap,
   SI476X_PROP_AUDIO_DEEMPHASIS,
-- 
2.1.0

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


[PATCH 02/14] cx18: avoid going past input/audio array

2015-04-28 Thread Mauro Carvalho Chehab
As reported by smatch:
drivers/media/pci/cx18/cx18-driver.c:807 cx18_init_struct2() error: 
buffer overflow 'cx-card-video_inputs' 6 = 6

That happens because nof_inputs and nof_audio_inputs can be initialized
as CX18_CARD_MAX_VIDEO_INPUTS, instead of CX18_CARD_MAX_VIDEO_INPUTS - 1.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/pci/cx18/cx18-driver.c 
b/drivers/media/pci/cx18/cx18-driver.c
index 83f5074706f9..260e462d91b4 100644
--- a/drivers/media/pci/cx18/cx18-driver.c
+++ b/drivers/media/pci/cx18/cx18-driver.c
@@ -786,11 +786,11 @@ static void cx18_init_struct2(struct cx18 *cx)
 {
int i;
 
-   for (i = 0; i  CX18_CARD_MAX_VIDEO_INPUTS; i++)
+   for (i = 0; i  CX18_CARD_MAX_VIDEO_INPUTS - 1; i++)
if (cx-card-video_inputs[i].video_type == 0)
break;
cx-nof_inputs = i;
-   for (i = 0; i  CX18_CARD_MAX_AUDIO_INPUTS; i++)
+   for (i = 0; i  CX18_CARD_MAX_AUDIO_INPUTS - 1; i++)
if (cx-card-audio_inputs[i].audio_type == 0)
break;
cx-nof_audio_inputs = i;
-- 
2.1.0

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


Re: [PATCH 1/2] clk: change clk_ops' -round_rate() prototype

2015-04-28 Thread Mikko Perttunen

The series

Tested-by: Mikko Perttunen mikko.perttu...@kapsi.fi

on Jetson-TK1.

I rebased my cpufreq series on top of this and everything's working well 
now. :)


Thanks,
Mikko.

On 04/17/2015 10:29 AM, Boris Brezillon wrote:

...

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


[PATCH 03/14] saa7134: fix indent issues

2015-04-28 Thread Mauro Carvalho Chehab
As reported by smatch:
drivers/media/pci/saa7134/saa7134-cards.c:7197 
saa7134_xc2028_callback() warn: inconsistent indenting
drivers/media/pci/saa7134/saa7134-cards.c:7846 saa7134_board_init2() 
warn: inconsistent indenting
drivers/media/pci/saa7134/saa7134-cards.c:7913 saa7134_board_init2() 
warn: inconsistent indenting

While here, fix a few CodingStyle issues on the affected code

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/pci/saa7134/saa7134-cards.c 
b/drivers/media/pci/saa7134/saa7134-cards.c
index 3ca078057755..d48fd5338db5 100644
--- a/drivers/media/pci/saa7134/saa7134-cards.c
+++ b/drivers/media/pci/saa7134/saa7134-cards.c
@@ -7194,7 +7194,7 @@ static int saa7134_xc2028_callback(struct saa7134_dev 
*dev,
saa7134_set_gpio(dev, 20, 1);
break;
}
-   return 0;
+   return 0;
}
return -EINVAL;
 }
@@ -7842,7 +7842,8 @@ int saa7134_board_init2(struct saa7134_dev *dev)
break;
case 0x001d:
dev-tuner_type = TUNER_PHILIPS_FMD1216ME_MK3;
-   printk(KERN_INFO %s Board has 
DVB-T\n, dev-name);
+   printk(KERN_INFO %s Board has DVB-T\n,
+  dev-name);
break;
default:
printk(KERN_ERR %s Can't determine tuner type 
%x from EEPROM\n, dev-name, tuner_t);
@@ -7903,13 +7904,15 @@ int saa7134_board_init2(struct saa7134_dev *dev)
case SAA7134_BOARD_ASUSTeK_TVFM7135:
/* The card below is detected as card=53, but is different */
   if (dev-autodetected  (dev-eedata[0x27] == 0x03)) {
-  dev-board = SAA7134_BOARD_ASUSTeK_P7131_ANALOG;
-  printk(KERN_INFO %s: P7131 analog only, using 
-  entry of %s\n,
-  dev-name, saa7134_boards[dev-board].name);
+   dev-board = SAA7134_BOARD_ASUSTeK_P7131_ANALOG;
+   printk(KERN_INFO
+  %s: P7131 analog only, using entry of %s\n,
+   dev-name, saa7134_boards[dev-board].name);
 
-   /* IR init has already happened for other cards, so
-* we have to catch up. */
+   /*
+* IR init has already happened for other cards, so
+* we have to catch up.
+*/
dev-has_remote = SAA7134_REMOTE_GPIO;
saa7134_input_init1(dev);
   }
-- 
2.1.0

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


[PATCH 12/14] ir-sony-decoder: shutup smatch warnings

2015-04-28 Thread Mauro Carvalho Chehab
There are some false-positive warnings produced by smatch:
drivers/media/rc/ir-sony-decoder.c:129 ir_sony_decode() warn: missing 
break? reassigning 'data-state'
drivers/media/rc/ir-sony-decoder.c:137 ir_sony_decode() warn: missing 
break? reassigning 'data-state'
drivers/media/rc/ir-sony-decoder.c:165 ir_sony_decode() warn: missing 
break? reassigning 'data-state'

This is due to the logic used there to detect the need of a break.

While those are false positives, it is easy to get rid of them without
any drawbacks. The side effect is a cleaner function, with is good.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/rc/ir-sony-decoder.c 
b/drivers/media/rc/ir-sony-decoder.c
index d12dc3da5931..58ef06f35175 100644
--- a/drivers/media/rc/ir-sony-decoder.c
+++ b/drivers/media/rc/ir-sony-decoder.c
@@ -125,30 +125,27 @@ static int ir_sony_decode(struct rc_dev *dev, struct 
ir_raw_event ev)
 
switch (data-count) {
case 12:
-   if (!(dev-enabled_protocols  RC_BIT_SONY12)) {
-   data-state = STATE_INACTIVE;
-   return 0;
-   }
+   if (!(dev-enabled_protocols  RC_BIT_SONY12))
+   goto finish_state_machine;
+
device= bitrev8((data-bits   3)  0xF8);
subdevice = 0;
function  = bitrev8((data-bits   4)  0xFE);
protocol = RC_TYPE_SONY12;
break;
case 15:
-   if (!(dev-enabled_protocols  RC_BIT_SONY15)) {
-   data-state = STATE_INACTIVE;
-   return 0;
-   }
+   if (!(dev-enabled_protocols  RC_BIT_SONY15))
+   goto finish_state_machine;
+
device= bitrev8((data-bits   0)  0xFF);
subdevice = 0;
function  = bitrev8((data-bits   7)  0xFE);
protocol = RC_TYPE_SONY15;
break;
case 20:
-   if (!(dev-enabled_protocols  RC_BIT_SONY20)) {
-   data-state = STATE_INACTIVE;
-   return 0;
-   }
+   if (!(dev-enabled_protocols  RC_BIT_SONY20))
+   goto finish_state_machine;
+
device= bitrev8((data-bits   5)  0xF8);
subdevice = bitrev8((data-bits   0)  0xFF);
function  = bitrev8((data-bits  12)  0xFE);
@@ -162,8 +159,7 @@ static int ir_sony_decode(struct rc_dev *dev, struct 
ir_raw_event ev)
scancode = device  16 | subdevice  8 | function;
IR_dprintk(1, Sony(%u) scancode 0x%05x\n, data-count, 
scancode);
rc_keydown(dev, protocol, scancode, 0);
-   data-state = STATE_INACTIVE;
-   return 0;
+   goto finish_state_machine;
}
 
 out:
@@ -171,6 +167,10 @@ out:
   data-state, TO_US(ev.duration), TO_STR(ev.pulse));
data-state = STATE_INACTIVE;
return -EINVAL;
+
+finish_state_machine:
+   data-state = STATE_INACTIVE;
+   return 0;
 }
 
 static struct ir_raw_handler sony_handler = {
-- 
2.1.0

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


[PATCH 06/14] saa717x: fix multi-byte read code

2015-04-28 Thread Mauro Carvalho Chehab
As reported by smatch:
drivers/media/i2c/saa717x.c:155 saa717x_read() warn: mask and shift to 
zero
drivers/media/i2c/saa717x.c:155 saa717x_read() warn: mask and shift to 
zero

This is done right at saa717x_write(), but the read function is
broken. Thankfully, there's just one place at saa717x driver that
uses multibyte read (for status report, via printk).

Yet, let's fix it. From saa717x_write(), it is clear that the
bytes are in little endian:
mm1[4] = (value  16)  0xff;
mm1[3] = (value  8)  0xff;
mm1[2] = value  0xff;

So, the same order should be valid for read too.

Compile-tested only.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/i2c/saa717x.c b/drivers/media/i2c/saa717x.c
index 0d0f9a917cd3..17557b2f1b09 100644
--- a/drivers/media/i2c/saa717x.c
+++ b/drivers/media/i2c/saa717x.c
@@ -152,9 +152,9 @@ static u32 saa717x_read(struct v4l2_subdev *sd, u32 reg)
i2c_transfer(adap, msgs, 2);
 
if (fw_addr)
-   value = (mm2[2]  0xff)  | ((mm2[1]  0xff)  8) | ((mm2[0]  
0xff)  16);
+   value = (mm2[2]  16)  | (mm2[1]  8) | mm2[0];
else
-   value = mm2[0]  0xff;
+   value = mm2[0];
 
v4l2_dbg(2, debug, sd, read:  reg 0x%03x=0x%08x\n, reg, value);
return value;
-- 
2.1.0

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


[PATCH 10/14] s3c-camif: Check if fmt is NULL before use

2015-04-28 Thread Mauro Carvalho Chehab
As reported by smatch:
drivers/media/platform/s3c-camif/camif-capture.c:463 queue_setup() 
warn: variable dereferenced before check 'fmt' (see line 460)

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/platform/s3c-camif/camif-capture.c 
b/drivers/media/platform/s3c-camif/camif-capture.c
index db4d7d23beb9..76e6289a5612 100644
--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -449,19 +449,22 @@ static int queue_setup(struct vb2_queue *vq, const struct 
v4l2_format *pfmt,
struct camif_vp *vp = vb2_get_drv_priv(vq);
struct camif_dev *camif = vp-camif;
struct camif_frame *frame = vp-out_frame;
-   const struct camif_fmt *fmt = vp-out_fmt;
+   const struct camif_fmt *fmt;
unsigned int size;
 
if (pfmt) {
pix = pfmt-fmt.pix;
fmt = s3c_camif_find_format(vp, pix-pixelformat, -1);
+   if (fmt == NULL)
+   return -EINVAL;
size = (pix-width * pix-height * fmt-depth) / 8;
} else {
+   fmt = vp-out_fmt;
+   if (fmt == NULL)
+   return -EINVAL;
size = (frame-f_width * frame-f_height * fmt-depth) / 8;
}
 
-   if (fmt == NULL)
-   return -EINVAL;
*num_planes = 1;
 
if (pix)
-- 
2.1.0

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


[PATCH 13/14] wl128x: fix int type for streg_cbdata

2015-04-28 Thread Mauro Carvalho Chehab
The streg_cbdata can have a negative error value. So, it should be
an integer, and not u8, as reported by smatch:
drivers/media/radio/wl128x/fmdrv_common.c:1517 fmc_prepare() warn: 
assigning (-115) to unsigned variable 'fmdev-streg_cbdata'

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/radio/wl128x/fmdrv.h 
b/drivers/media/radio/wl128x/fmdrv.h
index a587c9bac930..dd203de5de95 100644
--- a/drivers/media/radio/wl128x/fmdrv.h
+++ b/drivers/media/radio/wl128x/fmdrv.h
@@ -210,7 +210,7 @@ struct fmdev {
spinlock_t resp_skb_lock; /* To protect access to received SKB */
 
long flag;  /*  FM driver state machine info */
-   u8 streg_cbdata; /* status of ST registration */
+   int streg_cbdata; /* status of ST registration */
 
struct sk_buff_head rx_q;   /* RX queue */
struct tasklet_struct rx_task;  /* RX Tasklet */
-- 
2.1.0

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


[PATCH 05/14] saa7164: Check if dev is NULL before dereferencing it

2015-04-28 Thread Mauro Carvalho Chehab
As reported by smatch:
drivers/media/pci/saa7164/saa7164-core.c:631 saa7164_irq() warn: 
variable dereferenced before check 'dev' (see line 621)

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/pci/saa7164/saa7164-core.c 
b/drivers/media/pci/saa7164/saa7164-core.c
index 9cf3c6cba498..072dcc8f13d9 100644
--- a/drivers/media/pci/saa7164/saa7164-core.c
+++ b/drivers/media/pci/saa7164/saa7164-core.c
@@ -618,12 +618,7 @@ static irqreturn_t saa7164_irq_ts(struct saa7164_port 
*port)
 static irqreturn_t saa7164_irq(int irq, void *dev_id)
 {
struct saa7164_dev *dev = dev_id;
-   struct saa7164_port *porta = dev-ports[SAA7164_PORT_TS1];
-   struct saa7164_port *portb = dev-ports[SAA7164_PORT_TS2];
-   struct saa7164_port *portc = dev-ports[SAA7164_PORT_ENC1];
-   struct saa7164_port *portd = dev-ports[SAA7164_PORT_ENC2];
-   struct saa7164_port *porte = dev-ports[SAA7164_PORT_VBI1];
-   struct saa7164_port *portf = dev-ports[SAA7164_PORT_VBI2];
+   struct saa7164_port *porta, *portb, *portc, *portd, *porte, *portf;
 
u32 intid, intstat[INT_SIZE/4];
int i, handled = 0, bit;
@@ -634,6 +629,13 @@ static irqreturn_t saa7164_irq(int irq, void *dev_id)
goto out;
}
 
+   porta = dev-ports[SAA7164_PORT_TS1];
+   portb = dev-ports[SAA7164_PORT_TS2];
+   portc = dev-ports[SAA7164_PORT_ENC1];
+   portd = dev-ports[SAA7164_PORT_ENC2];
+   porte = dev-ports[SAA7164_PORT_VBI1];
+   portf = dev-ports[SAA7164_PORT_VBI2];
+
/* Check that the hardware is accessible. If the status bytes are
 * 0xFF then the device is not accessible, the the IRQ belongs
 * to another driver.
-- 
2.1.0

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


[PATCH 14/14] qt1010: Reduce text size by using static const

2015-04-28 Thread Mauro Carvalho Chehab
Using static const allows the compiler to optimize the code.

Before static const:
   textdata bss dec hex filename
   4982 524156870741ba2 drivers/media/tuners/qt1010.o

After static const:
   textdata bss dec hex filename
   4714 524156868061a96 drivers/media/tuners/qt1010.o

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/tuners/qt1010.c b/drivers/media/tuners/qt1010.c
index bc419f8a9671..74b6b17cdbaf 100644
--- a/drivers/media/tuners/qt1010.c
+++ b/drivers/media/tuners/qt1010.c
@@ -294,7 +294,7 @@ static int qt1010_init(struct dvb_frontend *fe)
int err = 0;
u8 i, tmpval, *valptr = NULL;
 
-   qt1010_i2c_oper_t i2c_data[] = {
+   static const qt1010_i2c_oper_t i2c_data[] = {
{ QT1010_WR, 0x01, 0x80 },
{ QT1010_WR, 0x0d, 0x84 },
{ QT1010_WR, 0x0e, 0xb7 },
-- 
2.1.0

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


[PATCH 11/14] s5p_mfc: remove a dead code

2015-04-28 Thread Mauro Carvalho Chehab
As reported by smatch:
drivers/media/platform/s5p-mfc/s5p_mfc.c:1340 s5p_mfc_runtime_resume() 
warn: this array is probably non-NULL. 'm_dev-alloc_ctx'

alloc_ctx can never be NULL, as it is embeeded inside the struct
s5p_mfc_dev.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index 8333fbc2fe96..1263d99d638e 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -1337,8 +1337,6 @@ static int s5p_mfc_runtime_resume(struct device *dev)
struct platform_device *pdev = to_platform_device(dev);
struct s5p_mfc_dev *m_dev = platform_get_drvdata(pdev);
 
-   if (!m_dev-alloc_ctx)
-   return 0;
atomic_set(m_dev-pm.power, 1);
return 0;
 }
-- 
2.1.0

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


[PATCH 01/14] rc: fix bad indenting

2015-04-28 Thread Mauro Carvalho Chehab
drivers/media/rc/rc-main.c:749 rc_close() warn: inconsistent indenting

There's an extra space there.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index f8c5e47a30aa..0ff388a16168 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -746,7 +746,7 @@ void rc_close(struct rc_dev *rdev)
if (rdev) {
mutex_lock(rdev-lock);
 
-if (!--rdev-users  rdev-close != NULL)
+   if (!--rdev-users  rdev-close != NULL)
rdev-close(rdev);
 
mutex_unlock(rdev-lock);
-- 
2.1.0

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


Fwd: UVC Camera on BeagleBoneBlack does not achieve good resolutions for preview

2015-04-28 Thread Rafael Coutinho
Hi,

I'm facing a problem on BeagleBoneBlack. For capturing pictures on a
USB UVC capture board camera I have to stick with a camera preview
streaming with a very low resolution of 320x240 otherwise I cannot get
the camera preview streaming.

I'm using Rowboat Android and a v4l2 camera hardware HAL.

However the same camera achieve 640x480 preview on other devices.

Not sure where to start investigating, might be it a kernel issue
(it's odd because on the other devices the kernel is older).

Or is there any hardware issue on BBB?

Any suggestions would help a lot.

Thanks.

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


[PATCH v6 01/10] leds: unify the location of led-trigger API

2015-04-28 Thread Jacek Anaszewski
Part of led-trigger API was in the private drivers/leds/leds.h header.
Move it to the include/linux/leds.h header to unify the API location
and announce it as public. It has been already exported from
led-triggers.c with EXPORT_SYMBOL_GPL macro. The no-op definitions are
changed from macros to inline to match the style of the surrounding code.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Cc: Bryan Wu coolo...@gmail.com
Cc: Richard Purdie rpur...@rpsys.net
Acked-by: Sakari Ailus sakari.ai...@linux.intel.com
---
 drivers/leds/leds.h  |   24 
 include/linux/leds.h |   25 +
 2 files changed, 25 insertions(+), 24 deletions(-)

diff --git a/drivers/leds/leds.h b/drivers/leds/leds.h
index 79efe57..bc89d7a 100644
--- a/drivers/leds/leds.h
+++ b/drivers/leds/leds.h
@@ -13,7 +13,6 @@
 #ifndef __LEDS_H_INCLUDED
 #define __LEDS_H_INCLUDED
 
-#include linux/device.h
 #include linux/rwsem.h
 #include linux/leds.h
 
@@ -50,27 +49,4 @@ void led_stop_software_blink(struct led_classdev *led_cdev);
 extern struct rw_semaphore leds_list_lock;
 extern struct list_head leds_list;
 
-#ifdef CONFIG_LEDS_TRIGGERS
-void led_trigger_set_default(struct led_classdev *led_cdev);
-void led_trigger_set(struct led_classdev *led_cdev,
-   struct led_trigger *trigger);
-void led_trigger_remove(struct led_classdev *led_cdev);
-
-static inline void *led_get_trigger_data(struct led_classdev *led_cdev)
-{
-   return led_cdev-trigger_data;
-}
-
-#else
-#define led_trigger_set_default(x) do {} while (0)
-#define led_trigger_set(x, y) do {} while (0)
-#define led_trigger_remove(x) do {} while (0)
-#define led_get_trigger_data(x) (NULL)
-#endif
-
-ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr,
-   const char *buf, size_t count);
-ssize_t led_trigger_show(struct device *dev, struct device_attribute *attr,
-   char *buf);
-
 #endif /* __LEDS_H_INCLUDED */
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 9a2b000..b122eea 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -12,6 +12,7 @@
 #ifndef __LINUX_LEDS_H_INCLUDED
 #define __LINUX_LEDS_H_INCLUDED
 
+#include linux/device.h
 #include linux/list.h
 #include linux/mutex.h
 #include linux/rwsem.h
@@ -222,6 +223,11 @@ struct led_trigger {
struct list_head  next_trig;
 };
 
+ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr,
+   const char *buf, size_t count);
+ssize_t led_trigger_show(struct device *dev, struct device_attribute *attr,
+   char *buf);
+
 /* Registration functions for complex triggers */
 extern int led_trigger_register(struct led_trigger *trigger);
 extern void led_trigger_unregister(struct led_trigger *trigger);
@@ -238,6 +244,16 @@ extern void led_trigger_blink_oneshot(struct led_trigger 
*trigger,
  unsigned long *delay_on,
  unsigned long *delay_off,
  int invert);
+extern void led_trigger_set_default(struct led_classdev *led_cdev);
+extern void led_trigger_set(struct led_classdev *led_cdev,
+   struct led_trigger *trigger);
+extern void led_trigger_remove(struct led_classdev *led_cdev);
+
+static inline void *led_get_trigger_data(struct led_classdev *led_cdev)
+{
+   return led_cdev-trigger_data;
+}
+
 /**
  * led_trigger_rename_static - rename a trigger
  * @name: the new trigger name
@@ -267,6 +283,15 @@ static inline void led_trigger_register_simple(const char 
*name,
 static inline void led_trigger_unregister_simple(struct led_trigger *trigger) 
{}
 static inline void led_trigger_event(struct led_trigger *trigger,
enum led_brightness event) {}
+static inline void led_trigger_set_default(struct led_classdev *led_cdev) {}
+static inline void led_trigger_set(struct led_classdev *led_cdev,
+   struct led_trigger *trigger) {}
+static inline void led_trigger_remove(struct led_classdev *led_cdev) {}
+static inline void *led_get_trigger_data(struct led_classdev *led_cdev)
+{
+   return NULL;
+}
+
 #endif /* CONFIG_LEDS_TRIGGERS */
 
 /* Trigger specific functions */
-- 
1.7.9.5

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


[PATCH v6 00/10] LED / flash API integration

2015-04-28 Thread Jacek Anaszewski
This is a sixth non-RFC version of LED / flash API integration
series [1]. It is based on linux_next-20150427.


Changes since v5

- renamed v4l2-flash module to v4l2-flash-led-class and applied
  other related modifications spotted by Sakari
- fixed not released of_node reference in max77693-led driver


Changes since v4

- adapted leds-max77693 and leds-aat1290 drivers to the recent
  modifications in leds/common.txt bindings documentation and
  changed the behaviour when properties are missing
- modified DT bindings documenation for the aforementioned
  drivers
- removed unjustified use of goto in the leds-aat1290 driver
- fixed lack of of_node_put in leds-aat1290 driver, after parsing
  DT child node 
- removed patch adding 'skyworks' vendor prefix, as the entry
  has been recently added


Changes since v2

- improved leds/common DT bindings documentation
- improved max77693-led DT documentation
- fixed validation of DT confguration for leds-max77693 by
  minimal values in joint iouts case
- removed trigger-type property from leds-max77693 bindings
  and adjusted the driver accordingly
- improved LED Flash class documentation related to v4l2-flash sub-device
  initialization
- excluded from leds-aat1290 DT bindings documentation the part
  related to handling external strobe sources


Changes since v1


- excluded exynos4-is media device related patches, as there is
  consenus required related to flash devices handling in media device
  DT bindings
- modifications around LED Flash class settings and v4l2 flash config
  initialization in LED Flash class drivers and v4l2-flash wrapper
- switched to using DT node name as a device name for leds-max77693
  and leds-aat1290 drivers, in case DT 'label' property is absent
- dropped OF dependecy for v4l2-flash wrapper
- moved LED_FAULTS definitions from led-class-flash.h to uapi/linux/leds.h
- allowed for multiple clients of v4l2-flash sub-device

==
Changes since RFC v13:
==

- reduced number of patches - some of them have been merged
- slightly modified max77693-led device naming
- fixed issues in v4l2-flash helpers detected with yavta
- cleaned up AAT1290 device tree documentation
- added GPIOLIB dependecy to AAT1290 related entry in Kconfig

Thanks,
Jacek Anaszewski

[1] http://www.spinics.net/lists/kernel/msg1944538.html

Jacek Anaszewski (10):
  leds: unify the location of led-trigger API
  DT: Add documentation for the mfd Maxim max77693
  leds: Add support for max77693 mfd flash cell
  DT: Add documentation for the Skyworks AAT1290
  leds: Add driver for AAT1290 flash LED controller
  media: Add registration helpers for V4L2 flash sub-devices
  Documentation: leds: Add description of v4l2-flash sub-device
  leds: max77693: add support for V4L2 Flash sub-device
  DT: aat1290: Document handling external strobe sources
  leds: aat1290: add support for V4L2 Flash sub-device

 .../devicetree/bindings/leds/leds-aat1290.txt  |   73 ++
 Documentation/devicetree/bindings/mfd/max77693.txt |   67 ++
 Documentation/leds/leds-class-flash.txt|   47 +
 drivers/leds/Kconfig   |   19 +
 drivers/leds/Makefile  |2 +
 drivers/leds/leds-aat1290.c|  577 ++
 drivers/leds/leds-max77693.c   | 1104 
 drivers/leds/leds.h|   24 -
 drivers/media/v4l2-core/Kconfig|   11 +
 drivers/media/v4l2-core/Makefile   |2 +
 drivers/media/v4l2-core/v4l2-flash-led-class.c |  626 +++
 include/linux/leds.h   |   25 +
 include/media/v4l2-flash-led-class.h   |  145 +++
 13 files changed, 2698 insertions(+), 24 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-aat1290.txt
 create mode 100644 drivers/leds/leds-aat1290.c
 create mode 100644 drivers/leds/leds-max77693.c
 create mode 100644 drivers/media/v4l2-core/v4l2-flash-led-class.c
 create mode 100644 include/media/v4l2-flash-led-class.h

-- 
1.7.9.5

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


[PATCH] v4l2-of: fix compiler errors if CONFIG_OF is undefined

2015-04-28 Thread Hans Verkuil
You must use static inline otherwise you get these errors if CONFIG_OF is not 
defined:

In file included from drivers/media/platform/soc_camera/soc_camera.c:39:0:
include/media/v4l2-of.h:112:13: warning: 'v4l2_of_free_endpoint' defined but 
not used [-Wunused-function]
 static void v4l2_of_free_endpoint(struct v4l2_of_endpoint *endpoint)
 ^
In file included from drivers/media/platform/soc_camera/atmel-isi.c:28:0:
include/media/v4l2-of.h:112:13: warning: 'v4l2_of_free_endpoint' defined but 
not used [-Wunused-function]
 static void v4l2_of_free_endpoint(struct v4l2_of_endpoint *endpoint)
 ^
In file included from drivers/media/platform/soc_camera/rcar_vin.c:36:0:
include/media/v4l2-of.h:112:13: warning: 'v4l2_of_free_endpoint' defined but 
not used [-Wunused-function]
 static void v4l2_of_free_endpoint(struct v4l2_of_endpoint *endpoint)
 ^

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
diff --git a/include/media/v4l2-of.h b/include/media/v4l2-of.h
index 241e98a..4dc34b2 100644
--- a/include/media/v4l2-of.h
+++ b/include/media/v4l2-of.h
@@ -103,13 +103,13 @@ static inline int v4l2_of_parse_endpoint(const struct 
device_node *node,
return -ENOSYS;
 }
 
-struct v4l2_of_endpoint *v4l2_of_alloc_parse_endpoint(
+static inline struct v4l2_of_endpoint *v4l2_of_alloc_parse_endpoint(
const struct device_node *node)
 {
return NULL;
 }
 
-static void v4l2_of_free_endpoint(struct v4l2_of_endpoint *endpoint)
+static inline void v4l2_of_free_endpoint(struct v4l2_of_endpoint *endpoint)
 {
 }
 
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 02/10] DT: Add documentation for the mfd Maxim max77693

2015-04-28 Thread Lee Jones
On Tue, 28 Apr 2015, Jacek Anaszewski wrote:

 This patch adds device tree binding documentation for
 the flash cell of the Maxim max77693 multifunctional device.
 
 Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
 Signed-off-by: Andrzej Hajda a.ha...@samsung.com
 Acked-by: Kyungmin Park kyungmin.p...@samsung.com
 Acked-by: Sakari Ailus sakari.ai...@linux.intel.com
 Cc: Lee Jones lee.jo...@linaro.org
 Cc: Chanwoo Choi cw00.c...@samsung.com
 Cc: Bryan Wu coolo...@gmail.com
 Cc: Richard Purdie rpur...@rpsys.net
 Cc: devicet...@vger.kernel.org
 ---
  Documentation/devicetree/bindings/mfd/max77693.txt |   67 
 
  1 file changed, 67 insertions(+)

Requires a LED Ack.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 04/10] DT: Add documentation for the Skyworks AAT1290

2015-04-28 Thread Jacek Anaszewski
This patch adds device tree binding documentation for
1.5A Step-Up Current Regulator for Flash LEDs.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Acked-by: Sakari Ailus sakari.ai...@linux.intel.com
Cc: Bryan Wu coolo...@gmail.com
Cc: Richard Purdie rpur...@rpsys.net
Cc: devicet...@vger.kernel.org
---
 .../devicetree/bindings/leds/leds-aat1290.txt  |   41 
 1 file changed, 41 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-aat1290.txt

diff --git a/Documentation/devicetree/bindings/leds/leds-aat1290.txt 
b/Documentation/devicetree/bindings/leds/leds-aat1290.txt
new file mode 100644
index 000..ef88b9c
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/leds-aat1290.txt
@@ -0,0 +1,41 @@
+* Skyworks Solutions, Inc. AAT1290 Current Regulator for Flash LEDs
+
+The device is controlled through two pins: FL_EN and EN_SET. The pins when,
+asserted high, enable flash strobe and movie mode (max 1/2 of flash current)
+respectively.
+
+Required properties:
+
+- compatible : Must be skyworks,aat1290.
+- flen-gpios : Must be device tree identifier of the flash device FL_EN pin.
+- enset-gpios : Must be device tree identifier of the flash device EN_SET pin.
+
+A discrete LED element connected to the device must be represented by a child
+node - see Documentation/devicetree/bindings/leds/common.txt.
+
+Required properties of the LED child node:
+- led-max-microamp : see Documentation/devicetree/bindings/leds/common.txt
+- flash-max-microamp : see Documentation/devicetree/bindings/leds/common.txt
+   Maximum flash LED supply current can be calculated using
+   following formula: I = 1A * 162kohm / Rset.
+- flash-timeout-us : see Documentation/devicetree/bindings/leds/common.txt
+ Maximum flash timeout can be calculated using following
+ formula: T = 8.82 * 10^9 * Ct.
+
+Optional properties of the LED child node:
+- label : see Documentation/devicetree/bindings/leds/common.txt
+
+Example (by Ct = 220nF, Rset = 160kohm):
+
+aat1290 {
+   compatible = skyworks,aat1290;
+   flen-gpios = gpj1 1 GPIO_ACTIVE_HIGH;
+   enset-gpios = gpj1 2 GPIO_ACTIVE_HIGH;
+
+   camera_flash: flash-led {
+   label = aat1290-flash;
+   led-max-microamp = 520833;
+   flash-max-microamp = 1012500;
+   flash-timeout-us = 194;
+   };
+};
-- 
1.7.9.5

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


[PATCH v6 07/10] Documentation: leds: Add description of v4l2-flash sub-device

2015-04-28 Thread Jacek Anaszewski
This patch extends LED Flash class documention by
the description of interactions with v4l2-flash sub-device.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Bryan Wu coolo...@gmail.com
Cc: Richard Purdie rpur...@rpsys.net
---
 Documentation/leds/leds-class-flash.txt |   47 +++
 1 file changed, 47 insertions(+)

diff --git a/Documentation/leds/leds-class-flash.txt 
b/Documentation/leds/leds-class-flash.txt
index 19bb673..9d39133 100644
--- a/Documentation/leds/leds-class-flash.txt
+++ b/Documentation/leds/leds-class-flash.txt
@@ -20,3 +20,50 @@ Following sysfs attributes are exposed for controlling flash 
LED devices:
- max_flash_timeout
- flash_strobe
- flash_fault
+
+
+V4L2 flash wrapper for flash LEDs
+=
+
+A LED subsystem driver can be controlled also from the level of VideoForLinux2
+subsystem. In order to enable this CONFIG_V4L2_FLASH_LED_CLASS symbol has to
+be defined in the kernel config.
+
+The driver must call the v4l2_flash_init function to get registered in the
+V4L2 subsystem. The function takes three arguments:
+- fled_cdev : the LED Flash class device to wrap
+- ops : V4L2 specific ops
+   * external_strobe_set - defines the source of the flash LED strobe -
+   V4L2_CID_FLASH_STROBE control or external source, typically
+   a sensor, which makes it possible to synchronise the flash
+   strobe start with exposure start,
+   * intensity_to_led_brightness and led_brightness_to_intensity - perform
+   enum led_brightness - V4L2 intensity conversion in a device
+   specific manner - they can be used for devices with non-linear
+   LED current scale.
+- config : configuration for V4L2 Flash sub-device
+   * dev_name - the name of the media entity, unique in the system,
+   * flash_faults - bitmask of flash faults that the LED Flash class
+   device can report; corresponding LED_FAULT* bit definitions are
+   available in linux/led-class-flash.h,
+   * intensity - constraints for the LED in the TORCH or INDICATOR mode,
+   in microamperes,
+   * has_external_strobe - determines whether the flash strobe source
+   can be switched to external,
+   * indicator_led - signifies that a led is of indicator type, which
+   implies that it can have only two V4L2 controls:
+   V4L2_CID_FLASH_INDICATOR_INTENSITY and V4L2_CID_FLASH_FAULT.
+
+On remove the v4l2_flash_release function has to be called, which takes one
+argument - struct v4l2_flash pointer returned previously by v4l2_flash_init.
+
+Please refer to drivers/leds/leds-max77693.c for an exemplary usage of the
+v4l2 flash API.
+
+Once the V4L2 sub-device is registered by the driver which created the Media
+controller device, the sub-device node acts just as a node of a native V4L2
+flash API device would. The calls are simply routed to the LED flash API.
+
+Opening the V4L2 flash sub-device makes the LED subsystem sysfs interface
+unavailable. The interface is re-enabled after the V4L2 flash sub-device
+is closed.
-- 
1.7.9.5

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


[PATCH v6 03/10] leds: Add support for max77693 mfd flash cell

2015-04-28 Thread Jacek Anaszewski
This patch adds led-flash support to Maxim max77693 chipset.
A device can be exposed to user space through LED subsystem
sysfs interface. Device supports up to two leds which can
work in flash and torch mode. The leds can be triggered
externally or by software.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Signed-off-by: Andrzej Hajda a.ha...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Bryan Wu coolo...@gmail.com
Cc: Richard Purdie rpur...@rpsys.net
Cc: Lee Jones lee.jo...@linaro.org
Cc: Chanwoo Choi cw00.c...@samsung.com
---
 drivers/leds/Kconfig |   10 +
 drivers/leds/Makefile|1 +
 drivers/leds/leds-max77693.c |  988 ++
 3 files changed, 999 insertions(+)
 create mode 100644 drivers/leds/leds-max77693.c

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index a38b17a..62be033 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -475,6 +475,16 @@ config LEDS_TLC591XX
  This option enables support for Texas Instruments TLC59108
  and TLC59116 LED controllers.
 
+config LEDS_MAX77693
+   tristate LED support for MAX77693 Flash
+   depends on LEDS_CLASS_FLASH
+   depends on MFD_MAX77693
+   depends on OF
+   help
+ This option enables support for the flash part of the MAX77693
+ multifunction device. It has build in control for two leds in flash
+ and torch mode.
+
 config LEDS_MAX8997
tristate LED support for MAX8997 PMIC
depends on LEDS_CLASS  MFD_MAX8997
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index 749dbe3..8bddae6 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -53,6 +53,7 @@ obj-$(CONFIG_LEDS_MC13783)+= leds-mc13783.o
 obj-$(CONFIG_LEDS_NS2) += leds-ns2.o
 obj-$(CONFIG_LEDS_NETXBIG) += leds-netxbig.o
 obj-$(CONFIG_LEDS_ASIC3)   += leds-asic3.o
+obj-$(CONFIG_LEDS_MAX77693)+= leds-max77693.o
 obj-$(CONFIG_LEDS_MAX8997) += leds-max8997.o
 obj-$(CONFIG_LEDS_LM355x)  += leds-lm355x.o
 obj-$(CONFIG_LEDS_BLINKM)  += leds-blinkm.o
diff --git a/drivers/leds/leds-max77693.c b/drivers/leds/leds-max77693.c
new file mode 100644
index 000..0dd8cb0
--- /dev/null
+++ b/drivers/leds/leds-max77693.c
@@ -0,0 +1,988 @@
+/*
+ * LED Flash class driver for the flash cell of max77693 mfd.
+ *
+ * Copyright (C) 2015, Samsung Electronics Co., Ltd.
+ *
+ * Authors: Jacek Anaszewski j.anaszew...@samsung.com
+ *  Andrzej Hajda a.ha...@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ */
+
+#include linux/led-class-flash.h
+#include linux/mfd/max77693.h
+#include linux/mfd/max77693-private.h
+#include linux/module.h
+#include linux/mutex.h
+#include linux/platform_device.h
+#include linux/regmap.h
+#include linux/slab.h
+#include linux/workqueue.h
+
+#define MODE_OFF   0
+#define MODE_FLASH(a)  (1  (a))
+#define MODE_TORCH(a)  (1  (2 + (a)))
+#define MODE_FLASH_EXTERNAL(a) (1  (4 + (a)))
+
+#define MODE_FLASH_MASK(MODE_FLASH(FLED1) | MODE_FLASH(FLED2) 
| \
+MODE_FLASH_EXTERNAL(FLED1) | \
+MODE_FLASH_EXTERNAL(FLED2))
+#define MODE_TORCH_MASK(MODE_TORCH(FLED1) | MODE_TORCH(FLED2))
+
+#define FLED1_IOUT (1  0)
+#define FLED2_IOUT (1  1)
+
+enum max77693_fled {
+   FLED1,
+   FLED2,
+};
+
+enum max77693_led_mode {
+   FLASH,
+   TORCH,
+};
+
+struct max77693_led_config_data {
+   const char *label[2];
+   u32 iout_torch_max[2];
+   u32 iout_flash_max[2];
+   u32 flash_timeout_max[2];
+   u32 num_leds;
+   u32 boost_mode;
+   u32 boost_vout;
+   u32 low_vsys;
+};
+
+struct max77693_sub_led {
+   /* corresponding FLED output identifier */
+   int fled_id;
+   /* corresponding LED Flash class device */
+   struct led_classdev_flash fled_cdev;
+   /* assures led-triggers compatibility */
+   struct work_struct work_brightness_set;
+
+   /* brightness cache */
+   unsigned int torch_brightness;
+   /* flash timeout cache */
+   unsigned int flash_timeout;
+   /* flash faults that may have occurred */
+   u32 flash_faults;
+};
+
+struct max77693_led_device {
+   /* parent mfd regmap */
+   struct regmap *regmap;
+   /* platform device data */
+   struct platform_device *pdev;
+   /* secures access to the device */
+   struct mutex lock;
+
+   /* sub led data */
+   struct max77693_sub_led sub_leds[2];
+
+   /* maximum torch current values for FLED outputs */
+   u32 iout_torch_max[2];
+   /* maximum flash current values for FLED outputs */
+   u32 

[PATCH v6 06/10] media: Add registration helpers for V4L2 flash sub-devices

2015-04-28 Thread Jacek Anaszewski
This patch adds helper functions for registering/unregistering
LED Flash class devices as V4L2 sub-devices. The functions should
be called from the LED subsystem device driver. In case the
support for V4L2 Flash sub-devices is disabled in the kernel
config the functions' empty versions will be used.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Sakari Ailus sakari.ai...@iki.fi
Cc: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/v4l2-core/Kconfig|   11 +
 drivers/media/v4l2-core/Makefile   |2 +
 drivers/media/v4l2-core/v4l2-flash-led-class.c |  626 
 include/media/v4l2-flash-led-class.h   |  145 ++
 4 files changed, 784 insertions(+)
 create mode 100644 drivers/media/v4l2-core/v4l2-flash-led-class.c
 create mode 100644 include/media/v4l2-flash-led-class.h

diff --git a/drivers/media/v4l2-core/Kconfig b/drivers/media/v4l2-core/Kconfig
index ba7e21a..c505dc3 100644
--- a/drivers/media/v4l2-core/Kconfig
+++ b/drivers/media/v4l2-core/Kconfig
@@ -44,6 +44,17 @@ config V4L2_MEM2MEM_DEV
 tristate
 depends on VIDEOBUF2_CORE
 
+# Used by LED subsystem flash drivers
+config V4L2_FLASH_LED_CLASS
+   tristate V4L2 flash API for LED flash class devices
+   depends on VIDEO_V4L2_SUBDEV_API
+   depends on LEDS_CLASS_FLASH
+   ---help---
+ Say Y here to enable V4L2 flash API support for LED flash
+ class drivers.
+
+ When in doubt, say N.
+
 # Used by drivers that need Videobuf modules
 config VIDEOBUF_GEN
tristate
diff --git a/drivers/media/v4l2-core/Makefile b/drivers/media/v4l2-core/Makefile
index 63d29f2..dc3de00 100644
--- a/drivers/media/v4l2-core/Makefile
+++ b/drivers/media/v4l2-core/Makefile
@@ -22,6 +22,8 @@ obj-$(CONFIG_VIDEO_TUNER) += tuner.o
 
 obj-$(CONFIG_V4L2_MEM2MEM_DEV) += v4l2-mem2mem.o
 
+obj-$(CONFIG_V4L2_FLASH_LED_CLASS) += v4l2-flash-led-class.o
+
 obj-$(CONFIG_VIDEOBUF_GEN) += videobuf-core.o
 obj-$(CONFIG_VIDEOBUF_DMA_SG) += videobuf-dma-sg.o
 obj-$(CONFIG_VIDEOBUF_DMA_CONTIG) += videobuf-dma-contig.o
diff --git a/drivers/media/v4l2-core/v4l2-flash-led-class.c 
b/drivers/media/v4l2-core/v4l2-flash-led-class.c
new file mode 100644
index 000..4075507
--- /dev/null
+++ b/drivers/media/v4l2-core/v4l2-flash-led-class.c
@@ -0,0 +1,626 @@
+/*
+ * V4L2 flash LED sub-device registration helpers.
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd
+ * Author: Jacek Anaszewski j.anaszew...@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/led-class-flash.h
+#include linux/module.h
+#include linux/mutex.h
+#include linux/of.h
+#include linux/slab.h
+#include linux/types.h
+#include media/v4l2-flash-led-class.h
+
+#define has_flash_op(v4l2_flash, op)   \
+   (v4l2_flash  v4l2_flash-ops-op)
+
+#define call_flash_op(v4l2_flash, op, arg) \
+   (has_flash_op(v4l2_flash, op) ? \
+   v4l2_flash-ops-op(v4l2_flash, arg) :  \
+   -EINVAL)
+
+static enum led_brightness __intensity_to_led_brightness(
+   struct v4l2_ctrl *ctrl, s32 intensity)
+{
+   intensity -= ctrl-minimum;
+   intensity /= (u32) ctrl-step;
+
+   /*
+* Indicator LEDs, unlike torch LEDs, are turned on/off basing on
+* the state of V4L2_CID_FLASH_INDICATOR_INTENSITY control only.
+* Therefore it must be possible to set it to 0 level which in
+* the LED subsystem reflects LED_OFF state.
+*/
+   if (ctrl-minimum)
+   ++intensity;
+
+   return intensity;
+}
+
+static s32 __led_brightness_to_intensity(struct v4l2_ctrl *ctrl,
+enum led_brightness brightness)
+{
+   /*
+* Indicator LEDs, unlike torch LEDs, are turned on/off basing on
+* the state of V4L2_CID_FLASH_INDICATOR_INTENSITY control only.
+* Do not decrement brightness read from the LED subsystem for
+* indicator LED as it may equal 0. For torch LEDs this function
+* is called only when V4L2_FLASH_LED_MODE_TORCH is set and the
+* brightness read is guaranteed to be greater than 0. In the mode
+* V4L2_FLASH_LED_MODE_NONE the cached torch intensity value is used.
+*/
+   if (ctrl-id != V4L2_CID_FLASH_INDICATOR_INTENSITY)
+   --brightness;
+
+   return (brightness * ctrl-step) + ctrl-minimum;
+}
+
+static void v4l2_flash_set_led_brightness(struct v4l2_flash *v4l2_flash,
+   struct v4l2_ctrl *ctrl)
+{
+   struct v4l2_ctrl **ctrls = v4l2_flash-ctrls;
+   enum led_brightness brightness;
+
+   if (has_flash_op(v4l2_flash, 

[PATCH v6 09/10] DT: aat1290: Document handling external strobe sources

2015-04-28 Thread Jacek Anaszewski
This patch adds documentation for a pinctrl-names property.
The property, when present, is used for switching the source
of the strobe signal for the device.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Bryan Wu coolo...@gmail.com
Cc: Richard Purdie rpur...@rpsys.net
Cc: Sakari Ailus sakari.ai...@iki.fi
Cc: devicet...@vger.kernel.org
---
 .../devicetree/bindings/leds/leds-aat1290.txt  |   36 ++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/leds/leds-aat1290.txt 
b/Documentation/devicetree/bindings/leds/leds-aat1290.txt
index ef88b9c..c05ed91 100644
--- a/Documentation/devicetree/bindings/leds/leds-aat1290.txt
+++ b/Documentation/devicetree/bindings/leds/leds-aat1290.txt
@@ -2,7 +2,9 @@
 
 The device is controlled through two pins: FL_EN and EN_SET. The pins when,
 asserted high, enable flash strobe and movie mode (max 1/2 of flash current)
-respectively.
+respectively. In order to add a capability of selecting the strobe signal 
source
+(e.g. CPU or camera sensor) there is an additional switch required, independent
+of the flash chip. The switch is controlled with pin control.
 
 Required properties:
 
@@ -10,6 +12,13 @@ Required properties:
 - flen-gpios : Must be device tree identifier of the flash device FL_EN pin.
 - enset-gpios : Must be device tree identifier of the flash device EN_SET pin.
 
+Optional properties:
+- pinctrl-names : Must contain entries: default, host, isp. Entries
+   default and host must refer to the same pin configuration
+   node, which sets the host as a strobe signal provider. Entry
+   isp must refer to the pin configuration node, which sets the
+   ISP as a strobe signal provider.
+
 A discrete LED element connected to the device must be represented by a child
 node - see Documentation/devicetree/bindings/leds/common.txt.
 
@@ -25,13 +34,22 @@ Required properties of the LED child node:
 Optional properties of the LED child node:
 - label : see Documentation/devicetree/bindings/leds/common.txt
 
-Example (by Ct = 220nF, Rset = 160kohm):
+Example (by Ct = 220nF, Rset = 160kohm and exynos4412-trats2 board with
+a switch that allows for routing strobe signal either from the host or from
+the camera sensor):
+
+#include exynos4412.dtsi
 
 aat1290 {
compatible = skyworks,aat1290;
flen-gpios = gpj1 1 GPIO_ACTIVE_HIGH;
enset-gpios = gpj1 2 GPIO_ACTIVE_HIGH;
 
+   pinctrl-names = default, host, isp;
+   pinctrl-0 = camera_flash_host;
+   pinctrl-1 = camera_flash_host;
+   pinctrl-2 = camera_flash_isp;
+
camera_flash: flash-led {
label = aat1290-flash;
led-max-microamp = 520833;
@@ -39,3 +57,17 @@ aat1290 {
flash-timeout-us = 194;
};
 };
+
+pinctrl_0 {
+   camera_flash_host: camera-flash-host {
+   samsung,pins = gpj1-0;
+   samsung,pin-function = 1;
+   samsung,pin-val = 0;
+   };
+
+   camera_flash_isp: camera-flash-isp {
+   samsung,pins = gpj1-0;
+   samsung,pin-function = 1;
+   samsung,pin-val = 1;
+   };
+};
-- 
1.7.9.5

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


[PATCH v6 08/10] leds: max77693: add support for V4L2 Flash sub-device

2015-04-28 Thread Jacek Anaszewski
Add support for V4L2 Flash sub-device to the max77693 LED Flash class
driver. The support allows for V4L2 Flash sub-device to take the control
of the LED Flash class device.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Bryan Wu coolo...@gmail.com
Cc: Richard Purdie rpur...@rpsys.net
Cc: Sakari Ailus sakari.ai...@iki.fi
---
 drivers/leds/leds-max77693.c |  128 --
 1 file changed, 122 insertions(+), 6 deletions(-)

diff --git a/drivers/leds/leds-max77693.c b/drivers/leds/leds-max77693.c
index 0dd8cb0..d49af8d 100644
--- a/drivers/leds/leds-max77693.c
+++ b/drivers/leds/leds-max77693.c
@@ -20,6 +20,7 @@
 #include linux/regmap.h
 #include linux/slab.h
 #include linux/workqueue.h
+#include media/v4l2-flash-led-class.h
 
 #define MODE_OFF   0
 #define MODE_FLASH(a)  (1  (a))
@@ -62,6 +63,8 @@ struct max77693_sub_led {
struct led_classdev_flash fled_cdev;
/* assures led-triggers compatibility */
struct work_struct work_brightness_set;
+   /* V4L2 Flash device */
+   struct v4l2_flash *v4l2_flash;
 
/* brightness cache */
unsigned int torch_brightness;
@@ -634,7 +637,8 @@ static int max77693_led_flash_timeout_set(
 }
 
 static int max77693_led_parse_dt(struct max77693_led_device *led,
-   struct max77693_led_config_data *cfg)
+   struct max77693_led_config_data *cfg,
+   struct device_node **sub_nodes)
 {
struct device *dev = led-pdev-dev;
struct max77693_sub_led *sub_leds = led-sub_leds;
@@ -681,6 +685,13 @@ static int max77693_led_parse_dt(struct 
max77693_led_device *led,
return -EINVAL;
}
 
+   if (sub_nodes[fled_id]) {
+   dev_err(dev,
+   Conflicting \led-sources\ DT properties\n);
+   return -EINVAL;
+   }
+
+   sub_nodes[fled_id] = child_node;
sub_leds[fled_id].fled_id = fled_id;
 
cfg-label[fled_id] =
@@ -793,11 +804,12 @@ static void max77693_led_validate_configuration(struct 
max77693_led_device *led,
 }
 
 static int max77693_led_get_configuration(struct max77693_led_device *led,
-   struct max77693_led_config_data *cfg)
+   struct max77693_led_config_data *cfg,
+   struct device_node **sub_nodes)
 {
int ret;
 
-   ret = max77693_led_parse_dt(led, cfg);
+   ret = max77693_led_parse_dt(led, cfg, sub_nodes);
if (ret  0)
return ret;
 
@@ -845,6 +857,66 @@ static void max77693_init_flash_settings(struct 
max77693_sub_led *sub_led,
setting-val = setting-max;
 }
 
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+
+static int max77693_led_external_strobe_set(
+   struct v4l2_flash *v4l2_flash,
+   bool enable)
+{
+   struct max77693_sub_led *sub_led =
+   flcdev_to_sub_led(v4l2_flash-fled_cdev);
+   struct max77693_led_device *led = sub_led_to_led(sub_led);
+   int fled_id = sub_led-fled_id;
+   int ret;
+
+   mutex_lock(led-lock);
+
+   if (enable)
+   ret = max77693_add_mode(led, MODE_FLASH_EXTERNAL(fled_id));
+   else
+   ret = max77693_clear_mode(led, MODE_FLASH_EXTERNAL(fled_id));
+
+   mutex_unlock(led-lock);
+
+   return ret;
+}
+
+static void max77693_init_v4l2_flash_config(struct max77693_sub_led *sub_led,
+   struct max77693_led_config_data *led_cfg,
+   struct v4l2_flash_config *v4l2_sd_cfg)
+{
+   struct max77693_led_device *led = sub_led_to_led(sub_led);
+   struct device *dev = led-pdev-dev;
+   struct max77693_dev *iodev = dev_get_drvdata(dev-parent);
+   struct i2c_client *i2c = iodev-i2c;
+   struct led_flash_setting *s;
+
+   snprintf(v4l2_sd_cfg-dev_name, sizeof(v4l2_sd_cfg-dev_name),
+%s %d-%04x, sub_led-fled_cdev.led_cdev.name,
+i2c_adapter_id(i2c-adapter), i2c-addr);
+
+   s = v4l2_sd_cfg-intensity;
+   s-min = TORCH_IOUT_MIN;
+   s-max = sub_led-fled_cdev.led_cdev.max_brightness * TORCH_IOUT_STEP;
+   s-step = TORCH_IOUT_STEP;
+   s-val = s-max;
+
+   /* Init flash faults config */
+   v4l2_sd_cfg-flash_faults = LED_FAULT_OVER_VOLTAGE |
+   LED_FAULT_SHORT_CIRCUIT |
+   LED_FAULT_OVER_CURRENT;
+
+   v4l2_sd_cfg-has_external_strobe = true;
+}
+
+static const struct v4l2_flash_ops v4l2_flash_ops = {
+   .external_strobe_set = max77693_led_external_strobe_set,
+};
+
+#else
+#define max77693_init_v4l2_flash_config(sub_led, led_cfg, v4l2_sd_cfg)
+#endif
+
 static void 

[PATCH v6 10/10] leds: aat1290: add support for V4L2 Flash sub-device

2015-04-28 Thread Jacek Anaszewski
Add support for V4L2 Flash sub-device to the aat1290 LED Flash class
driver. The support allows for V4L2 Flash sub-device to take the control
of the LED Flash class device.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Bryan Wu coolo...@gmail.com
Cc: Richard Purdie rpur...@rpsys.net
Cc: Sakari Ailus sakari.ai...@iki.fi
---
 drivers/leds/Kconfig|1 +
 drivers/leds/leds-aat1290.c |  137 +--
 2 files changed, 132 insertions(+), 6 deletions(-)

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index dd7834c..874df63 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -47,6 +47,7 @@ config LEDS_AAT1290
depends on LEDS_CLASS_FLASH
depends on GPIOLIB
depends on OF
+   depends on PINCTRL
help
 This option enables support for the LEDs on the AAT1290.
 
diff --git a/drivers/leds/leds-aat1290.c b/drivers/leds/leds-aat1290.c
index 03e5b96..f37f848 100644
--- a/drivers/leds/leds-aat1290.c
+++ b/drivers/leds/leds-aat1290.c
@@ -17,9 +17,11 @@
 #include linux/module.h
 #include linux/mutex.h
 #include linux/of.h
+#include linux/pinctrl/consumer.h
 #include linux/platform_device.h
 #include linux/slab.h
 #include linux/workqueue.h
+#include media/v4l2-flash-led-class.h
 
 #define AAT1290_MOVIE_MODE_CURRENT_ADDR17
 #define AAT1290_MAX_MM_CURR_PERCENT_0  16
@@ -52,6 +54,8 @@ struct aat1290_led_config_data {
u32 max_flash_current;
/* maximum flash timeout */
u32 max_flash_tm;
+   /* external strobe capability */
+   bool has_external_strobe;
/* max LED brightness level */
enum led_brightness max_brightness;
 };
@@ -64,6 +68,8 @@ struct aat1290_led {
 
/* corresponding LED Flash class device */
struct led_classdev_flash fled_cdev;
+   /* V4L2 Flash device */
+   struct v4l2_flash *v4l2_flash;
 
/* FLEN pin */
struct gpio_desc *gpio_fl_en;
@@ -230,11 +236,15 @@ static int aat1290_led_flash_timeout_set(struct 
led_classdev_flash *fled_cdev,
 }
 
 static int aat1290_led_parse_dt(struct aat1290_led *led,
-   struct aat1290_led_config_data *cfg)
+   struct aat1290_led_config_data *cfg,
+   struct device_node **sub_node)
 {
struct led_classdev *led_cdev = led-fled_cdev.led_cdev;
struct device *dev = led-pdev-dev;
struct device_node *child_node;
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+   struct pinctrl *pinctrl;
+#endif
int ret = 0;
 
led-gpio_fl_en = devm_gpiod_get(dev, flen);
@@ -251,6 +261,17 @@ static int aat1290_led_parse_dt(struct aat1290_led *led,
return ret;
}
 
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+   pinctrl = devm_pinctrl_get_select_default(led-pdev-dev);
+   if (IS_ERR(pinctrl)) {
+   cfg-has_external_strobe = false;
+   dev_info(dev,
+No support for external strobe detected.\n);
+   } else {
+   cfg-has_external_strobe = true;
+   }
+#endif
+
child_node = of_get_next_available_child(dev-of_node, NULL);
if (!child_node) {
dev_err(dev, No DT child node found for connected LED.\n);
@@ -288,6 +309,8 @@ static int aat1290_led_parse_dt(struct aat1290_led *led,
 
of_node_put(child_node);
 
+   *sub_node = child_node;
+
return ret;
 }
 
@@ -316,7 +339,8 @@ int init_mm_current_scale(struct aat1290_led *led,
int i, max_mm_current =
AAT1290_MAX_MM_CURRENT(cfg-max_flash_current);
 
-   led-mm_current_scale = kzalloc(sizeof(max_mm_current_percent),
+   led-mm_current_scale = devm_kzalloc(led-pdev-dev,
+   sizeof(max_mm_current_percent),
GFP_KERNEL);
if (!led-mm_current_scale)
return -ENOMEM;
@@ -329,11 +353,12 @@ int init_mm_current_scale(struct aat1290_led *led,
 }
 
 static int aat1290_led_get_configuration(struct aat1290_led *led,
-   struct aat1290_led_config_data *cfg)
+   struct aat1290_led_config_data *cfg,
+   struct device_node **sub_node)
 {
int ret;
 
-   ret = aat1290_led_parse_dt(led, cfg);
+   ret = aat1290_led_parse_dt(led, cfg, sub_node);
if (ret  0)
return ret;
/*
@@ -346,7 +371,10 @@ static int aat1290_led_get_configuration(struct 
aat1290_led *led,
 
aat1290_led_validate_mm_current(led, cfg);
 
-   kfree(led-mm_current_scale);
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+#else
+   devm_kfree(led-pdev-dev, led-mm_current_scale);
+#endif
 
return 0;
 }
@@ -365,6 +393,83 @@ static void aat1290_init_flash_timeout(struct aat1290_led 
*led,
setting-val = 

[PATCH v6 05/10] leds: Add driver for AAT1290 flash LED controller

2015-04-28 Thread Jacek Anaszewski
This patch adds a driver for the 1.5A Step-Up Current Regulator
for Flash LEDs. The device is programmed through a Skyworks proprietary
AS2Cwire serial digital interface.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Acked-by: Sakari Ailus sakari.ai...@linux.intel.com
Cc: Bryan Wu coolo...@gmail.com
Cc: Richard Purdie rpur...@rpsys.net
---
 drivers/leds/Kconfig|8 +
 drivers/leds/Makefile   |1 +
 drivers/leds/leds-aat1290.c |  452 +++
 3 files changed, 461 insertions(+)
 create mode 100644 drivers/leds/leds-aat1290.c

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 62be033..dd7834c 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -42,6 +42,14 @@ config LEDS_88PM860X
  This option enables support for on-chip LED drivers found on Marvell
  Semiconductor 88PM8606 PMIC.
 
+config LEDS_AAT1290
+   tristate LED support for the AAT1290
+   depends on LEDS_CLASS_FLASH
+   depends on GPIOLIB
+   depends on OF
+   help
+This option enables support for the LEDs on the AAT1290.
+
 config LEDS_LM3530
tristate LCD Backlight driver for LM3530
depends on LEDS_CLASS
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index 8bddae6..71f7c9a 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o
 
 # LED Platform Drivers
 obj-$(CONFIG_LEDS_88PM860X)+= leds-88pm860x.o
+obj-$(CONFIG_LEDS_AAT1290) += leds-aat1290.o
 obj-$(CONFIG_LEDS_BD2802)  += leds-bd2802.o
 obj-$(CONFIG_LEDS_LOCOMO)  += leds-locomo.o
 obj-$(CONFIG_LEDS_LM3530)  += leds-lm3530.o
diff --git a/drivers/leds/leds-aat1290.c b/drivers/leds/leds-aat1290.c
new file mode 100644
index 000..03e5b96
--- /dev/null
+++ b/drivers/leds/leds-aat1290.c
@@ -0,0 +1,452 @@
+/*
+ * LED Flash class driver for the AAT1290
+ * 1.5A Step-Up Current Regulator for Flash LEDs
+ *
+ * Copyright (C) 2015, Samsung Electronics Co., Ltd.
+ * Author: Jacek Anaszewski j.anaszew...@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ */
+
+#include linux/delay.h
+#include linux/gpio/consumer.h
+#include linux/led-class-flash.h
+#include linux/leds.h
+#include linux/module.h
+#include linux/mutex.h
+#include linux/of.h
+#include linux/platform_device.h
+#include linux/slab.h
+#include linux/workqueue.h
+
+#define AAT1290_MOVIE_MODE_CURRENT_ADDR17
+#define AAT1290_MAX_MM_CURR_PERCENT_0  16
+#define AAT1290_MAX_MM_CURR_PERCENT_1001
+
+#define AAT1290_FLASH_SAFETY_TIMER_ADDR18
+
+#define AAT1290_MOVIE_MODE_CONFIG_ADDR 19
+#define AAT1290_MOVIE_MODE_OFF 1
+#define AAT1290_MOVIE_MODE_ON  3
+
+#define AAT1290_MM_CURRENT_RATIO_ADDR  20
+#define AAT1290_MM_TO_FL_1_92  1
+
+#define AAT1290_MM_TO_FL_RATIO 1000 / 1920
+#define AAT1290_MAX_MM_CURRENT(fl_max) (fl_max * AAT1290_MM_TO_FL_RATIO)
+
+#define AAT1290_LATCH_TIME_MIN_US  500
+#define AAT1290_LATCH_TIME_MAX_US  1000
+#define AAT1290_EN_SET_TICK_TIME_US1
+#define AAT1290_FLEN_OFF_DELAY_TIME_US 10
+#define AAT1290_FLASH_TM_NUM_LEVELS16
+#define AAT1290_MM_CURRENT_SCALE_SIZE  15
+
+
+struct aat1290_led_config_data {
+   /* maximum LED current in movie mode */
+   u32 max_mm_current;
+   /* maximum LED current in flash mode */
+   u32 max_flash_current;
+   /* maximum flash timeout */
+   u32 max_flash_tm;
+   /* max LED brightness level */
+   enum led_brightness max_brightness;
+};
+
+struct aat1290_led {
+   /* platform device data */
+   struct platform_device *pdev;
+   /* secures access to the device */
+   struct mutex lock;
+
+   /* corresponding LED Flash class device */
+   struct led_classdev_flash fled_cdev;
+
+   /* FLEN pin */
+   struct gpio_desc *gpio_fl_en;
+   /* EN|SET pin  */
+   struct gpio_desc *gpio_en_set;
+   /* movie mode current scale */
+   int *mm_current_scale;
+   /* device mode */
+   bool movie_mode;
+
+   /* brightness cache */
+   unsigned int torch_brightness;
+   /* assures led-triggers compatibility */
+   struct work_struct work_brightness_set;
+};
+
+static struct aat1290_led *fled_cdev_to_led(
+   struct led_classdev_flash *fled_cdev)
+{
+   return container_of(fled_cdev, struct aat1290_led, fled_cdev);
+}
+
+static void aat1290_as2cwire_write(struct aat1290_led *led, int addr, int 
value)
+{
+   int i;
+
+   gpiod_direction_output(led-gpio_fl_en, 0);
+   gpiod_direction_output(led-gpio_en_set, 0);
+
+   udelay(AAT1290_FLEN_OFF_DELAY_TIME_US);
+
+   /* write address 

[PATCH v6 02/10] DT: Add documentation for the mfd Maxim max77693

2015-04-28 Thread Jacek Anaszewski
This patch adds device tree binding documentation for
the flash cell of the Maxim max77693 multifunctional device.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Signed-off-by: Andrzej Hajda a.ha...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Acked-by: Sakari Ailus sakari.ai...@linux.intel.com
Cc: Lee Jones lee.jo...@linaro.org
Cc: Chanwoo Choi cw00.c...@samsung.com
Cc: Bryan Wu coolo...@gmail.com
Cc: Richard Purdie rpur...@rpsys.net
Cc: devicet...@vger.kernel.org
---
 Documentation/devicetree/bindings/mfd/max77693.txt |   67 
 1 file changed, 67 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/max77693.txt 
b/Documentation/devicetree/bindings/mfd/max77693.txt
index 38e6440..d342584 100644
--- a/Documentation/devicetree/bindings/mfd/max77693.txt
+++ b/Documentation/devicetree/bindings/mfd/max77693.txt
@@ -76,7 +76,60 @@ Optional properties:
 Valid values: 430, 470, 480, 490
 Default: 430
 
+- led : the LED submodule device node
+
+There are two LED outputs available - FLED1 and FLED2. Each of them can
+control a separate LED or they can be connected together to double
+the maximum current for a single connected LED. One LED is represented
+by one child node.
+
+Required properties:
+- compatible : Must be maxim,max77693-led.
+
+Optional properties:
+- maxim,boost-mode :
+   In boost mode the device can produce up to 1.2A of total current
+   on both outputs. The maximum current on each output is reduced
+   to 625mA then. If not enabled explicitly, boost setting defaults to
+   LEDS_BOOST_FIXED in case both current sources are used.
+   Possible values:
+   LEDS_BOOST_OFF (0) - no boost,
+   LEDS_BOOST_ADAPTIVE (1) - adaptive mode,
+   LEDS_BOOST_FIXED (2) - fixed mode.
+- maxim,boost-mvout : Output voltage of the boost module in millivolts.
+   Valid values: 3300 - 5500, step by 25 (rounded down)
+   Default: 3300
+- maxim,mvsys-min : Low input voltage level in millivolts. Flash is not fired
+   if chip estimates that system voltage could drop below this level due
+   to flash power consumption.
+   Valid values: 2400 - 3400, step by 33 (rounded down)
+   Default: 2400
+
+Required properties for the LED child node:
+- led-sources : see Documentation/devicetree/bindings/leds/common.txt;
+   device current output identifiers: 0 - FLED1, 1 - FLED2
+- led-max-microamp : see Documentation/devicetree/bindings/leds/common.txt
+   Valid values for a LED connected to one FLED output:
+   15625 - 25, step by 15625 (rounded down)
+   Valid values for a LED connected to both FLED outputs:
+   15625 - 50, step by 15625 (rounded down)
+- flash-max-microamp : see Documentation/devicetree/bindings/leds/common.txt
+   Valid values for a single LED connected to one FLED output
+   (boost mode must be turned off):
+   15625 - 100, step by 15625 (rounded down)
+   Valid values for a single LED connected to both FLED outputs:
+   15625 - 125, step by 15625 (rounded down)
+   Valid values for two LEDs case:
+   15625 - 625000, step by 15625 (rounded down)
+- flash-max-timeout-us : see Documentation/devicetree/bindings/leds/common.txt
+   Valid values: 62500 - 100, step by 62500 (rounded down)
+
+Optional properties for the LED child node:
+- label : see Documentation/devicetree/bindings/leds/common.txt
+
 Example:
+#include dt-bindings/leds/common.h
+
max77693@66 {
compatible = maxim,max77693;
reg = 0x66;
@@ -117,5 +170,19 @@ Example:
maxim,thermal-regulation-celsius = 75;
maxim,battery-overcurrent-microamp = 300;
maxim,charge-input-threshold-microvolt = 430;
+
+   led {
+   compatible = maxim,max77693-led;
+   maxim,boost-mode = LEDS_BOOST_FIXED;
+   maxim,boost-mvout = 5000;
+   maxim,mvsys-min = 2400;
+
+   camera_flash: flash-led {
+   label = max77693-flash;
+   led-sources = 0, 1;
+   led-max-microamp = 50;
+   flash-max-microamp = 125;
+   flash-max-timeout-us = 100;
+   };
};
};
-- 
1.7.9.5

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


[GIT PULL FOR v4.1] OMAP4 ISS fix

2015-04-28 Thread Laurent Pinchart
Hi Mauro,

Could you please pull the following OMAP4 ISS regression fox for v4.1 ? If 
fixes a compilation breakage due to a change in the OMAP4 API.

The following changes since commit cb0c9e1f6777287e81d9b48c264d980bf5014b48:

  [media] smiapp: Use v4l2_of_alloc_parse_endpoint() (2015-04-27 16:05:55 
-0300)

are available in the git repository at:

  git://linuxtv.org/pinchartl/media.git omap4iss/fixes

for you to fetch changes up to 2039b0a6114b4ebc26ac261467225cc4622753ca:

  v4l: omap4iss: Replace outdated OMAP4 control pad API with syscon 
(2015-04-28 11:06:14 +0300)


Laurent Pinchart (1):
  v4l: omap4iss: Replace outdated OMAP4 control pad API with syscon

 drivers/staging/media/omap4iss/Kconfig  |  1 +
 drivers/staging/media/omap4iss/iss.c| 11 +++
 drivers/staging/media/omap4iss/iss.h|  4 
 drivers/staging/media/omap4iss/iss_csiphy.c | 12 +++-
 4 files changed, 23 insertions(+), 5 deletions(-)

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH] v4l2-of: fix compiler errors if CONFIG_OF is undefined

2015-04-28 Thread Sakari Ailus
Hi Hans,

On Tue, Apr 28, 2015 at 08:41:00AM +0200, Hans Verkuil wrote:
 You must use static inline otherwise you get these errors if CONFIG_OF is not 
 defined:
 
 In file included from drivers/media/platform/soc_camera/soc_camera.c:39:0:
 include/media/v4l2-of.h:112:13: warning: 'v4l2_of_free_endpoint' defined but 
 not used [-Wunused-function]
  static void v4l2_of_free_endpoint(struct v4l2_of_endpoint *endpoint)
  ^
 In file included from drivers/media/platform/soc_camera/atmel-isi.c:28:0:
 include/media/v4l2-of.h:112:13: warning: 'v4l2_of_free_endpoint' defined but 
 not used [-Wunused-function]
  static void v4l2_of_free_endpoint(struct v4l2_of_endpoint *endpoint)
  ^
 In file included from drivers/media/platform/soc_camera/rcar_vin.c:36:0:
 include/media/v4l2-of.h:112:13: warning: 'v4l2_of_free_endpoint' defined but 
 not used [-Wunused-function]
  static void v4l2_of_free_endpoint(struct v4l2_of_endpoint *endpoint)
  ^
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 ---
 diff --git a/include/media/v4l2-of.h b/include/media/v4l2-of.h
 index 241e98a..4dc34b2 100644
 --- a/include/media/v4l2-of.h
 +++ b/include/media/v4l2-of.h
 @@ -103,13 +103,13 @@ static inline int v4l2_of_parse_endpoint(const struct 
 device_node *node,
   return -ENOSYS;
  }
  
 -struct v4l2_of_endpoint *v4l2_of_alloc_parse_endpoint(
 +static inline struct v4l2_of_endpoint *v4l2_of_alloc_parse_endpoint(
   const struct device_node *node)
  {
   return NULL;
  }
  
 -static void v4l2_of_free_endpoint(struct v4l2_of_endpoint *endpoint)
 +static inline void v4l2_of_free_endpoint(struct v4l2_of_endpoint *endpoint)
  {
  }
  

Oops. My bad. Thanks for the patch!

Acked-by: Sakari Ailus sakari.ai...@linux.intel.com

-- 
Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 10/10] leds: aat1290: add support for V4L2 Flash sub-device

2015-04-28 Thread Jacek Anaszewski

Hi Sakari,

On 04/28/2015 04:02 PM, Sakari Ailus wrote:

Hi Jacek,

On Tue, Apr 28, 2015 at 09:18:50AM +0200, Jacek Anaszewski wrote:

Add support for V4L2 Flash sub-device to the aat1290 LED Flash class
driver. The support allows for V4L2 Flash sub-device to take the control
of the LED Flash class device.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Bryan Wu coolo...@gmail.com
Cc: Richard Purdie rpur...@rpsys.net
Cc: Sakari Ailus sakari.ai...@iki.fi
---
  drivers/leds/Kconfig|1 +
  drivers/leds/leds-aat1290.c |  137 +--
  2 files changed, 132 insertions(+), 6 deletions(-)

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index dd7834c..874df63 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -47,6 +47,7 @@ config LEDS_AAT1290
depends on LEDS_CLASS_FLASH
depends on GPIOLIB
depends on OF
+   depends on PINCTRL
help
 This option enables support for the LEDs on the AAT1290.

diff --git a/drivers/leds/leds-aat1290.c b/drivers/leds/leds-aat1290.c
index 03e5b96..f37f848 100644
--- a/drivers/leds/leds-aat1290.c
+++ b/drivers/leds/leds-aat1290.c
@@ -17,9 +17,11 @@
  #include linux/module.h
  #include linux/mutex.h
  #include linux/of.h
+#include linux/pinctrl/consumer.h
  #include linux/platform_device.h
  #include linux/slab.h
  #include linux/workqueue.h
+#include media/v4l2-flash-led-class.h

  #define AAT1290_MOVIE_MODE_CURRENT_ADDR   17
  #define AAT1290_MAX_MM_CURR_PERCENT_0 16
@@ -52,6 +54,8 @@ struct aat1290_led_config_data {
u32 max_flash_current;
/* maximum flash timeout */
u32 max_flash_tm;
+   /* external strobe capability */
+   bool has_external_strobe;
/* max LED brightness level */
enum led_brightness max_brightness;
  };
@@ -64,6 +68,8 @@ struct aat1290_led {

/* corresponding LED Flash class device */
struct led_classdev_flash fled_cdev;
+   /* V4L2 Flash device */
+   struct v4l2_flash *v4l2_flash;

/* FLEN pin */
struct gpio_desc *gpio_fl_en;
@@ -230,11 +236,15 @@ static int aat1290_led_flash_timeout_set(struct 
led_classdev_flash *fled_cdev,
  }

  static int aat1290_led_parse_dt(struct aat1290_led *led,
-   struct aat1290_led_config_data *cfg)
+   struct aat1290_led_config_data *cfg,
+   struct device_node **sub_node)
  {
struct led_classdev *led_cdev = led-fled_cdev.led_cdev;
struct device *dev = led-pdev-dev;
struct device_node *child_node;
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+   struct pinctrl *pinctrl;
+#endif
int ret = 0;

led-gpio_fl_en = devm_gpiod_get(dev, flen);
@@ -251,6 +261,17 @@ static int aat1290_led_parse_dt(struct aat1290_led *led,
return ret;
}

+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+   pinctrl = devm_pinctrl_get_select_default(led-pdev-dev);
+   if (IS_ERR(pinctrl)) {
+   cfg-has_external_strobe = false;
+   dev_info(dev,
+No support for external strobe detected.\n);
+   } else {
+   cfg-has_external_strobe = true;
+   }
+#endif
+
child_node = of_get_next_available_child(dev-of_node, NULL);
if (!child_node) {
dev_err(dev, No DT child node found for connected LED.\n);
@@ -288,6 +309,8 @@ static int aat1290_led_parse_dt(struct aat1290_led *led,

of_node_put(child_node);

+   *sub_node = child_node;
+
return ret;
  }

@@ -316,7 +339,8 @@ int init_mm_current_scale(struct aat1290_led *led,
int i, max_mm_current =
AAT1290_MAX_MM_CURRENT(cfg-max_flash_current);

-   led-mm_current_scale = kzalloc(sizeof(max_mm_current_percent),
+   led-mm_current_scale = devm_kzalloc(led-pdev-dev,
+   sizeof(max_mm_current_percent),
GFP_KERNEL);
if (!led-mm_current_scale)
return -ENOMEM;
@@ -329,11 +353,12 @@ int init_mm_current_scale(struct aat1290_led *led,
  }

  static int aat1290_led_get_configuration(struct aat1290_led *led,
-   struct aat1290_led_config_data *cfg)
+   struct aat1290_led_config_data *cfg,
+   struct device_node **sub_node)
  {
int ret;

-   ret = aat1290_led_parse_dt(led, cfg);
+   ret = aat1290_led_parse_dt(led, cfg, sub_node);
if (ret  0)
return ret;
/*
@@ -346,7 +371,10 @@ static int aat1290_led_get_configuration(struct 
aat1290_led *led,

aat1290_led_validate_mm_current(led, cfg);

-   kfree(led-mm_current_scale);
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+#else
+   devm_kfree(led-pdev-dev, led-mm_current_scale);
+#endif