mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 06:25:52 +02:00
temp revert rk change
This commit is contained in:
parent
3c3de0df8b
commit
15f7fabcb8
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -31,7 +31,6 @@ modules.builtin
|
|||
*.lzo
|
||||
*.patch
|
||||
*.gcno
|
||||
Untitled Project.*
|
||||
|
||||
#
|
||||
# Top-level generic files
|
||||
|
|
@ -44,7 +43,6 @@ Untitled Project.*
|
|||
/System.map
|
||||
/Module.markers
|
||||
/Module.symvers
|
||||
/kernel.img
|
||||
|
||||
#
|
||||
# git files that we don't want to ignore even it they are dot-files
|
||||
|
|
@ -58,7 +56,6 @@ Untitled Project.*
|
|||
include/config
|
||||
include/linux/version.h
|
||||
include/generated
|
||||
include/asm-arm/mach-types.h
|
||||
|
||||
# stgit generated dirs
|
||||
patches-*
|
||||
|
|
|
|||
|
|
@ -246,10 +246,6 @@ not_relocated: mov r0, #0
|
|||
* pointers, and start decompressing.
|
||||
*/
|
||||
bl cache_on
|
||||
#ifdef CONFIG_ARCH_RK29
|
||||
bl cache_off
|
||||
bl cache_on
|
||||
#endif
|
||||
|
||||
mov r1, sp @ malloc space above stack
|
||||
add r2, sp, #0x10000 @ 64k max
|
||||
|
|
|
|||
|
|
@ -94,7 +94,6 @@ void gic_ack_irq(unsigned int irq)
|
|||
spin_lock(&irq_controller_lock);
|
||||
writel(mask, gic_dist_base(irq) + GIC_DIST_ENABLE_CLEAR + (gic_irq(irq) / 32) * 4);
|
||||
writel(gic_irq(irq), gic_cpu_base(irq) + GIC_CPU_EOI);
|
||||
dsb();
|
||||
spin_unlock(&irq_controller_lock);
|
||||
}
|
||||
|
||||
|
|
@ -104,7 +103,6 @@ void gic_mask_irq(unsigned int irq)
|
|||
|
||||
spin_lock(&irq_controller_lock);
|
||||
writel(mask, gic_dist_base(irq) + GIC_DIST_ENABLE_CLEAR + (gic_irq(irq) / 32) * 4);
|
||||
dsb();
|
||||
spin_unlock(&irq_controller_lock);
|
||||
}
|
||||
|
||||
|
|
@ -114,7 +112,6 @@ void gic_unmask_irq(unsigned int irq)
|
|||
|
||||
spin_lock(&irq_controller_lock);
|
||||
writel(mask, gic_dist_base(irq) + GIC_DIST_ENABLE_SET + (gic_irq(irq) / 32) * 4);
|
||||
dsb();
|
||||
spin_unlock(&irq_controller_lock);
|
||||
}
|
||||
|
||||
|
|
@ -211,13 +208,6 @@ static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
|
|||
chip->unmask(irq);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_PM) && defined(CONFIG_ARCH_RK29)
|
||||
static int gic_set_wake(unsigned int irq, unsigned int on)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct irq_chip gic_chip = {
|
||||
.name = "GIC",
|
||||
.ack = gic_ack_irq,
|
||||
|
|
@ -227,9 +217,6 @@ static struct irq_chip gic_chip = {
|
|||
#ifdef CONFIG_SMP
|
||||
.set_affinity = gic_set_cpu,
|
||||
#endif
|
||||
#if defined(CONFIG_PM) && defined(CONFIG_ARCH_RK29)
|
||||
.set_wake = gic_set_wake,
|
||||
#endif
|
||||
};
|
||||
|
||||
void __init gic_cascade_irq(unsigned int gic_nr, unsigned int irq)
|
||||
|
|
@ -252,16 +239,11 @@ static unsigned int _gic_dist_init(unsigned int gic_nr)
|
|||
|
||||
writel(0, base + GIC_DIST_CTRL);
|
||||
|
||||
#ifdef CONFIG_ARCH_RK29
|
||||
/* rk29 read GIC_DIST_CTR is 2, why? */
|
||||
max_irq = NR_AIC_IRQS;
|
||||
#else
|
||||
/*
|
||||
* Find out how many interrupts are supported.
|
||||
*/
|
||||
max_irq = readl(base + GIC_DIST_CTR) & 0x1f;
|
||||
max_irq = (max_irq + 1) * 32;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The GIC only supports up to 1020 interrupt sources.
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ CFLAGS_REMOVE_return_address.o = -pg
|
|||
|
||||
obj-y := elf.o entry-armv.o entry-common.o irq.o \
|
||||
process.o ptrace.o return_address.o setup.o signal.o \
|
||||
sys_arm.o stacktrace.o time.o traps.o dma.o
|
||||
sys_arm.o stacktrace.o time.o traps.o
|
||||
|
||||
obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o
|
||||
|
||||
|
|
@ -29,7 +29,6 @@ obj-$(CONFIG_MODULES) += armksyms.o module.o
|
|||
obj-$(CONFIG_ARTHUR) += arthur.o
|
||||
obj-$(CONFIG_ISA_DMA) += dma-isa.o
|
||||
obj-$(CONFIG_PCI) += bios32.o isa.o
|
||||
obj-$(CONFIG_HAVE_SCHED_CLOCK) += sched_clock.o
|
||||
obj-$(CONFIG_SMP) += smp.o
|
||||
obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o
|
||||
obj-$(CONFIG_HAVE_ARM_TWD) += smp_twd.o
|
||||
|
|
|
|||
|
|
@ -302,17 +302,6 @@ __v7_setup:
|
|||
* NS1 = PRRR[19] = 1 - normal shareable property
|
||||
* NOS = PRRR[24+n] = 1 - not outer shareable
|
||||
*/
|
||||
#ifdef CONFIG_ARCH_RK29
|
||||
/* Setup L2 cache */
|
||||
mrc p15, 1, r5, c9, c0, 2
|
||||
bic r5, r5, #1 << 29 @ L2 data RAM read multiplexer select: 0 = two cycles
|
||||
bic r5, r5, #7 << 6
|
||||
bic r5, r5, #15
|
||||
orr r5, r5, #2 << 6 @ Tag RAM latency: b010 = 3 cycles
|
||||
orr r5, r5, #3 @ Data RAM latency: b0011 = 4 cycles
|
||||
mcr p15, 1, r5, c9, c0, 2
|
||||
#endif
|
||||
|
||||
ldr r5, =0xff0a89a8 @ PRRR
|
||||
#ifdef CONFIG_SMP
|
||||
ldr r6, =0xc0e0c4e0 @ NMRR
|
||||
|
|
|
|||
|
|
@ -1608,6 +1608,7 @@ kb9263 MACH_KB9263 KB9263 1612
|
|||
mt7108 MACH_MT7108 MT7108 1613
|
||||
smtr2440 MACH_SMTR2440 SMTR2440 1614
|
||||
manao MACH_MANAO MANAO 1615
|
||||
cm_x300 MACH_CM_X300 CM_X300 1616
|
||||
gulfstream_kp MACH_GULFSTREAM_KP GULFSTREAM_KP 1617
|
||||
lanreadyfn522 MACH_LANREADYFN522 LANREADYFN522 1618
|
||||
arma37 MACH_ARMA37 ARMA37 1619
|
||||
|
|
@ -2911,8 +2912,7 @@ smdkv310 MACH_SMDKV310 SMDKV310 2925
|
|||
siemens_l0 MACH_SIEMENS_L0 SIEMENS_L0 2926
|
||||
ventana MACH_VENTANA VENTANA 2927
|
||||
wm8505_7in_netbook MACH_WM8505_7IN_NETBOOK WM8505_7IN_NETBOOK 2928
|
||||
rk29 MACH_RK29 RK29 2929
|
||||
#ec4350sdb MACH_EC4350SDB EC4350SDB 2929
|
||||
ec4350sdb MACH_EC4350SDB EC4350SDB 2929
|
||||
mimas MACH_MIMAS MIMAS 2930
|
||||
titan MACH_TITAN TITAN 2931
|
||||
craneboard MACH_CRANEBOARD CRANEBOARD 2932
|
||||
|
|
|
|||
|
|
@ -206,23 +206,6 @@ ENTRY(vfp_save_state)
|
|||
mov pc, lr
|
||||
ENDPROC(vfp_save_state)
|
||||
|
||||
ENTRY(vfp_load_state)
|
||||
@ Save the current VFP state
|
||||
@ r0 - save location
|
||||
@ r1 - FPEXC
|
||||
DBGSTR1 "save VFP state %p", r0
|
||||
VFPFLDMIA r0, r2 @ save the working registers
|
||||
ldmia r0, {r1,r2,r3,r12}
|
||||
tst r1, #FPEXC_EX @ is there additional state to save?
|
||||
beq 1f
|
||||
tst r1, #FPEXC_FP2V @ is there an FPINST2 to read?
|
||||
beq 1f
|
||||
1:
|
||||
VFPFMXR FPSCR, r2
|
||||
VFPFMXR FPEXC, r1
|
||||
mov pc, lr
|
||||
ENDPROC(vfp_load_state)
|
||||
|
||||
last_VFP_context_address:
|
||||
.word last_VFP_context
|
||||
|
||||
|
|
|
|||
|
|
@ -50,10 +50,6 @@ source "drivers/i2c/Kconfig"
|
|||
|
||||
source "drivers/spi/Kconfig"
|
||||
|
||||
source "drivers/adc/Kconfig"
|
||||
|
||||
source "drivers/headset_observe/Kconfig"
|
||||
|
||||
source "drivers/pps/Kconfig"
|
||||
|
||||
source "drivers/gpio/Kconfig"
|
||||
|
|
@ -117,13 +113,4 @@ source "drivers/xen/Kconfig"
|
|||
source "drivers/staging/Kconfig"
|
||||
|
||||
source "drivers/platform/Kconfig"
|
||||
|
||||
source "drivers/cmmb/Kconfig"
|
||||
|
||||
source "drivers/testcode/Kconfig"
|
||||
|
||||
source "drivers/smc/Kconfig"
|
||||
|
||||
source "drivers/cir/Kconfig"
|
||||
|
||||
endmenu
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ obj-$(CONFIG_SCSI) += scsi/
|
|||
obj-$(CONFIG_ATA) += ata/
|
||||
obj-$(CONFIG_MTD) += mtd/
|
||||
obj-$(CONFIG_SPI) += spi/
|
||||
obj-y += headset_observe/
|
||||
obj-y += net/
|
||||
obj-$(CONFIG_ATM) += atm/
|
||||
obj-$(CONFIG_FUSION) += message/
|
||||
|
|
@ -66,16 +65,16 @@ obj-$(CONFIG_PARIDE) += block/paride/
|
|||
obj-$(CONFIG_TC) += tc/
|
||||
obj-$(CONFIG_UWB) += uwb/
|
||||
obj-$(CONFIG_USB_OTG_UTILS) += usb/otg/
|
||||
obj-$(CONFIG_USB_SUPPORT) += usb/
|
||||
obj-$(CONFIG_USB) += usb/
|
||||
obj-$(CONFIG_USB_MUSB_HDRC) += usb/musb/
|
||||
obj-$(CONFIG_PCI) += usb/
|
||||
obj-$(CONFIG_USB_GADGET) += usb/gadget/
|
||||
obj-$(CONFIG_SERIO) += input/serio/
|
||||
obj-$(CONFIG_GAMEPORT) += input/gameport/
|
||||
obj-$(CONFIG_INPUT) += input/
|
||||
obj-$(CONFIG_I2O) += message/
|
||||
obj-$(CONFIG_RTC_LIB) += rtc/
|
||||
obj-y += i2c/ media/
|
||||
obj-y += adc/
|
||||
obj-$(CONFIG_PPS) += pps/
|
||||
obj-$(CONFIG_W1) += w1/
|
||||
obj-$(CONFIG_POWER_SUPPLY) += power/
|
||||
|
|
@ -117,9 +116,3 @@ obj-$(CONFIG_VLYNQ) += vlynq/
|
|||
obj-$(CONFIG_STAGING) += staging/
|
||||
obj-y += platform/
|
||||
obj-y += ieee802154/
|
||||
obj-$(CONFIG_CMMB) += cmmb/
|
||||
obj-$(CONFIG_TEST_CODE) += testcode/
|
||||
obj-y += smc/
|
||||
obj-y += cir/
|
||||
obj-y += dbg/
|
||||
|
||||
|
|
|
|||
|
|
@ -27,9 +27,6 @@
|
|||
#include <linux/sched.h>
|
||||
#include <linux/async.h>
|
||||
#include <linux/timer.h>
|
||||
#ifdef CONFIG_ARCH_RK29
|
||||
#include <linux/console.h>
|
||||
#endif
|
||||
|
||||
#include "../base.h"
|
||||
#include "power.h"
|
||||
|
|
@ -614,9 +611,6 @@ static void dpm_drv_timeout(unsigned long data)
|
|||
printk(KERN_EMERG "**** DPM device timeout: %s (%s)\n", dev_name(dev),
|
||||
(dev->driver ? dev->driver->name : "no driver"));
|
||||
|
||||
#ifdef CONFIG_ARCH_RK29
|
||||
resume_console();
|
||||
#endif
|
||||
printk(KERN_EMERG "dpm suspend stack:\n");
|
||||
show_stack(tsk, NULL);
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ obj-$(CONFIG_CONSOLE_TRANSLATIONS) += consolemap.o consolemap_deftbl.o
|
|||
obj-$(CONFIG_HW_CONSOLE) += vt.o defkeymap.o
|
||||
obj-$(CONFIG_AUDIT) += tty_audit.o
|
||||
obj-$(CONFIG_MAGIC_SYSRQ) += sysrq.o
|
||||
obj-$(CONFIG_MAGIC_SYSRQ) += rk_sysrq.o
|
||||
obj-$(CONFIG_MVME147_SCC) += generic_serial.o vme_scc.o
|
||||
obj-$(CONFIG_MVME162_SCC) += generic_serial.o vme_scc.o
|
||||
obj-$(CONFIG_BVME6000_SCC) += generic_serial.o vme_scc.o
|
||||
|
|
|
|||
|
|
@ -30,13 +30,8 @@
|
|||
|
||||
#define DEF_FREQUENCY_DOWN_DIFFERENTIAL (10)
|
||||
#define DEF_FREQUENCY_UP_THRESHOLD (80)
|
||||
#ifdef CONFIG_ARCH_RK29
|
||||
#define MICRO_FREQUENCY_DOWN_DIFFERENTIAL (10)
|
||||
#define MICRO_FREQUENCY_UP_THRESHOLD (80)
|
||||
#else
|
||||
#define MICRO_FREQUENCY_DOWN_DIFFERENTIAL (3)
|
||||
#define MICRO_FREQUENCY_UP_THRESHOLD (95)
|
||||
#endif
|
||||
#define MICRO_FREQUENCY_MIN_SAMPLE_RATE (10000)
|
||||
#define MIN_FREQUENCY_UP_THRESHOLD (11)
|
||||
#define MAX_FREQUENCY_UP_THRESHOLD (100)
|
||||
|
|
|
|||
|
|
@ -1421,8 +1421,6 @@ int gpio_direction_output(unsigned gpio, int value)
|
|||
|
||||
spin_lock_irqsave(&gpio_lock, flags);
|
||||
|
||||
if (value !=0 && value !=1)
|
||||
goto fail;
|
||||
if (!gpio_is_valid(gpio))
|
||||
goto fail;
|
||||
chip = desc->chip;
|
||||
|
|
@ -1467,67 +1465,6 @@ int gpio_direction_output(unsigned gpio, int value)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(gpio_direction_output);
|
||||
|
||||
/*
|
||||
gpio pull up or pull down
|
||||
value = 0, normal
|
||||
value = 1, pull up
|
||||
value = 2, pull down
|
||||
*/
|
||||
int gpio_pull_updown(unsigned gpio, unsigned value)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct gpio_chip *chip;
|
||||
struct gpio_desc *desc = &gpio_desc[gpio];
|
||||
int status = -EINVAL;
|
||||
|
||||
spin_lock_irqsave(&gpio_lock, flags);
|
||||
|
||||
if (value >3)
|
||||
goto fail;
|
||||
if (!gpio_is_valid(gpio))
|
||||
goto fail;
|
||||
chip = desc->chip;
|
||||
if (!chip || !chip->get || !chip->pull_updown)
|
||||
goto fail;
|
||||
gpio -= chip->base;
|
||||
if (gpio >= chip->ngpio)
|
||||
goto fail;
|
||||
status = gpio_ensure_requested(desc, gpio);
|
||||
if (status < 0)
|
||||
goto fail;
|
||||
|
||||
/* now we know the gpio is valid and chip won't vanish */
|
||||
|
||||
spin_unlock_irqrestore(&gpio_lock, flags);
|
||||
|
||||
might_sleep_if(extra_checks && chip->can_sleep);
|
||||
|
||||
if (status) {
|
||||
status = chip->request(chip, gpio);
|
||||
if (status < 0) {
|
||||
pr_debug("GPIO-%d: chip request fail, %d\n",
|
||||
chip->base + gpio, status);
|
||||
/* and it's not available to anyone else ...
|
||||
* gpio_request() is the fully clean solution.
|
||||
*/
|
||||
goto lose;
|
||||
}
|
||||
}
|
||||
status = chip->pull_updown(chip, gpio,value);
|
||||
if (status == 0)
|
||||
clear_bit(FLAG_IS_OUT, &desc->flags);
|
||||
|
||||
lose:
|
||||
return status;
|
||||
fail:
|
||||
spin_unlock_irqrestore(&gpio_lock, flags);
|
||||
if (status)
|
||||
pr_debug("%s: gpio-%d status %d\n",
|
||||
__func__, gpio, status);
|
||||
return status;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(gpio_pull_updown);
|
||||
|
||||
/**
|
||||
* gpio_set_debounce - sets @debounce time for a @gpio
|
||||
* @gpio: the gpio to set debounce time
|
||||
|
|
@ -1606,9 +1543,7 @@ EXPORT_SYMBOL_GPL(gpio_set_debounce);
|
|||
int __gpio_get_value(unsigned gpio)
|
||||
{
|
||||
struct gpio_chip *chip;
|
||||
|
||||
if (!gpio_is_valid(gpio))
|
||||
return -1;
|
||||
|
||||
chip = gpio_to_chip(gpio);
|
||||
WARN_ON(chip->can_sleep);
|
||||
return chip->get ? chip->get(chip, gpio - chip->base) : 0;
|
||||
|
|
@ -1628,10 +1563,6 @@ void __gpio_set_value(unsigned gpio, int value)
|
|||
{
|
||||
struct gpio_chip *chip;
|
||||
|
||||
if(value !=0 && value !=1)
|
||||
return;
|
||||
if (!gpio_is_valid(gpio))
|
||||
return;
|
||||
chip = gpio_to_chip(gpio);
|
||||
WARN_ON(chip->can_sleep);
|
||||
chip->set(chip, gpio - chip->base, value);
|
||||
|
|
@ -1669,13 +1600,9 @@ EXPORT_SYMBOL_GPL(__gpio_cansleep);
|
|||
int __gpio_to_irq(unsigned gpio)
|
||||
{
|
||||
struct gpio_chip *chip;
|
||||
|
||||
if (!gpio_is_valid(gpio))
|
||||
return -1;
|
||||
|
||||
|
||||
chip = gpio_to_chip(gpio);
|
||||
|
||||
return chip->to_irq ? chip->to_irq(chip, gpio - chip->base) : -1;
|
||||
return chip->to_irq ? chip->to_irq(chip, gpio - chip->base) : -ENXIO;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__gpio_to_irq);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,364 +0,0 @@
|
|||
/*
|
||||
* tps65910_gpio.c -- access to GPIOs on TPS65910x chips
|
||||
*
|
||||
* Copyright (C) 2010 Mistral solutions Pvt Ltd <www.mistralsolutions.com>
|
||||
*
|
||||
* Based on twl4030-gpio.c
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include <linux/i2c/tps65910.h>
|
||||
|
||||
static int gpio_tps65910_remove(struct platform_device *pdev);
|
||||
|
||||
/*
|
||||
* The GPIO "subchip" supports 1 GPIOs which can be configured as
|
||||
* inputs or outputs, with pullups or pulldowns on each pin. Each
|
||||
* GPIO can trigger interrupts on either or both edges.
|
||||
*/
|
||||
|
||||
|
||||
/* Data structures */
|
||||
static struct gpio_chip tps65910_gpiochip;
|
||||
static DEFINE_MUTEX(gpio_lock);
|
||||
static unsigned int gpio_usage_count;
|
||||
static struct work_struct gpio_work;
|
||||
static struct mutex work_lock;
|
||||
/*
|
||||
* To configure TPS65910 GPIO registers
|
||||
*/
|
||||
static inline int gpio_tps65910_write(u8 address, u8 data)
|
||||
{
|
||||
return tps65910_i2c_write_u8(TPS65910_I2C_ID0, data, address);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* To read a TPS65910 GPIO module register
|
||||
*/
|
||||
static inline int gpio_tps65910_read(u8 address)
|
||||
{
|
||||
u8 data;
|
||||
int ret = 0;
|
||||
|
||||
ret = tps65910_i2c_read_u8(TPS65910_I2C_ID0, &data, address);
|
||||
return (ret < 0) ? ret : data;
|
||||
}
|
||||
|
||||
static int tps65910_request(struct gpio_chip *chip, unsigned offset)
|
||||
{
|
||||
int status = 0;
|
||||
|
||||
mutex_lock(&gpio_lock);
|
||||
|
||||
/* initialize TPS65910 GPIO */
|
||||
/* By default the GPIO_CKSYNC signal is GPIO */
|
||||
if (!gpio_usage_count)
|
||||
gpio_usage_count++;
|
||||
|
||||
mutex_unlock(&gpio_lock);
|
||||
return status;
|
||||
}
|
||||
|
||||
static void tps65910_free(struct gpio_chip *chip, unsigned offset)
|
||||
{
|
||||
mutex_lock(&gpio_lock);
|
||||
|
||||
/* on last use, switch off GPIO module */
|
||||
if (!gpio_usage_count)
|
||||
gpio_usage_count--;
|
||||
|
||||
mutex_unlock(&gpio_lock);
|
||||
}
|
||||
|
||||
static int tps65910_direction_in(struct gpio_chip *chip, unsigned offset)
|
||||
{
|
||||
/* Configure TPS65910 GPIO as input */
|
||||
u8 val;
|
||||
|
||||
mutex_lock(&gpio_lock);
|
||||
|
||||
val = gpio_tps65910_read(TPS65910_REG_GPIO0);
|
||||
|
||||
val &= ~(TPS65910_GPIO_CFG_OUTPUT);
|
||||
|
||||
val = gpio_tps65910_read(TPS65910_REG_GPIO0);
|
||||
|
||||
mutex_unlock(&gpio_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tps65910_get(struct gpio_chip *chip, unsigned offset)
|
||||
{
|
||||
int status = 0;
|
||||
|
||||
mutex_lock(&gpio_lock);
|
||||
|
||||
status = gpio_tps65910_read(TPS65910_REG_GPIO0);
|
||||
|
||||
mutex_unlock(&gpio_lock);
|
||||
if (status & 0x01)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
static
|
||||
int tps65910_direction_out(struct gpio_chip *chip, unsigned offset, int value)
|
||||
{
|
||||
/* Configure TPS65910 GPIO as input */
|
||||
u8 val;
|
||||
u32 ret;
|
||||
mutex_lock(&gpio_lock);
|
||||
val = gpio_tps65910_read(TPS65910_REG_GPIO0);
|
||||
|
||||
val |= TPS65910_GPIO_CFG_OUTPUT;
|
||||
|
||||
ret = gpio_tps65910_write(TPS65910_REG_GPIO0, val);
|
||||
mutex_unlock(&gpio_lock);
|
||||
|
||||
if (ret != 0)
|
||||
return -EIO;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void tps65910_set(struct gpio_chip *chip, unsigned offset, int value)
|
||||
{
|
||||
int val = 0;
|
||||
u32 ret;
|
||||
|
||||
mutex_lock(&gpio_lock);
|
||||
val = gpio_tps65910_read(TPS65910_REG_GPIO0);
|
||||
|
||||
if (value == 1)
|
||||
val |= 0x01;
|
||||
else
|
||||
val &= 0xFE;
|
||||
|
||||
ret = gpio_tps65910_write(TPS65910_REG_GPIO0, val);
|
||||
|
||||
mutex_unlock(&gpio_lock);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void tps65910_gpio_set_debounce(u8 debounce)
|
||||
{
|
||||
u8 val;
|
||||
|
||||
mutex_lock(&gpio_lock);
|
||||
|
||||
val = gpio_tps65910_read(TPS65910_REG_GPIO0);
|
||||
|
||||
if (debounce == TPS65910_DEBOUNCE_91_5_MS)
|
||||
val = (0<<4);
|
||||
else if (debounce == TPS65910_DEBOUNCE_150_MS)
|
||||
val = (1<<4);
|
||||
else
|
||||
printk(KERN_ERR "Invalid argument to %s\n", __func__);
|
||||
|
||||
gpio_tps65910_write(TPS65910_REG_GPIO0, val);
|
||||
|
||||
mutex_unlock(&gpio_lock);
|
||||
}
|
||||
EXPORT_SYMBOL(tps65910_gpio_set_debounce);
|
||||
|
||||
|
||||
static void tps65910_gpio_pullup_enable(void)
|
||||
{
|
||||
u8 val;
|
||||
u32 ret;
|
||||
|
||||
mutex_lock(&gpio_lock);
|
||||
|
||||
val = gpio_tps65910_read(TPS65910_REG_GPIO0);
|
||||
|
||||
val = (1<<3);
|
||||
|
||||
ret = gpio_tps65910_write(TPS65910_REG_GPIO0, val);
|
||||
|
||||
mutex_unlock(&gpio_lock);
|
||||
|
||||
if (ret != 0)
|
||||
printk(KERN_ERR "Error writing to TPS65910_REG_GPIO0 in %s \n",
|
||||
__func__);
|
||||
}
|
||||
EXPORT_SYMBOL(tps65910_gpio_pullup_enable);
|
||||
|
||||
static void tps65910_gpio_pullup_disable(void)
|
||||
{
|
||||
u8 val;
|
||||
u32 ret;
|
||||
|
||||
mutex_lock(&gpio_lock);
|
||||
|
||||
val = gpio_tps65910_read(TPS65910_REG_GPIO0);
|
||||
|
||||
val = (0<<3);
|
||||
|
||||
ret = gpio_tps65910_write(TPS65910_REG_GPIO0, val);
|
||||
|
||||
mutex_unlock(&gpio_lock);
|
||||
}
|
||||
EXPORT_SYMBOL(tps65910_gpio_pullup_disable);
|
||||
|
||||
static void tps65910_gpio_work(struct work_struct *work)
|
||||
{
|
||||
|
||||
/* Read the status register and take action */
|
||||
u8 status2;
|
||||
int err;
|
||||
mutex_lock(&work_lock);
|
||||
err = tps65910_i2c_read_u8(TPS65910_I2C_ID0, &status2,
|
||||
TPS65910_REG_INT_STS);
|
||||
if (!err) {
|
||||
switch (status2) {
|
||||
case TPS65910_GPIO_F_IT:
|
||||
printk(KERN_NOTICE "Received TPS65910 GPIO falling \
|
||||
edge interrupt \n");
|
||||
/* Clear interrupt */
|
||||
tps65910_i2c_write_u8(TPS65910_I2C_ID0, status2,
|
||||
TPS65910_REG_INT_STS);
|
||||
/* Add code accroding to board requirment */
|
||||
break;
|
||||
case TPS65910_GPIO_R_IT:
|
||||
printk(KERN_NOTICE "Received TPS65910 GPIO Raising \
|
||||
edge interrupt \n");
|
||||
/* Clear interrupt */
|
||||
tps65910_i2c_write_u8(TPS65910_I2C_ID0, status2,
|
||||
TPS65910_REG_INT_STS);
|
||||
/* Add code accroding to board requirment */
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
printk(KERN_ERR"Could not read TPS65910_REG_INT_STS\n");
|
||||
}
|
||||
|
||||
mutex_unlock(&work_lock);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
static irqreturn_t tps65910_gpio_isr(int irq, void *_tps65910)
|
||||
{
|
||||
/* Disable IRQ, schedule work, enable IRQ and acknowledge */
|
||||
disable_irq(irq);
|
||||
(void) schedule_work(&gpio_work);
|
||||
enable_irq(irq);
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
|
||||
static struct gpio_chip tps65910_gpiochip = {
|
||||
.label = "tps65910",
|
||||
.owner = THIS_MODULE,
|
||||
.request = tps65910_request,
|
||||
.free = tps65910_free,
|
||||
.direction_input = tps65910_direction_in,
|
||||
.get = tps65910_get,
|
||||
.direction_output = tps65910_direction_out,
|
||||
.set = tps65910_set,
|
||||
};
|
||||
|
||||
|
||||
static int __devinit gpio_tps65910_probe(struct platform_device *pdev)
|
||||
{
|
||||
int ret = -1;
|
||||
int status = 0;
|
||||
|
||||
struct tps65910_gpio *pdata = pdev->dev.platform_data;
|
||||
|
||||
if (pdata->gpio_mode == TPS65910_GPIO_AS_IRQ) {
|
||||
|
||||
if (pdata->irq_num) {
|
||||
status = request_irq(pdata->irq_num, tps65910_gpio_isr,
|
||||
IRQF_SHARED, "tps65910_gpio", pdev);
|
||||
if (status < 0) {
|
||||
pr_err("tps65910: could not claim irq%d: %d\n",
|
||||
pdata->irq_num, status);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
INIT_WORK(&gpio_work, tps65910_gpio_work);
|
||||
mutex_init(&work_lock);
|
||||
|
||||
tps65910_gpiochip.ngpio = TPS65910_GPIO_MAX;
|
||||
tps65910_gpiochip.dev = &pdev->dev;
|
||||
|
||||
ret = gpiochip_add(&tps65910_gpiochip);
|
||||
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "could not register gpiochip \
|
||||
%d\n", ret);
|
||||
tps65910_gpiochip.ngpio = 0;
|
||||
gpio_tps65910_remove(pdev);
|
||||
return -ENODEV;
|
||||
}
|
||||
if (pdata->gpio_setup)
|
||||
pdata->gpio_setup(pdata);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int gpio_tps65910_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct tps65910_gpio *pdata = pdev->dev.platform_data;
|
||||
int status;
|
||||
|
||||
if (pdata->gpio_taredown)
|
||||
pdata->gpio_taredown(pdata);
|
||||
if (pdata->gpio_mode == TPS65910_GPIO_AS_IRQ)
|
||||
free_irq(pdata->irq_num, NULL);
|
||||
|
||||
status = gpiochip_remove(&tps65910_gpiochip);
|
||||
if (status < 0)
|
||||
return status;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver gpio_tps65910_driver = {
|
||||
.driver.name = "tps65910_gpio",
|
||||
.driver.owner = THIS_MODULE,
|
||||
.probe = gpio_tps65910_probe,
|
||||
.remove = gpio_tps65910_remove,
|
||||
};
|
||||
|
||||
static int __init gpio_tps65910_init(void)
|
||||
{
|
||||
return platform_driver_register(&gpio_tps65910_driver);
|
||||
}
|
||||
subsys_initcall(gpio_tps65910_init);
|
||||
|
||||
static void __exit gpio_tps65910_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&gpio_tps65910_driver);
|
||||
}
|
||||
module_exit(gpio_tps65910_exit);
|
||||
|
||||
MODULE_AUTHOR("Mistral Solutions Pvt Ltd.");
|
||||
MODULE_DESCRIPTION("GPIO interface for TPS65910");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
@ -22,13 +22,8 @@ obj-$(CONFIG_INPUT_JOYSTICK) += joystick/
|
|||
obj-$(CONFIG_INPUT_TABLET) += tablet/
|
||||
obj-$(CONFIG_INPUT_TOUCHSCREEN) += touchscreen/
|
||||
obj-$(CONFIG_INPUT_MISC) += misc/
|
||||
obj-$(CONFIG_G_SENSOR_DEVICE) += gsensor/
|
||||
obj-$(CONFIG_GYRO_SENSOR_DEVICE) += gyroscope/
|
||||
obj-$(CONFIG_INPUT_JOGBALL) += jogball/
|
||||
obj-$(CONFIG_LIGHT_SENSOR_DEVICE) += lightsensor/
|
||||
|
||||
obj-$(CONFIG_INPUT_APMPOWER) += apm-power.o
|
||||
obj-$(CONFIG_INPUT_KEYRESET) += keyreset.o
|
||||
|
||||
obj-$(CONFIG_XEN_KBDDEV_FRONTEND) += xen-kbdfront.o
|
||||
obj-y += magnetometer/
|
||||
|
|
|
|||
|
|
@ -12,25 +12,6 @@ menuconfig INPUT_KEYBOARD
|
|||
|
||||
if INPUT_KEYBOARD
|
||||
|
||||
config KEYS_RK29
|
||||
tristate "rk29 keyboard"
|
||||
depends on ARCH_RK29
|
||||
default y
|
||||
help
|
||||
rk29 keyboard drivers(gpio and adc)
|
||||
|
||||
config KEYS_RK29_NEWTON
|
||||
tristate "rk29 newton keyboard"
|
||||
depends on ARCH_RK29
|
||||
help
|
||||
rk29 newton keyboard drivers(gpio and adc)
|
||||
|
||||
config SYNAPTICS_SO340010
|
||||
tristate "Synaptics So340010 TouchPad KEY"
|
||||
depends on I2C
|
||||
help
|
||||
Synaptics So340010 Touch Key (I2C) driver
|
||||
|
||||
config KEYBOARD_AAED2000
|
||||
tristate "AAED-2000 keyboard"
|
||||
depends on MACH_AAED2000
|
||||
|
|
@ -198,21 +179,6 @@ config KEYBOARD_GPIO
|
|||
To compile this driver as a module, choose M here: the
|
||||
module will be called gpio_keys.
|
||||
|
||||
config KEYBOARD_WM831X_GPIO
|
||||
tristate "WM831X_GPIO Buttons"
|
||||
depends on GENERIC_GPIO
|
||||
help
|
||||
This driver implements support for buttons connected
|
||||
to GPIO pins of various CPUs (and some other chips).
|
||||
|
||||
Say Y here if your device has buttons connected
|
||||
directly to such GPIO pins. Your board-specific
|
||||
setup logic must also provide a platform device,
|
||||
with configuration data saying which GPIOs are used.
|
||||
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called wm831x_gpio_keys.
|
||||
|
||||
config KEYBOARD_TCA6416
|
||||
tristate "TCA6416 Keypad Support"
|
||||
depends on I2C
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
# Each configuration option enables a list of files.
|
||||
|
||||
obj-$(CONFIG_KEYS_RK29) += rk29_keys.o
|
||||
obj-$(CONFIG_KEYS_RK29_NEWTON) += rk29_newton_keys.o
|
||||
obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o
|
||||
obj-$(CONFIG_KEYBOARD_ADP5520) += adp5520-keys.o
|
||||
obj-$(CONFIG_KEYBOARD_ADP5588) += adp5588-keys.o
|
||||
|
|
@ -16,7 +14,6 @@ obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o
|
|||
obj-$(CONFIG_KEYBOARD_DAVINCI) += davinci_keyscan.o
|
||||
obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o
|
||||
obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o
|
||||
obj-$(CONFIG_KEYBOARD_WM831X_GPIO) += wm831x_gpio_keys.o
|
||||
obj-$(CONFIG_KEYBOARD_TCA6416) += tca6416-keypad.o
|
||||
obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o
|
||||
obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o
|
||||
|
|
@ -44,5 +41,3 @@ obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd.o
|
|||
obj-$(CONFIG_KEYBOARD_TWL4030) += twl4030_keypad.o
|
||||
obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o
|
||||
obj-$(CONFIG_KEYBOARD_W90P910) += w90p910_keypad.o
|
||||
obj-$(CONFIG_SYNAPTICS_SO340010) += synaptics_so340010.o
|
||||
|
||||
|
|
|
|||
|
|
@ -11,58 +11,6 @@ menuconfig INPUT_TOUCHSCREEN
|
|||
|
||||
if INPUT_TOUCHSCREEN
|
||||
|
||||
config TOUCHSCREEN_XPT2046_SPI
|
||||
tristate "XPT2046 based touchscreens:SPI Interface"
|
||||
depends on SPIM_RK29
|
||||
|
||||
config TOUCHSCREEN_XPT2046_NORMAL_SPI
|
||||
tristate "normal mode"
|
||||
depends on TOUCHSCREEN_XPT2046_SPI
|
||||
|
||||
config TOUCHSCREEN_480X800
|
||||
tristate "480X800 resolution"
|
||||
depends on TOUCHSCREEN_XPT2046_NORMAL_SPI
|
||||
|
||||
config TOUCHSCREEN_800X480
|
||||
tristate "800X480 resolution"
|
||||
depends on TOUCHSCREEN_XPT2046_NORMAL_SPI
|
||||
|
||||
config TOUCHSCREEN_320X480
|
||||
tristate "320X480 resolution"
|
||||
depends on TOUCHSCREEN_XPT2046_NORMAL_SPI
|
||||
|
||||
config TOUCHSCREEN_XPT2046_TSLIB_SPI
|
||||
tristate "tslib mode"
|
||||
depends on TOUCHSCREEN_XPT2046_SPI
|
||||
|
||||
config TOUCHSCREEN_480X800
|
||||
tristate "480X800 resolution"
|
||||
depends on TOUCHSCREEN_XPT2046_TSLIB_SPI
|
||||
|
||||
config TOUCHSCREEN_800X480
|
||||
tristate "800X480 resolution"
|
||||
depends on TOUCHSCREEN_XPT2046_TSLIB_SPI
|
||||
|
||||
config TOUCHSCREEN_320X480
|
||||
tristate "320X480 resolution"
|
||||
depends on TOUCHSCREEN_XPT2046_TSLIB_SPI
|
||||
|
||||
config TOUCHSCREEN_XPT2046_CBN_SPI
|
||||
tristate "calibration mode"
|
||||
depends on TOUCHSCREEN_XPT2046_SPI
|
||||
|
||||
config TOUCHSCREEN_480X800
|
||||
tristate "480X800 resolution"
|
||||
depends on TOUCHSCREEN_XPT2046_CBN_SPI
|
||||
|
||||
config TOUCHSCREEN_800X480
|
||||
tristate "800X480 resolution"
|
||||
depends on TOUCHSCREEN_XPT2046_CBN_SPI
|
||||
|
||||
config TOUCHSCREEN_320X480
|
||||
tristate "320X480 resolution"
|
||||
depends on TOUCHSCREEN_XPT2046_CBN_SPI
|
||||
|
||||
config TOUCHSCREEN_88PM860X
|
||||
tristate "Marvell 88PM860x touchscreen"
|
||||
depends on MFD_88PM860X
|
||||
|
|
@ -106,28 +54,6 @@ config TOUCHSCREEN_AD7877
|
|||
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called ad7877.
|
||||
|
||||
config TOUCHSCREEN_ILI2102_IIC
|
||||
tristate "ili2102 based touchscreens: IIC Interface"
|
||||
help
|
||||
Say Y here if you have a touchscreen interface using the
|
||||
hx8520 controller, and your board-specific initialization
|
||||
code includes that in its table of IIC devices.
|
||||
|
||||
If unsure, say N (but it's safe to say "Y").
|
||||
|
||||
config RK28_I2C_TS_NTP070
|
||||
tristate "NTP070 based touchscreens: NTP070 Interface"
|
||||
depends on I2C_RK2818
|
||||
|
||||
config TOUCHSCREEN_IT7250
|
||||
tristate "IT7250 based touchscreens: IT7250 Interface"
|
||||
help
|
||||
Say Y here if you have a touchscreen interface using the
|
||||
xpt2046 controller, and your board-specific initialization
|
||||
code includes that in its table of SPI devices.
|
||||
|
||||
If unsure, say N (but it's safe to say "Y").
|
||||
|
||||
config TOUCHSCREEN_AD7879
|
||||
tristate "Analog Devices AD7879-1/AD7889-1 touchscreen interface"
|
||||
|
|
@ -709,172 +635,6 @@ config TOUCHSCREEN_PCAP
|
|||
To compile this driver as a module, choose M here: the
|
||||
module will be called pcap_ts.
|
||||
|
||||
config HANNSTAR_P1003
|
||||
tristate "Hannstar P1003 touchscreen"
|
||||
depends on I2C2_RK29
|
||||
help
|
||||
RK29 hannstar touch
|
||||
|
||||
config HANNSTAR_MAX_X
|
||||
int "hannstar touch x max"
|
||||
depends on HANNSTAR_P1003
|
||||
default 1087
|
||||
help
|
||||
RK29 hannstar touch max X size
|
||||
|
||||
config HANNSTAR_MAX_Y
|
||||
int "hannstar touch Y max"
|
||||
depends on HANNSTAR_P1003
|
||||
default 800
|
||||
help
|
||||
RK29 hannstar touch max Y size
|
||||
|
||||
config HANNSTAR_DEBUG
|
||||
bool "hannstar debug"
|
||||
depends on HANNSTAR_P1003
|
||||
default n
|
||||
help
|
||||
RK29 hannstar touch debug
|
||||
|
||||
config ATMEL_MXT224
|
||||
tristate "Atmel mXT224 touchscreen"
|
||||
depends on I2C2_RK29
|
||||
help
|
||||
RK29 Atmel_mXT224 touch
|
||||
|
||||
config MXT224_MAX_X
|
||||
int "atmel_mxt224 touch X max"
|
||||
depends on ATMEL_MXT224
|
||||
default 4095
|
||||
help
|
||||
RK29 atmel_mxt224 touch max X size
|
||||
|
||||
config MXT224_MAX_Y
|
||||
int "atmel_mxt224 touch Y max"
|
||||
depends on ATMEL_MXT224
|
||||
default 4095
|
||||
help
|
||||
RK29 atmel_mxt224 touch max Y size
|
||||
|
||||
config SINTEK_3FA16
|
||||
tristate "Sintek 3FA16 touchscreen"
|
||||
depends on I2C2_RK29
|
||||
help
|
||||
RK29 Sintek touch
|
||||
|
||||
config HANNSTAR_MAX_X
|
||||
int "Sintek touch x max"
|
||||
depends on SINTEK_3FA16
|
||||
default 1024
|
||||
help
|
||||
RK29 hannstar touch max X size
|
||||
|
||||
config HANNSTAR_MAX_Y
|
||||
int "Sintek touch Y max"
|
||||
depends on SINTEK_3FA16
|
||||
default 600
|
||||
help
|
||||
RK29 hannstar touch max Y size
|
||||
|
||||
config HANNSTAR_DEBUG
|
||||
bool "Sintek debug"
|
||||
depends on SINTEK_3FA16
|
||||
default n
|
||||
help
|
||||
RK29 hannstar touch debug
|
||||
|
||||
config EETI_EGALAX
|
||||
tristate "EETI_EGALAX touchscreen panel support"
|
||||
depends on I2C
|
||||
help
|
||||
Say Y here to enable support for I2C connected EETI touch panels.
|
||||
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called eeti_egalax_ts.
|
||||
|
||||
config EETI_EGALAX_MAX_X
|
||||
int "EETI_EGALAX_MAX_X"
|
||||
depends on EETI_EGALAX
|
||||
default 2047
|
||||
help
|
||||
RK29 EETI_EGALAX touch max X size
|
||||
|
||||
config EETI_EGALAX_MAX_Y
|
||||
int "EETI_EGALAX_MAX_Y"
|
||||
depends on EETI_EGALAX
|
||||
default 2047
|
||||
help
|
||||
RK29 EETI_EGALAX touch max Y size
|
||||
|
||||
config EETI_EGALAX_DEBUG
|
||||
bool "EETI_EGALAX debug"
|
||||
depends on EETI_EGALAX
|
||||
default n
|
||||
help
|
||||
RK29 EETI_EGALAX touch debug
|
||||
|
||||
config TOUCHSCREEN_IT7260
|
||||
tristate "IT7260 based touchscreens: IT7260 Interface"
|
||||
depends on I2C2_RK29
|
||||
help
|
||||
Say Y here if you have a touchscreen interface using the
|
||||
it7260 controller, and your board-specific initialization
|
||||
code includes that in its table of I2C devices.
|
||||
|
||||
If unsure, say N (but it's safe to say "Y").
|
||||
|
||||
config TOUCHSCREEN_IT7260_I2C
|
||||
tristate "IT7260 based touchscreens: IT7260 I2C Interface"
|
||||
depends on I2C_RK29
|
||||
help
|
||||
Say Y here if you have a touchscreen interface using the
|
||||
IT7260 controller, and your board-specific initialization
|
||||
code includes that in its table of I2C devices.
|
||||
|
||||
If unsure, say N (but it's safe to say "Y").
|
||||
|
||||
config TOUCHSCREEN_NAS
|
||||
tristate "NAS based touchscreens: NAS Interface"
|
||||
depends on I2C2_RK29
|
||||
help
|
||||
Say Y here if you have a touchscreen interface using the
|
||||
nas controller, and your board-specific initialization
|
||||
code includes that in its table of I2C devices.
|
||||
|
||||
If unsure, say N (but it's safe to say "Y").
|
||||
|
||||
config LAIBAO_TS
|
||||
tristate "LAIBAO touchscreen"
|
||||
depends on I2C2_RK29
|
||||
help
|
||||
RK29 LAIBAO touchscreen
|
||||
|
||||
config TOUCHSCREEN_GT801_IIC
|
||||
tristate "GT801_IIC based touchscreens"
|
||||
depends on I2C2_RK29
|
||||
|
||||
config TOUCHSCREEN_GT818_IIC
|
||||
tristate "GT818_IIC based touchscreens"
|
||||
depends on I2C2_RK29
|
||||
|
||||
config D70_L3188A
|
||||
tristate "D70-L3188A based touchscreens"
|
||||
depends on I2C2_RK29
|
||||
|
||||
config TOUCHSCREEN_GT819
|
||||
tristate "GT819 based touchscreens"
|
||||
depends on I2C2_RK29
|
||||
|
||||
config TOUCHSCREEN_FT5406
|
||||
tristate "FT5406 based touchscreens: FT5406 Interface"
|
||||
depends on I2C2_RK29
|
||||
help
|
||||
say Y here if you have a touchscreen interface using the FT5406
|
||||
controller,and your board-specific initialization code includes that
|
||||
in its table of I2C devices.
|
||||
|
||||
If unsure, say N(but it's safe to say "Y").
|
||||
|
||||
config TOUCHSCREEN_TPS6507X
|
||||
tristate "TPS6507x based touchscreens"
|
||||
depends on I2C
|
||||
|
|
@ -906,33 +666,4 @@ config TOUCHSCREEN_QUANTUM_OBP
|
|||
|
||||
If unsure, say N.
|
||||
|
||||
config ATMEL_MXT1386
|
||||
tristate "ATMEL_MXT1386 touchscreen panel support"
|
||||
depends on I2C
|
||||
help
|
||||
Say Y here to enable support for I2C connected ATMEL_MXT1386 touch panels.
|
||||
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called atmel_mxt1386_ts.
|
||||
|
||||
config ATMEL_MXT1386_MAX_X
|
||||
int "ATMEL_MXT1386_MAX_X"
|
||||
depends on ATMEL_MXT1386
|
||||
default 4095
|
||||
help
|
||||
RK29 ATMEL_MXT1386 touch max X size
|
||||
|
||||
config ATMEL_MXT1386_MAX_Y
|
||||
int "ATMEL_MXT1386_MAX_Y"
|
||||
depends on ATMEL_MXT1386
|
||||
default 4095
|
||||
help
|
||||
RK29 ATMEL_MXT1386 touch max Y size
|
||||
|
||||
config ATMEL_MXT1386_DEBUG
|
||||
bool "ATMEL_MXT1386 debug"
|
||||
depends on ATMEL_MXT1386
|
||||
default n
|
||||
help
|
||||
RK29 ATMEL_MXT1386 touch debug
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -76,37 +76,14 @@ obj-$(CONFIG_VIDEO_MT9V011) += mt9v011.o
|
|||
|
||||
obj-$(CONFIG_SOC_CAMERA_MT9M001) += mt9m001.o
|
||||
obj-$(CONFIG_SOC_CAMERA_MT9M111) += mt9m111.o
|
||||
obj-$(CONFIG_SOC_CAMERA_MT9M112) += mt9m112.o
|
||||
obj-$(CONFIG_SOC_CAMERA_MT9T031) += mt9t031.o
|
||||
obj-$(CONFIG_SOC_CAMERA_MT9T111) += mt9t111.o
|
||||
obj-$(CONFIG_SOC_CAMERA_MT9T112) += mt9t112.o
|
||||
obj-$(CONFIG_SOC_CAMERA_MT9V022) += mt9v022.o
|
||||
obj-$(CONFIG_SOC_CAMERA_MT9P111) += mt9p111.o
|
||||
obj-$(CONFIG_SOC_CAMERA_MT9D112) += mt9d112.o
|
||||
obj-$(CONFIG_SOC_CAMERA_MT9D113) += mt9d113.o
|
||||
obj-$(CONFIG_SOC_CAMERA_OV772X) += ov772x.o
|
||||
obj-$(CONFIG_SOC_CAMERA_OV9640) += ov9640.o
|
||||
obj-$(CONFIG_SOC_CAMERA_RJ54N1) += rj54n1cb0c.o
|
||||
obj-$(CONFIG_SOC_CAMERA_TW9910) += tw9910.o
|
||||
obj-$(CONFIG_SOC_CAMERA_OV7675) += ov7675.o
|
||||
obj-$(CONFIG_SOC_CAMERA_OV2655) += ov2655.o
|
||||
obj-$(CONFIG_SOC_CAMERA_OV2659) += ov2659.o
|
||||
obj-$(CONFIG_SOC_CAMERA_OV9650) += ov9650.o
|
||||
obj-$(CONFIG_SOC_CAMERA_OV2640) += ov2640.o
|
||||
obj-$(CONFIG_SOC_CAMERA_OV3640) += ov3640.o
|
||||
obj-$(CONFIG_SOC_CAMERA_OV5640) += ov5640.o
|
||||
obj-$(CONFIG_SOC_CAMERA_OV5642) += ov5642.o
|
||||
obj-$(CONFIG_SOC_CAMERA_S5K6AA) += s5k6aa.o
|
||||
obj-$(CONFIG_SOC_CAMERA_GT2005) += gt2005.o
|
||||
obj-$(CONFIG_SOC_CAMERA_GC0307) += gc0307.o
|
||||
obj-$(CONFIG_SOC_CAMERA_GC0308) += gc0308.o
|
||||
obj-$(CONFIG_SOC_CAMERA_GC0309) += gc0309.o
|
||||
obj-$(CONFIG_SOC_CAMERA_GC2015) += gc2015.o
|
||||
obj-$(CONFIG_SOC_CAMERA_SIV120B) += siv120b.o
|
||||
obj-$(CONFIG_SOC_CAMERA_SID130B) += sid130B.o
|
||||
obj-$(CONFIG_SOC_CAMERA_HI253) += hi253.o
|
||||
obj-$(CONFIG_SOC_CAMERA_HI704) += hi704.o
|
||||
obj-$(CONFIG_SOC_CAMERA_NT99250) += nt99250.o
|
||||
|
||||
# And now the v4l2 drivers:
|
||||
|
||||
obj-$(CONFIG_VIDEO_BT848) += bt8xx/
|
||||
|
|
@ -184,9 +161,6 @@ obj-$(CONFIG_VIDEO_MX1) += mx1_camera.o
|
|||
obj-$(CONFIG_VIDEO_MX2) += mx2_camera.o
|
||||
obj-$(CONFIG_VIDEO_MX3) += mx3_camera.o
|
||||
obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o
|
||||
obj-$(CONFIG_VIDEO_RK29_WORK_ONEFRAME) += rk29_camera_oneframe.o
|
||||
obj-$(CONFIG_VIDEO_RK29_WORK_PINGPONG) += rk29_camera_pingpong.o
|
||||
obj-$(CONFIG_VIDEO_RK29XX_VOUT) += rk29xx/
|
||||
obj-$(CONFIG_VIDEO_SH_MOBILE_CSI2) += sh_mobile_csi2.o
|
||||
obj-$(CONFIG_VIDEO_SH_MOBILE_CEU) += sh_mobile_ceu_camera.o
|
||||
obj-$(CONFIG_VIDEO_SAMSUNG_S5P_FIMC) += s5p-fimc/
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -373,18 +373,16 @@ static int soc_camera_open(struct file *file)
|
|||
icd->current_fmt->host_fmt->fourcc,
|
||||
},
|
||||
};
|
||||
/* ddl@rock-chips.com : accelerate device open */
|
||||
if ((file->f_flags & O_ACCMODE) == O_RDWR) {
|
||||
if (icl->power) {
|
||||
ret = icl->power(icd->pdev, 1);
|
||||
if (ret < 0)
|
||||
goto epower;
|
||||
}
|
||||
|
||||
/* The camera could have been already on, try to reset */
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
if (icl->power) {
|
||||
ret = icl->power(icd->pdev, 1);
|
||||
if (ret < 0)
|
||||
goto epower;
|
||||
}
|
||||
|
||||
/* The camera could have been already on, try to reset */
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
|
||||
ret = ici->ops->add(icd);
|
||||
if (ret < 0) {
|
||||
|
|
@ -397,7 +395,6 @@ static int soc_camera_open(struct file *file)
|
|||
if (ret < 0 && ret != -ENOSYS)
|
||||
goto eresume;
|
||||
|
||||
if ((file->f_flags & O_ACCMODE) == O_RDWR) {
|
||||
/*
|
||||
* Try to configure with default parameters. Notice: this is the
|
||||
* very first open, so, we cannot race against other calls,
|
||||
|
|
@ -407,7 +404,6 @@ static int soc_camera_open(struct file *file)
|
|||
ret = soc_camera_set_fmt(icf, &f);
|
||||
if (ret < 0)
|
||||
goto esfmt;
|
||||
}
|
||||
}
|
||||
|
||||
file->private_data = icf;
|
||||
|
|
@ -455,10 +451,8 @@ static int soc_camera_close(struct file *file)
|
|||
|
||||
ici->ops->remove(icd);
|
||||
|
||||
if ((file->f_flags & O_ACCMODE) == O_RDWR) {
|
||||
if (icl->power)
|
||||
icl->power(icd->pdev, 0);
|
||||
}
|
||||
}
|
||||
|
||||
mutex_unlock(&icd->video_lock);
|
||||
|
|
@ -531,34 +525,17 @@ static int soc_camera_s_fmt_vid_cap(struct file *file, void *priv,
|
|||
{
|
||||
struct soc_camera_file *icf = file->private_data;
|
||||
struct soc_camera_device *icd = icf->icd;
|
||||
int ret,i;
|
||||
int ret;
|
||||
|
||||
WARN_ON(priv != file->private_data);
|
||||
|
||||
mutex_lock(&icf->vb_vidq.vb_lock);
|
||||
|
||||
#if 1
|
||||
if (icf->vb_vidq.bufs[0]) {
|
||||
dev_err(&icd->dev, "S_FMT denied: queue initialised\n");
|
||||
ret = -EBUSY;
|
||||
goto unlock;
|
||||
}
|
||||
#else
|
||||
|
||||
/* ddl@rock-chips.com :
|
||||
Judge queue initialised by Judge icf->vb_vidq.bufs[0] whether is NULL , it is error. */
|
||||
|
||||
i = 0;
|
||||
while (icf->vb_vidq.bufs[i] && (i<VIDEO_MAX_FRAME)) {
|
||||
if (icf->vb_vidq.bufs[i]->state != VIDEOBUF_NEEDS_INIT) {
|
||||
dev_err(&icd->dev, "S_FMT denied: queue initialised, icf->vb_vidq.bufs[%d]->state:0x%x\n",i,icf->vb_vidq.bufs[i]->state);
|
||||
ret = -EBUSY;
|
||||
goto unlock;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
ret = soc_camera_set_fmt(icf, f);
|
||||
|
||||
|
|
@ -567,27 +544,7 @@ static int soc_camera_s_fmt_vid_cap(struct file *file, void *priv,
|
|||
|
||||
return ret;
|
||||
}
|
||||
static int soc_camera_enum_frameintervals (struct file *file, void *priv,
|
||||
struct v4l2_frmivalenum *fival)
|
||||
{
|
||||
struct soc_camera_file *icf = file->private_data;
|
||||
struct soc_camera_device *icd = icf->icd;
|
||||
const struct soc_camera_data_format *format;
|
||||
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
int ret;
|
||||
|
||||
WARN_ON(priv != file->private_data);
|
||||
|
||||
ret = v4l2_subdev_call(sd, video, enum_frameintervals, fival);
|
||||
if (ret == -ENOIOCTLCMD)
|
||||
if (ici->ops->enum_frameinervals)
|
||||
ret = ici->ops->enum_frameinervals(icd, fival);
|
||||
else
|
||||
ret = -ENOIOCTLCMD;
|
||||
|
||||
return ret;
|
||||
}
|
||||
static int soc_camera_enum_fmt_vid_cap(struct file *file, void *priv,
|
||||
struct v4l2_fmtdesc *f)
|
||||
{
|
||||
|
|
@ -651,8 +608,6 @@ static int soc_camera_streamon(struct file *file, void *priv,
|
|||
struct soc_camera_file *icf = file->private_data;
|
||||
struct soc_camera_device *icd = icf->icd;
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
struct soc_camera_host *ici =
|
||||
to_soc_camera_host(icd->dev.parent);
|
||||
int ret;
|
||||
|
||||
WARN_ON(priv != file->private_data);
|
||||
|
|
@ -663,8 +618,7 @@ static int soc_camera_streamon(struct file *file, void *priv,
|
|||
mutex_lock(&icd->video_lock);
|
||||
|
||||
v4l2_subdev_call(sd, video, s_stream, 1);
|
||||
if (ici->ops->s_stream)
|
||||
ici->ops->s_stream(icd, 1); /* ddl@rock-chips.com : Add stream control for host */
|
||||
|
||||
/* This calls buf_queue from host driver's videobuf_queue_ops */
|
||||
ret = videobuf_streamon(&icf->vb_vidq);
|
||||
|
||||
|
|
@ -679,14 +633,12 @@ static int soc_camera_streamoff(struct file *file, void *priv,
|
|||
struct soc_camera_file *icf = file->private_data;
|
||||
struct soc_camera_device *icd = icf->icd;
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
struct soc_camera_host *ici =
|
||||
to_soc_camera_host(icd->dev.parent);
|
||||
|
||||
WARN_ON(priv != file->private_data);
|
||||
|
||||
if (i != V4L2_BUF_TYPE_VIDEO_CAPTURE)
|
||||
return -EINVAL;
|
||||
|
||||
|
||||
mutex_lock(&icd->video_lock);
|
||||
|
||||
/*
|
||||
|
|
@ -696,10 +648,7 @@ static int soc_camera_streamoff(struct file *file, void *priv,
|
|||
videobuf_streamoff(&icf->vb_vidq);
|
||||
|
||||
v4l2_subdev_call(sd, video, s_stream, 0);
|
||||
if (ici->ops->s_stream)
|
||||
ici->ops->s_stream(icd, 0); /* ddl@rock-chips.com : Add stream control for host */
|
||||
|
||||
videobuf_mmap_free(&icf->vb_vidq); /* ddl@rock-chips.com : free video buf */
|
||||
mutex_unlock(&icd->video_lock);
|
||||
|
||||
return 0;
|
||||
|
|
@ -737,40 +686,6 @@ static int soc_camera_queryctrl(struct file *file, void *priv,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* ddl@rock-chips.com : Add ioctrl -VIDIOC_QUERYMENU */
|
||||
static int soc_camera_querymenu(struct file *file, void *priv,
|
||||
struct v4l2_querymenu *qm)
|
||||
{
|
||||
struct soc_camera_file *icf = file->private_data;
|
||||
struct soc_camera_device *icd = icf->icd;
|
||||
struct v4l2_queryctrl qctrl;
|
||||
int i,j;
|
||||
|
||||
qctrl.id = qm->id;
|
||||
|
||||
if (soc_camera_queryctrl(file,priv, &qctrl) == 0) {
|
||||
for (i = 0; i < icd->ops->num_menus; i++) {
|
||||
if (qm->id == icd->ops->menus[i].id) {
|
||||
for (j=0; j<=(qctrl.maximum - qctrl.minimum); j++) {
|
||||
|
||||
if (qm->index == icd->ops->menus[i].index) {
|
||||
snprintf(qm->name, sizeof(qm->name), icd->ops->menus[i].name);
|
||||
qm->reserved = 0;
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
i++;
|
||||
if ( i >= icd->ops->num_menus)
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int soc_camera_g_ctrl(struct file *file, void *priv,
|
||||
struct v4l2_control *ctrl)
|
||||
{
|
||||
|
|
@ -811,64 +726,6 @@ static int soc_camera_s_ctrl(struct file *file, void *priv,
|
|||
return v4l2_subdev_call(sd, core, s_ctrl, ctrl);
|
||||
}
|
||||
|
||||
|
||||
/* ddl@rock-chips.com : Add ioctrl -VIDIOC_XXX_ext_ctrl for soc-camera */
|
||||
static int soc_camera_try_ext_ctrl(struct file *file, void *priv,
|
||||
struct v4l2_ext_controls *ctrl)
|
||||
{
|
||||
struct soc_camera_file *icf = file->private_data;
|
||||
struct soc_camera_device *icd = icf->icd;
|
||||
const struct v4l2_queryctrl *qctrl;
|
||||
int i;
|
||||
|
||||
WARN_ON(priv != file->private_data);
|
||||
|
||||
if (ctrl->ctrl_class != V4L2_CTRL_CLASS_CAMERA)
|
||||
return -EINVAL;
|
||||
|
||||
for (i=0; i<ctrl->count; i++) {
|
||||
qctrl = soc_camera_find_qctrl(icd->ops, ctrl->controls[i].id);
|
||||
if (!qctrl)
|
||||
return -EINVAL;
|
||||
|
||||
if ((ctrl->controls[i].value < qctrl->minimum) ||(ctrl->controls[i].value > qctrl->minimum))
|
||||
return -ERANGE;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* ddl@rock-chips.com : Add ioctrl -VIDIOC_XXX_ext_ctrl for soc-camera */
|
||||
static int soc_camera_g_ext_ctrl(struct file *file, void *priv,
|
||||
struct v4l2_ext_controls *ctrl)
|
||||
{
|
||||
struct soc_camera_file *icf = file->private_data;
|
||||
struct soc_camera_device *icd = icf->icd;
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
|
||||
WARN_ON(priv != file->private_data);
|
||||
|
||||
if (ctrl->ctrl_class != V4L2_CTRL_CLASS_CAMERA)
|
||||
return -EINVAL;
|
||||
|
||||
return v4l2_subdev_call(sd, core, g_ext_ctrls, ctrl);
|
||||
}
|
||||
/* ddl@rock-chips.com : Add ioctrl -VIDIOC_XXX_ext_ctrl for soc-camera */
|
||||
static int soc_camera_s_ext_ctrl(struct file *file, void *priv,
|
||||
struct v4l2_ext_controls *ctrl)
|
||||
{
|
||||
struct soc_camera_file *icf = file->private_data;
|
||||
struct soc_camera_device *icd = icf->icd;
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
|
||||
WARN_ON(priv != file->private_data);
|
||||
|
||||
if (ctrl->ctrl_class != V4L2_CTRL_CLASS_CAMERA)
|
||||
return -EINVAL;
|
||||
|
||||
return v4l2_subdev_call(sd, core, s_ext_ctrls, ctrl);
|
||||
}
|
||||
|
||||
|
||||
static int soc_camera_cropcap(struct file *file, void *fh,
|
||||
struct v4l2_cropcap *a)
|
||||
{
|
||||
|
|
@ -1437,13 +1294,8 @@ static const struct v4l2_ioctl_ops soc_camera_ioctl_ops = {
|
|||
.vidioc_streamon = soc_camera_streamon,
|
||||
.vidioc_streamoff = soc_camera_streamoff,
|
||||
.vidioc_queryctrl = soc_camera_queryctrl,
|
||||
.vidioc_querymenu = soc_camera_querymenu, /* ddl@rock-chips.com: Add ioctrl - vidioc_querymenu for soc-camera */
|
||||
.vidioc_g_ctrl = soc_camera_g_ctrl,
|
||||
.vidioc_s_ctrl = soc_camera_s_ctrl,
|
||||
.vidioc_g_ext_ctrls = soc_camera_g_ext_ctrl, /* ddl@rock-chips.com: Add ioctrl - vidioc_g_ext_ctrls for soc-camera */
|
||||
.vidioc_s_ext_ctrls = soc_camera_s_ext_ctrl, /* ddl@rock-chips.com: Add ioctrl - vidioc_s_ext_ctrls for soc-camera */
|
||||
.vidioc_try_ext_ctrls = soc_camera_try_ext_ctrl,/* ddl@rock-chips.com: Add ioctrl - vidioc_try_ext_ctrls for soc-camera */
|
||||
.vidioc_enum_frameintervals = soc_camera_enum_frameintervals,/* ddl@rock-chips.com: Add ioctrl - VIDIOC_ENUM_FRAMEINTERVALS for soc-camera */
|
||||
.vidioc_cropcap = soc_camera_cropcap,
|
||||
.vidioc_g_crop = soc_camera_g_crop,
|
||||
.vidioc_s_crop = soc_camera_s_crop,
|
||||
|
|
|
|||
|
|
@ -315,17 +315,12 @@ static int uvc_v4l2_set_format(struct uvc_streaming *stream,
|
|||
struct uvc_frame *frame;
|
||||
int ret;
|
||||
|
||||
if (fmt->type != stream->type) {
|
||||
printk("uvc_v4l2_set_format, fmt->type(%d) != stream->type(%d)\n",fmt->type,stream->type);
|
||||
if (fmt->type != stream->type)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (uvc_queue_allocated(&stream->queue)) {
|
||||
printk("uvc_queue_allocated failed\n");
|
||||
if (uvc_queue_allocated(&stream->queue))
|
||||
return -EBUSY;
|
||||
|
||||
}
|
||||
|
||||
ret = uvc_v4l2_try_format(stream, fmt, &probe, &format, &frame);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
|
@ -796,10 +791,8 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
|
|||
}
|
||||
|
||||
case VIDIOC_S_FMT:
|
||||
if ((ret = uvc_acquire_privileges(handle)) < 0) {
|
||||
printk("uvc_acquire_privileges error.");
|
||||
if ((ret = uvc_acquire_privileges(handle)) < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return uvc_v4l2_set_format(stream, arg);
|
||||
|
||||
|
|
@ -970,18 +963,14 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
|
|||
}
|
||||
|
||||
case VIDIOC_QBUF:
|
||||
if (!uvc_has_privileges(handle)) {
|
||||
printk("uvcvideo: VIDIOC_QBUF uvc_has_privileges failed\n");
|
||||
if (!uvc_has_privileges(handle))
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
return uvc_queue_buffer(&stream->queue, arg);
|
||||
|
||||
case VIDIOC_DQBUF:
|
||||
if (!uvc_has_privileges(handle)) {
|
||||
printk("uvcvideo: VIDIOC_DQBUF uvc_has_privileges failed\n");
|
||||
if (!uvc_has_privileges(handle))
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
return uvc_dequeue_buffer(&stream->queue, arg,
|
||||
file->f_flags & O_NONBLOCK);
|
||||
|
|
|
|||
|
|
@ -807,10 +807,10 @@ static long __video_do_ioctl(struct file *file,
|
|||
case VIDIOC_S_FMT:
|
||||
{
|
||||
struct v4l2_format *f = (struct v4l2_format *)arg;
|
||||
|
||||
|
||||
/* FIXME: Should be one dump per type */
|
||||
dbgarg(cmd, "type=%s\n", prt_names(f->type, v4l2_type_names));
|
||||
|
||||
|
||||
switch (f->type) {
|
||||
case V4L2_BUF_TYPE_VIDEO_CAPTURE:
|
||||
CLEAR_AFTER_FIELD(f, fmt.pix);
|
||||
|
|
@ -2090,7 +2090,7 @@ long video_ioctl2(struct file *file,
|
|||
int is_ext_ctrl;
|
||||
size_t ctrls_size = 0;
|
||||
void __user *user_ptr = NULL;
|
||||
|
||||
|
||||
#ifdef __OLD_VIDIOC_
|
||||
cmd = video_fix_command(cmd);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -180,18 +180,6 @@ config TWL4030_POWER
|
|||
and load scripts controling which resources are switched off/on
|
||||
or reset when a sleep, wakeup or warm reset event occurs.
|
||||
|
||||
config TPS65910_CORE
|
||||
bool "Texas Instruments TPS65910 Support"
|
||||
depends on I2C=y && GENERIC_HARDIRQS
|
||||
help
|
||||
Say yes here if you have TPS65910 family chip on your board.
|
||||
This core driver provides register access and registers devices
|
||||
for the various functions so that function-specific drivers can
|
||||
bind to them.
|
||||
|
||||
These multi-function chips are found on many AM35xx boards,
|
||||
providing power management, RTC, GPIO features.
|
||||
|
||||
config TWL4030_CODEC
|
||||
bool
|
||||
depends on TWL4030_CORE
|
||||
|
|
@ -326,42 +314,15 @@ config MFD_WM8400
|
|||
the functionality of the device.
|
||||
|
||||
config MFD_WM831X
|
||||
bool
|
||||
depends on GENERIC_HARDIRQS
|
||||
|
||||
config MFD_WM831X_I2C
|
||||
bool "Support Wolfson Microelectronics WM831x/2x PMICs with I2C"
|
||||
bool "Support Wolfson Microelectronics WM831x/2x PMICs"
|
||||
select MFD_CORE
|
||||
select MFD_WM831X
|
||||
depends on I2C=y && GENERIC_HARDIRQS
|
||||
help
|
||||
Support for the Wolfson Microelecronics WM831x and WM832x PMICs
|
||||
when controlled using I2C. This driver provides common support
|
||||
for accessing the device, additional drivers must be enabled in
|
||||
order to use the functionality of the device.
|
||||
Support for the Wolfson Microelecronics WM831x and WM832x PMICs.
|
||||
This driver provides common support for accessing the device,
|
||||
additional drivers must be enabled in order to use the
|
||||
functionality of the device.
|
||||
|
||||
config MFD_WM831X_SPI
|
||||
bool "Support Wolfson Microelectronics WM831x/2x PMICs with SPI"
|
||||
select MFD_CORE
|
||||
select MFD_WM831X
|
||||
depends on SPI_MASTER && GENERIC_HARDIRQS
|
||||
help
|
||||
Support for the Wolfson Microelecronics WM831x and WM832x PMICs
|
||||
when controlled using SPI. This driver provides common support
|
||||
for accessing the device, additional drivers must be enabled in
|
||||
order to use the functionality of the device.
|
||||
|
||||
config MFD_WM831X_SPI_A22
|
||||
bool "Support Wolfson Microelectronics WM831x/2x PMICs with SPI for A22"
|
||||
#select MFD_CORE
|
||||
#select MFD_WM831X
|
||||
depends on SPI_MASTER && GENERIC_HARDIRQS
|
||||
help
|
||||
Support for the Wolfson Microelecronics WM831x and WM832x PMICs
|
||||
when controlled using SPI. This driver provides common support
|
||||
for accessing the device, additional drivers must be enabled in
|
||||
order to use the functionality of the device.
|
||||
|
||||
config MFD_WM8350
|
||||
bool
|
||||
depends on GENERIC_HARDIRQS
|
||||
|
|
|
|||
|
|
@ -24,9 +24,6 @@ obj-$(CONFIG_MFD_TC6393XB) += tc6393xb.o tmio_core.o
|
|||
obj-$(CONFIG_MFD_WM8400) += wm8400-core.o
|
||||
wm831x-objs := wm831x-core.o wm831x-irq.o wm831x-otp.o
|
||||
obj-$(CONFIG_MFD_WM831X) += wm831x.o
|
||||
obj-$(CONFIG_MFD_WM831X_I2C) += wm831x-i2c.o
|
||||
obj-$(CONFIG_MFD_WM831X_SPI) += wm831x-spi.o
|
||||
obj-$(CONFIG_MFD_WM831X_SPI_A22) += wm831x-spi-a22.o
|
||||
wm8350-objs := wm8350-core.o wm8350-regmap.o wm8350-gpio.o
|
||||
wm8350-objs += wm8350-irq.o
|
||||
obj-$(CONFIG_MFD_WM8350) += wm8350.o
|
||||
|
|
@ -42,8 +39,6 @@ obj-$(CONFIG_TWL4030_POWER) += twl4030-power.o
|
|||
obj-$(CONFIG_TWL4030_CODEC) += twl4030-codec.o
|
||||
obj-$(CONFIG_TWL6030_PWM) += twl6030-pwm.o
|
||||
|
||||
obj-$(CONFIG_TPS65910_CORE) += tps65910-core.o
|
||||
|
||||
obj-$(CONFIG_MFD_MC13783) += mc13783-core.o
|
||||
|
||||
obj-$(CONFIG_MFD_CORE) += mfd-core.o
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@
|
|||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/bcd.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/mfd/core.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/irq.h>
|
||||
|
||||
#include <linux/mfd/wm831x/core.h>
|
||||
#include <linux/mfd/wm831x/pdata.h>
|
||||
|
|
@ -26,13 +26,10 @@
|
|||
#include <linux/mfd/wm831x/auxadc.h>
|
||||
#include <linux/mfd/wm831x/otp.h>
|
||||
#include <linux/mfd/wm831x/regulator.h>
|
||||
#include <linux/mfd/wm831x/pmu.h>
|
||||
|
||||
|
||||
/* Current settings - values are 2*2^(reg_val/4) microamps. These are
|
||||
* exported since they are used by multiple drivers.
|
||||
*/
|
||||
extern int reboot_cmd_get(void);
|
||||
int wm831x_isinkv_values[WM831X_ISINK_MAX_ISEL + 1] = {
|
||||
2,
|
||||
2,
|
||||
|
|
@ -93,6 +90,14 @@ int wm831x_isinkv_values[WM831X_ISINK_MAX_ISEL + 1] = {
|
|||
};
|
||||
EXPORT_SYMBOL_GPL(wm831x_isinkv_values);
|
||||
|
||||
enum wm831x_parent {
|
||||
WM8310 = 0x8310,
|
||||
WM8311 = 0x8311,
|
||||
WM8312 = 0x8312,
|
||||
WM8320 = 0x8320,
|
||||
WM8321 = 0x8321,
|
||||
};
|
||||
|
||||
static int wm831x_reg_locked(struct wm831x *wm831x, unsigned short reg)
|
||||
{
|
||||
if (!wm831x->locked)
|
||||
|
|
@ -387,7 +392,7 @@ int wm831x_auxadc_read(struct wm831x *wm831x, enum wm831x_auxadc input)
|
|||
* the notification of the interrupt may be delayed by
|
||||
* threaded IRQ handling. */
|
||||
if (!wait_for_completion_timeout(&wm831x->auxadc_done,
|
||||
msecs_to_jiffies(2000))) {
|
||||
msecs_to_jiffies(500))) {
|
||||
dev_err(wm831x->dev, "Timed out waiting for AUXADC\n");
|
||||
ret = -EBUSY;
|
||||
goto disable;
|
||||
|
|
@ -1001,20 +1006,6 @@ static struct mfd_cell wm8310_devs[] = {
|
|||
.num_resources = ARRAY_SIZE(wm831x_wdt_resources),
|
||||
.resources = wm831x_wdt_resources,
|
||||
},
|
||||
#if defined(CONFIG_KEYBOARD_WM831X_GPIO)
|
||||
{
|
||||
.name = "wm831x_gpio-keys",
|
||||
.num_resources = 0,
|
||||
},
|
||||
#endif
|
||||
#if defined(CONFIG_WM831X_CHARGER_DISPLAY)
|
||||
{
|
||||
.name = "wm831x_charger_display",
|
||||
.num_resources = 0,
|
||||
},
|
||||
#endif
|
||||
|
||||
|
||||
};
|
||||
|
||||
static struct mfd_cell wm8311_devs[] = {
|
||||
|
|
@ -1455,7 +1446,7 @@ static struct mfd_cell backlight_devs[] = {
|
|||
/*
|
||||
* Instantiate the generic non-control parts of the device.
|
||||
*/
|
||||
int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
|
||||
static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
|
||||
{
|
||||
struct wm831x_pdata *pdata = wm831x->dev->platform_data;
|
||||
int rev;
|
||||
|
|
@ -1473,7 +1464,11 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
|
|||
dev_err(wm831x->dev, "Failed to read parent ID: %d\n", ret);
|
||||
goto err;
|
||||
}
|
||||
if (ret != 0x6204) {
|
||||
switch (ret) {
|
||||
case 0x6204:
|
||||
case 0x6246:
|
||||
break;
|
||||
default:
|
||||
dev_err(wm831x->dev, "Device is not a WM831x: ID %x\n", ret);
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
|
|
@ -1503,15 +1498,12 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
|
|||
switch (ret) {
|
||||
case WM8310:
|
||||
parent = WM8310;
|
||||
wm831x->num_gpio = 12;
|
||||
wm831x->num_gpio = 16;
|
||||
wm831x->charger_irq_wake = 1;
|
||||
if (rev > 0) {
|
||||
wm831x->has_gpio_ena = 1;
|
||||
wm831x->has_cs_sts = 1;
|
||||
}
|
||||
//ILIM = 900ma
|
||||
ret = wm831x_reg_read(wm831x, WM831X_POWER_STATE) & 0xffff;
|
||||
wm831x_reg_write(wm831x, WM831X_POWER_STATE, (ret&0xfff8) | 0x04);
|
||||
|
||||
dev_info(wm831x->dev, "WM8310 revision %c\n", 'A' + rev);
|
||||
break;
|
||||
|
|
@ -1552,12 +1544,6 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
|
|||
dev_info(wm831x->dev, "WM8321 revision %c\n", 'A' + rev);
|
||||
break;
|
||||
|
||||
case WM8325:
|
||||
parent = WM8325;
|
||||
wm831x->num_gpio = 12;
|
||||
dev_info(wm831x->dev, "WM8325 revision %c\n", 'A' + rev);
|
||||
break;
|
||||
|
||||
default:
|
||||
dev_err(wm831x->dev, "Unknown WM831x device %04x\n", ret);
|
||||
ret = -EINVAL;
|
||||
|
|
@ -1635,13 +1621,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
|
|||
case WM8321:
|
||||
ret = mfd_add_devices(wm831x->dev, -1,
|
||||
wm8320_devs, ARRAY_SIZE(wm8320_devs),
|
||||
NULL, 0);
|
||||
break;
|
||||
|
||||
case WM8325:
|
||||
ret = mfd_add_devices(wm831x->dev, -1,
|
||||
wm8320_devs, ARRAY_SIZE(wm8320_devs),
|
||||
NULL, 0);
|
||||
NULL, wm831x->irq_base);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -1667,11 +1647,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
|
|||
wm831x_otp_init(wm831x);
|
||||
|
||||
if (pdata && pdata->post_init) {
|
||||
wm831x_reg_unlock(wm831x);
|
||||
wm831x_set_bits(wm831x, WM831X_RESET_CONTROL,0x0010,0x0000);
|
||||
wm831x_set_bits(wm831x, WM831X_LDO_ENABLE,0Xf800,0Xf800);
|
||||
ret = pdata->post_init(wm831x);
|
||||
wm831x_reg_lock(wm831x);
|
||||
if (ret != 0) {
|
||||
dev_err(wm831x->dev, "post_init() failed: %d\n", ret);
|
||||
goto err_irq;
|
||||
|
|
@ -1688,7 +1664,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void wm831x_device_exit(struct wm831x *wm831x)
|
||||
static void wm831x_device_exit(struct wm831x *wm831x)
|
||||
{
|
||||
wm831x_otp_exit(wm831x);
|
||||
mfd_remove_devices(wm831x->dev);
|
||||
|
|
@ -1698,25 +1674,9 @@ void wm831x_device_exit(struct wm831x *wm831x)
|
|||
kfree(wm831x);
|
||||
}
|
||||
|
||||
int wm831x_device_suspend(struct wm831x *wm831x)
|
||||
static int wm831x_device_suspend(struct wm831x *wm831x)
|
||||
{
|
||||
int reg, mask;
|
||||
int i;
|
||||
|
||||
//mask some intterupt avoid wakeing up system while suspending
|
||||
for (i = 0; i < ARRAY_SIZE(wm831x->irq_masks_cur); i++) {
|
||||
/* If there's been a change in the mask write it back
|
||||
* to the hardware. */
|
||||
//printk("irq_masks_cur[%d]=0x%x\n",i,wm831x->irq_masks_cur[i]);
|
||||
|
||||
if (wm831x->irq_masks_cur[i] != wm831x->irq_masks_cache[i]) {
|
||||
wm831x->irq_masks_cache[i] = wm831x->irq_masks_cur[i];
|
||||
wm831x_reg_write(wm831x,
|
||||
WM831X_INTERRUPT_STATUS_1_MASK + i,
|
||||
wm831x->irq_masks_cur[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* If the charger IRQs are a wake source then make sure we ack
|
||||
* them even if they're not actively being used (eg, no power
|
||||
|
|
@ -1749,100 +1709,126 @@ int wm831x_device_suspend(struct wm831x *wm831x)
|
|||
|
||||
return 0;
|
||||
}
|
||||
void wm831x_enter_sleep(void){
|
||||
#if 1//def CONFIG_RK2818_SOC_PM
|
||||
struct regulator *dcdc;
|
||||
int i;
|
||||
dcdc=regulator_get(NULL, "dcdc1");
|
||||
struct wm831x_dcdc *dc = regulator_get_drvdata(dcdc);
|
||||
struct wm831x *wm831x = dc->wm831x;
|
||||
if(wm831x){
|
||||
wm831x_set_bits(wm831x, WM831X_POWER_STATE, 0x4000, 0x4000); // SYSTEM SLEEP MODE
|
||||
for (i=0; i<5; i++)
|
||||
wm831x_reg_write(wm831x,WM831X_INTERRUPT_STATUS_1+i, 0xffff); // INTRUPT FLAG CLEAR
|
||||
|
||||
printk("%s:complete! \n",__func__);
|
||||
|
||||
}else{
|
||||
printk("%s:error!",__func__);
|
||||
}
|
||||
regulator_put(dcdc);
|
||||
#endif
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(wm831x_enter_sleep);
|
||||
|
||||
void wm831x_exit_sleep(void){
|
||||
#if 1//def CONFIG_RK2818_SOC_PM
|
||||
struct regulator *dcdc;
|
||||
dcdc=regulator_get(NULL, "dcdc1");
|
||||
struct wm831x_dcdc *dc = regulator_get_drvdata(dcdc);
|
||||
struct wm831x *wm831x = dc->wm831x;
|
||||
if(wm831x){
|
||||
wm831x_set_bits(wm831x, WM831X_POWER_STATE, 0x4000, 0); // SYSTEM ON MODE
|
||||
printk("%s:complete! \n",__func__);
|
||||
|
||||
}else{
|
||||
printk("%s:error!",__func__);
|
||||
}
|
||||
regulator_put(dcdc);
|
||||
#endif
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(wm831x_exit_sleep);
|
||||
|
||||
int wm831x_device_shutdown(struct wm831x *wm831x)
|
||||
static int wm831x_i2c_read_device(struct wm831x *wm831x, unsigned short reg,
|
||||
int bytes, void *dest)
|
||||
{
|
||||
struct wm831x_pdata *pdata = wm831x->dev->platform_data;
|
||||
int ret = 0;
|
||||
|
||||
printk("pre WM831X_POWER_STATE = 0x%x\n", wm831x_reg_read(wm831x, WM831X_POWER_STATE));
|
||||
struct i2c_client *i2c = wm831x->control_data;
|
||||
int ret;
|
||||
u16 r = cpu_to_be16(reg);
|
||||
|
||||
if (pdata && pdata->last_deinit) {
|
||||
ret = pdata->last_deinit(wm831x);
|
||||
if (ret != 0) {
|
||||
dev_info(wm831x->dev, "last_deinit() failed: %d\n", ret);
|
||||
//goto err_irq;
|
||||
}
|
||||
}
|
||||
|
||||
//if(0 == reboot_cmd_get())
|
||||
{
|
||||
if(wm831x_set_bits(wm831x, WM831X_POWER_STATE, WM831X_CHIP_ON_MASK, 0) < 0)
|
||||
printk("%s wm831x_set_bits err\n", __FUNCTION__);
|
||||
//printk("post WM831X_POWER_STATE = 0x%x\n", wm831x_reg_read(wm831x, WM831X_POWER_STATE));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL_GPL(wm831x_device_shutdown);
|
||||
|
||||
|
||||
int wm831x_read_usb(struct wm831x *wm831x)
|
||||
{
|
||||
int ret, usb_chg = 0, wall_chg = 0;
|
||||
|
||||
ret = wm831x_reg_read(wm831x, WM831X_SYSTEM_STATUS);
|
||||
ret = i2c_master_send(i2c, (unsigned char *)&r, 2);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (ret != 2)
|
||||
return -EIO;
|
||||
|
||||
if (ret & WM831X_PWR_USB)
|
||||
usb_chg = 1;
|
||||
if (ret & WM831X_PWR_WALL)
|
||||
wall_chg = 1;
|
||||
|
||||
return ((usb_chg | wall_chg) ? 1 : 0);
|
||||
|
||||
ret = i2c_master_recv(i2c, dest, bytes);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (ret != bytes)
|
||||
return -EIO;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int wm831x_device_restart(struct wm831x *wm831x)
|
||||
/* Currently we allocate the write buffer on the stack; this is OK for
|
||||
* small writes - if we need to do large writes this will need to be
|
||||
* revised.
|
||||
*/
|
||||
static int wm831x_i2c_write_device(struct wm831x *wm831x, unsigned short reg,
|
||||
int bytes, void *src)
|
||||
{
|
||||
wm831x_reg_write(wm831x,WM831X_RESET_ID, 0xffff);
|
||||
struct i2c_client *i2c = wm831x->control_data;
|
||||
unsigned char msg[bytes + 2];
|
||||
int ret;
|
||||
|
||||
reg = cpu_to_be16(reg);
|
||||
memcpy(&msg[0], ®, 2);
|
||||
memcpy(&msg[2], src, bytes);
|
||||
|
||||
ret = i2c_master_send(i2c, msg, bytes + 2);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (ret < bytes + 2)
|
||||
return -EIO;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm831x_i2c_probe(struct i2c_client *i2c,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
struct wm831x *wm831x;
|
||||
|
||||
MODULE_DESCRIPTION("Core support for the WM831X AudioPlus PMIC");
|
||||
wm831x = kzalloc(sizeof(struct wm831x), GFP_KERNEL);
|
||||
if (wm831x == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
i2c_set_clientdata(i2c, wm831x);
|
||||
wm831x->dev = &i2c->dev;
|
||||
wm831x->control_data = i2c;
|
||||
wm831x->read_dev = wm831x_i2c_read_device;
|
||||
wm831x->write_dev = wm831x_i2c_write_device;
|
||||
|
||||
return wm831x_device_init(wm831x, id->driver_data, i2c->irq);
|
||||
}
|
||||
|
||||
static int wm831x_i2c_remove(struct i2c_client *i2c)
|
||||
{
|
||||
struct wm831x *wm831x = i2c_get_clientdata(i2c);
|
||||
|
||||
wm831x_device_exit(wm831x);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm831x_i2c_suspend(struct i2c_client *i2c, pm_message_t mesg)
|
||||
{
|
||||
struct wm831x *wm831x = i2c_get_clientdata(i2c);
|
||||
|
||||
return wm831x_device_suspend(wm831x);
|
||||
}
|
||||
|
||||
static const struct i2c_device_id wm831x_i2c_id[] = {
|
||||
{ "wm8310", WM8310 },
|
||||
{ "wm8311", WM8311 },
|
||||
{ "wm8312", WM8312 },
|
||||
{ "wm8320", WM8320 },
|
||||
{ "wm8321", WM8321 },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, wm831x_i2c_id);
|
||||
|
||||
|
||||
static struct i2c_driver wm831x_i2c_driver = {
|
||||
.driver = {
|
||||
.name = "wm831x",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = wm831x_i2c_probe,
|
||||
.remove = wm831x_i2c_remove,
|
||||
.suspend = wm831x_i2c_suspend,
|
||||
.id_table = wm831x_i2c_id,
|
||||
};
|
||||
|
||||
static int __init wm831x_i2c_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = i2c_add_driver(&wm831x_i2c_driver);
|
||||
if (ret != 0)
|
||||
pr_err("Failed to register wm831x I2C driver: %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
subsys_initcall(wm831x_i2c_init);
|
||||
|
||||
static void __exit wm831x_i2c_exit(void)
|
||||
{
|
||||
i2c_del_driver(&wm831x_i2c_driver);
|
||||
}
|
||||
module_exit(wm831x_i2c_exit);
|
||||
|
||||
MODULE_DESCRIPTION("I2C support for the WM831X AudioPlus PMIC");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Mark Brown");
|
||||
|
|
|
|||
|
|
@ -1,188 +0,0 @@
|
|||
/*
|
||||
* wm831x-i2c.c -- I2C access for Wolfson WM831x PMICs
|
||||
*
|
||||
* Copyright 2009,2010 Wolfson Microelectronics PLC.
|
||||
*
|
||||
* Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/mfd/core.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/gpio.h>
|
||||
|
||||
#include <linux/mfd/wm831x/core.h>
|
||||
#include <linux/mfd/wm831x/pdata.h>
|
||||
|
||||
static int wm831x_i2c_read_device(struct wm831x *wm831x, unsigned short reg,
|
||||
int bytes, void *dest)
|
||||
{
|
||||
struct i2c_client *i2c = wm831x->control_data;
|
||||
int ret;
|
||||
u16 r = cpu_to_be16(reg);
|
||||
|
||||
ret = i2c_master_send(i2c, (unsigned char *)&r, 2);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (ret != 2)
|
||||
return -EIO;
|
||||
|
||||
ret = i2c_master_recv(i2c, dest, bytes);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (ret != bytes)
|
||||
return -EIO;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Currently we allocate the write buffer on the stack; this is OK for
|
||||
* small writes - if we need to do large writes this will need to be
|
||||
* revised.
|
||||
*/
|
||||
static int wm831x_i2c_write_device(struct wm831x *wm831x, unsigned short reg,
|
||||
int bytes, void *src)
|
||||
{
|
||||
struct i2c_client *i2c = wm831x->control_data;
|
||||
unsigned char msg[bytes + 2];
|
||||
int ret;
|
||||
|
||||
reg = cpu_to_be16(reg);
|
||||
memcpy(&msg[0], ®, 2);
|
||||
memcpy(&msg[2], src, bytes);
|
||||
|
||||
ret = i2c_master_send(i2c, msg, bytes + 2);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (ret < bytes + 2)
|
||||
return -EIO;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm831x_i2c_probe(struct i2c_client *i2c,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
struct wm831x *wm831x;
|
||||
int ret,gpio,irq;
|
||||
|
||||
wm831x = kzalloc(sizeof(struct wm831x), GFP_KERNEL);
|
||||
if (wm831x == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
i2c_set_clientdata(i2c, wm831x);
|
||||
|
||||
gpio = i2c->irq;
|
||||
ret = gpio_request(gpio, "wm831x");
|
||||
if (ret) {
|
||||
printk( "failed to request rk gpio irq for wm831x \n");
|
||||
return ret;
|
||||
}
|
||||
gpio_pull_updown(gpio, GPIOPullUp);
|
||||
if (ret) {
|
||||
printk("failed to pull up gpio irq for wm831x \n");
|
||||
return ret;
|
||||
}
|
||||
irq = gpio_to_irq(gpio);
|
||||
|
||||
wm831x->dev = &i2c->dev;
|
||||
wm831x->control_data = i2c;
|
||||
wm831x->read_dev = wm831x_i2c_read_device;
|
||||
wm831x->write_dev = wm831x_i2c_write_device;
|
||||
|
||||
return wm831x_device_init(wm831x, id->driver_data, irq);
|
||||
}
|
||||
|
||||
static int wm831x_i2c_remove(struct i2c_client *i2c)
|
||||
{
|
||||
struct wm831x *wm831x = i2c_get_clientdata(i2c);
|
||||
|
||||
wm831x_device_exit(wm831x);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm831x_i2c_suspend(struct i2c_client *i2c, pm_message_t mesg)
|
||||
{
|
||||
struct wm831x *wm831x = i2c_get_clientdata(i2c);
|
||||
|
||||
return wm831x_device_suspend(wm831x);
|
||||
}
|
||||
|
||||
static int wm831x_i2c_resume(struct i2c_client *i2c)
|
||||
{
|
||||
struct wm831x *wm831x = i2c_get_clientdata(i2c);
|
||||
int i;
|
||||
//set some intterupt again while resume
|
||||
for (i = 0; i < ARRAY_SIZE(wm831x->irq_masks_cur); i++) {
|
||||
//printk("irq_masks_cur[%d]=0x%x\n",i,wm831x->irq_masks_cur[i]);
|
||||
|
||||
if (wm831x->irq_masks_cur[i] != wm831x->irq_masks_cache[i]) {
|
||||
wm831x->irq_masks_cache[i] = wm831x->irq_masks_cur[i];
|
||||
wm831x_reg_write(wm831x,
|
||||
WM831X_INTERRUPT_STATUS_1_MASK + i,
|
||||
wm831x->irq_masks_cur[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wm831x_i2c_shutdown(struct i2c_client *i2c)
|
||||
{
|
||||
struct wm831x *wm831x = i2c_get_clientdata(i2c);
|
||||
printk("%s\n", __FUNCTION__);
|
||||
wm831x_device_shutdown(wm831x);
|
||||
}
|
||||
|
||||
static const struct i2c_device_id wm831x_i2c_id[] = {
|
||||
{ "wm8310", WM8310 },
|
||||
{ "wm8311", WM8311 },
|
||||
{ "wm8312", WM8312 },
|
||||
{ "wm8320", WM8320 },
|
||||
{ "wm8321", WM8321 },
|
||||
{ "wm8325", WM8325 },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, wm831x_i2c_id);
|
||||
|
||||
|
||||
static struct i2c_driver wm831x_i2c_driver = {
|
||||
.driver = {
|
||||
.name = "wm831x",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = wm831x_i2c_probe,
|
||||
.remove = wm831x_i2c_remove,
|
||||
.suspend = wm831x_i2c_suspend,
|
||||
.resume = wm831x_i2c_resume,
|
||||
.shutdown = wm831x_i2c_shutdown,
|
||||
.id_table = wm831x_i2c_id,
|
||||
};
|
||||
|
||||
static int __init wm831x_i2c_init(void)
|
||||
{
|
||||
int ret;
|
||||
printk("%s \n", __FUNCTION__);
|
||||
ret = i2c_add_driver(&wm831x_i2c_driver);
|
||||
if (ret != 0)
|
||||
pr_err("Failed to register wm831x I2C driver: %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
subsys_initcall(wm831x_i2c_init);
|
||||
|
||||
static void __exit wm831x_i2c_exit(void)
|
||||
{
|
||||
i2c_del_driver(&wm831x_i2c_driver);
|
||||
}
|
||||
module_exit(wm831x_i2c_exit);
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
#include <linux/mfd/wm831x/irq.h>
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/wakelock.h>
|
||||
|
||||
/*
|
||||
* Since generic IRQs don't currently support interrupt controllers on
|
||||
* interrupt driven buses we don't use genirq but instead provide an
|
||||
|
|
@ -34,7 +34,6 @@
|
|||
* the static irq_data table we use to look up the data for individual
|
||||
* interrupts, but hopefully won't last too long.
|
||||
*/
|
||||
#define WM831X_IRQ_TYPE IRQF_TRIGGER_LOW
|
||||
|
||||
struct wm831x_irq_data {
|
||||
int primary;
|
||||
|
|
@ -42,12 +41,6 @@ struct wm831x_irq_data {
|
|||
int mask;
|
||||
};
|
||||
|
||||
struct wm831x_handle_irq
|
||||
{
|
||||
int irq;
|
||||
struct list_head queue;
|
||||
};
|
||||
|
||||
static struct wm831x_irq_data wm831x_irqs[] = {
|
||||
[WM831X_IRQ_TEMP_THW] = {
|
||||
.primary = WM831X_TEMP_INT,
|
||||
|
|
@ -384,7 +377,6 @@ static void wm831x_irq_unmask(unsigned int irq)
|
|||
struct wm831x_irq_data *irq_data = irq_to_wm831x_irq(wm831x, irq);
|
||||
|
||||
wm831x->irq_masks_cur[irq_data->reg - 1] &= ~irq_data->mask;
|
||||
//printk("%s:irq=%d\n",__FUNCTION__,irq);
|
||||
}
|
||||
|
||||
static void wm831x_irq_mask(unsigned int irq)
|
||||
|
|
@ -393,16 +385,6 @@ static void wm831x_irq_mask(unsigned int irq)
|
|||
struct wm831x_irq_data *irq_data = irq_to_wm831x_irq(wm831x, irq);
|
||||
|
||||
wm831x->irq_masks_cur[irq_data->reg - 1] |= irq_data->mask;
|
||||
//printk("%s:irq=%d\n",__FUNCTION__,irq);
|
||||
}
|
||||
|
||||
static void wm831x_irq_disable(unsigned int irq)
|
||||
{
|
||||
struct wm831x *wm831x = get_irq_chip_data(irq);
|
||||
struct wm831x_irq_data *irq_data = irq_to_wm831x_irq(wm831x, irq);
|
||||
|
||||
wm831x->irq_masks_cur[irq_data->reg - 1] |= irq_data->mask;
|
||||
//printk("%s:irq=%d\n",__FUNCTION__,irq);
|
||||
}
|
||||
|
||||
static int wm831x_irq_set_type(unsigned int irq, unsigned int type)
|
||||
|
|
@ -411,14 +393,15 @@ static int wm831x_irq_set_type(unsigned int irq, unsigned int type)
|
|||
int val;
|
||||
|
||||
irq = irq - wm831x->irq_base;
|
||||
if (irq < WM831X_IRQ_GPIO_1 || irq > WM831X_IRQ_GPIO_12) {
|
||||
|
||||
if (irq < WM831X_IRQ_GPIO_1 || irq > WM831X_IRQ_GPIO_11) {
|
||||
/* Ignore internal-only IRQs */
|
||||
if (irq >= 0 && irq < WM831X_NUM_IRQS)
|
||||
return 0;
|
||||
else
|
||||
return -EINVAL;
|
||||
}
|
||||
//printk("wm831x_irq_set_type:type=%x,irq=%d\n",type,irq);
|
||||
|
||||
switch (type) {
|
||||
case IRQ_TYPE_EDGE_BOTH:
|
||||
val = WM831X_GPN_INT_MODE;
|
||||
|
|
@ -433,97 +416,29 @@ static int wm831x_irq_set_type(unsigned int irq, unsigned int type)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
return wm831x_set_bits(wm831x, WM831X_GPIO1_CONTROL + irq - 1,
|
||||
return wm831x_set_bits(wm831x, WM831X_GPIO1_CONTROL + irq,
|
||||
WM831X_GPN_INT_MODE | WM831X_GPN_POL, val);
|
||||
}
|
||||
|
||||
static int wm831x_irq_set_wake(unsigned irq, unsigned state)
|
||||
{
|
||||
struct wm831x *wm831x = get_irq_chip_data(irq);
|
||||
|
||||
//only wm831x irq
|
||||
if ((irq > wm831x->irq_base + WM831X_IRQ_TEMP_THW) &&( irq < wm831x->irq_base + WM831X_NUM_IRQS))
|
||||
{
|
||||
if(state)
|
||||
wm831x_irq_unmask(irq);
|
||||
else
|
||||
wm831x_irq_mask(irq);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printk("%s:irq number err!irq=%d\n",__FUNCTION__,irq);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static struct irq_chip wm831x_irq_chip = {
|
||||
.name = "wm831x",
|
||||
.bus_lock = wm831x_irq_lock,
|
||||
.bus_sync_unlock = wm831x_irq_sync_unlock,
|
||||
.disable = wm831x_irq_disable,
|
||||
.mask = wm831x_irq_mask,
|
||||
.unmask = wm831x_irq_unmask,
|
||||
.set_type = wm831x_irq_set_type,
|
||||
.set_wake = wm831x_irq_set_wake,
|
||||
};
|
||||
|
||||
#if WM831X_IRQ_LIST
|
||||
static void wm831x_handle_worker(struct work_struct *work)
|
||||
/* The processing of the primary interrupt occurs in a thread so that
|
||||
* we can interact with the device over I2C or SPI. */
|
||||
static irqreturn_t wm831x_irq_thread(int irq, void *data)
|
||||
{
|
||||
struct wm831x *wm831x = container_of(work, struct wm831x, handle_work);
|
||||
int irq;
|
||||
|
||||
while (1) {
|
||||
unsigned long flags;
|
||||
struct wm831x_handle_irq *hd = NULL;
|
||||
|
||||
spin_lock_irqsave(&wm831x->work_lock, flags);
|
||||
if (!list_empty(&wm831x->handle_queue)) {
|
||||
hd = list_first_entry(&wm831x->handle_queue, struct wm831x_handle_irq, queue);
|
||||
list_del(&hd->queue);
|
||||
}
|
||||
spin_unlock_irqrestore(&wm831x->work_lock, flags);
|
||||
|
||||
if (!hd) // trans_queue empty
|
||||
break;
|
||||
|
||||
irq = hd->irq; //get wm831x intterupt status
|
||||
//printk("%s:irq=%d\n",__FUNCTION__,irq);
|
||||
|
||||
/*start to handle wm831x intterupt*/
|
||||
handle_nested_irq(wm831x->irq_base + irq);
|
||||
|
||||
kfree(hd);
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* Main interrupt handling occurs in a workqueue since we need
|
||||
* interrupts enabled to interact with the chip. */
|
||||
static void wm831x_irq_worker(struct work_struct *work)
|
||||
{
|
||||
struct wm831x *wm831x = container_of(work, struct wm831x, irq_work);
|
||||
struct wm831x *wm831x = data;
|
||||
unsigned int i;
|
||||
int primary;
|
||||
int status_regs[WM831X_NUM_IRQ_REGS] = { 0 };
|
||||
int read[WM831X_NUM_IRQ_REGS] = { 0 };
|
||||
int *status;
|
||||
unsigned long flags;
|
||||
struct wm831x_handle_irq *hd;
|
||||
int ret;
|
||||
|
||||
#if (WM831X_IRQ_TYPE != IRQF_TRIGGER_LOW)
|
||||
/*mask wm831x irq at first*/
|
||||
ret = wm831x_set_bits(wm831x, WM831X_IRQ_CONFIG,
|
||||
WM831X_IRQ_IM_MASK, WM831X_IRQ_IM_EANBLE);
|
||||
if (ret < 0) {
|
||||
dev_err(wm831x->dev, "Failed to mask irq: %d\n", ret);
|
||||
goto out;
|
||||
}
|
||||
#endif
|
||||
|
||||
primary = wm831x_reg_read(wm831x, WM831X_SYSTEM_INTERRUPTS);
|
||||
if (primary < 0) {
|
||||
|
|
@ -531,15 +446,13 @@ static void wm831x_irq_worker(struct work_struct *work)
|
|||
primary);
|
||||
goto out;
|
||||
}
|
||||
|
||||
mutex_lock(&wm831x->irq_lock);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(wm831x_irqs); i++) {
|
||||
int offset = wm831x_irqs[i].reg - 1;
|
||||
|
||||
|
||||
if (!(primary & wm831x_irqs[i].primary))
|
||||
continue;
|
||||
|
||||
|
||||
status = &status_regs[offset];
|
||||
|
||||
/* Hopefully there should only be one register to read
|
||||
|
|
@ -551,7 +464,7 @@ static void wm831x_irq_worker(struct work_struct *work)
|
|||
dev_err(wm831x->dev,
|
||||
"Failed to read IRQ status: %d\n",
|
||||
*status);
|
||||
goto out_lock;
|
||||
goto out;
|
||||
}
|
||||
|
||||
read[offset] = 1;
|
||||
|
|
@ -560,84 +473,18 @@ static void wm831x_irq_worker(struct work_struct *work)
|
|||
/* Report it if it isn't masked, or forget the status. */
|
||||
if ((*status & ~wm831x->irq_masks_cur[offset])
|
||||
& wm831x_irqs[i].mask)
|
||||
{
|
||||
#if WM831X_IRQ_LIST
|
||||
/*add intterupt handle on list*/
|
||||
hd = kzalloc(sizeof(struct wm831x_handle_irq), GFP_KERNEL);
|
||||
if (!hd)
|
||||
{
|
||||
printk("err:%s:ENOMEM\n",__FUNCTION__);
|
||||
return ;
|
||||
}
|
||||
|
||||
if(i == WM831X_IRQ_ON)
|
||||
wake_lock(&wm831x->handle_wake); //keep wake while handle WM831X_IRQ_ON
|
||||
hd->irq = i;
|
||||
spin_lock_irqsave(&wm831x->work_lock, flags);
|
||||
list_add_tail(&hd->queue, &wm831x->handle_queue);
|
||||
spin_unlock_irqrestore(&wm831x->work_lock, flags);
|
||||
queue_work(wm831x->handle_wq, &wm831x->handle_work);
|
||||
|
||||
#else
|
||||
if(i == WM831X_IRQ_ON)
|
||||
wake_lock(&wm831x->handle_wake); //keep wake while handle WM831X_IRQ_ON
|
||||
handle_nested_irq(wm831x->irq_base + i);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
else
|
||||
*status &= ~wm831x_irqs[i].mask;
|
||||
}
|
||||
|
||||
out_lock:
|
||||
mutex_unlock(&wm831x->irq_lock);
|
||||
|
||||
|
||||
out:
|
||||
for (i = 0; i < ARRAY_SIZE(status_regs); i++) {
|
||||
if (status_regs[i])
|
||||
wm831x_reg_write(wm831x, WM831X_INTERRUPT_STATUS_1 + i,
|
||||
status_regs[i]);
|
||||
}
|
||||
|
||||
#if (WM831X_IRQ_TYPE != IRQF_TRIGGER_LOW)
|
||||
ret = wm831x_set_bits(wm831x, WM831X_IRQ_CONFIG,
|
||||
WM831X_IRQ_IM_MASK, 0);
|
||||
if (ret < 0) {
|
||||
dev_err(wm831x->dev, "Failed to open irq: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
#if (WM831X_IRQ_TYPE == IRQF_TRIGGER_LOW)
|
||||
enable_irq(wm831x->irq);
|
||||
#endif
|
||||
wake_unlock(&wm831x->irq_wake);
|
||||
|
||||
}
|
||||
/* The processing of the primary interrupt occurs in a thread so that
|
||||
* we can interact with the device over I2C or SPI. */
|
||||
static irqreturn_t wm831x_irq_thread(int irq, void *data)
|
||||
{
|
||||
struct wm831x *wm831x = data;
|
||||
int msdelay = 0;
|
||||
/* Shut the interrupt to the CPU up and schedule the actual
|
||||
* handler; we can't check that the IRQ is asserted. */
|
||||
#if (WM831X_IRQ_TYPE == IRQF_TRIGGER_LOW)
|
||||
disable_irq_nosync(irq);
|
||||
#endif
|
||||
wake_lock(&wm831x->irq_wake);
|
||||
if(wm831x->flag_suspend)
|
||||
{
|
||||
spin_lock(&wm831x->flag_lock);
|
||||
wm831x->flag_suspend = 0;
|
||||
spin_unlock(&wm831x->flag_lock);
|
||||
msdelay = 50; //wait for spi/i2c resume
|
||||
printk("%s:msdelay=%d\n",__FUNCTION__,msdelay);
|
||||
}
|
||||
else
|
||||
msdelay = 0;
|
||||
|
||||
queue_delayed_work(wm831x->irq_wq, &wm831x->irq_work, msecs_to_jiffies(msdelay));
|
||||
//printk("%s\n",__FUNCTION__);
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
|
|
@ -645,7 +492,7 @@ int wm831x_irq_init(struct wm831x *wm831x, int irq)
|
|||
{
|
||||
struct wm831x_pdata *pdata = wm831x->dev->platform_data;
|
||||
int i, cur_irq, ret;
|
||||
printk( "wm831x_irq_init:irq=%d,%d\n",irq,pdata->irq_base);
|
||||
|
||||
mutex_init(&wm831x->irq_lock);
|
||||
|
||||
/* Mask the individual interrupt sources */
|
||||
|
|
@ -668,30 +515,9 @@ int wm831x_irq_init(struct wm831x *wm831x, int irq)
|
|||
return 0;
|
||||
}
|
||||
|
||||
wm831x->irq_wq = create_singlethread_workqueue("wm831x-irq");
|
||||
if (!wm831x->irq_wq) {
|
||||
dev_err(wm831x->dev, "Failed to allocate IRQ worker\n");
|
||||
return -ESRCH;
|
||||
}
|
||||
|
||||
|
||||
wm831x->irq = irq;
|
||||
wm831x->flag_suspend = 0;
|
||||
wm831x->irq_base = pdata->irq_base;
|
||||
INIT_DELAYED_WORK(&wm831x->irq_work, wm831x_irq_worker);
|
||||
wake_lock_init(&wm831x->irq_wake, WAKE_LOCK_SUSPEND, "wm831x_irq_wake");
|
||||
wake_lock_init(&wm831x->handle_wake, WAKE_LOCK_SUSPEND, "wm831x_handle_wake");
|
||||
#if WM831X_IRQ_LIST
|
||||
wm831x->handle_wq = create_rt_workqueue("wm831x_handle_wq");
|
||||
if (!wm831x->handle_wq) {
|
||||
printk("cannot create workqueue\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
INIT_WORK(&wm831x->handle_work, wm831x_handle_worker);
|
||||
INIT_LIST_HEAD(&wm831x->handle_queue);
|
||||
|
||||
#endif
|
||||
|
||||
/* Register them with genirq */
|
||||
for (cur_irq = wm831x->irq_base;
|
||||
cur_irq < ARRAY_SIZE(wm831x_irqs) + wm831x->irq_base;
|
||||
|
|
@ -709,22 +535,16 @@ int wm831x_irq_init(struct wm831x *wm831x, int irq)
|
|||
set_irq_noprobe(cur_irq);
|
||||
#endif
|
||||
}
|
||||
#if (WM831X_IRQ_TYPE == IRQF_TRIGGER_LOW)
|
||||
ret = request_threaded_irq(wm831x->irq, wm831x_irq_thread, NULL,
|
||||
IRQF_TRIGGER_LOW| IRQF_ONESHOT,//IRQF_TRIGGER_FALLING, //
|
||||
|
||||
ret = request_threaded_irq(irq, NULL, wm831x_irq_thread,
|
||||
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
|
||||
"wm831x", wm831x);
|
||||
#else
|
||||
ret = request_threaded_irq(wm831x->irq, wm831x_irq_thread, NULL,
|
||||
IRQF_TRIGGER_FALLING, //IRQF_TRIGGER_LOW| IRQF_ONESHOT,//
|
||||
"wm831x", wm831x);
|
||||
#endif
|
||||
if (ret != 0) {
|
||||
dev_err(wm831x->dev, "Failed to request IRQ %d: %d\n",
|
||||
wm831x->irq, ret);
|
||||
irq, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
enable_irq_wake(wm831x->irq); // so wm831x irq can wake up system
|
||||
/* Enable top level interrupts, we mask at secondary level */
|
||||
wm831x_reg_write(wm831x, WM831X_SYSTEM_INTERRUPTS_MASK, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,250 +0,0 @@
|
|||
/*
|
||||
* wm831x-spi.c -- SPI access for Wolfson WM831x PMICs
|
||||
*
|
||||
* Copyright 2009,2010 Wolfson Microelectronics PLC.
|
||||
*
|
||||
* Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/spi/spi.h>
|
||||
#include <linux/gpio.h>
|
||||
|
||||
|
||||
#include <linux/mfd/wm831x/core.h>
|
||||
|
||||
static int wm831x_spi_read_device(struct wm831x *wm831x, unsigned short reg,
|
||||
int bytes, void *dest)
|
||||
{
|
||||
u16 tx_val;
|
||||
u16 *d = dest;
|
||||
int r, ret;
|
||||
|
||||
/* Go register at a time */
|
||||
for (r = reg; r < reg + (bytes / 2); r++) {
|
||||
tx_val = cpu_to_be16(r | 0x8000);
|
||||
//printk("read:reg=0x%x,",reg);
|
||||
ret = spi_write_then_read(wm831x->control_data,
|
||||
(u8 *)&tx_val, 2, (u8 *)d, 2);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
//printk("rec=0x%x\n",be16_to_cpu(*d));
|
||||
//*d = be16_to_cpu(*d);
|
||||
|
||||
d++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm831x_spi_write_device(struct wm831x *wm831x, unsigned short reg,
|
||||
int bytes, void *src)
|
||||
{
|
||||
struct spi_device *spi = wm831x->control_data;
|
||||
u16 *s = src;
|
||||
u16 data[2];
|
||||
int ret, r;
|
||||
|
||||
/* Go register at a time */
|
||||
for (r = reg; r < reg + (bytes / 2); r++) {
|
||||
data[0] = cpu_to_be16(r);
|
||||
data[1] = *s++;
|
||||
//printk("write:reg=0x%x,send=0x%x\n",reg, data[0]);
|
||||
ret = spi_write(spi, (char *)&data, sizeof(data));
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __devinit wm831x_spi_probe(struct spi_device *spi)
|
||||
{
|
||||
struct wm831x *wm831x;
|
||||
enum wm831x_parent type;
|
||||
int ret,gpio,irq;
|
||||
|
||||
/* Currently SPI support for ID tables is unmerged, we're faking it */
|
||||
if (strcmp(spi->modalias, "wm8310") == 0)
|
||||
type = WM8310;
|
||||
else if (strcmp(spi->modalias, "wm8311") == 0)
|
||||
type = WM8311;
|
||||
else if (strcmp(spi->modalias, "wm8312") == 0)
|
||||
type = WM8312;
|
||||
else if (strcmp(spi->modalias, "wm8320") == 0)
|
||||
type = WM8320;
|
||||
else if (strcmp(spi->modalias, "wm8321") == 0)
|
||||
type = WM8321;
|
||||
else if (strcmp(spi->modalias, "wm8325") == 0)
|
||||
type = WM8325;
|
||||
else {
|
||||
dev_err(&spi->dev, "Unknown device type\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
wm831x = kzalloc(sizeof(struct wm831x), GFP_KERNEL);
|
||||
if (wm831x == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
spi->bits_per_word = 16;
|
||||
spi->mode = SPI_MODE_0;
|
||||
|
||||
gpio = spi->irq;
|
||||
ret = gpio_request(gpio, "wm831x");
|
||||
if (ret) {
|
||||
printk( "failed to request rk gpio irq for wm831x \n");
|
||||
return ret;
|
||||
}
|
||||
gpio_pull_updown(gpio, GPIOPullUp);
|
||||
if (ret) {
|
||||
printk("failed to pull up gpio irq for wm831x \n");
|
||||
return ret;
|
||||
}
|
||||
irq = gpio_to_irq(gpio);
|
||||
|
||||
dev_set_drvdata(&spi->dev, wm831x);
|
||||
wm831x->dev = &spi->dev;
|
||||
wm831x->control_data = spi;
|
||||
wm831x->read_dev = wm831x_spi_read_device;
|
||||
wm831x->write_dev = wm831x_spi_write_device;
|
||||
|
||||
return wm831x_device_init(wm831x, type, irq);
|
||||
}
|
||||
|
||||
static int __devexit wm831x_spi_remove(struct spi_device *spi)
|
||||
{
|
||||
struct wm831x *wm831x = dev_get_drvdata(&spi->dev);
|
||||
|
||||
wm831x_device_exit(wm831x);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm831x_spi_suspend(struct spi_device *spi, pm_message_t m)
|
||||
{
|
||||
struct wm831x *wm831x = dev_get_drvdata(&spi->dev);
|
||||
spin_lock(&wm831x->flag_lock);
|
||||
wm831x->flag_suspend = 1;
|
||||
spin_unlock(&wm831x->flag_lock);
|
||||
return wm831x_device_suspend(wm831x);
|
||||
}
|
||||
|
||||
static struct spi_driver wm8310_spi_driver = {
|
||||
.driver = {
|
||||
.name = "wm8310",
|
||||
.bus = &spi_bus_type,
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = wm831x_spi_probe,
|
||||
.remove = __devexit_p(wm831x_spi_remove),
|
||||
.suspend = wm831x_spi_suspend,
|
||||
};
|
||||
|
||||
static struct spi_driver wm8311_spi_driver = {
|
||||
.driver = {
|
||||
.name = "wm8311",
|
||||
.bus = &spi_bus_type,
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = wm831x_spi_probe,
|
||||
.remove = __devexit_p(wm831x_spi_remove),
|
||||
.suspend = wm831x_spi_suspend,
|
||||
};
|
||||
|
||||
static struct spi_driver wm8312_spi_driver = {
|
||||
.driver = {
|
||||
.name = "wm8312",
|
||||
.bus = &spi_bus_type,
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = wm831x_spi_probe,
|
||||
.remove = __devexit_p(wm831x_spi_remove),
|
||||
.suspend = wm831x_spi_suspend,
|
||||
};
|
||||
|
||||
static struct spi_driver wm8320_spi_driver = {
|
||||
.driver = {
|
||||
.name = "wm8320",
|
||||
.bus = &spi_bus_type,
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = wm831x_spi_probe,
|
||||
.remove = __devexit_p(wm831x_spi_remove),
|
||||
.suspend = wm831x_spi_suspend,
|
||||
};
|
||||
|
||||
static struct spi_driver wm8321_spi_driver = {
|
||||
.driver = {
|
||||
.name = "wm8321",
|
||||
.bus = &spi_bus_type,
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = wm831x_spi_probe,
|
||||
.remove = __devexit_p(wm831x_spi_remove),
|
||||
.suspend = wm831x_spi_suspend,
|
||||
};
|
||||
|
||||
static struct spi_driver wm8325_spi_driver = {
|
||||
.driver = {
|
||||
.name = "wm8325",
|
||||
.bus = &spi_bus_type,
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = wm831x_spi_probe,
|
||||
.remove = __devexit_p(wm831x_spi_remove),
|
||||
.suspend = wm831x_spi_suspend,
|
||||
};
|
||||
|
||||
static int __init wm831x_spi_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = spi_register_driver(&wm8310_spi_driver);
|
||||
if (ret != 0)
|
||||
pr_err("Failed to register WM8310 SPI driver: %d\n", ret);
|
||||
|
||||
ret = spi_register_driver(&wm8311_spi_driver);
|
||||
if (ret != 0)
|
||||
pr_err("Failed to register WM8311 SPI driver: %d\n", ret);
|
||||
|
||||
ret = spi_register_driver(&wm8312_spi_driver);
|
||||
if (ret != 0)
|
||||
pr_err("Failed to register WM8312 SPI driver: %d\n", ret);
|
||||
|
||||
ret = spi_register_driver(&wm8320_spi_driver);
|
||||
if (ret != 0)
|
||||
pr_err("Failed to register WM8320 SPI driver: %d\n", ret);
|
||||
|
||||
ret = spi_register_driver(&wm8321_spi_driver);
|
||||
if (ret != 0)
|
||||
pr_err("Failed to register WM8321 SPI driver: %d\n", ret);
|
||||
|
||||
ret = spi_register_driver(&wm8325_spi_driver);
|
||||
if (ret != 0)
|
||||
pr_err("Failed to register WM8325 SPI driver: %d\n", ret);
|
||||
|
||||
return 0;
|
||||
}
|
||||
subsys_initcall(wm831x_spi_init);
|
||||
|
||||
static void __exit wm831x_spi_exit(void)
|
||||
{
|
||||
spi_unregister_driver(&wm8325_spi_driver);
|
||||
spi_unregister_driver(&wm8321_spi_driver);
|
||||
spi_unregister_driver(&wm8320_spi_driver);
|
||||
spi_unregister_driver(&wm8312_spi_driver);
|
||||
spi_unregister_driver(&wm8311_spi_driver);
|
||||
spi_unregister_driver(&wm8310_spi_driver);
|
||||
}
|
||||
module_exit(wm831x_spi_exit);
|
||||
|
||||
MODULE_DESCRIPTION("SPI support for WM831x/2x AudioPlus PMICs");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Mark Brown");
|
||||
|
|
@ -173,9 +173,34 @@ static struct mfd_cell wm8994_regulator_devs[] = {
|
|||
{ .name = "wm8994-ldo", .id = 2 },
|
||||
};
|
||||
|
||||
static struct resource wm8994_codec_resources[] = {
|
||||
{
|
||||
.start = WM8994_IRQ_TEMP_SHUT,
|
||||
.end = WM8994_IRQ_TEMP_WARN,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
static struct resource wm8994_gpio_resources[] = {
|
||||
{
|
||||
.start = WM8994_IRQ_GPIO(1),
|
||||
.end = WM8994_IRQ_GPIO(11),
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
static struct mfd_cell wm8994_devs[] = {
|
||||
{ .name = "wm8994-codec" },
|
||||
{ .name = "wm8994-gpio" },
|
||||
{
|
||||
.name = "wm8994-codec",
|
||||
.num_resources = ARRAY_SIZE(wm8994_codec_resources),
|
||||
.resources = wm8994_codec_resources,
|
||||
},
|
||||
|
||||
{
|
||||
.name = "wm8994-gpio",
|
||||
.num_resources = ARRAY_SIZE(wm8994_gpio_resources),
|
||||
.resources = wm8994_gpio_resources,
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -236,6 +261,11 @@ static int wm8994_device_resume(struct device *dev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
ret = wm8994_write(wm8994, WM8994_INTERRUPT_STATUS_1_MASK,
|
||||
WM8994_NUM_IRQ_REGS * 2, &wm8994->irq_masks_cur);
|
||||
if (ret < 0)
|
||||
dev_err(dev, "Failed to restore interrupt masks: %d\n", ret);
|
||||
|
||||
ret = wm8994_write(wm8994, WM8994_LDO_1, WM8994_NUM_LDO_REGS * 2,
|
||||
&wm8994->ldo_regs);
|
||||
if (ret < 0)
|
||||
|
|
@ -296,8 +326,10 @@ static int wm8994_device_init(struct wm8994 *wm8994, unsigned long id, int irq)
|
|||
wm8994->supplies = kzalloc(sizeof(struct regulator_bulk_data) *
|
||||
ARRAY_SIZE(wm8994_main_supplies),
|
||||
GFP_KERNEL);
|
||||
if (!wm8994->supplies)
|
||||
if (!wm8994->supplies) {
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(wm8994_main_supplies); i++)
|
||||
wm8994->supplies[i].supply = wm8994_main_supplies[i];
|
||||
|
|
@ -348,6 +380,7 @@ static int wm8994_device_init(struct wm8994 *wm8994, unsigned long id, int irq)
|
|||
|
||||
|
||||
if (pdata) {
|
||||
wm8994->irq_base = pdata->irq_base;
|
||||
wm8994->gpio_base = pdata->gpio_base;
|
||||
|
||||
/* GPIO configuration is only applied if it's non-zero */
|
||||
|
|
@ -375,16 +408,20 @@ static int wm8994_device_init(struct wm8994 *wm8994, unsigned long id, int irq)
|
|||
WM8994_LDO1_DISCH, 0);
|
||||
}
|
||||
|
||||
wm8994_irq_init(wm8994);
|
||||
|
||||
ret = mfd_add_devices(wm8994->dev, -1,
|
||||
wm8994_devs, ARRAY_SIZE(wm8994_devs),
|
||||
NULL, 0);
|
||||
if (ret != 0) {
|
||||
dev_err(wm8994->dev, "Failed to add children: %d\n", ret);
|
||||
goto err_enable;
|
||||
goto err_irq;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_irq:
|
||||
wm8994_irq_exit(wm8994);
|
||||
err_enable:
|
||||
regulator_bulk_disable(ARRAY_SIZE(wm8994_main_supplies),
|
||||
wm8994->supplies);
|
||||
|
|
@ -401,6 +438,7 @@ static int wm8994_device_init(struct wm8994 *wm8994, unsigned long id, int irq)
|
|||
static void wm8994_device_exit(struct wm8994 *wm8994)
|
||||
{
|
||||
mfd_remove_devices(wm8994->dev);
|
||||
wm8994_irq_exit(wm8994);
|
||||
regulator_bulk_disable(ARRAY_SIZE(wm8994_main_supplies),
|
||||
wm8994->supplies);
|
||||
regulator_bulk_free(ARRAY_SIZE(wm8994_main_supplies), wm8994->supplies);
|
||||
|
|
@ -459,16 +497,15 @@ static int wm8994_i2c_probe(struct i2c_client *i2c,
|
|||
struct wm8994 *wm8994;
|
||||
|
||||
wm8994 = kzalloc(sizeof(struct wm8994), GFP_KERNEL);
|
||||
if (wm8994 == NULL) {
|
||||
kfree(i2c);
|
||||
if (wm8994 == NULL)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
i2c_set_clientdata(i2c, wm8994);
|
||||
wm8994->dev = &i2c->dev;
|
||||
wm8994->control_data = i2c;
|
||||
wm8994->read_dev = wm8994_i2c_read_device;
|
||||
wm8994->write_dev = wm8994_i2c_write_device;
|
||||
wm8994->irq = i2c->irq;
|
||||
|
||||
return wm8994_device_init(wm8994, id->driver_data, i2c->irq);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ config SENSORS_CAP_PROX
|
|||
Say yes here if you wish to include the Motorola
|
||||
Capacitive Proximity Sensor driver.
|
||||
|
||||
config SENSORS_MOTO_KXTF9
|
||||
config SENSORS_KXTF9
|
||||
tristate "KXTF9 Accelerometer"
|
||||
default n
|
||||
depends on I2C
|
||||
|
|
@ -496,34 +496,9 @@ config TEGRA_CRYPTO_DEV
|
|||
Dev node /dev/tegra-crypto in order to get access to tegra aes
|
||||
hardware from user space
|
||||
|
||||
config STE
|
||||
bool "STE modem control driver"
|
||||
default n
|
||||
|
||||
config MTK23D
|
||||
bool "MTK6223D modem control driver"
|
||||
default n
|
||||
|
||||
config FM580X
|
||||
bool "FM rda580x driver"
|
||||
default n
|
||||
|
||||
config MU509
|
||||
bool "MU509 modem control driver"
|
||||
default n
|
||||
config MW100
|
||||
bool "MW100 modem control driver"
|
||||
default n
|
||||
config RK29_NEWTON
|
||||
bool "RK29_NEWTON misc driver"
|
||||
default n
|
||||
|
||||
source "drivers/misc/c2port/Kconfig"
|
||||
source "drivers/misc/eeprom/Kconfig"
|
||||
source "drivers/misc/cb710/Kconfig"
|
||||
source "drivers/misc/rk29_modem/Kconfig"
|
||||
source "drivers/misc/gps/Kconfig"
|
||||
source "drivers/misc/mpu3050/Kconfig"
|
||||
source "drivers/misc/ts27010mux/Kconfig"
|
||||
source "drivers/misc/iwmc3200top/Kconfig"
|
||||
source "drivers/misc/radio_ctrl/Kconfig"
|
||||
|
|
|
|||
|
|
@ -36,21 +36,12 @@ obj-$(CONFIG_IWMC3200TOP) += iwmc3200top/
|
|||
obj-$(CONFIG_HMC6352) += hmc6352.o
|
||||
obj-y += eeprom/
|
||||
obj-y += cb710/
|
||||
obj-$(CONFIG_MTK23D) += mtk23d.o
|
||||
obj-$(CONFIG_FM580X) += fm580x.o
|
||||
obj-$(CONFIG_MU509) += mu509.o
|
||||
obj-$(CONFIG_MW100) += MW100.o
|
||||
obj-$(CONFIG_STE) += ste.o
|
||||
obj-$(CONFIG_RK29_SUPPORT_MODEM) += rk29_modem/
|
||||
obj-$(CONFIG_GPS_GNS7560) += gps/
|
||||
obj-y += mpu3050/
|
||||
obj-$(CONFIG_RK29_NEWTON) += newton.o
|
||||
obj-$(CONFIG_VMWARE_BALLOON) += vmw_balloon.o
|
||||
obj-$(CONFIG_ARM_CHARLCD) += arm-charlcd.o
|
||||
obj-$(CONFIG_WL127X_RFKILL) += wl127x-rfkill.o
|
||||
obj-$(CONFIG_APANIC) += apanic.o
|
||||
obj-$(CONFIG_SENSORS_AK8975) += akm8975.o
|
||||
obj-$(CONFIG_SENSORS_MOTO_KXTF9)+= kxtf9.o
|
||||
obj-$(CONFIG_SENSORS_KXTF9) += kxtf9.o
|
||||
obj-$(CONFIG_SENSORS_CAP_PROX) += cap_prox.o
|
||||
obj-$(CONFIG_SENSORS_MAX9635) += max9635.o
|
||||
obj-$(CONFIG_SENSORS_NCT1008) += nct1008.o
|
||||
|
|
|
|||
|
|
@ -193,13 +193,8 @@ static int apanic_proc_read(char *buffer, char **start, off_t offset,
|
|||
ctx->mtd->writesize,
|
||||
&len, ctx->bounce);
|
||||
|
||||
#ifdef CONFIG_MTD_RKNAND
|
||||
if (count > (ctx->mtd->writesize - page_offset))
|
||||
count = ctx->mtd->writesize - page_offset;
|
||||
#else
|
||||
if (page_offset)
|
||||
count -= page_offset;
|
||||
#endif
|
||||
memcpy(buffer, ctx->bounce + page_offset, count);
|
||||
|
||||
*start = count;
|
||||
|
|
@ -214,11 +209,6 @@ static int apanic_proc_read(char *buffer, char **start, off_t offset,
|
|||
static void mtd_panic_erase(void)
|
||||
{
|
||||
struct apanic_data *ctx = &drv_ctx;
|
||||
#ifdef CONFIG_MTD_RKNAND
|
||||
size_t wlen;
|
||||
memset(ctx->bounce, 0, ctx->mtd->writesize);
|
||||
ctx->mtd->write(ctx->mtd, 0, ctx->mtd->writesize, &wlen, ctx->bounce);
|
||||
#else
|
||||
struct erase_info erase;
|
||||
DECLARE_WAITQUEUE(wait, current);
|
||||
wait_queue_head_t wait_q;
|
||||
|
|
@ -270,7 +260,6 @@ static void mtd_panic_erase(void)
|
|||
schedule();
|
||||
remove_wait_queue(&wait_q, &wait);
|
||||
}
|
||||
#endif
|
||||
printk(KERN_DEBUG "apanic: %s partition erased\n",
|
||||
CONFIG_APANIC_PLABEL);
|
||||
out:
|
||||
|
|
@ -342,18 +331,14 @@ static void mtd_panic_notify_add(struct mtd_info *mtd)
|
|||
|
||||
if (hdr->magic != PANIC_MAGIC) {
|
||||
printk(KERN_INFO "apanic: No panic data available\n");
|
||||
#ifndef CONFIG_MTD_RKNAND
|
||||
mtd_panic_erase();
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
if (hdr->version != PHDR_VERSION) {
|
||||
printk(KERN_INFO "apanic: Version mismatch (%d != %d)\n",
|
||||
hdr->version, PHDR_VERSION);
|
||||
#ifndef CONFIG_MTD_RKNAND
|
||||
mtd_panic_erase();
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -393,10 +378,8 @@ static void mtd_panic_notify_add(struct mtd_info *mtd)
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef CONFIG_MTD_RKNAND
|
||||
if (!proc_entry_created)
|
||||
mtd_panic_erase();
|
||||
#endif
|
||||
|
||||
return;
|
||||
out_err:
|
||||
|
|
@ -528,7 +511,7 @@ static int apanic(struct notifier_block *this, unsigned long event,
|
|||
printk(KERN_EMERG "Crash partition in use!\n");
|
||||
goto out;
|
||||
}
|
||||
console_offset = ctx->mtd->erasesize;
|
||||
console_offset = ctx->mtd->writesize;
|
||||
|
||||
/*
|
||||
* Write out the console
|
||||
|
|
|
|||
|
|
@ -438,7 +438,7 @@ static int pmem_allocate(int id, unsigned long len)
|
|||
return best_fit;
|
||||
}
|
||||
|
||||
static pgprot_t pmem_phys_mem_access_prot(struct file *file, pgprot_t vma_prot)
|
||||
static pgprot_t phys_mem_access_prot(struct file *file, pgprot_t vma_prot)
|
||||
{
|
||||
int id = get_id(file);
|
||||
#ifdef pgprot_noncached
|
||||
|
|
@ -628,7 +628,7 @@ static int pmem_mmap(struct file *file, struct vm_area_struct *vma)
|
|||
}
|
||||
|
||||
vma->vm_pgoff = pmem_start_addr(id, data) >> PAGE_SHIFT;
|
||||
vma->vm_page_prot = pmem_phys_mem_access_prot(file, vma->vm_page_prot);
|
||||
vma->vm_page_prot = phys_mem_access_prot(file, vma->vm_page_prot);
|
||||
|
||||
if (data->flags & PMEM_FLAGS_CONNECTED) {
|
||||
struct pmem_region_node *region_node;
|
||||
|
|
@ -1086,8 +1086,8 @@ static long pmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
|||
region.offset = pmem_start_addr(id, data);
|
||||
region.len = pmem_len(id, data);
|
||||
}
|
||||
//printk(KERN_INFO "pmem: request for physical address of pmem region "
|
||||
// "from process %d.\n", current->pid);
|
||||
printk(KERN_INFO "pmem: request for physical address of pmem region "
|
||||
"from process %d.\n", current->pid);
|
||||
if (copy_to_user((void __user *)arg, ®ion,
|
||||
sizeof(struct pmem_region)))
|
||||
return -EFAULT;
|
||||
|
|
|
|||
|
|
@ -52,10 +52,6 @@ MODULE_ALIAS("mmc:block");
|
|||
#define INAND_CMD38_ARG_SECTRIM1 0x81
|
||||
#define INAND_CMD38_ARG_SECTRIM2 0x88
|
||||
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
static DEFINE_MUTEX(block_mutex); //added by xbw at 2011-04-21
|
||||
#endif
|
||||
|
||||
/*
|
||||
* max 8 partitions per card
|
||||
*/
|
||||
|
|
@ -114,12 +110,8 @@ static int mmc_blk_open(struct block_device *bdev, fmode_t mode)
|
|||
{
|
||||
struct mmc_blk_data *md = mmc_blk_get(bdev->bd_disk);
|
||||
int ret = -ENXIO;
|
||||
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
mutex_lock(&block_mutex); //added by xbw at 2011-04-21
|
||||
#else
|
||||
//lock_kernel(); // The feature of block_mutex is same with lock_kernel£¬but the better. noted by xbw at 2011-08-09
|
||||
#endif
|
||||
|
||||
lock_kernel();
|
||||
if (md) {
|
||||
if (md->usage == 2)
|
||||
check_disk_change(bdev);
|
||||
|
|
@ -130,12 +122,7 @@ static int mmc_blk_open(struct block_device *bdev, fmode_t mode)
|
|||
ret = -EROFS;
|
||||
}
|
||||
}
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
mutex_unlock(&block_mutex);
|
||||
#else
|
||||
unlock_kernel();
|
||||
#endif
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -143,20 +130,10 @@ static int mmc_blk_open(struct block_device *bdev, fmode_t mode)
|
|||
static int mmc_blk_release(struct gendisk *disk, fmode_t mode)
|
||||
{
|
||||
struct mmc_blk_data *md = disk->private_data;
|
||||
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
mutex_lock(&block_mutex); //added by xbw at 2011-04-21
|
||||
#else
|
||||
//lock_kernel(); // The feature of block_mutex is same with lock_kernel£¬but the better. noted by xbw at 2011-08-09
|
||||
#endif
|
||||
mmc_blk_put(md);
|
||||
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
mutex_unlock(&block_mutex);
|
||||
#else
|
||||
unlock_kernel();
|
||||
#endif
|
||||
|
||||
lock_kernel();
|
||||
mmc_blk_put(md);
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -256,13 +233,6 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card)
|
|||
return result;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) //Deleted by xbw@2011-03-21
|
||||
//static u32 get_card_status(struct mmc_card *card, struct request *req)
|
||||
//{
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
#else
|
||||
static u32 get_card_status(struct mmc_card *card, struct request *req)
|
||||
{
|
||||
struct mmc_command cmd;
|
||||
|
|
@ -275,11 +245,10 @@ static u32 get_card_status(struct mmc_card *card, struct request *req)
|
|||
cmd.flags = MMC_RSP_SPI_R2 | MMC_RSP_R1 | MMC_CMD_AC;
|
||||
err = mmc_wait_for_cmd(card->host, &cmd, 0);
|
||||
if (err)
|
||||
printk(KERN_DEBUG "%s: error %d sending status comand",
|
||||
printk(KERN_ERR "%s: error %d sending status comand",
|
||||
req->rq_disk->disk_name, err);
|
||||
return cmd.resp[0];
|
||||
}
|
||||
#endif
|
||||
|
||||
static int mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req)
|
||||
{
|
||||
|
|
@ -386,22 +355,13 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
|
|||
mmc_claim_host(card->host);
|
||||
|
||||
do {
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
//struct mmc_command cmd;//Deleted by xbw@2011-03-21
|
||||
#else
|
||||
struct mmc_command cmd;
|
||||
#endif
|
||||
|
||||
struct mmc_command cmd;
|
||||
u32 readcmd, writecmd, status = 0;
|
||||
|
||||
memset(&brq, 0, sizeof(struct mmc_blk_request));
|
||||
brq.mrq.cmd = &brq.cmd;
|
||||
brq.mrq.data = &brq.data;
|
||||
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
brq.cmd.retries = 2; //suppot retry read-write; added by xbw@2011-03-21
|
||||
#endif
|
||||
|
||||
|
||||
brq.cmd.arg = blk_rq_pos(req);
|
||||
if (!mmc_card_blockaddr(card))
|
||||
brq.cmd.arg <<= 9;
|
||||
|
|
@ -481,11 +441,6 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
|
|||
|
||||
mmc_queue_bounce_post(mq);
|
||||
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
//not turn CMD18 to CMD17. deleted by xbw at 2011-04-21
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* Check for errors here, but don't jump to cmd_err
|
||||
* until later as we need to wait for the card to leave
|
||||
|
|
@ -494,7 +449,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
|
|||
if (brq.cmd.error || brq.data.error || brq.stop.error) {
|
||||
if (brq.data.blocks > 1 && rq_data_dir(req) == READ) {
|
||||
/* Redo read one sector at a time */
|
||||
printk(KERN_DEBUG "%s: retrying using single "
|
||||
printk(KERN_WARNING "%s: retrying using single "
|
||||
"block read\n", req->rq_disk->disk_name);
|
||||
disable_multi = 1;
|
||||
continue;
|
||||
|
|
@ -502,11 +457,10 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
|
|||
status = get_card_status(card, req);
|
||||
} else if (disable_multi == 1) {
|
||||
disable_multi = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (brq.cmd.error) {
|
||||
printk(KERN_DEBUG "%s: error %d sending read/write "
|
||||
printk(KERN_ERR "%s: error %d sending read/write "
|
||||
"command, response %#x, card status %#x\n",
|
||||
req->rq_disk->disk_name, brq.cmd.error,
|
||||
brq.cmd.resp[0], status);
|
||||
|
|
@ -516,7 +470,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
|
|||
if (brq.data.error == -ETIMEDOUT && brq.mrq.stop)
|
||||
/* 'Stop' response contains card status */
|
||||
status = brq.mrq.stop->resp[0];
|
||||
printk(KERN_DEBUG "%s: error %d transferring data,"
|
||||
printk(KERN_ERR "%s: error %d transferring data,"
|
||||
" sector %u, nr %u, card status %#x\n",
|
||||
req->rq_disk->disk_name, brq.data.error,
|
||||
(unsigned)blk_rq_pos(req),
|
||||
|
|
@ -524,16 +478,12 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
|
|||
}
|
||||
|
||||
if (brq.stop.error) {
|
||||
printk(KERN_DEBUG "%s: error %d sending stop command, "
|
||||
printk(KERN_ERR "%s: error %d sending stop command, "
|
||||
"response %#x, card status %#x\n",
|
||||
req->rq_disk->disk_name, brq.stop.error,
|
||||
brq.stop.resp[0], status);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
//Deleted by xbw@2011-03-21
|
||||
|
||||
#else
|
||||
if (!mmc_host_is_spi(card->host) && rq_data_dir(req) != READ) {
|
||||
do {
|
||||
int err;
|
||||
|
|
@ -543,7 +493,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
|
|||
cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
|
||||
err = mmc_wait_for_cmd(card->host, &cmd, 5);
|
||||
if (err) {
|
||||
printk(KERN_DEBUG "%s: error %d requesting status\n",
|
||||
printk(KERN_ERR "%s: error %d requesting status\n",
|
||||
req->rq_disk->disk_name, err);
|
||||
goto cmd_err;
|
||||
}
|
||||
|
|
@ -563,9 +513,8 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
|
|||
goto cmd_err;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
if (brq.cmd.error || brq.stop.error || brq.data.error) {
|
||||
if (brq.cmd.error || brq.stop.error || brq.data.error) {
|
||||
if (rq_data_dir(req) == READ) {
|
||||
/*
|
||||
* After an error, we redo I/O one sector at a
|
||||
|
|
@ -718,11 +667,6 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
|
|||
|
||||
sprintf(md->disk->disk_name, "mmcblk%d", devidx);
|
||||
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
printk("%s..%d **** devidx=%d, dev_use[0]=%lu, disk_name=%s *** ==xbw[%s]==\n",\
|
||||
__FUNCTION__,__LINE__, devidx, dev_use[0], md->disk->disk_name,mmc_hostname(card->host));
|
||||
#endif
|
||||
|
||||
blk_queue_logical_block_size(md->queue.queue, 512);
|
||||
|
||||
if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) {
|
||||
|
|
|
|||
|
|
@ -211,9 +211,6 @@ static void mmc_wait_done(struct mmc_request *mrq)
|
|||
*/
|
||||
void mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq)
|
||||
{
|
||||
unsigned long datasize, waittime=0xFFFF;
|
||||
u32 multi, unit;
|
||||
|
||||
DECLARE_COMPLETION_ONSTACK(complete);
|
||||
|
||||
mrq->done_data = &complete;
|
||||
|
|
@ -221,47 +218,7 @@ void mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq)
|
|||
|
||||
mmc_start_request(host, mrq);
|
||||
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
if( strncmp( mmc_hostname(host) ,"mmc0" , strlen("mmc0")) )
|
||||
{
|
||||
multi = (mrq->cmd->retries>0)?mrq->cmd->retries:1;
|
||||
waittime = wait_for_completion_timeout(&complete,HZ*7*multi); //sdio; for cmd dead. Modifyed by xbw at 2011-06-02
|
||||
}
|
||||
else
|
||||
{
|
||||
//calculate the timeout value for SDMMC; added by xbw at 2011-09-27
|
||||
if(mrq->data)
|
||||
{
|
||||
unit = 3*(1<<20);// unit=3MB
|
||||
datasize = mrq->data->blksz*mrq->data->blocks;
|
||||
multi = datasize/unit;
|
||||
multi += (datasize%unit)?1:0;
|
||||
multi = (multi>0) ? multi : 1;
|
||||
multi += (mrq->cmd->retries>0)?1:0;
|
||||
waittime = wait_for_completion_timeout(&complete,HZ*7*multi); //It should be longer than bottom driver's time,due to the sum of two cmd time.
|
||||
//modifyed by xbw at 2011-10-08
|
||||
//
|
||||
//example:
|
||||
//rk29_sdmmc_request_end..2336... CMD12 wait busy timeout!!!!! ====xbw=[sd_mmc]====
|
||||
//mmc_wait_for_req..236.. !!!!! wait for CMD25 timeout ===xbw[mmc0]===
|
||||
}
|
||||
else
|
||||
{
|
||||
multi = (mrq->cmd->retries>0)?mrq->cmd->retries:1;
|
||||
waittime = wait_for_completion_timeout(&complete,HZ*7*multi);
|
||||
}
|
||||
}
|
||||
|
||||
if(waittime <= 1)
|
||||
{
|
||||
host->doneflag = 0;
|
||||
mrq->cmd->error = -EIO;
|
||||
printk("%s..%d.. !!!!! wait for CMD%d timeout ===xbw[%s]===\n",\
|
||||
__FUNCTION__, __LINE__, mrq->cmd->opcode, mmc_hostname(host));
|
||||
}
|
||||
#else
|
||||
wait_for_completion(&complete);
|
||||
#endif
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(mmc_wait_for_req);
|
||||
|
|
@ -1471,157 +1428,6 @@ int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from,
|
|||
}
|
||||
EXPORT_SYMBOL(mmc_erase_group_aligned);
|
||||
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
void mmc_rescan(struct work_struct *work)
|
||||
{
|
||||
struct mmc_host *host =
|
||||
container_of(work, struct mmc_host, detect.work);
|
||||
u32 ocr;
|
||||
int err;
|
||||
int extend_wakelock = 0;
|
||||
|
||||
|
||||
mmc_bus_get(host);
|
||||
|
||||
/* if there is a card registered, check whether it is still present */
|
||||
if ((host->bus_ops != NULL) && host->bus_ops->detect && !host->bus_dead)
|
||||
host->bus_ops->detect(host);
|
||||
|
||||
/* If the card was removed the bus will be marked
|
||||
* as dead - extend the wakelock so userspace
|
||||
* can respond */
|
||||
if (host->bus_dead)
|
||||
extend_wakelock = 1;
|
||||
|
||||
mmc_bus_put(host);
|
||||
|
||||
|
||||
mmc_bus_get(host);
|
||||
|
||||
/* if there still is a card present, stop here */
|
||||
if (host->bus_ops != NULL) {
|
||||
mmc_bus_put(host);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* detect a newly inserted card */
|
||||
|
||||
/*
|
||||
* Only we can add a new handler, so it's safe to
|
||||
* release the lock here.
|
||||
*/
|
||||
mmc_bus_put(host);
|
||||
printk("\n%s...%d.. ===== mmc_rescan Begin....======xbw[%s]=====\n",__FILE__, __LINE__, mmc_hostname(host));
|
||||
|
||||
if (host->ops->get_cd && host->ops->get_cd(host) == 0)
|
||||
{
|
||||
printk("\n=================\n%s..%d.. ====find no SDMMC host.====xbw[%s]=====\n", \
|
||||
__FUNCTION__, __LINE__, mmc_hostname(host));
|
||||
|
||||
goto out;
|
||||
}
|
||||
|
||||
mmc_claim_host(host);
|
||||
|
||||
mmc_power_up(host);
|
||||
|
||||
mmc_go_idle(host);
|
||||
|
||||
/*
|
||||
In oder to improve the initialization process in rockchip IC, I modify the following code about the the initialization process of SDIO-SD-MMC.
|
||||
So I deleted the CMD8 and add a conditional to distinguish between the two card type,i.e.SDMMC process and SDIO process.
|
||||
For detail,please refer to "RK29XX Technical Reference Manual" and "SD-MMC-SDIO Specifications".
|
||||
Noted by xbw@2011-04-09
|
||||
*/
|
||||
|
||||
//mmc_send_if_cond(host, host->ocr_avail); //deleted by xbw@2011-04-09
|
||||
#if !defined(CONFIG_USE_SDMMC0_FOR_WIFI_DEVELOP_BOARD)
|
||||
if( strncmp( mmc_hostname(host) ,"mmc0" , strlen("mmc0")) ){
|
||||
#endif
|
||||
/*
|
||||
* First we search for SDIO...
|
||||
*/
|
||||
err = mmc_send_io_op_cond(host, 0, &ocr);
|
||||
if (!err) {
|
||||
printk("\n%s..%d.. ===== Begin to identify card as SDIO-card===xbw[%s]===\n",__FUNCTION__, __LINE__, mmc_hostname(host));
|
||||
|
||||
if (mmc_attach_sdio(host, ocr))
|
||||
{
|
||||
printk("\n=====\n %s..%d.. ===== Initialize SDIO-card unsuccessfully!!! ===xbw[%s]===\n=====\n",\
|
||||
__FUNCTION__, __LINE__, mmc_hostname(host));
|
||||
|
||||
mmc_power_off(host);
|
||||
}
|
||||
else
|
||||
{
|
||||
printk("%s..%d.. ===== Initialize SDIO successfully. ===xbw[%s]===\n",__FUNCTION__, __LINE__, mmc_hostname(host));
|
||||
}
|
||||
extend_wakelock = 1;
|
||||
goto out;
|
||||
}
|
||||
#if !defined(CONFIG_USE_SDMMC0_FOR_WIFI_DEVELOP_BOARD)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ...then normal SD...
|
||||
*/
|
||||
err = mmc_send_app_op_cond(host, 0, &ocr);
|
||||
if (!err) {
|
||||
printk("\n%s..%d.. ===== Begin to identify card as SD-card ===xbw[%s]===\n",__FUNCTION__, __LINE__, mmc_hostname(host));
|
||||
|
||||
if (mmc_attach_sd(host, ocr))
|
||||
{
|
||||
printk("\n=====\n%s..%d.. ===== Initialize SD-card unsuccessfully!!! ===xbw[%s]===\n====\n",\
|
||||
__FUNCTION__, __LINE__, mmc_hostname(host));
|
||||
|
||||
mmc_power_off(host);
|
||||
}
|
||||
else
|
||||
{
|
||||
printk("%s..%d.. ===== Initialize SD-card successfully. ===xbw[%s]===\n",__FUNCTION__, __LINE__, mmc_hostname(host));
|
||||
}
|
||||
extend_wakelock = 1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* ...and finally MMC.
|
||||
*/
|
||||
err = mmc_send_op_cond(host, 0, &ocr);
|
||||
if (!err) {
|
||||
printk("\n%s..%d.. ===== Begin to identify card as MMC-card ===xbw[%s]===\n", __FUNCTION__, __LINE__, mmc_hostname(host));
|
||||
|
||||
if (mmc_attach_mmc(host, ocr))
|
||||
{
|
||||
printk("\n =====\n%s..%d.. ===== Initialize MMC-card unsuccessfully!!! ===xbw[%s]===\n======\n",\
|
||||
__FUNCTION__, __LINE__, mmc_hostname(host));
|
||||
|
||||
mmc_power_off(host);
|
||||
}
|
||||
else
|
||||
{
|
||||
printk("%s...%d.. ===== Initialize MMC-card successfully. ===xbw[%s]===\n",__FUNCTION__, __LINE__, mmc_hostname(host));
|
||||
}
|
||||
extend_wakelock = 1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
mmc_release_host(host);
|
||||
mmc_power_off(host);
|
||||
|
||||
out:
|
||||
|
||||
if (extend_wakelock)
|
||||
wake_lock_timeout(&mmc_delayed_work_wake_lock, HZ / 2);
|
||||
else
|
||||
wake_unlock(&mmc_delayed_work_wake_lock);
|
||||
|
||||
if (host->caps & MMC_CAP_NEEDS_POLL)
|
||||
mmc_schedule_delayed_work(&host->detect, HZ);
|
||||
}
|
||||
|
||||
#else
|
||||
void mmc_rescan(struct work_struct *work)
|
||||
{
|
||||
struct mmc_host *host =
|
||||
|
|
@ -1671,7 +1477,7 @@ void mmc_rescan(struct work_struct *work)
|
|||
* release the lock here.
|
||||
*/
|
||||
mmc_bus_put(host);
|
||||
|
||||
|
||||
if (host->ops->get_cd && host->ops->get_cd(host) == 0)
|
||||
goto out;
|
||||
|
||||
|
|
@ -1680,7 +1486,7 @@ void mmc_rescan(struct work_struct *work)
|
|||
mmc_power_up(host);
|
||||
sdio_reset(host);
|
||||
mmc_go_idle(host);
|
||||
|
||||
|
||||
mmc_send_if_cond(host, host->ocr_avail);
|
||||
|
||||
/*
|
||||
|
|
@ -1736,7 +1542,6 @@ void mmc_rescan(struct work_struct *work)
|
|||
if (host->caps & MMC_CAP_NEEDS_POLL)
|
||||
mmc_schedule_delayed_work(&host->detect, HZ);
|
||||
}
|
||||
#endif
|
||||
|
||||
void mmc_start_host(struct mmc_host *host)
|
||||
{
|
||||
|
|
@ -1920,11 +1725,6 @@ int mmc_resume_host(struct mmc_host *host)
|
|||
mmc_select_voltage(host, host->ocr);
|
||||
}
|
||||
BUG_ON(!host->bus_ops->resume);
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
//panic if the card is being removed during the resume, deleted by xbw at 2011-06-20
|
||||
host->bus_ops->resume(host);
|
||||
|
||||
#else
|
||||
err = host->bus_ops->resume(host);
|
||||
if (err) {
|
||||
printk(KERN_WARNING "%s: error %d during resume "
|
||||
|
|
@ -1932,7 +1732,6 @@ int mmc_resume_host(struct mmc_host *host)
|
|||
mmc_hostname(host), err);
|
||||
err = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
mmc_bus_put(host);
|
||||
|
||||
|
|
|
|||
|
|
@ -378,13 +378,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
|
|||
/* The extra bit indicates that we support high capacity */
|
||||
err = mmc_send_op_cond(host, ocr | (1 << 30), NULL);
|
||||
if (err)
|
||||
{
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
printk("%s..%d.. ====*Identify the card as MMC , but OCR error, so fail to initialize.===xbw[%s]===\n",\
|
||||
__FUNCTION__, __LINE__, mmc_hostname(host));
|
||||
#endif
|
||||
goto err;
|
||||
}
|
||||
|
||||
/*
|
||||
* For SPI, enable CRC as appropriate.
|
||||
|
|
@ -503,10 +497,6 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
|
|||
if (max_dtr > card->ext_csd.hs_max_dtr)
|
||||
max_dtr = card->ext_csd.hs_max_dtr;
|
||||
} else if (max_dtr > card->csd.max_dtr) {
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
//in order to expand the compatibility of card. Added by xbw@2011-03-21
|
||||
card->csd.max_dtr = (card->csd.max_dtr > MMC_FPP_FREQ) ? MMC_FPP_FREQ : (card->csd.max_dtr);
|
||||
#endif
|
||||
max_dtr = card->csd.max_dtr;
|
||||
}
|
||||
|
||||
|
|
@ -708,9 +698,6 @@ static void mmc_attach_bus_ops(struct mmc_host *host)
|
|||
int mmc_attach_mmc(struct mmc_host *host, u32 ocr)
|
||||
{
|
||||
int err;
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
int retry_times = 3;
|
||||
#endif
|
||||
|
||||
BUG_ON(!host);
|
||||
WARN_ON(!host->claimed);
|
||||
|
|
@ -755,33 +742,10 @@ int mmc_attach_mmc(struct mmc_host *host, u32 ocr)
|
|||
goto err;
|
||||
|
||||
mmc_release_host(host);
|
||||
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
//modifyed by xbw at 2011--04-11
|
||||
Retry_add:
|
||||
|
||||
err = mmc_add_card(host->card);
|
||||
if (err)
|
||||
{
|
||||
//retry add the card; Added by xbw
|
||||
if((--retry_times >= 0))
|
||||
{
|
||||
printk("\n%s..%s..%d ****error in add partition, so retry. ===xbw[%s]===\n",__FUNCTION__,__FILE__,__LINE__, mmc_hostname(host));
|
||||
/* sleep some time */
|
||||
set_current_state(TASK_INTERRUPTIBLE);
|
||||
schedule_timeout(HZ/2);
|
||||
|
||||
goto Retry_add;
|
||||
}
|
||||
|
||||
goto remove_card;
|
||||
|
||||
}
|
||||
#else
|
||||
err = mmc_add_card(host->card);
|
||||
if (err)
|
||||
goto remove_card;
|
||||
#endif
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -422,13 +422,8 @@ int mmc_sd_get_cid(struct mmc_host *host, u32 ocr, u32 *cid)
|
|||
ocr |= 1 << 30;
|
||||
|
||||
err = mmc_send_app_op_cond(host, ocr, NULL);
|
||||
if (err) {
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
printk("%s..%d.. ====*Identify the card as SD , but OCR error, so fail to initialize.===xbw[%s]===\n", \
|
||||
__FUNCTION__, __LINE__, mmc_hostname(host));
|
||||
#endif
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
if (mmc_host_is_spi(host))
|
||||
err = mmc_send_cid(host, cid);
|
||||
|
|
@ -503,13 +498,6 @@ int mmc_sd_setup_card(struct mmc_host *host, struct mmc_card *card,
|
|||
printk(KERN_WARNING
|
||||
"%s: read switch failed (attempt %d)\n",
|
||||
mmc_hostname(host), retries);
|
||||
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
if(0 == host->re_initialized_flags)
|
||||
{
|
||||
break; //Added by xbw at 2011-06-21
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
|
@ -562,11 +550,6 @@ unsigned mmc_sd_get_max_clock(struct mmc_card *card)
|
|||
if (max_dtr > card->sw_caps.hs_max_dtr)
|
||||
max_dtr = card->sw_caps.hs_max_dtr;
|
||||
} else if (max_dtr > card->csd.max_dtr) {
|
||||
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
//in order to expand the compatibility of card. Added by xbw@2011-03-21
|
||||
card->csd.max_dtr = (card->csd.max_dtr > SD_FPP_FREQ) ? SD_FPP_FREQ : (card->csd.max_dtr);
|
||||
#endif
|
||||
max_dtr = card->csd.max_dtr;
|
||||
}
|
||||
|
||||
|
|
@ -719,15 +702,6 @@ static void mmc_sd_detect(struct mmc_host *host)
|
|||
err = mmc_send_status(host->card, NULL);
|
||||
if (err) {
|
||||
retries--;
|
||||
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
if(0 == host->re_initialized_flags)
|
||||
{
|
||||
retries = 0;
|
||||
break; //Added by xbw at 2011-06-21
|
||||
}
|
||||
#endif
|
||||
|
||||
udelay(5);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -795,13 +769,6 @@ static int mmc_sd_resume(struct mmc_host *host)
|
|||
mmc_hostname(host), err, retries);
|
||||
mdelay(5);
|
||||
retries--;
|
||||
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
if(0 == host->re_initialized_flags)
|
||||
{
|
||||
break; //Added by xbw at 2011-06-21
|
||||
}
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
|
@ -855,10 +822,6 @@ static void mmc_sd_attach_bus_ops(struct mmc_host *host)
|
|||
int mmc_attach_sd(struct mmc_host *host, u32 ocr)
|
||||
{
|
||||
int err;
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
int retry_times = 3;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MMC_PARANOID_SD_INIT
|
||||
int retries;
|
||||
#endif
|
||||
|
|
@ -916,14 +879,6 @@ int mmc_attach_sd(struct mmc_host *host, u32 ocr)
|
|||
err = mmc_sd_init_card(host, host->ocr, NULL);
|
||||
if (err) {
|
||||
retries--;
|
||||
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
if(0 == host->re_initialized_flags)
|
||||
{
|
||||
retries = 0;
|
||||
break; //Added by xbw at 2011-06-21
|
||||
}
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
|
@ -942,31 +897,9 @@ int mmc_attach_sd(struct mmc_host *host, u32 ocr)
|
|||
|
||||
mmc_release_host(host);
|
||||
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
//modifyed by xbw at 2011--04-11
|
||||
Retry_add:
|
||||
err = mmc_add_card(host->card);
|
||||
if (err)
|
||||
{
|
||||
//retry add the card; Added by xbw
|
||||
if((--retry_times >= 0))
|
||||
{
|
||||
printk("\n%s..%s..%d ****error in add partition, so retry. ===xbw[%s]===\n",__FUNCTION__,__FILE__,__LINE__, mmc_hostname(host));
|
||||
/* sleep some time */
|
||||
set_current_state(TASK_INTERRUPTIBLE);
|
||||
schedule_timeout(HZ/2);
|
||||
|
||||
goto Retry_add;
|
||||
}
|
||||
|
||||
goto remove_card;
|
||||
|
||||
}
|
||||
#else
|
||||
err = mmc_add_card(host->card);
|
||||
if (err)
|
||||
goto remove_card;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -346,13 +346,8 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
|
|||
*/
|
||||
if (!powered_resume) {
|
||||
err = mmc_send_io_op_cond(host, host->ocr, &ocr);
|
||||
if (err) {
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
printk("%s..%d.. ====*Identify the card as SDIO , but OCR error, so fail to initialize.===xbw[%s]===\n", \
|
||||
__FUNCTION__, __LINE__, mmc_hostname(host));
|
||||
#endif
|
||||
if (err)
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -405,16 +400,6 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
|
|||
if (err)
|
||||
goto remove;
|
||||
|
||||
#if defined(CONFIG_SDMMC_RK29) && defined(CONFIG_SDMMC_RK29_OLD) //old driver add the code ,reform to kernel2.6.38
|
||||
/*
|
||||
* Update oldcard with the new RCA received from the SDIO
|
||||
* device -- we're doing this so that it's updated in the
|
||||
* "card" struct when oldcard overwrites that later.
|
||||
*/
|
||||
if (oldcard)
|
||||
oldcard->rca = card->rca;
|
||||
#endif
|
||||
|
||||
mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL);
|
||||
}
|
||||
|
||||
|
|
@ -822,10 +807,6 @@ int sdio_reset_comm(struct mmc_card *card)
|
|||
|
||||
printk("%s():\n", __func__);
|
||||
mmc_claim_host(host);
|
||||
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
host->sdmmc_host_hw_init(mmc_priv(host)); //added by xbw , at 2011-10-18
|
||||
#endif
|
||||
|
||||
mmc_go_idle(host);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,12 +6,6 @@ ifeq ($(CONFIG_MMC_DEBUG),y)
|
|||
EXTRA_CFLAGS += -DDEBUG
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SDMMC_RK29_OLD),y)
|
||||
obj-$(CONFIG_SDMMC_RK29) += rk29_sdmmc_old.o
|
||||
else
|
||||
obj-$(CONFIG_SDMMC_RK29) += rk29_sdmmc.o
|
||||
endif
|
||||
|
||||
obj-$(CONFIG_MMC_ARMMMCI) += mmci.o
|
||||
obj-$(CONFIG_MMC_PXA) += pxamci.o
|
||||
obj-$(CONFIG_MMC_IMX) += imxmmc.o
|
||||
|
|
|
|||
|
|
@ -17,53 +17,270 @@ menuconfig WLAN
|
|||
|
||||
if WLAN
|
||||
|
||||
config WLAN_80211
|
||||
bool "Wireless LAN (IEEE 802.11)"
|
||||
depends on NETDEVICES
|
||||
config PCMCIA_RAYCS
|
||||
tristate "Aviator/Raytheon 2.4GHz wireless support"
|
||||
depends on PCMCIA
|
||||
select WIRELESS_EXT
|
||||
select WEXT_SPY
|
||||
select WEXT_PRIV
|
||||
---help---
|
||||
Say Y if you have any 802.11 wireless LAN hardware.
|
||||
Say Y here if you intend to attach an Aviator/Raytheon PCMCIA
|
||||
(PC-card) wireless Ethernet networking card to your computer.
|
||||
Please read the file <file:Documentation/networking/ray_cs.txt> for
|
||||
details.
|
||||
|
||||
This option does not affect the kernel build, it only
|
||||
lets you choose drivers.
|
||||
To compile this driver as a module, choose M here: the module will be
|
||||
called ray_cs. If unsure, say N.
|
||||
|
||||
choice
|
||||
prompt "WiFi device driver support"
|
||||
default WIFI_NONE
|
||||
config LIBERTAS_THINFIRM
|
||||
tristate "Marvell 8xxx Libertas WLAN driver support with thin firmware"
|
||||
depends on MAC80211
|
||||
select FW_LOADER
|
||||
---help---
|
||||
A library for Marvell Libertas 8xxx devices using thinfirm.
|
||||
|
||||
config WIFI_NONE
|
||||
bool "No WiFi"
|
||||
config LIBERTAS_THINFIRM_DEBUG
|
||||
bool "Enable full debugging output in the Libertas thin firmware module."
|
||||
depends on LIBERTAS_THINFIRM
|
||||
---help---
|
||||
Debugging support.
|
||||
|
||||
config BCM4329
|
||||
depends on WLAN_80211 && MMC
|
||||
select WIRELESS_EXT
|
||||
select WEXT_PRIV
|
||||
select IEEE80211
|
||||
select FW_LOADER
|
||||
bool "Broadcom BCM4329 WiFi/BT Combo SDIO"
|
||||
---help---
|
||||
A library for Broadcom BCM4329 SDIO WLAN/BT combo devices.
|
||||
So far, the following modules have been verified:
|
||||
(1) Samsung SWL-B23
|
||||
config LIBERTAS_THINFIRM_USB
|
||||
tristate "Marvell Libertas 8388 USB 802.11b/g cards with thin firmware"
|
||||
depends on LIBERTAS_THINFIRM && USB
|
||||
---help---
|
||||
A driver for Marvell Libertas 8388 USB devices using thinfirm.
|
||||
|
||||
config MV8686
|
||||
depends on WLAN_80211 && MMC
|
||||
select WIRELESS_EXT
|
||||
select IEEE80211
|
||||
select FW_LOADER
|
||||
bool "Marvell MV8686 SDIO"
|
||||
---help---
|
||||
A library for Marvell 8686 SDIO WLAN devices.
|
||||
So far, the following modules have been verified:
|
||||
(1) Samsung SWL-2480
|
||||
(2) Azurewave AW-GH321
|
||||
(3) USI WM-G-MR-09
|
||||
(4) Murata SP-8HEP-P
|
||||
config AIRO
|
||||
tristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards"
|
||||
depends on ISA_DMA_API && (PCI || BROKEN)
|
||||
select WIRELESS_EXT
|
||||
select CRYPTO
|
||||
select WEXT_SPY
|
||||
select WEXT_PRIV
|
||||
---help---
|
||||
This is the standard Linux driver to support Cisco/Aironet ISA and
|
||||
PCI 802.11 wireless cards.
|
||||
It supports the new 802.11b cards from Cisco (Cisco 34X, Cisco 35X
|
||||
- with or without encryption) as well as card before the Cisco
|
||||
acquisition (Aironet 4500, Aironet 4800, Aironet 4800B).
|
||||
|
||||
source "drivers/net/wireless/bcm4319/Kconfig"
|
||||
source "drivers/net/wireless/rtl8192c/Kconfig"
|
||||
endchoice
|
||||
This driver support both the standard Linux Wireless Extensions
|
||||
and Cisco proprietary API, so both the Linux Wireless Tools and the
|
||||
Cisco Linux utilities can be used to configure the card.
|
||||
|
||||
#source "drivers/net/wireless/bcm4329/Kconfig"
|
||||
The driver can be compiled as a module and will be named "airo".
|
||||
|
||||
endif
|
||||
config ATMEL
|
||||
tristate "Atmel at76c50x chipset 802.11b support"
|
||||
depends on (PCI || PCMCIA)
|
||||
select WIRELESS_EXT
|
||||
select WEXT_PRIV
|
||||
select FW_LOADER
|
||||
select CRC32
|
||||
---help---
|
||||
A driver 802.11b wireless cards based on the Atmel fast-vnet
|
||||
chips. This driver supports standard Linux wireless extensions.
|
||||
|
||||
Many cards based on this chipset do not have flash memory
|
||||
and need their firmware loaded at start-up. If yours is
|
||||
one of these, you will need to provide a firmware image
|
||||
to be loaded into the card by the driver. The Atmel
|
||||
firmware package can be downloaded from
|
||||
<http://www.thekelleys.org.uk/atmel>
|
||||
|
||||
config PCI_ATMEL
|
||||
tristate "Atmel at76c506 PCI cards"
|
||||
depends on ATMEL && PCI
|
||||
---help---
|
||||
Enable support for PCI and mini-PCI cards containing the
|
||||
Atmel at76c506 chip.
|
||||
|
||||
config PCMCIA_ATMEL
|
||||
tristate "Atmel at76c502/at76c504 PCMCIA cards"
|
||||
depends on ATMEL && PCMCIA
|
||||
select WIRELESS_EXT
|
||||
select FW_LOADER
|
||||
select CRC32
|
||||
---help---
|
||||
Enable support for PCMCIA cards containing the
|
||||
Atmel at76c502 and at76c504 chips.
|
||||
|
||||
config AT76C50X_USB
|
||||
tristate "Atmel at76c503/at76c505/at76c505a USB cards"
|
||||
depends on MAC80211 && USB
|
||||
select FW_LOADER
|
||||
---help---
|
||||
Enable support for USB Wireless devices using Atmel at76c503,
|
||||
at76c505 or at76c505a chips.
|
||||
|
||||
config AIRO_CS
|
||||
tristate "Cisco/Aironet 34X/35X/4500/4800 PCMCIA cards"
|
||||
depends on PCMCIA && (BROKEN || !M32R)
|
||||
select WIRELESS_EXT
|
||||
select WEXT_SPY
|
||||
select WEXT_PRIV
|
||||
select CRYPTO
|
||||
select CRYPTO_AES
|
||||
---help---
|
||||
This is the standard Linux driver to support Cisco/Aironet PCMCIA
|
||||
802.11 wireless cards. This driver is the same as the Aironet
|
||||
driver part of the Linux Pcmcia package.
|
||||
It supports the new 802.11b cards from Cisco (Cisco 34X, Cisco 35X
|
||||
- with or without encryption) as well as card before the Cisco
|
||||
acquisition (Aironet 4500, Aironet 4800, Aironet 4800B). It also
|
||||
supports OEM of Cisco such as the DELL TrueMobile 4800 and Xircom
|
||||
802.11b cards.
|
||||
|
||||
This driver support both the standard Linux Wireless Extensions
|
||||
and Cisco proprietary API, so both the Linux Wireless Tools and the
|
||||
Cisco Linux utilities can be used to configure the card.
|
||||
|
||||
config PCMCIA_WL3501
|
||||
tristate "Planet WL3501 PCMCIA cards"
|
||||
depends on EXPERIMENTAL && PCMCIA
|
||||
select WIRELESS_EXT
|
||||
select WEXT_SPY
|
||||
help
|
||||
A driver for WL3501 PCMCIA 802.11 wireless cards made by Planet.
|
||||
It has basic support for Linux wireless extensions and initial
|
||||
micro support for ethtool.
|
||||
|
||||
config PRISM54
|
||||
tristate 'Intersil Prism GT/Duette/Indigo PCI/Cardbus (DEPRECATED)'
|
||||
depends on PCI && EXPERIMENTAL
|
||||
select WIRELESS_EXT
|
||||
select WEXT_SPY
|
||||
select WEXT_PRIV
|
||||
select FW_LOADER
|
||||
---help---
|
||||
This enables support for FullMAC PCI/Cardbus prism54 devices. This
|
||||
driver is now deprecated in favor for the SoftMAC driver, p54pci.
|
||||
p54pci supports FullMAC PCI/Cardbus devices as well. For details on
|
||||
the scheduled removal of this driver on the kernel see the feature
|
||||
removal schedule:
|
||||
|
||||
Documentation/feature-removal-schedule.txt
|
||||
|
||||
For more information refer to the p54 wiki:
|
||||
|
||||
http://wireless.kernel.org/en/users/Drivers/p54
|
||||
|
||||
Note: You need a motherboard with DMA support to use any of these cards
|
||||
|
||||
When built as module you get the module prism54
|
||||
|
||||
config USB_ZD1201
|
||||
tristate "USB ZD1201 based Wireless device support"
|
||||
depends on USB
|
||||
select WIRELESS_EXT
|
||||
select WEXT_PRIV
|
||||
select FW_LOADER
|
||||
---help---
|
||||
Say Y if you want to use wireless LAN adapters based on the ZyDAS
|
||||
ZD1201 chip.
|
||||
|
||||
This driver makes the adapter appear as a normal Ethernet interface,
|
||||
typically on wlan0.
|
||||
|
||||
The zd1201 device requires external firmware to be loaded.
|
||||
This can be found at http://linux-lc100020.sourceforge.net/
|
||||
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called zd1201.
|
||||
|
||||
config USB_NET_RNDIS_WLAN
|
||||
tristate "Wireless RNDIS USB support"
|
||||
depends on USB && EXPERIMENTAL
|
||||
depends on CFG80211
|
||||
select USB_USBNET
|
||||
select USB_NET_CDCETHER
|
||||
select USB_NET_RNDIS_HOST
|
||||
---help---
|
||||
This is a driver for wireless RNDIS devices.
|
||||
These are USB based adapters found in devices such as:
|
||||
|
||||
Buffalo WLI-U2-KG125S
|
||||
U.S. Robotics USR5421
|
||||
Belkin F5D7051
|
||||
Linksys WUSB54GSv2
|
||||
Linksys WUSB54GSC
|
||||
Asus WL169gE
|
||||
Eminent EM4045
|
||||
BT Voyager 1055
|
||||
Linksys WUSB54GSv1
|
||||
U.S. Robotics USR5420
|
||||
BUFFALO WLI-USB-G54
|
||||
|
||||
All of these devices are based on Broadcom 4320 chip which is the
|
||||
only wireless RNDIS chip known to date.
|
||||
|
||||
If you choose to build a module, it'll be called rndis_wlan.
|
||||
|
||||
source "drivers/net/wireless/rtl818x/Kconfig"
|
||||
|
||||
config ADM8211
|
||||
tristate "ADMtek ADM8211 support"
|
||||
depends on MAC80211 && PCI && EXPERIMENTAL
|
||||
select CRC32
|
||||
select EEPROM_93CX6
|
||||
---help---
|
||||
This driver is for ADM8211A, ADM8211B, and ADM8211C based cards.
|
||||
These are PCI/mini-PCI/Cardbus 802.11b chips found in cards such as:
|
||||
|
||||
Xterasys Cardbus XN-2411b
|
||||
Blitz NetWave Point PC
|
||||
TrendNet 221pc
|
||||
Belkin F5D6001
|
||||
SMC 2635W
|
||||
Linksys WPC11 v1
|
||||
Fiberline FL-WL-200X
|
||||
3com Office Connect (3CRSHPW796)
|
||||
Corega WLPCIB-11
|
||||
SMC 2602W V2 EU
|
||||
D-Link DWL-520 Revision C
|
||||
|
||||
However, some of these cards have been replaced with other chips
|
||||
like the RTL8180L (Xterasys Cardbus XN-2411b, Belkin F5D6001) or
|
||||
the Ralink RT2400 (SMC2635W) without a model number change.
|
||||
|
||||
Thanks to Infineon-ADMtek for their support of this driver.
|
||||
|
||||
config MAC80211_HWSIM
|
||||
tristate "Simulated radio testing tool for mac80211"
|
||||
depends on MAC80211
|
||||
---help---
|
||||
This driver is a developer testing tool that can be used to test
|
||||
IEEE 802.11 networking stack (mac80211) functionality. This is not
|
||||
needed for normal wireless LAN usage and is only for testing. See
|
||||
Documentation/networking/mac80211_hwsim for more information on how
|
||||
to use this tool.
|
||||
|
||||
To compile this driver as a module, choose M here: the module will be
|
||||
called mac80211_hwsim. If unsure, say N.
|
||||
|
||||
config MWL8K
|
||||
tristate "Marvell 88W8xxx PCI/PCIe Wireless support"
|
||||
depends on MAC80211 && PCI && EXPERIMENTAL
|
||||
---help---
|
||||
This driver supports Marvell TOPDOG 802.11 wireless cards.
|
||||
|
||||
To compile this driver as a module, choose M here: the module
|
||||
will be called mwl8k. If unsure, say N.
|
||||
|
||||
source "drivers/net/wireless/ath/Kconfig"
|
||||
source "drivers/net/wireless/b43/Kconfig"
|
||||
source "drivers/net/wireless/b43legacy/Kconfig"
|
||||
source "drivers/net/wireless/bcm4329/Kconfig"
|
||||
source "drivers/net/wireless/hostap/Kconfig"
|
||||
source "drivers/net/wireless/ipw2x00/Kconfig"
|
||||
source "drivers/net/wireless/iwlwifi/Kconfig"
|
||||
source "drivers/net/wireless/iwmc3200wifi/Kconfig"
|
||||
source "drivers/net/wireless/libertas/Kconfig"
|
||||
source "drivers/net/wireless/orinoco/Kconfig"
|
||||
source "drivers/net/wireless/p54/Kconfig"
|
||||
source "drivers/net/wireless/rt2x00/Kconfig"
|
||||
source "drivers/net/wireless/wl12xx/Kconfig"
|
||||
source "drivers/net/wireless/zd1211rw/Kconfig"
|
||||
|
||||
endif # WLAN
|
||||
|
|
|
|||
|
|
@ -1,9 +1,56 @@
|
|||
#
|
||||
# Makefile for the Linux Wireless network device drivers.
|
||||
#
|
||||
obj-y += wifi_sys/rkwifi_sys_iface.o
|
||||
obj-$(CONFIG_BCM4329) += bcm4329/
|
||||
obj-$(CONFIG_MV8686) += mv8686/
|
||||
obj-$(CONFIG_BCM4319) += bcm4319/
|
||||
obj-$(CONFIG_RTL8192CU) += rtl8192c/
|
||||
#obj-m += wlan/
|
||||
|
||||
obj-$(CONFIG_IPW2100) += ipw2x00/
|
||||
obj-$(CONFIG_IPW2200) += ipw2x00/
|
||||
|
||||
obj-$(CONFIG_HERMES) += orinoco/
|
||||
|
||||
obj-$(CONFIG_AIRO) += airo.o
|
||||
obj-$(CONFIG_AIRO_CS) += airo_cs.o airo.o
|
||||
|
||||
obj-$(CONFIG_ATMEL) += atmel.o
|
||||
obj-$(CONFIG_PCI_ATMEL) += atmel_pci.o
|
||||
obj-$(CONFIG_PCMCIA_ATMEL) += atmel_cs.o
|
||||
|
||||
obj-$(CONFIG_AT76C50X_USB) += at76c50x-usb.o
|
||||
|
||||
obj-$(CONFIG_PRISM54) += prism54/
|
||||
|
||||
obj-$(CONFIG_HOSTAP) += hostap/
|
||||
obj-$(CONFIG_B43) += b43/
|
||||
obj-$(CONFIG_B43LEGACY) += b43legacy/
|
||||
obj-$(CONFIG_ZD1211RW) += zd1211rw/
|
||||
obj-$(CONFIG_RTL8180) += rtl818x/
|
||||
obj-$(CONFIG_RTL8187) += rtl818x/
|
||||
|
||||
# 16-bit wireless PCMCIA client drivers
|
||||
obj-$(CONFIG_PCMCIA_RAYCS) += ray_cs.o
|
||||
obj-$(CONFIG_PCMCIA_WL3501) += wl3501_cs.o
|
||||
|
||||
obj-$(CONFIG_USB_NET_RNDIS_WLAN) += rndis_wlan.o
|
||||
|
||||
obj-$(CONFIG_USB_ZD1201) += zd1201.o
|
||||
obj-$(CONFIG_LIBERTAS) += libertas/
|
||||
|
||||
obj-$(CONFIG_LIBERTAS_THINFIRM) += libertas_tf/
|
||||
|
||||
obj-$(CONFIG_ADM8211) += adm8211.o
|
||||
|
||||
obj-$(CONFIG_MWL8K) += mwl8k.o
|
||||
|
||||
obj-$(CONFIG_IWLWIFI) += iwlwifi/
|
||||
obj-$(CONFIG_RT2X00) += rt2x00/
|
||||
|
||||
obj-$(CONFIG_P54_COMMON) += p54/
|
||||
|
||||
obj-$(CONFIG_ATH_COMMON) += ath/
|
||||
|
||||
obj-$(CONFIG_MAC80211_HWSIM) += mac80211_hwsim.o
|
||||
|
||||
obj-$(CONFIG_WL12XX) += wl12xx/
|
||||
|
||||
obj-$(CONFIG_IWM) += iwmc3200wifi/
|
||||
|
||||
obj-$(CONFIG_BCM4329) += bcm4329/
|
||||
|
|
|
|||
|
|
@ -22,6 +22,6 @@ config BCM4329_FW_PATH
|
|||
config BCM4329_NVRAM_PATH
|
||||
depends on BCM4329
|
||||
string "NVRAM path"
|
||||
default "/system/etc/firmware/nvram_B23.txt"
|
||||
default "/proc/calibration"
|
||||
---help---
|
||||
Path to the calibration file.
|
||||
|
|
|
|||
|
|
@ -3,16 +3,13 @@ DHDCFLAGS = -DLINUX -DBCMDRIVER -DBCMDONGLEHOST -DDHDTHREAD -DBCMWPA2 \
|
|||
-DUNRELEASEDCHIP -Dlinux -DDHD_SDALIGN=64 -DMAX_HDR_READ=64 \
|
||||
-DDHD_FIRSTREAD=64 -DDHD_GPL -DDHD_SCHED -DBDC -DTOE -DDHD_BCMEVENTS \
|
||||
-DSHOW_EVENTS -DBCMSDIO -DDHD_GPL -DBCMLXSDMMC -DBCMPLATFORM_BUS \
|
||||
-Wall -Wstrict-prototypes -Werror -DCUSTOMER_HW2 \
|
||||
-DDHD_USE_STATIC_BUF -DDHD_DEBUG_TRAP -DSOFTAP -DSDIO_ISR_THREAD \
|
||||
-Wall -Wstrict-prototypes -Werror -DOOB_INTR_ONLY -DCUSTOMER_HW2 \
|
||||
-DDHD_USE_STATIC_BUF -DMMC_SDIO_ABORT -DDHD_DEBUG_TRAP -DSOFTAP \
|
||||
-DEMBEDDED_PLATFORM -DARP_OFFLOAD_SUPPORT -DPKT_FILTER_SUPPORT \
|
||||
-DGET_CUSTOM_MAC_ENABLE -DSET_RANDOM_MAC_SOFTAP -DCSCAN \
|
||||
-DKEEP_ALIVE -DCONFIG_US_NON_DFS_CHANNELS_ONLY \
|
||||
-DGET_CUSTOM_MAC_ENABLE -DSET_RANDOM_MAC_SOFTAP -DCSCAN -DHW_OOB \
|
||||
-DKEEP_ALIVE -DPNO_SUPPORT \
|
||||
-Idrivers/net/wireless/bcm4329 -Idrivers/net/wireless/bcm4329/include
|
||||
|
||||
#options defines dependent on platform board and applicantion requirements:
|
||||
#-DOOB_INTR_ONLY -DMMC_SDIO_ABORT -DHW_OOB
|
||||
|
||||
DHDOFILES = dhd_linux.o linux_osl.o bcmutils.o dhd_common.o dhd_custom_gpio.o \
|
||||
wl_iw.o siutils.o sbutils.o aiutils.o hndpmu.o bcmwifi.o dhd_sdio.o \
|
||||
dhd_linux_sched.o dhd_cdc.o bcmsdh_sdmmc.o bcmsdh.o bcmsdh_linux.o \
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ int bcmsdh_remove(struct device *dev)
|
|||
MFREE(osh, sdhc, sizeof(bcmsdh_hc_t));
|
||||
osl_detach(osh);
|
||||
|
||||
#if !defined(BCMLXSDMMC)
|
||||
#if !defined(BCMLXSDMMC) || defined(OOB_INTR_ONLY)
|
||||
dev_set_drvdata(dev, NULL);
|
||||
#endif /* !defined(BCMLXSDMMC) */
|
||||
|
||||
|
|
@ -661,10 +661,12 @@ void bcmsdh_unregister_oob_intr(void)
|
|||
{
|
||||
SDLX_MSG(("%s: Enter\n", __FUNCTION__));
|
||||
|
||||
set_irq_wake(sdhcinfo->oob_irq, 0);
|
||||
disable_irq(sdhcinfo->oob_irq); /* just in case.. */
|
||||
free_irq(sdhcinfo->oob_irq, NULL);
|
||||
sdhcinfo->oob_irq_registered = FALSE;
|
||||
if (sdhcinfo->oob_irq_registered) {
|
||||
set_irq_wake(sdhcinfo->oob_irq, 0);
|
||||
disable_irq(sdhcinfo->oob_irq); /* just in case.. */
|
||||
free_irq(sdhcinfo->oob_irq, NULL);
|
||||
sdhcinfo->oob_irq_registered = FALSE;
|
||||
}
|
||||
}
|
||||
#endif /* defined(OOB_INTR_ONLY) */
|
||||
/* Module parameters specific to each host-controller driver */
|
||||
|
|
|
|||
|
|
@ -82,7 +82,6 @@ PBCMSDH_SDMMC_INSTANCE gInstance;
|
|||
|
||||
extern int bcmsdh_probe(struct device *dev);
|
||||
extern int bcmsdh_remove(struct device *dev);
|
||||
struct device sdmmc_dev;
|
||||
|
||||
static int bcmsdh_sdmmc_probe(struct sdio_func *func,
|
||||
const struct sdio_device_id *id)
|
||||
|
|
@ -102,7 +101,7 @@ static int bcmsdh_sdmmc_probe(struct sdio_func *func,
|
|||
if(func->device == 0x4) { /* 4318 */
|
||||
gInstance->func[2] = NULL;
|
||||
sd_trace(("NIC found, calling bcmsdh_probe...\n"));
|
||||
ret = bcmsdh_probe(&sdmmc_dev);
|
||||
ret = bcmsdh_probe(&func->dev);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -110,7 +109,7 @@ static int bcmsdh_sdmmc_probe(struct sdio_func *func,
|
|||
|
||||
if (func->num == 2) {
|
||||
sd_trace(("F2 found, calling bcmsdh_probe...\n"));
|
||||
ret = bcmsdh_probe(&sdmmc_dev);
|
||||
ret = bcmsdh_probe(&func->dev);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
@ -126,7 +125,7 @@ static void bcmsdh_sdmmc_remove(struct sdio_func *func)
|
|||
|
||||
if (func->num == 2) {
|
||||
sd_trace(("F2 found, calling bcmsdh_remove...\n"));
|
||||
bcmsdh_remove(&sdmmc_dev);
|
||||
bcmsdh_remove(&func->dev);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -250,10 +249,8 @@ int sdio_function_init(void)
|
|||
if (!gInstance)
|
||||
return -ENOMEM;
|
||||
|
||||
bzero(&sdmmc_dev, sizeof(sdmmc_dev));
|
||||
error = sdio_register_driver(&bcmsdh_sdmmc_driver);
|
||||
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
@ -265,7 +262,6 @@ void sdio_function_cleanup(void)
|
|||
{
|
||||
sd_trace(("%s Enter\n", __FUNCTION__));
|
||||
|
||||
|
||||
sdio_unregister_driver(&bcmsdh_sdmmc_driver);
|
||||
|
||||
if (gInstance)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
* $Id: dhd.h,v 1.32.4.7.2.4.14.49.4.7 2010/11/12 22:48:36 Exp $
|
||||
* $Id: dhd.h,v 1.32.4.7.2.4.14.49.4.9 2011/01/14 22:40:45 Exp $
|
||||
*/
|
||||
|
||||
/****************
|
||||
|
|
@ -164,7 +164,7 @@ typedef struct dhd_pub {
|
|||
char * pktfilter[100];
|
||||
int pktfilter_count;
|
||||
|
||||
uint8 country_code[WLC_CNTRY_BUF_SZ];
|
||||
wl_country_t dhd_cspec; /* Current Locale info */
|
||||
char eventmask[WL_EVENTING_MASK_LEN];
|
||||
|
||||
} dhd_pub_t;
|
||||
|
|
@ -179,7 +179,7 @@ typedef struct dhd_pub {
|
|||
wait_event_interruptible_timeout(a, FALSE, HZ/100); \
|
||||
} \
|
||||
} while (0)
|
||||
#define DHD_PM_RESUME_WAIT(a) _DHD_PM_RESUME_WAIT(a, 30)
|
||||
#define DHD_PM_RESUME_WAIT(a) _DHD_PM_RESUME_WAIT(a, 200)
|
||||
#define DHD_PM_RESUME_WAIT_FOREVER(a) _DHD_PM_RESUME_WAIT(a, ~0)
|
||||
#define DHD_PM_RESUME_RETURN_ERROR(a) do { if (dhd_mmc_suspend) return a; } while (0)
|
||||
#define DHD_PM_RESUME_RETURN do { if (dhd_mmc_suspend) return; } while (0)
|
||||
|
|
@ -214,6 +214,20 @@ typedef struct dhd_pub {
|
|||
|
||||
#define DHD_IF_VIF 0x01 /* Virtual IF (Hidden from user) */
|
||||
|
||||
inline static void NETIF_ADDR_LOCK(struct net_device *dev)
|
||||
{
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29))
|
||||
netif_addr_lock_bh(dev);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline static void NETIF_ADDR_UNLOCK(struct net_device *dev)
|
||||
{
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29))
|
||||
netif_addr_unlock_bh(dev);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Wakelock Functions */
|
||||
extern int dhd_os_wake_lock(dhd_pub_t *pub);
|
||||
extern int dhd_os_wake_unlock(dhd_pub_t *pub);
|
||||
|
|
@ -434,4 +448,9 @@ extern char nv_path[MOD_PARAM_PATHLEN];
|
|||
extern void dhd_wait_for_event(dhd_pub_t *dhd, bool *lockvar);
|
||||
extern void dhd_wait_event_wakeup(dhd_pub_t*dhd);
|
||||
|
||||
/* dhd_commn arp offload wrapers */
|
||||
extern void dhd_arp_cleanup(dhd_pub_t *dhd);
|
||||
int dhd_arp_get_arp_hostip_table(dhd_pub_t *dhd, void *buf, int buflen);
|
||||
void dhd_arp_offload_add_ip(dhd_pub_t *dhd, u32 ipaddr);
|
||||
|
||||
#endif /* _dhd_h_ */
|
||||
|
|
|
|||
|
|
@ -41,8 +41,6 @@
|
|||
#include <dhd_bus.h>
|
||||
#include <dhd_dbg.h>
|
||||
|
||||
uint8 wlan_mac_addr[ETHER_ADDR_LEN];
|
||||
|
||||
extern int dhd_preinit_ioctls(dhd_pub_t *dhd);
|
||||
|
||||
/* Packet alignment for most efficient SDIO (can change based on platform) */
|
||||
|
|
@ -504,7 +502,6 @@ dhd_prot_init(dhd_pub_t *dhd)
|
|||
return ret;
|
||||
}
|
||||
memcpy(dhd->mac.octet, buf, ETHER_ADDR_LEN);
|
||||
memcpy(wlan_mac_addr, buf, ETHER_ADDR_LEN);
|
||||
|
||||
dhd_os_proto_unblock(dhd);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
* $Id: dhd_common.c,v 1.5.6.8.2.6.6.69.4.20 2010/12/20 23:37:28 Exp $
|
||||
* $Id: dhd_common.c,v 1.5.6.8.2.6.6.69.4.25 2011-02-11 21:16:02 Exp $
|
||||
*/
|
||||
#include <typedefs.h>
|
||||
#include <osl.h>
|
||||
|
|
@ -39,9 +39,6 @@
|
|||
|
||||
#include <wlioctl.h>
|
||||
|
||||
#define CONFIG_BCM4329_FW_PATH "/system/etc/firmware/fw_bcm4329.bin"
|
||||
#define CONFIG_BCM4329_NVRAM_PATH "/system/etc/firmware/nvram_B23.txt"
|
||||
|
||||
#ifdef SET_RANDOM_MAC_SOFTAP
|
||||
#include <linux/random.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
|
@ -1223,6 +1220,82 @@ dhd_arp_offload_enable(dhd_pub_t * dhd, int arp_enable)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
void dhd_arp_cleanup(dhd_pub_t *dhd)
|
||||
{
|
||||
#ifdef ARP_OFFLOAD_SUPPORT
|
||||
int ret = 0;
|
||||
int iov_len = 0;
|
||||
char iovbuf[128];
|
||||
|
||||
if (dhd == NULL) return;
|
||||
|
||||
dhd_os_proto_block(dhd);
|
||||
|
||||
iov_len = bcm_mkiovar("arp_hostip_clear", 0, 0, iovbuf, sizeof(iovbuf));
|
||||
if ((ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, iov_len)) < 0)
|
||||
DHD_ERROR(("%s failed code %d\n", __FUNCTION__, ret));
|
||||
|
||||
iov_len = bcm_mkiovar("arp_table_clear", 0, 0, iovbuf, sizeof(iovbuf));
|
||||
if ((ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, iov_len)) < 0)
|
||||
DHD_ERROR(("%s failed code %d\n", __FUNCTION__, ret));
|
||||
|
||||
dhd_os_proto_unblock(dhd);
|
||||
|
||||
#endif /* ARP_OFFLOAD_SUPPORT */
|
||||
}
|
||||
|
||||
void dhd_arp_offload_add_ip(dhd_pub_t *dhd, u32 ipaddr)
|
||||
{
|
||||
#ifdef ARP_OFFLOAD_SUPPORT
|
||||
int iov_len = 0;
|
||||
char iovbuf[32];
|
||||
int retcode;
|
||||
|
||||
dhd_os_proto_block(dhd);
|
||||
|
||||
iov_len = bcm_mkiovar("arp_hostip", (char *)&ipaddr, 4, iovbuf, sizeof(iovbuf));
|
||||
retcode = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, iov_len);
|
||||
|
||||
dhd_os_proto_unblock(dhd);
|
||||
|
||||
if (retcode)
|
||||
DHD_TRACE(("%s: ARP ip addr add failed, retcode = %d\n",
|
||||
__FUNCTION__, retcode));
|
||||
else
|
||||
DHD_TRACE(("%s: ARP ipaddr entry added\n",
|
||||
__FUNCTION__));
|
||||
#endif /* ARP_OFFLOAD_SUPPORT */
|
||||
}
|
||||
|
||||
|
||||
int dhd_arp_get_arp_hostip_table(dhd_pub_t *dhd, void *buf, int buflen)
|
||||
{
|
||||
#ifdef ARP_OFFLOAD_SUPPORT
|
||||
int retcode;
|
||||
int iov_len = 0;
|
||||
|
||||
if (!buf)
|
||||
return -1;
|
||||
|
||||
dhd_os_proto_block(dhd);
|
||||
|
||||
iov_len = bcm_mkiovar("arp_hostip", 0, 0, buf, buflen);
|
||||
retcode = dhdcdc_query_ioctl(dhd, 0, WLC_GET_VAR, buf, buflen);
|
||||
|
||||
dhd_os_proto_unblock(dhd);
|
||||
|
||||
if (retcode) {
|
||||
DHD_TRACE(("%s: ioctl WLC_GET_VAR error %d\n",
|
||||
__FUNCTION__, retcode));
|
||||
|
||||
return -1;
|
||||
}
|
||||
#endif /* ARP_OFFLOAD_SUPPORT */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
dhd_preinit_ioctls(dhd_pub_t *dhd)
|
||||
{
|
||||
|
|
@ -1289,15 +1362,11 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
|
|||
}
|
||||
#endif /* SET_RANDOM_MAC_SOFTAP */
|
||||
|
||||
/* Set Country code
|
||||
* "US" ---> 11 channels, this is default setting.
|
||||
* "EU" ---> 13 channels
|
||||
* "JP" ---> 14 channels
|
||||
*/
|
||||
strcpy(dhd->country_code, "EU");
|
||||
if (dhd->country_code[0] != 0) {
|
||||
if (dhdcdc_set_ioctl(dhd, 0, WLC_SET_COUNTRY,
|
||||
dhd->country_code, sizeof(dhd->country_code)) < 0) {
|
||||
/* Set Country code */
|
||||
if (dhd->dhd_cspec.ccode[0] != 0) {
|
||||
bcm_mkiovar("country", (char *)&dhd->dhd_cspec, \
|
||||
sizeof(wl_country_t), iovbuf, sizeof(iovbuf));
|
||||
if ((ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf))) < 0) {
|
||||
DHD_ERROR(("%s: country code setting failed\n", __FUNCTION__));
|
||||
}
|
||||
}
|
||||
|
|
@ -1904,6 +1973,7 @@ int dhd_pno_clean(dhd_pub_t *dhd)
|
|||
int dhd_pno_enable(dhd_pub_t *dhd, int pfn_enabled)
|
||||
{
|
||||
char iovbuf[128];
|
||||
uint8 bssid[6];
|
||||
int ret = -1;
|
||||
|
||||
if ((!dhd) && ((pfn_enabled != 0) || (pfn_enabled != 1))) {
|
||||
|
|
@ -1911,6 +1981,20 @@ int dhd_pno_enable(dhd_pub_t *dhd, int pfn_enabled)
|
|||
return ret;
|
||||
}
|
||||
|
||||
memset(iovbuf, 0, sizeof(iovbuf));
|
||||
|
||||
/* Check if disassoc to enable pno */
|
||||
if ((pfn_enabled) && \
|
||||
((ret = dhdcdc_set_ioctl(dhd, 0, WLC_GET_BSSID, \
|
||||
(char *)&bssid, ETHER_ADDR_LEN)) == BCME_NOTASSOCIATED)) {
|
||||
DHD_TRACE(("%s pno enable called in disassoc mode\n", __FUNCTION__));
|
||||
}
|
||||
else if (pfn_enabled) {
|
||||
DHD_ERROR(("%s pno enable called in assoc mode ret=%d\n", \
|
||||
__FUNCTION__, ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Enable/disable PNO */
|
||||
if ((ret = bcm_mkiovar("pfn", (char *)&pfn_enabled, 4, iovbuf, sizeof(iovbuf))) > 0) {
|
||||
if ((ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf))) < 0) {
|
||||
|
|
@ -1929,7 +2013,8 @@ int dhd_pno_enable(dhd_pub_t *dhd, int pfn_enabled)
|
|||
|
||||
/* Function to execute combined scan */
|
||||
int
|
||||
dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t* ssids_local, int nssid, ushort scan_fr)
|
||||
dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t* ssids_local, int nssid, ushort scan_fr, \
|
||||
int pno_repeat, int pno_freq_expo_max)
|
||||
{
|
||||
int err = -1;
|
||||
char iovbuf[128];
|
||||
|
|
@ -1974,12 +2059,23 @@ dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t* ssids_local, int nssid, ushort scan_fr)
|
|||
pfn_param.version = htod32(PFN_VERSION);
|
||||
pfn_param.flags = htod16((PFN_LIST_ORDER << SORT_CRITERIA_BIT));
|
||||
|
||||
/* check and set extra pno params */
|
||||
if ((pno_repeat != 0) || (pno_freq_expo_max != 0)) {
|
||||
pfn_param.flags |= htod16(ENABLE << ENABLE_ADAPTSCAN_BIT);
|
||||
pfn_param.repeat_scan = htod32(pno_repeat);
|
||||
pfn_param.max_freq_adjust = htod32(pno_freq_expo_max);
|
||||
}
|
||||
|
||||
/* set up pno scan fr */
|
||||
if (scan_fr != 0)
|
||||
pfn_param.scan_freq = htod32(scan_fr);
|
||||
|
||||
if (pfn_param.scan_freq > PNO_SCAN_MAX_FW) {
|
||||
DHD_ERROR(("%s pno freq above %d sec\n", __FUNCTION__, PNO_SCAN_MAX_FW));
|
||||
if (pfn_param.scan_freq > PNO_SCAN_MAX_FW_SEC) {
|
||||
DHD_ERROR(("%s pno freq above %d sec\n", __FUNCTION__, PNO_SCAN_MAX_FW_SEC));
|
||||
return err;
|
||||
}
|
||||
if (pfn_param.scan_freq < PNO_SCAN_MIN_FW_SEC) {
|
||||
DHD_ERROR(("%s pno freq less %d sec\n", __FUNCTION__, PNO_SCAN_MIN_FW_SEC));
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -1991,8 +2087,6 @@ dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t* ssids_local, int nssid, ushort scan_fr)
|
|||
|
||||
pfn_element.bss_type = htod32(DOT11_BSSTYPE_INFRASTRUCTURE);
|
||||
pfn_element.auth = (DOT11_OPEN_SYSTEM);
|
||||
pfn_element.wpa_auth = htod32(WPA_AUTH_PFN_ANY);
|
||||
pfn_element.wsec = htod32(0);
|
||||
pfn_element.infra = htod32(1);
|
||||
|
||||
memcpy((char *)pfn_element.ssid.SSID, ssids_local[i].SSID, ssids_local[i].SSID_len);
|
||||
|
|
@ -2008,8 +2102,9 @@ dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t* ssids_local, int nssid, ushort scan_fr)
|
|||
return err;
|
||||
}
|
||||
else
|
||||
DHD_ERROR(("%s set OK with PNO time=%d\n", __FUNCTION__, \
|
||||
pfn_param.scan_freq));
|
||||
DHD_ERROR(("%s set OK with PNO time=%d repeat=%d max_adjust=%d\n", \
|
||||
__FUNCTION__, pfn_param.scan_freq, \
|
||||
pfn_param.repeat_scan, pfn_param.max_freq_adjust));
|
||||
}
|
||||
else DHD_ERROR(("%s failed err=%d\n", __FUNCTION__, err));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
* $Id: dhd_custom_gpio.c,v 1.1.4.8.4.1 2010/09/02 23:13:16 Exp $
|
||||
* $Id: dhd_custom_gpio.c,v 1.1.4.8.4.4 2011/01/20 20:23:09 Exp $
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -47,6 +47,7 @@ int wifi_set_carddetect(int on);
|
|||
int wifi_set_power(int on, unsigned long msec);
|
||||
int wifi_get_irq_number(unsigned long *irq_flags_ptr);
|
||||
int wifi_get_mac_addr(unsigned char *buf);
|
||||
void *wifi_get_country_code(char *ccode);
|
||||
#endif
|
||||
|
||||
#if defined(OOB_INTR_ONLY)
|
||||
|
|
@ -177,3 +178,95 @@ dhd_custom_get_mac_address(unsigned char *buf)
|
|||
return ret;
|
||||
}
|
||||
#endif /* GET_CUSTOM_MAC_ENABLE */
|
||||
|
||||
/* Customized Locale table : OPTIONAL feature */
|
||||
const struct cntry_locales_custom translate_custom_table[] = {
|
||||
/* Table should be filled out based on custom platform regulatory requirement */
|
||||
#ifdef EXAMPLE_TABLE
|
||||
{"", "XY", 4}, /* universal */
|
||||
{"US", "US", 69}, /* input ISO "US" to : US regrev 69 */
|
||||
{"CA", "US", 69}, /* input ISO "CA" to : US regrev 69 */
|
||||
{"EU", "EU", 5}, /* European union countries */
|
||||
{"AT", "EU", 5},
|
||||
{"BE", "EU", 5},
|
||||
{"BG", "EU", 5},
|
||||
{"CY", "EU", 5},
|
||||
{"CZ", "EU", 5},
|
||||
{"DK", "EU", 5},
|
||||
{"EE", "EU", 5},
|
||||
{"FI", "EU", 5},
|
||||
{"FR", "EU", 5},
|
||||
{"DE", "EU", 5},
|
||||
{"GR", "EU", 5},
|
||||
{"HU", "EU", 5},
|
||||
{"IE", "EU", 5},
|
||||
{"IT", "EU", 5},
|
||||
{"LV", "EU", 5},
|
||||
{"LI", "EU", 5},
|
||||
{"LT", "EU", 5},
|
||||
{"LU", "EU", 5},
|
||||
{"MT", "EU", 5},
|
||||
{"NL", "EU", 5},
|
||||
{"PL", "EU", 5},
|
||||
{"PT", "EU", 5},
|
||||
{"RO", "EU", 5},
|
||||
{"SK", "EU", 5},
|
||||
{"SI", "EU", 5},
|
||||
{"ES", "EU", 5},
|
||||
{"SE", "EU", 5},
|
||||
{"GB", "EU", 5}, /* input ISO "GB" to : EU regrev 05 */
|
||||
{"IL", "IL", 0},
|
||||
{"CH", "CH", 0},
|
||||
{"TR", "TR", 0},
|
||||
{"NO", "NO", 0},
|
||||
{"KR", "XY", 3},
|
||||
{"AU", "XY", 3},
|
||||
{"CN", "XY", 3}, /* input ISO "CN" to : XY regrev 03 */
|
||||
{"TW", "XY", 3},
|
||||
{"AR", "XY", 3},
|
||||
{"MX", "XY", 3}
|
||||
#endif /* EXAMPLE_TABLE */
|
||||
};
|
||||
|
||||
|
||||
/* Customized Locale convertor
|
||||
* input : ISO 3166-1 country abbreviation
|
||||
* output: customized cspec
|
||||
*/
|
||||
void get_customized_country_code(char *country_iso_code, wl_country_t *cspec)
|
||||
{
|
||||
#ifdef CUSTOMER_HW2
|
||||
struct cntry_locales_custom *cloc_ptr;
|
||||
|
||||
if (!cspec)
|
||||
return;
|
||||
|
||||
cloc_ptr = wifi_get_country_code(country_iso_code);
|
||||
if (cloc_ptr) {
|
||||
strlcpy(cspec->ccode, cloc_ptr->custom_locale, WLC_CNTRY_BUF_SZ);
|
||||
cspec->rev = cloc_ptr->custom_locale_rev;
|
||||
}
|
||||
return;
|
||||
#else
|
||||
int size, i;
|
||||
|
||||
size = ARRAYSIZE(translate_custom_table);
|
||||
|
||||
if (cspec == 0)
|
||||
return;
|
||||
|
||||
if (size == 0)
|
||||
return;
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
if (strcmp(country_iso_code, translate_custom_table[i].iso_abbrev) == 0) {
|
||||
memcpy(cspec->ccode, translate_custom_table[i].custom_locale, WLC_CNTRY_BUF_SZ);
|
||||
cspec->rev = translate_custom_table[i].custom_locale_rev;
|
||||
return;
|
||||
}
|
||||
}
|
||||
memcpy(cspec->ccode, translate_custom_table[0].custom_locale, WLC_CNTRY_BUF_SZ);
|
||||
cspec->rev = translate_custom_table[0].custom_locale_rev;
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
* $Id: dhd_linux.c,v 1.65.4.9.2.12.2.104.4.35 2010/11/17 03:13:21 Exp $
|
||||
* $Id: dhd_linux.c,v 1.65.4.9.2.12.2.104.4.40 2011/02/03 19:55:18 Exp $
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_WIFI_CONTROL_FUNC
|
||||
|
|
@ -43,11 +43,11 @@
|
|||
#include <linux/ethtool.h>
|
||||
#include <linux/fcntl.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/inetdevice.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/unaligned.h>
|
||||
|
||||
#include <wifi_version.h>
|
||||
#include <epivers.h>
|
||||
#include <bcmutils.h>
|
||||
#include <bcmendian.h>
|
||||
|
|
@ -63,16 +63,12 @@
|
|||
#include <linux/wakelock.h>
|
||||
#endif
|
||||
#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC)
|
||||
//#include <linux/wlan_plat.h>
|
||||
#include <mach/board.h>
|
||||
#include <linux/wlan_plat.h>
|
||||
|
||||
struct semaphore wifi_control_sem;
|
||||
|
||||
struct dhd_bus *g_bus;
|
||||
|
||||
extern void bcm4329_power_save_exit(void);
|
||||
extern void bcm4329_power_save_init(void);
|
||||
|
||||
static struct wifi_platform_data *wifi_control_data = NULL;
|
||||
static struct resource *wifi_irqres = NULL;
|
||||
|
||||
|
|
@ -131,6 +127,17 @@ int wifi_get_mac_addr(unsigned char *buf)
|
|||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
void *wifi_get_country_code(char *ccode)
|
||||
{
|
||||
DHD_TRACE(("%s\n", __FUNCTION__));
|
||||
if (!ccode)
|
||||
return NULL;
|
||||
if (wifi_control_data && wifi_control_data->get_country_code) {
|
||||
return wifi_control_data->get_country_code(ccode);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int wifi_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct wifi_platform_data *wifi_ctrl =
|
||||
|
|
@ -161,14 +168,21 @@ static int wifi_remove(struct platform_device *pdev)
|
|||
up(&wifi_control_sem);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wifi_suspend(struct platform_device *pdev, pm_message_t state)
|
||||
{
|
||||
DHD_TRACE(("##> %s\n", __FUNCTION__));
|
||||
#if defined(OOB_INTR_ONLY)
|
||||
bcmsdh_oob_intr_set(0);
|
||||
#endif /* (OOB_INTR_ONLY) */
|
||||
return 0;
|
||||
}
|
||||
static int wifi_resume(struct platform_device *pdev)
|
||||
{
|
||||
DHD_TRACE(("##> %s\n", __FUNCTION__));
|
||||
#if defined(OOB_INTR_ONLY)
|
||||
bcmsdh_oob_intr_set(1);
|
||||
#endif /* (OOB_INTR_ONLY) */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -195,6 +209,12 @@ void wifi_del_dev(void)
|
|||
}
|
||||
#endif /* defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) */
|
||||
|
||||
static int dhd_device_event(struct notifier_block *this, unsigned long event,
|
||||
void *ptr);
|
||||
|
||||
static struct notifier_block dhd_notifier = {
|
||||
.notifier_call = dhd_device_event
|
||||
};
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP)
|
||||
#include <linux/suspend.h>
|
||||
|
|
@ -380,7 +400,7 @@ uint dhd_roam = 1;
|
|||
uint dhd_radio_up = 1;
|
||||
|
||||
/* Network inteface name */
|
||||
char iface_name[IFNAMSIZ] = "wlan0";
|
||||
char iface_name[IFNAMSIZ];
|
||||
module_param_string(iface_name, iface_name, IFNAMSIZ, 0);
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
|
||||
|
|
@ -768,13 +788,13 @@ _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
|
|||
ASSERT(dhd && dhd->iflist[ifidx]);
|
||||
dev = dhd->iflist[ifidx]->net;
|
||||
|
||||
netif_addr_lock_bh(dev);
|
||||
NETIF_ADDR_LOCK(dev);
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
|
||||
cnt = netdev_mc_count(dev);
|
||||
#else
|
||||
cnt = dev->mc_count;
|
||||
#endif
|
||||
netif_addr_unlock_bh(dev);
|
||||
NETIF_ADDR_UNLOCK(dev);
|
||||
|
||||
/* Determine initial value of allmulti flag */
|
||||
allmulti = (dev->flags & IFF_ALLMULTI) ? TRUE : FALSE;
|
||||
|
|
@ -794,7 +814,7 @@ _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
|
|||
memcpy(bufp, &cnt, sizeof(cnt));
|
||||
bufp += sizeof(cnt);
|
||||
|
||||
netif_addr_lock_bh(dev);
|
||||
NETIF_ADDR_LOCK(dev);
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
if (!cnt)
|
||||
|
|
@ -804,12 +824,12 @@ _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
|
|||
cnt--;
|
||||
}
|
||||
#else
|
||||
for (mclist = dev->mc_list;(mclist && (cnt > 0)); cnt--, mclist = mclist->next) {
|
||||
for (mclist = dev->mc_list; (mclist && (cnt > 0)); cnt--, mclist = mclist->next) {
|
||||
memcpy(bufp, (void *)mclist->dmi_addr, ETHER_ADDR_LEN);
|
||||
bufp += ETHER_ADDR_LEN;
|
||||
}
|
||||
#endif
|
||||
netif_addr_unlock_bh(dev);
|
||||
NETIF_ADDR_UNLOCK(dev);
|
||||
|
||||
memset(&ioc, 0, sizeof(ioc));
|
||||
ioc.cmd = WLC_SET_VAR;
|
||||
|
|
@ -1907,8 +1927,6 @@ dhd_open(struct net_device *net)
|
|||
wl_control_wl_start(net);
|
||||
|
||||
ifidx = dhd_net2idx(dhd, net);
|
||||
if (ifidx == DHD_BAD_IF)
|
||||
return -1;
|
||||
DHD_TRACE(("%s: ifidx %d\n", __FUNCTION__, ifidx));
|
||||
|
||||
if ((dhd->iflist[ifidx]) && (dhd->iflist[ifidx]->state == WLC_E_IF_DEL)) {
|
||||
|
|
@ -2011,6 +2029,7 @@ dhd_del_if(dhd_info_t *dhd, int ifidx)
|
|||
up(&dhd->sysioc_sem);
|
||||
}
|
||||
|
||||
|
||||
dhd_pub_t *
|
||||
dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
|
||||
{
|
||||
|
|
@ -2167,6 +2186,8 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
|
|||
register_early_suspend(&dhd->early_suspend);
|
||||
#endif
|
||||
|
||||
register_inetaddr_notifier(&dhd_notifier);
|
||||
|
||||
return &dhd->pub;
|
||||
|
||||
fail:
|
||||
|
|
@ -2192,12 +2213,15 @@ dhd_bus_start(dhd_pub_t *dhdp)
|
|||
|
||||
DHD_TRACE(("%s: \n", __FUNCTION__));
|
||||
|
||||
dhd_os_sdlock(dhdp);
|
||||
|
||||
/* try to download image and nvram to the dongle */
|
||||
if (dhd->pub.busstate == DHD_BUS_DOWN) {
|
||||
if (!(dhd_bus_download_firmware(dhd->pub.bus, dhd->pub.osh,
|
||||
fw_path, nv_path))) {
|
||||
DHD_ERROR(("%s: dhdsdio_probe_download failed. firmware = %s nvram = %s\n",
|
||||
__FUNCTION__, fw_path, nv_path));
|
||||
dhd_os_sdunlock(dhdp);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -2207,8 +2231,9 @@ dhd_bus_start(dhd_pub_t *dhdp)
|
|||
dhd_os_wd_timer(&dhd->pub, dhd_watchdog_ms);
|
||||
|
||||
/* Bring up the bus */
|
||||
if ((ret = dhd_bus_init(&dhd->pub, TRUE)) != 0) {
|
||||
if ((ret = dhd_bus_init(&dhd->pub, FALSE)) != 0) {
|
||||
DHD_ERROR(("%s, dhd_bus_init failed %d\n", __FUNCTION__, ret));
|
||||
dhd_os_sdunlock(dhdp);
|
||||
return ret;
|
||||
}
|
||||
#if defined(OOB_INTR_ONLY)
|
||||
|
|
@ -2217,6 +2242,7 @@ dhd_bus_start(dhd_pub_t *dhdp)
|
|||
dhd->wd_timer_valid = FALSE;
|
||||
del_timer_sync(&dhd->timer);
|
||||
DHD_ERROR(("%s Host failed to resgister for OOB\n", __FUNCTION__));
|
||||
dhd_os_sdunlock(dhdp);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
|
@ -2229,9 +2255,12 @@ dhd_bus_start(dhd_pub_t *dhdp)
|
|||
dhd->wd_timer_valid = FALSE;
|
||||
del_timer_sync(&dhd->timer);
|
||||
DHD_ERROR(("%s failed bus is not ready\n", __FUNCTION__));
|
||||
dhd_os_sdunlock(dhdp);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
dhd_os_sdunlock(dhdp);
|
||||
|
||||
#ifdef EMBEDDED_PLATFORM
|
||||
bcm_mkiovar("event_msgs", dhdp->eventmask, WL_EVENTING_MASK_LEN, iovbuf, sizeof(iovbuf));
|
||||
dhdcdc_query_ioctl(dhdp, 0, WLC_GET_VAR, iovbuf, sizeof(iovbuf));
|
||||
|
|
@ -2319,6 +2348,48 @@ static struct net_device_ops dhd_ops_virt = {
|
|||
};
|
||||
#endif
|
||||
|
||||
static int dhd_device_event(struct notifier_block *this, unsigned long event,
|
||||
void *ptr)
|
||||
{
|
||||
struct in_ifaddr *ifa = (struct in_ifaddr *)ptr;
|
||||
dhd_info_t *dhd;
|
||||
dhd_pub_t *dhd_pub;
|
||||
|
||||
if (!ifa)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
dhd = *(dhd_info_t **)netdev_priv(ifa->ifa_dev->dev);
|
||||
dhd_pub = &dhd->pub;
|
||||
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 31))
|
||||
if (ifa->ifa_dev->dev->netdev_ops == &dhd_ops_pri) {
|
||||
#else
|
||||
if (ifa->ifa_dev->dev->open == &dhd_open) {
|
||||
#endif
|
||||
switch (event) {
|
||||
case NETDEV_UP:
|
||||
DHD_TRACE(("%s: [%s] Up IP: 0x%x\n",
|
||||
__FUNCTION__, ifa->ifa_label, ifa->ifa_address));
|
||||
|
||||
dhd_arp_cleanup(dhd_pub);
|
||||
break;
|
||||
|
||||
case NETDEV_DOWN:
|
||||
DHD_TRACE(("%s: [%s] Down IP: 0x%x\n",
|
||||
__FUNCTION__, ifa->ifa_label, ifa->ifa_address));
|
||||
|
||||
dhd_arp_cleanup(dhd_pub);
|
||||
break;
|
||||
|
||||
default:
|
||||
DHD_TRACE(("%s: [%s] Event: %lu\n",
|
||||
__FUNCTION__, ifa->ifa_label, event));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
int
|
||||
dhd_net_attach(dhd_pub_t *dhdp, int ifidx)
|
||||
{
|
||||
|
|
@ -2392,6 +2463,7 @@ dhd_net_attach(dhd_pub_t *dhdp, int ifidx)
|
|||
dhd->pub.mac.octet[0], dhd->pub.mac.octet[1], dhd->pub.mac.octet[2],
|
||||
dhd->pub.mac.octet[3], dhd->pub.mac.octet[4], dhd->pub.mac.octet[5]);
|
||||
|
||||
|
||||
#if defined(CONFIG_WIRELESS_EXT)
|
||||
#if defined(CONFIG_FIRST_SCAN)
|
||||
#ifdef SOFTAP
|
||||
|
|
@ -2457,6 +2529,8 @@ dhd_detach(dhd_pub_t *dhdp)
|
|||
dhd_if_t *ifp;
|
||||
int i;
|
||||
|
||||
unregister_inetaddr_notifier(&dhd_notifier);
|
||||
|
||||
#if defined(CONFIG_HAS_EARLYSUSPEND)
|
||||
if (dhd->early_suspend.suspend)
|
||||
unregister_early_suspend(&dhd->early_suspend);
|
||||
|
|
@ -2521,8 +2595,8 @@ dhd_detach(dhd_pub_t *dhdp)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
rockchip_wifi_exit_module(void)
|
||||
static void __exit
|
||||
dhd_module_cleanup(void)
|
||||
{
|
||||
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
|
||||
|
||||
|
|
@ -2532,17 +2606,15 @@ rockchip_wifi_exit_module(void)
|
|||
#endif
|
||||
/* Call customer gpio to turn off power with WL_REG_ON signal */
|
||||
dhd_customer_gpio_wlan_ctrl(WLAN_POWER_OFF);
|
||||
bcm4329_power_save_exit();
|
||||
}
|
||||
|
||||
int
|
||||
rockchip_wifi_init_module(void)
|
||||
static int __init
|
||||
dhd_module_init(void)
|
||||
{
|
||||
int error;
|
||||
|
||||
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
|
||||
|
||||
printk("BCM4329 Wi-Fi driver (Powered by Rockchip,Ver %s) init.\n", BCM4329_DRV_VERSION);
|
||||
/* Sanity check on the module parameters */
|
||||
do {
|
||||
/* Both watchdog and DPC as tasklets are ok */
|
||||
|
|
@ -2601,8 +2673,6 @@ rockchip_wifi_init_module(void)
|
|||
goto fail_2;
|
||||
}
|
||||
#endif
|
||||
bcm4329_power_save_init();
|
||||
|
||||
return error;
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
|
||||
fail_2:
|
||||
|
|
@ -2620,23 +2690,8 @@ rockchip_wifi_init_module(void)
|
|||
return error;
|
||||
}
|
||||
|
||||
//module_init(dhd_module_init);
|
||||
//module_exit(dhd_module_cleanup);
|
||||
int mv88w8686_if_sdio_init_module(void)
|
||||
{
|
||||
return rockchip_wifi_init_module();
|
||||
}
|
||||
|
||||
void mv88w8686_if_sdio_exit_module(void)
|
||||
{
|
||||
rockchip_wifi_exit_module();
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(rockchip_wifi_init_module);
|
||||
EXPORT_SYMBOL(rockchip_wifi_exit_module);
|
||||
EXPORT_SYMBOL(mv88w8686_if_sdio_init_module);
|
||||
EXPORT_SYMBOL(mv88w8686_if_sdio_exit_module);
|
||||
|
||||
module_init(dhd_module_init);
|
||||
module_exit(dhd_module_cleanup);
|
||||
|
||||
/*
|
||||
* OS specific functions required to implement DHD driver in OS independent way
|
||||
|
|
@ -3063,11 +3118,12 @@ dhd_dev_pno_enable(struct net_device *dev, int pfn_enabled)
|
|||
|
||||
/* Linux wrapper to call common dhd_pno_set */
|
||||
int
|
||||
dhd_dev_pno_set(struct net_device *dev, wlc_ssid_t* ssids_local, int nssid, ushort scan_fr)
|
||||
dhd_dev_pno_set(struct net_device *dev, wlc_ssid_t* ssids_local, int nssid,
|
||||
ushort scan_fr, int pno_repeat, int pno_freq_expo_max)
|
||||
{
|
||||
dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
|
||||
|
||||
return (dhd_pno_set(&dhd->pub, ssids_local, nssid, scan_fr));
|
||||
return (dhd_pno_set(&dhd->pub, ssids_local, nssid, scan_fr, pno_repeat, pno_freq_expo_max));
|
||||
}
|
||||
|
||||
/* Linux wrapper to get pno status */
|
||||
|
|
@ -3095,20 +3151,20 @@ int net_os_send_hang_message(struct net_device *dev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void dhd_bus_country_set(struct net_device *dev, char *country_code)
|
||||
void dhd_bus_country_set(struct net_device *dev, wl_country_t *cspec)
|
||||
{
|
||||
dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
|
||||
|
||||
if (dhd && dhd->pub.up)
|
||||
strncpy(dhd->pub.country_code, country_code, WLC_CNTRY_BUF_SZ);
|
||||
memcpy(&dhd->pub.dhd_cspec, cspec, sizeof(wl_country_t));
|
||||
}
|
||||
|
||||
char *dhd_bus_country_get(struct net_device *dev)
|
||||
{
|
||||
dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
|
||||
|
||||
if (dhd && (dhd->pub.country_code[0] != 0))
|
||||
return dhd->pub.country_code;
|
||||
if (dhd && (dhd->pub.dhd_cspec.ccode[0] != 0))
|
||||
return dhd->pub.dhd_cspec.ccode;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -428,7 +428,6 @@ static void dhdsdio_sdtest_set(dhd_bus_t *bus, bool start);
|
|||
|
||||
#ifdef DHD_DEBUG_TRAP
|
||||
static int dhdsdio_checkdied(dhd_bus_t *bus, uint8 *data, uint size);
|
||||
static int dhdsdio_mem_dump(dhd_bus_t *bus);
|
||||
#endif /* DHD_DEBUG_TRAP */
|
||||
static int dhdsdio_download_state(dhd_bus_t *bus, bool enter);
|
||||
|
||||
|
|
@ -1845,11 +1844,6 @@ dhdsdio_checkdied(dhd_bus_t *bus, uint8 *data, uint size)
|
|||
DHD_ERROR(("%s: %s\n", __FUNCTION__, strbuf.origbuf));
|
||||
}
|
||||
|
||||
if (sdpcm_shared.flags & SDPCM_SHARED_TRAP) {
|
||||
/* Mem dump to a file on device */
|
||||
dhdsdio_mem_dump(bus);
|
||||
}
|
||||
|
||||
done:
|
||||
if (mbuffer)
|
||||
MFREE(bus->dhd->osh, mbuffer, msize);
|
||||
|
|
@ -1858,60 +1852,6 @@ dhdsdio_checkdied(dhd_bus_t *bus, uint8 *data, uint size)
|
|||
|
||||
return bcmerror;
|
||||
}
|
||||
|
||||
static int
|
||||
dhdsdio_mem_dump(dhd_bus_t *bus)
|
||||
{
|
||||
int ret = 0;
|
||||
int size; /* Full mem size */
|
||||
int start = 0; /* Start address */
|
||||
int read_size = 0; /* Read size of each iteration */
|
||||
uint8 *buf = NULL, *databuf = NULL;
|
||||
|
||||
/* Get full mem size */
|
||||
size = bus->ramsize;
|
||||
buf = MALLOC(bus->dhd->osh, size);
|
||||
if (!buf) {
|
||||
printf("%s: Out of memory (%d bytes)\n", __FUNCTION__, size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Read mem content */
|
||||
printf("Dump dongle memory");
|
||||
databuf = buf;
|
||||
while (size)
|
||||
{
|
||||
read_size = MIN(MEMBLOCK, size);
|
||||
if ((ret = dhdsdio_membytes(bus, FALSE, start, databuf, read_size)))
|
||||
{
|
||||
printf("%s: Error membytes %d\n", __FUNCTION__, ret);
|
||||
if (buf) {
|
||||
MFREE(bus->dhd->osh, buf, size);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
printf(".");
|
||||
|
||||
/* Decrement size and increment start address */
|
||||
size -= read_size;
|
||||
start += read_size;
|
||||
databuf += read_size;
|
||||
}
|
||||
printf("Done\n");
|
||||
|
||||
#ifdef DHD_DEBUG
|
||||
/* free buf before return !!! */
|
||||
if (write_to_file(bus->dhd, buf, bus->ramsize))
|
||||
{
|
||||
printf("%s: Error writing to files\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
/* buf free handled in write_to_file, not here */
|
||||
#else
|
||||
MFREE(bus->dhd->osh, buf, size);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
#endif /* DHD_DEBUG_TRAP */
|
||||
|
||||
#ifdef DHD_DEBUG
|
||||
|
|
|
|||
|
|
@ -33,16 +33,16 @@
|
|||
|
||||
#define EPI_RC_NUMBER 248
|
||||
|
||||
#define EPI_INCREMENTAL_NUMBER 18
|
||||
#define EPI_INCREMENTAL_NUMBER 23
|
||||
|
||||
#define EPI_BUILD_NUMBER 0
|
||||
|
||||
#define EPI_VERSION 4, 218, 248, 18
|
||||
#define EPI_VERSION 4, 218, 248, 23
|
||||
|
||||
#define EPI_VERSION_NUM 0x04daf812
|
||||
#define EPI_VERSION_NUM 0x04daf817
|
||||
|
||||
|
||||
#define EPI_VERSION_STR "4.218.248.18"
|
||||
#define EPI_ROUTER_VERSION_STR "4.219.248.18"
|
||||
#define EPI_VERSION_STR "4.218.248.23"
|
||||
#define EPI_ROUTER_VERSION_STR "4.219.248.23"
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
* $Id: wlioctl.h,v 1.601.4.15.2.14.2.62.4.1 2010/11/17 03:09:28 Exp $
|
||||
* $Id: wlioctl.h,v 1.601.4.15.2.14.2.62.4.3 2011/02/09 23:31:02 Exp $
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -254,6 +254,11 @@ typedef struct wl_join_params {
|
|||
|
||||
#define WLC_CNTRY_BUF_SZ 4
|
||||
|
||||
typedef struct wl_country {
|
||||
char country_abbrev[WLC_CNTRY_BUF_SZ];
|
||||
int32 rev;
|
||||
char ccode[WLC_CNTRY_BUF_SZ];
|
||||
} wl_country_t;
|
||||
|
||||
typedef enum sup_auth_status {
|
||||
|
||||
|
|
@ -857,7 +862,7 @@ typedef struct wl_ioctl {
|
|||
#define PM_MAX 1
|
||||
#define PM_FAST 2
|
||||
|
||||
#define LISTEN_INTERVAL 20
|
||||
#define LISTEN_INTERVAL 10
|
||||
|
||||
#define INTERFERE_NONE 0
|
||||
#define NON_WLAN 1
|
||||
|
|
@ -1309,12 +1314,16 @@ enum {
|
|||
#define ENABLE_BKGRD_SCAN_BIT 2
|
||||
#define IMMEDIATE_SCAN_BIT 3
|
||||
#define AUTO_CONNECT_BIT 4
|
||||
#define ENABLE_BD_SCAN_BIT 5
|
||||
#define ENABLE_ADAPTSCAN_BIT 6
|
||||
|
||||
#define SORT_CRITERIA_MASK 0x01
|
||||
#define AUTO_NET_SWITCH_MASK 0x02
|
||||
#define ENABLE_BKGRD_SCAN_MASK 0x04
|
||||
#define IMMEDIATE_SCAN_MASK 0x08
|
||||
#define AUTO_CONNECT_MASK 0x10
|
||||
#define ENABLE_BD_SCAN_MASK 0x20
|
||||
#define ENABLE_ADAPTSCAN_MASK 0x40
|
||||
|
||||
#define PFN_VERSION 1
|
||||
|
||||
|
|
@ -1327,6 +1336,8 @@ typedef struct wl_pfn_param {
|
|||
int32 lost_network_timeout;
|
||||
int16 flags;
|
||||
int16 rssi_margin;
|
||||
int32 repeat_scan;
|
||||
int32 max_freq_adjust;
|
||||
} wl_pfn_param_t;
|
||||
|
||||
typedef struct wl_pfn {
|
||||
|
|
@ -1336,14 +1347,12 @@ typedef struct wl_pfn {
|
|||
int32 auth;
|
||||
uint32 wpa_auth;
|
||||
int32 wsec;
|
||||
#ifdef WLPFN_AUTO_CONNECT
|
||||
union {
|
||||
wl_wsec_key_t sec_key;
|
||||
wsec_pmk_t wpa_sec_key;
|
||||
} pfn_security;
|
||||
#endif
|
||||
} wl_pfn_t;
|
||||
|
||||
#define PNO_SCAN_MAX_FW 508*1000
|
||||
#define PNO_SCAN_MAX_FW_SEC PNO_SCAN_MAX_FW/1000
|
||||
#define PNO_SCAN_MIN_FW_SEC 10
|
||||
|
||||
|
||||
#define TOE_TX_CSUM_OL 0x00000001
|
||||
#define TOE_RX_CSUM_OL 0x00000002
|
||||
|
|
|
|||
|
|
@ -246,8 +246,10 @@ void*
|
|||
osl_pktget(osl_t *osh, uint len)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
gfp_t flags;
|
||||
|
||||
if ((skb = dev_alloc_skb(len))) {
|
||||
flags = (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL;
|
||||
if ((skb = __dev_alloc_skb(len, flags))) {
|
||||
skb_put(skb, len);
|
||||
skb->priority = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
* $Id: wl_iw.c,v 1.51.4.9.2.6.4.142.4.69 2010/12/21 03:00:08 Exp $
|
||||
* $Id: wl_iw.c,v 1.51.4.9.2.6.4.142.4.78 2011/02/11 21:27:52 Exp $
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -54,10 +54,11 @@ typedef const struct si_pub si_t;
|
|||
#define WL_INFORM(x)
|
||||
#define WL_WSEC(x)
|
||||
#define WL_SCAN(x)
|
||||
#define WL_PNO(x)
|
||||
#define WL_TRACE_COEX(x)
|
||||
|
||||
#include <wl_iw.h>
|
||||
#include <linux/wakelock.h>
|
||||
|
||||
|
||||
|
||||
#ifndef IW_ENCODE_ALG_SM4
|
||||
|
|
@ -115,10 +116,6 @@ static int g_onoff = G_WLAN_SET_ON;
|
|||
wl_iw_extra_params_t g_wl_iw_params;
|
||||
static struct mutex wl_cache_lock;
|
||||
|
||||
#ifdef CONFIG_US_NON_DFS_CHANNELS_ONLY
|
||||
static bool use_non_dfs_channels = true;
|
||||
#endif
|
||||
|
||||
extern bool wl_iw_conn_status_str(uint32 event_type, uint32 status,
|
||||
uint32 reason, char* stringBuf, uint buflen);
|
||||
#include <bcmsdbus.h>
|
||||
|
|
@ -161,12 +158,13 @@ extern int dhd_wait_pend8021x(struct net_device *dev);
|
|||
#endif
|
||||
|
||||
static void *g_scan = NULL;
|
||||
static volatile uint g_scan_specified_ssid;
|
||||
static wlc_ssid_t g_specific_ssid;
|
||||
static volatile uint g_scan_specified_ssid;
|
||||
static wlc_ssid_t g_specific_ssid;
|
||||
|
||||
static wlc_ssid_t g_ssid;
|
||||
|
||||
static wl_iw_ss_cache_ctrl_t g_ss_cache_ctrl;
|
||||
bool btcoex_is_sco_active(struct net_device *dev);
|
||||
static wl_iw_ss_cache_ctrl_t g_ss_cache_ctrl;
|
||||
#if defined(CONFIG_FIRST_SCAN)
|
||||
static volatile uint g_first_broadcast_scan;
|
||||
static volatile uint g_first_counter_scans;
|
||||
|
|
@ -594,6 +592,36 @@ wl_iw_set_passive_scan(
|
|||
return error;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
wl_iw_set_txpower(
|
||||
struct net_device *dev,
|
||||
struct iw_request_info *info,
|
||||
union iwreq_data *wrqu,
|
||||
char *extra
|
||||
)
|
||||
{
|
||||
int error = 0;
|
||||
char *p = extra;
|
||||
int txpower = -1;
|
||||
|
||||
txpower = bcm_atoi(extra + strlen(TXPOWER_SET_CMD) + 1);
|
||||
if ((txpower >= 0) && (txpower <= 127)) {
|
||||
txpower |= WL_TXPWR_OVERRIDE;
|
||||
txpower = htod32(txpower);
|
||||
|
||||
error = dev_wlc_intvar_set(dev, "qtxpower", txpower);
|
||||
p += snprintf(p, MAX_WX_STRING, "OK");
|
||||
WL_TRACE(("%s: set TXpower 0x%X is OK\n", __FUNCTION__, txpower));
|
||||
} else {
|
||||
WL_ERROR(("%s: set tx power failed\n", __FUNCTION__));
|
||||
p += snprintf(p, MAX_WX_STRING, "FAIL");
|
||||
}
|
||||
|
||||
wrqu->data.length = p - extra + 1;
|
||||
return error;
|
||||
}
|
||||
|
||||
static int
|
||||
wl_iw_get_macaddr(
|
||||
struct net_device *dev,
|
||||
|
|
@ -619,31 +647,6 @@ wl_iw_get_macaddr(
|
|||
return error;
|
||||
}
|
||||
|
||||
static int
|
||||
wl_iw_set_country_code(struct net_device *dev, char *ccode)
|
||||
{
|
||||
char country_code[WLC_CNTRY_BUF_SZ];
|
||||
int ret = -1;
|
||||
|
||||
WL_TRACE(("%s\n", __FUNCTION__));
|
||||
if (!ccode)
|
||||
ccode = dhd_bus_country_get(dev);
|
||||
strncpy(country_code, ccode, sizeof(country_code));
|
||||
if (ccode && (country_code[0] != 0)) {
|
||||
#ifdef CONFIG_US_NON_DFS_CHANNELS_ONLY
|
||||
if (use_non_dfs_channels && !strncmp(country_code, "US", 2))
|
||||
strncpy(country_code, "Q2", WLC_CNTRY_BUF_SZ);
|
||||
if (!use_non_dfs_channels && !strncmp(country_code, "Q2", 2))
|
||||
strncpy(country_code, "US", WLC_CNTRY_BUF_SZ);
|
||||
#endif
|
||||
ret = dev_wlc_ioctl(dev, WLC_SET_COUNTRY, &country_code, sizeof(country_code));
|
||||
if (ret >= 0) {
|
||||
WL_TRACE(("%s: set country %s OK\n", __FUNCTION__, country_code));
|
||||
dhd_bus_country_set(dev, &country_code[0]);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
wl_iw_set_country(
|
||||
|
|
@ -658,25 +661,39 @@ wl_iw_set_country(
|
|||
char *p = extra;
|
||||
int country_offset;
|
||||
int country_code_size;
|
||||
wl_country_t cspec = {{0}, 0, {0}};
|
||||
char smbuf[WLC_IOCTL_SMLEN];
|
||||
|
||||
WL_TRACE(("%s\n", __FUNCTION__));
|
||||
cspec.rev = -1;
|
||||
memset(country_code, 0, sizeof(country_code));
|
||||
memset(smbuf, 0, sizeof(smbuf));
|
||||
|
||||
country_offset = strcspn(extra, " ");
|
||||
country_code_size = strlen(extra) - country_offset;
|
||||
|
||||
if (country_offset != 0) {
|
||||
strncpy(country_code, extra + country_offset + 1,
|
||||
strncpy(country_code, extra + country_offset +1,
|
||||
MIN(country_code_size, sizeof(country_code)));
|
||||
error = wl_iw_set_country_code(dev, country_code);
|
||||
if (error >= 0) {
|
||||
|
||||
|
||||
memcpy(cspec.country_abbrev, country_code, WLC_CNTRY_BUF_SZ);
|
||||
memcpy(cspec.ccode, country_code, WLC_CNTRY_BUF_SZ);
|
||||
|
||||
get_customized_country_code((char *)&cspec.country_abbrev, &cspec);
|
||||
|
||||
if ((error = dev_iw_iovar_setbuf(dev, "country", &cspec, \
|
||||
sizeof(cspec), smbuf, sizeof(smbuf))) >= 0) {
|
||||
p += snprintf(p, MAX_WX_STRING, "OK");
|
||||
WL_TRACE(("%s: set country %s OK\n", __FUNCTION__, country_code));
|
||||
WL_ERROR(("%s: set country for %s as %s rev %d is OK\n", \
|
||||
__FUNCTION__, country_code, cspec.ccode, cspec.rev));
|
||||
dhd_bus_country_set(dev, &cspec);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
WL_ERROR(("%s: set country %s failed code %d\n", __FUNCTION__, country_code, error));
|
||||
WL_ERROR(("%s: set country for %s as %s rev %d failed\n", \
|
||||
__FUNCTION__, country_code, cspec.ccode, cspec.rev));
|
||||
|
||||
p += snprintf(p, MAX_WX_STRING, "FAIL");
|
||||
|
||||
exit:
|
||||
|
|
@ -684,33 +701,6 @@ wl_iw_set_country(
|
|||
return error;
|
||||
}
|
||||
|
||||
static int
|
||||
wl_iw_get_country(
|
||||
struct net_device *dev,
|
||||
struct iw_request_info *info,
|
||||
union iwreq_data *wrqu,
|
||||
char *extra
|
||||
)
|
||||
{
|
||||
char *ccode;
|
||||
int current_channels;
|
||||
|
||||
WL_TRACE(("%s\n", __FUNCTION__));
|
||||
|
||||
ccode = dhd_bus_country_get(dev);
|
||||
if(ccode){
|
||||
if(0 == strcmp(ccode, "Q2"))
|
||||
current_channels = 11;
|
||||
else if(0 == strcmp(ccode, "EU"))
|
||||
current_channels = 13;
|
||||
else if(0 == strcmp(ccode, "JP"))
|
||||
current_channels = 14;
|
||||
}
|
||||
sprintf(extra, "Scan-Channels = %d", current_channels);
|
||||
printk("Get Channels return %d,(country code = %s)\n",current_channels, ccode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CUSTOMER_HW2
|
||||
static int
|
||||
wl_iw_set_power_mode(
|
||||
|
|
@ -765,26 +755,40 @@ wl_iw_set_power_mode(
|
|||
#endif
|
||||
|
||||
|
||||
static bool btcoex_is_sco_active(struct net_device *dev)
|
||||
bool btcoex_is_sco_active(struct net_device *dev)
|
||||
{
|
||||
int ioc_res = 0;
|
||||
bool res = false;
|
||||
int temp = 0;
|
||||
int sco_id_cnt = 0;
|
||||
int param27;
|
||||
int i;
|
||||
|
||||
ioc_res = dev_wlc_intvar_get_reg(dev, "btc_params", 4, &temp);
|
||||
for (i = 0; i < 12; i++) {
|
||||
|
||||
if (ioc_res == 0) {
|
||||
WL_TRACE_COEX(("%s: read btc_params[4] = %x\n", __FUNCTION__, temp));
|
||||
ioc_res = dev_wlc_intvar_get_reg(dev, "btc_params", 27, ¶m27);
|
||||
|
||||
if ((temp > 0xea0) && (temp < 0xed8)) {
|
||||
WL_TRACE_COEX(("%s: BT SCO/eSCO is ACTIVE\n", __FUNCTION__));
|
||||
res = true;
|
||||
} else {
|
||||
WL_TRACE_COEX(("%s: BT SCO/eSCO is NOT detected\n", __FUNCTION__));
|
||||
WL_TRACE_COEX(("%s, sample[%d], btc params: 27:%x\n",
|
||||
__FUNCTION__, i, param27));
|
||||
|
||||
if (ioc_res < 0) {
|
||||
WL_ERROR(("%s ioc read btc params error\n", __FUNCTION__));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
WL_ERROR(("%s ioc read btc params error\n", __FUNCTION__));
|
||||
|
||||
if ((param27 & 0x6) == 2) {
|
||||
sco_id_cnt++;
|
||||
}
|
||||
|
||||
if (sco_id_cnt > 2) {
|
||||
WL_TRACE_COEX(("%s, sco/esco detected, pkt id_cnt:%d samples:%d\n",
|
||||
__FUNCTION__, sco_id_cnt, i));
|
||||
res = true;
|
||||
break;
|
||||
}
|
||||
|
||||
msleep(5);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -1070,21 +1074,6 @@ wl_iw_set_suspend(
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_US_NON_DFS_CHANNELS_ONLY
|
||||
static int
|
||||
wl_iw_set_dfs_channels(
|
||||
struct net_device *dev,
|
||||
struct iw_request_info *info,
|
||||
union iwreq_data *wrqu,
|
||||
char *extra
|
||||
)
|
||||
{
|
||||
use_non_dfs_channels = *(extra + strlen(SETDFSCHANNELS_CMD) + 1) - '0';
|
||||
use_non_dfs_channels = (use_non_dfs_channels != 0) ? false : true;
|
||||
wl_iw_set_country_code(dev, NULL);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
wl_format_ssid(char* ssid_buf, uint8* ssid, int ssid_len)
|
||||
|
|
@ -1370,9 +1359,10 @@ wl_iw_set_pno_set(
|
|||
int nssid = 0;
|
||||
cmd_tlv_t *cmd_tlv_temp;
|
||||
char *str_ptr;
|
||||
char *str_ptr_end;
|
||||
int tlv_size_left;
|
||||
int pno_time;
|
||||
int pno_repeat;
|
||||
int pno_freq_expo_max;
|
||||
|
||||
#ifdef PNO_SET_DEBUG
|
||||
int i;
|
||||
|
|
@ -1386,6 +1376,10 @@ wl_iw_set_pno_set(
|
|||
'G', 'O', 'O', 'G',
|
||||
'T',
|
||||
'1','E',
|
||||
'R',
|
||||
'2',
|
||||
'M',
|
||||
'2',
|
||||
0x00
|
||||
};
|
||||
#endif
|
||||
|
|
@ -1429,6 +1423,7 @@ wl_iw_set_pno_set(
|
|||
|
||||
cmd_tlv_temp = (cmd_tlv_t *)str_ptr;
|
||||
memset(ssids_local, 0, sizeof(ssids_local));
|
||||
pno_repeat = pno_freq_expo_max = 0;
|
||||
|
||||
if ((cmd_tlv_temp->prefix == PNO_TLV_PREFIX) && \
|
||||
(cmd_tlv_temp->version == PNO_TLV_VERSION) && \
|
||||
|
|
@ -1449,9 +1444,28 @@ wl_iw_set_pno_set(
|
|||
goto exit_proc;
|
||||
}
|
||||
str_ptr++;
|
||||
pno_time = simple_strtoul(str_ptr, &str_ptr_end, 16);
|
||||
WL_ERROR((" got %d bytes left pno_time %d or %#x\n", \
|
||||
tlv_size_left, pno_time, pno_time));
|
||||
pno_time = simple_strtoul(str_ptr, &str_ptr, 16);
|
||||
WL_PNO(("%s: pno_time=%d\n", __FUNCTION__, pno_time));
|
||||
|
||||
if (str_ptr[0] != 0) {
|
||||
if ((str_ptr[0] != PNO_TLV_FREQ_REPEAT)) {
|
||||
WL_ERROR(("%s pno repeat : corrupted field\n", \
|
||||
__FUNCTION__));
|
||||
goto exit_proc;
|
||||
}
|
||||
str_ptr++;
|
||||
pno_repeat = simple_strtoul(str_ptr, &str_ptr, 16);
|
||||
WL_PNO(("%s :got pno_repeat=%d\n", __FUNCTION__, pno_repeat));
|
||||
if (str_ptr[0] != PNO_TLV_FREQ_EXPO_MAX) {
|
||||
WL_ERROR(("%s FREQ_EXPO_MAX corrupted field size\n", \
|
||||
__FUNCTION__));
|
||||
goto exit_proc;
|
||||
}
|
||||
str_ptr++;
|
||||
pno_freq_expo_max = simple_strtoul(str_ptr, &str_ptr, 16);
|
||||
WL_PNO(("%s: pno_freq_expo_max=%d\n", \
|
||||
__FUNCTION__, pno_freq_expo_max));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
@ -1459,7 +1473,7 @@ wl_iw_set_pno_set(
|
|||
goto exit_proc;
|
||||
}
|
||||
|
||||
res = dhd_dev_pno_set(dev, ssids_local, nssid, pno_time);
|
||||
res = dhd_dev_pno_set(dev, ssids_local, nssid, pno_time, pno_repeat, pno_freq_expo_max);
|
||||
|
||||
exit_proc:
|
||||
net_os_wake_unlock(dev);
|
||||
|
|
@ -1746,6 +1760,79 @@ int hstr_2_buf(const char *txt, u8 *buf, int len)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if defined(SOFTAP) && defined(SOFTAP_TLV_CFG)
|
||||
|
||||
static int wl_iw_softap_cfg_tlv(
|
||||
struct net_device *dev,
|
||||
struct iw_request_info *info,
|
||||
union iwreq_data *wrqu,
|
||||
char *extra
|
||||
)
|
||||
{
|
||||
int res = -1;
|
||||
char *str_ptr;
|
||||
int tlv_size_left;
|
||||
|
||||
|
||||
#define SOFTAP_TLV_DEBUG 1
|
||||
#ifdef SOFTAP_TLV_DEBUG
|
||||
char softap_cmd_example[] = {
|
||||
|
||||
'S', 'O', 'F', 'T', 'A', 'P', 'S', 'E', 'T', ' ',
|
||||
|
||||
SOFTAP_TLV_PREFIX, SOFTAP_TLV_VERSION,
|
||||
SOFTAP_TLV_SUBVERSION, SOFTAP_TLV_RESERVED,
|
||||
|
||||
TLV_TYPE_SSID, 9, 'B', 'R', 'C', 'M', ',', 'G', 'O', 'O', 'G',
|
||||
|
||||
TLV_TYPE_SECUR, 4, 'O', 'P', 'E', 'N',
|
||||
|
||||
TLV_TYPE_KEY, 4, 0x31, 0x32, 0x33, 0x34,
|
||||
|
||||
TLV_TYPE_CHANNEL, 4, 0x06, 0x00, 0x00, 0x00
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef SOFTAP_TLV_DEBUG
|
||||
{
|
||||
int i;
|
||||
if (!(extra = kmalloc(sizeof(softap_cmd_example) +10, GFP_KERNEL)))
|
||||
return -ENOMEM;
|
||||
memcpy(extra, softap_cmd_example, sizeof(softap_cmd_example));
|
||||
wrqu->data.length = sizeof(softap_cmd_example);
|
||||
print_buf(extra, wrqu->data.length, 16);
|
||||
for (i = 0; i < wrqu->data.length; i++)
|
||||
printf("%c ", extra[i]);
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
WL_ERROR(("\n### %s: info->cmd:%x, info->flags:%x, u.data=0x%p, u.len=%d\n",
|
||||
__FUNCTION__, info->cmd, info->flags,
|
||||
wrqu->data.pointer, wrqu->data.length));
|
||||
|
||||
if (g_onoff == G_WLAN_SET_OFF) {
|
||||
WL_TRACE(("%s: driver is not up yet after START\n", __FUNCTION__));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (wrqu->data.length < (strlen(SOFTAP_SET_CMD) + sizeof(cmd_tlv_t))) {
|
||||
WL_ERROR(("%s argument=%d less %d\n", __FUNCTION__,
|
||||
wrqu->data.length, strlen(SOFTAP_SET_CMD) + sizeof(cmd_tlv_t)));
|
||||
return -1;
|
||||
}
|
||||
|
||||
str_ptr = extra + strlen(SOFTAP_SET_CMD)+1;
|
||||
tlv_size_left = wrqu->data.length - (strlen(SOFTAP_SET_CMD)+1);
|
||||
|
||||
memset(&my_ap, 0, sizeof(my_ap));
|
||||
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef SOFTAP
|
||||
int init_ap_profile_from_string(char *param_str, struct ap_profile *ap_cfg)
|
||||
{
|
||||
|
|
@ -3713,6 +3800,7 @@ wl_iw_handle_scanresults_ies(char **event_p, char *end,
|
|||
wpa_snprintf_hex(buf + 10, 2+1, &(ie->len), 1);
|
||||
wpa_snprintf_hex(buf + 12, 2*ie->len+1, ie->data, ie->len);
|
||||
event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, buf);
|
||||
kfree(buf);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
|
@ -5754,7 +5842,7 @@ wl_iw_combined_scan_set(struct net_device *dev, wlc_ssid_t* ssids_local, int nss
|
|||
WL_SCAN(("scan_type=%d\n", iscan->iscan_ex_params_p->params.scan_type));
|
||||
WL_SCAN(("\n###################\n"));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (params_size > WLC_IOCTL_MEDLEN) {
|
||||
WL_ERROR(("Set ISCAN for %s due to params_size=%d \n", \
|
||||
|
|
@ -5794,6 +5882,11 @@ static int iwpriv_set_cscan(struct net_device *dev, struct iw_request_info *info
|
|||
return -1;
|
||||
}
|
||||
|
||||
#ifdef PNO_SET_DEBUG
|
||||
wl_iw_set_pno_set(dev, info, wrqu, extra);
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
if (wrqu->data.length != 0) {
|
||||
|
||||
char *str_ptr;
|
||||
|
|
@ -6321,16 +6414,8 @@ static int set_ap_cfg(struct net_device *dev, struct ap_profile *ap)
|
|||
}
|
||||
|
||||
if (strlen(ap->country_code)) {
|
||||
int error = 0;
|
||||
if ((error = dev_wlc_ioctl(dev, WLC_SET_COUNTRY,
|
||||
ap->country_code, sizeof(ap->country_code))) >= 0) {
|
||||
WL_SOFTAP(("%s: set country %s OK\n",
|
||||
__FUNCTION__, ap->country_code));
|
||||
dhd_bus_country_set(dev, &ap->country_code[0]);
|
||||
} else {
|
||||
WL_ERROR(("%s: ERROR:%d setting country %s\n",
|
||||
__FUNCTION__, error, ap->country_code));
|
||||
}
|
||||
WL_ERROR(("%s: Igonored: Country MUST be specified \
|
||||
COUNTRY command with \n", __FUNCTION__));
|
||||
} else {
|
||||
WL_SOFTAP(("%s: Country code is not specified,"
|
||||
" will use Radio's default\n",
|
||||
|
|
@ -7072,30 +7157,6 @@ int wl_iw_process_private_ascii_cmd(
|
|||
}
|
||||
#endif
|
||||
|
||||
#define BCM4329_WAKELOCK_NAME "bcm4329_wifi_wakelock"
|
||||
|
||||
static struct wake_lock bcm4329_suspend_lock;
|
||||
|
||||
int bcm4329_wakelock_init = 0;
|
||||
|
||||
void bcm4329_power_save_init(void)
|
||||
{
|
||||
wake_lock_init(&bcm4329_suspend_lock, WAKE_LOCK_SUSPEND, BCM4329_WAKELOCK_NAME);
|
||||
wake_lock(&bcm4329_suspend_lock);
|
||||
|
||||
bcm4329_wakelock_init = 2;
|
||||
}
|
||||
|
||||
void bcm4329_power_save_exit(void)
|
||||
{
|
||||
bcm4329_wakelock_init = 0;
|
||||
msleep(100);
|
||||
|
||||
if (bcm4329_wakelock_init == 2)
|
||||
wake_unlock(&bcm4329_suspend_lock);
|
||||
wake_lock_destroy(&bcm4329_suspend_lock);
|
||||
}
|
||||
|
||||
static int wl_iw_set_priv(
|
||||
struct net_device *dev,
|
||||
struct iw_request_info *info,
|
||||
|
|
@ -7121,11 +7182,6 @@ static int wl_iw_set_priv(
|
|||
|
||||
if (dwrq->length && extra) {
|
||||
if (strnicmp(extra, "START", strlen("START")) == 0) {
|
||||
if (bcm4329_wakelock_init == 1)
|
||||
{
|
||||
wake_lock(&bcm4329_suspend_lock);
|
||||
bcm4329_wakelock_init = 2;
|
||||
}
|
||||
wl_iw_control_wl_on(dev, info);
|
||||
WL_TRACE(("%s, Received regular START command\n", __FUNCTION__));
|
||||
}
|
||||
|
|
@ -7157,16 +7213,8 @@ static int wl_iw_set_priv(
|
|||
ret = wl_iw_get_macaddr(dev, info, (union iwreq_data *)dwrq, extra);
|
||||
else if (strnicmp(extra, "COUNTRY", strlen("COUNTRY")) == 0)
|
||||
ret = wl_iw_set_country(dev, info, (union iwreq_data *)dwrq, extra);
|
||||
else if (strnicmp(extra, "SCAN-CHANNELS", strlen("SCAN-CHANNELS")) == 0)
|
||||
ret = wl_iw_get_country(dev, info, (union iwreq_data *)dwrq, extra);
|
||||
else if (strnicmp(extra, "STOP", strlen("STOP")) == 0){
|
||||
else if (strnicmp(extra, "STOP", strlen("STOP")) == 0)
|
||||
ret = wl_iw_control_wl_off(dev, info);
|
||||
if (bcm4329_wakelock_init == 2)
|
||||
{
|
||||
wake_unlock(&bcm4329_suspend_lock);
|
||||
bcm4329_wakelock_init = 1;
|
||||
}
|
||||
}
|
||||
else if (strnicmp(extra, BAND_GET_CMD, strlen(BAND_GET_CMD)) == 0)
|
||||
ret = wl_iw_get_band(dev, info, (union iwreq_data *)dwrq, extra);
|
||||
else if (strnicmp(extra, BAND_SET_CMD, strlen(BAND_SET_CMD)) == 0)
|
||||
|
|
@ -7177,10 +7225,8 @@ static int wl_iw_set_priv(
|
|||
ret = wl_iw_set_dtim_skip(dev, info, (union iwreq_data *)dwrq, extra);
|
||||
else if (strnicmp(extra, SETSUSPEND_CMD, strlen(SETSUSPEND_CMD)) == 0)
|
||||
ret = wl_iw_set_suspend(dev, info, (union iwreq_data *)dwrq, extra);
|
||||
#ifdef CONFIG_US_NON_DFS_CHANNELS_ONLY
|
||||
else if (strnicmp(extra, SETDFSCHANNELS_CMD, strlen(SETDFSCHANNELS_CMD)) == 0)
|
||||
ret = wl_iw_set_dfs_channels(dev, info, (union iwreq_data *)dwrq, extra);
|
||||
#endif
|
||||
else if (strnicmp(extra, TXPOWER_SET_CMD, strlen(TXPOWER_SET_CMD)) == 0)
|
||||
ret = wl_iw_set_txpower(dev, info, (union iwreq_data *)dwrq, extra);
|
||||
#if defined(PNO_SUPPORT)
|
||||
else if (strnicmp(extra, PNOSSIDCLR_SET_CMD, strlen(PNOSSIDCLR_SET_CMD)) == 0)
|
||||
ret = wl_iw_set_pno_reset(dev, info, (union iwreq_data *)dwrq, extra);
|
||||
|
|
@ -7196,8 +7242,10 @@ static int wl_iw_set_priv(
|
|||
#ifdef CUSTOMER_HW2
|
||||
else if (strnicmp(extra, "POWERMODE", strlen("POWERMODE")) == 0)
|
||||
ret = wl_iw_set_power_mode(dev, info, (union iwreq_data *)dwrq, extra);
|
||||
else if (strnicmp(extra, "BTCOEXMODE", strlen("BTCOEXMODE")) == 0)
|
||||
else if (strnicmp(extra, "BTCOEXMODE", strlen("BTCOEXMODE")) == 0) {
|
||||
WL_TRACE_COEX(("%s:got Framwrork cmd: 'BTCOEXMODE'\n", __FUNCTION__));
|
||||
ret = wl_iw_set_btcoex_dhcp(dev, info, (union iwreq_data *)dwrq, extra);
|
||||
}
|
||||
#else
|
||||
else if (strnicmp(extra, "POWERMODE", strlen("POWERMODE")) == 0)
|
||||
ret = wl_iw_set_btcoex_dhcp(dev, info, (union iwreq_data *)dwrq, extra);
|
||||
|
|
@ -7205,6 +7253,11 @@ static int wl_iw_set_priv(
|
|||
else if (strnicmp(extra, "GETPOWER", strlen("GETPOWER")) == 0)
|
||||
ret = wl_iw_get_power_mode(dev, info, (union iwreq_data *)dwrq, extra);
|
||||
#ifdef SOFTAP
|
||||
#ifdef SOFTAP_TLV_CFG
|
||||
else if (strnicmp(extra, SOFTAP_SET_CMD, strlen(SOFTAP_SET_CMD)) == 0) {
|
||||
wl_iw_softap_cfg_tlv(dev, info, (union iwreq_data *)dwrq, extra);
|
||||
}
|
||||
#endif
|
||||
else if (strnicmp(extra, "ASCII_CMD", strlen("ASCII_CMD")) == 0) {
|
||||
wl_iw_process_private_ascii_cmd(dev, info, (union iwreq_data *)dwrq, extra);
|
||||
} else if (strnicmp(extra, "AP_MAC_LIST_SET", strlen("AP_MAC_LIST_SET")) == 0) {
|
||||
|
|
@ -7725,9 +7778,10 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
|
|||
uint32 datalen = ntoh32(e->datalen);
|
||||
uint32 status = ntoh32(e->status);
|
||||
uint32 toto;
|
||||
#if defined(ROAM_NOT_USED)
|
||||
static uint32 roam_no_success = 0;
|
||||
static bool roam_no_success_send = FALSE;
|
||||
|
||||
#endif
|
||||
memset(&wrqu, 0, sizeof(wrqu));
|
||||
memset(extra, 0, sizeof(extra));
|
||||
|
||||
|
|
@ -7802,6 +7856,7 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
|
|||
wrqu.addr.sa_family = ARPHRD_ETHER;
|
||||
cmd = SIOCGIWAP;
|
||||
}
|
||||
#if defined(ROAM_NOT_USED)
|
||||
else if (status == WLC_E_STATUS_NO_NETWORKS) {
|
||||
roam_no_success++;
|
||||
if ((roam_no_success == 5) && (roam_no_success_send == FALSE)) {
|
||||
|
|
@ -7816,6 +7871,7 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
|
|||
goto wl_iw_event_end;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case WLC_E_DEAUTH_IND:
|
||||
case WLC_E_DISASSOC_IND:
|
||||
|
|
@ -7871,8 +7927,10 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
|
|||
wl_iw_send_priv_event(priv_dev, "AP_UP");
|
||||
} else {
|
||||
WL_TRACE(("STA_LINK_UP\n"));
|
||||
#if defined(ROAM_NOT_USED)
|
||||
roam_no_success_send = FALSE;
|
||||
roam_no_success = 0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
WL_TRACE(("Link UP\n"));
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
* $Id: wl_iw.h,v 1.5.34.1.6.36.4.15 2010/11/17 03:13:51 Exp $
|
||||
* $Id: wl_iw.h,v 1.5.34.1.6.36.4.18 2011/02/10 19:33:12 Exp $
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
#define PNOSETUP_SET_CMD "PNOSETUP "
|
||||
#define PNOENABLE_SET_CMD "PNOFORCE"
|
||||
#define PNODEBUG_SET_CMD "PNODEBUG"
|
||||
#define SETDFSCHANNELS_CMD "SETDFSCHANNELS"
|
||||
#define TXPOWER_SET_CMD "TXPOWER"
|
||||
|
||||
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
|
||||
#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
|
||||
|
|
@ -62,6 +62,12 @@ typedef struct wl_iw_extra_params {
|
|||
int target_channel;
|
||||
} wl_iw_extra_params_t;
|
||||
|
||||
struct cntry_locales_custom {
|
||||
char iso_abbrev[WLC_CNTRY_BUF_SZ];
|
||||
char custom_locale[WLC_CNTRY_BUF_SZ];
|
||||
int32 custom_locale_rev;
|
||||
};
|
||||
|
||||
#define WL_IW_RSSI_MINVAL -200
|
||||
#define WL_IW_RSSI_NO_SIGNAL -91
|
||||
#define WL_IW_RSSI_VERY_LOW -80
|
||||
|
|
@ -133,13 +139,13 @@ typedef struct wl_iw_ss_cache {
|
|||
} wl_iw_ss_cache_t;
|
||||
|
||||
typedef struct wl_iw_ss_cache_ctrl {
|
||||
wl_iw_ss_cache_t *m_cache_head;
|
||||
int m_link_down;
|
||||
int m_timer_expired;
|
||||
char m_active_bssid[ETHER_ADDR_LEN];
|
||||
uint m_prev_scan_mode;
|
||||
uint m_cons_br_scan_cnt;
|
||||
struct timer_list *m_timer;
|
||||
wl_iw_ss_cache_t *m_cache_head;
|
||||
int m_link_down;
|
||||
int m_timer_expired;
|
||||
char m_active_bssid[ETHER_ADDR_LEN];
|
||||
uint m_prev_scan_mode;
|
||||
uint m_cons_br_scan_cnt;
|
||||
struct timer_list *m_timer;
|
||||
} wl_iw_ss_cache_ctrl_t;
|
||||
|
||||
typedef enum broadcast_first_scan {
|
||||
|
|
@ -165,7 +171,7 @@ struct ap_profile {
|
|||
};
|
||||
|
||||
|
||||
#define MACLIST_MODE_DISABLED 0
|
||||
#define MACLIST_MODE_DISABLED 0
|
||||
#define MACLIST_MODE_DENY 1
|
||||
#define MACLIST_MODE_ALLOW 2
|
||||
struct mflist {
|
||||
|
|
@ -199,7 +205,7 @@ extern int net_os_set_suspend_disable(struct net_device *dev, int val);
|
|||
extern int net_os_set_suspend(struct net_device *dev, int val);
|
||||
extern int net_os_set_dtim_skip(struct net_device *dev, int val);
|
||||
extern int net_os_set_packet_filter(struct net_device *dev, int val);
|
||||
extern void dhd_bus_country_set(struct net_device *dev, char *country_code);
|
||||
extern void get_customized_country_code(char *country_iso_code, wl_country_t *cspec);
|
||||
extern char *dhd_bus_country_get(struct net_device *dev);
|
||||
extern int dhd_get_dtim_skip(dhd_pub_t *dhd);
|
||||
|
||||
|
|
@ -221,13 +227,15 @@ extern int dhd_get_dtim_skip(dhd_pub_t *dhd);
|
|||
|
||||
extern int dhd_pno_enable(dhd_pub_t *dhd, int pfn_enabled);
|
||||
extern int dhd_pno_clean(dhd_pub_t *dhd);
|
||||
extern int dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t* ssids_local, int nssid, ushort scan_fr);
|
||||
extern int dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t* ssids_local, int nssid, \
|
||||
ushort scan_fr, int pno_repeat, int pno_freq_expo_max);
|
||||
extern int dhd_pno_get_status(dhd_pub_t *dhd);
|
||||
extern int dhd_dev_pno_reset(struct net_device *dev);
|
||||
extern int dhd_dev_pno_set(struct net_device *dev, wlc_ssid_t* ssids_local, \
|
||||
int nssid, ushort scan_fr);
|
||||
int nssid, ushort scan_fr, int pno_repeat, int pno_freq_expo_max);
|
||||
extern int dhd_dev_pno_enable(struct net_device *dev, int pfn_enabled);
|
||||
extern int dhd_dev_get_pno_status(struct net_device *dev);
|
||||
extern void dhd_bus_country_set(struct net_device *dev, wl_country_t *cspec);
|
||||
|
||||
#define PNO_TLV_PREFIX 'S'
|
||||
#define PNO_TLV_VERSION '1'
|
||||
|
|
@ -235,8 +243,9 @@ extern int dhd_dev_get_pno_status(struct net_device *dev);
|
|||
#define PNO_TLV_RESERVED '0'
|
||||
#define PNO_TLV_TYPE_SSID_IE 'S'
|
||||
#define PNO_TLV_TYPE_TIME 'T'
|
||||
#define PNO_EVENT_UP "PNO_EVENT"
|
||||
#define PNO_SCAN_MAX_FW 508
|
||||
#define PNO_TLV_FREQ_REPEAT 'R'
|
||||
#define PNO_TLV_FREQ_EXPO_MAX 'M'
|
||||
#define PNO_EVENT_UP "PNO_EVENT"
|
||||
|
||||
typedef struct cmd_tlv {
|
||||
char prefix;
|
||||
|
|
@ -245,6 +254,19 @@ typedef struct cmd_tlv {
|
|||
char reserved;
|
||||
} cmd_tlv_t;
|
||||
|
||||
#ifdef SOFTAP_TLV_CFG
|
||||
#define SOFTAP_SET_CMD "SOFTAPSET "
|
||||
#define SOFTAP_TLV_PREFIX 'A'
|
||||
#define SOFTAP_TLV_VERSION '1'
|
||||
#define SOFTAP_TLV_SUBVERSION '0'
|
||||
#define SOFTAP_TLV_RESERVED '0'
|
||||
|
||||
#define TLV_TYPE_SSID 'S'
|
||||
#define TLV_TYPE_SECUR 'E'
|
||||
#define TLV_TYPE_KEY 'K'
|
||||
#define TLV_TYPE_CHANNEL 'C'
|
||||
#endif
|
||||
|
||||
#if defined(CSCAN)
|
||||
|
||||
typedef struct cscan_tlv {
|
||||
|
|
@ -279,6 +301,6 @@ extern int wl_iw_parse_ssid_list(char** list_str, wlc_ssid_t* ssid, int idx, int
|
|||
|
||||
extern int wl_iw_parse_channel_list(char** list_str, uint16* channel_list, int channel_num);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -18,110 +18,14 @@
|
|||
#include <linux/mfd/wm831x/auxadc.h>
|
||||
#include <linux/mfd/wm831x/pmu.h>
|
||||
#include <linux/mfd/wm831x/pdata.h>
|
||||
#include <linux/mfd/wm831x/irq.h>
|
||||
|
||||
#define WM831X_DEBUG
|
||||
#undef WM831X_DEBUG
|
||||
|
||||
#ifdef WM831X_DEBUG
|
||||
#define WM_BATT_DBG(x...) printk(KERN_INFO x)
|
||||
#else
|
||||
#define WM_BATT_DBG(x...) do {} while (0)
|
||||
#endif
|
||||
|
||||
#define WM831X_CHG_SYSLO_SHIFT 4
|
||||
#define WM831X_CHG_SYSOK_SHIFT 0
|
||||
#define WM831X_CHG_SYSLO_MASK ~(0x7 << 4)
|
||||
#define WM831X_CHG_SYSOK_MASK ~(0x7 << 0)
|
||||
|
||||
#define batt_num 52
|
||||
|
||||
static int batt_step_table[batt_num] = {
|
||||
3400,3420,3440,3475,3505,3525,
|
||||
3540,3557,3570,3580,3610,
|
||||
3630,3640,3652,3662,3672,
|
||||
3680,3687,3693,3699,3705,
|
||||
3710,3714,3718,3722,3726,
|
||||
3730,3734,3738,3742,3746,
|
||||
3750,3756,3764,3774,3786,
|
||||
3800,3808,3817,3827,3838,
|
||||
3950,3964,3982,4002,4026,
|
||||
4050,4074,4098,4123,4149,4178
|
||||
};
|
||||
|
||||
static int batt_disp_table[batt_num] = {
|
||||
0,1,2,3,5,7,
|
||||
9,11,13,15,17,
|
||||
19,21,23,25,27,
|
||||
29,31,33,35,37,
|
||||
39,41,43,45,47,
|
||||
49,51,53,55,57,
|
||||
59,61,63,65,67,
|
||||
69,71,73,75,77,
|
||||
79,81,83,85,87,
|
||||
89,91,93,95,97,100
|
||||
};
|
||||
|
||||
static int batt_chg_step_table[batt_num] = {
|
||||
3530,3565,3600,3635,3655,3680,//+160
|
||||
3700,3717,3734,3745,3755,//+150
|
||||
3770,3778,3786,3795,3803,//+140
|
||||
3810,3814,3818,3822,3825,//+130
|
||||
3830,3832,3834,3836,3837,//+120
|
||||
3840,3842,3844,3846,3847,//+110
|
||||
3850,3857,3864,3871,3876,//+100
|
||||
3890,3897,3904,3911,3918,//+90
|
||||
4030,4047,4064,4080,4096,//+80
|
||||
4120,4132,4144,4156,4170,4180//+70
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define TIMER_MS_COUNTS 1000
|
||||
struct wm_batt_priv_data {
|
||||
int online;
|
||||
int status;
|
||||
int health;
|
||||
int level;
|
||||
int temp;
|
||||
int voltage;
|
||||
};
|
||||
|
||||
struct wm831x_power {
|
||||
struct wm831x *wm831x;
|
||||
struct power_supply wall;
|
||||
struct power_supply usb;
|
||||
struct power_supply battery;
|
||||
struct work_struct batt_work;
|
||||
struct timer_list timer;
|
||||
struct wm_batt_priv_data batt_info;
|
||||
struct wake_lock syslo_wake;
|
||||
int interval;
|
||||
};
|
||||
|
||||
struct wm831x_power *g_wm831x_power;
|
||||
|
||||
static int power_test_sysfs_init(void);
|
||||
extern void wm831x_batt_vol_level(struct wm831x_power *power, int batt_vol, int *level);
|
||||
static DEFINE_MUTEX(charging_mutex);
|
||||
|
||||
int wm831x_read_on_pin_status(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if(!g_wm831x_power)
|
||||
{
|
||||
printk("err:%s:g_wm831x_power address is 0\n",__FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = wm831x_reg_read(g_wm831x_power->wm831x, WM831X_ON_PIN_CONTROL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return !(ret & WM831X_ON_PIN_STS) ? 1 : 0;
|
||||
}
|
||||
|
||||
static int wm831x_power_check_online(struct wm831x *wm831x, int supply,
|
||||
union power_supply_propval *val)
|
||||
{
|
||||
|
|
@ -139,54 +43,18 @@ static int wm831x_power_check_online(struct wm831x *wm831x, int supply,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int wm831x_read_chg_status(void)
|
||||
{
|
||||
int ret, usb_chg = 0, wall_chg = 0;
|
||||
|
||||
if(!g_wm831x_power)
|
||||
{
|
||||
printk("err:%s:g_wm831x_power address is 0\n",__FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = wm831x_reg_read(g_wm831x_power->wm831x, WM831X_SYSTEM_STATUS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (ret & WM831X_PWR_USB)
|
||||
usb_chg = 1;
|
||||
if (ret & WM831X_PWR_WALL)
|
||||
wall_chg = 1;
|
||||
|
||||
return ((usb_chg | wall_chg) ? 1 : 0);
|
||||
}
|
||||
|
||||
static int wm831x_power_read_voltage(struct wm831x *wm831x,
|
||||
enum wm831x_auxadc src,
|
||||
union power_supply_propval *val)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = wm831x_auxadc_read_uv(wm831x, src);
|
||||
if (ret >= 0)
|
||||
val->intval = ret / 1000;
|
||||
|
||||
return ret ;
|
||||
}
|
||||
val->intval = ret;
|
||||
|
||||
int wm831x_read_batt_voltage(void)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if(!g_wm831x_power)
|
||||
{
|
||||
printk("err:%s:g_wm831x_power address is 0\n",__FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = wm831x_auxadc_read_uv(g_wm831x_power->wm831x, WM831X_AUX_BATT);
|
||||
return ret / 1000;
|
||||
return ret;
|
||||
}
|
||||
//EXPORT_SYMBOL_GPL(wm831x_get_batt_voltage);
|
||||
|
||||
/*********************************************************************
|
||||
* WALL Power
|
||||
|
|
@ -322,34 +190,13 @@ static struct chg_map chg_times[] = {
|
|||
{ 510, 15 << WM831X_CHG_TIME_SHIFT },
|
||||
};
|
||||
|
||||
static struct chg_map chg_syslos[] = {
|
||||
{ 2800, 0 << WM831X_CHG_SYSLO_SHIFT},
|
||||
{ 2900, 1 << WM831X_CHG_SYSLO_SHIFT},
|
||||
{ 3000, 2 << WM831X_CHG_SYSLO_SHIFT},
|
||||
{ 3100, 3 << WM831X_CHG_SYSLO_SHIFT},
|
||||
{ 3200, 4 << WM831X_CHG_SYSLO_SHIFT},
|
||||
{ 3300, 5 << WM831X_CHG_SYSLO_SHIFT},
|
||||
{ 3400, 6 << WM831X_CHG_SYSLO_SHIFT},
|
||||
{ 3500, 7 << WM831X_CHG_SYSLO_SHIFT},
|
||||
};
|
||||
|
||||
static struct chg_map chg_sysoks[] = {
|
||||
{ 2800, 0 << WM831X_CHG_SYSOK_SHIFT},
|
||||
{ 2900, 1 << WM831X_CHG_SYSOK_SHIFT},
|
||||
{ 3000, 2 << WM831X_CHG_SYSOK_SHIFT},
|
||||
{ 3100, 3 << WM831X_CHG_SYSOK_SHIFT},
|
||||
{ 3200, 4 << WM831X_CHG_SYSOK_SHIFT},
|
||||
{ 3300, 5 << WM831X_CHG_SYSOK_SHIFT},
|
||||
{ 3400, 6 << WM831X_CHG_SYSOK_SHIFT},
|
||||
{ 3500, 7 << WM831X_CHG_SYSOK_SHIFT},
|
||||
};
|
||||
|
||||
static void wm831x_battey_apply_config(struct wm831x *wm831x,
|
||||
struct chg_map *map, int count, int val,
|
||||
int *reg, const char *name,
|
||||
const char *units)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
if (val == map[i].val)
|
||||
break;
|
||||
|
|
@ -366,7 +213,7 @@ static void wm831x_config_battery(struct wm831x *wm831x)
|
|||
{
|
||||
struct wm831x_pdata *wm831x_pdata = wm831x->dev->platform_data;
|
||||
struct wm831x_battery_pdata *pdata;
|
||||
int ret, reg1, reg2, reg3;
|
||||
int ret, reg1, reg2;
|
||||
|
||||
if (!wm831x_pdata || !wm831x_pdata->battery) {
|
||||
dev_warn(wm831x->dev,
|
||||
|
|
@ -378,7 +225,6 @@ static void wm831x_config_battery(struct wm831x *wm831x)
|
|||
|
||||
reg1 = 0;
|
||||
reg2 = 0;
|
||||
reg3 = 0;
|
||||
|
||||
if (!pdata->enable) {
|
||||
dev_info(wm831x->dev, "Battery charger disabled\n");
|
||||
|
|
@ -412,14 +258,6 @@ static void wm831x_config_battery(struct wm831x *wm831x)
|
|||
pdata->timeout, ®2,
|
||||
"charger timeout", "min");
|
||||
|
||||
wm831x_battey_apply_config(wm831x, chg_syslos, ARRAY_SIZE(chg_syslos),
|
||||
pdata->syslo, ®3,
|
||||
"syslo voltage", "mV");
|
||||
|
||||
wm831x_battey_apply_config(wm831x, chg_sysoks, ARRAY_SIZE(chg_sysoks),
|
||||
pdata->sysok, ®3,
|
||||
"sysok voltage", "mV");
|
||||
|
||||
ret = wm831x_reg_unlock(wm831x);
|
||||
if (ret != 0) {
|
||||
dev_err(wm831x->dev, "Failed to unlock registers: %d\n", ret);
|
||||
|
|
@ -429,12 +267,13 @@ static void wm831x_config_battery(struct wm831x *wm831x)
|
|||
ret = wm831x_set_bits(wm831x, WM831X_CHARGER_CONTROL_1,
|
||||
WM831X_CHG_ENA_MASK |
|
||||
WM831X_CHG_FAST_MASK |
|
||||
WM831X_CHG_ITERM_MASK |
|
||||
WM831X_CHG_ITERM_MASK,
|
||||
reg1);
|
||||
if (ret != 0) {
|
||||
if (ret != 0)
|
||||
dev_err(wm831x->dev, "Failed to set charger control 1: %d\n",
|
||||
ret);
|
||||
}
|
||||
|
||||
ret = wm831x_set_bits(wm831x, WM831X_CHARGER_CONTROL_2,
|
||||
WM831X_CHG_OFF_MSK |
|
||||
WM831X_CHG_TIME_MASK |
|
||||
|
|
@ -442,18 +281,9 @@ static void wm831x_config_battery(struct wm831x *wm831x)
|
|||
WM831X_CHG_TRKL_ILIM_MASK |
|
||||
WM831X_CHG_VSEL_MASK,
|
||||
reg2);
|
||||
if (ret != 0) {
|
||||
if (ret != 0)
|
||||
dev_err(wm831x->dev, "Failed to set charger control 2: %d\n",
|
||||
ret);
|
||||
}
|
||||
|
||||
ret = wm831x_set_bits(wm831x, WM831X_SYSVDD_CONTROL,
|
||||
WM831X_CHG_SYSLO_MASK |
|
||||
WM831X_CHG_SYSOK_MASK,
|
||||
reg3);
|
||||
if (ret < 0) {
|
||||
dev_err(wm831x->dev, "Failed to set sysvdd control reg: %d\n",ret);
|
||||
}
|
||||
|
||||
wm831x_reg_lock(wm831x);
|
||||
}
|
||||
|
|
@ -475,7 +305,6 @@ static int wm831x_bat_check_status(struct wm831x *wm831x, int *status)
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
||||
switch (ret & WM831X_CHG_STATE_MASK) {
|
||||
case WM831X_CHG_STATE_OFF:
|
||||
*status = POWER_SUPPLY_STATUS_NOT_CHARGING;
|
||||
|
|
@ -492,53 +321,10 @@ static int wm831x_bat_check_status(struct wm831x *wm831x, int *status)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int wm831x_read_bat_charging_status(void)
|
||||
{
|
||||
int ret, status;
|
||||
|
||||
if(!g_wm831x_power)
|
||||
{
|
||||
printk("err:%s:g_wm831x_power address is 0\n",__FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = wm831x_bat_check_status(g_wm831x_power->wm831x, &status);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (status == POWER_SUPPLY_STATUS_CHARGING)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm831x_bat_check_type(struct wm831x *wm831x, int *type)
|
||||
{
|
||||
int ret;
|
||||
#ifdef WM831X_DEBUG_0
|
||||
ret = wm831x_reg_read(wm831x, WM831X_POWER_STATE);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
WM_BATT_DBG("%s: wm831x power status %#x\n", __FUNCTION__, ret);
|
||||
|
||||
ret = wm831x_reg_read(wm831x, WM831X_SYSTEM_STATUS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
WM_BATT_DBG("%s: wm831x system status %#x\n", __FUNCTION__, ret);
|
||||
|
||||
ret = wm831x_reg_read(wm831x, WM831X_CHARGER_CONTROL_1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
WM_BATT_DBG("%s: wm831x charger control1 %#x\n", __FUNCTION__, ret);
|
||||
|
||||
ret = wm831x_reg_read(wm831x, WM831X_CHARGER_CONTROL_2);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
WM_BATT_DBG("%s: wm831x charger control2 %#x\n", __FUNCTION__, ret);
|
||||
|
||||
ret = wm831x_reg_read(wm831x, WM831X_CHARGER_STATUS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
WM_BATT_DBG("%s: wm831x charger status %#x\n\n", __FUNCTION__, ret);
|
||||
#endif
|
||||
|
||||
ret = wm831x_reg_read(wm831x, WM831X_CHARGER_STATUS);
|
||||
if (ret < 0)
|
||||
|
|
@ -606,41 +392,25 @@ static int wm831x_bat_get_prop(struct power_supply *psy,
|
|||
{
|
||||
struct wm831x_power *wm831x_power = dev_get_drvdata(psy->dev->parent);
|
||||
struct wm831x *wm831x = wm831x_power->wm831x;
|
||||
int ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
switch (psp) {
|
||||
case POWER_SUPPLY_PROP_STATUS:
|
||||
ret = wm831x_bat_check_status(wm831x, &val->intval);
|
||||
//val->intval = wm831x_power->batt_info.status;
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_PRESENT:
|
||||
case POWER_SUPPLY_PROP_ONLINE:
|
||||
//ret = wm831x_power_check_online(wm831x, WM831X_PWR_SRC_BATT, val);
|
||||
val->intval = wm831x_power->batt_info.online;
|
||||
ret = wm831x_power_check_online(wm831x, WM831X_PWR_SRC_BATT,
|
||||
val);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_VOLTAGE_NOW:
|
||||
//ret = wm831x_power_read_voltage(wm831x, WM831X_AUX_BATT, val);
|
||||
val->intval = wm831x_power->batt_info.voltage*1000;//uV
|
||||
ret = wm831x_power_read_voltage(wm831x, WM831X_AUX_BATT, val);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_HEALTH:
|
||||
//ret = wm831x_bat_check_health(wm831x, &val->intval);
|
||||
val->intval = wm831x_power->batt_info.health;
|
||||
ret = wm831x_bat_check_health(wm831x, &val->intval);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_CHARGE_TYPE:
|
||||
ret = wm831x_bat_check_type(wm831x, &val->intval);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_CAPACITY:
|
||||
//ret = wm831x_power_read_voltage(wm831x, WM831X_AUX_BATT, val);
|
||||
//wm831x_batt_vol_level(wm831x_power, val->intval, &level);
|
||||
//val->intval = level;
|
||||
val->intval = wm831x_power->batt_info.level;
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_TEMP:
|
||||
val->intval = 0;
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_TECHNOLOGY:
|
||||
val->intval = POWER_SUPPLY_TECHNOLOGY_LION;
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
|
|
@ -651,16 +421,12 @@ static int wm831x_bat_get_prop(struct power_supply *psy,
|
|||
|
||||
static enum power_supply_property wm831x_bat_props[] = {
|
||||
POWER_SUPPLY_PROP_STATUS,
|
||||
POWER_SUPPLY_PROP_HEALTH,
|
||||
POWER_SUPPLY_PROP_PRESENT,
|
||||
POWER_SUPPLY_PROP_ONLINE,
|
||||
POWER_SUPPLY_PROP_VOLTAGE_NOW,
|
||||
POWER_SUPPLY_PROP_CAPACITY, /* in percents! */
|
||||
POWER_SUPPLY_PROP_TECHNOLOGY,
|
||||
POWER_SUPPLY_PROP_TEMP,
|
||||
POWER_SUPPLY_PROP_HEALTH,
|
||||
POWER_SUPPLY_PROP_CHARGE_TYPE,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_WM831X_WITH_BATTERY
|
||||
static const char *wm831x_bat_irqs[] = {
|
||||
"BATT HOT",
|
||||
"BATT COLD",
|
||||
|
|
@ -676,18 +442,16 @@ static irqreturn_t wm831x_bat_irq(int irq, void *data)
|
|||
{
|
||||
struct wm831x_power *wm831x_power = data;
|
||||
struct wm831x *wm831x = wm831x_power->wm831x;
|
||||
int irq0;
|
||||
|
||||
irq0 = wm831x->irq_base + WM831X_IRQ_CHG_BATT_HOT + 1;
|
||||
dev_crit(wm831x->dev, "battery changed: i=%d\n", irq-irq0);
|
||||
|
||||
|
||||
dev_dbg(wm831x->dev, "Battery status changed: %d\n", irq);
|
||||
|
||||
/* The battery charger is autonomous so we don't need to do
|
||||
* anything except kick user space */
|
||||
power_supply_changed(&wm831x_power->battery);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* Initialisation
|
||||
|
|
@ -700,8 +464,8 @@ static irqreturn_t wm831x_syslo_irq(int irq, void *data)
|
|||
|
||||
/* Not much we can actually *do* but tell people for
|
||||
* posterity, we're probably about to run out of power. */
|
||||
dev_crit(wm831x->dev, "SYSVDD under voltage and wake lock 60s\n");
|
||||
wake_lock_timeout(&wm831x_power->syslo_wake,60*HZ);//wait for android closing system
|
||||
dev_crit(wm831x->dev, "SYSVDD under voltage\n");
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
|
|
@ -711,299 +475,15 @@ static irqreturn_t wm831x_pwr_src_irq(int irq, void *data)
|
|||
struct wm831x *wm831x = wm831x_power->wm831x;
|
||||
|
||||
dev_dbg(wm831x->dev, "Power source changed\n");
|
||||
WM_BATT_DBG("%s:Power source changed\n", __FUNCTION__);
|
||||
|
||||
/* Just notify for everything - little harm in overnotifying. */
|
||||
power_supply_changed(&wm831x_power->battery);
|
||||
power_supply_changed(&wm831x_power->usb);
|
||||
power_supply_changed(&wm831x_power->wall);
|
||||
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static void wm831x_batt_timer_handler(unsigned long data)
|
||||
{
|
||||
struct wm831x_power *wm831x_power = (struct wm831x_power*)data;
|
||||
schedule_work(&wm831x_power->batt_work);
|
||||
mod_timer(&wm831x_power->timer, jiffies + msecs_to_jiffies(wm831x_power->interval));
|
||||
}
|
||||
|
||||
void wm831x_batt_vol_level(struct wm831x_power *wm831x_power, int batt_vol, int *level)
|
||||
{
|
||||
int i, ret, status;
|
||||
static int chg_plus = 1000;
|
||||
static int chg_minus = 1000;
|
||||
static int chg_curr = 0;
|
||||
static int chg_num = 60;
|
||||
static int disp_plus = 1000;
|
||||
static int disp_minus = 1000;
|
||||
static int disp_curr = 0;
|
||||
static int disp_num = 50;
|
||||
|
||||
|
||||
*level = wm831x_power->batt_info.level;
|
||||
ret = wm831x_bat_check_status(wm831x_power->wm831x, &status);
|
||||
if (ret < 0) {
|
||||
printk("%s: check bat status failer...err = %d\n", __FUNCTION__, ret);
|
||||
return;
|
||||
}
|
||||
|
||||
if (status == POWER_SUPPLY_STATUS_NOT_CHARGING
|
||||
&& batt_vol >= batt_step_table[batt_num-1]) {
|
||||
*level = 100;
|
||||
return;
|
||||
}
|
||||
|
||||
if (status == POWER_SUPPLY_STATUS_CHARGING)
|
||||
{
|
||||
disp_plus = 0;
|
||||
disp_minus = 0;
|
||||
disp_curr = 0;
|
||||
|
||||
for(i = 0; i < batt_num; i++){
|
||||
if((batt_chg_step_table[i] <= batt_vol) &&
|
||||
(batt_chg_step_table[i+1] > batt_vol))
|
||||
break;
|
||||
}
|
||||
*level = batt_disp_table[i];
|
||||
|
||||
if (batt_vol <= batt_chg_step_table[0])
|
||||
*level = 0;
|
||||
if (batt_vol >= batt_chg_step_table[batt_num - 1])
|
||||
*level = 100;
|
||||
|
||||
// ³õʼ״̬
|
||||
if ((chg_plus == 1000) && (chg_minus == 1000))
|
||||
{
|
||||
*level = *level;
|
||||
chg_plus = 0;
|
||||
chg_minus = 0;
|
||||
chg_curr = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (*level >= (wm831x_power->batt_info.level+1))
|
||||
{
|
||||
chg_minus = 0;
|
||||
chg_curr = 0;
|
||||
|
||||
if (++chg_plus > chg_num)
|
||||
{
|
||||
*level = wm831x_power->batt_info.level + 1;
|
||||
chg_plus = 0;
|
||||
|
||||
if(*level < 85)
|
||||
chg_num = 60;
|
||||
else
|
||||
chg_num = 20;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
*level = wm831x_power->batt_info.level;
|
||||
}
|
||||
}
|
||||
|
||||
else if (*level >= wm831x_power->batt_info.level)
|
||||
{
|
||||
chg_plus = 0;
|
||||
chg_minus = 0;
|
||||
|
||||
if (++chg_curr > chg_num)
|
||||
{
|
||||
*level = *level;
|
||||
chg_curr = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
*level = wm831x_power->batt_info.level;
|
||||
}
|
||||
}
|
||||
else if (*level < (wm831x_power->batt_info.level-1))
|
||||
{
|
||||
chg_plus = 0;
|
||||
chg_curr = 0;
|
||||
|
||||
if (++chg_minus > (chg_num<<1))
|
||||
{
|
||||
*level = wm831x_power->batt_info.level - 1;
|
||||
chg_minus = 0;
|
||||
|
||||
if(*level < 85)
|
||||
chg_num = 60;
|
||||
else
|
||||
chg_num = 20;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
*level = wm831x_power->batt_info.level;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
chg_plus = 0;
|
||||
chg_minus = 0;
|
||||
chg_curr = 0;
|
||||
*level = wm831x_power->batt_info.level;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (*level >= 100)
|
||||
*level = 100;
|
||||
if (*level < 0)
|
||||
*level = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
chg_plus = 0;
|
||||
chg_minus = 0;
|
||||
chg_curr = 0;
|
||||
|
||||
for(i = 0; i < batt_num; i++){
|
||||
if(batt_vol >= batt_step_table[i] &&
|
||||
batt_vol < batt_step_table[i+1])
|
||||
break;
|
||||
}
|
||||
*level = batt_disp_table[i];
|
||||
|
||||
if (batt_vol <= batt_step_table[0])
|
||||
*level = 0;
|
||||
if (batt_vol >= batt_step_table[batt_num - 1])
|
||||
*level = 100;
|
||||
|
||||
// ³õʼ״̬
|
||||
if ((disp_plus == 1000) && (disp_minus == 1000))
|
||||
{
|
||||
*level = *level;
|
||||
disp_plus = 0;
|
||||
disp_minus = 0;
|
||||
disp_curr = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (*level <= (wm831x_power->batt_info.level-1))
|
||||
{
|
||||
disp_plus = 0;
|
||||
disp_curr = 0;
|
||||
|
||||
if (++disp_minus > disp_num)
|
||||
{
|
||||
*level = wm831x_power->batt_info.level - 1;
|
||||
disp_minus = 0;
|
||||
|
||||
if((*level < 17) || (*level > 85))
|
||||
disp_num = 10;
|
||||
else
|
||||
disp_num = 50;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
*level = wm831x_power->batt_info.level;
|
||||
}
|
||||
}
|
||||
else if (*level <= wm831x_power->batt_info.level)
|
||||
{
|
||||
disp_plus = 0;
|
||||
disp_minus = 0;
|
||||
|
||||
if (++disp_curr > disp_num)
|
||||
{
|
||||
*level = *level;
|
||||
disp_curr = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
*level = wm831x_power->batt_info.level;
|
||||
}
|
||||
}
|
||||
else if (*level >= (wm831x_power->batt_info.level+1))
|
||||
{
|
||||
disp_minus = 0;
|
||||
disp_curr = 0;
|
||||
|
||||
if (++disp_plus > (disp_num<<1))
|
||||
{
|
||||
*level = wm831x_power->batt_info.level + 1;
|
||||
disp_plus = 0;
|
||||
if((*level < 17) || (*level > 85))
|
||||
disp_num = 10;
|
||||
else
|
||||
disp_num = 50;
|
||||
}
|
||||
else
|
||||
{
|
||||
*level = wm831x_power->batt_info.level;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
disp_plus = 0;
|
||||
disp_minus = 0;
|
||||
disp_curr = 0;
|
||||
*level = wm831x_power->batt_info.level;
|
||||
}
|
||||
}
|
||||
|
||||
if (*level >= 100)
|
||||
*level = 100;
|
||||
if (*level < 0)
|
||||
*level = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void wm831x_batt_work(struct work_struct *work)
|
||||
{
|
||||
int online, status,health,level, ret;
|
||||
union power_supply_propval val;
|
||||
struct wm831x_power *power = container_of(work, struct wm831x_power, batt_work);
|
||||
|
||||
ret = wm831x_power_check_online(power->wm831x, WM831X_PWR_SRC_BATT, &val);
|
||||
if (ret < 0) {
|
||||
printk("%s: check bat online failer... err = %d\n", __FUNCTION__, ret);
|
||||
return;
|
||||
}
|
||||
online = val.intval;
|
||||
|
||||
ret = wm831x_bat_check_status(power->wm831x, &status);
|
||||
if (ret < 0) {
|
||||
printk("%s: check bat status failer... err = %d\n", __FUNCTION__, ret);
|
||||
return;
|
||||
}
|
||||
|
||||
ret = wm831x_bat_check_health(power->wm831x, &health);
|
||||
if (ret < 0) {
|
||||
printk("%s: check bat health failer... err = %d\n", __FUNCTION__, ret);
|
||||
return;
|
||||
}
|
||||
|
||||
ret = wm831x_power_read_voltage(power->wm831x, WM831X_AUX_BATT, &val);
|
||||
if (ret < 0) {
|
||||
printk("%s: read bat voltage failer...err = %d\n", __FUNCTION__, ret);
|
||||
return;
|
||||
}
|
||||
power->batt_info.voltage = val.intval;
|
||||
|
||||
wm831x_batt_vol_level(power, val.intval, &level);
|
||||
//mod_timer(&power->timer, jiffies + msecs_to_jiffies(power->interval));
|
||||
|
||||
if (online != power->batt_info.online || status != power->batt_info.status
|
||||
|| health != power->batt_info.health || level != power->batt_info.level)
|
||||
{
|
||||
power->batt_info.online = online;
|
||||
power->batt_info.status = status;
|
||||
power->batt_info.health = health;
|
||||
power->batt_info.level = level;
|
||||
|
||||
power_supply_changed(&power->battery);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static __devinit int wm831x_power_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
|
||||
|
|
@ -1076,14 +556,12 @@ static __devinit int wm831x_power_probe(struct platform_device *pdev)
|
|||
goto err_syslo;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_WM831X_WITH_BATTERY
|
||||
for (i = 0; i < ARRAY_SIZE(wm831x_bat_irqs); i++) {
|
||||
irq = platform_get_irq_byname(pdev, wm831x_bat_irqs[i]);
|
||||
ret = request_threaded_irq(irq, NULL, wm831x_bat_irq,
|
||||
IRQF_TRIGGER_RISING,
|
||||
wm831x_bat_irqs[i],
|
||||
power);
|
||||
WM_BATT_DBG("%s: %s irq no %d\n", __FUNCTION__, wm831x_bat_irqs[i], irq);
|
||||
if (ret != 0) {
|
||||
dev_err(&pdev->dev,
|
||||
"Failed to request %s IRQ %d: %d\n",
|
||||
|
|
@ -1091,27 +569,9 @@ static __devinit int wm831x_power_probe(struct platform_device *pdev)
|
|||
goto err_bat_irq;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
power->interval = TIMER_MS_COUNTS;
|
||||
power->batt_info.level = 100;
|
||||
power->batt_info.voltage = 4200;
|
||||
power->batt_info.online = 1;
|
||||
power->batt_info.status = POWER_SUPPLY_STATUS_DISCHARGING;
|
||||
power->batt_info.health = POWER_SUPPLY_HEALTH_GOOD;
|
||||
|
||||
wake_lock_init(&power->syslo_wake, WAKE_LOCK_SUSPEND, "wm831x_syslo_wake");
|
||||
INIT_WORK(&power->batt_work, wm831x_batt_work);
|
||||
setup_timer(&power->timer, wm831x_batt_timer_handler, (unsigned long)power);
|
||||
power->timer.expires = jiffies + msecs_to_jiffies(1000);
|
||||
add_timer(&power->timer);
|
||||
|
||||
g_wm831x_power = power;
|
||||
printk("%s:wm831x_power initialized\n",__FUNCTION__);
|
||||
power_test_sysfs_init();
|
||||
return ret;
|
||||
|
||||
#ifdef CONFIG_WM831X_WITH_BATTERY
|
||||
|
||||
err_bat_irq:
|
||||
for (; i >= 0; i--) {
|
||||
irq = platform_get_irq_byname(pdev, wm831x_bat_irqs[i]);
|
||||
|
|
@ -1119,8 +579,6 @@ static __devinit int wm831x_power_probe(struct platform_device *pdev)
|
|||
}
|
||||
irq = platform_get_irq_byname(pdev, "PWR SRC");
|
||||
free_irq(irq, power);
|
||||
#endif
|
||||
|
||||
err_syslo:
|
||||
irq = platform_get_irq_byname(pdev, "SYSLO");
|
||||
free_irq(irq, power);
|
||||
|
|
@ -1139,12 +597,12 @@ static __devexit int wm831x_power_remove(struct platform_device *pdev)
|
|||
{
|
||||
struct wm831x_power *wm831x_power = platform_get_drvdata(pdev);
|
||||
int irq, i;
|
||||
#ifdef CONFIG_WM831X_WITH_BATTERY
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(wm831x_bat_irqs); i++) {
|
||||
irq = platform_get_irq_byname(pdev, wm831x_bat_irqs[i]);
|
||||
free_irq(irq, wm831x_power);
|
||||
}
|
||||
#endif
|
||||
|
||||
irq = platform_get_irq_byname(pdev, "PWR SRC");
|
||||
free_irq(irq, wm831x_power);
|
||||
|
||||
|
|
@ -1154,40 +612,17 @@ static __devexit int wm831x_power_remove(struct platform_device *pdev)
|
|||
power_supply_unregister(&wm831x_power->battery);
|
||||
power_supply_unregister(&wm831x_power->wall);
|
||||
power_supply_unregister(&wm831x_power->usb);
|
||||
kfree(wm831x_power);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int wm831x_battery_suspend(struct platform_device *dev, pm_message_t state)
|
||||
{
|
||||
struct wm831x_power *power = (struct wm831x_power *)platform_get_drvdata(dev);
|
||||
flush_scheduled_work();
|
||||
del_timer(&power->timer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm831x_battery_resume(struct platform_device *dev)
|
||||
{
|
||||
struct wm831x_power *power = (struct wm831x_power *)platform_get_drvdata(dev);
|
||||
power->timer.expires = jiffies + msecs_to_jiffies(power->interval);
|
||||
add_timer(&power->timer);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#define wm831x_battery_suspend NULL
|
||||
#define wm831x_battery_resume NULL
|
||||
#endif
|
||||
|
||||
static struct platform_driver wm831x_power_driver = {
|
||||
.probe = wm831x_power_probe,
|
||||
.remove = __devexit_p(wm831x_power_remove),
|
||||
.suspend = wm831x_battery_suspend,
|
||||
.resume = wm831x_battery_resume,
|
||||
.driver = {
|
||||
.name = "wm831x-power",
|
||||
},
|
||||
};
|
||||
|
||||
static int __init wm831x_power_init(void)
|
||||
{
|
||||
return platform_driver_register(&wm831x_power_driver);
|
||||
|
|
@ -1200,98 +635,7 @@ static void __exit wm831x_power_exit(void)
|
|||
}
|
||||
module_exit(wm831x_power_exit);
|
||||
|
||||
|
||||
static ssize_t power_prop_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
ssize_t ret = 0;
|
||||
int level, power_status, system_status, chg_ctl1, chg_ctl2, chg_status;
|
||||
union power_supply_propval val;
|
||||
|
||||
if (!g_wm831x_power)
|
||||
return -1;
|
||||
power_status = wm831x_reg_read(g_wm831x_power->wm831x, WM831X_POWER_STATE);
|
||||
if (power_status < 0)
|
||||
return power_status;
|
||||
//printk("wm831x power status %#x\n", ret);
|
||||
|
||||
system_status = wm831x_reg_read(g_wm831x_power->wm831x, WM831X_SYSTEM_STATUS);
|
||||
if (system_status < 0)
|
||||
return system_status;
|
||||
//printk("wm831x system status %#x\n", ret);
|
||||
|
||||
chg_ctl1 = wm831x_reg_read(g_wm831x_power->wm831x, WM831X_CHARGER_CONTROL_1);
|
||||
if (chg_ctl1 < 0)
|
||||
return chg_ctl1;
|
||||
//printk("wm831x charger control1 %#x\n", ret);
|
||||
|
||||
chg_ctl2 = wm831x_reg_read(g_wm831x_power->wm831x, WM831X_CHARGER_CONTROL_2);
|
||||
if (chg_ctl2 < 0)
|
||||
return chg_ctl2;
|
||||
//printk("wm831x charger control2 %#x\n", ret);
|
||||
|
||||
chg_status = wm831x_reg_read(g_wm831x_power->wm831x, WM831X_CHARGER_STATUS);
|
||||
if (chg_status < 0)
|
||||
return chg_status;
|
||||
//printk("wm831x charger status %#x\n", ret);
|
||||
|
||||
ret = wm831x_power_read_voltage(g_wm831x_power->wm831x, WM831X_AUX_BATT, &val);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
wm831x_batt_vol_level(g_wm831x_power, val.intval, &level);
|
||||
//printk("batt_vol = %d batt_level = %d\n", val.intval, level);
|
||||
//
|
||||
sprintf(buf, "power_status=%#x\n"
|
||||
"system_status=%#x\n"
|
||||
"chg_ctl1=%#x\n"
|
||||
"chg_ctl2=%#x\n"
|
||||
"chg_status=%#x\n"
|
||||
"batt_vol=%d\n"
|
||||
"batt_level=%d%%\n",
|
||||
power_status,
|
||||
system_status,
|
||||
chg_ctl1,
|
||||
chg_ctl2,
|
||||
chg_status,
|
||||
val.intval,
|
||||
level);
|
||||
ret = strlen(buf) + 1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(prop, 0444, power_prop_show, NULL);
|
||||
|
||||
static struct kobject *power_test_kobj;
|
||||
|
||||
static int power_test_sysfs_init(void)
|
||||
{
|
||||
int ret ;
|
||||
power_test_kobj = kobject_create_and_add("power_test_prop", NULL);
|
||||
if (power_test_kobj == NULL) {
|
||||
printk(KERN_ERR
|
||||
"power_test_sysfs_init:"\
|
||||
"subsystem_register failed\n");
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
ret = sysfs_create_file(power_test_kobj, &dev_attr_prop.attr);
|
||||
if (ret) {
|
||||
printk(KERN_ERR
|
||||
"power_test_sysfs_init:"\
|
||||
"sysfs_create_group failed\n");
|
||||
goto err1;
|
||||
}
|
||||
|
||||
return 0 ;
|
||||
err1:
|
||||
kobject_del(power_test_kobj);
|
||||
err:
|
||||
return ret ;
|
||||
}
|
||||
|
||||
|
||||
MODULE_DESCRIPTION("Power supply driver for WM831x PMICs");
|
||||
MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_ALIAS("platform:wm831x-power");
|
||||
|
||||
|
|
|
|||
|
|
@ -25,16 +25,11 @@ obj-$(CONFIG_REGULATOR_WM8350) += wm8350-regulator.o
|
|||
obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_WM8994) += wm8994-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_TPS6586X) += tps6586x-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_TPS65910) += tps65910-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
|
||||
obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_MC13783) += mc13783-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o
|
||||
obj-$(CONFIG_RK2818_REGULATOR_LP8725) += rk2818_lp8725.o
|
||||
obj-$(CONFIG_RK2818_REGULATOR_CHARGE) += charge-regulator.o
|
||||
obj-$(CONFIG_RK29_PWM_REGULATOR) += rk29-pwm-regulator.o
|
||||
|
||||
obj-$(CONFIG_REGULATOR_CPCAP) += cpcap-regulator.o
|
||||
|
||||
obj-$(CONFIG_REGULATOR_TPS65023) += tps65023-regulator.o
|
||||
|
|
@ -42,6 +37,5 @@ obj-$(CONFIG_REGULATOR_TPS6507X) += tps6507x-regulator.o
|
|||
obj-$(CONFIG_REGULATOR_88PM8607) += 88pm8607.o
|
||||
obj-$(CONFIG_REGULATOR_ISL6271A) += isl6271a-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_AB8500) += ab8500.o
|
||||
obj-$(CONFIG_REGULATOR_ACT8891) += act8891.o
|
||||
|
||||
ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG
|
||||
|
|
|
|||
|
|
@ -1621,23 +1621,7 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
|
|||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(regulator_set_voltage);
|
||||
int regulator_set_suspend_voltage(struct regulator *regulator, int uV)
|
||||
{
|
||||
struct regulator_dev *rdev = regulator->rdev;
|
||||
int ret = 0;
|
||||
|
||||
if (rdev->desc->ops->set_suspend_voltage && uV > 0) {
|
||||
ret = rdev->desc->ops->set_suspend_voltage(rdev, uV);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "%s: failed to set voltage\n",
|
||||
__func__);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(regulator_set_suspend_voltage);
|
||||
static int _regulator_get_voltage(struct regulator_dev *rdev)
|
||||
{
|
||||
/* sanity check */
|
||||
|
|
|
|||
|
|
@ -1,767 +0,0 @@
|
|||
/*
|
||||
* tps65910-regulator.c -- support regulators in tps65910x family chips
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2010 Mistral Solutions Pvt Ltd <www.mistralsolutions.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation version 2.
|
||||
*
|
||||
* This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
|
||||
* whether express or implied; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/regulator/driver.h>
|
||||
#include <linux/regulator/machine.h>
|
||||
#include <linux/i2c/tps65910.h>
|
||||
|
||||
#if 0
|
||||
#define DBG(x...) printk(KERN_INFO x)
|
||||
#else
|
||||
#define DBG(x...)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The TPS65910x family chips include power management, a GPIO
|
||||
* RTC. These chips are often used in AM35xx-based systems.
|
||||
*
|
||||
* This driver implements software-based resource control for various
|
||||
* voltage regulators. This is usually augmented with state machine
|
||||
* based control.
|
||||
*/
|
||||
|
||||
|
||||
struct tps65910reg_info {
|
||||
/* tps65910 resource ID, for resource control state machine */
|
||||
u8 id;
|
||||
/* voltage in mV = table[VSEL]; table_len must be a power-of-two */
|
||||
u8 table_len;
|
||||
const u16 *table;
|
||||
|
||||
/* regulator specific turn-on delay */
|
||||
u32 delay;
|
||||
/* chip constraints on regulator behavior */
|
||||
u16 min_mV;
|
||||
u16 max_mV;
|
||||
/* used by regulator core */
|
||||
struct regulator_desc desc;
|
||||
};
|
||||
|
||||
|
||||
/* Supported voltage values for regulators */
|
||||
|
||||
/* TPS65910 VIO */
|
||||
static const u16 VIO_VSEL_table[] = {
|
||||
1500, 1800, 2500, 3300,
|
||||
};
|
||||
|
||||
/* TPS65910 VDD1 and VDD2 */
|
||||
/* value round off 12.5 is made as 12 */
|
||||
static const u16 VDD1_VSEL_table[] = {
|
||||
0, 600, 600, 600, 612, 625, 637, 650,
|
||||
662, 675, 687, 700, 712, 725, 737, 750,
|
||||
762, 775, 787, 800, 812, 825, 837, 850,
|
||||
862, 875, 887, 900, 912, 925, 937, 950,
|
||||
962, 975, 987, 1000, 1012, 1025, 1037, 1050,
|
||||
1062, 1075, 1087, 1100, 1112, 1125, 1137, 1150,
|
||||
1162, 1175, 1187, 1200, 1212, 1225, 1237, 1250,
|
||||
1262, 1275, 1287, 1300, 1312, 1325, 1337, 1350,
|
||||
1362, 1375, 1387, 1400, 1412, 1425, 1437, 1450,
|
||||
1462, 1475, 1487, 1500,
|
||||
};
|
||||
|
||||
static const u16 VDD2_VSEL_table[] = {
|
||||
0, 600, 600, 600, 612, 625, 637, 650,
|
||||
662, 675, 687, 700, 712, 725, 737, 750,
|
||||
762, 775, 787, 800, 812, 825, 837, 850,
|
||||
862, 875, 887, 900, 912, 925, 937, 950,
|
||||
962, 975, 987, 1000, 1012, 1025, 1037, 1050,
|
||||
1062, 1075, 1087, 1100, 1112, 1125, 1137, 1150,
|
||||
1162, 1175, 1187, 1200, 1212, 1225, 1237, 1250,
|
||||
1262, 1275, 1287, 1300, 1312, 1325, 1337, 1350,
|
||||
1362, 1375, 1387, 1400, 1412, 1425, 1437, 1450,
|
||||
1462, 1475, 1487, 1500,
|
||||
};
|
||||
|
||||
/* TPS65910 VDD3 */
|
||||
static const u16 VDD3_VSEL_table[] = {
|
||||
5000,
|
||||
};
|
||||
|
||||
/* VDIG1 */
|
||||
static const u16 VDIG1_VSEL_table[] = {
|
||||
1200, 1500, 1800, 2700,
|
||||
};
|
||||
|
||||
/* VDIG2 */
|
||||
static const u16 VDIG2_VSEL_table[] = {
|
||||
1000, 1100, 1200, 1800,
|
||||
};
|
||||
|
||||
/* VAUX33 */
|
||||
static const u16 VAUX33_VSEL_table[] = {
|
||||
1800, 2000, 2800, 3300,
|
||||
};
|
||||
|
||||
/* VMMC */
|
||||
static const u16 VMMC_VSEL_table[] = {
|
||||
1800, 2800, 3000, 3300,
|
||||
};
|
||||
|
||||
/* VAUX1 */
|
||||
static const u16 VAUX1_VSEL_table[] = {
|
||||
1800, 2000, 2800, 3300,
|
||||
};
|
||||
|
||||
/* VAUX2 */
|
||||
static const u16 VAUX2_VSEL_table[] = {
|
||||
1800, 2800, 2900, 3300,
|
||||
};
|
||||
|
||||
/* VDAC */
|
||||
static const u16 VDAC_VSEL_table[] = {
|
||||
1800, 2600, 2800, 2850,
|
||||
};
|
||||
|
||||
|
||||
/* VPLL */
|
||||
static const u16 VPLL_VSEL_table[] = {
|
||||
1000, 1100, 1800, 2500,
|
||||
};
|
||||
|
||||
/* VRTC, supports only enable/disable */
|
||||
static const u16 VRTC_VSEL_table[] = {
|
||||
1800,
|
||||
};
|
||||
|
||||
static inline int
|
||||
tps65910reg_read(struct tps65910reg_info *info, unsigned slave_addr,
|
||||
u8 offset)
|
||||
{
|
||||
u8 value;
|
||||
int status;
|
||||
status = tps65910_i2c_read_u8(slave_addr, &value, offset);
|
||||
|
||||
return (status < 0) ? status : value;
|
||||
}
|
||||
|
||||
static inline int
|
||||
tps65910reg_write(struct tps65910reg_info *info, unsigned slave_addr,
|
||||
u8 offset, u8 value)
|
||||
{
|
||||
if (0 == tps65910_i2c_write_u8(slave_addr, value, offset))
|
||||
return 0;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
static u8 tps65910reg_find_offset(u8 regulator_id)
|
||||
{
|
||||
u8 offset = 0;
|
||||
|
||||
switch (regulator_id) {
|
||||
|
||||
case TPS65910_VIO:
|
||||
offset = TPS65910_REG_VIO;
|
||||
break;
|
||||
case TPS65910_VDD1:
|
||||
offset = TPS65910_REG_VDD1_OP;
|
||||
break;
|
||||
case TPS65910_VDD2:
|
||||
offset = TPS65910_REG_VDD2_OP;
|
||||
break;
|
||||
case TPS65910_VDD3:
|
||||
offset = TPS65910_REG_VDD3;
|
||||
break;
|
||||
case TPS65910_VDIG1:
|
||||
offset = TPS65910_REG_VDIG1;
|
||||
break;
|
||||
case TPS65910_VDIG2:
|
||||
offset = TPS65910_REG_VDIG2;
|
||||
break;
|
||||
case TPS65910_VAUX33:
|
||||
offset = TPS65910_REG_VAUX33;
|
||||
break;
|
||||
case TPS65910_VMMC:
|
||||
offset = TPS65910_REG_VMMC;
|
||||
break;
|
||||
case TPS65910_VAUX1:
|
||||
offset = TPS65910_REG_VAUX1;
|
||||
break;
|
||||
case TPS65910_VAUX2:
|
||||
offset = TPS65910_REG_VAUX2;
|
||||
break;
|
||||
case TPS65910_VDAC:
|
||||
offset = TPS65910_REG_VDAC;
|
||||
break;
|
||||
case TPS65910_VPLL:
|
||||
offset = TPS65910_REG_VPLL;
|
||||
break;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
||||
static int tps65910reg_is_enabled(struct regulator_dev *rdev)
|
||||
{
|
||||
int val;
|
||||
u8 offset;
|
||||
|
||||
struct tps65910reg_info *info = rdev_get_drvdata(rdev);
|
||||
|
||||
offset = tps65910reg_find_offset(info->id);
|
||||
|
||||
val = tps65910reg_read(info, TPS65910_I2C_ID0, offset);
|
||||
if (val < 0) {
|
||||
printk(KERN_ERR "Unable to read TPS65910 Reg at offset 0x%x= \
|
||||
\n", offset);
|
||||
return -EIO;
|
||||
}
|
||||
if ((val & TPS65910_REG_OHP) || (val & TPS65910_REG_OLP))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int tps65910reg_enable(struct regulator_dev *rdev)
|
||||
{
|
||||
int val;
|
||||
u8 offset;
|
||||
struct tps65910reg_info *info = rdev_get_drvdata(rdev);
|
||||
|
||||
offset = tps65910reg_find_offset(info->id);
|
||||
|
||||
val = tps65910reg_read(info, TPS65910_I2C_ID0, offset);
|
||||
|
||||
if (val < 0) {
|
||||
|
||||
printk(KERN_ERR "Unable to read TPS65910 Reg at offset = 0x%x \
|
||||
\n", offset);
|
||||
return -EIO;
|
||||
}
|
||||
val |= TPS65910_REG_OHP;
|
||||
|
||||
DBG("%s: enable regulator id=%d\n", __FUNCTION__, info->id);
|
||||
|
||||
return tps65910reg_write(info, TPS65910_I2C_ID0, offset, val);
|
||||
}
|
||||
|
||||
static int tps65910reg_disable(struct regulator_dev *rdev)
|
||||
{
|
||||
int val;
|
||||
u8 offset;
|
||||
|
||||
struct tps65910reg_info *info = rdev_get_drvdata(rdev);
|
||||
|
||||
offset = tps65910reg_find_offset(info->id);
|
||||
|
||||
val = tps65910reg_read(info, TPS65910_I2C_ID0, offset);
|
||||
|
||||
if (val < 0) {
|
||||
|
||||
printk(KERN_ERR "Unable to read TPS65910 Reg at offset = \
|
||||
0x%x\n", offset);
|
||||
return -EIO;
|
||||
}
|
||||
val &= TPS65910_REG_OFF_00;
|
||||
|
||||
DBG("%s: disable regulator id=%d\n", __FUNCTION__, info->id);
|
||||
|
||||
return tps65910reg_write(info, TPS65910_I2C_ID0, offset, val);
|
||||
}
|
||||
|
||||
static int tps65910reg_get_status(struct regulator_dev *rdev)
|
||||
{
|
||||
int val;
|
||||
u8 offset;
|
||||
u8 ret;
|
||||
struct tps65910reg_info *info = rdev_get_drvdata(rdev);
|
||||
|
||||
offset = tps65910reg_find_offset(info->id);
|
||||
|
||||
val = tps65910reg_read(info, TPS65910_I2C_ID0, offset);
|
||||
|
||||
if (val < 0) {
|
||||
|
||||
printk(KERN_ERR "Unable to read TPS65910 Reg at offset = \
|
||||
0x%x\n", offset);
|
||||
return -EIO;
|
||||
}
|
||||
switch ((val & SUPPLY_STATE_FLAG)) {
|
||||
|
||||
case TPS65910_REG_OFF_00:
|
||||
case TPS65910_REG_OFF_10:
|
||||
ret = REGULATOR_STATUS_OFF;
|
||||
break;
|
||||
case TPS65910_REG_OHP:
|
||||
case TPS65910_REG_OLP:
|
||||
ret = REGULATOR_STATUS_ON;
|
||||
break;
|
||||
default:
|
||||
ret = REGULATOR_STATUS_OFF;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int tps65910reg_set_mode(struct regulator_dev *rdev, unsigned mode)
|
||||
{
|
||||
struct tps65910reg_info *info = rdev_get_drvdata(rdev);
|
||||
u8 offset;
|
||||
u8 val;
|
||||
|
||||
offset = tps65910reg_find_offset(info->id);
|
||||
val = tps65910reg_read(info, TPS65910_I2C_ID0, offset);
|
||||
|
||||
if (val < 0) {
|
||||
printk(KERN_ERR"Unable to read TPS65910 Reg at offset \
|
||||
= 0x%x\n", offset);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
switch (mode) {
|
||||
case REGULATOR_MODE_NORMAL:
|
||||
return tps65910reg_write(info, TPS65910_I2C_ID0, offset,
|
||||
(val | TPS65910_REG_OHP));
|
||||
case REGULATOR_MODE_STANDBY:
|
||||
return tps65910reg_write(info, TPS65910_I2C_ID0, offset,
|
||||
(val | TPS65910_REG_OLP));
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
int tps65910_ldo_list_voltage(struct regulator_dev *rdev, unsigned index)
|
||||
{
|
||||
struct tps65910reg_info *info = rdev_get_drvdata(rdev);
|
||||
int mV = info->table[index];
|
||||
return mV * 1000;
|
||||
}
|
||||
|
||||
static int get_voltage_index(int ldo_id, int uv)
|
||||
{
|
||||
int i = 0;
|
||||
int size = 0;
|
||||
u16 *ptr = NULL;
|
||||
|
||||
uv = uv/1000;
|
||||
|
||||
if (((ldo_id == TPS65910_VDD1) || (ldo_id == TPS65910_VDD2))) {
|
||||
for (i = 0; i < ARRAY_SIZE(VDD1_VSEL_table); i++) {
|
||||
if (VDD1_VSEL_table[i] == uv) {
|
||||
DBG("%s: regulator id=%d, volage=%d, get index=%d\n", __FUNCTION__, ldo_id, uv, i);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
if (i == ARRAY_SIZE(VDD1_VSEL_table)) {
|
||||
DBG("%s: regulator id=%d, can't find volage index\n", __FUNCTION__, ldo_id);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Lookup table to match LDO volatge to Index*/
|
||||
switch (ldo_id) {
|
||||
|
||||
case TPS65910_VIO:
|
||||
ptr = (u16 *)&VIO_VSEL_table[0];
|
||||
size = ARRAY_SIZE(VIO_VSEL_table);
|
||||
break;
|
||||
case TPS65910_VDIG1:
|
||||
ptr = (u16 *)&VDIG1_VSEL_table[0];
|
||||
size = ARRAY_SIZE(VDIG1_VSEL_table);
|
||||
break;
|
||||
case TPS65910_VDIG2:
|
||||
ptr = (u16 *)&VDIG2_VSEL_table[0];
|
||||
size = ARRAY_SIZE(VDIG2_VSEL_table);
|
||||
break;
|
||||
case TPS65910_VAUX33:
|
||||
ptr = (u16 *)&VAUX33_VSEL_table[0];
|
||||
size = ARRAY_SIZE(VAUX33_VSEL_table);
|
||||
break;
|
||||
case TPS65910_VMMC:
|
||||
ptr = (u16 *)&VMMC_VSEL_table[0];
|
||||
size = ARRAY_SIZE(VMMC_VSEL_table);
|
||||
break;
|
||||
case TPS65910_VAUX1:
|
||||
ptr = (u16 *)&VAUX1_VSEL_table[0];
|
||||
size = ARRAY_SIZE(VAUX1_VSEL_table);
|
||||
break;
|
||||
case TPS65910_VAUX2:
|
||||
ptr = (u16 *)&VAUX2_VSEL_table[0];
|
||||
size = ARRAY_SIZE(VAUX2_VSEL_table);
|
||||
break;
|
||||
case TPS65910_VDAC:
|
||||
ptr = (u16 *)&VDAC_VSEL_table[0];
|
||||
size = ARRAY_SIZE(VDAC_VSEL_table);
|
||||
break;
|
||||
case TPS65910_VPLL:
|
||||
ptr = (u16 *)&VPLL_VSEL_table[0];
|
||||
size = ARRAY_SIZE(VPLL_VSEL_table);
|
||||
break;
|
||||
default:
|
||||
ptr = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ptr != NULL) {
|
||||
for (i = 0; i < size; i++) {
|
||||
if (*ptr++ == uv) {
|
||||
DBG("%s: regulator id=%d, volage=%d, get index=%d\n", __FUNCTION__, ldo_id, uv, i);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
DBG("%s: regulator id=%d, can't find volage index\n", __FUNCTION__, ldo_id);
|
||||
|
||||
if (ptr == NULL || i == size)
|
||||
return -1;
|
||||
/* For warning */
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int get_index_voltage(int ldo_id, int index)
|
||||
{
|
||||
int vsel;
|
||||
int size = 0;
|
||||
u16 *ptr = NULL;
|
||||
|
||||
/* Get the index of voltage value from Reg and map to table */
|
||||
if (ldo_id == TPS65910_VDD1 || ldo_id == TPS65910_VDD2) {
|
||||
index &= 0x7F;
|
||||
ptr = (u16 *)&VDD1_VSEL_table[0];
|
||||
size = ARRAY_SIZE(VDD1_VSEL_table);
|
||||
/* For VDD1 and VDD2 */
|
||||
if (index >= size) {
|
||||
vsel = size - 1;
|
||||
} else {
|
||||
vsel = index;
|
||||
}
|
||||
} else {
|
||||
vsel = (index & 0xF3);
|
||||
vsel = (vsel >> 2);
|
||||
|
||||
/* Lookup table to match LDO volatge to Index*/
|
||||
switch (ldo_id) {
|
||||
|
||||
case TPS65910_VIO:
|
||||
ptr = (u16 *)&VIO_VSEL_table[0];
|
||||
size = ARRAY_SIZE(VIO_VSEL_table);
|
||||
break;
|
||||
case TPS65910_VDIG1:
|
||||
ptr = (u16 *)&VDIG1_VSEL_table[0];
|
||||
size = ARRAY_SIZE(VDIG1_VSEL_table);
|
||||
break;
|
||||
case TPS65910_VDIG2:
|
||||
ptr = (u16 *)&VDIG2_VSEL_table[0];
|
||||
size = ARRAY_SIZE(VDIG2_VSEL_table);
|
||||
break;
|
||||
case TPS65910_VAUX33:
|
||||
ptr = (u16 *)&VAUX33_VSEL_table[0];
|
||||
size = ARRAY_SIZE(VAUX33_VSEL_table);
|
||||
break;
|
||||
case TPS65910_VMMC:
|
||||
ptr = (u16 *)&VMMC_VSEL_table[0];
|
||||
size = ARRAY_SIZE(VMMC_VSEL_table);
|
||||
break;
|
||||
case TPS65910_VAUX1:
|
||||
ptr = (u16 *)&VAUX1_VSEL_table[0];
|
||||
size = ARRAY_SIZE(VAUX1_VSEL_table);
|
||||
break;
|
||||
case TPS65910_VAUX2:
|
||||
ptr = (u16 *)&VAUX2_VSEL_table[0];
|
||||
size = ARRAY_SIZE(VAUX2_VSEL_table);
|
||||
break;
|
||||
case TPS65910_VDAC:
|
||||
ptr = (u16 *)&VDAC_VSEL_table[0];
|
||||
size = ARRAY_SIZE(VDAC_VSEL_table);
|
||||
break;
|
||||
case TPS65910_VPLL:
|
||||
ptr = (u16 *)&VPLL_VSEL_table[0];
|
||||
size = ARRAY_SIZE(VPLL_VSEL_table);
|
||||
break;
|
||||
default:
|
||||
ptr = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (vsel >= size)
|
||||
vsel = size - 1;
|
||||
}
|
||||
|
||||
if (ptr != NULL) {
|
||||
DBG("%s: regulator id=%d index=%d, get volage=%d(mV)\n", __FUNCTION__, ldo_id, index, ptr[vsel]);
|
||||
return ptr[vsel] * 1000;
|
||||
}
|
||||
/* For warning */
|
||||
DBG("%s: regulator id=%d index=%d, get volage error\n", __FUNCTION__, ldo_id, index);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
tps65910_ldo_set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV)
|
||||
{
|
||||
struct tps65910reg_info *info = rdev_get_drvdata(rdev);
|
||||
int vsel;
|
||||
u8 offset;
|
||||
u8 val;
|
||||
u8 index;
|
||||
|
||||
if (info == NULL)
|
||||
return 0;
|
||||
|
||||
DBG("%s: regulator(%s) id=%d, set volage=(min_uV:%d, max_uV:%d)\n", __FUNCTION__, info->desc.name, info->id, min_uV, max_uV);
|
||||
if (rdev->constraints) {
|
||||
if (min_uV < rdev->constraints->min_uV || min_uV > rdev->constraints->max_uV)
|
||||
return -EINVAL;
|
||||
if (max_uV < rdev->constraints->min_uV || max_uV > rdev->constraints->max_uV)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
for (vsel = 0; vsel < info->table_len; vsel++) {
|
||||
|
||||
int mV = info->table[vsel];
|
||||
int uV;
|
||||
|
||||
uV = mV * 1000;
|
||||
|
||||
/* Break at the first in-range value */
|
||||
if (min_uV <= uV && uV <= max_uV) {
|
||||
offset = tps65910reg_find_offset(info->id);
|
||||
val = tps65910reg_read(info, TPS65910_I2C_ID0, offset);
|
||||
if (val < 0) {
|
||||
printk(KERN_ERR"Unable to read TPS65910 Reg at offset = 0x%x\n",
|
||||
offset);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
index = get_voltage_index(info->id, uV);
|
||||
/* For VDD1 and VDD2 */
|
||||
if (info->id == TPS65910_VDD1 || info->id == TPS65910_VDD2) {
|
||||
val = index;
|
||||
return tps65910reg_write(info, TPS65910_I2C_ID0, offset, val);
|
||||
}
|
||||
|
||||
val &= 0xF3;
|
||||
val = (index << 2);
|
||||
val |= 0x01;
|
||||
if (index < 0) {
|
||||
printk(KERN_ERR "Invaild voltage for LDO \n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return tps65910reg_write(info, TPS65910_I2C_ID0, offset, val);
|
||||
}
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int tps65910_ldo_get_voltage(struct regulator_dev *rdev)
|
||||
{
|
||||
struct tps65910reg_info *info = rdev_get_drvdata(rdev);
|
||||
int vsel;
|
||||
u8 offset;
|
||||
|
||||
offset = tps65910reg_find_offset(info->id);
|
||||
vsel = tps65910reg_read(info, TPS65910_I2C_ID0, offset);
|
||||
if (vsel < 0) {
|
||||
printk(KERN_ERR"Unable to read TPS65910 Reg at offset = \
|
||||
0x%x\n", offset);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/* Get the index of voltage value from Reg and map to table */
|
||||
return get_index_voltage(info->id, vsel);
|
||||
}
|
||||
|
||||
|
||||
static struct regulator_ops tps65910_ldo_ops = {
|
||||
.list_voltage = tps65910_ldo_list_voltage,
|
||||
.set_voltage = tps65910_ldo_set_voltage,
|
||||
.get_voltage = tps65910_ldo_get_voltage,
|
||||
.enable = tps65910reg_enable,
|
||||
.disable = tps65910reg_disable,
|
||||
.is_enabled = tps65910reg_is_enabled,
|
||||
.set_mode = tps65910reg_set_mode,
|
||||
.get_status = tps65910reg_get_status,
|
||||
};
|
||||
|
||||
static
|
||||
int tps65910_fixed_list_voltage(struct regulator_dev *rdev, unsigned index)
|
||||
{
|
||||
struct tps65910reg_info *info = rdev_get_drvdata(rdev);
|
||||
|
||||
return info->min_mV * 1000;
|
||||
}
|
||||
|
||||
static int tps65910_fixed_get_voltage(struct regulator_dev *rdev)
|
||||
{
|
||||
struct tps65910reg_info *info = rdev_get_drvdata(rdev);
|
||||
|
||||
return info->min_mV * 1000;
|
||||
}
|
||||
|
||||
static struct regulator_ops tps65910_fixed_ops = {
|
||||
.list_voltage = tps65910_fixed_list_voltage,
|
||||
.get_voltage = tps65910_fixed_get_voltage,
|
||||
.enable = tps65910reg_enable,
|
||||
.disable = tps65910reg_disable,
|
||||
.is_enabled = tps65910reg_is_enabled,
|
||||
.set_mode = tps65910reg_set_mode,
|
||||
.get_status = tps65910reg_get_status,
|
||||
};
|
||||
|
||||
#define TPS65910_ADJUSTABLE_LDO(label, num, min_mVolts, max_mVolts,\
|
||||
turnon_delay) { \
|
||||
.id = num, \
|
||||
.table_len = ARRAY_SIZE(label##_VSEL_table), \
|
||||
.table = label##_VSEL_table, \
|
||||
.min_mV = min_mVolts, \
|
||||
.max_mV = max_mVolts, \
|
||||
.delay = turnon_delay, \
|
||||
.desc = { \
|
||||
.name = #label, \
|
||||
.id = TPS65910_##label, \
|
||||
.n_voltages = ARRAY_SIZE(label##_VSEL_table), \
|
||||
.ops = &tps65910_ldo_ops, \
|
||||
.type = REGULATOR_VOLTAGE, \
|
||||
.owner = THIS_MODULE, \
|
||||
}, \
|
||||
}
|
||||
|
||||
#define TPS65910_FIXED_LDO(label, num, mVolts, turnon_delay) { \
|
||||
.id = num, \
|
||||
.min_mV = mVolts, \
|
||||
.delay = turnon_delay, \
|
||||
.desc = { \
|
||||
.name = #label, \
|
||||
.id = TPS65910_##label, \
|
||||
.n_voltages = 1, \
|
||||
.ops = &tps65910_fixed_ops, \
|
||||
.type = REGULATOR_VOLTAGE, \
|
||||
.owner = THIS_MODULE, \
|
||||
}, \
|
||||
}
|
||||
|
||||
/*
|
||||
* We list regulators here if systems need some level of
|
||||
* software control over them after boot.
|
||||
*/
|
||||
static struct tps65910reg_info tps65910_regs[] = {
|
||||
|
||||
TPS65910_ADJUSTABLE_LDO(VDD1, TPS65910_VDD1, 950, 1400, 4),
|
||||
TPS65910_FIXED_LDO(VDD2, TPS65910_VDD2, 1500, 4),
|
||||
TPS65910_FIXED_LDO(VIO, TPS65910_VIO, 3300, 1),
|
||||
|
||||
TPS65910_FIXED_LDO(VDD3, TPS65910_VDD3, 5000, 0),
|
||||
|
||||
TPS65910_FIXED_LDO(VDIG1, TPS65910_VDIG1, 2700, 7),
|
||||
TPS65910_FIXED_LDO(VDIG2, TPS65910_VDIG2, 1200, 2),
|
||||
TPS65910_FIXED_LDO(VAUX33, TPS65910_VAUX33, 3300, 2),
|
||||
TPS65910_FIXED_LDO(VMMC, TPS65910_VMMC, 3000, 7),
|
||||
TPS65910_FIXED_LDO(VAUX1, TPS65910_VAUX1, 2800, 7),
|
||||
TPS65910_FIXED_LDO(VAUX2, TPS65910_VAUX2, 2900, 6),
|
||||
TPS65910_FIXED_LDO(VDAC, TPS65910_VDAC, 1800, 6),
|
||||
TPS65910_FIXED_LDO(VPLL, TPS65910_VPLL, 2500, 2),
|
||||
};
|
||||
|
||||
static int tps65910_regulator_probe(struct platform_device *pdev)
|
||||
{
|
||||
int i;
|
||||
struct tps65910reg_info *info;
|
||||
struct regulator_init_data *initdata;
|
||||
struct regulation_constraints *c;
|
||||
struct regulator_dev *rdev;
|
||||
|
||||
for (i = 0, info = NULL; i < ARRAY_SIZE(tps65910_regs); i++) {
|
||||
if (tps65910_regs[i].desc.id != pdev->id)
|
||||
continue;
|
||||
info = tps65910_regs + i;
|
||||
break;
|
||||
}
|
||||
if (!info)
|
||||
return -ENODEV;
|
||||
|
||||
DBG("%s: reguloter(%s) id=%d\n", __FUNCTION__, info->desc.name, info->id);
|
||||
|
||||
initdata = pdev->dev.platform_data;
|
||||
if (!initdata)
|
||||
return -EINVAL;
|
||||
|
||||
/* Constrain board-specific capabilities according to what
|
||||
* this driver and the chip itself can actually do.
|
||||
*/
|
||||
c = &initdata->constraints;
|
||||
c->valid_modes_mask &= REGULATOR_MODE_NORMAL | REGULATOR_MODE_STANDBY;
|
||||
c->valid_ops_mask &= REGULATOR_CHANGE_VOLTAGE
|
||||
| REGULATOR_CHANGE_MODE
|
||||
| REGULATOR_CHANGE_STATUS;
|
||||
|
||||
switch (pdev->id) {
|
||||
case TPS65910_REG_VIO:
|
||||
case TPS65910_REG_VDD1:
|
||||
case TPS65910_REG_VDD2:
|
||||
case TPS65910_REG_VDIG2:
|
||||
case TPS65910_REG_VPLL:
|
||||
c->always_on = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
rdev = regulator_register(&info->desc, &pdev->dev, initdata, info);
|
||||
|
||||
if (IS_ERR(rdev)) {
|
||||
dev_err(&pdev->dev, "can't register %s, %ld\n",
|
||||
info->desc.name, PTR_ERR(rdev));
|
||||
return PTR_ERR(rdev);
|
||||
}
|
||||
// cwz add for init status, for regulator disable
|
||||
rdev->use_count = 1;
|
||||
|
||||
platform_set_drvdata(pdev, rdev);
|
||||
|
||||
DBG("%s: reguloter register OK.\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __devexit tps65910_regulator_remove(struct platform_device *pdev)
|
||||
{
|
||||
regulator_unregister(platform_get_drvdata(pdev));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
MODULE_ALIAS("platform:tps65910_regulator");
|
||||
static struct platform_driver tps65910_regulator_driver = {
|
||||
.probe = tps65910_regulator_probe,
|
||||
.remove = tps65910_regulator_remove,
|
||||
.driver.name = "tps65910_regulator",
|
||||
.driver.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __init tps65910_regulator_init(void)
|
||||
{
|
||||
return platform_driver_register(&tps65910_regulator_driver);
|
||||
}
|
||||
rootfs_initcall(tps65910_regulator_init);
|
||||
|
||||
static void __exit tps65910_regulator_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&tps65910_regulator_driver);
|
||||
}
|
||||
module_exit(tps65910_regulator_exit)
|
||||
|
||||
MODULE_AUTHOR("cwz <cwz@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("TPS65910 voltage regulator driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
@ -27,18 +27,6 @@
|
|||
#include <linux/mfd/wm831x/regulator.h>
|
||||
#include <linux/mfd/wm831x/pdata.h>
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/time.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/string.h>
|
||||
|
||||
//#include "../../arch/arm/mach-rk29/include/mach/gpio.h"
|
||||
|
||||
//#include <linux/hrtimer.h>
|
||||
|
||||
|
||||
|
||||
|
||||
#define WM831X_BUCKV_MAX_SELECTOR 0x68
|
||||
#define WM831X_BUCKP_MAX_SELECTOR 0x66
|
||||
|
||||
|
|
@ -47,7 +35,7 @@
|
|||
#define WM831X_DCDC_MODE_IDLE 2
|
||||
#define WM831X_DCDC_MODE_STANDBY 3
|
||||
|
||||
//#define WM831X_DCDC_MAX_NAME 6
|
||||
#define WM831X_DCDC_MAX_NAME 6
|
||||
|
||||
/* Register offsets in control block */
|
||||
#define WM831X_DCDC_CONTROL_1 0
|
||||
|
|
@ -59,7 +47,7 @@
|
|||
/*
|
||||
* Shared
|
||||
*/
|
||||
#if 0
|
||||
|
||||
struct wm831x_dcdc {
|
||||
char name[WM831X_DCDC_MAX_NAME];
|
||||
struct regulator_desc desc;
|
||||
|
|
@ -71,7 +59,6 @@ struct wm831x_dcdc {
|
|||
int on_vsel;
|
||||
int dvs_vsel;
|
||||
};
|
||||
#endif
|
||||
|
||||
static int wm831x_dcdc_is_enabled(struct regulator_dev *rdev)
|
||||
{
|
||||
|
|
@ -313,28 +300,7 @@ static int wm831x_buckv_set_dvs(struct regulator_dev *rdev, int state)
|
|||
|
||||
return 0;
|
||||
}
|
||||
//wm831x_buckv_get_voltage
|
||||
|
||||
int wm831x_reg_read(struct wm831x *wm831x, unsigned short reg);
|
||||
static int wm831x_buckv_read_voltage(struct regulator_dev *rdev)
|
||||
{
|
||||
int vol_read;
|
||||
int ret;
|
||||
struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
|
||||
struct wm831x *wm831x = dcdc->wm831x;
|
||||
int on_reg = dcdc->base + WM831X_DCDC_ON_CONFIG;
|
||||
|
||||
ret = wm831x_reg_read(wm831x, on_reg);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret &= WM831X_DC1_ON_VSEL_MASK;
|
||||
vol_read = (ret-8)*12500 + 600000;
|
||||
|
||||
return vol_read;
|
||||
|
||||
|
||||
|
||||
}
|
||||
static int wm831x_buckv_set_voltage(struct regulator_dev *rdev,
|
||||
int min_uV, int max_uV)
|
||||
{
|
||||
|
|
@ -424,78 +390,6 @@ static u16 wm831x_dcdc_ilim[] = {
|
|||
125, 250, 375, 500, 625, 750, 875, 1000
|
||||
};
|
||||
|
||||
static int wm831x_buckv_set_voltage_step(struct regulator_dev * rdev, int min_uV, int max_uV)
|
||||
{
|
||||
int old_vol;
|
||||
int new_min_uV,new_max_uV;
|
||||
int diff_value,step;
|
||||
int ret=0;
|
||||
|
||||
struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
|
||||
struct wm831x *wm831x = dcdc->wm831x;
|
||||
struct wm831x_pdata *pdata = wm831x->dev->platform_data;
|
||||
|
||||
|
||||
//if(strcmp(rdev->constraints->name,"DCDC2") != 0)
|
||||
if(strcmp(pdata->dcdc[1]->consumer_supplies[1].supply,"vcore") != 0)
|
||||
{
|
||||
|
||||
ret = wm831x_buckv_set_voltage(rdev,min_uV,max_uV);
|
||||
}
|
||||
else
|
||||
{
|
||||
old_vol = wm831x_buckv_read_voltage(rdev);
|
||||
|
||||
new_min_uV = old_vol;
|
||||
new_max_uV = old_vol+max_uV-min_uV;
|
||||
|
||||
if(old_vol > min_uV) //reduce voltage
|
||||
{
|
||||
diff_value = (old_vol - min_uV);
|
||||
|
||||
for(step = 100000; step<=diff_value; step += 100000)
|
||||
{
|
||||
new_min_uV = old_vol-step;
|
||||
new_max_uV = old_vol+max_uV-min_uV-step;
|
||||
|
||||
ret = wm831x_buckv_set_voltage(rdev,new_min_uV,new_max_uV);
|
||||
usleep_range(1000,1000);
|
||||
}
|
||||
|
||||
if(new_min_uV > min_uV) //0< old_vol - min_uV < 100000 ||0< new_min_uV - min_uV < 1000000
|
||||
{
|
||||
|
||||
ret = wm831x_buckv_set_voltage(rdev,min_uV,max_uV);
|
||||
usleep_range(1000,1000);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else //rise voltage
|
||||
{
|
||||
diff_value = (min_uV- old_vol);
|
||||
|
||||
for(step = 100000; step<=diff_value; step += 100000)
|
||||
{
|
||||
new_min_uV = old_vol + step;
|
||||
new_max_uV = old_vol+max_uV-min_uV+step;
|
||||
|
||||
ret = wm831x_buckv_set_voltage(rdev,new_min_uV,new_max_uV);
|
||||
usleep_range(1000,1000);
|
||||
}
|
||||
if(new_min_uV < min_uV)// min_uV - old_vol < 100000 || new_min_uV - old_vol < 100000
|
||||
{
|
||||
ret = wm831x_buckv_set_voltage(rdev,min_uV,max_uV);
|
||||
usleep_range(1000,1000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
static int wm831x_buckv_set_current_limit(struct regulator_dev *rdev,
|
||||
int min_uA, int max_uA)
|
||||
{
|
||||
|
|
@ -528,19 +422,8 @@ static int wm831x_buckv_get_current_limit(struct regulator_dev *rdev)
|
|||
return wm831x_dcdc_ilim[val & WM831X_DC1_HC_THR_MASK];
|
||||
}
|
||||
|
||||
int wm831x_dcdc_set_suspend_enable(struct regulator_dev *rdev)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
int wm831x_dcdc_set_suspend_disable(struct regulator_dev *rdev)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct regulator_ops wm831x_buckv_ops = {
|
||||
.set_voltage = wm831x_buckv_set_voltage_step,
|
||||
.set_voltage = wm831x_buckv_set_voltage,
|
||||
.get_voltage = wm831x_buckv_get_voltage,
|
||||
.list_voltage = wm831x_buckv_list_voltage,
|
||||
.set_suspend_voltage = wm831x_buckv_set_suspend_voltage,
|
||||
|
|
@ -554,8 +437,6 @@ static struct regulator_ops wm831x_buckv_ops = {
|
|||
.get_mode = wm831x_dcdc_get_mode,
|
||||
.set_mode = wm831x_dcdc_set_mode,
|
||||
.set_suspend_mode = wm831x_dcdc_set_suspend_mode,
|
||||
.set_suspend_enable = wm831x_dcdc_set_suspend_enable,
|
||||
.set_suspend_disable = wm831x_dcdc_set_suspend_disable,
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -624,7 +505,7 @@ static __devinit int wm831x_buckv_probe(struct platform_device *pdev)
|
|||
struct wm831x_dcdc *dcdc;
|
||||
struct resource *res;
|
||||
int ret, irq;
|
||||
|
||||
|
||||
dev_dbg(&pdev->dev, "Probing DCDC%d\n", id + 1);
|
||||
|
||||
if (pdata == NULL || pdata->dcdc[id] == NULL)
|
||||
|
|
@ -817,8 +698,6 @@ static struct regulator_ops wm831x_buckp_ops = {
|
|||
.get_mode = wm831x_dcdc_get_mode,
|
||||
.set_mode = wm831x_dcdc_set_mode,
|
||||
.set_suspend_mode = wm831x_dcdc_set_suspend_mode,
|
||||
.set_suspend_enable = wm831x_dcdc_set_suspend_enable,
|
||||
.set_suspend_disable = wm831x_dcdc_set_suspend_disable,
|
||||
};
|
||||
|
||||
static __devinit int wm831x_buckp_probe(struct platform_device *pdev)
|
||||
|
|
@ -1130,7 +1009,6 @@ static struct platform_driver wm831x_epe_driver = {
|
|||
static int __init wm831x_dcdc_init(void)
|
||||
{
|
||||
int ret;
|
||||
printk("%s \n", __FUNCTION__);
|
||||
ret = platform_driver_register(&wm831x_buckv_driver);
|
||||
if (ret != 0)
|
||||
pr_err("Failed to register WM831x BUCKV driver: %d\n", ret);
|
||||
|
|
@ -1146,7 +1024,7 @@ static int __init wm831x_dcdc_init(void)
|
|||
ret = platform_driver_register(&wm831x_epe_driver);
|
||||
if (ret != 0)
|
||||
pr_err("Failed to register WM831x EPE driver: %d\n", ret);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
subsys_initcall(wm831x_dcdc_init);
|
||||
|
|
|
|||
|
|
@ -25,9 +25,8 @@
|
|||
#include <linux/mfd/wm831x/regulator.h>
|
||||
#include <linux/mfd/wm831x/pdata.h>
|
||||
|
||||
//#define WM831X_ISINK_MAX_NAME 7
|
||||
#define WM831X_ISINK_MAX_NAME 7
|
||||
|
||||
#if 0
|
||||
struct wm831x_isink {
|
||||
char name[WM831X_ISINK_MAX_NAME];
|
||||
struct regulator_desc desc;
|
||||
|
|
@ -35,14 +34,13 @@ struct wm831x_isink {
|
|||
struct wm831x *wm831x;
|
||||
struct regulator_dev *regulator;
|
||||
};
|
||||
#endif
|
||||
|
||||
static int wm831x_isink_enable(struct regulator_dev *rdev)
|
||||
{
|
||||
struct wm831x_isink *isink = rdev_get_drvdata(rdev);
|
||||
struct wm831x *wm831x = isink->wm831x;
|
||||
int ret;
|
||||
printk("%s:line=%d\n",__FUNCTION__,__LINE__);
|
||||
|
||||
/* We have a two stage enable: first start the ISINK... */
|
||||
ret = wm831x_set_bits(wm831x, isink->reg, WM831X_CS1_ENA,
|
||||
WM831X_CS1_ENA);
|
||||
|
|
@ -54,7 +52,7 @@ static int wm831x_isink_enable(struct regulator_dev *rdev)
|
|||
WM831X_CS1_DRIVE);
|
||||
if (ret != 0)
|
||||
wm831x_set_bits(wm831x, isink->reg, WM831X_CS1_ENA, 0);
|
||||
printk("%s:line=%d,ret=0x%x\n",__FUNCTION__,__LINE__,ret);
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
|
@ -64,7 +62,7 @@ static int wm831x_isink_disable(struct regulator_dev *rdev)
|
|||
struct wm831x_isink *isink = rdev_get_drvdata(rdev);
|
||||
struct wm831x *wm831x = isink->wm831x;
|
||||
int ret;
|
||||
printk("%s:line=%d\n",__FUNCTION__,__LINE__);
|
||||
|
||||
ret = wm831x_set_bits(wm831x, isink->reg, WM831X_CS1_DRIVE, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
|
@ -82,11 +80,11 @@ static int wm831x_isink_is_enabled(struct regulator_dev *rdev)
|
|||
struct wm831x_isink *isink = rdev_get_drvdata(rdev);
|
||||
struct wm831x *wm831x = isink->wm831x;
|
||||
int ret;
|
||||
printk("%s:line=%d\n",__FUNCTION__,__LINE__);
|
||||
|
||||
ret = wm831x_reg_read(wm831x, isink->reg);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
||||
if ((ret & (WM831X_CS1_ENA | WM831X_CS1_DRIVE)) ==
|
||||
(WM831X_CS1_ENA | WM831X_CS1_DRIVE))
|
||||
return 1;
|
||||
|
|
@ -160,7 +158,7 @@ static __devinit int wm831x_isink_probe(struct platform_device *pdev)
|
|||
int ret, irq;
|
||||
|
||||
dev_dbg(&pdev->dev, "Probing ISINK%d\n", id + 1);
|
||||
printk("%s:line=%d\n",__FUNCTION__,__LINE__);
|
||||
|
||||
if (pdata == NULL || pdata->isink[id] == NULL)
|
||||
return -ENODEV;
|
||||
|
||||
|
|
@ -200,7 +198,6 @@ static __devinit int wm831x_isink_probe(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
irq = platform_get_irq(pdev, 0);
|
||||
printk("%s:line=%d,irq=%d\n",__FUNCTION__,__LINE__,irq);
|
||||
ret = wm831x_request_irq(wm831x, irq, wm831x_isink_irq,
|
||||
IRQF_TRIGGER_RISING, isink->name,
|
||||
isink);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include <linux/mfd/wm831x/regulator.h>
|
||||
#include <linux/mfd/wm831x/pdata.h>
|
||||
|
||||
//#define WM831X_LDO_MAX_NAME 6
|
||||
#define WM831X_LDO_MAX_NAME 6
|
||||
|
||||
#define WM831X_LDO_CONTROL 0
|
||||
#define WM831X_LDO_ON_CONTROL 1
|
||||
|
|
@ -34,7 +34,6 @@
|
|||
#define WM831X_ALIVE_LDO_ON_CONTROL 0
|
||||
#define WM831X_ALIVE_LDO_SLEEP_CONTROL 1
|
||||
|
||||
#if 0
|
||||
struct wm831x_ldo {
|
||||
char name[WM831X_LDO_MAX_NAME];
|
||||
struct regulator_desc desc;
|
||||
|
|
@ -42,12 +41,11 @@ struct wm831x_ldo {
|
|||
struct wm831x *wm831x;
|
||||
struct regulator_dev *regulator;
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Shared
|
||||
*/
|
||||
extern int reboot_cmd_get(void);
|
||||
|
||||
static int wm831x_ldo_is_enabled(struct regulator_dev *rdev)
|
||||
{
|
||||
struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
|
||||
|
|
@ -70,7 +68,7 @@ static int wm831x_ldo_enable(struct regulator_dev *rdev)
|
|||
struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
|
||||
struct wm831x *wm831x = ldo->wm831x;
|
||||
int mask = 1 << rdev_get_id(rdev);
|
||||
//printk("%s,%x\n", __FUNCTION__,mask);
|
||||
|
||||
return wm831x_set_bits(wm831x, WM831X_LDO_ENABLE, mask, mask);
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +77,7 @@ static int wm831x_ldo_disable(struct regulator_dev *rdev)
|
|||
struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
|
||||
struct wm831x *wm831x = ldo->wm831x;
|
||||
int mask = 1 << rdev_get_id(rdev);
|
||||
//printk("%s\n", __FUNCTION__);
|
||||
|
||||
return wm831x_set_bits(wm831x, WM831X_LDO_ENABLE, mask, 0);
|
||||
}
|
||||
|
||||
|
|
@ -143,7 +141,7 @@ static int wm831x_gp_ldo_set_voltage(struct regulator_dev *rdev,
|
|||
{
|
||||
struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
|
||||
int reg = ldo->base + WM831X_LDO_ON_CONTROL;
|
||||
//printk("%s base=%x,%d,%d\n", __FUNCTION__,ldo->base,min_uV,max_uV);
|
||||
|
||||
return wm831x_gp_ldo_set_voltage_int(rdev, reg, min_uV, max_uV);
|
||||
}
|
||||
|
||||
|
|
@ -166,7 +164,7 @@ static int wm831x_gp_ldo_get_voltage(struct regulator_dev *rdev)
|
|||
ret = wm831x_reg_read(wm831x, reg);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
//printk("%s base=%x,ret=%x\n", __FUNCTION__,ldo->base,ret);
|
||||
|
||||
ret &= WM831X_LDO1_ON_VSEL_MASK;
|
||||
|
||||
return wm831x_gp_ldo_list_voltage(rdev, ret);
|
||||
|
|
@ -206,7 +204,7 @@ static int wm831x_gp_ldo_set_mode(struct regulator_dev *rdev,
|
|||
int on_reg = ldo->base + WM831X_LDO_ON_CONTROL;
|
||||
int ret;
|
||||
|
||||
printk("%s base=%x,mode=%x\n", __FUNCTION__,ldo->base,mode);
|
||||
|
||||
switch (mode) {
|
||||
case REGULATOR_MODE_NORMAL:
|
||||
ret = wm831x_set_bits(wm831x, on_reg,
|
||||
|
|
@ -286,16 +284,6 @@ static unsigned int wm831x_gp_ldo_get_optimum_mode(struct regulator_dev *rdev,
|
|||
return REGULATOR_MODE_NORMAL;
|
||||
}
|
||||
|
||||
int wm831x_ldo_set_suspend_enable(struct regulator_dev *rdev)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
int wm831x_ldo_set_suspend_disable(struct regulator_dev *rdev)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct regulator_ops wm831x_gp_ldo_ops = {
|
||||
.list_voltage = wm831x_gp_ldo_list_voltage,
|
||||
|
|
@ -310,8 +298,6 @@ static struct regulator_ops wm831x_gp_ldo_ops = {
|
|||
.is_enabled = wm831x_ldo_is_enabled,
|
||||
.enable = wm831x_ldo_enable,
|
||||
.disable = wm831x_ldo_disable,
|
||||
.set_suspend_enable = wm831x_ldo_set_suspend_enable,
|
||||
.set_suspend_disable = wm831x_ldo_set_suspend_disable,
|
||||
};
|
||||
|
||||
static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev)
|
||||
|
|
@ -324,7 +310,7 @@ static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev)
|
|||
int ret, irq;
|
||||
|
||||
dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1);
|
||||
printk("Probing LDO%d\n", id + 1);
|
||||
|
||||
if (pdata == NULL || pdata->ldo[id] == NULL)
|
||||
return -ENODEV;
|
||||
|
||||
|
|
@ -455,7 +441,7 @@ static int wm831x_aldo_set_voltage(struct regulator_dev *rdev,
|
|||
{
|
||||
struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
|
||||
int reg = ldo->base + WM831X_LDO_ON_CONTROL;
|
||||
printk("%s base=%x,min_uV=%d,%d\n", __FUNCTION__,ldo->base,min_uV,max_uV);
|
||||
|
||||
return wm831x_aldo_set_voltage_int(rdev, reg, min_uV, max_uV);
|
||||
}
|
||||
|
||||
|
|
@ -474,13 +460,13 @@ static int wm831x_aldo_get_voltage(struct regulator_dev *rdev)
|
|||
struct wm831x *wm831x = ldo->wm831x;
|
||||
int reg = ldo->base + WM831X_LDO_ON_CONTROL;
|
||||
int ret;
|
||||
|
||||
|
||||
ret = wm831x_reg_read(wm831x, reg);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
printk("%s base=%x,ret=%x\n", __FUNCTION__,ldo->base,ret);
|
||||
|
||||
ret &= WM831X_LDO7_ON_VSEL_MASK;
|
||||
|
||||
|
||||
return wm831x_aldo_list_voltage(rdev, ret);
|
||||
}
|
||||
|
||||
|
|
@ -572,8 +558,6 @@ static struct regulator_ops wm831x_aldo_ops = {
|
|||
.is_enabled = wm831x_ldo_is_enabled,
|
||||
.enable = wm831x_ldo_enable,
|
||||
.disable = wm831x_ldo_disable,
|
||||
.set_suspend_enable = wm831x_ldo_set_suspend_enable,
|
||||
.set_suspend_disable = wm831x_ldo_set_suspend_disable,
|
||||
};
|
||||
|
||||
static __devinit int wm831x_aldo_probe(struct platform_device *pdev)
|
||||
|
|
@ -586,7 +570,7 @@ static __devinit int wm831x_aldo_probe(struct platform_device *pdev)
|
|||
int ret, irq;
|
||||
|
||||
dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1);
|
||||
printk("Probing LDO%d--\n", id + 1);
|
||||
|
||||
if (pdata == NULL || pdata->ldo[id] == NULL)
|
||||
return -ENODEV;
|
||||
|
||||
|
|
@ -760,8 +744,6 @@ static struct regulator_ops wm831x_alive_ldo_ops = {
|
|||
.is_enabled = wm831x_ldo_is_enabled,
|
||||
.enable = wm831x_ldo_enable,
|
||||
.disable = wm831x_ldo_disable,
|
||||
.set_suspend_enable = wm831x_ldo_set_suspend_enable,
|
||||
.set_suspend_disable = wm831x_ldo_set_suspend_disable,
|
||||
};
|
||||
|
||||
static __devinit int wm831x_alive_ldo_probe(struct platform_device *pdev)
|
||||
|
|
@ -774,7 +756,7 @@ static __devinit int wm831x_alive_ldo_probe(struct platform_device *pdev)
|
|||
int ret;
|
||||
|
||||
dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1);
|
||||
printk("wm831x_alive_ldo_probe Probing LDO%d\n", id + 1);
|
||||
|
||||
if (pdata == NULL || pdata->ldo[id] == NULL)
|
||||
return -ENODEV;
|
||||
|
||||
|
|
@ -830,64 +812,9 @@ static __devexit int wm831x_alive_ldo_remove(struct platform_device *pdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static __devexit int wm831x_alive_ldo_shutdown(struct platform_device *pdev) /*ZMF*/
|
||||
{
|
||||
//struct wm831x_ldo *ldo = platform_get_drvdata(pdev);
|
||||
#if 0
|
||||
//close ldo in wm831x_last_deinit()
|
||||
struct regulator* ldo;
|
||||
|
||||
//if (reboot_cmd_get())
|
||||
// return 0;
|
||||
printk("%s\n", __FUNCTION__);
|
||||
|
||||
ldo = regulator_get(NULL, "ldo1");
|
||||
regulator_disable(ldo);
|
||||
regulator_put(ldo);
|
||||
|
||||
ldo = regulator_get(NULL, "ldo2");
|
||||
regulator_disable(ldo);
|
||||
regulator_put(ldo);
|
||||
|
||||
ldo = regulator_get(NULL, "ldo3");
|
||||
regulator_disable(ldo);
|
||||
regulator_put(ldo);
|
||||
|
||||
ldo = regulator_get(NULL, "ldo4");
|
||||
//regulator_disable(ldo);
|
||||
regulator_put(ldo);
|
||||
|
||||
ldo = regulator_get(NULL, "ldo5");
|
||||
regulator_disable(ldo);
|
||||
regulator_put(ldo);
|
||||
|
||||
ldo = regulator_get(NULL, "ldo6");
|
||||
regulator_disable(ldo);
|
||||
regulator_put(ldo);
|
||||
|
||||
ldo = regulator_get(NULL, "ldo7");
|
||||
regulator_disable(ldo);
|
||||
regulator_put(ldo);
|
||||
|
||||
ldo = regulator_get(NULL, "ldo8");
|
||||
//regulator_disable(ldo);
|
||||
regulator_put(ldo);
|
||||
|
||||
ldo = regulator_get(NULL, "ldo9");
|
||||
regulator_disable(ldo);
|
||||
regulator_put(ldo);
|
||||
|
||||
ldo = regulator_get(NULL, "ldo10");
|
||||
regulator_disable(ldo);
|
||||
regulator_put(ldo);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver wm831x_alive_ldo_driver = {
|
||||
.probe = wm831x_alive_ldo_probe,
|
||||
.remove = __devexit_p(wm831x_alive_ldo_remove),
|
||||
.shutdown = __devexit_p(wm831x_alive_ldo_shutdown),
|
||||
.driver = {
|
||||
.name = "wm831x-alive-ldo",
|
||||
.owner = THIS_MODULE,
|
||||
|
|
@ -897,7 +824,7 @@ static struct platform_driver wm831x_alive_ldo_driver = {
|
|||
static int __init wm831x_ldo_init(void)
|
||||
{
|
||||
int ret;
|
||||
printk("%s \n", __FUNCTION__);
|
||||
|
||||
ret = platform_driver_register(&wm831x_gp_ldo_driver);
|
||||
if (ret != 0)
|
||||
pr_err("Failed to register WM831x GP LDO driver: %d\n", ret);
|
||||
|
|
@ -910,7 +837,8 @@ static int __init wm831x_ldo_init(void)
|
|||
if (ret != 0)
|
||||
pr_err("Failed to register WM831x alive LDO driver: %d\n",
|
||||
ret);
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
subsys_initcall(wm831x_ldo_init);
|
||||
|
||||
|
|
|
|||
|
|
@ -153,21 +153,6 @@ comment "I2C RTC drivers"
|
|||
|
||||
if I2C
|
||||
|
||||
config RTC_HYM8563
|
||||
tristate "RK2818 or RK29 extern HYM8563 RTC"
|
||||
depends on I2C_RK2818 || I2C_RK29
|
||||
help
|
||||
If you say yes here you will get support for the
|
||||
HYM8563 I2C RTC chip.
|
||||
This driver can also be built as a module. If so, the module
|
||||
will be called rtc-HYM8563.
|
||||
|
||||
config RTC_M41T66
|
||||
tristate "ST M41T66"
|
||||
depends on I2C_RK2818 || I2C_RK29
|
||||
help
|
||||
If you say Y here you will get support for the ST M41T66.
|
||||
|
||||
config RTC_DRV_DS1307
|
||||
tristate "Dallas/Maxim DS1307/37/38/39/40, ST M41T00, EPSON RX-8025"
|
||||
help
|
||||
|
|
@ -352,13 +337,6 @@ config RTC_DRV_TWL4030
|
|||
This driver can also be built as a module. If so, the module
|
||||
will be called rtc-twl.
|
||||
|
||||
config RTC_DRV_TPS65910
|
||||
boolean "TI TPS65910"
|
||||
depends on RTC_CLASS && TPS65910_CORE
|
||||
help
|
||||
If you say yes here you get support for the RTC on the
|
||||
TPS65910 family chips, used mostly with OMAP3/AM35xx platforms.
|
||||
|
||||
config RTC_DRV_S35390A
|
||||
tristate "Seiko Instruments S-35390A"
|
||||
select BITREVERSE
|
||||
|
|
@ -369,16 +347,6 @@ config RTC_DRV_S35390A
|
|||
This driver can also be built as a module. If so the module
|
||||
will be called rtc-s35390a.
|
||||
|
||||
config RTC_DRV_S35392A
|
||||
tristate "Seiko Instruments S-35392A"
|
||||
select BITREVERSE
|
||||
help
|
||||
If you say yes here you will get support for the Seiko
|
||||
Instruments S-35392A.
|
||||
|
||||
This driver can also be built as a module. If so the module
|
||||
will be called rtc-s35392a.
|
||||
|
||||
config RTC_DRV_FM3130
|
||||
tristate "Ramtron FM3130"
|
||||
help
|
||||
|
|
|
|||
|
|
@ -85,7 +85,6 @@ obj-$(CONFIG_RTC_DRV_RS5C372) += rtc-rs5c372.o
|
|||
obj-$(CONFIG_RTC_DRV_RX8025) += rtc-rx8025.o
|
||||
obj-$(CONFIG_RTC_DRV_RX8581) += rtc-rx8581.o
|
||||
obj-$(CONFIG_RTC_DRV_S35390A) += rtc-s35390a.o
|
||||
obj-$(CONFIG_RTC_DRV_S35392A) += rtc-s35392a.o
|
||||
obj-$(CONFIG_RTC_DRV_S3C) += rtc-s3c.o
|
||||
obj-$(CONFIG_RTC_DRV_SA1100) += rtc-sa1100.o
|
||||
obj-$(CONFIG_RTC_DRV_SH) += rtc-sh.o
|
||||
|
|
@ -95,7 +94,6 @@ obj-$(CONFIG_RTC_DRV_STMP) += rtc-stmp3xxx.o
|
|||
obj-$(CONFIG_RTC_DRV_SUN4V) += rtc-sun4v.o
|
||||
obj-$(CONFIG_RTC_DRV_TEST) += rtc-test.o
|
||||
obj-$(CONFIG_RTC_DRV_TPS6586X) += rtc-tps6586x.o
|
||||
obj-$(CONFIG_RTC_DRV_TPS65910) += rtc-tps65910.o
|
||||
obj-$(CONFIG_RTC_DRV_TWL4030) += rtc-twl.o
|
||||
obj-$(CONFIG_RTC_DRV_TX4939) += rtc-tx4939.o
|
||||
obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o
|
||||
|
|
@ -103,6 +101,4 @@ obj-$(CONFIG_RTC_DRV_VR41XX) += rtc-vr41xx.o
|
|||
obj-$(CONFIG_RTC_DRV_WM831X) += rtc-wm831x.o
|
||||
obj-$(CONFIG_RTC_DRV_WM8350) += rtc-wm8350.o
|
||||
obj-$(CONFIG_RTC_DRV_X1205) += rtc-x1205.o
|
||||
obj-$(CONFIG_RTC_HYM8563) += rtc-HYM8563.o
|
||||
obj-$(CONFIG_RTC_M41T66) += rtc-m41t66.o
|
||||
obj-$(CONFIG_RTC_DRV_CPCAP) += rtc-cpcap.o
|
||||
|
|
|
|||
|
|
@ -423,7 +423,6 @@ static int alarm_suspend(struct platform_device *pdev, pm_message_t state)
|
|||
if (rtc_current_time + 1 >= rtc_alarm_time) {
|
||||
pr_alarm(SUSPEND, "alarm about to go off\n");
|
||||
memset(&rtc_alarm, 0, sizeof(rtc_alarm));
|
||||
rtc_time_to_tm(0, &rtc_alarm.time);
|
||||
rtc_alarm.enabled = 0;
|
||||
rtc_set_alarm(alarm_rtc_dev, &rtc_alarm);
|
||||
|
||||
|
|
@ -449,7 +448,6 @@ static int alarm_resume(struct platform_device *pdev)
|
|||
pr_alarm(SUSPEND, "alarm_resume(%p)\n", pdev);
|
||||
|
||||
memset(&alarm, 0, sizeof(alarm));
|
||||
rtc_time_to_tm(0, &alarm.time);
|
||||
alarm.enabled = 0;
|
||||
rtc_set_alarm(alarm_rtc_dev, &alarm);
|
||||
|
||||
|
|
@ -463,18 +461,6 @@ static int alarm_resume(struct platform_device *pdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void alarm_shutdown(struct platform_device *pdev)
|
||||
{
|
||||
struct rtc_wkalrm alarm;
|
||||
|
||||
pr_alarm(FLOW, "alarm_shutdown(%p)\n", pdev);
|
||||
|
||||
memset(&alarm, 0, sizeof(alarm));
|
||||
rtc_time_to_tm(0, &alarm.time);
|
||||
alarm.enabled = 0;
|
||||
rtc_set_alarm(alarm_rtc_dev, &alarm);
|
||||
}
|
||||
|
||||
static struct rtc_task alarm_rtc_task = {
|
||||
.func = alarm_triggered_func
|
||||
};
|
||||
|
|
@ -534,7 +520,6 @@ static struct class_interface rtc_alarm_interface = {
|
|||
static struct platform_driver alarm_driver = {
|
||||
.suspend = alarm_suspend,
|
||||
.resume = alarm_resume,
|
||||
.shutdown = alarm_shutdown,
|
||||
.driver = {
|
||||
.name = "alarm"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1554,68 +1554,6 @@ config SERIAL_BCM63XX_CONSOLE
|
|||
If you have enabled the serial port on the bcm63xx CPU
|
||||
you can make it the console by answering Y to this option.
|
||||
|
||||
config SERIAL_RK29
|
||||
bool "RockChip rk29 serial port support"
|
||||
depends on ARM && ARCH_RK29
|
||||
select SERIAL_CORE
|
||||
|
||||
config SERIAL_RK29_STANDARD
|
||||
bool "Use RockChip rk29 serial port support standard"
|
||||
default y
|
||||
depends on SERIAL_RK29
|
||||
|
||||
config UART0_RK29
|
||||
bool "RockChip rk29 serial port 0 support"
|
||||
depends on SERIAL_RK29
|
||||
|
||||
config UART0_CTS_RTS_RK29
|
||||
bool "RockChip rk29 serial port 0 cts rts support"
|
||||
depends on UART0_RK29
|
||||
|
||||
config UART0_DMA_RK29
|
||||
bool "RockChip rk29 serial port 0 dma support (EXPERIMENTAL)"
|
||||
depends on UART0_RK29 && SERIAL_RK29_STANDARD
|
||||
|
||||
config UART1_RK29
|
||||
bool "RockChip rk29 serial port 1 support"
|
||||
depends on SERIAL_RK29
|
||||
|
||||
config UART2_RK29
|
||||
bool "RockChip rk29 serial port 2 support"
|
||||
depends on SERIAL_RK29
|
||||
|
||||
config UART2_CTS_RTS_RK29
|
||||
bool "RockChip rk29 serial port 2 cts rts support"
|
||||
depends on UART2_RK29
|
||||
|
||||
config UART2_DMA_RK29
|
||||
bool "RockChip rk29 serial port 2 dma support (EXPERIMENTAL)"
|
||||
depends on UART2_RK29 && SERIAL_RK29_STANDARD
|
||||
|
||||
config UART3_RK29
|
||||
bool "RockChip rk29 serial port 3 support"
|
||||
depends on SERIAL_RK29
|
||||
|
||||
config UART3_CTS_RTS_RK29
|
||||
bool "RockChip rk29 serial port 3 cts rts support"
|
||||
depends on UART3_RK29
|
||||
|
||||
config UART3_DMA_RK29
|
||||
bool "RockChip rk29 serial port 3 dma support (EXPERIMENTAL)"
|
||||
depends on UART3_RK29 && SERIAL_RK29_STANDARD
|
||||
|
||||
config SERIAL_RK29_CONSOLE
|
||||
bool "Rockchip rk29 serial console support"
|
||||
depends on SERIAL_RK29=y
|
||||
select SERIAL_CORE_CONSOLE
|
||||
|
||||
config SERIAL_SC8800
|
||||
tristate "SC8800 support"
|
||||
depends on SPI
|
||||
select SERIAL_CORE
|
||||
help
|
||||
SC8800 spi-serial support
|
||||
|
||||
config SERIAL_GRLIB_GAISLER_APBUART
|
||||
tristate "GRLIB APBUART serial support"
|
||||
depends on OF
|
||||
|
|
|
|||
|
|
@ -83,12 +83,6 @@ obj-$(CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL) += nwpserial.o
|
|||
obj-$(CONFIG_SERIAL_KS8695) += serial_ks8695.o
|
||||
obj-$(CONFIG_KGDB_SERIAL_CONSOLE) += kgdboc.o
|
||||
obj-$(CONFIG_SERIAL_QE) += ucc_uart.o
|
||||
ifeq ($(CONFIG_SERIAL_RK29_STANDARD),y)
|
||||
obj-$(CONFIG_SERIAL_RK29) += rk_serial.o
|
||||
else
|
||||
obj-$(CONFIG_SERIAL_RK29) += rk29_serial.o
|
||||
endif
|
||||
obj-$(CONFIG_SERIAL_SC8800) += sc8800.o
|
||||
obj-$(CONFIG_SERIAL_TIMBERDALE) += timbuart.o
|
||||
obj-$(CONFIG_SERIAL_GRLIB_GAISLER_APBUART) += apbuart.o
|
||||
obj-$(CONFIG_SERIAL_ALTERA_JTAGUART) += altera_jtaguart.o
|
||||
|
|
|
|||
|
|
@ -117,9 +117,6 @@ source "drivers/staging/memrar/Kconfig"
|
|||
|
||||
source "drivers/staging/iio/Kconfig"
|
||||
|
||||
source "drivers/staging/rk29/vivante/Kconfig"
|
||||
source "drivers/staging/rk29/ipp/Kconfig"
|
||||
|
||||
source "drivers/staging/zram/Kconfig"
|
||||
|
||||
source "drivers/staging/wlags49_h2/Kconfig"
|
||||
|
|
|
|||
|
|
@ -40,8 +40,6 @@ obj-$(CONFIG_HYPERV) += hv/
|
|||
obj-$(CONFIG_VME_BUS) += vme/
|
||||
obj-$(CONFIG_MRST_RAR_HANDLER) += memrar/
|
||||
obj-$(CONFIG_IIO) += iio/
|
||||
obj-$(CONFIG_VIVANTE) += rk29/vivante/
|
||||
obj-$(CONFIG_RK29_IPP) += rk29/ipp/
|
||||
obj-$(CONFIG_ZRAM) += zram/
|
||||
obj-$(CONFIG_WLAGS49_H2) += wlags49_h2/
|
||||
obj-$(CONFIG_WLAGS49_H25) += wlags49_h25/
|
||||
|
|
|
|||
|
|
@ -20,12 +20,10 @@
|
|||
#include <linux/hrtimer.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/wakelock.h>
|
||||
#include <linux/delay.h>
|
||||
|
||||
#include "timed_output.h"
|
||||
#include "timed_gpio.h"
|
||||
|
||||
#define GPIO_TYPE 0
|
||||
|
||||
struct timed_gpio_data {
|
||||
struct timed_output_dev dev;
|
||||
|
|
@ -34,40 +32,14 @@ struct timed_gpio_data {
|
|||
unsigned gpio;
|
||||
int max_timeout;
|
||||
u8 active_low;
|
||||
int adjust_time;
|
||||
#if (GPIO_TYPE == 1)
|
||||
struct work_struct timed_gpio_work;
|
||||
#endif
|
||||
struct wake_lock irq_wake;
|
||||
};
|
||||
|
||||
#if (GPIO_TYPE == 1)
|
||||
static void timed_gpio_work_handler(struct work_struct *work)
|
||||
{
|
||||
struct timed_gpio_data *data =
|
||||
container_of(work, struct timed_gpio_data, timed_gpio_work);
|
||||
int ret = 0,i = 0;
|
||||
//set gpio several times once error happened
|
||||
for(i=0; i<3; i++)
|
||||
{
|
||||
ret = gpio_direction_output(data->gpio, data->active_low ? 1 : 0);
|
||||
if(!ret)
|
||||
break;
|
||||
printk("%s:ret=%d,fail to set gpio and set again,i=%d\n",__FUNCTION__,ret,i);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static enum hrtimer_restart gpio_timer_func(struct hrtimer *timer)
|
||||
{
|
||||
struct timed_gpio_data *data =
|
||||
container_of(timer, struct timed_gpio_data, timer);
|
||||
|
||||
#if (GPIO_TYPE == 0)
|
||||
|
||||
gpio_direction_output(data->gpio, data->active_low ? 1 : 0);
|
||||
#else
|
||||
schedule_work(&data->timed_gpio_work);
|
||||
#endif
|
||||
return HRTIMER_NORESTART;
|
||||
}
|
||||
|
||||
|
|
@ -88,26 +60,24 @@ static void gpio_enable(struct timed_output_dev *dev, int value)
|
|||
{
|
||||
struct timed_gpio_data *data =
|
||||
container_of(dev, struct timed_gpio_data, dev);
|
||||
int ret = 0,i = 0;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&data->lock, flags);
|
||||
|
||||
/* cancel previous timer and set GPIO according to value */
|
||||
hrtimer_cancel(&data->timer);
|
||||
//set gpio several times once error happened
|
||||
for(i=0; i<3; i++)
|
||||
{
|
||||
ret = gpio_direction_output(data->gpio, data->active_low ? !value : !!value);
|
||||
if(!ret)
|
||||
break;
|
||||
printk("%s:ret=%d,fail to set gpio and set again,i=%d\n",__FUNCTION__,ret,i);
|
||||
}
|
||||
gpio_direction_output(data->gpio, data->active_low ? !value : !!value);
|
||||
|
||||
if (value > 0) {
|
||||
value += data->adjust_time;
|
||||
if (value > data->max_timeout)
|
||||
value = data->max_timeout;
|
||||
|
||||
hrtimer_start(&data->timer,
|
||||
ktime_set(value / 1000, (value % 1000) * 1000000),
|
||||
HRTIMER_MODE_REL);
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&data->lock, flags);
|
||||
}
|
||||
|
||||
static int timed_gpio_probe(struct platform_device *pdev)
|
||||
|
|
@ -155,17 +125,10 @@ static int timed_gpio_probe(struct platform_device *pdev)
|
|||
gpio_dat->gpio = cur_gpio->gpio;
|
||||
gpio_dat->max_timeout = cur_gpio->max_timeout;
|
||||
gpio_dat->active_low = cur_gpio->active_low;
|
||||
gpio_dat->adjust_time = cur_gpio->adjust_time;
|
||||
gpio_direction_output(gpio_dat->gpio, gpio_dat->active_low);
|
||||
}
|
||||
#if (GPIO_TYPE == 1)
|
||||
INIT_WORK(&gpio_dat->timed_gpio_work, timed_gpio_work_handler);
|
||||
#endif
|
||||
platform_set_drvdata(pdev, gpio_data);
|
||||
wake_lock_init(&gpio_data->irq_wake, WAKE_LOCK_SUSPEND, "timed_gpio_wake");
|
||||
|
||||
gpio_enable(&gpio_data ->dev, 100);
|
||||
printk("%s\n",__FUNCTION__);
|
||||
platform_set_drvdata(pdev, gpio_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -205,7 +168,7 @@ static void __exit timed_gpio_exit(void)
|
|||
platform_driver_unregister(&timed_gpio_driver);
|
||||
}
|
||||
|
||||
subsys_initcall(timed_gpio_init);
|
||||
module_init(timed_gpio_init);
|
||||
module_exit(timed_gpio_exit);
|
||||
|
||||
MODULE_AUTHOR("Mike Lockwood <lockwood@android.com>");
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ struct timed_gpio {
|
|||
unsigned gpio;
|
||||
int max_timeout;
|
||||
u8 active_low;
|
||||
int adjust_time;
|
||||
};
|
||||
|
||||
struct timed_gpio_platform_data {
|
||||
|
|
|
|||
|
|
@ -45,5 +45,3 @@ obj-$(CONFIG_EARLY_PRINTK_DBGP) += early/
|
|||
|
||||
obj-$(CONFIG_USB_ATM) += atm/
|
||||
obj-$(CONFIG_USB_SPEEDTOUCH) += atm/
|
||||
obj-$(CONFIG_DWC_OTG) += dwc_otg/
|
||||
obj-$(CONFIG_USB_GADGET) += gadget/
|
||||
|
|
|
|||
|
|
@ -112,7 +112,6 @@ config USB_GADGET_SELECTED
|
|||
choice
|
||||
prompt "USB Peripheral Controller"
|
||||
depends on USB_GADGET
|
||||
default USB_GADGET_DWC_OTG
|
||||
help
|
||||
A USB device uses a controller to talk to its host.
|
||||
Systems should have only one such upstream link.
|
||||
|
|
@ -506,18 +505,6 @@ config USB_LANGWELL
|
|||
default USB_GADGET
|
||||
select USB_GADGET_SELECTED
|
||||
|
||||
config USB_GADGET_DWC_OTG
|
||||
boolean "Synopsys DWC OTG Controller"
|
||||
select USB_GADGET_DUALSPEED
|
||||
help
|
||||
This driver provides USB Device Controller support for the
|
||||
Synopsys DesignWare USB OTG Core used on the Rockchip RK28.
|
||||
|
||||
config USB_DWC_OTG
|
||||
tristate
|
||||
depends on USB_GADGET_DWC_OTG
|
||||
default USB_GADGET
|
||||
select USB_GADGET_SELECTED
|
||||
|
||||
#
|
||||
# LAST -- dummy/emulated controller
|
||||
|
|
@ -569,9 +556,9 @@ config USB_GADGET_DUALSPEED
|
|||
# USB Gadget Drivers
|
||||
#
|
||||
choice
|
||||
bool "USB Gadget Drivers"
|
||||
tristate "USB Gadget Drivers"
|
||||
depends on USB_GADGET && USB_GADGET_SELECTED
|
||||
default USB_ANDROID
|
||||
default USB_ETH
|
||||
help
|
||||
A Linux "Gadget Driver" talks to the USB Peripheral Controller
|
||||
driver through the abstract "gadget" API. Some other operating
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ MODULE_VERSION("1.0");
|
|||
static const char longname[] = "Gadget Android";
|
||||
|
||||
/* Default vendor and product IDs, overridden by platform data */
|
||||
#define VENDOR_ID 0x2207//0x18D1
|
||||
#define PRODUCT_ID 0x2910
|
||||
#define VENDOR_ID 0x18D1
|
||||
#define PRODUCT_ID 0x0001
|
||||
|
||||
struct android_dev {
|
||||
struct usb_composite_dev *cdev;
|
||||
|
|
@ -187,7 +187,7 @@ static int android_bind_config(struct usb_configuration *c)
|
|||
{
|
||||
struct android_dev *dev = _android_dev;
|
||||
|
||||
printk("android_bind_config\n");
|
||||
printk(KERN_DEBUG "android_bind_config\n");
|
||||
dev->config = c;
|
||||
|
||||
if (should_bind_functions(dev))
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ static struct usb_endpoint_descriptor adb_highspeed_in_desc = {
|
|||
.bDescriptorType = USB_DT_ENDPOINT,
|
||||
.bEndpointAddress = USB_DIR_IN,
|
||||
.bmAttributes = USB_ENDPOINT_XFER_BULK,
|
||||
.wMaxPacketSize = __constant_cpu_to_le16(64),
|
||||
.wMaxPacketSize = __constant_cpu_to_le16(512),
|
||||
};
|
||||
|
||||
static struct usb_endpoint_descriptor adb_highspeed_out_desc = {
|
||||
|
|
|
|||
|
|
@ -302,32 +302,6 @@
|
|||
#define FUNCTION_NAME "usb_mass_storage"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARCH_RK29
|
||||
/* flush after every 4 meg of writes to avoid excessive block level caching */
|
||||
#define MAX_UNFLUSHED_BYTES (64 * 1024)// (4 * 1024 * 1024) //original value is 4MB,Modifyed by xbw at 2011-08-18
|
||||
#define MAX_UNFLUSHED_PACKETS 4//16
|
||||
|
||||
#include <linux/power_supply.h>
|
||||
#include <linux/reboot.h>
|
||||
#include <linux/syscalls.h>
|
||||
|
||||
static int usb_msc_connected; /*usb charge status*/
|
||||
|
||||
static void set_msc_connect_flag( int connected )
|
||||
{
|
||||
printk("%s status = %d 20101216\n" , __func__, connected);
|
||||
if( usb_msc_connected == connected )
|
||||
return;
|
||||
usb_msc_connected = connected;//usb mass storage is ok
|
||||
}
|
||||
|
||||
int get_msc_connect_flag( void )
|
||||
{
|
||||
return usb_msc_connected;
|
||||
}
|
||||
EXPORT_SYMBOL(get_msc_connect_flag);
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#define FSG_DRIVER_DESC "Mass Storage Function"
|
||||
|
|
@ -813,13 +787,6 @@ static int do_read(struct fsg_common *common)
|
|||
amount = min(amount, (unsigned int) PAGE_CACHE_SIZE -
|
||||
partial_page);
|
||||
|
||||
/* kever@rk
|
||||
* max size for dwc_otg ctonroller is 64(max pkt sizt) * 1023(pkt)
|
||||
* because of the DOEPTSIZ.PKTCNT has only 10 bits
|
||||
*/
|
||||
if((common->gadget->speed != USB_SPEED_HIGH)&&(amount >0x8000))
|
||||
amount = 0x8000;
|
||||
|
||||
/* Wait for the next buffer to become available */
|
||||
bh = common->next_buffhd_to_fill;
|
||||
while (bh->state != BUF_STATE_EMPTY) {
|
||||
|
|
@ -992,13 +959,6 @@ static int do_write(struct fsg_common *common)
|
|||
amount_left_to_req -= amount;
|
||||
if (amount_left_to_req == 0)
|
||||
get_some_more = 0;
|
||||
|
||||
/* kever@rk
|
||||
* max size for dwc_otg ctonroller is 64(max pkt sizt) * 1023(pkt)
|
||||
* because of the DOEPTSIZ.PKTCNT has only 10 bits
|
||||
*/
|
||||
if((common->gadget->speed != USB_SPEED_HIGH)&&(amount >0x8000))
|
||||
amount = 0x8000;
|
||||
|
||||
/* amount is always divisible by 512, hence by
|
||||
* the bulk-out maxpacket size */
|
||||
|
|
@ -1065,15 +1025,6 @@ static int do_write(struct fsg_common *common)
|
|||
amount_left_to_write -= nwritten;
|
||||
common->residue -= nwritten;
|
||||
|
||||
#ifdef MAX_UNFLUSHED_PACKETS
|
||||
curlun->unflushed_packet ++;
|
||||
curlun->unflushed_bytes += nwritten;
|
||||
if( (curlun->unflushed_packet >= MAX_UNFLUSHED_PACKETS) || (curlun->unflushed_bytes >= MAX_UNFLUSHED_BYTES)) {
|
||||
fsg_lun_fsync_sub(curlun);
|
||||
curlun->unflushed_packet = 0;
|
||||
curlun->unflushed_bytes = 0;
|
||||
}
|
||||
#endif
|
||||
/* If an error occurred, report it and its position */
|
||||
if (nwritten < amount) {
|
||||
curlun->sense_data = SS_WRITE_ERROR;
|
||||
|
|
@ -1989,153 +1940,6 @@ static int check_command(struct fsg_common *common, int cmnd_size,
|
|||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_ARCH_RK29
|
||||
static void deferred_restart(struct work_struct *dummy)
|
||||
{
|
||||
sys_sync();
|
||||
kernel_restart("loader");
|
||||
}
|
||||
static DECLARE_WORK(restart_work, deferred_restart);
|
||||
|
||||
typedef struct tagLoaderParam
|
||||
{
|
||||
int tag;
|
||||
int length;
|
||||
char parameter[1];
|
||||
int crc;
|
||||
} PARM_INFO;
|
||||
#define PARM_TAG 0x4D524150
|
||||
#define MSC_EXT_DBG 1
|
||||
extern int GetParamterInfo(char * pbuf , int len);
|
||||
|
||||
/* the buf is bh->buf,it is large enough. */
|
||||
static char * get_param_tag( char* buf , const char* tag )
|
||||
{
|
||||
PARM_INFO *pi;
|
||||
int i;
|
||||
char *pp = buf+256;
|
||||
char *spp;
|
||||
i = GetParamterInfo( pp , 1024 );
|
||||
pi = (PARM_INFO*)pp;
|
||||
if( pi->tag != PARM_TAG ){
|
||||
error_out:
|
||||
printk("paramter error,tag=0x%x\n" , pi->tag );
|
||||
return NULL;
|
||||
}
|
||||
if( pi->length+sizeof(PARM_INFO) > i ) {
|
||||
GetParamterInfo( pp , pi->length+sizeof(PARM_INFO) + 511 );
|
||||
}
|
||||
pp = strstr( pi->parameter , tag );
|
||||
if( !pp ) goto error_out;
|
||||
pp += strlen(tag); // sizeof "MACHINE_MODEL:"
|
||||
while( *pp == ' ' || *pp == '\t' ) {
|
||||
if(pp - pi->parameter >= pi->length)
|
||||
break;
|
||||
pp++;
|
||||
}
|
||||
spp = pp;
|
||||
while( *pp != 0x0d && *pp != 0x0a ) {
|
||||
if(pp - pi->parameter >= pi->length)
|
||||
break;
|
||||
pp++;
|
||||
}
|
||||
*pp = 0;
|
||||
if( spp == pp ) return NULL;
|
||||
return spp;
|
||||
}
|
||||
|
||||
static int do_get_product_name(int ret ,char *buf)
|
||||
{
|
||||
char *tag = "MACHINE_MODEL:";
|
||||
char *pname;
|
||||
#if MSC_EXT_DBG
|
||||
char tbuf[1300];
|
||||
if( buf == NULL ) buf = tbuf;
|
||||
#endif
|
||||
memset( buf , 0 , ret );
|
||||
pname = get_param_tag( buf , tag );
|
||||
if( pname ){
|
||||
strcpy( buf , pname);
|
||||
}
|
||||
#if MSC_EXT_DBG
|
||||
printk("%s%s\n" , tag , buf );
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int do_get_versions( int ret ,char* buf )
|
||||
{
|
||||
/* get boot version and fireware version from cmdline
|
||||
* bootver=2010-07-08#4.02 firmware_ver=1.0.0 // Firmware Ver:16.01.0000
|
||||
* return format: 0x02 0x04 0x00 0x00 0x00 0x01
|
||||
* RK29: bootver=2011-07-18#2.05 firmware_ver=0.2.3 (==00.02.0003)
|
||||
* for the old loader,the firmware_ver may be empty,so get the fw ver from paramter.
|
||||
*/
|
||||
#define ASC_BCD0( c ) (((c-'0'))&0xf)
|
||||
#define ASC_BCD1( c ) (((c-'0')<<4)&0xf0)
|
||||
|
||||
char *ver = buf;
|
||||
char *p_l , *p_f;
|
||||
char *l_tag = "bootver=";
|
||||
char *fw_tag = "FIRMWARE_VER:";
|
||||
|
||||
#if MSC_EXT_DBG
|
||||
char tbuf[1300];
|
||||
if( ver == NULL ) ver = tbuf;
|
||||
#endif
|
||||
|
||||
memset( ver , 0x00 , ret );
|
||||
p_l = strstr( saved_command_line , l_tag );
|
||||
if( !p_l ) {
|
||||
return ret;
|
||||
}
|
||||
p_l+=strlen( l_tag );
|
||||
if( (p_l = strchr( p_l,'#')) ) {
|
||||
p_l++;
|
||||
if( p_l[1] == '.' ) {
|
||||
ver[1] = ASC_BCD0(p_l[0]);
|
||||
p_l+=2;
|
||||
} else {
|
||||
ver[1] = ASC_BCD1(p_l[0])|ASC_BCD0(p_l[1]);
|
||||
p_l+=3;
|
||||
}
|
||||
ver[0] = ASC_BCD1(p_l[0])|ASC_BCD0(p_l[1]);
|
||||
}
|
||||
|
||||
p_f = get_param_tag( ver , fw_tag );
|
||||
if( !p_f ) return ret;
|
||||
|
||||
if( p_f[1] == '.' ) {
|
||||
ver[5] = ASC_BCD0(p_f[0]);
|
||||
p_f+=2;
|
||||
} else {
|
||||
ver[5] = ASC_BCD1(p_f[0])|ASC_BCD0(p_f[1]);
|
||||
p_f+=3;
|
||||
}
|
||||
if( p_f[1] == '.' ) {
|
||||
ver[4] = ASC_BCD0(p_f[0]);
|
||||
p_f+=2;
|
||||
} else {
|
||||
ver[4] = ASC_BCD1(p_f[0])|ASC_BCD0(p_f[1]);
|
||||
p_f+=3;
|
||||
}
|
||||
ver[2] = ASC_BCD0(p_f[0]);
|
||||
p_f++;
|
||||
if( p_f[0] != ' ' ){
|
||||
ver[2] |= ASC_BCD1(p_f[0]);
|
||||
p_f++;
|
||||
}
|
||||
// only support 2 byte version.
|
||||
ver[3] = 0;
|
||||
|
||||
#if MSC_EXT_DBG
|
||||
printk("VERSION:%02x %02x %02x %02x %02x %02x\n" ,
|
||||
ver[0],ver[1],ver[2],ver[3],ver[4],ver[5]);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int do_scsi_command(struct fsg_common *common)
|
||||
{
|
||||
struct fsg_buffhd *bh;
|
||||
|
|
@ -2143,9 +1947,6 @@ static int do_scsi_command(struct fsg_common *common)
|
|||
int reply = -EINVAL;
|
||||
int i;
|
||||
static char unknown[16];
|
||||
#ifdef CONFIG_ARCH_RK29
|
||||
struct fsg_common *fsg = common;
|
||||
#endif
|
||||
|
||||
dump_cdb(common);
|
||||
|
||||
|
|
@ -2334,11 +2135,7 @@ static int do_scsi_command(struct fsg_common *common)
|
|||
(1<<1) | (0xf<<2) | (3<<7), 1,
|
||||
"VERIFY");
|
||||
if (reply == 0)
|
||||
#ifdef CONFIG_ARCH_RK29
|
||||
reply = 0; //zyf 20100302
|
||||
#else
|
||||
reply = do_verify(common);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case SC_WRITE_6:
|
||||
|
|
@ -2392,26 +2189,6 @@ static int do_scsi_command(struct fsg_common *common)
|
|||
reply = -EINVAL;
|
||||
}
|
||||
break;
|
||||
#ifdef CONFIG_ARCH_RK29
|
||||
case 0xff:
|
||||
if( fsg->cmnd[1] != 0xe0 ||
|
||||
fsg->cmnd[2] != 0xff || fsg->cmnd[3] != 0xff ||
|
||||
fsg->cmnd[4] != 0xff )
|
||||
break;
|
||||
if (fsg->cmnd_size >= 6 && fsg->cmnd[5] == 0xfe) {
|
||||
schedule_work(&restart_work);
|
||||
}
|
||||
else if ( fsg->cmnd[5] == 0xf3 ) {
|
||||
fsg->data_size_from_cmnd = fsg->data_size;
|
||||
/* get product name from parameter section */
|
||||
reply = do_get_product_name( fsg->data_size,bh->buf );
|
||||
}
|
||||
else if ( fsg->cmnd[5] == 0xff ){
|
||||
fsg->data_size_from_cmnd = fsg->data_size;
|
||||
reply = do_get_versions( fsg->data_size,bh->buf );
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
up_read(&common->filesem);
|
||||
|
||||
|
|
@ -2666,8 +2443,6 @@ static void fsg_disable(struct usb_function *f)
|
|||
struct fsg_dev *fsg = fsg_from_func(f);
|
||||
fsg->common->new_fsg = NULL;
|
||||
raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE);
|
||||
// yk 201009
|
||||
set_msc_connect_flag(0);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -3399,60 +3174,6 @@ fsg_common_from_params(struct fsg_common *common,
|
|||
|
||||
#ifdef CONFIG_USB_ANDROID_MASS_STORAGE
|
||||
|
||||
#ifdef CONFIG_ARCH_RK29
|
||||
static enum power_supply_property usb_props[] = {
|
||||
// POWER_SUPPLY_PROP_STATUS,
|
||||
POWER_SUPPLY_PROP_ONLINE,
|
||||
};
|
||||
|
||||
static int usb_get_property(struct power_supply *psy,
|
||||
enum power_supply_property psp,
|
||||
union power_supply_propval *val)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
switch (psp) {
|
||||
case POWER_SUPPLY_PROP_ONLINE:
|
||||
#ifndef CONFIG_DWC_OTG_HOST_ONLY
|
||||
val->intval = get_msc_connect_flag();
|
||||
#else
|
||||
val->intval = 0;
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int usb_power_supply_register(struct device* parent)
|
||||
{
|
||||
struct power_supply *ps;
|
||||
int retval = 0;
|
||||
|
||||
ps = kzalloc(sizeof(*ps), GFP_KERNEL);
|
||||
if (!ps) {
|
||||
dev_err(parent, "failed to allocate power supply data\n");
|
||||
retval = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
ps->name = "usb";
|
||||
ps->type = POWER_SUPPLY_TYPE_USB;
|
||||
ps->properties = usb_props;
|
||||
ps->num_properties = ARRAY_SIZE(usb_props);
|
||||
ps->get_property = usb_get_property;
|
||||
ps->external_power_changed = NULL;
|
||||
retval = power_supply_register(parent, ps);
|
||||
if (retval) {
|
||||
dev_err(parent, "failed to register battery\n");
|
||||
goto out;
|
||||
}
|
||||
out:
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct fsg_config fsg_cfg;
|
||||
|
||||
static int fsg_probe(struct platform_device *pdev)
|
||||
|
|
@ -3477,21 +3198,7 @@ static int fsg_probe(struct platform_device *pdev)
|
|||
fsg_cfg.can_stall = 0;
|
||||
fsg_cfg.pdev = pdev;
|
||||
|
||||
#ifdef CONFIG_ARCH_RK29
|
||||
{
|
||||
/*
|
||||
* Initialize usb power supply
|
||||
*/
|
||||
int retval = usb_power_supply_register(&pdev->dev);
|
||||
if (retval != 0) {
|
||||
dev_err(&pdev->dev, "usb_power_supply_register failed\n");
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static struct platform_driver fsg_platform_driver = {
|
||||
|
|
|
|||
|
|
@ -276,10 +276,6 @@ struct fsg_lun {
|
|||
struct file *filp;
|
||||
loff_t file_length;
|
||||
loff_t num_sectors;
|
||||
#ifdef MAX_UNFLUSHED_PACKETS
|
||||
unsigned int unflushed_packet;
|
||||
unsigned int unflushed_bytes;
|
||||
#endif
|
||||
|
||||
unsigned int initially_ro:1;
|
||||
unsigned int ro:1;
|
||||
|
|
@ -809,9 +805,6 @@ static ssize_t fsg_store_file(struct device *dev, struct device_attribute *attr,
|
|||
struct rw_semaphore *filesem = dev_get_drvdata(dev);
|
||||
int rc = 0;
|
||||
|
||||
#ifdef CONFIG_ARCH_RK29
|
||||
printk("store_file: \"%s\"\n", buf);
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_USB_ANDROID_MASS_STORAGE
|
||||
/* disabled in android because we need to allow closing the backing file
|
||||
|
|
|
|||
|
|
@ -308,7 +308,6 @@ static void option_instat_callback(struct urb *urb);
|
|||
#define ZTE_PRODUCT_CDMA_TECH 0xfffe
|
||||
#define ZTE_PRODUCT_AC8710 0xfff1
|
||||
#define ZTE_PRODUCT_AC2726 0xfff5
|
||||
#define ZTE_PRODUCT_AC100 0x0094
|
||||
#define ZTE_PRODUCT_AC8710T 0xffff
|
||||
|
||||
/* ZTE PRODUCTS -- alternate vendor ID */
|
||||
|
|
@ -383,11 +382,6 @@ static void option_instat_callback(struct urb *urb);
|
|||
#define HAIER_VENDOR_ID 0x201e
|
||||
#define HAIER_PRODUCT_CE100 0x2009
|
||||
|
||||
/* Thinkwill products */
|
||||
#define THINKWILL_VENDOR_ID 0x19f5
|
||||
#define THINKWILL_PRODUCT_ID 0x9909
|
||||
#define THINKWILL_MI900_PRODUCT_ID 0x9013
|
||||
|
||||
#define CINTERION_VENDOR_ID 0x0681
|
||||
|
||||
/* Olivetti products */
|
||||
|
|
@ -398,13 +392,6 @@ static void option_instat_callback(struct urb *urb);
|
|||
#define CELOT_VENDOR_ID 0x211f
|
||||
#define CELOT_PRODUCT_CT680M 0x6801
|
||||
|
||||
/* leadcore LC1808*/
|
||||
#define LEADCORE_VENDOR_ID 0x1ab7
|
||||
#define LEADCORE_PRODUCT_LC1808 0x2200
|
||||
/*展讯模组*/
|
||||
#define SC8800G_VENDOR_ID 0x067b
|
||||
#define SC8800G_PRODUCT_ID 0x2303
|
||||
|
||||
/* some devices interfaces need special handling due to a number of reasons */
|
||||
enum option_blacklist_reason {
|
||||
OPTION_BLACKLIST_NONE = 0,
|
||||
|
|
@ -427,10 +414,6 @@ static const struct option_blacklist_info four_g_w14_blacklist = {
|
|||
|
||||
static const struct usb_device_id option_ids[] = {
|
||||
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
|
||||
{ USB_DEVICE(THINKWILL_VENDOR_ID,THINKWILL_PRODUCT_ID)},
|
||||
|
||||
{ USB_DEVICE(THINKWILL_VENDOR_ID,THINKWILL_MI900_PRODUCT_ID)},
|
||||
|
||||
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
|
||||
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_LIGHT) },
|
||||
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_QUAD) },
|
||||
|
|
@ -460,7 +443,6 @@ static const struct usb_device_id option_ids[] = {
|
|||
{ USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLX) },
|
||||
{ USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GKE) },
|
||||
{ USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLE) },
|
||||
{ USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600)},
|
||||
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600, 0xff, 0xff, 0xff) },
|
||||
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220, 0xff, 0xff, 0xff) },
|
||||
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS, 0xff, 0xff, 0xff) },
|
||||
|
|
@ -918,11 +900,6 @@ static const struct usb_device_id option_ids[] = {
|
|||
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) },
|
||||
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) },
|
||||
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
|
||||
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xFFED, 0xff, 0xff, 0xff) },
|
||||
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xFFFE, 0xff, 0xff, 0xff) },
|
||||
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xFFEB, 0xff, 0xff, 0xff) },
|
||||
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xF006, 0xff, 0xff, 0xff) },
|
||||
{ USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_AC100)},
|
||||
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) },
|
||||
{ USB_DEVICE(ZTE_VENDOR_ID2, ZTE_PRODUCT_MF_330) },
|
||||
{ USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) },
|
||||
|
|
@ -962,34 +939,6 @@ static const struct usb_device_id option_ids[] = {
|
|||
{ USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100F) },
|
||||
{ USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1011)},
|
||||
{ USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1012)},
|
||||
{ USB_DEVICE(LEADCORE_VENDOR_ID, LEADCORE_PRODUCT_LC1808) }, //zzc
|
||||
{ USB_DEVICE(SC8800G_VENDOR_ID,SC8800G_PRODUCT_ID)},
|
||||
{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) },
|
||||
{ USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */
|
||||
|
||||
// cmy:
|
||||
{ USB_DEVICE(0x0685, 0x6000) },
|
||||
{ USB_DEVICE(0x1E89, 0x1E16) },
|
||||
{ USB_DEVICE(0x7693, 0x0001) },
|
||||
{ USB_DEVICE(0x1D09, 0x4308) },
|
||||
{ USB_DEVICE(0x1234, 0x0033) },
|
||||
{ USB_DEVICE(0xFEED, 0x0001) },
|
||||
{ USB_DEVICE(ALCATEL_VENDOR_ID, 0x0017) },
|
||||
{ USB_DEVICE(0x1C9E, 0x9E00) },
|
||||
{ USB_DEVICE(0x1C9E, 0xF000) },
|
||||
{ USB_DEVICE(0x19D2, 0x1303) },
|
||||
{ USB_DEVICE(0x19F5, 0x9013) }, // MW100
|
||||
{ USB_DEVICE(0x21F5, 0x2008) },
|
||||
{ USB_DEVICE(0x12D1, 0x1D09) },
|
||||
{ USB_DEVICE(0x04CC, 0x2259) },
|
||||
{ USB_DEVICE(0x04CC, 0x226E) },
|
||||
{ USB_DEVICE(0x04CC, 0x225A) },
|
||||
{ USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0015) },
|
||||
{ USB_DEVICE(ALCATEL_VENDOR_ID, 0x00b7) },
|
||||
{ USB_DEVICE(ZTE_VENDOR_ID, 0xFFFF) },
|
||||
{ USB_DEVICE(LEADCORE_VENDOR_ID, 0x5700) },
|
||||
{ USB_DEVICE(LEADCORE_VENDOR_ID, 0x6341) },
|
||||
|
||||
{ USB_DEVICE(CINTERION_VENDOR_ID, 0x0047) },
|
||||
{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) },
|
||||
{ USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */
|
||||
|
|
|
|||
|
|
@ -18,46 +18,21 @@
|
|||
#include <linux/mfd/wm831x/core.h>
|
||||
#include <linux/mfd/wm831x/pdata.h>
|
||||
#include <linux/mfd/wm831x/regulator.h>
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
#include <linux/earlysuspend.h>
|
||||
#endif
|
||||
#include <linux/delay.h>
|
||||
#include <linux/ktime.h>
|
||||
#define BL_SET 255
|
||||
#define BL_MISC_VALUE 20
|
||||
#define BL_INIT_VALUE 102
|
||||
|
||||
struct wm831x_backlight_data {
|
||||
struct wm831x *wm831x;
|
||||
int isink_reg;
|
||||
int current_brightness;
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
struct early_suspend early_suspend;
|
||||
struct delayed_work work;
|
||||
int suspend_flag;
|
||||
int shutdown_flag;
|
||||
#endif
|
||||
};
|
||||
#define TS_POLL_DELAY (10000*1000*1000)
|
||||
int wm831x_bright = 0;
|
||||
int max_tp = 0;
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
static struct backlight_device *gwm831x_bl;
|
||||
static struct wm831x_backlight_data *gwm831x_data;
|
||||
#endif
|
||||
|
||||
static int wm831x_backlight_set(struct backlight_device *bl, int brightness)
|
||||
{
|
||||
struct wm831x_backlight_data *data = bl_get_data(bl);
|
||||
struct wm831x *wm831x = data->wm831x;
|
||||
// int power_up = !data->current_brightness && brightness;
|
||||
// int power_down = data->current_brightness && !brightness;
|
||||
int power_up;
|
||||
int power_down;
|
||||
int power_up = !data->current_brightness && brightness;
|
||||
int power_down = data->current_brightness && !brightness;
|
||||
int ret;
|
||||
int bright_tp;
|
||||
|
||||
bright_tp =( max_tp*brightness)/BL_SET;
|
||||
power_up =!data->current_brightness && bright_tp;
|
||||
power_down = data->current_brightness && !bright_tp;
|
||||
if (power_up) {
|
||||
/* Enable the ISINK */
|
||||
ret = wm831x_set_bits(wm831x, data->isink_reg,
|
||||
|
|
@ -88,7 +63,7 @@ static int wm831x_backlight_set(struct backlight_device *bl, int brightness)
|
|||
|
||||
/* Set the new brightness */
|
||||
ret = wm831x_set_bits(wm831x, data->isink_reg,
|
||||
WM831X_CS1_ISEL_MASK, bright_tp);
|
||||
WM831X_CS1_ISEL_MASK, brightness);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
|
||||
|
|
@ -119,21 +94,7 @@ static int wm831x_backlight_set(struct backlight_device *bl, int brightness)
|
|||
static int wm831x_backlight_update_status(struct backlight_device *bl)
|
||||
{
|
||||
int brightness = bl->props.brightness;
|
||||
if (brightness<=BL_MISC_VALUE) {
|
||||
brightness = 8*brightness;
|
||||
}
|
||||
else if (brightness<=BL_INIT_VALUE) {
|
||||
brightness = 31*brightness/41 + 145;
|
||||
}
|
||||
else {
|
||||
brightness = 33*brightness/153 + 200;
|
||||
}
|
||||
|
||||
if(gwm831x_data->suspend_flag == 1)
|
||||
brightness = 0;
|
||||
if (gwm831x_data->shutdown_flag == 1)
|
||||
brightness = 0;
|
||||
|
||||
if (bl->props.power != FB_BLANK_UNBLANK)
|
||||
brightness = 0;
|
||||
|
||||
|
|
@ -143,8 +104,6 @@ static int wm831x_backlight_update_status(struct backlight_device *bl)
|
|||
if (bl->props.state & BL_CORE_SUSPENDED)
|
||||
brightness = 0;
|
||||
|
||||
printk("backlight brightness=%d\n", brightness);
|
||||
|
||||
return wm831x_backlight_set(bl, brightness);
|
||||
}
|
||||
|
||||
|
|
@ -159,40 +118,6 @@ static const struct backlight_ops wm831x_backlight_ops = {
|
|||
.update_status = wm831x_backlight_update_status,
|
||||
.get_brightness = wm831x_backlight_get_brightness,
|
||||
};
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
static void wm831x_bl_work(struct work_struct *work)
|
||||
{
|
||||
//struct wm831x_backlight_data *wm831x_data = container_of(work, struct wm831x_backlight_data,
|
||||
//work.work);
|
||||
backlight_update_status(gwm831x_bl);
|
||||
}
|
||||
|
||||
static void wm831x_bl_suspend(struct early_suspend *h)
|
||||
{
|
||||
struct wm831x_backlight_data *wm831x_data;
|
||||
wm831x_data = container_of(h, struct wm831x_backlight_data, early_suspend);
|
||||
wm831x_data->suspend_flag = 1;
|
||||
|
||||
schedule_delayed_work(&wm831x_data->work, msecs_to_jiffies(100));
|
||||
}
|
||||
|
||||
|
||||
static void wm831x_bl_resume(struct early_suspend *h)
|
||||
{
|
||||
struct wm831x_backlight_data *wm831x_data;
|
||||
wm831x_data = container_of(h, struct wm831x_backlight_data, early_suspend);
|
||||
wm831x_data->suspend_flag = 0;
|
||||
|
||||
schedule_delayed_work(&wm831x_data->work, msecs_to_jiffies(100));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int rk29_backlight_ctrl(int open)
|
||||
{
|
||||
gwm831x_data->suspend_flag = !open;
|
||||
schedule_delayed_work(&gwm831x_data->work, 0);
|
||||
}
|
||||
|
||||
static int wm831x_backlight_probe(struct platform_device *pdev)
|
||||
{
|
||||
|
|
@ -228,7 +153,7 @@ static int wm831x_backlight_probe(struct platform_device *pdev)
|
|||
return -EINVAL;
|
||||
}
|
||||
max_isel = i - 1;
|
||||
max_tp = max_isel;
|
||||
|
||||
if (pdata->max_uA != wm831x_isinkv_values[max_isel])
|
||||
dev_warn(&pdev->dev,
|
||||
"Maximum current is %duA not %duA as requested\n",
|
||||
|
|
@ -268,7 +193,7 @@ static int wm831x_backlight_probe(struct platform_device *pdev)
|
|||
data->current_brightness = 0;
|
||||
data->isink_reg = isink_reg;
|
||||
|
||||
props.max_brightness = BL_SET;
|
||||
props.max_brightness = max_isel;
|
||||
bl = backlight_device_register("wm831x", &pdev->dev, data,
|
||||
&wm831x_backlight_ops, &props);
|
||||
if (IS_ERR(bl)) {
|
||||
|
|
@ -277,26 +202,15 @@ static int wm831x_backlight_probe(struct platform_device *pdev)
|
|||
return PTR_ERR(bl);
|
||||
}
|
||||
|
||||
bl->props.brightness = BL_INIT_VALUE;
|
||||
bl->props.brightness = max_isel;
|
||||
|
||||
platform_set_drvdata(pdev, bl);
|
||||
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
data->early_suspend.level = ~0x0;
|
||||
data->early_suspend.suspend = wm831x_bl_suspend;
|
||||
data->early_suspend.resume = wm831x_bl_resume;
|
||||
register_early_suspend(&data->early_suspend);
|
||||
INIT_DELAYED_WORK(&data->work, wm831x_bl_work);
|
||||
gwm831x_bl = bl;
|
||||
gwm831x_data = data;
|
||||
#endif
|
||||
|
||||
|
||||
/* Disable the DCDC if it was started so we can bootstrap */
|
||||
wm831x_set_bits(wm831x, WM831X_DCDC_ENABLE, WM831X_DC4_ENA, 0);
|
||||
|
||||
//backlight_update_status(bl);
|
||||
schedule_delayed_work(&data->work, msecs_to_jiffies(100));
|
||||
|
||||
backlight_update_status(bl);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -307,24 +221,10 @@ static int wm831x_backlight_remove(struct platform_device *pdev)
|
|||
struct wm831x_backlight_data *data = bl_get_data(bl);
|
||||
|
||||
backlight_device_unregister(bl);
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
unregister_early_suspend(&data->early_suspend);
|
||||
#endif
|
||||
kfree(data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void wm831x_backlight_shutdown(struct platform_device *pdev)
|
||||
{
|
||||
struct backlight_device *bl = platform_get_drvdata(pdev);
|
||||
struct wm831x_backlight_data *data = bl_get_data(bl);
|
||||
|
||||
printk("enter %s\n", __func__);
|
||||
data->shutdown_flag = 1;
|
||||
wm831x_backlight_update_status(bl);
|
||||
return;
|
||||
}
|
||||
|
||||
static struct platform_driver wm831x_backlight_driver = {
|
||||
.driver = {
|
||||
.name = "wm831x-backlight",
|
||||
|
|
@ -332,7 +232,6 @@ static struct platform_driver wm831x_backlight_driver = {
|
|||
},
|
||||
.probe = wm831x_backlight_probe,
|
||||
.remove = wm831x_backlight_remove,
|
||||
.shutdown = wm831x_backlight_shutdown,
|
||||
};
|
||||
|
||||
static int __init wm831x_backlight_init(void)
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ static int fat__get_entry(struct inode *dir, loff_t *pos,
|
|||
|
||||
*bh = sb_bread(sb, phys);
|
||||
if (*bh == NULL) {
|
||||
printk(KERN_DEBUG "FAT: Directory bread(block %llu) failed\n",
|
||||
printk(KERN_ERR "FAT: Directory bread(block %llu) failed\n",
|
||||
(llu)phys);
|
||||
/* skip this block */
|
||||
*pos = (iblock + 1) << sb->s_blocksize_bits;
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ static int fat12_ent_bread(struct super_block *sb, struct fat_entry *fatent,
|
|||
err_brelse:
|
||||
brelse(bhs[0]);
|
||||
err:
|
||||
printk(KERN_DEBUG "FAT: FAT read failed (blocknr %llu)\n", (llu)blocknr);
|
||||
printk(KERN_ERR "FAT: FAT read failed (blocknr %llu)\n", (llu)blocknr);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ static int fat_ent_bread(struct super_block *sb, struct fat_entry *fatent,
|
|||
fatent->fat_inode = MSDOS_SB(sb)->fat_inode;
|
||||
fatent->bhs[0] = sb_bread(sb, blocknr);
|
||||
if (!fatent->bhs[0]) {
|
||||
printk(KERN_DEBUG "FAT: FAT read failed (blocknr %llu)\n",
|
||||
printk(KERN_ERR "FAT: FAT read failed (blocknr %llu)\n",
|
||||
(llu)blocknr);
|
||||
return -EIO;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1283,7 +1283,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
|
|||
sb_min_blocksize(sb, 512);
|
||||
bh = sb_bread(sb, 0);
|
||||
if (bh == NULL) {
|
||||
printk(KERN_DEBUG "FAT: unable to read boot sector\n");
|
||||
printk(KERN_ERR "FAT: unable to read boot sector\n");
|
||||
goto out_fail;
|
||||
}
|
||||
|
||||
|
|
@ -1349,7 +1349,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
|
|||
}
|
||||
bh = sb_bread(sb, 0);
|
||||
if (bh == NULL) {
|
||||
printk(KERN_DEBUG "FAT: unable to read boot sector"
|
||||
printk(KERN_ERR "FAT: unable to read boot sector"
|
||||
" (logical sector size = %lu)\n",
|
||||
sb->s_blocksize);
|
||||
goto out_fail;
|
||||
|
|
|
|||
|
|
@ -2633,9 +2633,6 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
|
|||
param->nReservedBlocks = 5;
|
||||
param->nShortOpCaches = (options.no_cache) ? 0 : 10;
|
||||
param->inbandTags = options.inband_tags;
|
||||
#if defined (CONFIG_ARCH_RK2818) || (CONFIG_ARCH_RK29)
|
||||
dev->inbandTags = 1;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_YAFFS_DISABLE_LAZY_LOAD
|
||||
param->disableLazyLoad = 1;
|
||||
|
|
|
|||
|
|
@ -179,12 +179,7 @@ int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_Device *dev, int chunkInNAND,
|
|||
if (localData)
|
||||
yaffs_ReleaseTempBuffer(dev, data, __LINE__);
|
||||
|
||||
#ifdef CONFIG_MTD_NAND_RK29
|
||||
//dxj 20101221@ if return -EBADMSG then i think the page is badchunk so just set the eccResult=YAFFS_ECC_RESULT_NO_ERROR
|
||||
if (tags && retval == -EBADMSG /*&& tags->eccResult == YAFFS_ECC_RESULT_NO_ERROR*/) {
|
||||
#else
|
||||
if (tags && retval == -EBADMSG && tags->eccResult == YAFFS_ECC_RESULT_NO_ERROR) {
|
||||
#endif
|
||||
tags->eccResult = YAFFS_ECC_RESULT_UNFIXED;
|
||||
dev->eccUnfixed++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,17 +57,6 @@ struct i2c_board_info;
|
|||
* transmit an arbitrary number of messages without interruption.
|
||||
* @count must be be less than 64k since msg.len is u16.
|
||||
*/
|
||||
#if defined (CONFIG_I2C_RK2818) || defined(CONFIG_I2C_RK29)
|
||||
/* If everything went ok, return 'count' transmitted, else error code. */
|
||||
extern int i2c_master_normal_send(struct i2c_client *client,const char *buf ,int count, int scl_rate);
|
||||
extern int i2c_master_normal_recv(struct i2c_client *client, char *buf ,int count, int scl_rate);
|
||||
extern int i2c_master_reg8_send(struct i2c_client *client, const char reg, const char *buf, int count, int scl_rate);
|
||||
extern int i2c_master_reg8_recv(struct i2c_client *client, const char reg, char *buf, int count, int scl_rate);
|
||||
extern int i2c_master_reg16_send(struct i2c_client *client, const short regs, const short *buf, int count, int scl_rate);
|
||||
extern int i2c_master_reg16_recv(struct i2c_client *client, const short regs, short *buf, int count, int scl_rate);
|
||||
extern int i2c_suspended(struct i2c_adapter *adap);
|
||||
#endif
|
||||
|
||||
extern int i2c_master_send(struct i2c_client *client, const char *buf,
|
||||
int count);
|
||||
extern int i2c_master_recv(struct i2c_client *client, char *buf, int count);
|
||||
|
|
@ -217,7 +206,6 @@ struct i2c_client {
|
|||
struct i2c_driver *driver; /* and our access routines */
|
||||
struct device dev; /* the device structure */
|
||||
int irq; /* irq issued by device */
|
||||
int udelay;
|
||||
struct list_head detected;
|
||||
};
|
||||
#define to_i2c_client(d) container_of(d, struct i2c_client, dev)
|
||||
|
|
@ -271,7 +259,6 @@ struct i2c_board_info {
|
|||
struct device_node *of_node;
|
||||
#endif
|
||||
int irq;
|
||||
int udelay; //add by kfx
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -527,13 +514,8 @@ struct i2c_msg {
|
|||
#define I2C_M_IGNORE_NAK 0x1000 /* if I2C_FUNC_PROTOCOL_MANGLING */
|
||||
#define I2C_M_NO_RD_ACK 0x0800 /* if I2C_FUNC_PROTOCOL_MANGLING */
|
||||
#define I2C_M_RECV_LEN 0x0400 /* length will be first received byte */
|
||||
#define I2C_M_NEED_DELAY 0x0020 // add by kfx
|
||||
#define I2C_M_REG8_DIRECT 0x0040 // add by kfx
|
||||
__u16 len; /* msg length */
|
||||
__u8 *buf; /* pointer to msg data */
|
||||
__u32 scl_rate; // add by kfx
|
||||
int udelay; //add by kfx
|
||||
__u16 read_type;
|
||||
};
|
||||
|
||||
/* To determine what functionality is present */
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
#include <linux/completion.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/wakelock.h>
|
||||
#include <linux/regulator/driver.h>
|
||||
|
||||
/*
|
||||
* Register values.
|
||||
|
|
@ -239,15 +237,6 @@
|
|||
struct regulator_dev;
|
||||
|
||||
#define WM831X_NUM_IRQ_REGS 5
|
||||
#define WM831X_IRQ_LIST 1
|
||||
enum wm831x_parent {
|
||||
WM8310 = 0x8310,
|
||||
WM8311 = 0x8311,
|
||||
WM8312 = 0x8312,
|
||||
WM8320 = 0x8320,
|
||||
WM8321 = 0x8321,
|
||||
WM8325 = 0x8325,
|
||||
};
|
||||
|
||||
struct wm831x {
|
||||
struct mutex io_lock;
|
||||
|
|
@ -261,19 +250,7 @@ struct wm831x {
|
|||
void *control_data;
|
||||
|
||||
int irq; /* Our chip IRQ */
|
||||
int flag_suspend;
|
||||
spinlock_t flag_lock;
|
||||
struct mutex irq_lock;
|
||||
struct workqueue_struct *irq_wq;
|
||||
struct delayed_work irq_work;
|
||||
struct wake_lock irq_wake;
|
||||
struct wake_lock handle_wake;
|
||||
#if WM831X_IRQ_LIST
|
||||
struct workqueue_struct *handle_wq;
|
||||
struct work_struct handle_work;
|
||||
spinlock_t work_lock;
|
||||
struct list_head handle_queue;
|
||||
#endif
|
||||
unsigned int irq_base;
|
||||
int irq_masks_cur[WM831X_NUM_IRQ_REGS]; /* Currently active value */
|
||||
int irq_masks_cache[WM831X_NUM_IRQ_REGS]; /* Cached hardware value */
|
||||
|
|
@ -297,39 +274,6 @@ struct wm831x {
|
|||
unsigned int locked:1;
|
||||
};
|
||||
|
||||
#define WM831X_DCDC_MAX_NAME 6
|
||||
#define WM831X_LDO_MAX_NAME 6
|
||||
#define WM831X_ISINK_MAX_NAME 7
|
||||
|
||||
struct wm831x_dcdc {
|
||||
char name[WM831X_DCDC_MAX_NAME];
|
||||
struct regulator_desc desc;
|
||||
int base;
|
||||
struct wm831x *wm831x;
|
||||
struct regulator_dev *regulator;
|
||||
int dvs_gpio;
|
||||
int dvs_gpio_state;
|
||||
int on_vsel;
|
||||
int dvs_vsel;
|
||||
};
|
||||
|
||||
struct wm831x_ldo {
|
||||
char name[WM831X_LDO_MAX_NAME];
|
||||
struct regulator_desc desc;
|
||||
int base;
|
||||
struct wm831x *wm831x;
|
||||
struct regulator_dev *regulator;
|
||||
};
|
||||
|
||||
struct wm831x_isink {
|
||||
char name[WM831X_ISINK_MAX_NAME];
|
||||
struct regulator_desc desc;
|
||||
int reg;
|
||||
struct wm831x *wm831x;
|
||||
struct regulator_dev *regulator;
|
||||
};
|
||||
|
||||
|
||||
/* Device I/O API */
|
||||
int wm831x_reg_read(struct wm831x *wm831x, unsigned short reg);
|
||||
int wm831x_reg_write(struct wm831x *wm831x, unsigned short reg,
|
||||
|
|
@ -341,13 +285,6 @@ int wm831x_set_bits(struct wm831x *wm831x, unsigned short reg,
|
|||
int wm831x_bulk_read(struct wm831x *wm831x, unsigned short reg,
|
||||
int count, u16 *buf);
|
||||
|
||||
int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq);
|
||||
void wm831x_device_exit(struct wm831x *wm831x);
|
||||
int wm831x_device_suspend(struct wm831x *wm831x);
|
||||
int wm831x_device_resume(struct wm831x *wm831x);
|
||||
int wm831x_device_shutdown(struct wm831x *wm831x);
|
||||
int wm831x_read_usb(struct wm831x *wm831x);
|
||||
int wm831x_device_restart(struct wm831x *wm831x);
|
||||
int wm831x_irq_init(struct wm831x *wm831x, int irq);
|
||||
void wm831x_irq_exit(struct wm831x *wm831x);
|
||||
|
||||
|
|
|
|||
|
|
@ -39,8 +39,6 @@ struct wm831x_battery_pdata {
|
|||
int eoc_iterm; /** End of trickle charge current, in mA */
|
||||
int fast_ilim; /** Fast charge current limit, in mA */
|
||||
int timeout; /** Charge cycle timeout, in minutes */
|
||||
int syslo; /** syslo threshold, in mV**/
|
||||
int sysok; /** sysok threshold, in mV**/
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -97,22 +95,6 @@ struct wm831x_watchdog_pdata {
|
|||
int update_gpio;
|
||||
unsigned int software:1;
|
||||
};
|
||||
struct wm831x_gpio_keys_button {
|
||||
/* Configuration parameters */
|
||||
int code; /* input event code (KEY_*, SW_*) */
|
||||
int gpio;
|
||||
int active_low;
|
||||
char *desc;
|
||||
int type; /* input event type (EV_KEY, EV_SW) */
|
||||
int wakeup; /* configure the button as a wake-up source */
|
||||
int debounce_interval; /* debounce ticks interval in msecs */
|
||||
};
|
||||
|
||||
struct wm831x_gpio_keys_pdata {
|
||||
struct wm831x_gpio_keys_button *buttons;
|
||||
int nbuttons;
|
||||
unsigned int rep:1; /* enable input subsystem auto repeat */
|
||||
};
|
||||
|
||||
#define WM831X_MAX_STATUS 2
|
||||
#define WM831X_MAX_DCDC 4
|
||||
|
|
@ -125,14 +107,7 @@ struct wm831x_pdata {
|
|||
int (*pre_init)(struct wm831x *wm831x);
|
||||
/** Called after subdevices are set up */
|
||||
int (*post_init)(struct wm831x *wm831x);
|
||||
/** Called before subdevices are power down */
|
||||
int (*last_deinit)(struct wm831x *wm831x);
|
||||
//add by sxj
|
||||
unsigned int gpio_pin_num;
|
||||
struct rk2818_gpio_expander_info *settinginfo;
|
||||
int settinginfolen;
|
||||
int (*pin_type_init)(struct wm831x *wm831x);
|
||||
//above add by sxj
|
||||
|
||||
int irq_base;
|
||||
int gpio_base;
|
||||
struct wm831x_backlight_pdata *backlight;
|
||||
|
|
@ -140,9 +115,6 @@ struct wm831x_pdata {
|
|||
struct wm831x_battery_pdata *battery;
|
||||
struct wm831x_touch_pdata *touch;
|
||||
struct wm831x_watchdog_pdata *watchdog;
|
||||
//add by srt
|
||||
struct wm831x_gpio_keys_pdata *gpio_keys;
|
||||
//end by srt
|
||||
|
||||
/** LED1 = 0 and so on */
|
||||
struct wm831x_status_pdata *status[WM831X_MAX_STATUS];
|
||||
|
|
|
|||
|
|
@ -15,14 +15,38 @@
|
|||
#ifndef __MFD_WM8994_CORE_H__
|
||||
#define __MFD_WM8994_CORE_H__
|
||||
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
struct regulator_dev;
|
||||
struct regulator_bulk_data;
|
||||
|
||||
#define WM8994_NUM_GPIO_REGS 11
|
||||
#define WM8994_NUM_LDO_REGS 2
|
||||
#define WM8994_NUM_LDO_REGS 2
|
||||
#define WM8994_NUM_IRQ_REGS 2
|
||||
|
||||
#define WM8994_IRQ_TEMP_SHUT 0
|
||||
#define WM8994_IRQ_MIC1_DET 1
|
||||
#define WM8994_IRQ_MIC1_SHRT 2
|
||||
#define WM8994_IRQ_MIC2_DET 3
|
||||
#define WM8994_IRQ_MIC2_SHRT 4
|
||||
#define WM8994_IRQ_FLL1_LOCK 5
|
||||
#define WM8994_IRQ_FLL2_LOCK 6
|
||||
#define WM8994_IRQ_SRC1_LOCK 7
|
||||
#define WM8994_IRQ_SRC2_LOCK 8
|
||||
#define WM8994_IRQ_AIF1DRC1_SIG_DET 9
|
||||
#define WM8994_IRQ_AIF1DRC2_SIG_DET 10
|
||||
#define WM8994_IRQ_AIF2DRC_SIG_DET 11
|
||||
#define WM8994_IRQ_FIFOS_ERR 12
|
||||
#define WM8994_IRQ_WSEQ_DONE 13
|
||||
#define WM8994_IRQ_DCS_DONE 14
|
||||
#define WM8994_IRQ_TEMP_WARN 15
|
||||
|
||||
/* GPIOs in the chip are numbered from 1-11 */
|
||||
#define WM8994_IRQ_GPIO(x) (x + WM8994_IRQ_TEMP_WARN)
|
||||
|
||||
struct wm8994 {
|
||||
struct mutex io_lock;
|
||||
struct mutex irq_lock;
|
||||
|
||||
struct device *dev;
|
||||
int (*read_dev)(struct wm8994 *wm8994, unsigned short reg,
|
||||
|
|
@ -33,6 +57,11 @@ struct wm8994 {
|
|||
void *control_data;
|
||||
|
||||
int gpio_base;
|
||||
int irq_base;
|
||||
|
||||
int irq;
|
||||
u16 irq_masks_cur[WM8994_NUM_IRQ_REGS];
|
||||
u16 irq_masks_cache[WM8994_NUM_IRQ_REGS];
|
||||
|
||||
/* Used over suspend/resume */
|
||||
u16 ldo_regs[WM8994_NUM_LDO_REGS];
|
||||
|
|
@ -51,4 +80,26 @@ int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg,
|
|||
int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
|
||||
int count, u16 *buf);
|
||||
|
||||
|
||||
/* Helper to save on boilerplate */
|
||||
static inline int wm8994_request_irq(struct wm8994 *wm8994, int irq,
|
||||
irq_handler_t handler, const char *name,
|
||||
void *data)
|
||||
{
|
||||
if (!wm8994->irq_base)
|
||||
return -EINVAL;
|
||||
return request_threaded_irq(wm8994->irq_base + irq, NULL, handler,
|
||||
IRQF_TRIGGER_RISING, name,
|
||||
data);
|
||||
}
|
||||
static inline void wm8994_free_irq(struct wm8994 *wm8994, int irq, void *data)
|
||||
{
|
||||
if (!wm8994->irq_base)
|
||||
return;
|
||||
free_irq(wm8994->irq_base + irq, data);
|
||||
}
|
||||
|
||||
int wm8994_irq_init(struct wm8994 *wm8994);
|
||||
void wm8994_irq_exit(struct wm8994 *wm8994);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ struct wm8994_ldo_pdata {
|
|||
#define WM8994_CONFIGURE_GPIO 0x8000
|
||||
|
||||
#define WM8994_DRC_REGS 5
|
||||
#define WM8994_EQ_REGS 19
|
||||
#define WM8994_EQ_REGS 20
|
||||
|
||||
/**
|
||||
* DRC configurations are specified with a label and a set of register
|
||||
|
|
@ -59,9 +59,6 @@ struct wm8994_retune_mobile_cfg {
|
|||
u16 regs[WM8994_EQ_REGS];
|
||||
};
|
||||
|
||||
#define PCM_BB 1
|
||||
#define NO_PCM_BB 0
|
||||
|
||||
struct wm8994_pdata {
|
||||
int gpio_base;
|
||||
|
||||
|
|
@ -73,6 +70,7 @@ struct wm8994_pdata {
|
|||
|
||||
struct wm8994_ldo_pdata ldo[WM8994_NUM_LDO];
|
||||
|
||||
int irq_base; /** Base IRQ number for WM8994, required for IRQs */
|
||||
|
||||
int num_drc_cfgs;
|
||||
struct wm8994_drc_cfg *drc_cfgs;
|
||||
|
|
@ -95,35 +93,6 @@ struct wm8994_pdata {
|
|||
/* Jack detect threashold levels, see datasheet for values */
|
||||
unsigned int jd_scthr:2;
|
||||
unsigned int jd_thr:2;
|
||||
|
||||
//for phonepad
|
||||
unsigned int no_earpiece:1; // =1 don't have a earpiece, =0 has a earpiece
|
||||
unsigned int sp_hp_same_channel:1;
|
||||
|
||||
//BB input can be differential or single ended
|
||||
unsigned int BB_input_diff:1; // =0 single ended =1 differential
|
||||
unsigned int BB_class:1;//PCM_BB= 1 NO_PCM_BB=0
|
||||
|
||||
//If an external amplifier speakers wm8994 enable>0 disable=0
|
||||
unsigned int PA_control_pin;
|
||||
|
||||
//wm8994 LDO1_ENA and LDO2_ENA
|
||||
unsigned int Power_EN_Pin;
|
||||
char PowerEN_iomux_name[50];
|
||||
int PowerEN_iomux_mode;
|
||||
|
||||
//volume
|
||||
int speaker_incall_vol; //max = 6, min = -21
|
||||
int speaker_incall_mic_vol; //max = 30, min = -22
|
||||
int speaker_normal_vol; //max = 6, min = -57
|
||||
int earpiece_incall_vol; //max = 6, min = -21
|
||||
int headset_incall_vol; //max = 6, min = -12
|
||||
int headset_incall_mic_vol; //max = 30, min = -22
|
||||
int headset_normal_vol; //max = 6, min = -57
|
||||
int BT_incall_vol; //max = 30, min = -16
|
||||
int BT_incall_mic_vol; //max = 6, min = -57
|
||||
int recorder_vol; //max = 60 , min = -16
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -203,12 +203,6 @@ struct mmc_host {
|
|||
const struct mmc_bus_ops *bus_ops; /* current bus driver */
|
||||
unsigned int bus_refs; /* reference counter */
|
||||
|
||||
#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
|
||||
unsigned int re_initialized_flags; //in order to begin the rescan ; added by xbw@2011-04-07
|
||||
unsigned int doneflag; //added by xbw at 2011-08-27
|
||||
int (*sdmmc_host_hw_init)(void *data);
|
||||
#endif
|
||||
|
||||
unsigned int bus_resume_flags;
|
||||
#define MMC_BUSRESUME_MANUAL_RESUME (1 << 0)
|
||||
#define MMC_BUSRESUME_NEEDS_RESUME (1 << 1)
|
||||
|
|
|
|||
|
|
@ -153,9 +153,6 @@ int regulator_list_voltage(struct regulator *regulator, unsigned selector);
|
|||
int regulator_is_supported_voltage(struct regulator *regulator,
|
||||
int min_uV, int max_uV);
|
||||
int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
|
||||
#ifdef CONFIG_ARCH_RK29
|
||||
int regulator_set_suspend_voltage(struct regulator *regulator, int uV);
|
||||
#endif
|
||||
int regulator_get_voltage(struct regulator *regulator);
|
||||
int regulator_set_current_limit(struct regulator *regulator,
|
||||
int min_uA, int max_uA);
|
||||
|
|
@ -243,13 +240,6 @@ static inline int regulator_set_voltage(struct regulator *regulator,
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ARCH_RK29
|
||||
static inline int regulator_set_suspend_voltage(struct regulator *regulator, int uV)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline int regulator_get_voltage(struct regulator *regulator)
|
||||
{
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ int wake_lock_active(struct wake_lock *lock);
|
|||
* number of jiffies until all active wake locks time out.
|
||||
*/
|
||||
long has_wake_lock(int type);
|
||||
void print_active_wake_locks(int type);
|
||||
|
||||
#else
|
||||
|
||||
|
|
@ -85,7 +84,6 @@ static inline void wake_unlock(struct wake_lock *lock) {}
|
|||
|
||||
static inline int wake_lock_active(struct wake_lock *lock) { return 0; }
|
||||
static inline long has_wake_lock(int type) { return 0; }
|
||||
static inline void print_active_wake_locks(int type) {}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -69,21 +69,11 @@ enum {
|
|||
V4L2_IDENT_OV9650 = 254,
|
||||
V4L2_IDENT_OV9655 = 255,
|
||||
V4L2_IDENT_SOI968 = 256,
|
||||
V4L2_IDENT_OV2655 = 257, /* ddl@rock-chips.com : ov2655 support */
|
||||
V4L2_IDENT_OV2659 = 258,
|
||||
V4L2_IDENT_OV3640 = 259,
|
||||
V4L2_IDENT_OV5640 = 260,
|
||||
V4L2_IDENT_OV5642 = 261,
|
||||
V4L2_IDENT_OV7675 = 262,
|
||||
V4L2_IDENT_OV2640 = 263,
|
||||
V4L2_IDENT_OV9640 = 264,
|
||||
V4L2_IDENT_OV9640 = 257,
|
||||
|
||||
/* module saa7146: reserved range 300-309 */
|
||||
V4L2_IDENT_SAA7146 = 300,
|
||||
|
||||
/* Samsung sensors: reserved range 310-319 */
|
||||
V4L2_IDENT_S5K66A = 310, /* ddl@rock-chips.com : s5k66a support */
|
||||
|
||||
/* Conexant MPEG encoder/decoders: reserved range 400-420 */
|
||||
V4L2_IDENT_CX23418_843 = 403, /* Integrated A/V Decoder on the '418 */
|
||||
V4L2_IDENT_CX23415 = 415,
|
||||
|
|
@ -287,7 +277,6 @@ enum {
|
|||
V4L2_IDENT_MT9M001C12STM = 45005,
|
||||
V4L2_IDENT_MT9M111 = 45007,
|
||||
V4L2_IDENT_MT9M112 = 45008,
|
||||
V4L2_IDENT_MT9D112 = 45009, /* ddl@rock-chips.com : MT9D112 support */
|
||||
V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */
|
||||
V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */
|
||||
V4L2_IDENT_MT9T031 = 45020,
|
||||
|
|
@ -296,9 +285,6 @@ enum {
|
|||
V4L2_IDENT_MT9V111 = 45031,
|
||||
V4L2_IDENT_MT9V112 = 45032,
|
||||
|
||||
V4L2_IDENT_MT9P111 = 45033, /* ddl@rock-chips.com : MT9P111 support */
|
||||
V4L2_IDENT_MT9D113 = 45034, /* ddl@rock-chips.com : MT9D113 support */
|
||||
|
||||
/* HV7131R CMOS sensor: just ident 46000 */
|
||||
V4L2_IDENT_HV7131R = 46000,
|
||||
|
||||
|
|
@ -322,19 +308,6 @@ enum {
|
|||
/* module upd64083: just ident 64083 */
|
||||
V4L2_IDENT_UPD64083 = 64083,
|
||||
|
||||
|
||||
V4L2_IDENT_GT2005 = 64099, /* ddl@rock-chips.com : GT2005 support */
|
||||
V4L2_IDENT_GC0307 = 64100, /* ddl@rock-chips.com : GC0308 support */
|
||||
V4L2_IDENT_GC0308 = 64101, /* ddl@rock-chips.com : GC0308 support */
|
||||
V4L2_IDENT_GC0309 = 64102, /* ddl@rock-chips.com : GC0309 support */
|
||||
V4L2_IDENT_SIV120B = 64103, /* ddl@rock-chips.com : siv120b support */
|
||||
|
||||
V4L2_IDENT_GC2015 = 64105, /* ddl@rock-chips.com : gc2015 support */
|
||||
V4L2_IDENT_HI253 = 64106, /* ddl@rock-chips.com : hi253 support */
|
||||
V4L2_IDENT_HI704 = 64107, /* ddl@rock-chips.com : hi704 support */
|
||||
V4L2_IDENT_NT99250 = 64108, /* ddl@rock-chips.com : nt99250 support */
|
||||
V4L2_IDENT_SID130B = 64109, /* ddl@rock-chips.com : sid130B support */
|
||||
|
||||
/* Don't just add new IDs at the end: KEEP THIS LIST ORDERED BY ID! */
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
#include <linux/syscalls.h> /* sys_sync */
|
||||
#include <linux/wakelock.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/kallsyms.h>
|
||||
|
||||
#include "power.h"
|
||||
|
||||
|
|
@ -28,11 +27,7 @@ enum {
|
|||
DEBUG_USER_STATE = 1U << 0,
|
||||
DEBUG_SUSPEND = 1U << 2,
|
||||
};
|
||||
#ifdef DEBUG
|
||||
static int debug_mask = DEBUG_USER_STATE | DEBUG_SUSPEND;
|
||||
#else
|
||||
static int debug_mask = DEBUG_USER_STATE;
|
||||
#endif
|
||||
module_param_named(debug_mask, debug_mask, int, S_IRUGO | S_IWUSR | S_IWGRP);
|
||||
|
||||
static DEFINE_MUTEX(early_suspend_lock);
|
||||
|
|
@ -99,8 +94,6 @@ static void early_suspend(struct work_struct *work)
|
|||
if (debug_mask & DEBUG_SUSPEND)
|
||||
pr_info("early_suspend: call handlers\n");
|
||||
list_for_each_entry(pos, &early_suspend_handlers, link) {
|
||||
if (debug_mask & DEBUG_SUSPEND)
|
||||
print_symbol("early_suspend: call %s\n", (unsigned long)pos->suspend);
|
||||
if (pos->suspend != NULL)
|
||||
pos->suspend(pos);
|
||||
}
|
||||
|
|
@ -138,12 +131,9 @@ static void late_resume(struct work_struct *work)
|
|||
}
|
||||
if (debug_mask & DEBUG_SUSPEND)
|
||||
pr_info("late_resume: call handlers\n");
|
||||
list_for_each_entry_reverse(pos, &early_suspend_handlers, link) {
|
||||
if (debug_mask & DEBUG_SUSPEND)
|
||||
print_symbol("late_resume: call %s\n", (unsigned long)pos->resume);
|
||||
list_for_each_entry_reverse(pos, &early_suspend_handlers, link)
|
||||
if (pos->resume != NULL)
|
||||
pos->resume(pos);
|
||||
}
|
||||
if (debug_mask & DEBUG_SUSPEND)
|
||||
pr_info("late_resume: done\n");
|
||||
abort:
|
||||
|
|
|
|||
|
|
@ -106,7 +106,6 @@ static int try_to_freeze_tasks(bool sig_only)
|
|||
printk("\n");
|
||||
printk(KERN_ERR "Freezing of %s aborted\n",
|
||||
sig_only ? "user space " : "tasks ");
|
||||
print_active_wake_locks(WAKE_LOCK_SUSPEND);
|
||||
}
|
||||
else {
|
||||
printk("\n");
|
||||
|
|
|
|||
|
|
@ -30,9 +30,8 @@ enum {
|
|||
DEBUG_SUSPEND = 1U << 2,
|
||||
DEBUG_EXPIRE = 1U << 3,
|
||||
DEBUG_WAKE_LOCK = 1U << 4,
|
||||
DEBUG_FORBID_SUSPEND = 1U << 5,
|
||||
};
|
||||
static int debug_mask = DEBUG_EXIT_SUSPEND | DEBUG_WAKEUP | DEBUG_FORBID_SUSPEND;
|
||||
static int debug_mask = DEBUG_EXIT_SUSPEND | DEBUG_WAKEUP;
|
||||
module_param_named(debug_mask, debug_mask, int, S_IRUGO | S_IWUSR | S_IWGRP);
|
||||
|
||||
#define WAKE_LOCK_TYPE_MASK (0x0f)
|
||||
|
|
@ -207,33 +206,28 @@ static void expire_wake_lock(struct wake_lock *lock)
|
|||
}
|
||||
|
||||
/* Caller must acquire the list_lock spinlock */
|
||||
static void print_active_locks_locked(int type)
|
||||
static void print_active_locks(int type)
|
||||
{
|
||||
struct wake_lock *lock;
|
||||
bool print_expired = true;
|
||||
|
||||
BUG_ON(type >= WAKE_LOCK_TYPE_COUNT);
|
||||
list_for_each_entry(lock, &active_wake_locks[type], link) {
|
||||
if (lock->flags & WAKE_LOCK_AUTO_EXPIRE) {
|
||||
long timeout = lock->expires - jiffies;
|
||||
if (timeout <= 0)
|
||||
if (timeout > 0)
|
||||
pr_info("active wake lock %s, time left %ld\n",
|
||||
lock->name, timeout);
|
||||
else if (print_expired)
|
||||
pr_info("wake lock %s, expired\n", lock->name);
|
||||
else
|
||||
pr_info("active wake lock %s, time left %ld.%03lu\n",
|
||||
lock->name, timeout / HZ,
|
||||
(timeout % HZ) * MSEC_PER_SEC / HZ);
|
||||
} else
|
||||
} else {
|
||||
pr_info("active wake lock %s\n", lock->name);
|
||||
if (!(debug_mask & DEBUG_EXPIRE))
|
||||
print_expired = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void print_active_wake_locks(int type)
|
||||
{
|
||||
unsigned long irqflags;
|
||||
spin_lock_irqsave(&list_lock, irqflags);
|
||||
print_active_locks_locked(type);
|
||||
spin_unlock_irqrestore(&list_lock, irqflags);
|
||||
}
|
||||
|
||||
static long has_wake_lock_locked(int type)
|
||||
{
|
||||
struct wake_lock *lock, *n;
|
||||
|
|
@ -259,6 +253,8 @@ long has_wake_lock(int type)
|
|||
unsigned long irqflags;
|
||||
spin_lock_irqsave(&list_lock, irqflags);
|
||||
ret = has_wake_lock_locked(type);
|
||||
if (ret && (debug_mask & DEBUG_SUSPEND) && type == WAKE_LOCK_SUSPEND)
|
||||
print_active_locks(type);
|
||||
spin_unlock_irqrestore(&list_lock, irqflags);
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -269,10 +265,8 @@ static void suspend(struct work_struct *work)
|
|||
int entry_event_num;
|
||||
|
||||
if (has_wake_lock(WAKE_LOCK_SUSPEND)) {
|
||||
if (debug_mask & DEBUG_SUSPEND || debug_mask & DEBUG_FORBID_SUSPEND)
|
||||
if (debug_mask & DEBUG_SUSPEND)
|
||||
pr_info("suspend: abort suspend\n");
|
||||
if (debug_mask & DEBUG_FORBID_SUSPEND)
|
||||
print_active_wake_locks(WAKE_LOCK_SUSPEND);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -307,7 +301,7 @@ static void expire_wake_locks(unsigned long data)
|
|||
pr_info("expire_wake_locks: start\n");
|
||||
spin_lock_irqsave(&list_lock, irqflags);
|
||||
if (debug_mask & DEBUG_SUSPEND)
|
||||
print_active_locks_locked(WAKE_LOCK_SUSPEND);
|
||||
print_active_locks(WAKE_LOCK_SUSPEND);
|
||||
has_lock = has_wake_lock_locked(WAKE_LOCK_SUSPEND);
|
||||
if (debug_mask & DEBUG_EXPIRE)
|
||||
pr_info("expire_wake_locks: done, has_lock %ld\n", has_lock);
|
||||
|
|
@ -325,8 +319,6 @@ static int power_suspend_late(struct device *dev)
|
|||
#endif
|
||||
if (debug_mask & DEBUG_SUSPEND)
|
||||
pr_info("power_suspend_late return %d\n", ret);
|
||||
if (ret && (debug_mask & DEBUG_FORBID_SUSPEND))
|
||||
print_active_wake_locks(WAKE_LOCK_SUSPEND);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -349,7 +341,6 @@ void wake_lock_init(struct wake_lock *lock, int type, const char *name)
|
|||
if (name)
|
||||
lock->name = name;
|
||||
BUG_ON(!lock->name);
|
||||
BUG_ON(lock->flags & WAKE_LOCK_INITIALIZED);
|
||||
|
||||
if (debug_mask & DEBUG_WAKE_LOCK)
|
||||
pr_info("wake_lock_init name=%s\n", lock->name);
|
||||
|
|
@ -516,7 +507,7 @@ void wake_unlock(struct wake_lock *lock)
|
|||
}
|
||||
if (lock == &main_wake_lock) {
|
||||
if (debug_mask & DEBUG_SUSPEND)
|
||||
print_active_locks_locked(WAKE_LOCK_SUSPEND);
|
||||
print_active_locks(WAKE_LOCK_SUSPEND);
|
||||
#ifdef CONFIG_WAKELOCK_STAT
|
||||
update_sleep_wait_stats_locked(0);
|
||||
#endif
|
||||
|
|
|
|||
37
kernel/sys.c
37
kernel/sys.c
|
|
@ -46,18 +46,6 @@
|
|||
#include <asm/uaccess.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/unistd.h>
|
||||
/***************
|
||||
* DEBUG
|
||||
****************/
|
||||
#define RESTART_DEBUG
|
||||
#ifdef RESTART_DEBUG
|
||||
#define restart_dbg(format, arg...) \
|
||||
printk("RESTART_DEBUG : " format "\n" , ## arg)
|
||||
#else
|
||||
#define restart_dbg(format, arg...) do {} while (0)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifndef SET_UNALIGN_CTL
|
||||
# define SET_UNALIGN_CTL(a,b) (-EINVAL)
|
||||
|
|
@ -319,16 +307,11 @@ void kernel_restart_prepare(char *cmd)
|
|||
*/
|
||||
void kernel_restart(char *cmd)
|
||||
{
|
||||
/*
|
||||
* debug trace
|
||||
*/
|
||||
restart_dbg("%s->%d->cmd=%s",__FUNCTION__,__LINE__,cmd);
|
||||
|
||||
kernel_restart_prepare(cmd);
|
||||
if (!cmd)
|
||||
printk( "Restarting system.\n");
|
||||
printk(KERN_EMERG "Restarting system.\n");
|
||||
else
|
||||
printk( "Restarting system with command '%s'.\n", cmd);
|
||||
printk(KERN_EMERG "Restarting system with command '%s'.\n", cmd);
|
||||
machine_restart(cmd);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kernel_restart);
|
||||
|
|
@ -409,11 +392,6 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
|
|||
mutex_lock(&reboot_mutex);
|
||||
switch (cmd) {
|
||||
case LINUX_REBOOT_CMD_RESTART:
|
||||
/*
|
||||
* debug trace
|
||||
*/
|
||||
restart_dbg("%s->%d->cmd=%x",__FUNCTION__,__LINE__,cmd);
|
||||
|
||||
kernel_restart(NULL);
|
||||
break;
|
||||
|
||||
|
|
@ -431,11 +409,6 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
|
|||
panic("cannot halt");
|
||||
|
||||
case LINUX_REBOOT_CMD_POWER_OFF:
|
||||
/*
|
||||
* debug trace
|
||||
*/
|
||||
restart_dbg("%s->%d->cmd=%x",__FUNCTION__,__LINE__,cmd);
|
||||
|
||||
kernel_power_off();
|
||||
do_exit(0);
|
||||
break;
|
||||
|
|
@ -446,11 +419,7 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
|
|||
break;
|
||||
}
|
||||
buffer[sizeof(buffer) - 1] = '\0';
|
||||
/*
|
||||
* debug trace
|
||||
*/
|
||||
restart_dbg("%s->%d->cmd=%x args=%s",__FUNCTION__,__LINE__,cmd,buffer);
|
||||
|
||||
|
||||
kernel_restart(buffer);
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -2003,8 +2003,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
|
|||
goto nopage;
|
||||
|
||||
restart:
|
||||
if (!(gfp_mask & __GFP_NO_KSWAPD))
|
||||
wake_all_kswapd(order, zonelist, high_zoneidx);
|
||||
wake_all_kswapd(order, zonelist, high_zoneidx);
|
||||
|
||||
/*
|
||||
* OK, we're below the kswapd watermark and have kicked background
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user