LED / flash API integration
Subsystems (4)
v8 cover LED / flash API integration
This is eighth non-RFC version of LED / flash API integration series [1]. It is based on linux_next-20150519 with patch [2].
================
Changes since v7
================
- Merged patches from Sakari for v4l2-flash-led-class and V4L2 related patches for leds-max77693 and leds-aat1290 drivers
- applied minor modifications to the both led drivers related patches
- modified exynos4-is media device to parse new samsung,flash-led property, instead of 'flashes' array
- added DT documentation for samsung,flash-led property
================
Changes since v5
================
- renamed v4l2-flash module to v4l2-flash-led-class and applied other related modifications spotted by Sakari
- fixed not released of_node reference in max77693-led driver
================
Changes since v4
================
- adapted leds-max77693 and leds-aat1290 drivers to the recent modifications in leds/common.txt bindings documentation and changed the behaviour when properties are missing
- modified DT bindings documenation for the aforementioned drivers
- removed unjustified use of goto in the leds-aat1290 driver
- fixed lack of of_node_put in leds-aat1290 driver, after parsing DT child node
- removed patch adding 'skyworks' vendor prefix, as the entry has been recently added
================
Changes since v2
================
- improved leds/common DT bindings documentation
- improved max77693-led DT documentation
- fixed validation of DT confguration for leds-max77693 by minimal values in joint iouts case
- removed trigger-type property from leds-max77693 bindings and adjusted the driver accordingly
- improved LED Flash class documentation related to v4l2-flash sub-device initialization
- excluded from leds-aat1290 DT bindings documentation the part related to handling external strobe sources
================
Changes since v1
================
- excluded exynos4-is media device related patches, as there is consenus required related to flash devices handling in media device DT bindings
- modifications around LED Flash class settings and v4l2 flash config initialization in LED Flash class drivers and v4l2-flash wrapper
- switched to using DT node name as a device name for leds-max77693 and leds-aat1290 drivers, in case DT 'label' property is absent
- dropped OF dependecy for v4l2-flash wrapper
- moved LED_FAULTS definitions from led-class-flash.h to uapi/linux/leds.h
- allowed for multiple clients of v4l2-flash sub-device
======================
Changes since RFC v13:
======================
- reduced number of patches - some of them have been merged
- slightly modified max77693-led device naming
- fixed issues in v4l2-flash helpers detected with yavta
- cleaned up AAT1290 device tree documentation
- added GPIOLIB dependecy to AAT1290 related entry in Kconfig
Thanks,
Jacek Anaszewski
[1] http://www.spinics.net/lists/kernel/msg1944538.html
[2] http://www.spinics.net/lists/linux-media/msg89839.html
Jacek Anaszewski (8):
media: Add registration helpers for V4L2 flash sub-devices
leds: max77693: add support for V4L2 Flash sub-device
DT: aat1290: Document handling external strobe sources
leds: aat1290: add support for V4L2 Flash sub-device
exynos4-is: Add support for v4l2-flash subdevs
DT: s5c73m3: Add documentation for samsung,flash-led property
DT: s5k6a3: Add documentation for samsung,flash-led property
DT: samsung-fimc: Add examples for samsung,flash-led property
.../devicetree/bindings/leds/leds-aat1290.txt | 36 +- .../devicetree/bindings/media/samsung-fimc.txt | 4 + .../devicetree/bindings/media/samsung-s5c73m3.txt | 5 + .../devicetree/bindings/media/samsung-s5k6a3.txt | 4 + drivers/leds/Kconfig | 1 + drivers/leds/leds-aat1290.c | 137 +++- drivers/leds/leds-max77693.c | 129 +++- drivers/media/platform/exynos4-is/media-dev.c | 39 +- drivers/media/platform/exynos4-is/media-dev.h | 13 +- drivers/media/v4l2-core/Kconfig | 11 + drivers/media/v4l2-core/Makefile | 2 + drivers/media/v4l2-core/v4l2-flash-led-class.c | 655 ++++++++++++++++++++ include/media/v4l2-flash-led-class.h | 139 +++++ 13 files changed, 1158 insertions(+), 17 deletions(-) create mode 100644 drivers/media/v4l2-core/v4l2-flash-led-class.c create mode 100644 include/media/v4l2-flash-led-class.h
Signature · 1 line
1.7.9.5
PATCH v8 1/8 media: Add registration helpers for V4L2 flash sub-devices
This patch adds helper functions for registering/unregistering LED Flash class devices as V4L2 sub-devices. The functions should be called from the LED subsystem device driver. In case the support for V4L2 Flash sub-devices is disabled in the kernel config the functions' empty versions will be used.
--- drivers/media/v4l2-core/Kconfig | 11 + drivers/media/v4l2-core/Makefile | 2 + drivers/media/v4l2-core/v4l2-flash-led-class.c | 655 ++++++++++++++++++++++++ include/media/v4l2-flash-led-class.h | 139 +++++ 4 files changed, 807 insertions(+) create mode 100644 drivers/media/v4l2-core/v4l2-flash-led-class.c create mode 100644 include/media/v4l2-flash-led-class.h
drivers/media/v4l2-core/Kconfig +11 -0
@@ -44,6 +44,17 @@ config V4L2_MEM2MEM_DEV tristate depends on VIDEOBUF2_CORE +# Used by LED subsystem flash drivers +config V4L2_FLASH_LED_CLASS + tristate "V4L2 flash API for LED flash class devices" + depends on VIDEO_V4L2_SUBDEV_API + depends on LEDS_CLASS_FLASH + ---help--- + Say Y here to enable V4L2 flash API support for LED flash + class drivers. + + When in doubt, say N. + # Used by drivers that need Videobuf modules config VIDEOBUF_GEN tristate
drivers/media/v4l2-core/Makefile +2 -0
@@ -22,6 +22,8 @@ obj-$(CONFIG_VIDEO_TUNER) += tuner.o obj-$(CONFIG_V4L2_MEM2MEM_DEV) += v4l2-mem2mem.o +obj-$(CONFIG_V4L2_FLASH_LED_CLASS) += v4l2-flash-led-class.o + obj-$(CONFIG_VIDEOBUF_GEN) += videobuf-core.o obj-$(CONFIG_VIDEOBUF_DMA_SG) += videobuf-dma-sg.o obj-$(CONFIG_VIDEOBUF_DMA_CONTIG) += videobuf-dma-contig.o
drivers/media/v4l2-core/v4l2-flash-led-class.c new file +655 -0
655 lines not on this page · raw message
include/media/v4l2-flash-led-class.h new file +139 -0
139 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [PATCH v8 1/8] media: Add registration helpers for V4L2 flash sub-devices
Hi Jacek,
On Wed, May 20, 2015 at 04:10:08PM +0200, Jacek Anaszewski wrote:
...
Quoted 52 lines
drivers/media/v4l2-core/v4l2-flash-led-class.c new file +52
-0+struct v4l2_flash *v4l2_flash_init ( +struct device *dev,struct device_node *of_node, +struct led_classdev_flash *fled_cdev,const struct v4l2_flash_ops *ops, +struct v4l2_flash_config *config) +{ +struct v4l2_flash *v4l2_flash; +struct led_classdev *led_cdev = &fled_cdev->led_cdev; +struct v4l2_subdev *sd; +int ret; + +if (!fled_cdev || !ops || !config) +return ERR_PTR (-EINVAL ); + + v4l2_flash =devm_kzalloc (led_cdev->dev,sizeof (*v4l2_flash), +GFP_KERNEL ); +if (!v4l2_flash) +return ERR_PTR (-ENOMEM ); + + sd = &v4l2_flash->sd; + v4l2_flash->fled_cdev = fled_cdev; + v4l2_flash->ops = ops; + sd->dev = dev; + sd->of_node = of_node; +v4l2_subdev_init (sd, &v4l2_flash_subdev_ops); + sd->internal_ops = &v4l2_flash_subdev_internal_ops; + sd->flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; +strlcpy (sd->name, config->dev_name,sizeof (sd->name)); + + ret =media_entity_init (&sd->entity,0 ,NULL ,0 ); +if (ret <0 ) +return ERR_PTR (ret); + + sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_FLASH ; + + ret =v4l2_flash_init_controls (v4l2_flash, config); +if (ret <0 ) + goto err_init_controls; + +of_node_get (led_cdev->dev->of_node); + + ret =v4l2_async_register_subdev (sd); +if (ret <0 ) + goto err_async_register_sd; + +return v4l2_flash; + +err_async_register_sd: +of_node_put (led_cdev->dev->of_node); +v4l2_ctrl_handler_free (sd->ctrl_handler); +err_init_controls: +media_entity_cleanup (&sd->entity); +
drivers/media/v4l2-core/v4l2-flash-led-class.c line 640
Quoted 10 lines
drivers/media/v4l2-core/v4l2-flash-led-class.c new file +10
-0+return ERR_PTR (ret); +} +EXPORT_SYMBOL_GPL (v4l2_flash_init); + +void v4l2_flash_release (struct v4l2_flash *v4l2_flash) +{ +struct v4l2_subdev *sd; +struct led_classdev *led_cdev; + +if (IS_ERR (v4l2_flash))
I propose to use IS_ERR_OR_NULL() instead. Then this can be safely called without calling v4l2_flash_init() first, making error handling easier.
Quoted 11 lines
drivers/media/v4l2-core/v4l2-flash-led-class.c new file +11
-0+return ; + + sd = &v4l2_flash->sd; + led_cdev = &v4l2_flash->fled_cdev->led_cdev; + +v4l2_async_unregister_subdev (sd); +of_node_put (led_cdev->dev->of_node); +v4l2_ctrl_handler_free (sd->ctrl_handler); +media_entity_cleanup (&sd->entity); +} +EXPORT_SYMBOL_GPL (v4l2_flash_release);
...
Signature · 4 lines
Kind regards, Sakari Ailus e-mail: [email protected] XMPP: [email protected]
PATCH v8 2/8 leds: max77693: add support for V4L2 Flash sub-device
In reply to Jacek AnaszewskiAdd support for V4L2 Flash sub-device to the max77693 LED Flash class driver. The support allows for V4L2 Flash sub-device to take the control of the LED Flash class device.
--- drivers/leds/leds-max77693.c | 129 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 123 insertions(+), 6 deletions(-)
drivers/leds/leds-max77693.c +123 -6
@@ -20,6 +20,7 @@#include <linux/regmap.h> #include <linux/slab.h> #include <linux/workqueue.h> +#include <media/v4l2-flash-led-class.h> #define MODE_OFF 0#define MODE_FLASH (a) (1 << (a))
@@ -62,6 +63,8 @@ struct max77693_sub_led {struct led_classdev_flash fled_cdev;/* assures led-triggers compatibility */ struct work_struct work_brightness_set; +/* V4L2 Flash device */ +struct v4l2_flash *v4l2_flash;/* brightness cache */ unsigned int torch_brightness;
@@ -627,7 +630,8 @@ static int max77693_led_flash_timeout_set( }static int max77693_led_parse_dt (struct max77693_led_device *led, -struct max77693_led_config_data *cfg) +struct max77693_led_config_data *cfg, +struct device_node **sub_nodes) {struct device *dev = &led->pdev->dev;struct max77693_sub_led *sub_leds = led->sub_leds;
@@ -674,6 +678,13 @@ static int max77693_led_parse_dt(struct max77693_led_device *led,return -EINVAL ; } +if (sub_nodes[fled_id]) { +dev_err (dev, +"Conflicting \"led-sources\" DT properties\n" ); +return -EINVAL ; + } + + sub_nodes[fled_id] = child_node; sub_leds[fled_id].fled_id = fled_id; cfg->label[fled_id] =
@@ -786,11 +797,12 @@ static void max77693_led_validate_configuration(struct max77693_led_device *led, }static int max77693_led_get_configuration (struct max77693_led_device *led, -struct max77693_led_config_data *cfg) +struct max77693_led_config_data *cfg, +struct device_node **sub_nodes) {int ret; - ret =max77693_led_parse_dt (led, cfg); + ret =max77693_led_parse_dt (led, cfg, sub_nodes);if (ret <0 )return ret;
@@ -838,6 +850,71 @@ static void max77693_init_flash_settings(struct max77693_sub_led *sub_led, setting->val = setting->max; } +#if IS_ENABLED (CONFIG_V4L2_FLASH_LED_CLASS ) + +static int max77693_led_external_strobe_set ( +struct v4l2_flash *v4l2_flash, +bool enable) +{ +struct max77693_sub_led *sub_led = +flcdev_to_sub_led (v4l2_flash->fled_cdev); +struct max77693_led_device *led =sub_led_to_led (sub_led); +int fled_id = sub_led->fled_id; +int ret; + +mutex_lock (&led->lock); + +if (enable) + ret =max77693_add_mode (led,MODE_FLASH_EXTERNAL (fled_id)); +else + ret =max77693_clear_mode (led,MODE_FLASH_EXTERNAL (fled_id)); + +mutex_unlock (&led->lock); + +return ret; +} + +static void max77693_init_v4l2_flash_config (struct max77693_sub_led *sub_led, +struct max77693_led_config_data *led_cfg, +struct v4l2_flash_config *v4l2_sd_cfg) +{ +struct max77693_led_device *led =sub_led_to_led (sub_led); +struct device *dev = &led->pdev->dev; +struct max77693_dev *iodev =dev_get_drvdata (dev->parent); +struct i2c_client *i2c = iodev->i2c; +struct led_flash_setting *s; + +snprintf (v4l2_sd_cfg->dev_name,sizeof (v4l2_sd_cfg->dev_name), +"%s %d-%04x" , sub_led->fled_cdev.led_cdev.name, +i2c_adapter_id (i2c->adapter), i2c->addr); + + s = &v4l2_sd_cfg->intensity; + s->min =TORCH_IOUT_MIN ; + s->max = sub_led->fled_cdev.led_cdev.max_brightness *TORCH_IOUT_STEP ; + s->step =TORCH_IOUT_STEP ; + s->val = s->max; + +/* Init flash faults config */ + v4l2_sd_cfg->flash_faults =LED_FAULT_OVER_VOLTAGE | +LED_FAULT_SHORT_CIRCUIT | +LED_FAULT_OVER_CURRENT ; + + v4l2_sd_cfg->has_external_strobe = true; +} + +static const struct v4l2_flash_ops v4l2_flash_ops = { + .external_strobe_set = max77693_led_external_strobe_set, +}; +#else +static inline void max77693_init_v4l2_flash_config ( +struct max77693_sub_led *sub_led, +struct max77693_led_config_data *led_cfg, +struct v4l2_flash_config *v4l2_sd_cfg) +{ +} +static const struct v4l2_flash_ops v4l2_flash_ops; +#endif +static void max77693_init_fled_cdev (struct max77693_sub_led *sub_led,struct max77693_led_config_data *led_cfg) {
@@ -870,12 +947,45 @@ static void max77693_init_fled_cdev(struct max77693_sub_led *sub_led, sub_led->flash_timeout = fled_cdev->timeout.val; } +static int max77693_register_led (struct max77693_sub_led *sub_led, +struct max77693_led_config_data *led_cfg, +struct device_node *sub_node) +{ +struct max77693_led_device *led =sub_led_to_led (sub_led); +struct led_classdev_flash *fled_cdev = &sub_led->fled_cdev; +struct device *dev = &led->pdev->dev; +struct v4l2_flash_config v4l2_sd_cfg = {}; +int ret; + +/* Register in the LED subsystem */ + ret =led_classdev_flash_register (dev, fled_cdev); +if (ret <0 ) +return ret; + +max77693_init_v4l2_flash_config (sub_led, led_cfg, &v4l2_sd_cfg); + +/* Register in the V4L2 subsystem. */ + sub_led->v4l2_flash =v4l2_flash_init (dev, sub_node, fled_cdev, + &v4l2_flash_ops, &v4l2_sd_cfg); +if (IS_ERR (sub_led->v4l2_flash)) { + ret =PTR_ERR (sub_led->v4l2_flash); + goto err_v4l2_flash_init; + } + +return 0 ; + +err_v4l2_flash_init: +led_classdev_flash_unregister (fled_cdev); +return ret; +} +static int max77693_led_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;struct max77693_dev *iodev =dev_get_drvdata (dev->parent);struct max77693_led_device *led;struct max77693_sub_led *sub_leds; +struct device_node *sub_nodes[2 ] = {};struct max77693_led_config_data led_cfg = {};int init_fled_cdev[2 ], i, ret;
@@ -889,7 +999,7 @@ static int max77693_led_probe(struct platform_device *pdev) sub_leds = led->sub_leds;platform_set_drvdata (pdev, led); - ret =max77693_led_get_configuration (led, &led_cfg); + ret =max77693_led_get_configuration (led, &led_cfg, sub_nodes);if (ret <0 )return ret;
@@ -911,8 +1021,12 @@ static int max77693_led_probe(struct platform_device *pdev)/* Initialize LED Flash class device */ max77693_init_fled_cdev (&sub_leds[i], &led_cfg); -/* Register LED Flash class device */ - ret =led_classdev_flash_register (dev, &sub_leds[i].fled_cdev); +/* +* Register LED Flash class device and corresponding +* V4L2 Flash device. +*/ + ret =max77693_register_led (&sub_leds[i], &led_cfg, + sub_nodes[i]);if (ret <0 ) {/* * At this moment FLED1 might have been already
@@ -931,6 +1045,7 @@ err_register_led2:/* It is possible than only FLED2 was to be registered */ if (!init_fled_cdev[FLED1 ]) goto err_register_led1; +v4l2_flash_release (sub_leds[FLED1 ].v4l2_flash);led_classdev_flash_unregister (&sub_leds[FLED1 ].fled_cdev); err_register_led1:mutex_destroy (&led->lock);
@@ -944,11 +1059,13 @@ static int max77693_led_remove(struct platform_device *pdev)struct max77693_sub_led *sub_leds = led->sub_leds;if (led->iout_joint ||max77693_fled_used (led,FLED1 )) { +v4l2_flash_release (sub_leds[FLED1 ].v4l2_flash);led_classdev_flash_unregister (&sub_leds[FLED1 ].fled_cdev);cancel_work_sync (&sub_leds[FLED1 ].work_brightness_set); }if (!led->iout_joint &&max77693_fled_used (led,FLED2 )) { +v4l2_flash_release (sub_leds[FLED2 ].v4l2_flash);led_classdev_flash_unregister (&sub_leds[FLED2 ].fled_cdev);cancel_work_sync (&sub_leds[FLED2 ].work_brightness_set); }
Signature · 1 line
1.7.9.5
Re: [PATCH v8 2/8] leds: max77693: add support for V4L2 Flash sub-device
Quoted 9 lines · Jacek Anaszewski
Add support for V4L2 Flash sub-device to the max77693 LED Flash class driver. The support allows for V4L2 Flash sub-device to take the control of the LED Flash class device.
Signed-off-by Jacek Anaszewski <[email protected]>Acked-by Kyungmin Park <[email protected]>Cc Bryan Wu <[email protected]>Cc Richard Purdie <[email protected]>Cc Sakari Ailus <[email protected]>
Signature · 2 lines
Sakari Ailus e-mail: [email protected] XMPP: [email protected]
Re: [PATCH v8 2/8] leds: max77693: add support for V4L2 Flash sub-device
In reply to Jacek AnaszewskiQuoted 9 lines · Jacek Anaszewski
Add support for V4L2 Flash sub-device to the max77693 LED Flash class driver. The support allows for V4L2 Flash sub-device to take the control of the LED Flash class device.
Signed-off-by Jacek Anaszewski <[email protected]>Acked-by Kyungmin Park <[email protected]>Cc Bryan Wu <[email protected]>Cc Richard Purdie <[email protected]>Cc Sakari Ailus <[email protected]>
Signature · 2 lines
Sakari Ailus e-mail: [email protected] XMPP: [email protected]
PATCH v8 3/8 DT: aat1290: Document handling external strobe sources
In reply to Jacek AnaszewskiThis patch adds documentation for a pinctrl-names property. The property, when present, is used for switching the source of the strobe signal for the device.
--- .../devicetree/bindings/leds/leds-aat1290.txt | 36 ++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/leds/leds-aat1290.txt +34 -2
@@ -2,7 +2,9 @@ The device is controlled through two pins: FL_EN and EN_SET. The pins when, asserted high, enable flash strobe and movie mode (max 1/2 of flash current) -respectively. +respectively. In order to add a capability of selecting the strobe signal source +(e.g. CPU or camera sensor) there is an additional switch required, independent +of the flash chip. The switch is controlled with pin control. Required properties:
@@ -10,6 +12,13 @@ Required properties: - flen-gpios : Must be device tree identifier of the flash device FL_EN pin. - enset-gpios : Must be device tree identifier of the flash device EN_SET pin. +Optional properties: +- pinctrl-names : Must contain entries: "default", "host", "isp". Entries + "default" and "host" must refer to the same pin configuration + node, which sets the host as a strobe signal provider. Entry + "isp" must refer to the pin configuration node, which sets the + ISP as a strobe signal provider. + A discrete LED element connected to the device must be represented by a child node - see Documentation/devicetree/bindings/leds/common.txt.
@@ -25,13 +34,22 @@ Required properties of the LED child node: Optional properties of the LED child node: - label : see Documentation/devicetree/bindings/leds/common.txt -Example (by Ct = 220nF, Rset = 160kohm): +Example (by Ct = 220nF, Rset = 160kohm and exynos4412-trats2 board with +a switch that allows for routing strobe signal either from the host or from +the camera sensor): + +#include "exynos4412.dtsi" aat1290 { compatible = "skyworks,aat1290"; flen-gpios = <&gpj1 1 GPIO_ACTIVE_HIGH>; enset-gpios = <&gpj1 2 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default", "host", "isp"; + pinctrl-0 = <&camera_flash_host>; + pinctrl-1 = <&camera_flash_host>; + pinctrl-2 = <&camera_flash_isp>; + camera_flash: flash-led { label = "aat1290-flash"; led-max-microamp = <520833>;
@@ -39,3 +57,17 @@ aat1290 { flash-timeout-us = <1940000>; }; }; + +&pinctrl_0 { + camera_flash_host: camera-flash-host { + samsung,pins = "gpj1-0"; + samsung,pin-function = <1>; + samsung,pin-val = <0>; + }; + + camera_flash_isp: camera-flash-isp { + samsung,pins = "gpj1-0"; + samsung,pin-function = <1>; + samsung,pin-val = <1>; + }; +};
Signature · 1 line
1.7.9.5
PATCH v8 4/8 leds: aat1290: add support for V4L2 Flash sub-device
In reply to Jacek AnaszewskiAdd support for V4L2 Flash sub-device to the aat1290 LED Flash class driver. The support allows for V4L2 Flash sub-device to take the control of the LED Flash class device.
--- drivers/leds/Kconfig | 1 + drivers/leds/leds-aat1290.c | 137 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 132 insertions(+), 6 deletions(-)
drivers/leds/Kconfig +1 -0
@@ -47,6 +47,7 @@ config LEDS_AAT1290 depends on LEDS_CLASS_FLASH depends on GPIOLIB depends on OF + depends on PINCTRL help This option enables support for the LEDs on the AAT1290.
drivers/leds/leds-aat1290.c +131 -6
237 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v8 5/8 exynos4-is: Add support for v4l2-flash subdevs
In reply to Jacek AnaszewskiThis patch adds support for external v4l2-flash devices. The support includes parsing "samsung,flash-led" DT property and asynchronous subdevice registration.
--- drivers/media/platform/exynos4-is/media-dev.c | 39 +++++++++++++++++++++++-- drivers/media/platform/exynos4-is/media-dev.h | 13 ++++++++- 2 files changed, 49 insertions(+), 3 deletions(-)
drivers/media/platform/exynos4-is/media-dev.c +37 -2
@@ -451,6 +451,28 @@ rpm_put:return ret; } +static void fimc_md_register_flash_entities (struct fimc_md *fmd) +{ +int i; + + fmd->num_flashes =0 ; + +for (i =0 ; i < fmd->num_sensors; i++) { +const struct device_node *np = + fmd->sensor[i].asd.match.of.node; +const int nf = fmd->num_flashes; + + np =of_parse_phandle (np,"samsung,flash-led" ,0 ); +if (!np) +continue ; + + fmd->flash[nf].asd.match_type =V4L2_ASYNC_MATCH_OF ; + fmd->flash[nf].asd.match.of.node = np; + fmd->async_subdevs[fmd->num_sensors + nf] = &fmd->flash[nf].asd; + fmd->num_flashes++; + } +} +static int __of_get_csis_id (struct device_node *np) {u32 reg =0 ;
@@ -1275,6 +1297,15 @@ static int subdev_notifier_bound(struct v4l2_async_notifier *notifier,struct fimc_sensor_info *si =NULL ;int i; +/* Register flash subdev if detected any */ +for (i =0 ; i <ARRAY_SIZE (fmd->flash); i++) { +if (fmd->flash[i].asd.match.of.node == subdev->of_node) { + fmd->flash[i].subdev = subdev; + fmd->num_flashes++; +return 0 ; + } + } +/* Find platform data for this sensor subdev */ for (i =0 ; i <ARRAY_SIZE (fmd->sensor); i++)if (fmd->sensor[i].asd.match.of.node == subdev->dev->of_node)
@@ -1385,6 +1416,8 @@ static int fimc_md_probe(struct platform_device *pdev) goto err_m_ent; } +fimc_md_register_flash_entities (fmd); +mutex_unlock (&fmd->media_dev.graph_mutex); ret =device_create_file (&pdev->dev, &dev_attr_subdev_conf_mode);
@@ -1401,12 +1434,14 @@ static int fimc_md_probe(struct platform_device *pdev) goto err_attr; } -if (fmd->num_sensors >0 ) { +if (fmd->num_sensors >0 || fmd->num_flashes >0 ) { fmd->subdev_notifier.subdevs = fmd->async_subdevs; - fmd->subdev_notifier.num_subdevs = fmd->num_sensors; + fmd->subdev_notifier.num_subdevs = fmd->num_sensors + + fmd->num_flashes; fmd->subdev_notifier.bound = subdev_notifier_bound; fmd->subdev_notifier.complete = subdev_notifier_complete; fmd->num_sensors =0 ; + fmd->num_flashes =0 ; ret =v4l2_async_notifier_register (&fmd->v4l2_dev, &fmd->subdev_notifier);
drivers/media/platform/exynos4-is/media-dev.h +12 -1
@@ -34,6 +34,8 @@#define FIMC_MAX_SENSORS 4#define FIMC_MAX_CAMCLKS 2 +#define FIMC_MAX_FLASHES 4 +#define FIMC_MAX_ASYNC_SUBDEVS (FIMC_MAX_SENSORS + FIMC_MAX_FLASHES)#define DEFAULT_SENSOR_CLK_FREQ 24000000U/* LCD/ISP Writeback clocks (PIXELASYNCMx) */
@@ -93,6 +95,11 @@ struct fimc_sensor_info {struct fimc_dev *host; }; +struct fimc_flash_info { +struct v4l2_subdev *subdev; +struct v4l2_async_subdev asd; +}; +struct cam_clk {struct clk_hw hw;struct fimc_md *fmd;
@@ -104,6 +111,8 @@ struct cam_clk {* @csis: MIPI CSIS subdevs data * @sensor: array of registered sensor subdevs * @num_sensors: actual number of registered sensors +* @flash: array of registered flash subdevs +* @num_flashes: actual number of registered flashes * @camclk: external sensor clock information * @fimc: array of registered fimc devices * @fimc_is: fimc-is data structure
@@ -123,6 +132,8 @@ struct fimc_md {struct fimc_csis_info csis[CSIS_MAX_ENTITIES ];struct fimc_sensor_info sensor[FIMC_MAX_SENSORS ];int num_sensors; +struct fimc_flash_info flash[FIMC_MAX_FLASHES ]; +int num_flashes;struct fimc_camclk_info camclk[FIMC_MAX_CAMCLKS ];struct clk *wbclk[FIMC_MAX_WBCLKS ];struct fimc_lite *fimc_lite[FIMC_LITE_MAX_DEVS ];
@@ -149,7 +160,7 @@ struct fimc_md { } clk_provider;struct v4l2_async_notifier subdev_notifier; -struct v4l2_async_subdev *async_subdevs[FIMC_MAX_SENSORS ]; +struct v4l2_async_subdev *async_subdevs[FIMC_MAX_ASYNC_SUBDEVS ];bool user_subdev_api;spinlock_t slock;
Signature · 1 line
1.7.9.5
Re: [PATCH v8 5/8] exynos4-is: Add support for v4l2-flash subdevs
Hi Jacek,
Quoted 46 lines · Jacek Anaszewski
This patch adds support for external v4l2-flash devices. The support includes parsing "samsung,flash-led" DT property and asynchronous subdevice registration.
Signed-off-by Jacek Anaszewski <[email protected]>Acked-by Kyungmin Park <[email protected]>Cc Sylwester Nawrocki <[email protected]>--- drivers/media/platform/exynos4-is/media-dev.c | 39 +++++++++++++++++++++++-- drivers/media/platform/exynos4-is/media-dev.h | 13 ++++++++- 2 files changed, 49 insertions(+), 3 deletions(-)drivers/media/platform/exynos4-is/media-dev.c +22
-0@@ -451,6 +451,28 @@ rpm_put:return ret; } +static void fimc_md_register_flash_entities (struct fimc_md *fmd) +{ +int i; + + fmd->num_flashes =0 ; + +for (i =0 ; i < fmd->num_sensors; i++) { +const struct device_node *np = + fmd->sensor[i].asd.match.of.node; +const int nf = fmd->num_flashes; + + np =of_parse_phandle (np,"samsung,flash-led" ,0 ); +if (!np) +continue ; + + fmd->flash[nf].asd.match_type =V4L2_ASYNC_MATCH_OF ; + fmd->flash[nf].asd.match.of.node = np; + fmd->async_subdevs[fmd->num_sensors + nf] = &fmd->flash[nf].asd; + fmd->num_flashes++; + } +} +static int __of_get_csis_id (struct device_node *np) {u32 reg =0 ;
drivers/media/platform/exynos4-is/media-dev.c static int subdev_notifier_bound(struct v4l2_async_notifier *notifier, · line 1302
Quoted 6 lines
drivers/media/platform/exynos4-is/media-dev.c +3
-0@@ -1275,6 +1297,15 @@ static int subdev_notifier_bound(struct v4l2_async_notifier *notifier,struct fimc_sensor_info *si =NULL ;int i; +/* Register flash subdev if detected any */ +for (i =0 ; i <ARRAY_SIZE (fmd->flash); i++) { +if (fmd->flash[i].asd.match.of.node == subdev->of_node) {
Does the index of a particular sub-device index matter? Could you just use the next available one?
There would be no need to for the check anything here, please see how the omap3isp driver does it --- it's in isp_subdev_notifier_bound() drivers/media/platform/omap3isp/isp.c .
Quoted 9 lines
drivers/media/platform/exynos4-is/media-dev.c +6
-0+ fmd->flash[i].subdev = subdev; + fmd->num_flashes++; +return 0 ; + } + } +/* Find platform data for this sensor subdev */ for (i =0 ; i <ARRAY_SIZE (fmd->sensor); i++)if (fmd->sensor[i].asd.match.of.node == subdev->dev->of_node)
Signature · 4 lines
Kind regards, Sakari Ailus e-mail: [email protected] XMPP: [email protected]
Re: [PATCH v8 5/8] exynos4-is: Add support for v4l2-flash subdevs
Quoted 52 lines · Sakari Ailus
Hi Jacek,
Quoted 49 lines · Jacek Anaszewski
This patch adds support for external v4l2-flash devices. The support includes parsing "samsung,flash-led" DT property and asynchronous subdevice registration.
Signed-off-by Jacek Anaszewski <[email protected]>Acked-by Kyungmin Park <[email protected]>Cc Sylwester Nawrocki <[email protected]>--- drivers/media/platform/exynos4-is/media-dev.c | 39 +++++++++++++++++++++++-- drivers/media/platform/exynos4-is/media-dev.h | 13 ++++++++- 2 files changed, 49 insertions(+), 3 deletions(-)drivers/media/platform/exynos4-is/media-dev.c +22
-0@@ -451,6 +451,28 @@ rpm_put:return ret; } +static void fimc_md_register_flash_entities (struct fimc_md *fmd) +{ +int i; + + fmd->num_flashes =0 ; + +for (i =0 ; i < fmd->num_sensors; i++) { +const struct device_node *np = + fmd->sensor[i].asd.match.of.node; +const int nf = fmd->num_flashes; + + np =of_parse_phandle (np,"samsung,flash-led" ,0 ); +if (!np) +continue ; + + fmd->flash[nf].asd.match_type =V4L2_ASYNC_MATCH_OF ; + fmd->flash[nf].asd.match.of.node = np; + fmd->async_subdevs[fmd->num_sensors + nf] = &fmd->flash[nf].asd; + fmd->num_flashes++; + } +} +static int __of_get_csis_id (struct device_node *np) {u32 reg =0 ;@@ -1275,6 +1297,15 @@ static int subdev_notifier_bound(struct v4l2_async_notifier *notifier,struct fimc_sensor_info *si =NULL ;int i;
Quoted 6 lines
drivers/media/platform/exynos4-is/media-dev.c static int subdev_notifier_bound(struct v4l2_async_notifier *notifier, · line 1302
Quoted 3 lines
drivers/media/platform/exynos4-is/media-dev.c +3
-0+/* Register flash subdev if detected any */ +for (i =0 ; i <ARRAY_SIZE (fmd->flash); i++) { +if (fmd->flash[i].asd.match.of.node == subdev->of_node) {Does the index of a particular sub-device index matter? Could you just use the next available one?
Having the positions of sensor sub-devices kept in synch with the positions of associated flash sub-devices in the 'flash' array allows to avoid the addition o a condition for checking if the element of the flash array is available.
Quoted 3 lines
There would be no need to for the check anything here, please see how the omap3isp driver does it --- it's in
isp_subdev_notifier_bound()drivers/media/platform/omap3isp/isp.c.
This 'for' loop allows to detect that the sub-device being bound is of flash type and basing on that we can exit the function at this point. Otherwise some guards would have to be added in the remaining part of the function.
Quoted 10 lines
Quoted 9 lines
drivers/media/platform/exynos4-is/media-dev.c +6
-0+ fmd->flash[i].subdev = subdev; + fmd->num_flashes++; +return 0 ; + } + } +/* Find platform data for this sensor subdev */ for (i =0 ; i <ARRAY_SIZE (fmd->sensor); i++)if (fmd->sensor[i].asd.match.of.node == subdev->dev->of_node)
Signature · 2 lines
Best Regards, Jacek Anaszewski
Re: [PATCH v8 5/8] exynos4-is: Add support for v4l2-flash subdevs
Hi Jacek,
Quoted 67 lines · Jacek Anaszewski
Quoted 52 lines · Sakari Ailus
Hi Jacek,
Quoted 49 lines · Jacek Anaszewski
This patch adds support for external v4l2-flash devices. The support includes parsing "samsung,flash-led" DT property and asynchronous subdevice registration.
Signed-off-by Jacek Anaszewski <[email protected]>Acked-by Kyungmin Park <[email protected]>Cc Sylwester Nawrocki <[email protected]>--- drivers/media/platform/exynos4-is/media-dev.c | 39 +++++++++++++++++++++++-- drivers/media/platform/exynos4-is/media-dev.h | 13 ++++++++- 2 files changed, 49 insertions(+), 3 deletions(-)drivers/media/platform/exynos4-is/media-dev.c +22
-0@@ -451,6 +451,28 @@ rpm_put:return ret; } +static void fimc_md_register_flash_entities (struct fimc_md *fmd) +{ +int i; + + fmd->num_flashes =0 ; + +for (i =0 ; i < fmd->num_sensors; i++) { +const struct device_node *np = + fmd->sensor[i].asd.match.of.node; +const int nf = fmd->num_flashes; + + np =of_parse_phandle (np,"samsung,flash-led" ,0 ); +if (!np) +continue ; + + fmd->flash[nf].asd.match_type =V4L2_ASYNC_MATCH_OF ; + fmd->flash[nf].asd.match.of.node = np; + fmd->async_subdevs[fmd->num_sensors + nf] = &fmd->flash[nf].asd; + fmd->num_flashes++; + } +} +static int __of_get_csis_id (struct device_node *np) {u32 reg =0 ;@@ -1275,6 +1297,15 @@ static int subdev_notifier_bound(struct v4l2_async_notifier *notifier,struct fimc_sensor_info *si =NULL ;int i;Quoted 6 lines
drivers/media/platform/exynos4-is/media-dev.c static int subdev_notifier_bound(struct v4l2_async_notifier *notifier, · line 1302
Quoted 3 lines
drivers/media/platform/exynos4-is/media-dev.c +3
-0+/* Register flash subdev if detected any */ +for (i =0 ; i <ARRAY_SIZE (fmd->flash); i++) { +if (fmd->flash[i].asd.match.of.node == subdev->of_node) {Does the index of a particular sub-device index matter? Could you just use the next available one?
Having the positions of sensor sub-devices kept in synch with the positions of associated flash sub-devices in the 'flash' array allows to avoid the addition o a condition for checking if the element of the flash array is available.
Quoted 8 lines
Quoted 3 lines
There would be no need to for the check anything here, please see how the omap3isp driver does it --- it's in
isp_subdev_notifier_bound()drivers/media/platform/omap3isp/isp.c.This 'for' loop allows to detect that the sub-device being bound is of flash type and basing on that we can exit the function at this point. Otherwise some guards would have to be added in the remaining part of the function.
You have that information in fimc_md_register_flash_entities() but you're not storing that. A common struct for all async sub-device would help. I think you could associate sensors to flashes the same way.
Signature · 4 lines
Regards, Sakari Ailus e-mail: [email protected] XMPP: [email protected]
PATCH v8 6/8 DT: s5c73m3: Add documentation for samsung,flash-led property
In reply to Jacek AnaszewskiThis patch adds a description of 'samsung,flash-led' property to the samsung-s5c73m3.txt.
--- .../devicetree/bindings/media/samsung-s5c73m3.txt | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/media/samsung-s5c73m3.txt +5 -0
@@ -32,6 +32,10 @@ Optional properties: - clock-frequency : the frequency at which the "cis_extclk" clock should be configured to operate, in Hz; if this property is not specified default 24 MHz value will be used. +- samsung,flash-led : phandle to the flash LED associated with this sensor. + Flash LED is represented by the child node of a flash LED + device + (see Documentation/devicetree/bindings/leds/common.txt). The common video interfaces bindings (see video-interfaces.txt) should be used to specify link from the S5C73M3 to an external image data receiver. The S5C73M3
@@ -78,6 +82,7 @@ i2c@138A000000 { clock-names = "cis_extclk"; reset-gpios = <&gpf1 3 1>; standby-gpios = <&gpm0 1 1>; + samsung,flash-led = <&camera1_flash>; port { s5c73m3_ep: endpoint { remote-endpoint = <&csis0_ep>;
Signature · 1 line
1.7.9.5
PATCH v8 7/8 DT: s5k6a3: Add documentation for samsung,flash-led property
In reply to Jacek AnaszewskiThis patch adds a description of 'samsung,flash-led' property to the samsung-s5k6a3.txt.
--- .../devicetree/bindings/media/samsung-s5k6a3.txt | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/media/samsung-s5k6a3.txt +4 -0
@@ -22,6 +22,10 @@ Optional properties: - clock-frequency : the frequency at which the "extclk" clock should be configured to operate, in Hz; if this property is not specified default 24 MHz value will be used. +- samsung,flash-led : phandle to the flash LED associated with this sensor. + Flash LED is represented by the child node of a flash LED + device + (see Documentation/devicetree/bindings/leds/common.txt). The common video interfaces bindings (see video-interfaces.txt) should be used to specify link to the image data receiver. The S5K6A3(YX) device
Signature · 1 line
1.7.9.5
PATCH v8 8/8 DT: samsung-fimc: Add examples for samsung,flash-led property
In reply to Jacek AnaszewskiThis patch adds examples for samsung,flash-led property to the samsung-fimc.txt.
--- .../devicetree/bindings/media/samsung-fimc.txt | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/media/samsung-fimc.txt +4 -0
@@ -126,6 +126,8 @@ Example: clocks = <&camera 1>; clock-names = "mclk"; + samsung,flash-led = <&front_cam_flash>; + port { s5k6aa_ep: endpoint { remote-endpoint = <&fimc0_ep>;
@@ -147,6 +149,8 @@ Example: clocks = <&camera 0>; clock-names = "mclk"; + samsung,flash-led = <&rear_cam_flash>; + port { s5c73m3_1: endpoint { data-lanes = <1 2 3 4>;
Signature · 1 line
1.7.9.5
Re: [PATCH v8 8/8] DT: samsung-fimc: Add examples for samsung,flash-led property
Hi Jacek,
Quoted 25 lines · Jacek Anaszewski
This patch adds examples for samsung,flash-led property to the samsung-fimc.txt.
Signed-off-by Jacek Anaszewski <[email protected]>Acked-by Kyungmin Park <[email protected]>Cc Sylwester Nawrocki <[email protected]>--- .../devicetree/bindings/media/samsung-fimc.txt | 4 ++++ 1 file changed, 4 insertions(+)Documentation/devicetree/bindings/media/samsung-fimc.txt +2
-0@@ -126,6 +126,8 @@ Example: clocks = <&camera 1>; clock-names = "mclk"; + samsung,flash-led = <&front_cam_flash>; + port { s5k6aa_ep: endpoint { remote-endpoint = <&fimc0_ep>;
Documentation/devicetree/bindings/media/samsung-fimc.txt Example: · line 156
Quoted 8 lines
Documentation/devicetree/bindings/media/samsung-fimc.txt +2
-0@@ -147,6 +149,8 @@ Example: clocks = <&camera 0>; clock-names = "mclk"; + samsung,flash-led = <&rear_cam_flash>; + port { s5c73m3_1: endpoint { data-lanes = <1 2 3 4>;
Oops. I missed this property would have ended to the sensor's DT node. I don't think we should have properties here that are parsed by another driver --- let's discuss this tomorrow.
There are two main options that I can think of --- either put the property under the bridge (ISP) driver's device node as a temporary solution that works on a few ISP drivers, or think how sensor modules should be modelled, in which case we'd have some idea how lens device would be taken into account.
Cc Sebastian.
Signature · 4 lines
Kind regards, Sakari Ailus e-mail: [email protected] XMPP: [email protected]
Re: [PATCH v8 8/8] DT: samsung-fimc: Add examples for samsung,flash-led property
Hi Sakari,
Quoted 31 lines · Sakari Ailus
Hi Jacek,
Quoted 28 lines · Jacek Anaszewski
This patch adds examples for samsung,flash-led property to the samsung-fimc.txt.
Signed-off-by Jacek Anaszewski <[email protected]>Acked-by Kyungmin Park <[email protected]>Cc Sylwester Nawrocki <[email protected]>--- .../devicetree/bindings/media/samsung-fimc.txt | 4 ++++ 1 file changed, 4 insertions(+)Documentation/devicetree/bindings/media/samsung-fimc.txt +2
-0@@ -126,6 +126,8 @@ Example: clocks = <&camera 1>; clock-names = "mclk"; + samsung,flash-led = <&front_cam_flash>; + port { s5k6aa_ep: endpoint { remote-endpoint = <&fimc0_ep>;@@ -147,6 +149,8 @@ Example: clocks = <&camera 0>; clock-names = "mclk";
Quoted 9 lines
Documentation/devicetree/bindings/media/samsung-fimc.txt Example: · line 156
Quoted 5 lines
Documentation/devicetree/bindings/media/samsung-fimc.txt +2
-0+ samsung,flash-led = <&rear_cam_flash>; + port { s5c73m3_1: endpoint { data-lanes = <1 2 3 4>;Oops. I missed this property would have ended to the sensor's DT node. I don't think we should have properties here that are parsed by another driver --- let's discuss this tomorrow.
exynos4-is driver already parses sensor nodes (at least their 'port' sub-nodes).
Quoted 8 lines
There are two main options that I can think of --- either put the property under the bridge (ISP) driver's device node as a temporary solution that works on a few ISP drivers, or think how sensor modules should be modelled, in which case we'd have some idea how lens device would be taken into account.
Cc Sebastian.
Signature · 2 lines
Best Regards, Jacek Anaszewski
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v8 8/8] DT: samsung-fimc: Add examples for samsung,flash-led property
Hi Jacek,
Quoted 44 lines · Jacek Anaszewski
Hi Sakari,
Quoted 31 lines · Sakari Ailus
Hi Jacek,
Quoted 28 lines · Jacek Anaszewski
This patch adds examples for samsung,flash-led property to the samsung-fimc.txt.
Signed-off-by Jacek Anaszewski <[email protected]>Acked-by Kyungmin Park <[email protected]>Cc Sylwester Nawrocki <[email protected]>--- .../devicetree/bindings/media/samsung-fimc.txt | 4 ++++ 1 file changed, 4 insertions(+)Documentation/devicetree/bindings/media/samsung-fimc.txt +2
-0@@ -126,6 +126,8 @@ Example: clocks = <&camera 1>; clock-names = "mclk"; + samsung,flash-led = <&front_cam_flash>; + port { s5k6aa_ep: endpoint { remote-endpoint = <&fimc0_ep>;@@ -147,6 +149,8 @@ Example: clocks = <&camera 0>; clock-names = "mclk";Quoted 9 lines
Documentation/devicetree/bindings/media/samsung-fimc.txt Example: · line 156
Quoted 5 lines
Documentation/devicetree/bindings/media/samsung-fimc.txt +2
-0+ samsung,flash-led = <&rear_cam_flash>; + port { s5c73m3_1: endpoint { data-lanes = <1 2 3 4>;Oops. I missed this property would have ended to the sensor's DT node. I don't think we should have properties here that are parsed by another driver --- let's discuss this tomorrow.
Quoted 2 lines
exynos4-is driver already parses sensor nodes (at least their 'port' sub-nodes).
If you read the code and the comment, it looks like something that should be done better but hasn't been done yet. :-) That's something we should avoid. Also, flash devices are by far more common than external ISPs I presume.
Signature · 8 lines
Regards, Sakari Ailus e-mail: [email protected] XMPP: [email protected] -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v8 8/8] DT: samsung-fimc: Add examples for samsung,flash-led property
Quoted 14 lines · Sakari Ailus
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
(quoted diff) +0
-0@@ -147,6 +149,8 @@ Example: > >> clocks = <&camera 0>; > >> clock-names = "mclk";Quoted 10 lines
Quoted 6 lines
Documentation/devicetree/bindings/media/samsung-fimc.txt Example: · line 156
Quoted 6 lines
Documentation/devicetree/bindings/media/samsung-fimc.txt +2
-0+ samsung,flash-led = <&rear_cam_flash>; + port { s5c73m3_1: endpoint { data-lanes = <1 2 3 4>;Oops. I missed this property would have ended to the sensor's DT node. I don't think we should have properties here that are parsed by another driver --- let's discuss this tomorrow.
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
exynos4-is driver already parses sensor nodes (at least their 'port' sub-nodes).
If you read the code and the comment, it looks like something that should be done better but hasn't been done yet. :-) That's something we should avoid. Also, flash devices are by far more common than external ISPs I presume.
Yes, especially let's not require any samsung specific properties in other vendors' sensor bindings.
One way of modelling [flash led]/[image sensor] association I imagine would be to put, e.g. 'flash-leds' property in the SoC camera host interface/ISP DT node. This property would then contain pairs of phandles, first to the led node and the second to the sensor node, e.g.
i2c_controller {
...
flash_xx@NN {
...
led_a {
...
}
};
image_sensor_x@NN {
...
};
};flash-leds = <&flash_xx &image_sensor_x>, <...>;
For the purpose of this patch set presumably just samsung specific property name could be used (i.e. samsung,flash-leds).
--
Thanks,
Sylwester
Re: [PATCH v8 8/8] DT: samsung-fimc: Add examples for samsung,flash-led property
Hi Sylwester,
Quoted 44 lines · Sylwester Nawrocki
Quoted 14 lines · Sakari Ailus
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
(quoted diff) +0
-0@@ -147,6 +149,8 @@ Example: > >> clocks = <&camera 0>; > >> clock-names = "mclk";Quoted 10 lines
Quoted 6 lines
Documentation/devicetree/bindings/media/samsung-fimc.txt Example: · line 156
Quoted 6 lines
Documentation/devicetree/bindings/media/samsung-fimc.txt +2
-0+ samsung,flash-led = <&rear_cam_flash>; + port { s5c73m3_1: endpoint { data-lanes = <1 2 3 4>;Oops. I missed this property would have ended to the sensor's DT node. I don't think we should have properties here that are parsed by another driver --- let's discuss this tomorrow.
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
exynos4-is driver already parses sensor nodes (at least their 'port' sub-nodes).
If you read the code and the comment, it looks like something that should be done better but hasn't been done yet. :-) That's something we should avoid. Also, flash devices are by far more common than external ISPs I presume.
Yes, especially let's not require any samsung specific properties in other vendors' sensor bindings.
One way of modelling [flash led]/[image sensor] association I imagine would be to put, e.g. 'flash-leds' property in the SoC camera host interface/ISP DT node. This property would then contain pairs of phandles, first to the led node and the second to the sensor node, e.g.
i2c_controller { ... flash_xx@NN { ... led_a { ... } }; image_sensor_x@NN { ... }; };
Quoted 1 line
flash-leds = <
&flash_xx&image_sensor_x>, <...>;
Maybe a stupid question, but how do you access this in a driver? I have to admit I'm no DT expert.
Quoted 3 lines
For the purpose of this patch set presumably just samsung specific property name could be used (i.e. samsung,flash-leds).
I agree. I'll add similar support for the omap3isp driver in the near future though. Let's see how the camera modules will get modelled, if they will, and if this property still fits to the picture by that time, then we make it more generic.
What do you think?
Signature · 4 lines
Kind regards, Sakari Ailus e-mail: [email protected] XMPP: [email protected]
Re: [PATCH v8 8/8] DT: samsung-fimc: Add examples for samsung,flash-led property
Hi Sakari,
Quoted 45 lines · Sakari Ailus
Quoted 44 lines · Sylwester Nawrocki
Quoted 44 lines · Sakari Ailus
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Quoted 13 lines
(quoted diff) +0
-0@@ -147,6 +149,8 @@ Example: >>> > >> clocks = <&camera 0>; >>> > >> clock-names = "mclk";Quoted 10 lines
Quoted 10 lines
+ samsung,flash-led = <&rear_cam_flash>;
+
port {
s5c73m3_1: endpoint {
data-lanes = <1 2 3 4>;Oops. I missed this property would have ended to the sensor's DT node. I
don't think we should have properties here that are parsed by another
driver --- let's discuss this tomorrow.Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
exynos4-is driver already parses sensor nodes (at least their 'port' sub-nodes).
If you read the code and the comment, it looks like something that should be done better but hasn't been done yet. :-) That's something we should avoid. Also, flash devices are by far more common than external ISPs I presume.
Yes, especially let's not require any samsung specific properties in other vendors' sensor bindings.
One way of modelling [flash led]/[image sensor] association I imagine would be to put, e.g. 'flash-leds' property in the SoC camera host interface/ISP DT node. This property would then contain pairs of phandles, first to the led node and the second to the sensor node, e.g.
i2c_controller { ... flash_xx@NN { ... led_a { ... } }; image_sensor_x@NN { ... }; };
Quoted 4 lines
Quoted 1 line
Quoted 1 line
flash-leds = <
&flash_xx&image_sensor_x>, <...>;Maybe a stupid question, but how do you access this in a driver? I have to admit I'm no DT expert.
You could get of_node pointers with of_parse_phandle() call and then lookup related flash and sensor devices based on that.
Quoted 9 lines
Quoted 2 lines
Quoted 2 lines
For the purpose of this patch set presumably just samsung specific property name could be used (i.e. samsung,flash-leds).
I agree. I'll add similar support for the omap3isp driver in the near future though. Let's see how the camera modules will get modelled, if they will, and if this property still fits to the picture by that time, then we make it more generic.
What do you think?
I think we could do that, perhaps we could get some more opinions and use generic name already in this series? I'm not sure what are exact plans for this series, I guess it is targeted for 4.2?
Signature · 2 lines
Regards, Sylwester
Re: [PATCH v8 8/8] DT: samsung-fimc: Add examples for samsung,flash-led property
Hi Sylwester,
Quoted 48 lines · Sylwester Nawrocki
Hi Sakari,
Quoted 45 lines · Sakari Ailus
Quoted 44 lines · Sylwester Nawrocki
Quoted 44 lines · Sakari Ailus
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Quoted 13 lines
(quoted diff) +0
-0@@ -147,6 +149,8 @@ Example: >>> > >> clocks = <&camera 0>; >>> > >> clock-names = "mclk";Quoted 10 lines
+ samsung,flash-led = <&rear_cam_flash>;
+
port {
s5c73m3_1: endpoint {
data-lanes = <1 2 3 4>;Oops. I missed this property would have ended to the sensor's DT node. I
don't think we should have properties here that are parsed by another
driver --- let's discuss this tomorrow.Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
exynos4-is driver already parses sensor nodes (at least their 'port' sub-nodes).
If you read the code and the comment, it looks like something that should be done better but hasn't been done yet. :-) That's something we should avoid. Also, flash devices are by far more common than external ISPs I presume.
Yes, especially let's not require any samsung specific properties in other vendors' sensor bindings.
One way of modelling [flash led]/[image sensor] association I imagine would be to put, e.g. 'flash-leds' property in the SoC camera host interface/ISP DT node. This property would then contain pairs of phandles, first to the led node and the second to the sensor node, e.g.
i2c_controller { ... flash_xx@NN { ... led_a { ... } }; image_sensor_x@NN { ... }; };
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
flash-leds = <
&flash_xx&image_sensor_x>, <...>;Maybe a stupid question, but how do you access this in a driver? I have to admit I'm no DT expert.
You could get
of_nodepointers withof_parse_phandle()call and then lookup related flash and sensor devices based on that.
Ack. Looks good to me.
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
For the purpose of this patch set presumably just samsung specific property name could be used (i.e. samsung,flash-leds).
I agree. I'll add similar support for the omap3isp driver in the near future though. Let's see how the camera modules will get modelled, if they will, and if this property still fits to the picture by that time, then we make it more generic.
Quoted 5 lines
Quoted 1 line
What do you think?
I think we could do that, perhaps we could get some more opinions and use generic name already in this series? I'm not sure what are exact plans for this series, I guess it is targeted for 4.2?
There have been very few opinions expressed besides yours, mine and Jacek's, unfortunately. I'm also not very certain on the future-proofness of this solution until we have better understanding of how modules would best be expressed in DT.
v4.2 would be nice target for these, yes.
Signature · 4 lines
Kind regards, Sakari Ailus e-mail: [email protected] XMPP: [email protected]
Re: [PATCH v8 8/8] DT: samsung-fimc: Add examples for samsung,flash-led property
In reply to Sylwester NawrockiHi Sylwester and Jacek,
Quoted 1 line · Sylwester Nawrocki
flash-leds = <
&flash_xx&image_sensor_x>, <...>;
One more matter to consider: xenon flash devices.
How about samsung,camera-flashes (and ti,camera-flashes)? After pondering this awhile, I'm ok with removing the vendor prefix as well.
Let me know what you think.
Signature · 4 lines
Kind regards, Sakari Ailus e-mail: [email protected] XMPP: [email protected]
Re: [PATCH v8 8/8] DT: samsung-fimc: Add examples for samsung,flash-led property
Hi,
Quoted 9 lines · Sakari Ailus
Quoted 1 line · Sylwester Nawrocki
flash-leds = <
&flash_xx&image_sensor_x>, <...>;One more matter to consider: xenon flash devices.
How about samsung,camera-flashes (and ti,camera-flashes)? After pondering this awhile, I'm ok with removing the vendor prefix as well.
Let me know what you think.
I thought about it a bit more and I have some doubts about semantics as above. I'm fine with 'camera-flashes' as far as name is concerned.
Perhaps we should put only phandles to leds or xenon flash devices in the 'camera-flashes' property. I think it would be more future proof in case there is more nodes needed to describe the camera flash (or a camera module) than the above two. And phandles to corresponding image sensor device nodes would be put in a separate property.
camera-flashes = <&flash_xx>, ...
camera-flash-masters = <&image_sensor_x>, ...
Then pairs at same index would describe a single flash, 0 would indicate a null entry if needed.
Similarly we could create properties for other sub-devices of a camera module, like lenses, etc.
--
Thanks,
Sylwester
Re: [PATCH v8 8/8] DT: samsung-fimc: Add examples for samsung,flash-led property
Hi,
Quoted 13 lines · Sylwester Nawrocki
Hi,
Quoted 9 lines · Sakari Ailus
Quoted 1 line · Sylwester Nawrocki
flash-leds = <
&flash_xx&image_sensor_x>, <...>;One more matter to consider: xenon flash devices.
How about samsung,camera-flashes (and ti,camera-flashes)? After pondering this awhile, I'm ok with removing the vendor prefix as well.
Let me know what you think.
Quoted 8 lines
I thought about it a bit more and I have some doubts about semantics as above. I'm fine with 'camera-flashes' as far as name is concerned.
Perhaps we should put only phandles to leds or xenon flash devices in the 'camera-flashes' property. I think it would be more future proof in case there is more nodes needed to describe the camera flash (or a camera module) than the above two. And phandles to corresponding image sensor device nodes would be put in a separate property.
Could you give examples of the cases you are thinking of?
Quoted 5 lines
camera-flashes = <
&flash_xx>, ...
camera-flash-masters = <&image_sensor_x>, ...Then pairs at same index would describe a single flash, 0 would indicate a null entry if needed.
When it should be needed?
Quoted 2 lines
Similarly we could create properties for other sub-devices of a camera module, like lenses, etc.
Signature · 2 lines
Best Regards, Jacek Anaszewski
Re: [PATCH v8 8/8] DT: samsung-fimc: Add examples for samsung,flash-led property
Quoted 14 lines · Jacek Anaszewski
Quoted 14 lines · Sakari Ailus
Quoted 13 lines
Quoted 9 lines
Quoted 9 lines · Sylwester Nawrocki
Quoted 1 line
Quoted 1 line
flash-leds = <
&flash_xx&image_sensor_x>, <...>;One more matter to consider: xenon flash devices.
How about samsung,camera-flashes (and ti,camera-flashes)? After pondering this awhile, I'm ok with removing the vendor prefix as well.
Let me know what you think.
I thought about it a bit more and I have some doubts about semantics as above. I'm fine with 'camera-flashes' as far as name is concerned.
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Perhaps we should put only phandles to leds or xenon flash devices in the 'camera-flashes' property. I think it would be more future proof in case there is more nodes needed to describe the camera flash (or a camera module) than the above two. And phandles to corresponding image sensor device nodes would be put in a separate property.
Could you give examples of the cases you are thinking of?
I don't have any examples in mind ATM, I just wanted to point out the above convention might not be flexible enough. Especially since we already know there is more sub-devices within the camera module than just flashes and image sensors.
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
camera-flashes = <
&flash_xx>, ...
camera-flash-masters = <&image_sensor_x>, ...Then pairs at same index would describe a single flash, 0 would indicate a null entry if needed.
When it should be needed?
Not sure if there is a real use case for null entries, it was just to note we can skip any entry if needed - probably an irrelevant comment. I could imagine 2 LEDs of which one is only triggered in software, so it wouldn't have a 'camera-flash-masters' entry.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Similarly we could create properties for other sub-devices of a camera module, like lenses, etc.
--
Regards,
Sylwester
Re: [PATCH v8 8/8] DT: samsung-fimc: Add examples for samsung,flash-led property
Quoted 34 lines · Sylwester Nawrocki
Quoted 14 lines · Jacek Anaszewski
Quoted 14 lines · Sakari Ailus
Quoted 13 lines
Quoted 9 lines
Quoted 9 lines · Sylwester Nawrocki
Quoted 1 line
Quoted 1 line
flash-leds = <
&flash_xx&image_sensor_x>, <...>;One more matter to consider: xenon flash devices.
How about samsung,camera-flashes (and ti,camera-flashes)? After pondering this awhile, I'm ok with removing the vendor prefix as well.
Let me know what you think.
I thought about it a bit more and I have some doubts about semantics as above. I'm fine with 'camera-flashes' as far as name is concerned.
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Perhaps we should put only phandles to leds or xenon flash devices in the 'camera-flashes' property. I think it would be more future proof in case there is more nodes needed to describe the camera flash (or a camera module) than the above two. And phandles to corresponding image sensor device nodes would be put in a separate property.
Could you give examples of the cases you are thinking of?
I don't have any examples in mind ATM, I just wanted to point out the above convention might not be flexible enough. Especially since we already know there is more sub-devices within the camera module than just flashes and image sensors.
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
camera-flashes = <
&flash_xx>, ...
camera-flash-masters = <&image_sensor_x>, ...Then pairs at same index would describe a single flash, 0 would indicate a null entry if needed.
Quoted 9 lines
Quoted 1 line
When it should be needed?
Not sure if there is a real use case for null entries, it was just to note we can skip any entry if needed - probably an irrelevant comment. I could imagine 2 LEDs of which one is only triggered in software, so it wouldn't have a 'camera-flash-masters' entry.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Similarly we could create properties for other sub-devices of a camera module, like lenses, etc.
I have had the ninth version of the patch set ready to send today, so in view of your doubts I made the property samsung specific so as not to prevent us from going further while we will be discussing the implementation of the generic property. The 9th version of the patch set has been just sent.
Signature · 2 lines
Best Regards, Jacek Anaszewski
Re: [PATCH v8 8/8] DT: samsung-fimc: Add examples for samsung,flash-led property
In reply to Sylwester NawrockiHi Sylwester,
Quoted 21 lines · Sylwester Nawrocki
Quoted 20 lines · Jacek Anaszewski
Quoted 19 lines · Sakari Ailus
Quoted 18 lines
Quoted 9 lines
Quoted 9 lines · Sylwester Nawrocki
Quoted 1 line
Quoted 1 line
flash-leds = <
&flash_xx&image_sensor_x>, <...>;One more matter to consider: xenon flash devices.
How about samsung,camera-flashes (and ti,camera-flashes)? After pondering this awhile, I'm ok with removing the vendor prefix as well.
Let me know what you think.
I thought about it a bit more and I have some doubts about semantics as above. I'm fine with 'camera-flashes' as far as name is concerned.
Perhaps we should put only phandles to leds or xenon flash devices in the 'camera-flashes' property. I think it would be more future proof in case there is more nodes needed to describe the camera flash (or a camera module) than the above two. And phandles to corresponding image sensor device nodes would be put in a separate property.
Quoted 6 lines
Quoted 1 line
Could you give examples of the cases you are thinking of?
I don't have any examples in mind ATM, I just wanted to point out the above convention might not be flexible enough. Especially since we already know there is more sub-devices within the camera module than just flashes and image sensors.
I have to admit I've never seen a camera module with an integrated flash. The lens is part of the module but typically flash is not. That doesn't say there aren't such devices though.
Signature · 4 lines
Kind regards, Sakari Ailus e-mail: [email protected] XMPP: [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v8 8/8] DT: samsung-fimc: Add examples for samsung,flash-led property
Hi Sylwester,
Quoted 22 lines · Sylwester Nawrocki
Hi,
Quoted 9 lines · Sakari Ailus
Quoted 1 line · Sylwester Nawrocki
flash-leds = <
&flash_xx&image_sensor_x>, <...>;One more matter to consider: xenon flash devices.
How about samsung,camera-flashes (and ti,camera-flashes)? After pondering this awhile, I'm ok with removing the vendor prefix as well.
Let me know what you think.
I thought about it a bit more and I have some doubts about semantics as above. I'm fine with 'camera-flashes' as far as name is concerned.
Perhaps we should put only phandles to leds or xenon flash devices in the 'camera-flashes' property. I think it would be more future proof in case there is more nodes needed to describe the camera flash (or a camera module) than the above two. And phandles to corresponding image sensor device nodes would be put in a separate property.
Quoted 7 lines
camera-flashes = <
&flash_xx>, ...
camera-flash-masters = <&image_sensor_x>, ...Then pairs at same index would describe a single flash, 0 would indicate a null entry if needed.
Similarly we could create properties for other sub-devices of a camera module, like lenses, etc.
This arrangement would be advantageous compared to a single property when adding modules (or lenses) to the equation, and probably more future proof than "samsung,camera-flashes" / "ti,camera-flashes" I believe.
I'm also ok with keeping it as-is though.
Signature · 8 lines
Kind regards, Sakari Ailus e-mail: [email protected] XMPP: [email protected] -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html