LED / flash API integration
Subsystems (7)
v12 cover LED / flash API integration
This patch set is a follow-up of the LED / flash API integration series [1]. It is based on linux-next_20150304
========================
Changes since version 11 :
========================
- removed synchronized strobe feature from LED Flash class, as it turned out to be not fitting for sysfs interface. The V4L2 part can cover this in the future.
- Improved external strobe handling for AAT1290
- added removing led-triggers on v4l2-flash sub-device open
- applied minor improvements and cleanups
========================
Changes since version 10 :
========================
- added to the v4l2-flash sub-device driver the support for flash LED devices with non-linear brightness setting
- improved current setting in the max77693-led driver
- added ABI documentation for flash LED sysfs attributes
- improved synchronized LEDs related sysfs attributes in the LED Flash class
- applied various fixes and cleanups
========================
Changes since version 9 :
========================
- switched to assigning sub-led related of_node to led_cdev->dev->of_node member which allowed for avoiding modifications around v4l-async
- reimplemented max77693 flash cell driver to avoid extensive use of macros
- added led-sources DT property and switched to using it
- switched to reporting flash faults in the LED subsystem in the form of human readable strings
- added available_sync_leds sysfs attribute to the LED Flash class and changed the semantics of flash_sync_strobe attribute
- made LED subsystem flash faults not depending on the V4L2 Flash ones
- applied various fixes and cleanups
========================
Changes since version 8:
========================
- added a new way of registering async sub-device
- switched to matching flash leds by DT phandles
- improved Device Tree bindings documentation
- split the drivers patches to LED Flash class
and V4L2 Flash part
- fixed indicator leds handling in v4l2-flash
- applied various fixes an cleanups
========================
Changes since version 7:
========================
- removed explicit support for indicator leds from LED Flash class - indicator leds will be registered as a separate LED Flash class devices
- added flash_sync_strobe sysfs attribute and related V4L2_CID_FLASH_SYNC_STROBE control
- changed the way of matching V4L2 Flash sub-devices in a media device, which entailed modification in v4l2-async driver
- modified max77693 DT bindings documentation
- applied various fixes an cleanups
========================
Changes since version 6:
========================
- removed addition of public LED subsystem API for setting torch brightness in favour of internal API for synchronous and asynchronous led brightness level setting
- fixed possible race condition upon creating LED Flash class related sysfs attributes
========================
Changes since version 5:
========================
- removed flash manager framework - its implementation needs further thorough discussion.
- removed external strobe facilities from the LED Flash Class and provided external_strobe_set op in v4l2-flash. LED subsystem should be strobe provider agnostic.
Thanks,
Jacek Anaszewski
[1] https://lkml.org/lkml/2014/7/11/914
Jacek Anaszewski (19):
leds: flash: Remove synchronized flash strobe feature
leds: flash: document sysfs interface
Documentation: leds: Add description of LED Flash class extension
dt-binding: leds: Add common LED DT bindings macros
mfd: max77693: Modify flash cell name identifiers
mfd: max77693: Remove struct max77693_led_platform_data
mfd: max77693: add TORCH_IOUT_MASK macro
mfd: max77693: Adjust FLASH_EN_SHIFT and TORCH_EN_SHIFT macros
leds: Add support for max77693 mfd flash cell
DT: Add documentation for the mfd Maxim max77693
leds: Add driver for AAT1290 current regulator
of: Add Skyworks Solutions, Inc. vendor prefix
DT: Add documentation for the Skyworks AAT1290
exynos4-is: Add support for v4l2-flash subdevs
media: Add registration helpers for V4L2 flash sub-devices
Documentation: leds: Add description of v4l2-flash sub-device
DT: Add documentation for exynos4-is 'flashes' property
leds: max77693: add support for V4L2 Flash sub-device
leds: aat1290: add support for V4L2 Flash sub-device
Documentation/ABI/testing/sysfs-class-led-flash | 80 ++ .../devicetree/bindings/leds/leds-aat1290.txt | 64 ++ .../devicetree/bindings/media/samsung-fimc.txt | 8 + Documentation/devicetree/bindings/mfd/max77693.txt | 61 ++ .../devicetree/bindings/vendor-prefixes.txt | 1 + Documentation/leds/leds-class-flash.txt | 35 + drivers/leds/Kconfig | 18 + drivers/leds/Makefile | 2 + drivers/leds/led-class-flash.c | 82 -- drivers/leds/leds-aat1290.c | 571 ++++++++++ drivers/leds/leds-max77693.c | 1122 ++++++++++++++++++++ drivers/media/platform/exynos4-is/media-dev.c | 36 +- 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.c | 598 +++++++++++ drivers/mfd/max77693.c | 4 +- include/dt-bindings/leds/max77693.h | 21 + include/linux/led-class-flash.h | 14 - include/linux/leds.h | 1 - include/linux/mfd/max77693-private.h | 5 +- include/linux/mfd/max77693.h | 13 - include/media/v4l2-flash.h | 143 +++ 23 files changed, 2788 insertions(+), 117 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-class-led-flash create mode 100644 Documentation/devicetree/bindings/leds/leds-aat1290.txt create mode 100644 Documentation/leds/leds-class-flash.txt create mode 100644 drivers/leds/leds-aat1290.c create mode 100644 drivers/leds/leds-max77693.c create mode 100644 drivers/media/v4l2-core/v4l2-flash.c create mode 100644 include/dt-bindings/leds/max77693.h create mode 100644 include/media/v4l2-flash.h
Signature · 1 line
1.7.9.5
PATCH v12 1/19 leds: flash: Remove synchronized flash strobe feature
Synchronized flash strobe feature has been considered not fitting for LED subsystem sysfs interface and thus is being removed.
--- drivers/leds/led-class-flash.c | 82 --------------------------------------- include/linux/led-class-flash.h | 14 ------- include/linux/leds.h | 1 - 3 files changed, 97 deletions(-)
drivers/leds/led-class-flash.c +0 -82
@@ -216,75 +216,6 @@ static ssize_t flash_fault_show(struct device *dev, }static DEVICE_ATTR_RO (flash_fault); -static ssize_t available_sync_leds_show (struct device *dev, -struct device_attribute *attr,char *buf) -{ -struct led_classdev *led_cdev =dev_get_drvdata (dev); -struct led_classdev_flash *fled_cdev =lcdev_to_flcdev (led_cdev); -char *pbuf = buf; -int i, buf_len; - - buf_len =sprintf (pbuf,"[0: none] " ); - pbuf += buf_len; - -for (i =0 ; i < fled_cdev->num_sync_leds; ++i) { - buf_len =sprintf (pbuf,"[%d: %s] " , i +1 , - fled_cdev->sync_leds[i]->led_cdev.name); - pbuf += buf_len; - } - -return sprintf (buf,"%s\n" , buf); -} -static DEVICE_ATTR_RO (available_sync_leds); - -static ssize_t flash_sync_strobe_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 *fled_cdev =lcdev_to_flcdev (led_cdev); -unsigned long led_id; -ssize_t ret; - -mutex_lock (&led_cdev->led_access); - -if (led_sysfs_is_disabled (led_cdev)) { - ret = -EBUSY ; - goto unlock; - } - - ret =kstrtoul (buf,10 , &led_id); -if (ret) - goto unlock; - -if (led_id > fled_cdev->num_sync_leds) { - ret = -ERANGE ; - goto unlock; - } - - fled_cdev->sync_led_id = led_id; - - ret = size; -unlock: -mutex_unlock (&led_cdev->led_access); -return ret; -} - -static ssize_t flash_sync_strobe_show (struct device *dev, -struct device_attribute *attr,char *buf) -{ -struct led_classdev *led_cdev =dev_get_drvdata (dev); -struct led_classdev_flash *fled_cdev =lcdev_to_flcdev (led_cdev); -int sled_id = fled_cdev->sync_led_id; -char *sync_led_name ="none" ; - -if (fled_cdev->sync_led_id >0 ) - sync_led_name = (char *) - fled_cdev->sync_leds[sled_id -1 ]->led_cdev.name; - -return sprintf (buf,"[%d: %s]\n" , sled_id, sync_led_name); -} -static DEVICE_ATTR_RW (flash_sync_strobe); -static struct attribute *led_flash_strobe_attrs[] = { &dev_attr_flash_strobe.attr,NULL ,
@@ -307,12 +238,6 @@ static struct attribute *led_flash_fault_attrs[] = { NULL, }; -static struct attribute *led_flash_sync_strobe_attrs[] = { - &dev_attr_available_sync_leds.attr, - &dev_attr_flash_sync_strobe.attr, -NULL , -}; -static const struct attribute_group led_flash_strobe_group = { .attrs = led_flash_strobe_attrs, };
@@ -329,10 +254,6 @@ static const struct attribute_group led_flash_fault_group = { .attrs = led_flash_fault_attrs, }; -static const struct attribute_group led_flash_sync_strobe_group = { - .attrs = led_flash_sync_strobe_attrs, -}; -static void led_flash_resume (struct led_classdev *led_cdev) {struct led_classdev_flash *fled_cdev =lcdev_to_flcdev (led_cdev);
@@ -361,9 +282,6 @@ static void led_flash_init_sysfs_groups(struct led_classdev_flash *fled_cdev)if (ops->fault_get) flash_groups[num_sysfs_groups++] = &led_flash_fault_group; -if (led_cdev->flags &LED_DEV_CAP_SYNC_STROBE ) - flash_groups[num_sysfs_groups++] = &led_flash_sync_strobe_group; - led_cdev->groups = flash_groups; }
include/linux/led-class-flash.h +0 -14
@@ -81,20 +81,6 @@ struct led_classdev_flash {/* LED Flash class sysfs groups */ const struct attribute_group *sysfs_groups[LED_FLASH_MAX_SYSFS_GROUPS ]; - -/* LEDs available for flash strobe synchronization */ -struct led_classdev_flash **sync_leds; - -/* Number of LEDs available for flash strobe synchronization */ -int num_sync_leds; - -/* -* The identifier of the sub-led to synchronize the flash strobe with. -* Identifiers start from 1, which reflects the first element from the -* sync_leds array. 0 means that the flash strobe should not be -* synchronized. -*/ -u32 sync_led_id; }; static inline struct led_classdev_flash *lcdev_to_flcdev(
include/linux/leds.h +0 -1
@@ -47,7 +47,6 @@ struct led_classdev {#define SET_BRIGHTNESS_ASYNC (1 << 21)#define SET_BRIGHTNESS_SYNC (1 << 22)#define LED_DEV_CAP_FLASH (1 << 23) -#define LED_DEV_CAP_SYNC_STROBE (1 << 24)/* Set LED brightness level */ /* Must not sleep, use a workqueue if needed */
Signature · 1 line
1.7.9.5
Re: [PATCH/RFC v12 01/19] leds: flash: Remove synchronized flash strobe feature
Quoted 3 lines · Jacek Anaszewski
Synchronized flash strobe feature has been considered not fitting for LED subsystem sysfs interface and thus is being removed.
OK, I will merge this.
-Bryan
Quoted 164 lines
Signed-off-by Jacek Anaszewski <[email protected]>Acked-by Kyungmin Park <[email protected]>Cc Bryan Wu <[email protected]>Cc Richard Purdie <[email protected]>--- drivers/leds/led-class-flash.c | 82 --------------------------------------- include/linux/led-class-flash.h | 14 ------- include/linux/leds.h | 1 - 3 files changed, 97 deletions(-)drivers/leds/led-class-flash.c +0
-82@@ -216,75 +216,6 @@ static ssize_t flash_fault_show(struct device *dev, }static DEVICE_ATTR_RO (flash_fault); -static ssize_t available_sync_leds_show (struct device *dev, -struct device_attribute *attr,char *buf) -{ -struct led_classdev *led_cdev =dev_get_drvdata (dev); -struct led_classdev_flash *fled_cdev =lcdev_to_flcdev (led_cdev); -char *pbuf = buf; -int i, buf_len; - - buf_len =sprintf (pbuf,"[0: none] " ); - pbuf += buf_len; - -for (i =0 ; i < fled_cdev->num_sync_leds; ++i) { - buf_len =sprintf (pbuf,"[%d: %s] " , i +1 , - fled_cdev->sync_leds[i]->led_cdev.name); - pbuf += buf_len; - } - -return sprintf (buf,"%s\n" , buf); -} -static DEVICE_ATTR_RO (available_sync_leds); - -static ssize_t flash_sync_strobe_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 *fled_cdev =lcdev_to_flcdev (led_cdev); -unsigned long led_id; -ssize_t ret; - -mutex_lock (&led_cdev->led_access); - -if (led_sysfs_is_disabled (led_cdev)) { - ret = -EBUSY ; - goto unlock; - } - - ret =kstrtoul (buf,10 , &led_id); -if (ret) - goto unlock; - -if (led_id > fled_cdev->num_sync_leds) { - ret = -ERANGE ; - goto unlock; - } - - fled_cdev->sync_led_id = led_id; - - ret = size; -unlock: -mutex_unlock (&led_cdev->led_access); -return ret; -} - -static ssize_t flash_sync_strobe_show (struct device *dev, -struct device_attribute *attr,char *buf) -{ -struct led_classdev *led_cdev =dev_get_drvdata (dev); -struct led_classdev_flash *fled_cdev =lcdev_to_flcdev (led_cdev); -int sled_id = fled_cdev->sync_led_id; -char *sync_led_name ="none" ; - -if (fled_cdev->sync_led_id >0 ) - sync_led_name = (char *) - fled_cdev->sync_leds[sled_id -1 ]->led_cdev.name; - -return sprintf (buf,"[%d: %s]\n" , sled_id, sync_led_name); -} -static DEVICE_ATTR_RW (flash_sync_strobe); -static struct attribute *led_flash_strobe_attrs[] = { &dev_attr_flash_strobe.attr,NULL ,@@ -307,12 +238,6 @@ static struct attribute *led_flash_fault_attrs[] = { NULL, }; -static struct attribute *led_flash_sync_strobe_attrs[] = { - &dev_attr_available_sync_leds.attr, - &dev_attr_flash_sync_strobe.attr, -NULL , -}; -static const struct attribute_group led_flash_strobe_group = { .attrs = led_flash_strobe_attrs, };@@ -329,10 +254,6 @@ static const struct attribute_group led_flash_fault_group = { .attrs = led_flash_fault_attrs, }; -static const struct attribute_group led_flash_sync_strobe_group = { - .attrs = led_flash_sync_strobe_attrs, -}; -static void led_flash_resume (struct led_classdev *led_cdev) {struct led_classdev_flash *fled_cdev =lcdev_to_flcdev (led_cdev);@@ -361,9 +282,6 @@ static void led_flash_init_sysfs_groups(struct led_classdev_flash *fled_cdev)if (ops->fault_get) flash_groups[num_sysfs_groups++] = &led_flash_fault_group; -if (led_cdev->flags &LED_DEV_CAP_SYNC_STROBE ) - flash_groups[num_sysfs_groups++] = &led_flash_sync_strobe_group; - led_cdev->groups = flash_groups; }include/linux/led-class-flash.h +0
-14@@ -81,20 +81,6 @@ struct led_classdev_flash {/* LED Flash class sysfs groups */ const struct attribute_group *sysfs_groups[LED_FLASH_MAX_SYSFS_GROUPS ]; - -/* LEDs available for flash strobe synchronization */ -struct led_classdev_flash **sync_leds; - -/* Number of LEDs available for flash strobe synchronization */ -int num_sync_leds; - -/* -* The identifier of the sub-led to synchronize the flash strobe with. -* Identifiers start from 1, which reflects the first element from the -* sync_leds array. 0 means that the flash strobe should not be -* synchronized. -*/ -u32 sync_led_id; }; static inline struct led_classdev_flash *lcdev_to_flcdev(include/linux/leds.h +0
-2@@ -47,7 +47,6 @@ struct led_classdev {#define SET_BRIGHTNESS_ASYNC (1 << 21)#define SET_BRIGHTNESS_SYNC (1 << 22)#define LED_DEV_CAP_FLASH (1 << 23) -#define LED_DEV_CAP_SYNC_STROBE (1 << 24)/* Set LED brightness level */ /* Must not sleep, use a workqueue if needed */ --1.7.9.5
PATCH v12 2/19 leds: flash: document sysfs interface
In reply to Jacek AnaszewskiAdd a documentation of LED Flash class specific sysfs attributes.
--- Documentation/ABI/testing/sysfs-class-led-flash | 80 +++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-led-flash
Documentation/ABI/testing/sysfs-class-led-flash new file +80 -0
@@ -0,0 +1,80 @@ +What: /sys/class/leds/<led>/flash_brightness +Date: March 2015 +KernelVersion: 4.0 +Contact: Jacek Anaszewski <[email protected]> +Description: read/write + Set the brightness of this LED in the flash strobe mode, in + microamperes. The file is created only for the flash LED devices + that support setting flash brightness. + + The value is between 0 and + /sys/class/leds/<led>/max_flash_brightness. + +What: /sys/class/leds/<led>/max_flash_brightness +Date: March 2015 +KernelVersion: 4.0 +Contact: Jacek Anaszewski <[email protected]> +Description: read only + Maximum brightness level for this LED in the flash strobe mode, + in microamperes. + +What: /sys/class/leds/<led>/flash_timeout +Date: March 2015 +KernelVersion: 4.0 +Contact: Jacek Anaszewski <[email protected]> +Description: read/write + Hardware timeout for flash, in microseconds. The flash strobe + is stopped after this period of time has passed from the start + of the strobe. The file is created only for the flash LED + devices that support setting flash timeout. + +What: /sys/class/leds/<led>/max_flash_timeout +Date: March 2015 +KernelVersion: 4.0 +Contact: Jacek Anaszewski <[email protected]> +Description: read only + Maximum flash timeout for this LED, in microseconds. + +What: /sys/class/leds/<led>/flash_strobe +Date: March 2015 +KernelVersion: 4.0 +Contact: Jacek Anaszewski <[email protected]> +Description: read/write + Flash strobe state. When written with 1 it triggers flash strobe + and when written with 0 it turns the flash off. + + On read 1 means that flash is currently strobing and 0 means + that flash is off. + +What: /sys/class/leds/<led>/flash_fault +Date: March 2015 +KernelVersion: 4.0 +Contact: Jacek Anaszewski <[email protected]> +Description: read only + Space separated list of flash faults that may have occurred. + Flash faults are re-read after strobing the flash. Possible + flash faults: + + * led-over-voltage - flash controller voltage to the flash LED + has exceeded the limit specific to the flash controller + * flash-timeout-exceeded - the flash strobe was still on when + the timeout set by the user has expired; not all flash + controllers may set this in all such conditions + * controller-over-temperature - the flash controller has + overheated + * controller-short-circuit - the short circuit protection + of the flash controller has been triggered + * led-power-supply-over-current - current in the LED power + supply has exceeded the limit specific to the flash + controller + * indicator-led-fault - the flash controller has detected + a short or open circuit condition on the indicator LED + * led-under-voltage - flash controller voltage to the flash + LED has been below the minimum limit specific to + the flash + * controller-under-voltage - the input voltage of the flash + controller is below the limit under which strobing the + flash at full current will not be possible; + the condition persists until this flag is no longer set + * led-over-temperature - the temperature of the LED has exceeded + its allowed upper limit
Signature · 1 line
1.7.9.5
Re: [PATCH/RFC v12 02/19] leds: flash: document sysfs interface
Quoted 2 lines · Jacek Anaszewski
Add a documentation of LED Flash class specific sysfs attributes.
Thanks, merged!
-Bryan
Quoted 98 lines
Signed-off-by Jacek Anaszewski <[email protected]>Acked-by Kyungmin Park <[email protected]>Cc Bryan Wu <[email protected]>Cc Richard Purdie <[email protected]>--- Documentation/ABI/testing/sysfs-class-led-flash | 80 +++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-led-flashDocumentation/ABI/testing/sysfs-class-led-flash new file +80
-1@@ -0,0 +1,80 @@ +What: /sys/class/leds/<led>/flash_brightness +Date: March 2015 +KernelVersion: 4.0 +Contact: Jacek Anaszewski <[email protected]> +Description: read/write + Set the brightness of this LED in the flash strobe mode, in + microamperes. The file is created only for the flash LED devices + that support setting flash brightness. + + The value is between 0 and + /sys/class/leds/<led>/max_flash_brightness. + +What: /sys/class/leds/<led>/max_flash_brightness +Date: March 2015 +KernelVersion: 4.0 +Contact: Jacek Anaszewski <[email protected]> +Description: read only + Maximum brightness level for this LED in the flash strobe mode, + in microamperes. + +What: /sys/class/leds/<led>/flash_timeout +Date: March 2015 +KernelVersion: 4.0 +Contact: Jacek Anaszewski <[email protected]> +Description: read/write + Hardware timeout for flash, in microseconds. The flash strobe + is stopped after this period of time has passed from the start + of the strobe. The file is created only for the flash LED + devices that support setting flash timeout. + +What: /sys/class/leds/<led>/max_flash_timeout +Date: March 2015 +KernelVersion: 4.0 +Contact: Jacek Anaszewski <[email protected]> +Description: read only + Maximum flash timeout for this LED, in microseconds. + +What: /sys/class/leds/<led>/flash_strobe +Date: March 2015 +KernelVersion: 4.0 +Contact: Jacek Anaszewski <[email protected]> +Description: read/write + Flash strobe state. When written with 1 it triggers flash strobe + and when written with 0 it turns the flash off. + + On read 1 means that flash is currently strobing and 0 means + that flash is off. + +What: /sys/class/leds/<led>/flash_fault +Date: March 2015 +KernelVersion: 4.0 +Contact: Jacek Anaszewski <[email protected]> +Description: read only + Space separated list of flash faults that may have occurred. + Flash faults are re-read after strobing the flash. Possible + flash faults: + + * led-over-voltage - flash controller voltage to the flash LED + has exceeded the limit specific to the flash controller + * flash-timeout-exceeded - the flash strobe was still on when + the timeout set by the user has expired; not all flash + controllers may set this in all such conditions + * controller-over-temperature - the flash controller has + overheated + * controller-short-circuit - the short circuit protection + of the flash controller has been triggered + * led-power-supply-over-current - current in the LED power + supply has exceeded the limit specific to the flash + controller + * indicator-led-fault - the flash controller has detected + a short or open circuit condition on the indicator LED + * led-under-voltage - flash controller voltage to the flash + LED has been below the minimum limit specific to + the flash + * controller-under-voltage - the input voltage of the flash + controller is below the limit under which strobing the + flash at full current will not be possible; + the condition persists until this flag is no longer set + * led-over-temperature - the temperature of the LED has exceeded + its allowed upper limit --1.7.9.5
PATCH v12 3/19 Documentation: leds: Add description of LED Flash class extension
In reply to Jacek AnaszewskiThe documentation being added contains overall description of the LED Flash Class and the related sysfs attributes.
--- Documentation/leds/leds-class-flash.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Documentation/leds/leds-class-flash.txt
Documentation/leds/leds-class-flash.txt new file +22 -0
@@ -0,0 +1,22 @@ + +Flash LED handling under Linux +============================== + +Some LED devices provide two modes - torch and flash. In the LED subsystem +those modes are supported by LED class (see Documentation/leds/leds-class.txt) +and LED Flash class respectively. The torch mode related features are enabled +by default and the flash ones only if a driver declares it by setting +LED_DEV_CAP_FLASH flag. + +In order to enable the support for flash LEDs CONFIG_LEDS_CLASS_FLASH symbol +must be defined in the kernel config. A LED Flash class driver must be +registered in the LED subsystem with led_classdev_flash_register function. + +Following sysfs attributes are exposed for controlling flash LED devices: +(see Documentation/ABI/testing/sysfs-class-led-flash) + - flash_brightness + - max_flash_brightness + - flash_timeout + - max_flash_timeout + - flash_strobe + - flash_fault
Signature · 1 line
1.7.9.5
Re: [PATCH/RFC v12 03/19] Documentation: leds: Add description of LED Flash class extension
Quoted 3 lines · Jacek Anaszewski
The documentation being added contains overall description of the LED Flash Class and the related sysfs attributes.
Thanks, merged!
-Bryan
Quoted 40 lines
Signed-off-by Jacek Anaszewski <[email protected]>Acked-by Kyungmin Park <[email protected]>Cc Bryan Wu <[email protected]>Cc Richard Purdie <[email protected]>--- Documentation/leds/leds-class-flash.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Documentation/leds/leds-class-flash.txtDocumentation/leds/leds-class-flash.txt new file +22
-1@@ -0,0 +1,22 @@ + +Flash LED handling under Linux +============================== + +Some LED devices provide two modes - torch and flash. In the LED subsystem +those modes are supported by LED class (see Documentation/leds/leds-class.txt) +and LED Flash class respectively. The torch mode related features are enabled +by default and the flash ones only if a driver declares it by setting +LED_DEV_CAP_FLASH flag. + +In order to enable the support for flash LEDs CONFIG_LEDS_CLASS_FLASH symbol +must be defined in the kernel config. A LED Flash class driver must be +registered in the LED subsystem with led_classdev_flash_register function. + +Following sysfs attributes are exposed for controlling flash LED devices: +(see Documentation/ABI/testing/sysfs-class-led-flash) + - flash_brightness + - max_flash_brightness + - flash_timeout + - max_flash_timeout + - flash_strobe + - flash_fault --1.7.9.5
PATCH v12 4/19 dt-binding: leds: Add common LED DT bindings macros
In reply to Jacek AnaszewskiAdd macros for defining boost mode and trigger type properties of flash LED devices.
--- include/dt-bindings/leds/max77693.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 include/dt-bindings/leds/max77693.h
include/dt-bindings/leds/max77693.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* This header provides macros for the common LEDs device tree bindings. +* +* Copyright (C) 2015, Samsung Electronics Co., Ltd. +* +* Author: Jacek Anaszewski <[email protected]> +*/ + +#ifndef __DT_BINDINGS_LEDS_H__ +#define __DT_BINDINGS_LEDS_H + +/* External trigger type */ +#define LEDS_TRIG_TYPE_EDGE 0 +#define LEDS_TRIG_TYPE_LEVEL 1 + +/* Boost modes */ +#define LEDS_BOOST_OFF 0 +#define LEDS_BOOST_ADAPTIVE 1 +#define LEDS_BOOST_FIXED 2 + +#endif /* __DT_BINDINGS_LEDS_H */
Signature · 1 line
1.7.9.5
Re: [PATCH/RFC v12 04/19] dt-binding: leds: Add common LED DT bindings macros
Quoted 11 lines · Jacek Anaszewski
Add macros for defining boost mode and trigger type properties of flash LED devices.
Signed-off-by Jacek Anaszewski <[email protected]>Acked-by Kyungmin Park <[email protected]>Cc Bryan Wu <[email protected]>Cc Richard Purdie <[email protected]>--- include/dt-bindings/leds/max77693.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)create mode 100644
include/dt-bindings/leds/max77693.h
This should be obviously include/dt-bindings/leds/common.h. It will affect also max77693-led bindings documentation patch. I'll send the update after receiving review remarks related to the remaining part of the mentioned patches.
Quoted 29 lines
include/dt-bindings/leds/max77693.h new file +21
-0@@ -0,0 +1,21 @@ +/* +* This header provides macros for the common LEDs device tree bindings. +* +* Copyright (C) 2015, Samsung Electronics Co., Ltd. +* +* Author: Jacek Anaszewski <[email protected]> +*/ + +#ifndef __DT_BINDINGS_LEDS_H__ +#define __DT_BINDINGS_LEDS_H + +/* External trigger type */ +#define LEDS_TRIG_TYPE_EDGE 0 +#define LEDS_TRIG_TYPE_LEVEL 1 + +/* Boost modes */ +#define LEDS_BOOST_OFF 0 +#define LEDS_BOOST_ADAPTIVE 1 +#define LEDS_BOOST_FIXED 2 + +#endif /* __DT_BINDINGS_LEDS_H */
Signature · 2 lines
Best Regards, Jacek Anaszewski
Re: [PATCH/RFC v12 04/19] dt-binding: leds: Add common LED DT bindings macros
Quoted 15 lines · Jacek Anaszewski
Quoted 4 lines · Jacek Anaszewski
Add macros for defining boost mode and trigger type properties of flash LED devices.
Quoted 8 lines
Signed-off-by Jacek Anaszewski <[email protected]>Acked-by Kyungmin Park <[email protected]>Cc Bryan Wu <[email protected]>Cc Richard Purdie <[email protected]>--- include/dt-bindings/leds/max77693.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)create mode 100644
include/dt-bindings/leds/max77693.h
Quoted 5 lines
This should be obviously
include/dt-bindings/leds/common.h. It will affect also max77693-led bindings documentation patch. I'll send the update after receiving review remarks related to the remaining part of the mentioned patches.
OK, please update them then I will merge this patch.
Thanks,
-Bryan
Quoted 36 lines
Quoted 21 lines
include/dt-bindings/leds/max77693.h new file +11
-0@@ -0,0 +1,21 @@ +/* +* This header provides macros for the common LEDs device tree bindings. +* +* Copyright (C) 2015, Samsung Electronics Co., Ltd. +* +* Author: Jacek Anaszewski <[email protected]> +*/ + +#ifndef __DT_BINDINGS_LEDS_H__ +#define __DT_BINDINGS_LEDS_H +include/dt-bindings/leds/max77693.h line 21
Quoted 10 lines
include/dt-bindings/leds/max77693.h new file +10
-0+/* External trigger type */ +#define LEDS_TRIG_TYPE_EDGE 0 +#define LEDS_TRIG_TYPE_LEVEL 1 + +/* Boost modes */ +#define LEDS_BOOST_OFF 0 +#define LEDS_BOOST_ADAPTIVE 1 +#define LEDS_BOOST_FIXED 2 + +#endif /* __DT_BINDINGS_LEDS_H */ --
Best Regards,
Jacek Anaszewski
PATCH v12 5/19 mfd: max77693: Modify flash cell name identifiers
In reply to Jacek AnaszewskiChange flash cell identifiers from max77693-flash to max77693-led to avoid confusion with NOR/NAND Flash.
--- drivers/mfd/max77693.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/max77693.c +2 -2
@@ -53,8 +53,8 @@ static const struct mfd_cell max77693_devs[] = { .of_compatible = "maxim,max77693-haptic", }, { - .name = "max77693-flash", - .of_compatible = "maxim,max77693-flash", + .name = "max77693-led", + .of_compatible = "maxim,max77693-led", }, };
Signature · 1 line
1.7.9.5
Lee Jones
AppliedRe: [PATCH/RFC v12 05/19] mfd: max77693: Modify flash cell name identifiers
Quoted 9 lines · Jacek Anaszewski
Change flash cell identifiers from max77693-flash to max77693-led to avoid confusion with NOR/NAND Flash.
Signed-off-by Jacek Anaszewski <[email protected]>Acked-by Kyungmin Park <[email protected]>Acked-by Lee Jones <[email protected]>--- drivers/mfd/max77693.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Applied, thanks.
Quoted 15 lines
drivers/mfd/max77693.c +2
-2@@ -53,8 +53,8 @@ static const struct mfd_cell max77693_devs[] = { .of_compatible = "maxim,max77693-haptic", }, { - .name = "max77693-flash", - .of_compatible = "maxim,max77693-flash", + .name = "max77693-led", + .of_compatible = "maxim,max77693-led", }, };
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v12 6/19 mfd: max77693: Remove struct max77693_led_platform_data
In reply to Jacek AnaszewskiThe flash part of the max77693 device will depend only on OF, and thus will not use board files. Since there are no other users of the struct max77693_led_platform_data its existence is unjustified.
--- include/linux/mfd/max77693.h | 13 ------------- 1 file changed, 13 deletions(-)
include/linux/mfd/max77693.h +0 -13
@@ -87,19 +87,6 @@ enum max77693_led_boost_mode { MAX77693_LED_BOOST_FIXED, }; -struct max77693_led_platform_data { -u32 fleds[2 ]; -u32 iout_torch[2 ]; -u32 iout_flash[2 ]; -u32 trigger[2 ]; -u32 trigger_type[2 ]; -u32 num_leds; -u32 boost_mode; -u32 flash_timeout; -u32 boost_vout; -u32 low_vsys; -}; -/* MAX77693 */ struct max77693_platform_data {
Signature · 6 lines
1.7.9.5 -- 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
Lee Jones
AppliedRe: [PATCH/RFC v12 06/19] mfd: max77693: Remove struct max77693_led_platform_data
Quoted 11 lines · Jacek Anaszewski
The flash part of the max77693 device will depend only on OF, and thus will not use board files. Since there are no other users of the struct
max77693_led_platform_dataits existence is unjustified.Signed-off-by Jacek Anaszewski <[email protected]>Acked-by Kyungmin Park <[email protected]>Cc Chanwoo Choi <[email protected]>Cc Lee Jones <[email protected]>--- include/linux/mfd/max77693.h | 13 ------------- 1 file changed, 13 deletions(-)
Applied, thanks.
Quoted 24 lines
include/linux/mfd/max77693.h +0
-13@@ -87,19 +87,6 @@ enum max77693_led_boost_mode { MAX77693_LED_BOOST_FIXED, }; -struct max77693_led_platform_data { -u32 fleds[2 ]; -u32 iout_torch[2 ]; -u32 iout_flash[2 ]; -u32 trigger[2 ]; -u32 trigger_type[2 ]; -u32 num_leds; -u32 boost_mode; -u32 flash_timeout; -u32 boost_vout; -u32 low_vsys; -}; -/* MAX77693 */ struct max77693_platform_data {
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v12 7/19 mfd: max77693: add TORCH_IOUT_MASK macro
In reply to Jacek AnaszewskiAdd a macro for obtaining the mask of ITORCH register bit fields related either to FLED1 or FLED2 current output. The expected arguments are TORCH_IOUT1_SHIFT or TORCH_IOUT2_SHIFT.
--- include/linux/mfd/max77693-private.h | 1 + 1 file changed, 1 insertion(+)
include/linux/mfd/max77693-private.h +1 -0
@@ -87,6 +87,7 @@ enum max77693_pmic_reg {/* MAX77693 ITORCH register */ #define TORCH_IOUT1_SHIFT 0#define TORCH_IOUT2_SHIFT 4 +#define TORCH_IOUT_MASK (x) (0xf << (x))#define TORCH_IOUT_MIN 15625#define TORCH_IOUT_MAX 250000#define TORCH_IOUT_STEP 15625
Signature · 1 line
1.7.9.5
Lee Jones
AppliedRe: [PATCH/RFC v12 07/19] mfd: max77693: add TORCH_IOUT_MASK macro
Quoted 11 lines · Jacek Anaszewski
Add a macro for obtaining the mask of ITORCH register bit fields related either to FLED1 or FLED2 current output. The expected arguments are
TORCH_IOUT1_SHIFTorTORCH_IOUT2_SHIFT.Signed-off-by Jacek Anaszewski <[email protected]>Acked-by Kyungmin Park <[email protected]>Cc Chanwoo Choi <[email protected]>Cc Lee Jones <[email protected]>--- include/linux/mfd/max77693-private.h | 1 + 1 file changed, 1 insertion(+)
Applied, thanks.
Quoted 12 lines
include/linux/mfd/max77693-private.h +1
-0@@ -87,6 +87,7 @@ enum max77693_pmic_reg {/* MAX77693 ITORCH register */ #define TORCH_IOUT1_SHIFT 0#define TORCH_IOUT2_SHIFT 4 +#define TORCH_IOUT_MASK (x) (0xf << (x))#define TORCH_IOUT_MIN 15625#define TORCH_IOUT_MAX 250000#define TORCH_IOUT_STEP 15625
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v12 8/19 mfd: max77693: Adjust FLASH_EN_SHIFT and TORCH_EN_SHIFT macros
In reply to Jacek AnaszewskiModify FLASH_EN_SHIFT and TORCH_EN_SHIFT macros to work properly when passed enum max77693_fled values (0 for FLED1 and 1 for FLED2) from leds-max77693 driver. Previous definitions were compatible with one of the previous RFC versions of leds-max77693.c driver, which was not merged.
--- include/linux/mfd/max77693-private.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/mfd/max77693-private.h +2 -2
@@ -114,8 +114,8 @@ enum max77693_pmic_reg {#define FLASH_EN_FLASH 0x1#define FLASH_EN_TORCH 0x2#define FLASH_EN_ON 0x3 -#define FLASH_EN_SHIFT (x) (6 - ((x) - 1) * 2) -#define TORCH_EN_SHIFT (x) (2 - ((x) - 1) * 2) +#define FLASH_EN_SHIFT (x) (6 - (x) * 2) +#define TORCH_EN_SHIFT (x) (2 - (x) * 2)/* MAX77693 MAX_FLASH1 register */ #define MAX_FLASH1_MAX_FL_EN 0x80
Signature · 1 line
1.7.9.5
Lee Jones
AppliedRe: [PATCH/RFC v12 08/19] mfd: max77693: Adjust FLASH_EN_SHIFT and TORCH_EN_SHIFT macros
Quoted 6 lines · Jacek Anaszewski
Modify
FLASH_EN_SHIFTandTORCH_EN_SHIFTmacros to work properly when passed enummax77693_fledvalues (0 for FLED1 and 1 for FLED2) from leds-max77693 driver. Previous definitions were compatible with one of the previous RFC versions ofleds-max77693.cdriver, which was not merged.
Quoted 7 lines
Signed-off-by Jacek Anaszewski <[email protected]>Acked-by Kyungmin Park <[email protected]>Cc Chanwoo Choi <[email protected]>Cc Lee Jones <[email protected]>--- include/linux/mfd/max77693-private.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Applied, thanks.
Quoted 15 lines
include/linux/mfd/max77693-private.h +2
-2@@ -114,8 +114,8 @@ enum max77693_pmic_reg {#define FLASH_EN_FLASH 0x1#define FLASH_EN_TORCH 0x2#define FLASH_EN_ON 0x3 -#define FLASH_EN_SHIFT (x) (6 - ((x) - 1) * 2) -#define TORCH_EN_SHIFT (x) (2 - ((x) - 1) * 2) +#define FLASH_EN_SHIFT (x) (6 - (x) * 2) +#define TORCH_EN_SHIFT (x) (2 - (x) * 2)/* MAX77693 MAX_FLASH1 register */ #define MAX_FLASH1_MAX_FL_EN 0x80
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v12 9/19 leds: Add support for max77693 mfd flash cell
In reply to Jacek AnaszewskiThis 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.
--- drivers/leds/Kconfig | 10 + drivers/leds/Makefile | 1 + drivers/leds/leds-max77693.c | 993 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1004 insertions(+) create mode 100644 drivers/leds/leds-max77693.c
drivers/leds/Kconfig +10 -0
@@ -467,6 +467,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
drivers/leds/Makefile +1 -0
@@ -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
drivers/leds/leds-max77693.c new file +993 -0
993 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v12 10/19 DT: Add documentation for the mfd Maxim max77693
In reply to Jacek AnaszewskiThis patch adds device tree binding documentation for the flash cell of the Maxim max77693 multifunctional device.
--- Documentation/devicetree/bindings/mfd/max77693.txt | 61 ++++++++++++++++++++ 1 file changed, 61 insertions(+)
Documentation/devicetree/bindings/mfd/max77693.txt +61 -0
@@ -76,7 +76,53 @@ Optional properties: Valid values: 4300000, 4700000, 4800000, 4900000 Default: 4300000 +- 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,trigger-type : Flash trigger type. + Possible trigger types: + LEDS_TRIG_TYPE_EDGE (0) - Rising edge of the signal triggers + the flash, + LEDS_TRIG_TYPE_LEVEL (1) - Strobe pulse length controls duration + of the flash. +- maxim,boost-mode : + In boost mode the device can produce up to 1.2A of total current + on both outputs. The maximum current on each output is reduced + to 625mA then. If not enabled explicitly, boost setting defaults to + LEDS_BOOST_FIXED in case both current sources are used. + Possible values: + LEDS_BOOST_OFF (0) - no boost, + LEDS_BOOST_ADAPTIVE (1) - adaptive mode, + LEDS_BOOST_FIXED (2) - fixed mode. +- maxim,boost-mvout : Output voltage of the boost module in millivolts. +- maxim,mvsys-min : Low input voltage level in millivolts. Flash is not fired + if chip estimates that system voltage could drop below this level due + to flash power consumption. + +Required properties of the LED child node: +- label : see Documentation/devicetree/bindings/leds/common.txt +- led-sources : see Documentation/devicetree/bindings/leds/common.txt; + device current output identifiers: 0 - FLED1, 1 - FLED2 + +Optional properties of the LED child node: +- max-microamp : see Documentation/devicetree/bindings/leds/common.txt + Range: 15625 - 250000 +- flash-max-microamp : see Documentation/devicetree/bindings/leds/common.txt + Range: 15625 - 1000000 +- flash-timeout-us : see Documentation/devicetree/bindings/leds/common.txt + Range: 62500 - 1000000 + Example: +#include <dt-bindings/leds/max77693.h> + max77693@66 { compatible = "maxim,max77693"; reg = <0x66>;
@@ -117,5 +163,20 @@ Example: maxim,thermal-regulation-celsius = <75>; maxim,battery-overcurrent-microamp = <3000000>; maxim,charge-input-threshold-microvolt = <4300000>; + + led { + compatible = "maxim,max77693-led"; + maxim,trigger-type = <LEDS_TRIG_TYPE_LEVEL>; + maxim,boost-mode = <LEDS_BOOST_FIXED>; + maxim,boost-mvout = <5000>; + maxim,mvsys-min = <2400>; + + camera_flash: flash-led { + label = "max77693-flash1"; + led-sources = <0>, <1>; + max-microamp = <500000>; + flash-max-microamp = <1250000>; + flash-timeout-us = <1000000>; + }; }; };
Signature · 1 line
1.7.9.5
Re: [PATCH/RFC v12 10/19] DT: Add documentation for the mfd Maxim max77693
Hi Jacek,
Quoted 45 lines · Jacek Anaszewski
This patch adds device tree binding documentation for the flash cell of the Maxim max77693 multifunctional device.
Signed-off-by Jacek Anaszewski <[email protected]>Signed-off-by Andrzej Hajda <[email protected]>Acked-by Kyungmin Park <[email protected]>Cc Lee Jones <[email protected]>Cc Chanwoo Choi <[email protected]>Cc Bryan Wu <[email protected]>Cc Richard Purdie <rpurdie-Fm38FmjxZ/[email protected]>--- Documentation/devicetree/bindings/mfd/max77693.txt | 61 ++++++++++++++++++++ 1 file changed, 61 insertions(+)Documentation/devicetree/bindings/mfd/max77693.txt +23
-0@@ -76,7 +76,53 @@ Optional properties: Valid values: 4300000, 4700000, 4800000, 4900000 Default: 4300000 +- 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,trigger-type : Flash trigger type. + Possible trigger types: + LEDS_TRIG_TYPE_EDGE (0) - Rising edge of the signal triggers + the flash, + LEDS_TRIG_TYPE_LEVEL (1) - Strobe pulse length controls duration + of the flash. +- maxim,boost-mode : + In boost mode the device can produce up to 1.2A of total current + on both outputs. The maximum current on each output is reduced + to 625mA then. If not enabled explicitly, boost setting defaults to + LEDS_BOOST_FIXED in case both current sources are used. + Possible values:
Documentation/devicetree/bindings/mfd/max77693.txt Optional properties: · line 111
Quoted 10 lines
Documentation/devicetree/bindings/mfd/max77693.txt +10
-0+ LEDS_BOOST_OFF (0) - no boost, + LEDS_BOOST_ADAPTIVE (1) - adaptive mode, + LEDS_BOOST_FIXED (2) - fixed mode. +- maxim,boost-mvout : Output voltage of the boost module in millivolts. +- maxim,mvsys-min : Low input voltage level in millivolts. Flash is not fired + if chip estimates that system voltage could drop below this level due + to flash power consumption. + +Required properties of the LED child node: +- label : see Documentation/devicetree/bindings/leds/common.txt
According to ePAPR, label is "a human readable string describing a device". There's no requirement that this would be unique, for instance. If you have a camera flash LED, there's necessarily no meaningful label for it, as it doesn't really tell the user anything (vs. HDD activity LED, for instance).
I think I'd make this optional.
What comes to entity naming in Media controller, the label isn't enough. As we haven't yet fully agreed on how to name the entities in the future, I'd propose sticking to current practices: chip name (and optional numerical LED ID) followed by the I2C address. The name should be specified by the driver.
Do you have other than I2C busses required by the current drivers?
Quoted 38 lines
Documentation/devicetree/bindings/mfd/max77693.txt +28
-0+- led-sources : see Documentation/devicetree/bindings/leds/common.txt; + device current output identifiers: 0 - FLED1, 1 - FLED2 + +Optional properties of the LED child node: +- max-microamp : see Documentation/devicetree/bindings/leds/common.txt + Range: 15625 - 250000 +- flash-max-microamp : see Documentation/devicetree/bindings/leds/common.txt + Range: 15625 - 1000000 +- flash-timeout-us : see Documentation/devicetree/bindings/leds/common.txt + Range: 62500 - 1000000 + Example: +#include <dt-bindings/leds/max77693.h> + max77693@66 { compatible = "maxim,max77693"; reg = <0x66>;@@ -117,5 +163,20 @@ Example: maxim,thermal-regulation-celsius = <75>; maxim,battery-overcurrent-microamp = <3000000>; maxim,charge-input-threshold-microvolt = <4300000>; + + led { + compatible = "maxim,max77693-led"; + maxim,trigger-type = <LEDS_TRIG_TYPE_LEVEL>; + maxim,boost-mode = <LEDS_BOOST_FIXED>; + maxim,boost-mvout = <5000>; + maxim,mvsys-min = <2400>; + + camera_flash: flash-led { + label = "max77693-flash1"; + led-sources = <0>, <1>; + max-microamp = <500000>; + flash-max-microamp = <1250000>; + flash-timeout-us = <1000000>; + }; }; };
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
Re: [PATCH/RFC v12 10/19] DT: Add documentation for the mfd Maxim max77693
Hi Sakari,
Thanks for the review.
Quoted 64 lines · Sakari Ailus
Hi Jacek,
Quoted 45 lines · Jacek Anaszewski
This patch adds device tree binding documentation for the flash cell of the Maxim max77693 multifunctional device.
Signed-off-by Jacek Anaszewski <[email protected]>Signed-off-by Andrzej Hajda <[email protected]>Acked-by Kyungmin Park <[email protected]>Cc Lee Jones <[email protected]>Cc Chanwoo Choi <[email protected]>Cc Bryan Wu <[email protected]>Cc Richard Purdie <[email protected]>--- Documentation/devicetree/bindings/mfd/max77693.txt | 61 ++++++++++++++++++++ 1 file changed, 61 insertions(+)Documentation/devicetree/bindings/mfd/max77693.txt +23
-0@@ -76,7 +76,53 @@ Optional properties: Valid values: 4300000, 4700000, 4800000, 4900000 Default: 4300000 +- 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,trigger-type : Flash trigger type. + Possible trigger types: + LEDS_TRIG_TYPE_EDGE (0) - Rising edge of the signal triggers + the flash, + LEDS_TRIG_TYPE_LEVEL (1) - Strobe pulse length controls duration + of the flash. +- maxim,boost-mode : + In boost mode the device can produce up to 1.2A of total current + on both outputs. The maximum current on each output is reduced + to 625mA then. If not enabled explicitly, boost setting defaults to + LEDS_BOOST_FIXED in case both current sources are used. + Possible values:Documentation/devicetree/bindings/mfd/max77693.txt Optional properties: · line 111
Quoted 10 lines
Documentation/devicetree/bindings/mfd/max77693.txt +10
-0+ LEDS_BOOST_OFF (0) - no boost, + LEDS_BOOST_ADAPTIVE (1) - adaptive mode, + LEDS_BOOST_FIXED (2) - fixed mode. +- maxim,boost-mvout : Output voltage of the boost module in millivolts. +- maxim,mvsys-min : Low input voltage level in millivolts. Flash is not fired + if chip estimates that system voltage could drop below this level due + to flash power consumption. + +Required properties of the LED child node: +- label : see Documentation/devicetree/bindings/leds/common.txtAccording to ePAPR, label is "a human readable string describing a device". There's no requirement that this would be unique, for instance. If you have a camera flash LED, there's necessarily no meaningful label for it, as it doesn't really tell the user anything (vs. HDD activity LED, for instance).
Quoted 1 line
I think I'd make this optional.
OK.
Quoted 6 lines
What comes to entity naming in Media controller, the label isn't enough. As we haven't yet fully agreed on how to name the entities in the future, I'd propose sticking to current practices: chip name (and optional numerical LED ID) followed by the I2C address. The name should be specified by the driver.
Do you have other than I2C busses required by the current drivers?
I have AAT1290 device driven through GPIOs. There was also other driver, for a similar device, submitted few days ago to linux-leds list.
Quoted 39 lines
Quoted 38 lines
Documentation/devicetree/bindings/mfd/max77693.txt +28
-0+- led-sources : see Documentation/devicetree/bindings/leds/common.txt; + device current output identifiers: 0 - FLED1, 1 - FLED2 + +Optional properties of the LED child node: +- max-microamp : see Documentation/devicetree/bindings/leds/common.txt + Range: 15625 - 250000 +- flash-max-microamp : see Documentation/devicetree/bindings/leds/common.txt + Range: 15625 - 1000000 +- flash-timeout-us : see Documentation/devicetree/bindings/leds/common.txt + Range: 62500 - 1000000 + Example: +#include <dt-bindings/leds/max77693.h> + max77693@66 { compatible = "maxim,max77693"; reg = <0x66>;@@ -117,5 +163,20 @@ Example: maxim,thermal-regulation-celsius = <75>; maxim,battery-overcurrent-microamp = <3000000>; maxim,charge-input-threshold-microvolt = <4300000>; + + led { + compatible = "maxim,max77693-led"; + maxim,trigger-type = <LEDS_TRIG_TYPE_LEVEL>; + maxim,boost-mode = <LEDS_BOOST_FIXED>; + maxim,boost-mvout = <5000>; + maxim,mvsys-min = <2400>; + + camera_flash: flash-led { + label = "max77693-flash1"; + led-sources = <0>, <1>; + max-microamp = <500000>; + flash-max-microamp = <1250000>; + flash-timeout-us = <1000000>; + }; }; };
Signature · 2 lines
Best Regards, Jacek Anaszewski
Re: [PATCH/RFC v12 10/19] DT: Add documentation for the mfd Maxim max77693
Hi Jacek,
Quoted 78 lines · Jacek Anaszewski
Hi Sakari,
Thanks for the review.
Quoted 64 lines · Sakari Ailus
Hi Jacek,
Quoted 45 lines · Jacek Anaszewski
This patch adds device tree binding documentation for the flash cell of the Maxim max77693 multifunctional device.
Signed-off-by Jacek Anaszewski <[email protected]>Signed-off-by Andrzej Hajda <[email protected]>Acked-by Kyungmin Park <[email protected]>Cc Lee Jones <[email protected]>Cc Chanwoo Choi <[email protected]>Cc Bryan Wu <[email protected]>Cc Richard Purdie <[email protected]>--- Documentation/devicetree/bindings/mfd/max77693.txt | 61 ++++++++++++++++++++ 1 file changed, 61 insertions(+)Documentation/devicetree/bindings/mfd/max77693.txt +23
-0@@ -76,7 +76,53 @@ Optional properties: Valid values: 4300000, 4700000, 4800000, 4900000 Default: 4300000 +- 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,trigger-type : Flash trigger type. + Possible trigger types: + LEDS_TRIG_TYPE_EDGE (0) - Rising edge of the signal triggers + the flash, + LEDS_TRIG_TYPE_LEVEL (1) - Strobe pulse length controls duration + of the flash. +- maxim,boost-mode : + In boost mode the device can produce up to 1.2A of total current + on both outputs. The maximum current on each output is reduced + to 625mA then. If not enabled explicitly, boost setting defaults to + LEDS_BOOST_FIXED in case both current sources are used. + Possible values:Documentation/devicetree/bindings/mfd/max77693.txt Optional properties: · line 111
Quoted 10 lines
Documentation/devicetree/bindings/mfd/max77693.txt +10
-0+ LEDS_BOOST_OFF (0) - no boost, + LEDS_BOOST_ADAPTIVE (1) - adaptive mode, + LEDS_BOOST_FIXED (2) - fixed mode. +- maxim,boost-mvout : Output voltage of the boost module in millivolts. +- maxim,mvsys-min : Low input voltage level in millivolts. Flash is not fired + if chip estimates that system voltage could drop below this level due + to flash power consumption. + +Required properties of the LED child node: +- label : see Documentation/devicetree/bindings/leds/common.txtAccording to ePAPR, label is "a human readable string describing a device". There's no requirement that this would be unique, for instance. If you have a camera flash LED, there's necessarily no meaningful label for it, as it doesn't really tell the user anything (vs. HDD activity LED, for instance).
Quoted 1 line
I think I'd make this optional.
OK.
Quoted 5 lines
What comes to entity naming in Media controller, the label isn't enough. As we haven't yet fully agreed on how to name the entities in the future, I'd propose sticking to current practices: chip name (and optional numerical LED ID) followed by the I2C address. The name should be specified by the driver.
Quoted 4 lines
Quoted 1 line
Do you have other than I2C busses required by the current drivers?
I have AAT1290 device driven through GPIOs. There was also other driver, for a similar device, submitted few days ago to linux-leds list.
The problem indeed is defining a stable and unique identifier for a device in a system. In context of your patchset, I think this mostly matters in the V4L2 flash API wrapper patch.
GPIO controlled devices are little bit more troublesome, as GPIO numbers alone aren't necessarily stable, but depend on the probing order. Well, i2c controllers could also be registered dynamically. The same goes for PCI devices, too, for instance.
Most i2c adapters have a static id, and PCI devices have a stable bus address (unless system configuration is modified by e.g. adding or removing OTHER devices).
I wonder if this could be resolved on OF-based systems by adding a string property, say, device name, whenever where are more than one device of a kind in the system. The string could just contain a numeric value, say 0 or 1.
Cc Hans and Laurent.
Signature · 4 lines
Kind regards, Sakari Ailus e-mail: [email protected] XMPP: [email protected]
Re: [PATCH/RFC v12 10/19] DT: Add documentation for the mfd Maxim max77693
Quoted 81 lines · Sakari Ailus
Hi Jacek,
Quoted 78 lines · Jacek Anaszewski
Hi Sakari,
Thanks for the review.
Quoted 64 lines · Sakari Ailus
Hi Jacek,
Quoted 45 lines · Jacek Anaszewski
This patch adds device tree binding documentation for the flash cell of the Maxim max77693 multifunctional device.
Signed-off-by Jacek Anaszewski <[email protected]>Signed-off-by Andrzej Hajda <[email protected]>Acked-by Kyungmin Park <[email protected]>Cc Lee Jones <[email protected]>Cc Chanwoo Choi <[email protected]>Cc Bryan Wu <[email protected]>Cc Richard Purdie <[email protected]>--- Documentation/devicetree/bindings/mfd/max77693.txt | 61 ++++++++++++++++++++ 1 file changed, 61 insertions(+)Documentation/devicetree/bindings/mfd/max77693.txt +23
-0@@ -76,7 +76,53 @@ Optional properties: Valid values: 4300000, 4700000, 4800000, 4900000 Default: 4300000 +- 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,trigger-type : Flash trigger type. + Possible trigger types: + LEDS_TRIG_TYPE_EDGE (0) - Rising edge of the signal triggers + the flash, + LEDS_TRIG_TYPE_LEVEL (1) - Strobe pulse length controls duration + of the flash. +- maxim,boost-mode : + In boost mode the device can produce up to 1.2A of total current + on both outputs. The maximum current on each output is reduced + to 625mA then. If not enabled explicitly, boost setting defaults to + LEDS_BOOST_FIXED in case both current sources are used. + Possible values:Documentation/devicetree/bindings/mfd/max77693.txt Optional properties: · line 111
Quoted 10 lines
Documentation/devicetree/bindings/mfd/max77693.txt +10
-0+ LEDS_BOOST_OFF (0) - no boost, + LEDS_BOOST_ADAPTIVE (1) - adaptive mode, + LEDS_BOOST_FIXED (2) - fixed mode. +- maxim,boost-mvout : Output voltage of the boost module in millivolts. +- maxim,mvsys-min : Low input voltage level in millivolts. Flash is not fired + if chip estimates that system voltage could drop below this level due + to flash power consumption. + +Required properties of the LED child node: +- label : see Documentation/devicetree/bindings/leds/common.txtAccording to ePAPR, label is "a human readable string describing a device". There's no requirement that this would be unique, for instance. If you have a camera flash LED, there's necessarily no meaningful label for it, as it doesn't really tell the user anything (vs. HDD activity LED, for instance).
Quoted 1 line
I think I'd make this optional.
OK.
Quoted 5 lines
What comes to entity naming in Media controller, the label isn't enough. As we haven't yet fully agreed on how to name the entities in the future, I'd propose sticking to current practices: chip name (and optional numerical LED ID) followed by the I2C address. The name should be specified by the driver.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Do you have other than I2C busses required by the current drivers?
I have AAT1290 device driven through GPIOs. There was also other driver, for a similar device, submitted few days ago to linux-leds list.
The problem indeed is defining a stable and unique identifier for a device in a system. In context of your patchset, I think this mostly matters in the V4L2 flash API wrapper patch.
It would be good if LED Flash class device name would match V4L2 Flash sub-device name. LED class devices are assigned names on the basis of 'name' property of struct led-classdev, which is passed to the device_create_with_groups function. Some LED class drivers use hardcoded strings for 'name' and other ones use the value of DT 'label' property as the first choice, if it is available.
Quoted 4 lines
GPIO controlled devices are little bit more troublesome, as GPIO numbers alone aren't necessarily stable, but depend on the probing order. Well, i2c controllers could also be registered dynamically. The same goes for PCI devices, too, for instance.
For LED Flash devices we must also keep in mind that a device is created
per discrete LED component connected to one or more current outputs of the flash LED controller. There can be more than one LED Flash class device created per flash LED controller. This problem seems to be
even harder than the case with more than one device of a kind in the
system, as the devices are controlled with the same hardware interface.
Quoted 8 lines
Most i2c adapters have a static id, and PCI devices have a stable bus address (unless system configuration is modified by e.g. adding or removing OTHER devices).
I wonder if this could be resolved on OF-based systems by adding a string property, say, device name, whenever where are more than one device of a kind in the system. The string could just contain a numeric value, say 0 or 1.
I can't think of a better solution, especially taking into account the LED Flash class device case with multiple related
LED Flash class/v4l2-flash devices.
Quoted 1 line
Cc Hans and Laurent.
Signature · 2 lines
Best Regards, Jacek Anaszewski
PATCH v12 11/19 leds: Add driver for AAT1290 current regulator
In reply to Jacek AnaszewskiThis patch adds a driver for the 1.5A Step-Up Current Regulator for Flash LEDs. The device is programmed through a Skyworks proprietary AS2Cwire serial digital interface.
--- drivers/leds/Kconfig | 7 + drivers/leds/Makefile | 1 + drivers/leds/leds-aat1290.c | 410 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 418 insertions(+) create mode 100644 drivers/leds/leds-aat1290.c
drivers/leds/Kconfig +7 -0
@@ -42,6 +42,13 @@ config LEDS_88PM860X This option enables support for on-chip LED drivers found on Marvell Semiconductor 88PM8606 PMIC. +config LEDS_AAT1290 + tristate "LED support for the AAT1290" + depends on LEDS_CLASS_FLASH + depends on OF + help + This option enables support for the LEDs on the AAT1290. + config LEDS_LM3530 tristate "LCD Backlight driver for LM3530" depends on LEDS_CLASS
drivers/leds/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o # LED Platform Drivers obj-$(CONFIG_LEDS_88PM860X) += leds-88pm860x.o +obj-$(CONFIG_LEDS_AAT1290) += leds-aat1290.o obj-$(CONFIG_LEDS_BD2802) += leds-bd2802.o obj-$(CONFIG_LEDS_LOCOMO) += leds-locomo.o obj-$(CONFIG_LEDS_LM3530) += leds-lm3530.o
drivers/leds/leds-aat1290.c new file +410 -0
410 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v12 12/19 of: Add Skyworks Solutions, Inc. vendor prefix
In reply to Jacek AnaszewskiUse "skyworks" as the vendor prefix for the Skyworks Solutions, Inc.
--- .../devicetree/bindings/vendor-prefixes.txt | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
@@ -154,6 +154,7 @@ ricoh Ricoh Co. Ltd. rockchip Fuzhou Rockchip Electronics Co., Ltd samsung Samsung Semiconductor sandisk Sandisk Corporation +skyworks Skyworks Solutions, Inc. sbs Smart Battery System schindler Schindler seagate Seagate Technology PLC
Signature · 1 line
1.7.9.5
PATCH v12 13/19 DT: Add documentation for the Skyworks AAT1290
In reply to Jacek AnaszewskiThis patch adds device tree binding documentation for 1.5A Step-Up Current Regulator for Flash LEDs.
--- .../devicetree/bindings/leds/leds-aat1290.txt | 64 ++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-aat1290.txt
Documentation/devicetree/bindings/leds/leds-aat1290.txt new file +64 -0
@@ -0,0 +1,64 @@ +* Skyworks Solutions, Inc. AAT1290 Current Regulator for Flash LEDs + +The device is controlled through two pins: FL_EN and EN_SET. The pins when, +asserted high, enable flash strobe and movie mode (max 1/2 of flash current) +respectively. In order to add a capability of selecting the strobe signal source +(e.g. GPIO or ISP) there is an additional switch required, independent of the +flash chip. + +Required properties: + +- compatible : Must be "skyworks,aat1290". +- gpios : Two gpio pins in order FLEN, EN/SET + +Optional properties: +- pinctrl-names : Must contain entries: "default", "host", "isp". Entries + "default" and "host" must refer to the same pin configration + node, which sets the strobe signal source to host. Entry "isp" + must refer to the pin configuration node, which sets the strobe + signal source to ISP. + +The LED connected to the device must be represented by a child node - +see Documentation/devicetree/bindings/leds/common.txt. + +Required properties of the LED child node: +- label : see Documentation/devicetree/bindings/leds/common.txt +- flash-max-microamp : Maximum intensity in microamperes of the flash LED - + it can be calculated using following formula: + I = 1A * 162kohm / Rset +- flash-timeout-us : Maximum flash timeout in microseconds - + it can be calculated using following formula: + T = 8.82 * 10^9 * Ct. + +Example (by Ct = 220nF, Rset = 160kohm and exynos4412-trats2 board with a +switch that allows for routing the strobe source signal either from host or +from ISP): + +aat1290 { + compatible = "skyworks,aat1290"; + gpios = <&gpj1 1 0>, <&gpj1 2 0>; + 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"; + flash-max-microamp = <1012500> + 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 v12 14/19 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 "flashes" DT property and asynchronous subdevice registration.
--- drivers/media/platform/exynos4-is/media-dev.c | 36 +++++++++++++++++++++++-- drivers/media/platform/exynos4-is/media-dev.h | 13 ++++++++- 2 files changed, 46 insertions(+), 3 deletions(-)
drivers/media/platform/exynos4-is/media-dev.c +34 -2
@@ -451,6 +451,25 @@ rpm_put:return ret; } +static void fimc_md_register_flash_entities (struct fimc_md *fmd) +{ +struct device_node *parent = fmd->pdev->dev.of_node; +struct device_node *np; +int i =0 ; + +do { + np =of_parse_phandle (parent,"flashes" , i); +if (np) { + fmd->flash[fmd->num_flashes].asd.match_type = +V4L2_ASYNC_MATCH_OF ; + fmd->flash[fmd->num_flashes].asd.match.of.node = np; + fmd->num_flashes++; + fmd->async_subdevs[fmd->num_sensors + i] = + &fmd->flash[i].asd; + } + }while (np && (++i <FIMC_MAX_FLASHES )); +} +static int __of_get_csis_id (struct device_node *np) {u32 reg =0 ;
@@ -1275,6 +1294,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->dev->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 +1413,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 +1431,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 2 +#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
PATCH v12 15/19 media: Add registration helpers for V4L2 flash sub-devices
In reply to Jacek AnaszewskiThis 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.c | 598 ++++++++++++++++++++++++++++++++++ include/media/v4l2-flash.h | 143 ++++++++ 4 files changed, 754 insertions(+) create mode 100644 drivers/media/v4l2-core/v4l2-flash.c create mode 100644 include/media/v4l2-flash.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 "Enable support for Flash sub-devices" + depends on VIDEO_V4L2_SUBDEV_API + depends on LEDS_CLASS_FLASH + ---help--- + Say Y here to enable support for Flash sub-devices, which allow + to control LED class devices with use of V4L2 Flash controls. + + 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.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.c new file +598 -0
598 lines not on this page · raw message
include/media/v4l2-flash.h new file +143 -0
143 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v12 16/19 Documentation: leds: Add description of v4l2-flash sub-device
In reply to Jacek AnaszewskiThis patch extends LED Flash class documention by the description of interactions with v4l2-flash sub-device.
--- Documentation/leds/leds-class-flash.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+)
Documentation/leds/leds-class-flash.txt +13 -0
@@ -20,3 +20,16 @@ Following sysfs attributes are exposed for controlling flash LED devices: - max_flash_timeout - flash_strobe - flash_fault + +A LED subsystem driver can be controlled also from the level of VideoForLinux2 +subsystem. In order to enable this CONFIG_V4L2_FLASH_LED_CLASS symbol has to +be defined in the kernel config. The driver must call the v4l2_flash_init +function to get registered in the V4L2 subsystem. On remove the +v4l2_flash_release function has to be called (see <media/v4l2-flash.h>). + +After proper initialization a V4L2 Flash sub-device is created. The sub-device +exposes a number of V4L2 controls, which allow for controlling a LED Flash class +device with use of its internal kernel API. +Opening the V4L2 Flash sub-device makes the LED subsystem sysfs interface +unavailable. The interface is re-enabled after the V4L2 Flash sub-device +is closed.
Signature · 1 line
1.7.9.5
PATCH v12 17/19 DT: Add documentation for exynos4-is 'flashes' property
In reply to Jacek AnaszewskiThis patch adds a description of 'flashes' property to the samsung-fimc.txt.
--- .../devicetree/bindings/media/samsung-fimc.txt | 8 ++++++++ 1 file changed, 8 insertions(+)
Documentation/devicetree/bindings/media/samsung-fimc.txt +8 -0
@@ -40,6 +40,13 @@ should be inactive. For the "active-a" state the camera port A must be activated and the port B deactivated and for the state "active-b" it should be the other way around. +Optional properties: + +- flashes - Array of phandles to the flash LEDs that can be controlled by the + sub-devices contained in this media device. Flash LED is + represented by a child node of a flash LED device + (see Documentation/devicetree/bindings/leds/common.txt). + The 'camera' node must include at least one 'fimc' child node.
@@ -166,6 +173,7 @@ Example: clock-output-names = "cam_a_clkout", "cam_b_clkout"; pinctrl-names = "default"; pinctrl-0 = <&cam_port_a_clk_active>; + flashes = <&camera_flash>, <&system_torch>; status = "okay"; #address-cells = <1>; #size-cells = <1>;
Signature · 1 line
1.7.9.5
PATCH v12 18/19 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 | 145 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 137 insertions(+), 8 deletions(-)
drivers/leds/leds-max77693.c +137 -8
@@ -21,6 +21,7 @@#include <linux/regmap.h> #include <linux/slab.h> #include <linux/workqueue.h> +#include <media/v4l2-flash.h> #define MODE_OFF 0#define MODE_FLASH (a) (1 << (a))
@@ -64,6 +65,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;
@@ -652,7 +655,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;
@@ -698,6 +702,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; ret = of_property_read_string(child_node, "label",
@@ -789,11 +800,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;
@@ -851,9 +863,78 @@ static void max77693_init_flash_settings(struct max77693_led_device *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_ctrl_config (int fled_id, +struct max77693_led_settings *s, +struct v4l2_flash_ctrl_config *config) +{ +struct led_flash_setting *setting; +struct v4l2_ctrl_config *c; + + c = &config->intensity; + setting = &s->torch_brightness; + c->min = setting->min; + c->max = setting->max; + c->step = setting->step; + c->def = setting->val; + + c = &config->flash_intensity; + setting = &s->flash_brightness; + c->min = setting->min; + c->max = setting->max; + c->step = setting->step; + c->def = setting->val; + + c = &config->flash_timeout; + setting = &s->flash_timeout; + c->min = setting->min; + c->max = setting->max; + c->step = setting->step; + c->def = setting->val; + +/* Init flash faults config */ + config->flash_faults =V4L2_FLASH_FAULT_OVER_VOLTAGE | +V4L2_FLASH_FAULT_SHORT_CIRCUIT | +V4L2_FLASH_FAULT_OVER_CURRENT ; + + config->has_external_strobe = true; +} + +static const struct v4l2_flash_ops v4l2_flash_ops = { + .external_strobe_set = max77693_led_external_strobe_set, +}; + +#else +#define max77693_init_v4l2_ctrl_config (fled_id, s, config) +#endif +static void max77693_init_fled_cdev (struct max77693_led_device *led,int fled_id, -struct max77693_led_config_data *cfg) +struct max77693_led_config_data *cfg, +struct v4l2_flash_ctrl_config *v4l2_flash_cfg) {struct led_classdev_flash *fled_cdev;struct led_classdev *led_cdev;
@@ -862,6 +943,8 @@ static void max77693_init_fled_cdev(struct max77693_led_device *led,/* Initialize flash settings */ max77693_init_flash_settings (led, fled_id, cfg, &settings); +/* Initialize V4L2 Flash config basing on initialized settings */ +max77693_init_v4l2_ctrl_config (fled_id, &settings, v4l2_flash_cfg);/* Initialize LED Flash class device */ fled_cdev = &sub_led->fled_cdev;
@@ -882,15 +965,52 @@ static void max77693_init_fled_cdev(struct max77693_led_device *led, sub_led->flash_timeout = fled_cdev->timeout.val; } +static int max77693_register_led (struct max77693_sub_led *sub_led, +struct v4l2_flash_ctrl_config *v4l2_flash_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; +int ret; + +/* Register in the LED subsystem */ + ret =led_classdev_flash_register (dev, fled_cdev); +if (ret <0 ) +return ret; + +of_node_get (sub_node); + fled_cdev->led_cdev.dev->of_node = sub_node; + +/* Register in the V4L2 subsystem. */ + sub_led->v4l2_flash =v4l2_flash_init (fled_cdev, &v4l2_flash_ops, + v4l2_flash_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: +of_node_put (sub_node); +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 ] = {NULL ,NULL };struct max77693_led_config_data cfg = {}; +struct v4l2_flash_ctrl_config v4l2_flash_config[2 ];int init_fled_cdev[2 ], i, ret; +memset (v4l2_flash_config,0 ,sizeof (v4l2_flash_config)); + led =devm_kzalloc (dev,sizeof (*led),GFP_KERNEL );if (!led)return -ENOMEM ;
@@ -900,7 +1020,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, &cfg); + ret =max77693_led_get_configuration (led, &cfg, sub_nodes);if (ret <0 )return ret;
@@ -916,15 +1036,18 @@ static int max77693_led_probe(struct platform_device *pdev)/* Initialize LED Flash class device(s) */ for (i =FLED1 ; i <=FLED2 ; ++i)if (init_fled_cdev[i]) -max77693_init_fled_cdev (led, i, &cfg); +max77693_init_fled_cdev (led, i, &cfg, + &v4l2_flash_config[i]);mutex_init (&led->lock); -/* Register LED Flash class device(s) */ +/* Register LED Flash class and related V4L2 Flash device(s) */ for (i =FLED1 ; i <=FLED2 ; ++i) {if (!init_fled_cdev[i])continue ; - ret =led_classdev_flash_register (dev, &sub_leds[i].fled_cdev); + ret =max77693_register_led (&sub_leds[i], + &v4l2_flash_config[i], + sub_nodes[i]);if (ret <0 ) {/* * At this moment FLED1 might have been already
@@ -943,6 +1066,8 @@ 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); +of_node_put (sub_leds[FLED1 ].fled_cdev.led_cdev.dev->of_node);led_classdev_flash_unregister (&sub_leds[FLED1 ].fled_cdev); err_register_led1:mutex_destroy (&led->lock);
@@ -956,11 +1081,15 @@ 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); +of_node_put (sub_leds[FLED1 ].fled_cdev.led_cdev.dev->of_node);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); +of_node_put (sub_leds[FLED2 ].fled_cdev.led_cdev.dev->of_node);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
PATCH v12 19/19 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 | 165 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 164 insertions(+), 2 deletions(-)
drivers/leds/Kconfig +1 -0
@@ -46,6 +46,7 @@ config LEDS_AAT1290 tristate "LED support for the AAT1290" depends on LEDS_CLASS_FLASH depends on OF + depends on PINCTRL help This option enables support for the LEDs on the AAT1290.
drivers/leds/leds-aat1290.c +163 -2
242 lines not on this page · raw message
Signature · 1 line
1.7.9.5