lkml.org 
[lkml]   [2015]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 3/3] leds: Add ktd2692 flash LED driver
Hi Jacek,

On 2015년 04월 01일 15:47, Jacek Anaszewski wrote:
> Hi Ingi,
>
> On 04/01/2015 05:58 AM, Ingi Kim wrote:
>> This patch adds a driver to support the ktd2692 flash LEDs.
>> ktd2692 can control flash current by ExpressWire interface.
>>

...

>> + ktd2692_init_flash_timeout(flash_timeout_us, &flash_timeout);
>> +
>> + fled_cdev->timeout = flash_timeout;
>> + fled_cdev->ops = &flash_ops;
>> +
>> + led_cdev->name = KTD2692_DEFAULT_NAME;
>
> Device Tree label should be used for the LED class device name.
> Please refer to :
> Documentation/devicetree/bindings/leds/common.txt
>
> Also the documentation states that the LED should be represented
> by DT child node of the LED controller.
>
> You can parse the label as follows:
>
> led_cdev->name = of_get_property(child, "label", NULL) ? :
> child->name;
>

Sorry about late comments,
I fix the name and DT such as LED style
Thank you!

>> + led_cdev->brightness_set = ktd2692_led_brightness_set;
>> + led_cdev->brightness_set_sync = ktd2692_led_brightness_set_sync;
>> + led_cdev->flags |= LED_CORE_SUSPENDRESUME | LED_DEV_CAP_FLASH;
>> +
>> + mutex_init(&led->lock);
>> + INIT_WORK(&led->work_brightness_set, ktd2692_brightness_set_work);
>> +
>> + platform_set_drvdata(pdev, led);
>> +
>> + ret = led_classdev_flash_register(&pdev->dev, fled_cdev);
>> + if (ret) {
>> + dev_err(&pdev->dev, "can't register LED %s\n", led_cdev->name);
>> + mutex_destroy(&led->lock);
>> + return ret;
>> + }
>> +
>> + ktd2692_setup(led);
>> +
>> + return 0;
>> +}
>> +
>> +static int ktd2692_remove(struct platform_device *pdev)
>> +{
>> + struct ktd2692_context *led = platform_get_drvdata(pdev);
>> + int ret;
>> +
>> + led_classdev_flash_unregister(&led->fled_cdev);
>> + cancel_work_sync(&led->work_brightness_set);
>> +
>> + ret = regulator_disable(led->regulator);
>> + if (ret)
>> + dev_err(&pdev->dev, "Failed to disable supply: %d\n", ret);
>> +
>> + mutex_destroy(&led->lock);
>> +
>> + return 0;
>> +}
>> +
>> +static const struct of_device_id ktd2692_match[] = {
>> + { .compatible = "kinetic,ktd2692", },
>> + { /* sentinel */ },
>> +};
>> +
>> +static struct platform_driver ktd2692_driver = {
>> + .driver = {
>> + .name = "leds-ktd2692",
>> + .of_match_table = ktd2692_match,
>> + },
>> + .probe = ktd2692_probe,
>> + .remove = ktd2692_remove,
>> +};
>> +
>> +module_platform_driver(ktd2692_driver);
>> +
>> +MODULE_AUTHOR("Ingi Kim <ingi2.kim@samsung.com>");
>> +MODULE_DESCRIPTION("Kinetic KTD2692 LED driver");
>> +MODULE_LICENSE("GPL v2");
>>
>
>


\
 
 \ /
  Last update: 2015-04-10 09:21    [W:0.159 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site