Re: [PATCH 09/14] zoran: fix indent

2015-04-30 Thread Lad, Prabhakar
On Tue, Apr 28, 2015 at 4:43 PM, Mauro Carvalho Chehab
 wrote:
> 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 
>
Acked-by: Lad, Prabhakar 

Cheers,
--Prabhakar Lad
--
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 18/27] cx25840: fix bad identing

2015-04-30 Thread Lad, Prabhakar
On Thu, Apr 30, 2015 at 12:06 AM, Mauro Carvalho Chehab
 wrote:
> drivers/media/i2c/cx25840/cx25840-core.c:974 input_change() warn: 
> inconsistent indenting
>
> Signed-off-by: Mauro Carvalho Chehab 
>
Acked-by: Lad, Prabhakar 

Cheers,
--Prabhakar Lad
--
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 3/3] am437x: remove unused variable

2015-04-30 Thread Lad, Prabhakar
On Tue, Apr 28, 2015 at 12:59 PM, Mauro Carvalho Chehab
 wrote:
> 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 
> Signed-off-by: Mauro Carvalho Chehab 
>
Acked-by: Lad, Prabhakar 

Cheers,
--Prabhakar Lad
--
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 2/3] am437x: Fix a wrong identation

2015-04-30 Thread Lad, Prabhakar
On Tue, Apr 28, 2015 at 12:59 PM, Mauro Carvalho Chehab
 wrote:
> drivers/media/platform/am437x/am437x-vpfe.c:513 vpfe_ccdc_set_params() warn: 
> inconsistent indenting
>
> Cc: Benoit Parrot 
> Signed-off-by: Mauro Carvalho Chehab 
>
Acked-by: Lad, Prabhakar 

Cheers,
--Prabhakar Lad
--
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/3] am437x-vpfe: really update the vpfe_ccdc_update_raw_params data

2015-04-30 Thread Lad, Prabhakar
On Tue, Apr 28, 2015 at 12:59 PM, Mauro Carvalho Chehab
 wrote:
> 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 
> Signed-off-by: Mauro Carvalho Chehab 
>
Acked-by: Lad, Prabhakar 

Cheers,
--Prabhakar Lad
--
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] libgencec: Add userspace library for the generic CEC kernel interface

2015-04-30 Thread Kamil Debski
Hi Emil,

From: linux-media-ow...@vger.kernel.org [mailto:linux-media-
ow...@vger.kernel.org] On Behalf Of Emil Velikov
Sent: Wednesday, April 29, 2015 5:00 PM
> 
> Hi Kamil,
> 
> Allow me to put a few suggestions:
> 
> On 29 April 2015 at 11:02, Kamil Debski  wrote:
> > This is the first version of the libGenCEC library. It was designed
> to
> > act as an interface between the generic CEC kernel API and userspace
> > applications. It provides a simple interface for applications and an
> > example application that can be used to test the CEC functionality.
> >
> > signed-off-by: Kamil Debski 
> > ---
> >  AUTHORS  |1 +
> >  INSTALL  |9 +
> >  LICENSE  |  202 
> >  Makefile.am  |4 +
> >  README   |   22 ++
> >  configure.ac |   24 ++
> >  doc/index.html   |  345 +++
> >  examples/Makefile.am |4 +
> >  examples/cectest.c   |  631
> ++
> >  include/gencec.h |  255 
> >  src/Makefile.am  |4 +
> >  src/gencec.c |  445 +++
> >  12 files changed, 1946 insertions(+)
> >  create mode 100644 AUTHORS
> >  create mode 100644 INSTALL
> >  create mode 100644 LICENSE
> >  create mode 100644 Makefile.am
> >  create mode 100644 README
> >  create mode 100644 configure.ac
> >  create mode 100644 doc/index.html
> >  create mode 100644 examples/Makefile.am  create mode 100644
> > examples/cectest.c  create mode 100644 include/gencec.h  create mode
> > 100644 m4/.gitkeep  create mode 100644 src/Makefile.am  create mode
> > 100644 src/gencec.c
> >
> > diff --git a/AUTHORS b/AUTHORS
> > new file mode 100644
> > index 000..e4b7117
> > --- /dev/null
> > +++ b/AUTHORS
> > @@ -0,0 +1 @@
> > +Kamil Debski 
> > diff --git a/INSTALL b/INSTALL
> > new file mode 100644
> > index 000..aac6101
> > --- /dev/null
> > +++ b/INSTALL
> > @@ -0,0 +1,9 @@
> > +To install libgencec run following commands:
> > +
> > +autoreconf -i
> You might want add --force in here, otherwise the files will stay as-is
> if you update libtool and friends "mid-flight".
> Many projects include autogen.sh like the following. Feel free to add
> it to libgencec.

Thanks, I'll include this in the next version.
 
> $cat autogen.sh
> #! /bin/sh
> 
> srcdir=`dirname "$0"`
> test -z "$srcdir" && srcdir=.
> 
> ORIGDIR=`pwd`
> cd "$srcdir"
> 
> autoreconf --force --verbose --install || exit 1 cd "$ORIGDIR" || exit
> $?
> 
> if test -z "$NOCONFIGURE"; then
> "$srcdir"/configure "$@"
> fi
> 
> 
> 
> > --- /dev/null
> > +++ b/configure.ac
> > @@ -0,0 +1,24 @@
> 
> You can save yourself some headaches if you restrict old and/or buggy
> autoconf versions which don't work with the project.
> If I have to guess 2.60 should be ok.
> AC_PREREQ([XXX])

Good suggestion, thanks.

> 
> > +AC_INIT([libgencec], [0.1], [k.deb...@samsung.com])
> > +AM_INIT_AUTOMAKE([-Wall -Werror foreign])
> > +
> > +AC_PROG_CC
> > +AM_PROG_AR
> > +AC_CONFIG_MACRO_DIR([m4])
> > +AC_DEFINE([_GNU_SOURCE], [], [Use GNU extensions])
> > +
> 
> Same for libtool - 2.2 perhaps ?
> LT_PREREQ([XXX])

I agree.

> 
> > +LT_INIT
> > +
> > +# Checks for typedefs, structures, and compiler characteristics.
> > +AC_C_INLINE
> > +AC_TYPE_SIZE_T
> > +AC_TYPE_UINT16_T
> > +AC_TYPE_UINT32_T
> > +AC_TYPE_UINT8_T
> > +
> > +#AC_CHECK_LIB([c], [malloc])
> > +# Checks for library functions.
> > +#AC_FUNC_MALLOC
> > +l
> > +AC_CONFIG_FILES([Makefile src/Makefile examples/Makefile])
> Would be nice if the library provides libgencec.pc file. This way any
> users can avoid the explicit header/library check, amongst other useful
> bits.

Thanks for the suggestion, I'll look into this.
 
> > --- /dev/null
> > +++ b/examples/Makefile.am
> > @@ -0,0 +1,4 @@
> > +bin_PROGRAMS = cectest
> > +cectest_SOURCES = cectest.c
> > +AM_CPPFLAGS=-I$(top_srcdir)/include/
> > +AM_LDFLAGS=-L../src/ -lgencec
> The following seems more common (in the projects I've seen at least)
> cectest_LDADD = $(top_builddir)/src/libgencec.la
> 
> > diff --git a/m4/.gitkeep b/m4/.gitkeep new file mode 100644 index
> > 000..e69de29
> Haven't seen any projects doing this. Curious what the benefits of
> keeping and empty folder might be ?

When I run autoreconf -i it complained about missing m4 folder, hence I added
this filler file such that the folder is created. Any suggestion on how to do
this better?

> 
> > diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644
> > index 000..cb024f0
> > --- /dev/null
> > +++ b/src/Makefile.am
> > @@ -0,0 +1,4 @@
> > +lib_LTLIBRARIES = libgencec.la
> > +libgencec_la_SOURCES = gencec.c
> > +libgencec_la_LDFLAGS = -version-info 0:1:0
> You might want to add -no-undefined in order to prevent having a
> library with unresolved symbols.
> 
> Hope you find the above useful :-)

Thank you so much for your review. It is my first real approach at autotools,
so your commen

[PATCH v7] Documentation: leds: Add description of v4l2-flash sub-device

2015-04-30 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 
Acked-by: Kyungmin Park 
Acked-by: Sakari Ailus 
Cc: Bryan Wu 
Cc: Richard Purdie 
---
 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..4cedc58 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 ,
+   * 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 wrapper.
+
+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 v7] leds: Add driver for AAT1290 flash LED controller

2015-04-30 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 
Acked-by: Kyungmin Park 
Acked-by: Sakari Ailus 
Cc: Bryan Wu 
Cc: Richard Purdie 
---
Fixed issue reported by 0-DAY kernel test infrastructure:
drivers/leds/leds-aat1290.c:443:3-8: No need to set .owner here. The core will 
do it
Fixed issue reported by Coccinelle:
drivers/leds/leds-aat1290.c:204:5-10: WARNING: Comparison of bool to 0/1

 drivers/leds/Kconfig|8 +
 drivers/leds/Makefile   |1 +
 drivers/leds/leds-aat1290.c |  451 +++
 3 files changed, 460 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..6ea1d54
--- /dev/null
+++ b/drivers/leds/leds-aat1290.c
@@ -0,0 +1,451 @@
+/*
+ * 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 
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#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 */
+   for (i = 0; i < addr; +

[PATCH v7] leds: Add support for max77693 mfd flash cell

2015-04-30 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 
Signed-off-by: Andrzej Hajda 
Acked-by: Kyungmin Park 
Cc: Bryan Wu 
Cc: Richard Purdie 
---
Fixed issues reported by 0-DAY kernel test infrastructure:

- drivers/leds/leds-max77693.c:978:3-8: No need to set .owner here. The core 
will do it.
* removed the line
- drivers/leds/leds-max77693.c:193 max77693_add_mode() warn: maybe use && 
instead of &
* redesigned max77693_add_mode function


 drivers/leds/Kconfig |   10 +
 drivers/leds/Makefile|1 +
 drivers/leds/leds-max77693.c |  980 ++
 3 files changed, 991 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..eecaa92
--- /dev/null
+++ b/drivers/leds/leds-max77693.c
@@ -0,0 +1,980 @@
+/*
+ * LED Flash class driver for the flash cell of max77693 mfd.
+ *
+ * Copyright (C) 2015, Samsung Electronics Co., Ltd.
+ *
+ * Authors: Jacek Anaszewski 
+ *  Andrzej Hajda 
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#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 iout_flash_max[2];
+
+   /* current flash timeout cache */

[PATCH v7] media: Add registration helpers for V4L2 flash sub-devices

2015-04-30 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 
Acked-by: Kyungmin Park 
Cc: Sakari Ailus 
Cc: Hans Verkuil 
---
- moved enum ctrl_init_data_id definition from *.c to *.h file
  and switched to allocating the memory for ctrls property of
  struct v4l2_flash dynamically
- set V4L2_CTRL_FLAG_EXECUTE_ON_WRITE flag for the writable volatile
  controls to meet the requirements introduced by the recent modifications
  in v42l-ctrl.c

 drivers/media/v4l2-core/Kconfig|   11 +
 drivers/media/v4l2-core/Makefile   |2 +
 drivers/media/v4l2-core/v4l2-flash-led-class.c |  653 
 include/media/v4l2-flash-led-class.h   |  127 +
 4 files changed, 793 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..8fb6b05
--- /dev/null
+++ b/drivers/media/v4l2-core/v4l2-flash-led-class.c
@@ -0,0 +1,653 @@
+/*
+ * V4L2 flash LED sub-device registration helpers.
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd
+ * Author: Jacek Anaszewski 
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#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)
+
+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,
+};
+
+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
+  

Re: [PATCH/RFC] v4l: vsp1: Align crop rectangle to even boundary for YUV formats

2015-04-30 Thread Sergei Shtylyov

Hello.

On 4/29/2015 8:05 PM, Yoshihiro Kaneko wrote:


From: Damian Hobson-Garcia 



Make sure that there are valid values in the crop rectangle to ensure
that the color plane doesn't get shifted when cropping.
Since there is no distintion between 12bit and 16bit YUV formats in


   Вistinсtion.


at the subdev level, use the more restrictive 12bit limits for all YUV
formats.



Signed-off-by: Damian Hobson-Garcia 
Signed-off-by: Yoshihiro Kaneko 
---



This patch is based on the master branch of linuxtv.org/media_tree.git.



  drivers/media/platform/vsp1/vsp1_rwpf.c | 14 --
  1 file changed, 12 insertions(+), 2 deletions(-)



diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.c 
b/drivers/media/platform/vsp1/vsp1_rwpf.c
index fa71f46..9fed0b2 100644
--- a/drivers/media/platform/vsp1/vsp1_rwpf.c
+++ b/drivers/media/platform/vsp1/vsp1_rwpf.c
@@ -197,11 +197,21 @@ int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev,
 */
format = vsp1_entity_get_pad_format(&rwpf->entity, cfg, RWPF_PAD_SINK,
sel->which);
+
+   if (format->code == MEDIA_BUS_FMT_AYUV8_1X32) {
+   sel->r.left = (sel->r.left + 1) & ~1;
+   sel->r.top = (sel->r.top + 1) & ~1;


   There's ALIGN() macro just for that.


+   sel->r.width = (sel->r.width) & ~1;
+   sel->r.height = (sel->r.height) & ~1;


   Parens not needed.


+   }
+
sel->r.left = min_t(unsigned int, sel->r.left, format->width - 2);
sel->r.top = min_t(unsigned int, sel->r.top, format->height - 2);
if (rwpf->entity.type == VSP1_ENTITY_WPF) {
-   sel->r.left = min_t(unsigned int, sel->r.left, 255);
-   sel->r.top = min_t(unsigned int, sel->r.top, 255);
+   int maxcrop =
+   format->code == MEDIA_BUS_FMT_AYUV8_1X32 ? 254 : 255;


   I think you need an empty line here.


+   sel->r.left = min_t(unsigned int, sel->r.left, maxcrop);
+   sel->r.top = min_t(unsigned int, sel->r.top, maxcrop);
}
sel->r.width = min_t(unsigned int, sel->r.width,
 format->width - sel->r.left);


WBR, Sergei

--
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/RFC] v4l: vsp1: Align crop rectangle to even boundary for YUV formats

2015-04-30 Thread Geert Uytterhoeven
On Thu, Apr 30, 2015 at 1:22 PM, Sergei Shtylyov
 wrote:
>> Since there is no distintion between 12bit and 16bit YUV formats in
>
>Вistinсtion.

Distinction?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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/RFC] v4l: vsp1: Align crop rectangle to even boundary for YUV formats

2015-04-30 Thread Sergei Shtylyov

Hello.

On 4/30/2015 2:44 PM, Geert Uytterhoeven wrote:


Since there is no distintion between 12bit and 16bit YUV formats in



Вistinсtion.



Distinction?


   Sorry, yes. :-)


Gr{oetje,eeting}s,
 Geert


WBR, Sergei

--
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 v1 09/11] DT: Add documentation for exynos4-is 'flashes' property

2015-04-30 Thread Jacek Anaszewski

Hi Sakari and Sylwester,

On 04/03/2015 12:53 PM, Sylwester Nawrocki wrote:

Hello,

On 25/03/15 09:52, Jacek Anaszewski wrote:

On 03/25/2015 02:06 AM, Sakari Ailus wrote:

On Fri, Mar 20, 2015 at 04:03:29PM +0100, Jacek Anaszewski wrote:

This patch adds a description of 'flashes' property
to the samsung-fimc.txt.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Sylwester Nawrocki 
---
   .../devicetree/bindings/media/samsung-fimc.txt |8 
   1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/samsung-fimc.txt 
b/Documentation/devicetree/bindings/media/samsung-fimc.txt
index 922d6f8..cb0e263 100644
--- a/Documentation/devicetree/bindings/media/samsung-fimc.txt
+++ b/Documentation/devicetree/bindings/media/samsung-fimc.txt
@@ -40,6 +40,13 @@ should be inactive. For the "active-a" state the camera port 
A must be activated
   and the port B deactivated and for the state "active-b" it should be the 
other
   way around.

+Optional properties:
+
+- flashes - Array of phandles to the flash LEDs that can be controlled by the
+   sub-devices contained in this media device. Flash LED is
+   represented by a child node of a flash LED device


This should be in
Documentation/devicetree/bindings/media/video-interfaces.txt.


This file documents DT nodes starting from the level one below
the camera node aggregating all the devices belonging to the media
device (I am referring to the 'camera' node from the file
arch/arm/boot/dts/exynos4412-trats2.dts). Should 'leds' property be
put there, the aggregating node would have to be described there at
first. I am wondering whether video-interfaces is a suitable place
for documenting illuminators, though.


Should flash devices be associated with sensors somehow rather than ISPs?
That's how they commonly are arranged, however that doesn't limit placing
them in silly places.

I'm not necessarily saying the flashes-property should be present in
sensor's DT nodes, but it'd be good to be able to make the association if
it's there.


IMHO 'flashes' is a misleading name, these are simply high brightness LEDs
which can work as camera flash or auxiliary light for camcording, in context of
a camera device.

The led DT nodes which the entries of above flashes property is pointing to
have a text label, which presumably could be used to associate a LED device
with an image sensor. That said, I think we should allow a property as above
'flashes' be placed in aggregate camera node and also in sensor device node.
I think it should be left to the bridge/ISP binding to choose one option or
the other.


I agree.


For now I would propose to rename the "flashes" property to "samsung,leds" or
"leds" and leave it in "camera" node.


How about flash-leds?


I know of a SoC, which drives the flash from its on-chip ISP. The GPIO
connected to the flash controller's external strobe pin can be
configured so that the signal is routed to it from the ISP or from
CPU (for software strobe mode).

I think that Sylwester could say more in this subject.



+   (see Documentation/devicetree/bindings/leds/common.txt).
+
   The 'camera' node must include at least one 'fimc' child node.


@@ -166,6 +173,7 @@ Example:
clock-output-names = "cam_a_clkout", "cam_b_clkout";
pinctrl-names = "default";
pinctrl-0 = <&cam_port_a_clk_active>;
+   flashes = <&camera_flash>, <&system_torch>;
status = "okay";
#address-cells = <1>;
#size-cells = <1>;


There will be other kind of devices that have somewhat similar relationship.
They just haven't been defined yet. Lens controllers or EEPROM for instance.
The two are an integral part of a module, something which is not modelled in
DT in any way, but perhaps should be.


Indeed, I'd say it belongs to a particular image sensor (camera module) binding
to describe each its physical subdevices, i.e. if a pointer to lens or EEPROM
is needed in the main module DT node.


Do you suggest using more generic name than 'flashes'?






--
Best Regards,
Jacek Anaszewski
--
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.2] Clean up and move dt3155 out of staging

2015-04-30 Thread Hans Verkuil
This pull request cleans up the dt3155 driver and moves it out of staging.

Tested with my dt3155 board.

Regards,

Hans

The following changes since commit e183201b9e917daf2530b637b2f34f1d5afb934d:

  [media] uvcvideo: add support for VIDIOC_QUERY_EXT_CTRL (2015-04-10 10:29:27 
-0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git dt3155

for you to fetch changes up to 682454513c7c17c981645e5d9796ae5bed8edf61:

  dt3155: add GFP_DMA32 flag to vb2 queue (2015-04-26 11:27:00 +0200)


Hans Verkuil (13):
  dt3155v4l: code cleanup
  dt3155v4l: remove unused statistics
  dt3155v4l: add v4l2_device support
  dt3155v4l: remove pointless dt3155_alloc/free_coherent
  dt3155v4l: remove bogus single-frame capture in init_board
  dt3155v4l: move vb2_queue to top-level
  dt3155v4l: drop CONFIG_DT3155_STREAMING
  dt3155v4l: correctly start and stop streaming
  dt3155v4l: drop CONFIG_DT3155_CCIR, use s_std instead
  dt3155v4l: fix format handling
  dt3155v4l: support inputs VID0-3
  dt3155: move out of staging into drivers/media/pci
  dt3155: add GFP_DMA32 flag to vb2 queue

 MAINTAINERS|   
8 +
 drivers/media/pci/Kconfig  |   
1 +
 drivers/media/pci/Makefile |   
1 +
 drivers/media/pci/dt3155/Kconfig   |  
13 +
 drivers/media/pci/dt3155/Makefile  |   
1 +
 drivers/media/pci/dt3155/dt3155.c  | 
627 +
 drivers/{staging/media/dt3155v4l/dt3155v4l.h => media/pci/dt3155/dt3155.h} |  
64 +--
 drivers/staging/media/Kconfig  |   
2 -
 drivers/staging/media/Makefile |   
1 -
 drivers/staging/media/dt3155v4l/Kconfig|  
29 --
 drivers/staging/media/dt3155v4l/Makefile   |   
1 -
 drivers/staging/media/dt3155v4l/dt3155v4l.c| 
981 
 12 files changed, 675 insertions(+), 1054 deletions(-)
 create mode 100644 drivers/media/pci/dt3155/Kconfig
 create mode 100644 drivers/media/pci/dt3155/Makefile
 create mode 100644 drivers/media/pci/dt3155/dt3155.c
 rename drivers/{staging/media/dt3155v4l/dt3155v4l.h => 
media/pci/dt3155/dt3155.h} (82%)
 delete mode 100644 drivers/staging/media/dt3155v4l/Kconfig
 delete mode 100644 drivers/staging/media/dt3155v4l/Makefile
 delete mode 100644 drivers/staging/media/dt3155v4l/dt3155v4l.c
--
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 03/14] saa7134: fix indent issues

2015-04-30 Thread Mauro Carvalho Chehab
Em Thu, 30 Apr 2015 08:20:49 +0200
Hans Verkuil  escreveu:

> On 04/28/2015 05:43 PM, Mauro Carvalho Chehab wrote:
> > 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 
> > 
> > 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);
> 
> If you're changing this anyway, why not use pr_info instead?

Converting it to pr_foo is actually complex. Anyway, I found some time
today to do such conversion. I'll be adding on a patch series I'm about
to send.

> 
> > 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",
> 
> Ditto.
> 
> > +   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);
> >}
> > 
> 
> Regards,
> 
>   Hans
--
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/22] m2m-deinterlace: remove dead code

2015-04-30 Thread Mauro Carvalho Chehab
drivers/media/platform/m2m-deinterlace.c:1063 deinterlace_probe() info: 
ignoring unreachable code.

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/platform/m2m-deinterlace.c 
b/drivers/media/platform/m2m-deinterlace.c
index 92d954973ccf..c07f367aa436 100644
--- a/drivers/media/platform/m2m-deinterlace.c
+++ b/drivers/media/platform/m2m-deinterlace.c
@@ -1060,7 +1060,6 @@ static int deinterlace_probe(struct platform_device *pdev)
 
return 0;
 
-   v4l2_m2m_release(pcdev->m2m_dev);
 err_m2m:
video_unregister_device(&pcdev->vfd);
 err_ctx:
-- 
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/22] saa7134-alsa: use pr_debug() instead of printk

2015-04-30 Thread Mauro Carvalho Chehab
On saa7134-alsa, there is just one printk macro that use a
different debug level.

It should be easy to enable/disable this one using dynamic_printk,
if one need to individually control it.

So, this module can easily use pr_debug() instead of using its
own macros.

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/pci/saa7134/saa7134-alsa.c 
b/drivers/media/pci/saa7134/saa7134-alsa.c
index f8764a4c2f15..4199fbf9bc44 100644
--- a/drivers/media/pci/saa7134/saa7134-alsa.c
+++ b/drivers/media/pci/saa7134/saa7134-alsa.c
@@ -32,10 +32,6 @@
 #include 
 #include 
 
-static unsigned int debug;
-module_param(debug, int, 0644);
-MODULE_PARM_DESC(debug,"enable debug messages [alsa]");
-
 /*
  * Configuration macros
  */
@@ -57,11 +53,6 @@ module_param_array(enable, int, NULL, 0444);
 MODULE_PARM_DESC(index, "Index value for SAA7134 capture interface(s).");
 MODULE_PARM_DESC(enable, "Enable (or not) the SAA7134 capture interface(s).");
 
-#define dprintk(fmt, arg...)if (debug) \
-   printk(KERN_DEBUG "%s/alsa: " fmt, dev->name , ##arg)
-
-
-
 /*
  * Main chip structure
  */
@@ -149,11 +140,11 @@ static void saa7134_irq_alsa_done(struct saa7134_dev *dev,
 
spin_lock(&dev->slock);
if (UNSET == dev->dmasound.dma_blk) {
-   dprintk("irq: recording stopped\n");
+   pr_debug("irq: recording stopped\n");
goto done;
}
if (0 != (status & 0x0f00))
-   dprintk("irq: lost %ld\n", (status >> 24) & 0x0f);
+   pr_debug("irq: lost %ld\n", (status >> 24) & 0x0f);
if (0 == (status & 0x1000)) {
/* odd */
if (0 == (dev->dmasound.dma_blk & 0x01))
@@ -164,13 +155,13 @@ static void saa7134_irq_alsa_done(struct saa7134_dev *dev,
reg = SAA7134_RS_BA2(6);
}
if (0 == reg) {
-   dprintk("irq: field oops [%s]\n",
+   pr_debug("irq: field oops [%s]\n",
(status & 0x1000) ? "even" : "odd");
goto done;
}
 
if (dev->dmasound.read_count >= dev->dmasound.blksize * 
(dev->dmasound.blocks-2)) {
-   dprintk("irq: overrun [full=%d/%d] - Blocks in 
%d\n",dev->dmasound.read_count,
+   pr_debug("irq: overrun [full=%d/%d] - Blocks in 
%d\n",dev->dmasound.read_count,
dev->dmasound.bufsize, dev->dmasound.blocks);
spin_unlock(&dev->slock);
snd_pcm_stop_xrun(dev->dmasound.substream);
@@ -180,10 +171,9 @@ static void saa7134_irq_alsa_done(struct saa7134_dev *dev,
/* next block addr */
next_blk = (dev->dmasound.dma_blk + 2) % dev->dmasound.blocks;
saa_writel(reg,next_blk * dev->dmasound.blksize);
-   if (debug > 2)
-   dprintk("irq: ok, %s, next_blk=%d, addr=%x, blocks=%u, size=%u, 
read=%u\n",
-   (status & 0x1000) ? "even" : "odd ", next_blk,
-   next_blk * dev->dmasound.blksize, dev->dmasound.blocks, 
dev->dmasound.blksize, dev->dmasound.read_count);
+   pr_debug("irq: ok, %s, next_blk=%d, addr=%x, blocks=%u, size=%u, 
read=%u\n",
+   (status & 0x1000) ? "even" : "odd ", next_blk,
+   next_blk * dev->dmasound.blksize, dev->dmasound.blocks, 
dev->dmasound.blksize, dev->dmasound.read_count);
 
/* update status & wake waiting readers */
dev->dmasound.dma_blk = (dev->dmasound.dma_blk + 1) % 
dev->dmasound.blocks;
@@ -233,7 +223,7 @@ static irqreturn_t saa7134_alsa_irq(int irq, void *dev_id)
}
 
if (loop == 10) {
-   dprintk("error! looping IRQ!");
+   pr_debug("error! looping IRQ!");
}
 
 out:
@@ -281,11 +271,11 @@ static int saa7134_alsa_dma_init(struct saa7134_dev *dev, 
int nr_pages)
 
dma->vaddr = vmalloc_32(nr_pages << PAGE_SHIFT);
if (NULL == dma->vaddr) {
-   dprintk("vmalloc_32(%d pages) failed\n", nr_pages);
+   pr_debug("vmalloc_32(%d pages) failed\n", nr_pages);
return -ENOMEM;
}
 
-   dprintk("vmalloc is at addr 0x%08lx, size=%d\n",
+   pr_debug("vmalloc is at addr 0x%08lx, size=%d\n",
(unsigned long)dma->vaddr,
nr_pages << PAGE_SHIFT);
 
@@ -572,7 +562,7 @@ static int snd_card_saa7134_capture_prepare(struct 
snd_pcm_substream * substream
break;
}
 
-   dprintk("rec_start: afmt=%d ch=%d  =>  fmt=0x%x swap=%c\n",
+   pr_debug("rec_start: afmt=%d ch=%d  =>  fmt=0x%x swap=%c\n",
runtime->format, runtime->channels, fmt,
bswap ? 'b' : '-');
/* dma: setup channel 6 (= AUDIO) */
-- 
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 09/22] saa7134: fix a few other occurrences of KERN_INFO/KERN_WARNING

2015-04-30 Thread Mauro Carvalho Chehab
On a few places, the search expression used on the script that
replaced pr_info/pr_warn didn't match, because the string were
on the next line.

It is best to manually edit those lines, and re-indent the
paragraphs.

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/pci/saa7134/saa7134-cards.c 
b/drivers/media/pci/saa7134/saa7134-cards.c
index 3159e15a57d4..5b81157a5003 100644
--- a/drivers/media/pci/saa7134/saa7134-cards.c
+++ b/drivers/media/pci/saa7134/saa7134-cards.c
@@ -7906,9 +7906,8 @@ int saa7134_board_init2(struct saa7134_dev *dev)
/* 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);
+   pr_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
@@ -8047,9 +8046,8 @@ int saa7134_board_init2(struct saa7134_dev *dev)
msg.buf = &buffer[i][0];
msg.len = ARRAY_SIZE(buffer[0]);
if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1)
-   printk(KERN_WARNING
-  "%s: Unable to enable tuner(%i).\n",
-  dev->name, i);
+   pr_warn("%s: Unable to enable tuner(%i).\n",
+   dev->name, i);
}
break;
}
@@ -8065,9 +8063,8 @@ int saa7134_board_init2(struct saa7134_dev *dev)
/* watch TV without software reboot. For solve this problem */
/* switch the tuner to analog TV mode manually. */
if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1)
-   printk(KERN_WARNING
- "%s: Unable to enable IF of the tuner.\n",
-  dev->name);
+   pr_warn("%s: Unable to enable IF of the tuner.\n",
+   dev->name);
break;
}
case SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG:
diff --git a/drivers/media/pci/saa7134/saa7134-core.c 
b/drivers/media/pci/saa7134/saa7134-core.c
index 9ffdcdcfd2b0..c206148f816b 100644
--- a/drivers/media/pci/saa7134/saa7134-core.c
+++ b/drivers/media/pci/saa7134/saa7134-core.c
@@ -772,22 +772,20 @@ static void must_configure_manually(int has_eeprom)
unsigned int i,p;
 
if (!has_eeprom)
-   printk(KERN_WARNING
-  "saa7134: \n"
-  "saa7134:  Congratulations!  Your TV card vendor saved a 
few\n"
-  "saa7134:  cents for a eeprom, thus your pci board has 
no\n"
-  "saa7134:  subsystem ID and I can't identify it 
automatically\n"
-  "saa7134: \n"
-  "saa7134: I feel better now.  Ok, here are the good 
news:\n";
-  "saa7134: You can use the card= insmod option to 
specify\n"
-  "saa7134: which board do you have.  The list:\n");
+   pr_warn("saa7134: \n"
+   "saa7134:  Congratulations!  Your TV card vendor saved 
a few\n"
+   "saa7134:  cents for a eeprom, thus your pci board has 
no\n"
+   "saa7134:  subsystem ID and I can't identify it 
automatically\n"
+   "saa7134: \n"
+   "saa7134: I feel better now.  Ok, here are the good 
news:\n";
+   "saa7134: You can use the card= insmod option to 
specify\n"
+   "saa7134: which board do you have.  The list:\n");
else
-   printk(KERN_WARNING
-  "saa7134: Board is currently unknown. You might try to 
use the card=\n"
-  "saa7134: insmod option to specify which board do you 
have, but this is\n"
-  "saa7134: somewhat risky, as might damage your card. It 
is better to ask\n"
-  "saa7134: for support at linux-media@vger.kernel.org.\n"
-  "saa7134: The supported cards are:\n");
+   pr_warn("saa7134: Board is currently unknown. You might try to 
use the card=\n"
+   "saa7134: insmod option to specify which board do you 
have, but this is\n"
+   "saa7134: somewhat risky, as might damage your card. It 
is better to ask\n"
+   "saa7134: for support at linux-media@vger.kernel.org.\n"
+   "saa7134: The supported ca

[PATCH 20/22] saa7134: change the debug macros for IR input

2015-04-30 Thread Mauro Carvalho Chehab
Rename the macros to input_dbg() and ir_dbg(), using pr_fmt()
on both, to be coherent with the other debug macro changes.

The ir_dbg() also prints the IR name.

I'm not sure if it is a good idea to keep both macros here,
but merging them would require tests on different flavors of
saaa7134-based boards.

So, for now, let's keep both.

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/pci/saa7134/saa7134-input.c 
b/drivers/media/pci/saa7134/saa7134-input.c
index 9406d5d7cdde..89f5fcf12722 100644
--- a/drivers/media/pci/saa7134/saa7134-input.c
+++ b/drivers/media/pci/saa7134/saa7134-input.c
@@ -41,10 +41,10 @@ static int pinnacle_remote;
 module_param(pinnacle_remote, int, 0644);/* Choose Pinnacle PCTV remote */
 MODULE_PARM_DESC(pinnacle_remote, "Specify Pinnacle PCTV remote: 0=coloured, 
1=grey (defaults to 0)");
 
-#define dprintk(fmt, arg...)   if (ir_debug) \
-   printk(KERN_DEBUG "%s/ir: " fmt, dev->name , ## arg)
-#define i2cdprintk(fmt, arg...)if (ir_debug) \
-   printk(KERN_DEBUG "%s/ir: " fmt, ir->name , ## arg)
+#define input_dbg(fmt, arg...) if (ir_debug) \
+   printk(KERN_DEBUG pr_fmt("input: " fmt), ## arg)
+#define ir_dbg(ir, fmt, arg...)if (ir_debug) \
+   printk(KERN_DEBUG pr_fmt("ir %s: " fmt), ir->name, ## arg)
 
 /* Helper function for raw decoding at GPIO16 or GPIO18 */
 static int saa7134_raw_decode_irq(struct saa7134_dev *dev);
@@ -75,7 +75,7 @@ static int build_key(struct saa7134_dev *dev)
}
 
data = ir_extract_bits(gpio, ir->mask_keycode);
-   dprintk("build_key gpio=0x%x mask=0x%x data=%d\n",
+   input_dbg("build_key gpio=0x%x mask=0x%x data=%d\n",
gpio, ir->mask_keycode, data);
 
switch (dev->board) {
@@ -119,7 +119,7 @@ static int get_key_flydvb_trio(struct IR_i2c *ir, enum 
rc_type *protocol,
struct saa7134_dev *dev = ir->c->adapter->algo_data;
 
if (dev == NULL) {
-   i2cdprintk("get_key_flydvb_trio: "
+   ir_dbg(ir, "get_key_flydvb_trio: "
   "ir->c->adapter->algo_data is NULL!\n");
return -EIO;
}
@@ -146,12 +146,12 @@ static int get_key_flydvb_trio(struct IR_i2c *ir, enum 
rc_type *protocol,
msleep(10);
continue;
}
-   i2cdprintk("send wake up byte to pic16C505 (IR chip)"
+   ir_dbg(ir, "send wake up byte to pic16C505 (IR chip)"
   "failed %dx\n", attempt);
return -EIO;
}
if (1 != i2c_master_recv(ir->c, &b, 1)) {
-   i2cdprintk("read error\n");
+   ir_dbg(ir, "read error\n");
return -EIO;
}
 
@@ -170,7 +170,7 @@ static int get_key_msi_tvanywhere_plus(struct IR_i2c *ir, 
enum rc_type *protocol
/*  is needed to access GPIO. Used by the saa_readl macro. */
struct saa7134_dev *dev = ir->c->adapter->algo_data;
if (dev == NULL) {
-   i2cdprintk("get_key_msi_tvanywhere_plus: "
+   ir_dbg(ir, "get_key_msi_tvanywhere_plus: "
   "ir->c->adapter->algo_data is NULL!\n");
return -EIO;
}
@@ -191,7 +191,7 @@ static int get_key_msi_tvanywhere_plus(struct IR_i2c *ir, 
enum rc_type *protocol
/* GPIO says there is a button press. Get it. */
 
if (1 != i2c_master_recv(ir->c, &b, 1)) {
-   i2cdprintk("read error\n");
+   ir_dbg(ir, "read error\n");
return -EIO;
}
 
@@ -202,7 +202,7 @@ static int get_key_msi_tvanywhere_plus(struct IR_i2c *ir, 
enum rc_type *protocol
 
/* Button pressed */
 
-   dprintk("get_key_msi_tvanywhere_plus: Key = 0x%02X\n", b);
+   input_dbg("get_key_msi_tvanywhere_plus: Key = 0x%02X\n", b);
*protocol = RC_TYPE_UNKNOWN;
*scancode = b;
*toggle = 0;
@@ -219,7 +219,7 @@ static int get_key_kworld_pc150u(struct IR_i2c *ir, enum 
rc_type *protocol,
/*  is needed to access GPIO. Used by the saa_readl macro. */
struct saa7134_dev *dev = ir->c->adapter->algo_data;
if (dev == NULL) {
-   i2cdprintk("get_key_kworld_pc150u: "
+   ir_dbg(ir, "get_key_kworld_pc150u: "
   "ir->c->adapter->algo_data is NULL!\n");
return -EIO;
}
@@ -240,7 +240,7 @@ static int get_key_kworld_pc150u(struct IR_i2c *ir, enum 
rc_type *protocol,
/* GPIO says there is a button press. Get it. */
 
if (1 != i2c_master_recv(ir->c, &b, 1)) {
-   i2cdprintk("read error\n");
+   ir_dbg(ir, "read error\n");
return -EIO;
}
 
@@ -251,7 +251,7 @@ static int get_key_kworld_pc150u(struct IR_i2c *ir, enum 
rc_type *protocol,
 
/* Button pressed */
 
-   dprintk("get_key_kworld_pc150u: Key = 0x%02X\n", b);
+   input_dbg("get_key_kworld_pc150u: Key = 0x%02X\n", b);
*protocol = RC_TYPE_

[PATCH 17/22] saa7134-ts: use pr_fmt() at the debug macro

2015-04-30 Thread Mauro Carvalho Chehab
instead of using dev->name, let's use pr_fmt() like on the
other parts of saa7134. Also, rename the debug macro to
ts_dbg() to match the namespace for the debug macros.

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/pci/saa7134/saa7134-ts.c 
b/drivers/media/pci/saa7134/saa7134-ts.c
index 8a2938c34d32..5d7c4afac8e6 100644
--- a/drivers/media/pci/saa7134/saa7134-ts.c
+++ b/drivers/media/pci/saa7134/saa7134-ts.c
@@ -35,8 +35,8 @@ static unsigned int ts_debug;
 module_param(ts_debug, int, 0644);
 MODULE_PARM_DESC(ts_debug,"enable debug messages [ts]");
 
-#define dprintk(fmt, arg...)   if (ts_debug) \
-   printk(KERN_DEBUG "%s/ts: " fmt, dev->name , ## arg)
+#define ts_dbg(fmt, arg...)if (ts_debug) \
+   printk(KERN_DEBUG pr_fmt("ts: " fmt), ## arg)
 
 /* -- */
 static int buffer_activate(struct saa7134_dev *dev,
@@ -44,7 +44,7 @@ static int buffer_activate(struct saa7134_dev *dev,
   struct saa7134_buf *next)
 {
 
-   dprintk("buffer_activate [%p]",buf);
+   ts_dbg("buffer_activate [%p]",buf);
buf->top_seen = 0;
 
if (!dev->ts_started)
@@ -53,12 +53,12 @@ static int buffer_activate(struct saa7134_dev *dev,
if (NULL == next)
next = buf;
if (V4L2_FIELD_TOP == dev->ts_field) {
-   dprintk("- [top] buf=%p next=%p\n",buf,next);
+   ts_dbg("- [top] buf=%p next=%p\n",buf,next);
saa_writel(SAA7134_RS_BA1(5),saa7134_buffer_base(buf));
saa_writel(SAA7134_RS_BA2(5),saa7134_buffer_base(next));
dev->ts_field = V4L2_FIELD_BOTTOM;
} else {
-   dprintk("- [bottom]  buf=%p next=%p\n",buf,next);
+   ts_dbg("- [bottom]  buf=%p next=%p\n",buf,next);
saa_writel(SAA7134_RS_BA1(5),saa7134_buffer_base(next));
saa_writel(SAA7134_RS_BA2(5),saa7134_buffer_base(buf));
dev->ts_field = V4L2_FIELD_TOP;
@@ -95,7 +95,7 @@ int saa7134_ts_buffer_prepare(struct vb2_buffer *vb2)
struct sg_table *dma = vb2_dma_sg_plane_desc(vb2, 0);
unsigned int lines, llength, size;
 
-   dprintk("buffer_prepare [%p]\n", buf);
+   ts_dbg("buffer_prepare [%p]\n", buf);
 
llength = TS_PACKET_SIZE;
lines = dev->ts.nr_packets;
@@ -239,7 +239,7 @@ int saa7134_ts_init1(struct saa7134_dev *dev)
 /* Function for stop TS */
 int saa7134_ts_stop(struct saa7134_dev *dev)
 {
-   dprintk("TS stop\n");
+   ts_dbg("TS stop\n");
 
if (!dev->ts_started)
return 0;
@@ -261,7 +261,7 @@ int saa7134_ts_stop(struct saa7134_dev *dev)
 /* Function for start TS */
 int saa7134_ts_start(struct saa7134_dev *dev)
 {
-   dprintk("TS start\n");
+   ts_dbg("TS start\n");
 
if (WARN_ON(dev->ts_started))
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 14/22] saa7134: use pr_warn() on some places where no KERN_foo were used

2015-04-30 Thread Mauro Carvalho Chehab
On a few places, mostly during board detection, some printk()
macros were called without especifying any message level.

Those are actually warnings. So, use pr_warn() for them.

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/pci/saa7134/saa7134-cards.c 
b/drivers/media/pci/saa7134/saa7134-cards.c
index 5b81157a5003..abbeeb923114 100644
--- a/drivers/media/pci/saa7134/saa7134-cards.c
+++ b/drivers/media/pci/saa7134/saa7134-cards.c
@@ -7159,10 +7159,10 @@ MODULE_DEVICE_TABLE(pci, saa7134_pci_tbl);
 
 static void board_flyvideo(struct saa7134_dev *dev)
 {
-   printk("%s: there are different flyvideo cards with different tuners\n"
-  "%s: out there, you might have to use the tuner= insmod\n"
-  "%s: option to override the default value.\n",
-  dev->name, dev->name, dev->name);
+   pr_warn("%s: there are different flyvideo cards with different tuners\n"
+   "%s: out there, you might have to use the tuner= insmod\n"
+   "%s: option to override the default value.\n",
+   dev->name, dev->name, dev->name);
 }
 
 static int saa7134_xc2028_callback(struct saa7134_dev *dev,
@@ -7513,10 +7513,10 @@ int saa7134_board_init1(struct saa7134_dev *dev)
dev->has_remote = SAA7134_REMOTE_GPIO;
break;
case SAA7134_BOARD_MD5044:
-   printk("%s: seems there are two different versions of the 
MD5044\n"
-  "%s: (with the same ID) out there.  If sound doesn't 
work for\n"
-  "%s: you try the audio_clock_override=0x20 insmod 
option.\n",
-  dev->name,dev->name,dev->name);
+   pr_warn("%s: seems there are two different versions of the 
MD5044\n"
+   "%s: (with the same ID) out there.  If sound doesn't 
work for\n"
+   "%s: you try the audio_clock_override=0x20 insmod 
option.\n",
+   dev->name,dev->name,dev->name);
break;
case SAA7134_BOARD_CINERGY400_CARDBUS:
/* power-up tuner chip */
@@ -7641,10 +7641,10 @@ int saa7134_board_init1(struct saa7134_dev *dev)
dev->has_remote = SAA7134_REMOTE_I2C;
break;
case SAA7134_BOARD_AVERMEDIA_A169_B:
-   printk("%s: %s: dual saa713x broadcast decoders\n"
-  "%s: Sorry, none of the inputs to this chip are 
supported yet.\n"
-  "%s: Dual decoder functionality is disabled for now, use 
the other chip.\n",
-  dev->name,card(dev).name,dev->name,dev->name);
+   pr_warn("%s: %s: dual saa713x broadcast decoders\n"
+   "%s: Sorry, none of the inputs to this chip are 
supported yet.\n"
+   "%s: Dual decoder functionality is disabled for now, 
use the other chip.\n",
+   dev->name,card(dev).name,dev->name,dev->name);
break;
case SAA7134_BOARD_AVERMEDIA_M102:
/* enable tuner */
@@ -7790,7 +7790,7 @@ int saa7134_board_init2(struct saa7134_dev *dev)
if (board == dev->board)
break;
dev->board = board;
-   printk("%s: board type fixup: %s\n", dev->name,
+   pr_warn("%s: board type fixup: %s\n", dev->name,
saa7134_boards[dev->board].name);
dev->tuner_type = saa7134_boards[dev->board].tuner_type;
 
@@ -8047,7 +8047,7 @@ int saa7134_board_init2(struct saa7134_dev *dev)
msg.len = ARRAY_SIZE(buffer[0]);
if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1)
pr_warn("%s: Unable to enable tuner(%i).\n",
-   dev->name, i);
+   dev->name, i);
}
break;
}
diff --git a/drivers/media/pci/saa7134/saa7134-core.c 
b/drivers/media/pci/saa7134/saa7134-core.c
index c206148f816b..83dbb443214e 100644
--- a/drivers/media/pci/saa7134/saa7134-core.c
+++ b/drivers/media/pci/saa7134/saa7134-core.c
@@ -947,7 +947,7 @@ static int saa7134_initdev(struct pci_dev *pci_dev,
   dev->pci_lat,(unsigned long long)pci_resource_start(pci_dev,0));
pci_set_master(pci_dev);
if (!pci_dma_supported(pci_dev, DMA_BIT_MASK(32))) {
-   printk("%s: Oops: no 32bit PCI DMA ???\n",dev->name);
+   pr_warn("%s: Oops: no 32bit PCI DMA ???\n", dev->name);
err = -EIO;
goto fail1;
}
-- 
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/22] saa7134-dvb: get rid of wprintk() macro

2015-04-30 Thread Mauro Carvalho Chehab
wprintk() macro is now just a wrapper for pr_warn(). Get rid of
it!

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/pci/saa7134/saa7134-dvb.c 
b/drivers/media/pci/saa7134/saa7134-dvb.c
index c7d9896a454e..7e0091343c87 100644
--- a/drivers/media/pci/saa7134/saa7134-dvb.c
+++ b/drivers/media/pci/saa7134/saa7134-dvb.c
@@ -85,9 +85,6 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
 #define dprintk(fmt, arg...)   do { if (debug) \
printk(KERN_DEBUG "%s/dvb: " fmt, dev->name , ## arg); } while(0)
 
-/* Print a warning */
-#define wprintk(fmt, arg...) \
-   pr_warn("%s/dvb: " fmt, dev->name, ## arg)
 
 /* --
  * mt352 based DVB-T cards
@@ -259,7 +256,7 @@ static int kworld_sbtvd_gate_ctrl(struct dvb_frontend* fe, 
int enable)
struct i2c_msg msg = {.addr = 0x4b, .flags = 0, .buf = initmsg, .len = 
2};
 
if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) {
-   wprintk("could not access the I2C gate\n");
+   pr_warn("could not access the I2C gate\n");
return -EIO;
}
if (enable)
@@ -267,7 +264,7 @@ static int kworld_sbtvd_gate_ctrl(struct dvb_frontend* fe, 
int enable)
else
msg.buf = msg_disable;
if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) {
-   wprintk("could not access the I2C gate\n");
+   pr_warn("could not access the I2C gate\n");
return -EIO;
}
msleep(20);
@@ -370,7 +367,7 @@ static int philips_tda6651_pll_set(struct dvb_frontend *fe)
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) {
-   wprintk("could not write to tuner at addr: 0x%02x\n",
+   pr_warn("could not write to tuner at addr: 0x%02x\n",
addr << 1);
return -EIO;
}
@@ -557,8 +554,7 @@ static int tda8290_i2c_gate_ctrl( struct dvb_frontend* fe, 
int enable)
tda8290_msg.buf = tda8290_open;
}
if (i2c_transfer(state->i2c, &tda8290_msg, 1) != 1) {
-   struct saa7134_dev *dev = fe->dvb->priv;
-   wprintk("could not access tda8290 I2C gate\n");
+   pr_warn("could not access tda8290 I2C gate\n");
return -EIO;
}
msleep(20);
@@ -620,7 +616,7 @@ static int configure_tda827x_fe(struct saa7134_dev *dev,
   &dev->i2c_adap, tuner_conf))
return 0;
 
-   wprintk("no tda827x tuner found at addr: %02x\n",
+   pr_warn("no tda827x tuner found at addr: %02x\n",
cdec_conf->tuner_address);
}
return -EINVAL;
@@ -1042,8 +1038,7 @@ static int md8800_set_voltage2(struct dvb_frontend *fe, 
fe_sec_voltage_t voltage
 
 static int md8800_set_high_voltage2(struct dvb_frontend *fe, long arg)
 {
-   struct saa7134_dev *dev = fe->dvb->priv;
-   wprintk("%s: sorry can't set high LNB supply voltage from here\n", 
__func__);
+   pr_warn("%s: sorry can't set high LNB supply voltage from here\n", 
__func__);
return -EIO;
 }
 
@@ -1402,13 +1397,13 @@ static int dvb_init(struct saa7134_dev *dev)
if (fe0->dvb.frontend) {
if (dvb_attach(tda826x_attach, 
fe0->dvb.frontend, 0x63,

&dev->i2c_adap, 0) == NULL) {
-   wprintk("%s: Lifeview Trio, No tda826x 
found!\n", __func__);
+   pr_warn("%s: Lifeview Trio, No tda826x 
found!\n", __func__);
goto detach_frontend;
}
if (dvb_attach(isl6421_attach, 
fe0->dvb.frontend,
   &dev->i2c_adap,
   0x08, 0, 0, false) == NULL) {
-   wprintk("%s: Lifeview Trio, No ISL6421 
found!\n", __func__);
+   pr_warn("%s: Lifeview Trio, No ISL6421 
found!\n", __func__);
goto detach_frontend;
}
}
@@ -1423,12 +1418,12 @@ static int dvb_init(struct saa7134_dev *dev)
if (dvb_attach(tda827x_attach,fe0->dvb.frontend,
   ads_tech_duo_config.tuner_address, 
&dev->i2c_adap,
&ads_duo_cfg) 
== NULL) {
-   wprintk("no tda827x tuner found at addr: 
%02x\n",
+   pr_warn("no tda827x tuner found at addr: 
%02x\n",
ads_tech_duo_config.tuner_address);
 

[PATCH 21/22] saa7134-i2c: simplify debug dump and use pr_info()

2015-04-30 Thread Mauro Carvalho Chehab
Instead of implement its own hexdump logic, use the printk
format, and convert to use pr_info().

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/pci/saa7134/saa7134-i2c.c 
b/drivers/media/pci/saa7134/saa7134-i2c.c
index b140143dba7d..ef3c33e3757d 100644
--- a/drivers/media/pci/saa7134/saa7134-i2c.c
+++ b/drivers/media/pci/saa7134/saa7134-i2c.c
@@ -369,13 +369,12 @@ saa7134_i2c_eeprom(struct saa7134_dev *dev, unsigned char 
*eedata, int len)
   dev->name,err);
return -1;
}
-   for (i = 0; i < len; i++) {
-   if (0 == (i % 16))
-   pr_info("%s: i2c eeprom %02x:",dev->name,i);
-   printk(" %02x",eedata[i]);
-   if (15 == (i % 16))
-   printk("\n");
+
+   for (i = 0; i < len; i+= 16) {
+   int size = (len - i) > 16 ? 16 : len - i;
+   pr_info("i2c eeprom %02x: %*ph\n", i, size, &eedata[i]);
}
+
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 05/22] cx23885: fix bad indentation

2015-04-30 Thread Mauro Carvalho Chehab
drivers/media/pci/cx23885/altera-ci.c:762 altera_ci_init() warn: inconsistent 
indenting

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/pci/cx23885/altera-ci.c 
b/drivers/media/pci/cx23885/altera-ci.c
index 0a91df2c9f08..aaf4e46ff3e9 100644
--- a/drivers/media/pci/cx23885/altera-ci.c
+++ b/drivers/media/pci/cx23885/altera-ci.c
@@ -759,7 +759,7 @@ int altera_ci_init(struct altera_ci_config *config, int 
ci_nr)
if (0 != ret)
goto err;
 
-   inter->state[ci_nr - 1] = state;
+   inter->state[ci_nr - 1] = state;
 
altera_hw_filt_init(config, ci_nr);
 
-- 
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 19/22] saa7134: change the debug macros for video and vbi

2015-04-30 Thread Mauro Carvalho Chehab
rename the macro to vbi_dbg()/video_dbg() and use pr_fmt(),
to be coherent with the other debug macro changes.

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/pci/saa7134/saa7134-vbi.c 
b/drivers/media/pci/saa7134/saa7134-vbi.c
index 109c2ffeab93..face07bf420d 100644
--- a/drivers/media/pci/saa7134/saa7134-vbi.c
+++ b/drivers/media/pci/saa7134/saa7134-vbi.c
@@ -38,8 +38,8 @@ static unsigned int vbibufs = 4;
 module_param(vbibufs, int, 0444);
 MODULE_PARM_DESC(vbibufs,"number of vbi buffers, range 2-32");
 
-#define dprintk(fmt, arg...)   if (vbi_debug) \
-   printk(KERN_DEBUG "%s/vbi: " fmt, dev->name , ## arg)
+#define vbi_dbg(fmt, arg...)   if (vbi_debug) \
+   printk(KERN_DEBUG pr_fmt("vbi: " fmt), ## arg)
 
 /* -- */
 
@@ -84,7 +84,7 @@ static int buffer_activate(struct saa7134_dev *dev,
struct saa7134_dmaqueue *dmaq = buf->vb2.vb2_queue->drv_priv;
unsigned long control, base;
 
-   dprintk("buffer_activate [%p]\n", buf);
+   vbi_dbg("buffer_activate [%p]\n", buf);
buf->top_seen = 0;
 
task_init(dev, buf, TASK_A);
diff --git a/drivers/media/pci/saa7134/saa7134-video.c 
b/drivers/media/pci/saa7134/saa7134-video.c
index f7dcdccfc307..525ae6837fb3 100644
--- a/drivers/media/pci/saa7134/saa7134-video.c
+++ b/drivers/media/pci/saa7134/saa7134-video.c
@@ -52,8 +52,8 @@ module_param_string(secam, secam, sizeof(secam), 0644);
 MODULE_PARM_DESC(secam, "force SECAM variant, either DK,L or Lc");
 
 
-#define dprintk(fmt, arg...)   if (video_debug&0x04) \
-   printk(KERN_DEBUG "%s/video: " fmt, dev->name , ## arg)
+#define video_dbg(fmt, arg...) if (video_debug & 0x04) \
+   printk(KERN_DEBUG pr_fmt("video: " fmt), ## arg)
 
 /* -- */
 /* Defines for Video Output Port Register at address 0x191*/
@@ -385,7 +385,7 @@ static struct saa7134_format* format_by_fourcc(unsigned int 
fourcc)
 
 static void set_tvnorm(struct saa7134_dev *dev, struct saa7134_tvnorm *norm)
 {
-   dprintk("set tv norm = %s\n",norm->name);
+   video_dbg("set tv norm = %s\n",norm->name);
dev->tvnorm = norm;
 
/* setup cropping */
@@ -407,7 +407,7 @@ static void set_tvnorm(struct saa7134_dev *dev, struct 
saa7134_tvnorm *norm)
 
 static void video_mux(struct saa7134_dev *dev, int input)
 {
-   dprintk("video input = %d [%s]\n", input, card_in(dev, input).name);
+   video_dbg("video input = %d [%s]\n", input, card_in(dev, input).name);
dev->ctl_input = input;
set_tvnorm(dev, dev->tvnorm);
saa7134_tvaudio_setinput(dev, &card_in(dev, input));
@@ -531,14 +531,14 @@ static void set_v_scale(struct saa7134_dev *dev, int 
task, int yscale)
mirror = (dev->ctl_mirror) ? 0x02 : 0x00;
if (yscale < 2048) {
/* LPI */
-   dprintk("yscale LPI yscale=%d\n",yscale);
+   video_dbg("yscale LPI yscale=%d\n",yscale);
saa_writeb(SAA7134_V_FILTER(task), 0x00 | mirror);
saa_writeb(SAA7134_LUMA_CONTRAST(task), 0x40);
saa_writeb(SAA7134_CHROMA_SATURATION(task), 0x40);
} else {
/* ACM */
val = 0x40 * 1024 / yscale;
-   dprintk("yscale ACM yscale=%d val=0x%x\n",yscale,val);
+   video_dbg("yscale ACM yscale=%d val=0x%x\n",yscale,val);
saa_writeb(SAA7134_V_FILTER(task), 0x01 | mirror);
saa_writeb(SAA7134_LUMA_CONTRAST(task), val);
saa_writeb(SAA7134_CHROMA_SATURATION(task), val);
@@ -573,7 +573,7 @@ static void set_size(struct saa7134_dev *dev, int task,
prescale = 1;
xscale = 1024 * dev->crop_current.width / prescale / width;
yscale = 512 * div * dev->crop_current.height / height;
-   dprintk("prescale=%d xscale=%d yscale=%d\n",prescale,xscale,yscale);
+   video_dbg("prescale=%d xscale=%d yscale=%d\n",prescale,xscale,yscale);
set_h_prescale(dev,task,prescale);
saa_writeb(SAA7134_H_SCALE_INC1(task),  xscale &  0xff);
saa_writeb(SAA7134_H_SCALE_INC2(task),  xscale >> 8);
@@ -615,7 +615,7 @@ static void set_cliplist(struct saa7134_dev *dev, int reg,
saa_writeb(reg + 0, winbits);
saa_writeb(reg + 2, cl[i].position & 0xff);
saa_writeb(reg + 3, cl[i].position >> 8);
-   dprintk("clip: %s winbits=%02x pos=%d\n",
+   video_dbg("clip: %s winbits=%02x pos=%d\n",
name,winbits,cl[i].position);
reg += 8;
}
@@ -730,7 +730,7 @@ static int start_preview(struct saa7134_dev *dev)
return err;
 
dev->ovfield = dev->win.field;
-   dprintk("start_preview %dx%d+%d+%d %s field=%s\n",
+   video_dbg("start_preview %dx%d+%d+%d %s field=%s\n",
dev->win.w.width, dev->win.w.height,
  

[PATCH 22/22] saa7134: replace remaining occurences or printk()

2015-04-30 Thread Mauro Carvalho Chehab
Instead of using printk(), use pr_foo() macros.

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/pci/saa7134/saa7134-i2c.c 
b/drivers/media/pci/saa7134/saa7134-i2c.c
index ef3c33e3757d..d04fbdb49158 100644
--- a/drivers/media/pci/saa7134/saa7134-i2c.c
+++ b/drivers/media/pci/saa7134/saa7134-i2c.c
@@ -386,7 +386,7 @@ static char *i2c_devs[128] = {
[ 0x5a >> 1 ] = "remote control",
 };
 
-static void do_i2c_scan(char *name, struct i2c_client *c)
+static void do_i2c_scan(struct i2c_client *c)
 {
unsigned char buf;
int i,rc;
@@ -396,8 +396,8 @@ static void do_i2c_scan(char *name, struct i2c_client *c)
rc = i2c_master_recv(c,&buf,0);
if (rc < 0)
continue;
-   printk("%s: i2c scan: found device @ 0x%x  [%s]\n",
-  name, i << 1, i2c_devs[i] ? i2c_devs[i] : "???");
+   pr_info("i2c scan: found device @ 0x%x  [%s]\n",
+i << 1, i2c_devs[i] ? i2c_devs[i] : "???");
}
 }
 
@@ -415,7 +415,7 @@ int saa7134_i2c_register(struct saa7134_dev *dev)
 
saa7134_i2c_eeprom(dev,dev->eedata,sizeof(dev->eedata));
if (i2c_scan)
-   do_i2c_scan(dev->name,&dev->i2c_client);
+   do_i2c_scan(&dev->i2c_client);
 
/* Instantiate the IR receiver device, if present */
saa7134_probe_i2c_ir(dev);
diff --git a/drivers/media/pci/saa7134/saa7134-input.c 
b/drivers/media/pci/saa7134/saa7134-input.c
index 89f5fcf12722..c6036557b468 100644
--- a/drivers/media/pci/saa7134/saa7134-input.c
+++ b/drivers/media/pci/saa7134/saa7134-input.c
@@ -831,8 +831,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
break;
}
if (NULL == ir_codes) {
-   printk("%s: Oops: IR config error [card=%d]\n",
-  dev->name, dev->board);
+   pr_err("Oops: IR config error [card=%d]\n", dev->board);
return -ENODEV;
}
 
diff --git a/drivers/media/pci/saa7134/saa7134-tvaudio.c 
b/drivers/media/pci/saa7134/saa7134-tvaudio.c
index 360f447bd74d..6320b64d3528 100644
--- a/drivers/media/pci/saa7134/saa7134-tvaudio.c
+++ b/drivers/media/pci/saa7134/saa7134-tvaudio.c
@@ -674,12 +674,11 @@ static inline int saa_dsp_wait_bit(struct saa7134_dev 
*dev, int bit)
}
while (0 == (state & bit)) {
if (unlikely(0 == count)) {
-   printk("%s: dsp access wait timeout [bit=%s]\n",
-  dev->name,
-  (bit & SAA7135_DSP_RWSTATE_WRR) ? "WRR" :
-  (bit & SAA7135_DSP_RWSTATE_RDB) ? "RDB" :
-  (bit & SAA7135_DSP_RWSTATE_IDA) ? "IDA" :
-  "???");
+   pr_err("dsp access wait timeout [bit=%s]\n",
+(bit & SAA7135_DSP_RWSTATE_WRR) ? "WRR" :
+(bit & SAA7135_DSP_RWSTATE_RDB) ? "RDB" :
+(bit & SAA7135_DSP_RWSTATE_IDA) ? "IDA" :
+"???");
return -EIO;
}
saa_wait(DSP_DELAY);
-- 
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/22] af9005: fix bad indenting

2015-04-30 Thread Mauro Carvalho Chehab
drivers/media/usb/dvb-usb/af9005-fe.c:484 af9005_fe_read_status() warn: 
inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/usb/dvb-usb/af9005-fe.c 
b/drivers/media/usb/dvb-usb/af9005-fe.c
index 740f3f496f12..6e84a546dfdc 100644
--- a/drivers/media/usb/dvb-usb/af9005-fe.c
+++ b/drivers/media/usb/dvb-usb/af9005-fe.c
@@ -481,7 +481,7 @@ static int af9005_fe_read_status(struct dvb_frontend *fe, 
fe_status_t * stat)
return ret;
if (temp != state->strong) {
deb_info("adjust for strong signal %d\n", temp);
-   state->strong = temp;
+   state->strong = temp;
}
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 08/22] saa7134: instead of usinr printk KERN_foo, use pr_foo

2015-04-30 Thread Mauro Carvalho Chehab
Replaces all occurrences of printk with KERN_INFO, KERN_WARNING
and KERN_ERR to pr_info/pr_warning, pr_err, using this small
shell script:

for i in drivers/media/pci/saa7134/*.[ch]; do sed s,'printk(KERN_INFO 
','pr_info(',g <$i >a && mv a $i; done
for i in drivers/media/pci/saa7134/*.[ch]; do sed s,'printk(KERN_ERR 
','pr_err(',g <$i >a && mv a $i; done
for i in drivers/media/pci/saa7134/*.[ch]; do sed s,'printk(KERN_WARNING 
','pr_warn(',g <$i >a && mv a $i; done

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/pci/saa7134/saa7134-alsa.c 
b/drivers/media/pci/saa7134/saa7134-alsa.c
index d5b0610a91fb..f8764a4c2f15 100644
--- a/drivers/media/pci/saa7134/saa7134-alsa.c
+++ b/drivers/media/pci/saa7134/saa7134-alsa.c
@@ -821,7 +821,7 @@ static int snd_card_saa7134_capture_open(struct 
snd_pcm_substream * substream)
int amux, err;
 
if (!saa7134) {
-   printk(KERN_ERR "BUG: saa7134 can't find device struct."
+   pr_err("BUG: saa7134 can't find device struct."
" Can't proceed with open\n");
return -ENODEV;
}
@@ -1175,7 +1175,7 @@ static int alsa_card_saa7134_create(struct saa7134_dev 
*dev, int devnum)
(void*) &dev->dmasound);
 
if (err < 0) {
-   printk(KERN_ERR "%s: can't get IRQ %d for ALSA\n",
+   pr_err("%s: can't get IRQ %d for ALSA\n",
dev->name, dev->pci->irq);
goto __nodev;
}
@@ -1196,7 +1196,7 @@ static int alsa_card_saa7134_create(struct saa7134_dev 
*dev, int devnum)
sprintf(card->longname, "%s at 0x%lx irq %d",
chip->dev->name, chip->iobase, chip->irq);
 
-   printk(KERN_INFO "%s/alsa: %s registered as card 
%d\n",dev->name,card->longname,index[devnum]);
+   pr_info("%s/alsa: %s registered as card 
%d\n",dev->name,card->longname,index[devnum]);
 
if ((err = snd_card_register(card)) == 0) {
snd_saa7134_cards[devnum] = card;
@@ -1240,19 +1240,19 @@ static int saa7134_alsa_init(void)
saa7134_dmasound_init = alsa_device_init;
saa7134_dmasound_exit = alsa_device_exit;
 
-   printk(KERN_INFO "saa7134 ALSA driver for DMA sound loaded\n");
+   pr_info("saa7134 ALSA driver for DMA sound loaded\n");
 
list_for_each(list,&saa7134_devlist) {
dev = list_entry(list, struct saa7134_dev, devlist);
if (dev->pci->device == PCI_DEVICE_ID_PHILIPS_SAA7130)
-   printk(KERN_INFO "%s/alsa: %s doesn't support digital 
audio\n",
+   pr_info("%s/alsa: %s doesn't support digital audio\n",
dev->name, saa7134_boards[dev->board].name);
else
alsa_device_init(dev);
}
 
if (dev == NULL)
-   printk(KERN_INFO "saa7134 ALSA: no saa7134 cards found\n");
+   pr_info("saa7134 ALSA: no saa7134 cards found\n");
 
return 0;
 
@@ -1272,7 +1272,7 @@ static void saa7134_alsa_exit(void)
 
saa7134_dmasound_init = NULL;
saa7134_dmasound_exit = NULL;
-   printk(KERN_INFO "saa7134 ALSA driver for DMA sound unloaded\n");
+   pr_info("saa7134 ALSA driver for DMA sound unloaded\n");
 
return;
 }
diff --git a/drivers/media/pci/saa7134/saa7134-cards.c 
b/drivers/media/pci/saa7134/saa7134-cards.c
index 20de0b12c818..3159e15a57d4 100644
--- a/drivers/media/pci/saa7134/saa7134-cards.c
+++ b/drivers/media/pci/saa7134/saa7134-cards.c
@@ -7381,7 +7381,7 @@ int saa7134_tuner_callback(void *priv, int component, int 
command, int arg)
return saa7134_xc5000_callback(dev, command, arg);
}
} else {
-   printk(KERN_ERR "saa7134: Error - device struct undefined.\n");
+   pr_err("saa7134: Error - device struct undefined.\n");
return -EINVAL;
}
return -EINVAL;
@@ -7412,12 +7412,12 @@ static void hauppauge_eeprom(struct saa7134_dev *dev, 
u8 *eeprom_data)
case 67659: /* WinTV-HVR1110 (OEM, no IR, hybrid, FM, SVid/Comp, RCA 
aud) */
break;
default:
-   printk(KERN_WARNING "%s: warning: "
+   pr_warn("%s: warning: "
   "unknown hauppauge model #%d\n", dev->name, tv.model);
break;
}
 
-   printk(KERN_INFO "%s: hauppauge eeprom: model=%d\n",
+   pr_info("%s: hauppauge eeprom: model=%d\n",
   dev->name, tv.model);
 }
 
@@ -7428,7 +7428,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
/* Always print gpio, often manufacturers encode tuner type and other 
info. */
saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0);
dev->gpio_value = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2);
-   printk(KERN_INFO "%s: board init: gpio is %x\n", dev->name, 
dev->gpio_value);
+   pr_info("%s: board init: gpio is %x\n", dev->

[PATCH 13/22] saa7134-empress: use pr_debug() for the saa7134 empress module

2015-04-30 Thread Mauro Carvalho Chehab
As this module doesn't use any debug level, it is easy to
just replace all debug printks by pr_debug().

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/pci/saa7134/saa7134-empress.c 
b/drivers/media/pci/saa7134/saa7134-empress.c
index 5d687bcb74ce..e7db4a7166ad 100644
--- a/drivers/media/pci/saa7134/saa7134-empress.c
+++ b/drivers/media/pci/saa7134/saa7134-empress.c
@@ -39,13 +39,6 @@ static unsigned int empress_nr[] = {[0 ... 
(SAA7134_MAXBOARDS - 1)] = UNSET };
 module_param_array(empress_nr, int, NULL, 0444);
 MODULE_PARM_DESC(empress_nr,"ts device number");
 
-static unsigned int debug;
-module_param(debug, int, 0644);
-MODULE_PARM_DESC(debug,"enable debug messages");
-
-#define dprintk(fmt, arg...)   if (debug)  \
-   printk(KERN_DEBUG "%s/empress: " fmt, dev->name , ## arg)
-
 /* -- */
 
 static int start_streaming(struct vb2_queue *vq, unsigned int count)
@@ -221,9 +214,9 @@ static void empress_signal_update(struct work_struct *work)
container_of(work, struct saa7134_dev, empress_workqueue);
 
if (dev->nosignal) {
-   dprintk("no video signal\n");
+   pr_debug("no video signal\n");
} else {
-   dprintk("video signal acquired\n");
+   pr_debug("video signal acquired\n");
}
 }
 
@@ -255,7 +248,7 @@ static int empress_init(struct saa7134_dev *dev)
struct vb2_queue *q;
int err;
 
-   dprintk("%s: %s\n",dev->name,__func__);
+   pr_debug("%s: %s\n",dev->name,__func__);
dev->empress_dev = video_device_alloc();
if (NULL == dev->empress_dev)
return -ENOMEM;
@@ -317,7 +310,7 @@ static int empress_init(struct saa7134_dev *dev)
 
 static int empress_fini(struct saa7134_dev *dev)
 {
-   dprintk("%s: %s\n",dev->name,__func__);
+   pr_debug("%s: %s\n",dev->name,__func__);
 
if (NULL == dev->empress_dev)
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 02/22] dw2102: fix bad indenting

2015-04-30 Thread Mauro Carvalho Chehab
drivers/media/usb/dvb-usb/dw2102.c:440 dw2104_i2c_transfer() warn: inconsistent 
indenting

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/usb/dvb-usb/dw2102.c 
b/drivers/media/usb/dvb-usb/dw2102.c
index f1f357f43ff0..28fd6bacb852 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -437,7 +437,7 @@ static int dw2104_i2c_transfer(struct i2c_adapter *adap, 
struct i2c_msg msg[], i
ibuf, msg[j].len + 2,
DW210X_READ_MSG);
memcpy(msg[j].buf, ibuf + 2, msg[j].len);
-   mdelay(10);
+   mdelay(10);
} else if (((msg[j].buf[0] == 0xb0) &&
(msg[j].addr == 0x68)) ||
((msg[j].buf[0] == 0xf7) &&
-- 
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/22] vivid: fix bad indenting

2015-04-30 Thread Mauro Carvalho Chehab
drivers/media/platform/vivid/vivid-vid-out.c:1155 vivid_vid_out_g_parm() warn: 
inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/platform/vivid/vivid-vid-out.c 
b/drivers/media/platform/vivid/vivid-vid-out.c
index 0af43dc7715c..00f42df947c0 100644
--- a/drivers/media/platform/vivid/vivid-vid-out.c
+++ b/drivers/media/platform/vivid/vivid-vid-out.c
@@ -1152,7 +1152,8 @@ int vivid_vid_out_g_parm(struct file *file, void *priv,
parm->parm.output.capability   = V4L2_CAP_TIMEPERFRAME;
parm->parm.output.timeperframe = dev->timeperframe_vid_out;
parm->parm.output.writebuffers  = 1;
-return 0;
+
+   return 0;
 }
 
 int vidioc_subscribe_event(struct v4l2_fh *fh,
-- 
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/22] saa7134: prepare to use pr_foo macros

2015-04-30 Thread Mauro Carvalho Chehab
Add a pr_fmt macro, and move saa7134.h header to the beginning,
to avoid warnings when using the pr_foo macros.

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/pci/saa7134/saa7134-alsa.c 
b/drivers/media/pci/saa7134/saa7134-alsa.c
index ac3cd74e824e..d5b0610a91fb 100644
--- a/drivers/media/pci/saa7134/saa7134-alsa.c
+++ b/drivers/media/pci/saa7134/saa7134-alsa.c
@@ -16,6 +16,9 @@
  *
  */
 
+#include "saa7134.h"
+#include "saa7134-reg.h"
+
 #include 
 #include 
 #include 
@@ -29,9 +32,6 @@
 #include 
 #include 
 
-#include "saa7134.h"
-#include "saa7134-reg.h"
-
 static unsigned int debug;
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug,"enable debug messages [alsa]");
diff --git a/drivers/media/pci/saa7134/saa7134-cards.c 
b/drivers/media/pci/saa7134/saa7134-cards.c
index d48fd5338db5..20de0b12c818 100644
--- a/drivers/media/pci/saa7134/saa7134-cards.c
+++ b/drivers/media/pci/saa7134/saa7134-cards.c
@@ -20,13 +20,14 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include "saa7134.h"
+#include "saa7134-reg.h"
+
 #include 
 #include 
 #include 
 #include 
 
-#include "saa7134-reg.h"
-#include "saa7134.h"
 #include "tuner-xc2028.h"
 #include 
 #include 
diff --git a/drivers/media/pci/saa7134/saa7134-core.c 
b/drivers/media/pci/saa7134/saa7134-core.c
index a349e964e0bc..76e8ba98e4aa 100644
--- a/drivers/media/pci/saa7134/saa7134-core.c
+++ b/drivers/media/pci/saa7134/saa7134-core.c
@@ -20,6 +20,9 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include "saa7134.h"
+#include "saa7134-reg.h"
+
 #include 
 #include 
 #include 
@@ -33,9 +36,6 @@
 #include 
 #include 
 
-#include "saa7134-reg.h"
-#include "saa7134.h"
-
 MODULE_DESCRIPTION("v4l2 driver module for saa7130/34 based TV cards");
 MODULE_AUTHOR("Gerd Knorr  [SuSE Labs]");
 MODULE_LICENSE("GPL");
diff --git a/drivers/media/pci/saa7134/saa7134-dvb.c 
b/drivers/media/pci/saa7134/saa7134-dvb.c
index bcfebd56fa2b..e1fe006c8ff9 100644
--- a/drivers/media/pci/saa7134/saa7134-dvb.c
+++ b/drivers/media/pci/saa7134/saa7134-dvb.c
@@ -20,6 +20,9 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include "saa7134.h"
+#include "saa7134-reg.h"
+
 #include 
 #include 
 #include 
@@ -28,8 +31,6 @@
 #include 
 #include 
 
-#include "saa7134-reg.h"
-#include "saa7134.h"
 #include 
 #include "dvb-pll.h"
 #include 
diff --git a/drivers/media/pci/saa7134/saa7134-empress.c 
b/drivers/media/pci/saa7134/saa7134-empress.c
index 594dc3ad4750..d421c279a01a 100644
--- a/drivers/media/pci/saa7134/saa7134-empress.c
+++ b/drivers/media/pci/saa7134/saa7134-empress.c
@@ -17,6 +17,9 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include "saa7134.h"
+#include "saa7134-reg.h"
+
 #include 
 #include 
 #include 
@@ -26,9 +29,6 @@
 #include 
 #include 
 
-#include "saa7134-reg.h"
-#include "saa7134.h"
-
 /* -- */
 
 MODULE_AUTHOR("Gerd Knorr  [SuSE Labs]");
diff --git a/drivers/media/pci/saa7134/saa7134-go7007.c 
b/drivers/media/pci/saa7134/saa7134-go7007.c
index 54e650b4dff1..da7c4be4bed2 100644
--- a/drivers/media/pci/saa7134/saa7134-go7007.c
+++ b/drivers/media/pci/saa7134/saa7134-go7007.c
@@ -11,6 +11,9 @@
  * GNU General Public License for more details.
  */
 
+#include "saa7134.h"
+#include "saa7134-reg.h"
+
 #include 
 #include 
 #include 
@@ -27,8 +30,6 @@
 #include 
 #include 
 
-#include "saa7134.h"
-#include "saa7134-reg.h"
 #include "go7007-priv.h"
 
 /*#define GO7007_HPI_DEBUG*/
diff --git a/drivers/media/pci/saa7134/saa7134-i2c.c 
b/drivers/media/pci/saa7134/saa7134-i2c.c
index f4da674e7f26..b69c47546d29 100644
--- a/drivers/media/pci/saa7134/saa7134-i2c.c
+++ b/drivers/media/pci/saa7134/saa7134-i2c.c
@@ -20,14 +20,15 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include "saa7134.h"
+#include "saa7134-reg.h"
+
 #include 
 #include 
 #include 
 #include 
 #include 
 
-#include "saa7134-reg.h"
-#include "saa7134.h"
 #include 
 
 /* --- */
diff --git a/drivers/media/pci/saa7134/saa7134-input.c 
b/drivers/media/pci/saa7134/saa7134-input.c
index dc3d6516edf7..9406d5d7cdde 100644
--- a/drivers/media/pci/saa7134/saa7134-input.c
+++ b/drivers/media/pci/saa7134/saa7134-input.c
@@ -18,15 +18,15 @@
  *
  */
 
+#include "saa7134.h"
+#include "saa7134-reg.h"
+
 #include 
 #include 
 #include 
 #include 
 #include 
 
-#include "saa7134-reg.h"
-#include "saa7134.h"
-
 #define MODULE_NAME "saa7134"
 
 static unsigned int disable_ir;
diff --git a/drivers/media/pci/saa7134/saa7134-ts.c 
b/drivers/media/pci/saa7134/saa7134-ts.c
index 2709b83d57b1..8a2938c34d32 100644
--- a/drivers/media/pci/saa7134/saa7134-ts.c
+++ b/drivers/media/pci/saa7134/saa7134-ts.c
@@ -20,15 +20,15 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include "saa7134.h"
+#include "saa7134-reg.h"
+
 #include 
 #include 
 #incl

[PATCH 16/22] saa7134-i2c: make debug macros to use pr_fmt()

2015-04-30 Thread Mauro Carvalho Chehab
Converting debug prints to use pr_foo() is not trivial, as the
result will be a way worse than what's provided here, due to the
pieces of the code that prints the I2C transfers. Those use a
lot pr_cont(), and, depending on using either level 1 or 2,
a different set of macros are selected.

So, let's replace d1printk() and d2printk() macros by i2c_dbg()
and i2c_count() adding a debug level there.

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/pci/saa7134/saa7134-i2c.c 
b/drivers/media/pci/saa7134/saa7134-i2c.c
index 2dcc497fb166..b140143dba7d 100644
--- a/drivers/media/pci/saa7134/saa7134-i2c.c
+++ b/drivers/media/pci/saa7134/saa7134-i2c.c
@@ -41,8 +41,11 @@ static unsigned int i2c_scan;
 module_param(i2c_scan, int, 0444);
 MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time");
 
-#define d1printk if (1 == i2c_debug) printk
-#define d2printk if (2 == i2c_debug) printk
+#define i2c_dbg(level, fmt, arg...)if (i2c_debug == level) \
+   printk(KERN_DEBUG pr_fmt("i2c: " fmt), ## arg)
+
+#define i2c_cont(level, fmt, arg...)if (i2c_debug == level) \
+   pr_cont(fmt, ## arg)
 
 #define I2C_WAIT_DELAY  32
 #define I2C_WAIT_RETRY  16
@@ -90,23 +93,20 @@ static inline enum i2c_status i2c_get_status(struct 
saa7134_dev *dev)
enum i2c_status status;
 
status = saa_readb(SAA7134_I2C_ATTR_STATUS) & 0x0f;
-   d2printk(KERN_DEBUG "%s: i2c stat <= %s\n",dev->name,
-str_i2c_status[status]);
+   i2c_dbg(2, "i2c stat <= %s\n", str_i2c_status[status]);
return status;
 }
 
 static inline void i2c_set_status(struct saa7134_dev *dev,
  enum i2c_status status)
 {
-   d2printk(KERN_DEBUG "%s: i2c stat => %s\n",dev->name,
-str_i2c_status[status]);
+   i2c_dbg(2, "i2c stat => %s\n", str_i2c_status[status]);
saa_andorb(SAA7134_I2C_ATTR_STATUS,0x0f,status);
 }
 
 static inline void i2c_set_attr(struct saa7134_dev *dev, enum i2c_attr attr)
 {
-   d2printk(KERN_DEBUG "%s: i2c attr => %s\n",dev->name,
-str_i2c_attr[attr]);
+   i2c_dbg(2, "i2c attr => %s\n", str_i2c_attr[attr]);
saa_andorb(SAA7134_I2C_ATTR_STATUS,0xc0,attr << 6);
 }
 
@@ -169,7 +169,7 @@ static int i2c_reset(struct saa7134_dev *dev)
enum i2c_status status;
int count;
 
-   d2printk(KERN_DEBUG "%s: i2c reset\n",dev->name);
+   i2c_dbg(2, "i2c reset\n");
status = i2c_get_status(dev);
if (!i2c_is_error(status))
return true;
@@ -207,7 +207,7 @@ static inline int i2c_send_byte(struct saa7134_dev *dev,
 // dword |= 0x40 << 16;  /* 400 kHz */
dword |= 0xf0 << 24;
saa_writel(SAA7134_I2C_ATTR_STATUS >> 2, dword);
-   d2printk(KERN_DEBUG "%s: i2c data => 0x%x\n",dev->name,data);
+   i2c_dbg(2, "i2c data => 0x%x\n", data);
 
if (!i2c_is_busy_wait(dev))
return -EIO;
@@ -229,7 +229,7 @@ static inline int i2c_recv_byte(struct saa7134_dev *dev)
if (i2c_is_error(status))
return -EIO;
data = saa_readb(SAA7134_I2C_DATA);
-   d2printk(KERN_DEBUG "%s: i2c data <= 0x%x\n",dev->name,data);
+   i2c_dbg(2, "i2c data <= 0x%x\n", data);
return data;
 }
 
@@ -246,12 +246,12 @@ static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap,
if (!i2c_reset(dev))
return -EIO;
 
-   d2printk("start xfer\n");
-   d1printk(KERN_DEBUG "%s: i2c xfer:",dev->name);
+   i2c_dbg(2, "start xfer\n");
+   i2c_dbg(1, "i2c xfer:");
for (i = 0; i < num; i++) {
if (!(msgs[i].flags & I2C_M_NOSTART) || 0 == i) {
/* send address */
-   d2printk("send address\n");
+   i2c_dbg(2, "send address\n");
addr  = msgs[i].addr << 1;
if (msgs[i].flags & I2C_M_RD)
addr |= 1;
@@ -263,50 +263,50 @@ static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap,
 * needed to talk to the mt352 demux
 * thanks to pinnacle for the hint */
int quirk = 0xfe;
-   d1printk(" [%02x quirk]",quirk);
+   i2c_cont(1, " [%02x quirk]",quirk);
i2c_send_byte(dev,START,quirk);
i2c_recv_byte(dev);
}
-   d1printk(" < %02x", addr);
+   i2c_cont(1, " < %02x", addr);
rc = i2c_send_byte(dev,START,addr);
if (rc < 0)
 goto err;
}
if (msgs[i].flags & I2C_M_RD) {
/* read bytes */
-   d2printk("read bytes\n");
+   i2c_dbg(2, "read bytes\n");
for (byte = 

[PATCH 12/22] saa7134-dvb: use pr_debug() for the saa7134 dvb module

2015-04-30 Thread Mauro Carvalho Chehab
As this module doesn't use any debug level, it is easy to
just replace all debug printks by pr_debug().

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/pci/saa7134/saa7134-dvb.c 
b/drivers/media/pci/saa7134/saa7134-dvb.c
index 7e0091343c87..7edb49729489 100644
--- a/drivers/media/pci/saa7134/saa7134-dvb.c
+++ b/drivers/media/pci/saa7134/saa7134-dvb.c
@@ -76,16 +76,8 @@ static int use_frontend;
 module_param(use_frontend, int, 0644);
 MODULE_PARM_DESC(use_frontend,"for cards with multiple frontends (0: 
terrestrial, 1: satellite)");
 
-static int debug;
-module_param(debug, int, 0644);
-MODULE_PARM_DESC(debug, "Turn on/off module debugging (default:off).");
-
 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
 
-#define dprintk(fmt, arg...)   do { if (debug) \
-   printk(KERN_DEBUG "%s/dvb: " fmt, dev->name , ## arg); } while(0)
-
-
 /* --
  * mt352 based DVB-T cards
  */
@@ -110,7 +102,7 @@ static int pinnacle_antenna_pwr(struct saa7134_dev *dev, 
int on)
saa_setl(SAA7134_GPIO_GPSTATUS0 >> 2,   (1 << 28));
udelay(10);
ok = saa_readl(SAA7134_GPIO_GPSTATUS0) & (1 << 27);
-   dprintk("%s %s\n", __func__, ok ? "on" : "off");
+   pr_debug("%s %s\n", __func__, ok ? "on" : "off");
 
if (!ok)
saa_clearl(SAA7134_GPIO_GPSTATUS0 >> 2,   (1 << 26));
@@ -128,9 +120,8 @@ static int mt352_pinnacle_init(struct dvb_frontend* fe)
static u8 gpp_ctl_cfg []   = { GPP_CTL,0x0f };
static u8 scan_ctl_cfg []  = { SCAN_CTL,   0x0d };
static u8 irq_cfg []   = { INTERRUPT_EN_0, 0x00, 0x00, 0x00, 0x00 };
-   struct saa7134_dev *dev= fe->dvb->priv;
 
-   dprintk("%s called\n", __func__);
+   pr_debug("%s called\n", __func__);
 
mt352_write(fe, clock_config,   sizeof(clock_config));
udelay(200);
@@ -568,10 +559,10 @@ static int philips_tda827x_tuner_init(struct dvb_frontend 
*fe)
 
switch (state->config->antenna_switch) {
case 0: break;
-   case 1: dprintk("setting GPIO21 to 0 (TV antenna?)\n");
+   case 1: pr_debug("setting GPIO21 to 0 (TV antenna?)\n");
saa7134_set_gpio(dev, 21, 0);
break;
-   case 2: dprintk("setting GPIO21 to 1 (Radio antenna?)\n");
+   case 2: pr_debug("setting GPIO21 to 1 (Radio antenna?)\n");
saa7134_set_gpio(dev, 21, 1);
break;
}
@@ -585,10 +576,10 @@ static int philips_tda827x_tuner_sleep(struct 
dvb_frontend *fe)
 
switch (state->config->antenna_switch) {
case 0: break;
-   case 1: dprintk("setting GPIO21 to 1 (Radio antenna?)\n");
+   case 1: pr_debug("setting GPIO21 to 1 (Radio antenna?)\n");
saa7134_set_gpio(dev, 21, 1);
break;
-   case 2: dprintk("setting GPIO21 to 0 (TV antenna?)\n");
+   case 2: pr_debug("setting GPIO21 to 0 (TV antenna?)\n");
saa7134_set_gpio(dev, 21, 0);
break;
}
@@ -1246,7 +1237,7 @@ static int dvb_init(struct saa7134_dev *dev)
 
switch (dev->board) {
case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL:
-   dprintk("pinnacle 300i dvb setup\n");
+   pr_debug("pinnacle 300i dvb setup\n");
fe0->dvb.frontend = dvb_attach(mt352_attach, &pinnacle_300i,
   &dev->i2c_adap);
if (fe0->dvb.frontend) {
@@ -1255,7 +1246,7 @@ static int dvb_init(struct saa7134_dev *dev)
break;
case SAA7134_BOARD_AVERMEDIA_777:
case SAA7134_BOARD_AVERMEDIA_A16AR:
-   dprintk("avertv 777 dvb setup\n");
+   pr_debug("avertv 777 dvb setup\n");
fe0->dvb.frontend = dvb_attach(mt352_attach, &avermedia_777,
   &dev->i2c_adap);
if (fe0->dvb.frontend) {
@@ -1265,7 +1256,7 @@ static int dvb_init(struct saa7134_dev *dev)
}
break;
case SAA7134_BOARD_AVERMEDIA_A16D:
-   dprintk("AverMedia A16D dvb setup\n");
+   pr_debug("AverMedia A16D dvb setup\n");
fe0->dvb.frontend = dvb_attach(mt352_attach,
&avermedia_xc3028_mt352_dev,
&dev->i2c_adap);
@@ -1610,7 +1601,7 @@ static int dvb_init(struct saa7134_dev *dev)
goto detach_frontend;
break;
case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
-   dprintk("AverMedia E506R dvb setup\n");
+   pr_debug("AverMedia E506R dvb setup\n");
saa7134_set_gpio(dev, 25, 0);
msleep(10);
saa7134_set_gpio(dev, 25, 1);
-- 
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.ker

[PATCH 03/22] xirlink_cit: comment unreachable code

2015-04-30 Thread Mauro Carvalho Chehab
drivers/media/usb/gspca/xirlink_cit.c:1776 cit_start_model2() info: ignoring 
unreachable code.
drivers/media/usb/gspca/xirlink_cit.c:1858 cit_start_model2() info: ignoring 
unreachable code.
drivers/media/usb/gspca/xirlink_cit.c:1910 cit_start_model2() info: ignoring 
unreachable code.

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/usb/gspca/xirlink_cit.c 
b/drivers/media/usb/gspca/xirlink_cit.c
index a41aa7817c54..d5ed9d36ce25 100644
--- a/drivers/media/usb/gspca/xirlink_cit.c
+++ b/drivers/media/usb/gspca/xirlink_cit.c
@@ -1772,7 +1772,8 @@ static int cit_start_model2(struct gspca_dev *gspca_dev)
cit_write_reg(gspca_dev, 0x0070, 0x0119);   /* All except 
176x144 */
sd->sof_len = 2;
break;
-   /* case VIDEOSIZE_352x240: */
+#if 0
+   case VIDEOSIZE_352x240:
cit_write_reg(gspca_dev, 0x002c, 0x0103);   /* All except 
320x240 */
cit_write_reg(gspca_dev, 0x, 0x0104);   /* Same */
cit_write_reg(gspca_dev, 0x001e, 0x0105);   /* 320x240, 
352x240 */
@@ -1780,6 +1781,7 @@ static int cit_start_model2(struct gspca_dev *gspca_dev)
cit_write_reg(gspca_dev, 0x0070, 0x0119);   /* All except 
176x144 */
sd->sof_len = 2;
break;
+#endif
case 352: /* 352x288 */
cit_write_reg(gspca_dev, 0x002c, 0x0103);   /* All except 
320x240 */
cit_write_reg(gspca_dev, 0x, 0x0104);   /* Same */
@@ -1853,13 +1855,15 @@ static int cit_start_model2(struct gspca_dev *gspca_dev)
cit_model2_Packet1(gspca_dev, 0x0018, 0x0044); /* Another 
hardware setting */
clock_div = 8;
break;
-   /* case VIDEOSIZE_352x240: */
+#if 0
+   case VIDEOSIZE_352x240:
/* This mode doesn't work as Windows programs it; changed to 
work */
cit_model2_Packet1(gspca_dev, 0x0014, 0x0009); /* Windows sets 
this to 8 */
cit_model2_Packet1(gspca_dev, 0x0016, 0x0003); /* Horizontal 
shift */
cit_model2_Packet1(gspca_dev, 0x0018, 0x0044); /* Windows sets 
this to 0x0045 */
clock_div = 10;
break;
+#endif
case 352: /* 352x288 */
cit_model2_Packet1(gspca_dev, 0x0014, 0x0003);
cit_model2_Packet1(gspca_dev, 0x0016, 0x0002); /* Horizontal 
shift */
@@ -1906,9 +1910,11 @@ static int cit_start_model2(struct gspca_dev *gspca_dev)
case 320: /* 320x240 */
cit_model2_Packet1(gspca_dev, 0x0026, 0x0044);
break;
-   /* case VIDEOSIZE_352x240: */
+#if 0
+   case VIDEOSIZE_352x240:
cit_model2_Packet1(gspca_dev, 0x0026, 0x0046);
break;
+#endif
case 352: /* 352x288 */
cit_model2_Packet1(gspca_dev, 0x0026, 0x0048);
break;
-- 
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 18/22] saa7134: change the debug macros for saa7134-tvaudio

2015-04-30 Thread Mauro Carvalho Chehab
use just one macro instead of 2, naming it as audio_dbg() and
using pr_fmt().

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/pci/saa7134/saa7134-tvaudio.c 
b/drivers/media/pci/saa7134/saa7134-tvaudio.c
index e8aeea4cf422..360f447bd74d 100644
--- a/drivers/media/pci/saa7134/saa7134-tvaudio.c
+++ b/drivers/media/pci/saa7134/saa7134-tvaudio.c
@@ -49,13 +49,8 @@ static int audio_clock_tweak;
 module_param(audio_clock_tweak, int, 0644);
 MODULE_PARM_DESC(audio_clock_tweak, "Audio clock tick fine tuning for cards 
with audio crystal that's slightly off (range [-1024 .. 1024])");
 
-#define dprintk(fmt, arg...)   if (audio_debug) \
-   printk(KERN_DEBUG "%s/audio: " fmt, dev->name , ## arg)
-#define d2printk(fmt, arg...)  if (audio_debug > 1) \
-   printk(KERN_DEBUG "%s/audio: " fmt, dev->name, ## arg)
-
-#define print_regb(reg) printk("%s:   reg 0x%03x [%-16s]: 0x%02x\n", \
-   dev->name,(SAA7134_##reg),(#reg),saa_readb((SAA7134_##reg)))
+#define audio_dbg(level, fmt, arg...)if (audio_debug >= level) \
+   printk(KERN_DEBUG pr_fmt("audio: " fmt), ## arg)
 
 /* msecs */
 #define SCAN_INITIAL_DELAY 1000
@@ -206,13 +201,14 @@ static void mute_input_7134(struct saa7134_dev *dev)
 
if (dev->hw_mute  == mute &&
dev->hw_input == in && !dev->insuspend) {
-   dprintk("mute/input: nothing to do [mute=%d,input=%s]\n",
-   mute,in->name);
+   audio_dbg(1, "mute/input: nothing to do [mute=%d,input=%s]\n",
+ mute, in->name);
return;
}
 
-   dprintk("ctl_mute=%d automute=%d input=%s  =>  mute=%d input=%s\n",
-   dev->ctl_mute,dev->automute,dev->input->name,mute,in->name);
+   audio_dbg(1, "ctl_mute=%d automute=%d input=%s  =>  mute=%d input=%s\n",
+ dev->ctl_mute, dev->automute,
+ dev->input->name, mute, in->name);
dev->hw_mute  = mute;
dev->hw_input = in;
 
@@ -265,8 +261,8 @@ static void tvaudio_setmode(struct saa7134_dev *dev,
tweak = audio_clock_tweak;
 
if (note)
-   dprintk("tvaudio_setmode: %s %s [%d.%03d/%d.%03d MHz] 
acpf=%d%+d\n",
-   note,audio->name,
+   audio_dbg(1, "tvaudio_setmode: %s %s [%d.%03d/%d.%03d MHz] 
acpf=%d%+d\n",
+   note, audio->name,
audio->carr1 / 1000, audio->carr1 % 1000,
audio->carr2 / 1000, audio->carr2 % 1000,
acpf, tweak);
@@ -334,14 +330,14 @@ static int tvaudio_checkcarrier(struct saa7134_dev *dev, 
struct mainscan *scan)
 
if (!(dev->tvnorm->id & scan->std)) {
value = 0;
-   dprintk("skipping %d.%03d MHz [%4s]\n",
-   scan->carr / 1000, scan->carr % 1000, scan->name);
+   audio_dbg(1, "skipping %d.%03d MHz [%4s]\n",
+ scan->carr / 1000, scan->carr % 1000, scan->name);
return 0;
}
 
if (audio_debug > 1) {
int i;
-   dprintk("debug %d:",scan->carr);
+   audio_dbg(1, "debug %d:", scan->carr);
for (i = -150; i <= 150; i += 30) {
tvaudio_setcarrier(dev,scan->carr+i,scan->carr+i);
saa_readl(SAA7134_LEVEL_READOUT1 >> 2);
@@ -349,11 +345,11 @@ static int tvaudio_checkcarrier(struct saa7134_dev *dev, 
struct mainscan *scan)
return -1;
value = saa_readl(SAA7134_LEVEL_READOUT1 >> 2);
if (0 == i)
-   printk("  #  %6d  # ",value >> 16);
+   pr_cont("  #  %6d  # ",value >> 16);
else
-   printk(" %6d",value >> 16);
+   pr_cont(" %6d",value >> 16);
}
-   printk("\n");
+   pr_cont("\n");
}
 
tvaudio_setcarrier(dev,scan->carr-90,scan->carr-90);
@@ -371,9 +367,9 @@ static int tvaudio_checkcarrier(struct saa7134_dev *dev, 
struct mainscan *scan)
left >>= 16;
right >>= 16;
value = left > right ? left - right : right - left;
-   dprintk("scanning %d.%03d MHz [%4s] =>  dc is %5d [%d/%d]\n",
-   scan->carr / 1000, scan->carr % 1000,
-   scan->name, value, left, right);
+   audio_dbg(1, "scanning %d.%03d MHz [%4s] =>  dc is %5d [%d/%d]\n",
+ scan->carr / 1000, scan->carr % 1000,
+ scan->name, value, left, right);
return value;
 }
 
@@ -389,7 +385,7 @@ static int tvaudio_getstereo(struct saa7134_dev *dev, 
struct saa7134_tvaudio *au
case TVAUDIO_FM_K_STEREO:
case TVAUDIO_FM_BG_STEREO:
idp = (saa_readb(SAA7134_IDENT_SIF) & 0xe0) >> 5;
-   dprintk("getstereo: fm/stereo: idp=0x%x\n",idp);
+   

[PATCH 15/22] saa7134: better handle core debug messages

2015-04-30 Thread Mauro Carvalho Chehab
On media drivers, debugging messages should be grouped into
categories, as this makes easier to debug the driver.

In the case of saa7134, the core has 2 debug categories, one
for IRQ, and another one for the core itself. The IRQ have
actually 2 levels of debug.

So, instead of using pr_dbg(), where everything would be in
the same box, let's define two macros that use pr_fmt(),
one for the core, and another one for irq.

With that, we can replace the remaining printk() occurrences
at the core to use either core_dbg() or irq_dbg(), depending
on the group of debug macros that need to be enabled.

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/pci/saa7134/saa7134-core.c 
b/drivers/media/pci/saa7134/saa7134-core.c
index 83dbb443214e..e88e4ec8c0ee 100644
--- a/drivers/media/pci/saa7134/saa7134-core.c
+++ b/drivers/media/pci/saa7134/saa7134-core.c
@@ -102,8 +102,11 @@ static unsigned int saa7134_devcount;
 int (*saa7134_dmasound_init)(struct saa7134_dev *dev);
 int (*saa7134_dmasound_exit)(struct saa7134_dev *dev);
 
-#define dprintk(fmt, arg...)   if (core_debug) \
-   printk(KERN_DEBUG "%s/core: " fmt, dev->name , ## arg)
+#define core_dbg(fmt, arg...)if (core_debug) \
+   printk(KERN_DEBUG pr_fmt("core: " fmt), ## arg)
+
+#define irq_dbg(level, fmt, arg...)if (irq_debug > level) \
+   printk(KERN_DEBUG pr_fmt("irq: " fmt), ## arg)
 
 void saa7134_track_gpio(struct saa7134_dev *dev, char *msg)
 {
@@ -116,8 +119,7 @@ void saa7134_track_gpio(struct saa7134_dev *dev, char *msg)

saa_andorb(SAA7134_GPIO_GPMODE3,SAA7134_GPIO_GPRESCAN,SAA7134_GPIO_GPRESCAN);
mode   = saa_readl(SAA7134_GPIO_GPMODE0   >> 2) & 0xfff;
status = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2) & 0xfff;
-   printk(KERN_DEBUG
-  "%s: gpio: mode=0x%07lx in=0x%07lx out=0x%07lx [%s]\n",
+   core_dbg("%s: gpio: mode=0x%07lx in=0x%07lx out=0x%07lx [%s]\n",
   dev->name, mode, (~mode) & status, mode & status, msg);
 }
 
@@ -128,7 +130,7 @@ void saa7134_set_gpio(struct saa7134_dev *dev, int bit_no, 
int value)
index = 1 << bit_no;
switch (value) {
case 0: /* static value */
-   case 1: dprintk("setting GPIO%d to static %d\n", bit_no, value);
+   case 1: core_dbg("setting GPIO%d to static %d\n", bit_no, value);
/* turn sync mode off if necessary */
if (index & 0x00c0)
saa_andorb(SAA7134_VIDEO_PORT_CTRL6, 0x0f, 0x00);
@@ -140,7 +142,7 @@ void saa7134_set_gpio(struct saa7134_dev *dev, int bit_no, 
int value)
saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, index, bitval);
break;
case 3: /* tristate */
-   dprintk("setting GPIO%d to tristate\n", bit_no);
+   core_dbg("setting GPIO%d to tristate\n", bit_no);
saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, index, 0);
break;
}
@@ -274,7 +276,7 @@ int saa7134_buffer_queue(struct saa7134_dev *dev,
unsigned long flags;
 
spin_lock_irqsave(&dev->slock, flags);
-   dprintk("buffer_queue %p\n", buf);
+   core_dbg("buffer_queue %p\n", buf);
if (NULL == q->curr) {
if (!q->need_two) {
q->curr = buf;
@@ -298,7 +300,7 @@ void saa7134_buffer_finish(struct saa7134_dev *dev,
   struct saa7134_dmaqueue *q,
   unsigned int state)
 {
-   dprintk("buffer_finish %p\n", q->curr);
+   core_dbg("buffer_finish %p\n", q->curr);
 
/* finish current buffer */
v4l2_get_timestamp(&q->curr->vb2.v4l2_buf.timestamp);
@@ -318,18 +320,18 @@ void saa7134_buffer_next(struct saa7134_dev *dev,
if (!list_empty(&q->queue)) {
/* activate next one from queue */
buf = list_entry(q->queue.next, struct saa7134_buf, entry);
-   dprintk("buffer_next %p [prev=%p/next=%p]\n",
+   core_dbg("buffer_next %p [prev=%p/next=%p]\n",
buf, q->queue.prev, q->queue.next);
list_del(&buf->entry);
if (!list_empty(&q->queue))
next = list_entry(q->queue.next, struct saa7134_buf, 
entry);
q->curr = buf;
buf->activate(dev, buf, next);
-   dprintk("buffer_next #2 prev=%p/next=%p\n",
+   core_dbg("buffer_next #2 prev=%p/next=%p\n",
q->queue.prev, q->queue.next);
} else {
/* nothing to do -- just stop DMA */
-   dprintk("buffer_next %p\n", NULL);
+   core_dbg("buffer_next %p\n", NULL);
saa7134_set_dmabits(dev);
del_timer(&q->timeout);
}
@@ -351,7 +353,7 @@ void saa7134_buffer_timeout(unsigned long data)
/* flag current buffer as failed,
   try to start over with the next one. */
if (q->curr) {
-   dprintk("timeout on %p\n", 

Re: [PATCH 03/14] saa7134: fix indent issues

2015-04-30 Thread Hans Verkuil
On 04/30/2015 04:08 PM, Mauro Carvalho Chehab wrote:
> Em Thu, 30 Apr 2015 08:20:49 +0200
> Hans Verkuil  escreveu:
> 
>> On 04/28/2015 05:43 PM, Mauro Carvalho Chehab wrote:
>>> 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 
>>>
>>> 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);
>>
>> If you're changing this anyway, why not use pr_info instead?
> 
> Converting it to pr_foo is actually complex. Anyway, I found some time
> today to do such conversion. I'll be adding on a patch series I'm about
> to send.

I was just referring to this single patch, not the whole driver! :-)

Anyway, for the saa7134 patches:

Acked-by: Hans Verkuil 

> 
>>
>>> 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",
>>
>> Ditto.
>>
>>> +   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);
>>>}
>>>
>>
>> Regards,
>>
>>  Hans
> --
> 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
> 

--
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 04/22] vivid: fix bad indenting

2015-04-30 Thread Hans Verkuil
On 04/30/2015 04:08 PM, Mauro Carvalho Chehab wrote:
> drivers/media/platform/vivid/vivid-vid-out.c:1155 vivid_vid_out_g_parm() 
> warn: inconsistent indenting
> 
> Signed-off-by: Mauro Carvalho Chehab 

Acked-by: Hans Verkuil 

> 
> diff --git a/drivers/media/platform/vivid/vivid-vid-out.c 
> b/drivers/media/platform/vivid/vivid-vid-out.c
> index 0af43dc7715c..00f42df947c0 100644
> --- a/drivers/media/platform/vivid/vivid-vid-out.c
> +++ b/drivers/media/platform/vivid/vivid-vid-out.c
> @@ -1152,7 +1152,8 @@ int vivid_vid_out_g_parm(struct file *file, void *priv,
>   parm->parm.output.capability   = V4L2_CAP_TIMEPERFRAME;
>   parm->parm.output.timeperframe = dev->timeperframe_vid_out;
>   parm->parm.output.writebuffers  = 1;
> -return 0;
> +
> + return 0;
>  }
>  
>  int vidioc_subscribe_event(struct v4l2_fh *fh,
> 

--
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 v2 1/2] clk: change clk_ops' ->round_rate() prototype

2015-04-30 Thread Boris Brezillon
Clock rates are stored in an unsigned long field, but ->round_rate()
(which returns a rounded rate from a requested one) returns a long
value (errors are reported using negative error codes), which can lead
to long overflow if the clock rate exceed 2Ghz.

Change ->round_rate() prototype to return 0 or an error code, and pass the
requested rate as a pointer so that it can be adjusted depending on
hardware capabilities.

Signed-off-by: Boris Brezillon 
Tested-by: Heiko Stuebner 
Tested-by: Mikko Perttunen 
Reviewed-by: Heiko Stuebner 
---
CC: Jonathan Corbet 
CC: Shawn Guo 
CC: ascha Hauer 
CC: David Brown 
CC: Daniel Walker 
CC: Bryan Huntsman 
CC: Tony Lindgren 
CC: Paul Walmsley 
CC: Liviu Dudau 
CC: Sudeep Holla 
CC: Lorenzo Pieralisi 
CC: Ralf Baechle 
CC: Max Filippov 
CC: Heiko Stuebner 
CC: Sylwester Nawrocki  
CC: Tomasz Figa 
CC: Barry Song 
CC: Viresh Kumar 
CC: "Emilio L??pez" 
CC: Maxime Ripard 
CC: Peter De Schrijver 
CC: Prashant Gaikwad 
CC: Stephen Warren 
CC: Thierry Reding 
CC: Alexandre Courbot 
CC: Tero Kristo 
CC: Ulf Hansson 
CC: Michal Simek 
CC: Philipp Zabel 
CC: linux-...@vger.kernel.org
CC: linux-ker...@vger.kernel.org
CC: linux-arm-ker...@lists.infradead.org
CC: linux-arm-...@vger.kernel.org
CC: linux-o...@vger.kernel.org
CC: linux-m...@linux-mips.org
CC: patc...@opensource.wolfsonmicro.com
CC: linux-rockc...@lists.infradead.org
CC: linux-samsung-...@vger.kernel.org
CC: spear-de...@list.st.com
CC: linux-te...@vger.kernel.org
CC: dri-de...@lists.freedesktop.org
CC: linux-media@vger.kernel.org
CC: rtc-li...@googlegroups.com

 Documentation/clk.txt|  4 +-
 arch/arm/mach-imx/clk-busy.c |  2 +-
 arch/arm/mach-imx/clk-cpu.c  | 12 +++-
 arch/arm/mach-imx/clk-fixup-div.c|  2 +-
 arch/arm/mach-imx/clk-pfd.c  | 11 ++--
 arch/arm/mach-imx/clk-pllv2.c|  8 ++-
 arch/arm/mach-imx/clk-pllv3.c| 46 +++--
 arch/arm/mach-msm/clock-pcom.c   |  4 +-
 arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c | 13 ++--
 arch/arm/mach-omap2/clkt_clksel.c|  6 +-
 arch/arm/mach-omap2/clkt_dpll.c  | 21 +++---
 arch/arm/mach-omap2/clock.h  |  4 +-
 arch/arm/mach-omap2/dpll3xxx.c   | 27 +---
 arch/arm/mach-omap2/dpll44xx.c   | 26 +---
 arch/arm/mach-vexpress/spc.c | 11 +++-
 arch/mips/alchemy/common/clock.c | 13 ++--
 drivers/clk/at91/clk-h32mx.c | 24 ---
 drivers/clk/at91/clk-peripheral.c| 31 +
 drivers/clk/at91/clk-pll.c   | 14 ++--
 drivers/clk/at91/clk-plldiv.c| 22 ---
 drivers/clk/at91/clk-smd.c   | 24 ---
 drivers/clk/at91/clk-usb.c   | 16 +++--
 drivers/clk/clk-axi-clkgen.c |  5 +-
 drivers/clk/clk-cdce706.c| 46 ++---
 drivers/clk/clk-composite.c  | 23 ---
 drivers/clk/clk-divider.c| 16 +++--
 drivers/clk/clk-fixed-factor.c   |  7 +-
 drivers/clk/clk-fractional-divider.c | 16 +++--
 drivers/clk/clk-highbank.c   | 18 +++---
 drivers/clk/clk-si5351.c | 96 ++--
 drivers/clk/clk-si570.c  | 14 ++--
 drivers/clk/clk-u300.c   | 65 ++-
 drivers/clk/clk-vt8500.c | 27 
 drivers/clk/clk-wm831x.c | 11 ++--
 drivers/clk/clk-xgene.c  | 11 ++--
 drivers/clk/clk.c| 14 ++--
 drivers/clk/mmp/clk-frac.c   | 14 ++--
 drivers/clk/mvebu/clk-corediv.c  |  7 +-
 drivers/clk/mvebu/clk-cpu.c  |  9 +--
 drivers/clk/mxs/clk-div.c|  4 +-
 drivers/clk/mxs/clk-frac.c   | 11 ++--
 drivers/clk/mxs/clk-ref.c| 11 ++--
 drivers/clk/qcom/clk-regmap-divider.c|  4 +-
 drivers/clk/rockchip/clk-pll.c   | 13 ++--
 drivers/clk/samsung/clk-pll.c| 13 ++--
 drivers/clk/shmobile/clk-div6.c  |  7 +-
 drivers/clk/shmobile/clk-rcar-gen2.c |  9 +--
 drivers/clk/sirf/clk-common.c| 18 +++---
 drivers/clk/spear/clk-aux-synth.c| 10 ++-
 drivers/clk/spear/clk-frac-synth.c   | 10 ++-
 drivers/clk/spear/clk-gpt-synth.c| 10 ++-
 drivers/clk/spear/clk-vco-pll.c  | 20 --
 drivers/clk/st/clk-flexgen.c | 11 ++--
 drivers/clk/st/clkgen-fsyn.c | 21 +++---
 drivers/clk/st/clkgen-mux.c  |  2 +-
 drivers/clk/sunxi/clk-factors.c  | 14 ++--
 drivers/clk/tegra/clk-audio-sync.c   |  8 +--
 drivers/clk/tegra/clk-divider.c  | 19 --
 drivers/clk/tegra/clk-periph.c   |  4 +-
 drivers/clk/tegra/clk-pll.c  | 39 ++

[PATCH v2 0/2] clk: adapt ->round_rate()/->determine_rate() prototypes

2015-04-30 Thread Boris Brezillon
Hello,

As previously discussed in this thread [1], this series is changing
clk_ops' ->round_rate()/->determine_rate() prototypes to avoid long
overflows when the returned rate is exceeding 2Ghz.

Most of those changes have been compile-tested, but none of them have
been tested on real hardware (the changes are quite simple though).

Best Regards,

Boris

[1]https://lkml.org/lkml/2015/4/14/528

Changes since v1:
- fix an 'uninitialized variable' bug reported by Heiko
- rebased on clk-next

CC: Jonathan Corbet 
CC: Shawn Guo 
CC: ascha Hauer 
CC: David Brown 
CC: Daniel Walker 
CC: Bryan Huntsman 
CC: Tony Lindgren 
CC: Paul Walmsley 
CC: Liviu Dudau 
CC: Sudeep Holla 
CC: Lorenzo Pieralisi 
CC: Ralf Baechle 
CC: Max Filippov 
CC: Heiko Stuebner 
CC: Sylwester Nawrocki  
CC: Tomasz Figa 
CC: Barry Song 
CC: Viresh Kumar 
CC: "Emilio L??pez" 
CC: Maxime Ripard 
CC: Peter De Schrijver 
CC: Prashant Gaikwad 
CC: Stephen Warren 
CC: Thierry Reding 
CC: Alexandre Courbot 
CC: Tero Kristo 
CC: Ulf Hansson 
CC: Michal Simek 
CC: Philipp Zabel 
CC: linux-...@vger.kernel.org
CC: linux-ker...@vger.kernel.org
CC: linux-arm-ker...@lists.infradead.org
CC: linux-arm-...@vger.kernel.org
CC: linux-o...@vger.kernel.org
CC: linux-m...@linux-mips.org
CC: patc...@opensource.wolfsonmicro.com
CC: linux-rockc...@lists.infradead.org
CC: linux-samsung-...@vger.kernel.org
CC: spear-de...@list.st.com
CC: linux-te...@vger.kernel.org
CC: dri-de...@lists.freedesktop.org
CC: linux-media@vger.kernel.org
CC: rtc-li...@googlegroups.com

Boris Brezillon (2):
  clk: change clk_ops' ->round_rate() prototype
  clk: change clk_ops' ->determine_rate() prototype

 Documentation/clk.txt|  8 +--
 arch/arm/mach-imx/clk-busy.c |  2 +-
 arch/arm/mach-imx/clk-cpu.c  | 12 +++-
 arch/arm/mach-imx/clk-fixup-div.c|  2 +-
 arch/arm/mach-imx/clk-pfd.c  | 11 ++--
 arch/arm/mach-imx/clk-pllv2.c|  8 ++-
 arch/arm/mach-imx/clk-pllv3.c| 46 +++--
 arch/arm/mach-msm/clock-pcom.c   |  4 +-
 arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c | 13 ++--
 arch/arm/mach-omap2/clkt_clksel.c|  6 +-
 arch/arm/mach-omap2/clkt_dpll.c  | 21 +++---
 arch/arm/mach-omap2/clock.h  |  4 +-
 arch/arm/mach-omap2/dpll3xxx.c   | 45 -
 arch/arm/mach-omap2/dpll44xx.c   | 44 +++--
 arch/arm/mach-vexpress/spc.c | 11 +++-
 arch/mips/alchemy/common/clock.c | 76 ++
 drivers/clk/at91/clk-h32mx.c | 24 ---
 drivers/clk/at91/clk-peripheral.c| 31 +
 drivers/clk/at91/clk-pll.c   | 14 ++--
 drivers/clk/at91/clk-plldiv.c| 22 ---
 drivers/clk/at91/clk-programmable.c  | 28 
 drivers/clk/at91/clk-smd.c   | 24 ---
 drivers/clk/at91/clk-usb.c   | 42 ++--
 drivers/clk/bcm/clk-kona.c   | 24 ---
 drivers/clk/clk-axi-clkgen.c |  5 +-
 drivers/clk/clk-cdce706.c| 46 ++---
 drivers/clk/clk-composite.c  | 27 
 drivers/clk/clk-divider.c| 16 +++--
 drivers/clk/clk-fixed-factor.c   |  7 +-
 drivers/clk/clk-fractional-divider.c | 16 +++--
 drivers/clk/clk-highbank.c   | 18 +++---
 drivers/clk/clk-si5351.c | 96 ++--
 drivers/clk/clk-si570.c  | 14 ++--
 drivers/clk/clk-u300.c   | 65 ++-
 drivers/clk/clk-vt8500.c | 27 
 drivers/clk/clk-wm831x.c | 11 ++--
 drivers/clk/clk-xgene.c  | 11 ++--
 drivers/clk/clk.c| 72 +++--
 drivers/clk/hisilicon/clk-hi3620.c   | 22 +++
 drivers/clk/mmp/clk-frac.c   | 14 ++--
 drivers/clk/mmp/clk-mix.c| 17 ++---
 drivers/clk/mvebu/clk-corediv.c  |  7 +-
 drivers/clk/mvebu/clk-cpu.c  |  9 +--
 drivers/clk/mxs/clk-div.c|  4 +-
 drivers/clk/mxs/clk-frac.c   | 11 ++--
 drivers/clk/mxs/clk-ref.c| 11 ++--
 drivers/clk/qcom/clk-pll.c   | 12 ++--
 drivers/clk/qcom/clk-rcg.c   | 32 +-
 drivers/clk/qcom/clk-rcg2.c  | 54 +---
 drivers/clk/qcom/clk-regmap-divider.c|  4 +-
 drivers/clk/rockchip/clk-pll.c   | 13 ++--
 drivers/clk/samsung/clk-pll.c| 13 ++--
 drivers/clk/shmobile/clk-div6.c  |  7 +-
 drivers/clk/shmobile/clk-rcar-gen2.c |  9 +--
 drivers/clk/sirf/clk-common.c| 18 +++---
 drivers/clk/spear/clk-aux-synth.c| 10 ++-
 drivers/clk/spear/clk-frac-synth.c   | 10 ++-
 drivers

Re: [PATCH 2/9] mm: Provide new get_vaddr_pfns() helper

2015-04-30 Thread Mel Gorman
On Tue, Mar 17, 2015 at 12:56:32PM +0100, Jan Kara wrote:
> Provide new function get_vaddr_pfns().  This function maps virtual
> addresses from given start and fills given array with page frame numbers of
> the corresponding pages. If given start belongs to a normal vma, the function
> grabs reference to each of the pages to pin them in memory. If start
> belongs to VM_IO | VM_PFNMAP vma, we don't touch page structures. Caller
> should make sure pfns aren't reused for anything else while he is using
> them.
> 
> This function is created for various drivers to simplify handling of
> their buffers.
> 
> Signed-off-by: Jan Kara 
> ---
>  include/linux/mm.h |  38 +++
>  mm/gup.c   | 180 
> +
>  2 files changed, 218 insertions(+)
> 
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 47a93928b90f..a5045df92454 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -1279,6 +1279,44 @@ long get_user_pages_unlocked(struct task_struct *tsk, 
> struct mm_struct *mm,
>   int write, int force, struct page **pages);
>  int get_user_pages_fast(unsigned long start, int nr_pages, int write,
>   struct page **pages);
> +
> +/* Container for pinned pfns / pages */
> +struct pinned_pfns {
> + unsigned int nr_allocated_pfns; /* Number of pfns we have space for */
> + unsigned int nr_pfns;   /* Number of pfns stored in pfns array 
> */
> + unsigned int got_ref:1; /* Did we pin pfns by getting page ref? 
> */
> + unsigned int is_pages:1;/* Does array contain pages or pfns? */

The bit field is probably overkill as I expect it'll get padded out for
pointer alignment anyway. Just use bools.

is_pfns is less ambiguous than is_pages but not very important.

The naming is not great in general. Only struct pages are pinned in the
traditional meaning of the word. The raw PFNs are not so there is no such
thing as a "pinned pfns". It might be better just to call it frame_vectors
and document that it's either raw PFNs that the caller should be responsible
for or struct pages that are pinned.

> + void *ptrs[0];  /* Array of pinned pfns / pages.
> +  * Use pfns_vector_pages() or
> +  * pfns_vector_pfns() for access */
> +};
> +
> +struct pinned_pfns *pfns_vector_create(int nr_pfns);
> +void pfns_vector_destroy(struct pinned_pfns *pfns);
> +int get_vaddr_pfns(unsigned long start, int nr_pfns, int write, int force,
> +struct pinned_pfns *pfns);

It's not critical but I generally prefer to see bools for new APIs like
this.

unsigned int for nr_pfns.

> +void put_vaddr_pfns(struct pinned_pfns *pfns);
> +int pfns_vector_to_pages(struct pinned_pfns *pfns);
> +
> +static inline int pfns_vector_count(struct pinned_pfns *pfns)
> +{
> + return pfns->nr_pfns;
> +}

should return unsigned int.

> +
> +static inline struct page **pfns_vector_pages(struct pinned_pfns *pfns)
> +{
> + if (!pfns->is_pages)
> + return NULL;
> + return (struct page **)(pfns->ptrs);
> +}
> +
> +static inline unsigned long *pfns_vector_pfns(struct pinned_pfns *pfns)
> +{
> + if (pfns->is_pages)
> + return NULL;
> + return (unsigned long *)(pfns->ptrs);
> +}
> +
>  struct kvec;
>  int get_kernel_pages(const struct kvec *iov, int nr_pages, int write,
>   struct page **pages);
> diff --git a/mm/gup.c b/mm/gup.c
> index a6e24e246f86..63903913ab04 100644
> --- a/mm/gup.c
> +++ b/mm/gup.c
> @@ -819,6 +819,186 @@ long get_user_pages(struct task_struct *tsk, struct 
> mm_struct *mm,
>  EXPORT_SYMBOL(get_user_pages);
>  
>  /**
> + * get_vaddr_pfns() - map virtual addresses to pfns
> + * @start:   starting user address
> + * @nr_pfns: number of pfns from start to map
> + * @write:   whether pages will be written to by the caller
> + * @force:   whether to force write access even if user mapping is
> + *   readonly. This will result in the page being COWed even
> + *   in MAP_SHARED mappings. You do not want this.
> + * @pfns:structure which receives pfns of the pages mapped.
> + *   It should have space for at least nr_pfns pfns.
> + *
> + * This function maps virtual addresses from @start and fills @pfns structure
> + * with page frame numbers of corresponding pages. If @start belongs to a
> + * normal vma, the function grabs reference to each of the pages to pin them 
> in
> + * memory. If @start belongs to VM_IO | VM_PFNMAP vma, we don't touch page
> + * structures. Caller should make sure pfns aren't reused for anything else
> + * while he is using them.
> + *
> + * This function takes care of grabbing mmap_sem as necessary.
> + */
> +int get_vaddr_pfns(unsigned long start, int nr_pfns, int write, int force,
> +struct pinned_pfns *pfns)
> +{
> + struct mm_struct *mm = current->mm;
> + struct vm_are

Re: [PATCH 08/27] ov7670: check read error also for REG_AECHH on ov7670_s_exp()

2015-04-30 Thread Jonathan Corbet
On Wed, 29 Apr 2015 20:05:53 -0300
Mauro Carvalho Chehab  wrote:

> ov7670_s_exp() checks read error for 2 registers: REG_COM1
> and REG_COM8. But, although it uses the value latter, it
> doesn't check errors on REG_AECHH read. Yet, as it is doing
> a bitmask operation there, the read operation should succeed.
> 
> So, fix the code to also check if this succeeded.
> 
> This fixes this smatch report:
>   drivers/media/i2c/ov7670.c:1366 ov7670_s_exp() warn: inconsistent 
> indenting

That's why I like programming in Python...:)

Silly mistake, good fix.

Acked-by: Jonathan Corbet 

jon
--
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-30 Thread Pavel Machek

> +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;

Ok, the comments tell us what should be already obvious from the
variable names... but it would be nice to add units. (mA? uA? msec?)
(I guess in subsequent patch).
Pavel
-- 
(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


[PATCH v5 4/6] ivtv: use arch_phys_wc_add() and require PAT disabled

2015-04-30 Thread Luis R. Rodriguez
From: "Luis R. Rodriguez" 

We are burrying direct access to MTRR code support on
x86 in order to take advantage of PAT. In the future we
also want to make the default behaviour of ioremap_nocache()
to use strong UC, use of mtrr_add() on those systems
would make write-combining void.

In order to help both enable us to later make strong
UC default and in order to phase out direct MTRR access
code port the driver over to arch_phys_wc_add() and
annotate that the device driver requires systems to
boot with PAT disabled, with the nopat kernel parameter.

This is a worthy comprmise given that the hardware is
really rare these days, and perhaps only some lost souls
in some third world country are expected to be using this
feature of the device driver.

Acked-by: Andy Walls 
Cc: Andy Walls 
Cc: Doug Ledford 
Cc: Mauro Carvalho Chehab 
Cc: Andy Lutomirski 
Cc: Suresh Siddha 
Cc: Ingo Molnar 
Cc: Thomas Gleixner 
Cc: Juergen Gross 
Cc: Daniel Vetter 
Cc: Dave Airlie 
Cc: Bjorn Helgaas 
Cc: Antonino Daplas 
Cc: Jean-Christophe Plagniol-Villard 
Cc: Tomi Valkeinen 
Cc: Dave Hansen 
Cc: Arnd Bergmann 
Cc: Michael S. Tsirkin 
Cc: Stefan Bader 
Cc: Ville Syrjälä 
Cc: Mel Gorman 
Cc: Vlastimil Babka 
Cc: Borislav Petkov 
Cc: Davidlohr Bueso 
Cc: konrad.w...@oracle.com
Cc: ville.syrj...@linux.intel.com
Cc: david.vra...@citrix.com
Cc: jbeul...@suse.com
Cc: toshi.k...@hp.com
Cc: Roger Pau Monné 
Cc: linux-fb...@vger.kernel.org
Cc: linux-ker...@vger.kernel.org
Cc: ivtv-de...@ivtvdriver.org
Cc: linux-media@vger.kernel.org
Cc: xen-de...@lists.xensource.com
Signed-off-by: Luis R. Rodriguez 
---
 drivers/media/pci/ivtv/Kconfig  |  3 +++
 drivers/media/pci/ivtv/ivtvfb.c | 58 -
 2 files changed, 26 insertions(+), 35 deletions(-)

diff --git a/drivers/media/pci/ivtv/Kconfig b/drivers/media/pci/ivtv/Kconfig
index dd6ee57e..b2a7f88 100644
--- a/drivers/media/pci/ivtv/Kconfig
+++ b/drivers/media/pci/ivtv/Kconfig
@@ -57,5 +57,8 @@ config VIDEO_FB_IVTV
  This is used in the Hauppauge PVR-350 card. There is a driver
  homepage at .
 
+ If you have this hardware you will need to boot with PAT disabled
+ on your x86 systems, use the nopat kernel parameter.
+
  To compile this driver as a module, choose M here: the
  module will be called ivtvfb.
diff --git a/drivers/media/pci/ivtv/ivtvfb.c b/drivers/media/pci/ivtv/ivtvfb.c
index 9ff1230..7685ae3 100644
--- a/drivers/media/pci/ivtv/ivtvfb.c
+++ b/drivers/media/pci/ivtv/ivtvfb.c
@@ -44,8 +44,8 @@
 #include 
 #include 
 
-#ifdef CONFIG_MTRR
-#include 
+#ifdef CONFIG_X86_64
+#include 
 #endif
 
 #include "ivtv-driver.h"
@@ -155,12 +155,11 @@ struct osd_info {
/* Buffer size */
u32 video_buffer_size;
 
-#ifdef CONFIG_MTRR
/* video_base rounded down as required by hardware MTRRs */
unsigned long fb_start_aligned_physaddr;
/* video_base rounded up as required by hardware MTRRs */
unsigned long fb_end_aligned_physaddr;
-#endif
+   int wc_cookie;
 
/* Store the buffer offset */
int set_osd_coords_x;
@@ -1099,6 +1098,8 @@ static int ivtvfb_init_vidmode(struct ivtv *itv)
 static int ivtvfb_init_io(struct ivtv *itv)
 {
struct osd_info *oi = itv->osd_info;
+   /* Find the largest power of two that maps the whole buffer */
+   int size_shift = 31;
 
mutex_lock(&itv->serialize_lock);
if (ivtv_init_on_first_open(itv)) {
@@ -1132,29 +1133,16 @@ static int ivtvfb_init_io(struct ivtv *itv)
oi->video_pbase, oi->video_vbase,
oi->video_buffer_size / 1024);
 
-#ifdef CONFIG_MTRR
-   {
-   /* Find the largest power of two that maps the whole buffer */
-   int size_shift = 31;
-
-   while (!(oi->video_buffer_size & (1 << size_shift))) {
-   size_shift--;
-   }
-   size_shift++;
-   oi->fb_start_aligned_physaddr = oi->video_pbase & ~((1 << 
size_shift) - 1);
-   oi->fb_end_aligned_physaddr = oi->video_pbase + 
oi->video_buffer_size;
-   oi->fb_end_aligned_physaddr += (1 << size_shift) - 1;
-   oi->fb_end_aligned_physaddr &= ~((1 << size_shift) - 1);
-   if (mtrr_add(oi->fb_start_aligned_physaddr,
-   oi->fb_end_aligned_physaddr - 
oi->fb_start_aligned_physaddr,
-MTRR_TYPE_WRCOMB, 1) < 0) {
-   IVTVFB_INFO("disabled mttr\n");
-   oi->fb_start_aligned_physaddr = 0;
-   oi->fb_end_aligned_physaddr = 0;
-   }
-   }
-#endif
-
+   while (!(oi->video_buffer_size & (1 << size_shift)))
+   size_shift--;
+   size_shift++;
+   oi->fb_start_aligned_physaddr = oi->video_pbase & ~((1 << size_shift) - 
1);
+   oi->fb_end_aligned_physaddr = oi->video_pbase + oi->video_buffer_size;
+

cron job: media_tree daily build: ERRORS

2015-04-30 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:   Fri May  1 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.3-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: WARNINGS
linux-3.17.8-i686: WARNINGS
linux-3.18.7-i686: WARNINGS
linux-3.19-i686: WARNINGS
linux-4.0-i686: WARNINGS
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: OK
linux-3.17.8-x86_64: OK
linux-3.18.7-x86_64: OK
linux-3.19-x86_64: OK
linux-4.0-x86_64: WARNINGS
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/Friday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Friday.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