/* SPDX-License-Identifier: GPL-2.0-only */ /* * LED Flash class interface * * Copyright (C) 2015 Samsung Electronics Co., Ltd. * Author: Jacek Anaszewski <[email protected]> */ #ifndef __LINUX_FLASH_LEDS_H_INCLUDED #define __LINUX_FLASH_LEDS_H_INCLUDED #include <linux/leds.h> struct device_node; struct led_classdev_flash; /* * Supported led fault bits - must be kept in synch * with V4L2_FLASH_FAULT bits. */ #define LED_FAULT_OVER_VOLTAGE … #define LED_FAULT_TIMEOUT … #define LED_FAULT_OVER_TEMPERATURE … #define LED_FAULT_SHORT_CIRCUIT … #define LED_FAULT_OVER_CURRENT … #define LED_FAULT_INDICATOR … #define LED_FAULT_UNDER_VOLTAGE … #define LED_FAULT_INPUT_VOLTAGE … #define LED_FAULT_LED_OVER_TEMPERATURE … #define LED_NUM_FLASH_FAULTS … #define LED_FLASH_SYSFS_GROUPS_SIZE … struct led_flash_ops { … }; /* * Current value of a flash setting along * with its constraints. */ struct led_flash_setting { … }; struct led_classdev_flash { … }; static inline struct led_classdev_flash *lcdev_to_flcdev( struct led_classdev *lcdev) { … } /** * led_classdev_flash_register_ext - register a new object of LED class with * init data and with support for flash LEDs * @parent: LED flash controller device this flash LED is driven by * @fled_cdev: the led_classdev_flash structure for this device * @init_data: the LED class flash device initialization data * * Returns: 0 on success or negative error value on failure */ int led_classdev_flash_register_ext(struct device *parent, struct led_classdev_flash *fled_cdev, struct led_init_data *init_data); /** * led_classdev_flash_unregister - unregisters an object of led_classdev class * with support for flash LEDs * @fled_cdev: the flash LED to unregister * * Unregister a previously registered via led_classdev_flash_register object */ void led_classdev_flash_unregister(struct led_classdev_flash *fled_cdev); int devm_led_classdev_flash_register_ext(struct device *parent, struct led_classdev_flash *fled_cdev, struct led_init_data *init_data); void devm_led_classdev_flash_unregister(struct device *parent, struct led_classdev_flash *fled_cdev); static inline int led_classdev_flash_register(struct device *parent, struct led_classdev_flash *fled_cdev) { … } static inline int devm_led_classdev_flash_register(struct device *parent, struct led_classdev_flash *fled_cdev) { … } /** * led_set_flash_strobe - setup flash strobe * @fled_cdev: the flash LED to set strobe on * @state: 1 - strobe flash, 0 - stop flash strobe * * Strobe the flash LED. * * Returns: 0 on success or negative error value on failure */ static inline int led_set_flash_strobe(struct led_classdev_flash *fled_cdev, bool state) { … } /** * led_get_flash_strobe - get flash strobe status * @fled_cdev: the flash LED to query * @state: 1 - flash is strobing, 0 - flash is off * * Check whether the flash is strobing at the moment. * * Returns: 0 on success or negative error value on failure */ static inline int led_get_flash_strobe(struct led_classdev_flash *fled_cdev, bool *state) { … } /** * led_set_flash_brightness - set flash LED brightness * @fled_cdev: the flash LED to set * @brightness: the brightness to set it to * * Set a flash LED's brightness. * * Returns: 0 on success or negative error value on failure */ int led_set_flash_brightness(struct led_classdev_flash *fled_cdev, u32 brightness); /** * led_update_flash_brightness - update flash LED brightness * @fled_cdev: the flash LED to query * * Get a flash LED's current brightness and update led_flash->brightness * member with the obtained value. * * Returns: 0 on success or negative error value on failure */ int led_update_flash_brightness(struct led_classdev_flash *fled_cdev); /** * led_set_flash_timeout - set flash LED timeout * @fled_cdev: the flash LED to set * @timeout: the flash timeout to set it to * * Set the flash strobe duration. * * Returns: 0 on success or negative error value on failure */ int led_set_flash_timeout(struct led_classdev_flash *fled_cdev, u32 timeout); /** * led_get_flash_fault - get the flash LED fault * @fled_cdev: the flash LED to query * @fault: bitmask containing flash faults * * Get the flash LED fault. * * Returns: 0 on success or negative error value on failure */ int led_get_flash_fault(struct led_classdev_flash *fled_cdev, u32 *fault); #endif /* __LINUX_FLASH_LEDS_H_INCLUDED */