forked from Minki/linux
mfd/ab5500: delete AB5500 support
This platform has been obsoleted and was only available inside of ST-Ericsson, no users of this code are left in the world. This deletes the core U5500 support entirely in the same manner as the obsoleted U8500 silicon was previously deleted. Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> Cc: Rabin Vincent <rabin.vincent@stericsson.com> Cc: Jonas Aberg <jonas.aberg@stericsson.com> Cc: Per Forlin <per.forlin@stericsson.com> Cc: Ulf Hansson <ulf.hansson@stericsson.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
dece3709b7
commit
72fb92200d
@ -648,23 +648,6 @@ config EZX_PCAP
|
||||
This enables the PCAP ASIC present on EZX Phones. This is
|
||||
needed for MMC, TouchScreen, Sound, USB, etc..
|
||||
|
||||
config AB5500_CORE
|
||||
bool "ST-Ericsson AB5500 Mixed Signal Power Management chip"
|
||||
depends on ABX500_CORE && MFD_DB5500_PRCMU
|
||||
select MFD_CORE
|
||||
help
|
||||
Select this option to enable access to AB5500 power management
|
||||
chip. This connects to the db5500 chip via the I2C bus via PRCMU.
|
||||
This chip embeds various other multimedia funtionalities as well.
|
||||
|
||||
config AB5500_DEBUG
|
||||
bool "Enable debug info via debugfs"
|
||||
depends on AB5500_CORE && DEBUG_FS
|
||||
default y if DEBUG_FS
|
||||
help
|
||||
Select this option if you want debug information from the AB5500
|
||||
using the debug filesystem, debugfs.
|
||||
|
||||
config AB8500_CORE
|
||||
bool "ST-Ericsson AB8500 Mixed Signal Power Management chip"
|
||||
depends on GENERIC_HARDIRQS && ABX500_CORE
|
||||
|
@ -87,8 +87,6 @@ obj-$(CONFIG_PCF50633_GPIO) += pcf50633-gpio.o
|
||||
obj-$(CONFIG_ABX500_CORE) += abx500-core.o
|
||||
obj-$(CONFIG_AB3100_CORE) += ab3100-core.o
|
||||
obj-$(CONFIG_AB3100_OTP) += ab3100-otp.o
|
||||
obj-$(CONFIG_AB5500_CORE) += ab5500-core.o
|
||||
obj-$(CONFIG_AB5500_DEBUG) += ab5500-debugfs.o
|
||||
obj-$(CONFIG_AB8500_CORE) += ab8500-core.o ab8500-sysctrl.o
|
||||
obj-$(CONFIG_AB8500_DEBUG) += ab8500-debugfs.o
|
||||
obj-$(CONFIG_AB8500_GPADC) += ab8500-gpadc.o
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,807 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 ST-Ericsson
|
||||
* License terms: GNU General Public License (GPL) version 2
|
||||
* Debugfs support for the AB5500 MFD driver
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/mfd/abx500.h>
|
||||
#include <linux/mfd/abx500/ab5500.h>
|
||||
#include <linux/uaccess.h>
|
||||
|
||||
#include "ab5500-core.h"
|
||||
#include "ab5500-debugfs.h"
|
||||
|
||||
static struct ab5500_i2c_ranges ab5500_reg_ranges[AB5500_NUM_BANKS] = {
|
||||
[AB5500_BANK_LED] = {
|
||||
.bankid = AB5500_BANK_LED,
|
||||
.nranges = 1,
|
||||
.range = (struct ab5500_reg_range[]) {
|
||||
{
|
||||
.first = 0x00,
|
||||
.last = 0x0C,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
},
|
||||
},
|
||||
[AB5500_BANK_ADC] = {
|
||||
.bankid = AB5500_BANK_ADC,
|
||||
.nranges = 6,
|
||||
.range = (struct ab5500_reg_range[]) {
|
||||
{
|
||||
.first = 0x1F,
|
||||
.last = 0x22,
|
||||
.perm = AB5500_PERM_RO,
|
||||
},
|
||||
{
|
||||
.first = 0x23,
|
||||
.last = 0x24,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x26,
|
||||
.last = 0x2D,
|
||||
.perm = AB5500_PERM_RO,
|
||||
},
|
||||
{
|
||||
.first = 0x2F,
|
||||
.last = 0x34,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x37,
|
||||
.last = 0x57,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x58,
|
||||
.last = 0x58,
|
||||
.perm = AB5500_PERM_RO,
|
||||
},
|
||||
},
|
||||
},
|
||||
[AB5500_BANK_RTC] = {
|
||||
.bankid = AB5500_BANK_RTC,
|
||||
.nranges = 2,
|
||||
.range = (struct ab5500_reg_range[]) {
|
||||
{
|
||||
.first = 0x00,
|
||||
.last = 0x04,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x06,
|
||||
.last = 0x0C,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
},
|
||||
},
|
||||
[AB5500_BANK_STARTUP] = {
|
||||
.bankid = AB5500_BANK_STARTUP,
|
||||
.nranges = 12,
|
||||
.range = (struct ab5500_reg_range[]) {
|
||||
{
|
||||
.first = 0x00,
|
||||
.last = 0x01,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x1F,
|
||||
.last = 0x1F,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x2E,
|
||||
.last = 0x2E,
|
||||
.perm = AB5500_PERM_RO,
|
||||
},
|
||||
{
|
||||
.first = 0x2F,
|
||||
.last = 0x30,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x50,
|
||||
.last = 0x51,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x60,
|
||||
.last = 0x61,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x66,
|
||||
.last = 0x8A,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x8C,
|
||||
.last = 0x96,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0xAA,
|
||||
.last = 0xB4,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0xB7,
|
||||
.last = 0xBF,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0xC1,
|
||||
.last = 0xCA,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0xD3,
|
||||
.last = 0xE0,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
},
|
||||
},
|
||||
[AB5500_BANK_DBI_ECI] = {
|
||||
.bankid = AB5500_BANK_DBI_ECI,
|
||||
.nranges = 3,
|
||||
.range = (struct ab5500_reg_range[]) {
|
||||
{
|
||||
.first = 0x00,
|
||||
.last = 0x07,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x10,
|
||||
.last = 0x10,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x13,
|
||||
.last = 0x13,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
},
|
||||
},
|
||||
[AB5500_BANK_CHG] = {
|
||||
.bankid = AB5500_BANK_CHG,
|
||||
.nranges = 2,
|
||||
.range = (struct ab5500_reg_range[]) {
|
||||
{
|
||||
.first = 0x11,
|
||||
.last = 0x11,
|
||||
.perm = AB5500_PERM_RO,
|
||||
},
|
||||
{
|
||||
.first = 0x12,
|
||||
.last = 0x1B,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
},
|
||||
},
|
||||
[AB5500_BANK_FG_BATTCOM_ACC] = {
|
||||
.bankid = AB5500_BANK_FG_BATTCOM_ACC,
|
||||
.nranges = 2,
|
||||
.range = (struct ab5500_reg_range[]) {
|
||||
{
|
||||
.first = 0x00,
|
||||
.last = 0x0B,
|
||||
.perm = AB5500_PERM_RO,
|
||||
},
|
||||
{
|
||||
.first = 0x0C,
|
||||
.last = 0x10,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
},
|
||||
},
|
||||
[AB5500_BANK_USB] = {
|
||||
.bankid = AB5500_BANK_USB,
|
||||
.nranges = 12,
|
||||
.range = (struct ab5500_reg_range[]) {
|
||||
{
|
||||
.first = 0x01,
|
||||
.last = 0x01,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x80,
|
||||
.last = 0x83,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x87,
|
||||
.last = 0x8A,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x8B,
|
||||
.last = 0x8B,
|
||||
.perm = AB5500_PERM_RO,
|
||||
},
|
||||
{
|
||||
.first = 0x91,
|
||||
.last = 0x92,
|
||||
.perm = AB5500_PERM_RO,
|
||||
},
|
||||
{
|
||||
.first = 0x93,
|
||||
.last = 0x93,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x94,
|
||||
.last = 0x94,
|
||||
.perm = AB5500_PERM_RO,
|
||||
},
|
||||
{
|
||||
.first = 0xA8,
|
||||
.last = 0xB0,
|
||||
.perm = AB5500_PERM_RO,
|
||||
},
|
||||
{
|
||||
.first = 0xB2,
|
||||
.last = 0xB2,
|
||||
.perm = AB5500_PERM_RO,
|
||||
},
|
||||
{
|
||||
.first = 0xB4,
|
||||
.last = 0xBC,
|
||||
.perm = AB5500_PERM_RO,
|
||||
},
|
||||
{
|
||||
.first = 0xBF,
|
||||
.last = 0xBF,
|
||||
.perm = AB5500_PERM_RO,
|
||||
},
|
||||
{
|
||||
.first = 0xC1,
|
||||
.last = 0xC5,
|
||||
.perm = AB5500_PERM_RO,
|
||||
},
|
||||
},
|
||||
},
|
||||
[AB5500_BANK_IT] = {
|
||||
.bankid = AB5500_BANK_IT,
|
||||
.nranges = 4,
|
||||
.range = (struct ab5500_reg_range[]) {
|
||||
{
|
||||
.first = 0x00,
|
||||
.last = 0x02,
|
||||
.perm = AB5500_PERM_RO,
|
||||
},
|
||||
{
|
||||
.first = 0x20,
|
||||
.last = 0x36,
|
||||
.perm = AB5500_PERM_RO,
|
||||
},
|
||||
{
|
||||
.first = 0x40,
|
||||
.last = 0x56,
|
||||
.perm = AB5500_PERM_RO,
|
||||
},
|
||||
{
|
||||
.first = 0x60,
|
||||
.last = 0x76,
|
||||
.perm = AB5500_PERM_RO,
|
||||
},
|
||||
},
|
||||
},
|
||||
[AB5500_BANK_VDDDIG_IO_I2C_CLK_TST] = {
|
||||
.bankid = AB5500_BANK_VDDDIG_IO_I2C_CLK_TST,
|
||||
.nranges = 7,
|
||||
.range = (struct ab5500_reg_range[]) {
|
||||
{
|
||||
.first = 0x02,
|
||||
.last = 0x02,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x12,
|
||||
.last = 0x12,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x30,
|
||||
.last = 0x34,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x40,
|
||||
.last = 0x44,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x50,
|
||||
.last = 0x54,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x60,
|
||||
.last = 0x64,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x70,
|
||||
.last = 0x74,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
},
|
||||
},
|
||||
[AB5500_BANK_VIT_IO_I2C_CLK_TST_OTP] = {
|
||||
.bankid = AB5500_BANK_VIT_IO_I2C_CLK_TST_OTP,
|
||||
.nranges = 13,
|
||||
.range = (struct ab5500_reg_range[]) {
|
||||
{
|
||||
.first = 0x01,
|
||||
.last = 0x01,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x02,
|
||||
.last = 0x02,
|
||||
.perm = AB5500_PERM_RO,
|
||||
},
|
||||
{
|
||||
.first = 0x0D,
|
||||
.last = 0x0F,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x1C,
|
||||
.last = 0x1C,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x1E,
|
||||
.last = 0x1E,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x20,
|
||||
.last = 0x21,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x25,
|
||||
.last = 0x25,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x28,
|
||||
.last = 0x2A,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x30,
|
||||
.last = 0x33,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x40,
|
||||
.last = 0x43,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x50,
|
||||
.last = 0x53,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x60,
|
||||
.last = 0x63,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x70,
|
||||
.last = 0x73,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
},
|
||||
},
|
||||
[AB5500_BANK_VIBRA] = {
|
||||
.bankid = AB5500_BANK_VIBRA,
|
||||
.nranges = 2,
|
||||
.range = (struct ab5500_reg_range[]) {
|
||||
{
|
||||
.first = 0x10,
|
||||
.last = 0x13,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0xFE,
|
||||
.last = 0xFE,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
},
|
||||
},
|
||||
[AB5500_BANK_AUDIO_HEADSETUSB] = {
|
||||
.bankid = AB5500_BANK_AUDIO_HEADSETUSB,
|
||||
.nranges = 2,
|
||||
.range = (struct ab5500_reg_range[]) {
|
||||
{
|
||||
.first = 0x00,
|
||||
.last = 0x48,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0xEB,
|
||||
.last = 0xFB,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
},
|
||||
},
|
||||
[AB5500_BANK_SIM_USBSIM] = {
|
||||
.bankid = AB5500_BANK_SIM_USBSIM,
|
||||
.nranges = 1,
|
||||
.range = (struct ab5500_reg_range[]) {
|
||||
{
|
||||
.first = 0x13,
|
||||
.last = 0x19,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
},
|
||||
},
|
||||
[AB5500_BANK_VDENC] = {
|
||||
.bankid = AB5500_BANK_VDENC,
|
||||
.nranges = 12,
|
||||
.range = (struct ab5500_reg_range[]) {
|
||||
{
|
||||
.first = 0x00,
|
||||
.last = 0x08,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x09,
|
||||
.last = 0x09,
|
||||
.perm = AB5500_PERM_RO,
|
||||
},
|
||||
{
|
||||
.first = 0x0A,
|
||||
.last = 0x12,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x15,
|
||||
.last = 0x19,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x1B,
|
||||
.last = 0x21,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x27,
|
||||
.last = 0x2C,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x41,
|
||||
.last = 0x41,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x45,
|
||||
.last = 0x5B,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x5D,
|
||||
.last = 0x5D,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x69,
|
||||
.last = 0x69,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x6C,
|
||||
.last = 0x6D,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
{
|
||||
.first = 0x80,
|
||||
.last = 0x81,
|
||||
.perm = AB5500_PERM_RW,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static int ab5500_registers_print(struct seq_file *s, void *p)
|
||||
{
|
||||
struct ab5500 *ab = s->private;
|
||||
unsigned int i;
|
||||
u8 bank = (u8)ab->debug_bank;
|
||||
|
||||
seq_printf(s, "ab5500 register values:\n");
|
||||
for (bank = 0; bank < AB5500_NUM_BANKS; bank++) {
|
||||
seq_printf(s, " bank %u, %s (0x%x):\n", bank,
|
||||
bankinfo[bank].name,
|
||||
bankinfo[bank].slave_addr);
|
||||
for (i = 0; i < ab5500_reg_ranges[bank].nranges; i++) {
|
||||
u8 reg;
|
||||
int err;
|
||||
|
||||
for (reg = ab5500_reg_ranges[bank].range[i].first;
|
||||
reg <= ab5500_reg_ranges[bank].range[i].last;
|
||||
reg++) {
|
||||
u8 value;
|
||||
|
||||
err = ab5500_get_register_interruptible_raw(ab,
|
||||
bank, reg,
|
||||
&value);
|
||||
if (err < 0) {
|
||||
dev_err(ab->dev, "get_reg failed %d"
|
||||
"bank 0x%x reg 0x%x\n",
|
||||
err, bank, reg);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = seq_printf(s, "[%d/0x%02X]: 0x%02X\n",
|
||||
bank, reg, value);
|
||||
if (err < 0) {
|
||||
dev_err(ab->dev,
|
||||
"seq_printf overflow\n");
|
||||
/*
|
||||
* Error is not returned here since
|
||||
* the output is wanted in any case
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ab5500_registers_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, ab5500_registers_print, inode->i_private);
|
||||
}
|
||||
|
||||
static const struct file_operations ab5500_registers_fops = {
|
||||
.open = ab5500_registers_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int ab5500_bank_print(struct seq_file *s, void *p)
|
||||
{
|
||||
struct ab5500 *ab = s->private;
|
||||
|
||||
seq_printf(s, "%d\n", ab->debug_bank);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ab5500_bank_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, ab5500_bank_print, inode->i_private);
|
||||
}
|
||||
|
||||
static ssize_t ab5500_bank_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ab5500 *ab = ((struct seq_file *)(file->private_data))->private;
|
||||
char buf[32];
|
||||
int buf_size;
|
||||
unsigned long user_bank;
|
||||
int err;
|
||||
|
||||
/* Get userspace string and assure termination */
|
||||
buf_size = min(count, (sizeof(buf) - 1));
|
||||
if (copy_from_user(buf, user_buf, buf_size))
|
||||
return -EFAULT;
|
||||
buf[buf_size] = 0;
|
||||
|
||||
err = strict_strtoul(buf, 0, &user_bank);
|
||||
if (err)
|
||||
return -EINVAL;
|
||||
|
||||
if (user_bank >= AB5500_NUM_BANKS) {
|
||||
dev_err(ab->dev,
|
||||
"debugfs error input > number of banks\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ab->debug_bank = user_bank;
|
||||
|
||||
return buf_size;
|
||||
}
|
||||
|
||||
static int ab5500_address_print(struct seq_file *s, void *p)
|
||||
{
|
||||
struct ab5500 *ab = s->private;
|
||||
|
||||
seq_printf(s, "0x%02X\n", ab->debug_address);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ab5500_address_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, ab5500_address_print, inode->i_private);
|
||||
}
|
||||
|
||||
static ssize_t ab5500_address_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ab5500 *ab = ((struct seq_file *)(file->private_data))->private;
|
||||
char buf[32];
|
||||
int buf_size;
|
||||
unsigned long user_address;
|
||||
int err;
|
||||
|
||||
/* Get userspace string and assure termination */
|
||||
buf_size = min(count, (sizeof(buf) - 1));
|
||||
if (copy_from_user(buf, user_buf, buf_size))
|
||||
return -EFAULT;
|
||||
buf[buf_size] = 0;
|
||||
|
||||
err = strict_strtoul(buf, 0, &user_address);
|
||||
if (err)
|
||||
return -EINVAL;
|
||||
if (user_address > 0xff) {
|
||||
dev_err(ab->dev,
|
||||
"debugfs error input > 0xff\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
ab->debug_address = user_address;
|
||||
return buf_size;
|
||||
}
|
||||
|
||||
static int ab5500_val_print(struct seq_file *s, void *p)
|
||||
{
|
||||
struct ab5500 *ab = s->private;
|
||||
int err;
|
||||
u8 regvalue;
|
||||
|
||||
err = ab5500_get_register_interruptible_raw(ab, (u8)ab->debug_bank,
|
||||
(u8)ab->debug_address, ®value);
|
||||
if (err) {
|
||||
dev_err(ab->dev, "get_reg failed %d, bank 0x%x"
|
||||
", reg 0x%x\n", err, ab->debug_bank,
|
||||
ab->debug_address);
|
||||
return -EINVAL;
|
||||
}
|
||||
seq_printf(s, "0x%02X\n", regvalue);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ab5500_val_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, ab5500_val_print, inode->i_private);
|
||||
}
|
||||
|
||||
static ssize_t ab5500_val_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ab5500 *ab = ((struct seq_file *)(file->private_data))->private;
|
||||
char buf[32];
|
||||
int buf_size;
|
||||
unsigned long user_val;
|
||||
int err;
|
||||
u8 regvalue;
|
||||
|
||||
/* Get userspace string and assure termination */
|
||||
buf_size = min(count, (sizeof(buf)-1));
|
||||
if (copy_from_user(buf, user_buf, buf_size))
|
||||
return -EFAULT;
|
||||
buf[buf_size] = 0;
|
||||
|
||||
err = strict_strtoul(buf, 0, &user_val);
|
||||
if (err)
|
||||
return -EINVAL;
|
||||
if (user_val > 0xff) {
|
||||
dev_err(ab->dev,
|
||||
"debugfs error input > 0xff\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = ab5500_mask_and_set_register_interruptible_raw(
|
||||
ab, (u8)ab->debug_bank,
|
||||
(u8)ab->debug_address, 0xFF, (u8)user_val);
|
||||
if (err)
|
||||
return -EINVAL;
|
||||
|
||||
ab5500_get_register_interruptible_raw(ab, (u8)ab->debug_bank,
|
||||
(u8)ab->debug_address, ®value);
|
||||
if (err)
|
||||
return -EINVAL;
|
||||
|
||||
return buf_size;
|
||||
}
|
||||
|
||||
static const struct file_operations ab5500_bank_fops = {
|
||||
.open = ab5500_bank_open,
|
||||
.write = ab5500_bank_write,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static const struct file_operations ab5500_address_fops = {
|
||||
.open = ab5500_address_open,
|
||||
.write = ab5500_address_write,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static const struct file_operations ab5500_val_fops = {
|
||||
.open = ab5500_val_open,
|
||||
.write = ab5500_val_write,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static struct dentry *ab5500_dir;
|
||||
static struct dentry *ab5500_reg_file;
|
||||
static struct dentry *ab5500_bank_file;
|
||||
static struct dentry *ab5500_address_file;
|
||||
static struct dentry *ab5500_val_file;
|
||||
|
||||
void __init ab5500_setup_debugfs(struct ab5500 *ab)
|
||||
{
|
||||
ab->debug_bank = AB5500_BANK_VIT_IO_I2C_CLK_TST_OTP;
|
||||
ab->debug_address = AB5500_CHIP_ID;
|
||||
|
||||
ab5500_dir = debugfs_create_dir("ab5500", NULL);
|
||||
if (!ab5500_dir)
|
||||
goto exit_no_debugfs;
|
||||
|
||||
ab5500_reg_file = debugfs_create_file("all-bank-registers",
|
||||
S_IRUGO, ab5500_dir, ab, &ab5500_registers_fops);
|
||||
if (!ab5500_reg_file)
|
||||
goto exit_destroy_dir;
|
||||
|
||||
ab5500_bank_file = debugfs_create_file("register-bank",
|
||||
(S_IRUGO | S_IWUGO), ab5500_dir, ab, &ab5500_bank_fops);
|
||||
if (!ab5500_bank_file)
|
||||
goto exit_destroy_reg;
|
||||
|
||||
ab5500_address_file = debugfs_create_file("register-address",
|
||||
(S_IRUGO | S_IWUGO), ab5500_dir, ab, &ab5500_address_fops);
|
||||
if (!ab5500_address_file)
|
||||
goto exit_destroy_bank;
|
||||
|
||||
ab5500_val_file = debugfs_create_file("register-value",
|
||||
(S_IRUGO | S_IWUGO), ab5500_dir, ab, &ab5500_val_fops);
|
||||
if (!ab5500_val_file)
|
||||
goto exit_destroy_address;
|
||||
|
||||
return;
|
||||
|
||||
exit_destroy_address:
|
||||
debugfs_remove(ab5500_address_file);
|
||||
exit_destroy_bank:
|
||||
debugfs_remove(ab5500_bank_file);
|
||||
exit_destroy_reg:
|
||||
debugfs_remove(ab5500_reg_file);
|
||||
exit_destroy_dir:
|
||||
debugfs_remove(ab5500_dir);
|
||||
exit_no_debugfs:
|
||||
dev_err(ab->dev, "failed to create debugfs entries.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
void __exit ab5500_remove_debugfs(void)
|
||||
{
|
||||
debugfs_remove(ab5500_val_file);
|
||||
debugfs_remove(ab5500_address_file);
|
||||
debugfs_remove(ab5500_bank_file);
|
||||
debugfs_remove(ab5500_reg_file);
|
||||
debugfs_remove(ab5500_dir);
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 ST-Ericsson
|
||||
* License terms: GNU General Public License (GPL) version 2
|
||||
* Debugfs interface to the AB5500 core driver
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
|
||||
void ab5500_setup_debugfs(struct ab5500 *ab);
|
||||
void ab5500_remove_debugfs(void);
|
||||
|
||||
#else /* !CONFIG_DEBUG_FS */
|
||||
|
||||
static inline void ab5500_setup_debugfs(struct ab5500 *ab)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void ab5500_remove_debugfs(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* ABX500 core access functions.
|
||||
* The abx500 interface is used for the Analog Baseband chip
|
||||
* ab3100, ab5500, and ab8500.
|
||||
* ab3100 and ab8500.
|
||||
*
|
||||
* Author: Mattias Wallin <mattias.wallin@stericsson.com>
|
||||
* Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com>
|
||||
@ -30,9 +30,6 @@ struct device;
|
||||
#define AB3100_P1G 0xc6
|
||||
#define AB3100_R2A 0xc7
|
||||
#define AB3100_R2B 0xc8
|
||||
#define AB5500_1_0 0x20
|
||||
#define AB5500_1_1 0x21
|
||||
#define AB5500_2_0 0x24
|
||||
|
||||
/*
|
||||
* AB3100, EVENTA1, A2 and A3 event register flags
|
||||
|
@ -1,140 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) ST-Ericsson 2011
|
||||
*
|
||||
* License Terms: GNU General Public License v2
|
||||
*/
|
||||
#ifndef MFD_AB5500_H
|
||||
#define MFD_AB5500_H
|
||||
|
||||
struct device;
|
||||
|
||||
enum ab5500_devid {
|
||||
AB5500_DEVID_ADC,
|
||||
AB5500_DEVID_LEDS,
|
||||
AB5500_DEVID_POWER,
|
||||
AB5500_DEVID_REGULATORS,
|
||||
AB5500_DEVID_SIM,
|
||||
AB5500_DEVID_RTC,
|
||||
AB5500_DEVID_CHARGER,
|
||||
AB5500_DEVID_FUELGAUGE,
|
||||
AB5500_DEVID_VIBRATOR,
|
||||
AB5500_DEVID_CODEC,
|
||||
AB5500_DEVID_USB,
|
||||
AB5500_DEVID_OTP,
|
||||
AB5500_DEVID_VIDEO,
|
||||
AB5500_DEVID_DBIECI,
|
||||
AB5500_DEVID_ONSWA,
|
||||
AB5500_NUM_DEVICES,
|
||||
};
|
||||
|
||||
enum ab5500_banks {
|
||||
AB5500_BANK_VIT_IO_I2C_CLK_TST_OTP = 0,
|
||||
AB5500_BANK_VDDDIG_IO_I2C_CLK_TST = 1,
|
||||
AB5500_BANK_VDENC = 2,
|
||||
AB5500_BANK_SIM_USBSIM = 3,
|
||||
AB5500_BANK_LED = 4,
|
||||
AB5500_BANK_ADC = 5,
|
||||
AB5500_BANK_RTC = 6,
|
||||
AB5500_BANK_STARTUP = 7,
|
||||
AB5500_BANK_DBI_ECI = 8,
|
||||
AB5500_BANK_CHG = 9,
|
||||
AB5500_BANK_FG_BATTCOM_ACC = 10,
|
||||
AB5500_BANK_USB = 11,
|
||||
AB5500_BANK_IT = 12,
|
||||
AB5500_BANK_VIBRA = 13,
|
||||
AB5500_BANK_AUDIO_HEADSETUSB = 14,
|
||||
AB5500_NUM_BANKS = 15,
|
||||
};
|
||||
|
||||
enum ab5500_banks_addr {
|
||||
AB5500_ADDR_VIT_IO_I2C_CLK_TST_OTP = 0x4A,
|
||||
AB5500_ADDR_VDDDIG_IO_I2C_CLK_TST = 0x4B,
|
||||
AB5500_ADDR_VDENC = 0x06,
|
||||
AB5500_ADDR_SIM_USBSIM = 0x04,
|
||||
AB5500_ADDR_LED = 0x10,
|
||||
AB5500_ADDR_ADC = 0x0A,
|
||||
AB5500_ADDR_RTC = 0x0F,
|
||||
AB5500_ADDR_STARTUP = 0x03,
|
||||
AB5500_ADDR_DBI_ECI = 0x07,
|
||||
AB5500_ADDR_CHG = 0x0B,
|
||||
AB5500_ADDR_FG_BATTCOM_ACC = 0x0C,
|
||||
AB5500_ADDR_USB = 0x05,
|
||||
AB5500_ADDR_IT = 0x0E,
|
||||
AB5500_ADDR_VIBRA = 0x02,
|
||||
AB5500_ADDR_AUDIO_HEADSETUSB = 0x0D,
|
||||
};
|
||||
|
||||
/*
|
||||
* Interrupt register offsets
|
||||
* Bank : 0x0E
|
||||
*/
|
||||
#define AB5500_IT_SOURCE0_REG 0x20
|
||||
#define AB5500_IT_SOURCE1_REG 0x21
|
||||
#define AB5500_IT_SOURCE2_REG 0x22
|
||||
#define AB5500_IT_SOURCE3_REG 0x23
|
||||
#define AB5500_IT_SOURCE4_REG 0x24
|
||||
#define AB5500_IT_SOURCE5_REG 0x25
|
||||
#define AB5500_IT_SOURCE6_REG 0x26
|
||||
#define AB5500_IT_SOURCE7_REG 0x27
|
||||
#define AB5500_IT_SOURCE8_REG 0x28
|
||||
#define AB5500_IT_SOURCE9_REG 0x29
|
||||
#define AB5500_IT_SOURCE10_REG 0x2A
|
||||
#define AB5500_IT_SOURCE11_REG 0x2B
|
||||
#define AB5500_IT_SOURCE12_REG 0x2C
|
||||
#define AB5500_IT_SOURCE13_REG 0x2D
|
||||
#define AB5500_IT_SOURCE14_REG 0x2E
|
||||
#define AB5500_IT_SOURCE15_REG 0x2F
|
||||
#define AB5500_IT_SOURCE16_REG 0x30
|
||||
#define AB5500_IT_SOURCE17_REG 0x31
|
||||
#define AB5500_IT_SOURCE18_REG 0x32
|
||||
#define AB5500_IT_SOURCE19_REG 0x33
|
||||
#define AB5500_IT_SOURCE20_REG 0x34
|
||||
#define AB5500_IT_SOURCE21_REG 0x35
|
||||
#define AB5500_IT_SOURCE22_REG 0x36
|
||||
#define AB5500_IT_SOURCE23_REG 0x37
|
||||
|
||||
#define AB5500_NUM_IRQ_REGS 23
|
||||
|
||||
/**
|
||||
* struct ab5500
|
||||
* @access_mutex: lock out concurrent accesses to the AB registers
|
||||
* @dev: a pointer to the device struct for this chip driver
|
||||
* @ab5500_irq: the analog baseband irq
|
||||
* @irq_base: the platform configuration irq base for subdevices
|
||||
* @chip_name: name of this chip variant
|
||||
* @chip_id: 8 bit chip ID for this chip variant
|
||||
* @irq_lock: a lock to protect the mask
|
||||
* @abb_events: a local bit mask of the prcmu wakeup events
|
||||
* @event_mask: a local copy of the mask event registers
|
||||
* @last_event_mask: a copy of the last event_mask written to hardware
|
||||
* @startup_events: a copy of the first reading of the event registers
|
||||
* @startup_events_read: whether the first events have been read
|
||||
*/
|
||||
struct ab5500 {
|
||||
struct mutex access_mutex;
|
||||
struct device *dev;
|
||||
unsigned int ab5500_irq;
|
||||
unsigned int irq_base;
|
||||
char chip_name[32];
|
||||
u8 chip_id;
|
||||
struct mutex irq_lock;
|
||||
u32 abb_events;
|
||||
u8 mask[AB5500_NUM_IRQ_REGS];
|
||||
u8 oldmask[AB5500_NUM_IRQ_REGS];
|
||||
u8 startup_events[AB5500_NUM_IRQ_REGS];
|
||||
bool startup_events_read;
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
unsigned int debug_bank;
|
||||
unsigned int debug_address;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct ab5500_platform_data {
|
||||
struct {unsigned int base; unsigned int count; } irq;
|
||||
void *dev_data[AB5500_NUM_DEVICES];
|
||||
struct abx500_init_settings *init_settings;
|
||||
unsigned int init_settings_sz;
|
||||
bool pm_power_off;
|
||||
};
|
||||
|
||||
#endif /* MFD_AB5500_H */
|
Loading…
Reference in New Issue
Block a user