Re: [PATCH/RFC v9 01/19] leds: Add LED Flash class extension to the LED subsystem
Hi Sakari, Thanks for the review. On 12/03/2014 05:50 PM, Sakari Ailus wrote: Hi Jacek, Thanks for the update. A few comments below. On Wed, Dec 03, 2014 at 05:06:36PM +0100, Jacek Anaszewski wrote: Some LED devices support two operation modes - torch and flash. This patch provides support for flash LED devices in the LED subsystem by introducing new sysfs attributes and kernel internal interface. The attributes being introduced are: flash_brightness, flash_strobe, flash_timeout, max_flash_timeout, max_flash_brightness, flash_fault and flash_sync_strobe. All the flash related features are placed in a separate module. Torch mode is supported by the LED class interface. The modifications aim to be compatible with V4L2 framework requirements related to the flash devices management. The design assumes that V4L2 sub-device can take of the LED class device control and communicate with it through the kernel internal interface. When V4L2 Flash sub-device file is opened, the LED class device sysfs interface is made unavailable. Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com Acked-by: Kyungmin Park kyungmin.p...@samsung.com Cc: Bryan Wu coolo...@gmail.com Cc: Richard Purdie rpur...@rpsys.net --- drivers/leds/Kconfig| 10 + drivers/leds/Makefile |1 + drivers/leds/led-class-flash.c | 446 +++ drivers/leds/led-class.c|4 + include/linux/led-class-flash.h | 186 include/linux/leds.h|3 + 6 files changed, 650 insertions(+) create mode 100644 drivers/leds/led-class-flash.c create mode 100644 include/linux/led-class-flash.h diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index b3c0d8a..fa8021e 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -19,6 +19,16 @@ config LEDS_CLASS This option enables the led sysfs class in /sys/class/leds. You'll need this to do anything useful with LEDs. If unsure, say N. +config LEDS_CLASS_FLASH + tristate LED Flash Class Support + depends on LEDS_CLASS + help + This option enables the flash led sysfs class in /sys/class/leds. + It wrapps LED Class and adds flash LEDs specific sysfs attributes + and kernel internal API to it. You'll need this to provide support + for the flash related features of a LED device. It can be built + as a module. + comment LED drivers config LEDS_88PM860X diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 1c65a19..cbba921 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -2,6 +2,7 @@ # LED Core obj-$(CONFIG_NEW_LEDS)+= led-core.o obj-$(CONFIG_LEDS_CLASS) += led-class.o +obj-$(CONFIG_LEDS_CLASS_FLASH) += led-class-flash.o obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o # LED Platform Drivers diff --git a/drivers/leds/led-class-flash.c b/drivers/leds/led-class-flash.c new file mode 100644 index 000..219b414 --- /dev/null +++ b/drivers/leds/led-class-flash.c @@ -0,0 +1,446 @@ +/* + * LED Flash class interface + * + * Copyright (C) 2014 Samsung Electronics Co., Ltd. + * Author: Jacek Anaszewski j.anaszew...@samsung.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/device.h +#include linux/init.h +#include linux/led-class-flash.h +#include linux/leds.h +#include linux/module.h +#include linux/slab.h +#include leds.h + +#define has_flash_op(flash, op)\ + (flash flash-ops-op) + +#define call_flash_op(flash, op, args...) \ + ((has_flash_op(flash, op)) ?\ + (flash-ops-op(flash, args)) : \ + -EINVAL) + +static ssize_t flash_brightness_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t size) +{ + struct led_classdev *led_cdev = dev_get_drvdata(dev); + struct led_classdev_flash *flash = lcdev_to_flash(led_cdev); + unsigned long state; + ssize_t ret; + + mutex_lock(led_cdev-led_access); + + if (led_sysfs_is_disabled(led_cdev)) { + ret = -EBUSY; + goto unlock; + } + + ret = kstrtoul(buf, 10, state); + if (ret) + goto unlock; + + ret = led_set_flash_brightness(flash, state); + if (ret 0) + goto unlock; + + ret = size; +unlock: + mutex_unlock(led_cdev-led_access); + return ret; +} + +static ssize_t flash_brightness_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct led_classdev *led_cdev = dev_get_drvdata(dev); + struct led_classdev_flash *flash = lcdev_to_flash(led_cdev); + + /* no lock needed for
Re: [PATCH/RFC v9 05/19] leds: Add support for max77693 mfd flash cell
Hi Jacek, On Wed, Dec 03, 2014 at 05:06:40PM +0100, Jacek Anaszewski wrote: This patch adds led-flash support to Maxim max77693 chipset. A device can be exposed to user space through LED subsystem sysfs interface. Device supports up to two leds which can work in flash and torch mode. The leds can be triggered externally or by software. Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com Signed-off-by: Andrzej Hajda a.ha...@samsung.com Acked-by: Kyungmin Park kyungmin.p...@samsung.com Cc: Bryan Wu coolo...@gmail.com Cc: Richard Purdie rpur...@rpsys.net Cc: Lee Jones lee.jo...@linaro.org Cc: Chanwoo Choi cw00.c...@samsung.com --- drivers/leds/Kconfig | 10 + drivers/leds/Makefile|1 + drivers/leds/leds-max77693.c | 1023 ++ 3 files changed, 1034 insertions(+) create mode 100644 drivers/leds/leds-max77693.c diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index fa8021e..2e66d55 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -463,6 +463,16 @@ config LEDS_TCA6507 LED driver chips accessed via the I2C bus. Driver support brightness control and hardware-assisted blinking. +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 cbba921..57ca62b 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -52,6 +52,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..67a2f8f --- /dev/null +++ b/drivers/leds/leds-max77693.c @@ -0,0 +1,1023 @@ +/* + * LED Flash class driver for the flash cell of max77693 mfd. + * + * Copyright (C) 2014, Samsung Electronics Co., Ltd. + * + * Authors: Jacek Anaszewski j.anaszew...@samsung.com + *Andrzej Hajda a.ha...@samsung.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + */ + +#include asm/div64.h +#include linux/led-class-flash.h +#include linux/mfd/max77693.h +#include linux/mfd/max77693-private.h +#include linux/module.h +#include linux/mutex.h +#include linux/platform_device.h +#include linux/regmap.h +#include linux/slab.h +#include linux/workqueue.h + +#define MODE_OFF 0 +#define MODE_FLASH1 (1 0) +#define MODE_FLASH2 (1 1) +#define MODE_TORCH1 (1 2) +#define MODE_TORCH2 (1 3) +#define MODE_FLASH_EXTERNAL1 (1 4) +#define MODE_FLASH_EXTERNAL2 (1 5) You could do this based on an argument (led number). E.g. #define MODE_FLASH_EXTERNAL(a) (1 (4 + a)) +#define MODE_FLASH (MODE_FLASH1 | MODE_FLASH2 | \ + MODE_FLASH_EXTERNAL1 | MODE_FLASH_EXTERNAL2) + +#define FLED1_IOUT (1 0) +#define FLED2_IOUT (1 1) + +enum { + FLED1, + FLED2 +}; + +enum { + FLASH, + TORCH +}; + +struct max77693_sub_led { + struct led_classdev_flash ldev; + struct work_struct work_brightness_set; + + unsigned int torch_brightness; + unsigned int flash_timeout; +}; + +struct max77693_led { As this does not refer to a device, how about struct max77693_device, for instance? + struct regmap *regmap; + struct platform_device *pdev; + struct max77693_led_platform_data *pdata; + struct mutex lock; + + struct max77693_sub_led sub_leds[2]; + + unsigned int current_flash_timeout; + unsigned int mode_flags; + u8 torch_iout_reg; + bool iout_joint; + int strobing_sub_led_id; +}; + +struct max77693_led_settings { + struct led_flash_setting torch_brightness; + struct led_flash_setting flash_brightness; + struct led_flash_setting flash_timeout; +}; + +static u8 max77693_led_iout_to_reg(u32 ua) +{ + if (ua FLASH_IOUT_MIN) + ua = FLASH_IOUT_MIN; + return (ua - FLASH_IOUT_MIN) / FLASH_IOUT_STEP; +} + +static u8 max77693_flash_timeout_to_reg(u32
Re: [PATCH/RFC v9 02/19] Documentation: leds: Add description of LED Flash class extension
Hi Sakari, Thanks for the review. On 12/03/2014 06:08 PM, Sakari Ailus wrote: Hi Jacek, On Wed, Dec 03, 2014 at 05:06:37PM +0100, Jacek Anaszewski wrote: The documentation being added contains overall description of the LED Flash Class and the related sysfs attributes. Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com Acked-by: Kyungmin Park kyungmin.p...@samsung.com Cc: Bryan Wu coolo...@gmail.com Cc: Richard Purdie rpur...@rpsys.net --- Documentation/leds/leds-class-flash.txt | 50 +++ 1 file changed, 50 insertions(+) create mode 100644 Documentation/leds/leds-class-flash.txt diff --git a/Documentation/leds/leds-class-flash.txt b/Documentation/leds/leds-class-flash.txt new file mode 100644 index 000..82e58b1 --- /dev/null +++ b/Documentation/leds/leds-class-flash.txt @@ -0,0 +1,50 @@ + +Flash LED handling under Linux +== + +Some LED devices support two modes - torch and flash. The modes are +supported by the LED class (see Documentation/leds/leds-class.txt) +and LED Flash class respectively. + +In order to enable support for flash LEDs CONFIG_LEDS_CLASS_FLASH symbol +must be defined in the kernel config. A flash LED driver must register +in the LED subsystem with led_classdev_flash_register to gain flash +capabilities. + +Following sysfs attributes are exposed for controlling flash led devices: + + - flash_brightness - flash LED brightness in microamperes (RW) + - max_flash_brightness - maximum available flash LED brightness (RO) + - flash_timeout - flash strobe duration in microseconds (RW) + - max_flash_timeout - maximum available flash strobe duration (RO) + - flash_strobe - flash strobe state (RW) + - flash_sync_strobe - one flash device can control more than one + sub-led; when this atrribute is set to 1 s/atrribute/attribute/ + the flash led will be strobed synchronously + with the other one controlled by the same + device; flash timeout setting is inherited + from the led being strobed explicitly and + flash brightness setting of a sub-led's + being synchronized is used (RW) The flash brightness shouldn't be determined by the strobed LED. If this is a property of the hardware, then be it, but in general no, it it shouldn't be an interface requirement. I think this should just say that the strobe is synchronised. I intended this to sound exactly as you laid it out above, but maybe it is obscure English. and flash brightness setting of a sub-led being synchronized is used - from my point of view the led being synchronized is the one that isn't strobed explicitly. But I'm ok with confining ourselves only to saying that strobe is synchronized. How does the user btw. figure out which flash LEDs may be strobed synchronously using the LED flash interface? The flash_sync_strobe argument is absent if synchronized strobe is not available for a LED. The driver defines this by setting newly added LED_DEV_CAP_COMPOUND flag. 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
[RFC PATCH 0/8] Removing duplicate video/pad ops
This patch series attempts to remove some of the duplicate video/pad ops. The first two patches have been posted before. The only thing changed is that the subdevs no longer add checks for pad values != 0 as suggested. The third patch removes an unused subdev op. Somehow we must have missed that one. The fourth replaces v4l2_subdev_fh by v4l2_subdev_pad_config. No other changes other than that. This patch paves the way for bridge drivers to call pad ops that need v4l2_subdev_pad_config since bridge drivers do not have a v4l2_subdev_fh struct. The fifth patch is a small Kconfig cleanup. The sixth patch causes v4l2_device_register_subdev() to initialize a v4l2_subdev_pad_config array for use in bridge drivers. Bridge drivers can then use sd-pad_configs as argument to the pad ops. It's done behind the scenes, so this requires no driver changes. One disadvantage, though: bridge drivers that never call those pad ops since they expect that userspace will call them are now allocating memory for this when they will never need it. Should I add a V4L2_FL_DONT_CREATE_PAD_CONFIGS flag that such drivers can set, prohibiting allocating this memory? Is the code I use to initialize the pad_configs correct? Is it something that subdev_fh_init() in v4l2-subdev.c should do as well? The seventh patch removes the video enum_framesizes/intervals ops. The last patch removes the video g/s_crop and cropcap ops. This especially affects soc_camera. Note that I only tested if it compiles, I have not tried this on my soc_camera board. I will try to get my renesas board up and running with this kernel to test it but more help with this would be much appreciated. 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
[RFC PATCH 3/8] v4l2-subdev: drop unused op enum_mbus_fmt
From: Hans Verkuil hans.verk...@cisco.com Weird, this op isn't used at all. Seems to be orphaned code. Remove it. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- include/media/v4l2-subdev.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index b052184..5beeb87 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -342,8 +342,6 @@ struct v4l2_subdev_video_ops { struct v4l2_dv_timings *timings); int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index, u32 *code); - int (*enum_mbus_fsizes)(struct v4l2_subdev *sd, -struct v4l2_frmsizeenum *fsize); int (*g_mbus_fmt)(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt); int (*try_mbus_fmt)(struct v4l2_subdev *sd, -- 2.1.3 -- 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
[RFC PATCH 2/8] v4l2-subdev: drop get/set_crop pad ops
From: Hans Verkuil hans.verk...@cisco.com Drop the duplicate get/set_crop pad ops and only use get/set_selection. It makes no sense to have two duplicate ops in the internal subdev API. Signed-off-by: Hans Verkuil hans.verk...@cisco.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/v4l2-core/v4l2-subdev.c | 8 include/media/v4l2-subdev.h | 4 2 files changed, 12 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index 543631c..19a034e 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -283,10 +283,6 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) if (rval) return rval; - rval = v4l2_subdev_call(sd, pad, get_crop, subdev_fh, crop); - if (rval != -ENOIOCTLCMD) - return rval; - memset(sel, 0, sizeof(sel)); sel.which = crop-which; sel.pad = crop-pad; @@ -308,10 +304,6 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) if (rval) return rval; - rval = v4l2_subdev_call(sd, pad, set_crop, subdev_fh, crop); - if (rval != -ENOIOCTLCMD) - return rval; - memset(sel, 0, sizeof(sel)); sel.which = crop-which; sel.pad = crop-pad; diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 5860292..b052184 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -503,10 +503,6 @@ struct v4l2_subdev_pad_ops { struct v4l2_subdev_format *format); int (*set_fmt)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, struct v4l2_subdev_format *format); - int (*set_crop)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, - struct v4l2_subdev_crop *crop); - int (*get_crop)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, - struct v4l2_subdev_crop *crop); int (*get_selection)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, struct v4l2_subdev_selection *sel); int (*set_selection)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, -- 2.1.3 -- 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
[RFC PATCH 5/8] media/i2c/Kconfig: drop superfluous MEDIA_CONTROLLER
From: Hans Verkuil hans.verk...@cisco.com These drivers depend on VIDEO_V4L2_SUBDEV_API, which in turn depends on MEDIA_CONTROLLER. So it is sufficient to just depend on VIDEO_V4L2_SUBDEV_API. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index f40b4cf..29276fd 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -196,7 +196,7 @@ config VIDEO_ADV7183 config VIDEO_ADV7604 tristate Analog Devices ADV7604 decoder - depends on VIDEO_V4L2 I2C VIDEO_V4L2_SUBDEV_API MEDIA_CONTROLLER + depends on VIDEO_V4L2 I2C VIDEO_V4L2_SUBDEV_API ---help--- Support for the Analog Devices ADV7604 video decoder. @@ -208,7 +208,7 @@ config VIDEO_ADV7604 config VIDEO_ADV7842 tristate Analog Devices ADV7842 decoder - depends on VIDEO_V4L2 I2C VIDEO_V4L2_SUBDEV_API MEDIA_CONTROLLER + depends on VIDEO_V4L2 I2C VIDEO_V4L2_SUBDEV_API ---help--- Support for the Analog Devices ADV7842 video decoder. @@ -431,7 +431,7 @@ config VIDEO_ADV7393 config VIDEO_ADV7511 tristate Analog Devices ADV7511 encoder - depends on VIDEO_V4L2 I2C VIDEO_V4L2_SUBDEV_API MEDIA_CONTROLLER + depends on VIDEO_V4L2 I2C VIDEO_V4L2_SUBDEV_API ---help--- Support for the Analog Devices ADV7511 video encoder. -- 2.1.3 -- 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
[RFC PATCH 1/8] v4l2 subdevs: replace get/set_crop by get/set_selection
From: Hans Verkuil hans.verk...@cisco.com The crop and selection pad ops are duplicates. Replace all uses of get/set_crop by get/set_selection. This will make it possible to drop get/set_crop altogether. Signed-off-by: Hans Verkuil hans.verk...@cisco.com Acked-by: Sylwester Nawrocki s.nawro...@samsung.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Cc: Prabhakar Lad prabhakar.cse...@gmail.com Cc: Philipp Zabel p.za...@pengutronix.de --- drivers/media/i2c/mt9m032.c | 42 --- drivers/media/i2c/mt9p031.c | 41 --- drivers/media/i2c/mt9t001.c | 41 --- drivers/media/i2c/mt9v032.c | 43 --- drivers/media/i2c/s5k6aa.c | 44 +--- drivers/staging/media/davinci_vpfe/dm365_isif.c | 69 + 6 files changed, 156 insertions(+), 124 deletions(-) diff --git a/drivers/media/i2c/mt9m032.c b/drivers/media/i2c/mt9m032.c index 45b3fca..7643122 100644 --- a/drivers/media/i2c/mt9m032.c +++ b/drivers/media/i2c/mt9m032.c @@ -422,22 +422,25 @@ done: return ret; } -static int mt9m032_get_pad_crop(struct v4l2_subdev *subdev, - struct v4l2_subdev_fh *fh, - struct v4l2_subdev_crop *crop) +static int mt9m032_get_pad_selection(struct v4l2_subdev *subdev, +struct v4l2_subdev_fh *fh, +struct v4l2_subdev_selection *sel) { struct mt9m032 *sensor = to_mt9m032(subdev); + if (sel-target != V4L2_SEL_TGT_CROP) + return -EINVAL; + mutex_lock(sensor-lock); - crop-rect = *__mt9m032_get_pad_crop(sensor, fh, crop-which); + sel-r = *__mt9m032_get_pad_crop(sensor, fh, sel-which); mutex_unlock(sensor-lock); return 0; } -static int mt9m032_set_pad_crop(struct v4l2_subdev *subdev, - struct v4l2_subdev_fh *fh, - struct v4l2_subdev_crop *crop) +static int mt9m032_set_pad_selection(struct v4l2_subdev *subdev, +struct v4l2_subdev_fh *fh, +struct v4l2_subdev_selection *sel) { struct mt9m032 *sensor = to_mt9m032(subdev); struct v4l2_mbus_framefmt *format; @@ -445,9 +448,12 @@ static int mt9m032_set_pad_crop(struct v4l2_subdev *subdev, struct v4l2_rect rect; int ret = 0; + if (sel-target != V4L2_SEL_TGT_CROP) + return -EINVAL; + mutex_lock(sensor-lock); - if (sensor-streaming crop-which == V4L2_SUBDEV_FORMAT_ACTIVE) { + if (sensor-streaming sel-which == V4L2_SUBDEV_FORMAT_ACTIVE) { ret = -EBUSY; goto done; } @@ -455,13 +461,13 @@ static int mt9m032_set_pad_crop(struct v4l2_subdev *subdev, /* Clamp the crop rectangle boundaries and align them to a multiple of 2 * pixels to ensure a GRBG Bayer pattern. */ - rect.left = clamp(ALIGN(crop-rect.left, 2), MT9M032_COLUMN_START_MIN, + rect.left = clamp(ALIGN(sel-r.left, 2), MT9M032_COLUMN_START_MIN, MT9M032_COLUMN_START_MAX); - rect.top = clamp(ALIGN(crop-rect.top, 2), MT9M032_ROW_START_MIN, + rect.top = clamp(ALIGN(sel-r.top, 2), MT9M032_ROW_START_MIN, MT9M032_ROW_START_MAX); - rect.width = clamp_t(unsigned int, ALIGN(crop-rect.width, 2), + rect.width = clamp_t(unsigned int, ALIGN(sel-r.width, 2), MT9M032_COLUMN_SIZE_MIN, MT9M032_COLUMN_SIZE_MAX); - rect.height = clamp_t(unsigned int, ALIGN(crop-rect.height, 2), + rect.height = clamp_t(unsigned int, ALIGN(sel-r.height, 2), MT9M032_ROW_SIZE_MIN, MT9M032_ROW_SIZE_MAX); rect.width = min_t(unsigned int, rect.width, @@ -469,21 +475,21 @@ static int mt9m032_set_pad_crop(struct v4l2_subdev *subdev, rect.height = min_t(unsigned int, rect.height, MT9M032_PIXEL_ARRAY_HEIGHT - rect.top); - __crop = __mt9m032_get_pad_crop(sensor, fh, crop-which); + __crop = __mt9m032_get_pad_crop(sensor, fh, sel-which); if (rect.width != __crop-width || rect.height != __crop-height) { /* Reset the output image size if the crop rectangle size has * been modified. */ - format = __mt9m032_get_pad_format(sensor, fh, crop-which); + format = __mt9m032_get_pad_format(sensor, fh, sel-which); format-width = rect.width; format-height = rect.height; } *__crop = rect; - crop-rect = rect; + sel-r = rect; - if (crop-which == V4L2_SUBDEV_FORMAT_ACTIVE) + if (sel-which == V4L2_SUBDEV_FORMAT_ACTIVE) ret =
[RFC PATCH 7/8] v4l2-subdev: remove enum_framesizes/intervals
From: Hans Verkuil hans.verk...@cisco.com Replace the video ops enum_framesizes and enum_frameintervals by the pad ops enum_frame_size and enum_frame_interval. The video and pad ops are duplicates, so get rid of the more limited video op. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/ov7670.c | 37 +++ drivers/media/platform/marvell-ccic/mcam-core.c | 48 ++--- drivers/media/platform/soc_camera/soc_camera.c | 29 ++- drivers/media/platform/via-camera.c | 15 ++-- include/media/v4l2-subdev.h | 2 -- 5 files changed, 100 insertions(+), 31 deletions(-) diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c index 957927f..b984752 100644 --- a/drivers/media/i2c/ov7670.c +++ b/drivers/media/i2c/ov7670.c @@ -1069,29 +1069,35 @@ static int ov7670_s_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *parms) static int ov7670_frame_rates[] = { 30, 15, 10, 5, 1 }; -static int ov7670_enum_frameintervals(struct v4l2_subdev *sd, - struct v4l2_frmivalenum *interval) +static int ov7670_enum_frame_interval(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_frame_interval_enum *fie) { - if (interval-index = ARRAY_SIZE(ov7670_frame_rates)) + if (fie-pad) return -EINVAL; - interval-type = V4L2_FRMIVAL_TYPE_DISCRETE; - interval-discrete.numerator = 1; - interval-discrete.denominator = ov7670_frame_rates[interval-index]; + if (fie-index = ARRAY_SIZE(ov7670_frame_rates)) + return -EINVAL; + fie-interval.numerator = 1; + fie-interval.denominator = ov7670_frame_rates[fie-index]; return 0; } /* * Frame size enumeration */ -static int ov7670_enum_framesizes(struct v4l2_subdev *sd, - struct v4l2_frmsizeenum *fsize) +static int ov7670_enum_frame_size(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_frame_size_enum *fse) { struct ov7670_info *info = to_state(sd); int i; int num_valid = -1; - __u32 index = fsize-index; + __u32 index = fse-index; unsigned int n_win_sizes = info-devtype-n_win_sizes; + if (fse-pad) + return -EINVAL; + /* * If a minimum width/height was requested, filter out the capture * windows that fall outside that. @@ -1103,9 +1109,8 @@ static int ov7670_enum_framesizes(struct v4l2_subdev *sd, if (info-min_height win-height info-min_height) continue; if (index == ++num_valid) { - fsize-type = V4L2_FRMSIZE_TYPE_DISCRETE; - fsize-discrete.width = win-width; - fsize-discrete.height = win-height; + fse-min_width = fse-max_width = win-width; + fse-min_height = fse-max_height = win-height; return 0; } } @@ -1485,13 +1490,17 @@ static const struct v4l2_subdev_video_ops ov7670_video_ops = { .s_mbus_fmt = ov7670_s_mbus_fmt, .s_parm = ov7670_s_parm, .g_parm = ov7670_g_parm, - .enum_frameintervals = ov7670_enum_frameintervals, - .enum_framesizes = ov7670_enum_framesizes, +}; + +static const struct v4l2_subdev_pad_ops ov7670_pad_ops = { + .enum_frame_interval = ov7670_enum_frame_interval, + .enum_frame_size = ov7670_enum_frame_size, }; static const struct v4l2_subdev_ops ov7670_ops = { .core = ov7670_core_ops, .video = ov7670_video_ops, + .pad = ov7670_pad_ops, }; /* --- */ diff --git a/drivers/media/platform/marvell-ccic/mcam-core.c b/drivers/media/platform/marvell-ccic/mcam-core.c index 193373f..cab5a6a 100644 --- a/drivers/media/platform/marvell-ccic/mcam-core.c +++ b/drivers/media/platform/marvell-ccic/mcam-core.c @@ -1568,24 +1568,64 @@ static int mcam_vidioc_enum_framesizes(struct file *filp, void *priv, struct v4l2_frmsizeenum *sizes) { struct mcam_camera *cam = priv; + struct mcam_format_struct *f; + struct v4l2_subdev_frame_size_enum fse = { + .index = sizes-index, + }; int ret; + f = mcam_find_format(sizes-pixel_format); + if (f-pixelformat != sizes-pixel_format) + return -EINVAL; + fse.code = f-mbus_code; mutex_lock(cam-s_mutex); - ret = sensor_call(cam, video, enum_framesizes, sizes); + ret = sensor_call(cam, pad, enum_frame_size, + cam-sensor-pad_configs, fse); mutex_unlock(cam-s_mutex); - return ret; + if (ret) +
[RFC PATCH 6/8] v4l2-subdev: add v4l2_subdev_create_pad_configs
From: Hans Verkuil hans.verk...@cisco.com When a new subdevice is registered this new function is called to allocate and initialize a pad_config array. This allows bridge drivers to use the pad ops that require such an array as argument. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/v4l2-core/v4l2-device.c | 11 ++- drivers/media/v4l2-core/v4l2-subdev.c | 36 +++ include/media/v4l2-subdev.h | 4 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c index 015f92a..5c8d402 100644 --- a/drivers/media/v4l2-core/v4l2-device.c +++ b/drivers/media/v4l2-core/v4l2-device.c @@ -183,12 +183,16 @@ int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev, if (err) goto error_unregister; + err = v4l2_subdev_create_pad_configs(sd); + if (err) + goto error_unregister; + #if defined(CONFIG_MEDIA_CONTROLLER) /* Register the entity. */ if (v4l2_dev-mdev) { err = media_device_register_entity(v4l2_dev-mdev, entity); if (err 0) - goto error_unregister; + goto error_free_pad_configs; } #endif @@ -198,6 +202,9 @@ int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev, return 0; +error_free_pad_configs: + kfree(sd-pad_configs); + sd-pad_configs = NULL; error_unregister: if (sd-internal_ops sd-internal_ops-unregistered) sd-internal_ops-unregistered(sd); @@ -282,6 +289,8 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev *sd) if (sd-internal_ops sd-internal_ops-unregistered) sd-internal_ops-unregistered(sd); + kfree(sd-pad_configs); + sd-pad_configs = NULL; sd-v4l2_dev = NULL; #if defined(CONFIG_MEDIA_CONTROLLER) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index 3c8b198..a7b874e 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -560,6 +560,41 @@ int v4l2_subdev_link_validate(struct media_link *link) EXPORT_SYMBOL_GPL(v4l2_subdev_link_validate); #endif /* CONFIG_MEDIA_CONTROLLER */ +int v4l2_subdev_create_pad_configs(struct v4l2_subdev *sd) +{ +#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) + struct v4l2_subdev_format fmt = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + unsigned pads = sd-entity.num_pads; + unsigned pad; + int err; + + if (pads == 0) + return 0; + sd-pad_configs = kcalloc(pads, sizeof(*sd-pad_configs), GFP_KERNEL); + if (sd-pad_configs == NULL) + return -ENOMEM; + for (pad = 0; pad pads; pad++) { + fmt.pad = pad; + err = v4l2_subdev_call(sd, pad, get_fmt, NULL, fmt); + + if (err err != -ENOIOCTLCMD) { + kfree(sd-pad_configs); + sd-pad_configs = NULL; + return err; + } + sd-pad_configs[pad].try_fmt = fmt.format; + sd-pad_configs[pad].try_crop.width = fmt.format.width; + sd-pad_configs[pad].try_crop.height = fmt.format.height; + sd-pad_configs[pad].try_compose.width = fmt.format.width; + sd-pad_configs[pad].try_compose.height = fmt.format.height; + } +#endif + return 0; +} +EXPORT_SYMBOL_GPL(v4l2_subdev_create_pad_configs); + void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops *ops) { INIT_LIST_HEAD(sd-list); @@ -571,6 +606,7 @@ void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops *ops) sd-grp_id = 0; sd-dev_priv = NULL; sd-host_priv = NULL; + sd-pad_configs = NULL; #if defined(CONFIG_MEDIA_CONTROLLER) sd-entity.name = sd-name; sd-entity.type = MEDIA_ENT_T_V4L2_SUBDEV; diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 175dc4f..e9e8b15 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -611,6 +611,8 @@ struct v4l2_subdev { char name[V4L2_SUBDEV_NAME_SIZE]; /* can be used to group similar subdevs, value is driver-specific */ u32 grp_id; + /* Used by bridge drivers to allocate a pad config array */ + struct v4l2_subdev_pad_config *pad_configs; /* pointer to private data */ void *dev_priv; void *host_priv; @@ -689,6 +691,8 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd, struct v4l2_subdev_format *sink_fmt); int v4l2_subdev_link_validate(struct media_link *link); #endif /* CONFIG_MEDIA_CONTROLLER */ + +int v4l2_subdev_create_pad_configs(struct v4l2_subdev *sd); void v4l2_subdev_init(struct v4l2_subdev *sd,
[RFC PATCH 8/8] v4l2-subdev: remove g/s_crop and cropcap from video ops
From: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/ak881x.c | 32 +++-- drivers/media/i2c/soc_camera/imx074.c | 46 drivers/media/i2c/soc_camera/mt9m001.c | 74 +++- drivers/media/i2c/soc_camera/mt9m111.c | 61 +- drivers/media/i2c/soc_camera/mt9t031.c | 56 + drivers/media/i2c/soc_camera/mt9t112.c | 64 +- drivers/media/i2c/soc_camera/mt9v022.c | 72 +++- drivers/media/i2c/soc_camera/ov2640.c | 45 --- drivers/media/i2c/soc_camera/ov5642.c | 57 + drivers/media/i2c/soc_camera/ov6650.c | 78 +++-- drivers/media/i2c/soc_camera/ov772x.c | 48 drivers/media/i2c/soc_camera/ov9640.c | 45 --- drivers/media/i2c/soc_camera/ov9740.c | 49 drivers/media/i2c/soc_camera/rj54n1cb0c.c | 56 + drivers/media/i2c/soc_camera/tw9910.c | 51 +++- drivers/media/i2c/tvp5150.c| 85 +++--- drivers/media/platform/omap3isp/ispvideo.c | 88 +- drivers/media/platform/sh_vou.c| 13 ++- drivers/media/platform/soc_camera/mx2_camera.c | 18 ++- drivers/media/platform/soc_camera/mx3_camera.c | 18 ++- drivers/media/platform/soc_camera/omap1_camera.c | 23 ++-- drivers/media/platform/soc_camera/pxa_camera.c | 17 ++- drivers/media/platform/soc_camera/rcar_vin.c | 26 ++--- .../platform/soc_camera/sh_mobile_ceu_camera.c | 32 +++-- drivers/media/platform/soc_camera/soc_camera.c | 130 ++--- .../platform/soc_camera/soc_camera_platform.c | 49 drivers/media/platform/soc_camera/soc_scale_crop.c | 85 -- drivers/media/platform/soc_camera/soc_scale_crop.h | 6 +- drivers/staging/media/omap4iss/iss_video.c | 88 +- include/media/soc_camera.h | 7 +- include/media/v4l2-subdev.h| 3 - 31 files changed, 805 insertions(+), 717 deletions(-) diff --git a/drivers/media/i2c/ak881x.c b/drivers/media/i2c/ak881x.c index 69aeaf3..29d3b2a 100644 --- a/drivers/media/i2c/ak881x.c +++ b/drivers/media/i2c/ak881x.c @@ -128,21 +128,27 @@ static int ak881x_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned int index, return 0; } -static int ak881x_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) +static int ak881x_get_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct ak881x *ak881x = to_ak881x(client); - a-bounds.left = 0; - a-bounds.top = 0; - a-bounds.width = 720; - a-bounds.height= ak881x-lines; - a-defrect = a-bounds; - a-type = V4L2_BUF_TYPE_VIDEO_OUTPUT; - a-pixelaspect.numerator= 1; - a-pixelaspect.denominator = 1; + if (sel-which != V4L2_SUBDEV_FORMAT_ACTIVE) + return -EINVAL; - return 0; + switch (sel-target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + sel-r.left = 0; + sel-r.top = 0; + sel-r.width = 720; + sel-r.height = ak881x-lines; + return 0; + default: + return -EINVAL; + } } static int ak881x_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std) @@ -214,15 +220,19 @@ static struct v4l2_subdev_video_ops ak881x_subdev_video_ops = { .s_mbus_fmt = ak881x_s_mbus_fmt, .g_mbus_fmt = ak881x_try_g_mbus_fmt, .try_mbus_fmt = ak881x_try_g_mbus_fmt, - .cropcap= ak881x_cropcap, .enum_mbus_fmt = ak881x_enum_mbus_fmt, .s_std_output = ak881x_s_std_output, .s_stream = ak881x_s_stream, }; +static struct v4l2_subdev_pad_ops ak881x_subdev_pad_ops = { + .get_selection = ak881x_get_selection, +}; + static struct v4l2_subdev_ops ak881x_subdev_ops = { .core = ak881x_subdev_core_ops, .video = ak881x_subdev_video_ops, + .pad= ak881x_subdev_pad_ops, }; static int ak881x_probe(struct i2c_client *client, diff --git a/drivers/media/i2c/soc_camera/imx074.c b/drivers/media/i2c/soc_camera/imx074.c index ec89cfa..a5fc6d5 100644 --- a/drivers/media/i2c/soc_camera/imx074.c +++ b/drivers/media/i2c/soc_camera/imx074.c @@ -208,31 +208,26 @@ static int imx074_g_fmt(struct v4l2_subdev *sd, return 0; } -static int imx074_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) +static int
Re: [PATCH/RFC v9 06/19] DT: Add documentation for the mfd Maxim max77693
Hi Jacek, On Wed, Dec 03, 2014 at 05:06:41PM +0100, Jacek Anaszewski wrote: This patch adds device tree binding documentation for the flash cell of the Maxim max77693 multifunctional device. Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com Signed-off-by: Andrzej Hajda a.ha...@samsung.com Acked-by: Kyungmin Park kyungmin.p...@samsung.com Cc: Lee Jones lee.jo...@linaro.org Cc: Chanwoo Choi cw00.c...@samsung.com Cc: Bryan Wu coolo...@gmail.com Cc: Richard Purdie rpur...@rpsys.net Cc: Rob Herring robh...@kernel.org Cc: Pawel Moll pawel.m...@arm.com Cc: Mark Rutland mark.rutl...@arm.com Cc: Ian Campbell ijc+devicet...@hellion.org.uk Cc: Kumar Gala ga...@codeaurora.org Cc: devicet...@vger.kernel.org --- Documentation/devicetree/bindings/mfd/max77693.txt | 89 1 file changed, 89 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/max77693.txt b/Documentation/devicetree/bindings/mfd/max77693.txt index 01e9f30..25a6e78 100644 --- a/Documentation/devicetree/bindings/mfd/max77693.txt +++ b/Documentation/devicetree/bindings/mfd/max77693.txt @@ -41,7 +41,66 @@ Optional properties: To get more informations, please refer to documentaion. [*] refer Documentation/devicetree/bindings/pwm/pwm.txt +- led : the LED submodule device node + +There are two led outputs available - fled1 and fled2. Each of them can +control a separate led or they can be connected together to double +the maximum current for a single connected led. One led is represented +by one child node. + +Required properties: +- compatible : Must be maxim,max77693-led. + +Optional properties: +- maxim,fleds : Array of current outputs in order: fled1, fled2. + Note: both current outputs can be connected to a single led + Possible values: + MAX77693_LED_FLED_UNUSED - the output is left disconnected, + MAX77693_LED_FLED_USED - a diode is connected to the output. As you have a LED sub-nodes for each LED already, isn't this redundant? +- maxim,trigger-type : Array of trigger types in order: flash, torch. + Possible trigger types: + MAX77693_LED_TRIG_TYPE_EDGE - Rising edge of the signal triggers + the flash/torch, + MAX77693_LED_TRIG_TYPE_LEVEL - Signal level controls duration of How about: Strobe pulse length ...? How long does the torch stay on if you use edge trigger for it? I've always thought the torch enable pin was a practical joke. :-) If you need it this for torch as well, I'd use separate properties for the purpose, i.e. trigger-type-flash and trigger-type-torch. + the flash/torch. +- maxim,trigger : Array of flags indicating which trigger can activate given led + in order: fled1, fled2. + Possible flag values (can be combined): + MAX77693_LED_TRIG_FLASHEN - FLASHEN pin of the chip, + MAX77693_LED_TRIG_TORCHEN - TORCHEN pin of the chip, + MAX77693_LED_TRIG_SOFTWARE - software via I2C command. Is there a need to prevent strobing using a certain method? Just wondering. +- maxim,boost-mode : + In boost mode the device can produce up to 1.2A of total current + on both outputs. The maximum current on each output is reduced + to 625mA then. If there are two child led nodes defined then boost + is enabled by default. + Possible values: + MAX77693_LED_BOOST_OFF - no boost, + MAX77693_LED_BOOST_ADAPTIVE - adaptive mode, + MAX77693_LED_BOOST_FIXED - fixed mode. +- maxim,boost-vout : Output voltage of the boost module in millivolts. +- maxim,vsys-min : Low input voltage level in millivolts. Flash is not fired + if chip estimates that system voltage could drop below this level due + to flash power consumption. + +Required properties of the LED child node: +- label : see Documentation/devicetree/bindings/leds/common.txt +- maxim,fled_id : Identifier of the fled output the led is connected to; I'm pretty sure this will be needed for about every chip that can drive multiple LEDs. Shouldn't it be documented in the generic documentation? + MAX77693_LED_FLED1 - FLED1 output of the device - it has to be + used also if a single LED is connected to both outputs, + MAX77693_LED_FLED2 - FLED2 output of the device. + +Optional properties of the LED child node: +- max-microamp : see Documentation/devicetree/bindings/leds/common.txt + Range: 15625 - 25 +- flash-max-microamp : see Documentation/devicetree/bindings/leds/common.txt + Range: 15625 - 100 +- flash-timeout-microsec : see Documentation/devicetree/bindings/leds/common.txt + Range: 62500 - 100 + Example: +#include dt-bindings/mfd/max77693.h + max77693@66 { compatible = maxim,max77693; reg = 0x66; @@ -73,4 +132,34 @@ Example:
Re: [PATCH] Add LVDS RGB media bus formats
Hi Sakari, Am Mittwoch, den 03.12.2014, 17:47 +0200 schrieb Sakari Ailus: Hi Philipp, On Tue, Dec 02, 2014 at 08:41:24PM +0100, Philipp Zabel wrote: This patch adds three new RGB media bus formats that describe 18-bit or 24-bit samples transferred over an LVDS bus with three or four differential data pairs, serialized into 7 time slots, using standard SPWG/PSWG/VESA or JEIDA data ordering. Signed-off-by: Philipp Zabel p.za...@pengutronix.de --- Documentation/DocBook/media/v4l/subdev-formats.xml | 189 + include/uapi/linux/media-bus-format.h | 5 +- 2 files changed, 193 insertions(+), 1 deletion(-) diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml b/Documentation/DocBook/media/v4l/subdev-formats.xml index 0d6f731..52d7f04 100644 --- a/Documentation/DocBook/media/v4l/subdev-formats.xml +++ b/Documentation/DocBook/media/v4l/subdev-formats.xml @@ -89,6 +89,11 @@ constantMEDIA_BUS_FMT_RGB555_2X8_PADHI_BE/constant. /para + paraOn LVDS buses, usually each sample is transferred in seven time slots + on three (18-bit) or four (24-bit) differential data pairs at the same time. + The remaining bits are used for control signals as defined by SPWG/PSWG/VESA + or JEIDA standards./para + paraThe following tables list existing packed RGB formats./para table pgwide=0 frame=none id=v4l2-mbus-pixelcode-rgb @@ -606,6 +611,190 @@ /tbody /tgroup /table + table pgwide=0 frame=none id=v4l2-mbus-pixelcode-rgb-lvds + titleLVDS RGB formats/title + tgroup cols=11 + colspec colname=id align=left / + colspec colname=code align=center / + colspec colname=pair align=center / + colspec colname=slot / + colspec colnum=4 colname=s00 align=center / + colspec colnum=5 colname=s01 align=center / + colspec colnum=6 colname=s02 align=center / + colspec colnum=7 colname=s03 align=center / + colspec colnum=8 colname=s04 align=center / + colspec colnum=9 colname=s05 align=center / + colspec colnum=10 colname=s06 align=center / + spanspec namest=s00 nameend=s06 spanname=s0 / + thead + row + entryIdentifier/entry + entryCode/entry + entry/entry + entry/entry + entry spanname=s0Data organization/entry + /row + row + entry/entry + entry/entry + entryPair/entry + entrySlot/entry + entry0/entry + entry1/entry + entry2/entry + entry3/entry + entry4/entry + entry5/entry + entry6/entry + /row + /thead + tbody valign=top + row id=MEDIA-BUS-FMT-RGB666-LVDS-SPWG + entryMEDIA_BUS_FMT_RGB666_LVDS_SPWG/entry + entry0x1010/entry + entrydata0/entry + entry/entry + entrygsubscript0/subscript/entry + entryrsubscript5/subscript/entry + entryrsubscript4/subscript/entry + entryrsubscript3/subscript/entry + entryrsubscript2/subscript/entry + entryrsubscript1/subscript/entry + entryrsubscript0/subscript/entry + /row + row + entry/entry + entry/entry + entrydata1/entry + entry/entry + entrybsubscript1/subscript/entry + entrybsubscript0/subscript/entry + entrygsubscript5/subscript/entry + entrygsubscript4/subscript/entry + entrygsubscript3/subscript/entry + entrygsubscript2/subscript/entry + entrygsubscript1/subscript/entry + /row + row + entry/entry + entry/entry + entrydata2/entry + entry/entry + entryde/entry + entryvs/entry + entryhs/entry + entrybsubscript5/subscript/entry + entrybsubscript4/subscript/entry + entrybsubscript3/subscript/entry + entrybsubscript2/subscript/entry + /row + row id=MEDIA-BUS-FMT-RGB888-LVDS-SPWG + entryMEDIA_BUS_FMT_RGB888_LVDS_SPWG/entry + entry0x1011/entry + entrydata0/entry + entry/entry + entrygsubscript0/subscript/entry + entryrsubscript5/subscript/entry + entryrsubscript4/subscript/entry + entryrsubscript3/subscript/entry + entryrsubscript2/subscript/entry + entryrsubscript1/subscript/entry + entryrsubscript0/subscript/entry + /row + row + entry/entry + entry/entry + entrydata1/entry + entry/entry + entrybsubscript1/subscript/entry + entrybsubscript0/subscript/entry + entrygsubscript5/subscript/entry + entrygsubscript4/subscript/entry +
Re: [PATCH/RFC v9 05/19] leds: Add support for max77693 mfd flash cell
Hi Sakari, Thanks for the review. On 12/04/2014 10:39 AM, Sakari Ailus wrote: Hi Jacek, On Wed, Dec 03, 2014 at 05:06:40PM +0100, Jacek Anaszewski wrote: This patch adds led-flash support to Maxim max77693 chipset. A device can be exposed to user space through LED subsystem sysfs interface. Device supports up to two leds which can work in flash and torch mode. The leds can be triggered externally or by software. Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com Signed-off-by: Andrzej Hajda a.ha...@samsung.com Acked-by: Kyungmin Park kyungmin.p...@samsung.com Cc: Bryan Wu coolo...@gmail.com Cc: Richard Purdie rpur...@rpsys.net Cc: Lee Jones lee.jo...@linaro.org Cc: Chanwoo Choi cw00.c...@samsung.com --- drivers/leds/Kconfig | 10 + drivers/leds/Makefile|1 + drivers/leds/leds-max77693.c | 1023 ++ 3 files changed, 1034 insertions(+) create mode 100644 drivers/leds/leds-max77693.c diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index fa8021e..2e66d55 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -463,6 +463,16 @@ config LEDS_TCA6507 LED driver chips accessed via the I2C bus. Driver support brightness control and hardware-assisted blinking. +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 cbba921..57ca62b 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -52,6 +52,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..67a2f8f --- /dev/null +++ b/drivers/leds/leds-max77693.c @@ -0,0 +1,1023 @@ +/* + * LED Flash class driver for the flash cell of max77693 mfd. + * + * Copyright (C) 2014, Samsung Electronics Co., Ltd. + * + * Authors: Jacek Anaszewski j.anaszew...@samsung.com + * Andrzej Hajda a.ha...@samsung.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + */ + +#include asm/div64.h +#include linux/led-class-flash.h +#include linux/mfd/max77693.h +#include linux/mfd/max77693-private.h +#include linux/module.h +#include linux/mutex.h +#include linux/platform_device.h +#include linux/regmap.h +#include linux/slab.h +#include linux/workqueue.h + +#define MODE_OFF 0 +#define MODE_FLASH1(1 0) +#define MODE_FLASH2(1 1) +#define MODE_TORCH1(1 2) +#define MODE_TORCH2(1 3) +#define MODE_FLASH_EXTERNAL1 (1 4) +#define MODE_FLASH_EXTERNAL2 (1 5) You could do this based on an argument (led number). E.g. #define MODE_FLASH_EXTERNAL(a) (1 (4 + a)) OK. +#define MODE_FLASH (MODE_FLASH1 | MODE_FLASH2 | \ +MODE_FLASH_EXTERNAL1 | MODE_FLASH_EXTERNAL2) + +#define FLED1_IOUT (1 0) +#define FLED2_IOUT (1 1) + +enum { + FLED1, + FLED2 +}; + +enum { + FLASH, + TORCH +}; + +struct max77693_sub_led { + struct led_classdev_flash ldev; + struct work_struct work_brightness_set; + + unsigned int torch_brightness; + unsigned int flash_timeout; +}; + +struct max77693_led { As this does not refer to a device, how about struct max77693_device, for instance? OK. + struct regmap *regmap; + struct platform_device *pdev; + struct max77693_led_platform_data *pdata; + struct mutex lock; + + struct max77693_sub_led sub_leds[2]; + + unsigned int current_flash_timeout; + unsigned int mode_flags; + u8 torch_iout_reg; + bool iout_joint; + int strobing_sub_led_id; +}; + +struct max77693_led_settings { + struct led_flash_setting torch_brightness; + struct led_flash_setting flash_brightness; + struct led_flash_setting flash_timeout; +}; + +static u8 max77693_led_iout_to_reg(u32 ua) +{ + if (ua FLASH_IOUT_MIN) + ua = FLASH_IOUT_MIN; + return (ua -
Re: [PATCH/RFC v9 06/19] DT: Add documentation for the mfd Maxim max77693
Hi Sakari, Thanks for the review. On 12/04/2014 11:07 AM, Sakari Ailus wrote: Hi Jacek, On Wed, Dec 03, 2014 at 05:06:41PM +0100, Jacek Anaszewski wrote: This patch adds device tree binding documentation for the flash cell of the Maxim max77693 multifunctional device. Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com Signed-off-by: Andrzej Hajda a.ha...@samsung.com Acked-by: Kyungmin Park kyungmin.p...@samsung.com Cc: Lee Jones lee.jo...@linaro.org Cc: Chanwoo Choi cw00.c...@samsung.com Cc: Bryan Wu coolo...@gmail.com Cc: Richard Purdie rpur...@rpsys.net Cc: Rob Herring robh...@kernel.org Cc: Pawel Moll pawel.m...@arm.com Cc: Mark Rutland mark.rutl...@arm.com Cc: Ian Campbell ijc+devicet...@hellion.org.uk Cc: Kumar Gala ga...@codeaurora.org Cc: devicet...@vger.kernel.org --- Documentation/devicetree/bindings/mfd/max77693.txt | 89 1 file changed, 89 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/max77693.txt b/Documentation/devicetree/bindings/mfd/max77693.txt index 01e9f30..25a6e78 100644 --- a/Documentation/devicetree/bindings/mfd/max77693.txt +++ b/Documentation/devicetree/bindings/mfd/max77693.txt @@ -41,7 +41,66 @@ Optional properties: To get more informations, please refer to documentaion. [*] refer Documentation/devicetree/bindings/pwm/pwm.txt +- led : the LED submodule device node + +There are two led outputs available - fled1 and fled2. Each of them can +control a separate led or they can be connected together to double +the maximum current for a single connected led. One led is represented +by one child node. + +Required properties: +- compatible : Must be maxim,max77693-led. + +Optional properties: +- maxim,fleds : Array of current outputs in order: fled1, fled2. + Note: both current outputs can be connected to a single led + Possible values: + MAX77693_LED_FLED_UNUSED - the output is left disconnected, + MAX77693_LED_FLED_USED - a diode is connected to the output. As you have a LED sub-nodes for each LED already, isn't this redundant? Well, it seems so :) +- maxim,trigger-type : Array of trigger types in order: flash, torch. + Possible trigger types: + MAX77693_LED_TRIG_TYPE_EDGE - Rising edge of the signal triggers + the flash/torch, + MAX77693_LED_TRIG_TYPE_LEVEL - Signal level controls duration of How about: Strobe pulse length ...? OK, it will be more clear. How long does the torch stay on if you use edge trigger for it? I've always thought the torch enable pin was a practical joke. :-) There is a torch timer available but I don't expose it to the user. If you need it this for torch as well, I'd use separate properties for the purpose, i.e. trigger-type-flash and trigger-type-torch. OK. + the flash/torch. +- maxim,trigger : Array of flags indicating which trigger can activate given led + in order: fled1, fled2. + Possible flag values (can be combined): + MAX77693_LED_TRIG_FLASHEN - FLASHEN pin of the chip, + MAX77693_LED_TRIG_TORCHEN - TORCHEN pin of the chip, + MAX77693_LED_TRIG_SOFTWARE - software via I2C command. Is there a need to prevent strobing using a certain method? Just wondering. In some cases it could be convenient to prevent some options through device tree. +- maxim,boost-mode : + In boost mode the device can produce up to 1.2A of total current + on both outputs. The maximum current on each output is reduced + to 625mA then. If there are two child led nodes defined then boost + is enabled by default. + Possible values: + MAX77693_LED_BOOST_OFF - no boost, + MAX77693_LED_BOOST_ADAPTIVE - adaptive mode, + MAX77693_LED_BOOST_FIXED - fixed mode. +- maxim,boost-vout : Output voltage of the boost module in millivolts. +- maxim,vsys-min : Low input voltage level in millivolts. Flash is not fired + if chip estimates that system voltage could drop below this level due + to flash power consumption. + +Required properties of the LED child node: +- label : see Documentation/devicetree/bindings/leds/common.txt +- maxim,fled_id : Identifier of the fled output the led is connected to; I'm pretty sure this will be needed for about every chip that can drive multiple LEDs. Shouldn't it be documented in the generic documentation? OK. + MAX77693_LED_FLED1 - FLED1 output of the device - it has to be + used also if a single LED is connected to both outputs, + MAX77693_LED_FLED2 - FLED2 output of the device. + +Optional properties of the LED child node: +- max-microamp : see Documentation/devicetree/bindings/leds/common.txt + Range: 15625 - 25 +- flash-max-microamp : see Documentation/devicetree/bindings/leds/common.txt + Range: 15625 - 100 +-
[GIT PULL for v3.18] media fixes
Linus, Please pull from: git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media tags/media/v3.18-rc8 For a core fix and some driver fixes: - a regression fix at Remote Controller core affecting RC6 protocol handling; - a fix at video buffer handling at cx23885; - a race fix at solo6x10; - a fix at image selection at smiapp; - a fix at reported payload size on s2255drv; - two updates for MAINTAINERS file. Thanks! Mauro - The following changes since commit 167921cb0ff2bdbf25138dad799fec88c99ed316: [media] sp2: sp2_init() can be static (2014-11-03 19:08:06 -0200) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media tags/media/v3.18-rc8 for you to fetch changes up to d2a74581390d8e5ed09b12c9d4736847d918dfa6: [media] rc-core: fix toggle handling in the rc6 decoder (2014-11-21 15:57:47 -0200) media fixes for v3.18-rc8 Andrey Utkin (1): [media] Update MAINTAINERS for solo6x10 David Härdeman (1): [media] rc-core: fix toggle handling in the rc6 decoder Hans Verkuil (1): [media] cx23885: use sg = sg_next(sg) instead of sg++ Krzysztof Hałasa (1): [media] solo6x10: fix a race in IRQ handler Mauro Carvalho Chehab (1): MAINTAINERS: Update mchehab's addresses Sakari Ailus (1): [media] smiapp: Only some selection targets are settable sensoray-dev (1): [media] s2255drv: fix payload size for JPG, MJPEG MAINTAINERS| 38 -- drivers/media/i2c/smiapp/smiapp-core.c | 2 +- drivers/media/pci/cx23885/cx23885-core.c | 6 ++--- drivers/media/pci/solo6x10/solo6x10-core.c | 10 ++-- drivers/media/rc/ir-rc6-decoder.c | 2 +- drivers/media/usb/s2255/s2255drv.c | 2 +- 6 files changed, 28 insertions(+), 32 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
Re: [PATCH v2] staging: media: lirc: lirc_zilog.c: fix quoted strings split across lines
Hi Luis, Em Tue, 25 Nov 2014 20:36:29 + Luis de Bethencourt l...@debethencourt.com escreveu: checkpatch makes an exception to the 80-colum rule for quotes strings, and Documentation/CodingStyle recommends not splitting quotes strings across lines because it breaks the ability to grep for the string. Fixing these. WARNING: quoted string split across lines Signed-off-by: Luis de Bethencourt l...@debethencourt.com --- Changes in v2: - As pointed out by Joe Perches I missed a space when joining a set of strings Thanks for the review Joe drivers/staging/media/lirc/lirc_zilog.c | 39 ++--- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c index dca806a..a35d6f2 100644 --- a/drivers/staging/media/lirc/lirc_zilog.c +++ b/drivers/staging/media/lirc/lirc_zilog.c @@ -372,14 +372,12 @@ static int add_to_buf(struct IR *ir) ret); if (failures = 3) { mutex_unlock(ir-ir_lock); - dev_err(ir-l.dev, unable to read from the IR chip - after 3 resets, giving up\n); + dev_err(ir-l.dev, unable to read from the IR chip after 3 resets, giving up\n); This patch didn't apply on my tree, as what I have there is a driver custom macro. Probably I'm missing some patch (or it got merged via some other tree): + zilog_error(unable to read from the IR chip after 3 resets, giving up\n); +=== + dev_err(ir-l.dev, unable to read from the IR chip after 3 resets, giving up\n); + One general note about this patch: those strings are already big, so the best is to put them at the beginning of the second line, aligned with the parenthesis, e. g: dev_err(ir-l.dev, unable to read from the IR chip after 3 resets, giving up\n); Ok, on some, the second line will still violate the 80-cols max, but on others it may actually fit. So, better to do the same thing along the entire driver, as it makes easier to read it if all similar lines use the same criteria. Regards, Mauro. break; } /* Looks like the chip crashed, reset it */ - dev_err(ir-l.dev, polling the IR receiver chip failed, - trying reset\n); + dev_err(ir-l.dev, polling the IR receiver chip failed, trying reset\n); set_current_state(TASK_UNINTERRUPTIBLE); if (kthread_should_stop()) { @@ -405,8 +403,8 @@ static int add_to_buf(struct IR *ir) ret = i2c_master_recv(rx-c, keybuf, sizeof(keybuf)); mutex_unlock(ir-ir_lock); if (ret != sizeof(keybuf)) { - dev_err(ir-l.dev, i2c_master_recv failed with %d -- - keeping last read buffer\n, ret); + dev_err(ir-l.dev, i2c_master_recv failed with %d -- keeping last read buffer\n, + ret); } else { rx-b[0] = keybuf[3]; rx-b[1] = keybuf[4]; @@ -713,8 +711,8 @@ static int send_boot_data(struct IR_tx *tx) buf[0]); return 0; } - dev_notice(tx-ir-l.dev, Zilog/Hauppauge IR blaster firmware version - %d.%d.%d loaded\n, buf[1], buf[2], buf[3]); + dev_notice(tx-ir-l.dev, Zilog/Hauppauge IR blaster firmware version %d.%d.%d loaded\n, + buf[1], buf[2], buf[3]); return 0; } @@ -794,8 +792,7 @@ static int fw_load(struct IR_tx *tx) if (!read_uint8(data, tx_data-endp, version)) goto corrupt; if (version != 1) { - dev_err(tx-ir-l.dev, unsupported code set file version (%u, expected - 1) -- please upgrade to a newer driver, + dev_err(tx-ir-l.dev, unsupported code set file version (%u, expected 1) -- please upgrade to a newer driver, version); fw_unload_locked(); ret = -EFAULT; @@ -983,8 +980,8 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key) ret = get_key_data(data_block, code, key); if (ret == -EPROTO) { - dev_err(tx-ir-l.dev, failed to get data for code %u, key %u -- check - lircd.conf entries\n, code, key); + dev_err(tx-ir-l.dev, failed to get data for code %u, key %u -- check lircd.conf entries\n, + code, key);
[PATCH 5/5] rc: img-ir: add philips rc6 decoder module
Add img-ir module for decoding Philips rc6 protocol. Signed-off-by: Sifan Naeem sifan.na...@imgtec.com --- drivers/media/rc/img-ir/Kconfig |8 +++ drivers/media/rc/img-ir/Makefile |1 + drivers/media/rc/img-ir/img-ir-hw.c |3 + drivers/media/rc/img-ir/img-ir-hw.h |1 + drivers/media/rc/img-ir/img-ir-rc6.c | 117 ++ 5 files changed, 130 insertions(+) create mode 100644 drivers/media/rc/img-ir/img-ir-rc6.c diff --git a/drivers/media/rc/img-ir/Kconfig b/drivers/media/rc/img-ir/Kconfig index b5b114f..4d3fca9 100644 --- a/drivers/media/rc/img-ir/Kconfig +++ b/drivers/media/rc/img-ir/Kconfig @@ -66,3 +66,11 @@ config IR_IMG_RC5 help Say Y here to enable support for the RC5 protocol in the ImgTec infrared decoder block. + +config IR_IMG_RC6 + bool Phillips RC6 protocol support + depends on IR_IMG_HW + help + Say Y here to enable support for the RC6 protocol in the ImgTec + infrared decoder block. + Note: This version only supports mode 0. diff --git a/drivers/media/rc/img-ir/Makefile b/drivers/media/rc/img-ir/Makefile index 898b1b8..8e6d458 100644 --- a/drivers/media/rc/img-ir/Makefile +++ b/drivers/media/rc/img-ir/Makefile @@ -7,6 +7,7 @@ img-ir-$(CONFIG_IR_IMG_SONY)+= img-ir-sony.o img-ir-$(CONFIG_IR_IMG_SHARP) += img-ir-sharp.o img-ir-$(CONFIG_IR_IMG_SANYO) += img-ir-sanyo.o img-ir-$(CONFIG_IR_IMG_RC5)+= img-ir-rc5.o +img-ir-$(CONFIG_IR_IMG_RC6)+= img-ir-rc6.o img-ir-objs:= $(img-ir-y) obj-$(CONFIG_IR_IMG) += img-ir.o diff --git a/drivers/media/rc/img-ir/img-ir-hw.c b/drivers/media/rc/img-ir/img-ir-hw.c index 322cdf8..3b70dc2 100644 --- a/drivers/media/rc/img-ir/img-ir-hw.c +++ b/drivers/media/rc/img-ir/img-ir-hw.c @@ -45,6 +45,9 @@ static struct img_ir_decoder *img_ir_decoders[] = { #ifdef CONFIG_IR_IMG_RC5 img_ir_rc5, #endif +#ifdef CONFIG_IR_IMG_RC6 + img_ir_rc6, +#endif NULL }; diff --git a/drivers/media/rc/img-ir/img-ir-hw.h b/drivers/media/rc/img-ir/img-ir-hw.h index f124ec5..c7b6e1a 100644 --- a/drivers/media/rc/img-ir/img-ir-hw.h +++ b/drivers/media/rc/img-ir/img-ir-hw.h @@ -188,6 +188,7 @@ extern struct img_ir_decoder img_ir_sony; extern struct img_ir_decoder img_ir_sharp; extern struct img_ir_decoder img_ir_sanyo; extern struct img_ir_decoder img_ir_rc5; +extern struct img_ir_decoder img_ir_rc6; /** * struct img_ir_reg_timings - Reg values for decoder timings at clock rate. diff --git a/drivers/media/rc/img-ir/img-ir-rc6.c b/drivers/media/rc/img-ir/img-ir-rc6.c new file mode 100644 index 000..bcd0822 --- /dev/null +++ b/drivers/media/rc/img-ir/img-ir-rc6.c @@ -0,0 +1,117 @@ +/* + * ImgTec IR Decoder setup for Phillips RC-6 protocol. + * + * Copyright 2012-2014 Imagination Technologies Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include img-ir-hw.h + +/* Convert RC6 data to a scancode */ +static int img_ir_rc6_scancode(int len, u64 raw, u64 enabled_protocols, + struct img_ir_scancode_req *request) +{ + unsigned int addr, cmd, mode, trl1, trl2; + + /* +* Due to a side effect of the decoder handling the double length +* Trailer bit, the header information is a bit scrambled, and the +* raw data is shifted incorrectly. +* This workaround effectively recovers the header bits. +* +* The Header field should look like this: +* +* StartBit ModeBit2 ModeBit1 ModeBit0 TrailerBit +* +* But what we get is: +* +* ModeBit2 ModeBit1 ModeBit0 TrailerBit1 TrailerBit2 +* +* The start bit is not important to recover the scancode. +*/ + + raw = 27; + + trl1= (raw 17) 0x01; + trl2= (raw 16) 0x01; + + mode= (raw 18) 0x07; + addr= (raw8) 0xff; + cmd = raw 0xff; + + /* +* Due to the above explained irregularity the trailer bits cannot +* have the same value. +*/ + if (trl1 == trl2) + return -EINVAL; + + /* Only mode 0 supported for now */ + if (mode) + return -EINVAL; + + request-protocol = RC_TYPE_RC6_0; + request-scancode = addr 8 | cmd; + request-toggle = trl2; + return IMG_IR_SCANCODE; +} + +/* Convert RC6 scancode to RC6 data filter */ +static int img_ir_rc6_filter(const struct rc_scancode_filter *in, +struct img_ir_filter *out, u64 protocols) +{ + /* Not supported by the hw. */ + return -EINVAL; +} + +/* + * RC-6 decoder + * see http://www.sbprojects.com/knowledge/ir/rc6.php
[PATCH 4/5] rc: img-ir: add philips rc5 decoder module
Add img-ir module for decoding Philips rc5 protocol. Signed-off-by: Sifan Naeem sifan.na...@imgtec.com --- drivers/media/rc/img-ir/Kconfig |7 +++ drivers/media/rc/img-ir/Makefile |1 + drivers/media/rc/img-ir/img-ir-hw.c |3 ++ drivers/media/rc/img-ir/img-ir-hw.h |1 + drivers/media/rc/img-ir/img-ir-rc5.c | 88 ++ 5 files changed, 100 insertions(+) create mode 100644 drivers/media/rc/img-ir/img-ir-rc5.c diff --git a/drivers/media/rc/img-ir/Kconfig b/drivers/media/rc/img-ir/Kconfig index 03ba9fc..b5b114f 100644 --- a/drivers/media/rc/img-ir/Kconfig +++ b/drivers/media/rc/img-ir/Kconfig @@ -59,3 +59,10 @@ config IR_IMG_SANYO help Say Y here to enable support for the Sanyo protocol (used by Sanyo, Aiwa, Chinon remotes) in the ImgTec infrared decoder block. + +config IR_IMG_RC5 + bool Phillips RC5 protocol support + depends on IR_IMG_HW + help + Say Y here to enable support for the RC5 protocol in the ImgTec + infrared decoder block. diff --git a/drivers/media/rc/img-ir/Makefile b/drivers/media/rc/img-ir/Makefile index 92a459d..898b1b8 100644 --- a/drivers/media/rc/img-ir/Makefile +++ b/drivers/media/rc/img-ir/Makefile @@ -6,6 +6,7 @@ img-ir-$(CONFIG_IR_IMG_JVC) += img-ir-jvc.o img-ir-$(CONFIG_IR_IMG_SONY) += img-ir-sony.o img-ir-$(CONFIG_IR_IMG_SHARP) += img-ir-sharp.o img-ir-$(CONFIG_IR_IMG_SANYO) += img-ir-sanyo.o +img-ir-$(CONFIG_IR_IMG_RC5)+= img-ir-rc5.o img-ir-objs:= $(img-ir-y) obj-$(CONFIG_IR_IMG) += img-ir.o diff --git a/drivers/media/rc/img-ir/img-ir-hw.c b/drivers/media/rc/img-ir/img-ir-hw.c index a977467..322cdf8 100644 --- a/drivers/media/rc/img-ir/img-ir-hw.c +++ b/drivers/media/rc/img-ir/img-ir-hw.c @@ -42,6 +42,9 @@ static struct img_ir_decoder *img_ir_decoders[] = { #ifdef CONFIG_IR_IMG_SANYO img_ir_sanyo, #endif +#ifdef CONFIG_IR_IMG_RC5 + img_ir_rc5, +#endif NULL }; diff --git a/drivers/media/rc/img-ir/img-ir-hw.h b/drivers/media/rc/img-ir/img-ir-hw.h index 8578aa7..f124ec5 100644 --- a/drivers/media/rc/img-ir/img-ir-hw.h +++ b/drivers/media/rc/img-ir/img-ir-hw.h @@ -187,6 +187,7 @@ extern struct img_ir_decoder img_ir_jvc; extern struct img_ir_decoder img_ir_sony; extern struct img_ir_decoder img_ir_sharp; extern struct img_ir_decoder img_ir_sanyo; +extern struct img_ir_decoder img_ir_rc5; /** * struct img_ir_reg_timings - Reg values for decoder timings at clock rate. diff --git a/drivers/media/rc/img-ir/img-ir-rc5.c b/drivers/media/rc/img-ir/img-ir-rc5.c new file mode 100644 index 000..e1a0829 --- /dev/null +++ b/drivers/media/rc/img-ir/img-ir-rc5.c @@ -0,0 +1,88 @@ +/* + * ImgTec IR Decoder setup for Phillips RC-5 protocol. + * + * Copyright 2012-2014 Imagination Technologies Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include img-ir-hw.h + +/* Convert RC5 data to a scancode */ +static int img_ir_rc5_scancode(int len, u64 raw, u64 enabled_protocols, + struct img_ir_scancode_req *request) +{ + unsigned int addr, cmd, tgl, start; + + /* Quirk in the decoder shifts everything by 2 to the left. */ + raw = 2; + + start = (raw 13) 0x01; + tgl = (raw 11) 0x01; + addr= (raw 6) 0x1f; + cmd = raw 0x3f; + /* +* 12th bit is used to extend the command in extended RC5 and has +* no effect on standard RC5. +*/ + cmd += ((raw 12) 0x01) ? 0 : 0x40; + + if (!start) + return -EINVAL; + + request-protocol = RC_TYPE_RC5; + request-scancode = addr 8 | cmd; + request-toggle = tgl; + return IMG_IR_SCANCODE; +} + +/* Convert RC5 scancode to RC5 data filter */ +static int img_ir_rc5_filter(const struct rc_scancode_filter *in, +struct img_ir_filter *out, u64 protocols) +{ + /* Not supported by the hw. */ + return -EINVAL; +} + +/* + * RC-5 decoder + * see http://www.sbprojects.com/knowledge/ir/rc5.php + */ +struct img_ir_decoder img_ir_rc5 = { + .type = RC_BIT_RC5, + .control = { + .bitoriend2 = 1, + .code_type = IMG_IR_CODETYPE_BIPHASE, + .decodend2 = 1, + }, + /* main timings */ + .tolerance = 16, + .unit = 88, /* 1/36k*32=888.888microseconds */ + .timings= { + /* 10 symbol */ + .s10 = { + .pulse = { 1 }, + .space = { 1 }, + }, + + /* 11 symbol */ + .s11 = { +
[PATCH 1/5] rc: img-ir: add scancode requests to a struct
The information being requested of hardware decode callbacks through the img-ir-hw scancode API is mounting up, so combine it into a struct which can be passed in with a single pointer rather than multiple pointer arguments. This allows it to be extended more easily without touching all the hardware decode callbacks. Signed-off-by: Sifan Naeem sifan.na...@imgtec.com --- drivers/media/rc/img-ir/img-ir-hw.c| 16 +--- drivers/media/rc/img-ir/img-ir-hw.h| 16 ++-- drivers/media/rc/img-ir/img-ir-jvc.c |8 drivers/media/rc/img-ir/img-ir-nec.c | 24 drivers/media/rc/img-ir/img-ir-sanyo.c |8 drivers/media/rc/img-ir/img-ir-sharp.c |8 drivers/media/rc/img-ir/img-ir-sony.c | 12 ++-- 7 files changed, 53 insertions(+), 39 deletions(-) diff --git a/drivers/media/rc/img-ir/img-ir-hw.c b/drivers/media/rc/img-ir/img-ir-hw.c index ec49f94..61850a6 100644 --- a/drivers/media/rc/img-ir/img-ir-hw.c +++ b/drivers/media/rc/img-ir/img-ir-hw.c @@ -789,20 +789,22 @@ static void img_ir_handle_data(struct img_ir_priv *priv, u32 len, u64 raw) struct img_ir_priv_hw *hw = priv-hw; const struct img_ir_decoder *dec = hw-decoder; int ret = IMG_IR_SCANCODE; - u32 scancode; - enum rc_type protocol = RC_TYPE_UNKNOWN; + struct img_ir_scancode_req request; + + request.protocol = RC_TYPE_UNKNOWN; if (dec-scancode) - ret = dec-scancode(len, raw, protocol, scancode, hw-enabled_protocols); + ret = dec-scancode(len, raw, hw-enabled_protocols, request); else if (len = 32) - scancode = (u32)raw; + request.scancode = (u32)raw; else if (len 32) - scancode = (u32)raw ((1 len)-1); + request.scancode = (u32)raw ((1 len)-1); dev_dbg(priv-dev, data (%u bits) = %#llx\n, len, (unsigned long long)raw); if (ret == IMG_IR_SCANCODE) { - dev_dbg(priv-dev, decoded scan code %#x\n, scancode); - rc_keydown(hw-rdev, protocol, scancode, 0); + dev_dbg(priv-dev, decoded scan code %#x\n, + request.scancode); + rc_keydown(hw-rdev, request.protocol, request.scancode, 0); img_ir_end_repeat(priv); } else if (ret == IMG_IR_REPEATCODE) { if (hw-mode == IMG_IR_M_REPEATING) { diff --git a/drivers/media/rc/img-ir/img-ir-hw.h b/drivers/media/rc/img-ir/img-ir-hw.h index 8fcc16c..1fc9583 100644 --- a/drivers/media/rc/img-ir/img-ir-hw.h +++ b/drivers/media/rc/img-ir/img-ir-hw.h @@ -133,6 +133,18 @@ struct img_ir_timing_regvals { #define IMG_IR_REPEATCODE 1 /* repeat the previous code */ /** + * struct img_ir_scancode_req - Scancode request data. + * @protocol: Protocol code of received message (defaults to + * RC_TYPE_UNKNOWN). + * @scancode: Scan code of received message (must be written by + * handler if IMG_IR_SCANCODE is returned). + */ +struct img_ir_scancode_req { + enum rc_type protocol; + u32 scancode; +}; + +/** * struct img_ir_decoder - Decoder settings for an IR protocol. * @type: Protocol types bitmap. * @tolerance: Timing tolerance as a percentage (default 10%). @@ -162,8 +174,8 @@ struct img_ir_decoder { struct img_ir_control control; /* scancode logic */ - int (*scancode)(int len, u64 raw, enum rc_type *protocol, - u32 *scancode, u64 enabled_protocols); + int (*scancode)(int len, u64 raw, u64 enabled_protocols, + struct img_ir_scancode_req *request); int (*filter)(const struct rc_scancode_filter *in, struct img_ir_filter *out, u64 protocols); }; diff --git a/drivers/media/rc/img-ir/img-ir-jvc.c b/drivers/media/rc/img-ir/img-ir-jvc.c index a60dda8..d3e2fc0 100644 --- a/drivers/media/rc/img-ir/img-ir-jvc.c +++ b/drivers/media/rc/img-ir/img-ir-jvc.c @@ -12,8 +12,8 @@ #include img-ir-hw.h /* Convert JVC data to a scancode */ -static int img_ir_jvc_scancode(int len, u64 raw, enum rc_type *protocol, - u32 *scancode, u64 enabled_protocols) +static int img_ir_jvc_scancode(int len, u64 raw, u64 enabled_protocols, + struct img_ir_scancode_req *request) { unsigned int cust, data; @@ -23,8 +23,8 @@ static int img_ir_jvc_scancode(int len, u64 raw, enum rc_type *protocol, cust = (raw 0) 0xff; data = (raw 8) 0xff; - *protocol = RC_TYPE_JVC; - *scancode = cust 8 | data; + request-protocol = RC_TYPE_JVC; + request-scancode = cust 8 | data; return IMG_IR_SCANCODE; } diff --git a/drivers/media/rc/img-ir/img-ir-nec.c b/drivers/media/rc/img-ir/img-ir-nec.c index 7398975..27a7ea8 100644 --- a/drivers/media/rc/img-ir/img-ir-nec.c +++
[PATCH 3/5] rc: img-ir: biphase enabled with workaround
Biphase decoding in the current img-ir has got a quirk, where multiple Interrupts are generated when an incomplete IR code is received by the decoder. Patch adds a work around for the quirk and enables biphase decoding. Signed-off-by: Sifan Naeem sifan.na...@imgtec.com --- drivers/media/rc/img-ir/img-ir-hw.c | 56 +-- drivers/media/rc/img-ir/img-ir-hw.h |2 ++ 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/drivers/media/rc/img-ir/img-ir-hw.c b/drivers/media/rc/img-ir/img-ir-hw.c index 4a1407b..a977467 100644 --- a/drivers/media/rc/img-ir/img-ir-hw.c +++ b/drivers/media/rc/img-ir/img-ir-hw.c @@ -52,6 +52,11 @@ static struct img_ir_decoder *img_ir_decoders[] = { #define IMG_IR_QUIRK_CODE_BROKEN 0x1 /* Decode is broken */ #define IMG_IR_QUIRK_CODE_LEN_INCR 0x2 /* Bit length needs increment */ +/* + * The decoder generates rapid interrupts without actually having + * received any new data after an incomplete IR code is decoded. + */ +#define IMG_IR_QUIRK_CODE_IRQ 0x4 /* functions for preprocessing timings, ensuring max is set */ @@ -547,6 +552,7 @@ static void img_ir_set_decoder(struct img_ir_priv *priv, /* stop the end timer and switch back to normal mode */ del_timer_sync(hw-end_timer); + del_timer_sync(hw-suspend_timer); hw-mode = IMG_IR_M_NORMAL; /* clear the wakeup scancode filter */ @@ -843,6 +849,26 @@ static void img_ir_end_timer(unsigned long arg) spin_unlock_irq(priv-lock); } +/* + * Timer function to re-enable the current protocol after it had been + * cleared when invalid interrupts were generated due to a quirk in the + * img-ir decoder. + */ +static void img_ir_suspend_timer(unsigned long arg) +{ + struct img_ir_priv *priv = (struct img_ir_priv *)arg; + + img_ir_write(priv, IMG_IR_IRQ_CLEAR, + IMG_IR_IRQ_ALL ~IMG_IR_IRQ_EDGE); + + /* Don't set IRQ if it has changed in a different context. */ + if ((priv-hw.suspend_irqen IMG_IR_IRQ_EDGE) == + img_ir_read(priv, IMG_IR_IRQ_ENABLE)) + img_ir_write(priv, IMG_IR_IRQ_ENABLE, priv-hw.suspend_irqen); + /* enable */ + img_ir_write(priv, IMG_IR_CONTROL, priv-hw.reg_timings.ctrl); +} + #ifdef CONFIG_COMMON_CLK static void img_ir_change_frequency(struct img_ir_priv *priv, struct clk_notifier_data *change) @@ -908,15 +934,37 @@ void img_ir_isr_hw(struct img_ir_priv *priv, u32 irq_status) if (!hw-decoder) return; + ct = hw-decoder-control.code_type; + ir_status = img_ir_read(priv, IMG_IR_STATUS); - if (!(ir_status (IMG_IR_RXDVAL | IMG_IR_RXDVALD2))) + if (!(ir_status (IMG_IR_RXDVAL | IMG_IR_RXDVALD2))) { + if (!(priv-hw.ct_quirks[ct] IMG_IR_QUIRK_CODE_IRQ)) + return; + /* +* The below functionality is added as a work around to stop +* multiple Interrupts generated when an incomplete IR code is +* received by the decoder. +* The decoder generates rapid interrupts without actually +* having received any new data. After a single interrupt it's +* expected to clear up, but instead multiple interrupts are +* rapidly generated. only way to get out of this loop is to +* reset the control register after a short delay. +*/ + img_ir_write(priv, IMG_IR_CONTROL, 0); + hw-suspend_irqen = img_ir_read(priv, IMG_IR_IRQ_ENABLE); + img_ir_write(priv, IMG_IR_IRQ_ENABLE, +hw-suspend_irqen IMG_IR_IRQ_EDGE); + + /* Timer activated to re-enable the protocol. */ + mod_timer(hw-suspend_timer, + jiffies + msecs_to_jiffies(5)); return; + } ir_status = ~(IMG_IR_RXDVAL | IMG_IR_RXDVALD2); img_ir_write(priv, IMG_IR_STATUS, ir_status); len = (ir_status IMG_IR_RXDLEN) IMG_IR_RXDLEN_SHIFT; /* some versions report wrong length for certain code types */ - ct = hw-decoder-control.code_type; if (hw-ct_quirks[ct] IMG_IR_QUIRK_CODE_LEN_INCR) ++len; @@ -958,7 +1006,7 @@ static void img_ir_probe_hw_caps(struct img_ir_priv *priv) hw-ct_quirks[IMG_IR_CODETYPE_PULSELEN] |= IMG_IR_QUIRK_CODE_LEN_INCR; hw-ct_quirks[IMG_IR_CODETYPE_BIPHASE] - |= IMG_IR_QUIRK_CODE_BROKEN; + |= IMG_IR_QUIRK_CODE_IRQ; hw-ct_quirks[IMG_IR_CODETYPE_2BITPULSEPOS] |= IMG_IR_QUIRK_CODE_BROKEN; } @@ -977,6 +1025,8 @@ int img_ir_probe_hw(struct img_ir_priv *priv) /* Set up the end timer */ setup_timer(hw-end_timer, img_ir_end_timer, (unsigned long)priv); + setup_timer(hw-suspend_timer,
[PATCH 2/5] rc: img-ir: pass toggle bit to the rc driver
Add toggle bit to struct img_ir_scancode_req so that protocols can provide it to img_ir_handle_data(), and pass that toggle bit up to rc_keydown instead of 0. This is nedded for the upcoming rc-5 and rc-6 patches. Signed-off-by: Sifan Naeem sifan.na...@imgtec.com --- drivers/media/rc/img-ir/img-ir-hw.c |8 +--- drivers/media/rc/img-ir/img-ir-hw.h |2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/media/rc/img-ir/img-ir-hw.c b/drivers/media/rc/img-ir/img-ir-hw.c index 61850a6..4a1407b 100644 --- a/drivers/media/rc/img-ir/img-ir-hw.c +++ b/drivers/media/rc/img-ir/img-ir-hw.c @@ -792,6 +792,7 @@ static void img_ir_handle_data(struct img_ir_priv *priv, u32 len, u64 raw) struct img_ir_scancode_req request; request.protocol = RC_TYPE_UNKNOWN; + request.toggle = 0; if (dec-scancode) ret = dec-scancode(len, raw, hw-enabled_protocols, request); @@ -802,9 +803,10 @@ static void img_ir_handle_data(struct img_ir_priv *priv, u32 len, u64 raw) dev_dbg(priv-dev, data (%u bits) = %#llx\n, len, (unsigned long long)raw); if (ret == IMG_IR_SCANCODE) { - dev_dbg(priv-dev, decoded scan code %#x\n, - request.scancode); - rc_keydown(hw-rdev, request.protocol, request.scancode, 0); + dev_dbg(priv-dev, decoded scan code %#x, toggle %u\n, + request.scancode, request.toggle); + rc_keydown(hw-rdev, request.protocol, request.scancode, + request.toggle); img_ir_end_repeat(priv); } else if (ret == IMG_IR_REPEATCODE) { if (hw-mode == IMG_IR_M_REPEATING) { diff --git a/drivers/media/rc/img-ir/img-ir-hw.h b/drivers/media/rc/img-ir/img-ir-hw.h index 1fc9583..5e59e8e 100644 --- a/drivers/media/rc/img-ir/img-ir-hw.h +++ b/drivers/media/rc/img-ir/img-ir-hw.h @@ -138,10 +138,12 @@ struct img_ir_timing_regvals { * RC_TYPE_UNKNOWN). * @scancode: Scan code of received message (must be written by * handler if IMG_IR_SCANCODE is returned). + * @toggle:Toggle bit (defaults to 0). */ struct img_ir_scancode_req { enum rc_type protocol; u32 scancode; + u8 toggle; }; /** -- 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 0/5] rc: img-ir: rc5 and rc6 support added
This patch sets adds support for rc5 and rc6 decoder modules along with workarounds for quirks in the hw which surfaces when decoding in biphase mode required by rc5 and rc6. This patch set was based on head of linux-next commit: commit 1ca7c606de868d172afb4eb65e04e290dbdb51ff Author: Stephen Rothwell s...@canb.auug.org.au Date: Thu Dec 4 19:49:10 2014 +1100 Sifan Naeem (5): rc: img-ir: add scancode requests to a struct rc: img-ir: pass toggle bit to the rc driver rc: img-ir: biphase enabled with workaround rc: img-ir: add philips rc5 decoder module rc: img-ir: add philips rc6 decoder module drivers/media/rc/img-ir/Kconfig| 15 drivers/media/rc/img-ir/Makefile |2 + drivers/media/rc/img-ir/img-ir-hw.c| 80 +++--- drivers/media/rc/img-ir/img-ir-hw.h| 22 +- drivers/media/rc/img-ir/img-ir-jvc.c |8 +-- drivers/media/rc/img-ir/img-ir-nec.c | 24 +++ drivers/media/rc/img-ir/img-ir-rc5.c | 88 drivers/media/rc/img-ir/img-ir-rc6.c | 117 drivers/media/rc/img-ir/img-ir-sanyo.c |8 +-- drivers/media/rc/img-ir/img-ir-sharp.c |8 +-- drivers/media/rc/img-ir/img-ir-sony.c | 12 ++-- 11 files changed, 342 insertions(+), 42 deletions(-) create mode 100644 drivers/media/rc/img-ir/img-ir-rc5.c create mode 100644 drivers/media/rc/img-ir/img-ir-rc6.c -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH/RFC v9 06/19] DT: Add documentation for the mfd Maxim max77693
Hi! +- maxim,boost-mode : + In boost mode the device can produce up to 1.2A of total current + on both outputs. The maximum current on each output is reduced + to 625mA then. If there are two child led nodes defined then boost + is enabled by default. + Possible values: + MAX77693_LED_BOOST_OFF - no boost, + MAX77693_LED_BOOST_ADAPTIVE - adaptive mode, + MAX77693_LED_BOOST_FIXED - fixed mode. +- maxim,boost-vout : Output voltage of the boost module in millivolts. +- maxim,vsys-min : Low input voltage level in millivolts. Flash is not fired + if chip estimates that system voltage could drop below this level due + to flash power consumption. + +Required properties of the LED child node: +- label : see Documentation/devicetree/bindings/leds/common.txt +- maxim,fled_id : Identifier of the fled output the led is connected to; I'm pretty sure this will be needed for about every chip that can drive multiple LEDs. Shouldn't it be documented in the generic documentation? OK. Well... fled_id is not exactly suitable name. On other busses, it would be reg = 1? 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] [media] stv090x: Some whitespace cleanups
While writing changeset fdf1bc9fa2cf, I noticed some checkpatch complains about the CodingStyle for function parameters. So, clean them. While here, also removes uneeded extern from function prototype. No functional changes. Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/dvb-frontends/stv090x.h b/drivers/media/dvb-frontends/stv090x.h index f7f452f435f2..742eeda99000 100644 --- a/drivers/media/dvb-frontends/stv090x.h +++ b/drivers/media/dvb-frontends/stv090x.h @@ -89,29 +89,29 @@ struct stv090x_config { bool diseqc_envelope_mode; - int (*tuner_init) (struct dvb_frontend *fe); - int (*tuner_sleep) (struct dvb_frontend *fe); - int (*tuner_set_mode) (struct dvb_frontend *fe, enum tuner_mode mode); - int (*tuner_set_frequency) (struct dvb_frontend *fe, u32 frequency); - int (*tuner_get_frequency) (struct dvb_frontend *fe, u32 *frequency); - int (*tuner_set_bandwidth) (struct dvb_frontend *fe, u32 bandwidth); - int (*tuner_get_bandwidth) (struct dvb_frontend *fe, u32 *bandwidth); - int (*tuner_set_bbgain) (struct dvb_frontend *fe, u32 gain); - int (*tuner_get_bbgain) (struct dvb_frontend *fe, u32 *gain); - int (*tuner_set_refclk) (struct dvb_frontend *fe, u32 refclk); - int (*tuner_get_status) (struct dvb_frontend *fe, u32 *status); - void (*tuner_i2c_lock) (struct dvb_frontend *fe, int lock); + int (*tuner_init)(struct dvb_frontend *fe); + int (*tuner_sleep)(struct dvb_frontend *fe); + int (*tuner_set_mode)(struct dvb_frontend *fe, enum tuner_mode mode); + int (*tuner_set_frequency)(struct dvb_frontend *fe, u32 frequency); + int (*tuner_get_frequency)(struct dvb_frontend *fe, u32 *frequency); + int (*tuner_set_bandwidth)(struct dvb_frontend *fe, u32 bandwidth); + int (*tuner_get_bandwidth)(struct dvb_frontend *fe, u32 *bandwidth); + int (*tuner_set_bbgain)(struct dvb_frontend *fe, u32 gain); + int (*tuner_get_bbgain)(struct dvb_frontend *fe, u32 *gain); + int (*tuner_set_refclk)(struct dvb_frontend *fe, u32 refclk); + int (*tuner_get_status)(struct dvb_frontend *fe, u32 *status); + void (*tuner_i2c_lock)(struct dvb_frontend *fe, int lock); /* dir = 0 - output, dir = 1 - input/open-drain */ int (*set_gpio)(struct dvb_frontend *fe, u8 gpio, u8 dir, u8 value, -u8 xor_value); + u8 xor_value); }; #if IS_ENABLED(CONFIG_DVB_STV090x) -extern struct dvb_frontend *stv090x_attach(struct stv090x_config *config, - struct i2c_adapter *i2c, - enum stv090x_demodulator demod); +struct dvb_frontend *stv090x_attach(struct stv090x_config *config, + struct i2c_adapter *i2c, + enum stv090x_demodulator demod); #else -- 1.9.3 -- 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] stv090x: add an extra protetion against buffer overflow
As pointed by smatch: drivers/media/dvb-frontends/stv090x.c:2787 stv090x_optimize_carloop() error: buffer overflow 'car_loop_apsk_low' 11 = 13 drivers/media/dvb-frontends/stv090x.c:2789 stv090x_optimize_carloop() error: buffer overflow 'car_loop_apsk_low' 11 = 13 drivers/media/dvb-frontends/stv090x.c:2791 stv090x_optimize_carloop() error: buffer overflow 'car_loop_apsk_low' 11 = 13 drivers/media/dvb-frontends/stv090x.c:2793 stv090x_optimize_carloop() error: buffer overflow 'car_loop_apsk_low' 11 = 13 drivers/media/dvb-frontends/stv090x.c:2795 stv090x_optimize_carloop() error: buffer overflow 'car_loop_apsk_low' 11 = 13 The situation of a buffer overflow won't happen, in practice, with the current values of car_loop table. Yet, the entire logic that checks for those registration values is too complex. So, better to add an explicit check, just in case someone changes the car_loop tables causing a buffer overflow by mistake. This also helps to remove several smatch warnings, with is good. Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/dvb-frontends/stv090x.c b/drivers/media/dvb-frontends/stv090x.c index bce9cc1072aa..0b2a934f53e5 100644 --- a/drivers/media/dvb-frontends/stv090x.c +++ b/drivers/media/dvb-frontends/stv090x.c @@ -2783,6 +2783,12 @@ static u8 stv090x_optimize_carloop(struct stv090x_state *state, enum stv090x_mod aclc = car_loop[i].crl_pilots_off_30; } } else { /* 16APSK and 32APSK */ + /* +* This should never happen in practice, except if +* something is really wrong at the car_loop table. +*/ + if (i = 11) + i = 10; if (state-srate = 300) aclc = car_loop_apsk_low[i].crl_pilots_on_2; else if (state-srate = 700) -- 1.9.3 -- 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] arm: omap2: rx51-peripherals: fix build warning
commit 68a3c04 ([media] ARM: OMAP2: RX-51: update si4713 platform data) updated board-rx51-peripherals.c so that si4713 could be easily used on DT boot, but it ended up introducing a build warning whenever si4713 isn't enabled. This patches fixes that warning: arch/arm/mach-omap2/board-rx51-peripherals.c:1000:36: warning: \ ‘rx51_si4713_platform_data’ defined but not used [-Wunused-variable] static struct si4713_platform_data rx51_si4713_platform_data = { Cc: Sebastian Reichel s...@kernel.org Cc: Tony Lindgren t...@atomide.com Cc: Hans Verkuil hans.verk...@cisco.com Cc: Mauro Carvalho Chehab mche...@osg.samsung.com Signed-off-by: Felipe Balbi ba...@ti.com --- arch/arm/mach-omap2/board-rx51-peripherals.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c index d18a5cf..bda20c5 100644 --- a/arch/arm/mach-omap2/board-rx51-peripherals.c +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c @@ -997,9 +997,11 @@ static struct aic3x_pdata rx51_aic3x_data2 = { .gpio_reset = 60, }; +#if IS_ENABLED(CONFIG_I2C_SI4713) IS_ENABLED(CONFIG_PLATFORM_SI4713) static struct si4713_platform_data rx51_si4713_platform_data = { .is_platform_device = true }; +#endif static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_2[] = { #if IS_ENABLED(CONFIG_I2C_SI4713) IS_ENABLED(CONFIG_PLATFORM_SI4713) -- 2.1.0.GIT -- 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: [git:media_tree/master] [media] tuners: remove unneeded checks before release_firmware()
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/media_tree.git tree: Subject: [media] tuners: remove uneeded checks before release_firmware() Would you like to amend a typo in the commit title? Regards, Markus -- 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: [REVIEW PATCH 1/2] img-ir/hw: Avoid clearing filter for no-op protocol change
Em Mon, 1 Dec 2014 12:55:09 + James Hogan james.ho...@imgtec.com escreveu: When the img-ir driver is asked to change protocol, if the chosen decoder is already loaded then don't call img_ir_set_decoder(), so as not to clear the current filter. This is important because store_protocol() does not refresh the scancode filter with the new protocol if the set of enabled protocols hasn't actually changed, but it will still call the change_protocol() callback, resulting in the filter being disabled in the hardware. The problem can be reproduced by setting a filter, and then setting the protocol to the same protocol that is already set: $ echo nec protocols $ echo 0x filter_mask $ echo nec protocols After this, messages which don't match the filter still get received. This should be fixed at the RC core, as this is not driver-specific. Regards, Mauro Reported-by: Sifan Naeem sifan.na...@imgtec.com Signed-off-by: James Hogan james.ho...@imgtec.com Cc: Mauro Carvalho Chehab m.che...@samsung.com Cc: sta...@vger.kernel.org # v3.15+ Cc: linux-media@vger.kernel.org --- drivers/media/rc/img-ir/img-ir-hw.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/media/rc/img-ir/img-ir-hw.c b/drivers/media/rc/img-ir/img-ir-hw.c index 9db065344b41..1566337c1059 100644 --- a/drivers/media/rc/img-ir/img-ir-hw.c +++ b/drivers/media/rc/img-ir/img-ir-hw.c @@ -643,6 +643,12 @@ static int img_ir_change_protocol(struct rc_dev *dev, u64 *ir_type) continue; if (*ir_type dec-type) { *ir_type = dec-type; + /* + * We don't want to clear the filter if nothing is + * changing as it won't get set again. + */ + if (dec == hw-decoder) + return 0; img_ir_set_decoder(priv, dec, *ir_type); goto success; } -- 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 3.19 or 3.20] rtl2832 i2c binding
That set fixes issue, which happens when mn88472 slave demod from staging is used. Fix itself is done for drivers that has been in-kernel ages, but bug happens only when staging demod is used. So make decision to pull that for 3.19, or if not, then 3.20. Antti The following changes since commit 9a4ea5a98652f602d4ec16957f64fd666e862b09: [media] MAINTAINERS: Add myself as img-ir maintainer (2014-12-04 15:42:21 -0200) are available in the git repository at: git://linuxtv.org/anttip/media_tree.git astrometa for you to fetch changes up to 51e8ac292e856fbdacfc2b2e362553cc7db7d1da: rtl28xxu: change module unregister order (2014-12-04 19:50:18 +0200) Antti Palosaari (3): rtl2832: convert driver to I2C binding rtl28xxu: switch rtl2832 demod attach to I2C binding rtl28xxu: change module unregister order drivers/media/dvb-frontends/rtl2832.c | 108 drivers/media/dvb-frontends/rtl2832.h | 10 ++ drivers/media/dvb-frontends/rtl2832_priv.h | 1 + drivers/media/usb/dvb-usb-v2/rtl28xxu.c| 92 drivers/media/usb/dvb-usb-v2/rtl28xxu.h| 1 + 5 files changed, 184 insertions(+), 28 deletions(-) -- http://palosaari.fi/ -- 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: [git:media_tree/master] [media] tuners: remove unneeded checks before release_firmware()
Em Thu, 04 Dec 2014 18:38:21 +0100 SF Markus Elfring elfr...@users.sourceforge.net escreveu: This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/media_tree.git tree: Subject: [media] tuners: remove uneeded checks before release_firmware() Would you like to amend a typo in the commit title? Too late for that. Btw, next time, please try to use ~70 bytes per line on your patches. Regards, Markus -- 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] media / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
Em Wed, 03 Dec 2014 03:13:55 +0100 Rafael J. Wysocki r...@rjwysocki.net escreveu: From: Rafael J. Wysocki rafael.j.wyso...@intel.com After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected) PM_RUNTIME is always set if PM is set, so #ifdef blocks depending on CONFIG_PM_RUNTIME may now be changed to depend on CONFIG_PM. The alternative of CONFIG_PM_SLEEP and CONFIG_PM_RUNTIME may be replaced with CONFIG_PM too. Make these changes everywhere under drivers/media/. Signed-off-by: Rafael J. Wysocki rafael.j.wyso...@intel.com Acked-by: Mauro Carvalho Chehab mche...@osg.samsung.com Feel free to apply it via your tree. PS.: I won't doubt that you would find some extra checks for PM_RUNTIME on other places at media, as I remember I merged some things like that recently - I think they are there for 3.19, but it needs to be double-checked. Regards, Mauro --- Note: This depends on commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected) which is only in linux-next at the moment (via the linux-pm tree). Please let me know if it is OK to take this one into linux-pm. --- drivers/media/platform/coda/coda-common.c |4 ++-- drivers/media/platform/exynos4-is/fimc-core.c |6 +++--- drivers/media/platform/exynos4-is/fimc-is-i2c.c |2 +- drivers/media/platform/exynos4-is/fimc-lite.c |2 +- drivers/media/platform/exynos4-is/mipi-csis.c |2 +- drivers/media/platform/s5p-jpeg/jpeg-core.c |4 ++-- drivers/media/platform/s5p-mfc/s5p_mfc.c|2 +- drivers/media/platform/s5p-mfc/s5p_mfc_pm.c | 10 -- 8 files changed, 15 insertions(+), 17 deletions(-) Index: linux-pm/drivers/media/platform/s5p-jpeg/jpeg-core.c === --- linux-pm.orig/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ linux-pm/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -2632,7 +2632,7 @@ static int s5p_jpeg_remove(struct platfo return 0; } -#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) +#ifdef CONFIG_PM static int s5p_jpeg_runtime_suspend(struct device *dev) { struct s5p_jpeg *jpeg = dev_get_drvdata(dev); @@ -2682,7 +2682,7 @@ static int s5p_jpeg_runtime_resume(struc return 0; } -#endif /* CONFIG_PM_RUNTIME || CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ #ifdef CONFIG_PM_SLEEP static int s5p_jpeg_suspend(struct device *dev) Index: linux-pm/drivers/media/platform/s5p-mfc/s5p_mfc.c === --- linux-pm.orig/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ linux-pm/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -1302,7 +1302,7 @@ static int s5p_mfc_resume(struct device } #endif -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM static int s5p_mfc_runtime_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); Index: linux-pm/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c === --- linux-pm.orig/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c +++ linux-pm/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c @@ -13,9 +13,7 @@ #include linux/clk.h #include linux/err.h #include linux/platform_device.h -#ifdef CONFIG_PM_RUNTIME #include linux/pm_runtime.h -#endif #include s5p_mfc_common.h #include s5p_mfc_debug.h #include s5p_mfc_pm.h @@ -67,7 +65,7 @@ int s5p_mfc_init_pm(struct s5p_mfc_dev * } atomic_set(pm-power, 0); -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM pm-device = dev-plat_dev-dev; pm_runtime_enable(pm-device); #endif @@ -93,7 +91,7 @@ void s5p_mfc_final_pm(struct s5p_mfc_dev } clk_unprepare(pm-clock_gate); clk_put(pm-clock_gate); -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM pm_runtime_disable(pm-device); #endif } @@ -120,7 +118,7 @@ void s5p_mfc_clock_off(void) int s5p_mfc_power_on(void) { -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM return pm_runtime_get_sync(pm-device); #else atomic_set(pm-power, 1); @@ -130,7 +128,7 @@ int s5p_mfc_power_on(void) int s5p_mfc_power_off(void) { -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM return pm_runtime_put_sync(pm-device); #else atomic_set(pm-power, 0); Index: linux-pm/drivers/media/platform/exynos4-is/fimc-is-i2c.c === --- linux-pm.orig/drivers/media/platform/exynos4-is/fimc-is-i2c.c +++ linux-pm/drivers/media/platform/exynos4-is/fimc-is-i2c.c @@ -81,7 +81,7 @@ static int fimc_is_i2c_remove(struct pla return 0; } -#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) +#ifdef CONFIG_PM static int fimc_is_i2c_runtime_suspend(struct device *dev) { struct fimc_is_i2c *isp_i2c = dev_get_drvdata(dev); Index: linux-pm/drivers/media/platform/exynos4-is/fimc-lite.c
wintv-hvr-1955 status
Hi: I have a wintv-hvr-1955 (sold as a wintv-hvr-1950) from Hauppauge. I referenced a thread in this list in June 2014 http://article.gmane.org/gmane.linux.drivers.video-input-infrastructure/78952/match=wintv+hvr+1955 as well as this wiki page http://www.linuxtv.org/wiki/index.php/Hauppauge_WinTV-HVR-1950 Both of the above suggest that a Linux driver for this device is available from Hauppauge after signing an NDA. So I contacted them on Nov 19 and they responded with the following message: --- A driver has been recently submitted to Linux TV and is awaiting approval. This process can take anywhere from 2 weeks to 3 months. --- I am wondering if this is true and if I can get a status of this or an ETA. Is there anything available that I can try? Will support for this device be included in the pvrusb2 driver (like the 1950) or in something else? Thanks for any information or suggestions. Steve -- -- Steven Saner ssa...@hubris.net Voice: 316-858-3000 Director of Network Operations Fax: 316-858-3001 Hubris Communicationshttp://www.hubris.net -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 1/2] staging: media: lirc: lirc_zilog.c: fix quoted strings split across lines
checkpatch makes an exception to the 80-column rule for quotes strings, and Documentation/CodingStyle recommends not splitting quotes strings across lines because it breaks the ability to grep for the string. Fixing these. WARNING: quoted string split across lines Signed-off-by: Luis de Bethencourt l...@debethencourt.com --- drivers/staging/media/lirc/lirc_zilog.c | 61 ++--- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c index dca806a..8814a7e 100644 --- a/drivers/staging/media/lirc/lirc_zilog.c +++ b/drivers/staging/media/lirc/lirc_zilog.c @@ -372,14 +372,14 @@ static int add_to_buf(struct IR *ir) ret); if (failures = 3) { mutex_unlock(ir-ir_lock); - dev_err(ir-l.dev, unable to read from the IR chip - after 3 resets, giving up\n); + dev_err(ir-l.dev, + unable to read from the IR chip after 3 resets, giving up\n); break; } /* Looks like the chip crashed, reset it */ - dev_err(ir-l.dev, polling the IR receiver chip failed, - trying reset\n); + dev_err(ir-l.dev, + polling the IR receiver chip failed, trying reset\n); set_current_state(TASK_UNINTERRUPTIBLE); if (kthread_should_stop()) { @@ -405,8 +405,9 @@ static int add_to_buf(struct IR *ir) ret = i2c_master_recv(rx-c, keybuf, sizeof(keybuf)); mutex_unlock(ir-ir_lock); if (ret != sizeof(keybuf)) { - dev_err(ir-l.dev, i2c_master_recv failed with %d -- - keeping last read buffer\n, ret); + dev_err(ir-l.dev, + i2c_master_recv failed with %d -- keeping last read buffer\n, + ret); } else { rx-b[0] = keybuf[3]; rx-b[1] = keybuf[4]; @@ -713,8 +714,9 @@ static int send_boot_data(struct IR_tx *tx) buf[0]); return 0; } - dev_notice(tx-ir-l.dev, Zilog/Hauppauge IR blaster firmware version -%d.%d.%d loaded\n, buf[1], buf[2], buf[3]); + dev_notice(tx-ir-l.dev, + Zilog/Hauppauge IR blaster firmware version %d.%d.%d loaded\n, + buf[1], buf[2], buf[3]); return 0; } @@ -794,9 +796,9 @@ static int fw_load(struct IR_tx *tx) if (!read_uint8(data, tx_data-endp, version)) goto corrupt; if (version != 1) { - dev_err(tx-ir-l.dev, unsupported code set file version (%u, expected - 1) -- please upgrade to a newer driver, - version); + dev_err(tx-ir-l.dev, + unsupported code set file version (%u, expected 1) -- please upgrade to a newer driver, + version); fw_unload_locked(); ret = -EFAULT; goto out; @@ -983,8 +985,9 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key) ret = get_key_data(data_block, code, key); if (ret == -EPROTO) { - dev_err(tx-ir-l.dev, failed to get data for code %u, key %u -- check - lircd.conf entries\n, code, key); + dev_err(tx-ir-l.dev, + failed to get data for code %u, key %u -- check lircd.conf entries\n, + code, key); return ret; } else if (ret != 0) return ret; @@ -1059,12 +1062,14 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key) ret = i2c_master_send(tx-c, buf, 1); if (ret == 1) break; - dev_dbg(tx-ir-l.dev, NAK expected: i2c_master_send - failed with %d (try %d)\n, ret, i+1); + dev_dbg(tx-ir-l.dev, + NAK expected: i2c_master_send failed with %d (try %d)\n, + ret, i+1); } if (ret != 1) { - dev_err(tx-ir-l.dev, IR TX chip never got ready: last i2c_master_send - failed with %d\n, ret); + dev_err(tx-ir-l.dev, + IR TX chip never got ready: last i2c_master_send failed with %d\n, + ret); return ret 0 ? ret : -EFAULT; } @@ -1167,12 +1172,12 @@ static ssize_t
[PATCH v3 2/2] staging: media: lirc: lirc_zilog.c: keep consistency in dev functions
The previous patch switched some dev functions to move the string to a second line. Doing this for all similar functions because it makes the driver easier to read if all similar lines use the same criteria. Signed-off-by: Luis de Bethencourt l...@debethencourt.com --- drivers/staging/media/lirc/lirc_zilog.c | 155 +--- 1 file changed, 102 insertions(+), 53 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c index 8814a7e..af46827 100644 --- a/drivers/staging/media/lirc/lirc_zilog.c +++ b/drivers/staging/media/lirc/lirc_zilog.c @@ -322,7 +322,8 @@ static int add_to_buf(struct IR *ir) struct IR_tx *tx; if (lirc_buffer_full(rbuf)) { - dev_dbg(ir-l.dev, buffer overflow\n); + dev_dbg(ir-l.dev, + buffer overflow\n); return -EOVERFLOW; } @@ -368,8 +369,9 @@ static int add_to_buf(struct IR *ir) */ ret = i2c_master_send(rx-c, sendbuf, 1); if (ret != 1) { - dev_err(ir-l.dev, i2c_master_send failed with %d\n, - ret); + dev_err(ir-l.dev, + i2c_master_send failed with %d\n, + ret); if (failures = 3) { mutex_unlock(ir-ir_lock); dev_err(ir-l.dev, @@ -412,8 +414,9 @@ static int add_to_buf(struct IR *ir) rx-b[0] = keybuf[3]; rx-b[1] = keybuf[4]; rx-b[2] = keybuf[5]; - dev_dbg(ir-l.dev, key (0x%02x/0x%02x)\n, - rx-b[0], rx-b[1]); + dev_dbg(ir-l.dev, + key (0x%02x/0x%02x)\n, + rx-b[0], rx-b[1]); } /* key pressed ? */ @@ -464,7 +467,8 @@ static int lirc_thread(void *arg) struct IR *ir = arg; struct lirc_buffer *rbuf = ir-l.rbuf; - dev_dbg(ir-l.dev, poll thread started\n); + dev_dbg(ir-l.dev, + poll thread started\n); while (!kthread_should_stop()) { set_current_state(TASK_INTERRUPTIBLE); @@ -492,7 +496,8 @@ static int lirc_thread(void *arg) wake_up_interruptible(rbuf-wait_poll); } - dev_dbg(ir-l.dev, poll thread ended\n); + dev_dbg(ir-l.dev, + poll thread ended\n); return 0; } @@ -654,11 +659,14 @@ static int send_data_block(struct IR_tx *tx, unsigned char *data_block) buf[0] = (unsigned char)(i + 1); for (j = 0; j tosend; ++j) buf[1 + j] = data_block[i + j]; - dev_dbg(tx-ir-l.dev, %*ph, 5, buf); + dev_dbg(tx-ir-l.dev, + %*ph, + 5, buf); ret = i2c_master_send(tx-c, buf, tosend + 1); if (ret != tosend + 1) { - dev_err(tx-ir-l.dev, i2c_master_send failed with %d\n, - ret); + dev_err(tx-ir-l.dev, + i2c_master_send failed with %d\n, + ret); return ret 0 ? ret : -EFAULT; } i += tosend; @@ -682,7 +690,9 @@ static int send_boot_data(struct IR_tx *tx) buf[1] = 0x20; ret = i2c_master_send(tx-c, buf, 2); if (ret != 2) { - dev_err(tx-ir-l.dev, i2c_master_send failed with %d\n, ret); + dev_err(tx-ir-l.dev, + i2c_master_send failed with %d\n, + ret); return ret 0 ? ret : -EFAULT; } @@ -699,19 +709,24 @@ static int send_boot_data(struct IR_tx *tx) } if (ret != 1) { - dev_err(tx-ir-l.dev, i2c_master_send failed with %d\n, ret); + dev_err(tx-ir-l.dev, + i2c_master_send failed with %d\n, + ret); return ret 0 ? ret : -EFAULT; } /* Here comes the firmware version... (hopefully) */ ret = i2c_master_recv(tx-c, buf, 4); if (ret != 4) { - dev_err(tx-ir-l.dev, i2c_master_recv failed with %d\n, ret); + dev_err(tx-ir-l.dev, + i2c_master_recv failed with %d\n, + ret); return 0; } if ((buf[0] != 0x80) (buf[0] != 0xa0)) { - dev_err(tx-ir-l.dev, unexpected IR TX init response: %02x\n, - buf[0]); + dev_err(tx-ir-l.dev, + unexpected IR TX init response: %02x\n, + buf[0]);
Re: [PATCH v2] staging: media: lirc: lirc_zilog.c: fix quoted strings split across lines
On Thu, Dec 04, 2014 at 01:16:11PM -0200, Mauro Carvalho Chehab wrote: Hi Luis, Em Tue, 25 Nov 2014 20:36:29 + Luis de Bethencourt l...@debethencourt.com escreveu: checkpatch makes an exception to the 80-colum rule for quotes strings, and Documentation/CodingStyle recommends not splitting quotes strings across lines because it breaks the ability to grep for the string. Fixing these. WARNING: quoted string split across lines Signed-off-by: Luis de Bethencourt l...@debethencourt.com --- Changes in v2: - As pointed out by Joe Perches I missed a space when joining a set of strings Thanks for the review Joe drivers/staging/media/lirc/lirc_zilog.c | 39 ++--- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c index dca806a..a35d6f2 100644 --- a/drivers/staging/media/lirc/lirc_zilog.c +++ b/drivers/staging/media/lirc/lirc_zilog.c @@ -372,14 +372,12 @@ static int add_to_buf(struct IR *ir) ret); if (failures = 3) { mutex_unlock(ir-ir_lock); - dev_err(ir-l.dev, unable to read from the IR chip - after 3 resets, giving up\n); + dev_err(ir-l.dev, unable to read from the IR chip after 3 resets, giving up\n); This patch didn't apply on my tree, as what I have there is a driver custom macro. Probably I'm missing some patch (or it got merged via some other tree): Hi Mauro, The patch is against Greg's staging-testing branch. If you want it against any of your branches let me know and I will fix it. + zilog_error(unable to read from the IR chip after 3 resets, giving up\n); +=== + dev_err(ir-l.dev, unable to read from the IR chip after 3 resets, giving up\n); + One general note about this patch: those strings are already big, so the best is to put them at the beginning of the second line, aligned with the parenthesis, e. g: dev_err(ir-l.dev, unable to read from the IR chip after 3 resets, giving up\n); Ok, on some, the second line will still violate the 80-cols max, but on others it may actually fit. So, better to do the same thing along the entire driver, as it makes easier to read it if all similar lines use the same criteria. I just sent two patches. The first one changes the original patch to follow the format you suggest here. The second one changes the rest of the driver to be consisent with this. Thanks a lot for the review :) Luis Regards, Mauro. break; } /* Looks like the chip crashed, reset it */ - dev_err(ir-l.dev, polling the IR receiver chip failed, - trying reset\n); + dev_err(ir-l.dev, polling the IR receiver chip failed, trying reset\n); set_current_state(TASK_UNINTERRUPTIBLE); if (kthread_should_stop()) { @@ -405,8 +403,8 @@ static int add_to_buf(struct IR *ir) ret = i2c_master_recv(rx-c, keybuf, sizeof(keybuf)); mutex_unlock(ir-ir_lock); if (ret != sizeof(keybuf)) { - dev_err(ir-l.dev, i2c_master_recv failed with %d -- - keeping last read buffer\n, ret); + dev_err(ir-l.dev, i2c_master_recv failed with %d -- keeping last read buffer\n, + ret); } else { rx-b[0] = keybuf[3]; rx-b[1] = keybuf[4]; @@ -713,8 +711,8 @@ static int send_boot_data(struct IR_tx *tx) buf[0]); return 0; } - dev_notice(tx-ir-l.dev, Zilog/Hauppauge IR blaster firmware version -%d.%d.%d loaded\n, buf[1], buf[2], buf[3]); + dev_notice(tx-ir-l.dev, Zilog/Hauppauge IR blaster firmware version %d.%d.%d loaded\n, +buf[1], buf[2], buf[3]); return 0; } @@ -794,8 +792,7 @@ static int fw_load(struct IR_tx *tx) if (!read_uint8(data, tx_data-endp, version)) goto corrupt; if (version != 1) { - dev_err(tx-ir-l.dev, unsupported code set file version (%u, expected - 1) -- please upgrade to a newer driver, + dev_err(tx-ir-l.dev, unsupported code set file version (%u, expected 1) -- please upgrade to a newer driver, version); fw_unload_locked(); ret = -EFAULT; @@ -983,8 +980,8 @@ static int
[PATCH 1/3] configure.ac: add qt5 detection support
Disable QTGL for qt5 because of qv4l2 crash on startup. Signed-off-by: Peter Seiderer ps.rep...@gmx.net --- configure.ac | 41 +++-- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index 7bf9bf6..245a409 100644 --- a/configure.ac +++ b/configure.ac @@ -131,29 +131,42 @@ AS_IF([test x$with_jpeg != xno], AM_CONDITIONAL([HAVE_JPEG], [$have_jpeg]) -PKG_CHECK_MODULES(QT, [QtCore = 4.4 QtGui = 4.4], [qt_pkgconfig=true], [qt_pkgconfig=false]) +PKG_CHECK_MODULES(QT, [Qt5Core = 5.0 Qt5Gui = 5.0 Qt5Widgets = 5.0], [qt_pkgconfig=true], [qt_pkgconfig=false]) if test x$qt_pkgconfig = xtrue; then + QT_CFLAGS=$QT_CFLAGS -fPIC AC_SUBST(QT_CFLAGS) AC_SUBST(QT_LIBS) - MOC=`$PKG_CONFIG --variable=moc_location QtCore` - UIC=`$PKG_CONFIG --variable=uic_location QtCore` - RCC=`$PKG_CONFIG --variable=rcc_location QtCore` - if test -z $RCC; then - RCC=rcc - fi + AC_CHECK_PROGS(MOC, [moc-qt5 moc]) + AC_CHECK_PROGS(UIC, [uic-qt5 uic]) + AC_CHECK_PROGS(RCC, [rcc-qt5 rcc]) AC_SUBST(MOC) AC_SUBST(UIC) AC_SUBST(RCC) +# disable QTGL for qt5 because qv4l2 crash + qt_pkgconfig_gl=false else - AC_MSG_WARN(Qt4 or higher is not available) + PKG_CHECK_MODULES(QT, [QtCore = 4.0 QtGui = 4.0], [qt_pkgconfig=true], [qt_pkgconfig=false]) + if test x$qt_pkgconfig = xtrue; then + MOC=`$PKG_CONFIG --variable=moc_location Qt5Core` + UIC=`$PKG_CONFIG --variable=uic_location Qt5Core` + RCC=`$PKG_CONFIG --variable=rcc_location Qt5Core` + if test -z $RCC; then + RCC=rcc + fi + AC_SUBST(MOC) + AC_SUBST(UIC) + AC_SUBST(RCC) + PKG_CHECK_MODULES(QTGL, [QtOpenGL = 4.8 gl], [qt_pkgconfig_gl=true], [qt_pkgconfig_gl=false]) + if test x$qt_pkgconfig_gl = xtrue; then + AC_DEFINE([HAVE_QTGL], [1], [qt has opengl support]) + else + AC_MSG_WARN(Qt4 OpenGL is not available) + fi + else + AC_MSG_WARN(Qt4 or higher is not available) + fi fi -PKG_CHECK_MODULES(QTGL, [QtOpenGL = 4.8 gl], [qt_pkgconfig_gl=true], [qt_pkgconfig_gl=false]) -if test x$qt_pkgconfig_gl = xtrue; then - AC_DEFINE([HAVE_QTGL], [1], [qt has opengl support]) -else - AC_MSG_WARN(Qt4 OpenGL or higher is not available) -fi PKG_CHECK_MODULES(ALSA, [alsa], [alsa_pkgconfig=true], [alsa_pkgconfig=false]) if test x$alsa_pkgconfig = xtrue; then -- 2.1.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
[PATCH 2/3] qv4l2: fix qt5 compile
Signed-off-by: Peter Seiderer ps.rep...@gmx.net --- utils/qv4l2/capture-win-qt.cpp | 4 utils/qv4l2/qv4l2.cpp | 21 + 2 files changed, 25 insertions(+) diff --git a/utils/qv4l2/capture-win-qt.cpp b/utils/qv4l2/capture-win-qt.cpp index db85cd2..9c849a0 100644 --- a/utils/qv4l2/capture-win-qt.cpp +++ b/utils/qv4l2/capture-win-qt.cpp @@ -117,7 +117,11 @@ void CaptureWinQt::paintFrame() void CaptureWinQt::stop() { if (m_data != NULL) +#if QT_VERSION = 0x05 + memcpy(m_image-bits(), m_data, m_image-byteCount()); +#else memcpy(m_image-bits(), m_data, m_image-numBytes()); +#endif m_data = NULL; } diff --git a/utils/qv4l2/qv4l2.cpp b/utils/qv4l2/qv4l2.cpp index 0784a15..8329cbd 100644 --- a/utils/qv4l2/qv4l2.cpp +++ b/utils/qv4l2/qv4l2.cpp @@ -1084,8 +1084,13 @@ void ApplicationWindow::startAudio() QString audOut = m_genTab-getAudioOutDevice(); if (audIn != NULL audOut != NULL audIn.compare(None) audIn.compare(audOut) != 0) { +#if QT_VERSION = 0x05 + alsa_thread_startup(audOut.toLatin1().data(), audIn.toLatin1().data(), + m_genTab-getAudioDeviceBufferSize(), NULL, 0); +#else alsa_thread_startup(audOut.toAscii().data(), audIn.toAscii().data(), m_genTab-getAudioDeviceBufferSize(), NULL, 0); +#endif if (m_genTab-isRadio()) statusBar()-showMessage(Capturing audio); @@ -1582,7 +1587,11 @@ void ApplicationWindow::error(const QString error) { statusBar()-showMessage(error, 2); if (!error.isEmpty()) +#if QT_VERSION = 0x05 + fprintf(stderr, %s\n, error.toLatin1().data()); +#else fprintf(stderr, %s\n, error.toAscii().data()); +#endif } void ApplicationWindow::error(int err) @@ -1657,7 +1666,11 @@ static bool processShortOption(const QStringList args, int i, QString dev) return false; if (args[i].length() == 2) { if (i + 1 = args.size()) { +#if QT_VERSION = 0x05 + usageError(args[i].toLatin1()); +#else usageError(args[i].toAscii()); +#endif return false; } dev = args[++i]; @@ -1680,7 +1693,11 @@ static bool processLongOption(const QStringList args, int i, QString dev) return true; } if (i + 1 = args.size()) { +#if QT_VERSION = 0x05 + usageError(args[i].toLatin1()); +#else usageError(args[i].toAscii()); +#endif return false; } dev = args[++i]; @@ -1734,7 +1751,11 @@ int main(int argc, char **argv) } else if (args[i] == -R || args[i] == --raw) { raw = true; } else { +#if QT_VERSION = 0x05 + printf(Invalid argument %s\n, args[i].toLatin1().data()); +#else printf(Invalid argument %s\n, args[i].toAscii().data()); +#endif return 0; } } -- 2.1.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
[PATCH 3/3] qv4l2: update qmake project file
Signed-off-by: Peter Seiderer ps.rep...@gmx.net --- utils/qv4l2/qv4l2.pro | 32 ++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/utils/qv4l2/qv4l2.pro b/utils/qv4l2/qv4l2.pro index 7ab39cc..2c6c9c8 100644 --- a/utils/qv4l2/qv4l2.pro +++ b/utils/qv4l2/qv4l2.pro @@ -6,9 +6,37 @@ TEMPLATE = app INCLUDEPATH += . ../libv4l2util ../../lib/include ../../include CONFIG += debug +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +greaterThan(QT_MAJOR_VERSION, 4): QT += opengl + +INCLUDEPATH += /home/seiderer/Work/v4l_utils/v4l-utils +INCLUDEPATH += /home/seiderer/Work/v4l_utils/v4l-utils/utils/v4l2-ctl/ +INCLUDEPATH += /home/seiderer/Work/v4l_utils/v4l-utils/utils/v4l2-compliance + # Input -HEADERS += qv4l2.h general-tab.h capture-win.h -SOURCES += qv4l2.cpp general-tab.cpp ctrl-tab.cpp capture-win.cpp +HEADERS += alsa_stream.h +HEADERS += capture-win-gl.h +HEADERS += capture-win.h +HEADERS += capture-win-qt.h +HEADERS += general-tab.h +HEADERS += qv4l2.h +HEADERS += raw2sliced.h +HEADERS += vbi-tab.h +HEADERS += ../v4l2-ctl/vivid-tpg.h +HEADERS += ../v4l2-ctl/vivid-tpg-colors.h + +SOURCES += capture-win.cpp +SOURCES += capture-win-gl.cpp +SOURCES += capture-win-qt.cpp +SOURCES += ctrl-tab.cpp +SOURCES += general-tab.cpp +SOURCES += qv4l2.cpp +SOURCES += raw2sliced.cpp +SOURCES += tpg-tab.cpp +SOURCES += vbi-tab.cpp +SOURCES += ../v4l2-ctl/vivid-tpg.c +SOURCES += ../v4l2-ctl/vivid-tpg-colors.c + LIBS += -L../../lib/libv4l2 -lv4l2 -L../../lib/libv4lconvert -lv4lconvert -lrt -L../libv4l2util -lv4l2util -ldl -ljpeg RESOURCES += qv4l2.qrc -- 2.1.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
Re: [PATCH] media / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
On Thursday, December 04, 2014 04:08:40 PM Mauro Carvalho Chehab wrote: Em Wed, 03 Dec 2014 03:13:55 +0100 Rafael J. Wysocki r...@rjwysocki.net escreveu: From: Rafael J. Wysocki rafael.j.wyso...@intel.com After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected) PM_RUNTIME is always set if PM is set, so #ifdef blocks depending on CONFIG_PM_RUNTIME may now be changed to depend on CONFIG_PM. The alternative of CONFIG_PM_SLEEP and CONFIG_PM_RUNTIME may be replaced with CONFIG_PM too. Make these changes everywhere under drivers/media/. Signed-off-by: Rafael J. Wysocki rafael.j.wyso...@intel.com Acked-by: Mauro Carvalho Chehab mche...@osg.samsung.com Feel free to apply it via your tree. Thanks! PS.: I won't doubt that you would find some extra checks for PM_RUNTIME on other places at media, as I remember I merged some things like that recently - I think they are there for 3.19, but it needs to be double-checked. That's fine. There is at least one case when I need to wait for other trees to get merged due to files being moved around, so I'll do a second round during the merge window anyway. Kind regards, Rafael -- 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: OK
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 Dec 5 04:00:29 CET 2014 git branch: test git hash: 71947828caef0c83d4245f7d1eaddc799b4ff1d1 gcc version:i686-linux-gcc (GCC) 4.9.1 sparse version: v0.5.0-35-gc1c3f96 smatch version: 0.4.1-3153-g7d56ab3 host hardware: x86_64 host os:3.17-3.slh.2-amd64 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.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.1.10-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-3.10.1-i686: OK linux-3.11.1-i686: OK linux-3.12.23-i686: OK linux-3.13.11-i686: OK linux-3.14.9-i686: OK linux-3.15.2-i686: OK linux-3.16-i686: OK linux-3.17-i686: OK linux-3.18-rc1-i686: 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.1.10-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 linux-3.10.1-x86_64: OK linux-3.11.1-x86_64: OK linux-3.12.23-x86_64: OK linux-3.13.11-x86_64: OK linux-3.14.9-x86_64: OK linux-3.15.2-x86_64: OK linux-3.16-x86_64: OK linux-3.17-x86_64: OK linux-3.18-rc1-x86_64: OK 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
Re: [GIT PULL] soc-camera: 1st set for 3.19
Hi Mauro, On Mon, 1 Dec 2014, Mauro Carvalho Chehab wrote: Em Fri, 28 Nov 2014 23:15:32 +0100 (CET) Guennadi Liakhovetski g.liakhovet...@gmx.de escreveu: Hi Mauro, IIUC, this coming Sunday might be the last -rc, so, postponing pull requests to subsystem maintainers even further isn't a good idea, so, here goes an soc-camera request. I know it isn't complete, there are a few more patches waiting to be pushed upstream, but I won't have time this coming weekend and next two weeks I'm traveling, which won't simplify things either. Some more patches are being reworked, if they arrive soon and we do get another -rc, I might try to push them too, but I don't want to postpone these ones, while waiting. One of these patches has also been modified by me and hasn't been tested yet. But changes weren't too complex. If however I did break something, we'll have to fix it in an incremental patch. The following changes since commit d298a59791fad3a707c1dadbef0935ee2664a10e: Merge branch 'patchwork' into to_next (2014-11-21 17:01:46 -0200) are available in the git repository at: git://linuxtv.org/gliakhovetski/v4l-dvb.git for-3.19-1 for you to fetch changes up to d8f5c144e57d99d2a7325bf8877812bf560e22dd: rcar_vin: Fix interrupt enable in progressive (2014-11-23 12:08:19 +0100) Koji Matsuoka (4): rcar_vin: Add YUYV capture format support rcar_vin: Add scaling support Hmm... WARNING: DT compatible string renesas,vin-r8a7794 appears un-documented -- check ./Documentation/devicetree/bindings/ #38: FILE: drivers/media/platform/soc_camera/rcar_vin.c:1406: + { .compatible = renesas,vin-r8a7794, .data = (void *)RCAR_GEN2 }, WARNING: DT compatible string renesas,vin-r8a7793 appears un-documented -- check ./Documentation/devicetree/bindings/ #39: FILE: drivers/media/platform/soc_camera/rcar_vin.c:1407: + { .compatible = renesas,vin-r8a7793, .data = (void *)RCAR_GEN2 }, Where are the DT binding documentation for this? You should be adding a patch to: Documentation/devicetree/bindings/media/rcar_vin.txt before this one. Sure, documentation is in the same patch http://git.linuxtv.org/cgit.cgi/gliakhovetski/v4l-dvb.git/commit/?h=for-3.19-1id=aa1f7651acbe222948f43e239eda15362c9e274c Is it because you cannot push it via your tree or what's happened, why this warning? Thanks Guennadi rcar_vin: Enable VSYNC field toggle mode rcar_vin: Fix interrupt enable in progressive Yoshihiro Kaneko (1): rcar_vin: Add DT support for r8a7793 and r8a7794 SoCs .../devicetree/bindings/media/rcar_vin.txt | 2 + drivers/media/platform/soc_camera/rcar_vin.c | 466 - 2 files changed, 457 insertions(+), 11 deletions(-) Thanks Guennadi -- 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