iwl-3945-led.c 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2003 - 2010 Intel Corporation. All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17. *
  18. * The full GNU General Public License is included in this distribution in the
  19. * file called LICENSE.
  20. *
  21. * Contact Information:
  22. * Intel Linux Wireless <ilw@linux.intel.com>
  23. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  24. *
  25. *****************************************************************************/
  26. #include <linux/kernel.h>
  27. #include <linux/module.h>
  28. #include <linux/init.h>
  29. #include <linux/pci.h>
  30. #include <linux/dma-mapping.h>
  31. #include <linux/delay.h>
  32. #include <linux/skbuff.h>
  33. #include <linux/netdevice.h>
  34. #include <linux/wireless.h>
  35. #include <net/mac80211.h>
  36. #include <linux/etherdevice.h>
  37. #include <asm/unaligned.h>
  38. #include "iwl-commands.h"
  39. #include "iwl-3945.h"
  40. #include "iwl-core.h"
  41. #include "iwl-dev.h"
  42. #include "iwl-3945-led.h"
  43. /* Send led command */
  44. static int iwl3945_send_led_cmd(struct iwl_priv *priv,
  45. struct iwl_led_cmd *led_cmd)
  46. {
  47. struct iwl_host_cmd cmd = {
  48. .id = REPLY_LEDS_CMD,
  49. .len = sizeof(struct iwl_led_cmd),
  50. .data = led_cmd,
  51. .flags = CMD_ASYNC,
  52. .callback = NULL,
  53. };
  54. return iwl_send_cmd(priv, &cmd);
  55. }
  56. /* Set led on command */
  57. static int iwl3945_led_on(struct iwl_priv *priv)
  58. {
  59. struct iwl_led_cmd led_cmd = {
  60. .id = IWL_LED_LINK,
  61. .on = IWL_LED_SOLID,
  62. .off = 0,
  63. .interval = IWL_DEF_LED_INTRVL
  64. };
  65. return iwl3945_send_led_cmd(priv, &led_cmd);
  66. }
  67. /* Set led off command */
  68. static int iwl3945_led_off(struct iwl_priv *priv)
  69. {
  70. struct iwl_led_cmd led_cmd = {
  71. .id = IWL_LED_LINK,
  72. .on = 0,
  73. .off = 0,
  74. .interval = IWL_DEF_LED_INTRVL
  75. };
  76. IWL_DEBUG_LED(priv, "led off\n");
  77. return iwl3945_send_led_cmd(priv, &led_cmd);
  78. }
  79. const struct iwl_led_ops iwl3945_led_ops = {
  80. .cmd = iwl3945_send_led_cmd,
  81. .on = iwl3945_led_on,
  82. .off = iwl3945_led_off,
  83. };