Re: [PATCH v5 3/3] leds: Add ktd2692 flash LED driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxxx>");
>> +MODULE_DESCRIPTION("Kinetic KTD2692 LED driver");
>> +MODULE_LICENSE("GPL v2");
>>
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux