blob: 48541577202a00c3a5919812f8a9372bd32dde2c [file] [log] [blame]
Wey-Yi Guy4bc85c12011-02-21 11:11:05 -08001/******************************************************************************
2 *
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003 * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved.
Wey-Yi Guy4bc85c12011-02-21 11:11:05 -08004 *
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>
Wey-Yi Guy4bc85c12011-02-21 11:11:05 -080035#include <net/mac80211.h>
36#include <linux/etherdevice.h>
37#include <asm/unaligned.h>
38
39#include "iwl-commands.h"
Wey-Yi Guy4bc85c12011-02-21 11:11:05 -080040#include "iwl-dev.h"
Wey-Yi Guybe663ab2011-02-21 11:27:26 -080041#include "iwl-core.h"
42#include "iwl-io.h"
43#include "iwl-4965-led.h"
Wey-Yi Guy4bc85c12011-02-21 11:11:05 -080044
45/* Send led command */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -080046static int
Stanislaw Gruszka46bc8d42011-10-24 16:49:25 +020047il4965_send_led_cmd(struct il_priv *il, struct il_led_cmd *led_cmd)
Wey-Yi Guy4bc85c12011-02-21 11:11:05 -080048{
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +020049 struct il_host_cmd cmd = {
Wey-Yi Guy4bc85c12011-02-21 11:11:05 -080050 .id = REPLY_LEDS_CMD,
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +020051 .len = sizeof(struct il_led_cmd),
Wey-Yi Guy4bc85c12011-02-21 11:11:05 -080052 .data = led_cmd,
53 .flags = CMD_ASYNC,
54 .callback = NULL,
55 };
Wey-Yi Guybe663ab2011-02-21 11:27:26 -080056 u32 reg;
Wey-Yi Guy4bc85c12011-02-21 11:11:05 -080057
Stanislaw Gruszka841b2cc2011-08-24 15:14:03 +020058 reg = _il_rd(il, CSR_LED_REG);
Wey-Yi Guybe663ab2011-02-21 11:27:26 -080059 if (reg != (reg & CSR_LED_BSM_CTRL_MSK))
Stanislaw Gruszka841b2cc2011-08-24 15:14:03 +020060 _il_wr(il, CSR_LED_REG, reg & CSR_LED_BSM_CTRL_MSK);
Wey-Yi Guybe663ab2011-02-21 11:27:26 -080061
Stanislaw Gruszka46bc8d42011-10-24 16:49:25 +020062 return il_send_cmd(il, &cmd);
Wey-Yi Guy4bc85c12011-02-21 11:11:05 -080063}
64
Wey-Yi Guybe663ab2011-02-21 11:27:26 -080065/* Set led register off */
Stanislaw Gruszka46bc8d42011-10-24 16:49:25 +020066void il4965_led_enable(struct il_priv *il)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -080067{
Stanislaw Gruszka841b2cc2011-08-24 15:14:03 +020068 _il_wr(il, CSR_LED_REG, CSR_LED_REG_TRUN_ON);
Wey-Yi Guybe663ab2011-02-21 11:27:26 -080069}
70
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +020071const struct il_led_ops il4965_led_ops = {
72 .cmd = il4965_send_led_cmd,
Wey-Yi Guy4bc85c12011-02-21 11:11:05 -080073};