Re: [PATCH] [media] uvcvideo: fix data type for pan/tilt control

2013-09-29 Thread Laurent Pinchart
Hi Chanho,

Thank you for the patch.

On Friday 27 September 2013 13:57:40 Chanho Min wrote:
 The pan/tilt absolute control value is signed value. If minimum value
 is minus, It will be changed to plus by clamp_t() as commit 64ae9958a62.
 ([media] uvcvideo: Fix control value clamping for unsigned integer
 controls).
 
 It leads to wrong setting of the control values. For example,
 when min and max are -36000 and 36000, the setting value between of this
 range is always 36000. So, Its data type should be changed to signed.
 
 Signed-off-by: Chanho Min chanho@lge.com

Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com

I've taken the patch in my tree and will send a pull request for the next 
kernel version.

 ---
  drivers/media/usb/uvc/uvc_ctrl.c |4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/media/usb/uvc/uvc_ctrl.c
 b/drivers/media/usb/uvc/uvc_ctrl.c index a2f4501..0eb82106 100644
 --- a/drivers/media/usb/uvc/uvc_ctrl.c
 +++ b/drivers/media/usb/uvc/uvc_ctrl.c
 @@ -664,7 +664,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] =
 { .size   = 32,
   .offset = 0,
   .v4l2_type  = V4L2_CTRL_TYPE_INTEGER,
 - .data_type  = UVC_CTRL_DATA_TYPE_UNSIGNED,
 + .data_type  = UVC_CTRL_DATA_TYPE_SIGNED,
   },
   {
   .id = V4L2_CID_TILT_ABSOLUTE,
 @@ -674,7 +674,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] =
 { .size   = 32,
   .offset = 32,
   .v4l2_type  = V4L2_CTRL_TYPE_INTEGER,
 - .data_type  = UVC_CTRL_DATA_TYPE_UNSIGNED,
 + .data_type  = UVC_CTRL_DATA_TYPE_SIGNED,
   },
   {
   .id = V4L2_CID_PRIVACY,
-- 
Regards,

Laurent Pinchart

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


[PATCH 4/8] drm: encoder_slave: Don't use i2c_client-driver

2013-09-29 Thread Lars-Peter Clausen
The 'driver' field of the i2c_client struct is redundant and is going to be
removed. The results of the expressions 'client-driver.driver-field' and
'client-dev.driver-field' are identical, so replace all occurrences of the
former with the later. To get direct access to the i2c_driver struct use
'to_i2c_driver(client-dev.driver)'.

Signed-off-by: Lars-Peter Clausen l...@metafoo.de
---
 drivers/gpu/drm/drm_encoder_slave.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_encoder_slave.c 
b/drivers/gpu/drm/drm_encoder_slave.c
index 0cfb60f..d18b88b 100644
--- a/drivers/gpu/drm/drm_encoder_slave.c
+++ b/drivers/gpu/drm/drm_encoder_slave.c
@@ -67,12 +67,12 @@ int drm_i2c_encoder_init(struct drm_device *dev,
goto fail;
}
 
-   if (!client-driver) {
+   if (!client-dev.driver) {
err = -ENODEV;
goto fail_unregister;
}
 
-   module = client-driver-driver.owner;
+   module = client-dev.driver-owner;
if (!try_module_get(module)) {
err = -ENODEV;
goto fail_unregister;
@@ -80,7 +80,7 @@ int drm_i2c_encoder_init(struct drm_device *dev,
 
encoder-bus_priv = client;
 
-   encoder_drv = to_drm_i2c_encoder_driver(client-driver);
+   encoder_drv = 
to_drm_i2c_encoder_driver(to_i2c_driver(client-dev.driver));
 
err = encoder_drv-encoder_init(client, dev, encoder);
if (err)
@@ -111,7 +111,7 @@ void drm_i2c_encoder_destroy(struct drm_encoder 
*drm_encoder)
 {
struct drm_encoder_slave *encoder = to_encoder_slave(drm_encoder);
struct i2c_client *client = drm_i2c_encoder_get_client(drm_encoder);
-   struct module *module = client-driver-driver.owner;
+   struct module *module = client-dev.driver-owner;
 
i2c_unregister_device(client);
encoder-bus_priv = NULL;
-- 
1.8.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 6/8] ALSA: ppc: keywest: Don't use i2c_client-driver

2013-09-29 Thread Lars-Peter Clausen
The 'driver' field of the i2c_client struct is redundant and is going to be
removed. Use 'to_i2c_driver(client-dev.driver)' instead to get direct
access to the i2c_driver struct.

Signed-off-by: Lars-Peter Clausen l...@metafoo.de
---
 sound/ppc/keywest.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c
index 01aecc2..0d1c27e 100644
--- a/sound/ppc/keywest.c
+++ b/sound/ppc/keywest.c
@@ -65,7 +65,7 @@ static int keywest_attach_adapter(struct i2c_adapter *adapter)
 * already bound. If not it means binding failed, and then there
 * is no point in keeping the device instantiated.
 */
-   if (!keywest_ctx-client-driver) {
+   if (!keywest_ctx-client-dev.driver) {
i2c_unregister_device(keywest_ctx-client);
keywest_ctx-client = NULL;
return -ENODEV;
@@ -76,7 +76,7 @@ static int keywest_attach_adapter(struct i2c_adapter *adapter)
 * This is safe because i2c-core holds the core_lock mutex for us.
 */
list_add_tail(keywest_ctx-client-detected,
- keywest_ctx-client-driver-clients);
+ to_i2c_driver(keywest_ctx-client-dev.driver)-clients);
return 0;
 }
 
-- 
1.8.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 7/8] ASoC: imx-wm8962: Don't use i2c_client-driver

2013-09-29 Thread Lars-Peter Clausen
The 'driver' field of the i2c_client struct is redundant and is going to be
removed. Check i2c_client-dev.driver instead to see if a driver is bound to the
device.

Signed-off-by: Lars-Peter Clausen l...@metafoo.de
---
 sound/soc/fsl/imx-wm8962.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/fsl/imx-wm8962.c b/sound/soc/fsl/imx-wm8962.c
index 6c60666..f84ecbf 100644
--- a/sound/soc/fsl/imx-wm8962.c
+++ b/sound/soc/fsl/imx-wm8962.c
@@ -215,7 +215,7 @@ static int imx_wm8962_probe(struct platform_device *pdev)
goto fail;
}
codec_dev = of_find_i2c_device_by_node(codec_np);
-   if (!codec_dev || !codec_dev-driver) {
+   if (!codec_dev || !codec_dev-dev.driver) {
dev_err(pdev-dev, failed to find codec platform device\n);
ret = -EINVAL;
goto fail;
-- 
1.8.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 5/8] drm: nouveau: Don't use i2c_client-driver

2013-09-29 Thread Lars-Peter Clausen
The 'driver' field of the i2c_client struct is redundant and is going to be
removed. Use 'to_i2c_driver(client-dev.driver)' instead to get direct access to
the i2c_driver struct.

Signed-off-by: Lars-Peter Clausen l...@metafoo.de
Cc: Martin Peres martin.pe...@labri.fr
---
 drivers/gpu/drm/nouveau/core/subdev/therm/ic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/ic.c 
b/drivers/gpu/drm/nouveau/core/subdev/therm/ic.c
index 8b3adec..eae939d 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/therm/ic.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/therm/ic.c
@@ -41,7 +41,8 @@ probe_monitoring_device(struct nouveau_i2c_port *i2c,
if (!client)
return false;
 
-   if (!client-driver || client-driver-detect(client, info)) {
+   if (!client-dev.driver ||
+   to_i2c_driver(client-dev.driver)-detect(client, info)) {
i2c_unregister_device(client);
return false;
}
-- 
1.8.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 2/8] [media] exynos4-is: Don't use i2c_client-driver

2013-09-29 Thread Lars-Peter Clausen
The 'driver' field of the i2c_client struct is redundant and is going to be
removed. The results of the expressions 'client-driver.driver-field' and
'client-dev.driver-field' are identical, so replace all occurrences of the
former with the later.

Signed-off-by: Lars-Peter Clausen l...@metafoo.de
Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Sylwester Nawrocki s.nawro...@samsung.com
---
 drivers/media/platform/exynos4-is/media-dev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/exynos4-is/media-dev.c 
b/drivers/media/platform/exynos4-is/media-dev.c
index a835112..7a4ee4c 100644
--- a/drivers/media/platform/exynos4-is/media-dev.c
+++ b/drivers/media/platform/exynos4-is/media-dev.c
@@ -411,8 +411,8 @@ static int fimc_md_of_add_sensor(struct fimc_md *fmd,
 
device_lock(client-dev);
 
-   if (!client-driver ||
-   !try_module_get(client-driver-driver.owner)) {
+   if (!client-dev.driver ||
+   !try_module_get(client-dev.driver-owner)) {
ret = -EPROBE_DEFER;
v4l2_info(fmd-v4l2_dev, No driver found for %s\n,
node-full_name);
@@ -442,7 +442,7 @@ static int fimc_md_of_add_sensor(struct fimc_md *fmd,
fmd-num_sensors++;
 
 mod_put:
-   module_put(client-driver-driver.owner);
+   module_put(client-dev.driver-owner);
 dev_put:
device_unlock(client-dev);
put_device(client-dev);
-- 
1.8.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 8/8] i2c: Remove redundant 'driver' field from the i2c_client struct

2013-09-29 Thread Lars-Peter Clausen
The 'driver' field of the i2c_client struct is redundant. The same data can be
accessed through to_i2c_driver(client-dev.driver). The generated code for both
approaches in more or less the same.

E.g. on ARM the expression client-driver-command(...) generates

...
ldr r3, [r0, #28]
ldr r3, [r3, #32]
blx r3
...

and the expression to_i2c_driver(client-dev.driver)-command(...) generates

...
ldr r3, [r0, #160]
ldr r3, [r3, #-4]
blx r3
...

Other architectures will generate similar code.

All users of the 'driver' field outside of the I2C core have already been
converted. So this only leaves the core itself. This patch converts the
remaining few users in the I2C core and then removes the 'driver' field from the
i2c_client struct.

Signed-off-by: Lars-Peter Clausen l...@metafoo.de
---
 drivers/i2c/i2c-core.c  | 21 -
 drivers/i2c/i2c-smbus.c | 10 ++
 include/linux/i2c.h |  2 --
 3 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 29d3f04..430c001 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -248,17 +248,16 @@ static int i2c_device_probe(struct device *dev)
driver = to_i2c_driver(dev-driver);
if (!driver-probe || !driver-id_table)
return -ENODEV;
-   client-driver = driver;
+
if (!device_can_wakeup(client-dev))
device_init_wakeup(client-dev,
client-flags  I2C_CLIENT_WAKE);
dev_dbg(dev, probe\n);
 
status = driver-probe(client, i2c_match_id(driver-id_table, client));
-   if (status) {
-   client-driver = NULL;
+   if (status)
i2c_set_clientdata(client, NULL);
-   }
+
return status;
 }
 
@@ -279,10 +278,9 @@ static int i2c_device_remove(struct device *dev)
dev-driver = NULL;
status = 0;
}
-   if (status == 0) {
-   client-driver = NULL;
+   if (status == 0)
i2c_set_clientdata(client, NULL);
-   }
+
return status;
 }
 
@@ -1606,9 +1604,14 @@ static int i2c_cmd(struct device *dev, void *_arg)
 {
struct i2c_client   *client = i2c_verify_client(dev);
struct i2c_cmd_arg  *arg = _arg;
+   struct i2c_driver   *driver;
+
+   if (!client || !client-dev.driver)
+   return 0;
 
-   if (client  client-driver  client-driver-command)
-   client-driver-command(client, arg-cmd, arg-arg);
+   driver = to_i2c_driver(client-dev.driver);
+   if (driver-command)
+   driver-command(client, arg-cmd, arg-arg);
return 0;
 }
 
diff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c
index 44d4c60..c99b229 100644
--- a/drivers/i2c/i2c-smbus.c
+++ b/drivers/i2c/i2c-smbus.c
@@ -46,6 +46,7 @@ static int smbus_do_alert(struct device *dev, void *addrp)
 {
struct i2c_client *client = i2c_verify_client(dev);
struct alert_data *data = addrp;
+   struct i2c_driver *driver;
 
if (!client || client-addr != data-addr)
return 0;
@@ -54,12 +55,13 @@ static int smbus_do_alert(struct device *dev, void *addrp)
 
/*
 * Drivers should either disable alerts, or provide at least
-* a minimal handler.  Lock so client-driver won't change.
+* a minimal handler.  Lock so the driver won't change.
 */
device_lock(dev);
-   if (client-driver) {
-   if (client-driver-alert)
-   client-driver-alert(client, data-flag);
+   if (client-dev.driver) {
+   driver = to_i2c_driver(client-dev.driver);
+   if (driver-alert)
+   driver-alert(client, data-flag);
else
dev_warn(client-dev, no driver alert()!\n);
} else
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 2ab11dc..eff50e0 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -205,7 +205,6 @@ struct i2c_driver {
  * @name: Indicates the type of the device, usually a chip name that's
  * generic enough to hide second-sourcing and compatible revisions.
  * @adapter: manages the bus segment hosting this I2C device
- * @driver: device's driver, hence pointer to access routines
  * @dev: Driver model device node for the slave.
  * @irq: indicates the IRQ generated by this device (if any)
  * @detected: member of an i2c_driver.clients list or i2c-core's
@@ -222,7 +221,6 @@ struct i2c_client {
/* _LOWER_ 7 bits   */
char name[I2C_NAME_SIZE];
struct i2c_adapter *adapter;/* the adapter we sit on*/
-   struct i2c_driver *driver;  /* and our access routines  */

[PATCH 0/8] i2c: Remove redundant driver field from the i2c_client struct

2013-09-29 Thread Lars-Peter Clausen
Hi,

This series removes the redundant driver field from the i2c_client struct. The
field is redundant since the same pointer can be accessed through
to_i2c_driver(client-dev.driver). The commit log suggests that the field has
been around since forever (since before v2.6.12-rc2) and it looks as if it was
simply forgotten to remove it during the conversion of the i2c framework to the
generic device driver model.

Nevertheless there are a still a few users of the field around. This series
first updates all users to use an alternative method of accessing the same data
and then the last patch removes the driver field from the i2c_client struct.

Note that due to this changes on most architectures neither the code size nor
the type of generated instructions will change. This is due to the fact that we
aren't really interested in the pointer value itself, but rather want to
dereference it to access one of the fields of the struct. offset_of() (and hence
to_i2c_driver) works by subtracting a offset from the pointer, so the compiler
can internally create the sum of these two offsets and use that to access the
field.

E.g. on ARM the expression client-driver-command(...) generates

...
ldr r3, [r0, #28]
ldr r3, [r3, #32]
blx r3
...

and the expression to_i2c_driver(client-dev.driver)-command(...) generates

...
ldr r3, [r0, #160]
ldr r3, [r3, #-4]
blx r3
...

Other architectures will generate similar code.

The most common pattern is to use the i2c_driver to get to the device_driver
struct embedded in it. The same struct can easily be accessed through the device
struct embedded in the i2c_client struct.  E.g. client-driver-driver.field can
be replaced by client-dev.driver-field. Here again the generated code is
almost identical and only the offsets differ.

E.g. on ARM the expression 'client-driver-driver.owner' generates

ldr r3, [r0, #28]
ldr r0, [r3, #44]

and 'client-dev.driver-owner' generates

ldr r3, [r0, #160]
ldr r0, [r3, #8]

The kernel overall code size is slightly reduced since the code that manages the
driver field is removed and of course also the runtime memory footprint of the
i2c_client struct is reduced.

- Lars

Lars-Peter Clausen (8):
  [media] s5c73m3: Don't use i2c_client-driver
  [media] exynos4-is: Don't use i2c_client-driver
  [media] core: Don't use i2c_client-driver
  drm: encoder_slave: Don't use i2c_client-driver
  drm: nouveau: Don't use i2c_client-driver
  ALSA: ppc: keywest: Don't use i2c_client-driver
  ASoC: imx-wm8962: Don't use i2c_client-driver
  i2c: Remove redundant 'driver' field from the i2c_client struct

 drivers/gpu/drm/drm_encoder_slave.c|  8 
 drivers/gpu/drm/nouveau/core/subdev/therm/ic.c |  3 ++-
 drivers/i2c/i2c-core.c | 21 -
 drivers/i2c/i2c-smbus.c| 10 ++
 drivers/media/i2c/s5c73m3/s5c73m3-core.c   |  2 +-
 drivers/media/platform/exynos4-is/media-dev.c  |  6 +++---
 drivers/media/v4l2-core/tuner-core.c   |  6 +++---
 drivers/media/v4l2-core/v4l2-common.c  | 10 +-
 include/linux/i2c.h|  2 --
 include/media/v4l2-common.h|  2 +-
 sound/ppc/keywest.c|  4 ++--
 sound/soc/fsl/imx-wm8962.c |  2 +-
 12 files changed, 40 insertions(+), 36 deletions(-)

-- 
1.8.0

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


[PATCH 1/8] [media] s5c73m3: Don't use i2c_client-driver

2013-09-29 Thread Lars-Peter Clausen
The 'driver' field of the i2c_client struct is redundant and is going to be
removed. The results of the expressions 'client-driver.driver-field' and
'client-dev.driver-field' are identical, so replace all occurrences of the
former with the later.

Signed-off-by: Lars-Peter Clausen l...@metafoo.de
Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Andrzej Hajda a.ha...@samsung.com
---
 drivers/media/i2c/s5c73m3/s5c73m3-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c 
b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
index b76ec0e..1083890 100644
--- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c
+++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
@@ -1581,7 +1581,7 @@ static int s5c73m3_probe(struct i2c_client *client,
oif_sd = state-oif_sd;
 
v4l2_subdev_init(sd, s5c73m3_subdev_ops);
-   sd-owner = client-driver-driver.owner;
+   sd-owner = client-dev.driver-owner;
v4l2_set_subdevdata(sd, state);
strlcpy(sd-name, S5C73M3, sizeof(sd-name));
 
-- 
1.8.0

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


[PATCH 3/8] [media] core: Don't use i2c_client-driver

2013-09-29 Thread Lars-Peter Clausen
The 'driver' field of the i2c_client struct is redundant and is going to be
removed. The results of the expressions 'client-driver.driver-field' and
'client-dev.driver-field' are identical, so replace all occurrences of the
former with the later.

Signed-off-by: Lars-Peter Clausen l...@metafoo.de
---
 drivers/media/v4l2-core/tuner-core.c  |  6 +++---
 drivers/media/v4l2-core/v4l2-common.c | 10 +-
 include/media/v4l2-common.h   |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/media/v4l2-core/tuner-core.c 
b/drivers/media/v4l2-core/tuner-core.c
index ddc9379..4133af0 100644
--- a/drivers/media/v4l2-core/tuner-core.c
+++ b/drivers/media/v4l2-core/tuner-core.c
@@ -43,7 +43,7 @@
 
 #define UNSET (-1U)
 
-#define PREFIX (t-i2c-driver-driver.name)
+#define PREFIX (t-i2c-dev.driver-name)
 
 /*
  * Driver modprobe parameters
@@ -452,7 +452,7 @@ static void set_type(struct i2c_client *c, unsigned int 
type,
}
 
tuner_dbg(%s %s I2C addr 0x%02x with type %d used for 0x%02x\n,
- c-adapter-name, c-driver-driver.name, c-addr  1, type,
+ c-adapter-name, c-dev.driver-name, c-addr  1, type,
  t-mode_mask);
return;
 
@@ -556,7 +556,7 @@ static void tuner_lookup(struct i2c_adapter *adap,
int mode_mask;
 
if (pos-i2c-adapter != adap ||
-   strcmp(pos-i2c-driver-driver.name, tuner))
+   strcmp(pos-i2c-dev.driver-name, tuner))
continue;
 
mode_mask = pos-mode_mask;
diff --git a/drivers/media/v4l2-core/v4l2-common.c 
b/drivers/media/v4l2-core/v4l2-common.c
index 037d7a5..433d6d7 100644
--- a/drivers/media/v4l2-core/v4l2-common.c
+++ b/drivers/media/v4l2-core/v4l2-common.c
@@ -236,14 +236,14 @@ void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct 
i2c_client *client,
v4l2_subdev_init(sd, ops);
sd-flags |= V4L2_SUBDEV_FL_IS_I2C;
/* the owner is the same as the i2c_client's driver owner */
-   sd-owner = client-driver-driver.owner;
+   sd-owner = client-dev.driver-owner;
sd-dev = client-dev;
/* i2c_client and v4l2_subdev point to one another */
v4l2_set_subdevdata(sd, client);
i2c_set_clientdata(client, sd);
/* initialize name */
snprintf(sd-name, sizeof(sd-name), %s %d-%04x,
-   client-driver-driver.name, i2c_adapter_id(client-adapter),
+   client-dev.driver-name, i2c_adapter_id(client-adapter),
client-addr);
 }
 EXPORT_SYMBOL_GPL(v4l2_i2c_subdev_init);
@@ -274,11 +274,11 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct 
v4l2_device *v4l2_dev,
   loaded. This delay-load mechanism doesn't work if other drivers
   want to use the i2c device, so explicitly loading the module
   is the best alternative. */
-   if (client == NULL || client-driver == NULL)
+   if (client == NULL || client-dev.driver == NULL)
goto error;
 
/* Lock the module so we can safely get the v4l2_subdev pointer */
-   if (!try_module_get(client-driver-driver.owner))
+   if (!try_module_get(client-dev.driver-owner))
goto error;
sd = i2c_get_clientdata(client);
 
@@ -287,7 +287,7 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct 
v4l2_device *v4l2_dev,
if (v4l2_device_register_subdev(v4l2_dev, sd))
sd = NULL;
/* Decrease the module use count to match the first try_module_get. */
-   module_put(client-driver-driver.owner);
+   module_put(client-dev.driver-owner);
 
 error:
/* If we have a client but no subdev, then something went wrong and
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 16550c4..a707529 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -35,7 +35,7 @@
printk(level %s %d-%04x:  fmt, name, i2c_adapter_id(adapter), addr , 
## arg)
 
 #define v4l_client_printk(level, client, fmt, arg...)  \
-   v4l_printk(level, (client)-driver-driver.name, (client)-adapter, \
+   v4l_printk(level, (client)-dev.driver-name, (client)-adapter, \
   (client)-addr, fmt , ## arg)
 
 #define v4l_err(client, fmt, arg...) \
-- 
1.8.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 0/2] fix tunning for r820t tunner

2013-09-29 Thread Jiří Pinkava
Fixes range check for VCO parameters, simplifies calculation of divisor.

 drivers/media/tuners/r820t.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

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


[PATCH 1/2] [media] r820t: fix nint range check

2013-09-29 Thread Jiří Pinkava


Use full range of VCO parameters, fixes tunning for some frequencies.
---
 drivers/media/tuners/r820t.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/tuners/r820t.c b/drivers/media/tuners/r820t.c
index 1c23666..e25c720 100644
--- a/drivers/media/tuners/r820t.c
+++ b/drivers/media/tuners/r820t.c
@@ -637,7 +637,7 @@ static int r820t_set_pll(struct r820t_priv *priv,
enum v4l2_tuner_type type,
vco_fra = pll_ref * 129 / 128;
}
 
-   if (nint  63) {
+   if (nint  76) {
tuner_info(No valid PLL values for %u kHz!\n, freq);
return -EINVAL;
}
-- 
1.8.3.2


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


Subject: [PATCH 2/2] [media] r820t: simplify divisor calculation

2013-09-29 Thread Jiří Pinkava

---
 drivers/media/tuners/r820t.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/media/tuners/r820t.c b/drivers/media/tuners/r820t.c
index e25c720..36dc63e 100644
--- a/drivers/media/tuners/r820t.c
+++ b/drivers/media/tuners/r820t.c
@@ -596,13 +596,9 @@ static int r820t_set_pll(struct r820t_priv *priv,
enum v4l2_tuner_type type,
while (mix_div = 64) {
if (((freq * mix_div) = vco_min) 
   ((freq * mix_div)  vco_max)) {
-   div_buf = mix_div;
-   while (div_buf  2) {
-   div_buf = div_buf  1;
-   div_num++;
-   }
break;
}
+   ++div_num;
mix_div = mix_div  1;
}
 
-- 
1.8.3.2


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


Technisat CableStar Combi CI HD

2013-09-29 Thread Benjamin Veitschegger

Hi there,

i'm currently trying to get a Technisat CableStar Combo CI HD to work 
under debian wheezy, kernel 3.11.


I've followed [1], and at first everything looked fine, the card seems 
to be recognized, and the drivers are loaded. (dmesg)


So, i've tried to scan for some dvb-c channels, and drxk started 
spamming my dmesg.


[ 1407.088033] drxk: SCU not ready
[ 1407.088046] drxk: Error -5 on get_qam_lock_status
[ 1407.088052] drxk: Error -5 on get_lock_status
[.]

Does anyone have an idea, how to fix it? According to the wiki, there 
are already people, who got the device working.


Thanks.
Benjamin

[1] http://www.linuxtv.org/wiki/index.php/TechniSat_CableStar_Combo_HD_CI

--
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 7/8] ASoC: imx-wm8962: Don't use i2c_client-driver

2013-09-29 Thread Mark Brown
On Sun, Sep 29, 2013 at 10:51:05AM +0200, Lars-Peter Clausen wrote:
 The 'driver' field of the i2c_client struct is redundant and is going to be
 removed. Check i2c_client-dev.driver instead to see if a driver is bound to 
 the
 device.

Acked-by: Mark Brown broo...@linaro.org


signature.asc
Description: Digital signature


Re: [PATCH 0/8] i2c: Remove redundant driver field from the i2c_client struct

2013-09-29 Thread Wolfram Sang
On Sun, Sep 29, 2013 at 10:50:58AM +0200, Lars-Peter Clausen wrote:

 This series removes the redundant driver field from the i2c_client struct. The
 field is redundant since the same pointer can be accessed through
 to_i2c_driver(client-dev.driver). The commit log suggests that the field has
 been around since forever (since before v2.6.12-rc2) and it looks as if it was
 simply forgotten to remove it during the conversion of the i2c framework to 
 the
 generic device driver model.

Great! Looks proper from a first glimpse. I'd think it makes sense to
take all patches via I2C. So, I am looking for ACKs for other subsystems
touched.

Thanks,

   Wolfram



signature.asc
Description: Digital signature


Re: [alsa-devel] [PATCH 1/8] [media] s5c73m3: Don't use i2c_client-driver

2013-09-29 Thread Sylwester Nawrocki

On 09/29/2013 10:50 AM, Lars-Peter Clausen wrote:

The 'driver' field of the i2c_client struct is redundant and is going to be
removed. The results of the expressions 'client-driver.driver-field' and
'client-dev.driver-field' are identical, so replace all occurrences of the
former with the later.

Signed-off-by: Lars-Peter Clausenl...@metafoo.de
Cc: Kyungmin Parkkyungmin.p...@samsung.com
Cc: Andrzej Hajdaa.ha...@samsung.com


Acked-by: Sylwester Nawrocki s.nawro...@samsung.com
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [alsa-devel] [PATCH 2/8] [media] exynos4-is: Don't use i2c_client-driver

2013-09-29 Thread Sylwester Nawrocki

On 09/29/2013 10:51 AM, Lars-Peter Clausen wrote:

The 'driver' field of the i2c_client struct is redundant and is going to be
removed. The results of the expressions 'client-driver.driver-field' and
'client-dev.driver-field' are identical, so replace all occurrences of the
former with the later.

Signed-off-by: Lars-Peter Clausenl...@metafoo.de
Cc: Kyungmin Parkkyungmin.p...@samsung.com
Cc: Sylwester Nawrockis.nawro...@samsung.com


Acked-by: Sylwester Nawrocki s.nawro...@samsung.com
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] [media] videobuf2-core: call __setup_offsets only for mmap memory type

2013-09-29 Thread Pawel Osciak
Thanks Philipp.

Acked-by: Pawel Osciak pa...@osciak.com


On Thu, Sep 19, 2013 at 5:30 PM, Philipp Zabel p.za...@pengutronix.de wrote:
 Hi Pawel,

 Am Donnerstag, den 19.09.2013, 16:54 +0900 schrieb Pawel Osciak:
 On Thu, Sep 19, 2013 at 4:37 PM, Philipp Zabel p.za...@pengutronix.de 
 wrote:
  __setup_offsets fills the v4l2_planes' mem_offset fields, which is only 
  valid
  for V4L2_MEMORY_MMAP type buffers. For V4L2_MEMORY_DMABUF and _USERPTR 
  buffers,
  this incorrectly overwrites the fd and userptr fields.

 I'm not particularly against this change, but I'm curious if anything
 that you were doing was broken by this call? The buffers are created
 here, so their fields don't contain anything that could be overwritten
 (although keeping them at 0 is preferable).

 nothing was actually broken, but even though the spec doesn't say
 anything about the QUERYBUF return values in the DMABUF/USERPTR cases,
 setting them to some random initial value doesn't seem right.

 Maybe the documentation could be amended to mention fd and userptr,
 although in this case the fd should probably be set to -1 initially.
 QUERYBUF could then be used to find free slots.

 regards
 Philipp




-- 
Best regards,
Pawel Osciak
--
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] Add support for KWorld UB435-Q V2

2013-09-29 Thread Jean-Francois Thibert
This adds support for the UB435-Q V2. It seems that you might need to
use the device once with the official driver to reprogram the device
descriptors. Thanks to Jarod Wilson for the initial attempt at adding
support for this device.

Jean-Francois Thibert (1):
  Add support for KWorld UB435-Q V2

 drivers/media/usb/em28xx/em28xx-cards.c |   14 +-
 drivers/media/usb/em28xx/em28xx-dvb.c   |   27 +++
 drivers/media/usb/em28xx/em28xx.h   |1 +
 3 files changed, 41 insertions(+), 1 deletions(-)

-- 
1.7.5.4

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


[PATCH] Add support for KWorld UB435-Q V2

2013-09-29 Thread Jean-Francois Thibert
Signed-off-by: Jean-Francois Thibert jfthib...@google.com
---
 drivers/media/usb/em28xx/em28xx-cards.c |   14 +-
 drivers/media/usb/em28xx/em28xx-dvb.c   |   27 +++
 drivers/media/usb/em28xx/em28xx.h   |1 +
 3 files changed, 41 insertions(+), 1 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-cards.c 
b/drivers/media/usb/em28xx/em28xx-cards.c
index dc65742..a512909 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -174,7 +174,7 @@ static struct em28xx_reg_seq evga_indtube_digital[] = {
 };
 
 /*
- * KWorld PlusTV 340U and UB435-Q (ATSC) GPIOs map:
+ * KWorld PlusTV 340U, UB435-Q and UB435-Q V2 (ATSC) GPIOs map:
  * EM_GPIO_0 - currently unknown
  * EM_GPIO_1 - LED disable/enable (1 = off, 0 = on)
  * EM_GPIO_2 - currently unknown
@@ -2030,6 +2030,16 @@ struct em28xx_board em28xx_boards[] = {
.i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
EM28XX_I2C_FREQ_400_KHZ,
},
+   /* 1b80:e346 KWorld USB ATSC TV Stick UB435-Q V2
+* Empia EM2874B + LG DT3305 + NXP TDA18271HDC2 */
+   [EM2874_BOARD_KWORLD_UB435Q_V2] = {
+   .name   = KWorld USB ATSC TV Stick UB435-Q V2,
+   .tuner_type = TUNER_ABSENT,
+   .has_dvb= 1,
+   .dvb_gpio   = kworld_a340_digital,
+   .tuner_gpio = default_tuner_gpio,
+   .def_i2c_bus  = 1,
+   },
 };
 const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards);
 
@@ -2173,6 +2183,8 @@ struct usb_device_id em28xx_id_table[] = {
.driver_info = EM2860_BOARD_GADMEI_UTV330 },
{ USB_DEVICE(0x1b80, 0xa340),
.driver_info = EM2870_BOARD_KWORLD_A340 },
+   { USB_DEVICE(0x1b80, 0xe346),
+   .driver_info = EM2874_BOARD_KWORLD_UB435Q_V2 },
{ USB_DEVICE(0x2013, 0x024f),
.driver_info = EM28174_BOARD_PCTV_290E },
{ USB_DEVICE(0x2013, 0x024c),
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c 
b/drivers/media/usb/em28xx/em28xx-dvb.c
index bb1e8dc..547eea6 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -298,6 +298,18 @@ static struct lgdt3305_config em2870_lgdt3304_dev = {
.qam_if_khz = 4000,
 };
 
+static struct lgdt3305_config em2874_lgdt3305_dev = {
+   .i2c_addr   = 0x0e,
+   .demod_chip = LGDT3305,
+   .spectral_inversion = 1,
+   .deny_i2c_rptr  = 0,
+   .mpeg_mode  = LGDT3305_MPEG_SERIAL,
+   .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE,
+   .tpvalid_polarity   = LGDT3305_TP_VALID_HIGH,
+   .vsb_if_khz = 3250,
+   .qam_if_khz = 4000,
+};
+
 static struct s921_config sharp_isdbt = {
.demod_address = 0x30  1
 };
@@ -329,6 +341,12 @@ static struct tda18271_config kworld_a340_config = {
.std_map   = kworld_a340_std_map,
 };
 
+static struct tda18271_config kworld_ub435q_v2_config = {
+   .std_map   = kworld_a340_std_map,
+   .gate  = TDA18271_GATE_DIGITAL,
+};
+
+
 static struct zl10353_config em28xx_zl10353_xc3028_no_i2c_gate = {
.demod_address = (0x1e  1),
.no_tuner = 1,
@@ -1297,6 +1315,15 @@ static int em28xx_dvb_init(struct em28xx *dev)
goto out_free;
}
break;
+   case EM2874_BOARD_KWORLD_UB435Q_V2:
+   dvb-fe[0] = dvb_attach(lgdt3305_attach,
+  em2874_lgdt3305_dev,
+  dev-i2c_adap[dev-def_i2c_bus]);
+   if (dvb-fe[0] != NULL)
+   dvb_attach(tda18271_attach, dvb-fe[0], 0x60,
+  dev-i2c_adap[dev-def_i2c_bus], 
kworld_ub435q_v2_config);
+
+   break;
default:
em28xx_errdev(/2: The frontend of your DVB/ATSC card
 isn't supported yet\n);
diff --git a/drivers/media/usb/em28xx/em28xx.h 
b/drivers/media/usb/em28xx/em28xx.h
index 205e903..6d988ad 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -131,6 +131,7 @@
 #define EM2884_BOARD_TERRATEC_HTC_USB_XS 87
 #define EM2884_BOARD_C3TECH_DIGITAL_DUO  88
 #define EM2874_BOARD_DELOCK_6195989
+#define EM2874_BOARD_KWORLD_UB435Q_V290
 
 /* Limits minimum and default number of buffers */
 #define EM28XX_MIN_BUF 4
-- 
1.7.5.4

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


cron job: media_tree daily build: WARNINGS

2013-09-29 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:   Mon Sep 30 04:00:20 CEST 2013
git branch: test
git hash:   ffee921033e64edf8579a3b21c7f15d1a6c3ef71
gcc version:i686-linux-gcc (GCC) 4.8.1
sparse version: 0.4.5-rc1
host hardware:  x86_64
host os:3.10.1

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
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.31.14-i686: OK
linux-2.6.32.27-i686: OK
linux-2.6.33.7-i686: OK
linux-2.6.34.7-i686: OK
linux-2.6.35.9-i686: OK
linux-2.6.36.4-i686: OK
linux-2.6.37.6-i686: OK
linux-2.6.38.8-i686: OK
linux-2.6.39.4-i686: OK
linux-3.0.60-i686: OK
linux-3.10.1-i686: OK
linux-3.1.10-i686: OK
linux-3.11.1-i686: OK
linux-3.12-rc1-i686: OK
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: OK
linux-3.7.4-i686: OK
linux-3.8-i686: OK
linux-3.9.2-i686: OK
linux-2.6.31.14-x86_64: OK
linux-2.6.32.27-x86_64: OK
linux-2.6.33.7-x86_64: OK
linux-2.6.34.7-x86_64: OK
linux-2.6.35.9-x86_64: OK
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
linux-3.0.60-x86_64: OK
linux-3.10.1-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12-rc1-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: OK
linux-3.9.2-x86_64: OK
apps: WARNINGS
spec-git: OK
ABI WARNING: change for arm-at91
ABI WARNING: change for arm-davinci
ABI WARNING: change for arm-exynos
ABI WARNING: change for arm-mx
ABI WARNING: change for arm-omap
ABI WARNING: change for arm-omap1
ABI WARNING: change for arm-pxa
ABI WARNING: change for blackfin
ABI WARNING: change for i686
ABI WARNING: change for m32r
ABI WARNING: change for mips
ABI WARNING: change for powerpc64
ABI WARNING: change for sh
ABI WARNING: change for x86_64
sparse version: 0.4.5-rc1
sparse: ERRORS

Detailed results are available here:

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

Full logs are available here:

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


iram pool not available for MX27

2013-09-29 Thread Chris Ruehl

Hi Phillipp,

hope things doing OK.

I recently update to the 3.12-rc kernel and hit this problem below.

[ 3.377790] coda coda-imx27.0: iram pool not available
[ 3.383363] coda: probe of coda-imx27.0 failed with error -12

I read your comments of the patch-set using platform data rather then 
hard coded addresses to get

the ocram from a SoC.

I checked the imx27.dtsi for the iram (coda: coda@..) definition and 
compare with the former hard coded address and size it matches.


My .config also has the CONFIG_OF set.

Any Idea what's go wrong?

Chris

--
GTSYS -
Unit A01, 24/F Gold King Industrial Building,
35-41 Tai Lin Pai Road, Kwai Chung,
Hong Kong
新界葵涌大連排道35-41號金基工業大廈24樓A01室

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