2019-05-29 00:57:24 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2010-05-19 17:39:02 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) ST-Ericsson SA 2010
|
|
|
|
*
|
|
|
|
* Author: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
|
|
|
|
* Author: Rabin Vincent <rabin.vincent@stericsson.com>
|
2011-03-02 18:51:11 +08:00
|
|
|
* Author: Mattias Wallin <mattias.wallin@stericsson.com>
|
2010-05-19 17:39:02 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/irq.h>
|
2012-06-20 20:56:37 +08:00
|
|
|
#include <linux/irqdomain.h>
|
2010-05-19 17:39:02 +08:00
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/interrupt.h>
|
2016-10-30 09:24:36 +08:00
|
|
|
#include <linux/moduleparam.h>
|
2010-05-19 17:39:02 +08:00
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/mfd/core.h>
|
2010-09-10 23:47:56 +08:00
|
|
|
#include <linux/mfd/abx500.h>
|
2011-12-02 21:16:33 +08:00
|
|
|
#include <linux/mfd/abx500/ab8500.h>
|
2012-05-19 23:21:37 +08:00
|
|
|
#include <linux/mfd/dbx500-prcmu.h>
|
2012-05-17 21:45:13 +08:00
|
|
|
#include <linux/of.h>
|
|
|
|
#include <linux/of_device.h>
|
2010-05-19 17:39:02 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Interrupt register offsets
|
|
|
|
* Bank : 0x0E
|
|
|
|
*/
|
2010-09-10 23:47:56 +08:00
|
|
|
#define AB8500_IT_SOURCE1_REG 0x00
|
|
|
|
#define AB8500_IT_SOURCE2_REG 0x01
|
|
|
|
#define AB8500_IT_SOURCE3_REG 0x02
|
|
|
|
#define AB8500_IT_SOURCE4_REG 0x03
|
|
|
|
#define AB8500_IT_SOURCE5_REG 0x04
|
|
|
|
#define AB8500_IT_SOURCE6_REG 0x05
|
|
|
|
#define AB8500_IT_SOURCE7_REG 0x06
|
|
|
|
#define AB8500_IT_SOURCE8_REG 0x07
|
2012-02-21 04:42:24 +08:00
|
|
|
#define AB9540_IT_SOURCE13_REG 0x0C
|
2010-09-10 23:47:56 +08:00
|
|
|
#define AB8500_IT_SOURCE19_REG 0x12
|
|
|
|
#define AB8500_IT_SOURCE20_REG 0x13
|
|
|
|
#define AB8500_IT_SOURCE21_REG 0x14
|
|
|
|
#define AB8500_IT_SOURCE22_REG 0x15
|
|
|
|
#define AB8500_IT_SOURCE23_REG 0x16
|
|
|
|
#define AB8500_IT_SOURCE24_REG 0x17
|
2010-05-19 17:39:02 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* latch registers
|
|
|
|
*/
|
2010-09-10 23:47:56 +08:00
|
|
|
#define AB8500_IT_LATCH1_REG 0x20
|
|
|
|
#define AB8500_IT_LATCH2_REG 0x21
|
|
|
|
#define AB8500_IT_LATCH3_REG 0x22
|
|
|
|
#define AB8500_IT_LATCH4_REG 0x23
|
|
|
|
#define AB8500_IT_LATCH5_REG 0x24
|
|
|
|
#define AB8500_IT_LATCH6_REG 0x25
|
|
|
|
#define AB8500_IT_LATCH7_REG 0x26
|
|
|
|
#define AB8500_IT_LATCH8_REG 0x27
|
|
|
|
#define AB8500_IT_LATCH9_REG 0x28
|
|
|
|
#define AB8500_IT_LATCH10_REG 0x29
|
2010-12-07 18:20:47 +08:00
|
|
|
#define AB8500_IT_LATCH12_REG 0x2B
|
2012-02-21 04:42:24 +08:00
|
|
|
#define AB9540_IT_LATCH13_REG 0x2C
|
2010-09-10 23:47:56 +08:00
|
|
|
#define AB8500_IT_LATCH19_REG 0x32
|
|
|
|
#define AB8500_IT_LATCH20_REG 0x33
|
|
|
|
#define AB8500_IT_LATCH21_REG 0x34
|
|
|
|
#define AB8500_IT_LATCH22_REG 0x35
|
|
|
|
#define AB8500_IT_LATCH23_REG 0x36
|
|
|
|
#define AB8500_IT_LATCH24_REG 0x37
|
2010-05-19 17:39:02 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* mask registers
|
|
|
|
*/
|
|
|
|
|
2010-09-10 23:47:56 +08:00
|
|
|
#define AB8500_IT_MASK1_REG 0x40
|
|
|
|
#define AB8500_IT_MASK2_REG 0x41
|
|
|
|
#define AB8500_IT_MASK3_REG 0x42
|
|
|
|
#define AB8500_IT_MASK4_REG 0x43
|
|
|
|
#define AB8500_IT_MASK5_REG 0x44
|
|
|
|
#define AB8500_IT_MASK6_REG 0x45
|
|
|
|
#define AB8500_IT_MASK7_REG 0x46
|
|
|
|
#define AB8500_IT_MASK8_REG 0x47
|
|
|
|
#define AB8500_IT_MASK9_REG 0x48
|
|
|
|
#define AB8500_IT_MASK10_REG 0x49
|
|
|
|
#define AB8500_IT_MASK11_REG 0x4A
|
|
|
|
#define AB8500_IT_MASK12_REG 0x4B
|
|
|
|
#define AB8500_IT_MASK13_REG 0x4C
|
|
|
|
#define AB8500_IT_MASK14_REG 0x4D
|
|
|
|
#define AB8500_IT_MASK15_REG 0x4E
|
|
|
|
#define AB8500_IT_MASK16_REG 0x4F
|
|
|
|
#define AB8500_IT_MASK17_REG 0x50
|
|
|
|
#define AB8500_IT_MASK18_REG 0x51
|
|
|
|
#define AB8500_IT_MASK19_REG 0x52
|
|
|
|
#define AB8500_IT_MASK20_REG 0x53
|
|
|
|
#define AB8500_IT_MASK21_REG 0x54
|
|
|
|
#define AB8500_IT_MASK22_REG 0x55
|
|
|
|
#define AB8500_IT_MASK23_REG 0x56
|
|
|
|
#define AB8500_IT_MASK24_REG 0x57
|
2013-02-25 22:34:26 +08:00
|
|
|
#define AB8500_IT_MASK25_REG 0x58
|
2010-09-10 23:47:56 +08:00
|
|
|
|
2012-05-07 21:02:03 +08:00
|
|
|
/*
|
|
|
|
* latch hierarchy registers
|
|
|
|
*/
|
|
|
|
#define AB8500_IT_LATCHHIER1_REG 0x60
|
|
|
|
#define AB8500_IT_LATCHHIER2_REG 0x61
|
|
|
|
#define AB8500_IT_LATCHHIER3_REG 0x62
|
2013-02-25 22:57:35 +08:00
|
|
|
#define AB8540_IT_LATCHHIER4_REG 0x63
|
2012-05-07 21:02:03 +08:00
|
|
|
|
|
|
|
#define AB8500_IT_LATCHHIER_NUM 3
|
2013-02-25 22:57:35 +08:00
|
|
|
#define AB8540_IT_LATCHHIER_NUM 4
|
2012-05-07 21:02:03 +08:00
|
|
|
|
2010-09-10 23:47:56 +08:00
|
|
|
#define AB8500_REV_REG 0x80
|
2012-02-21 04:42:10 +08:00
|
|
|
#define AB8500_IC_NAME_REG 0x82
|
2011-03-02 18:52:36 +08:00
|
|
|
#define AB8500_SWITCH_OFF_STATUS 0x00
|
2010-05-19 17:39:02 +08:00
|
|
|
|
2011-10-11 16:49:47 +08:00
|
|
|
#define AB8500_TURN_ON_STATUS 0x00
|
2015-10-28 17:15:02 +08:00
|
|
|
#define AB8505_TURN_ON_STATUS_2 0x04
|
2011-10-11 16:49:47 +08:00
|
|
|
|
2012-05-30 19:02:37 +08:00
|
|
|
#define AB8500_CH_USBCH_STAT1_REG 0x02
|
|
|
|
#define VBUS_DET_DBNC100 0x02
|
|
|
|
#define VBUS_DET_DBNC1 0x01
|
|
|
|
|
|
|
|
static DEFINE_SPINLOCK(on_stat_lock);
|
|
|
|
static u8 turn_on_stat_mask = 0xFF;
|
|
|
|
static u8 turn_on_stat_set;
|
2012-04-17 15:30:57 +08:00
|
|
|
|
2012-02-21 04:42:24 +08:00
|
|
|
#define AB9540_MODEM_CTRL2_REG 0x23
|
|
|
|
#define AB9540_MODEM_CTRL2_SWDBBRSTN_BIT BIT(2)
|
|
|
|
|
2010-05-19 17:39:02 +08:00
|
|
|
/*
|
|
|
|
* Map interrupt numbers to the LATCH and MASK register offsets, Interrupt
|
2012-02-21 04:42:17 +08:00
|
|
|
* numbers are indexed into this array with (num / 8). The interupts are
|
|
|
|
* defined in linux/mfd/ab8500.h
|
2010-05-19 17:39:02 +08:00
|
|
|
*
|
|
|
|
* This is one off from the register names, i.e. AB8500_IT_MASK1_REG is at
|
|
|
|
* offset 0.
|
|
|
|
*/
|
2012-02-21 04:42:17 +08:00
|
|
|
/* AB8500 support */
|
2010-05-19 17:39:02 +08:00
|
|
|
static const int ab8500_irq_regoffset[AB8500_NUM_IRQ_REGS] = {
|
2010-12-07 18:20:47 +08:00
|
|
|
0, 1, 2, 3, 4, 6, 7, 8, 9, 11, 18, 19, 20, 21,
|
2010-05-19 17:39:02 +08:00
|
|
|
};
|
|
|
|
|
2013-02-25 22:34:26 +08:00
|
|
|
/* AB9540 / AB8505 support */
|
2012-02-21 04:42:24 +08:00
|
|
|
static const int ab9540_irq_regoffset[AB9540_NUM_IRQ_REGS] = {
|
2013-02-25 22:34:26 +08:00
|
|
|
0, 1, 2, 3, 4, 6, 7, 8, 9, 11, 18, 19, 20, 21, 12, 13, 24, 5, 22, 23
|
2012-02-21 04:42:24 +08:00
|
|
|
};
|
|
|
|
|
2013-02-25 22:57:35 +08:00
|
|
|
/* AB8540 support */
|
|
|
|
static const int ab8540_irq_regoffset[AB8540_NUM_IRQ_REGS] = {
|
mfd: ab8500-core: Resolve code style issues
Soothes the following checkpatch warnings:
WARNING: line over 80 characters
#151: FILE: drivers/mfd/ab8500-core.c:151:
+ 0, 1, 2, 3, 4, -1, -1, -1, -1, 11, 18, 19, 20, 21, 12, 13, 24, 5, 22, 23,
ERROR: spaces required around that '=' (ctx:VxW)
#325: FILE: drivers/mfd/ab8500-core.c:325:
+ ret= mask_and_set_register_interruptible(ab8500, bank, reg,
^
WARNING: line over 80 characters
#418: FILE: drivers/mfd/ab8500-core.c:418:
+ else if (offset >= AB9540_INT_GPIO50R && offset <= AB9540_INT_GPIO54R)
WARNING: line over 80 characters
#420: FILE: drivers/mfd/ab8500-core.c:420:
+ else if (offset == AB8540_INT_GPIO43R || offset == AB8540_INT_GPIO44R)
ERROR: spaces required around that '==' (ctx:VxV)
#454: FILE: drivers/mfd/ab8500-core.c:454:
+ if ((i==3) && (*offset >= 24))
^
ERROR: code indent should use tabs where possible
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
WARNING: please, no spaces at the start of a line
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
ERROR: code indent should use tabs where possible
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: please, no spaces at the start of a line
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: char * array declaration might be better as static const
#1554: FILE: drivers/mfd/ab8500-core.c:1554:
+ static char *switch_off_status[] = {
WARNING: char * array declaration might be better as static const
#1563: FILE: drivers/mfd/ab8500-core.c:1563:
+ static char *turn_on_status[] = {
WARNING: sizeof *ab8500 should be sizeof(*ab8500)
#1582: FILE: drivers/mfd/ab8500-core.c:1582:
+ ab8500 = devm_kzalloc(&pdev->dev, sizeof *ab8500, GFP_KERNEL);
ERROR: space required after that close brace '}'
#1639: FILE: drivers/mfd/ab8500-core.c:1639:
+ }/* Configure AB8500 or AB9540 IRQ */
WARNING: line over 80 characters
#1652: FILE: drivers/mfd/ab8500-core.c:1652:
+ ab8500->oldmask = devm_kzalloc(&pdev->dev, ab8500->mask_size, GFP_KERNEL);
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1677: FILE: drivers/mfd/ab8500-core.c:1677:
+ printk(KERN_CONT " \"%s\"",
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1682: FILE: drivers/mfd/ab8500-core.c:1682:
+ printk(KERN_CONT "\n");
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1684: FILE: drivers/mfd/ab8500-core.c:1684:
+ printk(KERN_CONT " None\n");
WARNING: printk() should include KERN_ facility level
#1695: FILE: drivers/mfd/ab8500-core.c:1695:
+ printk("\"%s\" ", turn_on_status[i]);
WARNING: printk() should include KERN_ facility level
#1700: FILE: drivers/mfd/ab8500-core.c:1700:
+ printk("None\n");
total: 5 errors, 14 warnings, 1869 lines checked
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-05-08 21:11:37 +08:00
|
|
|
0, 1, 2, 3, 4, -1, -1, -1, -1, 11, 18, 19, 20, 21, 12, 13, 24, 5, 22,
|
|
|
|
23, 25, 26, 27, 28, 29, 30, 31,
|
2013-02-25 22:57:35 +08:00
|
|
|
};
|
|
|
|
|
2012-02-21 04:42:10 +08:00
|
|
|
static const char ab8500_version_str[][7] = {
|
|
|
|
[AB8500_VERSION_AB8500] = "AB8500",
|
|
|
|
[AB8500_VERSION_AB8505] = "AB8505",
|
|
|
|
[AB8500_VERSION_AB9540] = "AB9540",
|
|
|
|
[AB8500_VERSION_AB8540] = "AB8540",
|
|
|
|
};
|
|
|
|
|
2012-06-20 20:56:38 +08:00
|
|
|
static int ab8500_prcmu_write(struct ab8500 *ab8500, u16 addr, u8 data)
|
2012-05-19 23:21:37 +08:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = prcmu_abb_write((u8)(addr >> 8), (u8)(addr & 0xFF), &data, 1);
|
|
|
|
if (ret < 0)
|
|
|
|
dev_err(ab8500->dev, "prcmu i2c error %d\n", ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-06-20 20:56:38 +08:00
|
|
|
static int ab8500_prcmu_write_masked(struct ab8500 *ab8500, u16 addr, u8 mask,
|
2012-05-19 23:21:37 +08:00
|
|
|
u8 data)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = prcmu_abb_write_masked((u8)(addr >> 8), (u8)(addr & 0xFF), &data,
|
|
|
|
&mask, 1);
|
|
|
|
if (ret < 0)
|
|
|
|
dev_err(ab8500->dev, "prcmu i2c error %d\n", ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-06-20 20:56:38 +08:00
|
|
|
static int ab8500_prcmu_read(struct ab8500 *ab8500, u16 addr)
|
2012-05-19 23:21:37 +08:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
u8 data;
|
|
|
|
|
|
|
|
ret = prcmu_abb_read((u8)(addr >> 8), (u8)(addr & 0xFF), &data, 1);
|
|
|
|
if (ret < 0) {
|
|
|
|
dev_err(ab8500->dev, "prcmu i2c error %d\n", ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
return (int)data;
|
|
|
|
}
|
|
|
|
|
2010-09-10 23:47:56 +08:00
|
|
|
static int ab8500_get_chip_id(struct device *dev)
|
|
|
|
{
|
2010-12-02 22:08:32 +08:00
|
|
|
struct ab8500 *ab8500;
|
|
|
|
|
|
|
|
if (!dev)
|
|
|
|
return -EINVAL;
|
|
|
|
ab8500 = dev_get_drvdata(dev->parent);
|
|
|
|
return ab8500 ? (int)ab8500->chip_id : -EINVAL;
|
2010-09-10 23:47:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int set_register_interruptible(struct ab8500 *ab8500, u8 bank,
|
|
|
|
u8 reg, u8 data)
|
2010-05-19 17:39:02 +08:00
|
|
|
{
|
|
|
|
int ret;
|
2010-09-10 23:47:56 +08:00
|
|
|
/*
|
|
|
|
* Put the u8 bank and u8 register together into a an u16.
|
|
|
|
* The bank on higher 8 bits and register in lower 8 bits.
|
2015-10-28 17:15:02 +08:00
|
|
|
*/
|
2010-09-10 23:47:56 +08:00
|
|
|
u16 addr = ((u16)bank) << 8 | reg;
|
2010-05-19 17:39:02 +08:00
|
|
|
|
|
|
|
dev_vdbg(ab8500->dev, "wr: addr %#x <= %#x\n", addr, data);
|
|
|
|
|
2012-03-08 21:01:46 +08:00
|
|
|
mutex_lock(&ab8500->lock);
|
2010-09-10 23:47:56 +08:00
|
|
|
|
2010-05-19 17:39:02 +08:00
|
|
|
ret = ab8500->write(ab8500, addr, data);
|
|
|
|
if (ret < 0)
|
|
|
|
dev_err(ab8500->dev, "failed to write reg %#x: %d\n",
|
|
|
|
addr, ret);
|
2010-09-10 23:47:56 +08:00
|
|
|
mutex_unlock(&ab8500->lock);
|
2010-05-19 17:39:02 +08:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-09-10 23:47:56 +08:00
|
|
|
static int ab8500_set_register(struct device *dev, u8 bank,
|
|
|
|
u8 reg, u8 value)
|
2010-05-19 17:39:02 +08:00
|
|
|
{
|
2012-04-17 15:30:33 +08:00
|
|
|
int ret;
|
2010-09-10 23:47:56 +08:00
|
|
|
struct ab8500 *ab8500 = dev_get_drvdata(dev->parent);
|
2010-05-19 17:39:02 +08:00
|
|
|
|
2012-04-17 15:30:33 +08:00
|
|
|
atomic_inc(&ab8500->transfer_ongoing);
|
|
|
|
ret = set_register_interruptible(ab8500, bank, reg, value);
|
|
|
|
atomic_dec(&ab8500->transfer_ongoing);
|
|
|
|
return ret;
|
2010-05-19 17:39:02 +08:00
|
|
|
}
|
|
|
|
|
2010-09-10 23:47:56 +08:00
|
|
|
static int get_register_interruptible(struct ab8500 *ab8500, u8 bank,
|
|
|
|
u8 reg, u8 *value)
|
2010-05-19 17:39:02 +08:00
|
|
|
{
|
|
|
|
int ret;
|
2010-09-10 23:47:56 +08:00
|
|
|
u16 addr = ((u16)bank) << 8 | reg;
|
|
|
|
|
2012-03-08 21:01:46 +08:00
|
|
|
mutex_lock(&ab8500->lock);
|
2010-05-19 17:39:02 +08:00
|
|
|
|
|
|
|
ret = ab8500->read(ab8500, addr);
|
|
|
|
if (ret < 0)
|
|
|
|
dev_err(ab8500->dev, "failed to read reg %#x: %d\n",
|
|
|
|
addr, ret);
|
2010-09-10 23:47:56 +08:00
|
|
|
else
|
|
|
|
*value = ret;
|
2010-05-19 17:39:02 +08:00
|
|
|
|
2010-09-10 23:47:56 +08:00
|
|
|
mutex_unlock(&ab8500->lock);
|
2010-05-19 17:39:02 +08:00
|
|
|
dev_vdbg(ab8500->dev, "rd: addr %#x => data %#x\n", addr, ret);
|
|
|
|
|
2018-10-25 20:43:44 +08:00
|
|
|
return (ret < 0) ? ret : 0;
|
2010-05-19 17:39:02 +08:00
|
|
|
}
|
|
|
|
|
2010-09-10 23:47:56 +08:00
|
|
|
static int ab8500_get_register(struct device *dev, u8 bank,
|
|
|
|
u8 reg, u8 *value)
|
2010-05-19 17:39:02 +08:00
|
|
|
{
|
2012-04-17 15:30:33 +08:00
|
|
|
int ret;
|
2010-09-10 23:47:56 +08:00
|
|
|
struct ab8500 *ab8500 = dev_get_drvdata(dev->parent);
|
2010-05-19 17:39:02 +08:00
|
|
|
|
2012-04-17 15:30:33 +08:00
|
|
|
atomic_inc(&ab8500->transfer_ongoing);
|
|
|
|
ret = get_register_interruptible(ab8500, bank, reg, value);
|
|
|
|
atomic_dec(&ab8500->transfer_ongoing);
|
|
|
|
return ret;
|
2010-05-19 17:39:02 +08:00
|
|
|
}
|
2010-09-10 23:47:56 +08:00
|
|
|
|
|
|
|
static int mask_and_set_register_interruptible(struct ab8500 *ab8500, u8 bank,
|
|
|
|
u8 reg, u8 bitmask, u8 bitvalues)
|
2010-05-19 17:39:02 +08:00
|
|
|
{
|
|
|
|
int ret;
|
2010-09-10 23:47:56 +08:00
|
|
|
u16 addr = ((u16)bank) << 8 | reg;
|
2010-05-19 17:39:02 +08:00
|
|
|
|
2012-03-08 21:01:46 +08:00
|
|
|
mutex_lock(&ab8500->lock);
|
2010-05-19 17:39:02 +08:00
|
|
|
|
2012-03-08 21:02:20 +08:00
|
|
|
if (ab8500->write_masked == NULL) {
|
|
|
|
u8 data;
|
2010-05-19 17:39:02 +08:00
|
|
|
|
2012-03-08 21:02:20 +08:00
|
|
|
ret = ab8500->read(ab8500, addr);
|
|
|
|
if (ret < 0) {
|
|
|
|
dev_err(ab8500->dev, "failed to read reg %#x: %d\n",
|
|
|
|
addr, ret);
|
|
|
|
goto out;
|
|
|
|
}
|
2010-05-19 17:39:02 +08:00
|
|
|
|
2012-03-08 21:02:20 +08:00
|
|
|
data = (u8)ret;
|
|
|
|
data = (~bitmask & data) | (bitmask & bitvalues);
|
|
|
|
|
|
|
|
ret = ab8500->write(ab8500, addr, data);
|
|
|
|
if (ret < 0)
|
|
|
|
dev_err(ab8500->dev, "failed to write reg %#x: %d\n",
|
|
|
|
addr, ret);
|
2010-05-19 17:39:02 +08:00
|
|
|
|
2012-03-08 21:02:20 +08:00
|
|
|
dev_vdbg(ab8500->dev, "mask: addr %#x => data %#x\n", addr,
|
|
|
|
data);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
ret = ab8500->write_masked(ab8500, addr, bitmask, bitvalues);
|
|
|
|
if (ret < 0)
|
|
|
|
dev_err(ab8500->dev, "failed to modify reg %#x: %d\n", addr,
|
|
|
|
ret);
|
2010-05-19 17:39:02 +08:00
|
|
|
out:
|
|
|
|
mutex_unlock(&ab8500->lock);
|
|
|
|
return ret;
|
|
|
|
}
|
2010-09-10 23:47:56 +08:00
|
|
|
|
|
|
|
static int ab8500_mask_and_set_register(struct device *dev,
|
|
|
|
u8 bank, u8 reg, u8 bitmask, u8 bitvalues)
|
|
|
|
{
|
2012-04-17 15:30:33 +08:00
|
|
|
int ret;
|
2010-09-10 23:47:56 +08:00
|
|
|
struct ab8500 *ab8500 = dev_get_drvdata(dev->parent);
|
|
|
|
|
2012-04-17 15:30:33 +08:00
|
|
|
atomic_inc(&ab8500->transfer_ongoing);
|
mfd: ab8500-core: Resolve code style issues
Soothes the following checkpatch warnings:
WARNING: line over 80 characters
#151: FILE: drivers/mfd/ab8500-core.c:151:
+ 0, 1, 2, 3, 4, -1, -1, -1, -1, 11, 18, 19, 20, 21, 12, 13, 24, 5, 22, 23,
ERROR: spaces required around that '=' (ctx:VxW)
#325: FILE: drivers/mfd/ab8500-core.c:325:
+ ret= mask_and_set_register_interruptible(ab8500, bank, reg,
^
WARNING: line over 80 characters
#418: FILE: drivers/mfd/ab8500-core.c:418:
+ else if (offset >= AB9540_INT_GPIO50R && offset <= AB9540_INT_GPIO54R)
WARNING: line over 80 characters
#420: FILE: drivers/mfd/ab8500-core.c:420:
+ else if (offset == AB8540_INT_GPIO43R || offset == AB8540_INT_GPIO44R)
ERROR: spaces required around that '==' (ctx:VxV)
#454: FILE: drivers/mfd/ab8500-core.c:454:
+ if ((i==3) && (*offset >= 24))
^
ERROR: code indent should use tabs where possible
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
WARNING: please, no spaces at the start of a line
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
ERROR: code indent should use tabs where possible
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: please, no spaces at the start of a line
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: char * array declaration might be better as static const
#1554: FILE: drivers/mfd/ab8500-core.c:1554:
+ static char *switch_off_status[] = {
WARNING: char * array declaration might be better as static const
#1563: FILE: drivers/mfd/ab8500-core.c:1563:
+ static char *turn_on_status[] = {
WARNING: sizeof *ab8500 should be sizeof(*ab8500)
#1582: FILE: drivers/mfd/ab8500-core.c:1582:
+ ab8500 = devm_kzalloc(&pdev->dev, sizeof *ab8500, GFP_KERNEL);
ERROR: space required after that close brace '}'
#1639: FILE: drivers/mfd/ab8500-core.c:1639:
+ }/* Configure AB8500 or AB9540 IRQ */
WARNING: line over 80 characters
#1652: FILE: drivers/mfd/ab8500-core.c:1652:
+ ab8500->oldmask = devm_kzalloc(&pdev->dev, ab8500->mask_size, GFP_KERNEL);
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1677: FILE: drivers/mfd/ab8500-core.c:1677:
+ printk(KERN_CONT " \"%s\"",
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1682: FILE: drivers/mfd/ab8500-core.c:1682:
+ printk(KERN_CONT "\n");
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1684: FILE: drivers/mfd/ab8500-core.c:1684:
+ printk(KERN_CONT " None\n");
WARNING: printk() should include KERN_ facility level
#1695: FILE: drivers/mfd/ab8500-core.c:1695:
+ printk("\"%s\" ", turn_on_status[i]);
WARNING: printk() should include KERN_ facility level
#1700: FILE: drivers/mfd/ab8500-core.c:1700:
+ printk("None\n");
total: 5 errors, 14 warnings, 1869 lines checked
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-05-08 21:11:37 +08:00
|
|
|
ret = mask_and_set_register_interruptible(ab8500, bank, reg,
|
2012-04-17 15:30:33 +08:00
|
|
|
bitmask, bitvalues);
|
|
|
|
atomic_dec(&ab8500->transfer_ongoing);
|
|
|
|
return ret;
|
2010-09-10 23:47:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct abx500_ops ab8500_ops = {
|
|
|
|
.get_chip_id = ab8500_get_chip_id,
|
|
|
|
.get_register = ab8500_get_register,
|
|
|
|
.set_register = ab8500_set_register,
|
|
|
|
.get_register_page = NULL,
|
|
|
|
.set_register_page = NULL,
|
|
|
|
.mask_and_set_register = ab8500_mask_and_set_register,
|
|
|
|
.event_registers_startup_state_get = NULL,
|
|
|
|
.startup_irq_enabled = NULL,
|
2012-01-27 18:35:41 +08:00
|
|
|
.dump_all_banks = ab8500_dump_all_banks,
|
2010-09-10 23:47:56 +08:00
|
|
|
};
|
2010-05-19 17:39:02 +08:00
|
|
|
|
2010-12-11 21:16:08 +08:00
|
|
|
static void ab8500_irq_lock(struct irq_data *data)
|
2010-05-19 17:39:02 +08:00
|
|
|
{
|
2010-12-11 21:16:08 +08:00
|
|
|
struct ab8500 *ab8500 = irq_data_get_irq_chip_data(data);
|
2010-05-19 17:39:02 +08:00
|
|
|
|
|
|
|
mutex_lock(&ab8500->irq_lock);
|
2012-04-17 15:30:33 +08:00
|
|
|
atomic_inc(&ab8500->transfer_ongoing);
|
2010-05-19 17:39:02 +08:00
|
|
|
}
|
|
|
|
|
2010-12-11 21:16:08 +08:00
|
|
|
static void ab8500_irq_sync_unlock(struct irq_data *data)
|
2010-05-19 17:39:02 +08:00
|
|
|
{
|
2010-12-11 21:16:08 +08:00
|
|
|
struct ab8500 *ab8500 = irq_data_get_irq_chip_data(data);
|
2010-05-19 17:39:02 +08:00
|
|
|
int i;
|
|
|
|
|
2012-02-21 04:42:17 +08:00
|
|
|
for (i = 0; i < ab8500->mask_size; i++) {
|
2010-05-19 17:39:02 +08:00
|
|
|
u8 old = ab8500->oldmask[i];
|
|
|
|
u8 new = ab8500->mask[i];
|
|
|
|
int reg;
|
|
|
|
|
|
|
|
if (new == old)
|
|
|
|
continue;
|
|
|
|
|
2012-02-21 04:42:10 +08:00
|
|
|
/*
|
|
|
|
* Interrupt register 12 doesn't exist prior to AB8500 version
|
|
|
|
* 2.0
|
|
|
|
*/
|
|
|
|
if (ab8500->irq_reg_offset[i] == 11 &&
|
|
|
|
is_ab8500_1p1_or_earlier(ab8500))
|
2010-12-07 18:20:47 +08:00
|
|
|
continue;
|
|
|
|
|
2013-02-25 22:57:35 +08:00
|
|
|
if (ab8500->irq_reg_offset[i] < 0)
|
|
|
|
continue;
|
|
|
|
|
2010-05-19 17:39:02 +08:00
|
|
|
ab8500->oldmask[i] = new;
|
|
|
|
|
2012-02-21 04:42:17 +08:00
|
|
|
reg = AB8500_IT_MASK1_REG + ab8500->irq_reg_offset[i];
|
2010-09-10 23:47:56 +08:00
|
|
|
set_register_interruptible(ab8500, AB8500_INTERRUPT, reg, new);
|
2010-05-19 17:39:02 +08:00
|
|
|
}
|
2012-04-17 15:30:33 +08:00
|
|
|
atomic_dec(&ab8500->transfer_ongoing);
|
2010-05-19 17:39:02 +08:00
|
|
|
mutex_unlock(&ab8500->irq_lock);
|
|
|
|
}
|
|
|
|
|
2010-12-11 21:16:08 +08:00
|
|
|
static void ab8500_irq_mask(struct irq_data *data)
|
2010-05-19 17:39:02 +08:00
|
|
|
{
|
2010-12-11 21:16:08 +08:00
|
|
|
struct ab8500 *ab8500 = irq_data_get_irq_chip_data(data);
|
2012-06-20 20:56:37 +08:00
|
|
|
int offset = data->hwirq;
|
2010-05-19 17:39:02 +08:00
|
|
|
int index = offset / 8;
|
|
|
|
int mask = 1 << (offset % 8);
|
|
|
|
|
|
|
|
ab8500->mask[index] |= mask;
|
2012-12-20 19:23:42 +08:00
|
|
|
|
|
|
|
/* The AB8500 GPIOs have two interrupts each (rising & falling). */
|
|
|
|
if (offset >= AB8500_INT_GPIO6R && offset <= AB8500_INT_GPIO41R)
|
|
|
|
ab8500->mask[index + 2] |= mask;
|
|
|
|
if (offset >= AB9540_INT_GPIO50R && offset <= AB9540_INT_GPIO54R)
|
|
|
|
ab8500->mask[index + 1] |= mask;
|
|
|
|
if (offset == AB8540_INT_GPIO43R || offset == AB8540_INT_GPIO44R)
|
2013-02-07 04:54:34 +08:00
|
|
|
/* Here the falling IRQ is one bit lower */
|
|
|
|
ab8500->mask[index] |= (mask << 1);
|
2010-05-19 17:39:02 +08:00
|
|
|
}
|
|
|
|
|
2010-12-11 21:16:08 +08:00
|
|
|
static void ab8500_irq_unmask(struct irq_data *data)
|
2010-05-19 17:39:02 +08:00
|
|
|
{
|
2010-12-11 21:16:08 +08:00
|
|
|
struct ab8500 *ab8500 = irq_data_get_irq_chip_data(data);
|
2012-12-20 19:23:42 +08:00
|
|
|
unsigned int type = irqd_get_trigger_type(data);
|
2012-06-20 20:56:37 +08:00
|
|
|
int offset = data->hwirq;
|
2010-05-19 17:39:02 +08:00
|
|
|
int index = offset / 8;
|
|
|
|
int mask = 1 << (offset % 8);
|
|
|
|
|
2012-12-20 19:23:42 +08:00
|
|
|
if (type & IRQ_TYPE_EDGE_RISING)
|
|
|
|
ab8500->mask[index] &= ~mask;
|
|
|
|
|
|
|
|
/* The AB8500 GPIOs have two interrupts each (rising & falling). */
|
|
|
|
if (type & IRQ_TYPE_EDGE_FALLING) {
|
|
|
|
if (offset >= AB8500_INT_GPIO6R && offset <= AB8500_INT_GPIO41R)
|
|
|
|
ab8500->mask[index + 2] &= ~mask;
|
mfd: ab8500-core: Resolve code style issues
Soothes the following checkpatch warnings:
WARNING: line over 80 characters
#151: FILE: drivers/mfd/ab8500-core.c:151:
+ 0, 1, 2, 3, 4, -1, -1, -1, -1, 11, 18, 19, 20, 21, 12, 13, 24, 5, 22, 23,
ERROR: spaces required around that '=' (ctx:VxW)
#325: FILE: drivers/mfd/ab8500-core.c:325:
+ ret= mask_and_set_register_interruptible(ab8500, bank, reg,
^
WARNING: line over 80 characters
#418: FILE: drivers/mfd/ab8500-core.c:418:
+ else if (offset >= AB9540_INT_GPIO50R && offset <= AB9540_INT_GPIO54R)
WARNING: line over 80 characters
#420: FILE: drivers/mfd/ab8500-core.c:420:
+ else if (offset == AB8540_INT_GPIO43R || offset == AB8540_INT_GPIO44R)
ERROR: spaces required around that '==' (ctx:VxV)
#454: FILE: drivers/mfd/ab8500-core.c:454:
+ if ((i==3) && (*offset >= 24))
^
ERROR: code indent should use tabs where possible
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
WARNING: please, no spaces at the start of a line
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
ERROR: code indent should use tabs where possible
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: please, no spaces at the start of a line
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: char * array declaration might be better as static const
#1554: FILE: drivers/mfd/ab8500-core.c:1554:
+ static char *switch_off_status[] = {
WARNING: char * array declaration might be better as static const
#1563: FILE: drivers/mfd/ab8500-core.c:1563:
+ static char *turn_on_status[] = {
WARNING: sizeof *ab8500 should be sizeof(*ab8500)
#1582: FILE: drivers/mfd/ab8500-core.c:1582:
+ ab8500 = devm_kzalloc(&pdev->dev, sizeof *ab8500, GFP_KERNEL);
ERROR: space required after that close brace '}'
#1639: FILE: drivers/mfd/ab8500-core.c:1639:
+ }/* Configure AB8500 or AB9540 IRQ */
WARNING: line over 80 characters
#1652: FILE: drivers/mfd/ab8500-core.c:1652:
+ ab8500->oldmask = devm_kzalloc(&pdev->dev, ab8500->mask_size, GFP_KERNEL);
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1677: FILE: drivers/mfd/ab8500-core.c:1677:
+ printk(KERN_CONT " \"%s\"",
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1682: FILE: drivers/mfd/ab8500-core.c:1682:
+ printk(KERN_CONT "\n");
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1684: FILE: drivers/mfd/ab8500-core.c:1684:
+ printk(KERN_CONT " None\n");
WARNING: printk() should include KERN_ facility level
#1695: FILE: drivers/mfd/ab8500-core.c:1695:
+ printk("\"%s\" ", turn_on_status[i]);
WARNING: printk() should include KERN_ facility level
#1700: FILE: drivers/mfd/ab8500-core.c:1700:
+ printk("None\n");
total: 5 errors, 14 warnings, 1869 lines checked
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-05-08 21:11:37 +08:00
|
|
|
else if (offset >= AB9540_INT_GPIO50R &&
|
|
|
|
offset <= AB9540_INT_GPIO54R)
|
2012-12-20 19:23:42 +08:00
|
|
|
ab8500->mask[index + 1] &= ~mask;
|
mfd: ab8500-core: Resolve code style issues
Soothes the following checkpatch warnings:
WARNING: line over 80 characters
#151: FILE: drivers/mfd/ab8500-core.c:151:
+ 0, 1, 2, 3, 4, -1, -1, -1, -1, 11, 18, 19, 20, 21, 12, 13, 24, 5, 22, 23,
ERROR: spaces required around that '=' (ctx:VxW)
#325: FILE: drivers/mfd/ab8500-core.c:325:
+ ret= mask_and_set_register_interruptible(ab8500, bank, reg,
^
WARNING: line over 80 characters
#418: FILE: drivers/mfd/ab8500-core.c:418:
+ else if (offset >= AB9540_INT_GPIO50R && offset <= AB9540_INT_GPIO54R)
WARNING: line over 80 characters
#420: FILE: drivers/mfd/ab8500-core.c:420:
+ else if (offset == AB8540_INT_GPIO43R || offset == AB8540_INT_GPIO44R)
ERROR: spaces required around that '==' (ctx:VxV)
#454: FILE: drivers/mfd/ab8500-core.c:454:
+ if ((i==3) && (*offset >= 24))
^
ERROR: code indent should use tabs where possible
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
WARNING: please, no spaces at the start of a line
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
ERROR: code indent should use tabs where possible
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: please, no spaces at the start of a line
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: char * array declaration might be better as static const
#1554: FILE: drivers/mfd/ab8500-core.c:1554:
+ static char *switch_off_status[] = {
WARNING: char * array declaration might be better as static const
#1563: FILE: drivers/mfd/ab8500-core.c:1563:
+ static char *turn_on_status[] = {
WARNING: sizeof *ab8500 should be sizeof(*ab8500)
#1582: FILE: drivers/mfd/ab8500-core.c:1582:
+ ab8500 = devm_kzalloc(&pdev->dev, sizeof *ab8500, GFP_KERNEL);
ERROR: space required after that close brace '}'
#1639: FILE: drivers/mfd/ab8500-core.c:1639:
+ }/* Configure AB8500 or AB9540 IRQ */
WARNING: line over 80 characters
#1652: FILE: drivers/mfd/ab8500-core.c:1652:
+ ab8500->oldmask = devm_kzalloc(&pdev->dev, ab8500->mask_size, GFP_KERNEL);
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1677: FILE: drivers/mfd/ab8500-core.c:1677:
+ printk(KERN_CONT " \"%s\"",
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1682: FILE: drivers/mfd/ab8500-core.c:1682:
+ printk(KERN_CONT "\n");
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1684: FILE: drivers/mfd/ab8500-core.c:1684:
+ printk(KERN_CONT " None\n");
WARNING: printk() should include KERN_ facility level
#1695: FILE: drivers/mfd/ab8500-core.c:1695:
+ printk("\"%s\" ", turn_on_status[i]);
WARNING: printk() should include KERN_ facility level
#1700: FILE: drivers/mfd/ab8500-core.c:1700:
+ printk("None\n");
total: 5 errors, 14 warnings, 1869 lines checked
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-05-08 21:11:37 +08:00
|
|
|
else if (offset == AB8540_INT_GPIO43R ||
|
|
|
|
offset == AB8540_INT_GPIO44R)
|
2013-02-07 04:54:34 +08:00
|
|
|
/* Here the falling IRQ is one bit lower */
|
|
|
|
ab8500->mask[index] &= ~(mask << 1);
|
2012-12-20 19:23:42 +08:00
|
|
|
else
|
|
|
|
ab8500->mask[index] &= ~mask;
|
2013-02-07 04:54:34 +08:00
|
|
|
} else {
|
2012-12-20 19:23:42 +08:00
|
|
|
/* Satisfies the case where type is not set. */
|
|
|
|
ab8500->mask[index] &= ~mask;
|
2013-02-07 04:54:34 +08:00
|
|
|
}
|
2010-05-19 17:39:02 +08:00
|
|
|
}
|
|
|
|
|
2013-01-07 20:23:48 +08:00
|
|
|
static int ab8500_irq_set_type(struct irq_data *data, unsigned int type)
|
|
|
|
{
|
|
|
|
return 0;
|
2010-05-19 17:39:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct irq_chip ab8500_irq_chip = {
|
|
|
|
.name = "ab8500",
|
2010-12-11 21:16:08 +08:00
|
|
|
.irq_bus_lock = ab8500_irq_lock,
|
|
|
|
.irq_bus_sync_unlock = ab8500_irq_sync_unlock,
|
|
|
|
.irq_mask = ab8500_irq_mask,
|
2011-10-11 16:49:17 +08:00
|
|
|
.irq_disable = ab8500_irq_mask,
|
2010-12-11 21:16:08 +08:00
|
|
|
.irq_unmask = ab8500_irq_unmask,
|
2013-01-07 20:23:48 +08:00
|
|
|
.irq_set_type = ab8500_irq_set_type,
|
2010-05-19 17:39:02 +08:00
|
|
|
};
|
|
|
|
|
2013-02-25 22:57:35 +08:00
|
|
|
static void update_latch_offset(u8 *offset, int i)
|
|
|
|
{
|
|
|
|
/* Fix inconsistent ITFromLatch25 bit mapping... */
|
|
|
|
if (unlikely(*offset == 17))
|
2015-10-28 17:15:02 +08:00
|
|
|
*offset = 24;
|
2013-02-25 22:57:35 +08:00
|
|
|
/* Fix inconsistent ab8540 bit mapping... */
|
|
|
|
if (unlikely(*offset == 16))
|
2015-10-28 17:15:02 +08:00
|
|
|
*offset = 25;
|
mfd: ab8500-core: Resolve code style issues
Soothes the following checkpatch warnings:
WARNING: line over 80 characters
#151: FILE: drivers/mfd/ab8500-core.c:151:
+ 0, 1, 2, 3, 4, -1, -1, -1, -1, 11, 18, 19, 20, 21, 12, 13, 24, 5, 22, 23,
ERROR: spaces required around that '=' (ctx:VxW)
#325: FILE: drivers/mfd/ab8500-core.c:325:
+ ret= mask_and_set_register_interruptible(ab8500, bank, reg,
^
WARNING: line over 80 characters
#418: FILE: drivers/mfd/ab8500-core.c:418:
+ else if (offset >= AB9540_INT_GPIO50R && offset <= AB9540_INT_GPIO54R)
WARNING: line over 80 characters
#420: FILE: drivers/mfd/ab8500-core.c:420:
+ else if (offset == AB8540_INT_GPIO43R || offset == AB8540_INT_GPIO44R)
ERROR: spaces required around that '==' (ctx:VxV)
#454: FILE: drivers/mfd/ab8500-core.c:454:
+ if ((i==3) && (*offset >= 24))
^
ERROR: code indent should use tabs where possible
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
WARNING: please, no spaces at the start of a line
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
ERROR: code indent should use tabs where possible
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: please, no spaces at the start of a line
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: char * array declaration might be better as static const
#1554: FILE: drivers/mfd/ab8500-core.c:1554:
+ static char *switch_off_status[] = {
WARNING: char * array declaration might be better as static const
#1563: FILE: drivers/mfd/ab8500-core.c:1563:
+ static char *turn_on_status[] = {
WARNING: sizeof *ab8500 should be sizeof(*ab8500)
#1582: FILE: drivers/mfd/ab8500-core.c:1582:
+ ab8500 = devm_kzalloc(&pdev->dev, sizeof *ab8500, GFP_KERNEL);
ERROR: space required after that close brace '}'
#1639: FILE: drivers/mfd/ab8500-core.c:1639:
+ }/* Configure AB8500 or AB9540 IRQ */
WARNING: line over 80 characters
#1652: FILE: drivers/mfd/ab8500-core.c:1652:
+ ab8500->oldmask = devm_kzalloc(&pdev->dev, ab8500->mask_size, GFP_KERNEL);
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1677: FILE: drivers/mfd/ab8500-core.c:1677:
+ printk(KERN_CONT " \"%s\"",
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1682: FILE: drivers/mfd/ab8500-core.c:1682:
+ printk(KERN_CONT "\n");
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1684: FILE: drivers/mfd/ab8500-core.c:1684:
+ printk(KERN_CONT " None\n");
WARNING: printk() should include KERN_ facility level
#1695: FILE: drivers/mfd/ab8500-core.c:1695:
+ printk("\"%s\" ", turn_on_status[i]);
WARNING: printk() should include KERN_ facility level
#1700: FILE: drivers/mfd/ab8500-core.c:1700:
+ printk("None\n");
total: 5 errors, 14 warnings, 1869 lines checked
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-05-08 21:11:37 +08:00
|
|
|
if ((i == 3) && (*offset >= 24))
|
2015-10-28 17:15:02 +08:00
|
|
|
*offset += 2;
|
2013-02-25 22:57:35 +08:00
|
|
|
}
|
|
|
|
|
2012-05-07 21:02:03 +08:00
|
|
|
static int ab8500_handle_hierarchical_line(struct ab8500 *ab8500,
|
|
|
|
int latch_offset, u8 latch_val)
|
|
|
|
{
|
2013-03-21 21:49:44 +08:00
|
|
|
int int_bit, line, i;
|
2012-05-07 21:02:03 +08:00
|
|
|
|
2013-03-21 21:49:44 +08:00
|
|
|
for (i = 0; i < ab8500->mask_size; i++)
|
|
|
|
if (ab8500->irq_reg_offset[i] == latch_offset)
|
|
|
|
break;
|
2012-05-07 21:02:03 +08:00
|
|
|
|
2013-03-21 21:49:44 +08:00
|
|
|
if (i >= ab8500->mask_size) {
|
|
|
|
dev_err(ab8500->dev, "Register offset 0x%2x not declared\n",
|
|
|
|
latch_offset);
|
|
|
|
return -ENXIO;
|
|
|
|
}
|
2012-05-07 21:02:03 +08:00
|
|
|
|
2013-03-21 21:49:44 +08:00
|
|
|
/* ignore masked out interrupts */
|
|
|
|
latch_val &= ~ab8500->mask[i];
|
2012-05-07 21:02:03 +08:00
|
|
|
|
2013-03-21 21:49:44 +08:00
|
|
|
while (latch_val) {
|
|
|
|
int_bit = __ffs(latch_val);
|
2012-05-07 21:02:03 +08:00
|
|
|
line = (i << 3) + int_bit;
|
|
|
|
latch_val &= ~(1 << int_bit);
|
|
|
|
|
2013-02-07 04:54:34 +08:00
|
|
|
/*
|
|
|
|
* This handles the falling edge hwirqs from the GPIO
|
|
|
|
* lines. Route them back to the line registered for the
|
|
|
|
* rising IRQ, as this is merely a flag for the same IRQ
|
|
|
|
* in linux terms.
|
|
|
|
*/
|
|
|
|
if (line >= AB8500_INT_GPIO6F && line <= AB8500_INT_GPIO41F)
|
|
|
|
line -= 16;
|
|
|
|
if (line >= AB9540_INT_GPIO50F && line <= AB9540_INT_GPIO54F)
|
|
|
|
line -= 8;
|
|
|
|
if (line == AB8540_INT_GPIO43F || line == AB8540_INT_GPIO44F)
|
|
|
|
line += 1;
|
|
|
|
|
2021-07-26 02:07:54 +08:00
|
|
|
handle_nested_irq(irq_find_mapping(ab8500->domain, line));
|
2013-03-21 21:49:44 +08:00
|
|
|
}
|
2012-05-07 21:02:03 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ab8500_handle_hierarchical_latch(struct ab8500 *ab8500,
|
|
|
|
int hier_offset, u8 hier_val)
|
|
|
|
{
|
|
|
|
int latch_bit, status;
|
|
|
|
u8 latch_offset, latch_val;
|
|
|
|
|
|
|
|
do {
|
|
|
|
latch_bit = __ffs(hier_val);
|
|
|
|
latch_offset = (hier_offset << 3) + latch_bit;
|
|
|
|
|
2013-02-25 22:57:35 +08:00
|
|
|
update_latch_offset(&latch_offset, hier_offset);
|
2012-05-07 21:02:03 +08:00
|
|
|
|
|
|
|
status = get_register_interruptible(ab8500,
|
|
|
|
AB8500_INTERRUPT,
|
|
|
|
AB8500_IT_LATCH1_REG + latch_offset,
|
|
|
|
&latch_val);
|
|
|
|
if (status < 0 || latch_val == 0)
|
|
|
|
goto discard;
|
|
|
|
|
|
|
|
status = ab8500_handle_hierarchical_line(ab8500,
|
|
|
|
latch_offset, latch_val);
|
|
|
|
if (status < 0)
|
|
|
|
return status;
|
|
|
|
discard:
|
|
|
|
hier_val &= ~(1 << latch_bit);
|
|
|
|
} while (hier_val);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static irqreturn_t ab8500_hierarchical_irq(int irq, void *dev)
|
|
|
|
{
|
|
|
|
struct ab8500 *ab8500 = dev;
|
|
|
|
u8 i;
|
|
|
|
|
|
|
|
dev_vdbg(ab8500->dev, "interrupt\n");
|
|
|
|
|
|
|
|
/* Hierarchical interrupt version */
|
2013-02-25 22:57:35 +08:00
|
|
|
for (i = 0; i < (ab8500->it_latchhier_num); i++) {
|
2012-05-07 21:02:03 +08:00
|
|
|
int status;
|
|
|
|
u8 hier_val;
|
|
|
|
|
|
|
|
status = get_register_interruptible(ab8500, AB8500_INTERRUPT,
|
|
|
|
AB8500_IT_LATCHHIER1_REG + i, &hier_val);
|
|
|
|
if (status < 0 || hier_val == 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
status = ab8500_handle_hierarchical_latch(ab8500, i, hier_val);
|
|
|
|
if (status < 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
2012-06-20 20:56:37 +08:00
|
|
|
static int ab8500_irq_map(struct irq_domain *d, unsigned int virq,
|
|
|
|
irq_hw_number_t hwirq)
|
|
|
|
{
|
|
|
|
struct ab8500 *ab8500 = d->host_data;
|
|
|
|
|
|
|
|
if (!ab8500)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
irq_set_chip_data(virq, ab8500);
|
|
|
|
irq_set_chip_and_handler(virq, &ab8500_irq_chip,
|
|
|
|
handle_simple_irq);
|
|
|
|
irq_set_nested_thread(virq, 1);
|
|
|
|
irq_set_noprobe(virq);
|
2010-05-19 17:39:02 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-04-27 20:54:13 +08:00
|
|
|
static const struct irq_domain_ops ab8500_irq_ops = {
|
mfd: ab8500-core: Resolve code style issues
Soothes the following checkpatch warnings:
WARNING: line over 80 characters
#151: FILE: drivers/mfd/ab8500-core.c:151:
+ 0, 1, 2, 3, 4, -1, -1, -1, -1, 11, 18, 19, 20, 21, 12, 13, 24, 5, 22, 23,
ERROR: spaces required around that '=' (ctx:VxW)
#325: FILE: drivers/mfd/ab8500-core.c:325:
+ ret= mask_and_set_register_interruptible(ab8500, bank, reg,
^
WARNING: line over 80 characters
#418: FILE: drivers/mfd/ab8500-core.c:418:
+ else if (offset >= AB9540_INT_GPIO50R && offset <= AB9540_INT_GPIO54R)
WARNING: line over 80 characters
#420: FILE: drivers/mfd/ab8500-core.c:420:
+ else if (offset == AB8540_INT_GPIO43R || offset == AB8540_INT_GPIO44R)
ERROR: spaces required around that '==' (ctx:VxV)
#454: FILE: drivers/mfd/ab8500-core.c:454:
+ if ((i==3) && (*offset >= 24))
^
ERROR: code indent should use tabs where possible
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
WARNING: please, no spaces at the start of a line
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
ERROR: code indent should use tabs where possible
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: please, no spaces at the start of a line
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: char * array declaration might be better as static const
#1554: FILE: drivers/mfd/ab8500-core.c:1554:
+ static char *switch_off_status[] = {
WARNING: char * array declaration might be better as static const
#1563: FILE: drivers/mfd/ab8500-core.c:1563:
+ static char *turn_on_status[] = {
WARNING: sizeof *ab8500 should be sizeof(*ab8500)
#1582: FILE: drivers/mfd/ab8500-core.c:1582:
+ ab8500 = devm_kzalloc(&pdev->dev, sizeof *ab8500, GFP_KERNEL);
ERROR: space required after that close brace '}'
#1639: FILE: drivers/mfd/ab8500-core.c:1639:
+ }/* Configure AB8500 or AB9540 IRQ */
WARNING: line over 80 characters
#1652: FILE: drivers/mfd/ab8500-core.c:1652:
+ ab8500->oldmask = devm_kzalloc(&pdev->dev, ab8500->mask_size, GFP_KERNEL);
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1677: FILE: drivers/mfd/ab8500-core.c:1677:
+ printk(KERN_CONT " \"%s\"",
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1682: FILE: drivers/mfd/ab8500-core.c:1682:
+ printk(KERN_CONT "\n");
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1684: FILE: drivers/mfd/ab8500-core.c:1684:
+ printk(KERN_CONT " None\n");
WARNING: printk() should include KERN_ facility level
#1695: FILE: drivers/mfd/ab8500-core.c:1695:
+ printk("\"%s\" ", turn_on_status[i]);
WARNING: printk() should include KERN_ facility level
#1700: FILE: drivers/mfd/ab8500-core.c:1700:
+ printk("None\n");
total: 5 errors, 14 warnings, 1869 lines checked
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-05-08 21:11:37 +08:00
|
|
|
.map = ab8500_irq_map,
|
|
|
|
.xlate = irq_domain_xlate_twocell,
|
2012-06-20 20:56:37 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static int ab8500_irq_init(struct ab8500 *ab8500, struct device_node *np)
|
2010-05-19 17:39:02 +08:00
|
|
|
{
|
2012-02-21 04:42:17 +08:00
|
|
|
int num_irqs;
|
|
|
|
|
2013-02-25 22:57:35 +08:00
|
|
|
if (is_ab8540(ab8500))
|
|
|
|
num_irqs = AB8540_NR_IRQS;
|
|
|
|
else if (is_ab9540(ab8500))
|
2012-02-21 04:42:24 +08:00
|
|
|
num_irqs = AB9540_NR_IRQS;
|
2012-03-08 21:01:57 +08:00
|
|
|
else if (is_ab8505(ab8500))
|
|
|
|
num_irqs = AB8505_NR_IRQS;
|
2012-02-21 04:42:24 +08:00
|
|
|
else
|
|
|
|
num_irqs = AB8500_NR_IRQS;
|
2010-05-19 17:39:02 +08:00
|
|
|
|
2012-10-19 00:18:44 +08:00
|
|
|
/* If ->irq_base is zero this will give a linear mapping */
|
2014-06-03 00:27:58 +08:00
|
|
|
ab8500->domain = irq_domain_add_simple(ab8500->dev->of_node,
|
2015-10-28 17:15:02 +08:00
|
|
|
num_irqs, 0,
|
|
|
|
&ab8500_irq_ops, ab8500);
|
2012-06-20 20:56:37 +08:00
|
|
|
|
|
|
|
if (!ab8500->domain) {
|
|
|
|
dev_err(ab8500->dev, "Failed to create irqdomain\n");
|
2015-10-28 17:15:02 +08:00
|
|
|
return -ENODEV;
|
2012-06-20 20:56:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2010-05-19 17:39:02 +08:00
|
|
|
}
|
|
|
|
|
2012-04-17 15:30:33 +08:00
|
|
|
int ab8500_suspend(struct ab8500 *ab8500)
|
|
|
|
{
|
|
|
|
if (atomic_read(&ab8500->transfer_ongoing))
|
|
|
|
return -EINVAL;
|
2014-07-02 18:13:42 +08:00
|
|
|
|
|
|
|
return 0;
|
2012-04-17 15:30:33 +08:00
|
|
|
}
|
|
|
|
|
2013-11-18 21:33:06 +08:00
|
|
|
static const struct mfd_cell ab8500_bm_devs[] = {
|
2021-03-12 16:36:02 +08:00
|
|
|
MFD_CELL_OF("ab8500-charger", NULL, NULL, 0, 0,
|
|
|
|
"stericsson,ab8500-charger"),
|
|
|
|
MFD_CELL_OF("ab8500-btemp", NULL, NULL, 0, 0,
|
|
|
|
"stericsson,ab8500-btemp"),
|
|
|
|
MFD_CELL_OF("ab8500-fg", NULL, NULL, 0, 0,
|
|
|
|
"stericsson,ab8500-fg"),
|
|
|
|
MFD_CELL_OF("ab8500-chargalg", NULL, NULL, 0, 0,
|
|
|
|
"stericsson,ab8500-chargalg"),
|
2013-02-25 22:42:00 +08:00
|
|
|
};
|
|
|
|
|
2013-11-18 21:33:06 +08:00
|
|
|
static const struct mfd_cell ab8500_devs[] = {
|
2020-12-17 16:34:20 +08:00
|
|
|
MFD_CELL_OF("ab8500-sysctrl",
|
2016-02-10 23:35:36 +08:00
|
|
|
NULL, NULL, 0, 0, "stericsson,ab8500-sysctrl"),
|
2020-12-17 16:34:20 +08:00
|
|
|
MFD_CELL_OF("ab8500-ext-regulator",
|
2016-02-10 23:35:36 +08:00
|
|
|
NULL, NULL, 0, 0, "stericsson,ab8500-ext-regulator"),
|
2020-12-17 16:34:20 +08:00
|
|
|
MFD_CELL_OF("ab8500-regulator",
|
2016-02-10 23:35:36 +08:00
|
|
|
NULL, NULL, 0, 0, "stericsson,ab8500-regulator"),
|
2020-12-17 16:34:20 +08:00
|
|
|
MFD_CELL_OF("ab8500-clk",
|
2019-12-11 19:46:39 +08:00
|
|
|
NULL, NULL, 0, 0, "stericsson,ab8500-clk"),
|
2020-12-17 16:34:20 +08:00
|
|
|
MFD_CELL_OF("ab8500-gpadc",
|
2016-02-10 23:35:36 +08:00
|
|
|
NULL, NULL, 0, 0, "stericsson,ab8500-gpadc"),
|
2020-12-17 16:34:20 +08:00
|
|
|
MFD_CELL_OF("ab8500-rtc",
|
2016-02-10 23:35:36 +08:00
|
|
|
NULL, NULL, 0, 0, "stericsson,ab8500-rtc"),
|
2020-12-17 16:34:20 +08:00
|
|
|
MFD_CELL_OF("ab8500-acc-det",
|
2016-02-10 23:35:36 +08:00
|
|
|
NULL, NULL, 0, 0, "stericsson,ab8500-acc-det"),
|
2020-12-17 16:34:20 +08:00
|
|
|
MFD_CELL_OF("ab8500-poweron-key",
|
2016-02-10 23:35:36 +08:00
|
|
|
NULL, NULL, 0, 0, "stericsson,ab8500-poweron-key"),
|
2020-12-17 16:34:20 +08:00
|
|
|
MFD_CELL_OF("ab8500-pwm",
|
2016-02-10 23:35:36 +08:00
|
|
|
NULL, NULL, 0, 1, "stericsson,ab8500-pwm"),
|
2020-12-17 16:34:20 +08:00
|
|
|
MFD_CELL_OF("ab8500-pwm",
|
2016-02-10 23:35:36 +08:00
|
|
|
NULL, NULL, 0, 2, "stericsson,ab8500-pwm"),
|
2020-12-17 16:34:20 +08:00
|
|
|
MFD_CELL_OF("ab8500-pwm",
|
2016-02-10 23:35:36 +08:00
|
|
|
NULL, NULL, 0, 3, "stericsson,ab8500-pwm"),
|
2020-12-17 16:34:20 +08:00
|
|
|
MFD_CELL_OF("ab8500-denc",
|
2016-02-10 23:35:36 +08:00
|
|
|
NULL, NULL, 0, 0, "stericsson,ab8500-denc"),
|
2020-12-17 16:34:20 +08:00
|
|
|
MFD_CELL_OF("pinctrl-ab8500",
|
2016-02-10 23:35:36 +08:00
|
|
|
NULL, NULL, 0, 0, "stericsson,ab8500-gpio"),
|
2020-12-17 16:34:20 +08:00
|
|
|
MFD_CELL_OF("abx500-temp",
|
2016-02-10 23:35:36 +08:00
|
|
|
NULL, NULL, 0, 0, "stericsson,abx500-temp"),
|
2020-12-17 16:34:20 +08:00
|
|
|
MFD_CELL_OF("ab8500-usb",
|
2016-02-10 23:35:36 +08:00
|
|
|
NULL, NULL, 0, 0, "stericsson,ab8500-usb"),
|
2020-12-17 16:34:20 +08:00
|
|
|
MFD_CELL_OF("ab8500-codec",
|
2016-02-10 23:35:36 +08:00
|
|
|
NULL, NULL, 0, 0, "stericsson,ab8500-codec"),
|
2012-04-17 15:30:57 +08:00
|
|
|
};
|
|
|
|
|
2013-11-18 21:33:06 +08:00
|
|
|
static const struct mfd_cell ab9540_devs[] = {
|
2012-02-21 04:42:24 +08:00
|
|
|
{
|
2013-02-25 22:42:00 +08:00
|
|
|
.name = "ab8500-sysctrl",
|
2012-02-21 04:42:24 +08:00
|
|
|
},
|
2013-06-07 23:07:47 +08:00
|
|
|
{
|
|
|
|
.name = "ab8500-ext-regulator",
|
|
|
|
},
|
2012-04-17 15:30:14 +08:00
|
|
|
{
|
2013-02-25 22:42:00 +08:00
|
|
|
.name = "ab8500-regulator",
|
2012-04-17 15:30:14 +08:00
|
|
|
},
|
2012-11-20 21:57:25 +08:00
|
|
|
{
|
|
|
|
.name = "abx500-clk",
|
|
|
|
.of_compatible = "stericsson,abx500-clk",
|
|
|
|
},
|
2013-02-12 23:04:09 +08:00
|
|
|
{
|
|
|
|
.name = "ab8500-gpadc",
|
|
|
|
.of_compatible = "stericsson,ab8500-gpadc",
|
|
|
|
},
|
2013-02-25 22:42:00 +08:00
|
|
|
{
|
|
|
|
.name = "ab8500-rtc",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "ab8500-acc-det",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "ab8500-poweron-key",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "ab8500-pwm",
|
|
|
|
.id = 1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "abx500-temp",
|
|
|
|
},
|
2012-02-21 04:42:24 +08:00
|
|
|
{
|
2013-01-16 23:09:36 +08:00
|
|
|
.name = "pinctrl-ab9540",
|
|
|
|
.of_compatible = "stericsson,ab9540-gpio",
|
2012-02-21 04:42:24 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "ab9540-usb",
|
|
|
|
},
|
2012-04-17 15:30:14 +08:00
|
|
|
{
|
|
|
|
.name = "ab9540-codec",
|
|
|
|
},
|
2013-02-12 23:04:09 +08:00
|
|
|
{
|
|
|
|
.name = "ab-iddet",
|
|
|
|
},
|
2012-04-17 15:30:14 +08:00
|
|
|
};
|
|
|
|
|
2013-02-12 23:04:09 +08:00
|
|
|
/* Device list for ab8505 */
|
2013-11-18 21:33:06 +08:00
|
|
|
static const struct mfd_cell ab8505_devs[] = {
|
2013-02-25 22:42:00 +08:00
|
|
|
{
|
|
|
|
.name = "ab8500-sysctrl",
|
2019-11-18 06:10:53 +08:00
|
|
|
.of_compatible = "stericsson,ab8500-sysctrl",
|
2013-02-25 22:42:00 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "ab8500-regulator",
|
2019-11-18 06:10:53 +08:00
|
|
|
.of_compatible = "stericsson,ab8505-regulator",
|
2013-02-25 22:42:00 +08:00
|
|
|
},
|
2012-11-20 21:57:25 +08:00
|
|
|
{
|
|
|
|
.name = "abx500-clk",
|
2019-11-18 06:10:53 +08:00
|
|
|
.of_compatible = "stericsson,ab8500-clk",
|
2012-11-20 21:57:25 +08:00
|
|
|
},
|
2013-02-25 22:42:00 +08:00
|
|
|
{
|
|
|
|
.name = "ab8500-gpadc",
|
2013-05-08 21:29:09 +08:00
|
|
|
.of_compatible = "stericsson,ab8500-gpadc",
|
2013-02-25 22:42:00 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "ab8500-rtc",
|
2019-11-18 06:10:53 +08:00
|
|
|
.of_compatible = "stericsson,ab8500-rtc",
|
2013-02-25 22:42:00 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "ab8500-acc-det",
|
2019-11-18 06:10:53 +08:00
|
|
|
.of_compatible = "stericsson,ab8500-acc-det",
|
2013-02-25 22:42:00 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "ab8500-poweron-key",
|
2019-11-18 06:10:53 +08:00
|
|
|
.of_compatible = "stericsson,ab8500-poweron-key",
|
2013-02-25 22:42:00 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "ab8500-pwm",
|
2019-11-18 06:10:53 +08:00
|
|
|
.of_compatible = "stericsson,ab8500-pwm",
|
2013-02-25 22:42:00 +08:00
|
|
|
.id = 1,
|
|
|
|
},
|
|
|
|
{
|
2013-05-07 18:29:55 +08:00
|
|
|
.name = "pinctrl-ab8505",
|
2019-11-18 06:10:53 +08:00
|
|
|
.of_compatible = "stericsson,ab8505-gpio",
|
2013-02-25 22:42:00 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "ab8500-usb",
|
2019-11-18 06:10:53 +08:00
|
|
|
.of_compatible = "stericsson,ab8500-usb",
|
2013-02-25 22:42:00 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "ab8500-codec",
|
2019-11-18 06:10:53 +08:00
|
|
|
.of_compatible = "stericsson,ab8500-codec",
|
2013-02-25 22:42:00 +08:00
|
|
|
},
|
2013-02-12 23:04:09 +08:00
|
|
|
{
|
|
|
|
.name = "ab-iddet",
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2013-11-18 21:33:06 +08:00
|
|
|
static const struct mfd_cell ab8540_devs[] = {
|
2013-02-25 22:42:00 +08:00
|
|
|
{
|
|
|
|
.name = "ab8500-sysctrl",
|
|
|
|
},
|
2013-06-07 23:07:47 +08:00
|
|
|
{
|
|
|
|
.name = "ab8500-ext-regulator",
|
|
|
|
},
|
2013-02-25 22:42:00 +08:00
|
|
|
{
|
|
|
|
.name = "ab8500-regulator",
|
|
|
|
},
|
2012-11-20 21:57:25 +08:00
|
|
|
{
|
|
|
|
.name = "abx500-clk",
|
|
|
|
.of_compatible = "stericsson,abx500-clk",
|
|
|
|
},
|
2013-02-25 22:42:00 +08:00
|
|
|
{
|
|
|
|
.name = "ab8500-gpadc",
|
2013-05-08 21:29:09 +08:00
|
|
|
.of_compatible = "stericsson,ab8500-gpadc",
|
2013-02-25 22:42:00 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "ab8500-acc-det",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "ab8500-poweron-key",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "ab8500-pwm",
|
|
|
|
.id = 1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "abx500-temp",
|
|
|
|
},
|
2013-02-12 23:04:09 +08:00
|
|
|
{
|
2013-05-07 18:29:55 +08:00
|
|
|
.name = "pinctrl-ab8540",
|
2013-02-12 23:04:09 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "ab8540-usb",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "ab8540-codec",
|
|
|
|
},
|
2012-04-17 15:30:14 +08:00
|
|
|
{
|
|
|
|
.name = "ab-iddet",
|
|
|
|
},
|
2012-02-21 04:42:24 +08:00
|
|
|
};
|
|
|
|
|
2013-11-18 21:33:06 +08:00
|
|
|
static const struct mfd_cell ab8540_cut1_devs[] = {
|
2013-05-24 17:59:47 +08:00
|
|
|
{
|
|
|
|
.name = "ab8500-rtc",
|
|
|
|
.of_compatible = "stericsson,ab8500-rtc",
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2013-11-18 21:33:06 +08:00
|
|
|
static const struct mfd_cell ab8540_cut2_devs[] = {
|
2013-05-24 17:59:47 +08:00
|
|
|
{
|
|
|
|
.name = "ab8540-rtc",
|
|
|
|
.of_compatible = "stericsson,ab8540-rtc",
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2021-06-02 19:43:39 +08:00
|
|
|
static ssize_t chip_id_show(struct device *dev,
|
|
|
|
struct device_attribute *attr, char *buf)
|
2010-12-02 22:09:36 +08:00
|
|
|
{
|
|
|
|
struct ab8500 *ab8500;
|
|
|
|
|
|
|
|
ab8500 = dev_get_drvdata(dev);
|
2013-02-26 18:09:41 +08:00
|
|
|
|
2010-12-02 22:09:36 +08:00
|
|
|
return sprintf(buf, "%#x\n", ab8500 ? ab8500->chip_id : -EINVAL);
|
|
|
|
}
|
|
|
|
|
2011-03-02 18:52:36 +08:00
|
|
|
/*
|
|
|
|
* ab8500 has switched off due to (SWITCH_OFF_STATUS):
|
|
|
|
* 0x01 Swoff bit programming
|
|
|
|
* 0x02 Thermal protection activation
|
|
|
|
* 0x04 Vbat lower then BattOk falling threshold
|
|
|
|
* 0x08 Watchdog expired
|
|
|
|
* 0x10 Non presence of 32kHz clock
|
|
|
|
* 0x20 Battery level lower than power on reset threshold
|
|
|
|
* 0x40 Power on key 1 pressed longer than 10 seconds
|
|
|
|
* 0x80 DB8500 thermal shutdown
|
|
|
|
*/
|
2021-06-02 19:43:39 +08:00
|
|
|
static ssize_t switch_off_status_show(struct device *dev,
|
|
|
|
struct device_attribute *attr, char *buf)
|
2011-03-02 18:52:36 +08:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
u8 value;
|
|
|
|
struct ab8500 *ab8500;
|
|
|
|
|
|
|
|
ab8500 = dev_get_drvdata(dev);
|
|
|
|
ret = get_register_interruptible(ab8500, AB8500_RTC,
|
|
|
|
AB8500_SWITCH_OFF_STATUS, &value);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
return sprintf(buf, "%#x\n", value);
|
|
|
|
}
|
|
|
|
|
2012-05-30 19:02:37 +08:00
|
|
|
/* use mask and set to override the register turn_on_stat value */
|
|
|
|
void ab8500_override_turn_on_stat(u8 mask, u8 set)
|
|
|
|
{
|
|
|
|
spin_lock(&on_stat_lock);
|
|
|
|
turn_on_stat_mask = mask;
|
|
|
|
turn_on_stat_set = set;
|
|
|
|
spin_unlock(&on_stat_lock);
|
|
|
|
}
|
|
|
|
|
2011-10-11 16:49:47 +08:00
|
|
|
/*
|
|
|
|
* ab8500 has turned on due to (TURN_ON_STATUS):
|
|
|
|
* 0x01 PORnVbat
|
|
|
|
* 0x02 PonKey1dbF
|
|
|
|
* 0x04 PonKey2dbF
|
|
|
|
* 0x08 RTCAlarm
|
|
|
|
* 0x10 MainChDet
|
|
|
|
* 0x20 VbusDet
|
|
|
|
* 0x40 UsbIDDetect
|
|
|
|
* 0x80 Reserved
|
|
|
|
*/
|
2021-06-02 19:43:39 +08:00
|
|
|
static ssize_t turn_on_status_show(struct device *dev,
|
|
|
|
struct device_attribute *attr, char *buf)
|
2011-10-11 16:49:47 +08:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
u8 value;
|
|
|
|
struct ab8500 *ab8500;
|
|
|
|
|
|
|
|
ab8500 = dev_get_drvdata(dev);
|
|
|
|
ret = get_register_interruptible(ab8500, AB8500_SYS_CTRL1_BLOCK,
|
|
|
|
AB8500_TURN_ON_STATUS, &value);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
2012-05-30 19:02:37 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* In L9540, turn_on_status register is not updated correctly if
|
|
|
|
* the device is rebooted with AC/USB charger connected. Due to
|
|
|
|
* this, the device boots android instead of entering into charge
|
|
|
|
* only mode. Read the AC/USB status register to detect the charger
|
|
|
|
* presence and update the turn on status manually.
|
|
|
|
*/
|
|
|
|
if (is_ab9540(ab8500)) {
|
|
|
|
spin_lock(&on_stat_lock);
|
|
|
|
value = (value & turn_on_stat_mask) | turn_on_stat_set;
|
|
|
|
spin_unlock(&on_stat_lock);
|
|
|
|
}
|
|
|
|
|
2011-10-11 16:49:47 +08:00
|
|
|
return sprintf(buf, "%#x\n", value);
|
|
|
|
}
|
|
|
|
|
2021-06-02 19:43:39 +08:00
|
|
|
static ssize_t turn_on_status_2_show(struct device *dev,
|
|
|
|
struct device_attribute *attr, char *buf)
|
2012-05-31 22:16:36 +08:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
u8 value;
|
|
|
|
struct ab8500 *ab8500;
|
|
|
|
|
|
|
|
ab8500 = dev_get_drvdata(dev);
|
|
|
|
ret = get_register_interruptible(ab8500, AB8500_SYS_CTRL1_BLOCK,
|
|
|
|
AB8505_TURN_ON_STATUS_2, &value);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
return sprintf(buf, "%#x\n", (value & 0x1));
|
|
|
|
}
|
|
|
|
|
2021-06-02 19:43:39 +08:00
|
|
|
static ssize_t dbbrstn_show(struct device *dev,
|
|
|
|
struct device_attribute *attr, char *buf)
|
2012-02-21 04:42:24 +08:00
|
|
|
{
|
|
|
|
struct ab8500 *ab8500;
|
|
|
|
int ret;
|
|
|
|
u8 value;
|
|
|
|
|
|
|
|
ab8500 = dev_get_drvdata(dev);
|
|
|
|
|
|
|
|
ret = get_register_interruptible(ab8500, AB8500_REGU_CTRL2,
|
|
|
|
AB9540_MODEM_CTRL2_REG, &value);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
return sprintf(buf, "%d\n",
|
|
|
|
(value & AB9540_MODEM_CTRL2_SWDBBRSTN_BIT) ? 1 : 0);
|
|
|
|
}
|
|
|
|
|
2021-06-02 19:43:39 +08:00
|
|
|
static ssize_t dbbrstn_store(struct device *dev,
|
2012-02-21 04:42:24 +08:00
|
|
|
struct device_attribute *attr, const char *buf, size_t count)
|
|
|
|
{
|
|
|
|
struct ab8500 *ab8500;
|
|
|
|
int ret = count;
|
|
|
|
int err;
|
|
|
|
u8 bitvalues;
|
|
|
|
|
|
|
|
ab8500 = dev_get_drvdata(dev);
|
|
|
|
|
|
|
|
if (count > 0) {
|
|
|
|
switch (buf[0]) {
|
|
|
|
case '0':
|
|
|
|
bitvalues = 0;
|
|
|
|
break;
|
|
|
|
case '1':
|
|
|
|
bitvalues = AB9540_MODEM_CTRL2_SWDBBRSTN_BIT;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
err = mask_and_set_register_interruptible(ab8500,
|
|
|
|
AB8500_REGU_CTRL2, AB9540_MODEM_CTRL2_REG,
|
|
|
|
AB9540_MODEM_CTRL2_SWDBBRSTN_BIT, bitvalues);
|
|
|
|
if (err)
|
|
|
|
dev_info(ab8500->dev,
|
|
|
|
"Failed to set DBBRSTN %c, err %#x\n",
|
|
|
|
buf[0], err);
|
|
|
|
}
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2021-06-02 19:43:39 +08:00
|
|
|
static DEVICE_ATTR_RO(chip_id);
|
|
|
|
static DEVICE_ATTR_RO(switch_off_status);
|
|
|
|
static DEVICE_ATTR_RO(turn_on_status);
|
|
|
|
static DEVICE_ATTR_RO(turn_on_status_2);
|
|
|
|
static DEVICE_ATTR_RW(dbbrstn);
|
2010-12-02 22:09:36 +08:00
|
|
|
|
|
|
|
static struct attribute *ab8500_sysfs_entries[] = {
|
|
|
|
&dev_attr_chip_id.attr,
|
2011-03-02 18:52:36 +08:00
|
|
|
&dev_attr_switch_off_status.attr,
|
2011-10-11 16:49:47 +08:00
|
|
|
&dev_attr_turn_on_status.attr,
|
2010-12-02 22:09:36 +08:00
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
2012-05-31 22:16:36 +08:00
|
|
|
static struct attribute *ab8505_sysfs_entries[] = {
|
|
|
|
&dev_attr_turn_on_status_2.attr,
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
2012-02-21 04:42:24 +08:00
|
|
|
static struct attribute *ab9540_sysfs_entries[] = {
|
|
|
|
&dev_attr_chip_id.attr,
|
|
|
|
&dev_attr_switch_off_status.attr,
|
|
|
|
&dev_attr_turn_on_status.attr,
|
|
|
|
&dev_attr_dbbrstn.attr,
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
2017-07-10 13:37:22 +08:00
|
|
|
static const struct attribute_group ab8500_attr_group = {
|
2010-12-02 22:09:36 +08:00
|
|
|
.attrs = ab8500_sysfs_entries,
|
|
|
|
};
|
|
|
|
|
2017-07-10 13:37:22 +08:00
|
|
|
static const struct attribute_group ab8505_attr_group = {
|
2012-05-31 22:16:36 +08:00
|
|
|
.attrs = ab8505_sysfs_entries,
|
|
|
|
};
|
|
|
|
|
2017-07-10 13:37:22 +08:00
|
|
|
static const struct attribute_group ab9540_attr_group = {
|
2012-02-21 04:42:24 +08:00
|
|
|
.attrs = ab9540_sysfs_entries,
|
|
|
|
};
|
|
|
|
|
2012-11-20 02:23:04 +08:00
|
|
|
static int ab8500_probe(struct platform_device *pdev)
|
2010-05-19 17:39:02 +08:00
|
|
|
{
|
2015-10-28 17:15:02 +08:00
|
|
|
static const char * const switch_off_status[] = {
|
2012-06-29 23:46:12 +08:00
|
|
|
"Swoff bit programming",
|
|
|
|
"Thermal protection activation",
|
|
|
|
"Vbat lower then BattOk falling threshold",
|
|
|
|
"Watchdog expired",
|
|
|
|
"Non presence of 32kHz clock",
|
|
|
|
"Battery level lower than power on reset threshold",
|
|
|
|
"Power on key 1 pressed longer than 10 seconds",
|
|
|
|
"DB8500 thermal shutdown"};
|
2015-10-28 17:15:02 +08:00
|
|
|
static const char * const turn_on_status[] = {
|
2012-09-28 15:34:24 +08:00
|
|
|
"Battery rising (Vbat)",
|
|
|
|
"Power On Key 1 dbF",
|
|
|
|
"Power On Key 2 dbF",
|
|
|
|
"RTC Alarm",
|
|
|
|
"Main Charger Detect",
|
|
|
|
"Vbus Detect (USB)",
|
|
|
|
"USB ID Detect",
|
|
|
|
"UART Factory Mode Detect"};
|
2012-05-19 23:21:37 +08:00
|
|
|
const struct platform_device_id *platid = platform_get_device_id(pdev);
|
2012-05-17 21:45:13 +08:00
|
|
|
enum ab8500_version version = AB8500_VERSION_UNDEFINED;
|
|
|
|
struct device_node *np = pdev->dev.of_node;
|
2012-05-19 23:21:37 +08:00
|
|
|
struct ab8500 *ab8500;
|
2010-05-19 17:39:02 +08:00
|
|
|
int ret;
|
|
|
|
int i;
|
2022-03-09 11:56:07 +08:00
|
|
|
int irq;
|
2010-09-10 23:47:56 +08:00
|
|
|
u8 value;
|
2010-05-19 17:39:02 +08:00
|
|
|
|
mfd: ab8500-core: Resolve code style issues
Soothes the following checkpatch warnings:
WARNING: line over 80 characters
#151: FILE: drivers/mfd/ab8500-core.c:151:
+ 0, 1, 2, 3, 4, -1, -1, -1, -1, 11, 18, 19, 20, 21, 12, 13, 24, 5, 22, 23,
ERROR: spaces required around that '=' (ctx:VxW)
#325: FILE: drivers/mfd/ab8500-core.c:325:
+ ret= mask_and_set_register_interruptible(ab8500, bank, reg,
^
WARNING: line over 80 characters
#418: FILE: drivers/mfd/ab8500-core.c:418:
+ else if (offset >= AB9540_INT_GPIO50R && offset <= AB9540_INT_GPIO54R)
WARNING: line over 80 characters
#420: FILE: drivers/mfd/ab8500-core.c:420:
+ else if (offset == AB8540_INT_GPIO43R || offset == AB8540_INT_GPIO44R)
ERROR: spaces required around that '==' (ctx:VxV)
#454: FILE: drivers/mfd/ab8500-core.c:454:
+ if ((i==3) && (*offset >= 24))
^
ERROR: code indent should use tabs where possible
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
WARNING: please, no spaces at the start of a line
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
ERROR: code indent should use tabs where possible
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: please, no spaces at the start of a line
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: char * array declaration might be better as static const
#1554: FILE: drivers/mfd/ab8500-core.c:1554:
+ static char *switch_off_status[] = {
WARNING: char * array declaration might be better as static const
#1563: FILE: drivers/mfd/ab8500-core.c:1563:
+ static char *turn_on_status[] = {
WARNING: sizeof *ab8500 should be sizeof(*ab8500)
#1582: FILE: drivers/mfd/ab8500-core.c:1582:
+ ab8500 = devm_kzalloc(&pdev->dev, sizeof *ab8500, GFP_KERNEL);
ERROR: space required after that close brace '}'
#1639: FILE: drivers/mfd/ab8500-core.c:1639:
+ }/* Configure AB8500 or AB9540 IRQ */
WARNING: line over 80 characters
#1652: FILE: drivers/mfd/ab8500-core.c:1652:
+ ab8500->oldmask = devm_kzalloc(&pdev->dev, ab8500->mask_size, GFP_KERNEL);
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1677: FILE: drivers/mfd/ab8500-core.c:1677:
+ printk(KERN_CONT " \"%s\"",
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1682: FILE: drivers/mfd/ab8500-core.c:1682:
+ printk(KERN_CONT "\n");
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1684: FILE: drivers/mfd/ab8500-core.c:1684:
+ printk(KERN_CONT " None\n");
WARNING: printk() should include KERN_ facility level
#1695: FILE: drivers/mfd/ab8500-core.c:1695:
+ printk("\"%s\" ", turn_on_status[i]);
WARNING: printk() should include KERN_ facility level
#1700: FILE: drivers/mfd/ab8500-core.c:1700:
+ printk("None\n");
total: 5 errors, 14 warnings, 1869 lines checked
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-05-08 21:11:37 +08:00
|
|
|
ab8500 = devm_kzalloc(&pdev->dev, sizeof(*ab8500), GFP_KERNEL);
|
2012-05-19 23:21:37 +08:00
|
|
|
if (!ab8500)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
ab8500->dev = &pdev->dev;
|
|
|
|
|
2022-03-09 11:56:07 +08:00
|
|
|
irq = platform_get_irq(pdev, 0);
|
|
|
|
if (irq < 0)
|
|
|
|
return irq;
|
2012-05-19 23:21:37 +08:00
|
|
|
|
2022-03-09 11:56:07 +08:00
|
|
|
ab8500->irq = irq;
|
2012-05-19 23:21:37 +08:00
|
|
|
|
2012-06-20 20:56:38 +08:00
|
|
|
ab8500->read = ab8500_prcmu_read;
|
|
|
|
ab8500->write = ab8500_prcmu_write;
|
|
|
|
ab8500->write_masked = ab8500_prcmu_write_masked;
|
2012-05-19 23:21:37 +08:00
|
|
|
|
2010-05-19 17:39:02 +08:00
|
|
|
mutex_init(&ab8500->lock);
|
|
|
|
mutex_init(&ab8500->irq_lock);
|
2012-04-17 15:30:33 +08:00
|
|
|
atomic_set(&ab8500->transfer_ongoing, 0);
|
2010-05-19 17:39:02 +08:00
|
|
|
|
2012-05-19 23:21:37 +08:00
|
|
|
platform_set_drvdata(pdev, ab8500);
|
|
|
|
|
2012-05-17 21:45:13 +08:00
|
|
|
if (platid)
|
|
|
|
version = platid->driver_data;
|
|
|
|
|
2012-02-21 04:42:10 +08:00
|
|
|
if (version != AB8500_VERSION_UNDEFINED)
|
|
|
|
ab8500->version = version;
|
|
|
|
else {
|
|
|
|
ret = get_register_interruptible(ab8500, AB8500_MISC,
|
|
|
|
AB8500_IC_NAME_REG, &value);
|
2014-02-04 07:35:56 +08:00
|
|
|
if (ret < 0) {
|
|
|
|
dev_err(&pdev->dev, "could not probe HW\n");
|
2012-11-05 23:10:35 +08:00
|
|
|
return ret;
|
2014-02-04 07:35:56 +08:00
|
|
|
}
|
2012-02-21 04:42:10 +08:00
|
|
|
|
|
|
|
ab8500->version = value;
|
|
|
|
}
|
|
|
|
|
2010-09-10 23:47:56 +08:00
|
|
|
ret = get_register_interruptible(ab8500, AB8500_MISC,
|
|
|
|
AB8500_REV_REG, &value);
|
2010-05-19 17:39:02 +08:00
|
|
|
if (ret < 0)
|
2012-11-05 23:10:35 +08:00
|
|
|
return ret;
|
2010-05-19 17:39:02 +08:00
|
|
|
|
2010-09-10 23:47:56 +08:00
|
|
|
ab8500->chip_id = value;
|
2010-05-19 17:39:02 +08:00
|
|
|
|
2012-02-21 04:42:10 +08:00
|
|
|
dev_info(ab8500->dev, "detected chip, %s rev. %1x.%1x\n",
|
|
|
|
ab8500_version_str[ab8500->version],
|
|
|
|
ab8500->chip_id >> 4,
|
|
|
|
ab8500->chip_id & 0x0F);
|
|
|
|
|
2013-02-25 22:57:35 +08:00
|
|
|
/* Configure AB8540 */
|
|
|
|
if (is_ab8540(ab8500)) {
|
|
|
|
ab8500->mask_size = AB8540_NUM_IRQ_REGS;
|
|
|
|
ab8500->irq_reg_offset = ab8540_irq_regoffset;
|
|
|
|
ab8500->it_latchhier_num = AB8540_IT_LATCHHIER_NUM;
|
mfd: ab8500-core: Resolve code style issues
Soothes the following checkpatch warnings:
WARNING: line over 80 characters
#151: FILE: drivers/mfd/ab8500-core.c:151:
+ 0, 1, 2, 3, 4, -1, -1, -1, -1, 11, 18, 19, 20, 21, 12, 13, 24, 5, 22, 23,
ERROR: spaces required around that '=' (ctx:VxW)
#325: FILE: drivers/mfd/ab8500-core.c:325:
+ ret= mask_and_set_register_interruptible(ab8500, bank, reg,
^
WARNING: line over 80 characters
#418: FILE: drivers/mfd/ab8500-core.c:418:
+ else if (offset >= AB9540_INT_GPIO50R && offset <= AB9540_INT_GPIO54R)
WARNING: line over 80 characters
#420: FILE: drivers/mfd/ab8500-core.c:420:
+ else if (offset == AB8540_INT_GPIO43R || offset == AB8540_INT_GPIO44R)
ERROR: spaces required around that '==' (ctx:VxV)
#454: FILE: drivers/mfd/ab8500-core.c:454:
+ if ((i==3) && (*offset >= 24))
^
ERROR: code indent should use tabs where possible
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
WARNING: please, no spaces at the start of a line
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
ERROR: code indent should use tabs where possible
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: please, no spaces at the start of a line
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: char * array declaration might be better as static const
#1554: FILE: drivers/mfd/ab8500-core.c:1554:
+ static char *switch_off_status[] = {
WARNING: char * array declaration might be better as static const
#1563: FILE: drivers/mfd/ab8500-core.c:1563:
+ static char *turn_on_status[] = {
WARNING: sizeof *ab8500 should be sizeof(*ab8500)
#1582: FILE: drivers/mfd/ab8500-core.c:1582:
+ ab8500 = devm_kzalloc(&pdev->dev, sizeof *ab8500, GFP_KERNEL);
ERROR: space required after that close brace '}'
#1639: FILE: drivers/mfd/ab8500-core.c:1639:
+ }/* Configure AB8500 or AB9540 IRQ */
WARNING: line over 80 characters
#1652: FILE: drivers/mfd/ab8500-core.c:1652:
+ ab8500->oldmask = devm_kzalloc(&pdev->dev, ab8500->mask_size, GFP_KERNEL);
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1677: FILE: drivers/mfd/ab8500-core.c:1677:
+ printk(KERN_CONT " \"%s\"",
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1682: FILE: drivers/mfd/ab8500-core.c:1682:
+ printk(KERN_CONT "\n");
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1684: FILE: drivers/mfd/ab8500-core.c:1684:
+ printk(KERN_CONT " None\n");
WARNING: printk() should include KERN_ facility level
#1695: FILE: drivers/mfd/ab8500-core.c:1695:
+ printk("\"%s\" ", turn_on_status[i]);
WARNING: printk() should include KERN_ facility level
#1700: FILE: drivers/mfd/ab8500-core.c:1700:
+ printk("None\n");
total: 5 errors, 14 warnings, 1869 lines checked
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-05-08 21:11:37 +08:00
|
|
|
} /* Configure AB8500 or AB9540 IRQ */
|
2013-02-25 22:57:35 +08:00
|
|
|
else if (is_ab9540(ab8500) || is_ab8505(ab8500)) {
|
2012-02-21 04:42:24 +08:00
|
|
|
ab8500->mask_size = AB9540_NUM_IRQ_REGS;
|
|
|
|
ab8500->irq_reg_offset = ab9540_irq_regoffset;
|
2013-02-25 22:57:35 +08:00
|
|
|
ab8500->it_latchhier_num = AB8500_IT_LATCHHIER_NUM;
|
2012-02-21 04:42:24 +08:00
|
|
|
} else {
|
|
|
|
ab8500->mask_size = AB8500_NUM_IRQ_REGS;
|
|
|
|
ab8500->irq_reg_offset = ab8500_irq_regoffset;
|
2013-02-25 22:57:35 +08:00
|
|
|
ab8500->it_latchhier_num = AB8500_IT_LATCHHIER_NUM;
|
2012-02-21 04:42:24 +08:00
|
|
|
}
|
mfd: ab8500-core: Resolve code style issues
Soothes the following checkpatch warnings:
WARNING: line over 80 characters
#151: FILE: drivers/mfd/ab8500-core.c:151:
+ 0, 1, 2, 3, 4, -1, -1, -1, -1, 11, 18, 19, 20, 21, 12, 13, 24, 5, 22, 23,
ERROR: spaces required around that '=' (ctx:VxW)
#325: FILE: drivers/mfd/ab8500-core.c:325:
+ ret= mask_and_set_register_interruptible(ab8500, bank, reg,
^
WARNING: line over 80 characters
#418: FILE: drivers/mfd/ab8500-core.c:418:
+ else if (offset >= AB9540_INT_GPIO50R && offset <= AB9540_INT_GPIO54R)
WARNING: line over 80 characters
#420: FILE: drivers/mfd/ab8500-core.c:420:
+ else if (offset == AB8540_INT_GPIO43R || offset == AB8540_INT_GPIO44R)
ERROR: spaces required around that '==' (ctx:VxV)
#454: FILE: drivers/mfd/ab8500-core.c:454:
+ if ((i==3) && (*offset >= 24))
^
ERROR: code indent should use tabs where possible
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
WARNING: please, no spaces at the start of a line
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
ERROR: code indent should use tabs where possible
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: please, no spaces at the start of a line
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: char * array declaration might be better as static const
#1554: FILE: drivers/mfd/ab8500-core.c:1554:
+ static char *switch_off_status[] = {
WARNING: char * array declaration might be better as static const
#1563: FILE: drivers/mfd/ab8500-core.c:1563:
+ static char *turn_on_status[] = {
WARNING: sizeof *ab8500 should be sizeof(*ab8500)
#1582: FILE: drivers/mfd/ab8500-core.c:1582:
+ ab8500 = devm_kzalloc(&pdev->dev, sizeof *ab8500, GFP_KERNEL);
ERROR: space required after that close brace '}'
#1639: FILE: drivers/mfd/ab8500-core.c:1639:
+ }/* Configure AB8500 or AB9540 IRQ */
WARNING: line over 80 characters
#1652: FILE: drivers/mfd/ab8500-core.c:1652:
+ ab8500->oldmask = devm_kzalloc(&pdev->dev, ab8500->mask_size, GFP_KERNEL);
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1677: FILE: drivers/mfd/ab8500-core.c:1677:
+ printk(KERN_CONT " \"%s\"",
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1682: FILE: drivers/mfd/ab8500-core.c:1682:
+ printk(KERN_CONT "\n");
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1684: FILE: drivers/mfd/ab8500-core.c:1684:
+ printk(KERN_CONT " None\n");
WARNING: printk() should include KERN_ facility level
#1695: FILE: drivers/mfd/ab8500-core.c:1695:
+ printk("\"%s\" ", turn_on_status[i]);
WARNING: printk() should include KERN_ facility level
#1700: FILE: drivers/mfd/ab8500-core.c:1700:
+ printk("None\n");
total: 5 errors, 14 warnings, 1869 lines checked
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-05-08 21:11:37 +08:00
|
|
|
ab8500->mask = devm_kzalloc(&pdev->dev, ab8500->mask_size,
|
|
|
|
GFP_KERNEL);
|
2012-02-21 04:42:17 +08:00
|
|
|
if (!ab8500->mask)
|
|
|
|
return -ENOMEM;
|
mfd: ab8500-core: Resolve code style issues
Soothes the following checkpatch warnings:
WARNING: line over 80 characters
#151: FILE: drivers/mfd/ab8500-core.c:151:
+ 0, 1, 2, 3, 4, -1, -1, -1, -1, 11, 18, 19, 20, 21, 12, 13, 24, 5, 22, 23,
ERROR: spaces required around that '=' (ctx:VxW)
#325: FILE: drivers/mfd/ab8500-core.c:325:
+ ret= mask_and_set_register_interruptible(ab8500, bank, reg,
^
WARNING: line over 80 characters
#418: FILE: drivers/mfd/ab8500-core.c:418:
+ else if (offset >= AB9540_INT_GPIO50R && offset <= AB9540_INT_GPIO54R)
WARNING: line over 80 characters
#420: FILE: drivers/mfd/ab8500-core.c:420:
+ else if (offset == AB8540_INT_GPIO43R || offset == AB8540_INT_GPIO44R)
ERROR: spaces required around that '==' (ctx:VxV)
#454: FILE: drivers/mfd/ab8500-core.c:454:
+ if ((i==3) && (*offset >= 24))
^
ERROR: code indent should use tabs where possible
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
WARNING: please, no spaces at the start of a line
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
ERROR: code indent should use tabs where possible
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: please, no spaces at the start of a line
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: char * array declaration might be better as static const
#1554: FILE: drivers/mfd/ab8500-core.c:1554:
+ static char *switch_off_status[] = {
WARNING: char * array declaration might be better as static const
#1563: FILE: drivers/mfd/ab8500-core.c:1563:
+ static char *turn_on_status[] = {
WARNING: sizeof *ab8500 should be sizeof(*ab8500)
#1582: FILE: drivers/mfd/ab8500-core.c:1582:
+ ab8500 = devm_kzalloc(&pdev->dev, sizeof *ab8500, GFP_KERNEL);
ERROR: space required after that close brace '}'
#1639: FILE: drivers/mfd/ab8500-core.c:1639:
+ }/* Configure AB8500 or AB9540 IRQ */
WARNING: line over 80 characters
#1652: FILE: drivers/mfd/ab8500-core.c:1652:
+ ab8500->oldmask = devm_kzalloc(&pdev->dev, ab8500->mask_size, GFP_KERNEL);
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1677: FILE: drivers/mfd/ab8500-core.c:1677:
+ printk(KERN_CONT " \"%s\"",
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1682: FILE: drivers/mfd/ab8500-core.c:1682:
+ printk(KERN_CONT "\n");
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1684: FILE: drivers/mfd/ab8500-core.c:1684:
+ printk(KERN_CONT " None\n");
WARNING: printk() should include KERN_ facility level
#1695: FILE: drivers/mfd/ab8500-core.c:1695:
+ printk("\"%s\" ", turn_on_status[i]);
WARNING: printk() should include KERN_ facility level
#1700: FILE: drivers/mfd/ab8500-core.c:1700:
+ printk("None\n");
total: 5 errors, 14 warnings, 1869 lines checked
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-05-08 21:11:37 +08:00
|
|
|
ab8500->oldmask = devm_kzalloc(&pdev->dev, ab8500->mask_size,
|
|
|
|
GFP_KERNEL);
|
2012-11-05 23:10:35 +08:00
|
|
|
if (!ab8500->oldmask)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
2011-03-02 18:52:36 +08:00
|
|
|
/*
|
|
|
|
* ab8500 has switched off due to (SWITCH_OFF_STATUS):
|
|
|
|
* 0x01 Swoff bit programming
|
|
|
|
* 0x02 Thermal protection activation
|
|
|
|
* 0x04 Vbat lower then BattOk falling threshold
|
|
|
|
* 0x08 Watchdog expired
|
|
|
|
* 0x10 Non presence of 32kHz clock
|
|
|
|
* 0x20 Battery level lower than power on reset threshold
|
|
|
|
* 0x40 Power on key 1 pressed longer than 10 seconds
|
|
|
|
* 0x80 DB8500 thermal shutdown
|
|
|
|
*/
|
|
|
|
|
|
|
|
ret = get_register_interruptible(ab8500, AB8500_RTC,
|
|
|
|
AB8500_SWITCH_OFF_STATUS, &value);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
2012-06-29 23:46:12 +08:00
|
|
|
dev_info(ab8500->dev, "switch off cause(s) (%#x): ", value);
|
|
|
|
|
|
|
|
if (value) {
|
|
|
|
for (i = 0; i < ARRAY_SIZE(switch_off_status); i++) {
|
|
|
|
if (value & 1)
|
mfd: ab8500-core: Resolve code style issues
Soothes the following checkpatch warnings:
WARNING: line over 80 characters
#151: FILE: drivers/mfd/ab8500-core.c:151:
+ 0, 1, 2, 3, 4, -1, -1, -1, -1, 11, 18, 19, 20, 21, 12, 13, 24, 5, 22, 23,
ERROR: spaces required around that '=' (ctx:VxW)
#325: FILE: drivers/mfd/ab8500-core.c:325:
+ ret= mask_and_set_register_interruptible(ab8500, bank, reg,
^
WARNING: line over 80 characters
#418: FILE: drivers/mfd/ab8500-core.c:418:
+ else if (offset >= AB9540_INT_GPIO50R && offset <= AB9540_INT_GPIO54R)
WARNING: line over 80 characters
#420: FILE: drivers/mfd/ab8500-core.c:420:
+ else if (offset == AB8540_INT_GPIO43R || offset == AB8540_INT_GPIO44R)
ERROR: spaces required around that '==' (ctx:VxV)
#454: FILE: drivers/mfd/ab8500-core.c:454:
+ if ((i==3) && (*offset >= 24))
^
ERROR: code indent should use tabs where possible
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
WARNING: please, no spaces at the start of a line
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
ERROR: code indent should use tabs where possible
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: please, no spaces at the start of a line
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: char * array declaration might be better as static const
#1554: FILE: drivers/mfd/ab8500-core.c:1554:
+ static char *switch_off_status[] = {
WARNING: char * array declaration might be better as static const
#1563: FILE: drivers/mfd/ab8500-core.c:1563:
+ static char *turn_on_status[] = {
WARNING: sizeof *ab8500 should be sizeof(*ab8500)
#1582: FILE: drivers/mfd/ab8500-core.c:1582:
+ ab8500 = devm_kzalloc(&pdev->dev, sizeof *ab8500, GFP_KERNEL);
ERROR: space required after that close brace '}'
#1639: FILE: drivers/mfd/ab8500-core.c:1639:
+ }/* Configure AB8500 or AB9540 IRQ */
WARNING: line over 80 characters
#1652: FILE: drivers/mfd/ab8500-core.c:1652:
+ ab8500->oldmask = devm_kzalloc(&pdev->dev, ab8500->mask_size, GFP_KERNEL);
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1677: FILE: drivers/mfd/ab8500-core.c:1677:
+ printk(KERN_CONT " \"%s\"",
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1682: FILE: drivers/mfd/ab8500-core.c:1682:
+ printk(KERN_CONT "\n");
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1684: FILE: drivers/mfd/ab8500-core.c:1684:
+ printk(KERN_CONT " None\n");
WARNING: printk() should include KERN_ facility level
#1695: FILE: drivers/mfd/ab8500-core.c:1695:
+ printk("\"%s\" ", turn_on_status[i]);
WARNING: printk() should include KERN_ facility level
#1700: FILE: drivers/mfd/ab8500-core.c:1700:
+ printk("None\n");
total: 5 errors, 14 warnings, 1869 lines checked
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-05-08 21:11:37 +08:00
|
|
|
pr_cont(" \"%s\"", switch_off_status[i]);
|
2012-06-29 23:46:12 +08:00
|
|
|
value = value >> 1;
|
|
|
|
|
|
|
|
}
|
mfd: ab8500-core: Resolve code style issues
Soothes the following checkpatch warnings:
WARNING: line over 80 characters
#151: FILE: drivers/mfd/ab8500-core.c:151:
+ 0, 1, 2, 3, 4, -1, -1, -1, -1, 11, 18, 19, 20, 21, 12, 13, 24, 5, 22, 23,
ERROR: spaces required around that '=' (ctx:VxW)
#325: FILE: drivers/mfd/ab8500-core.c:325:
+ ret= mask_and_set_register_interruptible(ab8500, bank, reg,
^
WARNING: line over 80 characters
#418: FILE: drivers/mfd/ab8500-core.c:418:
+ else if (offset >= AB9540_INT_GPIO50R && offset <= AB9540_INT_GPIO54R)
WARNING: line over 80 characters
#420: FILE: drivers/mfd/ab8500-core.c:420:
+ else if (offset == AB8540_INT_GPIO43R || offset == AB8540_INT_GPIO44R)
ERROR: spaces required around that '==' (ctx:VxV)
#454: FILE: drivers/mfd/ab8500-core.c:454:
+ if ((i==3) && (*offset >= 24))
^
ERROR: code indent should use tabs where possible
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
WARNING: please, no spaces at the start of a line
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
ERROR: code indent should use tabs where possible
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: please, no spaces at the start of a line
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: char * array declaration might be better as static const
#1554: FILE: drivers/mfd/ab8500-core.c:1554:
+ static char *switch_off_status[] = {
WARNING: char * array declaration might be better as static const
#1563: FILE: drivers/mfd/ab8500-core.c:1563:
+ static char *turn_on_status[] = {
WARNING: sizeof *ab8500 should be sizeof(*ab8500)
#1582: FILE: drivers/mfd/ab8500-core.c:1582:
+ ab8500 = devm_kzalloc(&pdev->dev, sizeof *ab8500, GFP_KERNEL);
ERROR: space required after that close brace '}'
#1639: FILE: drivers/mfd/ab8500-core.c:1639:
+ }/* Configure AB8500 or AB9540 IRQ */
WARNING: line over 80 characters
#1652: FILE: drivers/mfd/ab8500-core.c:1652:
+ ab8500->oldmask = devm_kzalloc(&pdev->dev, ab8500->mask_size, GFP_KERNEL);
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1677: FILE: drivers/mfd/ab8500-core.c:1677:
+ printk(KERN_CONT " \"%s\"",
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1682: FILE: drivers/mfd/ab8500-core.c:1682:
+ printk(KERN_CONT "\n");
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1684: FILE: drivers/mfd/ab8500-core.c:1684:
+ printk(KERN_CONT " None\n");
WARNING: printk() should include KERN_ facility level
#1695: FILE: drivers/mfd/ab8500-core.c:1695:
+ printk("\"%s\" ", turn_on_status[i]);
WARNING: printk() should include KERN_ facility level
#1700: FILE: drivers/mfd/ab8500-core.c:1700:
+ printk("None\n");
total: 5 errors, 14 warnings, 1869 lines checked
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-05-08 21:11:37 +08:00
|
|
|
pr_cont("\n");
|
2012-06-29 23:46:12 +08:00
|
|
|
} else {
|
mfd: ab8500-core: Resolve code style issues
Soothes the following checkpatch warnings:
WARNING: line over 80 characters
#151: FILE: drivers/mfd/ab8500-core.c:151:
+ 0, 1, 2, 3, 4, -1, -1, -1, -1, 11, 18, 19, 20, 21, 12, 13, 24, 5, 22, 23,
ERROR: spaces required around that '=' (ctx:VxW)
#325: FILE: drivers/mfd/ab8500-core.c:325:
+ ret= mask_and_set_register_interruptible(ab8500, bank, reg,
^
WARNING: line over 80 characters
#418: FILE: drivers/mfd/ab8500-core.c:418:
+ else if (offset >= AB9540_INT_GPIO50R && offset <= AB9540_INT_GPIO54R)
WARNING: line over 80 characters
#420: FILE: drivers/mfd/ab8500-core.c:420:
+ else if (offset == AB8540_INT_GPIO43R || offset == AB8540_INT_GPIO44R)
ERROR: spaces required around that '==' (ctx:VxV)
#454: FILE: drivers/mfd/ab8500-core.c:454:
+ if ((i==3) && (*offset >= 24))
^
ERROR: code indent should use tabs where possible
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
WARNING: please, no spaces at the start of a line
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
ERROR: code indent should use tabs where possible
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: please, no spaces at the start of a line
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: char * array declaration might be better as static const
#1554: FILE: drivers/mfd/ab8500-core.c:1554:
+ static char *switch_off_status[] = {
WARNING: char * array declaration might be better as static const
#1563: FILE: drivers/mfd/ab8500-core.c:1563:
+ static char *turn_on_status[] = {
WARNING: sizeof *ab8500 should be sizeof(*ab8500)
#1582: FILE: drivers/mfd/ab8500-core.c:1582:
+ ab8500 = devm_kzalloc(&pdev->dev, sizeof *ab8500, GFP_KERNEL);
ERROR: space required after that close brace '}'
#1639: FILE: drivers/mfd/ab8500-core.c:1639:
+ }/* Configure AB8500 or AB9540 IRQ */
WARNING: line over 80 characters
#1652: FILE: drivers/mfd/ab8500-core.c:1652:
+ ab8500->oldmask = devm_kzalloc(&pdev->dev, ab8500->mask_size, GFP_KERNEL);
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1677: FILE: drivers/mfd/ab8500-core.c:1677:
+ printk(KERN_CONT " \"%s\"",
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1682: FILE: drivers/mfd/ab8500-core.c:1682:
+ printk(KERN_CONT "\n");
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1684: FILE: drivers/mfd/ab8500-core.c:1684:
+ printk(KERN_CONT " None\n");
WARNING: printk() should include KERN_ facility level
#1695: FILE: drivers/mfd/ab8500-core.c:1695:
+ printk("\"%s\" ", turn_on_status[i]);
WARNING: printk() should include KERN_ facility level
#1700: FILE: drivers/mfd/ab8500-core.c:1700:
+ printk("None\n");
total: 5 errors, 14 warnings, 1869 lines checked
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-05-08 21:11:37 +08:00
|
|
|
pr_cont(" None\n");
|
2012-06-29 23:46:12 +08:00
|
|
|
}
|
2012-09-28 15:34:24 +08:00
|
|
|
ret = get_register_interruptible(ab8500, AB8500_SYS_CTRL1_BLOCK,
|
|
|
|
AB8500_TURN_ON_STATUS, &value);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
dev_info(ab8500->dev, "turn on reason(s) (%#x): ", value);
|
|
|
|
|
|
|
|
if (value) {
|
|
|
|
for (i = 0; i < ARRAY_SIZE(turn_on_status); i++) {
|
|
|
|
if (value & 1)
|
mfd: ab8500-core: Resolve code style issues
Soothes the following checkpatch warnings:
WARNING: line over 80 characters
#151: FILE: drivers/mfd/ab8500-core.c:151:
+ 0, 1, 2, 3, 4, -1, -1, -1, -1, 11, 18, 19, 20, 21, 12, 13, 24, 5, 22, 23,
ERROR: spaces required around that '=' (ctx:VxW)
#325: FILE: drivers/mfd/ab8500-core.c:325:
+ ret= mask_and_set_register_interruptible(ab8500, bank, reg,
^
WARNING: line over 80 characters
#418: FILE: drivers/mfd/ab8500-core.c:418:
+ else if (offset >= AB9540_INT_GPIO50R && offset <= AB9540_INT_GPIO54R)
WARNING: line over 80 characters
#420: FILE: drivers/mfd/ab8500-core.c:420:
+ else if (offset == AB8540_INT_GPIO43R || offset == AB8540_INT_GPIO44R)
ERROR: spaces required around that '==' (ctx:VxV)
#454: FILE: drivers/mfd/ab8500-core.c:454:
+ if ((i==3) && (*offset >= 24))
^
ERROR: code indent should use tabs where possible
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
WARNING: please, no spaces at the start of a line
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
ERROR: code indent should use tabs where possible
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: please, no spaces at the start of a line
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: char * array declaration might be better as static const
#1554: FILE: drivers/mfd/ab8500-core.c:1554:
+ static char *switch_off_status[] = {
WARNING: char * array declaration might be better as static const
#1563: FILE: drivers/mfd/ab8500-core.c:1563:
+ static char *turn_on_status[] = {
WARNING: sizeof *ab8500 should be sizeof(*ab8500)
#1582: FILE: drivers/mfd/ab8500-core.c:1582:
+ ab8500 = devm_kzalloc(&pdev->dev, sizeof *ab8500, GFP_KERNEL);
ERROR: space required after that close brace '}'
#1639: FILE: drivers/mfd/ab8500-core.c:1639:
+ }/* Configure AB8500 or AB9540 IRQ */
WARNING: line over 80 characters
#1652: FILE: drivers/mfd/ab8500-core.c:1652:
+ ab8500->oldmask = devm_kzalloc(&pdev->dev, ab8500->mask_size, GFP_KERNEL);
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1677: FILE: drivers/mfd/ab8500-core.c:1677:
+ printk(KERN_CONT " \"%s\"",
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1682: FILE: drivers/mfd/ab8500-core.c:1682:
+ printk(KERN_CONT "\n");
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1684: FILE: drivers/mfd/ab8500-core.c:1684:
+ printk(KERN_CONT " None\n");
WARNING: printk() should include KERN_ facility level
#1695: FILE: drivers/mfd/ab8500-core.c:1695:
+ printk("\"%s\" ", turn_on_status[i]);
WARNING: printk() should include KERN_ facility level
#1700: FILE: drivers/mfd/ab8500-core.c:1700:
+ printk("None\n");
total: 5 errors, 14 warnings, 1869 lines checked
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-05-08 21:11:37 +08:00
|
|
|
pr_cont("\"%s\" ", turn_on_status[i]);
|
2012-09-28 15:34:24 +08:00
|
|
|
value = value >> 1;
|
|
|
|
}
|
mfd: ab8500-core: Resolve code style issues
Soothes the following checkpatch warnings:
WARNING: line over 80 characters
#151: FILE: drivers/mfd/ab8500-core.c:151:
+ 0, 1, 2, 3, 4, -1, -1, -1, -1, 11, 18, 19, 20, 21, 12, 13, 24, 5, 22, 23,
ERROR: spaces required around that '=' (ctx:VxW)
#325: FILE: drivers/mfd/ab8500-core.c:325:
+ ret= mask_and_set_register_interruptible(ab8500, bank, reg,
^
WARNING: line over 80 characters
#418: FILE: drivers/mfd/ab8500-core.c:418:
+ else if (offset >= AB9540_INT_GPIO50R && offset <= AB9540_INT_GPIO54R)
WARNING: line over 80 characters
#420: FILE: drivers/mfd/ab8500-core.c:420:
+ else if (offset == AB8540_INT_GPIO43R || offset == AB8540_INT_GPIO44R)
ERROR: spaces required around that '==' (ctx:VxV)
#454: FILE: drivers/mfd/ab8500-core.c:454:
+ if ((i==3) && (*offset >= 24))
^
ERROR: code indent should use tabs where possible
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
WARNING: please, no spaces at the start of a line
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
ERROR: code indent should use tabs where possible
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: please, no spaces at the start of a line
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: char * array declaration might be better as static const
#1554: FILE: drivers/mfd/ab8500-core.c:1554:
+ static char *switch_off_status[] = {
WARNING: char * array declaration might be better as static const
#1563: FILE: drivers/mfd/ab8500-core.c:1563:
+ static char *turn_on_status[] = {
WARNING: sizeof *ab8500 should be sizeof(*ab8500)
#1582: FILE: drivers/mfd/ab8500-core.c:1582:
+ ab8500 = devm_kzalloc(&pdev->dev, sizeof *ab8500, GFP_KERNEL);
ERROR: space required after that close brace '}'
#1639: FILE: drivers/mfd/ab8500-core.c:1639:
+ }/* Configure AB8500 or AB9540 IRQ */
WARNING: line over 80 characters
#1652: FILE: drivers/mfd/ab8500-core.c:1652:
+ ab8500->oldmask = devm_kzalloc(&pdev->dev, ab8500->mask_size, GFP_KERNEL);
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1677: FILE: drivers/mfd/ab8500-core.c:1677:
+ printk(KERN_CONT " \"%s\"",
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1682: FILE: drivers/mfd/ab8500-core.c:1682:
+ printk(KERN_CONT "\n");
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1684: FILE: drivers/mfd/ab8500-core.c:1684:
+ printk(KERN_CONT " None\n");
WARNING: printk() should include KERN_ facility level
#1695: FILE: drivers/mfd/ab8500-core.c:1695:
+ printk("\"%s\" ", turn_on_status[i]);
WARNING: printk() should include KERN_ facility level
#1700: FILE: drivers/mfd/ab8500-core.c:1700:
+ printk("None\n");
total: 5 errors, 14 warnings, 1869 lines checked
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-05-08 21:11:37 +08:00
|
|
|
pr_cont("\n");
|
2012-09-28 15:34:24 +08:00
|
|
|
} else {
|
mfd: ab8500-core: Resolve code style issues
Soothes the following checkpatch warnings:
WARNING: line over 80 characters
#151: FILE: drivers/mfd/ab8500-core.c:151:
+ 0, 1, 2, 3, 4, -1, -1, -1, -1, 11, 18, 19, 20, 21, 12, 13, 24, 5, 22, 23,
ERROR: spaces required around that '=' (ctx:VxW)
#325: FILE: drivers/mfd/ab8500-core.c:325:
+ ret= mask_and_set_register_interruptible(ab8500, bank, reg,
^
WARNING: line over 80 characters
#418: FILE: drivers/mfd/ab8500-core.c:418:
+ else if (offset >= AB9540_INT_GPIO50R && offset <= AB9540_INT_GPIO54R)
WARNING: line over 80 characters
#420: FILE: drivers/mfd/ab8500-core.c:420:
+ else if (offset == AB8540_INT_GPIO43R || offset == AB8540_INT_GPIO44R)
ERROR: spaces required around that '==' (ctx:VxV)
#454: FILE: drivers/mfd/ab8500-core.c:454:
+ if ((i==3) && (*offset >= 24))
^
ERROR: code indent should use tabs where possible
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
WARNING: please, no spaces at the start of a line
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$
ERROR: code indent should use tabs where possible
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: please, no spaces at the start of a line
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$
WARNING: char * array declaration might be better as static const
#1554: FILE: drivers/mfd/ab8500-core.c:1554:
+ static char *switch_off_status[] = {
WARNING: char * array declaration might be better as static const
#1563: FILE: drivers/mfd/ab8500-core.c:1563:
+ static char *turn_on_status[] = {
WARNING: sizeof *ab8500 should be sizeof(*ab8500)
#1582: FILE: drivers/mfd/ab8500-core.c:1582:
+ ab8500 = devm_kzalloc(&pdev->dev, sizeof *ab8500, GFP_KERNEL);
ERROR: space required after that close brace '}'
#1639: FILE: drivers/mfd/ab8500-core.c:1639:
+ }/* Configure AB8500 or AB9540 IRQ */
WARNING: line over 80 characters
#1652: FILE: drivers/mfd/ab8500-core.c:1652:
+ ab8500->oldmask = devm_kzalloc(&pdev->dev, ab8500->mask_size, GFP_KERNEL);
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1677: FILE: drivers/mfd/ab8500-core.c:1677:
+ printk(KERN_CONT " \"%s\"",
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1682: FILE: drivers/mfd/ab8500-core.c:1682:
+ printk(KERN_CONT "\n");
WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1684: FILE: drivers/mfd/ab8500-core.c:1684:
+ printk(KERN_CONT " None\n");
WARNING: printk() should include KERN_ facility level
#1695: FILE: drivers/mfd/ab8500-core.c:1695:
+ printk("\"%s\" ", turn_on_status[i]);
WARNING: printk() should include KERN_ facility level
#1700: FILE: drivers/mfd/ab8500-core.c:1700:
+ printk("None\n");
total: 5 errors, 14 warnings, 1869 lines checked
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-05-08 21:11:37 +08:00
|
|
|
pr_cont("None\n");
|
2012-09-28 15:34:24 +08:00
|
|
|
}
|
2011-03-02 18:52:36 +08:00
|
|
|
|
2012-05-30 19:02:37 +08:00
|
|
|
if (is_ab9540(ab8500)) {
|
|
|
|
ret = get_register_interruptible(ab8500, AB8500_CHARGER,
|
|
|
|
AB8500_CH_USBCH_STAT1_REG, &value);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
if ((value & VBUS_DET_DBNC1) && (value & VBUS_DET_DBNC100))
|
|
|
|
ab8500_override_turn_on_stat(~AB8500_POW_KEY_1_ON,
|
|
|
|
AB8500_VBUS_DET);
|
|
|
|
}
|
2010-05-19 17:39:02 +08:00
|
|
|
|
|
|
|
/* Clear and mask all interrupts */
|
2012-02-21 04:42:17 +08:00
|
|
|
for (i = 0; i < ab8500->mask_size; i++) {
|
2012-02-21 04:42:10 +08:00
|
|
|
/*
|
|
|
|
* Interrupt register 12 doesn't exist prior to AB8500 version
|
|
|
|
* 2.0
|
|
|
|
*/
|
|
|
|
if (ab8500->irq_reg_offset[i] == 11 &&
|
|
|
|
is_ab8500_1p1_or_earlier(ab8500))
|
2010-12-07 18:20:47 +08:00
|
|
|
continue;
|
2010-05-19 17:39:02 +08:00
|
|
|
|
2013-02-25 22:57:35 +08:00
|
|
|
if (ab8500->irq_reg_offset[i] < 0)
|
|
|
|
continue;
|
|
|
|
|
2010-09-10 23:47:56 +08:00
|
|
|
get_register_interruptible(ab8500, AB8500_INTERRUPT,
|
2012-02-21 04:42:17 +08:00
|
|
|
AB8500_IT_LATCH1_REG + ab8500->irq_reg_offset[i],
|
2010-12-07 18:20:47 +08:00
|
|
|
&value);
|
2010-09-10 23:47:56 +08:00
|
|
|
set_register_interruptible(ab8500, AB8500_INTERRUPT,
|
2012-02-21 04:42:17 +08:00
|
|
|
AB8500_IT_MASK1_REG + ab8500->irq_reg_offset[i], 0xff);
|
2010-05-19 17:39:02 +08:00
|
|
|
}
|
|
|
|
|
2010-09-10 23:47:56 +08:00
|
|
|
ret = abx500_register_ops(ab8500->dev, &ab8500_ops);
|
|
|
|
if (ret)
|
2012-11-05 23:10:35 +08:00
|
|
|
return ret;
|
2010-09-10 23:47:56 +08:00
|
|
|
|
2012-02-21 04:42:17 +08:00
|
|
|
for (i = 0; i < ab8500->mask_size; i++)
|
2010-05-19 17:39:02 +08:00
|
|
|
ab8500->mask[i] = ab8500->oldmask[i] = 0xff;
|
|
|
|
|
2012-06-20 20:56:37 +08:00
|
|
|
ret = ab8500_irq_init(ab8500, np);
|
|
|
|
if (ret)
|
2012-11-05 23:10:35 +08:00
|
|
|
return ret;
|
2010-05-19 17:39:02 +08:00
|
|
|
|
2012-11-26 20:31:26 +08:00
|
|
|
ret = devm_request_threaded_irq(&pdev->dev, ab8500->irq, NULL,
|
|
|
|
ab8500_hierarchical_irq,
|
|
|
|
IRQF_ONESHOT | IRQF_NO_SUSPEND,
|
|
|
|
"ab8500", ab8500);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
2010-05-19 17:39:02 +08:00
|
|
|
|
2012-07-02 23:10:56 +08:00
|
|
|
if (is_ab9540(ab8500))
|
|
|
|
ret = mfd_add_devices(ab8500->dev, 0, ab9540_devs,
|
|
|
|
ARRAY_SIZE(ab9540_devs), NULL,
|
2014-02-04 07:35:56 +08:00
|
|
|
0, ab8500->domain);
|
2013-05-24 17:59:47 +08:00
|
|
|
else if (is_ab8540(ab8500)) {
|
2013-02-12 23:04:09 +08:00
|
|
|
ret = mfd_add_devices(ab8500->dev, 0, ab8540_devs,
|
|
|
|
ARRAY_SIZE(ab8540_devs), NULL,
|
2014-02-04 07:35:56 +08:00
|
|
|
0, ab8500->domain);
|
2013-05-24 17:59:47 +08:00
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
if (is_ab8540_1p2_or_earlier(ab8500))
|
|
|
|
ret = mfd_add_devices(ab8500->dev, 0, ab8540_cut1_devs,
|
|
|
|
ARRAY_SIZE(ab8540_cut1_devs), NULL,
|
2014-02-04 07:35:56 +08:00
|
|
|
0, ab8500->domain);
|
2013-05-24 17:59:47 +08:00
|
|
|
else /* ab8540 >= cut2 */
|
|
|
|
ret = mfd_add_devices(ab8500->dev, 0, ab8540_cut2_devs,
|
|
|
|
ARRAY_SIZE(ab8540_cut2_devs), NULL,
|
2014-02-04 07:35:56 +08:00
|
|
|
0, ab8500->domain);
|
2013-05-24 17:59:47 +08:00
|
|
|
} else if (is_ab8505(ab8500))
|
2013-02-12 23:04:09 +08:00
|
|
|
ret = mfd_add_devices(ab8500->dev, 0, ab8505_devs,
|
|
|
|
ARRAY_SIZE(ab8505_devs), NULL,
|
2014-02-04 07:35:56 +08:00
|
|
|
0, ab8500->domain);
|
2012-07-02 23:10:56 +08:00
|
|
|
else
|
|
|
|
ret = mfd_add_devices(ab8500->dev, 0, ab8500_devs,
|
|
|
|
ARRAY_SIZE(ab8500_devs), NULL,
|
2014-02-04 07:35:56 +08:00
|
|
|
0, ab8500->domain);
|
2012-07-02 23:10:56 +08:00
|
|
|
if (ret)
|
2012-11-05 23:10:35 +08:00
|
|
|
return ret;
|
2012-04-17 15:30:14 +08:00
|
|
|
|
2021-03-07 07:22:27 +08:00
|
|
|
/* Add battery management devices */
|
|
|
|
ret = mfd_add_devices(ab8500->dev, 0, ab8500_bm_devs,
|
|
|
|
ARRAY_SIZE(ab8500_bm_devs), NULL,
|
|
|
|
0, ab8500->domain);
|
|
|
|
if (ret)
|
|
|
|
dev_err(ab8500->dev, "error adding bm devices\n");
|
2012-04-17 15:30:57 +08:00
|
|
|
|
2013-02-26 18:09:41 +08:00
|
|
|
if (((is_ab8505(ab8500) || is_ab9540(ab8500)) &&
|
|
|
|
ab8500->chip_id >= AB8500_CUT2P0) || is_ab8540(ab8500))
|
2012-02-21 04:42:24 +08:00
|
|
|
ret = sysfs_create_group(&ab8500->dev->kobj,
|
|
|
|
&ab9540_attr_group);
|
|
|
|
else
|
|
|
|
ret = sysfs_create_group(&ab8500->dev->kobj,
|
|
|
|
&ab8500_attr_group);
|
2012-05-31 22:16:36 +08:00
|
|
|
|
|
|
|
if ((is_ab8505(ab8500) || is_ab9540(ab8500)) &&
|
|
|
|
ab8500->chip_id >= AB8500_CUT2P0)
|
|
|
|
ret = sysfs_create_group(&ab8500->dev->kobj,
|
|
|
|
&ab8505_attr_group);
|
|
|
|
|
2010-12-02 22:09:36 +08:00
|
|
|
if (ret)
|
|
|
|
dev_err(ab8500->dev, "error creating sysfs entries\n");
|
2012-06-20 20:56:37 +08:00
|
|
|
|
|
|
|
return ret;
|
2010-05-19 17:39:02 +08:00
|
|
|
}
|
|
|
|
|
2012-05-19 23:21:37 +08:00
|
|
|
static const struct platform_device_id ab8500_id[] = {
|
|
|
|
{ "ab8500-core", AB8500_VERSION_AB8500 },
|
2019-11-18 06:10:53 +08:00
|
|
|
{ "ab8505-core", AB8500_VERSION_AB8505 },
|
2012-05-19 23:21:37 +08:00
|
|
|
{ "ab9540-i2c", AB8500_VERSION_AB9540 },
|
|
|
|
{ "ab8540-i2c", AB8500_VERSION_AB8540 },
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_driver ab8500_core_driver = {
|
|
|
|
.driver = {
|
|
|
|
.name = "ab8500-core",
|
2016-10-30 09:24:36 +08:00
|
|
|
.suppress_bind_attrs = true,
|
2012-05-19 23:21:37 +08:00
|
|
|
},
|
|
|
|
.probe = ab8500_probe,
|
|
|
|
.id_table = ab8500_id,
|
|
|
|
};
|
|
|
|
|
|
|
|
static int __init ab8500_core_init(void)
|
|
|
|
{
|
|
|
|
return platform_driver_register(&ab8500_core_driver);
|
|
|
|
}
|
2012-06-11 23:25:00 +08:00
|
|
|
core_initcall(ab8500_core_init);
|