/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * iPAQ microcontroller backlight support * Author : Linus Walleij */ #include #include #include #include #include #include #include static int micro_bl_update_status(struct backlight_device *bd) { struct ipaq_micro *micro = dev_get_drvdata(&bd->dev); int intensity = bd->props.brightness; struct ipaq_micro_msg msg = { .id = MSG_BACKLIGHT, .tx_len = 3, }; if (bd->props.power != FB_BLANK_UNBLANK) intensity = 0; if (bd->props.state & (BL_CORE_FBBLANK | BL_CORE_SUSPENDED)) intensity = 0; /* * Message format: * Byte 0: backlight instance (usually 1) * Byte 1: on/off * Byte 2: intensity, 0-255 */ msg.tx_data[0] = 0x01; msg.tx_data[1] = intensity > 0 ? 1 : 0; msg.tx_data[2] = intensity; return ipaq_micro_tx_msg_sync(micro, &msg); } static const struct backlight_ops micro_bl_ops = { .options = BL_CORE_SUSPENDRESUME, .update_status = micro_bl_update_status, }; static struct backlight_properties micro_bl_props = { .type = BACKLIGHT_RAW, .max_brightness = 255, .power = FB_BLANK_UNBLANK, .brightness = 64, }; static int micro_backlight_probe(struct platform_device *pdev) { struct backlight_device *bd; struct ipaq_micro *micro = dev_get_drvdata(pdev->dev.parent); bd = devm_backlight_device_register(&pdev->dev, "ipaq-micro-backlight", &pdev->dev, micro, µ_bl_ops, µ_bl_props); if (IS_ERR(bd)) return PTR_ERR(bd); platform_set_drvdata(pdev, bd); backlight_update_status(bd); return 0; } static struct platform_driver micro_backlight_device_driver = { .driver = { .name = "ipaq-micro-backlight", }, .probe = micro_backlight_probe, }; module_platform_driver(micro_backlight_device_driver); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("driver for iPAQ Atmel micro backlight"); MODULE_ALIAS("platform:ipaq-micro-backlight"); 963e61f19021f2'>commitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-02-06 14:16:23 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-06 14:16:23 -0800
commit396bf4cd835e62d70fad4a03a8963e61f19021f2 (patch)
tree79ac8f33554260fea1a8d43e6f8c4c5460115f45 /drivers/usb/misc/emi62.c
parentd5adbfcd5f7bcc6fa58a41c5c5ada0e5c826ce2c (diff)
parent7c2cf1c4615cc2f576d0604406cdf0065f00b83b (diff)
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fixes from Herbert Xu: - use-after-free in algif_aead - modular aesni regression when pcbc is modular but absent - bug causing IO page faults in ccp - double list add in ccp - NULL pointer dereference in qat (two patches) - panic in chcr - NULL pointer dereference in chcr - out-of-bound access in chcr * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: crypto: chcr - Fix key length for RFC4106 crypto: algif_aead - Fix kernel panic on list_del crypto: aesni - Fix failure when pcbc module is absent crypto: ccp - Fix double add when creating new DMA command crypto: ccp - Fix DMA operations when IOMMU is enabled crypto: chcr - Check device is allocated before use crypto: chcr - Fix panic on dma_unmap_sg crypto: qat - zero esram only for DH85x devices crypto: qat - fix bar discovery for c62x
Diffstat (limited to 'drivers/usb/misc/emi62.c')