blob: abe2b739c4dc33eb4dea2565bfd36b11e4801196 [file] [log] [blame]
Mohamed Abbasab53d8a2008-03-25 16:33:36 -07001/******************************************************************************
2 *
Reinette Chatre1f447802010-01-15 13:43:41 -08003 * Copyright(c) 2003 - 2010 Intel Corporation. All rights reserved.
Mohamed Abbasab53d8a2008-03-25 16:33:36 -07004 *
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:
Winkler, Tomas759ef892008-12-09 11:28:58 -080022 * Intel Linux Wireless <ilw@linux.intel.com>
Mohamed Abbasab53d8a2008-03-25 16:33:36 -070023 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
24 *
25 *****************************************************************************/
26
Mohamed Abbasab53d8a2008-03-25 16:33:36 -070027#include <linux/kernel.h>
28#include <linux/module.h>
Mohamed Abbasab53d8a2008-03-25 16:33:36 -070029#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
Tomas Winkler600c0e12008-12-19 10:37:04 +080040#include "iwl-commands.h"
Mohamed Abbasab53d8a2008-03-25 16:33:36 -070041#include "iwl-3945.h"
Samuel Ortiz518099a2009-01-19 15:30:27 -080042#include "iwl-core.h"
43#include "iwl-dev.h"
Johannes Berge932a602009-10-02 13:44:03 -070044#include "iwl-3945-led.h"
Mohamed Abbasab53d8a2008-03-25 16:33:36 -070045
Mohamed Abbasab53d8a2008-03-25 16:33:36 -070046
47/* Send led command */
Johannes Berge932a602009-10-02 13:44:03 -070048static int iwl3945_send_led_cmd(struct iwl_priv *priv,
49 struct iwl_led_cmd *led_cmd)
Mohamed Abbasab53d8a2008-03-25 16:33:36 -070050{
Winkler, Tomasc2d79b482008-12-19 10:37:34 +080051 struct iwl_host_cmd cmd = {
Mohamed Abbasab53d8a2008-03-25 16:33:36 -070052 .id = REPLY_LEDS_CMD,
Tomas Winkler4c897252008-12-19 10:37:05 +080053 .len = sizeof(struct iwl_led_cmd),
Mohamed Abbasab53d8a2008-03-25 16:33:36 -070054 .data = led_cmd,
Johannes Bergc2acea82009-07-24 11:13:05 -070055 .flags = CMD_ASYNC,
Johannes Berge932a602009-10-02 13:44:03 -070056 .callback = NULL,
Mohamed Abbasab53d8a2008-03-25 16:33:36 -070057 };
58
Samuel Ortiz518099a2009-01-19 15:30:27 -080059 return iwl_send_cmd(priv, &cmd);
Mohamed Abbasab53d8a2008-03-25 16:33:36 -070060}
61
Abhijeet Kolekar9a9ad0c2008-07-11 11:53:41 +080062/* Set led on command */
Johannes Berge932a602009-10-02 13:44:03 -070063static int iwl3945_led_on(struct iwl_priv *priv)
Abhijeet Kolekar9a9ad0c2008-07-11 11:53:41 +080064{
Tomas Winkler4c897252008-12-19 10:37:05 +080065 struct iwl_led_cmd led_cmd = {
Johannes Berge932a602009-10-02 13:44:03 -070066 .id = IWL_LED_LINK,
Mohamed Abbasab53d8a2008-03-25 16:33:36 -070067 .on = IWL_LED_SOLID,
68 .off = 0,
69 .interval = IWL_DEF_LED_INTRVL
70 };
Johannes Berge932a602009-10-02 13:44:03 -070071 return iwl3945_send_led_cmd(priv, &led_cmd);
Mohamed Abbasab53d8a2008-03-25 16:33:36 -070072}
73
Mohamed Abbasab53d8a2008-03-25 16:33:36 -070074/* Set led off command */
Johannes Berge932a602009-10-02 13:44:03 -070075static int iwl3945_led_off(struct iwl_priv *priv)
Mohamed Abbasab53d8a2008-03-25 16:33:36 -070076{
Tomas Winkler4c897252008-12-19 10:37:05 +080077 struct iwl_led_cmd led_cmd = {
Johannes Berge932a602009-10-02 13:44:03 -070078 .id = IWL_LED_LINK,
Mohamed Abbasab53d8a2008-03-25 16:33:36 -070079 .on = 0,
80 .off = 0,
81 .interval = IWL_DEF_LED_INTRVL
82 };
Johannes Berge932a602009-10-02 13:44:03 -070083 IWL_DEBUG_LED(priv, "led off\n");
84 return iwl3945_send_led_cmd(priv, &led_cmd);
Mohamed Abbasab53d8a2008-03-25 16:33:36 -070085}
Mohamed Abbasab53d8a2008-03-25 16:33:36 -070086
Johannes Berge932a602009-10-02 13:44:03 -070087const struct iwl_led_ops iwl3945_led_ops = {
88 .cmd = iwl3945_send_led_cmd,
89 .on = iwl3945_led_on,
90 .off = iwl3945_led_off,
91};