Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame^] | 3 | * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 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 | |
| 27 | #include <linux/kernel.h> |
| 28 | #include <linux/module.h> |
| 29 | #include <linux/init.h> |
| 30 | #include <linux/pci.h> |
| 31 | #include <linux/dma-mapping.h> |
| 32 | #include <linux/delay.h> |
| 33 | #include <linux/skbuff.h> |
| 34 | #include <linux/netdevice.h> |
| 35 | #include <linux/wireless.h> |
| 36 | #include <net/mac80211.h> |
| 37 | #include <linux/etherdevice.h> |
| 38 | #include <asm/unaligned.h> |
| 39 | |
| 40 | #include "iwl-commands.h" |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 41 | #include "iwl-dev.h" |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame^] | 42 | #include "iwl-core.h" |
| 43 | #include "iwl-io.h" |
| 44 | #include "iwl-4965-led.h" |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 45 | |
| 46 | /* Send led command */ |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame^] | 47 | static int |
| 48 | iwl4965_send_led_cmd(struct iwl_priv *priv, struct iwl_led_cmd *led_cmd) |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 49 | { |
| 50 | struct iwl_host_cmd cmd = { |
| 51 | .id = REPLY_LEDS_CMD, |
| 52 | .len = sizeof(struct iwl_led_cmd), |
| 53 | .data = led_cmd, |
| 54 | .flags = CMD_ASYNC, |
| 55 | .callback = NULL, |
| 56 | }; |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame^] | 57 | u32 reg; |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 58 | |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame^] | 59 | reg = iwl_read32(priv, CSR_LED_REG); |
| 60 | if (reg != (reg & CSR_LED_BSM_CTRL_MSK)) |
| 61 | iwl_write32(priv, CSR_LED_REG, reg & CSR_LED_BSM_CTRL_MSK); |
| 62 | |
| 63 | return iwl_legacy_send_cmd(priv, &cmd); |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 64 | } |
| 65 | |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame^] | 66 | /* Set led register off */ |
| 67 | void iwl4965_led_enable(struct iwl_priv *priv) |
| 68 | { |
| 69 | iwl_write32(priv, CSR_LED_REG, CSR_LED_REG_TRUN_ON); |
| 70 | } |
| 71 | |
| 72 | const struct iwl_led_ops iwl4965_led_ops = { |
| 73 | .cmd = iwl4965_send_led_cmd, |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 74 | }; |